grommet 2.22.0 → 2.23.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/Box/propTypes.js +1 -1
- package/components/Button/index.d.ts +15 -16
- package/components/CheckBox/CheckBox.js +1 -1
- package/components/CheckBox/StyledCheckBox.js +6 -2
- package/components/CheckBox/index.d.ts +2 -1
- package/components/DataChart/DataChart.js +26 -15
- package/components/DataChart/XAxis.js +18 -6
- package/components/DataChart/index.d.ts +1 -1
- package/components/DataChart/propTypes.js +3 -1
- package/components/DataChart/stories/Offset.js +6 -1
- package/components/DataTable/Body.js +76 -24
- package/components/DataTable/Cell.js +10 -4
- package/components/DataTable/DataTable.js +14 -5
- package/components/DataTable/Footer.js +6 -3
- package/components/DataTable/GroupedBody.js +22 -6
- package/components/DataTable/Header.js +85 -40
- package/components/DataTable/StyledDataTable.js +2 -2
- package/components/DataTable/index.d.ts +14 -2
- package/components/DataTable/propTypes.js +9 -2
- package/components/DataTable/stories/Units.js +41 -2
- package/components/DataTable/stories/VerticalAlign.js +51 -0
- package/components/DataTable/stories/typescript/Clickable.tsx +1 -0
- package/components/DataTable/stories/typescript/OnSelect.tsx +5 -10
- package/components/Drop/DropContainer.js +5 -2
- package/components/Drop/index.d.ts +2 -0
- package/components/Footer/index.d.ts +2 -2
- package/components/FormField/index.d.ts +4 -1
- package/components/Header/Header.js +62 -7
- package/components/Header/index.d.ts +8 -2
- package/components/Header/propTypes.js +19 -0
- package/components/Header/stories/Sticky.js +134 -0
- package/components/InfiniteScroll/index.d.ts +1 -0
- package/components/Keyboard/index.d.ts +1 -0
- package/components/List/List.js +5 -2
- package/components/List/index.d.ts +1 -0
- package/components/List/stories/Basic.js +1 -0
- package/components/Main/index.d.ts +2 -2
- package/components/Menu/Menu.js +4 -3
- package/components/Menu/index.d.ts +2 -1
- package/components/Menu/stories/Simple.js +1 -0
- package/components/Menu/stories/typescript/Children.tsx +1 -1
- package/components/NameValueList/index.d.ts +4 -1
- package/components/Nav/index.d.ts +2 -2
- package/components/Page/index.d.ts +2 -2
- package/components/PageContent/index.d.ts +2 -2
- package/components/RadioButton/index.d.ts +2 -1
- package/components/RangeSelector/stories/Thin.js +1 -9
- package/components/Select/SelectContainer.js +17 -10
- package/components/Select/stories/Clear.js +27 -2
- package/components/Spinner/index.d.ts +2 -1
- package/components/TableCell/TableCell.js +8 -4
- package/components/Tip/index.d.ts +1 -0
- package/components/Video/StyledVideo.js +1 -1
- package/components/Video/Video.js +72 -20
- package/components/Video/index.d.ts +14 -8
- package/components/Video/propTypes.js +7 -5
- package/components/Video/stories/typescript/ControlsBelow.tsx +6 -4
- package/components/Video/stories/typescript/Simple.tsx +1 -1
- package/components/Video/stories/typescript/TheaterMode.tsx +1 -2
- package/contexts/ThemeContext/index.d.ts +4 -1
- package/es6/components/Box/propTypes.js +1 -1
- package/es6/components/Button/index.d.ts +15 -16
- package/es6/components/CheckBox/CheckBox.js +1 -1
- package/es6/components/CheckBox/StyledCheckBox.js +6 -2
- package/es6/components/CheckBox/index.d.ts +2 -1
- package/es6/components/DataChart/DataChart.js +26 -15
- package/es6/components/DataChart/XAxis.js +18 -6
- package/es6/components/DataChart/index.d.ts +1 -1
- package/es6/components/DataChart/propTypes.js +3 -1
- package/es6/components/DataChart/stories/Offset.js +6 -1
- package/es6/components/DataTable/Body.js +76 -24
- package/es6/components/DataTable/Cell.js +11 -4
- package/es6/components/DataTable/DataTable.js +14 -5
- package/es6/components/DataTable/Footer.js +6 -3
- package/es6/components/DataTable/GroupedBody.js +22 -6
- package/es6/components/DataTable/Header.js +85 -40
- package/es6/components/DataTable/StyledDataTable.js +2 -2
- package/es6/components/DataTable/index.d.ts +14 -2
- package/es6/components/DataTable/propTypes.js +9 -2
- package/es6/components/DataTable/stories/Units.js +41 -2
- package/es6/components/DataTable/stories/VerticalAlign.js +38 -0
- package/es6/components/DataTable/stories/typescript/Clickable.tsx +1 -0
- package/es6/components/DataTable/stories/typescript/OnSelect.tsx +5 -10
- package/es6/components/Drop/DropContainer.js +5 -2
- package/es6/components/Drop/index.d.ts +2 -0
- package/es6/components/Footer/index.d.ts +2 -2
- package/es6/components/FormField/index.d.ts +4 -1
- package/es6/components/Header/Header.js +57 -6
- package/es6/components/Header/index.d.ts +8 -2
- package/es6/components/Header/propTypes.js +10 -0
- package/es6/components/Header/stories/Sticky.js +121 -0
- package/es6/components/InfiniteScroll/index.d.ts +1 -0
- package/es6/components/Keyboard/index.d.ts +1 -0
- package/es6/components/List/List.js +5 -2
- package/es6/components/List/index.d.ts +1 -0
- package/es6/components/List/stories/Basic.js +1 -0
- package/es6/components/Main/index.d.ts +2 -2
- package/es6/components/Menu/Menu.js +4 -3
- package/es6/components/Menu/index.d.ts +2 -1
- package/es6/components/Menu/stories/Simple.js +1 -0
- package/es6/components/Menu/stories/typescript/Children.tsx +1 -1
- package/es6/components/NameValueList/index.d.ts +4 -1
- package/es6/components/Nav/index.d.ts +2 -2
- package/es6/components/Page/index.d.ts +2 -2
- package/es6/components/PageContent/index.d.ts +2 -2
- package/es6/components/RadioButton/index.d.ts +2 -1
- package/es6/components/RangeSelector/stories/Thin.js +1 -7
- package/es6/components/Select/SelectContainer.js +17 -10
- package/es6/components/Select/stories/Clear.js +27 -2
- package/es6/components/Spinner/index.d.ts +2 -1
- package/es6/components/TableCell/TableCell.js +7 -4
- package/es6/components/Tip/index.d.ts +1 -0
- package/es6/components/Video/StyledVideo.js +2 -2
- package/es6/components/Video/Video.js +71 -20
- package/es6/components/Video/index.d.ts +14 -8
- package/es6/components/Video/propTypes.js +7 -5
- package/es6/components/Video/stories/typescript/ControlsBelow.tsx +6 -4
- package/es6/components/Video/stories/typescript/Simple.tsx +1 -1
- package/es6/components/Video/stories/typescript/TheaterMode.tsx +1 -2
- package/es6/contexts/ThemeContext/index.d.ts +4 -1
- package/es6/themes/base.d.ts +21 -14
- package/es6/themes/base.js +10 -3
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/package.json +40 -40
- package/themes/base.d.ts +21 -14
- package/themes/base.js +10 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["alignSelf", "autoPlay", "children", "controls", "gridArea", "loop", "margin", "messages", "mute", "onDurationChange", "onEnded", "onPause", "onPlay", "onTimeUpdate", "onVolumeChange"];
|
|
1
|
+
var _excluded = ["alignSelf", "autoPlay", "children", "controls", "gridArea", "loop", "margin", "messages", "mute", "onDurationChange", "onEnded", "onPause", "onPlay", "onTimeUpdate", "onVolumeChange", "skipInterval"];
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
@@ -14,6 +14,7 @@ import { Menu } from '../Menu';
|
|
|
14
14
|
import { Meter } from '../Meter';
|
|
15
15
|
import { Stack } from '../Stack';
|
|
16
16
|
import { Text } from '../Text';
|
|
17
|
+
import { Keyboard } from '../Keyboard';
|
|
17
18
|
import { containsFocus, useForwardedRef } from '../../utils';
|
|
18
19
|
import { StyledVideo, StyledVideoContainer, StyledVideoControls, StyledVideoScrubber } from './StyledVideo';
|
|
19
20
|
import { MessageContext } from '../../contexts/MessageContext';
|
|
@@ -53,6 +54,7 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
53
54
|
_onPlay = _ref.onPlay,
|
|
54
55
|
_onTimeUpdate = _ref.onTimeUpdate,
|
|
55
56
|
_onVolumeChange = _ref.onVolumeChange,
|
|
57
|
+
skipInterval = _ref.skipInterval,
|
|
56
58
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
57
59
|
|
|
58
60
|
var theme = useContext(ThemeContext) || defaultProps.theme;
|
|
@@ -189,24 +191,30 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
189
191
|
|
|
190
192
|
if (textTracks.length > 0) {
|
|
191
193
|
if (textTracks.length === 1) {
|
|
192
|
-
|
|
194
|
+
// only one track was provided
|
|
195
|
+
var track = textTracks[0];
|
|
196
|
+
var active = track.mode === 'showing';
|
|
193
197
|
|
|
194
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
|
|
195
201
|
setCaptions([{
|
|
202
|
+
label: track.label,
|
|
196
203
|
active: active
|
|
197
204
|
}]);
|
|
198
205
|
}
|
|
199
206
|
} else {
|
|
207
|
+
// multiple tracks provided
|
|
200
208
|
var nextCaptions = [];
|
|
201
209
|
var set = false;
|
|
202
210
|
|
|
203
211
|
for (var i = 0; i < textTracks.length; i += 1) {
|
|
204
|
-
var
|
|
212
|
+
var _track = textTracks[i];
|
|
205
213
|
|
|
206
|
-
var _active =
|
|
214
|
+
var _active = _track.mode === 'showing';
|
|
207
215
|
|
|
208
216
|
nextCaptions.push({
|
|
209
|
-
label:
|
|
217
|
+
label: _track.label,
|
|
210
218
|
active: _active
|
|
211
219
|
});
|
|
212
220
|
|
|
@@ -242,21 +250,27 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
242
250
|
if (duration) videoRef.current.currentTime = duration * percent;
|
|
243
251
|
}
|
|
244
252
|
}, [duration, videoRef]);
|
|
253
|
+
var seekForward = useCallback(function () {
|
|
254
|
+
setInteracting(true);
|
|
255
|
+
videoRef.current.currentTime += skipInterval || theme.video.scrubber.interval;
|
|
256
|
+
}, [skipInterval, theme.video.scrubber.interval, videoRef]);
|
|
257
|
+
var seekBackward = useCallback(function () {
|
|
258
|
+
setInteracting(true);
|
|
259
|
+
videoRef.current.currentTime -= skipInterval || theme.video.scrubber.interval;
|
|
260
|
+
}, [skipInterval, theme.video.scrubber.interval, videoRef]);
|
|
245
261
|
var louder = useCallback(function () {
|
|
246
262
|
videoRef.current.volume += VOLUME_STEP;
|
|
247
263
|
}, [videoRef]);
|
|
248
264
|
var quieter = useCallback(function () {
|
|
249
265
|
videoRef.current.volume -= VOLUME_STEP;
|
|
250
266
|
}, [videoRef]);
|
|
251
|
-
|
|
252
|
-
var showCaptions = function showCaptions(index) {
|
|
267
|
+
var showCaptions = useCallback(function (index) {
|
|
253
268
|
var textTracks = videoRef.current.textTracks;
|
|
254
269
|
|
|
255
270
|
for (var i = 0; i < textTracks.length; i += 1) {
|
|
256
271
|
textTracks[i].mode = i === index ? 'showing' : 'hidden';
|
|
257
272
|
}
|
|
258
|
-
};
|
|
259
|
-
|
|
273
|
+
}, [videoRef]);
|
|
260
274
|
var fullscreen = useCallback(function () {
|
|
261
275
|
var video = videoRef.current;
|
|
262
276
|
|
|
@@ -294,15 +308,26 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
294
308
|
ReduceVolume: theme.video.icons.reduceVolume,
|
|
295
309
|
Volume: theme.video.icons.volume
|
|
296
310
|
};
|
|
297
|
-
var captionControls = captions.map(function (caption) {
|
|
311
|
+
var captionControls = captions.map(function (caption, index) {
|
|
298
312
|
return {
|
|
299
313
|
icon: caption.label ? undefined : /*#__PURE__*/React.createElement(Icons.ClosedCaption, {
|
|
300
314
|
color: iconColor
|
|
301
315
|
}),
|
|
302
316
|
label: caption.label,
|
|
303
317
|
active: caption.active,
|
|
318
|
+
a11yTitle: caption.label || 'video.captions',
|
|
304
319
|
onClick: function onClick() {
|
|
305
|
-
|
|
320
|
+
showCaptions(caption.active ? -1 : index);
|
|
321
|
+
var updatedCaptions = [];
|
|
322
|
+
|
|
323
|
+
for (var i = 0; i < captions.length; i += 1) {
|
|
324
|
+
updatedCaptions.push(captions[i]); // set other captions to active=false
|
|
325
|
+
|
|
326
|
+
if (i !== index && updatedCaptions[i].active) updatedCaptions[i].active = false; // set the currently selected captions to active
|
|
327
|
+
else if (i === index) updatedCaptions[i].active = !captions[index].active;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
setCaptions(updatedCaptions);
|
|
306
331
|
}
|
|
307
332
|
};
|
|
308
333
|
});
|
|
@@ -352,7 +377,8 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
352
377
|
id: 'video.pauseButton',
|
|
353
378
|
messages: messages
|
|
354
379
|
}),
|
|
355
|
-
|
|
380
|
+
disabled: !playing,
|
|
381
|
+
onClick: pause
|
|
356
382
|
},
|
|
357
383
|
play: {
|
|
358
384
|
icon: /*#__PURE__*/React.createElement(Icons.Play, {
|
|
@@ -362,7 +388,8 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
362
388
|
id: 'video.playButton',
|
|
363
389
|
messages: messages
|
|
364
390
|
}),
|
|
365
|
-
|
|
391
|
+
disabled: playing,
|
|
392
|
+
onClick: play
|
|
366
393
|
}
|
|
367
394
|
};
|
|
368
395
|
var controlsMenuItems = [];
|
|
@@ -374,7 +401,18 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
374
401
|
return undefined;
|
|
375
402
|
}
|
|
376
403
|
|
|
377
|
-
if (
|
|
404
|
+
if (item === 'captions' && typeof buttonProps[item] === 'object') {
|
|
405
|
+
for (var i = 0; i < buttonProps[item].length; i += 1) {
|
|
406
|
+
controlsMenuItems.push(buttonProps[item][i]);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
return undefined;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
if (typeof item === 'string') {
|
|
413
|
+
return controlsMenuItems.push(buttonProps[item]);
|
|
414
|
+
}
|
|
415
|
+
|
|
378
416
|
return controlsMenuItems.push(item);
|
|
379
417
|
});
|
|
380
418
|
controlsElement = /*#__PURE__*/React.createElement(StyledVideoControls, {
|
|
@@ -403,7 +441,10 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
403
441
|
})
|
|
404
442
|
}),
|
|
405
443
|
hoverIndicator: "background",
|
|
406
|
-
onClick: playing ? pause : play
|
|
444
|
+
onClick: playing ? pause : play,
|
|
445
|
+
onFocus: function onFocus() {
|
|
446
|
+
return setInteracting(true);
|
|
447
|
+
}
|
|
407
448
|
}), /*#__PURE__*/React.createElement(Box, {
|
|
408
449
|
direction: "row",
|
|
409
450
|
align: "center",
|
|
@@ -434,7 +475,10 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
434
475
|
onMouseLeave: function onMouseLeave() {
|
|
435
476
|
return setScrubTime(undefined);
|
|
436
477
|
},
|
|
437
|
-
onClick: seek
|
|
478
|
+
onClick: seek,
|
|
479
|
+
onFocus: function onFocus() {
|
|
480
|
+
return setInteracting(true);
|
|
481
|
+
}
|
|
438
482
|
}))), /*#__PURE__*/React.createElement(Box, {
|
|
439
483
|
pad: {
|
|
440
484
|
horizontal: 'small'
|
|
@@ -460,7 +504,10 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
460
504
|
messages: messages
|
|
461
505
|
})
|
|
462
506
|
},
|
|
463
|
-
items: [].concat(controlsMenuItems)
|
|
507
|
+
items: [].concat(controlsMenuItems),
|
|
508
|
+
onFocus: function onFocus() {
|
|
509
|
+
return setInteracting(true);
|
|
510
|
+
}
|
|
464
511
|
})));
|
|
465
512
|
}
|
|
466
513
|
|
|
@@ -496,13 +543,17 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
496
543
|
}
|
|
497
544
|
}
|
|
498
545
|
|
|
499
|
-
return /*#__PURE__*/React.createElement(
|
|
546
|
+
return /*#__PURE__*/React.createElement(Keyboard, {
|
|
547
|
+
onLeft: seekBackward,
|
|
548
|
+
onRight: seekForward
|
|
549
|
+
}, /*#__PURE__*/React.createElement(StyledVideoContainer, _extends({
|
|
500
550
|
ref: containerRef
|
|
501
551
|
}, mouseEventListeners, {
|
|
502
552
|
alignSelf: alignSelf,
|
|
503
553
|
gridArea: gridArea,
|
|
504
554
|
margin: margin,
|
|
505
|
-
style: style
|
|
555
|
+
style: style,
|
|
556
|
+
tabIndex: "-1"
|
|
506
557
|
}), /*#__PURE__*/React.createElement(StyledVideo, _extends({}, rest, {
|
|
507
558
|
ref: videoRef,
|
|
508
559
|
onDurationChange: function onDurationChange(event) {
|
|
@@ -536,7 +587,7 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
536
587
|
},
|
|
537
588
|
autoPlay: autoPlay || false,
|
|
538
589
|
loop: loop || false
|
|
539
|
-
}), children), controlsElement);
|
|
590
|
+
}), children), controlsElement));
|
|
540
591
|
});
|
|
541
592
|
Video.defaultProps = {};
|
|
542
593
|
Video.displayName = 'Video';
|
|
@@ -7,6 +7,18 @@ import {
|
|
|
7
7
|
Omit,
|
|
8
8
|
} from '../../utils';
|
|
9
9
|
|
|
10
|
+
type controlsItems =
|
|
11
|
+
| 'captions'
|
|
12
|
+
| 'fullScreen'
|
|
13
|
+
| 'play'
|
|
14
|
+
| 'pause'
|
|
15
|
+
| 'volume'
|
|
16
|
+
| {
|
|
17
|
+
icon?: React.ReactNode;
|
|
18
|
+
a11yTitle?: A11yTitleType;
|
|
19
|
+
onClick?: (...args: any[]) => any;
|
|
20
|
+
};
|
|
21
|
+
|
|
10
22
|
export interface VideoProps {
|
|
11
23
|
a11yTitle?: A11yTitleType;
|
|
12
24
|
alignSelf?: AlignSelfType;
|
|
@@ -17,14 +29,7 @@ export interface VideoProps {
|
|
|
17
29
|
| 'below'
|
|
18
30
|
| {
|
|
19
31
|
position?: false | 'over' | 'below';
|
|
20
|
-
items?: [
|
|
21
|
-
'captions' | 'fullScreen' | 'play' | 'pause' | 'volume',
|
|
22
|
-
{
|
|
23
|
-
icon?: React.ReactNode;
|
|
24
|
-
a11yTitle?: A11yTitleType;
|
|
25
|
-
onClick?: () => {};
|
|
26
|
-
},
|
|
27
|
-
];
|
|
32
|
+
items?: controlsItems[];
|
|
28
33
|
};
|
|
29
34
|
fit?: 'cover' | 'contain';
|
|
30
35
|
gridArea?: GridAreaType;
|
|
@@ -42,6 +47,7 @@ export interface VideoProps {
|
|
|
42
47
|
volumeDown?: string;
|
|
43
48
|
};
|
|
44
49
|
mute?: boolean;
|
|
50
|
+
skipInterval?: number;
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
export interface VideoExtendedProps
|
|
@@ -8,11 +8,12 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
8
8
|
PropType = _extends({}, genericProps, {
|
|
9
9
|
autoPlay: PropTypes.bool,
|
|
10
10
|
controls: PropTypes.oneOfType([PropTypes.oneOf([false, 'over', 'below']), PropTypes.shape({
|
|
11
|
-
position: PropTypes.oneOf[
|
|
12
|
-
items: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.
|
|
11
|
+
position: PropTypes.oneOf([false, 'over', 'below']),
|
|
12
|
+
items: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf(['captions', 'fullScreen', 'play', 'pause', 'volume']), PropTypes.shape({
|
|
13
13
|
icon: PropTypes.element,
|
|
14
14
|
a11yTitle: PropTypes.string,
|
|
15
|
-
onClick: PropTypes.func
|
|
15
|
+
onClick: PropTypes.func,
|
|
16
|
+
disabled: PropTypes.bool
|
|
16
17
|
})]))
|
|
17
18
|
})]),
|
|
18
19
|
fit: PropTypes.oneOf(['cover', 'contain']),
|
|
@@ -21,14 +22,15 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
21
22
|
messages: PropTypes.shape({
|
|
22
23
|
closeMenu: PropTypes.string,
|
|
23
24
|
fullScreen: PropTypes.string,
|
|
24
|
-
progressMeter: PropTypes.string,
|
|
25
25
|
openMenu: PropTypes.string,
|
|
26
26
|
pauseButton: PropTypes.string,
|
|
27
27
|
playButton: PropTypes.string,
|
|
28
|
+
progressMeter: PropTypes.string,
|
|
28
29
|
scrubber: PropTypes.string,
|
|
29
30
|
volumeDown: PropTypes.string,
|
|
30
31
|
volumeUp: PropTypes.string
|
|
31
|
-
})
|
|
32
|
+
}),
|
|
33
|
+
skipInterval: PropTypes.number
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
36
|
|
|
@@ -2,9 +2,12 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { Box, Video } from 'grommet';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
export const ControlsBelow = () => (
|
|
6
6
|
<Box align="center" pad="large">
|
|
7
|
-
<Video
|
|
7
|
+
<Video
|
|
8
|
+
skipInterval={2}
|
|
9
|
+
controls={{ position: 'below', items: ['captions'] }}
|
|
10
|
+
>
|
|
8
11
|
<source src="small.mp4" type="video/mp4" />
|
|
9
12
|
<source
|
|
10
13
|
src="http://techslides.com/demos/sample-videos/small.webm"
|
|
@@ -18,12 +21,11 @@ const SimpleVideo = (props) => (
|
|
|
18
21
|
src="http://techslides.com/demos/sample-videos/small.3gp"
|
|
19
22
|
type="video/3gp"
|
|
20
23
|
/>
|
|
24
|
+
<track kind="subtitles" srcLang="en" src="small-en.vtt" />
|
|
21
25
|
</Video>
|
|
22
26
|
</Box>
|
|
23
27
|
);
|
|
24
28
|
|
|
25
|
-
export const ControlsBelow = () => <SimpleVideo controls="below" />;
|
|
26
|
-
|
|
27
29
|
ControlsBelow.storyName = 'Controls below';
|
|
28
30
|
|
|
29
31
|
export default {
|
|
@@ -3,7 +3,7 @@ import React, { useState } from 'react';
|
|
|
3
3
|
import { Box, Video } from 'grommet';
|
|
4
4
|
import { Monitor } from 'grommet-icons/icons/Monitor';
|
|
5
5
|
|
|
6
|
-
const TheaterMode = (
|
|
6
|
+
const TheaterMode = () => {
|
|
7
7
|
const [theaterMode, setTheaterMode] = useState(false);
|
|
8
8
|
|
|
9
9
|
return (
|
|
@@ -27,7 +27,6 @@ const TheaterMode = (props) => {
|
|
|
27
27
|
'fullScreen',
|
|
28
28
|
],
|
|
29
29
|
}}
|
|
30
|
-
{...props}
|
|
31
30
|
/>
|
|
32
31
|
</Box>
|
|
33
32
|
);
|
|
@@ -3,7 +3,10 @@ import * as React from 'react';
|
|
|
3
3
|
export type ThemeValue = object;
|
|
4
4
|
|
|
5
5
|
export interface ThemeContextI extends React.Context<ThemeValue> {
|
|
6
|
-
Extend: React.FC<{
|
|
6
|
+
Extend: React.FC<{
|
|
7
|
+
value: ThemeValue;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}>;
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
declare const ThemeContext: ThemeContextI;
|
package/es6/themes/base.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
ThemedStyledProps,
|
|
5
5
|
} from 'styled-components';
|
|
6
6
|
import { ReactComponentElement } from 'react';
|
|
7
|
+
import { Icon } from 'grommet-icons';
|
|
7
8
|
|
|
8
9
|
import {
|
|
9
10
|
BackgroundType,
|
|
@@ -819,6 +820,11 @@ export interface ThemeType {
|
|
|
819
820
|
grommet?: {
|
|
820
821
|
extend?: ExtendType;
|
|
821
822
|
};
|
|
823
|
+
header?: {
|
|
824
|
+
sticky?: {
|
|
825
|
+
zIndex?: string;
|
|
826
|
+
};
|
|
827
|
+
};
|
|
822
828
|
heading?: {
|
|
823
829
|
color?: ColorType;
|
|
824
830
|
extend?: ExtendType;
|
|
@@ -1009,8 +1015,8 @@ export interface ThemeType {
|
|
|
1009
1015
|
extend?: ExtendType;
|
|
1010
1016
|
};
|
|
1011
1017
|
icons?: {
|
|
1012
|
-
down?: React.ReactNode;
|
|
1013
|
-
up?: React.ReactNode;
|
|
1018
|
+
down?: React.ReactNode | Icon;
|
|
1019
|
+
up?: React.ReactNode | Icon;
|
|
1014
1020
|
};
|
|
1015
1021
|
extend?: ExtendType;
|
|
1016
1022
|
};
|
|
@@ -1057,11 +1063,11 @@ export interface ThemeType {
|
|
|
1057
1063
|
title?: TextProps;
|
|
1058
1064
|
message?: TextProps;
|
|
1059
1065
|
close?: {
|
|
1060
|
-
icon?: React.ReactNode;
|
|
1066
|
+
icon?: React.ReactNode | Icon;
|
|
1061
1067
|
color?: ColorType;
|
|
1062
1068
|
};
|
|
1063
1069
|
critical?: {
|
|
1064
|
-
icon?: React.ReactNode;
|
|
1070
|
+
icon?: React.ReactNode | Icon;
|
|
1065
1071
|
background?: BackgroundType;
|
|
1066
1072
|
color?: ColorType;
|
|
1067
1073
|
global?: {
|
|
@@ -1072,7 +1078,7 @@ export interface ThemeType {
|
|
|
1072
1078
|
};
|
|
1073
1079
|
};
|
|
1074
1080
|
warning?: {
|
|
1075
|
-
icon?: React.ReactNode;
|
|
1081
|
+
icon?: React.ReactNode | Icon;
|
|
1076
1082
|
background?: BackgroundType;
|
|
1077
1083
|
color?: ColorType;
|
|
1078
1084
|
global?: {
|
|
@@ -1083,7 +1089,7 @@ export interface ThemeType {
|
|
|
1083
1089
|
};
|
|
1084
1090
|
};
|
|
1085
1091
|
normal?: {
|
|
1086
|
-
icon?: React.ReactNode;
|
|
1092
|
+
icon?: React.ReactNode | Icon;
|
|
1087
1093
|
background?: BackgroundType;
|
|
1088
1094
|
color?: ColorType;
|
|
1089
1095
|
global?: {
|
|
@@ -1094,7 +1100,7 @@ export interface ThemeType {
|
|
|
1094
1100
|
};
|
|
1095
1101
|
};
|
|
1096
1102
|
info?: {
|
|
1097
|
-
icon?: React.ReactNode;
|
|
1103
|
+
icon?: React.ReactNode | Icon;
|
|
1098
1104
|
background?: BackgroundType;
|
|
1099
1105
|
color?: ColorType;
|
|
1100
1106
|
global?: {
|
|
@@ -1105,7 +1111,7 @@ export interface ThemeType {
|
|
|
1105
1111
|
};
|
|
1106
1112
|
};
|
|
1107
1113
|
unknown?: {
|
|
1108
|
-
icon?: React.ReactNode;
|
|
1114
|
+
icon?: React.ReactNode | Icon;
|
|
1109
1115
|
background?: BackgroundType;
|
|
1110
1116
|
color?: ColorType;
|
|
1111
1117
|
global?: {
|
|
@@ -1116,7 +1122,7 @@ export interface ThemeType {
|
|
|
1116
1122
|
};
|
|
1117
1123
|
};
|
|
1118
1124
|
undefined?: {
|
|
1119
|
-
icon?: React.ReactNode;
|
|
1125
|
+
icon?: React.ReactNode | Icon;
|
|
1120
1126
|
background?: BackgroundType;
|
|
1121
1127
|
color?: ColorType;
|
|
1122
1128
|
global?: {
|
|
@@ -1153,8 +1159,8 @@ export interface ThemeType {
|
|
|
1153
1159
|
};
|
|
1154
1160
|
icons?: {
|
|
1155
1161
|
color?: ColorType;
|
|
1156
|
-
next?: React.ReactNode;
|
|
1157
|
-
previous?: React.ReactNode;
|
|
1162
|
+
next?: React.ReactNode | Icon;
|
|
1163
|
+
previous?: React.ReactNode | Icon;
|
|
1158
1164
|
};
|
|
1159
1165
|
};
|
|
1160
1166
|
paragraph?: {
|
|
@@ -1310,8 +1316,8 @@ export interface ThemeType {
|
|
|
1310
1316
|
extend?: ExtendType;
|
|
1311
1317
|
icons?: {
|
|
1312
1318
|
color?: ColorType;
|
|
1313
|
-
down?: React.ReactNode;
|
|
1314
|
-
up?: React.ReactNode;
|
|
1319
|
+
down?: React.ReactNode | Icon;
|
|
1320
|
+
up?: React.ReactNode | Icon;
|
|
1315
1321
|
margin?: MarginType;
|
|
1316
1322
|
};
|
|
1317
1323
|
options?: {
|
|
@@ -1332,7 +1338,7 @@ export interface ThemeType {
|
|
|
1332
1338
|
| BoxProps
|
|
1333
1339
|
| { color?: ColorType }
|
|
1334
1340
|
| { size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | string };
|
|
1335
|
-
icon?: React.ReactNode;
|
|
1341
|
+
icon?: React.ReactNode | Icon;
|
|
1336
1342
|
size?: {
|
|
1337
1343
|
xsmall?: string;
|
|
1338
1344
|
small?: string;
|
|
@@ -1566,6 +1572,7 @@ export interface ThemeType {
|
|
|
1566
1572
|
};
|
|
1567
1573
|
scrubber?: {
|
|
1568
1574
|
color?: ColorType;
|
|
1575
|
+
interval: number;
|
|
1569
1576
|
track?: {
|
|
1570
1577
|
color?: ColorType;
|
|
1571
1578
|
};
|
package/es6/themes/base.js
CHANGED
|
@@ -863,7 +863,8 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
863
863
|
color: 'text-xweak',
|
|
864
864
|
margin: {
|
|
865
865
|
left: 'xsmall'
|
|
866
|
-
}
|
|
866
|
+
},
|
|
867
|
+
alignSelf: 'end'
|
|
867
868
|
}
|
|
868
869
|
},
|
|
869
870
|
icons: {
|
|
@@ -1010,6 +1011,11 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1010
1011
|
},
|
|
1011
1012
|
grommet: {// extend: undefined
|
|
1012
1013
|
},
|
|
1014
|
+
header: {
|
|
1015
|
+
sticky: {
|
|
1016
|
+
zIndex: '20'
|
|
1017
|
+
}
|
|
1018
|
+
},
|
|
1013
1019
|
heading: {
|
|
1014
1020
|
// color: undefined,
|
|
1015
1021
|
font: {// family: undefined
|
|
@@ -1830,9 +1836,10 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1830
1836
|
volume: Volume // color: { dark: undefined, light: undefined },
|
|
1831
1837
|
|
|
1832
1838
|
},
|
|
1833
|
-
// scrubber: { track: { color: undefined } },
|
|
1834
1839
|
scrubber: {
|
|
1835
|
-
color: 'light-4'
|
|
1840
|
+
color: 'light-4',
|
|
1841
|
+
interval: 10 // track: { color: undefined }
|
|
1842
|
+
|
|
1836
1843
|
}
|
|
1837
1844
|
},
|
|
1838
1845
|
worldMap: {
|