@ndla/ui 24.2.2 → 25.0.2

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 (97) hide show
  1. package/es/CompetenceGoals/CompetenceGoalsDialog.js +15 -23
  2. package/es/CompetenceGoals/index.js +1 -4
  3. package/es/Filter/FilterButtons.js +10 -11
  4. package/es/Filter/FilterList.js +82 -152
  5. package/es/Filter/FilterListPhone.js +180 -271
  6. package/es/Filter/ToggleItem.js +6 -25
  7. package/es/Frontpage/FrontpageAllSubjects.js +8 -9
  8. package/es/Frontpage/FrontpageSearch.js +3 -4
  9. package/es/Masthead/Masthead.js +65 -41
  10. package/es/Masthead/MastheadSearchModal.js +4 -5
  11. package/es/Masthead/SkipToMainContent.js +24 -0
  12. package/es/Masthead/index.js +2 -1
  13. package/es/SearchTypeResult/PopupFilter.js +8 -9
  14. package/es/SearchTypeResult/SearchFilterContent.js +3 -4
  15. package/es/SectionHeading/SectionHeading.js +24 -17
  16. package/es/Subject/index.js +0 -1
  17. package/es/all.css +1 -1
  18. package/es/index-javascript.js +1 -4
  19. package/es/index.js +6 -2
  20. package/lib/CompetenceGoals/CompetenceGoalsDialog.d.ts +19 -0
  21. package/lib/CompetenceGoals/CompetenceGoalsDialog.js +13 -24
  22. package/lib/CompetenceGoals/index.d.ts +1 -0
  23. package/lib/CompetenceGoals/index.js +1 -33
  24. package/lib/Filter/FilterButtons.js +9 -9
  25. package/lib/Filter/FilterList.d.ts +25 -0
  26. package/lib/Filter/FilterList.js +85 -155
  27. package/lib/Filter/FilterListPhone.d.ts +32 -0
  28. package/lib/Filter/FilterListPhone.js +176 -269
  29. package/lib/Filter/ToggleItem.d.ts +15 -0
  30. package/lib/Filter/ToggleItem.js +6 -32
  31. package/lib/Filter/filterClasses.d.ts +2 -0
  32. package/lib/Filter/index.d.ts +12 -0
  33. package/lib/Frontpage/FrontpageAllSubjects.js +7 -7
  34. package/lib/Frontpage/FrontpageMultidisciplinarySubject.d.ts +5 -5
  35. package/lib/Frontpage/FrontpageSearch.js +2 -3
  36. package/lib/Frontpage/illustrations/FrontpageIllustrations.d.ts +2 -2
  37. package/lib/Masthead/Masthead.d.ts +4 -8
  38. package/lib/Masthead/Masthead.js +65 -49
  39. package/lib/Masthead/MastheadSearchModal.js +3 -4
  40. package/lib/Masthead/SkipToMainContent.d.ts +6 -0
  41. package/lib/Masthead/SkipToMainContent.js +38 -0
  42. package/lib/Masthead/index.d.ts +2 -1
  43. package/lib/Masthead/index.js +10 -0
  44. package/lib/MultidisciplinarySubject/Illustrations.d.ts +7 -7
  45. package/lib/Resource/resourceComponents.d.ts +2 -2
  46. package/lib/Search/ActiveFilterContent.d.ts +1 -1
  47. package/lib/Search/ContentTypeResultStyles.d.ts +3 -3
  48. package/lib/SearchTypeResult/ActiveFilterContent.d.ts +1 -1
  49. package/lib/SearchTypeResult/PopupFilter.js +7 -7
  50. package/lib/SearchTypeResult/SearchFilterContent.js +2 -2
  51. package/lib/SectionHeading/SectionHeading.d.ts +1 -13
  52. package/lib/SectionHeading/SectionHeading.js +23 -19
  53. package/lib/Subject/index.d.ts +0 -1
  54. package/lib/Subject/index.js +0 -8
  55. package/lib/all.css +1 -1
  56. package/lib/index-javascript.js +1 -63
  57. package/lib/index.d.ts +6 -2
  58. package/lib/index.js +60 -10
  59. package/package.json +11 -11
  60. package/src/CompetenceGoals/{CompetenceGoalsDialog.jsx → CompetenceGoalsDialog.tsx} +34 -26
  61. package/src/CompetenceGoals/index.ts +1 -0
  62. package/src/Filter/FilterButtons.tsx +0 -1
  63. package/src/Filter/FilterList.tsx +135 -0
  64. package/src/Filter/FilterListPhone.tsx +275 -0
  65. package/src/Filter/ToggleItem.tsx +58 -0
  66. package/src/Filter/{filterClasses.js → filterClasses.ts} +0 -0
  67. package/src/Filter/{index.js → index.ts} +0 -0
  68. package/src/Frontpage/FrontpageAllSubjects.tsx +0 -1
  69. package/src/Frontpage/FrontpageSearch.tsx +0 -1
  70. package/src/Masthead/Masthead.tsx +85 -45
  71. package/src/Masthead/MastheadSearchModal.tsx +0 -1
  72. package/src/Masthead/SkipToMainContent.tsx +48 -0
  73. package/src/Masthead/index.ts +2 -1
  74. package/src/SearchTypeResult/PopupFilter.tsx +0 -1
  75. package/src/SearchTypeResult/SearchFilterContent.tsx +0 -1
  76. package/src/SectionHeading/SectionHeading.tsx +29 -16
  77. package/src/Subject/index.ts +0 -1
  78. package/src/index-javascript.js +0 -10
  79. package/src/index.ts +9 -2
  80. package/src/main.scss +0 -3
  81. package/es/CompetenceGoals/CompetenceGoalList.js +0 -58
  82. package/es/CompetenceGoals/CompetenceGoals.js +0 -159
  83. package/es/Subject/SubjectFilter.js +0 -42
  84. package/lib/CompetenceGoals/CompetenceGoalList.js +0 -78
  85. package/lib/CompetenceGoals/CompetenceGoals.js +0 -184
  86. package/lib/Subject/SubjectFilter.d.ts +0 -27
  87. package/lib/Subject/SubjectFilter.js +0 -58
  88. package/src/CompetenceGoals/CompetenceGoalList.jsx +0 -51
  89. package/src/CompetenceGoals/CompetenceGoals.jsx +0 -152
  90. package/src/CompetenceGoals/component.competence-goals.scss +0 -161
  91. package/src/CompetenceGoals/index.js +0 -6
  92. package/src/Filter/FilterList.jsx +0 -167
  93. package/src/Filter/FilterListPhone.jsx +0 -328
  94. package/src/Filter/ToggleItem.jsx +0 -71
  95. package/src/Masthead/component.masthead.scss +0 -146
  96. package/src/SectionHeading/component.section-heading.scss +0 -17
  97. package/src/Subject/SubjectFilter.tsx +0 -48
