@hashicorp/design-system-components 0.0.13 → 0.0.17

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.
Files changed (27) hide show
  1. package/.github/ISSUE_TEMPLATE/new-component-quest-issue-engineering-checklist.md +78 -0
  2. package/addon/components/hds/badge/index.hbs +1 -1
  3. package/addon/components/hds/badge/index.js +20 -27
  4. package/addon/components/hds/badge-count/index.hbs +1 -1
  5. package/addon/components/hds/badge-count/index.js +16 -23
  6. package/addon/components/hds/button/index.hbs +1 -1
  7. package/addon/components/hds/button/index.js +26 -34
  8. package/addon/components/hds/card/container.hbs +1 -4
  9. package/addon/components/hds/card/container.js +18 -32
  10. package/addon/components/hds/icon-tile/index.hbs +1 -1
  11. package/addon/components/hds/icon-tile/index.js +21 -27
  12. package/addon/components/hds/link/standalone.hbs +20 -0
  13. package/addon/components/hds/link/standalone.js +135 -0
  14. package/addon/components/hds/link-to/standalone.hbs +25 -0
  15. package/addon/components/hds/link-to/standalone.js +161 -0
  16. package/addon/helpers/hds-link-to-models.js +30 -0
  17. package/app/components/hds/link/standalone.js +1 -0
  18. package/app/components/hds/link-to/standalone.js +1 -0
  19. package/app/helpers/hds-link-to-models.js +1 -0
  20. package/app/styles/@hashicorp/design-system-components.scss +3 -0
  21. package/app/styles/components/badge-count.scss +1 -1
  22. package/app/styles/components/badge.scss +1 -1
  23. package/app/styles/components/button.scss +63 -59
  24. package/app/styles/components/card/container.scss +0 -62
  25. package/app/styles/components/link/standalone.scss +166 -0
  26. package/package.json +7 -4
  27. package/.node_modules.ember-try/source-map-url/.jshintrc +0 -43
