@availity/mui-link 0.2.9 → 0.3.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/CHANGELOG.md +7 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -5
- package/dist/index.mjs +4 -5
- package/package.json +1 -1
- package/src/lib/Link.stories.tsx +29 -2
- package/src/lib/Link.tsx +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.3.0](https://github.com/Availity/element/compare/@availity/mui-link@0.2.9...@availity/mui-link@0.3.0) (2024-05-02)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **mui-link:** inline link styles ([7ee4587](https://github.com/Availity/element/commit/7ee458780be5cbb5ca97595aa7bf8bb7e3c36423))
|
|
11
|
+
|
|
5
12
|
## [0.2.9](https://github.com/Availity/element/compare/@availity/mui-link@0.2.8...@availity/mui-link@0.2.9) (2024-04-19)
|
|
6
13
|
|
|
7
14
|
### Dependency Updates
|
package/dist/index.d.mts
CHANGED
|
@@ -15,7 +15,7 @@ type LinkProps = {
|
|
|
15
15
|
onClick?: (event: React.MouseEvent, url: string) => void;
|
|
16
16
|
children?: ReactNode;
|
|
17
17
|
rel?: string;
|
|
18
|
-
} & Omit<LinkProps$1, 'underline' | 'noWrap' | 'variantMapping'
|
|
18
|
+
} & Omit<LinkProps$1, 'underline' | 'noWrap' | 'variantMapping'>;
|
|
19
19
|
declare const Link: react.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & react.RefAttributes<HTMLAnchorElement>>;
|
|
20
20
|
|
|
21
21
|
export { Link, type LinkProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ type LinkProps = {
|
|
|
15
15
|
onClick?: (event: React.MouseEvent, url: string) => void;
|
|
16
16
|
children?: ReactNode;
|
|
17
17
|
rel?: string;
|
|
18
|
-
} & Omit<LinkProps$1, 'underline' | 'noWrap' | 'variantMapping'
|
|
18
|
+
} & Omit<LinkProps$1, 'underline' | 'noWrap' | 'variantMapping'>;
|
|
19
19
|
declare const Link: react.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & react.RefAttributes<HTMLAnchorElement>>;
|
|
20
20
|
|
|
21
21
|
export { Link, type LinkProps };
|
package/dist/index.js
CHANGED
|
@@ -105,14 +105,13 @@ var Link = (0, import_react.forwardRef)((props, ref) => {
|
|
|
105
105
|
href: url,
|
|
106
106
|
target,
|
|
107
107
|
onClick: (event) => onClick && onClick(event, url),
|
|
108
|
-
rel: rel || setRel(url, target, absolute)
|
|
109
|
-
underline: "hover"
|
|
108
|
+
rel: rel || setRel(url, target, absolute)
|
|
110
109
|
}, rest), {
|
|
111
110
|
ref,
|
|
112
111
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
113
|
-
|
|
114
|
-
"
|
|
115
|
-
|
|
112
|
+
NewWindowIcon,
|
|
113
|
+
" ",
|
|
114
|
+
children
|
|
116
115
|
] })
|
|
117
116
|
})
|
|
118
117
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -72,14 +72,13 @@ var Link = forwardRef((props, ref) => {
|
|
|
72
72
|
href: url,
|
|
73
73
|
target,
|
|
74
74
|
onClick: (event) => onClick && onClick(event, url),
|
|
75
|
-
rel: rel || setRel(url, target, absolute)
|
|
76
|
-
underline: "hover"
|
|
75
|
+
rel: rel || setRel(url, target, absolute)
|
|
77
76
|
}, rest), {
|
|
78
77
|
ref,
|
|
79
78
|
children: /* @__PURE__ */ jsxs("span", { children: [
|
|
80
|
-
|
|
81
|
-
"
|
|
82
|
-
|
|
79
|
+
NewWindowIcon,
|
|
80
|
+
" ",
|
|
81
|
+
children
|
|
83
82
|
] })
|
|
84
83
|
})
|
|
85
84
|
);
|
package/package.json
CHANGED
package/src/lib/Link.stories.tsx
CHANGED
|
@@ -3,6 +3,8 @@ import type { Meta, StoryObj } from '@storybook/react';
|
|
|
3
3
|
import { SystemPropsList } from '../../../../data/MuiSystemProperties';
|
|
4
4
|
import { Link, LinkProps } from './Link';
|
|
5
5
|
|
|
6
|
+
const excludedProps = [...SystemPropsList, "align"]
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
9
|
* Simple link component that renders an `<a>` tag with the href formatted to leverage loadApp so the link gets loaded inside the home page's iframe
|
|
8
10
|
*
|
|
@@ -15,12 +17,12 @@ const meta: Meta<typeof Link> = {
|
|
|
15
17
|
parameters: {
|
|
16
18
|
docs: {
|
|
17
19
|
controls: {
|
|
18
|
-
exclude:
|
|
20
|
+
exclude: excludedProps,
|
|
19
21
|
},
|
|
20
22
|
},
|
|
21
23
|
canvas: {
|
|
22
24
|
controls: {
|
|
23
|
-
exclude:
|
|
25
|
+
exclude: excludedProps,
|
|
24
26
|
},
|
|
25
27
|
},
|
|
26
28
|
},
|
|
@@ -39,6 +41,17 @@ export const _Link: StoryObj<typeof Link> = {
|
|
|
39
41
|
},
|
|
40
42
|
};
|
|
41
43
|
|
|
44
|
+
/** Inline styling is achieved with the `inherit` variant. */
|
|
45
|
+
export const _Variants: StoryObj<typeof Link> = {
|
|
46
|
+
render: () => (
|
|
47
|
+
<div>
|
|
48
|
+
<Link href='#' gutterBottom>Medium standalone link (default)</Link><br />
|
|
49
|
+
<Link href='#' gutterBottom variant="body2">Small standalone link</Link><br />
|
|
50
|
+
<Link href='#' gutterBottom variant="inherit">Inline link</Link>
|
|
51
|
+
</div>
|
|
52
|
+
),
|
|
53
|
+
};
|
|
54
|
+
|
|
42
55
|
/** The `OpenInNewIcon` has an accessible name to tell screenreaders that it opens in a new window. */
|
|
43
56
|
export const _NewWindow: StoryObj<typeof Link> = {
|
|
44
57
|
render: (args: LinkProps) => <Link {...args} loadApp={false} target="_blank" />,
|
|
@@ -61,3 +74,17 @@ export const _RelativeUrl: StoryObj<typeof Link> = {
|
|
|
61
74
|
children: 'Portal App',
|
|
62
75
|
},
|
|
63
76
|
};
|
|
77
|
+
|
|
78
|
+
/** The `gutterBottom` prop achieves correct spacing for a list of links. */
|
|
79
|
+
export const _Lists: StoryObj<typeof Link> = {
|
|
80
|
+
render: () => (
|
|
81
|
+
<div>
|
|
82
|
+
<Link href='#' gutterBottom>Link 1</Link><br />
|
|
83
|
+
<Link href='#' gutterBottom>Link 2</Link><br />
|
|
84
|
+
<Link href='#' gutterBottom>Link 3</Link><br />
|
|
85
|
+
<Link href='#' gutterBottom>Link 4</Link><br />
|
|
86
|
+
<Link href='#' gutterBottom>Link 5</Link><br />
|
|
87
|
+
<Link href='#' gutterBottom>Link 6</Link><br />
|
|
88
|
+
</div>
|
|
89
|
+
),
|
|
90
|
+
};
|
package/src/lib/Link.tsx
CHANGED
|
@@ -53,7 +53,7 @@ export type LinkProps = {
|
|
|
53
53
|
onClick?: (event: React.MouseEvent, url: string) => void;
|
|
54
54
|
children?: ReactNode;
|
|
55
55
|
rel?: string;
|
|
56
|
-
} & Omit<MuiLinkProps, 'underline' | 'noWrap' | 'variantMapping'
|
|
56
|
+
} & Omit<MuiLinkProps, 'underline' | 'noWrap' | 'variantMapping' >;
|
|
57
57
|
|
|
58
58
|
export const Link = forwardRef<HTMLAnchorElement, LinkProps>((props, ref) => {
|
|
59
59
|
const { href, target = '_self', children, onClick, loadApp = true, rel, ...rest } = props;
|
|
@@ -68,12 +68,11 @@ export const Link = forwardRef<HTMLAnchorElement, LinkProps>((props, ref) => {
|
|
|
68
68
|
target={target}
|
|
69
69
|
onClick={(event: React.MouseEvent) => onClick && onClick(event, url)}
|
|
70
70
|
rel={rel || setRel(url, target, absolute)}
|
|
71
|
-
underline="hover"
|
|
72
71
|
{...rest}
|
|
73
72
|
ref={ref}
|
|
74
73
|
>
|
|
75
74
|
<span>
|
|
76
|
-
{
|
|
75
|
+
{NewWindowIcon} {children}
|
|
77
76
|
</span>
|
|
78
77
|
</MuiLink>
|
|
79
78
|
);
|