@ndla/ui 24.2.1 → 25.0.1
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/CompetenceGoals/CompetenceGoalsDialog.js +15 -24
- package/es/CompetenceGoals/index.js +1 -4
- package/es/Filter/FilterButtons.js +10 -11
- package/es/Filter/FilterList.js +82 -152
- package/es/Filter/FilterListPhone.js +180 -272
- package/es/Filter/ToggleItem.js +6 -25
- package/es/Frontpage/FrontpageAllSubjects.js +8 -9
- package/es/Frontpage/FrontpageSearch.js +3 -4
- package/es/LearningPaths/LearningPathMenuModalWrapper.js +1 -2
- package/es/Masthead/Masthead.js +65 -41
- package/es/Masthead/MastheadSearchModal.js +4 -5
- package/es/Masthead/SkipToMainContent.js +24 -0
- package/es/Masthead/index.js +2 -1
- package/es/SearchTypeResult/PopupFilter.js +8 -9
- package/es/SearchTypeResult/SearchFilterContent.js +3 -4
- package/es/SectionHeading/SectionHeading.js +24 -17
- package/es/Subject/index.js +0 -1
- package/es/User/UserInfo.js +11 -3
- package/es/all.css +1 -1
- package/es/index-javascript.js +1 -4
- package/es/index.js +5 -2
- package/es/locale/messages-en.js +1 -0
- package/es/locale/messages-nb.js +1 -0
- package/es/locale/messages-nn.js +1 -0
- package/es/locale/messages-se.js +1 -0
- package/es/locale/messages-sma.js +1 -0
- package/lib/CompetenceGoals/CompetenceGoalsDialog.d.ts +19 -0
- package/lib/CompetenceGoals/CompetenceGoalsDialog.js +13 -25
- package/lib/CompetenceGoals/index.d.ts +1 -0
- package/lib/CompetenceGoals/index.js +1 -33
- package/lib/Filter/FilterButtons.js +9 -9
- package/lib/Filter/FilterList.d.ts +25 -0
- package/lib/Filter/FilterList.js +85 -155
- package/lib/Filter/FilterListPhone.d.ts +32 -0
- package/lib/Filter/FilterListPhone.js +176 -270
- package/lib/Filter/ToggleItem.d.ts +15 -0
- package/lib/Filter/ToggleItem.js +6 -32
- package/lib/Filter/filterClasses.d.ts +2 -0
- package/lib/Filter/index.d.ts +12 -0
- package/lib/Frontpage/FrontpageAllSubjects.js +7 -7
- package/lib/Frontpage/FrontpageSearch.js +2 -3
- package/lib/LearningPaths/LearningPathMenuModalWrapper.js +1 -2
- package/lib/Masthead/Masthead.d.ts +4 -8
- package/lib/Masthead/Masthead.js +65 -49
- package/lib/Masthead/MastheadSearchModal.js +3 -4
- package/lib/Masthead/SkipToMainContent.d.ts +6 -0
- package/lib/Masthead/SkipToMainContent.js +38 -0
- package/lib/Masthead/index.d.ts +2 -1
- package/lib/Masthead/index.js +10 -0
- package/lib/SearchTypeResult/PopupFilter.js +7 -7
- package/lib/SearchTypeResult/SearchFilterContent.js +2 -2
- package/lib/SectionHeading/SectionHeading.d.ts +1 -13
- package/lib/SectionHeading/SectionHeading.js +23 -19
- package/lib/Subject/index.d.ts +0 -1
- package/lib/Subject/index.js +0 -8
- package/lib/User/UserInfo.js +11 -3
- package/lib/all.css +1 -1
- package/lib/index-javascript.js +1 -63
- package/lib/index.d.ts +5 -2
- package/lib/index.js +48 -7
- package/lib/locale/messages-en.d.ts +1 -0
- package/lib/locale/messages-en.js +1 -0
- package/lib/locale/messages-nb.d.ts +1 -0
- package/lib/locale/messages-nb.js +1 -0
- package/lib/locale/messages-nn.d.ts +1 -0
- package/lib/locale/messages-nn.js +1 -0
- package/lib/locale/messages-se.d.ts +1 -0
- package/lib/locale/messages-se.js +1 -0
- package/lib/locale/messages-sma.d.ts +1 -0
- package/lib/locale/messages-sma.js +1 -0
- package/package.json +11 -11
- package/src/.DS_Store +0 -0
- package/src/CompetenceGoals/{CompetenceGoalsDialog.jsx → CompetenceGoalsDialog.tsx} +34 -27
- package/src/CompetenceGoals/index.ts +1 -0
- package/src/Filter/FilterButtons.tsx +0 -1
- package/src/Filter/FilterList.tsx +135 -0
- package/src/Filter/FilterListPhone.tsx +275 -0
- package/src/Filter/ToggleItem.tsx +58 -0
- package/src/Filter/{filterClasses.js → filterClasses.ts} +0 -0
- package/src/Filter/{index.js → index.ts} +0 -0
- package/src/Frontpage/FrontpageAllSubjects.tsx +0 -1
- package/src/Frontpage/FrontpageSearch.tsx +0 -1
- package/src/LearningPaths/LearningPathMenuModalWrapper.tsx +0 -1
- package/src/Masthead/Masthead.tsx +85 -45
- package/src/Masthead/MastheadSearchModal.tsx +0 -1
- package/src/Masthead/SkipToMainContent.tsx +48 -0
- package/src/Masthead/index.ts +2 -1
- package/src/SearchTypeResult/PopupFilter.tsx +0 -1
- package/src/SearchTypeResult/SearchFilterContent.tsx +0 -1
- package/src/SectionHeading/SectionHeading.tsx +29 -16
- package/src/Subject/index.ts +0 -1
- package/src/User/UserInfo.tsx +4 -4
- package/src/index-javascript.js +0 -10
- package/src/index.ts +7 -2
- package/src/locale/messages-en.ts +1 -0
- package/src/locale/messages-nb.ts +1 -0
- package/src/locale/messages-nn.ts +1 -0
- package/src/locale/messages-se.ts +1 -0
- package/src/locale/messages-sma.ts +1 -0
- package/src/main.scss +0 -3
- package/es/CompetenceGoals/CompetenceGoalList.js +0 -58
- package/es/CompetenceGoals/CompetenceGoals.js +0 -159
- package/es/Subject/SubjectFilter.js +0 -42
- package/lib/CompetenceGoals/CompetenceGoalList.js +0 -78
- package/lib/CompetenceGoals/CompetenceGoals.js +0 -184
- package/lib/Subject/SubjectFilter.d.ts +0 -27
- package/lib/Subject/SubjectFilter.js +0 -58
- package/src/CompetenceGoals/CompetenceGoalList.jsx +0 -51
- package/src/CompetenceGoals/CompetenceGoals.jsx +0 -152
- package/src/CompetenceGoals/component.competence-goals.scss +0 -161
- package/src/CompetenceGoals/index.js +0 -6
- package/src/Filter/FilterList.jsx +0 -167
- package/src/Filter/FilterListPhone.jsx +0 -329
- package/src/Filter/ToggleItem.jsx +0 -71
- package/src/Masthead/component.masthead.scss +0 -146
- package/src/SectionHeading/component.section-heading.scss +0 -17
- package/src/Subject/SubjectFilter.tsx +0 -48
package/lib/index-javascript.js
CHANGED
|
@@ -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
|
@@ -8,11 +8,13 @@
|
|
|
8
8
|
/** @ts-ignore */
|
|
9
9
|
export * from './index-javascript';
|
|
10
10
|
export { ArticleByline, ArticleContent, ArticleFootNotes, ArticleIntroduction, ArticleTitle, ArticleWrapper, ArticleHeaderWrapper, ArticleSideBar, default as Article, ArticleFavoritesButton, } from './Article';
|
|
11
|
+
export { CompetenceGoalsDialog } from './CompetenceGoals';
|
|
12
|
+
export { default as TopicIntroductionList } from './TopicIntroductionList';
|
|
11
13
|
export { default as Table } from './Table';
|
|
12
14
|
export { default as ResourcesWrapper, ResourcesTitle, ResourcesTopicTitle } from './ResourcesWrapper';
|
|
13
15
|
export { createUniversalPortal } from './utils/createUniversalPortal';
|
|
14
16
|
export { default as NoContentBox } from './NoContentBox';
|
|
15
|
-
export { default as Masthead, MastheadItem, getMastheadHeight, useMastheadHeight } from './Masthead';
|
|
17
|
+
export { default as Masthead, MastheadItem, getMastheadHeight, useMastheadHeight, SkipToMainContent } from './Masthead';
|
|
16
18
|
export { default as Portrait } from './Portrait';
|
|
17
19
|
export { default as ContentLoader } from './ContentLoader';
|
|
18
20
|
export { default as RelatedArticleList, RelatedArticle } from './RelatedArticleList';
|
|
@@ -28,6 +30,7 @@ export { default as Image, ImageLink, makeSrcQueryString } from './Image';
|
|
|
28
30
|
export type { ImageCrop, ImageFocalPoint } from './Image';
|
|
29
31
|
export type { HeroContentType } from './Hero';
|
|
30
32
|
export { SubjectMaterialHero, TasksAndActivitiesHero, AssessmentResourcesHero, SubjectHero, ExternalLearningResourcesHero, SourceMaterialHero, Hero, NdlaFilmHero, } from './Hero';
|
|
33
|
+
export { FilterList, FilterListPhone, FilterButtons } from './Filter';
|
|
31
34
|
export { Footer, EditorName, FooterText, FooterAuth } from './Footer';
|
|
32
35
|
export { Figure, FigureCaption, FigureLicenseDialog, FigureExpandButton, FigureOpenDialogButton, FigureBylineExpandButton, } from './Figure';
|
|
33
36
|
export type { FigureType } from './Figure';
|
|
@@ -72,7 +75,7 @@ export { FilmSlideshow, MovieGrid, AboutNdlaFilm, FilmMovieSearch, FilmMovieList
|
|
|
72
75
|
export { DisplayOnPageYOffset } from './Animation';
|
|
73
76
|
export { MediaList, MediaListItem, MediaListItemBody, MediaListItemActions, MediaListItemImage, MediaListItemMeta, } from './MediaList';
|
|
74
77
|
export { default as ContentTypeBadge, SubjectMaterialBadge, TasksAndActivitiesBadge, AssessmentResourcesBadge, LearningPathBadge, SubjectBadge, ExternalLearningResourcesBadge, SourceMaterialBadge, } from './ContentTypeBadge';
|
|
75
|
-
export { SubjectAbout, SubjectArchive, SubjectCarousel, SubjectChildContent, SubjectContent,
|
|
78
|
+
export { SubjectAbout, SubjectArchive, SubjectCarousel, SubjectChildContent, SubjectContent, SubjectFlexChild, SubjectFlexWrapper, SubjectHeader, SubjectLinks, SubjectNewContent, SubjectSecondaryContent, SubjectSectionTitle, SubjectShortcuts, SubjectSidebarWrapper, SubjectSocialContent, SubjectSocialSection, SubjectTopics, SubjectBanner, } from './Subject';
|
|
76
79
|
export { default as ContentCard } from './ContentCard';
|
|
77
80
|
export { default as CopyParagraphButton } from './CopyParagraphButton';
|
|
78
81
|
export { default as ContentPlaceholder } from './ContentPlaceholder';
|
package/lib/index.js
CHANGED
|
@@ -16,6 +16,8 @@ var _exportNames = {
|
|
|
16
16
|
ArticleSideBar: true,
|
|
17
17
|
Article: true,
|
|
18
18
|
ArticleFavoritesButton: true,
|
|
19
|
+
CompetenceGoalsDialog: true,
|
|
20
|
+
TopicIntroductionList: true,
|
|
19
21
|
Table: true,
|
|
20
22
|
ResourcesWrapper: true,
|
|
21
23
|
ResourcesTitle: true,
|
|
@@ -26,6 +28,7 @@ var _exportNames = {
|
|
|
26
28
|
MastheadItem: true,
|
|
27
29
|
getMastheadHeight: true,
|
|
28
30
|
useMastheadHeight: true,
|
|
31
|
+
SkipToMainContent: true,
|
|
29
32
|
Portrait: true,
|
|
30
33
|
ContentLoader: true,
|
|
31
34
|
RelatedArticleList: true,
|
|
@@ -59,6 +62,9 @@ var _exportNames = {
|
|
|
59
62
|
SourceMaterialHero: true,
|
|
60
63
|
Hero: true,
|
|
61
64
|
NdlaFilmHero: true,
|
|
65
|
+
FilterList: true,
|
|
66
|
+
FilterListPhone: true,
|
|
67
|
+
FilterButtons: true,
|
|
62
68
|
Footer: true,
|
|
63
69
|
EditorName: true,
|
|
64
70
|
FooterText: true,
|
|
@@ -158,7 +164,6 @@ var _exportNames = {
|
|
|
158
164
|
SubjectCarousel: true,
|
|
159
165
|
SubjectChildContent: true,
|
|
160
166
|
SubjectContent: true,
|
|
161
|
-
SubjectFilter: true,
|
|
162
167
|
SubjectFlexChild: true,
|
|
163
168
|
SubjectFlexWrapper: true,
|
|
164
169
|
SubjectHeader: true,
|
|
@@ -255,6 +260,18 @@ Object.defineProperty(exports, "ArticleFavoritesButton", {
|
|
|
255
260
|
return _Article.ArticleFavoritesButton;
|
|
256
261
|
}
|
|
257
262
|
});
|
|
263
|
+
Object.defineProperty(exports, "CompetenceGoalsDialog", {
|
|
264
|
+
enumerable: true,
|
|
265
|
+
get: function get() {
|
|
266
|
+
return _CompetenceGoals.CompetenceGoalsDialog;
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
Object.defineProperty(exports, "TopicIntroductionList", {
|
|
270
|
+
enumerable: true,
|
|
271
|
+
get: function get() {
|
|
272
|
+
return _TopicIntroductionList["default"];
|
|
273
|
+
}
|
|
274
|
+
});
|
|
258
275
|
Object.defineProperty(exports, "Table", {
|
|
259
276
|
enumerable: true,
|
|
260
277
|
get: function get() {
|
|
@@ -315,6 +332,12 @@ Object.defineProperty(exports, "useMastheadHeight", {
|
|
|
315
332
|
return _Masthead.useMastheadHeight;
|
|
316
333
|
}
|
|
317
334
|
});
|
|
335
|
+
Object.defineProperty(exports, "SkipToMainContent", {
|
|
336
|
+
enumerable: true,
|
|
337
|
+
get: function get() {
|
|
338
|
+
return _Masthead.SkipToMainContent;
|
|
339
|
+
}
|
|
340
|
+
});
|
|
318
341
|
Object.defineProperty(exports, "Portrait", {
|
|
319
342
|
enumerable: true,
|
|
320
343
|
get: function get() {
|
|
@@ -513,6 +536,24 @@ Object.defineProperty(exports, "NdlaFilmHero", {
|
|
|
513
536
|
return _Hero.NdlaFilmHero;
|
|
514
537
|
}
|
|
515
538
|
});
|
|
539
|
+
Object.defineProperty(exports, "FilterList", {
|
|
540
|
+
enumerable: true,
|
|
541
|
+
get: function get() {
|
|
542
|
+
return _Filter.FilterList;
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
Object.defineProperty(exports, "FilterListPhone", {
|
|
546
|
+
enumerable: true,
|
|
547
|
+
get: function get() {
|
|
548
|
+
return _Filter.FilterListPhone;
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
Object.defineProperty(exports, "FilterButtons", {
|
|
552
|
+
enumerable: true,
|
|
553
|
+
get: function get() {
|
|
554
|
+
return _Filter.FilterButtons;
|
|
555
|
+
}
|
|
556
|
+
});
|
|
516
557
|
Object.defineProperty(exports, "Footer", {
|
|
517
558
|
enumerable: true,
|
|
518
559
|
get: function get() {
|
|
@@ -1107,12 +1148,6 @@ Object.defineProperty(exports, "SubjectContent", {
|
|
|
1107
1148
|
return _Subject.SubjectContent;
|
|
1108
1149
|
}
|
|
1109
1150
|
});
|
|
1110
|
-
Object.defineProperty(exports, "SubjectFilter", {
|
|
1111
|
-
enumerable: true,
|
|
1112
|
-
get: function get() {
|
|
1113
|
-
return _Subject.SubjectFilter;
|
|
1114
|
-
}
|
|
1115
|
-
});
|
|
1116
1151
|
Object.defineProperty(exports, "SubjectFlexChild", {
|
|
1117
1152
|
enumerable: true,
|
|
1118
1153
|
get: function get() {
|
|
@@ -1339,6 +1374,10 @@ Object.keys(_indexJavascript).forEach(function (key) {
|
|
|
1339
1374
|
|
|
1340
1375
|
var _Article = _interopRequireWildcard(require("./Article"));
|
|
1341
1376
|
|
|
1377
|
+
var _CompetenceGoals = require("./CompetenceGoals");
|
|
1378
|
+
|
|
1379
|
+
var _TopicIntroductionList = _interopRequireDefault(require("./TopicIntroductionList"));
|
|
1380
|
+
|
|
1342
1381
|
var _Table = _interopRequireDefault(require("./Table"));
|
|
1343
1382
|
|
|
1344
1383
|
var _ResourcesWrapper = _interopRequireWildcard(require("./ResourcesWrapper"));
|
|
@@ -1375,6 +1414,8 @@ var _Image = _interopRequireWildcard(require("./Image"));
|
|
|
1375
1414
|
|
|
1376
1415
|
var _Hero = require("./Hero");
|
|
1377
1416
|
|
|
1417
|
+
var _Filter = require("./Filter");
|
|
1418
|
+
|
|
1378
1419
|
var _Footer = require("./Footer");
|
|
1379
1420
|
|
|
1380
1421
|
var _Figure = require("./Figure");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.1",
|
|
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.
|
|
36
|
-
"@ndla/carousel": "^1.2.
|
|
35
|
+
"@ndla/button": "^3.3.4",
|
|
36
|
+
"@ndla/carousel": "^1.2.18",
|
|
37
37
|
"@ndla/core": "^2.3.4",
|
|
38
|
-
"@ndla/forms": "^3.1.
|
|
38
|
+
"@ndla/forms": "^3.1.7",
|
|
39
39
|
"@ndla/hooks": "^1.1.5",
|
|
40
|
-
"@ndla/icons": "^1.11.
|
|
41
|
-
"@ndla/licenses": "^5.0.
|
|
42
|
-
"@ndla/modal": "^1.3.
|
|
43
|
-
"@ndla/notion": "^3.1.
|
|
44
|
-
"@ndla/safelink": "^2.2.
|
|
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.
|
|
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": "
|
|
88
|
+
"gitHead": "39b5729fe67a1f6746df4cab2edba75918ca716c"
|
|
89
89
|
}
|
package/src/.DS_Store
ADDED
|
Binary file
|
|
@@ -6,14 +6,12 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import 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
|
-
|
|
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
|
|
|
@@ -43,11 +69,10 @@ export const CompetenceGoalsDialog = ({ children, isOpen, onClose, subjectName,
|
|
|
43
69
|
isOpen={isOpen}
|
|
44
70
|
onClose={onClose}
|
|
45
71
|
size="fullscreen"
|
|
46
|
-
animation="slide-up"
|
|
47
72
|
backgroundColor="light-gradient"
|
|
48
73
|
narrow>
|
|
49
74
|
{(close) => (
|
|
50
|
-
|
|
75
|
+
<>
|
|
51
76
|
<ModalHeader modifier="menu">
|
|
52
77
|
<HeaderWrapper>
|
|
53
78
|
<HeadingWrapper>
|
|
@@ -58,30 +83,12 @@ export const CompetenceGoalsDialog = ({ children, isOpen, onClose, subjectName,
|
|
|
58
83
|
</HeaderWrapper>
|
|
59
84
|
</ModalHeader>
|
|
60
85
|
<ModalBody>
|
|
61
|
-
<
|
|
62
|
-
{children}
|
|
63
|
-
</div>
|
|
86
|
+
<CompetenceGoalsWrapper>{children}</CompetenceGoalsWrapper>
|
|
64
87
|
</ModalBody>
|
|
65
|
-
|
|
88
|
+
</>
|
|
66
89
|
)}
|
|
67
90
|
</Modal>
|
|
68
91
|
);
|
|
69
92
|
};
|
|
70
93
|
|
|
71
|
-
CompetenceGoalsDialog.propTypes = {
|
|
72
|
-
curriculums: PropTypes.arrayOf(
|
|
73
|
-
PropTypes.shape({
|
|
74
|
-
id: PropTypes.string.isRequired,
|
|
75
|
-
name: PropTypes.string.isRequired,
|
|
76
|
-
goals: PropTypes.arrayOf(
|
|
77
|
-
PropTypes.shape({
|
|
78
|
-
id: PropTypes.string.isRequired,
|
|
79
|
-
name: PropTypes.string.isRequired,
|
|
80
|
-
}),
|
|
81
|
-
),
|
|
82
|
-
}),
|
|
83
|
-
),
|
|
84
|
-
subjectName: PropTypes.string,
|
|
85
|
-
};
|
|
86
|
-
|
|
87
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;
|