@ndla/ui 30.0.6 → 30.0.8

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 (67) hide show
  1. package/es/Article/Article.js +6 -12
  2. package/es/Article/index.js +1 -2
  3. package/es/LearningPaths/LearningPathMenu.js +5 -5
  4. package/es/LearningPaths/LearningPathMenuIntro.js +9 -14
  5. package/es/ResourceGroup/ResourceGroup.js +5 -8
  6. package/es/ResourceGroup/ResourceItem.js +13 -22
  7. package/es/ResourceGroup/ResourceList.js +4 -6
  8. package/es/TagSelector/Control.js +1 -1
  9. package/es/TagSelector/MenuList.js +1 -1
  10. package/es/TreeStructure/TreeStructure.js +7 -7
  11. package/es/index.js +1 -1
  12. package/es/locale/messages-en.js +3 -1
  13. package/es/locale/messages-nb.js +3 -1
  14. package/es/locale/messages-nn.js +4 -2
  15. package/es/locale/messages-se.js +3 -1
  16. package/es/locale/messages-sma.js +3 -1
  17. package/lib/Article/Article.d.ts +2 -3
  18. package/lib/Article/Article.js +6 -13
  19. package/lib/Article/index.d.ts +1 -2
  20. package/lib/Article/index.js +0 -8
  21. package/lib/LearningPaths/LearningPathMenu.d.ts +3 -2
  22. package/lib/LearningPaths/LearningPathMenu.js +5 -5
  23. package/lib/LearningPaths/LearningPathMenuIntro.d.ts +3 -2
  24. package/lib/LearningPaths/LearningPathMenuIntro.js +9 -15
  25. package/lib/ResourceGroup/ResourceGroup.d.ts +3 -3
  26. package/lib/ResourceGroup/ResourceGroup.js +5 -8
  27. package/lib/ResourceGroup/ResourceItem.d.ts +3 -4
  28. package/lib/ResourceGroup/ResourceItem.js +13 -23
  29. package/lib/ResourceGroup/ResourceList.d.ts +4 -4
  30. package/lib/ResourceGroup/ResourceList.js +4 -6
  31. package/lib/TagSelector/Control.js +1 -1
  32. package/lib/TagSelector/MenuList.js +1 -1
  33. package/lib/TreeStructure/TreeStructure.js +7 -7
  34. package/lib/index.d.ts +1 -1
  35. package/lib/index.js +0 -7
  36. package/lib/locale/messages-en.d.ts +2 -0
  37. package/lib/locale/messages-en.js +3 -1
  38. package/lib/locale/messages-nb.d.ts +2 -0
  39. package/lib/locale/messages-nb.js +3 -1
  40. package/lib/locale/messages-nn.d.ts +2 -0
  41. package/lib/locale/messages-nn.js +4 -2
  42. package/lib/locale/messages-se.d.ts +2 -0
  43. package/lib/locale/messages-se.js +3 -1
  44. package/lib/locale/messages-sma.d.ts +2 -0
  45. package/lib/locale/messages-sma.js +3 -1
  46. package/package.json +10 -10
  47. package/src/.DS_Store +0 -0
  48. package/src/Article/Article.tsx +4 -14
  49. package/src/Article/index.ts +0 -2
  50. package/src/LearningPaths/LearningPathMenu.tsx +4 -4
  51. package/src/LearningPaths/LearningPathMenuIntro.tsx +4 -7
  52. package/src/ResourceGroup/ResourceGroup.tsx +4 -7
  53. package/src/ResourceGroup/ResourceItem.tsx +4 -15
  54. package/src/ResourceGroup/ResourceList.tsx +5 -8
  55. package/src/TagSelector/Control.tsx +1 -0
  56. package/src/TagSelector/MenuList.tsx +1 -0
  57. package/src/TreeStructure/TreeStructure.tsx +1 -0
  58. package/src/index.ts +0 -1
  59. package/src/locale/messages-en.ts +4 -1
  60. package/src/locale/messages-nb.ts +4 -1
  61. package/src/locale/messages-nn.ts +5 -2
  62. package/src/locale/messages-se.ts +4 -1
  63. package/src/locale/messages-sma.ts +4 -1
  64. package/es/Article/ArticleFavoritesButton.js +0 -42
  65. package/lib/Article/ArticleFavoritesButton.d.ts +0 -14
  66. package/lib/Article/ArticleFavoritesButton.js +0 -59
  67. package/src/Article/ArticleFavoritesButton.tsx +0 -42
