@ndla/ui 56.0.42-alpha.0 → 56.0.44-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.
@@ -120,6 +120,7 @@
120
120
  "color]___[value:inherit",
121
121
  "alignItems]___[value:flex-end",
122
122
  "display]___[value:block]___[cond:tabletDown",
123
+ "color]___[value:inherit]___[cond:& a<___>_visited",
123
124
  "textDecoration]___[value:underline",
124
125
  "textDecoration]___[value:none]___[cond:_hover",
125
126
  "textDecoration]___[value:none]___[cond:_focusVisible",
@@ -142,39 +143,6 @@
142
143
  "position]___[value:relative]___[cond:tablet",
143
144
  "lineClamp]___[value:4]___[cond:tablet",
144
145
  "boxOrient]___[value:vertical]___[cond:tablet",
145
- "borderLeft]___[value:4px solid",
146
- "borderLeftColor]___[value:stroke.default",
147
- "boxSizing]___[value:border-box",
148
- "overflowX]___[value:auto",
149
- "textStyle]___[value:label.medium",
150
- "fontFamily]___[value:code",
151
- "display]___[value:block",
152
- "whiteSpace]___[value:pre",
153
- "display]___[value:inline-block]___[cond:& .linenumber",
154
- "paddingBlock]___[value:0]___[cond:& .linenumber",
155
- "paddingInline]___[value:small]___[cond:& .linenumber",
156
- "borderRight]___[value:1px solid]___[cond:& .linenumber",
157
- "borderColor]___[value:stroke.subtle]___[cond:& .linenumber",
158
- "width]___[value:xxlarge]___[cond:& .linenumber",
159
- "textAlign]___[value:right]___[cond:& .linenumber",
160
- "marginInlineEnd]___[value:xsmall]___[cond:& .linenumber",
161
- "paddingBlockStart]___[value:xsmall]___[cond:& .linenumber[data-first]",
162
- "paddingBlockEnd]___[value:xsmall]___[cond:& .linenumber[data-last]",
163
- "color]___[value:#7d8b99]___[cond:& .token.comment, .token.block-comment, .token.prolog, .token.doctype, .token.cdata",
164
- "color]___[value:#5f6364]___[cond:& .token.punctuation",
165
- "color]___[value:#c92c2c]___[cond:& .token.property, .token.tag, .token.boolean, .token.number, .token.function-name, .token.constant, .token.symbol, .token.deleted",
166
- "color]___[value:#2f9c0a]___[cond:& .token.selector, .token.attr-name, .token.string, .token.char, .token.function, .token.builtin, .token.inserted",
167
- "color]___[value:#a67f59]___[cond:& .token.operator, .token.entity, .token.url, .token.variable",
168
- "background]___[value:rgba(255, 255, 255, 0.5)]___[cond:& .token.operator, .token.entity, .token.url, .token.variable",
169
- "color]___[value:#1990b8]___[cond:& .token.atrule, .token.attr-value, .token.keyword, .token.class-name",
170
- "color]___[value:#e90]___[cond:& .token.regex, .token.important",
171
- "color]___[value:#a67f59]___[cond:& .language-css .token.string, .style .token.string",
172
- "background]___[value:rgba(255, 255, 255, 0.5)]___[cond:& .language-css .token.string, .style .token.string",
173
- "fontWeight]___[value:normal]___[cond:& .token.important",
174
- "fontWeight]___[value:bold]___[cond:& .token.bold",
175
- "fontStyle]___[value:italic]___[cond:& .token.italic",
176
- "cursor]___[value:help]___[cond:& .token.entity",
177
- "opacity]___[value:0.7]___[cond:& .token.namespace",
178
146
  "display]___[value:inline",
179
147
  "display]___[value:inline]___[cond:& p",
180
148
  "minWidth]___[value:surface.xxsmall",
@@ -396,6 +364,7 @@
396
364
  "maxWidth]___[value:1024px",
397
365
  "minHeight]___[value:100vh",
398
366
  "backgroundColor]___[value:#f8f8f8]___[cond:tablet",
367
+ "textStyle]___[value:label.medium",
399
368
  "color]___[value:text.subtle",
400
369
  "borderColor]___[value:stroke.error",
401
370
  "background]___[value:surface.dangerSubtle",
package/dist/styles.css CHANGED
@@ -26,19 +26,6 @@
26
26
  line-height: calc(var(--line-heights-medium) * 1.11);
27
27
  }
28
28
 
29
- .textStyle_label\.medium {
30
- letter-spacing: normal;
31
- font-family: var(--fonts-sans);
32
- font-weight: var(--font-weights-normal);
33
- font-size: var(--font-sizes-small);
34
- line-height: var(--line-heights-small);
35
- }
36
-
37
- .textStyle_label\.medium:where([lang='zh'], [lang='zh-Hans'], [lang='zh-Hant']):not([data-pinyin]) {
38
- font-size: calc(var(--font-sizes-small) * 1.11);
39
- line-height: calc(var(--line-heights-small) * 1.11);
40
- }
41
-
42
29
  .textStyle_label\.large {
43
30
  letter-spacing: normal;
44
31
  font-family: var(--fonts-sans);
@@ -78,6 +65,19 @@
78
65
  line-height: calc(var(--line-heights-large) * 1.11);
79
66
  }
80
67
 
