@madgex/design-system 1.9.0 → 1.10.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/dist/_tokens/css/_tokens.css +9 -15
- package/dist/_tokens/js/_tokens-module.js +16 -122
- package/dist/_tokens/scss/_tokens.scss +4 -18
- package/dist/css/index.css +2421 -1
- package/package.json +1 -1
- package/src/layout/spacing/README.md +23 -0
- package/src/layout/spacing/spacing.njk +15 -0
- package/src/scss/core/_grid.scss +1 -2
- package/src/scss/helpers/__index.scss +1 -0
- package/src/scss/helpers/_spacing.scss +46 -0
- package/src/tokens/_config.js +4 -2
- package/src/tokens/size.json +2 -10
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
## Space scale
|
|
2
|
+
|
|
3
|
+
We are using a spacing scale based on a single tolen: `$mds-size-baseline = 0.25 rem | 4px`.
|
|
4
|
+
|
|
5
|
+
We multiply this token to create any spacing on the design system.
|
|
6
|
+
|
|
7
|
+
Ex: `margin-bottom: $mds-size-baseline * 5`
|
|
8
|
+
|
|
9
|
+
## Helpers
|
|
10
|
+
|
|
11
|
+
To help building a layout, we created classes that add margin and padding to an element.
|
|
12
|
+
|
|
13
|
+
Use the class `mds-padding` or `mds-margin`, followed by a position: `top`, `right`, `bottom`, `left` (optional), a breakpoint: `sm`, `md`, `lg`, `xl` (optional) and the spacing that you want: `b0 to 10` (`baseline * scale`).
|
|
14
|
+
|
|
15
|
+
Examples:
|
|
16
|
+
|
|
17
|
+
- `mds-padding-b5`
|
|
18
|
+
- `mds-margin-bottom-b0`
|
|
19
|
+
- `mds-padding-left-lg-b4`
|
|
20
|
+
|
|
21
|
+
The classes with the positions will override the value of the "shorthand" class at any viewport width.
|
|
22
|
+
|
|
23
|
+
For example: `class="mds-padding-b5 mds-padding-md-b10 mds-padding-top-b0"` will create 20px padding at default size, then 40px padding from the `md` breakpoint but the padding-top will always be 0px at all sizes.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<h2>Padding</h2>
|
|
2
|
+
<div class="mds-padding-b5" style="border: 1px solid #666;">
|
|
3
|
+
<div>A box with a padding of 20px (baseline * 5)</div>
|
|
4
|
+
</div>
|
|
5
|
+
<div class="mds-padding-b5 mds-padding-left-b2 mds-padding-right-b2" style="border: 1px solid #666;">
|
|
6
|
+
<div>A box with a padding of 20px at the top and bottom and 8px on the left and right</div>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="mds-padding-b5 mds-padding-md-b10 mds-padding-right-b0" style="border: 1px solid #666;">
|
|
9
|
+
<div>A box with a padding of 20px, 40px from the `md` breakpoint and no padding on the right</div>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<h2>Margin</h2>
|
|
13
|
+
<p class="mds-margin-bottom-b7">A paragraph with a margin-bottom override of 28px (baseline * 7)</p>
|
|
14
|
+
<p class="mds-margin-bottom-b7 mds-margin-bottom-md-b10">A paragraph with a margin-bottom override of 28px as default and 40px (baseline * 10) from the `md` breakpoint</p>
|
|
15
|
+
<p class="mds-margin-bottom-b0">A paragraph with a margin-bottom override of 0px (baseline * 0)</p>
|
package/src/scss/core/_grid.scss
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
$breakpoints: map-get(map-get($tokens, 'size'), 'breakpoint');
|
|
2
|
+
$positions: top, right, bottom, left;
|
|
3
|
+
|
|
4
|
+
// There are 2 loops as the more specific classes with positions have to be declared before the shorthand ones
|
|
5
|
+
// so the value with the position can override the value of the shorthand.
|
|
6
|
+
|
|
7
|
+
@for $i from 0 through 10 {
|
|
8
|
+
.mds-padding-b#{$i} {
|
|
9
|
+
padding: $mds-size-baseline * $i;
|
|
10
|
+
}
|
|
11
|
+
.mds-margin-b#{$i} {
|
|
12
|
+
margin: $mds-size-baseline * $i;
|
|
13
|
+
}
|
|
14
|
+
@each $bpname, $value in $breakpoints {
|
|
15
|
+
@include mq($from: $bpname) {
|
|
16
|
+
.mds-padding-#{$bpname}-b#{$i} {
|
|
17
|
+
padding: $mds-size-baseline * $i;
|
|
18
|
+
}
|
|
19
|
+
.mds-margin-#{$bpname}-b#{$i} {
|
|
20
|
+
margin: $mds-size-baseline * $i;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@for $i from 0 through 10 {
|
|
27
|
+
@each $position in $positions {
|
|
28
|
+
.mds-padding-#{$position}-b#{$i} {
|
|
29
|
+
padding-#{$position}: $mds-size-baseline * $i;
|
|
30
|
+
}
|
|
31
|
+
.mds-margin-#{$position}-b#{$i} {
|
|
32
|
+
margin-#{$position}: $mds-size-baseline * $i;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@each $bpname, $value in $breakpoints {
|
|
36
|
+
@include mq($from: $bpname) {
|
|
37
|
+
.mds-padding-#{$position}-#{$bpname}-b#{$i} {
|
|
38
|
+
padding-#{$position}: $mds-size-baseline * $i;
|
|
39
|
+
}
|
|
40
|
+
.mds-margin-#{$position}-#{$bpname}-b#{$i} {
|
|
41
|
+
margin-#{$position}: $mds-size-baseline * $i;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
package/src/tokens/_config.js
CHANGED
|
@@ -2,7 +2,8 @@ const config = {
|
|
|
2
2
|
source: ['src/tokens/**/*.json'],
|
|
3
3
|
platforms: {
|
|
4
4
|
'css-variables': {
|
|
5
|
-
transformGroup: 'css',
|
|
5
|
+
// transformGroup: 'css',
|
|
6
|
+
transforms: ['attribute/cti', 'name/cti/kebab', 'time/seconds', 'content/icon', 'color/css'],
|
|
6
7
|
buildPath: 'dist/_tokens/css/',
|
|
7
8
|
prefix: 'mds',
|
|
8
9
|
files: [
|
|
@@ -13,8 +14,9 @@ const config = {
|
|
|
13
14
|
],
|
|
14
15
|
},
|
|
15
16
|
'scss-variables': {
|
|
16
|
-
transformGroup: 'web',
|
|
17
|
+
// transformGroup: 'web',
|
|
17
18
|
// transforms: ['size/px'],
|
|
19
|
+
transforms: ['attribute/cti', 'name/cti/kebab', 'color/css'],
|
|
18
20
|
buildPath: 'dist/_tokens/scss/',
|
|
19
21
|
prefix: 'mds',
|
|
20
22
|
files: [
|
package/src/tokens/size.json
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"size": {
|
|
3
|
-
"font": {
|
|
4
|
-
"xs": { "value": "12" },
|
|
5
|
-
"sm": { "value": "14" },
|
|
6
|
-
"md": { "value": "16px" },
|
|
7
|
-
"lg": { "value": "20" },
|
|
8
|
-
"xl": { "value": "26" },
|
|
9
|
-
"xxl": { "value": "46" },
|
|
10
|
-
"base": { "value": "{size.font.md.value}" }
|
|
11
|
-
},
|
|
12
3
|
"baseline": { "value": "4px" },
|
|
13
4
|
"breakpoint": {
|
|
14
5
|
"sm": { "value": "400px" },
|
|
@@ -23,6 +14,7 @@
|
|
|
23
14
|
"radius": {
|
|
24
15
|
"value": "3px"
|
|
25
16
|
}
|
|
26
|
-
}
|
|
17
|
+
},
|
|
18
|
+
"gutter-width": { "value" : "20px" }
|
|
27
19
|
}
|
|
28
20
|
}
|