@ndla/ui 53.0.1 → 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.
- package/es/Embed/ConceptEmbed.js +14 -8
- package/es/Embed/RelatedContentEmbed.js +2 -1
- package/es/ErrorMessage/ErrorMessage.js +14 -17
- package/es/Figure/Figure.js +36 -20
- package/es/Layout/LayoutItem.js +20 -6
- package/es/Layout/index.js +0 -1
- package/es/List/OrderedList.js +12 -11
- package/es/TreeStructure/AddFolderButton.js +2 -2
- package/es/TreeStructure/ComboboxButton.js +2 -2
- package/es/TreeStructure/FolderItem.js +7 -7
- package/es/TreeStructure/FolderItems.js +2 -2
- package/es/TreeStructure/TreeStructure.js +5 -5
- package/es/all.css +1 -1
- package/es/index.js +1 -1
- package/lib/Embed/ConceptEmbed.d.ts +1 -0
- package/lib/Embed/ConceptEmbed.js +14 -8
- package/lib/Embed/RelatedContentEmbed.js +3 -1
- package/lib/ErrorMessage/ErrorMessage.js +14 -17
- package/lib/Figure/Figure.js +40 -20
- package/lib/Layout/LayoutItem.js +20 -8
- package/lib/Layout/index.d.ts +0 -1
- package/lib/Layout/index.js +0 -7
- package/lib/List/OrderedList.d.ts +0 -1
- package/lib/List/OrderedList.js +12 -12
- package/lib/TreeStructure/AddFolderButton.d.ts +1 -1
- package/lib/TreeStructure/AddFolderButton.js +2 -2
- package/lib/TreeStructure/ComboboxButton.d.ts +1 -1
- package/lib/TreeStructure/ComboboxButton.js +2 -2
- package/lib/TreeStructure/FolderItem.d.ts +1 -1
- package/lib/TreeStructure/FolderItem.js +7 -7
- package/lib/TreeStructure/FolderItems.d.ts +1 -1
- package/lib/TreeStructure/FolderItems.js +2 -2
- package/lib/TreeStructure/TreeStructure.d.ts +1 -1
- package/lib/TreeStructure/TreeStructure.js +5 -5
- package/lib/TreeStructure/arrowNavigation.d.ts +1 -1
- package/lib/TreeStructure/helperFunctions.d.ts +1 -1
- package/lib/TreeStructure/types.d.ts +1 -1
- package/lib/all.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -6
- package/package.json +16 -15
- package/src/Embed/AudioEmbed.stories.tsx +3 -3
- package/src/Embed/BrightcoveEmbed.stories.tsx +3 -3
- package/src/Embed/ConceptEmbed.stories.tsx +3 -3
- package/src/Embed/ConceptEmbed.tsx +20 -2
- package/src/Embed/ExternalEmbed.stories.tsx +3 -3
- package/src/Embed/H5pEmbed.stories.tsx +3 -3
- package/src/Embed/IframeEmbed.stories.tsx +3 -3
- package/src/Embed/ImageEmbed.stories.tsx +3 -3
- package/src/Embed/RelatedContentEmbed.stories.tsx +15 -3
- package/src/Embed/RelatedContentEmbed.tsx +4 -1
- package/src/Embed/UuDisclaimerEmbed.stories.tsx +3 -3
- package/src/ErrorMessage/ErrorMessage.tsx +8 -4
- package/src/Figure/Figure.tsx +102 -24
- package/src/Layout/LayoutItem.tsx +23 -6
- package/src/Layout/index.ts +0 -1
- package/src/List/OrderedList.stories.tsx +2 -2
- package/src/List/OrderedList.tsx +21 -18
- package/src/TreeStructure/AddFolderButton.tsx +1 -1
- package/src/TreeStructure/ComboboxButton.tsx +1 -1
- package/src/TreeStructure/FolderItem.tsx +1 -1
- package/src/TreeStructure/FolderItems.tsx +1 -1
- package/src/TreeStructure/TreeStructure.stories.tsx +1 -1
- package/src/TreeStructure/TreeStructure.tsx +1 -1
- package/src/TreeStructure/arrowNavigation.ts +1 -1
- package/src/TreeStructure/helperFunctions.ts +1 -1
- package/src/TreeStructure/types.ts +1 -1
- package/src/index.ts +1 -1
- package/es/Layout/Content.js +0 -19
- package/lib/Layout/Content.d.ts +0 -13
- package/lib/Layout/Content.js +0 -26
- package/src/Layout/Content.tsx +0 -17
package/src/List/OrderedList.tsx
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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";
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { IFolder } from "@ndla/types-backend/
|
|
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[] => {
|
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
|
|
120
|
+
export { default as LayoutItem, OneColumn, PageContainer } from "./Layout";
|
|
121
121
|
|
|
122
122
|
export {
|
|
123
123
|
MediaList,
|
package/es/Layout/Content.js
DELETED
|
@@ -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;
|
package/lib/Layout/Content.d.ts
DELETED
|
@@ -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;
|
package/lib/Layout/Content.js
DELETED
|
@@ -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;
|
package/src/Layout/Content.tsx
DELETED
|
@@ -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;
|