@hashicorp/design-system-components 2.8.1 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -10
- package/addon/components/hds/accordion/item/button.hbs +1 -1
- package/addon/components/hds/accordion/item/index.hbs +1 -1
- package/addon/components/hds/copy/button/index.hbs +16 -0
- package/addon/components/hds/copy/button/index.js +91 -0
- package/addon/components/hds/copy/snippet/index.hbs +15 -0
- package/addon/components/hds/copy/snippet/index.js +118 -0
- package/addon/components/hds/dropdown/list-item/copy-item.hbs +1 -9
- package/addon/components/hds/dropdown/list-item/copy-item.js +0 -30
- package/addon/components/hds/flyout/index.js +22 -1
- package/addon/components/hds/form/field/index.js +1 -1
- package/addon/components/hds/form/file-input/base.hbs +6 -0
- package/addon/components/hds/form/file-input/field.hbs +24 -0
- package/addon/components/hds/icon-tile/index.js +0 -1
- package/addon/components/hds/modal/index.js +22 -1
- package/addon/components/hds/tabs/index.hbs +2 -0
- package/addon/components/hds/tabs/index.js +17 -1
- package/addon/components/hds/tabs/panel.hbs +1 -0
- package/addon/components/hds/tabs/panel.js +9 -0
- package/addon/components/hds/tabs/tab.hbs +1 -0
- package/addon/components/hds/tabs/tab.js +9 -0
- package/app/components/hds/copy/button/index.js +6 -0
- package/app/components/hds/copy/snippet/index.js +6 -0
- package/app/components/hds/form/file-input/base.js +6 -0
- package/app/components/hds/form/file-input/field.js +6 -0
- package/app/styles/@hashicorp/design-system-components.scss +1 -0
- package/app/styles/components/copy/button.scss +31 -0
- package/app/styles/components/copy/index.scss +8 -0
- package/app/styles/components/copy/snippet.scss +111 -0
- package/app/styles/components/dropdown.scss +0 -52
- package/app/styles/components/form/file-input.scss +94 -0
- package/app/styles/components/form/index.scss +1 -0
- package/app/styles/components/segmented-group.scss +4 -4
- package/app/styles/components/table.scss +4 -0
- package/package.json +4 -3
- package/app/utils/hds-get-element-id.js +0 -6
- package/app/utils/hds-set-aria-described-by.js +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,62 @@
|
|
|
1
1
|
# @hashicorp/design-system-components
|
|
2
2
|
|
|
3
|
+
## 2.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1535](https://github.com/hashicorp/design-system/pull/1535) [`2daa95479`](https://github.com/hashicorp/design-system/commit/2daa95479307fea0b94b2af413126d09525462c8) Thanks [@KristinLBradley](https://github.com/KristinLBradley)! - Add new `FileInput` component
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#1570](https://github.com/hashicorp/design-system/pull/1570) [`7bf297996`](https://github.com/hashicorp/design-system/commit/7bf297996e06a15cb2506bfb23f43d71ecc9b492) Thanks [@Dhaulagiri](https://github.com/Dhaulagiri)! - Remove unnecessary export of `hds/copy/index.js`
|
|
12
|
+
|
|
13
|
+
- [#1575](https://github.com/hashicorp/design-system/pull/1575) [`0362019ca`](https://github.com/hashicorp/design-system/commit/0362019ca043ef955364f18b23dbcd36f0bfb2bf) Thanks [@alex-ju](https://github.com/alex-ju)! - `Hds::Tabs` - Fix missing tab indicator when used in Modal or Flyout
|
|
14
|
+
|
|
15
|
+
- [#1567](https://github.com/hashicorp/design-system/pull/1567) [`384faeec2`](https://github.com/hashicorp/design-system/commit/384faeec244011f8090f3bcce0def89da1563164) Thanks [@MelSumner](https://github.com/MelSumner)! - Add support for container in Copy::Snippet and update API docs
|
|
16
|
+
|
|
17
|
+
- [#1571](https://github.com/hashicorp/design-system/pull/1571) [`8ad8a5908`](https://github.com/hashicorp/design-system/commit/8ad8a59080d0c0c855f2f746f0a10ddf4440e461) Thanks [@alex-ju](https://github.com/alex-ju)! - `Hds::Tabs` - Fix tabs and panels misbehaving on route change
|
|
18
|
+
|
|
19
|
+
- [#1568](https://github.com/hashicorp/design-system/pull/1568) [`dbe2e437d`](https://github.com/hashicorp/design-system/commit/dbe2e437d7d465cda3b69c7a28b01cbfb2849b79) Thanks [@MelSumner](https://github.com/MelSumner)! - Update error icon for copy components
|
|
20
|
+
|
|
21
|
+
- [#1555](https://github.com/hashicorp/design-system/pull/1555) [`90a615161`](https://github.com/hashicorp/design-system/commit/90a61516156ea58898febaa5bd66b31386256151) Thanks [@alex-ju](https://github.com/alex-ju)! - `Hds::SegmentedGroup` - prevent `border-radius` from interfering with underlying elements
|
|
22
|
+
|
|
23
|
+
- [#1565](https://github.com/hashicorp/design-system/pull/1565) [`60154db1a`](https://github.com/hashicorp/design-system/commit/60154db1a00f877b2c3bc4a9c4069556e8af809b) Thanks [@MelSumner](https://github.com/MelSumner)! - Resolved issue where ThSort was not supporting right-aligned text properly
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [[`8b8d6bcfa`](https://github.com/hashicorp/design-system/commit/8b8d6bcfa67efa5de1a2cc419167a962e747a8c9)]:
|
|
26
|
+
- @hashicorp/ember-flight-icons@3.1.0
|
|
27
|
+
|
|
28
|
+
## 2.9.0
|
|
29
|
+
|
|
30
|
+
### Minor Changes
|
|
31
|
+
|
|
32
|
+
- [#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.
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- [#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
|
|
37
|
+
|
|
38
|
+
- [#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`
|
|
39
|
+
|
|
40
|
+
- [#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
|
|
41
|
+
|
|
42
|
+
- [#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`
|
|
43
|
+
|
|
44
|
+
- [#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
|
|
45
|
+
|
|
46
|
+
- Updated dependencies []:
|
|
47
|
+
- @hashicorp/ember-flight-icons@3.0.9
|
|
48
|
+
|
|
3
49
|
## 2.8.1
|
|
4
50
|
|
|
5
51
|
### Patch Changes
|
|
6
52
|
|
|
7
|
-
- [#1516](https://github.com/hashicorp/design-system/pull/1516) [`f2192cad7`](https://github.com/hashicorp/design-system/commit/f2192cad73b6d966bf813f54dcee02e157c76392) Thanks [@didoo](https://github.com/didoo)! - `SideNav` - Fixed issue with links still being interactive (even if visually hidden) when the navigation is "minimized"
|
|
53
|
+
- [#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"
|
|
8
54
|
|
|
9
|
-
- [#1518](https://github.com/hashicorp/design-system/pull/1518) [`5fd48e31e`](https://github.com/hashicorp/design-system/commit/5fd48e31ed3241ee19a8226bb28fa04ad79479c5) Thanks [@didoo](https://github.com/didoo)! - `PageHeader` - Fixed overflow of non-breaking text for `title`, `subtitle` and `description` elements
|
|
55
|
+
- [#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
|
|
10
56
|
|
|
11
|
-
- [#1494](https://github.com/hashicorp/design-system/pull/1494) [`169a85b63`](https://github.com/hashicorp/design-system/commit/169a85b6348649bc0e2411f3ab6f6a086eecb692) Thanks [@natmegs](https://github.com/natmegs)! - `Form::TextInput` - Add support for datetime-local type
|
|
57
|
+
- [#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
|
|
12
58
|
|
|
13
|
-
- [#1500](https://github.com/hashicorp/design-system/pull/1500) [`b6c2867a4`](https://github.com/hashicorp/design-system/commit/b6c2867a4b7d1c183e9a17d16208ed12ce1aa43f) Thanks [@didoo](https://github.com/didoo)! -
|
|
59
|
+
- [#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
|
|
14
60
|
|
|
15
61
|
- [#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`
|
|
16
62
|
|
|
@@ -22,15 +68,15 @@
|
|
|
22
68
|
|
|
23
69
|
### Minor Changes
|
|
24
70
|
|
|
25
|
-
- [#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.
|
|
71
|
+
- [#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.
|
|
26
72
|
|
|
27
|
-
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 `
|
|
73
|
+
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.
|
|
28
74
|
|
|
29
|
-
- [#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
|
|
75
|
+
- [#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
|
|
30
76
|
|
|
31
|
-
- [#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)! -
|
|
77
|
+
- [#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
|
|
32
78
|
|
|
33
|
-
- [#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
|
|
79
|
+
- [#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
|
|
34
80
|
|
|
35
81
|
### Patch Changes
|
|
36
82
|
|
|
@@ -78,7 +124,7 @@
|
|
|
78
124
|
|
|
79
125
|
- [#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
|
|
80
126
|
|
|
81
|
-
- [#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
|
|
127
|
+
- [#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
|
|
82
128
|
|
|
83
129
|
- Updated dependencies [[`e6e0c22c5`](https://github.com/hashicorp/design-system/commit/e6e0c22c538e381f4a97428dc35cf1295ce6ae21)]:
|
|
84
130
|
- @hashicorp/ember-flight-icons@3.0.6
|
|
@@ -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-x';
|
|
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 container=@container 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-x';
|
|
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
|
-
<
|
|
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
|
-
`@
|
|
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)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{{!
|
|
2
|
+
Copyright (c) HashiCorp, Inc.
|
|
3
|
+
SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
}}
|
|
5
|
+
<Hds::Form::Field
|
|
6
|
+
@layout="vertical"
|
|
7
|
+
@extraAriaDescribedBy={{@extraAriaDescribedBy}}
|
|
8
|
+
@isRequired={{@isRequired}}
|
|
9
|
+
@isOptional={{@isOptional}}
|
|
10
|
+
@id={{@id}}
|
|
11
|
+
as |F|
|
|
12
|
+
>
|
|
13
|
+
{{! Notice: the order of the elements is not relevant here, because is controlled at "Hds::Form::Field" component level }}
|
|
14
|
+
{{yield (hash Label=F.Label isRequired=F.isRequired isOptional=F.isOptional)}}
|
|
15
|
+
{{yield (hash HelperText=F.HelperText Error=F.Error)}}
|
|
16
|
+
<F.Control>
|
|
17
|
+
<Hds::Form::FileInput::Base
|
|
18
|
+
required={{@isRequired}}
|
|
19
|
+
...attributes
|
|
20
|
+
id={{F.id}}
|
|
21
|
+
aria-describedby={{F.ariaDescribedBy}}
|
|
22
|
+
/>
|
|
23
|
+
</F.Control>
|
|
24
|
+
</Hds::Form::Field>
|
|
@@ -133,7 +133,6 @@ export default class HdsIconTileIndexComponent extends Component {
|
|
|
133
133
|
get entity() {
|
|
134
134
|
let entity;
|
|
135
135
|
|
|
136
|
-
// TODO: discuss if we want these kind of tests
|
|
137
136
|
assert(
|
|
138
137
|
`you can't pass both @logo and @icon properties to the "Hds::IconTile" component`,
|
|
139
138
|
!(this.args.logo && this.args.icon)
|
|
@@ -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
|
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
Tab=(component
|
|
12
12
|
"hds/tabs/tab"
|
|
13
13
|
didInsertNode=this.didInsertTab
|
|
14
|
+
willDestroyNode=this.willDestroyTab
|
|
14
15
|
tabIds=this.tabIds
|
|
15
16
|
panelIds=this.panelIds
|
|
16
17
|
selectedTabIndex=this.selectedTabIndex
|
|
@@ -28,6 +29,7 @@
|
|
|
28
29
|
Panel=(component
|
|
29
30
|
"hds/tabs/panel"
|
|
30
31
|
didInsertNode=this.didInsertPanel
|
|
32
|
+
willDestroyNode=this.willDestroyPanel
|
|
31
33
|
tabIds=this.tabIds
|
|
32
34
|
panelIds=this.panelIds
|
|
33
35
|
selectedTabIndex=this.selectedTabIndex
|
|
@@ -7,6 +7,7 @@ import Component from '@glimmer/component';
|
|
|
7
7
|
import { tracked } from '@glimmer/tracking';
|
|
8
8
|
import { action } from '@ember/object';
|
|
9
9
|
import { assert } from '@ember/debug';
|
|
10
|
+
import { schedule } from '@ember/runloop';
|
|
10
11
|
|
|
11
12
|
export default class HdsTabsIndexComponent extends Component {
|
|
12
13
|
@tracked tabNodes = [];
|
|
@@ -28,7 +29,10 @@ export default class HdsTabsIndexComponent extends Component {
|
|
|
28
29
|
}
|
|
29
30
|
});
|
|
30
31
|
this.selectedTabIndex = initialTabIndex;
|
|
31
|
-
|
|
32
|
+
|
|
33
|
+
schedule('afterRender', () => {
|
|
34
|
+
this.setTabIndicator(initialTabIndex);
|
|
35
|
+
});
|
|
32
36
|
|
|
33
37
|
assert('Only one tab may use isSelected argument', selectedCount <= 1);
|
|
34
38
|
|
|
@@ -44,12 +48,24 @@ export default class HdsTabsIndexComponent extends Component {
|
|
|
44
48
|
this.tabIds = [...this.tabIds, element.id];
|
|
45
49
|
}
|
|
46
50
|
|
|
51
|
+
@action
|
|
52
|
+
willDestroyTab(element) {
|
|
53
|
+
this.tabNodes = this.tabNodes.filter((node) => node.id !== element.id);
|
|
54
|
+
this.tabIds = this.tabIds.filter((tabId) => tabId !== element.id);
|
|
55
|
+
}
|
|
56
|
+
|
|
47
57
|
@action
|
|
48
58
|
didInsertPanel(panelId, element) {
|
|
49
59
|
this.panelNodes = [...this.panelNodes, element];
|
|
50
60
|
this.panelIds = [...this.panelIds, panelId];
|
|
51
61
|
}
|
|
52
62
|
|
|
63
|
+
@action
|
|
64
|
+
willDestroyPanel(element) {
|
|
65
|
+
this.panelNodes = this.panelNodes.filter((node) => node.id !== element.id);
|
|
66
|
+
this.panelIds = this.panelIds.filter((panelId) => panelId !== element.id);
|
|
67
|
+
}
|
|
68
|
+
|
|
53
69
|
@action
|
|
54
70
|
onClick(tabIndex, event) {
|
|
55
71
|
this.selectedTabIndex = tabIndex;
|
|
@@ -42,4 +42,13 @@ export default class HdsTabsIndexComponent extends Component {
|
|
|
42
42
|
didInsertNode(this.elementId, ...arguments);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
|
|
46
|
+
@action
|
|
47
|
+
willDestroyNode() {
|
|
48
|
+
let { willDestroyNode } = this.args;
|
|
49
|
+
|
|
50
|
+
if (typeof willDestroyNode === 'function') {
|
|
51
|
+
willDestroyNode(...arguments);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
45
54
|
}
|
|
@@ -54,6 +54,15 @@ export default class HdsTabsIndexComponent extends Component {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
@action
|
|
58
|
+
willDestroyNode() {
|
|
59
|
+
let { willDestroyNode } = this.args;
|
|
60
|
+
|
|
61
|
+
if (typeof willDestroyNode === 'function') {
|
|
62
|
+
willDestroyNode(...arguments);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
57
66
|
@action
|
|
58
67
|
onClick() {
|
|
59
68
|
let { onClick } = this.args;
|
|
@@ -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,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
|
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
//
|
|
7
|
+
// FORM > FILE-INPUT
|
|
8
|
+
//
|
|
9
|
+
|
|
10
|
+
@use "../../mixins/button" as *;
|
|
11
|
+
|
|
12
|
+
.hds-form-file-input {
|
|
13
|
+
margin: -4px 0 -4px -4px; // offset shadow padding + default 1px spacing
|
|
14
|
+
padding: 3px 0 3px 3px; // add padding so button shadow is visible
|
|
15
|
+
color: var(--token-color-foreground-primary);
|
|
16
|
+
|
|
17
|
+
&:focus,
|
|
18
|
+
&:focus-visible {
|
|
19
|
+
outline: none;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/::file-selector-button
|
|
24
|
+
// https://caniuse.com/?search=file-selector-button
|
|
25
|
+
|
|
26
|
+
// Button
|
|
27
|
+
.hds-form-file-input::file-selector-button {
|
|
28
|
+
min-height: 36px;
|
|
29
|
+
margin-right: 16px;
|
|
30
|
+
padding: 7px 16px 7px 37px; // padding in code altered to match Figma visual design
|
|
31
|
+
color: var(--token-color-foreground-primary);
|
|
32
|
+
font: inherit;
|
|
33
|
+
background-color: var(--token-color-surface-faint);
|
|
34
|
+
// upload icon
|
|
35
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 16 16'%3E%3Cg fill='%233b3d45'%3E%3Cpath d='M4.24 5.8a.75.75 0 001.06-.04l1.95-2.1v6.59a.75.75 0 001.5 0V3.66l1.95 2.1a.75.75 0 101.1-1.02l-3.25-3.5a.75.75 0 00-1.101.001L4.2 4.74a.75.75 0 00.04 1.06z'/%3E%3Cpath d='M1.75 9a.75.75 0 01.75.75v3c0 .414.336.75.75.75h9.5a.75.75 0 00.75-.75v-3a.75.75 0 011.5 0v3A2.25 2.25 0 0112.75 15h-9.5A2.25 2.25 0 011 12.75v-3A.75.75 0 011.75 9z'/%3E%3C/g%3E%3C/svg%3E");
|
|
36
|
+
background-repeat: no-repeat;
|
|
37
|
+
background-position: 15px 50%;
|
|
38
|
+
background-size: var(--token-form-text-input-background-image-size);
|
|
39
|
+
border: $hds-button-border-width solid var(--token-color-border-strong);
|
|
40
|
+
border-radius: $hds-button-border-radius;
|
|
41
|
+
box-shadow: var(--token-elevation-low-box-shadow);
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Button states
|
|
46
|
+
.hds-form-file-input::file-selector-button:hover,
|
|
47
|
+
.hds-form-file-input.mock-hover::file-selector-button {
|
|
48
|
+
color: var(--token-color-foreground-primary);
|
|
49
|
+
background-color: var(--token-color-surface-primary);
|
|
50
|
+
border-color: var(--token-color-border-strong);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.hds-form-file-input:focus-within::file-selector-button,
|
|
54
|
+
.hds-form-file-input.mock-focus::file-selector-button {
|
|
55
|
+
color: var(--token-color-foreground-primary);
|
|
56
|
+
background-color: var(--token-color-surface-faint);
|
|
57
|
+
border-color: var(--token-color-focus-action-internal);
|
|
58
|
+
outline: 3px solid var(--token-color-focus-action-external);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Fix issue with button focus style which was displaying after button was activated
|
|
62
|
+
.hds-form-file-input:not(:focus, .mock-focus) {
|
|
63
|
+
&::file-selector-button {
|
|
64
|
+
border-color: var(--token-color-border-strong);
|
|
65
|
+
outline: 0;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.hds-form-file-input::file-selector-button:active,
|
|
70
|
+
.hds-form-file-input.mock-active::file-selector-button {
|
|
71
|
+
color: var(--token-color-foreground-primary);
|
|
72
|
+
background-color: var(--token-color-surface-interactive-active);
|
|
73
|
+
border-color: var(--token-color-border-strong);
|
|
74
|
+
box-shadow: none;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.hds-form-file-input {
|
|
78
|
+
&:disabled,
|
|
79
|
+
&[disabled],
|
|
80
|
+
&.mock-disabled,
|
|
81
|
+
&:disabled:focus,
|
|
82
|
+
&[disabled]:focus,
|
|
83
|
+
&.mock-disabled:focus,
|
|
84
|
+
&:disabled:hover,
|
|
85
|
+
&[disabled]:hover,
|
|
86
|
+
&.mock-disabled:hover {
|
|
87
|
+
color: var(--token-color-foreground-disabled);
|
|
88
|
+
|
|
89
|
+
&::file-selector-button {
|
|
90
|
+
@include hds-button-state-disabled();
|
|
91
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 16 16'%3E%3Cg fill='%238c909c'%3E%3Cpath d='M4.24 5.8a.75.75 0 001.06-.04l1.95-2.1v6.59a.75.75 0 001.5 0V3.66l1.95 2.1a.75.75 0 101.1-1.02l-3.25-3.5a.75.75 0 00-1.101.001L4.2 4.74a.75.75 0 00.04 1.06z'/%3E%3Cpath d='M1.75 9a.75.75 0 01.75.75v3c0 .414.336.75.75.75h9.5a.75.75 0 00.75-.75v-3a.75.75 0 011.5 0v3A2.25 2.25 0 0112.75 15h-9.5A2.25 2.25 0 011 12.75v-3A.75.75 0 011.75 9z'/%3E%3C/g%3E%3C/svg%3E");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
.hds-segmented-group {
|
|
11
11
|
display: inline-flex;
|
|
12
12
|
|
|
13
|
-
.hds-button,
|
|
14
|
-
.hds-dropdown,
|
|
15
|
-
.hds-form-select,
|
|
16
|
-
.hds-form-text-input {
|
|
13
|
+
> .hds-button,
|
|
14
|
+
> .hds-dropdown,
|
|
15
|
+
> .hds-form-select,
|
|
16
|
+
> .hds-form-text-input {
|
|
17
17
|
&:first-child {
|
|
18
18
|
border-top-right-radius: 0;
|
|
19
19
|
border-bottom-right-radius: 0;
|
|
@@ -159,6 +159,10 @@ $hds-table-cell-padding-tall: 22px 16px 21px 16px; // the 1px difference is to a
|
|
|
159
159
|
text-align: right;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
.hds-table__th-sort--text-right .hds-table__th-sort--button-content {
|
|
163
|
+
justify-content: flex-end;
|
|
164
|
+
}
|
|
165
|
+
|
|
162
166
|
.hds-table__th-sort--text-center,
|
|
163
167
|
.hds-table__th--text-center,
|
|
164
168
|
.hds-table__td--text-center {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashicorp/design-system-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.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
|
+
"@ember/test-waiters": "^3.0.2",
|
|
43
44
|
"@hashicorp/design-system-tokens": "^1.7.0",
|
|
44
|
-
"@hashicorp/ember-flight-icons": "^3.0
|
|
45
|
+
"@hashicorp/ember-flight-icons": "^3.1.0",
|
|
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",
|
|
@@ -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",
|