@hashicorp/design-system-components 0.1.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/addon/components/hds/breadcrumb/index.hbs +13 -0
- package/addon/components/hds/breadcrumb/index.js +40 -0
- package/addon/components/hds/breadcrumb/item.hbs +26 -0
- package/addon/components/hds/breadcrumb/item.js +50 -0
- package/addon/components/hds/breadcrumb/truncation.hbs +23 -0
- package/addon/components/hds/button/index.js +7 -5
- package/app/components/hds/breadcrumb/index.js +1 -0
- package/app/components/hds/breadcrumb/item.js +1 -0
- package/app/components/hds/breadcrumb/truncation.js +1 -0
- package/app/styles/@hashicorp/design-system-components.scss +1 -0
- package/app/styles/components/breadcrumb.scss +189 -0
- package/app/styles/components/button.scss +54 -0
- package/app/styles/mixins/_focus-ring.scss +6 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @hashicorp/design-system-components
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#98](https://github.com/hashicorp/design-system/pull/98) [`411cd9b9`](https://github.com/hashicorp/design-system/commit/411cd9b949e376d38eb1dc4d4af93ae17e6c686a) Thanks [@didoo](https://github.com/didoo)! - refactored the “focus-ring” mixins to support both “action” (default) and “critical“ colors
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`411cd9b9`](https://github.com/hashicorp/design-system/commit/411cd9b949e376d38eb1dc4d4af93ae17e6c686a)]:
|
|
10
|
+
- @hashicorp/design-system-tokens@0.7.0
|
|
11
|
+
|
|
12
|
+
## 0.3.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#48](https://github.com/hashicorp/design-system/pull/48) [`971efb9e`](https://github.com/hashicorp/design-system/commit/971efb9e92478e4d88c24aeee835f448f35d2066) Thanks [@didoo](https://github.com/didoo)! - Added "Breadcrumb" component
|
|
17
|
+
|
|
18
|
+
## 0.2.0
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- [#76](https://github.com/hashicorp/design-system/pull/76) [`48a82d54`](https://github.com/hashicorp/design-system/commit/48a82d545817c280d022cf95b2f3a691dc3c46a3) Thanks [@didoo](https://github.com/didoo)! - Added the "tertiary" color variant to the "Button" component
|
|
23
|
+
|
|
24
|
+
* [#77](https://github.com/hashicorp/design-system/pull/77) [`c08711e4`](https://github.com/hashicorp/design-system/commit/c08711e4fa3fac0cd3418b8afa1a0c4c254e8fac) Thanks [@didoo](https://github.com/didoo)! - Fixed the "elevation" treatment for the "Button" component
|
|
25
|
+
|
|
3
26
|
## 0.1.2
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<nav
|
|
2
|
+
class={{this.classNames}}
|
|
3
|
+
{{!
|
|
4
|
+
TODO: should this string be localized, like in Structure? https://github.com/hashicorp/structure/blob/dffbb0e0ae5246d3b832586ab25bcb981a052b30/packages/pds-ember/addon/components/pds/breadcrumbs/index.hbs#L3
|
|
5
|
+
(in which case, we need to expose a prop? or start to have localization in the HDS system?)
|
|
6
|
+
}}
|
|
7
|
+
aria-label="breadcrumbs"
|
|
8
|
+
...attributes
|
|
9
|
+
>
|
|
10
|
+
<ol class="hds-breadcrumb__list" {{did-insert this.didInsert}}>
|
|
11
|
+
{{yield}}
|
|
12
|
+
</ol>
|
|
13
|
+
</nav>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
|
|
3
|
+
const noop = () => {};
|
|
4
|
+
|
|
5
|
+
export default class HdsBreadcrumbComponent extends Component {
|
|
6
|
+
/**
|
|
7
|
+
* @param onDidInsert
|
|
8
|
+
* @type {function}
|
|
9
|
+
* @default () => {}
|
|
10
|
+
*/
|
|
11
|
+
get didInsert() {
|
|
12
|
+
// TODO discuss with Matthew if this is the right way to create a guard for this method
|
|
13
|
+
return this.args.didInsert ?? noop;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param itemsCanWrap
|
|
18
|
+
* @type {boolean}
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
get itemsCanWrap() {
|
|
22
|
+
return this.args.itemsCanWrap ?? true;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Get the class names to apply to the component.
|
|
27
|
+
* @method Breadcrumb#classNames
|
|
28
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
29
|
+
*/
|
|
30
|
+
get classNames() {
|
|
31
|
+
let classes = ['hds-breadcrumb'];
|
|
32
|
+
|
|
33
|
+
// add a class based on the @itemsCanWrap argument
|
|
34
|
+
if (this.itemsCanWrap) {
|
|
35
|
+
classes.push('hds-breadcrumb--items-can-wrap');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return classes.join(' ');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<li class="hds-breadcrumb__item" style={{this.itemStyle}} ...attributes>
|
|
2
|
+
{{#if @current}}
|
|
3
|
+
<div class="hds-breadcrumb__current">
|
|
4
|
+
{{#if @icon}}
|
|
5
|
+
<div class="hds-breadcrumb__icon">
|
|
6
|
+
<FlightIcon @name={{@icon}} @size="16" @stretched={{true}} />
|
|
7
|
+
</div>
|
|
8
|
+
{{/if}}
|
|
9
|
+
<span class="hds-breadcrumb__text">{{@text}}</span>
|
|
10
|
+
</div>
|
|
11
|
+
{{else}}
|
|
12
|
+
<LinkTo
|
|
13
|
+
class="hds-breadcrumb__link {{if @hover 'is-hover'}} {{if @active 'is-active'}} {{if @focus 'is-focus'}}"
|
|
14
|
+
@models={{hds-link-to-models @model @models}}
|
|
15
|
+
@query={{hds-link-to-query @query}}
|
|
16
|
+
@route={{@route}}
|
|
17
|
+
>
|
|
18
|
+
{{#if @icon}}
|
|
19
|
+
<div class="hds-breadcrumb__icon">
|
|
20
|
+
<FlightIcon @name={{@icon}} @size="16" @stretched={{true}} />
|
|
21
|
+
</div>
|
|
22
|
+
{{/if}}
|
|
23
|
+
<span class="hds-breadcrumb__text">{{@text}}</span>
|
|
24
|
+
</LinkTo>
|
|
25
|
+
{{/if}}
|
|
26
|
+
</li>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { htmlSafe } from '@ember/template';
|
|
3
|
+
import { assert } from '@ember/debug';
|
|
4
|
+
|
|
5
|
+
export default class HdsBreadcrumbItemComponent extends Component {
|
|
6
|
+
/**
|
|
7
|
+
* @param maxWidth
|
|
8
|
+
* @type {string}
|
|
9
|
+
* @default undefined
|
|
10
|
+
* @description A parameter that can be applied to an "item" to limit its max-width
|
|
11
|
+
*/
|
|
12
|
+
get maxWidth() {
|
|
13
|
+
let { maxWidth } = this.args;
|
|
14
|
+
|
|
15
|
+
if (maxWidth) {
|
|
16
|
+
assert(
|
|
17
|
+
`@maxWidth for "Hds::Breadcrumb::Item" must be a size as number in 'px' or in 'em' (eg. '200px' or '24em'), received: ${maxWidth}`,
|
|
18
|
+
maxWidth.match(/^\d+(px|em)$/)
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
return maxWidth;
|
|
22
|
+
} else {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get the inline style to apply to the item.
|
|
29
|
+
* @method BreadcrumbItem#itemStyle
|
|
30
|
+
* @return {string} The "style" attribute to apply to the item.
|
|
31
|
+
*/
|
|
32
|
+
get itemStyle() {
|
|
33
|
+
if (this.maxWidth) {
|
|
34
|
+
return htmlSafe(`max-width: ${this.maxWidth}`);
|
|
35
|
+
} else {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Get the class names to apply to the component.
|
|
42
|
+
* @method BreadcrumbItem#classNames
|
|
43
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
44
|
+
*/
|
|
45
|
+
get classNames() {
|
|
46
|
+
let classes = ['hds-breadcrumb__item'];
|
|
47
|
+
|
|
48
|
+
return classes.join(' ');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<li class="hds-breadcrumb__item hds-breadcrumb__item--is-truncation" ...attributes>
|
|
2
|
+
<Hds::Disclosure>
|
|
3
|
+
<:toggle as |t|>
|
|
4
|
+
<button
|
|
5
|
+
type="button"
|
|
6
|
+
class="hds-breadcrumb__truncation-toggle
|
|
7
|
+
{{if @hover 'is-hover'}}
|
|
8
|
+
{{if @active 'is-active'}}
|
|
9
|
+
{{if @focus 'is-focus'}}"
|
|
10
|
+
{{on "click" t.onClickToggle}}
|
|
11
|
+
>
|
|
12
|
+
<FlightIcon @name="more-horizontal" @size="16" @isInlineBlock={{false}} />
|
|
13
|
+
</button>
|
|
14
|
+
</:toggle>
|
|
15
|
+
<:content>
|
|
16
|
+
<div class="hds-breadcrumb__truncation-content">
|
|
17
|
+
<ol class="hds-breadcrumb__sublist">
|
|
18
|
+
{{yield}}
|
|
19
|
+
</ol>
|
|
20
|
+
</div>
|
|
21
|
+
</:content>
|
|
22
|
+
</Hds::Disclosure>
|
|
23
|
+
</li>
|
|
@@ -6,7 +6,7 @@ export const DEFAULT_COLOR = 'primary';
|
|
|
6
6
|
export const DEFAULT_TYPE = 'button';
|
|
7
7
|
export const DEFAULT_ICONPOSITION = 'leading';
|
|
8
8
|
export const SIZES = ['small', 'medium', 'large'];
|
|
9
|
-
export const COLORS = ['primary', 'secondary', 'critical'];
|
|
9
|
+
export const COLORS = ['primary', 'secondary', 'tertiary', 'critical'];
|
|
10
10
|
export const TYPES = ['button', 'submit', 'reset'];
|
|
11
11
|
export const ICONPOSITIONS = ['leading', 'trailing'];
|
|
12
12
|
|
|
@@ -72,6 +72,11 @@ export default class HdsButtonIndexComponent extends Component {
|
|
|
72
72
|
* @description The name of the icon to be used.
|
|
73
73
|
*/
|
|
74
74
|
get icon() {
|
|
75
|
+
assert(
|
|
76
|
+
`when the "Hds::Button" @color is "tertiary" an @icon is required`,
|
|
77
|
+
!(this.color === 'tertiary' && !this.args.icon)
|
|
78
|
+
);
|
|
79
|
+
|
|
75
80
|
return this.args.icon ?? null;
|
|
76
81
|
}
|
|
77
82
|
|
|
@@ -162,7 +167,7 @@ export default class HdsButtonIndexComponent extends Component {
|
|
|
162
167
|
|
|
163
168
|
/**
|
|
164
169
|
* Get the class names to apply to the component.
|
|
165
|
-
* @method
|
|
170
|
+
* @method Button#classNames
|
|
166
171
|
* @return {string} The "class" attribute to apply to the component.
|
|
167
172
|
*/
|
|
168
173
|
// "hds-button {{this.sizeClass}} {{this.colorClass}} {{this.widthClass}}"
|
|
@@ -180,9 +185,6 @@ export default class HdsButtonIndexComponent extends Component {
|
|
|
180
185
|
classes.push('hds-button--width-full');
|
|
181
186
|
}
|
|
182
187
|
|
|
183
|
-
// the button has a "low" elevation effect applied to it
|
|
184
|
-
classes.push('hds-elevation-low');
|
|
185
|
-
|
|
186
188
|
return classes.join(' ');
|
|
187
189
|
}
|
|
188
190
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/breadcrumb/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/breadcrumb/item';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/breadcrumb/truncation';
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
//
|
|
2
|
+
// BREADCRUMB
|
|
3
|
+
//
|
|
4
|
+
// properties within each class are sorted alphabetically
|
|
5
|
+
//
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
@use "../mixins/focus-ring" as *;
|
|
9
|
+
|
|
10
|
+
$hds-breadcrumb-item-height: 28px;
|
|
11
|
+
$hds-breadcrumb-item-border-radius: 5px;
|
|
12
|
+
$hds-breadcrumb-item-visual-horizontal-padding: 4px;
|
|
13
|
+
|
|
14
|
+
// MAIN CONTAINER (NAV)
|
|
15
|
+
.hds-breadcrumb {
|
|
16
|
+
position: relative;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// LIST (OL)
|
|
20
|
+
|
|
21
|
+
.hds-breadcrumb__list {
|
|
22
|
+
display: flex;
|
|
23
|
+
list-style: none;
|
|
24
|
+
margin: 0;
|
|
25
|
+
padding: 0;
|
|
26
|
+
|
|
27
|
+
.hds-breadcrumb--items-can-wrap & {
|
|
28
|
+
flex-wrap: wrap;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.hds-breadcrumb__sublist {
|
|
33
|
+
list-style: none;
|
|
34
|
+
margin: 0;
|
|
35
|
+
padding: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ITEM (LI)
|
|
39
|
+
|
|
40
|
+
.hds-breadcrumb__item {
|
|
41
|
+
align-items: center;
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: row;
|
|
44
|
+
min-width: 0;
|
|
45
|
+
position: relative;
|
|
46
|
+
|
|
47
|
+
.hds-breadcrumb__list > & {
|
|
48
|
+
&:not(:last-child)::after {
|
|
49
|
+
color: var(--token-color-palette-neutral-300);
|
|
50
|
+
content: "/";
|
|
51
|
+
padding: 0 8px;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.hds-breadcrumb__sublist > & + & {
|
|
56
|
+
margin-top: 4px;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.hds-breadcrumb__item--is-truncation {
|
|
61
|
+
flex: none; // needed to avoid that the "flex" parent collapses the truncation element (it happens with very long strings and no-wrapping)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// LINK (A)
|
|
65
|
+
|
|
66
|
+
.hds-breadcrumb__link {
|
|
67
|
+
align-items: center;
|
|
68
|
+
border-radius: $hds-breadcrumb-item-border-radius;
|
|
69
|
+
color: var(--token-color-foreground-faint);
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: row;
|
|
72
|
+
margin: 0 (-$hds-breadcrumb-item-visual-horizontal-padding); // we use a negative horizontal margin to counter-balance the horizonal padding (used to shift the focus from the content)
|
|
73
|
+
min-width: 0;
|
|
74
|
+
padding: 0 $hds-breadcrumb-item-visual-horizontal-padding;
|
|
75
|
+
// notice: the text decoration is applied directly to the "text" container because of a bug in Safari (see https://github.com/hashicorp/design-system-components/issues/159)
|
|
76
|
+
text-decoration-color: transparent;
|
|
77
|
+
|
|
78
|
+
// we apply the focus directly to the element, without using a pseudo-element
|
|
79
|
+
@include hds-focus-ring-basic();
|
|
80
|
+
|
|
81
|
+
&:hover,
|
|
82
|
+
&.is-hover {
|
|
83
|
+
color: var(--token-color-palette-neutral-600);
|
|
84
|
+
|
|
85
|
+
> .hds-breadcrumb__text {
|
|
86
|
+
text-decoration-color: currentColor;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&:active,
|
|
91
|
+
&.is-active {
|
|
92
|
+
color: var(--token-color-foreground-secondary);
|
|
93
|
+
|
|
94
|
+
> .hds-breadcrumb__text {
|
|
95
|
+
text-decoration-color: currentColor;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// CURRENT
|
|
101
|
+
|
|
102
|
+
.hds-breadcrumb__current {
|
|
103
|
+
align-items: center;
|
|
104
|
+
color: var(--token-color-foreground-strong);
|
|
105
|
+
display: flex;
|
|
106
|
+
flex-direction: row;
|
|
107
|
+
margin: 0 (-$hds-breadcrumb-item-visual-horizontal-padding); // we use a negative horizontal margin to counter-balance the horizonal padding (used to shift the focus from the content)
|
|
108
|
+
min-width: 0;
|
|
109
|
+
padding: 0 $hds-breadcrumb-item-visual-horizontal-padding;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// SUB-ELEMENTS
|
|
113
|
+
|
|
114
|
+
.hds-breadcrumb__icon {
|
|
115
|
+
flex: none;
|
|
116
|
+
margin-right: 6px;
|
|
117
|
+
height: 13px;
|
|
118
|
+
width: 13px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.hds-breadcrumb__text {
|
|
122
|
+
font-family: var(--token-typography-font-stack-text);
|
|
123
|
+
font-size: 0.8125rem; // 13px
|
|
124
|
+
line-height: 1rem; // 16px
|
|
125
|
+
overflow: hidden;
|
|
126
|
+
// we use the extra vertical padding to force the height of the parent item to be exactly $hds-breadcrumb-item-height
|
|
127
|
+
padding: calc((#{$hds-breadcrumb-item-height} - 1rem) / 2) 0;
|
|
128
|
+
text-decoration: underline;
|
|
129
|
+
text-decoration-color: transparent;
|
|
130
|
+
text-overflow: ellipsis;
|
|
131
|
+
white-space: nowrap;
|
|
132
|
+
|
|
133
|
+
.hds-breadcrumb__sublist & {
|
|
134
|
+
white-space: normal;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// TRUNCATION
|
|
139
|
+
|
|
140
|
+
.hds-breadcrumb__truncation-toggle {
|
|
141
|
+
align-items: center;
|
|
142
|
+
background-color: transparent;
|
|
143
|
+
border: 1px solid transparent; // We need this to be transparent for a11y
|
|
144
|
+
border-radius: $hds-breadcrumb-item-border-radius;
|
|
145
|
+
color: var(--token-color-foreground-faint);
|
|
146
|
+
cursor: pointer;
|
|
147
|
+
display: flex;
|
|
148
|
+
flex: none;
|
|
149
|
+
height: $hds-breadcrumb-item-height;
|
|
150
|
+
justify-content: center;
|
|
151
|
+
margin: 0 (-$hds-breadcrumb-item-visual-horizontal-padding); // the horizontal negative margin applied here is for visual balance of the spacing between items
|
|
152
|
+
outline: none; // TODO check with @melanie
|
|
153
|
+
padding: 0;
|
|
154
|
+
width: $hds-breadcrumb-item-height;
|
|
155
|
+
|
|
156
|
+
// we apply the focus directly to the element, without using a pseudo-element
|
|
157
|
+
@include hds-focus-ring-basic();
|
|
158
|
+
|
|
159
|
+
&:hover,
|
|
160
|
+
&.is-hover {
|
|
161
|
+
border-color: var(--token-color-border-strong);
|
|
162
|
+
color: var(--token-color-foreground-faint);
|
|
163
|
+
}
|
|
164
|
+
&:active,
|
|
165
|
+
&.is-active {
|
|
166
|
+
background-color: var(--token-color-surface-interactive-active);
|
|
167
|
+
border-color: var(--token-color-border-strong);
|
|
168
|
+
color: var(--token-color-foreground-primary);
|
|
169
|
+
}
|
|
170
|
+
&:focus,
|
|
171
|
+
&.is-focus {
|
|
172
|
+
background-color: transparent;
|
|
173
|
+
border: none; // important: we need to completely remove the border, of the inner box-shadow of the focus ring will be drawn inside the border
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.hds-breadcrumb__truncation-content {
|
|
178
|
+
background-color: var(--token-color-surface-primary);
|
|
179
|
+
border-radius: 6px;
|
|
180
|
+
box-shadow: var(--token-surface-high-box-shadow);
|
|
181
|
+
left: -$hds-breadcrumb-item-visual-horizontal-padding;
|
|
182
|
+
margin-top: 4px;
|
|
183
|
+
max-width: 200px; // by design
|
|
184
|
+
padding: 6px 12px;
|
|
185
|
+
position: absolute;
|
|
186
|
+
top: 100%;
|
|
187
|
+
width: max-content;
|
|
188
|
+
z-index: 300; // this is the z-index used in Structure for this kind of things, I am reusing the same value
|
|
189
|
+
}
|
|
@@ -59,6 +59,8 @@ $hds-button-focus-border-width: 3px;
|
|
|
59
59
|
|
|
60
60
|
&:focus,
|
|
61
61
|
&.is-focus {
|
|
62
|
+
box-shadow: none;
|
|
63
|
+
|
|
62
64
|
&::before {
|
|
63
65
|
// the position absolute of an element is computed from the inside of the border of the container
|
|
64
66
|
// so we have to take in account the border width of the pseudo-element container itself
|
|
@@ -141,6 +143,7 @@ $size-props: (
|
|
|
141
143
|
.hds-button--color-primary {
|
|
142
144
|
background-color: var(--token-color-palette-blue-200);
|
|
143
145
|
border-color: var(--token-color-palette-blue-300);
|
|
146
|
+
box-shadow: var(--token-elevation-low-box-shadow);
|
|
144
147
|
color: var(--token-color-foreground-high-contrast);
|
|
145
148
|
|
|
146
149
|
&:focus,
|
|
@@ -183,6 +186,7 @@ $size-props: (
|
|
|
183
186
|
.hds-button--color-secondary {
|
|
184
187
|
background-color: var(--token-color-surface-faint);
|
|
185
188
|
border-color: var(--token-color-border-strong);
|
|
189
|
+
box-shadow: var(--token-elevation-low-box-shadow);
|
|
186
190
|
color: var(--token-color-foreground-primary);
|
|
187
191
|
|
|
188
192
|
&:focus,
|
|
@@ -213,9 +217,59 @@ $size-props: (
|
|
|
213
217
|
}
|
|
214
218
|
}
|
|
215
219
|
|
|
220
|
+
.hds-button--color-tertiary {
|
|
221
|
+
background-color: transparent;
|
|
222
|
+
border-color: transparent;
|
|
223
|
+
color: var(--token-color-foreground-action);
|
|
224
|
+
|
|
225
|
+
&:focus,
|
|
226
|
+
&.is-focus {
|
|
227
|
+
border-color: var(--token-color-focus-action-internal);
|
|
228
|
+
color: var(--token-color-foreground-action);
|
|
229
|
+
&::before {
|
|
230
|
+
border-color: var(--token-color-focus-action-external);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
&:hover,
|
|
234
|
+
&.is-hover {
|
|
235
|
+
background-color: var(--token-color-surface-primary);
|
|
236
|
+
border-color: var(--token-color-border-strong);
|
|
237
|
+
color: var(--token-color-foreground-action-hover);
|
|
238
|
+
cursor: pointer;
|
|
239
|
+
}
|
|
240
|
+
&:active,
|
|
241
|
+
&.is-active {
|
|
242
|
+
background-color: var(--token-color-surface-interactive-active);
|
|
243
|
+
border-color: var(--token-color-border-strong);
|
|
244
|
+
box-shadow: none;
|
|
245
|
+
color: var(--token-color-foreground-action-active);
|
|
246
|
+
&::before {
|
|
247
|
+
border-color: transparent;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
&:disabled,
|
|
252
|
+
&[disabled],
|
|
253
|
+
&.is-disabled,
|
|
254
|
+
&:disabled:focus,
|
|
255
|
+
&[disabled]:focus,
|
|
256
|
+
&.is-disabled:focus,
|
|
257
|
+
&:disabled:hover,
|
|
258
|
+
&[disabled]:hover,
|
|
259
|
+
&.is-disabled:hover {
|
|
260
|
+
background-color: transparent;
|
|
261
|
+
border-color: transparent;
|
|
262
|
+
|
|
263
|
+
&::before {
|
|
264
|
+
border-color: transparent;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
216
269
|
.hds-button--color-critical {
|
|
217
270
|
background-color: var(--token-color-surface-critical);
|
|
218
271
|
border-color: var(--token-color-foreground-critical-on-surface);
|
|
272
|
+
box-shadow: var(--token-elevation-low-box-shadow);
|
|
219
273
|
color: var(--token-color-foreground-critical-on-surface);
|
|
220
274
|
|
|
221
275
|
&:focus,
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// - https://github.com/hashicorp/design-system-components/issues/161
|
|
3
3
|
// - https://www.tpgi.com/focus-visible-and-backwards-compatibility/
|
|
4
4
|
|
|
5
|
-
@mixin hds-focus-ring-basic() {
|
|
5
|
+
@mixin hds-focus-ring-basic($color: action) {
|
|
6
6
|
outline-style: solid; // used to avoid double outline+focus-ring in Safari (see https://github.com/hashicorp/design-system-components/issues/161#issuecomment-1031548656)
|
|
7
7
|
outline-color: transparent;
|
|
8
8
|
|
|
9
9
|
// default focus for browsers that still rely on ":focus"
|
|
10
10
|
&:focus,
|
|
11
11
|
&.is-focus {
|
|
12
|
-
box-shadow: var(--token-focus-ring-box-shadow);
|
|
12
|
+
box-shadow: var(--token-focus-ring-#{$color}-box-shadow);
|
|
13
13
|
}
|
|
14
14
|
// undo the previous declaration for browsers that support ":focus-visible" but wouldn't normally show default focus styles
|
|
15
15
|
&:focus:not(:focus-visible) {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
}
|
|
18
18
|
// set focus for browsers that support ":focus-visible"
|
|
19
19
|
&:focus-visible {
|
|
20
|
-
box-shadow: var(--token-focus-ring-box-shadow);
|
|
20
|
+
box-shadow: var(--token-focus-ring-#{$color}-box-shadow);
|
|
21
21
|
}
|
|
22
22
|
// remove the focus ring on "active + focused" state (by design)
|
|
23
23
|
&:focus:active,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
@mixin hds-focus-ring-with-pseudo-element($top: 0, $right: 0, $bottom: 0, $left: 0, $radius: 5px) {
|
|
29
|
+
@mixin hds-focus-ring-with-pseudo-element($top: 0, $right: 0, $bottom: 0, $left: 0, $radius: 5px, $color: action) {
|
|
30
30
|
isolation: isolate; // used to create a new stacking context (needed to have the pseudo element below text/icon but not the parent container)
|
|
31
31
|
outline-style: solid; // used to avoid double outline+focus-ring in Safari (see https://github.com/hashicorp/design-system-components/issues/161#issuecomment-1031548656)
|
|
32
32
|
outline-color: transparent;
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
&:focus,
|
|
49
49
|
&.is-focus {
|
|
50
50
|
&::before {
|
|
51
|
-
box-shadow: var(--token-focus-ring-box-shadow);
|
|
51
|
+
box-shadow: var(--token-focus-ring-#{$color}-box-shadow);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
// undo the previous declaration for browsers that support ":focus-visible" but wouldn't normally show default focus styles
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
// set focus for browsers that support ":focus-visible"
|
|
61
61
|
&:focus-visible {
|
|
62
62
|
&::before {
|
|
63
|
-
box-shadow: var(--token-focus-ring-box-shadow);
|
|
63
|
+
box-shadow: var(--token-focus-ring-#{$color}-box-shadow);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
// remove the focus ring on "active + focused" state (by design)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashicorp/design-system-components",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "HashiCorp Design System Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hashicorp",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"test:ember:percy": "percy exec ember test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@hashicorp/design-system-tokens": "^0.
|
|
37
|
+
"@hashicorp/design-system-tokens": "^0.7.0",
|
|
38
38
|
"@hashicorp/ember-flight-icons": "^2.0.1",
|
|
39
39
|
"ember-auto-import": "^2.2.3",
|
|
40
40
|
"ember-cli-babel": "^7.26.6",
|