@shortfuse/materialdesignweb 0.8.0 → 0.9.1

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 (405) hide show
  1. package/README.md +50 -198
  2. package/bin/mdw-css.js +1 -1
  3. package/components/Badge.js +15 -5
  4. package/components/Body.js +7 -0
  5. package/components/BottomAppBar.js +7 -10
  6. package/components/BottomSheet.js +472 -0
  7. package/components/Box.js +11 -49
  8. package/components/Button.js +81 -82
  9. package/components/Card.js +74 -62
  10. package/components/Checkbox.js +15 -25
  11. package/components/CheckboxIcon.js +19 -31
  12. package/components/Chip.js +18 -13
  13. package/components/Dialog.js +70 -100
  14. package/components/DialogActions.js +4 -0
  15. package/components/Display.js +64 -0
  16. package/components/Divider.js +5 -0
  17. package/components/Fab.js +94 -17
  18. package/components/FabContainer.js +57 -0
  19. package/components/FilterChip.js +43 -32
  20. package/components/Grid.js +187 -0
  21. package/components/Headline.js +9 -28
  22. package/components/Icon.js +80 -71
  23. package/components/IconButton.js +77 -120
  24. package/components/Input.js +745 -86
  25. package/components/InputChip.js +193 -0
  26. package/components/Label.js +7 -0
  27. package/components/List.js +11 -5
  28. package/components/ListItem.js +92 -23
  29. package/components/ListOption.js +143 -65
  30. package/components/Listbox.js +57 -17
  31. package/components/Menu.js +39 -27
  32. package/components/MenuItem.js +49 -36
  33. package/components/NavBar.js +66 -21
  34. package/components/NavBarItem.js +5 -0
  35. package/components/NavDrawer.js +33 -16
  36. package/components/NavDrawerItem.js +7 -4
  37. package/components/NavItem.js +61 -34
  38. package/components/NavRail.js +32 -21
  39. package/components/NavRailItem.js +10 -2
  40. package/components/Page.js +119 -0
  41. package/components/Pane.js +24 -0
  42. package/components/Popup.js +23 -8
  43. package/components/Progress.js +25 -5
  44. package/components/Radio.js +8 -7
  45. package/components/RadioIcon.js +24 -15
  46. package/components/Ripple.js +25 -7
  47. package/components/Root.js +225 -0
  48. package/components/Scrim.js +95 -0
  49. package/components/Search.js +30 -25
  50. package/components/SegmentedButton.js +53 -40
  51. package/components/SegmentedButtonGroup.js +15 -12
  52. package/components/Select.js +19 -10
  53. package/components/Shape.js +10 -66
  54. package/components/SideSheet.js +337 -0
  55. package/components/Slider.js +93 -36
  56. package/components/Snackbar.js +52 -20
  57. package/components/SnackbarContainer.js +51 -0
  58. package/components/Surface.js +20 -10
  59. package/components/Switch.js +21 -18
  60. package/components/SwitchIcon.js +62 -33
  61. package/components/Tab.js +78 -38
  62. package/components/TabContent.js +33 -12
  63. package/components/TabList.js +95 -34
  64. package/components/TabPanel.js +10 -1
  65. package/components/Table.js +151 -0
  66. package/components/TextArea.js +48 -16
  67. package/components/Title.js +8 -9
  68. package/components/Tooltip.js +51 -22
  69. package/components/TopAppBar.js +71 -78
  70. package/constants/shapes.js +36 -0
  71. package/constants/typography.js +127 -0
  72. package/core/Composition.js +391 -201
  73. package/core/CompositionAdapter.js +35 -18
  74. package/core/CustomElement.js +634 -254
  75. package/core/css.js +117 -12
  76. package/core/customTypes.js +161 -49
  77. package/core/dom.js +18 -11
  78. package/core/jsonMergePatch.js +27 -11
  79. package/core/observe.js +308 -256
  80. package/core/optimizations.js +9 -9
  81. package/core/template.js +14 -57
  82. package/dist/CustomElement.min.js +2 -0
  83. package/dist/CustomElement.min.js.map +7 -0
  84. package/dist/core/CustomElement.min.js +2 -0
  85. package/dist/core/CustomElement.min.js.map +7 -0
  86. package/dist/index.min.js +85 -115
  87. package/dist/index.min.js.map +4 -4
  88. package/dist/meta.json +1 -1
  89. package/dom/HTMLOptionsCollectionProxy.js +108 -0
  90. package/{theming/themableMixinLoader.js → loaders/palette.js} +4 -3
  91. package/loaders/theme.js +12 -0
  92. package/mixins/AriaReflectorMixin.js +64 -15
  93. package/mixins/AriaToolbarMixin.js +6 -0
  94. package/mixins/ControlMixin.js +79 -33
  95. package/mixins/DelegatesFocusMixin.js +62 -0
  96. package/mixins/DensityMixin.js +7 -3
  97. package/mixins/ElevationMixin.js +61 -0
  98. package/mixins/FlexableMixin.js +87 -39
  99. package/mixins/FormAssociatedMixin.js +76 -10
  100. package/mixins/HyperlinkMixin.js +76 -0
  101. package/mixins/InputMixin.js +227 -32
  102. package/mixins/KeyboardNavMixin.js +11 -7
  103. package/mixins/NavigationListenerMixin.js +33 -0
  104. package/mixins/PopupMixin.js +216 -219
  105. package/mixins/RTLObserverMixin.js +2 -0
  106. package/mixins/ResizeObserverMixin.js +18 -4
  107. package/mixins/RippleMixin.js +11 -7
  108. package/mixins/ScrollListenerMixin.js +14 -2
  109. package/mixins/SemiStickyMixin.js +51 -98
  110. package/mixins/ShapeMaskedMixin.js +125 -0
  111. package/mixins/ShapeMixin.js +30 -203
  112. package/mixins/StateMixin.js +74 -34
  113. package/mixins/TextFieldMixin.js +128 -145
  114. package/mixins/ThemableMixin.js +57 -56
  115. package/mixins/TooltipTriggerMixin.js +305 -359
  116. package/mixins/TouchTargetMixin.js +5 -2
  117. package/mixins/TypographyMixin.js +128 -0
  118. package/package.json +125 -81
  119. package/services/rtl.js +10 -0
  120. package/services/svgAlias.js +17 -0
  121. package/{theming/index.js → services/theme.js} +25 -176
  122. package/types/bin/mdw-css.d.ts +3 -0
  123. package/types/bin/mdw-css.d.ts.map +1 -0
  124. package/types/components/Badge.d.ts +39 -0
  125. package/types/components/Badge.d.ts.map +1 -0
  126. package/types/components/Body.d.ts +29 -0
  127. package/types/components/Body.d.ts.map +1 -0
  128. package/types/components/BottomAppBar.d.ts +72 -0
  129. package/types/components/BottomAppBar.d.ts.map +1 -0
  130. package/types/components/BottomSheet.d.ts +135 -0
  131. package/types/components/BottomSheet.d.ts.map +1 -0
  132. package/types/components/Box.d.ts +16 -0
  133. package/types/components/Box.d.ts.map +1 -0
  134. package/types/components/Button.d.ts +245 -0
  135. package/types/components/Button.d.ts.map +1 -0
  136. package/types/components/Card.d.ts +147 -0
  137. package/types/components/Card.d.ts.map +1 -0
  138. package/types/components/Checkbox.d.ts +207 -0
  139. package/types/components/Checkbox.d.ts.map +1 -0
  140. package/types/components/CheckboxIcon.d.ts +44 -0
  141. package/types/components/CheckboxIcon.d.ts.map +1 -0
  142. package/types/components/Chip.d.ts +248 -0
  143. package/types/components/Chip.d.ts.map +1 -0
  144. package/types/components/Dialog.d.ts +103 -0
  145. package/types/components/Dialog.d.ts.map +1 -0
  146. package/types/components/DialogActions.d.ts +4 -0
  147. package/types/components/DialogActions.d.ts.map +1 -0
  148. package/types/components/Display.d.ts +46 -0
  149. package/types/components/Display.d.ts.map +1 -0
  150. package/types/components/Divider.d.ts +10 -0
  151. package/types/components/Divider.d.ts.map +1 -0
  152. package/types/components/Fab.d.ts +273 -0
  153. package/types/components/Fab.d.ts.map +1 -0
  154. package/types/components/FabContainer.d.ts +10 -0
  155. package/types/components/FabContainer.d.ts.map +1 -0
  156. package/types/components/FilterChip.d.ts +256 -0
  157. package/types/components/FilterChip.d.ts.map +1 -0
  158. package/types/components/Grid.d.ts +38 -0
  159. package/types/components/Grid.d.ts.map +1 -0
  160. package/types/components/Headline.d.ts +46 -0
  161. package/types/components/Headline.d.ts.map +1 -0
  162. package/types/components/Icon.d.ts +55 -0
  163. package/types/components/Icon.d.ts.map +1 -0
  164. package/types/components/IconButton.d.ts +284 -0
  165. package/types/components/IconButton.d.ts.map +1 -0
  166. package/types/components/Input.d.ts +2528 -0
  167. package/types/components/Input.d.ts.map +1 -0
  168. package/types/components/InputChip.d.ts +85 -0
  169. package/types/components/InputChip.d.ts.map +1 -0
  170. package/types/components/Label.d.ts +29 -0
  171. package/types/components/Label.d.ts.map +1 -0
  172. package/types/components/List.d.ts +35 -0
  173. package/types/components/List.d.ts.map +1 -0
  174. package/types/components/ListItem.d.ts +124 -0
  175. package/types/components/ListItem.d.ts.map +1 -0
  176. package/types/components/ListOption.d.ts +158 -0
  177. package/types/components/ListOption.d.ts.map +1 -0
  178. package/types/components/Listbox.d.ts +763 -0
  179. package/types/components/Listbox.d.ts.map +1 -0
  180. package/types/components/Menu.d.ts +130 -0
  181. package/types/components/Menu.d.ts.map +1 -0
  182. package/types/components/MenuItem.d.ts +232 -0
  183. package/types/components/MenuItem.d.ts.map +1 -0
  184. package/types/components/NavBar.d.ts +20 -0
  185. package/types/components/NavBar.d.ts.map +1 -0
  186. package/types/components/NavBarItem.d.ts +97 -0
  187. package/types/components/NavBarItem.d.ts.map +1 -0
  188. package/types/components/NavDrawer.d.ts +107 -0
  189. package/types/components/NavDrawer.d.ts.map +1 -0
  190. package/types/components/NavDrawerItem.d.ts +97 -0
  191. package/types/components/NavDrawerItem.d.ts.map +1 -0
  192. package/types/components/NavItem.d.ts +99 -0
  193. package/types/components/NavItem.d.ts.map +1 -0
  194. package/types/components/NavRail.d.ts +108 -0
  195. package/types/components/NavRail.d.ts.map +1 -0
  196. package/types/components/NavRailItem.d.ts +97 -0
  197. package/types/components/NavRailItem.d.ts.map +1 -0
  198. package/types/components/Page.d.ts +25 -0
  199. package/types/components/Page.d.ts.map +1 -0
  200. package/types/components/Pane.d.ts +44 -0
  201. package/types/components/Pane.d.ts.map +1 -0
  202. package/types/components/Popup.d.ts +78 -0
  203. package/types/components/Popup.d.ts.map +1 -0
  204. package/types/components/Progress.d.ts +21 -0
  205. package/types/components/Progress.d.ts.map +1 -0
  206. package/types/components/Radio.d.ts +201 -0
  207. package/types/components/Radio.d.ts.map +1 -0
  208. package/types/components/RadioIcon.d.ts +46 -0
  209. package/types/components/RadioIcon.d.ts.map +1 -0
  210. package/types/components/Ripple.d.ts +35 -0
  211. package/types/components/Ripple.d.ts.map +1 -0
  212. package/types/components/Root.d.ts +68 -0
  213. package/types/components/Root.d.ts.map +1 -0
  214. package/types/components/Scrim.d.ts +6 -0
  215. package/types/components/Scrim.d.ts.map +1 -0
  216. package/types/components/Search.d.ts +516 -0
  217. package/types/components/Search.d.ts.map +1 -0
  218. package/types/components/SegmentedButton.d.ts +252 -0
  219. package/types/components/SegmentedButton.d.ts.map +1 -0
  220. package/types/components/SegmentedButtonGroup.d.ts +43 -0
  221. package/types/components/SegmentedButtonGroup.d.ts.map +1 -0
  222. package/types/components/Select.d.ts +158 -0
  223. package/types/components/Select.d.ts.map +1 -0
  224. package/types/components/Shape.d.ts +10 -0
  225. package/types/components/Shape.d.ts.map +1 -0
  226. package/types/components/SideSheet.d.ts +111 -0
  227. package/types/components/SideSheet.d.ts.map +1 -0
  228. package/types/components/Slider.d.ts +203 -0
  229. package/types/components/Slider.d.ts.map +1 -0
  230. package/types/components/Snackbar.d.ts +73 -0
  231. package/types/components/Snackbar.d.ts.map +1 -0
  232. package/types/components/SnackbarContainer.d.ts +6 -0
  233. package/types/components/SnackbarContainer.d.ts.map +1 -0
  234. package/types/components/Surface.d.ts +45 -0
  235. package/types/components/Surface.d.ts.map +1 -0
  236. package/types/components/Switch.d.ts +187 -0
  237. package/types/components/Switch.d.ts.map +1 -0
  238. package/types/components/SwitchIcon.d.ts +61 -0
  239. package/types/components/SwitchIcon.d.ts.map +1 -0
  240. package/types/components/Tab.d.ts +139 -0
  241. package/types/components/Tab.d.ts.map +1 -0
  242. package/types/components/TabContent.d.ts +124 -0
  243. package/types/components/TabContent.d.ts.map +1 -0
  244. package/types/components/TabList.d.ts +1111 -0
  245. package/types/components/TabList.d.ts.map +1 -0
  246. package/types/components/TabPanel.d.ts +28 -0
  247. package/types/components/TabPanel.d.ts.map +1 -0
  248. package/types/components/Table.d.ts +25 -0
  249. package/types/components/Table.d.ts.map +1 -0
  250. package/types/components/TextArea.d.ts +201 -0
  251. package/types/components/TextArea.d.ts.map +1 -0
  252. package/types/components/Title.d.ts +46 -0
  253. package/types/components/Title.d.ts.map +1 -0
  254. package/types/components/Tooltip.d.ts +49 -0
  255. package/types/components/Tooltip.d.ts.map +1 -0
  256. package/types/components/TopAppBar.d.ts +129 -0
  257. package/types/components/TopAppBar.d.ts.map +1 -0
  258. package/types/constants/colorKeywords.d.ts +2 -0
  259. package/types/constants/colorKeywords.d.ts.map +1 -0
  260. package/types/constants/shapes.d.ts +38 -0
  261. package/types/constants/shapes.d.ts.map +1 -0
  262. package/types/constants/typography.d.ts +212 -0
  263. package/types/constants/typography.d.ts.map +1 -0
  264. package/types/core/Composition.d.ts +260 -0
  265. package/types/core/Composition.d.ts.map +1 -0
  266. package/types/core/CompositionAdapter.d.ts +114 -0
  267. package/types/core/CompositionAdapter.d.ts.map +1 -0
  268. package/types/core/CustomElement.d.ts +304 -0
  269. package/types/core/CustomElement.d.ts.map +1 -0
  270. package/types/core/css.d.ts +44 -0
  271. package/types/core/css.d.ts.map +1 -0
  272. package/types/core/customTypes.d.ts +22 -0
  273. package/types/core/customTypes.d.ts.map +1 -0
  274. package/types/core/dom.d.ts +32 -0
  275. package/types/core/dom.d.ts.map +1 -0
  276. package/types/core/jsonMergePatch.d.ts +31 -0
  277. package/types/core/jsonMergePatch.d.ts.map +1 -0
  278. package/types/core/observe.d.ts +114 -0
  279. package/types/core/observe.d.ts.map +1 -0
  280. package/types/core/optimizations.d.ts +7 -0
  281. package/types/core/optimizations.d.ts.map +1 -0
  282. package/types/core/template.d.ts +47 -0
  283. package/types/core/template.d.ts.map +1 -0
  284. package/types/core/uid.d.ts +6 -0
  285. package/types/core/uid.d.ts.map +1 -0
  286. package/types/dom/HTMLOptionsCollectionProxy.d.ts +18 -0
  287. package/types/dom/HTMLOptionsCollectionProxy.d.ts.map +1 -0
  288. package/types/index.d.ts +88 -0
  289. package/types/index.d.ts.map +1 -0
  290. package/types/loaders/palette.d.ts +2 -0
  291. package/types/loaders/palette.d.ts.map +1 -0
  292. package/types/loaders/theme.d.ts +2 -0
  293. package/types/loaders/theme.d.ts.map +1 -0
  294. package/types/mixins/AriaReflectorMixin.d.ts +31 -0
  295. package/types/mixins/AriaReflectorMixin.d.ts.map +1 -0
  296. package/types/mixins/AriaToolbarMixin.d.ts +34 -0
  297. package/types/mixins/AriaToolbarMixin.d.ts.map +1 -0
  298. package/types/mixins/ControlMixin.d.ts +124 -0
  299. package/types/mixins/ControlMixin.d.ts.map +1 -0
  300. package/types/mixins/DelegatesFocusMixin.d.ts +13 -0
  301. package/types/mixins/DelegatesFocusMixin.d.ts.map +1 -0
  302. package/types/mixins/DensityMixin.d.ts +8 -0
  303. package/types/mixins/DensityMixin.d.ts.map +1 -0
  304. package/types/mixins/ElevationMixin.d.ts +32 -0
  305. package/types/mixins/ElevationMixin.d.ts.map +1 -0
  306. package/types/mixins/FlexableMixin.d.ts +14 -0
  307. package/types/mixins/FlexableMixin.d.ts.map +1 -0
  308. package/types/mixins/FormAssociatedMixin.d.ts +123 -0
  309. package/types/mixins/FormAssociatedMixin.d.ts.map +1 -0
  310. package/types/mixins/HyperlinkMixin.d.ts +25 -0
  311. package/types/mixins/HyperlinkMixin.d.ts.map +1 -0
  312. package/types/mixins/InputMixin.d.ts +173 -0
  313. package/types/mixins/InputMixin.d.ts.map +1 -0
  314. package/types/mixins/KeyboardNavMixin.d.ts +46 -0
  315. package/types/mixins/KeyboardNavMixin.d.ts.map +1 -0
  316. package/types/mixins/NavigationListenerMixin.d.ts +8 -0
  317. package/types/mixins/NavigationListenerMixin.d.ts.map +1 -0
  318. package/types/mixins/PopupMixin.d.ts +98 -0
  319. package/types/mixins/PopupMixin.d.ts.map +1 -0
  320. package/types/mixins/RTLObserverMixin.d.ts +8 -0
  321. package/types/mixins/RTLObserverMixin.d.ts.map +1 -0
  322. package/types/mixins/ResizeObserverMixin.d.ts +13 -0
  323. package/types/mixins/ResizeObserverMixin.d.ts.map +1 -0
  324. package/types/mixins/RippleMixin.d.ts +94 -0
  325. package/types/mixins/RippleMixin.d.ts.map +1 -0
  326. package/types/mixins/ScrollListenerMixin.d.ts +46 -0
  327. package/types/mixins/ScrollListenerMixin.d.ts.map +1 -0
  328. package/types/mixins/SemiStickyMixin.d.ts +50 -0
  329. package/types/mixins/SemiStickyMixin.d.ts.map +1 -0
  330. package/types/mixins/ShapeMaskedMixin.d.ts +12 -0
  331. package/types/mixins/ShapeMaskedMixin.d.ts.map +1 -0
  332. package/types/mixins/ShapeMixin.d.ts +39 -0
  333. package/types/mixins/ShapeMixin.d.ts.map +1 -0
  334. package/types/mixins/StateMixin.d.ts +29 -0
  335. package/types/mixins/StateMixin.d.ts.map +1 -0
  336. package/types/mixins/TextFieldMixin.d.ts +153 -0
  337. package/types/mixins/TextFieldMixin.d.ts.map +1 -0
  338. package/types/mixins/ThemableMixin.d.ts +10 -0
  339. package/types/mixins/ThemableMixin.d.ts.map +1 -0
  340. package/types/mixins/TooltipTriggerMixin.d.ts +114 -0
  341. package/types/mixins/TooltipTriggerMixin.d.ts.map +1 -0
  342. package/types/mixins/TouchTargetMixin.d.ts +6 -0
  343. package/types/mixins/TouchTargetMixin.d.ts.map +1 -0
  344. package/types/mixins/TypographyMixin.d.ts +20 -0
  345. package/types/mixins/TypographyMixin.d.ts.map +1 -0
  346. package/types/services/rtl.d.ts +3 -0
  347. package/types/services/rtl.d.ts.map +1 -0
  348. package/types/services/svgAlias.d.ts +13 -0
  349. package/types/services/svgAlias.d.ts.map +1 -0
  350. package/types/services/theme.d.ts +45 -0
  351. package/types/services/theme.d.ts.map +1 -0
  352. package/types/utils/cli.d.ts +3 -0
  353. package/types/utils/cli.d.ts.map +1 -0
  354. package/types/utils/function.d.ts +3 -0
  355. package/types/utils/function.d.ts.map +1 -0
  356. package/types/utils/jsx-runtime.d.ts +20 -0
  357. package/types/utils/jsx-runtime.d.ts.map +1 -0
  358. package/types/utils/material-color/blend.d.ts +34 -0
  359. package/types/utils/material-color/blend.d.ts.map +1 -0
  360. package/types/utils/material-color/hct/Cam16.d.ts +142 -0
  361. package/types/utils/material-color/hct/Cam16.d.ts.map +1 -0
  362. package/types/utils/material-color/hct/Hct.d.ts +93 -0
  363. package/types/utils/material-color/hct/Hct.d.ts.map +1 -0
  364. package/types/utils/material-color/hct/ViewingConditions.d.ts +69 -0
  365. package/types/utils/material-color/hct/ViewingConditions.d.ts.map +1 -0
  366. package/types/utils/material-color/hct/hctSolver.d.ts +30 -0
  367. package/types/utils/material-color/hct/hctSolver.d.ts.map +1 -0
  368. package/types/utils/material-color/helper.d.ts +8 -0
  369. package/types/utils/material-color/helper.d.ts.map +1 -0
  370. package/types/utils/material-color/palettes/CorePalette.d.ts +75 -0
  371. package/types/utils/material-color/palettes/CorePalette.d.ts.map +1 -0
  372. package/types/utils/material-color/palettes/TonalPalette.d.ts +38 -0
  373. package/types/utils/material-color/palettes/TonalPalette.d.ts.map +1 -0
  374. package/types/utils/material-color/scheme/Scheme.d.ts +264 -0
  375. package/types/utils/material-color/scheme/Scheme.d.ts.map +1 -0
  376. package/types/utils/material-color/utils/color.d.ts +172 -0
  377. package/types/utils/material-color/utils/color.d.ts.map +1 -0
  378. package/types/utils/material-color/utils/math.d.ts +94 -0
  379. package/types/utils/material-color/utils/math.d.ts.map +1 -0
  380. package/types/utils/pixelmatch.d.ts +22 -0
  381. package/types/utils/pixelmatch.d.ts.map +1 -0
  382. package/types/utils/popup.d.ts +106 -0
  383. package/types/utils/popup.d.ts.map +1 -0
  384. package/types/utils/searchParams.d.ts +3 -0
  385. package/types/utils/searchParams.d.ts.map +1 -0
  386. package/types/utils/svg.d.ts +7 -0
  387. package/types/utils/svg.d.ts.map +1 -0
  388. package/utils/jsx-runtime.js +9 -4
  389. package/utils/material-color/scheme/Scheme.js +1 -1
  390. package/utils/pixelmatch.js +363 -0
  391. package/utils/popup.js +86 -10
  392. package/utils/searchParams.js +22 -0
  393. package/components/Button.md +0 -61
  394. package/components/ExtendedFab.js +0 -32
  395. package/components/Layout.js +0 -504
  396. package/components/Nav.js +0 -38
  397. package/core/DomAdapter.js +0 -586
  398. package/core/ICustomElement.d.ts +0 -291
  399. package/core/ICustomElement.js +0 -1
  400. package/core/test.js +0 -126
  401. package/core/typings.d.ts +0 -142
  402. package/core/typings.js +0 -1
  403. package/mixins/SurfaceMixin.js +0 -127
  404. package/theming/loader.js +0 -22
  405. /package/{utils/color_keywords.js → constants/colorKeywords.js} +0 -0
