@hashicorp/design-system-components 2.0.0 → 2.2.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.
Files changed (84) hide show
  1. package/CHANGELOG.md +72 -20
  2. package/HOW-TO-TEST-A-COMPONENT-IN-CLOUD-UI.md +28 -3
  3. package/addon/components/hds/app-frame/index.hbs +24 -0
  4. package/addon/components/hds/app-frame/index.js +52 -0
  5. package/addon/components/hds/app-frame/parts/footer.hbs +7 -0
  6. package/addon/components/hds/{empty-state → app-frame/parts}/header.hbs +2 -2
  7. package/addon/components/hds/{empty-state/body.hbs → app-frame/parts/main.hbs} +2 -2
  8. package/addon/components/hds/app-frame/parts/modals.hbs +6 -0
  9. package/addon/components/hds/{empty-state/footer.hbs → app-frame/parts/sidebar.hbs} +2 -2
  10. package/addon/components/hds/application-state/body.hbs +13 -0
  11. package/addon/components/hds/application-state/footer.hbs +7 -0
  12. package/addon/components/hds/application-state/footer.js +35 -0
  13. package/addon/components/hds/application-state/header.hbs +20 -0
  14. package/addon/components/hds/application-state/index.hbs +13 -0
  15. package/addon/components/hds/dropdown/footer.hbs +5 -0
  16. package/addon/components/hds/dropdown/header.hbs +5 -0
  17. package/addon/components/hds/dropdown/index.hbs +2 -2
  18. package/addon/components/hds/dropdown/index.js +18 -2
  19. package/addon/components/hds/dropdown/list-item/checkbox.hbs +5 -0
  20. package/addon/components/hds/dropdown/list-item/checkbox.js +5 -0
  21. package/addon/components/hds/dropdown/list-item/checkmark.hbs +5 -0
  22. package/addon/components/hds/dropdown/list-item/checkmark.js +5 -0
  23. package/addon/components/hds/dropdown/list-item/radio.hbs +5 -0
  24. package/addon/components/hds/dropdown/list-item/radio.js +5 -0
  25. package/addon/components/hds/dropdown/toggle/chevron.hbs +5 -0
  26. package/addon/components/hds/flyout/footer.hbs +7 -0
  27. package/addon/components/hds/flyout/index.hbs +1 -0
  28. package/addon/components/hds/side-nav/base.hbs +14 -0
  29. package/addon/components/hds/side-nav/{home-link.js → header/home-link.js} +2 -2
  30. package/addon/components/hds/side-nav/{icon-button.hbs → header/icon-button.hbs} +1 -1
  31. package/addon/components/hds/side-nav/{icon-button.js → header/icon-button.js} +2 -2
  32. package/addon/components/hds/side-nav/{header.hbs → header/index.hbs} +2 -2
  33. package/addon/components/hds/side-nav/index.hbs +40 -0
  34. package/addon/components/hds/side-nav/index.js +107 -0
  35. package/addon/components/hds/side-nav/list/index.hbs +2 -0
  36. package/addon/components/hds/side-nav/portal/index.hbs +12 -0
  37. package/addon/components/hds/side-nav/portal/target.hbs +14 -0
  38. package/addon/components/hds/side-nav/portal/target.js +156 -0
  39. package/app/components/hds/{empty-state/body.js → app-frame/index.js} +1 -1
  40. package/app/components/hds/app-frame/parts/footer.js +6 -0
  41. package/app/components/hds/app-frame/parts/header.js +6 -0
  42. package/app/components/hds/{empty-state/footer.js → app-frame/parts/main.js} +1 -1
  43. package/app/components/hds/app-frame/parts/modals.js +6 -0
  44. package/app/components/hds/app-frame/parts/sidebar.js +6 -0
  45. package/app/components/hds/application-state/body.js +6 -0
  46. package/app/components/hds/application-state/footer.js +6 -0
  47. package/app/components/hds/application-state/header.js +6 -0
  48. package/app/components/hds/application-state/index.js +6 -0
  49. package/app/components/hds/dropdown/footer.js +5 -0
  50. package/app/components/hds/dropdown/header.js +5 -0
  51. package/app/components/hds/dropdown/list-item/checkbox.js +5 -0
  52. package/app/components/hds/dropdown/list-item/checkmark.js +5 -0
  53. package/app/components/hds/dropdown/list-item/radio.js +5 -0
  54. package/app/components/hds/{side-nav/wrapper.js → flyout/footer.js} +1 -1
  55. package/app/components/hds/side-nav/base.js +6 -0
  56. package/app/components/hds/side-nav/{home-link.js → header/home-link.js} +1 -1
  57. package/app/components/hds/side-nav/{icon-button.js → header/icon-button.js} +1 -1
  58. package/app/components/hds/{empty-state → side-nav}/index.js +1 -1
  59. package/app/components/hds/{empty-state/header.js → side-nav/portal/index.js} +1 -1
  60. package/app/components/hds/side-nav/portal/target.js +6 -0
  61. package/app/styles/@hashicorp/design-system-components.scss +2 -1
  62. package/app/styles/@hashicorp/design-system-power-select-overrides.scss +33 -3
  63. package/app/styles/components/app-frame.scss +60 -0
  64. package/app/styles/components/application-state.scss +55 -0
  65. package/app/styles/components/dropdown.scss +11 -0
  66. package/app/styles/components/flyout.scss +15 -1
  67. package/app/styles/components/form/checkbox.scss +1 -1
  68. package/app/styles/components/form/radio.scss +1 -1
  69. package/app/styles/components/form/text-input.scss +1 -1
  70. package/app/styles/components/form/textarea.scss +2 -1
  71. package/app/styles/components/side-nav/a11y-refocus.scss +30 -0
  72. package/app/styles/components/side-nav/content.scss +156 -0
  73. package/app/styles/components/side-nav/header.scss +102 -0
  74. package/app/styles/components/side-nav/index.scss +10 -0
  75. package/app/styles/components/side-nav/main.scss +202 -0
  76. package/app/styles/components/side-nav/vars.scss +36 -0
  77. package/blueprints/hds-component-test/files/tests/integration/components/hds/__name__/index-test.js +14 -11
  78. package/package.json +6 -4
  79. package/addon/components/hds/empty-state/index.hbs +0 -13
  80. package/addon/components/hds/side-nav/wrapper.hbs +0 -18
  81. package/app/styles/components/empty-state.scss +0 -37
  82. package/app/styles/components/side-nav.scss +0 -275
  83. /package/addon/components/hds/side-nav/{home-link.hbs → header/home-link.hbs} +0 -0
  84. /package/app/components/hds/side-nav/{header.js → header/index.js} +0 -0
