material-inspired-component-library 6.0.7 → 7.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 (55) hide show
  1. package/README.md +11 -2
  2. package/components/accordion/README.md +4 -6
  3. package/components/appbar/index.scss +4 -4
  4. package/components/button/README.md +16 -1
  5. package/components/button/index.scss +6 -0
  6. package/components/button/index.ts +17 -0
  7. package/components/card/README.md +84 -11
  8. package/components/card/index.scss +178 -209
  9. package/components/checkbox/index.scss +4 -0
  10. package/components/datepicker/README.md +3 -2
  11. package/components/datepicker/index.ts +0 -8
  12. package/components/dialog/README.md +7 -7
  13. package/components/iconbutton/README.md +11 -0
  14. package/components/iconbutton/index.scss +12 -0
  15. package/components/iconbutton/index.ts +15 -0
  16. package/components/navigationrail/README.md +64 -59
  17. package/components/navigationrail/index.scss +197 -300
  18. package/components/navigationrail/index.ts +55 -38
  19. package/components/radio/index.scss +4 -0
  20. package/components/select/index.scss +14 -14
  21. package/components/snackbar/README.md +126 -0
  22. package/components/snackbar/index.scss +94 -73
  23. package/components/snackbar/index.ts +90 -28
  24. package/components/textfield/index.scss +6 -0
  25. package/components/timepicker/README.md +2 -1
  26. package/components/timepicker/index.ts +0 -3
  27. package/dist/appbar.css +1 -1
  28. package/dist/button.css +1 -1
  29. package/dist/card.css +1 -1
  30. package/dist/checkbox.css +1 -1
  31. package/dist/components/navigationrail/index.d.ts +2 -1
  32. package/dist/components/snackbar/index.d.ts +1 -0
  33. package/dist/iconbutton.css +1 -1
  34. package/dist/micl.css +1 -1
  35. package/dist/micl.js +1 -1
  36. package/dist/navigationrail.css +1 -1
  37. package/dist/radio.css +1 -1
  38. package/dist/select.css +1 -1
  39. package/dist/snackbar.css +1 -1
  40. package/dist/textfield.css +1 -1
  41. package/docs/accordion.html +10 -10
  42. package/docs/button.html +43 -15
  43. package/docs/card.html +6 -5
  44. package/docs/datepicker.html +4 -4
  45. package/docs/dialog.html +17 -19
  46. package/docs/iconbutton.html +22 -8
  47. package/docs/index.html +31 -18
  48. package/docs/micl.css +1 -1
  49. package/docs/micl.js +1 -1
  50. package/docs/navigationrail.html +76 -22
  51. package/docs/snackbar.html +31 -14
  52. package/docs/timepicker.html +12 -3
  53. package/package.json +4 -4
  54. package/docs/snackbar1.html +0 -159
  55. package/docs/snackbar2.html +0 -159
package/README.md CHANGED
@@ -51,6 +51,8 @@ Copy the main `micl.css` file to your distribution folder and include it in your
51
51
  <link rel="stylesheet" type="text/css" href="path/to/dist/micl.css">
52
52
  ```
53
53
 
54
+ The main MICL CSS file can also be found on CDN networks, like on jsDelivr: `https://cdn.jsdelivr.net/npm/material-inspired-component-library/dist/micl.css`
55
+
54
56
  ### 3. Add the HTML & JavaScript
55
57
  Here is a simple example of a [Card component](components/card/README.md).
56
58
 
@@ -76,7 +78,8 @@ Copy the main `micl.js` file to your distribution folder and include it in your
76
78
  ```HTML
77
79
  <script src="path/to/dist/micl.js"></script>
78
80
  ```
79
- This will initialize all MICL components, including those that will be added to the DOM later on.
81
+
82
+ The main MICL JavaScript file can also be found on CDN networks, like on jsDelivr: `https://cdn.jsdelivr.net/npm/material-inspired-component-library/dist/micl.js`
80
83
 
81
84
  ### 4. Add a font
