material-inspired-component-library 4.0.2 → 5.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 (99) hide show
  1. package/README.md +14 -0
  2. package/components/alert/index.scss +4 -4
  3. package/components/appbar/index.scss +3 -2
  4. package/components/badge/index.scss +2 -2
  5. package/components/bottomsheet/index.scss +6 -5
  6. package/components/button/index.scss +21 -20
  7. package/components/card/index.scss +10 -9
  8. package/components/checkbox/index.scss +11 -11
  9. package/components/datepicker/index.scss +435 -0
  10. package/components/datepicker/index.ts +600 -0
  11. package/components/dialog/README.md +14 -12
  12. package/components/dialog/index.scss +79 -62
  13. package/components/divider/index.scss +2 -0
  14. package/components/iconbutton/index.scss +18 -17
  15. package/components/list/index.scss +10 -10
  16. package/components/menu/index.scss +2 -1
  17. package/components/navigationrail/index.scss +10 -9
  18. package/components/radio/README.md +0 -1
  19. package/components/radio/index.scss +11 -11
  20. package/components/select/index.scss +2 -1
  21. package/components/sidesheet/index.scss +3 -1
  22. package/components/slider/index.scss +7 -7
  23. package/components/stepper/index.scss +5 -4
  24. package/components/switch/README.md +0 -1
  25. package/components/switch/index.scss +21 -21
  26. package/components/textfield/index.scss +6 -5
  27. package/components/textfield/index.ts +7 -6
  28. package/components/timepicker/README.md +135 -0
  29. package/components/timepicker/index.scss +245 -122
  30. package/components/timepicker/index.ts +348 -45
  31. package/dist/alert.css +1 -1
  32. package/dist/appbar.css +1 -1
  33. package/dist/badge.css +1 -1
  34. package/dist/bottomsheet.css +1 -1
  35. package/dist/button.css +1 -1
  36. package/dist/card.css +1 -1
  37. package/dist/checkbox.css +1 -1
  38. package/dist/components/datepicker/index.d.ts +6 -0
  39. package/dist/datepicker.css +1 -0
  40. package/dist/datepicker.js +1 -0
  41. package/dist/dialog.css +1 -1
  42. package/dist/divider.css +1 -1
  43. package/dist/foundations.css +1 -0
  44. package/dist/foundations.js +1 -0
  45. package/dist/iconbutton.css +1 -1
  46. package/dist/layout.css +1 -1
  47. package/dist/list.css +1 -1
  48. package/dist/menu.css +1 -1
  49. package/dist/micl.css +1 -1
  50. package/dist/micl.js +1 -1
  51. package/dist/navigationrail.css +1 -1
  52. package/dist/radio.css +1 -1
  53. package/dist/scrollbar.css +1 -0
  54. package/dist/scrollbar.js +1 -0
  55. package/dist/select.css +1 -1
  56. package/dist/sidesheet.css +1 -1
  57. package/dist/slider.css +1 -1
  58. package/dist/stepper.css +1 -1
  59. package/dist/switch.css +1 -1
  60. package/dist/textfield.css +1 -1
  61. package/dist/timepicker.css +1 -1
  62. package/docs/accordion.html +3 -1
  63. package/docs/alert.html +3 -1
  64. package/docs/bottomsheet.html +4 -2
  65. package/docs/button.html +3 -1
  66. package/docs/card.html +3 -1
  67. package/docs/checkbox.html +3 -1
  68. package/docs/datepicker.html +151 -0
  69. package/docs/dialog.html +33 -19
  70. package/docs/divider.html +3 -1
  71. package/docs/docs.js +43 -0
  72. package/docs/iconbutton.html +1 -1
  73. package/docs/index.html +34 -8
  74. package/docs/list.html +3 -1
  75. package/docs/menu.html +3 -1
  76. package/docs/micl.css +1 -1
  77. package/docs/micl.js +1 -1
  78. package/docs/navigationrail.html +3 -1
  79. package/docs/radio.html +3 -1
  80. package/docs/select.html +3 -1
  81. package/docs/sidesheet.html +3 -1
  82. package/docs/slider.html +1 -1
  83. package/docs/stepper.html +3 -1
  84. package/docs/switch.html +3 -1
  85. package/docs/textfield.html +3 -1
  86. package/docs/timepicker.html +66 -27
  87. package/foundations/index.scss +102 -0
  88. package/foundations/layout/index.scss +0 -52
  89. package/foundations/scrollbar/index.scss +46 -0
  90. package/intl.d.ts +9 -0
  91. package/micl.ts +18 -8
  92. package/package.json +17 -15
  93. package/styles/README.md +17 -8
  94. package/styles/motion.scss +3 -0
  95. package/styles/shapes.scss +23 -18
  96. package/styles/statelayer.scss +4 -0
  97. package/styles/typography.scss +2 -2
  98. package/styles.scss +3 -26
  99. package/tsconfig.json +2 -2
