@shortfuse/materialdesignweb 0.4.0 → 0.5.0

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.
Files changed (184) hide show
  1. package/.browserslistrc +2 -1
  2. package/.eslintrc.json +59 -8
  3. package/.stylelintrc.json +94 -49
  4. package/CHANGELOG.md +12 -0
  5. package/README.md +1 -3
  6. package/adapters/datatable/column.js +27 -54
  7. package/adapters/datatable/index.js +69 -81
  8. package/adapters/dom/index.js +32 -47
  9. package/adapters/search/index.js +107 -133
  10. package/components/appbar/_spec.scss +77 -137
  11. package/components/banner/_spec.scss +28 -63
  12. package/components/bottomnav/_spec.scss +46 -54
  13. package/components/bottomnav/index.js +15 -20
  14. package/components/bottomnav/item.js +4 -5
  15. package/components/button/README.md +1 -1
  16. package/components/button/_spec.scss +43 -42
  17. package/components/button/_theme.scss +27 -50
  18. package/components/card/_spec.scss +61 -69
  19. package/components/chip/_spec.scss +21 -44
  20. package/components/chip/_theme.scss +79 -151
  21. package/components/chip/index.js +6 -4
  22. package/components/datatable/_spec.scss +36 -99
  23. package/components/datatable/_theme.scss +98 -124
  24. package/components/datatable/cell.js +1 -2
  25. package/components/datatable/columnheader.js +1 -2
  26. package/components/datatable/index.js +33 -47
  27. package/components/datatable/row.js +4 -5
  28. package/components/dialog/_spec.scss +53 -63
  29. package/components/dialog/_theme.scss +7 -0
  30. package/components/dialog/index.js +62 -88
  31. package/components/divider/_spec.scss +6 -8
  32. package/components/elevation/_spec.scss +1 -1
  33. package/components/fab/_spec.scss +30 -42
  34. package/components/fab/index.js +4 -8
  35. package/components/grid/_spec.scss +68 -211
  36. package/components/layout/_mixins.scss +0 -22
  37. package/components/layout/_spec.scss +267 -363
  38. package/components/layout/_theme.scss +10 -35
  39. package/components/layout/index.js +40 -50
  40. package/components/list/_spec.scss +57 -91
  41. package/components/list/_theme.scss +75 -84
  42. package/components/list/content.js +9 -13
  43. package/components/list/index.js +34 -38
  44. package/components/list/item.js +8 -11
  45. package/components/list/secondary.js +8 -9
  46. package/components/menu/_spec.scss +134 -167
  47. package/components/menu/index.js +45 -61
  48. package/components/menu/item.js +11 -19
  49. package/components/progress/_spec.scss +43 -34
  50. package/components/selection/_spec.scss +123 -133
  51. package/components/selection/_theme.scss +88 -120
  52. package/components/selection/index.js +9 -15
  53. package/components/selection/input.js +3 -5
  54. package/components/selection/radiogroup.js +8 -15
  55. package/components/slider/_spec.scss +23 -28
  56. package/components/snackbar/_spec.scss +17 -62
  57. package/components/snackbar/index.js +15 -21
  58. package/components/tab/_spec.scss +35 -50
  59. package/components/tab/content.js +33 -28
  60. package/components/tab/index.js +30 -33
  61. package/components/tab/item.js +4 -5
  62. package/components/tab/list.js +22 -36
  63. package/components/textfield/README.md +2 -2
  64. package/components/textfield/_spec.scss +241 -287
  65. package/components/textfield/_theme.scss +197 -232
  66. package/components/textfield/index.js +8 -16
  67. package/components/tooltip/_spec.scss +23 -26
  68. package/components/type/_spec.scss +19 -16
  69. package/core/_breakpoint.scss +33 -33
  70. package/core/_elevation.scss +40 -0
  71. package/core/_length.scss +0 -1
  72. package/core/_platform.scss +0 -22
  73. package/core/_type.scss +7 -6
  74. package/core/aria/button.js +4 -5
  75. package/core/aria/keyboard.js +1 -2
  76. package/core/aria/rovingtabindex.js +14 -17
  77. package/core/aria/tab.js +1 -2
  78. package/core/dom.js +18 -109
  79. package/core/overlay/_spec.scss +5 -8
  80. package/core/overlay/_theme.scss +126 -150
  81. package/core/overlay/index.js +19 -32
  82. package/core/ripple/_spec.scss +16 -17
  83. package/core/ripple/_theme.scss +13 -33
  84. package/core/ripple/index.js +36 -44
  85. package/core/theme/_aliases.scss +15 -0
  86. package/core/theme/_config.scss +8 -2
  87. package/core/theme/_functions.scss +22 -0
  88. package/core/theme/_palettes.scss +0 -1
  89. package/core/{color → theme}/_spec.scss +0 -0
  90. package/core/theme/_theme.scss +268 -0
  91. package/core/theme/index.scss +4 -0
  92. package/core/transition/index.js +73 -76
  93. package/docs/_flex.scss +7 -1
  94. package/docs/_menuoptions.js +2 -2
  95. package/docs/_partials/_appbar.eta +12 -14
  96. package/docs/_partials/_header.eta +41 -44
  97. package/docs/_sample-utils.js +15 -20
  98. package/docs/docs.scss +123 -87
  99. package/docs/framework.scss +26 -0
  100. package/docs/index.eta +2 -6
  101. package/docs/index.js +7 -0
  102. package/docs/pages/appbar.eta +22 -28
  103. package/docs/pages/bottomnav.js +17 -14
  104. package/docs/pages/button.js +10 -10
  105. package/docs/pages/card.js +20 -22
  106. package/docs/pages/chip.js +11 -13
  107. package/docs/pages/color.js +35 -36
  108. package/docs/pages/datatable.js +11 -15
  109. package/docs/pages/dialog.eta +9 -11
  110. package/docs/pages/dialog.js +6 -9
  111. package/docs/pages/dom.js +6 -9
  112. package/docs/pages/elevation.eta +10 -10
  113. package/docs/pages/fab.js +2 -3
  114. package/docs/pages/grid.js +5 -5
  115. package/docs/pages/list.js +1 -2
  116. package/docs/pages/menu.eta +17 -19
  117. package/docs/pages/menu.js +7 -11
  118. package/docs/pages/overlay.js +1 -2
  119. package/docs/pages/progress.eta +2 -2
  120. package/docs/pages/progress.js +1 -1
  121. package/docs/pages/ripple.js +1 -2
  122. package/docs/pages/search.eta +20 -24
  123. package/docs/pages/search.js +24 -41
  124. package/docs/pages/selection.eta +2 -6
  125. package/docs/pages/selection.js +3 -4
  126. package/docs/pages/snackbar.js +3 -4
  127. package/docs/pages/tab.eta +61 -75
  128. package/docs/pages/tab.js +16 -15
  129. package/docs/pages/textfield.eta +9 -8
  130. package/docs/pages/textfield.js +26 -23
  131. package/docs/pages/tooltip.eta +10 -12
  132. package/docs/pages/transition.js +5 -7
  133. package/docs/postrender.js +7 -5
  134. package/docs/pwa/pwa.eta +14 -16
  135. package/docs/pwa/pwa.js +19 -27
  136. package/docs/pwa/pwa.scss +12 -7
  137. package/docs/themes/theme-colored.scss +9 -11
  138. package/docs/themes/theme-default.scss +0 -14
  139. package/index.scss +27 -0
  140. package/jsconfig.json +7 -3
  141. package/package.json +26 -15
  142. package/tsconfig.json +16 -0
  143. package/{webpack.config.cjs → webpack.config.js} +105 -58
  144. package/components/template/_theme.scss +0 -27
  145. package/components/textfield/_mixins.scss +0 -52
  146. package/core/color/_theme.scss +0 -390
  147. package/core/color/index.scss +0 -2
  148. package/core/theme/_mixins.scss +0 -172
  149. package/core/theme/_variables.scss +0 -24
  150. package/docs/_mixins.pug +0 -155
  151. package/docs/pages/appbar.pug +0 -78
  152. package/docs/pages/bottomnav.pug +0 -137
  153. package/docs/pages/button.pug +0 -121
  154. package/docs/pages/card.pug +0 -74
  155. package/docs/pages/chip.pug +0 -91
  156. package/docs/pages/color.pug +0 -121
  157. package/docs/pages/datatable.pug +0 -283
  158. package/docs/pages/dialog.pug +0 -132
  159. package/docs/pages/dom.pug +0 -22
  160. package/docs/pages/elevation.pug +0 -25
  161. package/docs/pages/fab.pug +0 -66
  162. package/docs/pages/grid.pug +0 -95
  163. package/docs/pages/layout.pug +0 -7
  164. package/docs/pages/list.pug +0 -326
  165. package/docs/pages/menu.pug +0 -205
  166. package/docs/pages/overlay.pug +0 -55
  167. package/docs/pages/progress.pug +0 -16
  168. package/docs/pages/ripple.pug +0 -21
  169. package/docs/pages/search.pug +0 -165
  170. package/docs/pages/selection.pug +0 -74
  171. package/docs/pages/slider.pug +0 -17
  172. package/docs/pages/snackbar.pug +0 -60
  173. package/docs/pages/tab.pug +0 -304
  174. package/docs/pages/textfield.pug +0 -360
  175. package/docs/pages/tooltip.pug +0 -78
  176. package/docs/pages/transition.pug +0 -76
  177. package/docs/pages/type.pug +0 -29
  178. package/docs/pwa/_dialogs.pug +0 -96
  179. package/docs/pwa/_menus.pug +0 -11
  180. package/docs/pwa/pwa.pug +0 -325
  181. package/docs/spec.scss +0 -26
  182. package/docs/themes/_component-themes.scss +0 -26
  183. package/docs/themes/theme-colored-fallbacks.scss +0 -17
  184. package/docs/themes/theme-default-fallbacks.scss +0 -17
