@material/web 2.4.1 → 2.4.2-nightly.082faad.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (450) hide show
  1. package/button/internal/button.d.ts +2 -21
  2. package/button/internal/button.js +4 -43
  3. package/button/internal/button.js.map +1 -1
  4. package/button/internal/elevated-styles.d.ts +2 -0
  5. package/button/internal/elevated-styles.js +1 -0
  6. package/button/internal/elevated-styles.js.map +1 -1
  7. package/button/internal/filled-styles.d.ts +2 -0
  8. package/button/internal/filled-styles.js +1 -0
  9. package/button/internal/filled-styles.js.map +1 -1
  10. package/button/internal/filled-tonal-styles.d.ts +2 -0
  11. package/button/internal/filled-tonal-styles.js +1 -0
  12. package/button/internal/filled-tonal-styles.js.map +1 -1
  13. package/button/internal/outlined-styles.d.ts +2 -0
  14. package/button/internal/outlined-styles.js +1 -0
  15. package/button/internal/outlined-styles.js.map +1 -1
  16. package/button/internal/shared-elevation-styles.d.ts +2 -0
  17. package/button/internal/shared-elevation-styles.js +1 -0
  18. package/button/internal/shared-elevation-styles.js.map +1 -1
  19. package/button/internal/shared-styles.d.ts +2 -0
  20. package/button/internal/shared-styles.js +1 -0
  21. package/button/internal/shared-styles.js.map +1 -1
  22. package/button/internal/text-styles.d.ts +2 -0
  23. package/button/internal/text-styles.js +1 -0
  24. package/button/internal/text-styles.js.map +1 -1
  25. package/checkbox/internal/checkbox-styles.d.ts +2 -0
  26. package/checkbox/internal/checkbox-styles.js +1 -0
  27. package/checkbox/internal/checkbox-styles.js.map +1 -1
  28. package/chips/internal/assist-styles.d.ts +2 -0
  29. package/chips/internal/assist-styles.js +1 -0
  30. package/chips/internal/assist-styles.js.map +1 -1
  31. package/chips/internal/chip-set-styles.d.ts +2 -0
  32. package/chips/internal/chip-set-styles.js +1 -0
  33. package/chips/internal/chip-set-styles.js.map +1 -1
  34. package/chips/internal/elevated-styles.d.ts +2 -0
  35. package/chips/internal/elevated-styles.js +1 -0
  36. package/chips/internal/elevated-styles.js.map +1 -1
  37. package/chips/internal/filter-styles.d.ts +2 -0
  38. package/chips/internal/filter-styles.js +1 -0
  39. package/chips/internal/filter-styles.js.map +1 -1
  40. package/chips/internal/input-styles.d.ts +2 -0
  41. package/chips/internal/input-styles.js +1 -0
  42. package/chips/internal/input-styles.js.map +1 -1
  43. package/chips/internal/selectable-styles.d.ts +2 -0
  44. package/chips/internal/selectable-styles.js +1 -0
  45. package/chips/internal/selectable-styles.js.map +1 -1
  46. package/chips/internal/shared-styles.d.ts +2 -0
  47. package/chips/internal/shared-styles.js +1 -0
  48. package/chips/internal/shared-styles.js.map +1 -1
  49. package/chips/internal/suggestion-styles.d.ts +2 -0
  50. package/chips/internal/suggestion-styles.js +1 -0
  51. package/chips/internal/suggestion-styles.js.map +1 -1
  52. package/chips/internal/trailing-icon-styles.d.ts +2 -0
  53. package/chips/internal/trailing-icon-styles.js +1 -0
  54. package/chips/internal/trailing-icon-styles.js.map +1 -1
  55. package/dialog/internal/dialog-styles.d.ts +2 -0
  56. package/dialog/internal/dialog-styles.js +1 -0
  57. package/dialog/internal/dialog-styles.js.map +1 -1
  58. package/divider/internal/divider-styles.d.ts +2 -0
  59. package/divider/internal/divider-styles.js +1 -0
  60. package/divider/internal/divider-styles.js.map +1 -1
  61. package/elevation/internal/elevation-styles.d.ts +2 -0
  62. package/elevation/internal/elevation-styles.js +1 -0
  63. package/elevation/internal/elevation-styles.js.map +1 -1
  64. package/fab/internal/fab-branded-styles.d.ts +2 -0
  65. package/fab/internal/fab-branded-styles.js +1 -0
  66. package/fab/internal/fab-branded-styles.js.map +1 -1
  67. package/fab/internal/fab-styles.d.ts +2 -0
  68. package/fab/internal/fab-styles.js +1 -0
  69. package/fab/internal/fab-styles.js.map +1 -1
  70. package/fab/internal/forced-colors-styles.d.ts +2 -0
  71. package/fab/internal/forced-colors-styles.js +1 -0
  72. package/fab/internal/forced-colors-styles.js.map +1 -1
  73. package/fab/internal/shared-styles.d.ts +2 -0
  74. package/fab/internal/shared-styles.js +1 -0
  75. package/fab/internal/shared-styles.js.map +1 -1
  76. package/field/internal/field.js +12 -1
  77. package/field/internal/field.js.map +1 -1
  78. package/field/internal/filled-styles.d.ts +2 -0
  79. package/field/internal/filled-styles.js +1 -0
  80. package/field/internal/filled-styles.js.map +1 -1
  81. package/field/internal/outlined-styles.d.ts +2 -0
  82. package/field/internal/outlined-styles.js +1 -0
  83. package/field/internal/outlined-styles.js.map +1 -1
  84. package/field/internal/shared-styles.d.ts +2 -0
  85. package/field/internal/shared-styles.js +1 -0
  86. package/field/internal/shared-styles.js.map +1 -1
  87. package/focus/internal/focus-ring-styles.d.ts +2 -0
  88. package/focus/internal/focus-ring-styles.js +1 -0
  89. package/focus/internal/focus-ring-styles.js.map +1 -1
  90. package/icon/internal/icon-styles.d.ts +2 -0
  91. package/icon/internal/icon-styles.js +1 -0
  92. package/icon/internal/icon-styles.js.map +1 -1
  93. package/iconbutton/internal/filled-styles.d.ts +2 -0
  94. package/iconbutton/internal/filled-styles.js +1 -0
  95. package/iconbutton/internal/filled-styles.js.map +1 -1
  96. package/iconbutton/internal/filled-tonal-styles.d.ts +2 -0
  97. package/iconbutton/internal/filled-tonal-styles.js +1 -0
  98. package/iconbutton/internal/filled-tonal-styles.js.map +1 -1
  99. package/iconbutton/internal/icon-button.d.ts +2 -32
  100. package/iconbutton/internal/icon-button.js +33 -84
  101. package/iconbutton/internal/icon-button.js.map +1 -1
  102. package/iconbutton/internal/outlined-styles.d.ts +2 -0
  103. package/iconbutton/internal/outlined-styles.js +1 -0
  104. package/iconbutton/internal/outlined-styles.js.map +1 -1
  105. package/iconbutton/internal/shared-styles.d.ts +2 -0
  106. package/iconbutton/internal/shared-styles.js +1 -0
  107. package/iconbutton/internal/shared-styles.js.map +1 -1
  108. package/iconbutton/internal/standard-styles.d.ts +2 -0
  109. package/iconbutton/internal/standard-styles.js +1 -0
  110. package/iconbutton/internal/standard-styles.js.map +1 -1
  111. package/internal/events/dispatch-hooks.js +10 -1
  112. package/internal/events/dispatch-hooks.js.map +1 -1
  113. package/labs/badge/internal/badge-styles.d.ts +2 -0
  114. package/labs/badge/internal/badge-styles.js +1 -0
  115. package/labs/badge/internal/badge-styles.js.map +1 -1
  116. package/labs/behaviors/form-associated.d.ts +10 -8
  117. package/labs/behaviors/form-associated.js +4 -4
  118. package/labs/behaviors/form-associated.js.map +1 -1
  119. package/{internal/controller → labs/behaviors}/form-submitter.d.ts +10 -16
  120. package/labs/behaviors/form-submitter.js +87 -0
  121. package/labs/behaviors/form-submitter.js.map +1 -0
  122. package/labs/card/internal/elevated-styles.d.ts +2 -0
  123. package/labs/card/internal/elevated-styles.js +1 -0
  124. package/labs/card/internal/elevated-styles.js.map +1 -1
  125. package/labs/card/internal/filled-styles.d.ts +2 -0
  126. package/labs/card/internal/filled-styles.js +1 -0
  127. package/labs/card/internal/filled-styles.js.map +1 -1
  128. package/labs/card/internal/outlined-styles.d.ts +2 -0
  129. package/labs/card/internal/outlined-styles.js +1 -0
  130. package/labs/card/internal/outlined-styles.js.map +1 -1
  131. package/labs/card/internal/shared-styles.d.ts +2 -0
  132. package/labs/card/internal/shared-styles.js +1 -0
  133. package/labs/card/internal/shared-styles.js.map +1 -1
  134. package/labs/item/internal/item-styles.d.ts +2 -0
  135. package/labs/item/internal/item-styles.js +1 -0
  136. package/labs/item/internal/item-styles.js.map +1 -1
  137. package/labs/navigationbar/internal/navigation-bar-styles.d.ts +2 -0
  138. package/labs/navigationbar/internal/navigation-bar-styles.js +1 -0
  139. package/labs/navigationbar/internal/navigation-bar-styles.js.map +1 -1
  140. package/labs/navigationdrawer/internal/navigation-drawer-modal-styles.d.ts +2 -0
  141. package/labs/navigationdrawer/internal/navigation-drawer-modal-styles.js +1 -0
  142. package/labs/navigationdrawer/internal/navigation-drawer-modal-styles.js.map +1 -1
  143. package/labs/navigationdrawer/internal/navigation-drawer-styles.d.ts +2 -0
  144. package/labs/navigationdrawer/internal/navigation-drawer-styles.js +1 -0
  145. package/labs/navigationdrawer/internal/navigation-drawer-styles.js.map +1 -1
  146. package/labs/navigationdrawer/internal/shared-styles.d.ts +2 -0
  147. package/labs/navigationdrawer/internal/shared-styles.js +1 -0
  148. package/labs/navigationdrawer/internal/shared-styles.js.map +1 -1
  149. package/labs/navigationtab/internal/navigation-tab-styles.d.ts +2 -0
  150. package/labs/navigationtab/internal/navigation-tab-styles.js +1 -0
  151. package/labs/navigationtab/internal/navigation-tab-styles.js.map +1 -1
  152. package/labs/segmentedbutton/internal/outlined-styles.d.ts +2 -0
  153. package/labs/segmentedbutton/internal/outlined-styles.js +1 -0
  154. package/labs/segmentedbutton/internal/outlined-styles.js.map +1 -1
  155. package/labs/segmentedbutton/internal/shared-styles.d.ts +2 -0
  156. package/labs/segmentedbutton/internal/shared-styles.js +1 -0
  157. package/labs/segmentedbutton/internal/shared-styles.js.map +1 -1
  158. package/labs/segmentedbuttonset/internal/outlined-styles.d.ts +2 -0
  159. package/labs/segmentedbuttonset/internal/outlined-styles.js +1 -0
  160. package/labs/segmentedbuttonset/internal/outlined-styles.js.map +1 -1
  161. package/labs/segmentedbuttonset/internal/shared-styles.d.ts +2 -0
  162. package/labs/segmentedbuttonset/internal/shared-styles.js +1 -0
  163. package/labs/segmentedbuttonset/internal/shared-styles.js.map +1 -1
  164. package/list/internal/list-styles.d.ts +2 -0
  165. package/list/internal/list-styles.js +1 -0
  166. package/list/internal/list-styles.js.map +1 -1
  167. package/list/internal/listitem/_list-item.scss +3 -0
  168. package/list/internal/listitem/list-item-styles.css +1 -1
  169. package/list/internal/listitem/list-item-styles.css.map +1 -1
  170. package/list/internal/listitem/list-item-styles.d.ts +2 -0
  171. package/list/internal/listitem/list-item-styles.js +2 -1
  172. package/list/internal/listitem/list-item-styles.js.map +1 -1
  173. package/menu/internal/menu-styles.d.ts +2 -0
  174. package/menu/internal/menu-styles.js +1 -0
  175. package/menu/internal/menu-styles.js.map +1 -1
  176. package/menu/internal/menuitem/_menu-item.scss +3 -0
  177. package/menu/internal/menuitem/menu-item-styles.css +1 -1
  178. package/menu/internal/menuitem/menu-item-styles.css.map +1 -1
  179. package/menu/internal/menuitem/menu-item-styles.d.ts +2 -0
  180. package/menu/internal/menuitem/menu-item-styles.js +2 -1
  181. package/menu/internal/menuitem/menu-item-styles.js.map +1 -1
  182. package/menu/internal/submenu/sub-menu-styles.d.ts +2 -0
  183. package/menu/internal/submenu/sub-menu-styles.js +1 -0
  184. package/menu/internal/submenu/sub-menu-styles.js.map +1 -1
  185. package/package.json +23 -1
  186. package/progress/internal/circular-progress-styles.d.ts +2 -0
  187. package/progress/internal/circular-progress-styles.js +1 -0
  188. package/progress/internal/circular-progress-styles.js.map +1 -1
  189. package/progress/internal/linear-progress-styles.d.ts +2 -0
  190. package/progress/internal/linear-progress-styles.js +1 -0
  191. package/progress/internal/linear-progress-styles.js.map +1 -1
  192. package/radio/internal/radio-styles.d.ts +2 -0
  193. package/radio/internal/radio-styles.js +1 -0
  194. package/radio/internal/radio-styles.js.map +1 -1
  195. package/ripple/internal/ripple-styles.d.ts +2 -0
  196. package/ripple/internal/ripple-styles.js +1 -0
  197. package/ripple/internal/ripple-styles.js.map +1 -1
  198. package/sass/ext/_assert.scss +82 -0
  199. package/sass/ext/_list_ext.scss +114 -0
  200. package/sass/ext/_map_ext.scss +222 -0
  201. package/sass/ext/_string_ext.scss +153 -0
  202. package/sass/ext/_throw.scss +83 -0
  203. package/sass/ext/_type.scss +66 -0
  204. package/{internal/sass → sass/ext}/_var.scss +86 -96
  205. package/sass/ext/tests.css +1 -0
  206. package/sass/ext/tests.css.map +1 -0
  207. package/sass/ext/tests.scss +18 -0
  208. package/select/internal/filled-select-styles.d.ts +2 -0
  209. package/select/internal/filled-select-styles.js +1 -0
  210. package/select/internal/filled-select-styles.js.map +1 -1
  211. package/select/internal/outlined-select-styles.d.ts +2 -0
  212. package/select/internal/outlined-select-styles.js +1 -0
  213. package/select/internal/outlined-select-styles.js.map +1 -1
  214. package/select/internal/shared-styles.d.ts +2 -0
  215. package/select/internal/shared-styles.js +1 -0
  216. package/select/internal/shared-styles.js.map +1 -1
  217. package/slider/internal/_slider.scss +1 -0
  218. package/slider/internal/forced-colors-styles.d.ts +2 -0
  219. package/slider/internal/forced-colors-styles.js +1 -0
  220. package/slider/internal/forced-colors-styles.js.map +1 -1
  221. package/slider/internal/slider-styles.css +1 -1
  222. package/slider/internal/slider-styles.css.map +1 -1
  223. package/slider/internal/slider-styles.d.ts +2 -0
  224. package/slider/internal/slider-styles.js +2 -1
  225. package/slider/internal/slider-styles.js.map +1 -1
  226. package/switch/internal/switch-styles.d.ts +2 -0
  227. package/switch/internal/switch-styles.js +1 -0
  228. package/switch/internal/switch-styles.js.map +1 -1
  229. package/tabs/internal/_tab.scss +0 -1
  230. package/tabs/internal/primary-tab-styles.d.ts +2 -0
  231. package/tabs/internal/primary-tab-styles.js +1 -0
  232. package/tabs/internal/primary-tab-styles.js.map +1 -1
  233. package/tabs/internal/secondary-tab-styles.d.ts +2 -0
  234. package/tabs/internal/secondary-tab-styles.js +1 -0
  235. package/tabs/internal/secondary-tab-styles.js.map +1 -1
  236. package/tabs/internal/tab-styles.css.map +1 -1
  237. package/tabs/internal/tab-styles.d.ts +2 -0
  238. package/tabs/internal/tab-styles.js +1 -0
  239. package/tabs/internal/tab-styles.js.map +1 -1
  240. package/tabs/internal/tabs-styles.d.ts +2 -0
  241. package/tabs/internal/tabs-styles.js +1 -0
  242. package/tabs/internal/tabs-styles.js.map +1 -1
  243. package/textfield/internal/filled-styles.d.ts +2 -0
  244. package/textfield/internal/filled-styles.js +1 -0
  245. package/textfield/internal/filled-styles.js.map +1 -1
  246. package/textfield/internal/outlined-styles.d.ts +2 -0
  247. package/textfield/internal/outlined-styles.js +1 -0
  248. package/textfield/internal/outlined-styles.js.map +1 -1
  249. package/textfield/internal/shared-styles.d.ts +2 -0
  250. package/textfield/internal/shared-styles.js +1 -0
  251. package/textfield/internal/shared-styles.js.map +1 -1
  252. package/tokens/versions/v30_0/sass/_index.scss +239 -0
  253. package/tokens/versions/v30_0/sass/_md-comp-app-bar-large-flexible.scss +31 -0
  254. package/tokens/versions/v30_0/sass/_md-comp-app-bar-large.scss +35 -0
  255. package/tokens/versions/v30_0/sass/_md-comp-app-bar-medium-flexible.scss +31 -0
  256. package/tokens/versions/v30_0/sass/_md-comp-app-bar-medium.scss +35 -0
  257. package/tokens/versions/v30_0/sass/_md-comp-app-bar-small.scss +42 -0
  258. package/tokens/versions/v30_0/sass/_md-comp-app-bar.scss +59 -0
  259. package/tokens/versions/v30_0/sass/_md-comp-assist-chip.scss +134 -0
  260. package/tokens/versions/v30_0/sass/_md-comp-badge.scss +53 -0
  261. package/tokens/versions/v30_0/sass/_md-comp-banner.scss +147 -0
  262. package/tokens/versions/v30_0/sass/_md-comp-banners-basic.scss +86 -0
  263. package/tokens/versions/v30_0/sass/_md-comp-banners-rich.scss +89 -0
  264. package/tokens/versions/v30_0/sass/_md-comp-banners.scss +43 -0
  265. package/tokens/versions/v30_0/sass/_md-comp-bottom-app-bar.scss +37 -0
  266. package/tokens/versions/v30_0/sass/_md-comp-button-elevated.scss +125 -0
  267. package/tokens/versions/v30_0/sass/_md-comp-button-filled.scss +125 -0
  268. package/tokens/versions/v30_0/sass/_md-comp-button-group-connected-large.scss +31 -0
  269. package/tokens/versions/v30_0/sass/_md-comp-button-group-connected-medium.scss +31 -0
  270. package/tokens/versions/v30_0/sass/_md-comp-button-group-connected-small.scss +31 -0
  271. package/tokens/versions/v30_0/sass/_md-comp-button-group-connected-xlarge.scss +31 -0
  272. package/tokens/versions/v30_0/sass/_md-comp-button-group-connected-xsmall.scss +31 -0
  273. package/tokens/versions/v30_0/sass/_md-comp-button-group-standard-large.scss +29 -0
  274. package/tokens/versions/v30_0/sass/_md-comp-button-group-standard-medium.scss +29 -0
  275. package/tokens/versions/v30_0/sass/_md-comp-button-group-standard-small.scss +29 -0
  276. package/tokens/versions/v30_0/sass/_md-comp-button-group-standard-xlarge.scss +29 -0
  277. package/tokens/versions/v30_0/sass/_md-comp-button-group-standard-xsmall.scss +29 -0
  278. package/tokens/versions/v30_0/sass/_md-comp-button-large.scss +51 -0
  279. package/tokens/versions/v30_0/sass/_md-comp-button-medium.scss +51 -0
  280. package/tokens/versions/v30_0/sass/_md-comp-button-outlined.scss +124 -0
  281. package/tokens/versions/v30_0/sass/_md-comp-button-small.scss +51 -0
  282. package/tokens/versions/v30_0/sass/_md-comp-button-text.scss +60 -0
  283. package/tokens/versions/v30_0/sass/_md-comp-button-tonal.scss +125 -0
  284. package/tokens/versions/v30_0/sass/_md-comp-button-xlarge.scss +51 -0
  285. package/tokens/versions/v30_0/sass/_md-comp-button-xsmall.scss +51 -0
  286. package/tokens/versions/v30_0/sass/_md-comp-button.scss +163 -0
  287. package/tokens/versions/v30_0/sass/_md-comp-carousel-item.scss +79 -0
  288. package/tokens/versions/v30_0/sass/_md-comp-checkbox.scss +216 -0
  289. package/tokens/versions/v30_0/sass/_md-comp-circular-progress-indicator.scss +52 -0
  290. package/tokens/versions/v30_0/sass/_md-comp-data-table.scss +110 -0
  291. package/tokens/versions/v30_0/sass/_md-comp-date-input-modal.scss +80 -0
  292. package/tokens/versions/v30_0/sass/_md-comp-date-picker-docked.scss +241 -0
  293. package/tokens/versions/v30_0/sass/_md-comp-date-picker-modal.scss +295 -0
  294. package/tokens/versions/v30_0/sass/_md-comp-dialog.scss +157 -0
  295. package/tokens/versions/v30_0/sass/_md-comp-divider.scss +23 -0
  296. package/tokens/versions/v30_0/sass/_md-comp-drag-handle.scss +54 -0
  297. package/tokens/versions/v30_0/sass/_md-comp-elevated-button.scss +112 -0
  298. package/tokens/versions/v30_0/sass/_md-comp-elevated-card.scss +75 -0
  299. package/tokens/versions/v30_0/sass/_md-comp-extended-fab-branded.scss +100 -0
  300. package/tokens/versions/v30_0/sass/_md-comp-extended-fab-large.scss +36 -0
  301. package/tokens/versions/v30_0/sass/_md-comp-extended-fab-medium.scss +36 -0
  302. package/tokens/versions/v30_0/sass/_md-comp-extended-fab-primary-container.scss +61 -0
  303. package/tokens/versions/v30_0/sass/_md-comp-extended-fab-primary.scss +174 -0
  304. package/tokens/versions/v30_0/sass/_md-comp-extended-fab-secondary-container.scss +61 -0
  305. package/tokens/versions/v30_0/sass/_md-comp-extended-fab-secondary.scss +174 -0
  306. package/tokens/versions/v30_0/sass/_md-comp-extended-fab-small.scss +36 -0
  307. package/tokens/versions/v30_0/sass/_md-comp-extended-fab-surface.scss +108 -0
  308. package/tokens/versions/v30_0/sass/_md-comp-extended-fab-tertiary-container.scss +61 -0
  309. package/tokens/versions/v30_0/sass/_md-comp-extended-fab-tertiary.scss +174 -0
  310. package/tokens/versions/v30_0/sass/_md-comp-extended-fab.scss +36 -0
  311. package/tokens/versions/v30_0/sass/_md-comp-fab-branded-large.scss +79 -0
  312. package/tokens/versions/v30_0/sass/_md-comp-fab-branded.scss +75 -0
  313. package/tokens/versions/v30_0/sass/_md-comp-fab-large.scss +27 -0
  314. package/tokens/versions/v30_0/sass/_md-comp-fab-medium.scss +27 -0
  315. package/tokens/versions/v30_0/sass/_md-comp-fab-menu-primary-close-button.scss +51 -0
  316. package/tokens/versions/v30_0/sass/_md-comp-fab-menu-primary-container.scss +59 -0
  317. package/tokens/versions/v30_0/sass/_md-comp-fab-menu-secondary-close-button.scss +51 -0
  318. package/tokens/versions/v30_0/sass/_md-comp-fab-menu-secondary-container.scss +59 -0
  319. package/tokens/versions/v30_0/sass/_md-comp-fab-menu-tertiary-close-button.scss +51 -0
  320. package/tokens/versions/v30_0/sass/_md-comp-fab-menu-tertiary-container.scss +59 -0
  321. package/tokens/versions/v30_0/sass/_md-comp-fab-menu.scss +53 -0
  322. package/tokens/versions/v30_0/sass/_md-comp-fab-primary-container.scss +53 -0
  323. package/tokens/versions/v30_0/sass/_md-comp-fab-primary-large.scss +77 -0
  324. package/tokens/versions/v30_0/sass/_md-comp-fab-primary-small.scss +77 -0
  325. package/tokens/versions/v30_0/sass/_md-comp-fab-primary.scss +131 -0
  326. package/tokens/versions/v30_0/sass/_md-comp-fab-secondary-container.scss +53 -0
  327. package/tokens/versions/v30_0/sass/_md-comp-fab-secondary-large.scss +77 -0
  328. package/tokens/versions/v30_0/sass/_md-comp-fab-secondary-small.scss +77 -0
  329. package/tokens/versions/v30_0/sass/_md-comp-fab-secondary.scss +131 -0
  330. package/tokens/versions/v30_0/sass/_md-comp-fab-small.scss +27 -0
  331. package/tokens/versions/v30_0/sass/_md-comp-fab-surface-large.scss +83 -0
  332. package/tokens/versions/v30_0/sass/_md-comp-fab-surface.scss +83 -0
  333. package/tokens/versions/v30_0/sass/_md-comp-fab-tertiary-container.scss +53 -0
  334. package/tokens/versions/v30_0/sass/_md-comp-fab-tertiary-large.scss +77 -0
  335. package/tokens/versions/v30_0/sass/_md-comp-fab-tertiary-small.scss +77 -0
  336. package/tokens/versions/v30_0/sass/_md-comp-fab-tertiary.scss +131 -0
  337. package/tokens/versions/v30_0/sass/_md-comp-fab.scss +27 -0
  338. package/tokens/versions/v30_0/sass/_md-comp-filled-autocomplete.scss +279 -0
  339. package/tokens/versions/v30_0/sass/_md-comp-filled-button.scss +128 -0
  340. package/tokens/versions/v30_0/sass/_md-comp-filled-card.scss +75 -0
  341. package/tokens/versions/v30_0/sass/_md-comp-filled-icon-button.scss +102 -0
  342. package/tokens/versions/v30_0/sass/_md-comp-filled-menu-button.scss +118 -0
  343. package/tokens/versions/v30_0/sass/_md-comp-filled-select.scss +269 -0
  344. package/tokens/versions/v30_0/sass/_md-comp-filled-text-field.scss +221 -0
  345. package/tokens/versions/v30_0/sass/_md-comp-filled-tonal-button.scss +108 -0
  346. package/tokens/versions/v30_0/sass/_md-comp-filled-tonal-icon-button.scss +102 -0
  347. package/tokens/versions/v30_0/sass/_md-comp-filter-chip.scss +276 -0
  348. package/tokens/versions/v30_0/sass/_md-comp-full-screen-dialog.scss +199 -0
  349. package/tokens/versions/v30_0/sass/_md-comp-icon-button-filled.scss +82 -0
  350. package/tokens/versions/v30_0/sass/_md-comp-icon-button-large.scss +52 -0
  351. package/tokens/versions/v30_0/sass/_md-comp-icon-button-medium.scss +52 -0
  352. package/tokens/versions/v30_0/sass/_md-comp-icon-button-outlined.scss +86 -0
  353. package/tokens/versions/v30_0/sass/_md-comp-icon-button-small.scss +52 -0
  354. package/tokens/versions/v30_0/sass/_md-comp-icon-button-standard.scss +72 -0
  355. package/tokens/versions/v30_0/sass/_md-comp-icon-button-tonal.scss +82 -0
  356. package/tokens/versions/v30_0/sass/_md-comp-icon-button-xlarge.scss +52 -0
  357. package/tokens/versions/v30_0/sass/_md-comp-icon-button-xsmall.scss +52 -0
  358. package/tokens/versions/v30_0/sass/_md-comp-icon-button.scss +193 -0
  359. package/tokens/versions/v30_0/sass/_md-comp-input-chip.scss +300 -0
  360. package/tokens/versions/v30_0/sass/_md-comp-linear-progress-indicator.scss +60 -0
  361. package/tokens/versions/v30_0/sass/_md-comp-list-expand.scss +36 -0
  362. package/tokens/versions/v30_0/sass/_md-comp-list-reorder.scss +45 -0
  363. package/tokens/versions/v30_0/sass/_md-comp-list-reveal.scss +50 -0
  364. package/tokens/versions/v30_0/sass/_md-comp-list.scss +408 -0
  365. package/tokens/versions/v30_0/sass/_md-comp-loading-indicator.scss +38 -0
  366. package/tokens/versions/v30_0/sass/_md-comp-menu.scss +218 -0
  367. package/tokens/versions/v30_0/sass/_md-comp-menus-standard.scss +188 -0
  368. package/tokens/versions/v30_0/sass/_md-comp-menus-vibrant.scss +160 -0
  369. package/tokens/versions/v30_0/sass/_md-comp-menus.scss +141 -0
  370. package/tokens/versions/v30_0/sass/_md-comp-nav-bar-item-horizontal.scss +31 -0
  371. package/tokens/versions/v30_0/sass/_md-comp-nav-bar-item-vertical.scss +31 -0
  372. package/tokens/versions/v30_0/sass/_md-comp-nav-bar.scss +68 -0
  373. package/tokens/versions/v30_0/sass/_md-comp-nav-rail-collapsed.scss +35 -0
  374. package/tokens/versions/v30_0/sass/_md-comp-nav-rail-expanded.scss +47 -0
  375. package/tokens/versions/v30_0/sass/_md-comp-nav-rail-item-horizontal.scss +31 -0
  376. package/tokens/versions/v30_0/sass/_md-comp-nav-rail-item-vertical.scss +33 -0
  377. package/tokens/versions/v30_0/sass/_md-comp-nav-rail-item.scss +39 -0
  378. package/tokens/versions/v30_0/sass/_md-comp-nav-rail.scss +48 -0
  379. package/tokens/versions/v30_0/sass/_md-comp-navigation-bar.scss +150 -0
  380. package/tokens/versions/v30_0/sass/_md-comp-navigation-drawer.scss +187 -0
  381. package/tokens/versions/v30_0/sass/_md-comp-navigation-rail.scss +233 -0
  382. package/tokens/versions/v30_0/sass/_md-comp-outlined-autocomplete.scss +275 -0
  383. package/tokens/versions/v30_0/sass/_md-comp-outlined-button.scss +108 -0
  384. package/tokens/versions/v30_0/sass/_md-comp-outlined-card.scss +87 -0
  385. package/tokens/versions/v30_0/sass/_md-comp-outlined-menu-button.scss +117 -0
  386. package/tokens/versions/v30_0/sass/_md-comp-outlined-segmented-button.scss +121 -0
  387. package/tokens/versions/v30_0/sass/_md-comp-outlined-select.scss +266 -0
  388. package/tokens/versions/v30_0/sass/_md-comp-outlined-text-field.scss +216 -0
  389. package/tokens/versions/v30_0/sass/_md-comp-plain-tooltip.scss +45 -0
  390. package/tokens/versions/v30_0/sass/_md-comp-primary-navigation-tab.scss +130 -0
  391. package/tokens/versions/v30_0/sass/_md-comp-progress-indicator-circular.scss +47 -0
  392. package/tokens/versions/v30_0/sass/_md-comp-progress-indicator-linear.scss +65 -0
  393. package/tokens/versions/v30_0/sass/_md-comp-progress-indicator.scss +48 -0
  394. package/tokens/versions/v30_0/sass/_md-comp-radio-button.scss +72 -0
  395. package/tokens/versions/v30_0/sass/_md-comp-rich-tooltip.scss +113 -0
  396. package/tokens/versions/v30_0/sass/_md-comp-scrim.scss +23 -0
  397. package/tokens/versions/v30_0/sass/_md-comp-search-bar.scss +102 -0
  398. package/tokens/versions/v30_0/sass/_md-comp-search-view.scss +84 -0
  399. package/tokens/versions/v30_0/sass/_md-comp-secondary-navigation-tab.scss +104 -0
  400. package/tokens/versions/v30_0/sass/_md-comp-sheet-bottom.scss +52 -0
  401. package/tokens/versions/v30_0/sass/_md-comp-sheet-floating.scss +31 -0
  402. package/tokens/versions/v30_0/sass/_md-comp-sheet-side.scss +96 -0
  403. package/tokens/versions/v30_0/sass/_md-comp-slider-large.scss +31 -0
  404. package/tokens/versions/v30_0/sass/_md-comp-slider-medium.scss +31 -0
  405. package/tokens/versions/v30_0/sass/_md-comp-slider-small.scss +27 -0
  406. package/tokens/versions/v30_0/sass/_md-comp-slider-xlarge.scss +31 -0
  407. package/tokens/versions/v30_0/sass/_md-comp-slider-xsmall.scss +27 -0
  408. package/tokens/versions/v30_0/sass/_md-comp-slider.scss +307 -0
  409. package/tokens/versions/v30_0/sass/_md-comp-snackbar.scss +115 -0
  410. package/tokens/versions/v30_0/sass/_md-comp-split-button-large.scss +43 -0
  411. package/tokens/versions/v30_0/sass/_md-comp-split-button-medium.scss +43 -0
  412. package/tokens/versions/v30_0/sass/_md-comp-split-button-small.scss +43 -0
  413. package/tokens/versions/v30_0/sass/_md-comp-split-button-xlarge.scss +43 -0
  414. package/tokens/versions/v30_0/sass/_md-comp-split-button-xsmall.scss +45 -0
  415. package/tokens/versions/v30_0/sass/_md-comp-standard-menu-button.scss +103 -0
  416. package/tokens/versions/v30_0/sass/_md-comp-suggestion-chip.scss +134 -0
  417. package/tokens/versions/v30_0/sass/_md-comp-switch.scss +191 -0
  418. package/tokens/versions/v30_0/sass/_md-comp-text-button.scss +94 -0
  419. package/tokens/versions/v30_0/sass/_md-comp-time-input.scss +206 -0
  420. package/tokens/versions/v30_0/sass/_md-comp-time-picker.scss +257 -0
  421. package/tokens/versions/v30_0/sass/_md-comp-toolbar-docked.scss +36 -0
  422. package/tokens/versions/v30_0/sass/_md-comp-toolbar-floating-fab.scss +51 -0
  423. package/tokens/versions/v30_0/sass/_md-comp-toolbar-floating.scss +75 -0
  424. package/tokens/versions/v30_0/sass/_md-comp-toolbar-standard.scss +87 -0
  425. package/tokens/versions/v30_0/sass/_md-comp-toolbar-vibrant.scss +87 -0
  426. package/tokens/versions/v30_0/sass/_md-comp-top-app-bar-large.scss +62 -0
  427. package/tokens/versions/v30_0/sass/_md-comp-top-app-bar-medium.scss +62 -0
  428. package/tokens/versions/v30_0/sass/_md-comp-top-app-bar-small-centered.scss +72 -0
  429. package/tokens/versions/v30_0/sass/_md-comp-top-app-bar-small.scss +70 -0
  430. package/tokens/versions/v30_0/sass/_md-ref-palette.scss +495 -0
  431. package/tokens/versions/v30_0/sass/_md-ref-typeface.scss +27 -0
  432. package/tokens/versions/v30_0/sass/_md-sys-color.scss +209 -0
  433. package/tokens/versions/v30_0/sass/_md-sys-color__dark.scss +209 -0
  434. package/tokens/versions/v30_0/sass/_md-sys-color__dark__high-contrast.scss +209 -0
  435. package/tokens/versions/v30_0/sass/_md-sys-color__dark__medium-contrast.scss +209 -0
  436. package/tokens/versions/v30_0/sass/_md-sys-color__high-contrast.scss +209 -0
  437. package/tokens/versions/v30_0/sass/_md-sys-color__medium-contrast.scss +209 -0
  438. package/tokens/versions/v30_0/sass/_md-sys-elevation.scss +35 -0
  439. package/tokens/versions/v30_0/sass/_md-sys-motion.scss +107 -0
  440. package/tokens/versions/v30_0/sass/_md-sys-shape.scss +67 -0
  441. package/tokens/versions/v30_0/sass/_md-sys-state-focus-indicator.scss +23 -0
  442. package/tokens/versions/v30_0/sass/_md-sys-state.scss +27 -0
  443. package/tokens/versions/v30_0/sass/_md-sys-typescale-emphasized.scss +559 -0
  444. package/tokens/versions/v30_0/sass/_md-sys-typescale.scss +571 -0
  445. package/typography/md-typescale-styles.d.ts +2 -0
  446. package/typography/md-typescale-styles.js +1 -0
  447. package/typography/md-typescale-styles.js.map +1 -1
  448. package/internal/controller/form-submitter.js +0 -69
  449. package/internal/controller/form-submitter.js.map +0 -1
  450. package/internal/sass/_string-ext.scss +0 -195