@@ -19,7 +19,7 @@
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/layout';
22
+ @use '../../foundations';
23
23
  @use '../../styles/motion';
24
24
  @use '../../styles/shapes';
25
25
  @use '../../styles/statelayer';
@@ -41,7 +41,7 @@
41
41
  @mixin slider-track-disabled() {
42
42
  background-image: linear-gradient(
43
43
  var(--md-sys-slider-track-direction),
44
- color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent) calc(100% * (var(--md-sys-slider-value) - var(--md-sys-slider-min)) / (var(--md-sys-slider-max) - var(--md-sys-slider-min))),
44
+ color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-disabled-state-layer-opacity, 38%), transparent) calc(100% * (var(--md-sys-slider-value) - var(--md-sys-slider-min)) / (var(--md-sys-slider-max) - var(--md-sys-slider-min))),
45
45
  transparent calc(100% * (var(--md-sys-slider-value) - var(--md-sys-slider-min)) / (var(--md-sys-slider-max) - var(--md-sys-slider-min))),
46
46
  color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent) calc(100% * (var(--md-sys-slider-value) - var(--md-sys-slider-min)) / (var(--md-sys-slider-max) - var(--md-sys-slider-min))),
47
47
  color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent) 100%,
@@ -79,8 +79,8 @@
79
79
  var(--md-sys-slider-track-direction),
80
80
  transparent 0px,
81
81
  transparent var(--md-sys-slider-thumb-space),
82
- color-mix(in srgb, var(--md-sys-color-on-surface) 38%, var(--md-sys-color-surface)) var(--md-sys-slider-thumb-space),
83
- color-mix(in srgb, var(--md-sys-color-on-surface) 38%, var(--md-sys-color-surface)) 10px,
82
+ color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-disabled-state-layer-opacity, 38%), var(--md-sys-color-surface)) var(--md-sys-slider-thumb-space),
83
+ color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-disabled-state-layer-opacity, 38%), var(--md-sys-color-surface)) 10px,
84
84
  transparent 10px,
85
85
  transparent 16px
86
86
  );
@@ -223,10 +223,10 @@ input[type=range].micl-slider-xl {
223
223
  }
224
224
  &:focus-visible {
225
225
  &::-webkit-slider-thumb {
226
- outline: var(--md-sys-state-focus-indicator-thickness) solid var(--md-sys-color-secondary);
226
+ outline: var(--md-sys-state-focus-indicator-thickness, 3px) solid var(--md-sys-color-secondary);
227
227
  }
228
228
  &::-moz-range-thumb {
229
- outline: var(--md-sys-state-focus-indicator-thickness) solid var(--md-sys-color-secondary);
229
+ outline: var(--md-sys-state-focus-indicator-thickness, 3px) solid var(--md-sys-color-secondary);
230
230
  }
231
231
  }
