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
|
@@ -25,8 +25,8 @@ var ClearTop = function ClearTop() {
|
|
|
25
25
|
pad: "large"
|
|
26
26
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.Select, {
|
|
27
27
|
placeholder: "Clear Options",
|
|
28
|
-
multiple: true,
|
|
29
28
|
value: value,
|
|
29
|
+
multiple: true,
|
|
30
30
|
options: options,
|
|
31
31
|
onChange: function onChange(_ref) {
|
|
32
32
|
var nextValue = _ref.value;
|
|
@@ -36,12 +36,37 @@ var ClearTop = function ClearTop() {
|
|
|
36
36
|
}));
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
+
var ClearBottom = function ClearBottom() {
|
|
40
|
+
var _useState2 = (0, _react.useState)(),
|
|
41
|
+
value = _useState2[0],
|
|
42
|
+
setValue = _useState2[1];
|
|
43
|
+
|
|
44
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
45
|
+
fill: true,
|
|
46
|
+
align: "center",
|
|
47
|
+
justify: "start",
|
|
48
|
+
pad: "large"
|
|
49
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Select, {
|
|
50
|
+
placeholder: "Clear Options",
|
|
51
|
+
value: value,
|
|
52
|
+
multiple: true,
|
|
53
|
+
options: options,
|
|
54
|
+
onChange: function onChange(_ref2) {
|
|
55
|
+
var nextValue = _ref2.value;
|
|
56
|
+
return setValue(nextValue);
|
|
57
|
+
},
|
|
58
|
+
clear: {
|
|
59
|
+
position: 'bottom'
|
|
60
|
+
}
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
63
|
+
|
|
39
64
|
var Clear = function Clear() {
|
|
40
65
|
return (
|
|
41
66
|
/*#__PURE__*/
|
|
42
67
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
43
68
|
// <Grommet theme={...}>
|
|
44
|
-
_react["default"].createElement(ClearTop, null) // </Grommet>
|
|
69
|
+
_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(ClearTop, null), /*#__PURE__*/_react["default"].createElement(ClearBottom, null)) // </Grommet>
|
|
45
70
|
|
|
46
71
|
);
|
|
47
72
|
};
|
|
@@ -4,8 +4,9 @@ import { ColorType } from 'grommet/utils';
|
|
|
4
4
|
import { BoxProps } from '../Box/index';
|
|
5
5
|
|
|
6
6
|
export interface SpinnerProps {
|
|
7
|
-
|
|
7
|
+
children?: React.ReactNode;
|
|
8
8
|
color?: ColorType;
|
|
9
|
+
size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | string;
|
|
9
10
|
message?: string | { start?: string; end?: string };
|
|
10
11
|
}
|
|
11
12
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.TableCell = void 0;
|
|
4
|
+
exports.verticalAlignToJustify = exports.TableCell = void 0;
|
|
5
5
|
|
|
6
6
|
var _react = _interopRequireWildcard(require("react"));
|
|
7
7
|
|
|
@@ -21,7 +21,7 @@ var _StyledTable = require("../Table/StyledTable");
|
|
|
21
21
|
|
|
22
22
|
var _propTypes = require("./propTypes");
|
|
23
23
|
|
|
24
|
-
var _excluded = ["align", "background", "border", "children", "className", "colSpan", "onWidth", "pad", "plain", "rowSpan", "scope", "size", "verticalAlign"];
|
|
24
|
+
var _excluded = ["align", "aria-disabled", "background", "border", "children", "className", "colSpan", "onWidth", "pad", "plain", "rowSpan", "scope", "size", "verticalAlign"];
|
|
25
25
|
|
|
26
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
27
|
|
|
@@ -36,8 +36,10 @@ var verticalAlignToJustify = {
|
|
|
36
36
|
top: 'start',
|
|
37
37
|
bottom: 'end'
|
|
38
38
|
};
|
|
39
|
+
exports.verticalAlignToJustify = verticalAlignToJustify;
|
|
39
40
|
var TableCell = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
40
41
|
var align = _ref.align,
|
|
42
|
+
ariaDisabled = _ref['aria-disabled'],
|
|
41
43
|
background = _ref.background,
|
|
42
44
|
border = _ref.border,
|
|
43
45
|
children = _ref.children,
|
|
@@ -105,16 +107,18 @@ var TableCell = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
105
107
|
|
|
106
108
|
Object.keys(mergedProps).forEach(function (key) {
|
|
107
109
|
if (rest[key] === undefined) mergedProps[key] = tableContextTheme[key];
|
|
108
|
-
}); // split out background, border, and
|
|
110
|
+
}); // split out background, border, pad, and aria-disabled
|
|
109
111
|
|
|
110
112
|
var cellProps = {
|
|
111
113
|
align: align || mergedProps.align || undefined,
|
|
114
|
+
'aria-disabled': ariaDisabled || undefined,
|
|
112
115
|
background: background || mergedProps.background || undefined,
|
|
113
116
|
border: border || mergedProps.border || undefined,
|
|
114
117
|
pad: plain !== 'noPad' ? pad || mergedProps.pad || undefined : undefined,
|
|
115
118
|
verticalAlign: verticalAlign || mergedProps.verticalAlign || undefined
|
|
116
119
|
};
|
|
117
120
|
delete mergedProps.align;
|
|
121
|
+
delete mergedProps.ariaDisabled;
|
|
118
122
|
delete mergedProps.background;
|
|
119
123
|
delete mergedProps.border;
|
|
120
124
|
delete mergedProps.pad;
|
|
@@ -127,7 +131,7 @@ var TableCell = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
127
131
|
// TableCell
|
|
128
132
|
content = /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
129
133
|
ref: containerRef,
|
|
130
|
-
justify:
|
|
134
|
+
justify: verticalAlign ? verticalAlignToJustify[verticalAlign] : 'center'
|
|
131
135
|
}, children);
|
|
132
136
|
} // construct a new theme object in case we have a background that wants
|
|
133
137
|
// to change the background color context
|
|
@@ -39,7 +39,7 @@ Object.setPrototypeOf(StyledVideo.defaultProps, _defaultProps.defaultProps);
|
|
|
39
39
|
var StyledVideoContainer = _styledComponents["default"].div.withConfig({
|
|
40
40
|
displayName: "StyledVideo__StyledVideoContainer",
|
|
41
41
|
componentId: "sc-w4v8h9-1"
|
|
42
|
-
})(["flex:1 1;display:flex;flex-direction:column;overflow:hidden;position:relative;", "
|
|
42
|
+
})(["flex:1 1;display:flex;flex-direction:column;overflow:hidden;position:relative;", ";&:focus{", "}"], _utils.genericStyles, (0, _utils.focusStyle)());
|
|
43
43
|
|
|
44
44
|
exports.StyledVideoContainer = StyledVideoContainer;
|
|
45
45
|
StyledVideoContainer.defaultProps = {};
|
|
@@ -23,6 +23,8 @@ var _Stack = require("../Stack");
|
|
|
23
23
|
|
|
24
24
|
var _Text = require("../Text");
|
|
25
25
|
|
|
26
|
+
var _Keyboard = require("../Keyboard");
|
|
27
|
+
|
|
26
28
|
var _utils = require("../../utils");
|
|
27
29
|
|
|
28
30
|
var _StyledVideo = require("./StyledVideo");
|
|
@@ -31,7 +33,7 @@ var _MessageContext = require("../../contexts/MessageContext");
|
|
|
31
33
|
|
|
32
34
|
var _propTypes = require("./propTypes");
|
|
33
35
|
|
|
34
|
-
var _excluded = ["alignSelf", "autoPlay", "children", "controls", "gridArea", "loop", "margin", "messages", "mute", "onDurationChange", "onEnded", "onPause", "onPlay", "onTimeUpdate", "onVolumeChange"];
|
|
36
|
+
var _excluded = ["alignSelf", "autoPlay", "children", "controls", "gridArea", "loop", "margin", "messages", "mute", "onDurationChange", "onEnded", "onPause", "onPlay", "onTimeUpdate", "onVolumeChange", "skipInterval"];
|
|
35
37
|
|
|
36
38
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
39
|
|
|
@@ -76,6 +78,7 @@ var Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
76
78
|
_onPlay = _ref.onPlay,
|
|
77
79
|
_onTimeUpdate = _ref.onTimeUpdate,
|
|
78
80
|
_onVolumeChange = _ref.onVolumeChange,
|
|
81
|
+
skipInterval = _ref.skipInterval,
|
|
79
82
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
80
83
|
|
|
81
84
|
var theme = (0, _react.useContext)(_styledComponents.ThemeContext) || _defaultProps.defaultProps.theme;
|
|
@@ -212,24 +215,30 @@ var Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
212
215
|
|
|
213
216
|
if (textTracks.length > 0) {
|
|
214
217
|
if (textTracks.length === 1) {
|
|
215
|
-
|
|
218
|
+
// only one track was provided
|
|
219
|
+
var track = textTracks[0];
|
|
220
|
+
var active = track.mode === 'showing';
|
|
216
221
|
|
|
217
222
|
if (!captions || !captions[0] || captions[0].active !== active) {
|
|
223
|
+
// get label if provided and if the track is active
|
|
224
|
+
// (currently showing) or not
|
|
218
225
|
setCaptions([{
|
|
226
|
+
label: track.label,
|
|
219
227
|
active: active
|
|
220
228
|
}]);
|
|
221
229
|
}
|
|
222
230
|
} else {
|
|
231
|
+
// multiple tracks provided
|
|
223
232
|
var nextCaptions = [];
|
|
224
233
|
var set = false;
|
|
225
234
|
|
|
226
235
|
for (var i = 0; i < textTracks.length; i += 1) {
|
|
227
|
-
var
|
|
236
|
+
var _track = textTracks[i];
|
|
228
237
|
|
|
229
|
-
var _active =
|
|
238
|
+
var _active = _track.mode === 'showing';
|
|
230
239
|
|
|
231
240
|
nextCaptions.push({
|
|
232
|
-
label:
|
|
241
|
+
label: _track.label,
|
|
233
242
|
active: _active
|
|
234
243
|
});
|
|
235
244
|
|
|
@@ -265,21 +274,27 @@ var Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
265
274
|
if (duration) videoRef.current.currentTime = duration * percent;
|
|
266
275
|
}
|
|
267
276
|
}, [duration, videoRef]);
|
|
277
|
+
var seekForward = (0, _react.useCallback)(function () {
|
|
278
|
+
setInteracting(true);
|
|
279
|
+
videoRef.current.currentTime += skipInterval || theme.video.scrubber.interval;
|
|
280
|
+
}, [skipInterval, theme.video.scrubber.interval, videoRef]);
|
|
281
|
+
var seekBackward = (0, _react.useCallback)(function () {
|
|
282
|
+
setInteracting(true);
|
|
283
|
+
videoRef.current.currentTime -= skipInterval || theme.video.scrubber.interval;
|
|
284
|
+
}, [skipInterval, theme.video.scrubber.interval, videoRef]);
|
|
268
285
|
var louder = (0, _react.useCallback)(function () {
|
|
269
286
|
videoRef.current.volume += VOLUME_STEP;
|
|
270
287
|
}, [videoRef]);
|
|
271
288
|
var quieter = (0, _react.useCallback)(function () {
|
|
272
289
|
videoRef.current.volume -= VOLUME_STEP;
|
|
273
290
|
}, [videoRef]);
|
|
274
|
-
|
|
275
|
-
var showCaptions = function showCaptions(index) {
|
|
291
|
+
var showCaptions = (0, _react.useCallback)(function (index) {
|
|
276
292
|
var textTracks = videoRef.current.textTracks;
|
|
277
293
|
|
|
278
294
|
for (var i = 0; i < textTracks.length; i += 1) {
|
|
279
295
|
textTracks[i].mode = i === index ? 'showing' : 'hidden';
|
|
280
296
|
}
|
|
281
|
-
};
|
|
282
|
-
|
|
297
|
+
}, [videoRef]);
|
|
283
298
|
var fullscreen = (0, _react.useCallback)(function () {
|
|
284
299
|
var video = videoRef.current;
|
|
285
300
|
|
|
@@ -317,15 +332,26 @@ var Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
317
332
|
ReduceVolume: theme.video.icons.reduceVolume,
|
|
318
333
|
Volume: theme.video.icons.volume
|
|
319
334
|
};
|
|
320
|
-
var captionControls = captions.map(function (caption) {
|
|
335
|
+
var captionControls = captions.map(function (caption, index) {
|
|
321
336
|
return {
|
|
322
337
|
icon: caption.label ? undefined : /*#__PURE__*/_react["default"].createElement(Icons.ClosedCaption, {
|
|
323
338
|
color: iconColor
|
|
324
339
|
}),
|
|
325
340
|
label: caption.label,
|
|
326
341
|
active: caption.active,
|
|
342
|
+
a11yTitle: caption.label || 'video.captions',
|
|
327
343
|
onClick: function onClick() {
|
|
328
|
-
|
|
344
|
+
showCaptions(caption.active ? -1 : index);
|
|
345
|
+
var updatedCaptions = [];
|
|
346
|
+
|
|
347
|
+
for (var i = 0; i < captions.length; i += 1) {
|
|
348
|
+
updatedCaptions.push(captions[i]); // set other captions to active=false
|
|
349
|
+
|
|
350
|
+
if (i !== index && updatedCaptions[i].active) updatedCaptions[i].active = false; // set the currently selected captions to active
|
|
351
|
+
else if (i === index) updatedCaptions[i].active = !captions[index].active;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
setCaptions(updatedCaptions);
|
|
329
355
|
}
|
|
330
356
|
};
|
|
331
357
|
});
|
|
@@ -375,7 +401,8 @@ var Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
375
401
|
id: 'video.pauseButton',
|
|
376
402
|
messages: messages
|
|
377
403
|
}),
|
|
378
|
-
|
|
404
|
+
disabled: !playing,
|
|
405
|
+
onClick: pause
|
|
379
406
|
},
|
|
380
407
|
play: {
|
|
381
408
|
icon: /*#__PURE__*/_react["default"].createElement(Icons.Play, {
|
|
@@ -385,7 +412,8 @@ var Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
385
412
|
id: 'video.playButton',
|
|
386
413
|
messages: messages
|
|
387
414
|
}),
|
|
388
|
-
|
|
415
|
+
disabled: playing,
|
|
416
|
+
onClick: play
|
|
389
417
|
}
|
|
390
418
|
};
|
|
391
419
|
var controlsMenuItems = [];
|
|
@@ -397,7 +425,18 @@ var Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
397
425
|
return undefined;
|
|
398
426
|
}
|
|
399
427
|
|
|
400
|
-
if (
|
|
428
|
+
if (item === 'captions' && typeof buttonProps[item] === 'object') {
|
|
429
|
+
for (var i = 0; i < buttonProps[item].length; i += 1) {
|
|
430
|
+
controlsMenuItems.push(buttonProps[item][i]);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
return undefined;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
if (typeof item === 'string') {
|
|
437
|
+
return controlsMenuItems.push(buttonProps[item]);
|
|
438
|
+
}
|
|
439
|
+
|
|
401
440
|
return controlsMenuItems.push(item);
|
|
402
441
|
});
|
|
403
442
|
controlsElement = /*#__PURE__*/_react["default"].createElement(_StyledVideo.StyledVideoControls, {
|
|
@@ -426,7 +465,10 @@ var Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
426
465
|
})
|
|
427
466
|
}),
|
|
428
467
|
hoverIndicator: "background",
|
|
429
|
-
onClick: playing ? pause : play
|
|
468
|
+
onClick: playing ? pause : play,
|
|
469
|
+
onFocus: function onFocus() {
|
|
470
|
+
return setInteracting(true);
|
|
471
|
+
}
|
|
430
472
|
}), /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
431
473
|
direction: "row",
|
|
432
474
|
align: "center",
|
|
@@ -457,7 +499,10 @@ var Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
457
499
|
onMouseLeave: function onMouseLeave() {
|
|
458
500
|
return setScrubTime(undefined);
|
|
459
501
|
},
|
|
460
|
-
onClick: seek
|
|
502
|
+
onClick: seek,
|
|
503
|
+
onFocus: function onFocus() {
|
|
504
|
+
return setInteracting(true);
|
|
505
|
+
}
|
|
461
506
|
}))), /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
462
507
|
pad: {
|
|
463
508
|
horizontal: 'small'
|
|
@@ -483,7 +528,10 @@ var Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
483
528
|
messages: messages
|
|
484
529
|
})
|
|
485
530
|
},
|
|
486
|
-
items: [].concat(controlsMenuItems)
|
|
531
|
+
items: [].concat(controlsMenuItems),
|
|
532
|
+
onFocus: function onFocus() {
|
|
533
|
+
return setInteracting(true);
|
|
534
|
+
}
|
|
487
535
|
})));
|
|
488
536
|
}
|
|
489
537
|
|
|
@@ -519,13 +567,17 @@ var Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
519
567
|
}
|
|
520
568
|
}
|
|
521
569
|
|
|
522
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
570
|
+
return /*#__PURE__*/_react["default"].createElement(_Keyboard.Keyboard, {
|
|
571
|
+
onLeft: seekBackward,
|
|
572
|
+
onRight: seekForward
|
|
573
|
+
}, /*#__PURE__*/_react["default"].createElement(_StyledVideo.StyledVideoContainer, _extends({
|
|
523
574
|
ref: containerRef
|
|
524
575
|
}, mouseEventListeners, {
|
|
525
576
|
alignSelf: alignSelf,
|
|
526
577
|
gridArea: gridArea,
|
|
527
578
|
margin: margin,
|
|
528
|
-
style: style
|
|
579
|
+
style: style,
|
|
580
|
+
tabIndex: "-1"
|
|
529
581
|
}), /*#__PURE__*/_react["default"].createElement(_StyledVideo.StyledVideo, _extends({}, rest, {
|
|
530
582
|
ref: videoRef,
|
|
531
583
|
onDurationChange: function onDurationChange(event) {
|
|
@@ -559,7 +611,7 @@ var Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
559
611
|
},
|
|
560
612
|
autoPlay: autoPlay || false,
|
|
561
613
|
loop: loop || false
|
|
562
|
-
}), children), controlsElement);
|
|
614
|
+
}), children), controlsElement));
|
|
563
615
|
});
|
|
564
616
|
exports.Video = Video;
|
|
565
617
|
Video.defaultProps = {};
|
|
@@ -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
|
|
@@ -17,11 +17,12 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
17
17
|
PropType = _extends({}, _generalPropTypes.genericProps, {
|
|
18
18
|
autoPlay: _propTypes["default"].bool,
|
|
19
19
|
controls: _propTypes["default"].oneOfType([_propTypes["default"].oneOf([false, 'over', 'below']), _propTypes["default"].shape({
|
|
20
|
-
position: _propTypes["default"].oneOf[
|
|
21
|
-
items: _propTypes["default"].arrayOf(_propTypes["default"].oneOfType([_propTypes["default"].
|
|
20
|
+
position: _propTypes["default"].oneOf([false, 'over', 'below']),
|
|
21
|
+
items: _propTypes["default"].arrayOf(_propTypes["default"].oneOfType([_propTypes["default"].oneOf(['captions', 'fullScreen', 'play', 'pause', 'volume']), _propTypes["default"].shape({
|
|
22
22
|
icon: _propTypes["default"].element,
|
|
23
23
|
a11yTitle: _propTypes["default"].string,
|
|
24
|
-
onClick: _propTypes["default"].func
|
|
24
|
+
onClick: _propTypes["default"].func,
|
|
25
|
+
disabled: _propTypes["default"].bool
|
|
25
26
|
})]))
|
|
26
27
|
})]),
|
|
27
28
|
fit: _propTypes["default"].oneOf(['cover', 'contain']),
|
|
@@ -30,14 +31,15 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
30
31
|
messages: _propTypes["default"].shape({
|
|
31
32
|
closeMenu: _propTypes["default"].string,
|
|
32
33
|
fullScreen: _propTypes["default"].string,
|
|
33
|
-
progressMeter: _propTypes["default"].string,
|
|
34
34
|
openMenu: _propTypes["default"].string,
|
|
35
35
|
pauseButton: _propTypes["default"].string,
|
|
36
36
|
playButton: _propTypes["default"].string,
|
|
37
|
+
progressMeter: _propTypes["default"].string,
|
|
37
38
|
scrubber: _propTypes["default"].string,
|
|
38
39
|
volumeDown: _propTypes["default"].string,
|
|
39
40
|
volumeUp: _propTypes["default"].string
|
|
40
|
-
})
|
|
41
|
+
}),
|
|
42
|
+
skipInterval: _propTypes["default"].number
|
|
41
43
|
});
|
|
42
44
|
}
|
|
43
45
|
|
|
@@ -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;
|
|
@@ -52,7 +52,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
52
52
|
responsive: PropTypes.bool,
|
|
53
53
|
round: roundPropType,
|
|
54
54
|
tag: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
55
|
-
as: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
55
|
+
as: PropTypes.oneOfType([PropTypes.string, PropTypes.func, PropTypes.elementType]),
|
|
56
56
|
width: widthPropType,
|
|
57
57
|
wrap: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['reverse'])])
|
|
58
58
|
});
|
|
@@ -27,6 +27,17 @@ export interface ButtonProps {
|
|
|
27
27
|
value?: boolean | number;
|
|
28
28
|
}
|
|
29
29
|
| JSX.Element;
|
|
30
|
+
children?:
|
|
31
|
+
| React.ReactNode
|
|
32
|
+
| (({
|
|
33
|
+
disabled,
|
|
34
|
+
hover,
|
|
35
|
+
focus,
|
|
36
|
+
}: {
|
|
37
|
+
disabled: boolean;
|
|
38
|
+
hover: boolean;
|
|
39
|
+
focus: boolean;
|
|
40
|
+
}) => React.ReactNode);
|
|
30
41
|
gridArea?: GridAreaType;
|
|
31
42
|
margin?: MarginType;
|
|
32
43
|
active?: boolean;
|
|
@@ -63,25 +74,13 @@ type anchorType = Omit<JSX.IntrinsicElements['a'], 'color'>;
|
|
|
63
74
|
type buttonType = Omit<JSX.IntrinsicElements['button'], 'color'>;
|
|
64
75
|
type extendType = anchorType & buttonType;
|
|
65
76
|
|
|
66
|
-
export interface ButtonExtendedProps
|
|
77
|
+
export interface ButtonExtendedProps
|
|
78
|
+
extends ButtonProps,
|
|
79
|
+
Omit<extendType, 'target' | 'children'> {}
|
|
67
80
|
|
|
68
81
|
// Keep type alias for backwards compatibility.
|
|
69
82
|
export type ButtonType = ButtonProps & extendType;
|
|
70
83
|
|
|
71
|
-
declare const Button: React.FC<
|
|
72
|
-
ButtonExtendedProps & {
|
|
73
|
-
children?:
|
|
74
|
-
| React.ReactNode
|
|
75
|
-
| (({
|
|
76
|
-
disabled,
|
|
77
|
-
hover,
|
|
78
|
-
focus,
|
|
79
|
-
}: {
|
|
80
|
-
disabled: boolean;
|
|
81
|
-
hover: boolean;
|
|
82
|
-
focus: boolean;
|
|
83
|
-
}) => React.ReactNode);
|
|
84
|
-
}
|
|
85
|
-
>;
|
|
84
|
+
declare const Button: React.FC<ButtonExtendedProps>;
|
|
86
85
|
|
|
87
86
|
export { Button };
|
|
@@ -145,7 +145,7 @@ var CheckBox = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
145
145
|
fill: "none",
|
|
146
146
|
d: "M6,12 L18,12"
|
|
147
147
|
}))));
|
|
148
|
-
var side = reverse ? 'left' : 'right';
|
|
148
|
+
var side = !reverse !== !theme.dir ? 'left' : 'right';
|
|
149
149
|
var checkBoxNode = /*#__PURE__*/React.createElement(StyledCheckBox, _extends({
|
|
150
150
|
as: Box,
|
|
151
151
|
align: "center",
|
|
@@ -59,8 +59,10 @@ Object.setPrototypeOf(StyledCheckBoxContainer.defaultProps, defaultProps);
|
|
|
59
59
|
var StyledCheckBoxInput = styled.input.withConfig({
|
|
60
60
|
displayName: "StyledCheckBox__StyledCheckBoxInput",
|
|
61
61
|
componentId: "sc-1dbk5ju-2"
|
|
62
|
-
})(["opacity:0;-moz-appearance:none;width:0;height:0;margin:0;", ":checked + span > span{
|
|
62
|
+
})(["opacity:0;-moz-appearance:none;width:0;height:0;margin:0;", ":checked + span > span{", ":calc( ", " - ", " );background:", ";}"], function (props) {
|
|
63
63
|
return !props.disabled && 'cursor: pointer;';
|
|
64
|
+
}, function (props) {
|
|
65
|
+
return !props.theme.dir ? 'left' : 'right';
|
|
64
66
|
}, function (props) {
|
|
65
67
|
return props.theme.checkBox.toggle.size;
|
|
66
68
|
}, function (props) {
|
|
@@ -105,8 +107,10 @@ Object.setPrototypeOf(StyledCheckBoxToggle.defaultProps, defaultProps);
|
|
|
105
107
|
var StyledCheckBoxKnob = styled.span.withConfig({
|
|
106
108
|
displayName: "StyledCheckBox__StyledCheckBoxKnob",
|
|
107
109
|
componentId: "sc-1dbk5ju-5"
|
|
108
|
-
})(["box-sizing:border-box;position:relative;display:inherit;top:-", ";
|
|
110
|
+
})(["box-sizing:border-box;position:relative;display:inherit;top:-", ";", ":-", ";transition:all 0.3s;width:", ";height:", ";background:", ";border-radius:", ";", ";"], function (props) {
|
|
109
111
|
return props.theme.checkBox.border.width;
|
|
112
|
+
}, function (props) {
|
|
113
|
+
return !props.theme.dir ? 'left' : 'right';
|
|
110
114
|
}, function (props) {
|
|
111
115
|
return props.theme.checkBox.border.width;
|
|
112
116
|
}, function (props) {
|
|
@@ -4,6 +4,7 @@ import { A11yTitleType, PadType } from '../../utils';
|
|
|
4
4
|
export interface CheckBoxProps {
|
|
5
5
|
a11yTitle?: A11yTitleType;
|
|
6
6
|
checked?: boolean;
|
|
7
|
+
children?: Function;
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
fill?: boolean;
|
|
9
10
|
id?: string;
|
|
@@ -15,7 +16,7 @@ export interface CheckBoxProps {
|
|
|
15
16
|
indeterminate?: boolean;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
type inputType = JSX.IntrinsicElements['input']
|
|
19
|
+
type inputType = Omit<JSX.IntrinsicElements['input'], 'children'>;
|
|
19
20
|
|
|
20
21
|
export interface CheckBoxExtendedProps extends CheckBoxProps, inputType {}
|
|
21
22
|
|