@ndla/ui 3.3.13 → 3.3.14

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.
Files changed (91) hide show
  1. package/es/Figure/Figure.js +3 -1
  2. package/es/NDLAFilm/AboutNdlaFilm.js +6 -17
  3. package/es/NDLAFilm/AllMoviesAlphabetically.js +11 -11
  4. package/es/NDLAFilm/CategorySelect.js +17 -18
  5. package/es/NDLAFilm/FilmContentCard.js +8 -22
  6. package/es/NDLAFilm/FilmContentCardTags.js +4 -8
  7. package/es/NDLAFilm/FilmMovieList.js +6 -21
  8. package/es/NDLAFilm/FilmMovieSearch.js +18 -26
  9. package/es/NDLAFilm/MovieGrid.js +10 -19
  10. package/es/NDLAFilm/VisualElement.js +22 -29
  11. package/es/TopicIntroductionList/TopicIntroduction.js +14 -33
  12. package/es/TopicIntroductionList/TopicIntroductionList.js +6 -23
  13. package/es/TopicIntroductionList/TopicIntroductionShortcuts.js +71 -110
  14. package/es/TopicIntroductionList/TopicShortcutItem.js +0 -9
  15. package/es/all.css +1 -4
  16. package/es/index-javascript.js +1 -5
  17. package/es/index.js +4 -0
  18. package/es/shapes.js +0 -6
  19. package/lib/Figure/Figure.js +3 -1
  20. package/lib/NDLAFilm/AboutNdlaFilm.d.ts +15 -0
  21. package/lib/NDLAFilm/AboutNdlaFilm.js +6 -18
  22. package/lib/NDLAFilm/AllMoviesAlphabetically.d.ts +2 -2
  23. package/lib/NDLAFilm/AllMoviesAlphabetically.js +11 -11
  24. package/lib/NDLAFilm/CategorySelect.d.ts +11 -0
  25. package/lib/NDLAFilm/CategorySelect.js +20 -19
  26. package/lib/NDLAFilm/FilmContentCard.d.ts +11 -0
  27. package/lib/NDLAFilm/FilmContentCard.js +8 -23
  28. package/lib/NDLAFilm/FilmContentCardTags.d.ts +7 -0
  29. package/lib/NDLAFilm/FilmContentCardTags.js +4 -9
  30. package/lib/NDLAFilm/FilmMovieList.d.ts +19 -0
  31. package/lib/NDLAFilm/FilmMovieList.js +5 -21
  32. package/lib/NDLAFilm/FilmMovieSearch.d.ts +21 -0
  33. package/lib/NDLAFilm/FilmMovieSearch.js +25 -30
  34. package/lib/NDLAFilm/FilmSlideshow.d.ts +5 -5
  35. package/lib/NDLAFilm/MovieGrid.d.ts +13 -0
  36. package/lib/NDLAFilm/MovieGrid.js +9 -21
  37. package/lib/NDLAFilm/SlideshowIndicator.d.ts +2 -2
  38. package/lib/NDLAFilm/VisualElement.d.ts +16 -0
  39. package/lib/NDLAFilm/VisualElement.js +22 -30
  40. package/lib/NDLAFilm/index.d.ts +14 -0
  41. package/lib/NDLAFilm/types.d.ts +6 -4
  42. package/lib/TopicIntroductionList/TopicIntroduction.d.ts +21 -0
  43. package/lib/TopicIntroductionList/TopicIntroduction.js +16 -36
  44. package/lib/TopicIntroductionList/TopicIntroductionList.d.ts +35 -0
  45. package/lib/TopicIntroductionList/TopicIntroductionList.js +6 -25
  46. package/lib/TopicIntroductionList/TopicIntroductionShortcuts.d.ts +8 -0
  47. package/lib/TopicIntroductionList/TopicIntroductionShortcuts.js +72 -110
  48. package/lib/TopicIntroductionList/TopicShortcutItem.d.ts +6 -0
  49. package/lib/TopicIntroductionList/TopicShortcutItem.js +0 -11
  50. package/lib/TopicIntroductionList/index.d.ts +9 -0
  51. package/lib/all.css +1 -4
  52. package/lib/index-javascript.js +3 -137
  53. package/lib/index.d.ts +4 -0
  54. package/lib/index.js +155 -0
  55. package/lib/shapes.js +1 -10
  56. package/package.json +10 -10
  57. package/src/Figure/Figure.tsx +2 -1
  58. package/src/Figure/component.figure.scss +37 -3
  59. package/src/NDLAFilm/{AboutNdlaFilm.jsx → AboutNdlaFilm.tsx} +19 -18
  60. package/src/NDLAFilm/AllMoviesAlphabetically.tsx +3 -3
  61. package/src/NDLAFilm/{CategorySelect.jsx → CategorySelect.tsx} +23 -20
  62. package/src/NDLAFilm/{FilmContentCard.jsx → FilmContentCard.tsx} +21 -21
  63. package/src/NDLAFilm/{FilmContentCardTags.jsx → FilmContentCardTags.tsx} +7 -7
  64. package/src/NDLAFilm/{FilmMovieList.jsx → FilmMovieList.tsx} +17 -27
  65. package/src/NDLAFilm/FilmMovieSearch.tsx +71 -0
  66. package/src/NDLAFilm/FilmSlideshow.tsx +6 -6
  67. package/src/NDLAFilm/MovieGrid.tsx +76 -0
  68. package/src/NDLAFilm/SlideshowIndicator.tsx +2 -2
  69. package/src/NDLAFilm/VisualElement.tsx +40 -0
  70. package/src/NDLAFilm/{index.js → index.ts} +0 -0
  71. package/src/NDLAFilm/types.ts +7 -4
  72. package/src/TopicIntroductionList/{TopicIntroduction.jsx → TopicIntroduction.tsx} +22 -35
  73. package/src/TopicIntroductionList/{TopicIntroductionList.jsx → TopicIntroductionList.tsx} +32 -26
  74. package/src/TopicIntroductionList/TopicIntroductionShortcuts.tsx +71 -0
  75. package/src/TopicIntroductionList/{TopicShortcutItem.jsx → TopicShortcutItem.tsx} +5 -13
  76. package/src/TopicIntroductionList/{index.js → index.ts} +0 -0
  77. package/src/index-javascript.js +0 -30
  78. package/src/index.ts +31 -0
  79. package/src/shapes.js +0 -7
  80. package/es/NDLAFilm/interfaces.js +0 -0
  81. package/es/NDLAFilm/shapes.js +0 -15
  82. package/lib/NDLAFilm/interfaces.d.ts +0 -10
  83. package/lib/NDLAFilm/interfaces.js +0 -1
  84. package/lib/NDLAFilm/shapes.d.ts +0 -15
  85. package/lib/NDLAFilm/shapes.js +0 -30
  86. package/src/NDLAFilm/FilmMovieSearch.jsx +0 -66
  87. package/src/NDLAFilm/MovieGrid.jsx +0 -75
  88. package/src/NDLAFilm/VisualElement.jsx +0 -48
  89. package/src/NDLAFilm/interfaces.ts +0 -10
  90. package/src/NDLAFilm/shapes.ts +0 -17
  91. package/src/TopicIntroductionList/TopicIntroductionShortcuts.jsx +0 -92
