@ndla/ui 53.0.0 → 54.0.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 (227) hide show
  1. package/es/Embed/ConceptEmbed.js +14 -8
  2. package/es/Embed/ImageEmbed.js +10 -4
  3. package/es/Embed/RelatedContentEmbed.js +2 -1
  4. package/es/ErrorMessage/ErrorMessage.js +14 -17
  5. package/es/Figure/Figure.js +36 -20
  6. package/es/Layout/LayoutItem.js +20 -6
  7. package/es/Layout/index.js +0 -1
  8. package/es/List/OrderedList.js +12 -11
  9. package/es/TreeStructure/AddFolderButton.js +2 -2
  10. package/es/TreeStructure/ComboboxButton.js +2 -2
  11. package/es/TreeStructure/FolderItem.js +7 -7
  12. package/es/TreeStructure/FolderItems.js +2 -2
  13. package/es/TreeStructure/TreeStructure.js +5 -5
  14. package/es/all.css +1 -1
  15. package/es/index.js +1 -1
  16. package/es/locale/messages-en.js +2 -0
  17. package/es/locale/messages-nb.js +2 -0
  18. package/es/locale/messages-nn.js +2 -0
  19. package/es/locale/messages-se.js +2 -0
  20. package/es/locale/messages-sma.js +2 -0
  21. package/lib/Article/Article.js +1 -1
  22. package/lib/Article/ArticleByline.js +1 -1
  23. package/lib/Article/ArticleFootNotes.js +1 -1
  24. package/lib/Article/ArticleHeaderWrapper.js +1 -1
  25. package/lib/Article/ArticleParagraph.js +1 -1
  26. package/lib/Article/index.js +1 -1
  27. package/lib/AudioPlayer/AudioPlayer.js +1 -1
  28. package/lib/AudioPlayer/Controls.js +1 -1
  29. package/lib/AudioPlayer/index.js +1 -1
  30. package/lib/BlogPost/BlogPost.js +1 -1
  31. package/lib/BlogPost/index.js +1 -1
  32. package/lib/Breadcrumb/Breadcrumb.js +1 -1
  33. package/lib/Breadcrumb/BreadcrumbItem.js +1 -1
  34. package/lib/Breadcrumb/HomeBreadcrumb.js +1 -1
  35. package/lib/Breadcrumb/index.js +1 -1
  36. package/lib/CampaignBlock/CampaignBlock.js +1 -1
  37. package/lib/CampaignBlock/index.js +1 -1
  38. package/lib/CodeBlock/CodeBlock.js +1 -1
  39. package/lib/CodeBlock/index.js +1 -1
  40. package/lib/ContactBlock/ContactBlock.js +1 -1
  41. package/lib/ContactBlock/index.js +1 -1
  42. package/lib/ContentPlaceholder/ContentPlaceholder.js +1 -1
  43. package/lib/ContentPlaceholder/index.js +1 -1
  44. package/lib/ContentTypeBadge/ContentTypeBadge.js +1 -1
  45. package/lib/CopyParagraphButton/CopyParagraphButton.js +1 -1
  46. package/lib/CopyParagraphButton/index.js +1 -1
  47. package/lib/CreatedBy/CreatedBy.js +1 -1
  48. package/lib/CreatedBy/index.js +1 -1
  49. package/lib/DefinitionList/DefinitionDescription.js +1 -1
  50. package/lib/DefinitionList/DefinitionTerm.js +1 -1
  51. package/lib/DefinitionList/index.js +1 -1
  52. package/lib/Embed/AudioEmbed.js +1 -1
  53. package/lib/Embed/BrightcoveEmbed.js +1 -1
  54. package/lib/Embed/ConceptEmbed.d.ts +1 -0
  55. package/lib/Embed/ConceptEmbed.js +15 -9
  56. package/lib/Embed/ConceptListEmbed.js +1 -1
  57. package/lib/Embed/ContentLinkEmbed.js +1 -1
  58. package/lib/Embed/CopyrightEmbed.js +1 -1
  59. package/lib/Embed/EmbedErrorPlaceholder.js +1 -1
  60. package/lib/Embed/ExternalEmbed.js +1 -1
  61. package/lib/Embed/FootnoteEmbed.js +1 -1
  62. package/lib/Embed/H5pEmbed.js +1 -1
  63. package/lib/Embed/IframeEmbed.js +1 -1
  64. package/lib/Embed/ImageEmbed.js +11 -5
  65. package/lib/Embed/RelatedContentEmbed.js +3 -1
  66. package/lib/Embed/UnknownEmbed.js +1 -1
  67. package/lib/Embed/UuDisclaimerEmbed.js +1 -1
  68. package/lib/Embed/conceptComponents.js +1 -1
  69. package/lib/Embed/index.js +1 -1
  70. package/lib/ErrorMessage/ErrorMessage.js +15 -18
  71. package/lib/ErrorMessage/ErrorResourceAccessDenied.js +1 -1
  72. package/lib/ErrorMessage/index.js +1 -1
  73. package/lib/FactBox/FactBox.js +1 -1
  74. package/lib/FactBox/index.js +1 -1
  75. package/lib/Figure/Figure.js +41 -21
  76. package/lib/Figure/index.js +1 -1
  77. package/lib/FileList/File.js +1 -1
  78. package/lib/FileList/FileList.js +1 -1
  79. package/lib/FileList/Format.js +1 -1
  80. package/lib/FileList/index.js +1 -1
  81. package/lib/Footer/FooterBlock.js +1 -1
  82. package/lib/FramedContent/FramedContent.js +1 -1
  83. package/lib/FramedContent/index.js +1 -1
  84. package/lib/FrontpageArticle/FrontpageArticle.js +1 -1
  85. package/lib/Gloss/Gloss.js +1 -1
  86. package/lib/Gloss/GlossExample.js +1 -1
  87. package/lib/Gloss/index.js +1 -1
  88. package/lib/Grid/Grid.js +1 -1
  89. package/lib/Hero/Hero.js +1 -1
  90. package/lib/Hero/HeroContent.js +1 -1
  91. package/lib/Image/Image.js +1 -1
  92. package/lib/Image/ImageLink.js +1 -1
  93. package/lib/KeyFigure/KeyFigure.js +1 -1
  94. package/lib/KeyFigure/index.js +1 -1
  95. package/lib/LanguageSelector/LanguageSelector.js +1 -1
  96. package/lib/LanguageSelector/index.js +1 -1
  97. package/lib/Layout/LayoutItem.js +20 -8
  98. package/lib/Layout/OneColumn.js +1 -1
  99. package/lib/Layout/PageContainer.js +1 -1
  100. package/lib/Layout/index.d.ts +0 -1
  101. package/lib/Layout/index.js +1 -8
  102. package/lib/LetterFilter/LetterFilter.js +1 -1
  103. package/lib/LetterFilter/index.js +1 -1
  104. package/lib/LicenseByline/EmbedByline.js +1 -1
  105. package/lib/LicenseByline/LicenseDescription.js +1 -1
  106. package/lib/LicenseByline/LicenseLink.js +1 -1
  107. package/lib/LicenseByline/index.js +1 -1
  108. package/lib/LinkBlock/LinkBlock.js +1 -1
  109. package/lib/LinkBlock/LinkBlockSection.js +1 -1
  110. package/lib/LinkBlock/index.js +1 -1
  111. package/lib/List/OrderedList.d.ts +0 -1
  112. package/lib/List/OrderedList.js +13 -13
  113. package/lib/List/UnOrderedList.js +1 -1
  114. package/lib/List/index.js +1 -1
  115. package/lib/Logo/Logo.js +1 -1
  116. package/lib/Logo/SvgLogo.js +1 -1
  117. package/lib/Logo/index.js +1 -1
  118. package/lib/MediaList/MediaList.js +1 -1
  119. package/lib/Messages/MessageBanner.js +1 -1
  120. package/lib/Messages/MessageBox.js +1 -1
  121. package/lib/Messages/index.js +1 -1
  122. package/lib/MyNdla/Resource/Folder.js +1 -1
  123. package/lib/MyNdla/Resource/index.js +1 -1
  124. package/lib/MyNdla/index.js +1 -1
  125. package/lib/Notion/Notion.js +1 -1
  126. package/lib/Notion/NotionImage.js +1 -1
  127. package/lib/Notion/index.js +1 -1
  128. package/lib/ProgrammeCard/ProgrammeCard.js +1 -1
  129. package/lib/ProgrammeCard/index.js +1 -1
  130. package/lib/RelatedArticleList/RelatedArticleList.js +1 -1
  131. package/lib/Resource/BlockResource.js +1 -1
  132. package/lib/Resource/ListResource.js +1 -1
  133. package/lib/Resource/index.js +1 -1
  134. package/lib/Resource/resourceComponents.js +1 -1
  135. package/lib/ResourceBox/ResourceBox.js +1 -1
  136. package/lib/ResourceBox/index.js +1 -1
  137. package/lib/Search/ActiveFilterContent.js +1 -1
  138. package/lib/Search/ActiveFilters.js +1 -1
  139. package/lib/Search/ContentTypeResult.js +1 -1
  140. package/lib/Search/ContentTypeResultStyles.js +1 -1
  141. package/lib/Search/LoadingWrapper.js +1 -1
  142. package/lib/Search/SearchField.js +1 -1
  143. package/lib/Search/SearchFieldForm.js +1 -1
  144. package/lib/Search/SearchResult.js +1 -1
  145. package/lib/Search/SearchResultSleeve.js +1 -1
  146. package/lib/Search/index.js +1 -1
  147. package/lib/SnackBar/DefaultSnackbar.js +1 -1
  148. package/lib/SnackBar/SnackbarProvider.js +1 -1
  149. package/lib/SnackBar/index.js +1 -1
  150. package/lib/Table/Table.js +1 -1
  151. package/lib/TagSelector/Control.js +1 -1
  152. package/lib/TagSelector/DropdownIndicator.js +1 -1
  153. package/lib/TagSelector/MenuList.js +1 -1
  154. package/lib/TagSelector/Option.js +1 -1
  155. package/lib/TagSelector/SelectContainer.js +1 -1
  156. package/lib/TagSelector/TagSelector.js +1 -1
  157. package/lib/TagSelector/ValueButton.js +1 -1
  158. package/lib/TagSelector/index.js +1 -1
  159. package/lib/TreeStructure/AddFolderButton.d.ts +1 -1
  160. package/lib/TreeStructure/AddFolderButton.js +3 -3
  161. package/lib/TreeStructure/ComboboxButton.d.ts +1 -1
  162. package/lib/TreeStructure/ComboboxButton.js +3 -3
  163. package/lib/TreeStructure/FolderItem.d.ts +1 -1
  164. package/lib/TreeStructure/FolderItem.js +8 -8
  165. package/lib/TreeStructure/FolderItems.d.ts +1 -1
  166. package/lib/TreeStructure/FolderItems.js +3 -3
  167. package/lib/TreeStructure/TreeStructure.d.ts +1 -1
  168. package/lib/TreeStructure/TreeStructure.js +6 -6
  169. package/lib/TreeStructure/arrowNavigation.d.ts +1 -1
  170. package/lib/TreeStructure/helperFunctions.d.ts +1 -1
  171. package/lib/TreeStructure/index.js +1 -1
  172. package/lib/TreeStructure/types.d.ts +1 -1
  173. package/lib/all.css +1 -1
  174. package/lib/i18n/i18n.js +1 -1
  175. package/lib/index.d.ts +1 -1
  176. package/lib/index.js +1 -7
  177. package/lib/locale/messages-en.d.ts +2 -0
  178. package/lib/locale/messages-en.js +3 -1
  179. package/lib/locale/messages-nb.d.ts +2 -0
  180. package/lib/locale/messages-nb.js +3 -1
  181. package/lib/locale/messages-nn.d.ts +2 -0
  182. package/lib/locale/messages-nn.js +3 -1
  183. package/lib/locale/messages-se.d.ts +2 -0
  184. package/lib/locale/messages-se.js +3 -1
  185. package/lib/locale/messages-sma.d.ts +2 -0
  186. package/lib/locale/messages-sma.js +3 -1
  187. package/lib/utils/resourceTypeColor.js +1 -1
  188. package/package.json +16 -15
  189. package/src/CodeBlock/CodeBlock.stories.tsx +1 -3
  190. package/src/Embed/AudioEmbed.stories.tsx +3 -3
  191. package/src/Embed/BrightcoveEmbed.stories.tsx +3 -3
  192. package/src/Embed/ConceptEmbed.stories.tsx +3 -3
  193. package/src/Embed/ConceptEmbed.tsx +20 -2
  194. package/src/Embed/ExternalEmbed.stories.tsx +3 -3
  195. package/src/Embed/H5pEmbed.stories.tsx +3 -3
  196. package/src/Embed/IframeEmbed.stories.tsx +3 -3
  197. package/src/Embed/ImageEmbed.stories.tsx +3 -3
  198. package/src/Embed/ImageEmbed.tsx +5 -1
  199. package/src/Embed/RelatedContentEmbed.stories.tsx +15 -3
  200. package/src/Embed/RelatedContentEmbed.tsx +4 -1
  201. package/src/Embed/UuDisclaimerEmbed.stories.tsx +3 -3
  202. package/src/ErrorMessage/ErrorMessage.tsx +8 -4
  203. package/src/Figure/Figure.tsx +102 -24
  204. package/src/Layout/LayoutItem.tsx +23 -6
  205. package/src/Layout/index.ts +0 -1
  206. package/src/LicenseByline/EmbedByline.stories.tsx +2 -2
  207. package/src/List/OrderedList.stories.tsx +2 -2
  208. package/src/List/OrderedList.tsx +21 -18
  209. package/src/TreeStructure/AddFolderButton.tsx +1 -1
  210. package/src/TreeStructure/ComboboxButton.tsx +1 -1
  211. package/src/TreeStructure/FolderItem.tsx +1 -1
  212. package/src/TreeStructure/FolderItems.tsx +1 -1
  213. package/src/TreeStructure/TreeStructure.stories.tsx +1 -1
  214. package/src/TreeStructure/TreeStructure.tsx +1 -1
  215. package/src/TreeStructure/arrowNavigation.ts +1 -1
  216. package/src/TreeStructure/helperFunctions.ts +1 -1
  217. package/src/TreeStructure/types.ts +1 -1
  218. package/src/index.ts +1 -1
  219. package/src/locale/messages-en.ts +2 -0
  220. package/src/locale/messages-nb.ts +2 -0
  221. package/src/locale/messages-nn.ts +2 -0
  222. package/src/locale/messages-se.ts +2 -0
  223. package/src/locale/messages-sma.ts +2 -0
  224. package/es/Layout/Content.js +0 -19
  225. package/lib/Layout/Content.d.ts +0 -13
  226. package/lib/Layout/Content.js +0 -26
  227. package/src/Layout/Content.tsx +0 -17
