@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
@@ -3,8 +3,7 @@
3
3
  import * as ListContent from '../../components/list/content.js';
4
4
  import * as List from '../../components/list/index.js';
5
5
  import * as TextField from '../../components/textfield/index.js';
6
- import { getTextNode, iterateArrayLike, iterateSomeOfArrayLike } from '../../core/dom.js';
7
- import { noop } from '../../utils/function.js';
6
+ import { getTextNode } from '../../core/dom.js';
8
7
 
9
8
  /**
10
9
  * @param {string} input
@@ -13,7 +12,7 @@ import { noop } from '../../utils/function.js';
13
12
  */
14
13
  function containsTextFilter(input, content) {
15
14
  return content.trim().toLocaleLowerCase()
16
- .indexOf(input.trim().toLocaleLowerCase()) !== -1;
15
+ .includes(input.trim().toLocaleLowerCase());
17
16
  }
18
17
 
19
18
  /**
@@ -61,17 +60,13 @@ function selectSibling(list, backwards) {
61
60
  const items = list.querySelectorAll('[role="option"]:not([aria-hidden="true"]):not([disabled])');
62
61
  let sibling;
63
62
  if (current && current.getAttribute('aria-hidden') !== 'true') {
64
- iterateSomeOfArrayLike(items, (item, index) => {
65
- if (item !== current) {
66
- return false;
67
- }
68
- if (backwards) {
69
- sibling = items[index - 1];
70
- } else {
71
- sibling = items[index + 1];
63
+ for (let i = 0; i < items.length; i++) {
64
+ const item = items.item(i);
65
+ if (item === current) {
66
+ sibling = backwards ? items[i - 1] : items[i + 1];
67
+ break;
72
68
  }
73
- return true;
74
- });
69
+ }
75
70
  } else if (backwards) {
76
71
  sibling = items[items.length - 1];
77
72
  } else {
@@ -88,38 +83,41 @@ function selectSibling(list, backwards) {
88
83
  }
89
84
 
90
85
  /**
91
- * @param {Element} listItem
92
- * @return {void}
86
+ * @param {Element} el
87
+ * @return {number}
93
88
  */