@@ -0,0 +1,161 @@
1
+ import Component from '@glimmer/component';
2
+ import { assert } from '@ember/debug';
3
+
4
+ export const DEFAULT_ICONPOSITION = 'leading';
5
+ export const DEFAULT_COLOR = 'primary';
6
+ export const DEFAULT_SIZE = 'medium';
7
+ export const ICONPOSITIONS = ['leading', 'trailing'];
8
+ export const COLORS = ['primary', 'secondary'];
9
+ export const SIZES = ['small', 'medium', 'large'];
10
+
11
+ export default class HdsLinkToStandaloneComponent extends Component {
12
+ /**
13
+ * @param text
14
+ * @type {string}
15
+ * @description The text of the link. If no text value is defined an error will be thrown.
16
+ */
17
+ get text() {
18
+ let { text } = this.args;
19
+
20
+ assert(
21
+ '@text for "Hds::LinkTo::Standalone" must have a valid value',
22
+ text !== undefined
23
+ );
24
+
25
+ return text;
26
+ }
27
+
28
+ /**
29
+ * @param route
30
+ * @type {string|null}
31
+ * @description Checks to make sure route is defined.
32
+ */
33
+ get route() {
34
+ let { route } = this.args;
35
+ assert(
36
+ '@route must be defined for "Hds::LinkTo::Standalone"',
37
+ route !== undefined
38
+ );
39
+
40
+ return route;
41
+ }
42
+
43
+ /**
44
+ * @param color
45
+ * @type {string}
46
+ * @default primary
47
+ * @description Determines the color of link to be used; acceptable values are `primary` and `secondary`
48
+ */
49
+ get color() {
50
+ let { color = DEFAULT_COLOR } = this.args;
51
+
52
+ assert(
53
+ `@color for "Hds::LinkTo::Standalone" must be one of the following: ${COLORS.join(
54
+ ', '
55
+ )}; received: ${color}`,
56
+ COLORS.includes(color)
57
+ );
58
+
59
+ return color;
60
+ }
61
+
62
+ /**
63
+ * @param icon
64
+ * @type {string|null}
65
+ * @default null
66
+ * @description The name of the icon to be used. An icon name must be defined.
67
+ */
68
+ get icon() {
69
+ let { icon } = this.args;
70
+
71
+ assert(
72
+ '@icon for "Hds::LinkTo::Standalone" must have a valid value',
73
+ icon !== undefined
74
+ );
75
+
76
+ return icon;
77
+ }
78
+
79
+ /**
80
+ * @param iconPosition
81
+ * @type {string}
82
+ * @default leading
83
+ * @description Positions the icon before or after the text; allowed values are `leading` or `trailing`
84
+ */
85
+ get iconPosition() {
86
+ let { iconPosition = DEFAULT_ICONPOSITION } = this.args;
87
+
88
+ assert(
89
+ `@iconPosition for "Hds::LinkTo::Standalone" must be one of the following: ${ICONPOSITIONS.join(
90
+ ', '
91
+ )}; received: ${iconPosition}`,
92
+ ICONPOSITIONS.includes(iconPosition)
93
+ );
94
+
95
+ return iconPosition;
96
+ }
97
+
98
+ /**
99
+ * @param size
100
+ * @type {string}
101
+ * @default medium
102
+ * @description The size of the standalone link; acceptable values are `small`, `medium`, and `large`
103
+ */
104
+ get size() {
105
+ let { size = DEFAULT_SIZE } = this.args;
106
+
107
+ assert(
108
+ `@size for "Hds::LinkTo::Standalone" must be one of the following: ${SIZES.join(
109
+ ', '
110
+ )}; received: ${size}`,
111
+ SIZES.includes(size)
112
+ );
113
+
114
+ return size;
115
+ }
116
+
117
+ /**
118
+ * @param iconSize
119
+ * @type {string}
120
+ * @default 16
121
+ * @description ensures that the correct icon size is used. Automatically calculated.
122
+ */
123
+ get iconSize() {
124
+ if (this.args.size === 'large') {
125
+ return '24';
126
+ } else {
127
+ return '16';
128
+ }
129
+ }
130
+
131
+ // this is a workaround for https://github.com/emberjs/ember.js/issues/19693
132
+ // don't remove until we drop support for ember 3.27 and 3.28
133
+ get queryParams() {
134
+ if (this.args.query) {
135
+ return this.args.query;
136
+ } else {
137
+ return {};
138
+ }
139
+ }
140
+
141
+ /**
142
+ * Get the class names to apply to the component.
143
+ * @method LinkToStandalone#classNames
144
+ * @return {string} The "class" attribute to apply to the component.
145
+ */
146
+ get classNames() {
147
+ // Notice: we've left this class name the same as the hds::link::standalone (we didn't add the "-to") so we didn't have to replicate the CSS
148
+ let classes = ['hds-link-standalone'];
149
+
150
+ // add a class based on the @size argument
151
+ classes.push(`hds-link-standalone--size-${this.size}`);
152
+
153
+ // add a class based on the @color argument
154
+ classes.push(`hds-link-standalone--color-${this.color}`);
155
+
156
+ // add a class based on the @iconPosition argument
157
+ classes.push(`hds-link-standalone--icon-position-${this.iconPosition}`);
158
+
159
+ return classes.join(' ');
160
+ }
161
+ }
@@ -0,0 +1,30 @@
1
+ import { helper } from '@ember/component/helper';
2
+ import { assert } from '@ember/debug';
3
+
4
+ /*
5
+ * This helper can be used to support both @model and @models arguments when wrapping
6
+ * the `<LinkTo>` component without it triggering assertions or having to use the component helper.
7
+ *
8
+ * The result of this helper should be passed into the `@models` argument of the `<LinkTo>` component:
9
+ *
10
+ * ```hbs
11
+ * <LinkTo @models={{hds-link-to-models @model @models}} />
12
+ * ```
13
+ */
14
+
15
+ export function hdsLinkToModels([model, models]) {
16
+ assert(
17
+ 'You cannot provide both the `@model` and `@models` arguments to the component.',
18
+ !model || !models
19
+ );
20
+
21
+ if (model) {
22
+ return [model];
23
+ } else if (models) {
24
+ return models;
25
+ } else {
26
+ return [];
27
+ }
28
+ }
29
+
30
+ export default helper(hdsLinkToModels);
@@ -0,0 +1 @@
1
+ export { default } from '@hashicorp/design-system-components/components/hds/link/standalone';
@@ -0,0 +1 @@
1
+ export { default } from '@hashicorp/design-system-components/components/hds/link-to/standalone';
@@ -0,0 +1 @@
1
+ export { default } from '@hashicorp/design-system-components/helpers/hds-link-to-models';
@@ -1,4 +1,6 @@
1
+ // these are files coming from the 'design-system-tokens' package
1
2
  @use "tokens";
