@shortfuse/materialdesignweb 0.8.0 → 0.9.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 (394) hide show
  1. package/README.md +32 -24
  2. package/bin/mdw-css.js +1 -1
  3. package/components/Badge.js +12 -5
  4. package/components/Body.js +3 -0
  5. package/components/BottomAppBar.js +1 -8
  6. package/components/BottomSheet.js +424 -0
  7. package/components/Box.js +11 -49
  8. package/components/Button.js +61 -82
  9. package/components/Card.js +56 -61
  10. package/components/Checkbox.js +7 -25
  11. package/components/CheckboxIcon.js +10 -28
  12. package/components/Chip.js +13 -11
  13. package/components/Dialog.js +49 -98
  14. package/components/Display.js +55 -0
  15. package/components/Fab.js +83 -17
  16. package/components/FabContainer.js +48 -0
  17. package/components/FilterChip.js +34 -32
  18. package/components/Grid.js +176 -0
  19. package/components/Headline.js +5 -28
  20. package/components/Icon.js +54 -69
  21. package/components/IconButton.js +71 -120
  22. package/components/Input.js +669 -83
  23. package/components/InputChip.js +161 -0
  24. package/components/Label.js +3 -0
  25. package/components/List.js +1 -5
  26. package/components/ListItem.js +39 -23
  27. package/components/ListOption.js +79 -62
  28. package/components/Listbox.js +19 -10
  29. package/components/Menu.js +8 -18
  30. package/components/MenuItem.js +25 -26
  31. package/components/NavBar.js +53 -19
  32. package/components/NavDrawer.js +15 -15
  33. package/components/NavDrawerItem.js +2 -4
  34. package/components/NavItem.js +40 -33
  35. package/components/NavRail.js +23 -21
  36. package/components/NavRailItem.js +5 -2
  37. package/components/Page.js +105 -0
  38. package/components/Pane.js +18 -0
  39. package/components/Popup.js +17 -8
  40. package/components/Radio.js +2 -5
  41. package/components/RadioIcon.js +10 -14
  42. package/components/Ripple.js +11 -7
  43. package/components/Root.js +209 -0
  44. package/components/Scrim.js +87 -0
  45. package/components/Search.js +12 -20
  46. package/components/SegmentedButton.js +33 -36
  47. package/components/SegmentedButtonGroup.js +9 -3
  48. package/components/Select.js +6 -7
  49. package/components/Shape.js +5 -65
  50. package/components/SideSheet.js +308 -0
  51. package/components/Slider.js +71 -34
  52. package/components/Snackbar.js +22 -16
  53. package/components/SnackbarContainer.js +42 -0
  54. package/components/Surface.js +15 -10
  55. package/components/Switch.js +3 -16
  56. package/components/SwitchIcon.js +40 -32
  57. package/components/Tab.js +57 -38
  58. package/components/TabContent.js +1 -0
  59. package/components/TabList.js +60 -32
  60. package/components/TabPanel.js +1 -1
  61. package/components/Table.js +116 -0
  62. package/components/TextArea.js +16 -15
  63. package/components/Title.js +4 -9
  64. package/components/Tooltip.js +43 -21
  65. package/components/TopAppBar.js +56 -78
  66. package/constants/shapes.js +36 -0
  67. package/constants/typography.js +127 -0
  68. package/core/Composition.js +354 -192
  69. package/core/CompositionAdapter.js +11 -12
  70. package/core/CustomElement.js +588 -236
  71. package/core/css.js +117 -12
  72. package/core/customTypes.js +120 -25
  73. package/core/dom.js +17 -11
  74. package/core/jsonMergePatch.js +12 -10
  75. package/core/observe.js +298 -253
  76. package/core/optimizations.js +9 -9
  77. package/core/template.js +14 -57
  78. package/dist/index.min.js +85 -115
  79. package/dist/index.min.js.map +4 -4
  80. package/dist/meta.json +1 -1
  81. package/dom/HTMLOptionsCollectionProxy.js +106 -0
  82. package/{theming/themableMixinLoader.js → loaders/palette.js} +4 -3
  83. package/loaders/theme.js +12 -0
  84. package/mixins/AriaReflectorMixin.js +53 -13
  85. package/mixins/AriaToolbarMixin.js +3 -0
  86. package/mixins/ControlMixin.js +76 -33
  87. package/mixins/DelegatesFocusMixin.js +54 -0
  88. package/mixins/DensityMixin.js +2 -2
  89. package/mixins/ElevationMixin.js +62 -0
  90. package/mixins/FlexableMixin.js +66 -37
  91. package/mixins/FormAssociatedMixin.js +60 -8
  92. package/mixins/HyperlinkMixin.js +66 -0
  93. package/mixins/InputMixin.js +205 -32
  94. package/mixins/KeyboardNavMixin.js +8 -6
  95. package/mixins/NavigationListenerMixin.js +33 -0
  96. package/mixins/PopupMixin.js +176 -208
  97. package/mixins/ResizeObserverMixin.js +16 -4
  98. package/mixins/RippleMixin.js +8 -6
  99. package/mixins/ScrollListenerMixin.js +1 -1
  100. package/mixins/SemiStickyMixin.js +44 -98
  101. package/mixins/ShapeMaskedMixin.js +117 -0
  102. package/mixins/ShapeMixin.js +22 -204
  103. package/mixins/StateMixin.js +70 -34
  104. package/mixins/TextFieldMixin.js +107 -143
  105. package/mixins/ThemableMixin.js +44 -56
  106. package/mixins/TooltipTriggerMixin.js +291 -359
  107. package/mixins/TouchTargetMixin.js +1 -1
  108. package/mixins/TypographyMixin.js +121 -0
  109. package/package.json +110 -74
  110. package/services/rtl.js +10 -0
  111. package/services/svgAlias.js +17 -0
  112. package/{theming/index.js → services/theme.js} +24 -174
  113. package/types/bin/mdw-css.d.ts +3 -0
  114. package/types/bin/mdw-css.d.ts.map +1 -0
  115. package/types/components/Badge.d.ts +39 -0
  116. package/types/components/Badge.d.ts.map +1 -0
  117. package/types/components/Body.d.ts +29 -0
  118. package/types/components/Body.d.ts.map +1 -0
  119. package/types/components/BottomAppBar.d.ts +73 -0
  120. package/types/components/BottomAppBar.d.ts.map +1 -0
  121. package/types/components/BottomSheet.d.ts +109 -0
  122. package/types/components/BottomSheet.d.ts.map +1 -0
  123. package/types/components/Box.d.ts +16 -0
  124. package/types/components/Box.d.ts.map +1 -0
  125. package/types/components/Button.d.ts +714 -0
  126. package/types/components/Button.d.ts.map +1 -0
  127. package/types/components/Card.d.ts +412 -0
  128. package/types/components/Card.d.ts.map +1 -0
  129. package/types/components/Checkbox.d.ts +205 -0
  130. package/types/components/Checkbox.d.ts.map +1 -0
  131. package/types/components/CheckboxIcon.d.ts +44 -0
  132. package/types/components/CheckboxIcon.d.ts.map +1 -0
  133. package/types/components/Chip.d.ts +1425 -0
  134. package/types/components/Chip.d.ts.map +1 -0
  135. package/types/components/Dialog.d.ts +286 -0
  136. package/types/components/Dialog.d.ts.map +1 -0
  137. package/types/components/DialogActions.d.ts +4 -0
  138. package/types/components/DialogActions.d.ts.map +1 -0
  139. package/types/components/Display.d.ts +45 -0
  140. package/types/components/Display.d.ts.map +1 -0
  141. package/types/components/Divider.d.ts +10 -0
  142. package/types/components/Divider.d.ts.map +1 -0
  143. package/types/components/Fab.d.ts +741 -0
  144. package/types/components/Fab.d.ts.map +1 -0
  145. package/types/components/FabContainer.d.ts +10 -0
  146. package/types/components/FabContainer.d.ts.map +1 -0
  147. package/types/components/FilterChip.d.ts +4283 -0
  148. package/types/components/FilterChip.d.ts.map +1 -0
  149. package/types/components/Grid.d.ts +37 -0
  150. package/types/components/Grid.d.ts.map +1 -0
  151. package/types/components/Headline.d.ts +47 -0
  152. package/types/components/Headline.d.ts.map +1 -0
  153. package/types/components/Icon.d.ts +103 -0
  154. package/types/components/Icon.d.ts.map +1 -0
  155. package/types/components/IconButton.d.ts +1486 -0
  156. package/types/components/IconButton.d.ts.map +1 -0
  157. package/types/components/Input.d.ts +51288 -0
  158. package/types/components/Input.d.ts.map +1 -0
  159. package/types/components/InputChip.d.ts +243 -0
  160. package/types/components/InputChip.d.ts.map +1 -0
  161. package/types/components/Label.d.ts +29 -0
  162. package/types/components/Label.d.ts.map +1 -0
  163. package/types/components/List.d.ts +31 -0
  164. package/types/components/List.d.ts.map +1 -0
  165. package/types/components/ListItem.d.ts +349 -0
  166. package/types/components/ListItem.d.ts.map +1 -0
  167. package/types/components/ListOption.d.ts +1493 -0
  168. package/types/components/ListOption.d.ts.map +1 -0
  169. package/types/components/Listbox.d.ts +12012 -0
  170. package/types/components/Listbox.d.ts.map +1 -0
  171. package/types/components/Menu.d.ts +119 -0
  172. package/types/components/Menu.d.ts.map +1 -0
  173. package/types/components/MenuItem.d.ts +3109 -0
  174. package/types/components/MenuItem.d.ts.map +1 -0
  175. package/types/components/NavBar.d.ts +18 -0
  176. package/types/components/NavBar.d.ts.map +1 -0
  177. package/types/components/NavBarItem.d.ts +186 -0
  178. package/types/components/NavBarItem.d.ts.map +1 -0
  179. package/types/components/NavDrawer.d.ts +108 -0
  180. package/types/components/NavDrawer.d.ts.map +1 -0
  181. package/types/components/NavDrawerItem.d.ts +186 -0
  182. package/types/components/NavDrawerItem.d.ts.map +1 -0
  183. package/types/components/NavItem.d.ts +190 -0
  184. package/types/components/NavItem.d.ts.map +1 -0
  185. package/types/components/NavRail.d.ts +109 -0
  186. package/types/components/NavRail.d.ts.map +1 -0
  187. package/types/components/NavRailItem.d.ts +186 -0
  188. package/types/components/NavRailItem.d.ts.map +1 -0
  189. package/types/components/Page.d.ts +24 -0
  190. package/types/components/Page.d.ts.map +1 -0
  191. package/types/components/Pane.d.ts +44 -0
  192. package/types/components/Pane.d.ts.map +1 -0
  193. package/types/components/Popup.d.ts +76 -0
  194. package/types/components/Popup.d.ts.map +1 -0
  195. package/types/components/Progress.d.ts +19 -0
  196. package/types/components/Progress.d.ts.map +1 -0
  197. package/types/components/Radio.d.ts +199 -0
  198. package/types/components/Radio.d.ts.map +1 -0
  199. package/types/components/RadioIcon.d.ts +46 -0
  200. package/types/components/RadioIcon.d.ts.map +1 -0
  201. package/types/components/Ripple.d.ts +34 -0
  202. package/types/components/Ripple.d.ts.map +1 -0
  203. package/types/components/Root.d.ts +68 -0
  204. package/types/components/Root.d.ts.map +1 -0
  205. package/types/components/Scrim.d.ts +6 -0
  206. package/types/components/Scrim.d.ts.map +1 -0
  207. package/types/components/Search.d.ts +16 -0
  208. package/types/components/Search.d.ts.map +1 -0
  209. package/types/components/SegmentedButton.d.ts +718 -0
  210. package/types/components/SegmentedButton.d.ts.map +1 -0
  211. package/types/components/SegmentedButtonGroup.d.ts +44 -0
  212. package/types/components/SegmentedButtonGroup.d.ts.map +1 -0
  213. package/types/components/Select.d.ts +1361 -0
  214. package/types/components/Select.d.ts.map +1 -0
  215. package/types/components/Shape.d.ts +10 -0
  216. package/types/components/Shape.d.ts.map +1 -0
  217. package/types/components/SideSheet.d.ts +106 -0
  218. package/types/components/SideSheet.d.ts.map +1 -0
  219. package/types/components/Slider.d.ts +382 -0
  220. package/types/components/Slider.d.ts.map +1 -0
  221. package/types/components/Snackbar.d.ts +65 -0
  222. package/types/components/Snackbar.d.ts.map +1 -0
  223. package/types/components/SnackbarContainer.d.ts +6 -0
  224. package/types/components/SnackbarContainer.d.ts.map +1 -0
  225. package/types/components/Surface.d.ts +45 -0
  226. package/types/components/Surface.d.ts.map +1 -0
  227. package/types/components/Switch.d.ts +183 -0
  228. package/types/components/Switch.d.ts.map +1 -0
  229. package/types/components/SwitchIcon.d.ts +169 -0
  230. package/types/components/SwitchIcon.d.ts.map +1 -0
  231. package/types/components/Tab.d.ts +879 -0
  232. package/types/components/Tab.d.ts.map +1 -0
  233. package/types/components/TabContent.d.ts +122 -0
  234. package/types/components/TabContent.d.ts.map +1 -0
  235. package/types/components/TabList.d.ts +6266 -0
  236. package/types/components/TabList.d.ts.map +1 -0
  237. package/types/components/TabPanel.d.ts +28 -0
  238. package/types/components/TabPanel.d.ts.map +1 -0
  239. package/types/components/Table.d.ts +2 -0
  240. package/types/components/Table.d.ts.map +1 -0
  241. package/types/components/TextArea.d.ts +1394 -0
  242. package/types/components/TextArea.d.ts.map +1 -0
  243. package/types/components/Title.d.ts +47 -0
  244. package/types/components/Title.d.ts.map +1 -0
  245. package/types/components/Tooltip.d.ts +49 -0
  246. package/types/components/Tooltip.d.ts.map +1 -0
  247. package/types/components/TopAppBar.d.ts +130 -0
  248. package/types/components/TopAppBar.d.ts.map +1 -0
  249. package/types/constants/colorKeywords.d.ts +2 -0
  250. package/types/constants/colorKeywords.d.ts.map +1 -0
  251. package/types/constants/shapes.d.ts +38 -0
  252. package/types/constants/shapes.d.ts.map +1 -0
  253. package/types/constants/typography.d.ts +212 -0
  254. package/types/constants/typography.d.ts.map +1 -0
  255. package/types/core/Composition.d.ts +252 -0
  256. package/types/core/Composition.d.ts.map +1 -0
  257. package/types/core/CompositionAdapter.d.ts +92 -0
  258. package/types/core/CompositionAdapter.d.ts.map +1 -0
  259. package/types/core/CustomElement.d.ts +302 -0
  260. package/types/core/CustomElement.d.ts.map +1 -0
  261. package/types/core/css.d.ts +44 -0
  262. package/types/core/css.d.ts.map +1 -0
  263. package/types/core/customTypes.d.ts +26 -0
  264. package/types/core/customTypes.d.ts.map +1 -0
  265. package/types/core/dom.d.ts +32 -0
  266. package/types/core/dom.d.ts.map +1 -0
  267. package/types/core/jsonMergePatch.d.ts +31 -0
  268. package/types/core/jsonMergePatch.d.ts.map +1 -0
  269. package/types/core/observe.d.ts +113 -0
  270. package/types/core/observe.d.ts.map +1 -0
  271. package/types/core/optimizations.d.ts +7 -0
  272. package/types/core/optimizations.d.ts.map +1 -0
  273. package/types/core/template.d.ts +47 -0
  274. package/types/core/template.d.ts.map +1 -0
  275. package/types/core/uid.d.ts +6 -0
  276. package/types/core/uid.d.ts.map +1 -0
  277. package/types/dom/HTMLOptionsCollectionProxy.d.ts +18 -0
  278. package/types/dom/HTMLOptionsCollectionProxy.d.ts.map +1 -0
  279. package/types/index.d.ts +88 -0
  280. package/types/index.d.ts.map +1 -0
  281. package/types/loaders/palette.d.ts +2 -0
  282. package/types/loaders/palette.d.ts.map +1 -0
  283. package/types/loaders/theme.d.ts +2 -0
  284. package/types/loaders/theme.d.ts.map +1 -0
  285. package/types/mixins/AriaReflectorMixin.d.ts +23 -0
  286. package/types/mixins/AriaReflectorMixin.d.ts.map +1 -0
  287. package/types/mixins/AriaToolbarMixin.d.ts +32 -0
  288. package/types/mixins/AriaToolbarMixin.d.ts.map +1 -0
  289. package/types/mixins/ControlMixin.d.ts +124 -0
  290. package/types/mixins/ControlMixin.d.ts.map +1 -0
  291. package/types/mixins/DelegatesFocusMixin.d.ts +5 -0
  292. package/types/mixins/DelegatesFocusMixin.d.ts.map +1 -0
  293. package/types/mixins/DensityMixin.d.ts +5 -0
  294. package/types/mixins/DensityMixin.d.ts.map +1 -0
  295. package/types/mixins/ElevationMixin.d.ts +33 -0
  296. package/types/mixins/ElevationMixin.d.ts.map +1 -0
  297. package/types/mixins/FlexableMixin.d.ts +13 -0
  298. package/types/mixins/FlexableMixin.d.ts.map +1 -0
  299. package/types/mixins/FormAssociatedMixin.d.ts +122 -0
  300. package/types/mixins/FormAssociatedMixin.d.ts.map +1 -0
  301. package/types/mixins/HyperlinkMixin.d.ts +22 -0
  302. package/types/mixins/HyperlinkMixin.d.ts.map +1 -0
  303. package/types/mixins/InputMixin.d.ts +179 -0
  304. package/types/mixins/InputMixin.d.ts.map +1 -0
  305. package/types/mixins/KeyboardNavMixin.d.ts +47 -0
  306. package/types/mixins/KeyboardNavMixin.d.ts.map +1 -0
  307. package/types/mixins/NavigationListenerMixin.d.ts +8 -0
  308. package/types/mixins/NavigationListenerMixin.d.ts.map +1 -0
  309. package/types/mixins/PopupMixin.d.ts +82 -0
  310. package/types/mixins/PopupMixin.d.ts.map +1 -0
  311. package/types/mixins/RTLObserverMixin.d.ts +7 -0
  312. package/types/mixins/RTLObserverMixin.d.ts.map +1 -0
  313. package/types/mixins/ResizeObserverMixin.d.ts +12 -0
  314. package/types/mixins/ResizeObserverMixin.d.ts.map +1 -0
  315. package/types/mixins/RippleMixin.d.ts +92 -0
  316. package/types/mixins/RippleMixin.d.ts.map +1 -0
  317. package/types/mixins/ScrollListenerMixin.d.ts +41 -0
  318. package/types/mixins/ScrollListenerMixin.d.ts.map +1 -0
  319. package/types/mixins/SemiStickyMixin.d.ts +50 -0
  320. package/types/mixins/SemiStickyMixin.d.ts.map +1 -0
  321. package/types/mixins/ShapeMaskedMixin.d.ts +9 -0
  322. package/types/mixins/ShapeMaskedMixin.d.ts.map +1 -0
  323. package/types/mixins/ShapeMixin.d.ts +38 -0
  324. package/types/mixins/ShapeMixin.d.ts.map +1 -0
  325. package/types/mixins/StateMixin.d.ts +27 -0
  326. package/types/mixins/StateMixin.d.ts.map +1 -0
  327. package/types/mixins/TextFieldMixin.d.ts +1354 -0
  328. package/types/mixins/TextFieldMixin.d.ts.map +1 -0
  329. package/types/mixins/ThemableMixin.d.ts +9 -0
  330. package/types/mixins/ThemableMixin.d.ts.map +1 -0
  331. package/types/mixins/TooltipTriggerMixin.d.ts +106 -0
  332. package/types/mixins/TooltipTriggerMixin.d.ts.map +1 -0
  333. package/types/mixins/TouchTargetMixin.d.ts +3 -0
  334. package/types/mixins/TouchTargetMixin.d.ts.map +1 -0
  335. package/types/mixins/TypographyMixin.d.ts +17 -0
  336. package/types/mixins/TypographyMixin.d.ts.map +1 -0
  337. package/types/services/rtl.d.ts +3 -0
  338. package/types/services/rtl.d.ts.map +1 -0
  339. package/types/services/svgAlias.d.ts +13 -0
  340. package/types/services/svgAlias.d.ts.map +1 -0
  341. package/types/services/theme.d.ts +45 -0
  342. package/types/services/theme.d.ts.map +1 -0
  343. package/types/utils/cli.d.ts +3 -0
  344. package/types/utils/cli.d.ts.map +1 -0
  345. package/types/utils/function.d.ts +3 -0
  346. package/types/utils/function.d.ts.map +1 -0
  347. package/types/utils/jsx-runtime.d.ts +20 -0
  348. package/types/utils/jsx-runtime.d.ts.map +1 -0
  349. package/types/utils/material-color/blend.d.ts +34 -0
  350. package/types/utils/material-color/blend.d.ts.map +1 -0
  351. package/types/utils/material-color/hct/Cam16.d.ts +142 -0
  352. package/types/utils/material-color/hct/Cam16.d.ts.map +1 -0
  353. package/types/utils/material-color/hct/Hct.d.ts +93 -0
  354. package/types/utils/material-color/hct/Hct.d.ts.map +1 -0
  355. package/types/utils/material-color/hct/ViewingConditions.d.ts +69 -0
  356. package/types/utils/material-color/hct/ViewingConditions.d.ts.map +1 -0
  357. package/types/utils/material-color/hct/hctSolver.d.ts +30 -0
  358. package/types/utils/material-color/hct/hctSolver.d.ts.map +1 -0
  359. package/types/utils/material-color/helper.d.ts +8 -0
  360. package/types/utils/material-color/helper.d.ts.map +1 -0
  361. package/types/utils/material-color/palettes/CorePalette.d.ts +75 -0
  362. package/types/utils/material-color/palettes/CorePalette.d.ts.map +1 -0
  363. package/types/utils/material-color/palettes/TonalPalette.d.ts +38 -0
  364. package/types/utils/material-color/palettes/TonalPalette.d.ts.map +1 -0
  365. package/types/utils/material-color/scheme/Scheme.d.ts +264 -0
  366. package/types/utils/material-color/scheme/Scheme.d.ts.map +1 -0
  367. package/types/utils/material-color/utils/color.d.ts +172 -0
  368. package/types/utils/material-color/utils/color.d.ts.map +1 -0
  369. package/types/utils/material-color/utils/math.d.ts +94 -0
  370. package/types/utils/material-color/utils/math.d.ts.map +1 -0
  371. package/types/utils/pixelmatch.d.ts +22 -0
  372. package/types/utils/pixelmatch.d.ts.map +1 -0
  373. package/types/utils/popup.d.ts +106 -0
  374. package/types/utils/popup.d.ts.map +1 -0
  375. package/types/utils/searchParams.d.ts +3 -0
  376. package/types/utils/searchParams.d.ts.map +1 -0
  377. package/types/utils/svg.d.ts +7 -0
  378. package/types/utils/svg.d.ts.map +1 -0
  379. package/utils/material-color/scheme/Scheme.js +1 -1
  380. package/utils/pixelmatch.js +360 -0
  381. package/utils/popup.js +86 -10
  382. package/utils/searchParams.js +19 -0
  383. package/components/ExtendedFab.js +0 -32
  384. package/components/Layout.js +0 -504
  385. package/components/Nav.js +0 -38
  386. package/core/DomAdapter.js +0 -586
  387. package/core/ICustomElement.d.ts +0 -291
  388. package/core/ICustomElement.js +0 -1
  389. package/core/test.js +0 -126
  390. package/core/typings.d.ts +0 -142
  391. package/core/typings.js +0 -1
  392. package/mixins/SurfaceMixin.js +0 -127
  393. package/theming/loader.js +0 -22
  394. /package/{utils/color_keywords.js → constants/colorKeywords.js} +0 -0
