@hashicorp/design-system-components 0.10.0 → 0.11.2
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 +32 -0
- package/NEW-COMPONENT-CHECKLIST.md +64 -3
- package/README.md +2 -2
- package/addon/components/hds/alert/description.hbs +1 -0
- package/addon/components/hds/alert/index.hbs +31 -0
- package/addon/components/hds/alert/index.js +128 -0
- package/addon/components/hds/alert/title.hbs +1 -0
- package/addon/components/hds/breadcrumb/truncation.hbs +1 -0
- package/addon/components/hds/disclosure/index.hbs +12 -12
- package/addon/components/hds/disclosure/index.js +31 -24
- package/addon/components/hds/dropdown/index.hbs +2 -2
- package/addon/components/hds/dropdown/list-item/copy-item.js +13 -6
- package/addon/components/hds/dropdown/toggle/button.hbs +1 -0
- package/addon/components/hds/dropdown/toggle/icon.hbs +8 -1
- package/addon/components/hds/toast/index.hbs +20 -0
- package/addon/components/hds/yield/index.hbs +3 -0
- package/app/components/hds/alert/description.js +1 -0
- package/app/components/hds/alert/index.js +1 -0
- package/app/components/hds/alert/title.js +1 -0
- package/app/components/hds/toast/index.js +1 -0
- package/app/components/hds/yield/index.js +1 -0
- package/app/styles/@hashicorp/design-system-components.scss +2 -0
- package/app/styles/components/alert.scss +274 -0
- package/app/styles/components/dropdown.scss +34 -40
- package/app/styles/components/toast.scss +16 -0
- package/blueprints/hds-component/files/addon/components/hds/__name__/index.hbs +4 -0
- package/blueprints/hds-component/files/addon/components/hds/__name__/index.js +23 -0
- package/blueprints/hds-component/files/app/components/hds/__name__/index.js +1 -0
- package/blueprints/hds-component/files/app/styles/components/__name__.scss +6 -0
- package/blueprints/hds-component/index.js +26 -0
- package/blueprints/hds-component-test/files/tests/dummy/app/routes/components/__name__.js +3 -0
- package/blueprints/hds-component-test/files/tests/dummy/app/styles/pages/__dummyCSSFileName__.scss +1 -0
- package/blueprints/hds-component-test/files/tests/dummy/app/templates/components/__name__.hbs +65 -0
- package/blueprints/hds-component-test/files/tests/integration/components/hds/__name__/index-test.js +17 -0
- package/blueprints/hds-component-test/index.js +126 -0
- package/package.json +27 -28
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @hashicorp/design-system-components
|
|
2
2
|
|
|
3
|
+
## 0.11.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#301](https://github.com/hashicorp/design-system/pull/301) [`4976379e`](https://github.com/hashicorp/design-system/commit/4976379e1b080c7753ceee2affe8cadc053296e5) Thanks [@alex-ju](https://github.com/alex-ju)! - Convey the disclosure state to assistive tech for dropdown and truncated breadcrumbs
|
|
8
|
+
|
|
9
|
+
## 0.11.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#284](https://github.com/hashicorp/design-system/pull/284) [`ba409885`](https://github.com/hashicorp/design-system/commit/ba409885468f91d659d10971fa1f34f64f57ddbc) Thanks [@alex-ju](https://github.com/alex-ju)! - Change focus management in disclosure utility component
|
|
14
|
+
|
|
15
|
+
* [#289](https://github.com/hashicorp/design-system/pull/289) [`bf3a00e5`](https://github.com/hashicorp/design-system/commit/bf3a00e56989bbef92bfa355a42e5775785847a3) Thanks [@didoo](https://github.com/didoo)! - "Alert" and "Toast" components - converted "title" and "description" arguments to be contextual components
|
|
16
|
+
|
|
17
|
+
## 0.11.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- [#245](https://github.com/hashicorp/design-system/pull/245) [`c6de1018`](https://github.com/hashicorp/design-system/commit/c6de101880ec1c21971e3775e1a21b6cb9e69757) Thanks [@didoo](https://github.com/didoo)! - - Added `Alert` component
|
|
22
|
+
- Added `Toast` component
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- [#259](https://github.com/hashicorp/design-system/pull/259) [`478b3069`](https://github.com/hashicorp/design-system/commit/478b3069e800cf2ccefba9b5475c72b024e25d16) Thanks [@didoo](https://github.com/didoo)! - - removed autofocus on first item for `Disclosure` component (and as a result also for `Breadcrumb` and `Dropdown` components)
|
|
27
|
+
- updated focus state treatment for `Dropdown` component
|
|
28
|
+
|
|
29
|
+
* [#225](https://github.com/hashicorp/design-system/pull/225) [`f1f07179`](https://github.com/hashicorp/design-system/commit/f1f0717952b3e6b41676135cf00e77a6e55579ec) Thanks [@Dhaulagiri](https://github.com/Dhaulagiri)! - update to ember-keyboard@8.1.0 in packages/components
|
|
30
|
+
|
|
31
|
+
- [#265](https://github.com/hashicorp/design-system/pull/265) [`79bc3e99`](https://github.com/hashicorp/design-system/commit/79bc3e99cd5cc6cb60fc82286d5726c0d0ffbd82) Thanks [@Dhaulagiri](https://github.com/Dhaulagiri)! - npx ember-cli-update@4.3.0 dependency updates
|
|
32
|
+
|
|
33
|
+
* [#253](https://github.com/hashicorp/design-system/pull/253) [`21786983`](https://github.com/hashicorp/design-system/commit/21786983d4ebbb3f38a72d4d105504169bfeda78) Thanks [@MelSumner](https://github.com/MelSumner)! - bugfix for icon size in copy-item component
|
|
34
|
+
|
|
3
35
|
## 0.10.0
|
|
4
36
|
|
|
5
37
|
### Minor Changes
|
|
@@ -5,13 +5,74 @@ This is the quest issue/engineering checklist for the COMPONENT_NAME Component.
|
|
|
5
5
|
## Pre-Flight Checklist
|
|
6
6
|
Update this list and these links as appropriate.
|
|
7
7
|
|
|
8
|
-
- [Component
|
|
9
|
-
- [
|
|
10
|
-
- [
|
|
8
|
+
- [Component Audit](https://www.figma.com/file/h3LtloARmbYVwh7z6XWHVb/Component-Audits-FY23?node-id=0%3A1): This audit should be completed by ambassadors before any work gets started.
|
|
9
|
+
- [Component Requirement Document (CRD)](https://docs.google.com/document/d/1kGcdfnb_z5tVUUvkSJGQPOssNd1yl2SVyd7bqk1KXII/): This file should exist before any design explorations or code is written.
|
|
10
|
+
- ["System of Systems" Storybook](https://unofficial-design-system-search.vercel.app) (storybook of storybooks): use for reference, to consider existing features that we might need to replicate in the component.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Design Checklist
|
|
14
|
+
The design checklist has 5 parts:
|
|
15
|
+
1. creating the branch
|
|
16
|
+
2. design explorations and iterations
|
|
17
|
+
3. documentation
|
|
18
|
+
4. release
|
|
19
|
+
5. testing
|
|
20
|
+
|
|
21
|
+
The design process is largely cyclical, so some of these steps may need to be repeated until approval.
|
|
22
|
+
|
|
23
|
+
### Component Creation
|
|
24
|
+
- [ ] [create a branch](https://help.figma.com/hc/en-us/articles/360063144053-Create-branches-and-merge-changes#Create_a_branch) in the [product components ui kit](https://www.figma.com/file/noyY6dUMDYjmySpHcMjhkN/HDS-Product---Components)
|
|
25
|
+
- [ ] add a new page for the component, as needed
|
|
26
|
+
- [ ] copy & paste the [stickersheet template](https://www.figma.com/file/noyY6dUMDYjmySpHcMjhkN/HDS-Product---Components?node-id=2279%3A26800) found in UI Helpers to the new page
|
|
27
|
+
- [ ] update the status badge to "In progress"
|
|
28
|
+
- [ ] change "{DOC TYPE}" to "STICKERSHEET"
|
|
29
|
+
- [ ] change "{Component name}" to the name of the component
|
|
30
|
+
- [ ] delete the sunset notice
|
|
31
|
+
- [ ] **design**
|
|
32
|
+
- [ ] work through design explorations, providing 2-3 visual directions based on existing [foundations](https://www.figma.com/file/oQsMzMMnynfPWpMEt91OpH/HDS-Product---Foundations?node-id=2916%3A4) and patterns, as well as the findings from the audit and requirements from the CRD
|
|
33
|
+
- [ ] review with appropriate stakeholders (typically HDS designers, engineering partner, ambassadors) and iterate
|
|
34
|
+
- [ ] review for a11y considerations and iterate, as necessary
|
|
35
|
+
- [ ] review with design leadership and iterate, as necessary
|
|
36
|
+
- [ ] once approved, build out the design as a component
|
|
37
|
+
- ensure the variant and property names align with what was discussed/decided on with your engineering partner
|
|
38
|
+
- [ ] test the component with HDS designers and iterate, as necessary
|
|
39
|
+
- [ ] sync with your engineering partner (pseudo handoff)
|
|
40
|
+
- let them know it's been design approved and discuss any remaining questions (this should be an ongoing process as well)
|
|
41
|
+
- [ ] **documentation**
|
|
42
|
+
- all documentation should be contained within frames so it can be easily linked to
|
|
43
|
+
- [ ] stickersheet
|
|
44
|
+
- make sure the component instances can be easily selected and other layers are locked
|
|
45
|
+
- [ ] design guidelines
|
|
46
|
+
- when complete, lock this frame
|
|
47
|
+
- [ ] figma tips, as necessary
|
|
48
|
+
- when complete, lock this frame
|
|
49
|
+
- [ ] migration details, as necessary
|
|
50
|
+
- when complete, lock this frame
|
|
51
|
+
- [ ] let your engineering partner know that design guidelines are ready to be added to the scrappy site (they will add it themselves)
|
|
52
|
+
- [ ] **release**
|
|
53
|
+
- [ ] lock and hide the components leaving only the stickersheets and docs visible, and change the header's badge to Experimental
|
|
54
|
+
- [ ] add release notes to the changelog
|
|
55
|
+
- [ ] review with situationally appropriate reviewers to get final approval
|
|
56
|
+
- [ ] merge the branch
|
|
57
|
+
- [ ] publish the ui kit
|
|
58
|
+
- Important: do not communicate this release to consumers yet! (this will be done later in the process)
|
|
59
|
+
- [ ] **testing**
|
|
60
|
+
- [ ] add a new page to the [playground](https://www.figma.com/file/95YqaJF4TNV72ucXbyC7A0/Playground?node-id=302%3A10) file and prepare a frame for each ambassador to test
|
|
61
|
+
- provide a variety (basic to complex) of screenshots to recreate based on real world examples from the audit
|
|
62
|
+
- [ ] test the component with ambassadors
|
|
63
|
+
- if iterations are needed, work through the process until approved (don't forget to branch!)
|
|
64
|
+
- [ ] **final release**
|
|
65
|
+
- this comes after ambassadors have tested the component in Figma and no other adjustments are needed
|
|
66
|
+
- [ ] if changes were required, follow the steps under "release" again
|
|
67
|
+
- [ ] share about the release in the slack channel [#team-design-systems](https://hashicorp.slack.com/archives/C7KTUHNUS) and let consumers know that the component is available for use in Figma
|
|
68
|
+
|
|
11
69
|
|
|
12
70
|
## Engineering Checklist
|
|
13
71
|
The engineering checklist has six parts: creating the feature branch, component template, component backing class, component style, tests, and documentation.
|
|
14
72
|
|
|
73
|
+
### Dependency
|
|
74
|
+
- Since we are trying to align the component API naming with the same terms used in the Figma file, it is likely useful to have a fairly stable Figma design before we create a component; it should definitely be finalized before the component ships, however.
|
|
75
|
+
|
|
15
76
|
### Component Creation
|
|
16
77
|
|
|
17
78
|
- [ ] create new branch from main for the component (`git checkout -b USER/COMPONENT-NAME`)
|
package/README.md
CHANGED
|
@@ -9,8 +9,8 @@ A package containing the components for the HashiCorp Design System.
|
|
|
9
9
|
Compatibility
|
|
10
10
|
------------------------------------------------------------------------------
|
|
11
11
|
|
|
12
|
-
* Ember.js v3.
|
|
13
|
-
* Ember CLI v3.
|
|
12
|
+
* Ember.js v3.24 or above
|
|
13
|
+
* Ember CLI v3.24 or above
|
|
14
14
|
* Node.js v12 or above
|
|
15
15
|
|
|
16
16
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div class="hds-alert__description" ...attributes>{{yield}}</div>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<div class={{this.classNames}} role="alert" aria-live="polite" ...attributes>
|
|
2
|
+
{{#if this.icon}}
|
|
3
|
+
<div class="hds-alert__icon">
|
|
4
|
+
<FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} @isInlineBlock={{false}} />
|
|
5
|
+
</div>
|
|
6
|
+
{{/if}}
|
|
7
|
+
|
|
8
|
+
<div class="hds-alert__content">
|
|
9
|
+
<div class="hds-alert__text">
|
|
10
|
+
{{yield (hash Title=(component "hds/alert/title"))}}
|
|
11
|
+
{{yield (hash Description=(component "hds/alert/description"))}}
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<div class="hds-alert__actions">
|
|
15
|
+
{{yield
|
|
16
|
+
(hash
|
|
17
|
+
Button=(component "hds/button" size="small")
|
|
18
|
+
Link::Standalone=(component "hds/link/standalone" size="small")
|
|
19
|
+
LinkTo::Standalone=(component "hds/link-to/standalone" size="small")
|
|
20
|
+
)
|
|
21
|
+
}}
|
|
22
|
+
</div>
|
|
23
|
+
{{yield (hash Generic=(component "hds/yield"))}}
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
{{#if this.onDismiss}}
|
|
27
|
+
<button class="hds-alert__dismiss" type="button" aria-label="Dismiss" {{on "click" this.onDismiss}}>
|
|
28
|
+
<FlightIcon @name="x" @size="16" @isInlineBlock={{false}} />
|
|
29
|
+
</button>
|
|
30
|
+
{{/if}}
|
|
31
|
+
</div>
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { assert } from '@ember/debug';
|
|
3
|
+
|
|
4
|
+
export const TYPES = ['page', 'inline', 'compact'];
|
|
5
|
+
export const DEFAULT_COLOR = 'neutral';
|
|
6
|
+
export const COLORS = [
|
|
7
|
+
'neutral',
|
|
8
|
+
'highlight',
|
|
9
|
+
'success',
|
|
10
|
+
'warning',
|
|
11
|
+
'critical',
|
|
12
|
+
];
|
|
13
|
+
export const MAPPING_COLORS_TO_ICONS = {
|
|
14
|
+
neutral: 'info',
|
|
15
|
+
highlight: 'info',
|
|
16
|
+
success: 'check-circle',
|
|
17
|
+
warning: 'alert-triangle',
|
|
18
|
+
critical: 'alert-diamond',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default class HdsAlertIndexComponent extends Component {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
|
|
25
|
+
assert(
|
|
26
|
+
`@type for "Hds::Alert" must be one of the following: ${TYPES.join(
|
|
27
|
+
', '
|
|
28
|
+
)}; received: ${this.args.type}`,
|
|
29
|
+
TYPES.includes(this.args.type)
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param color
|
|
35
|
+
* @type {enum}
|
|
36
|
+
* @default neutral
|
|
37
|
+
* @description Determines the color scheme for the alert.
|
|
38
|
+
*/
|
|
39
|
+
get color() {
|
|
40
|
+
let { color = DEFAULT_COLOR } = this.args;
|
|
41
|
+
|
|
42
|
+
assert(
|
|
43
|
+
`@color for "Hds::Alert" must be one of the following: ${COLORS.join(
|
|
44
|
+
', '
|
|
45
|
+
)}; received: ${color}`,
|
|
46
|
+
COLORS.includes(color)
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return color;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @param icon
|
|
54
|
+
* @type {string}
|
|
55
|
+
* @default null
|
|
56
|
+
* @description The name of the icon to be used.
|
|
57
|
+
*/
|
|
58
|
+
get icon() {
|
|
59
|
+
let { icon } = this.args;
|
|
60
|
+
|
|
61
|
+
// If `icon` isn't passed, use the pre-defined one from `color`
|
|
62
|
+
if (icon === undefined) {
|
|
63
|
+
if (this.args.type === 'compact') {
|
|
64
|
+
// for the "compact" type by default we use filled icons
|
|
65
|
+
return `${MAPPING_COLORS_TO_ICONS[this.color]}-fill`;
|
|
66
|
+
} else {
|
|
67
|
+
// for all the other types by default we use outlined icons
|
|
68
|
+
return MAPPING_COLORS_TO_ICONS[this.color];
|
|
69
|
+
}
|
|
70
|
+
// If `icon` is set explicitly to false, user doesn't want any icon in the alert
|
|
71
|
+
} else if (icon === false) {
|
|
72
|
+
assert(
|
|
73
|
+
`@icon for "Hds::Alert" with @type "compact" is required`,
|
|
74
|
+
this.args.type !== 'compact'
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
return false;
|
|
78
|
+
} else {
|
|
79
|
+
// If a name for `icon` is passed, set FlightIcon to that name
|
|
80
|
+
return icon;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @param onDismiss
|
|
86
|
+
* @type {function}
|
|
87
|
+
* @default () => {}
|
|
88
|
+
*/
|
|
89
|
+
get onDismiss() {
|
|
90
|
+
let { onDismiss } = this.args;
|
|
91
|
+
|
|
92
|
+
if (typeof onDismiss === 'function') {
|
|
93
|
+
return onDismiss;
|
|
94
|
+
} else {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @param iconSize
|
|
101
|
+
* @type {string}
|
|
102
|
+
* @description ensures that the correct icon size is used. Automatically calculated.
|
|
103
|
+
*/
|
|
104
|
+
get iconSize() {
|
|
105
|
+
if (this.args.type === 'compact') {
|
|
106
|
+
return '16';
|
|
107
|
+
} else {
|
|
108
|
+
return '24';
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Get the class names to apply to the component.
|
|
114
|
+
* @method Alert#classNames
|
|
115
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
116
|
+
*/
|
|
117
|
+
get classNames() {
|
|
118
|
+
let classes = ['hds-alert'];
|
|
119
|
+
|
|
120
|
+
// Add a class based on the @type argument
|
|
121
|
+
classes.push(`hds-alert--type-${this.args.type}`);
|
|
122
|
+
|
|
123
|
+
// Add a class based on the @color argument
|
|
124
|
+
classes.push(`hds-alert--color-${this.color}`);
|
|
125
|
+
|
|
126
|
+
return classes.join(' ');
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div class="hds-alert__title" ...attributes>{{yield}}</div>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
{{! template-lint-disable no-invalid-interactive }}
|
|
2
|
+
<div
|
|
3
|
+
class="hds-disclosure"
|
|
4
|
+
...attributes
|
|
5
|
+
{{did-insert this.didInsert}}
|
|
6
|
+
{{on "focusout" this.onFocusOut}}
|
|
7
|
+
{{on "keyup" this.onKeyUp}}
|
|
8
|
+
>
|
|
9
|
+
<div class="hds-disclosure__toggle" tabindex="-1">
|
|
10
|
+
{{yield (hash onClickToggle=this.onClickToggle isOpen=this.isOpen) to="toggle"}}
|
|
4
11
|
</div>
|
|
5
|
-
{{#if this.
|
|
6
|
-
<div
|
|
7
|
-
class="hds-disclosure__content"
|
|
8
|
-
{{focus-trap
|
|
9
|
-
isActive=this.isActive
|
|
10
|
-
shouldSelfFocus=false
|
|
11
|
-
focusTrapOptions=(hash clickOutsideDeactivates=this.clickOutsideDeactivates onDeactivate=this.onDeactivate)
|
|
12
|
-
}}
|
|
13
|
-
>
|
|
12
|
+
{{#if this.isOpen}}
|
|
13
|
+
<div class="hds-disclosure__content" tabindex="-1">
|
|
14
14
|
{{yield to="content"}}
|
|
15
15
|
</div>
|
|
16
16
|
{{/if}}
|
|
@@ -3,45 +3,52 @@ import { tracked } from '@glimmer/tracking';
|
|
|
3
3
|
import { action } from '@ember/object';
|
|
4
4
|
|
|
5
5
|
export default class HdsDisclosureComponent extends Component {
|
|
6
|
-
@tracked
|
|
6
|
+
@tracked isOpen; // notice: if in the future we need to add a "@isOpen" prop to control the status from outside (eg to have the Disclosure opened on render) just add "this.args.isOpen" here to initalize the variable
|
|
7
7
|
@tracked toggleRef;
|
|
8
8
|
@tracked isToggleClicked;
|
|
9
9
|
|
|
10
|
+
@action
|
|
11
|
+
didInsert(element) {
|
|
12
|
+
this.element = element;
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
@action
|
|
11
16
|
onClickToggle(event) {
|
|
12
17
|
// we store a reference to the DOM node that has the "onClickToggle" event associated with it
|
|
13
18
|
if (!this.toggleRef) {
|
|
14
19
|
this.toggleRef = event.currentTarget;
|
|
15
20
|
}
|
|
16
|
-
this.
|
|
21
|
+
this.isOpen = !this.isOpen;
|
|
22
|
+
// we explicitly apply a focus state to the toggle element to overcome a bug in WebKit (see b8abfcf)
|
|
23
|
+
this.toggleRef.focus();
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
@action
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// see: https://github.com/focus-trap/focus-trap#createoptions
|
|
28
|
-
return true;
|
|
27
|
+
onFocusOut(event) {
|
|
28
|
+
if (
|
|
29
|
+
!event.relatedTarget || // click or tap a non-related target (e.g. outside the element)
|
|
30
|
+
!this.element.contains(event.relatedTarget) // move focus to a target outside the element
|
|
31
|
+
) {
|
|
32
|
+
this.deactivate();
|
|
33
|
+
}
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
@action
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
onKeyUp(event) {
|
|
38
|
+
if (event.key === 'Escape') {
|
|
39
|
+
this.deactivate();
|
|
40
|
+
this.toggleRef.focus();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@action
|
|
45
|
+
deactivate() {
|
|
46
|
+
if (this.isOpen) {
|
|
47
|
+
this.isOpen = false;
|
|
48
|
+
}
|
|
49
|
+
// we call the "onClose" callback if it exists (and is a function)
|
|
50
|
+
if (this.args.onClose && typeof this.args.onClose === 'function') {
|
|
51
|
+
this.args.onClose();
|
|
45
52
|
}
|
|
46
53
|
}
|
|
47
54
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<:toggle as |t|>
|
|
3
3
|
{{yield
|
|
4
4
|
(hash
|
|
5
|
-
ToggleButton=(component "hds/dropdown/toggle/button" isOpen=t.
|
|
6
|
-
ToggleIcon=(component "hds/dropdown/toggle/icon" isOpen=t.
|
|
5
|
+
ToggleButton=(component "hds/dropdown/toggle/button" isOpen=t.isOpen onClick=t.onClickToggle)
|
|
6
|
+
ToggleIcon=(component "hds/dropdown/toggle/icon" isOpen=t.isOpen onClick=t.onClickToggle)
|
|
7
7
|
)
|
|
8
8
|
}}
|
|
9
9
|
</:toggle>
|
|
@@ -4,7 +4,7 @@ import { tracked } from '@glimmer/tracking';
|
|
|
4
4
|
import { action } from '@ember/object';
|
|
5
5
|
|
|
6
6
|
export default class HdsDropdownListItemCopyItemComponent extends Component {
|
|
7
|
-
@tracked isSuccess =
|
|
7
|
+
@tracked isSuccess = false;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @param text
|
|
@@ -37,12 +37,19 @@ export default class HdsDropdownListItemCopyItemComponent extends Component {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
@action
|
|
40
|
-
copyCode() {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
async copyCode() {
|
|
41
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Clipboard
|
|
42
|
+
await navigator.clipboard.writeText(this.args.text);
|
|
43
|
+
const result = await navigator.clipboard.readText();
|
|
44
|
+
|
|
45
|
+
if (result === this.args.text) {
|
|
45
46
|
this.isSuccess = true;
|
|
47
|
+
// console.log(`result is ${result}`);
|
|
48
|
+
|
|
49
|
+
// make it fade back to the default state
|
|
50
|
+
setTimeout(() => {
|
|
51
|
+
this.isSuccess = false;
|
|
52
|
+
}, 1000);
|
|
46
53
|
}
|
|
47
54
|
}
|
|
48
55
|
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
<button
|
|
1
|
+
<button
|
|
2
|
+
class={{this.classNames}}
|
|
3
|
+
aria-label={{this.text}}
|
|
4
|
+
...attributes
|
|
5
|
+
aria-expanded={{if @isOpen "true" "false"}}
|
|
6
|
+
{{on "click" this.onClick}}
|
|
7
|
+
type="button"
|
|
8
|
+
>
|
|
2
9
|
<div class="hds-dropdown-toggle-icon__wrapper">
|
|
3
10
|
{{#if @imageSrc}}
|
|
4
11
|
<img src={{@imageSrc}} alt="" role="presentation" height="32" width="32" />
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<Hds::Alert
|
|
2
|
+
class="hds-toast"
|
|
3
|
+
@type="inline"
|
|
4
|
+
@color={{@color}}
|
|
5
|
+
@icon={{@icon}}
|
|
6
|
+
@onDismiss={{@onDismiss}}
|
|
7
|
+
...attributes
|
|
8
|
+
as |A|
|
|
9
|
+
>
|
|
10
|
+
{{yield
|
|
11
|
+
(hash
|
|
12
|
+
Title=A.Title
|
|
13
|
+
Description=A.Description
|
|
14
|
+
Button=A.Button
|
|
15
|
+
Link::Standalone=A.Link::Standalone
|
|
16
|
+
LinkTo::Standalone=A.LinkTo::Standalone
|
|
17
|
+
Generic=A.Generic
|
|
18
|
+
)
|
|
19
|
+
}}
|
|
20
|
+
</Hds::Alert>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/alert/description';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/alert/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/alert/title';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/toast/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/yield/index';
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
@use "helpers/focus-ring";
|
|
6
6
|
@use "helpers/typography";
|
|
7
7
|
|
|
8
|
+
@use "../components/alert";
|
|
8
9
|
@use "../components/badge";
|
|
9
10
|
@use "../components/badge-count";
|
|
10
11
|
@use "../components/breadcrumb";
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
@use "../components/icon-tile";
|
|
16
17
|
@use "../components/link/cta";
|
|
17
18
|
@use "../components/link/standalone";
|
|
19
|
+
@use "../components/toast";
|
|
18
20
|
|
|
19
21
|
.sr-only {
|
|
20
22
|
border: 0 !important;
|