@ndla/video-search 4.0.0 → 4.1.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/es/VideoSearch.js +1 -0
- package/es/VideoTabs.js +25 -47
- package/lib/VideoSearch.js +1 -0
- package/lib/VideoTabs.js +30 -51
- package/package.json +7 -7
package/es/VideoSearch.js
CHANGED
|
@@ -238,6 +238,7 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
|
|
|
238
238
|
var searchListTabs = enabledSources.map(function (source) {
|
|
239
239
|
return {
|
|
240
240
|
title: source,
|
|
241
|
+
id: source,
|
|
241
242
|
content: _jsx("div", _objectSpread(_objectSpread({}, classes('list')), {}, {
|
|
242
243
|
children: selectedType === source.toLowerCase() && _jsx(VideoSearchList, {
|
|
243
244
|
translations: translations,
|
package/es/VideoTabs.js
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
function
|
|
2
|
-
function
|
|
3
|
-
function
|
|
4
|
-
function
|
|
5
|
-
function
|
|
6
|
-
function
|
|
7
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
8
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
9
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
11
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
7
|
/**
|
|
15
8
|
* Copyright (c) 2016-present, NDLA.
|
|
16
9
|
*
|
|
@@ -19,47 +12,32 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
19
12
|
*
|
|
20
13
|
*/
|
|
21
14
|
|
|
22
|
-
import React, {
|
|
15
|
+
import React, { useState } from 'react';
|
|
23
16
|
import PropTypes from 'prop-types';
|
|
24
17
|
import Tabs from '@ndla/tabs';
|
|
25
18
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
26
|
-
var VideoTabs =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
value:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
onSearchTypeChange(tabs[index].title.toLowerCase());
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}, {
|
|
47
|
-
key: "render",
|
|
48
|
-
value: function render() {
|
|
49
|
-
var tabs = this.props.tabs;
|
|
50
|
-
return _jsx(Tabs, {
|
|
51
|
-
onSelect: this.handleOnSelect,
|
|
52
|
-
tabs: tabs
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}]);
|
|
56
|
-
return VideoTabs;
|
|
57
|
-
}(Component);
|
|
19
|
+
var VideoTabs = function VideoTabs(_ref) {
|
|
20
|
+
var onSearchTypeChange = _ref.onSearchTypeChange,
|
|
21
|
+
tabs = _ref.tabs;
|
|
22
|
+
var _useState = useState(undefined),
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
selectedTab = _useState2[0],
|
|
25
|
+
setSelectedTab = _useState2[1];
|
|
26
|
+
var handleOnSelect = function handleOnSelect(value) {
|
|
27
|
+
setSelectedTab(value);
|
|
28
|
+
onSearchTypeChange(value);
|
|
29
|
+
};
|
|
30
|
+
return _jsx(Tabs, {
|
|
31
|
+
value: selectedTab,
|
|
32
|
+
onValueChange: handleOnSelect,
|
|
33
|
+
tabs: tabs
|
|
34
|
+
});
|
|
35
|
+
};
|
|
58
36
|
VideoTabs.propTypes = {
|
|
59
|
-
searchTypes: PropTypes.string,
|
|
60
37
|
onSearchTypeChange: PropTypes.func.isRequired,
|
|
61
38
|
tabs: PropTypes.arrayOf(PropTypes.shape({
|
|
62
39
|
type: PropTypes.string,
|
|
40
|
+
id: PropTypes.string,
|
|
63
41
|
content: PropTypes.node
|
|
64
42
|
})).isRequired
|
|
65
43
|
};
|
package/lib/VideoSearch.js
CHANGED
|
@@ -244,6 +244,7 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
|
|
|
244
244
|
var searchListTabs = enabledSources.map(function (source) {
|
|
245
245
|
return {
|
|
246
246
|
title: source,
|
|
247
|
+
id: source,
|
|
247
248
|
content: (0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, classes('list')), {}, {
|
|
248
249
|
children: selectedType === source.toLowerCase() && (0, _jsxRuntime.jsx)(_VideoSearchList["default"], {
|
|
249
250
|
translations: translations,
|
package/lib/VideoTabs.js
CHANGED
|
@@ -12,61 +12,40 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
13
|
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); }
|
|
14
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
function
|
|
16
|
-
function
|
|
17
|
-
function
|
|
18
|
-
function
|
|
19
|
-
function
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
key: "handleOnSelect",
|
|
45
|
-
value: function handleOnSelect(index, last) {
|
|
46
|
-
var _this$props = this.props,
|
|
47
|
-
onSearchTypeChange = _this$props.onSearchTypeChange,
|
|
48
|
-
tabs = _this$props.tabs;
|
|
49
|
-
if (index !== last) {
|
|
50
|
-
onSearchTypeChange(tabs[index].title.toLowerCase());
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}, {
|
|
54
|
-
key: "render",
|
|
55
|
-
value: function render() {
|
|
56
|
-
var tabs = this.props.tabs;
|
|
57
|
-
return (0, _jsxRuntime.jsx)(_tabs["default"], {
|
|
58
|
-
onSelect: this.handleOnSelect,
|
|
59
|
-
tabs: tabs
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}]);
|
|
63
|
-
return VideoTabs;
|
|
64
|
-
}(_react.Component);
|
|
15
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
19
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
20
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /**
|
|
21
|
+
* Copyright (c) 2016-present, NDLA.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
var VideoTabs = function VideoTabs(_ref) {
|
|
28
|
+
var onSearchTypeChange = _ref.onSearchTypeChange,
|
|
29
|
+
tabs = _ref.tabs;
|
|
30
|
+
var _useState = (0, _react.useState)(undefined),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
selectedTab = _useState2[0],
|
|
33
|
+
setSelectedTab = _useState2[1];
|
|
34
|
+
var handleOnSelect = function handleOnSelect(value) {
|
|
35
|
+
setSelectedTab(value);
|
|
36
|
+
onSearchTypeChange(value);
|
|
37
|
+
};
|
|
38
|
+
return (0, _jsxRuntime.jsx)(_tabs["default"], {
|
|
39
|
+
value: selectedTab,
|
|
40
|
+
onValueChange: handleOnSelect,
|
|
41
|
+
tabs: tabs
|
|
42
|
+
});
|
|
43
|
+
};
|
|
65
44
|
VideoTabs.propTypes = {
|
|
66
|
-
searchTypes: _propTypes["default"].string,
|
|
67
45
|
onSearchTypeChange: _propTypes["default"].func.isRequired,
|
|
68
46
|
tabs: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
69
47
|
type: _propTypes["default"].string,
|
|
48
|
+
id: _propTypes["default"].string,
|
|
70
49
|
content: _propTypes["default"].node
|
|
71
50
|
})).isRequired
|
|
72
51
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/video-search",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "A simple library for searching NDLA videos",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -31,16 +31,16 @@
|
|
|
31
31
|
"prop-types": "^15.8.1"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ndla/button": "^10.1.
|
|
35
|
-
"@ndla/icons": "^3.0.
|
|
34
|
+
"@ndla/button": "^10.1.6",
|
|
35
|
+
"@ndla/icons": "^3.0.2",
|
|
36
36
|
"@ndla/licenses": "^7.0.4",
|
|
37
|
-
"@ndla/notion": "^5.0.
|
|
38
|
-
"@ndla/pager": "^2.2.
|
|
39
|
-
"@ndla/tabs": "^
|
|
37
|
+
"@ndla/notion": "^5.0.3",
|
|
38
|
+
"@ndla/pager": "^2.2.6",
|
|
39
|
+
"@ndla/tabs": "^3.0.0",
|
|
40
40
|
"react-bem-helper": "^1.4.1"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "9d01ddb3d2eee554008a3e58eda434dfc968cb52"
|
|
46
46
|
}
|