@hashicorp/design-system-components 0.1.0 → 0.1.1
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/README.md +21 -1
- package/addon/components/hds/button/index.js +2 -2
- 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/helpers/hds-link-to-query.js +1 -0
- package/app/styles/components/button.scss +4 -4
- package/app/styles/components/link/standalone.scss +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,27 @@ Installation
|
|
|
21
21
|
yarn add @hashicorp/design-system-components
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
If you do not have `ember-cli-sass` installed, 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/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';
|
|
@@ -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;
|
|
@@ -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/helpers/hds-link-to-query';
|
|
@@ -213,14 +213,14 @@ $size-props: (
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
.hds-button--color-
|
|
217
|
-
background-color: var(--token-color-
|
|
218
|
-
border-color: var(--token-color-
|
|
216
|
+
.hds-button--color-critical {
|
|
217
|
+
background-color: var(--token-color-surface-critical);
|
|
218
|
+
border-color: var(--token-color-foreground-critical-on-surface);
|
|
219
219
|
color: var(--token-color-foreground-critical-on-surface);
|
|
220
220
|
|
|
221
221
|
&:focus,
|
|
222
222
|
&.is-focus {
|
|
223
|
-
background-color: var(--token-color-
|
|
223
|
+
background-color: var(--token-color-surface-critical);
|
|
224
224
|
border-color: var(--token-color-focus-critical-internal);
|
|
225
225
|
color: var(--token-color-foreground-critical-on-surface);
|
|
226
226
|
&::before {
|