@hashicorp/design-system-components 2.8.0 → 2.9.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 (29) hide show
  1. package/CHANGELOG.md +45 -6
  2. package/addon/components/hds/accordion/item/button.hbs +5 -0
  3. package/addon/components/hds/accordion/item/index.hbs +5 -0
  4. package/addon/components/hds/copy/button/index.hbs +16 -0
  5. package/addon/components/hds/copy/button/index.js +91 -0
  6. package/addon/components/hds/copy/snippet/index.hbs +15 -0
  7. package/addon/components/hds/copy/snippet/index.js +118 -0
  8. package/addon/components/hds/dropdown/list-item/copy-item.hbs +1 -9
  9. package/addon/components/hds/dropdown/list-item/copy-item.js +0 -30
  10. package/addon/components/hds/flyout/index.js +22 -1
  11. package/addon/components/hds/form/field/index.js +1 -1
  12. package/addon/components/hds/form/text-input/base.js +1 -0
  13. package/addon/components/hds/modal/index.js +22 -1
  14. package/addon/components/hds/page-header/index.hbs +1 -1
  15. package/app/components/hds/copy/button/index.js +6 -0
  16. package/app/components/hds/copy/index.js +6 -0
  17. package/app/components/hds/copy/snippet/index.js +6 -0
  18. package/app/styles/@hashicorp/design-system-components.scss +1 -0
  19. package/app/styles/components/copy/button.scss +31 -0
  20. package/app/styles/components/copy/index.scss +8 -0
  21. package/app/styles/components/copy/snippet.scss +111 -0
  22. package/app/styles/components/dropdown.scss +0 -52
  23. package/app/styles/components/form/text-input.scss +4 -2
  24. package/app/styles/components/page-header.scss +14 -1
  25. package/app/styles/components/side-nav/content.scss +2 -2
  26. package/app/styles/components/side-nav/main.scss +13 -0
  27. package/package.json +7 -6
  28. package/app/utils/hds-get-element-id.js +0 -6
  29. package/app/utils/hds-set-aria-described-by.js +0 -6
package/CHANGELOG.md CHANGED
@@ -1,18 +1,57 @@
1
1
  # @hashicorp/design-system-components
2
2
 