@@ -5,11 +5,11 @@
5
5
  @use '../../core/_motion.scss' as motion;
6
6
 
7
7
  $delay: 40ms !default;
8
- $padding: dp(16) !default;
9
- $size: dp(56) !default;
10
- $miniSize: dp(40) !default;
11
- $miniPadding: dp(8) !default;
12
- $iconSize: dp(24) !default;
8
+ $padding: 16px !default;
9
+ $size: 56px !default;
10
+ $miniSize: 40px !default;
11
+ $miniPadding: 8px !default;
12
+ $iconSize: 24px !default;
13
13
 
14
14
  .mdw-fab {
15
15
  display: flex;
@@ -18,9 +18,10 @@ $iconSize: dp(24) !default;
18
18
  flex-direction: column-reverse;
19
19
  justify-content: center;
20
20
 
21
- height: dp(56);
21
+ block-size: 56px;
22
22
 
23
23
  pointer-events: none;
24
+
24
25
  z-index: 6;
25
26
 
26
27
  &[mdw-horizontal] {
@@ -30,14 +31,12 @@ $iconSize: dp(24) !default;
30
31
 
31
32
  .mdw-fab__close {
32
33
  position: fixed;
33
- top: 0;
34
- right: 0;
35
- bottom: 0;
36
- left: 0;
34
+ inset: 0;
37
35
 
38
36
  cursor: default;
39
37
 
40
38
  pointer-events: auto;
39
+
41
40
  visibility: hidden;
42
41
  // z-index: -1; // Safari has a negative z-index bug
43
42
  }
@@ -46,14 +45,14 @@ $iconSize: dp(24) !default;
46
45
  order: -1;
47
46
 
48
47
  box-sizing: content-box;
49
- height: dp(24);
50
- min-width: dp(24);
48
+ block-size: 24px;
49
+ min-inline-size: 24px;
51
50
  margin: 0;
52
- padding: dp(16);
51
+ padding: 16px;
53
52
 
54
53
  pointer-events: auto;
55
54
 
56
- border-radius: dp(32);
55
+ border-radius: 32px;
57
56
  box-shadow: elevation.boxShadow(6);
58
57
 
59
58
  &:active {
@@ -61,34 +60,30 @@ $iconSize: dp(24) !default;
61
60
  }
62
61
 
63
62
  &[mdw-extended] {
64
- padding: dp(12);
63
+ padding: 12px;
65
64
  }
66
65
 
67
66
  &[mdw-mini] {
68
- padding: dp(8);
67
+ padding: 8px;
69
68
  }
70
69
  }
71
70
 
72
71
  .mdw-fab__speed-dial {
73
72
  display: flex;
74
73
  position: absolute;
75
- right: 0;
76
- bottom: 100%;
77
- left: auto;
74
+ inset-block-end: 100%;
75
+ inset-inline: auto 0;
76
+
78
77
  align-items: center;
79
78
  flex-direction: inherit;
80
79
  order: 1;
81
80
 
82
81
  pointer-events: none;
83
- z-index: inherit;
84
82
 
85
- :root[dir="rtl"] & {
86
- right: auto;
87
- left: 0;
88
- }
83
+ z-index: inherit;
89
84
 
90
85
  & > .mdw-fab__button.mdw-button {
91
- margin: 0 0 dp(16) 0;
86
+ margin: 0 0 16px 0;
92
87
 
93
88
  transition-duration: motion.$collapseDuration;
94
89
  transition-property: transform, opacity;
@@ -98,14 +93,14 @@ $iconSize: dp(24) !default;
98
93
  transform: scale(0);
99
94
 
100
95
  &[mdw-mini] {
101
- margin: 0 dp(8) dp(16) dp(8);
96
+ margin: 0 8px 16px 8px;
102
97
 
103
98
  .mdw-fab__button[mdw-mini] ~ & {
104
- margin: 0 0 dp(16) 0;
99
+ margin: 0 0 16px 0;
105
100
  }
106
101
 
107
102
  .mdw-fab__button[mdw-extended] ~ & {
108
- margin: 0 dp(4) dp(16) dp(4);
103
+ margin: 0 4px 16px 4px;
109
104
  }
110
105
  }
111
106
  @for $i from 1 through 7 {
@@ -119,8 +114,8 @@ $iconSize: dp(24) !default;
119
114
  .mdw-fab__icon {
120
115
  position: relative;
121
116
 
122
- height: $iconSize;
123
- width: $iconSize;
117
+ block-size: $iconSize;
118
+ inline-size: $iconSize;
124
119
 
125
120
  transition-duration: 200ms;
126
121
  transition-property: margin;
@@ -131,7 +126,7 @@ $iconSize: dp(24) !default;
131
126
  overflow: hidden;
132
127
 
133
128
  transition-duration: 200ms;
134
- transition-property: font-size, margin-left, margin-right;
129
+ transition-property: font-size, margin-inline;
135
130
  transition-timing-function: linear;
136
131
  will-change: font-size;
137
132
 
@@ -141,7 +136,7 @@ $iconSize: dp(24) !default;
141
136
 
142
137
  .mdw-fab__button[mdw-extended]:not([mdw-extended="hover"]),
143
138
  .mdw-fab__button[mdw-extended="hover"]:hover {
144
- padding: dp(12) dp(16);
139
+ padding: 12px 16px;
145
140
 
146
141
  .mdw-fab__text {
147
142
  font-size: inherit;
@@ -149,21 +144,15 @@ $iconSize: dp(24) !default;
149
144
  }
150
145
 
151
146
  .mdw-fab__icon + .mdw-fab__text {
152
- margin-right: dp(4);
153
- margin-left: dp(8);
154
-
155
- :root[dir="rtl"] & {
156
- margin-right: dp(8);
157
- margin-left: dp(4);
158
- }
147
+ margin-inline: 8px 4px;
159
148
  }
160
149
  }
161
150
 
162
151
  .mdw-fab__hidden-icon,
163
152
  .mdw-fab__shown-icon {
164
153
  position: absolute;
165
- top: 0;
166
- left: 0;
154
+ inset-block-start: 0;
155
+ inset-inline-start: 0;
167
156
  }
168
157
 
169
158
  .mdw-fab__shown-icon {
@@ -175,7 +164,6 @@ $iconSize: dp(24) !default;
175
164
  pointer-events: none;
176
165
  }
177
166
 
178
-
179
167
  .mdw-fab:target,
180
168
  .mdw-fab[mdw-show]:not([mdw-hide]) {
181
169
  > .mdw-fab__button {
@@ -1,5 +1,3 @@
1
- import { findElementParentByClassName } from '../../core/dom.js';
2
-
3
1
  /**
4
2
  * @param {Element} fabElement
5
3
  * @return {boolean} handled
@@ -39,9 +37,8 @@ export function hide(fabElement) {
39
37
  * @return {void}
40
38
  */
41
39
  export function onCloserClicked(event) {
42
- /** @type {HTMLElement} */
43
- const closer = (event.currentTarget);
44
- const fabElement = findElementParentByClassName(closer, 'mdw-fab');
40
+ const closer = /** @type {HTMLElement} */ (event.currentTarget);
41
+ const fabElement = closer.closest('.mdw-fab');
45
42
  if (!fabElement) {
46
43
  return;
47
44
  }
@@ -64,9 +61,8 @@ export function toggle(fabElement) {
64
61
  * @return {void}
65
62
  */
66
63
  export function onFabButtonClicked(event) {
67
- /** @type {HTMLElement} */
68
- const button = (event.currentTarget);
69
- const fabElement = findElementParentByClassName(button, 'mdw-fab');
64
+ const button = /** @type {HTMLElement} */ (event.currentTarget);
65
+ const fabElement = button.closest('.mdw-fab');
70
66
  if (!fabElement) {
71
67
  return;
72
68
  }
@@ -7,29 +7,33 @@
7
7
  @use '../../core/_length.scss' as *;
8
8
  @use '../../core/_motion.scss' as motion;
9
9
 
10
- $margin: dp(24) !default;
11
- $gutter: dp(24) !default;
10
+ :root {
11
+ --mdw-grid__margin: 24px;
12
+ --mdw-grid__gutter: 24px;
13
+ @include breakpoint.has16DPMargin() {
14
+ --mdw-grid__margin: 16px;
15
+ --mdw-grid__gutter: 16px;
16
+ }
17
+ }
12
18
 
13
19
  .mdw-grid {
20
+ --mdw-grid__columns: 12;
21
+ --mdw-grid__item-flex-grow: 0;
22
+ --mdw-grid__item-min-width: none;
23
+
14
24
  display: flex;
15
25
  flex-wrap: wrap;
16
26
  grid-auto-flow: row;
17
27
  grid-auto-rows: auto;
18
- grid-template-columns: repeat(12, 1fr);
28
+ grid-template-columns: repeat(var(--mdw-grid__columns), 1fr);
19
29
 
20
- margin-top: -$gutter;
21
-
22
- margin-left: -$gutter;
23
- padding-right: $margin;
24
-
25
- padding-left: $margin;
26
- -ms-grid-columns: unquote("(1fr)[12]");
27
- -ms-grid-rows: auto;
30
+ margin-block-start: calc(-1 * var(--mdw-grid__gutter));
31
+ margin-inline-start: calc(-1 * var(--mdw-grid__gutter));
32
+ padding-inline: var(--mdw-grid__margin);
28
33
 
29
34
  &[mdw-grid] {
30
- // IE11 is currently unsupported due to lack of automatic placement
35
+ --mdw-grid__item-min-width: 100%;
31
36
  display: grid;
32
- display: -ms-grid;
33
37
  }
34
38
 
35
39
  &[mdw-dense] {
@@ -41,271 +45,124 @@ $gutter: dp(24) !default;
41
45
  }
42
46
 
43
47
  &[mdw-margin-top] {
44
- padding-top: $margin;
48
+ padding-block-start: var(--mdw-grid__margin);
45
49
  }
46
50
 
47
51
  &[mdw-margin-bottom] {
48
- padding-bottom: $margin;
52
+ padding-block-end: var(--mdw-grid__margin);
49
53
  }
50
54
 
51
- }
52
-
53
- @mixin item($columnCount) {
54
- &[mdw-colspan="1"],
55
- &:not([mdw-colspan]) {
56
- width: #{math.div(100%, $columnCount)};
55
+ &[mdw-columns="8"] {
56
+ --mdw-grid__columns: 8;
57
57
  }
58
58
 
59
- &[mdw-stretch] {
60
- max-width: none;
59
+ &[mdw-columns="4"] {
60
+ --mdw-grid__columns: 4;
61
61
  }
62
- @for $i from 2 to 12 {
63
- &[mdw-colspan="#{$i}"] {
64
- @if ($i > $columnCount) {
65
- -ms-grid-column-span: #{$columnCount};
66
- grid-column-end: span #{$columnCount};
67
62
 
68
- width: 100%;
69
- } @else {
70
- width: #{math.div($i * 100%, $columnCount)};
71
- }
63
+ &[mdw-columns="1"] {
64
+ --mdw-grid__columns: 1;
65
+
66
+ & > .mdw-grid__item {
67
+ inline-size: 100%;
72
68
  }
73
69
  }
74
- @each $percent in (25, 50, 75, 100) {
75
- &[mdw-colspan="#{$percent}%"] {
76
- $value: $percent * 0.01 * $columnCount;
77
- -ms-grid-column-span: #{$value};
78
- grid-column-end: span #{$value};
79
- @if ($value < 1) {
80
- $value: $columnCount;
81
- width: 100%;
82
- }
83
- }
70
+
71
+ &[mdw-stretch] {
72
+ --mdw-grid__item-flex-grow: 1;
84
73
  }
74
+
85
75
  }
86
76
 
87
77
  .mdw-grid__item {
88
-
89
- @include item(12);
90
78
  box-sizing: border-box;
91
- max-width: 100%;
92
- flex-grow: 0;
79
+ min-inline-size: var(--mdw-grid__item-min-width);
80
+ max-inline-size: 100%;
81
+
82
+ inline-size: calc(100% / var(--mdw-grid__columns));
83
+ flex-grow: var(--mdw-grid__item-flex-grow);
93
84
  flex-shrink: 1;
94
- padding-top: $gutter;
95
- padding-left: $gutter;
85
+ padding-block-start: var(--mdw-grid__gutter);
86
+ padding-inline-start: var(--mdw-grid__gutter);
96
87
 
97
88
  transition-duration: motion.$shapeChangeDuration;
98
89
  transition-property: flex, width, padding;
99
90
  transition-timing-function: motion.$standardEasing;
100
91
 
101
- .mdw-grid[mdw-grid] > & {
102
- min-width: 100%;
103
- }
104
-
105
- .mdw-grid[mdw-stretch] > & {
106
- flex-grow: 1;
107
- }
108
-
109
- &[mdw-colspan="25%"] {
110
- width: 25%;
111
- }
112
-
113
- &[mdw-colspan="50%"] {
114
- width: 50%;
115
- }
116
-
117
- &[mdw-colspan="75%"] {
118
- width: 75%;
119
- }
120
-
121
- &[mdw-colspan="100%"] {
122
- width: 100%;
92
+ &[mdw-stretch] {
93
+ max-inline-size: none;
123
94
  }
124
95
 
125
96
  @for $i from 2 to 12 {
126
- &[mdw-rowspan="#{$i}"] {
127
- -ms-grid-row-span: #{$i};
128
- grid-row-end: span #{$i};
129
- }
130
-
131
97
  &[mdw-colspan="#{$i}"] {
132
- -ms-grid-column-span: #{$i};
133
- grid-column-end: span #{$i};
134
- }
135
- }
136
- }
98
+ grid-column-end: span min(#{$i}, var(--mdw-grid__columns));
137
99
 
138
- @include breakpoint.has16DPMargin() {
139
- .mdw-grid {
140
- margin-top: dp(-16);
141
- margin-left: dp(-16);
142
- padding-right: dp(16);
143
- padding-left: dp(16);
144
-
145
- &[mdw-margin-top] {
146
- padding-top: dp(16);
100
+ inline-size: calc(#{$i} * 100% / var(--mdw-grid__columns));
147
101
  }
148
-
149
- &[mdw-margin-bottom] {
150
- padding-bottom: dp(16);
102
+ &[mdw-rowspan="#{$i}"] {
103
+ grid-row-end: span #{$i};
151
104
  }
105
+ }
106
+ @each $percent in (25, 50, 75, 100) {
107
+ &[mdw-colspan="#{$percent}%"] {
108
+ grid-column-end: span calc($percent / 100 * var(--mdw-grid__columns));
152
109
 
153
- & > .mdw-grid__item {
154
- padding-top: dp(16);
155
- padding-left: dp(16);
110
+ inline-size: #{$percent + '%'};
156
111
  }
157
112
  }
158
113
  }
159
114
 
160
115
  .mdw-grid__content {
161
116
  box-sizing: border-box;
162
- max-height: 100%;
163
- height: 100%;
164
- max-width: 100%;
165
- width: 100%;
117
+ max-block-size: 100%;
118
+ block-size: 100%;
119
+ max-inline-size: 100%;
120
+ inline-size: 100%;
166
121
  flex: 100%;
167
122
  }
168
123
 
169
- // 8 Columns (Explicit on >=840dp, Implicit on < 840dp)
170
- .mdw-grid[mdw-columns="8"] {
171
- grid-template-columns: repeat(8, 1fr);
172
- -ms-grid-columns: unquote("(1fr)[8]");
173
-
174
- & > .mdw-grid__item {
175
- @include item(8);
176
- }
177
- }
178
- @include breakpoint.max8Columns() {
179
- .mdw-grid {
180
- grid-template-columns: repeat(8, 1fr);
181
- -ms-grid-columns: unquote("(1fr)[8]");
182
- }
183
-
184
- .mdw-grid__item {
185
- @include item(8);
186
- }
187
- }
188
-
189
- // 4 Columns (Explicit on >=600dp, Implicit on <600dp)
190
- .mdw-grid[mdw-columns="4"] {
191
- grid-template-columns: repeat(4, 1fr);
192
- -ms-grid-columns: unquote("(1fr)[4]");
193
-
194
- & > .mdw-grid__item {
195
- @include item(4);
196
- }
197
- }
198
-
199
- @include breakpoint.is4Columns() {
200
- .mdw-grid,
201
- .mdw-grid[mdw-columns="8"] {
202
- grid-template-columns: repeat(4, 1fr);
203
- -ms-grid-columns: unquote("(1fr)[4]");
204
- }
205
-
206
- .mdw-grid__item,
207
- .mdw-grid[mdw-columns="8"] > .mdw-grid__item {
208
- @include item(4);
209
- }
210
- }
211
-
212
- // 1 Column (Explicit on all)
213
- .mdw-grid[mdw-columns="1"] {
214
- grid-template-columns: 1fr;
215
- -ms-grid-columns: 1fr;
216
-
217
- & > .mdw-grid__item {
218
- @include item(1);
219
- }
220
- }
221
-
222
124
  // 1-column uses same margin values as 12-column
223
125
  @each $value in (0, 8, 16, 24, 40) {
224
126
  .mdw-grid[mdw-margin="#{$value}"],
225
127
  .mdw-grid[mdw-columns="1"][mdw-margin="#{$value}"],
226
128
  .mdw-grid[mdw-columns="8"][mdw-margin-8col="#{$value}"],
227
129
  .mdw-grid[mdw-columns="4"][mdw-margin-4col="#{$value}"] {
228
- padding-right: dp($value);
229
- padding-left: dp($value);
230
-
231
- &[mdw-margin-bottom] {
232
- padding-bottom: dp($value);
233
- }
234
-
235
- &[mdw-margin-top] {
236
- padding-top: dp($value);
237
- }
130
+ --mdw-grid__margin: #{dp($value)};
238
131
  }
239
132
 
240
133
  .mdw-grid[mdw-gutter="#{$value}"],
241
134
  .mdw-grid[mdw-columns="1"][mdw-gutter="#{$value}"],
242
135
  .mdw-grid[mdw-columns="8"][mdw-gutter-8col="#{$value}"],
243
136
  .mdw-grid[mdw-columns="4"][mdw-gutter-4col="#{$value}"] {
244
- margin-top: dp(-$value);
245
- margin-left: dp(-$value);
246
-
247
- & > .mdw-grid__item {
248
- padding-top: dp($value);
249
- padding-left: dp($value);
250
- }
137
+ --mdw-grid__gutter: #{dp($value)};
251
138
  }
252
139
  }
253
140
 
254
- // 8-col grids use 8col variable
255
141
  @include breakpoint.max8Columns() {
256
- @each $value in (0, 8, 16, 24, 40) {
257
- .mdw-grid[mdw-margin-8col="#{$value}"] {
258
- padding-right: dp($value);
259
- padding-left: dp($value);
260
-
261
- &[mdw-margin-bottom] {
262
- padding-bottom: dp($value);
142
+ .mdw-grid {
143
+ --mdw-grid__columns: 8;
144
+ @each $value in (0, 8, 16, 24, 40) {
145
+ &[mdw-margin-8col="#{$value}"] {
146
+ --mdw-grid__margin: #{dp($value)};
263
147
  }
264
148
 
265
- &[mdw-margin-top] {
266
- padding-top: dp($value);
267
- }
268
- }
269
-
270
- .mdw-grid[mdw-gutter-8col="#{$value}"] {
271
- margin-top: dp(-$value);
272
- margin-left: dp(-$value);
273
-
274
- & > .mdw-grid__item {
275
- padding-top: dp($value);
276
- padding-left: dp($value);
149
+ &[mdw-gutter-8col="#{$value}"] {
150
+ --mdw-grid__gutter: #{dp($value)};
277
151
  }
278
152
  }
279
153
  }
280
154
  }
281
155
 
282
- // 4col grids use 4col variable
283
- // Overrides 8col and 12col
284
156
  @include breakpoint.is4Columns() {
285
- @each $value in (0, 8, 16, 24, 40) {
286
- .mdw-grid,
287
- .mdw-grid[mdw-columns="8"] {
157
+ .mdw-grid {
158
+ --mdw-grid__columns: 4;
159
+ @each $value in (0, 8, 16, 24, 40) {
288
160
  &[mdw-margin-4col="#{$value}"] {
289
- padding-right: dp($value);
290
- padding-left: dp($value);
291
-
292
- &[mdw-margin-bottom] {
293
- padding-bottom: dp($value);
294
- }
295
-
296
- &[mdw-margin-top] {
297
- padding-top: dp($value);
298
- }
161
+ --mdw-grid__margin: #{dp($value)};
299
162
  }
300
163
 
301
164
  &[mdw-gutter-4col="#{$value}"] {
302
- margin-top: dp(-$value);
303
- margin-left: dp(-$value);
304
-
305
- > .mdw-grid__item {
306
- padding-top: dp($value);
307
- padding-left: dp($value);
308
- }
165
+ --mdw-grid__gutter: #{dp($value)};
309
166
  }
310
167
  }
311
168
  }
@@ -9,25 +9,3 @@
9
9
  @content;
10
10
  }
11
11
  }
12
-
13
- @mixin gridColumn($start, $end: null) {
14
- @if ($end == null) {
15
- $end: $start;
16
- }
17
- -ms-grid-column: $start;
18
- grid-column-start: $start;
19
- -ms-grid-column-span: #{($end - $start) + 1};
20
- grid-column-end: span #{($end - $start) + 1};
21
- }
22
-
23
-
24
- @mixin gridRow($top, $bottom: null) {
25
- @if ($bottom == null) {
26
- $bottom: $top;
27
- }
28
- -ms-grid-row: $top;
29
- grid-row-start: $top;
30
- -ms-grid-row-span: #{($bottom - $top) + 1};
31
- grid-row-end: span #{($bottom - $top) + 1};
32
- }
33
-