material-inspired-component-library 8.1.1 → 9.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/README.md +106 -18
  2. package/components/README.md +1 -1
  3. package/components/accordion/README.md +6 -6
  4. package/components/alert/README.md +10 -10
  5. package/components/alert/index.scss +27 -52
  6. package/components/appbar/README.md +19 -6
  7. package/components/appbar/index.scss +40 -44
  8. package/components/badge/README.md +12 -10
  9. package/components/badge/index.scss +21 -25
  10. package/components/bottomsheet/README.md +26 -1
  11. package/components/bottomsheet/index.scss +58 -44
  12. package/components/button/README.md +7 -5
  13. package/components/button/_shared.scss +210 -0
  14. package/components/button/index.scss +49 -283
  15. package/components/card/README.md +97 -85
  16. package/components/card/index.scss +46 -65
  17. package/components/checkbox/README.md +25 -14
  18. package/{tools/shapes/check.mjs → components/checkbox/_label.scss} +37 -42
  19. package/components/checkbox/index.scss +66 -66
  20. package/components/chip/README.md +186 -0
  21. package/components/chip/index.scss +285 -0
  22. package/components/datepicker/README.md +79 -0
  23. package/components/datepicker/index.scss +346 -315
  24. package/components/dialog/README.md +20 -10
  25. package/components/dialog/index.scss +55 -66
  26. package/components/divider/README.md +16 -15
  27. package/components/divider/index.scss +9 -25
  28. package/components/iconbutton/README.md +8 -3
  29. package/components/iconbutton/index.scss +83 -186
  30. package/components/list/README.md +89 -156
  31. package/components/list/index.scss +34 -36
  32. package/components/menu/README.md +81 -155
  33. package/components/menu/index.scss +52 -58
  34. package/components/navigationbar/README.md +108 -0
  35. package/components/navigationbar/index.scss +185 -0
  36. package/components/navigationrail/README.md +60 -36
  37. package/components/navigationrail/_navitem.scss +96 -0
  38. package/components/navigationrail/index.scss +76 -130
  39. package/components/progressindicator/README.md +83 -47
  40. package/components/progressindicator/index.scss +622 -172
  41. package/components/radio/README.md +11 -9
  42. package/components/radio/index.scss +36 -33
  43. package/components/select/README.md +12 -7
  44. package/components/select/index.scss +26 -34
  45. package/components/shapes/README.md +3 -3
  46. package/components/shapes/index.scss +0 -1
  47. package/components/sidesheet/README.md +21 -9
  48. package/components/sidesheet/index.scss +38 -46
  49. package/components/slider/README.md +21 -0
  50. package/components/slider/index.scss +108 -139
  51. package/components/snackbar/README.md +32 -35
  52. package/components/snackbar/index.scss +10 -22
  53. package/components/stepper/README.md +14 -7
  54. package/components/stepper/index.scss +58 -39
  55. package/components/switch/README.md +22 -15
  56. package/components/switch/index.scss +68 -60
  57. package/components/textfield/README.md +48 -5
  58. package/components/textfield/index.scss +193 -248
  59. package/components/timepicker/README.md +53 -23
  60. package/components/timepicker/index.scss +110 -128
  61. package/dist/alert.css +1 -1
  62. package/dist/alert.js +1 -1
  63. package/dist/appbar.css +1 -1
  64. package/dist/appbar.js +1 -1
  65. package/dist/badge.css +1 -1
  66. package/dist/badge.js +1 -1
  67. package/dist/base.css +1 -0
  68. package/dist/base.js +1 -0
  69. package/dist/bottomsheet.css +1 -1
  70. package/dist/bottomsheet.js +1 -1
  71. package/dist/button.css +1 -1
  72. package/dist/button.js +1 -1
  73. package/dist/card.css +1 -1
  74. package/dist/card.js +1 -1
  75. package/dist/checkbox.css +1 -1
  76. package/dist/checkbox.js +1 -1
  77. package/dist/chip.css +1 -0
  78. package/dist/chip.js +1 -0
  79. package/dist/components/iconbutton/index.d.ts +2 -7
  80. package/dist/components/slider/index.d.ts +1 -1
  81. package/dist/components/textfield/index.d.ts +2 -2
  82. package/dist/datepicker.css +1 -1
  83. package/dist/datepicker.js +1 -1
  84. package/dist/dialog.css +1 -1
  85. package/dist/dialog.js +1 -1
  86. package/dist/divider.css +1 -1
  87. package/dist/divider.js +1 -1
  88. package/dist/field.css +1 -0
  89. package/dist/field.js +1 -0
  90. package/dist/foundations/form/index.js +1 -1
  91. package/dist/foundations/runtime.d.ts +15 -0
  92. package/dist/foundations/runtime.js +1 -0
  93. package/dist/iconbutton.css +1 -1
  94. package/dist/iconbutton.js +1 -1
  95. package/dist/layout.css +1 -1
  96. package/dist/layout.js +1 -1
  97. package/dist/list.css +1 -1
  98. package/dist/list.js +1 -1
  99. package/dist/menu.css +1 -1
  100. package/dist/menu.js +1 -1
  101. package/dist/micl.css +1 -1
  102. package/dist/micl.d.ts +14 -5
  103. package/dist/micl.js +1 -1
  104. package/dist/navigationbar.css +1 -0
  105. package/dist/navigationbar.js +1 -0
  106. package/dist/navigationrail.css +1 -1
  107. package/dist/navigationrail.js +1 -1
  108. package/dist/progressindicator.css +1 -1
  109. package/dist/progressindicator.js +1 -1
  110. package/dist/radio.css +1 -1
  111. package/dist/radio.js +1 -1
  112. package/dist/scrollbar.js +1 -1
  113. package/dist/select.css +1 -1
  114. package/dist/select.js +1 -1
  115. package/dist/shapes.css +1 -1
  116. package/dist/shapes.js +1 -1
  117. package/dist/sidesheet.css +1 -1
  118. package/dist/sidesheet.js +1 -1
  119. package/dist/slider.css +1 -1
  120. package/dist/slider.js +1 -1
  121. package/dist/snackbar.css +1 -1
  122. package/dist/snackbar.js +1 -1
  123. package/dist/stepper.css +1 -1
  124. package/dist/stepper.js +1 -1
  125. package/dist/switch.css +1 -1
  126. package/dist/switch.js +1 -1
  127. package/dist/textfield.css +1 -1
  128. package/dist/textfield.js +1 -1
  129. package/dist/timepicker.css +1 -1
  130. package/dist/timepicker.js +1 -1
  131. package/foundations/_index.scss +35 -0
  132. package/foundations/{index.scss → base/index.scss} +21 -56
  133. package/foundations/field/index.scss +37 -0
  134. package/foundations/layout/index.scss +64 -65
  135. package/package.json +23 -9
  136. package/styles/statelayer.scss +20 -5
  137. package/styles.scss +5 -2
  138. package/.claude/settings.local.json +0 -17
  139. package/.editorconfig +0 -12
  140. package/.gitattributes +0 -9
  141. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -35
  142. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  143. package/CLAUDE.md +0 -53
  144. package/CODE_OF_CONDUCT.md +0 -128
  145. package/components/bottomsheet/index.ts +0 -153
  146. package/components/button/index.ts +0 -79
  147. package/components/checkbox/index.ts +0 -148
  148. package/components/datepicker/index.ts +0 -693
  149. package/components/iconbutton/index.ts +0 -77
  150. package/components/list/index.ts +0 -138
  151. package/components/menu/index.ts +0 -145
  152. package/components/navigationrail/index.ts +0 -87
  153. package/components/progressindicator/index.ts +0 -77
  154. package/components/slider/index.ts +0 -149
  155. package/components/snackbar/index.ts +0 -118
  156. package/components/stepper/index.ts +0 -248
  157. package/components/textfield/index.ts +0 -188
  158. package/components/timepicker/index.ts +0 -413
  159. package/dist/components/progressindicator/index.d.ts +0 -6
  160. package/dist/foundations.css +0 -1
  161. package/dist/foundations.js +0 -1
  162. package/docs/accordion.html +0 -344
  163. package/docs/alert.html +0 -177
  164. package/docs/bottomsheet.html +0 -240
  165. package/docs/button.html +0 -291
  166. package/docs/card-awards.webp +0 -0
  167. package/docs/card-cabinet.webp +0 -0
  168. package/docs/card-city.webp +0 -0
  169. package/docs/card-fingerprint.webp +0 -0
  170. package/docs/card-holiday.webp +0 -0
  171. package/docs/card-names.webp +0 -0
  172. package/docs/card.html +0 -159
  173. package/docs/checkbox.html +0 -147
  174. package/docs/datepicker.html +0 -274
  175. package/docs/dialog.html +0 -195
  176. package/docs/divider.html +0 -139
  177. package/docs/docs.css +0 -26
  178. package/docs/docs.js +0 -139
  179. package/docs/iconbutton.html +0 -331
  180. package/docs/index.html +0 -431
  181. package/docs/list.html +0 -310
  182. package/docs/menu.html +0 -574
  183. package/docs/micl.css +0 -1
  184. package/docs/micl.js +0 -1
  185. package/docs/navigationrail.html +0 -138
  186. package/docs/progressindicator.html +0 -288
  187. package/docs/radio.html +0 -123
  188. package/docs/select.html +0 -337
  189. package/docs/shapes.css +0 -1
  190. package/docs/shapes.html +0 -159
  191. package/docs/shapes.js +0 -1
  192. package/docs/sidesheet.html +0 -149
  193. package/docs/slider.html +0 -141
  194. package/docs/snackbar.html +0 -102
  195. package/docs/stepper.html +0 -319
  196. package/docs/switch.html +0 -196
  197. package/docs/textfield.html +0 -208
  198. package/docs/themes/airblue/dark-hc.css +0 -51
  199. package/docs/themes/airblue/dark-mc.css +0 -51
  200. package/docs/themes/airblue/dark.css +0 -51
  201. package/docs/themes/airblue/light-hc.css +0 -51
  202. package/docs/themes/airblue/light-mc.css +0 -51
  203. package/docs/themes/airblue/light.css +0 -51
  204. package/docs/themes/airblue/theme.css +0 -306
  205. package/docs/themes/barnred/dark-hc.css +0 -51
  206. package/docs/themes/barnred/dark-mc.css +0 -51
  207. package/docs/themes/barnred/dark.css +0 -51
  208. package/docs/themes/barnred/light-hc.css +0 -51
  209. package/docs/themes/barnred/light-mc.css +0 -51
  210. package/docs/themes/barnred/light.css +0 -51
  211. package/docs/themes/barnred/theme.css +0 -306
  212. package/docs/themes/citrine/dark-hc.css +0 -51
  213. package/docs/themes/citrine/dark-mc.css +0 -51
  214. package/docs/themes/citrine/dark.css +0 -51
  215. package/docs/themes/citrine/light-hc.css +0 -51
  216. package/docs/themes/citrine/light-mc.css +0 -51
  217. package/docs/themes/citrine/light.css +0 -51
  218. package/docs/themes/citrine/theme.css +0 -306
  219. package/docs/themes/gray/dark-hc.css +0 -51
  220. package/docs/themes/gray/dark-mc.css +0 -51
  221. package/docs/themes/gray/dark.css +0 -51
  222. package/docs/themes/gray/light-hc.css +0 -51
  223. package/docs/themes/gray/light-mc.css +0 -51
  224. package/docs/themes/gray/light.css +0 -51
  225. package/docs/themes/gray/theme.css +0 -306
  226. package/docs/themes/greenery/dark-hc.css +0 -51
  227. package/docs/themes/greenery/dark-mc.css +0 -51
  228. package/docs/themes/greenery/dark.css +0 -51
  229. package/docs/themes/greenery/light-hc.css +0 -51
  230. package/docs/themes/greenery/light-mc.css +0 -51
  231. package/docs/themes/greenery/light.css +0 -51
  232. package/docs/themes/greenery/theme.css +0 -306
  233. package/docs/themes/hermana/dark-hc.css +0 -51
  234. package/docs/themes/hermana/dark-mc.css +0 -51
  235. package/docs/themes/hermana/dark.css +0 -51
  236. package/docs/themes/hermana/light-hc.css +0 -51
  237. package/docs/themes/hermana/light-mc.css +0 -51
  238. package/docs/themes/hermana/light.css +0 -51
  239. package/docs/themes/hermana/theme.css +0 -306
  240. package/docs/themes/illuminating/dark-hc.css +0 -51
  241. package/docs/themes/illuminating/dark-mc.css +0 -51
  242. package/docs/themes/illuminating/dark.css +0 -51
  243. package/docs/themes/illuminating/light-hc.css +0 -51
  244. package/docs/themes/illuminating/light-mc.css +0 -51
  245. package/docs/themes/illuminating/light.css +0 -51
  246. package/docs/themes/illuminating/theme.css +0 -306
  247. package/docs/themes/magenta/dark-hc.css +0 -51
  248. package/docs/themes/magenta/dark-mc.css +0 -51
  249. package/docs/themes/magenta/dark.css +0 -51
  250. package/docs/themes/magenta/light-hc.css +0 -51
  251. package/docs/themes/magenta/light-mc.css +0 -51
  252. package/docs/themes/magenta/light.css +0 -51
  253. package/docs/themes/magenta/theme.css +0 -306
  254. package/docs/themes/mocha/dark-hc.css +0 -51
  255. package/docs/themes/mocha/dark-mc.css +0 -51
  256. package/docs/themes/mocha/dark.css +0 -51
  257. package/docs/themes/mocha/light-hc.css +0 -51
  258. package/docs/themes/mocha/light-mc.css +0 -51
  259. package/docs/themes/mocha/light.css +0 -51
  260. package/docs/themes/mocha/theme.css +0 -306
  261. package/docs/themes/olivegreen/dark-hc.css +0 -51
  262. package/docs/themes/olivegreen/dark-mc.css +0 -51
  263. package/docs/themes/olivegreen/dark.css +0 -51
  264. package/docs/themes/olivegreen/light-hc.css +0 -51
  265. package/docs/themes/olivegreen/light-mc.css +0 -51
  266. package/docs/themes/olivegreen/light.css +0 -51
  267. package/docs/themes/olivegreen/theme.css +0 -306
  268. package/docs/themes/peri/dark-hc.css +0 -51
  269. package/docs/themes/peri/dark-mc.css +0 -51
  270. package/docs/themes/peri/dark.css +0 -51
  271. package/docs/themes/peri/light-hc.css +0 -51
  272. package/docs/themes/peri/light-mc.css +0 -51
  273. package/docs/themes/peri/light.css +0 -51
  274. package/docs/themes/peri/theme.css +0 -306
  275. package/docs/timepicker.html +0 -160
  276. package/foundations/form/index.ts +0 -174
  277. package/foundations/layout/README.md +0 -127
  278. package/intl.d.ts +0 -9
  279. package/micl.ts +0 -221
  280. package/styles/README.md +0 -196
  281. package/tools/shapes/generate.mjs +0 -828
  282. package/tsconfig.json +0 -116
  283. package/webpack.config.js +0 -159