68
+ .textStyle_label\.medium {
69
+ letter-spacing: normal;
70
+ font-family: var(--fonts-sans);
71
+ font-weight: var(--font-weights-normal);
72
+ font-size: var(--font-sizes-small);
73
+ line-height: var(--line-heights-small);
74
+ }
75
+
76
+ .textStyle_label\.medium:where([lang='zh'], [lang='zh-Hans'], [lang='zh-Hant']):not([data-pinyin]) {
77
+ font-size: calc(var(--font-sizes-small) * 1.11);
78
+ line-height: calc(var(--line-heights-small) * 1.11);
79
+ }
80
+
81
81
  .\[\&_a\]\:textStyle_label\.xsmall a {
82
82
  letter-spacing: normal;
83
83
  font-family: var(--fonts-sans);
@@ -386,22 +386,6 @@
386
386
  height: 215px;
387
387
  }
388
388
 
389
- .bd-l_4px_solid {
390
- border-left: 4px solid;
391
- }
392
-
393
- .bx-s_border-box {
394
- box-sizing: border-box;
395
- }
396
-
397
- .d_block {
398
- display: block;
399
- }
400
-
401
- .white-space_pre {
402
- white-space: pre;
403
- }
404
-
405
389
  .d_inline {
406
390
  display: inline;
407
391
  }
@@ -725,18 +709,6 @@
725
709
  background-color: var(--colors-surface-brand-3);
726
710
  }
727
711
 
728
- .bd-l-c_stroke\.default {
729
- border-left-color: var(--colors-stroke-default);
730
- }
731
-
732
- .ov-x_auto {
733
- overflow-x: auto;
734
- }
735
-
736
- .ff_code {
737
- font-family: var(--fonts-code);
738
- }
739
-
740
712
  .jc_flex-start {
741
713
  justify-content: flex-start;
742
714
  }
@@ -947,90 +919,6 @@
947
919
  flex: 1 1 0%;
948
920
  }
949
921
 
