material-inspired-component-library 1.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.
Files changed (174) hide show
  1. package/.editorconfig +12 -0
  2. package/.gitattributes +9 -0
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +35 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  5. package/LICENSE +21 -0
  6. package/README.md +99 -0
  7. package/components/README.md +12 -0
  8. package/components/accordion/README.md +94 -0
  9. package/components/bottomsheet/README.md +77 -0
  10. package/components/bottomsheet/bottomsheet.scss +134 -0
  11. package/components/bottomsheet/index.ts +152 -0
  12. package/components/button/README.md +92 -0
  13. package/components/button/button.scss +515 -0
  14. package/components/button/index.ts +73 -0
  15. package/components/card/README.md +125 -0
  16. package/components/card/card.scss +261 -0
  17. package/components/checkbox/README.md +62 -0
  18. package/components/checkbox/checkbox.scss +275 -0
  19. package/components/checkbox/index.ts +48 -0
  20. package/components/dialog/README.md +133 -0
  21. package/components/dialog/dialog.scss +262 -0
  22. package/components/divider/README.md +52 -0
  23. package/components/divider/divider.scss +74 -0
  24. package/components/iconbutton/README.md +86 -0
  25. package/components/iconbutton/iconbutton.scss +461 -0
  26. package/components/iconbutton/index.ts +73 -0
  27. package/components/list/README.md +176 -0
  28. package/components/list/index.ts +108 -0
  29. package/components/list/list.scss +295 -0
  30. package/components/menu/README.md +96 -0
  31. package/components/menu/index.ts +77 -0
  32. package/components/menu/menu.scss +124 -0
  33. package/components/radio/README.md +53 -0
  34. package/components/radio/radio.scss +138 -0
  35. package/components/select/README.md +84 -0
  36. package/components/select/select.scss +122 -0
  37. package/components/sidesheet/README.md +99 -0
  38. package/components/sidesheet/sidesheet.scss +162 -0
  39. package/components/slider/README.md +69 -0
  40. package/components/slider/index.ts +114 -0
  41. package/components/slider/slider.scss +258 -0
  42. package/components/switch/README.md +49 -0
  43. package/components/switch/switch.scss +176 -0
  44. package/components/textfield/README.md +75 -0
  45. package/components/textfield/index.ts +81 -0
  46. package/components/textfield/textfield.scss +387 -0
  47. package/components.ts +169 -0
  48. package/dist/bottomsheet.css +1 -0
  49. package/dist/bottomsheet.js +0 -0
  50. package/dist/button.css +1 -0
  51. package/dist/button.js +0 -0
  52. package/dist/card.css +1 -0
  53. package/dist/card.js +0 -0
  54. package/dist/checkbox.css +1 -0
  55. package/dist/checkbox.js +0 -0
  56. package/dist/dialog.css +1 -0
  57. package/dist/dialog.js +0 -0
  58. package/dist/divider.css +1 -0
  59. package/dist/divider.js +0 -0
  60. package/dist/iconbutton.css +1 -0
  61. package/dist/iconbutton.js +0 -0
  62. package/dist/list.css +1 -0
  63. package/dist/list.js +0 -0
  64. package/dist/menu.css +1 -0
  65. package/dist/menu.js +0 -0
  66. package/dist/micl.css +1 -0
  67. package/dist/micl.js +1 -0
  68. package/dist/radio.css +1 -0
  69. package/dist/radio.js +0 -0
  70. package/dist/select.css +1 -0
  71. package/dist/select.js +0 -0
  72. package/dist/sidesheet.css +1 -0
  73. package/dist/sidesheet.js +0 -0
  74. package/dist/slider.css +1 -0
  75. package/dist/slider.js +0 -0
  76. package/dist/switch.css +1 -0
  77. package/dist/switch.js +0 -0
  78. package/dist/textfield.css +1 -0
  79. package/dist/textfield.js +0 -0
  80. package/docs/accordion.html +285 -0
  81. package/docs/bottomsheet.html +162 -0
  82. package/docs/button.html +206 -0
  83. package/docs/card-awards.webp +0 -0
  84. package/docs/card-cabinet.webp +0 -0
  85. package/docs/card-city.webp +0 -0
  86. package/docs/card-fingerprint.webp +0 -0
  87. package/docs/card-holiday.webp +0 -0
  88. package/docs/card-names.webp +0 -0
  89. package/docs/card.html +91 -0
  90. package/docs/checkbox.html +99 -0
  91. package/docs/dialog.html +153 -0
  92. package/docs/divider.html +103 -0
  93. package/docs/docs.css +34 -0
  94. package/docs/docs.js +69 -0
  95. package/docs/iconbutton.html +197 -0
  96. package/docs/index.html +319 -0
  97. package/docs/list.html +224 -0
  98. package/docs/menu.html +143 -0
  99. package/docs/micl.css +1 -0
  100. package/docs/micl.js +1 -0
  101. package/docs/radio.html +101 -0
  102. package/docs/select.html +205 -0
  103. package/docs/sidesheet.html +115 -0
  104. package/docs/slider.html +72 -0
  105. package/docs/switch.html +151 -0
  106. package/docs/textfield.html +151 -0
  107. package/docs/themes/airblue/dark-hc.css +51 -0
  108. package/docs/themes/airblue/dark-mc.css +51 -0
  109. package/docs/themes/airblue/dark.css +51 -0
  110. package/docs/themes/airblue/light-hc.css +51 -0
  111. package/docs/themes/airblue/light-mc.css +51 -0
  112. package/docs/themes/airblue/light.css +51 -0
  113. package/docs/themes/airblue/theme.css +306 -0
  114. package/docs/themes/barnred/dark-hc.css +51 -0
  115. package/docs/themes/barnred/dark-mc.css +51 -0
  116. package/docs/themes/barnred/dark.css +51 -0
  117. package/docs/themes/barnred/light-hc.css +51 -0
  118. package/docs/themes/barnred/light-mc.css +51 -0
  119. package/docs/themes/barnred/light.css +51 -0
  120. package/docs/themes/barnred/theme.css +306 -0
  121. package/docs/themes/citrine/dark-hc.css +51 -0
  122. package/docs/themes/citrine/dark-mc.css +51 -0
  123. package/docs/themes/citrine/dark.css +51 -0
  124. package/docs/themes/citrine/light-hc.css +51 -0
  125. package/docs/themes/citrine/light-mc.css +51 -0
  126. package/docs/themes/citrine/light.css +51 -0
  127. package/docs/themes/citrine/theme.css +306 -0
  128. package/docs/themes/olivegreen/dark-hc.css +51 -0
  129. package/docs/themes/olivegreen/dark-mc.css +51 -0
  130. package/docs/themes/olivegreen/dark.css +51 -0
  131. package/docs/themes/olivegreen/light-hc.css +51 -0
  132. package/docs/themes/olivegreen/light-mc.css +51 -0
  133. package/docs/themes/olivegreen/light.css +51 -0
  134. package/docs/themes/olivegreen/theme.css +306 -0
  135. package/package.json +62 -0
  136. package/styles/README.md +99 -0
  137. package/styles/elevation.scss +36 -0
  138. package/styles/motion.scss +124 -0
  139. package/styles/ripple.scss +50 -0
  140. package/styles/shapes.scss +46 -0
  141. package/styles/statelayer.scss +42 -0
  142. package/styles/typography.scss +568 -0
  143. package/styles.scss +43 -0
  144. package/themes/README.md +57 -0
  145. package/themes/airblue/dark-hc.css +51 -0
  146. package/themes/airblue/dark-mc.css +51 -0
  147. package/themes/airblue/dark.css +51 -0
  148. package/themes/airblue/light-hc.css +51 -0
  149. package/themes/airblue/light-mc.css +51 -0
  150. package/themes/airblue/light.css +51 -0
  151. package/themes/airblue/theme.css +306 -0
  152. package/themes/barnred/dark-hc.css +51 -0
  153. package/themes/barnred/dark-mc.css +51 -0
  154. package/themes/barnred/dark.css +51 -0
  155. package/themes/barnred/light-hc.css +51 -0
  156. package/themes/barnred/light-mc.css +51 -0
  157. package/themes/barnred/light.css +51 -0
  158. package/themes/barnred/theme.css +306 -0
  159. package/themes/citrine/dark-hc.css +51 -0
  160. package/themes/citrine/dark-mc.css +51 -0
  161. package/themes/citrine/dark.css +51 -0
  162. package/themes/citrine/light-hc.css +51 -0
  163. package/themes/citrine/light-mc.css +51 -0
  164. package/themes/citrine/light.css +51 -0
  165. package/themes/citrine/theme.css +306 -0
  166. package/themes/olivegreen/dark-hc.css +51 -0
  167. package/themes/olivegreen/dark-mc.css +51 -0
  168. package/themes/olivegreen/dark.css +51 -0
  169. package/themes/olivegreen/light-hc.css +51 -0
  170. package/themes/olivegreen/light-mc.css +51 -0
  171. package/themes/olivegreen/light.css +51 -0
  172. package/themes/olivegreen/theme.css +306 -0
  173. package/tsconfig.json +110 -0
  174. package/webpack.config.js +49 -0
