@hashicorp/design-system-components 0.0.19 → 0.0.20

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.
@@ -1,6 +1,7 @@
1
1
  // these are files coming from the 'design-system-tokens' package
2
2
  @use "tokens";
3
3
  @use "helpers/elevation";
4
+ @use "helpers/focus-ring";
4
5
 
5
6
  @use "../mixins/generic-focus-state";
6
7
 
@@ -22,6 +22,7 @@ $hds-button-focus-border-width: 3px;
22
22
  display: flex;
23
23
  font-family: var(--token-typography-font-stack-text);
24
24
  justify-content: center;
25
+ outline-style: solid; // used to avoid double outline+focus-ring in Safari (see https://github.com/hashicorp/design-system-components/issues/161#issuecomment-1031548656)
25
26
  outline-color: transparent; // We need this to be transparent for a11y
26
27
  max-width: fit-content;
27
28
  position: relative;
@@ -34,9 +35,6 @@ $hds-button-focus-border-width: 3px;
34
35
  &:disabled:focus,
35
36
  &[disabled]:focus,
36
37
  &.is-disabled:focus,
37
- &:disabled:focus-visible,
38
- &[disabled]:focus-visible,
39
- &.is-disabled:focus-visible,
40
38
  &:disabled:hover,
41
39
  &[disabled]:hover,
