@ndla/ui 56.0.39-alpha.0 → 56.0.41-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.
Files changed (44) hide show
  1. package/dist/panda.buildinfo.json +2 -0
  2. package/dist/styles.css +8 -0
  3. package/es/Article/Article.js +6 -2
  4. package/es/AudioPlayer/Controls.js +6 -3
  5. package/es/Embed/UuDisclaimerEmbed.js +11 -12
  6. package/es/KeyFigure/KeyFigure.js +5 -1
  7. package/es/locale/messages-en.js +0 -3
  8. package/es/locale/messages-nb.js +0 -3
  9. package/es/locale/messages-nn.js +0 -3
  10. package/es/locale/messages-se.js +0 -3
  11. package/es/locale/messages-sma.js +0 -3
  12. package/lib/Article/Article.d.ts +4 -2
  13. package/lib/Article/Article.js +6 -2
  14. package/lib/AudioPlayer/Controls.js +6 -3
  15. package/lib/Embed/UuDisclaimerEmbed.js +10 -11
  16. package/lib/KeyFigure/KeyFigure.js +5 -1
  17. package/lib/TagSelector/TagSelector.d.ts +3 -3
  18. package/lib/i18n/useComponentTranslations.d.ts +2 -3
  19. package/lib/index.d.ts +1 -1
  20. package/lib/locale/messages-en.d.ts +0 -3
  21. package/lib/locale/messages-en.js +0 -3
  22. package/lib/locale/messages-nb.d.ts +0 -3
  23. package/lib/locale/messages-nb.js +0 -3
  24. package/lib/locale/messages-nn.d.ts +0 -3
  25. package/lib/locale/messages-nn.js +0 -3
  26. package/lib/locale/messages-se.d.ts +0 -3
  27. package/lib/locale/messages-se.js +0 -3
  28. package/lib/locale/messages-sma.d.ts +0 -3
  29. package/lib/locale/messages-sma.js +0 -3
  30. package/package.json +4 -4
  31. package/src/Article/Article.tsx +6 -1
  32. package/src/AudioPlayer/Controls.tsx +4 -4
  33. package/src/Embed/UuDisclaimerEmbed.tsx +8 -9
  34. package/src/Grid/Grid.stories.tsx +15 -9
  35. package/src/KeyFigure/KeyFigure.tsx +5 -0
  36. package/src/TagSelector/TagSelector.stories.tsx +4 -2
  37. package/src/TagSelector/TagSelector.tsx +3 -3
  38. package/src/i18n/useComponentTranslations.ts +3 -3
  39. package/src/index.ts +1 -1
  40. package/src/locale/messages-en.ts +0 -3
  41. package/src/locale/messages-nb.ts +0 -3
  42. package/src/locale/messages-nn.ts +0 -3
  43. package/src/locale/messages-se.ts +0 -3
  44. package/src/locale/messages-sma.ts +0 -3
@@ -297,6 +297,7 @@
297
297
  "outlineColor]___[value:stroke.default]___[cond:_focusVisible<___>_after",
298
298
  "outlineOffset]___[value:3px]___[cond:_focusVisible<___>_after",
299
299
  "outlineStyle]___[value:solid]___[cond:_focusVisible<___>_after",
300
+ "paddingInlineStart]___[value:4xsmall",
300
301
  "textAlign]___[value:center",
301
302
  "color]___[value:text.strong]___[cond:& a",
302
303
  "marginTop]___[value:0]___[cond:& h1",
@@ -375,6 +376,7 @@
375
376
  "borderColor]___[value:surface.brand.2",
376
377
  "top]___[value:var(--masthead-height, 0px)]___[cond:& > div",
377
378
  "position]___[value:sticky]___[cond:& > div",
379
+ "paddingBlock]___[value:xxlarge]___[cond:&:not(:has(> img))",
378
380
  "width]___[value:surface.3xsmall",
379
381
  "textStyle]___[value:heading.large",
380
382
  "textStyle]___[value:title.medium",
package/dist/styles.css CHANGED
@@ -546,6 +546,10 @@
546
546
  padding-inline: var(--spacing-4xsmall);
547
547
  }
548
548
 
549
+ .ps_4xsmall {
550
+ padding-inline-start: var(--spacing-4xsmall);
551
+ }
552
+
549
553
  .ta_center {
550
554
  text-align: center;
551
555
  }
@@ -1179,6 +1183,10 @@
1179
1183
  position: sticky;
1180
1184
  }
1181
1185
 
1186
+ .\[\&\:not\(\:has\(\>_img\)\)\]\:py_xxlarge:not(:has(> img)) {
1187
+ padding-block: var(--spacing-xxlarge);
1188
+ }
1189
+
1182
1190
  .after\:d_block\!::after {
1183
1191
  display: block !important;
1184
1192
  }
@@ -109,6 +109,7 @@ export const ArticleTitle = _ref2 => {
109
109
  lang,
110
110
  id,
111
111
  introduction,
112
+ contentTypeLabel,
112
113
  competenceGoals
113
114
  } = _ref2;