3
+ @use "helpers/elevation";
2
4
 
3
5
  @use "../mixins/generic-focus-state";
4
6
 
@@ -7,6 +9,7 @@
7
9
  @use "../components/button";
8
10
  @use "../components/card";
9
11
  @use "../components/icon-tile";
12
+ @use "../components/link/standalone";
10
13
 
11
14
  .sr-only {
12
15
  border: 0 !important;
@@ -17,7 +17,7 @@ $hds-badge-count-border-width: 1px;
17
17
  border: $hds-badge-count-border-width solid transparent;
18
18
  box-sizing: border-box;
19
19
  display: inline-flex;
20
- font-family: var(--token-typography-body-base-font-family);
20
+ font-family: var(--token-typography-font-stack-text);
21
21
  max-width: 100%;
22
22
  }
23
23
 
@@ -28,7 +28,7 @@
28
28
 
29
29
  .hds-badge__text {
30
30
  flex: 1 0 0;
31
- font-family: var(--token-typography-body-base-font-family);
31
+ font-family: var(--token-typography-font-stack-text);
32
32
  }
33
33
 
34
34
 
@@ -1,34 +1,26 @@
1
- // Button Component Styles
1
+ //
2
+ // BUTTON COMPONENT
3
+ //
4
+ // properties within each class are sorted alphabetically
5
+ // notice: pseudo-classes for the states *must* follow the order link > visited > focus > hover > active
6
+ // see https://github.com/hashicorp/design-system-components/issues/132
7
+ //
8
+ //
9
+
10
+ $hds-button-sizes: ( 'small', 'medium', 'large' );
2
11
 
3
12
  $hds-button-border-radius: 5px;
4
13
  $hds-button-border-width: 1px;
5
14
  $hds-button-focus-border-width: 3px;
6
15
 
7
- // TODO! generalize with the existing mixin in Card component
8
- @mixin tempElevation() {
9
- box-shadow:
10
- var(--token-elevation-low-shadow-01-x)
11
- var(--token-elevation-low-shadow-01-y)
12
- var(--token-elevation-low-shadow-01-blur)
13
- var(--token-elevation-low-shadow-01-spread)
14
- var(--token-elevation-low-shadow-01-color),
15
- var(--token-elevation-low-shadow-02-x)
16
- var(--token-elevation-low-shadow-02-y)
17
- var(--token-elevation-low-shadow-02-blur)
18
- var(--token-elevation-low-shadow-02-spread)
19
- var(--token-elevation-low-shadow-02-color)
20
- ;
21
- }
22
16
 