950
- .\[\&_\.linenumber\]\:d_inline-block .linenumber {
951
- display: inline-block;
952
- }
953
-
954
- .\[\&_\.linenumber\]\:py_0 .linenumber {
955
- padding-block: 0;
956
- }
957
-
958
- .\[\&_\.linenumber\]\:px_small .linenumber {
959
- padding-inline: var(--spacing-small);
960
- }
961
-
962
- .\[\&_\.linenumber\]\:bd-r_1px_solid .linenumber {
963
- border-right: 1px solid;
964
- }
965
-
966
- .\[\&_\.linenumber\]\:w_xxlarge .linenumber {
967
- width: var(--sizes-xxlarge);
968
- }
969
-
970
- .\[\&_\.linenumber\]\:ta_right .linenumber {
971
- text-align: right;
972
- }
973
-
974
- .\[\&_\.linenumber\]\:me_xsmall .linenumber {
975
- margin-inline-end: var(--spacing-xsmall);
976
- }
977
-
978
- .\[\&_\.linenumber\[data-first\]\]\:pbs_xsmall .linenumber[data-first] {
979
- padding-block-start: var(--spacing-xsmall);
980
- }
981
-
982
- .\[\&_\.linenumber\[data-last\]\]\:pbe_xsmall .linenumber[data-last] {
983
- padding-block-end: var(--spacing-xsmall);
984
- }
985
-
986
- .\[\&_\.token\.comment\,_\.token\.block-comment\,_\.token\.prolog\,_\.token\.doctype\,_\.token\.cdata\]\:c_\#7d8b99 .token.comment,.\[\&_\.token\.comment\,_\.token\.block-comment\,_\.token\.prolog\,_\.token\.doctype\,_\.token\.cdata\]\:c_\#7d8b99 .token.block-comment,.\[\&_\.token\.comment\,_\.token\.block-comment\,_\.token\.prolog\,_\.token\.doctype\,_\.token\.cdata\]\:c_\#7d8b99 .token.prolog,.\[\&_\.token\.comment\,_\.token\.block-comment\,_\.token\.prolog\,_\.token\.doctype\,_\.token\.cdata\]\:c_\#7d8b99 .token.doctype,.\[\&_\.token\.comment\,_\.token\.block-comment\,_\.token\.prolog\,_\.token\.doctype\,_\.token\.cdata\]\:c_\#7d8b99 .token.cdata {
987
- color: #7d8b99;
988
- }
989
-
990
- .\[\&_\.token\.punctuation\]\:c_\#5f6364 .token.punctuation {
991
- color: #5f6364;
992
- }
993
-
994
- .\[\&_\.token\.property\,_\.token\.tag\,_\.token\.boolean\,_\.token\.number\,_\.token\.function-name\,_\.token\.constant\,_\.token\.symbol\,_\.token\.deleted\]\:c_\#c92c2c .token.property,.\[\&_\.token\.property\,_\.token\.tag\,_\.token\.boolean\,_\.token\.number\,_\.token\.function-name\,_\.token\.constant\,_\.token\.symbol\,_\.token\.deleted\]\:c_\#c92c2c .token.tag,.\[\&_\.token\.property\,_\.token\.tag\,_\.token\.boolean\,_\.token\.number\,_\.token\.function-name\,_\.token\.constant\,_\.token\.symbol\,_\.token\.deleted\]\:c_\#c92c2c .token.boolean,.\[\&_\.token\.property\,_\.token\.tag\,_\.token\.boolean\,_\.token\.number\,_\.token\.function-name\,_\.token\.constant\,_\.token\.symbol\,_\.token\.deleted\]\:c_\#c92c2c .token.number,.\[\&_\.token\.property\,_\.token\.tag\,_\.token\.boolean\,_\.token\.number\,_\.token\.function-name\,_\.token\.constant\,_\.token\.symbol\,_\.token\.deleted\]\:c_\#c92c2c .token.function-name,.\[\&_\.token\.property\,_\.token\.tag\,_\.token\.boolean\,_\.token\.number\,_\.token\.function-name\,_\.token\.constant\,_\.token\.symbol\,_\.token\.deleted\]\:c_\#c92c2c .token.constant,.\[\&_\.token\.property\,_\.token\.tag\,_\.token\.boolean\,_\.token\.number\,_\.token\.function-name\,_\.token\.constant\,_\.token\.symbol\,_\.token\.deleted\]\:c_\#c92c2c .token.symbol,.\[\&_\.token\.property\,_\.token\.tag\,_\.token\.boolean\,_\.token\.number\,_\.token\.function-name\,_\.token\.constant\,_\.token\.symbol\,_\.token\.deleted\]\:c_\#c92c2c .token.deleted {
995
- color: #c92c2c;
996
- }
997
-
998
- .\[\&_\.token\.selector\,_\.token\.attr-name\,_\.token\.string\,_\.token\.char\,_\.token\.function\,_\.token\.builtin\,_\.token\.inserted\]\:c_\#2f9c0a .token.selector,.\[\&_\.token\.selector\,_\.token\.attr-name\,_\.token\.string\,_\.token\.char\,_\.token\.function\,_\.token\.builtin\,_\.token\.inserted\]\:c_\#2f9c0a .token.attr-name,.\[\&_\.token\.selector\,_\.token\.attr-name\,_\.token\.string\,_\.token\.char\,_\.token\.function\,_\.token\.builtin\,_\.token\.inserted\]\:c_\#2f9c0a .token.string,.\[\&_\.token\.selector\,_\.token\.attr-name\,_\.token\.string\,_\.token\.char\,_\.token\.function\,_\.token\.builtin\,_\.token\.inserted\]\:c_\#2f9c0a .token.char,.\[\&_\.token\.selector\,_\.token\.attr-name\,_\.token\.string\,_\.token\.char\,_\.token\.function\,_\.token\.builtin\,_\.token\.inserted\]\:c_\#2f9c0a .token.function,.\[\&_\.token\.selector\,_\.token\.attr-name\,_\.token\.string\,_\.token\.char\,_\.token\.function\,_\.token\.builtin\,_\.token\.inserted\]\:c_\#2f9c0a .token.builtin,.\[\&_\.token\.selector\,_\.token\.attr-name\,_\.token\.string\,_\.token\.char\,_\.token\.function\,_\.token\.builtin\,_\.token\.inserted\]\:c_\#2f9c0a .token.inserted {
999
- color: #2f9c0a;
1000
- }
1001
-
1002
- .\[\&_\.token\.operator\,_\.token\.entity\,_\.token\.url\,_\.token\.variable\]\:c_\#a67f59 .token.operator,.\[\&_\.token\.operator\,_\.token\.entity\,_\.token\.url\,_\.token\.variable\]\:c_\#a67f59 .token.entity,.\[\&_\.token\.operator\,_\.token\.entity\,_\.token\.url\,_\.token\.variable\]\:c_\#a67f59 .token.url,.\[\&_\.token\.operator\,_\.token\.entity\,_\.token\.url\,_\.token\.variable\]\:c_\#a67f59 .token.variable {
1003
- color: #a67f59;
1004
- }
1005
-
1006
- .\[\&_\.token\.operator\,_\.token\.entity\,_\.token\.url\,_\.token\.variable\]\:bg_rgba\(255\,_255\,_255\,_0\.5\) .token.operator,.\[\&_\.token\.operator\,_\.token\.entity\,_\.token\.url\,_\.token\.variable\]\:bg_rgba\(255\,_255\,_255\,_0\.5\) .token.entity,.\[\&_\.token\.operator\,_\.token\.entity\,_\.token\.url\,_\.token\.variable\]\:bg_rgba\(255\,_255\,_255\,_0\.5\) .token.url,.\[\&_\.token\.operator\,_\.token\.entity\,_\.token\.url\,_\.token\.variable\]\:bg_rgba\(255\,_255\,_255\,_0\.5\) .token.variable {
1007
- background: rgba(255, 255, 255, 0.5);
1008
- }
1009
-
1010
- .\[\&_\.token\.atrule\,_\.token\.attr-value\,_\.token\.keyword\,_\.token\.class-name\]\:c_\#1990b8 .token.atrule,.\[\&_\.token\.atrule\,_\.token\.attr-value\,_\.token\.keyword\,_\.token\.class-name\]\:c_\#1990b8 .token.attr-value,.\[\&_\.token\.atrule\,_\.token\.attr-value\,_\.token\.keyword\,_\.token\.class-name\]\:c_\#1990b8 .token.keyword,.\[\&_\.token\.atrule\,_\.token\.attr-value\,_\.token\.keyword\,_\.token\.class-name\]\:c_\#1990b8 .token.class-name {
1011
- color: #1990b8;
1012
- }
1013
-
1014
- .\[\&_\.token\.regex\,_\.token\.important\]\:c_\#e90 .token.regex,.\[\&_\.token\.regex\,_\.token\.important\]\:c_\#e90 .token.important {
1015
- color: #e90;
1016
- }
1017
-
1018
- .\[\&_\.language-css_\.token\.string\,_\.style_\.token\.string\]\:c_\#a67f59 .language-css .token.string,.\[\&_\.language-css_\.token\.string\,_\.style_\.token\.string\]\:c_\#a67f59 .style .token.string {
1019
- color: #a67f59;
1020
- }
1021
-
1022
- .\[\&_\.language-css_\.token\.string\,_\.style_\.token\.string\]\:bg_rgba\(255\,_255\,_255\,_0\.5\) .language-css .token.string,.\[\&_\.language-css_\.token\.string\,_\.style_\.token\.string\]\:bg_rgba\(255\,_255\,_255\,_0\.5\) .style .token.string {
1023
- background: rgba(255, 255, 255, 0.5);
1024
- }
1025
-
1026
- .\[\&_\.token\.entity\]\:cursor_help .token.entity {
1027
- cursor: help;
1028
- }
1029
-
1030
- .\[\&_\.token\.namespace\]\:op_0\.7 .token.namespace {
1031
- opacity: 0.7;
1032
- }
1033
-
1034
922
  .\[\&_p\]\:d_inline p {
1035
923
  display: inline;
1036
924
  }