package/components/Box.js CHANGED
@@ -3,35 +3,16 @@ import FlexableMixin from '../mixins/FlexableMixin.js';
3
3
  import ThemableMixin from '../mixins/ThemableMixin.js';
4
4
 
5
5
  /**
6
- * Containers are stateless elements that may have a color and ink.
6
+ * Boxes are stateless elements that may have a color and ink.
7
7
  * They should have simple geometry for rendering and layout.
8
8
  */
9
9
  export default CustomElement
10
10
  .extend()
11
11
  .mixin(ThemableMixin)
12
12
  .mixin(FlexableMixin)
13
- .observe({
14
- inline: 'boolean',
15
- grid: 'boolean',
16
- block: {
17
- type: 'boolean',
18
- empty: true,
19
- },
20
- })
13
+ .html`<slot id=slot></slot>`
21
14
  .css`
22
- :host {
23
- display: block;
24
- }
25
-
26
- :host([inline]) {
27
- display: inline-block;
28
- }
29
-
30
- :host([flex]:where([inline])) {
31
- display: inline-flex;
32
- }
33
-
34
- :host([color]) {
15
+ :host(:where([color])) {
35
16
  background-color: rgb(var(--mdw-bg));
36
17
  color: rgb(var(--mdw-ink));
37
18
  }
@@ -49,36 +30,17 @@ export default CustomElement
49
30
  font: var(--mdw-type__font);
50
31
  letter-spacing: var(--mdw-type__letter-spacing);
51
32
  }
52
-
53
- #slot {
54
- /* Passthrough from parent */
55
- block-size: inherit;
56
- inline-size: inherit;
57
- }
58
33
 
59
- :host([grid]) {
60
- display: grid;
61
- column-gap: 16px; /* Gutters */
62
- grid-auto-flow: row;
63
- grid-template-columns: repeat(var(--mdw-grid__columns), 1fr);
34
+ #slot::slotted([flex-0]) {
35
+ flex: 0;
64
36
  }
65
37
 
66
- #slot[grid]::slotted(*) { grid-column: auto / span calc(var(--mdw-grid__columns)) }
67
- #slot[grid]::slotted([col-span="1"]) { grid-column: auto / span 1; }
68
- #slot[grid]::slotted([col-span="2"]) { grid-column: auto / span min(2, var(--mdw-grid__columns)); }
69
- #slot[grid]::slotted([col-span="3"]) { grid-column: auto / span min(3, var(--mdw-grid__columns)); }
70
- #slot[grid]::slotted([col-span="4"]) { grid-column: auto / span min(4, var(--mdw-grid__columns)); }
71
- #slot[grid]::slotted([col-span="5"]) { grid-column: auto / span min(5, var(--mdw-grid__columns)); }
72
- #slot[grid]::slotted([col-span="6"]) { grid-column: auto / span min(6, var(--mdw-grid__columns)); }
73
- #slot[grid]::slotted([col-span="7"]) { grid-column: auto / span min(7, var(--mdw-grid__columns)); }
74
- #slot[grid]::slotted([col-span="8"]) { grid-column: auto / span min(8, var(--mdw-grid__columns)); }
75
- #slot[grid]::slotted([col-span="9"]) { grid-column: auto / span min(9, var(--mdw-grid__columns)); }
76
- #slot[grid]::slotted([col-span="10"]) { grid-column: auto / span min(10, var(--mdw-grid__columns)); }
77
- #slot[grid]::slotted([col-span="11"]) { grid-column: auto / span min(11, var(--mdw-grid__columns)); }
78
- #slot[grid]::slotted([col-span="12"]) { grid-column: auto / span min(12, var(--mdw-grid__columns)); }
79
- #slot[grid]::slotted([col-span="50%"]) { grid-column: auto / span max(calc(var(--mdw-grid__columns) / 2), 1); }
80
- #slot[grid]::slotted([col-span="25%"]) { grid-column: auto / span max(calc(var(--mdw-grid__columns) / 4), 1); }
38
+ #slot::slotted([flex-1]) {
39
+ flex: 1;
40
+ }
81
41
 
42
+ #slot::slotted([flex-none]) {
43
+ flex: none;
44
+ }
82
45
  `