@@ -0,0 +1,125 @@
1
+ # Card
2
+ This component implements the the [Material Design 3 Expressive Card](https://m3.material.io/components/cards/overview) design.
3
+
4
+ ## Basic Usage
5
+
6
+ ### HTML
7
+ To add a basic card, use a `<div>` element with one of the primary card style classes: `micl-card-elevated`, `micl-card-filled` or `micl-card-outlined`.
8
+
9
+ ```HTML
10
+ <div class="micl-card-elevated">
11
+ <p>This is a basic elevated card.</p>
12
+ </div>
13
+ ```
14
+
15
+ ### CSS
16
+ Import the card styles into your project:
17
+
18
+ ```CSS
19
+ @use "micl/components/card";
20
+ ```
21
+
22
+ ### TypeScript
23
+ No custom TypeScript is required for the core functionality of this component.
24
+
25
+ ### Demo
26
+ A live example of the [Card component](https://henkpb.github.io/micl/card.html) is available for you to interact with.
27
+
28
+ ## Variants
29
+ Cards come in **three distinct styles**:
30
+
31
+ - `micl-card-elevated`: A card with a subtle shadow, visually lifted from the background. This is the style shown in Basic Usage.
32
+
33
+ - `micl-card-filled`: A card with a solid background color, blending more seamlessly with its surroundings.
34
+ ```HTML
35
+ <div class="micl-card-filled">
36
+ <p>This is a filled card.</p>
37
+ </div>
38
+ ```
39
+
40
+ - `micl-card-outlined`: A card with a clear border, often used for less prominent content or to indicate interactivity.
41
+
42
+ ### Card Content Structure
43
+
44
+ While the card container is the only required element, the Card component provides several optional utility classes to help structure your card's content:
45
+ ```HTML
46
+ <div class="micl-card-outlined" tabindex="0">
47
+ <img alt="Descriptive image text" class="micl-card__image" src="/path/to/your/image.jpg">
48
+
49
+ <div class="micl-card__headline-m">
50
+ <h2>Card headline</h2>
51
+ </div>
52
+
53
+ <p class="micl-card__subhead">This is a sub-header</p>
54
+ <p class="micl-card__supporting-text">This is supporting text that provides more details about the card's content.</p>
55
+
56
+ <div class="micl-card__content">
57
+ <p>Additional content</p>
58
+ </div>
59
+ </div>
60
+ ```
61
+
62
+ - **Headline Classes**: Use these classes for prominent text within the card. They expect a child heading element (`<h1>`-`<h6>`).
63
+ - `micl-card__headline-s` (small)
64
+ - `micl-card__headline-m` (medium) - *Used in the example above*
65
+ - `micl-card__headline-l` (large)
66
+
67
+ - `micl-card__image`: Applies styling to an `<img>` element used as the primary image for the card.
68
+
69
+ - `micl-card__subhead`: For secondary headings, displayed with a smaller font than the main headline.
70
+
71
+ - `micl-card__supporting-text`: Intended for short descriptions or supplementary information, displayed with a smaller font.
72
+
73
+ - `micl-card__content`: A flexible container for the main body of your card's content.
74
+
75
+ ### Actionable Cards
76
+ For cards that are themselves clickable or interactive (e.g., to navigate to another page), specify the `tabindex="0"` attribute on the card container. Non-actionable cards, which contain interactive elements like buttons or links within their content, should *not* have a tabindex on the card container itself.
77
+
78
+ ### Expandable Cards
79
+ Cards can also serve as containers for expandable detail areas using the `<details>` and `<summary>` elements. In this scenario, the `<summary>` element becomes the actionable part of the card.
80
+
81
+ ```HTML
82
+ <details class="micl-card-elevated">
83
+ <summary>
84
+ <img alt="Image of a landscape" class="micl-card__image" src="/path/to/another/image.jpg">
85
+ <span class="micl-card__headline-m">
86
+ <span class="micl-heading">Expandable Card Title</span>
87
+ </span>
88
+ <span class="micl-card__supporting-text">Click to reveal more details.</span>
89
+ </summary>
90
+ <div class="micl-card__content">
91
+ <p>This is the hidden content that appears when the summary is clicked.</p>
92
+ </div>
93
+ </details>
94
+ ```
95
+
96
+ ### States
97
+ - **Disabled Cards**: To visually indicate a disabled card (e.g., non-interactive), add the `micl-card--disabled` class to the card container.
98
+
99
+ - **Dragging State**: When implementing drag-and-drop functionality for cards, apply the `micl-card--dragging` class to the card container to provide visual feedback during the drag operation.
100
+
101
+ ## Customizations
102
+ You can customize the appearance of the Card component by overriding its global CSS variables. These variables are declared on the `:root` pseudo-class and can be changed on any appropriate parent element to affect its child dividers.
103
+
104
+ | Variable name | Default Value | Description |
105
+ | ------------- | ----- | ----------- |
106
+ | --md-sys-card-margin | 8px | Sets the spacing between adjacent cards both horizontally and vertically |
107
+ | --md-sys-card-padding-inline | 16px | Defines the amount of space between the left and right edges of a card and its content |
108
+
109
+ **Example: Changing the card margins**
110
+
111
+ ```HTML
112
+ <div style="--md-sys-card-margin:4px">
113
+ <div class="micl-card-filled">
114
+ <p>This is a filled card.</p>
115
+ </div>
116
+ <div class="micl-card-filled">
117
+ <p>This is another filled card.</p>
118
+ </div>
119
+ </div>
120
+ ```
121
+
122
+ ## Compatibility
123
+ This component uses the `color-mix` CSS functional notation, which might not be supported in your browser. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color-mix#browser_compatibility) for details.
124
+
125
+ The Card component uses the `interpolate-size` CSS property to smoothly open and close the detail area of a Details disclosure element, which might not be supported in your browser. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/interpolate-size#browser_compatibility) for details.
@@ -0,0 +1,261 @@
1
+ //
2
+ // Copyright © 2025 Hermana AS
3
+ //
4
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ // of this software and associated documentation files (the "Software"), to deal
6
+ // in the Software without restriction, including without limitation the rights
7
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ // copies of the Software, and to permit persons to whom the Software is
9
+ // furnished to do so, subject to the following conditions:
10
+ //
11
+ // The above copyright notice and this permission notice shall be included in all
12
+ // copies or substantial portions of the Software.
13
+ //
14
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ // SOFTWARE.
21
+
22
+ @use '../../styles/motion';
23
+ @use '../../styles/ripple';
24
+ @use '../../styles/typography';
25
+
26
+ :root {
27
+ --md-sys-card-margin: 8px;
28
+ --md-sys-card-padding-inline: 16px;
29
+ }
30
+
31
+ .micl-card-elevated,
32
+ .micl-card-filled,
33
+ .micl-card-outlined {
34
+ height: fit-content;
35
+ margin: var(--md-sys-card-margin);
36
+ border-radius: var(--md-sys-shape-corner-medium);
37
+ overflow: hidden;
38
+ interpolate-size: allow-keywords;
39
+
40
+ &[tabindex='0']:not(.micl-card--disabled) {
41
+ --miclripple: 1;
42
+
43
+ @include ripple.effect;
44
+
45
+ &:hover {
46
+ box-shadow: var(--md-sys-elevation-level1);
47
+ cursor: pointer;
48
+ }
49
+ &:focus-visible {
50
+ outline: var(--md-sys-state-focus-indicator-thickness) solid var(--md-sys-color-secondary);
51
+ outline-offset: var(--md-sys-state-focus-indicator-outer-offset);
52
+ box-shadow: var(--md-sys-elevation-level1);
53
+ }
54
+ }
55
+ &:not([tabindex='0']):not(.micl-card--disabled):has(> summary:focus-visible) {
56
+ outline: var(--md-sys-state-focus-indicator-thickness) solid var(--md-sys-color-secondary);
57
+ outline-offset: var(--md-sys-state-focus-indicator-outer-offset);
58
+ }
59
+ &::details-content {
60
+ height: 0;
61
+ overflow: hidden;
62
+ transition:
63
+ content-visibility var(--md-sys-motion-duration-medium4) allow-discrete,
64
+ height var(--md-sys-motion-duration-medium4) linear(motion.$md-sys-motion-spring-default-spatial);
65
+ }
66
+ &[open]::details-content {
67
+ height: auto;
68
+ }
69
+ &> summary {
70
+ padding-block-end: 8px;
71
+ outline: none;
72
+ list-style: none;
73
+ cursor: pointer
74
+ }
75
+ }
76
+
77
+ .micl-card-elevated {
78
+ background-color: var(--md-sys-color-surface-container-low);
79
+ box-shadow: var(--md-sys-elevation-level1);
80
+
81
+ &[tabindex='0']:not(.micl-card--disabled) {
82
+ &:hover {
83
+ background-color: color-mix(in srgb, var(--md-sys-color-surface-container-low), var(--md-sys-color-on-surface) var(--md-sys-state-hover-state-layer-opacity));
84
+ box-shadow: var(--md-sys-elevation-level2);
85
+ }
86
+ &:focus-visible {
87
+ background-color: color-mix(in srgb, var(--md-sys-color-surface-container-low), var(--md-sys-color-on-surface) var(--md-sys-state-focus-state-layer-opacity));
88
+ }
89
+ &:active {
90
+ background-color: color-mix(in srgb, var(--md-sys-color-surface-container-low), var(--md-sys-color-on-surface) var(--md-sys-state-pressed-state-layer-opacity));
91
+ box-shadow: var(--md-sys-elevation-level1);
92
+ }
93
+ &.micl-card--dragging {
94
+ background-color: color-mix(in srgb, var(--md-sys-color-surface-container-low), var(--md-sys-color-on-surface) var(--md-sys-state-dragged-state-layer-opacity));
95
+ box-shadow: var(--md-sys-elevation-level4);
96
+ cursor: grabbing;
97
+ }
98
+ }
99
+ }
100
+ .micl-card-filled {
101
+ background-color: var(--md-sys-color-surface-container-highest);
102
+ box-shadow: var(--md-sys-elevation-level0);
103
+
104
+ &[tabindex='0']:not(.micl-card--disabled) {
105
+ &:hover {
106
+ background-color: color-mix(in srgb, var(--md-sys-color-surface-container-highest), var(--md-sys-color-on-surface) var(--md-sys-state-hover-state-layer-opacity));
107
+ }
108
+ &:focus-visible {
109
+ background-color: color-mix(in srgb, var(--md-sys-color-surface-container-highest), var(--md-sys-color-on-surface) var(--md-sys-state-focus-state-layer-opacity));
110
+ box-shadow: var(--md-sys-elevation-level0);
111
+ }
112
+ &:active {
113
+ background-color: color-mix(in srgb, var(--md-sys-color-surface-container-highest), var(--md-sys-color-on-surface) var(--md-sys-state-pressed-state-layer-opacity));
114
+ box-shadow: var(--md-sys-elevation-level0);
115
+ }
116
+ &.micl-card--dragging {
117
+ background-color: color-mix(in srgb, var(--md-sys-color-surface-container-highest), var(--md-sys-color-on-surface) var(--md-sys-state-dragged-state-layer-opacity));
118
+ box-shadow: var(--md-sys-elevation-level3);
119
+ cursor: grabbing;
120
+ }
121
+ }
122
+ }
123
+ .micl-card-outlined {
124
+ background-color: var(--md-sys-color-surface);
125
+ box-shadow: var(--md-sys-elevation-level0);
126
+ border: 1px solid var(--md-sys-color-outline-variant);
127
+
128
+ &[tabindex='0']:not(.micl-card--disabled) {
129
+ &:hover {
130
+ background-color: color-mix(in srgb, var(--md-sys-color-surface), var(--md-sys-color-on-surface) var(--md-sys-state-hover-state-layer-opacity));
131
+ }
132
+ &:focus-visible {
133
+ border-color: var(--md-sys-color-on-surface);
134
+ background-color: color-mix(in srgb, var(--md-sys-color-surface), var(--md-sys-color-on-surface) var(--md-sys-state-focus-state-layer-opacity));
135
+ box-shadow: var(--md-sys-elevation-level0);
136
+ }
137
+ &:active {
138
+ border-color: var(--md-sys-color-outline-variant);
139
+ background-color: color-mix(in srgb, var(--md-sys-color-surface), var(--md-sys-color-on-surface) var(--md-sys-state-pressed-state-layer-opacity));
140
+ box-shadow: var(--md-sys-elevation-level0);
141
+ }
142
+ &.micl-card--dragging {
143
+ background-color: color-mix(in srgb, var(--md-sys-color-surface), var(--md-sys-color-on-surface) var(--md-sys-state-dragged-state-layer-opacity));
144
+ box-shadow: var(--md-sys-elevation-level3);
145
+ cursor: grabbing;
146
+ }
147
+ }
148
+ }
149
+
150
+ .micl-card--disabled {
151
+ opacity: 38%;
152
+ pointer-events: none;
153
+
154
+ &.micl-card-elevated {
155
+ background-color: var(--md-sys-color-surface);
156
+ }
157
+ &.micl-card-filled {
158
+ background-color: var(--md-sys-color-surface-variant);
159
+ }
160
+ &.micl-card-outlined {
161
+ box-shadow: var(--md-sys-elevation-level0);
162
+ border-color: rgb(from var(--md-sys-color-outline) r g b / 12%);
163
+ }
164
+ }
165
+
166
+ .micl-card__image {
167
+ width: 100%;
168
+ border-radius: var(--md-sys-shape-corner-medium);
169
+ }
170
+
171
+ .micl-card__headline-s,
172
+ .micl-card__headline-m,
173
+ .micl-card__headline-l {
174
+ display: flex;
175
+ align-items: center;
176
+ column-gap: 8px;
177
+ margin-block: 8px;
178
+ color: var(--md-sys-color-on-surface-variant);
179
+
180
+ h1, h2, h3, h4, h5, h6, .micl-heading {
181
+ flex: 1 2 fit-content;
182
+ margin: 0;
183
+ padding-inline: var(--md-sys-card-padding-inline);
184
+ overflow: hidden;
185
+ text-overflow: ellipsis;
186
+ white-space: nowrap;
187
+
188
+ &:has(+ button) {
189
+ padding-inline-end: 0;
190
+ }
191
+ }
192
+ &:has(button) {
193
+ margin-block: 0;
194
+ }
195
+ }
196
+ .micl-card__headline-s {
197
+ h1, h2, h3, h4, h5, h6, .micl-heading {
198
+ @include typography.headline-small;
199
+ }
200
+ }
201
+ .micl-card__headline-m {
202
+ h1, h2, h3, h4, h5, h6, .micl-heading {
203
+ @include typography.headline-medium;
204
+ }
205
+ }
206
+ .micl-card__headline-l {
207
+ h1, h2, h3, h4, h5, h6, .micl-heading {
208
+ @include typography.headline-large;
209
+ }
210
+ }
211
+
212
+ .micl-card__subhead {
213
+ @include typography.title-medium;
214
+
215
+ display: block;
216
+ margin-block: 0 8px;
217
+ padding-inline: var(--md-sys-card-padding-inline);
218
+ overflow: hidden;
219
+ text-overflow: ellipsis;
220
+ white-space: nowrap;
221
+ color: var(--md-sys-color-on-surface-variant);
222
+ }
223
+
224
+ .micl-card__supporting-text {
225
+ @include typography.body-small;
226
+
227
+ display: block;
228
+ margin-block: 0 8px;
229
+ padding-inline: var(--md-sys-card-padding-inline);
230
+ color: var(--md-sys-color-on-surface-variant);
231
+ }
232
+
233
+ .micl-card-elevated[tabindex='0']:not(.micl-card--disabled),
234
+ .micl-card-filled[tabindex='0']:not(.micl-card--disabled),
235
+ .micl-card-outlined[tabindex='0']:not(.micl-card--disabled) {
236
+ &:hover,
237
+ &:focus-visible,
238
+ &:active,
239
+ &.micl-card--dragging {
240
+ .micl-card__headline-s,
241
+ .micl-card__headline-m,
242
+ .micl-card__headline-l {
243
+ color: var(--md-sys-color-on-surface);
244
+
245
+ button {
246
+ color: var(--md-sys-color-on-surface);
247
+ }
248
+ }
249
+ .micl-card__subhead,
250
+ .micl-card__supporting-text {
251
+ color: var(--md-sys-color-on-surface);
252
+ }
253
+ }
254
+ }
255
+
256
+ .micl-card__content {
257
+ box-sizing: border-box;
258
+ padding-inline: var(--md-sys-card-padding-inline);
259
+ background-color: inherit;
260
+ overflow: hidden;
261
+ }
@@ -0,0 +1,62 @@
1
+ # Checkbox
2
+ This component implements the the [Material Design 3 Expressive Checkbox](https://m3.material.io/components/checkbox/overview) design.
3
+
4
+ ## Basic Usage
5
+
6
+ ### HTML
7
+ To add a basic checkbox, use the `<input type="checkbox">` element with the `micl-checkbox` class, paired with a `<label>` element:
8
+
9
+ ```HTML
10
+ <input type="checkbox" id="mycheckbox" class="micl-checkbox" value="foo">
11
+ <label for="mycheckbox">Bar</label>
12
+ ```
13
+
14
+ ### CSS
15
+ Import the checkbox styles into your project:
16
+
17
+ ```CSS
18
+ @use "micl/components/checkbox";
19
+ ```
20
+
21
+ ### TypeScript
22
+ This component requires a TypeScript module to support checking and unchecking using a keyboard. You can import the specific module or use the main MICL TypeScript library, which handles initialization automatically.
23
+
24
+ To manually initialize the component:
25
+
26
+ ```TypeScript
27
+ import miclCheckbox from 'micl/components/checkbox';
28
+
29
+ miclCheckbox.initialize(document.querySelector('.micl-checkbox'));
30
+ ```
31
+
32
+ ### Demo
33
+ A live example of the [Checkbox component](https://henkpb.github.io/micl/checkbox.html) is available for you to interact with.
34
+
35
+ ## Variants
36
+ Adding the `micl-checkbox--error` CSS class to the `<input>` element will create an error-checkbox as specified by the Material Design 3 specification.
37
+
38
+ A checkbox can be disabled by adding the `disabled` attribute to the `<input>` element.
39
+
40
+ The Checkbox component respects the `dir` global attribute, automatically adjusting its layout for right-to-left (RTL) languages when `dir="rtl"` is applied to an ancestor element.
41
+
42
+ ## Customizations
43
+ You can customize the appearance of the Checkbox component by overriding its global CSS variables. These variables are declared on the :root pseudo-class and can be changed on any appropriate parent element to affect its child checkboxes.
44
+
45
+ | Variable name | Default Value | Description |
46
+ | ------------- | ------------- | ----------- |
47
+ | --md-sys-checkbox-border-width | 2px | Controls the thickness of the checkbox's border |
48
+ | --md-sys-checkbox-container-size | 18px | Defines the size of the checkbox itself |
49
+ | --md-sys-checkbox-selected-icon | \2A3D | The character used as the checkmark for the checkbox |
50
+ | --md-sys-checkbox-state-layer-radius | 20px | Sets the radius of the interactive area that indicates the component's current state (e.g., hover, focus, press) |
51
+
52
+ **Example: Changing the size of the interactive area**
53
+
54
+ ```HTML
55
+ <div style="--md-sys-checkbox-state-layer-radius:24px">
56
+ <input type="checkbox" id="mycheckbox" class="micl-checkbox">
57
+ <label for="mycheckbox">Checkbox</label>
58
+ </div>
59
+ ```
60
+
61
+ ## Compatibility
62
+ This component utilizes relative RGB color values, which may not be fully supported in your browser. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#browser_compatibility) for details.