@@ -1,59 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = exports.ArticleFavoritesButton = void 0;
7
-
8
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
9
-
10
- var _react = _interopRequireDefault(require("react"));
11
-
12
- var _button = require("@ndla/button");
13
-
14
- var _action = require("@ndla/icons/action");
15
-
16
- var _tooltip = _interopRequireDefault(require("@ndla/tooltip"));
17
-
18
- var _reactI18next = require("react-i18next");
19
-
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
-
22
- /**
23
- * Copyright (c) 2022-present, NDLA.
24
- *
25
- * This source code is licensed under the GPLv3 license found in the
26
- * LICENSE file in the root directory of this source tree.
27
- *
28
- */
29
- var ArticleFavoritesButton = function ArticleFavoritesButton(_ref) {
30
- var isFavorite = _ref.isFavorite,
31
- onToggleAddToFavorites = _ref.onToggleAddToFavorites,
32
- articleId = _ref.articleId;
33
-
34
- var _useTranslation = (0, _reactI18next.useTranslation)(),
35
- t = _useTranslation.t;
36
-
37
- var removeFromFavoritesLabel = t('myNdla.resource.addToMyNdla');
38
- var addToFavoritesLabel = t('myNdla.resource.addedToMyNdla');
39
- return (0, _jsxRuntime.jsx)(_tooltip["default"], {
40
- tooltip: isFavorite ? addToFavoritesLabel : removeFromFavoritesLabel,
41
- children: (0, _jsxRuntime.jsx)(_button.IconButtonDualStates, {
42
- ariaLabelActive: t('myNdla.alreadyFavourited'),
43
- ariaLabelInActive: t('myNdla.addToFavourites'),
44
- activeIcon: (0, _jsxRuntime.jsx)(_action.Heart, {}),
45
- inactiveIcon: (0, _jsxRuntime.jsx)(_action.HeartOutline, {}),
46
- active: isFavorite,
47
- size: "small",
48
- colorTheme: "light",
49
- variant: "ghost",
50
- onClick: function onClick() {
51
- return onToggleAddToFavorites(articleId, !isFavorite);
52
- }
53
- })
54
- });
55
- };
56
-
57
- exports.ArticleFavoritesButton = ArticleFavoritesButton;
58
- var _default = ArticleFavoritesButton;
59
- exports["default"] = _default;
@@ -1,42 +0,0 @@
1
- /**
2
- * Copyright (c) 2022-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- import React from 'react';
10
- import { IconButtonDualStates } from '@ndla/button';
11
- import { Heart, HeartOutline } from '@ndla/icons/action';
12
- import Tooltip from '@ndla/tooltip';
13
- import { useTranslation } from 'react-i18next';
14
-
15
- export interface Props {
16
- isFavorite?: boolean;
17
- onToggleAddToFavorites: (id: string, add: boolean) => void;
18
- articleId: string;
19
- }
20
-
21
- export const ArticleFavoritesButton = ({ isFavorite, onToggleAddToFavorites, articleId }: Props) => {
22
- const { t } = useTranslation();
23
- const removeFromFavoritesLabel = t('myNdla.resource.addToMyNdla');
24
- const addToFavoritesLabel = t('myNdla.resource.addedToMyNdla');
25
- return (
26
- <Tooltip tooltip={isFavorite ? addToFavoritesLabel : removeFromFavoritesLabel}>
27
- <IconButtonDualStates
28
- ariaLabelActive={t('myNdla.alreadyFavourited')}
29
- ariaLabelInActive={t('myNdla.addToFavourites')}
30
- activeIcon={<Heart />}
31
- inactiveIcon={<HeartOutline />}
32
- active={isFavorite}
33
- size="small"
34
- colorTheme="light"
35
- variant="ghost"
36
- onClick={() => onToggleAddToFavorites(articleId, !isFavorite)}
37
- />
38
- </Tooltip>
39
- );
40
- };
41
-
42
- export default ArticleFavoritesButton;