material-inspired-component-library 7.0.2 → 8.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/CLAUDE.md +42 -0
- package/README.md +6 -0
- package/components/accordion/README.md +6 -3
- package/components/button/index.scss +10 -6
- package/components/card/README.md +4 -0
- package/components/card/index.scss +159 -150
- package/components/checkbox/index.scss +11 -6
- package/components/datepicker/index.ts +9 -9
- package/components/dialog/index.scss +5 -6
- package/components/iconbutton/index.scss +10 -6
- package/components/list/README.md +191 -32
- package/components/list/index.scss +256 -190
- package/components/list/index.ts +100 -100
- package/components/menu/README.md +199 -10
- package/components/menu/index.scss +224 -47
- package/components/menu/index.ts +74 -37
- package/components/navigationrail/index.scss +75 -69
- package/components/radio/index.scss +11 -6
- package/components/select/README.md +42 -5
- package/components/select/index.scss +39 -79
- package/components/stepper/index.scss +1 -5
- package/components/textfield/index.scss +1 -1
- package/components/textfield/index.ts +2 -2
- package/dist/alert.css +1 -1
- package/dist/appbar.css +1 -1
- package/dist/badge.css +1 -1
- package/dist/bottomsheet.css +1 -1
- package/dist/button.css +1 -1
- package/dist/card.css +1 -1
- package/dist/checkbox.css +1 -1
- package/dist/components/list/index.d.ts +2 -2
- package/dist/datepicker.css +1 -1
- package/dist/dialog.css +1 -1
- package/dist/divider.css +1 -1
- package/dist/foundations.css +1 -1
- package/dist/iconbutton.css +1 -1
- package/dist/list.css +1 -1
- package/dist/menu.css +1 -1
- package/dist/micl.css +1 -1
- package/dist/micl.js +1 -1
- package/dist/navigationrail.css +1 -1
- package/dist/radio.css +1 -1
- package/dist/select.css +1 -1
- package/dist/sidesheet.css +1 -1
- package/dist/slider.css +1 -1
- package/dist/snackbar.css +1 -1
- package/dist/stepper.css +1 -1
- package/dist/switch.css +1 -1
- package/dist/textfield.css +1 -1
- package/dist/timepicker.css +1 -1
- package/docs/accordion.html +24 -24
- package/docs/bottomsheet.html +1 -4
- package/docs/dialog.html +1 -1
- package/docs/index.html +4 -4
- package/docs/list.html +38 -22
- package/docs/menu.html +246 -41
- package/docs/micl.css +1 -1
- package/docs/micl.js +1 -1
- package/docs/select.html +68 -19
- package/docs/shapes.html +85 -0
- package/foundations/index.scss +0 -1
- package/micl.ts +6 -1
- package/package.json +3 -3
- package/styles/README.md +4 -4
- package/styles/shapes.scss +81 -0
- package/styles/statelayer.scss +10 -0
|
@@ -23,47 +23,204 @@
|
|
|
23
23
|
@use '../../styles/elevation';
|
|
24
24
|
@use '../../styles/motion';
|
|
25
25
|
@use '../../styles/shapes';
|
|
26
|
+
@use '../../styles/typography';
|
|
26
27
|
|
|
27
28
|
:root {
|
|
28
|
-
--md-
|
|
29
|
-
--md-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
--md-comp-menu-width-max: 320px;
|
|
30
|
+
--md-comp-menu-width-min: 112px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
$menu-padding-block: 4px;
|
|
34
|
+
$item-classes: ':is(.micl-list-item-one, .micl-list-item-two, .micl-list-item-three)';
|
|
35
|
+
|
|
36
|
+
@mixin menu-color-set(
|
|
37
|
+
$variant,
|
|
38
|
+
$container,
|
|
39
|
+
$on-container,
|
|
40
|
+
$on-container-strong,
|
|
41
|
+
$on-icon-active,
|
|
42
|
+
$selected-container,
|
|
43
|
+
$on-selected
|
|
44
|
+
) {
|
|
45
|
+
--md-comp-list-item-container-color: var(--md-comp-menu-#{$variant}-menu-item-container-color, #{$container});
|
|
46
|
+
--md-comp-list-item-label-text-color: var(--md-comp-menu-#{$variant}-menu-item-label-text-color, #{$on-container});
|
|
47
|
+
--md-comp-list-item-leading-icon-color: var(--md-comp-menu-#{$variant}-menu-item-leading-icon-color, #{$on-container});
|
|
48
|
+
--md-comp-list-item-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-supporting-text-color, #{$on-container});
|
|
49
|
+
--md-comp-list-item-trailing-icon-color: var(--md-comp-menu-#{$variant}-menu-item-trailing-icon-color, #{$on-container});
|
|
50
|
+
--md-comp-list-item-trailing-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-trailing-supporting-text-color, #{$on-container});
|
|
51
|
+
|
|
52
|
+
--md-comp-list-item-disabled-label-text-color: var(--md-comp-menu-#{$variant}-menu-item-disabled-label-text-color, #{$on-container-strong});
|
|
53
|
+
--md-comp-list-item-disabled-label-text-opacity: var(--md-comp-menu-#{$variant}-menu-item-disabled-label-text-opacity, var(--md-sys-state-disabled-state-layer-opacity, 38%));
|
|
54
|
+
--md-comp-list-item-disabled-leading-icon-color: var(--md-comp-menu-#{$variant}-menu-item-disabled-leading-icon-color, #{$on-container-strong});
|
|
55
|
+
--md-comp-list-item-disabled-leading-icon-opacity: var(--md-comp-menu-#{$variant}-menu-item-disabled-leading-icon-opacity, var(--md-sys-state-disabled-state-layer-opacity, 38%));
|
|
56
|
+
--md-comp-list-item-disabled-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-disabled-supporting-text-color, #{$on-container-strong});
|
|
57
|
+
--md-comp-list-item-disabled-supporting-text-opacity: var(--md-comp-menu-#{$variant}-menu-item-disabled-supporting-text-opacity, var(--md-sys-state-disabled-state-layer-opacity, 38%));
|
|
58
|
+
--md-comp-list-item-disabled-trailing-icon-color: var(--md-comp-menu-#{$variant}-menu-item-disabled-trailing-icon-color, #{$on-container-strong});
|
|
59
|
+
--md-comp-list-item-disabled-trailing-icon-opacity: var(--md-comp-menu-#{$variant}-menu-item-disabled-trailing-icon-opacity, var(--md-sys-state-disabled-state-layer-opacity, 38%));
|
|
60
|
+
--md-comp-list-item-disabled-trailing-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-disabled-trailing-supporting-text-color, #{$on-container-strong});
|
|
61
|
+
--md-comp-list-item-disabled-trailing-supporting-text-opacity: var(--md-comp-menu-#{$variant}-menu-item-disabled-trailing-supporting-text-opacity, var(--md-sys-state-disabled-state-layer-opacity, 38%));
|
|
62
|
+
|
|
63
|
+
--md-comp-list-item-focus-label-text-color: var(--md-comp-menu-#{$variant}-menu-item-focused-label-text-color, #{$on-container-strong});
|
|
64
|
+
--md-comp-list-item-focus-leading-icon-color: var(--md-comp-menu-#{$variant}-menu-item-focused-leading-icon-color, #{$on-icon-active});
|
|
65
|
+
--md-comp-list-item-focus-state-layer-color: var(--md-comp-menu-#{$variant}-menu-item-focused-state-layer-color, #{$on-container-strong});
|
|
66
|
+
--md-comp-list-item-focus-state-layer-opacity: var(--md-comp-menu-#{$variant}-menu-item-focused-state-layer-opacity, var(--md-sys-state-focus-state-layer-opacity, 10%));
|
|
67
|
+
--md-comp-list-item-focus-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-focused-supporting-text-color, #{$on-container});
|
|
68
|
+
--md-comp-list-item-focus-trailing-icon-color: var(--md-comp-menu-#{$variant}-menu-item-focused-trailing-icon-color, #{$on-icon-active});
|
|
69
|
+
--md-comp-list-item-focus-trailing-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-focused-trailing-supporting-text-color, #{$on-container});
|
|
70
|
+
|
|
71
|
+
--md-comp-list-item-hover-label-text-color: var(--md-comp-menu-#{$variant}-menu-item-hovered-label-text-color, #{$on-container-strong});
|
|
72
|
+
--md-comp-list-item-hover-leading-icon-color: var(--md-comp-menu-#{$variant}-menu-item-hovered-leading-icon-color, #{$on-icon-active});
|
|
73
|
+
--md-comp-list-item-hover-state-layer-color: var(--md-comp-menu-#{$variant}-menu-item-hovered-state-layer-color, #{$on-container-strong});
|
|
74
|
+
--md-comp-list-item-hover-state-layer-opacity: var(--md-comp-menu-#{$variant}-menu-item-hovered-state-layer-opacity, var(--md-sys-state-hover-state-layer-opacity, 8%));
|
|
75
|
+
--md-comp-list-item-hover-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-hovered-supporting-text-color, #{$on-container});
|
|
76
|
+
--md-comp-list-item-hover-trailing-icon-color: var(--md-comp-menu-#{$variant}-menu-item-hovered-trailing-icon-color, #{$on-icon-active});
|
|
77
|
+
--md-comp-list-item-hover-trailing-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-hovered-trailing-supporting-text-color, #{$on-container});
|
|
78
|
+
|
|
79
|
+
--md-comp-list-item-pressed-label-text-color: var(--md-comp-menu-#{$variant}-menu-item-pressed-label-text-color, #{$on-container-strong});
|
|
80
|
+
--md-comp-list-item-pressed-leading-icon-color: var(--md-comp-menu-#{$variant}-menu-item-pressed-leading-icon-color, #{$on-icon-active});
|
|
81
|
+
--md-comp-list-item-pressed-state-layer-color: var(--md-comp-menu-#{$variant}-menu-item-pressed-state-layer-color, #{$on-container-strong});
|
|
82
|
+
--md-comp-list-item-pressed-state-layer-opacity: var(--md-comp-menu-#{$variant}-menu-item-pressed-state-layer-opacity, var(--md-sys-state-pressed-state-layer-opacity, 10%));
|
|
83
|
+
--md-comp-list-item-pressed-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-pressed-supporting-text-color, #{$on-container});
|
|
84
|
+
--md-comp-list-item-pressed-trailing-icon-color: var(--md-comp-menu-#{$variant}-menu-item-pressed-trailing-icon-color, #{$on-icon-active});
|
|
85
|
+
--md-comp-list-item-pressed-trailing-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-pressed-trailing-supporting-text-color, #{$on-container});
|
|
86
|
+
|
|
87
|
+
--md-comp-list-item-selected-container-color: var(--md-comp-menu-#{$variant}-menu-item-selected-container-color, #{$selected-container});
|
|
88
|
+
--md-comp-list-item-selected-label-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-label-text-color, #{$on-selected});
|
|
89
|
+
--md-comp-list-item-selected-leading-icon-color: var(--md-comp-menu-#{$variant}-menu-item-selected-leading-icon-color, #{$on-selected});
|
|
90
|
+
--md-comp-list-item-selected-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-supporting-text-color, #{$on-selected});
|
|
91
|
+
--md-comp-list-item-selected-trailing-icon-color: var(--md-comp-menu-#{$variant}-menu-item-selected-trailing-icon-color, #{$on-selected});
|
|
92
|
+
--md-comp-list-item-selected-trailing-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-trailing-supporting-text-color, #{$on-selected});
|
|
93
|
+
|
|
94
|
+
--md-comp-list-item-selected-disabled-container-color: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-container-color, #{$selected-container});
|
|
95
|
+
--md-comp-list-item-selected-disabled-container-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-container-opacity, var(--md-sys-state-disabled-state-layer-opacity, 38%));
|
|
96
|
+
--md-comp-list-item-selected-disabled-label-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-label-text-color, #{$on-selected});
|
|
97
|
+
--md-comp-list-item-selected-disabled-label-text-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-label-text-opacity, var(--md-sys-state-disabled-state-layer-opacity, 38%));
|
|
98
|
+
--md-comp-list-item-selected-disabled-leading-icon-color: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-leading-icon-color, #{$on-selected});
|
|
99
|
+
--md-comp-list-item-selected-disabled-leading-icon-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-leading-icon-opacity, var(--md-sys-state-disabled-state-layer-opacity, 38%));
|
|
100
|
+
--md-comp-list-item-selected-disabled-trailing-icon-color: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-trailing-icon-color, #{$on-selected});
|
|
101
|
+
--md-comp-list-item-selected-disabled-trailing-icon-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-trailing-icon-opacity, var(--md-sys-state-disabled-state-layer-opacity, 38%));
|
|
102
|
+
--md-comp-list-item-selected-disabled-trailing-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-trailing-supporting-text-color, #{$on-selected});
|
|
103
|
+
--md-comp-list-item-selected-disabled-trailing-supporting-text-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-disabled-trailing-supporting-text-opacity, var(--md-sys-state-disabled-state-layer-opacity, 38%));
|
|
104
|
+
|
|
105
|
+
--md-comp-list-item-selected-focus-label-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-focused-label-text-color, #{$on-selected});
|
|
106
|
+
--md-comp-list-item-selected-focus-leading-icon-color: var(--md-comp-menu-#{$variant}-menu-item-selected-focused-leading-icon-color, #{$on-selected});
|
|
107
|
+
--md-comp-list-item-selected-focus-state-layer-color: var(--md-comp-menu-#{$variant}-menu-item-selected-focused-state-layer-color, #{$on-selected});
|
|
108
|
+
--md-comp-list-item-selected-focus-state-layer-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-focused-state-layer-opacity, var(--md-sys-state-focus-state-layer-opacity, 10%));
|
|
109
|
+
--md-comp-list-item-selected-focus-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-focused-supporting-text-color, #{$on-selected});
|
|
110
|
+
--md-comp-list-item-selected-focus-trailing-icon-color: var(--md-comp-menu-#{$variant}-menu-item-selected-focused-trailing-icon-color, #{$on-selected});
|
|
111
|
+
--md-comp-list-item-selected-focus-trailing-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-focused-trailing-supporting-text-color, #{$on-selected});
|
|
112
|
+
|
|
113
|
+
--md-comp-list-item-selected-hover-label-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-hovered-label-text-color, #{$on-selected});
|
|
114
|
+
--md-comp-list-item-selected-hover-leading-icon-color: var(--md-comp-menu-#{$variant}-menu-item-selected-hovered-leading-icon-color, #{$on-selected});
|
|
115
|
+
--md-comp-list-item-selected-hover-state-layer-color: var(--md-comp-menu-#{$variant}-menu-item-selected-hovered-state-layer-color, #{$on-selected});
|
|
116
|
+
--md-comp-list-item-selected-hover-state-layer-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-hovered-state-layer-opacity, var(--md-sys-state-hover-state-layer-opacity, 8%));
|
|
117
|
+
--md-comp-list-item-selected-hover-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-hovered-supporting-text-color, #{$on-selected});
|
|
118
|
+
--md-comp-list-item-selected-hover-trailing-icon-color: var(--md-comp-menu-#{$variant}-menu-item-selected-hovered-trailing-icon-color, #{$on-selected});
|
|
119
|
+
--md-comp-list-item-selected-hover-trailing-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-hovered-trailing-supporting-text-color, #{$on-selected});
|
|
120
|
+
|
|
121
|
+
--md-comp-list-item-selected-pressed-label-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-pressed-label-text-color, #{$on-selected});
|
|
122
|
+
--md-comp-list-item-selected-pressed-leading-icon-color: var(--md-comp-menu-#{$variant}-menu-item-selected-pressed-leading-icon-color, #{$on-selected});
|
|
123
|
+
--md-comp-list-item-selected-pressed-state-layer-color: var(--md-comp-menu-#{$variant}-menu-item-selected-pressed-state-layer-color, #{$on-selected});
|
|
124
|
+
--md-comp-list-item-selected-pressed-state-layer-opacity: var(--md-comp-menu-#{$variant}-menu-item-selected-pressed-state-layer-opacity, var(--md-sys-state-pressed-state-layer-opacity, 10%));
|
|
125
|
+
--md-comp-list-item-selected-pressed-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-pressed-supporting-text-color, #{$on-selected});
|
|
126
|
+
--md-comp-list-item-selected-pressed-trailing-icon-color: var(--md-comp-menu-#{$variant}-menu-item-selected-pressed-trailing-icon-color, #{$on-selected});
|
|
127
|
+
--md-comp-list-item-selected-pressed-trailing-supporting-text-color: var(--md-comp-menu-#{$variant}-menu-item-selected-pressed-trailing-supporting-text-color, #{$on-selected});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.micl-menu[popover], select {
|
|
131
|
+
--md-comp-menu-motion-effects: #{motion.$md-sys-motion-expressive-fast-effects};
|
|
132
|
+
--md-comp-menu-motion-effects-duration: #{motion.$md-sys-motion-expressive-default-effects-duration};
|
|
133
|
+
--md-comp-menu-motion-effects-duration-reverse: #{motion.$md-sys-motion-expressive-default-effects-duration};
|
|
134
|
+
--md-comp-menu-motion-spatial: #{motion.$md-sys-motion-expressive-default-spatial};
|
|
135
|
+
--md-comp-menu-motion-spatial-duration: #{motion.$md-sys-motion-expressive-default-spatial-duration};
|
|
136
|
+
--md-comp-menu-motion-spatial-duration-reverse: #{motion.$md-sys-motion-expressive-fast-spatial-duration};
|
|
137
|
+
|
|
138
|
+
--md-comp-list-container-shape: var(--md-comp-menu-active-container-shape, var(--md-comp-menu-container-shape, var(--md-sys-shape-corner-large, 16px)));
|
|
139
|
+
|
|
140
|
+
--md-comp-list-item-container-expressive-shape: var(--md-comp-menu-item-shape, var(--md-sys-shape-corner-small, 8px));
|
|
141
|
+
--md-comp-list-item-container-selected-expressive-shape: var(--md-comp-menu-item-selected-shape, var(--md-sys-shape-corner-large, 16px));
|
|
142
|
+
|
|
143
|
+
--md-comp-list-item-between-space: 12px;
|
|
144
|
+
--md-comp-list-item-leading-space: calc(var(--md-comp-menu-item-leading-space, 16px) - #{$menu-padding-block});
|
|
145
|
+
--md-comp-list-item-leading-icon-expressive-size: var(--md-comp-menu-item-leading-icon-size, 20px);
|
|
146
|
+
--md-comp-list-item-trailing-icon-expressive-size: var(--md-comp-menu-item-trailing-icon-size, 20px);
|
|
147
|
+
--md-comp-list-item-trailing-space: calc(var(--md-comp-menu-item-trailing-space, 16px) - #{$menu-padding-block});
|
|
148
|
+
--md-comp-list-item-top-space: var(--md-comp-menu-item-top-space, 8px);
|
|
149
|
+
--md-comp-list-item-bottom-space: var(--md-comp-menu-item-bottom-space, 8px);
|
|
150
|
+
--md-comp-list-item-one-line-container-height: var(--md-comp-menu-item-height, 44px);
|
|
151
|
+
--md-comp-list-item-two-line-container-height: var(--md-comp-menu-item-height, 44px);
|
|
152
|
+
--md-comp-list-item-three-line-container-height: var(--md-comp-menu-item-height, 44px);
|
|
153
|
+
|
|
154
|
+
--md-comp-list-item-focus-indicator-color: var(--md-comp-menu-item-focus-indicator-color, var(--md-sys-color-secondary));
|
|
155
|
+
--md-comp-list-item-focus-indicator-offset: var(--md-comp-menu-item-focus-indicator-offset, var(--md-sys-state-focus-indicator-inner-offset, -3px));
|
|
156
|
+
--md-comp-list-item-focus-indicator-thickness: var(--md-comp-menu-item-focus-indicator-thickness, var(--md-sys-state-focus-indicator-thickness, 3px));
|
|
157
|
+
|
|
158
|
+
@include menu-color-set(
|
|
159
|
+
'standard',
|
|
160
|
+
var(--md-sys-color-surface-container-low),
|
|
161
|
+
var(--md-sys-color-on-surface-variant),
|
|
162
|
+
var(--md-sys-color-on-surface),
|
|
163
|
+
var(--md-sys-color-on-surface-variant),
|
|
164
|
+
var(--md-sys-color-tertiary-container),
|
|
165
|
+
var(--md-sys-color-on-tertiary-container)
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
.micl-menu__section {
|
|
169
|
+
@include typography.label-small;
|
|
170
|
+
|
|
171
|
+
padding-block: var(--md-comp-menu-section-label-top-space, 8px) var(--md-comp-menu-section-label-bottom-space, 8px);
|
|
172
|
+
padding-inline: var(--md-comp-list-item-leading-space, 16px) var(--md-comp-list-item-trailing-space, 16px);
|
|
173
|
+
color: var(--md-comp-menu-standard-section-label-text-color, var(--md-sys-color-on-surface-variant));
|
|
174
|
+
}
|
|
175
|
+
&.micl-menu--vibrant .micl-menu__section {
|
|
176
|
+
color: var(--md-comp-menu-vibrant-section-label-text-color, var(--md-sys-color-on-tertiary-container));
|
|
177
|
+
}
|
|
178
|
+
.micl-list-item__text {
|
|
179
|
+
@include typography.label-large;
|
|
180
|
+
|
|
181
|
+
.micl-list-item__supporting-text {
|
|
182
|
+
@include typography.body-small;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
.micl-list-item__trailing-text {
|
|
186
|
+
@include typography.label-large;
|
|
187
|
+
}
|
|
33
188
|
}
|
|
34
189
|
|
|
35
190
|
.micl-menu[popover] {
|
|
191
|
+
display: flex;
|
|
192
|
+
flex-direction: column;
|
|
36
193
|
position: absolute;
|
|
37
194
|
inset: unset;
|
|
38
195
|
inset-block-start: anchor(end);
|
|
39
196
|
inset-inline-start: anchor(start);
|
|
40
|
-
position-try: most-block-size
|
|
41
|
-
|
|
42
|
-
|
|
197
|
+
position-try-order: most-block-size;
|
|
198
|
+
position-try-fallbacks: flip-block, flip-inline;
|
|
199
|
+
min-inline-size: var(--md-comp-menu-width-min, 112px);
|
|
200
|
+
max-inline-size: var(--md-comp-menu-width-max, 320px);
|
|
201
|
+
gap: var(--md-comp-menu-gap, 2px);
|
|
43
202
|
padding: 0;
|
|
44
203
|
border: none;
|
|
45
|
-
border-radius: var(--md-sys-shape-corner-extra-small);
|
|
46
204
|
outline: none;
|
|
47
|
-
background-color:
|
|
48
|
-
box-shadow: var(--md-sys-elevation-level2);
|
|
205
|
+
background-color: transparent;
|
|
49
206
|
opacity: 0;
|
|
50
|
-
overflow:
|
|
207
|
+
overflow: visible;
|
|
51
208
|
transform: scaleY(0);
|
|
52
|
-
transform-origin:
|
|
209
|
+
transform-origin: center top;
|
|
53
210
|
transition:
|
|
54
|
-
opacity var(--md-
|
|
55
|
-
transform var(--md-
|
|
56
|
-
overlay var(--md-
|
|
57
|
-
display var(--md-
|
|
211
|
+
opacity var(--md-comp-menu-motion-spatial-duration-reverse) linear,
|
|
212
|
+
transform var(--md-comp-menu-motion-spatial-duration-reverse) var(--md-comp-menu-motion-spatial),
|
|
213
|
+
overlay var(--md-comp-menu-motion-spatial-duration-reverse) linear allow-discrete,
|
|
214
|
+
display var(--md-comp-menu-motion-spatial-duration-reverse) linear allow-discrete;
|
|
58
215
|
|
|
59
216
|
&:popover-open {
|
|
60
217
|
opacity: 1;
|
|
61
218
|
transform: scaleY(1);
|
|
62
219
|
transition:
|
|
63
|
-
opacity var(--md-
|
|
64
|
-
transform var(--md-
|
|
65
|
-
overlay var(--md-
|
|
66
|
-
display var(--md-
|
|
220
|
+
opacity var(--md-comp-menu-motion-spatial-duration) motion.$md-sys-motion-easing-emphasized-decelerate,
|
|
221
|
+
transform var(--md-comp-menu-motion-spatial-duration) var(--md-comp-menu-motion-spatial),
|
|
222
|
+
overlay var(--md-comp-menu-motion-spatial-duration) linear allow-discrete,
|
|
223
|
+
display var(--md-comp-menu-motion-spatial-duration) linear allow-discrete;
|
|
67
224
|
|
|
68
225
|
@starting-style {
|
|
69
226
|
opacity: 0;
|
|
@@ -80,39 +237,59 @@
|
|
|
80
237
|
&::backdrop {
|
|
81
238
|
background-color: rgba(0, 0, 0, 0);
|
|
82
239
|
transition:
|
|
83
|
-
background-color var(--md-
|
|
84
|
-
overlay var(--md-
|
|
85
|
-
display var(--md-
|
|
240
|
+
background-color var(--md-comp-menu-motion-effects-duration) linear,
|
|
241
|
+
overlay var(--md-comp-menu-motion-effects-duration) linear allow-discrete,
|
|
242
|
+
display var(--md-comp-menu-motion-effects-duration) linear allow-discrete;
|
|
86
243
|
}
|
|
87
244
|
|
|
88
|
-
|
|
89
|
-
--md-
|
|
90
|
-
|
|
91
|
-
--md-sys-
|
|
92
|
-
--md-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
.micl-list
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
245
|
+
.micl-list {
|
|
246
|
+
padding: var(--md-comp-menu-group-padding, 4px) $menu-padding-block;
|
|
247
|
+
row-gap: 2px;
|
|
248
|
+
background-color: var(--md-comp-menu-standard-container-color, var(--md-sys-color-surface-container-low));
|
|
249
|
+
box-shadow: var(--md-comp-menu-container-elevation, var(--md-sys-elevation-level2));
|
|
250
|
+
transition: border-radius var(--md-comp-menu-motion-effects-duration-reverse) linear;
|
|
251
|
+
|
|
252
|
+
&+ .micl-list {
|
|
253
|
+
border-start-start-radius: var(--md-comp-menu-group-shape, var(--md-sys-shape-corner-small, 8px));
|
|
254
|
+
border-start-end-radius: var(--md-comp-menu-group-shape, var(--md-sys-shape-corner-small, 8px));
|
|
255
|
+
}
|
|
256
|
+
&:has(+ .micl-list) {
|
|
257
|
+
border-end-start-radius: var(--md-comp-menu-group-shape, var(--md-sys-shape-corner-small, 8px));
|
|
258
|
+
border-end-end-radius: var(--md-comp-menu-group-shape, var(--md-sys-shape-corner-small, 8px));
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
#{$item-classes} > .micl-menu[popover] {
|
|
262
|
+
transform: scaleX(0);
|
|
263
|
+
|
|
264
|
+
&:popover-open {
|
|
265
|
+
transform: scaleX(1);
|
|
266
|
+
|
|
267
|
+
@starting-style {
|
|
268
|
+
transform: scaleX(0);
|
|
107
269
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
background-color: rgba(0, 0, 0, 0);
|
|
111
|
-
}
|
|
270
|
+
&::backdrop {
|
|
271
|
+
background-color: rgba(0, 0, 0, 0);
|
|
112
272
|
}
|
|
113
273
|
}
|
|
114
274
|
}
|
|
115
275
|
}
|
|
276
|
+
&:has(.micl-menu:popover-open) > .micl-list {
|
|
277
|
+
--md-comp-list-container-shape: var(--md-comp-menu-inactive-container-shape, var(--md-sys-shape-corner-small, 8px));
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
&.micl-menu--vibrant > .micl-list {
|
|
281
|
+
@include menu-color-set(
|
|
282
|
+
'vibrant',
|
|
283
|
+
var(--md-sys-color-tertiary-container),
|
|
284
|
+
var(--md-sys-color-on-tertiary-container),
|
|
285
|
+
var(--md-sys-color-on-tertiary-container),
|
|
286
|
+
var(--md-sys-color-tertiary),
|
|
287
|
+
var(--md-sys-color-tertiary),
|
|
288
|
+
var(--md-sys-color-on-tertiary)
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
background-color: var(--md-comp-menu-vibrant-container-color, var(--md-sys-color-tertiary-container));
|
|
292
|
+
}
|
|
116
293
|
}
|
|
117
294
|
|
|
118
295
|
[dir=rtl] .micl-menu[popover] > .micl-list button[popovertarget] .micl-list-item__icon {
|
package/components/menu/index.ts
CHANGED
|
@@ -32,6 +32,14 @@ export default (() =>
|
|
|
32
32
|
((invokerRect.y > popoverRect.y) ? 'bottom' : 'top');
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
const navigableItems = (list: Element): HTMLElement[] =>
|
|
36
|
+
Array.from(list.children).filter((child): child is HTMLElement =>
|
|
37
|
+
child instanceof HTMLLIElement
|
|
38
|
+
&& child.getAttribute('role') !== 'separator'
|
|
39
|
+
&& !child.classList.contains('micl-list-item--disabled')
|
|
40
|
+
&& child.matches('.micl-list-item-one,.micl-list-item-two,.micl-list-item-three')
|
|
41
|
+
);
|
|
42
|
+
|
|
35
43
|
return {
|
|
36
44
|
initialize: (element: HTMLElement): void =>
|
|
37
45
|
{
|
|
@@ -45,62 +53,91 @@ export default (() =>
|
|
|
45
53
|
|
|
46
54
|
const invoker = document.querySelector(`[popovertarget="${element.id}"]`);
|
|
47
55
|
|
|
48
|
-
invoker && element.addEventListener('beforetoggle',
|
|
56
|
+
invoker && element.addEventListener('beforetoggle', () =>
|
|
49
57
|
{
|
|
50
|
-
|
|
51
|
-
// The popover is about to be closed.
|
|
52
|
-
element.style.transformOrigin = getOrigin(invoker, element);
|
|
53
|
-
}
|
|
58
|
+
element.style.transformOrigin = getOrigin(invoker, element);
|
|
54
59
|
});
|
|
55
|
-
|
|
60
|
+
|
|
61
|
+
element.addEventListener('keydown', (event: KeyboardEvent) =>
|
|
56
62
|
{
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') return;
|
|
64
|
+
|
|
65
|
+
const target = event.target;
|
|
66
|
+
if (
|
|
67
|
+
!(target instanceof HTMLElement)
|
|
68
|
+
|| !target.matches('.micl-list-item-one,.micl-list-item-two,.micl-list-item-three')
|
|
69
|
+
) {
|
|
70
|
+
return;
|
|
60
71
|
}
|
|
61
|
-
|
|
72
|
+
|
|
73
|
+
const currentList = target.parentElement;
|
|
74
|
+
if (!currentList?.matches('ul.micl-list')) return;
|
|
75
|
+
if (currentList.parentElement !== element) return;
|
|
76
|
+
|
|
77
|
+
const lists = Array.from(element.querySelectorAll<HTMLElement>(':scope > ul.micl-list'));
|
|
78
|
+
if (lists.length < 2) return;
|
|
79
|
+
|
|
80
|
+
const listIndex = lists.indexOf(currentList as HTMLElement);
|
|
81
|
+
const items = navigableItems(currentList);
|
|
82
|
+
const itemIndex = items.indexOf(target);
|
|
83
|
+
if (itemIndex === -1) return;
|
|
84
|
+
|
|
85
|
+
let nextItem: HTMLElement | undefined;
|
|
86
|
+
|
|
87
|
+
if (event.key === 'ArrowDown' && itemIndex === items.length - 1) {
|
|
88
|
+
const nextListIndex = (listIndex + 1) % lists.length;
|
|
89
|
+
nextItem = navigableItems(lists[nextListIndex])[0];
|
|
90
|
+
}
|
|
91
|
+
else if (event.key === 'ArrowUp' && itemIndex === 0) {
|
|
92
|
+
const prevListIndex = (listIndex - 1 + lists.length) % lists.length;
|
|
93
|
+
const prev = navigableItems(lists[prevListIndex]);
|
|
94
|
+
nextItem = prev[prev.length - 1];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (nextItem) {
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
event.stopPropagation();
|
|
100
|
+
target.setAttribute('tabindex', '-1');
|
|
101
|
+
nextItem.setAttribute('tabindex', '0');
|
|
102
|
+
nextItem.focus();
|
|
103
|
+
}
|
|
104
|
+
}, true);
|
|
62
105
|
|
|
63
106
|
element.querySelectorAll<HTMLButtonElement>(
|
|
64
107
|
':scope > ul.micl-list > li > button[popovertarget]'
|
|
65
108
|
).forEach(submenuinvoker =>
|
|
66
109
|
{
|
|
67
110
|
if (submenuinvoker.popoverTargetElement?.matches('.micl-menu[popover]')) {
|
|
68
|
-
|
|
69
|
-
|
|
111
|
+
const popover = submenuinvoker.popoverTargetElement as HTMLElement;
|
|
112
|
+
const id = `--${popover.id}`;
|
|
113
|
+
let hoverTimeout: ReturnType<typeof setTimeout>;
|
|
70
114
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
submenuinvoker.popoverTargetElement.style.insetInlineStart = `anchor(${id} end)`;
|
|
75
|
-
}
|
|
115
|
+
submenuinvoker.style.setProperty('anchor-name', id);
|
|
116
|
+
popover.style.insetBlockStart = `anchor(${id} start)`;
|
|
117
|
+
popover.style.insetInlineStart = `anchor(${id} end)`;
|
|
76
118
|
|
|
77
|
-
|
|
78
|
-
{
|
|
79
|
-
if (submenuinvoker.popoverTargetElement instanceof HTMLElement) {
|
|
80
|
-
submenuinvoker.popoverTargetElement.showPopover();
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
submenuinvoker.addEventListener('mouseleave', () =>
|
|
119
|
+
const scheduleClose = () =>
|
|
84
120
|
{
|
|
85
|
-
hoverTimeout
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
submenuinvoker.popoverTargetElement.hidePopover();
|
|
121
|
+
clearTimeout(hoverTimeout);
|
|
122
|
+
hoverTimeout = setTimeout(() =>
|
|
123
|
+
{
|
|
124
|
+
if (!submenuinvoker.matches(':hover') && !popover.matches(':hover')) {
|
|
125
|
+
popover.hidePopover();
|
|
91
126
|
}
|
|
92
|
-
},
|
|
93
|
-
}
|
|
94
|
-
|
|
127
|
+
}, 300);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
submenuinvoker.addEventListener('mouseenter', () =>
|
|
95
131
|
{
|
|
96
132
|
clearTimeout(hoverTimeout);
|
|
133
|
+
popover.showPopover();
|
|
97
134
|
});
|
|
98
|
-
submenuinvoker.
|
|
135
|
+
submenuinvoker.addEventListener('mouseleave', scheduleClose);
|
|
136
|
+
popover.addEventListener('mouseenter', () =>
|
|
99
137
|
{
|
|
100
|
-
|
|
101
|
-
submenuinvoker.popoverTargetElement.hidePopover();
|
|
102
|
-
}
|
|
138
|
+
clearTimeout(hoverTimeout);
|
|
103
139
|
});
|
|
140
|
+
popover.addEventListener('mouseleave', scheduleClose);
|
|
104
141
|
}
|
|
105
142
|
});
|
|
106
143
|
}
|