@hashicorp/design-system-components 0.0.3 → 0.0.8

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,246 @@
1
+ // Button Component Styles
2
+
3
+ $border-radius: 5px;
4
+
5
+ // TODO! generalize with the existing mixin in Card component
6
+ @mixin tempElevation() {
7
+ box-shadow:
8
+ var(--token-elevation-low-shadow-01-x)
9
+ var(--token-elevation-low-shadow-01-y)
10
+ var(--token-elevation-low-shadow-01-blur)
11
+ var(--token-elevation-low-shadow-01-spread)
12
+ var(--token-elevation-low-shadow-01-color),
13
+ var(--token-elevation-low-shadow-02-x)
14
+ var(--token-elevation-low-shadow-02-y)
15
+ var(--token-elevation-low-shadow-02-blur)
16
+ var(--token-elevation-low-shadow-02-spread)
17
+ var(--token-elevation-low-shadow-02-color)
18
+ ;
19
+ }
20
+
21
+ .hds-button {
22
+ @include tempElevation();
23
+
24
+ align-items: center;
25
+ border: 1px solid transparent; // We need this to be transparent for a11y
26
+ border-radius: $border-radius;
27
+ box-sizing: border-box; // TODO https://github.com/hashicorp/design-system-components/issues/46
28
+ display: flex;
29
+ font-family: var(--token-typography-body-base-font-family);
30
+ justify-content: center;
31
+ outline-color: transparent; // We need this to be transparent for a11y
32
+ max-width: fit-content;
33
+ position: relative;
34
+ width: auto;
35
+
36
+ // This covers all of the browsers and focus scenarios (due to the custom focus design).
37
+ &:disabled,
38
+ &[disabled],
39
+ &.is-disabled,
40
+ &:disabled:hover,
41
+ &[disabled]:hover,
42
+ &.is-disabled:hover,
43
+ &:disabled:focus,
44
+ &[disabled]:focus,
45
+ &.is-disabled:focus,
46
+ &:disabled:focus-visible,
47
+ &[disabled]:focus-visible,
48
+ &.is-disabled:focus-visible {
49
+ background-color: var(--token-color-palette-neutral-50);
50
+ border-color: var(--token-color-palette-alpha-200);
51
+ box-shadow: none;
52
+ color: var(--token-color-palette-neutral-400);
53
+ cursor: not-allowed;
54
+ outline-color: var(--token-color-palette-alpha-200);
55
+
56
+ &::before {
57
+ border-color: transparent;
58
+ }
59
+ }
60
+
61
+ &.hds-button--width-full {
62
+ width: 100%;
63
+ max-width: 100%;
64
+
65
+ .hds-button__text {
66
+ flex: 0 0 auto;
67
+ }
68
+ }
69
+
70
+ &.is-focus,
71
+ &:focus,
72
+ &:focus-visible {
73
+ &::before {
74
+ border-radius: $border-radius + 3px;
75
+ border: 3px solid transparent;
76
+ bottom: -4px;
77
+ box-sizing: border-box;
78
+ content: '';
79
+ left: -4px;
80
+ position: absolute;
81
+ right: -4px;
82
+ top: -4px;
83
+ }
84
+ }
85
+ }
86
+
87
+ .hds-button__text {
88
+ flex: 1 0 0;
89
+ .hds-button__icon + & {
90
+ margin-left: 0.375rem;
91
+ }
92
+ & +.hds-button__icon {
93
+ margin-left: 0.375rem;
94
+ }
95
+ }
96
+
97
+
98
+ // SIZE
99
+
100
+ .hds-button--size-small {
101
+ font-size: 0.8125rem; // 13px;
102
+ min-height: 1.75rem; //28px
103
+ line-height: 1;
104
+ padding: 0 1rem;
105
+
106
+ .hds-button__icon {
107
+ height: 0.75rem; // 12px
108
+ width: 0.75rem; // 12px
109
+ }
110
+ }
111
+
112
+ .hds-button--size-medium {
113
+ font-size: 0.875rem; // 14px
114
+ line-height: 1rem; // 16px
115
+ min-height: 2.25rem; //36px
116
+ padding: 0.625rem 1rem;
117
+
118
+ .hds-button__icon {
119
+ height: 1rem;
120
+ width: 1rem;
121
+ }
122
+ }
123
+
124
+ .hds-button--size-large {
125
+ font-size: 1rem; //16px
126
+ line-height: 1.5rem; // 24px
127
+ min-height: 3rem; //48px
128
+ padding: 0.75rem 1.25rem; // 12px 20px
129
+
130
+ .hds-button__icon {
131
+ height: 1.5rem;
132
+ width: 1.5rem;
133
+ }
134
+ }
135
+
136
+ // COLORS & STATES
137
+ // 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.
138
+
139
+ .hds-button--color-primary {
140
+ background-color: var(--token-color-action-background-primary);
141
+ border-color: var(--token-color-action-border-on-primary);
142
+ color: var(--token-color-palette-neutral-0);
143
+
144
+ &:focus,
145
+ &:focus-visible,
146
+ &.is-focus {
147
+ background-color: var(--token-color-action-background-primary);
148
+ border-color: var(--token-color-action-border-on-primary);
149
+ color: var(--token-color-palette-neutral-0);
150
+ &::before {
151
+ border-color: var(--token-color-action-background-primary);
152
+ bottom: -6px;
153
+ left: -6px;
154
+ right: -6px;
155
+ top: -6px;
156
+ }
157
+ }
158
+ &:hover,
159
+ &.is-hover {
160
+ background-color: var(--token-color-action-background-hover);
161
+ border-color: var(--token-color-action-border-on-hover);
162
+ color: var(--token-color-palette-neutral-0);
163
+ cursor: pointer;
164
+ }
165
+ &:active,
166
+ &.is-active {
167
+ background-color: var(--token-color-action-background-active);
168
+ border-color: var(--token-color-action-background-active);
169
+ box-shadow: none;
170
+ color: var(--token-color-palette-neutral-0);
171
+ &::before {
172
+ border-color: transparent;
173
+ }
174
+ }
175
+ }
176
+
177
+ .hds-button--color-secondary {
178
+ background-color: var(--token-color-palette-neutral-50);
179
+ border-color: var(--token-color-palette-alpha-300);
180
+ color: var(--token-color-palette-neutral-600);
181
+
182
+ &:focus,
183
+ &:focus-visible,
184
+ &.is-focus {
185
+ background-color: var(--token-color-palette-neutral-50);
186
+ border-color: var(--token-color-action-border-on-primary);
187
+ color: var(--token-color-palette-neutral-600);
188
+ outline-color: var(--token-color-action-border-on-primary);
189
+ &::before {
190
+ border-color: #5990FF;
191
+ }
192
+ }
193
+ &:hover,
194
+ &.is-hover {
195
+ background-color: var(--token-color-palette-neutral-0);
196
+ border-color: var(--token-color-palette-alpha-300);
197
+ color: var(--token-color-palette-neutral-600);
198
+ cursor: pointer;
199
+ }
200
+ &:active,
201
+ &.is-active {
202
+ background-color: var(--token-color-palette-neutral-200);
203
+ border-color: var(--token-color-palette-alpha-300);
204
+ box-shadow: none;
205
+ color: var(--token-color-palette-neutral-600);
206
+ &::before {
207
+ border-color: transparent;
208
+ }
209
+ }
210
+ }
211
+
212
+ .hds-button--color-destructive {
213
+ background-color: var(--token-color-palette-neutral-50);
214
+ border-color: var(--token-color-palette-alpha-300);
215
+ color: var(--token-color-critical-foreground-on-faint);
216
+
217
+ &:focus,
218
+ &:focus-visible,
219
+ &.is-focus {
220
+ background-color: var(--token-color-palette-neutral-50);
221
+ border-color: var(--token-color-critical-border-on-primary);
222
+ color: var(--token-color-critical-foreground-on-faint);
223
+ outline-color: var(--token-color-critical-border-on-primary);
224
+ &::before {
225
+ border-color: #DD7578;
226
+ }
227
+ }
228
+ &:hover,
229
+ &.is-hover {
230
+ background-color: var(--token-color-critical-background-hover);
231
+ border-color: var(--token-color-critical-border-on-hover);
232
+ color: var(--token-color-palette-neutral-0);
233
+ cursor: pointer;
234
+ }
235
+
236
+ &:active,
237
+ &.is-active {
238
+ background-color: var(--token-color-critical-background-active);
239
+ border-color: var(--token-color-critical-background-active);
240
+ box-shadow: none;
241
+ color: var(--token-color-palette-neutral-0);
242
+ &::before {
243
+ border-color: transparent;
244
+ }
245
+ }
246
+ }
@@ -0,0 +1,101 @@
1
+ //
2
+ // CARD COMPONENT > CONTAINER
3
+ //
4
+ // properties within each class are sorted alphabetically
5
+ //
6
+ //
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
+
59
+ $hds-card-container-levels: ( 'base', 'mid', 'high' );
60
+
61
+ $hds-card-container-border-radius: 6px;
62
+
63
+ .hds-card__container {
64
+ background-color: #fff;
65
+ border-radius: $hds-card-container-border-radius;
66
+ position: relative;
67
+ }
68
+
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
+
82
+ // BACKGROUND
83
+
84
+ .hds-card__container--background-neutral-primary {
85
+ background-color: var(--token-color-neutral-background-primary);
86
+ }
87
+
88
+ .hds-card__container--background-neutral-secondary {
89
+ background-color: var(--token-color-neutral-background-secondary);
90
+ }
91
+
92
+
93
+ // OVERFLOW
94
+
95
+ .hds-card__container--overflow-hidden {
96
+ overflow: hidden;
97
+ }
98
+
99
+ .hds-card__container--overflow-visible {
100
+ overflow: visible;
101
+ }
@@ -0,0 +1,5 @@
1
+ //
2
+ // CARD COMPONENT
3
+ //
4
+
5
+ @use "./container";
@@ -0,0 +1,147 @@
1
+ //
2
+ // ICON-TILE
3
+ //
4
+ // properties within each class are sorted alphabetically
5
+ //
6
+ //
7
+
8
+ $hds-icon-tile-sizes: ( 'small', 'medium', 'large' );
9
+ $hds-icon-tile-types: ( 'object','resource','logo' );
10
+ $hds-icon-tile-colors-products: ( 'boundary', 'consul', 'nomad', 'packer', 'terraform', 'vagrant', 'vault', 'waypoint' );
11
+
12
+ $hds-icon-tile-border-width: 1px;
13
+ $hds-icon-tile-box-shadow: 0px 1px 1px rgba(#656A76, 0.05);
14
+
15
+
16
+ .hds-icon-tile {
17
+ border-radius: 4px;
18
+ border: $hds-icon-tile-border-width solid transparent;
19
+ box-shadow: $hds-icon-tile-box-shadow;
20
+ box-sizing: border-box;
21
+ display: flex;
22
+ position: relative;
23
+ }
24
+
25
+ .hds-icon-tile__icon,
26
+ .hds-icon-tile__logo {
27
+ display: flex;
28
+ margin: auto;
29
+ }
30
+
31
+ .hds-icon-tile__extra {
32
+ background-color: var(--token-color-neutral-background-primary);
33
+ border: 1px solid var(--token-color-palette-alpha-200);
34
+ bottom: -6px;
35
+ box-shadow: $hds-icon-tile-box-shadow;
36
+ box-sizing: content-box; // the border is outside
37
+ right: -6px;
38
+ display: flex;
39
+ position: absolute;
40
+ }
41
+
42
+ .hds-icon-tile__extra-icon {
43
+ display: flex;
44
+ margin: auto;
45
+ color: var(--token-color-neutral-foreground-primary);
46
+ }
47
+
48
+ // SIZE
49
+
50
+ // these values later may come from the design tokens
51
+ $size-props: (
52
+ "small": (
53
+ "size": 1.75rem, // 28px
54
+ "border-radius": 5px,
55
+ "icon-size": 1rem,
56
+ "logo-size": 1.25rem,
57
+ 'extra-size': 1.125rem,
58
+ 'extra-border-radius': 4px,
59
+ 'extra-icon-size': 0.75rem,
60
+ ),
61
+ "medium": (
62
+ "size": 2.5rem, // 40px
63
+ "border-radius": 6px,
64
+ "icon-size": 1.5rem,
65
+ "logo-size": 2.25rem,
66
+ 'extra-size': 1.5rem,
67
+ 'extra-border-radius': 5px,
68
+ 'extra-icon-size': 1rem,
69
+ ),
70
+ "large": (
71
+ "size": 3rem, // 48px
72
+ "border-radius": 6px,
73
+ "icon-size": 1.5rem,
74
+ "logo-size": 2.25rem,
75
+ 'extra-size': 1.5rem,
76
+ 'extra-border-radius': 5px,
77
+ 'extra-icon-size': 1rem,
78
+ )
79
+ );
80
+
81
+ @each $size in $hds-icon-tile-sizes {
82
+ .hds-icon-tile--size-#{$size} {
83
+ width: map-get($size-props, $size, "size");
84
+ height: map-get($size-props, $size, "size");
85
+ border-radius: map-get($size-props, $size, "border-radius");
86
+
87
+ .hds-icon-tile__icon {
88
+ height: map-get($size-props, $size, "icon-size");
89
+ width: map-get($size-props, $size, "icon-size");
90
+ }
91
+
92
+ .hds-icon-tile__logo {
93
+ height: map-get($size-props, $size, "logo-size");
94
+ width: map-get($size-props, $size, "logo-size");
95
+ }
96
+
97
+ .hds-icon-tile__extra {
98
+ border-radius: map-get($size-props, $size, "extra-border-radius");
99
+ height: map-get($size-props, $size, "extra-size");
100
+ width: map-get($size-props, $size, "extra-size");
101
+ }
102
+
103
+ .hds-icon-tile__extra-icon {
104
+ height: map-get($size-props, $size, "extra-icon-size");
105
+ width: map-get($size-props, $size, "extra-icon-size");
106
+ }
107
+ }
108
+ }
109
+
110
+
111
+ // LOGO - COLOR
112
+
113
+ .hds-icon-tile--logo {
114
+ background-color: var(--token-color-neutral-background-primary);
115
+ border-color: var(--token-color-neutral-border-primary);
116
+
117
+ @each $product in $hds-icon-tile-colors-products {
118
+ &.hds-icon-tile--color-#{$product} {
119
+ color: var(--token-color-#{$product}-brand);
120
+ }
121
+ }
122
+
123
+ // exception for Vault, where the color of the logo needs to be the "alt" one
124
+ &.hds-icon-tile--color-vault {
125
+ color: var(--token-color-vault-brand-alt);
126
+ }
127
+ }
128
+
129
+ // ICON - COLOR
130
+
131
+ .hds-icon-tile--icon {
132
+
133
+ &.hds-icon-tile--color-neutral {
134
+ background-color: var(--token-color-neutral-background-secondary);
135
+ border-color: var(--token-color-neutral-border-primary);
136
+ color: var(--token-color-neutral-foreground-faint);
137
+ }
138
+
139
+ @each $product in $hds-icon-tile-colors-products {
140
+ &.hds-icon-tile--color-#{$product} {
141
+ background: linear-gradient(135deg, var(--token-color-#{$product}-gradient-faint-start) 0%, var(--token-color-#{$product}-gradient-faint-stop) 100%);
142
+ border-color: var(--token-color-#{$product}-border);
143
+ color: var(--token-color-#{$product}-brand);
144
+ }
145
+ }
146
+ }
147
+
package/index.js CHANGED
@@ -1,9 +1,5 @@
1
1
  'use strict';
2
2
 
3
- // let Funnel = require('broccoli-funnel');
4
- // let mergeTrees = require('broccoli-merge-trees');
5
- // let path = require('path');
6
-
7
3
  module.exports = {
8
4
  name: require('./package').name,
9
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashicorp/design-system-components",
3
- "version": "0.0.3",
3
+ "version": "0.0.8",
4
4
  "description": "HashiCorp Design System Components",
5
5
  "keywords": [
6
6
  "hashicorp",
@@ -52,10 +52,11 @@
52
52
  "start": "ember serve",
53
53
  "test": "npm-run-all lint test:*",
54
54
  "test:ember": "ember test",
55
- "test:ember-compatibility": "ember try:each"
55
+ "test:ember-compatibility": "ember try:each",
56
+ "test:ember:percy": "percy exec ember test"
56
57
  },
57
58
  "dependencies": {
58
- "@hashicorp/design-system-tokens": "^0.0.3",
59
+ "@hashicorp/design-system-tokens": "^0.0.13",
59
60
  "@hashicorp/ember-flight-icons": "^1.2.0",
60
61
  "ember-cli-babel": "^7.26.6",
61
62
  "ember-cli-htmlbars": "^5.7.1",
@@ -68,6 +69,8 @@
68
69
  "@embroider/test-setup": "^0.41.0",
69
70
  "@glimmer/component": "^1.0.4",
70
71
  "@glimmer/tracking": "^1.0.4",
72
+ "@percy/cli": "^1.0.0-beta.70",
73
+ "@percy/ember": "^3.0.0",
71
74
  "babel-eslint": "^10.1.0",
72
75
  "broccoli-asset-rev": "^3.0.0",
73
76
  "ember-auto-import": "^2.2.3",
@@ -87,6 +90,7 @@
87
90
  "ember-source": "~3.27.2",
88
91
  "ember-source-channel-url": "^3.0.0",
89
92
  "ember-template-lint": "^3.4.2",
93
+ "ember-truth-helpers": "^3.0.0",
90
94
  "ember-try": "^1.4.0",
91
95
  "eslint": "^7.27.0",
92
96
  "eslint-config-prettier": "^8.3.0",