material-inspired-component-library 4.0.1 → 4.0.2

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.
@@ -112,5 +112,25 @@ Use a [Divider component](../divider/README.md) to separate neighbouring accordi
112
112
 
113
113
  Since the Accordion is based on the List component, you can use the same utility classes for content structure and styling. Refer to the [List component documentation](../list/README.md) for details on how to add icons, avatars, images, and other features to your accordion items.
114
114
 
115
+ ## Customizations
116
+ You can customize the appearance of the Accordion component by overriding its own global CSS variables and those from the List component. These variables are declared on the `:root` pseudo-class and can be changed on any appropriate parent element to affect its child accordions.
117
+
118
+ | Variable name | Default Value | Description |
119
+ | ------------- | ------------- | ----------- |
120
+ | --md-sys-accordion-item-space | 0px | The space between an opened accordion item and its next neighbour. |
121
+
122
+ **Example: Changing the margin between an opened item and the next**
123
+
124
+ ```HTML
125
+ <div class="micl-list" role="listbox" style="--md-sys-accordion-item-space:4px">
126
+ <details>
127
+ ...
128
+ </details>
129
+ <details>
130
+ ...
131
+ </details>
132
+ </div>
133
+ ```
134
+
115
135
  ## Compatibility
116
136
  The Card component uses the `interpolate-size` CSS property to smoothly open and close the detail area of a Details disclosure element, which might not be supported in your browser. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/interpolate-size#browser_compatibility) for details.
@@ -1,5 +1,5 @@
1
1
  # Alert
