@ndla/ui 56.0.43-alpha.0 → 56.0.45-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.
package/README.md CHANGED
@@ -18,11 +18,12 @@ The following dependencies are optional, but some components may depend on one o
18
18
 
19
19
  ```js
20
20
  react-router
21
- @ndla/article-converter
22
- @ndla/button
23
- @ndla/licenses
21
+ @ndla/core
24
22
  @ndla/icons
25
- @ndla/tabs
23
+ @ndla/licenses
24
+ @ndla/primitives
25
+ @ndla/safelink
26
+ @ndla/styled-system
26
27
  @ndla/util
27
28
  ```
28
29
 
@@ -6,6 +6,7 @@
6
6
  *
7
7
  */
8
8
 
9
+ import { forwardRef } from "react";
9
10
  import { SafeLink } from "@ndla/safelink";
10
11
  import { styled } from "@ndla/styled-system/jsx";
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -27,10 +28,11 @@ const StyledSafeLink = styled(SafeLink, {
27
28
  }
28
29
  }
29
30
  });
30
- export const LicenseLink = _ref => {
31
+ export const LicenseLink = /*#__PURE__*/forwardRef((_ref, ref) => {
31
32
  let {
32
33
  license,
33
- hideLink
34
+ hideLink,
35
+ ...rest
34
36
  } = _ref;
35
37
  const disabled = hideLink ? {
36
38
  "data-disabled": ""
@@ -43,10 +45,12 @@ export const LicenseLink = _ref => {
43
45
  to: license.url,
44
46
  rel: "license",
45
47
  ...disabled,
48
+ ...rest,
49
+ ref: ref,
46
50
  children: license.abbreviation
47
51
  });
48
52
  }
49
53
  return /*#__PURE__*/_jsx("span", {
50
54
  children: license.abbreviation
51
55
  });
52
- };
56
+ });
@@ -5,10 +5,12 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
+ /// <reference types="react" />
8
9
  import { LicenseLocaleType } from "@ndla/licenses";
9
- interface Props {
10
+ import { SafeLinkProps } from "@ndla/safelink";
11
+ interface Props extends Omit<SafeLinkProps, "to"> {
10
12
  license: LicenseLocaleType;
11
13
  hideLink?: boolean;
12
14
  }
13
- export declare const LicenseLink: ({ license, hideLink }: Props) => import("react/jsx-runtime").JSX.Element | null;
15
+ export declare const LicenseLink: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
14
16
  export {};
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.LicenseLink = void 0;
7
+ var _react = require("react");
7
8
  var _safelink = require("@ndla/safelink");
8
9
  var _jsx2 = require("@ndla/styled-system/jsx");
9
10
  var _jsxRuntime = require("react/jsx-runtime");
@@ -33,10 +34,11 @@ const StyledSafeLink = (0, _jsx2.styled)(_safelink.SafeLink, {
33
34
  }
34
35
  }
35
36
  });
36
- const LicenseLink = _ref => {
37
+ const LicenseLink = exports.LicenseLink = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
37
38
  let {
38
39
  license,
39
- hideLink
40
+ hideLink,
41
+ ...rest
40
42
  } = _ref;
41
43
  const disabled = hideLink ? {
42
44
  "data-disabled": ""
@@ -49,11 +51,12 @@ const LicenseLink = _ref => {
49
51
  to: license.url,
50
52
  rel: "license",
51
53
  ...disabled,
54
+ ...rest,
55
+ ref: ref,
52
56
  children: license.abbreviation
53
57
  });
54
58
  }
55
59
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
56
60
  children: license.abbreviation
57
61
  });
58
- };
59
- exports.LicenseLink = LicenseLink;
62
+ });
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.43-alpha.0",
3
+ "version": "56.0.45-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.28-alpha.0",
37
37
  "@ndla/licenses": "^8.0.3-alpha.0",
38
- "@ndla/primitives": "^1.0.39-alpha.0",
39
- "@ndla/safelink": "^7.0.39-alpha.0",
38
+ "@ndla/primitives": "^1.0.40-alpha.0",
39
+ "@ndla/safelink": "^7.0.40-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": "90fba8b86f3dcb8b52dfe9e5a6cc2722f55aa843"
61
+ "gitHead": "e79c68709bfa94d73a608d460f271f41f9f04e09"
62
62
  }
@@ -6,11 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
+ import { forwardRef } from "react";
9
10
  import { LicenseLocaleType } from "@ndla/licenses";
10
- import { SafeLink } from "@ndla/safelink";
11
+ import { SafeLink, SafeLinkProps } from "@ndla/safelink";
11
12
  import { styled } from "@ndla/styled-system/jsx";
12
13
 
13
- interface Props {
14
+ interface Props extends Omit<SafeLinkProps, "to"> {
14
15
  license: LicenseLocaleType;
15
16
  hideLink?: boolean;
16
17
  }
@@ -34,17 +35,17 @@ const StyledSafeLink = styled(SafeLink, {
34
35
  },
35
36
  });
36
37
 
37
- export const LicenseLink = ({ license, hideLink }: Props) => {
38
+ export const LicenseLink = forwardRef<HTMLAnchorElement, Props>(({ license, hideLink, ...rest }, ref) => {
38
39
  const disabled = hideLink ? { "data-disabled": "" } : {};
39
40
  if (license.abbreviation === "unknown") {
40
41
  return null;
41
42
  }
42
43
  if (license.url?.length) {
43
44
  return (
44
- <StyledSafeLink to={license.url} rel="license" {...disabled}>
45
+ <StyledSafeLink to={license.url} rel="license" {...disabled} {...rest} ref={ref}>
45
46
  {license.abbreviation}
46
47
  </StyledSafeLink>
47
48
  );
48
49
  }
49
50
  return <span>{license.abbreviation}</span>;
50
- };
51
+ });
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,