@@ -1,52 +1,89 @@
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
+
14
+ /**
15
+ * Buttons prompt most actions in a UI.
16
+ * @see https://m3.material.io/components/buttons/specs
17
+ */
11
18
  export default CustomElement
12
19
  .extend()
13
20
  .mixin(ThemableMixin)
14
21
  .mixin(DensityMixin)
15
- .mixin(SurfaceMixin)
16
- .mixin(ShapeMixin)
17
22
  .mixin(StateMixin)
23
+ .mixin(ElevationMixin)
24
+ .mixin(ShapeMixin)
18
25
  .mixin(RippleMixin)
19
26
  .mixin(InputMixin)
27
+ .mixin(HyperlinkMixin)
20
28
  .define({
29
+ /**
30
+ * Returns the element used as the state target for visual states
31
+ * (e.g., pressed/hover). Typically the internal control element.
32
+ * @return {HTMLElement}
33
+ */
21
34
  stateTargetElement() { return this.refs.control; },
22
35
  })
23
36
  .set({
24
37
  stateLayer: true,
25
- delegatesFocus: true,
38
+ _allowedTypes: ['button', 'submit', 'reset', 'file'],
26
39
  })
27
40
  .observe({
28
- type: { empty: 'button' },
41
+ /** The underlying control `type` (button, submit, reset, file). */
42
+ type: {
43
+ empty: 'button',
44
+ /**
45
+ * @param {string} value
46
+ * @param {*} internalSet
47
+ */
48
+ set(value, internalSet) {
49
+ const enumeratedValue = value?.toLowerCase() ?? 'button';
50
+ internalSet(
51
+ this._allowedTypes.includes(enumeratedValue)
52
+ ? enumeratedValue
53
+ : 'button',
54
+ );
55
+ },
56
+ },
57
+ /** Bound to [elevated] specifying whether the element should be elevated. */
29
58
  elevated: 'boolean',
59
+ /** Visual filled variant; may be "tonal" or boolean-filled token. */
30
60
  filled: 'string',
31
- href: 'string',
61
+ /** Whether the button should render an outline. */
32
62
  outlined: 'boolean',
63
+ /** Icon name (uses internal `mdw-icon` when set). */
33
64
  icon: 'string',
65
+ /** Ink color override for the icon. */
34
66
  iconInk: 'string',
67
+ // Overrides to string instead of DOMString
68
+ /** Image source URL for an icon. */
35
69
  src: 'string',
70
+ /** Inline SVG markup to render as icon. */
36
71
  svg: 'string',
72
+ /** SVG `viewBox` attribute for inline SVG icons. */
37
73
  viewBox: 'string',
74
+ /** Path data for an inline SVG icon. */
38
75
  svgPath: 'string',
39
- _slotInnerText: 'string',
40
76
  })
