@ndla/ui 45.0.7 → 45.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Gloss/Gloss.js +9 -9
- package/es/MediaList/MediaList.js +32 -14
- 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/Gloss/Gloss.d.ts +1 -1
- package/lib/Gloss/Gloss.js +9 -9
- package/lib/MediaList/MediaList.d.ts +12 -5
- package/lib/MediaList/MediaList.js +31 -14
- package/lib/MediaList/index.d.ts +1 -0
- package/lib/index.d.ts +1 -0
- 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 +4 -4
- package/src/Gloss/Gloss.tsx +2 -2
- package/src/MediaList/MediaList.tsx +38 -8
- package/src/MediaList/index.ts +2 -0
- package/src/index.ts +2 -0
- 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
|
@@ -599,6 +599,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
599
599
|
title: 'Tihtele',
|
|
600
600
|
originator: 'Opphaver',
|
|
601
601
|
published: 'Publiseringsdato',
|
|
602
|
+
processed: 'Innhaldet har vorte omarbeidd',
|
|
602
603
|
rightsholder: 'Rettighetshaver',
|
|
603
604
|
source: 'Gaaltije',
|
|
604
605
|
info: 'Lisensinformasjon'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "45.0.
|
|
3
|
+
"version": "45.0.8",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"@ndla/forms": "^4.3.23",
|
|
41
41
|
"@ndla/hooks": "^2.1.0",
|
|
42
42
|
"@ndla/icons": "^4.0.6",
|
|
43
|
-
"@ndla/licenses": "^7.1.
|
|
43
|
+
"@ndla/licenses": "^7.1.4",
|
|
44
44
|
"@ndla/modal": "^4.0.7",
|
|
45
|
-
"@ndla/notion": "^5.0.
|
|
45
|
+
"@ndla/notion": "^5.0.24",
|
|
46
46
|
"@ndla/safelink": "^4.1.21",
|
|
47
47
|
"@ndla/select": "^2.4.12",
|
|
48
48
|
"@ndla/switch": "^1.1.12",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "4fcf1c6c35e6612269adbe3878fd773d7fdd9cd2"
|
|
87
87
|
}
|
package/src/Gloss/Gloss.tsx
CHANGED
|
@@ -31,7 +31,7 @@ export interface Props {
|
|
|
31
31
|
transcriptions: Transcription;
|
|
32
32
|
examples?: Example[][];
|
|
33
33
|
};
|
|
34
|
-
audio
|
|
34
|
+
audio?: {
|
|
35
35
|
title: string;
|
|
36
36
|
src?: string;
|
|
37
37
|
};
|
|
@@ -124,7 +124,7 @@ const Gloss = ({ title, glossData, audio }: Props) => {
|
|
|
124
124
|
<TypeSpan aria-label={t('gloss.wordClass')}>{t(`wordClass.${glossData.wordClass}`)}</TypeSpan>
|
|
125
125
|
)}
|
|
126
126
|
</GlossContainer>
|
|
127
|
-
{audio
|
|
127
|
+
{audio?.src && <SpeechControl src={audio.src} title={audio.title}></SpeechControl>}
|
|
128
128
|
</Wrapper>
|
|
129
129
|
<span>{title.title}</span>
|
|
130
130
|
</Container>
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
isCreativeCommonsLicense,
|
|
14
14
|
metaTypes,
|
|
15
15
|
} from '@ndla/licenses';
|
|
16
|
+
import type { MetaType } from '@ndla/licenses';
|
|
16
17
|
import { LicenseDescription } from '@ndla/notion';
|
|
17
18
|
import BEMHelper from 'react-bem-helper';
|
|
18
19
|
import { uuid } from '@ndla/util';
|
|
@@ -182,25 +183,54 @@ export const HandleLink = ({ text, children }: HandleLinkProps) => {
|
|
|
182
183
|
|
|
183
184
|
const attributionTypes = [metaTypes.author, metaTypes.copyrightHolder, metaTypes.contributor];
|
|
184
185
|
|
|
186
|
+
export type ItemType = ItemTypeWithDescription | DescriptionLessItemType;
|
|
187
|
+
|
|
188
|
+
interface ItemTypeWithDescription {
|
|
189
|
+
label: string;
|
|
190
|
+
description: string;
|
|
191
|
+
metaType: Omit<MetaType, 'otherWithoutDescription'>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
interface DescriptionLessItemType {
|
|
195
|
+
label: string;
|
|
196
|
+
metaType: 'otherWithoutDescription';
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function isOtherWithoutDescription(item: ItemType): item is DescriptionLessItemType {
|
|
200
|
+
return item.metaType === metaTypes.otherWithoutDescription;
|
|
201
|
+
}
|
|
202
|
+
|
|
185
203
|
interface MediaListItemMetaProps {
|
|
186
|
-
items?:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
204
|
+
items?: ItemType[];
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const ItemText = ({ item }: { item: ItemType }) => {
|
|
208
|
+
if (isOtherWithoutDescription(item)) {
|
|
209
|
+
return <>{item.label}</>;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<>
|
|
214
|
+
{item.label}: <HandleLink text={item.description}>{item.description}</HandleLink>
|
|
215
|
+
</>
|
|
216
|
+
);
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
function isAttributionItem(item: ItemType): item is ItemTypeWithDescription {
|
|
220
|
+
if (isOtherWithoutDescription(item)) return false;
|
|
221
|
+
return attributionTypes.some((type) => type === item.metaType);
|
|
191
222
|
}
|
|
192
223
|
|
|
193
224
|
export const MediaListItemMeta = ({ items = [] }: MediaListItemMetaProps) => {
|
|
194
|
-
const attributionItems = items.filter(
|
|
225
|
+
const attributionItems = items.filter(isAttributionItem);
|
|
195
226
|
const attributionMeta = attributionItems.map((item) => `${item.label}: ${item.description}`).join(', ');
|
|
196
227
|
|
|
197
228
|
return (
|
|
198
|
-
//@ts-ignore
|
|
199
229
|
// eslint-disable-next-line react/no-unknown-property
|
|
200
230
|
<ul {...cClasses('actions')} property="cc:attributionName" content={attributionMeta}>
|
|
201
231
|
{items.map((item) => (
|
|
202
232
|
<li key={uuid()} className="c-medialist__meta-item">
|
|
203
|
-
|
|
233
|
+
<ItemText item={item} />
|
|
204
234
|
</li>
|
|
205
235
|
))}
|
|
206
236
|
</ul>
|
package/src/MediaList/index.ts
CHANGED
package/src/index.ts
CHANGED