material-inspired-component-library 6.0.7 → 7.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.
- package/README.md +11 -2
- package/components/appbar/index.scss +4 -4
- package/components/button/README.md +16 -1
- package/components/button/index.scss +6 -0
- package/components/button/index.ts +17 -0
- package/components/card/README.md +82 -11
- package/components/card/index.scss +169 -209
- package/components/datepicker/README.md +3 -2
- package/components/datepicker/index.ts +0 -8
- package/components/iconbutton/README.md +11 -0
- package/components/iconbutton/index.scss +12 -0
- package/components/iconbutton/index.ts +15 -0
- package/components/navigationrail/README.md +64 -59
- package/components/navigationrail/index.scss +197 -300
- package/components/navigationrail/index.ts +55 -38
- package/components/snackbar/README.md +126 -0
- package/components/snackbar/index.scss +94 -73
- package/components/snackbar/index.ts +90 -28
- package/components/timepicker/README.md +2 -1
- package/components/timepicker/index.ts +0 -3
- package/dist/appbar.css +1 -1
- package/dist/button.css +1 -1
- package/dist/card.css +1 -1
- package/dist/components/navigationrail/index.d.ts +2 -1
- package/dist/components/snackbar/index.d.ts +1 -0
- package/dist/iconbutton.css +1 -1
- package/dist/micl.css +1 -1
- package/dist/micl.js +1 -1
- package/dist/navigationrail.css +1 -1
- package/dist/snackbar.css +1 -1
- package/docs/button.html +43 -15
- package/docs/card.html +6 -5
- package/docs/datepicker.html +4 -4
- package/docs/iconbutton.html +22 -8
- package/docs/index.html +31 -18
- package/docs/micl.css +1 -1
- package/docs/micl.js +1 -1
- package/docs/navigationrail.html +76 -22
- package/docs/snackbar.html +31 -14
- package/docs/timepicker.html +12 -3
- package/package.json +1 -1
- package/docs/snackbar1.html +0 -159
- 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
|
-
|
|
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
|
-
- [
|
|
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.
|
|
@@ -64,11 +64,11 @@
|
|
|
64
64
|
}
|
|
65
65
|
.micl-appbar__leading {
|
|
66
66
|
grid-area: appbar-leading;
|
|
67
|
-
margin-inline-start:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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
|
|
|
@@ -102,12 +102,12 @@ Cards can also serve as containers for expandable detail areas using the `<detai
|
|
|
102
102
|
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
103
|
|
|
104
104
|
### States
|
|
105
|
-
- **Disabled Cards**: To visually indicate a disabled card (e.g., non-interactive), add the `
|
|
105
|
+
- **Disabled Cards**: To visually indicate a disabled card (e.g., non-interactive), add the `inert` attribute to the card container.
|
|
106
106
|
|
|
107
107
|
- **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
108
|
|
|
109
109
|
## 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.
|
|
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.
|
|
111
111
|
|
|
112
112
|
| Variable name | Default Value | Description |
|
|
113
113
|
| ------------- | ----- | ----------- |
|
|
@@ -115,15 +115,78 @@ You can customize the appearance of the Card component by overriding its global
|
|
|
115
115
|
| --md-comp-card-padding-inline | 16px | Defines the amount of space between the left and right edges of a card and its content |
|
|
116
116
|
| --md-comp-card-content-padding-block | 16px | The amount of vertical padding reserved for the content area |
|
|
117
117
|
| --md-comp-card-gap | 8px | Defines the amount of vertical space between structural elements inside the card |
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
118
|
+
|
|
119
|
+
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):
|
|
120
|
+
|
|
121
|
+
```CSS
|
|
122
|
+
--md-comp-elevated-card-container-color
|
|
123
|
+
--md-comp-elevated-card-container-elevation
|
|
124
|
+
--md-comp-elevated-card-container-shape
|
|
125
|
+
--md-comp-elevated-card-disabled-container-elevation
|
|
126
|
+
--md-comp-elevated-card-disabled-container-color
|
|
127
|
+
--md-comp-elevated-card-hover-container-elevation
|
|
128
|
+
--md-comp-elevated-card-hover-state-layer-color
|
|
129
|
+
--md-comp-elevated-card-hover-state-layer-opacity
|
|
130
|
+
--md-comp-elevated-card-focus-indicator-color
|
|
131
|
+
--md-comp-elevated-card-focus-indicator-thickness
|
|
132
|
+
--md-comp-elevated-card-focus-indicator-outline-offset
|
|
133
|
+
--md-comp-elevated-card-focus-container-elevation
|
|
134
|
+
--md-comp-elevated-card-focus-state-layer-color
|
|
135
|
+
--md-comp-elevated-card-focus-state-layer-opacity
|
|
136
|
+
--md-comp-elevated-card-pressed-container-elevation
|
|
137
|
+
--md-comp-elevated-card-pressed-state-layer-color
|
|
138
|
+
--md-comp-elevated-card-pressed-state-layer-opacity
|
|
139
|
+
--md-comp-elevated-card-dragged-container-elevation
|
|
140
|
+
--md-comp-elevated-card-dragged-state-layer-color
|
|
141
|
+
--md-comp-elevated-card-dragged-state-layer-opacity
|
|
142
|
+
--md-comp-filled-card-container-color
|
|
143
|
+
--md-comp-filled-card-container-elevation
|
|
144
|
+
--md-comp-filled-card-container-shape
|
|
145
|
+
--md-comp-filled-card-disabled-container-elevation
|
|
146
|
+
--md-comp-filled-card-disabled-container-color
|
|
147
|
+
--md-comp-filled-card-hover-container-elevation
|
|
148
|
+
--md-comp-filled-card-hover-state-layer-color
|
|
149
|
+
--md-comp-filled-card-hover-state-layer-opacity
|
|
150
|
+
--md-comp-filled-card-focus-indicator-color
|
|
151
|
+
--md-comp-filled-card-focus-indicator-thickness
|
|
152
|
+
--md-comp-filled-card-focus-indicator-outline-offset
|
|
153
|
+
--md-comp-filled-card-focus-container-elevation
|
|
154
|
+
--md-comp-filled-card-focus-state-layer-color
|
|
155
|
+
--md-comp-filled-card-focus-state-layer-opacity
|
|
156
|
+
--md-comp-filled-card-pressed-container-elevation
|
|
157
|
+
--md-comp-filled-card-pressed-state-layer-color
|
|
158
|
+
--md-comp-filled-card-pressed-state-layer-opacity
|
|
159
|
+
--md-comp-filled-card-dragged-container-elevation
|
|
160
|
+
--md-comp-filled-card-dragged-state-layer-color
|
|
161
|
+
--md-comp-filled-card-dragged-state-layer-opacity
|
|
162
|
+
--md-comp-outlined-card-container-color
|
|
163
|
+
--md-comp-outlined-card-container-elevation
|
|
164
|
+
--md-comp-outlined-card-container-shape
|
|
165
|
+
--md-comp-outlined-card-outline-width
|
|
166
|
+
--md-comp-outlined-card-outline-color
|
|
167
|
+
--md-comp-outlined-card-disabled-container-elevation
|
|
168
|
+
--md-comp-outlined-card-disabled-outline-color
|
|
169
|
+
--md-comp-outlined-card-disabled-outline-opacity
|
|
170
|
+
--md-comp-outlined-card-hover-container-elevation
|
|
171
|
+
--md-comp-outlined-card-hover-outline-color
|
|
172
|
+
--md-comp-outlined-card-hover-state-layer-color
|
|
173
|
+
--md-comp-outlined-card-hover-state-layer-opacity
|
|
174
|
+
--md-comp-outlined-card-focus-indicator-color
|
|
175
|
+
--md-comp-outlined-card-focus-indicator-thickness
|
|
176
|
+
--md-comp-outlined-card-focus-indicator-outline-offset
|
|
177
|
+
--md-comp-outlined-card-focus-container-elevation
|
|
178
|
+
--md-comp-outlined-card-focus-outline-color
|
|
179
|
+
--md-comp-outlined-card-focus-state-layer-color
|
|
180
|
+
--md-comp-outlined-card-focus-state-layer-opacity
|
|
181
|
+
--md-comp-outlined-card-pressed-container-elevation
|
|
182
|
+
--md-comp-outlined-card-pressed-outline-color
|
|
183
|
+
--md-comp-outlined-card-pressed-state-layer-color
|
|
184
|
+
--md-comp-outlined-card-pressed-state-layer-opacity
|
|
185
|
+
--md-comp-outlined-card-dragged-container-elevation
|
|
186
|
+
--md-comp-outlined-card-dragged-outline-color
|
|
187
|
+
--md-comp-outlined-card-dragged-state-layer-color
|
|
188
|
+
--md-comp-outlined-card-dragged-state-layer-opacity
|
|
189
|
+
```
|
|
127
190
|
|
|
128
191
|
**Example: Changing the card margins**
|
|
129
192
|
|
|
@@ -138,6 +201,14 @@ You can customize the appearance of the Card component by overriding its global
|
|
|
138
201
|
</div>
|
|
139
202
|
```
|
|
140
203
|
|
|
204
|
+
To change the amount of rounding of a filled card's corners, you could for example add a CSS rule to your stylesheet:
|
|
205
|
+
|
|
206
|
+
```CSS
|
|
207
|
+
.micl-card-filled {
|
|
208
|
+
--md-comp-filled-card-container-shape: 24px;
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
141
212
|
## Compatibility
|
|
142
213
|
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
214
|
|