41
77
  .expressions({
42
- hasIcon({ icon, svg, src, svgPath }) {
78
+ hasIcon({ icon, svg, src, svgPath } = this) {
43
79
  return icon ?? svg ?? src ?? svgPath;
44
80
  },
45
- computedAriaLabel({ ariaLabel, _slotInnerText }) {
46
- return ariaLabel?.trim() || _slotInnerText?.trim() || null;
81
+ iconVariation({ outlined } = this) {
82
+ return outlined ? null : 'filled';
47
83
  },
48
84
  })
49
85
  .methods({
86
+ /** @type {HTMLElement['focus']} */
50
87
  focus(...options) {
51
88
  if (this.href) {
52
89
  this.refs.anchor.focus(...options);
@@ -56,39 +93,19 @@ export default CustomElement
56
93
  },
57
94
  })
58
95
  .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>
96
+ <mdw-icon mdw-if={hasIcon} id=icon ink={iconInk} disabled={disabledState}
97
+ outlined={outlined} variation={iconVariation} aria-hidden=true svg={svg} src={src}
98
+ svg-path={svgPath} view-box={viewBox} icon={icon}></mdw-icon>
99
+ <slot id=slot disabled={disabledState} aria-hidden=true>{_defaultValue}</slot>
62
100
  `
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
- },
101
+ .recompose(({ refs: { anchor, control } }) => {
102
+ control.setAttribute('mdw-if', '{!href}');
103
+ control.setAttribute('role', 'button');
104
+ anchor.setAttribute('mdw-if', '{href}');
105
+ anchor.setAttribute('aria-label', '{_computedAriaLabel}');
106
+ anchor.setAttribute('aria-labelledby', '{_computedAriaLabelledby}');
88
107
  })
89
108
  .css`
90
- /* https://m3.material.io/components/buttons/specs */
91
-
92
109
  :host {
93
110
  --mdw-shape__size: var(--mdw-shape__full);
94
111
  --mdw-ink: var(--mdw-color__primary);
@@ -121,23 +138,39 @@ export default CustomElement
121
138
  }
122
139
 
123
140
  :host(:where([elevated],[filled])) {
124
- will-change: filter;
141
+ transition: box-shadow 200ms;
142
+ will-change: box-shadow;
125
143
  }
126
144
 
127
145
  /** Elevated Color Defaults */
128
146
  :host(:where([elevated])) {
129
147
  --mdw-bg: var(--mdw-color__surface-container-low);
130
148
  --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);
149
+ box-shadow: var(--mdw-elevation__box-shadow__1);
133
150
  }
134
151
  /** Filled Color Defaults */
135
152
  :host(:where([filled])) {
136
153
  --mdw-bg: var(--mdw-color__primary);
137
154
  --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);
155
+ box-shadow: var(--mdw-elevation__box-shadow__0);
156
+ }
157
+
158
+ :host(:where([elevated]:hover:not(:active))) {
159
+ box-shadow: var(--mdw-elevation__box-shadow__2);
140
160
  }
161
+
162
+ :host(:where([filled]:hover:not(:active))) {
163
+ box-shadow: var(--mdw-elevation__box-shadow__1);
164
+ }
165
+
166
+ :host(:where([elevated]:disabled)) {
167
+ box-shadow: var(--mdw-elevation__box-shadow__0);
168
+ }
169
+
170
+ :host(:where([filled]:disabled)) {
171
+ box-shadow: var(--mdw-elevation__box-shadow__0);
172
+ }
173
+
141
174
  /** Filled Tonal Color Defaults */
142
175
  :host(:where([filled="tonal"])) {
143
176
  --mdw-bg: var(--mdw-color__secondary-container);
@@ -164,7 +197,7 @@ export default CustomElement
164
197
  padding-inline: calc(16px + (var(--mdw-density) * 2px)) calc(24px + (var(--mdw-density) * 2px));
165
198
  }
166
199
 
167
- #shape:where([elevated],[filled],[color]) {
200
+ :host(:where([elevated],[filled],[color])) {
168
201
  background-color: rgb(var(--mdw-bg));
169
202
  }
170
203
 
@@ -192,7 +225,7 @@ export default CustomElement
192
225
  color: rgba(var(--mdw-color__on-surface), 0.38);
193
226
  }
