material-inspired-component-library 9.0.0 → 9.0.2

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.
@@ -66,6 +66,7 @@ dialog.micl-dialog {
66
66
  min-inline-size: var(--md-comp-dialog-min-width, 280px);
67
67
  max-inline-size: var(--md-comp-dialog-max-width, 560px);
68
68
  max-block-size: 100vh;
69
+ position-anchor: auto;
69
70
  inset-block-start: anchor(start);
70
71
  inset-inline-start: anchor(start);
71
72
  transform: var(--_translate) scale(50%);
@@ -153,7 +154,6 @@ dialog.micl-dialog {
153
154
  }
154
155
 
155
156
  &.micl-dialog--docked {
156
- position-anchor: auto;
157
157
  inset-block: anchor(end) auto;
158
158
  inset-inline: anchor(start) auto;
159
159
  transform: none;
@@ -275,12 +275,12 @@ $unselected: ':not(:checked, :has(input[type=checkbox]:checked), #{$open-accordi
275
275
  -webkit-tap-highlight-color: transparent;
276
276
 
277
277
  &:first-of-type {
278
- border-start-start-radius: max(var(--_list-item-shape), var(--_list-shape));
279
- border-start-end-radius: max(var(--_list-item-shape), var(--_list-shape));
278
+ border-start-start-radius: max(var(--_list-item-shape), var(--_list-shape, 0px));
279
+ border-start-end-radius: max(var(--_list-item-shape), var(--_list-shape, 0px));
280
280
  }
281
281
  &:last-of-type {
282
- border-end-start-radius: max(var(--_list-item-shape), var(--_list-shape));
283
- border-end-end-radius: max(var(--_list-item-shape), var(--_list-shape));
282
+ border-end-start-radius: max(var(--_list-item-shape), var(--_list-shape, 0px));
283
+ border-end-end-radius: max(var(--_list-item-shape), var(--_list-shape, 0px));
284
284
  }
285
285
  &:not(:has(> button)) {
286
286
  --micl-ripple: 1;
@@ -200,12 +200,11 @@ $item-classes: ':is(.micl-list-item-one, .micl-list-item-two, .micl-list-item-th
200
200
 
201
201
  .micl-menu[popover] {
202
202
  flex-direction: column;
203
- position: absolute;
203
+ position-anchor: auto;
204
204
  inset: unset;
205
205
  inset-block-start: anchor(end);
206
206
  inset-inline-start: anchor(start);
207
- position-try-order: most-block-size;
208
- position-try-fallbacks: flip-block, flip-inline;
207
+ position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
209
208
  min-inline-size: var(--md-comp-menu-width-min, 112px);
210
209
  max-inline-size: var(--md-comp-menu-width-max, 320px);
211
210
  gap: var(--md-comp-menu-gap, 2px);
@@ -133,6 +133,32 @@ Options can be grouped by using the `<optgroup>` element. Add a `<legend>` eleme
133
133
  </div>
134
134
  ```
135
135
 
136
+ ## Multiple selection
137
+ Adding the `multiple` attribute turns the select into an in-page listbox in which several options can be chosen at once.
138
+
139
+ By default the listbox grows with its options. To give it a fixed height with internal scrolling, set the `--md-comp-text-field-container-height` custom property.
140
+
141
+ **Example: A multiple select with a fixed height**
142
+
143
+ ```HTML
144
+ <div class="micl-textfield-outlined" style="--md-comp-text-field-container-height:230px">
145
+ <label for="myselect">Countries</label>
146
+ <select id="myselect" multiple>
147
+ <option class="micl-list-item-one" value="AR" selected>
148
+ <span class="micl-list-item__text">Argentina</span>
149
+ </option>
150
+ <option class="micl-list-item-one" value="BO">
151
+ <span class="micl-list-item__text">Bolivia</span>
152
+ </option>
153
+ <option class="micl-list-item-one" value="CL" selected>
154
+ <span class="micl-list-item__text">Chile</span>
155
+ </option>
156
+ </select>
157
+ </div>
158
+ ```
159
+
160
+ Options support the same content as in a single select: supporting text, dividers, media elements, and option groups.
161
+
136
162
  ## Theming
137
163
  The Select component has no tokens of its own: the field is themed with the CSS custom properties of the [Text field](../textfield/README.md) component, and the option pick-list with those of the [Menu](../menu/README.md) and [List](../list/README.md) components. Set them on any appropriate parent element to affect its child selects.
138
164
 
@@ -106,6 +106,25 @@ $selects: ':is(.micl-textfield-filled, .micl-textfield-outlined) > select';
106
106
  }
107
107
  }
108
108
 
109
+ &[multiple] {
110
+ --md-comp-divider-space: 0.5px;
111
+ --_list-item-background-color: var(--md-comp-list-item-container-color, transparent);
112
+ --_list-item-background-opacity: 0%;
113
+
114
+ display: flex;
115
+ flex-direction: column;
116
+ gap: var(--md-comp-menu-gap, 2px);
117
+ block-size: var(--md-comp-text-field-container-height, auto);
118
+ min-block-size: var(--_height);
119
+ padding-block: 6px calc(4px - var(--_outline-extra, 0px));
120
+ padding-inline: calc(4px - var(--_outline-extra, 0px));
121
+ overflow-y: auto;
122
+
123
+ &::picker-icon {
124
+ display: none;
125
+ }
126
+ }
127
+
109
128
  option {
110
129
  line-height: normal;
111
130
 
@@ -120,6 +139,40 @@ $selects: ':is(.micl-textfield-filled, .micl-textfield-outlined) > select';
120
139
  }
121
140
  }
122
141
 
142
+ .micl-textfield-filled > select[multiple] {
143
+ padding-block: 24px calc(5px - var(--_outline-width, 1px));
144
+ }
145
+
146
+ @supports not (appearance: base-select) {
147
+ #{$selects}[multiple] {
148
+ border-radius: 0;
149
+
150
+ option {
151
+ --micl-ripple: 0;
152
+
153
+ appearance: none;
154
+ background-position: var(--micl-x, center) var(--micl-y, center), 0 0, 0 0;
155
+ background-size: 0%, 100%, 100%;
156
+ background-image:
157
+ radial-gradient(
158
+ circle at var(--micl-x, center) var(--micl-y, center),
159
+ transparent 0%,
160
+ rgb(from var(--statelayer-color) r g b / calc(var(--statelayer-opacity) * var(--md-sys-state-ripple-opacity-factor))) 10%,
161
+ transparent 10%
162
+ ),
163
+ linear-gradient(rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity))),
164
+ linear-gradient(rgb(from var(--_list-item-background-color) r g b / var(--_list-item-background-opacity)));
165
+ -webkit-text-fill-color: var(--_headline-color);
166
+
167
+ // A timed border-radius transition also re-enables the native painting —
168
+ // the list transition is repeated here without it.
169
+ transition:
170
+ background-size 0ms,
171
+ --statelayer-opacity var(--md-comp-list-motion-duration) linear;
172
+ }
173
+ }
174
+ }
175
+
123
176
  [inert] #{$selects}::picker-icon {
124
177
  display: none;
125
178
  }