@omicronenergy/oscd-ui 0.0.6 → 0.0.7

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 (464) hide show
  1. package/app-bar/OscdAppBar.d.ts +3 -3
  2. package/app-bar/OscdAppBar.js +12 -10
  3. package/app-bar/OscdAppBar.js.map +1 -1
  4. package/button/OscdFilledButton.js +2 -2
  5. package/button/OscdFilledButton.js.map +1 -1
  6. package/button/OscdOutlinedButton.js +1 -1
  7. package/button/OscdOutlinedButton.js.map +1 -1
  8. package/button/OscdTextButton.js +1 -1
  9. package/button/OscdTextButton.js.map +1 -1
  10. package/button/oscd-outlined-button.d.ts +1 -1
  11. package/button/oscd-outlined-button.js.map +1 -1
  12. package/dialog/OscdDialog.js +1 -1
  13. package/dialog/OscdDialog.js.map +1 -1
  14. package/divider/OscdDivider.js +1 -1
  15. package/divider/OscdDivider.js.map +1 -1
  16. package/elevation/OscdElevation.d.ts +1 -2
  17. package/elevation/OscdElevation.js +3 -4
  18. package/elevation/OscdElevation.js.map +1 -1
  19. package/elevation/_elevation.scss +6 -0
  20. package/elevation/internal/_elevation.scss +176 -0
  21. package/elevation/internal/elevation-styles.css +1 -0
  22. package/elevation/internal/elevation-styles.css.map +1 -0
  23. package/elevation/internal/elevation-styles.d.ts +1 -0
  24. package/elevation/internal/elevation-styles.js +10 -0
  25. package/elevation/internal/elevation-styles.js.map +1 -0
  26. package/elevation/internal/elevation-styles.scss +10 -0
  27. package/elevation/internal/elevation.d.ts +13 -0
  28. package/elevation/internal/elevation.js +21 -0
  29. package/elevation/internal/elevation.js.map +1 -0
  30. package/field/OscdFilledField.js +1 -1
  31. package/field/OscdFilledField.js.map +1 -1
  32. package/field/OscdOutlinedField.js +1 -1
  33. package/field/OscdOutlinedField.js.map +1 -1
  34. package/focus/OscdFocusRing.d.ts +5 -0
  35. package/focus/OscdFocusRing.js +6 -0
  36. package/focus/OscdFocusRing.js.map +1 -0
  37. package/focus/_focus-ring.scss +6 -0
  38. package/focus/internal/_focus-ring.scss +113 -0
  39. package/focus/internal/focus-ring-styles.css +1 -0
  40. package/focus/internal/focus-ring-styles.css.map +1 -0
  41. package/focus/internal/focus-ring-styles.d.ts +1 -0
  42. package/focus/internal/focus-ring-styles.js +10 -0
  43. package/focus/internal/focus-ring-styles.js.map +1 -0
  44. package/focus/internal/focus-ring-styles.scss +10 -0
  45. package/focus/internal/focus-ring.d.ts +39 -0
  46. package/focus/internal/focus-ring.js +101 -0
  47. package/focus/internal/focus-ring.js.map +1 -0
  48. package/focus/oscd-focus-ring.d.ts +21 -0
  49. package/focus/oscd-focus-ring.js +23 -0
  50. package/focus/oscd-focus-ring.js.map +1 -0
  51. package/icon/OscdIcon.js +1 -1
  52. package/icon/OscdIcon.js.map +1 -1
  53. package/iconbutton/OscdFilledIconButton.js +1 -1
  54. package/iconbutton/OscdFilledIconButton.js.map +1 -1
  55. package/iconbutton/OscdFilledTonalIconButton.js +1 -1
  56. package/iconbutton/OscdFilledTonalIconButton.js.map +1 -1
  57. package/iconbutton/OscdIconButton.js +1 -1
  58. package/iconbutton/OscdIconButton.js.map +1 -1
  59. package/iconbutton/OscdOutlinedIconButton.js +1 -1
  60. package/iconbutton/OscdOutlinedIconButton.js.map +1 -1
  61. package/internal/aria/aria.d.ts +103 -0
  62. package/internal/aria/aria.js +81 -0
  63. package/internal/aria/aria.js.map +1 -0
  64. package/internal/aria/delegate.d.ts +54 -0
  65. package/internal/aria/delegate.js +176 -0
  66. package/internal/aria/delegate.js.map +1 -0
  67. package/internal/controller/attachable-controller.d.ts +114 -0
  68. package/internal/controller/attachable-controller.js +121 -0
  69. package/internal/controller/attachable-controller.js.map +1 -0
  70. package/internal/controller/form-submitter.d.ts +70 -0
  71. package/internal/controller/form-submitter.js +69 -0
  72. package/internal/controller/form-submitter.js.map +1 -0
  73. package/internal/controller/is-rtl.d.ts +14 -0
  74. package/internal/controller/is-rtl.js +18 -0
  75. package/internal/controller/is-rtl.js.map +1 -0
  76. package/internal/controller/string-converter.d.ts +9 -0
  77. package/internal/controller/string-converter.js +14 -0
  78. package/internal/controller/string-converter.js.map +1 -0
  79. package/internal/events/dispatch-hooks.d.ts +85 -0
  80. package/internal/events/dispatch-hooks.js +151 -0
  81. package/internal/events/dispatch-hooks.js.map +1 -0
  82. package/internal/events/form-label-activation.d.ts +55 -0
  83. package/internal/events/form-label-activation.js +96 -0
  84. package/internal/events/form-label-activation.js.map +1 -0
  85. package/internal/events/redispatch-event.d.ts +27 -0
  86. package/internal/events/redispatch-event.js +40 -0
  87. package/internal/events/redispatch-event.js.map +1 -0
  88. package/internal/motion/_animation.scss +33 -0
  89. package/internal/motion/animation.d.ts +80 -0
  90. package/internal/motion/animation.js +101 -0
  91. package/internal/motion/animation.js.map +1 -0
  92. package/internal/sass/_string-ext.scss +195 -0
  93. package/internal/sass/_var.scss +237 -0
  94. package/labs/badge/OscdBadge.d.ts +14 -0
  95. package/labs/badge/OscdBadge.js +15 -0
  96. package/labs/badge/OscdBadge.js.map +1 -0
  97. package/labs/badge/_badge.scss +6 -0
  98. package/labs/badge/internal/_badge.scss +76 -0
  99. package/labs/badge/internal/badge-styles.css +1 -0
  100. package/labs/badge/internal/badge-styles.css.map +1 -0
  101. package/labs/badge/internal/badge-styles.d.ts +1 -0
  102. package/labs/badge/internal/badge-styles.js +10 -0
  103. package/labs/badge/internal/badge-styles.js.map +1 -0
  104. package/labs/badge/internal/badge-styles.scss +10 -0
  105. package/labs/badge/internal/badge.d.ts +13 -0
  106. package/labs/badge/internal/badge.js +28 -0
  107. package/labs/badge/internal/badge.js.map +1 -0
  108. package/labs/badge/oscd-badge.d.ts +19 -0
  109. package/labs/badge/oscd-badge.js +21 -0
  110. package/labs/badge/oscd-badge.js.map +1 -0
  111. package/labs/behaviors/constraint-validation.d.ts +133 -0
  112. package/labs/behaviors/constraint-validation.js +131 -0
  113. package/labs/behaviors/constraint-validation.js.map +1 -0
  114. package/labs/behaviors/element-internals.d.ts +45 -0
  115. package/labs/behaviors/element-internals.js +46 -0
  116. package/labs/behaviors/element-internals.js.map +1 -0
  117. package/labs/behaviors/focusable.d.ts +39 -0
  118. package/labs/behaviors/focusable.js +87 -0
  119. package/labs/behaviors/focusable.js.map +1 -0
  120. package/labs/behaviors/form-associated.d.ts +199 -0
  121. package/labs/behaviors/form-associated.js +175 -0
  122. package/labs/behaviors/form-associated.js.map +1 -0
  123. package/labs/behaviors/mixin.d.ts +54 -0
  124. package/labs/behaviors/mixin.js +7 -0
  125. package/labs/behaviors/mixin.js.map +1 -0
  126. package/labs/behaviors/on-report-validity.d.ts +71 -0
  127. package/labs/behaviors/on-report-validity.js +289 -0
  128. package/labs/behaviors/on-report-validity.js.map +1 -0
  129. package/labs/behaviors/validators/checkbox-validator.d.ts +35 -0
  130. package/labs/behaviors/validators/checkbox-validator.js +34 -0
  131. package/labs/behaviors/validators/checkbox-validator.js.map +1 -0
  132. package/labs/behaviors/validators/radio-validator.d.ts +38 -0
  133. package/labs/behaviors/validators/radio-validator.js +67 -0
  134. package/labs/behaviors/validators/radio-validator.js.map +1 -0
  135. package/labs/behaviors/validators/select-validator.d.ts +35 -0
  136. package/labs/behaviors/validators/select-validator.js +35 -0
  137. package/labs/behaviors/validators/select-validator.js.map +1 -0
  138. package/labs/behaviors/validators/text-field-validator.d.ts +110 -0
  139. package/labs/behaviors/validators/text-field-validator.js +156 -0
  140. package/labs/behaviors/validators/text-field-validator.js.map +1 -0
  141. package/labs/behaviors/validators/validator.d.ts +96 -0
  142. package/labs/behaviors/validators/validator.js +73 -0
  143. package/labs/behaviors/validators/validator.js.map +1 -0
  144. package/labs/card/OscdElevatedCard.d.ts +20 -0
  145. package/labs/card/OscdElevatedCard.js +23 -0
  146. package/labs/card/OscdElevatedCard.js.map +1 -0
  147. package/labs/card/OscdFilledCard.d.ts +20 -0
  148. package/labs/card/OscdFilledCard.js +23 -0
  149. package/labs/card/OscdFilledCard.js.map +1 -0
  150. package/labs/card/OscdOutlinedCard.d.ts +20 -0
  151. package/labs/card/OscdOutlinedCard.js +23 -0
  152. package/labs/card/OscdOutlinedCard.js.map +1 -0
  153. package/labs/card/_elevated-card.scss +6 -0
  154. package/labs/card/_filled-card.scss +6 -0
  155. package/labs/card/_outlined-card.scss +6 -0
  156. package/labs/card/demo/demo.d.ts +7 -0
  157. package/labs/card/demo/demo.js +13 -0
  158. package/labs/card/demo/demo.js.map +1 -0
  159. package/labs/card/demo/stories.d.ts +15 -0
  160. package/labs/card/demo/stories.js +104 -0
  161. package/labs/card/demo/stories.js.map +1 -0
  162. package/labs/card/internal/_elevated-card.scss +35 -0
  163. package/labs/card/internal/_filled-card.scss +35 -0
  164. package/labs/card/internal/_outlined-card.scss +40 -0
  165. package/labs/card/internal/_shared.scss +62 -0
  166. package/labs/card/internal/card.d.ts +12 -0
  167. package/labs/card/internal/card.js +21 -0
  168. package/labs/card/internal/card.js.map +1 -0
  169. package/labs/card/internal/elevated-styles.css +1 -0
  170. package/labs/card/internal/elevated-styles.css.map +1 -0
  171. package/labs/card/internal/elevated-styles.d.ts +1 -0
  172. package/labs/card/internal/elevated-styles.js +10 -0
  173. package/labs/card/internal/elevated-styles.js.map +1 -0
  174. package/labs/card/internal/elevated-styles.scss +10 -0
  175. package/labs/card/internal/filled-styles.css +1 -0
  176. package/labs/card/internal/filled-styles.css.map +1 -0
  177. package/labs/card/internal/filled-styles.d.ts +1 -0
  178. package/labs/card/internal/filled-styles.js +10 -0
  179. package/labs/card/internal/filled-styles.js.map +1 -0
  180. package/labs/card/internal/filled-styles.scss +10 -0
  181. package/labs/card/internal/outlined-styles.css +1 -0
  182. package/labs/card/internal/outlined-styles.css.map +1 -0
  183. package/labs/card/internal/outlined-styles.d.ts +1 -0
  184. package/labs/card/internal/outlined-styles.js +10 -0
  185. package/labs/card/internal/outlined-styles.js.map +1 -0
  186. package/labs/card/internal/outlined-styles.scss +10 -0
  187. package/labs/card/internal/shared-styles.css +1 -0
  188. package/labs/card/internal/shared-styles.css.map +1 -0
  189. package/labs/card/internal/shared-styles.d.ts +1 -0
  190. package/labs/card/internal/shared-styles.js +10 -0
  191. package/labs/card/internal/shared-styles.js.map +1 -0
  192. package/labs/card/internal/shared-styles.scss +10 -0
  193. package/labs/card/oscd-elevated-card.d.ts +20 -0
  194. package/labs/card/oscd-elevated-card.js +23 -0
  195. package/labs/card/oscd-elevated-card.js.map +1 -0
  196. package/labs/card/oscd-filled-card.d.ts +25 -0
  197. package/labs/card/oscd-filled-card.js +28 -0
  198. package/labs/card/oscd-filled-card.js.map +1 -0
  199. package/labs/card/oscd-outlined-card.d.ts +20 -0
  200. package/labs/card/oscd-outlined-card.js +23 -0
  201. package/labs/card/oscd-outlined-card.js.map +1 -0
  202. package/list/OscdList.js +1 -1
  203. package/list/OscdList.js.map +1 -1
  204. package/list/OscdListItem.d.ts +4 -0
  205. package/list/OscdListItem.js +13 -1
  206. package/list/OscdListItem.js.map +1 -1
  207. package/menu/OscdMenu.js +1 -1
  208. package/menu/OscdMenu.js.map +1 -1
  209. package/menu/OscdMenuItem.js +1 -1
  210. package/menu/OscdMenuItem.js.map +1 -1
  211. package/navigation-drawer/OscdNavigationDrawer.js +2 -2
  212. package/navigation-drawer/OscdNavigationDrawer.js.map +1 -1
  213. package/navigation-drawer/OscdNavigationDrawerHeader.js +2 -2
  214. package/navigation-drawer/OscdNavigationDrawerHeader.js.map +1 -1
  215. package/package.json +76 -110
  216. package/radio/OscdRadio.d.ts +31 -0
  217. package/radio/OscdRadio.js +27 -0
  218. package/radio/OscdRadio.js.map +1 -0
  219. package/radio/demo/demo.d.ts +7 -0
  220. package/radio/demo/demo.js +14 -0
  221. package/radio/demo/demo.js.map +1 -0
  222. package/radio/demo/stories.d.ts +13 -0
  223. package/radio/demo/stories.js +97 -0
  224. package/radio/demo/stories.js.map +1 -0
  225. package/radio/internal/_radio.scss +198 -0
  226. package/radio/internal/radio-styles.css +1 -0
  227. package/radio/internal/radio-styles.css.map +1 -0
  228. package/radio/internal/radio-styles.d.ts +1 -0
  229. package/radio/internal/radio-styles.js +10 -0
  230. package/radio/internal/radio-styles.js.map +1 -0
  231. package/radio/internal/radio-styles.scss +10 -0
  232. package/radio/internal/radio.d.ts +59 -0
  233. package/radio/internal/radio.js +175 -0
  234. package/radio/internal/radio.js.map +1 -0
  235. package/radio/internal/single-selection-controller.d.ts +80 -0
  236. package/radio/internal/single-selection-controller.js +199 -0
  237. package/radio/internal/single-selection-controller.js.map +1 -0
  238. package/radio/oscd-radio.d.ts +32 -0
  239. package/radio/oscd-radio.js +34 -0
  240. package/radio/oscd-radio.js.map +1 -0
  241. package/ripple/OscdRipple.d.ts +5 -0
  242. package/ripple/OscdRipple.js +6 -0
  243. package/ripple/OscdRipple.js.map +1 -0
  244. package/ripple/_ripple.scss +6 -0
  245. package/ripple/internal/_ripple.scss +92 -0
  246. package/ripple/internal/ripple-styles.css +1 -0
  247. package/ripple/internal/ripple-styles.css.map +1 -0
  248. package/ripple/internal/ripple-styles.d.ts +1 -0
  249. package/ripple/internal/ripple-styles.js +10 -0
  250. package/ripple/internal/ripple-styles.js.map +1 -0
  251. package/ripple/internal/ripple-styles.scss +10 -0
  252. package/ripple/internal/ripple.d.ts +76 -0
  253. package/ripple/internal/ripple.js +425 -0
  254. package/ripple/internal/ripple.js.map +1 -0
  255. package/ripple/oscd-ripple.d.ts +29 -0
  256. package/ripple/oscd-ripple.js +31 -0
  257. package/ripple/oscd-ripple.js.map +1 -0
  258. package/select/OscdFilledSelect.js +1 -1
  259. package/select/OscdFilledSelect.js.map +1 -1
  260. package/select/OscdOutlinedSelect.js +1 -1
  261. package/select/OscdOutlinedSelect.js.map +1 -1
  262. package/select/OscdSelectOption.js +1 -1
  263. package/select/OscdSelectOption.js.map +1 -1
  264. package/tabs/OscdPrimaryTab.js +1 -1
  265. package/tabs/OscdPrimaryTab.js.map +1 -1
  266. package/tabs/OscdSecondaryTab.js +1 -1
  267. package/tabs/OscdSecondaryTab.js.map +1 -1
  268. package/tabs/OscdTabs.js +1 -1
  269. package/tabs/OscdTabs.js.map +1 -1
  270. package/textfield/OscdFilledTextField.js +5 -2
  271. package/textfield/OscdFilledTextField.js.map +1 -1
  272. package/textfield/OscdOutlinedTextField.js +5 -2
  273. package/textfield/OscdOutlinedTextField.js.map +1 -1
  274. package/tokens/_index.scss +66 -0
  275. package/tokens/_md-comp-assist-chip.scss +153 -0
  276. package/tokens/_md-comp-badge.scss +39 -0
  277. package/tokens/_md-comp-checkbox.scss +156 -0
  278. package/tokens/_md-comp-circular-progress.scss +79 -0
  279. package/tokens/_md-comp-dialog.scss +112 -0
  280. package/tokens/_md-comp-divider.scss +43 -0
  281. package/tokens/_md-comp-elevated-button.scss +143 -0
  282. package/tokens/_md-comp-elevated-card.scss +80 -0
  283. package/tokens/_md-comp-elevation.scss +48 -0
  284. package/tokens/_md-comp-fab-branded.scss +155 -0
  285. package/tokens/_md-comp-fab.scss +296 -0
  286. package/tokens/_md-comp-filled-button.scss +143 -0
  287. package/tokens/_md-comp-filled-card.scss +80 -0
  288. package/tokens/_md-comp-filled-field.scss +293 -0
  289. package/tokens/_md-comp-filled-icon-button.scss +119 -0
  290. package/tokens/_md-comp-filled-select.scss +198 -0
  291. package/tokens/_md-comp-filled-text-field.scss +200 -0
  292. package/tokens/_md-comp-filled-tonal-button.scss +143 -0
  293. package/tokens/_md-comp-filled-tonal-icon-button.scss +123 -0
  294. package/tokens/_md-comp-filter-chip.scss +265 -0
  295. package/tokens/_md-comp-focus-ring.scss +78 -0
  296. package/tokens/_md-comp-full-screen-dialog.scss +25 -0
  297. package/tokens/_md-comp-icon-button.scss +94 -0
  298. package/tokens/_md-comp-icon.scss +46 -0
  299. package/tokens/_md-comp-input-chip.scss +247 -0
  300. package/tokens/_md-comp-item.scss +88 -0
  301. package/tokens/_md-comp-linear-progress.scss +64 -0
  302. package/tokens/_md-comp-list-item.scss +173 -0
  303. package/tokens/_md-comp-list.scss +44 -0
  304. package/tokens/_md-comp-menu-item.scss +125 -0
  305. package/tokens/_md-comp-menu.scss +59 -0
  306. package/tokens/_md-comp-navigation-bar.scss +44 -0
  307. package/tokens/_md-comp-navigation-drawer.scss +44 -0
  308. package/tokens/_md-comp-outlined-button.scss +139 -0
  309. package/tokens/_md-comp-outlined-card.scss +86 -0
  310. package/tokens/_md-comp-outlined-field.scss +268 -0
  311. package/tokens/_md-comp-outlined-icon-button.scss +117 -0
  312. package/tokens/_md-comp-outlined-segmented-button.scss +123 -0
  313. package/tokens/_md-comp-outlined-select.scss +186 -0
  314. package/tokens/_md-comp-outlined-text-field.scss +187 -0
  315. package/tokens/_md-comp-primary-tab.scss +160 -0
  316. package/tokens/_md-comp-radio.scss +86 -0
  317. package/tokens/_md-comp-ripple.scss +48 -0
  318. package/tokens/_md-comp-secondary-tab.scss +158 -0
  319. package/tokens/_md-comp-slider.scss +117 -0
  320. package/tokens/_md-comp-suggestion-chip.scss +157 -0
  321. package/tokens/_md-comp-switch.scss +187 -0
  322. package/tokens/_md-comp-test-table.scss +43 -0
  323. package/tokens/_md-comp-text-button.scss +132 -0
  324. package/tokens/_md-ref-palette.scss +112 -0
  325. package/tokens/_md-ref-typeface.scss +46 -0
  326. package/tokens/_md-sys-color.scss +119 -0
  327. package/tokens/_md-sys-elevation.scss +31 -0
  328. package/tokens/_md-sys-motion.scss +12 -0
  329. package/tokens/_md-sys-shape.scss +102 -0
  330. package/tokens/_md-sys-state.scss +12 -0
  331. package/tokens/_md-sys-typescale.scss +149 -0
  332. package/tokens/internal/_shape.scss +93 -0
  333. package/tokens/internal/_validate.scss +109 -0
  334. package/tokens/v0_192/_index.scss +107 -0
  335. package/tokens/v0_192/_md-comp-assist-chip.scss +111 -0
  336. package/tokens/v0_192/_md-comp-badge.scss +61 -0
  337. package/tokens/v0_192/_md-comp-banner.scss +76 -0
  338. package/tokens/v0_192/_md-comp-bottom-app-bar.scss +36 -0
  339. package/tokens/v0_192/_md-comp-carousel-item.scss +66 -0
  340. package/tokens/v0_192/_md-comp-checkbox.scss +129 -0
  341. package/tokens/v0_192/_md-comp-circular-progress-indicator.scss +41 -0
  342. package/tokens/v0_192/_md-comp-data-table.scss +99 -0
  343. package/tokens/v0_192/_md-comp-date-input-modal.scss +90 -0
  344. package/tokens/v0_192/_md-comp-date-picker-docked.scss +247 -0
  345. package/tokens/v0_192/_md-comp-date-picker-modal.scss +306 -0
  346. package/tokens/v0_192/_md-comp-dialog.scss +124 -0
  347. package/tokens/v0_192/_md-comp-divider.scss +28 -0
  348. package/tokens/v0_192/_md-comp-elevated-button.scss +92 -0
  349. package/tokens/v0_192/_md-comp-elevated-card.scss +60 -0
  350. package/tokens/v0_192/_md-comp-extended-fab-branded.scss +89 -0
  351. package/tokens/v0_192/_md-comp-extended-fab-primary.scss +97 -0
  352. package/tokens/v0_192/_md-comp-extended-fab-secondary.scss +98 -0
  353. package/tokens/v0_192/_md-comp-extended-fab-surface.scss +93 -0
  354. package/tokens/v0_192/_md-comp-extended-fab-tertiary.scss +98 -0
  355. package/tokens/v0_192/_md-comp-fab-branded-large.scss +63 -0
  356. package/tokens/v0_192/_md-comp-fab-branded.scss +63 -0
  357. package/tokens/v0_192/_md-comp-fab-primary-large.scss +68 -0
  358. package/tokens/v0_192/_md-comp-fab-primary-small.scss +68 -0
  359. package/tokens/v0_192/_md-comp-fab-primary.scss +68 -0
  360. package/tokens/v0_192/_md-comp-fab-secondary-large.scss +69 -0
  361. package/tokens/v0_192/_md-comp-fab-secondary-small.scss +69 -0
  362. package/tokens/v0_192/_md-comp-fab-secondary.scss +69 -0
  363. package/tokens/v0_192/_md-comp-fab-surface-large.scss +67 -0
  364. package/tokens/v0_192/_md-comp-fab-surface-small.scss +67 -0
  365. package/tokens/v0_192/_md-comp-fab-surface.scss +67 -0
  366. package/tokens/v0_192/_md-comp-fab-tertiary-large.scss +69 -0
  367. package/tokens/v0_192/_md-comp-fab-tertiary-small.scss +69 -0
  368. package/tokens/v0_192/_md-comp-fab-tertiary.scss +69 -0
  369. package/tokens/v0_192/_md-comp-filled-autocomplete.scss +239 -0
  370. package/tokens/v0_192/_md-comp-filled-button.scss +92 -0
  371. package/tokens/v0_192/_md-comp-filled-card.scss +62 -0
  372. package/tokens/v0_192/_md-comp-filled-icon-button.scss +83 -0
  373. package/tokens/v0_192/_md-comp-filled-menu-button.scss +101 -0
  374. package/tokens/v0_192/_md-comp-filled-select.scss +273 -0
  375. package/tokens/v0_192/_md-comp-filled-text-field.scss +193 -0
  376. package/tokens/v0_192/_md-comp-filled-tonal-button.scss +102 -0
  377. package/tokens/v0_192/_md-comp-filled-tonal-icon-button.scss +90 -0
  378. package/tokens/v0_192/_md-comp-filter-chip.scss +210 -0
  379. package/tokens/v0_192/_md-comp-full-screen-dialog.scss +114 -0
  380. package/tokens/v0_192/_md-comp-icon-button.scss +74 -0
  381. package/tokens/v0_192/_md-comp-input-chip.scss +187 -0
  382. package/tokens/v0_192/_md-comp-linear-progress-indicator.scss +43 -0
  383. package/tokens/v0_192/_md-comp-list.scss +255 -0
  384. package/tokens/v0_192/_md-comp-menu.scss +44 -0
  385. package/tokens/v0_192/_md-comp-navigation-bar.scss +115 -0
  386. package/tokens/v0_192/_md-comp-navigation-drawer.scss +165 -0
  387. package/tokens/v0_192/_md-comp-navigation-rail.scss +119 -0
  388. package/tokens/v0_192/_md-comp-outlined-autocomplete.scss +229 -0
  389. package/tokens/v0_192/_md-comp-outlined-button.scss +87 -0
  390. package/tokens/v0_192/_md-comp-outlined-card.scss +66 -0
  391. package/tokens/v0_192/_md-comp-outlined-icon-button.scss +83 -0
  392. package/tokens/v0_192/_md-comp-outlined-menu-button.scss +97 -0
  393. package/tokens/v0_192/_md-comp-outlined-segmented-button.scss +115 -0
  394. package/tokens/v0_192/_md-comp-outlined-select.scss +263 -0
  395. package/tokens/v0_192/_md-comp-outlined-text-field.scss +174 -0
  396. package/tokens/v0_192/_md-comp-plain-tooltip.scss +58 -0
  397. package/tokens/v0_192/_md-comp-primary-navigation-tab.scss +124 -0
  398. package/tokens/v0_192/_md-comp-radio-button.scss +71 -0
  399. package/tokens/v0_192/_md-comp-rich-tooltip.scss +122 -0
  400. package/tokens/v0_192/_md-comp-scrim.scss +28 -0
  401. package/tokens/v0_192/_md-comp-search-bar.scss +100 -0
  402. package/tokens/v0_192/_md-comp-search-view.scss +94 -0
  403. package/tokens/v0_192/_md-comp-secondary-navigation-tab.scss +87 -0
  404. package/tokens/v0_192/_md-comp-sheet-bottom.scss +46 -0
  405. package/tokens/v0_192/_md-comp-sheet-floating.scss +35 -0
  406. package/tokens/v0_192/_md-comp-sheet-side.scss +94 -0
  407. package/tokens/v0_192/_md-comp-slider.scss +118 -0
  408. package/tokens/v0_192/_md-comp-snackbar.scss +130 -0
  409. package/tokens/v0_192/_md-comp-standard-menu-button.scss +101 -0
  410. package/tokens/v0_192/_md-comp-suggestion-chip.scss +127 -0
  411. package/tokens/v0_192/_md-comp-switch.scss +141 -0
  412. package/tokens/v0_192/_md-comp-text-button.scss +80 -0
  413. package/tokens/v0_192/_md-comp-time-input.scss +220 -0
  414. package/tokens/v0_192/_md-comp-time-picker.scss +267 -0
  415. package/tokens/v0_192/_md-comp-top-app-bar-large.scss +64 -0
  416. package/tokens/v0_192/_md-comp-top-app-bar-medium.scss +64 -0
  417. package/tokens/v0_192/_md-comp-top-app-bar-small-centered.scss +71 -0
  418. package/tokens/v0_192/_md-comp-top-app-bar-small.scss +67 -0
  419. package/tokens/v0_192/_md-ref-palette.scss +109 -0
  420. package/tokens/v0_192/_md-ref-typeface.scss +23 -0
  421. package/tokens/v0_192/_md-sys-color.scss +135 -0
  422. package/tokens/v0_192/_md-sys-elevation.scss +24 -0
  423. package/tokens/v0_192/_md-sys-motion.scss +55 -0
  424. package/tokens/v0_192/_md-sys-shape.scss +33 -0
  425. package/tokens/v0_192/_md-sys-state.scss +22 -0
  426. package/tokens/v0_192/_md-sys-typescale.scss +286 -0
  427. package/tokens/v0_192/index.test.css +1 -0
  428. package/tokens/v0_192/index.test.css.map +1 -0
  429. package/tokens/v0_192/index.test.scss +584 -0
  430. package/tokens/v0_192/lib.test.css +1 -0
  431. package/tokens/v0_192/lib.test.css.map +1 -0
  432. package/tokens/v0_192/lib.test.scss +663 -0
  433. package/utils/storybook/getStorybookHelpers.js +0 -1
  434. package/utils/storybook/getStorybookHelpers.js.map +1 -1
  435. package/utils/storybook/scopedWcDecorator.js +1 -0
  436. package/utils/storybook/scopedWcDecorator.js.map +1 -1
  437. package/utils/storybook/stories/components/knob-ui-components.d.ts +103 -0
  438. package/utils/storybook/stories/components/knob-ui-components.js +414 -0
  439. package/utils/storybook/stories/components/knob-ui-components.js.map +1 -0
  440. package/utils/storybook/stories/components/stories-renderer.d.ts +40 -0
  441. package/utils/storybook/stories/components/stories-renderer.js +204 -0
  442. package/utils/storybook/stories/components/stories-renderer.js.map +1 -0
  443. package/utils/storybook/stories/components/story-knob-panel.d.ts +53 -0
  444. package/utils/storybook/stories/components/story-knob-panel.js +333 -0
  445. package/utils/storybook/stories/components/story-knob-panel.js.map +1 -0
  446. package/utils/storybook/stories/components/story-renderer.d.ts +27 -0
  447. package/utils/storybook/stories/components/story-renderer.js +84 -0
  448. package/utils/storybook/stories/components/story-renderer.js.map +1 -0
  449. package/utils/storybook/stories/index.d.ts +8 -0
  450. package/utils/storybook/stories/index.js +11 -0
  451. package/utils/storybook/stories/index.js.map +1 -0
  452. package/utils/storybook/stories/knobs.d.ts +143 -0
  453. package/utils/storybook/stories/knobs.js +177 -0
  454. package/utils/storybook/stories/knobs.js.map +1 -0
  455. package/utils/storybook/stories/material-collection.d.ts +75 -0
  456. package/utils/storybook/stories/material-collection.js +59 -0
  457. package/utils/storybook/stories/material-collection.js.map +1 -0
  458. package/utils/storybook/stories/story.d.ts +85 -0
  459. package/utils/storybook/stories/story.js +142 -0
  460. package/utils/storybook/stories/story.js.map +1 -0
  461. package/utils/storybook/stories/theme-loader.d.ts +13 -0
  462. package/utils/storybook/stories/theme-loader.js +43 -0
  463. package/utils/storybook/stories/theme-loader.js.map +1 -0
  464. package/utils/storybook/themingDecorator.d.ts +15 -2