194
227
 
195
- #shape[disabled]:is([elevated], [filled]) {
228
+ :host([disabled]:is([elevated], [filled])) {
196
229
  background-color: rgba(var(--mdw-color__on-surface), 0.12);
197
230
  color: rgba(var(--mdw-color__on-surface), 0.38);
198
231
  }
@@ -203,11 +236,6 @@ export default CustomElement
203
236
 
204
237
  #icon {
205
238
  font-size: calc(18/14 * 1em);
206
- font-variation-settings: 'FILL' 1;
207
- }
208
-
209
- #icon[outlined] {
210
- font-variation-settings: 'FILL' 0;
211
239
  }
212
240
 
213
241
  #icon[disabled] {
@@ -222,37 +250,8 @@ export default CustomElement
222
250
 
223
251
  @media (any-pointer: coarse) {
224
252
  #touch-target {
225
- visibility: visible;
253
+ visibility: inherit;
226
254
  }
227
255
  }
228
256
  `
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
257
  .autoRegister('mdw-button');
@@ -1,111 +1,124 @@
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';
10
11
 
11
12
  const SUPPORTS_INERT = 'inert' in HTMLElement.prototype;
12
13
 
13
- export default CustomElement
14
+ /**
15
+ * Cards display content and actions about a single subject.
16
+ * @see https://m3.material.io/components/cards/specs
17
+ */
18
+ export default Box
14
19
  .extend()
15
- .mixin(ThemableMixin)
16
- .mixin(FlexableMixin)
17
- .mixin(SurfaceMixin)
20
+ .mixin(StateMixin)
21
+ .mixin(ElevationMixin)
18
22
  .mixin(ShapeMixin)
19
23
  .mixin(FormAssociatedMixin) // Tap into FormAssociated for disabledState
20
- .mixin(StateMixin)
21
24
  .mixin(AriaReflectorMixin)
22
- .setStatic({
23
- delegatesFocus: true,
24
- })
25
+ .mixin(DelegatesFocusMixin)
26
+ .mixin(HyperlinkMixin)
25
27
  .set({
26
28
  _ariaRole: 'figure',
27
29
  })
28
30
  .observe({
31
+ /** Whether the card displays an elevated surface. */
32
+ elevated: 'boolean',
33
+ /** Whether the card uses a filled surface style. */
29
34
  filled: 'boolean',
35
+ /** When true, card renders an actionable control (clickable). */
30
36
  actionable: 'boolean',
37
+ /** Label for the action control used for accessibility. */
31
38
  actionLabel: 'string',
39
+ /** Event handler called when the card action is triggered. */
32
40
  onaction: EVENT_HANDLER_TYPE,
33
41
  })
34
42
  .define({
43
+ /**
44
+ * Element used as the target for state styling (pressed/focus).
45
+ * Returns the internal action control when actionable, otherwise the host.
46
+ * @return {HTMLElement}
47
+ */
35
48
  stateTargetElement() { return this.actionable ? this.refs.action : this; },
36
49
  })
37
50
  .expressions({
38
- showBlocker: ({ disabledState }) => !SUPPORTS_INERT && disabledState,
51
+ showBlocker: ({ disabledState, disabled }) => disabledState && (!disabled || !SUPPORTS_INERT),
52
+ showButton: ({ actionable, href }) => Boolean(actionable || href),
39
53
  })
40
54
  .methods({
55
+ /**
56
+ * Focuses the internal action control if the card is actionable and not disabled.
57
+ * @return {void}
58
+ */
41
59
  focus() {
42
60
  if (this.disabledState) return;
43
- if (this.actionable) this.refs.action.focus();
61
+ if (!this.actionable) return;
62
+ this.refs.action.focus();
44
63
  },
45
64
  })
46
65
  .html`
