@hashicorp/design-system-components 0.0.7 → 0.0.8
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/addon/components/hds/badge/index.js +18 -24
- package/addon/components/hds/badge-count/index.js +18 -24
- package/addon/components/hds/button/index.hbs +35 -0
- package/addon/components/hds/button/index.js +185 -0
- package/addon/components/hds/card/container.js +18 -24
- package/addon/components/hds/icon-tile/index.hbs +62 -0
- package/addon/components/hds/icon-tile/index.js +181 -0
- package/app/components/hds/button/index.js +1 -0
- package/app/components/hds/icon-tile/index.js +1 -0
- package/app/styles/@hashicorp/design-system-components.scss +2 -0
- package/app/styles/components/badge-count.scss +1 -0
- package/app/styles/components/badge.scss +6 -6
- package/app/styles/components/button.scss +246 -0
- package/app/styles/components/card/container.scss +1 -0
- package/app/styles/components/card/index.scss +1 -0
- package/app/styles/components/icon-tile.scss +147 -0
- package/package.json +3 -2
|
@@ -27,14 +27,12 @@ export default class HdsBadgeIndexComponent extends Component {
|
|
|
27
27
|
get size() {
|
|
28
28
|
let { size = DEFAULT_SIZE } = this.args;
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
);
|
|
37
|
-
}
|
|
30
|
+
assert(
|
|
31
|
+
`@size for "Hds::Badge" must be one of the following: ${SIZES.join(
|
|
32
|
+
', '
|
|
33
|
+
)}, received: ${size}`,
|
|
34
|
+
SIZES.includes(size)
|
|
35
|
+
);
|
|
38
36
|
|
|
39
37
|
return size;
|
|
40
38
|
}
|
|
@@ -59,14 +57,12 @@ export default class HdsBadgeIndexComponent extends Component {
|
|
|
59
57
|
get type() {
|
|
60
58
|
let { type = DEFAULT_TYPE } = this.args;
|
|
61
59
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
);
|
|
69
|
-
}
|
|
60
|
+
assert(
|
|
61
|
+
`@type for "Hds::Badge" must be one of the following: ${TYPES.join(
|
|
62
|
+
', '
|
|
63
|
+
)}, received: ${type}`,
|
|
64
|
+
TYPES.includes(type)
|
|
65
|
+
);
|
|
70
66
|
|
|
71
67
|
return type;
|
|
72
68
|
}
|
|
@@ -91,14 +87,12 @@ export default class HdsBadgeIndexComponent extends Component {
|
|
|
91
87
|
get color() {
|
|
92
88
|
let { color = DEFAULT_COLOR } = this.args;
|
|
93
89
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
);
|
|
101
|
-
}
|
|
90
|
+
assert(
|
|
91
|
+
`@color for "Hds::Badge" must be one of the following: ${COLORS.join(
|
|
92
|
+
', '
|
|
93
|
+
)}, received: ${color}`,
|
|
94
|
+
COLORS.includes(color)
|
|
95
|
+
);
|
|
102
96
|
|
|
103
97
|
return color;
|
|
104
98
|
}
|
|
@@ -20,14 +20,12 @@ export default class HdsBadgeCountIndexComponent extends Component {
|
|
|
20
20
|
get size() {
|
|
21
21
|
let { size = DEFAULT_SIZE } = this.args;
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
);
|
|
30
|
-
}
|
|
23
|
+
assert(
|
|
24
|
+
`@size for "Hds::BadgeCount" must be one of the following: ${SIZES.join(
|
|
25
|
+
', '
|
|
26
|
+
)}, received: ${size}`,
|
|
27
|
+
SIZES.includes(size)
|
|
28
|
+
);
|
|
31
29
|
|
|
32
30
|
return size;
|
|
33
31
|
}
|
|
@@ -52,14 +50,12 @@ export default class HdsBadgeCountIndexComponent extends Component {
|
|
|
52
50
|
get type() {
|
|
53
51
|
let { type = DEFAULT_TYPE } = this.args;
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
);
|
|
62
|
-
}
|
|
53
|
+
assert(
|
|
54
|
+
`@type for "Hds::BadgeCount" must be one of the following: ${TYPES.join(
|
|
55
|
+
', '
|
|
56
|
+
)}, received: ${type}`,
|
|
57
|
+
TYPES.includes(type)
|
|
58
|
+
);
|
|
63
59
|
|
|
64
60
|
return type;
|
|
65
61
|
}
|
|
@@ -84,14 +80,12 @@ export default class HdsBadgeCountIndexComponent extends Component {
|
|
|
84
80
|
get color() {
|
|
85
81
|
let { color = DEFAULT_COLOR } = this.args;
|
|
86
82
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
);
|
|
94
|
-
}
|
|
83
|
+
assert(
|
|
84
|
+
`@color for "Hds::BadgeCount" must be one of the following: ${COLORS.join(
|
|
85
|
+
', '
|
|
86
|
+
)}, received: ${color}`,
|
|
87
|
+
COLORS.includes(color)
|
|
88
|
+
);
|
|
95
89
|
|
|
96
90
|
return color;
|
|
97
91
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<button
|
|
2
|
+
class="hds-button {{this.sizeClass}} {{this.colorClass}} {{this.widthClass}}"
|
|
3
|
+
...attributes
|
|
4
|
+
aria-label={{if this.isIconOnly this.text null}}
|
|
5
|
+
type={{this.type}}
|
|
6
|
+
disabled={{if this.isDisabled "disabled" null}}
|
|
7
|
+
>
|
|
8
|
+
{{#if this.isIconOnly}}
|
|
9
|
+
<div class="hds-button__icon">
|
|
10
|
+
<FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />
|
|
11
|
+
</div>
|
|
12
|
+
{{else}}
|
|
13
|
+
{{#if this.icon}}
|
|
14
|
+
{{#if (eq this.iconPos "leading")}}
|
|
15
|
+
<div class="hds-button__icon">
|
|
16
|
+
<FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />
|
|
17
|
+
</div>
|
|
18
|
+
<div class="hds-button__text">
|
|
19
|
+
{{this.text}}
|
|
20
|
+
</div>
|
|
21
|
+
{{else}}
|
|
22
|
+
<div class="hds-button__text">
|
|
23
|
+
{{this.text}}
|
|
24
|
+
</div>
|
|
25
|
+
<div class="hds-button__icon">
|
|
26
|
+
<FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />
|
|
27
|
+
</div>
|
|
28
|
+
{{/if}}
|
|
29
|
+
{{else}}
|
|
30
|
+
<div class="hds-button__text">
|
|
31
|
+
{{this.text}}
|
|
32
|
+
</div>
|
|
33
|
+
{{/if}}
|
|
34
|
+
{{/if}}
|
|
35
|
+
</button>
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { assert } from '@ember/debug';
|
|
3
|
+
|
|
4
|
+
export const DEFAULT_SIZE = 'medium';
|
|
5
|
+
export const DEFAULT_COLOR = 'primary';
|
|
6
|
+
export const DEFAULT_TYPE = 'button';
|
|
7
|
+
export const SIZES = ['small', 'medium', 'large'];
|
|
8
|
+
export const COLORS = ['primary', 'secondary', 'destructive'];
|
|
9
|
+
export const TYPES = ['button', 'submit', 'reset'];
|
|
10
|
+
|
|
11
|
+
export default class HdsButtonIndexComponent extends Component {
|
|
12
|
+
/**
|
|
13
|
+
* @param text
|
|
14
|
+
* @type {string}
|
|
15
|
+
* @description The text of the button or value of `aria-label` if `isIconOnly` is set to `true`. If no text value is defined an error will be thrown.
|
|
16
|
+
*/
|
|
17
|
+
get text() {
|
|
18
|
+
let { text } = this.args;
|
|
19
|
+
|
|
20
|
+
assert(
|
|
21
|
+
'@text for "Hds::Button" must have a valid value',
|
|
22
|
+
text !== undefined
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return text;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @param size
|
|
30
|
+
* @type {string}
|
|
31
|
+
* @default medium
|
|
32
|
+
* @description The size of the button; acceptable values are `small`, `medium`, and `large`
|
|
33
|
+
*/
|
|
34
|
+
get size() {
|
|
35
|
+
let { size = DEFAULT_SIZE } = this.args;
|
|
36
|
+
|
|
37
|
+
assert(
|
|
38
|
+
`@size for "Hds::Button" must be one of the following: ${SIZES.join(
|
|
39
|
+
', '
|
|
40
|
+
)}; received: ${size}`,
|
|
41
|
+
SIZES.includes(size)
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
return size;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param sizeClass
|
|
49
|
+
* @type {string}
|
|
50
|
+
* @default hds-button--size-medium
|
|
51
|
+
* @description Determines the CSS class that the button should have, based on the size value; automatically set.
|
|
52
|
+
*/
|
|
53
|
+
get sizeClass() {
|
|
54
|
+
return `hds-button--size-${this.size}`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @param color
|
|
59
|
+
* @type {string}
|
|
60
|
+
* @default primary
|
|
61
|
+
* @description Determines the color of button to be used; acceptable values are `primary`, `secondary`, and `destructive`
|
|
62
|
+
*/
|
|
63
|
+
get color() {
|
|
64
|
+
let { color = DEFAULT_COLOR } = this.args;
|
|
65
|
+
|
|
66
|
+
assert(
|
|
67
|
+
`@color for "Hds::Button" must be one of the following: ${COLORS.join(
|
|
68
|
+
', '
|
|
69
|
+
)}; received: ${color}`,
|
|
70
|
+
COLORS.includes(color)
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
return color;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @param colorClass
|
|
78
|
+
* @type {string}
|
|
79
|
+
* @default hds-button--color-primary
|
|
80
|
+
* @description Determines the CSS class that the button should have, based on the color value; automatically set
|
|
81
|
+
*/
|
|
82
|
+
get colorClass() {
|
|
83
|
+
return `hds-button--color-${this.color}`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @param icon
|
|
88
|
+
* @type {string}
|
|
89
|
+
* @default null
|
|
90
|
+
* @description The name of the icon to be used.
|
|
91
|
+
*/
|
|
92
|
+
get icon() {
|
|
93
|
+
return this.args.icon ?? null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @param isIconOnly
|
|
98
|
+
* @type {boolean}
|
|
99
|
+
* @default false
|
|
100
|
+
* @description Indicates if the button will only contain an icon; component will also ensure that accessible text is still applied to the component.
|
|
101
|
+
*/
|
|
102
|
+
get isIconOnly() {
|
|
103
|
+
if (this.icon) {
|
|
104
|
+
return this.args.isIconOnly ?? false;
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @param iconPos
|
|
111
|
+
* @type {string}
|
|
112
|
+
* @default leading
|
|
113
|
+
* @description Positions the icon before or after the text; allowed values are `leading` or `trailing`
|
|
114
|
+
*/
|
|
115
|
+
get iconPos() {
|
|
116
|
+
return this.args.iconPos ?? 'leading';
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @param iconSize
|
|
121
|
+
* @type {string}
|
|
122
|
+
* @default 16
|
|
123
|
+
* @description ensures that the correct icon size is used. Automatically calculated.
|
|
124
|
+
*/
|
|
125
|
+
get iconSize() {
|
|
126
|
+
if (this.args.size === 'large') {
|
|
127
|
+
return '24';
|
|
128
|
+
} else {
|
|
129
|
+
return '16';
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @param type
|
|
135
|
+
* @type {string}
|
|
136
|
+
* @default button
|
|
137
|
+
* @description The value for the button's `type` attribute. Acceptable values are `button`, `submit`, and `reset`
|
|
138
|
+
*/
|
|
139
|
+
get type() {
|
|
140
|
+
let { type = DEFAULT_TYPE } = this.args;
|
|
141
|
+
|
|
142
|
+
assert(
|
|
143
|
+
`@type for "Hds::Button" must be one of the following: ${TYPES.join(
|
|
144
|
+
', '
|
|
145
|
+
)}; received: ${type}`,
|
|
146
|
+
TYPES.includes(type)
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
return type;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @param isFullWidth
|
|
154
|
+
* @type {boolean}
|
|
155
|
+
* @default false
|
|
156
|
+
* @description Indicates that a button should take up the full width of the parent container. The default is false.
|
|
157
|
+
*/
|
|
158
|
+
get isFullWidth() {
|
|
159
|
+
return this.args.isFullWidth ?? false;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @param widthClass
|
|
164
|
+
* @type {string|null}
|
|
165
|
+
* @default null
|
|
166
|
+
* @description Determines if the full-width class should be applied to the component. This is set automatically based on the value of `isFullWidth`.
|
|
167
|
+
*/
|
|
168
|
+
get widthClass() {
|
|
169
|
+
if (this.isFullWidth === true) {
|
|
170
|
+
return 'hds-button--width-full';
|
|
171
|
+
} else {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* @param isDisabled
|
|
178
|
+
* @type {boolean}
|
|
179
|
+
* @default null
|
|
180
|
+
* @description Sets the native HTML attribute `disabled` on the button element. Default is null (doesn't render the attribute).
|
|
181
|
+
*/
|
|
182
|
+
get isDisabled() {
|
|
183
|
+
return this.args.isDisabled ?? null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -20,14 +20,12 @@ export default class HdsCardContainerComponent extends Component {
|
|
|
20
20
|
get level() {
|
|
21
21
|
let { level = DEFAULT_LEVEL } = this.args;
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
);
|
|
30
|
-
}
|
|
23
|
+
assert(
|
|
24
|
+
`@level for "Hds::CardContainer" must be one of the following: ${LEVELS.join(
|
|
25
|
+
', '
|
|
26
|
+
)}, received: ${level}`,
|
|
27
|
+
LEVELS.includes(level)
|
|
28
|
+
);
|
|
31
29
|
|
|
32
30
|
return level;
|
|
33
31
|
}
|
|
@@ -52,14 +50,12 @@ export default class HdsCardContainerComponent extends Component {
|
|
|
52
50
|
get background() {
|
|
53
51
|
let { background = DEFAULT_BACKGROUND } = this.args;
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
);
|
|
62
|
-
}
|
|
53
|
+
assert(
|
|
54
|
+
`@background for "Hds::CardContainer" must be one of the following: ${BACKGROUNDS.join(
|
|
55
|
+
', '
|
|
56
|
+
)}, received: ${background}`,
|
|
57
|
+
BACKGROUNDS.includes(background)
|
|
58
|
+
);
|
|
63
59
|
|
|
64
60
|
return background;
|
|
65
61
|
}
|
|
@@ -93,14 +89,12 @@ export default class HdsCardContainerComponent extends Component {
|
|
|
93
89
|
get overflow() {
|
|
94
90
|
let { overflow = DEFAULT_OVERFLOW } = this.args;
|
|
95
91
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
);
|
|
103
|
-
}
|
|
92
|
+
assert(
|
|
93
|
+
`@overflow for "Hds::CardContainer" must be one of the following: ${OVERFLOWS.join(
|
|
94
|
+
', '
|
|
95
|
+
)}, received: ${overflow}`,
|
|
96
|
+
OVERFLOWS.includes(overflow)
|
|
97
|
+
);
|
|
104
98
|
|
|
105
99
|
return overflow;
|
|
106
100
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<div class="hds-icon-tile {{this.entityClass}} {{this.sizeClass}} {{this.colorClass}}" ...attributes>
|
|
2
|
+
{{#if @icon}}
|
|
3
|
+
<div class="hds-icon-tile__icon">
|
|
4
|
+
<FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched="true" />
|
|
5
|
+
</div>
|
|
6
|
+
{{/if}}
|
|
7
|
+
{{#if @logo}}
|
|
8
|
+
<div class="hds-icon-tile__logo">
|
|
9
|
+
{{!-- TODO! this will be replaced later with something else (TBD how we deliver these logos as design system) --}}
|
|
10
|
+
<svg width="100%" height="100%" viewBox="0 0 144 144" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
11
|
+
{{#if (eq this.logo 'boundary')}}
|
|
12
|
+
<path d="M44.83 125.83V117.56H62.01V112.45H53.68V104.13H93.01L74.74 72.49L93.01 40.84H52.7V84.73H31V19.15H105.67L118.13 40.73L99.8 72.49L118.5 104.89L106.41 125.83H44.83Z" fill="currentColor"/>
|
|
13
|
+
<path d="M48.1696 104.13H39.8496V112.45H48.1696V104.13Z" fill="currentColor"/>
|
|
14
|
+
<path d="M39.32 117.5H31V125.82H39.32V117.5Z" fill="currentColor"/>
|
|
15
|
+
{{/if}}
|
|
16
|
+
{{#if (eq this.logo 'consul')}}
|
|
17
|
+
<path d="M72.5298 126.56C63.6148 126.568 54.8328 124.399 46.946 120.243C39.0592 116.087 32.306 110.068 27.2724 102.71C22.2389 95.3524 19.0771 86.8772 18.0616 78.0203C17.0462 69.1634 18.2076 60.1924 21.4452 51.8862C24.6828 43.5799 29.8987 36.1893 36.6401 30.3559C43.3815 24.5225 51.4448 20.4225 60.13 18.4118C68.8153 16.4012 77.86 16.5406 86.4791 18.818C95.0982 21.0954 103.031 25.4419 109.59 31.4803V31.4803L96.5898 45.0804C91.4215 40.412 85.0101 37.343 78.1326 36.2453C71.2551 35.1476 64.2069 36.0684 57.8422 38.8961C51.4776 41.7238 46.0698 46.3369 42.2743 52.1764C38.4789 58.0158 36.4587 64.8308 36.4587 71.7953C36.4587 78.7599 38.4789 85.5749 42.2743 91.4143C46.0698 97.2538 51.4776 101.867 57.8422 104.695C64.2069 107.522 71.2551 108.443 78.1326 107.345C85.0101 106.248 91.4215 103.179 96.5898 98.5104L109.59 112.11C99.4912 121.413 86.26 126.572 72.5298 126.56V126.56Z" fill="currentColor"/>
|
|
18
|
+
<path d="M116.61 99.1604C115.722 99.1604 114.854 98.897 114.116 98.4037C113.377 97.9103 112.802 97.2091 112.462 96.3886C112.122 95.5682 112.033 94.6654 112.206 93.7944C112.38 92.9234 112.807 92.1234 113.435 91.4955C114.063 90.8675 114.863 90.4399 115.734 90.2666C116.605 90.0934 117.508 90.1823 118.328 90.5221C119.149 90.862 119.85 91.4375 120.343 92.1759C120.837 92.9142 121.1 93.7823 121.1 94.6704C121.097 95.8604 120.624 97.0009 119.782 97.8424C118.941 98.6838 117.8 99.1577 116.61 99.1604Z" fill="currentColor"/>
|
|
19
|
+
<path d="M72.1798 83.6504C69.8296 83.6603 67.5293 82.9723 65.5705 81.6736C63.6117 80.3749 62.0826 78.5239 61.1768 76.3553C60.271 74.1866 60.0294 71.7979 60.4825 69.4918C60.9357 67.1857 62.0632 65.066 63.7222 63.4013C65.3813 61.7366 67.4972 60.6019 69.8017 60.141C72.1063 59.6801 74.4958 59.9136 76.6675 60.8121C78.8392 61.7105 80.6953 63.2335 82.0007 65.1879C83.306 67.1423 84.0017 69.4401 83.9998 71.7904C83.9945 74.9273 82.7488 77.9348 80.5344 80.1567C78.32 82.3786 75.3167 83.6345 72.1798 83.6504Z" fill="currentColor"/>
|
|
20
|
+
<path d="M121.76 83.8604C120.871 83.8604 120.003 83.597 119.265 83.1037C118.527 82.6103 117.951 81.9091 117.611 81.0886C117.271 80.2682 117.183 79.3654 117.356 78.4944C117.529 77.6234 117.957 76.8234 118.585 76.1955C119.213 75.5675 120.013 75.1399 120.884 74.9666C121.755 74.7934 122.657 74.8823 123.478 75.2221C124.298 75.562 124.999 76.1375 125.493 76.8759C125.986 77.6142 126.25 78.4823 126.25 79.3704C126.247 80.5604 125.773 81.7009 124.932 82.5424C124.09 83.3838 122.95 83.8577 121.76 83.8604Z" fill="currentColor"/>
|
|
21
|
+
<path d="M108.41 83.3004C107.519 83.3003 106.649 83.0357 105.91 82.5401C105.171 82.0444 104.595 81.3402 104.257 80.5169C103.919 79.6935 103.833 78.7882 104.01 77.9159C104.187 77.0435 104.62 76.2436 105.253 75.6177C105.886 74.9918 106.69 74.5682 107.565 74.4006C108.439 74.2331 109.343 74.3292 110.163 74.6767C110.982 75.0242 111.68 75.6075 112.167 76.3524C112.655 77.0973 112.91 77.9703 112.9 78.8604C112.886 80.0425 112.408 81.1718 111.567 82.003C110.726 82.8343 109.592 83.3004 108.41 83.3004Z" fill="currentColor"/>
|
|
22
|
+
<path d="M121.76 68.7304C120.871 68.7304 120.003 68.467 119.265 67.9737C118.527 67.4803 117.951 66.7791 117.611 65.9586C117.271 65.1382 117.183 64.2354 117.356 63.3644C117.529 62.4934 117.957 61.6934 118.585 61.0655C119.213 60.4375 120.013 60.0099 120.884 59.8366C121.755 59.6634 122.657 59.7523 123.478 60.0922C124.298 60.432 124.999 61.0075 125.493 61.7459C125.986 62.4842 126.25 63.3523 126.25 64.2404C126.247 65.4304 125.773 66.5709 124.932 67.4124C124.09 68.2538 122.95 68.7277 121.76 68.7304Z" fill="currentColor"/>
|
|
23
|
+
<path d="M108.41 69.2404C107.522 69.2404 106.654 68.977 105.915 68.4837C105.177 67.9903 104.602 67.2891 104.262 66.4686C103.922 65.6482 103.833 64.7454 104.006 63.8744C104.179 63.0034 104.607 62.2034 105.235 61.5755C105.863 60.9475 106.663 60.5199 107.534 60.3467C108.405 60.1734 109.308 60.2623 110.128 60.6022C110.949 60.942 111.65 61.5175 112.143 62.2559C112.637 62.9942 112.9 63.8623 112.9 64.7504C112.9 65.9412 112.427 67.0832 111.585 67.9253C110.743 68.7673 109.601 69.2404 108.41 69.2404Z" fill="currentColor"/>
|
|
24
|
+
<path d="M116.87 53.6304C115.982 53.6324 115.113 53.3707 114.373 52.8785C113.633 52.3864 113.056 51.6858 112.715 50.8656C112.373 50.0453 112.283 49.1422 112.455 48.2706C112.627 47.3989 113.054 46.598 113.682 45.969C114.309 45.3401 115.109 44.9115 115.98 44.7374C116.852 44.5633 117.755 44.6517 118.576 44.9912C119.397 45.3308 120.099 45.9062 120.593 46.6448C121.087 47.3834 121.35 48.2519 121.35 49.1404C121.35 50.3295 120.878 51.47 120.039 52.3118C119.199 53.1535 118.059 53.6277 116.87 53.6304Z" fill="currentColor"/>
|
|
25
|
+
{{/if}}
|
|
26
|
+
{{#if (eq this.logo 'nomad')}}
|
|
27
|
+
<path d="M71.9995 14L21.7695 43V101L71.9995 130L122.23 101V43L71.9995 14ZM94.3795 77.78L80.9995 85.51L64.8295 76.71V95.19L49.6295 104.83V66.19L61.6895 58.81L78.4195 67.63V48.76L94.4195 39.17L94.3795 77.78Z" fill="currentColor"/>
|
|
28
|
+
{{/if}}
|
|
29
|
+
{{#if (eq this.logo 'packer')}}
|
|
30
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M35.0898 26.38L74.2198 49V132.38L35.0898 109.76V26.38Z" fill="currentColor"/>
|
|
31
|
+
<path d="M93.5996 36.13L51.0596 11.62V28.62L79.9996 45.34V96.39L93.6096 104.21C102.03 109.07 108.92 106.21 108.92 97.74V60.28C108.91 51.86 102 41 93.5996 36.13Z" fill="currentColor"/>
|
|
32
|
+
{{/if}}
|
|
33
|
+
{{#if (eq this.logo 'terraform')}}
|
|
34
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M55.52 32.97L88.48 51.99V90.05L55.52 71.02V32.97Z" fill="currentColor"/>
|
|
35
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M92.0898 51.99V90.05L125.04 71.02V32.97L92.0898 51.99Z" fill="currentColor"/>
|
|
36
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.96 11.73V49.78L51.91 68.81V30.76L18.96 11.73Z" fill="currentColor"/>
|
|
37
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M55.52 113.24L88.47 132.27V94.47V94.22L55.52 75.19V113.24Z" fill="currentColor"/>
|
|
38
|
+
{{/if}}
|
|
39
|
+
{{#if (eq this.logo 'vagrant')}}
|
|
40
|
+
{{!-- notice: this is the only one that has specific/fixed fill colors; at the moment we have to treat it as an exception --}}
|
|
41
|
+
<path d="M110.77 17.5498L86.6801 31.4598V39.9998L72.0001 74.5198L57.3201 39.9998V31.4598L33.2301 17.5498L18.5801 26.0198V35.8498L51.2101 115.77L72.0001 127.77L92.7901 115.77L125.42 35.8498V26.0198L110.77 17.5498Z" fill="#1868F2"/>
|
|
42
|
+
<path d="M125.42 26.0195L101.33 39.9195V48.4695L81.77 92.1895L72 97.8295V127.77L92.79 115.77L125.42 35.8495V26.0195Z" fill="#0850C5"/>
|
|
43
|
+
<path d="M57.3202 40V31.46L42.6602 39.92V48.47L62.2302 92.19L72.0002 86.55V74.52L57.3202 40Z" fill="#0850C5"/>
|
|
44
|
+
{{/if}}
|
|
45
|
+
{{#if (eq this.logo 'vault')}}
|
|
46
|
+
<path d="M16.8809 21.15L71.8009 131.4L127.121 21.15H16.8809ZM78.3409 43.27H84.7309V49.67H78.3409V43.27ZM65.6109 68.84H59.2209V62.45H65.6109V68.84ZM65.6109 59.25H59.2209V52.86H65.6109V59.25ZM65.6109 49.67H59.2209V43.27H65.6109V49.67ZM75.2009 78.43H68.8009V72H75.2009V78.43ZM75.2009 68.84H68.8009V62.45H75.2009V68.84ZM75.2009 59.25H68.8009V52.86H75.2009V59.25ZM75.2009 49.67H68.8009V43.27H75.2009V49.67ZM78.3409 52.86H84.7309V59.25H78.3409V52.86ZM78.3409 68.86V62.45H84.7309V68.84L78.3409 68.86Z" fill="currentColor"/>
|
|
47
|
+
{{/if}}
|
|
48
|
+
{{#if (eq this.logo 'waypoint')}}
|
|
49
|
+
<path d="M143.23 27.66L125.44 58.47L107.65 27.66H143.23Z" fill="currentColor"/>
|
|
50
|
+
<path d="M48.2595 48.23H36.3895L66.0595 99.63L54.1895 120.19L0.769531 27.66H60.1295L89.8095 79.07L95.7395 68.79L71.9995 27.66H95.7395L107.62 48.23L119.49 68.79L89.8095 120.19L48.2595 48.23Z" fill="currentColor"/>
|
|
51
|
+
{{/if}}
|
|
52
|
+
</svg>
|
|
53
|
+
</div>
|
|
54
|
+
{{/if}}
|
|
55
|
+
{{#if this.iconSecondary}}
|
|
56
|
+
<div class="hds-icon-tile__extra">
|
|
57
|
+
<div class="hds-icon-tile__extra-icon">
|
|
58
|
+
<FlightIcon @name={{this.iconSecondary}} @size="16" @stretched="true" />
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
{{/if}}
|
|
62
|
+
</div>
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { assert } from '@ember/debug';
|
|
3
|
+
|
|
4
|
+
export const DEFAULT_SIZE = 'medium';
|
|
5
|
+
export const DEFAULT_COLOR = 'neutral';
|
|
6
|
+
export const SIZES = ['small', 'medium', 'large'];
|
|
7
|
+
export const PRODUCTS = [
|
|
8
|
+
'boundary',
|
|
9
|
+
'consul',
|
|
10
|
+
'nomad',
|
|
11
|
+
'packer',
|
|
12
|
+
'terraform',
|
|
13
|
+
'vagrant',
|
|
14
|
+
'vault',
|
|
15
|
+
'waypoint',
|
|
16
|
+
];
|
|
17
|
+
export const COLORS = ['neutral', ...PRODUCTS];
|
|
18
|
+
|
|
19
|
+
export default class HdsIconTileIndexComponent extends Component {
|
|
20
|
+
/**
|
|
21
|
+
* Sets the size for the component
|
|
22
|
+
* Accepted values: small, medium, large
|
|
23
|
+
*
|
|
24
|
+
* @param size
|
|
25
|
+
* @type {string}
|
|
26
|
+
* @default 'medium'
|
|
27
|
+
*/
|
|
28
|
+
get size() {
|
|
29
|
+
let { size = DEFAULT_SIZE } = this.args;
|
|
30
|
+
|
|
31
|
+
assert(
|
|
32
|
+
`@size for "Hds::IconTile" must be one of the following: ${SIZES.join(
|
|
33
|
+
', '
|
|
34
|
+
)}, received: ${size}`,
|
|
35
|
+
SIZES.includes(size)
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return size;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Get a class to apply to the component based on the size argument.
|
|
43
|
+
* @method IconTile#sizeClass
|
|
44
|
+
* @return {string} The css class to apply to the component.
|
|
45
|
+
*/
|
|
46
|
+
get sizeClass() {
|
|
47
|
+
return `hds-icon-tile--size-${this.size}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Sets the color scheme for the component
|
|
52
|
+
* Accepted values: see THE COLORS LIST
|
|
53
|
+
*
|
|
54
|
+
* @param color
|
|
55
|
+
* @type {string}
|
|
56
|
+
* @default 'neutral'
|
|
57
|
+
*/
|
|
58
|
+
get color() {
|
|
59
|
+
let { color = DEFAULT_COLOR } = this.args;
|
|
60
|
+
|
|
61
|
+
// if it's a "logo" then we overwrite any @color parameter passed
|
|
62
|
+
// and just use the product "brand" color
|
|
63
|
+
if (this.logo) {
|
|
64
|
+
color = this.logo;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
assert(
|
|
68
|
+
`@color for "Hds::IconTile" must be one of the following: ${COLORS.join(
|
|
69
|
+
', '
|
|
70
|
+
)}, received: ${color}`,
|
|
71
|
+
COLORS.includes(color)
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
return color;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Get a class to apply to the component based on the color argument.
|
|
79
|
+
* @method IconTile#colorClass
|
|
80
|
+
* @return {string} The css class to apply to the component.
|
|
81
|
+
*/
|
|
82
|
+
get colorClass() {
|
|
83
|
+
return `hds-icon-tile--color-${this.color}`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Sets the icon name (one of the FlightIcons)
|
|
88
|
+
*
|
|
89
|
+
* @param icon
|
|
90
|
+
* @type {string|null}
|
|
91
|
+
* @default null
|
|
92
|
+
*/
|
|
93
|
+
get icon() {
|
|
94
|
+
return this.args.icon ?? null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @param iconSize
|
|
99
|
+
* @type {string}
|
|
100
|
+
* @default 16
|
|
101
|
+
* @description ensures that the correct icon size is used. Automatically calculated.
|
|
102
|
+
*/
|
|
103
|
+
get iconSize() {
|
|
104
|
+
if (this.args.size === 'small') {
|
|
105
|
+
return '16';
|
|
106
|
+
} else {
|
|
107
|
+
return '24';
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Sets the logo name if there is one
|
|
113
|
+
*
|
|
114
|
+
* @param logo
|
|
115
|
+
* @type {string|null}
|
|
116
|
+
* @default null
|
|
117
|
+
*/
|
|
118
|
+
get logo() {
|
|
119
|
+
let { logo } = this.args;
|
|
120
|
+
|
|
121
|
+
if (logo) {
|
|
122
|
+
assert(
|
|
123
|
+
`@logo for "Hds::IconTile" must be one of the following: ${PRODUCTS.join(
|
|
124
|
+
', '
|
|
125
|
+
)}, received: ${logo}`,
|
|
126
|
+
PRODUCTS.includes(logo)
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return logo ?? null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* We need to differentiate between a logo and an icon
|
|
135
|
+
* @method IconTile#entity
|
|
136
|
+
* @return {string} The kind of entity we're dealing with ("logo" or "icon")
|
|
137
|
+
*/
|
|
138
|
+
get entity() {
|
|
139
|
+
let entity;
|
|
140
|
+
|
|
141
|
+
// TODO: discuss if we want these kind of tests
|
|
142
|
+
assert(
|
|
143
|
+
`you can't pass both @logo and @icon properties to the "Hds::IconTile" component`,
|
|
144
|
+
!(this.args.logo && this.args.icon)
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
assert(
|
|
148
|
+
`you need to pass @logo or @icon to the "Hds::IconTile" component`,
|
|
149
|
+
!(this.args.logo === undefined && this.args.icon === undefined)
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
if (this.args.logo) {
|
|
153
|
+
entity = 'logo';
|
|
154
|
+
}
|
|
155
|
+
if (this.args.icon) {
|
|
156
|
+
entity = 'icon';
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return entity;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Get a class to apply to the component based on the its entity.
|
|
164
|
+
* @method IconTile#entityClass
|
|
165
|
+
* @return {string} The css class to apply to the component.
|
|
166
|
+
*/
|
|
167
|
+
get entityClass() {
|
|
168
|
+
return `hds-icon-tile--${this.entity}`;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Sets the "secondary" icon name (one of the FlightIcons)
|
|
173
|
+
*
|
|
174
|
+
* @param iconSecondary
|
|
175
|
+
* @type {string|null}
|
|
176
|
+
* @default null
|
|
177
|
+
*/
|
|
178
|
+
get iconSecondary() {
|
|
179
|
+
return this.args.iconSecondary ?? null;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/button/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/icon-tile/index';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
//
|
|
2
|
+
// BADGE
|
|
3
|
+
//
|
|
4
|
+
// properties within each class are sorted alphabetically
|
|
5
|
+
//
|
|
6
|
+
//
|
|
7
7
|
|
|
8
8
|
$hds-badge-types: ( 'flat','inverted','outlined' );
|
|
9
9
|
$hds-badge-colors-accents: ( 'highlight', 'success', 'warning', 'critical' );
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
// Button Component Styles
|
|
2
|
+
|
|
3
|
+
$border-radius: 5px;
|
|
4
|
+
|
|
5
|
+
// TODO! generalize with the existing mixin in Card component
|
|
6
|
+
@mixin tempElevation() {
|
|
7
|
+
box-shadow:
|
|
8
|
+
var(--token-elevation-low-shadow-01-x)
|
|
9
|
+
var(--token-elevation-low-shadow-01-y)
|
|
10
|
+
var(--token-elevation-low-shadow-01-blur)
|
|
11
|
+
var(--token-elevation-low-shadow-01-spread)
|
|
12
|
+
var(--token-elevation-low-shadow-01-color),
|
|
13
|
+
var(--token-elevation-low-shadow-02-x)
|
|
14
|
+
var(--token-elevation-low-shadow-02-y)
|
|
15
|
+
var(--token-elevation-low-shadow-02-blur)
|
|
16
|
+
var(--token-elevation-low-shadow-02-spread)
|
|
17
|
+
var(--token-elevation-low-shadow-02-color)
|
|
18
|
+
;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.hds-button {
|
|
22
|
+
@include tempElevation();
|
|
23
|
+
|
|
24
|
+
align-items: center;
|
|
25
|
+
border: 1px solid transparent; // We need this to be transparent for a11y
|
|
26
|
+
border-radius: $border-radius;
|
|
27
|
+
box-sizing: border-box; // TODO https://github.com/hashicorp/design-system-components/issues/46
|
|
28
|
+
display: flex;
|
|
29
|
+
font-family: var(--token-typography-body-base-font-family);
|
|
30
|
+
justify-content: center;
|
|
31
|
+
outline-color: transparent; // We need this to be transparent for a11y
|
|
32
|
+
max-width: fit-content;
|
|
33
|
+
position: relative;
|
|
34
|
+
width: auto;
|
|
35
|
+
|
|
36
|
+
// This covers all of the browsers and focus scenarios (due to the custom focus design).
|
|
37
|
+
&:disabled,
|
|
38
|
+
&[disabled],
|
|
39
|
+
&.is-disabled,
|
|
40
|
+
&:disabled:hover,
|
|
41
|
+
&[disabled]:hover,
|
|
42
|
+
&.is-disabled:hover,
|
|
43
|
+
&:disabled:focus,
|
|
44
|
+
&[disabled]:focus,
|
|
45
|
+
&.is-disabled:focus,
|
|
46
|
+
&:disabled:focus-visible,
|
|
47
|
+
&[disabled]:focus-visible,
|
|
48
|
+
&.is-disabled:focus-visible {
|
|
49
|
+
background-color: var(--token-color-palette-neutral-50);
|
|
50
|
+
border-color: var(--token-color-palette-alpha-200);
|
|
51
|
+
box-shadow: none;
|
|
52
|
+
color: var(--token-color-palette-neutral-400);
|
|
53
|
+
cursor: not-allowed;
|
|
54
|
+
outline-color: var(--token-color-palette-alpha-200);
|
|
55
|
+
|
|
56
|
+
&::before {
|
|
57
|
+
border-color: transparent;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&.hds-button--width-full {
|
|
62
|
+
width: 100%;
|
|
63
|
+
max-width: 100%;
|
|
64
|
+
|
|
65
|
+
.hds-button__text {
|
|
66
|
+
flex: 0 0 auto;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&.is-focus,
|
|
71
|
+
&:focus,
|
|
72
|
+
&:focus-visible {
|
|
73
|
+
&::before {
|
|
74
|
+
border-radius: $border-radius + 3px;
|
|
75
|
+
border: 3px solid transparent;
|
|
76
|
+
bottom: -4px;
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
content: '';
|
|
79
|
+
left: -4px;
|
|
80
|
+
position: absolute;
|
|
81
|
+
right: -4px;
|
|
82
|
+
top: -4px;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.hds-button__text {
|
|
88
|
+
flex: 1 0 0;
|
|
89
|
+
.hds-button__icon + & {
|
|
90
|
+
margin-left: 0.375rem;
|
|
91
|
+
}
|
|
92
|
+
& +.hds-button__icon {
|
|
93
|
+
margin-left: 0.375rem;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
// SIZE
|
|
99
|
+
|
|
100
|
+
.hds-button--size-small {
|
|
101
|
+
font-size: 0.8125rem; // 13px;
|
|
102
|
+
min-height: 1.75rem; //28px
|
|
103
|
+
line-height: 1;
|
|
104
|
+
padding: 0 1rem;
|
|
105
|
+
|
|
106
|
+
.hds-button__icon {
|
|
107
|
+
height: 0.75rem; // 12px
|
|
108
|
+
width: 0.75rem; // 12px
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.hds-button--size-medium {
|
|
113
|
+
font-size: 0.875rem; // 14px
|
|
114
|
+
line-height: 1rem; // 16px
|
|
115
|
+
min-height: 2.25rem; //36px
|
|
116
|
+
padding: 0.625rem 1rem;
|
|
117
|
+
|
|
118
|
+
.hds-button__icon {
|
|
119
|
+
height: 1rem;
|
|
120
|
+
width: 1rem;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.hds-button--size-large {
|
|
125
|
+
font-size: 1rem; //16px
|
|
126
|
+
line-height: 1.5rem; // 24px
|
|
127
|
+
min-height: 3rem; //48px
|
|
128
|
+
padding: 0.75rem 1.25rem; // 12px 20px
|
|
129
|
+
|
|
130
|
+
.hds-button__icon {
|
|
131
|
+
height: 1.5rem;
|
|
132
|
+
width: 1.5rem;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// COLORS & STATES
|
|
137
|
+
// Note: the order of the pseuo-selectors need to stay the way they are; it doesn't match the Figma file but it's the correct order for browsers to render the styles correctly.
|
|
138
|
+
|
|
139
|
+
.hds-button--color-primary {
|
|
140
|
+
background-color: var(--token-color-action-background-primary);
|
|
141
|
+
border-color: var(--token-color-action-border-on-primary);
|
|
142
|
+
color: var(--token-color-palette-neutral-0);
|
|
143
|
+
|
|
144
|
+
&:focus,
|
|
145
|
+
&:focus-visible,
|
|
146
|
+
&.is-focus {
|
|
147
|
+
background-color: var(--token-color-action-background-primary);
|
|
148
|
+
border-color: var(--token-color-action-border-on-primary);
|
|
149
|
+
color: var(--token-color-palette-neutral-0);
|
|
150
|
+
&::before {
|
|
151
|
+
border-color: var(--token-color-action-background-primary);
|
|
152
|
+
bottom: -6px;
|
|
153
|
+
left: -6px;
|
|
154
|
+
right: -6px;
|
|
155
|
+
top: -6px;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
&:hover,
|
|
159
|
+
&.is-hover {
|
|
160
|
+
background-color: var(--token-color-action-background-hover);
|
|
161
|
+
border-color: var(--token-color-action-border-on-hover);
|
|
162
|
+
color: var(--token-color-palette-neutral-0);
|
|
163
|
+
cursor: pointer;
|
|
164
|
+
}
|
|
165
|
+
&:active,
|
|
166
|
+
&.is-active {
|
|
167
|
+
background-color: var(--token-color-action-background-active);
|
|
168
|
+
border-color: var(--token-color-action-background-active);
|
|
169
|
+
box-shadow: none;
|
|
170
|
+
color: var(--token-color-palette-neutral-0);
|
|
171
|
+
&::before {
|
|
172
|
+
border-color: transparent;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.hds-button--color-secondary {
|
|
178
|
+
background-color: var(--token-color-palette-neutral-50);
|
|
179
|
+
border-color: var(--token-color-palette-alpha-300);
|
|
180
|
+
color: var(--token-color-palette-neutral-600);
|
|
181
|
+
|
|
182
|
+
&:focus,
|
|
183
|
+
&:focus-visible,
|
|
184
|
+
&.is-focus {
|
|
185
|
+
background-color: var(--token-color-palette-neutral-50);
|
|
186
|
+
border-color: var(--token-color-action-border-on-primary);
|
|
187
|
+
color: var(--token-color-palette-neutral-600);
|
|
188
|
+
outline-color: var(--token-color-action-border-on-primary);
|
|
189
|
+
&::before {
|
|
190
|
+
border-color: #5990FF;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
&:hover,
|
|
194
|
+
&.is-hover {
|
|
195
|
+
background-color: var(--token-color-palette-neutral-0);
|
|
196
|
+
border-color: var(--token-color-palette-alpha-300);
|
|
197
|
+
color: var(--token-color-palette-neutral-600);
|
|
198
|
+
cursor: pointer;
|
|
199
|
+
}
|
|
200
|
+
&:active,
|
|
201
|
+
&.is-active {
|
|
202
|
+
background-color: var(--token-color-palette-neutral-200);
|
|
203
|
+
border-color: var(--token-color-palette-alpha-300);
|
|
204
|
+
box-shadow: none;
|
|
205
|
+
color: var(--token-color-palette-neutral-600);
|
|
206
|
+
&::before {
|
|
207
|
+
border-color: transparent;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.hds-button--color-destructive {
|
|
213
|
+
background-color: var(--token-color-palette-neutral-50);
|
|
214
|
+
border-color: var(--token-color-palette-alpha-300);
|
|
215
|
+
color: var(--token-color-critical-foreground-on-faint);
|
|
216
|
+
|
|
217
|
+
&:focus,
|
|
218
|
+
&:focus-visible,
|
|
219
|
+
&.is-focus {
|
|
220
|
+
background-color: var(--token-color-palette-neutral-50);
|
|
221
|
+
border-color: var(--token-color-critical-border-on-primary);
|
|
222
|
+
color: var(--token-color-critical-foreground-on-faint);
|
|
223
|
+
outline-color: var(--token-color-critical-border-on-primary);
|
|
224
|
+
&::before {
|
|
225
|
+
border-color: #DD7578;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
&:hover,
|
|
229
|
+
&.is-hover {
|
|
230
|
+
background-color: var(--token-color-critical-background-hover);
|
|
231
|
+
border-color: var(--token-color-critical-border-on-hover);
|
|
232
|
+
color: var(--token-color-palette-neutral-0);
|
|
233
|
+
cursor: pointer;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
&:active,
|
|
237
|
+
&.is-active {
|
|
238
|
+
background-color: var(--token-color-critical-background-active);
|
|
239
|
+
border-color: var(--token-color-critical-background-active);
|
|
240
|
+
box-shadow: none;
|
|
241
|
+
color: var(--token-color-palette-neutral-0);
|
|
242
|
+
&::before {
|
|
243
|
+
border-color: transparent;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ICON-TILE
|
|
3
|
+
//
|
|
4
|
+
// properties within each class are sorted alphabetically
|
|
5
|
+
//
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
$hds-icon-tile-sizes: ( 'small', 'medium', 'large' );
|
|
9
|
+
$hds-icon-tile-types: ( 'object','resource','logo' );
|
|
10
|
+
$hds-icon-tile-colors-products: ( 'boundary', 'consul', 'nomad', 'packer', 'terraform', 'vagrant', 'vault', 'waypoint' );
|
|
11
|
+
|
|
12
|
+
$hds-icon-tile-border-width: 1px;
|
|
13
|
+
$hds-icon-tile-box-shadow: 0px 1px 1px rgba(#656A76, 0.05);
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
.hds-icon-tile {
|
|
17
|
+
border-radius: 4px;
|
|
18
|
+
border: $hds-icon-tile-border-width solid transparent;
|
|
19
|
+
box-shadow: $hds-icon-tile-box-shadow;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
display: flex;
|
|
22
|
+
position: relative;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.hds-icon-tile__icon,
|
|
26
|
+
.hds-icon-tile__logo {
|
|
27
|
+
display: flex;
|
|
28
|
+
margin: auto;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.hds-icon-tile__extra {
|
|
32
|
+
background-color: var(--token-color-neutral-background-primary);
|
|
33
|
+
border: 1px solid var(--token-color-palette-alpha-200);
|
|
34
|
+
bottom: -6px;
|
|
35
|
+
box-shadow: $hds-icon-tile-box-shadow;
|
|
36
|
+
box-sizing: content-box; // the border is outside
|
|
37
|
+
right: -6px;
|
|
38
|
+
display: flex;
|
|
39
|
+
position: absolute;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.hds-icon-tile__extra-icon {
|
|
43
|
+
display: flex;
|
|
44
|
+
margin: auto;
|
|
45
|
+
color: var(--token-color-neutral-foreground-primary);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// SIZE
|
|
49
|
+
|
|
50
|
+
// these values later may come from the design tokens
|
|
51
|
+
$size-props: (
|
|
52
|
+
"small": (
|
|
53
|
+
"size": 1.75rem, // 28px
|
|
54
|
+
"border-radius": 5px,
|
|
55
|
+
"icon-size": 1rem,
|
|
56
|
+
"logo-size": 1.25rem,
|
|
57
|
+
'extra-size': 1.125rem,
|
|
58
|
+
'extra-border-radius': 4px,
|
|
59
|
+
'extra-icon-size': 0.75rem,
|
|
60
|
+
),
|
|
61
|
+
"medium": (
|
|
62
|
+
"size": 2.5rem, // 40px
|
|
63
|
+
"border-radius": 6px,
|
|
64
|
+
"icon-size": 1.5rem,
|
|
65
|
+
"logo-size": 2.25rem,
|
|
66
|
+
'extra-size': 1.5rem,
|
|
67
|
+
'extra-border-radius': 5px,
|
|
68
|
+
'extra-icon-size': 1rem,
|
|
69
|
+
),
|
|
70
|
+
"large": (
|
|
71
|
+
"size": 3rem, // 48px
|
|
72
|
+
"border-radius": 6px,
|
|
73
|
+
"icon-size": 1.5rem,
|
|
74
|
+
"logo-size": 2.25rem,
|
|
75
|
+
'extra-size': 1.5rem,
|
|
76
|
+
'extra-border-radius': 5px,
|
|
77
|
+
'extra-icon-size': 1rem,
|
|
78
|
+
)
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
@each $size in $hds-icon-tile-sizes {
|
|
82
|
+
.hds-icon-tile--size-#{$size} {
|
|
83
|
+
width: map-get($size-props, $size, "size");
|
|
84
|
+
height: map-get($size-props, $size, "size");
|
|
85
|
+
border-radius: map-get($size-props, $size, "border-radius");
|
|
86
|
+
|
|
87
|
+
.hds-icon-tile__icon {
|
|
88
|
+
height: map-get($size-props, $size, "icon-size");
|
|
89
|
+
width: map-get($size-props, $size, "icon-size");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.hds-icon-tile__logo {
|
|
93
|
+
height: map-get($size-props, $size, "logo-size");
|
|
94
|
+
width: map-get($size-props, $size, "logo-size");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.hds-icon-tile__extra {
|
|
98
|
+
border-radius: map-get($size-props, $size, "extra-border-radius");
|
|
99
|
+
height: map-get($size-props, $size, "extra-size");
|
|
100
|
+
width: map-get($size-props, $size, "extra-size");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.hds-icon-tile__extra-icon {
|
|
104
|
+
height: map-get($size-props, $size, "extra-icon-size");
|
|
105
|
+
width: map-get($size-props, $size, "extra-icon-size");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
// LOGO - COLOR
|
|
112
|
+
|
|
113
|
+
.hds-icon-tile--logo {
|
|
114
|
+
background-color: var(--token-color-neutral-background-primary);
|
|
115
|
+
border-color: var(--token-color-neutral-border-primary);
|
|
116
|
+
|
|
117
|
+
@each $product in $hds-icon-tile-colors-products {
|
|
118
|
+
&.hds-icon-tile--color-#{$product} {
|
|
119
|
+
color: var(--token-color-#{$product}-brand);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// exception for Vault, where the color of the logo needs to be the "alt" one
|
|
124
|
+
&.hds-icon-tile--color-vault {
|
|
125
|
+
color: var(--token-color-vault-brand-alt);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ICON - COLOR
|
|
130
|
+
|
|
131
|
+
.hds-icon-tile--icon {
|
|
132
|
+
|
|
133
|
+
&.hds-icon-tile--color-neutral {
|
|
134
|
+
background-color: var(--token-color-neutral-background-secondary);
|
|
135
|
+
border-color: var(--token-color-neutral-border-primary);
|
|
136
|
+
color: var(--token-color-neutral-foreground-faint);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@each $product in $hds-icon-tile-colors-products {
|
|
140
|
+
&.hds-icon-tile--color-#{$product} {
|
|
141
|
+
background: linear-gradient(135deg, var(--token-color-#{$product}-gradient-faint-start) 0%, var(--token-color-#{$product}-gradient-faint-stop) 100%);
|
|
142
|
+
border-color: var(--token-color-#{$product}-border);
|
|
143
|
+
color: var(--token-color-#{$product}-brand);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashicorp/design-system-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "HashiCorp Design System Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hashicorp",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"test:ember:percy": "percy exec ember test"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@hashicorp/design-system-tokens": "^0.0.
|
|
59
|
+
"@hashicorp/design-system-tokens": "^0.0.13",
|
|
60
60
|
"@hashicorp/ember-flight-icons": "^1.2.0",
|
|
61
61
|
"ember-cli-babel": "^7.26.6",
|
|
62
62
|
"ember-cli-htmlbars": "^5.7.1",
|
|
@@ -90,6 +90,7 @@
|
|
|
90
90
|
"ember-source": "~3.27.2",
|
|
91
91
|
"ember-source-channel-url": "^3.0.0",
|
|
92
92
|
"ember-template-lint": "^3.4.2",
|
|
93
|
+
"ember-truth-helpers": "^3.0.0",
|
|
93
94
|
"ember-try": "^1.4.0",
|
|
94
95
|
"eslint": "^7.27.0",
|
|
95
96
|
"eslint-config-prettier": "^8.3.0",
|