@ndla/article-converter 9.0.14-alpha.0 → 9.0.16-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.
@@ -7,17 +7,16 @@
7
7
  */
8
8
 
9
9
  import { attributesToProps, domToReact } from "html-react-parser";
10
- import { OrderedList } from "@ndla/ui";
10
+ import { OrderedList } from "@ndla/primitives";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const olPlugin = (node, converterOpts, opts) => {
13
13
  const props = attributesToProps(node.attribs);
14
- const letterClass = node.attribs["data-type"] === "letters" ? "ol-list--roman" : false;
15
- const num = node.attribs.start;
16
- const numClass = num ? `ol-reset-${num}` : false;
17
- const classes = [node.attribs.class ?? false, letterClass, numClass].filter(c => !!c).join(" ");
14
+ const variantProp = node.attribs["data-type"] === "letters" ? {
15
+ variant: "letters"
16
+ } : {};
18
17
  return _jsx(OrderedList, {
19
18
  ...props,
20
- className: classes.length ? classes : undefined,
19
+ ...variantProp,
21
20
  lang: opts.articleLanguage,
22
21
  children: domToReact(node.children, converterOpts)
23
22
  });
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { attributesToProps, domToReact } from "html-react-parser";
10
- import { UnOrderedList } from "@ndla/ui";
10
+ import { UnOrderedList } from "@ndla/primitives";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const ulPlugin = (node, converterOpts, opts) => {
13
13
  const props = attributesToProps(node.attribs);
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.olPlugin = void 0;
7
7
  var _htmlReactParser = require("html-react-parser");
8
- var _ui = require("@ndla/ui");
8
+ var _primitives = require("@ndla/primitives");
9
9
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
10
10
  /**
11
11
  * Copyright (c) 2023-present, NDLA.
@@ -17,13 +17,12 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const olPlugin = (node, converterOpts, opts) => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
20
- const letterClass = node.attribs["data-type"] === "letters" ? "ol-list--roman" : false;
21
- const num = node.attribs.start;
22
- const numClass = num ? `ol-reset-${num}` : false;
23
- const classes = [node.attribs.class ?? false, letterClass, numClass].filter(c => !!c).join(" ");
24
- return (0, _jsxRuntime.jsx)(_ui.OrderedList, {
20
+ const variantProp = node.attribs["data-type"] === "letters" ? {
21
+ variant: "letters"
22
+ } : {};
23
+ return (0, _jsxRuntime.jsx)(_primitives.OrderedList, {
25
24
  ...props,
26
- className: classes.length ? classes : undefined,
25
+ ...variantProp,
27
26
  lang: opts.articleLanguage,
28
27
  children: (0, _htmlReactParser.domToReact)(node.children, converterOpts)
29
28
  });
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.ulPlugin = void 0;
7
7
  var _htmlReactParser = require("html-react-parser");
8
- var _ui = require("@ndla/ui");
8
+ var _primitives = require("@ndla/primitives");
9
9
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
10
10
  /**
11
11
  * Copyright (c) 2023-present, NDLA.
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const ulPlugin = (node, converterOpts, opts) => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
20
- return (0, _jsxRuntime.jsx)(_ui.UnOrderedList, {
20
+ return (0, _jsxRuntime.jsx)(_primitives.UnOrderedList, {
21
21
  ...props,
22
22
  className: node.attribs.class,
23
23
  lang: opts.articleLanguage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/article-converter",
3
- "version": "9.0.14-alpha.0",
3
+ "version": "9.0.16-alpha.0",
4
4
  "description": "Transforms NDLA articles into extended html versions",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -31,8 +31,8 @@
31
31
  "@ndla/types-embed": "^4.1.8"
32
32
  },
33
33
  "dependencies": {
34
- "@ndla/primitives": "^0.0.18",
35
- "@ndla/ui": "^55.0.14-alpha.0",
34
+ "@ndla/primitives": "^0.0.19",
35
+ "@ndla/ui": "^55.0.16-alpha.0",
36
36
  "html-react-parser": "^5.1.8"
37
37
  },
38
38
  "peerDependencies": {
@@ -47,5 +47,5 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "6fdfbed9f18bbd725c837fb74de2f093e80d5605"
50
+ "gitHead": "b05b7016560891b2867811c4420041e6932003cc"
51
51
  }
@@ -7,17 +7,14 @@
7
7
  */
8
8
 
9
9
  import { DOMNode, attributesToProps, domToReact } from "html-react-parser";
10
- import { OrderedList } from "@ndla/ui";
10
+ import { OrderedList } from "@ndla/primitives";
11
11
  import { PluginType } from "./types";
12
12
  export const olPlugin: PluginType = (node, converterOpts, opts) => {
13
13
  const props = attributesToProps(node.attribs);
14
- const letterClass = node.attribs["data-type"] === "letters" ? "ol-list--roman" : false;
15
- const num = node.attribs.start;
16
- const numClass = num ? `ol-reset-${num}` : false;
17
- const classes = [node.attribs.class ?? false, letterClass, numClass].filter((c): c is string => !!c).join(" ");
14
+ const variantProp = node.attribs["data-type"] === "letters" ? ({ variant: "letters" } as const) : {};
18
15
 
19
16
  return (
20
- <OrderedList {...props} className={classes.length ? classes : undefined} lang={opts.articleLanguage}>
17
+ <OrderedList {...props} {...variantProp} lang={opts.articleLanguage}>
21
18
  {domToReact(node.children as DOMNode[], converterOpts)}
22
19
  </OrderedList>
23
20
  );
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { DOMNode, attributesToProps, domToReact } from "html-react-parser";
10
- import { UnOrderedList } from "@ndla/ui";
10
+ import { UnOrderedList } from "@ndla/primitives";
11
11
  import { PluginType } from "./types";
12
12
  export const ulPlugin: PluginType = (node, converterOpts, opts) => {
13
13
  const props = attributesToProps(node.attribs);