83
- .html`<slot id=slot type-style={typeStyle} grid={grid}></slot>`
84
46
  .autoRegister('mdw-box');
@@ -1,34 +1,51 @@
1
1
  import './Icon.js';
2
2
  import CustomElement from '../core/CustomElement.js';
3
3
  import DensityMixin from '../mixins/DensityMixin.js';
4
+ import ElevationMixin from '../mixins/ElevationMixin.js';
5
+ import HyperlinkMixin from '../mixins/HyperlinkMixin.js';
4
6
  import InputMixin from '../mixins/InputMixin.js';
5
7
  import RippleMixin from '../mixins/RippleMixin.js';
6
8
  import ShapeMixin from '../mixins/ShapeMixin.js';
7
9
  import StateMixin from '../mixins/StateMixin.js';
8
- import SurfaceMixin from '../mixins/SurfaceMixin.js';
9
10
  import ThemableMixin from '../mixins/ThemableMixin.js';
10
11
 
12
+ /* https://m3.material.io/components/buttons/specs */
13
+
11
14
  export default CustomElement
12
15
  .extend()
13
16
  .mixin(ThemableMixin)
14
17
  .mixin(DensityMixin)
15
- .mixin(SurfaceMixin)
16
- .mixin(ShapeMixin)
17
18
  .mixin(StateMixin)
