@hashicorp/design-system-components 0.12.8 → 0.12.11
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 +22 -0
- package/addon/components/hds/alert/index.hbs +9 -2
- package/addon/components/hds/alert/index.js +21 -2
- package/addon/components/hds/card/container.js +65 -5
- package/addon/components/hds/form/checkbox/base.hbs +1 -1
- package/addon/components/hds/form/checkbox/field.hbs +1 -1
- package/addon/components/hds/form/checkbox/group.hbs +8 -3
- package/addon/components/hds/form/field/index.hbs +11 -1
- package/addon/components/hds/form/field/index.js +18 -0
- package/addon/components/hds/form/fieldset/index.hbs +7 -1
- package/addon/components/hds/form/fieldset/index.js +18 -0
- package/addon/components/hds/form/indicator/index.hbs +6 -0
- package/addon/components/hds/form/label/index.hbs +1 -0
- package/addon/components/hds/form/legend/index.hbs +1 -0
- package/addon/components/hds/form/radio/base.hbs +1 -1
- package/addon/components/hds/form/radio/field.hbs +1 -1
- package/addon/components/hds/form/radio/group.hbs +10 -3
- package/addon/components/hds/form/select/field.hbs +10 -2
- package/addon/components/hds/form/text-input/field.hbs +10 -2
- package/addon/components/hds/form/textarea/base.hbs +1 -1
- package/addon/components/hds/form/textarea/field.hbs +11 -2
- package/addon/components/hds/form/toggle/base.js +0 -5
- package/addon/components/hds/form/toggle/field.hbs +1 -1
- package/addon/components/hds/form/toggle/group.hbs +14 -0
- package/app/components/hds/form/indicator/index.js +1 -0
- package/app/components/hds/form/toggle/group.js +1 -0
- package/app/styles/components/badge-count.scss +1 -0
- package/app/styles/components/badge.scss +2 -1
- package/app/styles/components/button.scss +16 -0
- package/app/styles/components/card/container.scss +25 -0
- package/app/styles/components/form/_tokens.scss +41 -0
- package/app/styles/components/form/checkbox.scss +28 -41
- package/app/styles/components/form/error.scss +1 -1
- package/app/styles/components/form/group.scss +2 -2
- package/app/styles/components/form/helper-text.scss +1 -1
- package/app/styles/components/form/index.scss +3 -0
- package/app/styles/components/form/indicator.scss +15 -0
- package/app/styles/components/form/label.scss +9 -1
- package/app/styles/components/form/legend.scss +9 -1
- package/app/styles/components/form/radio.scss +25 -42
- package/app/styles/components/form/select.scss +24 -12
- package/app/styles/components/form/text-input.scss +21 -22
- package/app/styles/components/form/textarea.scss +18 -20
- package/app/styles/components/form/toggle.scss +21 -36
- package/package.json +2 -2
- package/addon/components/hds/form/checkbox/base.js +0 -19
- package/addon/components/hds/form/radio/base.js +0 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @hashicorp/design-system-components
|
|
2
2
|
|
|
3
|
+
## 0.12.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#426](https://github.com/hashicorp/design-system/pull/426) [`ff236b25`](https://github.com/hashicorp/design-system/commit/ff236b2530dae122c011abf88baf2059a7871427) Thanks [@didoo](https://github.com/didoo)! - Updated font-weight to "medium" for "Badge" and "BadgeCount" components
|
|
8
|
+
|
|
9
|
+
## 0.12.10
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#428](https://github.com/hashicorp/design-system/pull/428) [`599dca97`](https://github.com/hashicorp/design-system/commit/599dca971fba57b613f9a17588ebe0e569aafe4c) Thanks [@didoo](https://github.com/didoo)! - Fixed issue with "disabled" visual state for "Hds::Button" when is a link
|
|
14
|
+
|
|
15
|
+
## 0.12.9
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#418](https://github.com/hashicorp/design-system/pull/418) [`981e2bd9`](https://github.com/hashicorp/design-system/commit/981e2bd99d29398a40274d390d1885ebfcd85133) Thanks [@alex-ju](https://github.com/alex-ju)! - Determine an accessible name for `alertdialog` alerts #418
|
|
20
|
+
|
|
21
|
+
* [#416](https://github.com/hashicorp/design-system/pull/416) [`824e53d1`](https://github.com/hashicorp/design-system/commit/824e53d11678a5bb2544add3d9d1b2a93f9c42c1) Thanks [@alex-ju](https://github.com/alex-ju)! - Remove stray aria-describedby in alert component
|
|
22
|
+
|
|
23
|
+
- [#415](https://github.com/hashicorp/design-system/pull/415) [`c6842109`](https://github.com/hashicorp/design-system/commit/c68421094991b2d62832cb346b4cf23eca1049e4) Thanks [@didoo](https://github.com/didoo)! - Added `@levelHover` and `@levelActive` arguments to `Card::Container` component
|
|
24
|
+
|
|
3
25
|
## 0.12.8
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
<div
|
|
1
|
+
<div
|
|
2
|
+
class={{this.classNames}}
|
|
3
|
+
role={{this.role}}
|
|
4
|
+
aria-live="polite"
|
|
5
|
+
aria-labelledby={{this.ariaLabelledBy}}
|
|
6
|
+
{{did-insert this.didInsert}}
|
|
7
|
+
...attributes
|
|
8
|
+
>
|
|
2
9
|
{{#if this.icon}}
|
|
3
10
|
<div class="hds-alert__icon">
|
|
4
11
|
<FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} @isInlineBlock={{false}} />
|
|
5
12
|
</div>
|
|
6
13
|
{{/if}}
|
|
7
14
|
|
|
8
|
-
<div class="hds-alert__content"
|
|
15
|
+
<div class="hds-alert__content">
|
|
9
16
|
<div class="hds-alert__text">
|
|
10
17
|
{{yield (hash Title=(component "hds/alert/title"))}}
|
|
11
18
|
{{yield (hash Description=(component "hds/alert/description"))}}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { action } from '@ember/object';
|
|
3
3
|
import { assert } from '@ember/debug';
|
|
4
|
+
import { guidFor } from '@ember/object/internals';
|
|
4
5
|
import { tracked } from '@glimmer/tracking';
|
|
5
6
|
|
|
6
7
|
export const TYPES = ['page', 'inline', 'compact'];
|
|
@@ -20,8 +21,13 @@ export const MAPPING_COLORS_TO_ICONS = {
|
|
|
20
21
|
critical: 'alert-diamond',
|
|
21
22
|
};
|
|
22
23
|
|
|
24
|
+
const CONTENT_ELEMENT_SELECTOR = '.hds-alert__content';
|
|
25
|
+
const TITLE_ELEMENT_SELECTOR = '.hds-alert__title';
|
|
26
|
+
const DESCRIPTION_ELEMENT_SELECTOR = '.hds-alert__description';
|
|
27
|
+
|
|
23
28
|
export default class HdsAlertIndexComponent extends Component {
|
|
24
29
|
@tracked role = 'alert';
|
|
30
|
+
@tracked ariaLabelledBy;
|
|
25
31
|
|
|
26
32
|
constructor() {
|
|
27
33
|
super(...arguments);
|
|
@@ -131,10 +137,23 @@ export default class HdsAlertIndexComponent extends Component {
|
|
|
131
137
|
}
|
|
132
138
|
|
|
133
139
|
@action
|
|
134
|
-
|
|
135
|
-
let actions = element.querySelectorAll(
|
|
140
|
+
didInsert(element) {
|
|
141
|
+
let actions = element.querySelectorAll(
|
|
142
|
+
`${CONTENT_ELEMENT_SELECTOR} button, ${CONTENT_ELEMENT_SELECTOR} a`
|
|
143
|
+
);
|
|
136
144
|
if (actions.length) {
|
|
137
145
|
this.role = 'alertdialog';
|
|
138
146
|
}
|
|
147
|
+
|
|
148
|
+
// `alertdialog` must have an accessible name so we use either the
|
|
149
|
+
// title or the description as label for the alert
|
|
150
|
+
let label =
|
|
151
|
+
element.querySelector(TITLE_ELEMENT_SELECTOR) ||
|
|
152
|
+
element.querySelector(DESCRIPTION_ELEMENT_SELECTOR);
|
|
153
|
+
if (label) {
|
|
154
|
+
let labelId = label.getAttribute('id') || guidFor(element);
|
|
155
|
+
label.setAttribute('id', labelId);
|
|
156
|
+
this.ariaLabelledBy = labelId;
|
|
157
|
+
}
|
|
139
158
|
}
|
|
140
159
|
}
|
|
@@ -21,7 +21,7 @@ export default class HdsCardContainerComponent extends Component {
|
|
|
21
21
|
let { level = DEFAULT_LEVEL } = this.args;
|
|
22
22
|
|
|
23
23
|
assert(
|
|
24
|
-
`@level for "Hds::
|
|
24
|
+
`@level for "Hds::Card::Container" must be one of the following: ${LEVELS.join(
|
|
25
25
|
', '
|
|
26
26
|
)}, received: ${level}`,
|
|
27
27
|
LEVELS.includes(level)
|
|
@@ -30,6 +30,50 @@ export default class HdsCardContainerComponent extends Component {
|
|
|
30
30
|
return level;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Sets the "elevation" level for the component on ":hover" state
|
|
35
|
+
* Accepted values: base, mid, high
|
|
36
|
+
*
|
|
37
|
+
* @param levelHover
|
|
38
|
+
* @type {string}
|
|
39
|
+
*/
|
|
40
|
+
get levelHover() {
|
|
41
|
+
let { levelHover } = this.args;
|
|
42
|
+
|
|
43
|
+
if (levelHover) {
|
|
44
|
+
assert(
|
|
45
|
+
`@levelHover for "Hds::Card::Container" must be one of the following: ${LEVELS.join(
|
|
46
|
+
', '
|
|
47
|
+
)}, received: ${levelHover}`,
|
|
48
|
+
LEVELS.includes(levelHover)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return levelHover;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Sets the "elevation" level for the component on ":active" state
|
|
57
|
+
* Accepted values: base, mid, high
|
|
58
|
+
*
|
|
59
|
+
* @param levelActive
|
|
60
|
+
* @type {string}
|
|
61
|
+
*/
|
|
62
|
+
get levelActive() {
|
|
63
|
+
let { levelActive } = this.args;
|
|
64
|
+
|
|
65
|
+
if (levelActive) {
|
|
66
|
+
assert(
|
|
67
|
+
`@levelActive for "Hds::Card::Container" must be one of the following: ${LEVELS.join(
|
|
68
|
+
', '
|
|
69
|
+
)}, received: ${levelActive}`,
|
|
70
|
+
LEVELS.includes(levelActive)
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return levelActive;
|
|
75
|
+
}
|
|
76
|
+
|
|
33
77
|
/**
|
|
34
78
|
* Sets the background for the component
|
|
35
79
|
* Accepted values: neutral-primary, neutral-secondary
|
|
@@ -42,7 +86,7 @@ export default class HdsCardContainerComponent extends Component {
|
|
|
42
86
|
let { background = DEFAULT_BACKGROUND } = this.args;
|
|
43
87
|
|
|
44
88
|
assert(
|
|
45
|
-
`@background for "Hds::
|
|
89
|
+
`@background for "Hds::Card::Container" must be one of the following: ${BACKGROUNDS.join(
|
|
46
90
|
', '
|
|
47
91
|
)}, received: ${background}`,
|
|
48
92
|
BACKGROUNDS.includes(background)
|
|
@@ -63,7 +107,7 @@ export default class HdsCardContainerComponent extends Component {
|
|
|
63
107
|
let { overflow = DEFAULT_OVERFLOW } = this.args;
|
|
64
108
|
|
|
65
109
|
assert(
|
|
66
|
-
`@overflow for "Hds::
|
|
110
|
+
`@overflow for "Hds::Card::Container" must be one of the following: ${OVERFLOWS.join(
|
|
67
111
|
', '
|
|
68
112
|
)}, received: ${overflow}`,
|
|
69
113
|
OVERFLOWS.includes(overflow)
|
|
@@ -80,10 +124,26 @@ export default class HdsCardContainerComponent extends Component {
|
|
|
80
124
|
get classNames() {
|
|
81
125
|
let classes = ['hds-card__container'];
|
|
82
126
|
|
|
83
|
-
// add
|
|
127
|
+
// add "elevation" classes based on the @level and @hasBorder arguments
|
|
84
128
|
classes.push(
|
|
85
|
-
`hds-${
|
|
129
|
+
`hds-card__container--level-${
|
|
130
|
+
this.args.hasBorder ? 'surface' : 'elevation'
|
|
131
|
+
}-${this.level}`
|
|
86
132
|
);
|
|
133
|
+
if (this.levelHover) {
|
|
134
|
+
classes.push(
|
|
135
|
+
`hds-card__container--hover-level-${
|
|
136
|
+
this.args.hasBorder ? 'surface' : 'elevation'
|
|
137
|
+
}-${this.levelHover}`
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
if (this.levelActive) {
|
|
141
|
+
classes.push(
|
|
142
|
+
`hds-card__container--active-level-${
|
|
143
|
+
this.args.hasBorder ? 'surface' : 'elevation'
|
|
144
|
+
}-${this.levelActive}`
|
|
145
|
+
);
|
|
146
|
+
}
|
|
87
147
|
|
|
88
148
|
// add a class based on the @background argument
|
|
89
149
|
classes.push(`hds-card__container--background-${this.background}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<input type="checkbox" class=
|
|
1
|
+
<input type="checkbox" class="hds-form-checkbox" ...attributes value={{@value}} />
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
<Hds::Form::Checkbox::Base
|
|
11
11
|
class="hds-form-field__control"
|
|
12
12
|
@value={{@value}}
|
|
13
|
-
@isInvalid={{@isInvalid}}
|
|
14
13
|
...attributes
|
|
15
14
|
id={{F.id}}
|
|
16
15
|
aria-describedby={{F.ariaDescribedBy}}
|
|
16
|
+
required={{@isRequired}}
|
|
17
17
|
/>
|
|
18
18
|
</F.Control>
|
|
19
19
|
</Hds::Form::Field>
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
<Hds::Form::Fieldset @layout={{@layout}} ...attributes as |F|>
|
|
1
|
+
<Hds::Form::Fieldset @layout={{@layout}} @isRequired={{@isRequired}} @isOptional={{@isOptional}} ...attributes as |F|>
|
|
2
2
|
{{! Notice: the order of the elements is not relevant here, because it's controlled at "Hds::Form::Fieldset" component level }}
|
|
3
|
-
{{yield (hash Legend=F.Legend
|
|
3
|
+
{{yield (hash Legend=F.Legend isRequired=F.isRequired isOptional=F.isOptional)}}
|
|
4
|
+
{{yield (hash HelperText=F.HelperText Error=F.Error)}}
|
|
4
5
|
<F.Control>
|
|
5
6
|
{{yield
|
|
6
|
-
(hash
|
|
7
|
+
(hash
|
|
8
|
+
Checkbox::Field=(component
|
|
9
|
+
"hds/form/checkbox/field" contextualClass="hds-form-group__control-field" isRequired=@isRequired
|
|
10
|
+
)
|
|
11
|
+
)
|
|
7
12
|
}}
|
|
8
13
|
</F.Control>
|
|
9
14
|
</Hds::Form::Fieldset>
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
<div class={{this.classNames}} ...attributes>
|
|
2
|
-
{{yield
|
|
2
|
+
{{yield
|
|
3
|
+
(hash
|
|
4
|
+
Label=(component
|
|
5
|
+
"hds/form/label"
|
|
6
|
+
controlId=this.id
|
|
7
|
+
isRequired=this.isRequired
|
|
8
|
+
isOptional=this.isOptional
|
|
9
|
+
contextualClass="hds-form-field__label"
|
|
10
|
+
)
|
|
11
|
+
)
|
|
12
|
+
}}
|
|
3
13
|
{{yield
|
|
4
14
|
(hash
|
|
5
15
|
HelperText=(component
|
|
@@ -63,4 +63,22 @@ export default class HdsFormFieldIndexComponent extends Component {
|
|
|
63
63
|
|
|
64
64
|
return classes.join(' ');
|
|
65
65
|
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @param isRequired
|
|
69
|
+
* @type {boolean}
|
|
70
|
+
* @default false
|
|
71
|
+
*/
|
|
72
|
+
get isRequired() {
|
|
73
|
+
return this.args.isRequired || false;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @param isOptional
|
|
78
|
+
* @type {boolean}
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
get isOptional() {
|
|
82
|
+
return this.args.isOptional || false;
|
|
83
|
+
}
|
|
66
84
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<fieldset class={{this.classNames}} id={{this.id}} ...attributes aria-describedby={{this.ariaDescribedBy}}>
|
|
2
|
-
{{yield
|
|
2
|
+
{{yield
|
|
3
|
+
(hash
|
|
4
|
+
Legend=(component
|
|
5
|
+
"hds/form/legend" isRequired=this.isRequired isOptional=this.isOptional contextualClass="hds-form-group__legend"
|
|
6
|
+
)
|
|
7
|
+
)
|
|
8
|
+
}}
|
|
3
9
|
{{yield
|
|
4
10
|
(hash
|
|
5
11
|
HelperText=(component
|
|
@@ -46,4 +46,22 @@ export default class HdsFormFieldsetIndexComponent extends Component {
|
|
|
46
46
|
|
|
47
47
|
return classes.join(' ');
|
|
48
48
|
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param isRequired
|
|
52
|
+
* @type {boolean}
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
get isRequired() {
|
|
56
|
+
return this.args.isRequired || false;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @param isOptional
|
|
61
|
+
* @type {boolean}
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
64
|
+
get isOptional() {
|
|
65
|
+
return this.args.isOptional || false;
|
|
66
|
+
}
|
|
49
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<input type="radio" class=
|
|
1
|
+
<input type="radio" class="hds-form-radio" ...attributes value={{@value}} />
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
<Hds::Form::Radio::Base
|
|
11
11
|
class="hds-form-field__control"
|
|
12
12
|
@value={{@value}}
|
|
13
|
-
@isInvalid={{@isInvalid}}
|
|
14
13
|
...attributes
|
|
15
14
|
id={{F.id}}
|
|
16
15
|
aria-describedby={{F.ariaDescribedBy}}
|
|
16
|
+
required={{@isRequired}}
|
|
17
17
|
/>
|
|
18
18
|
</F.Control>
|
|
19
19
|
</Hds::Form::Field>
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
<Hds::Form::Fieldset @layout={{@layout}} ...attributes as |F|>
|
|
1
|
+
<Hds::Form::Fieldset @layout={{@layout}} @isRequired={{@isRequired}} @isOptional={{@isOptional}} ...attributes as |F|>
|
|
2
2
|
{{! Notice: the order of the elements is not relevant here, because it's controlled at "Hds::Form::Fieldset" component level }}
|
|
3
|
-
{{yield (hash Legend=F.Legend
|
|
3
|
+
{{yield (hash Legend=F.Legend isRequired=F.isRequired isOptional=F.isOptional)}}
|
|
4
|
+
{{yield (hash HelperText=F.HelperText Error=F.Error)}}
|
|
4
5
|
<F.Control>
|
|
5
|
-
{{yield
|
|
6
|
+
{{yield
|
|
7
|
+
(hash
|
|
8
|
+
Radio::Field=(component
|
|
9
|
+
"hds/form/radio/field" contextualClass="hds-form-group__control-field" isRequired=@isRequired
|
|
10
|
+
)
|
|
11
|
+
)
|
|
12
|
+
}}
|
|
6
13
|
</F.Control>
|
|
7
14
|
</Hds::Form::Fieldset>
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
<Hds::Form::Field
|
|
1
|
+
<Hds::Form::Field
|
|
2
|
+
@layout="vertical"
|
|
3
|
+
@extraAriaDescribedBy={{@extraAriaDescribedBy}}
|
|
4
|
+
@isRequired={{@isRequired}}
|
|
5
|
+
@isOptional={{@isOptional}}
|
|
6
|
+
as |F|
|
|
7
|
+
>
|
|
2
8
|
{{! Notice: the order of the elements is not relevant here, because is controlled at "Hds::Form::Field" component level }}
|
|
3
|
-
{{yield (hash Label=F.Label
|
|
9
|
+
{{yield (hash Label=F.Label isRequired=F.isRequired isOptional=F.isOptional)}}
|
|
10
|
+
{{yield (hash HelperText=F.HelperText Error=F.Error)}}
|
|
4
11
|
<F.Control>
|
|
5
12
|
<Hds::Form::Select::Base
|
|
6
13
|
class="hds-form-field__control"
|
|
@@ -10,6 +17,7 @@
|
|
|
10
17
|
...attributes
|
|
11
18
|
id={{F.id}}
|
|
12
19
|
aria-describedby={{F.ariaDescribedBy}}
|
|
20
|
+
required={{@isRequired}}
|
|
13
21
|
as |S|
|
|
14
22
|
>
|
|
15
23
|
{{yield (hash Options=S.Options)}}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
<Hds::Form::Field
|
|
1
|
+
<Hds::Form::Field
|
|
2
|
+
@layout="vertical"
|
|
3
|
+
@extraAriaDescribedBy={{@extraAriaDescribedBy}}
|
|
4
|
+
@isRequired={{@isRequired}}
|
|
5
|
+
@isOptional={{@isOptional}}
|
|
6
|
+
as |F|
|
|
7
|
+
>
|
|
2
8
|
{{! Notice: the order of the elements is not relevant here, because is controlled at "Hds::Form::Field" component level }}
|
|
3
|
-
{{yield (hash Label=F.Label
|
|
9
|
+
{{yield (hash Label=F.Label isRequired=F.isRequired isOptional=F.isOptional)}}
|
|
10
|
+
{{yield (hash HelperText=F.HelperText Error=F.Error)}}
|
|
4
11
|
<F.Control>
|
|
5
12
|
<Hds::Form::TextInput::Base
|
|
6
13
|
class="hds-form-field__control"
|
|
@@ -11,6 +18,7 @@
|
|
|
11
18
|
...attributes
|
|
12
19
|
id={{F.id}}
|
|
13
20
|
aria-describedby={{F.ariaDescribedBy}}
|
|
21
|
+
required={{@isRequired}}
|
|
14
22
|
/>
|
|
15
23
|
</F.Control>
|
|
16
24
|
</Hds::Form::Field>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
{{! Notice: this is not the native HTML <textarea> but the Ember component <Textarea> }}
|
|
2
|
-
<Textarea class={{this.classNames}} {{style width=@width}} ...attributes @value={{@value}} />
|
|
2
|
+
<Textarea class={{this.classNames}} {{style width=@width height=@height}} rows="4" ...attributes @value={{@value}} />
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
<Hds::Form::Field
|
|
1
|
+
<Hds::Form::Field
|
|
2
|
+
@layout="vertical"
|
|
3
|
+
@extraAriaDescribedBy={{@extraAriaDescribedBy}}
|
|
4
|
+
@isRequired={{@isRequired}}
|
|
5
|
+
@isOptional={{@isOptional}}
|
|
6
|
+
as |F|
|
|
7
|
+
>
|
|
2
8
|
{{! Notice: the order of the elements is not relevant here, because is controlled at "Hds::Form::Field" component level }}
|
|
3
|
-
{{yield (hash Label=F.Label
|
|
9
|
+
{{yield (hash Label=F.Label isRequired=F.isRequired isOptional=F.isOptional)}}
|
|
10
|
+
{{yield (hash HelperText=F.HelperText Error=F.Error)}}
|
|
4
11
|
<F.Control>
|
|
5
12
|
<Hds::Form::Textarea::Base
|
|
6
13
|
class="hds-form-field__control"
|
|
7
14
|
@value={{@value}}
|
|
8
15
|
@isInvalid={{@isInvalid}}
|
|
9
16
|
@width={{@width}}
|
|
17
|
+
@height={{@height}}
|
|
10
18
|
...attributes
|
|
11
19
|
id={{F.id}}
|
|
12
20
|
aria-describedby={{F.ariaDescribedBy}}
|
|
21
|
+
required={{@isRequired}}
|
|
13
22
|
/>
|
|
14
23
|
</F.Control>
|
|
15
24
|
</Hds::Form::Field>
|
|
@@ -9,11 +9,6 @@ export default class HdsFormToggleBaseComponent extends Component {
|
|
|
9
9
|
get classNames() {
|
|
10
10
|
let classes = ['hds-form-toggle'];
|
|
11
11
|
|
|
12
|
-
// add a class based on the @isInvalid argument
|
|
13
|
-
if (this.args.isInvalid) {
|
|
14
|
-
classes.push(`hds-form-toggle--is-invalid`);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
12
|
// add a class based on the @_wrapperClass argument
|
|
18
13
|
// we need to use this special argument to pass a class to the wrapping element, because the ...attributes is applied to the control
|
|
19
14
|
// notice: this will *not* be documented for public use
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
{{! template-lint-disable no-capital-arguments }}
|
|
12
12
|
@_wrapperClass="hds-form-field__control"
|
|
13
13
|
@value={{@value}}
|
|
14
|
-
@isInvalid={{@isInvalid}}
|
|
15
14
|
...attributes
|
|
16
15
|
id={{F.id}}
|
|
17
16
|
aria-describedby={{F.ariaDescribedBy}}
|
|
17
|
+
required={{@isRequired}}
|
|
18
18
|
/>
|
|
19
19
|
</F.Control>
|
|
20
20
|
</Hds::Form::Field>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<Hds::Form::Fieldset @layout={{@layout}} @isRequired={{@isRequired}} @isOptional={{@isOptional}} ...attributes as |F|>
|
|
2
|
+
{{! Notice: the order of the elements is not relevant here, because it's controlled at "Hds::Form::Fieldset" component level }}
|
|
3
|
+
{{yield (hash Legend=F.Legend isRequired=F.isRequired isOptional=F.isOptional)}}
|
|
4
|
+
{{yield (hash HelperText=F.HelperText Error=F.Error)}}
|
|
5
|
+
<F.Control>
|
|
6
|
+
{{yield
|
|
7
|
+
(hash
|
|
8
|
+
Toggle::Field=(component
|
|
9
|
+
"hds/form/toggle/field" contextualClass="hds-form-group__control-field" isRequired=@isRequired
|
|
10
|
+
)
|
|
11
|
+
)
|
|
12
|
+
}}
|
|
13
|
+
</F.Control>
|
|
14
|
+
</Hds::Form::Fieldset>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/form/indicator/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/form/toggle/group';
|
|
@@ -17,6 +17,7 @@ $hds-badge-count-border-width: 1px;
|
|
|
17
17
|
border: $hds-badge-count-border-width solid transparent;
|
|
18
18
|
display: inline-flex;
|
|
19
19
|
font-family: var(--token-typography-font-stack-text);
|
|
20
|
+
font-weight: var(--token-typography-font-weight-medium);
|
|
20
21
|
max-width: 100%;
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
.hds-badge__text {
|
|
30
30
|
flex: 1 0 0;
|
|
31
31
|
font-family: var(--token-typography-font-stack-text);
|
|
32
|
+
font-weight: var(--token-typography-font-weight-medium);
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
|
|
@@ -143,4 +144,4 @@ $size-props: (
|
|
|
143
144
|
color: var(--token-color-foreground-#{$color});
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
|
-
}
|
|
147
|
+
}
|
|
@@ -32,11 +32,19 @@ $hds-button-focus-border-width: 3px;
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// This covers all of the browsers and focus scenarios (due to the custom focus design).
|
|
35
|
+
//
|
|
36
|
+
// IMPORTANT: we need to use also the [disabled] selector because if the "disabled" attribute is applied to a "Button as link",
|
|
37
|
+
// the ":disabled" pseudo-selector is not applied to the element in the browser (rightly) because a link can't be disabled
|
|
38
|
+
// but from the product perspective there may be use cases where they need to have a "Button as link" that looks disabled anyway
|
|
39
|
+
//
|
|
35
40
|
&:disabled,
|
|
41
|
+
&[disabled],
|
|
36
42
|
&.mock-disabled,
|
|
37
43
|
&:disabled:focus,
|
|
44
|
+
&[disabled]:focus,
|
|
38
45
|
&.mock-disabled:focus,
|
|
39
46
|
&:disabled:hover,
|
|
47
|
+
&[disabled]:hover,
|
|
40
48
|
&.mock-disabled:hover {
|
|
41
49
|
background-color: var(--token-color-surface-faint);
|
|
42
50
|
border-color: var(--token-color-border-primary);
|
|
@@ -254,11 +262,19 @@ $size-props: (
|
|
|
254
262
|
}
|
|
255
263
|
}
|
|
256
264
|
|
|
265
|
+
//
|
|
266
|
+
// IMPORTANT: we need to use also the [disabled] selector because if the "disabled" attribute is applied to a "Button as link",
|
|
267
|
+
// the ":disabled" pseudo-selector is not applied to the element in the browser (rightly) because a link can't be disabled
|
|
268
|
+
// but from the product perspective there may be use cases where they need to have a "Button as link" that looks disabled anyway
|
|
269
|
+
//
|
|
257
270
|
&:disabled,
|
|
271
|
+
&[disabled],
|
|
258
272
|
&.mock-disabled,
|
|
259
273
|
&:disabled:focus,
|
|
274
|
+
&[disabled]:focus,
|
|
260
275
|
&.mock-disabled:focus,
|
|
261
276
|
&:disabled:hover,
|
|
277
|
+
&[disabled]:hover,
|
|
262
278
|
&.mock-disabled:hover {
|
|
263
279
|
background-color: transparent;
|
|
264
280
|
border-color: transparent;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
$hds-card-container-style: ( 'surface', 'elevation' );
|
|
9
10
|
$hds-card-container-levels: ( 'base', 'mid', 'high' );
|
|
10
11
|
|
|
11
12
|
$hds-card-container-border-radius: 6px;
|
|
@@ -16,6 +17,30 @@ $hds-card-container-border-radius: 6px;
|
|
|
16
17
|
position: relative;
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
// LEVEL (elevation style as "drop" + "border" shadow effects)
|
|
21
|
+
|
|
22
|
+
@each $style in $hds-card-container-style {
|
|
23
|
+
// IMPORTANT: we need to keep separate loops, because we want the "hover" state
|
|
24
|
+
// to override the "rest" state, and the "active" state to override the "hover" state
|
|
25
|
+
// so the order of the declaration matters, they need to be one group after another group
|
|
26
|
+
@each $level in $hds-card-container-levels {
|
|
27
|
+
.hds-card__container--level-#{$style}-#{$level} {
|
|
28
|
+
box-shadow: var(--token-#{$style}-#{$level}-box-shadow);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
@each $level in $hds-card-container-levels {
|
|
32
|
+
.hds-card__container--hover-level-#{$style}-#{$level}:hover,
|
|
33
|
+
.hds-card__container--hover-level-#{$style}-#{$level}.mock-hover {
|
|
34
|
+
box-shadow: var(--token-#{$style}-#{$level}-box-shadow);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
@each $level in $hds-card-container-levels {
|
|
38
|
+
.hds-card__container--active-level-#{$style}-#{$level}:active,
|
|
39
|
+
.hds-card__container--active-level-#{$style}-#{$level}.mock-active {
|
|
40
|
+
box-shadow: var(--token-#{$style}-#{$level}-box-shadow);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
19
44
|
|
|
20
45
|
// BACKGROUND
|
|
21
46
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//
|
|
2
|
+
// FORM > TOKENS
|
|
3
|
+
//
|
|
4
|
+
// TODO: this will be removed once we define the correct component-level tokens for the "form controls" component
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
:root {
|
|
8
|
+
// INPUT / DEFAULT
|
|
9
|
+
--token-form-control-foreground-color-default: var(--token-color-foreground-strong);
|
|
10
|
+
--token-form-control-background-color-default: var(--token-color-surface-interactive);
|
|
11
|
+
--token-form-control-background-color-default-hover: var(--token-color-surface-interactive-hover);
|
|
12
|
+
--token-form-control-border-color-default: #8c909c;
|
|
13
|
+
--token-form-control-border-color-default-hover: #656a76;
|
|
14
|
+
// INPUT / CHECKED
|
|
15
|
+
--token-form-control-background-color-checked: #1060FF;
|
|
16
|
+
--token-form-control-background-color-checked-hover: #0C56E9;
|
|
17
|
+
--token-form-control-border-color-checked: #0C56E9;
|
|
18
|
+
--token-form-control-border-color-checked-hover: #0046D1;
|
|
19
|
+
// INPUT / READONLY
|
|
20
|
+
--token-form-control-foreground-color-readonly: var(--token-color-foreground-primary);
|
|
21
|
+
--token-form-control-background-color-readonly: var(--token-color-surface-strong);
|
|
22
|
+
--token-form-control-border-color-readonly: var(--token-color-border-faint);
|
|
23
|
+
// INPUT / DISABLED
|
|
24
|
+
--token-form-control-foreground-color-disabled: var(--token-color-foreground-disabled);
|
|
25
|
+
--token-form-control-background-color-disabled: var(--token-color-surface-interactive-disabled);
|
|
26
|
+
--token-form-control-border-color-disabled: var(--token-color-border-primary);
|
|
27
|
+
// INPUT / INVALID
|
|
28
|
+
--token-form-control-foreground-color-critical: var(--token-color-foreground-critical-on-surface);
|
|
29
|
+
--token-form-control-border-color-critical: #c00005;
|
|
30
|
+
--token-form-control-border-color-critical-hover: #940004;
|
|
31
|
+
// INPUT / PLACEHOLDER
|
|
32
|
+
--token-form-control-placeholder-color: var(--token-color-foreground-faint);
|
|
33
|
+
// INPUT / BORDER SIZING
|
|
34
|
+
--token-form-control-border-radius: 5px;
|
|
35
|
+
// LABEL/HELPER-TEXT
|
|
36
|
+
--token-form-label-foreground-color: var(--token-color-foreground-strong);
|
|
37
|
+
--token-form-helper-text-foreground-color: var(--token-color-foreground-faint);
|
|
38
|
+
// CHECKBOX
|
|
39
|
+
--token-form-checkbox-size: 16px;
|
|
40
|
+
--token-form-checkbox-border-radius: 3px;
|
|
41
|
+
}
|