@@ -0,0 +1,222 @@
1
+ //
2
+ // Copyright 2025 Google LLC
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ //
5
+
6
+ // Extensions to the go/sass:map built-in module.
7
+
8
+ // go/keep-sorted start by_regex='(.+) prefix_order=sass:
9
+ @use 'sass:list';
10
+ @use 'sass:map';
11
+ @use 'sass:meta';
12
+ @use 'assert';
13
+ @use 'throw';
14
+ @use 'type';
15
+ // go/keep-sorted end
16
+
17
+ /// The same as `map.get()` but throws an error if the key is not found.
18
+ ///
19
+ /// This is useful over `map.get()` when using Sass maps like records, where
20
+ /// the key is expected to exist.
21
+ ///
22
+ /// @example scss
23
+ /// $map: (
24
+ /// 'name': 'foo',
25
+ /// 'value': blue,
26
+ /// );
27
+ ///
28
+ /// @debug map_ext.get-strict($map, 'name'); // 'foo'
29
+ /// @debug map_ext.get-strict($map, 'bar'); // ERROR: Key "bar" expected but not found in $map: ('name': 'foo', 'value': blue)
30
+ ///
31
+ /// @param {map} $map - The map to retrieve the value from.
32
+ /// @param {string} $key - The key of the value to retrieve.
33
+ /// @param {list} $keys - Additional keys to retrieve deeply nested values.
34
+ /// @return {*} The value at the given key.
35
+ /// @throw Error if the key does not exist in the map.
36
+ @function get-strict($map, $key, $keys...) {
37
+ $map: assert.is-type($map, 'map', $source: 'map_ext.get-strict');
38
+ @if throw.get-error($map) {
39
+ @return $map;
40
+ }
41
+ @if not map.has-key($map, $key, $keys...) {
42
+ @return throw.error(
43
+ 'Key #{$key} expected but not found in $map: #{meta.inspect($map)}',
44
+ $source: 'map.get-strict'
45
+ );
46
+ }
47
+
48
+ @return map.get($map, $key, $keys...);
49
+ }
50
+
51
+ /// Splits a Map and returns a List pair with two new Maps: the first with the
52
+ /// provided keys and the second without.
53
+ ///
54
+ /// @example scss
55
+ /// $map: (
56
+ /// 'focus': blue,
57
+ /// 'focus-within': blue,
58
+ /// 'hover': teal,
59
+ /// 'active': green,
60
+ /// );
61
+ ///
62
+ /// $pair: map_ext.split($map, ('focus', 'focus-within'));
63
+ ///
64
+ /// $map-with-focus-keys: list.nth($pair, 1);
65
+ /// @debug $map-with-focus-keys; // ('focus': blue, 'focus-within': blue)
66
+ ///
67
+ /// $map-with-remaining-keys: list.nth($pair, 2);
68
+ /// @debug $map-with-remaining-keys; // ('hover': teal, 'active': green)
69
+ ///
70
+ /// @param {map} $map - The Map to split.
71
+ /// @param {list} $keys - List of keys to split the Map by.
72
+ /// @return {list} A List pair with two new Maps: the first with the keys
73
+ /// provided, and the second with the remaining keys.
74
+ @function split($map, $keys) {
75
+ @if type.matches($keys, 'string') {
76
+ // A list with a single string `('key')` collapses to a single string type
77
+ // at build time. We can force it to be a list using a list API method.
78
+ // Ex:
79
+ // map_ext.split($map, ('key')) is the same as
80
+ // map_ext.split($map, 'key')
81
+ $keys: list.append((), $keys);
82
+ }
83
+
84
+ // In Sass, `()` counts as both a map and a list, and always reports its type
85
+ // as a list. If we're given an empty map-list, we don't need to throw a type
86
+ // error.
87
+ $map: assert.is-type($map, 'map|list', $source: 'map_ext.split');
88
+ $keys: assert.is-type($keys, 'list', $source: 'map_ext.split');
89
+ $error: throw.get-error($map, $keys);
90
+ @if not $error and list.length($keys) == 0 {
91
+ $error: throw.error(
92
+ 'List of keys to split by are empty',
93
+ $source: 'map_ext.split'
94
+ );
95
+ }
96
+ @if $error {
97
+ @return $error;
98
+ }
99
+
100
+ // In Sass, `()` is an empty list. We can force Sass to use map types by
101
+ // creating the map with map APIs. This ensures that even if a map is empty,
102
+ // `meta.type-of()` will report it as a map.
103
+ $map-with-keys: map.merge((), ());
104
+ $map-without-keys: map.merge((), ());
105
+ @each $key, $value in $map {
106
+ $has-key: list.index($keys, $key) != null;
107
+ @if $has-key {
108
+ $map-with-keys: map.set($map-with-keys, $key, $value);
109
+ } @else {
110
+ $map-without-keys: map.set($map-without-keys, $key, $value);
111
+ }
112
+ }
113
+
114
+ @return ($map-with-keys, $map-without-keys);
115
+ }
116
+
117
+ /// Splits a Map and returns a new Map that only includes the provided keys.
118
+ ///
119
+ /// @example scss
120
+ /// $map: (
121
+ /// 'focus': blue,
122
+ /// 'focus-within': blue,
123
+ /// 'hover': teal,
124
+ /// 'active': green,
125
+ /// );
126
+ ///
127
+ /// $map-with-focus-keys: map_ext.pick($map, ('focus', 'focus-within'));
128
+ /// @debug $map-with-focus-keys; // ('focus': blue, 'focus-within': blue)
129
+ ///
130
+ /// @param {map} $map - The Map to split.
131
+ /// @param {list} $keys - List of keys to include in the new Map.
132
+ /// @return {map} Map with only the keys provided.
133
+ @function pick($map, $keys) {
134
+ $result: split($map, $keys);
135
+ @if throw.get-error($result) {
136
+ @return $result;
137
+ }
138
+ @return list.nth($result, 1);
139
+ }
140
+
141
+ /// Splits a Map and returns a new Map that excludes the provided keys.
142
+ ///
143
+ /// @example scss
144
+ /// $map: (
145
+ /// 'focus': blue,
146
+ /// 'focus-within': blue,
147
+ /// 'hover': teal,
148
+ /// 'active': green,
149
+ /// );
150
+ ///
151
+ /// $map-without-focus-keys: map_ext.omit($map, ('focus', 'focus-within'));
152
+ /// @debug $map-without-focus-keys; // ('hover': teal, 'active': green)
153
+ ///
154
+ /// @param {map} $map - The Map to split.
155
+ /// @param {list} $keys - List of keys to exclude from the new Map.
156
+ /// @return {map} Map without the keys provided.
157
+ @function omit($map, $keys) {
158
+ $result: split($map, $keys);
159
+ @if throw.get-error($result) {
160
+ @return $result;
161
+ }
162
+ @return list.nth($result, 2);
163
+ }
164
+
165
+ /// Returns the given map with any matching keys renamed according to the
166
+ /// provided Map of keys to rename.
167
+ ///
168
+ /// @example scss
169
+ /// $map: ('foo': red);
170
+ ///
171
+ /// $new-map: map_ext.rename-keys($map, ('foo': 'bar'));
172
+ /// @debug $new-map; // ('bar': red)
173
+ ///
174
+ /// @param {map} $map - The map to rename keys within.
175
+ /// @param {map} $keys-to-rename - A map of keys and their new names.
176
+ /// @return {map} The map with any matching keys renamed.
177
+ @function rename-keys($map, $keys-to-rename) {
178
+ $new-map: omit($map, map.keys($keys-to-rename));
179
+ @if throw.get-error($new-map) {
180
+ @return $new-map;
181
+ }
182
+
183
+ @each $old-key-name, $new-key-name in $keys-to-rename {
184
+ @if map.has-key($map, $old-key-name) {
185
+ $new-map: map.set($new-map, $new-key-name, map.get($map, $old-key-name));
186
+ }
187
+ }
188
+
189
+ @return $new-map;
190
+ }
191
+
192
+ /// Returns a list of keys where $mapB diverges from $mapA.
193
+ /// Divergence occurs when:
194
+ /// 1. A key exists in $mapB but not in $mapA.
195
+ /// 2. A key exists in both maps but with different values.
196
+ ///
197
+ /// @example scss
198
+ /// $mapA: ('foo': red, 'bar': yellow, 'baz': 10);
199
+ /// $mapB: ('foo': red, 'bar': green, 'baz': 10, 'fooBar': blue);
200
+ ///
201
+ /// $differences: map_ext.difference($mapA, $mapB);
202
+ /// @debug $differences; // ('bar', 'fooBar')
203
+ ///
204
+ /// @param {map} $mapA - The reference map.
205
+ /// @param {map} $mapB - The map to compare against the reference.
206
+ /// @return {list} A list of keys where $mapB diverges from $mapA.
207
+ @function difference($mapA, $mapB) {
208
+ $mapA: assert.is-type($mapA, 'map', $source: 'map_ext.difference');
209
+ $mapB: assert.is-type($mapB, 'map', $source: 'map_ext.difference');
210
+ $error: throw.get-error($mapA, $mapB);
211
+ @if $error {
212
+ @return $error;
213
+ }
214
+ $differences: ();
215
+ @each $key, $value in $mapB {
216
+ @if not map.has-key($mapA, $key) or map.get($mapA, $key) != $value {
217
+ $differences: list.append($differences, $key);
218
+ }
219
+ }
220
+
221
+ @return $differences;
222
+ }
@@ -0,0 +1,153 @@
1
+ //
2
+ // Copyright 2021 Google LLC
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ //
5
+
6
+ // Extensions to the go/sass:string built-in module.
7
+
8
+ // go/keep-sorted start by_regex='(.+) prefix_order=sass:
9
+ @use 'sass:list';
10
+ @use 'sass:string';
11
+ // go/keep-sorted end
12
+
13
+ /// Checks if a string starts with a given prefix.
14
+ ///
15
+ /// @example scss
16
+ /// @debug string_ext.starts-with('var(--foo)', 'var('); // true
17
+ ///
18
+ /// @param {string} $string - The string to test.
19
+ /// @param {string} $prefix - The prefix to check.
20
+ /// @return {boolean} True if the string starts with the given prefix.
21
+ @function starts-with($string, $prefix) {
22
+ @return string.slice($string, 1, string.length($prefix)) == $prefix;
23
+ }
24
+
25
+ /// Checks if a string ends with a given suffix.
26
+ ///
27
+ /// @example scss
28
+ /// @debug string_ext.ends-with('var(--foo)', ')'); // true
29
+ ///
30
+ /// @param {string} $string - The string to test.
31
+ /// @param {string} $suffix - The suffix to check.
32
+ /// @return {boolean} True if the string ends with the given suffix.
33
+ @function ends-with($string, $suffix) {
34
+ @return string.slice($string, -1 * string.length($suffix)) == $suffix;
35
+ }
36
+
37
+ /// Trims leading whitespace from the start of a string.
38
+ ///
39
+ /// @example scss
40
+ /// @debug string_ext.trim-start(' foo bar '); // "foo bar "
41
+ ///
42
+ /// @param {string} $string - The string to trim.
43
+ /// @return {string} The string with whitespace trimmed from the start.
44
+ @function trim-start($string) {
45
+ @while starts-with($string, ' ') {
46
+ $string: replace-start($string, ' ', '');
47
+ }
48
+
49
+ @return $string;
50
+ }
51
+
52
+ /// Trims trailing whitespace from the end of a string.
53
+ ///
54
+ /// @example scss
55
+ /// @debug string_ext.trim-end(' foo bar '); // " foo bar"
56
+ ///
57
+ /// @param {string} $string - The string to trim.
58
+ /// @return {string} The string with trailing whitespace trimmed from the end.
59
+ @function trim-end($string) {
60
+ @while ends-with($string, ' ') {
61
+ $string: replace-end($string, ' ', '');
62
+ }
63
+
64
+ @return $string;
65
+ }
66
+
67
+ /// Trims leading and trailing whitespace from a string.
68
+ ///
69
+ /// @example scss
70
+ /// @debug string_ext.trim(' foo bar '); // "foo bar"
71
+ ///
72
+ /// @param {string} $string - The string to trim.
73
+ /// @return {string} The string with leading and trailing whitespace trimmed.
74
+ @function trim($string) {
75
+ @return trim-start(trim-end($string));
76
+ }
77
+
78
+ /// Returns a new string with the first match of a pattern replaced by a given
79
+ /// string.
80
+ ///
81
+ /// @example scss
82
+ /// @debug string_ext.replace('foo bar baz', 'bar', 'quux'); // "foo quux baz"
83
+ ///
84
+ /// @param {string} $string - The string to be searched.
85
+ /// @param {string} $pattern - The pattern to search for.
86
+ /// @param {string} $replacement - The value to replace the pattern.
87
+ /// @return {string} The string with the first match of pattern replaced by the
88
+ /// replacement or the initial string itself.
89
+ @function replace($string, $pattern, $replacement) {
90
+ $pattern-index: string.index($string, $pattern);
91
+ @if not $pattern-index {
92
+ @return $string;
93
+ }
94
+
95
+ $before: string.slice($string, 1, $pattern-index - 1);
96
+ $after: string.slice($string, string.length($pattern) + $pattern-index);
97
+
98
+ @return $before + $replacement + $after;
99
+ }
100
+
101
+ /// Returns a new string with all matches of a pattern replaced by a given
102
+ /// string.
103
+ ///
104
+ /// @example scss
105
+ /// @debug string_ext.replace-all('foo bar baz', 'ba', 'qua'); // "foo quar quaz"
106
+ ///
107
+ /// @param {string} $string - The string to be searched.
108
+ /// @param {string} $pattern - The pattern to search for.
109
+ /// @param {string} $replacement - The value to replace the pattern.
110
+ /// @return {string} The string with all matches of pattern replaced by the
111
+ /// replacement or the initial string itself.
112
+ @function replace-all($string, $pattern, $replacement) {
113
+ @while string.index($string, $pattern) {
114
+ $string: replace($string, $pattern, $replacement);
115
+ }
116
+
117
+ @return $string;
118
+ }
119
+
120
+ /// Returns a new string that replaces a prefix at the start of the string.
121
+ ///
122
+ /// @example scss
123
+ /// @debug string_ext.replace-start('var(--foo)', 'var(', ''); // "--foo)"
124
+ ///
125
+ /// @param {string} $string - The string to be searched.
126
+ /// @param {string} $prefix - The prefix string to replace.
127
+ /// @param {string} $replacement - The value to replace the prefix.
128
+ /// @return {string} The string with the prefix replaced.
129
+ @function replace-start($string, $prefix, $replacement) {
130
+ @if starts-with($string, $prefix) {
131
+ $string: $replacement + string.slice($string, string.length($prefix) + 1);
132
+ }
133
+
134
+ @return $string;
135
+ }
136
+
137
+ /// Returns a new string that replaces a suffix at the end of the string.
138
+ ///
139
+ /// @example scss
140
+ /// @debug string_ext.replace-end('var(--foo)', ')', ''); // "var(--foo"
141
+ ///
142
+ /// @param {string} $string - The string to be searched.
143
+ /// @param {string} $suffix - The suffix string to replace.
144
+ /// @param {string} $replacement - The value to replace the suffix.
145
+ /// @return {string} The string with the suffix trimmed from the end.
146
+ @function replace-end($string, $suffix, $replacement) {
147
+ @if ends-with($string, $suffix) {
148
+ $string: string.slice($string, 1, -1 * string.length($suffix) - 1) +
149
+ $replacement;
150
+ }
151
+
152
+ @return $string;
153
+ }
@@ -0,0 +1,83 @@
1
+ //
2
+ // Copyright 2025 Google LLC
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ //
5
+
6
+ // Utilities for `sass-true` errors, to support testing error behavior.
7
+
8
+ // go/keep-sorted start by_regex='(.+) prefix_order=sass:
9
+ @use 'sass:meta';
10
+ @use 'sass:string';
11
+ // go/keep-sorted end
12
+
13
+ @forward 'true' show error;
14
+
15
+ /// Returns false if none of the given values are error strings, or returns an
16
+ /// error string if any value has an error.
17
+ ///
18
+ /// This is used to support testing error behavior with `sass-true`, since
19
+ /// `@error` messages cannot be caught at build time.
20
+ ///
21
+ /// @example scss
22
+ /// // A function that may return an "ERROR:" string in a test.
23
+ /// @function get-value($map, $key) {
24
+ /// @if meta.type-of($map) != 'map' {
25
+ /// // Identical to `@error 'ERROR: Arg is not a map'` outside of tests.
26
+ /// @return throw.error('Arg is not a map');
27
+ /// }
28
+ /// @return map.get($map, $key);
29
+ /// }
30
+ ///
31
+ /// // A function that needs to handle potential errors from other functions.
32
+ /// @function mix-primary-on-surface($values) {
33
+ /// $primary: get-value($values, 'primary');
34
+ /// $surface: get-value($values, 'surface');
35
+ /// $error: throw.get-error($primary, $surface);
36
+ /// @if $error {
37
+ /// // Return early to guard logic against additional errors since
38
+ /// // $primary or $surface may be a string instead of a color.
39
+ /// @return $error;
40
+ /// }
41
+ ///
42
+ /// @return color.mix($primary, $surface, 10%);
43
+ /// }
44
+ ///
45
+ /// Note: `throw.error()` and `throw.get-error()` are only useful when testing
46
+ /// error behavior using `sass-true`. If you are not testing a function, use
47
+ /// `@error` instead.
48
+ ///
49
+ /// @example scss
50
+ /// // In a `sass-true` test, `throw.get-error()` can be used to assert that
51
+ /// // an error is thrown.
52
+ /// @use 'true' as test with ($catch-errors: true);
53
+ ///
54
+ /// @include test.describe('module.get-value()') {
55
+ /// @include test.it('throws an error if the value is not a map') {
56
+ /// $result: module.get-value('not a map', 'primary');
57
+ /// @include test.assert-truthy(throw.get-error($result), '$result is an error');
58
+ /// }
59
+ /// }
60
+ ///
61
+ /// @param {*} $error - The value to check.
62
+ /// @param {list} $errors - Additional values to check. Useful for checking
63
+ /// multiple errors at the same time.
64
+ /// @return {string|boolean} The error string if any value is an error, or false
65
+ /// otherwise.
66
+ @function get-error($error, $errors...) {
67
+ @if _is-error($error) {
68
+ @return $error;
69
+ }
70
+
71
+ @each $additional-error in $errors {
72
+ @if _is-error($additional-error) {
73
+ @return $additional-error;
74
+ }
75
+ }
76
+
77
+ @return false;
78
+ }
79
+
80
+ @function _is-error($error) {
81
+ @return (meta.type-of($error) == 'string') and
82
+ (string.index($error, 'ERROR') == 1);
83
+ }
@@ -0,0 +1,66 @@
1
+ //
2
+ // Copyright 2025 Google LLC
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ //
5
+
6
+ // Utilities for Sass type checking.
7
+
8
+ // go/keep-sorted start by_regex='(.+) prefix_order=sass:
9
+ @use 'sass:meta';
10
+ @use 'sass:string';
11
+ @use 'throw';
12
+ // go/keep-sorted end
13
+
14
+ /// Returns true if the given value matches the provided type string.
15
+ ///
16
+ /// The type string supports multiple types separated by `|`, such as
17
+ /// `'string|null'`. Type options are any values returned by `meta.type-of()`.
18
+ ///
19
+ /// @example scss
20
+ /// @function is-empty($value) {
21
+ /// @if type.matches($value, 'list|map') {
22
+ /// @return list.length($value) == 0;
23
+ /// }
24
+ /// @if type.matches($value, 'string') {
25
+ /// @return $value == '';
26
+ /// }
27
+ /// @return type.matches($value, 'null');
28
+ /// }
29
+ ///
30
+ /// @param {*} $value - The value to check the type of.
31
+ /// @param {string} $type-string - The type to check. May be multiple types
32
+ /// separated by `|`.
33
+ /// @return {boolean} True if the value matches the type string.
34
+ @function matches($value, $type-string) {
35
+ @if meta.type-of($type-string) != 'string' or $type-string == '' {
36
+ @return throw.error(
37
+ '$type-string must be a non-empty string',
38
+ $source: 'type.matches'
39
+ );
40
+ }
41
+ @if string.index($type-string, ' ') {
42
+ @return throw.error(
43
+ '$type-string may not contain spaces',
44
+ $source: 'type.matches'
45
+ );
46
+ }
47
+ @if string.index($type-string, 'boolean') {
48
+ @return throw.error(
49
+ 'Use "bool" instead of "boolean"',
50
+ $source: 'type.matches'
51
+ );
52
+ }
53
+
54
+ $value-type: meta.type-of($value);
55
+ @if $value-type == $type-string {
56
+ @return true;
57
+ }
58
+
59
+ @each $type in string.split($type-string, '|') {
60
+ @if $value-type == $type {
61
+ @return true;
62
+ }
63
+ }
64
+
65
+ @return false;
66
+ }