@@ -19,11 +19,11 @@
19
19
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
20
  // SOFTWARE.
21
21
 
22
- @use '../../foundations';
23
22
  @use '../../styles/motion';
24
23
  @use '../../styles/shape';
25
24
  @use '../../styles/statelayer';
26
25
  @use '../../styles/typography';
26
+ @use './label';
27
27
 
28
28
  @include shape.corner('full');
29
29
 
@@ -41,17 +41,16 @@
41
41
  @include motion.duration('short3');
42
42
  @include motion.duration('long4');
43
43
 
44
- :root {
45
- --md-sys-checkbox-border-width: 2px;
46
- --md-sys-checkbox-check-thickness: 2px;
47
- --md-sys-checkbox-container-size: 18px;
48
- }
44
+ $checkbox: 'input[type=checkbox].micl-checkbox';
49
45
 
50
- input[type=checkbox].micl-checkbox {
51
- --md-sys-checkbox-motion-duration: #{motion.$md-sys-motion-expressive-slow-effects-duration};
52
- --md-sys-checkbox-motion-duration-reverse: #{motion.$md-sys-motion-expressive-default-effects-duration};
53
- --md-sys-checkbox-motion-spatial: #{motion.$md-sys-motion-expressive-fast-spatial};
46
+ #{$checkbox} {
47
+ --md-comp-checkbox-motion-duration: #{motion.$md-sys-motion-expressive-slow-effects-duration};
48
+ --md-comp-checkbox-motion-duration-reverse: #{motion.$md-sys-motion-expressive-default-effects-duration};
49
+ --md-comp-checkbox-motion-spatial: #{motion.$md-sys-motion-expressive-fast-spatial};
54
50
 
51
+ --_size: var(--md-comp-checkbox-container-size, 18px);
52
+ --_outline-width: var(--md-comp-checkbox-outline-width, 2px);
53
+ --_check-thickness: var(--md-comp-checkbox-check-thickness, 2px);
55
54
  --statelayer-color: var(--md-sys-color-on-surface);
56
55
 
57
56
  appearance: none;
@@ -69,21 +68,25 @@ input[type=checkbox].micl-checkbox {
69
68
  border-radius: var(--md-sys-shape-corner-full);
70
69
  outline-offset: -4px;
71
70
 
71
+ // The check mark: two currentColor borders rotated into a check, revealed by a
72
+ // combination of block-size and clip-path transitions. currentColor, so that the
73
+ // error and disabled states recolour it with a single color declaration.
72
74
  &::before {
73
- --md-sys-checkbox-check-width: calc(var(--md-sys-checkbox-container-size) - 3px);
74
- --md-sys-checkbox-check-height: calc(0.4667 * var(--md-sys-checkbox-check-width));
75
+ --_check-width: calc(var(--_size) - 3px);
76
+ --_check-height: calc(0.4667 * var(--_check-width));
75
77
 
76
78
  content: "";
77
79
  box-sizing: border-box;
78
80
  position: absolute;
79
- inline-size: var(--md-sys-checkbox-check-width);
81
+ inline-size: var(--_check-width);
80
82
  block-size: 0;
81
83
  inset: 0;
82
- inset-block-start: calc(-0.25 * var(--md-sys-checkbox-container-size));
84
+ inset-block-start: calc(-0.25 * var(--_size));
83
85
  inset-inline-start: 1px;
84
86
  margin: auto;
85
- border-block-end: var(--md-sys-checkbox-check-thickness) var(--md-sys-color-on-primary) solid;
86
- border-inline-start: var(--md-sys-checkbox-check-thickness) var(--md-sys-color-on-primary) solid;
87
+ color: var(--md-comp-checkbox-selected-icon-color, var(--md-sys-color-on-primary));
88
+ border-block-end: var(--_check-thickness) currentColor solid;
89
+ border-inline-start: var(--_check-thickness) currentColor solid;
87
90
  transform: rotate(-45deg);
88
91
  transform-origin: center;
89
92
  clip-path: rect(0 2px 0 0);
@@ -97,41 +100,40 @@ input[type=checkbox].micl-checkbox {
97
100
  transform 0ms linear var(--md-sys-motion-duration-short3);
98
101
  }
99
102
  &::after {
100
- --md-sys-checkbox-background-color: transparent;
101
- --md-sys-checkbox-border-color: var(--md-sys-color-on-surface-variant);
103
+ --_container-color: transparent;
104
+ --_outline-color: var(--md-comp-checkbox-unselected-outline-color, var(--md-sys-color-on-surface-variant));
102
105
 
103
106
  content: "";
104
107
  box-sizing: border-box;
105
108
  position: absolute;
106
- inline-size: var(--md-sys-checkbox-container-size);
107
- block-size: var(--md-sys-checkbox-container-size);
109
+ inline-size: var(--_size);
110
+ block-size: var(--_size);
108
111
  inset: 0;
109
112
  margin: auto;
110
- border: var(--md-sys-checkbox-border-width) solid var(--md-sys-checkbox-border-color);
113
+ border: var(--_outline-width) solid var(--_outline-color);
111
114
  border-radius: 2px;
112
- background-color: var(--md-sys-checkbox-background-color);
115
+ background-color: var(--_container-color);
113
116
  transition:
114
- background-color var(--md-sys-checkbox-motion-duration-reverse) motion.$md-sys-motion-easing-emphasized var(--md-sys-checkbox-motion-duration-reverse),
115
- border-color var(--md-sys-checkbox-motion-duration-reverse) motion.$md-sys-motion-easing-emphasized var(--md-sys-checkbox-motion-duration-reverse);
117
+ background-color var(--md-comp-checkbox-motion-duration-reverse) motion.$md-sys-motion-easing-emphasized var(--md-comp-checkbox-motion-duration-reverse),
118
+ border-color var(--md-comp-checkbox-motion-duration-reverse) motion.$md-sys-motion-easing-emphasized var(--md-comp-checkbox-motion-duration-reverse);
116
119
  }
117
- &:checked,
118
- &:indeterminate {
120
+ &:is(:checked, :indeterminate) {
119
121
  --statelayer-color: var(--md-sys-color-primary);
120
122
 
121
123
  &::before {
122
- block-size: var(--md-sys-checkbox-check-height);
123
- clip-path: rect(0 calc(var(--md-sys-checkbox-container-size) - 5px) 18px 0);
124
+ block-size: var(--_check-height);
125
+ clip-path: rect(0 calc(var(--_size) - 5px) var(--_size) 0);
124
126
  transition:
125
- block-size var(--md-sys-motion-duration-short3) var(--md-sys-checkbox-motion-spatial),
126
- clip-path var(--md-sys-motion-duration-long4) var(--md-sys-motion-duration-short3) var(--md-sys-checkbox-motion-spatial);
127
+ block-size var(--md-sys-motion-duration-short3) var(--md-comp-checkbox-motion-spatial),
128
+ clip-path var(--md-sys-motion-duration-long4) var(--md-sys-motion-duration-short3) var(--md-comp-checkbox-motion-spatial);
127
129
  }
128
130
  &::after {
129
- --md-sys-checkbox-background-color: var(--md-sys-color-primary);
130
- --md-sys-checkbox-border-color: var(--md-sys-color-primary);
131
+ --_container-color: var(--md-comp-checkbox-selected-container-color, var(--md-sys-color-primary));
132
+ --_outline-color: var(--md-comp-checkbox-selected-container-color, var(--md-sys-color-primary));
131
133
 
132
134
  transition:
133
- background-color var(--md-sys-checkbox-motion-duration) linear,
134
- border-color var(--md-sys-checkbox-motion-duration) motion.$md-sys-motion-easing-emphasized;
135
+ background-color var(--md-comp-checkbox-motion-duration) linear,
136
+ border-color var(--md-comp-checkbox-motion-duration) motion.$md-sys-motion-easing-emphasized;
135
137
  }
136
138
  }
137
139
  &:indeterminate::before {
@@ -143,10 +145,9 @@ input[type=checkbox].micl-checkbox {
143
145
  --statelayer-color: var(--md-sys-color-error);
144
146
 
145
147
  &::after {
146
- --md-sys-checkbox-border-color: var(--md-sys-color-error);
148
+ --_outline-color: var(--md-sys-color-error);
147
149
  }
148
- &:checked,
149
- &:indeterminate {
150
+ &:is(:checked, :indeterminate) {
150
151
  &:hover,
151
152
  &:focus-visible,
152
153
  &:active {
@@ -156,17 +157,17 @@ input[type=checkbox].micl-checkbox {
156
157
  color: var(--md-sys-color-on-error);
157
158
  }
158
159
  &::after {
159
- --md-sys-checkbox-background-color: var(--md-sys-color-error);
160
+ --_container-color: var(--md-sys-color-error);
160
161
  }
161
162
  }
162
- &:not(:checked):not(:indeterminate) {
163
+ &:not(:checked, :indeterminate) {
163
164
  &:hover,
164
165
  &:focus-visible,
165
166
  &:active {
166
167
  --statelayer-color: var(--md-sys-color-error);
167
168
 
168
169
  &::after {
169
- --md-sys-checkbox-border-color: var(--md-sys-color-error);
170
+ --_outline-color: var(--md-sys-color-error);
170
171
  }
171
172
  }
172
173
  }
@@ -183,17 +184,18 @@ input[type=checkbox].micl-checkbox {
183
184
  ),
184
185
  linear-gradient(rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)));
185
186
  background-repeat: no-repeat;
187
+ background-position: var(--micl-x, center) var(--micl-y, center), 0 0;
186
188
  background-size: 0%, 100%;
187
189
  cursor: pointer;
188
190
  transition:
189
191
  background-size 0ms,
190
- --statelayer-opacity var(--md-sys-checkbox-motion-duration) linear;
192
+ --statelayer-opacity var(--md-comp-checkbox-motion-duration) linear;
191
193
 
192
194
  &:hover {
193
195
  --statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity, 8%);
194
196
 
195
- &:not(:checked):not(:indeterminate)::after {
196
- --md-sys-checkbox-border-color: var(--md-sys-color-on-surface);
197
+ &:not(:checked, :indeterminate)::after {
198
+ --_outline-color: var(--md-sys-color-on-surface);
197
199
  }
198
200
  }
199
201
  &:focus-visible {
@@ -201,68 +203,66 @@ input[type=checkbox].micl-checkbox {
201
203
 
202
204
  outline: var(--md-sys-state-focus-indicator-thickness, 3px) solid var(--md-sys-color-secondary);
203
205
 
204
- &:not(:checked):not(:indeterminate)::after {
205
- --md-sys-checkbox-border-color: var(--md-sys-color-on-surface);
206
+ &:not(:checked, :indeterminate)::after {
207
+ --_outline-color: var(--md-sys-color-on-surface);
206
208
  }
207
209
  }
208
210
  &:active {
209
211
  --statelayer-color: var(--md-sys-color-on-surface);
210
212
  --statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity, 10%);
211
213
 
212
- &:not(:checked):not(:indeterminate) {
214
+ &:not(:checked, :indeterminate) {
213
215
  --statelayer-color: var(--md-sys-color-primary);
214
216
 
215
217
  &::after {
216
- --md-sys-checkbox-border-color: var(--md-sys-color-on-surface);
218
+ --_outline-color: var(--md-sys-color-on-surface);
217
219
  }
218
220
  }
219
221
  }
220
222
  &.micl-rippling {
221
- animation: micl-ripple var(--md-sys-state-ripple-duration) motion.$md-sys-motion-easing-standard;
223
+ animation: micl-ripple var(--md-sys-state-ripple-duration);
222
224
  }
223
225
  }
224
226
  &:disabled {
225
227
  opacity: var(--md-sys-state-disabled-state-layer-opacity, 38%);
226
228
 
227
- &:checked,
228
- &:indeterminate {
229
+ &:is(:checked, :indeterminate) {
229
230
  &::before {
230
231
  color: var(--md-sys-color-surface);
231
232
  }
232
233
  &::after {
233
- --md-sys-checkbox-background-color: var(--md-sys-color-on-surface);
234
+ --_container-color: var(--md-sys-color-on-surface);
234
235
  }
235
236
  }
236
237
  &::after {
237
- --md-sys-checkbox-border-color: var(--md-sys-color-on-surface);
238
+ --_outline-color: var(--md-sys-color-on-surface);
238
239
  }
239
240
  }
240
241
  }
241
242
 
242
- input[type=checkbox].micl-checkbox:not(:disabled) + label,
243
- label:has(+ input[type=checkbox].micl-checkbox:not(:disabled)) {
244
- -webkit-tap-highlight-color: transparent;
245
- cursor: pointer;
243
+ #{$checkbox}:not(:disabled) + label,
244
+ label:has(+ #{$checkbox}:not(:disabled)) {
245
+ @extend %micl-toggle-label-pointer;
246
246
  }
247
- input[type=checkbox].micl-checkbox + label,
248
- label:has(+ input[type=checkbox].micl-checkbox) {
249
- color: var(--md-sys-color-on-surface);
247
+ #{$checkbox} + label,
248
+ label:has(+ #{$checkbox}) {
249
+ @extend %micl-toggle-label;
250
250
  }
251
- input[type=checkbox].micl-checkbox:disabled + label,
252
- label:has(+ input[type=radio].micl-checkbox:disabled) {
253
- opacity: var(--md-sys-state-disabled-state-layer-opacity, 38%)
251
+ #{$checkbox}:disabled + label,
252
+ label:has(+ #{$checkbox}:disabled) {
253
+ @extend %micl-toggle-label-disabled;
254
254
  }
255
255
 
256
- [dir=rtl] input[type=checkbox].micl-checkbox {
256
+ #{$checkbox}:dir(rtl) {
257
257
  &::before {
258
- clip-path: rect(0 18px 8px 16px);
258
+ clip-path: rect(0 var(--_size) var(--_size) calc(var(--_size) - 2px));
259
259
  }
260
260
  &:checked::before {
261
- clip-path: rect(0 18px 8px 2px);
261
+ clip-path: rect(0 var(--_size) var(--_size) 2px);
262
262
  transform: rotate(45deg);
263
263
  }
264
264
  &:indeterminate::before {
265
- clip-path: rect(0 18px 8px 2px);
265
+ clip-path: rect(0 var(--_size) var(--_size) 2px);
266
266
  transform: rotate(0deg);
267
267
  }
268
268
  }
@@ -0,0 +1,186 @@
1
+ # Chip
2
+ This component implements the [Material Design 3 Chips](https://m3.material.io/components/chips/overview) design. Chips help people enter information, make selections, filter content, or trigger actions.
3
+
4
+ ## Basic Usage
5
+
6
+ ### HTML
7
+ The Chip component is an extension of the [**Button** component](../button/README.md). Chips are placed in a `micl-chips` container. To create a basic chip, use the `<button>` element with a class that specifies its type. This example uses two assist chips:
8
+
9
+ ```HTML
10
+ <fieldset class="micl-chips">
11
+ <button type="button" class="micl-chip-assist">Turn on lights</button>
12
+ <button type="button" class="micl-chip-assist">Set alarm</button>
13
+ </fieldset>
14
+ ```
15
+
16
+ ### CSS
17
+ Import the chip styles into your project:
18
+
19
+ ```CSS
20
+ @use "material-inspired-component-library/dist/chip";
21
+ ```
22
+
23
+ Or import all MICL styles:
24
+ ```CSS
25
+ @use "material-inspired-component-library/styles";
26
+ ```
27
+
28
+ ### JavaScript
29
+ No custom JavaScript is required for the core functionality of this component.
30
+
31
+ ### Live Demo
32
+ A live example of the [Chip component](https://henkpb.github.io/micl/chip.html) is available to interact with.
33
+
34
+ ## Variants
35
+ Material Design provides **four types** of chips, each with its own class:
36
+
37
+ | Type | Class | Purpose |
38
+ |---|---|---|
39
+ | Assist | `micl-chip-assist` | Trigger a smart or automated action |
40
+ | Filter | `micl-chip-filter` | Select from a set of options |
41
+ | Input | `micl-chip-input` | Represent discrete pieces of information entered by the user |
42
+ | Suggestion | `micl-chip-suggestion` | Present dynamically generated suggestions |
43
+
44
+ By default, chips have an **outlined** appearance. For an elevated appearance without an outline, add the `micl-chip--elevated` class:
45
+
46
+ ```HTML
47
+ <button type="button" class="micl-chip-assist micl-chip--elevated">Turn on lights</button>
48
+ ```
49
+
50
+ Adding the `disabled` boolean attribute causes the chip to be displayed in a disabled state. **Exceptions**: for filter chips, the attribute is placed on the nested `<input>` element instead, and for input chips on both nested `<button>` elements (see below).
51
+
52
+ ### Filter Chip
53
+ A filter chip is a `<label>` wrapping an `<input type="checkbox">` (multiple selection) or `<input type="radio">` (single selection), followed by the label text. The leading element with the checkmark icon is required; it is revealed with an animation when the chip is selected:
54
+
55
+ ```HTML
56
+ <fieldset class="micl-chips">
57
+ <label class="micl-chip-filter">
58
+ <span class="micl-button__icon material-symbols-outlined" aria-hidden="true">check</span>
59
+ <input type="checkbox" name="amenities" value="parking">
60
+ <span>Parking</span>
61
+ </label>
62
+ <label class="micl-chip-filter">
63
+ <span class="micl-button__icon material-symbols-outlined" aria-hidden="true">check</span>
64
+ <input type="checkbox" name="amenities" value="garden" disabled>
65
+ <span>Garden</span>
66
+ </label>
67
+ </fieldset>
68
+ ```
69
+
70
+ The selected state follows the `:checked` state of the input, and the disabled state its `disabled` attribute.
71
+
72
+ A filter chip may additionally carry a **leading icon**, placed before the checkmark icon. It is visible while the chip is unselected and hidden while it is selected.
73
+
74
+ ```HTML
75
+ <label class="micl-chip-filter">
76
+ <span class="micl-button__icon material-symbols-outlined" aria-hidden="true">elevator</span>
77
+ <span class="micl-button__icon material-symbols-outlined" aria-hidden="true">check</span>
78
+ <input type="checkbox" name="amenities" value="elevator">
79
+ <span>Elevator</span>
80
+ </label>
81
+ ```
82
+
83
+ ### Input Chip
84
+ An input chip carries **two actions** — activating the chip and removing it. The chip itself is a non-interactive `<span>` container holding two sibling `<button>` elements: the primary action with the label, and the trailing remove action.
85
+
86
+ ```HTML
87
+ <span class="micl-chip-input">
88
+ <button type="button" class="micl-chip__primary">Avocado</button>
89
+ <button type="button" class="micl-chip__remove material-symbols-outlined"
90
+ aria-label="Remove Avocado">close</button>
91
+ </span>
92
+ ```
93
+
94
+ To disable an input chip, place the `disabled` attribute on **both** buttons.
95
+
96
+ An input chip may represent a person with a leading avatar — an `<img>`, or an element with a monogram — placed inside the primary action before the label.
97
+
98
+ ```HTML
99
+ <span class="micl-chip-input">
100
+ <button type="button" class="micl-chip__primary">
101
+ <img src="jonas.webp" alt="" class="micl-chip__avatar">
102
+ <span>Jonas</span>
103
+ </button>
104
+ <button type="button" class="micl-chip__remove material-symbols-outlined"
105
+ aria-label="Remove Jonas">close</button>
106
+ </span>
107
+ ```
108
+
109
+ For a collection of input chips presented like a form field, add the `micl-chips--input` class to the container:
110
+
111
+ ```HTML
112
+ <fieldset class="micl-chips micl-chips--input">
113
+ <legend class="md-sys-typescale-label-large">Recipients</legend>
114
+ ...
115
+ </fieldset>
116
+ ```
117
+
118
+ ## Icons
119
+ To add a leading icon to a chip, include an element with the `micl-button__icon` class before the label text:
120
+
121
+ ```HTML
122
+ <button type="button" class="micl-chip-suggestion">
123
+ <span class="micl-button__icon material-symbols-outlined" aria-hidden="true">music_note</span>
124
+ <span>What song is this?</span>
125
+ </button>
126
+ ```
127
+
128
+ These examples use [Google Material Symbols](https://fonts.google.com/icons), but other icon libraries can be used just as well.
129
+
130
+ ## Theming
131
+ Each chip type can be themed with CSS custom properties that follow the Material Design 3 component-token naming convention.
132
+
133
+ ### Assist
134
+ | Custom property | Meaning | Default |
135
+ |---|---|---|
136
+ | `--md-comp-assist-chip-label-text-color` | Label colour | `--md-sys-color-on-surface` |
137
+ | `--md-comp-assist-chip-leading-icon-color` | Icon colour | `--md-sys-color-primary` |
138
+ | `--md-comp-assist-chip-outline-color` | Outline (border) colour | `--md-sys-color-outline-variant` |
139
+ | `--md-comp-assist-chip-elevated-container-color` | Container background when elevated | `--md-sys-color-surface-container-low` |
140
+ | `--md-comp-assist-chip-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` at `38%` |
141
+ | `--md-comp-assist-chip-disabled-outline-color` | Outline colour when disabled | `--md-sys-color-on-surface` at `12%` |
142
+
143
+ ### Filter
144
+ | Custom property | Meaning | Default |
145
+ |---|---|---|
146
+ | `--md-comp-filter-chip-label-text-color` | Label colour | `--md-sys-color-on-surface-variant` |
147
+ | `--md-comp-filter-chip-leading-icon-color` | Icon colour | `--md-sys-color-primary` |
148
+ | `--md-comp-filter-chip-outline-color` | Outline (border) colour | `--md-sys-color-outline-variant` |
149
+ | `--md-comp-filter-chip-elevated-container-color` | Container background when elevated | `--md-sys-color-surface-container-low` |
150
+ | `--md-comp-filter-chip-selected-container-color` | Container background when selected | `--md-sys-color-secondary-container` |
151
+ | `--md-comp-filter-chip-selected-label-text-color` | Label colour when selected | `--md-sys-color-on-secondary-container` |
152
+ | `--md-comp-filter-chip-selected-leading-icon-color` | Checkmark colour when selected | `--md-sys-color-on-secondary-container` |
153
+ | `--md-comp-filter-chip-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` at `38%` |
154
+ | `--md-comp-filter-chip-disabled-outline-color` | Outline colour when disabled | `--md-sys-color-on-surface` at `12%` |
155
+ | `--md-comp-filter-chip-disabled-selected-container-color` | Container background when selected and disabled | `--md-sys-color-on-surface` |
156
+ | `--md-comp-filter-chip-disabled-selected-container-opacity` | Container opacity when selected and disabled | `12%` |
157
+
158
+ ### Input
159
+ | Custom property | Meaning | Default |
160
+ |---|---|---|
161
+ | `--md-comp-input-chip-label-text-color` | Label colour | `--md-sys-color-on-surface-variant` |
162
+ | `--md-comp-input-chip-leading-icon-color` | Icon colour | the label colour |
163
+ | `--md-comp-input-chip-trailing-icon-color` | Trailing (remove) icon colour | the leading icon colour |
164
+ | `--md-comp-input-chip-outline-color` | Outline (border) colour | `--md-sys-color-outline-variant` |
165
+ | `--md-comp-input-chip-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` at `38%` |
166
+ | `--md-comp-input-chip-disabled-outline-color` | Outline colour when disabled | `--md-sys-color-on-surface` at `12%` |
167
+ | `--md-comp-input-chip-avatar-size` | Avatar diameter | `24px` |
168
+ | `--md-comp-input-chip-avatar-shape` | Avatar corner shape | `--md-sys-shape-corner-full` |
169
+ | `--md-comp-input-chip-disabled-avatar-opacity` | Avatar opacity when disabled | `38%` |
170
+ | `--md-comp-input-chip-avatar-color` | Monogram avatar background colour ¹ | `--md-sys-color-primary-container` |
171
+ | `--md-comp-input-chip-avatar-label-color` | Monogram avatar text colour ¹ | `--md-sys-color-on-primary-container` |
172
+
173
+ ¹ MICL extension: monogram avatars are not part of the Material Design token set, which only covers image avatars.
174
+
175
+ ### Suggestion
176
+ | Custom property | Meaning | Default |
177
+ |---|---|---|
178
+ | `--md-comp-suggestion-chip-label-text-color` | Label colour | `--md-sys-color-on-surface-variant` |
179
+ | `--md-comp-suggestion-chip-leading-icon-color` | Icon colour | `--md-sys-color-primary` |
180
+ | `--md-comp-suggestion-chip-outline-color` | Outline (border) colour | `--md-sys-color-outline-variant` |
181
+ | `--md-comp-suggestion-chip-elevated-container-color` | Container background when elevated | `--md-sys-color-surface-container-low` |
182
+ | `--md-comp-suggestion-chip-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` at `38%` |
183
+ | `--md-comp-suggestion-chip-disabled-outline-color` | Outline colour when disabled | `--md-sys-color-on-surface` at `12%` |
184
+
185
+ ## Compatibility
186
+ This component utilizes relative RGB color values and the `:has()` pseudo-class, which may not be fully supported in your browser. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#browser_compatibility) for details.