@hashicorp/design-system-components 2.15.0 → 3.0.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-FIGMA-COMPONENTS.md +177 -0
- package/CHANGELOG-FIGMA-FOUNDATIONS.md +2 -0
- package/CHANGELOG.md +359 -59
- package/README.md +1 -1
- package/addon/components/hds/accordion/item/index.hbs +16 -5
- package/addon/components/hds/application-state/body.hbs +2 -2
- package/addon/components/hds/application-state/header.hbs +4 -4
- package/addon/components/hds/button/{index.js → index.ts} +29 -4
- package/addon/components/hds/copy/button/index.hbs +1 -1
- package/addon/components/hds/copy/button/index.js +14 -2
- package/addon/components/hds/copy/snippet/index.hbs +3 -3
- package/addon/components/hds/copy/snippet/index.js +19 -2
- package/addon/components/hds/dropdown/index.js +0 -3
- package/addon/components/hds/dropdown/list-item/checkmark.hbs +9 -3
- package/addon/components/hds/dropdown/list-item/copy-item.hbs +8 -4
- package/addon/components/hds/dropdown/list-item/copy-item.js +13 -0
- package/addon/components/hds/dropdown/list-item/description.hbs +9 -2
- package/addon/components/hds/dropdown/list-item/description.js +0 -18
- package/addon/components/hds/dropdown/list-item/interactive.hbs +4 -4
- package/addon/components/hds/dropdown/list-item/radio.hbs +6 -1
- package/addon/components/hds/dropdown/list-item/title.hbs +9 -2
- package/addon/components/hds/dropdown/list-item/title.js +0 -18
- package/addon/components/hds/flyout/description.hbs +2 -2
- package/addon/components/hds/flyout/header.hbs +4 -4
- package/addon/components/hds/form/error/index.hbs +2 -2
- package/addon/components/hds/form/error/index.js +0 -3
- package/addon/components/hds/form/error/message.hbs +2 -2
- package/addon/components/hds/form/helper-text/index.hbs +10 -2
- package/addon/components/hds/form/helper-text/index.js +0 -3
- package/addon/components/hds/form/indicator/index.hbs +1 -1
- package/addon/components/hds/form/indicator/index.js +0 -3
- package/addon/components/hds/form/masked-input/base.hbs +8 -10
- package/addon/components/hds/form/masked-input/base.js +14 -14
- package/addon/components/hds/form/masked-input/field.hbs +3 -1
- package/addon/components/hds/form/radio-card/description.hbs +6 -1
- package/addon/components/hds/form/radio-card/group.hbs +1 -2
- package/addon/components/hds/form/radio-card/index.js +5 -33
- package/addon/components/hds/form/radio-card/label.hbs +7 -1
- package/addon/components/hds/form/text-input/base.js +5 -0
- package/addon/components/hds/form/text-input/field.hbs +23 -11
- package/addon/components/hds/form/text-input/field.js +59 -0
- package/addon/components/hds/form/visibility-toggle/index.hbs +8 -0
- package/addon/components/hds/interactive/{index.js → index.ts} +28 -3
- package/addon/components/hds/modal/header.hbs +4 -4
- package/addon/components/hds/page-header/description.hbs +7 -1
- package/addon/components/hds/page-header/subtitle.hbs +7 -1
- package/addon/components/hds/page-header/title.hbs +7 -1
- package/addon/components/hds/pagination/info/index.hbs +2 -2
- package/addon/components/hds/pagination/nav/arrow.hbs +16 -4
- package/addon/components/hds/pagination/nav/arrow.js +0 -2
- package/addon/components/hds/pagination/nav/number.hbs +2 -1
- package/addon/components/hds/pagination/nav/number.js +1 -6
- package/addon/components/hds/side-nav/list/index.hbs +2 -2
- package/addon/components/hds/stepper/step/indicator.hbs +6 -1
- package/addon/components/hds/tag/index.hbs +2 -2
- package/addon/modifiers/hds-clipboard.js +163 -0
- package/addon/template-registry.ts +12 -0
- package/app/components/hds/form/visibility-toggle/index.js +6 -0
- package/app/modifiers/hds-clipboard.js +6 -0
- package/app/styles/components/button.scss +2 -0
- package/app/styles/components/copy/snippet.scss +22 -14
- package/app/styles/components/dropdown.scss +2 -5
- package/app/styles/components/flyout.scss +0 -2
- package/app/styles/components/form/group.scss +5 -0
- package/app/styles/components/form/index.scss +1 -0
- package/app/styles/components/form/masked-input.scss +0 -9
- package/app/styles/components/form/radio-card.scss +2 -4
- package/app/styles/components/form/text-input.scss +17 -0
- package/app/styles/components/form/visibility-toggle.scss +23 -0
- package/app/styles/components/stepper/step-indicator.scss +0 -3
- package/app/styles/components/tag.scss +1 -5
- package/index.js +3 -0
- package/package.json +33 -4
- package/tsconfig.json +46 -0
- package/types/dummy/index.d.ts +6 -0
- package/types/global.d.ts +12 -0
|
@@ -5,15 +5,33 @@
|
|
|
5
5
|
|
|
6
6
|
import Component from '@glimmer/component';
|
|
7
7
|
import { assert } from '@ember/debug';
|
|
8
|
+
import { HdsInteractiveSignature } from '../interactive';
|
|
8
9
|
|
|
9
10
|
export const DEFAULT_SIZE = 'medium';
|
|
10
11
|
export const DEFAULT_COLOR = 'primary';
|
|
11
12
|
export const DEFAULT_ICONPOSITION = 'leading';
|
|
12
|
-
export const SIZES = ['small', 'medium', 'large'];
|
|
13
|
-
export const COLORS = ['primary', 'secondary', 'tertiary', 'critical'];
|
|
14
|
-
export const ICONPOSITIONS = ['leading', 'trailing'];
|
|
13
|
+
export const SIZES = ['small', 'medium', 'large'] as const;
|
|
14
|
+
export const COLORS = ['primary', 'secondary', 'tertiary', 'critical'] as const;
|
|
15
|
+
export const ICONPOSITIONS = ['leading', 'trailing'] as const;
|
|
16
|
+
|
|
17
|
+
export type HdsButtonSize = typeof SIZES[number];
|
|
18
|
+
export type HdsButtonColor = typeof COLORS[number];
|
|
19
|
+
export type HdsButtonIconPosition = typeof ICONPOSITIONS[number];
|
|
20
|
+
|
|
21
|
+
export interface HdsButtonSignature {
|
|
22
|
+
Args: HdsInteractiveSignature['Args'] & {
|
|
23
|
+
size?: HdsButtonSize;
|
|
24
|
+
color?: HdsButtonColor;
|
|
25
|
+
text: string;
|
|
26
|
+
icon?: string;
|
|
27
|
+
iconPosition?: HdsButtonIconPosition;
|
|
28
|
+
isIconOnly?: boolean;
|
|
29
|
+
isFullWidth?: boolean;
|
|
30
|
+
};
|
|
31
|
+
Element: HdsInteractiveSignature['Element'];
|
|
32
|
+
}
|
|
15
33
|
|
|
16
|
-
export default class HdsButtonIndexComponent extends Component {
|
|
34
|
+
export default class HdsButtonIndexComponent extends Component<HdsButtonSignature> {
|
|
17
35
|
/**
|
|
18
36
|
* @param text
|
|
19
37
|
* @type {string}
|
|
@@ -166,3 +184,10 @@ export default class HdsButtonIndexComponent extends Component {
|
|
|
166
184
|
return classes.join(' ');
|
|
167
185
|
}
|
|
168
186
|
}
|
|
187
|
+
|
|
188
|
+
declare module '@glint/environment-ember-loose/registry' {
|
|
189
|
+
export default interface Registry {
|
|
190
|
+
'Hds::Button': typeof HdsButtonIndexComponent;
|
|
191
|
+
'hds/button': typeof HdsButtonIndexComponent;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
@isIconOnly={{@isIconOnly}}
|
|
12
12
|
@color="secondary"
|
|
13
13
|
@iconPosition="trailing"
|
|
14
|
-
{{clipboard text=@textToCopy target=@targetToCopy
|
|
14
|
+
{{hds-clipboard text=@textToCopy target=@targetToCopy onSuccess=this.onSuccess onError=this.onError}}
|
|
15
15
|
...attributes
|
|
16
16
|
/>
|
|
@@ -70,15 +70,27 @@ export default class HdsCopyButtonComponent extends Component {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
@action
|
|
73
|
-
onSuccess() {
|
|
73
|
+
onSuccess(args) {
|
|
74
74
|
this.status = 'success';
|
|
75
75
|
this.resetStatusDelayed();
|
|
76
|
+
|
|
77
|
+
let { onSuccess } = this.args;
|
|
78
|
+
|
|
79
|
+
if (typeof onSuccess === 'function') {
|
|
80
|
+
onSuccess(args);
|
|
81
|
+
}
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
@action
|
|
79
|
-
onError() {
|
|
85
|
+
onError(args) {
|
|
80
86
|
this.status = 'error';
|
|
81
87
|
this.resetStatusDelayed();
|
|
88
|
+
|
|
89
|
+
let { onError } = this.args;
|
|
90
|
+
|
|
91
|
+
if (typeof onError === 'function') {
|
|
92
|
+
onError(args);
|
|
93
|
+
}
|
|
82
94
|
}
|
|
83
95
|
|
|
84
96
|
resetStatusDelayed() {
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
<button
|
|
6
6
|
type="button"
|
|
7
7
|
class={{this.classNames}}
|
|
8
|
-
{{clipboard text=@textToCopy
|
|
8
|
+
{{hds-clipboard text=@textToCopy onSuccess=this.onSuccess onError=this.onError}}
|
|
9
9
|
...attributes
|
|
10
10
|
>
|
|
11
|
-
<
|
|
11
|
+
<Hds::Text::Code class="hds-copy-snippet__text" @tag="span" @size="100">
|
|
12
12
|
{{@textToCopy}}
|
|
13
|
-
</
|
|
13
|
+
</Hds::Text::Code>
|
|
14
14
|
<FlightIcon @name={{this.icon}} class="hds-copy-snippet__icon" />
|
|
15
15
|
</button>
|
|
@@ -88,6 +88,11 @@ export default class HdsCopySnippetIndexComponent extends Component {
|
|
|
88
88
|
// add a class based on the tracked status (idle/success/error)
|
|
89
89
|
classes.push(`hds-copy-snippet--status-${this.status}`);
|
|
90
90
|
|
|
91
|
+
// add a class based on the @isTruncated argument
|
|
92
|
+
if (this.isTruncated) {
|
|
93
|
+
classes.push('hds-copy-snippet--is-truncated');
|
|
94
|
+
}
|
|
95
|
+
|
|
91
96
|
// add a class based on the @isFullWidth argument
|
|
92
97
|
if (this.isFullWidth) {
|
|
93
98
|
classes.push('hds-copy-snippet--width-full');
|
|
@@ -97,15 +102,27 @@ export default class HdsCopySnippetIndexComponent extends Component {
|
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
@action
|
|
100
|
-
onSuccess() {
|
|
105
|
+
onSuccess(args) {
|
|
101
106
|
this.status = 'success';
|
|
102
107
|
this.resetStatusDelayed();
|
|
108
|
+
|
|
109
|
+
let { onSuccess } = this.args;
|
|
110
|
+
|
|
111
|
+
if (typeof onSuccess === 'function') {
|
|
112
|
+
onSuccess(args);
|
|
113
|
+
}
|
|
103
114
|
}
|
|
104
115
|
|
|
105
116
|
@action
|
|
106
|
-
onError() {
|
|
117
|
+
onError(args) {
|
|
107
118
|
this.status = 'error';
|
|
108
119
|
this.resetStatusDelayed();
|
|
120
|
+
|
|
121
|
+
let { onError } = this.args;
|
|
122
|
+
|
|
123
|
+
if (typeof onError === 'function') {
|
|
124
|
+
onError(args);
|
|
125
|
+
}
|
|
109
126
|
}
|
|
110
127
|
|
|
111
128
|
resetStatusDelayed() {
|
|
@@ -8,10 +8,7 @@ import { action } from '@ember/object';
|
|
|
8
8
|
import { assert } from '@ember/debug';
|
|
9
9
|
|
|
10
10
|
export const DEFAULT_POSITION = 'bottom-right';
|
|
11
|
-
// TODO: retire 'right' and 'left' in favor of `bottom-right` and `bottom-left` https://github.com/hashicorp/design-system/pull/1262
|
|
12
11
|
export const POSITIONS = [
|
|
13
|
-
'right',
|
|
14
|
-
'left',
|
|
15
12
|
'bottom-left',
|
|
16
13
|
'bottom-right',
|
|
17
14
|
'top-left',
|
|
@@ -24,11 +24,17 @@
|
|
|
24
24
|
<FlightIcon @name={{@icon}} @isInlineBlock={{false}} />
|
|
25
25
|
</div>
|
|
26
26
|
{{/if}}
|
|
27
|
-
<div class="hds-dropdown-list-item__interactive-text
|
|
27
|
+
<Hds::Text::Body @tag="div" @size="200" @weight="medium" class="hds-dropdown-list-item__interactive-text">
|
|
28
28
|
{{yield}}
|
|
29
|
-
</
|
|
29
|
+
</Hds::Text::Body>
|
|
30
30
|
{{#if @count}}
|
|
31
|
-
<
|
|
31
|
+
<Hds::Text::Body
|
|
32
|
+
class="hds-dropdown-list-item__count"
|
|
33
|
+
@tag="span"
|
|
34
|
+
@size="100"
|
|
35
|
+
@weight="medium"
|
|
36
|
+
@color="faint"
|
|
37
|
+
>{{@count}}</Hds::Text::Body>
|
|
32
38
|
{{/if}}
|
|
33
39
|
<span class="hds-dropdown-list-item__checkmark">
|
|
34
40
|
{{#if @selected}}
|
|
@@ -4,9 +4,13 @@
|
|
|
4
4
|
}}
|
|
5
5
|
<li class={{this.classNames}} ...attributes>
|
|
6
6
|
{{#if @copyItemTitle}}
|
|
7
|
-
<
|
|
8
|
-
class="hds-dropdown-list-item__copy-item-title
|
|
9
|
-
|
|
7
|
+
<Hds::Text::Body
|
|
8
|
+
class="hds-dropdown-list-item__copy-item-title"
|
|
9
|
+
@tag="div"
|
|
10
|
+
@size="100"
|
|
11
|
+
@weight="semibold"
|
|
12
|
+
@color="faint"
|
|
13
|
+
>{{@copyItemTitle}}</Hds::Text::Body>
|
|
10
14
|
{{/if}}
|
|
11
|
-
<Hds::Copy::Snippet @textToCopy={{this.text}} @isTruncated={{
|
|
15
|
+
<Hds::Copy::Snippet @color="secondary" @textToCopy={{this.text}} @isTruncated={{this.isTruncated}} />
|
|
12
16
|
</li>
|
|
@@ -22,6 +22,19 @@ export default class HdsDropdownListItemCopyItemComponent extends Component {
|
|
|
22
22
|
|
|
23
23
|
return text;
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param isTruncated
|
|
28
|
+
* @type {boolean}
|
|
29
|
+
* @default true
|
|
30
|
+
* @description Indicates that the text should be truncated instead of wrapping and using multiple lines.
|
|
31
|
+
*/
|
|
32
|
+
get isTruncated() {
|
|
33
|
+
let { isTruncated = true } = this.args;
|
|
34
|
+
|
|
35
|
+
return isTruncated;
|
|
36
|
+
}
|
|
37
|
+
|
|
25
38
|
/**
|
|
26
39
|
* Get the class names to apply to the component.
|
|
27
40
|
* @method classNames
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
Copyright (c) HashiCorp, Inc.
|
|
3
3
|
SPDX-License-Identifier: MPL-2.0
|
|
4
4
|
}}
|
|
5
|
-
<
|
|
5
|
+
<Hds::Text::Body
|
|
6
|
+
class="hds-dropdown-list-item hds-dropdown-list-item--variant-description"
|
|
7
|
+
@tag="li"
|
|
8
|
+
@size="100"
|
|
9
|
+
@weight="regular"
|
|
10
|
+
@color="faint"
|
|
11
|
+
...attributes
|
|
12
|
+
>
|
|
6
13
|
{{this.text}}
|
|
7
|
-
</
|
|
14
|
+
</Hds::Text::Body>
|
|
@@ -22,22 +22,4 @@ export default class HdsDropdownListItemDescriptionComponent extends Component {
|
|
|
22
22
|
|
|
23
23
|
return text;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Get the class names to apply to the component.
|
|
28
|
-
* @method classNames
|
|
29
|
-
* @return {string} The "class" attribute to apply to the component.
|
|
30
|
-
*/
|
|
31
|
-
get classNames() {
|
|
32
|
-
let classes = [
|
|
33
|
-
'hds-dropdown-list-item',
|
|
34
|
-
'hds-dropdown-list-item--variant-description',
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
// add classes for the typographic style
|
|
38
|
-
classes.push('hds-typography-body-100');
|
|
39
|
-
classes.push('hds-font-weight-regular');
|
|
40
|
-
|
|
41
|
-
return classes.join(' ');
|
|
42
|
-
}
|
|
43
25
|
}
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
<div class="hds-dropdown-list-item__interactive-icon">
|
|
9
9
|
<FlightIcon @name="loading" @isInlineBlock={{false}} />
|
|
10
10
|
</div>
|
|
11
|
-
<div class="hds-dropdown-list-item__interactive-text
|
|
11
|
+
<Hds::Text::Body @tag="div" @size="100" @weight="regular" class="hds-dropdown-list-item__interactive-text">
|
|
12
12
|
{{this.text}}
|
|
13
|
-
</
|
|
13
|
+
</Hds::Text::Body>
|
|
14
14
|
</div>
|
|
15
15
|
{{else}}
|
|
16
16
|
<Hds::Interactive
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
<FlightIcon @name={{@icon}} @isInlineBlock={{false}} />
|
|
30
30
|
</div>
|
|
31
31
|
{{/if}}
|
|
32
|
-
<
|
|
32
|
+
<Hds::Text::Body class="hds-dropdown-list-item__interactive-text" @tag="div" @size="200" @weight="medium">
|
|
33
33
|
{{this.text}}
|
|
34
|
-
</
|
|
34
|
+
</Hds::Text::Body>
|
|
35
35
|
</Hds::Interactive>
|
|
36
36
|
{{/if}}
|
|
37
37
|
</li>
|
|
@@ -14,7 +14,12 @@
|
|
|
14
14
|
<span class="hds-dropdown-list-item__text-content">{{yield}}</span>
|
|
15
15
|
|
|
16
16
|
{{#if @count}}
|
|
17
|
-
<
|
|
17
|
+
<Hds::Text::Body
|
|
18
|
+
class="hds-dropdown-list-item__count"
|
|
19
|
+
@tag="span"
|
|
20
|
+
@size="100"
|
|
21
|
+
@weight="medium"
|
|
22
|
+
>{{@count}}</Hds::Text::Body>
|
|
18
23
|
{{/if}}
|
|
19
24
|
</label>
|
|
20
25
|
</li>
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
Copyright (c) HashiCorp, Inc.
|
|
3
3
|
SPDX-License-Identifier: MPL-2.0
|
|
4
4
|
}}
|
|
5
|
-
<
|
|
5
|
+
<Hds::Text::Body
|
|
6
|
+
class="hds-dropdown-list-item hds-dropdown-list-item--variant-title"
|
|
7
|
+
@tag="li"
|
|
8
|
+
@size="100"
|
|
9
|
+
@weight="semibold"
|
|
10
|
+
@color="strong"
|
|
11
|
+
...attributes
|
|
12
|
+
>
|
|
6
13
|
{{this.text}}
|
|
7
|
-
</
|
|
14
|
+
</Hds::Text::Body>
|
|
@@ -22,22 +22,4 @@ export default class HdsDropdownListItemTitleComponent extends Component {
|
|
|
22
22
|
|
|
23
23
|
return text;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Get the class names to apply to the component.
|
|
28
|
-
* @method classNames
|
|
29
|
-
* @return {string} The "class" attribute to apply to the component.
|
|
30
|
-
*/
|
|
31
|
-
get classNames() {
|
|
32
|
-
let classes = [
|
|
33
|
-
'hds-dropdown-list-item',
|
|
34
|
-
'hds-dropdown-list-item--variant-title',
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
// add classes for the typographic style
|
|
38
|
-
classes.push('hds-typography-body-100');
|
|
39
|
-
classes.push('hds-font-weight-semibold');
|
|
40
|
-
|
|
41
|
-
return classes.join(' ');
|
|
42
|
-
}
|
|
43
25
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Copyright (c) HashiCorp, Inc.
|
|
3
3
|
SPDX-License-Identifier: MPL-2.0
|
|
4
4
|
}}
|
|
5
|
-
<
|
|
5
|
+
<Hds::Text::Body class="hds-flyout__description" @tag="div" @size="200" @color="primary" ...attributes>
|
|
6
6
|
{{yield}}
|
|
7
|
-
</
|
|
7
|
+
</Hds::Text::Body>
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
{{#if @icon}}
|
|
7
7
|
<FlightIcon class="hds-flyout__icon" @name={{@icon}} @size="24" @isInlineBlock={{false}} />
|
|
8
8
|
{{/if}}
|
|
9
|
-
<
|
|
9
|
+
<Hds::Text::Display class="hds-flyout__title" @tag="div" @size="300" @weight="semibold" id={{@id}}>
|
|
10
10
|
{{#if @tagline}}
|
|
11
|
-
<
|
|
11
|
+
<Hds::Text::Body class="hds-flyout__tagline" @tag="div" @size="100" @weight="regular" @color="faint">
|
|
12
12
|
{{@tagline}}
|
|
13
|
-
</
|
|
13
|
+
</Hds::Text::Body>
|
|
14
14
|
{{/if}}
|
|
15
15
|
{{yield}}
|
|
16
|
-
</
|
|
16
|
+
</Hds::Text::Display>
|
|
17
17
|
<Hds::DismissButton class="hds-flyout__dismiss" {{on "click" @onDismiss}} />
|
|
18
18
|
</div>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
}}
|
|
5
5
|
<div class={{this.classNames}} id={{this.id}} {{did-insert this.onInsert}} ...attributes>
|
|
6
6
|
<FlightIcon class="hds-form-error__icon" @name="alert-diamond-fill" />
|
|
7
|
-
<
|
|
7
|
+
<Hds::Text::Body class="hds-form-error__content" @tag="div" @size="100" @weight="medium">
|
|
8
8
|
{{yield (hash Message=(component "hds/form/error/message"))}}
|
|
9
|
-
</
|
|
9
|
+
</Hds::Text::Body>
|
|
10
10
|
</div>
|
|
@@ -46,9 +46,6 @@ export default class HdsFormErrorIndexComponent extends Component {
|
|
|
46
46
|
get classNames() {
|
|
47
47
|
let classes = ['hds-form-error'];
|
|
48
48
|
|
|
49
|
-
// add typographic classes
|
|
50
|
-
classes.push('hds-typography-body-100', 'hds-font-weight-medium');
|
|
51
|
-
|
|
52
49
|
// add a class based on the @contextualClass argument
|
|
53
50
|
// notice: this will *not* be documented for public use
|
|
54
51
|
// the reason for this is that the contextual component declarations don't pass attributes to the component
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
Copyright (c) HashiCorp, Inc.
|
|
3
3
|
SPDX-License-Identifier: MPL-2.0
|
|
4
4
|
}}
|
|
5
|
-
<
|
|
5
|
+
<Hds::Text::Body
|
|
6
|
+
class={{this.classNames}}
|
|
7
|
+
@tag="div"
|
|
8
|
+
@size="100"
|
|
9
|
+
@weight="regular"
|
|
10
|
+
id={{this.id}}
|
|
11
|
+
{{did-insert this.onInsert}}
|
|
12
|
+
...attributes
|
|
13
|
+
>
|
|
6
14
|
{{yield}}
|
|
7
|
-
</
|
|
15
|
+
</Hds::Text::Body>
|
|
@@ -46,9 +46,6 @@ export default class HdsFormHelperTextIndexComponent extends Component {
|
|
|
46
46
|
get classNames() {
|
|
47
47
|
let classes = ['hds-form-helper-text'];
|
|
48
48
|
|
|
49
|
-
// add typographic classes
|
|
50
|
-
classes.push('hds-typography-body-100', 'hds-font-weight-regular');
|
|
51
|
-
|
|
52
49
|
// add a class based on the @contextualClass argument
|
|
53
50
|
// notice: this will *not* be documented for public use
|
|
54
51
|
// the reason for this is that the contextual component declarations don't pass attributes to the component
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
SPDX-License-Identifier: MPL-2.0
|
|
4
4
|
}}
|
|
5
5
|
{{#if @isOptional}}
|
|
6
|
-
<
|
|
6
|
+
<Hds::Text::Body class={{this.classNames}} tag="span" @size="100" @weight="regular">(Optional)</Hds::Text::Body>
|
|
7
7
|
{{/if}}
|
|
8
8
|
{{#if @isRequired}}
|
|
9
9
|
<Hds::Badge aria-hidden="true" class={{this.classNames}} @size="small" @color="neutral" @text="Required" />
|
|
@@ -17,9 +17,6 @@ export default class HdsFormIndicatorIndexComponent extends Component {
|
|
|
17
17
|
if (this.args.isOptional) {
|
|
18
18
|
// add speficic class for "optional" indicator
|
|
19
19
|
classes.push('hds-form-indicator--optional');
|
|
20
|
-
|
|
21
|
-
// add typographic classes
|
|
22
|
-
classes.push('hds-typography-body-100', 'hds-font-weight-regular');
|
|
23
20
|
}
|
|
24
21
|
|
|
25
22
|
return classes.join(' ');
|
|
@@ -21,22 +21,20 @@
|
|
|
21
21
|
...attributes
|
|
22
22
|
/>
|
|
23
23
|
{{/if}}
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
<Hds::Form::VisibilityToggle
|
|
25
|
+
@isVisible={{this.isContentMasked}}
|
|
26
|
+
@ariaLabel={{this.visibilityToggleAriaLabel}}
|
|
27
|
+
@ariaMessageText={{this.visibilityToggleAriaMessageText}}
|
|
28
28
|
aria-controls={{this.id}}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<span class="sr-only" aria-live="polite">{{this.ariaMessageText}}</span>
|
|
33
|
-
</button>
|
|
29
|
+
class="hds-form-masked-input__toggle-button"
|
|
30
|
+
{{on "click" this.onClickToggleMasking}}
|
|
31
|
+
/>
|
|
34
32
|
{{#if @hasCopyButton}}
|
|
35
33
|
<Hds::Copy::Button
|
|
36
34
|
class="hds-form-masked-input__copy-button"
|
|
37
35
|
@text={{this.copyButtonText}}
|
|
38
36
|
@isIconOnly={{true}}
|
|
39
|
-
@
|
|
37
|
+
@targetToCopy="#{{this.id}}"
|
|
40
38
|
/>
|
|
41
39
|
{{/if}}
|
|
42
40
|
</div>
|
|
@@ -9,11 +9,11 @@ import { action } from '@ember/object';
|
|
|
9
9
|
import { getElementId } from '@hashicorp/design-system-components/utils/hds-get-element-id';
|
|
10
10
|
|
|
11
11
|
export default class HdsFormMaskedInputBaseComponent extends Component {
|
|
12
|
-
@tracked
|
|
12
|
+
@tracked isContentMasked = this.args.isContentMasked ?? true;
|
|
13
13
|
|
|
14
14
|
@action
|
|
15
|
-
|
|
16
|
-
this.
|
|
15
|
+
onClickToggleMasking() {
|
|
16
|
+
this.isContentMasked = !this.isContentMasked;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -28,10 +28,10 @@ export default class HdsFormMaskedInputBaseComponent extends Component {
|
|
|
28
28
|
* @type {string}
|
|
29
29
|
* @default 'Show masked content'
|
|
30
30
|
*/
|
|
31
|
-
get
|
|
32
|
-
if (this.args.
|
|
33
|
-
return this.args.
|
|
34
|
-
} else if (this.
|
|
31
|
+
get visibilityToggleAriaLabel() {
|
|
32
|
+
if (this.args.visibilityToggleAriaLabel) {
|
|
33
|
+
return this.args.visibilityToggleAriaLabel;
|
|
34
|
+
} else if (this.isContentMasked) {
|
|
35
35
|
return 'Show masked content';
|
|
36
36
|
} else {
|
|
37
37
|
return 'Hide masked content';
|
|
@@ -43,13 +43,13 @@ export default class HdsFormMaskedInputBaseComponent extends Component {
|
|
|
43
43
|
* @type {string}
|
|
44
44
|
* @default 'Input content is now hidden'
|
|
45
45
|
*/
|
|
46
|
-
get
|
|
47
|
-
if (this.args.
|
|
48
|
-
return this.args.
|
|
49
|
-
} else if (this.
|
|
50
|
-
return 'Input content is
|
|
46
|
+
get visibilityToggleAriaMessageText() {
|
|
47
|
+
if (this.args.visibilityToggleAriaMessageText) {
|
|
48
|
+
return this.args.visibilityToggleAriaMessageText;
|
|
49
|
+
} else if (this.isContentMasked) {
|
|
50
|
+
return 'Input content is hidden';
|
|
51
51
|
} else {
|
|
52
|
-
return 'Input content is
|
|
52
|
+
return 'Input content is visible';
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -74,7 +74,7 @@ export default class HdsFormMaskedInputBaseComponent extends Component {
|
|
|
74
74
|
get classNames() {
|
|
75
75
|
let classes = ['hds-form-masked-input'];
|
|
76
76
|
|
|
77
|
-
if (this.
|
|
77
|
+
if (this.isContentMasked) {
|
|
78
78
|
classes.push(`hds-form-masked-input--is-masked`);
|
|
79
79
|
} else {
|
|
80
80
|
classes.push(`hds-form-masked-input--is-not-masked`);
|
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
<Hds::Form::MaskedInput::Base
|
|
18
18
|
@hasCopyButton={{@hasCopyButton}}
|
|
19
19
|
@isMultiline={{@isMultiline}}
|
|
20
|
-
@
|
|
20
|
+
@isContentMasked={{@isContentMasked}}
|
|
21
|
+
@visibilityToggleAriaLabel={{@visibilityToggleAriaLabel}}
|
|
22
|
+
@visibilityToggleAriaMessageText={{@visibilityToggleAriaMessageText}}
|
|
21
23
|
@value={{@value}}
|
|
22
24
|
@isInvalid={{@isInvalid}}
|
|
23
25
|
@width={{@width}}
|
|
@@ -2,4 +2,9 @@
|
|
|
2
2
|
Copyright (c) HashiCorp, Inc.
|
|
3
3
|
SPDX-License-Identifier: MPL-2.0
|
|
4
4
|
}}
|
|
5
|
-
<
|
|
5
|
+
<Hds::Text::Body
|
|
6
|
+
class="hds-form-radio-card__description"
|
|
7
|
+
@tag="span"
|
|
8
|
+
@size="100"
|
|
9
|
+
...attributes
|
|
10
|
+
>{{yield}}</Hds::Text::Body>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
}}
|
|
5
5
|
<Hds::Form::Fieldset
|
|
6
6
|
class="hds-form-group--radio-cards"
|
|
7
|
-
@layout="horizontal"
|
|
7
|
+
@layout={{if (eq @layout "vertical") "vertical" "horizontal"}}
|
|
8
8
|
@name={{@name}}
|
|
9
9
|
@isRequired={{@isRequired}}
|
|
10
10
|
@isOptional={{@isOptional}}
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
name=@name
|
|
23
23
|
alignment=@alignment
|
|
24
24
|
controlPosition=@controlPosition
|
|
25
|
-
layout=@layout
|
|
26
25
|
extraAriaDescribedBy=F.ariaDescribedBy
|
|
27
26
|
)
|
|
28
27
|
)
|
|
@@ -12,10 +12,8 @@ import { setAriaDescribedBy } from '@hashicorp/design-system-components/utils/hd
|
|
|
12
12
|
|
|
13
13
|
export const DEFAULT_CONTROL_POSITION = 'bottom';
|
|
14
14
|
export const DEFAULT_ALIGNMENT = 'left';
|
|
15
|
-
export const DEFAULT_LAYOUT = 'fluid';
|
|
16
15
|
export const CONTROL_POSITIONS = ['bottom', 'left'];
|
|
17
16
|
export const ALIGNMENTS = ['left', 'center'];
|
|
18
|
-
export const LAYOUTS = ['fluid', 'fixed'];
|
|
19
17
|
|
|
20
18
|
export default class HdsFormRadioCardIndexComponent extends Component {
|
|
21
19
|
@tracked ariaDescribedBy = this.args.extraAriaDescribedBy;
|
|
@@ -71,34 +69,6 @@ export default class HdsFormRadioCardIndexComponent extends Component {
|
|
|
71
69
|
return alignment;
|
|
72
70
|
}
|
|
73
71
|
|
|
74
|
-
/**
|
|
75
|
-
* Sets the layout of the card within the group
|
|
76
|
-
* Accepted values: fluid, fixed
|
|
77
|
-
*
|
|
78
|
-
* @param layout
|
|
79
|
-
* @type {string}
|
|
80
|
-
* @default 'fluid'
|
|
81
|
-
*/
|
|
82
|
-
get layout() {
|
|
83
|
-
let { layout = DEFAULT_LAYOUT } = this.args;
|
|
84
|
-
|
|
85
|
-
assert(
|
|
86
|
-
`@layout for "Hds::Form::RadioCard" must be one of the following: ${LAYOUTS.join(
|
|
87
|
-
', '
|
|
88
|
-
)}; received: ${layout}`,
|
|
89
|
-
LAYOUTS.includes(layout)
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
// if the `@layout` is set to 'fixed' we need a `@maxWidth` value to constrain the card to
|
|
93
|
-
if (layout === 'fixed') {
|
|
94
|
-
assert(
|
|
95
|
-
`@maxWidth for "Hds::Form::RadioCard" with @layout "fixed" is required`,
|
|
96
|
-
this.args.maxWidth
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
return layout;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
72
|
/**
|
|
103
73
|
* Get the class names to apply to the component.
|
|
104
74
|
* @method classNames
|
|
@@ -113,6 +83,11 @@ export default class HdsFormRadioCardIndexComponent extends Component {
|
|
|
113
83
|
if (this.args.disabled) {
|
|
114
84
|
classes.push('hds-form-radio-card--disabled');
|
|
115
85
|
}
|
|
86
|
+
if (this.args.maxWidth) {
|
|
87
|
+
classes.push('hds-form-radio-card--has-fixed-width');
|
|
88
|
+
} else {
|
|
89
|
+
classes.push('hds-form-radio-card--has-fluid-width');
|
|
90
|
+
}
|
|
116
91
|
|
|
117
92
|
// add a class based on the @controlPosition argument
|
|
118
93
|
classes.push(`hds-form-radio-card--control-${this.controlPosition}`);
|
|
@@ -120,9 +95,6 @@ export default class HdsFormRadioCardIndexComponent extends Component {
|
|
|
120
95
|
// add a class based on the @alignment argument
|
|
121
96
|
classes.push(`hds-form-radio-card--align-${this.alignment}`);
|
|
122
97
|
|
|
123
|
-
// add a class based on the @layout argument
|
|
124
|
-
classes.push(`hds-form-radio-card--layout-${this.layout}`);
|
|
125
|
-
|
|
126
98
|
return classes.join(' ');
|
|
127
99
|
}
|
|
128
100
|
}
|