material-inspired-component-library 8.1.0 → 9.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 +106 -18
- package/components/README.md +1 -1
- package/components/accordion/README.md +6 -6
- package/components/alert/README.md +10 -10
- package/components/alert/index.scss +27 -52
- package/components/appbar/README.md +19 -6
- package/components/appbar/index.scss +40 -44
- package/components/badge/README.md +12 -10
- package/components/badge/index.scss +21 -25
- package/components/bottomsheet/README.md +26 -1
- package/components/bottomsheet/index.scss +58 -44
- package/components/button/README.md +70 -10
- package/components/button/_shared.scss +210 -0
- package/components/button/index.scss +75 -389
- package/components/card/README.md +97 -85
- package/components/card/index.scss +46 -65
- package/components/checkbox/README.md +25 -14
- package/{tools/shapes/check.mjs → components/checkbox/_label.scss} +37 -42
- package/components/checkbox/index.scss +66 -66
- package/components/chip/README.md +186 -0
- package/components/chip/index.scss +285 -0
- package/components/datepicker/README.md +79 -0
- package/components/datepicker/index.scss +346 -315
- package/components/dialog/README.md +20 -10
- package/components/dialog/index.scss +55 -66
- package/components/divider/README.md +16 -15
- package/components/divider/index.scss +9 -25
- package/components/iconbutton/README.md +63 -12
- package/components/iconbutton/index.scss +142 -303
- package/components/list/README.md +89 -156
- package/components/list/index.scss +34 -36
- package/components/menu/README.md +81 -155
- package/components/menu/index.scss +52 -58
- package/components/navigationbar/README.md +108 -0
- package/components/navigationbar/index.scss +185 -0
- package/components/navigationrail/README.md +62 -37
- package/components/navigationrail/_navitem.scss +96 -0
- package/components/navigationrail/index.scss +78 -132
- package/components/progressindicator/README.md +83 -47
- package/components/progressindicator/index.scss +622 -172
- package/components/radio/README.md +11 -9
- package/components/radio/index.scss +36 -33
- package/components/select/README.md +12 -7
- package/components/select/index.scss +26 -34
- package/components/shapes/README.md +3 -3
- package/components/shapes/index.scss +0 -1
- package/components/sidesheet/README.md +21 -9
- package/components/sidesheet/index.scss +38 -46
- package/components/slider/README.md +21 -0
- package/components/slider/index.scss +108 -139
- package/components/snackbar/README.md +32 -35
- package/components/snackbar/index.scss +10 -22
- package/components/stepper/README.md +14 -7
- package/components/stepper/index.scss +58 -39
- package/components/switch/README.md +22 -15
- package/components/switch/index.scss +68 -60
- package/components/textfield/README.md +48 -5
- package/components/textfield/index.scss +192 -248
- package/components/timepicker/README.md +53 -23
- package/components/timepicker/index.scss +110 -128
- package/dist/alert.css +1 -1
- package/dist/alert.js +1 -1
- package/dist/appbar.css +1 -1
- package/dist/appbar.js +1 -1
- package/dist/badge.css +1 -1
- package/dist/badge.js +1 -1
- package/dist/base.css +1 -0
- package/dist/base.js +1 -0
- package/dist/bottomsheet.css +1 -1
- 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/card.js +1 -1
- package/dist/checkbox.css +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/chip.css +1 -0
- package/dist/chip.js +1 -0
- package/dist/components/button/index.d.ts +1 -1
- package/dist/components/iconbutton/index.d.ts +2 -7
- package/dist/components/slider/index.d.ts +1 -1
- package/dist/components/textfield/index.d.ts +2 -2
- package/dist/datepicker.css +1 -1
- package/dist/datepicker.js +1 -1
- package/dist/dialog.css +1 -1
- package/dist/dialog.js +1 -1
- package/dist/divider.css +1 -1
- package/dist/divider.js +1 -1
- package/dist/field.css +1 -0
- package/dist/field.js +1 -0
- package/dist/foundations/form/index.js +1 -1
- package/dist/foundations/runtime.d.ts +15 -0
- package/dist/foundations/runtime.js +1 -0
- package/dist/iconbutton.css +1 -1
- package/dist/iconbutton.js +1 -1
- package/dist/layout.css +1 -1
- package/dist/layout.js +1 -1
- package/dist/list.css +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.css +1 -1
- package/dist/menu.js +1 -1
- package/dist/micl.css +1 -1
- package/dist/micl.d.ts +14 -5
- package/dist/micl.js +1 -1
- package/dist/navigationbar.css +1 -0
- package/dist/navigationbar.js +1 -0
- package/dist/navigationrail.css +1 -1
- package/dist/navigationrail.js +1 -1
- package/dist/progressindicator.css +1 -1
- package/dist/progressindicator.js +1 -1
- package/dist/radio.css +1 -1
- package/dist/radio.js +1 -1
- package/dist/scrollbar.js +1 -1
- package/dist/select.css +1 -1
- package/dist/select.js +1 -1
- package/dist/shapes.css +1 -1
- package/dist/shapes.js +1 -1
- package/dist/sidesheet.css +1 -1
- package/dist/sidesheet.js +1 -1
- package/dist/slider.css +1 -1
- package/dist/slider.js +1 -1
- package/dist/snackbar.css +1 -1
- package/dist/snackbar.js +1 -1
- package/dist/stepper.css +1 -1
- package/dist/stepper.js +1 -1
- package/dist/switch.css +1 -1
- package/dist/switch.js +1 -1
- package/dist/textfield.css +1 -1
- package/dist/textfield.js +1 -1
- package/dist/timepicker.css +1 -1
- package/dist/timepicker.js +1 -1
- package/foundations/_index.scss +35 -0
- package/foundations/{index.scss → base/index.scss} +21 -56
- package/foundations/field/index.scss +37 -0
- package/foundations/layout/index.scss +64 -65
- package/package.json +23 -9
- package/styles/statelayer.scss +20 -5
- package/styles.scss +5 -2
- package/.claude/settings.local.json +0 -14
- package/.editorconfig +0 -12
- package/.gitattributes +0 -9
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -35
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/CLAUDE.md +0 -53
- package/CODE_OF_CONDUCT.md +0 -128
- package/components/bottomsheet/index.ts +0 -153
- package/components/button/index.ts +0 -79
- package/components/checkbox/index.ts +0 -148
- package/components/datepicker/index.ts +0 -693
- package/components/iconbutton/index.ts +0 -77
- package/components/list/index.ts +0 -138
- package/components/menu/index.ts +0 -145
- package/components/navigationrail/index.ts +0 -87
- package/components/progressindicator/index.ts +0 -77
- package/components/slider/index.ts +0 -149
- package/components/snackbar/index.ts +0 -118
- package/components/stepper/index.ts +0 -248
- package/components/textfield/index.ts +0 -188
- package/components/timepicker/index.ts +0 -413
- package/dist/components/progressindicator/index.d.ts +0 -6
- package/dist/foundations.css +0 -1
- package/dist/foundations.js +0 -1
- package/docs/accordion.html +0 -344
- package/docs/alert.html +0 -177
- package/docs/bottomsheet.html +0 -240
- package/docs/button.html +0 -290
- package/docs/card-awards.webp +0 -0
- package/docs/card-cabinet.webp +0 -0
- package/docs/card-city.webp +0 -0
- package/docs/card-fingerprint.webp +0 -0
- package/docs/card-holiday.webp +0 -0
- package/docs/card-names.webp +0 -0
- package/docs/card.html +0 -159
- package/docs/checkbox.html +0 -147
- package/docs/datepicker.html +0 -274
- package/docs/dialog.html +0 -195
- package/docs/divider.html +0 -139
- package/docs/docs.css +0 -26
- package/docs/docs.js +0 -139
- package/docs/iconbutton.html +0 -329
- package/docs/index.html +0 -431
- package/docs/list.html +0 -310
- package/docs/menu.html +0 -574
- package/docs/micl.css +0 -1
- package/docs/micl.js +0 -1
- package/docs/navigationrail.html +0 -138
- package/docs/progressindicator.html +0 -288
- package/docs/radio.html +0 -123
- package/docs/select.html +0 -337
- package/docs/shapes.css +0 -1
- package/docs/shapes.html +0 -159
- package/docs/shapes.js +0 -1
- package/docs/sidesheet.html +0 -149
- package/docs/slider.html +0 -141
- package/docs/snackbar.html +0 -102
- package/docs/stepper.html +0 -319
- package/docs/switch.html +0 -196
- package/docs/textfield.html +0 -208
- package/docs/themes/airblue/dark-hc.css +0 -51
- package/docs/themes/airblue/dark-mc.css +0 -51
- package/docs/themes/airblue/dark.css +0 -51
- package/docs/themes/airblue/light-hc.css +0 -51
- package/docs/themes/airblue/light-mc.css +0 -51
- package/docs/themes/airblue/light.css +0 -51
- package/docs/themes/airblue/theme.css +0 -306
- package/docs/themes/barnred/dark-hc.css +0 -51
- package/docs/themes/barnred/dark-mc.css +0 -51
- package/docs/themes/barnred/dark.css +0 -51
- package/docs/themes/barnred/light-hc.css +0 -51
- package/docs/themes/barnred/light-mc.css +0 -51
- package/docs/themes/barnred/light.css +0 -51
- package/docs/themes/barnred/theme.css +0 -306
- package/docs/themes/citrine/dark-hc.css +0 -51
- package/docs/themes/citrine/dark-mc.css +0 -51
- package/docs/themes/citrine/dark.css +0 -51
- package/docs/themes/citrine/light-hc.css +0 -51
- package/docs/themes/citrine/light-mc.css +0 -51
- package/docs/themes/citrine/light.css +0 -51
- package/docs/themes/citrine/theme.css +0 -306
- package/docs/themes/gray/dark-hc.css +0 -51
- package/docs/themes/gray/dark-mc.css +0 -51
- package/docs/themes/gray/dark.css +0 -51
- package/docs/themes/gray/light-hc.css +0 -51
- package/docs/themes/gray/light-mc.css +0 -51
- package/docs/themes/gray/light.css +0 -51
- package/docs/themes/gray/theme.css +0 -306
- package/docs/themes/greenery/dark-hc.css +0 -51
- package/docs/themes/greenery/dark-mc.css +0 -51
- package/docs/themes/greenery/dark.css +0 -51
- package/docs/themes/greenery/light-hc.css +0 -51
- package/docs/themes/greenery/light-mc.css +0 -51
- package/docs/themes/greenery/light.css +0 -51
- package/docs/themes/greenery/theme.css +0 -306
- package/docs/themes/hermana/dark-hc.css +0 -51
- package/docs/themes/hermana/dark-mc.css +0 -51
- package/docs/themes/hermana/dark.css +0 -51
- package/docs/themes/hermana/light-hc.css +0 -51
- package/docs/themes/hermana/light-mc.css +0 -51
- package/docs/themes/hermana/light.css +0 -51
- package/docs/themes/hermana/theme.css +0 -306
- package/docs/themes/illuminating/dark-hc.css +0 -51
- package/docs/themes/illuminating/dark-mc.css +0 -51
- package/docs/themes/illuminating/dark.css +0 -51
- package/docs/themes/illuminating/light-hc.css +0 -51
- package/docs/themes/illuminating/light-mc.css +0 -51
- package/docs/themes/illuminating/light.css +0 -51
- package/docs/themes/illuminating/theme.css +0 -306
- package/docs/themes/magenta/dark-hc.css +0 -51
- package/docs/themes/magenta/dark-mc.css +0 -51
- package/docs/themes/magenta/dark.css +0 -51
- package/docs/themes/magenta/light-hc.css +0 -51
- package/docs/themes/magenta/light-mc.css +0 -51
- package/docs/themes/magenta/light.css +0 -51
- package/docs/themes/magenta/theme.css +0 -306
- package/docs/themes/mocha/dark-hc.css +0 -51
- package/docs/themes/mocha/dark-mc.css +0 -51
- package/docs/themes/mocha/dark.css +0 -51
- package/docs/themes/mocha/light-hc.css +0 -51
- package/docs/themes/mocha/light-mc.css +0 -51
- package/docs/themes/mocha/light.css +0 -51
- package/docs/themes/mocha/theme.css +0 -306
- package/docs/themes/olivegreen/dark-hc.css +0 -51
- package/docs/themes/olivegreen/dark-mc.css +0 -51
- package/docs/themes/olivegreen/dark.css +0 -51
- package/docs/themes/olivegreen/light-hc.css +0 -51
- package/docs/themes/olivegreen/light-mc.css +0 -51
- package/docs/themes/olivegreen/light.css +0 -51
- package/docs/themes/olivegreen/theme.css +0 -306
- package/docs/themes/peri/dark-hc.css +0 -51
- package/docs/themes/peri/dark-mc.css +0 -51
- package/docs/themes/peri/dark.css +0 -51
- package/docs/themes/peri/light-hc.css +0 -51
- package/docs/themes/peri/light-mc.css +0 -51
- package/docs/themes/peri/light.css +0 -51
- package/docs/themes/peri/theme.css +0 -306
- package/docs/timepicker.html +0 -160
- package/foundations/form/index.ts +0 -174
- package/foundations/layout/README.md +0 -127
- package/intl.d.ts +0 -9
- package/micl.ts +0 -221
- package/styles/README.md +0 -196
- package/tools/shapes/generate.mjs +0 -828
- package/tsconfig.json +0 -116
- package/webpack.config.js +0 -104
|
@@ -19,11 +19,11 @@
|
|
|
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';
|
|
23
22
|
@use '../../styles/motion';
|
|
24
23
|
@use '../../styles/shape';
|
|
25
24
|
@use '../../styles/statelayer';
|
|
26
25
|
@use '../../styles/typography';
|
|
26
|
+
@use './label';
|
|
27
27
|
|
|
28
28
|
@include shape.corner('full');
|
|
29
29
|
|
|
@@ -41,17 +41,16 @@
|
|
|
41
41
|
@include motion.duration('short3');
|
|
42
42
|
@include motion.duration('long4');
|
|
43
43
|
|
|
44
|
-
:
|
|
45
|
-
--md-sys-checkbox-border-width: 2px;
|
|
46
|
-
--md-sys-checkbox-check-thickness: 2px;
|
|
47
|
-
--md-sys-checkbox-container-size: 18px;
|
|
48
|
-
}
|
|
44
|
+
$checkbox: 'input[type=checkbox].micl-checkbox';
|
|
49
45
|
|
|
50
|
-
|
|
51
|
-
--md-
|
|
52
|
-
--md-
|
|
53
|
-
--md-
|
|
46
|
+
#{$checkbox} {
|
|
47
|
+
--md-comp-checkbox-motion-duration: #{motion.$md-sys-motion-expressive-slow-effects-duration};
|
|
48
|
+
--md-comp-checkbox-motion-duration-reverse: #{motion.$md-sys-motion-expressive-default-effects-duration};
|
|
49
|
+
--md-comp-checkbox-motion-spatial: #{motion.$md-sys-motion-expressive-fast-spatial};
|
|
54
50
|
|
|
51
|
+
--_size: var(--md-comp-checkbox-container-size, 18px);
|
|
52
|
+
--_outline-width: var(--md-comp-checkbox-outline-width, 2px);
|
|
53
|
+
--_check-thickness: var(--md-comp-checkbox-check-thickness, 2px);
|
|
55
54
|
--statelayer-color: var(--md-sys-color-on-surface);
|
|
56
55
|
|
|
57
56
|
appearance: none;
|
|
@@ -69,21 +68,25 @@ input[type=checkbox].micl-checkbox {
|
|
|
69
68
|
border-radius: var(--md-sys-shape-corner-full);
|
|
70
69
|
outline-offset: -4px;
|
|
71
70
|
|
|
71
|
+
// The check mark: two currentColor borders rotated into a check, revealed by a
|
|
72
|
+
// combination of block-size and clip-path transitions. currentColor, so that the
|
|
73
|
+
// error and disabled states recolour it with a single color declaration.
|
|
72
74
|
&::before {
|
|
73
|
-
--
|
|
74
|
-
--
|
|
75
|
+
--_check-width: calc(var(--_size) - 3px);
|
|
76
|
+
--_check-height: calc(0.4667 * var(--_check-width));
|
|
75
77
|
|
|
76
78
|
content: "";
|
|
77
79
|
box-sizing: border-box;
|
|
78
80
|
position: absolute;
|
|
79
|
-
inline-size: var(--
|
|
81
|
+
inline-size: var(--_check-width);
|
|
80
82
|
block-size: 0;
|
|
81
83
|
inset: 0;
|
|
82
|
-
inset-block-start: calc(-0.25 * var(--
|
|
84
|
+
inset-block-start: calc(-0.25 * var(--_size));
|
|
83
85
|
inset-inline-start: 1px;
|
|
84
86
|
margin: auto;
|
|
85
|
-
|
|
86
|
-
border-
|
|
87
|
+
color: var(--md-comp-checkbox-selected-icon-color, var(--md-sys-color-on-primary));
|
|
88
|
+
border-block-end: var(--_check-thickness) currentColor solid;
|
|
89
|
+
border-inline-start: var(--_check-thickness) currentColor solid;
|
|
87
90
|
transform: rotate(-45deg);
|
|
88
91
|
transform-origin: center;
|
|
89
92
|
clip-path: rect(0 2px 0 0);
|
|
@@ -97,41 +100,40 @@ input[type=checkbox].micl-checkbox {
|
|
|
97
100
|
transform 0ms linear var(--md-sys-motion-duration-short3);
|
|
98
101
|
}
|
|
99
102
|
&::after {
|
|
100
|
-
--
|
|
101
|
-
--md-
|
|
103
|
+
--_container-color: transparent;
|
|
104
|
+
--_outline-color: var(--md-comp-checkbox-unselected-outline-color, var(--md-sys-color-on-surface-variant));
|
|
102
105
|
|
|
103
106
|
content: "";
|
|
104
107
|
box-sizing: border-box;
|
|
105
108
|
position: absolute;
|
|
106
|
-
inline-size: var(--
|
|
107
|
-
block-size: var(--
|
|
109
|
+
inline-size: var(--_size);
|
|
110
|
+
block-size: var(--_size);
|
|
108
111
|
inset: 0;
|
|
109
112
|
margin: auto;
|
|
110
|
-
border: var(--
|
|
113
|
+
border: var(--_outline-width) solid var(--_outline-color);
|
|
111
114
|
border-radius: 2px;
|
|
112
|
-
background-color: var(--
|
|
115
|
+
background-color: var(--_container-color);
|
|
113
116
|
transition:
|
|
114
|
-
background-color var(--md-
|
|
115
|
-
border-color var(--md-
|
|
117
|
+
background-color var(--md-comp-checkbox-motion-duration-reverse) motion.$md-sys-motion-easing-emphasized var(--md-comp-checkbox-motion-duration-reverse),
|
|
118
|
+
border-color var(--md-comp-checkbox-motion-duration-reverse) motion.$md-sys-motion-easing-emphasized var(--md-comp-checkbox-motion-duration-reverse);
|
|
116
119
|
}
|
|
117
|
-
&:checked,
|
|
118
|
-
&:indeterminate {
|
|
120
|
+
&:is(:checked, :indeterminate) {
|
|
119
121
|
--statelayer-color: var(--md-sys-color-primary);
|
|
120
122
|
|
|
121
123
|
&::before {
|
|
122
|
-
block-size: var(--
|
|
123
|
-
clip-path: rect(0 calc(var(--
|
|
124
|
+
block-size: var(--_check-height);
|
|
125
|
+
clip-path: rect(0 calc(var(--_size) - 5px) var(--_size) 0);
|
|
124
126
|
transition:
|
|
125
|
-
block-size var(--md-sys-motion-duration-short3) var(--md-
|
|
126
|
-
clip-path var(--md-sys-motion-duration-long4) var(--md-sys-motion-duration-short3) var(--md-
|
|
127
|
+
block-size var(--md-sys-motion-duration-short3) var(--md-comp-checkbox-motion-spatial),
|
|
128
|
+
clip-path var(--md-sys-motion-duration-long4) var(--md-sys-motion-duration-short3) var(--md-comp-checkbox-motion-spatial);
|
|
127
129
|
}
|
|
128
130
|
&::after {
|
|
129
|
-
--md-
|
|
130
|
-
--md-
|
|
131
|
+
--_container-color: var(--md-comp-checkbox-selected-container-color, var(--md-sys-color-primary));
|
|
132
|
+
--_outline-color: var(--md-comp-checkbox-selected-container-color, var(--md-sys-color-primary));
|
|
131
133
|
|
|
132
134
|
transition:
|
|
133
|
-
background-color var(--md-
|
|
134
|
-
border-color var(--md-
|
|
135
|
+
background-color var(--md-comp-checkbox-motion-duration) linear,
|
|
136
|
+
border-color var(--md-comp-checkbox-motion-duration) motion.$md-sys-motion-easing-emphasized;
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
139
|
&:indeterminate::before {
|
|
@@ -143,10 +145,9 @@ input[type=checkbox].micl-checkbox {
|
|
|
143
145
|
--statelayer-color: var(--md-sys-color-error);
|
|
144
146
|
|
|
145
147
|
&::after {
|
|
146
|
-
--
|
|
148
|
+
--_outline-color: var(--md-sys-color-error);
|
|
147
149
|
}
|
|
148
|
-
&:checked,
|
|
149
|
-
&:indeterminate {
|
|
150
|
+
&:is(:checked, :indeterminate) {
|
|
150
151
|
&:hover,
|
|
151
152
|
&:focus-visible,
|
|
152
153
|
&:active {
|
|
@@ -156,17 +157,17 @@ input[type=checkbox].micl-checkbox {
|
|
|
156
157
|
color: var(--md-sys-color-on-error);
|
|
157
158
|
}
|
|
158
159
|
&::after {
|
|
159
|
-
--
|
|
160
|
+
--_container-color: var(--md-sys-color-error);
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
|
-
&:not(:checked
|
|
163
|
+
&:not(:checked, :indeterminate) {
|
|
163
164
|
&:hover,
|
|
164
165
|
&:focus-visible,
|
|
165
166
|
&:active {
|
|
166
167
|
--statelayer-color: var(--md-sys-color-error);
|
|
167
168
|
|
|
168
169
|
&::after {
|
|
169
|
-
--
|
|
170
|
+
--_outline-color: var(--md-sys-color-error);
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
173
|
}
|
|
@@ -183,17 +184,18 @@ input[type=checkbox].micl-checkbox {
|
|
|
183
184
|
),
|
|
184
185
|
linear-gradient(rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)));
|
|
185
186
|
background-repeat: no-repeat;
|
|
187
|
+
background-position: var(--micl-x, center) var(--micl-y, center), 0 0;
|
|
186
188
|
background-size: 0%, 100%;
|
|
187
189
|
cursor: pointer;
|
|
188
190
|
transition:
|
|
189
191
|
background-size 0ms,
|
|
190
|
-
--statelayer-opacity var(--md-
|
|
192
|
+
--statelayer-opacity var(--md-comp-checkbox-motion-duration) linear;
|
|
191
193
|
|
|
192
194
|
&:hover {
|
|
193
195
|
--statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity, 8%);
|
|
194
196
|
|
|
195
|
-
&:not(:checked
|
|
196
|
-
--
|
|
197
|
+
&:not(:checked, :indeterminate)::after {
|
|
198
|
+
--_outline-color: var(--md-sys-color-on-surface);
|
|
197
199
|
}
|
|
198
200
|
}
|
|
199
201
|
&:focus-visible {
|
|
@@ -201,68 +203,66 @@ input[type=checkbox].micl-checkbox {
|
|
|
201
203
|
|
|
202
204
|
outline: var(--md-sys-state-focus-indicator-thickness, 3px) solid var(--md-sys-color-secondary);
|
|
203
205
|
|
|
204
|
-
&:not(:checked
|
|
205
|
-
--
|
|
206
|
+
&:not(:checked, :indeterminate)::after {
|
|
207
|
+
--_outline-color: var(--md-sys-color-on-surface);
|
|
206
208
|
}
|
|
207
209
|
}
|
|
208
210
|
&:active {
|
|
209
211
|
--statelayer-color: var(--md-sys-color-on-surface);
|
|
210
212
|
--statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity, 10%);
|
|
211
213
|
|
|
212
|
-
&:not(:checked
|
|
214
|
+
&:not(:checked, :indeterminate) {
|
|
213
215
|
--statelayer-color: var(--md-sys-color-primary);
|
|
214
216
|
|
|
215
217
|
&::after {
|
|
216
|
-
--
|
|
218
|
+
--_outline-color: var(--md-sys-color-on-surface);
|
|
217
219
|
}
|
|
218
220
|
}
|
|
219
221
|
}
|
|
220
222
|
&.micl-rippling {
|
|
221
|
-
animation: micl-ripple var(--md-sys-state-ripple-duration)
|
|
223
|
+
animation: micl-ripple var(--md-sys-state-ripple-duration);
|
|
222
224
|
}
|
|
223
225
|
}
|
|
224
226
|
&:disabled {
|
|
225
227
|
opacity: var(--md-sys-state-disabled-state-layer-opacity, 38%);
|
|
226
228
|
|
|
227
|
-
&:checked,
|
|
228
|
-
&:indeterminate {
|
|
229
|
+
&:is(:checked, :indeterminate) {
|
|
229
230
|
&::before {
|
|
230
231
|
color: var(--md-sys-color-surface);
|
|
231
232
|
}
|
|
232
233
|
&::after {
|
|
233
|
-
--
|
|
234
|
+
--_container-color: var(--md-sys-color-on-surface);
|
|
234
235
|
}
|
|
235
236
|
}
|
|
236
237
|
&::after {
|
|
237
|
-
--
|
|
238
|
+
--_outline-color: var(--md-sys-color-on-surface);
|
|
238
239
|
}
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
242
|
|
|
242
|
-
|
|
243
|
-
label:has(+
|
|
244
|
-
-
|
|
245
|
-
cursor: pointer;
|
|
243
|
+
#{$checkbox}:not(:disabled) + label,
|
|
244
|
+
label:has(+ #{$checkbox}:not(:disabled)) {
|
|
245
|
+
@extend %micl-toggle-label-pointer;
|
|
246
246
|
}
|
|
247
|
-
|
|
248
|
-
label:has(+
|
|
249
|
-
|
|
247
|
+
#{$checkbox} + label,
|
|
248
|
+
label:has(+ #{$checkbox}) {
|
|
249
|
+
@extend %micl-toggle-label;
|
|
250
250
|
}
|
|
251
|
-
|
|
252
|
-
label:has(+
|
|
253
|
-
|
|
251
|
+
#{$checkbox}:disabled + label,
|
|
252
|
+
label:has(+ #{$checkbox}:disabled) {
|
|
253
|
+
@extend %micl-toggle-label-disabled;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
|
|
256
|
+
#{$checkbox}:dir(rtl) {
|
|
257
257
|
&::before {
|
|
258
|
-
clip-path: rect(0
|
|
258
|
+
clip-path: rect(0 var(--_size) var(--_size) calc(var(--_size) - 2px));
|
|
259
259
|
}
|
|
260
260
|
&:checked::before {
|
|
261
|
-
clip-path: rect(0
|
|
261
|
+
clip-path: rect(0 var(--_size) var(--_size) 2px);
|
|
262
262
|
transform: rotate(45deg);
|
|
263
263
|
}
|
|
264
264
|
&:indeterminate::before {
|
|
265
|
-
clip-path: rect(0
|
|
265
|
+
clip-path: rect(0 var(--_size) var(--_size) 2px);
|
|
266
266
|
transform: rotate(0deg);
|
|
267
267
|
}
|
|
268
268
|
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Chip
|
|
2
|
+
This component implements the [Material Design 3 Chips](https://m3.material.io/components/chips/overview) design. Chips help people enter information, make selections, filter content, or trigger actions.
|
|
3
|
+
|
|
4
|
+
## Basic Usage
|
|
5
|
+
|
|
6
|
+
### HTML
|
|
7
|
+
The Chip component is an extension of the [**Button** component](../button/README.md). Chips are placed in a `micl-chips` container. To create a basic chip, use the `<button>` element with a class that specifies its type. This example uses two assist chips:
|
|
8
|
+
|
|
9
|
+
```HTML
|
|
10
|
+
<fieldset class="micl-chips">
|
|
11
|
+
<button type="button" class="micl-chip-assist">Turn on lights</button>
|
|
12
|
+
<button type="button" class="micl-chip-assist">Set alarm</button>
|
|
13
|
+
</fieldset>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### CSS
|
|
17
|
+
Import the chip styles into your project:
|
|
18
|
+
|
|
19
|
+
```CSS
|
|
20
|
+
@use "material-inspired-component-library/dist/chip";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or import all MICL styles:
|
|
24
|
+
```CSS
|
|
25
|
+
@use "material-inspired-component-library/styles";
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### JavaScript
|
|
29
|
+
No custom JavaScript is required for the core functionality of this component.
|
|
30
|
+
|
|
31
|
+
### Live Demo
|
|
32
|
+
A live example of the [Chip component](https://henkpb.github.io/micl/chip.html) is available to interact with.
|
|
33
|
+
|
|
34
|
+
## Variants
|
|
35
|
+
Material Design provides **four types** of chips, each with its own class:
|
|
36
|
+
|
|
37
|
+
| Type | Class | Purpose |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| Assist | `micl-chip-assist` | Trigger a smart or automated action |
|
|
40
|
+
| Filter | `micl-chip-filter` | Select from a set of options |
|
|
41
|
+
| Input | `micl-chip-input` | Represent discrete pieces of information entered by the user |
|
|
42
|
+
| Suggestion | `micl-chip-suggestion` | Present dynamically generated suggestions |
|
|
43
|
+
|
|
44
|
+
By default, chips have an **outlined** appearance. For an elevated appearance without an outline, add the `micl-chip--elevated` class:
|
|
45
|
+
|
|
46
|
+
```HTML
|
|
47
|
+
<button type="button" class="micl-chip-assist micl-chip--elevated">Turn on lights</button>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Adding the `disabled` boolean attribute causes the chip to be displayed in a disabled state. **Exceptions**: for filter chips, the attribute is placed on the nested `<input>` element instead, and for input chips on both nested `<button>` elements (see below).
|
|
51
|
+
|
|
52
|
+
### Filter Chip
|
|
53
|
+
A filter chip is a `<label>` wrapping an `<input type="checkbox">` (multiple selection) or `<input type="radio">` (single selection), followed by the label text. The leading element with the checkmark icon is required; it is revealed with an animation when the chip is selected:
|
|
54
|
+
|
|
55
|
+
```HTML
|
|
56
|
+
<fieldset class="micl-chips">
|
|
57
|
+
<label class="micl-chip-filter">
|
|
58
|
+
<span class="micl-button__icon material-symbols-outlined" aria-hidden="true">check</span>
|
|
59
|
+
<input type="checkbox" name="amenities" value="parking">
|
|
60
|
+
<span>Parking</span>
|
|
61
|
+
</label>
|
|
62
|
+
<label class="micl-chip-filter">
|
|
63
|
+
<span class="micl-button__icon material-symbols-outlined" aria-hidden="true">check</span>
|
|
64
|
+
<input type="checkbox" name="amenities" value="garden" disabled>
|
|
65
|
+
<span>Garden</span>
|
|
66
|
+
</label>
|
|
67
|
+
</fieldset>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The selected state follows the `:checked` state of the input, and the disabled state its `disabled` attribute.
|
|
71
|
+
|
|
72
|
+
A filter chip may additionally carry a **leading icon**, placed before the checkmark icon. It is visible while the chip is unselected and hidden while it is selected.
|
|
73
|
+
|
|
74
|
+
```HTML
|
|
75
|
+
<label class="micl-chip-filter">
|
|
76
|
+
<span class="micl-button__icon material-symbols-outlined" aria-hidden="true">elevator</span>
|
|
77
|
+
<span class="micl-button__icon material-symbols-outlined" aria-hidden="true">check</span>
|
|
78
|
+
<input type="checkbox" name="amenities" value="elevator">
|
|
79
|
+
<span>Elevator</span>
|
|
80
|
+
</label>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Input Chip
|
|
84
|
+
An input chip carries **two actions** — activating the chip and removing it. The chip itself is a non-interactive `<span>` container holding two sibling `<button>` elements: the primary action with the label, and the trailing remove action.
|
|
85
|
+
|
|
86
|
+
```HTML
|
|
87
|
+
<span class="micl-chip-input">
|
|
88
|
+
<button type="button" class="micl-chip__primary">Avocado</button>
|
|
89
|
+
<button type="button" class="micl-chip__remove material-symbols-outlined"
|
|
90
|
+
aria-label="Remove Avocado">close</button>
|
|
91
|
+
</span>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
To disable an input chip, place the `disabled` attribute on **both** buttons.
|
|
95
|
+
|
|
96
|
+
An input chip may represent a person with a leading avatar — an `<img>`, or an element with a monogram — placed inside the primary action before the label.
|
|
97
|
+
|
|
98
|
+
```HTML
|
|
99
|
+
<span class="micl-chip-input">
|
|
100
|
+
<button type="button" class="micl-chip__primary">
|
|
101
|
+
<img src="jonas.webp" alt="" class="micl-chip__avatar">
|
|
102
|
+
<span>Jonas</span>
|
|
103
|
+
</button>
|
|
104
|
+
<button type="button" class="micl-chip__remove material-symbols-outlined"
|
|
105
|
+
aria-label="Remove Jonas">close</button>
|
|
106
|
+
</span>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
For a collection of input chips presented like a form field, add the `micl-chips--input` class to the container:
|
|
110
|
+
|
|
111
|
+
```HTML
|
|
112
|
+
<fieldset class="micl-chips micl-chips--input">
|
|
113
|
+
<legend class="md-sys-typescale-label-large">Recipients</legend>
|
|
114
|
+
...
|
|
115
|
+
</fieldset>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Icons
|
|
119
|
+
To add a leading icon to a chip, include an element with the `micl-button__icon` class before the label text:
|
|
120
|
+
|
|
121
|
+
```HTML
|
|
122
|
+
<button type="button" class="micl-chip-suggestion">
|
|
123
|
+
<span class="micl-button__icon material-symbols-outlined" aria-hidden="true">music_note</span>
|
|
124
|
+
<span>What song is this?</span>
|
|
125
|
+
</button>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
These examples use [Google Material Symbols](https://fonts.google.com/icons), but other icon libraries can be used just as well.
|
|
129
|
+
|
|
130
|
+
## Theming
|
|
131
|
+
Each chip type can be themed with CSS custom properties that follow the Material Design 3 component-token naming convention.
|
|
132
|
+
|
|
133
|
+
### Assist
|
|
134
|
+
| Custom property | Meaning | Default |
|
|
135
|
+
|---|---|---|
|
|
136
|
+
| `--md-comp-assist-chip-label-text-color` | Label colour | `--md-sys-color-on-surface` |
|
|
137
|
+
| `--md-comp-assist-chip-leading-icon-color` | Icon colour | `--md-sys-color-primary` |
|
|
138
|
+
| `--md-comp-assist-chip-outline-color` | Outline (border) colour | `--md-sys-color-outline-variant` |
|
|
139
|
+
| `--md-comp-assist-chip-elevated-container-color` | Container background when elevated | `--md-sys-color-surface-container-low` |
|
|
140
|
+
| `--md-comp-assist-chip-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` at `38%` |
|
|
141
|
+
| `--md-comp-assist-chip-disabled-outline-color` | Outline colour when disabled | `--md-sys-color-on-surface` at `12%` |
|
|
142
|
+
|
|
143
|
+
### Filter
|
|
144
|
+
| Custom property | Meaning | Default |
|
|
145
|
+
|---|---|---|
|
|
146
|
+
| `--md-comp-filter-chip-label-text-color` | Label colour | `--md-sys-color-on-surface-variant` |
|
|
147
|
+
| `--md-comp-filter-chip-leading-icon-color` | Icon colour | `--md-sys-color-primary` |
|
|
148
|
+
| `--md-comp-filter-chip-outline-color` | Outline (border) colour | `--md-sys-color-outline-variant` |
|
|
149
|
+
| `--md-comp-filter-chip-elevated-container-color` | Container background when elevated | `--md-sys-color-surface-container-low` |
|
|
150
|
+
| `--md-comp-filter-chip-selected-container-color` | Container background when selected | `--md-sys-color-secondary-container` |
|
|
151
|
+
| `--md-comp-filter-chip-selected-label-text-color` | Label colour when selected | `--md-sys-color-on-secondary-container` |
|
|
152
|
+
| `--md-comp-filter-chip-selected-leading-icon-color` | Checkmark colour when selected | `--md-sys-color-on-secondary-container` |
|
|
153
|
+
| `--md-comp-filter-chip-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` at `38%` |
|
|
154
|
+
| `--md-comp-filter-chip-disabled-outline-color` | Outline colour when disabled | `--md-sys-color-on-surface` at `12%` |
|
|
155
|
+
| `--md-comp-filter-chip-disabled-selected-container-color` | Container background when selected and disabled | `--md-sys-color-on-surface` |
|
|
156
|
+
| `--md-comp-filter-chip-disabled-selected-container-opacity` | Container opacity when selected and disabled | `12%` |
|
|
157
|
+
|
|
158
|
+
### Input
|
|
159
|
+
| Custom property | Meaning | Default |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| `--md-comp-input-chip-label-text-color` | Label colour | `--md-sys-color-on-surface-variant` |
|
|
162
|
+
| `--md-comp-input-chip-leading-icon-color` | Icon colour | the label colour |
|
|
163
|
+
| `--md-comp-input-chip-trailing-icon-color` | Trailing (remove) icon colour | the leading icon colour |
|
|
164
|
+
| `--md-comp-input-chip-outline-color` | Outline (border) colour | `--md-sys-color-outline-variant` |
|
|
165
|
+
| `--md-comp-input-chip-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` at `38%` |
|
|
166
|
+
| `--md-comp-input-chip-disabled-outline-color` | Outline colour when disabled | `--md-sys-color-on-surface` at `12%` |
|
|
167
|
+
| `--md-comp-input-chip-avatar-size` | Avatar diameter | `24px` |
|
|
168
|
+
| `--md-comp-input-chip-avatar-shape` | Avatar corner shape | `--md-sys-shape-corner-full` |
|
|
169
|
+
| `--md-comp-input-chip-disabled-avatar-opacity` | Avatar opacity when disabled | `38%` |
|
|
170
|
+
| `--md-comp-input-chip-avatar-color` | Monogram avatar background colour ¹ | `--md-sys-color-primary-container` |
|
|
171
|
+
| `--md-comp-input-chip-avatar-label-color` | Monogram avatar text colour ¹ | `--md-sys-color-on-primary-container` |
|
|
172
|
+
|
|
173
|
+
¹ MICL extension: monogram avatars are not part of the Material Design token set, which only covers image avatars.
|
|
174
|
+
|
|
175
|
+
### Suggestion
|
|
176
|
+
| Custom property | Meaning | Default |
|
|
177
|
+
|---|---|---|
|
|
178
|
+
| `--md-comp-suggestion-chip-label-text-color` | Label colour | `--md-sys-color-on-surface-variant` |
|
|
179
|
+
| `--md-comp-suggestion-chip-leading-icon-color` | Icon colour | `--md-sys-color-primary` |
|
|
180
|
+
| `--md-comp-suggestion-chip-outline-color` | Outline (border) colour | `--md-sys-color-outline-variant` |
|
|
181
|
+
| `--md-comp-suggestion-chip-elevated-container-color` | Container background when elevated | `--md-sys-color-surface-container-low` |
|
|
182
|
+
| `--md-comp-suggestion-chip-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` at `38%` |
|
|
183
|
+
| `--md-comp-suggestion-chip-disabled-outline-color` | Outline colour when disabled | `--md-sys-color-on-surface` at `12%` |
|
|
184
|
+
|
|
185
|
+
## Compatibility
|
|
186
|
+
This component utilizes relative RGB color values and the `:has()` pseudo-class, 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.
|