@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.
- package/.browserslistrc +2 -1
- package/.eslintrc.json +59 -8
- package/.stylelintrc.json +94 -49
- package/CHANGELOG.md +12 -0
- package/README.md +1 -3
- package/adapters/datatable/column.js +27 -54
- package/adapters/datatable/index.js +69 -81
- package/adapters/dom/index.js +32 -47
- package/adapters/search/index.js +107 -133
- package/components/appbar/_spec.scss +77 -137
- package/components/banner/_spec.scss +28 -63
- package/components/bottomnav/_spec.scss +46 -54
- package/components/bottomnav/index.js +15 -20
- package/components/bottomnav/item.js +4 -5
- package/components/button/README.md +1 -1
- package/components/button/_spec.scss +43 -42
- package/components/button/_theme.scss +27 -50
- package/components/card/_spec.scss +61 -69
- package/components/chip/_spec.scss +21 -44
- package/components/chip/_theme.scss +79 -151
- package/components/chip/index.js +6 -4
- package/components/datatable/_spec.scss +36 -99
- package/components/datatable/_theme.scss +98 -124
- package/components/datatable/cell.js +1 -2
- package/components/datatable/columnheader.js +1 -2
- package/components/datatable/index.js +33 -47
- package/components/datatable/row.js +4 -5
- package/components/dialog/_spec.scss +53 -63
- package/components/dialog/_theme.scss +7 -0
- package/components/dialog/index.js +62 -88
- package/components/divider/_spec.scss +6 -8
- package/components/elevation/_spec.scss +1 -1
- package/components/fab/_spec.scss +30 -42
- package/components/fab/index.js +4 -8
- package/components/grid/_spec.scss +68 -211
- package/components/layout/_mixins.scss +0 -22
- package/components/layout/_spec.scss +267 -363
- package/components/layout/_theme.scss +10 -35
- package/components/layout/index.js +40 -50
- package/components/list/_spec.scss +57 -91
- package/components/list/_theme.scss +75 -84
- package/components/list/content.js +9 -13
- package/components/list/index.js +34 -38
- package/components/list/item.js +8 -11
- package/components/list/secondary.js +8 -9
- package/components/menu/_spec.scss +134 -167
- package/components/menu/index.js +45 -61
- package/components/menu/item.js +11 -19
- package/components/progress/_spec.scss +43 -34
- package/components/selection/_spec.scss +123 -133
- package/components/selection/_theme.scss +88 -120
- package/components/selection/index.js +9 -15
- package/components/selection/input.js +3 -5
- package/components/selection/radiogroup.js +8 -15
- package/components/slider/_spec.scss +23 -28
- package/components/snackbar/_spec.scss +17 -62
- package/components/snackbar/index.js +15 -21
- package/components/tab/_spec.scss +35 -50
- package/components/tab/content.js +33 -28
- package/components/tab/index.js +30 -33
- package/components/tab/item.js +4 -5
- package/components/tab/list.js +22 -36
- package/components/textfield/README.md +2 -2
- package/components/textfield/_spec.scss +241 -287
- package/components/textfield/_theme.scss +197 -232
- package/components/textfield/index.js +8 -16
- package/components/tooltip/_spec.scss +23 -26
- package/components/type/_spec.scss +19 -16
- package/core/_breakpoint.scss +33 -33
- package/core/_elevation.scss +40 -0
- package/core/_length.scss +0 -1
- package/core/_platform.scss +0 -22
- package/core/_type.scss +7 -6
- package/core/aria/button.js +4 -5
- package/core/aria/keyboard.js +1 -2
- package/core/aria/rovingtabindex.js +14 -17
- package/core/aria/tab.js +1 -2
- package/core/dom.js +18 -109
- package/core/overlay/_spec.scss +5 -8
- package/core/overlay/_theme.scss +126 -150
- package/core/overlay/index.js +19 -32
- package/core/ripple/_spec.scss +16 -17
- package/core/ripple/_theme.scss +13 -33
- package/core/ripple/index.js +36 -44
- package/core/theme/_aliases.scss +15 -0
- package/core/theme/_config.scss +8 -2
- package/core/theme/_functions.scss +22 -0
- package/core/theme/_palettes.scss +0 -1
- package/core/{color → theme}/_spec.scss +0 -0
- package/core/theme/_theme.scss +268 -0
- package/core/theme/index.scss +4 -0
- package/core/transition/index.js +73 -76
- package/docs/_flex.scss +7 -1
- package/docs/_menuoptions.js +2 -2
- package/docs/_partials/_appbar.eta +12 -14
- package/docs/_partials/_header.eta +41 -44
- package/docs/_sample-utils.js +15 -20
- package/docs/docs.scss +123 -87
- package/docs/framework.scss +26 -0
- package/docs/index.eta +2 -6
- package/docs/index.js +7 -0
- package/docs/pages/appbar.eta +22 -28
- package/docs/pages/bottomnav.js +17 -14
- package/docs/pages/button.js +10 -10
- package/docs/pages/card.js +20 -22
- package/docs/pages/chip.js +11 -13
- package/docs/pages/color.js +35 -36
- package/docs/pages/datatable.js +11 -15
- package/docs/pages/dialog.eta +9 -11
- package/docs/pages/dialog.js +6 -9
- package/docs/pages/dom.js +6 -9
- package/docs/pages/elevation.eta +10 -10
- package/docs/pages/fab.js +2 -3
- package/docs/pages/grid.js +5 -5
- package/docs/pages/list.js +1 -2
- package/docs/pages/menu.eta +17 -19
- package/docs/pages/menu.js +7 -11
- package/docs/pages/overlay.js +1 -2
- package/docs/pages/progress.eta +2 -2
- package/docs/pages/progress.js +1 -1
- package/docs/pages/ripple.js +1 -2
- package/docs/pages/search.eta +20 -24
- package/docs/pages/search.js +24 -41
- package/docs/pages/selection.eta +2 -6
- package/docs/pages/selection.js +3 -4
- package/docs/pages/snackbar.js +3 -4
- package/docs/pages/tab.eta +61 -75
- package/docs/pages/tab.js +16 -15
- package/docs/pages/textfield.eta +9 -8
- package/docs/pages/textfield.js +26 -23
- package/docs/pages/tooltip.eta +10 -12
- package/docs/pages/transition.js +5 -7
- package/docs/postrender.js +7 -5
- package/docs/pwa/pwa.eta +14 -16
- package/docs/pwa/pwa.js +19 -27
- package/docs/pwa/pwa.scss +12 -7
- package/docs/themes/theme-colored.scss +9 -11
- package/docs/themes/theme-default.scss +0 -14
- package/index.scss +27 -0
- package/jsconfig.json +7 -3
- package/package.json +26 -15
- package/tsconfig.json +16 -0
- package/{webpack.config.cjs → webpack.config.js} +105 -58
- package/components/template/_theme.scss +0 -27
- package/components/textfield/_mixins.scss +0 -52
- package/core/color/_theme.scss +0 -390
- package/core/color/index.scss +0 -2
- package/core/theme/_mixins.scss +0 -172
- package/core/theme/_variables.scss +0 -24
- package/docs/_mixins.pug +0 -155
- package/docs/pages/appbar.pug +0 -78
- package/docs/pages/bottomnav.pug +0 -137
- package/docs/pages/button.pug +0 -121
- package/docs/pages/card.pug +0 -74
- package/docs/pages/chip.pug +0 -91
- package/docs/pages/color.pug +0 -121
- package/docs/pages/datatable.pug +0 -283
- package/docs/pages/dialog.pug +0 -132
- package/docs/pages/dom.pug +0 -22
- package/docs/pages/elevation.pug +0 -25
- package/docs/pages/fab.pug +0 -66
- package/docs/pages/grid.pug +0 -95
- package/docs/pages/layout.pug +0 -7
- package/docs/pages/list.pug +0 -326
- package/docs/pages/menu.pug +0 -205
- package/docs/pages/overlay.pug +0 -55
- package/docs/pages/progress.pug +0 -16
- package/docs/pages/ripple.pug +0 -21
- package/docs/pages/search.pug +0 -165
- package/docs/pages/selection.pug +0 -74
- package/docs/pages/slider.pug +0 -17
- package/docs/pages/snackbar.pug +0 -60
- package/docs/pages/tab.pug +0 -304
- package/docs/pages/textfield.pug +0 -360
- package/docs/pages/tooltip.pug +0 -78
- package/docs/pages/transition.pug +0 -76
- package/docs/pages/type.pug +0 -29
- package/docs/pwa/_dialogs.pug +0 -96
- package/docs/pwa/_menus.pug +0 -11
- package/docs/pwa/pwa.pug +0 -325
- package/docs/spec.scss +0 -26
- package/docs/themes/_component-themes.scss +0 -26
- package/docs/themes/theme-colored-fallbacks.scss +0 -17
- package/docs/themes/theme-default-fallbacks.scss +0 -17
package/adapters/search/index.js
CHANGED
|
@@ -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
|
|
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
|
-
.
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
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}
|
|
92
|
-
* @return {
|
|
86
|
+
* @param {Element} el
|
|
87
|
+
* @return {number}
|
|
93
88
|
*/
|
|
94
|
-
function
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
|
|
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
|
|
149
|
-
* @prop {function(T[]
|
|
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 || (
|
|
217
|
-
this.updateList = options.updateList || (
|
|
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
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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
|
-
|
|
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
|
-
* @
|
|
295
|
-
* @param {function(Error):any} reject
|
|
296
|
-
* @return {void}
|
|
276
|
+
* @return {Promise<void>}
|
|
297
277
|
*/
|
|
298
|
-
checkExpired(inputValue
|
|
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
|
-
* @
|
|
309
|
-
* @param {function(Error):any} reject
|
|
310
|
-
* @return {void}
|
|
287
|
+
* @return {Promise<void>}
|
|
311
288
|
*/
|
|
312
|
-
performDebounce(searchTerm
|
|
289
|
+
performDebounce(searchTerm) {
|
|
313
290
|
if (!this.debounce) {
|
|
314
|
-
resolve();
|
|
315
|
-
return;
|
|
291
|
+
return Promise.resolve();
|
|
316
292
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
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
|
-
|
|
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
|
-
|
|
500
|
-
|
|
501
|
-
|
|
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
|
-
|
|
512
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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-
|
|
22
|
-
display: -ms-grid;
|
|
34
|
+
.mdw-appbar {
|
|
23
35
|
display: grid;
|
|
36
|
+
|
|
24
37
|
grid-template-columns: auto 1fr auto;
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
min-
|
|
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-
|
|
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
|
-
|
|
42
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
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-
|
|
83
|
-
|
|
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
|
-
|
|
92
|
-
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
93
84
|
|
|
94
|
-
-
|
|
95
|
-
align-self: flex-end;
|
|
85
|
+
align-self: center;
|
|
96
86
|
|
|
97
|
-
-ms-grid-column: 2;
|
|
98
87
|
grid-column: 2;
|
|
99
|
-
|
|
100
|
-
|
|
88
|
+
grid-row: 1 / span 2;
|
|
89
|
+
|
|
90
|
+
overflow: hidden;
|
|
101
91
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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-
|
|
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
|
-
|
|
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
|
-
|
|
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-
|
|
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-
|
|
130
|
+
margin-inline-start: var(--mdw-appbar__start-margin-inline-start);
|
|
150
131
|
|
|
151
|
-
padding:
|
|
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-
|
|
163
|
-
|
|
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:
|
|
146
|
+
align-items: center;
|
|
184
147
|
flex-direction: row;
|
|
148
|
+
grid-row: 1/1;
|
|
185
149
|
|
|
186
|
-
|
|
187
|
-
}
|
|
150
|
+
min-block-size: inherit;
|
|
188
151
|
|
|
189
|
-
|
|
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
|
|
160
|
+
margin: 0 4px;
|
|
215
161
|
|
|
216
162
|
&[mdw-more-button] {
|
|
217
|
-
margin-
|
|
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
|
}
|