@@ -0,0 +1,175 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { __decorate } from "tslib";
7
+ import { property } from 'lit/decorators.js';
8
+ import { internals } from './element-internals.js';
9
+ /**
10
+ * A symbol property to retrieve the form value for an element.
11
+ */
12
+ export const getFormValue = Symbol('getFormValue');
13
+ /**
14
+ * A symbol property to retrieve the form state for an element.
15
+ */
16
+ export const getFormState = Symbol('getFormState');
17
+ /**
18
+ * Mixes in form-associated behavior for a class. This allows an element to add
19
+ * values to `<form>` elements.
20
+ *
21
+ * Implementing classes should provide a `[formValue]` to return the current
22
+ * value of the element, as well as reset and restore callbacks.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const base = mixinFormAssociated(mixinElementInternals(LitElement));
27
+ *
28
+ * class MyControl extends base {
29
+ * \@property()
30
+ * value = '';
31
+ *
32
+ * override [getFormValue]() {
33
+ * return this.value;
34
+ * }
35
+ *
36
+ * override formResetCallback() {
37
+ * const defaultValue = this.getAttribute('value');
38
+ * this.value = defaultValue;
39
+ * }
40
+ *
41
+ * override formStateRestoreCallback(state: string) {
42
+ * this.value = state;
43
+ * }
44
+ * }
45
+ * ```
46
+ *
47
+ * Elements may optionally provide a `[formState]` if their values do not
48
+ * represent the state of the component.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * const base = mixinFormAssociated(mixinElementInternals(LitElement));
53
+ *
54
+ * class MyCheckbox extends base {
55
+ * \@property()
56
+ * value = 'on';
57
+ *
58
+ * \@property({type: Boolean})
59
+ * checked = false;
60
+ *
61
+ * override [getFormValue]() {
62
+ * return this.checked ? this.value : null;
63
+ * }
64
+ *
65
+ * override [getFormState]() {
66
+ * return String(this.checked);
67
+ * }
68
+ *
69
+ * override formResetCallback() {
70
+ * const defaultValue = this.hasAttribute('checked');
71
+ * this.checked = defaultValue;
72
+ * }
73
+ *
74
+ * override formStateRestoreCallback(state: string) {
75
+ * this.checked = Boolean(state);
76
+ * }
77
+ * }
78
+ * ```
79
+ *
80
+ * IMPORTANT: Requires declares for lit-analyzer
81
+ * @example
82
+ * ```ts
83
+ * const base = mixinFormAssociated(mixinElementInternals(LitElement));
84
+ * class MyControl extends base {
85
+ * // Writable mixin properties for lit-html binding, needed for lit-analyzer
86
+ * declare disabled: boolean;
87
+ * declare name: string;
88
+ * }
89
+ * ```
90
+ *
91
+ * @param base The class to mix functionality into. The base class must use
92
+ * `mixinElementInternals()`.
93
+ * @return The provided class with `FormAssociated` mixed in.
94
+ */
95
+ export function mixinFormAssociated(base) {
96
+ class FormAssociatedElement extends base {
97
+ /** @nocollapse */
98
+ static { this.formAssociated = true; }
99
+ get form() {
100
+ return this[internals].form;
101
+ }
102
+ get labels() {
103
+ return this[internals].labels;
104
+ }
105
+ // Use @property for the `name` and `disabled` properties to add them to the
106
+ // `observedAttributes` array and trigger `attributeChangedCallback()`.
107
+ //
108
+ // We don't use Lit's default getter/setter (`noAccessor: true`) because
109
+ // the attributes need to be updated synchronously to work with synchronous
110
+ // form APIs, and Lit updates attributes async by default.
111
+ get name() {
112
+ return this.getAttribute('name') ?? '';
113
+ }
114
+ set name(name) {
115
+ // Note: setting name to null or empty does not remove the attribute.
116
+ this.setAttribute('name', name);
117
+ // We don't need to call `requestUpdate()` since it's called synchronously
118
+ // in `attributeChangedCallback()`.
119
+ }
120
+ get disabled() {
121
+ return this.hasAttribute('disabled');
122
+ }
123
+ set disabled(disabled) {
124
+ this.toggleAttribute('disabled', disabled);
125
+ // We don't need to call `requestUpdate()` since it's called synchronously
126
+ // in `attributeChangedCallback()`.
127
+ }
128
+ attributeChangedCallback(name, old, value) {
129
+ // Manually `requestUpdate()` for `name` and `disabled` when their
130
+ // attribute or property changes.
131
+ // The properties update their attributes, so this callback is invoked
132
+ // immediately when the properties are set. We call `requestUpdate()` here
133
+ // instead of letting Lit set the properties from the attribute change.
134
+ // That would cause the properties to re-set the attribute and invoke this
135
+ // callback again in a loop. This leads to stale state when Lit tries to
136
+ // determine if a property changed or not.
137
+ if (name === 'name' || name === 'disabled') {
138
+ // Disabled's value is only false if the attribute is missing and null.
139
+ const oldValue = name === 'disabled' ? old !== null : old;
140
+ // Trigger a lit update when the attribute changes.
141
+ this.requestUpdate(name, oldValue);
142
+ return;
143
+ }
144
+ super.attributeChangedCallback(name, old, value);
145
+ }
146
+ requestUpdate(name, oldValue, options) {
147
+ super.requestUpdate(name, oldValue, options);
148
+ // If any properties change, update the form value, which may have changed
149
+ // as well.
150
+ // Update the form value synchronously in `requestUpdate()` rather than
151
+ // `update()` or `updated()`, which are async. This is necessary to ensure
152
+ // that form data is updated in time for synchronous event listeners.
153
+ this[internals].setFormValue(this[getFormValue](), this[getFormState]());
154
+ }
155
+ [getFormValue]() {
156
+ // Closure does not allow abstract symbol members, so a default
157
+ // implementation is needed.
158
+ throw new Error(`Implement [getFormValue] in ${this.constructor.name}`);
159
+ }
160
+ [getFormState]() {
161
+ return this[getFormValue]();
162
+ }
163
+ formDisabledCallback(disabled) {
164
+ this.disabled = disabled;
165
+ }
166
+ }
167
+ __decorate([
168
+ property({ noAccessor: true })
169
+ ], FormAssociatedElement.prototype, "name", null);
170
+ __decorate([
171
+ property({ type: Boolean, noAccessor: true })
172
+ ], FormAssociatedElement.prototype, "disabled", null);
173
+ return FormAssociatedElement;
174
+ }
175
+ //# sourceMappingURL=form-associated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-associated.js","sourceRoot":"","sources":["form-associated.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAwB,MAAM,wBAAwB,CAAC;AA0GzE;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6EG;AACH,MAAM,UAAU,mBAAmB,CAEjC,IAAO;IACP,MAAe,qBAAsB,SAAQ,IAAI;QAC/C,kBAAkB;iBACF,mBAAc,GAAG,IAAI,CAAC;QAEtC,IAAI,IAAI;YACN,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;QAC9B,CAAC;QAED,IAAI,MAAM;YACR,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;QAChC,CAAC;QAED,4EAA4E;QAC5E,uEAAuE;QACvE,EAAE;QACF,wEAAwE;QACxE,2EAA2E;QAC3E,0DAA0D;QAE1D,IAAI,IAAI;YACN,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACzC,CAAC;QACD,IAAI,IAAI,CAAC,IAAY;YACnB,qEAAqE;YACrE,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAChC,0EAA0E;YAC1E,mCAAmC;QACrC,CAAC;QAGD,IAAI,QAAQ;YACV,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QACvC,CAAC;QACD,IAAI,QAAQ,CAAC,QAAiB;YAC5B,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YAC3C,0EAA0E;YAC1E,mCAAmC;QACrC,CAAC;QAEQ,wBAAwB,CAC/B,IAAY,EACZ,GAAkB,EAClB,KAAoB;YAEpB,kEAAkE;YAClE,iCAAiC;YACjC,sEAAsE;YACtE,0EAA0E;YAC1E,uEAAuE;YACvE,0EAA0E;YAC1E,wEAAwE;YACxE,0CAA0C;YAC1C,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;gBAC3C,uEAAuE;gBACvE,MAAM,QAAQ,GAAG,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;gBAC1D,mDAAmD;gBACnD,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBACnC,OAAO;YACT,CAAC;YAED,KAAK,CAAC,wBAAwB,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QACnD,CAAC;QAEQ,aAAa,CACpB,IAAkB,EAClB,QAAkB,EAClB,OAA6B;YAE7B,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC7C,0EAA0E;YAC1E,WAAW;YACX,uEAAuE;YACvE,0EAA0E;YAC1E,qEAAqE;YACrE,IAAI,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QAC3E,CAAC;QAED,CAAC,YAAY,CAAC;YACZ,+DAA+D;YAC/D,4BAA4B;YAC5B,MAAM,IAAI,KAAK,CAAC,+BAA+B,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QAC1E,CAAC;QAED,CAAC,YAAY,CAAC;YACZ,OAAO,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9B,CAAC;QAED,oBAAoB,CAAC,QAAiB;YACpC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC3B,CAAC;;IAtED;QADC,QAAQ,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;qDAG9B;IASD;QADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;yDAG7C;IAmEH,OAAO,qBAAqB,CAAC;AAC/B,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { LitElement, PropertyDeclaration } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { internals, WithElementInternals } from './element-internals.js';\nimport { MixinBase, MixinReturn } from './mixin.js';\n\n/**\n * A form-associated element.\n *\n * IMPORTANT: Requires declares for lit-analyzer\n * @example\n * ```ts\n * const base = mixinFormAssociated(mixinElementInternals(LitElement));\n * class MyControl extends base {\n * // Writable mixin properties for lit-html binding, needed for lit-analyzer\n * declare disabled: boolean;\n * declare name: string;\n * }\n * ```\n */\nexport interface FormAssociated {\n /**\n * The associated form element with which this element's value will submit.\n */\n readonly form: HTMLFormElement | null;\n\n /**\n * The labels this element is associated with.\n */\n readonly labels: NodeList;\n\n /**\n * The HTML name to use in form submission.\n */\n name: string;\n\n /**\n * Whether or not the element is disabled.\n */\n disabled: boolean;\n\n /**\n * Gets the current form value of a component.\n *\n * @return The current form value.\n */\n [getFormValue](): FormValue | null;\n\n /**\n * Gets the current form state of a component. Defaults to the component's\n * `[formValue]`.\n *\n * Use this when the state of an element is different from its value, such as\n * checkboxes (internal boolean state and a user string value).\n *\n * @return The current form state, defaults to the form value.\n */\n [getFormState](): FormValue | null;\n\n /**\n * A callback for when a form component should be disabled or enabled. This\n * can be called in a variety of situations, such as disabled `<fieldset>`s.\n *\n * @param disabled Whether or not the form control should be disabled.\n */\n formDisabledCallback(disabled: boolean): void;\n\n /**\n * A callback for when the form requests to reset its value. Typically, the\n * default value that is reset is represented in the attribute of an element.\n *\n * This means the attribute used for the value should not update as the value\n * changes. For example, a checkbox should not change its default `checked`\n * attribute when selected. Ensure form values do not reflect.\n */\n formResetCallback(): void;\n\n /**\n * A callback for when the form restores the state of a component. For\n * example, when a page is reloaded or forms are autofilled.\n *\n * @param state The state to restore, or null to reset the form control's\n * value.\n * @param reason The reason state was restored, either `'restore'` or\n * `'autocomplete'`.\n */\n formStateRestoreCallback(\n state: FormRestoreState | null,\n reason: FormRestoreReason,\n ): void;\n\n /**\n * An optional callback for when the associated form changes.\n *\n * @param form The new associated form, or `null` if there is none.\n */\n formAssociatedCallback?(form: HTMLFormElement | null): void;\n}\n\n/**\n * The constructor of a `FormAssociated` element.\n */\nexport interface FormAssociatedConstructor {\n /**\n * Indicates that an element is participating in form association.\n */\n readonly formAssociated: true;\n}\n\n/**\n * A symbol property to retrieve the form value for an element.\n */\nexport const getFormValue = Symbol('getFormValue');\n\n/**\n * A symbol property to retrieve the form state for an element.\n */\nexport const getFormState = Symbol('getFormState');\n\n/**\n * Mixes in form-associated behavior for a class. This allows an element to add\n * values to `<form>` elements.\n *\n * Implementing classes should provide a `[formValue]` to return the current\n * value of the element, as well as reset and restore callbacks.\n *\n * @example\n * ```ts\n * const base = mixinFormAssociated(mixinElementInternals(LitElement));\n *\n * class MyControl extends base {\n * \\@property()\n * value = '';\n *\n * override [getFormValue]() {\n * return this.value;\n * }\n *\n * override formResetCallback() {\n * const defaultValue = this.getAttribute('value');\n * this.value = defaultValue;\n * }\n *\n * override formStateRestoreCallback(state: string) {\n * this.value = state;\n * }\n * }\n * ```\n *\n * Elements may optionally provide a `[formState]` if their values do not\n * represent the state of the component.\n *\n * @example\n * ```ts\n * const base = mixinFormAssociated(mixinElementInternals(LitElement));\n *\n * class MyCheckbox extends base {\n * \\@property()\n * value = 'on';\n *\n * \\@property({type: Boolean})\n * checked = false;\n *\n * override [getFormValue]() {\n * return this.checked ? this.value : null;\n * }\n *\n * override [getFormState]() {\n * return String(this.checked);\n * }\n *\n * override formResetCallback() {\n * const defaultValue = this.hasAttribute('checked');\n * this.checked = defaultValue;\n * }\n *\n * override formStateRestoreCallback(state: string) {\n * this.checked = Boolean(state);\n * }\n * }\n * ```\n *\n * IMPORTANT: Requires declares for lit-analyzer\n * @example\n * ```ts\n * const base = mixinFormAssociated(mixinElementInternals(LitElement));\n * class MyControl extends base {\n * // Writable mixin properties for lit-html binding, needed for lit-analyzer\n * declare disabled: boolean;\n * declare name: string;\n * }\n * ```\n *\n * @param base The class to mix functionality into. The base class must use\n * `mixinElementInternals()`.\n * @return The provided class with `FormAssociated` mixed in.\n */\nexport function mixinFormAssociated<\n T extends MixinBase<LitElement & WithElementInternals>,\n>(base: T): MixinReturn<T & FormAssociatedConstructor, FormAssociated> {\n abstract class FormAssociatedElement extends base implements FormAssociated {\n /** @nocollapse */\n static readonly formAssociated = true;\n\n get form() {\n return this[internals].form;\n }\n\n get labels() {\n return this[internals].labels;\n }\n\n // Use @property for the `name` and `disabled` properties to add them to the\n // `observedAttributes` array and trigger `attributeChangedCallback()`.\n //\n // We don't use Lit's default getter/setter (`noAccessor: true`) because\n // the attributes need to be updated synchronously to work with synchronous\n // form APIs, and Lit updates attributes async by default.\n @property({ noAccessor: true })\n get name() {\n return this.getAttribute('name') ?? '';\n }\n set name(name: string) {\n // Note: setting name to null or empty does not remove the attribute.\n this.setAttribute('name', name);\n // We don't need to call `requestUpdate()` since it's called synchronously\n // in `attributeChangedCallback()`.\n }\n\n @property({ type: Boolean, noAccessor: true })\n get disabled() {\n return this.hasAttribute('disabled');\n }\n set disabled(disabled: boolean) {\n this.toggleAttribute('disabled', disabled);\n // We don't need to call `requestUpdate()` since it's called synchronously\n // in `attributeChangedCallback()`.\n }\n\n override attributeChangedCallback(\n name: string,\n old: string | null,\n value: string | null,\n ) {\n // Manually `requestUpdate()` for `name` and `disabled` when their\n // attribute or property changes.\n // The properties update their attributes, so this callback is invoked\n // immediately when the properties are set. We call `requestUpdate()` here\n // instead of letting Lit set the properties from the attribute change.\n // That would cause the properties to re-set the attribute and invoke this\n // callback again in a loop. This leads to stale state when Lit tries to\n // determine if a property changed or not.\n if (name === 'name' || name === 'disabled') {\n // Disabled's value is only false if the attribute is missing and null.\n const oldValue = name === 'disabled' ? old !== null : old;\n // Trigger a lit update when the attribute changes.\n this.requestUpdate(name, oldValue);\n return;\n }\n\n super.attributeChangedCallback(name, old, value);\n }\n\n override requestUpdate(\n name?: PropertyKey,\n oldValue?: unknown,\n options?: PropertyDeclaration,\n ) {\n super.requestUpdate(name, oldValue, options);\n // If any properties change, update the form value, which may have changed\n // as well.\n // Update the form value synchronously in `requestUpdate()` rather than\n // `update()` or `updated()`, which are async. This is necessary to ensure\n // that form data is updated in time for synchronous event listeners.\n this[internals].setFormValue(this[getFormValue](), this[getFormState]());\n }\n\n [getFormValue](): FormValue | null {\n // Closure does not allow abstract symbol members, so a default\n // implementation is needed.\n throw new Error(`Implement [getFormValue] in ${this.constructor.name}`);\n }\n\n [getFormState](): FormValue | null {\n return this[getFormValue]();\n }\n\n formDisabledCallback(disabled: boolean) {\n this.disabled = disabled;\n }\n\n abstract formResetCallback(): void;\n\n abstract formStateRestoreCallback(\n state: FormRestoreState | null,\n reason: FormRestoreReason,\n ): void;\n }\n\n return FormAssociatedElement;\n}\n\n/**\n * A value that can be provided for form submission and state.\n */\nexport type FormValue = File | string | FormData;\n\n/**\n * A value to be restored for a component's form value. If a component's form\n * state is a `FormData` object, its entry list of name and values will be\n * provided.\n */\nexport type FormRestoreState =\n | File\n | string\n | Array<[string, FormDataEntryValue]>;\n\n/**\n * The reason a form component is being restored for, either `'restore'` for\n * browser restoration or `'autocomplete'` for restoring user values.\n */\nexport type FormRestoreReason = 'restore' | 'autocomplete';\n"]}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * The base class for a mixin with an optional expected base class type.
8
+ *
9
+ * @template ExpectedBase Optional expected base class type, such as
10
+ * `LitElement`.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * interface Foo {
15
+ * isFoo: boolean;
16
+ * }
17
+ *
18
+ * function mixinFoo<T extends MixinBase>(base: T): MixinReturn<T, Foo> {
19
+ * // Mixins must be `abstract`
20
+ * abstract class FooImpl extends base implements Foo {
21
+ * isFoo = true;
22
+ * }
23
+ *
24
+ * return FooImpl;
25
+ * }
26
+ * ```
27
+ */
28
+ export type MixinBase<ExpectedBase = object> = abstract new (...args: any[]) => ExpectedBase;
29
+ /**
30
+ * The return value of a mixin.
31
+ *
32
+ * @template MixinBase The generic that extends `MixinBase` used for the mixin's
33
+ * base class argument.
34
+ * @template MixinClass Optional interface of fuctionality that was mixed in.
35
+ * Omit if no additional APIs were added (such as purely overriding base
36
+ * class functionality).
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * interface Foo {
41
+ * isFoo: boolean;
42
+ * }
43
+ *
44
+ * // Mixins must be `abstract`
45
+ * function mixinFoo<T extends MixinBase>(base: T): MixinReturn<T, Foo> {
46
+ * abstract class FooImpl extends base implements Foo {
47
+ * isFoo = true;
48
+ * }
49
+ *
50
+ * return FooImpl;
51
+ * }
52
+ * ```
53
+ */
54
+ export type MixinReturn<MixinBase, MixinClass = object> = (abstract new (...args: any[]) => MixinClass) & MixinBase;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=mixin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixin.js","sourceRoot":"","sources":["mixin.ts"],"names":[],"mappings":"AAAA;;;;GAIG","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The base class for a mixin with an optional expected base class type.\n *\n * @template ExpectedBase Optional expected base class type, such as\n * `LitElement`.\n *\n * @example\n * ```ts\n * interface Foo {\n * isFoo: boolean;\n * }\n *\n * function mixinFoo<T extends MixinBase>(base: T): MixinReturn<T, Foo> {\n * // Mixins must be `abstract`\n * abstract class FooImpl extends base implements Foo {\n * isFoo = true;\n * }\n *\n * return FooImpl;\n * }\n * ```\n */\nexport type MixinBase<ExpectedBase = object> = abstract new (\n // Mixins must have a constructor with `...args: any[]`\n // tslint:disable-next-line:no-any\n ...args: any[]\n) => ExpectedBase;\n\n/**\n * The return value of a mixin.\n *\n * @template MixinBase The generic that extends `MixinBase` used for the mixin's\n * base class argument.\n * @template MixinClass Optional interface of fuctionality that was mixed in.\n * Omit if no additional APIs were added (such as purely overriding base\n * class functionality).\n *\n * @example\n * ```ts\n * interface Foo {\n * isFoo: boolean;\n * }\n *\n * // Mixins must be `abstract`\n * function mixinFoo<T extends MixinBase>(base: T): MixinReturn<T, Foo> {\n * abstract class FooImpl extends base implements Foo {\n * isFoo = true;\n * }\n *\n * return FooImpl;\n * }\n * ```\n */\nexport type MixinReturn<MixinBase, MixinClass = object> =\n // Mixins must have a constructor with `...args: any[]`\n // tslint:disable-next-line:no-any\n (abstract new (...args: any[]) => MixinClass) & MixinBase;\n"]}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { LitElement } from 'lit';
7
+ import { ConstraintValidation } from './constraint-validation.js';
8
+ import { WithElementInternals } from './element-internals.js';
9
+ import { MixinBase, MixinReturn } from './mixin.js';
10
+ /**
11
+ * A constraint validation element that has a callback for when the element
12
+ * should report validity styles and error messages to the user.
13
+ *
14
+ * This is commonly used in text-field-like controls that display error styles
15
+ * and error messages.
16
+ */
17
+ export interface OnReportValidity extends ConstraintValidation {
18
+ /**
19
+ * A callback that is invoked when validity should be reported. Components
20
+ * that can display their own error state can use this and update their
21
+ * styles.
22
+ *
23
+ * If an invalid event is provided, the element is invalid. If `null`, the
24
+ * element is valid.
25
+ *
26
+ * The invalid event's `preventDefault()` may be called to stop the platform
27
+ * popup from displaying.
28
+ *
29
+ * @param invalidEvent The `invalid` event dispatched when an element is
30
+ * invalid, or `null` if the element is valid.
31
+ */
32
+ [onReportValidity](invalidEvent: Event | null): void;
33
+ formAssociatedCallback(form: HTMLFormElement | null): void;
34
+ }
35
+ /**
36
+ * A symbol property used for a callback when validity has been reported.
37
+ */
38
+ export declare const onReportValidity: unique symbol;
39
+ /**
40
+ * Mixes in a callback for constraint validation when validity should be
41
+ * styled and reported to the user.
42
+ *
43
+ * This is commonly used in text-field-like controls that display error styles
44
+ * and error messages.
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * const baseClass = mixinOnReportValidity(
49
+ * mixinConstraintValidation(
50
+ * mixinFormAssociated(mixinElementInternals(LitElement)),
51
+ * ),
52
+ * );
53
+ *
54
+ * class MyField extends baseClass {
55
+ * \@property({type: Boolean}) error = false;
56
+ * \@property() errorMessage = '';
57
+ *
58
+ * [onReportValidity](invalidEvent: Event | null) {
59
+ * this.error = !!invalidEvent;
60
+ * this.errorMessage = this.validationMessage;
61
+ *
62
+ * // Optionally prevent platform popup from displaying
63
+ * invalidEvent?.preventDefault();
64
+ * }
65
+ * }
66
+ * ```
67
+ *
68
+ * @param base The class to mix functionality into.
69
+ * @return The provided class with `OnReportValidity` mixed in.
70
+ */
71
+ export declare function mixinOnReportValidity<T extends MixinBase<LitElement & ConstraintValidation & WithElementInternals>>(base: T): MixinReturn<T, OnReportValidity>;
@@ -0,0 +1,289 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { isServer } from 'lit';
7
+ import { internals } from './element-internals.js';
8
+ /**
9
+ * A symbol property used for a callback when validity has been reported.
10
+ */
11
+ export const onReportValidity = Symbol('onReportValidity');
12
+ // Private symbol members, used to avoid name clashing.
13
+ const privateCleanupFormListeners = Symbol('privateCleanupFormListeners');
14
+ const privateDoNotReportInvalid = Symbol('privateDoNotReportInvalid');
15
+ const privateIsSelfReportingValidity = Symbol('privateIsSelfReportingValidity');
16
+ const privateCallOnReportValidity = Symbol('privateCallOnReportValidity');
17
+ /**
18
+ * Mixes in a callback for constraint validation when validity should be
19
+ * styled and reported to the user.
20
+ *
21
+ * This is commonly used in text-field-like controls that display error styles
22
+ * and error messages.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const baseClass = mixinOnReportValidity(
27
+ * mixinConstraintValidation(
28
+ * mixinFormAssociated(mixinElementInternals(LitElement)),
29
+ * ),
30
+ * );
31
+ *
32
+ * class MyField extends baseClass {
33
+ * \@property({type: Boolean}) error = false;
34
+ * \@property() errorMessage = '';
35
+ *
36
+ * [onReportValidity](invalidEvent: Event | null) {
37
+ * this.error = !!invalidEvent;
38
+ * this.errorMessage = this.validationMessage;
39
+ *
40
+ * // Optionally prevent platform popup from displaying
41
+ * invalidEvent?.preventDefault();
42
+ * }
43
+ * }
44
+ * ```
45
+ *
46
+ * @param base The class to mix functionality into.
47
+ * @return The provided class with `OnReportValidity` mixed in.
48
+ */
49
+ export function mixinOnReportValidity(base) {
50
+ var _a, _b, _c;
51
+ class OnReportValidityElement extends base {
52
+ // Mixins must have a constructor with `...args: any[]`
53
+ // tslint:disable-next-line:no-any
54
+ constructor(...args) {
55
+ super(...args);
56
+ /**
57
+ * Used to clean up event listeners when a new form is associated.
58
+ */
59
+ this[_a] = new AbortController();
60
+ /**
61
+ * Used to determine if an invalid event should report validity. Invalid
62
+ * events from `checkValidity()` do not trigger reporting.
63
+ */
64
+ this[_b] = false;
65
+ /**
66
+ * Used to determine if the control is reporting validity from itself, or
67
+ * if a `<form>` is causing the validity report. Forms have different
68
+ * control focusing behavior.
69
+ */
70
+ this[_c] = false;
71
+ if (isServer) {
72
+ return;
73
+ }
74
+ this.addEventListener('invalid', invalidEvent => {
75
+ // Listen for invalid events dispatched by a `<form>` when it tries to
76
+ // submit and the element is invalid. We ignore events dispatched when
77
+ // calling `checkValidity()` as well as untrusted events, since the
78
+ // `reportValidity()` and `<form>`-dispatched events are always
79
+ // trusted.
80
+ if (this[privateDoNotReportInvalid] || !invalidEvent.isTrusted) {
81
+ return;
82
+ }
83
+ this.addEventListener('invalid', () => {
84
+ // A normal bubbling phase event listener. By adding it here, we
85
+ // ensure it's the last event listener that is called during the
86
+ // bubbling phase.
87
+ this[privateCallOnReportValidity](invalidEvent);
88
+ }, { once: true });
89
+ }, {
90
+ // Listen during the capture phase, which will happen before the
91
+ // bubbling phase. That way, we can add a final event listener that
92
+ // will run after other event listeners, and we can check if it was
93
+ // default prevented. This works because invalid does not bubble.
94
+ capture: true,
95
+ });
96
+ }
97
+ checkValidity() {
98
+ this[privateDoNotReportInvalid] = true;
99
+ const valid = super.checkValidity();
100
+ this[privateDoNotReportInvalid] = false;
101
+ return valid;
102
+ }
103
+ reportValidity() {
104
+ this[privateIsSelfReportingValidity] = true;
105
+ const valid = super.reportValidity();
106
+ // Constructor's invalid listener will handle reporting invalid events.
107
+ if (valid) {
108
+ this[privateCallOnReportValidity](null);
109
+ }
110
+ this[privateIsSelfReportingValidity] = false;
111
+ return valid;
112
+ }
113
+ [(_a = privateCleanupFormListeners, _b = privateDoNotReportInvalid, _c = privateIsSelfReportingValidity, privateCallOnReportValidity)](invalidEvent) {
114
+ // Since invalid events do not bubble to parent listeners, and because
115
+ // our invalid listeners are added lazily after other listeners, we can
116
+ // reliably read `defaultPrevented` synchronously without worrying
117
+ // about waiting for another listener that could cancel it.
118
+ const wasCanceled = invalidEvent?.defaultPrevented;
119
+ if (wasCanceled) {
120
+ return;
121
+ }
122
+ this[onReportValidity](invalidEvent);
123
+ // If an implementation calls invalidEvent.preventDefault() to stop the
124
+ // platform popup from displaying, focusing is also prevented, so we need
125
+ // to manually focus.
126
+ const implementationCanceledFocus = !wasCanceled && invalidEvent?.defaultPrevented;
127
+ if (!implementationCanceledFocus) {
128
+ return;
129
+ }
130
+ // The control should be focused when:
131
+ // - `control.reportValidity()` is called (self-reporting).
132
+ // - a form is reporting validity for its controls and this is the first
133
+ // invalid control.
134
+ if (this[privateIsSelfReportingValidity] ||
135
+ isFirstInvalidControlInForm(this[internals].form, this)) {
136
+ this.focus();
137
+ }
138
+ }
139
+ [onReportValidity](_invalidEvent) {
140
+ throw new Error(`Implement [onReportValidity] in ${this.constructor.name}`);
141
+ }
142
+ formAssociatedCallback(form) {
143
+ // can't use super.formAssociatedCallback?.() due to closure
144
+ if (super.formAssociatedCallback) {
145
+ super.formAssociatedCallback(form);
146
+ }
147
+ // Clean up previous form listeners.
148
+ this[privateCleanupFormListeners].abort();
149
+ if (!form) {
150
+ return;
151
+ }
152
+ this[privateCleanupFormListeners] = new AbortController();
153
+ // Add a listener that fires when the form runs constraint validation and
154
+ // the control is valid, so that it may remove its error styles.
155
+ //
156
+ // This happens on `form.reportValidity()` and `form.requestSubmit()`
157
+ // (both when the submit fails and passes).
158
+ addFormReportValidListener(this, form, () => {
159
+ this[privateCallOnReportValidity](null);
160
+ }, this[privateCleanupFormListeners].signal);
161
+ }
162
+ }
163
+ return OnReportValidityElement;
164
+ }
165
+ /**
166
+ * Add a listener that fires when a form runs constraint validation on a control
167
+ * and it is valid. This is needed to clear previously invalid styles.
168
+ *
169
+ * @param control The control of the form to listen for valid events.
170
+ * @param form The control's form that can run constraint validation.
171
+ * @param onControlValid A listener that is called when the form runs constraint
172
+ * validation and the control is valid.
173
+ * @param cleanup A cleanup signal to remove the listener.
174
+ */
175
+ function addFormReportValidListener(control, form, onControlValid, cleanup) {
176
+ const validateHooks = getFormValidateHooks(form);
177
+ // When a form validates its controls, check if an invalid event is dispatched
178
+ // on the control. If it is not, then inform the control to report its valid
179
+ // state.
180
+ let controlFiredInvalid = false;
181
+ let cleanupInvalidListener;
182
+ let isNextSubmitFromHook = false;
183
+ validateHooks.addEventListener('before', () => {
184
+ isNextSubmitFromHook = true;
185
+ cleanupInvalidListener = new AbortController();
186
+ controlFiredInvalid = false;
187
+ control.addEventListener('invalid', () => {
188
+ controlFiredInvalid = true;
189
+ }, {
190
+ signal: cleanupInvalidListener.signal,
191
+ });
192
+ }, { signal: cleanup });
193
+ validateHooks.addEventListener('after', () => {
194
+ isNextSubmitFromHook = false;
195
+ cleanupInvalidListener?.abort();
196
+ if (controlFiredInvalid) {
197
+ return;
198
+ }
199
+ onControlValid();
200
+ }, { signal: cleanup });
201
+ // The above hooks handle imperatively submitting the form, but not
202
+ // declaratively submitting the form. This happens when:
203
+ // 1. A non-custom element `<button type="submit">` is clicked.
204
+ // 2. Enter is pressed on a non-custom element text editable `<input>`.
205
+ form.addEventListener('submit', () => {
206
+ // This submit was from `form.requestSubmit()`, which already calls the
207
+ // listener.
208
+ if (isNextSubmitFromHook) {
209
+ return;
210
+ }
211
+ onControlValid();
212
+ }, {
213
+ signal: cleanup,
214
+ });
215
+ // Note: it is a known limitation that we cannot detect if a form tries to
216
+ // submit declaratively, but fails to do so because an unrelated sibling
217
+ // control failed its constraint validation.
218
+ //
219
+ // Since we cannot detect when that happens, a previously invalid control may
220
+ // not clear its error styling when it becomes valid again.
221
+ //
222
+ // To work around this, call `form.reportValidity()` when submitting a form
223
+ // declaratively. This can be down on the `<button type="submit">`'s click or
224
+ // the text editable `<input>`'s 'Enter' keydown.
225
+ }
226
+ const FORM_VALIDATE_HOOKS = new WeakMap();
227
+ /**
228
+ * Get a hooks `EventTarget` that dispatches 'before' and 'after' events that
229
+ * fire before a form runs constraint validation and immediately after it
230
+ * finishes running constraint validation on its controls.
231
+ *
232
+ * This happens during `form.reportValidity()` and `form.requestSubmit()`.
233
+ *
234
+ * @param form The form to get or set up hooks for.
235
+ * @return A hooks `EventTarget` to add listeners to.
236
+ */
237
+ function getFormValidateHooks(form) {
238
+ if (!FORM_VALIDATE_HOOKS.has(form)) {
239
+ // Patch form methods to add event listener hooks. These are needed to react
240
+ // to form behaviors that do not dispatch events, such as a form asking its
241
+ // controls to report their validity.
242
+ //
243
+ // We should only patch the methods once, since multiple controls and other
244
+ // forces may want to patch this method. We cannot reliably clean it up if
245
+ // there are multiple patched and re-patched methods referring holding
246
+ // references to each other.
247
+ //
248
+ // Instead, we never clean up the patch but add and clean up event listeners
249
+ // added to the hooks after the patch.
250
+ const hooks = new EventTarget();
251
+ FORM_VALIDATE_HOOKS.set(form, hooks);
252
+ // Add hooks to support notifying before and after a form has run constraint
253
+ // validation on its controls.
254
+ // Note: `form.submit()` does not run constraint validation per spec.
255
+ for (const methodName of ['reportValidity', 'requestSubmit']) {
256
+ const superMethod = form[methodName];
257
+ form[methodName] = function (...args) {
258
+ hooks.dispatchEvent(new Event('before'));
259
+ const result = Reflect.apply(superMethod, this, args);
260
+ hooks.dispatchEvent(new Event('after'));
261
+ return result;
262
+ };
263
+ }
264
+ }
265
+ return FORM_VALIDATE_HOOKS.get(form);
266
+ }
267
+ /**
268
+ * Checks if a control is the first invalid control in a form.
269
+ *
270
+ * @param form The control's form. When `null`, the control doesn't have a form
271
+ * and the method returns true.
272
+ * @param control The control to check.
273
+ * @return True if there is no form or if the control is the form's first
274
+ * invalid control.
275
+ */
276
+ function isFirstInvalidControlInForm(form, control) {
277
+ if (!form) {
278
+ return true;
279
+ }
280
+ let firstInvalidControl;
281
+ for (const element of Array.from(form.elements)) {
282
+ if (element.matches(':invalid')) {
283
+ firstInvalidControl = element;
284
+ break;
285
+ }
286
+ }
287
+ return firstInvalidControl === control;
288
+ }
289
+ //# sourceMappingURL=on-report-validity.js.map