19
+ .mixin(ElevationMixin)
20
+ .mixin(ShapeMixin)
18
21
  .mixin(RippleMixin)
19
22
  .mixin(InputMixin)
23
+ .mixin(HyperlinkMixin)
20
24
  .define({
21
25
  stateTargetElement() { return this.refs.control; },
22
26
  })
23
27
  .set({
24
28
  stateLayer: true,
25
- delegatesFocus: true,
29
+ _allowedTypes: ['button', 'submit', 'reset', 'file'],
26
30
  })
27
31
  .observe({
28
- type: { empty: 'button' },
32
+ type: {
33
+ empty: 'button',
34
+ /**
35
+ * @param {string} value
36
+ * @param {*} internalSet
37
+ */
38
+ set(value, internalSet) {
39
+ const enumeratedValue = value?.toLowerCase() ?? 'button';
40
+ internalSet(
41
+ this._allowedTypes.includes(enumeratedValue)
42
+ ? enumeratedValue
43
+ : 'button',
44
+ );
45
+ },
46
+ },
29
47
  elevated: 'boolean',
30
48
  filled: 'string',
31
- href: 'string',
32
49
  outlined: 'boolean',
33
50
  icon: 'string',
34
51
  iconInk: 'string',
@@ -36,17 +53,17 @@ export default CustomElement
36
53
  svg: 'string',
37
54
  viewBox: 'string',
38
55
  svgPath: 'string',
39
- _slotInnerText: 'string',
40
56
  })
