material-inspired-component-library 3.0.1 → 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 +9 -14
- package/components/alert/index.scss +120 -0
- package/components/appbar/index.scss +2 -2
- package/components/badge/index.scss +22 -7
- package/components/button/index.scss +2 -2
- package/components/card/README.md +9 -5
- package/components/card/index.scss +49 -22
- package/components/checkbox/README.md +49 -11
- package/components/checkbox/index.scss +145 -182
- package/components/checkbox/index.ts +148 -0
- package/components/dialog/index.scss +3 -3
- package/components/divider/README.md +3 -3
- package/components/divider/index.scss +18 -27
- package/components/iconbutton/index.scss +2 -2
- package/components/list/index.scss +2 -2
- package/components/list/index.ts +2 -3
- package/components/menu/index.ts +2 -2
- package/components/navigationrail/index.scss +5 -3
- package/components/radio/README.md +1 -1
- package/components/radio/index.scss +6 -24
- package/components/select/index.scss +5 -2
- package/components/slider/index.scss +4 -4
- package/components/slider/index.ts +9 -10
- package/components/stepper/index.scss +85 -0
- package/components/stepper/index.ts +226 -0
- package/components/switch/README.md +26 -4
- package/components/switch/index.scss +24 -23
- package/components/textfield/index.scss +1 -0
- package/components/textfield/index.ts +56 -23
- package/dist/alert.css +1 -0
- package/dist/alert.js +1 -0
- package/dist/appbar.css +1 -1
- 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/stepper/index.d.ts +5 -0
- package/dist/components/textfield/index.d.ts +2 -1
- package/dist/dialog.css +1 -1
- package/dist/divider.css +1 -1
- package/dist/iconbutton.css +1 -1
- package/dist/layout.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/select.css +1 -1
- package/dist/slider.css +1 -1
- package/dist/stepper.css +1 -0
- package/dist/stepper.js +1 -0
- package/dist/switch.css +1 -1
- package/dist/textfield.css +1 -1
- package/docs/alert.html +181 -0
- package/docs/card.html +25 -7
- package/docs/checkbox.html +31 -7
- package/docs/divider.html +7 -1
- package/docs/index.html +9 -10
- package/docs/micl.css +1 -1
- package/docs/micl.js +1 -1
- package/docs/navigationrail.html +2 -3
- package/docs/radio.html +1 -1
- package/docs/switch.html +41 -26
- package/layout/index.scss +9 -2
- package/micl.ts +24 -26
- package/package.json +2 -1
- package/styles.scss +2 -0
|
@@ -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-
|
|
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
|
-
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
|
-
|
|
127
|
-
--checkbox-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
content:
|
|
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
|
-
|
|
134
|
-
|
|
61
|
+
inline-size: var(--md-sys-checkbox-check-width);
|
|
62
|
+
block-size: 0;
|
|
135
63
|
inset: 0;
|
|
136
|
-
inset-block-start:
|
|
137
|
-
inset-inline-start:
|
|
138
|
-
margin:
|
|
139
|
-
|
|
140
|
-
|
|
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:
|
|
144
|
-
clip-path: rect(
|
|
145
|
-
|
|
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
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
158
|
-
--checkbox-
|
|
159
|
-
--checkbox-
|
|
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-
|
|
162
|
-
--checkbox-
|
|
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
|
-
|
|
165
|
-
|
|
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
|
-
|
|
169
|
-
|
|
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
|
-
|
|
172
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
}
|
|
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
|
-
--
|
|
177
|
+
--statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity);
|
|
204
178
|
|
|
205
|
-
|
|
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
|
-
|
|
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
|
-
}
|
|
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
|
-
|
|
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));
|
|
186
|
+
--statelayer-color: var(--md-sys-color-on-surface);
|
|
187
|
+
--statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity);
|
|
226
188
|
|
|
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));
|
|
189
|
+
background-size: 0%, 100%;
|
|
190
|
+
transition: background-size 0ms;
|
|
236
191
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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
|
-
|
|
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
|
-
&::
|
|
270
|
-
|
|
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
|
-
&:
|
|
275
|
-
clip-path: rect(
|
|
236
|
+
&:indeterminate::before {
|
|
237
|
+
clip-path: rect(0 18px 8px 2px);
|
|
238
|
+
transform: rotate(0deg);
|
|
276
239
|
}
|
|
277
240
|
}
|
|
@@ -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
|
+
})();
|
|
@@ -161,9 +161,9 @@ dialog.micl-dialog-fullscreen {
|
|
|
161
161
|
color: var(--md-sys-color-on-surface);
|
|
162
162
|
}
|
|
163
163
|
.micl-dialog__icon {
|
|
164
|
-
width: 24px;
|
|
165
|
-
height: 24px;
|
|
166
|
-
font-size: 24px;
|
|
164
|
+
width: var(--md-sys-layout-icon-size, 24px);
|
|
165
|
+
height: var(--md-sys-layout-icon-size, 24px);
|
|
166
|
+
font-size: var(--md-sys-layout-icon-size, 24px);
|
|
167
167
|
color: var(--md-sys-color-secondary);
|
|
168
168
|
}
|
|
169
169
|
button {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Divider
|
|
2
|
-
This component implements the the [Material Design 3 Expressive Divider](https://m3.material.io/components/divider/overview) design.
|
|
2
|
+
This component implements the 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
|
|
|
@@ -30,8 +30,8 @@ The Divider component offers five CSS classes for different divider styles:
|
|
|
30
30
|
| --------- | ----------- |
|
|
31
31
|
| micl-divider | A standard, full-width divider |
|
|
32
32
|
| micl-divider-inset | Indented equally on both the left and right sides |
|
|
33
|
-
| micl-divider-inset
|
|
34
|
-
| micl-divider-inset
|
|
33
|
+
| micl-divider-inset-start | Indented only on the left (start) side |
|
|
34
|
+
| micl-divider-inset-end | Indented only on the right (end) side |
|
|
35
35
|
| micl-divider-vertical | A vertical divider |
|
|
36
36
|
|
|
37
37
|
## Customizations
|
|
@@ -25,50 +25,41 @@
|
|
|
25
25
|
--md-sys-divider-space: 4px;
|
|
26
26
|
}
|
|
27
27
|
body {
|
|
28
|
-
--md-sys-divider-color: var(--md-sys-color-outline-variant);
|
|
28
|
+
--md-sys-divider-color: var(--md-sys-color-outline-variant, gray);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.micl-divider
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
.micl-divider,
|
|
32
|
+
.micl-divider-inset,
|
|
33
|
+
.micl-divider-inset-start,
|
|
34
|
+
.micl-divider-inset-end {
|
|
35
|
+
inline-size: 100%;
|
|
36
|
+
block-size: 0;
|
|
34
37
|
margin-block: calc(var(--md-sys-divider-space, 4px) - 1px) var(--md-sys-divider-space, 4px);
|
|
35
38
|
margin-inline: 0;
|
|
36
39
|
border: 0;
|
|
37
|
-
border-block-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color);
|
|
40
|
+
border-block-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color, gray);
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
.micl-divider-inset {
|
|
41
|
-
|
|
42
|
-
height: 0;
|
|
43
|
-
margin-block: calc(var(--md-sys-divider-space, 4px) - 1px) var(--md-sys-divider-space, 4px);
|
|
44
|
+
inline-size: calc(100% - 2 * var(--md-sys-divider-inset-margin, 16px));
|
|
44
45
|
margin-inline: var(--md-sys-divider-inset-margin);
|
|
45
|
-
border: 0;
|
|
46
|
-
border-block-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color);
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
.micl-divider-inset
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
margin-block: calc(var(--md-sys-divider-space, 4px) - 1px) var(--md-sys-divider-space, 4px);
|
|
53
|
-
margin-inline: var(--md-sys-divider-inset-margin) 0;
|
|
54
|
-
border: 0;
|
|
55
|
-
border-block-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color);
|
|
48
|
+
.micl-divider-inset-start {
|
|
49
|
+
inline-size: calc(100% - var(--md-sys-divider-inset-margin, 16px));
|
|
50
|
+
margin-inline-start: var(--md-sys-divider-inset-margin, 16px);
|
|
56
51
|
}
|
|
57
52
|
|
|
58
|
-
.micl-divider-inset
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
margin-block: calc(var(--md-sys-divider-space, 4px) - 1px) var(--md-sys-divider-space, 4px);
|
|
62
|
-
margin-inline: 0 var(--md-sys-divider-inset-margin);
|
|
63
|
-
border: 0;
|
|
64
|
-
border-block-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color);
|
|
53
|
+
.micl-divider-inset-end {
|
|
54
|
+
inline-size: calc(100% - var(--md-sys-divider-inset-margin, 16px));
|
|
55
|
+
margin-inline-end: var(--md-sys-divider-inset-margin, 16px);
|
|
65
56
|
}
|
|
66
57
|
|
|
67
58
|
.micl-divider-vertical {
|
|
68
|
-
min-
|
|
69
|
-
|
|
59
|
+
min-block-size: 100%;
|
|
60
|
+
inline-size: 0;
|
|
70
61
|
margin-block: 0;
|
|
71
62
|
margin-inline: calc(2 * var(--md-sys-divider-space, 4px));
|
|
72
63
|
border: 0;
|
|
73
|
-
border-inline-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color);
|
|
64
|
+
border-inline-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color, gray);
|
|
74
65
|
}
|
|
@@ -151,7 +151,7 @@ button.micl-iconbutton-outlined-s {
|
|
|
151
151
|
inline-size: var(--micl-width);
|
|
152
152
|
min-inline-size: var(--micl-width);
|
|
153
153
|
block-size: var(--micl-height);
|
|
154
|
-
font-size: 24px;
|
|
154
|
+
font-size: var(--md-sys-layout-icon-size, 24px);
|
|
155
155
|
|
|
156
156
|
&::before {
|
|
157
157
|
content: "";
|
|
@@ -202,7 +202,7 @@ button.micl-iconbutton-outlined-m {
|
|
|
202
202
|
inline-size: var(--micl-width);
|
|
203
203
|
min-inline-size: var(--micl-width);
|
|
204
204
|
block-size: var(--micl-height);
|
|
205
|
-
font-size: 24px;
|
|
205
|
+
font-size: var(--md-sys-layout-icon-size, 24px);
|
|
206
206
|
|
|
207
207
|
&.micl-button--toggle.micl-button--selected {
|
|
208
208
|
border-radius: var(--md-sys-shape-corner-large);
|