47
- <mdw-button mdw-if={actionable} aria-label={actionLabel} id=action disabled={disabledState}></mdw-button>
66
+ <mdw-button mdw-if={showButton} aria-label={actionLabel} href={href}
67
+ target={target}
68
+ download={download}
69
+ ping={ping}
70
+ rel={rel}
71
+ hreflang={hreflang}
72
+ referrerpolicy={referrerPolicy} id=action disabled={disabledState}></mdw-button>
48
73
  <div mdw-if={showBlocker} id=inert-blocker></div>
49
- <slot id=slot disabled={disabledState}></slot>
50
74
  `
75
+ .recompose(({ refs: { anchor, inertBlocker, slot } }) => {
76
+ anchor.remove();
77
+ slot.setAttribute('disabled', '{disabledState}');
78
+ inertBlocker.before(slot);
79
+ })
51
80
  .css`
52
- /* https://m3.material.io/components/cards/specs */
53
-
54
81
  :host {
55
- --mdw-shape__size: 12px;
82
+ --mdw-shape__size: var(--mdw-shape__medium);
56
83
 
57
- --mdw-surface__shadow__resting: none;
58
- --mdw-surface__shadow__raised: var(--mdw-surface__shadow__resting);
59
84
  /* padding-inline: 12px; */
60
85
 
61
- --mdw-bg: var(--mdw-color__surface-container);
86
+ --mdw-bg: var(--mdw-color__surface);
62
87
  --mdw-ink: var(--mdw-color__on-surface);
63
88
  position: relative;
64
89
 
65
- display: block;
66
-
67
- color: rgb(var(--mdw-ink));
68
-
69
90
  font: var(--mdw-type__font);
70
91
  letter-spacing: var(--mdw-type__letter-spacing);
71
- }
72
92
 
