material-inspired-component-library 8.0.4 → 8.1.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.
- package/.claude/settings.local.json +4 -1
- package/CLAUDE.md +53 -0
- package/README.md +4 -0
- package/components/alert/index.scss +2 -2
- package/components/appbar/index.scss +2 -2
- package/components/bottomsheet/index.scss +3 -3
- package/components/button/README.md +68 -10
- package/components/button/index.scss +99 -179
- package/components/button/index.ts +4 -4
- package/components/card/index.scss +3 -3
- package/components/checkbox/index.scss +2 -2
- package/components/datepicker/index.scss +3 -3
- package/components/dialog/index.scss +3 -3
- package/components/iconbutton/README.md +55 -9
- package/components/iconbutton/index.scss +109 -167
- package/components/iconbutton/index.ts +4 -4
- package/components/list/index.scss +8 -8
- package/components/menu/index.scss +3 -3
- package/components/navigationrail/README.md +2 -1
- package/components/navigationrail/index.scss +4 -4
- package/components/radio/index.scss +2 -2
- package/components/select/index.scss +2 -2
- package/components/shapes/README.md +94 -0
- package/components/{shape → shapes}/_paths.generated.scss +0 -6
- package/components/{shape → shapes}/index.scss +10 -10
- package/components/{shape → shapes}/master.scss +3 -3
- package/components/sidesheet/index.scss +3 -3
- package/components/slider/index.scss +5 -5
- package/components/snackbar/index.scss +2 -2
- package/components/switch/index.scss +2 -2
- package/components/textfield/index.scss +2 -2
- package/components/timepicker/index.scss +3 -3
- package/dist/bottomsheet.js +1 -1
- package/dist/button.css +1 -1
- package/dist/button.js +1 -1
- package/dist/card.css +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/components/button/index.d.ts +1 -1
- package/dist/components/iconbutton/index.d.ts +1 -1
- package/dist/datepicker.js +1 -1
- package/dist/iconbutton.css +1 -1
- package/dist/iconbutton.js +1 -1
- package/dist/list.css +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.js +1 -1
- package/dist/micl.css +1 -1
- package/dist/micl.js +1 -1
- package/dist/navigationrail.css +1 -1
- package/dist/navigationrail.js +1 -1
- package/dist/progressindicator.js +1 -1
- package/dist/shapes.css +1 -0
- package/dist/slider.js +1 -1
- package/dist/snackbar.js +1 -1
- package/dist/stepper.js +1 -1
- package/dist/textfield.js +1 -1
- package/dist/timepicker.js +1 -1
- package/docs/button.html +18 -17
- package/docs/iconbutton.html +12 -10
- package/docs/index.html +104 -89
- package/docs/menu.html +1 -1
- package/docs/micl.css +1 -1
- package/docs/micl.js +1 -1
- package/docs/shapes.css +1 -0
- package/docs/shapes.html +49 -40
- package/foundations/layout/index.scss +2 -2
- package/package.json +2 -1
- package/styles/elevation.scss +10 -7
- package/styles/motion.scss +12 -19
- package/styles/{shapes.scss → shape.scss} +6 -4
- package/styles/statelayer.scss +32 -45
- package/styles/typography.scss +4 -5
- package/styles.scss +1 -4
- package/tools/shapes/check.mjs +1 -1
- package/tools/shapes/generate.mjs +2 -8
- package/webpack.config.js +60 -5
- package/components/shape/README.md +0 -103
- package/dist/shape.css +0 -1
- package/docs/shape.css +0 -1
- /package/dist/{shape.js → shapes.js} +0 -0
- /package/docs/{shape.js → shapes.js} +0 -0
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
"WebFetch(domain:android.googlesource.com)",
|
|
9
9
|
"WebFetch(domain:m3.material.io)",
|
|
10
10
|
"WebFetch(domain:github.com)",
|
|
11
|
-
"Bash(xargs grep -l \"body\\\\|html\")"
|
|
11
|
+
"Bash(xargs grep -l \"body\\\\|html\")",
|
|
12
|
+
"WebFetch(domain:androidx.tech)",
|
|
13
|
+
"WebFetch(domain:cs.android.com)",
|
|
14
|
+
"WebFetch(domain:api.github.com)"
|
|
12
15
|
]
|
|
13
16
|
}
|
|
14
17
|
}
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
MICL is a Material Design 3 (M3 Expressive) UI component library written in Sass and TypeScript.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm run build # Compiles TypeScript + Sass via webpack, outputs to /dist/ and /docs/
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
There is no test suite, linter script, or dev server configured.
|
|
16
|
+
|
|
17
|
+
## Architecture
|
|
18
|
+
|
|
19
|
+
### Entry Points
|
|
20
|
+
|
|
21
|
+
- **`micl.ts`** — Main orchestrator. Initializes components lazily via a `MutationObserver` that watches for DOM insertions/removals. Handles event delegation for `input`, `change`, and `keydown` events, applies the ripple effect, and sets scrollbar CSS custom properties.
|
|
22
|
+
- **`styles.scss`** — Master stylesheet that imports all component and foundation Sass partials.
|
|
23
|
+
|
|
24
|
+
### Component Structure
|
|
25
|
+
|
|
26
|
+
Each component lives in `components/<name>/` and exports:
|
|
27
|
+
- A CSS selector string (e.g., `buttonSelector = 'button.micl-button--toggle'`)
|
|
28
|
+
- A handler object with `initialize(element)` / `cleanup(element)` methods and optional event handlers (`input`, `change`, `keydown`, `command`)
|
|
29
|
+
|
|
30
|
+
`micl.ts` imports every component handler, maps selectors to handlers, and drives the lifecycle using the MutationObserver + event delegation pattern.
|
|
31
|
+
|
|
32
|
+
### Styling System
|
|
33
|
+
|
|
34
|
+
- Sass uses `@use` (not `@import`); partials are namespaced.
|
|
35
|
+
- Theming is done entirely via CSS custom properties with `--md-comp-*` prefixes.
|
|
36
|
+
- `themes/` contains 11 colour themes, each with light, dark, and high-contrast variants.
|
|
37
|
+
- `styles/` contains Material Design tokens: typography, shapes, elevation, motion, state layers.
|
|
38
|
+
- `foundations/` contains the responsive layout system (breakpoints: compact ≤599 px, medium 600–839 px, expanded 840–1199 px, large 1200–1599 px, extra-large ≥1600 px).
|
|
39
|
+
|
|
40
|
+
### Coding
|
|
41
|
+
|
|
42
|
+
- The amount of TypeScript code should be minimized. Necessary functionality should be solved using SCSS only.
|
|
43
|
+
– The SCSS code can be verbose, but the compiled CSS code must be as small as possible.
|
|
44
|
+
|
|
45
|
+
### Documentation
|
|
46
|
+
|
|
47
|
+
- Component documentation is stored with the SCSS and JavaScript files. Always check if the documentation is up to date with regards to the implementation.
|
|
48
|
+
|
|
49
|
+
### Build
|
|
50
|
+
|
|
51
|
+
`webpack.config.js` produces two identical outputs: one to `/dist/` (npm distribution) and one to `/docs/` (live demo). TypeScript target is ES2022 with strict mode and declaration-file generation enabled.
|
|
52
|
+
|
|
53
|
+
The library compiles to a UMD bundle (`dist/micl.js`) and a CSS file (`dist/micl.css`) with zero runtime dependencies. In addition, a CSS and JavaScript pair of compiled files is created, so that a consumer may load only a subset of components.
|
package/README.md
CHANGED
|
@@ -114,6 +114,7 @@ The library currently consists of the following components:
|
|
|
114
114
|
- [x] [Navigation rail](components/navigationrail/README.md)
|
|
115
115
|
- [x] [Radio button](components/radio/README.md)
|
|
116
116
|
- [x] [Select](components/select/README.md)
|
|
117
|
+
- [x] [Shapes](components/shapes/README.md)
|
|
117
118
|
- [x] [Side sheet](components/sidesheet/README.md)
|
|
118
119
|
- [x] [Slider](components/slider/README.md)
|
|
119
120
|
- [x] [Snackbar](components/snackbar/README.md)
|
|
@@ -124,6 +125,9 @@ The library currently consists of the following components:
|
|
|
124
125
|
|
|
125
126
|
## Change Log ↪️
|
|
126
127
|
|
|
128
|
+
### 8.1.0 (24.06.2026)
|
|
129
|
+
- **Shapes**: The Material shape library supported as the 'Shapes' component.
|
|
130
|
+
|
|
127
131
|
### 8.0.0 (05.05.2026)
|
|
128
132
|
- **BREAKING**: Renamed many CSS custom properties from --md-sys- to --md-comp-.
|
|
129
133
|
- **List, Menu, Accordion, Select**: Aligned with latest MD3 spec.
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
// SOFTWARE.
|
|
21
21
|
|
|
22
22
|
@use '../../foundations';
|
|
23
|
-
@use '../../styles/
|
|
23
|
+
@use '../../styles/shape';
|
|
24
24
|
@use '../../styles/typography';
|
|
25
25
|
|
|
26
|
-
@include
|
|
26
|
+
@include shape.corner('small');
|
|
27
27
|
|
|
28
28
|
@include typography.scale('title-medium');
|
|
29
29
|
@include typography.scale('body-medium');
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
@use '../../foundations';
|
|
23
23
|
@use '../../foundations/layout';
|
|
24
24
|
@use '../../styles/elevation';
|
|
25
|
-
@use '../../styles/
|
|
25
|
+
@use '../../styles/shape';
|
|
26
26
|
@use '../../styles/statelayer';
|
|
27
27
|
@use '../../styles/typography';
|
|
28
28
|
|
|
29
29
|
@include elevation.level(0);
|
|
30
30
|
@include elevation.level(2);
|
|
31
31
|
|
|
32
|
-
@include
|
|
32
|
+
@include shape.corner('none');
|
|
33
33
|
|
|
34
34
|
@include typography.scale('display-small');
|
|
35
35
|
@include typography.scale('headline-medium');
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
@use '../../foundations';
|
|
23
23
|
@use '../../styles/elevation';
|
|
24
24
|
@use '../../styles/motion';
|
|
25
|
-
@use '../../styles/
|
|
25
|
+
@use '../../styles/shape';
|
|
26
26
|
@use '../../styles/statelayer';
|
|
27
27
|
|
|
28
28
|
@include elevation.level(1);
|
|
29
29
|
|
|
30
|
-
@include
|
|
31
|
-
@include
|
|
30
|
+
@include shape.corner('extra-large');
|
|
31
|
+
@include shape.corner('small');
|
|
32
32
|
|
|
33
33
|
@include statelayer.token('focus-indicator-thickness');
|
|
34
34
|
@include statelayer.token('focus-indicator-outer-offset');
|
|
@@ -23,7 +23,7 @@ Or import all MICL styles:
|
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### JavaScript
|
|
26
|
-
This component requires JavaScript
|
|
26
|
+
This component requires JavaScript to support the **toggle logic**:
|
|
27
27
|
|
|
28
28
|
```JavaScript
|
|
29
29
|
import micl from "material-inspired-component-library/dist/micl";
|
|
@@ -40,7 +40,7 @@ Buttons come in **five sizes**: extra small (`xs`), small (`s`), medium (`m`), l
|
|
|
40
40
|
**Example: An extra-large text button**
|
|
41
41
|
|
|
42
42
|
```HTML
|
|
43
|
-
<button type="button" class="micl-button-text-xl>Save</button>
|
|
43
|
+
<button type="button" class="micl-button-text-xl">Save</button>
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
Material Design provides **five distinct styles**: `text`, `elevated`, `filled`, `tonal` and `outlined`. To use a style other than the `text` style used above, apply the corresponding class to the button:
|
|
@@ -56,9 +56,9 @@ By default, buttons have a **rounded shape**. For a more square-like appearance,
|
|
|
56
56
|
Adding the `disabled` boolean attribute to the button causes the button to be displayed in a disabled state.
|
|
57
57
|
|
|
58
58
|
### Toggle Button
|
|
59
|
-
A toggle button has two states: **on** (
|
|
60
|
-
- **Off state**: The button has the `micl-button--toggle` class
|
|
61
|
-
- **On state**: The button has
|
|
59
|
+
A toggle button has two states: **on** (pressed) and **off** (unpressed). To create one, add the `micl-button--toggle` class and an `aria-pressed` attribute.
|
|
60
|
+
- **Off state**: The button has the `micl-button--toggle` class and `aria-pressed="false"`.
|
|
61
|
+
- **On state**: The button has the `micl-button--toggle` class and `aria-pressed="true"`.
|
|
62
62
|
|
|
63
63
|
**Example: A selected toggle button**
|
|
64
64
|
|
|
@@ -66,13 +66,14 @@ A toggle button has two states: **on** (selected) and **off** (unselected). To c
|
|
|
66
66
|
<button
|
|
67
67
|
type="button"
|
|
68
68
|
id="id0"
|
|
69
|
-
class="micl-button-tonal-s micl-button--toggle
|
|
69
|
+
class="micl-button-tonal-s micl-button--toggle"
|
|
70
|
+
aria-pressed="true"
|
|
70
71
|
commandfor="id0"
|
|
71
72
|
command="--micl-toggle"
|
|
72
73
|
>Selected</button>
|
|
73
74
|
```
|
|
74
75
|
|
|
75
|
-
The self-targeting `command` property (`--micl-toggle`)
|
|
76
|
+
The self-targeting `command` property (`--micl-toggle`) flips `aria-pressed` whenever the user interacts with the button.
|
|
76
77
|
|
|
77
78
|
## Icons
|
|
78
79
|
To add a leading icon to a button, include an element with the `micl-button__icon` class inside the `<button>`:
|
|
@@ -84,14 +85,14 @@ To add a leading icon to a button, include an element with the `micl-button__ico
|
|
|
84
85
|
</button>
|
|
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 **
|
|
88
|
+
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 **off** icon) and `data-micliconselected` (the name of the **on** icon) attributes:
|
|
88
89
|
|
|
89
90
|
```HTML
|
|
90
91
|
...
|
|
91
92
|
<span
|
|
92
93
|
class="micl-button__icon material-symbols-outlined"
|
|
93
|
-
data-miclicon="
|
|
94
|
-
data-micliconselected="
|
|
94
|
+
data-miclicon="icon_for_off"
|
|
95
|
+
data-micliconselected="icon_for_on"
|
|
95
96
|
aria-hidden="true"
|
|
96
97
|
><span>
|
|
97
98
|
...
|
|
@@ -114,5 +115,62 @@ You can also use other icon libraries. For example, with the [Bootstrap Icons li
|
|
|
114
115
|
</button>
|
|
115
116
|
```
|
|
116
117
|
|
|
118
|
+
## Theming
|
|
119
|
+
Each button style can be themed with CSS custom properties that follow the Material Design 3 component-token naming convention. Note that the `selected-*` and `unselected-*` properties only apply to [toggle buttons](#toggle-button).
|
|
120
|
+
|
|
121
|
+
### Text
|
|
122
|
+
| Custom property | Meaning | Default |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| `--md-comp-text-button-label-text-color` | Label & icon colour | `--md-sys-color-primary` |
|
|
125
|
+
| `--md-comp-text-button-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` |
|
|
126
|
+
| `--md-comp-text-button-disabled-label-text-opacity` | Label & icon opacity when disabled | `38%` |
|
|
127
|
+
|
|
128
|
+
### Elevated
|
|
129
|
+
| Custom property | Meaning | Default |
|
|
130
|
+
|---|---|---|
|
|
131
|
+
| `--md-comp-elevated-button-container-color` | Container background | `--md-sys-color-surface-container-low` |
|
|
132
|
+
| `--md-comp-elevated-button-container-elevation` | Container elevation (shadow) | `--md-sys-elevation-level1` |
|
|
133
|
+
| `--md-comp-elevated-button-label-text-color` | Label & icon colour | `--md-sys-color-primary` |
|
|
134
|
+
| `--md-comp-elevated-button-selected-container-color` | Container background when selected | `--md-sys-color-primary` |
|
|
135
|
+
| `--md-comp-elevated-button-selected-label-text-color` | Label & icon colour when selected | `--md-sys-color-on-primary` |
|
|
136
|
+
| `--md-comp-elevated-button-disabled-container-color` | Container background when disabled | `--md-sys-color-on-surface` |
|
|
137
|
+
| `--md-comp-elevated-button-disabled-container-opacity` | Container opacity when disabled | `10%` |
|
|
138
|
+
| `--md-comp-elevated-button-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` |
|
|
139
|
+
| `--md-comp-elevated-button-disabled-label-text-opacity` | Label & icon opacity when disabled | `38%` |
|
|
140
|
+
|
|
141
|
+
### Filled
|
|
142
|
+
| Custom property | Meaning | Default |
|
|
143
|
+
|---|---|---|
|
|
144
|
+
| `--md-comp-filled-button-container-color` | Container background (also the selected state) | `--md-sys-color-primary` |
|
|
145
|
+
| `--md-comp-filled-button-label-text-color` | Label & icon colour (also the selected state) | `--md-sys-color-on-primary` |
|
|
146
|
+
| `--md-comp-filled-button-unselected-container-color` | Container background when an unselected toggle | `--md-sys-color-surface-container` |
|
|
147
|
+
| `--md-comp-filled-button-unselected-label-text-color` | Label & icon colour when an unselected toggle | `--md-sys-color-on-surface-variant` |
|
|
148
|
+
| `--md-comp-filled-button-disabled-container-color` | Container background when disabled | `--md-sys-color-on-surface` |
|
|
149
|
+
| `--md-comp-filled-button-disabled-container-opacity` | Container opacity when disabled | `10%` |
|
|
150
|
+
| `--md-comp-filled-button-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` |
|
|
151
|
+
| `--md-comp-filled-button-disabled-label-text-opacity` | Label & icon opacity when disabled | `38%` |
|
|
152
|
+
|
|
153
|
+
### Tonal
|
|
154
|
+
| Custom property | Meaning | Default |
|
|
155
|
+
|---|---|---|
|
|
156
|
+
| `--md-comp-filled-tonal-button-container-color` | Container background | `--md-sys-color-secondary-container` |
|
|
157
|
+
| `--md-comp-filled-tonal-button-label-text-color` | Label & icon colour | `--md-sys-color-on-secondary-container` |
|
|
158
|
+
| `--md-comp-filled-tonal-button-selected-container-color` | Container background when selected | `--md-sys-color-secondary` |
|
|
159
|
+
| `--md-comp-filled-tonal-button-selected-label-text-color` | Label & icon colour when selected | `--md-sys-color-on-secondary` |
|
|
160
|
+
| `--md-comp-filled-tonal-button-disabled-container-color` | Container background when disabled | `--md-sys-color-on-surface` |
|
|
161
|
+
| `--md-comp-filled-tonal-button-disabled-container-opacity` | Container opacity when disabled | `10%` |
|
|
162
|
+
| `--md-comp-filled-tonal-button-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` |
|
|
163
|
+
| `--md-comp-filled-tonal-button-disabled-label-text-opacity` | Label & icon opacity when disabled | `38%` |
|
|
164
|
+
|
|
165
|
+
### Outlined
|
|
166
|
+
| Custom property | Meaning | Default |
|
|
167
|
+
|---|---|---|
|
|
168
|
+
| `--md-comp-outlined-button-outline-color` | Outline (border) colour | `--md-sys-color-outline-variant` |
|
|
169
|
+
| `--md-comp-outlined-button-label-text-color` | Label & icon colour | `--md-sys-color-on-surface-variant` |
|
|
170
|
+
| `--md-comp-outlined-button-selected-container-color` | Container background when selected | `--md-sys-color-inverse-surface` |
|
|
171
|
+
| `--md-comp-outlined-button-selected-label-text-color` | Label & icon colour when selected | `--md-sys-color-inverse-on-surface` |
|
|
172
|
+
| `--md-comp-outlined-button-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` |
|
|
173
|
+
| `--md-comp-outlined-button-disabled-label-text-opacity` | Label & icon opacity when disabled | `38%` |
|
|
174
|
+
|
|
117
175
|
## Compatibility
|
|
118
176
|
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.
|