@shortfuse/materialdesignweb 0.3.0 → 0.4.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 (398) hide show
  1. package/.eslintrc.json +136 -30
  2. package/.stylelintrc.json +6 -40
  3. package/.vscode/launch.json +20 -5
  4. package/CHANGELOG.md +24 -0
  5. package/README.md +12 -9
  6. package/adapters/datatable/column.js +82 -74
  7. package/adapters/datatable/index.js +173 -131
  8. package/adapters/dom/index.js +529 -75
  9. package/adapters/list/index.js +25 -12
  10. package/adapters/search/index.js +13 -13
  11. package/components/appbar/_spec.scss +87 -64
  12. package/components/appbar/index.scss +2 -2
  13. package/components/banner/_spec.scss +8 -8
  14. package/components/banner/index.scss +2 -2
  15. package/components/bottomnav/_spec.scss +22 -17
  16. package/components/bottomnav/index.js +61 -52
  17. package/components/bottomnav/index.scss +2 -2
  18. package/components/bottomnav/item.js +44 -25
  19. package/components/button/README.md +14 -14
  20. package/components/button/_spec.scss +23 -22
  21. package/components/button/_theme.scss +37 -21
  22. package/components/button/index.eta +32 -0
  23. package/components/button/index.js +12 -12
  24. package/components/button/index.scss +2 -2
  25. package/components/card/_spec.scss +40 -36
  26. package/components/card/index.scss +2 -2
  27. package/components/chip/_spec.scss +7 -8
  28. package/components/chip/_theme.scss +31 -31
  29. package/components/chip/index.js +3 -2
  30. package/components/chip/index.scss +2 -2
  31. package/components/chip/item.js +1 -16
  32. package/components/datatable/_spec.scss +71 -85
  33. package/components/datatable/_theme.scss +61 -156
  34. package/components/datatable/cell.js +45 -0
  35. package/components/datatable/columnheader.js +47 -0
  36. package/components/datatable/index.js +279 -366
  37. package/components/datatable/index.scss +2 -2
  38. package/components/datatable/row.js +49 -0
  39. package/components/datatable/rowheader.js +18 -0
  40. package/components/dialog/_spec.scss +61 -41
  41. package/components/dialog/index.js +325 -297
  42. package/components/dialog/index.scss +2 -2
  43. package/components/divider/_spec.scss +8 -6
  44. package/components/divider/index.scss +2 -2
  45. package/components/elevation/_spec.scss +2 -2
  46. package/components/elevation/index.scss +2 -2
  47. package/components/fab/_spec.scss +23 -24
  48. package/components/fab/index.js +50 -50
  49. package/components/fab/index.scss +2 -2
  50. package/components/grid/_spec.scss +33 -31
  51. package/components/grid/index.scss +2 -2
  52. package/components/layout/_mixins.scss +5 -5
  53. package/components/layout/_spec.scss +206 -176
  54. package/components/layout/_theme.scss +14 -16
  55. package/components/layout/index.js +181 -153
  56. package/components/layout/index.scss +2 -2
  57. package/components/list/_spec.scss +117 -104
  58. package/components/list/_theme.scss +31 -34
  59. package/components/list/content.js +68 -52
  60. package/components/list/index.js +194 -61
  61. package/components/list/index.scss +2 -2
  62. package/components/list/item.js +136 -12
  63. package/components/list/secondary.js +46 -0
  64. package/components/menu/_spec.scss +32 -19
  65. package/components/menu/index.js +242 -229
  66. package/components/menu/index.scss +2 -2
  67. package/components/menu/item.js +95 -110
  68. package/components/progress/_spec.scss +35 -27
  69. package/components/progress/index.js +21 -0
  70. package/components/progress/index.scss +2 -1
  71. package/components/selection/_spec.scss +242 -224
  72. package/components/selection/_theme.scss +100 -95
  73. package/components/selection/index.eta +60 -0
  74. package/components/selection/index.js +76 -0
  75. package/components/selection/index.pug +15 -8
  76. package/components/selection/index.scss +2 -2
  77. package/components/selection/input.js +56 -0
  78. package/components/selection/radiogroup.js +47 -0
  79. package/components/slider/_spec.scss +10 -8
  80. package/components/slider/index.scss +2 -2
  81. package/components/snackbar/_spec.scss +22 -21
  82. package/components/snackbar/index.js +102 -111
  83. package/components/snackbar/index.scss +2 -2
  84. package/components/tab/_spec.scss +20 -19
  85. package/components/tab/content.js +41 -40
  86. package/components/tab/index.js +192 -99
  87. package/components/tab/index.scss +2 -2
  88. package/components/tab/item.js +38 -55
  89. package/components/tab/list.js +96 -72
  90. package/components/tab/panel.js +12 -13
  91. package/components/template/_theme.scss +11 -11
  92. package/components/textfield/_mixins.scss +52 -0
  93. package/components/textfield/_spec.scss +215 -266
  94. package/components/textfield/_theme.scss +95 -72
  95. package/components/textfield/index.eta +74 -0
  96. package/components/textfield/index.js +63 -57
  97. package/components/textfield/index.scss +2 -2
  98. package/components/tooltip/_spec.scss +27 -25
  99. package/components/tooltip/index.scss +2 -2
  100. package/components/type/_spec.scss +51 -38
  101. package/components/type/index.scss +2 -2
  102. package/core/_breakpoint.scss +75 -91
  103. package/core/_elevation.scss +10 -10
  104. package/core/_length.scss +9 -0
  105. package/core/_motion.scss +14 -14
  106. package/core/_platform.scss +9 -15
  107. package/core/_type.scss +33 -32
  108. package/core/aria/attributes.js +125 -25
  109. package/core/aria/button.js +23 -23
  110. package/core/aria/keyboard.js +93 -0
  111. package/core/aria/rovingtabindex.js +69 -154
  112. package/core/aria/tab.js +31 -28
  113. package/core/color/_theme.scss +240 -280
  114. package/core/color/index.scss +2 -2
  115. package/core/document/index.js +39 -0
  116. package/core/dom.js +12 -12
  117. package/core/overlay/_spec.scss +0 -3
  118. package/core/overlay/_theme.scss +56 -74
  119. package/core/overlay/index.js +49 -18
  120. package/core/overlay/index.scss +2 -2
  121. package/core/ripple/_spec.scss +22 -39
  122. package/core/ripple/_theme.scss +13 -13
  123. package/core/ripple/index.js +137 -134
  124. package/core/ripple/index.scss +2 -2
  125. package/core/theme/_config.scss +2 -0
  126. package/core/theme/_mixins.scss +172 -0
  127. package/core/theme/_palettes.scss +155 -135
  128. package/core/theme/_variables.scss +24 -15
  129. package/core/theme/index.js +50 -0
  130. package/core/throttler.js +1 -1
  131. package/core/transition/index.js +36 -20
  132. package/{docs-src → docs}/_flex.scss +0 -0
  133. package/{docs-src → docs}/_menuoptions.js +21 -34
  134. package/{docs-src → docs}/_mixins.pug +39 -26
  135. package/docs/_partials/_androidnavbar.eta +5 -0
  136. package/docs/_partials/_androidstatusbar.eta +13 -0
  137. package/docs/_partials/_appbar.eta +29 -0
  138. package/docs/_partials/_buttontest.eta +31 -0
  139. package/docs/_partials/_header.eta +149 -0
  140. package/docs/_partials/_navlistitem.eta +16 -0
  141. package/docs/_partials/_target.eta +1 -0
  142. package/{docs-src → docs}/_sample-utils.js +8 -6
  143. package/{docs-src → docs}/_storage.js +0 -0
  144. package/{docs-src → docs}/docs.scss +5 -2
  145. package/docs/index.eta +16 -0
  146. package/{docs-src → docs}/index.js +0 -0
  147. package/docs/pages/appbar.eta +114 -0
  148. package/{docs-src/components → docs/pages}/appbar.js +0 -0
  149. package/{docs-src/components → docs/pages}/appbar.pug +15 -18
  150. package/docs/pages/bottomnav.eta +188 -0
  151. package/{docs-src/components → docs/pages}/bottomnav.js +23 -24
  152. package/{docs-src/components → docs/pages}/bottomnav.pug +4 -4
  153. package/docs/pages/button.eta +124 -0
  154. package/{docs-src/components → docs/pages}/button.js +19 -19
  155. package/{docs-src/components → docs/pages}/button.pug +15 -15
  156. package/docs/pages/card.eta +90 -0
  157. package/{docs-src/components → docs/pages}/card.js +3 -3
  158. package/{docs-src/components → docs/pages}/card.pug +7 -7
  159. package/docs/pages/chip.eta +122 -0
  160. package/{docs-src/components → docs/pages}/chip.js +3 -6
  161. package/{docs-src/components → docs/pages}/chip.pug +2 -2
  162. package/docs/pages/color.eta +143 -0
  163. package/{docs-src/core → docs/pages}/color.js +95 -20
  164. package/docs/pages/color.pug +121 -0
  165. package/docs/pages/datatable.eta +323 -0
  166. package/{docs-src/components → docs/pages}/datatable.js +26 -13
  167. package/docs/pages/datatable.pug +283 -0
  168. package/docs/pages/dialog.eta +186 -0
  169. package/{docs-src/components → docs/pages}/dialog.js +26 -13
  170. package/{docs-src/components → docs/pages}/dialog.pug +46 -28
  171. package/docs/pages/dom.eta +26 -0
  172. package/docs/pages/dom.js +143 -0
  173. package/docs/pages/dom.pug +22 -0
  174. package/docs/pages/elevation.eta +35 -0
  175. package/{docs-src/components → docs/pages}/elevation.js +0 -0
  176. package/{docs-src/components → docs/pages}/elevation.pug +0 -0
  177. package/docs/pages/fab.eta +99 -0
  178. package/{docs-src/components → docs/pages}/fab.js +3 -3
  179. package/{docs-src/components → docs/pages}/fab.pug +2 -2
  180. package/docs/pages/grid.eta +135 -0
  181. package/{docs-src/components → docs/pages}/grid.js +1 -1
  182. package/{docs-src/components → docs/pages}/grid.pug +3 -3
  183. package/docs/pages/layout.eta +8 -0
  184. package/{docs-src/components → docs/pages}/layout.js +0 -0
  185. package/{docs-src/components → docs/pages}/layout.pug +0 -0
  186. package/docs/pages/list.eta +465 -0
  187. package/{docs-src/components → docs/pages}/list.js +2 -2
  188. package/{docs-src/components → docs/pages}/list.pug +7 -14
  189. package/docs/pages/menu.eta +276 -0
  190. package/{docs-src/components → docs/pages}/menu.js +14 -10
  191. package/{docs-src/components → docs/pages}/menu.pug +0 -0
  192. package/docs/pages/overlay.eta +69 -0
  193. package/docs/pages/overlay.js +4 -0
  194. package/{docs-src/core → docs/pages}/overlay.pug +14 -11
  195. package/docs/pages/progress.eta +23 -0
  196. package/{docs-src/components → docs/pages}/progress.js +1 -1
  197. package/{docs-src/components → docs/pages}/progress.pug +1 -1
  198. package/docs/pages/ripple.eta +27 -0
  199. package/docs/pages/ripple.js +4 -0
  200. package/{docs-src/core → docs/pages}/ripple.pug +4 -4
  201. package/docs/pages/search.eta +246 -0
  202. package/{docs-src/components → docs/pages}/search.js +59 -42
  203. package/{docs-src/components → docs/pages}/search.pug +50 -51
  204. package/docs/pages/selection.eta +111 -0
  205. package/docs/pages/selection.js +13 -0
  206. package/docs/pages/selection.pug +74 -0
  207. package/docs/pages/slider.eta +23 -0
  208. package/{docs-src/components → docs/pages}/slider.js +0 -0
  209. package/{docs-src/components → docs/pages}/slider.pug +0 -0
  210. package/docs/pages/snackbar.eta +83 -0
  211. package/{docs-src/components → docs/pages}/snackbar.js +3 -3
  212. package/{docs-src/components → docs/pages}/snackbar.pug +0 -0
  213. package/docs/pages/tab.eta +421 -0
  214. package/{docs-src/components → docs/pages}/tab.js +18 -35
  215. package/{docs-src/components → docs/pages}/tab.pug +4 -4
  216. package/docs/pages/textfield.eta +486 -0
  217. package/{docs-src/components → docs/pages}/textfield.js +3 -4
  218. package/{docs-src/components → docs/pages}/textfield.pug +87 -35
  219. package/docs/pages/tooltip.eta +94 -0
  220. package/{docs-src/components → docs/pages}/tooltip.js +0 -0
  221. package/{docs-src/components → docs/pages}/tooltip.pug +0 -1
  222. package/docs/pages/transition.eta +117 -0
  223. package/{docs-src/core → docs/pages}/transition.js +7 -8
  224. package/{docs-src/core → docs/pages}/transition.pug +0 -0
  225. package/docs/pages/type.eta +31 -0
  226. package/{docs-src/components → docs/pages}/type.js +0 -0
  227. package/{docs-src/components → docs/pages}/type.pug +0 -1
  228. package/docs/postrender.js +39 -0
  229. package/{docs-src → docs}/prerender.js +3 -9
  230. package/docs/pwa/_dialogs.eta +143 -0
  231. package/docs/pwa/_dialogs.pug +96 -0
  232. package/docs/pwa/_menus.eta +16 -0
  233. package/{docs-src → docs}/pwa/_menus.pug +0 -0
  234. package/docs/pwa/pwa-prerender.js +3 -0
  235. package/docs/pwa/pwa.eta +480 -0
  236. package/docs/pwa/pwa.js +306 -0
  237. package/{docs-src → docs}/pwa/pwa.pug +166 -263
  238. package/docs/pwa/pwa.scss +26 -0
  239. package/docs/spec.scss +26 -0
  240. package/docs/themes/_component-themes.scss +26 -0
  241. package/docs/themes/theme-colored-fallbacks.scss +17 -0
  242. package/docs/themes/theme-colored.scss +17 -0
  243. package/docs/themes/theme-default-fallbacks.scss +17 -0
  244. package/docs/themes/theme-default.scss +17 -0
  245. package/jsconfig.json +4 -2
  246. package/package.json +40 -27
  247. package/scripts/deploy-docs.sh +9 -0
  248. package/templates/index.eta +2 -0
  249. package/utils/function.js +3 -0
  250. package/webpack.config.cjs +257 -0
  251. package/_spec.scss +0 -27
  252. package/_theme.scss +0 -27
  253. package/components/list/expander.js +0 -142
  254. package/components/list/itemgroup.js +0 -22
  255. package/core/theme/_builder.scss +0 -116
  256. package/core/theme/index.scss +0 -68
  257. package/docs/appbar.html +0 -1
  258. package/docs/appbar.min.js +0 -2
  259. package/docs/appbar.min.js.map +0 -1
  260. package/docs/bottomnav.html +0 -1
  261. package/docs/bottomnav.min.js +0 -2
  262. package/docs/bottomnav.min.js.map +0 -1
  263. package/docs/button.html +0 -1
  264. package/docs/button.min.js +0 -2
  265. package/docs/button.min.js.map +0 -1
  266. package/docs/card.html +0 -1
  267. package/docs/card.min.js +0 -2
  268. package/docs/card.min.js.map +0 -1
  269. package/docs/chip.html +0 -1
  270. package/docs/chip.min.js +0 -2
  271. package/docs/chip.min.js.map +0 -1
  272. package/docs/color.html +0 -1
  273. package/docs/color.min.js +0 -2
  274. package/docs/color.min.js.map +0 -1
  275. package/docs/datatable.html +0 -1
  276. package/docs/datatable.min.js +0 -2
  277. package/docs/datatable.min.js.map +0 -1
  278. package/docs/default.common.min.js +0 -2
  279. package/docs/default.common.min.js.map +0 -1
  280. package/docs/dialog.html +0 -1
  281. package/docs/dialog.min.js +0 -2
  282. package/docs/dialog.min.js.map +0 -1
  283. package/docs/docs.min.css +0 -1
  284. package/docs/docs.min.js +0 -2
  285. package/docs/docs.min.js.map +0 -1
  286. package/docs/elevation.html +0 -1
  287. package/docs/elevation.min.js +0 -2
  288. package/docs/elevation.min.js.map +0 -1
  289. package/docs/fab.html +0 -1
  290. package/docs/fab.min.js +0 -2
  291. package/docs/fab.min.js.map +0 -1
  292. package/docs/grid.html +0 -1
  293. package/docs/grid.min.js +0 -2
  294. package/docs/grid.min.js.map +0 -1
  295. package/docs/index.html +0 -1
  296. package/docs/index.min.js +0 -2
  297. package/docs/index.min.js.map +0 -1
  298. package/docs/ink.html +0 -1
  299. package/docs/ink.min.js +0 -2
  300. package/docs/ink.min.js.map +0 -1
  301. package/docs/layout.html +0 -1
  302. package/docs/layout.min.js +0 -2
  303. package/docs/layout.min.js.map +0 -1
  304. package/docs/list.html +0 -1
  305. package/docs/list.min.js +0 -2
  306. package/docs/list.min.js.map +0 -1
  307. package/docs/menu.html +0 -1
  308. package/docs/menu.min.js +0 -2
  309. package/docs/menu.min.js.map +0 -1
  310. package/docs/overlay.html +0 -1
  311. package/docs/overlay.min.js +0 -2
  312. package/docs/overlay.min.js.map +0 -1
  313. package/docs/prerender.common.min.js +0 -2
  314. package/docs/prerender.common.min.js.map +0 -1
  315. package/docs/prerender.min.js +0 -2
  316. package/docs/prerender.min.js.map +0 -1
  317. package/docs/progress.html +0 -1
  318. package/docs/progress.min.js +0 -2
  319. package/docs/progress.min.js.map +0 -1
  320. package/docs/pwa-prerender.min.js +0 -2
  321. package/docs/pwa-prerender.min.js.map +0 -1
  322. package/docs/pwa.html +0 -11
  323. package/docs/pwa.min.css +0 -1
  324. package/docs/pwa.min.js +0 -2
  325. package/docs/pwa.min.js.map +0 -1
  326. package/docs/ripple.html +0 -1
  327. package/docs/ripple.min.js +0 -2
  328. package/docs/ripple.min.js.map +0 -1
  329. package/docs/search.html +0 -1
  330. package/docs/search.min.js +0 -2
  331. package/docs/search.min.js.map +0 -1
  332. package/docs/selection.html +0 -1
  333. package/docs/selection.min.js +0 -2
  334. package/docs/selection.min.js.map +0 -1
  335. package/docs/slider.html +0 -1
  336. package/docs/slider.min.js +0 -2
  337. package/docs/slider.min.js.map +0 -1
  338. package/docs/snackbar.html +0 -1
  339. package/docs/snackbar.min.js +0 -2
  340. package/docs/snackbar.min.js.map +0 -1
  341. package/docs/spec.min.css +0 -1
  342. package/docs/spec.min.js +0 -2
  343. package/docs/spec.min.js.map +0 -1
  344. package/docs/surface.html +0 -1
  345. package/docs/surface.min.js +0 -2
  346. package/docs/surface.min.js.map +0 -1
  347. package/docs/tab.html +0 -1
  348. package/docs/tab.min.js +0 -2
  349. package/docs/tab.min.js.map +0 -1
  350. package/docs/textfield.html +0 -2
  351. package/docs/textfield.min.js +0 -2
  352. package/docs/textfield.min.js.map +0 -1
  353. package/docs/theme-colored-fallbacks.min.css +0 -1
  354. package/docs/theme-colored-fallbacks.min.js +0 -2
  355. package/docs/theme-colored-fallbacks.min.js.map +0 -1
  356. package/docs/theme-colored.min.css +0 -1
  357. package/docs/theme-colored.min.js +0 -2
  358. package/docs/theme-colored.min.js.map +0 -1
  359. package/docs/theme-default-fallbacks.min.css +0 -1
  360. package/docs/theme-default-fallbacks.min.js +0 -2
  361. package/docs/theme-default-fallbacks.min.js.map +0 -1
  362. package/docs/theme-default.min.css +0 -1
  363. package/docs/theme-default.min.js +0 -2
  364. package/docs/theme-default.min.js.map +0 -1
  365. package/docs/themes-fallbacks.min.css +0 -1
  366. package/docs/themes-fallbacks.min.js +0 -2
  367. package/docs/themes-fallbacks.min.js.map +0 -1
  368. package/docs/themes.min.css +0 -1
  369. package/docs/themes.min.js +0 -2
  370. package/docs/themes.min.js.map +0 -1
  371. package/docs/tooltip.html +0 -1
  372. package/docs/tooltip.min.js +0 -2
  373. package/docs/tooltip.min.js.map +0 -1
  374. package/docs/transition.html +0 -1
  375. package/docs/transition.min.js +0 -2
  376. package/docs/transition.min.js.map +0 -1
  377. package/docs/type.html +0 -1
  378. package/docs/type.min.js +0 -2
  379. package/docs/type.min.js.map +0 -1
  380. package/docs-src/components/datatable.pug +0 -327
  381. package/docs-src/components/selection.js +0 -9
  382. package/docs-src/components/selection.pug +0 -77
  383. package/docs-src/core/color.pug +0 -201
  384. package/docs-src/core/overlay.js +0 -4
  385. package/docs-src/core/ripple.js +0 -4
  386. package/docs-src/index.pug +0 -9
  387. package/docs-src/pwa/_dialogs.pug +0 -15
  388. package/docs-src/pwa/pwa-prerender.js +0 -3
  389. package/docs-src/pwa/pwa.js +0 -182
  390. package/docs-src/pwa/pwa.scss +0 -25
  391. package/docs-src/spec.scss +0 -1
  392. package/docs-src/themes/theme-colored-fallbacks.scss +0 -14
  393. package/docs-src/themes/theme-colored.scss +0 -14
  394. package/docs-src/themes/theme-default-fallbacks.scss +0 -14
  395. package/docs-src/themes/theme-default.scss +0 -14
  396. package/index.js +0 -51
  397. package/index.scss +0 -2
  398. package/webpack.config.js +0 -187