41
57
  .expressions({
42
- hasIcon({ icon, svg, src, svgPath }) {
58
+ hasIcon({ icon, svg, src, svgPath } = this) {
43
59
  return icon ?? svg ?? src ?? svgPath;
44
60
  },
45
- computedAriaLabel({ ariaLabel, _slotInnerText }) {
46
- return ariaLabel?.trim() || _slotInnerText?.trim() || null;
61
+ iconVariation({ outlined } = this) {
62
+ return outlined ? null : 'filled';
47
63
  },
48
64
  })
49
65
  .methods({
66
+ /** @type {HTMLElement['focus']} */
50
67
  focus(...options) {
51
68
  if (this.href) {
52
69
  this.refs.anchor.focus(...options);
@@ -56,39 +73,19 @@ export default CustomElement
56
73
  },
57
74
  })
58
75
  .html`
59
- <mdw-icon mdw-if={hasIcon} id=icon ink={iconInk} disabled={disabledState} outlined={outlined} aria-hidden=true svg={svg} src={src} svg-path={svgPath} view-box={viewBox}>{icon}</mdw-icon>
60
- <a mdw-if={href} id=anchor href={href} aria-label="{computedAriaLabel}"></a>
61
- <slot id=slot disabled={disabledState} aria-hidden=false></slot>
76
+ <mdw-icon mdw-if={hasIcon} id=icon ink={iconInk} disabled={disabledState}
77
+ outlined={outlined} variation={iconVariation} aria-hidden=true svg={svg} src={src}
78
+ svg-path={svgPath} view-box={viewBox} icon={icon}></mdw-icon>
79
+ <slot id=slot disabled={disabledState} aria-hidden=true>{_defaultValue}</slot>
62
80
  `
63
- .childEvents({
64
- slot: {
65
- slotchange() {
66
- // Firefox and Webkit will not apply label from slots.
67
- // https://bugs.webkit.org/show_bug.cgi?id=254934
68
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1826194
69
- if (navigator.userAgent.includes('Firefox')
70
- || (navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrom'))) {
71
- this._slotInnerText = this.textContent;
72
- }
73
- },
74
- },
75
- })
76
- .on({
77
- composed() {
78
- const {
79
- shape, state, rippleContainer, surface, control,
80
- } = this.refs;
81
- surface.append(shape);
82
- shape.append(state, rippleContainer);
83
- shape.setAttribute('filled', '{filled}');
84
- control.setAttribute('aria-label', '{computedAriaLabel}');
85
- control.setAttribute('hidden', '{href}');
86
- control.setAttribute('role', 'button');
87
- },
81
+ .recompose(({ refs: { anchor, control } }) => {
82
+ control.setAttribute('mdw-if', '{!href}');
83
+ control.setAttribute('role', 'button');
84
+ anchor.setAttribute('mdw-if', '{href}');
85
+ anchor.setAttribute('aria-label', '{_computedAriaLabel}');
86
+ anchor.setAttribute('aria-labelledby', '{_computedAriaLabelledby}');
88
87
  })
89
88
  .css`
90
- /* https://m3.material.io/components/buttons/specs */
91
-
92
89
  :host {
93
90
  --mdw-shape__size: var(--mdw-shape__full);
94
91
  --mdw-ink: var(--mdw-color__primary);
@@ -121,23 +118,39 @@ export default CustomElement
121
118
  }
122
119
 
123
120
  :host(:where([elevated],[filled])) {
124
- will-change: filter;
121
+ transition: box-shadow 200ms;
122
+ will-change: box-shadow;
125
123
  }
126
124
 
127
125
  /** Elevated Color Defaults */
128
126
  :host(:where([elevated])) {
129
127
  --mdw-bg: var(--mdw-color__surface-container-low);
130
128
  --mdw-ink: var(--mdw-color__primary);
131
- --mdw-surface__shadow__resting: var(--mdw-surface__shadow__1);
132
- --mdw-surface__shadow__raised: var(--mdw-surface__shadow__2);
129
+ box-shadow: var(--mdw-elevation__box-shadow__1);
133
130
  }
134
131
  /** Filled Color Defaults */
135
132
  :host(:where([filled])) {
136
133
  --mdw-bg: var(--mdw-color__primary);
137
134
  --mdw-ink: var(--mdw-color__on-primary);
138
- --mdw-surface__shadow__resting: var(--mdw-surface__shadow__0);
139
- --mdw-surface__shadow__raised: var(--mdw-surface__shadow__1);
135
+ box-shadow: var(--mdw-elevation__box-shadow__0);
136
+ }
137
+
138
+ :host(:where([elevated]:hover:not(:active))) {
139
+ box-shadow: var(--mdw-elevation__box-shadow__2);
140
140
  }
141
+
142
+ :host(:where([filled]:hover:not(:active))) {
143
+ box-shadow: var(--mdw-elevation__box-shadow__1);
144
+ }
145
+
146
+ :host(:where([elevated]:disabled)) {
147
+ box-shadow: var(--mdw-elevation__box-shadow__0);
148
+ }
149
+
150
+ :host(:where([filled]:disabled)) {
151
+ box-shadow: var(--mdw-elevation__box-shadow__0);
152
+ }
153
+
141
154
  /** Filled Tonal Color Defaults */
142
155
  :host(:where([filled="tonal"])) {
143
156
  --mdw-bg: var(--mdw-color__secondary-container);
@@ -164,7 +177,7 @@ export default CustomElement
164
177
  padding-inline: calc(16px + (var(--mdw-density) * 2px)) calc(24px + (var(--mdw-density) * 2px));
165
178
  }
166
179
 
167
- #shape:where([elevated],[filled],[color]) {
180
+ :host(:where([elevated],[filled],[color])) {
168
181
  background-color: rgb(var(--mdw-bg));
169
182
  }
170
183
 
@@ -192,7 +205,7 @@ export default CustomElement
192
205
  color: rgba(var(--mdw-color__on-surface), 0.38);
193
206
  }
194
207
 
195
- #shape[disabled]:is([elevated], [filled]) {
208
+ :host([disabled]:is([elevated], [filled])) {
196
209
  background-color: rgba(var(--mdw-color__on-surface), 0.12);
197
210
  color: rgba(var(--mdw-color__on-surface), 0.38);
198
211
  }
@@ -203,11 +216,6 @@ export default CustomElement
203
216
 
204
217
  #icon {
205
218
  font-size: calc(18/14 * 1em);
206
- font-variation-settings: 'FILL' 1;
207
- }
208
-
209
- #icon[outlined] {
210
- font-variation-settings: 'FILL' 0;
211
219
  }
212
220
 
213
221
  #icon[disabled] {
@@ -222,37 +230,8 @@ export default CustomElement
222
230
 
223
231
  @media (any-pointer: coarse) {
224
232
  #touch-target {
225
- visibility: visible;
233
+ visibility: inherit;
226
234
  }
227
235
  }
228
236
  `
229
- .childEvents({
230
- control: {
231
- /**
232
- * Duplicates button for form submission
233
- * @see https://github.com/WICG/webcomponents/issues/814
234
- * @param {{currentTarget:HTMLInputElement}} event
235
- * @type {any}
236
- */
237
- '~click'({ currentTarget }) {
238
- if (currentTarget.disabled) return;
239
- if (currentTarget.type !== 'submit') return;
240
- if (this.disabled) return;
241
- const { value } = currentTarget;
242
- const form = this.elementInternals?.form;
243
- if (!form) return;
244
- this.elementInternals.setFormValue(value);
245
- if ((currentTarget.type ?? 'submit') !== 'submit') return;
246
- const duplicatedButton = /** @type {HTMLInputElement} */ (currentTarget.cloneNode());
247
- duplicatedButton.hidden = true;
248
- form.append(duplicatedButton);
249
- if ('requestSubmit' in form) {
250
- form.requestSubmit(duplicatedButton);
251
- } else {
252
- duplicatedButton.click();
253
- }
254
- duplicatedButton.remove();
255
- },
256
- },
257
- })
258
237
  .autoRegister('mdw-button');
@@ -1,31 +1,32 @@
1
- import CustomElement from '../core/CustomElement.js';
2
1
  import { EVENT_HANDLER_TYPE } from '../core/customTypes.js';
3
2
  import AriaReflectorMixin from '../mixins/AriaReflectorMixin.js';
4
- import FlexableMixin from '../mixins/FlexableMixin.js';
3
+ import DelegatesFocusMixin from '../mixins/DelegatesFocusMixin.js';
4
+ import ElevationMixin from '../mixins/ElevationMixin.js';
5
5
  import FormAssociatedMixin from '../mixins/FormAssociatedMixin.js';
6
+ import HyperlinkMixin from '../mixins/HyperlinkMixin.js';
6
7
  import ShapeMixin from '../mixins/ShapeMixin.js';
7
8
  import StateMixin from '../mixins/StateMixin.js';
8
- import SurfaceMixin from '../mixins/SurfaceMixin.js';
9
- import ThemableMixin from '../mixins/ThemableMixin.js';
9
+
10
+ import Box from './Box.js';
11
+
12
+ /* https://m3.material.io/components/cards/specs */
10
13
 
11
14
  const SUPPORTS_INERT = 'inert' in HTMLElement.prototype;
12
15
 
13
- export default CustomElement
16
+ export default Box
14
17
  .extend()
15
- .mixin(ThemableMixin)
16
- .mixin(FlexableMixin)
17
- .mixin(SurfaceMixin)
18
+ .mixin(StateMixin)
19
+ .mixin(ElevationMixin)
18
20
  .mixin(ShapeMixin)
19
21
  .mixin(FormAssociatedMixin) // Tap into FormAssociated for disabledState
20
- .mixin(StateMixin)
21
22
  .mixin(AriaReflectorMixin)
22
- .setStatic({
23
- delegatesFocus: true,
24
- })
23
+ .mixin(DelegatesFocusMixin)
24
+ .mixin(HyperlinkMixin)
25
25
  .set({
26
26
  _ariaRole: 'figure',
27
27
  })
28
28
  .observe({
29
+ elevated: 'boolean',
29
30
  filled: 'boolean',
30
31
  actionable: 'boolean',
31
32
  actionLabel: 'string',
@@ -35,7 +36,8 @@ export default CustomElement
35
36
  stateTargetElement() { return this.actionable ? this.refs.action : this; },
36
37
  })
37
38
  .expressions({
38
- showBlocker: ({ disabledState }) => !SUPPORTS_INERT && disabledState,
39
+ showBlocker: ({ disabledState, disabled }) => disabledState && (!disabled || !SUPPORTS_INERT),
40
+ showButton: ({ actionable, href }) => Boolean(actionable || href),
39
41
  })
40
42
  .methods({
41
43
  focus() {
@@ -44,68 +46,62 @@ export default CustomElement
44
46
  },
45
47
  })
46
48
  .html`
47
- <mdw-button mdw-if={actionable} aria-label={actionLabel} id=action disabled={disabledState}></mdw-button>
49
+ <mdw-button mdw-if={showButton} aria-label={actionLabel} href={href}
50
+ target={target}
51
+ download={download}
52
+ ping={ping}
53
+ rel={rel}
54
+ hreflang={hreflang}
55
+ referrerpolicy={referrerPolicy} id=action disabled={disabledState}></mdw-button>
48
56
  <div mdw-if={showBlocker} id=inert-blocker></div>
49
- <slot id=slot disabled={disabledState}></slot>
50
57
  `
58
+ .recompose(({ refs: { anchor, inertBlocker, slot } }) => {
59
+ anchor.remove();
60
+ slot.setAttribute('disabled', '{disabledState}');
61
+ inertBlocker.before(slot);
62
+ })
51
63
  .css`
52
- /* https://m3.material.io/components/cards/specs */
53
-
54
64
  :host {
55
- --mdw-shape__size: 12px;
65
+ --mdw-shape__size: var(--mdw-shape__medium);
56
66
 
57
- --mdw-surface__shadow__resting: none;
58
- --mdw-surface__shadow__raised: var(--mdw-surface__shadow__resting);
59
67
  /* padding-inline: 12px; */
60
68
 
61
- --mdw-bg: var(--mdw-color__surface-container);
69
+ --mdw-bg: var(--mdw-color__surface);
62
70
  --mdw-ink: var(--mdw-color__on-surface);
63
71
  position: relative;
64
72
 
65
- display: block;
66
-
67
- color: rgb(var(--mdw-ink));
68
-
69
73
  font: var(--mdw-type__font);
70
74
  letter-spacing: var(--mdw-type__letter-spacing);
71
- }
72
75
 
73
- #shape:where([elevated],[filled],[color]) {
74
- background-color: rgb(var(--mdw-bg));
76
+ transition: filter 200ms;
77
+ will-change: filter;
75
78
  }
76
79
 
77
- :host(:where([filled])) {
78
- --mdw-bg: var(--mdw-color__surface-container-highest);
79
- --mdw-ink: var(--mdw-color__on-surface-variant);
80
+ :host(:where([elevated],[filled],[outlined])) {
81
+ background-color: rgb(var(--mdw-bg));
80
82
  }
81
83
 
82
84
  :host(:where([elevated])) {
83
85
  --mdw-bg: var(--mdw-color__surface-container-low);
84
86
  --mdw-ink: var(--mdw-color__on-surface);
87
+ filter: var(--mdw-elevation__drop-shadow__1);
85
88
  }
86
89
 
87
- :host([filled]) {
88
- --mdw-surface__shadow__resting: var(--mdw-surface__shadow__0);
90
+ :host(:where([filled])) {
91
+ --mdw-bg: var(--mdw-color__surface-container-highest);
92
+ --mdw-ink: var(--mdw-color__on-surface-variant);
89
93
  }
90
94
 
91
- :host([filled][actionable]) {
92
- --mdw-surface__shadow__raised: var(--mdw-surface__shadow__1);
95
+ :host(:where([filled][actionable])) {
96
+ filter: var(--mdw-elevation__drop-shadow__0);
93
97
  }
94
98
 
95
- :host([elevated]) {
96
- --mdw-surface__shadow__resting: var(--mdw-surface__shadow__1);
99
+ :host(:where([elevated][actionable]:hover:not(:active))) {
100
+ filter: var(--mdw-elevation__drop-shadow__2);
97
101
  }
98
102
 
99
- :host([elevated][actionable]) {
100
- --mdw-surface__shadow__raised: var(--mdw-surface__shadow__2);
101
- }
102
-
103
- #shape[disabled] {
104
-
105
- /* Works on images */
106
- filter: grayscale();
107
-
108
- color: rgb(var(--mdw-color__on-surface));
103
+ :host(:where([filled][actionable]:hover:not(:active))) {
104
+ filter: var(--mdw-elevation__drop-shadow__1);
109
105
  }
110
106
 
111
107
  :host([disabled]) {
@@ -113,6 +109,8 @@ export default CustomElement
113
109
 
114
110
  filter: grayscale();
115
111
  opacity: 0.38;
112
+
113
+ color: rgb(var(--mdw-color__on-surface));
116
114
  }
117
115
 
118
116
  #slot[disabled] {
@@ -135,10 +133,14 @@ export default CustomElement
135
133
  z-index: 99;
136
134
  }
137
135
 
138
- #shape[disabled][elevated] {
136
+ :host([disabled][elevated]) {
139
137
  background-color: rgba(var(--mdw-color__surface-container-highest));
140
138
  }
141
139
 
140
+ :host([disabled][filled]) {
141
+ background-color: rgba(var(--mdw-color__surface));
142
+ }
143
+
142
144
  #action {
143
145
  --mdw-ink: inherit;
144
146
  --mdw-shape__size: inherit;
@@ -153,19 +155,12 @@ export default CustomElement
153
155
  color: inherit
154
156
  }
155
157
  `
156
- .on({
157
- composed() {
158
- const { slot, surface, shape, outline } = this.refs;
159
- surface.append(shape);
160
- outline.removeAttribute('pressed');
161
- outline.removeAttribute('focused');
162
-
163
- shape.setAttribute('filled', '{filled}');
164
- slot.setAttribute('inert', '{disabledState}');
165
- slot.setAttribute('disabled', '{disabledState}');
166
- // shape.setAttribute('disabled', '{disabledState}');
167
- // shape.setAttribute('filled', '{filled}');
168
- },
158
+ .recompose(({ refs: { slot, outline } }) => {
159
+ outline.removeAttribute('pressed');
160
+ outline.removeAttribute('focused');
161
+
162
+ slot.setAttribute('inert', '{disabledState}');
163
+ slot.setAttribute('disabled', '{disabledState}');
169
164
  })
170
165
  .childEvents({
171
166
  action: {
@@ -21,43 +21,25 @@ export default CustomElement
21
21
  .observe({
22
22
  icon: { value: 'check' },
23
23
  indeterminateIcon: { value: 'check_indeterminate_small' },
24
- /** Reflected property */
25
- indeterminate: 'boolean',
26
24
  })
27
- .observe({
28
- _ariaChecked({ indeterminate, checked }) {
29
- return (indeterminate ? 'mixed' : `${!!checked}`);
30
- },
25
+ .expressions({
31
26
  _determinateIcon({ indeterminate, indeterminateIcon, icon }) {
32
27
  return (indeterminate ? indeterminateIcon : icon);
33
28
  },
29
+ _iconSelectedState({ checked, indeterminate }) {
30
+ return checked || indeterminate;
31
+ },
34
32
  })
35
33
  .html`
36
34
  <div id=checkbox errored={erroredState} selected={checked}>
37
35
  <mdw-checkbox-icon id=icon errored={erroredState} disabled={disabledState}
38
- icon={_determinateIcon} selected={checked}>
36
+ icon={_determinateIcon} selected={_iconSelectedState}>
39
37
  </mdw-checkbox-icon>
40
38
  </div>
41
39
  <slot id=slot></slot>
42
40
  `
43
- .rootEvents({
44
- click(event) {
45
- const { control } = this.refs;
46
- if (event.target !== control) {
47
- // Label-like click
48
- event.stopPropagation();
49
- control.click();
50
- }
51
- },
52
- })
53
- .on({
54
- composed() {
55
- const { control, checkbox, state, rippleContainer } = this.refs;
56
- checkbox.append(state, rippleContainer);
57
-
58
- // Indeterminate must be manually expressed for ARIA
59
- control.setAttribute('aria-checked', '{_ariaChecked}');
60
- },
41
+ .recompose(({ refs: { checkbox, state, rippleContainer } }) => {
42
+ checkbox.append(state, rippleContainer);
61
43
  })
62
44
  .css`
63
45
  /* https://m3.material.io/components/checkbox/specs */
@@ -42,16 +42,6 @@ export default CustomElement
42
42
  line-height: 18px;
43
43
  }
44
44
 
45
- #shape {
46
- --mdw-shape__size: inherit;
47
- position: absolute;
48
- inset: 0;
49
-
50
- z-index: auto;
51
-
52
- background-color: transparent;
53
- }
54
-
55
45
  #icon {
56
46
  position: absolute;
57
47
  inset: 0;
@@ -59,6 +49,7 @@ export default CustomElement
59
49
  opacity: 0;
60
50
 
61
51
  background-color: rgb(var(--mdw-bg));
52
+ border-radius: inherit;
62
53
  color: rgb(var(--mdw-ink));
63
54
 
64
55
  transition-duration: 200ms;
@@ -67,11 +58,7 @@ export default CustomElement
67
58
  }
68
59
 
69
60
  #outline {
70
- filter:
71
- drop-shadow(1px 0px 0px currentColor)
72
- drop-shadow(0px 1px 0px currentColor)
73
- drop-shadow(-1px 0px 0px currentColor)
74
- drop-shadow(0px -1px 0px currentColor);
61
+ border-width: 2px;
75
62
 
76
63
  color: rgb(var(--mdw-color__on-surface));
77
64
 
@@ -112,18 +99,13 @@ export default CustomElement
112
99
  color: rgb(var(--mdw-color__on-surface), var(--disabled-opacity));
113
100
  }
114
101
  `
115
- .on({
116
- composed({ html }) {
117
- const { outline, shape } = this.refs;
118
- outline.removeAttribute('mdw-if');
119
- outline.setAttribute('selected', '{selected}');
120
- outline.setAttribute('errored', '{errored}');
121
- outline.setAttribute('disabled', '{disabled}');
122
- // outlineLeft.remove();
123
- // outlineRight.remove();
124
- shape.append(html`
125
- <mdw-icon id=icon selected={selected} errored={errored} disabled={disabled}>{icon}</mdw-icon>
126
- `);
127
- },
102
+ .html`
103
+ <mdw-icon id=icon selected={selected} errored={errored} disabled={disabled} icon={icon}></mdw-icon>
104
+ `
105
+ .recompose(({ refs: { outline } }) => {
106
+ outline.removeAttribute('mdw-if');
107
+ outline.setAttribute('selected', '{selected}');
108
+ outline.setAttribute('errored', '{errored}');
109
+ outline.setAttribute('disabled', '{disabled}');
128
110
  })
129
111
  .autoRegister('mdw-checkbox-icon');
@@ -5,6 +5,11 @@ export default Button
5
5
  .observe({
6
6
  suggestion: 'boolean',
7
7
  })
8
+ .expressions({
9
+ iconVariation({ elevated }) {
10
+ return elevated ? 'filled' : null;
11
+ },
12
+ })
8
13
  .css`
9
14
  /* https://m3.material.io/components/chips/specs */
10
15
 
@@ -43,16 +48,13 @@ export default Button
43
48
  }
44
49
 
45
50
  `
46
- .on({
47
- composed({ inline }) {
48
- const { slot, outline, icon } = this.refs;
49
- slot.setAttribute('disabled', '{disabledState}');
50
- slot.removeAttribute('ink');
51
- slot.removeAttribute('color');
52
- outline.setAttribute('mdw-if', '{!elevated}');
53
- outline.setAttribute('ink', '{ink}');
54
- outline.setAttribute('color', '{color}');
55
- icon.setAttribute('ink', inline(({ ink, iconInk }) => iconInk ?? ink ?? 'primary'));
56
- },
51
+ .recompose(({ inline, refs: { slot, outline, icon } }) => {
52
+ slot.setAttribute('disabled', '{disabledState}');
53
+ slot.removeAttribute('ink');
54
+ slot.removeAttribute('color');
55
+ outline.setAttribute('mdw-if', '{!elevated}');
56
+ outline.setAttribute('ink', '{ink}');
57
+ outline.setAttribute('color', '{color}');
58
+ icon.setAttribute('ink', inline(({ ink, iconInk }) => iconInk ?? ink ?? 'primary'));
57
59
  })
58
60
  .autoRegister('mdw-chip');