@hashicorp/design-system-components 2.10.0 → 2.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 +19 -0
- package/addon/components/hds/form/indicator/index.hbs +1 -1
- package/addon/components/hds/form/masked-input/base.hbs +8 -0
- package/addon/components/hds/form/masked-input/base.js +14 -1
- package/addon/components/hds/form/masked-input/field.hbs +1 -0
- package/addon/components/hds/text/body.hbs +14 -0
- package/addon/components/hds/text/body.js +73 -0
- package/addon/components/hds/text/code.hbs +14 -0
- package/addon/components/hds/text/code.js +73 -0
- package/addon/components/hds/text/display.hbs +14 -0
- package/addon/components/hds/text/display.js +85 -0
- package/addon/components/hds/text/index.hbs +8 -0
- package/addon/components/hds/text/index.js +148 -0
- package/app/components/hds/text/body.js +6 -0
- package/app/components/hds/text/code.js +6 -0
- package/app/components/hds/text/display.js +6 -0
- package/app/components/hds/text/index.js +6 -0
- package/app/styles/@hashicorp/design-system-components.scss +1 -0
- package/app/styles/components/alert.scss +5 -5
- package/app/styles/components/form/masked-input.scss +11 -0
- package/app/styles/components/text.scss +25 -0
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @hashicorp/design-system-components
|
|
2
2
|
|
|
3
|
+
## 2.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1490](https://github.com/hashicorp/design-system/pull/1490) [`4dafcb7d7`](https://github.com/hashicorp/design-system/commit/4dafcb7d7568027c495cb92d01026359a040507a) Thanks [@didoo](https://github.com/didoo)! - `Hds::Text` - Added new `Text` component
|
|
8
|
+
|
|
9
|
+
- [#1587](https://github.com/hashicorp/design-system/pull/1587) [`57e7a42cb`](https://github.com/hashicorp/design-system/commit/57e7a42cb8353af83d8be5be0a318f951b00d3e3) Thanks [@alex-ju](https://github.com/alex-ju)! - `Hds::Form::MaskedInput` - Add `hasCopyButton` argument
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#1577](https://github.com/hashicorp/design-system/pull/1577) [`8aa9a5889`](https://github.com/hashicorp/design-system/commit/8aa9a5889cf14fc28100a462dfd42754a3bdb42b) Thanks [@DingoEatingFuzz](https://github.com/DingoEatingFuzz)! - Remove aria-hidden from the "optional" span in Form::Indicator
|
|
14
|
+
|
|
15
|
+
- [#1606](https://github.com/hashicorp/design-system/pull/1606) [`7ac4526db`](https://github.com/hashicorp/design-system/commit/7ac4526dbddda6bea0e6e9f542addc5c97914fa8) Thanks [@Dhaulagiri](https://github.com/Dhaulagiri)! - Remove `ember-named-blocks-polyfill` as all consumers of HDS are on Ember 3.25 or later now. This can be installed locally if it is still needed.
|
|
16
|
+
|
|
17
|
+
- [#1576](https://github.com/hashicorp/design-system/pull/1576) [`e16c88ba9`](https://github.com/hashicorp/design-system/commit/e16c88ba959dcd0b186fd823fc3fccacf39674e8) Thanks [@KristinLBradley](https://github.com/KristinLBradley)! - `Alert`, `Toast`: Fixed an issue with anchor tag color styles within Description that had been overriding `Hds::Link` color; changed the default color for HTML links within Description to "neutral" to better align with existing guidance for links in the actions and improve accessible contrast.
|
|
18
|
+
|
|
19
|
+
- Updated dependencies []:
|
|
20
|
+
- @hashicorp/ember-flight-icons@3.1.1
|
|
21
|
+
|
|
3
22
|
## 2.10.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
SPDX-License-Identifier: MPL-2.0
|
|
4
4
|
}}
|
|
5
5
|
{{#if @isOptional}}
|
|
6
|
-
<span
|
|
6
|
+
<span class={{this.classNames}}>(Optional)</span>
|
|
7
7
|
{{/if}}
|
|
8
8
|
{{#if @isRequired}}
|
|
9
9
|
<Hds::Badge aria-hidden="true" class={{this.classNames}} @size="small" @color="neutral" @text="Required" />
|
|
@@ -31,4 +31,12 @@
|
|
|
31
31
|
<FlightIcon @name={{if this.isMasked "eye" "eye-off"}} @size="16" @isInlineBlock={{false}} />
|
|
32
32
|
<span class="sr-only" aria-live="polite">{{this.ariaMessageText}}</span>
|
|
33
33
|
</button>
|
|
34
|
+
{{#if @hasCopyButton}}
|
|
35
|
+
<Hds::Copy::Button
|
|
36
|
+
class="hds-form-masked-input__copy-button"
|
|
37
|
+
@text={{this.copyButtonText}}
|
|
38
|
+
@isIconOnly={{true}}
|
|
39
|
+
@textToCopy="{{@value}}"
|
|
40
|
+
/>
|
|
41
|
+
{{/if}}
|
|
34
42
|
</div>
|
|
@@ -41,7 +41,7 @@ export default class HdsFormMaskedInputBaseComponent extends Component {
|
|
|
41
41
|
/**
|
|
42
42
|
* @param ariaMessageText
|
|
43
43
|
* @type {string}
|
|
44
|
-
* @default ''
|
|
44
|
+
* @default 'Input content is now hidden'
|
|
45
45
|
*/
|
|
46
46
|
get ariaMessageText() {
|
|
47
47
|
if (this.args.ariaMessageText) {
|
|
@@ -53,6 +53,19 @@ export default class HdsFormMaskedInputBaseComponent extends Component {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* @param copyButtonText
|
|
58
|
+
* @type {string}
|
|
59
|
+
* @default 'Copy masked content'
|
|
60
|
+
*/
|
|
61
|
+
get copyButtonText() {
|
|
62
|
+
if (this.args.copyButtonText) {
|
|
63
|
+
return this.args.copyButtonText;
|
|
64
|
+
} else {
|
|
65
|
+
return 'Copy masked content';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
56
69
|
/**
|
|
57
70
|
* Get the class names to apply to the component.
|
|
58
71
|
* @method classNames
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{{!
|
|
2
|
+
Copyright (c) HashiCorp, Inc.
|
|
3
|
+
SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
}}
|
|
5
|
+
|
|
6
|
+
<Hds::Text
|
|
7
|
+
@group="body"
|
|
8
|
+
@size={{this.size}}
|
|
9
|
+
@weight={{this.weight}}
|
|
10
|
+
@align={{@align}}
|
|
11
|
+
@color={{@color}}
|
|
12
|
+
@tag={{@tag}}
|
|
13
|
+
...attributes
|
|
14
|
+
>{{yield}}</Hds::Text>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import Component from '@glimmer/component';
|
|
7
|
+
import { assert } from '@ember/debug';
|
|
8
|
+
|
|
9
|
+
// notice: only some combinations of size + font-weight are allowed (per design specs)
|
|
10
|
+
// see: https://www.figma.com/file/oQsMzMMnynfPWpMEt91OpH/HDS-Product---Foundations?node-id=1262%3A9192
|
|
11
|
+
|
|
12
|
+
export const DEFAULT_SIZE = '200';
|
|
13
|
+
export const AVAILABLE_SIZES = [300, 200, 100];
|
|
14
|
+
|
|
15
|
+
export const DEFAULT_WEIGHT = 'regular';
|
|
16
|
+
export const AVAILABLE_WEIGHTS_PER_SIZE = {
|
|
17
|
+
300: ['regular', 'medium', 'semibold'],
|
|
18
|
+
200: ['regular', 'medium', 'semibold'],
|
|
19
|
+
100: ['regular', 'medium', 'semibold'],
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default class HdsTextBodyComponent extends Component {
|
|
23
|
+
/**
|
|
24
|
+
* Sets the "size" for the text
|
|
25
|
+
* Accepted values: see AVAILABLE_SIZES
|
|
26
|
+
*
|
|
27
|
+
* @type {string}
|
|
28
|
+
*
|
|
29
|
+
* @param size
|
|
30
|
+
*/
|
|
31
|
+
get size() {
|
|
32
|
+
let { size = DEFAULT_SIZE } = this.args;
|
|
33
|
+
|
|
34
|
+
// let's be a bit forgiving with the consumers
|
|
35
|
+
if (typeof size === 'string') {
|
|
36
|
+
size = parseInt(size, 10);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
assert(
|
|
40
|
+
`@size for "Hds::Text::Body" must be one of the following: ${AVAILABLE_SIZES.join(
|
|
41
|
+
', '
|
|
42
|
+
)}; received: ${size}`,
|
|
43
|
+
AVAILABLE_SIZES.includes(size)
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return size;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Sets the "weight" for the text
|
|
51
|
+
* Accepted values: see AVAILABLE_WEIGHTS_PER_SIZE
|
|
52
|
+
*
|
|
53
|
+
* @type {string}
|
|
54
|
+
*
|
|
55
|
+
* @param variant
|
|
56
|
+
*/
|
|
57
|
+
get weight() {
|
|
58
|
+
let { weight = DEFAULT_WEIGHT } = this.args;
|
|
59
|
+
|
|
60
|
+
const availableWeights = AVAILABLE_WEIGHTS_PER_SIZE[this.size];
|
|
61
|
+
|
|
62
|
+
assert(
|
|
63
|
+
`@weight for "Hds::Text::Body" with @size=${
|
|
64
|
+
this.size
|
|
65
|
+
} must be one of the following: ${availableWeights.join(
|
|
66
|
+
', '
|
|
67
|
+
)}; received: ${weight}`,
|
|
68
|
+
availableWeights.includes(weight)
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
return weight;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{{!
|
|
2
|
+
Copyright (c) HashiCorp, Inc.
|
|
3
|
+
SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
}}
|
|
5
|
+
|
|
6
|
+
<Hds::Text
|
|
7
|
+
@group="code"
|
|
8
|
+
@size={{this.size}}
|
|
9
|
+
@weight={{this.weight}}
|
|
10
|
+
@align={{@align}}
|
|
11
|
+
@color={{@color}}
|
|
12
|
+
@tag={{@tag}}
|
|
13
|
+
...attributes
|
|
14
|
+
>{{yield}}</Hds::Text>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import Component from '@glimmer/component';
|
|
7
|
+
import { assert } from '@ember/debug';
|
|
8
|
+
|
|
9
|
+
// notice: only some combinations of size + font-weight are allowed (per design specs)
|
|
10
|
+
// see: https://www.figma.com/file/oQsMzMMnynfPWpMEt91OpH/HDS-Product---Foundations?node-id=1262%3A9192
|
|
11
|
+
|
|
12
|
+
export const DEFAULT_SIZE = '200';
|
|
13
|
+
export const AVAILABLE_SIZES = [300, 200, 100];
|
|
14
|
+
|
|
15
|
+
export const DEFAULT_WEIGHT = 'regular';
|
|
16
|
+
export const AVAILABLE_WEIGHTS_PER_SIZE = {
|
|
17
|
+
300: ['regular', 'bold'],
|
|
18
|
+
200: ['regular', 'bold'],
|
|
19
|
+
100: ['regular', 'bold'],
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default class HdsTextCodeComponent extends Component {
|
|
23
|
+
/**
|
|
24
|
+
* Sets the "size" for the text
|
|
25
|
+
* Accepted values: see AVAILABLE_SIZES
|
|
26
|
+
*
|
|
27
|
+
* @type {string}
|
|
28
|
+
*
|
|
29
|
+
* @param size
|
|
30
|
+
*/
|
|
31
|
+
get size() {
|
|
32
|
+
let { size = DEFAULT_SIZE } = this.args;
|
|
33
|
+
|
|
34
|
+
// let's be a bit forgiving with the consumers
|
|
35
|
+
if (typeof size === 'string') {
|
|
36
|
+
size = parseInt(size, 10);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
assert(
|
|
40
|
+
`@size for "Hds::Text::Code" must be one of the following: ${AVAILABLE_SIZES.join(
|
|
41
|
+
', '
|
|
42
|
+
)}; received: ${size}`,
|
|
43
|
+
AVAILABLE_SIZES.includes(size)
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return size;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Sets the "weight" for the text
|
|
51
|
+
* Accepted values: see AVAILABLE_WEIGHTS_PER_SIZE
|
|
52
|
+
*
|
|
53
|
+
* @type {string}
|
|
54
|
+
*
|
|
55
|
+
* @param variant
|
|
56
|
+
*/
|
|
57
|
+
get weight() {
|
|
58
|
+
let { weight = DEFAULT_WEIGHT } = this.args;
|
|
59
|
+
|
|
60
|
+
const availableWeights = AVAILABLE_WEIGHTS_PER_SIZE[this.size];
|
|
61
|
+
|
|
62
|
+
assert(
|
|
63
|
+
`@weight for "Hds::Text::Code" with @size=${
|
|
64
|
+
this.size
|
|
65
|
+
} must be one of the following: ${availableWeights.join(
|
|
66
|
+
', '
|
|
67
|
+
)}; received: ${weight}`,
|
|
68
|
+
availableWeights.includes(weight)
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
return weight;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{{!
|
|
2
|
+
Copyright (c) HashiCorp, Inc.
|
|
3
|
+
SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
}}
|
|
5
|
+
|
|
6
|
+
<Hds::Text
|
|
7
|
+
@group="display"
|
|
8
|
+
@size={{this.size}}
|
|
9
|
+
@weight={{this.weight}}
|
|
10
|
+
@align={{@align}}
|
|
11
|
+
@color={{@color}}
|
|
12
|
+
@tag={{@tag}}
|
|
13
|
+
...attributes
|
|
14
|
+
>{{yield}}</Hds::Text>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import Component from '@glimmer/component';
|
|
7
|
+
import { assert } from '@ember/debug';
|
|
8
|
+
|
|
9
|
+
// notice: only some combinations of size + font-weight are allowed (per design specs)
|
|
10
|
+
// see: https://www.figma.com/file/oQsMzMMnynfPWpMEt91OpH/HDS-Product---Foundations?node-id=1262%3A9192
|
|
11
|
+
|
|
12
|
+
export const DEFAULT_SIZE = '200';
|
|
13
|
+
export const AVAILABLE_SIZES = [500, 400, 300, 200, 100];
|
|
14
|
+
|
|
15
|
+
export const DEFAULT_WEIGHTS_PER_SIZE = {
|
|
16
|
+
500: ['bold'],
|
|
17
|
+
400: ['semibold'],
|
|
18
|
+
300: ['semibold'],
|
|
19
|
+
200: ['semibold'],
|
|
20
|
+
100: ['medium'],
|
|
21
|
+
};
|
|
22
|
+
export const AVAILABLE_WEIGHTS_PER_SIZE = {
|
|
23
|
+
500: ['bold'],
|
|
24
|
+
400: ['medium', 'semibold', 'bold'],
|
|
25
|
+
300: ['medium', 'semibold', 'bold'],
|
|
26
|
+
200: ['semibold'],
|
|
27
|
+
100: ['medium'],
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default class HdsTextDisplayComponent extends Component {
|
|
31
|
+
/**
|
|
32
|
+
* Sets the "size" for the text
|
|
33
|
+
* Accepted values: see AVAILABLE_SIZES
|
|
34
|
+
*
|
|
35
|
+
* @type {string}
|
|
36
|
+
*
|
|
37
|
+
* @param size
|
|
38
|
+
*/
|
|
39
|
+
get size() {
|
|
40
|
+
let { size = DEFAULT_SIZE } = this.args;
|
|
41
|
+
|
|
42
|
+
// let's be a bit forgiving with the consumers
|
|
43
|
+
if (typeof size === 'string') {
|
|
44
|
+
size = parseInt(size, 10);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
assert(
|
|
48
|
+
`@size for "Hds::Text::Display" must be one of the following: ${AVAILABLE_SIZES.join(
|
|
49
|
+
', '
|
|
50
|
+
)}; received: ${size}`,
|
|
51
|
+
AVAILABLE_SIZES.includes(size)
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
return size;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Sets the "weight" for the text
|
|
59
|
+
* Accepted values: see AVAILABLE_WEIGHTS_PER_SIZE
|
|
60
|
+
*
|
|
61
|
+
* @type {string}
|
|
62
|
+
*
|
|
63
|
+
* @param variant
|
|
64
|
+
*/
|
|
65
|
+
get weight() {
|
|
66
|
+
let { weight } = this.args;
|
|
67
|
+
|
|
68
|
+
if (weight) {
|
|
69
|
+
const availableWeights = AVAILABLE_WEIGHTS_PER_SIZE[this.size];
|
|
70
|
+
assert(
|
|
71
|
+
`@weight for "Hds::Text::Display" with @size=${
|
|
72
|
+
this.size
|
|
73
|
+
} must be one of the following: ${availableWeights.join(
|
|
74
|
+
', '
|
|
75
|
+
)}; received: ${weight}`,
|
|
76
|
+
availableWeights.includes(weight)
|
|
77
|
+
);
|
|
78
|
+
} else {
|
|
79
|
+
// use the default (first item in the array)
|
|
80
|
+
weight = DEFAULT_WEIGHTS_PER_SIZE[this.size];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return weight;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import Component from '@glimmer/component';
|
|
7
|
+
import { assert } from '@ember/debug';
|
|
8
|
+
|
|
9
|
+
export const AVAILABLE_ALIGNS = ['left', 'center', 'right'];
|
|
10
|
+
|
|
11
|
+
export const AVAILABLE_COLORS = [
|
|
12
|
+
'primary',
|
|
13
|
+
'strong',
|
|
14
|
+
'faint',
|
|
15
|
+
'disabled',
|
|
16
|
+
'high-contrast',
|
|
17
|
+
'action',
|
|
18
|
+
'action-hover',
|
|
19
|
+
'action-active',
|
|
20
|
+
'highlight',
|
|
21
|
+
'highlight-on-surface',
|
|
22
|
+
'highlight-high-contrast',
|
|
23
|
+
'success',
|
|
24
|
+
'success-on-surface',
|
|
25
|
+
'success-high-contrast',
|
|
26
|
+
'warning',
|
|
27
|
+
'warning-on-surface',
|
|
28
|
+
'warning-high-contrast',
|
|
29
|
+
'critical',
|
|
30
|
+
'critical-on-surface',
|
|
31
|
+
'critical-high-contrast',
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
export default class HdsTextIndexComponent extends Component {
|
|
35
|
+
/**
|
|
36
|
+
* Get a tag to render based on the `@tag` argument passed or the value of `this.size` (via mapping)
|
|
37
|
+
*
|
|
38
|
+
* @method #componentTag
|
|
39
|
+
* @return {string} The html tag to use in the dynamic render of the component
|
|
40
|
+
*/
|
|
41
|
+
get componentTag() {
|
|
42
|
+
let { tag = 'span' } = this.args;
|
|
43
|
+
|
|
44
|
+
return tag;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Sets the "variant" (style) for the text
|
|
49
|
+
* Accepted values: see AVAILABLE_VARIANTS
|
|
50
|
+
*
|
|
51
|
+
* @type {string}
|
|
52
|
+
*
|
|
53
|
+
* @param variant
|
|
54
|
+
*/
|
|
55
|
+
get variant() {
|
|
56
|
+
let { group, size } = this.args;
|
|
57
|
+
|
|
58
|
+
// notice: for performance reasons we don't do any other extra check on these values
|
|
59
|
+
// we assume they've already been validated by the "parent" components
|
|
60
|
+
return `${group}-${size}`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Sets the alignment of the text
|
|
65
|
+
* Accepted values: see AVAILABLE_ALIGNS
|
|
66
|
+
*
|
|
67
|
+
* @param align
|
|
68
|
+
* @type {string}
|
|
69
|
+
*/
|
|
70
|
+
get align() {
|
|
71
|
+
let { align } = this.args;
|
|
72
|
+
|
|
73
|
+
if (align) {
|
|
74
|
+
assert(
|
|
75
|
+
`@align for "Hds::Text" must be one of the following: ${AVAILABLE_ALIGNS.join(
|
|
76
|
+
', '
|
|
77
|
+
)}; received: ${align}`,
|
|
78
|
+
AVAILABLE_ALIGNS.includes(align)
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return align;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Sets the color of the text as pre-defined value
|
|
87
|
+
* Accepted values: see AVAILABLE_COLORS
|
|
88
|
+
*
|
|
89
|
+
* @param color
|
|
90
|
+
* @type {string}
|
|
91
|
+
*/
|
|
92
|
+
get predefinedColor() {
|
|
93
|
+
let { color } = this.args;
|
|
94
|
+
|
|
95
|
+
console.log(color, AVAILABLE_COLORS.includes(color));
|
|
96
|
+
|
|
97
|
+
if (AVAILABLE_COLORS.includes(color)) {
|
|
98
|
+
return color;
|
|
99
|
+
} else {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Sets the color of the text as custom value (via inline style)
|
|
106
|
+
*
|
|
107
|
+
* @param color
|
|
108
|
+
* @type {string}
|
|
109
|
+
*/
|
|
110
|
+
get customColor() {
|
|
111
|
+
let { color } = this.args;
|
|
112
|
+
|
|
113
|
+
if (!AVAILABLE_COLORS.includes(color)) {
|
|
114
|
+
return color;
|
|
115
|
+
} else {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Get the class names to apply to the component.
|
|
122
|
+
* @method #classNames
|
|
123
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
124
|
+
*/
|
|
125
|
+
get classNames() {
|
|
126
|
+
let classes = ['hds-text'];
|
|
127
|
+
|
|
128
|
+
// add a (helper) class based on the "group + size" variant
|
|
129
|
+
classes.push(`hds-typography-${this.variant}`);
|
|
130
|
+
|
|
131
|
+
// add a (helper) class based on the @weight argument
|
|
132
|
+
if (this.args.weight) {
|
|
133
|
+
classes.push(`hds-font-weight-${this.args.weight}`);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// add a class based on the @align argument
|
|
137
|
+
if (this.align) {
|
|
138
|
+
classes.push(`hds-text--align-${this.align}`);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// add a (helper) class based on the @color argument (if pre-defined)
|
|
142
|
+
if (this.predefinedColor) {
|
|
143
|
+
classes.push(`hds-foreground-${this.predefinedColor}`);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return classes.join(' ');
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
border-radius: 5px;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
//
|
|
67
|
-
a {
|
|
68
|
-
color: var(--token-color-foreground-
|
|
66
|
+
// Default styling for bare HTML links not using HDS::Link components
|
|
67
|
+
a:not([class*="hds-"]) {
|
|
68
|
+
color: var(--token-color-foreground-strong);
|
|
69
69
|
|
|
70
70
|
&:focus,
|
|
71
71
|
&:focus-visible {
|
|
@@ -75,11 +75,11 @@
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
&:hover {
|
|
78
|
-
color: var(--token-color-foreground-
|
|
78
|
+
color: var(--token-color-foreground-primary);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
&:active {
|
|
82
|
-
color: var(--token-color-foreground-
|
|
82
|
+
color: var(--token-color-foreground-faint);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -11,9 +11,13 @@ $hds-form-masked-input-button-size: 24px;
|
|
|
11
11
|
|
|
12
12
|
.hds-form-masked-input {
|
|
13
13
|
position: relative;
|
|
14
|
+
display: grid;
|
|
15
|
+
grid-template-areas: "input copy-button";
|
|
16
|
+
grid-template-columns: 1fr auto;
|
|
14
17
|
width: 100%;
|
|
15
18
|
|
|
16
19
|
.hds-form-masked-input__control {
|
|
20
|
+
grid-area: input;
|
|
17
21
|
padding-right: calc(var(--token-form-control-padding) + $hds-form-masked-input-button-size);
|
|
18
22
|
}
|
|
19
23
|
}
|
|
@@ -36,6 +40,7 @@ $hds-form-masked-input-button-size: 24px;
|
|
|
36
40
|
position: absolute;
|
|
37
41
|
top: calc(var(--token-form-control-padding) - var(--token-form-control-border-width));
|
|
38
42
|
right: calc(var(--token-form-control-padding) - var(--token-form-control-border-width));
|
|
43
|
+
grid-area: input;
|
|
39
44
|
width: $hds-form-masked-input-button-size;
|
|
40
45
|
height: $hds-form-masked-input-button-size;
|
|
41
46
|
padding: 2px;
|
|
@@ -44,3 +49,9 @@ $hds-form-masked-input-button-size: 24px;
|
|
|
44
49
|
border-color: transparent;
|
|
45
50
|
cursor: pointer;
|
|
46
51
|
}
|
|
52
|
+
|
|
53
|
+
.hds-form-masked-input__copy-button {
|
|
54
|
+
grid-area: copy-button;
|
|
55
|
+
align-self: flex-start;
|
|
56
|
+
margin-left: 8px;
|
|
57
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
//
|
|
7
|
+
// TEXT
|
|
8
|
+
//
|
|
9
|
+
|
|
10
|
+
// .hds-text {}
|
|
11
|
+
|
|
12
|
+
// ALIGNMENT
|
|
13
|
+
|
|
14
|
+
.hds-text--align-left {
|
|
15
|
+
text-align: left;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.hds-text--align-center {
|
|
19
|
+
text-align: center;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.hds-text--align-right {
|
|
23
|
+
text-align: right;
|
|
24
|
+
}
|
|
25
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashicorp/design-system-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "Helios Design System Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hashicorp",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@ember/render-modifiers": "^2.0.5",
|
|
43
43
|
"@ember/test-waiters": "^3.0.2",
|
|
44
44
|
"@hashicorp/design-system-tokens": "^1.7.0",
|
|
45
|
-
"@hashicorp/ember-flight-icons": "^3.1.
|
|
45
|
+
"@hashicorp/ember-flight-icons": "^3.1.1",
|
|
46
46
|
"dialog-polyfill": "^0.5.6",
|
|
47
47
|
"ember-a11y-refocus": "^3.0.2",
|
|
48
48
|
"ember-auto-import": "^2.6.3",
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"ember-composable-helpers": "^4.5.0",
|
|
55
55
|
"ember-focus-trap": "^1.0.2",
|
|
56
56
|
"ember-keyboard": "^8.2.0",
|
|
57
|
-
"ember-named-blocks-polyfill": "^0.2.5",
|
|
58
57
|
"ember-stargate": "^0.4.3",
|
|
59
58
|
"ember-style-modifier": "^3.0.1",
|
|
60
59
|
"ember-truth-helpers": "^3.1.1",
|