@@ -6,12 +6,11 @@
6
6
  *
7
7
  */
8
8
  import React from 'react';
9
- import PropTypes from 'prop-types';
10
9
  import BEMHelper from 'react-bem-helper';
10
+ import { useTranslation } from 'react-i18next';
11
11
  import { Additional, Core } from '@ndla/icons/common';
12
12
  import Tooltip from '@ndla/tooltip';
13
13
  import SafeLink from '@ndla/safelink';
14
- import { TopicShape, ShortcutShape } from '../shapes';
15
14
  import TopicIntroductionShortcuts from './TopicIntroductionShortcuts';
16
15
  import { jsx as ___EmotionJSX } from "@emotion/core";
17
16
  var topicClasses = new BEMHelper({
@@ -24,15 +23,20 @@ export var TopicIntroduction = function TopicIntroduction(_ref) {
24
23
  topic = _ref.topic,
25
24
  subjectPage = _ref.subjectPage,
26
25
  shortcuts = _ref.shortcuts,
27
- messages = _ref.messages,
28
26
  shortcutAlwaysExpanded = _ref.shortcutAlwaysExpanded,
29
- additional = _ref.additional,
30
- showAdditionalCores = _ref.showAdditionalCores,
27
+ _ref$additional = _ref.additional,
28
+ additional = _ref$additional === void 0 ? false : _ref$additional,
29
+ _ref$showAdditionalCo = _ref.showAdditionalCores,
30
+ showAdditionalCores = _ref$showAdditionalCo === void 0 ? false : _ref$showAdditionalCo,
31
31
  id = _ref.id;
32
- var contentTypeDescription = additional ? messages.tooltipAdditionalTopic : messages.tooltipCoreTopic;
32
+
33
+ var _useTranslation = useTranslation(),
34
+ t = _useTranslation.t;
35
+
36
+ var contentTypeDescription = t(additional ? 'resource.tooltipAdditionalTopic' : 'resource.tooltipCoreTopic');
33
37
  return ___EmotionJSX("li", {
34
38
  className: topicClasses('item', {
35
- subjectPage: subjectPage,
39
+ subjectPage: !!subjectPage,
36
40
  additional: additional,
37
41
  showAdditionalCores: showAdditionalCores
38
42
  })
@@ -49,12 +53,12 @@ export var TopicIntroduction = function TopicIntroduction(_ref) {
49
53
  id: id,
50
54
  hidden: true
51
55
  }, contentTypeDescription), additional && ___EmotionJSX(Tooltip, {
52
- tooltip: messages.tooltipAdditionalTopic,
56
+ tooltip: t('resource.tooltipAdditionalTopic'),
53
57
  align: "left"
54
58
  }, ___EmotionJSX(Additional, {
55
59
  className: "c-icon--20 u-margin-left-tiny"
56
60
  })), !additional && showAdditionalCores && ___EmotionJSX(Tooltip, {
57
- tooltip: messages.tooltipCoreTopic,
61
+ tooltip: t('resource.tooltipCoreTopic'),
58
62
  align: "left"
59
63
  }, ___EmotionJSX(Core, {
60
64
  className: "c-icon--20 u-margin-left-tiny"
@@ -67,32 +71,9 @@ export var TopicIntroduction = function TopicIntroduction(_ref) {
67
71
  }), shortcuts && ___EmotionJSX(TopicIntroductionShortcuts, {
68
72
  alwaysExpanded: shortcutAlwaysExpanded,
69
73
  id: "".concat(topic.id, "_shortcuts"),
70
- shortcuts: shortcuts,
71
- messages: {
72
- toggleButtonText: messages.shortcutButtonText
73
- }
74
+ shortcuts: shortcuts
74
75
  })), topic.metaImage && ___EmotionJSX("div", null, ___EmotionJSX("img", {
75
76
  src: topic.metaImage.url,
76
77
  alt: topic.metaImage.alt
77
78
  })))));
78
- };
79
- TopicIntroduction.propTypes = {
80
- additional: PropTypes.bool,
81
- showAdditionalCores: PropTypes.bool,
82
- messages: PropTypes.shape({
83
- shortcutButtonText: PropTypes.string.isRequired,
84
- tooltipAdditionalTopic: PropTypes.string,
85
- tooltipCoreTopic: PropTypes.string
86
- }),
87
- topic: TopicShape.isRequired,
88
- toTopic: PropTypes.func.isRequired,
89
- subjectPage: PropTypes.bool,
90
- shortcuts: PropTypes.arrayOf(ShortcutShape),
91
- twoColumns: PropTypes.bool,
92
- shortcutAlwaysExpanded: PropTypes.bool,
93
- id: PropTypes.string.isRequired
94
- };
95
- TopicIntroduction.defaultProps = {
96
- showAdditionalCores: false,
97
- additional: false
98
79
  };
@@ -12,11 +12,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
12
12
  *
13
13
  */
14
14
  import React from 'react';
15
- import PropTypes from 'prop-types';
16
15
  import BEMHelper from 'react-bem-helper';
17
16
  import { useTranslation } from 'react-i18next';
18
17
  import NoContentBox from '../NoContentBox';
19
- import { TopicShape } from '../shapes';
20
18
  import { TopicIntroduction } from './TopicIntroduction';
21
19
  import { jsx as ___EmotionJSX } from "@emotion/core";
22
20
  var topicClasses = new BEMHelper({
@@ -27,9 +25,12 @@ var topicClasses = new BEMHelper({
27
25
 
28
26
  var TopicIntroductionList = function TopicIntroductionList(_ref) {
29
27
  var topics = _ref.topics,
30
- twoColumns = _ref.twoColumns,
31
- shortcutAlwaysExpanded = _ref.shortcutAlwaysExpanded,
32
- showAdditionalCores = _ref.showAdditionalCores,
28
+ _ref$twoColumns = _ref.twoColumns,
29
+ twoColumns = _ref$twoColumns === void 0 ? false : _ref$twoColumns,
30
+ _ref$shortcutAlwaysEx = _ref.shortcutAlwaysExpanded,
31
+ shortcutAlwaysExpanded = _ref$shortcutAlwaysEx === void 0 ? false : _ref$shortcutAlwaysEx,
32
+ _ref$showAdditionalCo = _ref.showAdditionalCores,
33
+ showAdditionalCores = _ref$showAdditionalCo === void 0 ? false : _ref$showAdditionalCo,
33
34
  toggleAdditionalCores = _ref.toggleAdditionalCores,
34
35
  rest = _objectWithoutProperties(_ref, ["topics", "twoColumns", "shortcutAlwaysExpanded", "showAdditionalCores", "toggleAdditionalCores"]);
35
36
 
@@ -56,11 +57,6 @@ var TopicIntroductionList = function TopicIntroductionList(_ref) {
56
57
  additional: additional,
57
58
  showAdditionalCores: showAdditionalCores,
58
59
  shortcutAlwaysExpanded: shortcutAlwaysExpanded,
59
- messages: {
60
- shortcutButtonText: t('resource.label'),
61
- tooltipAdditionalTopic: t('resource.tooltipAdditionalTopic'),
62
- tooltipCoreTopic: t('resource.tooltipCoreTopic')
63
- },
64
60
  id: "".concat(topic.id, "_").concat(index)
65
61
  }));
66
62
  }), renderAdditionalTopicsTrigger && ___EmotionJSX("li", null, ___EmotionJSX(NoContentBox, {
@@ -70,17 +66,4 @@ var TopicIntroductionList = function TopicIntroductionList(_ref) {
70
66
  })));
71
67
  };
72
68
 
73
- TopicIntroductionList.propTypes = {
74
- toTopic: PropTypes.func.isRequired,
75
- topics: PropTypes.arrayOf(TopicShape).isRequired,
76
- twoColumns: PropTypes.bool,
77
- shortcutAlwaysExpanded: PropTypes.bool,
78
- showAdditionalCores: PropTypes.bool,
79
- toggleAdditionalCores: PropTypes.func.isRequired
80
- };
81
- TopicIntroductionList.defaultProps = {
82
- twoColumns: false,
83
- shortcutAlwaysExpanded: false,
84
- showAdditionalCores: false
85
- };
86
69
  export default TopicIntroductionList;
@@ -1,134 +1,95 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
-
3
1
  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
2
 
5
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
-
7
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
8
-
9
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
10
-
11
- 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
4
 
13
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
5
+ 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."); }
14
6
 
15
- 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); }; }
7
+ 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); }
16
8
 
