@hashicorp/design-system-components 1.8.0 → 2.0.0
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.
- package/CHANGELOG.md +52 -0
- package/addon/components/hds/disclosure/index.js +3 -4
- package/addon/components/hds/dropdown/footer.hbs +3 -0
- package/addon/components/hds/dropdown/header.hbs +3 -0
- package/addon/components/hds/dropdown/index.hbs +20 -13
- package/addon/components/hds/dropdown/index.js +27 -10
- package/addon/components/hds/dropdown/list-item/checkbox.hbs +14 -0
- package/addon/components/hds/dropdown/list-item/checkbox.js +11 -0
- package/addon/components/hds/dropdown/list-item/checkmark.hbs +34 -0
- package/addon/components/hds/dropdown/list-item/checkmark.js +23 -0
- package/addon/components/hds/dropdown/list-item/copy-item.js +1 -1
- package/addon/components/hds/dropdown/list-item/description.js +1 -1
- package/addon/components/hds/dropdown/list-item/generic.hbs +1 -1
- package/addon/components/hds/dropdown/list-item/interactive.js +1 -1
- package/addon/components/hds/dropdown/list-item/radio.hbs +12 -0
- package/addon/components/hds/dropdown/list-item/radio.js +11 -0
- package/addon/components/hds/dropdown/list-item/separator.hbs +1 -1
- package/addon/components/hds/dropdown/list-item/title.js +4 -1
- package/addon/components/hds/dropdown/toggle/button.hbs +30 -21
- package/addon/components/hds/dropdown/toggle/button.js +52 -0
- package/addon/components/hds/dropdown/toggle/chevron.hbs +3 -0
- package/addon/components/hds/dropdown/toggle/icon.hbs +2 -2
- package/addon/components/hds/dropdown/toggle/icon.js +40 -0
- package/addon/components/hds/side-nav/header.hbs +5 -0
- package/addon/components/hds/side-nav/home-link.hbs +6 -0
- package/addon/components/hds/side-nav/home-link.js +25 -0
- package/addon/components/hds/side-nav/icon-button.hbs +5 -0
- package/addon/components/hds/side-nav/list/back-link.hbs +5 -0
- package/addon/components/hds/side-nav/list/index.hbs +5 -0
- package/addon/components/hds/side-nav/list/item.hbs +5 -0
- package/addon/components/hds/side-nav/list/link.hbs +5 -0
- package/addon/components/hds/side-nav/list/title.hbs +5 -0
- package/addon/components/hds/side-nav/wrapper.hbs +5 -0
- package/app/components/hds/dropdown/footer.js +1 -0
- package/app/components/hds/dropdown/header.js +1 -0
- package/app/components/hds/dropdown/list-item/checkbox.js +1 -0
- package/app/components/hds/dropdown/list-item/checkmark.js +1 -0
- package/app/components/hds/dropdown/list-item/radio.js +1 -0
- package/app/components/hds/dropdown/toggle/chevron.js +6 -0
- package/app/components/hds/side-nav/header.js +5 -0
- package/app/components/hds/side-nav/home-link.js +5 -0
- package/app/components/hds/side-nav/icon-button.js +5 -0
- package/app/components/hds/side-nav/list/back-link.js +5 -0
- package/app/components/hds/side-nav/list/index.js +5 -0
- package/app/components/hds/side-nav/list/item.js +5 -0
- package/app/components/hds/side-nav/list/link.js +5 -0
- package/app/components/hds/side-nav/list/title.js +5 -0
- package/app/components/hds/side-nav/wrapper.js +5 -0
- package/app/styles/components/button.scss +9 -254
- package/app/styles/components/dropdown.scss +260 -65
- package/app/styles/components/side-nav.scss +5 -0
- package/app/styles/mixins/_button.scss +280 -0
- package/blueprints/hds-component-test/index.js +4 -2
- package/package.json +4 -3
- /package/blueprints/hds-component-test/files/tests/dummy/app/styles/{pages → showcase-pages}/__dummyCSSFileName__.scss +0 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
$hds-button-sizes: ( "small", "medium", "large" );
|
|
7
|
+
$hds-button-border-radius: 5px;
|
|
8
|
+
$hds-button-border-width: 1px;
|
|
9
|
+
$hds-button-focus-border-width: 3px;
|
|
10
|
+
|
|
11
|
+
// these values later may come from the design tokens
|
|
12
|
+
$size-props: (
|
|
13
|
+
"small": (
|
|
14
|
+
"font-size": 0.8125rem, // 13px;
|
|
15
|
+
"line-height": 0.875rem, // 14px - we need to make it even (so we set it slighly larger than the font-size; notice: in Figma is 12px but this would cut some ascendants/descendants)
|
|
16
|
+
"min-height": 1.75rem, // 28px
|
|
17
|
+
"padding": 0.375rem 0.6875rem, // 6px 11px - here we're taking into account the 1px border
|
|
18
|
+
"icon-size": 0.75rem, // 12px
|
|
19
|
+
),
|
|
20
|
+
"medium": (
|
|
21
|
+
"font-size": 0.875rem, // 14px
|
|
22
|
+
"line-height": 1rem,// 16px
|
|
23
|
+
"min-height": 2.25rem, // 36px
|
|
24
|
+
"padding": 0.5625rem 0.9375rem, // 9px 15px - here we're taking into account the 1px border
|
|
25
|
+
"icon-size": 1rem, // 16px
|
|
26
|
+
),
|
|
27
|
+
"large": (
|
|
28
|
+
"font-size": 1rem, // 16px
|
|
29
|
+
"line-height": 1.5rem, // 24px
|
|
30
|
+
"min-height": 3rem, // 48px
|
|
31
|
+
"padding": 0.6875rem 1.1875rem, // 11px 19px - here we're taking into account the 1px border
|
|
32
|
+
"icon-size": 1.5rem, // 24px
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
@mixin hds-button() {
|
|
37
|
+
position: relative;
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
width: auto;
|
|
42
|
+
font-family: var(--token-typography-font-stack-text);
|
|
43
|
+
text-decoration: none;
|
|
44
|
+
border: $hds-button-border-width solid transparent; // We need this to be transparent for a11y
|
|
45
|
+
border-radius: $hds-button-border-radius;
|
|
46
|
+
outline-style: solid; // used to avoid double outline+focus-ring in Safari (see https://github.com/hashicorp/design-system-components/issues/161#issuecomment-1031548656)
|
|
47
|
+
outline-color: transparent; // We need this to be transparent for a11y
|
|
48
|
+
isolation: isolate;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@mixin hds-button-state-disabled() {
|
|
52
|
+
color: var(--token-color-foreground-disabled);
|
|
53
|
+
background-color: var(--token-color-surface-faint);
|
|
54
|
+
border-color: var(--token-color-border-primary);
|
|
55
|
+
box-shadow: none;
|
|
56
|
+
cursor: not-allowed;
|
|
57
|
+
|
|
58
|
+
&::before {
|
|
59
|
+
border-color: transparent;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@mixin hds-button-state-focus() {
|
|
64
|
+
box-shadow: none;
|
|
65
|
+
|
|
66
|
+
&::before {
|
|
67
|
+
// the position absolute of an element is computed from the inside of the border of the container
|
|
68
|
+
// so we have to take in account the border width of the pseudo-element container itself
|
|
69
|
+
$shift: $hds-button-border-width + $hds-button-focus-border-width;
|
|
70
|
+
position: absolute;
|
|
71
|
+
top: -$shift;
|
|
72
|
+
right: -$shift;
|
|
73
|
+
bottom: -$shift;
|
|
74
|
+
left: -$shift;
|
|
75
|
+
z-index: -1;
|
|
76
|
+
border: $hds-button-focus-border-width solid transparent;
|
|
77
|
+
border-radius: $hds-button-border-radius + $hds-button-focus-border-width;
|
|
78
|
+
content: "";
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@mixin hds-button-color-primary() {
|
|
83
|
+
color: var(--token-color-foreground-high-contrast);
|
|
84
|
+
background-color: var(--token-color-palette-blue-200);
|
|
85
|
+
border-color: var(--token-color-palette-blue-300);
|
|
86
|
+
box-shadow: var(--token-elevation-low-box-shadow);
|
|
87
|
+
|
|
88
|
+
&:hover,
|
|
89
|
+
&.mock-hover {
|
|
90
|
+
color: var(--token-color-foreground-high-contrast);
|
|
91
|
+
background-color: var(--token-color-palette-blue-300);
|
|
92
|
+
border-color: var(--token-color-palette-blue-400);
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&:focus,
|
|
97
|
+
&.mock-focus {
|
|
98
|
+
color: var(--token-color-foreground-high-contrast);
|
|
99
|
+
background-color: var(--token-color-palette-blue-200);
|
|
100
|
+
border-color: var(--token-color-focus-action-internal);
|
|
101
|
+
|
|
102
|
+
&::before {
|
|
103
|
+
// the position absolute of an element is computed from the inside of the border of the container
|
|
104
|
+
// so we have to take in account the border width of the pseudo-element container itself
|
|
105
|
+
// plus for the primary button we want to have a 2px gap between the button and the focus
|
|
106
|
+
$shift: $hds-button-border-width + $hds-button-focus-border-width + 2px;
|
|
107
|
+
top: -$shift;
|
|
108
|
+
right: -$shift;
|
|
109
|
+
bottom: -$shift;
|
|
110
|
+
left: -$shift;
|
|
111
|
+
border-color: var(--token-color-focus-action-external);
|
|
112
|
+
border-radius: $hds-button-border-radius + $hds-button-focus-border-width + 2px;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&:active,
|
|
117
|
+
&.mock-active {
|
|
118
|
+
color: var(--token-color-foreground-high-contrast);
|
|
119
|
+
background-color: var(--token-color-palette-blue-400);
|
|
120
|
+
border-color: var(--token-color-palette-blue-400);
|
|
121
|
+
box-shadow: none;
|
|
122
|
+
|
|
123
|
+
&::before {
|
|
124
|
+
border-color: transparent;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@mixin hds-button-color-secondary() {
|
|
130
|
+
color: var(--token-color-foreground-primary);
|
|
131
|
+
background-color: var(--token-color-surface-faint);
|
|
132
|
+
border-color: var(--token-color-border-strong);
|
|
133
|
+
box-shadow: var(--token-elevation-low-box-shadow);
|
|
134
|
+
|
|
135
|
+
&:hover,
|
|
136
|
+
&.mock-hover {
|
|
137
|
+
color: var(--token-color-foreground-primary);
|
|
138
|
+
background-color: var(--token-color-surface-primary);
|
|
139
|
+
border-color: var(--token-color-border-strong);
|
|
140
|
+
cursor: pointer;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&:focus,
|
|
144
|
+
&.mock-focus {
|
|
145
|
+
color: var(--token-color-foreground-primary);
|
|
146
|
+
background-color: var(--token-color-surface-faint);
|
|
147
|
+
border-color: var(--token-color-focus-action-internal);
|
|
148
|
+
|
|
149
|
+
&::before {
|
|
150
|
+
border-color: var(--token-color-focus-action-external);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
&:active,
|
|
155
|
+
&.mock-active {
|
|
156
|
+
color: var(--token-color-foreground-primary);
|
|
157
|
+
background-color: var(--token-color-surface-interactive-active);
|
|
158
|
+
border-color: var(--token-color-border-strong);
|
|
159
|
+
box-shadow: none;
|
|
160
|
+
|
|
161
|
+
&::before {
|
|
162
|
+
border-color: transparent;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@mixin hds-button-color-tertiary() {
|
|
168
|
+
color: var(--token-color-foreground-action);
|
|
169
|
+
background-color: transparent;
|
|
170
|
+
border-color: transparent;
|
|
171
|
+
|
|
172
|
+
&:hover,
|
|
173
|
+
&.mock-hover {
|
|
174
|
+
color: var(--token-color-foreground-action-hover);
|
|
175
|
+
background-color: var(--token-color-surface-primary);
|
|
176
|
+
border-color: var(--token-color-border-strong);
|
|
177
|
+
cursor: pointer;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&:focus,
|
|
181
|
+
&.mock-focus {
|
|
182
|
+
color: var(--token-color-foreground-action);
|
|
183
|
+
border-color: var(--token-color-focus-action-internal);
|
|
184
|
+
|
|
185
|
+
&::before {
|
|
186
|
+
border-color: var(--token-color-focus-action-external);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&:active,
|
|
191
|
+
&.mock-active {
|
|
192
|
+
color: var(--token-color-foreground-action-active);
|
|
193
|
+
background-color: var(--token-color-surface-interactive-active);
|
|
194
|
+
border-color: var(--token-color-border-strong);
|
|
195
|
+
box-shadow: none;
|
|
196
|
+
|
|
197
|
+
&::before {
|
|
198
|
+
border-color: transparent;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
//
|
|
203
|
+
// IMPORTANT: we need to use also the [disabled] selector because if the "disabled" attribute is applied to a "Button as link",
|
|
204
|
+
// the ":disabled" pseudo-selector is not applied to the element in the browser (rightly) because a link can't be disabled
|
|
205
|
+
// but from the product perspective there may be use cases where they need to have a "Button as link" that looks disabled anyway
|
|
206
|
+
//
|
|
207
|
+
&:disabled,
|
|
208
|
+
&[disabled],
|
|
209
|
+
&.mock-disabled,
|
|
210
|
+
&:disabled:focus,
|
|
211
|
+
&[disabled]:focus,
|
|
212
|
+
&.mock-disabled:focus,
|
|
213
|
+
&:disabled:hover,
|
|
214
|
+
&[disabled]:hover,
|
|
215
|
+
&.mock-disabled:hover {
|
|
216
|
+
background-color: transparent;
|
|
217
|
+
border-color: transparent;
|
|
218
|
+
|
|
219
|
+
&::before {
|
|
220
|
+
border-color: transparent;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
@mixin hds-button-color-critical() {
|
|
226
|
+
color: var(--token-color-foreground-critical-on-surface);
|
|
227
|
+
background-color: var(--token-color-surface-critical);
|
|
228
|
+
border-color: var(--token-color-foreground-critical-on-surface);
|
|
229
|
+
box-shadow: var(--token-elevation-low-box-shadow);
|
|
230
|
+
|
|
231
|
+
&:hover,
|
|
232
|
+
&.mock-hover {
|
|
233
|
+
color: var(--token-color-foreground-high-contrast);
|
|
234
|
+
background-color: var(--token-color-palette-red-300);
|
|
235
|
+
border-color: var(--token-color-palette-red-400);
|
|
236
|
+
cursor: pointer;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
&:focus,
|
|
240
|
+
&.mock-focus {
|
|
241
|
+
color: var(--token-color-foreground-critical-on-surface);
|
|
242
|
+
background-color: var(--token-color-surface-critical);
|
|
243
|
+
border-color: var(--token-color-focus-critical-internal);
|
|
244
|
+
|
|
245
|
+
&::before {
|
|
246
|
+
border-color: var(--token-color-focus-critical-external);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
&:active,
|
|
251
|
+
&.mock-active {
|
|
252
|
+
color: var(--token-color-foreground-high-contrast);
|
|
253
|
+
background-color: var(--token-color-palette-red-400);
|
|
254
|
+
border-color: var(--token-color-palette-red-400);
|
|
255
|
+
box-shadow: none;
|
|
256
|
+
|
|
257
|
+
&::before {
|
|
258
|
+
border-color: transparent;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
@mixin hds-button-size-classes($blockName) {
|
|
264
|
+
@each $size in $hds-button-sizes {
|
|
265
|
+
.#{$blockName}--size-#{$size} {
|
|
266
|
+
min-height: map-get($size-props, $size, "min-height");
|
|
267
|
+
padding: map-get($size-props, $size, "padding");
|
|
268
|
+
|
|
269
|
+
.#{$blockName}__icon {
|
|
270
|
+
width: map-get($size-props, $size, "icon-size");
|
|
271
|
+
height: map-get($size-props, $size, "icon-size");
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.#{$blockName}__text {
|
|
275
|
+
font-size: map-get($size-props, $size, "font-size");
|
|
276
|
+
line-height: map-get($size-props, $size, "line-height");
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
@@ -64,7 +64,9 @@ const updateDummyAppCSS = (options) => {
|
|
|
64
64
|
firstComponentImportIndex,
|
|
65
65
|
lastComponentImportIndex + 1
|
|
66
66
|
);
|
|
67
|
-
importLinesArray.push(
|
|
67
|
+
importLinesArray.push(
|
|
68
|
+
`@import "./showcase-pages/${getDummyCSSFileName(name)}";`
|
|
69
|
+
);
|
|
68
70
|
const newImportLinesArray = importLinesArray
|
|
69
71
|
.filter((line, index, self) => self.indexOf(line) === index)
|
|
70
72
|
.sort();
|
|
@@ -126,6 +128,6 @@ const getRoutedModuleName = (name) => {
|
|
|
126
128
|
|
|
127
129
|
const getDummyCSSFileName = (name) => {
|
|
128
130
|
const parts = name.split('/');
|
|
129
|
-
const fileName =
|
|
131
|
+
const fileName = `${parts.pop()}`;
|
|
130
132
|
return `${parts.concat([fileName]).join('/')}`;
|
|
131
133
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashicorp/design-system-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Helios Design System Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hashicorp",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"test:ember:percy": "percy exec ember test"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"@ember/render-modifiers": "^2.0.5",
|
|
40
41
|
"@hashicorp/design-system-tokens": "^1.4.1",
|
|
41
42
|
"@hashicorp/ember-flight-icons": "^3.0.2",
|
|
42
43
|
"dialog-polyfill": "^0.5.6",
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
"@embroider/test-setup": "^2.0.2",
|
|
61
62
|
"@glimmer/component": "^1.1.2",
|
|
62
63
|
"@glimmer/tracking": "^1.1.2",
|
|
63
|
-
"@percy/cli": "^1.
|
|
64
|
+
"@percy/cli": "^1.21.0",
|
|
64
65
|
"@percy/ember": "^4.2.0",
|
|
65
66
|
"babel-eslint": "^10.1.0",
|
|
66
67
|
"broccoli-asset-rev": "^3.0.0",
|
|
@@ -99,7 +100,7 @@
|
|
|
99
100
|
"stylelint": "^14.16.1",
|
|
100
101
|
"stylelint-config-rational-order": "^0.1.2",
|
|
101
102
|
"stylelint-config-standard-scss": "^5.0.0",
|
|
102
|
-
"webpack": "^5.
|
|
103
|
+
"webpack": "^5.76.0"
|
|
103
104
|
},
|
|
104
105
|
"engines": {
|
|
105
106
|
"node": "12.* || 14.* || >= 16"
|