@madgex/design-system 1.16.0 → 1.16.2
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/dist/_tokens/css/_tokens.css +2 -1
- package/dist/_tokens/js/_tokens-module.js +24 -1
- package/dist/_tokens/scss/_tokens.scss +7 -1
- package/dist/css/index.css +2 -1
- package/package.json +1 -1
- package/src/components/button/button.scss +6 -3
- package/src/scss/functions/__index.scss +1 -0
- package/src/scss/functions/_text-contrast.scss +23 -0
- package/src/scss/utilities/_mixins.scss +0 -24
- package/src/tokens/size.json +7 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly
|
|
3
|
-
* Generated on
|
|
3
|
+
* Generated on Tue, 16 Jul 2019 15:41:45 GMT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
:root {
|
|
@@ -128,4 +128,5 @@
|
|
|
128
128
|
--mds-size-wrapper-max-width: 1280px;
|
|
129
129
|
--mds-size-wrapper-padding: 1.5%;
|
|
130
130
|
--mds-size-surface-padding: 28px 32px;
|
|
131
|
+
--mds-size-button-border-radius: 4px;
|
|
131
132
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly
|
|
3
|
-
* Generated on
|
|
3
|
+
* Generated on Tue, 16 Jul 2019 15:41:45 GMT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
@@ -2614,6 +2614,29 @@ module.exports = {
|
|
|
2614
2614
|
"padding"
|
|
2615
2615
|
]
|
|
2616
2616
|
}
|
|
2617
|
+
},
|
|
2618
|
+
"button": {
|
|
2619
|
+
"border": {
|
|
2620
|
+
"radius": {
|
|
2621
|
+
"value": "4rem",
|
|
2622
|
+
"original": {
|
|
2623
|
+
"value": "{size.border.radius.value}"
|
|
2624
|
+
},
|
|
2625
|
+
"name": "MdsSizeButtonBorderRadius",
|
|
2626
|
+
"attributes": {
|
|
2627
|
+
"category": "size",
|
|
2628
|
+
"type": "button",
|
|
2629
|
+
"item": "border",
|
|
2630
|
+
"subitem": "radius"
|
|
2631
|
+
},
|
|
2632
|
+
"path": [
|
|
2633
|
+
"size",
|
|
2634
|
+
"button",
|
|
2635
|
+
"border",
|
|
2636
|
+
"radius"
|
|
2637
|
+
]
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2617
2640
|
}
|
|
2618
2641
|
}
|
|
2619
2642
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
3
|
Do not edit directly
|
|
4
|
-
Generated on
|
|
4
|
+
Generated on Tue, 16 Jul 2019 15:41:45 GMT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
$mds-color-brand-1-base: #1b75bb !default;
|
|
@@ -128,6 +128,7 @@ $mds-size-wrapper-width: 100% !default;
|
|
|
128
128
|
$mds-size-wrapper-max-width: 1280px !default;
|
|
129
129
|
$mds-size-wrapper-padding: 1.5% !default;
|
|
130
130
|
$mds-size-surface-padding: 28px 32px !default;
|
|
131
|
+
$mds-size-button-border-radius: 4px !default;
|
|
131
132
|
|
|
132
133
|
$tokens: (
|
|
133
134
|
'color': (
|
|
@@ -388,6 +389,11 @@ $tokens: (
|
|
|
388
389
|
),
|
|
389
390
|
'surface': (
|
|
390
391
|
'padding': $mds-size-surface-padding
|
|
392
|
+
),
|
|
393
|
+
'button': (
|
|
394
|
+
'border': (
|
|
395
|
+
'radius': $mds-size-button-border-radius
|
|
396
|
+
)
|
|
391
397
|
)
|
|
392
398
|
)
|
|
393
399
|
);
|
package/dist/css/index.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Do not edit directly
|
|
3
|
-
Generated on
|
|
3
|
+
Generated on Tue, 16 Jul 2019 15:41:45 GMT
|
|
4
4
|
*/
|
|
5
5
|
html,
|
|
6
6
|
body,
|
|
@@ -1393,6 +1393,7 @@ body {
|
|
|
1393
1393
|
white-space: nowrap;
|
|
1394
1394
|
-webkit-appearance: none;
|
|
1395
1395
|
border: 1px solid transparent;
|
|
1396
|
+
border-radius: 4px;
|
|
1396
1397
|
background-color: #f0af11;
|
|
1397
1398
|
padding: 8px 12px;
|
|
1398
1399
|
font-size: 100%;
|
package/package.json
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
$mds-color-button-bg: $mds-color-brand-2-base !default;
|
|
2
2
|
$mds-color-button-bg-hover: $mds-color-brand-2-light !default;
|
|
3
|
+
$mds-color-button-text: text-contrast($mds-color-button-bg) !default;
|
|
4
|
+
$mds-color-button-text-hover: text-contrast($mds-color-button-bg-hover) !default;
|
|
3
5
|
|
|
4
6
|
.mds-button {
|
|
5
7
|
cursor: pointer;
|
|
@@ -8,13 +10,14 @@ $mds-color-button-bg-hover: $mds-color-brand-2-light !default;
|
|
|
8
10
|
white-space: nowrap;
|
|
9
11
|
-webkit-appearance: none;
|
|
10
12
|
border: 1px solid transparent;
|
|
13
|
+
border-radius: $mds-size-button-border-radius;
|
|
11
14
|
background-color: $mds-color-button-bg;
|
|
12
15
|
padding: ($mds-size-baseline * 2) ($mds-size-baseline * 3);
|
|
13
16
|
font-size: 100%;
|
|
14
17
|
width: 100%;
|
|
15
18
|
display: inline-block;
|
|
16
19
|
text-align: center;
|
|
17
|
-
|
|
20
|
+
color: $mds-color-button-text;
|
|
18
21
|
|
|
19
22
|
@include mq($from: md) {
|
|
20
23
|
width: auto;
|
|
@@ -25,13 +28,13 @@ $mds-color-button-bg-hover: $mds-color-brand-2-light !default;
|
|
|
25
28
|
&:visited,
|
|
26
29
|
&:active {
|
|
27
30
|
text-decoration: none;
|
|
28
|
-
|
|
31
|
+
color: $mds-color-button-text;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
&:hover,
|
|
32
35
|
&:focus {
|
|
33
36
|
background-color: $mds-color-button-bg-hover;
|
|
34
37
|
text-decoration: none;
|
|
35
|
-
|
|
38
|
+
color: $mds-color-button-text-hover
|
|
36
39
|
}
|
|
37
40
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
@function text-contrast($bg-color) {
|
|
3
|
+
$color-text-base-brightness: round(
|
|
4
|
+
(red($mds-color-text-base) * 299) + (green($mds-color-text-base) * 587) + (blue($mds-color-text-base) * 114) / 1000
|
|
5
|
+
);
|
|
6
|
+
$color-brightness: round((red($bg-color) * 299) + (green($bg-color) * 587) + (blue($bg-color) * 114) / 1000);
|
|
7
|
+
$light-color: round((red(#ffffff) * 299) + (green(#ffffff) * 587) + (blue(#ffffff) * 114) / 1000);
|
|
8
|
+
|
|
9
|
+
$text-color-dark: $mds-color-text-base !default;
|
|
10
|
+
$text-color-light: $mds-color-text-invert !default;
|
|
11
|
+
|
|
12
|
+
@if abs($color-text-base-brightness) >= ($light-color/2) {
|
|
13
|
+
$text-color-dark: $mds-color-text-invert;
|
|
14
|
+
$text-color-light: $mds-color-text-base;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@if abs($color-brightness) < ($light-color/2) {
|
|
18
|
+
@return $text-color-light;
|
|
19
|
+
} @else {
|
|
20
|
+
@return $text-color-dark;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
@@ -4,27 +4,3 @@
|
|
|
4
4
|
-moz-user-select: none;
|
|
5
5
|
user-select: none;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
// This mixin will check the brightness of the background colour and text
|
|
9
|
-
// and return either light or dark text depending on the contrast
|
|
10
|
-
@mixin mds-text-contrast($bg-color) {
|
|
11
|
-
$color-text-base-brightness: round(
|
|
12
|
-
(red($mds-color-text-base) * 299) + (green($mds-color-text-base) * 587) + (blue($mds-color-text-base) * 114) / 1000
|
|
13
|
-
);
|
|
14
|
-
$color-brightness: round((red($bg-color) * 299) + (green($bg-color) * 587) + (blue($bg-color) * 114) / 1000);
|
|
15
|
-
$light-color: round((red(#ffffff) * 299) + (green(#ffffff) * 587) + (blue(#ffffff) * 114) / 1000);
|
|
16
|
-
|
|
17
|
-
$text-color-dark: $mds-color-text-base !default;
|
|
18
|
-
$text-color-light: $mds-color-text-invert !default;
|
|
19
|
-
|
|
20
|
-
@if abs($color-text-base-brightness) >= ($light-color/2) {
|
|
21
|
-
$text-color-dark: $mds-color-text-invert;
|
|
22
|
-
$text-color-light: $mds-color-text-base;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@if abs($color-brightness) < ($light-color/2) {
|
|
26
|
-
color: $text-color-light;
|
|
27
|
-
} @else {
|
|
28
|
-
color: $text-color-dark;
|
|
29
|
-
}
|
|
30
|
-
}
|