232
232
  &:active {
@@ -273,7 +273,7 @@ input[type=range].micl-slider-xl {
273
273
  grid-area: slider-icon;
274
274
  inset: 0;
275
275
  margin: 6px;
276
- font-size: var(--md-sys-layout-icon-size, 24px);
276
+ font-size: var(--md-sys-icon-size, 24px);
277
277
  color: var(--md-sys-color-on-primary);
278
278
  z-index: 1;
279
279
  }
@@ -19,8 +19,9 @@
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/layout';
22
+ @use '../../foundations';
23
23
  @use '../../styles/motion';
24
+ @use '../../styles/statelayer';
24
25
 
25
26
  :root {
26
27
  --md-sys-stepper-counter-style: decimal;
@@ -38,7 +39,7 @@ body {
38
39
  box-sizing: border-box;
39
40
  display: flex;
40
41
  flex-direction: column;
41
- row-gap: var(--md-sys-layout-padding-xl, 24px);
42
+ row-gap: var(--md-sys-padding-xl, 24px);
42
43
  margin: 0;
43
44
  background-color: inherit;
44
45
 
@@ -119,7 +120,7 @@ body {
119
120
  &>:last-child {
120
121
  display: flex;
121
122
  flex: 1 1 0;
122
- column-gap: var(--md-sys-layout-padding-xs, 8px)
123
+ column-gap: var(--md-sys-padding-xs, 8px)
123
124
  }
124
125
  &>:last-child {
125
126
  justify-content: flex-end;
@@ -139,7 +140,7 @@ body {
139
140
  text-align: center;
140
141
  background-color: var(--md-sys-color-on-surface);
141
142
  color: var(--md-sys-color-surface);
142
- opacity: 38%;
143
+ opacity: var(--md-sys-state-disabled-state-layer-opacity, 38%);
143
144
  counter-increment: dotnumber 1;
144
145
  }
145
146
  .micl-stepper__progress--done.micl-stepper__progress-dot,
@@ -59,7 +59,6 @@ You can customize the appearance of the Switch component by overriding its globa
59
59
  | --md-sys-switch-handle-selected-size | 24px | The diameter of the handle when the switch is "on" |
60
60
  | --md-sys-switch-handle-pressed-size | 28px | The diameter of the handle when the switch is pressed |
61
61
  | --md-sys-switch-outline-width | 2px | The width of the border |
62
- | --md-sys-switch-state-layer-size | 40px | Sets the size of the area that indicates the component's current state (e.g., hover, focus, press) |
63
62
  | --md-sys-switch-target-height | 32px | The height of the track |
64
63
  | --md-sys-switch-target-width | 52px | The width of the track |
65
64
 
@@ -19,6 +19,7 @@
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';
22
23
  @use '../../styles/motion';
23
24
  @use '../../styles/shapes';
24
25
  @use '../../styles/statelayer';
@@ -29,7 +30,6 @@
29
30
  --md-sys-switch-handle-selected-size: 24px;
30
31
  --md-sys-switch-handle-pressed-size: 28px;
31
32
  --md-sys-switch-outline-width: 2px;
32
- --md-sys-switch-state-layer-size: 40px;
33
33
  --md-sys-switch-target-height: 32px;
34
34
  --md-sys-switch-target-width: 52px;
35
35
  }
@@ -56,7 +56,7 @@ input[type=checkbox].micl-switch {
56
56
  display: block;
57
57
  inline-size: var(--md-sys-switch-target-width);
58
58
  block-size: var(--md-sys-switch-target-height);
59
- margin-block: calc((var(--md-sys-target-size) - var(--md-sys-switch-target-height)) / 2);
59
+ margin-block: calc((var(--md-sys-target-size, 48px) - var(--md-sys-switch-target-height)) / 2);
60
60
  border: var(--md-sys-switch-outline-width) solid var(--md-sys-color-outline);
61
61
  border-radius: inherit;
62
62
  background-color: var(--md-sys-color-surface-container-highest);
@@ -66,17 +66,17 @@ input[type=checkbox].micl-switch {
66
66
  content: var(--md-sys-switch-unselected-icon);
67
67
  box-sizing: border-box;
68
68
  position: absolute;
69
- inline-size: var(--md-sys-switch-state-layer-size);
70
- block-size: var(--md-sys-switch-state-layer-size);
69
+ inline-size: var(--md-sys-state-layer-size, 40px);
70
+ block-size: var(--md-sys-state-layer-size, 40px);
71
71
  inset: 0;
72
- inset-inline-start: calc((var(--md-sys-target-size) - var(--md-sys-switch-state-layer-size) - 16px) / 2);
72
+ inset-inline-start: calc((var(--md-sys-target-size, 48px) - var(--md-sys-state-layer-size, 40px) - 16px) / 2);
73
73
  margin: auto 0;
74
74
  font: 300 16px / 1rem var(--md-ref-typeface-plain);
75
75
  color: var(--md-sys-color-surface-container-highest);
76
76
  text-align: center;
77
77
  background-color: var(--md-sys-color-outline);
78
78
  background-clip: content-box;
79
- border: calc((var(--md-sys-switch-state-layer-size) - var(--md-sys-switch-handle-size)) / 2) solid transparent;
79
+ border: calc((var(--md-sys-state-layer-size, 40px) - var(--md-sys-switch-handle-size)) / 2) solid transparent;
80
80
  border-radius: var(--md-sys-shape-corner-full);
81
81
  transform: rotate(135deg);
82
82
  transition:
@@ -93,11 +93,11 @@ input[type=checkbox].micl-switch {
93
93
  }
94
94
  &::after {
95
95
  content: var(--md-sys-switch-selected-icon);
96
- inset-inline-start: calc(var(--md-sys-switch-target-width) - ((var(--md-sys-switch-state-layer-size) + var(--md-sys-target-size) - 16px) / 2));
96
+ inset-inline-start: calc(var(--md-sys-switch-target-width) - ((var(--md-sys-state-layer-size, 40px) + var(--md-sys-target-size, 48px) - 16px) / 2));
97
97
  font-size: 1.6rem;
98
98
  line-height: 1.3rem;
99
99
  letter-spacing: 0.1rem;
100
- border: calc((var(--md-sys-switch-state-layer-size) - var(--md-sys-switch-handle-selected-size)) / 2) solid transparent;
100
+ border: calc((var(--md-sys-state-layer-size, 40px) - var(--md-sys-switch-handle-selected-size)) / 2) solid transparent;
101
101
  color: var(--md-sys-color-on-primary-container);
102
102
  background-color: var(--md-sys-color-on-primary);
103
103
  }
@@ -107,24 +107,24 @@ input[type=checkbox].micl-switch {
107
107
 
108
108
  &:hover {
109
109
  &::after {
110
- border-color: color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-hover-state-layer-opacity), transparent);
110
+ border-color: color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-hover-state-layer-opacity, 8%), transparent);
111
111
  background-color: var(--md-sys-color-on-surface-variant);
112
112
  }
113
113
  &:checked::after {
114
- border-color: color-mix(in srgb, var(--md-sys-color-primary) var(--md-sys-state-hover-state-layer-opacity), transparent);
114
+ border-color: color-mix(in srgb, var(--md-sys-color-primary) var(--md-sys-state-hover-state-layer-opacity, 8%), transparent);
115
115
  background-color: var(--md-sys-color-primary-container);
116
116
  }
117
117
  }
118
118
  &:focus-visible {
119
119
  &::after {
120
- border-color: color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-focus-state-layer-opacity), transparent);
120
+ border-color: color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-focus-state-layer-opacity, 10%), transparent);
121
121
  }
