material-inspired-component-library 8.1.1 → 9.0.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 (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 +192 -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
@@ -1,306 +0,0 @@
1
- .light {
2
- --md-sys-color-primary: rgb(88 89 146);
3
- --md-sys-color-surface-tint: rgb(88 89 146);
4
- --md-sys-color-on-primary: rgb(255 255 255);
5
- --md-sys-color-primary-container: rgb(225 223 255);
6
- --md-sys-color-on-primary-container: rgb(64 65 120);
7
- --md-sys-color-secondary: rgb(93 92 114);
8
- --md-sys-color-on-secondary: rgb(255 255 255);
9
- --md-sys-color-secondary-container: rgb(226 224 249);
10
- --md-sys-color-on-secondary-container: rgb(69 69 89);
11
- --md-sys-color-tertiary: rgb(121 83 105);
12
- --md-sys-color-on-tertiary: rgb(255 255 255);
13
- --md-sys-color-tertiary-container: rgb(255 216 236);
14
- --md-sys-color-on-tertiary-container: rgb(95 60 81);
15
- --md-sys-color-error: rgb(186 26 26);
16
- --md-sys-color-on-error: rgb(255 255 255);
17
- --md-sys-color-error-container: rgb(255 218 214);
18
- --md-sys-color-on-error-container: rgb(147 0 10);
19
- --md-sys-color-background: rgb(252 248 255);
20
- --md-sys-color-on-background: rgb(27 27 33);
21
- --md-sys-color-surface: rgb(252 248 255);
22
- --md-sys-color-on-surface: rgb(27 27 33);
23
- --md-sys-color-surface-variant: rgb(228 225 236);
24
- --md-sys-color-on-surface-variant: rgb(71 70 79);
25
- --md-sys-color-outline: rgb(119 118 128);
26
- --md-sys-color-outline-variant: rgb(200 197 208);
27
- --md-sys-color-shadow: rgb(0 0 0);
28
- --md-sys-color-scrim: rgb(0 0 0);
29
- --md-sys-color-inverse-surface: rgb(48 48 54);
30
- --md-sys-color-inverse-on-surface: rgb(243 239 247);
31
- --md-sys-color-inverse-primary: rgb(193 193 255);
32
- --md-sys-color-primary-fixed: rgb(225 223 255);
33
- --md-sys-color-on-primary-fixed: rgb(20 19 74);
34
- --md-sys-color-primary-fixed-dim: rgb(193 193 255);
35
- --md-sys-color-on-primary-fixed-variant: rgb(64 65 120);
36
- --md-sys-color-secondary-fixed: rgb(226 224 249);
37
- --md-sys-color-on-secondary-fixed: rgb(26 26 44);
38
- --md-sys-color-secondary-fixed-dim: rgb(198 196 221);
39
- --md-sys-color-on-secondary-fixed-variant: rgb(69 69 89);
40
- --md-sys-color-tertiary-fixed: rgb(255 216 236);
41
- --md-sys-color-on-tertiary-fixed: rgb(47 17 36);
42
- --md-sys-color-tertiary-fixed-dim: rgb(233 185 211);
43
- --md-sys-color-on-tertiary-fixed-variant: rgb(95 60 81);
44
- --md-sys-color-surface-dim: rgb(220 217 224);
45
- --md-sys-color-surface-bright: rgb(252 248 255);
46
- --md-sys-color-surface-container-lowest: rgb(255 255 255);
47
- --md-sys-color-surface-container-low: rgb(246 242 250);
48
- --md-sys-color-surface-container: rgb(240 236 244);
49
- --md-sys-color-surface-container-high: rgb(234 231 239);
50
- --md-sys-color-surface-container-highest: rgb(228 225 233);
51
- }
52
- .light-medium-contrast {
53
- --md-sys-color-primary: rgb(47 48 102);
54
- --md-sys-color-surface-tint: rgb(88 89 146);
55
- --md-sys-color-on-primary: rgb(255 255 255);
56
- --md-sys-color-primary-container: rgb(103 104 162);
57
- --md-sys-color-on-primary-container: rgb(255 255 255);
58
- --md-sys-color-secondary: rgb(52 52 72);
59
- --md-sys-color-on-secondary: rgb(255 255 255);
60
- --md-sys-color-secondary-container: rgb(108 107 129);
61
- --md-sys-color-on-secondary-container: rgb(255 255 255);
62
- --md-sys-color-tertiary: rgb(77 43 64);
63
- --md-sys-color-on-tertiary: rgb(255 255 255);
64
- --md-sys-color-tertiary-container: rgb(137 97 120);
65
- --md-sys-color-on-tertiary-container: rgb(255 255 255);
66
- --md-sys-color-error: rgb(116 0 6);
67
- --md-sys-color-on-error: rgb(255 255 255);
68
- --md-sys-color-error-container: rgb(207 44 39);
69
- --md-sys-color-on-error-container: rgb(255 255 255);
70
- --md-sys-color-background: rgb(252 248 255);
71
- --md-sys-color-on-background: rgb(27 27 33);
72
- --md-sys-color-surface: rgb(252 248 255);
73
- --md-sys-color-on-surface: rgb(17 17 22);
74
- --md-sys-color-surface-variant: rgb(228 225 236);
75
- --md-sys-color-on-surface-variant: rgb(54 53 62);
76
- --md-sys-color-outline: rgb(82 81 91);
77
- --md-sys-color-outline-variant: rgb(109 108 117);
78
- --md-sys-color-shadow: rgb(0 0 0);
79
- --md-sys-color-scrim: rgb(0 0 0);
80
- --md-sys-color-inverse-surface: rgb(48 48 54);
81
- --md-sys-color-inverse-on-surface: rgb(243 239 247);
82
- --md-sys-color-inverse-primary: rgb(193 193 255);
83
- --md-sys-color-primary-fixed: rgb(103 104 162);
84
- --md-sys-color-on-primary-fixed: rgb(255 255 255);
85
- --md-sys-color-primary-fixed-dim: rgb(78 79 135);
86
- --md-sys-color-on-primary-fixed-variant: rgb(255 255 255);
87
- --md-sys-color-secondary-fixed: rgb(108 107 129);
88
- --md-sys-color-on-secondary-fixed: rgb(255 255 255);
89
- --md-sys-color-secondary-fixed-dim: rgb(83 83 104);
90
- --md-sys-color-on-secondary-fixed-variant: rgb(255 255 255);
91
- --md-sys-color-tertiary-fixed: rgb(137 97 120);
92
- --md-sys-color-on-tertiary-fixed: rgb(255 255 255);
93
- --md-sys-color-tertiary-fixed-dim: rgb(111 73 95);
94
- --md-sys-color-on-tertiary-fixed-variant: rgb(255 255 255);
95
- --md-sys-color-surface-dim: rgb(200 197 205);
96
- --md-sys-color-surface-bright: rgb(252 248 255);
97
- --md-sys-color-surface-container-lowest: rgb(255 255 255);
98
- --md-sys-color-surface-container-low: rgb(246 242 250);
99
- --md-sys-color-surface-container: rgb(234 231 239);
100
- --md-sys-color-surface-container-high: rgb(223 219 227);
101
- --md-sys-color-surface-container-highest: rgb(211 208 216);
102
- }
103
- .light-high-contrast {
104
- --md-sys-color-primary: rgb(37 38 92);
105
- --md-sys-color-surface-tint: rgb(88 89 146);
106
- --md-sys-color-on-primary: rgb(255 255 255);
107
- --md-sys-color-primary-container: rgb(67 67 123);
108
- --md-sys-color-on-primary-container: rgb(255 255 255);
109
- --md-sys-color-secondary: rgb(42 42 61);
110
- --md-sys-color-on-secondary: rgb(255 255 255);
111
- --md-sys-color-secondary-container: rgb(72 71 92);
112
- --md-sys-color-on-secondary-container: rgb(255 255 255);
113
- --md-sys-color-tertiary: rgb(66 34 54);
114
- --md-sys-color-on-tertiary: rgb(255 255 255);
115
- --md-sys-color-tertiary-container: rgb(98 62 83);
116
- --md-sys-color-on-tertiary-container: rgb(255 255 255);
117
- --md-sys-color-error: rgb(96 0 4);
118
- --md-sys-color-on-error: rgb(255 255 255);
119
- --md-sys-color-error-container: rgb(152 0 10);
120
- --md-sys-color-on-error-container: rgb(255 255 255);
121
- --md-sys-color-background: rgb(252 248 255);
122
- --md-sys-color-on-background: rgb(27 27 33);
123
- --md-sys-color-surface: rgb(252 248 255);
124
- --md-sys-color-on-surface: rgb(0 0 0);
125
- --md-sys-color-surface-variant: rgb(228 225 236);
126
- --md-sys-color-on-surface-variant: rgb(0 0 0);
127
- --md-sys-color-outline: rgb(44 43 52);
128
- --md-sys-color-outline-variant: rgb(73 72 81);
129
- --md-sys-color-shadow: rgb(0 0 0);
130
- --md-sys-color-scrim: rgb(0 0 0);
131
- --md-sys-color-inverse-surface: rgb(48 48 54);
132
- --md-sys-color-inverse-on-surface: rgb(255 255 255);
133
- --md-sys-color-inverse-primary: rgb(193 193 255);
134
- --md-sys-color-primary-fixed: rgb(67 67 123);
135
- --md-sys-color-on-primary-fixed: rgb(255 255 255);
136
- --md-sys-color-primary-fixed-dim: rgb(44 44 99);
137
- --md-sys-color-on-primary-fixed-variant: rgb(255 255 255);
138
- --md-sys-color-secondary-fixed: rgb(72 71 92);
139
- --md-sys-color-on-secondary-fixed: rgb(255 255 255);
140
- --md-sys-color-secondary-fixed-dim: rgb(49 49 68);
141
- --md-sys-color-on-secondary-fixed-variant: rgb(255 255 255);
142
- --md-sys-color-tertiary-fixed: rgb(98 62 83);
143
- --md-sys-color-on-tertiary-fixed: rgb(255 255 255);
144
- --md-sys-color-tertiary-fixed-dim: rgb(73 40 60);
145
- --md-sys-color-on-tertiary-fixed-variant: rgb(255 255 255);
146
- --md-sys-color-surface-dim: rgb(186 183 191);
147
- --md-sys-color-surface-bright: rgb(252 248 255);
148
- --md-sys-color-surface-container-lowest: rgb(255 255 255);
149
- --md-sys-color-surface-container-low: rgb(243 239 247);
150
- --md-sys-color-surface-container: rgb(228 225 233);
151
- --md-sys-color-surface-container-high: rgb(214 211 219);
152
- --md-sys-color-surface-container-highest: rgb(200 197 205);
153
- }
154
- .dark {
155
- --md-sys-color-primary: rgb(193 193 255);
156
- --md-sys-color-surface-tint: rgb(193 193 255);
157
- --md-sys-color-on-primary: rgb(41 42 96);
158
- --md-sys-color-primary-container: rgb(64 65 120);
159
- --md-sys-color-on-primary-container: rgb(225 223 255);
160
- --md-sys-color-secondary: rgb(198 196 221);
161
- --md-sys-color-on-secondary: rgb(47 47 66);
162
- --md-sys-color-secondary-container: rgb(69 69 89);
163
- --md-sys-color-on-secondary-container: rgb(226 224 249);
164
- --md-sys-color-tertiary: rgb(233 185 211);
165
- --md-sys-color-on-tertiary: rgb(70 38 58);
166
- --md-sys-color-tertiary-container: rgb(95 60 81);
167
- --md-sys-color-on-tertiary-container: rgb(255 216 236);
168
- --md-sys-color-error: rgb(255 180 171);
169
- --md-sys-color-on-error: rgb(105 0 5);
170
- --md-sys-color-error-container: rgb(147 0 10);
171
- --md-sys-color-on-error-container: rgb(255 218 214);
172
- --md-sys-color-background: rgb(19 19 24);
173
- --md-sys-color-on-background: rgb(228 225 233);
174
- --md-sys-color-surface: rgb(19 19 24);
175
- --md-sys-color-on-surface: rgb(228 225 233);
176
- --md-sys-color-surface-variant: rgb(71 70 79);
177
- --md-sys-color-on-surface-variant: rgb(200 197 208);
178
- --md-sys-color-outline: rgb(145 143 154);
179
- --md-sys-color-outline-variant: rgb(71 70 79);
180
- --md-sys-color-shadow: rgb(0 0 0);
181
- --md-sys-color-scrim: rgb(0 0 0);
182
- --md-sys-color-inverse-surface: rgb(228 225 233);
183
- --md-sys-color-inverse-on-surface: rgb(48 48 54);
184
- --md-sys-color-inverse-primary: rgb(88 89 146);
185
- --md-sys-color-primary-fixed: rgb(225 223 255);
186
- --md-sys-color-on-primary-fixed: rgb(20 19 74);
187
- --md-sys-color-primary-fixed-dim: rgb(193 193 255);
188
- --md-sys-color-on-primary-fixed-variant: rgb(64 65 120);
189
- --md-sys-color-secondary-fixed: rgb(226 224 249);
190
- --md-sys-color-on-secondary-fixed: rgb(26 26 44);
191
- --md-sys-color-secondary-fixed-dim: rgb(198 196 221);
192
- --md-sys-color-on-secondary-fixed-variant: rgb(69 69 89);
193
- --md-sys-color-tertiary-fixed: rgb(255 216 236);
194
- --md-sys-color-on-tertiary-fixed: rgb(47 17 36);
195
- --md-sys-color-tertiary-fixed-dim: rgb(233 185 211);
196
- --md-sys-color-on-tertiary-fixed-variant: rgb(95 60 81);
197
- --md-sys-color-surface-dim: rgb(19 19 24);
198
- --md-sys-color-surface-bright: rgb(57 56 63);
199
- --md-sys-color-surface-container-lowest: rgb(14 14 19);
200
- --md-sys-color-surface-container-low: rgb(27 27 33);
201
- --md-sys-color-surface-container: rgb(31 31 37);
202
- --md-sys-color-surface-container-high: rgb(42 41 47);
203
- --md-sys-color-surface-container-highest: rgb(53 52 58);
204
- }
205
- .dark-medium-contrast {
206
- --md-sys-color-primary: rgb(218 217 255);
207
- --md-sys-color-surface-tint: rgb(193 193 255);
208
- --md-sys-color-on-primary: rgb(30 31 85);
209
- --md-sys-color-primary-container: rgb(139 139 200);
210
- --md-sys-color-on-primary-container: rgb(0 0 0);
211
- --md-sys-color-secondary: rgb(220 218 243);
212
- --md-sys-color-on-secondary: rgb(36 36 54);
213
- --md-sys-color-secondary-container: rgb(144 142 165);
214
- --md-sys-color-on-secondary-container: rgb(0 0 0);
215
- --md-sys-color-tertiary: rgb(255 207 232);
216
- --md-sys-color-on-tertiary: rgb(58 27 47);
217
- --md-sys-color-tertiary-container: rgb(176 132 156);
218
- --md-sys-color-on-tertiary-container: rgb(0 0 0);
219
- --md-sys-color-error: rgb(255 210 204);
220
- --md-sys-color-on-error: rgb(84 0 3);
221
- --md-sys-color-error-container: rgb(255 84 73);
222
- --md-sys-color-on-error-container: rgb(0 0 0);
223
- --md-sys-color-background: rgb(19 19 24);
224
- --md-sys-color-on-background: rgb(228 225 233);
225
- --md-sys-color-surface: rgb(19 19 24);
226
- --md-sys-color-on-surface: rgb(255 255 255);
227
- --md-sys-color-surface-variant: rgb(71 70 79);
228
- --md-sys-color-on-surface-variant: rgb(222 219 230);
229
- --md-sys-color-outline: rgb(179 176 187);
230
- --md-sys-color-outline-variant: rgb(145 143 153);
231
- --md-sys-color-shadow: rgb(0 0 0);
232
- --md-sys-color-scrim: rgb(0 0 0);
233
- --md-sys-color-inverse-surface: rgb(228 225 233);
234
- --md-sys-color-inverse-on-surface: rgb(42 41 47);
235
- --md-sys-color-inverse-primary: rgb(65 66 122);
236
- --md-sys-color-primary-fixed: rgb(225 223 255);
237
- --md-sys-color-on-primary-fixed: rgb(8 6 65);
238
- --md-sys-color-primary-fixed-dim: rgb(193 193 255);
239
- --md-sys-color-on-primary-fixed-variant: rgb(47 48 102);
240
- --md-sys-color-secondary-fixed: rgb(226 224 249);
241
- --md-sys-color-on-secondary-fixed: rgb(15 15 33);
242
- --md-sys-color-secondary-fixed-dim: rgb(198 196 221);
243
- --md-sys-color-on-secondary-fixed-variant: rgb(52 52 72);
244
- --md-sys-color-tertiary-fixed: rgb(255 216 236);
245
- --md-sys-color-on-tertiary-fixed: rgb(34 7 26);
246
- --md-sys-color-tertiary-fixed-dim: rgb(233 185 211);
247
- --md-sys-color-on-tertiary-fixed-variant: rgb(77 43 64);
248
- --md-sys-color-surface-dim: rgb(19 19 24);
249
- --md-sys-color-surface-bright: rgb(69 68 74);
250
- --md-sys-color-surface-container-lowest: rgb(7 7 12);
251
- --md-sys-color-surface-container-low: rgb(29 29 35);
252
- --md-sys-color-surface-container: rgb(40 39 45);
253
- --md-sys-color-surface-container-high: rgb(51 50 56);
254
- --md-sys-color-surface-container-highest: rgb(62 61 67);
255
- }
256
- .dark-high-contrast {
257
- --md-sys-color-primary: rgb(241 238 255);
258
- --md-sys-color-surface-tint: rgb(193 193 255);
259
- --md-sys-color-on-primary: rgb(0 0 0);
260
- --md-sys-color-primary-container: rgb(189 189 253);
261
- --md-sys-color-on-primary-container: rgb(3 0 60);
262
- --md-sys-color-secondary: rgb(241 238 255);
263
- --md-sys-color-on-secondary: rgb(0 0 0);
264
- --md-sys-color-secondary-container: rgb(194 192 217);
265
- --md-sys-color-on-secondary-container: rgb(9 9 27);
266
- --md-sys-color-tertiary: rgb(255 235 243);
267
- --md-sys-color-on-tertiary: rgb(0 0 0);
268
- --md-sys-color-tertiary-container: rgb(229 181 207);
269
- --md-sys-color-on-tertiary-container: rgb(27 3 19);
270
- --md-sys-color-error: rgb(255 236 233);
271
- --md-sys-color-on-error: rgb(0 0 0);
272
- --md-sys-color-error-container: rgb(255 174 164);
273
- --md-sys-color-on-error-container: rgb(34 0 1);
274
- --md-sys-color-background: rgb(19 19 24);
275
- --md-sys-color-on-background: rgb(228 225 233);
276
- --md-sys-color-surface: rgb(19 19 24);
277
- --md-sys-color-on-surface: rgb(255 255 255);
278
- --md-sys-color-surface-variant: rgb(71 70 79);
279
- --md-sys-color-on-surface-variant: rgb(255 255 255);
280
- --md-sys-color-outline: rgb(242 238 250);
281
- --md-sys-color-outline-variant: rgb(196 193 204);
282
- --md-sys-color-shadow: rgb(0 0 0);
283
- --md-sys-color-scrim: rgb(0 0 0);
284
- --md-sys-color-inverse-surface: rgb(228 225 233);
285
- --md-sys-color-inverse-on-surface: rgb(0 0 0);
286
- --md-sys-color-inverse-primary: rgb(65 66 122);
287
- --md-sys-color-primary-fixed: rgb(225 223 255);
288
- --md-sys-color-on-primary-fixed: rgb(0 0 0);
289
- --md-sys-color-primary-fixed-dim: rgb(193 193 255);
290
- --md-sys-color-on-primary-fixed-variant: rgb(8 6 65);
291
- --md-sys-color-secondary-fixed: rgb(226 224 249);
292
- --md-sys-color-on-secondary-fixed: rgb(0 0 0);
293
- --md-sys-color-secondary-fixed-dim: rgb(198 196 221);
294
- --md-sys-color-on-secondary-fixed-variant: rgb(15 15 33);
295
- --md-sys-color-tertiary-fixed: rgb(255 216 236);
296
- --md-sys-color-on-tertiary-fixed: rgb(0 0 0);
297
- --md-sys-color-tertiary-fixed-dim: rgb(233 185 211);
298
- --md-sys-color-on-tertiary-fixed-variant: rgb(34 7 26);
299
- --md-sys-color-surface-dim: rgb(19 19 24);
300
- --md-sys-color-surface-bright: rgb(80 79 86);
301
- --md-sys-color-surface-container-lowest: rgb(0 0 0);
302
- --md-sys-color-surface-container-low: rgb(31 31 37);
303
- --md-sys-color-surface-container: rgb(48 48 54);
304
- --md-sys-color-surface-container-high: rgb(59 59 65);
305
- --md-sys-color-surface-container-highest: rgb(71 70 76);
306
- }
@@ -1,160 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <meta name="description" content="Demonstrating MICL Time Pickers">
7
- <title>MICL Time Pickers</title>
8
- <link rel="preconnect" href="https://fonts.googleapis.com">
9
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
- <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Google+Sans:ital,opsz,wght@0,17..18,400..700;1,17..18,400..700&display=swap">
11
- <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:FILL@0..1&icon_names=content_copy,dark_mode,home,keyboard,schedule&display=block">
12
- <link rel="stylesheet" href="themes/airblue/theme.css" id="theme-link">
13
- <link rel="stylesheet" href="micl.css">
14
- <link rel="stylesheet" href="docs.css">
15
- <style>
16
- .micl-card__content {
17
- display: flex;
18
- flex-direction: column;
19
- row-gap: 8px;
20
- }
21
- p {
22
- margin-block: 24px 0px;
23
- color: var(--md-sys-color-on-surface);
24
- }
25
- </style>
26
- </head>
27
- <body class="micl-window light">
28
- <main class="micl-body micl-body--stacked-to-large">
29
- <section class="micl-pane">
30
- <header class="micl-appbar">
31
- <a href="index.html" class="micl-appbar__leading-icon micl-link micl-iconbutton-standard-s" aria-label="Navigate to the main MICL Showcase page">
32
- <span class="material-symbols-outlined" aria-hidden="true">home</span>
33
- </a>
34
- <div class="micl-appbar__headline micl-appbar__headline--center">
35
- <h1>Time Pickers</h1>
36
- <p class="micl-appbar__subtitle">Showcasing MICL time pickers</p>
37
- </div>
38
- <div id="settings-placeholder" class="micl-appbar__trailing"></div>
39
- </header>
40
-
41
- <div class="micl-pane__columns">
42
- <div class="micl-pane__column" style="gap:24px">
43
- <div class="micl-card-outlined">
44
- <div class="micl-card__content">
45
- <p class="md-sys-typescale-body-medium">Default non-MICL time input field</p>
46
- <input type="time" name="t0" style="width:fit-content" value="08:40">
47
- <p class="md-sys-typescale-body-medium">MICL time textfield component without the MICL time picker component</p>
48
- <div class="micl-textfield-outlined" style="width:fit-content">
49
- <label for="mytextfield0">Start time</label>
50
- <input type="time" id="mytextfield0" value="08:40">
51
- </div>
52
- <p class="md-sys-typescale-body-medium">MICL time textfield component with the MICL time picker component</p>
53
- <div class="micl-textfield-outlined" style="width:fit-content">
54
- <label for="mytextfield1">Start time</label>
55
- <input type="time" id="mytextfield1" data-timepicker="mytimepicker1" value="23:19">
56
- </div>
57
- <dialog id="mytimepicker1" class="micl-dialog micl-timepicker" closedby="closerequest" aria-labelledby="mytitle1">
58
- <form method="dialog">
59
- <div class="micl-dialog__headline">
60
- <h2 id="mytitle1">Enter time</h2>
61
- </div>
62
- <div class="micl-dialog__content">
63
- <input type="number" name="hour" value="00" aria-labelledby="myhour1">
64
- <span class="micl-timepicker__separator">:</span>
65
- <input type="number" name="minute" value="00" aria-labelledby="myminute1">
66
- <div class="micl-timepicker__period"></div>
67
- <span id="myhour1" class="micl-timepicker__supporting-text-hour">Hour</span>
68
- <span id="myminute1" class="micl-timepicker__supporting-text-minute">Minute</span>
69
- <div class="micl-timepicker__dial"></div>
70
- </div>
71
- <div class="micl-dialog__actions">
72
- <button type="button" id="btn1" class="micl-timepicker__inputmode micl-iconbutton-standard-s micl-button--toggle micl-button--square material-symbols-outlined" commandfor="btn1" command="--micl-toggle" data-miclicon="keyboard" data-micliconselected="schedule"></button>
73
- <div>
74
- <button class="micl-button-text-s" value="">Cancel</button>
75
- <button class="micl-button-text-s" value="OK">OK</button>
76
- </div>
77
- </div>
78
- </form>
79
- </dialog>
80
- <p class="md-sys-typescale-body-medium">Time input using a MICL button component that opens the MICL time picker</p>
81
- <div class="micl-flex--vcenter" style="column-gap:8px">
82
- <label for="mytime" class="md-sys-typescale-body-large">Start time:</label>
83
- <button type="button" id="mytime" class="micl-button-text-m" command="show-modal" commandfor="mytimepicker2" value="07:53">07:53</button>
84
- </div>
85
- <dialog id="mytimepicker2" class="micl-dialog micl-timepicker micl-timepicker--horizontal" closedby="closerequest" aria-labelledby="mytitle2">
86
- <form method="dialog">
87
- <div class="micl-dialog__headline">
88
- <h2 id="mytitle2">Enter time</h2>
89
- </div>
90
- <div class="micl-dialog__content">
91
- <input type="number" name="hour" value="00" aria-labelledby="myhour2">
92
- <span class="micl-timepicker__separator">:</span>
93
- <input type="number" name="minute" value="00" aria-labelledby="myminute2">
94
- <div class="micl-timepicker__period"></div>
95
- <span id="myhour2" class="micl-timepicker__supporting-text-hour">Hour</span>
96
- <span id="myminute2" class="micl-timepicker__supporting-text-minute">Minute</span>
97
- <div class="micl-timepicker__dial micl-hidden"></div>
98
- </div>
99
- <div class="micl-dialog__actions">
100
- <button type="button" id="btn2" class="micl-timepicker__inputmode micl-iconbutton-standard-s micl-button--toggle micl-button--square material-symbols-outlined" commandfor="btn2" command="--micl-toggle" data-miclicon="keyboard" data-micliconselected="schedule"></button>
101
- <div>
102
- <button class="micl-button-text-s" value="">Cancel</button>
103
- <button class="micl-button-text-s" value="OK">OK</button>
104
- </div>
105
- </div>
106
- </form>
107
- </dialog>
108
- </div>
109
- </div>
110
- </div>
111
- </div>
112
- </section>
113
- <section class="micl-pane">
114
- <div class="micl-card-filled" style="margin-top:8px">
115
- <div class="micl-card__headline-s">
116
- <h2>Code example</h2>
117
- <button type="button" id="copycode" class="micl-iconbutton-standard-s material-symbols-outlined" aria-label="Copy code">content_copy</button>
118
- </div>
119
- <div class="micl-card__content docs-code">
120
- <pre tabindex="-1"><code>&lt;dialog class="micl-dialog micl-timepicker" closedby="closerequest" aria-labelledby="id0"&gt;
121
- &lt;form method="dialog"&gt;
122
- &lt;div class="micl-dialog__headline"&gt;
123
- &lt;h2 id="id0"&gt;Enter time&lt;/h2&gt;
124
- &lt;/div&gt;
125
- &lt;div class="micl-dialog__content"&gt;
126
- &lt;input type="number" name="hour" value="00" aria-labelledby="id1"&gt;
127
- &lt;span class="micl-timepicker__separator"&gt;:&lt;/span&gt;
128
- &lt;input type="number" name="minute" value="00" aria-labelledby="id2"&gt;
129
- &lt;div class="micl-timepicker__period"&gt;&lt;/div&gt;
130
- &lt;span id="id1" class="micl-timepicker__supporting-text-hour"&gt;Hour&lt;/span&gt;
131
- &lt;span id="id2" class="micl-timepicker__supporting-text-minute"&gt;Minute&lt;/span&gt;
132
- &lt;div class="micl-timepicker__dial"&gt;&lt;/div&gt;
133
- &lt;/div&gt;
134
- &lt;div class="micl-dialog__actions"&gt;
135
- &lt;button
136
- type="button"
137
- id="btn"
138
- class="micl-timepicker__inputmode micl-iconbutton-standard-s
139
- micl-button--toggle micl-button--square material-symbols-outlined"
140
- commandfor="btn"
141
- command="--micl-toggle"
142
- data-miclicon="keyboard"
143
- data-micliconselected="schedule"
144
- &gt;&lt;/button&gt;
145
- &lt;div&gt;
146
- &lt;button class="micl-button-text-s" value=""&gt;Cancel&lt;/button&gt;
147
- &lt;button class="micl-button-text-s" value="OK"&gt;OK&lt;/button&gt;
148
- &lt;/div&gt;
149
- &lt;/div&gt;
150
- &lt;/form&gt;
151
- &lt;/dialog&gt;</code></pre>
152
- </div>
153
- </div>
154
- </section>
155
- </main>
156
-
157
- <script src="micl.js"></script>
158
- <script src="docs.js"></script>
159
- </body>
160
- </html>
@@ -1,174 +0,0 @@
1
- //
2
- // Copyright © 2025 Hermana AS
3
- //
4
- // Permission is hereby granted, free of charge, to any person obtaining a copy
5
- // of this software and associated documentation files (the "Software"), to deal
6
- // in the Software without restriction, including without limitation the rights
7
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- // copies of the Software, and to permit persons to whom the Software is
9
- // furnished to do so, subject to the following conditions:
10
- //
11
- // The above copyright notice and this permission notice shall be included in all
12
- // copies or substantial portions of the Software.
13
- //
14
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- // SOFTWARE.
21
-
22
- export default (() =>
23
- {
24
- const isCVElement = (element: Element): element is
25
- HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | HTMLFieldSetElement =>
26
- 'willValidate' in element;
27
-
28
- const setErrorStateCheckbox = (element: HTMLInputElement): boolean =>
29
- {
30
- element.classList.toggle('micl-checkbox--error', !!element.validationMessage);
31
-
32
- return false;
33
- };
34
-
35
- const setErrorStateTextField = (textField: HTMLElement, message: string): boolean =>
36
- {
37
- textField.classList.toggle('micl-textfield--error', !!message);
38
-
39
- const supporting = textField.querySelector(
40
- '.micl-textfield__supporting-text'
41
- ) as HTMLElement;
42
-
43
- if (supporting) {
44
- if (!message) {
45
- if ('micltext' in supporting.dataset) {
46
- supporting.textContent = supporting.dataset.micltext || '';
47
- }
48
- }
49
- else {
50
- if (!supporting.dataset.micltext) {
51
- supporting.dataset.micltext = supporting.textContent;
52
- }
53
- supporting.textContent = message;
54
- }
55
- }
56
-
57
- return !!message && !!supporting;
58
- };
59
-
60
- const setErrorState = (element: HTMLElement): boolean =>
61
- {
62
- if (
63
- !element.parentElement
64
- || !isCVElement(element)
65
- ) {
66
- return false;
67
- }
68
- let reported = false;
69
-
70
- if (
71
- element instanceof HTMLInputElement
72
- && (element.type === 'checkbox')
73
- && element.classList.contains('micl-checkbox')
74
- ) {
75
- reported = setErrorStateCheckbox(element);
76
- }
77
- else if (
78
- element.parentElement.classList.contains('micl-textfield-outlined')
79
- || element.parentElement.classList.contains('micl-textfield-filled')
80
- ) {
81
- reported = setErrorStateTextField(element.parentElement, element.validationMessage);
82
- }
83
-
84
- return reported;
85
- };
86
-
87
- const clearCustomValidity = (event: Event): void =>
88
- {
89
- const element = event.target as Element;
90
- if (isCVElement(element)) {
91
- element.setCustomValidity('');
92
- }
93
- };
94
-
95
- const setCustomValidityFieldSet = (fieldset: HTMLFieldSetElement): void =>
96
- {
97
- const message = fieldset.dataset.miclvalidateMessage || '';
98
- if (!message) {
99
- return;
100
- }
101
-
102
- if (fieldset.matches('[data-miclvalidate-checkboxes-name]')) {
103
- const name = fieldset.dataset.miclvalidateCheckboxesName || '';
104
- const countEqual = fieldset.dataset.miclvalidateCheckboxesCountEqual || '';
105
- const countMax = fieldset.dataset.miclvalidateCheckboxesCountMax || '';
106
- const countMin = fieldset.dataset.miclvalidateCheckboxesCountMin || '';
107
-
108
- if (name && (countEqual || countMax || countMin)) {
109
- const checkedCount = fieldset.querySelectorAll<HTMLInputElement>(
110
- `input[type="checkbox"][name="${name}"]:checked`
111
- ).length;
112
- const expectedCountEqual = parseInt(countEqual, 10);
113
- const expectedCountMax = parseInt(countMax, 10);
114
- const expectedCountMin = parseInt(countMin, 10);
115
-
116
- let invalid = (!isNaN(expectedCountEqual) && (checkedCount != expectedCountEqual))
117
- || (!isNaN(expectedCountMax) && (checkedCount > expectedCountMax))
118
- || (!isNaN(expectedCountMin) && (checkedCount < expectedCountMin));
119
-
120
- fieldset.setCustomValidity(invalid ? message : '');
121
-
122
- const firstCheckbox = fieldset.querySelector<HTMLInputElement>(
123
- `input[type="checkbox"][name="${name}"]`
124
- );
125
- if (firstCheckbox) {
126
- firstCheckbox.setCustomValidity(invalid ? message : '');
127
- if (invalid) {
128
- firstCheckbox.addEventListener('change', clearCustomValidity);
129
- }
130
- else {
131
- firstCheckbox.removeEventListener('change', clearCustomValidity);
132
- }
133
- }
134
- }
135
- }
136
- };
137
-
138
- const validity = (container: HTMLFormElement | HTMLFieldSetElement, doReport?: boolean): boolean =>
139
- {
140
- let invalid = false;
141
-
142
- container.querySelectorAll<HTMLFieldSetElement>(
143
- 'fieldset'
144
- ).forEach(setCustomValidityFieldSet);
145
-
146
- Array.from(container.elements).forEach(element =>
147
- {
148
- if (isCVElement(element) && element.willValidate) {
149
- if (!element.checkValidity()) {
150
- invalid = true;
151
- }
152
- let reported = setErrorState(element);
153
- if (!reported && doReport) {
154
- element.reportValidity();
155
- }
156
- }
157
- });
158
-
159
- return !invalid;
160
- };
161
-
162
- return {
163
- validateFieldSet: (fieldset: HTMLFieldSetElement, doReport?: boolean): boolean =>
164
- {
165
- setCustomValidityFieldSet(fieldset);
166
- return validity(fieldset, doReport);
167
- },
168
-
169
- validateForm: (form: HTMLFormElement, doReport?: boolean): boolean =>
170
- {
171
- return validity(form, doReport);
172
- }
173
- };
174
- })();