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
|
@@ -0,0 +1,185 @@
|
|
|
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 '../../foundations/layout';
|
|
23
|
+
@use '../../styles/elevation';
|
|
24
|
+
@use '../../styles/statelayer';
|
|
25
|
+
@use '../navigationrail/navitem';
|
|
26
|
+
|
|
27
|
+
@include elevation.level(0);
|
|
28
|
+
@include elevation.level(2);
|
|
29
|
+
|
|
30
|
+
@include statelayer.token('hover-state-layer-opacity');
|
|
31
|
+
@include statelayer.token('focus-state-layer-opacity');
|
|
32
|
+
@include statelayer.token('pressed-state-layer-opacity');
|
|
33
|
+
@include statelayer.token('ripple-opacity-factor');
|
|
34
|
+
@include statelayer.token('ripple-duration');
|
|
35
|
+
@include statelayer.property;
|
|
36
|
+
@include statelayer.keyframes;
|
|
37
|
+
|
|
38
|
+
nav.micl-navigationbar {
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
position: fixed;
|
|
41
|
+
inset-block: auto 0;
|
|
42
|
+
inset-inline: 0;
|
|
43
|
+
padding-block-end: env(safe-area-inset-bottom);
|
|
44
|
+
background-color: var(--md-comp-nav-bar-container-color, var(--md-sys-color-surface-container));
|
|
45
|
+
box-shadow: var(--md-comp-nav-bar-container-elevation, var(--md-sys-elevation-level2));
|
|
46
|
+
border-radius: var(--md-comp-nav-bar-container-shape, 0px);
|
|
47
|
+
z-index: 9;
|
|
48
|
+
|
|
49
|
+
&> .micl-navigationbar__content {
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: flex-start;
|
|
53
|
+
justify-content: space-evenly;
|
|
54
|
+
block-size: var(--md-comp-nav-bar-container-height, 64px);
|
|
55
|
+
padding-block-start: 6px;
|
|
56
|
+
|
|
57
|
+
&> a.micl-navigationbar__item {
|
|
58
|
+
@extend %micl-navitem;
|
|
59
|
+
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
inline-size: var(--md-comp-nav-bar-item-vertical-active-indicator-width, 56px);
|
|
62
|
+
block-size: var(--md-comp-nav-bar-item-vertical-active-indicator-height, 32px);
|
|
63
|
+
border-radius: var(--md-comp-nav-bar-item-active-indicator-shape, calc(var(--md-comp-nav-bar-item-vertical-active-indicator-height, 32px) / 2));
|
|
64
|
+
|
|
65
|
+
.micl-navigationbar__icon {
|
|
66
|
+
@extend %micl-navitem-icon;
|
|
67
|
+
font-size: var(--md-comp-nav-bar-item-icon-size, var(--md-sys-icon-size));
|
|
68
|
+
inline-size: var(--md-comp-nav-bar-item-icon-size, var(--md-sys-icon-size));
|
|
69
|
+
padding-inline: 16px;
|
|
70
|
+
}
|
|
71
|
+
.micl-navigationbar__text {
|
|
72
|
+
@extend %micl-navitem-text;
|
|
73
|
+
margin-block-start: var(--md-comp-nav-bar-item-active-indicator-icon-label-space, 4px);
|
|
74
|
+
white-space: nowrap;
|
|
75
|
+
text-overflow: ellipsis;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&> a.micl-navigationbar__item[aria-current="page"] {
|
|
80
|
+
@extend %micl-navitem-current;
|
|
81
|
+
|
|
82
|
+
.micl-navigationbar__icon {
|
|
83
|
+
@extend %micl-navitem-current-icon;
|
|
84
|
+
}
|
|
85
|
+
.micl-navigationbar__text {
|
|
86
|
+
@extend %micl-navitem-current-text;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Tall bar (80px): the item stack is vertically centered
|
|
92
|
+
&.micl-navigationbar--tall > .micl-navigationbar__content {
|
|
93
|
+
block-size: var(--md-comp-nav-bar-tall-container-height, 80px);
|
|
94
|
+
padding-block-start: 14px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Horizontal items: icon and label side by side in a 40px pill
|
|
98
|
+
&.micl-navigationbar--horizontal > .micl-navigationbar__content {
|
|
99
|
+
align-items: center;
|
|
100
|
+
padding-block-start: 0;
|
|
101
|
+
|
|
102
|
+
&> a.micl-navigationbar__item {
|
|
103
|
+
flex-direction: row;
|
|
104
|
+
inline-size: fit-content;
|
|
105
|
+
max-inline-size: 100%;
|
|
106
|
+
block-size: var(--md-comp-nav-bar-item-horizontal-active-indicator-height, 40px);
|
|
107
|
+
border-radius: var(--md-comp-nav-bar-item-active-indicator-shape, calc(var(--md-comp-nav-bar-item-horizontal-active-indicator-height, 40px) / 2));
|
|
108
|
+
|
|
109
|
+
.micl-navigationbar__icon {
|
|
110
|
+
padding-inline:
|
|
111
|
+
var(--md-comp-nav-bar-item-horizontal-active-indicator-leading-space, 16px)
|
|
112
|
+
var(--md-comp-nav-bar-item-active-indicator-icon-label-space, 4px);
|
|
113
|
+
}
|
|
114
|
+
.micl-navigationbar__text {
|
|
115
|
+
margin-block-start: 0;
|
|
116
|
+
padding-inline-end: var(--md-comp-nav-bar-item-horizontal-active-indicator-trailing-space, 16px);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Reserve space at the bottom of the page for the fixed navigation bar
|
|
123
|
+
// (higher specificity than the padding shorthand of body.micl-window)
|
|
124
|
+
body:has(nav.micl-navigationbar) {
|
|
125
|
+
padding-block-end: calc(var(--md-comp-nav-bar-container-height, 64px) + env(safe-area-inset-bottom));
|
|
126
|
+
}
|
|
127
|
+
body:has(nav.micl-navigationbar--tall) {
|
|
128
|
+
padding-block-end: calc(var(--md-comp-nav-bar-tall-container-height, 80px) + env(safe-area-inset-bottom));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Adaptive navigation: a navigation bar below the named breakpoint and a
|
|
132
|
+
// collapsed navigation rail (using the nav-rail tokens) at the breakpoint
|
|
133
|
+
// and above. The item anatomy is shared, so only the container changes.
|
|
134
|
+
$_breakpoints: (
|
|
135
|
+
medium: layout.$md-sys-breakpoint-medium-min,
|
|
136
|
+
expanded: layout.$md-sys-breakpoint-expanded-min,
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
@each $name, $min in $_breakpoints {
|
|
140
|
+
@media (min-width: $min) {
|
|
141
|
+
nav.micl-navigationbar--bar-to-#{$name} {
|
|
142
|
+
display: flex;
|
|
143
|
+
flex-direction: column;
|
|
144
|
+
position: sticky;
|
|
145
|
+
float: inline-start;
|
|
146
|
+
inset: unset;
|
|
147
|
+
inset-block-start: 0;
|
|
148
|
+
inline-size: var(--md-comp-nav-rail-collapsed-container-width, 96px);
|
|
149
|
+
block-size: 100vh;
|
|
150
|
+
min-block-size: 100%;
|
|
151
|
+
margin-inline: calc(-1 * var(--md-sys-layout-window-margin, 0px)) auto;
|
|
152
|
+
padding-block: var(--md-comp-nav-rail-collapsed-top-space, 44px) 0;
|
|
153
|
+
background-color: var(--md-comp-nav-rail-collapsed-container-color, var(--md-sys-color-surface));
|
|
154
|
+
box-shadow: var(--md-comp-nav-rail-collapsed-container-elevation, var(--md-sys-elevation-level0));
|
|
155
|
+
border-radius: var(--md-comp-nav-rail-collapsed-container-shape, 0px);
|
|
156
|
+
border-inline-end: var(--md-comp-nav-rail-divider-thickness, 0px) solid var(--md-comp-nav-rail-divider-color, var(--md-comp-divider-color));
|
|
157
|
+
overflow: hidden;
|
|
158
|
+
|
|
159
|
+
&> .micl-navigationbar__content {
|
|
160
|
+
flex: 1 1 auto;
|
|
161
|
+
flex-direction: column;
|
|
162
|
+
justify-content: flex-start;
|
|
163
|
+
inline-size: 100%;
|
|
164
|
+
block-size: auto;
|
|
165
|
+
row-gap: var(--md-comp-nav-rail-item-container-vertical-space, 6px);
|
|
166
|
+
padding-block: var(--md-comp-nav-rail-item-header-space-minimum, 40px) 16px;
|
|
167
|
+
padding-inline: 20px;
|
|
168
|
+
overflow: hidden auto;
|
|
169
|
+
|
|
170
|
+
&> a.micl-navigationbar__item {
|
|
171
|
+
margin-block-end: 40px;
|
|
172
|
+
row-gap: var(--md-comp-nav-rail-collapsed-item-vertical-space, 4px);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// in rail mode the bottom of the page no longer needs to be reserved
|
|
178
|
+
body.micl-window:has(nav.micl-navigationbar--bar-to-#{$name}) {
|
|
179
|
+
padding-block-end: var(--md-sys-layout-window-margin, 0px);
|
|
180
|
+
}
|
|
181
|
+
body:not(.micl-window):has(nav.micl-navigationbar--bar-to-#{$name}) {
|
|
182
|
+
padding-block-end: 0;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -25,6 +25,7 @@ To create a simple navigation rail, use a `<nav>` element with the `micl-navigat
|
|
|
25
25
|
Import the navigation rail styles into your project:
|
|
26
26
|
|
|
27
27
|
```CSS
|
|
28
|
+
@use "material-inspired-component-library/dist/iconbutton";
|
|
28
29
|
@use "material-inspired-component-library/dist/navigationrail";
|
|
29
30
|
```
|
|
30
31
|
|
|
@@ -53,6 +54,7 @@ The basic example creates a **collapsed** navigation rail. Add a menu button to
|
|
|
53
54
|
type="button"
|
|
54
55
|
id="mybutton"
|
|
55
56
|
class="micl-iconbutton-standard-s micl-button--toggle material-symbols-outlined"
|
|
57
|
+
aria-pressed="false"
|
|
56
58
|
command="--micl-toggle"
|
|
57
59
|
commandfor="mybutton"
|
|
58
60
|
data-miclicon="menu"
|
|
@@ -66,7 +68,7 @@ The basic example creates a **collapsed** navigation rail. Add a menu button to
|
|
|
66
68
|
</nav>
|
|
67
69
|
```
|
|
68
70
|
|
|
69
|
-
When the user clicks the menu button, the navigation rail is expanded and the toggle button is given
|
|
71
|
+
When the user clicks the menu button, the navigation rail is expanded and the toggle button is given `aria-pressed="true"` and the `micl-button--toggled` class that indicates that the toggle button has been clicked at least once.
|
|
70
72
|
|
|
71
73
|
### Modal navigation rail
|
|
72
74
|
|
|
@@ -100,47 +102,70 @@ A **modal** navigation rail is hidden until the user clicks a menu button. When
|
|
|
100
102
|
|
|
101
103
|
The button inside the navigation rail is used to hide the navigation rail, while the button outside is responsible for opening it.
|
|
102
104
|
|
|
103
|
-
|
|
104
|
-
You can customize the appearance of the Navigation rail 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 navigation rails.
|
|
105
|
+
### Adaptive navigation rail
|
|
105
106
|
|
|
106
|
-
|
|
107
|
-
| ------------- | ------------- | ----------- |
|
|
108
|
-
| --md-comp-nav-rail-divider-thickness | 0px | The width of the vertical divider at the end of the rail |
|
|
109
|
-
| --md-comp-nav-rail-divider-color | | The color of the vertical divider |
|
|
107
|
+
An **adaptive** navigation rail is permanently visible as a standard (expanded) navigation rail on wide screens, and acts as a modal navigation rail on narrow screens. Add one of the following modifier classes to a modal navigation rail:
|
|
110
108
|
|
|
111
|
-
|
|
109
|
+
| Class | Modal below | Standard from |
|
|
110
|
+
| ----- | ----------- | ------------- |
|
|
111
|
+
| `micl-navigationrail--modal-to-medium` | `600px` | `600px` |
|
|
112
|
+
| `micl-navigationrail--modal-to-expanded` | `840px` | `840px` |
|
|
113
|
+
| `micl-navigationrail--modal-to-large` | `1200px` | `1200px` |
|
|
114
|
+
| `micl-navigationrail--modal-to-extralarge` | `1600px` | `1600px` |
|
|
115
|
+
|
|
116
|
+
```HTML
|
|
117
|
+
<dialog id="mynavigationrail" class="micl-navigationrail micl-navigationrail--modal-to-expanded" closedby="closerequest">
|
|
118
|
+
...
|
|
119
|
+
</dialog>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Place the `<dialog>` element where a standard `<nav>` navigation rail would go, so that it occupies its usual position when the wide-screen layout applies. The open and close buttons only serve the modal behaviour, so hide them on wide screens, for example:
|
|
112
123
|
|
|
113
124
|
```CSS
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
--md-comp-nav-rail-item-short-container-height
|
|
120
|
-
--md-comp-nav-rail-item-container-shape
|
|
121
|
-
--md-comp-nav-rail-item-container-vertical-space
|
|
122
|
-
--md-comp-nav-rail-item-header-space-minimum
|
|
123
|
-
--md-comp-nav-rail-collapsed-container-width
|
|
124
|
-
--md-comp-nav-rail-collapsed-narrow-container-width
|
|
125
|
-
--md-comp-nav-rail-collapsed-container-elevation
|
|
126
|
-
--md-comp-nav-rail-collapsed-container-shape
|
|
127
|
-
--md-comp-nav-rail-collapsed-container-color
|
|
128
|
-
--md-comp-nav-rail-collapsed-item-vertical-space
|
|
129
|
-
--md-comp-nav-rail-collapsed-top-space
|
|
130
|
-
--md-comp-nav-rail-expanded-container-width-minimum
|
|
131
|
-
--md-comp-nav-rail-expanded-container-width-maximum
|
|
132
|
-
--md-comp-nav-rail-expanded-top-space
|
|
133
|
-
--md-comp-nav-rail-expanded-container-elevation
|
|
134
|
-
--md-comp-nav-rail-expanded-modal-container-elevation
|
|
135
|
-
--md-comp-nav-rail-expanded-container-color
|
|
136
|
-
--md-comp-nav-rail-expanded-modal-container-color
|
|
137
|
-
--md-comp-nav-rail-expanded-container-shape
|
|
138
|
-
--md-comp-nav-rail-expanded-modal-container-shape
|
|
139
|
-
--md-comp-nav-rail-item-vertical-active-indicator-height
|
|
140
|
-
--md-comp-nav-rail-item-vertical-active-indicator-width
|
|
141
|
-
--md-comp-nav-rail-item-horizontal-full-width-leading-space
|
|
125
|
+
@media (min-width: 840px) {
|
|
126
|
+
[commandfor="mynavigationrail"] {
|
|
127
|
+
display: none;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
142
130
|
```
|
|
143
131
|
|
|
132
|
+
> [!NOTE]
|
|
133
|
+
> If the modal navigation rail is open while the window is resized across the breakpoint, it remains modal until dismissed, after which it becomes the permanently visible standard rail.
|
|
134
|
+
|
|
135
|
+
## Theming
|
|
136
|
+
Each navigation rail can be themed with CSS custom properties that follow the Material Design 3 component-token naming convention.
|
|
137
|
+
|
|
138
|
+
| Custom property | Meaning | Default |
|
|
139
|
+
|---|---|---|
|
|
140
|
+
| `--md-comp-nav-rail-divider-thickness` | The width of the vertical divider at the end of the rail | `0px` |
|
|
141
|
+
| `--md-comp-nav-rail-divider-color` | The color of the vertical divider | `--md-comp-divider-color` |
|
|
142
|
+
| `--md-comp-nav-rail-collapsed-container-width` | The width of the collapsed navigation rail | `96px` |
|
|
143
|
+
| `--md-comp-nav-rail-collapsed-container-color` | The background color of the collapsed navigation rail | `--md-sys-color-surface` |
|
|
144
|
+
| `--md-comp-nav-rail-collapsed-container-elevation` | The shadow (elevation) of the collapsed navigation rail | `--md-sys-elevation-level0` |
|
|
145
|
+
| `--md-comp-nav-rail-collapsed-container-shape` | The corner rounding of the collapsed navigation rail | `0px` |
|
|
146
|
+
| `--md-comp-nav-rail-collapsed-top-space` | The space between the top edge and the header of the collapsed navigation rail | `44px` |
|
|
147
|
+
| `--md-comp-nav-rail-collapsed-item-vertical-space` | The space between the icon and the label of a collapsed item | `4px` |
|
|
148
|
+
| `--md-comp-nav-rail-expanded-container-width-minimum` | The smallest allowed width of the expanded navigation rail | `220px` |
|
|
149
|
+
| `--md-comp-nav-rail-expanded-container-width-maximum` | The largest allowed width of the expanded navigation rail | `360px` |
|
|
150
|
+
| `--md-comp-nav-rail-expanded-container-color` | The background color of the expanded navigation rail | `--md-sys-color-surface` |
|
|
151
|
+
| `--md-comp-nav-rail-expanded-container-elevation` | The shadow (elevation) of the expanded navigation rail | `--md-sys-elevation-level0` |
|
|
152
|
+
| `--md-comp-nav-rail-expanded-container-shape` | The corner rounding of the expanded navigation rail | `0px` |
|
|
153
|
+
| `--md-comp-nav-rail-expanded-top-space` | The space between the top edge and the header of the expanded navigation rail | `44px` |
|
|
154
|
+
| `--md-comp-nav-rail-expanded-modal-container-color` | The background color of the modal navigation rail | `--md-sys-color-surface-container` |
|
|
155
|
+
| `--md-comp-nav-rail-expanded-modal-container-elevation` | The shadow (elevation) of the modal navigation rail | `--md-sys-elevation-level2` |
|
|
156
|
+
| `--md-comp-nav-rail-expanded-modal-container-shape` | The corner rounding of the modal navigation rail, applied to the two corners facing the content | `--md-sys-shape-corner-large` |
|
|
157
|
+
| `--md-comp-nav-rail-item-icon-size` | The size of the item icons | `--md-sys-icon-size` |
|
|
158
|
+
| `--md-comp-nav-rail-item-container-shape` | The corner rounding of an item's active indicator | half the item height |
|
|
159
|
+
| `--md-comp-nav-rail-item-container-vertical-space` | The vertical space between items | `6px` |
|
|
160
|
+
| `--md-comp-nav-rail-item-header-space-minimum` | The minimum space between the header and the first item | `40px` |
|
|
161
|
+
| `--md-comp-nav-rail-item-short-container-height` | The height of items in an expanded navigation rail, and of items without a label | `56px` |
|
|
162
|
+
| `--md-comp-nav-rail-item-vertical-active-indicator-width` | The width of an item's active indicator in a collapsed navigation rail | `56px` |
|
|
163
|
+
| `--md-comp-nav-rail-item-vertical-active-indicator-height` | The height of an item's active indicator in a collapsed navigation rail | `32px` |
|
|
164
|
+
| `--md-comp-nav-rail-item-active-indicator-leading-space` | The space between the start edge of the active indicator and the icon | `16px` |
|
|
165
|
+
| `--md-comp-nav-rail-item-active-indicator-trailing-space` | The space between the icon and the end edge of the active indicator | `16px` |
|
|
166
|
+
| `--md-comp-nav-rail-item-active-indicator-icon-label-space` | The space between the icon and the label of an expanded item | `8px` |
|
|
167
|
+
| `--md-comp-nav-rail-item-horizontal-full-width-trailing-space` | The space between the end of an expanded item's click target and the container edge | `16px` |
|
|
168
|
+
|
|
144
169
|
**Example: Changing the width of the collapsed navigation rail**
|
|
145
170
|
|
|
146
171
|
```HTML
|
|
@@ -151,7 +176,7 @@ The Navigation rail component supports the following CSS variables, as defined i
|
|
|
151
176
|
</div>
|
|
152
177
|
```
|
|
153
178
|
|
|
154
|
-
To add a vertical divider
|
|
179
|
+
To add a vertical divider to the navigation rail, set the following CSS variable:
|
|
155
180
|
|
|
156
181
|
```CSS
|
|
157
182
|
#mynavigationrail {
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
// Shared navigation item anatomy, used by the Navigation rail and the
|
|
23
|
+
// Navigation bar components (placeholders only — emits no CSS on its own).
|
|
24
|
+
// The two components share the MD3 item colors, state layers and ripple;
|
|
25
|
+
// geometry and component tokens stay with each component.
|
|
26
|
+
|
|
27
|
+
@use '../../styles/motion';
|
|
28
|
+
@use '../../styles/typography';
|
|
29
|
+
|
|
30
|
+
@include typography.scale('label-medium');
|
|
31
|
+
|
|
32
|
+
%micl-navitem {
|
|
33
|
+
--micl-ripple: 1;
|
|
34
|
+
--statelayer-color: var(--md-sys-color-on-secondary-container);
|
|
35
|
+
|
|
36
|
+
box-sizing: border-box;
|
|
37
|
+
display: flex;
|
|
38
|
+
position: relative;
|
|
39
|
+
align-items: center;
|
|
40
|
+
outline: none;
|
|
41
|
+
text-decoration: none;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
|
|
44
|
+
overflow: visible;
|
|
45
|
+
background-color: transparent;
|
|
46
|
+
background-image:
|
|
47
|
+
radial-gradient(
|
|
48
|
+
circle at var(--micl-x, center) var(--micl-y, center),
|
|
49
|
+
transparent 0%,
|
|
50
|
+
rgb(from var(--statelayer-color) r g b / calc(var(--statelayer-opacity) * var(--md-sys-state-ripple-opacity-factor))) 10%,
|
|
51
|
+
transparent 10%
|
|
52
|
+
),
|
|
53
|
+
linear-gradient(rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)));
|
|
54
|
+
background-repeat: no-repeat;
|
|
55
|
+
background-position: var(--micl-x, center) var(--micl-y, center), 0 0;
|
|
56
|
+
background-size: 0%, 100%;
|
|
57
|
+
|
|
58
|
+
&:focus-visible {
|
|
59
|
+
--statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity, 10%);
|
|
60
|
+
}
|
|
61
|
+
&:hover {
|
|
62
|
+
--statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity, 8%);
|
|
63
|
+
}
|
|
64
|
+
&:active {
|
|
65
|
+
--statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity, 10%);
|
|
66
|
+
}
|
|
67
|
+
&.micl-rippling {
|
|
68
|
+
animation: micl-ripple calc(var(--md-sys-state-ripple-duration) * 1.333);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
%micl-navitem-icon {
|
|
73
|
+
margin: 0;
|
|
74
|
+
padding-block: 4px;
|
|
75
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
76
|
+
font-variation-settings: 'FILL' 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
%micl-navitem-text {
|
|
80
|
+
@include typography.label-medium;
|
|
81
|
+
min-block-size: var(--md-sys-typescale-label-medium-line-height);
|
|
82
|
+
margin: 4px 0px 0px 0px;
|
|
83
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
84
|
+
overflow: hidden;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
%micl-navitem-current {
|
|
88
|
+
background-color: var(--md-sys-color-secondary-container);
|
|
89
|
+
}
|
|
90
|
+
%micl-navitem-current-icon {
|
|
91
|
+
color: var(--md-sys-color-on-secondary-container);
|
|
92
|
+
font-variation-settings: 'FILL' 1;
|
|
93
|
+
}
|
|
94
|
+
%micl-navitem-current-text {
|
|
95
|
+
color: var(--md-sys-color-secondary);
|
|
96
|
+
}
|