42
40
  &.is-disabled:hover {
@@ -45,7 +43,6 @@ $hds-button-focus-border-width: 3px;
45
43
  box-shadow: none;
46
44
  color: var(--token-color-palette-neutral-400);
47
45
  cursor: not-allowed;
48
- outline-color: var(--token-color-palette-alpha-200);
49
46
 
50
47
  &::before {
51
48
  border-color: transparent;
@@ -62,7 +59,6 @@ $hds-button-focus-border-width: 3px;
62
59
  }
63
60
 
64
61
  &:focus,
65
- &:focus-visible,
66
62
  &.is-focus {
67
63
  &::before {
68
64
  // the position absolute of an element is computed from the inside of the border of the container
@@ -149,7 +145,6 @@ $size-props: (
149
145
  color: var(--token-color-palette-neutral-0);
150
146
 
151
147
  &:focus,
152
- &:focus-visible,
153
148
  &.is-focus {
154
149
  background-color: var(--token-color-action-background-primary);
155
150
  border-color: var(--token-color-action-border-on-primary);
@@ -192,12 +187,10 @@ $size-props: (
192
187
  color: var(--token-color-palette-neutral-600);
193
188
 
194
189
  &:focus,
195
- &:focus-visible,
196
190
  &.is-focus {
197
191
  background-color: var(--token-color-palette-neutral-50);
198
192
  border-color: var(--token-color-action-border-on-primary);
199
193
  color: var(--token-color-palette-neutral-600);
200
- outline-color: var(--token-color-action-border-on-primary);
201
194
  &::before {
202
195
  border-color: #5990FF;
203
196
  }
@@ -227,12 +220,10 @@ $size-props: (
227
220
  color: var(--token-color-critical-foreground-on-faint);
228
221
 
229
222
  &:focus,
230
- &:focus-visible,
231
223
  &.is-focus {
232
224
  background-color: var(--token-color-palette-neutral-50);
233
225
  border-color: var(--token-color-critical-border-on-primary);
234
226
  color: var(--token-color-critical-foreground-on-faint);
235
- outline-color: var(--token-color-critical-border-on-primary);
236
227
  &::before {
237
228
  border-color: #DD7578;
238
229
  }
@@ -18,14 +18,14 @@ $hds-link-standalone-border-width: 1px;
18
18
  align-items: center;
19
19
  background-color: transparent; // needs to exist for a11y
20
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
21
  display: flex;
23
22
  font-family: var(--token-typography-font-stack-text);
24
23
  isolation: isolate; // used to create a new stacking context (needed to have the pseudo element below text/icon but not the parent container)
25
24
  justify-content: center;
25
+ outline-style: solid; // used to avoid double outline+focus-ring in Safari (see https://github.com/hashicorp/design-system-components/issues/161#issuecomment-1031548656)
26
26
  outline-color: transparent;
27
27
  position: relative;
28
- text-decoration: underline;
28
+ // notice: the text decoration is applied directly to the "text" container because of a bug in Safari (see https://github.com/hashicorp/design-system-components/issues/159)
29
29
  text-decoration-color: transparent;
30
30
  width: fit-content;
31
31
 
@@ -62,6 +62,9 @@ $hds-link-standalone-border-width: 1px;
62
62
 
63
63
  .hds-link-standalone__text {
64
64
  flex: 1 0 0;
65
+ text-decoration: underline;
66
+ text-decoration-color: transparent;
67
+ transition: text-decoration-color 0.25s ease-in;
65
68
 
66
69
  .hds-link-standalone__icon + & {
67
70
  margin-left: 0.375rem;
@@ -112,34 +115,38 @@ $size-props: (
112
115
  // COLORS & STATES
113
116
  // The "primary" and "secondary" variants share a lot of styles for the interactive states
114
117
  // Note: the order of the pseuo-selectors need to stay the way they are
118
+ //
119
+ // For an explanation of the ":focus/:focus-visible" states see:
120
+ // - https://github.com/hashicorp/design-system-components/issues/161
121
+ // - https://www.tpgi.com/focus-visible-and-backwards-compatibility/
115
122
 
116
123
  .hds-link-standalone {
124
+ // default focus for browsers that still rely on ":focus"
117
125
  &:focus,
118
- &:focus-visible,
119
126
  &.is-focus {
120
127
  &::before {
121
128
  @include hds-generic-focus-state();
122
129
  }
123
130
  }
124
- &:hover,
125
- &.is-hover {
126
- text-decoration: underline;
127
- transition: text-decoration-color 0.25s ease-in;
131
+ // undo the previous declaration for browsers that support ":focus-visible" but wouldn't normally show default focus styles
132
+ &:focus:not(:focus-visible) {
133
+ &::before {
134
+ @include hds-remove-focus-state();
135
+ }
128
136
  }
129
- &:active,
130
- &.is-active {
131
- text-decoration: underline;
132
-
137
+ // set focus for browsers that support ":focus-visible"
138
+ &:focus-visible {
139
+ &::before {
140
+ @include hds-generic-focus-state();
141
+ }
133
142
  }
134
143
  // remove the focus ring on "active + focused" state (by design)
135
144
  &:focus:active,
136
- &:focus-visible:active,
137
145
  &.is-focus.is-active {
138
146
  &::before {
139
- content: none;
147
+ @include hds-remove-focus-state();
140
148
  }
141
149
  }
142
-
143
150
  }
144
151
 
145
152
  .hds-link-standalone--color-primary {
@@ -148,12 +155,20 @@ $size-props: (
148
155
  &:hover,
149
156
  &.is-hover {
150
157
  color: var(--token-color-action-background-hover);
151
- text-decoration-color: #4E81E8; // custom color by design
158
+
159
+ .hds-link-standalone__text {
160
+ text-decoration-color: #4E81E8; // custom color by design
161
+ }
152
162
  }
163
+
153
164
  &:active,
154
165
  &.is-active {
155
166
  color: var(--token-color-action-background-active);
156
- text-decoration-color: #396ED6; // custom color by design
167
+
168
+ .hds-link-standalone__text {
169
+ text-decoration-color: #396ED6; // custom color by design
170
+ }
171
+
157
172
  &::before {
158
173
  background-color: var(--token-color-action-background-faint);
159
174
  }
@@ -165,12 +180,19 @@ $size-props: (
165
180
 
166
181
  &:hover,
167
182
  &.is-hover {
168
- text-decoration-color: #4D4D4F; // custom color by design
183
+ .hds-link-standalone__text {
184
+ text-decoration-color: #4D4D4F; // custom color by design
185
+ }
169
186
  }
187
+
170
188
  &:active,
171
189
  &.is-active {
172
190
  color: var(--token-color-neutral-foreground-secondary);
173
- text-decoration-color: #6E7075; // custom color by design
191
+
192
+ .hds-link-standalone__text {
193
+ text-decoration-color: #6E7075; // custom color by design
194
+ }
195
+
174
196
  &::before {
175
197
  background-color: var(--token-color-palette-neutral-200);
176
198
  }
@@ -1,3 +1,7 @@
1
1
  @mixin hds-generic-focus-state() {
2
2
  box-shadow: var(--token-focus-ring-box-shadow);
3
3
  }
4
+
5
+ @mixin hds-remove-focus-state() {
6
+ box-shadow: none;
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashicorp/design-system-components",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "HashiCorp Design System Components",
5
5
  "keywords": [
6
6
  "hashicorp",
@@ -62,7 +62,7 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "@hashicorp/design-system-tokens": "^0.4.7",
65
- "@hashicorp/ember-flight-icons": "^2.0.0",
65
+ "@hashicorp/ember-flight-icons": "^2.0.1",
66
66
  "ember-cli-babel": "^7.26.6",
67
67
  "ember-cli-htmlbars": "^5.7.1",
68
68
  "ember-cli-sass": "^10.0.1",