114
115
  return /*#__PURE__*/_jsxs(ArticleHeader, {
@@ -119,7 +120,8 @@ export const ArticleTitle = _ref2 => {
119
120
  direction: "row",
120
121
  gap: "small",
121
122
  children: [!!contentType && /*#__PURE__*/_jsx(ContentTypeBadgeNew, {
122
- contentType: contentType
123
+ contentType: contentType,
124
+ children: contentTypeLabel
123
125
  }), heartButton]
124
126
  }), /*#__PURE__*/_jsx(Heading, {
125
127
  textStyle: "heading.medium",
@@ -146,6 +148,7 @@ export const Article = _ref3 => {
146
148
  licenseBox,
147
149
  children,
148
150
  competenceGoals,
151
+ contentTypeLabel,
149
152
  id,
150
153
  heartButton,
151
154
  lang
@@ -167,7 +170,8 @@ export const Article = _ref3 => {
167
170
  title: title,
168
171
  introduction: introduction,
169
172
  competenceGoals: competenceGoals,
170
- lang: lang
173
+ lang: lang,
174
+ contentTypeLabel: contentTypeLabel
171
175
  }), /*#__PURE__*/_jsx(ArticleContent, {
172
176
  children: content
173
177
  }), /*#__PURE__*/_jsxs(ArticleFooter, {
@@ -8,6 +8,7 @@
8
8
 
9
9
  import { useEffect, useRef, useState } from "react";
10
10
  import { useTranslation } from "react-i18next";
11
+ import { createListCollection } from "@ark-ui/react";
11
12
  import { Replay15Line, Forward15Line } from "@ndla/icons/action";
12
13
  import { PlayFill, PauseLine, VolumeUpFill } from "@ndla/icons/common";
13
14
  import { CheckLine } from "@ndla/icons/editor";
@@ -115,7 +116,9 @@ const formatTime = seconds => {
115
116
  const formattedSeconds = currentSeconds < 10 ? `0${currentSeconds}` : currentSeconds;
116
117
  return `${minutes}:${formattedSeconds}`;
117
118
  };
118
- const speedValues = ["0.5", "0.75", "1", "1.25", "1.5", "1.75", "2"];
119
+ const speedValues = createListCollection({
120
+ items: ["0.5", "0.75", "1", "1.25", "1.5", "1.75", "2"]
121
+ });
119
122
  const Controls = _ref => {
120
123
  let {
121
124
  src,
@@ -253,7 +256,7 @@ const Controls = _ref => {
253
256
  })
254
257
  })]
255
258
  }), /*#__PURE__*/_jsxs(StyledSelectRoot, {
256
- items: speedValues,
259
+ collection: speedValues,
257
260
  value: [speedValue.toString()],
258
261
  onValueChange: details => setSpeedValue(parseFloat(details.value[0])),
259
262
  positioning: {
@@ -276,7 +279,7 @@ const Controls = _ref => {
276
279
  })
277
280
  }), /*#__PURE__*/_jsx(SelectPositioner, {
278
281
  children: /*#__PURE__*/_jsx(SelectContent, {
279
- children: speedValues.map(speed => /*#__PURE__*/_jsxs(SelectItem, {
282
+ children: speedValues.items.map(speed => /*#__PURE__*/_jsxs(SelectItem, {
280
283
  item: speed,
281
284
  children: [/*#__PURE__*/_jsxs(SelectItemText, {
282
285
  children: [speed, "x"]
@@ -6,12 +6,11 @@
6
6
  *
7
7
  */
8
8
 
9
- import { useTranslation } from "react-i18next";
10
9
  import { InformationLine } from "@ndla/icons/common";
11
10
  import { MessageBox } from "@ndla/primitives";
12
11
  import { SafeLink } from "@ndla/safelink";
13
12
  import { styled } from "@ndla/styled-system/jsx";
14
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
14
  const StyledMessageBox = styled(MessageBox, {
16
15
  base: {
17
16
  display: "flex",
@@ -24,14 +23,16 @@ const Disclaimer = styled("div", {
24
23
  textStyle: "body.medium"
25
24
  }
26
25
  });
26
+ const StyledSafeLink = styled(SafeLink, {
27
+ base: {
28
+ paddingInlineStart: "4xsmall"
29
+ }
30
+ });
27
31
  const UuDisclaimerEmbed = _ref => {
28
32
  let {
29
33
  embed,
30
34
  children
31
35
  } = _ref;
32
- const {
33
- t
34
- } = useTranslation();
35
36
  if (embed.status === "error") {
36
37
  return null;
37
38
  }
@@ -39,13 +40,11 @@ const UuDisclaimerEmbed = _ref => {
39
40
  embedData,
40
41
  data
41
42
  } = embed;
42
- const disclaimerLink = data?.disclaimerLink ? /*#__PURE__*/_jsxs(_Fragment, {
43
- children: [` ${t("uuDisclaimer.alternative")} `, /*#__PURE__*/_jsx(SafeLink, {
44
- to: data.disclaimerLink.href,
45
- target: "_blank",
46
- rel: "noopener noreferrer",
47
- children: data.disclaimerLink.text
48
- })]
43
+ const disclaimerLink = data?.disclaimerLink ? /*#__PURE__*/_jsx(StyledSafeLink, {
44
+ to: data.disclaimerLink.href,
45
+ target: "_blank",
46
+ rel: "noopener noreferrer",
47
+ children: data.disclaimerLink.text
49
48
  }) : null;
50
49
  return /*#__PURE__*/_jsxs("div", {
51
50
  role: "region",
@@ -14,7 +14,11 @@ const ContentWrapper = styled("div", {
14
14
  display: "flex",
15
15
  flexDirection: "column",
16
16
  alignItems: "center",
17
- justifyContent: "center"
17
+ justifyContent: "center",
18
+ gap: "xsmall",
19
+ "&:not(:has(> img))": {
20
+ paddingBlock: "xxlarge"
21
+ }
18
22
  }
19
23
  });
20
24
  const StyledImage = styled("img", {
@@ -1404,9 +1404,6 @@ const messages = {
1404
1404
  pinyin: "Pinyin"
1405
1405
  }
1406
1406
  },
1407
- uuDisclaimer: {
1408
- alternative: "You can find alternative content in the article"
1409
- },
1410
1407
  wordClass: {
1411
1408
  [wordClass.wordClass.adjective]: "Adjective",
1412
1409
  [wordClass.wordClass.adverb]: "Adverb",
@@ -1404,9 +1404,6 @@ const messages = {
1404
1404
  pinyin: "Pinyin"
1405
1405
  }
1406
1406
  },
1407
- uuDisclaimer: {
1408
- alternative: "Du kan finne alternativt innhold i artikkelen"
1409
- },
1410
1407
  wordClass: {
1411
1408
  [wordClass.wordClass.adjective]: "Adjektiv",
1412
1409
  [wordClass.wordClass.adverb]: "Adverb",
@@ -1404,9 +1404,6 @@ const messages = {
1404
1404
  pinyin: "Pinyin"
1405
1405
  }
1406
1406
  },
1407
- uuDisclaimer: {
1408
- alternative: "Du kan finne alternativt innhald i artikkelen"
1409
- },
1410
1407
  wordClass: {
1411
1408
  [wordClass.wordClass.adjective]: "Adjektiv",
1412
1409
  [wordClass.wordClass.adverb]: "Adverb",
@@ -1404,9 +1404,6 @@ const messages = {
1404
1404
  pinyin: "Pinyin"
1405
1405
  }
1406
1406
  },
1407
- uuDisclaimer: {
1408
- alternative: "Du kan finne alternativt innhold i artikkelen"
1409
- },
1410
1407
  wordClass: {
1411
1408
  [wordClass.wordClass.adjective]: "Adjektiivvat",
1412
1409
  [wordClass.wordClass.adverb]: "Advearba",
@@ -1404,9 +1404,6 @@ const messages = {
1404
1404
  pinyin: "Pinyin"
1405
1405
  }
1406
1406
  },
1407
- uuDisclaimer: {
1408
- alternative: "Du kan finne alternativt innhold i artikkelen"
1409
- },
1410
1407
  wordClass: {
1411
1408
  [wordClass.wordClass.adjective]: "Adjektiv",
1412
1409
  [wordClass.wordClass.adverb]: "Adverb",
@@ -28,22 +28,24 @@ export declare const ArticleFooter: import("@ndla/styled-system/types").StyledCo
28
28
  interface ArticleTitleProps {
29
29
  heartButton?: ReactNode;
30
30
  contentType?: ContentType;
31
+ contentTypeLabel?: ReactNode;
31
32
  competenceGoals?: ReactNode;
32
33
  id: string;
33
34
  lang?: string;
34
35
  title?: ReactNode;
35
36
  introduction?: ReactNode;
36
37
  }
37
- export declare const ArticleTitle: ({ contentType, heartButton, title, lang, id, introduction, competenceGoals, }: ArticleTitleProps) => import("react/jsx-runtime").JSX.Element;
38
+ export declare const ArticleTitle: ({ contentType, heartButton, title, lang, id, introduction, contentTypeLabel, competenceGoals, }: ArticleTitleProps) => import("react/jsx-runtime").JSX.Element;
38
39
  interface Props {
39
40
  heartButton?: ReactNode;
40
41
  article: ArticleType;
41
42
  licenseBox?: ReactNode;
42
43
  contentType?: ContentType;
44
+ contentTypeLabel?: ReactNode;
43
45
  children?: ReactNode;
44
46
  competenceGoals?: ReactNode;
45
47
  id: string;
46
48
  lang?: string;
47
49
  }
48
- export declare const Article: ({ article, contentType, licenseBox, children, competenceGoals, id, heartButton, lang, }: Props) => import("react/jsx-runtime").JSX.Element;
50
+ export declare const Article: ({ article, contentType, licenseBox, children, competenceGoals, contentTypeLabel, id, heartButton, lang, }: Props) => import("react/jsx-runtime").JSX.Element;
49
51
  export {};
@@ -115,6 +115,7 @@ const ArticleTitle = _ref2 => {
115
115
  lang,
116
116
  id,
117
117
  introduction,
118
+ contentTypeLabel,
118
119
  competenceGoals
119
120
  } = _ref2;
120
121
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ArticleHeader, {
@@ -125,7 +126,8 @@ const ArticleTitle = _ref2 => {
125
126
  direction: "row",
126
127
  gap: "small",
127
128
  children: [!!contentType && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.ContentTypeBadgeNew, {
128
- contentType: contentType
129
+ contentType: contentType,
130
+ children: contentTypeLabel
129
131
  }), heartButton]
130
132
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Heading, {
131
133
  textStyle: "heading.medium",
@@ -153,6 +155,7 @@ const Article = _ref3 => {
153
155
  licenseBox,
154
156
  children,
155
157
  competenceGoals,
158
+ contentTypeLabel,
156
159
  id,
157
160
  heartButton,
158
161
  lang
@@ -174,7 +177,8 @@ const Article = _ref3 => {
174
177
  title: title,
175
178
  introduction: introduction,
176
179
  competenceGoals: competenceGoals,
177
- lang: lang
180
+ lang: lang,
181
+ contentTypeLabel: contentTypeLabel
178
182
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ArticleContent, {
179
183
  children: content
180
184
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(ArticleFooter, {
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = require("react");
8
8
  var _reactI18next = require("react-i18next");
9
+ var _react2 = require("@ark-ui/react");
9
10
  var _action = require("@ndla/icons/action");
10
11
  var _common = require("@ndla/icons/common");
11
12
  var _editor = require("@ndla/icons/editor");
@@ -121,7 +122,9 @@ const formatTime = seconds => {
121
122
  const formattedSeconds = currentSeconds < 10 ? `0${currentSeconds}` : currentSeconds;
122
123
  return `${minutes}:${formattedSeconds}`;
123
124
  };
124
- const speedValues = ["0.5", "0.75", "1", "1.25", "1.5", "1.75", "2"];
125
+ const speedValues = (0, _react2.createListCollection)({
126
+ items: ["0.5", "0.75", "1", "1.25", "1.5", "1.75", "2"]
127
+ });
125
128
  const Controls = _ref => {
126
129
  let {
127
130
  src,
@@ -259,7 +262,7 @@ const Controls = _ref => {
259
262
  })
260
263
  })]
261
264
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledSelectRoot, {
262
- items: speedValues,
265
+ collection: speedValues,
263
266
  value: [speedValue.toString()],
264
267
  onValueChange: details => setSpeedValue(parseFloat(details.value[0])),
265
268
  positioning: {
@@ -282,7 +285,7 @@ const Controls = _ref => {
282
285
  })
283
286
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.SelectPositioner, {
284
287
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.SelectContent, {
285
- children: speedValues.map(speed => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.SelectItem, {
288
+ children: speedValues.items.map(speed => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.SelectItem, {
286
289
  item: speed,
287
290
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.SelectItemText, {
288
291
  children: [speed, "x"]
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _reactI18next = require("react-i18next");
8
7
  var _common = require("@ndla/icons/common");
9
8
  var _primitives = require("@ndla/primitives");
10
9
  var _safelink = require("@ndla/safelink");
@@ -30,14 +29,16 @@ const Disclaimer = (0, _jsx2.styled)("div", {
30
29
  textStyle: "body.medium"
31
30
  }
32
31
  });
32
+ const StyledSafeLink = (0, _jsx2.styled)(_safelink.SafeLink, {
33
+ base: {
34
+ paddingInlineStart: "4xsmall"
35
+ }
36
+ });
33
37
  const UuDisclaimerEmbed = _ref => {
34
38
  let {
35
39
  embed,
36
40
  children
37
41
  } = _ref;
38
- const {
39
- t
40
- } = (0, _reactI18next.useTranslation)();
41
42
  if (embed.status === "error") {
42
43
  return null;
43
44
  }
@@ -45,13 +46,11 @@ const UuDisclaimerEmbed = _ref => {
45
46
  embedData,
46
47
  data
47
48
  } = embed;
48
- const disclaimerLink = data?.disclaimerLink ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
49
- children: [` ${t("uuDisclaimer.alternative")} `, /*#__PURE__*/(0, _jsxRuntime.jsx)(_safelink.SafeLink, {
50
- to: data.disclaimerLink.href,
51
- target: "_blank",
52
- rel: "noopener noreferrer",
53
- children: data.disclaimerLink.text
54
- })]
49
+ const disclaimerLink = data?.disclaimerLink ? /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledSafeLink, {
50
+ to: data.disclaimerLink.href,
51
+ target: "_blank",
52
+ rel: "noopener noreferrer",
53
+ children: data.disclaimerLink.text
55
54
  }) : null;
56
55
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
57
56
  role: "region",
@@ -21,7 +21,11 @@ const ContentWrapper = (0, _jsx2.styled)("div", {
21
21
  display: "flex",
22
22
  flexDirection: "column",
23
23
  alignItems: "center",
24
- justifyContent: "center"
24
+ justifyContent: "center",
25
+ gap: "xsmall",
26
+ "&:not(:has(> img))": {
27
+ paddingBlock: "xxlarge"
28
+ }
25
29
  }
26
30
  });
27
31
  const StyledImage = (0, _jsx2.styled)("img", {
@@ -6,10 +6,10 @@
6
6
  *
7
7
  */
8
8
  /// <reference types="react" />
9
- import type { ComboboxCollectionItem } from "@ark-ui/react";
9
+ import type { CollectionItem } from "@ark-ui/react";
10
10
  import { ComboboxControlProps, ComboboxInputProps, ComboboxRootProps, TagsInputControlProps, TagsInputInputProps, TagsInputRootProps } from "@ndla/primitives";
11
- export type TagSelectorRootProps<T extends ComboboxCollectionItem> = ComboboxRootProps<T> & TagsInputRootProps;
12
- export declare const TagSelectorRoot: <T extends ComboboxCollectionItem>({ allowCustomValue, multiple, selectionBehavior, editable, addOnPaste, onValueChange, children, value, translations, ...rest }: TagSelectorRootProps<T>) => import("react/jsx-runtime").JSX.Element;
11
+ export type TagSelectorRootProps<T extends CollectionItem> = ComboboxRootProps<T> & TagsInputRootProps;
12
+ export declare const TagSelectorRoot: <T extends unknown>({ allowCustomValue, multiple, selectionBehavior, editable, addOnPaste, onValueChange, children, value, translations, ...rest }: TagSelectorRootProps<T>) => import("react/jsx-runtime").JSX.Element;
13
13
  export type TagSelectorControlProps = ComboboxControlProps & TagsInputControlProps;
14
14
  export declare const TagSelectorLabel: ({ textStyle, fontWeight, ...props }: import("@ndla/primitives").ComboboxLabelProps) => import("react/jsx-runtime").JSX.Element;
15
15
  export declare const TagSelectorItemInput: import("react").ForwardRefExoticComponent<import("@ark-ui/react").TagsInputItemInputProps & {
@@ -5,15 +5,14 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import type { ComboboxCollectionItem } from "@ark-ui/react";
9
8
  import type { ComboboxRootProps, PaginationRootProps, TagsInputRootProps } from "@ndla/primitives";
10
9
  import { TagSelectorRootProps } from "../TagSelector/TagSelector";
11
10
  type DeepPartial<T> = {
12
11
  [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
13
12
  };
14
13
  export declare const useTagsInputTranslations: (translations?: Partial<TagsInputRootProps["translations"]>) => TagsInputRootProps["translations"];
15
- export declare const useComboboxTranslations: <T extends ComboboxCollectionItem>(translations?: Partial<ComboboxRootProps<T>["translations"]>) => ComboboxRootProps<T>["translations"];
16
- export declare const useTagSelectorTranslations: <T extends ComboboxCollectionItem>(translations?: Partial<TagSelectorRootProps<T>["translations"]>) => TagSelectorRootProps<T>["translations"];
14
+ export declare const useComboboxTranslations: <T extends unknown>(translations?: Partial<ComboboxRootProps<T>["translations"]>) => ComboboxRootProps<T>["translations"];
15
+ export declare const useTagSelectorTranslations: <T extends unknown>(translations?: Partial<TagSelectorRootProps<T>["translations"]>) => TagSelectorRootProps<T>["translations"];
17
16
  export declare const usePaginationTranslations: (translations?: Partial<PaginationRootProps["translations"]>) => PaginationRootProps["translations"];
18
17
  interface AudioSearchTranslations {
19
18
  searchPlaceholder: string;
package/lib/index.d.ts CHANGED
@@ -48,7 +48,7 @@ export { Grid, GridParallaxItem } from "./Grid";
48
48
  export type { GridType } from "./Grid";
49
49
  export { Gloss, GlossExample } from "./Gloss";
50
50
  export { LinkBlock, LinkBlockSection } from "./LinkBlock";
51
- export type { Article as ArticleType } from "./types";
51
+ export type { Article as ArticleType, HeadingLevel } from "./types";
52
52
  export { CodeBlock, codeLanguageOptions } from "./CodeBlock";
53
53
  export { ZendeskButton } from "./ZendeskButton/ZendeskButton";
54
54
  export type { ZendeskButtonProps } from "./ZendeskButton/ZendeskButton";
@@ -1394,9 +1394,6 @@ declare const messages: {
1394
1394
  pinyin: string;
1395
1395
  };
1396
1396
  };
1397
- uuDisclaimer: {
1398
- alternative: string;
1399
- };
1400
1397
  wordClass: {
1401
1398
  [x: string]: string;
1402
1399
  };
@@ -1411,9 +1411,6 @@ const messages = {
1411
1411
  pinyin: "Pinyin"
1412
1412
  }
1413
1413
  },
1414
- uuDisclaimer: {
1415
- alternative: "You can find alternative content in the article"
1416
- },
1417
1414
  wordClass: {
1418
1415
  [wordClass.wordClass.adjective]: "Adjective",
1419
1416
  [wordClass.wordClass.adverb]: "Adverb",
@@ -1394,9 +1394,6 @@ declare const messages: {
1394
1394
  pinyin: string;
1395
1395
  };
1396
1396
  };
1397
- uuDisclaimer: {
1398
- alternative: string;
1399
- };
1400
1397
  wordClass: {
1401
1398
  [x: string]: string;
1402
1399
  };
@@ -1411,9 +1411,6 @@ const messages = {
1411
1411
  pinyin: "Pinyin"
1412
1412
  }
1413
1413
  },
1414
- uuDisclaimer: {
1415
- alternative: "Du kan finne alternativt innhold i artikkelen"
1416
- },
1417
1414
  wordClass: {
1418
1415
  [wordClass.wordClass.adjective]: "Adjektiv",
1419
1416
  [wordClass.wordClass.adverb]: "Adverb",
@@ -1394,9 +1394,6 @@ declare const messages: {
1394
1394
  pinyin: string;
1395
1395
  };
1396
1396
  };
1397
- uuDisclaimer: {
1398
- alternative: string;
1399
- };
1400
1397
  wordClass: {
1401
1398
  [x: string]: string;
1402
1399
  };
@@ -1411,9 +1411,6 @@ const messages = {
1411
1411
  pinyin: "Pinyin"
1412
1412
  }
1413
1413
  },
1414
- uuDisclaimer: {
1415
- alternative: "Du kan finne alternativt innhald i artikkelen"
1416
- },
1417
1414
  wordClass: {
1418
1415
  [wordClass.wordClass.adjective]: "Adjektiv",
1419
1416
  [wordClass.wordClass.adverb]: "Adverb",
@@ -1394,9 +1394,6 @@ declare const messages: {
1394
1394
  pinyin: string;
1395
1395
  };
1396
1396
  };
1397
- uuDisclaimer: {
1398
- alternative: string;
1399
- };
1400
1397
  wordClass: {
1401
1398
  [x: string]: string;
1402
1399
  };
@@ -1411,9 +1411,6 @@ const messages = {
1411
1411
  pinyin: "Pinyin"
1412
1412
  }
1413
1413
  },
1414
- uuDisclaimer: {
1415
- alternative: "Du kan finne alternativt innhold i artikkelen"
1416
- },
1417
1414
  wordClass: {
1418
1415
  [wordClass.wordClass.adjective]: "Adjektiivvat",
1419
1416
  [wordClass.wordClass.adverb]: "Advearba",
@@ -1394,9 +1394,6 @@ declare const messages: {
1394
1394
  pinyin: string;
1395
1395
  };
1396
1396
  };
1397
- uuDisclaimer: {
1398
- alternative: string;
1399
- };
1400
1397
  wordClass: {
1401
1398
  [x: string]: string;
1402
1399
  };
@@ -1411,9 +1411,6 @@ const messages = {
1411
1411
  pinyin: "Pinyin"
1412
1412
  }
1413
1413
  },
1414
- uuDisclaimer: {
1415
- alternative: "Du kan finne alternativt innhold i artikkelen"
1416
- },
1417
1414
  wordClass: {
1418
1415
  [wordClass.wordClass.adjective]: "Adjektiv",
1419
1416
  [wordClass.wordClass.adverb]: "Adverb",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "56.0.39-alpha.0",
3
+ "version": "56.0.41-alpha.0",
4
4
  "description": "UI component library for NDLA",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -35,8 +35,8 @@
35
35
  "@ndla/core": "^5.0.2",
36
36
  "@ndla/icons": "^8.0.27-alpha.0",
37
37
  "@ndla/licenses": "^8.0.3-alpha.0",
38
- "@ndla/primitives": "^1.0.36-alpha.0",
39
- "@ndla/safelink": "^7.0.36-alpha.0",
38
+ "@ndla/primitives": "^1.0.37-alpha.0",
39
+ "@ndla/safelink": "^7.0.37-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",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "84234a46743d9d044f220e90e6710e2da307d65d"
61
+ "gitHead": "29f766c461881909c892102640cd09944f64d694"
62
62
  }
@@ -113,6 +113,7 @@ const StyledStack = styled(Stack, {
113
113
  interface ArticleTitleProps {
114
114
  heartButton?: ReactNode;
115
115
  contentType?: ContentType;
116
+ contentTypeLabel?: ReactNode;
116
117
  competenceGoals?: ReactNode;
117
118
  id: string;
118
119
  lang?: string;
@@ -127,6 +128,7 @@ export const ArticleTitle = ({
127
128
  lang,
128
129
  id,
129
130
  introduction,
131
+ contentTypeLabel,
130
132
  competenceGoals,
131
133
  }: ArticleTitleProps) => {
132
134
  return (
@@ -134,7 +136,7 @@ export const ArticleTitle = ({
134
136
  <ArticleHGroup>
135
137
  {(!!contentType || !!heartButton) && (
136
138
  <StyledStack justify="space-between" align="center" direction="row" gap="small">
137
- {!!contentType && <ContentTypeBadgeNew contentType={contentType} />}
139
+ {!!contentType && <ContentTypeBadgeNew contentType={contentType}>{contentTypeLabel}</ContentTypeBadgeNew>}
138
140
  {heartButton}
139
141
  </StyledStack>
140
142
  )}
@@ -157,6 +159,7 @@ interface Props {
157
159
  article: ArticleType;
158
160
  licenseBox?: ReactNode;
159
161
  contentType?: ContentType;
162
+ contentTypeLabel?: ReactNode;
160
163
  children?: ReactNode;
161
164
  competenceGoals?: ReactNode;
162
165
  id: string;
@@ -169,6 +172,7 @@ export const Article = ({
169
172
  licenseBox,
170
173
  children,
171
174
  competenceGoals,
175
+ contentTypeLabel,
172
176
  id,
173
177
  heartButton,
174
178
  lang,
@@ -188,6 +192,7 @@ export const Article = ({
188
192
  introduction={introduction}
189
193
  competenceGoals={competenceGoals}
190
194
  lang={lang}
195
+ contentTypeLabel={contentTypeLabel}
191
196
  />
192
197
  <ArticleContent>{content}</ArticleContent>
193
198
  <ArticleFooter>
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { useEffect, useRef, useState } from "react";
10
10
  import { useTranslation } from "react-i18next";
11
- import type { SliderValueChangeDetails } from "@ark-ui/react";
11
+ import { type SliderValueChangeDetails, createListCollection } from "@ark-ui/react";
12
12
  import { Replay15Line, Forward15Line } from "@ndla/icons/action";
13
13
  import { PlayFill, PauseLine, VolumeUpFill } from "@ndla/icons/common";
14
14
  import { CheckLine } from "@ndla/icons/editor";
@@ -152,7 +152,7 @@ const formatTime = (seconds: number) => {
152
152
  return `${minutes}:${formattedSeconds}`;
153
153
  };
154
154
 
155
- const speedValues = ["0.5", "0.75", "1", "1.25", "1.5", "1.75", "2"];
155
+ const speedValues = createListCollection({ items: ["0.5", "0.75", "1", "1.25", "1.5", "1.75", "2"] });
156
156
 
157
157
  interface Props {
158
158
  src: string;
@@ -291,7 +291,7 @@ const Controls = ({ src, title }: Props) => {
291
291
  </StyledText>
292
292
  </ProgressWrapper>
293
293
  <StyledSelectRoot
294
- items={speedValues}
294
+ collection={speedValues}
295
295
  value={[speedValue.toString()]}
296
296
  onValueChange={(details) => setSpeedValue(parseFloat(details.value[0]))}
297
297
  positioning={{ placement: "top" }}
@@ -310,7 +310,7 @@ const Controls = ({ src, title }: Props) => {
310
310
  </SelectControl>
311
311
  <SelectPositioner>
312
312
  <SelectContent>
313
- {speedValues.map((speed) => (
313
+ {speedValues.items.map((speed) => (
314
314
  <SelectItem key={speed} item={speed}>
315
315
  <SelectItemText>{speed}x</SelectItemText>
316
316
  <SelectItemIndicator>
@@ -7,7 +7,6 @@
7
7
  */
8
8
 
9
9
  import { ReactNode } from "react";
10
- import { useTranslation } from "react-i18next";
11
10
  import { InformationLine } from "@ndla/icons/common";
12
11
  import { MessageBox } from "@ndla/primitives";
13
12
  import { SafeLink } from "@ndla/safelink";
@@ -31,10 +30,13 @@ const Disclaimer = styled("div", {
31
30
  textStyle: "body.medium",
32
31
  },
33
32
  });
33
+ const StyledSafeLink = styled(SafeLink, {
34
+ base: {
35
+ paddingInlineStart: "4xsmall",
36
+ },
37
+ });
34
38
 
35
39
  const UuDisclaimerEmbed = ({ embed, children }: Props) => {
36
- const { t } = useTranslation();
37
-
38
40
  if (embed.status === "error") {
39
41
  return null;
40
42
  }
@@ -42,12 +44,9 @@ const UuDisclaimerEmbed = ({ embed, children }: Props) => {
42
44
  const { embedData, data } = embed;
43
45
 
44
46
  const disclaimerLink = data?.disclaimerLink ? (
45
- <>
46
- {` ${t("uuDisclaimer.alternative")} `}
47
- <SafeLink to={data.disclaimerLink.href} target="_blank" rel="noopener noreferrer">
48
- {data.disclaimerLink.text}
49
- </SafeLink>
50
- </>
47
+ <StyledSafeLink to={data.disclaimerLink.href} target="_blank" rel="noopener noreferrer">
48
+ {data.disclaimerLink.text}
49
+ </StyledSafeLink>
51
50
  ) : null;
52
51
 
53
52
  return (
@@ -50,7 +50,11 @@ export const GridKeyPerformanceStory: StoryFn<typeof Grid> = ({ ...args }) => {
50
50
  const columns = args.columns === "2x2" ? 4 : parseInt(args.columns);
51
51
  const items = new Array(columns).fill(0).map((_, idx) => {
52
52
  const args = keyFigureArgs[idx % keyFigureArgs.length];
53
- return <Plain key={idx} {...args} />;
53
+ return (
54
+ <div key={idx} data-type="grid-cell" data-parallax-cell="false">
55
+ <Plain key={idx} {...args} />
56
+ </div>
57
+ );
54
58
  });
55
59
  return <Grid {...args}>{items}</Grid>;
56
60
  };
@@ -58,14 +62,16 @@ export const GridKeyPerformanceStory: StoryFn<typeof Grid> = ({ ...args }) => {
58
62
  export const GridBlogPostStory: StoryFn<typeof Grid> = ({ ...args }) => {
59
63
  const columns = args.columns === "2x2" ? 4 : parseInt(args.columns);
60
64
  const items = new Array(columns).fill(
61
- <BlogPostStory
62
- metaImage={BlogPostStory.args?.metaImage!}
63
- title={BlogPostStory.args?.title!}
64
- size={"normal"}
65
- headingLevel={BlogPostStory.args?.headingLevel}
66
- url={BlogPostStory.args?.url!}
67
- author={BlogPostStory.args?.author}
68
- />,
65
+ <div data-type="grid-cell" data-parallax-cell="false">
66
+ <BlogPostStory
67
+ metaImage={BlogPostStory.args?.metaImage!}
68
+ title={BlogPostStory.args?.title!}
69
+ size={"normal"}
70
+ headingLevel={BlogPostStory.args?.headingLevel}
71
+ url={BlogPostStory.args?.url!}
72
+ author={BlogPostStory.args?.author}
73
+ />
74
+ </div>,
69
75
  );
70
76
  return <Grid {...args}>{items}</Grid>;
71
77
  };
@@ -15,6 +15,11 @@ const ContentWrapper = styled("div", {
15
15
  flexDirection: "column",
16
16
  alignItems: "center",
17
17
  justifyContent: "center",
18
+ gap: "xsmall",
19
+
20
+ "&:not(:has(> img))": {
21
+ paddingBlock: "xxlarge",
22
+ },
18
23
  },
19
24
  });
20
25
 
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { useState } from "react";
10
- import type { ComboboxInputValueChangeDetails } from "@ark-ui/react";
10
+ import { type ComboboxInputValueChangeDetails, createListCollection } from "@ark-ui/react";
11
11
 
12
12
  import { Meta, StoryFn } from "@storybook/react";
13
13
  import { CloseLine } from "@ndla/icons/action";
@@ -63,11 +63,13 @@ export const Default: StoryFn<typeof TagSelectorRoot> = ({ translations, ...args
63
63
  setOptions(filtered);
64
64
  };
65
65
 
66
+ const collection = createListCollection({ items: options });
67
+
66
68
  return (
67
69
  <TagSelectorRoot
68
70
  {...args}
69
71
  value={value}
70
- items={options}
72
+ collection={collection}
71
73
  onInputValueChange={handleChange}
72
74
  onValueChange={(details) => setValue(details.value)}
73
75
  translations={componentTranslations}
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { forwardRef, useEffect, useId, useRef } from "react";
10
- import type { ComboboxCollectionItem } from "@ark-ui/react";
10
+ import type { CollectionItem } from "@ark-ui/react";
11
11
  import { ComboboxContext, useTagsInputContext } from "@ark-ui/react";
12
12
  import { CloseLine } from "@ndla/icons/action";
13
13
  import {
@@ -34,9 +34,9 @@ import {
34
34
  } from "@ndla/primitives";
35
35
  import { contains } from "@ndla/util";
36
36
 
37
- export type TagSelectorRootProps<T extends ComboboxCollectionItem> = ComboboxRootProps<T> & TagsInputRootProps;
37
+ export type TagSelectorRootProps<T extends CollectionItem> = ComboboxRootProps<T> & TagsInputRootProps;
38
38
 
39
- export const TagSelectorRoot = <T extends ComboboxCollectionItem>({
39
+ export const TagSelectorRoot = <T extends CollectionItem>({
40
40
  allowCustomValue = true,
41
41
  multiple = true,
42
42
  selectionBehavior = "clear",
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { useTranslation } from "react-i18next";
10
- import type { ComboboxCollectionItem } from "@ark-ui/react";
10
+ import type { CollectionItem } from "@ark-ui/react";
11
11
  import type { ComboboxRootProps, PaginationRootProps, TagsInputRootProps } from "@ndla/primitives";
12
12
  import { TagSelectorRootProps } from "../TagSelector/TagSelector";
13
13
 
@@ -33,7 +33,7 @@ export const useTagsInputTranslations = (
33
33
  };
34
34
  };
35
35
 
36
- export const useComboboxTranslations = <T extends ComboboxCollectionItem>(
36
+ export const useComboboxTranslations = <T extends CollectionItem>(
37
37
  translations?: Partial<ComboboxRootProps<T>["translations"]>,
38
38
  ): ComboboxRootProps<T>["translations"] => {
39
39
  const { t } = useTranslation("translation", { keyPrefix: "component.combobox" });
@@ -45,7 +45,7 @@ export const useComboboxTranslations = <T extends ComboboxCollectionItem>(
45
45
  };
46
46
  };
47
47
 
48
- export const useTagSelectorTranslations = <T extends ComboboxCollectionItem>(
48
+ export const useTagSelectorTranslations = <T extends CollectionItem>(
49
49
  translations?: Partial<TagSelectorRootProps<T>["translations"]>,
50
50
  ): TagSelectorRootProps<T>["translations"] => {
51
51
  const tagsInputTranslations = useTagsInputTranslations();
package/src/index.ts CHANGED
@@ -142,7 +142,7 @@ export { Gloss, GlossExample } from "./Gloss";
142
142
 
143
143
  export { LinkBlock, LinkBlockSection } from "./LinkBlock";
144
144
 
145
- export type { Article as ArticleType } from "./types";
145
+ export type { Article as ArticleType, HeadingLevel } from "./types";
146
146
 
147
147
  export { CodeBlock, codeLanguageOptions } from "./CodeBlock";
148
148
 
@@ -1437,9 +1437,6 @@ const messages = {
1437
1437
  pinyin: "Pinyin",
1438
1438
  },
1439
1439
  },
1440
- uuDisclaimer: {
1441
- alternative: "You can find alternative content in the article",
1442
- },
1443
1440
  wordClass: {
1444
1441
  [wordClass.wordClass.adjective]: "Adjective",
1445
1442
  [wordClass.wordClass.adverb]: "Adverb",
@@ -1437,9 +1437,6 @@ const messages = {
1437
1437
  pinyin: "Pinyin",
1438
1438
  },
1439
1439
  },
1440
- uuDisclaimer: {
1441
- alternative: "Du kan finne alternativt innhold i artikkelen",
1442
- },
1443
1440
  wordClass: {
1444
1441
  [wordClass.wordClass.adjective]: "Adjektiv",
1445
1442
  [wordClass.wordClass.adverb]: "Adverb",
@@ -1436,9 +1436,6 @@ const messages = {
1436
1436
  pinyin: "Pinyin",
1437
1437
  },
1438
1438
  },
1439
- uuDisclaimer: {
1440
- alternative: "Du kan finne alternativt innhald i artikkelen",
1441
- },
1442
1439
  wordClass: {
1443
1440
  [wordClass.wordClass.adjective]: "Adjektiv",
1444
1441
  [wordClass.wordClass.adverb]: "Adverb",
@@ -1439,9 +1439,6 @@ const messages = {
1439
1439
  pinyin: "Pinyin",
1440
1440
  },
1441
1441
  },
1442
- uuDisclaimer: {
1443
- alternative: "Du kan finne alternativt innhold i artikkelen",
1444
- },
1445
1442
  wordClass: {
1446
1443
  [wordClass.wordClass.adjective]: "Adjektiivvat",
1447
1444
  [wordClass.wordClass.adverb]: "Advearba",
@@ -1441,9 +1441,6 @@ const messages = {
1441
1441
  pinyin: "Pinyin",
1442
1442
  },
1443
1443
  },
1444
- uuDisclaimer: {
1445
- alternative: "Du kan finne alternativt innhold i artikkelen",
1446
- },
1447
1444
  wordClass: {
1448
1445
  [wordClass.wordClass.adjective]: "Adjektiv",
1449
1446
  [wordClass.wordClass.adverb]: "Adverb",