@ndla/safelink 5.1.15 → 6.0.0-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/dist/panda.buildinfo.json +7 -0
- package/dist/styles.css +0 -0
- package/es/MissingRouterContext.js +1 -2
- package/es/SafeLink.js +16 -20
- package/es/SafeLinkButton.js +17 -28
- package/es/SafeLinkIconButton.js +13 -21
- package/es/index.js +4 -4
- package/lib/MissingRouterContext.d.ts +1 -2
- package/lib/MissingRouterContext.js +2 -3
- package/lib/SafeLink.d.ts +4 -3
- package/lib/SafeLink.js +18 -23
- package/lib/SafeLinkButton.d.ts +3 -6
- package/lib/SafeLinkButton.js +18 -31
- package/lib/SafeLinkIconButton.d.ts +4 -5
- package/lib/SafeLinkIconButton.js +14 -24
- package/lib/index.d.ts +6 -4
- package/lib/index.js +8 -9
- package/package.json +13 -9
package/dist/styles.css
ADDED
|
File without changes
|
package/es/SafeLink.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _styled from "@emotion/styled/base";
|
|
2
1
|
/**
|
|
3
2
|
* Copyright (c) 2019-present, NDLA.
|
|
4
3
|
*
|
|
@@ -9,20 +8,19 @@ import _styled from "@emotion/styled/base";
|
|
|
9
8
|
|
|
10
9
|
import { forwardRef, useContext } from "react";
|
|
11
10
|
import { Link } from "react-router-dom";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
11
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
12
|
+
import { MissingRouterContext } from "./MissingRouterContext";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
14
|
const oldNdlaRegex = /(.*)\/?node\/(\d+).*/;
|
|
17
15
|
const isExternalLink = to => typeof to === "string" && (to.startsWith("https://") || to.startsWith("http://") || to.startsWith("mailto:") || to.endsWith(".xml"));
|
|
18
16
|
export const isOldNdlaLink = to => typeof to === "string" && to.match(oldNdlaRegex) !== null;
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
const StyledLink = styled(Link, {}, {
|
|
18
|
+
baseComponent: true
|
|
19
|
+
});
|
|
20
|
+
|
|
23
21
|
// Fallback to normal link if app is missing RouterContext, link is external or is old ndla link
|
|
24
22
|
|
|
25
|
-
const SafeLink = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
23
|
+
export const SafeLink = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
26
24
|
let {
|
|
27
25
|
to,
|
|
28
26
|
replace,
|
|
@@ -36,28 +34,26 @@ const SafeLink = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
36
34
|
const isMissingRouterContext = useContext(MissingRouterContext);
|
|
37
35
|
if (isMissingRouterContext || isExternalLink(to) || isOldNdlaLink(to) || asAnchor || disabled) {
|
|
38
36
|
const href = typeof to === "string" ? to : "#";
|
|
39
|
-
return
|
|
37
|
+
return /*#__PURE__*/_jsx(styled.a, {
|
|
40
38
|
href: disabled ? undefined : href,
|
|
41
39
|
role: disabled ? "link" : undefined,
|
|
42
40
|
"aria-disabled": disabled,
|
|
43
41
|
ref: ref,
|
|
44
42
|
tabIndex: tabIndex,
|
|
45
43
|
...rest,
|
|
46
|
-
children:
|
|
47
|
-
size: "medium"
|
|
48
|
-
})]
|
|
44
|
+
children: children
|
|
49
45
|
});
|
|
50
46
|
}
|
|
51
47
|
return (
|
|
48
|
+
/*#__PURE__*/
|
|
52
49
|
// RR6 link immediately fails if to is somehow undefined, so we provide an empty fallback to recover.
|
|
53
|
-
|
|
50
|
+
_jsx(StyledLink, {
|
|
54
51
|
ref: ref,
|
|
55
|
-
tabIndex: tabIndex
|
|
56
|
-
to: to
|
|
52
|
+
tabIndex: tabIndex ?? 0,
|
|
53
|
+
to: to ?? "",
|
|
57
54
|
replace: replace,
|
|
58
55
|
...rest,
|
|
59
|
-
children:
|
|
56
|
+
children: children
|
|
60
57
|
})
|
|
61
58
|
);
|
|
62
|
-
});
|
|
63
|
-
export default SafeLink;
|
|
59
|
+
});
|
package/es/SafeLinkButton.js
CHANGED
|
@@ -6,36 +6,25 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
/** @jsxImportSource @emotion/react */
|
|
10
9
|
import { forwardRef } from "react";
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
|
|
10
|
+
import { buttonBaseRecipe, buttonRecipe } from "@ndla/primitives";
|
|
11
|
+
import { css } from "@ndla/styled-system/css";
|
|
12
|
+
import { SafeLink } from "./SafeLink";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
export const SafeLinkButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
15
15
|
let {
|
|
16
|
-
children,
|
|
17
|
-
inverted,
|
|
18
|
-
to,
|
|
19
|
-
size,
|
|
20
|
-
colorTheme,
|
|
21
16
|
variant,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
...
|
|
17
|
+
size,
|
|
18
|
+
css: cssProp,
|
|
19
|
+
...props
|
|
25
20
|
} = _ref;
|
|
26
|
-
return _jsx(SafeLink, {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
size
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
shape,
|
|
35
|
-
fontWeight
|
|
36
|
-
}),
|
|
37
|
-
...rest,
|
|
38
|
-
children: children
|
|
21
|
+
return /*#__PURE__*/_jsx(SafeLink, {
|
|
22
|
+
...props,
|
|
23
|
+
css: css.raw(buttonBaseRecipe.raw({
|
|
24
|
+
variant
|
|
25
|
+
}), buttonRecipe.raw({
|
|
26
|
+
size
|
|
27
|
+
}), cssProp),
|
|
28
|
+
ref: ref
|
|
39
29
|
});
|
|
40
|
-
});
|
|
41
|
-
export default SafeLinkButton;
|
|
30
|
+
});
|
package/es/SafeLinkIconButton.js
CHANGED
|
@@ -6,30 +6,22 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
/** @jsxImportSource @emotion/react */
|
|
10
9
|
import { forwardRef } from "react";
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
|
|
10
|
+
import { buttonBaseRecipe, iconButtonRecipe } from "@ndla/primitives";
|
|
11
|
+
import { css } from "@ndla/styled-system/css";
|
|
12
|
+
import { SafeLink } from "./SafeLink";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
export const SafeLinkIconButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
15
15
|
let {
|
|
16
|
-
inverted,
|
|
17
|
-
size,
|
|
18
|
-
colorTheme,
|
|
19
16
|
variant,
|
|
20
|
-
|
|
21
|
-
...
|
|
17
|
+
css: cssProp,
|
|
18
|
+
...props
|
|
22
19
|
} = _ref;
|
|
23
|
-
return _jsx(SafeLink, {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
inverted,
|
|
29
|
-
fontWeight
|
|
30
|
-
}),
|
|
31
|
-
...rest,
|
|
20
|
+
return /*#__PURE__*/_jsx(SafeLink, {
|
|
21
|
+
...props,
|
|
22
|
+
css: css.raw(buttonBaseRecipe.raw({
|
|
23
|
+
variant
|
|
24
|
+
}), iconButtonRecipe.raw(), cssProp),
|
|
32
25
|
ref: ref
|
|
33
26
|
});
|
|
34
|
-
});
|
|
35
|
-
export default SafeLinkIconButton;
|
|
27
|
+
});
|
package/es/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
9
|
+
export { MissingRouterContext } from "./MissingRouterContext";
|
|
10
|
+
export { SafeLinkButton } from "./SafeLinkButton";
|
|
11
|
+
export { SafeLinkIconButton } from "./SafeLinkIconButton";
|
|
12
|
+
export { SafeLink } from "./SafeLink";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.MissingRouterContext = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
/**
|
|
9
9
|
* Copyright (c) 2019-present, NDLA.
|
|
@@ -13,5 +13,4 @@ var _react = require("react");
|
|
|
13
13
|
*
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
const MissingRouterContext = /*#__PURE__*/(0, _react.createContext)(false);
|
|
17
|
-
var _default = exports.default = MissingRouterContext;
|
|
16
|
+
const MissingRouterContext = exports.MissingRouterContext = /*#__PURE__*/(0, _react.createContext)(false);
|
package/lib/SafeLink.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { HTMLAttributes, MutableRefObject, ReactNode } from "react";
|
|
9
9
|
import { LinkProps } from "react-router-dom";
|
|
10
|
+
import { JsxStyleProps } from "@ndla/styled-system/types";
|
|
10
11
|
export declare const isOldNdlaLink: (to?: LinkProps["to"]) => boolean;
|
|
11
12
|
type Props = {
|
|
12
13
|
showNewWindowIcon?: boolean;
|
|
@@ -15,6 +16,6 @@ type Props = {
|
|
|
15
16
|
children?: ReactNode;
|
|
16
17
|
disabled?: boolean;
|
|
17
18
|
};
|
|
18
|
-
export type SafeLinkProps = Props & LinkProps & HTMLAttributes<HTMLElement>;
|
|
19
|
-
declare const SafeLink: import("react").ForwardRefExoticComponent<Omit<SafeLinkProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
20
|
-
export
|
|
19
|
+
export type SafeLinkProps = Props & LinkProps & JsxStyleProps & HTMLAttributes<HTMLElement>;
|
|
20
|
+
export declare const SafeLink: import("react").ForwardRefExoticComponent<Omit<SafeLinkProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
21
|
+
export {};
|
package/lib/SafeLink.js
CHANGED
|
@@ -3,15 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isOldNdlaLink = exports.
|
|
7
|
-
var _base = _interopRequireDefault(require("@emotion/styled/base"));
|
|
6
|
+
exports.isOldNdlaLink = exports.SafeLink = void 0;
|
|
8
7
|
var _react = require("react");
|
|
9
8
|
var _reactRouterDom = require("react-router-dom");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
14
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
10
|
+
var _MissingRouterContext = require("./MissingRouterContext");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
12
|
/**
|
|
16
13
|
* Copyright (c) 2019-present, NDLA.
|
|
17
14
|
*
|
|
@@ -24,13 +21,13 @@ const oldNdlaRegex = /(.*)\/?node\/(\d+).*/;
|
|
|
24
21
|
const isExternalLink = to => typeof to === "string" && (to.startsWith("https://") || to.startsWith("http://") || to.startsWith("mailto:") || to.endsWith(".xml"));
|
|
25
22
|
const isOldNdlaLink = to => typeof to === "string" && to.match(oldNdlaRegex) !== null;
|
|
26
23
|
exports.isOldNdlaLink = isOldNdlaLink;
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
const StyledLink = (0, _jsx2.styled)(_reactRouterDom.Link, {}, {
|
|
25
|
+
baseComponent: true
|
|
26
|
+
});
|
|
27
|
+
|
|
31
28
|
// Fallback to normal link if app is missing RouterContext, link is external or is old ndla link
|
|
32
29
|
|
|
33
|
-
const SafeLink = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
30
|
+
const SafeLink = exports.SafeLink = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
34
31
|
let {
|
|
35
32
|
to,
|
|
36
33
|
replace,
|
|
@@ -41,31 +38,29 @@ const SafeLink = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
41
38
|
asAnchor,
|
|
42
39
|
...rest
|
|
43
40
|
} = _ref;
|
|
44
|
-
const isMissingRouterContext = (0, _react.useContext)(_MissingRouterContext.
|
|
41
|
+
const isMissingRouterContext = (0, _react.useContext)(_MissingRouterContext.MissingRouterContext);
|
|
45
42
|
if (isMissingRouterContext || isExternalLink(to) || isOldNdlaLink(to) || asAnchor || disabled) {
|
|
46
43
|
const href = typeof to === "string" ? to : "#";
|
|
47
|
-
return (0, _jsxRuntime.
|
|
44
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsx2.styled.a, {
|
|
48
45
|
href: disabled ? undefined : href,
|
|
49
46
|
role: disabled ? "link" : undefined,
|
|
50
47
|
"aria-disabled": disabled,
|
|
51
48
|
ref: ref,
|
|
52
49
|
tabIndex: tabIndex,
|
|
53
50
|
...rest,
|
|
54
|
-
children:
|
|
55
|
-
size: "medium"
|
|
56
|
-
})]
|
|
51
|
+
children: children
|
|
57
52
|
});
|
|
58
53
|
}
|
|
59
54
|
return (
|
|
55
|
+
/*#__PURE__*/
|
|
60
56
|
// RR6 link immediately fails if to is somehow undefined, so we provide an empty fallback to recover.
|
|
61
|
-
(0, _jsxRuntime.
|
|
57
|
+
(0, _jsxRuntime.jsx)(StyledLink, {
|
|
62
58
|
ref: ref,
|
|
63
|
-
tabIndex: tabIndex
|
|
64
|
-
to: to
|
|
59
|
+
tabIndex: tabIndex ?? 0,
|
|
60
|
+
to: to ?? "",
|
|
65
61
|
replace: replace,
|
|
66
62
|
...rest,
|
|
67
|
-
children:
|
|
63
|
+
children: children
|
|
68
64
|
})
|
|
69
65
|
);
|
|
70
|
-
});
|
|
71
|
-
var _default = exports.default = SafeLink;
|
|
66
|
+
});
|
package/lib/SafeLinkButton.d.ts
CHANGED
|
@@ -5,14 +5,11 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
/** @jsxImportSource @emotion/react */
|
|
9
8
|
import { ReactNode } from "react";
|
|
10
|
-
import {
|
|
9
|
+
import { ButtonVariantProps } from "@ndla/primitives";
|
|
11
10
|
import { SafeLinkProps } from "./SafeLink";
|
|
12
|
-
interface
|
|
11
|
+
export interface SafeLinkButtonProps extends SafeLinkProps, ButtonVariantProps {
|
|
13
12
|
children: ReactNode;
|
|
14
13
|
to: string;
|
|
15
|
-
className?: string;
|
|
16
14
|
}
|
|
17
|
-
declare const SafeLinkButton: import("react").ForwardRefExoticComponent<Omit<
|
|
18
|
-
export default SafeLinkButton;
|
|
15
|
+
export declare const SafeLinkButton: import("react").ForwardRefExoticComponent<Omit<SafeLinkButtonProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
package/lib/SafeLinkButton.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.SafeLinkButton = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
8
|
+
var _primitives = require("@ndla/primitives");
|
|
9
|
+
var _css = require("@ndla/styled-system/css");
|
|
10
|
+
var _SafeLink = require("./SafeLink");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
/**
|
|
13
13
|
* Copyright (c) 2019-present, NDLA.
|
|
14
14
|
*
|
|
@@ -17,33 +17,20 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const SafeLinkButton = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
20
|
+
const SafeLinkButton = exports.SafeLinkButton = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
23
21
|
let {
|
|
24
|
-
children,
|
|
25
|
-
inverted,
|
|
26
|
-
to,
|
|
27
|
-
size,
|
|
28
|
-
colorTheme,
|
|
29
22
|
variant,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
...
|
|
23
|
+
size,
|
|
24
|
+
css: cssProp,
|
|
25
|
+
...props
|
|
33
26
|
} = _ref;
|
|
34
|
-
return (0, _jsxRuntime.jsx)(_SafeLink.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
size
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
shape,
|
|
43
|
-
fontWeight
|
|
44
|
-
}),
|
|
45
|
-
...rest,
|
|
46
|
-
children: children
|
|
27
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SafeLink.SafeLink, {
|
|
28
|
+
...props,
|
|
29
|
+
css: _css.css.raw(_primitives.buttonBaseRecipe.raw({
|
|
30
|
+
variant
|
|
31
|
+
}), _primitives.buttonRecipe.raw({
|
|
32
|
+
size
|
|
33
|
+
}), cssProp),
|
|
34
|
+
ref: ref
|
|
47
35
|
});
|
|
48
|
-
});
|
|
49
|
-
var _default = exports.default = SafeLinkButton;
|
|
36
|
+
});
|
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
/** @jsxImportSource @emotion/react */
|
|
9
8
|
import { ReactNode } from "react";
|
|
10
|
-
import {
|
|
9
|
+
import { IconButtonVariantProps } from "@ndla/primitives";
|
|
11
10
|
import { SafeLinkProps } from "./SafeLink";
|
|
12
|
-
interface
|
|
11
|
+
export interface SafeLinkIconButtonProps extends SafeLinkProps, IconButtonVariantProps {
|
|
13
12
|
children: ReactNode;
|
|
13
|
+
to: string;
|
|
14
14
|
}
|
|
15
|
-
declare const SafeLinkIconButton: import("react").ForwardRefExoticComponent<Omit<
|
|
16
|
-
export default SafeLinkIconButton;
|
|
15
|
+
export declare const SafeLinkIconButton: import("react").ForwardRefExoticComponent<Omit<SafeLinkIconButtonProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.SafeLinkIconButton = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
8
|
+
var _primitives = require("@ndla/primitives");
|
|
9
|
+
var _css = require("@ndla/styled-system/css");
|
|
10
|
+
var _SafeLink = require("./SafeLink");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
/**
|
|
13
13
|
* Copyright (c) 2022-present, NDLA.
|
|
14
14
|
*
|
|
@@ -17,27 +17,17 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const SafeLinkIconButton = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
20
|
+
const SafeLinkIconButton = exports.SafeLinkIconButton = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
23
21
|
let {
|
|
24
|
-
inverted,
|
|
25
|
-
size,
|
|
26
|
-
colorTheme,
|
|
27
22
|
variant,
|
|
28
|
-
|
|
29
|
-
...
|
|
23
|
+
css: cssProp,
|
|
24
|
+
...props
|
|
30
25
|
} = _ref;
|
|
31
|
-
return (0, _jsxRuntime.jsx)(_SafeLink.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
inverted,
|
|
37
|
-
fontWeight
|
|
38
|
-
}),
|
|
39
|
-
...rest,
|
|
26
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SafeLink.SafeLink, {
|
|
27
|
+
...props,
|
|
28
|
+
css: _css.css.raw(_primitives.buttonBaseRecipe.raw({
|
|
29
|
+
variant
|
|
30
|
+
}), _primitives.iconButtonRecipe.raw(), cssProp),
|
|
40
31
|
ref: ref
|
|
41
32
|
});
|
|
42
|
-
});
|
|
43
|
-
var _default = exports.default = SafeLinkIconButton;
|
|
33
|
+
});
|
package/lib/index.d.ts
CHANGED
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
8
|
+
export { MissingRouterContext } from "./MissingRouterContext";
|
|
9
|
+
export { SafeLinkButton } from "./SafeLinkButton";
|
|
10
|
+
export type { SafeLinkIconButtonProps } from "./SafeLinkIconButton";
|
|
11
|
+
export { SafeLinkIconButton } from "./SafeLinkIconButton";
|
|
12
|
+
export type { SafeLinkButtonProps } from "./SafeLinkButton";
|
|
13
|
+
export { SafeLink } from "./SafeLink";
|
|
12
14
|
export type { SafeLinkProps } from "./SafeLink";
|
package/lib/index.js
CHANGED
|
@@ -6,29 +6,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "MissingRouterContext", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return _MissingRouterContext.
|
|
9
|
+
return _MissingRouterContext.MissingRouterContext;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "SafeLink", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return _SafeLink.
|
|
15
|
+
return _SafeLink.SafeLink;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "SafeLinkButton", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function () {
|
|
21
|
-
return _SafeLinkButton.
|
|
21
|
+
return _SafeLinkButton.SafeLinkButton;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "SafeLinkIconButton", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
get: function () {
|
|
27
|
-
return _SafeLinkIconButton.
|
|
27
|
+
return _SafeLinkIconButton.SafeLinkIconButton;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
var _MissingRouterContext =
|
|
31
|
-
var _SafeLinkButton =
|
|
32
|
-
var _SafeLinkIconButton =
|
|
33
|
-
var _SafeLink =
|
|
34
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
30
|
+
var _MissingRouterContext = require("./MissingRouterContext");
|
|
31
|
+
var _SafeLinkButton = require("./SafeLinkButton");
|
|
32
|
+
var _SafeLinkIconButton = require("./SafeLinkIconButton");
|
|
33
|
+
var _SafeLink = require("./SafeLink");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/safelink",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-alpha.0",
|
|
4
4
|
"description": "SafeLink component for NDLA",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "node ../../scripts/build.js package",
|
|
11
11
|
"build:types": "tsc -p tsconfig.build.json",
|
|
12
|
-
"
|
|
12
|
+
"build:panda": "mkdir -p dist && concurrently 'panda cssgen --minimal --outfile dist/styles.css' 'panda ship --outfile dist/panda.buildinfo.json'",
|
|
13
|
+
"prepublish": "concurrently 'yarn build:types' 'yarn build:panda'"
|
|
13
14
|
},
|
|
14
15
|
"repository": {
|
|
15
16
|
"type": "git",
|
|
@@ -21,22 +22,25 @@
|
|
|
21
22
|
],
|
|
22
23
|
"author": "ndla@knowit.no",
|
|
23
24
|
"files": [
|
|
24
|
-
"
|
|
25
|
+
"dist",
|
|
25
26
|
"lib",
|
|
26
27
|
"es"
|
|
27
28
|
],
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@ndla/
|
|
30
|
-
"@ndla/
|
|
30
|
+
"@ndla/primitives": "^0.0.17",
|
|
31
|
+
"@ndla/styled-system": "^0.0.8"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@ndla/preset-panda": "^0.0.10",
|
|
35
|
+
"@pandacss/dev": "^0.42.0"
|
|
31
36
|
},
|
|
32
37
|
"peerDependencies": {
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"react": ">= 16.8.0",
|
|
38
|
+
"react": ">= 18",
|
|
39
|
+
"react-dom": ">= 18",
|
|
36
40
|
"react-router-dom": "^6.3.0"
|
|
37
41
|
},
|
|
38
42
|
"publishConfig": {
|
|
39
43
|
"access": "public"
|
|
40
44
|
},
|
|
41
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "93dde6fe4aaca52642f8fa0a27f4acad359207cb"
|
|
42
46
|
}
|