122
122
  &::before {
123
- outline: var(--md-sys-state-focus-indicator-thickness) solid var(--md-sys-color-secondary);
123
+ outline: var(--md-sys-state-focus-indicator-thickness, 3px) solid var(--md-sys-color-secondary);
124
124
  outline-offset: 2px;
125
125
  }
126
126
  &:checked::after {
127
- border-color: color-mix(in srgb, var(--md-sys-color-primary) var(--md-sys-state-focus-state-layer-opacity), transparent);
127
+ border-color: color-mix(in srgb, var(--md-sys-color-primary) var(--md-sys-state-focus-state-layer-opacity, 10%), transparent);
128
128
  background-color: var(--md-sys-color-primary-container);
129
129
  }
130
130
  &:not(:checked)::after {
@@ -134,18 +134,18 @@ input[type=checkbox].micl-switch {
134
134
  &:active {
135
135
  &::after {
136
136
  line-height: 1.7rem;
137
- border: calc((var(--md-sys-switch-state-layer-size) - var(--md-sys-switch-handle-pressed-size)) / 2) solid transparent;
137
+ border: calc((var(--md-sys-state-layer-size, 40px) - var(--md-sys-switch-handle-pressed-size)) / 2) solid transparent;
138
138
  background-color: var(--md-sys-color-on-surface-variant);
139
139
  }
140
140
  &:checked::after {
141
141
  line-height: 1.6rem;
142
- border-width: calc((var(--md-sys-switch-state-layer-size) - var(--md-sys-switch-handle-pressed-size)) / 2);
143
- border-color: color-mix(in srgb, var(--md-sys-color-primary) var(--md-sys-state-pressed-state-layer-opacity), transparent);
142
+ border-width: calc((var(--md-sys-state-layer-size, 40px) - var(--md-sys-switch-handle-pressed-size)) / 2);
143
+ border-color: color-mix(in srgb, var(--md-sys-color-primary) var(--md-sys-state-pressed-state-layer-opacity, 10%), transparent);
144
144
  background-color: var(--md-sys-color-primary-container);
145
145
  }
146
146
  &:not(:checked)::after {
147
- inset-inline-start: calc((var(--md-sys-target-size) - var(--md-sys-switch-state-layer-size) - 16px) / 2);
148
- border-color: color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-pressed-state-layer-opacity), transparent);
147
+ inset-inline-start: calc((var(--md-sys-target-size, 48px) - var(--md-sys-state-layer-size, 40px) - 16px) / 2);
148
+ border-color: color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-pressed-state-layer-opacity, 10%), transparent);
149
149
  }
