@hashicorp/design-system-components 0.12.7 → 0.12.10
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 +8 -1
- package/addon/components/hds/alert/index.js +31 -0
- package/addon/components/hds/card/container.js +65 -5
- package/addon/components/hds/form/toggle/group.hbs +7 -0
- package/app/components/hds/form/toggle/group.js +1 -0
- package/app/styles/components/button.scss +10 -0
- package/app/styles/components/card/container.scss +25 -0
- package/app/styles/components/form/checkbox.scss +3 -20
- package/app/styles/components/form/error.scss +0 -1
- package/app/styles/components/form/group.scss +1 -1
- package/app/styles/components/form/radio.scss +5 -20
- package/app/styles/components/form/select.scss +17 -14
- package/app/styles/components/form/text-input.scss +23 -15
- package/app/styles/components/form/textarea.scss +23 -14
- package/app/styles/components/form/toggle.scss +6 -20
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @hashicorp/design-system-components
|
|
2
2
|
|
|
3
|
+
## 0.12.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
9
|
+
## 0.12.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#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
|
|
14
|
+
|
|
15
|
+
* [#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
|
|
16
|
+
|
|
17
|
+
- [#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
|
|
18
|
+
|
|
19
|
+
## 0.12.8
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#400](https://github.com/hashicorp/design-system/pull/400) [`d87d622b`](https://github.com/hashicorp/design-system/commit/d87d622b0f1f8829a0d5e6a48cfcd8ad8ff6f425) Thanks [@alex-ju](https://github.com/alex-ju)! - Determine alert component's role based on the presence of interactive elements
|
|
24
|
+
|
|
3
25
|
## 0.12.7
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -1,4 +1,11 @@
|
|
|
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}} />
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
|
+
import { action } from '@ember/object';
|
|
2
3
|
import { assert } from '@ember/debug';
|
|
4
|
+
import { guidFor } from '@ember/object/internals';
|
|
5
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
6
|
|
|
4
7
|
export const TYPES = ['page', 'inline', 'compact'];
|
|
5
8
|
export const DEFAULT_COLOR = 'neutral';
|
|
@@ -18,7 +21,14 @@ export const MAPPING_COLORS_TO_ICONS = {
|
|
|
18
21
|
critical: 'alert-diamond',
|
|
19
22
|
};
|
|
20
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
|
+
|
|
21
28
|
export default class HdsAlertIndexComponent extends Component {
|
|
29
|
+
@tracked role = 'alert';
|
|
30
|
+
@tracked ariaLabelledBy;
|
|
31
|
+
|
|
22
32
|
constructor() {
|
|
23
33
|
super(...arguments);
|
|
24
34
|
|
|
@@ -125,4 +135,25 @@ export default class HdsAlertIndexComponent extends Component {
|
|
|
125
135
|
|
|
126
136
|
return classes.join(' ');
|
|
127
137
|
}
|
|
138
|
+
|
|
139
|
+
@action
|
|
140
|
+
didInsert(element) {
|
|
141
|
+
let actions = element.querySelectorAll(
|
|
142
|
+
`${CONTENT_ELEMENT_SELECTOR} button, ${CONTENT_ELEMENT_SELECTOR} a`
|
|
143
|
+
);
|
|
144
|
+
if (actions.length) {
|
|
145
|
+
this.role = 'alertdialog';
|
|
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
|
+
}
|
|
158
|
+
}
|
|
128
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}`);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<Hds::Form::Fieldset @layout={{@layout}} ...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 HelperText=F.HelperText Error=F.Error)}}
|
|
4
|
+
<F.Control>
|
|
5
|
+
{{yield (hash Toggle::Field=(component "hds/form/toggle/field" contextualClass="hds-form-group__control-field"))}}
|
|
6
|
+
</F.Control>
|
|
7
|
+
</Hds::Form::Fieldset>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/form/toggle/group';
|
|
@@ -32,6 +32,11 @@ $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,
|
|
36
41
|
&[disabled],
|
|
37
42
|
&.mock-disabled,
|
|
@@ -257,6 +262,11 @@ $size-props: (
|
|
|
257
262
|
}
|
|
258
263
|
}
|
|
259
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
|
+
//
|
|
260
270
|
&:disabled,
|
|
261
271
|
&[disabled],
|
|
262
272
|
&.mock-disabled,
|
|
@@ -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
|
|
|
@@ -56,18 +56,8 @@ $hds-form-checkbox-control-border-radius: 3px;
|
|
|
56
56
|
&.mock-focus:checked,
|
|
57
57
|
&.mock-focus:not(:checked) {
|
|
58
58
|
border-color: var(--token-color-palette-blue-400);
|
|
59
|
-
outline:
|
|
60
|
-
outline-offset:
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// active
|
|
64
|
-
|
|
65
|
-
&:active:not(:checked),
|
|
66
|
-
&.mock-active:not(:checked),
|
|
67
|
-
&:active:checked,
|
|
68
|
-
&.mock-active:checked {
|
|
69
|
-
background-color: var(--token-color-palette-blue-400);
|
|
70
|
-
border-color: var(--token-color-palette-blue-400);
|
|
59
|
+
outline: 3px solid var(--token-color-focus-action-external);
|
|
60
|
+
outline-offset: 1px;
|
|
71
61
|
}
|
|
72
62
|
|
|
73
63
|
// INVALID
|
|
@@ -90,14 +80,6 @@ $hds-form-checkbox-control-border-radius: 3px;
|
|
|
90
80
|
border-color: var(--token-color-palette-red-400);
|
|
91
81
|
}
|
|
92
82
|
|
|
93
|
-
&.hds-form-checkbox--is-invalid:active:not(:checked),
|
|
94
|
-
&.hds-form-checkbox--is-invalid.mock-active:not(:checked),
|
|
95
|
-
&.hds-form-checkbox--is-invalid:active:checked,
|
|
96
|
-
&.hds-form-checkbox--is-invalid.mock-active:checked {
|
|
97
|
-
background-color: var(--token-color-palette-red-400);
|
|
98
|
-
border-color: var(--token-color-palette-red-400);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
83
|
// DISABLED
|
|
102
84
|
|
|
103
85
|
&:disabled:not(:checked),
|
|
@@ -109,5 +91,6 @@ $hds-form-checkbox-control-border-radius: 3px;
|
|
|
109
91
|
box-shadow: none;
|
|
110
92
|
// notice: the "tick" color is hardcoded here!
|
|
111
93
|
background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M9.78033 3.21967C10.0732 3.51256 10.0732 3.98744 9.78033 4.28033L5.28033 8.78033C4.98744 9.07322 4.51256 9.07322 4.21967 8.78033L2.21967 6.78033C1.92678 6.48744 1.92678 6.01256 2.21967 5.71967C2.51256 5.42678 2.98744 5.42678 3.28033 5.71967L4.75 7.18934L8.71967 3.21967C9.01256 2.92678 9.48744 2.92678 9.78033 3.21967Z' fill='%238C909C'/%3e%3c/svg%3e");
|
|
94
|
+
cursor: not-allowed;
|
|
112
95
|
}
|
|
113
96
|
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
.hds-form-group__control-fields-wrapper {
|
|
20
20
|
// when the group contains a "legend", we reduce the visual weight of the "label"
|
|
21
|
-
.hds-form-group__legend
|
|
21
|
+
.hds-form-group__legend ~ & {
|
|
22
22
|
.hds-form-label {
|
|
23
23
|
font-weight: var(--token-typography-font-weight-regular);
|
|
24
24
|
}
|
|
@@ -55,18 +55,8 @@ $hds-form-radio-control-size: 16px;
|
|
|
55
55
|
&.mock-focus:checked,
|
|
56
56
|
&.mock-focus:not(:checked) {
|
|
57
57
|
border-color: var(--token-color-palette-blue-400);
|
|
58
|
-
outline:
|
|
59
|
-
outline-offset:
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// active
|
|
63
|
-
|
|
64
|
-
&:active:not(:checked),
|
|
65
|
-
&.mock-active:not(:checked),
|
|
66
|
-
&:active:checked,
|
|
67
|
-
&.mock-active:checked {
|
|
68
|
-
background-color: var(--token-color-palette-blue-400);
|
|
69
|
-
border-color: var(--token-color-palette-blue-400);
|
|
58
|
+
outline: 3px solid var(--token-color-focus-action-external);
|
|
59
|
+
outline-offset: 1px;
|
|
70
60
|
}
|
|
71
61
|
|
|
72
62
|
// INVALID
|
|
@@ -89,20 +79,14 @@ $hds-form-radio-control-size: 16px;
|
|
|
89
79
|
border-color: var(--token-color-palette-red-400);
|
|
90
80
|
}
|
|
91
81
|
|
|
92
|
-
&.hds-form-radio--is-invalid:active:not(:checked),
|
|
93
|
-
&.hds-form-radio--is-invalid.mock-active:not(:checked),
|
|
94
|
-
&.hds-form-radio--is-invalid:active:checked,
|
|
95
|
-
&.hds-form-radio--is-invalid.mock-active:checked {
|
|
96
|
-
background-color: var(--token-color-palette-red-400);
|
|
97
|
-
border-color: var(--token-color-palette-red-400);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
82
|
// DISABLED
|
|
101
83
|
|
|
102
84
|
&:disabled:not(:checked),
|
|
103
85
|
&.hds-form-checkbox--is-invalid:disabled:not(:checked) {
|
|
104
86
|
background-color: var(--token-color-surface-strong);
|
|
105
87
|
border-color: var(--token-color-border-primary);
|
|
88
|
+
box-shadow: none;
|
|
89
|
+
cursor: not-allowed;
|
|
106
90
|
}
|
|
107
91
|
&:disabled:checked,
|
|
108
92
|
&.hds-form-checkbox--is-invalid:disabled:checked {
|
|
@@ -111,5 +95,6 @@ $hds-form-radio-control-size: 16px;
|
|
|
111
95
|
box-shadow: none;
|
|
112
96
|
// notice: the "dot" color is hardcoded here!
|
|
113
97
|
background-image: url("data:image/svg+xml,%3csvg width='12' height='12' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='6' cy='6' r='2.5' fill='%23656a76'/%3e%3c/svg%3e");
|
|
98
|
+
cursor: not-allowed;
|
|
114
99
|
}
|
|
115
100
|
}
|
|
@@ -9,12 +9,8 @@
|
|
|
9
9
|
.hds-form-select {
|
|
10
10
|
border: 1px solid var(--token-color-palette-neutral-400);
|
|
11
11
|
border-radius: 5px;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
font-family: var(--token-typography-body-200-font-family);
|
|
15
|
-
font-size: var(--token-typography-body-200-font-size);
|
|
16
|
-
line-height: var(--token-typography-body-200-line-height);
|
|
17
|
-
padding: 7px;
|
|
12
|
+
color: var(--token-color-foreground-strong);
|
|
13
|
+
padding: 7px; // we have to take into account the border
|
|
18
14
|
max-width: 100%;
|
|
19
15
|
|
|
20
16
|
// STATUS
|
|
@@ -30,26 +26,33 @@
|
|
|
30
26
|
&.mock-focus {
|
|
31
27
|
border-color: var(--token-color-focus-action-internal);
|
|
32
28
|
// TODO: Safari doesn't apply a rounded border
|
|
33
|
-
outline:
|
|
29
|
+
outline: 3px solid var(--token-color-focus-action-external);
|
|
34
30
|
outline-offset: 0px;
|
|
35
31
|
}
|
|
36
32
|
|
|
37
|
-
&:active,
|
|
38
|
-
&.mock-active {
|
|
39
|
-
background-color: var(--token-color-surface-interactive-disabled);
|
|
40
|
-
border-color: var(--token-color-border-primary);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
33
|
// DISABLED
|
|
44
34
|
|
|
45
35
|
&:disabled {
|
|
46
36
|
background-color: var(--token-color-surface-strong);
|
|
47
37
|
border-color: var(--token-color-border-primary);
|
|
38
|
+
cursor: not-allowed;
|
|
48
39
|
}
|
|
49
40
|
|
|
50
41
|
// INVALID
|
|
51
42
|
|
|
52
43
|
&.hds-form-select--is-invalid {
|
|
53
|
-
border-color:
|
|
44
|
+
border-color: #C00005; // TODO convert to form-controls design token
|
|
45
|
+
|
|
46
|
+
&:hover,
|
|
47
|
+
&.mock-hover {
|
|
48
|
+
border-color: #940004; // TODO convert to form-controls design token
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// TODO add handling of focus-visible
|
|
52
|
+
&:focus,
|
|
53
|
+
&.mock-focus {
|
|
54
|
+
border-color: var(--token-color-focus-critical-internal);
|
|
55
|
+
outline-color: var(--token-color-focus-critical-external);
|
|
56
|
+
}
|
|
54
57
|
}
|
|
55
58
|
}
|
|
@@ -7,14 +7,12 @@
|
|
|
7
7
|
// "BASE" CONTROL
|
|
8
8
|
|
|
9
9
|
.hds-form-text-input {
|
|
10
|
+
background-color: var(--token-color-surface-primary);
|
|
10
11
|
border: 1px solid var(--token-color-palette-neutral-400);
|
|
11
12
|
border-radius: 5px;
|
|
12
13
|
box-shadow: var(--hds-elevation-inset-box-shadow);
|
|
13
|
-
color: var(--token-color-foreground-
|
|
14
|
-
|
|
15
|
-
font-size: var(--token-typography-body-200-font-size);
|
|
16
|
-
line-height: var(--token-typography-body-200-line-height);
|
|
17
|
-
padding: 7px;
|
|
14
|
+
color: var(--token-color-foreground-strong);
|
|
15
|
+
padding: 7px; // we have to take into account the border
|
|
18
16
|
width: 100%;
|
|
19
17
|
max-width: 100%;
|
|
20
18
|
|
|
@@ -37,35 +35,46 @@
|
|
|
37
35
|
&.mock-focus {
|
|
38
36
|
border-color: var(--token-color-focus-action-internal);
|
|
39
37
|
// TODO: Safari doesn't apply a rounded border
|
|
40
|
-
outline:
|
|
38
|
+
outline: 3px solid var(--token-color-focus-action-external);
|
|
41
39
|
outline-offset: 0px;
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
&:active,
|
|
45
|
-
&.mock-active {
|
|
46
|
-
border-color: var(--token-color-focus-action-internal);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
42
|
// READONLY
|
|
50
43
|
|
|
51
44
|
&:read-only,
|
|
52
45
|
&[readonly] {
|
|
53
46
|
background-color: var(--token-color-surface-strong);
|
|
54
47
|
border-color: var(--token-color-palette-neutral-400);
|
|
48
|
+
box-shadow: none;
|
|
49
|
+
color: var(--token-color-foreground-primary);
|
|
55
50
|
}
|
|
56
51
|
|
|
57
52
|
// DISABLED
|
|
58
53
|
|
|
59
|
-
&:disabled
|
|
60
|
-
&[disabled] {
|
|
54
|
+
&:disabled {
|
|
61
55
|
background-color: var(--token-color-surface-interactive-disabled);
|
|
62
56
|
border-color: var(--token-color-border-primary);
|
|
57
|
+
box-shadow: none;
|
|
58
|
+
color: var(--token-color-foreground-disabled);
|
|
59
|
+
cursor: not-allowed;
|
|
63
60
|
}
|
|
64
61
|
|
|
65
62
|
// INVALID
|
|
66
63
|
|
|
67
64
|
&.hds-form-text-input--is-invalid {
|
|
68
|
-
border-color:
|
|
65
|
+
border-color: #C00005; // TODO convert to form-controls design token
|
|
66
|
+
|
|
67
|
+
&:hover,
|
|
68
|
+
&.mock-hover {
|
|
69
|
+
border-color: #940004; // TODO convert to form-controls design token
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// TODO add handling of focus-visible
|
|
73
|
+
&:focus,
|
|
74
|
+
&.mock-focus {
|
|
75
|
+
border-color: var(--token-color-focus-critical-internal);
|
|
76
|
+
outline-color: var(--token-color-focus-critical-external);
|
|
77
|
+
}
|
|
69
78
|
}
|
|
70
79
|
}
|
|
71
80
|
|
|
@@ -84,7 +93,6 @@
|
|
|
84
93
|
width: initial;
|
|
85
94
|
|
|
86
95
|
// show the native icon dimmed if disabled (hidden in Chrome)
|
|
87
|
-
&[disabled]::-webkit-calendar-picker-indicator,
|
|
88
96
|
&:disabled::-webkit-calendar-picker-indicator {
|
|
89
97
|
visibility: visible;
|
|
90
98
|
opacity: 0.5;
|
|
@@ -7,14 +7,12 @@
|
|
|
7
7
|
// "BASE" CONTROL
|
|
8
8
|
|
|
9
9
|
.hds-form-textarea {
|
|
10
|
+
background-color: var(--token-color-surface-primary);
|
|
10
11
|
border: 1px solid var(--token-color-palette-neutral-400);
|
|
11
12
|
border-radius: 5px;
|
|
12
13
|
box-shadow: var(--hds-elevation-inset-box-shadow);
|
|
13
|
-
color: var(--token-color-foreground-
|
|
14
|
-
|
|
15
|
-
font-size: var(--token-typography-body-200-font-size);
|
|
16
|
-
line-height: var(--token-typography-body-200-line-height);
|
|
17
|
-
padding: 4px 8px;
|
|
14
|
+
color: var(--token-color-foreground-strong);
|
|
15
|
+
padding: 3px 7px; // we have to take into account the border
|
|
18
16
|
resize: vertical;
|
|
19
17
|
width: 100%;
|
|
20
18
|
max-width: 100%;
|
|
@@ -38,34 +36,45 @@
|
|
|
38
36
|
&.mock-focus {
|
|
39
37
|
border-color: var(--token-color-focus-action-internal);
|
|
40
38
|
// TODO: Safari doesn't apply a rounded border
|
|
41
|
-
outline:
|
|
39
|
+
outline: 3px solid var(--token-color-focus-action-external);
|
|
42
40
|
outline-offset: 0px;
|
|
43
41
|
}
|
|
44
42
|
|
|
45
|
-
&:active,
|
|
46
|
-
&.mock-active {
|
|
47
|
-
border-color: var(--token-color-focus-action-internal);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
43
|
// READONLY
|
|
51
44
|
|
|
52
45
|
&:read-only,
|
|
53
46
|
&[readonly] {
|
|
54
47
|
background-color: var(--token-color-surface-strong);
|
|
55
48
|
border-color: var(--token-color-palette-neutral-400);
|
|
49
|
+
box-shadow: none;
|
|
50
|
+
color: var(--token-color-foreground-primary);
|
|
56
51
|
}
|
|
57
52
|
|
|
58
53
|
// DISABLED
|
|
59
54
|
|
|
60
|
-
&:disabled
|
|
61
|
-
&[disabled] {
|
|
55
|
+
&:disabled {
|
|
62
56
|
background-color: var(--token-color-surface-interactive-disabled);
|
|
63
57
|
border-color: var(--token-color-border-primary);
|
|
58
|
+
box-shadow: none;
|
|
59
|
+
color: var(--token-color-foreground-disabled);
|
|
60
|
+
cursor: not-allowed;
|
|
64
61
|
}
|
|
65
62
|
|
|
66
63
|
// INVALID
|
|
67
64
|
|
|
68
65
|
&.hds-form-textarea--is-invalid {
|
|
69
|
-
border-color:
|
|
66
|
+
border-color: #C00005; // TODO convert to form-controls design token
|
|
67
|
+
|
|
68
|
+
&:hover,
|
|
69
|
+
&.mock-hover {
|
|
70
|
+
border-color: #940004; // TODO convert to form-controls design token
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// TODO add handling of focus-visible
|
|
74
|
+
&:focus,
|
|
75
|
+
&.mock-focus {
|
|
76
|
+
border-color: var(--token-color-focus-critical-internal);
|
|
77
|
+
outline-color: var(--token-color-focus-critical-external);
|
|
78
|
+
}
|
|
70
79
|
}
|
|
71
80
|
}
|
|
@@ -38,6 +38,10 @@ $hds-form-toggle-border-radius: math.div($hds-form-toggle-control-height, 2);
|
|
|
38
38
|
right: 0;
|
|
39
39
|
top: 0;
|
|
40
40
|
z-index: 1;
|
|
41
|
+
|
|
42
|
+
&:disabled {
|
|
43
|
+
cursor: not-allowed;
|
|
44
|
+
}
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
// facade (visible)
|
|
@@ -74,8 +78,8 @@ $hds-form-toggle-border-radius: math.div($hds-form-toggle-control-height, 2);
|
|
|
74
78
|
// used for the focus
|
|
75
79
|
|
|
76
80
|
&::before {
|
|
77
|
-
$border-width:
|
|
78
|
-
$shift: $border-width +
|
|
81
|
+
$border-width: 3px;
|
|
82
|
+
$shift: $border-width + 2px; // we need to take in account also the border width of the parent
|
|
79
83
|
border-radius: $hds-form-toggle-border-radius + $border-width;
|
|
80
84
|
border-width: $border-width;
|
|
81
85
|
bottom: -$shift;
|
|
@@ -133,16 +137,6 @@ $hds-form-toggle-border-radius: math.div($hds-form-toggle-control-height, 2);
|
|
|
133
137
|
}
|
|
134
138
|
}
|
|
135
139
|
|
|
136
|
-
// active
|
|
137
|
-
|
|
138
|
-
:active:not(:checked) + &,
|
|
139
|
-
.mock-active:not(:checked) + &,
|
|
140
|
-
:active:checked + &,
|
|
141
|
-
.mock-active:checked + & {
|
|
142
|
-
background-color: var(--token-color-palette-blue-400);
|
|
143
|
-
--border-color: var(--token-color-palette-blue-400);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
140
|
// INVALID
|
|
147
141
|
|
|
148
142
|
.hds-form-toggle--is-invalid :not(:checked) + & {
|
|
@@ -163,14 +157,6 @@ $hds-form-toggle-border-radius: math.div($hds-form-toggle-control-height, 2);
|
|
|
163
157
|
background-color: var(--token-color-palette-red-400);
|
|
164
158
|
}
|
|
165
159
|
|
|
166
|
-
.hds-form-toggle--is-invalid :active:not(:checked) + &,
|
|
167
|
-
.hds-form-toggle--is-invalid .mock-active:not(:checked) + &,
|
|
168
|
-
.hds-form-toggle--is-invalid :active:checked + &,
|
|
169
|
-
.hds-form-toggle--is-invalid .mock-active:checked + & {
|
|
170
|
-
background-color: var(--token-color-palette-red-400);
|
|
171
|
-
--border-color: var(--token-color-palette-red-400);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
160
|
// DISABLED
|
|
175
161
|
|
|
176
162
|
:disabled:not(:checked) + &,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashicorp/design-system-components",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.10",
|
|
4
4
|
"description": "HashiCorp Design System Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hashicorp",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@embroider/test-setup": "^1.5.0",
|
|
51
51
|
"@glimmer/component": "^1.0.4",
|
|
52
52
|
"@glimmer/tracking": "^1.0.4",
|
|
53
|
-
"@percy/cli": "^1.
|
|
53
|
+
"@percy/cli": "^1.5.1",
|
|
54
54
|
"@percy/ember": "^3.0.0",
|
|
55
55
|
"babel-eslint": "^10.1.0",
|
|
56
56
|
"broccoli-asset-rev": "^3.0.0",
|