82
85
  MICL uses the [**Google Sans**](https://fonts.google.com/specimen/Google+Sans) as its default font. Include a reference to this font in your application.
@@ -113,7 +116,7 @@ The library currently consists of the following components:
113
116
  - [x] [Select](components/select/README.md)
114
117
  - [x] [Side sheet](components/sidesheet/README.md)
115
118
  - [x] [Slider](components/slider/README.md)
116
- - [ ] [Snackbar]
119
+ - [x] [Snackbar](components/snackbar/README.md)
117
120
  - [x] [Stepper](components/stepper/README.md)
118
121
  - [x] [Switch](components/switch/README.md)
119
122
  - [x] [Text field](components/textfield/README.md)
@@ -121,6 +124,12 @@ The library currently consists of the following components:
121
124
 
122
125
  ## Change Log ↪️
123
126
 
127
+ ### 7.0.0 (08.03.2026)
128
+ - **BREAKING**: Use `<a>` instead of `<label>` inside Navigation rail.
129
+ - **BREAKING**: Use `inert` for disabled cards instead of `micl-card--disabled`.
130
+ - **Snackbar**: New component.
131
+ - **Toggle buttons**: Support for toggling icons.
132
+
124
133
  ### 6.0.0 (23.12.2025)
125
134
  - **BREAKING**: Use command-attribute to control toggle buttons.
126
135
  - **Date picker**: New component.
@@ -7,7 +7,7 @@ This component implements the [Material Design 3 Expressive Expandable Lists](ht
7
7
  The Accordion component is an extension of the [**List** component](../list/README.md), using `<details>` and `<summary>` elements for its interactive behaviour. To create a basic accordion, use a `<div>` with the `micl-list` class and nest individual `<details>` elements for each collapsible item. Apply the appropriate `micl-list-item-` class to the `summary` element.
8
8
 
9
9
  ```HTML
10
- <div class="micl-list" role="listbox">
10
+ <div class="micl-list">
11
11
  <details>
12
12
  <summary class="micl-list-item-one">
13
13
  <span class="micl-list-item__text">
@@ -23,8 +23,6 @@ The Accordion component is an extension of the [**List** component](../list/READ
23
23
  </div>
24
24
  ```
25
25
 
26
- - The `role="listbox"` is used for accessibility, indicating a selectable list.
27
-
28
26
  - The `micl-list-item__content` class styles the collapsible area of the accordion item.
29
27
 
30
28
  ### CSS
@@ -55,7 +53,7 @@ A live example of the [Accordion component](https://henkpb.github.io/micl/accord
55
53
  To ensure that only one accordion item within a group can be open at a time, add a matching `name` attribute to all the `<details>` elements you want to group together.
56
54
 
57
55
  ```HTML
58
- <div class="micl-list" role="listbox">
56
+ <div class="micl-list">
59
57
  <details name="mygroup">
60
58
  <summary class="micl-list-item-two">
61
59
  <span class="micl-list-item__text">
@@ -91,7 +89,7 @@ To ensure that only one accordion item within a group can be open at a time, add
91
89
  Add a trailing icon to an accordion item to indicate that the item can be expanded. If you add the `micl-list-item__icon--expander` class to the icon, the icon will rotate 180 degrees when the accordion panel is opened or closed.
92
90
 
93
91
  ```HTML
94
- <div class="micl-list" role="listbox">
92
+ <div class="micl-list">
95
93
  <details>
96
94
  <summary class="micl-list-item-one">
97
95
  <span class="micl-list-item__text">
@@ -122,7 +120,7 @@ You can customize the appearance of the Accordion component by overriding its ow
122
120
  **Example: Changing the margin between an opened item and the next**
123
121
 
124
122
  ```HTML
125
- <div class="micl-list" role="listbox" style="--md-sys-accordion-item-space:4px">
123
+ <div class="micl-list" style="--md-sys-accordion-item-space:4px">
126
124
  <details>
127
125
  ...
128
126
  </details>
@@ -64,11 +64,11 @@
64
64
  }
65
65
  .micl-appbar__leading {
66
66
  grid-area: appbar-leading;
67
- margin-inline-start: calc(var(--md-sys-layout-window-margin) - var(--md-sys-appbar-padding-inline));
67
+ margin-inline-start: var(--md-sys-layout-window-margin);
68
68
  }
69
69
  .micl-appbar__leading-icon {
70
70
  grid-area: appbar-leading;
71
- margin-inline-start: calc(var(--md-sys-layout-window-margin) - (var(--micl-width, statelayer.$md-sys-target-size) / 2) + (var(--md-sys-icon-size, 24px) / 2) - var(--md-sys-appbar-padding-inline));
71
+ margin-inline-start: var(--md-sys-layout-window-margin);
72
72
  color: var(--md-sys-color-on-surface);
73
73
  }
74
74
  .micl-appbar__headline {
@@ -101,11 +101,11 @@
101
101
  }
102
102
  .micl-appbar__trailing {
103
103
  grid-area: appbar-trailing;
104
- margin-inline-end: calc(var(--md-sys-layout-window-margin) - var(--md-sys-appbar-padding-inline));
104
+ margin-inline-end: var(--md-sys-layout-window-margin);
105
105
  }
106
106
  .micl-appbar__trailing-icon {
107
107
  grid-area: appbar-trailing;
108
- margin-inline-end: calc(var(--md-sys-layout-window-margin) - (var(--micl-width, statelayer.$md-sys-target-size) / 2) + (var(--md-sys-icon-size, 24px) / 2) - var(--md-sys-appbar-padding-inline));
108
+ margin-inline-end: var(--md-sys-layout-window-margin);
109
109
  color: var(--md-sys-color-on-surface-variant);
110
110
  }
111
111
  &.micl-appbar--medium {
@@ -84,7 +84,22 @@ To add a leading icon to a button, include an element with the `micl-button__ico
84
84
  </button>
85
85
  ```
86
86
 
87
- This example uses a [Google Material Symbol](https://fonts.google.com/icons). For buttons using these icons, a fill-style of `1` is applied when the button is selected or hovered over. To enable this effect, ensure your `link` tag includes `FILL@0..1`.
87
+ To use different icons for the **on** state and the **off** state in a toggle button, remove the icon name from the `micl-button__icon` element and add the `data-miclicon` (the name of the **on** icon) and `data-micliconselected` (the name of the **off** icon) attributes:
88
+
89
+ ```HTML
90
+ ...
91
+ <span
92
+ class="micl-button__icon material-symbols-outlined"
93
+ data-miclicon="icon_for_on"
94
+ data-micliconselected="icon_for_off"
95
+ aria-hidden="true"
96
+ ><span>
97
+ ...
98
+ ```
99
+
100
+ Note that the name of the currently used icon is also added to the `class` attribute to support icon libraries using class names to identify icons.
101
+
102
+ These examples use [Google Material Symbols](https://fonts.google.com/icons). For buttons using these icons, a fill-style of `1` is applied when the button is selected or hovered over. To enable this effect, ensure your `link` tag includes `FILL@0..1`.
88
103
 
89
104
  ```HTML
90
105
  <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:FILL@0..1" rel="stylesheet">
@@ -100,6 +100,12 @@ button.micl-button-outlined-xl {
100
100
  font-variation-settings: 'FILL' 0;
101
101
  transition: font-variation-settings var(--md-sys-button-motion-duration) linear;
102
102
  }
103
+ &.micl-button--toggle:not(.micl-button--selected) .micl-button__icon::before {
104
+ content: attr(data-miclicon);
105
+ }
106
+ &.micl-button--toggle.micl-button--selected .micl-button__icon::before {
107
+ content: attr(data-micliconselected);
108
+ }
103
109
  }
104
110
 
105
111
  button.micl-button-text-xs,
@@ -21,6 +21,19 @@
21
21
 
22
22
  export const buttonSelector = 'button.micl-button--toggle';
23
23
 
24
+ const toggleIcon = (button: HTMLButtonElement): void =>
25
+ {
26
+ const element = button.querySelector<HTMLElement>('.micl-button__icon') ?? button;
27
+
28
+ const selected = button.classList.contains('micl-button--selected');
29
+ if (element.dataset.micliconselected) {
30
+ element.classList.toggle(element.dataset.micliconselected, selected);
31
+ }
32
+ if (element.dataset.miclicon) {
33
+ element.classList.toggle(element.dataset.miclicon, !selected);
34
+ }
35
+ };
36
+
24
37
  export default (() =>
25
38
  {
26
39
  return {
@@ -35,6 +48,8 @@ export default (() =>
35
48
  ) {
36
49
  target.classList.add('micl-button--toggled');
37
50
  target.classList.toggle('micl-button--selected');
51
+
52
+ toggleIcon(target);
38
53
  }
39
54
  },
40
55
 
@@ -48,6 +63,8 @@ export default (() =>
48
63
  }
49
64
  element.dataset.miclinitialized = '1';
50
65
 
66
+ toggleIcon(element);
67
+
51
68
  element.addEventListener('command', this.command);
52
69
  },
53
70
 
@@ -77,6 +77,8 @@ While the card container is the only required element, the Card component provid
77
77
 
78
78
  - `micl-card__content`: A flexible container for the main body of your card's content.
79
79
 
80
+ - `micl-card__actions`: A flexible container for any action buttons.
81
+
80
82
  ### Actionable Cards
81
83
  For cards that are themselves clickable or interactive (e.g., to navigate to another page), specify the `tabindex="0"` attribute on the card container. Non-actionable cards, which contain interactive elements like buttons or links within their content, should *not* have a tabindex on the card container itself.
82
84
 
@@ -102,12 +104,12 @@ Cards can also serve as containers for expandable detail areas using the `<detai
102
104
  Add the `micl-card--compact` to the main `<div>` element (or, the `<summary>` element for expandable cards) to create a compact version of the card header.
103
105
 
104
106
  ### States
105
- - **Disabled Cards**: To visually indicate a disabled card (e.g., non-interactive), add the `micl-card--disabled` class to the card container.
107
+ - **Disabled Cards**: To visually indicate a disabled card (e.g., non-interactive), add the `inert` attribute to the card container.
106
108
 
107
109
  - **Dragging State**: When implementing drag-and-drop functionality for cards, apply the `micl-card--dragging` class to the card container to provide visual feedback during the drag operation.
108
110
 
109
111
  ## Customizations
110
- You can customize the appearance of the Card 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 cards. Replace **?** by either **elevated**, **filled** or **outlined**.
112
+ You can customize the appearance of the Card 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 cards.
111
113
 
112
114
  | Variable name | Default Value | Description |
113
115
  | ------------- | ----- | ----------- |
@@ -115,15 +117,78 @@ You can customize the appearance of the Card component by overriding its global
115
117
  | --md-comp-card-padding-inline | 16px | Defines the amount of space between the left and right edges of a card and its content |
116
118
  | --md-comp-card-content-padding-block | 16px | The amount of vertical padding reserved for the content area |
117
119
  | --md-comp-card-gap | 8px | Defines the amount of vertical space between structural elements inside the card |
118
- | --md-comp-**?**-card-container-shape | | The shape of the card, like having rounded corners |
119
- | --md-comp-**?**-card-disabled-container-opacity | 38% | The transparency level of a disabled card |
120
- | --md-comp-**?**-card-container-elevation | | How high an enabled card floats above its background |
121
- | --md-comp-**?**-card-disabled-container-elevation | | The elevation of a disabled card |
122
- | --md-comp-**?**-card-hover-container-elevation | | The elevation of a card in the hovered state |
123
- | --md-comp-**?**-card-focus-container-elevation | | The elevation of a card in the focused state |
124
- | --md-comp-**?**-card-pressed-container-elevation | | The elevation of a card in the pressed state |
125
- | --md-comp-**?**-card-dragged-container-elevation | | The elevation of a card being dragged |
126
- | --md-comp-outlined-card-outline-width | 1px | The width of the border of **outlined** cards |
120
+
121
+ The Card component supports the following CSS variables, as defined in the [Material Design 3 Expressive Card Specification](https://m3.material.io/components/cards/specs):
122
+
123
+ ```CSS
124
+ --md-comp-elevated-card-container-color
125
+ --md-comp-elevated-card-container-elevation
126
+ --md-comp-elevated-card-container-shape
127
+ --md-comp-elevated-card-disabled-container-elevation
128
+ --md-comp-elevated-card-disabled-container-color
129
+ --md-comp-elevated-card-hover-container-elevation
130
+ --md-comp-elevated-card-hover-state-layer-color
131
+ --md-comp-elevated-card-hover-state-layer-opacity
132
+ --md-comp-elevated-card-focus-indicator-color
133
+ --md-comp-elevated-card-focus-indicator-thickness
134
+ --md-comp-elevated-card-focus-indicator-outline-offset
135
+ --md-comp-elevated-card-focus-container-elevation
136
+ --md-comp-elevated-card-focus-state-layer-color
137
+ --md-comp-elevated-card-focus-state-layer-opacity
138
+ --md-comp-elevated-card-pressed-container-elevation
139
+ --md-comp-elevated-card-pressed-state-layer-color
140
+ --md-comp-elevated-card-pressed-state-layer-opacity
141
+ --md-comp-elevated-card-dragged-container-elevation
142
+ --md-comp-elevated-card-dragged-state-layer-color
143
+ --md-comp-elevated-card-dragged-state-layer-opacity
144
+ --md-comp-filled-card-container-color
145
+ --md-comp-filled-card-container-elevation
146
+ --md-comp-filled-card-container-shape
147
+ --md-comp-filled-card-disabled-container-elevation
148
+ --md-comp-filled-card-disabled-container-color
149
+ --md-comp-filled-card-hover-container-elevation
150
+ --md-comp-filled-card-hover-state-layer-color
151
+ --md-comp-filled-card-hover-state-layer-opacity
152
+ --md-comp-filled-card-focus-indicator-color
153
+ --md-comp-filled-card-focus-indicator-thickness
154
+ --md-comp-filled-card-focus-indicator-outline-offset
155
+ --md-comp-filled-card-focus-container-elevation
156
+ --md-comp-filled-card-focus-state-layer-color
157
+ --md-comp-filled-card-focus-state-layer-opacity
158
+ --md-comp-filled-card-pressed-container-elevation
159
+ --md-comp-filled-card-pressed-state-layer-color
160
+ --md-comp-filled-card-pressed-state-layer-opacity
161
+ --md-comp-filled-card-dragged-container-elevation
162
+ --md-comp-filled-card-dragged-state-layer-color
163
+ --md-comp-filled-card-dragged-state-layer-opacity
164
+ --md-comp-outlined-card-container-color
165
+ --md-comp-outlined-card-container-elevation
166
+ --md-comp-outlined-card-container-shape
167
+ --md-comp-outlined-card-outline-width
168
+ --md-comp-outlined-card-outline-color
169
+ --md-comp-outlined-card-disabled-container-elevation
170
+ --md-comp-outlined-card-disabled-outline-color
171
+ --md-comp-outlined-card-disabled-outline-opacity
172
+ --md-comp-outlined-card-hover-container-elevation
173
+ --md-comp-outlined-card-hover-outline-color
174
+ --md-comp-outlined-card-hover-state-layer-color
175
+ --md-comp-outlined-card-hover-state-layer-opacity
176
+ --md-comp-outlined-card-focus-indicator-color
177
+ --md-comp-outlined-card-focus-indicator-thickness
178
+ --md-comp-outlined-card-focus-indicator-outline-offset
179
+ --md-comp-outlined-card-focus-container-elevation
180
+ --md-comp-outlined-card-focus-outline-color
181
+ --md-comp-outlined-card-focus-state-layer-color
182
+ --md-comp-outlined-card-focus-state-layer-opacity
183
+ --md-comp-outlined-card-pressed-container-elevation
184
+ --md-comp-outlined-card-pressed-outline-color
185
+ --md-comp-outlined-card-pressed-state-layer-color
186
+ --md-comp-outlined-card-pressed-state-layer-opacity
187
+ --md-comp-outlined-card-dragged-container-elevation
188
+ --md-comp-outlined-card-dragged-outline-color
189
+ --md-comp-outlined-card-dragged-state-layer-color
190
+ --md-comp-outlined-card-dragged-state-layer-opacity
191
+ ```
127
192
 
128
193
  **Example: Changing the card margins**
129
194
 
@@ -138,6 +203,14 @@ You can customize the appearance of the Card component by overriding its global
138
203
  </div>
139
204
  ```
140
205
 
206
+ To change the amount of rounding of a filled card's corners, you could for example add a CSS rule to your stylesheet:
207
+
208
+ ```CSS
209
+ .micl-card-filled {
210
+ --md-comp-filled-card-container-shape: 24px;
211
+ }
212
+ ```
213
+
141
214
  ## Compatibility
142
215
  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.
143
216