@hashicorp/design-system-components 0.0.20 → 0.1.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 +8 -0
- package/README.md +21 -1
- package/RELEASE.md +3 -32
- package/addon/components/hds/button/index.js +2 -2
- package/addon/components/hds/disclosure/index.hbs +17 -0
- package/addon/components/hds/disclosure/index.js +41 -0
- package/addon/components/hds/link-to/standalone.hbs +1 -1
- package/addon/components/hds/link-to/standalone.js +0 -10
- package/addon/helpers/hds-link-to-query.js +21 -0
- package/app/components/hds/disclosure/index.js +1 -0
- package/app/helpers/hds-link-to-query.js +1 -0
- package/app/styles/@hashicorp/design-system-components.scss +1 -2
- package/app/styles/components/badge-count.scss +11 -11
- package/app/styles/components/badge.scss +16 -16
- package/app/styles/components/button.scss +43 -44
- package/app/styles/components/card/container.scss +2 -2
- package/app/styles/components/disclosure.scss +10 -0
- package/app/styles/components/icon-tile.scss +10 -11
- package/app/styles/components/link/standalone.scss +32 -76
- package/app/styles/mixins/_focus-ring.scss +73 -0
- package/package.json +11 -42
- package/.github/ISSUE_TEMPLATE/new-component-quest-issue-engineering-checklist.md +0 -78
- package/.github/pull_request_template.md. +0 -26
- package/.github/workflows/ci.yml +0 -196
- package/.husky/pre-commit +0 -14
- package/app/styles/mixins/_generic-focus-state.scss +0 -7
package/CHANGELOG.md
ADDED
package/README.md
CHANGED
|
@@ -21,7 +21,27 @@ Installation
|
|
|
21
21
|
yarn add @hashicorp/design-system-components
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
You will need to do three things before importing the styles into your app:
|
|
25
|
+
|
|
26
|
+
1. Install `ember-cli-sass`
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
ember install ember-cli-sass
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
2. Change `app/styles/app.css` to `app/styles/app.scss`
|
|
33
|
+
3. Add the following to the `app` definition (starts on/around line 6 in new Ember apps) in `ember-cli-build.js`
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
sassOptions: {
|
|
37
|
+
precision: 4,
|
|
38
|
+
includePaths: [
|
|
39
|
+
'./node_modules/@hashicorp/design-system-tokens/dist/products/css',
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Finally, add this line to the top of your app's style file (`app.scss` or similar):
|
|
25
45
|
|
|
26
46
|
```
|
|
27
47
|
@import '@hashicorp/design-system-components';
|
package/RELEASE.md
CHANGED
|
@@ -1,41 +1,12 @@
|
|
|
1
|
-
# How
|
|
1
|
+
# How to release
|
|
2
2
|
|
|
3
3
|
Whenever there is an update to the components, and these changes have been approved, we need to release them as package to the npm registry.
|
|
4
4
|
|
|
5
5
|
Please see the instructions in the [CONTRIBUTING](CONTRIBUTING.md) file for more details about how to setup the project and make changes to the code for these packages.
|
|
6
6
|
|
|
7
|
-
## Bump
|
|
7
|
+
## Bump and release
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* Make sure your local `main` branch is up to date.
|
|
12
|
-
* Create new custom branch from `main`.
|
|
13
|
-
* `cd /design-system-components`
|
|
14
|
-
* Run `yarn bump` and choose the _SemVer_ version as agreed upon on the previous PR.
|
|
15
|
-
* _The `bump` command is interactive, you can move up and down with the keyboard, choose one option, and then hit "enter": the tool will automatically update the version in the `package.json` file for you._
|
|
16
|
-
* Check the `git diff` for the project, you should see only the `package.json` file changed (with the new version).
|
|
17
|
-
* Commit, push, open a pull request, and wait for approval.
|
|
18
|
-
|
|
19
|
-
Once the PR has been approved and merged, you can finally move to the next step, the actual release.
|
|
20
|
-
|
|
21
|
-
## Release
|
|
22
|
-
|
|
23
|
-
The "release" step publishes the package on the npm registry, using the version declared in the `package.json` file, and [tags](https://www.atlassian.com/git/tutorials/inspecting-a-repository/git-tag) that specific release on git.
|
|
24
|
-
|
|
25
|
-
_**IMPORTANT**: Once released a package on the public registry, you can't revert the changes: the only solution is to deprecate the package (this will hide it from the public, but remains there). If you need to do some tests, use a **local** package registry (see below), don't test directly in production!_
|
|
26
|
-
|
|
27
|
-
* Make sure your local `main` branch is up to date.
|
|
28
|
-
* You will need a company-approved 2FA-enabled account on npm to publish (see [npm 2FA docs](https://docs.npmjs.com/configuring-two-factor-authentication) for more info).
|
|
29
|
-
* `cd /design-system-components`
|
|
30
|
-
* `yarn release`
|
|
31
|
-
* Check the git diff, you should not see any change.
|
|
32
|
-
|
|
33
|
-
**Notice**: this action will automatically:
|
|
34
|
-
|
|
35
|
-
* publish the new version of the package on the [NPM registry](https://www.npmjs.com/) using the current _SemVer_ version declared in the `package.json` file (the one previously chosen in the `bump` step).
|
|
36
|
-
* tag the current last commit in the `main` branch and push the tag to the git origin
|
|
37
|
-
|
|
38
|
-
At this point check on npm that the package ([@hashicorp/design-system-components](https://www.npmjs.com/package/@hashicorp/design-system-components) has been successfully published, and if it's so... well done! You just published your new package 🎉.
|
|
9
|
+
Follow the instructions for Changesets in the root [README](../../README.md).
|
|
39
10
|
|
|
40
11
|
🚨 **DON'T FORGET**:
|
|
41
12
|
|
|
@@ -6,7 +6,7 @@ export const DEFAULT_COLOR = 'primary';
|
|
|
6
6
|
export const DEFAULT_TYPE = 'button';
|
|
7
7
|
export const DEFAULT_ICONPOSITION = 'leading';
|
|
8
8
|
export const SIZES = ['small', 'medium', 'large'];
|
|
9
|
-
export const COLORS = ['primary', 'secondary', '
|
|
9
|
+
export const COLORS = ['primary', 'secondary', 'critical'];
|
|
10
10
|
export const TYPES = ['button', 'submit', 'reset'];
|
|
11
11
|
export const ICONPOSITIONS = ['leading', 'trailing'];
|
|
12
12
|
|
|
@@ -50,7 +50,7 @@ export default class HdsButtonIndexComponent extends Component {
|
|
|
50
50
|
* @param color
|
|
51
51
|
* @type {string}
|
|
52
52
|
* @default primary
|
|
53
|
-
* @description Determines the color of button to be used; acceptable values are `primary`, `secondary`, and `
|
|
53
|
+
* @description Determines the color of button to be used; acceptable values are `primary`, `secondary`, and `critical`
|
|
54
54
|
*/
|
|
55
55
|
get color() {
|
|
56
56
|
let { color = DEFAULT_COLOR } = this.args;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<div class="hds-disclosure" ...attributes>
|
|
2
|
+
<div class="hds-disclosure__toggle">
|
|
3
|
+
{{yield (hash onClickToggle=this.onClickToggle) to="toggle"}}
|
|
4
|
+
</div>
|
|
5
|
+
{{#if this.isActive}}
|
|
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
|
+
>
|
|
14
|
+
{{yield to="content"}}
|
|
15
|
+
</div>
|
|
16
|
+
{{/if}}
|
|
17
|
+
</div>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
import { action } from '@ember/object';
|
|
4
|
+
|
|
5
|
+
export default class HdsDisclosureComponent extends Component {
|
|
6
|
+
@tracked isActive; // notice: if in the future we need to add a "@isActive" prop to control the status from outside (eg to have the Disclosure opened on render) just add "this.args.isActive" here to initalize the variable
|
|
7
|
+
@tracked toggleRef;
|
|
8
|
+
@tracked isToggleClicked;
|
|
9
|
+
|
|
10
|
+
@action
|
|
11
|
+
onClickToggle(event) {
|
|
12
|
+
// we store a reference to the DOM node that has the "onClickToggle" event associated with it
|
|
13
|
+
if (!this.toggleRef) {
|
|
14
|
+
this.toggleRef = event.currentTarget;
|
|
15
|
+
}
|
|
16
|
+
this.isActive = !this.isActive;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@action
|
|
20
|
+
clickOutsideDeactivates(event) {
|
|
21
|
+
// we check if the toggle reference belongs to the tree of parent DOM nodes
|
|
22
|
+
// of the element that was clicked and triggered the "click outside" event handling
|
|
23
|
+
this.isToggleClicked = event.path.includes(this.toggleRef);
|
|
24
|
+
// here we need to return `true` to make sure that the focus trap will be deactivated (and allow the click event to do its thing (i.e. to pass-through to the element that was clicked).
|
|
25
|
+
// see: https://github.com/focus-trap/focus-trap#createoptions
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@action
|
|
30
|
+
onDeactivate() {
|
|
31
|
+
// on deactivate we hide the content, except for the case when the button has been clicked
|
|
32
|
+
// the reason is that the "onClickToggle" is called in any case (there's no way to block the event)
|
|
33
|
+
// so when the user clicks the toggle to close the panel, we let the "onClickToggle" handle the closure
|
|
34
|
+
// otherwise we would have two changes of status, this and the toggle, and the panel would remain open
|
|
35
|
+
if (!this.isToggleClicked) {
|
|
36
|
+
this.isActive = false;
|
|
37
|
+
// we need to reset this check
|
|
38
|
+
this.isToggleClicked = false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -128,16 +128,6 @@ export default class HdsLinkToStandaloneComponent extends Component {
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
// this is a workaround for https://github.com/emberjs/ember.js/issues/19693
|
|
132
|
-
// don't remove until we drop support for ember 3.27 and 3.28
|
|
133
|
-
get queryParams() {
|
|
134
|
-
if (this.args.query) {
|
|
135
|
-
return this.args.query;
|
|
136
|
-
} else {
|
|
137
|
-
return {};
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
131
|
/**
|
|
142
132
|
* Get the class names to apply to the component.
|
|
143
133
|
* @method LinkToStandalone#classNames
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { helper } from '@ember/component/helper';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* This helper can be used to safely pass a @query argument to the `<LinkTo>` component
|
|
5
|
+
* without the risk of triggering an assertion if the argument is undefined
|
|
6
|
+
*
|
|
7
|
+
* The result of this helper should be passed into the `@query` argument of the `<LinkTo>` component:
|
|
8
|
+
*
|
|
9
|
+
* ```hbs
|
|
10
|
+
* <LinkTo @query={{hds-link-to-query @query}} />
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// this is a workaround for https://github.com/emberjs/ember.js/issues/19693
|
|
15
|
+
// don't remove until we drop support for ember 3.27 and 3.28
|
|
16
|
+
|
|
17
|
+
export function hdsLinkToQuery([query]) {
|
|
18
|
+
return query ?? {};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default helper(hdsLinkToQuery);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/disclosure/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/helpers/hds-link-to-query';
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
@use "helpers/elevation";
|
|
4
4
|
@use "helpers/focus-ring";
|
|
5
5
|
|
|
6
|
-
@use "../mixins/generic-focus-state";
|
|
7
|
-
|
|
8
6
|
@use "../components/badge";
|
|
9
7
|
@use "../components/badge-count";
|
|
10
8
|
@use "../components/button";
|
|
11
9
|
@use "../components/card";
|
|
10
|
+
@use "../components/disclosure";
|
|
12
11
|
@use "../components/icon-tile";
|
|
13
12
|
@use "../components/link/standalone";
|
|
14
13
|
|
|
@@ -63,36 +63,36 @@ $size-props: (
|
|
|
63
63
|
|
|
64
64
|
.hds-badge-count--color-neutral {
|
|
65
65
|
&.hds-badge-count--type-filled {
|
|
66
|
-
background-color: var(--token-color-
|
|
67
|
-
color: var(--token-color-
|
|
66
|
+
background-color: var(--token-color-surface-strong);
|
|
67
|
+
color: var(--token-color-foreground-primary);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
&.hds-badge-count--type-inverted {
|
|
71
|
-
background-color: var(--token-color-
|
|
72
|
-
color: var(--token-color-
|
|
71
|
+
background-color: var(--token-color-foreground-faint);
|
|
72
|
+
color: var(--token-color-foreground-high-contrast);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
&.hds-badge-count--type-outlined {
|
|
76
76
|
background-color: transparent;
|
|
77
|
-
border-color: var(--token-color-
|
|
78
|
-
color: var(--token-color-
|
|
77
|
+
border-color: var(--token-color-foreground-faint);
|
|
78
|
+
color: var(--token-color-foreground-primary);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
.hds-badge-count--color-neutral-dark-mode {
|
|
83
83
|
&.hds-badge-count--type-filled {
|
|
84
|
-
background-color: var(--token-color-
|
|
85
|
-
color: var(--token-color-
|
|
84
|
+
background-color: var(--token-color-foreground-faint);
|
|
85
|
+
color: var(--token-color-foreground-high-contrast);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
&.hds-badge-count--type-inverted {
|
|
89
|
-
background-color: var(--token-color-
|
|
90
|
-
color: var(--token-color-
|
|
89
|
+
background-color: var(--token-color-surface-faint);
|
|
90
|
+
color: var(--token-color-foreground-primary);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
&.hds-badge-count--type-outlined {
|
|
94
94
|
background-color: transparent;
|
|
95
95
|
border-color: var(--token-color-palette-neutral-100);
|
|
96
|
-
color: var(--token-color-
|
|
96
|
+
color: var(--token-color-foreground-high-contrast);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
@@ -91,56 +91,56 @@ $size-props: (
|
|
|
91
91
|
|
|
92
92
|
.hds-badge--color-neutral {
|
|
93
93
|
&.hds-badge--type-filled {
|
|
94
|
-
background-color: var(--token-color-
|
|
95
|
-
color: var(--token-color-
|
|
94
|
+
background-color: var(--token-color-surface-strong);
|
|
95
|
+
color: var(--token-color-foreground-primary);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
&.hds-badge--type-inverted {
|
|
99
|
-
background-color: var(--token-color-
|
|
100
|
-
color: var(--token-color-
|
|
99
|
+
background-color: var(--token-color-foreground-faint);
|
|
100
|
+
color: var(--token-color-foreground-high-contrast);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
&.hds-badge--type-outlined {
|
|
104
104
|
background-color: transparent;
|
|
105
|
-
border-color: var(--token-color-
|
|
106
|
-
color: var(--token-color-
|
|
105
|
+
border-color: var(--token-color-foreground-faint);
|
|
106
|
+
color: var(--token-color-foreground-primary);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
.hds-badge--color-neutral-dark-mode {
|
|
111
111
|
&.hds-badge--type-filled {
|
|
112
|
-
background-color: var(--token-color-
|
|
113
|
-
color: var(--token-color-
|
|
112
|
+
background-color: var(--token-color-foreground-faint);
|
|
113
|
+
color: var(--token-color-foreground-high-contrast);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
&.hds-badge--type-inverted {
|
|
117
|
-
background-color: var(--token-color-
|
|
118
|
-
color: var(--token-color-
|
|
117
|
+
background-color: var(--token-color-surface-faint);
|
|
118
|
+
color: var(--token-color-foreground-primary);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
&.hds-badge--type-outlined {
|
|
122
122
|
background-color: transparent;
|
|
123
123
|
border-color: var(--token-color-palette-neutral-100);
|
|
124
|
-
color: var(--token-color-
|
|
124
|
+
color: var(--token-color-foreground-high-contrast);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
@each $color in $hds-badge-colors-accents {
|
|
129
129
|
.hds-badge--color-#{$color} {
|
|
130
130
|
&.hds-badge--type-filled {
|
|
131
|
-
background-color: var(--token-color-#{$color}
|
|
132
|
-
color: var(--token-color-#{$color}-
|
|
131
|
+
background-color: var(--token-color-surface-#{$color});
|
|
132
|
+
color: var(--token-color-foreground-#{$color}-on-surface);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
&.hds-badge--type-inverted {
|
|
136
|
-
background-color: var(--token-color-#{$color}
|
|
137
|
-
color: var(--token-color-
|
|
136
|
+
background-color: var(--token-color-foreground-#{$color});
|
|
137
|
+
color: var(--token-color-foreground-high-contrast);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
&.hds-badge--type-outlined {
|
|
141
141
|
background-color: transparent;
|
|
142
142
|
border-color: currentColor;
|
|
143
|
-
color: var(--token-color-#{$color}
|
|
143
|
+
color: var(--token-color-foreground-#{$color});
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
}
|
|
@@ -24,7 +24,6 @@ $hds-button-focus-border-width: 3px;
|
|
|
24
24
|
justify-content: center;
|
|
25
25
|
outline-style: solid; // used to avoid double outline+focus-ring in Safari (see https://github.com/hashicorp/design-system-components/issues/161#issuecomment-1031548656)
|
|
26
26
|
outline-color: transparent; // We need this to be transparent for a11y
|
|
27
|
-
max-width: fit-content;
|
|
28
27
|
position: relative;
|
|
29
28
|
width: auto;
|
|
30
29
|
|
|
@@ -38,10 +37,10 @@ $hds-button-focus-border-width: 3px;
|
|
|
38
37
|
&:disabled:hover,
|
|
39
38
|
&[disabled]:hover,
|
|
40
39
|
&.is-disabled:hover {
|
|
41
|
-
background-color: var(--token-color-
|
|
42
|
-
border-color: var(--token-color-
|
|
40
|
+
background-color: var(--token-color-surface-faint);
|
|
41
|
+
border-color: var(--token-color-border-primary);
|
|
43
42
|
box-shadow: none;
|
|
44
|
-
color: var(--token-color-
|
|
43
|
+
color: var(--token-color-foreground-disabled);
|
|
45
44
|
cursor: not-allowed;
|
|
46
45
|
|
|
47
46
|
&::before {
|
|
@@ -140,22 +139,22 @@ $size-props: (
|
|
|
140
139
|
// Note: the order of the pseuo-selectors need to stay the way they are; it doesn't match the Figma file but it's the correct order for browsers to render the styles correctly.
|
|
141
140
|
|
|
142
141
|
.hds-button--color-primary {
|
|
143
|
-
background-color: var(--token-color-
|
|
144
|
-
border-color: var(--token-color-
|
|
145
|
-
color: var(--token-color-
|
|
142
|
+
background-color: var(--token-color-palette-blue-200);
|
|
143
|
+
border-color: var(--token-color-palette-blue-300);
|
|
144
|
+
color: var(--token-color-foreground-high-contrast);
|
|
146
145
|
|
|
147
146
|
&:focus,
|
|
148
147
|
&.is-focus {
|
|
149
|
-
background-color: var(--token-color-
|
|
150
|
-
border-color: var(--token-color-action-
|
|
151
|
-
color: var(--token-color-
|
|
148
|
+
background-color: var(--token-color-palette-blue-200);
|
|
149
|
+
border-color: var(--token-color-focus-action-internal);
|
|
150
|
+
color: var(--token-color-foreground-high-contrast);
|
|
152
151
|
&::before {
|
|
153
152
|
// the position absolute of an element is computed from the inside of the border of the container
|
|
154
153
|
// so we have to take in account the border width of the pseudo-element container itself
|
|
155
154
|
// plus for the primary button we want to have a 2px gap between the button and the focus
|
|
156
155
|
$shift: $hds-button-border-width + $hds-button-focus-border-width + 2px;
|
|
157
156
|
border-radius: $hds-button-border-radius + $hds-button-focus-border-width + 2px;
|
|
158
|
-
border-color: var(--token-color-action-
|
|
157
|
+
border-color: var(--token-color-focus-action-external);
|
|
159
158
|
bottom: -$shift;
|
|
160
159
|
left: -$shift;
|
|
161
160
|
right: -$shift;
|
|
@@ -164,17 +163,17 @@ $size-props: (
|
|
|
164
163
|
}
|
|
165
164
|
&:hover,
|
|
166
165
|
&.is-hover {
|
|
167
|
-
background-color: var(--token-color-
|
|
168
|
-
border-color: var(--token-color-
|
|
169
|
-
color: var(--token-color-
|
|
166
|
+
background-color: var(--token-color-palette-blue-300);
|
|
167
|
+
border-color: var(--token-color-palette-blue-400);
|
|
168
|
+
color: var(--token-color-foreground-high-contrast);
|
|
170
169
|
cursor: pointer;
|
|
171
170
|
}
|
|
172
171
|
&:active,
|
|
173
172
|
&.is-active {
|
|
174
|
-
background-color: var(--token-color-
|
|
175
|
-
border-color: var(--token-color-
|
|
173
|
+
background-color: var(--token-color-palette-blue-400);
|
|
174
|
+
border-color: var(--token-color-palette-blue-400);
|
|
176
175
|
box-shadow: none;
|
|
177
|
-
color: var(--token-color-
|
|
176
|
+
color: var(--token-color-foreground-high-contrast);
|
|
178
177
|
&::before {
|
|
179
178
|
border-color: transparent;
|
|
180
179
|
}
|
|
@@ -182,66 +181,66 @@ $size-props: (
|
|
|
182
181
|
}
|
|
183
182
|
|
|
184
183
|
.hds-button--color-secondary {
|
|
185
|
-
background-color: var(--token-color-
|
|
186
|
-
border-color: var(--token-color-
|
|
187
|
-
color: var(--token-color-
|
|
184
|
+
background-color: var(--token-color-surface-faint);
|
|
185
|
+
border-color: var(--token-color-border-strong);
|
|
186
|
+
color: var(--token-color-foreground-primary);
|
|
188
187
|
|
|
189
188
|
&:focus,
|
|
190
189
|
&.is-focus {
|
|
191
|
-
background-color: var(--token-color-
|
|
192
|
-
border-color: var(--token-color-action-
|
|
193
|
-
color: var(--token-color-
|
|
190
|
+
background-color: var(--token-color-surface-faint);
|
|
191
|
+
border-color: var(--token-color-focus-action-internal);
|
|
192
|
+
color: var(--token-color-foreground-primary);
|
|
194
193
|
&::before {
|
|
195
|
-
border-color:
|
|
194
|
+
border-color: var(--token-color-focus-action-external);
|
|
196
195
|
}
|
|
197
196
|
}
|
|
198
197
|
&:hover,
|
|
199
198
|
&.is-hover {
|
|
200
|
-
background-color: var(--token-color-
|
|
201
|
-
border-color: var(--token-color-
|
|
202
|
-
color: var(--token-color-
|
|
199
|
+
background-color: var(--token-color-surface-primary);
|
|
200
|
+
border-color: var(--token-color-border-strong);
|
|
201
|
+
color: var(--token-color-foreground-primary);
|
|
203
202
|
cursor: pointer;
|
|
204
203
|
}
|
|
205
204
|
&:active,
|
|
206
205
|
&.is-active {
|
|
207
|
-
background-color: var(--token-color-
|
|
208
|
-
border-color: var(--token-color-
|
|
206
|
+
background-color: var(--token-color-surface-interactive-active);
|
|
207
|
+
border-color: var(--token-color-border-strong);
|
|
209
208
|
box-shadow: none;
|
|
210
|
-
color: var(--token-color-
|
|
209
|
+
color: var(--token-color-foreground-primary);
|
|
211
210
|
&::before {
|
|
212
211
|
border-color: transparent;
|
|
213
212
|
}
|
|
214
213
|
}
|
|
215
214
|
}
|
|
216
215
|
|
|
217
|
-
.hds-button--color-
|
|
218
|
-
background-color: var(--token-color-
|
|
219
|
-
border-color: var(--token-color-
|
|
220
|
-
color: var(--token-color-critical-
|
|
216
|
+
.hds-button--color-critical {
|
|
217
|
+
background-color: var(--token-color-surface-critical);
|
|
218
|
+
border-color: var(--token-color-foreground-critical-on-surface);
|
|
219
|
+
color: var(--token-color-foreground-critical-on-surface);
|
|
221
220
|
|
|
222
221
|
&:focus,
|
|
223
222
|
&.is-focus {
|
|
224
|
-
background-color: var(--token-color-
|
|
225
|
-
border-color: var(--token-color-critical-
|
|
226
|
-
color: var(--token-color-critical-
|
|
223
|
+
background-color: var(--token-color-surface-critical);
|
|
224
|
+
border-color: var(--token-color-focus-critical-internal);
|
|
225
|
+
color: var(--token-color-foreground-critical-on-surface);
|
|
227
226
|
&::before {
|
|
228
|
-
border-color:
|
|
227
|
+
border-color: var(--token-color-focus-critical-external);
|
|
229
228
|
}
|
|
230
229
|
}
|
|
231
230
|
&:hover,
|
|
232
231
|
&.is-hover {
|
|
233
|
-
background-color: var(--token-color-
|
|
234
|
-
border-color: var(--token-color-
|
|
235
|
-
color: var(--token-color-
|
|
232
|
+
background-color: var(--token-color-palette-red-300);
|
|
233
|
+
border-color: var(--token-color-palette-red-400);
|
|
234
|
+
color: var(--token-color-foreground-high-contrast);
|
|
236
235
|
cursor: pointer;
|
|
237
236
|
}
|
|
238
237
|
|
|
239
238
|
&:active,
|
|
240
239
|
&.is-active {
|
|
241
|
-
background-color: var(--token-color-
|
|
242
|
-
border-color: var(--token-color-
|
|
240
|
+
background-color: var(--token-color-palette-red-400);
|
|
241
|
+
border-color: var(--token-color-palette-red-400);
|
|
243
242
|
box-shadow: none;
|
|
244
|
-
color: var(--token-color-
|
|
243
|
+
color: var(--token-color-foreground-high-contrast);
|
|
245
244
|
&::before {
|
|
246
245
|
border-color: transparent;
|
|
247
246
|
}
|
|
@@ -20,11 +20,11 @@ $hds-card-container-border-radius: 6px;
|
|
|
20
20
|
// BACKGROUND
|
|
21
21
|
|
|
22
22
|
.hds-card__container--background-neutral-primary {
|
|
23
|
-
background-color: var(--token-color-
|
|
23
|
+
background-color: var(--token-color-surface-primary);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
.hds-card__container--background-neutral-secondary {
|
|
27
|
-
background-color: var(--token-color-
|
|
27
|
+
background-color: var(--token-color-surface-faint);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
.hds-icon-tile__extra {
|
|
32
|
-
background-color: var(--token-color-
|
|
33
|
-
border: 1px solid var(--token-color-
|
|
32
|
+
background-color: var(--token-color-surface-primary);
|
|
33
|
+
border: 1px solid var(--token-color-border-primary);
|
|
34
34
|
bottom: -6px;
|
|
35
35
|
box-shadow: $hds-icon-tile-box-shadow;
|
|
36
36
|
box-sizing: content-box; // the border is outside
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
.hds-icon-tile__extra-icon {
|
|
43
43
|
display: flex;
|
|
44
44
|
margin: auto;
|
|
45
|
-
color: var(--token-color-
|
|
45
|
+
color: var(--token-color-foreground-strong);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// SIZE
|
|
@@ -112,8 +112,8 @@ $size-props: (
|
|
|
112
112
|
|
|
113
113
|
.hds-icon-tile--logo {
|
|
114
114
|
// notice: we are using colored icons so we don't need to set the "color" property here
|
|
115
|
-
background-color: var(--token-color-
|
|
116
|
-
border-color: var(--token-color-
|
|
115
|
+
background-color: var(--token-color-surface-primary);
|
|
116
|
+
border-color: var(--token-color-border-primary);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
// ICON - COLOR
|
|
@@ -121,18 +121,17 @@ $size-props: (
|
|
|
121
121
|
.hds-icon-tile--icon {
|
|
122
122
|
|
|
123
123
|
&.hds-icon-tile--color-neutral {
|
|
124
|
-
background-color: var(--token-color-
|
|
125
|
-
border-color: var(--token-color-
|
|
126
|
-
color: var(--token-color-
|
|
124
|
+
background-color: var(--token-color-surface-faint);
|
|
125
|
+
border-color: var(--token-color-border-primary);
|
|
126
|
+
color: var(--token-color-foreground-faint);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
@each $product in $hds-icon-tile-colors-products {
|
|
130
130
|
@if ($product == 'hcp') {
|
|
131
131
|
// exception for HCP (we use neutral colors, we don't have specific product colors for foreground/background)
|
|
132
|
-
// notice: at the moment we don't have a token for that, that's why we're using an hex value
|
|
133
132
|
&.hds-icon-tile--color-hcp {
|
|
134
|
-
background-color: var(--token-color-
|
|
135
|
-
border-color: var(--token-color-
|
|
133
|
+
background-color: var(--token-color-surface-faint);
|
|
134
|
+
border-color: var(--token-color-border-primary);
|
|
136
135
|
color: var(--token-color-palette-#{$product}-brand);
|
|
137
136
|
}
|
|
138
137
|
} @else {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
//
|
|
8
8
|
//
|
|
9
9
|
|
|
10
|
-
@use
|
|
10
|
+
@use "../../mixins/focus-ring" as *;
|
|
11
11
|
|
|
12
12
|
$hds-link-standalone-sizes: ( 'small', 'medium', 'large' );
|
|
13
13
|
|
|
@@ -20,44 +20,10 @@ $hds-link-standalone-border-width: 1px;
|
|
|
20
20
|
border: $hds-link-standalone-border-width solid transparent; // needs to exist AND be transparent for a11y
|
|
21
21
|
display: flex;
|
|
22
22
|
font-family: var(--token-typography-font-stack-text);
|
|
23
|
-
isolation: isolate; // used to create a new stacking context (needed to have the pseudo element below text/icon but not the parent container)
|
|
24
23
|
justify-content: center;
|
|
25
|
-
outline-style: solid; // used to avoid double outline+focus-ring in Safari (see https://github.com/hashicorp/design-system-components/issues/161#issuecomment-1031548656)
|
|
26
|
-
outline-color: transparent;
|
|
27
|
-
position: relative;
|
|
28
24
|
// notice: the text decoration is applied directly to the "text" container because of a bug in Safari (see https://github.com/hashicorp/design-system-components/issues/159)
|
|
29
25
|
text-decoration-color: transparent;
|
|
30
26
|
width: fit-content;
|
|
31
|
-
|
|
32
|
-
// this is how much the focus is visually "shifted" from the bounding box of the
|
|
33
|
-
// notice: you have to take in account also the inset shadow of the focus (see Figma file and also "generic-focus-state" mixin)
|
|
34
|
-
$hds-link-standalone-focus-shift: 4px;
|
|
35
|
-
// the position absolute of an element is computed from the inside of the border of the container
|
|
36
|
-
// so we have to take in account the border width of the pseudo-element container itself
|
|
37
|
-
$shift: $hds-link-standalone-focus-shift + $hds-link-standalone-border-width;
|
|
38
|
-
// for visual/optical balance we add an extra 2px to the "shift" near the text (opposite the icon)
|
|
39
|
-
$shift-extra: $shift + 2px;
|
|
40
|
-
|
|
41
|
-
// this is used not only for the focus, but also to increase the clickable area
|
|
42
|
-
&::before {
|
|
43
|
-
border-radius: $hds-link-standalone-focus-border-radius;
|
|
44
|
-
bottom: -$shift;
|
|
45
|
-
box-sizing: border-box;
|
|
46
|
-
content: '';
|
|
47
|
-
left: -$shift;
|
|
48
|
-
position: absolute;
|
|
49
|
-
right: -$shift;
|
|
50
|
-
top: -$shift;
|
|
51
|
-
z-index: -1;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
&.hds-link-standalone--icon-position-leading::before {
|
|
55
|
-
right: -$shift-extra;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
&.hds-link-standalone--icon-position-trailing::before {
|
|
59
|
-
left: -$shift-extra;
|
|
60
|
-
}
|
|
61
27
|
}
|
|
62
28
|
|
|
63
29
|
.hds-link-standalone__text {
|
|
@@ -75,7 +41,6 @@ $hds-link-standalone-border-width: 1px;
|
|
|
75
41
|
}
|
|
76
42
|
}
|
|
77
43
|
|
|
78
|
-
|
|
79
44
|
// SIZE
|
|
80
45
|
|
|
81
46
|
// these values later may come from the design tokens
|
|
@@ -115,46 +80,13 @@ $size-props: (
|
|
|
115
80
|
// COLORS & STATES
|
|
116
81
|
// The "primary" and "secondary" variants share a lot of styles for the interactive states
|
|
117
82
|
// Note: the order of the pseuo-selectors need to stay the way they are
|
|
118
|
-
//
|
|
119
|
-
// For an explanation of the ":focus/:focus-visible" states see:
|
|
120
|
-
// - https://github.com/hashicorp/design-system-components/issues/161
|
|
121
|
-
// - https://www.tpgi.com/focus-visible-and-backwards-compatibility/
|
|
122
|
-
|
|
123
|
-
.hds-link-standalone {
|
|
124
|
-
// default focus for browsers that still rely on ":focus"
|
|
125
|
-
&:focus,
|
|
126
|
-
&.is-focus {
|
|
127
|
-
&::before {
|
|
128
|
-
@include hds-generic-focus-state();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
// undo the previous declaration for browsers that support ":focus-visible" but wouldn't normally show default focus styles
|
|
132
|
-
&:focus:not(:focus-visible) {
|
|
133
|
-
&::before {
|
|
134
|
-
@include hds-remove-focus-state();
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
// set focus for browsers that support ":focus-visible"
|
|
138
|
-
&:focus-visible {
|
|
139
|
-
&::before {
|
|
140
|
-
@include hds-generic-focus-state();
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
// remove the focus ring on "active + focused" state (by design)
|
|
144
|
-
&:focus:active,
|
|
145
|
-
&.is-focus.is-active {
|
|
146
|
-
&::before {
|
|
147
|
-
@include hds-remove-focus-state();
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
83
|
|
|
152
84
|
.hds-link-standalone--color-primary {
|
|
153
|
-
color: var(--token-color-
|
|
85
|
+
color: var(--token-color-foreground-action);
|
|
154
86
|
|
|
155
87
|
&:hover,
|
|
156
88
|
&.is-hover {
|
|
157
|
-
color: var(--token-color-action-
|
|
89
|
+
color: var(--token-color-foreground-action-hover);
|
|
158
90
|
|
|
159
91
|
.hds-link-standalone__text {
|
|
160
92
|
text-decoration-color: #4E81E8; // custom color by design
|
|
@@ -163,20 +95,20 @@ $size-props: (
|
|
|
163
95
|
|
|
164
96
|
&:active,
|
|
165
97
|
&.is-active {
|
|
166
|
-
color: var(--token-color-action-
|
|
98
|
+
color: var(--token-color-foreground-action-active);
|
|
167
99
|
|
|
168
100
|
.hds-link-standalone__text {
|
|
169
101
|
text-decoration-color: #396ED6; // custom color by design
|
|
170
102
|
}
|
|
171
103
|
|
|
172
104
|
&::before {
|
|
173
|
-
background-color: var(--token-color-action
|
|
105
|
+
background-color: var(--token-color-surface-action);
|
|
174
106
|
}
|
|
175
107
|
}
|
|
176
108
|
}
|
|
177
109
|
|
|
178
110
|
.hds-link-standalone--color-secondary {
|
|
179
|
-
color: var(--token-color-
|
|
111
|
+
color: var(--token-color-foreground-strong);
|
|
180
112
|
|
|
181
113
|
&:hover,
|
|
182
114
|
&.is-hover {
|
|
@@ -187,14 +119,38 @@ $size-props: (
|
|
|
187
119
|
|
|
188
120
|
&:active,
|
|
189
121
|
&.is-active {
|
|
190
|
-
color: var(--token-color-
|
|
122
|
+
color: var(--token-color-foreground-primary);
|
|
191
123
|
|
|
192
124
|
.hds-link-standalone__text {
|
|
193
125
|
text-decoration-color: #6E7075; // custom color by design
|
|
194
126
|
}
|
|
195
127
|
|
|
196
128
|
&::before {
|
|
197
|
-
background-color: var(--token-color-
|
|
129
|
+
background-color: var(--token-color-surface-interactive-active);
|
|
198
130
|
}
|
|
199
131
|
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// this is how much the focus is visually "shifted" from the bounding box of the
|
|
135
|
+
// notice: you have to take in account also the inset shadow of the focus (see Figma file and also "focus-ring" mixin)
|
|
136
|
+
$hds-link-standalone-focus-shift: 4px;
|
|
137
|
+
|
|
138
|
+
.hds-link-standalone {
|
|
139
|
+
// the position absolute of an element is computed from the inside of the border of the container
|
|
140
|
+
// so we have to take in account the border width of the pseudo-element container itself
|
|
141
|
+
$shift: $hds-link-standalone-focus-shift + $hds-link-standalone-border-width;
|
|
142
|
+
// for visual/optical balance we add an extra 2px to the "shift" near the text (opposite the icon)
|
|
143
|
+
$shift-extra: $shift + 2px;
|
|
144
|
+
|
|
145
|
+
// notice: this is used not only for the focus, but also to increase the clickable area
|
|
146
|
+
@include hds-focus-ring-with-pseudo-element($top: -$shift, $right: -$shift, $bottom: -$shift, $left: -$shift, $radius: $hds-link-standalone-focus-border-radius);
|
|
147
|
+
|
|
148
|
+
// we need to override a couple of values for better visual alignment
|
|
149
|
+
&.hds-link-standalone--icon-position-leading::before {
|
|
150
|
+
right: -$shift-extra;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&.hds-link-standalone--icon-position-trailing::before {
|
|
154
|
+
left: -$shift-extra;
|
|
155
|
+
}
|
|
200
156
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// For an explanation of the ":focus/:focus-visible" states see:
|
|
2
|
+
// - https://github.com/hashicorp/design-system-components/issues/161
|
|
3
|
+
// - https://www.tpgi.com/focus-visible-and-backwards-compatibility/
|
|
4
|
+
|
|
5
|
+
@mixin hds-focus-ring-basic() {
|
|
6
|
+
outline-style: solid; // used to avoid double outline+focus-ring in Safari (see https://github.com/hashicorp/design-system-components/issues/161#issuecomment-1031548656)
|
|
7
|
+
outline-color: transparent;
|
|
8
|
+
|
|
9
|
+
// default focus for browsers that still rely on ":focus"
|
|
10
|
+
&:focus,
|
|
11
|
+
&.is-focus {
|
|
12
|
+
box-shadow: var(--token-focus-ring-box-shadow);
|
|
13
|
+
}
|
|
14
|
+
// undo the previous declaration for browsers that support ":focus-visible" but wouldn't normally show default focus styles
|
|
15
|
+
&:focus:not(:focus-visible) {
|
|
16
|
+
box-shadow: none;
|
|
17
|
+
}
|
|
18
|
+
// set focus for browsers that support ":focus-visible"
|
|
19
|
+
&:focus-visible {
|
|
20
|
+
box-shadow: var(--token-focus-ring-box-shadow);
|
|
21
|
+
}
|
|
22
|
+
// remove the focus ring on "active + focused" state (by design)
|
|
23
|
+
&:focus:active,
|
|
24
|
+
&.is-focus.is-active {
|
|
25
|
+
box-shadow: none;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@mixin hds-focus-ring-with-pseudo-element($top: 0, $right: 0, $bottom: 0, $left: 0, $radius: 5px) {
|
|
30
|
+
isolation: isolate; // used to create a new stacking context (needed to have the pseudo element below text/icon but not the parent container)
|
|
31
|
+
outline-style: solid; // used to avoid double outline+focus-ring in Safari (see https://github.com/hashicorp/design-system-components/issues/161#issuecomment-1031548656)
|
|
32
|
+
outline-color: transparent;
|
|
33
|
+
position: relative;
|
|
34
|
+
|
|
35
|
+
&::before {
|
|
36
|
+
border-radius: $radius;
|
|
37
|
+
bottom: $bottom;
|
|
38
|
+
box-sizing: border-box;
|
|
39
|
+
content: '';
|
|
40
|
+
left: $left;
|
|
41
|
+
position: absolute;
|
|
42
|
+
right: $right;
|
|
43
|
+
top: $top;
|
|
44
|
+
z-index: -1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// default focus for browsers that still rely on ":focus"
|
|
48
|
+
&:focus,
|
|
49
|
+
&.is-focus {
|
|
50
|
+
&::before {
|
|
51
|
+
box-shadow: var(--token-focus-ring-box-shadow);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// undo the previous declaration for browsers that support ":focus-visible" but wouldn't normally show default focus styles
|
|
55
|
+
&:focus:not(:focus-visible) {
|
|
56
|
+
&::before {
|
|
57
|
+
box-shadow: none;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// set focus for browsers that support ":focus-visible"
|
|
61
|
+
&:focus-visible {
|
|
62
|
+
&::before {
|
|
63
|
+
box-shadow: var(--token-focus-ring-box-shadow);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// remove the focus ring on "active + focused" state (by design)
|
|
67
|
+
&:focus:active,
|
|
68
|
+
&.is-focus.is-active {
|
|
69
|
+
&::before {
|
|
70
|
+
box-shadow: none;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashicorp/design-system-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "HashiCorp Design System Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hashicorp",
|
|
@@ -8,35 +8,13 @@
|
|
|
8
8
|
"components",
|
|
9
9
|
"ember-addon"
|
|
10
10
|
],
|
|
11
|
-
"repository":
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/hashicorp/design-system.git",
|
|
14
|
+
"directory": "packages/components"
|
|
15
|
+
},
|
|
12
16
|
"license": "MPL-2.0",
|
|
13
17
|
"author": "HashiCorp Design Systems <design-systems@hashicorp.com>",
|
|
14
|
-
"contributors": [
|
|
15
|
-
{
|
|
16
|
-
"name": "Melanie Sumner",
|
|
17
|
-
"email": "melanie@hashicorp.com"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"name": "Brian Runnells",
|
|
21
|
-
"email": "brunnells@hashicorp.com"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"name": "Hector Simpson",
|
|
25
|
-
"email": "hector@hashicorp.com"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"name": "Heather Larsen",
|
|
29
|
-
"email": "hlarsen@hashicorp.com"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"name": "Amy Lam",
|
|
33
|
-
"email": "alam@hashicorp.com"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"name": "Cristiano Rastelli",
|
|
37
|
-
"email": "cristiano.rastelli@hashicorp.com"
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
18
|
"directories": {
|
|
41
19
|
"doc": "doc",
|
|
42
20
|
"test": "tests"
|
|
@@ -53,19 +31,17 @@
|
|
|
53
31
|
"test": "npm-run-all lint test:*",
|
|
54
32
|
"test:ember": "ember test",
|
|
55
33
|
"test:ember-compatibility": "ember try:each",
|
|
56
|
-
"test:ember:percy": "percy exec ember test"
|
|
57
|
-
"bump": "./node_modules/.bin/bump package.json",
|
|
58
|
-
"release": "yarn publish --new-version $npm_package_version",
|
|
59
|
-
"postrelease:git-tag": "TAG_VERSION=\"${npm_package_name}/${npm_package_version}\" && git tag $TAG_VERSION && git push origin $TAG_VERSION",
|
|
60
|
-
"postrelease": "yarn postrelease:git-tag",
|
|
61
|
-
"prepare": "husky install"
|
|
34
|
+
"test:ember:percy": "percy exec ember test"
|
|
62
35
|
},
|
|
63
36
|
"dependencies": {
|
|
64
|
-
"@hashicorp/design-system-tokens": "^0.
|
|
37
|
+
"@hashicorp/design-system-tokens": "^0.6.0",
|
|
65
38
|
"@hashicorp/ember-flight-icons": "^2.0.1",
|
|
39
|
+
"ember-auto-import": "^2.2.3",
|
|
66
40
|
"ember-cli-babel": "^7.26.6",
|
|
67
41
|
"ember-cli-htmlbars": "^5.7.1",
|
|
68
42
|
"ember-cli-sass": "^10.0.1",
|
|
43
|
+
"ember-focus-trap": "^1.0.1",
|
|
44
|
+
"ember-named-blocks-polyfill": "^0.2.5",
|
|
69
45
|
"sass": "^1.43.4"
|
|
70
46
|
},
|
|
71
47
|
"devDependencies": {
|
|
@@ -79,7 +55,6 @@
|
|
|
79
55
|
"babel-eslint": "^10.1.0",
|
|
80
56
|
"broccoli-asset-rev": "^3.0.0",
|
|
81
57
|
"ember-a11y-refocus": "^2.1.0",
|
|
82
|
-
"ember-auto-import": "^2.2.3",
|
|
83
58
|
"ember-cli": "~3.28.4",
|
|
84
59
|
"ember-cli-clipboard": "^0.15.0",
|
|
85
60
|
"ember-cli-dependency-checker": "^3.2.0",
|
|
@@ -109,8 +84,6 @@
|
|
|
109
84
|
"eslint-plugin-node": "^11.1.0",
|
|
110
85
|
"eslint-plugin-prettier": "^3.4.1",
|
|
111
86
|
"eslint-plugin-qunit": "^6.2.0",
|
|
112
|
-
"husky": "^7.0.4",
|
|
113
|
-
"lint-staged": "^12.1.2",
|
|
114
87
|
"loader.js": "^4.7.0",
|
|
115
88
|
"npm-run-all": "^4.1.5",
|
|
116
89
|
"prettier": "^2.3.2",
|
|
@@ -127,9 +100,5 @@
|
|
|
127
100
|
},
|
|
128
101
|
"ember-addon": {
|
|
129
102
|
"configPath": "tests/dummy/config"
|
|
130
|
-
},
|
|
131
|
-
"lint-staged": {
|
|
132
|
-
"*.js": "eslint --cache --fix",
|
|
133
|
-
"*.{js,hbs}": "prettier --write"
|
|
134
103
|
}
|
|
135
104
|
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: New Component Quest Issue/Engineering Checklist
|
|
3
|
-
about: 'DS Team: Engineering Checklist for New Components'
|
|
4
|
-
title: "[Quest] New Component: Component Name"
|
|
5
|
-
labels: ''
|
|
6
|
-
assignees: ''
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
This is the quest issue/engineering checklist for the COMPONENT_NAME Component. All new components will have their own feature branch, and any PR that adds an item from the checklist should target the feature branch, and not `main`.
|
|
11
|
-
|
|
12
|
-
## Pre-Flight Checklist
|
|
13
|
-
Update this list and these links as appropriate.
|
|
14
|
-
|
|
15
|
-
- [Component Doc](url_here): This file should exist before any code is written.
|
|
16
|
-
- [FIGMA Design](url_here): 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.
|
|
17
|
-
- [Design System Website](https://design-system-website.vercel.app/?path=/story/example-introduction--page) (storybook of storybooks): use for reference, to consider existing features that we might need to replicate in the component.
|
|
18
|
-
|
|
19
|
-
## Engineering Checklist
|
|
20
|
-
The engineering checklist has six parts: creating the feature branch, component template, component backing class, component style, tests, and documentation.
|
|
21
|
-
|
|
22
|
-
### Component Creation
|
|
23
|
-
|
|
24
|
-
- [ ] create new branch from main for the component.
|
|
25
|
-
- [ ] create new component
|
|
26
|
-
- `ember generate component hds/COMPONENT_NAME/index --gc` (the component won't need to be invoked with index, it's just to put all the files in the correct place)
|
|
27
|
-
- if it's a variation on a component, then `hds/COMPONENT_NAME/VARIATION` instead of `index`
|
|
28
|
-
- [ ] **component template**
|
|
29
|
-
- use semantic HTML
|
|
30
|
-
- the component should have a css class that is the same as the component (e.g. `hds/button` should have a class name of `hds-button` on the component, and additional CSS classes should start with this same class name.
|
|
31
|
-
- add `...attributes` unless doing so would be detrimental (e.g., a parent component and child component that both have ...attributes)
|
|
32
|
-
- [ ] **component class**
|
|
33
|
-
- use getters (vs template conditionals or constructors, if possible)
|
|
34
|
-
- write API comments in the JS doc way (copy from an existing DS component)
|
|
35
|
-
- use the same naming as the Figma file for the components API unless it conflicts with a pre-existing HTML attribute. If that is the case, document the difference in the comment.
|
|
36
|
-
- ensure that all existing functionality (from a Structure component) is accounted for in some way. If we are not providing existing functionality at all, it should be documented (along with the reason why). If we are providing temporary functionality, explain that it's temporary and why.
|
|
37
|
-
- check the [design system website](https://design-system-website.vercel.app/?path=/story/example-introduction--page) to see what kind of component functionality is being used across all products
|
|
38
|
-
- booleans should start with a verb (is/has/etc)
|
|
39
|
-
- assertion text should match the content style of the other components.
|
|
40
|
-
- goal is a terse invocation
|
|
41
|
-
- [ ] **component style**
|
|
42
|
-
- create `component/COMPONENT_NAME.scss` in `app/styles`
|
|
43
|
-
- add `@use` to `app/styles/@hashicorp/design-system-components.scss` (see existing code for precise syntax)
|
|
44
|
-
- use design tokens wherever possible, comment where they are not
|
|
45
|
-
- sizes should be in relative units
|
|
46
|
-
- line heights should be unitless
|
|
47
|
-
- [ ] **testing**
|
|
48
|
-
- [ ] test basic functionality
|
|
49
|
-
- [ ] test defaults
|
|
50
|
-
- [ ] try not to repeat tests (i.e., don't have to test all sizes, all colors, etc.)
|
|
51
|
-
- [ ] test all accessibility attributes
|
|
52
|
-
- [ ] **documentation**
|
|
53
|
-
- create component page `ember generate route components/COMPONENT_NAME --dummy`
|
|
54
|
-
- add link to `templates/index.hbs` page
|
|
55
|
-
- [ ] API docs
|
|
56
|
-
- [ ] Usage
|
|
57
|
-
- [ ] Showcase
|
|
58
|
-
|
|
59
|
-
### Component Review
|
|
60
|
-
|
|
61
|
-
Pre-review request checks:
|
|
62
|
-
|
|
63
|
-
- [ ] make sure all tests pass (`ember s` then visit /tests; or `ember t -s`)
|
|
64
|
-
- [ ] check for basic a11y on docs page:
|
|
65
|
-
- keyboard navigation
|
|
66
|
-
- logical DOM order
|
|
67
|
-
- zoom up to 400%
|
|
68
|
-
- color contrast
|
|
69
|
-
- (the axe-core browser plugin can run some basic tests and give immediate feedback)
|
|
70
|
-
- [ ] check page on browsers
|
|
71
|
-
- Chrome
|
|
72
|
-
- Firefox
|
|
73
|
-
- Safari
|
|
74
|
-
- Edge (once available)
|
|
75
|
-
|
|
76
|
-
When ready for review:
|
|
77
|
-
- [ ] add situationally appropriate reviewers
|
|
78
|
-
- [ ] added instructions for reviewers in your PR, letting them know what kind of review you need
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
## :pushpin: Summary
|
|
2
|
-
|
|
3
|
-
<!-- TLDR that includes the purpose of the PR e.g. "If merged, this PR..." -->
|
|
4
|
-
|
|
5
|
-
## :busts_in_silhouette: How to review this PR
|
|
6
|
-
|
|
7
|
-
<!-- Check one box -->
|
|
8
|
-
|
|
9
|
-
- [ ] Review commit-by-commit (please copy commit info to "Summary" for clarity)
|
|
10
|
-
- [ ] Review by "Files changed"
|
|
11
|
-
|
|
12
|
-
## :camera_flash: Screenshots
|
|
13
|
-
|
|
14
|
-
<!-- A picture is a thousand words -->
|
|
15
|
-
|
|
16
|
-
## :link: External links
|
|
17
|
-
|
|
18
|
-
<!-- Asana issues, RFCs, etc. -->
|
|
19
|
-
|
|
20
|
-
## :memo: Is it documented?
|
|
21
|
-
|
|
22
|
-
- [ ] Please confirm that this change is documented on the website!
|
|
23
|
-
|
|
24
|
-
***
|
|
25
|
-
|
|
26
|
-
:speech_balloon: Please consider using [conventional comments](https://conventionalcomments.org/) when reviewing this PR.
|
package/.github/workflows/ci.yml
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
pull_request:
|
|
8
|
-
|
|
9
|
-
env:
|
|
10
|
-
NODE_VERSION: '16.x'
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
lint:
|
|
14
|
-
name: Lint
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v2
|
|
18
|
-
with:
|
|
19
|
-
fetch-depth: 1
|
|
20
|
-
|
|
21
|
-
- uses: actions/setup-node@v2-beta
|
|
22
|
-
with:
|
|
23
|
-
node-version: '${{ env.NODE_VERSION }}'
|
|
24
|
-
|
|
25
|
-
- name: Get package manager's global cache path
|
|
26
|
-
id: global-cache-dir-path
|
|
27
|
-
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
28
|
-
|
|
29
|
-
- name: Cache package manager's global cache and node_modules
|
|
30
|
-
id: cache-dependencies
|
|
31
|
-
uses: actions/cache@v2
|
|
32
|
-
with:
|
|
33
|
-
path: |
|
|
34
|
-
${{ steps.global-cache-dir-path.outputs.dir }}
|
|
35
|
-
node_modules
|
|
36
|
-
key: ${{ runner.os }}-${{ matrix.node-version }}-${{
|
|
37
|
-
hashFiles('**/yarn.lock'
|
|
38
|
-
) }}
|
|
39
|
-
restore-keys: |
|
|
40
|
-
${{ runner.os }}-${{ matrix.node-version }}-
|
|
41
|
-
|
|
42
|
-
- name: Install Dependencies
|
|
43
|
-
run: yarn install --frozen-lockfile
|
|
44
|
-
if: |
|
|
45
|
-
steps.cache-dependencies.outputs.cache-hit != 'true'
|
|
46
|
-
|
|
47
|
-
- name: Lint
|
|
48
|
-
run: yarn lint
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
test:
|
|
52
|
-
name: Tests
|
|
53
|
-
runs-on: ${{ matrix.os }}
|
|
54
|
-
needs: lint
|
|
55
|
-
|
|
56
|
-
strategy:
|
|
57
|
-
matrix:
|
|
58
|
-
os: [ubuntu-latest]
|
|
59
|
-
browser: [chrome]
|
|
60
|
-
|
|
61
|
-
steps:
|
|
62
|
-
- uses: actions/checkout@v2
|
|
63
|
-
with:
|
|
64
|
-
fetch-depth: 1
|
|
65
|
-
|
|
66
|
-
- uses: actions/setup-node@v2-beta
|
|
67
|
-
with:
|
|
68
|
-
node-version: '${{ env.NODE_VERSION }}'
|
|
69
|
-
|
|
70
|
-
- name: Get package manager's global cache path
|
|
71
|
-
id: global-cache-dir-path
|
|
72
|
-
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
73
|
-
|
|
74
|
-
- name: Cache package manager's global cache and node_modules
|
|
75
|
-
id: cache-dependencies
|
|
76
|
-
uses: actions/cache@v2
|
|
77
|
-
with:
|
|
78
|
-
path: |
|
|
79
|
-
${{ steps.global-cache-dir-path.outputs.dir }}
|
|
80
|
-
node_modules
|
|
81
|
-
key: ${{ runner.os }}-${{ matrix.node-version }}-${{
|
|
82
|
-
hashFiles('**/yarn.lock'
|
|
83
|
-
) }}
|
|
84
|
-
restore-keys: |
|
|
85
|
-
${{ runner.os }}-${{ matrix.node-version }}-
|
|
86
|
-
|
|
87
|
-
- name: Install Dependencies
|
|
88
|
-
run: yarn install --frozen-lockfile
|
|
89
|
-
if: |
|
|
90
|
-
steps.cache-dependencies.outputs.cache-hit != 'true'
|
|
91
|
-
|
|
92
|
-
- name: Test
|
|
93
|
-
run: yarn test:ember:percy --launch ${{ matrix.browser }}
|
|
94
|
-
env:
|
|
95
|
-
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
|
|
96
|
-
|
|
97
|
-
floating-dependencies:
|
|
98
|
-
name: Floating Dependencies
|
|
99
|
-
runs-on: ${{ matrix.os }}
|
|
100
|
-
needs: lint
|
|
101
|
-
|
|
102
|
-
strategy:
|
|
103
|
-
matrix:
|
|
104
|
-
os: [ubuntu-latest]
|
|
105
|
-
browser: [chrome]
|
|
106
|
-
|
|
107
|
-
steps:
|
|
108
|
-
- uses: actions/checkout@v2
|
|
109
|
-
with:
|
|
110
|
-
fetch-depth: 1
|
|
111
|
-
|
|
112
|
-
- uses: actions/setup-node@v2-beta
|
|
113
|
-
with:
|
|
114
|
-
node-version: '${{ env.NODE_VERSION }}'
|
|
115
|
-
|
|
116
|
-
- name: Get package manager's global cache path
|
|
117
|
-
id: global-cache-dir-path
|
|
118
|
-
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
119
|
-
|
|
120
|
-
- name: Cache package manager's global cache and node_modules
|
|
121
|
-
id: cache-dependencies
|
|
122
|
-
uses: actions/cache@v2
|
|
123
|
-
with:
|
|
124
|
-
path: |
|
|
125
|
-
${{ steps.global-cache-dir-path.outputs.dir }}
|
|
126
|
-
node_modules
|
|
127
|
-
key: ${{ runner.os }}-${{ matrix.node-version }}-${{
|
|
128
|
-
hashFiles('**/yarn.lock'
|
|
129
|
-
) }}
|
|
130
|
-
restore-keys: |
|
|
131
|
-
${{ runner.os }}-${{ matrix.node-version }}-
|
|
132
|
-
|
|
133
|
-
- name: Install Dependencies
|
|
134
|
-
run: yarn install --no-lockfile --non-interactive
|
|
135
|
-
|
|
136
|
-
- name: Test
|
|
137
|
-
run: yarn test:ember:percy --launch ${{ matrix.browser }}
|
|
138
|
-
env:
|
|
139
|
-
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
|
|
140
|
-
|
|
141
|
-
try-scenarios:
|
|
142
|
-
name: Tests - ${{ matrix.ember-try-scenario }}
|
|
143
|
-
runs-on: ubuntu-latest
|
|
144
|
-
continue-on-error: true
|
|
145
|
-
needs: test
|
|
146
|
-
|
|
147
|
-
strategy:
|
|
148
|
-
fail-fast: true
|
|
149
|
-
matrix:
|
|
150
|
-
ember-try-scenario: [
|
|
151
|
-
ember-lts-3.20,
|
|
152
|
-
ember-lts-3.24,
|
|
153
|
-
ember-release,
|
|
154
|
-
ember-beta,
|
|
155
|
-
# ember-canary,
|
|
156
|
-
ember-default-with-jquery,
|
|
157
|
-
ember-classic,
|
|
158
|
-
# embroider-safe,
|
|
159
|
-
# embroider-optimized
|
|
160
|
-
]
|
|
161
|
-
|
|
162
|
-
steps:
|
|
163
|
-
- uses: actions/checkout@v2
|
|
164
|
-
with:
|
|
165
|
-
fetch-depth: 1
|
|
166
|
-
|
|
167
|
-
- uses: actions/setup-node@v2-beta
|
|
168
|
-
with:
|
|
169
|
-
node-version: '${{ env.NODE_VERSION }}'
|
|
170
|
-
|
|
171
|
-
- name: Get package manager's global cache path
|
|
172
|
-
id: global-cache-dir-path
|
|
173
|
-
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
174
|
-
|
|
175
|
-
- name: Cache package manager's global cache and node_modules
|
|
176
|
-
id: cache-dependencies
|
|
177
|
-
uses: actions/cache@v2
|
|
178
|
-
with:
|
|
179
|
-
path: |
|
|
180
|
-
${{ steps.global-cache-dir-path.outputs.dir }}
|
|
181
|
-
node_modules
|
|
182
|
-
key: ${{ runner.os }}-${{ matrix.node-version }}-${{
|
|
183
|
-
hashFiles('**/yarn.lock'
|
|
184
|
-
) }}
|
|
185
|
-
restore-keys: |
|
|
186
|
-
${{ runner.os }}-${{ matrix.node-version }}-
|
|
187
|
-
|
|
188
|
-
- name: Install Dependencies
|
|
189
|
-
run: yarn install --frozen-lockfile
|
|
190
|
-
if: |
|
|
191
|
-
steps.cache-dependencies.outputs.cache-hit != 'true'
|
|
192
|
-
|
|
193
|
-
- name: Test
|
|
194
|
-
env:
|
|
195
|
-
EMBER_TRY_SCENARIO: ${{ matrix.ember-try-scenario }}
|
|
196
|
-
run: node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO
|
package/.husky/pre-commit
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
. "$(dirname "$0")/_/husky.sh"
|
|
3
|
-
|
|
4
|
-
export NVM_DIR="$HOME/.nvm/nvm.sh"
|
|
5
|
-
. "$(dirname $NVM_DIR)/nvm.sh"
|
|
6
|
-
|
|
7
|
-
export NVM_DIR="$HOME/.nvm"
|
|
8
|
-
a=$(nvm ls | grep 'node')
|
|
9
|
-
b=${a#*(-> }
|
|
10
|
-
v=${b%%[)| ]*}
|
|
11
|
-
|
|
12
|
-
export PATH="$NVM_DIR/versions/node/$v/bin:$PATH"
|
|
13
|
-
|
|
14
|
-
npx lint-staged
|