150
150
  }
151
151
  }
@@ -159,12 +159,12 @@ input[type=checkbox].micl-switch {
159
159
  background-color: var(--md-sys-color-on-surface);
160
160
  }
161
161
  &::after {
162
- color: rgb(from var(--md-sys-color-surface-container-highest) r g b / 38%);
162
+ color: rgb(from var(--md-sys-color-surface-container-highest) r g b / var(--md-sys-state-disabled-state-layer-opacity, 38%));
163
163
  background-color: var(--md-sys-color-on-surface);
164
- opacity: 38%;
164
+ opacity: var(--md-sys-state-disabled-state-layer-opacity, 38%);
165
165
  }
166
166
  &:checked::after {
167
- color: rgb(from var(--md-sys-color-on-surface) r g b / 38%);
167
+ color: rgb(from var(--md-sys-color-on-surface) r g b / var(--md-sys-state-disabled-state-layer-opacity, 38%));
168
168
  background-color: var(--md-sys-color-surface);
169
169
  opacity: 100%;
170
170
  }
@@ -19,6 +19,7 @@
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';
22
23
  @use '../../styles/motion';
23
24
  @use '../../styles/shapes';
24
25
  @use '../../styles/statelayer';
@@ -80,8 +81,8 @@
80
81
  caret-color: var(--md-sys-color-primary);
81
82
 
82
83
  &:disabled {
83
- border-block-end-color: rgb(from var(--md-sys-color-on-surface) r g b / 38%);
84
- color: rgb(from var(--md-sys-color-on-surface) r g b / 38%);
84
+ border-block-end-color: rgb(from var(--md-sys-color-on-surface) r g b / var(--md-sys-state-disabled-state-layer-opacity, 38%));
85
+ color: rgb(from var(--md-sys-color-on-surface) r g b / var(--md-sys-state-disabled-state-layer-opacity, 38%));
85
86
  }
86
87
  &::placeholder {
87
88
  color: var(--md-sys-color-on-surface-variant);
@@ -220,12 +221,12 @@
220
221
  &:has(> select:disabled),
221
222
  &:has(> textarea:disabled) {
222
223
  &> label {
223
- color: rgb(from var(--md-sys-color-on-surface) r g b / 38%);
224
+ color: rgb(from var(--md-sys-color-on-surface) r g b / var(--md-sys-state-disabled-state-layer-opacity, 38%));
224
225
  }
225
226
  &> .micl-textfield__icon-leading,
226
227
  &> .micl-textfield__icon-trailing,
227
228
  &> .micl-textfield__supporting-text {
228
- color: rgb(from var(--md-sys-color-on-surface) r g b / 38%);
229
+ color: rgb(from var(--md-sys-color-on-surface) r g b / var(--md-sys-state-disabled-state-layer-opacity, 38%));
229
230
  }
230
231
  &> .micl-textfield__character-counter {
231
232
  display: none;
@@ -253,7 +254,7 @@
253
254
  &> input:not(:disabled),
254
255
  &> select:not(:disabled),
255
256
  &> textarea:not(:disabled) {
256
- --statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity);
257
+ --statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity, 8%);
257
258
 
258
259
  border-block-end-color: var(--md-sys-color-on-surface);
259
260
  }
@@ -70,14 +70,15 @@ export default (() =>
70
70
  });
