|
4 | 4 |
|
5 | 5 | %chevron-properties { |
6 | 6 | display: inline-block; |
7 | | - width: $ouds-link-size-icon-medium; |
8 | | - min-width: $ouds-link-size-icon-medium; |
9 | | - height: $ouds-link-size-icon-medium; |
| 7 | + width: var(--#{$prefix}link-icon-size); |
| 8 | + min-width: var(--#{$prefix}link-icon-size); |
| 9 | + height: var(--#{$prefix}link-icon-size); |
10 | 10 | vertical-align: middle; |
11 | 11 | content: ""; |
12 | | - background-color: $ouds-link-color-arrow-enabled; |
| 12 | + background-color: var(--#{$prefix}link-arrow-color); |
13 | 13 | mask: var(--#{$prefix}chevron-icon) center no-repeat; |
14 | | - mask-size: $ouds-link-size-icon-medium; |
| 14 | + mask-size: var(--#{$prefix}link-icon-size); |
15 | 15 | } |
16 | 16 |
|
17 | | -.link, |
18 | | -.link-chevron, |
19 | | -.icon-link { |
20 | | - // scss-docs-start link-css-vars |
21 | | - --#{$prefix}link-color-rgb: #{$ouds-link-color-content-enabled}; |
22 | | - // scss-docs-end link-css-vars |
| 17 | +.link { |
| 18 | + --#{$prefix}link-icon-size: #{$ouds-link-size-icon-medium}; |
| 19 | + --#{$prefix}link-icon-gap: #{$ouds-link-space-column-gap-icon-medium}; |
23 | 20 |
|
| 21 | + @extend a; |
24 | 22 | @include get-font-size("label-large"); |
25 | | - display: inline-block; |
| 23 | + display: inline-flex; |
| 24 | + align-items: center; |
26 | 25 | min-width: $ouds-link-size-min-width-medium; |
27 | 26 | min-height: $ouds-link-size-min-height-medium; |
28 | 27 | padding: $ouds-link-space-padding-block $ouds-link-space-padding-inline; |
29 | | - font-weight: $link-font-weight; |
30 | | - color: var(--#{$prefix}link-color-rgb); |
31 | | - text-decoration: $link-decoration;// OUDS mod |
| 28 | + text-align: start; |
32 | 29 | text-wrap: pretty; |
33 | | - |
34 | | - &:hover { |
35 | | - --#{$prefix}link-color-rgb: #{$ouds-link-color-content-hover}; |
36 | | - |
37 | | - text-decoration: $link-hover-decoration; |
| 30 | + background: transparent; |
| 31 | + border: 0; |
| 32 | + |
| 33 | + svg, |
| 34 | + img, |
| 35 | + .icon { |
| 36 | + width: 1em; |
| 37 | + height: 1em; |
| 38 | + margin-right: var(--#{$prefix}link-icon-gap); |
| 39 | + overflow: hidden; |
| 40 | + font-size: var(--#{$prefix}link-icon-size); |
| 41 | + line-height: 1; |
38 | 42 | } |
| 43 | +} |
| 44 | + |
| 45 | +.link-chevron { |
| 46 | + --#{$prefix}link-arrow-gap: #{$ouds-link-space-column-gap-arrow-medium}; |
| 47 | + --#{$prefix}link-arrow-color: #{$ouds-link-color-arrow-enabled}; |
| 48 | + --#{$prefix}link-arrow-hover-color: #{$ouds-link-color-arrow-hover}; |
| 49 | + --#{$prefix}link-arrow-focus-color: #{$ouds-link-color-arrow-focus}; |
| 50 | + --#{$prefix}link-arrow-pressed-color: #{$ouds-link-color-arrow-pressed}; |
| 51 | + --#{$prefix}link-arrow-disabled-color: #{$ouds-color-action-disabled}; |
39 | 52 |
|
40 | | - &:focus-visible, |
41 | | - &:focus[data-focus-visible-added] { |
42 | | - --#{$prefix}link-color-rgb: #{$ouds-link-color-content-focus}; |
| 53 | + @extend .link; |
| 54 | + text-decoration: none; |
43 | 55 |
|
44 | | - text-decoration: $link-hover-decoration; |
| 56 | + &:hover::before, |
| 57 | + &:hover::after { |
| 58 | + background-color: var(--#{$prefix}link-arrow-hover-color); |
45 | 59 | } |
46 | 60 |
|
47 | | - &:active { |
48 | | - --#{$prefix}link-color-rgb: #{$ouds-link-color-content-pressed}; |
| 61 | + &:focus-visible::before, |
| 62 | + &:focus[data-focus-visible]::before, |
| 63 | + &:focus-visible::after, |
| 64 | + &:focus[data-focus-visible]::after { |
| 65 | + background-color: var(--#{$prefix}link-arrow-focus-color); |
49 | 66 | } |
50 | 67 |
|
51 | | - &.link-sm{ |
52 | | - @include get-font-size("label-medium"); |
53 | | - min-width: $ouds-link-size-min-width-small; |
54 | | - min-height: $ouds-link-size-min-height-small; |
| 68 | + &:active::before, |
| 69 | + &:active::after { |
| 70 | + background-color: var(--#{$prefix}link-arrow-pressed-color); |
55 | 71 | } |
56 | 72 |
|
57 | | - // OUDS Chevron links |
58 | | - |
59 | | - &.link-chevron { |
60 | | - |
61 | | - &:not(:hover):not(:active):not(:focus) { |
62 | | - text-decoration: none; |
63 | | - } |
64 | | - |
65 | | - // Chevron right is the default position if no class '.back' is added |
66 | | - &:not(.back)::after { |
67 | | - @extend %chevron-properties; |
68 | | - margin-left: $ouds-link-space-column-gap-arrow-medium; |
69 | | - transform: $ouds-link-chevron-after-transform; |
70 | | - } |
71 | | - |
72 | | - // Chevron small size |
73 | | - &.link-sm::after, |
74 | | - &.link-sm::before { |
75 | | - width: $ouds-link-size-icon-small; |
76 | | - min-width: $ouds-link-size-icon-small; |
77 | | - mask-size: $ouds-link-size-icon-small; |
78 | | - } |
79 | | - |
80 | | - // Chevron right margin for small size |
81 | | - &.link-sm::after { |
82 | | - margin-left: $ouds-link-space-column-gap-arrow-small; |
83 | | - } |
84 | | - |
85 | | - // Chevron is set on left side when class '.back' is added |
86 | | - |
87 | | - // Left chevron is aligned with the center of the text link on multiple lines |
88 | | - &.back { |
89 | | - display: inline-flex; |
90 | | - align-items: center; |
91 | | - } |
92 | | - |
93 | | - &.back::before { |
94 | | - @extend %chevron-properties; |
95 | | - margin-right: $ouds-link-space-column-gap-arrow-medium; |
96 | | - } |
97 | | - |
98 | | - // Chevron left margin for small size |
99 | | - &.link-sm::before { |
100 | | - margin-right: $ouds-link-space-column-gap-arrow-small; |
101 | | - } |
102 | | - |
103 | | - // When link is disabled, chevron is styled accordingly |
104 | | - &[aria-disabled="true"] { |
105 | | - &::after, |
106 | | - &::before { |
107 | | - background-color: var(--#{$prefix}color-action-disabled); |
108 | | - } |
109 | | - } |
| 73 | + &[aria-disabled="true"]::before, |
| 74 | + &[aria-disabled="true"]::after { |
| 75 | + background-color: var(--#{$prefix}link-arrow-disabled-color); |
110 | 76 | } |
111 | 77 |
|
112 | | - // OUDS Icon links |
113 | | - |
114 | | - &.icon-link { |
115 | | - display: inline-flex; |
116 | | - gap: $ouds-link-space-column-gap-icon-medium; |
117 | | - align-items: center; |
118 | | - backface-visibility: hidden; |
119 | | - |
120 | | - > .bi { |
121 | | - flex-shrink: 0; |
122 | | - width: $ouds-link-size-icon-medium; |
123 | | - height: $ouds-link-size-icon-medium; |
124 | | - fill: currentcolor; |
125 | | - @include transition($icon-link-icon-transition); |
126 | | - } |
127 | | - |
128 | | - &.link-sm { |
129 | | - gap: $ouds-link-space-column-gap-icon-small; |
130 | | - |
131 | | - > .bi { |
132 | | - width: $ouds-link-size-icon-small; |
133 | | - height: $ouds-link-size-icon-small; |
134 | | - } |
135 | | - } |
| 78 | + &.back::before, |
| 79 | + &:not(.back)::after { |
| 80 | + @extend %chevron-properties; |
| 81 | + margin-right: var(--#{$prefix}link-arrow-gap); |
| 82 | + transform: translateY(-1px); // TODO: RTL |
136 | 83 | } |
137 | 84 |
|
138 | | - &.icon-link-hover { |
139 | | - &:hover, |
140 | | - &:focus-visible { |
141 | | - > .bi { |
142 | | - transform: var(--#{$prefix}icon-link-transform, $icon-link-icon-transform); |
143 | | - } |
144 | | - } |
| 85 | + &:not(.back)::after { |
| 86 | + margin-right: 0; |
| 87 | + margin-left: var(--#{$prefix}link-arrow-gap); |
| 88 | + transform: rotate(180deg) translateY(1px); // TODO: RTL |
145 | 89 | } |
146 | 90 | } |
147 | 91 |
|
148 | | -.visited-links a:not(.icon-link):not(.link-chevron):visited { |
149 | | - color: var(--#{$prefix}color-action-visited); |
| 92 | +.link-on-colored-bg { |
| 93 | + --#{$prefix}link-color: #{$ouds-link-color-content-enabled-mono}; |
| 94 | + --#{$prefix}link-hover-color: #{$ouds-link-color-content-hover-mono}; |
| 95 | + --#{$prefix}link-focus-color: #{$ouds-link-color-content-focus-mono}; |
| 96 | + --#{$prefix}link-active-color: #{$ouds-link-color-content-pressed-mono}; |
| 97 | + --#{$prefix}link-disabled-color: #{$ouds-link-color-content-disabled-mono}; |
| 98 | + --#{$prefix}link-visited-color: #{$ouds-link-color-content-enabled-mono}; |
| 99 | + --#{$prefix}link-arrow-color: #{$ouds-link-color-content-enabled-mono}; |
| 100 | + --#{$prefix}link-arrow-hover-color: #{$ouds-link-color-content-hover-mono}; |
| 101 | + --#{$prefix}link-arrow-focus-color: #{$ouds-link-color-content-focus-mono}; |
| 102 | + --#{$prefix}link-arrow-pressed-color: #{$ouds-link-color-content-pressed-mono}; |
| 103 | + --#{$prefix}link-arrow-disabled-color: #{$ouds-link-color-content-disabled-mono}; |
150 | 104 | } |
151 | 105 |
|
| 106 | +.link-sm { |
| 107 | + --#{$prefix}link-icon-size: #{$ouds-link-size-icon-small}; |
| 108 | + --#{$prefix}link-icon-gap: #{$ouds-link-space-column-gap-icon-small}; |
| 109 | + --#{$prefix}link-arrow-gap: #{$ouds-link-space-column-gap-arrow-small}; |
| 110 | + |
| 111 | + @include get-font-size("label-medium"); |
| 112 | + min-width: $ouds-link-size-min-width-small; |
| 113 | + min-height: $ouds-link-size-min-height-small; |
| 114 | +} |
| 115 | + |
| 116 | +@if $enable-bootstrap-compatibility { |
| 117 | + .icon-link { |
| 118 | + @extend .link; |
| 119 | + } |
| 120 | +} |
0 commit comments