@@ -1203,22 +1091,6 @@
1203
1091
  content: 0;
1204
1092
  }
1205
1093
 
1206
- .\[\&_\.linenumber\]\:bd-c_stroke\.subtle .linenumber {
1207
- border-color: var(--colors-stroke-subtle);
1208
- }
1209
-
1210
- .\[\&_\.token\.important\]\:fw_normal .token.important {
1211
- font-weight: var(--font-weights-normal);
1212
- }
1213
-
1214
- .\[\&_\.token\.bold\]\:fw_bold .token.bold {
1215
- font-weight: var(--font-weights-bold);
1216
- }
1217
-
1218
- .\[\&_\.token\.italic\]\:font-style_italic .token.italic {
1219
- font-style: italic;
1220
- }
1221
-
1222
1094
  .before\:content_\"\"::before {
1223
1095
  content: "";
1224
1096
  }
@@ -1378,6 +1250,10 @@
1378
1250
  border-color: var(--colors-text-link);
1379
1251
  }
1380
1252
 
1253
+ .\[\&_a\]\:visited\:c_inherit a:visited {
1254
+ color: inherit;
1255
+ }
1256
+
1381
1257
  .\[\&_button\[data-expanded\=\'true\'\]\]\:\[\&_svg\]\:trf_rotate\(-45deg\) button[data-expanded='true'] svg {
1382
1258
  transform: rotate(-45deg);
1383
1259
  }
@@ -19,6 +19,11 @@ const StyledListItem = styled("li", {
19
19
  alignItems: "flex-end",
20
20
  tabletDown: {
21
21
  display: "block"
22
+ },
23
+ "& a": {
24
+ _visited: {
25
+ color: "inherit"
26
+ }
22
27
  }
23
28
  }
24
29
  });
@@ -10,79 +10,7 @@ import { forwardRef, useMemo } from "react";
10
10
  import { cx } from "@ndla/styled-system/css";
11
11
  import { styled } from "@ndla/styled-system/jsx";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