@@ -8,15 +8,18 @@ import { setupRenderingTest } from 'ember-qunit';
8
8
  import { render } from '@ember/test-helpers';
9
9
  import { hbs } from 'ember-cli-htmlbars';
10
10
 
11
- module('Integration | Component | hds/<%= dasherizedModuleName %>/index', function (hooks) {
12
- setupRenderingTest(hooks);
11
+ module(
12
+ 'Integration | Component | hds/<%= dasherizedModuleName %>/index',
13
+ function (hooks) {
14
+ setupRenderingTest(hooks);
13
15
 
14
- test('it renders the component', async function (assert) {
15
- await render(hbs`<Hds::<%= columnizedModuleName %> />`);
16
- assert.dom(this.element).exists();
17
- });
18
- test('it should render with a CSS class that matches the component name', async function (assert) {
19
- await render(hbs`<Hds::<%= columnizedModuleName %> id="test-<%= kebabizedModuleName %>" />`);
20
- assert.dom('#test-<%= kebabizedModuleName %>').hasClass('hds-<%= kebabizedModuleName %>');
21
- });
22
- });
16
+ test('it should render the component with a CSS class that matches the component name', async function (assert) {
17
+ await render(
18
+ hbs`<Hds::<%= columnizedModuleName %> id="test-<%= kebabizedModuleName %>" />`
19
+ );
20
+ assert
21
+ .dom('#test-<%= kebabizedModuleName %>')
22
+ .hasClass('hds-<%= kebabizedModuleName %>');
23
+ });
24
+ }
25
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashicorp/design-system-components",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "Helios Design System Components",
5
5
  "keywords": [
6
6
  "hashicorp",
@@ -38,9 +38,10 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@ember/render-modifiers": "^2.0.5",
41
- "@hashicorp/design-system-tokens": "^1.4.1",
41
+ "@hashicorp/design-system-tokens": "^1.4.2",
42
42
  "@hashicorp/ember-flight-icons": "^3.0.2",
43
43
  "dialog-polyfill": "^0.5.6",
44
+ "ember-a11y-refocus": "^3.0.2",
44
45
  "ember-auto-import": "^2.6.0",
45
46
  "ember-cached-decorator-polyfill": "^0.1.4",
46
47
  "ember-cli-babel": "^7.26.11",
@@ -50,6 +51,7 @@
50
51
  "ember-focus-trap": "^1.0.1",
51
52
  "ember-keyboard": "^8.1.0",
52
53
  "ember-named-blocks-polyfill": "^0.2.5",
54
+ "ember-stargate": "^0.4.3",
53
55
  "ember-style-modifier": "^0.8.0",
54
56
  "ember-truth-helpers": "^3.0.0",
55
57
  "sass": "^1.58.3"
@@ -61,7 +63,7 @@
61
63
  "@embroider/test-setup": "^2.0.2",
62
64
  "@glimmer/component": "^1.1.2",
63
65
  "@glimmer/tracking": "^1.1.2",
64
- "@percy/cli": "^1.21.0",
66
+ "@percy/cli": "^1.24.0",
65
67
  "@percy/ember": "^4.2.0",
66
68
  "babel-eslint": "^10.1.0",
67
69
  "broccoli-asset-rev": "^3.0.0",
@@ -79,7 +81,7 @@
79
81
  "ember-load-initializers": "^2.1.2",
80
82
  "ember-page-title": "^7.0.0",
81
83
  "ember-power-select": "^6.0.0",
82
- "ember-qunit": "^6.1.1",
84
+ "ember-qunit": "^6.2.0",
83
85
  "ember-resolver": "^10.0.0",
84
86
  "ember-source": "~4.10.0",
85
87
  "ember-source-channel-url": "^3.0.0",
@@ -1,13 +0,0 @@
1
- {{!
2
- Copyright (c) HashiCorp, Inc.
3
- SPDX-License-Identifier: MPL-2.0
4
- }}
5
- <div class="hds-empty-state" ...attributes>
6
- {{yield
7
- (hash
8
- Header=(component "hds/empty-state/header")
9
- Body=(component "hds/empty-state/body")
10
- Footer=(component "hds/empty-state/footer")
11
- )
12
- }}
13
- </div>
@@ -1,18 +0,0 @@
1
- {{!
2
- Copyright (c) HashiCorp, Inc.
3
- SPDX-License-Identifier: MPL-2.0
4
- }}
5
-
6
- <div class="hds-side-nav__wrapper" ...attributes>
7
- <div class="hds-side-nav__wrapper-header">
8
- {{yield to="header"}}
9
- </div>
10
-
11
- <div class="hds-side-nav__wrapper-body" aria-label="contents">
12
- {{yield to="body"}}
13
- </div>
14
-
15
- <div class="hds-side-nav__wrapper-footer">
16
- {{yield to="footer"}}
17
- </div>
18
- </div>
@@ -1,37 +0,0 @@
1
- /**
2
- * Copyright (c) HashiCorp, Inc.
3
- * SPDX-License-Identifier: MPL-2.0
4
- */
5
-
6
- //
7
- // EMPTY-STATE COMPONENT
8
- //
9
-
10
- .hds-empty-state {
11
- display: block;
12
- max-width: 40ch;
13
- margin: 0 auto;
14
- padding: 0;
15
- color: var(--token-color-foreground-faint);
16
-
17
- > * {
18
- margin: 0;
19
- padding: 0;
20
- }
21
- }
22
-
23
- .hds-empty-state__body {
24
- font-weight: 400;
25
- font-size: 1rem;
26
- line-height: 1.5;
27
-
28
- + * {
29
- margin-block-start: 1rem;
30
- }
31
- }
32
-
33
- .hds-empty-state__header {
34
- font-weight: 700;
35
- font-size: 1.25rem;
36
- line-height: 1.2;
37
- }
@@ -1,275 +0,0 @@
1
- /**
2
- * Copyright (c) HashiCorp, Inc.
3
- * SPDX-License-Identifier: MPL-2.0
4
- */
5
-
6
- //
7
- // SIDE-NAV
8
- //
9
-
10
- @use "../mixins/focus-ring" as *;
11
-
12
- // WIP, naming, etc. will be refined... TODO: Add JSON for color tokens, etc.
13
- :root {
14
- // Sizes:
15
-
16
- // header, body, footer "wrappers":
17
- --token-side-nav-wrapper-padding-horizontal: 16px;
18
- --token-side-nav-wrapper-padding-vertical: 16px;
19
- --token-side-nav-wrapper-header-padding-bottom: 8px;
20
-
21
- // header content:
22
- --token-side-nav-header-home-link-padding: 4px;
23
- --token-side-nav-header-home-link-logo-size: 48px;
24
- --token-side-nav-header-actions-spacing: 8px;
25
-
26
- // body content:
27
- --token-side-nav-body-list-margin-vertical: 16px;
28
- --token-side-nav-body-list-item-padding-horizontal: 8px;
29
- --token-side-nav-body-list-item-padding-vertical: 4px;
30
- --token-side-nav-body-list-item-spacing-vertical: 2px;
31
- --token-side-nav-body-list-item-content-spacing-horizontal: 8px;
32
- --token-side-nav-body-list-item-border-radius: 5px;
33
-
34
- // Colors:
35
-
36
- // SideNav container:
37
- --token-side-nav-foreground-primary: #dedfe3;
38
- --token-side-nav-foreground-primary-strong: #fff;
39
- --token-side-nav-foreground-faint: #8c909c;
40
- --token-side-nav-surface-primary: #0c0c0e;
41
-
42
- // Interactive elements:
43
- // base:
44
- --token-side-nav-interactive-surface-hover: #3b3d45;
45
- --token-side-nav-interactive-surface-active: #656a76;
46
- }
47
-
48
- @mixin hds-side-nav-icon-button($add-visible-border: false) {
49
- color: var(--token-side-nav-foreground-primary-strong);
50
- background-color: transparent;
51
- border: 1px solid transparent;
52
- border-radius: var(--token-side-nav-body-list-item-border-radius);
53
- cursor: pointer;
54
-
55
- @if ($add-visible-border) {
56
- border-color: var(--token-color-palette-neutral-500);
57
- }
58
-
59
- &:focus,
60
- &.mock-focus {
61
- @include hds-focus-ring-with-pseudo-element($top: -1px, $right: -1px, $bottom: -1px, $left: -1px);
62
- }
63
-
64
- &:hover,
65
- &.mock-hover {
66
- color: var(--token-side-nav-foreground-primary-strong); // to avoid overrides by specificity (eg. `a:hover`)
67
- background: var(--token-side-nav-interactive-surface-hover);
68
- }
69
-
70
- &:active,
71
- &.mock-active {
72
- color: var(--token-side-nav-foreground-primary-strong); // to avoid overrides by specificity (eg. `a:hover`)
73
- background: var(--token-side-nav-interactive-surface-active);
74
-
75
- @if ($add-visible-border) {
76
- border-color: var(--token-color-palette-neutral-400);
77
- }
78
- }
79
- }
80
-
81
-
82
- // * SideNav Parent (wrapper) component
83
- // -------------------------------------------------------------------
84
-
85
- .hds-side-nav__wrapper {
86
- display: flex;
87
- flex-direction: column;
88
- width: 100%;
89
- height: 100%;
90
- color: var(--token-side-nav-foreground-primary); // Default color
91
- background: var(--token-side-nav-surface-primary);
92
- }
93
-
94
- .hds-side-nav__wrapper-header {
95
- padding-top: var(--token-side-nav-wrapper-padding-vertical);
96
- padding-right: var(--token-side-nav-wrapper-padding-horizontal);
97
- padding-bottom: var(--token-side-nav-wrapper-header-padding-bottom); // by design
98
- padding-left: var(--token-side-nav-wrapper-padding-horizontal);
99
- }
100
-
101
- .hds-side-nav__wrapper-body {
102
- flex: 1;
103
- padding: var(--token-side-nav-wrapper-padding-vertical) var(--token-side-nav-wrapper-padding-horizontal);
104
- overflow-y: auto;
105
- }
106
-
107
- .hds-side-nav__wrapper-footer {
108
- padding: var(--token-side-nav-wrapper-padding-vertical) var(--token-side-nav-wrapper-padding-horizontal);
109
- }
110
-
111
- // * Header child elements
112
- // ---------------------------------------
113
-
114
- .hds-side-nav-header {
115
- display: flex;
116
- align-items: center;
117
- justify-content: space-between;
118
- }
119
-
120
- .hds-side-nav-header__logo {
121
- display: block;
122
- flex: none;
123
- align-items: center;
124
- justify-content: center;
125
- width: var(--token-side-nav-header-home-link-logo-size);
126
- height: var(--token-side-nav-header-home-link-logo-size);
127
- }
128
-
129
- .hds-side-nav-header__actions {
130
- display: flex;
131
-
132
- > * + * { margin-left: var(--token-side-nav-header-actions-spacing); }
133
- }
134
-
135
- .hds-side-nav__home-link {
136
- @include hds-side-nav-icon-button();
137
- display: block;
138
- width: 100%;
139
- height: 100%;
140
- padding: calc(var(--token-side-nav-header-home-link-padding) - 1px); // by design - we take in account the transparent border
141
- }
142
-
143
- // Apply class name to Hds::Dropdown component
144
- .hds-side-nav__dropdown {
145
- .hds-dropdown-toggle-icon {
146
- @include hds-side-nav-icon-button($add-visible-border: true);
147
- }
148
- }
149
-
150
- .hds-side-nav__icon-button {
151
- @include hds-side-nav-icon-button($add-visible-border: true);
152
- display: flex;
153
- align-items: center;
154
- justify-content: center;
155
- width: 36px;
156
- height: 36px;
157
- padding: 5px; // we take in account the transparent border
158
- }
159
-
160
- // * Body child elements
161
- // ---------------------------------------
162
-
163
- .hds-side-nav__list-title {
164
- display: flex;
165
- align-items: center;
166
- min-height: 34px;
167
- margin-top: var(--token-side-nav-body-list-margin-vertical);
168
- padding: 0 var(--token-side-nav-body-list-item-padding-horizontal);
169
- color: var(--token-side-nav-foreground-faint);
170
-
171
- // Remove margin from title at top of all list-items & lists
172
- .hds-side-nav__list-wrapper:first-child .hds-side-nav__list-item:first-child > & {
173
- margin-top: 0;
174
- }
175
- }
176
-
177
- .hds-side-nav__list {
178
- margin: 0;
179
- padding: 0;
180
- }
181
-
182
- .hds-side-nav__list-item {
183
- list-style-type: none; // Q: Should ul have role="list" added for accessibility?
184
-
185
- & + & {
186
- margin-top: var(--token-side-nav-body-list-item-spacing-vertical);
187
- }
188
- }
189
-
190
- .hds-side-nav__list-item-link {
191
- display: flex;
192
- align-items: center;
193
- width: 100%;
194
- min-height: 36px;
195
- padding: var(--token-side-nav-body-list-item-padding-vertical) var(--token-side-nav-body-list-item-padding-horizontal);
196
- color: var(--token-side-nav-foreground-primary);
197
- text-decoration: none;
198
- background: var(--token-side-nav-surface-primary);
199
- // "Link" could render as an HTML button element so this overrides the default border style in that case:
200
- border-color: transparent;
201
- border-radius: var(--token-side-nav-body-list-item-border-radius);
202
-
203
- &:focus,
204
- &.mock-focus {
205
- @include hds-focus-ring-with-pseudo-element();
206
- }
207
-
208
- &:hover,
209
- &.mock-hover {
210
- background: var(--token-side-nav-interactive-surface-hover);
211
- border-color: transparent;
212
-
213
- .hds-side-nav__list-item-text,
214
- .hds-side-nav__list-item-icon-leading,
215
- .hds-side-nav__list-item-icon-trailing {
216
- color: var(--token-side-nav-foreground-primary-strong);
217
- }
218
- }
219
-
220
- // notice: this ".active" extra class is used to match the corresponding `active` class assigned automatically
221
- // by the `<LinkTo>` Ember component (when the link is "current), so that consumers get it for free if they want
222
- // otherwise they can use the `@isActive` argument to set this visual state directly
223
- &.active,
224
- &:active,
225
- &.mock-active {
226
- background: var(--token-side-nav-interactive-surface-active);
227
-
228
- .hds-side-nav__list-item-text,
229
- .hds-side-nav__list-item-icon-leading,
230
- .hds-side-nav__list-item-icon-trailing {
231
- color: var(--token-side-nav-foreground-primary-strong);
232
- }
233
-
234
- .hds-badge,
235
- .hds-badge-count {
236
- color: var(--token-color-foreground-primary);
237
- background: var(--token-color-surface-strong);
238
- }
239
- }
240
-
241
- .hds-badge,
242
- .hds-badge-count {
243
- margin-left: var(--token-side-nav-body-list-item-content-spacing-horizontal);
244
- }
245
- }
246
-
247
- // special override for the "back-link" element (no visible active state, by design)
248
- .hds-side-nav__list-item-link--back-link {
249
- &:active,
250
- &.mock-active {
251
- background: var(--token-side-nav-surface-primary);
252
-
253
- .hds-side-nav__list-item-text,
254
- .hds-side-nav__list-item-icon-leading,
255
- .hds-side-nav__list-item-icon-trailing {
256
- color: var(--token-side-nav-foreground-primary);
257
- }
258
- }
259
- }
260
-
261
- .hds-side-nav__list-item-text {
262
- color: var(--token-side-nav-foreground-primary);
263
- text-align: left;
264
- }
265
-
266
- .hds-side-nav__list-item-icon-leading {
267
- flex: none;
268
- margin-right: var(--token-side-nav-body-list-item-content-spacing-horizontal);
269
- }
270
-
271
- .hds-side-nav__list-item-icon-trailing {
272
- flex: none;
273
- margin-left: auto;
274
- padding-left: var(--token-side-nav-body-list-item-content-spacing-horizontal);
275
- }