@veracity/vui 2.29.0 → 2.29.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veracity/vui",
3
- "version": "2.29.0",
3
+ "version": "2.29.1",
4
4
  "description": "Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.",
5
5
  "module": "./dist/esm/index.js",
6
6
  "main": "./dist/cjs/index.js",
@@ -51,4 +51,4 @@
51
51
  "dist",
52
52
  "src"
53
53
  ]
54
- }
54
+ }
package/src/link/link.tsx CHANGED
@@ -8,33 +8,46 @@ import { LinkProps } from './link.types'
8
8
  import LinkIcon from './linkIcon'
9
9
  import LinkText from './linkText'
10
10
 
11
+ const linkSwipeAnimation = `
12
+ @keyframes linkSwipe {
13
+ from {
14
+ background-size: 0 1px;
15
+ }
16
+ to {
17
+ background-size: 100% 1px;
18
+ }
19
+ }
20
+ `
21
+
11
22
  export const LinkBase = styled.aBox.attrs((props: LinkProps) => ({
12
23
  isUnderlined: props.isUnderlined || false,
13
24
  }))`
14
- align-items: center;
15
- border-radius: none;
25
+ ${linkSwipeAnimation}
26
+ display: inline;
16
27
  cursor: pointer;
17
- display: inline-flex;
18
- line-height: normal;
28
+ position: relative;
29
+ line-height: 1.5;
19
30
  outline: none;
20
31
  width: fit-content;
32
+ text-decoration: none;
21
33
 
22
- &:not(.vui-listItemLink) > span {
23
- text-decoration-line: ${props => (props.isUnderlined ? 'underline' : 'none')};
24
- text-decoration-thickness: 1px;
25
- text-underline-offset: 2px;
34
+ &:not(.vui-linkNoUnderline) span {
35
+ position: relative;
36
+ background: linear-gradient(to right, currentcolor, currentcolor);
37
+ background-size: ${({ isUnderlined }) => (isUnderlined ? '100% 1px' : '0 1px')};
38
+ background-position: 0 100%;
39
+ background-repeat: no-repeat;
40
+ text-decoration: none;
41
+ padding-bottom: 2px;
42
+ line-height: 1;
26
43
  }
27
44
 
28
- &:not(.vui-listItemLink) > span:hover {
29
- text-decoration-line: underline;
30
- text-decoration-thickness: ${props => (props.isUnderlined ? '2px' : '1px')};
45
+ &:hover span {
46
+ animation: linkSwipe 0.3s ease forwards;
47
+ background-size: 100% 1px;
31
48
  }
32
49
  `
33
50
 
34
- /**
35
- * Displays a link item. Handles different underline scenarios and opening external links in new tab.
36
- * Exposes some props to the children via context.
37
- */
38
51
  export const Link = vui<'a', LinkProps>((props, ref) => {
39
52
  const {
40
53
  children,
@@ -63,7 +76,9 @@ export const Link = vui<'a', LinkProps>((props, ref) => {
63
76
  return (
64
77
  <LinkProvider value={context}>
65
78
  <LinkBase
79
+ alignItems={iconLeft || iconRight ? 'center' : undefined}
66
80
  className={cs('vui-link', className)}
81
+ display={iconLeft || iconRight ? 'inline-flex' : 'inline'}
67
82
  focusRing={2}
68
83
  isUnderlined={isUnderlined}
69
84
  ref={ref}
@@ -12,7 +12,7 @@ import ListText from './listText'
12
12
  const ListItemLink = vui<'a', LinkProps>((props, ref) => (
13
13
  <Link
14
14
  borderRadius="none"
15
- className="vui-listItemLink"
15
+ className="vui-listItemLink vui-linkNoUnderline"
16
16
  h="100%"
17
17
  px={2}
18
18
  ref={ref}