3
+ ## 2.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1488](https://github.com/hashicorp/design-system/pull/1488) [`372bae36d`](https://github.com/hashicorp/design-system/commit/372bae36d87377dc87aa18ed39c7834a4cc545f4) Thanks [@MelSumner](https://github.com/MelSumner)! - Adds the `Hds::CopyButton` and `Hds::CopySnippet` components.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#1539](https://github.com/hashicorp/design-system/pull/1539) [`9d3f29a42`](https://github.com/hashicorp/design-system/commit/9d3f29a42e8130b2155498a7c3cb77a6da279a68) Thanks [@Dhaulagiri](https://github.com/Dhaulagiri)! - Adjusted closing brace on copywrite headers to avoid terminal noise
12
+
13
+ - [#1549](https://github.com/hashicorp/design-system/pull/1549) [`a6553ea03`](https://github.com/hashicorp/design-system/commit/a6553ea032f70f0167f149589801b72154c3cf75) Thanks [@fivetanley](https://github.com/fivetanley)! - `Hds::Modal` - reduce test flakiness around closing Modal when using `@ember/test-helpers`
14
+
15
+ - [#1530](https://github.com/hashicorp/design-system/pull/1530) [`b757e6efb`](https://github.com/hashicorp/design-system/commit/b757e6efb4c115abcd604bc4ef155f731f118c72) Thanks [@alex-ju](https://github.com/alex-ju)! - Fix Embroider warnings caused by incorrect export of internal utility functions
16
+
17
+ - [#1552](https://github.com/hashicorp/design-system/pull/1552) [`865ff7aad`](https://github.com/hashicorp/design-system/commit/865ff7aad593bddf6f16bfdb1210318bedfa4e22) Thanks [@alex-ju](https://github.com/alex-ju)! - `Hds::Flyout` - reduce test flakiness around closing Flyout when using `@ember/test-helpers`
18
+
19
+ - [#1529](https://github.com/hashicorp/design-system/pull/1529) [`1433fe098`](https://github.com/hashicorp/design-system/commit/1433fe0988b9c4e0d280ac450e6688e5d606630d) Thanks [@alex-ju](https://github.com/alex-ju)! - `Hds::Form::Field` - Fix error message for unexpected `@layout` values
20
+
21
+ - Updated dependencies []:
22
+ - @hashicorp/ember-flight-icons@3.0.9
23
+
24
+ ## 2.8.1
25
+
26
+ ### Patch Changes
27
+
28
+ - [#1516](https://github.com/hashicorp/design-system/pull/1516) [`f2192cad7`](https://github.com/hashicorp/design-system/commit/f2192cad73b6d966bf813f54dcee02e157c76392) Thanks [@didoo](https://github.com/didoo)! - `Hds::SideNav` - Fixed issue with links still being interactive (even if visually hidden) when the navigation is "minimized"
29
+
30
+ - [#1518](https://github.com/hashicorp/design-system/pull/1518) [`5fd48e31e`](https://github.com/hashicorp/design-system/commit/5fd48e31ed3241ee19a8226bb28fa04ad79479c5) Thanks [@didoo](https://github.com/didoo)! - `Hds::PageHeader` - Fixed overflow of non-breaking text for `title`, `subtitle` and `description` elements
31
+
32
+ - [#1494](https://github.com/hashicorp/design-system/pull/1494) [`169a85b63`](https://github.com/hashicorp/design-system/commit/169a85b6348649bc0e2411f3ab6f6a086eecb692) Thanks [@natmegs](https://github.com/natmegs)! - `Hds::Form::TextInput` - Add support for `datetime-local` type
33
+
34
+ - [#1500](https://github.com/hashicorp/design-system/pull/1500) [`b6c2867a4`](https://github.com/hashicorp/design-system/commit/b6c2867a4b7d1c183e9a17d16208ed12ce1aa43f) Thanks [@didoo](https://github.com/didoo)! - `Hds::SideNav` - updated layout styling for the `SideNav::List::Title` element
35
+
36
+ - [#1520](https://github.com/hashicorp/design-system/pull/1520) [`7f7ec22c3`](https://github.com/hashicorp/design-system/commit/7f7ec22c387ac9df05d05de31e5c2b45d6324777) Thanks [@alex-ju](https://github.com/alex-ju)! - Upgrade `ember-style-modifier` to `3.0.1`
37
+
38
+ - Updated dependencies [[`fd5953633`](https://github.com/hashicorp/design-system/commit/fd595363396c2e6672025ab8f9c3df7d2a3fce53)]:
39
+ - @hashicorp/design-system-tokens@1.7.0
40
+ - @hashicorp/ember-flight-icons@3.0.8
41
+
3
42
  ## 2.8.0
4
43
 
5
44
  ### Minor Changes
6
45
 
7
- - [#1492](https://github.com/hashicorp/design-system/pull/1492) [`a17e5b2ac`](https://github.com/hashicorp/design-system/commit/a17e5b2acf66493ccbb68a623a3b7ba2fd5ab5a8) Thanks [@KristinLBradley](https://github.com/KristinLBradley)! - `Card` - Updated default value of `@overflow` argument to `"visible"` to address an area of consumer confusion and better support the most common use cases.
46
+ - [#1492](https://github.com/hashicorp/design-system/pull/1492) [`a17e5b2ac`](https://github.com/hashicorp/design-system/commit/a17e5b2acf66493ccbb68a623a3b7ba2fd5ab5a8) Thanks [@KristinLBradley](https://github.com/KristinLBradley)! - `Hds::Card` - Updated default value of `@overflow` argument to `"visible"` to address an area of consumer confusion and better support the most common use cases.
8
47
 
9
- Technically, this is a breaking change as it will require consumers relying upon the previous `hidden` default value to now manually set the value. The result of not setting the a `"hidden"` value can cause square edges of some images to "stick out" and overlap the rounded corners of the Card itself. We considered this to be a fairly minor, low-impact issue however which would not affect functionality or usability.
48
+ Technically, this is a breaking change as it will require consumers relying upon the previous `hidden` default value to now manually set the value. The result of not setting the a `hidden` value can cause square edges of some images to "stick out" and overlap the rounded corners of the Card itself. We considered this to be a fairly minor, low-impact issue however which would not affect functionality or usability.
10
49
 
11
- - [#1452](https://github.com/hashicorp/design-system/pull/1452) [`c277d0366`](https://github.com/hashicorp/design-system/commit/c277d036673cf572c00ebf5b8b35b424c0b057fd) Thanks [@alex-ju](https://github.com/alex-ju)! - `Form::TextInput` - Add loading state on "search" type
50
+ - [#1452](https://github.com/hashicorp/design-system/pull/1452) [`c277d0366`](https://github.com/hashicorp/design-system/commit/c277d036673cf572c00ebf5b8b35b424c0b057fd) Thanks [@alex-ju](https://github.com/alex-ju)! - `Hds::Form::TextInput` - Add loading state on "search" type
12
51
 
13
- - [#1468](https://github.com/hashicorp/design-system/pull/1468) [`b0a766ccf`](https://github.com/hashicorp/design-system/commit/b0a766ccf5357dd6f0e8dfb68d8c1ee823e76b50) Thanks [@alex-ju](https://github.com/alex-ju)! - Added `MaskedInput` component for forms
52
+ - [#1468](https://github.com/hashicorp/design-system/pull/1468) [`b0a766ccf`](https://github.com/hashicorp/design-system/commit/b0a766ccf5357dd6f0e8dfb68d8c1ee823e76b50) Thanks [@alex-ju](https://github.com/alex-ju)! - Add `Hds::Form::MaskedInput` component
14
53
 
15
- - [#1423](https://github.com/hashicorp/design-system/pull/1423) [`5ac340c8c`](https://github.com/hashicorp/design-system/commit/5ac340c8c3a3adab388704067578cf419e2e2f10) Thanks [@KristinLBradley](https://github.com/KristinLBradley)! - Add new `Accordion` component
54
+ - [#1423](https://github.com/hashicorp/design-system/pull/1423) [`5ac340c8c`](https://github.com/hashicorp/design-system/commit/5ac340c8c3a3adab388704067578cf419e2e2f10) Thanks [@KristinLBradley](https://github.com/KristinLBradley)! - Add `Hds::Accordion` component
16
55
 
17
56
  ### Patch Changes
18
57
 
@@ -60,7 +99,7 @@
60
99
 
61
100
  - [#1426](https://github.com/hashicorp/design-system/pull/1426) [`1f8886a2d`](https://github.com/hashicorp/design-system/commit/1f8886a2d5117d74a0dddd4bca4a09d9fcedc8da) Thanks [@MelSumner](https://github.com/MelSumner)! - Style tweaks to standalone link
62
101
 
63
- - [#1434](https://github.com/hashicorp/design-system/pull/1434) [`eadefc4bd`](https://github.com/hashicorp/design-system/commit/eadefc4bdb4e5fd6c110a7be1d7d9aa720695678) Thanks [@alex-ju](https://github.com/alex-ju)! - Fix scroll management on `Modal` and `Flyout` resulting in stray `style` attribute on `<body>` element
102
+ - [#1434](https://github.com/hashicorp/design-system/pull/1434) [`eadefc4bd`](https://github.com/hashicorp/design-system/commit/eadefc4bdb4e5fd6c110a7be1d7d9aa720695678) Thanks [@alex-ju](https://github.com/alex-ju)! - Fix scroll management on `Hds::Modal` and `Hds::Flyout` resulting in stray `style` attribute on `<body>` element
64
103
 
65
104
  - Updated dependencies [[`e6e0c22c5`](https://github.com/hashicorp/design-system/commit/e6e0c22c538e381f4a97428dc35cf1295ce6ae21)]:
66
105
  - @hashicorp/ember-flight-icons@3.0.6
@@ -1,3 +1,8 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
5
+
1
6
  <button
2
7
  class={{this.classNames}}
3
8
  type="button"
@@ -1,3 +1,8 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
5
+
1
6
  <Hds::DisclosurePrimitive class={{this.classNames}} @isOpen={{@isOpen}} ...attributes>
2
7
  <:toggle as |t|>
3
8
  <div class="hds-accordion-item__toggle">
@@ -0,0 +1,16 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
5
+ <Hds::Button
6
+ class={{this.classNames}}
7
+ @size={{this.size}}
8
+ @isFullWidth={{@isFullWidth}}
9
+ @text={{@text}}
10
+ @icon={{this.icon}}
11
+ @isIconOnly={{@isIconOnly}}
12
+ @color="secondary"
13
+ @iconPosition="trailing"
14
+ {{clipboard text=@textToCopy target=@targetToCopy container=@container onError=this.onError onSuccess=this.onSuccess}}
15
+ ...attributes
16
+ />
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ import Component from '@glimmer/component';
7
+ import { assert } from '@ember/debug';
8
+ import { tracked } from '@glimmer/tracking';
9
+ import { action } from '@ember/object';
10
+
11
+ export const DEFAULT_SIZE = 'medium';
12
+ export const SIZES = ['small', 'medium'];
13
+ export const DEFAULT_ICON = 'clipboard-copy';
14
+ export const SUCCESS_ICON = 'clipboard-checked';
15
+ export const ERROR_ICON = 'clipboard';
16
+ export const DEFAULT_STATUS = 'idle';
17
+
18
+ export default class HdsCopyButtonComponent extends Component {
19
+ @tracked status = DEFAULT_STATUS;
20
+ @tracked timer;
21
+
22
+ /**
23
+ * @param icon
24
+ * @type {string}
25
+ * @description The icon to be displayed for each status; automatically calculated based on the tracked property `status`.
26
+ */
27
+ get icon() {
28
+ let icon = DEFAULT_ICON;
29
+ if (this.status === 'success') {
30
+ icon = SUCCESS_ICON;
31
+ } else if (this.status === 'error') {
32
+ icon = ERROR_ICON;
33
+ }
34
+ return icon;
35
+ }
36
+
37
+ /**
38
+ * @param size
39
+ * @type {string}
40
+ * @default medium
41
+ * @description The size of the copy/button; acceptable values are `small` and `medium`
42
+ */
43
+ get size() {
44
+ let { size = DEFAULT_SIZE } = this.args;
45
+
46
+ assert(
47
+ `@size for "Hds::Copy::Button" must be one of the following: ${SIZES.join(
48
+ ', '
49
+ )}; received: ${size}`,
50
+ SIZES.includes(size)
51
+ );
52
+
53
+ return size;
54
+ }
55
+
56
+ /**
57
+ * Get the class names to apply to the component.
58
+ * @method CopyButton#classNames
59
+ * @return {string} The "class" attribute to apply to the component.
60
+ */
61
+ get classNames() {
62
+ let classes = ['hds-copy-button'];
63
+
64
+ // add a class based on the @size argument
65
+ classes.push(`hds-button--size-${this.size}`);
66
+
67
+ classes.push(`hds-copy-button--status-${this.status}`);
68
+
69
+ return classes.join(' ');
70
+ }
71
+
72
+ @action
73
+ onSuccess() {
74
+ this.status = 'success';
75
+ this.resetStatusDelayed();
76
+ }
77
+
78
+ @action
79
+ onError() {
80
+ this.status = 'error';
81
+ this.resetStatusDelayed();
82
+ }
83
+
84
+ resetStatusDelayed() {
85
+ clearTimeout(this.timer);
86
+ // make it fade back to the default state
87
+ this.timer = setTimeout(() => {
88
+ this.status = DEFAULT_STATUS;
89
+ }, 1500);
90
+ }
91
+ }
@@ -0,0 +1,15 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
5
+ <button
6
+ type="button"
7
+ class={{this.classNames}}
8
+ {{clipboard text=@textToCopy onError=this.onError onSuccess=this.onSuccess}}
9
+ ...attributes
10
+ >
11
+ <span class="hds-copy-snippet__text hds-typography-code-100 {{if @isTruncated 'hds-copy-snippet__text--truncated'}}">
12
+ {{@textToCopy}}
13
+ </span>
14
+ <FlightIcon @name={{this.icon}} class="hds-copy-snippet__icon" />
15
+ </button>
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ import Component from '@glimmer/component';
7
+ import { assert } from '@ember/debug';
8
+ import { tracked } from '@glimmer/tracking';
9
+ import { action } from '@ember/object';
10
+
11
+ export const DEFAULT_COLOR = 'primary';
12
+ export const COLORS = ['primary', 'secondary'];
13
+ export const DEFAULT_ICON = 'clipboard-copy';
14
+ export const SUCCESS_ICON = 'clipboard-checked';
15
+ export const ERROR_ICON = 'clipboard';
16
+ export const DEFAULT_STATUS = 'idle';
17
+
18
+ export default class HdsCopySnippetIndexComponent extends Component {
19
+ @tracked status = DEFAULT_STATUS;
20
+ @tracked timer;
21
+
22
+ /**
23
+ * @param icon
24
+ * @type {string}
25
+ * @default DEFAULT_ICON
26
+ * @description Determines the icon to be used, based on the success state. Note that this is auto-tracked because it depends on a tracked property (status).
27
+ */
28
+ get icon() {
29
+ let icon = DEFAULT_ICON;
30
+ if (this.status === 'success') {
31
+ icon = SUCCESS_ICON;
32
+ } else if (this.status === 'error') {
33
+ icon = ERROR_ICON;
34
+ }
35
+ return icon;
36
+ }
37
+
38
+ /**
39
+ * @param color
40
+ * @type {string}
41
+ * @default primary
42
+ * @description Determines the color of button to be used; acceptable values are `primary` and `secondary`
43
+ */
44
+ get color() {
45
+ let { color = DEFAULT_COLOR } = this.args;
46
+
47
+ assert(
48
+ `@color for "Hds::Copy::Snippet" must be one of the following: ${COLORS.join(
49
+ ', '
50
+ )}; received: ${color}`,
51
+ COLORS.includes(color)
52
+ );
53
+
54
+ return color;
55
+ }
56
+
57
+ /**
58
+ * @param isFullWidth
59
+ * @type {boolean}
60
+ * @default false
61
+ * @description Indicates that the component should take up the full width of the parent container.
62
+ */
63
+ get isFullWidth() {
64
+ return this.args.isFullWidth ?? false;
65
+ }
66
+
67
+ /**
68
+ * @param isTruncated
69
+ * @type {boolean}
70
+ * @default false
71
+ * @description Indicates that the component should be truncated instead of wrapping text and using multiple lines.
72
+ */
73
+ get isTruncated() {
74
+ return this.args.isTruncated ?? false;
75
+ }
76
+
77
+ /**
78
+ * Get the class names to apply to the component.
79
+ * @method CopySnippet#classNames
80
+ * @return {string} The "class" attribute to apply to the component.
81
+ */
82
+ get classNames() {
83
+ let classes = ['hds-copy-snippet'];
84
+
85
+ // add a class based on the @color argument
86
+ classes.push(`hds-copy-snippet--color-${this.color}`);
87
+
88
+ // add a class based on the tracked status (idle/success/error)
89
+ classes.push(`hds-copy-snippet--status-${this.status}`);
90
+
91
+ // add a class based on the @isFullWidth argument
92
+ if (this.isFullWidth) {
93
+ classes.push('hds-copy-snippet--width-full');
94
+ }
95
+
96
+ return classes.join(' ');
97
+ }
98
+
99
+ @action
100
+ onSuccess() {
101
+ this.status = 'success';
102
+ this.resetStatusDelayed();
103
+ }
104
+
105
+ @action
106
+ onError() {
107
+ this.status = 'error';
108
+ this.resetStatusDelayed();
109
+ }
110
+
111
+ resetStatusDelayed() {
112
+ clearTimeout(this.timer);
113
+ // make it fade back to the default state
114
+ this.timer = setTimeout(() => {
115
+ this.status = DEFAULT_STATUS;
116
+ }, 1500);
117
+ }
118
+ }
@@ -8,13 +8,5 @@
8
8
  class="hds-dropdown-list-item__copy-item-title hds-typography-body-100 hds-font-weight-semibold"
9
9
  >{{@copyItemTitle}}</div>
10
10
  {{/if}}
11
- <button type="button" class="{{if this.isSuccess 'is-success'}}" {{on "click" this.copyCode}}>
12
- <div class="hds-dropdown-list-item__copy-item-text hds-typography-code-100">
13
- {{this.text}}
14
- </div>
15
- <FlightIcon
16
- @name="{{if this.isSuccess 'clipboard-checked' 'clipboard-copy'}}"
17
- class="hds-dropdown-list-item__copy-item-icon"
18
- />
19
- </button>
11
+ <Hds::Copy::Snippet @textToCopy={{this.text}} @isTruncated={{@isTruncated}} />
20
12
  </li>
@@ -5,12 +5,8 @@
5
5
 
6
6
  import Component from '@glimmer/component';
7
7
  import { assert } from '@ember/debug';
8
- import { tracked } from '@glimmer/tracking';
9
- import { action } from '@ember/object';
10
8
 
11
9
  export default class HdsDropdownListItemCopyItemComponent extends Component {
12
- @tracked isSuccess = false;
13
-
14
10
  /**
15
11
  * @param text
16
12
  * @type {string}
@@ -26,7 +22,6 @@ export default class HdsDropdownListItemCopyItemComponent extends Component {
26
22
 
27
23
  return text;
28
24
  }
29
-
30
25
  /**
31
26
  * Get the class names to apply to the component.
32
27
  * @method classNames
@@ -40,29 +35,4 @@ export default class HdsDropdownListItemCopyItemComponent extends Component {
40
35
 
41
36
  return classes.join(' ');
42
37
  }
43
-
44
- @action
45
- async copyCode() {
46
- // https://developer.mozilla.org/en-US/docs/Web/API/Clipboard
47
- await navigator.clipboard.writeText(this.args.text);
48
-
49
- if (navigator.clipboard.readText) {
50
- const result = await navigator.clipboard.readText();
51
-
52
- if (result === this.args.text) {
53
- this.isSuccess = true;
54
- }
55
- } else {
56
- // assume that it works so Firefox can show the success state
57
- // doesn't confirm that you'll get the correct pasted text
58
- // but we accept this as a reasonable tradeoff
59
- // since users can always copy/paste manually.
60
- this.isSuccess = true;
61
- }
62
-
63
- // make it fade back to the default state
64
- setTimeout(() => {
65
- this.isSuccess = false;
66
- }, 1000);
67
- }
68
38
  }
@@ -8,6 +8,15 @@ import { tracked } from '@glimmer/tracking';
8
8
  import { action } from '@ember/object';
9
9
  import { assert } from '@ember/debug';
10
10
  import { getElementId } from '@hashicorp/design-system-components/utils/hds-get-element-id';
11
+ import { buildWaiter } from '@ember/test-waiters';
12
+ import { DEBUG } from '@glimmer/env';
13
+
14
+ let waiter;
15
+
16
+ // Notice: this code will get stripped out in production builds (DEBUG evaluates to `true` in dev/test builds, but `false` in prod builds)
17
+ if (DEBUG) {
18
+ waiter = buildWaiter('@hashicorp/design-system-components:flyout');
19
+ }
11
20
 
12
21
  export const DEFAULT_SIZE = 'medium';
13
22
  export const DEFAULT_HAS_OVERLAY = true;
@@ -115,7 +124,19 @@ export default class HdsFlyoutIndexComponent extends Component {
115
124
  }
116
125
 
117
126
  @action
118
- onDismiss() {
127
+ async onDismiss() {
128
+ // allow ember test helpers to be aware of when the `close` event fires
129
+ // when using `click` or other helpers from '@ember/test-helpers'
130
+ // Notice: this code will get stripped out in production builds (DEBUG evaluates to `true` in dev/test builds, but `false` in prod builds)
131
+ if (DEBUG && this.element.open) {
132
+ let token = waiter.beginAsync();
133
+ let listener = () => {
134
+ waiter.endAsync(token);
135
+ this.element.removeEventListener('close', listener);
136
+ };
137
+ this.element.addEventListener('close', listener);
138
+ }
139
+
119
140
  // Make flyout dialog invisible using the native `close` method
120
141
  this.element.close();
121
142
 
@@ -40,7 +40,7 @@ export default class HdsFormFieldIndexComponent extends Component {
40
40
  let { layout } = this.args;
41
41
 
42
42
  assert(
43
- `@type for "Hds::Form::Field" must be one of the following: ${LAYOUT_TYPES.join(
43
+ `@layout for "Hds::Form::Field" must be one of the following: ${LAYOUT_TYPES.join(
44
44
  ', '
45
45
  )}; received: ${layout}`,
46
46
  LAYOUT_TYPES.includes(layout)
@@ -16,6 +16,7 @@ export const TYPES = [
16
16
  'url',
17
17
  'date',
18
18
  'time',
19
+ 'datetime-local',
19
20
  'search',
20
21
  ];
21
22
 
@@ -8,6 +8,15 @@ import { tracked } from '@glimmer/tracking';
8
8
  import { action } from '@ember/object';
9
9
  import { assert } from '@ember/debug';
10
10
  import { getElementId } from '@hashicorp/design-system-components/utils/hds-get-element-id';
11
+ import { buildWaiter } from '@ember/test-waiters';
12
+ import { DEBUG } from '@glimmer/env';
13
+
14
+ let waiter;
15
+
16
+ // Notice: this code will get stripped out in production builds (DEBUG evaluates to `true` in dev/test builds, but `false` in prod builds)
17
+ if (DEBUG) {
18
+ waiter = buildWaiter('@hashicorp/design-system-components:modal');
19
+ }
11
20
 
12
21
  export const DEFAULT_SIZE = 'medium';
13
22
  export const DEFAULT_COLOR = 'neutral';
@@ -156,7 +165,19 @@ export default class HdsModalIndexComponent extends Component {
156
165
  }
157
166
 
158
167
  @action
159
- onDismiss() {
168
+ async onDismiss() {
169
+ // allow ember test helpers to be aware of when the `close` event fires
170
+ // when using `click` or other helpers from '@ember/test-helpers'
171
+ // Notice: this code will get stripped out in production builds (DEBUG evaluates to `true` in dev/test builds, but `false` in prod builds)
172
+ if (DEBUG && this.element.open) {
173
+ let token = waiter.beginAsync();
174
+ let listener = () => {
175
+ waiter.endAsync(token);
176
+ this.element.removeEventListener('close', listener);
177
+ };
178
+ this.element.addEventListener('close', listener);
179
+ }
180
+
160
181
  // Make modal dialog invisible using the native `close` method
161
182
  this.element.close();
162
183
 
@@ -8,7 +8,7 @@
8
8
  {{yield (hash IconTile=(component "hds/icon-tile" size="medium"))}}
9
9
  <div class="hds-page-header__main">
10
10
  <div class="hds-page-header__content">
11
- <div class="hds-page-header__title-main">
11
+ <div class="hds-page-header__title-wrapper">
12
12
  {{yield (hash Title=(component "hds/page-header/title"))}}
13
13
  {{yield (hash Badges=(component "hds/page-header/badges"))}}
14
14
  </div>
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ export { default } from '@hashicorp/design-system-components/components/hds/copy/button/index';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ export { default } from '@hashicorp/design-system-components/components/hds/copy/index';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ export { default } from '@hashicorp/design-system-components/components/hds/copy/snippet/index';
@@ -23,6 +23,7 @@
23
23
  @use "../components/button";
24
24
  @use "../components/button-set";
25
25
  @use "../components/card";
26
+ @use "../components/copy";
26
27
  @use "../components/disclosure-primitive";
27
28
  @use "../components/dismiss-button";
28
29
  @use "../components/dropdown";
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ //
7
+ // COPY > BUTTON
8
+ //
9
+
10
+ // mostly the hds-button but with a few style tweaks
11
+ // so the CSS is scoped to the component class (we're not changing any of the other class names)
12
+ .hds-copy-button {
13
+ cursor: pointer;
14
+
15
+ .hds-button__icon {
16
+ color: var(--token-color-foreground-action);
17
+ }
18
+
19
+ &.hds-copy-button--status-success {
20
+ .hds-button__icon {
21
+ color: var(--token-color-foreground-success);
22
+ }
23
+ }
24
+
25
+ &.hds-copy-button--status-error {
26
+ .hds-button__icon {
27
+ color: var(--token-color-foreground-critical);
28
+ }
29
+ }
30
+ }
31
+
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ @use "./button.scss";
7
+ @use "./snippet.scss";
8
+
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ //
7
+ // COPY > SNIPPET
8
+ //
9
+ @use "../../mixins/focus-ring" as *;
10
+
11
+ .hds-copy-snippet {
12
+ @include hds-focus-ring-with-pseudo-element();
13
+
14
+ display: flex;
15
+ gap: 8px;
16
+ align-items: center;
17
+ justify-content: space-between;
18
+ width: 100%;
19
+ padding: 6px 4px;
20
+ white-space: normal;
21
+ text-align: left;
22
+ overflow-wrap: anywhere;
23
+ border: 1px solid transparent;
24
+ border-radius: 5px;
25
+ cursor: pointer;
26
+ }
27
+
28
+ .hds-copy-snippet--color-primary {
29
+ color: var(--token-color-foreground-action);
30
+ background-color: var(--token-color-surface-interactive);
31
+
32
+ &:hover,
33
+ &.mock-hover {
34
+ color: var(--token-color-foreground-action-hover);
35
+ border-color: var(--token-color-border-strong);
36
+ }
37
+
38
+ &:active,
39
+ &.mock-active {
40
+ color: var(--token-color-foreground-action-active);
41
+ background-color: var(--token-color-surface-interactive-active);
42
+ border-color: var(--token-color-border-strong);
43
+ }
44
+ }
45
+
46
+ .hds-copy-snippet--color-secondary {
47
+ color: var(--token-color-foreground-primary);
48
+ background-color: var(--token-color-surface-interactive);
49
+
50
+ &:hover,
51
+ &.mock-hover {
52
+ border-color: var(--token-color-border-strong);
53
+ }
54
+
55
+ &:active,
56
+ &.mock-active {
57
+ background-color: var(--token-color-surface-interactive-active);
58
+ border-color: var(--token-color-border-strong);
59
+ }
60
+
61
+ .hds-copy-snippet__icon {
62
+ color: var(--token-color-foreground-action);
63
+
64
+ &:hover {
65
+ color: var(--token-color-foreground-action-hover);
66
+ }
67
+
68
+ &:active {
69
+ color: var(--token-color-foreground-action-active);
70
+ }
71
+
72
+ &:focus {
73
+ color: var(--token-color-foreground-action);
74
+ }
75
+ }
76
+ }
77
+
78
+ .hds-copy-snippet--status-success {
79
+ .hds-copy-snippet__icon {
80
+ color: var(--token-color-foreground-success);
81
+ }
82
+ }
83
+
84
+ .hds-copy-snippet--status-error {
85
+ .hds-copy-snippet__icon {
86
+ color: var(--token-color-foreground-critical);
87
+ }
88
+ }
89
+
90
+ .hds-copy-snippet__text {
91
+ flex: 1 0 0;
92
+ max-width: calc(100% - 24px);
93
+ }
94
+
95
+ .hds-copy-snippet__icon {
96
+ flex: none;
97
+ }
98
+
99
+ .hds-copy-snippet--width-full {
100
+ justify-content: center;
101
+
102
+ .hds-copy-snippet__text {
103
+ flex: 0 0 auto;
104
+ }
105
+ }
106
+
107
+ .hds-copy-snippet__text--truncated {
108
+ overflow: hidden;
109
+ white-space: nowrap;
110
+ text-overflow: ellipsis;
111
+ }
@@ -279,60 +279,8 @@ $hds-dropdown-toggle-border-radius: $hds-button-border-radius;
279
279
  .hds-dropdown-list-item--variant-copy-item {
280
280
  width: 100%;
281
281
  padding: 10px 16px 12px;
282
-
283
- button {
284
- display: flex;
285
- justify-content: space-between;
286
- width: 100%;
287
- padding: 12px 8px;
288
- color: var(--token-color-foreground-primary);
289
- background-color: transparent;
290
- border: 1px solid var(--token-color-border-primary);
291
- border-radius: 5px;
292
-
293
- &:hover,
294
- &.mock-hover {
295
- background-color: var(--token-color-surface-interactive-hover);
296
- cursor: pointer;
297
- }
298
-
299
- @include hds-focus-ring-basic();
300
-
301
- &:focus,
302
- &.mock-focus {
303
- // TODO this focus is just way too complex
304
- background-color: var(--token-color-surface-action);
305
- border-color: var(--token-color-focus-action-internal);
306
- }
307
-
308
- &:active,
309
- &.mock-active {
310
- background-color: var(--token-color-surface-interactive-active);
311
- }
312
-
313
- &.is-success {
314
- background-color: var(--token-color-surface-success);
315
- border-color: var(--token-color-border-success);
316
-
317
- .hds-dropdown-list-item__copy-item-icon {
318
- color: var(--token-color-foreground-success);
319
- }
320
- }
321
- }
322
- }
323
-
324
- .hds-dropdown-list-item__copy-item-text {
325
- overflow: hidden;
326
- white-space: nowrap;
327
- text-align: left;
328
- text-overflow: ellipsis;
329
282
  }
330
283
 
331
- .hds-dropdown-list-item__copy-item-icon {
332
- flex: none;
333
- margin-left: 8px;
334
- color: var(--token-color-foreground-action);
335
- }
336
284
 
337
285
  // HDS::DROPDOWN::LIST-ITEM::DESCRIPTION
338
286
 
@@ -88,7 +88,8 @@
88
88
  // DATE/TIME
89
89
 
90
90
  &[type="date"],
91
- &[type="time"] {
91
+ &[type="time"],
92
+ &[type="datetime-local"] {
92
93
 
93
94
  // browsers set a specific width for these controls, we want to keep it
94
95
  width: initial;
@@ -108,7 +109,8 @@
108
109
 
109
110
  // we override the default icon with the Flight corresponding one
110
111
  // notice: the original in Chrome has two assets, one for light and one for dark mode, and uses a special syntax, but apparently it doesn't work if used in a stylesheet
111
- &[type="date"] {
112
+ &[type="date"],
113
+ &[type="datetime-local"] {
112
114
  &::-webkit-calendar-picker-indicator {
113
115
  background-image: var(--token-form-text-input-background-image-data-url-date);
114
116
  background-position: center center;
@@ -42,6 +42,7 @@
42
42
  @container (min-width: 768px) {
43
43
  flex-direction: row;
44
44
  justify-content: space-between;
45
+ min-width: 0; // this is important or it will blow beyond the parent flexbox width with long non-breaking names
45
46
  }
46
47
  }
47
48
 
@@ -50,9 +51,11 @@
50
51
  flex-direction: column;
51
52
  flex-grow: 1;
52
53
  gap: 8px;
54
+ min-width: 0; // this is important or it will blow beyond the parent flexbox width with long non-breaking names
55
+ max-width: 100%;
53
56
  }
54
57
 
55
- .hds-page-header__title-main {
58
+ .hds-page-header__title-wrapper {
56
59
  display: flex;
57
60
  flex-direction: row;
58
61
  flex-wrap: wrap;
@@ -60,6 +63,11 @@
60
63
  align-items: center;
61
64
  }
62
65
 
66
+ .hds-page-header__title {
67
+ max-width: 100%;
68
+ overflow-wrap: break-word;
69
+ }
70
+
63
71
  .hds-page-header__badges-wrapper {
64
72
  display: flex;
65
73
  flex-wrap: wrap;
@@ -72,6 +80,11 @@
72
80
  gap: 4px;
73
81
  }
74
82
 
83
+ .hds-page-header__subtitle,
84
+ .hds-page-header__description {
85
+ overflow-wrap: break-word;
86
+ }
87
+
75
88
  .hds-page-header__actions {
76
89
  display: flex;
77
90
  flex-direction: row;
@@ -34,9 +34,9 @@
34
34
  .hds-side-nav__list-title {
35
35
  display: flex;
36
36
  align-items: center;
37
- min-height: 34px;
37
+ min-height: var(--token-side-nav-body-list-item-height);
38
38
  margin-top: var(--token-side-nav-body-list-margin-vertical);
39
- padding: 0 var(--token-side-nav-body-list-item-padding-horizontal);
39
+ padding: 9px var(--token-side-nav-body-list-item-padding-horizontal); // 8px = (min-height - body-100-line-height) / 2
40
40
  color: var(--token-side-nav-color-foreground-faint);
41
41
 
42
42
  // Remove margin from title at top of all list-items & lists
@@ -191,6 +191,19 @@
191
191
  visibility: hidden !important; // we need `!important` here to override the inline style applied to the single panels
192
192
  opacity: 0;
193
193
  transition: none;
194
+ // this is needed because, despite the element having `visibility: hidden`,
195
+ // the child elements ("panels") have their visibility dynamically managed via JS
196
+ // and when they have "visibility: visible" applied, they are not visually visible
197
+ // (because of the `opacity: 0` of the parent) but the user can still interact with them
198
+ // and click on the links inside the sidenav even if they're not visible at all,
199
+ // so we have to block the interactivity of the whole container
200
+ // for reference see these PRs:
201
+ // - https://github.com/hashicorp/design-system/pull/1338
202
+ // - https://github.com/hashicorp/design-system/pull/1388
203
+ // - https://github.com/hashicorp/design-system/pull/1516
204
+ // and this codepen with a redux of the problem:
205
+ // - https://codepen.io/didoo/pen/mdQKMJW?editors=1100
206
+ pointer-events: none;
194
207
  }
195
208
 
196
209
  .hds-side-nav--is-mobile.hds-side-nav--is-not-minimized &,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashicorp/design-system-components",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "Helios Design System Components",
5
5
  "keywords": [
6
6
  "hashicorp",
@@ -40,13 +40,15 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@ember/render-modifiers": "^2.0.5",
43
- "@hashicorp/design-system-tokens": "^1.6.0",
44
- "@hashicorp/ember-flight-icons": "^3.0.7",
43
+ "@ember/test-waiters": "^3.0.2",
44
+ "@hashicorp/design-system-tokens": "^1.7.0",
45
+ "@hashicorp/ember-flight-icons": "^3.0.9",
45
46
  "dialog-polyfill": "^0.5.6",
46
47
  "ember-a11y-refocus": "^3.0.2",
47
48
  "ember-auto-import": "^2.6.3",
48
49
  "ember-cached-decorator-polyfill": "^0.1.4",
49
50
  "ember-cli-babel": "^7.26.11",
51
+ "ember-cli-clipboard": "^1.0.0",
50
52
  "ember-cli-htmlbars": "^6.2.0",
51
53
  "ember-cli-sass": "^10.0.1",
52
54
  "ember-composable-helpers": "^4.5.0",
@@ -54,7 +56,7 @@
54
56
  "ember-keyboard": "^8.2.0",
55
57
  "ember-named-blocks-polyfill": "^0.2.5",
56
58
  "ember-stargate": "^0.4.3",
57
- "ember-style-modifier": "^0.8.0",
59
+ "ember-style-modifier": "^3.0.1",
58
60
  "ember-truth-helpers": "^3.1.1",
59
61
  "sass": "^1.62.1",
60
62
  "tippy.js": "^6.3.7"
@@ -73,7 +75,6 @@
73
75
  "ember-a11y-testing": "^5.2.1",
74
76
  "ember-body-class": "^3.0.0",
75
77
  "ember-cli": "~4.12.1",
76
- "ember-cli-clipboard": "^1.0.0",
77
78
  "ember-cli-dependency-checker": "^3.3.1",
78
79
  "ember-cli-deprecation-workflow": "^2.1.0",
79
80
  "ember-cli-inject-live-reload": "^2.1.0",
@@ -102,7 +103,7 @@
102
103
  "prettier": "^2.8.8",
103
104
  "qunit": "^2.19.4",
104
105
  "qunit-dom": "^2.0.0",
105
- "stylelint": "^14.16.1",
106
+ "stylelint": "^15.10.1",
106
107
  "stylelint-config-rational-order": "^0.1.2",
107
108
  "stylelint-config-standard-scss": "^5.0.0",
108
109
  "webpack": "^5.84.1"
@@ -1,6 +0,0 @@
1
- /**
2
- * Copyright (c) HashiCorp, Inc.
3
- * SPDX-License-Identifier: MPL-2.0
4
- */
5
-
6
- export { default } from '@hashicorp/design-system-components/utils/hds-get-element-id';
@@ -1,6 +0,0 @@
1
- /**
2
- * Copyright (c) HashiCorp, Inc.
3
- * SPDX-License-Identifier: MPL-2.0
4
- */
5
-
6
- export { default } from '@hashicorp/design-system-components/utils/hds-set-aria-described-by';