@hashicorp/design-system-components 0.9.2 → 0.11.1
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 +41 -0
- package/NEW-COMPONENT-CHECKLIST.md +64 -3
- package/README.md +2 -2
- package/addon/components/hds/alert/description.hbs +1 -0
- package/addon/components/hds/alert/index.hbs +31 -0
- package/addon/components/hds/alert/index.js +128 -0
- package/addon/components/hds/alert/title.hbs +1 -0
- package/addon/components/hds/disclosure/index.hbs +10 -10
- package/addon/components/hds/disclosure/index.js +28 -17
- package/addon/components/hds/dropdown/index.hbs +10 -13
- package/addon/components/hds/dropdown/index.js +45 -0
- package/addon/components/hds/dropdown/list-item/copy-item.hbs +20 -0
- package/addon/components/hds/dropdown/list-item/copy-item.js +55 -0
- package/addon/components/hds/dropdown/list-item/description.hbs +3 -0
- package/addon/components/hds/dropdown/list-item/description.js +38 -0
- package/addon/components/hds/dropdown/list-item/generic.hbs +3 -0
- package/addon/components/hds/dropdown/list-item/interactive.hbs +44 -0
- package/addon/components/hds/dropdown/list-item/interactive.js +59 -0
- package/addon/components/hds/dropdown/list-item/separator.hbs +1 -0
- package/addon/components/hds/dropdown/list-item/title.hbs +3 -0
- package/addon/components/hds/dropdown/list-item/title.js +35 -0
- package/addon/components/hds/dropdown/{toggle-button.hbs → toggle/button.hbs} +3 -3
- package/addon/components/hds/dropdown/{toggle-button.js → toggle/button.js} +21 -3
- package/addon/components/hds/dropdown/toggle/icon.hbs +12 -0
- package/addon/components/hds/dropdown/{toggle-icon.js → toggle/icon.js} +28 -13
- package/addon/components/hds/toast/index.hbs +20 -0
- package/addon/components/hds/yield/index.hbs +3 -0
- package/app/components/hds/{dropdown/list-item.js → alert/description.js} +1 -1
- package/app/components/hds/{dropdown/toggle-icon.js → alert/index.js} +1 -1
- package/app/components/hds/{dropdown/toggle-button.js → alert/title.js} +1 -1
- package/app/components/hds/dropdown/list-item/copy-item.js +1 -0
- package/app/components/hds/dropdown/list-item/description.js +1 -0
- package/app/components/hds/dropdown/list-item/generic.js +1 -0
- package/app/components/hds/dropdown/list-item/interactive.js +1 -0
- package/app/components/hds/dropdown/list-item/separator.js +1 -0
- package/app/components/hds/dropdown/list-item/title.js +1 -0
- package/app/components/hds/dropdown/toggle/button.js +1 -0
- package/app/components/hds/dropdown/toggle/icon.js +1 -0
- package/app/components/hds/toast/index.js +1 -0
- package/app/components/hds/yield/index.js +1 -0
- package/app/styles/@hashicorp/design-system-components.scss +2 -0
- package/app/styles/components/alert.scss +274 -0
- package/app/styles/components/dropdown.scss +152 -150
- package/app/styles/components/toast.scss +16 -0
- package/blueprints/hds-component/files/addon/components/hds/__name__/index.hbs +4 -0
- package/blueprints/hds-component/files/addon/components/hds/__name__/index.js +23 -0
- package/blueprints/hds-component/files/app/components/hds/__name__/index.js +1 -0
- package/blueprints/hds-component/files/app/styles/components/__name__.scss +6 -0
- package/blueprints/hds-component/index.js +26 -0
- package/blueprints/hds-component-test/files/tests/dummy/app/routes/components/__name__.js +3 -0
- package/blueprints/hds-component-test/files/tests/dummy/app/styles/pages/__dummyCSSFileName__.scss +1 -0
- package/blueprints/hds-component-test/files/tests/dummy/app/templates/components/__name__.hbs +65 -0
- package/blueprints/hds-component-test/files/tests/integration/components/hds/__name__/index-test.js +17 -0
- package/blueprints/hds-component-test/index.js +126 -0
- package/package.json +28 -28
- package/addon/components/hds/dropdown/list-item.hbs +0 -84
- package/addon/components/hds/dropdown/list-item.js +0 -120
- package/addon/components/hds/dropdown/toggle-icon.hbs +0 -22
|
@@ -20,29 +20,33 @@
|
|
|
20
20
|
|
|
21
21
|
@use '../mixins/focus-ring' as *;
|
|
22
22
|
|
|
23
|
+
$hds-dropdown-toggle-base-height: 36px;
|
|
24
|
+
$hds-dropdown-toggle-border-radius: 5px;
|
|
25
|
+
|
|
26
|
+
|
|
23
27
|
// TOGGLE/ICON
|
|
28
|
+
|
|
24
29
|
.hds-dropdown-toggle-icon {
|
|
25
30
|
align-items: center;
|
|
26
31
|
background-color: transparent;
|
|
27
32
|
border: 1px solid transparent; // We need this to be transparent for a11y
|
|
28
|
-
border-radius:
|
|
33
|
+
border-radius: $hds-dropdown-toggle-border-radius;
|
|
29
34
|
display: flex;
|
|
30
|
-
height:
|
|
35
|
+
height: $hds-dropdown-toggle-base-height;
|
|
31
36
|
justify-content: center;
|
|
37
|
+
min-width: $hds-dropdown-toggle-base-height;
|
|
32
38
|
outline-style: solid; // used to avoid double outline+focus-ring in Safari (see https://github.com/hashicorp/design-system-components/issues/161#issuecomment-1031548656)
|
|
33
39
|
outline-color: transparent; // We need this to be transparent for a11y
|
|
34
40
|
padding: 1px;
|
|
35
|
-
min-width: 36px;
|
|
36
41
|
|
|
37
|
-
&:hover,
|
|
42
|
+
&:hover,
|
|
38
43
|
&.is-hover {
|
|
39
44
|
background-color: var(--token-color-surface-interactive);
|
|
40
45
|
border-color: var(--token-color-border-strong);
|
|
41
46
|
cursor: pointer;
|
|
42
47
|
}
|
|
43
48
|
|
|
44
|
-
|
|
45
|
-
@include hds-focus-ring-with-pseudo-element($top: -1px, $right: -1px, $bottom: -1px, $left: -1px, $radius: 5px);
|
|
49
|
+
@include hds-focus-ring-with-pseudo-element($top: -1px, $right: -1px, $bottom: -1px, $left: -1px, $radius: $hds-dropdown-toggle-border-radius);
|
|
46
50
|
|
|
47
51
|
&:active,
|
|
48
52
|
&.is-active {
|
|
@@ -53,7 +57,7 @@
|
|
|
53
57
|
|
|
54
58
|
.hds-dropdown-toggle-icon__wrapper {
|
|
55
59
|
align-items: center;
|
|
56
|
-
border-radius: 3px; //
|
|
60
|
+
border-radius: 3px; // $hds-dropdown-toggle-border-radius - 1px padding - 1px border
|
|
57
61
|
display: flex;
|
|
58
62
|
justify-content: center;
|
|
59
63
|
height: 32px;
|
|
@@ -62,21 +66,43 @@
|
|
|
62
66
|
|
|
63
67
|
img {
|
|
64
68
|
border-radius: inherit;
|
|
69
|
+
height: 100%;
|
|
65
70
|
object-fit: cover; // this will make sure it's correct even if the item isn't square
|
|
71
|
+
width: 100%;
|
|
66
72
|
}
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
.hds-dropdown-toggle-icon__chevron {
|
|
70
|
-
margin-left:
|
|
76
|
+
margin-left: 4px;
|
|
77
|
+
|
|
78
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
79
|
+
transition: transform .3s;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.hds-dropdown-toggle-icon--is-open & {
|
|
83
|
+
transform: rotate(-180deg);
|
|
84
|
+
}
|
|
71
85
|
}
|
|
72
86
|
|
|
73
87
|
// TOGGLE/BUTTON
|
|
74
|
-
|
|
88
|
+
|
|
89
|
+
.hds-dropdown-toggle-button {
|
|
75
90
|
box-shadow: none; // we override this to remove the elevation style
|
|
76
91
|
|
|
77
92
|
.hds-button__icon {
|
|
93
|
+
margin-left: 8px; // this overrides the rule `.hds-button__text + .hds-button__icon`
|
|
78
94
|
margin-right: -6px; // we apply a negative margin to counter the padding-right of the button and reduce the visual space between the icon and the right border
|
|
79
|
-
|
|
95
|
+
|
|
96
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
97
|
+
transition: transform .3s;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
.hds-dropdown-toggle-button--is-open {
|
|
104
|
+
.hds-button__icon {
|
|
105
|
+
transform: rotate(-180deg);
|
|
80
106
|
}
|
|
81
107
|
}
|
|
82
108
|
|
|
@@ -91,71 +117,37 @@
|
|
|
91
117
|
box-shadow: var(--token-surface-high-box-shadow);
|
|
92
118
|
list-style: none;
|
|
93
119
|
margin: 0;
|
|
94
|
-
max-width:
|
|
95
|
-
min-width:
|
|
120
|
+
max-width: 400px;
|
|
121
|
+
min-width: 200px;
|
|
96
122
|
padding: 4px 0;
|
|
97
|
-
|
|
98
|
-
position: absolute;
|
|
99
|
-
right: 0;
|
|
100
|
-
top: calc(100% + 0.25rem);
|
|
101
|
-
z-index: 2; // https://github.com/hashicorp/design-system/issues/114
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
&.hds-dropdown-list--position-left {
|
|
105
|
-
position: absolute;
|
|
106
|
-
left: 0;
|
|
107
|
-
top: calc(100% + 0.25rem);
|
|
108
|
-
z-index: 2; // https://github.com/hashicorp/design-system/issues/114
|
|
109
|
-
}
|
|
123
|
+
width: max-content; // notice: this is important because being in a position absolute means the layout algorithm assigns a width of 0 and this impacts on the flex algorithm of the children (in some cases they don't use the full width)
|
|
110
124
|
}
|
|
111
125
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
.hds-dropdown-list-item--title {
|
|
116
|
-
color: var(--token-color-foreground-strong);
|
|
117
|
-
font-family: var(--token-typography-body-100-font-family);
|
|
118
|
-
font-size: var(--token-typography-body-100-font-size);
|
|
119
|
-
font-weight: var(--token-typography-font-weight-semibold);
|
|
120
|
-
line-height: var(--token-typography-body-100-line-height);
|
|
121
|
-
padding: 10px 16px 4px;
|
|
126
|
+
.hds-dropdown-list--fixed-width {
|
|
127
|
+
max-width: initial;
|
|
128
|
+
min-width: initial;
|
|
122
129
|
}
|
|
123
130
|
|
|
124
|
-
.hds-dropdown-list-
|
|
125
|
-
|
|
126
|
-
|
|
131
|
+
.hds-dropdown-list--position-right {
|
|
132
|
+
position: absolute;
|
|
133
|
+
right: 0;
|
|
134
|
+
top: calc(100% + 4px);
|
|
135
|
+
z-index: 2; // https://github.com/hashicorp/design-system/issues/114
|
|
127
136
|
}
|
|
128
137
|
|
|
129
|
-
.hds-dropdown-list-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
line-height: var(--token-typography-body-100-line-height);
|
|
135
|
-
padding: 2px 16px 4px;
|
|
138
|
+
.hds-dropdown-list--position-left {
|
|
139
|
+
left: 0;
|
|
140
|
+
position: absolute;
|
|
141
|
+
top: calc(100% + 4px);
|
|
142
|
+
z-index: 2; // https://github.com/hashicorp/design-system/issues/114
|
|
136
143
|
}
|
|
137
144
|
|
|
138
|
-
.hds-dropdown-list-item--separator {
|
|
139
|
-
position: relative;
|
|
140
|
-
height: 4px;
|
|
141
|
-
width: 100%;
|
|
142
145
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
right: 6px;
|
|
146
|
-
left: 6px;
|
|
147
|
-
bottom: 0;
|
|
148
|
-
border-bottom: 1px solid var(--token-color-border-primary);
|
|
149
|
-
content: '';
|
|
150
|
-
}
|
|
151
|
-
}
|
|
146
|
+
// LIST > LIST-ITEM
|
|
147
|
+
// HDS::DROPDOWN::LIST-ITEM
|
|
152
148
|
|
|
153
149
|
.hds-dropdown-list-item__copy-item-title {
|
|
154
150
|
color: var(--token-color-foreground-faint);
|
|
155
|
-
font-family: var(--token-typography-body-100-font-family);
|
|
156
|
-
font-size: var(--token-typography-body-100-font-size); // 13
|
|
157
|
-
font-weight: var(--token-typography-font-weight-semibold);
|
|
158
|
-
line-height: var(--token-typography-body-100-line-height); // 18
|
|
159
151
|
padding: 2px 0 4px;
|
|
160
152
|
}
|
|
161
153
|
|
|
@@ -163,17 +155,16 @@
|
|
|
163
155
|
padding: 10px 16px 12px;
|
|
164
156
|
width: 100%;
|
|
165
157
|
|
|
166
|
-
button {
|
|
158
|
+
button {
|
|
167
159
|
background-color: transparent;
|
|
168
160
|
border-radius: 5px;
|
|
169
161
|
border: 1px solid var(--token-color-border-primary);
|
|
170
|
-
color: var(--token-color-foreground-primary);
|
|
162
|
+
color: var(--token-color-foreground-primary);
|
|
171
163
|
display: flex;
|
|
172
|
-
font-family: var(--token-typography-font-stack-code);
|
|
173
164
|
justify-content: space-between;
|
|
174
165
|
padding: 12px 8px;
|
|
175
166
|
width: 100%;
|
|
176
|
-
|
|
167
|
+
|
|
177
168
|
&:hover,
|
|
178
169
|
&.is-hover {
|
|
179
170
|
background-color: var(--token-color-surface-interactive-hover);
|
|
@@ -181,55 +172,61 @@
|
|
|
181
172
|
}
|
|
182
173
|
|
|
183
174
|
@include hds-focus-ring-basic();
|
|
184
|
-
|
|
175
|
+
|
|
185
176
|
&:focus,
|
|
186
177
|
&.is-focus {
|
|
187
|
-
//TODO this focus is just way too complex
|
|
178
|
+
//TODO this focus is just way too complex
|
|
188
179
|
background-color: var(--token-color-surface-action);
|
|
189
180
|
border-color: var(--token-color-focus-action-internal);
|
|
190
181
|
}
|
|
191
|
-
|
|
192
|
-
&:active,
|
|
182
|
+
|
|
183
|
+
&:active,
|
|
193
184
|
&.is-active {
|
|
194
185
|
background-color: var(--token-color-surface-interactive-active);
|
|
195
186
|
}
|
|
196
187
|
|
|
197
188
|
&.is-success {
|
|
198
|
-
border-color: var(--token-color-border-success);
|
|
199
189
|
background-color: var(--token-color-surface-success);
|
|
200
|
-
|
|
190
|
+
border-color: var(--token-color-border-success);
|
|
191
|
+
|
|
201
192
|
.hds-dropdown-list-item__copy-item-icon {
|
|
202
193
|
color: var(--token-color-foreground-success);
|
|
203
194
|
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
.hds-dropdown-list-item__copy-item-text {
|
|
207
|
-
font-size: var(--token-typography-code-100-font-size);
|
|
208
|
-
font-weight: var(--token-typography-font-weight-regular);
|
|
209
|
-
line-height: var(--token-typography-code-100-line-height);
|
|
210
|
-
// max-width: 250px; // TODO we should be able to figure out the proportions here
|
|
211
|
-
overflow: hidden;
|
|
212
|
-
text-align: left;
|
|
213
|
-
text-overflow: ellipsis;
|
|
214
|
-
white-space: nowrap;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.hds-dropdown-list-item__copy-item-icon {
|
|
218
|
-
color: var(--token-color-foreground-action);
|
|
219
|
-
margin-left: 0.5rem;
|
|
220
195
|
}
|
|
221
196
|
}
|
|
222
197
|
}
|
|
223
198
|
|
|
199
|
+
.hds-dropdown-list-item__copy-item-text {
|
|
200
|
+
overflow: hidden;
|
|
201
|
+
text-align: left;
|
|
202
|
+
text-overflow: ellipsis;
|
|
203
|
+
white-space: nowrap;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.hds-dropdown-list-item__copy-item-icon {
|
|
207
|
+
color: var(--token-color-foreground-action);
|
|
208
|
+
flex: none;
|
|
209
|
+
margin-left: 8px;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.hds-dropdown-list-item--description {
|
|
213
|
+
color: var(--token-color-foreground-faint);
|
|
214
|
+
padding: 2px 16px 4px;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.hds-dropdown-list-item--generic {
|
|
218
|
+
padding-left: 16px;
|
|
219
|
+
padding-right: 16px;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
|
|
224
223
|
.hds-dropdown-list-item--interactive {
|
|
225
|
-
position: relative;
|
|
226
224
|
isolation: isolate; // used to create a new stacking context (needed to have the pseudo element below text/icon but not the parent container)
|
|
227
225
|
min-height: 36px;
|
|
226
|
+
position: relative;
|
|
228
227
|
|
|
229
|
-
// need to reset a few extra things to make the button visually appear the same as the
|
|
230
|
-
// TODO this is 0.125rem taller than the link...
|
|
228
|
+
// need to reset a few extra things to make the button visually appear the same as the link
|
|
231
229
|
button {
|
|
232
|
-
border: 1px inset transparent; // cause of the extra height
|
|
233
230
|
background-color: transparent;
|
|
234
231
|
width: 100%;
|
|
235
232
|
|
|
@@ -242,10 +239,11 @@
|
|
|
242
239
|
// shared styles for links and buttons
|
|
243
240
|
a, button {
|
|
244
241
|
align-items: center;
|
|
242
|
+
border: 1px solid transparent; // because a border for the button is needed for a11y, we apply it to both the button and the link so they have the same height
|
|
245
243
|
display: flex;
|
|
246
244
|
outline-style: solid; // used to avoid double outline+focus-ring in Safari (see https://github.com/hashicorp/design-system-components/issues/161#issuecomment-1031548656)
|
|
247
245
|
outline-color: transparent;
|
|
248
|
-
padding:
|
|
246
|
+
padding: 7px 9px 7px 15px; // notice: we're subtracting 1px because of the transparent border
|
|
249
247
|
text-decoration: none;
|
|
250
248
|
|
|
251
249
|
// this is used for the left "hover" indicator
|
|
@@ -253,7 +251,7 @@
|
|
|
253
251
|
border-radius: 1px;
|
|
254
252
|
bottom: 6px;
|
|
255
253
|
content: '';
|
|
256
|
-
left:
|
|
254
|
+
left: 4px;
|
|
257
255
|
position: absolute;
|
|
258
256
|
top: 6px;
|
|
259
257
|
width: 2px;
|
|
@@ -266,59 +264,81 @@
|
|
|
266
264
|
border-radius: 5px;
|
|
267
265
|
bottom: 0px;
|
|
268
266
|
content: '';
|
|
269
|
-
left:
|
|
267
|
+
left: 10px;
|
|
270
268
|
position: absolute;
|
|
271
|
-
right:
|
|
272
|
-
z-index: -1;
|
|
269
|
+
right: 4px;
|
|
273
270
|
top: 0;
|
|
271
|
+
z-index: -1;
|
|
274
272
|
}
|
|
275
273
|
|
|
276
274
|
// Notice: to avoid too much duplication we define two local CSS variables
|
|
277
275
|
// and define their values in the color variants below
|
|
278
276
|
|
|
277
|
+
&:hover,
|
|
278
|
+
&.is-hover {
|
|
279
|
+
color: var(--current-color-hover);
|
|
280
|
+
&::before {
|
|
281
|
+
background-color: currentColor;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
279
285
|
// default focus for browsers that still rely on ":focus"
|
|
280
286
|
&:focus,
|
|
281
287
|
&.is-focus {
|
|
288
|
+
color: var(--current-color-focus);
|
|
282
289
|
&::after {
|
|
283
290
|
background-color: var(--current-background-color);
|
|
284
291
|
box-shadow: var(--current-focus-ring-box-shadow);
|
|
285
|
-
left:
|
|
292
|
+
left: 4px;
|
|
286
293
|
}
|
|
287
294
|
}
|
|
288
295
|
// undo the previous declaration for browsers that support ":focus-visible" but wouldn't normally show default focus styles
|
|
289
296
|
&:focus:not(:focus-visible) {
|
|
290
297
|
&::after {
|
|
298
|
+
background-color: transparent;
|
|
291
299
|
box-shadow: none;
|
|
292
300
|
}
|
|
293
301
|
}
|
|
294
302
|
// set focus for browsers that support ":focus-visible"
|
|
295
303
|
&:focus-visible {
|
|
304
|
+
color: var(--current-color-focus);
|
|
296
305
|
&::after {
|
|
297
306
|
background-color: var(--current-background-color);
|
|
298
307
|
box-shadow: var(--current-focus-ring-box-shadow);
|
|
299
|
-
left:
|
|
308
|
+
left: 4px;
|
|
300
309
|
}
|
|
301
310
|
}
|
|
311
|
+
|
|
302
312
|
// remove the focus ring on "active + focused" state (by design)
|
|
303
313
|
&:focus:active,
|
|
314
|
+
&:focus-visible:active,
|
|
304
315
|
&.is-focus.is-active {
|
|
305
316
|
&::after {
|
|
317
|
+
background-color: var(--current-background-color);
|
|
306
318
|
box-shadow: none;
|
|
319
|
+
left: 10px;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
&:active,
|
|
324
|
+
&.is-active {
|
|
325
|
+
color: var(--current-color-active);
|
|
326
|
+
&::before {
|
|
327
|
+
background-color: currentColor;
|
|
328
|
+
}
|
|
329
|
+
&::after {
|
|
330
|
+
background-color: var(--current-background-color);
|
|
307
331
|
}
|
|
308
332
|
}
|
|
309
333
|
}
|
|
310
334
|
}
|
|
311
335
|
|
|
312
336
|
.hds-dropdown-list-item__interactive-text {
|
|
313
|
-
font-family: var(--token-typography-body-200-font-family);
|
|
314
|
-
font-size: var(--token-typography-body-200-font-size);
|
|
315
|
-
font-weight: var(--token-typography-font-weight-medium);
|
|
316
|
-
line-height: var(--token-typography-body-200-line-height);
|
|
317
337
|
text-align: left; // the button element was centering text
|
|
318
338
|
}
|
|
319
339
|
|
|
320
340
|
.hds-dropdown-list-item__interactive-icon {
|
|
321
|
-
margin-right:
|
|
341
|
+
margin-right: 8px;
|
|
322
342
|
}
|
|
323
343
|
|
|
324
344
|
.hds-dropdown-list-item--color-action {
|
|
@@ -326,30 +346,12 @@
|
|
|
326
346
|
color: var(--token-color-foreground-primary);
|
|
327
347
|
|
|
328
348
|
// assign the values to the local CSS variables used above
|
|
349
|
+
--current-color-hover: var(--token-color-foreground-action-hover);
|
|
350
|
+
--current-color-focus: var(--token-color-foreground-action-active);
|
|
351
|
+
--current-color-active: var(--token-color-foreground-action-active);
|
|
329
352
|
&::after {
|
|
330
353
|
--current-background-color: var(--token-color-surface-action);
|
|
331
|
-
--current-focus-ring-box-shadow: var(
|
|
332
|
-
--token-focus-ring-action-box-shadow
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
&:hover,
|
|
337
|
-
&.is-hover {
|
|
338
|
-
color: var(--token-color-foreground-action-hover);
|
|
339
|
-
&::before {
|
|
340
|
-
background-color: currentColor;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
&:active,
|
|
345
|
-
&.is-active {
|
|
346
|
-
color: var(--token-color-foreground-action-active);
|
|
347
|
-
&::before {
|
|
348
|
-
background-color: currentColor;
|
|
349
|
-
}
|
|
350
|
-
&::after {
|
|
351
|
-
background-color: var(--token-color-surface-action);
|
|
352
|
-
}
|
|
354
|
+
--current-focus-ring-box-shadow: var(--token-focus-ring-action-box-shadow);
|
|
353
355
|
}
|
|
354
356
|
}
|
|
355
357
|
}
|
|
@@ -359,33 +361,33 @@
|
|
|
359
361
|
color: var(--token-color-foreground-critical);
|
|
360
362
|
|
|
361
363
|
// assign the values to the local CSS variables used above
|
|
364
|
+
--current-color-hover: var(--token-color-palette-red-300);
|
|
365
|
+
--current-color-focus: var(--token-color-palette-red-400);
|
|
366
|
+
--current-color-active: var(--token-color-palette-red-400);
|
|
362
367
|
&::after {
|
|
363
368
|
--current-background-color: var(--token-color-surface-critical);
|
|
364
|
-
--current-focus-ring-box-shadow: var(
|
|
365
|
-
--token-focus-ring-critical-box-shadow
|
|
366
|
-
);
|
|
369
|
+
--current-focus-ring-box-shadow: var(--token-focus-ring-critical-box-shadow);
|
|
367
370
|
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
368
373
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
--token-color-palette-red-400
|
|
382
|
-
); // TODO we need to add this token to the design system
|
|
383
|
-
&::before {
|
|
384
|
-
background-color: currentColor;
|
|
385
|
-
}
|
|
386
|
-
&::after {
|
|
387
|
-
background-color: var(--token-color-surface-critical);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
374
|
+
.hds-dropdown-list-item--separator {
|
|
375
|
+
height: 4px;
|
|
376
|
+
position: relative;
|
|
377
|
+
width: 100%;
|
|
378
|
+
|
|
379
|
+
&::before {
|
|
380
|
+
border-bottom: 1px solid var(--token-color-border-primary);
|
|
381
|
+
bottom: 0;
|
|
382
|
+
content: '';
|
|
383
|
+
left: 6px;
|
|
384
|
+
position: absolute;
|
|
385
|
+
right: 6px;
|
|
390
386
|
}
|
|
391
387
|
}
|
|
388
|
+
|
|
389
|
+
.hds-dropdown-list-item--title {
|
|
390
|
+
color: var(--token-color-foreground-strong);
|
|
391
|
+
padding: 10px 16px 4px;
|
|
392
|
+
}
|
|
393
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// TOAST
|
|
3
|
+
//
|
|
4
|
+
// properties within each class are sorted alphabetically
|
|
5
|
+
//
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
.hds-toast {
|
|
9
|
+
// we apply an elevation to the "alert/inline" element
|
|
10
|
+
box-shadow: var(--token-elevation-higher-box-shadow);
|
|
11
|
+
|
|
12
|
+
// per design specs
|
|
13
|
+
min-width: min(360px, 80vw);
|
|
14
|
+
max-width: min(500px, 80vw);
|
|
15
|
+
width: fit-content;
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
|
|
3
|
+
export default class Hds<%= classifiedModuleName %>IndexComponent extends Component {
|
|
4
|
+
// UNCOMMENT THIS IF YOU NEED A CONSTRUCTOR
|
|
5
|
+
// constructor() {
|
|
6
|
+
// super(...arguments);
|
|
7
|
+
// // ADD YOUR ASSERTIONS HERE
|
|
8
|
+
// }
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Get the class names to apply to the component.
|
|
12
|
+
* @method classNames
|
|
13
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
14
|
+
*/
|
|
15
|
+
get classNames() {
|
|
16
|
+
let classes = ['hds-<%= kebabizedModuleName %>'];
|
|
17
|
+
|
|
18
|
+
// add a class based on the @xxx argument
|
|
19
|
+
// classes.push(`hds-<%= kebabizedModuleName %>--[variant]-${this.xxx}`);
|
|
20
|
+
|
|
21
|
+
return classes.join(' ');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/<%= dasherizedModuleName %>/index';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* eslint-disable ember/no-string-prototype-extensions */
|
|
2
|
+
/* eslint-disable node/no-extraneous-require */
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
const stringUtil = require('ember-cli-string-utils');
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
description: 'Generates all files for an HDS component',
|
|
9
|
+
|
|
10
|
+
locals(options) {
|
|
11
|
+
return {
|
|
12
|
+
columnizedModuleName: options.entity.name
|
|
13
|
+
.split('/')
|
|
14
|
+
.map((part) => stringUtil.classify(part))
|
|
15
|
+
.join('::'),
|
|
16
|
+
kebabizedModuleName: options.entity.name
|
|
17
|
+
.split('/')
|
|
18
|
+
.map((part) => stringUtil.dasherize(part))
|
|
19
|
+
.join('-'),
|
|
20
|
+
folderizedModuleName: options.entity.name
|
|
21
|
+
.split('/')
|
|
22
|
+
.map((part) => stringUtil.dasherize(part).toUpperCase())
|
|
23
|
+
.join(' > '),
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
};
|
package/blueprints/hds-component-test/files/tests/dummy/app/styles/pages/__dummyCSSFileName__.scss
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// <%= folderizedModuleName %>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{{page-title "<%= columnizedModuleName %> Component"}}
|
|
2
|
+
|
|
3
|
+
<h2 class="dummy-h2"><%= columnizedModuleName %></h2>
|
|
4
|
+
|
|
5
|
+
{{! ADD YOUR CONTENT BELOW }}
|
|
6
|
+
{{! Please follow as much as possible what it's already done in other components. }}
|
|
7
|
+
{{! You can start by copy&pasting it, if you want, and then adapt it according to your needs. }}
|
|
8
|
+
{{! Once done, please remove these comments (they're created by the generator). }}
|
|
9
|
+
|
|
10
|
+
<section>
|
|
11
|
+
<h3 class="dummy-h3" id="overview"><a href="#overview">§</a> Overview</h3>
|
|
12
|
+
|
|
13
|
+
{{! ADD YOUR CONTENT HERE }}
|
|
14
|
+
|
|
15
|
+
</section>
|
|
16
|
+
|
|
17
|
+
<section>
|
|
18
|
+
<h3 class="dummy-h3" id="component-api"><a href="#component-api">§</a> Component API</h3>
|
|
19
|
+
<p class="dummy-paragraph" id="component-api-<%= kebabizedModuleName %>">
|
|
20
|
+
Here is the API for the component:
|
|
21
|
+
</p>
|
|
22
|
+
<dl class="dummy-component-props" aria-labelledby="component-api-<%= kebabizedModuleName %>">
|
|
23
|
+
|
|
24
|
+
{{! ADD YOUR CONTENT HERE }}
|
|
25
|
+
|
|
26
|
+
</dl>
|
|
27
|
+
</section>
|
|
28
|
+
|
|
29
|
+
<section>
|
|
30
|
+
<h3 class="dummy-h3" id="how-to-use"><a href="#how-to-use" class="dummy-link-section">§</a> How to use</h3>
|
|
31
|
+
|
|
32
|
+
{{! ADD YOUR CONTENT HERE }}
|
|
33
|
+
|
|
34
|
+
</section>
|
|
35
|
+
|
|
36
|
+
<section>
|
|
37
|
+
<h3 class="dummy-h3" id="design-guidelines"><a href="#design-guidelines" class="dummy-link-section">§</a>Design guidelines</h3>
|
|
38
|
+
{{! UNCOMMENT THIS BLOCK (once the link and/or the image are available) }}
|
|
39
|
+
{{!
|
|
40
|
+
<div class="dummy-design-guidelines">
|
|
41
|
+
<p class="dummy-paragraph">
|
|
42
|
+
<a href="[ADD THE LINK TO THE FIGMA FILE/PAGE HERE!]" target="_blank" rel="noopener noreferrer">Figma UI Kit</a>
|
|
43
|
+
</p>
|
|
44
|
+
<br />
|
|
45
|
+
<img class="dummy-figma-docs" src="/assets/images/<%= kebabizedModuleName %>-design-usage.png" alt="" role="none" />
|
|
46
|
+
</div>
|
|
47
|
+
}}
|
|
48
|
+
</section>
|
|
49
|
+
|
|
50
|
+
<section>
|
|
51
|
+
<h3 class="dummy-h3" id="accessibility"><a href="#accessibility" class="dummy-link-section">§</a> Accessibility</h3>
|
|
52
|
+
|
|
53
|
+
{{! ADD YOUR CONTENT HERE }}
|
|
54
|
+
|
|
55
|
+
</section>
|
|
56
|
+
|
|
57
|
+
<section data-test-percy>
|
|
58
|
+
<h3 class="dummy-h3" id="showcase"><a href="#showcase" class="dummy-link-section">§</a> Showcase</h3>
|
|
59
|
+
|
|
60
|
+
{{! ADD YOUR CONTENT HERE }}
|
|
61
|
+
|
|
62
|
+
{{! This below is just an example of invocation, to get started }}
|
|
63
|
+
<Hds::<%= columnizedModuleName %>>This is the Hds::<%= columnizedModuleName %> component </Hds::<%= columnizedModuleName %>>
|
|
64
|
+
|
|
65
|
+
</section>
|
package/blueprints/hds-component-test/files/tests/integration/components/hds/__name__/index-test.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { module, test } from 'qunit';
|
|
2
|
+
import { setupRenderingTest } from 'ember-qunit';
|
|
3
|
+
import { render } from '@ember/test-helpers';
|
|
4
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
5
|
+
|
|
6
|
+
module('Integration | Component | hds/<%= dasherizedModuleName %>/index', function (hooks) {
|
|
7
|
+
setupRenderingTest(hooks);
|
|
8
|
+
|
|
9
|
+
test('it renders the component', async function (assert) {
|
|
10
|
+
await render(hbs`<Hds::<%= columnizedModuleName %> />`);
|
|
11
|
+
assert.dom(this.element).exists();
|
|
12
|
+
});
|
|
13
|
+
test('it should render with a CSS class that matches the component name', async function (assert) {
|
|
14
|
+
await render(hbs`<Hds::<%= columnizedModuleName %> id="test-<%= kebabizedModuleName %>" />`);
|
|
15
|
+
assert.dom('#test-<%= kebabizedModuleName %>').hasClass('hds-<%= kebabizedModuleName %>');
|
|
16
|
+
});
|
|
17
|
+
});
|