@universal-material/web 3.0.8 → 3.0.9

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 (364) hide show
  1. package/.editorconfig +8 -0
  2. package/.eleventy.cjs +21 -0
  3. package/.eslintignore +6 -0
  4. package/.eslintrc.json +98 -0
  5. package/.prettierrc.json +7 -0
  6. package/.vscode/extensions.json +9 -0
  7. package/CHANGELOG.md +98 -0
  8. package/LICENSE +28 -0
  9. package/docs/.nojekyll +0 -0
  10. package/docs/api/index.html +149 -0
  11. package/docs/docs.css +185 -0
  12. package/docs/examples/index.html +75 -0
  13. package/docs/examples/name-property/index.html +65 -0
  14. package/docs/index.html +75 -0
  15. package/docs/install/index.html +53 -0
  16. package/docs/prism-okaidia.css +123 -0
  17. package/docs/src/_api-section.pug +27 -0
  18. package/docs/src/_layout.pug +182 -0
  19. package/docs/src/components/button-set/alignment.html +29 -0
  20. package/docs/src/components/button-set/stack.html +5 -0
  21. package/docs/src/components/button-set/usage.html +35 -0
  22. package/docs/src/components/button-set.pug +16 -0
  23. package/docs/src/components/cards/card-media.html +39 -0
  24. package/docs/src/components/cards/card-with-actions.html +38 -0
  25. package/docs/src/components/cards/simple-card.html +3 -0
  26. package/docs/src/components/cards.pug +15 -0
  27. package/docs/src/components/checkbox/usage.html +33 -0
  28. package/docs/src/components/checkbox.pug +7 -0
  29. package/docs/src/components/chips/chip-input.html +73 -0
  30. package/docs/src/components/chips/default-chips.html +25 -0
  31. package/docs/src/components/chips/elevated-chips.html +25 -0
  32. package/docs/src/components/chips/selected-chips.html +50 -0
  33. package/docs/src/components/chips.pug +16 -0
  34. package/docs/src/components/common-buttons/anchor-buttons.html +6 -0
  35. package/docs/src/components/common-buttons/buttons-icons.html +24 -0
  36. package/docs/src/components/common-buttons/buttons-trailing-icons.html +25 -0
  37. package/docs/src/components/common-buttons/buttons-variants.html +6 -0
  38. package/docs/src/components/common-buttons/filled-colors.html +4 -0
  39. package/docs/src/components/common-buttons.pug +22 -0
  40. package/docs/src/components/data-tables/simple-table.html +47 -0
  41. package/docs/src/components/data-tables/table-footer.html +59 -0
  42. package/docs/src/components/data-tables/table-header.html +43 -0
  43. package/docs/src/components/data-tables.pug +15 -0
  44. package/docs/src/components/datepicker.pug +133 -0
  45. package/docs/src/components/dialogs/example.html +44 -0
  46. package/docs/src/components/dialogs.pug +19 -0
  47. package/docs/src/components/dividers/no-margin.html +7 -0
  48. package/docs/src/components/dividers/usage.html +7 -0
  49. package/docs/src/components/dividers.pug +13 -0
  50. package/docs/src/components/dropdown-menus/down-end.html +10 -0
  51. package/docs/src/components/dropdown-menus/down-left.html +10 -0
  52. package/docs/src/components/dropdown-menus/down-right.html +10 -0
  53. package/docs/src/components/dropdown-menus/down-start.html +10 -0
  54. package/docs/src/components/dropdown-menus/down.html +10 -0
  55. package/docs/src/components/dropdown-menus/up-end.html +10 -0
  56. package/docs/src/components/dropdown-menus/up-left.html +10 -0
  57. package/docs/src/components/dropdown-menus/up-right.html +10 -0
  58. package/docs/src/components/dropdown-menus/up-start.html +10 -0
  59. package/docs/src/components/dropdown-menus/up.html +10 -0
  60. package/docs/src/components/expansion-panel.pug +33 -0
  61. package/docs/src/components/fab/button-colors.html +18 -0
  62. package/docs/src/components/fab/button-sizes.html +11 -0
  63. package/docs/src/components/fab/extended-buttons.html +18 -0
  64. package/docs/src/components/fab/floating-action-area.html +5 -0
  65. package/docs/src/components/fab/floating-menu.html +10 -0
  66. package/docs/src/components/fab/lowered-buttons.html +6 -0
  67. package/docs/src/components/fab.pug +25 -0
  68. package/docs/src/components/icon-buttons/anchor-buttons.html +15 -0
  69. package/docs/src/components/icon-buttons/buttons-variants.html +15 -0
  70. package/docs/src/components/icon-buttons/toggle-buttons-manual.html +44 -0
  71. package/docs/src/components/icon-buttons/toggle-buttons.html +48 -0
  72. package/docs/src/components/icon-buttons.pug +18 -0
  73. package/docs/src/components/lists/list-avatars.html +14 -0
  74. package/docs/src/components/lists/list-custom-dividers.html +23 -0
  75. package/docs/src/components/lists/list-dividers.html +17 -0
  76. package/docs/src/components/lists/list-dynamic.html +26 -0
  77. package/docs/src/components/lists/list-hover.html +17 -0
  78. package/docs/src/components/lists/list-icons.html +17 -0
  79. package/docs/src/components/lists/list-indexed.html +123 -0
  80. package/docs/src/components/lists/list-sections.html +16 -0
  81. package/docs/src/components/lists/list-three-lines.html +20 -0
  82. package/docs/src/components/lists/list-two-lines.html +20 -0
  83. package/docs/src/components/lists/list-with-action.html +26 -0
  84. package/docs/src/components/lists/list-with-activated-item.html +17 -0
  85. package/docs/src/components/lists/simple-list.html +17 -0
  86. package/docs/src/components/lists.pug +94 -0
  87. package/docs/src/components/menus.pug +55 -0
  88. package/docs/src/components/progress/circular-progress.html +13 -0
  89. package/docs/src/components/progress/determinate-progress.html +3 -0
  90. package/docs/src/components/progress/indeterminate-progress.html +3 -0
  91. package/docs/src/components/progress/progress-color.html +3 -0
  92. package/docs/src/components/progress.pug +18 -0
  93. package/docs/src/components/ripple/usage.html +9 -0
  94. package/docs/src/components/ripple.pug +10 -0
  95. package/docs/src/components/selection-controls/checkbox.html +22 -0
  96. package/docs/src/components/selection-controls/radio-button.html +36 -0
  97. package/docs/src/components/selection-controls/switch.html +12 -0
  98. package/docs/src/components/selection-controls.pug +13 -0
  99. package/docs/src/components/sliders/example.html +42 -0
  100. package/docs/src/components/sliders.pug +7 -0
  101. package/docs/src/components/snackbar/example.html +35 -0
  102. package/docs/src/components/snackbars.pug +21 -0
  103. package/docs/src/components/steppers.pug +57 -0
  104. package/docs/src/components/tabs/example.html +45 -0
  105. package/docs/src/components/tabs.pug +8 -0
  106. package/docs/src/components/text-fields.pug +88 -0
  107. package/docs/src/components/toolbars/simple-toolbar.html +33 -0
  108. package/docs/src/components/toolbars.pug +7 -0
  109. package/docs/src/content/typography/example.html +15 -0
  110. package/docs/src/content/typography.pug +8 -0
  111. package/docs/src/css/docs.scss +189 -0
  112. package/docs/src/index.pug +10 -0
  113. package/docs/src/js/docs.js +161 -0
  114. package/docs/src/js/universal-material.js +757 -0
  115. package/docs/src/js/universal-material.js.map +1 -0
  116. package/docs/src/js/universal-material.min.js +17 -0
  117. package/docs/src/js/universal-material.min.js.map +1 -0
  118. package/docs/src/layout/grid.pug +15 -0
  119. package/docs/src/utilities/background-colors/common-colors.html +7 -0
  120. package/docs/src/utilities/background-colors/theme-colors.html +16 -0
  121. package/docs/src/utilities/background-colors.pug +10 -0
  122. package/docs/src/utilities/text-and-background-colors/common-colors.html +80 -0
  123. package/docs/src/utilities/text-and-background-colors/theme-colors.html +208 -0
  124. package/docs/src/utilities/text-and-background-colors.pug +10 -0
  125. package/docs/src/utilities/text-colors/common-colors.html +12 -0
  126. package/docs/src/utilities/text-colors/emphasis-colors.html +26 -0
  127. package/docs/src/utilities/text-colors/theme-colors.html +37 -0
  128. package/docs/src/utilities/text-colors.pug +13 -0
  129. package/gulpfile.js +225 -0
  130. package/index.html +11 -0
  131. package/package.json +1 -1
  132. package/rollup.config.js +42 -0
  133. package/src/_utils.scss +20 -0
  134. package/src/_variables.scss +68 -0
  135. package/src/button/button-base.styles.scss +75 -0
  136. package/src/button/button-base.ts +147 -0
  137. package/src/button/button-set.styles.scss +35 -0
  138. package/src/button/button-set.ts +33 -0
  139. package/src/button/button.styles.scss +97 -0
  140. package/src/button/button.ts +64 -0
  141. package/src/button/fab.styles.scss +90 -0
  142. package/src/button/fab.ts +55 -0
  143. package/src/button/icon-button.styles.scss +74 -0
  144. package/src/button/icon-button.ts +72 -0
  145. package/src/card/card-content.styles.scss +11 -0
  146. package/src/card/card-content.ts +45 -0
  147. package/src/card/card-media.styles.scss +9 -0
  148. package/src/card/card-media.ts +24 -0
  149. package/src/card/card.styles.scss +27 -0
  150. package/src/card/card.ts +37 -0
  151. package/src/checkbox/checkbox.ts +77 -0
  152. package/src/container/container.styles.scss +39 -0
  153. package/src/container/container.ts +24 -0
  154. package/src/divider/divider.styles.scss +13 -0
  155. package/src/divider/divider.ts +21 -0
  156. package/src/elevation/elevation.styles.scss +31 -0
  157. package/src/elevation/elevation.ts +17 -0
  158. package/{index.js → src/index.ts} +1 -1
  159. package/src/ripple/ripple.styles.scss +80 -0
  160. package/src/ripple/ripple.ts +150 -0
  161. package/src/shared/base.styles.scss +5 -0
  162. package/src/table/table-body.styles.scss +9 -0
  163. package/src/table/table-body.ts +21 -0
  164. package/src/table/table-cell.styles.scss +9 -0
  165. package/src/table/table-cell.ts +21 -0
  166. package/src/table/table-head.styles.scss +9 -0
  167. package/src/table/table-head.ts +21 -0
  168. package/src/table/table-header-cell.styles.scss +10 -0
  169. package/src/table/table-header-cell.ts +21 -0
  170. package/src/table/table-row.styles.scss +3 -0
  171. package/src/table/table-row.ts +21 -0
  172. package/src/table/table.styles.scss +12 -0
  173. package/{table/table.js → src/table/table.ts} +15 -6
  174. package/src/theme/color.ts +6 -0
  175. package/src/theme/css-var-builder.ts +36 -0
  176. package/{theme/index.js → src/theme/index.ts} +0 -1
  177. package/src/theme/neutral-colors.ts +21 -0
  178. package/src/theme/rgb-color.ts +19 -0
  179. package/src/theme/theme-builder.ts +201 -0
  180. package/{theme/theme-color.d.ts → src/theme/theme-color.ts} +3 -2
  181. package/tsconfig.json +36 -0
  182. package/web-dev-server.config.js +25 -0
  183. package/web-test-runner.config.js +120 -0
  184. package/button/button-base.d.ts +0 -43
  185. package/button/button-base.d.ts.map +0 -1
  186. package/button/button-base.js +0 -152
  187. package/button/button-base.js.map +0 -1
  188. package/button/button-base.styles.d.ts +0 -2
  189. package/button/button-base.styles.d.ts.map +0 -1
  190. package/button/button-base.styles.js +0 -75
  191. package/button/button-base.styles.js.map +0 -1
  192. package/button/button-set.d.ts +0 -20
  193. package/button/button-set.d.ts.map +0 -1
  194. package/button/button-set.js +0 -38
  195. package/button/button-set.js.map +0 -1
  196. package/button/button-set.styles.d.ts +0 -2
  197. package/button/button-set.styles.d.ts.map +0 -1
  198. package/button/button-set.styles.js +0 -39
  199. package/button/button-set.styles.js.map +0 -1
  200. package/button/button.d.ts +0 -34
  201. package/button/button.d.ts.map +0 -1
  202. package/button/button.js +0 -64
  203. package/button/button.js.map +0 -1
  204. package/button/button.styles.d.ts +0 -2
  205. package/button/button.styles.d.ts.map +0 -1
  206. package/button/button.styles.js +0 -96
  207. package/button/button.styles.js.map +0 -1
  208. package/button/fab.d.ts +0 -31
  209. package/button/fab.d.ts.map +0 -1
  210. package/button/fab.js +0 -63
  211. package/button/fab.js.map +0 -1
  212. package/button/fab.styles.d.ts +0 -2
  213. package/button/fab.styles.d.ts.map +0 -1
  214. package/button/fab.styles.js +0 -89
  215. package/button/fab.styles.js.map +0 -1
  216. package/button/icon-button.d.ts +0 -35
  217. package/button/icon-button.d.ts.map +0 -1
  218. package/button/icon-button.js +0 -79
  219. package/button/icon-button.js.map +0 -1
  220. package/button/icon-button.styles.d.ts +0 -2
  221. package/button/icon-button.styles.d.ts.map +0 -1
  222. package/button/icon-button.styles.js +0 -70
  223. package/button/icon-button.styles.js.map +0 -1
  224. package/card/card-content.d.ts +0 -13
  225. package/card/card-content.d.ts.map +0 -1
  226. package/card/card-content.js +0 -44
  227. package/card/card-content.js.map +0 -1
  228. package/card/card-content.styles.d.ts +0 -2
  229. package/card/card-content.styles.d.ts.map +0 -1
  230. package/card/card-content.styles.js +0 -15
  231. package/card/card-content.styles.js.map +0 -1
  232. package/card/card-media.d.ts +0 -12
  233. package/card/card-media.d.ts.map +0 -1
  234. package/card/card-media.js +0 -29
  235. package/card/card-media.js.map +0 -1
  236. package/card/card-media.styles.d.ts +0 -2
  237. package/card/card-media.styles.d.ts.map +0 -1
  238. package/card/card-media.styles.js +0 -13
  239. package/card/card-media.styles.js.map +0 -1
  240. package/card/card.d.ts +0 -19
  241. package/card/card.d.ts.map +0 -1
  242. package/card/card.js +0 -40
  243. package/card/card.js.map +0 -1
  244. package/card/card.styles.d.ts +0 -2
  245. package/card/card.styles.d.ts.map +0 -1
  246. package/card/card.styles.js +0 -28
  247. package/card/card.styles.js.map +0 -1
  248. package/checkbox/checkbox.d.ts +0 -16
  249. package/checkbox/checkbox.d.ts.map +0 -1
  250. package/checkbox/checkbox.js +0 -75
  251. package/checkbox/checkbox.js.map +0 -1
  252. package/container/container.d.ts +0 -13
  253. package/container/container.d.ts.map +0 -1
  254. package/container/container.js +0 -23
  255. package/container/container.js.map +0 -1
  256. package/container/container.styles.d.ts +0 -2
  257. package/container/container.styles.d.ts.map +0 -1
  258. package/container/container.styles.js +0 -43
  259. package/container/container.styles.js.map +0 -1
  260. package/custom-elements.json +0 -3706
  261. package/divider/divider.d.ts +0 -14
  262. package/divider/divider.d.ts.map +0 -1
  263. package/divider/divider.js +0 -27
  264. package/divider/divider.js.map +0 -1
  265. package/divider/divider.styles.d.ts +0 -2
  266. package/divider/divider.styles.d.ts.map +0 -1
  267. package/divider/divider.styles.js +0 -15
  268. package/divider/divider.styles.js.map +0 -1
  269. package/elevation/elevation.d.ts +0 -11
  270. package/elevation/elevation.d.ts.map +0 -1
  271. package/elevation/elevation.js +0 -21
  272. package/elevation/elevation.js.map +0 -1
  273. package/elevation/elevation.styles.d.ts +0 -2
  274. package/elevation/elevation.styles.d.ts.map +0 -1
  275. package/elevation/elevation.styles.js +0 -28
  276. package/elevation/elevation.styles.js.map +0 -1
  277. package/index.d.ts +0 -27
  278. package/index.d.ts.map +0 -1
  279. package/index.js.map +0 -1
  280. package/ripple/ripple.d.ts +0 -25
  281. package/ripple/ripple.d.ts.map +0 -1
  282. package/ripple/ripple.js +0 -119
  283. package/ripple/ripple.js.map +0 -1
  284. package/ripple/ripple.styles.d.ts +0 -2
  285. package/ripple/ripple.styles.d.ts.map +0 -1
  286. package/ripple/ripple.styles.js +0 -74
  287. package/ripple/ripple.styles.js.map +0 -1
  288. package/shared/base.styles.d.ts +0 -2
  289. package/shared/base.styles.d.ts.map +0 -1
  290. package/shared/base.styles.js +0 -9
  291. package/shared/base.styles.js.map +0 -1
  292. package/table/table-body.d.ts +0 -11
  293. package/table/table-body.d.ts.map +0 -1
  294. package/table/table-body.js +0 -21
  295. package/table/table-body.js.map +0 -1
  296. package/table/table-body.styles.d.ts +0 -2
  297. package/table/table-body.styles.d.ts.map +0 -1
  298. package/table/table-body.styles.js +0 -11
  299. package/table/table-body.styles.js.map +0 -1
  300. package/table/table-cell.d.ts +0 -11
  301. package/table/table-cell.d.ts.map +0 -1
  302. package/table/table-cell.js +0 -21
  303. package/table/table-cell.js.map +0 -1
  304. package/table/table-cell.styles.d.ts +0 -2
  305. package/table/table-cell.styles.d.ts.map +0 -1
  306. package/table/table-cell.styles.js +0 -11
  307. package/table/table-cell.styles.js.map +0 -1
  308. package/table/table-head.d.ts +0 -11
  309. package/table/table-head.d.ts.map +0 -1
  310. package/table/table-head.js +0 -21
  311. package/table/table-head.js.map +0 -1
  312. package/table/table-head.styles.d.ts +0 -2
  313. package/table/table-head.styles.d.ts.map +0 -1
  314. package/table/table-head.styles.js +0 -11
  315. package/table/table-head.styles.js.map +0 -1
  316. package/table/table-header-cell.d.ts +0 -11
  317. package/table/table-header-cell.d.ts.map +0 -1
  318. package/table/table-header-cell.js +0 -21
  319. package/table/table-header-cell.js.map +0 -1
  320. package/table/table-header-cell.styles.d.ts +0 -2
  321. package/table/table-header-cell.styles.d.ts.map +0 -1
  322. package/table/table-header-cell.styles.js +0 -12
  323. package/table/table-header-cell.styles.js.map +0 -1
  324. package/table/table-row.d.ts +0 -11
  325. package/table/table-row.d.ts.map +0 -1
  326. package/table/table-row.js +0 -21
  327. package/table/table-row.js.map +0 -1
  328. package/table/table-row.styles.d.ts +0 -2
  329. package/table/table-row.styles.d.ts.map +0 -1
  330. package/table/table-row.styles.js +0 -7
  331. package/table/table-row.styles.js.map +0 -1
  332. package/table/table.d.ts +0 -16
  333. package/table/table.d.ts.map +0 -1
  334. package/table/table.js.map +0 -1
  335. package/table/table.styles.d.ts +0 -2
  336. package/table/table.styles.d.ts.map +0 -1
  337. package/table/table.styles.js +0 -16
  338. package/table/table.styles.js.map +0 -1
  339. package/theme/color.d.ts +0 -7
  340. package/theme/color.d.ts.map +0 -1
  341. package/theme/color.js +0 -2
  342. package/theme/color.js.map +0 -1
  343. package/theme/css-var-builder.d.ts +0 -9
  344. package/theme/css-var-builder.d.ts.map +0 -1
  345. package/theme/css-var-builder.js +0 -25
  346. package/theme/css-var-builder.js.map +0 -1
  347. package/theme/index.d.ts +0 -2
  348. package/theme/index.d.ts.map +0 -1
  349. package/theme/index.js.map +0 -1
  350. package/theme/neutral-colors.d.ts +0 -4
  351. package/theme/neutral-colors.d.ts.map +0 -1
  352. package/theme/neutral-colors.js +0 -19
  353. package/theme/neutral-colors.js.map +0 -1
  354. package/theme/rgb-color.d.ts +0 -9
  355. package/theme/rgb-color.d.ts.map +0 -1
  356. package/theme/rgb-color.js +0 -13
  357. package/theme/rgb-color.js.map +0 -1
  358. package/theme/theme-builder.d.ts +0 -27
  359. package/theme/theme-builder.d.ts.map +0 -1
  360. package/theme/theme-builder.js +0 -146
  361. package/theme/theme-builder.js.map +0 -1
  362. package/theme/theme-color.d.ts.map +0 -1
  363. package/theme/theme-color.js +0 -2
  364. package/theme/theme-color.js.map +0 -1