2
- This component is an Alert component inspired by [Material Design 3 Expressive](https://m3.material.io/components). Alerts are used to inform the user of important changes in a prominent way.
2
+ Alerts are used to inform the user of important changes in a prominent way. This component is inspired by [Material Design 3 Expressive](https://m3.material.io/components).
3
3
 
4
4
  ## Basic Usage
5
5
 
@@ -46,16 +46,28 @@ Alerts are available in **three distinct styles**:
46
46
 
47
47
  - `micl-alert-tonal`: An alert with a lighter background color. This is the style shown in the Basic Usage section.
48
48
 
49
- - `micl-alert-outlined`: An alert with a clear border, typically used for less prominent content.
49
+ - `micl-alert-outlined`: An alert with a clear border and a transparent background, typically used for less prominent content.
50
+
51
+ You can change the component's color to reflect different semantic meanings or states.
52
+
53
+ **By default, all alert styles use the error-style color scheme.**
54
+
55
+ To change the color, add one of the following modifier classes to the main `<div>` element.
56
+
57
+ | Class name | Description |
58
+ | ---------- | ----------- |
59
+ | micl-alert--primary | Uses the main color scheme of your application |
60
+ | micl-alert--secondary | Uses a color scheme that is less prominent than the main one |
61
+ | micl-alert--tertiary | Uses a color scheme that provides contrasting accents |
50
62
 
51
63
  ### Alert Content Structure
52
- The alert in the Basic Usage section shows all available structural elements:
64
+ The Alert component is built with a few key structural elements.
53
65
 
54
- - `micl-alert__icon`: An optional icon that appears before the alert text.
66
+ - `micl-alert__icon` (optional): A container for an icon, typically from a library like Material Symbols. It appears before the alert text.
55
67
 
56
- - `micl-alert__text`: A container for the main alert heading (`<h1>`-`<h6>`) and the supporting text.
68
+ - `micl-alert__text`: A container for the main alert heading (`<h1>`-`<h6>`) and supporting text.
57
69
 
58
- - `micl-alert__supporting-text`: Intended for a short description or supplementary information, and displayed in a smaller font.
70
+ - `micl-alert__supporting-text` (optional): Used for a short description or supplementary information. It is displayed in a smaller font.
59
71
 
60
72
  ## Customizations
61
73
  You can customize the appearance of the Alert 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 alert.
@@ -63,7 +75,7 @@ You can customize the appearance of the Alert component by overriding its global
63
75
  | Variable name | Default Value | Description |
64
76
  | ------------- | ------------- | ----------- |
65
77
  | --md-sys-alert-padding | 16px | The inner padding between the alert's edge and its content |
66
- | --md-sys-alert-space | 16px | Sets the spacing between the icon and the text |
78
+ | --md-sys-alert-space | 16px | The spacing between the optional icon and the text container |
67
79
 
68
80
  **Example: Changing the padding**
69
81
 
@@ -92,4 +92,4 @@ You can also use other icon libraries. For example, with the [Bootstrap Icons li
92
92
  ```
93
93
 
94
94
  ## Compatibility
95
- This component uses the `color-mix` CSS functional notation, which might not be supported in your browser. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color-mix#browser_compatibility) for details.
95
+ This component utilizes relative RGB color values, which may not be fully supported in your browser. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#browser_compatibility) for details.
@@ -63,6 +63,7 @@ button.micl-button-outlined-xl {
63
63
  position: relative;
64
64
  display: inline-flex;
65
65
  align-items: center;
66
+ justify-content: center;
66
67
  padding: 0;
67
68
  border: none;
68
69
  border-radius: calc(var(--micl-height) / 2);
@@ -115,15 +116,16 @@ button.micl-button-outlined-xs {
115
116
  min-inline-size: var(--micl-width);
116
117
  block-size: var(--micl-height);
117
118
  min-block-size: var(--micl-height);
118
- column-gap: 8px;
119
+ column-gap: 4px;
119
120
  padding-inline: 12px;
120
121
 
121
122
  &::before {
122
123
  content: "";
123
124
  position: absolute;
124
- block-size: var(--md-sys-target-size);
125
- inline-size: var(--md-sys-target-size);
126
- inset: calc((var(--micl-height) - var(--md-sys-target-size)) / 2) 0 0 calc((var(--micl-width) - var(--md-sys-target-size)) / 2);
125
+ block-size: var(--md-sys-target-size, 48px);
126
+ inline-size: 100%;
127
+ min-inline-size: var(--md-sys-target-size, 48px);
128
+ inset: calc((var(--micl-height) - var(--md-sys-target-size, 48px)) / 2) 0 0 calc((min(100%, var(--md-sys-target-size, 48px)) - var(--md-sys-target-size, 48px)) / 2);
127
129
  background-color: transparent;
128
130
  }
129
131
  &.micl-button--toggle.micl-button--selected {
@@ -133,7 +135,7 @@ button.micl-button-outlined-xs {
133
135
  border-radius: var(--md-sys-shape-corner-medium);
134
136
 
135
137
  &.micl-button--toggle.micl-button--selected {
136
- border-radius: var(--md-sys-shape-corner-full);
138
+ border-radius: calc(var(--micl-height) / 2);
137
139
  }
138
140
  }
139
141
  &:not(:disabled) {
@@ -143,7 +145,7 @@ button.micl-button-outlined-xs {
143
145
  }
144
146
  .micl-button__icon {
145
147
  font-size: 20px;
146
- width: 20px;
148
+ inline-size: 20px;
147
149
  }
148
150
  }
149
151
 
@@ -167,9 +169,10 @@ button.micl-button-outlined-s {
167
169
  &::before {
168
170
  content: "";
169
171
  position: absolute;
170
- block-size: var(--md-sys-target-size);
171
- inline-size: var(--md-sys-target-size);
172
- inset: calc((var(--micl-height) - var(--md-sys-target-size)) / 2) 0 0 calc((var(--micl-width) - var(--md-sys-target-size)) / 2);
172
+ block-size: var(--md-sys-target-size, 48px);
173
+ inline-size: 100%;
174
+ min-inline-size: var(--md-sys-target-size, 48px);
175
+ inset: calc((var(--micl-height) - var(--md-sys-target-size, 48px)) / 2) 0 0 calc((min(100%, var(--md-sys-target-size, 48px)) - var(--md-sys-target-size, 48px)) / 2);
173
176
  background-color: transparent;
174
177
  }
175
178
  &.micl-button--toggle.micl-button--selected {
@@ -179,7 +182,7 @@ button.micl-button-outlined-s {
179
182
  border-radius: var(--md-sys-shape-corner-medium);
180
183
 
181
184
  &.micl-button--toggle.micl-button--selected {
182
- border-radius: var(--md-sys-shape-corner-full);
185
+ border-radius: calc(var(--micl-height) / 2);
183
186
  }
184
187
  }
185
188
  &:not(:disabled) {
@@ -189,7 +192,7 @@ button.micl-button-outlined-s {
189
192
  }
190
193
  .micl-button__icon {
191
194
  font-size: 20px;
192
- width: 20px;
195
+ inline-size: 20px;
193
196
  }
194
197
  }
195
198
 
@@ -217,17 +220,17 @@ button.micl-button-outlined-m {
217
220
  border-radius: var(--md-sys-shape-corner-large);
218
221
 
219
222
  &.micl-button--toggle.micl-button--selected {
220
- border-radius: var(--md-sys-shape-corner-full);
223
+ border-radius: calc(var(--micl-height) / 2);
221
224
  }
222
225
  }
223
226
  &:not(:disabled) {
224
227
  &:active {
225
- border-radius: var(--md-sys-shape-corner-small);
228
+ border-radius: var(--md-sys-shape-corner-medium);
226
229
  }
227
230
  }
228
231
  .micl-button__icon {
229
232
  font-size: var(--md-sys-layout-icon-size, 24px);
230
- width: var(--md-sys-layout-icon-size, 24px);
233
+ inline-size: var(--md-sys-layout-icon-size, 24px);
231
234
  }
232
235
  }
233
236
 
@@ -254,7 +257,7 @@ button.micl-button-outlined-l {
254
257
  border-radius: var(--md-sys-shape-corner-extra-large);
255
258
 
256
259
  &.micl-button--toggle.micl-button--selected {
257
- border-radius: var(--md-sys-shape-corner-full);
260
+ border-radius: calc(var(--micl-height) / 2);
258
261
  }
259
262
  }
260
263
  &:not(:disabled) {
@@ -264,7 +267,7 @@ button.micl-button-outlined-l {
264
267
  }
265
268
  .micl-button__icon {
266
269
  font-size: 32px;
267
- width: 32px;
270
+ inline-size: 32px;
268
271
  }
269
272
  }
270
273
 
@@ -291,7 +294,7 @@ button.micl-button-outlined-xl {
291
294
  border-radius: var(--md-sys-shape-corner-extra-large);
292
295
 
293
296
  &.micl-button--toggle.micl-button--selected {
294
- border-radius: var(--md-sys-shape-corner-full);
297
+ border-radius: calc(var(--micl-height) / 2);
295
298
  }
296
299
  }
297
300
  &:not(:disabled) {
@@ -301,7 +304,7 @@ button.micl-button-outlined-xl {
301
304
  }
302
305
  .micl-button__icon {
303
306
  font-size: 40px;
304
- width: 40px;
307
+ inline-size: 40px;
305
308
  }
306
309
  }
307
310
 
@@ -373,11 +376,11 @@ button.micl-button-elevated-xl {
373
376
  }
374
377
  }
375
378
  button.micl-button-elevated-xs {
376
- height: 32px;
379
+ block-size: 32px;
377
380
  border: none;
378
381
  }
379
382
  button.micl-button-elevated-s {
380
- height: 40px;
383
+ block-size: 40px;
381
384
  border: none;
382
385
  }
383
386
 
@@ -53,8 +53,8 @@ Removing the `popover` attribute creates a more intrusive **modal** dialog. This
53
53
  </div>
54
54
  <div class="micl-dialog__actions">
55
55
  <form method="dialog">
56
- <button class="micl-button">Cancel</button>
57
- <button class="micl-button">Save</button>
56
+ <button class="micl-button-text-s">Cancel</button>
57
+ <button class="micl-button-text-s">Save</button>
58
58
  </form>
59
59
  </div>
60
60
  </dialog>
@@ -100,14 +100,14 @@ A full-screen dialog covers the entire viewport, primarily on smaller screens. O
100
100
  <button type="button" class="micl-iconbutton-s material-symbols-outlined" popovertarget="mydialog" aria-label="Close">close</button>
101
101
  <span class="micl-dialog__icon material-symbols-outlined" aria-hidden="true">person</span>
102
102
  <h2 id="mytitle">Full-screen dialog</h2>
103
- <button class="micl-button" value="dosave">Save</button>
103
+ <button class="micl-button-text-s" value="dosave">Save</button>
104
104
  </form>
105
105
  <div class="micl-dialog__content">
106
106
  <span id="mydesc" class="micl-dialog__supporting-text">This dialog covers the whole screen.</span>
107
107
  </div>
108
108
  <form method="dialog" class="micl-dialog__actions">
109
- <button type="button" class="micl-button" popovertarget="mydialog">Cancel</button>
110
- <button class="micl-button" value="dosave">Save</button>
109
+ <button type="button" class="micl-button-text-s" popovertarget="mydialog">Cancel</button>
110
+ <button class="micl-button-text-s" value="dosave">Save</button>
111
111
  </form>
112
112
  </dialog>
113
113
 
@@ -34,7 +34,7 @@ body {
34
34
  .micl-divider-inset-end {
35
35
  inline-size: 100%;
36
36
  block-size: 0;
37
- margin-block: calc(var(--md-sys-divider-space, 4px) - 1px) var(--md-sys-divider-space, 4px);
37
+ margin-block: calc(var(--md-sys-divider-space, 4px) - 0.5px) calc(var(--md-sys-divider-space, 4px) - 0.5px);
38
38
  margin-inline: 0;
39
39
  border: none;
40
40
  border-block-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color, gray);
@@ -63,3 +63,9 @@ body {
63
63
  border: none;
64
64
  border-inline-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color, gray);
65
65
  }
66
+
67
+ li.micl-divider {
68
+ list-style: none;
69
+ box-shadow: 0 calc(-1 * var(--md-sys-divider-space, 4px) / 2) 0 calc(var(--md-sys-divider-space, 4px) / 2) var(--md-sys-list-item-container-color),
70
+ 0 calc(var(--md-sys-divider-space, 4px) / 2) 0 calc(var(--md-sys-divider-space, 4px) / 2) var(--md-sys-list-item-container-color);
71
+ }
@@ -86,4 +86,4 @@ You can also use other icon libraries. For example, with the [Bootstrap Icons li
86
86
  ```
87
87
 
88
88
  ## Compatibility
89
- This component uses the `color-mix` CSS functional notation, which might not be supported in your browser. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color-mix#browser_compatibility) for details.
89
+ This component utilizes relative RGB color values, which may not be fully supported in your browser. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#browser_compatibility) for details.
@@ -111,9 +111,10 @@ button.micl-iconbutton-outlined-xs {
111
111
  &::before {
112
112
  content: "";
113
113
  position: absolute;
114
- block-size: var(--md-sys-target-size);
115
- inline-size: var(--md-sys-target-size);
116
- inset: calc((var(--micl-height) - var(--md-sys-target-size)) / 2) 0 0 calc((var(--micl-width) - var(--md-sys-target-size)) / 2);
114
+ block-size: var(--md-sys-target-size, 48px);
115
+ inline-size: 100%;
116
+ min-inline-size: var(--md-sys-target-size, 48px);
117
+ inset: calc((var(--micl-height) - var(--md-sys-target-size, 48px)) / 2) 0 0 calc((min(100%, var(--md-sys-target-size, 48px)) - var(--md-sys-target-size, 48px)) / 2);
117
118
  background-color: transparent;
118
119
  }
119
120
  &.micl-button--toggle.micl-button--selected {
@@ -125,7 +126,7 @@ button.micl-iconbutton-outlined-xs {
125
126
  }
126
127
  &.micl-iconbutton--wide {
127
128
  --micl-width: 40px;
128
- border-radius: calc(var(--micl-width) / 2);
129
+ border-radius: calc(var(--micl-height) / 2);
129
130
  }
130
131
  &.micl-button--square {
131
132
  border-radius: var(--md-sys-shape-corner-medium);
@@ -158,9 +159,10 @@ button.micl-iconbutton-outlined-s {
158
159
  &::before {
159
160
  content: "";
160
161
  position: absolute;
161
- block-size: var(--md-sys-target-size);
162
- inline-size: var(--md-sys-target-size);
163
- inset: calc((var(--micl-height) - var(--md-sys-target-size)) / 2) 0 0 calc((var(--micl-width) - var(--md-sys-target-size)) / 2);
162
+ block-size: var(--md-sys-target-size, 48px);
163
+ inline-size: 100%;
164
+ min-inline-size: var(--md-sys-target-size, 48px);
165
+ inset: calc((var(--micl-height) - var(--md-sys-target-size, 48px)) / 2) 0 0 calc((min(100%, var(--md-sys-target-size, 48px)) - var(--md-sys-target-size, 48px)) / 2);
164
166
  background-color: transparent;
165
167
  }
166
168
  &.micl-button--toggle.micl-button--selected {
@@ -172,12 +174,7 @@ button.micl-iconbutton-outlined-s {
172
174
  }
173
175
  &.micl-iconbutton--wide {
174
176
  --micl-width: 52px;
175
- border-radius: calc(var(--micl-width) / 2);
176
-
177
- &::before {
178
- inline-size: var(--micl-width);
179
- inset: calc((40px - var(--md-sys-target-size)) / 2) 0 0 0;
180
- }
177
+ border-radius: calc(var(--micl-height) / 2);
181
178
  }
182
179
  &.micl-button--square {
183
180
  border-radius: var(--md-sys-shape-corner-medium);
@@ -215,7 +212,7 @@ button.micl-iconbutton-outlined-m {
215
212
  }
216
213
  &.micl-iconbutton--wide {
217
214
  --micl-width: 72px;
218
- border-radius: calc(var(--micl-width) / 2);
215
+ border-radius: calc(var(--micl-height) / 2);
219
216
  }
220
217
  &.micl-button--square {
221
218
  border-radius: var(--md-sys-shape-corner-large);
@@ -226,7 +223,7 @@ button.micl-iconbutton-outlined-m {
226
223
  }
227
224
  &:not(:disabled) {
228
225
  &:active {
229
- border-radius: var(--md-sys-shape-corner-small);
226
+ border-radius: var(--md-sys-shape-corner-medium);
230
227
  }
231
228
  }
232
229
  }
@@ -252,7 +249,7 @@ button.micl-iconbutton-outlined-l {
252
249
  }
253
250
  &.micl-iconbutton--wide {
254
251
  --micl-width: 128px;
255
- border-radius: calc(var(--micl-width) / 2);
252
+ border-radius: calc(var(--micl-height) / 2);
256
253
  }
257
254
  &.micl-button--square {
258
255
  border-radius: var(--md-sys-shape-corner-extra-large);
@@ -289,7 +286,7 @@ button.micl-iconbutton-outlined-xl {
289
286
  }
290
287
  &.micl-iconbutton--wide {
291
288
  --micl-width: 184px;
292
- border-radius: calc(var(--micl-width) / 2);
289
+ border-radius: calc(var(--micl-height) / 2);
293
290
  }
294
291
  &.micl-button--square {
295
292
  border-radius: var(--md-sys-shape-corner-extra-large);
@@ -315,6 +312,9 @@ button.micl-iconbutton-standard-l,
315
312
  button.micl-iconbutton-standard-xl {
316
313
  --statelayer-color: var(--md-sys-color-on-surface-variant);
317
314
 
315
+ &:disabled {
316
+ background-color: transparent;
317
+ }
318
318
  &:not(:disabled) {
319
319
  &.micl-button--toggle.micl-button--selected {
320
320
  --statelayer-color: var(--md-sys-color-primary);
@@ -416,6 +416,9 @@ button.micl-iconbutton-outlined-xl {
416
416
  // border: 3px solid var(--md-sys-color-outline);
417
417
  border: 3px solid var(--md-sys-color-outline-variant);
418
418
  }
419
+ &:disabled {
420
+ background-color: transparent;
421
+ }
419
422
  &:not(:disabled) {
420
423
  &.micl-button--toggle.micl-button--selected {
421
424
  --statelayer-color: var(--md-sys-color-inverse-on-surface);
@@ -35,6 +35,7 @@
35
35
  --md-sys-list-item-three-padding: 12px;
36
36
  --md-sys-list-item-space: 16px;
37
37
  --md-sys-list-item-padding-inline: 16px;
38
+ --md-sys-accordion-item-space: 0px;
38
39
  }
39
40
 
40
41
  .micl-list {
@@ -60,6 +61,7 @@
60
61
  }
61
62
  &[open]::details-content {
62
63
  block-size: auto;
64
+ margin-block-end: var(--md-sys-accordion-item-space, 0px);
63
65
  }
64
66
  &[open] .micl-list-item__icon--expander {
65
67
  transform: rotate(180deg);
@@ -88,11 +90,6 @@
88
90
  overflow: hidden;
89
91
  }
90
92
  }
91
-
92
- li.micl-divider {
93
- box-shadow: 0 -4px 0 3px var(--md-sys-list-item-container-color),
94
- 0 4px 0 4px var(--md-sys-list-item-container-color);
95
- }
96
93
  }
97
94
 
98
95
  .micl-list:has(.micl-list-item-one[tabindex], .micl-list-item-two[tabindex], .micl-list-item-three[tabindex]),
@@ -70,6 +70,32 @@ 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) {
77
+ input.addEventListener('click', (event: Event) =>
78
+ {
79
+ event.preventDefault();
80
+ timePicker.showModal();
81
+ });
82
+ input.addEventListener('keydown', (event: Event) =>
83
+ {
84
+ if (!(event instanceof KeyboardEvent)) {
85
+ return;
86
+ }
87
+ switch (event.key) {
88
+ case 'Enter':
89
+ case ' ':
90
+ event.preventDefault();
91
+ timePicker.showModal();
92
+ break;
93
+ default:
94
+ }
95
+ });
96
+ }
97
+ }
98
+
73
99
  setCounter(input);
74
100
  },
75
101