@ndla/ui 56.0.170-alpha.0 → 56.0.172-alpha.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/dist/panda.buildinfo.json +1 -2
- package/dist/styles.css +2 -6
- package/es/Article/Article.mjs +1 -27
- package/es/Article/Article.mjs.map +1 -1
- package/es/Article/ArticleByline.mjs +31 -28
- package/es/Article/ArticleByline.mjs.map +1 -1
- package/es/Article/ArticleFootNotes.mjs +1 -0
- package/es/Article/ArticleFootNotes.mjs.map +1 -1
- package/es/AudioPlayer/Controls.mjs +6 -6
- package/es/AudioPlayer/Controls.mjs.map +1 -1
- package/es/Embed/IframeEmbed.mjs +2 -2
- package/es/Embed/IframeEmbed.mjs.map +1 -1
- package/es/Gloss/GlossExample.mjs +8 -8
- package/es/Gloss/GlossExample.mjs.map +1 -1
- package/es/Grid/Grid.mjs +2 -2
- package/es/Grid/Grid.mjs.map +1 -1
- package/es/index.mjs +4 -9
- package/es/model/ContentType.mjs +1 -6
- package/es/model/ContentType.mjs.map +1 -1
- package/lib/Article/Article.d.ts +0 -13
- package/lib/Article/Article.js +0 -27
- package/lib/Article/Article.js.map +1 -1
- package/lib/Article/ArticleByline.d.ts +4 -0
- package/lib/Article/ArticleByline.js +30 -27
- package/lib/Article/ArticleByline.js.map +1 -1
- package/lib/Article/ArticleFootNotes.js +1 -0
- package/lib/Article/ArticleFootNotes.js.map +1 -1
- package/lib/AudioPlayer/Controls.js +6 -6
- package/lib/AudioPlayer/Controls.js.map +1 -1
- package/lib/Embed/IframeEmbed.js +2 -2
- package/lib/Embed/IframeEmbed.js.map +1 -1
- package/lib/Gloss/GlossExample.js +8 -8
- package/lib/Gloss/GlossExample.js.map +1 -1
- package/lib/Grid/Grid.js +2 -2
- package/lib/Grid/Grid.js.map +1 -1
- package/lib/index.d.ts +2 -8
- package/lib/index.js +28 -16
- package/lib/model/ContentType.js +0 -24
- package/lib/model/ContentType.js.map +1 -1
- package/package.json +7 -6
- package/src/Article/Article.tsx +0 -58
- package/src/Article/ArticleByline.tsx +42 -37
- package/src/Article/ArticleFootNotes.tsx +1 -1
- package/src/Grid/Grid.tsx +2 -2
- package/src/index.ts +1 -9
- package/es/ContentTypeBadge/ContentTypeBadge.mjs +0 -48
- package/es/ContentTypeBadge/ContentTypeBadge.mjs.map +0 -1
- package/es/i18n/formatNestedMessages.mjs +0 -17
- package/es/i18n/formatNestedMessages.mjs.map +0 -1
- package/es/locale/messages-en.mjs +0 -466
- package/es/locale/messages-en.mjs.map +0 -1
- package/es/locale/messages-nb.mjs +0 -466
- package/es/locale/messages-nb.mjs.map +0 -1
- package/es/locale/messages-nn.mjs +0 -466
- package/es/locale/messages-nn.mjs.map +0 -1
- package/es/locale/messages-se.mjs +0 -466
- package/es/locale/messages-se.mjs.map +0 -1
- package/lib/ContentTypeBadge/ContentTypeBadge.d.ts +0 -16
- package/lib/ContentTypeBadge/ContentTypeBadge.js +0 -50
- package/lib/ContentTypeBadge/ContentTypeBadge.js.map +0 -1
- package/lib/i18n/formatNestedMessages.d.ts +0 -15
- package/lib/i18n/formatNestedMessages.js +0 -18
- package/lib/i18n/formatNestedMessages.js.map +0 -1
- package/lib/locale/messages-en.d.ts +0 -440
- package/lib/locale/messages-en.js +0 -467
- package/lib/locale/messages-en.js.map +0 -1
- package/lib/locale/messages-nb.d.ts +0 -440
- package/lib/locale/messages-nb.js +0 -467
- package/lib/locale/messages-nb.js.map +0 -1
- package/lib/locale/messages-nn.d.ts +0 -440
- package/lib/locale/messages-nn.js +0 -467
- package/lib/locale/messages-nn.js.map +0 -1
- package/lib/locale/messages-se.d.ts +0 -440
- package/lib/locale/messages-se.js +0 -467
- package/lib/locale/messages-se.js.map +0 -1
- package/src/ContentTypeBadge/ContentTypeBadge.stories.tsx +0 -75
- package/src/ContentTypeBadge/ContentTypeBadge.tsx +0 -79
- package/src/i18n/__tests__/formatNestedMessages-test.ts +0 -29
- package/src/i18n/formatNestedMessages.ts +0 -37
- package/src/locale/__tests__/translations-test.ts +0 -39
- package/src/locale/messages-en.ts +0 -481
- package/src/locale/messages-nb.ts +0 -482
- package/src/locale/messages-nn.ts +0 -482
- package/src/locale/messages-se.ts +0 -483
package/lib/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.js');
|
|
1
2
|
const require_LicenseLink = require('./LicenseByline/LicenseLink.js');
|
|
2
3
|
const require_EmbedByline = require('./LicenseByline/EmbedByline.js');
|
|
3
4
|
const require_licenseAttributes = require('./utils/licenseAttributes.js');
|
|
@@ -26,10 +27,10 @@ const require_CodeBlock = require('./CodeBlock/CodeBlock.js');
|
|
|
26
27
|
const require_codeLanguageOptions = require('./CodeBlock/codeLanguageOptions.js');
|
|
27
28
|
const require_CodeEmbed = require('./Embed/CodeEmbed.js');
|
|
28
29
|
const require_EmbedWrapper = require('./Embed/EmbedWrapper.js');
|
|
29
|
-
const require_ArticleFootNotes = require('./Article/ArticleFootNotes.js');
|
|
30
|
-
const require_ArticleByline = require('./Article/ArticleByline.js');
|
|
31
30
|
const require_BadgesContainer = require('./Article/BadgesContainer.js');
|
|
32
31
|
const require_Article = require('./Article/Article.js');
|
|
32
|
+
const require_ArticleFootNotes = require('./Article/ArticleFootNotes.js');
|
|
33
|
+
const require_ArticleByline = require('./Article/ArticleByline.js');
|
|
33
34
|
const require_relativeUrl = require('./utils/relativeUrl.js');
|
|
34
35
|
const require_FileList = require('./FileList/FileList.js');
|
|
35
36
|
const require_File = require('./FileList/File.js');
|
|
@@ -40,16 +41,10 @@ const require_SubjectCategories = require('./model/SubjectCategories.js');
|
|
|
40
41
|
const require_SubjectTypes = require('./model/SubjectTypes.js');
|
|
41
42
|
const require_WordClass = require('./model/WordClass.js');
|
|
42
43
|
const require_index = require('./model/index.js');
|
|
43
|
-
const require_messages_nb = require('./locale/messages-nb.js');
|
|
44
|
-
const require_messages_nn = require('./locale/messages-nn.js');
|
|
45
|
-
const require_messages_en = require('./locale/messages-en.js');
|
|
46
|
-
const require_messages_se = require('./locale/messages-se.js');
|
|
47
44
|
const require_Breadcrumb = require('./Breadcrumb/Breadcrumb.js');
|
|
48
45
|
const require_HomeBreadcrumb = require('./Breadcrumb/HomeBreadcrumb.js');
|
|
49
|
-
const require_formatNestedMessages = require('./i18n/formatNestedMessages.js');
|
|
50
46
|
const require_TagSelector = require('./TagSelector/TagSelector.js');
|
|
51
47
|
const require_useComponentTranslations = require('./i18n/useComponentTranslations.js');
|
|
52
|
-
const require_ContentTypeBadge = require('./ContentTypeBadge/ContentTypeBadge.js');
|
|
53
48
|
const require_AnchorHeading = require('./AnchorHeading/AnchorHeading.js');
|
|
54
49
|
const require_Pitch = require('./Pitch/Pitch.js');
|
|
55
50
|
const require_KeyFigure = require('./KeyFigure/KeyFigure.js');
|
|
@@ -59,9 +54,9 @@ const require_Grid = require('./Grid/Grid.js');
|
|
|
59
54
|
const require_LinkBlock = require('./LinkBlock/LinkBlock.js');
|
|
60
55
|
const require_LinkBlockSection = require('./LinkBlock/LinkBlockSection.js');
|
|
61
56
|
const require_ZendeskButton = require('./ZendeskButton/ZendeskButton.js');
|
|
57
|
+
let _ndla_locales = require("@ndla/locales");
|
|
62
58
|
|
|
63
59
|
exports.AnchorHeading = require_AnchorHeading.AnchorHeading;
|
|
64
|
-
exports.Article = require_Article.Article;
|
|
65
60
|
exports.ArticleByline = require_ArticleByline.ArticleByline;
|
|
66
61
|
exports.ArticleBylineAccordionItem = require_ArticleByline.ArticleBylineAccordionItem;
|
|
67
62
|
exports.ArticleContent = require_Article.ArticleContent;
|
|
@@ -85,7 +80,6 @@ exports.ConceptEmbed = require_ConceptEmbed.ConceptEmbed;
|
|
|
85
80
|
exports.ConceptInlineTriggerButton = require_ConceptInlineTriggerButton.ConceptInlineTriggerButton;
|
|
86
81
|
exports.ContactBlock = require_ContactBlock.ContactBlock;
|
|
87
82
|
exports.ContentLinkEmbed = require_ContentLinkEmbed.ContentLinkEmbed;
|
|
88
|
-
exports.ContentTypeBadge = require_ContentTypeBadge.ContentTypeBadge;
|
|
89
83
|
exports.CopyrightEmbed = require_CopyrightEmbed.CopyrightEmbed;
|
|
90
84
|
exports.EmbedByline = require_EmbedByline.EmbedByline;
|
|
91
85
|
exports.EmbedWrapper = require_EmbedWrapper.EmbedWrapper;
|
|
@@ -132,17 +126,35 @@ exports.codeLanguageOptions = require_codeLanguageOptions.codeLanguageOptions;
|
|
|
132
126
|
exports.constants = require_index.constants;
|
|
133
127
|
exports.contactBlockBackgrounds = require_ContactBlock.contactBlockBackgrounds;
|
|
134
128
|
exports.contentTypeMapping = require_ContentType.contentTypeMapping;
|
|
135
|
-
exports.contentTypeToBadgeVariantMap = require_ContentTypeBadge.contentTypeToBadgeVariantMap;
|
|
136
129
|
exports.contentTypes = require_ContentType.contentTypes;
|
|
137
|
-
exports.formatNestedMessages = require_formatNestedMessages.formatNestedMessages;
|
|
138
130
|
exports.getCrop = require_ImageEmbed.getCrop;
|
|
139
131
|
exports.getFocalPoint = require_ImageEmbed.getFocalPoint;
|
|
140
132
|
exports.getPossiblyRelativeUrl = require_relativeUrl.getPossiblyRelativeUrl;
|
|
141
133
|
exports.licenseAttributes = require_licenseAttributes.licenseAttributes;
|
|
142
|
-
exports
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
134
|
+
Object.defineProperty(exports, 'messagesEN', {
|
|
135
|
+
enumerable: true,
|
|
136
|
+
get: function () {
|
|
137
|
+
return _ndla_locales.messagesEN;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
Object.defineProperty(exports, 'messagesNB', {
|
|
141
|
+
enumerable: true,
|
|
142
|
+
get: function () {
|
|
143
|
+
return _ndla_locales.messagesNB;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
Object.defineProperty(exports, 'messagesNN', {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
get: function () {
|
|
149
|
+
return _ndla_locales.messagesNN;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
Object.defineProperty(exports, 'messagesSE', {
|
|
153
|
+
enumerable: true,
|
|
154
|
+
get: function () {
|
|
155
|
+
return _ndla_locales.messagesSE;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
146
158
|
exports.resourceEmbedTypeMapping = require_ContentType.resourceEmbedTypeMapping;
|
|
147
159
|
exports.subjectCategories = require_SubjectCategories.subjectCategories;
|
|
148
160
|
exports.subjectTypes = require_SubjectTypes.subjectTypes;
|
package/lib/model/ContentType.js
CHANGED
|
@@ -18,11 +18,6 @@ const MULTIDISCIPLINARY = "multidisciplinary";
|
|
|
18
18
|
const CONCEPT = "concept";
|
|
19
19
|
const EXTERNAL = "external";
|
|
20
20
|
const MISSING = "missing";
|
|
21
|
-
const IMAGE = "image";
|
|
22
|
-
const VIDEO = "video";
|
|
23
|
-
const AUDIO = "audio";
|
|
24
|
-
const PODCAST = "podcast";
|
|
25
|
-
const GLOSS = "gloss";
|
|
26
21
|
const PROGRAMME = "programme";
|
|
27
22
|
const PODCAST_SERIES = "podcast-series";
|
|
28
23
|
const FRONTPAGE_ARTICLE = "frontpage-article";
|
|
@@ -69,25 +64,6 @@ const resourceEmbedTypeMapping = {
|
|
|
69
64
|
};
|
|
70
65
|
|
|
71
66
|
//#endregion
|
|
72
|
-
exports.ASSESSMENT_RESOURCES = ASSESSMENT_RESOURCES;
|
|
73
|
-
exports.AUDIO = AUDIO;
|
|
74
|
-
exports.CONCEPT = CONCEPT;
|
|
75
|
-
exports.EXTERNAL = EXTERNAL;
|
|
76
|
-
exports.FRONTPAGE_ARTICLE = FRONTPAGE_ARTICLE;
|
|
77
|
-
exports.GLOSS = GLOSS;
|
|
78
|
-
exports.IMAGE = IMAGE;
|
|
79
|
-
exports.LEARNING_PATH = LEARNING_PATH;
|
|
80
|
-
exports.MISSING = MISSING;
|
|
81
|
-
exports.MULTIDISCIPLINARY = MULTIDISCIPLINARY;
|
|
82
|
-
exports.PODCAST = PODCAST;
|
|
83
|
-
exports.PODCAST_SERIES = PODCAST_SERIES;
|
|
84
|
-
exports.PROGRAMME = PROGRAMME;
|
|
85
|
-
exports.SOURCE_MATERIAL = SOURCE_MATERIAL;
|
|
86
|
-
exports.SUBJECT = SUBJECT;
|
|
87
|
-
exports.SUBJECT_MATERIAL = SUBJECT_MATERIAL;
|
|
88
|
-
exports.TASKS_AND_ACTIVITIES = TASKS_AND_ACTIVITIES;
|
|
89
|
-
exports.TOPIC = TOPIC;
|
|
90
|
-
exports.VIDEO = VIDEO;
|
|
91
67
|
exports.contentTypeMapping = contentTypeMapping;
|
|
92
68
|
exports.contentTypes = contentTypes;
|
|
93
69
|
exports.resourceEmbedTypeMapping = resourceEmbedTypeMapping;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentType.js","names":[],"sources":["../../src/model/ContentType.ts"],"sourcesContent":["/**\n * Copyright (c) 2017-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nexport const SUBJECT_MATERIAL = \"subject-material\";\nexport const TASKS_AND_ACTIVITIES = \"tasks-and-activities\";\nexport const ASSESSMENT_RESOURCES = \"assessment-resources\";\nexport const SUBJECT = \"subject\";\nexport const SOURCE_MATERIAL = \"source-material\";\nexport const LEARNING_PATH = \"learning-path\";\nexport const TOPIC = \"topic\";\nexport const MULTIDISCIPLINARY = \"multidisciplinary\";\nexport const CONCEPT = \"concept\";\nexport const EXTERNAL = \"external\";\nexport const MISSING = \"missing\";\nexport const IMAGE = \"image\";\nexport const VIDEO = \"video\";\nexport const AUDIO = \"audio\";\nexport const PODCAST = \"podcast\";\nexport const GLOSS = \"gloss\";\nexport const PROGRAMME = \"programme\";\nexport const PODCAST_SERIES = \"podcast-series\";\nexport const FRONTPAGE_ARTICLE = \"frontpage-article\";\n\nexport const contentTypes = {\n SUBJECT_MATERIAL,\n TASKS_AND_ACTIVITIES,\n ASSESSMENT_RESOURCES,\n SUBJECT,\n SOURCE_MATERIAL,\n LEARNING_PATH,\n TOPIC,\n MULTIDISCIPLINARY,\n CONCEPT,\n EXTERNAL,\n MISSING,\n PROGRAMME,\n PODCAST_SERIES,\n};\n\nexport const RESOURCE_TYPE_LEARNING_PATH = \"urn:resourcetype:learningPath\";\nexport const RESOURCE_TYPE_SUBJECT_MATERIAL = \"urn:resourcetype:subjectMaterial\";\nexport const RESOURCE_TYPE_TASKS_AND_ACTIVITIES = \"urn:resourcetype:tasksAndActivities\";\nexport const RESOURCE_TYPE_ASSESSMENT_RESOURCES = \"urn:resourcetype:reviewResource\";\nexport const RESOURCE_TYPE_SOURCE_MATERIAL = \"urn:resourcetype:SourceMaterial\";\nexport const RESOURCE_TYPE_CONCEPT = \"urn:resourcetype:concept\";\n\nexport const contentTypeMapping: Record<string, string> = {\n [RESOURCE_TYPE_LEARNING_PATH]: LEARNING_PATH,\n [RESOURCE_TYPE_SUBJECT_MATERIAL]: SUBJECT_MATERIAL,\n [RESOURCE_TYPE_TASKS_AND_ACTIVITIES]: TASKS_AND_ACTIVITIES,\n [RESOURCE_TYPE_ASSESSMENT_RESOURCES]: ASSESSMENT_RESOURCES,\n [RESOURCE_TYPE_SOURCE_MATERIAL]: SOURCE_MATERIAL,\n [RESOURCE_TYPE_CONCEPT]: CONCEPT,\n [MULTIDISCIPLINARY]: MULTIDISCIPLINARY,\n [TOPIC]: TOPIC,\n [FRONTPAGE_ARTICLE]: FRONTPAGE_ARTICLE,\n default: SUBJECT_MATERIAL,\n};\n\nexport const resourceEmbedTypeMapping: Record<string, string> = {\n image: \"image\",\n video: \"video\",\n concept: \"concept\",\n audio: \"audio\",\n podcast: \"podcast\",\n gloss: \"gloss\",\n};\n"],"mappings":";;;;;;;;;AAQA,MAAa,mBAAmB;AAChC,MAAa,uBAAuB;AACpC,MAAa,uBAAuB;AACpC,MAAa,UAAU;AACvB,MAAa,kBAAkB;AAC/B,MAAa,gBAAgB;AAC7B,MAAa,QAAQ;AACrB,MAAa,oBAAoB;AACjC,MAAa,UAAU;AACvB,MAAa,WAAW;AACxB,MAAa,UAAU;
|
|
1
|
+
{"version":3,"file":"ContentType.js","names":[],"sources":["../../src/model/ContentType.ts"],"sourcesContent":["/**\n * Copyright (c) 2017-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nexport const SUBJECT_MATERIAL = \"subject-material\";\nexport const TASKS_AND_ACTIVITIES = \"tasks-and-activities\";\nexport const ASSESSMENT_RESOURCES = \"assessment-resources\";\nexport const SUBJECT = \"subject\";\nexport const SOURCE_MATERIAL = \"source-material\";\nexport const LEARNING_PATH = \"learning-path\";\nexport const TOPIC = \"topic\";\nexport const MULTIDISCIPLINARY = \"multidisciplinary\";\nexport const CONCEPT = \"concept\";\nexport const EXTERNAL = \"external\";\nexport const MISSING = \"missing\";\nexport const IMAGE = \"image\";\nexport const VIDEO = \"video\";\nexport const AUDIO = \"audio\";\nexport const PODCAST = \"podcast\";\nexport const GLOSS = \"gloss\";\nexport const PROGRAMME = \"programme\";\nexport const PODCAST_SERIES = \"podcast-series\";\nexport const FRONTPAGE_ARTICLE = \"frontpage-article\";\n\nexport const contentTypes = {\n SUBJECT_MATERIAL,\n TASKS_AND_ACTIVITIES,\n ASSESSMENT_RESOURCES,\n SUBJECT,\n SOURCE_MATERIAL,\n LEARNING_PATH,\n TOPIC,\n MULTIDISCIPLINARY,\n CONCEPT,\n EXTERNAL,\n MISSING,\n PROGRAMME,\n PODCAST_SERIES,\n};\n\nexport const RESOURCE_TYPE_LEARNING_PATH = \"urn:resourcetype:learningPath\";\nexport const RESOURCE_TYPE_SUBJECT_MATERIAL = \"urn:resourcetype:subjectMaterial\";\nexport const RESOURCE_TYPE_TASKS_AND_ACTIVITIES = \"urn:resourcetype:tasksAndActivities\";\nexport const RESOURCE_TYPE_ASSESSMENT_RESOURCES = \"urn:resourcetype:reviewResource\";\nexport const RESOURCE_TYPE_SOURCE_MATERIAL = \"urn:resourcetype:SourceMaterial\";\nexport const RESOURCE_TYPE_CONCEPT = \"urn:resourcetype:concept\";\n\nexport const contentTypeMapping: Record<string, string> = {\n [RESOURCE_TYPE_LEARNING_PATH]: LEARNING_PATH,\n [RESOURCE_TYPE_SUBJECT_MATERIAL]: SUBJECT_MATERIAL,\n [RESOURCE_TYPE_TASKS_AND_ACTIVITIES]: TASKS_AND_ACTIVITIES,\n [RESOURCE_TYPE_ASSESSMENT_RESOURCES]: ASSESSMENT_RESOURCES,\n [RESOURCE_TYPE_SOURCE_MATERIAL]: SOURCE_MATERIAL,\n [RESOURCE_TYPE_CONCEPT]: CONCEPT,\n [MULTIDISCIPLINARY]: MULTIDISCIPLINARY,\n [TOPIC]: TOPIC,\n [FRONTPAGE_ARTICLE]: FRONTPAGE_ARTICLE,\n default: SUBJECT_MATERIAL,\n};\n\nexport const resourceEmbedTypeMapping: Record<string, string> = {\n image: \"image\",\n video: \"video\",\n concept: \"concept\",\n audio: \"audio\",\n podcast: \"podcast\",\n gloss: \"gloss\",\n};\n"],"mappings":";;;;;;;;;AAQA,MAAa,mBAAmB;AAChC,MAAa,uBAAuB;AACpC,MAAa,uBAAuB;AACpC,MAAa,UAAU;AACvB,MAAa,kBAAkB;AAC/B,MAAa,gBAAgB;AAC7B,MAAa,QAAQ;AACrB,MAAa,oBAAoB;AACjC,MAAa,UAAU;AACvB,MAAa,WAAW;AACxB,MAAa,UAAU;AAMvB,MAAa,YAAY;AACzB,MAAa,iBAAiB;AAC9B,MAAa,oBAAoB;AAEjC,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,8BAA8B;AAC3C,MAAa,iCAAiC;AAC9C,MAAa,qCAAqC;AAClD,MAAa,qCAAqC;AAClD,MAAa,gCAAgC;AAC7C,MAAa,wBAAwB;AAErC,MAAa,qBAA6C;EACvD,8BAA8B;EAC9B,iCAAiC;EACjC,qCAAqC;EACrC,qCAAqC;EACrC,gCAAgC;EAChC,wBAAwB;EACxB,oBAAoB;EACpB,QAAQ;EACR,oBAAoB;CACrB,SAAS;CACV;AAED,MAAa,2BAAmD;CAC9D,OAAO;CACP,OAAO;CACP,SAAS;CACT,OAAO;CACP,SAAS;CACT,OAAO;CACR"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "56.0.
|
|
4
|
+
"version": "56.0.172-alpha.0",
|
|
5
5
|
"description": "UI component library for NDLA",
|
|
6
6
|
"license": "GPL-3.0",
|
|
7
7
|
"exports": {
|
|
@@ -36,12 +36,13 @@
|
|
|
36
36
|
"types"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@ark-ui/react": "^5.
|
|
39
|
+
"@ark-ui/react": "^5.30.0",
|
|
40
40
|
"@ndla/core": "^6.0.7-alpha.0",
|
|
41
41
|
"@ndla/icons": "^8.0.77-alpha.0",
|
|
42
42
|
"@ndla/licenses": "^10.0.9-alpha.0",
|
|
43
|
-
"@ndla/
|
|
44
|
-
"@ndla/
|
|
43
|
+
"@ndla/locales": "^0.0.1",
|
|
44
|
+
"@ndla/primitives": "^1.0.119-alpha.0",
|
|
45
|
+
"@ndla/safelink": "^7.0.122-alpha.0",
|
|
45
46
|
"@ndla/styled-system": "^0.0.46",
|
|
46
47
|
"@ndla/util": "^5.0.18-alpha.0",
|
|
47
48
|
"html-react-parser": "^5.2.8"
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
"i18next": ">= 25.0.0",
|
|
51
52
|
"react": ">= 18",
|
|
52
53
|
"react-dom": ">= 18",
|
|
53
|
-
"react-i18next": "
|
|
54
|
+
"react-i18next": ">= 16",
|
|
54
55
|
"react-router": ">= 7.0.0"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
@@ -62,5 +63,5 @@
|
|
|
62
63
|
"publishConfig": {
|
|
63
64
|
"access": "public"
|
|
64
65
|
},
|
|
65
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "36c5e7334db527a79bf6c0b498e21b72c643ebf2"
|
|
66
67
|
}
|
package/src/Article/Article.tsx
CHANGED
|
@@ -12,9 +12,7 @@ import { Heading, Text } from "@ndla/primitives";
|
|
|
12
12
|
import { cx } from "@ndla/styled-system/css";
|
|
13
13
|
import { styled } from "@ndla/styled-system/jsx";
|
|
14
14
|
import type { StyledProps } from "@ndla/styled-system/types";
|
|
15
|
-
import { ArticleByline } from "./ArticleByline";
|
|
16
15
|
import { BadgesContainer } from "./BadgesContainer";
|
|
17
|
-
import type { Article as ArticleType } from "../types";
|
|
18
16
|
|
|
19
17
|
const StyledArticleContent = styled(ark.section, {}, { baseComponent: true });
|
|
20
18
|
|
|
@@ -170,59 +168,3 @@ export const ArticleTitle = ({
|
|
|
170
168
|
</ArticleHeader>
|
|
171
169
|
);
|
|
172
170
|
};
|
|
173
|
-
|
|
174
|
-
interface Props {
|
|
175
|
-
badges?: ReactNode;
|
|
176
|
-
heartButton?: ReactNode;
|
|
177
|
-
article: ArticleType;
|
|
178
|
-
licenseBox?: ReactNode;
|
|
179
|
-
children?: ReactNode;
|
|
180
|
-
competenceGoals?: ReactNode;
|
|
181
|
-
id: string;
|
|
182
|
-
lang?: string;
|
|
183
|
-
disclaimer?: ReactNode;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export const Article = ({
|
|
187
|
-
badges,
|
|
188
|
-
article,
|
|
189
|
-
licenseBox,
|
|
190
|
-
children,
|
|
191
|
-
competenceGoals,
|
|
192
|
-
id,
|
|
193
|
-
heartButton,
|
|
194
|
-
lang,
|
|
195
|
-
disclaimer,
|
|
196
|
-
}: Props) => {
|
|
197
|
-
const { title, introduction, published, content, footNotes, copyright } = article;
|
|
198
|
-
|
|
199
|
-
const authors =
|
|
200
|
-
copyright?.creators.length || copyright?.rightsholders.length ? copyright.creators : copyright?.processors;
|
|
201
|
-
|
|
202
|
-
return (
|
|
203
|
-
<ArticleWrapper>
|
|
204
|
-
<ArticleTitle
|
|
205
|
-
id={id}
|
|
206
|
-
badges={badges}
|
|
207
|
-
heartButton={heartButton}
|
|
208
|
-
title={title}
|
|
209
|
-
introduction={introduction}
|
|
210
|
-
competenceGoals={competenceGoals}
|
|
211
|
-
lang={lang}
|
|
212
|
-
disclaimer={disclaimer}
|
|
213
|
-
/>
|
|
214
|
-
<ArticleContent>{content}</ArticleContent>
|
|
215
|
-
<ArticleFooter>
|
|
216
|
-
<ArticleByline
|
|
217
|
-
lang={lang}
|
|
218
|
-
footnotes={footNotes}
|
|
219
|
-
authors={authors}
|
|
220
|
-
suppliers={copyright?.rightsholders}
|
|
221
|
-
published={published}
|
|
222
|
-
licenseBox={licenseBox}
|
|
223
|
-
/>
|
|
224
|
-
{children}
|
|
225
|
-
</ArticleFooter>
|
|
226
|
-
</ArticleWrapper>
|
|
227
|
-
);
|
|
228
|
-
};
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { type ReactNode, forwardRef, useCallback, useEffect,
|
|
9
|
+
import { type ReactNode, forwardRef, useCallback, useEffect, useRef } from "react";
|
|
10
10
|
import { useTranslation } from "react-i18next";
|
|
11
|
-
import {
|
|
11
|
+
import { useAccordionContext } from "@ark-ui/react";
|
|
12
12
|
import { ArrowDownShortLine } from "@ndla/icons";
|
|
13
13
|
import {
|
|
14
14
|
AccordionItem,
|
|
@@ -95,6 +95,7 @@ const StyledAccordionRoot = styled(AccordionRoot, {
|
|
|
95
95
|
|
|
96
96
|
const refRegexp = /note\d/;
|
|
97
97
|
const footnotesAccordionId = "footnotes";
|
|
98
|
+
const accordionItemValue = "rulesForUse";
|
|
98
99
|
|
|
99
100
|
export const ArticleByline = ({
|
|
100
101
|
lang,
|
|
@@ -109,31 +110,6 @@ export const ArticleByline = ({
|
|
|
109
110
|
learningpathCopiedFrom,
|
|
110
111
|
}: Props) => {
|
|
111
112
|
const { t, i18n } = useTranslation();
|
|
112
|
-
const { pathname } = useLocation();
|
|
113
|
-
const [openAccordions, setOpenAccordions] = useState<string[]>([]);
|
|
114
|
-
const accordionItemValue = "rulesForUse";
|
|
115
|
-
|
|
116
|
-
const onHashChange = useCallback(
|
|
117
|
-
(e: HashChangeEvent) => {
|
|
118
|
-
const hash = e.newURL.split("#")[1];
|
|
119
|
-
if (hash?.match(refRegexp) && !openAccordions.includes(footnotesAccordionId)) {
|
|
120
|
-
setOpenAccordions([...openAccordions, footnotesAccordionId]);
|
|
121
|
-
const el = document.getElementById(`#${hash}`);
|
|
122
|
-
el?.click();
|
|
123
|
-
el?.focus();
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
[openAccordions],
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
setOpenAccordions((prev) => prev.filter((state) => state !== accordionItemValue));
|
|
131
|
-
}, [pathname]);
|
|
132
|
-
|
|
133
|
-
useEffect(() => {
|
|
134
|
-
window.addEventListener("hashchange", onHashChange);
|
|
135
|
-
return () => window.removeEventListener("hashchange", onHashChange);
|
|
136
|
-
}, [onHashChange]);
|
|
137
113
|
|
|
138
114
|
const showPrimaryContributors = suppliers.length > 0 || authors.length > 0;
|
|
139
115
|
const listFormatter = new Intl.ListFormat(lang ?? i18n.language, { style: "long", type: "conjunction" });
|
|
@@ -162,21 +138,13 @@ export const ArticleByline = ({
|
|
|
162
138
|
</TextWrapper>
|
|
163
139
|
)}
|
|
164
140
|
{(!!licenseBox || !!footnotes?.length) && (
|
|
165
|
-
<StyledAccordionRoot
|
|
166
|
-
multiple
|
|
167
|
-
value={openAccordions}
|
|
168
|
-
onValueChange={(details) => setOpenAccordions(details.value)}
|
|
169
|
-
>
|
|
141
|
+
<StyledAccordionRoot multiple>
|
|
170
142
|
{!!licenseBox && (
|
|
171
143
|
<ArticleBylineAccordionItem value={accordionItemValue} accordionTitle={t("article.useContent")}>
|
|
172
144
|
{licenseBox}
|
|
173
145
|
</ArticleBylineAccordionItem>
|
|
174
146
|
)}
|
|
175
|
-
{!!footnotes?.length &&
|
|
176
|
-
<ArticleBylineAccordionItem value={footnotesAccordionId} accordionTitle={t("article.footnotes")}>
|
|
177
|
-
<ArticleFootNotes footNotes={footnotes} />
|
|
178
|
-
</ArticleBylineAccordionItem>
|
|
179
|
-
)}
|
|
147
|
+
{!!footnotes?.length && <ArticleBylineFootnotes footnotes={footnotes} />}
|
|
180
148
|
</StyledAccordionRoot>
|
|
181
149
|
)}
|
|
182
150
|
</Wrapper>
|
|
@@ -187,6 +155,43 @@ interface ArticleBylineAccordionprops extends AccordionItemProps {
|
|
|
187
155
|
accordionTitle: ReactNode;
|
|
188
156
|
}
|
|
189
157
|
|
|
158
|
+
interface ArticleBylineFootnotesProps {
|
|
159
|
+
footnotes: FootNote[];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export const ArticleBylineFootnotes = ({ footnotes }: ArticleBylineFootnotesProps) => {
|
|
163
|
+
const { t } = useTranslation();
|
|
164
|
+
const { value, setValue } = useAccordionContext();
|
|
165
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
166
|
+
|
|
167
|
+
const onHashChange = useCallback(
|
|
168
|
+
(e: HashChangeEvent) => {
|
|
169
|
+
const hash = e.newURL.split("#")[1];
|
|
170
|
+
if (hash?.match(refRegexp) && !value.includes(footnotesAccordionId)) {
|
|
171
|
+
ref.current?.scrollIntoView({ behavior: "smooth" });
|
|
172
|
+
setValue([...value, footnotesAccordionId]);
|
|
173
|
+
setTimeout(() => {
|
|
174
|
+
const el = document.getElementById(`${hash}`);
|
|
175
|
+
el?.click();
|
|
176
|
+
el?.focus();
|
|
177
|
+
}, 300);
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
[value, setValue],
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
useEffect(() => {
|
|
184
|
+
window.addEventListener("hashchange", onHashChange);
|
|
185
|
+
return () => window.removeEventListener("hashchange", onHashChange);
|
|
186
|
+
}, [onHashChange]);
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
<ArticleBylineAccordionItem ref={ref} value={footnotesAccordionId} accordionTitle={t("article.footnotes")}>
|
|
190
|
+
<ArticleFootNotes footNotes={footnotes} />
|
|
191
|
+
</ArticleBylineAccordionItem>
|
|
192
|
+
);
|
|
193
|
+
};
|
|
194
|
+
|
|
190
195
|
export const ArticleBylineAccordionItem = forwardRef<HTMLDivElement, ArticleBylineAccordionprops>(
|
|
191
196
|
({ value, accordionTitle, children, ...props }, ref) => {
|
|
192
197
|
return (
|
|
@@ -26,7 +26,7 @@ const StyledCite = styled("cite", {
|
|
|
26
26
|
|
|
27
27
|
const FootNote = ({ footNote }: FootNoteProps) => (
|
|
28
28
|
<li>
|
|
29
|
-
<Text id={`note${footNote.ref}`} asChild consumeCss textStyle="body.medium">
|
|
29
|
+
<Text id={`note${footNote.ref}`} asChild consumeCss textStyle="body.medium" tabIndex={-1}>
|
|
30
30
|
<StyledCite>
|
|
31
31
|
<a href={`#ref${footNote.ref}`} target="_self">
|
|
32
32
|
{footNote.ref}
|
package/src/Grid/Grid.tsx
CHANGED
|
@@ -52,7 +52,7 @@ const GridContainer = styled("div", {
|
|
|
52
52
|
lightBlue: {
|
|
53
53
|
padding: "xsmall",
|
|
54
54
|
border: "1px solid",
|
|
55
|
-
borderColor: "
|
|
55
|
+
borderColor: "stroke.subtle",
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
},
|
|
@@ -66,7 +66,7 @@ const StyledGridItem = styled("div", {
|
|
|
66
66
|
border: {
|
|
67
67
|
true: {
|
|
68
68
|
outline: "1px solid",
|
|
69
|
-
outlineColor: "stroke.
|
|
69
|
+
outlineColor: "stroke.subtle",
|
|
70
70
|
},
|
|
71
71
|
},
|
|
72
72
|
},
|
package/src/index.ts
CHANGED
|
@@ -33,7 +33,6 @@ export { EmbedByline } from "./LicenseByline/EmbedByline";
|
|
|
33
33
|
|
|
34
34
|
export {
|
|
35
35
|
ArticleWrapper,
|
|
36
|
-
Article,
|
|
37
36
|
ArticleFooter,
|
|
38
37
|
ArticleHeader,
|
|
39
38
|
ArticleContent,
|
|
@@ -65,16 +64,12 @@ export { subjectTypes } from "./model/SubjectTypes";
|
|
|
65
64
|
export { wordClass } from "./model/WordClass";
|
|
66
65
|
export { subjectCategories } from "./model/SubjectCategories";
|
|
67
66
|
|
|
68
|
-
export {
|
|
69
|
-
export { default as messagesNN } from "./locale/messages-nn";
|
|
70
|
-
export { default as messagesEN } from "./locale/messages-en";
|
|
71
|
-
export { default as messagesSE } from "./locale/messages-se";
|
|
67
|
+
export { messagesNB, messagesNN, messagesSE, messagesEN } from "@ndla/locales";
|
|
72
68
|
|
|
73
69
|
export { Breadcrumb } from "./Breadcrumb/Breadcrumb";
|
|
74
70
|
export { HomeBreadcrumb } from "./Breadcrumb/HomeBreadcrumb";
|
|
75
71
|
export type { SimpleBreadcrumbItem, IndexedBreadcrumbItem } from "./Breadcrumb/BreadcrumbItem";
|
|
76
72
|
|
|
77
|
-
export { formatNestedMessages } from "./i18n/formatNestedMessages";
|
|
78
73
|
export {
|
|
79
74
|
useTagsInputTranslations,
|
|
80
75
|
useTagSelectorTranslations,
|
|
@@ -86,9 +81,6 @@ export {
|
|
|
86
81
|
useDatePickerTranslations,
|
|
87
82
|
} from "./i18n/useComponentTranslations";
|
|
88
83
|
|
|
89
|
-
export type { ContentTypeBadgeProps, StrictContentType, ContentType } from "./ContentTypeBadge/ContentTypeBadge";
|
|
90
|
-
export { ContentTypeBadge, contentTypeToBadgeVariantMap } from "./ContentTypeBadge/ContentTypeBadge";
|
|
91
|
-
|
|
92
84
|
export { AnchorHeading } from "./AnchorHeading/AnchorHeading";
|
|
93
85
|
|
|
94
86
|
export type { TagSelectorControlProps, TagSelectorInputProps, TagSelectorRootProps } from "./TagSelector/TagSelector";
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ASSESSMENT_RESOURCES, AUDIO, CONCEPT, EXTERNAL, FRONTPAGE_ARTICLE, GLOSS, IMAGE, LEARNING_PATH, MISSING, MULTIDISCIPLINARY, PODCAST, PODCAST_SERIES, PROGRAMME, SOURCE_MATERIAL, SUBJECT, SUBJECT_MATERIAL, TASKS_AND_ACTIVITIES, TOPIC, VIDEO } from "../model/ContentType.mjs";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { Badge } from "@ndla/primitives";
|
|
4
|
-
import { useTranslation } from "react-i18next";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
|
|
7
|
-
//#region src/ContentTypeBadge/ContentTypeBadge.tsx
|
|
8
|
-
/**
|
|
9
|
-
* Copyright (c) 2024-present, NDLA.
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
12
|
-
* LICENSE file in the root directory of this source tree.
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
const contentTypeToBadgeVariantMap = {
|
|
16
|
-
[SUBJECT_MATERIAL]: "brand1",
|
|
17
|
-
[TASKS_AND_ACTIVITIES]: "brand2",
|
|
18
|
-
[ASSESSMENT_RESOURCES]: "brand2",
|
|
19
|
-
[SUBJECT]: "neutral",
|
|
20
|
-
[SOURCE_MATERIAL]: "brand1",
|
|
21
|
-
[LEARNING_PATH]: "brand3",
|
|
22
|
-
[TOPIC]: "neutral",
|
|
23
|
-
[MULTIDISCIPLINARY]: "neutral",
|
|
24
|
-
[CONCEPT]: "brand1",
|
|
25
|
-
[EXTERNAL]: "brand2",
|
|
26
|
-
[IMAGE]: "brand1",
|
|
27
|
-
[AUDIO]: "brand1",
|
|
28
|
-
[PODCAST]: "brand1",
|
|
29
|
-
[VIDEO]: "brand1",
|
|
30
|
-
[MISSING]: "neutral",
|
|
31
|
-
[PODCAST_SERIES]: "brand1",
|
|
32
|
-
[GLOSS]: "brand1",
|
|
33
|
-
[PROGRAMME]: "neutral",
|
|
34
|
-
[FRONTPAGE_ARTICLE]: "brand2"
|
|
35
|
-
};
|
|
36
|
-
const ContentTypeBadge = forwardRef(({ contentType, children, ...props }, ref) => {
|
|
37
|
-
const { t } = useTranslation();
|
|
38
|
-
return /* @__PURE__ */ jsx(Badge, {
|
|
39
|
-
colorTheme: contentTypeToBadgeVariantMap[contentType ?? "missing"] ?? contentTypeToBadgeVariantMap["missing"],
|
|
40
|
-
...props,
|
|
41
|
-
ref,
|
|
42
|
-
children: children ?? t(`contentTypes.${contentType}`)
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
//#endregion
|
|
47
|
-
export { ContentTypeBadge, contentTypeToBadgeVariantMap };
|
|
48
|
-
//# sourceMappingURL=ContentTypeBadge.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContentTypeBadge.mjs","names":["contentTypes.SUBJECT_MATERIAL","contentTypes.TASKS_AND_ACTIVITIES","contentTypes.ASSESSMENT_RESOURCES","contentTypes.SUBJECT","contentTypes.SOURCE_MATERIAL","contentTypes.LEARNING_PATH","contentTypes.TOPIC","contentTypes.MULTIDISCIPLINARY","contentTypes.CONCEPT","contentTypes.EXTERNAL","contentTypes.IMAGE","contentTypes.AUDIO","contentTypes.PODCAST","contentTypes.VIDEO","contentTypes.MISSING","contentTypes.PODCAST_SERIES","contentTypes.GLOSS","contentTypes.PROGRAMME","contentTypes.FRONTPAGE_ARTICLE"],"sources":["../../src/ContentTypeBadge/ContentTypeBadge.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { forwardRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Badge, type BadgeProps, type BadgeVariant } from \"@ndla/primitives\";\nimport * as contentTypes from \"../model/ContentType\";\n\nexport interface ContentTypeBadgeProps extends Omit<BadgeProps, \"colorTheme\"> {\n contentType: ContentType | undefined;\n}\n\nexport type StrictContentType =\n | typeof contentTypes.SUBJECT_MATERIAL\n | typeof contentTypes.TASKS_AND_ACTIVITIES\n | typeof contentTypes.ASSESSMENT_RESOURCES\n | typeof contentTypes.SUBJECT\n | typeof contentTypes.SOURCE_MATERIAL\n | typeof contentTypes.LEARNING_PATH\n | typeof contentTypes.TOPIC\n | typeof contentTypes.MULTIDISCIPLINARY\n | typeof contentTypes.CONCEPT\n | typeof contentTypes.EXTERNAL\n | typeof contentTypes.IMAGE\n | typeof contentTypes.AUDIO\n | typeof contentTypes.VIDEO\n | typeof contentTypes.MISSING\n | typeof contentTypes.PODCAST\n | typeof contentTypes.GLOSS\n | typeof contentTypes.PROGRAMME\n | typeof contentTypes.PODCAST_SERIES\n | typeof contentTypes.FRONTPAGE_ARTICLE;\n\nexport type ContentType =\n | StrictContentType\n // This allows for us to fallback to string without getting a ts error, while still keeping intellisense\n | (string & {});\n\nexport const contentTypeToBadgeVariantMap: Record<ContentType, BadgeVariant> = {\n [contentTypes.SUBJECT_MATERIAL]: \"brand1\",\n [contentTypes.TASKS_AND_ACTIVITIES]: \"brand2\",\n [contentTypes.ASSESSMENT_RESOURCES]: \"brand2\",\n [contentTypes.SUBJECT]: \"neutral\",\n [contentTypes.SOURCE_MATERIAL]: \"brand1\",\n [contentTypes.LEARNING_PATH]: \"brand3\",\n [contentTypes.TOPIC]: \"neutral\",\n [contentTypes.MULTIDISCIPLINARY]: \"neutral\",\n [contentTypes.CONCEPT]: \"brand1\",\n [contentTypes.EXTERNAL]: \"brand2\",\n [contentTypes.IMAGE]: \"brand1\",\n [contentTypes.AUDIO]: \"brand1\",\n [contentTypes.PODCAST]: \"brand1\",\n [contentTypes.VIDEO]: \"brand1\",\n [contentTypes.MISSING]: \"neutral\",\n [contentTypes.PODCAST_SERIES]: \"brand1\",\n [contentTypes.GLOSS]: \"brand1\",\n [contentTypes.PROGRAMME]: \"neutral\",\n [contentTypes.FRONTPAGE_ARTICLE]: \"brand2\",\n};\n\nexport const ContentTypeBadge = forwardRef<HTMLDivElement, ContentTypeBadgeProps>(\n ({ contentType, children, ...props }, ref) => {\n const { t } = useTranslation();\n return (\n <Badge\n colorTheme={contentTypeToBadgeVariantMap[contentType ?? \"missing\"] ?? contentTypeToBadgeVariantMap[\"missing\"]}\n {...props}\n ref={ref}\n >\n {children ?? t(`contentTypes.${contentType}`)}\n </Badge>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;AA2CA,MAAa,+BAAkE;EAC5EA,mBAAgC;EAChCC,uBAAoC;EACpCC,uBAAoC;EACpCC,UAAuB;EACvBC,kBAA+B;EAC/BC,gBAA6B;EAC7BC,QAAqB;EACrBC,oBAAiC;EACjCC,UAAuB;EACvBC,WAAwB;EACxBC,QAAqB;EACrBC,QAAqB;EACrBC,UAAuB;EACvBC,QAAqB;EACrBC,UAAuB;EACvBC,iBAA8B;EAC9BC,QAAqB;EACrBC,YAAyB;EACzBC,oBAAiC;CACnC;AAED,MAAa,mBAAmB,YAC7B,EAAE,aAAa,UAAU,GAAG,SAAS,QAAQ;CAC5C,MAAM,EAAE,MAAM,gBAAgB;AAC9B,QACE,oBAAC;EACC,YAAY,6BAA6B,eAAe,cAAc,6BAA6B;EACnG,GAAI;EACC;YAEJ,YAAY,EAAE,gBAAgB,cAAc;GACvC;EAGb"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
//#region src/i18n/formatNestedMessages.ts
|
|
2
|
-
const formatNestedMessages = (phrases, formattedMessages = {}, prefix = "") => {
|
|
3
|
-
const messages = formattedMessages;
|
|
4
|
-
Object.keys(phrases).forEach((key) => {
|
|
5
|
-
const value = phrases[key];
|
|
6
|
-
if ({}.hasOwnProperty.call(phrases, key)) {
|
|
7
|
-
const keyWithPrefix = prefix ? `${prefix}.${key}` : key;
|
|
8
|
-
if (typeof value === "object") formatNestedMessages(value, formattedMessages, keyWithPrefix);
|
|
9
|
-
else messages[keyWithPrefix] = value;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
return messages;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
export { formatNestedMessages };
|
|
17
|
-
//# sourceMappingURL=formatNestedMessages.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatNestedMessages.mjs","names":[],"sources":["../../src/i18n/formatNestedMessages.ts"],"sourcesContent":["/**\n * Copyright (c) 2017-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\ninterface Phrases {\n [key: string]: string | Phrases;\n}\n\ninterface FormattedMessages {\n [key: string]: string;\n}\n\nexport const formatNestedMessages = (\n phrases: Phrases,\n formattedMessages: FormattedMessages = {},\n prefix: string = \"\",\n) => {\n const messages = formattedMessages;\n\n Object.keys(phrases).forEach((key) => {\n const value = phrases[key];\n if ({}.hasOwnProperty.call(phrases, key)) {\n const keyWithPrefix = prefix ? `${prefix}.${key}` : key;\n if (typeof value === \"object\") {\n formatNestedMessages(value, formattedMessages, keyWithPrefix);\n } else {\n messages[keyWithPrefix] = value;\n }\n }\n });\n\n return messages;\n};\n"],"mappings":";AAgBA,MAAa,wBACX,SACA,oBAAuC,EAAE,EACzC,SAAiB,OACd;CACH,MAAM,WAAW;AAEjB,QAAO,KAAK,QAAQ,CAAC,SAAS,QAAQ;EACpC,MAAM,QAAQ,QAAQ;AACtB,MAAI,EAAE,CAAC,eAAe,KAAK,SAAS,IAAI,EAAE;GACxC,MAAM,gBAAgB,SAAS,GAAG,OAAO,GAAG,QAAQ;AACpD,OAAI,OAAO,UAAU,SACnB,sBAAqB,OAAO,mBAAmB,cAAc;OAE7D,UAAS,iBAAiB;;GAG9B;AAEF,QAAO"}
|