@hashicorp/design-system-components 2.1.0 → 2.3.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 (74) hide show
  1. package/CHANGELOG.md +48 -0
  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/app-frame/parts/header.hbs +7 -0
  7. package/addon/components/hds/app-frame/parts/main.hbs +7 -0
  8. package/addon/components/hds/app-frame/parts/modals.hbs +6 -0
  9. package/addon/components/hds/app-frame/parts/sidebar.hbs +7 -0
  10. package/addon/components/hds/application-state/footer.js +5 -0
  11. package/addon/components/hds/dropdown/index.hbs +2 -2
  12. package/addon/components/hds/dropdown/index.js +18 -2
  13. package/addon/components/hds/flyout/footer.hbs +7 -0
  14. package/addon/components/hds/flyout/index.hbs +1 -0
  15. package/addon/components/hds/form/checkbox/field.hbs +0 -1
  16. package/addon/components/hds/form/field/index.hbs +3 -1
  17. package/addon/components/hds/form/radio/field.hbs +0 -1
  18. package/addon/components/hds/form/select/field.hbs +0 -1
  19. package/addon/components/hds/form/text-input/field.hbs +0 -1
  20. package/addon/components/hds/form/textarea/field.hbs +0 -1
  21. package/addon/components/hds/form/toggle/base.hbs +1 -1
  22. package/addon/components/hds/form/toggle/field.hbs +0 -2
  23. package/addon/components/hds/segmented-group/index.hbs +15 -0
  24. package/addon/components/hds/side-nav/base.hbs +14 -0
  25. package/addon/components/hds/side-nav/{home-link.js → header/home-link.js} +2 -2
  26. package/addon/components/hds/side-nav/{icon-button.js → header/icon-button.js} +2 -2
  27. package/addon/components/hds/side-nav/{header.hbs → header/index.hbs} +2 -2
  28. package/addon/components/hds/side-nav/index.hbs +40 -0
  29. package/addon/components/hds/side-nav/index.js +107 -0
  30. package/addon/components/hds/side-nav/list/index.hbs +2 -0
  31. package/addon/components/hds/side-nav/portal/index.hbs +12 -0
  32. package/addon/components/hds/side-nav/portal/target.hbs +14 -0
  33. package/addon/components/hds/side-nav/portal/target.js +153 -0
  34. package/addon/components/hds/tooltip-button/index.hbs +11 -0
  35. package/addon/components/hds/tooltip-button/index.js +86 -0
  36. package/addon/modifiers/hds-tooltip.js +164 -0
  37. package/app/components/hds/{side-nav/wrapper.js → app-frame/index.js} +1 -1
  38. package/app/components/hds/app-frame/parts/footer.js +6 -0
  39. package/app/components/hds/app-frame/parts/header.js +6 -0
  40. package/app/components/hds/{side-nav/icon-button.js → app-frame/parts/main.js} +1 -1
  41. package/app/components/hds/app-frame/parts/modals.js +6 -0
  42. package/app/components/hds/app-frame/parts/sidebar.js +6 -0
  43. package/app/components/hds/{side-nav/home-link.js → flyout/footer.js} +1 -1
  44. package/app/components/hds/segmented-group/index.js +6 -0
  45. package/app/components/hds/side-nav/base.js +6 -0
  46. package/app/components/hds/side-nav/header/home-link.js +6 -0
  47. package/app/components/hds/side-nav/header/icon-button.js +6 -0
  48. package/app/components/hds/side-nav/index.js +6 -0
  49. package/app/components/hds/side-nav/portal/index.js +6 -0
  50. package/app/components/hds/side-nav/portal/target.js +6 -0
  51. package/app/components/hds/tooltip-button/index.js +6 -0
  52. package/app/modifiers/hds-tooltip.js +6 -0
  53. package/app/styles/@hashicorp/design-system-components.scss +3 -0
  54. package/app/styles/@hashicorp/design-system-power-select-overrides.scss +32 -2
  55. package/app/styles/components/app-frame.scss +60 -0
  56. package/app/styles/components/dropdown.scss +11 -0
  57. package/app/styles/components/flyout.scss +15 -1
  58. package/app/styles/components/form/field.scss +4 -1
  59. package/app/styles/components/form/textarea.scss +1 -0
  60. package/app/styles/components/segmented-group.scss +59 -0
  61. package/app/styles/components/side-nav/a11y-refocus.scss +30 -0
  62. package/app/styles/components/side-nav/content.scss +159 -0
  63. package/app/styles/components/side-nav/header.scss +103 -0
  64. package/app/styles/components/side-nav/index.scss +10 -0
  65. package/app/styles/components/side-nav/main.scss +202 -0
  66. package/app/styles/components/side-nav/vars.scss +36 -0
  67. package/app/styles/components/tooltip.scss +84 -0
  68. package/package.json +7 -4
  69. package/addon/components/hds/form/toggle/base.js +0 -27
  70. package/addon/components/hds/side-nav/wrapper.hbs +0 -18
  71. package/app/styles/components/side-nav.scss +0 -275
  72. /package/addon/components/hds/side-nav/{home-link.hbs → header/home-link.hbs} +0 -0
  73. /package/addon/components/hds/side-nav/{icon-button.hbs → header/icon-button.hbs} +0 -0
  74. /package/app/components/hds/side-nav/{header.js → header/index.js} +0 -0
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ //
7
+ // TOOLTIP & TOOLTIP-BUTTON
8
+ //
9
+
10
+ @use "../mixins/focus-ring" as *;
11
+
12
+ .hds-tooltip-button {
13
+ @include hds-focus-ring-with-pseudo-element(
14
+ $top: var(--token-tooltip-focus-offset),
15
+ $right: var(--token-tooltip-focus-offset),
16
+ $bottom: var(--token-tooltip-focus-offset),
17
+ $left: var(--token-tooltip-focus-offset),
18
+ );
19
+ }
20
+
21
+ // The special declarations below are used to allow the button to inherit styles from the parent element
22
+ // without preventing the consumers from applying these styles via HDS or custom classes if they want
23
+ //
24
+ // Since the `:where()` selector has a specificity of `0` (see https://developer.mozilla.org/en-US/docs/Web/CSS/:where)
25
+ // the styles declared below are applied to the `<button>` element, but are overwritten by any other style applied via classname
26
+ //
27
+ // If you want to see the effect of this selector, try to comment it and look at the "Inheritance" demo in the showcase:
28
+ // https://hds-showcase.vercel.app/components/tooltip
29
+
30
+ :where(.hds-tooltip-button) {
31
+ margin: 0;
32
+ padding: 0;
33
+ color: inherit;
34
+ font: inherit;
35
+ background-color: inherit;
36
+ border: none;
37
+ }
38
+
39
+ :where(.hds-tooltip-button--is-inline) {
40
+ display: inline-flex;
41
+ }
42
+
43
+ :where(.hds-tooltip-button--is-block) {
44
+ display: flex;
45
+ }
46
+
47
+
48
+ // Tippy.js styling
49
+ // https://atomiks.github.io/tippyjs/
50
+
51
+ .tippy-box[data-theme~="hds"] {
52
+ padding: var(--token-tooltip-padding-vertical) var(--token-tooltip-padding-horizontal);
53
+ color: var(--token-tooltip-color-foreground-primary);
54
+ font-weight: var(--token-typography-font-weight-regular);
55
+ font-size: var(--token-typography-body-200-font-size);
56
+ font-family: var(--token-typography-body-200-font-family);
57
+ line-height: var(--token-typography-body-200-line-height);
58
+ overflow-wrap: break-word;
59
+ background-color: var(--token-tooltip-color-surface-primary);
60
+ border-radius: var(--token-tooltip-border-radius);
61
+ box-shadow: var(--token-elevation-higher-box-shadow);
62
+ transition-property: transform, visibility, opacity;
63
+
64
+ &[data-animation="fade"][data-state="hidden"] {
65
+ opacity: 0;
66
+ }
67
+
68
+ &[data-inertia][data-state="visible"] {
69
+ transition-timing-function: var(--token-tooltip-transition-function);
70
+ }
71
+
72
+ .tippy-content {
73
+ position: relative;
74
+ z-index: 1;
75
+ // This needs to go here because Tippy generates a javascript
76
+ // max-width on .tippy-box.
77
+ max-width: var(--token-tooltip-max-width);
78
+ }
79
+
80
+ // works with Tippy's custom SVG arrow variation:
81
+ .tippy-svg-arrow {
82
+ fill: var(--token-tooltip-color-surface-primary);
83
+ }
84
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashicorp/design-system-components",
3
- "version": "2.1.0",
3
+ "version": "2.3.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.5.0",
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,9 +51,11 @@
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
- "sass": "^1.58.3"
57
+ "sass": "^1.58.3",
58
+ "tippy.js": "^6.3.7"
56
59
  },
