material-inspired-component-library 3.0.2 → 3.1.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 CHANGED
@@ -84,6 +84,7 @@ A separate CSS file, based on the [Material Design Layout Foundation](https://m3
84
84
  ## Available components ✅
85
85
  The library currently consists of the following components:
86
86
  - [x] [Accordion](components/accordion/README.md)
87
+ - [ ] [Alert](README.md)
87
88
  - [x] [App Bar](components/appbar/README.md)
88
89
  - [x] [Badge](components/badge/README.md)
89
90
  - [x] [Bottom sheet](components/bottomsheet/README.md)
@@ -100,39 +101,33 @@ The library currently consists of the following components:
100
101
  - [x] [Select](components/select/README.md)
101
102
  - [x] [Side sheet](components/sidesheet/README.md)
102
103
  - [x] [Slider](components/slider/README.md)
104
+ - [ ] [Stepper](README.md)
103
105
  - [x] [Switch](components/switch/README.md)
104
106
  - [x] [Text field](components/textfield/README.md)
105
107
 
106
108
  ## Change Log ↪️
107
109
 
108
- ### 3.0.0 (24.09.2025)
109
- **Features**
110
+ ### 3.1.0 (19.10.2025)
111
+ - **Checkbox**: Refactoring + add support for checkbox groups.
110
112
 
113
+ ### 3.0.0 (24.09.2025)
114
+ - **BREAKING:** Use `<nav>` instead of `<div>` for Navigation rail.
111
115
  - **App Bar**: New component.
112
116
  - **Layout**: Support for adaptive layout.
113
- - Improved handling of target area for small buttons.
114
- - **BREAKING:** Use `<nav>` instead of `<div>` for Navigation rail.
117
+ - **Buttons**: Improved handling of target area for small buttons.
115
118
 
116
119
  ### 2.0.0 (04.09.2025)
117
- **Features**
118
-
119
120
  - **Navigation rail**: New component.
120
121
  - **Badge**: New component.
121
122
  - **Ripple**: Now uses custom CSS properties.
122
123
 
123
124
  ### 1.3.0 (23.08.2025)
124
- **Features**
125
-
126
125
  - **Menu**: Added support for submenus.
127
126
  - **Ripple**: The ripple-effect does not use a pseudo-element anymore.
128
127
  - **State layer**: Rewrite for simpler styling.
129
128
 
130
129
  ### 1.2.0 (17.08.2025)
131
- **Features**
132
-
133
130
  - **List**: Added support for switches inside list items.
134
131
 
135
132
  ### 1.1.0 (12.08.2025)
136
- **Features**
137
-
138
133
  - **Text field**: Added support for multi-line text fields.
@@ -0,0 +1,120 @@
1
+ //
2
+ // Copyright © 2025 Hermana AS
3
+ //
4
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ // of this software and associated documentation files (the "Software"), to deal
6
+ // in the Software without restriction, including without limitation the rights
7
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ // copies of the Software, and to permit persons to whom the Software is
9
+ // furnished to do so, subject to the following conditions:
10
+ //
11
+ // The above copyright notice and this permission notice shall be included in all
12
+ // copies or substantial portions of the Software.
13
+ //
14
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ // SOFTWARE.
21
+
22
+ @use '../../styles/shapes';
23
+ @use '../../styles/typography';
24
+
25
+ :root {
26
+ --md-sys-alert-padding: 16px;
27
+ --md-sys-alert-space: 16px;
28
+ }
29
+
30
+ .micl-alert-filled,
31
+ .micl-alert-tonal,
32
+ .micl-alert-outlined {
33
+ --md-sys-alert-background-color: inherit;
34
+ --md-sys-alert-color: inherit;
35
+
36
+ box-sizing: border-box;
37
+ display: flex;
38
+ inline-size: 100%;
39
+ padding: var(--md-sys-alert-padding, 16px);
40
+ column-gap: var(--md-sys-alert-space, 8px);
41
+ border: none;
42
+ outline: none;
43
+ border-radius: var(--md-sys-shape-corner-small, 8px);
44
+ background-color: var(--md-sys-alert-background-color);
45
+ color: var(--md-sys-alert-color);
46
+
47
+ .micl-alert__icon {
48
+ block-size: var(--md-sys-layout-icon-size, 24px);
49
+ inline-size: var(--md-sys-layout-icon-size, 24px);
50
+ font-size: var(--md-sys-layout-icon-size, 24px);
51
+ }
52
+ .micl-alert__text {
53
+ display: flex;
54
+ flex-direction: column;
55
+ row-gap: 8px;
56
+
57
+ h1, h2, h3, h4, h5, h6, .micl-heading {
58
+ @include typography.title-medium;
59
+
60
+ margin: 0;
61
+ }
62
+ .micl-alert__supporting-text {
63
+ @include typography.body-medium;
64
+
65
+ margin: 0;
66
+ }
67
+ }
68
+ }
69
+
70
+ .micl-alert-filled {
71
+ --md-sys-alert-background-color: var(--md-sys-color-error);
72
+ --md-sys-alert-color: var(--md-sys-color-on-error);
73
+
74
+ &.micl-alert--primary {
75
+ --md-sys-alert-background-color: var(--md-sys-color-primary);
76
+ --md-sys-alert-color: var(--md-sys-color-on-primary);
77
+ }
78
+ &.micl-alert--secondary {
79
+ --md-sys-alert-background-color: var(--md-sys-color-secondary);
80
+ --md-sys-alert-color: var(--md-sys-color-on-secondary);
81
+ }
82
+ &.micl-alert--tertiary {
83
+ --md-sys-alert-background-color: var(--md-sys-color-tertiary);
84
+ --md-sys-alert-color: var(--md-sys-color-on-tertiary);
85
+ }
86
+ }
87
+
88
+ .micl-alert-tonal {
89
+ --md-sys-alert-background-color: var(--md-sys-color-error-container);
90
+ --md-sys-alert-color: var(--md-sys-color-on-error-container);
91
+
92
+ &.micl-alert--primary {
93
+ --md-sys-alert-background-color: var(--md-sys-color-primary-container);
94
+ --md-sys-alert-color: var(--md-sys-color-on-primary-container);
95
+ }
96
+ &.micl-alert--secondary {
97
+ --md-sys-alert-background-color: var(--md-sys-color-secondary-container);
98
+ --md-sys-alert-color: var(--md-sys-color-on-secondary-container);
99
+ }
100
+ &.micl-alert--tertiary {
101
+ --md-sys-alert-background-color: var(--md-sys-color-tertiary-container);
102
+ --md-sys-alert-color: var(--md-sys-color-on-tertiary-container);
103
+ }
104
+ }
105
+
106
+ .micl-alert-outlined {
107
+ --md-sys-alert-color: var(--md-sys-color-error);
108
+
109
+ border: 1px solid var(--md-sys-alert-color);
110
+
111
+ &.micl-alert--primary {
112
+ --md-sys-alert-color: var(--md-sys-color-primary);
113
+ }
114
+ &.micl-alert--secondary {
115
+ --md-sys-alert-color: var(--md-sys-color-secondary);
116
+ }
117
+ &.micl-alert--tertiary {
118
+ --md-sys-alert-color: var(--md-sys-color-tertiary);
119
+ }
120
+ }
@@ -1,5 +1,5 @@
1
1
  # Checkbox
2
- This component implements the the [Material Design 3 Expressive Checkbox](https://m3.material.io/components/checkbox/overview) design.
2
+ This component implements the the [Material Design 3 Expressive Checkbox](https://m3.material.io/components/checkbox/overview) design. A checkbox allows a user to select one or more options from a number of choices.
3
3
 
4
4
  ## Basic Usage
5
5
 
@@ -7,7 +7,7 @@ This component implements the the [Material Design 3 Expressive Checkbox](https:
7
7
  To add a basic checkbox, use the `<input type="checkbox">` element with the `micl-checkbox` class, paired with a `<label>` element:
8
8
 
9
9
  ```HTML
10
- <input type="checkbox" id="mycheckbox" class="micl-checkbox" value="foo">
10
+ <input type="checkbox" id="mycheckbox" class="micl-checkbox">
11
11
  <label for="mycheckbox">Bar</label>
12
12
  ```
13
13
 
@@ -19,13 +19,11 @@ Import the checkbox styles into your project:
19
19
  ```
20
20
 
21
21
  ### JavaScript
22
- This component requires JavaScript to support checking and unchecking using a keyboard:
22
+ This component requires JavaScript to support checkbox groups:
23
23
 
24
- ```JavaScript
25
- import micl from "material-inspired-component-library/dist/micl";
26
- ```
24
+ `import micl from "material-inspired-component-library/dist/micl";`
27
25
 
28
- This will initialize any Checkbox component, including those that will be added to the DOM later on.
26
+ This will initialize any checkbox group, including those that will be added to the DOM later on.
29
27
 
30
28
  ### Demo
31
29
  A live example of the [Checkbox component](https://henkpb.github.io/micl/checkbox.html) is available for you to interact with.
@@ -37,20 +35,60 @@ A checkbox can be disabled by adding the `disabled` attribute to the `<input>` e
37
35
 
38
36
  The Checkbox component respects the `dir` global attribute, automatically adjusting its layout for right-to-left (RTL) languages when `dir="rtl"` is applied to an ancestor element.
39
37
 
38
+ The component applies `cursor: pointer` and the color role **on surface** to the `<label>` element immediately preceding or following an `<input type="checkbox">` with the `micl-checkbox` class. You are encouraged to customize these CSS settings to match your design system.
39
+
40
+ ## Checkbox group
41
+ You can establish a parent-child relationship among checkboxes. To do this, wrap the entire set of related checkboxes in an element using the `micl-checkbox-group` class. The designated parent checkbox must also include the `micl-checkbox__parent` class.
42
+
43
+ ```HTML
44
+ <div class="micl-checkbox-group">
45
+ <input type="checkbox" id="cb0" class="micl-checkbox micl-checkbox__parent" value="c0">
46
+ <label for="cb0">Choices</label>
47
+ <input type="checkbox" id="cb1" class="micl-checkbox" value="c1">
48
+ <label for="cb1">First Choice</label>
49
+ <input type="checkbox" id="cb2" class="micl-checkbox" checked value="c2">
50
+ <label for="cb2">Second Choice</label>
51
+ ...
52
+ </div>
53
+ ```
54
+
55
+ To visually improve the layout, such as by indenting child checkboxes, use wrapper elements and utility classes:
56
+
57
+ ```HTML
58
+ <div class="micl-checkbox-group">
59
+ <div class="micl-flex--vcenter">
60
+ <input type="checkbox" id="cb0" class="micl-checkbox micl-checkbox__parent" value="c0">
61
+ <label for="cb0">Choices</label>
62
+ </div>
63
+ <div style="padding-inline-start:16px">
64
+ <div class="micl-flex--vcenter">
65
+ <input type="checkbox" id="cb1" class="micl-checkbox" value="c1">
66
+ <label for="cb1">First Choice</label>
67
+ </div>
68
+ <div class="micl-flex--vcenter">
69
+ <input type="checkbox" id="cb2" class="micl-checkbox" checked value="c2">
70
+ <label for="cb2">Second Choice</label>
71
+ </div>
72
+ ...
73
+ </div>
74
+ </div>
75
+ ```
76
+
77
+ Note that checkbox groups support **nesting**, allowing a `micl-checkbox-group` to contain other `micl-checkbox-group` elements for multi-level hierarchies.
78
+
40
79
  ## Customizations
41
80
  You can customize the appearance of the Checkbox 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 checkboxes.
42
81
 
43
82
  | Variable name | Default Value | Description |
44
83
  | ------------- | ------------- | ----------- |
45
84
  | --md-sys-checkbox-border-width | 2px | Controls the thickness of the checkbox's border |
85
+ | --md-sys-checkbox-check-thickness | 2px | The thickness of the checkmark |
46
86
  | --md-sys-checkbox-container-size | 18px | Defines the size of the checkbox itself |
47
- | --md-sys-checkbox-selected-icon | \2A3D | The character used as the checkmark for the checkbox |
48
- | --md-sys-checkbox-state-layer-radius | 20px | Sets the radius of the interactive area that indicates the component's current state (e.g., hover, focus, press) |
49
87
 
50
- **Example: Changing the size of the interactive area**
88
+ **Example: Changing the border width of a checkbox**
51
89
 
52
90
  ```HTML
53
- <div style="--md-sys-checkbox-state-layer-radius:24px">
91
+ <div style="--md-sys-checkbox-border-width:1px">
54
92
  <input type="checkbox" id="mycheckbox" class="micl-checkbox">
55
93
  <label for="mycheckbox">Checkbox</label>
56
94
  </div>
@@ -24,234 +24,194 @@
24
24
  @use '../../styles/typography';
25
25
 
26
26
  :root {
27
- --md-sys-checkbox-container-size: 18px;
28
27
  --md-sys-checkbox-border-width: 2px;
29
- --md-sys-checkbox-selected-icon: "\2A3D";
30
- --md-sys-checkbox-state-layer-radius: 20px;
31
- }
32
-
33
- @property --checkbox-outline-color {
34
- syntax: '<color>';
35
- initial-value: transparent;
36
- inherits: false;
37
- }
38
- @property --checkbox-state-layer-color {
39
- syntax: '<color>';
40
- initial-value: transparent;
41
- inherits: false;
42
- }
43
- @property --checkbox-container-color {
44
- syntax: '<color>';
45
- initial-value: transparent;
46
- inherits: false;
47
- }
48
- @property --checkbox-container-border-color {
49
- syntax: '<color>';
50
- initial-value: transparent;
51
- inherits: false;
28
+ --md-sys-checkbox-check-thickness: 2px;
29
+ --md-sys-checkbox-container-size: 18px;
30
+ --md-sys-checkbox-state-layer-size: 40px;
52
31
  }
53
32
 
54
33
  input[type=checkbox].micl-checkbox {
55
34
  --md-sys-checkbox-motion-duration: #{motion.$md-sys-motion-expressive-slow-effects-duration};
56
- --checkbox-container-color: transparent;
57
- --checkbox-container-border-color: var(--md-sys-color-on-surface-variant);
35
+ --md-sys-checkbox-motion-duration-reverse: #{motion.$md-sys-motion-expressive-default-effects-duration};
36
+ --md-sys-checkbox-motion-spatial: #{motion.$md-sys-motion-expressive-fast-spatial};
37
+
38
+ --statelayer-color: var(--md-sys-color-on-surface);
58
39
 
59
40
  appearance: none;
60
41
  box-sizing: border-box;
61
42
  position: relative;
62
- width: var(--md-sys-target-size);
63
- min-width: var(--md-sys-target-size);
64
- height: var(--md-sys-target-size);
65
- min-height: var(--md-sys-target-size);
43
+ inline-size: var(--md-sys-target-size);
44
+ min-inline-size: var(--md-sys-target-size);
45
+ block-size: var(--md-sys-target-size);
46
+ min-block-size: var(--md-sys-target-size);
66
47
  margin: 0;
67
- padding: calc((var(--md-sys-target-size) - var(--md-sys-checkbox-container-size)) / 2);
68
- border-radius: calc(var(--md-sys-checkbox-border-width) + ((var(--md-sys-target-size) - var(--md-sys-checkbox-container-size)) / 2));
69
- background-clip: border-box, border-box, content-box, content-box, content-box;
70
- background-image:
71
- radial-gradient(
72
- circle var(--md-sys-checkbox-state-layer-radius),
73
- transparent 0%,
74
- transparent calc(var(--md-sys-checkbox-state-layer-radius) - var(--md-sys-state-focus-indicator-thickness)),
75
- var(--checkbox-outline-color) calc(var(--md-sys-checkbox-state-layer-radius) - var(--md-sys-state-focus-indicator-thickness)),
76
- var(--checkbox-outline-color) 100%,
77
- transparent
78
- ),
79
- radial-gradient(
80
- circle calc(var(--md-sys-checkbox-state-layer-radius) - var(--md-sys-state-focus-indicator-thickness)),
81
- var(--checkbox-state-layer-color) 0%,
82
- var(--checkbox-state-layer-color) 100%,
83
- transparent
84
- ),
85
- linear-gradient(
86
- to right,
87
- var(--checkbox-container-color) 0%,
88
- var(--checkbox-container-color) 100%,
89
- transparent
90
- ),
91
- linear-gradient(
92
- to bottom,
93
- var(--checkbox-container-border-color) var(--md-sys-checkbox-border-width),
94
- transparent var(--md-sys-checkbox-border-width),
95
- transparent 16px,
96
- var(--checkbox-container-border-color) 0px,
97
- var(--checkbox-container-border-color) var(--md-sys-checkbox-container-size),
98
- transparent var(--md-sys-checkbox-container-size)
99
- ),
100
- linear-gradient(
101
- to right,
102
- var(--checkbox-container-border-color) var(--md-sys-checkbox-border-width),
103
- transparent var(--md-sys-checkbox-border-width),
104
- transparent 16px,
105
- var(--checkbox-container-border-color) 0px,
106
- var(--checkbox-container-border-color) var(--md-sys-checkbox-container-size),
107
- transparent var(--md-sys-checkbox-container-size)
108
- );
109
- background-origin: border-box;
110
- background-position: center, center, center, center, center;
111
- background-repeat: no-repeat;
112
- background-size:
113
- auto,
114
- auto,
115
- var(--md-sys-checkbox-container-size) var(--md-sys-checkbox-container-size),
116
- var(--md-sys-checkbox-container-size) var(--md-sys-checkbox-container-size),
117
- var(--md-sys-checkbox-container-size) var(--md-sys-checkbox-container-size),
118
- var(--md-sys-checkbox-container-size) var(--md-sys-checkbox-container-size);
119
- clip-path: circle(var(--md-sys-checkbox-state-layer-radius));
120
- transition:
121
- --checkbox-outline-color var(--md-sys-checkbox-motion-duration),
122
- --checkbox-state-layer-color var(--md-sys-checkbox-motion-duration),
123
- --checkbox-container-color var(--md-sys-checkbox-motion-duration) var(--md-sys-motion-duration-short4),
124
- --checkbox-container-border-color var(--md-sys-checkbox-motion-duration);
48
+ border: calc((var(--md-sys-target-size) - var(--md-sys-checkbox-state-layer-size)) / 2) solid transparent;
49
+ background-clip: content-box;
50
+ background-color: transparent;
51
+ border-radius: var(--md-sys-shape-corner-full);
52
+ outline-offset: -4px;
125
53
 
126
- &.micl-checkbox--error {
127
- --checkbox-container-border-color: var(--md-sys-color-error);
128
- }
129
- &::after {
130
- content: var(--md-sys-checkbox-selected-icon);
54
+ &::before {
55
+ --md-sys-checkbox-check-width: calc(var(--md-sys-checkbox-container-size) - 3px);
56
+ --md-sys-checkbox-check-height: calc(0.4667 * var(--md-sys-checkbox-check-width));
57
+
58
+ content: "";
131
59
  box-sizing: border-box;
132
60
  position: absolute;
133
- width: calc(var(--md-sys-checkbox-container-size) + 2px);
134
- height: 0;
61
+ inline-size: var(--md-sys-checkbox-check-width);
62
+ block-size: 0;
135
63
  inset: 0;
136
- inset-block-start: 15px;
137
- inset-inline-start: 8px;
138
- margin: 4px;
139
- font: 400 26px/2px var(--md-ref-typeface-plain);
140
- color: var(--md-sys-color-on-primary);
141
- text-align: center;
64
+ inset-block-start: calc(-0.25 * var(--md-sys-checkbox-container-size));
65
+ inset-inline-start: 1px;
66
+ margin: auto;
67
+ border-block-end: var(--md-sys-checkbox-check-thickness) var(--md-sys-color-on-primary) solid;
68
+ border-inline-start: var(--md-sys-checkbox-check-thickness) var(--md-sys-color-on-primary) solid;
142
69
  transform: rotate(-45deg);
143
- transform-origin: top;
144
- clip-path: rect(0px 4.5px 18px 0px);
145
- overflow: hidden;
70
+ transform-origin: center;
71
+ clip-path: rect(0 2px 0 0);
72
+ z-index: 1;
146
73
  transition:
74
+ block-size var(--md-sys-motion-duration-short3) var(--md-sys-motion-duration-short3) motion.$md-sys-motion-easing-standard-decelerate,
147
75
  clip-path var(--md-sys-motion-duration-short3) motion.$md-sys-motion-easing-standard-accelerate,
148
- height var(--md-sys-motion-duration-short3) var(--md-sys-motion-duration-short3) motion.$md-sys-motion-easing-standard-decelerate;
149
- }
150
- @supports (-moz-appearance:none) {
151
- &::after {
152
- inset-block-start: 16px;
153
- inset-inline-start: 7px;
154
- font: 400 27px/3px var(--md-ref-typeface-plain);
155
- }
76
+ inset-block-start 0ms linear var(--md-sys-motion-duration-short3),
77
+ inset-inline-start 0ms linear var(--md-sys-motion-duration-short3),
78
+ border-inline-start-width 0ms linear var(--md-sys-motion-duration-short3),
79
+ transform 0ms linear var(--md-sys-motion-duration-short3);
156
80
  }
157
- &:checked {
158
- --checkbox-container-color: var(--md-sys-color-primary);
159
- --checkbox-container-border-color: transparent;
81
+ &::after {
82
+ --md-sys-checkbox-background-color: transparent;
83
+ --md-sys-checkbox-border-color: var(--md-sys-color-on-surface-variant);
84
+
85
+ content: "";
86
+ box-sizing: border-box;
87
+ position: absolute;
88
+ inline-size: var(--md-sys-checkbox-container-size);
89
+ block-size: var(--md-sys-checkbox-container-size);
90
+ inset: 0;
91
+ margin: auto;
92
+ border: var(--md-sys-checkbox-border-width) solid var(--md-sys-checkbox-border-color);
93
+ border-radius: 2px;
94
+ background-color: var(--md-sys-checkbox-background-color);
160
95
  transition:
161
- --checkbox-container-color var(--md-sys-motion-duration-medium2),
162
- --checkbox-container-border-color var(--md-sys-motion-duration-medium2);
96
+ background-color var(--md-sys-checkbox-motion-duration-reverse) motion.$md-sys-motion-easing-emphasized var(--md-sys-checkbox-motion-duration-reverse),
97
+ border-color var(--md-sys-checkbox-motion-duration-reverse) motion.$md-sys-motion-easing-emphasized var(--md-sys-checkbox-motion-duration-reverse);
98
+ }
99
+ &:checked,
100
+ &:indeterminate {
101
+ --statelayer-color: var(--md-sys-color-primary);
163
102
 
164
- &.micl-checkbox--error {
165
- --checkbox-container-color: var(--md-sys-color-error);
103
+ &::before {
104
+ block-size: var(--md-sys-checkbox-check-height);
105
+ clip-path: rect(0 calc(var(--md-sys-checkbox-container-size) - 5px) 18px 0);
106
+ transition:
107
+ block-size var(--md-sys-motion-duration-short3) var(--md-sys-checkbox-motion-spatial),
108
+ clip-path var(--md-sys-motion-duration-long4) var(--md-sys-motion-duration-short3) var(--md-sys-checkbox-motion-spatial);
166
109
  }
167
110
  &::after {
168
- height: 8px;
169
- clip-path: rect(0px 16px 18px 0px);
111
+ --md-sys-checkbox-background-color: var(--md-sys-color-primary);
112
+ --md-sys-checkbox-border-color: var(--md-sys-color-primary);
113
+
170
114
  transition:
171
- height var(--md-sys-motion-duration-short3) motion.$md-sys-motion-easing-standard-accelerate,
172
- clip-path var(--md-sys-motion-duration-long4) var(--md-sys-motion-duration-short3) linear(motion.$md-sys-motion-spring-default-spatial);
115
+ background-color var(--md-sys-checkbox-motion-duration) linear,
116
+ border-color var(--md-sys-checkbox-motion-duration) motion.$md-sys-motion-easing-emphasized;
117
+ }
118
+ }
119
+ &:indeterminate::before {
120
+ inset-inline-start: 2px;
121
+ border-inline-start-width: 0px;
122
+ transform: rotate(0deg);
123
+ }
124
+ &.micl-checkbox--error:not(:disabled) {
125
+ --statelayer-color: var(--md-sys-color-error);
126
+
127
+ &::after {
128
+ --md-sys-checkbox-border-color: var(--md-sys-color-error);
129
+ }
130
+ &:checked,
131
+ &:indeterminate {
132
+ &:hover,
133
+ &:focus-visible,
134
+ &:active {
135
+ --statelayer-color: var(--md-sys-color-error);
136
+ }
137
+ &::before {
138
+ color: var(--md-sys-color-on-error);
139
+ }
140
+ &::after {
141
+ --md-sys-checkbox-background-color: var(--md-sys-color-error);
142
+ }
143
+ }
144
+ &:not(:checked):not(:indeterminate) {
145
+ &:hover,
146
+ &:focus-visible,
147
+ &:active {
148
+ --statelayer-color: var(--md-sys-color-error);
149
+
150
+ &::after {
151
+ --md-sys-checkbox-border-color: var(--md-sys-color-error);
152
+ }
153
+ }
173
154
  }
174
155
  }
175
156
  &:not(:disabled) {
176
157
  --micl-ripple: 1;
177
158
 
159
+ background-image:
160
+ radial-gradient(circle at var(--micl-x, center) var(--micl-y, center), transparent 0%, rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)) 10%, transparent 10%),
161
+ linear-gradient(rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)));
162
+ background-repeat: no-repeat;
163
+ background-size: 10000%, 100%;
178
164
  cursor: pointer;
165
+ transition:
166
+ background-size 3000ms,
167
+ --statelayer-opacity var(--md-sys-checkbox-motion-duration) linear;
179
168
 
180
169
  &:hover {
181
- &:checked {
182
- --checkbox-outline-color: rgb(from var(--md-sys-color-primary) r g b / var(--md-sys-state-hover-state-layer-opacity));
183
- --checkbox-state-layer-color: rgb(from var(--md-sys-color-primary) r g b / var(--md-sys-state-hover-state-layer-opacity));
170
+ --statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity);
184
171
 
185
- &.micl-checkbox--error {
186
- --checkbox-outline-color: rgb(from var(--md-sys-color-error) r g b / var(--md-sys-state-hover-state-layer-opacity));
187
- --checkbox-state-layer-color: rgb(from var(--md-sys-color-error) r g b / var(--md-sys-state-hover-state-layer-opacity));
188
- }
189
- }
190
- &:not(:checked) {
191
- --checkbox-container-border-color: var(--md-sys-color-on-surface);
192
- --checkbox-outline-color: rgb(from var(--md-sys-color-on-surface) r g b / var(--md-sys-state-hover-state-layer-opacity));
193
- --checkbox-state-layer-color: rgb(from var(--md-sys-color-on-surface) r g b / var(--md-sys-state-hover-state-layer-opacity));
194
-
195
- &.micl-checkbox--error {
196
- --checkbox-container-border-color: var(--md-sys-color-error);
197
- --checkbox-outline-color: rgb(from var(--md-sys-color-error) r g b / var(--md-sys-state-hover-state-layer-opacity));
198
- --checkbox-state-layer-color: rgb(from var(--md-sys-color-error) r g b / var(--md-sys-state-hover-state-layer-opacity));
199
- }
172
+ &:not(:checked):not(:indeterminate)::after {
173
+ --md-sys-checkbox-border-color: var(--md-sys-color-on-surface);
200
174
  }
201
175
  }
202
176
  &:focus-visible {
203
- --checkbox-outline-color: var(--md-sys-color-secondary);
177
+ --statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity);
204
178
 
205
- &:checked {
206
- --checkbox-state-layer-color: rgb(from var(--md-sys-color-primary) r g b / var(--md-sys-state-focus-state-layer-opacity));
179
+ outline: var(--md-sys-state-focus-indicator-thickness) solid var(--md-sys-color-secondary);
207
180
 
208
- &.micl-checkbox--error {
209
- --checkbox-state-layer-color: rgb(from var(--md-sys-color-error) r g b / var(--md-sys-state-focus-state-layer-opacity));
210
- }
211
- }
212
- &:not(:checked) {
213
- --checkbox-container-border-color: var(--md-sys-color-on-surface);
214
- --checkbox-state-layer-color: rgb(from var(--md-sys-color-on-surface) r g b / var(--md-sys-state-focus-state-layer-opacity));
215
-
216
- &.micl-checkbox--error {
217
- --checkbox-container-border-color: var(--md-sys-color-error);
218
- --checkbox-state-layer-color: rgb(from var(--md-sys-color-error) r g b / var(--md-sys-state-focus-state-layer-opacity));
219
- }
181
+ &:not(:checked):not(:indeterminate)::after {
182
+ --md-sys-checkbox-border-color: var(--md-sys-color-on-surface);
220
183
  }
221
184
  }
222
185
  &:active {
223
- &:checked {
224
- --checkbox-outline-color: rgb(from var(--md-sys-color-on-surface) r g b / var(--md-sys-state-pressed-state-layer-opacity));
225
- --checkbox-state-layer-color: rgb(from var(--md-sys-color-on-surface) r g b / var(--md-sys-state-pressed-state-layer-opacity));
186
+ --statelayer-color: var(--md-sys-color-on-surface);
187
+ --statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity);
226
188
 
227
- &.micl-checkbox--error {
228
- --checkbox-outline-color: rgb(from var(--md-sys-color-error) r g b / var(--md-sys-state-pressed-state-layer-opacity));
229
- --checkbox-state-layer-color: rgb(from var(--md-sys-color-error) r g b / var(--md-sys-state-pressed-state-layer-opacity));
230
- }
231
- }
232
- &:not(:checked) {
233
- --checkbox-container-border-color: var(--md-sys-color-on-surface);
234
- --checkbox-outline-color: rgb(from var(--md-sys-color-primary) r g b / var(--md-sys-state-pressed-state-layer-opacity));
235
- --checkbox-state-layer-color: rgb(from var(--md-sys-color-primary) r g b / var(--md-sys-state-pressed-state-layer-opacity));
189
+ background-size: 0%, 100%;
190
+ transition: background-size 0ms;
236
191
 
237
- &.micl-checkbox--error {
238
- --checkbox-container-border-color: var(--md-sys-color-error);
239
- --checkbox-outline-color: rgb(from var(--md-sys-color-error) r g b / var(--md-sys-state-pressed-state-layer-opacity));
240
- --checkbox-state-layer-color: rgb(from var(--md-sys-color-error) r g b / var(--md-sys-state-pressed-state-layer-opacity));
192
+ &:not(:checked):not(:indeterminate) {
193
+ --statelayer-color: var(--md-sys-color-primary);
194
+
195
+ &::after {
196
+ --md-sys-checkbox-border-color: var(--md-sys-color-on-surface);
241
197
  }
242
198
  }
243
199
  }
244
200
  }
245
201
  &:disabled {
246
- --checkbox-container-border-color: var(--md-sys-color-on-surface);
247
202
  opacity: 38%;
248
203
 
249
- &:checked {
250
- --checkbox-container-color: var(--md-sys-color-on-surface);
251
-
252
- &::after {
204
+ &:checked,
205
+ &:indeterminate {
206
+ &::before {
253
207
  color: var(--md-sys-color-surface);
254
208
  }
209
+ &::after {
210
+ --md-sys-checkbox-background-color: var(--md-sys-color-on-surface);
211
+ }
212
+ }
213
+ &::after {
214
+ --md-sys-checkbox-border-color: var(--md-sys-color-on-surface);
255
215
  }
256
216
  }
257
217
  }
@@ -266,12 +226,15 @@ label:has(+ input[type=checkbox].micl-checkbox) {
266
226
  }
267
227
 
268
228
  [dir=rtl] input[type=checkbox].micl-checkbox {
269
- &::after {
270
- inset-inline-start: 9px;
229
+ &::before {
230
+ clip-path: rect(0 18px 8px 16px);
231
+ }
232
+ &:checked::before {
233
+ clip-path: rect(0 18px 8px 2px);
271
234
  transform: rotate(45deg);
272
- clip-path: rect(0px 18px 7.5px 16px);
273
235
  }
274
- &:checked::after {
275
- clip-path: rect(0px 18px 8px 6px);
236
+ &:indeterminate::before {
237
+ clip-path: rect(0 18px 8px 2px);
238
+ transform: rotate(0deg);
276
239
  }
277
240
  }