- const Pre = styled("pre", {
14
- base: {
15
- border: "1px solid",
16
- borderColor: "stroke.subtle",
17
- borderLeft: "4px solid",
18
- borderLeftColor: "stroke.default",
19
- borderRadius: "xsmall",
20
- boxSizing: "border-box",
21
- overflowX: "auto",
22
- textStyle: "label.medium",
23
- fontFamily: "code",
24
- display: "block",
25
- whiteSpace: "pre",
26
- "& .linenumber": {
27
- display: "inline-block",
28
- paddingBlock: "0",
29
- paddingInline: "small",
30
- borderRight: "1px solid",
31
- borderColor: "stroke.subtle",
32
- width: "xxlarge",
33
- textAlign: "right",
34
- marginInlineEnd: "xsmall"
35
- },
36
- "& .linenumber[data-first]": {
37
- paddingBlockStart: "xsmall"
38
- },
39
- "& .linenumber[data-last]": {
40
- paddingBlockEnd: "xsmall"
41
- },
42
- // The remaining css is copied from the coy theme in prismjs. A lot of css is omitted due to styling clashes
43
- "& .token.comment, .token.block-comment, .token.prolog, .token.doctype, .token.cdata": {
44
- color: "#7d8b99"
45
- },
46
- "& .token.punctuation": {
47
- color: "#5f6364"
48
- },
49
- "& .token.property, .token.tag, .token.boolean, .token.number, .token.function-name, .token.constant, .token.symbol, .token.deleted": {
50
- color: "#c92c2c"
51
- },
52
- "& .token.selector, .token.attr-name, .token.string, .token.char, .token.function, .token.builtin, .token.inserted": {
53
- color: "#2f9c0a"
54
- },
55
- "& .token.operator, .token.entity, .token.url, .token.variable": {
56
- color: "#a67f59",
57
- background: "rgba(255, 255, 255, 0.5)"
58
- },
59
- "& .token.atrule, .token.attr-value, .token.keyword, .token.class-name": {
60
- color: "#1990b8"
61
- },
62
- "& .token.regex, .token.important": {
63
- color: "#e90"
64
- },
65
- "& .language-css .token.string, .style .token.string": {
66
- color: "#a67f59",
67
- background: "rgba(255, 255, 255, 0.5)"
68
- },
69
- "& .token.important": {
70
- fontWeight: "normal"
71
- },
72
- "& .token.bold": {
73
- fontWeight: "bold"
74
- },
75
- "& .token.italic": {
76
- fontStyle: "italic"
77
- },
78
- "& .token.entity": {
79
- cursor: "help"
80
- },
81
- "& .token.namespace": {
82
- opacity: "0.7"
83
- }
84
- }
85
- });
13
+ const Pre = styled("pre", {});
86
14
  export const Codeblock = /*#__PURE__*/forwardRef((_ref, ref) => {
87
15
  let {
88
16
  highlightedCode,
@@ -91,12 +19,12 @@ export const Codeblock = /*#__PURE__*/forwardRef((_ref, ref) => {
91
19
  ...props
92
20
  } = _ref;
93
21
  const codeWithLineNumbers = useMemo(() => {
94
- return highlightedCode.split("\n").map((line, i, arr) => {
95
- return `<span><span class="linenumber" ${i === 0 ? 'data-first=""' : ""} ${i === arr.length - 1 ? 'data-last=""' : ""}>${i + 1}</span>${line}</span>`;
22
+ return highlightedCode.split("\n").map((line, i) => {
23
+ return `<span class="linenumber">${i + 1}</span>${line}`;
96
24
  }).join("\n");
97
25
  }, [highlightedCode]);
98
26
  return /*#__PURE__*/_jsx(Pre, {
99
- className: cx(`language-${format}`, className),
27
+ className: cx("codeblock", `language-${format}`, className),
100
28
  ...props,
101
29
  dangerouslySetInnerHTML: {
102
30
  __html: codeWithLineNumbers
@@ -15,7 +15,8 @@ import { ResourceBox } from "../ResourceBox";
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
16
  const StyledIframe = styled("iframe", {
17
17
  base: {
18
- width: "100%"
18
+ width: "100%",
19
+ border: 0
19
20
  }
20
21
  });
21
22
  const IframeEmbed = _ref => {
@@ -79,13 +80,8 @@ const IframeEmbed = _ref => {
79
80
  "aria-label": urlOrTitle,
80
81
  src: url,
81
82
  width: strippedWidth,
82
- height: strippedHeight
83
- // eslint-disable-next-line react/no-unknown-property
84
- ,
85
- allowFullScreen: true,
86
- allow: "encrypted-media",
87
- scrolling: "no",
88
- frameBorder: "0",
83
+ height: strippedHeight,
84
+ allow: "fullscreen; encrypted-media",
89
85
  loading: "lazy"
90
86
  })
91
87
  });
@@ -59,7 +59,6 @@ export const EmbedByline = _ref => {
59
59
  children,
60
60
  visibleAlt,
61
61
  hideCopyright,
62
- hideDescription,
63
62
  ...props
64
63
  } = _ref;
65
64
  const {
@@ -82,14 +81,14 @@ export const EmbedByline = _ref => {
82
81
  const {
83
82
  copyright
84
83
  } = props;
85
- const bylineDescription = hideDescription ? "" : description;
84
+ const hideByline = hideCopyright && !description;
86
85
  return /*#__PURE__*/_jsxs(_Fragment, {
87
- children: [/*#__PURE__*/_jsx(BylineWrapper, {
86
+ children: [!hideByline && /*#__PURE__*/_jsx(BylineWrapper, {
88
87
  children: /*#__PURE__*/_jsxs("div", {
89
- children: [hideCopyright && bylineDescription, !hideCopyright && /*#__PURE__*/_jsx(LicenseContainerContent, {
88
+ children: [hideCopyright && description, !hideCopyright && /*#__PURE__*/_jsx(LicenseContainerContent, {
90
89
  type: type,
91
90
  copyright: copyright,
92
- children: bylineDescription
91
+ children: description
93
92
  }), children]
94
93
  })
95
94
  }), visibleAlt ? /*#__PURE__*/_jsx(StyledText, {
@@ -25,6 +25,11 @@ const StyledListItem = (0, _jsx2.styled)("li", {
25
25
  alignItems: "flex-end",
26
26
  tabletDown: {
27
27
  display: "block"
28
+ },
29
+ "& a": {
30
+ _visited: {
31
+ color: "inherit"
32
+ }
28
33
  }
29
34
  }
30
35
  });
@@ -16,79 +16,7 @@ var _jsxRuntime = require("react/jsx-runtime");
16
16
  *
17
17
  */
18
18
 
19
- const Pre = (0, _jsx2.styled)("pre", {
20
- base: {
21
- border: "1px solid",
22
- borderColor: "stroke.subtle",
23
- borderLeft: "4px solid",
24
- borderLeftColor: "stroke.default",
25
- borderRadius: "xsmall",
26
- boxSizing: "border-box",
27
- overflowX: "auto",
28
- textStyle: "label.medium",
29
- fontFamily: "code",
30
- display: "block",
31
- whiteSpace: "pre",
32
- "& .linenumber": {
33
- display: "inline-block",
34
- paddingBlock: "0",
35
- paddingInline: "small",
36
- borderRight: "1px solid",
37
- borderColor: "stroke.subtle",
38
- width: "xxlarge",
39
- textAlign: "right",
40
- marginInlineEnd: "xsmall"
41
- },
42
- "& .linenumber[data-first]": {
43
- paddingBlockStart: "xsmall"
44
- },
45
- "& .linenumber[data-last]": {
46
- paddingBlockEnd: "xsmall"
47
- },
48
- // The remaining css is copied from the coy theme in prismjs. A lot of css is omitted due to styling clashes
49
- "& .token.comment, .token.block-comment, .token.prolog, .token.doctype, .token.cdata": {
50
- color: "#7d8b99"
51
- },
52
- "& .token.punctuation": {
53
- color: "#5f6364"
54
- },
55
- "& .token.property, .token.tag, .token.boolean, .token.number, .token.function-name, .token.constant, .token.symbol, .token.deleted": {
56
- color: "#c92c2c"
57
- },
58
- "& .token.selector, .token.attr-name, .token.string, .token.char, .token.function, .token.builtin, .token.inserted": {
59
- color: "#2f9c0a"
60
- },
61
- "& .token.operator, .token.entity, .token.url, .token.variable": {
62
- color: "#a67f59",
63
- background: "rgba(255, 255, 255, 0.5)"
64
- },
65
- "& .token.atrule, .token.attr-value, .token.keyword, .token.class-name": {
66
- color: "#1990b8"
67
- },
68
- "& .token.regex, .token.important": {
69
- color: "#e90"
70
- },
71
- "& .language-css .token.string, .style .token.string": {
72
- color: "#a67f59",
73
- background: "rgba(255, 255, 255, 0.5)"
74
- },
75
- "& .token.important": {
76
- fontWeight: "normal"
77
- },
78
- "& .token.bold": {
79
- fontWeight: "bold"
80
- },
81
- "& .token.italic": {
82
- fontStyle: "italic"
83
- },
84
- "& .token.entity": {
85
- cursor: "help"
86
- },
87
- "& .token.namespace": {
88
- opacity: "0.7"
89
- }
90
- }
91
- });
19
+ const Pre = (0, _jsx2.styled)("pre", {});
92
20
  const Codeblock = exports.Codeblock = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
93
21
  let {
94
22
  highlightedCode,
@@ -97,12 +25,12 @@ const Codeblock = exports.Codeblock = /*#__PURE__*/(0, _react.forwardRef)((_ref,
97
25
  ...props
98
26
  } = _ref;
99
27
  const codeWithLineNumbers = (0, _react.useMemo)(() => {
100
- return highlightedCode.split("\n").map((line, i, arr) => {
101
- return `<span><span class="linenumber" ${i === 0 ? 'data-first=""' : ""} ${i === arr.length - 1 ? 'data-last=""' : ""}>${i + 1}</span>${line}</span>`;
28
+ return highlightedCode.split("\n").map((line, i) => {
29
+ return `<span class="linenumber">${i + 1}</span>${line}`;
102
30
  }).join("\n");
103
31
  }, [highlightedCode]);
104
32
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Pre, {
105
- className: (0, _css.cx)(`language-${format}`, className),
33
+ className: (0, _css.cx)("codeblock", `language-${format}`, className),
106
34
  ...props,
107
35
  dangerouslySetInnerHTML: {
108
36
  __html: codeWithLineNumbers
@@ -22,7 +22,8 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
22
22
 
23
23
  const StyledIframe = (0, _jsx2.styled)("iframe", {
24
24
  base: {
25
- width: "100%"
25
+ width: "100%",
26
+ border: 0
26
27
  }
27
28
  });
28
29
  const IframeEmbed = _ref => {
@@ -86,13 +87,8 @@ const IframeEmbed = _ref => {
86
87
  "aria-label": urlOrTitle,
87
88
  src: url,
88
89
  width: strippedWidth,
89
- height: strippedHeight
90
- // eslint-disable-next-line react/no-unknown-property
91
- ,
92
- allowFullScreen: true,
93
- allow: "encrypted-media",
94
- scrolling: "no",
95
- frameBorder: "0",
90
+ height: strippedHeight,
91
+ allow: "fullscreen; encrypted-media",
96
92
  loading: "lazy"
97
93
  })
98
94
  });
@@ -49,7 +49,7 @@ interface CopyrightProps extends BaseProps {
49
49
  }
50
50
  export type EmbedBylineTypeProps = ImageProps | BrightcoveProps | AudioProps | PodcastProps | ConceptProps | CopyrightProps;
51
51
  type Props = EmbedBylineTypeProps | EmbedBylineErrorProps;
52
- export declare const EmbedByline: ({ type, description, children, visibleAlt, hideCopyright, hideDescription, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
52
+ export declare const EmbedByline: ({ type, description, children, visibleAlt, hideCopyright, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
53
53
  interface LicenseContainerProps {
54
54
  children?: ReactNode;
55
55
  copyright: EmbedBylineTypeProps["copyright"];
@@ -65,7 +65,6 @@ const EmbedByline = _ref => {
65
65
  children,
66
66
  visibleAlt,
67
67
  hideCopyright,
68
- hideDescription,
69
68
  ...props
70
69
  } = _ref;
71
70
  const {
@@ -88,14 +87,14 @@ const EmbedByline = _ref => {
88
87
  const {
89
88
  copyright
90
89
  } = props;
91
- const bylineDescription = hideDescription ? "" : description;
90
+ const hideByline = hideCopyright && !description;
92
91
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
93
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(BylineWrapper, {
92
+ children: [!hideByline && /*#__PURE__*/(0, _jsxRuntime.jsx)(BylineWrapper, {
94
93
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
95
- children: [hideCopyright && bylineDescription, !hideCopyright && /*#__PURE__*/(0, _jsxRuntime.jsx)(LicenseContainerContent, {
94
+ children: [hideCopyright && description, !hideCopyright && /*#__PURE__*/(0, _jsxRuntime.jsx)(LicenseContainerContent, {
96
95
  type: type,
97
96
  copyright: copyright,
98
- children: bylineDescription
97
+ children: description
99
98
  }), children]
100
99
  })
101
100
  }), visibleAlt ? /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledText, {
package/lib/index.d.ts CHANGED
@@ -37,6 +37,7 @@ export { type ContentTypeBlockQuoteVariant } from "./ContentTypeBlockQuote/Conte
37
37
  export { ContentTypeFramedContent } from "./ContentTypeFramedContent/ContentTypeFramedContent";
38
38
  export { type ContentTypeFramedContentVariant } from "./ContentTypeFramedContent/ContentTypeFramedContent";
39
39
  export { default as CopyParagraphButton } from "./CopyParagraphButton";
40
+ export type { TagSelectorControlProps, TagSelectorInputProps, TagSelectorRootProps } from "./TagSelector/TagSelector";
40
41
  export { TagSelectorRoot, TagSelectorLabel, TagSelectorItemInput, TagSelectorTrigger, TagSelectorControl, TagSelectorClearTrigger, TagSelectorInputBase, TagSelectorInput, } from "./TagSelector/TagSelector";
41
42
  export { BlogPostV2 } from "./BlogPost";
42
43
  export { KeyFigure } from "./KeyFigure";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "56.0.42-alpha.0",
3
+ "version": "56.0.44-alpha.0",
4
4
  "description": "UI component library for NDLA",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -33,10 +33,10 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@ndla/core": "^5.0.2",
36
- "@ndla/icons": "^8.0.27-alpha.0",
36
+ "@ndla/icons": "^8.0.28-alpha.0",
37
37
  "@ndla/licenses": "^8.0.3-alpha.0",
38
- "@ndla/primitives": "^1.0.38-alpha.0",
39
- "@ndla/safelink": "^7.0.38-alpha.0",
38
+ "@ndla/primitives": "^1.0.39-alpha.0",
39
+ "@ndla/safelink": "^7.0.39-alpha.0",
40
40
  "@ndla/styled-system": "^0.0.23",
41
41
  "@ndla/util": "^5.0.0-alpha.0",
42
42
  "html-react-parser": "^5.1.8",
@@ -50,7 +50,7 @@
50
50
  "react-router-dom": "> 6.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@ndla/preset-panda": "^0.0.36",
53
+ "@ndla/preset-panda": "^0.0.37",
54
54
  "@ndla/types-backend": "^0.2.86",
55
55
  "@ndla/types-embed": "^5.0.3-alpha.0",
56
56
  "@pandacss/dev": "^0.46.0"
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "fa8b235f77c036a235f87c3e5875a2e938cb0ccd"
61
+ "gitHead": "783a77ac565381846c0654a3bd2ccde659a4cef4"
62
62
  }
@@ -34,6 +34,11 @@ const StyledListItem = styled("li", {
34
34
  tabletDown: {
35
35
  display: "block",
36
36
  },
37
+ "& a": {
38
+ _visited: {
39
+ color: "inherit",
40
+ },
41
+ },
37
42
  },
38
43
  });
39
44
 
@@ -16,97 +16,21 @@ interface Props extends JsxStyleProps, ComponentPropsWithRef<"pre"> {
16
16
  format: string;
17
17
  }
18
18
 
19
- const Pre = styled("pre", {
20
- base: {
21
- border: "1px solid",
22
- borderColor: "stroke.subtle",
23
- borderLeft: "4px solid",
24
- borderLeftColor: "stroke.default",
25
- borderRadius: "xsmall",
26
- boxSizing: "border-box",
27
- overflowX: "auto",
28
- textStyle: "label.medium",
29
- fontFamily: "code",
30
- display: "block",
31
- whiteSpace: "pre",
32
- "& .linenumber": {
33
- display: "inline-block",
34
- paddingBlock: "0",
35
- paddingInline: "small",
36
- borderRight: "1px solid",
37
- borderColor: "stroke.subtle",
38
- width: "xxlarge",
39
- textAlign: "right",
40
- marginInlineEnd: "xsmall",
41
- },
42
- "& .linenumber[data-first]": {
43
- paddingBlockStart: "xsmall",
44
- },
45
- "& .linenumber[data-last]": {
46
- paddingBlockEnd: "xsmall",
47
- },
48
- // The remaining css is copied from the coy theme in prismjs. A lot of css is omitted due to styling clashes
49
- "& .token.comment, .token.block-comment, .token.prolog, .token.doctype, .token.cdata": {
50
- color: "#7d8b99",
51
- },
52
- "& .token.punctuation": {
53
- color: "#5f6364",
54
- },
55
- "& .token.property, .token.tag, .token.boolean, .token.number, .token.function-name, .token.constant, .token.symbol, .token.deleted":
56
- {
57
- color: "#c92c2c",
58
- },
59
- "& .token.selector, .token.attr-name, .token.string, .token.char, .token.function, .token.builtin, .token.inserted":
60
- {
61
- color: "#2f9c0a",
62
- },
63
- "& .token.operator, .token.entity, .token.url, .token.variable": {
64
- color: "#a67f59",
65
- background: "rgba(255, 255, 255, 0.5)",
66
- },
67
- "& .token.atrule, .token.attr-value, .token.keyword, .token.class-name": {
68
- color: "#1990b8",
69
- },
70
- "& .token.regex, .token.important": {
71
- color: "#e90",
72
- },
73
- "& .language-css .token.string, .style .token.string": {
74
- color: "#a67f59",
75
- background: "rgba(255, 255, 255, 0.5)",
76
- },
77
- "& .token.important": {
78
- fontWeight: "normal",
79
- },
80
- "& .token.bold": {
81
- fontWeight: "bold",
82
- },
83
- "& .token.italic": {
84
- fontStyle: "italic",
85
- },
86
- "& .token.entity": {
87
- cursor: "help",
88
- },
89
- "& .token.namespace": {
90
- opacity: "0.7",
91
- },
92
- },
93
- });
19
+ const Pre = styled("pre", {});
94
20
 
95
21
  export const Codeblock = forwardRef<HTMLPreElement, Props>(({ highlightedCode, format, className, ...props }, ref) => {
96
22
  const codeWithLineNumbers = useMemo(() => {
97
23
  return highlightedCode
98
24
  .split("\n")
99
- .map((line, i, arr) => {
100
- return `<span><span class="linenumber" ${i === 0 ? 'data-first=""' : ""} ${
101
- i === arr.length - 1 ? 'data-last=""' : ""
102
- }>${i + 1}</span>${line}</span>`;
25
+ .map((line, i) => {
26
+ return `<span class="linenumber">${i + 1}</span>${line}`;
103
27
  })
104
28
  .join("\n");
105
29
  }, [highlightedCode]);
106
30
 
107
31
  return (
108
32
  <Pre
109
- className={cx(`language-${format}`, className)}
33
+ className={cx("codeblock", `language-${format}`, className)}
110
34
  {...props}
111
35
  dangerouslySetInnerHTML={{ __html: codeWithLineNumbers }}
112
36
  ref={ref}
@@ -21,6 +21,7 @@ interface Props {
21
21
  const StyledIframe = styled("iframe", {
22
22
  base: {
23
23
  width: "100%",
24
+ border: 0,
24
25
  },
25
26
  });
26
27
 
@@ -76,11 +77,7 @@ const IframeEmbed = ({ embed }: Props) => {
76
77
  src={url}
77
78
  width={strippedWidth}
78
79
  height={strippedHeight}
79
- // eslint-disable-next-line react/no-unknown-property
80
- allowFullScreen
81
- allow="encrypted-media"
82
- scrolling="no"
83
- frameBorder="0"
80
+ allow="fullscreen; encrypted-media"
84
81
  loading="lazy"
85
82
  />
86
83
  </Figure>
@@ -154,7 +154,23 @@ export const HiddenCaption: StoryObj<typeof ImageEmbed> = {
154
154
  embedData: {
155
155
  ...embedData,
156
156
  size: "full",
157
- hideCaption: "true",
157
+ caption: "",
158
+ },
159
+ data: metaData,
160
+ },
161
+ },
162
+ };
163
+
164
+ export const HiddenBylineAndCaption: StoryObj<typeof ImageEmbed> = {
165
+ args: {
166
+ embed: {
167
+ resource: "image",
168
+ status: "success",
169
+ embedData: {
170
+ ...embedData,
171
+ size: "full",
172
+ hideByline: "true",
173
+ caption: "",
158
174
  },
159
175
  data: metaData,
160
176
  },
@@ -116,15 +116,7 @@ const BaseDescription = styled("div", {
116
116
  },
117
117
  });
118
118
 
119
- export const EmbedByline = ({
120
- type,
121
- description,
122
- children,
123
- visibleAlt,
124
- hideCopyright,
125
- hideDescription,
126
- ...props
127
- }: Props) => {
119
+ export const EmbedByline = ({ type, description, children, visibleAlt, hideCopyright, ...props }: Props) => {
128
120
  const { t } = useTranslation();
129
121
 
130
122
  if (props.error) {
@@ -142,21 +134,23 @@ export const EmbedByline = ({
142
134
  }
143
135
 
144
136
  const { copyright } = props;
145
- const bylineDescription = hideDescription ? "" : description;
137
+ const hideByline = hideCopyright && !description;
146
138
 
147
139
  return (
148
140
  <>
149
- <BylineWrapper>
150
- <div>
151
- {hideCopyright && bylineDescription}
152
- {!hideCopyright && (
153
- <LicenseContainerContent type={type} copyright={copyright}>
154
- {bylineDescription}
155
- </LicenseContainerContent>
156
- )}
157
- {children}
158
- </div>
159
- </BylineWrapper>
141
+ {!hideByline && (
142
+ <BylineWrapper>
143
+ <div>
144
+ {hideCopyright && description}
145
+ {!hideCopyright && (
146
+ <LicenseContainerContent type={type} copyright={copyright}>
147
+ {description}
148
+ </LicenseContainerContent>
149
+ )}
150
+ {children}
151
+ </div>
152
+ </BylineWrapper>
153
+ )}
160
154
  {visibleAlt ? (
161
155
  <StyledText color="text.subtle" textStyle="label.medium" asChild consumeCss>
162
156
  <span>{`Alt: ${visibleAlt}`}</span>
package/src/index.ts CHANGED
@@ -118,6 +118,8 @@ export { type ContentTypeFramedContentVariant } from "./ContentTypeFramedContent
118
118
 
119
119
  export { default as CopyParagraphButton } from "./CopyParagraphButton";
120
120
 
121
+ export type { TagSelectorControlProps, TagSelectorInputProps, TagSelectorRootProps } from "./TagSelector/TagSelector";
122
+
121
123
  export {
122
124
  TagSelectorRoot,
123
125
  TagSelectorLabel,