94
- function scrollItemIntoView(listItem) {
95
- /**
96
- * @param {Element} el
97
- * @return {number}
98
- */
99
- function getElementVisibility(el) {
100
- let rect = el.getBoundingClientRect();
101
- const { top, height } = rect;
102
- let next = el.parentElement;
103
- do {
104
- rect = next.getBoundingClientRect();
105
- if ((top + height) > rect.bottom) {
106
- // bottom clipped
107
- return 1;
108
- }
109
- if (top < rect.top) {
110
- // top clipped
111
- return -1;
112
- }
113
- next = next.parentElement;
114
- } while (next !== document.body);
115
- if (top < 0) {
116
- return -1;
117
- }
118
- if ((top + height) > document.documentElement.clientHeight) {
89
+ function getElementVisibility(el) {
90
+ let rect = el.getBoundingClientRect();
91
+ const { top, height } = rect;
92
+ let next = el.parentElement;
93
+ do {
94
+ rect = next.getBoundingClientRect();
95
+ // eslint-disable-next-line unicorn/consistent-destructuring
96
+ if ((top + height) > rect.bottom) {
97
+ // bottom clipped
119
98
  return 1;
120
99
  }
121
- return 0;
100
+ // eslint-disable-next-line unicorn/consistent-destructuring
101
+ if (top < rect.top) {
102
+ // top clipped
103
+ return -1;
104
+ }
105
+ next = next.parentElement;
106
+ } while (next !== document.body);
107
+ if (top < 0) {
108
+ return -1;
109
+ }
110
+ if ((top + height) > document.documentElement.clientHeight) {
111
+ return 1;
122
112
  }
113
+ return 0;
114
+ }
115
+
116
+ /**
117
+ * @param {Element} listItem
118
+ * @return {void}
119
+ */
120
+ function scrollItemIntoView(listItem) {
123
121
  const visibility = getElementVisibility(listItem);
124
122
  if (visibility < 0) {
125
123
  listItem.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' });
@@ -145,8 +143,8 @@ function scrollItemIntoView(listItem) {
145
143
  * @prop {boolean} [dropdown=false]
146
144
  * @prop {boolean} [filterItems=true]
147
145
  * @prop {('replace'|'append'|'none')} [suggestionMethod='replace']
148
- * @prop {function(string, function(T[]=), function(Error=)=):void} [performSearch]
149
- * @prop {function(T[], function(), function(Error=)):void} [updateList]
146
+ * @prop {function(string):(Promise<T[]>)|T[]} [performSearch]
147
+ * @prop {function(T[]):(Promise<void>|void)} [updateList]
150
148
  * @prop {boolean} [searchOnFocus=true]
151
149
  * @prop {number} [debounce=null] Debounce time in milliseconds
152
150
  */
@@ -167,12 +165,10 @@ export default class SearchAdapter {
167
165
  this.filter = containsTextFilter;
168
166
  }
169
167
  this.itemTextParser = defaultItemTextParser || options.itemTextParser;
170
- /** @type {HTMLInputElement} */
171
- const input = (this.textfield.getElementsByClassName('mdw-textfield__input')[0]);
168
+ const input = /** @type {HTMLInputElement} */ (this.textfield.getElementsByClassName('mdw-textfield__input')[0]);
172
169
  this.input = input;
173
170
  this.list.addEventListener(ListContent.ACTIVATE_EVENT, (event) => {
174
- /** @type {HTMLElement} */
175
- const item = (event.target);
171
+ const item = /** @type {HTMLElement} */(event.target);
176
172
  this.onItemSelected(item);
177
173
  const inputValue = this.input.value || '';
178
174
  this.suggestedInput = inputValue;
@@ -209,12 +205,30 @@ export default class SearchAdapter {
209
205
  this.debounce = options.debounce;
210
206
  this.suggestionMethod = options.suggestionMethod || 'replace';
211
207
  this.currentSearchTerm = this.input.value || '';
212
- /** @type {string} */
208
+ /** @type {?string} */
213
209
  this.suggestedInput = null;
214
- /** @type {string} */
210
+ /** @type {?string} */
215
211
  this.previousValue = null;
216
- this.performSearch = options.performSearch || ((value, resolve = noop) => resolve());
217
- this.updateList = options.updateList || ((results, resolve = noop) => resolve());
212
+ this.performSearch = options.performSearch || this.performSearch.bind(this);
213
+ this.updateList = options.updateList || this.updateList.bind(this);
214
+ }
215
+
216
+ /**
217
+ * @param {string} value
218
+ * @return {Promise<T[]>|T[]}
219
+ */
220
+ // eslint-disable-next-line class-methods-use-this
221
+ performSearch(value) {
222
+ return [];
223
+ }
224
+
225
+ /**
226
+ * @param {T[]} results
227
+ * @return {Promise<void>|void}
228
+ */
229
+ // eslint-disable-next-line class-methods-use-this
230
+ updateList(results) {
231
+ return undefined;
218
232
  }
219
233
 
220
234
  /**
@@ -237,90 +251,54 @@ export default class SearchAdapter {
237
251
  this.previousValue = inputValue;
238
252
  this.currentSearchTerm = inputValue;
239
253
 
240
- /**
241
- * @param {Error} error
242
- * @return {void}
243
- */
244
- function onErrorCallback(error) {
245
- if (error.message === 'debounced') {
246
- return;
247
- }
248
- if (error.message === 'expired') {
249
- return;
254
+ void (async () => {
255
+ try {
256
+ await this.performDebounce(inputValue);
257
+ await this.checkExpired(inputValue);
258
+ const searchResults = await this.performSearch(inputValue);
259
+ await this.checkExpired(inputValue);
260
+ await this.updateList(searchResults);
261
+ await this.filterListItems();
262
+ } catch (error) {
263
+ if (error.message === 'debounced') {
264
+ return;
265
+ }
266
+ if (error.message === 'expired') {
267
+ return;
268
+ }
269
+ throw error;
250
270
  }
251
- throw error;
252
- }
253
-
254
- // IE does not support ES6 Promises
255
- // Using resolve/reject callbacks instead.
256
- // Syntactically ugly, but removes need for a polyfill.
257
- this.performDebounce(inputValue,
258
- () => this.checkExpired(inputValue,
259
- () => this.performSearch(inputValue,
260
- (searchResults) => this.checkExpired(inputValue,
261
- () => this.updateList(searchResults,
262
- () => this.filterListItems(),
263
- onErrorCallback),
264
- onErrorCallback),
265
- onErrorCallback),
266
- onErrorCallback),
267
- onErrorCallback);
268
-
269
- /**
270
- * Promise.resolve()
271
- * .then(() => this.performDebounce(inputValue))
272
- * .then(() => this.checkExpired(inputValue))
273
- * .then(() => this.performSearch(inputValue))
274
- * .then((searchResults) => {
275
- * results = searchResults;
276
- * })
277
- * .then(() => this.checkExpired(inputValue))
278
- * .then(() => this.updateList(results))
279
- * .then(() => this.filterListItems())
280
- * .catch((error) => {
281
- * if (error.message === 'debounced') {
282
- * return;
283
- * }
284
- * if (error.message === 'expired') {
285
- * return;
286
- * }
287
- * throw error;
288
- * });
289
- */
271
+ })();
290
272
  }
291
273
 
292
274
  /**
293
275
  * @param {string} inputValue
294
- * @param {Function} resolve
295
- * @param {function(Error):any} reject
296
- * @return {void}
276
+ * @return {Promise<void>}
297
277
  */
298
- checkExpired(inputValue, resolve, reject) {
278
+ checkExpired(inputValue) {
299
279
  if (inputValue === this.currentSearchTerm) {
300
- resolve();
301
- } else {
302
- reject(new Error('expired'));
280
+ return Promise.resolve();
303
281
  }
282
+ return Promise.reject(new Error('expired'));
304
283
  }
305
284
 
306
285
  /**
307
286
  * @param {string} searchTerm
308
- * @param {Function} resolve
309
- * @param {function(Error):any} reject
310
- * @return {void}
287
+ * @return {Promise<void>}
311
288
  */
312
- performDebounce(searchTerm, resolve, reject) {
289
+ performDebounce(searchTerm) {
313
290
  if (!this.debounce) {
314
- resolve();
315
- return;
291
+ return Promise.resolve();
316
292
  }
317
- setTimeout(() => {
318
- if (searchTerm !== this.currentSearchTerm) {
319
- reject(new Error('debounced'));
320
- return;
321
- }
322
- resolve();
323
- }, this.debounce);
293
+ return new Promise((resolve, reject) => {
294
+ setTimeout(() => {
295
+ if (searchTerm !== this.currentSearchTerm) {
296
+ reject(new Error('debounced'));
297
+ return;
298
+ }
299
+ resolve();
300
+ }, this.debounce);
301
+ });
324
302
  }
325
303
 
326
304
  /** @return {boolean} handled */
@@ -423,7 +401,7 @@ export default class SearchAdapter {
423
401
  const current = this.list.querySelector('[role="option"][aria-selected="true"]');
424
402
  const items = this.list.querySelectorAll('[role="option"]');
425
403
  let hasItem = false;
426
- iterateArrayLike(items, (item) => {
404
+ for (const item of items) {
427
405
  const content = this.itemTextParser(item);
428
406
  const fn = fnFilter || this.filter;
429
407
  if (fn(input, content)) {
@@ -432,7 +410,7 @@ export default class SearchAdapter {
432
410
  } else {
433
411
  item.setAttribute('aria-hidden', 'true');
434
412
  }
435
- });
413
+ }
436
414
  if (current && current.getAttribute('aria-hidden') === 'true') {
437
415
  const newSelection = selectSibling(this.list);
438
416
  if (newSelection) {
@@ -495,23 +473,19 @@ export default class SearchAdapter {
495
473
  case 'Enter': {
496
474
  /** @type {HTMLElement} */
497
475
  const current = this.list.querySelector('[role="option"][aria-selected="true"]');
498
- if (current) {
499
- if (this.hideDropDown()) {
500
- current.click();
501
- event.stopPropagation();
502
- event.preventDefault();
503
- }
476
+ if (current && this.hideDropDown()) {
477
+ current.click();
478
+ event.stopPropagation();
479
+ event.preventDefault();
504
480
  }
505
481
  break;
506
482
  }
507
483
  case 'Tab': {
508
484
  /** @type {HTMLElement} */
509
485
  const current = this.list.querySelector('[role="option"][aria-selected="true"]');
510
- if (current) {
511
- if (this.hideDropDown()) {
512
- current.click();
513
- event.stopPropagation();
514
- }
486
+ if (current && this.hideDropDown()) {
487
+ current.click();
488
+ event.stopPropagation();
515
489
  }
516
490
  break;
517
491
  }
@@ -5,136 +5,118 @@
5
5
  @use '../../core/_length.scss' as *;
6
6
  @use '../../core/_type.scss' as type;
7
7
 
8
- $height: 64 !default;
9
- $heightDense: 48 !default;
10
- $heightMobile: 56 !default;
11
- $heightMobileLandscape: 48 !default;
12
- $heightProminent: 128 !default;
13
- $heightProminentDense: 96 !default;
14
- $iconHeight: 40 !default;
15
-
16
- .mdw-appbar {
17
- display: flex;
18
- flex-direction: column;
8
+ :root {
9
+ --mdw-appbar__min-block-size: 64px;
10
+ --mdw-appbar__min-block-size__dense: 48px;
11
+ --mdw-appbar__min-block-size__prominent: 128px;
12
+ --mdw-appbar__min-block-size__prominent__dense: 96px;
13
+ --mdw-appbar__min-block-size__mobile: 56px;
14
+ --mdw-appbar__min-block-size__mobile__landscape: 48px;
15
+ --mdw-appbar__content-margin-inline: 24px;
16
+ --mdw-appbar__start-margin-inline-start: 8px;
17
+ @include breakpoint.has16DPMargin() {
18
+ --mdw-appbar__content-margin-inline: 16px;
19
+ --mdw-appbar__start-margin-inline-start: 0;
20
+ }
21
+ @include breakpoint.maxTabletDevice {
22
+ // No high density on mobile
23
+ --mdw-appbar__min-block-size: var(--mdw-appbar__min-block-size__mobile);
24
+ --mdw-appbar__min-block-size__dense: var(--mdw-appbar__min-block-size__mobile);
25
+ --mdw-appbar__min-block-size__prominent__dense: var(--mdw-appbar__min-block-size__prominent);
26
+ }
27
+ @include breakpoint.isMobileDeviceLandscape {
28
+ --mdw-appbar__min-block-size: var(--mdw-appbar__min-block-size__mobile__landscape);
29
+ --mdw-appbar__min-block-size__dense: var(--mdw-appbar__min-block-size__mobile__landscape);
30
+ }
31
+ --mdw-appbar__icon-min-block-size: 40px;
19
32
  }
20
33
 
21
- .mdw-appbar__action {
22
- display: -ms-grid;
34
+ .mdw-appbar {
23
35
  display: grid;
36
+
24
37
  grid-template-columns: auto 1fr auto;
25
- -ms-grid-columns: auto 1fr auto;
26
-
27
- min-height: dp($height);
28
- -ms-grid-rows: minmax(dp($height), 1fr) auto;
38
+ grid-template-rows: auto auto;
39
+
40
+ min-block-size: var(--mdw-appbar__min-block-size);
29
41
 
30
42
  transition-duration: inherit;
31
- transition-property: min-height;
43
+ transition-property: min-block-size;
32
44
  transition-timing-function: inherit;
33
45
 
34
46
  z-index: 1;
35
47
 
36
48
  &[mdw-centered] {
37
49
  grid-template-columns: minmax(auto, 1fr) minmax(0, auto) minmax(auto, 1fr);
38
- -ms-grid-columns: minmax(max-content, 1fr) minmax(0, max-content) minmax(max-content, 1fr);
39
50
  }
40
51
 
41
- .mdw-appbar[mdw-prominent] > & {
42
- min-height: dp($heightProminent);
43
- -ms-grid-rows: minmax(dp($heightProminent), 1fr) auto;
44
- }
45
-
46
- .mdw-appbar[mdw-dense] > & {
47
- min-height: dp($heightDense);
48
- -ms-grid-rows: minmax(dp($heightDense), 1fr) auto;
49
- }
50
-
51
- .mdw-appbar[mdw-dense][mdw-prominent] > & {
52
- min-height: dp($heightProminentDense);
53
- -ms-grid-rows: minmax(dp($heightProminentDense), 1fr) auto;
54
- @include breakpoint.maxTabletDevice {
55
- min-height: dp($heightProminent);
56
- -ms-grid-rows: minmax(dp($heightProminent), 1fr) auto;
57
- }
52
+ &[mdw-dense] {
53
+ --mdw-appbar__min-block-size: var(--mdw-appbar__min-block-size__dense);
58
54
  }
55
+ }
59
56
 
60
- &,
61
- .mdw-appbar[mdw-dense] > & {
62
- @include breakpoint.maxTabletDevice {
63
- min-height: dp($heightMobile);
64
- }
65
- @include breakpoint.isMobileDeviceLandscape {
66
- min-height: dp($heightMobileLandscape);
67
- }
68
- }
57
+ .mdw-appbar__action {
58
+ display: grid;
59
+ grid-template-columns: auto 1fr auto;
60
+
61
+ min-block-size: var(--mdw-appbar__min-block-size);
62
+
63
+ transition-duration: inherit;
64
+ transition-property: min-block-size;
65
+ transition-timing-function: inherit;
66
+
67
+ z-index: 1;
69
68
  }
70
69
 
71
70
  .mdw-appbar__content {
72
71
  display: flex;
73
72
  flex-direction: column;
74
73
 
75
- -ms-grid-column: 1;
76
- grid-column: 1;
77
- -ms-grid-column-span: 3;
78
- grid-column-end: span 3;
79
- -ms-grid-row: 2;
74
+ grid-column: 1 / span 3;
80
75
  grid-row: 2;
81
76
 
82
- margin-right: dp(24);
83
- margin-left: dp(80);
84
- @include breakpoint.has16DPMargin() {
85
- margin-right: dp(16);
86
- margin-left: dp(72);
87
- }
77
+ margin-inline: var(--mdw-appbar__content-margin-inline);
78
+ padding-inline-start: 56px;
88
79
  }
89
80
 
90
81
  .mdw-appbar__title {
91
- @include type.addRules('h6');
92
- @include type.baselineToBottom(24);
82
+ display: flex;
83
+ align-items: center;
93
84
 
94
- -ms-grid-row-align: end;
95
- align-self: flex-end;
85
+ align-self: center;
96
86
 
97
- -ms-grid-column: 2;
98
87
  grid-column: 2;
99
- -ms-grid-row: 1;
100
- grid-row: 1;
88
+ grid-row: 1 / span 2;
89
+
90
+ overflow: hidden;
101
91
 
102
- justify-content: space-around;
103
- overflow-x: hidden;
104
-
105
- height: auto;
106
- margin: 0 dp(16);
92
+ min-block-size: auto;
93
+
94
+ block-size: auto;
95
+ margin: 0 16px;
107
96
 
108
97
  transition-duration: inherit;
109
- transition-property: font, letter-spacing, margin-top;
98
+ transition-property: font, letter-spacing, margin-block-size;
110
99
  transition-timing-function: inherit;
111
100
 
112
101
  text-overflow: ellipsis;
113
102
  white-space: nowrap;
114
103
 
104
+ @include type.addRules('h6');
115
105
 
116
- .mdw-appbar[mdw-dense] & {
117
- @include type.baselineToBottom(16);
118
- }
119
-
120
- .mdw-appbar[mdw-dense] &,
121
- & {
122
- @include breakpoint.maxTabletDevice {
123
- @include type.baselineToBottom(20);
124
- }
125
- @include breakpoint.isMobileDeviceLandscape {
126
- @include type.baselineToBottom(16);
127
- }
128
- }
129
-
106
+ // TODO: Use CSS Variables instead of nesting
130
107
  .mdw-appbar[mdw-prominent] & {
108
+ min-block-size: var(--mdw-appbar__min-block-size__prominent);
109
+
131
110
  white-space: normal;
132
111
  @include type.addRules('h5');
133
- @include type.baselineToBottom(28);
112
+ }
113
+
114
+ .mdw-appbar[mdw-prominent][mdw-dense] & {
115
+ min-block-size: var(--mdw-appbar__min-block-size__prominent__dense);
134
116
  }
135
117
 
136
118
  &[mdw-custom] {
137
- margin-top: 0;
119
+ margin-block-start: 0;
138
120
 
139
121
  &::after {
140
122
  display: none;
@@ -143,67 +125,31 @@ $iconHeight: 40 !default;
143
125
  }
144
126
 
145
127
  .mdw-appbar__start {
146
- -ms-grid-column: 1;
147
128
  grid-column: 1;
148
129
 
149
- margin-left: dp(8);
130
+ margin-inline-start: var(--mdw-appbar__start-margin-inline-start);
150
131
 
151
- padding: 0 dp(8);
152
- @include breakpoint.has16DPMargin() {
153
- margin-left: 0;
154
- }
132
+ padding-inline: 8px;
155
133
  }
156
134
 
157
135
  .mdw-appbar__end {
158
- -ms-grid-column: 3;
159
136
  grid-column: 3;
160
137
  justify-content: flex-end;
161
138
 
162
- margin-right: dp(12);
163
- margin-left: 0;
164
- @include breakpoint.has16DPMargin() {
165
- margin-right: dp(4);
166
- margin-left: 0;
167
- }
168
-
169
- :root[dir="rtl"] & {
170
- margin-right: 0;
171
- margin-left: dp(12);
172
- @include breakpoint.has16DPMargin() {
173
- margin-right: 0;
174
- margin-left: dp(4);
175
- }
176
- }
139
+ margin-inline-end: -12px;
140
+ padding-inline-end: var(--mdw-appbar__content-margin-inline);
177
141
  }
178
142
 
179
-
180
143
  .mdw-appbar__start,
181
144
  .mdw-appbar__end {
182
145
  display: flex;
183
- align-items: flex-start;
146
+ align-items: center;
184
147
  flex-direction: row;
148
+ grid-row: 1/1;
185
149
 
186
- transition-property: margin-top;
187
- }
150
+ min-block-size: inherit;
188
151
 
189
- .mdw-appbar__start,
190
- .mdw-appbar__end,
191
- .mdw-appbar__title {
192
- margin-top: dp(($height - $iconHeight) * 0.5);
193
-
194
- .mdw-appbar[mdw-dense] & {
195
- margin-top: dp(($heightDense - $iconHeight) * 0.5);
196
- }
197
-
198
- &,
199
- .mdw-appbar[mdw-dense] & {
200
- @include breakpoint.maxTabletDevice {
201
- margin-top: dp(($heightMobile - $iconHeight) * 0.5);
202
- }
203
- @include breakpoint.isMobileDeviceLandscape {
204
- margin-top: dp(($heightMobileLandscape - $iconHeight) * 0.5);
205
- }
206
- }
152
+ transition-property: margin-block-start;
207
153
  }
208
154
 
209
155
  .mdw-appbar__start .mdw-button {
@@ -211,15 +157,9 @@ $iconHeight: 40 !default;
211
157
  }
212
158
 
213
159
  .mdw-appbar__end .mdw-button {
214
- margin: 0 dp(4);
160
+ margin: 0 4px;
215
161
 
216
162
  &[mdw-more-button] {
217
- margin-right: dp(-2);
218
- margin-left: 0;
219
-
220
- :root[dir="rtl"] & {
221
- margin-right: 0;
222
- margin-left: dp(-2);
223
- }
163
+ margin-inline-end: -2px;
224
164
  }
225
165
  }