@@ -5,30 +5,6 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- Object.defineProperty(exports, "FilterList", {
9
- enumerable: true,
10
- get: function get() {
11
- return _Filter.FilterList;
12
- }
13
- });
14
- Object.defineProperty(exports, "FilterListPhone", {
15
- enumerable: true,
16
- get: function get() {
17
- return _Filter.FilterListPhone;
18
- }
19
- });
20
- Object.defineProperty(exports, "FilterButtons", {
21
- enumerable: true,
22
- get: function get() {
23
- return _Filter.FilterButtons;
24
- }
25
- });
26
- Object.defineProperty(exports, "TopicIntroductionList", {
27
- enumerable: true,
28
- get: function get() {
29
- return _TopicIntroductionList["default"];
30
- }
31
- });
32
8
  Object.defineProperty(exports, "TopicMenu", {
33
9
  enumerable: true,
34
10
  get: function get() {
@@ -41,47 +17,9 @@ Object.defineProperty(exports, "TopicMenuButton", {
41
17
  return _TopicMenu.TopicMenuButton;
42
18
  }
43
19
  });
44
- Object.defineProperty(exports, "CompetenceGoals", {
45
- enumerable: true,
46
- get: function get() {
47
- return _CompetenceGoals["default"];
48
- }
49
- });
50
- Object.defineProperty(exports, "CompetenceGoalList", {
51
- enumerable: true,
52
- get: function get() {
53
- return _CompetenceGoals.CompetenceGoalList;
54
- }
55
- });
56
- Object.defineProperty(exports, "CompetenceGoalListHeading", {
57
- enumerable: true,
58
- get: function get() {
59
- return _CompetenceGoals.CompetenceGoalListHeading;
60
- }
61
- });
62
- Object.defineProperty(exports, "CompetenceGoal", {
63
- enumerable: true,
64
- get: function get() {
65
- return _CompetenceGoals.CompetenceGoal;
66
- }
67
- });
68
- Object.defineProperty(exports, "CompetenceGoalsDialog", {
69
- enumerable: true,
70
- get: function get() {
71
- return _CompetenceGoals.CompetenceGoalsDialog;
72
- }
73
- });
74
-
75
- var _Filter = require("./Filter");
76
-
77
- var _TopicIntroductionList = _interopRequireDefault(require("./TopicIntroductionList"));
78
20
 
79
21
  var _TopicMenu = _interopRequireWildcard(require("./TopicMenu"));
80
22
 
81
- var _CompetenceGoals = _interopRequireWildcard(require("./CompetenceGoals"));
82
-
83
23
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
84
24
 
85
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
86
-
87
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
package/lib/index.d.ts CHANGED
@@ -7,12 +7,15 @@
7
7
  */
8
8
  /** @ts-ignore */
9
9
  export * from './index-javascript';
10
+ export { default as SectionHeading } from './SectionHeading';
10
11
  export { ArticleByline, ArticleContent, ArticleFootNotes, ArticleIntroduction, ArticleTitle, ArticleWrapper, ArticleHeaderWrapper, ArticleSideBar, default as Article, ArticleFavoritesButton, } from './Article';
12
+ export { CompetenceGoalsDialog } from './CompetenceGoals';
13
+ export { default as TopicIntroductionList } from './TopicIntroductionList';
11
14
  export { default as Table } from './Table';
12
15
  export { default as ResourcesWrapper, ResourcesTitle, ResourcesTopicTitle } from './ResourcesWrapper';
13
16
  export { createUniversalPortal } from './utils/createUniversalPortal';
14
17
  export { default as NoContentBox } from './NoContentBox';
15
- export { default as Masthead, MastheadItem, getMastheadHeight, useMastheadHeight } from './Masthead';
18
+ export { default as Masthead, MastheadItem, getMastheadHeight, useMastheadHeight, SkipToMainContent } from './Masthead';
16
19
  export { default as Portrait } from './Portrait';
17
20
  export { default as ContentLoader } from './ContentLoader';
18
21
  export { default as RelatedArticleList, RelatedArticle } from './RelatedArticleList';
@@ -28,6 +31,7 @@ export { default as Image, ImageLink, makeSrcQueryString } from './Image';
28
31
  export type { ImageCrop, ImageFocalPoint } from './Image';
29
32
  export type { HeroContentType } from './Hero';
30
33
  export { SubjectMaterialHero, TasksAndActivitiesHero, AssessmentResourcesHero, SubjectHero, ExternalLearningResourcesHero, SourceMaterialHero, Hero, NdlaFilmHero, } from './Hero';
34
+ export { FilterList, FilterListPhone, FilterButtons } from './Filter';
31
35
  export { Footer, EditorName, FooterText, FooterAuth } from './Footer';
32
36
  export { Figure, FigureCaption, FigureLicenseDialog, FigureExpandButton, FigureOpenDialogButton, FigureBylineExpandButton, } from './Figure';
33
37
  export type { FigureType } from './Figure';
@@ -72,7 +76,7 @@ export { FilmSlideshow, MovieGrid, AboutNdlaFilm, FilmMovieSearch, FilmMovieList
72
76
  export { DisplayOnPageYOffset } from './Animation';
73
77
  export { MediaList, MediaListItem, MediaListItemBody, MediaListItemActions, MediaListItemImage, MediaListItemMeta, } from './MediaList';
74
78
  export { default as ContentTypeBadge, SubjectMaterialBadge, TasksAndActivitiesBadge, AssessmentResourcesBadge, LearningPathBadge, SubjectBadge, ExternalLearningResourcesBadge, SourceMaterialBadge, } from './ContentTypeBadge';
75
- export { SubjectAbout, SubjectArchive, SubjectCarousel, SubjectChildContent, SubjectContent, SubjectFilter, SubjectFlexChild, SubjectFlexWrapper, SubjectHeader, SubjectLinks, SubjectNewContent, SubjectSecondaryContent, SubjectSectionTitle, SubjectShortcuts, SubjectSidebarWrapper, SubjectSocialContent, SubjectSocialSection, SubjectTopics, SubjectBanner, } from './Subject';
79
+ export { SubjectAbout, SubjectArchive, SubjectCarousel, SubjectChildContent, SubjectContent, SubjectFlexChild, SubjectFlexWrapper, SubjectHeader, SubjectLinks, SubjectNewContent, SubjectSecondaryContent, SubjectSectionTitle, SubjectShortcuts, SubjectSidebarWrapper, SubjectSocialContent, SubjectSocialSection, SubjectTopics, SubjectBanner, } from './Subject';
76
80
  export { default as ContentCard } from './ContentCard';
77
81
  export { default as CopyParagraphButton } from './CopyParagraphButton';
78
82
  export { default as ContentPlaceholder } from './ContentPlaceholder';
package/lib/index.js CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  var _exportNames = {
9
+ SectionHeading: true,
9
10
  ArticleByline: true,
10
11
  ArticleContent: true,
11
12
  ArticleFootNotes: true,
@@ -16,6 +17,8 @@ var _exportNames = {
16
17
  ArticleSideBar: true,
17
18
  Article: true,
18
19
  ArticleFavoritesButton: true,
20
+ CompetenceGoalsDialog: true,
21
+ TopicIntroductionList: true,
19
22
  Table: true,
20
23
  ResourcesWrapper: true,
21
24
  ResourcesTitle: true,
@@ -26,6 +29,7 @@ var _exportNames = {
26
29
  MastheadItem: true,
27
30
  getMastheadHeight: true,
28
31
  useMastheadHeight: true,
32
+ SkipToMainContent: true,
29
33
  Portrait: true,
30
34
  ContentLoader: true,
31
35
  RelatedArticleList: true,
@@ -59,6 +63,9 @@ var _exportNames = {
59
63
  SourceMaterialHero: true,
60
64
  Hero: true,
61
65
  NdlaFilmHero: true,
66
+ FilterList: true,
67
+ FilterListPhone: true,
68
+ FilterButtons: true,
62
69
  Footer: true,
63
70
  EditorName: true,
64
71
  FooterText: true,
@@ -158,7 +165,6 @@ var _exportNames = {
158
165
  SubjectCarousel: true,
159
166
  SubjectChildContent: true,
160
167
  SubjectContent: true,
161
- SubjectFilter: true,
162
168
  SubjectFlexChild: true,
163
169
  SubjectFlexWrapper: true,
164
170
  SubjectHeader: true,
@@ -195,6 +201,12 @@ var _exportNames = {
195
201
  ActiveFilters: true,
196
202
  ToggleSearchButton: true
197
203
  };
204
+ Object.defineProperty(exports, "SectionHeading", {
205
+ enumerable: true,
206
+ get: function get() {
207
+ return _SectionHeading["default"];
208
+ }
209
+ });
198
210
  Object.defineProperty(exports, "ArticleByline", {
199
211
  enumerable: true,
200
212
  get: function get() {
@@ -255,6 +267,18 @@ Object.defineProperty(exports, "ArticleFavoritesButton", {
255
267
  return _Article.ArticleFavoritesButton;
256
268
  }
257
269
  });
270
+ Object.defineProperty(exports, "CompetenceGoalsDialog", {
271
+ enumerable: true,
272
+ get: function get() {
273
+ return _CompetenceGoals.CompetenceGoalsDialog;
274
+ }
275
+ });
276
+ Object.defineProperty(exports, "TopicIntroductionList", {
277
+ enumerable: true,
278
+ get: function get() {
279
+ return _TopicIntroductionList["default"];
280
+ }
281
+ });
258
282
  Object.defineProperty(exports, "Table", {
259
283
  enumerable: true,
260
284
  get: function get() {
@@ -315,6 +339,12 @@ Object.defineProperty(exports, "useMastheadHeight", {
315
339
  return _Masthead.useMastheadHeight;
316
340
  }
317
341
  });
342
+ Object.defineProperty(exports, "SkipToMainContent", {
343
+ enumerable: true,
344
+ get: function get() {
345
+ return _Masthead.SkipToMainContent;
346
+ }
347
+ });
318
348
  Object.defineProperty(exports, "Portrait", {
319
349
  enumerable: true,
320
350
  get: function get() {
@@ -513,6 +543,24 @@ Object.defineProperty(exports, "NdlaFilmHero", {
513
543
  return _Hero.NdlaFilmHero;
514
544
  }
515
545
  });
546
+ Object.defineProperty(exports, "FilterList", {
547
+ enumerable: true,
548
+ get: function get() {
549
+ return _Filter.FilterList;
550
+ }
551
+ });
552
+ Object.defineProperty(exports, "FilterListPhone", {
553
+ enumerable: true,
554
+ get: function get() {
555
+ return _Filter.FilterListPhone;
556
+ }
557
+ });
558
+ Object.defineProperty(exports, "FilterButtons", {
559
+ enumerable: true,
560
+ get: function get() {
561
+ return _Filter.FilterButtons;
562
+ }
563
+ });
516
564
  Object.defineProperty(exports, "Footer", {
517
565
  enumerable: true,
518
566
  get: function get() {
@@ -1107,12 +1155,6 @@ Object.defineProperty(exports, "SubjectContent", {
1107
1155
  return _Subject.SubjectContent;
1108
1156
  }
1109
1157
  });
1110
- Object.defineProperty(exports, "SubjectFilter", {
1111
- enumerable: true,
1112
- get: function get() {
1113
- return _Subject.SubjectFilter;
1114
- }
1115
- });
1116
1158
  Object.defineProperty(exports, "SubjectFlexChild", {
1117
1159
  enumerable: true,
1118
1160
  get: function get() {
@@ -1337,8 +1379,14 @@ Object.keys(_indexJavascript).forEach(function (key) {
1337
1379
  });
1338
1380
  });
1339
1381
 
1382
+ var _SectionHeading = _interopRequireDefault(require("./SectionHeading"));
1383
+
1340
1384
  var _Article = _interopRequireWildcard(require("./Article"));
1341
1385
 
1386
+ var _CompetenceGoals = require("./CompetenceGoals");
1387
+
1388
+ var _TopicIntroductionList = _interopRequireDefault(require("./TopicIntroductionList"));
1389
+
1342
1390
  var _Table = _interopRequireDefault(require("./Table"));
1343
1391
 
1344
1392
  var _ResourcesWrapper = _interopRequireWildcard(require("./ResourcesWrapper"));
@@ -1375,6 +1423,8 @@ var _Image = _interopRequireWildcard(require("./Image"));
1375
1423
 
1376
1424
  var _Hero = require("./Hero");
1377
1425
 
1426
+ var _Filter = require("./Filter");
1427
+
1378
1428
  var _Footer = require("./Footer");
1379
1429
 
1380
1430
  var _Figure = require("./Figure");
@@ -1477,8 +1527,8 @@ var _TreeStructure = require("./TreeStructure");
1477
1527
 
1478
1528
  var _Search = require("./Search");
1479
1529
 
1480
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1481
-
1482
1530
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
1483
1531
 
1484
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
1532
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
1533
+
1534
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "24.2.2",
3
+ "version": "25.0.2",
4
4
  "description": "UI component library for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -32,18 +32,18 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@ndla/article-scripts": "^3.0.1",
35
- "@ndla/button": "^3.3.3",
36
- "@ndla/carousel": "^1.2.17",
35
+ "@ndla/button": "^3.3.4",
36
+ "@ndla/carousel": "^1.2.18",
37
37
  "@ndla/core": "^2.3.4",
38
- "@ndla/forms": "^3.1.6",
38
+ "@ndla/forms": "^3.1.7",
39
39
  "@ndla/hooks": "^1.1.5",
40
- "@ndla/icons": "^1.11.5",
41
- "@ndla/licenses": "^5.0.10",
42
- "@ndla/modal": "^1.3.1",
43
- "@ndla/notion": "^3.1.34",
44
- "@ndla/safelink": "^2.2.9",
40
+ "@ndla/icons": "^1.11.6",
41
+ "@ndla/licenses": "^5.0.11",
42
+ "@ndla/modal": "^1.3.2",
43
+ "@ndla/notion": "^3.1.35",
44
+ "@ndla/safelink": "^2.2.10",
45
45
  "@ndla/switch": "^0.1.12",
46
- "@ndla/tabs": "^1.1.16",
46
+ "@ndla/tabs": "^1.1.17",
47
47
  "@ndla/tooltip": "^2.2.0",
48
48
  "@ndla/types-learningpath-api": "^0.0.13",
49
49
  "@ndla/util": "^3.0.1",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "5150e405d5a94a7a48e57331da3bbac47537833c"
88
+ "gitHead": "67a6b882ad4c1c4619fe0ffae2f226275b1db676"
89
89
  }
@@ -6,14 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import React, { Fragment } from 'react';
10
- import PropTypes from 'prop-types';
9
+ import React, { ComponentProps, ReactNode } from 'react';
11
10
  import { useTranslation } from 'react-i18next';
12
- import { fonts } from '@ndla/core';
11
+ import { breakpoints, fonts, mq } from '@ndla/core';
13
12
  import Modal, { ModalHeader, ModalBody, ModalCloseButton } from '@ndla/modal';
14
13
  import { FooterHeaderIcon } from '@ndla/icons/common';
15
14
  import styled from '@emotion/styled';
16
- import { classes } from './CompetenceGoals';
17
15
 
18
16
  const HeaderWrapper = styled.div`
19
17
  padding: 14px 20px 14px 0;
@@ -31,7 +29,35 @@ const HeadingWrapper = styled.h2`
31
29
  font-weight: ${fonts.weight.semibold};
32
30
  `;
33
31
 
34
- export const CompetenceGoalsDialog = ({ children, isOpen, onClose, subjectName, modalProps }) => {
32
+ interface Props {
33
+ children?: ReactNode;
34
+ modalProps?: ComponentProps<typeof Modal>;
35
+ isOpen?: boolean;
36
+ onClose?: () => void;
37
+ subjectName?: string;
38
+ curriculums?: {
39
+ id: string;
40
+ name: string;
41
+ goals?: {
42
+ id: string;
43
+ name: string;
44
+ }[];
45
+ }[];
46
+ }
47
+
48
+ const CompetenceGoalsWrapper = styled.div`
49
+ height: 100%;
50
+ max-width: 960px;
51
+ width: 100%;
52
+ margin: 0 auto;
53
+ padding: 32px;
54
+
55
+ ${mq.range({ from: breakpoints.mobile })} {
56
+ padding: 0;
57
+ }
58
+ `;
59
+
60
+ export const CompetenceGoalsDialog = ({ children, isOpen, onClose, subjectName, modalProps }: Props) => {
35
61
  const { t } = useTranslation();
36
62
  const iconId = 'popupCompetenceGoals';
37
63
 
@@ -46,7 +72,7 @@ export const CompetenceGoalsDialog = ({ children, isOpen, onClose, subjectName,
46
72
  backgroundColor="light-gradient"
47
73
  narrow>
48
74
  {(close) => (
49
- <Fragment>
75
+ <>
50
76
  <ModalHeader modifier="menu">
51
77
  <HeaderWrapper>
52
78
  <HeadingWrapper>
@@ -57,30 +83,12 @@ export const CompetenceGoalsDialog = ({ children, isOpen, onClose, subjectName,
57
83
  </HeaderWrapper>
58
84
  </ModalHeader>
59
85
  <ModalBody>
60
- <div {...classes()} className="c-competence-goals">
61
- {children}
62
- </div>
86
+ <CompetenceGoalsWrapper>{children}</CompetenceGoalsWrapper>
63
87
  </ModalBody>
64
- </Fragment>
88
+ </>
65
89
  )}
66
90
  </Modal>
67
91
  );
68
92
  };
69
93
 
70
- CompetenceGoalsDialog.propTypes = {
71
- curriculums: PropTypes.arrayOf(
72
- PropTypes.shape({
73
- id: PropTypes.string.isRequired,
74
- name: PropTypes.string.isRequired,
75
- goals: PropTypes.arrayOf(
76
- PropTypes.shape({
77
- id: PropTypes.string.isRequired,
78
- name: PropTypes.string.isRequired,
79
- }),
80
- ),
81
- }),
82
- ),
83
- subjectName: PropTypes.string,
84
- };
85
-
86
94
  export default CompetenceGoalsDialog;
@@ -0,0 +1 @@
1
+ export { default as CompetenceGoalsDialog } from './CompetenceGoalsDialog';
@@ -12,7 +12,6 @@ import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
12
12
  import { useTranslation } from 'react-i18next';
13
13
  import { Cross as CrossIcon, Plus as PlusIcon } from '@ndla/icons/action';
14
14
  import Modal, { ModalHeader, ModalBody, ModalCloseButton } from '@ndla/modal';
15
- // @ts-ignore
16
15
  import ToggleItem from './ToggleItem';
17
16
  import FilterCarousel from './FilterCarousel';
18
17
 
@@ -0,0 +1,135 @@
1
+ /*
2
+ * Copyright (c) 2016-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
+ * FRI OG BEGRENSET
7
+ */
8
+
9
+ import React, { ReactNode, useState } from 'react';
10
+ import { ChevronDown, ChevronUp } from '@ndla/icons/common';
11
+
12
+ import { classes } from './filterClasses';
13
+ import ToggleItem from './ToggleItem';
14
+
15
+ interface Props {
16
+ children?: ReactNode;
17
+ label?: string;
18
+ preid?: string;
19
+ labelNotVisible?: boolean;
20
+ modifiers?: string;
21
+ onChange?: Function;
22
+ options: {
23
+ title: string;
24
+ value: string;
25
+ hits?: number;
26
+ icon?: ReactNode;
27
+ noResults?: boolean;
28
+ }[];
29
+ values: string[];
30
+ defaultVisibleCount?: number;
31
+ showLabel?: string;
32
+ noFilterSelectedLabel?: string;
33
+ hideLabel?: string;
34
+ alignedGroup?: boolean;
35
+ collapseMobile?: boolean;
36
+ }
37
+
38
+ const FilterList = ({
39
+ modifiers = '',
40
+ preid = '',
41
+ label = 'FILTER:',
42
+ labelNotVisible,
43
+ options,
44
+ values = [],
45
+ onChange,
46
+ defaultVisibleCount,
47
+ showLabel,
48
+ hideLabel,
49
+ alignedGroup,
50
+ collapseMobile,
51
+ noFilterSelectedLabel,
52
+ }: Props) => {
53
+ const [visibleCount, setVisibleCount] = useState<number | undefined>(defaultVisibleCount);
54
+
55
+ const showAll = defaultVisibleCount === undefined || options.length <= defaultVisibleCount;
56
+ const labelModifiers = [];
57
+
58
+ if (labelNotVisible) {
59
+ labelModifiers.push('hidden');
60
+ }
61
+
62
+ return (
63
+ <section {...classes('list', modifiers)}>
64
+ {label && <h1 {...classes('label', labelModifiers)}>{label}</h1>}
65
+ {noFilterSelectedLabel && options.length === 0 && (
66
+ <span {...classes('no-filter-selected')}>{noFilterSelectedLabel}</span>
67
+ )}
68
+ <ul
69
+ {...classes('item-wrapper', {
70
+ 'aligned-grouping': !!alignedGroup,
71
+ 'collapse-mobile': !!collapseMobile,
72
+ })}>
73
+ {options.map((option, index) => {
74
+ const itemModifiers = [];
75
+
76
+ const checked = values.some((value) => value === option.value);
77
+
78
+ if (!showAll && !checked && index + 1 > (visibleCount ?? 0)) {
79
+ itemModifiers.push('hidden');
80
+ }
81
+
82
+ const disabled = option.noResults || option.hits === 0;
83
+
84
+ if (disabled) {
85
+ itemModifiers.push('no-results');
86
+ }
87
+
88
+ return (
89
+ <ToggleItem
90
+ modifiers={itemModifiers}
91
+ id={preid + option.value}
92
+ key={option.value}
93
+ value={option.value}
94
+ disabled={disabled}
95
+ tabIndex={disabled ? -1 : 0}
96
+ checked={checked}
97
+ label={option.title}
98
+ onChange={(event) => {
99
+ let newValues = null;
100
+ if (event.currentTarget.checked) {
101
+ newValues = [...values, option.value];
102
+ } else {
103
+ newValues = values.filter((value) => value !== option.value);
104
+ }
105
+ if (onChange) {
106
+ onChange(newValues, option.value);
107
+ }
108
+ }}
109
+ />
110
+ );
111
+ })}
112
+ </ul>
113
+ {!showAll && (
114
+ <button
115
+ {...classes('expand')}
116
+ type="button"
117
+ onClick={() => {
118
+ setVisibleCount((prev) => (prev === defaultVisibleCount ? options.length : defaultVisibleCount));
119
+ }}>
120
+ {visibleCount === defaultVisibleCount ? (
121
+ <>
122
+ <span>{showLabel}</span> <ChevronDown />
123
+ </>
124
+ ) : (
125
+ <>
126
+ <span>{hideLabel}</span> <ChevronUp />
127
+ </>
128
+ )}
129
+ </button>
130
+ )}
131
+ </section>
132
+ );
133
+ };
134
+
135
+ export default FilterList;