57
60
  "devDependencies": {
58
61
  "@ember/optional-features": "^2.0.0",
@@ -61,7 +64,7 @@
61
64
  "@embroider/test-setup": "^2.0.2",
62
65
  "@glimmer/component": "^1.1.2",
63
66
  "@glimmer/tracking": "^1.1.2",
64
- "@percy/cli": "^1.21.0",
67
+ "@percy/cli": "^1.24.0",
65
68
  "@percy/ember": "^4.2.0",
66
69
  "babel-eslint": "^10.1.0",
67
70
  "broccoli-asset-rev": "^3.0.0",
@@ -1,27 +0,0 @@
1
- /**
2
- * Copyright (c) HashiCorp, Inc.
3
- * SPDX-License-Identifier: MPL-2.0
4
- */
5
-
6
- import Component from '@glimmer/component';
7
-
8
- export default class HdsFormToggleBaseComponent extends Component {
9
- /**
10
- * Get the class names to apply to the component.
11
- * @method classNames
12
- * @return {string} The "class" attribute to apply to the component.
13
- */
14
- get classNames() {
15
- let classes = ['hds-form-toggle'];
16
-
17
- // add a class based on the @_wrapperClass argument
18
- // we need to use this special argument to pass a class to the wrapping element, because the ...attributes is applied to the control
19
- // notice: this will *not* be documented for public use
20
- // the reason for this is that the spread (...) of attributes is applied to the <input> element, but the component has a wrapping container and we need to pass a class to it
21
- if (this.args._wrapperClass) {
22
- classes.push(this.args._wrapperClass);
23
- }
24
-
25
- return classes.join(' ');
26
- }
27
- }
@@ -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,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
- }