material-inspired-component-library 3.0.2 → 4.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 +16 -14
- package/components/README.md +1 -1
- package/components/accordion/README.md +8 -3
- package/components/alert/README.md +76 -0
- package/components/alert/index.scss +121 -0
- package/components/appbar/README.md +9 -4
- package/components/appbar/index.scss +1 -1
- package/components/badge/README.md +8 -3
- package/components/badge/index.scss +1 -0
- package/components/bottomsheet/README.md +8 -3
- package/components/button/README.md +8 -3
- package/components/button/index.scss +7 -0
- package/components/card/README.md +10 -4
- package/components/card/index.scss +1 -1
- package/components/checkbox/README.md +56 -13
- package/components/checkbox/index.scss +148 -183
- package/components/checkbox/index.ts +148 -0
- package/components/dialog/README.md +8 -3
- package/components/dialog/index.scss +1 -0
- package/components/divider/README.md +8 -3
- package/components/iconbutton/README.md +8 -3
- package/components/iconbutton/index.scss +3 -1
- package/components/list/README.md +8 -3
- package/components/list/index.scss +2 -0
- package/components/list/index.ts +2 -3
- package/components/menu/README.md +7 -2
- package/components/menu/index.ts +2 -2
- package/components/navigationrail/README.md +8 -3
- package/components/navigationrail/index.scss +1 -0
- package/components/radio/README.md +8 -3
- package/components/radio/index.scss +8 -24
- package/components/select/README.md +3 -3
- package/components/sidesheet/README.md +8 -3
- package/components/slider/README.md +8 -3
- package/components/slider/index.scss +1 -0
- package/components/slider/index.ts +9 -10
- package/components/stepper/README.md +190 -0
- package/components/stepper/index.scss +93 -14
- package/components/stepper/index.ts +169 -88
- package/components/switch/README.md +8 -3
- package/components/switch/index.scss +2 -0
- package/components/textfield/README.md +8 -3
- package/components/textfield/index.ts +8 -41
- package/dist/alert.css +1 -0
- package/dist/alert.js +1 -0
- package/dist/badge.css +1 -1
- package/dist/button.css +1 -1
- package/dist/card.css +1 -1
- package/dist/checkbox.css +1 -1
- package/dist/components/checkbox/index.d.ts +5 -0
- package/dist/components/textfield/index.d.ts +0 -1
- package/dist/dialog.css +1 -1
- package/dist/foundations/form/index.d.ts +5 -0
- package/dist/iconbutton.css +1 -1
- package/dist/list.css +1 -1
- package/dist/micl.css +1 -1
- package/dist/micl.js +1 -1
- package/dist/navigationrail.css +1 -1
- package/dist/radio.css +1 -1
- package/dist/slider.css +1 -1
- package/dist/stepper.css +1 -1
- package/dist/switch.css +1 -1
- package/docs/accordion.html +1 -1
- package/docs/alert.html +176 -0
- package/docs/bottomsheet.html +2 -2
- package/docs/button.html +2 -2
- package/docs/card.html +7 -7
- package/docs/checkbox.html +33 -9
- package/docs/dialog.html +2 -2
- package/docs/divider.html +8 -8
- package/docs/iconbutton.html +2 -2
- package/docs/index.html +43 -32
- package/docs/list.html +2 -2
- package/docs/menu.html +2 -2
- package/docs/micl.css +1 -1
- package/docs/micl.js +1 -1
- package/docs/radio.html +2 -2
- package/docs/select.html +2 -2
- package/docs/sidesheet.html +2 -2
- package/docs/slider.html +2 -2
- package/docs/stepper.html +318 -0
- package/docs/switch.html +8 -4
- package/docs/textfield.html +2 -2
- package/foundations/form/index.ts +174 -0
- package/{layout → foundations/layout}/README.md +5 -0
- package/{layout → foundations/layout}/index.scss +1 -1
- package/micl.ts +3 -3
- package/package.json +3 -1
- package/styles.scss +2 -1
- package/webpack.config.js +1 -1
|
@@ -24,240 +24,202 @@
|
|
|
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-
|
|
30
|
-
--md-sys-checkbox-
|
|
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-
|
|
57
|
-
--checkbox-
|
|
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
|
-
|
|
63
|
-
min-
|
|
64
|
-
|
|
65
|
-
min-
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
background-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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);
|
|
125
|
-
|
|
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);
|
|
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
|
+
-webkit-tap-highlight-color: transparent;
|
|
52
|
+
border-radius: var(--md-sys-shape-corner-full);
|
|
53
|
+
outline-offset: -4px;
|
|
54
|
+
|
|
55
|
+
&::before {
|
|
56
|
+
--md-sys-checkbox-check-width: calc(var(--md-sys-checkbox-container-size) - 3px);
|
|
57
|
+
--md-sys-checkbox-check-height: calc(0.4667 * var(--md-sys-checkbox-check-width));
|
|
58
|
+
|
|
59
|
+
content: "";
|
|
131
60
|
box-sizing: border-box;
|
|
132
61
|
position: absolute;
|
|
133
|
-
|
|
134
|
-
|
|
62
|
+
inline-size: var(--md-sys-checkbox-check-width);
|
|
63
|
+
block-size: 0;
|
|
135
64
|
inset: 0;
|
|
136
|
-
inset-block-start:
|
|
137
|
-
inset-inline-start:
|
|
138
|
-
margin:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
text-align: center;
|
|
65
|
+
inset-block-start: calc(-0.25 * var(--md-sys-checkbox-container-size));
|
|
66
|
+
inset-inline-start: 1px;
|
|
67
|
+
margin: auto;
|
|
68
|
+
border-block-end: var(--md-sys-checkbox-check-thickness) var(--md-sys-color-on-primary) solid;
|
|
69
|
+
border-inline-start: var(--md-sys-checkbox-check-thickness) var(--md-sys-color-on-primary) solid;
|
|
142
70
|
transform: rotate(-45deg);
|
|
143
|
-
transform-origin:
|
|
144
|
-
clip-path: rect(
|
|
145
|
-
|
|
71
|
+
transform-origin: center;
|
|
72
|
+
clip-path: rect(0 2px 0 0);
|
|
73
|
+
z-index: 1;
|
|
146
74
|
transition:
|
|
75
|
+
block-size var(--md-sys-motion-duration-short3) var(--md-sys-motion-duration-short3) motion.$md-sys-motion-easing-standard-decelerate,
|
|
147
76
|
clip-path var(--md-sys-motion-duration-short3) motion.$md-sys-motion-easing-standard-accelerate,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
inset-block-start: 16px;
|
|
153
|
-
inset-inline-start: 7px;
|
|
154
|
-
font: 400 27px/3px var(--md-ref-typeface-plain);
|
|
155
|
-
}
|
|
77
|
+
inset-block-start 0ms linear var(--md-sys-motion-duration-short3),
|
|
78
|
+
inset-inline-start 0ms linear var(--md-sys-motion-duration-short3),
|
|
79
|
+
border-inline-start-width 0ms linear var(--md-sys-motion-duration-short3),
|
|
80
|
+
transform 0ms linear var(--md-sys-motion-duration-short3);
|
|
156
81
|
}
|
|
157
|
-
|
|
158
|
-
--checkbox-
|
|
159
|
-
--checkbox-
|
|
82
|
+
&::after {
|
|
83
|
+
--md-sys-checkbox-background-color: transparent;
|
|
84
|
+
--md-sys-checkbox-border-color: var(--md-sys-color-on-surface-variant);
|
|
85
|
+
|
|
86
|
+
content: "";
|
|
87
|
+
box-sizing: border-box;
|
|
88
|
+
position: absolute;
|
|
89
|
+
inline-size: var(--md-sys-checkbox-container-size);
|
|
90
|
+
block-size: var(--md-sys-checkbox-container-size);
|
|
91
|
+
inset: 0;
|
|
92
|
+
margin: auto;
|
|
93
|
+
border: var(--md-sys-checkbox-border-width) solid var(--md-sys-checkbox-border-color);
|
|
94
|
+
border-radius: 2px;
|
|
95
|
+
background-color: var(--md-sys-checkbox-background-color);
|
|
160
96
|
transition:
|
|
161
|
-
--checkbox-
|
|
162
|
-
--checkbox-
|
|
97
|
+
background-color var(--md-sys-checkbox-motion-duration-reverse) motion.$md-sys-motion-easing-emphasized var(--md-sys-checkbox-motion-duration-reverse),
|
|
98
|
+
border-color var(--md-sys-checkbox-motion-duration-reverse) motion.$md-sys-motion-easing-emphasized var(--md-sys-checkbox-motion-duration-reverse);
|
|
99
|
+
}
|
|
100
|
+
&:checked,
|
|
101
|
+
&:indeterminate {
|
|
102
|
+
--statelayer-color: var(--md-sys-color-primary);
|
|
163
103
|
|
|
164
|
-
|
|
165
|
-
|
|
104
|
+
&::before {
|
|
105
|
+
block-size: var(--md-sys-checkbox-check-height);
|
|
106
|
+
clip-path: rect(0 calc(var(--md-sys-checkbox-container-size) - 5px) 18px 0);
|
|
107
|
+
transition:
|
|
108
|
+
block-size var(--md-sys-motion-duration-short3) var(--md-sys-checkbox-motion-spatial),
|
|
109
|
+
clip-path var(--md-sys-motion-duration-long4) var(--md-sys-motion-duration-short3) var(--md-sys-checkbox-motion-spatial);
|
|
166
110
|
}
|
|
167
111
|
&::after {
|
|
168
|
-
|
|
169
|
-
|
|
112
|
+
--md-sys-checkbox-background-color: var(--md-sys-color-primary);
|
|
113
|
+
--md-sys-checkbox-border-color: var(--md-sys-color-primary);
|
|
114
|
+
|
|
170
115
|
transition:
|
|
171
|
-
|
|
172
|
-
|
|
116
|
+
background-color var(--md-sys-checkbox-motion-duration) linear,
|
|
117
|
+
border-color var(--md-sys-checkbox-motion-duration) motion.$md-sys-motion-easing-emphasized;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
&:indeterminate::before {
|
|
121
|
+
inset-inline-start: 2px;
|
|
122
|
+
border-inline-start-width: 0px;
|
|
123
|
+
transform: rotate(0deg);
|
|
124
|
+
}
|
|
125
|
+
&.micl-checkbox--error:not(:disabled) {
|
|
126
|
+
--statelayer-color: var(--md-sys-color-error);
|
|
127
|
+
|
|
128
|
+
&::after {
|
|
129
|
+
--md-sys-checkbox-border-color: var(--md-sys-color-error);
|
|
130
|
+
}
|
|
131
|
+
&:checked,
|
|
132
|
+
&:indeterminate {
|
|
133
|
+
&:hover,
|
|
134
|
+
&:focus-visible,
|
|
135
|
+
&:active {
|
|
136
|
+
--statelayer-color: var(--md-sys-color-error);
|
|
137
|
+
}
|
|
138
|
+
&::before {
|
|
139
|
+
color: var(--md-sys-color-on-error);
|
|
140
|
+
}
|
|
141
|
+
&::after {
|
|
142
|
+
--md-sys-checkbox-background-color: var(--md-sys-color-error);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
&:not(:checked):not(:indeterminate) {
|
|
146
|
+
&:hover,
|
|
147
|
+
&:focus-visible,
|
|
148
|
+
&:active {
|
|
149
|
+
--statelayer-color: var(--md-sys-color-error);
|
|
150
|
+
|
|
151
|
+
&::after {
|
|
152
|
+
--md-sys-checkbox-border-color: var(--md-sys-color-error);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
173
155
|
}
|
|
174
156
|
}
|
|
175
157
|
&:not(:disabled) {
|
|
176
158
|
--micl-ripple: 1;
|
|
177
159
|
|
|
160
|
+
background-image:
|
|
161
|
+
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%),
|
|
162
|
+
linear-gradient(rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)));
|
|
163
|
+
background-repeat: no-repeat;
|
|
164
|
+
background-size: 10000%, 100%;
|
|
178
165
|
cursor: pointer;
|
|
166
|
+
transition:
|
|
167
|
+
background-size 3000ms,
|
|
168
|
+
--statelayer-opacity var(--md-sys-checkbox-motion-duration) linear;
|
|
179
169
|
|
|
180
170
|
&:hover {
|
|
181
|
-
|
|
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));
|
|
171
|
+
--statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity);
|
|
184
172
|
|
|
185
|
-
|
|
186
|
-
|
|
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
|
-
}
|
|
173
|
+
&:not(:checked):not(:indeterminate)::after {
|
|
174
|
+
--md-sys-checkbox-border-color: var(--md-sys-color-on-surface);
|
|
200
175
|
}
|
|
201
176
|
}
|
|
202
177
|
&:focus-visible {
|
|
203
|
-
--
|
|
178
|
+
--statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity);
|
|
204
179
|
|
|
205
|
-
|
|
206
|
-
--checkbox-state-layer-color: rgb(from var(--md-sys-color-primary) r g b / var(--md-sys-state-focus-state-layer-opacity));
|
|
180
|
+
outline: var(--md-sys-state-focus-indicator-thickness) solid var(--md-sys-color-secondary);
|
|
207
181
|
|
|
208
|
-
|
|
209
|
-
|
|
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
|
-
}
|
|
182
|
+
&:not(:checked):not(:indeterminate)::after {
|
|
183
|
+
--md-sys-checkbox-border-color: var(--md-sys-color-on-surface);
|
|
220
184
|
}
|
|
221
185
|
}
|
|
222
186
|
&:active {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
--checkbox-state-layer-color: rgb(from var(--md-sys-color-on-surface) r g b / var(--md-sys-state-pressed-state-layer-opacity));
|
|
187
|
+
--statelayer-color: var(--md-sys-color-on-surface);
|
|
188
|
+
--statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity);
|
|
226
189
|
|
|
227
|
-
|
|
228
|
-
|
|
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));
|
|
190
|
+
background-size: 0%, 100%;
|
|
191
|
+
transition: background-size 0ms;
|
|
236
192
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
193
|
+
&:not(:checked):not(:indeterminate) {
|
|
194
|
+
--statelayer-color: var(--md-sys-color-primary);
|
|
195
|
+
|
|
196
|
+
&::after {
|
|
197
|
+
--md-sys-checkbox-border-color: var(--md-sys-color-on-surface);
|
|
241
198
|
}
|
|
242
199
|
}
|
|
243
200
|
}
|
|
244
201
|
}
|
|
245
202
|
&:disabled {
|
|
246
|
-
--checkbox-container-border-color: var(--md-sys-color-on-surface);
|
|
247
203
|
opacity: 38%;
|
|
248
204
|
|
|
249
|
-
&:checked
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
&::after {
|
|
205
|
+
&:checked,
|
|
206
|
+
&:indeterminate {
|
|
207
|
+
&::before {
|
|
253
208
|
color: var(--md-sys-color-surface);
|
|
254
209
|
}
|
|
210
|
+
&::after {
|
|
211
|
+
--md-sys-checkbox-background-color: var(--md-sys-color-on-surface);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
&::after {
|
|
215
|
+
--md-sys-checkbox-border-color: var(--md-sys-color-on-surface);
|
|
255
216
|
}
|
|
256
217
|
}
|
|
257
218
|
}
|
|
258
219
|
|
|
259
220
|
input[type=checkbox].micl-checkbox:not(:disabled) + label,
|
|
260
221
|
label:has(+ input[type=checkbox].micl-checkbox:not(:disabled)) {
|
|
222
|
+
-webkit-tap-highlight-color: transparent;
|
|
261
223
|
cursor: pointer;
|
|
262
224
|
}
|
|
263
225
|
input[type=checkbox].micl-checkbox + label,
|
|
@@ -266,12 +228,15 @@ label:has(+ input[type=checkbox].micl-checkbox) {
|
|
|
266
228
|
}
|
|
267
229
|
|
|
268
230
|
[dir=rtl] input[type=checkbox].micl-checkbox {
|
|
269
|
-
&::
|
|
270
|
-
|
|
231
|
+
&::before {
|
|
232
|
+
clip-path: rect(0 18px 8px 16px);
|
|
233
|
+
}
|
|
234
|
+
&:checked::before {
|
|
235
|
+
clip-path: rect(0 18px 8px 2px);
|
|
271
236
|
transform: rotate(45deg);
|
|
272
|
-
clip-path: rect(0px 18px 7.5px 16px);
|
|
273
237
|
}
|
|
274
|
-
&:
|
|
275
|
-
clip-path: rect(
|
|
238
|
+
&:indeterminate::before {
|
|
239
|
+
clip-path: rect(0 18px 8px 2px);
|
|
240
|
+
transform: rotate(0deg);
|
|
276
241
|
}
|
|
277
242
|
}
|
|
@@ -0,0 +1,148 @@
|
|
|
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
|
+
export const checkboxGroupSelector = '.micl-checkbox-group';
|
|
23
|
+
|
|
24
|
+
export default (() =>
|
|
25
|
+
{
|
|
26
|
+
const getParentCheckbox = (checkboxGroup: HTMLElement): HTMLInputElement | null =>
|
|
27
|
+
{
|
|
28
|
+
const parentCheckbox = checkboxGroup.querySelector<HTMLInputElement>('.micl-checkbox__parent');
|
|
29
|
+
return (parentCheckbox?.closest(checkboxGroupSelector) === checkboxGroup) ? parentCheckbox : null;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const refreshParentCheckbox = (checkboxGroup: HTMLElement): boolean =>
|
|
33
|
+
{
|
|
34
|
+
const parentCheckbox = getParentCheckbox(checkboxGroup);
|
|
35
|
+
if (!parentCheckbox) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
let nrCheckboxes = 0,
|
|
39
|
+
nrCheckedCheckboxes = 0;
|
|
40
|
+
|
|
41
|
+
checkboxGroup.querySelectorAll<HTMLInputElement>(
|
|
42
|
+
'input[type="checkbox"].micl-checkbox'
|
|
43
|
+
).forEach(cb =>
|
|
44
|
+
{
|
|
45
|
+
if (cb !== parentCheckbox) {
|
|
46
|
+
const group = cb.closest(checkboxGroupSelector) as HTMLElement;
|
|
47
|
+
if (group === checkboxGroup) {
|
|
48
|
+
nrCheckboxes++;
|
|
49
|
+
if (cb.checked && !cb.indeterminate) {
|
|
50
|
+
nrCheckedCheckboxes++;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else if (
|
|
54
|
+
cb.classList.contains('micl-checkbox__parent')
|
|
55
|
+
&& (group?.parentElement?.closest(checkboxGroupSelector) === checkboxGroup)
|
|
56
|
+
) {
|
|
57
|
+
nrCheckboxes++;
|
|
58
|
+
if (refreshParentCheckbox(group)) {
|
|
59
|
+
nrCheckedCheckboxes++;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
if (nrCheckedCheckboxes === 0) {
|
|
66
|
+
parentCheckbox.checked = false;
|
|
67
|
+
parentCheckbox.indeterminate = false;
|
|
68
|
+
}
|
|
69
|
+
else if (nrCheckedCheckboxes === nrCheckboxes) {
|
|
70
|
+
parentCheckbox.checked = true;
|
|
71
|
+
parentCheckbox.indeterminate = false;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
parentCheckbox.checked = true;
|
|
75
|
+
parentCheckbox.indeterminate = true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return nrCheckedCheckboxes === nrCheckboxes;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const updateCheckboxGroup = (checkboxGroup: HTMLElement, checked: boolean): void =>
|
|
82
|
+
{
|
|
83
|
+
checkboxGroup.querySelectorAll<HTMLInputElement>(
|
|
84
|
+
'input[type="checkbox"].micl-checkbox'
|
|
85
|
+
).forEach(cb =>
|
|
86
|
+
{
|
|
87
|
+
const group = cb.closest(checkboxGroupSelector) as HTMLElement;
|
|
88
|
+
if (group === checkboxGroup) {
|
|
89
|
+
cb.checked = checked;
|
|
90
|
+
}
|
|
91
|
+
else if (
|
|
92
|
+
cb.classList.contains('micl-checkbox__parent')
|
|
93
|
+
&& (group?.parentElement?.closest(checkboxGroupSelector) === checkboxGroup)
|
|
94
|
+
) {
|
|
95
|
+
cb.checked = checked;
|
|
96
|
+
updateCheckboxGroup(group, checked);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const refreshCheckboxGroup = (checkboxGroup: HTMLElement, input: HTMLInputElement | null): void =>
|
|
102
|
+
{
|
|
103
|
+
const parentCheckbox = getParentCheckbox(checkboxGroup);
|
|
104
|
+
if (!parentCheckbox) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (input === parentCheckbox) {
|
|
109
|
+
updateCheckboxGroup(checkboxGroup, input.checked);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
let parentCheckboxGroup,
|
|
113
|
+
cbg = checkboxGroup;
|
|
114
|
+
do {
|
|
115
|
+
parentCheckboxGroup = cbg;
|
|
116
|
+
cbg = cbg.parentElement?.closest(checkboxGroupSelector) as HTMLElement;
|
|
117
|
+
}
|
|
118
|
+
while (cbg);
|
|
119
|
+
|
|
120
|
+
refreshParentCheckbox(parentCheckboxGroup);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
initialize: (element: HTMLElement): void =>
|
|
125
|
+
{
|
|
126
|
+
if (
|
|
127
|
+
!element.matches(checkboxGroupSelector)
|
|
128
|
+
|| element.dataset.miclinitialized
|
|
129
|
+
) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
element.dataset.miclinitialized = '1';
|
|
133
|
+
|
|
134
|
+
element.addEventListener('change', event =>
|
|
135
|
+
{
|
|
136
|
+
const input = event.target as HTMLInputElement;
|
|
137
|
+
if (!input.classList.contains('micl-checkbox')) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
event.stopPropagation();
|
|
141
|
+
|
|
142
|
+
refreshCheckboxGroup(element, input);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
refreshCheckboxGroup(element, null);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
})();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Dialog
|
|
2
|
-
This component implements the
|
|
2
|
+
This component implements the [Material Design 3 Expressive Dialog](https://m3.material.io/components/dialogs/overview) design.
|
|
3
3
|
|
|
4
4
|
## Basic Usage
|
|
5
5
|
|
|
@@ -28,11 +28,16 @@ Import the dialog styles into your project:
|
|
|
28
28
|
@use "material-inspired-component-library/dist/dialog";
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
Or import all MICL styles:
|
|
32
|
+
```CSS
|
|
33
|
+
@use "material-inspired-component-library/styles";
|
|
34
|
+
```
|
|
35
|
+
|
|
31
36
|
### JavaScript
|
|
32
37
|
No custom JavaScript is required for the core functionality of this component, as the native popover attribute handles the open/close behavior.
|
|
33
38
|
|
|
34
|
-
### Demo
|
|
35
|
-
A live example of the [Dialog component](https://henkpb.github.io/micl/dialog.html) is available
|
|
39
|
+
### Live Demo
|
|
40
|
+
A live example of the [Dialog component](https://henkpb.github.io/micl/dialog.html) is available to interact with.
|
|
36
41
|
|
|
37
42
|
## Variants
|
|
38
43
|
When dialogs with the `popover` attribute are opened, they animate from the control element to the center of the screen. They can be easily dismissed by clicking outside or pressing <kbd>Esc</kbd>.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Divider
|
|
2
|
-
This component implements the
|
|
2
|
+
This component implements the [Material Design 3 Expressive Divider](https://m3.material.io/components/divider/overview) design. Dividers are thin lines that separate content into distinct sections.
|
|
3
3
|
|
|
4
4
|
## Basic Usage
|
|
5
5
|
|
|
@@ -17,11 +17,16 @@ Import the divider styles into your project:
|
|
|
17
17
|
@use "material-inspired-component-library/dist/divider";
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
Or import all MICL styles:
|
|
21
|
+
```CSS
|
|
22
|
+
@use "material-inspired-component-library/styles";
|
|
23
|
+
```
|
|
24
|
+
|
|
20
25
|
### JavaScript
|
|
21
26
|
No custom JavaScript is required for the core functionality of this component.
|
|
22
27
|
|
|
23
|
-
### Demo
|
|
24
|
-
A live example of the [Divider component](https://henkpb.github.io/micl/divider.html) is available
|
|
28
|
+
### Live Demo
|
|
29
|
+
A live example of the [Divider component](https://henkpb.github.io/micl/divider.html) is available to interact with.
|
|
25
30
|
|
|
26
31
|
## Variants
|
|
27
32
|
The Divider component offers five CSS classes for different divider styles:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Icon button
|
|
2
|
-
This component implements the
|
|
2
|
+
This component implements the [Material Design 3 Expressive Icon button](https://m3.material.io/components/icon-buttons/overview) design. Icon buttons allow users to perform a single action with a minimal visual footprint.
|
|
3
3
|
|
|
4
4
|
## Basic Usage
|
|
5
5
|
|
|
@@ -19,6 +19,11 @@ Import the icon button styles into your project:
|
|
|
19
19
|
@use "material-inspired-component-library/dist/iconbutton";
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
Or import all MICL styles:
|
|
23
|
+
```CSS
|
|
24
|
+
@use "material-inspired-component-library/styles";
|
|
25
|
+
```
|
|
26
|
+
|
|
22
27
|
### JavaScript
|
|
23
28
|
This component requires JavaScript for interactive features like the **toggle logic**:
|
|
24
29
|
|
|
@@ -28,8 +33,8 @@ import micl from "material-inspired-component-library/dist/micl";
|
|
|
28
33
|
|
|
29
34
|
This will initialize any Icon button component, including those that will be added to the DOM later on.
|
|
30
35
|
|
|
31
|
-
### Demo
|
|
32
|
-
A live example of the [Icon button component](https://henkpb.github.io/micl/iconbutton.html) is available
|
|
36
|
+
### Live Demo
|
|
37
|
+
A live example of the [Icon button component](https://henkpb.github.io/micl/iconbutton.html) is available to interact with.
|
|
33
38
|
|
|
34
39
|
## Variants
|
|
35
40
|
Icon buttons come in **five sizes**: extra small (`xs`), small (`s`), medium (`m`), large (`l`), and extra large (`xl`). To specify a size, append the appropriate postfix to the button's style class:
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
20
|
// SOFTWARE.
|
|
21
21
|
|
|
22
|
+
@use '../../foundations/layout';
|
|
22
23
|
@use '../../styles/elevation';
|
|
23
24
|
@use '../../styles/motion';
|
|
24
25
|
@use '../../styles/shapes';
|
|
@@ -61,9 +62,10 @@ button.micl-iconbutton-outlined-xl {
|
|
|
61
62
|
linear-gradient(rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)));
|
|
62
63
|
background-repeat: no-repeat;
|
|
63
64
|
background-size: 10000%, 100%;
|
|
65
|
+
-webkit-tap-highlight-color: transparent;
|
|
64
66
|
color: var(--md-sys-color-on-surface-variant);
|
|
65
|
-
cursor: pointer;
|
|
66
67
|
font-variation-settings: 'FILL' 0;
|
|
68
|
+
cursor: pointer;
|
|
67
69
|
transition:
|
|
68
70
|
border-radius var(--md-sys-iconbutton-motion-duration) var(--md-sys-iconbutton-motion-effects),
|
|
69
71
|
font-variation-settings var(--md-sys-iconbutton-motion-duration) linear,
|