@@ -0,0 +1,97 @@
1
+ @import "../utils";
2
+
3
+ :host {
4
+ --u-common-button-line-height: var(--u-label-large-line-height, 1.25rem);
5
+ --u-common-button-font-size: var(--u-label-large-font-size, 0.875rem);
6
+ --u-common-button-font-weight: #{get-font-weight-var(medium)};
7
+ --_common-button-height: var(--u-common-button-height, 2.5rem);
8
+ --_common-button-padding: var(--u-common-button-padding, 24px);
9
+ --_common-button-icon-padding: var(--u-common-button-icon-padding, 16px);
10
+
11
+ border-radius: var(--u-common-button-shape-corner, #{get-shaper-corner-var(full)});
12
+ font-family: var(--u-font-family-base, system-ui);
13
+ height: var(--u-common-button-height, 40px);
14
+ font-size: var(--u-common-button-font-size);
15
+ font-weight: var(--u-common-button-font-weight);
16
+ padding-inline: var(--_common-button-padding);
17
+ box-sizing: border-box;
18
+ }
19
+
20
+ :host([variant=filled]),
21
+ :host([variant=filled][color=primary]) {
22
+ background-color: var(--u-filled-button-primary-container-color, var(--_color-primary));
23
+ color: var(--u-filled-button-primary-text-color, #{get-color-var(on-primary)});
24
+ }
25
+
26
+ :host([variant=filled][color=secondary]) {
27
+ background-color: var(--u-filled-button-secondary-container-color, #{get-color-var(secondary)});
28
+ color: var(--u-filled-button-secondary-text-color, #{get-color-var(on-secondary)});
29
+ }
30
+
31
+ :host([variant=filled][color=tertiary]) {
32
+ background-color: var(--u-filled-button-tertiary-container-color, #{get-color-var(tertiary)});
33
+ color: var(--u-filled-button-tertiary-text-color, #{get-color-var(on-tertiary)});
34
+ }
35
+
36
+ :host([variant=filled][color=error]) {
37
+ background-color: var(--u-filled-button-error-container-color, #{get-color-var(error)});
38
+ color: var(--u-filled-button-error-text-color, #{get-color-var(on-error)});
39
+ }
40
+
41
+ :host([variant=tonal]) {
42
+ background-color: var(--u-tonal-button-background-color, #{get-color-var(secondary-container)});
43
+ color: var(--u-tonal-button-text-color, #{get-color-var(on-secondary-container)});
44
+ }
45
+
46
+ :host([variant=elevated]) {
47
+ background-color: var(--u-elevated-button-background-color, #{get-color-var(surface-container-low)});
48
+ color: var(--u-tonal-button-text-color, #{get-color-var(on-secondary-container)});
49
+ }
50
+
51
+ @media (hover: hover) {
52
+ :host([variant=filled]:hover:not(:focus-within):not(:active)),
53
+ :host([variant=tonal]:hover:not(:focus-within):not(:active)) {
54
+ --u-elevation-level: var(--u-filled-button-hover-elevation-level, 1);
55
+ }
56
+ }
57
+
58
+ :host([variant=outlined]),
59
+ :host([variant=text]),
60
+ :host([variant=elevated]) {
61
+ color: var(--_color-primary);
62
+ }
63
+
64
+ :host([variant=outlined]) {
65
+ border: 1px solid #{get-color-var(outline-color)};
66
+ }
67
+
68
+ :host([variant=elevated]) {
69
+ --u-elevation-level: var(--u-elevated-button-elevation-level, 1);
70
+ }
71
+
72
+ @media (hover: hover) {
73
+ :host([variant=elevated]:hover) {
74
+ --u-elevation-level: var(--u-elevated-button-hover-elevation-level, 2);
75
+ }
76
+ }
77
+
78
+ :host([has-icon]) {
79
+ padding-inline: var(--_common-button-icon-padding) var(--_common-button-padding);
80
+ }
81
+
82
+ :host([has-icon][trailing-icon]) {
83
+ padding-inline: var(--_common-button-padding) var(--_common-button-icon-padding);
84
+ }
85
+
86
+ ::slotted([slot=icon]) {
87
+ display: inline-block;
88
+ width: var(--u-common-button-icon-size, 1.125rem);
89
+ height: var(--u-common-button-icon-size, 1.125rem);
90
+ margin-inline-end: 8px;
91
+ font-size: var(--u-common-button-icon-size, 1.125rem);
92
+ line-height: var(--u-common-button-icon-size, 1.125rem);
93
+ }
94
+
95
+ :host([trailing-icon]) ::slotted([slot=icon]) {
96
+ margin-inline: 8px 0;
97
+ }
@@ -0,0 +1,64 @@
1
+ import { CSSResult, html, HTMLTemplateResult, nothing } from 'lit';
2
+ import { customElement, property, queryAssignedElements } from 'lit/decorators.js';
3
+
4
+ import { UmButtonBase } from './button-base';
5
+ import { styles as buttonBaseStyles } from './button-base.styles';
6
+ import { styles } from './button.styles';
7
+ import '../ripple/ripple.js';
8
+
9
+ export type UmButtonVariant = 'filled' | 'tonal' | 'elevated' | 'outlined' | 'text';
10
+ export type UmButtonColor = 'primary' | 'secondary' | 'tertiary' | 'error' | undefined;
11
+
12
+ @customElement('u-button')
13
+ export class UmButton extends UmButtonBase {
14
+
15
+ static override styles: CSSResult | CSSResult[] = [buttonBaseStyles, styles];
16
+
17
+ /**
18
+ * The Button variant to render
19
+ */
20
+ @property({reflect: true}) variant: UmButtonVariant = 'filled';
21
+
22
+ /**
23
+ * The Button color
24
+ *
25
+ * _Note:_ Filled buttons only
26
+ */
27
+ @property({reflect: true}) color: UmButtonColor;
28
+
29
+ @property({type: Boolean, attribute: 'trailing-icon', reflect: true}) trailingIcon = false;
30
+
31
+ /**
32
+ * Whether the button has icon or not
33
+ *
34
+ * _Note:_ Readonly
35
+ */
36
+ @property({type: Boolean, attribute: 'has-icon', reflect: true}) hasIcon = false;
37
+
38
+ @queryAssignedElements({slot: 'icon', flatten: true})
39
+ private readonly assignedIcons!: HTMLElement[];
40
+
41
+ protected override renderContent(): HTMLTemplateResult {
42
+ const icon = html`
43
+ <slot
44
+ name="icon"
45
+ aria-hidden="true"
46
+ @slotchange="${this.handleSlotChange}"></slot>`;
47
+
48
+ return html`
49
+ ${this.trailingIcon ? nothing : icon}
50
+ <span><slot></slot></span>
51
+ ${this.trailingIcon ? icon : nothing}
52
+ `;
53
+ }
54
+
55
+ private handleSlotChange() {
56
+ this.hasIcon = this.assignedIcons.length > 0;
57
+ }
58
+ }
59
+
60
+ declare global {
61
+ interface HTMLElementTagNameMap {
62
+ 'u-button': UmButton;
63
+ }
64
+ }
@@ -0,0 +1,90 @@
1
+ @import "../utils";
2
+
3
+ :host {
4
+ aspect-ratio: 1;
5
+ --u-elevation-level: var(--u-fab-button-elevation-level, 3);
6
+ }
7
+
8
+ :host([lowered]) {
9
+ --u-elevation-level: var(--u-fab-button-elevation-level, 1);
10
+ }
11
+
12
+ @media (hover: hover) {
13
+ :host(:hover:not(:focus-within):not(:active)) {
14
+ --u-elevation-level: var(--u-fab-button-hover-elevation-level, 4);
15
+ }
16
+
17
+ :host(:hover:not(:focus-within):not(:active)[lowered]) {
18
+ --u-elevation-level: var(--u-fab-button-elevation-level, 2);
19
+ }
20
+ }
21
+
22
+ @media (hover: hover) {
23
+ :host(:hover:not(:focus-within):not(:active)) {
24
+ --u-elevation-level: var(--u-fab-button-hover-elevation-level, 4);
25
+ }
26
+ }
27
+
28
+ :host([size="small"]) {
29
+ width: var(--u-fab-button-small-size, 40px);
30
+ border-radius: var(--u-fab-button-medium-shape-corner, #{get-shaper-corner-var(medium)});
31
+ }
32
+
33
+ :host([size="large"]) {
34
+ width: var(--u-fab-button-medium-size, 96px);
35
+ border-radius: var(--u-fab-button-medium-shape-corner, #{get-shaper-corner-var(extra-large)});
36
+ }
37
+
38
+ :host([extended]),
39
+ :host([size="medium"]) {
40
+ width: var(--u-fab-button-medium-size, 56px);
41
+ border-radius: var(--u-fab-button-medium-shape-corner, #{get-shaper-corner-var(large)});
42
+ }
43
+
44
+ :host([size="large"]) .icon {
45
+ font-size: var(--u-fab-button-icon-size, 2rem);
46
+ }
47
+
48
+ :host([extended]) .icon,
49
+ :host([size="small"]) .icon,
50
+ :host([size="medium"]) .icon {
51
+ font-size: var(--u-fab-button-icon-size, 1.5rem);
52
+ }
53
+
54
+ :host([extended]) {
55
+ width: auto;
56
+ height: var(--u-extended-fab-button-height, 56px);
57
+ aspect-ratio: auto;
58
+ min-width: var(--u-extended-fab-button-min-width, 80px);
59
+ padding-inline: var(--u-extended-fab-button-padding, 16px 24px);
60
+ }
61
+
62
+ :host([extended]) .icon {
63
+ margin-inline-end: var(--u-extended-fab-button-icon-margin, 12px);
64
+ }
65
+
66
+ :host([color="primary"]) {
67
+ background-color: var(--u-fab-button-primary-background-color, #{get-color-var(primary-container)});
68
+ color: var(--u-fab-button-primary-text-color, #{get-color-var(on-primary-container)});
69
+ }
70
+
71
+ :host([color="secondary"]) {
72
+ background-color: var(--u-fab-button-secondary-background-color, #{get-color-var(secondary-container)});
73
+ color: var(--u-fab-button-secondary-text-color, #{get-color-var(on-secondary-container)});
74
+ }
75
+
76
+ :host([color="tertiary"]) {
77
+ background-color: var(--u-fab-button-tertiary-background-color, #{get-color-var(tertiary-container)});
78
+ color: var(--u-fab-button-tertiary-text-color, #{get-color-var(on-tertiary-container)});
79
+ }
80
+
81
+ :host([color="branded"]),
82
+ :host([color="surface"]) {
83
+ background-color: var(--u-fab-button-surface-background-color, #{get-color-var(surface-container-high)});
84
+ color: var(--u-fab-button-surface-text-color, var(--_color-primary));
85
+ }
86
+
87
+ :host([color="branded"][lowered]),
88
+ :host([color="surface"][lowered]) {
89
+ background-color: var(--u-fab-button-surface-background-color, #{get-color-var(surface-container-low)});
90
+ }
@@ -0,0 +1,55 @@
1
+ import { CSSResult, html, HTMLTemplateResult, nothing } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+
4
+ import { UmButtonBase } from './button-base';
5
+ import { styles as buttonBaseStyles } from './button-base.styles';
6
+ import { styles } from './fab.styles';
7
+
8
+ export type UmFabColor = 'primary' | 'secondary' | 'tertiary' | 'surface' | 'branded';
9
+ export type UmFabSize = 'small' | 'medium' | 'large';
10
+
11
+ @customElement('u-fab')
12
+ export class UmFab extends UmButtonBase {
13
+
14
+ static override styles: CSSResult | CSSResult[] = [buttonBaseStyles, styles];
15
+
16
+ /**
17
+ * The FAB color variant to render.
18
+ */
19
+ @property({reflect: true}) color: UmFabColor = 'primary';
20
+
21
+ /**
22
+ * The size of the FAB.
23
+ */
24
+ @property({reflect: true}) size: UmFabSize = 'medium';
25
+
26
+ /**
27
+ * The text to display the FAB.
28
+ */
29
+ @property({reflect: true}) label: string | null = null;
30
+
31
+ /**
32
+ * Lowers the FAB's elevation.
33
+ */
34
+ @property({type: Boolean, reflect: true}) lowered = false;
35
+
36
+ @property({type: Boolean, reflect: true})
37
+ get extended(): boolean {
38
+ return !!this.label;
39
+ }
40
+
41
+ protected override renderContent(): HTMLTemplateResult {
42
+ const labelTag = html`<span>${this.label}</span>`;
43
+
44
+ return html`
45
+ <span class="icon" aria-hidden="true"><slot></slot></span>
46
+ ${this.label ? labelTag : nothing}
47
+ `;
48
+ }
49
+ }
50
+
51
+ declare global {
52
+ interface HTMLElementTagNameMap {
53
+ 'u-fab': UmFab;
54
+ }
55
+ }
@@ -0,0 +1,74 @@
1
+ @import "../utils";
2
+
3
+ :host {
4
+ --_surface-container-highest-color: #{get-color-var(surface-container-highest)};
5
+
6
+ width: var(--u-icon-button-size, 2.5rem);
7
+ height: var(--u-icon-button-size, 2.5rem);
8
+ border-radius: var(--u-icon-button-shape-corner, 9999px);
9
+ font-family: var(--u-font-family-base, system-ui);
10
+
11
+ }
12
+
13
+ .icon {
14
+ display: inline-flex;
15
+ align-items: center;
16
+ justify-content: center;
17
+ font-size: var(--u-icon-button-icon-size, 1.5rem);
18
+ line-height: var(--u-icon-button-icon-size, 1.5rem);
19
+
20
+ &.icon-selected {
21
+ display: none;
22
+ }
23
+ }
24
+
25
+ :host([selected]) {
26
+ .icon:not(.icon-selected) {
27
+ display: none;
28
+ }
29
+
30
+ .icon.icon-selected {
31
+ display: inline-block;
32
+ }
33
+ }
34
+
35
+ :host([variant="filled"]) {
36
+ background-color: var(--u-filled-icon-button-unselected-background-color, var(--_surface-container-highest-color));
37
+ color: var(--u-filled-icon-button-unselected-text-color, var(--_color-primary));
38
+ }
39
+
40
+ :host([variant="tonal"]) {
41
+ background-color: var(--u-total-icon-button-unselected-background-color, var(--_surface-container-highest-color));
42
+ color: var(--u-tonal-icon-button-unselected-text-color, #{get-color-var(on-surface-variant)});
43
+ }
44
+
45
+ :host([selected][variant="filled"]),
46
+ :host([variant="filled"]:not([has-selection-icon])) {
47
+ background-color: var(--u-filled-icon-button-background-color, var(--_color-primary));
48
+ color: var(--u-filled-icon-button-text-color, #{get-color-var(on-primary)});
49
+ }
50
+
51
+ :host([selected][variant="tonal"]),
52
+ :host([variant="tonal"]:not([has-selection-icon])) {
53
+ background-color: var(--u-tonal-icon-button-background-color, #{get-color-var(secondary-container)});
54
+ color: var(--u-tonal-icon-button-text-color, #{get-color-var(on-secondary-container)});
55
+ }
56
+
57
+ :host([variant="standard"]),
58
+ :host([variant="outlined"]) {
59
+ color: #{get-color-var(on-surface-variant)};
60
+ }
61
+
62
+ :host([variant="outlined"]) {
63
+ border: 1px solid #{get-color-var(outline)};
64
+ }
65
+
66
+ :host([selected][variant="outlined"]) {
67
+ border: none;
68
+ background-color: var(--u-outlined-icon-button-selected-background-color, #{get-color-var(inverse-surface)});
69
+ color: var(--u-outlined-icon-button-selected-text-color, #{get-color-var(inverse-on-surface)});
70
+ }
71
+
72
+ :host([selected][variant="standard"]) {
73
+ color: var(--u-standard-icon-button-selected-text-color, var(--_color-primary));
74
+ }
@@ -0,0 +1,72 @@
1
+ import { CSSResult, html, HTMLTemplateResult, nothing } from 'lit';
2
+ import { customElement, property, queryAssignedElements } from 'lit/decorators.js';
3
+
4
+ import '../ripple/ripple.js';
5
+ import { UmButtonBase } from './button-base';
6
+ import { styles as buttonBaseStyles } from './button-base.styles';
7
+ import { styles } from './icon-button.styles';
8
+
9
+ export type UmIconButtonVariant = 'standard' | 'filled' | 'tonal' | 'outlined';
10
+
11
+ @customElement('u-icon-button')
12
+ export class UmIconButton extends UmButtonBase {
13
+
14
+ static override styles: CSSResult | CSSResult[] = [buttonBaseStyles, styles];
15
+
16
+ @property({reflect: true}) variant: UmIconButtonVariant = 'standard';
17
+
18
+ /**
19
+ * When true, the button will toggle between selected and unselected
20
+ * states
21
+ */
22
+ @property({type: Boolean}) toggle = false;
23
+
24
+ @property({type: Boolean, attribute: 'has-selection-icon', reflect: true}) hasSelectionIcon = false;
25
+
26
+ /**
27
+ * Sets the selected state. When false, displays the default icon. When true,
28
+ * displays the selected icon, or the default icon If no `slot="selected"`
29
+ * icon is provided.
30
+ */
31
+ @property({type: Boolean, reflect: true}) selected = false;
32
+
33
+ /**
34
+ * The `aria-label` of the button when the button is toggleable and selected.
35
+ */
36
+ @property({attribute: 'aria-label-selected'}) ariaLabelSelected = '';
37
+
38
+ @queryAssignedElements({slot: 'selected', flatten: true})
39
+ private readonly selectedIcons!: HTMLElement[];
40
+
41
+ protected override renderContent(): HTMLTemplateResult {
42
+
43
+ return html`
44
+ <span class="icon" aria-hidden="true"><slot></slot></span>
45
+ <span class="icon icon-selected" aria-hidden="true">
46
+ <slot name="selected" @slotchange="${this.handleSlotChange}"></slot>
47
+ </span>
48
+ `;
49
+ }
50
+
51
+ protected override handleClick(_: UIEvent): void {
52
+ if (this.toggle) {
53
+ this.selected = !this.selected;
54
+ }
55
+ }
56
+
57
+ override getAriaLabel(): string | null | typeof nothing {
58
+ return this.selected
59
+ ? this.ariaLabelSelected || super.getAriaLabel()
60
+ : super.getAriaLabel();
61
+ }
62
+
63
+ private handleSlotChange() {
64
+ this.hasSelectionIcon = this.selectedIcons.length > 0;
65
+ }
66
+ }
67
+
68
+ declare global {
69
+ interface HTMLElementTagNameMap {
70
+ 'u-icon-button': UmIconButton;
71
+ }
72
+ }
@@ -0,0 +1,11 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ :host(:has(slot > *)) {
6
+ display: none;
7
+ }
8
+
9
+ :host([has-content]) {
10
+ padding: var(--u-card-padding, 16px);
11
+ }
@@ -0,0 +1,45 @@
1
+ import { HTMLTemplateResult, LitElement, html } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+
4
+ import { styles as baseStyles } from '../shared/base.styles';
5
+ import { styles } from './card-content.styles';
6
+
7
+ @customElement('u-card-content')
8
+ export class UmCardContent extends LitElement {
9
+
10
+ static override styles = [baseStyles, styles];
11
+
12
+ @property({type: Boolean, attribute: 'has-content', reflect: true}) hasContent = false;
13
+
14
+ override render(): HTMLTemplateResult {
15
+ return html`
16
+ <slot @slotchange="${this.handleSlotChange}"></slot>`;
17
+ }
18
+
19
+ private handleSlotChange(e: Event) {
20
+ const slot = <HTMLSlotElement>e.target;
21
+
22
+ this.hasContent = slot.assignedElements({flatten: true}).length > 0;
23
+
24
+ if (this.hasContent) {
25
+ return;
26
+ }
27
+
28
+ const nodes = slot.assignedNodes({flatten: true});
29
+
30
+ for (const node of nodes) {
31
+ if (node.nodeValue?.trim()) {
32
+ this.hasContent = true;
33
+ return;
34
+ }
35
+ }
36
+
37
+ this.hasContent = false;
38
+ }
39
+ }
40
+
41
+ declare global {
42
+ interface HTMLElementTagNameMap {
43
+ 'u-card-content': UmCardContent;
44
+ }
45
+ }
@@ -0,0 +1,9 @@
1
+ :host {
2
+ display: block;
3
+ aspect-ratio: 1;
4
+ border-radius: var(--u-card-shape-corner, var(--u-shape-corner-medium, 12px));
5
+ }
6
+
7
+ :host([wide]) {
8
+ aspect-ratio: 16/9;
9
+ }
@@ -0,0 +1,24 @@
1
+ import { HTMLTemplateResult, LitElement, html } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+
4
+ import { styles as baseStyles } from '../shared/base.styles';
5
+ import { styles } from './card-media.styles';
6
+
7
+ @customElement('u-card-media')
8
+ export class UmCardMedia extends LitElement {
9
+
10
+ static override styles = [baseStyles, styles];
11
+
12
+ @property({type: Boolean, reflect: true}) wide = false;
13
+
14
+ override render(): HTMLTemplateResult {
15
+ return html`
16
+ <slot></slot>`;
17
+ }
18
+ }
19
+
20
+ declare global {
21
+ interface HTMLElementTagNameMap {
22
+ 'u-card-media': UmCardMedia;
23
+ }
24
+ }
@@ -0,0 +1,27 @@
1
+ @import "../utils";
2
+
3
+ :host {
4
+ display: block;
5
+ position: relative;
6
+ border-radius: var(--u-card-shape-corner, #{get-shaper-corner-var(medium)});
7
+ }
8
+
9
+ :host(:not(:first-child)) {
10
+ margin-top: 8px;
11
+ }
12
+
13
+ :host([variant=elevated]) {
14
+ background-color: #{get-color-var(surface-container-low)};
15
+
16
+ u-elevation {
17
+ --u-elevation-level: var(--u-elevated-card-elevation-level, 1);
18
+ }
19
+ }
20
+
21
+ :host([variant=filled]) {
22
+ background-color: #{get-color-var(surface-container-highest)};
23
+ }
24
+
25
+ :host([variant=outlined]) {
26
+ border: var(--u-outlined-card-outline-width, 1px) solid var(--u-outlined-card-outline-color, #{get-color-var(outline-variant)});
27
+ }
@@ -0,0 +1,37 @@
1
+ import { html, HTMLTemplateResult, LitElement } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+
4
+ import { styles as baseStyles } from '../shared/base.styles';
5
+ import { styles } from './card.styles';
6
+ import './card-content.js';
7
+ import './card-media.js';
8
+ import '../elevation/elevation.js';
9
+
10
+ export type UmCardVariant = 'filled' | 'elevated' | 'outlined';
11
+
12
+ @customElement('u-card')
13
+ export class UmCard extends LitElement {
14
+
15
+ static override styles = [baseStyles, styles];
16
+
17
+ /**
18
+ * The Card variant to render.
19
+ */
20
+ @property({reflect: true}) variant: UmCardVariant = 'elevated';
21
+
22
+ override render(): HTMLTemplateResult {
23
+ return html`
24
+ <u-elevation></u-elevation>
25
+ <slot name="before-content"></slot>
26
+ <u-card-content>
27
+ <slot></slot>
28
+ </u-card-content>
29
+ <slot name="after-content"></slot>`;
30
+ }
31
+ }
32
+
33
+ declare global {
34
+ interface HTMLElementTagNameMap {
35
+ 'u-card': UmCard;
36
+ }
37
+ }
@@ -0,0 +1,77 @@
1
+ import { css, html, HTMLTemplateResult, LitElement } from 'lit';
2
+ import { customElement, query, queryAssignedElements } from 'lit/decorators.js';
3
+
4
+ import { UmRipple } from '../ripple/ripple';
5
+ import { styles as baseStyles } from '../shared/base.styles';
6
+
7
+ @customElement('u-checkbox')
8
+ export class UmCheckbox extends LitElement {
9
+ static override styles = [
10
+ baseStyles,
11
+ css`
12
+ :host {
13
+ position: relative;
14
+ display: inline-flex;
15
+ justify-content: center;
16
+ align-items: center;
17
+ width: 48px;
18
+ height: 48px;
19
+ }
20
+
21
+ ::slotted(input) {
22
+ position: relative;
23
+ padding: 0;
24
+ margin: 0;
25
+ aspect-ratio: 1;
26
+ height: 100%;
27
+ z-index: 1;
28
+ appearance: none;
29
+ }
30
+
31
+ .touch {
32
+ position: absolute;
33
+ inset: 0;
34
+ border-radius: 9999px;
35
+ }
36
+ `
37
+ ];
38
+
39
+ @query('u-ripple') private readonly ripple!: UmRipple;
40
+ @queryAssignedElements({selector: 'input', flatten: true})
41
+ private readonly assignedInputs!: HTMLInputElement[];
42
+
43
+ private input: HTMLInputElement | undefined;
44
+
45
+ override render(): HTMLTemplateResult {
46
+ return html`
47
+ <div class="touch">
48
+ <u-ripple><slot @slotchange="${this.handleSlotChange}"></slot></u-ripple>
49
+ </div>`;
50
+ }
51
+
52
+ private handleSlotChange(): void {
53
+ console.log('slotchange');
54
+
55
+ if (this.input) {
56
+ this.input.removeEventListener('click', this.handleInputChange);
57
+ }
58
+
59
+ this.input = this.assignedInputs[0];
60
+
61
+ if (this.input) {
62
+ this.input.addEventListener('click', this.handleInputChange);
63
+ }
64
+ }
65
+
66
+ private handleInputChange = (e: MouseEvent) => {
67
+ if (this.input !== document.elementFromPoint(e.clientX, e.clientY)) {
68
+ this.ripple.createRipple();
69
+ }
70
+ };
71
+ }
72
+
73
+ declare global {
74
+ interface HTMLElementTagNameMap {
75
+ 'u-checkbox': UmCheckbox;
76
+ }
77
+ }