@@ -1,12 +1,18 @@
1
- import DomAdapter from '../dom/index';
2
- import * as ListItem from '../../components/list/item';
1
+ import * as ListItem from '../../components/list/item.js';
2
+ import DomAdapter from '../dom/index.js';
3
+
4
+ /**
5
+ * @template T1
6
+ * @template T2
7
+ * @typedef {import('../dom/index').DomAdapterCreateOptions<T1,T2>} DomAdapterCreateOptions<T1,T2>
8
+ */
3
9
 
4
10
  /**
5
11
  * @param {HTMLLIElement} element
6
12
  * @param {any} data
7
13
  * @return {void}
8
14
  */
9
- function AnyListAdapterRendererFn(element, data) {
15
+ function AnyListAdapterRenderer(element, data) {
10
16
  let primaryText = element.getElementsByClassName('mdw-list__text')[0];
11
17
  if (!primaryText) {
12
18
  let contentElement = element.getElementsByClassName('mdw-list__content')[0];
@@ -33,19 +39,26 @@ function AnyListAdapterRendererFn(element, data) {
33
39
  }
34
40
  }
35
41
 
42
+ /**
43
+ * @template T
44
+ * @typedef {Object} ListAdapterCreateOptions
45
+ * @prop {HTMLElement} element
46
+ * @prop {Array<T>} datasource
47
+ * @prop {function(HTMLLIElement, T):void} [render={function(HTMLIElement,T):void}]
48
+ */
49
+
36
50
  /**
37
51
  * @template T
38
52
  * @extends {DomAdapter<T, HTMLLIElement>}
39
- * */
53
+ */
40
54
  export default class ListAdapter extends DomAdapter {
41
- /**
42
- * @param {HTMLElement} element
43
- * @param {Array<T>} datasource
44
- * @param {function(HTMLLIElement, T)=} renderFn
45
- */
46
- constructor(element, datasource, renderFn) {
47
- super(element, datasource, renderFn, ListAdapter.create);
48
- this.render = renderFn || AnyListAdapterRendererFn;
55
+ /** @param {ListAdapterCreateOptions<T>} options */
56
+ constructor(options) {
57
+ super(options);
58
+ if (!options.render) {
59
+ this.render = AnyListAdapterRenderer;
60
+ }
61
+ this.create = ListAdapter.create;
49
62
  }
50
63
 
51
64
  static create() {
@@ -1,10 +1,10 @@
1
1
  // https://www.w3.org/TR/wai-aria-practices/#combobox
2
2
 
3
- import { iterateSomeOfArrayLike, iterateArrayLike, getTextNode } from '../../core/dom';
4
-
5
- import * as List from '../../components/list/index';
6
- import * as ListContent from '../../components/list/content';
7
- import * as TextField from '../../components/textfield/index';
3
+ import * as ListContent from '../../components/list/content.js';
4
+ import * as List from '../../components/list/index.js';
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';
8
8
 
9
9
  /**
10
10
  * @param {string} input
@@ -133,7 +133,7 @@ function scrollItemIntoView(listItem) {
133
133
  * @param {string} input
134
134
  * @param {string} content
135
135
  * @return {boolean} passes
136
- */
136
+ */
137
137
 
138
138
  /**
139
139
  * @template T
@@ -213,8 +213,8 @@ export default class SearchAdapter {
213
213
  this.suggestedInput = null;
214
214
  /** @type {string} */
215
215
  this.previousValue = null;
216
- this.performSearch = options.performSearch || ((value, resolve = () => {}) => resolve());
217
- this.updateList = options.updateList || ((results, resolve = () => {}) => resolve());
216
+ this.performSearch = options.performSearch || ((value, resolve = noop) => resolve());
217
+ this.updateList = options.updateList || ((results, resolve = noop) => resolve());
218
218
  }
219
219
 
220
220
  /**
@@ -222,7 +222,7 @@ export default class SearchAdapter {
222
222
  * @param {Event} [event]
223
223
  * @return {void}
224
224
  */
225
- handleInputEvent(event) { // eslint-disable-line no-unused-vars
225
+ handleInputEvent(event) { // eslint-disable-line @typescript-eslint/no-unused-vars
226
226
  if (document.activeElement !== this.input) {
227
227
  return;
228
228
  }
@@ -257,7 +257,7 @@ export default class SearchAdapter {
257
257
  this.performDebounce(inputValue,
258
258
  () => this.checkExpired(inputValue,
259
259
  () => this.performSearch(inputValue,
260
- searchResults => this.checkExpired(inputValue,
260
+ (searchResults) => this.checkExpired(inputValue,
261
261
  () => this.updateList(searchResults,
262
262
  () => this.filterListItems(),
263
263
  onErrorCallback),
@@ -291,7 +291,7 @@ export default class SearchAdapter {
291
291
 
292
292
  /**
293
293
  * @param {string} inputValue
294
- * @param {function} resolve
294
+ * @param {Function} resolve
295
295
  * @param {function(Error):any} reject
296
296
  * @return {void}
297
297
  */
@@ -305,7 +305,7 @@ export default class SearchAdapter {
305
305
 
306
306
  /**
307
307
  * @param {string} searchTerm
308
- * @param {function} resolve
308
+ * @param {Function} resolve
309
309
  * @param {function(Error):any} reject
310
310
  * @return {void}
311
311
  */
@@ -376,7 +376,7 @@ export default class SearchAdapter {
376
376
  * @param {Event|FocusEvent} event
377
377
  * @return {void}
378
378
  */
379
- handleBlurEvent(event) { // eslint-disable-line no-unused-vars
379
+ handleBlurEvent(event) { // eslint-disable-line @typescript-eslint/no-unused-vars
380
380
  if (this.dropdown) {
381
381
  const dropDownElement = this.textfield.querySelector('.mdw-textfield__dropdown');
382
382
  if (dropDownElement.hasAttribute('mdw-show')) {
@@ -1,17 +1,17 @@
1
1
  // https://material.io/guidelines/layout/structure.html#structure-app-bar
2
2
  // https://material.io/archive/guidelines/components/toolbars.html
3
3
 
4
- @import '../../core/_breakpoint.scss';
5
- @import '../../core/_platform.scss';
6
- @import '../../core/_type.scss';
7
-
8
- $mdw-appbar__height: 64 !default;
9
- $mdw-appbar__height-dense: 48 !default;
10
- $mdw-appbar__height-mobile: 56 !default;
11
- $mdw-appbar__height-mobile-landscape: 48 !default;
12
- $mdw-appbar__height-prominent: 128 !default;
13
- $mdw-appbar__height-prominent-dense: 96 !default;
14
- $mdw-appbar__icon-height: 40 !default;
4
+ @use '../../core/_breakpoint.scss' as breakpoint;
5
+ @use '../../core/_length.scss' as *;
6
+ @use '../../core/_type.scss' as type;
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
15
 
16
16
  .mdw-appbar {
17
17
  display: flex;
@@ -19,41 +19,51 @@ $mdw-appbar__icon-height: 40 !default;
19
19
  }
20
20
 
21
21
  .mdw-appbar__action {
22
- display: flex;
23
- flex-direction: row;
24
- justify-content: space-between;
25
-
26
- min-height: dp($mdw-appbar__height);
27
-
22
+ display: -ms-grid;
23
+ display: grid;
24
+ grid-template-columns: auto 1fr auto;
25
+ -ms-grid-columns: auto 1fr auto;
28
26
 
27
+ min-height: dp($height);
28
+ -ms-grid-rows: minmax(dp($height), 1fr) auto;
29
+
29
30
  transition-duration: inherit;
30
31
  transition-property: min-height;
31
32
  transition-timing-function: inherit;
32
33
 
33
34
  z-index: 1;
34
35
 
36
+ &[mdw-centered] {
37
+ 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
+ }
40
+
35
41
  .mdw-appbar[mdw-prominent] > & {
36
- min-height: dp($mdw-appbar__height-prominent);
42
+ min-height: dp($heightProminent);
43
+ -ms-grid-rows: minmax(dp($heightProminent), 1fr) auto;
37
44
  }
38
45
 
39
46
  .mdw-appbar[mdw-dense] > & {
40
- min-height: dp($mdw-appbar__height-dense);
47
+ min-height: dp($heightDense);
48
+ -ms-grid-rows: minmax(dp($heightDense), 1fr) auto;
41
49
  }
42
50
 
43
51
  .mdw-appbar[mdw-dense][mdw-prominent] > & {
44
- min-height: dp($mdw-appbar__height-prominent-dense);
45
- @include mdw-breakpoint__tablet-device__max {
46
- min-height: dp($mdw-appbar__height-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;
47
57
  }
48
58
  }
49
-
59
+
50
60
  &,
51
61
  .mdw-appbar[mdw-dense] > & {
52
- @include mdw-breakpoint__tablet-device__max {
53
- min-height: dp($mdw-appbar__height-mobile);
62
+ @include breakpoint.maxTabletDevice {
63
+ min-height: dp($heightMobile);
54
64
  }
55
- @include mdw-breakpoint__mobile-device__landscape {
56
- min-height: dp($mdw-appbar__height-mobile-landscape);
65
+ @include breakpoint.isMobileDeviceLandscape {
66
+ min-height: dp($heightMobileLandscape);
57
67
  }
58
68
  }
59
69
  }
@@ -62,59 +72,67 @@ $mdw-appbar__icon-height: 40 !default;
62
72
  display: flex;
63
73
  flex-direction: column;
64
74
 
65
- flex-grow: 1;
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;
80
+ grid-row: 2;
66
81
 
67
82
  margin-right: dp(24);
68
83
  margin-left: dp(80);
69
- @include mdw-breakpoint__16dp-margin {
84
+ @include breakpoint.has16DPMargin() {
70
85
  margin-right: dp(16);
71
86
  margin-left: dp(72);
72
87
  }
73
88
  }
74
89
 
75
90
  .mdw-appbar__title {
76
- @include type-rules('h6');
77
- @include baseline-bottom(24);
91
+ @include type.addRules('h6');
92
+ @include type.baselineToBottom(24);
78
93
 
94
+ -ms-grid-row-align: end;
79
95
  align-self: flex-end;
96
+
97
+ -ms-grid-column: 2;
98
+ grid-column: 2;
99
+ -ms-grid-row: 1;
100
+ grid-row: 1;
101
+
80
102
  justify-content: space-around;
81
103
  overflow-x: hidden;
82
104
 
83
105
  height: auto;
84
- flex-grow: 1;
85
106
  margin: 0 dp(16);
86
-
87
107
 
88
108
  transition-duration: inherit;
89
- transition-property: font, letter-spacing;
109
+ transition-property: font, letter-spacing, margin-top;
90
110
  transition-timing-function: inherit;
91
111
 
92
112
  text-overflow: ellipsis;
93
113
  white-space: nowrap;
94
114
 
95
- &[mdw-centered] {
96
- flex-grow: 0;
97
- }
98
115
 
99
116
  .mdw-appbar[mdw-dense] & {
100
- @include baseline-bottom(16);
117
+ @include type.baselineToBottom(16);
101
118
  }
102
-
119
+
103
120
  .mdw-appbar[mdw-dense] &,
104
121
  & {
105
- @include mdw-breakpoint__tablet-device__max {
106
- @include baseline-bottom(20);
122
+ @include breakpoint.maxTabletDevice {
123
+ @include type.baselineToBottom(20);
107
124
  }
108
- @include mdw-breakpoint__mobile-device__landscape {
109
- @include baseline-bottom(16);
125
+ @include breakpoint.isMobileDeviceLandscape {
126
+ @include type.baselineToBottom(16);
110
127
  }
111
128
  }
112
129
 
113
130
  .mdw-appbar[mdw-prominent] & {
114
131
  white-space: normal;
115
- @include type-rules('h5');
116
- @include baseline-bottom(28);
132
+ @include type.addRules('h5');
133
+ @include type.baselineToBottom(28);
117
134
  }
135
+
118
136
  &[mdw-custom] {
119
137
  margin-top: 0;
120
138
 
@@ -125,30 +143,35 @@ $mdw-appbar__icon-height: 40 !default;
125
143
  }
126
144
 
127
145
  .mdw-appbar__start {
128
- order: -1;
146
+ -ms-grid-column: 1;
147
+ grid-column: 1;
129
148
 
130
149
  margin-left: dp(8);
131
150
 
132
151
  padding: 0 dp(8);
133
- @include mdw-breakpoint__16dp-margin {
152
+ @include breakpoint.has16DPMargin() {
134
153
  margin-left: 0;
135
154
  }
136
155
  }
137
156
 
138
157
  .mdw-appbar__end {
139
- order: 1;
140
- margin-left: 0;
158
+ -ms-grid-column: 3;
159
+ grid-column: 3;
160
+ justify-content: flex-end;
161
+
141
162
  margin-right: dp(12);
142
- @include mdw-breakpoint__16dp-margin {
143
- margin-left: 0;
163
+ margin-left: 0;
164
+ @include breakpoint.has16DPMargin() {
144
165
  margin-right: dp(4);
166
+ margin-left: 0;
145
167
  }
146
- [dir=rtl] & {
147
- margin-left: dp(12);
168
+
169
+ :root[dir="rtl"] & {
148
170
  margin-right: 0;
149
- @include mdw-breakpoint__16dp-margin {
150
- margin-left: dp(4);
171
+ margin-left: dp(12);
172
+ @include breakpoint.has16DPMargin() {
151
173
  margin-right: 0;
174
+ margin-left: dp(4);
152
175
  }
153
176
  }
154
177
  }
@@ -159,26 +182,26 @@ $mdw-appbar__icon-height: 40 !default;
159
182
  display: flex;
160
183
  align-items: flex-start;
161
184
  flex-direction: row;
185
+
186
+ transition-property: margin-top;
162
187
  }
163
188
 
164
189
  .mdw-appbar__start,
165
190
  .mdw-appbar__end,
166
191
  .mdw-appbar__title {
167
- margin-top: dp(($mdw-appbar__height - $mdw-appbar__icon-height) / 2);
168
-
169
- transition-property: margin-top;
192
+ margin-top: dp(($height - $iconHeight) * 0.5);
170
193
 
171
194
  .mdw-appbar[mdw-dense] & {
172
- margin-top: dp(($mdw-appbar__height-dense - $mdw-appbar__icon-height) / 2);
195
+ margin-top: dp(($heightDense - $iconHeight) * 0.5);
173
196
  }
174
-
197
+
175
198
  &,
176
199
  .mdw-appbar[mdw-dense] & {
177
- @include mdw-breakpoint__tablet-device__max {
178
- margin-top: dp(($mdw-appbar__height-mobile - $mdw-appbar__icon-height) / 2);
200
+ @include breakpoint.maxTabletDevice {
201
+ margin-top: dp(($heightMobile - $iconHeight) * 0.5);
179
202
  }
180
- @include mdw-breakpoint__mobile-device__landscape {
181
- margin-top: dp(($mdw-appbar__height-mobile-landscape - $mdw-appbar__icon-height) / 2);
203
+ @include breakpoint.isMobileDeviceLandscape {
204
+ margin-top: dp(($heightMobileLandscape - $iconHeight) * 0.5);
182
205
  }
183
206
  }
184
207
  }
@@ -1,2 +1,2 @@
1
- @import './_spec.scss';
2
- @import './_theme.scss';
1
+ @forward './_spec.scss';
2
+ @forward './_theme.scss';
@@ -1,8 +1,8 @@
1
1
  // https://material.io/design/components/banners.html
2
2
 
3
- @import '../../core/_platform.scss';
4
- @import '../../core/_breakpoint.scss';
5
- @import '../../core/_type.scss';
3
+ @use '../../core/_breakpoint.scss' as breakpoint;
4
+ @use '../../core/_length.scss' as *;
5
+ @use '../../core/_type.scss' as type;
6
6
 
7
7
  .mdw-banner {
8
8
  display: flex;
@@ -15,7 +15,7 @@
15
15
  }
16
16
 
17
17
  .mdw-banner__container {
18
- @include type-rules('body-2');
18
+ @include type.addRules('body-2');
19
19
 
20
20
  display: flex;
21
21
  position: relative;
@@ -53,8 +53,8 @@
53
53
  }
54
54
 
55
55
  .mdw-banner__text {
56
- @include texttop-to-top(12);
57
- @include baseline-bottom(12);
56
+ @include type.textTopToTop(12);
57
+ @include type.baselineToBottom(12);
58
58
 
59
59
  flex-grow: 1;
60
60
 
@@ -68,7 +68,7 @@
68
68
  padding-left: 0;
69
69
  }
70
70
 
71
- @include mdw-breakpoint__16dp-margin {
71
+ @include breakpoint.has16DPMargin() {
72
72
  padding-right: 0;
73
73
  padding-left: dp(16);
74
74
 
@@ -101,7 +101,7 @@
101
101
  }
102
102
  }
103
103
 
104
- @include mdw-breakpoint__medium-window__min {
104
+ @include breakpoint.minMediumWindow {
105
105
  .mdw-banner {
106
106
  flex-wrap: nowrap;
107
107
  }
@@ -1,2 +1,2 @@
1
- @import './_spec.scss';
2
- @import './_theme.scss';
1
+ @forward './_spec.scss';
2
+ @forward './_theme.scss';
@@ -1,14 +1,12 @@
1
1
  // https://material.io/design/components/bottom-navigation.html#specs
2
2
 
3
- @import '../../core/_motion.scss';
4
- @import '../../core/_platform.scss';
5
- @import '../../core/_type.scss';
3
+ @use '../../core/_length.scss' as *;
4
+ @use '../../core/_motion.scss' as motion;
5
+ @use '../../core/_type.scss' as type;
6
6
 
7
7
  .mdw-bottomnav {
8
8
  display: flex;
9
9
  position: relative;
10
- align-items: stretch;
11
- flex-direction: row;
12
10
  justify-content: center;
13
11
  overflow: hidden;
14
12
 
@@ -25,8 +23,10 @@
25
23
  overflow: visible;
26
24
 
27
25
  min-width: dp(80);
28
- max-width: dp(168);
29
- flex: 1;
26
+ flex: dp(168);
27
+ flex-grow: 0;
28
+ // flex-shrink: 1;
29
+ // flex-basis: dp(168);
30
30
  margin: 0;
31
31
  padding: 0;
32
32
 
@@ -44,6 +44,7 @@
44
44
  }
45
45
 
46
46
  .mdw-bottomnav__icon {
47
+ display: flex;
47
48
  position: absolute;
48
49
  top: 0;
49
50
  left: 50%;
@@ -52,9 +53,9 @@
52
53
  margin-left: dp(-12);
53
54
  padding: 0;
54
55
 
55
- transition-duration: $mdw-motion__shape-change-duration, $mdw-motion__simple-duration;
56
+ transition-duration: motion.$shapeChangeDuration, motion.$simpleDuration;
56
57
  transition-property: transform, color;
57
- transition-timing-function: $mdw-motion__standard-easing;
58
+ transition-timing-function: motion.$standardEasing;
58
59
 
59
60
  pointer-events: none;
60
61
  transform: translateY(dp(8));
@@ -66,7 +67,6 @@
66
67
  }
67
68
 
68
69
  .mdw-bottomnav__badge {
69
- visibility: hidden;
70
70
  position: absolute;
71
71
  top: 0;
72
72
  right: auto;
@@ -78,13 +78,15 @@
78
78
  min-width: dp(8);
79
79
  padding: dp(2);
80
80
 
81
+ visibility: hidden;
82
+
81
83
  z-index: 1;
82
84
 
83
85
  border-radius: dp(8);
84
86
 
85
87
  font: inherit;
86
88
 
87
- font-weight: $font-weight-regular;
89
+ font-weight: type.$weightRegular;
88
90
  font-size: dp(10);
89
91
  line-height: dp(12);
90
92
  letter-spacing: normal;
@@ -96,12 +98,15 @@
96
98
 
97
99
  &[mdw-badge] {
98
100
  visibility: visible;
101
+
99
102
  &::before {
100
103
  content: attr(mdw-badge);
101
104
  }
102
105
  }
106
+
103
107
  &[data-mdw-badge] {
104
108
  visibility: visible;
109
+
105
110
  &::before {
106
111
  content: attr(data-mdw-badge);
107
112
  }
@@ -109,20 +114,20 @@
109
114
  }
110
115
 
111
116
  .mdw-bottomnav__label {
112
- @include type-rules('caption');
113
- @include texttop-to-top(32);
114
- @include baseline-bottom(8);
117
+ @include type.addRules('caption');
118
+ @include type.textTopToTop(32);
119
+ @include type.baselineToBottom(8);
115
120
 
116
121
  // Overriding 12dp for baseline bottom with 8dp for oversized and textwrapped
117
- // Baseline top will ensure baseline-bottom is 12dp for standard layouts
122
+ // Baseline top will ensure type.baselineToBottom is 12dp for standard layouts
118
123
 
119
124
  box-sizing: border-box;
120
125
  max-width: 100%;
121
126
  padding: 0 dp(12);
122
127
 
123
- transition-duration: $mdw-motion__shape-change-duration;
128
+ transition-duration: motion.$shapeChangeDuration;
124
129
  transition-property: transform, opacity, color;
125
- transition-timing-function: $mdw-motion__standard-easing;
130
+ transition-timing-function: motion.$standardEasing;
126
131
 
127
132
  pointer-events: none;
128
133