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.
- package/.editorconfig +12 -0
- package/.gitattributes +9 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +35 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/LICENSE +21 -0
- package/README.md +99 -0
- package/components/README.md +12 -0
- package/components/accordion/README.md +94 -0
- package/components/bottomsheet/README.md +77 -0
- package/components/bottomsheet/bottomsheet.scss +134 -0
- package/components/bottomsheet/index.ts +152 -0
- package/components/button/README.md +92 -0
- package/components/button/button.scss +515 -0
- package/components/button/index.ts +73 -0
- package/components/card/README.md +125 -0
- package/components/card/card.scss +261 -0
- package/components/checkbox/README.md +62 -0
- package/components/checkbox/checkbox.scss +275 -0
- package/components/checkbox/index.ts +48 -0
- package/components/dialog/README.md +133 -0
- package/components/dialog/dialog.scss +262 -0
- package/components/divider/README.md +52 -0
- package/components/divider/divider.scss +74 -0
- package/components/iconbutton/README.md +86 -0
- package/components/iconbutton/iconbutton.scss +461 -0
- package/components/iconbutton/index.ts +73 -0
- package/components/list/README.md +176 -0
- package/components/list/index.ts +108 -0
- package/components/list/list.scss +295 -0
- package/components/menu/README.md +96 -0
- package/components/menu/index.ts +77 -0
- package/components/menu/menu.scss +124 -0
- package/components/radio/README.md +53 -0
- package/components/radio/radio.scss +138 -0
- package/components/select/README.md +84 -0
- package/components/select/select.scss +122 -0
- package/components/sidesheet/README.md +99 -0
- package/components/sidesheet/sidesheet.scss +162 -0
- package/components/slider/README.md +69 -0
- package/components/slider/index.ts +114 -0
- package/components/slider/slider.scss +258 -0
- package/components/switch/README.md +49 -0
- package/components/switch/switch.scss +176 -0
- package/components/textfield/README.md +75 -0
- package/components/textfield/index.ts +81 -0
- package/components/textfield/textfield.scss +387 -0
- package/components.ts +169 -0
- package/dist/bottomsheet.css +1 -0
- package/dist/bottomsheet.js +0 -0
- package/dist/button.css +1 -0
- package/dist/button.js +0 -0
- package/dist/card.css +1 -0
- package/dist/card.js +0 -0
- package/dist/checkbox.css +1 -0
- package/dist/checkbox.js +0 -0
- package/dist/dialog.css +1 -0
- package/dist/dialog.js +0 -0
- package/dist/divider.css +1 -0
- package/dist/divider.js +0 -0
- package/dist/iconbutton.css +1 -0
- package/dist/iconbutton.js +0 -0
- package/dist/list.css +1 -0
- package/dist/list.js +0 -0
- package/dist/menu.css +1 -0
- package/dist/menu.js +0 -0
- package/dist/micl.css +1 -0
- package/dist/micl.js +1 -0
- package/dist/radio.css +1 -0
- package/dist/radio.js +0 -0
- package/dist/select.css +1 -0
- package/dist/select.js +0 -0
- package/dist/sidesheet.css +1 -0
- package/dist/sidesheet.js +0 -0
- package/dist/slider.css +1 -0
- package/dist/slider.js +0 -0
- package/dist/switch.css +1 -0
- package/dist/switch.js +0 -0
- package/dist/textfield.css +1 -0
- package/dist/textfield.js +0 -0
- package/docs/accordion.html +285 -0
- package/docs/bottomsheet.html +162 -0
- package/docs/button.html +206 -0
- 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 +91 -0
- package/docs/checkbox.html +99 -0
- package/docs/dialog.html +153 -0
- package/docs/divider.html +103 -0
- package/docs/docs.css +34 -0
- package/docs/docs.js +69 -0
- package/docs/iconbutton.html +197 -0
- package/docs/index.html +319 -0
- package/docs/list.html +224 -0
- package/docs/menu.html +143 -0
- package/docs/micl.css +1 -0
- package/docs/micl.js +1 -0
- package/docs/radio.html +101 -0
- package/docs/select.html +205 -0
- package/docs/sidesheet.html +115 -0
- package/docs/slider.html +72 -0
- package/docs/switch.html +151 -0
- package/docs/textfield.html +151 -0
- package/docs/themes/airblue/dark-hc.css +51 -0
- package/docs/themes/airblue/dark-mc.css +51 -0
- package/docs/themes/airblue/dark.css +51 -0
- package/docs/themes/airblue/light-hc.css +51 -0
- package/docs/themes/airblue/light-mc.css +51 -0
- package/docs/themes/airblue/light.css +51 -0
- package/docs/themes/airblue/theme.css +306 -0
- package/docs/themes/barnred/dark-hc.css +51 -0
- package/docs/themes/barnred/dark-mc.css +51 -0
- package/docs/themes/barnred/dark.css +51 -0
- package/docs/themes/barnred/light-hc.css +51 -0
- package/docs/themes/barnred/light-mc.css +51 -0
- package/docs/themes/barnred/light.css +51 -0
- package/docs/themes/barnred/theme.css +306 -0
- package/docs/themes/citrine/dark-hc.css +51 -0
- package/docs/themes/citrine/dark-mc.css +51 -0
- package/docs/themes/citrine/dark.css +51 -0
- package/docs/themes/citrine/light-hc.css +51 -0
- package/docs/themes/citrine/light-mc.css +51 -0
- package/docs/themes/citrine/light.css +51 -0
- package/docs/themes/citrine/theme.css +306 -0
- package/docs/themes/olivegreen/dark-hc.css +51 -0
- package/docs/themes/olivegreen/dark-mc.css +51 -0
- package/docs/themes/olivegreen/dark.css +51 -0
- package/docs/themes/olivegreen/light-hc.css +51 -0
- package/docs/themes/olivegreen/light-mc.css +51 -0
- package/docs/themes/olivegreen/light.css +51 -0
- package/docs/themes/olivegreen/theme.css +306 -0
- package/package.json +62 -0
- package/styles/README.md +99 -0
- package/styles/elevation.scss +36 -0
- package/styles/motion.scss +124 -0
- package/styles/ripple.scss +50 -0
- package/styles/shapes.scss +46 -0
- package/styles/statelayer.scss +42 -0
- package/styles/typography.scss +568 -0
- package/styles.scss +43 -0
- package/themes/README.md +57 -0
- package/themes/airblue/dark-hc.css +51 -0
- package/themes/airblue/dark-mc.css +51 -0
- package/themes/airblue/dark.css +51 -0
- package/themes/airblue/light-hc.css +51 -0
- package/themes/airblue/light-mc.css +51 -0
- package/themes/airblue/light.css +51 -0
- package/themes/airblue/theme.css +306 -0
- package/themes/barnred/dark-hc.css +51 -0
- package/themes/barnred/dark-mc.css +51 -0
- package/themes/barnred/dark.css +51 -0
- package/themes/barnred/light-hc.css +51 -0
- package/themes/barnred/light-mc.css +51 -0
- package/themes/barnred/light.css +51 -0
- package/themes/barnred/theme.css +306 -0
- package/themes/citrine/dark-hc.css +51 -0
- package/themes/citrine/dark-mc.css +51 -0
- package/themes/citrine/dark.css +51 -0
- package/themes/citrine/light-hc.css +51 -0
- package/themes/citrine/light-mc.css +51 -0
- package/themes/citrine/light.css +51 -0
- package/themes/citrine/theme.css +306 -0
- package/themes/olivegreen/dark-hc.css +51 -0
- package/themes/olivegreen/dark-mc.css +51 -0
- package/themes/olivegreen/dark.css +51 -0
- package/themes/olivegreen/light-hc.css +51 -0
- package/themes/olivegreen/light-mc.css +51 -0
- package/themes/olivegreen/light.css +51 -0
- package/themes/olivegreen/theme.css +306 -0
- package/tsconfig.json +110 -0
- package/webpack.config.js +49 -0
|
@@ -0,0 +1,262 @@
|
|
|
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/typography';
|
|
24
|
+
|
|
25
|
+
:root {
|
|
26
|
+
--md-sys-dialog-padding: 24px;
|
|
27
|
+
--md-sys-dialog-dir-factor: 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[dir=rtl] {
|
|
31
|
+
--md-sys-dialog-dir-factor: -1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
dialog.micl-dialog,
|
|
35
|
+
dialog.micl-dialog-fullscreen {
|
|
36
|
+
box-sizing: border-box;
|
|
37
|
+
display: none;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
min-width: 280px;
|
|
40
|
+
max-width: 560px;
|
|
41
|
+
max-height: 100vh;
|
|
42
|
+
inset-block-start: anchor(start);
|
|
43
|
+
inset-inline-start: anchor(start);
|
|
44
|
+
transform: translate(calc(var(--md-sys-dialog-dir-factor) * -50%), -50%) scale(50%);
|
|
45
|
+
padding: 0;
|
|
46
|
+
margin: 0;
|
|
47
|
+
border: none;
|
|
48
|
+
border-radius: var(--md-sys-shape-corner-extra-large);
|
|
49
|
+
background-color: var(--md-sys-color-surface-container-high);
|
|
50
|
+
box-shadow: var(--md-sys-elevation-level3);
|
|
51
|
+
opacity: 0;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
interpolate-size: allow-keywords;
|
|
54
|
+
transition:
|
|
55
|
+
display var(--md-sys-motion-duration-medium1) allow-discrete,
|
|
56
|
+
overlay var(--md-sys-motion-duration-medium1) allow-discrete,
|
|
57
|
+
inset-block-start var(--md-sys-motion-duration-medium1) linear,
|
|
58
|
+
inset-inline-start var(--md-sys-motion-duration-medium1) linear,
|
|
59
|
+
opacity var(--md-sys-motion-duration-medium1) motion.$md-sys-motion-easing-emphasized-decelerate,
|
|
60
|
+
transform var(--md-sys-motion-duration-medium1) linear;
|
|
61
|
+
|
|
62
|
+
@starting-style {
|
|
63
|
+
height: fit-content;
|
|
64
|
+
width: fit-content;
|
|
65
|
+
inset-block-start: anchor(start);
|
|
66
|
+
inset-inline-start: anchor(start);
|
|
67
|
+
opacity: 0;
|
|
68
|
+
transform: translate(calc(var(--md-sys-dialog-dir-factor) * -50%), -50%) scale(50%);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&:popover-open,
|
|
72
|
+
&[open] {
|
|
73
|
+
display: flex;
|
|
74
|
+
inset-block-start: 50%;
|
|
75
|
+
inset-inline-start: 50%;
|
|
76
|
+
opacity: 1;
|
|
77
|
+
transform: translate(calc(var(--md-sys-dialog-dir-factor) * -50%), -50%) scale(100%);
|
|
78
|
+
transition:
|
|
79
|
+
display var(--md-sys-motion-duration-medium2) linear allow-discrete,
|
|
80
|
+
overlay var(--md-sys-motion-duration-medium2) linear allow-discrete,
|
|
81
|
+
inset-block-start var(--md-sys-motion-duration-medium2) linear,
|
|
82
|
+
inset-inline-start var(--md-sys-motion-duration-medium2) linear,
|
|
83
|
+
width var(--md-sys-motion-duration-medium2) linear,
|
|
84
|
+
height var(--md-sys-motion-duration-medium2) linear,
|
|
85
|
+
opacity var(--md-sys-motion-duration-medium2) motion.$md-sys-motion-easing-emphasized-accelerate,
|
|
86
|
+
transform var(--md-sys-motion-duration-medium2) linear;
|
|
87
|
+
|
|
88
|
+
@starting-style {
|
|
89
|
+
inset-block-start: anchor(start);
|
|
90
|
+
inset-inline-start: anchor(start);
|
|
91
|
+
opacity: 0;
|
|
92
|
+
transform: translate(calc(var(--md-sys-dialog-dir-factor) * -50%), -50%) scale(50%);
|
|
93
|
+
}
|
|
94
|
+
&::backdrop {
|
|
95
|
+
@starting-style {
|
|
96
|
+
background-color: rgba(0, 0, 0, 0);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
&:not([popover]) {
|
|
101
|
+
inset-block-start: 50%;
|
|
102
|
+
inset-inline-start: 50%;
|
|
103
|
+
|
|
104
|
+
@starting-style {
|
|
105
|
+
inset-block-start: 50%;
|
|
106
|
+
inset-inline-start: 50%;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&:popover-open,
|
|
110
|
+
&[open] {
|
|
111
|
+
@starting-style {
|
|
112
|
+
inset-block-start: 50%;
|
|
113
|
+
inset-inline-start: 50%;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&::backdrop {
|
|
119
|
+
background-color: rgba(0, 0, 0, 0);
|
|
120
|
+
transition:
|
|
121
|
+
display var(--md-sys-motion-duration-long2) linear allow-discrete,
|
|
122
|
+
overlay var(--md-sys-motion-duration-long2) linear allow-discrete,
|
|
123
|
+
background-color var(--md-sys-motion-duration-long2) linear;
|
|
124
|
+
}
|
|
125
|
+
&[open]::backdrop {
|
|
126
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
127
|
+
}
|
|
128
|
+
&:hover {
|
|
129
|
+
background-color: color-mix(in srgb, var(--md-sys-color-surface-container-high), var(--md-sys-color-primary) var(--md-sys-state-hover-state-layer-opacity));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.micl-dialog__headline {
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-direction: column;
|
|
135
|
+
flex-shrink: 0;
|
|
136
|
+
align-items: flex-start;
|
|
137
|
+
gap: 16px;
|
|
138
|
+
padding: var(--md-sys-dialog-padding);
|
|
139
|
+
background-color: transparent;
|
|
140
|
+
|
|
141
|
+
h1, h2, h3, h4, h5, h6, .micl-heading {
|
|
142
|
+
@include typography.headline-small;
|
|
143
|
+
|
|
144
|
+
flex: 1 1 100%;
|
|
145
|
+
margin: 0;
|
|
146
|
+
overflow: hidden;
|
|
147
|
+
text-overflow: ellipsis;
|
|
148
|
+
white-space: nowrap;
|
|
149
|
+
color: var(--md-sys-color-on-surface);
|
|
150
|
+
}
|
|
151
|
+
.micl-dialog__icon {
|
|
152
|
+
width: 24px;
|
|
153
|
+
height: 24px;
|
|
154
|
+
font-size: 24px;
|
|
155
|
+
color: var(--md-sys-color-secondary);
|
|
156
|
+
}
|
|
157
|
+
button {
|
|
158
|
+
display: none;
|
|
159
|
+
}
|
|
160
|
+
&+ .micl-dialog__actions {
|
|
161
|
+
padding-block-start: 0;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
.micl-dialog__headline:has(> .micl-dialog__icon) {
|
|
165
|
+
align-items: center;
|
|
166
|
+
}
|
|
167
|
+
.micl-dialog__subhead {
|
|
168
|
+
@include typography.title-medium;
|
|
169
|
+
|
|
170
|
+
padding-inline: var(--md-sys-dialog-padding);
|
|
171
|
+
overflow: hidden;
|
|
172
|
+
text-overflow: ellipsis;
|
|
173
|
+
white-space: nowrap;
|
|
174
|
+
color: var(--md-sys-color-on-surface)
|
|
175
|
+
}
|
|
176
|
+
.micl-dialog__supporting-text {
|
|
177
|
+
@include typography.body-medium;
|
|
178
|
+
|
|
179
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
180
|
+
}
|
|
181
|
+
.micl-dialog__content {
|
|
182
|
+
flex-shrink: 1;
|
|
183
|
+
padding-inline: var(--md-sys-dialog-padding);
|
|
184
|
+
background-color: inherit;
|
|
185
|
+
overflow-y: auto;
|
|
186
|
+
}
|
|
187
|
+
.micl-dialog__actions {
|
|
188
|
+
display: flex;
|
|
189
|
+
flex-shrink: 0;
|
|
190
|
+
justify-content: flex-end;
|
|
191
|
+
column-gap: 8px;
|
|
192
|
+
padding: var(--md-sys-dialog-padding);
|
|
193
|
+
opacity: 1;
|
|
194
|
+
transition: opacity var(--md-sys-motion-duration-medium1) linear;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
dialog.micl-dialog-fullscreen {
|
|
199
|
+
@media (max-width: 560px) {
|
|
200
|
+
width: 100vw;
|
|
201
|
+
height: 100vh;
|
|
202
|
+
max-width: 100vw;
|
|
203
|
+
border-radius: var(--md-sys-shape-corner-none);
|
|
204
|
+
background-color: var(--md-sys-color-surface);
|
|
205
|
+
box-shadow: var(--md-sys-elevation-level0);
|
|
206
|
+
timeline-scope: --headlineTimeline;
|
|
207
|
+
|
|
208
|
+
&:hover {
|
|
209
|
+
background-color: color-mix(in srgb, var(--md-sys-color-surface), var(--md-sys-color-primary) var(--md-sys-state-hover-state-layer-opacity));
|
|
210
|
+
}
|
|
211
|
+
.micl-dialog__headline {
|
|
212
|
+
height: 56px;
|
|
213
|
+
flex-direction: row;
|
|
214
|
+
align-items: center;
|
|
215
|
+
gap: 4px;
|
|
216
|
+
padding: 4px;
|
|
217
|
+
animation-name: headlineScroll;
|
|
218
|
+
animation-duration: 1ms;
|
|
219
|
+
animation-timeline: --headlineTimeline;
|
|
220
|
+
animation-fill-mode: forwards;
|
|
221
|
+
animation-range: 0% 20%;
|
|
222
|
+
z-index: 1;
|
|
223
|
+
|
|
224
|
+
h1, h2, h3, h4, h5, h6, .micl-heading {
|
|
225
|
+
@include typography.title-large;
|
|
226
|
+
|
|
227
|
+
margin: 0;
|
|
228
|
+
overflow: hidden;
|
|
229
|
+
text-overflow: ellipsis;
|
|
230
|
+
white-space: nowrap;
|
|
231
|
+
}
|
|
232
|
+
.micl-dialog__icon {
|
|
233
|
+
display:none;
|
|
234
|
+
}
|
|
235
|
+
button {
|
|
236
|
+
display: inline-block;
|
|
237
|
+
|
|
238
|
+
&.micl-button {
|
|
239
|
+
margin-right: 16px;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
.micl-dialog__content {
|
|
244
|
+
scroll-timeline: --headlineTimeline block;
|
|
245
|
+
scroll-timeline: --headlineTimeline vertical;
|
|
246
|
+
}
|
|
247
|
+
.micl-dialog__actions {
|
|
248
|
+
opacity: 0;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
@keyframes headlineScroll {
|
|
254
|
+
from {
|
|
255
|
+
background-color: transparent;
|
|
256
|
+
box-shadow: var(--md-sys-elevation-level0);
|
|
257
|
+
}
|
|
258
|
+
to {
|
|
259
|
+
background-color: var(--md-sys-color-surface-container);
|
|
260
|
+
box-shadow: var(--md-sys-elevation-level2);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Divider
|
|
2
|
+
This component implements the the [Material Design 3 Expressive Divider](https://m3.material.io/components/divider/overview) design.
|
|
3
|
+
|
|
4
|
+
## Basic Usage
|
|
5
|
+
|
|
6
|
+
### HTML
|
|
7
|
+
To add a basic divider, use the `<hr>` element with the `micl-divider` class:
|
|
8
|
+
|
|
9
|
+
```HTML
|
|
10
|
+
<hr class="micl-divider">
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### CSS
|
|
14
|
+
Import the divider styles into your project:
|
|
15
|
+
|
|
16
|
+
```CSS
|
|
17
|
+
@use "micl/components/divider";
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### TypeScript
|
|
21
|
+
No custom TypeScript is required for the core functionality of this component.
|
|
22
|
+
|
|
23
|
+
### Demo
|
|
24
|
+
A live example of the [Divider component](https://henkpb.github.io/micl/divider.html) is available for you to interact with.
|
|
25
|
+
|
|
26
|
+
## Variants
|
|
27
|
+
The Divider component offers five CSS classes for different divider styles:
|
|
28
|
+
|
|
29
|
+
| CSS class | Description |
|
|
30
|
+
| --------- | ----------- |
|
|
31
|
+
| micl-divider | A standard, full-width divider |
|
|
32
|
+
| micl-divider-inset | Indented equally on both the left and right sides |
|
|
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
|
+
| micl-divider-vertical | A vertical divider |
|
|
36
|
+
|
|
37
|
+
## Customizations
|
|
38
|
+
You can customize the appearance of the Divider 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.
|
|
39
|
+
|
|
40
|
+
| Variable name | Default Value | Description |
|
|
41
|
+
| ------------- | ----- | ----------- |
|
|
42
|
+
| --md-sys-divider-thickness | 1px | Controls the thickness (height for horizontal, width for vertical) of the divider |
|
|
43
|
+
| --md-sys-divider-inset-margin | 16px | Defines the indentation distance for inset dividers |
|
|
44
|
+
| --md-sys-divider-space | 4px | Sets the spacing between the divider and adjacent text or elements |
|
|
45
|
+
|
|
46
|
+
**Example: Changing the inset margin**
|
|
47
|
+
|
|
48
|
+
```HTML
|
|
49
|
+
<div style="--md-sys-divider-inset-margin:32px">
|
|
50
|
+
<hr class="micl-divider-inset">
|
|
51
|
+
</div>
|
|
52
|
+
```
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
:root {
|
|
23
|
+
--md-sys-divider-thickness: 1px;
|
|
24
|
+
--md-sys-divider-inset-margin: 16px;
|
|
25
|
+
--md-sys-divider-space: 4px;
|
|
26
|
+
}
|
|
27
|
+
body {
|
|
28
|
+
--md-sys-divider-color: var(--md-sys-color-outline-variant);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.micl-divider {
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 0;
|
|
34
|
+
margin-block: var(--md-sys-divider-space);
|
|
35
|
+
margin-inline: 0;
|
|
36
|
+
border: 0;
|
|
37
|
+
border-block-start: var(--md-sys-divider-thickness) solid var(--md-sys-divider-color);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.micl-divider-inset {
|
|
41
|
+
width: calc(100% - 2 * var(--md-sys-divider-inset-margin));
|
|
42
|
+
height: 0;
|
|
43
|
+
margin-block: var(--md-sys-divider-space);
|
|
44
|
+
margin-inline: var(--md-sys-divider-inset-margin);
|
|
45
|
+
border: 0;
|
|
46
|
+
border-block-start: var(--md-sys-divider-thickness) solid var(--md-sys-divider-color);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.micl-divider-inset--start {
|
|
50
|
+
width: calc(100% - var(--md-sys-divider-inset-margin));
|
|
51
|
+
height: 0;
|
|
52
|
+
margin-block: var(--md-sys-divider-space);
|
|
53
|
+
margin-inline: var(--md-sys-divider-inset-margin) 0;
|
|
54
|
+
border: 0;
|
|
55
|
+
border-block-start: var(--md-sys-divider-thickness) solid var(--md-sys-divider-color);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.micl-divider-inset--end {
|
|
59
|
+
width: calc(100% - var(--md-sys-divider-inset-margin));
|
|
60
|
+
height: 0;
|
|
61
|
+
margin-block: var(--md-sys-divider-space);
|
|
62
|
+
margin-inline: 0 var(--md-sys-divider-inset-margin);
|
|
63
|
+
border: 0;
|
|
64
|
+
border-block-start: var(--md-sys-divider-thickness) solid var(--md-sys-divider-color);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.micl-divider-vertical {
|
|
68
|
+
min-height: 100%;
|
|
69
|
+
width: 0;
|
|
70
|
+
margin-block: 0;
|
|
71
|
+
margin-inline: calc(2 * var(--md-sys-divider-space));
|
|
72
|
+
border: 0;
|
|
73
|
+
border-inline-start: var(--md-sys-divider-thickness) solid var(--md-sys-divider-color);
|
|
74
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Icon button
|
|
2
|
+
This component implements the the [Material Design 3 Expressive Icon button](https://m3.material.io/components/icon-buttons/overview) design. Icon buttons allow users to perform a single action with a minimal visual footprint.
|
|
3
|
+
|
|
4
|
+
## Basic Usage
|
|
5
|
+
|
|
6
|
+
### HTML
|
|
7
|
+
To create a basic icon button, use the `<button>` element with a class that specifies its style and size. This example uses a small standard icon button with a Material Symbol:
|
|
8
|
+
|
|
9
|
+
```HTML
|
|
10
|
+
<button type="button" class="micl-iconbutton-standard-s material-symbols-outlined" aria-label="Control Panel">settings</button>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Important**: The `aria-label` attribute is crucial for accessibility, as it provides a descriptive text for screen readers.
|
|
14
|
+
|
|
15
|
+
### CSS
|
|
16
|
+
Import the icon button styles into your project:
|
|
17
|
+
|
|
18
|
+
```CSS
|
|
19
|
+
@use "micl/components/iconbutton";
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### TypeScript
|
|
23
|
+
This component requires a TypeScript module for interactive features like the **ripple effect** and **toggle logic**. You can import the specific module and handle initialization manually, or use the main MICL library for automatic initialization.
|
|
24
|
+
|
|
25
|
+
To manually initialize the component:
|
|
26
|
+
|
|
27
|
+
```TypeScript
|
|
28
|
+
import miclIconButton from 'micl/components/button';
|
|
29
|
+
|
|
30
|
+
miclIconButton.initialize(document.querySelector('.micl-iconbutton-standard-s'));
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Demo
|
|
34
|
+
A live example of the [Icon button component](https://henkpb.github.io/micl/iconbutton.html) is available for you to interact with.
|
|
35
|
+
|
|
36
|
+
## Variants
|
|
37
|
+
Icon buttons come in **five sizes**: extra small (`xs`), small (`s`), medium (`m`), large (`l`), and extra large (`xl`). To specify a size, append the appropriate postfix to the button's style class:
|
|
38
|
+
|
|
39
|
+
**Example: An extra-large icon button**
|
|
40
|
+
|
|
41
|
+
```HTML
|
|
42
|
+
<button type="button" class="micl-iconbutton-standard-xl material-symbols-outlined" aria-label="Control Panel">settings</button>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Material Design provides **four distinct styles**: `standard`, `filled`, `tonal` and `outlined`. To use a style other than the `standard` style used above, apply the corresponding class to the button:
|
|
46
|
+
|
|
47
|
+
**Example: A medium-sized filled icon button**
|
|
48
|
+
|
|
49
|
+
```HTML
|
|
50
|
+
<button type="button" class="micl-iconbutton-filled-m material-symbols-outlined" aria-label="Control Panel">settings</button>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
By default, icon buttons have a **rounded shape**. For a more square-like appearance, add the `micl-button--square` class.
|
|
54
|
+
|
|
55
|
+
To reduce the width of an icon button, add the `micl-iconbutton--narrow` class. For an increased width, use the `micl-iconbutton--wide` class.
|
|
56
|
+
|
|
57
|
+
Adding the `disabled` boolean attribute to the button causes the button to be displayed in a disabled state.
|
|
58
|
+
|
|
59
|
+
### Toggle Button
|
|
60
|
+
A toggle button has two states: **on** (selected) and **off** (unselected). To create one, add the `micl-button--toggle` class.
|
|
61
|
+
- **Off state**: The button has the `micl-button--toggle` class.
|
|
62
|
+
- **On state**: The button has both the `micl-button--toggle` and `micl-button--selected` classes.
|
|
63
|
+
|
|
64
|
+
**Example: A selected toggle button**
|
|
65
|
+
|
|
66
|
+
```HTML
|
|
67
|
+
<button type="button" class="micl-iconbutton-outlined-l micl-button--toggle micl-button--selected material-symbols-outlined" aria-label="Control Panel">settings</button>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Icons
|
|
71
|
+
The examples above use [Google Material Symbols](https://fonts.google.com/icons). For buttons using these icons, a fill-style of `1` is applied when the button is active or hovered over. To enable this effect, ensure your `link` tag includes `FILL@0..1`.
|
|
72
|
+
|
|
73
|
+
```HTML
|
|
74
|
+
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:FILL@0..1" rel="stylesheet" />
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
You can also use other icon libraries. For example, with the [Bootstrap Icons library](https://icons.getbootstrap.com):
|
|
78
|
+
|
|
79
|
+
```HTML
|
|
80
|
+
<button type="button" class="micl-iconbutton-tonal-m" aria-label="Control Panel">
|
|
81
|
+
<i class="bi bi-gear"></i>
|
|
82
|
+
</button>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Compatibility
|
|
86
|
+
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.
|