material-inspired-component-library 8.1.0 → 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 (284) 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 +70 -10
  13. package/components/button/_shared.scss +210 -0
  14. package/components/button/index.scss +75 -389
  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 +63 -12
  29. package/components/iconbutton/index.scss +142 -303
  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 +62 -37
  37. package/components/navigationrail/_navitem.scss +96 -0
  38. package/components/navigationrail/index.scss +78 -132
  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/button/index.d.ts +1 -1
  80. package/dist/components/iconbutton/index.d.ts +2 -7
  81. package/dist/components/slider/index.d.ts +1 -1
  82. package/dist/components/textfield/index.d.ts +2 -2
  83. package/dist/datepicker.css +1 -1
  84. package/dist/datepicker.js +1 -1
  85. package/dist/dialog.css +1 -1
  86. package/dist/dialog.js +1 -1
  87. package/dist/divider.css +1 -1
  88. package/dist/divider.js +1 -1
  89. package/dist/field.css +1 -0
  90. package/dist/field.js +1 -0
  91. package/dist/foundations/form/index.js +1 -1
  92. package/dist/foundations/runtime.d.ts +15 -0
  93. package/dist/foundations/runtime.js +1 -0
  94. package/dist/iconbutton.css +1 -1
  95. package/dist/iconbutton.js +1 -1
  96. package/dist/layout.css +1 -1
  97. package/dist/layout.js +1 -1
  98. package/dist/list.css +1 -1
  99. package/dist/list.js +1 -1
  100. package/dist/menu.css +1 -1
  101. package/dist/menu.js +1 -1
  102. package/dist/micl.css +1 -1
  103. package/dist/micl.d.ts +14 -5
  104. package/dist/micl.js +1 -1
  105. package/dist/navigationbar.css +1 -0
  106. package/dist/navigationbar.js +1 -0
  107. package/dist/navigationrail.css +1 -1
  108. package/dist/navigationrail.js +1 -1
  109. package/dist/progressindicator.css +1 -1
  110. package/dist/progressindicator.js +1 -1
  111. package/dist/radio.css +1 -1
  112. package/dist/radio.js +1 -1
  113. package/dist/scrollbar.js +1 -1
  114. package/dist/select.css +1 -1
  115. package/dist/select.js +1 -1
  116. package/dist/shapes.css +1 -1
  117. package/dist/shapes.js +1 -1
  118. package/dist/sidesheet.css +1 -1
  119. package/dist/sidesheet.js +1 -1
  120. package/dist/slider.css +1 -1
  121. package/dist/slider.js +1 -1
  122. package/dist/snackbar.css +1 -1
  123. package/dist/snackbar.js +1 -1
  124. package/dist/stepper.css +1 -1
  125. package/dist/stepper.js +1 -1
  126. package/dist/switch.css +1 -1
  127. package/dist/switch.js +1 -1
  128. package/dist/textfield.css +1 -1
  129. package/dist/textfield.js +1 -1
  130. package/dist/timepicker.css +1 -1
  131. package/dist/timepicker.js +1 -1
  132. package/foundations/_index.scss +35 -0
  133. package/foundations/{index.scss → base/index.scss} +21 -56
  134. package/foundations/field/index.scss +37 -0
  135. package/foundations/layout/index.scss +64 -65
  136. package/package.json +23 -9
  137. package/styles/statelayer.scss +20 -5
  138. package/styles.scss +5 -2
  139. package/.claude/settings.local.json +0 -14
  140. package/.editorconfig +0 -12
  141. package/.gitattributes +0 -9
  142. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -35
  143. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  144. package/CLAUDE.md +0 -53
  145. package/CODE_OF_CONDUCT.md +0 -128
  146. package/components/bottomsheet/index.ts +0 -153
  147. package/components/button/index.ts +0 -79
  148. package/components/checkbox/index.ts +0 -148
  149. package/components/datepicker/index.ts +0 -693
  150. package/components/iconbutton/index.ts +0 -77
  151. package/components/list/index.ts +0 -138
  152. package/components/menu/index.ts +0 -145
  153. package/components/navigationrail/index.ts +0 -87
  154. package/components/progressindicator/index.ts +0 -77
  155. package/components/slider/index.ts +0 -149
  156. package/components/snackbar/index.ts +0 -118
  157. package/components/stepper/index.ts +0 -248
  158. package/components/textfield/index.ts +0 -188
  159. package/components/timepicker/index.ts +0 -413
  160. package/dist/components/progressindicator/index.d.ts +0 -6
  161. package/dist/foundations.css +0 -1
  162. package/dist/foundations.js +0 -1
  163. package/docs/accordion.html +0 -344
  164. package/docs/alert.html +0 -177
  165. package/docs/bottomsheet.html +0 -240
  166. package/docs/button.html +0 -290
  167. package/docs/card-awards.webp +0 -0
  168. package/docs/card-cabinet.webp +0 -0
  169. package/docs/card-city.webp +0 -0
  170. package/docs/card-fingerprint.webp +0 -0
  171. package/docs/card-holiday.webp +0 -0
  172. package/docs/card-names.webp +0 -0
  173. package/docs/card.html +0 -159
  174. package/docs/checkbox.html +0 -147
  175. package/docs/datepicker.html +0 -274
  176. package/docs/dialog.html +0 -195
  177. package/docs/divider.html +0 -139
  178. package/docs/docs.css +0 -26
  179. package/docs/docs.js +0 -139
  180. package/docs/iconbutton.html +0 -329
  181. package/docs/index.html +0 -431
  182. package/docs/list.html +0 -310
  183. package/docs/menu.html +0 -574
  184. package/docs/micl.css +0 -1
  185. package/docs/micl.js +0 -1
  186. package/docs/navigationrail.html +0 -138
  187. package/docs/progressindicator.html +0 -288
  188. package/docs/radio.html +0 -123
  189. package/docs/select.html +0 -337
  190. package/docs/shapes.css +0 -1
  191. package/docs/shapes.html +0 -159
  192. package/docs/shapes.js +0 -1
  193. package/docs/sidesheet.html +0 -149
  194. package/docs/slider.html +0 -141
  195. package/docs/snackbar.html +0 -102
  196. package/docs/stepper.html +0 -319
  197. package/docs/switch.html +0 -196
  198. package/docs/textfield.html +0 -208
  199. package/docs/themes/airblue/dark-hc.css +0 -51
  200. package/docs/themes/airblue/dark-mc.css +0 -51
  201. package/docs/themes/airblue/dark.css +0 -51
  202. package/docs/themes/airblue/light-hc.css +0 -51
  203. package/docs/themes/airblue/light-mc.css +0 -51
  204. package/docs/themes/airblue/light.css +0 -51
  205. package/docs/themes/airblue/theme.css +0 -306
  206. package/docs/themes/barnred/dark-hc.css +0 -51
  207. package/docs/themes/barnred/dark-mc.css +0 -51
  208. package/docs/themes/barnred/dark.css +0 -51
  209. package/docs/themes/barnred/light-hc.css +0 -51
  210. package/docs/themes/barnred/light-mc.css +0 -51
  211. package/docs/themes/barnred/light.css +0 -51
  212. package/docs/themes/barnred/theme.css +0 -306
  213. package/docs/themes/citrine/dark-hc.css +0 -51
  214. package/docs/themes/citrine/dark-mc.css +0 -51
  215. package/docs/themes/citrine/dark.css +0 -51
  216. package/docs/themes/citrine/light-hc.css +0 -51
  217. package/docs/themes/citrine/light-mc.css +0 -51
  218. package/docs/themes/citrine/light.css +0 -51
  219. package/docs/themes/citrine/theme.css +0 -306
  220. package/docs/themes/gray/dark-hc.css +0 -51
  221. package/docs/themes/gray/dark-mc.css +0 -51
  222. package/docs/themes/gray/dark.css +0 -51
  223. package/docs/themes/gray/light-hc.css +0 -51
  224. package/docs/themes/gray/light-mc.css +0 -51
  225. package/docs/themes/gray/light.css +0 -51
  226. package/docs/themes/gray/theme.css +0 -306
  227. package/docs/themes/greenery/dark-hc.css +0 -51
  228. package/docs/themes/greenery/dark-mc.css +0 -51
  229. package/docs/themes/greenery/dark.css +0 -51
  230. package/docs/themes/greenery/light-hc.css +0 -51
  231. package/docs/themes/greenery/light-mc.css +0 -51
  232. package/docs/themes/greenery/light.css +0 -51
  233. package/docs/themes/greenery/theme.css +0 -306
  234. package/docs/themes/hermana/dark-hc.css +0 -51
  235. package/docs/themes/hermana/dark-mc.css +0 -51
  236. package/docs/themes/hermana/dark.css +0 -51
  237. package/docs/themes/hermana/light-hc.css +0 -51
  238. package/docs/themes/hermana/light-mc.css +0 -51
  239. package/docs/themes/hermana/light.css +0 -51
  240. package/docs/themes/hermana/theme.css +0 -306
  241. package/docs/themes/illuminating/dark-hc.css +0 -51
  242. package/docs/themes/illuminating/dark-mc.css +0 -51
  243. package/docs/themes/illuminating/dark.css +0 -51
  244. package/docs/themes/illuminating/light-hc.css +0 -51
  245. package/docs/themes/illuminating/light-mc.css +0 -51
  246. package/docs/themes/illuminating/light.css +0 -51
  247. package/docs/themes/illuminating/theme.css +0 -306
  248. package/docs/themes/magenta/dark-hc.css +0 -51
  249. package/docs/themes/magenta/dark-mc.css +0 -51
  250. package/docs/themes/magenta/dark.css +0 -51
  251. package/docs/themes/magenta/light-hc.css +0 -51
  252. package/docs/themes/magenta/light-mc.css +0 -51
  253. package/docs/themes/magenta/light.css +0 -51
  254. package/docs/themes/magenta/theme.css +0 -306
  255. package/docs/themes/mocha/dark-hc.css +0 -51
  256. package/docs/themes/mocha/dark-mc.css +0 -51
  257. package/docs/themes/mocha/dark.css +0 -51
  258. package/docs/themes/mocha/light-hc.css +0 -51
  259. package/docs/themes/mocha/light-mc.css +0 -51
  260. package/docs/themes/mocha/light.css +0 -51
  261. package/docs/themes/mocha/theme.css +0 -306
  262. package/docs/themes/olivegreen/dark-hc.css +0 -51
  263. package/docs/themes/olivegreen/dark-mc.css +0 -51
  264. package/docs/themes/olivegreen/dark.css +0 -51
  265. package/docs/themes/olivegreen/light-hc.css +0 -51
  266. package/docs/themes/olivegreen/light-mc.css +0 -51
  267. package/docs/themes/olivegreen/light.css +0 -51
  268. package/docs/themes/olivegreen/theme.css +0 -306
  269. package/docs/themes/peri/dark-hc.css +0 -51
  270. package/docs/themes/peri/dark-mc.css +0 -51
  271. package/docs/themes/peri/dark.css +0 -51
  272. package/docs/themes/peri/light-hc.css +0 -51
  273. package/docs/themes/peri/light-mc.css +0 -51
  274. package/docs/themes/peri/light.css +0 -51
  275. package/docs/themes/peri/theme.css +0 -306
  276. package/docs/timepicker.html +0 -160
  277. package/foundations/form/index.ts +0 -174
  278. package/foundations/layout/README.md +0 -127
  279. package/intl.d.ts +0 -9
  280. package/micl.ts +0 -221
  281. package/styles/README.md +0 -196
  282. package/tools/shapes/generate.mjs +0 -828
  283. package/tsconfig.json +0 -116
  284. package/webpack.config.js +0 -104