23
17
  .hds-button {
24
- @include tempElevation();
25
-
26
18
  align-items: center;
27
19
  border: $hds-button-border-width solid transparent; // We need this to be transparent for a11y
28
20
  border-radius: $hds-button-border-radius;
29
21
  box-sizing: border-box; // TODO https://github.com/hashicorp/design-system-components/issues/46
30
22
  display: flex;
31
- font-family: var(--token-typography-body-base-font-family);
23
+ font-family: var(--token-typography-font-stack-text);
32
24
  justify-content: center;
33
25
  outline-color: transparent; // We need this to be transparent for a11y
34
26
  max-width: fit-content;
@@ -39,15 +31,15 @@ $hds-button-focus-border-width: 3px;
39
31
  &:disabled,
40
32
  &[disabled],
41
33
  &.is-disabled,
42
- &:disabled:hover,
43
- &[disabled]:hover,
44
- &.is-disabled:hover,
45
34
  &:disabled:focus,
46
35
  &[disabled]:focus,
47
36
  &.is-disabled:focus,
48
37
  &:disabled:focus-visible,
49
38
  &[disabled]:focus-visible,
50
- &.is-disabled:focus-visible {
39
+ &.is-disabled:focus-visible,
40
+ &:disabled:hover,
41
+ &[disabled]:hover,
42
+ &.is-disabled:hover {
51
43
  background-color: var(--token-color-palette-neutral-50);
52
44
  border-color: var(--token-color-palette-alpha-200);
53
45
  box-shadow: none;
@@ -69,11 +61,12 @@ $hds-button-focus-border-width: 3px;
69
61
  }
70
62
  }
71
63
 
72
- &.is-focus,
73
64
  &:focus,
74
- &:focus-visible {
65
+ &:focus-visible,
66
+ &.is-focus {
75
67
  &::before {
76
- // the position absolute is computed from the inside of the border, so we have to take in account the border width
68
+ // the position absolute of an element is computed from the inside of the border of the container
69
+ // so we have to take in account the border width of the pseudo-element container itself
77
70
  $shift: $hds-button-border-width + $hds-button-focus-border-width;
78
71
  border-radius: $hds-button-border-radius + $hds-button-focus-border-width;
79
72
  border: $hds-button-focus-border-width solid transparent;
@@ -84,15 +77,18 @@ $hds-button-focus-border-width: 3px;
84
77
  position: absolute;
85
78
  right: -$shift;
86
79
  top: -$shift;
80
+ z-index: -1;
87
81
  }
88
82
  }
89
83
  }
90
84
 
91
85
  .hds-button__text {
92
86
  flex: 1 0 0;
87
+
93
88
  .hds-button__icon + & {
94
89
  margin-left: 0.375rem;
95
90
  }
91
+
96
92
  & +.hds-button__icon {
97
93
  margin-left: 0.375rem;
98
94
  }
@@ -101,42 +97,49 @@ $hds-button-focus-border-width: 3px;
101
97
 
102
98
  // SIZE
103
99
 
104
- .hds-button--size-small {
105
- font-size: 0.8125rem; // 13px;
106
- min-height: 1.75rem; //28px
107
- line-height: 1;
108
- padding: 0 1rem;
109
-
110
- .hds-button__icon {
111
- height: 0.75rem; // 12px
112
- width: 0.75rem; // 12px
113
- }
114
- }
115
-
116
- .hds-button--size-medium {
117
- font-size: 0.875rem; // 14px
118
- line-height: 1rem; // 16px
119
- min-height: 2.25rem; //36px
120
- padding: 0.625rem 1rem;
100
+ // these values later may come from the design tokens
101
+ $size-props: (
102
+ "small": (
103
+ "font-size": 0.8125rem, // 13px;
104
+ "line-height": 1,
105
+ "min-height": 1.75rem, // 28px
106
+ "padding": 0 1rem, // 0 16px
107
+ "icon-size": 0.75rem, // 12px
108
+ ),
109
+ "medium": (
110
+ "font-size": 0.875rem, // 14px
111
+ "line-height": 1rem,// 16px
112
+ "min-height": 2.25rem, // 36px
113
+ "padding": 0.625rem 1rem, // 10px 16px
114
+ "icon-size": 1rem, // 16px
115
+ ),
116
+ "large": (
117
+ "font-size": 1rem, //16px
118
+ "line-height": 1.5rem, // 24px
119
+ "min-height": 3rem, // 48px
120
+ "padding": 0.75rem 1.25rem, // 12px 20px
121
+ "icon-size": 1.5rem, // 24px
122
+ )
123
+ );
121
124
 
122
- .hds-button__icon {
123
- height: 1rem;
124
- width: 1rem;
125
- }
126
- }
125
+ @each $size in $hds-button-sizes {
126
+ .hds-button--size-#{$size} {
127
+ min-height: map-get($size-props, $size, "min-height");
128
+ padding: map-get($size-props, $size, "padding");
127
129
 
128
- .hds-button--size-large {
129
- font-size: 1rem; //16px
130
- line-height: 1.5rem; // 24px
131
- min-height: 3rem; //48px
132
- padding: 0.75rem 1.25rem; // 12px 20px
130
+ .hds-button__icon {
131
+ height: map-get($size-props, $size, "icon-size");
132
+ width: map-get($size-props, $size, "icon-size");
133
+ }
133
134
 
134
- .hds-button__icon {
135
- height: 1.5rem;
136
- width: 1.5rem;
135
+ .hds-button__text {
136
+ font-size: map-get($size-props, $size, "font-size");
137
+ line-height: map-get($size-props, $size, "line-height");
138
+ }
137
139
  }
138
140
  }
139
141
 
142
+
140
143
  // COLORS & STATES
141
144
  // Note: the order of the pseuo-selectors need to stay the way they are; it doesn't match the Figma file but it's the correct order for browsers to render the styles correctly.
142
145
 
@@ -152,7 +155,8 @@ $hds-button-focus-border-width: 3px;
152
155
  border-color: var(--token-color-action-border-on-primary);
153
156
  color: var(--token-color-palette-neutral-0);
154
157
  &::before {
155
- // the position absolute is computed from the inside of the border, so we have to take in account the border width
158
+ // the position absolute of an element is computed from the inside of the border of the container
159
+ // so we have to take in account the border width of the pseudo-element container itself
156
160
  // plus for the primary button we want to have a 2px gap between the button and the focus
157
161
  $shift: $hds-button-border-width + $hds-button-focus-border-width + 2px;
158
162
  border-radius: $hds-button-border-radius + $hds-button-focus-border-width + 2px;
@@ -205,7 +209,7 @@ $hds-button-focus-border-width: 3px;
205
209
  color: var(--token-color-palette-neutral-600);
206
210
  cursor: pointer;
207
211
  }
208
- &:active,
212
+ &:active,
209
213
  &.is-active {
210
214
  background-color: var(--token-color-palette-neutral-200);
211
215
  border-color: var(--token-color-palette-alpha-300);
@@ -240,7 +244,7 @@ $hds-button-focus-border-width: 3px;
240
244
  color: var(--token-color-palette-neutral-0);
241
245
  cursor: pointer;
242
246
  }
243
-
247
+
244
248
  &:active,
245
249
  &.is-active {
246
250
  background-color: var(--token-color-critical-background-active);
@@ -5,56 +5,6 @@
5
5
  //
6
6
  //
7
7
 
8
- // this mixin is used to apply the "elevation" styles to the card container
9
- // depending on the "elevation level" and if it has a border applied to it.
10
- // we are mimicking the way this effect is defined in Figma, through a set of
11
- // multiple drop shadows (also the border is a 1px shadow); we tried using an
12
- // outline but Safari still doesn't support rounded edges for outlines.
13
- // for details see: https://www.figma.com/file/oQsMzMMnynfPWpMEt91OpH/?node-id=1988%3A2
14
-
15
- @mixin getElevationStyle($level, $has-border: false) {
16
- $drop-shadow: false;
17
- $border-shadow: false;
18
-
19
- // here we define the "drop-shadow" values (there are two shadows applied)
20
- // notice: the "base" level doesn't have a "drop shadow" effect applied (no elevation)
21
- @if ($level != 'base') {
22
- $drop-shadow:
23
- var(--token-elevation-#{$level}-shadow-01-x)
24
- var(--token-elevation-#{$level}-shadow-01-y)
25
- var(--token-elevation-#{$level}-shadow-01-blur)
26
- var(--token-elevation-#{$level}-shadow-01-spread)
27
- var(--token-elevation-#{$level}-shadow-01-color),
28
- var(--token-elevation-#{$level}-shadow-02-x)
29
- var(--token-elevation-#{$level}-shadow-02-y)
30
- var(--token-elevation-#{$level}-shadow-02-blur)
31
- var(--token-elevation-#{$level}-shadow-02-spread)
32
- var(--token-elevation-#{$level}-shadow-02-color)
33
- ;
34
- }
35
-
36
- // here we define the "border-shadow" values
37
- // notice: we create a border via a shadow, so we have zero values for x/y/blur
38
- @if ($has-border) {
39
- $border-shadow:
40
- 0
41
- 0
42
- 0
43
- var(--token-elevation-#{$level}-border-width)
44
- var(--token-elevation-#{$level}-border-color);
45
- }
46
-
47
- // here we join the two effects in a single box-shadow (depending on the different cases)
48
- @if ($drop-shadow and not $border-shadow) {
49
- box-shadow: $drop-shadow;
50
- } @else if($border-shadow and not $drop-shadow) {
51
- box-shadow: $border-shadow;
52
- } @else {
53
- // notice: we put the "border-shadow" first because the final rendering in the browser looks better
54
- // see: https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow - "The z-ordering of multiple box shadows is the same as multiple text shadows (the first specified shadow is on top)."
55
- box-shadow: $border-shadow, $drop-shadow;
56
- }
57
- }
58
8
 
59
9
  $hds-card-container-levels: ( 'base', 'mid', 'high' );
60
10
 
@@ -66,18 +16,6 @@ $hds-card-container-border-radius: 6px;
66
16
  position: relative;
67
17
  }
68
18
 
69
- // LEVEL (elevation style as "drop" + "border" shadow effects)
70
-
71
- @each $level in $hds-card-container-levels {
72
- .hds-card__container--level-#{$level} {
73
- @include getElevationStyle($level);
74
-
75
- &.hds-card__container--has-border {
76
- @include getElevationStyle($level, true);
77
- }
78
- }
79
- }
80
-
81
19
 
82
20
  // BACKGROUND
83
21
 
@@ -0,0 +1,166 @@
1
+ //
2
+ // LINK > STANDALONE COMPONENT
3
+ //
4
+ // properties within each class are sorted alphabetically
5
+ // notice: pseudo-classes for the states *must* follow the order link > visited > focus > hover > active
6
+ // see https://github.com/hashicorp/design-system-components/issues/132
7
+ //
8
+ //
9
+
10
+ @use '../../mixins/generic-focus-state.scss' as *;
11
+
12
+ $hds-link-standalone-sizes: ( 'small', 'medium', 'large' );
13
+
14
+ $hds-link-standalone-focus-border-radius: 5px;
15
+ $hds-link-standalone-border-width: 1px;
16
+
17
+ .hds-link-standalone {
18
+ align-items: center;
19
+ background-color: transparent; // needs to exist for a11y
20
+ border: $hds-link-standalone-border-width solid transparent; // needs to exist AND be transparent for a11y
21
+ color: var(--token-color-action-foreground-on-faint);
22
+ display: flex;
23
+ font-family: var(--token-typography-font-stack-text);
24
+ justify-content: center;
25
+ outline-color: transparent;
26
+ position: relative;
27
+ text-decoration: underline;
28
+ text-decoration-color: transparent;
29
+ width: fit-content;
30
+
31
+ // this is how much the focus is visually "shifted" from the bounding box of the
32
+ // notice: you have to take in account also the inset shadow of the focus (see Figma file and also "generic-focus-state" mixin)
33
+ $hds-link-standalone-focus-shift: 4px;
34
+ // the position absolute of an element is computed from the inside of the border of the container
35
+ // so we have to take in account the border width of the pseudo-element container itself
36
+ $shift: $hds-link-standalone-focus-shift + $hds-link-standalone-border-width;
37
+ // for visual/optical balance we add an extra 2px to the "shift" near the text (opposite the icon)
38
+ $shift-extra: $shift + 2px;
39
+
40
+ // this is used not only for the focus, but also to increase the clickable area
41
+ &::before {
42
+ border-radius: $hds-link-standalone-focus-border-radius;
43
+ bottom: -$shift;
44
+ box-sizing: border-box;
45
+ content: '';
46
+ left: -$shift;
47
+ position: absolute;
48
+ right: -$shift;
49
+ top: -$shift;
50
+ }
51
+
52
+ &.hds-link-standalone--icon-position-leading::before {
53
+ right: -$shift-extra;
54
+ }
55
+
56
+ &.hds-link-standalone--icon-position-trailing::before {
57
+ left: -$shift-extra;
58
+ }
59
+ }
60
+
61
+ .hds-link-standalone__text {
62
+ flex: 1 0 0;
63
+
64
+ .hds-link-standalone__icon + & {
65
+ margin-left: 0.375rem;
66
+ }
67
+
68
+ & +.hds-link-standalone__icon {
69
+ margin-left: 0.375rem;
70
+ }
71
+ }
72
+
73
+
74
+ // SIZE
75
+
76
+ // these values later may come from the design tokens
77
+ $size-props: (
78
+ "small": (
79
+ "font-size": 0.8125rem, // 13px;
80
+ "icon-size": 1rem, // 16px
81
+ "line-height": 1.231, // ~16px
82
+ ),
83
+ "medium": (
84
+ "font-size": 0.875rem, // 14px
85
+ "icon-size": 1rem, // 16px
86
+ "line-height": 1.143, // ~16px
87
+ ),
88
+ "large": (
89
+ "font-size": 1rem, // 16px
90
+ "icon-size": 1.5rem, // 24px
91
+ "line-height": 1.5, // 24px
92
+ )
93
+ );
94
+
95
+ @each $size in $hds-link-standalone-sizes {
96
+ .hds-link-standalone--size-#{$size} {
97
+
98
+ .hds-link-standalone__icon {
99
+ height: map-get($size-props, $size, "icon-size");
100
+ width: map-get($size-props, $size, "icon-size");
101
+ }
102
+
103
+ .hds-link-standalone__text {
104
+ font-size: map-get($size-props, $size, "font-size");
105
+ line-height: map-get($size-props, $size, "line-height");
106
+ }
107
+ }
108
+ }
109
+
110
+ // COLORS & STATES
111
+ // The "primary" and "secondary" variants share a lot of styles for the interactive states
112
+ // Note: the order of the pseuo-selectors need to stay the way they are
113
+
114
+ .hds-link-standalone {
115
+ &:focus,
116
+ &:focus-visible,
117
+ &.is-focus {
118
+ &::before {
119
+ @include hds-generic-focus-state();
120
+ }
121
+ }
122
+ &:hover,
123
+ &.is-hover {
124
+ text-decoration: underline;
125
+ transition: text-decoration-color 0.25s ease-in;
126
+ // TODO!
127
+ // discuss with Heather if she wants that we add calculation for text-decoration offset
128
+ }
129
+ &:active,
130
+ &.is-active {
131
+ text-decoration: underline;
132
+
133
+ // remove the focus ring on "active + focused" state (by design)
134
+ &::before {
135
+ content: none;
136
+ }
137
+ }
138
+ }
139
+
140
+ .hds-link-standalone--color-primary {
141
+ color: var(--token-color-action-foreground-on-faint);
142
+
143
+ &:hover,
144
+ &.is-hover {
145
+ text-decoration-color: #4E81E8; // custom color by design
146
+ }
147
+ &:active,
148
+ &.is-active {
149
+ color: var(--token-color-action-foreground-high-contrast);
150
+ text-decoration-color: #596987; // custom color by design
151
+ }
152
+ }
153
+
154
+ .hds-link-standalone--color-secondary {
155
+ color: var(--token-color-neutral-foreground-primary);
156
+
157
+ &:hover,
158
+ &.is-hover {
159
+ text-decoration-color: #4D4D4F; // custom color by design
160
+ }
161
+ &:active,
162
+ &.is-active {
163
+ color: var(--token-color-neutral-foreground-secondary);
164
+ text-decoration-color: #6E7075; // custom color by design
165
+ }
166
+ }