@hashicorp/design-system-components 0.0.3 → 0.0.5
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.hbs +1 -1
- package/addon/components/hds/badge/index.js +20 -20
- package/addon/components/hds/badge-count/index.hbs +3 -0
- package/addon/components/hds/badge-count/index.js +107 -0
- package/addon/components/hds/card/container.hbs +3 -0
- package/addon/components/hds/card/container.js +116 -0
- package/app/components/hds/badge-count/index.js +1 -0
- package/app/components/hds/card/container.js +1 -0
- package/app/styles/@hashicorp/design-system-components.scss +2 -0
- package/app/styles/components/badge-count.scss +97 -0
- package/app/styles/components/badge.scss +2 -2
- package/app/styles/components/card/container.scss +97 -0
- package/app/styles/components/card/index.scss +4 -0
- package/index.js +0 -4
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<div class="hds-badge {{this.
|
|
1
|
+
<div class="hds-badge {{this.sizeClass}} {{this.typeClass}} {{this.colorClass}}" ...attributes>
|
|
2
2
|
{{#if @icon}}
|
|
3
3
|
<div class="hds-badge__icon">
|
|
4
4
|
<FlightIcon @name={{this.icon}} @size="16" @stretched="true" />
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { assert } from '@ember/debug';
|
|
3
3
|
|
|
4
|
-
const DEFAULT_SIZE = 'medium';
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const SIZES = ['small', 'medium', 'large'];
|
|
8
|
-
const TYPES = ['filled', 'inverted', 'outlined'];
|
|
9
|
-
const COLORS = [
|
|
4
|
+
export const DEFAULT_SIZE = 'medium';
|
|
5
|
+
export const DEFAULT_TYPE = 'filled';
|
|
6
|
+
export const DEFAULT_COLOR = 'neutral';
|
|
7
|
+
export const SIZES = ['small', 'medium', 'large'];
|
|
8
|
+
export const TYPES = ['filled', 'inverted', 'outlined'];
|
|
9
|
+
export const COLORS = [
|
|
10
10
|
'neutral',
|
|
11
11
|
'neutral-dark-mode',
|
|
12
12
|
'highlight',
|
|
@@ -17,8 +17,8 @@ const COLORS = [
|
|
|
17
17
|
|
|
18
18
|
export default class HdsBadgeIndexComponent extends Component {
|
|
19
19
|
/**
|
|
20
|
-
* Sets the size for the
|
|
21
|
-
* Accepted
|
|
20
|
+
* Sets the size for the component
|
|
21
|
+
* Accepted values: small, medium, large
|
|
22
22
|
*
|
|
23
23
|
* @param size
|
|
24
24
|
* @type {string}
|
|
@@ -29,7 +29,7 @@ export default class HdsBadgeIndexComponent extends Component {
|
|
|
29
29
|
|
|
30
30
|
if (size) {
|
|
31
31
|
assert(
|
|
32
|
-
`@size for
|
|
32
|
+
`@size for "Hds::Badge" must be one of the following: ${SIZES.join(
|
|
33
33
|
', '
|
|
34
34
|
)}, received: ${size}`,
|
|
35
35
|
SIZES.includes(size)
|
|
@@ -40,16 +40,16 @@ export default class HdsBadgeIndexComponent extends Component {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* Get a class to apply to the
|
|
43
|
+
* Get a class to apply to the component based on the size argument.
|
|
44
44
|
* @method Badge#sizeClass
|
|
45
|
-
* @return {string} The css class to apply to the
|
|
45
|
+
* @return {string} The css class to apply to the component.
|
|
46
46
|
*/
|
|
47
47
|
get sizeClass() {
|
|
48
48
|
return `hds-badge--size-${this.size}`;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
* Sets the type of
|
|
52
|
+
* Sets the type of the component
|
|
53
53
|
* Accepted values: filled, inverted, outlined
|
|
54
54
|
*
|
|
55
55
|
* @param type
|
|
@@ -61,7 +61,7 @@ export default class HdsBadgeIndexComponent extends Component {
|
|
|
61
61
|
|
|
62
62
|
if (type) {
|
|
63
63
|
assert(
|
|
64
|
-
`@type for
|
|
64
|
+
`@type for "Hds::Badge" must be one of the following: ${TYPES.join(
|
|
65
65
|
', '
|
|
66
66
|
)}, received: ${type}`,
|
|
67
67
|
TYPES.includes(type)
|
|
@@ -72,17 +72,17 @@ export default class HdsBadgeIndexComponent extends Component {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
|
-
* Get a class to apply to the
|
|
75
|
+
* Get a class to apply to the component based on the type argument.
|
|
76
76
|
* @method Badge#typeClass
|
|
77
|
-
* @return {string} The css class to apply to the
|
|
77
|
+
* @return {string} The css class to apply to the component.
|
|
78
78
|
*/
|
|
79
79
|
get typeClass() {
|
|
80
80
|
return `hds-badge--type-${this.type}`;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
|
-
* Sets the color scheme for the
|
|
85
|
-
* Accepted
|
|
84
|
+
* Sets the color scheme for the component
|
|
85
|
+
* Accepted values: neutral, neutral-dark-mode, highlight, success, warning, critical
|
|
86
86
|
*
|
|
87
87
|
* @param color
|
|
88
88
|
* @type {string}
|
|
@@ -93,7 +93,7 @@ export default class HdsBadgeIndexComponent extends Component {
|
|
|
93
93
|
|
|
94
94
|
if (color) {
|
|
95
95
|
assert(
|
|
96
|
-
`@color for
|
|
96
|
+
`@color for "Hds::Badge" must be one of the following: ${COLORS.join(
|
|
97
97
|
', '
|
|
98
98
|
)}, received: ${color}`,
|
|
99
99
|
COLORS.includes(color)
|
|
@@ -104,9 +104,9 @@ export default class HdsBadgeIndexComponent extends Component {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
* Get a class to apply to the
|
|
107
|
+
* Get a class to apply to the component based on the color argument.
|
|
108
108
|
* @method Badge#colorClass
|
|
109
|
-
* @return {string} The css class to apply to the
|
|
109
|
+
* @return {string} The css class to apply to the component.
|
|
110
110
|
*/
|
|
111
111
|
get colorClass() {
|
|
112
112
|
return `hds-badge--color-${this.color}`;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { assert } from '@ember/debug';
|
|
3
|
+
|
|
4
|
+
export const DEFAULT_SIZE = 'medium';
|
|
5
|
+
export const DEFAULT_TYPE = 'filled';
|
|
6
|
+
export const DEFAULT_COLOR = 'neutral';
|
|
7
|
+
export const SIZES = ['small', 'medium', 'large'];
|
|
8
|
+
export const TYPES = ['filled', 'inverted', 'outlined'];
|
|
9
|
+
export const COLORS = ['neutral', 'neutral-dark-mode'];
|
|
10
|
+
|
|
11
|
+
export default class HdsBadgeCountIndexComponent extends Component {
|
|
12
|
+
/**
|
|
13
|
+
* Sets the size for the component
|
|
14
|
+
* Accepted sizes: small, medium, large
|
|
15
|
+
*
|
|
16
|
+
* @param size
|
|
17
|
+
* @type {string}
|
|
18
|
+
* @default 'medium'
|
|
19
|
+
*/
|
|
20
|
+
get size() {
|
|
21
|
+
let { size = DEFAULT_SIZE } = this.args;
|
|
22
|
+
|
|
23
|
+
if (size) {
|
|
24
|
+
assert(
|
|
25
|
+
`@size for "Hds::BadgeCount" must be one of the following: ${SIZES.join(
|
|
26
|
+
', '
|
|
27
|
+
)}, received: ${size}`,
|
|
28
|
+
SIZES.includes(size)
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return size;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get a class to apply to the component based on the size argument.
|
|
37
|
+
* @method BadgeCount#sizeClass
|
|
38
|
+
* @return {string} The css class to apply to the component.
|
|
39
|
+
*/
|
|
40
|
+
get sizeClass() {
|
|
41
|
+
return `hds-badge-count--size-${this.size}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Sets the type of the component
|
|
46
|
+
* Accepted values: filled, inverted, outlined
|
|
47
|
+
*
|
|
48
|
+
* @param type
|
|
49
|
+
* @type {string}
|
|
50
|
+
* @default 'filled'
|
|
51
|
+
*/
|
|
52
|
+
get type() {
|
|
53
|
+
let { type = DEFAULT_TYPE } = this.args;
|
|
54
|
+
|
|
55
|
+
if (type) {
|
|
56
|
+
assert(
|
|
57
|
+
`@type for "Hds::BadgeCount" must be one of the following: ${TYPES.join(
|
|
58
|
+
', '
|
|
59
|
+
)}, received: ${type}`,
|
|
60
|
+
TYPES.includes(type)
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return type;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Get a class to apply to the component based on the type argument.
|
|
69
|
+
* @method BadgeCount#typeClass
|
|
70
|
+
* @return {string} The css class to apply to the component.
|
|
71
|
+
*/
|
|
72
|
+
get typeClass() {
|
|
73
|
+
return `hds-badge-count--type-${this.type}`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Sets the color scheme for the component
|
|
78
|
+
* Accepted colors: neutral, neutral-dark-mode
|
|
79
|
+
*
|
|
80
|
+
* @param color
|
|
81
|
+
* @type {string}
|
|
82
|
+
* @default 'neutral'
|
|
83
|
+
*/
|
|
84
|
+
get color() {
|
|
85
|
+
let { color = DEFAULT_COLOR } = this.args;
|
|
86
|
+
|
|
87
|
+
if (color) {
|
|
88
|
+
assert(
|
|
89
|
+
`@color for "Hds::BadgeCount" must be one of the following: ${COLORS.join(
|
|
90
|
+
', '
|
|
91
|
+
)}, received: ${color}`,
|
|
92
|
+
COLORS.includes(color)
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return color;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Get a class to apply to the component based on the color argument.
|
|
101
|
+
* @method BadgeCount#colorClass
|
|
102
|
+
* @return {string} The css class to apply to the component.
|
|
103
|
+
*/
|
|
104
|
+
get colorClass() {
|
|
105
|
+
return `hds-badge-count--color-${this.color}`;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { assert } from '@ember/debug';
|
|
3
|
+
|
|
4
|
+
export const DEFAULT_LEVEL = 'base';
|
|
5
|
+
export const DEFAULT_BACKGROUND = 'neutral-0';
|
|
6
|
+
export const DEFAULT_OVERFLOW = 'hidden';
|
|
7
|
+
export const LEVELS = ['base', 'mid', 'high'];
|
|
8
|
+
export const BACKGROUNDS = ['neutral-0', 'neutral-50'];
|
|
9
|
+
export const OVERFLOWS = ['hidden', 'visible'];
|
|
10
|
+
|
|
11
|
+
export default class HdsCardContainerComponent extends Component {
|
|
12
|
+
/**
|
|
13
|
+
* Sets the "elevation" level for the component
|
|
14
|
+
* Accepted values: base, mid, high
|
|
15
|
+
*
|
|
16
|
+
* @param level
|
|
17
|
+
* @type {string}
|
|
18
|
+
* @default 'base'
|
|
19
|
+
*/
|
|
20
|
+
get level() {
|
|
21
|
+
let { level = DEFAULT_LEVEL } = this.args;
|
|
22
|
+
|
|
23
|
+
if (level) {
|
|
24
|
+
assert(
|
|
25
|
+
`@level for "Hds::CardContainer" must be one of the following: ${LEVELS.join(
|
|
26
|
+
', '
|
|
27
|
+
)}, received: ${level}`,
|
|
28
|
+
LEVELS.includes(level)
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return level;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get a class to apply to the component based on the level argument.
|
|
37
|
+
* @method Card#levelClass
|
|
38
|
+
* @return {string} The css class to apply to the component.
|
|
39
|
+
*/
|
|
40
|
+
get levelClass() {
|
|
41
|
+
return `hds-card__container--level-${this.level}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Sets the background for the component
|
|
46
|
+
* Accepted values: neutral-0, neutral-50
|
|
47
|
+
*
|
|
48
|
+
* @param background
|
|
49
|
+
* @type {string}
|
|
50
|
+
* @default 'base'
|
|
51
|
+
*/
|
|
52
|
+
get background() {
|
|
53
|
+
let { background = DEFAULT_BACKGROUND } = this.args;
|
|
54
|
+
|
|
55
|
+
if (background) {
|
|
56
|
+
assert(
|
|
57
|
+
`@background for "Hds::CardContainer" must be one of the following: ${BACKGROUNDS.join(
|
|
58
|
+
', '
|
|
59
|
+
)}, received: ${background}`,
|
|
60
|
+
BACKGROUNDS.includes(background)
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return background;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Get a class to apply to the component based on the background argument.
|
|
69
|
+
* @method Card#backgroundClass
|
|
70
|
+
* @return {string} The css class to apply to the component.
|
|
71
|
+
*/
|
|
72
|
+
get backgroundClass() {
|
|
73
|
+
return `hds-card__container--background-${this.background}`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Get a class to apply to the component based on the hasBorder argument.
|
|
78
|
+
* @method Card#hasBorderClass
|
|
79
|
+
* @return {string} The css class to apply to the component.
|
|
80
|
+
*/
|
|
81
|
+
get borderClass() {
|
|
82
|
+
return this.args.hasBorder ? `hds-card__container--has-border` : undefined;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Sets the level for the card
|
|
87
|
+
* Accepted values: visible, hidden
|
|
88
|
+
*
|
|
89
|
+
* @param overflow
|
|
90
|
+
* @type {string}
|
|
91
|
+
* @default 'hidden'
|
|
92
|
+
*/
|
|
93
|
+
get overflow() {
|
|
94
|
+
let { overflow = DEFAULT_OVERFLOW } = this.args;
|
|
95
|
+
|
|
96
|
+
if (overflow) {
|
|
97
|
+
assert(
|
|
98
|
+
`@overflow for "Hds::CardContainer" must be one of the following: ${OVERFLOWS.join(
|
|
99
|
+
', '
|
|
100
|
+
)}, received: ${overflow}`,
|
|
101
|
+
OVERFLOWS.includes(overflow)
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return overflow;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Get a class to apply to the component based on the overflow argument.
|
|
110
|
+
* @method Card#overflowClass
|
|
111
|
+
* @return {string} The css class to apply to the component.
|
|
112
|
+
*/
|
|
113
|
+
get overflowClass() {
|
|
114
|
+
return `hds-card__container--overflow-${this.overflow}`;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/badge-count/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/card/container';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// BADGE-COUNT
|
|
2
|
+
//
|
|
3
|
+
// properties within each class are sorted alphabetically
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
@use 'sass:math';
|
|
7
|
+
|
|
8
|
+
$hds-badge-count-types: ( 'flat','inverted','outlined' );
|
|
9
|
+
$hds-badge-count-sizes: ( 'small', 'medium', 'large' );
|
|
10
|
+
|
|
11
|
+
$hds-badge-count-border-width: 1px;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
.hds-badge-count {
|
|
15
|
+
align-items: center;
|
|
16
|
+
border: $hds-badge-count-border-width solid transparent;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
font-family: var(--token-typography-tag-font-family);
|
|
20
|
+
max-width: 100%;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// SIZE
|
|
24
|
+
|
|
25
|
+
// these values later may come from the design tokens
|
|
26
|
+
$size-props: (
|
|
27
|
+
"small": (
|
|
28
|
+
"font-size": 0.8125rem, // 13px
|
|
29
|
+
"height": 1.25rem,
|
|
30
|
+
"line-height": 1.23077, // 16px
|
|
31
|
+
"padding-vertical": 0.125rem,
|
|
32
|
+
"padding-horizontal": 0.5rem,
|
|
33
|
+
),
|
|
34
|
+
"medium": (
|
|
35
|
+
"font-size": 0.8125rem, // 13px
|
|
36
|
+
"height": 1.5rem,
|
|
37
|
+
"line-height": 1.23077, // 16px
|
|
38
|
+
"padding-vertical": 0.25rem,
|
|
39
|
+
"padding-horizontal": 0.75rem,
|
|
40
|
+
),
|
|
41
|
+
"large": (
|
|
42
|
+
"font-size": 1rem, // 16px
|
|
43
|
+
"height": 2rem,
|
|
44
|
+
"line-height": 1.5, // 24px
|
|
45
|
+
"padding-vertical": 0.25rem,
|
|
46
|
+
"padding-horizontal": 0.875rem,
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
@each $size in $hds-badge-count-sizes {
|
|
51
|
+
.hds-badge-count--size-#{$size} {
|
|
52
|
+
border-radius: math.div(map-get($size-props, $size, "height"), 2);
|
|
53
|
+
font-size: map-get($size-props, $size, "font-size");
|
|
54
|
+
line-height: map-get($size-props, $size, "line-height");
|
|
55
|
+
min-height: map-get($size-props, $size, "height");
|
|
56
|
+
padding: calc(#{map-get($size-props, $size, "padding-vertical")} - #{$hds-badge-count-border-width}) calc(#{map-get($size-props, $size, "padding-horizontal")} - #{$hds-badge-count-border-width});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
// COLOR + TYPE COMBINATIONS
|
|
62
|
+
|
|
63
|
+
.hds-badge-count--color-neutral {
|
|
64
|
+
&.hds-badge-count--type-filled {
|
|
65
|
+
background-color: var(--token-color-neutral-neutral-100);
|
|
66
|
+
color: var(--token-color-neutral-neutral-600);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&.hds-badge-count--type-inverted {
|
|
70
|
+
background-color: var(--token-color-neutral-neutral-500);
|
|
71
|
+
color: var(--token-color-neutral-neutral-0);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&.hds-badge-count--type-outlined {
|
|
75
|
+
background-color: transparent;
|
|
76
|
+
border-color: currentColor;
|
|
77
|
+
color: var(--token-color-neutral-neutral-500);;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.hds-badge-count--color-neutral-dark-mode {
|
|
82
|
+
&.hds-badge-count--type-filled {
|
|
83
|
+
background-color: var(--token-color-neutral-neutral-500);
|
|
84
|
+
color: var(--token-color-neutral-neutral-0);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&.hds-badge-count--type-inverted {
|
|
88
|
+
background-color: var(--token-color-neutral-neutral-50);
|
|
89
|
+
color: var(--token-color-neutral-neutral-600);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&.hds-badge-count--type-outlined {
|
|
93
|
+
background-color: transparent;
|
|
94
|
+
border-color: currentColor;
|
|
95
|
+
color: var(--token-color-neutral-neutral-0);;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -114,8 +114,8 @@ $size-props: (
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
&.hds-badge--type-inverted {
|
|
117
|
-
background-color: var(--token-color-neutral-neutral-
|
|
118
|
-
color: var(--token-color-neutral-neutral-
|
|
117
|
+
background-color: var(--token-color-neutral-neutral-50);
|
|
118
|
+
color: var(--token-color-neutral-neutral-600);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
&.hds-badge--type-outlined {
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// CARD COMPONENT > CONTAINER
|
|
2
|
+
//
|
|
3
|
+
// properties within each class are sorted alphabetically
|
|
4
|
+
//
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
// this mixin is used to apply the "elevation" styles to the card container
|
|
8
|
+
// depending on the "elevation level" and if it has a border applied to it.
|
|
9
|
+
// we are mimicking the way this effect is defined in Figma, through a set of
|
|
10
|
+
// multiple drop shadows (also the border is a 1px shadow); we tried using an
|
|
11
|
+
// outline but Safari still doesn't support rounded edges for outlines.
|
|
12
|
+
// for details see: https://www.figma.com/file/oQsMzMMnynfPWpMEt91OpH/?node-id=1988%3A2
|
|
13
|
+
|
|
14
|
+
@mixin getElevationStyle($level, $has-border: false) {
|
|
15
|
+
$drop-shadow: false;
|
|
16
|
+
$border-shadow: false;
|
|
17
|
+
|
|
18
|
+
// here we define the "drop-shadow" values (there are two shadows applied)
|
|
19
|
+
// notice: the "base" level doesn't have a "drop shadow" effect applied (no elevation)
|
|
20
|
+
@if ($level != 'base') {
|
|
21
|
+
$drop-shadow:
|
|
22
|
+
var(--token-elevation-#{$level}-shadow-01-x)
|
|
23
|
+
var(--token-elevation-#{$level}-shadow-01-y)
|
|
24
|
+
var(--token-elevation-#{$level}-shadow-01-blur)
|
|
25
|
+
var(--token-elevation-#{$level}-shadow-01-spread)
|
|
26
|
+
var(--token-elevation-#{$level}-shadow-01-color),
|
|
27
|
+
var(--token-elevation-#{$level}-shadow-02-x)
|
|
28
|
+
var(--token-elevation-#{$level}-shadow-02-y)
|
|
29
|
+
var(--token-elevation-#{$level}-shadow-02-blur)
|
|
30
|
+
var(--token-elevation-#{$level}-shadow-02-spread)
|
|
31
|
+
var(--token-elevation-#{$level}-shadow-02-color)
|
|
32
|
+
;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// here we define the "border-shadow" values
|
|
36
|
+
// notice: we create a border via a shadow, so we have zero values for x/y/blur
|
|
37
|
+
@if ($has-border) {
|
|
38
|
+
$border-shadow:
|
|
39
|
+
0
|
|
40
|
+
0
|
|
41
|
+
0
|
|
42
|
+
var(--token-elevation-#{$level}-border-width)
|
|
43
|
+
var(--token-elevation-#{$level}-border-color);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// here we join the two effects in a single box-shadow (depending on the different cases)
|
|
47
|
+
@if ($drop-shadow and not $border-shadow) {
|
|
48
|
+
box-shadow: $drop-shadow;
|
|
49
|
+
} @else if($border-shadow and not $drop-shadow) {
|
|
50
|
+
box-shadow: $border-shadow;
|
|
51
|
+
} @else {
|
|
52
|
+
// notice: we put the "border-shadow" first because the final rendering in the browser looks better
|
|
53
|
+
// see: https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow - "The z-ordering of multiple box shadows is the same as multiple text shadows (the first specified shadow is on top)."
|
|
54
|
+
box-shadow: $border-shadow, $drop-shadow;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
$hds-card-container-levels: ( 'base', 'mid', 'high' );
|
|
59
|
+
$hds-card-container-backgrounds: ( 'neutral-0', 'neutral-50' );
|
|
60
|
+
|
|
61
|
+
$hds-card-container-border-radius: 6px;
|
|
62
|
+
|
|
63
|
+
.hds-card__container {
|
|
64
|
+
background-color: #fff;
|
|
65
|
+
border-radius: $hds-card-container-border-radius;
|
|
66
|
+
position: relative;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// LEVEL (elevation style as "drop" + "border" shadow effects)
|
|
70
|
+
|
|
71
|
+
@each $level in $hds-card-container-levels {
|
|
72
|
+
.hds-card__container--level-#{$level} {
|
|
73
|
+
@include getElevationStyle($level);
|
|
74
|
+
|
|
75
|
+
&.hds-card__container--has-border {
|
|
76
|
+
@include getElevationStyle($level, true);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// BACKGROUND
|
|
82
|
+
|
|
83
|
+
@each $background-color in $hds-card-container-backgrounds {
|
|
84
|
+
.hds-card__container--background-#{$background-color} {
|
|
85
|
+
background-color: var(--token-color-neutral-#{$background-color});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// OVERFLOW
|
|
90
|
+
|
|
91
|
+
.hds-card__container--overflow-hidden {
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.hds-card__container--overflow-visible {
|
|
96
|
+
overflow: visible;
|
|
97
|
+
}
|
package/index.js
CHANGED
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.5",
|
|
4
4
|
"description": "HashiCorp Design System Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hashicorp",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"test:ember-compatibility": "ember try:each"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@hashicorp/design-system-tokens": "^0.0.
|
|
58
|
+
"@hashicorp/design-system-tokens": "^0.0.9",
|
|
59
59
|
"@hashicorp/ember-flight-icons": "^1.2.0",
|
|
60
60
|
"ember-cli-babel": "^7.26.6",
|
|
61
61
|
"ember-cli-htmlbars": "^5.7.1",
|