@hashicorp/design-system-components 0.0.16 → 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.
@@ -0,0 +1,26 @@
1
+ ## :pushpin: Summary
2
+
3
+ <!-- TLDR that includes the purpose of the PR e.g. "If merged, this PR..." -->
4
+
5
+ ## :busts_in_silhouette: How to review this PR
6
+
7
+ <!-- Check one box -->
8
+
9
+ - [ ] Review commit-by-commit (please copy commit info to "Summary" for clarity)
10
+ - [ ] Review by "Files changed"
11
+
12
+ ## :camera_flash: Screenshots
13
+
14
+ <!-- A picture is a thousand words -->
15
+
16
+ ## :link: External links
17
+
18
+ <!-- Asana issues, RFCs, etc. -->
19
+
20
+ ## :memo: Is it documented?
21
+
22
+ - [ ] Please confirm that this change is documented on the website!
23
+
24
+ ***
25
+
26
+ :speech_balloon: Please consider using [conventional comments](https://conventionalcomments.org/) when reviewing this PR.
package/README.md CHANGED
@@ -27,6 +27,12 @@ Then add this line to the top of your app's style file (`app.scss` or similar):
27
27
  @import '@hashicorp/design-system-components';
28
28
  ```
29
29
 
30
+ Usage
31
+ ------------------------------------------------------------------------------
32
+
33
+ See the dedicated components website: https://design-system-components-hashicorp.vercel.app/
34
+
35
+
30
36
  Contributing
31
37
  ------------------------------------------------------------------------------
32
38
 
@@ -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,13 +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);
23
+ isolation: isolate; // used to create a new stacking context (needed to have the pseudo element below text/icon but not the parent container)
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;
26
27
  position: relative;
27
- 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)
28
29
  text-decoration-color: transparent;
29
30
  width: fit-content;
30
31
 
@@ -61,6 +62,9 @@ $hds-link-standalone-border-width: 1px;
61
62
 
62
63
  .hds-link-standalone__text {
63
64
  flex: 1 0 0;
65
+ text-decoration: underline;
66
+ text-decoration-color: transparent;
67
+ transition: text-decoration-color 0.25s ease-in;
64
68
 
65
69
  .hds-link-standalone__icon + & {
66
70
  margin-left: 0.375rem;
@@ -111,44 +115,63 @@ $size-props: (
111
115
  // COLORS & STATES
112
116
  // The "primary" and "secondary" variants share a lot of styles for the interactive states
113
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/
114
122
 
115
123
  .hds-link-standalone {
124
+ // default focus for browsers that still rely on ":focus"
116
125
  &:focus,
117
- &:focus-visible,
118
126
  &.is-focus {
119
127
  &::before {
120
128
  @include hds-generic-focus-state();
121
129
  }
122
130
  }
123
- &:hover,
124
- &.is-hover {
125
- text-decoration: underline;
126
- transition: text-decoration-color 0.25s ease-in;
127
- // TODO!
128
- // discuss with Heather if she wants that we add calculation for text-decoration offset
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
+ }
129
136
  }
130
- &:active,
131
- &.is-active {
132
- text-decoration: underline;
133
-
134
- // remove the focus ring on "active + focused" state (by design)
137
+ // set focus for browsers that support ":focus-visible"
138
+ &:focus-visible {
139
+ &::before {
140
+ @include hds-generic-focus-state();
141
+ }
142
+ }
143
+ // remove the focus ring on "active + focused" state (by design)
144
+ &:focus:active,
145
+ &.is-focus.is-active {
135
146
  &::before {
136
- content: none;
147
+ @include hds-remove-focus-state();
137
148
  }
138
149
  }
139
150
  }
140
151
 
141
152
  .hds-link-standalone--color-primary {
142
- color: var(--token-color-action-foreground-on-faint);
153
+ color: var(--token-color-action-foreground-primary);
143
154
 
144
155
  &:hover,
145
156
  &.is-hover {
146
- text-decoration-color: #4E81E8; // custom color by design
157
+ color: var(--token-color-action-background-hover);
158
+
159
+ .hds-link-standalone__text {
160
+ text-decoration-color: #4E81E8; // custom color by design
161
+ }
147
162
  }
163
+
148
164
  &:active,
149
165
  &.is-active {
150
- color: var(--token-color-action-foreground-high-contrast);
151
- text-decoration-color: #596987; // custom color by design
166
+ color: var(--token-color-action-background-active);
167
+
168
+ .hds-link-standalone__text {
169
+ text-decoration-color: #396ED6; // custom color by design
170
+ }
171
+
172
+ &::before {
173
+ background-color: var(--token-color-action-background-faint);
174
+ }
152
175
  }
153
176
  }
154
177
 
@@ -157,11 +180,21 @@ $size-props: (
157
180
 
158
181
  &:hover,
159
182
  &.is-hover {
160
- text-decoration-color: #4D4D4F; // custom color by design
183
+ .hds-link-standalone__text {
184
+ text-decoration-color: #4D4D4F; // custom color by design
185
+ }
161
186
  }
187
+
162
188
  &:active,
163
189
  &.is-active {
164
190
  color: var(--token-color-neutral-foreground-secondary);
165
- 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
+
196
+ &::before {
197
+ background-color: var(--token-color-palette-neutral-200);
198
+ }
166
199
  }
167
200
  }
@@ -1,4 +1,7 @@
1
1
  @mixin hds-generic-focus-state() {
2
- box-shadow: inset 0px 0px 0px 1px var(--token-color-action-border-on-primary),
3
- 0px 0px 0px 3px #5990ff; // this is a special color used only for the focus style, to pass color contrast for a11y purpose
2
+ box-shadow: var(--token-focus-ring-box-shadow);
3
+ }
4
+
5
+ @mixin hds-remove-focus-state() {
6
+ box-shadow: none;
4
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashicorp/design-system-components",
3
- "version": "0.0.16",
3
+ "version": "0.0.20",
4
4
  "description": "HashiCorp Design System Components",
5
5
  "keywords": [
6
6
  "hashicorp",
@@ -61,8 +61,8 @@
61
61
  "prepare": "husky install"
62
62
  },
63
63
  "dependencies": {
64
- "@hashicorp/design-system-tokens": "^0.4.3",
65
- "@hashicorp/ember-flight-icons": "^2.0.0",
64
+ "@hashicorp/design-system-tokens": "^0.4.7",
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",
@@ -81,12 +81,14 @@
81
81
  "ember-a11y-refocus": "^2.1.0",
82
82
  "ember-auto-import": "^2.2.3",
83
83
  "ember-cli": "~3.28.4",
84
+ "ember-cli-clipboard": "^0.15.0",
84
85
  "ember-cli-dependency-checker": "^3.2.0",
85
86
  "ember-cli-inject-live-reload": "^2.1.0",
86
87
  "ember-cli-markdown-it-templates": "^0.0.3",
87
88
  "ember-cli-sri": "^2.1.1",
88
89
  "ember-cli-string-helpers": "^6.1.0",
89
90
  "ember-cli-terser": "^4.0.2",
91
+ "ember-concurrency": "^2.2.0",
90
92
  "ember-disable-prototype-extensions": "^1.1.3",
91
93
  "ember-export-application-global": "^2.0.1",
92
94
  "ember-load-initializers": "^2.1.2",
@@ -1,43 +0,0 @@
1
- {
2
- "bitwise": true,
3
- "camelcase": true,
4
- "curly": false,
5
- "eqeqeq": true,
6
- "es3": true,
7
- "forin": true,
8
- "immed": false,
9
- "indent": false,
10
- "latedef": "nofunc",
11
- "newcap": false,
12
- "noarg": true,
13
- "noempty": true,
14
- "nonew": false,
15
- "plusplus": false,
16
- "quotmark": false,
17
- "undef": true,
18
- "unused": "vars",
19
- "strict": false,
20
- "trailing": true,
21
- "maxparams": 5,
22
- "maxdepth": false,
23
- "maxstatements": false,
24
- "maxcomplexity": false,
25
- "maxlen": 100,
26
-
27
- "asi": true,
28
- "expr": true,
29
- "globalstrict": true,
30
- "smarttabs": true,
31
- "sub": true,
32
-
33
- "node": true,
34
- "globals": {
35
- "describe": false,
36
- "it": false,
37
- "before": false,
38
- "beforeEach": false,
39
- "after": false,
40
- "afterEach": false,
41
- "define": false
42
- }
43
- }