@hashicorp/design-system-components 0.10.0 → 0.11.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 +18 -0
- package/NEW-COMPONENT-CHECKLIST.md +64 -3
- package/README.md +2 -2
- package/addon/components/hds/alert/index.hbs +35 -0
- package/addon/components/hds/alert/index.js +128 -0
- package/addon/components/hds/disclosure/index.hbs +1 -1
- package/addon/components/hds/dropdown/list-item/copy-item.js +13 -6
- package/addon/components/hds/toast/index.hbs +15 -0
- package/addon/components/hds/yield/index.hbs +3 -0
- package/app/components/hds/alert/index.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 +261 -0
- package/app/styles/components/dropdown.scss +34 -40
- package/app/styles/components/toast.scss +16 -0
- package/package.json +26 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @hashicorp/design-system-components
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
- Added `Toast` component
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- [#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)
|
|
13
|
+
- updated focus state treatment for `Dropdown` component
|
|
14
|
+
|
|
15
|
+
* [#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
|
|
16
|
+
|
|
17
|
+
- [#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
|
|
18
|
+
|
|
19
|
+
* [#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
|
|
20
|
+
|
|
3
21
|
## 0.10.0
|
|
4
22
|
|
|
5
23
|
### 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,35 @@
|
|
|
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
|
+
{{#if @title}}
|
|
11
|
+
<div class="hds-alert__title">{{@title}}</div>
|
|
12
|
+
{{/if}}
|
|
13
|
+
{{#if @description}}
|
|
14
|
+
<div class="hds-alert__description">{{html-safe @description}}</div>
|
|
15
|
+
{{/if}}
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="hds-alert__actions">
|
|
19
|
+
{{yield
|
|
20
|
+
(hash
|
|
21
|
+
Button=(component "hds/button" size="small")
|
|
22
|
+
Link::Standalone=(component "hds/link/standalone" size="small")
|
|
23
|
+
LinkTo::Standalone=(component "hds/link-to/standalone" size="small")
|
|
24
|
+
)
|
|
25
|
+
}}
|
|
26
|
+
</div>
|
|
27
|
+
{{yield (hash Generic=(component "hds/yield"))}}
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
{{#if this.onDismiss}}
|
|
31
|
+
<button class="hds-alert__dismiss" type="button" aria-label="Dismiss" {{on "click" this.onDismiss}}>
|
|
32
|
+
<FlightIcon @name="x" @size="16" @isInlineBlock={{false}} />
|
|
33
|
+
</button>
|
|
34
|
+
{{/if}}
|
|
35
|
+
</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
|
+
}
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<Hds::Alert
|
|
2
|
+
class="hds-toast"
|
|
3
|
+
@type="inline"
|
|
4
|
+
@color={{@color}}
|
|
5
|
+
@icon={{@icon}}
|
|
6
|
+
@title={{@title}}
|
|
7
|
+
@description={{@description}}
|
|
8
|
+
@onDismiss={{@onDismiss}}
|
|
9
|
+
...attributes
|
|
10
|
+
as |A|
|
|
11
|
+
>
|
|
12
|
+
{{yield
|
|
13
|
+
(hash Button=A.Button Link::Standalone=A.Link::Standalone LinkTo::Standalone=A.LinkTo::Standalone Generic=A.Generic)
|
|
14
|
+
}}
|
|
15
|
+
</Hds::Alert>
|
|
@@ -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/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;
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ALERT
|
|
3
|
+
//
|
|
4
|
+
// properties within each class are sorted alphabetically
|
|
5
|
+
//
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
@use "../mixins/focus-ring" as *;
|
|
9
|
+
|
|
10
|
+
.hds-alert {
|
|
11
|
+
align-items: flex-start;
|
|
12
|
+
display: flex;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// ICON
|
|
16
|
+
|
|
17
|
+
.hds-alert__icon {
|
|
18
|
+
flex: none;
|
|
19
|
+
height: 20px;
|
|
20
|
+
margin-right: 12px;
|
|
21
|
+
width: 20px;
|
|
22
|
+
|
|
23
|
+
.hds-alert--type-compact & {
|
|
24
|
+
height: 14px;
|
|
25
|
+
width: 14px;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// CONTENT (TEXT + ACTIONS + GENERIC)
|
|
30
|
+
|
|
31
|
+
.hds-alert__content {
|
|
32
|
+
flex: 1 1 auto;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// TEXT (TITLE & DESCRIPTION)
|
|
36
|
+
|
|
37
|
+
.hds-alert__text {
|
|
38
|
+
color: var(--token-color-foreground-warning-on-surface);
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
font-family: var(--token-typography-body-200-font-family);
|
|
42
|
+
font-size: var(--token-typography-body-200-font-size);
|
|
43
|
+
justify-content: center;
|
|
44
|
+
line-height: var(--token-typography-body-200-line-height);
|
|
45
|
+
|
|
46
|
+
.hds-alert--type-compact & {
|
|
47
|
+
font-family: var(--token-typography-body-100-font-family);
|
|
48
|
+
font-size: var(--token-typography-body-100-font-size);
|
|
49
|
+
line-height: var(--token-typography-body-100-line-height);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.hds-alert__title {
|
|
54
|
+
font-weight: var(--token-typography-font-weight-semibold);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.hds-alert__description {
|
|
58
|
+
color: var(--token-color-foreground-primary);
|
|
59
|
+
font-weight: var(--token-typography-font-weight-regular);
|
|
60
|
+
|
|
61
|
+
.hds-alert__title + & {
|
|
62
|
+
margin-top: 4px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// we add very basic styling for elements that may be injected via the "description" string
|
|
66
|
+
|
|
67
|
+
strong {
|
|
68
|
+
font-weight: var(--token-typography-font-weight-semibold);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
code, pre {
|
|
72
|
+
font-family: var(--token-typography-font-stack-code);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Notice: in the future this may become a "Link::Inline" component (for now we declare the styles directly here)
|
|
76
|
+
a {
|
|
77
|
+
color: var(--token-color-foreground-action);
|
|
78
|
+
// At the moment the "focus" state is not well defined in design (the one that is in Figma does not work) so we just apply a simple color to the default outline
|
|
79
|
+
outline-color: var(--token-color-focus-action-external);
|
|
80
|
+
|
|
81
|
+
&:hover {
|
|
82
|
+
color: var(--token-color-foreground-action-hover);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:active {
|
|
86
|
+
color: var(--token-color-foreground-action-active);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// ACTIONS
|
|
92
|
+
|
|
93
|
+
.hds-alert__actions {
|
|
94
|
+
align-items: center;
|
|
95
|
+
display: flex;
|
|
96
|
+
|
|
97
|
+
> * {
|
|
98
|
+
margin-top: 16px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
> * + * {
|
|
102
|
+
margin-left: 8px;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// DISMISS
|
|
107
|
+
|
|
108
|
+
.hds-alert__dismiss {
|
|
109
|
+
background-color: transparent;
|
|
110
|
+
border: none;
|
|
111
|
+
color: var(--token-color-foreground-faint);
|
|
112
|
+
cursor: pointer;
|
|
113
|
+
flex: none;
|
|
114
|
+
margin-left: 16px;
|
|
115
|
+
margin-top: 2px; // for alignment with the main icon and text
|
|
116
|
+
padding: 0;
|
|
117
|
+
|
|
118
|
+
.hds-alert--type-compact & {
|
|
119
|
+
margin-top: 1px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&:hover,
|
|
123
|
+
&.is-hover {
|
|
124
|
+
&::before { // we re-use the pseudo-element created by the "focus-ring" mixin
|
|
125
|
+
background-color: rgba(#dedfe3, 0.4);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// notice: this is used not only for the focus, but also to increase the clickable area
|
|
130
|
+
@include hds-focus-ring-with-pseudo-element($top: -4px, $right: -4px, $bottom: -4px, $left: -4px);
|
|
131
|
+
|
|
132
|
+
&:active,
|
|
133
|
+
&.is-active {
|
|
134
|
+
color: var(--token-color-foreground-secondary);
|
|
135
|
+
&::before {
|
|
136
|
+
background-color: rgba(#dedfe3, 0.4);
|
|
137
|
+
border: 1px solid var(--token-color-border-strong);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
// TYPES
|
|
144
|
+
|
|
145
|
+
.hds-alert--type-page {
|
|
146
|
+
padding: 16px 48px; // by design
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.hds-alert--type-inline {
|
|
150
|
+
border-radius: 6px;
|
|
151
|
+
border-style: solid;
|
|
152
|
+
border-width: 1px;
|
|
153
|
+
padding: 16px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.hds-alert--type-compact {
|
|
157
|
+
.hds-alert__icon {
|
|
158
|
+
margin-right: 8px;
|
|
159
|
+
margin-top: 2px; // notice: the icon size for the "compact" type is 14px, not 20px, so this 2px extra are needed to reach the exact same height as the "description" text line-height
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// extra safety
|
|
163
|
+
.hds-alert__title {
|
|
164
|
+
display: none;
|
|
165
|
+
& + .hds-alert__description {
|
|
166
|
+
margin-top: 0;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// COLORS (& TYPES)
|
|
172
|
+
|
|
173
|
+
.hds-alert--color-neutral {
|
|
174
|
+
|
|
175
|
+
&.hds-alert--type-page {
|
|
176
|
+
background-color: var(--token-color-surface-faint);
|
|
177
|
+
box-shadow: 0px 1px 0px 0px var(--token-color-palette-alpha-300);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&.hds-alert--type-inline {
|
|
181
|
+
background-color: var(--token-color-surface-faint);
|
|
182
|
+
border-color: var(--token-color-border-strong); // notice: in the "neutral" color the "inline" has a slightly darker border color compared to the others to increase contrast (eg. could be used on a light gray background)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// different color by design
|
|
186
|
+
.hds-alert__icon {
|
|
187
|
+
color: var(--token-color-foreground-faint);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.hds-alert__title {
|
|
191
|
+
color: var(--token-color-foreground-primary);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.hds-alert--color-highlight {
|
|
196
|
+
|
|
197
|
+
&.hds-alert--type-page {
|
|
198
|
+
background-color: var(--token-color-surface-highlight);
|
|
199
|
+
box-shadow: 0px 1px 0px 0px var(--token-color-border-highlight);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
&.hds-alert--type-inline {
|
|
203
|
+
background-color: var(--token-color-surface-highlight);
|
|
204
|
+
border-color: var(--token-color-border-highlight);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.hds-alert__icon, .hds-alert__title {
|
|
208
|
+
color: var(--token-color-foreground-highlight-on-surface);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.hds-alert--color-success {
|
|
213
|
+
|
|
214
|
+
&.hds-alert--type-page {
|
|
215
|
+
background-color: var(--token-color-surface-success);
|
|
216
|
+
box-shadow: 0px 1px 0px 0px var(--token-color-border-success);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
&.hds-alert--type-inline {
|
|
220
|
+
background-color: var(--token-color-surface-success);
|
|
221
|
+
border-color: var(--token-color-border-success);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.hds-alert__icon, .hds-alert__title {
|
|
225
|
+
color: var(--token-color-foreground-success-on-surface);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.hds-alert--color-warning {
|
|
230
|
+
|
|
231
|
+
&.hds-alert--type-page {
|
|
232
|
+
background-color: var(--token-color-surface-warning);
|
|
233
|
+
box-shadow: 0px 1px 0px 0px var(--token-color-border-warning);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
&.hds-alert--type-inline {
|
|
237
|
+
background-color: var(--token-color-surface-warning);
|
|
238
|
+
border-color: var(--token-color-border-warning);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.hds-alert__icon, .hds-alert__title {
|
|
242
|
+
color: var(--token-color-foreground-warning-on-surface);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.hds-alert--color-critical {
|
|
247
|
+
|
|
248
|
+
&.hds-alert--type-page {
|
|
249
|
+
background-color: var(--token-color-surface-critical);
|
|
250
|
+
box-shadow: 0px 1px 0px 0px var(--token-color-border-critical);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
&.hds-alert--type-inline {
|
|
254
|
+
background-color: var(--token-color-surface-critical);
|
|
255
|
+
border-color: var(--token-color-border-critical);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.hds-alert__icon, .hds-alert__title {
|
|
259
|
+
color: var(--token-color-foreground-critical-on-surface);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
@@ -205,6 +205,7 @@ $hds-dropdown-toggle-border-radius: 5px;
|
|
|
205
205
|
|
|
206
206
|
.hds-dropdown-list-item__copy-item-icon {
|
|
207
207
|
color: var(--token-color-foreground-action);
|
|
208
|
+
flex: none;
|
|
208
209
|
margin-left: 8px;
|
|
209
210
|
}
|
|
210
211
|
|
|
@@ -273,9 +274,18 @@ $hds-dropdown-toggle-border-radius: 5px;
|
|
|
273
274
|
// Notice: to avoid too much duplication we define two local CSS variables
|
|
274
275
|
// and define their values in the color variants below
|
|
275
276
|
|
|
277
|
+
&:hover,
|
|
278
|
+
&.is-hover {
|
|
279
|
+
color: var(--current-color-hover);
|
|
280
|
+
&::before {
|
|
281
|
+
background-color: currentColor;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
276
285
|
// default focus for browsers that still rely on ":focus"
|
|
277
286
|
&:focus,
|
|
278
287
|
&.is-focus {
|
|
288
|
+
color: var(--current-color-focus);
|
|
279
289
|
&::after {
|
|
280
290
|
background-color: var(--current-background-color);
|
|
281
291
|
box-shadow: var(--current-focus-ring-box-shadow);
|
|
@@ -285,22 +295,39 @@ $hds-dropdown-toggle-border-radius: 5px;
|
|
|
285
295
|
// undo the previous declaration for browsers that support ":focus-visible" but wouldn't normally show default focus styles
|
|
286
296
|
&:focus:not(:focus-visible) {
|
|
287
297
|
&::after {
|
|
298
|
+
background-color: transparent;
|
|
288
299
|
box-shadow: none;
|
|
289
300
|
}
|
|
290
301
|
}
|
|
291
302
|
// set focus for browsers that support ":focus-visible"
|
|
292
303
|
&:focus-visible {
|
|
304
|
+
color: var(--current-color-focus);
|
|
293
305
|
&::after {
|
|
294
306
|
background-color: var(--current-background-color);
|
|
295
307
|
box-shadow: var(--current-focus-ring-box-shadow);
|
|
296
308
|
left: 4px;
|
|
297
309
|
}
|
|
298
310
|
}
|
|
311
|
+
|
|
299
312
|
// remove the focus ring on "active + focused" state (by design)
|
|
300
313
|
&:focus:active,
|
|
314
|
+
&:focus-visible:active,
|
|
301
315
|
&.is-focus.is-active {
|
|
302
316
|
&::after {
|
|
317
|
+
background-color: var(--current-background-color);
|
|
303
318
|
box-shadow: none;
|
|
319
|
+
left: 10px;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
&:active,
|
|
324
|
+
&.is-active {
|
|
325
|
+
color: var(--current-color-active);
|
|
326
|
+
&::before {
|
|
327
|
+
background-color: currentColor;
|
|
328
|
+
}
|
|
329
|
+
&::after {
|
|
330
|
+
background-color: var(--current-background-color);
|
|
304
331
|
}
|
|
305
332
|
}
|
|
306
333
|
}
|
|
@@ -319,30 +346,12 @@ $hds-dropdown-toggle-border-radius: 5px;
|
|
|
319
346
|
color: var(--token-color-foreground-primary);
|
|
320
347
|
|
|
321
348
|
// assign the values to the local CSS variables used above
|
|
349
|
+
--current-color-hover: var(--token-color-foreground-action-hover);
|
|
350
|
+
--current-color-focus: var(--token-color-foreground-action-active);
|
|
351
|
+
--current-color-active: var(--token-color-foreground-action-active);
|
|
322
352
|
&::after {
|
|
323
353
|
--current-background-color: var(--token-color-surface-action);
|
|
324
|
-
--current-focus-ring-box-shadow: var(
|
|
325
|
-
--token-focus-ring-action-box-shadow
|
|
326
|
-
);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
&:hover,
|
|
330
|
-
&.is-hover {
|
|
331
|
-
color: var(--token-color-foreground-action-hover);
|
|
332
|
-
&::before {
|
|
333
|
-
background-color: currentColor;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
&:active,
|
|
338
|
-
&.is-active {
|
|
339
|
-
color: var(--token-color-foreground-action-active);
|
|
340
|
-
&::before {
|
|
341
|
-
background-color: currentColor;
|
|
342
|
-
}
|
|
343
|
-
&::after {
|
|
344
|
-
background-color: var(--token-color-surface-action);
|
|
345
|
-
}
|
|
354
|
+
--current-focus-ring-box-shadow: var(--token-focus-ring-action-box-shadow);
|
|
346
355
|
}
|
|
347
356
|
}
|
|
348
357
|
}
|
|
@@ -352,28 +361,13 @@ $hds-dropdown-toggle-border-radius: 5px;
|
|
|
352
361
|
color: var(--token-color-foreground-critical);
|
|
353
362
|
|
|
354
363
|
// assign the values to the local CSS variables used above
|
|
364
|
+
--current-color-hover: var(--token-color-palette-red-300);
|
|
365
|
+
--current-color-focus: var(--token-color-palette-red-400);
|
|
366
|
+
--current-color-active: var(--token-color-palette-red-400);
|
|
355
367
|
&::after {
|
|
356
368
|
--current-background-color: var(--token-color-surface-critical);
|
|
357
369
|
--current-focus-ring-box-shadow: var(--token-focus-ring-critical-box-shadow);
|
|
358
370
|
}
|
|
359
|
-
|
|
360
|
-
&:hover,
|
|
361
|
-
&.is-hover {
|
|
362
|
-
color: var(--token-color-palette-red-300);
|
|
363
|
-
&::before {
|
|
364
|
-
background-color: currentColor;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
&:active,
|
|
368
|
-
&.is-active {
|
|
369
|
-
color: var(--token-color-palette-red-400);
|
|
370
|
-
&::before {
|
|
371
|
-
background-color: currentColor;
|
|
372
|
-
}
|
|
373
|
-
&::after {
|
|
374
|
-
background-color: var(--token-color-surface-critical);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
371
|
}
|
|
378
372
|
}
|
|
379
373
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// TOAST
|
|
3
|
+
//
|
|
4
|
+
// properties within each class are sorted alphabetically
|
|
5
|
+
//
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
.hds-toast {
|
|
9
|
+
// we apply an elevation to the "alert/inline" element
|
|
10
|
+
box-shadow: var(--token-elevation-higher-box-shadow);
|
|
11
|
+
|
|
12
|
+
// per design specs
|
|
13
|
+
min-width: min(360px, 80vw);
|
|
14
|
+
max-width: min(500px, 80vw);
|
|
15
|
+
width: fit-content;
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashicorp/design-system-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "HashiCorp Design System Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hashicorp",
|
|
@@ -36,19 +36,19 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@hashicorp/design-system-tokens": "^0.8.0",
|
|
38
38
|
"@hashicorp/ember-flight-icons": "^2.0.5",
|
|
39
|
-
"ember-auto-import": "^2.
|
|
40
|
-
"ember-cli-babel": "^7.26.
|
|
41
|
-
"ember-cli-htmlbars": "^
|
|
39
|
+
"ember-auto-import": "^2.4.1",
|
|
40
|
+
"ember-cli-babel": "^7.26.11",
|
|
41
|
+
"ember-cli-htmlbars": "^6.0.1",
|
|
42
42
|
"ember-cli-sass": "^10.0.1",
|
|
43
43
|
"ember-focus-trap": "^1.0.1",
|
|
44
|
-
"ember-keyboard": "^8.
|
|
44
|
+
"ember-keyboard": "^8.1.0",
|
|
45
45
|
"ember-named-blocks-polyfill": "^0.2.5",
|
|
46
46
|
"sass": "^1.43.4"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@ember/optional-features": "^2.0.0",
|
|
50
|
-
"@ember/test-helpers": "^2.
|
|
51
|
-
"@embroider/test-setup": "^
|
|
50
|
+
"@ember/test-helpers": "^2.6.0",
|
|
51
|
+
"@embroider/test-setup": "^1.5.0",
|
|
52
52
|
"@glimmer/component": "^1.0.4",
|
|
53
53
|
"@glimmer/tracking": "^1.0.4",
|
|
54
54
|
"@percy/cli": "^1.0.1",
|
|
@@ -56,9 +56,10 @@
|
|
|
56
56
|
"babel-eslint": "^10.1.0",
|
|
57
57
|
"broccoli-asset-rev": "^3.0.0",
|
|
58
58
|
"ember-a11y-refocus": "^2.1.0",
|
|
59
|
-
"ember-cli": "~3.
|
|
60
|
-
"ember-cli-clipboard": "^0.
|
|
61
|
-
"ember-cli-dependency-checker": "^3.
|
|
59
|
+
"ember-cli": "~4.3.0",
|
|
60
|
+
"ember-cli-clipboard": "^0.16.0",
|
|
61
|
+
"ember-cli-dependency-checker": "^3.3.0",
|
|
62
|
+
"ember-cli-deprecation-workflow": "^2.1.0",
|
|
62
63
|
"ember-cli-inject-live-reload": "^2.1.0",
|
|
63
64
|
"ember-cli-markdown-it-templates": "^0.0.3",
|
|
64
65
|
"ember-cli-sri": "^2.1.1",
|
|
@@ -68,31 +69,30 @@
|
|
|
68
69
|
"ember-disable-prototype-extensions": "^1.1.3",
|
|
69
70
|
"ember-export-application-global": "^2.0.1",
|
|
70
71
|
"ember-load-initializers": "^2.1.2",
|
|
71
|
-
"ember-
|
|
72
|
-
"ember-page-title": "^6.2.2",
|
|
72
|
+
"ember-page-title": "^7.0.0",
|
|
73
73
|
"ember-prism": "^0.12.0",
|
|
74
|
-
"ember-qunit": "^5.1.
|
|
75
|
-
"ember-resolver": "^8.0.
|
|
76
|
-
"ember-source": "~3.
|
|
74
|
+
"ember-qunit": "^5.1.5",
|
|
75
|
+
"ember-resolver": "^8.0.3",
|
|
76
|
+
"ember-source": "~4.3.0",
|
|
77
77
|
"ember-source-channel-url": "^3.0.0",
|
|
78
78
|
"ember-style-modifier": "^0.8.0",
|
|
79
|
-
"ember-template-lint": "^3.
|
|
80
|
-
"ember-template-lint-plugin-prettier": "^
|
|
79
|
+
"ember-template-lint": "^4.3.0",
|
|
80
|
+
"ember-template-lint-plugin-prettier": "^4.0.0",
|
|
81
81
|
"ember-truth-helpers": "^3.0.0",
|
|
82
|
-
"ember-try": "^
|
|
82
|
+
"ember-try": "^2.0.0",
|
|
83
83
|
"eslint": "^7.32.0",
|
|
84
|
-
"eslint-config-prettier": "^8.
|
|
85
|
-
"eslint-plugin-ember": "^10.5.
|
|
84
|
+
"eslint-config-prettier": "^8.5.0",
|
|
85
|
+
"eslint-plugin-ember": "^10.5.9",
|
|
86
86
|
"eslint-plugin-node": "^11.1.0",
|
|
87
|
-
"eslint-plugin-prettier": "^
|
|
88
|
-
"eslint-plugin-qunit": "^
|
|
87
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
88
|
+
"eslint-plugin-qunit": "^7.2.0",
|
|
89
89
|
"loader.js": "^4.7.0",
|
|
90
90
|
"npm-run-all": "^4.1.5",
|
|
91
|
-
"prettier": "^2.
|
|
92
|
-
"qunit": "^2.
|
|
93
|
-
"qunit-dom": "^
|
|
91
|
+
"prettier": "^2.6.1",
|
|
92
|
+
"qunit": "^2.18.0",
|
|
93
|
+
"qunit-dom": "^2.0.0",
|
|
94
94
|
"version-bump-prompt": "^6.1.0",
|
|
95
|
-
"webpack": "^5.
|
|
95
|
+
"webpack": "^5.70.0"
|
|
96
96
|
},
|
|
97
97
|
"engines": {
|
|
98
98
|
"node": "12.* || 14.* || >= 16"
|