71
71
  }
72
72
 
73
- if (input.matches('input[type=time][data-timepicker]')) {
74
- const timePicker = !input.dataset.timepicker ? null :
75
- document.getElementById(input.dataset.timepicker);
76
- if (timePicker instanceof HTMLDialogElement) {
73
+ if (input.matches('input[type=time][data-timepicker],input[type=date][data-datepicker]')) {
74
+ const picker = !input.dataset.timepicker ? (!input.dataset.datepicker ? null :
75
+ document.getElementById(input.dataset.datepicker)) :
76
+ document.getElementById(input.dataset.timepicker);
77
+ if (picker instanceof HTMLDialogElement) {
77
78
  input.addEventListener('click', (event: Event) =>
78
79
  {
79
80
  event.preventDefault();
80
- timePicker.showModal();
81
+ picker.showModal();
81
82
  });
82
83
  input.addEventListener('keydown', (event: Event) =>
83
84
  {
@@ -88,7 +89,7 @@ export default (() =>
88
89
  case 'Enter':
89
90
  case ' ':
90
91
  event.preventDefault();
91
- timePicker.showModal();
92
+ picker.showModal();
92
93
  break;
93
94
  default:
94
95
  }
@@ -0,0 +1,135 @@
1
+ # Time picker
2
+ This component implements the [Material Design 3 Expressive Time picker](https://m3.material.io/components/time-pickers/overview) design. It allows users to select a specific time of day using either a text input or an analog dial interface.
3
+
4
+ ## Basic Usage
5
+
6
+ ### HTML
7
+ The Time picker component is an extension of the [**Dialog** component](../dialog/README.md). To create a basic time picker, use a `<dialog>` element with both `micl-dialog` and `micl-timepicker` classes.
8
+
9
+ ```HTML
10
+ <dialog id="mytimepicker" class="micl-dialog micl-timepicker" closedby="closerequest" aria-labelledby="mytitle">
11
+ <form method="dialog">
12
+ <div class="micl-dialog__headline">
13
+ <h2 id="mytitle">Enter time</h2>
14
+ </div>
15
+
16
+ <div class="micl-dialog__content">
17
+ <input type="number" name="hour" value="00" aria-labelledby="myhour">
18
+ <span class="micl-timepicker__separator">:</span>
19
+ <input type="number" name="minute" value="00" aria-labelledby="myminute">
20
+ <div class="micl-timepicker__period"></div>
21
+ <span id="myhour" class="micl-timepicker__supporting-text-hour">Hour</span>
22
+ <span id="myminute" class="micl-timepicker__supporting-text-minute">Minute</span>
23
+ <div class="micl-timepicker__dial"></div>
24
+ </div>
25
+
26
+ <div class="micl-dialog__actions">
27
+ <button
28
+ type="button"
29
+ class="micl-timepicker__inputmode micl-iconbutton-standard-s material-symbols-outlined"
30
+ data-alticon="schedule"
31
+ aria-label="Switch input mode"
32
+ >keyboard</button>
33
+ <div>
34
+ <button class="micl-button-text-s" value="">Cancel</button>
35
+ <button class="micl-button-text-s" value="OK">OK</button>
36
+ </div>
37
+ </div>
38
+ </form>
39
+ </dialog>
40
+ ```
41
+
42
+ ### CSS
43
+ Import both the time picker and the dialog styles into your project:
44
+
45
+ ```CSS
46
+ @use "material-inspired-component-library/dist/dialog";
47
+ @use "material-inspired-component-library/dist/timepicker";
48
+ ```
49
+
50
+ Or import all MICL styles:
51
+ ```CSS
52
+ @use "material-inspired-component-library/styles";
53
+ ```
54
+
55
+ ### JavaScript
56
+ This component requires JavaScript to function:
57
+
58
+ ```JavaScript
59
+ import micl from "material-inspired-component-library/dist/micl";
60
+ ```
61
+
62
+ This will initialize any Time picker component, including those that will be added to the DOM later on.
63
+
64
+ ### Live Demo
65
+ A live example of the [Time picker component](https://henkpb.github.io/micl/timepicker.html) is available to interact with.
66
+
67
+ ## Variants
68
+ Because the Time picker component relies on the Dialog component, it utilizes the same utility classes for content structure. Refer to the [Dialog component documentation](../dialog/README.md) for structural details.
69
+
70
+ ### Time Picker Structure
71
+ For the picker to function correctly, the `micl-dialog__content` area must contain:
72
+
73
+ - Hour input: `<input type="number" name="hour">`
74
+ - Minute input: `<input type="number" name="minute">`
75
+ - Separator: A text element with class `micl-timepicker__separator` (e.g., a colon).
76
+ - AM/PM Container: An empty `<div>` with class `micl-timepicker__period`. The component logic will populate this selector if the user's locale uses a 12-hour format.
77
+ - Dial Container: An optional empty `<div>` with class `micl-timepicker__dial` for the analog clock interface.
78
+ - Optional elements for "Hour" and "Minute" supporting text.
79
+
80
+ By default, the layout is **vertical**. To switch to a **horizontal** layout (side-by-side inputs and dial), add the modifier class `micl-timepicker--horizontal` to the `<dialog>`.
81
+
82
+ #### Input Mode Switching
83
+ To allow users to toggle between the text inputs and the analog dial, add a button to the `micl-dialog__actions` container:
84
+
85
+ - Class: `micl-timepicker__inputmode`
86
+ - Data Attribute: `data-alticon="schedule"` (defines the icon to show when toggled).
87
+
88
+ ### Integration
89
+ You can trigger the Time picker component from standard input fields or buttons.
90
+
91
+ #### Connecting to an Input Field
92
+ To replace the browser's native time picker, add the `data-timepicker` attribute to an `<input>` element. The value of this attribute must match the `id` of your Time picker dialog.
93
+
94
+ ```HTML
95
+ <input type="time" data-timepicker="mytimepicker" value="09:41">
96
+ ```
97
+
98
+ - **Behavior**: When the input is clicked, the picker opens with the input's current value.
99
+ - **Reusability**: Multiple input fields can target the same Time picker component ID.
100
+
101
+ You may use the same time picker component for different time-input fields. When the user engages with the input field, the time picker is opened showing the time specified in the `value`-attribute.
102
+
103
+ #### Connecting to a Button
104
+ You can use a button to trigger the picker using the standard `popovertarget` attribute.
105
+
106
+ ```HTML
107
+ <button type="button" class="micl-button-text-m" popovertarget="mytimepicker">09:41</button>
108
+ ```
109
+
110
+ - **Behavior**: The Time picker treats the button's text content as the time value to read from and write to.
111
+
112
+ ## Customizations
113
+ You can customize the appearance of the Time picker component by overriding its global CSS variables. These variables are declared on the `:root` pseudo-class and can be changed on any appropriate parent element to affect its child time pickers.
114
+
115
+ | Variable name | Default Value | Description |
116
+ | ------------- | ------------- | ----------- |
117
+ | --md-sys-timepicker-input-height | 72px | Height of the hour a minute input boxes |
118
+ | --md-sys-timepicker-input-width | 96px | Width of the input boxes in 12-hour mode |
119
+ | --md-sys-timepicker-input-width-24h | 114px | Width of the input boxes in 24-hour mode |
120
+ | --md-sys-timepicker-separator-width | 24px | Width of the space containing the colon separator |
121
+ | --md-sys-timepicker-period-height | 72px | Total height of the AM/PM selector toggle |
122
+ | --md-sys-timepicker-period-width | 52px | Width of the AM/PM selector toggle |
123
+ | --md-sys-timepicker-dial-size | 256px | Diameter of the analog clock face |
124
+ | --md-sys-timepicker-dial-center-size | 8px | Diameter of the center dot in the analog dial |
125
+ | --md-sys-timepicker-dial-track-width | 2px | Thickness of the circular track line on the dial |
126
+
127
+ **Example: Changing the width of the dial track**
128
+
129
+ ```HTML
130
+ <div style="--md-sys-timepicker-dial-track-width:3px">
131
+ <dialog class="micl-dialog micl-timepicker" closedby="closerequest">
132
+ ...
133
+ </dialog>
134
+ </div>
135
+ ```