73
- #shape:where([elevated],[filled],[color]) {
74
- background-color: rgb(var(--mdw-bg));
93
+ transition: filter 200ms;
94
+ will-change: filter;
75
95
  }
76
96
 
77
- :host(:where([filled])) {
78
- --mdw-bg: var(--mdw-color__surface-container-highest);
79
- --mdw-ink: var(--mdw-color__on-surface-variant);
97
+ :host(:where([elevated],[filled],[outlined])) {
98
+ background-color: rgb(var(--mdw-bg));
80
99
  }
81
100
 
82
101
  :host(:where([elevated])) {
83
102
  --mdw-bg: var(--mdw-color__surface-container-low);
84
103
  --mdw-ink: var(--mdw-color__on-surface);
104
+ filter: var(--mdw-elevation__drop-shadow__1);
85
105
  }
86
106
 
87
- :host([filled]) {
88
- --mdw-surface__shadow__resting: var(--mdw-surface__shadow__0);
89
- }
90
-
91
- :host([filled][actionable]) {
92
- --mdw-surface__shadow__raised: var(--mdw-surface__shadow__1);
107
+ :host(:where([filled])) {
108
+ --mdw-bg: var(--mdw-color__surface-container-highest);
109
+ --mdw-ink: var(--mdw-color__on-surface-variant);
93
110
  }
94
111
 
95
- :host([elevated]) {
96
- --mdw-surface__shadow__resting: var(--mdw-surface__shadow__1);
112
+ :host(:where([filled][actionable])) {
113
+ filter: var(--mdw-elevation__drop-shadow__0);
97
114
  }
98
115
 
99
- :host([elevated][actionable]) {
100
- --mdw-surface__shadow__raised: var(--mdw-surface__shadow__2);
116
+ :host(:where([elevated][actionable]:hover:not(:active))) {
117
+ filter: var(--mdw-elevation__drop-shadow__2);
101
118
  }
102
119
 
103
- #shape[disabled] {
104
-
105
- /* Works on images */
106
- filter: grayscale();
107
-
108
- color: rgb(var(--mdw-color__on-surface));
120
+ :host(:where([filled][actionable]:hover:not(:active))) {
121
+ filter: var(--mdw-elevation__drop-shadow__1);
109
122
  }
110
123
 
111
124
  :host([disabled]) {
@@ -113,6 +126,8 @@ export default CustomElement
113
126
 
114
127
  filter: grayscale();
115
128
  opacity: 0.38;
129
+
130
+ color: rgb(var(--mdw-color__on-surface));
116
131
  }
117
132
 
118
133
  #slot[disabled] {
@@ -135,10 +150,14 @@ export default CustomElement
135
150
  z-index: 99;
136
151
  }
137
152
 
138
- #shape[disabled][elevated] {
153
+ :host([disabled][elevated]) {
139
154
  background-color: rgba(var(--mdw-color__surface-container-highest));
140
155
  }
141
156
 
157
+ :host([disabled][filled]) {
158
+ background-color: rgba(var(--mdw-color__surface));
159
+ }
160
+
142
161
  #action {
143
162
  --mdw-ink: inherit;
144
163
  --mdw-shape__size: inherit;
@@ -153,19 +172,12 @@ export default CustomElement
153
172
  color: inherit
154
173
  }
155
174
  `
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
- },
175
+ .recompose(({ refs: { slot, outline } }) => {
176
+ outline.removeAttribute('pressed');
177
+ outline.removeAttribute('focused');
178
+
179
+ slot.setAttribute('inert', '{disabledState}');
180
+ slot.setAttribute('disabled', '{disabledState}');
169
181
  })
170
182
  .childEvents({
171
183
  action: {
@@ -7,6 +7,10 @@ import StateMixin from '../mixins/StateMixin.js';
7
7
  import ThemableMixin from '../mixins/ThemableMixin.js';
8
8
  import TouchTargetMixin from '../mixins/TouchTargetMixin.js';
9
9
 
10
+ /**
11
+ * Checkboxes let users select one or more items from a list, or turn an item on or off.
12
+ * @see https://m3.material.io/components/checkbox/specs
13
+ */
10
14
  export default CustomElement
11
15
  .extend()
12
16
  .mixin(ThemableMixin)
@@ -15,49 +19,35 @@ export default CustomElement
15
19
  .mixin(InputMixin)
16
20
  .mixin(TouchTargetMixin)
17
21
  .set({
22
+ /** Whether the element renders a state layer for interaction feedback. */
18
23
  stateLayer: true,
24
+ /** The underlying control input `type` value. */
19
25
  type: 'checkbox',
20
26
  })
21
27
  .observe({
28
+ /** Icon name to show for the checked state. */
22
29
  icon: { value: 'check' },
30
+ /** Icon name to show when the control is indeterminate. */
23
31
  indeterminateIcon: { value: 'check_indeterminate_small' },
24
- /** Reflected property */
25
- indeterminate: 'boolean',
26
32
  })
27
- .observe({
28
- _ariaChecked({ indeterminate, checked }) {
29
- return (indeterminate ? 'mixed' : `${!!checked}`);
30
- },
33
+ .expressions({
31
34
  _determinateIcon({ indeterminate, indeterminateIcon, icon }) {
32
35
  return (indeterminate ? indeterminateIcon : icon);
33
36
  },
37
+ _iconSelectedState({ checked, indeterminate }) {
38
+ return checked || indeterminate;
39
+ },
34
40
  })
35
41
  .html`
36
42
  <div id=checkbox errored={erroredState} selected={checked}>
37
43
  <mdw-checkbox-icon id=icon errored={erroredState} disabled={disabledState}
38
- icon={_determinateIcon} selected={checked}>
44
+ icon={_determinateIcon} selected={_iconSelectedState}>
39
45
  </mdw-checkbox-icon>
40
46
  </div>
41
47
  <slot id=slot></slot>
42
48
  `
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
- },
49
+ .recompose(({ refs: { checkbox, state, rippleContainer } }) => {
50
+ checkbox.append(state, rippleContainer);
61
51
  })
62
52
  .css`
63
53
  /* https://m3.material.io/components/checkbox/specs */
@@ -3,26 +3,32 @@ import CustomElement from '../core/CustomElement.js';
3
3
  import ShapeMixin from '../mixins/ShapeMixin.js';
4
4
  import ThemableMixin from '../mixins/ThemableMixin.js';
5
5
 
6
+ /**
7
+ * CheckboxIcon is a visual helper for checkboxes, rendering the box and checkmark.
8
+ * @see https://m3.material.io/components/checkbox/specs
9
+ */
6
10
  export default CustomElement
7
11
  .extend()
8
12
  .mixin(ThemableMixin)
9
13
  .mixin(ShapeMixin)
10
14
  .observe({
15
+ /** Whether the icon is selected (checked). */
11
16
  selected: 'boolean',
17
+ /** Icon name to render inside the checkbox icon. */
12
18
  icon: 'string',
19
+ /** Whether the associated control is in an error state. */
13
20
  errored: 'boolean',
21
+ /** Whether the associated control is disabled. */
14
22
  disabled: 'boolean',
15
23
  })
16
24
  .define({
17
- /** Alias for Selected (QoL) */
25
+ /** Alias for `selected` (quality-of-life property). */
18
26
  checked: {
19
27
  get() { return this.selected; },
20
28
  set(value) { this.selected = value; },
21
29
  },
22
30
  })
23
31
  .css`
24
- /* https://m3.material.io/components/checkbox/specs */
25
-
26
32
  :host {
27
33
  --mdw-ink: var(--mdw-color__on-primary);
28
34
  --mdw-bg: var(--mdw-color__primary);
@@ -42,16 +48,6 @@ export default CustomElement
42
48
  line-height: 18px;
43
49
  }
44
50
 
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
51
  #icon {
56
52
  position: absolute;
57
53
  inset: 0;
@@ -59,6 +55,7 @@ export default CustomElement
59
55
  opacity: 0;
60
56
 
61
57
  background-color: rgb(var(--mdw-bg));
58
+ border-radius: inherit;
62
59
  color: rgb(var(--mdw-ink));
63
60
 
64
61
  transition-duration: 200ms;
@@ -67,11 +64,7 @@ export default CustomElement
67
64
  }
68
65
 
69
66
  #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);
67
+ border-width: 2px;
75
68
 
76
69
  color: rgb(var(--mdw-color__on-surface));
77
70
 
@@ -112,18 +105,13 @@ export default CustomElement
112
105
  color: rgb(var(--mdw-color__on-surface), var(--disabled-opacity));
113
106
  }
114
107
  `
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
- },
108
+ .html`
109
+ <mdw-icon id=icon selected={selected} errored={errored} disabled={disabled} icon={icon}></mdw-icon>
110
+ `
111
+ .recompose(({ refs: { outline } }) => {
112
+ outline.removeAttribute('mdw-if');
113
+ outline.setAttribute('selected', '{selected}');
114
+ outline.setAttribute('errored', '{errored}');
115
+ outline.setAttribute('disabled', '{disabled}');
128
116
  })
129
117
  .autoRegister('mdw-checkbox-icon');