@ndla/ui 55.0.14-alpha.0 → 55.0.15-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 +22 -0
- package/dist/styles.css +86 -0
- package/es/Article/ArticleByline.js +7 -7
- package/es/AudioPlayer/AudioPlayer.js +1 -0
- package/es/Concept/Concept.js +2 -2
- package/es/ContactBlock/ContactBlock.js +17 -17
- package/es/Embed/BrightcoveEmbed.js +0 -1
- package/es/Embed/CopyrightEmbed.js +1 -2
- package/es/LicenseByline/EmbedByline.js +143 -33
- package/es/LicenseByline/LicenseLink.js +16 -9
- package/es/LicenseByline/index.js +2 -2
- package/es/index.js +0 -1
- package/es/styles.css +86 -0
- package/lib/Article/ArticleByline.js +8 -8
- package/lib/AudioPlayer/AudioPlayer.js +1 -0
- package/lib/Concept/Concept.js +1 -1
- package/lib/ContactBlock/ContactBlock.js +18 -18
- package/lib/Embed/BrightcoveEmbed.js +0 -1
- package/lib/Embed/CopyrightEmbed.js +1 -2
- package/lib/LicenseByline/EmbedByline.d.ts +2 -4
- package/lib/LicenseByline/EmbedByline.js +145 -35
- package/lib/LicenseByline/LicenseLink.d.ts +2 -2
- package/lib/LicenseByline/LicenseLink.js +16 -9
- package/lib/LicenseByline/index.d.ts +2 -2
- package/lib/LicenseByline/index.js +4 -5
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -13
- package/lib/styles.css +86 -0
- package/package.json +5 -5
- package/src/Article/ArticleByline.tsx +1 -1
- package/src/AudioPlayer/AudioPlayer.tsx +1 -0
- package/src/Concept/Concept.tsx +2 -2
- package/src/ContactBlock/ContactBlock.tsx +1 -1
- package/src/Embed/BrightcoveEmbed.tsx +1 -1
- package/src/Embed/CopyrightEmbed.tsx +1 -1
- package/src/LicenseByline/EmbedByline.stories.tsx +9 -4
- package/src/LicenseByline/EmbedByline.tsx +139 -53
- package/src/LicenseByline/LicenseLink.tsx +15 -15
- package/src/LicenseByline/index.tsx +2 -2
- package/src/index.ts +0 -1
- package/es/LicenseByline/LicenseDescription.js +0 -63
- package/es/List/OrderedList.js +0 -41
- package/es/List/UnOrderedList.js +0 -28
- package/es/List/index.js +0 -10
- package/lib/LicenseByline/LicenseDescription.d.ts +0 -15
- package/lib/LicenseByline/LicenseDescription.js +0 -70
- package/lib/List/OrderedList.d.ts +0 -16
- package/lib/List/OrderedList.js +0 -48
- package/lib/List/UnOrderedList.d.ts +0 -10
- package/lib/List/UnOrderedList.js +0 -35
- package/lib/List/index.d.ts +0 -9
- package/lib/List/index.js +0 -20
- package/src/LicenseByline/LicenseDescription.tsx +0 -100
- package/src/List/OrderedList.stories.tsx +0 -135
- package/src/List/OrderedList.tsx +0 -158
- package/src/List/UnOrderedList.tsx +0 -43
- package/src/List/UnorderedList.stories.tsx +0 -72
- package/src/List/index.ts +0 -10
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _styled from "@emotion/styled/base";
|
|
2
1
|
/**
|
|
3
2
|
* Copyright (c) 2023-present, NDLA.
|
|
4
3
|
*
|
|
@@ -7,26 +6,55 @@ import _styled from "@emotion/styled/base";
|
|
|
7
6
|
*
|
|
8
7
|
*/
|
|
9
8
|
|
|
9
|
+
import { useState } from "react";
|
|
10
10
|
import { useTranslation } from "react-i18next";
|
|
11
|
-
import { colors, fonts, misc, spacing } from "@ndla/core";
|
|
12
11
|
import { WarningOutline } from "@ndla/icons/common";
|
|
13
12
|
import { getLicenseByAbbreviation, getLicenseCredits } from "@ndla/licenses";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
13
|
+
import { Button, Text } from "@ndla/primitives";
|
|
14
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
15
|
+
import { LicenseLink } from "./LicenseLink";
|
|
16
16
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
17
|
-
const BylineWrapper =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
17
|
+
const BylineWrapper = styled("figcaption", {
|
|
18
|
+
base: {
|
|
19
|
+
display: "flex",
|
|
20
|
+
flexDirection: "column",
|
|
21
|
+
paddingBlock: "xsmall",
|
|
22
|
+
background: "surface.default",
|
|
23
|
+
textStyle: "label.medium"
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
const ErrorBylineWrapper = styled(BylineWrapper, {
|
|
27
|
+
base: {
|
|
28
|
+
border: "1px solid",
|
|
29
|
+
borderColor: "stroke.error",
|
|
30
|
+
borderRadius: "xsmall",
|
|
31
|
+
background: "surface.dangerSubtle",
|
|
32
|
+
paddingInline: "medium",
|
|
33
|
+
paddingBlock: "medium"
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const StyledText = styled(Text, {
|
|
37
|
+
base: {
|
|
38
|
+
fontStyle: "italic"
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const ContentWrapper = styled("div", {
|
|
42
|
+
base: {
|
|
43
|
+
display: "flex",
|
|
44
|
+
gap: "xsmall",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
textStyle: "label.medium"
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const BaseDescription = styled("div", {
|
|
50
|
+
base: {
|
|
51
|
+
display: "inline-flex",
|
|
52
|
+
whiteSpace: "pre-wrap"
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
export const EmbedByline = _ref => {
|
|
26
56
|
let {
|
|
27
57
|
type,
|
|
28
|
-
topRounded,
|
|
29
|
-
bottomRounded,
|
|
30
58
|
description,
|
|
31
59
|
children,
|
|
32
60
|
visibleAlt,
|
|
@@ -37,16 +65,15 @@ const EmbedByline = _ref => {
|
|
|
37
65
|
} = useTranslation();
|
|
38
66
|
if (props.error) {
|
|
39
67
|
const typeString = type === "h5p" ? "H5P" : t(`embed.type.${type}`).toLowerCase();
|
|
40
|
-
return _jsx(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
})
|
|
68
|
+
return _jsx(ErrorBylineWrapper, {
|
|
69
|
+
children: _jsxs(ContentWrapper, {
|
|
70
|
+
children: [_jsx(WarningOutline, {}), _jsx(BaseDescription, {
|
|
71
|
+
children: _jsx("span", {
|
|
72
|
+
children: t("embed.embedError", {
|
|
73
|
+
type: typeString
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
})]
|
|
50
77
|
})
|
|
51
78
|
});
|
|
52
79
|
}
|
|
@@ -62,17 +89,89 @@ const EmbedByline = _ref => {
|
|
|
62
89
|
children: description
|
|
63
90
|
}), children]
|
|
64
91
|
})
|
|
65
|
-
}), visibleAlt ? _jsx(
|
|
66
|
-
|
|
92
|
+
}), visibleAlt ? _jsx(StyledText, {
|
|
93
|
+
color: "text.subtle",
|
|
94
|
+
textStyle: "label.medium",
|
|
95
|
+
asChild: true,
|
|
96
|
+
consumeCss: true,
|
|
97
|
+
children: _jsx("span", {
|
|
98
|
+
children: `Alt: ${visibleAlt}`
|
|
99
|
+
})
|
|
67
100
|
}) : null]
|
|
68
101
|
});
|
|
69
102
|
};
|
|
70
|
-
|
|
103
|
+
const StyledDescription = styled(BaseDescription, {
|
|
104
|
+
base: {
|
|
105
|
+
mobileWideDown: {
|
|
106
|
+
display: "grid",
|
|
107
|
+
gridTemplateColumns: "1fr auto",
|
|
108
|
+
alignItems: "center",
|
|
109
|
+
overflow: "hidden",
|
|
110
|
+
_open: {
|
|
111
|
+
display: "inline"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
const TextContent = styled("span", {
|
|
117
|
+
base: {
|
|
118
|
+
mobileWideDown: {
|
|
119
|
+
whiteSpace: "nowrap",
|
|
120
|
+
maxHeight: "large",
|
|
121
|
+
overflow: "hidden",
|
|
122
|
+
textOverflow: "ellipsis",
|
|
123
|
+
transitionProperty: "max-height",
|
|
124
|
+
transitionDuration: "slow",
|
|
125
|
+
transitionTimingFunction: "ease-in",
|
|
126
|
+
_open: {
|
|
127
|
+
whiteSpace: "pre-wrap",
|
|
128
|
+
maxHeight: "none"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
const StyledButton = styled(Button, {
|
|
134
|
+
base: {
|
|
135
|
+
mobileWide: {
|
|
136
|
+
display: "none"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
const LicenseDescription = _ref2 => {
|
|
141
|
+
let {
|
|
142
|
+
children
|
|
143
|
+
} = _ref2;
|
|
144
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
145
|
+
const open = isOpen ? {
|
|
146
|
+
"data-open": ""
|
|
147
|
+
} : {};
|
|
148
|
+
const {
|
|
149
|
+
t
|
|
150
|
+
} = useTranslation();
|
|
151
|
+
const handleToggle = () => {
|
|
152
|
+
setIsOpen(!isOpen);
|
|
153
|
+
};
|
|
154
|
+
return _jsx(ContentWrapper, {
|
|
155
|
+
children: _jsxs(StyledDescription, {
|
|
156
|
+
...open,
|
|
157
|
+
children: [_jsx(TextContent, {
|
|
158
|
+
...open,
|
|
159
|
+
children: children
|
|
160
|
+
}), _jsx(StyledButton, {
|
|
161
|
+
variant: "link",
|
|
162
|
+
size: "small",
|
|
163
|
+
onClick: handleToggle,
|
|
164
|
+
children: isOpen ? `${t("audio.readLessDescriptionLabel")}` : `${t("audio.readMoreDescriptionLabel")}`
|
|
165
|
+
})]
|
|
166
|
+
})
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
export const LicenseContainerContent = _ref3 => {
|
|
71
170
|
let {
|
|
72
171
|
children,
|
|
73
172
|
copyright,
|
|
74
173
|
type
|
|
75
|
-
} =
|
|
174
|
+
} = _ref3;
|
|
76
175
|
const {
|
|
77
176
|
t,
|
|
78
177
|
i18n
|
|
@@ -80,13 +179,24 @@ export const LicenseContainerContent = _ref2 => {
|
|
|
80
179
|
const license = copyright ? getLicenseByAbbreviation(copyright.license?.license ?? "", i18n.language) : undefined;
|
|
81
180
|
const authors = getLicenseCredits(copyright);
|
|
82
181
|
const captionAuthors = Object.values(authors).find(i => i.length > 0) ?? [];
|
|
83
|
-
const
|
|
84
|
-
return _jsxs(Component, {
|
|
182
|
+
const content = _jsxs(_Fragment, {
|
|
85
183
|
children: [children, ` ${t(`embed.type.${type}`)}${captionAuthors.length ? ": " : ""}`, captionAuthors.map(author => author.name).join(", "), license ? _jsxs(_Fragment, {
|
|
86
184
|
children: [" / ", _jsx(LicenseLink, {
|
|
87
185
|
license: license
|
|
88
186
|
})]
|
|
89
187
|
}) : null]
|
|
90
188
|
});
|
|
91
|
-
|
|
92
|
-
|
|
189
|
+
if (children) {
|
|
190
|
+
return _jsx(LicenseDescription, {
|
|
191
|
+
children: content
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
return _jsx(Text, {
|
|
195
|
+
textStyle: "label.medium",
|
|
196
|
+
asChild: true,
|
|
197
|
+
consumeCss: true,
|
|
198
|
+
children: _jsx("span", {
|
|
199
|
+
children: content
|
|
200
|
+
})
|
|
201
|
+
});
|
|
202
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _styled from "@emotion/styled/base";
|
|
2
1
|
/**
|
|
3
2
|
* Copyright (c) 2023-present, NDLA.
|
|
4
3
|
*
|
|
@@ -7,14 +6,23 @@ import _styled from "@emotion/styled/base";
|
|
|
7
6
|
*
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
|
-
import { colors } from "@ndla/core";
|
|
11
9
|
import { SafeLink } from "@ndla/safelink";
|
|
10
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
12
11
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
13
|
-
const StyledSafeLink =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const StyledSafeLink = styled(SafeLink, {
|
|
13
|
+
base: {
|
|
14
|
+
color: "primary",
|
|
15
|
+
textDecoration: "underline",
|
|
16
|
+
whiteSpace: "nowrap",
|
|
17
|
+
_hover: {
|
|
18
|
+
textDecoration: "none"
|
|
19
|
+
},
|
|
20
|
+
_focusWithin: {
|
|
21
|
+
textDecoration: "none"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
export const LicenseLink = _ref => {
|
|
18
26
|
let {
|
|
19
27
|
license
|
|
20
28
|
} = _ref;
|
|
@@ -31,5 +39,4 @@ const LicenseLink = _ref => {
|
|
|
31
39
|
return _jsx("span", {
|
|
32
40
|
children: license.abbreviation
|
|
33
41
|
});
|
|
34
|
-
};
|
|
35
|
-
export default LicenseLink;
|
|
42
|
+
};
|
package/es/index.js
CHANGED
|
@@ -47,7 +47,6 @@ export { TagSelectorRoot, TagSelectorLabel, TagSelectorItemInput, TagSelectorTri
|
|
|
47
47
|
export { SnackbarProvider, useSnack, BaseSnack, DefaultSnackbar } from "./SnackBar";
|
|
48
48
|
export { TreeStructure } from "./TreeStructure";
|
|
49
49
|
export { SearchField, SearchResultList, SearchResultItem, ActiveFilters } from "./Search";
|
|
50
|
-
export { OrderedList, UnOrderedList } from "./List";
|
|
51
50
|
export { BlogPostV2 } from "./BlogPost";
|
|
52
51
|
export { ProgrammeCard } from "./ProgrammeCard";
|
|
53
52
|
export { KeyFigure } from "./KeyFigure";
|
package/es/styles.css
CHANGED
|
@@ -73,6 +73,10 @@
|
|
|
73
73
|
box-shadow: var(--shadows-full);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
.mbe_4xsmall {
|
|
77
|
+
margin-block-end: var(--spacing-4xsmall);
|
|
78
|
+
}
|
|
79
|
+
|
|
76
80
|
.ov_hidden {
|
|
77
81
|
overflow: hidden;
|
|
78
82
|
}
|
|
@@ -415,6 +419,26 @@
|
|
|
415
419
|
background: var(--colors-surface-default);
|
|
416
420
|
}
|
|
417
421
|
|
|
422
|
+
.bg_surface\.dangerSubtle {
|
|
423
|
+
background: var(--colors-surface-danger-subtle);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.d_inline-flex {
|
|
427
|
+
display: inline-flex;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.white-space_pre-wrap {
|
|
431
|
+
white-space: pre-wrap;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.c_primary {
|
|
435
|
+
color: var(--colors-primary);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.white-space_nowrap {
|
|
439
|
+
white-space: nowrap;
|
|
440
|
+
}
|
|
441
|
+
|
|
418
442
|
.c_icon\.strong {
|
|
419
443
|
color: var(--colors-icon-strong);
|
|
420
444
|
}
|
|
@@ -604,6 +628,10 @@
|
|
|
604
628
|
font-style: italic;
|
|
605
629
|
}
|
|
606
630
|
|
|
631
|
+
.bd-c_stroke\.error {
|
|
632
|
+
border-color: var(--colors-stroke-error);
|
|
633
|
+
}
|
|
634
|
+
|
|
607
635
|
.grid-tc_repeat\(2\,_1fr\) {
|
|
608
636
|
grid-template-columns: repeat(2, 1fr);
|
|
609
637
|
}
|
|
@@ -926,6 +954,10 @@
|
|
|
926
954
|
content: "";
|
|
927
955
|
}
|
|
928
956
|
|
|
957
|
+
.focusWithin\:td_none:focus-within {
|
|
958
|
+
text-decoration: none;
|
|
959
|
+
}
|
|
960
|
+
|
|
929
961
|
.focusVisible\:ring_none:is(:focus-visible, [data-focus-visible]) {
|
|
930
962
|
outline: 2px solid transparent;
|
|
931
963
|
outline-offset: 2px;
|
|
@@ -1042,6 +1074,9 @@
|
|
|
1042
1074
|
@media screen and (min-width: 29.75rem) {
|
|
1043
1075
|
.mobileWide\:max-w_surface\.medium {
|
|
1044
1076
|
max-width: var(--sizes-surface-medium);
|
|
1077
|
+
}
|
|
1078
|
+
.mobileWide\:d_none {
|
|
1079
|
+
display: none;
|
|
1045
1080
|
}
|
|
1046
1081
|
}
|
|
1047
1082
|
|
|
@@ -1157,8 +1192,59 @@
|
|
|
1157
1192
|
}
|
|
1158
1193
|
|
|
1159
1194
|
@media screen and (max-width: 29.7475rem) {
|
|
1195
|
+
.mobileWideDown\:d_grid {
|
|
1196
|
+
display: grid;
|
|
1197
|
+
}
|
|
1198
|
+
.mobileWideDown\:ov_hidden {
|
|
1199
|
+
overflow: hidden;
|
|
1200
|
+
}
|
|
1201
|
+
.mobileWideDown\:white-space_nowrap {
|
|
1202
|
+
white-space: nowrap;
|
|
1203
|
+
}
|
|
1204
|
+
.mobileWideDown\:max-h_large {
|
|
1205
|
+
max-height: var(--sizes-large);
|
|
1206
|
+
}
|
|
1207
|
+
.mobileWideDown\:tov_ellipsis {
|
|
1208
|
+
text-overflow: ellipsis;
|
|
1209
|
+
}
|
|
1160
1210
|
.mobileWideDown\:cg_3xsmall {
|
|
1161
1211
|
column-gap: var(--spacing-3xsmall);
|
|
1212
|
+
}
|
|
1213
|
+
.mobileWideDown\:grid-tc_1fr_auto {
|
|
1214
|
+
grid-template-columns: 1fr auto;
|
|
1215
|
+
}
|
|
1216
|
+
.mobileWideDown\:ai_center {
|
|
1217
|
+
align-items: center;
|
|
1218
|
+
}
|
|
1219
|
+
.mobileWideDown\:trs-prop_max-height {
|
|
1220
|
+
--transition-prop: max-height;
|
|
1221
|
+
transition-property: max-height;
|
|
1222
|
+
}
|
|
1223
|
+
.mobileWideDown\:trs-dur_slow {
|
|
1224
|
+
--transition-duration: var(--durations-slow);
|
|
1225
|
+
transition-duration: var(--durations-slow);
|
|
1226
|
+
}
|
|
1227
|
+
.mobileWideDown\:trs-tmf_ease-in {
|
|
1228
|
+
--transition-easing: ease-in;
|
|
1229
|
+
transition-timing-function: ease-in;
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
@media screen and (max-width: 29.7475rem) {
|
|
1234
|
+
.mobileWideDown\:open\:d_inline:is([open], [data-open], [data-state="open"]) {
|
|
1235
|
+
display: inline;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
@media screen and (max-width: 29.7475rem) {
|
|
1240
|
+
.mobileWideDown\:open\:white-space_pre-wrap:is([open], [data-open], [data-state="open"]) {
|
|
1241
|
+
white-space: pre-wrap;
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
@media screen and (max-width: 29.7475rem) {
|
|
1246
|
+
.mobileWideDown\:open\:max-h_none:is([open], [data-open], [data-state="open"]) {
|
|
1247
|
+
max-height: none;
|
|
1162
1248
|
}
|
|
1163
1249
|
}
|
|
1164
1250
|
|