17
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
9
+ 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; }
18
10
 
19
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
11
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
20
12
 
21
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
14
 
23
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
24
-
25
- import React, { Component } from 'react';
26
- import PropTypes from 'prop-types';
15
+ import React, { useState } from 'react';
16
+ import { useTranslation } from 'react-i18next';
27
17
  import BEMHelper from 'react-bem-helper';
28
18
  import { Forward } from '@ndla/icons/common';
29
19
  import ShortcutItem from './TopicShortcutItem';
30
- import { ShortcutShape } from '../shapes';
31
20
  import { jsx as ___EmotionJSX } from "@emotion/core";
32
21
  var classes = new BEMHelper({
33
22
  name: 'topic-shortcuts',
34
23
  prefix: 'c-'
35
24
  });
36
25
 
37
- var TopicIntroductionShortcuts = /*#__PURE__*/function (_Component) {
38
- _inherits(TopicIntroductionShortcuts, _Component);
39
-
40
- var _super = _createSuper(TopicIntroductionShortcuts);
41
-
42
- function TopicIntroductionShortcuts(props) {
43
- var _this;
44
-
45
- _classCallCheck(this, TopicIntroductionShortcuts);
26
+ var TopicIntroductionShortcuts = function TopicIntroductionShortcuts(_ref) {
27
+ var id = _ref.id,
28
+ _ref$alwaysExpanded = _ref.alwaysExpanded,
29
+ alwaysExpanded = _ref$alwaysExpanded === void 0 ? false : _ref$alwaysExpanded,
30
+ shortcuts = _ref.shortcuts;
31
+
32
+ var _useTranslation = useTranslation(),
33
+ t = _useTranslation.t;
34
+
35
+ var _useState = useState(alwaysExpanded),
36
+ _useState2 = _slicedToArray(_useState, 2),
37
+ open = _useState2[0],
38
+ setOpen = _useState2[1];
39
+
40
+ var _useState3 = useState(false),
41
+ _useState4 = _slicedToArray(_useState3, 2),
42
+ returned = _useState4[0],
43
+ setReturned = _useState4[1];
44
+
45
+ var _useState5 = useState(true),
46
+ _useState6 = _slicedToArray(_useState5, 2),
47
+ showButtonText = _useState6[0],
48
+ setShowButtonText = _useState6[1];
49
+
50
+ var handleOnToggle = function handleOnToggle(newOpen) {
51
+ setOpen(newOpen);
52
+ setShowButtonText(!newOpen);
53
+ setReturned(!newOpen);
54
+ };
55
+
56
+ var onMouseEnter = undefined;
57
+ var onMouseLeave = undefined;
58
+ var buttonView = null;
59
+
60
+ if (!alwaysExpanded) {
61
+ onMouseEnter = function onMouseEnter() {
62
+ return handleOnToggle(true);
63
+ };
46
64
 
47
- _this = _super.call(this, props);
48
- _this.state = {
49
- open: props.alwaysExpanded,
50
- returned: false,
51
- showButtonText: true
65
+ onMouseLeave = function onMouseLeave() {
66
+ return handleOnToggle(false);
52
67
  };
53
- _this.handleOnToggle = _this.handleOnToggle.bind(_assertThisInitialized(_this));
54
- return _this;
55
- }
56
68
 
57
- _createClass(TopicIntroductionShortcuts, [{
58
- key: "handleOnToggle",
59
- value: function handleOnToggle(open) {
60
- this.setState({
61
- open: open,
62
- showButtonText: !open,
63
- returned: !open
64
- });
65
- }
66
- }, {
67
- key: "render",
68
- value: function render() {
69
- var _this2 = this;
70
-
71
- var _this$props = this.props,
72
- shortcuts = _this$props.shortcuts,
73
- messages = _this$props.messages,
74
- id = _this$props.id,
75
- alwaysExpanded = _this$props.alwaysExpanded;
76
- var _this$state = this.state,
77
- open = _this$state.open,
78
- returned = _this$state.returned,
79
- showButtonText = _this$state.showButtonText;
80
- var onMouseEnter = null;
81
- var onMouseLeave = null;
82
- var buttonView = null;
83
-
84
- if (!alwaysExpanded) {
85
- onMouseEnter = function onMouseEnter() {
86
- return _this2.handleOnToggle(true);
87
- };
88
-
89
- onMouseLeave = function onMouseLeave() {
90
- return _this2.handleOnToggle(false);
91
- };
92
-
93
- buttonView = ___EmotionJSX("button", _extends({
94
- type: "button",
95
- "aria-expanded": this.state.open,
96
- "aria-label": messages.toggleButtonText,
97
- "aria-controls": id
98
- }, classes('button', returned ? 're-enter' : ''), {
99
- onClick: function onClick() {
100
- _this2.handleOnToggle(!open);
101
- }
102
- }), ___EmotionJSX(Forward, null), showButtonText && ___EmotionJSX("span", classes('label'), messages.toggleButtonText));
69
+ buttonView = ___EmotionJSX("button", _extends({
70
+ type: "button",
71
+ "aria-expanded": open,
72
+ "aria-label": t('resource.label'),
73
+ "aria-controls": id
74
+ }, classes('button', returned ? 're-enter' : ''), {
75
+ onClick: function onClick() {
76
+ return handleOnToggle(!open);
103
77
  }
78
+ }), ___EmotionJSX(Forward, null), showButtonText && ___EmotionJSX("span", classes('label'), t('resource.label')));
79
+ }
104
80
 
105
- return ___EmotionJSX("div", _extends({
106
- onMouseEnter: onMouseEnter,
107
- onMouseLeave: onMouseLeave
108
- }, classes()), buttonView, open && ___EmotionJSX("ul", {
109
- className: classes('list', open ? 'visible' : '').className
110
- }, shortcuts.map(function (shortcut) {
111
- return ___EmotionJSX("li", _extends({}, classes('item'), {
112
- key: shortcut.id
113
- }), ___EmotionJSX(ShortcutItem, {
114
- shortcut: shortcut
115
- }));
116
- })));
117
- }
118
- }]);
119
-
120
- return TopicIntroductionShortcuts;
121
- }(Component);
122
-
123
- TopicIntroductionShortcuts.propTypes = {
124
- id: PropTypes.string.isRequired,
125
- alwaysExpanded: PropTypes.bool,
126
- messages: PropTypes.shape({
127
- toggleButtonText: PropTypes.string.isRequired
128
- }),
129
- shortcuts: PropTypes.arrayOf(ShortcutShape).isRequired
130
- };
131
- TopicIntroductionShortcuts.defaultProps = {
132
- alwaysExpanded: false
81
+ return ___EmotionJSX("div", _extends({
82
+ onMouseEnter: onMouseEnter,
83
+ onMouseLeave: onMouseLeave
84
+ }, classes()), buttonView, open && ___EmotionJSX("ul", {
85
+ className: classes('list', open ? 'visible' : '').className
86
+ }, shortcuts.map(function (shortcut) {
87
+ return ___EmotionJSX("li", _extends({}, classes('item'), {
88
+ key: shortcut.id
89
+ }), ___EmotionJSX(ShortcutItem, {
90
+ shortcut: shortcut
91
+ }));
92
+ })));
133
93
  };
94
+
134
95
  export default TopicIntroductionShortcuts;
@@ -1,13 +1,11 @@
1
1
  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); }
2
2
 
3
3
  import React from 'react';
4
- import PropTypes from 'prop-types';
5
4
  import BEMHelper from 'react-bem-helper';
6
5
  import Tooltip from '@ndla/tooltip';
7
6
  import SafeLink from '@ndla/safelink';
8
7
  import { useTranslation } from 'react-i18next';
9
8
  import ContentTypeBadge from '../ContentTypeBadge';
10
- import { ShortcutShape } from '../shapes';
11
9
  import { jsx as ___EmotionJSX } from "@emotion/core";
12
10
  var classes = new BEMHelper({
13
11
  name: 'topic-shortcuts',
@@ -42,11 +40,4 @@ var ShortcutItem = function ShortcutItem(_ref) {
42
40
  }), ___EmotionJSX("span", classes('count'), count)));
43
41
  };
44
42
 
45
- ShortcutItem.propTypes = {
46
- shortcut: ShortcutShape.isRequired,
47
- disableToolTip: PropTypes.bool
48
- };
49
- ShortcutItem.defaultProps = {
50
- disableToolTip: false
51
- };
52
43
  export default ShortcutItem;