@@ -15,7 +15,7 @@ import { ArticleWrapper } from "../Article";
15
15
  import CopyParagraphButton from "../CopyParagraphButton";
16
16
  import FactBox from "../FactBox";
17
17
  import FramedContent from "../FramedContent";
18
- import { OneColumn } from "../Layout";
18
+ import LayoutItem, { OneColumn } from "../Layout";
19
19
 
20
20
  const embedData: UuDisclaimerEmbedData = {
21
21
  resource: "uu-disclaimer",
@@ -31,11 +31,11 @@ const meta: Meta<typeof UuDisclaimerEmbed> = {
31
31
  (Story) => (
32
32
  <OneColumn>
33
33
  <ArticleWrapper modifier="clean">
34
- <section className="u-4/6@desktop u-push-1/6@desktop u-10/12@tablet u-push-1/12@tablet">
34
+ <LayoutItem layout="center">
35
35
  <section>
36
36
  <Story />
37
37
  </section>
38
- </section>
38
+ </LayoutItem>
39
39
  </ArticleWrapper>
40
40
  </OneColumn>
41
41
  ),
@@ -40,6 +40,10 @@ const CustomElementWrapper = styled.div`
40
40
  margin: ${spacing.large} 0;
41
41
  `;
42
42
 
43
+ const MessageWrapper = styled.div`
44
+ margin-top: ${spacing.xsmall};
45
+ `;
46
+
43
47
  interface Props {
44
48
  messages: {
45
49
  title: string;
@@ -75,14 +79,14 @@ export const ErrorMessage = ({ children, messages, illustration, illustrationEle
75
79
  </SafeLink>
76
80
  )}
77
81
  {messages.goToFrontPage && (
78
- <div css={{ marginTop: spacing.xsmall }}>
82
+ <MessageWrapper>
79
83
  <SafeLink to="/">{messages.goToFrontPage}</SafeLink>
80
- </div>
84
+ </MessageWrapper>
81
85
  )}
82
86
  {messages.logInFailed && (
83
- <div css={{ marginTop: spacing.xsmall }}>
87
+ <MessageWrapper>
84
88
  <SafeLink to="/minndla">{messages.logInFailed}</SafeLink>
85
- </div>
89
+ </MessageWrapper>
86
90
  )}
87
91
  {children}
88
92
  </StyledErrorMessage>
@@ -9,9 +9,9 @@
9
9
  // N.B These components is used to render static markup serverside
10
10
 
11
11
  import { ComponentPropsWithRef, forwardRef, useMemo } from "react";
12
- import { css } from "@emotion/react";
12
+ import { SerializedStyles, css } from "@emotion/react";
13
13
  import styled from "@emotion/styled";
14
- import { spacing } from "@ndla/core";
14
+ import { breakpoints, mq, spacing } from "@ndla/core";
15
15
 
16
16
  const StyledFigure = styled.figure`
17
17
  position: relative;
@@ -35,36 +35,114 @@ const StyledFigure = styled.figure`
35
35
  }
36
36
  `;
37
37
 
38
- const fullColumnStyle = css`
39
- left: auto !important;
40
- right: auto !important;
41
- width: auto !important;
42
- padding-left: 0;
43
- padding-right: 0;
44
- padding-bottom: ${spacing.large};
45
- margin-bottom: 0;
46
- `;
38
+ const floatSizes: Record<FigureType, SerializedStyles> = {
39
+ left: css`
40
+ margin-top: ${spacing.xsmall};
41
+ --float: left;
42
+ --width: 50%;
43
+ --width-desktop: 65%;
44
+ & {
45
+ ${mq.range({ from: breakpoints.tablet })} {
46
+ padding-right: ${spacing.small};
47
+ }
48
+ }
49
+ `,
50
+ right: css`
51
+ margin-top: ${spacing.xsmall};
52
+ --float: right;
53
+ --width: 50%;
54
+ --width-desktop: 65%;
55
+ & {
56
+ ${mq.range({ from: breakpoints.tablet })} {
57
+ padding-left: ${spacing.small};
58
+ }
59
+ }
60
+ `,
61
+ "small-left": css`
62
+ margin-top: ${spacing.xsmall};
63
+ --float: left;
64
+ --width: 25%;
65
+ --width-desktop: 50%;
66
+ & {
67
+ ${mq.range({ from: breakpoints.tablet })} {
68
+ padding-right: ${spacing.small};
69
+ }
70
+ }
71
+ `,
72
+ "small-right": css`
73
+ margin-top: ${spacing.xsmall};
74
+ --float: right;
75
+ --width: 25%;
76
+ --width-desktop: 50%;
77
+ & {
78
+ ${mq.range({ from: breakpoints.tablet })} {
79
+ padding-left: ${spacing.small};
80
+ }
81
+ }
82
+ `,
83
+ "xsmall-left": css`
84
+ --float: left;
85
+ --width: 25%;
86
+ & {
87
+ ${mq.range({ from: breakpoints.tablet })} {
88
+ padding-right: ${spacing.small};
89
+ margin: ${spacing.xsmall} 0 ${spacing.medium};
90
+ }
91
+ }
92
+ `,
93
+ "xsmall-right": css`
94
+ --float: right;
95
+ --width: 25%;
96
+ & {
97
+ ${mq.range({ from: breakpoints.tablet })} {
98
+ padding-left: ${spacing.small};
99
+ margin: ${spacing.xsmall} 0 ${spacing.normal} ${spacing.xsmall};
100
+ }
101
+ }
102
+ `,
103
+ full: css`
104
+ margin-top: ${spacing.xsmall};
105
+ `,
106
+ "full-column": css`
107
+ left: auto !important;
108
+ right: auto !important;
109
+ width: auto !important;
110
+ padding-left: 0;
111
+ padding-right: 0;
112
+ padding-bottom: ${spacing.large};
113
+ margin-bottom: 0;
114
+ `,
115
+ };
47
116
 
48
- const rightStyle = css`
49
- float: right;
117
+ const floatStyle = css`
118
+ ${mq.range({ from: breakpoints.tablet })} {
119
+ float: var(--float);
120
+ clear: var(--float);
121
+ width: var(--width) !important;
122
+ z-index: 1;
123
+ left: auto !important;
124
+ padding: 0;
125
+ }
126
+ ${mq.range({ from: breakpoints.desktop })} {
127
+ width: var(--width-desktop, var(--width)) !important;
128
+ }
50
129
  `;
51
130
 
52
- const smallTypes = ["small-right", "xsmall-right"];
53
-
54
- const Figure = forwardRef<HTMLElement, Props>(({ children, type = "full", className, ...rest }, ref) => {
55
- const floatClass = type === "full-column" ? undefined : `u-float-${type}`;
56
-
131
+ const Figure = forwardRef<HTMLElement, Props>(({ children, type = "full", ...rest }, ref) => {
57
132
  const styles = useMemo(() => {
58
133
  const styles = [];
59
- if (!floatClass) styles.push(fullColumnStyle);
60
- if (smallTypes.includes(type)) styles.push(rightStyle);
134
+ const floatCss = floatSizes[type];
135
+ if (type !== "full-column" && type !== "full") {
136
+ styles.push(floatStyle);
137
+ }
138
+ if (floatCss) {
139
+ styles.push(floatCss);
140
+ }
61
141
  return styles;
62
- }, [floatClass, type]);
63
-
64
- const classes = floatClass ? `${floatClass} ${className ?? ""}` : className;
142
+ }, [type]);
65
143
 
66
144
  return (
67
- <StyledFigure data-sizetype={type} css={styles} className={classes} {...rest} ref={ref}>
145
+ <StyledFigure data-sizetype={type} css={styles} {...rest} ref={ref}>
68
146
  {children}
69
147
  </StyledFigure>
70
148
  );
@@ -7,25 +7,42 @@
7
7
  */
8
8
 
9
9
  import { HTMLAttributes, ReactNode, useMemo } from "react";
10
+ import { css } from "@emotion/react";
11
+ import { mq, breakpoints } from "@ndla/core";
10
12
 
11
13
  interface Props extends HTMLAttributes<HTMLElement> {
12
14
  children?: ReactNode;
13
15
  layout?: "extend" | "center";
14
16
  }
15
17
 
18
+ const centerCss = css`
19
+ position: relative !important;
20
+ width: 83.333%;
21
+ right: auto !important;
22
+ left: 8.333%;
23
+ `;
24
+
25
+ const extendCss = css`
26
+ ${mq.range({ from: breakpoints.tablet })} {
27
+ position: relative !important;
28
+ width: 83.333%;
29
+ right: auto !important;
30
+ left: 8.333%;
31
+ }
32
+ `;
33
+
16
34
  export const LayoutItem = ({ children, layout, ...rest }: Props) => {
17
- const className = useMemo(() => {
35
+ const style = useMemo(() => {
18
36
  if (layout === "extend") {
19
- return "u-10/12@desktop u-push-1/12@desktop u-10/12@tablet u-push-1/12@tablet";
20
- }
21
- if (layout === "center") {
22
- return "u-10/12 u-push-1/12";
37
+ return extendCss;
38
+ } else if (layout === "center") {
39
+ return centerCss;
23
40
  }
24
41
  return undefined;
25
42
  }, [layout]);
26
43
 
27
44
  return (
28
- <section className={className} {...rest}>
45
+ <section css={style} {...rest}>
29
46
  {children}
30
47
  </section>
31
48
  );
@@ -10,6 +10,5 @@ import LayoutItem from "./LayoutItem";
10
10
 
11
11
  export { default as OneColumn } from "./OneColumn";
12
12
  export { default as PageContainer } from "./PageContainer";
13
- export { default as Content } from "./Content";
14
13
 
15
14
  export default LayoutItem;
@@ -63,8 +63,8 @@ export default {
63
63
  },
64
64
  argTypes: {
65
65
  children: {
66
- control: {
67
- type: null,
66
+ table: {
67
+ disable: true,
68
68
  },
69
69
  },
70
70
  },
@@ -82,7 +82,7 @@ export const WithNumbersAndLetters: StoryFn = () => (
82
82
  );
83
83
 
84
84
  export const StartingAtFive: StoryFn = () => (
85
- <OrderedList start={5} data-type="letters" className="ol-reset-5">
85
+ <OrderedList start={5} data-type="letters">
86
86
  <li>Listepunkt 1</li>
87
87
  <li>Listepunkt 2</li>
88
88
  <li>
@@ -97,7 +97,7 @@ export const StartingAtFive: StoryFn = () => (
97
97
  <li>Listepunkt 2</li>
98
98
  <li>
99
99
  Listepunkt 3
100
- <OrderedList className="ol-reset-5" start={5}>
100
+ <OrderedList start={5}>
101
101
  <li>Listepunkt 1</li>
102
102
  <li>Listepunkt 2</li>
103
103
  <li>Listepunkt 3</li>
@@ -6,22 +6,11 @@
6
6
  *
7
7
  */
8
8
 
9
- import { forwardRef, HTMLAttributes } from "react";
9
+ import { CSSProperties, forwardRef, HTMLAttributes, useMemo } from "react";
10
10
  import { css } from "@emotion/react";
11
11
  import styled from "@emotion/styled";
12
12
  import { fonts, spacing } from "@ndla/core";
13
13
 
14
- export const generateListResets = (counterName: string) => {
15
- let styles = "";
16
- for (let $i = 0; $i < 50; $i++) {
17
- styles += `
18
- &.ol-reset-${$i} { counter-reset: ${counterName} ${$i - 1}; }
19
- `;
20
- }
21
-
22
- return styles;
23
- };
24
-
25
14
  export const LetterCSS = css`
26
15
  padding-left: ${spacing.medium};
27
16
  > li {
@@ -73,7 +62,9 @@ export const NumberCSS = css`
73
62
  }
74
63
  > ol:not([data-type="letters"]) {
75
64
  counter-reset: level2;
76
- ${generateListResets("level2")};
65
+ &[data-count="true"] {
66
+ counter-reset: level2 var(--start, 0);
67
+ }
77
68
  > li {
78
69
  padding-left: ${spacing.nsmall};
79
70
  counter-increment: level2;
@@ -82,7 +73,9 @@ export const NumberCSS = css`
82
73
  }
83
74
  > ol:not([data-type="letters"]) {
84
75
  counter-reset: level3;
85
- ${generateListResets("level3")};
76
+ &[data-count="true"] {
77
+ counter-reset: level3 var(--start, 0);
78
+ }
86
79
  > li {
87
80
  padding-left: ${spacing.medium};
88
81
  counter-increment: level3;
@@ -91,7 +84,10 @@ export const NumberCSS = css`
91
84
  }
92
85
  > ol:not([data-type="letters"]) {
93
86
  counter-reset: level4;
94
- ${generateListResets("level4")};
87
+ &[data-count="true"] {
88
+ counter-reset: level4 var(--start, 0);
89
+ }
90
+
95
91
  > li {
96
92
  padding-left: ${spacing.large};
97
93
  counter-increment: level4;
@@ -110,12 +106,15 @@ export const NumberCSS = css`
110
106
 
111
107
  const StyledOl = styled.ol`
112
108
  ${fonts.sizes("18px", "29px")};
113
- ${generateListResets("level1")};
114
109
  padding: 0;
115
110
  list-style-type: none;
116
111
  counter-reset: level1;
117
112
  margin: ${spacing.normal} 0 ${spacing.normal} ${spacing.normal};
118
113
 
114
+ &[data-count="true"] {
115
+ counter-reset: level1 var(--start, 0);
116
+ }
117
+
119
118
  > li {
120
119
  margin-top: ${spacing.nsmall};
121
120
  padding-top: 0;
@@ -144,9 +143,13 @@ interface Props extends HTMLAttributes<HTMLOListElement> {
144
143
  start?: number;
145
144
  }
146
145
 
147
- const OrderedList = forwardRef<HTMLOListElement, Props>(({ type, children, ...rest }, ref) => {
146
+ const OrderedList = forwardRef<HTMLOListElement, Props>(({ type, children, start, ...rest }, ref) => {
147
+ const style = useMemo(() => {
148
+ return { "--start": start ? start - 1 : undefined } as CSSProperties;
149
+ }, [start]);
150
+
148
151
  return (
149
- <StyledOl data-type={type} ref={ref} {...rest}>
152
+ <StyledOl data-type={type} data-count={start != null} style={style} ref={ref} {...rest}>
150
153
  {children}
151
154
  </StyledOl>
152
155
  );
@@ -12,7 +12,7 @@ import styled from "@emotion/styled";
12
12
  import { ButtonV2 as Button } from "@ndla/button";
13
13
  import { Plus } from "@ndla/icons/action";
14
14
  import { Tooltip } from "@ndla/tooltip";
15
- import { IFolder } from "@ndla/types-backend/learningpath-api";
15
+ import { IFolder } from "@ndla/types-backend/myndla-api";
16
16
 
17
17
  interface AddFolderButtonProps {
18
18
  canAddFolder: boolean;
@@ -11,7 +11,7 @@ import styled from "@emotion/styled";
11
11
  import { ButtonV2 as Button, IconButtonV2 as IconButton } from "@ndla/button";
12
12
  import { breakpoints, colors, mq, spacing } from "@ndla/core";
13
13
  import { ChevronUp, ChevronDown } from "@ndla/icons/common";
14
- import { IFolder } from "@ndla/types-backend/learningpath-api";
14
+ import { IFolder } from "@ndla/types-backend/myndla-api";
15
15
  import { useForwardedRef } from "@ndla/util";
16
16
  import { arrowNavigation } from "./arrowNavigation";
17
17
  import { treestructureId } from "./helperFunctions";
@@ -15,7 +15,7 @@ import { ArrowDropDownRounded } from "@ndla/icons/common";
15
15
  import { FolderOutlined, FolderShared } from "@ndla/icons/contentType";
16
16
  import { Done } from "@ndla/icons/editor";
17
17
  import { SafeLink } from "@ndla/safelink";
18
- import { IFolder } from "@ndla/types-backend/learningpath-api";
18
+ import { IFolder } from "@ndla/types-backend/myndla-api";
19
19
  import { arrowNavigation } from "./arrowNavigation";
20
20
  import { treestructureId } from "./helperFunctions";
21
21
  import { CommonFolderItemsProps } from "./types";
@@ -9,7 +9,7 @@
9
9
  import { ReactNode } from "react";
10
10
  import styled from "@emotion/styled";
11
11
  import { animations } from "@ndla/core";
12
- import { IFolder } from "@ndla/types-backend/learningpath-api";
12
+ import { IFolder } from "@ndla/types-backend/myndla-api";
13
13
  import FolderItem from "./FolderItem";
14
14
  import { treestructureId } from "./helperFunctions";
15
15
  import { CommonFolderItemsProps, NewFolderInputFunc, OnCreatedFunc } from "./types";
@@ -17,7 +17,7 @@ import { FieldErrorMessage, FieldHelper, FormControl, InputContainer, InputV3, L
17
17
  import { Spinner } from "@ndla/icons";
18
18
  import { Cross } from "@ndla/icons/action";
19
19
  import { Done } from "@ndla/icons/editor";
20
- import { IFolder } from "@ndla/types-backend/learningpath-api";
20
+ import { IFolder } from "@ndla/types-backend/myndla-api";
21
21
  import { uuid } from "@ndla/util";
22
22
  import { flattenFolders } from "./helperFunctions";
23
23
  import TreeStructure, { TreeStructureProps } from "./TreeStructure";
@@ -9,7 +9,7 @@
9
9
  import { useEffect, useState, useMemo, useRef } from "react";
10
10
  import styled from "@emotion/styled";
11
11
  import { colors, fonts, misc, utils } from "@ndla/core";
12
- import { IFolder } from "@ndla/types-backend/learningpath-api";
12
+ import { IFolder } from "@ndla/types-backend/myndla-api";
13
13
  import AddFolderButton from "./AddFolderButton";
14
14
  import ComboboxButton from "./ComboboxButton";
15
15
  import FolderItems from "./FolderItems";
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { KeyboardEvent } from "react";
10
- import { IFolder } from "@ndla/types-backend/learningpath-api";
10
+ import { IFolder } from "@ndla/types-backend/myndla-api";
11
11
 
12
12
  const navigateVertical = (
13
13
  visibleFolders: IFolder[],
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
 
9
- import { IFolder } from "@ndla/types-backend/learningpath-api";
9
+ import { IFolder } from "@ndla/types-backend/myndla-api";
10
10
  import { TreeStructureType } from "./types";
11
11
 
12
12
  export const flattenFolders = (folders: IFolder[], openFolders?: string[]): IFolder[] => {
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { ReactNode } from "react";
10
- import { IFolder, IResource } from "@ndla/types-backend/learningpath-api";
10
+ import { IFolder, IResource } from "@ndla/types-backend/myndla-api";
11
11
 
12
12
  export type TreeStructureType = "navigation" | "picker";
13
13
 
package/src/index.ts CHANGED
@@ -117,7 +117,7 @@ export type { SimpleBreadcrumbItem, IndexedBreadcrumbItem } from "./Breadcrumb";
117
117
 
118
118
  export { i18nInstance, formatNestedMessages } from "./i18n";
119
119
 
120
- export { default as LayoutItem, OneColumn, PageContainer, Content } from "./Layout";
120
+ export { default as LayoutItem, OneColumn, PageContainer } from "./Layout";
121
121
 
122
122
  export {
123
123
  MediaList,
@@ -944,6 +944,7 @@ const messages = {
944
944
  unShare: "Sharing stopped. The folder is no longer shared",
945
945
  copyLink: "Copy link to folder",
946
946
  link: "Link is copied",
947
+ savedLink: "Link to {{ name }} has been added to My folders.",
947
948
  header: {
948
949
  shared: "This folder is shared",
949
950
  },
@@ -1190,6 +1191,7 @@ const messages = {
1190
1191
  copyFolderDisclaimer:
1191
1192
  "This creates a copy of the folder. Any changes made to the original folder will not be updated here.",
1192
1193
  loginCopyFolderPitch: "Do you wish to copy this folder?",
1194
+ loginSaveFolderLinkPitch: "Do you wish to save the link to this shared folder?",
1193
1195
  help: "Help",
1194
1196
  more: "More options",
1195
1197
  selectView: "Select view",
@@ -944,6 +944,7 @@ const messages = {
944
944
  unShare: "Delingen er avsluttet. Mappen er ikke lenger delt.",
945
945
  copyLink: "Kopier lenke til mappa",
946
946
  link: "Lenken er kopiert",
947
+ savedLink: "Lenke til {{ name }} er lagt til i Mine mapper.",
947
948
  header: {
948
949
  shared: "Denne mappa er delt",
949
950
  },
@@ -1190,6 +1191,7 @@ const messages = {
1190
1191
  copyFolderDisclaimer:
1191
1192
  "Dette lager en kopi av mappen. Eventuelle endringer i originalmappen vil ikke bli oppdatert her.",
1192
1193
  loginCopyFolderPitch: "Ønsker du å kopiere denne mappen?",
1194
+ loginSaveFolderLinkPitch: "Ønsker du å lagre lenken til denne delte mappen?",
1193
1195
  help: "Hjelp",
1194
1196
  more: "Flere valg",
1195
1197
  selectView: "Velg visning",
@@ -943,6 +943,7 @@ const messages = {
943
943
  sharedFolder: "Delt mappe",
944
944
  unShare: "Delinga er avslutta. Mappa er ikkje lenger delt",
945
945
  link: "Lenka er kopiert",
946
+ savedLink: "Lenka til {{ name }} er lagt til i Mine mapper.",
946
947
  copyLink: "Kopier lenke til mappa",
947
948
  header: {
948
949
  shared: "Denne mappa er delt",
@@ -1190,6 +1191,7 @@ const messages = {
1190
1191
  copyFolderDisclaimer:
1191
1192
  "Dette lagar ein kopi av mappa. Eventuelle endringar i originalmappa vil ikkje bli oppdatert her.",
1192
1193
  loginCopyFolderPitch: "Ønsker du å kopiere denne mappa?",
1194
+ loginSaveFolderLinkPitch: "Ønsker du å lagra lenka til denne delte mappa?",
1193
1195
  help: "Hjelp",
1194
1196
  more: "Fleire val",
1195
1197
  selectView: "Velg visning",
@@ -946,6 +946,7 @@ const messages = {
946
946
  unShare: "Delingen er avsluttet. Mappen er ikke lenger delt.",
947
947
  copyLink: "Kopier lenke til mappa",
948
948
  link: "Lenken er kopiert",
949
+ savedLink: "Lenke til {{ name }} er lagt til i Mine mapper.",
949
950
  header: {
950
951
  shared: "Denne mappa er delt",
951
952
  },
@@ -1192,6 +1193,7 @@ const messages = {
1192
1193
  copyFolderDisclaimer:
1193
1194
  "Dette lager en kopi av mappen. Eventuelle endringer i originalmappen vil ikke bli oppdatert her.",
1194
1195
  loginCopyFolderPitch: "Ønsker du å kopiere denne mappen?",
1196
+ loginSaveFolderLinkPitch: "Ønsker du å lagre lenken til denne delte mappen?",
1195
1197
  help: "Hjelp",
1196
1198
  more: "Flere valg",
1197
1199
  selectView: "Velg visning",
@@ -948,6 +948,7 @@ const messages = {
948
948
  unShare: "Delingen er avsluttet. Mappen er ikke lenger delt.",
949
949
  copyLink: "Kopier lenke til mappa",
950
950
  link: "Lenken er kopiert",
951
+ savedLink: "Lenke til {{ name }} er lagt til i Mine mapper.",
951
952
  header: {
952
953
  shared: "Denne mappa er delt",
953
954
  },
@@ -1194,6 +1195,7 @@ const messages = {
1194
1195
  copyFolderDisclaimer:
1195
1196
  "Dette lager en kopi av mappen. Eventuelle endringer i originalmappen vil ikke bli oppdatert her.",
1196
1197
  loginCopyFolderPitch: "Ønsker du å kopiere denne mappen?",
1198
+ loginSaveFolderLinkPitch: "Ønsker du å lagre lenken til denne delte mappen?",
1197
1199
  help: "Hjelp",
1198
1200
  more: "Flere valg",
1199
1201
  selectView: "Velg visning",
@@ -1,19 +0,0 @@
1
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
- /**
3
- * Copyright (c) 2016-present, NDLA.
4
- *
5
- * This source code is licensed under the GPLv3 license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- *
8
- */
9
-
10
- export const Content = _ref => {
11
- let {
12
- children
13
- } = _ref;
14
- return _jsx("div", {
15
- className: "o-content",
16
- children: children
17
- });
18
- };
19
- export default Content;
@@ -1,13 +0,0 @@
1
- /**
2
- * Copyright (c) 2016-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { ReactNode } from "react";
9
- interface Props {
10
- children: ReactNode;
11
- }
12
- export declare const Content: ({ children }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
13
- export default Content;
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.Content = void 0;
7
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
8
- /**
9
- * Copyright (c) 2016-present, NDLA.
10
- *
11
- * This source code is licensed under the GPLv3 license found in the
12
- * LICENSE file in the root directory of this source tree.
13
- *
14
- */
15
-
16
- const Content = _ref => {
17
- let {
18
- children
19
- } = _ref;
20
- return (0, _jsxRuntime.jsx)("div", {
21
- className: "o-content",
22
- children: children
23
- });
24
- };
25
- exports.Content = Content;
26
- var _default = exports.default = Content;
@@ -1,17 +0,0 @@
1
- /**
2
- * Copyright (c) 2016-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- import { ReactNode } from "react";
10
-
11
- interface Props {
12
- children: ReactNode;
13
- }
14
-
15
- export const Content = ({ children }: Props) => <div className="o-content">{children}</div>;
16
-
17
- export default Content;