@@ -1,413 +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 const timepickerSelector = 'dialog.micl-dialog.micl-timepicker';
23
-
24
- type ValueElement = HTMLInputElement | HTMLButtonElement;
25
-
26
- interface TimeLimits {
27
- max: number,
28
- min: number
29
- }
30
-
31
- export default (() =>
32
- {
33
- const uses12HourFormat = (() =>
34
- {
35
- try {
36
- const hourCycle = new Intl.DateTimeFormat(undefined, {
37
- hour: 'numeric'
38
- }).resolvedOptions().hourCycle;
39
-
40
- return hourCycle === 'h11' || hourCycle === 'h12';
41
- }
42
- catch (error) {
43
- return false;
44
- }
45
- })();
46
-
47
- const getElement = <T extends Element>(parent: Element, selector: string): T | null =>
48
- {
49
- return parent.querySelector(selector) as T | null;
50
- };
51
-
52
- const isValueElement = (element: Element | null): element is ValueElement =>
53
- {
54
- return element instanceof HTMLInputElement || element instanceof HTMLButtonElement;
55
- };
56
-
57
- const isVisible = (element: Element | null): boolean =>
58
- {
59
- return !!element && !element.classList.contains('micl-hidden');
60
- };
61
-
62
- const toggleSelection = (element: Element, force: boolean): void =>
63
- {
64
- element.classList.toggle('micl-timepicker--selected', force);
65
- };
66
-
67
- const getTimeLimits = (name: string): TimeLimits =>
68
- {
69
- if (name === 'hour') {
70
- return {
71
- min: uses12HourFormat ? 1 : 0,
72
- max: uses12HourFormat ? 12 : 23
73
- };
74
- }
75
- return { min: 0, max: 59 };
76
- };
77
-
78
- const formatValue = (element: HTMLInputElement): void =>
79
- {
80
- const { max, min } = getTimeLimits(element.name);
81
- let value = parseInt(element.value, 10);
82
-
83
- if (isNaN(value)) value = min;
84
- if (value > max) value = max;
85
- if (value < 0) value = min;
86
-
87
- element.value = String(value).padStart(2, '0');
88
- };
89
-
90
- const setInputAttributes = (input: HTMLInputElement): void =>
91
- {
92
- const { min, max } = getTimeLimits(input.name);
93
-
94
- let pattern: string;
95
- if (input.name === 'hour') {
96
- pattern = uses12HourFormat ? '(0[1-9]|1[0-2])' : '(0[0-9]|1[0-9]|2[0-3])';
97
- } else {
98
- pattern = '(0[0-9]|[1-5][0-9])';
99
- }
100
-
101
- const attributes: Record<string, string> = {
102
- maxlength: '2',
103
- pattern: pattern,
104
- inputmode: 'numeric',
105
- autocomplete: 'off',
106
- role: 'spinbutton',
107
- min: String(min),
108
- max: String(max)
109
- };
110
-
111
- for (const key in attributes) {
112
- input.setAttribute(key, attributes[key]);
113
- }
114
- };
115
-
116
- const setDial = (dial: HTMLElement, name: string, value: string): void =>
117
- {
118
- dial.querySelectorAll('data').forEach(
119
- e => e.classList.remove('micl-timepicker__time--selected')
120
- );
121
-
122
- const mark = dial.querySelector(`data[data-${name}][value="${value}"]`);
123
- let angle = '';
124
-
125
- if (mark) {
126
- angle = window.getComputedStyle(mark).getPropertyValue('--micl-angle');
127
- mark.classList.add('micl-timepicker__time--selected');
128
- }
129
- else if (name === 'minute') {
130
- angle = `${Math.round((parseInt(value, 10) * 360 / 60) - 90)}deg`;
131
- }
132
- !!angle && dial.style.setProperty('--micl-angle', angle);
133
- };
134
-
135
- const setInputValue = (
136
- dialog : HTMLElement,
137
- name : string,
138
- value? : string,
139
- setampm?: boolean,
140
- setdial : boolean = true
141
- ): void => {
142
-
143
- let numeric = parseInt(value || '0', 10);
144
- if (isNaN(numeric)) {
145
- return;
146
- }
147
- const input = getElement<HTMLInputElement>(dialog, `input[name=${name}]`);
148
- if (!input) {
149
- return;
150
- }
151
-
152
- if (name === 'hour' && setampm && uses12HourFormat) {
153
- const am = dialog.querySelector('.micl-timepicker__am') as HTMLInputElement;
154
- const pm = dialog.querySelector('.micl-timepicker__pm') as HTMLInputElement;
155
-
156
- if (numeric > 12) {
157
- if (pm) {
158
- pm.checked = true;
159
- }
160
- numeric -= 12;
161
- }
162
- else if (am) {
163
- am.checked = true;
164
- }
165
- }
166
- input.value = `${numeric}`.padStart(2, '0');
167
-
168
- if (setdial) {
169
- const dial = getElement<HTMLElement>(dialog, '.micl-timepicker__dial');
170
- if (!dial) {
171
- return;
172
- }
173
- setDial(dial, name, input.value);
174
- }
175
- }
176
-
177
- const addMarks = (dial: HTMLElement): void =>
178
- {
179
- let angle = uses12HourFormat ? 300 : 270;
180
-
181
- for (let i = (uses12HourFormat ? 1 : 0); i <= (uses12HourFormat ? 12 : 23); i++) {
182
- const mark = document.createElement('data') as HTMLDataElement;
183
-
184
- mark.value = `${i}`.padStart(2, '0');
185
- mark.textContent = `${i}`;
186
- mark.dataset.hour = `${i}`;
187
- mark.style.setProperty('--micl-angle', `${angle}deg`);
188
- if (!uses12HourFormat && i >= 12) {
189
- mark.classList.add('micl-timepicker__dial-inner');
190
- }
191
- else {
192
- mark.dataset.minute = `${(i * 5) % 60}`;
193
- }
194
- dial.appendChild(mark);
195
-
196
- angle = (angle + 30) % 360;
197
- }
198
-
199
- const track: HTMLSpanElement = document.createElement('span');
200
- track.classList.add('micl-timepicker__track');
201
- dial.appendChild(track);
202
- };
203
-
204
- const showDialMarks = (dial: HTMLElement, name: string): void =>
205
- {
206
- dial.querySelectorAll<HTMLDataElement>('data').forEach(mark =>
207
- {
208
- if (!!mark.dataset[name]) {
209
- mark.textContent = mark.dataset[name];
210
- mark.value = mark.dataset[name].padStart(2, '0');
211
- }
212
- if (mark.classList.contains('micl-timepicker__dial-inner')) {
213
- mark.classList[name === 'hour' ? 'remove' : 'add']('micl-hidden');
214
- }
215
- });
216
- };
217
-
218
- const handleSpinning = (dialog: HTMLElement, input: HTMLInputElement, event: KeyboardEvent): void =>
219
- {
220
- if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') {
221
- return;
222
- }
223
- event.preventDefault();
224
-
225
- const { max, min } = getTimeLimits(input.name);
226
- let value = parseInt(input.value, 10) || 0;
227
-
228
- value += event.key === 'ArrowUp' ? 1 : -1;
229
- if (value < min || value > max) {
230
- value = (value < min) ? max : min;
231
- if (input.name === 'hour' && uses12HourFormat) {
232
- const e = dialog.querySelector('input[name=period]:not(:checked)') as HTMLInputElement;
233
- e?.click();
234
- }
235
- }
236
-
237
- setInputValue(dialog, input.name, `${value}`);
238
- };
239
-
240
- return {
241
- initialize: (dialog: HTMLDialogElement): void =>
242
- {
243
- if (dialog.dataset.miclinitialized) {
244
- return;
245
- }
246
-
247
- const form = getElement<HTMLFormElement>(dialog, 'form');
248
- const mode = getElement<HTMLElement>(dialog, '.micl-timepicker__inputmode');
249
- const dial = getElement<HTMLElement>(dialog, '.micl-timepicker__dial');
250
- const inputs = [
251
- getElement<HTMLInputElement>(dialog, 'input[name=hour]'),
252
- getElement<HTMLInputElement>(dialog, 'input[name=minute]')
253
- ].filter((input): input is HTMLInputElement => input !== null);
254
-
255
- if (!form || inputs.length < 2) {
256
- return;
257
- }
258
- dialog.dataset.miclinitialized = '1';
259
-
260
- inputs.forEach((input, i) =>
261
- {
262
- setInputAttributes(input);
263
- if (dial) {
264
- input.toggleAttribute('readonly', isVisible(dial));
265
- }
266
-
267
- input.addEventListener('keydown', handleSpinning.bind(null, dialog, input));
268
- input.addEventListener('focus', () =>
269
- {
270
- toggleSelection(inputs[i === 0 ? 1 : 0], false);
271
- toggleSelection(input, true);
272
- if (dial) {
273
- showDialMarks(dial, input.name);
274
- setDial(dial, input.name, input.value);
275
- }
276
- });
277
- input.addEventListener('blur', () =>
278
- {
279
- if (!isVisible(dial)) {
280
- formatValue(input);
281
- toggleSelection(input, false);
282
- }
283
- });
284
- });
285
-
286
- const period = dialog.querySelector('.micl-timepicker__period');
287
- if (period && uses12HourFormat) {
288
- ['am', 'pm'].forEach(ampm => {
289
- let e = document.createElement('input') as HTMLInputElement;
290
- e.type = 'radio';
291
- e.name = 'period';
292
- e.classList.add(`micl-timepicker__${ampm}`);
293
- e.value = ampm;
294
- e.ariaLabel = ampm.toUpperCase();
295
- period.appendChild(e);
296
- });
297
- period.classList.toggle('micl-hidden', !uses12HourFormat);
298
- }
299
-
300
- mode?.addEventListener('click', () =>
301
- {
302
- dial?.classList.toggle('micl-hidden');
303
- inputs.forEach(input =>
304
- {
305
- input.toggleAttribute('readonly', isVisible(dial));
306
- });
307
- if (isVisible(dial)) {
308
- inputs[0].focus();
309
- }
310
- });
311
-
312
- if (dial) {
313
- addMarks(dial);
314
-
315
- const handleSelection = (clientX: number, clientY: number) =>
316
- {
317
- const target = document.elementFromPoint(clientX, clientY);
318
- if (target && target.tagName === 'DATA') {
319
- setInputValue(dialog, !dialog.querySelector(
320
- 'input[name=hour].micl-timepicker--selected'
321
- ) ? 'minute' : 'hour', (target as HTMLDataElement).value);
322
- }
323
- };
324
- dial.addEventListener('pointerdown', (event: PointerEvent) =>
325
- {
326
- dial.classList.add('micl-timepicker__dial--dragging');
327
- handleSelection(event.clientX, event.clientY);
328
- dial.setPointerCapture(event.pointerId);
329
- });
330
- dial.addEventListener('pointermove', (event: PointerEvent) =>
331
- {
332
- if (dial.classList.contains('micl-timepicker__dial--dragging')) {
333
- handleSelection(event.clientX, event.clientY);
334
- }
335
- });
336
- const stopDragging = (event: PointerEvent) =>
337
- {
338
- dial.classList.remove('micl-timepicker__dial--dragging');
339
- dial.releasePointerCapture(event.pointerId);
340
- };
341
- dial.addEventListener('pointerup', stopDragging);
342
- dial.addEventListener('pointercancel', stopDragging);
343
- }
344
-
345
- dialog.addEventListener('beforetoggle', (event): void =>
346
- {
347
- if (event.oldState === 'open') {
348
- return;
349
- }
350
-
351
- let invoker = document.activeElement;
352
- if (
353
- !isValueElement(invoker)
354
- || (!invoker.dataset.timepicker && !invoker.popoverTargetElement && !(invoker as any).commandForElement)
355
- ) {
356
- invoker = document.querySelector(
357
- `[data-timepicker="${dialog.id}"],[popovertarget="${dialog.id}"],[commandfor="${dialog.id}"]`
358
- );
359
- }
360
- if (!isValueElement(invoker)) {
361
- return;
362
- }
363
- (dialog as any)._miclInvoker = invoker;
364
-
365
- const time = (invoker.value || invoker.textContent).split(':');
366
- if (time.length === 2) {
367
- setInputValue(dialog, 'hour', time[0], true);
368
- setInputValue(dialog, 'minute', time[1], false, false);
369
- }
370
- });
371
-
372
- dialog.addEventListener('close', (): void =>
373
- {
374
- if (!dialog.returnValue) {
375
- return;
376
- }
377
-
378
- let invoker = (dialog as any)._miclInvoker;
379
- if (!invoker) {
380
- invoker = document.querySelector(
381
- `[data-timepicker="${dialog.id}"],[popovertarget="${dialog.id}"],[commandfor="${dialog.id}"]`
382
- );
383
- }
384
- if (!isValueElement(invoker)) {
385
- return;
386
- }
387
-
388
- const inputs = form.elements;
389
- let h = parseInt((inputs.namedItem('hour') as HTMLInputElement)?.value || '0', 10);
390
- if (isNaN(h)) {
391
- return;
392
- }
393
- if (uses12HourFormat && (inputs.namedItem('period') as RadioNodeList)?.value === 'pm') {
394
- h += 12;
395
- }
396
- const m = parseInt((inputs.namedItem('minute') as HTMLInputElement)?.value || '0', 10);
397
- if (isNaN(m)) {
398
- return;
399
- }
400
- const time = `${h}`.padStart(2, '0') + ':' + `${m}`.padStart(2, '0');
401
- invoker.value = time;
402
-
403
- if (invoker instanceof HTMLInputElement) {
404
- invoker.dispatchEvent(new Event('change', { bubbles: true }));
405
- invoker.dispatchEvent(new Event('input', { bubbles: true }));
406
- }
407
- else {
408
- invoker.textContent = time;
409
- }
410
- });
411
- }
412
- };
413
- })();
@@ -1,6 +0,0 @@
1
- export declare const progressindicatorSelector = "progress.micl-progress-linear,progress.micl-progress-circular";
2
- declare const _default: {
3
- initialize: (element: HTMLProgressElement) => void;
4
- cleanup: (element: HTMLProgressElement) => void;
5
- };
6
- export default _default;
@@ -1 +0,0 @@
1
- :root{--md-sys-icon-size: 24px;--md-sys-padding-xxs: 4px;--md-sys-padding-xs: 8px;--md-sys-padding-s: 12px;--md-sys-padding-m: 16px;--md-sys-padding-l: 20px;--md-sys-padding-xl: 24px;--md-sys-padding-xxl: 28px}.micl-hidden{display:none !important}.micl-no-transition{transition:none !important}.micl-flex--vcenter{display:flex;flex-direction:row;align-items:center}.micl-grid-field,.micl-grid-iconfield{box-sizing:border-box;display:grid;row-gap:var(--md-sys-padding-xl, 24px)}.micl-grid-iconfield{grid-template-columns:48px 1fr}.micl-grid-iconfield__icon{grid-column:1;margin-block-start:.6rem}.micl-grid-iconfield__field{grid-column:2}.micl-link{display:flex;align-items:center;justify-content:center;text-decoration:none}@property --micl-ripple{syntax:"<integer>";inherits:false;initial-value:0}@property --micl-x{syntax:"<length>";inherits:false;initial-value:-100000px}@property --micl-y{syntax:"<length>";inherits:false;initial-value:-100000px}@property --micl-width{syntax:"<length>";inherits:true;initial-value:0px}@property --micl-height{syntax:"<length>";inherits:true;initial-value:0px}
@@ -1 +0,0 @@
1
- !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.micl=o():e.micl=o()}(self,()=>(()=>{"use strict";var e={};return(e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(e),e})());