@hashicorp/design-system-components 0.0.14 → 0.0.18

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.
@@ -127,6 +127,9 @@ export default class HdsLinkStandaloneComponent extends Component {
127
127
  // add a class based on the @color argument
128
128
  classes.push(`hds-link-standalone--color-${this.color}`);
129
129
 
130
+ // add a class based on the @iconPosition argument
131
+ classes.push(`hds-link-standalone--icon-position-${this.iconPosition}`);
132
+
130
133
  return classes.join(' ');
131
134
  }
132
135
  }
@@ -153,6 +153,9 @@ export default class HdsLinkToStandaloneComponent extends Component {
153
153
  // add a class based on the @color argument
154
154
  classes.push(`hds-link-standalone--color-${this.color}`);
155
155
 
156
+ // add a class based on the @iconPosition argument
157
+ classes.push(`hds-link-standalone--icon-position-${this.iconPosition}`);
158
+
156
159
  return classes.join(' ');
157
160
  }
158
161
  }
@@ -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,10 +1,18 @@
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
- $hds-button-sizes: ( 'small', 'medium', 'large' );
8
16
 
9
17
  .hds-button {
10
18
  align-items: center;
@@ -12,7 +20,7 @@ $hds-button-sizes: ( 'small', 'medium', 'large' );
12
20
  border-radius: $hds-button-border-radius;
13
21
  box-sizing: border-box; // TODO https://github.com/hashicorp/design-system-components/issues/46
14
22
  display: flex;
15
- font-family: var(--token-typography-body-base-font-family);
23
+ font-family: var(--token-typography-font-stack-text);
16
24
  justify-content: center;
17
25
  outline-color: transparent; // We need this to be transparent for a11y
18
26
  max-width: fit-content;
@@ -23,15 +31,15 @@ $hds-button-sizes: ( 'small', 'medium', 'large' );
23
31
  &:disabled,
24
32
  &[disabled],
25
33
  &.is-disabled,
26
- &:disabled:hover,
27
- &[disabled]:hover,
28
- &.is-disabled:hover,
29
34
  &:disabled:focus,
30
35
  &[disabled]:focus,
31
36
  &.is-disabled:focus,
32
37
  &:disabled:focus-visible,
33
38
  &[disabled]:focus-visible,
34
- &.is-disabled:focus-visible {
39
+ &.is-disabled:focus-visible,
40
+ &:disabled:hover,
41
+ &[disabled]:hover,
42
+ &.is-disabled:hover {
35
43
  background-color: var(--token-color-palette-neutral-50);
36
44
  border-color: var(--token-color-palette-alpha-200);
37
45
  box-shadow: none;
@@ -53,11 +61,12 @@ $hds-button-sizes: ( 'small', 'medium', 'large' );
53
61
  }
54
62
  }
55
63
 
56
- &.is-focus,
57
64
  &:focus,
58
- &:focus-visible {
65
+ &:focus-visible,
66
+ &.is-focus {
59
67
  &::before {
60
- // 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
61
70
  $shift: $hds-button-border-width + $hds-button-focus-border-width;
62
71
  border-radius: $hds-button-border-radius + $hds-button-focus-border-width;
63
72
  border: $hds-button-focus-border-width solid transparent;
@@ -68,15 +77,18 @@ $hds-button-sizes: ( 'small', 'medium', 'large' );
68
77
  position: absolute;
69
78
  right: -$shift;
70
79
  top: -$shift;
80
+ z-index: -1;
71
81
  }
72
82
  }
73
83
  }
74
84
 
75
85
  .hds-button__text {
76
86
  flex: 1 0 0;
87
+
77
88
  .hds-button__icon + & {
78
89
  margin-left: 0.375rem;
79
90
  }
91
+
80
92
  & +.hds-button__icon {
81
93
  margin-left: 0.375rem;
82
94
  }
@@ -112,15 +124,18 @@ $size-props: (
112
124
 
113
125
  @each $size in $hds-button-sizes {
114
126
  .hds-button--size-#{$size} {
115
- font-size: map-get($size-props, $size, "font-size");
116
127
  min-height: map-get($size-props, $size, "min-height");
117
- line-height: map-get($size-props, $size, "line-height");
118
128
  padding: map-get($size-props, $size, "padding");
119
129
 
120
130
  .hds-button__icon {
121
131
  height: map-get($size-props, $size, "icon-size");
122
132
  width: map-get($size-props, $size, "icon-size");
123
133
  }
134
+
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
+ }
124
139
  }
125
140
  }
126
141
 
@@ -140,7 +155,8 @@ $size-props: (
140
155
  border-color: var(--token-color-action-border-on-primary);
141
156
  color: var(--token-color-palette-neutral-0);
142
157
  &::before {
143
- // 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
144
160
  // plus for the primary button we want to have a 2px gap between the button and the focus
145
161
  $shift: $hds-button-border-width + $hds-button-focus-border-width + 2px;
146
162
  border-radius: $hds-button-border-radius + $hds-button-focus-border-width + 2px;
@@ -193,7 +209,7 @@ $size-props: (
193
209
  color: var(--token-color-palette-neutral-600);
194
210
  cursor: pointer;
195
211
  }
196
- &:active,
212
+ &:active,
197
213
  &.is-active {
198
214
  background-color: var(--token-color-palette-neutral-200);
199
215
  border-color: var(--token-color-palette-alpha-300);
@@ -228,7 +244,7 @@ $size-props: (
228
244
  color: var(--token-color-palette-neutral-0);
229
245
  cursor: pointer;
230
246
  }
231
-
247
+
232
248
  &:active,
233
249
  &.is-active {
234
250
  background-color: var(--token-color-critical-background-active);
@@ -1,36 +1,91 @@
1
- $hds-link-standalone-border-radius: 5px;
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
+
2
12
  $hds-link-standalone-sizes: ( 'small', 'medium', 'large' );
3
- $hds-link-standalone-border-width: 1px;
4
- $hds-link-standalone-focus-border-width: 3px + $hds-link-standalone-border-width;
5
13
 
14
+ $hds-link-standalone-focus-border-radius: 5px;
15
+ $hds-link-standalone-border-width: 1px;
6
16
 
7
17
  .hds-link-standalone {
8
18
  align-items: center;
9
- background-color: transparent;
19
+ background-color: transparent; // needs to exist for a11y
10
20
  border: $hds-link-standalone-border-width solid transparent; // needs to exist AND be transparent for a11y
11
- border-radius: $hds-link-standalone-border-radius;
12
21
  color: var(--token-color-action-foreground-on-faint);
13
22
  display: flex;
14
- font-family: var(--token-typography-body-base-font-family);
23
+ font-family: var(--token-typography-font-stack-text);
24
+ isolation: isolate; // used to create a new stacking context (needed to have the pseudo element below text/icon but not the parent container)
15
25
  justify-content: center;
16
26
  outline-color: transparent;
17
- padding: 0.25rem; // should be 4px; iconPosition will override it on one side
18
27
  position: relative;
19
- text-decoration: none;
28
+ text-decoration: underline;
29
+ text-decoration-color: transparent;
20
30
  width: fit-content;
31
+
32
+ // this is how much the focus is visually "shifted" from the bounding box of the
33
+ // notice: you have to take in account also the inset shadow of the focus (see Figma file and also "generic-focus-state" mixin)
34
+ $hds-link-standalone-focus-shift: 4px;
35
+ // the position absolute of an element is computed from the inside of the border of the container
36
+ // so we have to take in account the border width of the pseudo-element container itself
37
+ $shift: $hds-link-standalone-focus-shift + $hds-link-standalone-border-width;
38
+ // for visual/optical balance we add an extra 2px to the "shift" near the text (opposite the icon)
39
+ $shift-extra: $shift + 2px;
40
+
41
+ // this is used not only for the focus, but also to increase the clickable area
42
+ &::before {
43
+ border-radius: $hds-link-standalone-focus-border-radius;
44
+ bottom: -$shift;
45
+ box-sizing: border-box;
46
+ content: '';
47
+ left: -$shift;
48
+ position: absolute;
49
+ right: -$shift;
50
+ top: -$shift;
51
+ z-index: -1;
52
+ }
53
+
54
+ &.hds-link-standalone--icon-position-leading::before {
55
+ right: -$shift-extra;
56
+ }
57
+
58
+ &.hds-link-standalone--icon-position-trailing::before {
59
+ left: -$shift-extra;
60
+ }
21
61
  }
22
62
 
63
+ .hds-link-standalone__text {
64
+ flex: 1 0 0;
65
+
66
+ .hds-link-standalone__icon + & {
67
+ margin-left: 0.375rem;
68
+ }
69
+
70
+ & +.hds-link-standalone__icon {
71
+ margin-left: 0.375rem;
72
+ }
73
+ }
74
+
75
+
76
+ // SIZE
77
+
23
78
  // these values later may come from the design tokens
24
79
  $size-props: (
25
80
  "small": (
26
81
  "font-size": 0.8125rem, // 13px;
27
- "icon-size": 0.75rem, // 12px
28
- "line-height": 0.75,
82
+ "icon-size": 1rem, // 16px
83
+ "line-height": 1.231, // ~16px
29
84
  ),
30
85
  "medium": (
31
86
  "font-size": 0.875rem, // 14px
32
87
  "icon-size": 1rem, // 16px
33
- "line-height": 1, // 16px
88
+ "line-height": 1.143, // ~16px
34
89
  ),
35
90
  "large": (
36
91
  "font-size": 1rem, // 16px
@@ -51,76 +106,73 @@ $size-props: (
51
106
  font-size: map-get($size-props, $size, "font-size");
52
107
  line-height: map-get($size-props, $size, "line-height");
53
108
  }
54
-
55
- }
56
- }
57
-
58
- .hds-link-standalone__text {
59
- flex: 1 0 0;
60
- .hds-link-standalone__icon + & {
61
- margin-left: 0.375rem;
62
- }
63
- & +.hds-link-standalone__icon {
64
- margin-left: 0.375rem;
65
109
  }
66
110
  }
67
111
 
68
112
  // COLORS & STATES
113
+ // The "primary" and "secondary" variants share a lot of styles for the interactive states
69
114
  // Note: the order of the pseuo-selectors need to stay the way they are
70
115
 
71
- .hds-link-standalone--color-primary {
72
- color: var(--token-color-action-foreground-on-faint);
73
-
74
- &:visited {
75
- color: var(--token-color-action-foreground-on-faint);
116
+ .hds-link-standalone {
117
+ &:focus,
118
+ &:focus-visible,
119
+ &.is-focus {
120
+ &::before {
121
+ @include hds-generic-focus-state();
122
+ }
76
123
  }
77
124
  &:hover,
78
125
  &.is-hover {
79
- text-decoration-color: #4E81E8;
80
126
  text-decoration: underline;
81
127
  transition: text-decoration-color 0.25s ease-in;
82
128
  }
83
- &:focus,
84
- &:focus-visible,
85
- &.is-focus {
86
- outline: 2px solid transparent;
87
- box-shadow:
88
- 0 0 0 $hds-link-standalone-border-width var(--token-color-action-border-on-primary),
89
- 0 0 0 $hds-link-standalone-focus-border-width #5990FF;
90
- }
91
129
  &:active,
92
130
  &.is-active {
93
- color: var(--token-color-action-foreground-high-contrast);
94
131
  text-decoration: underline;
95
- text-decoration-color: #596987;
132
+
133
+ }
134
+ // remove the focus ring on "active + focused" state (by design)
135
+ &:focus:active,
136
+ &:focus-visible:active,
137
+ &.is-focus.is-active {
96
138
  &::before {
97
- border-color: transparent;
139
+ content: none;
140
+ }
141
+ }
142
+
143
+ }
144
+
145
+ .hds-link-standalone--color-primary {
146
+ color: var(--token-color-action-foreground-primary);
147
+
148
+ &:hover,
149
+ &.is-hover {
150
+ color: var(--token-color-action-background-hover);
151
+ text-decoration-color: #4E81E8; // custom color by design
152
+ }
153
+ &:active,
154
+ &.is-active {
155
+ color: var(--token-color-action-background-active);
156
+ text-decoration-color: #396ED6; // custom color by design
157
+ &::before {
158
+ background-color: var(--token-color-action-background-faint);
98
159
  }
99
160
  }
100
161
  }
101
162
 
102
163
  .hds-link-standalone--color-secondary {
103
- background-color: transparent;
104
164
  color: var(--token-color-neutral-foreground-primary);
105
165
 
106
- &:focus,
107
- &:focus-visible,
108
- &.is-focus {
109
- outline: 2px solid transparent;
110
- box-shadow:
111
- 0 0 0 $hds-link-standalone-border-width var(--token-color-action-border-on-primary),
112
- 0 0 0 $hds-link-standalone-focus-border-width #5990FF;
113
- }
114
166
  &:hover,
115
167
  &.is-hover {
116
- text-decoration: underline;
117
- text-decoration-color: var(--token-color-neutral-foreground-primary);
168
+ text-decoration-color: #4D4D4F; // custom color by design
118
169
  }
119
- &:active,
170
+ &:active,
120
171
  &.is-active {
121
172
  color: var(--token-color-neutral-foreground-secondary);
122
- text-decoration: underline;
123
- text-decoration-color: var(--token-color-neutral-foreground-primary);
124
-
173
+ text-decoration-color: #6E7075; // custom color by design
174
+ &::before {
175
+ background-color: var(--token-color-palette-neutral-200);
176
+ }
125
177
  }
126
178
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashicorp/design-system-components",
3
- "version": "0.0.14",
3
+ "version": "0.0.18",
4
4
  "description": "HashiCorp Design System Components",
5
5
  "keywords": [
6
6
  "hashicorp",
@@ -61,7 +61,7 @@
61
61
  "prepare": "husky install"
62
62
  },
63
63
  "dependencies": {
64
- "@hashicorp/design-system-tokens": "^0.1.0",
64
+ "@hashicorp/design-system-tokens": "^0.4.3",
65
65
  "@hashicorp/ember-flight-icons": "^2.0.0",
66
66
  "ember-cli-babel": "^7.26.6",
67
67
  "ember-cli-htmlbars": "^5.7.1",
@@ -81,17 +81,20 @@
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",
93
95
  "ember-maybe-import-regenerator": "^0.1.6",
94
96
  "ember-page-title": "^6.2.2",
97
+ "ember-prism": "^0.12.0",
95
98
  "ember-qunit": "^5.1.4",
96
99
  "ember-resolver": "^8.0.2",
97
100
  "ember-source": "~3.28.0",
@@ -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
- }