material 3.13.1 → 3.14.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 +28 -1
- package/dist/components/bottom-app-bar-toolbar/index.d.ts +8 -0
- package/dist/components/bottom-app-bar-toolbar/index.js +66 -0
- package/dist/components/bottom-app-bar-toolbar/structure.js +18 -0
- package/dist/components/chips/chip/chip.js +6 -4
- package/dist/components/dialog/features.js +9 -24
- package/dist/components/fab-menu/fab-menu.js +5 -6
- package/dist/components/fab-menu/index.d.ts +7 -0
- package/dist/components/listbox/index.d.ts +100 -0
- package/dist/components/listbox/index.js +1 -0
- package/dist/components/listbox/listbox.js +633 -0
- package/dist/elements/preupgrade/badge.css +1 -1
- package/dist/elements/preupgrade/bottom-app-bar.css +1 -1
- package/dist/elements/preupgrade/bottom-sheet.css +1 -1
- package/dist/elements/preupgrade/button-group.css +1 -1
- package/dist/elements/preupgrade/button.css +1 -1
- package/dist/elements/preupgrade/card.css +1 -1
- package/dist/elements/preupgrade/carousel.css +1 -1
- package/dist/elements/preupgrade/checkbox.css +1 -1
- package/dist/elements/preupgrade/chips.css +1 -1
- package/dist/elements/preupgrade/datepicker.css +1 -1
- package/dist/elements/preupgrade/dialog.css +1 -1
- package/dist/elements/preupgrade/divider.css +1 -1
- package/dist/elements/preupgrade/drawer.css +1 -1
- package/dist/elements/preupgrade/extended-fab.css +1 -1
- package/dist/elements/preupgrade/fab-menu.css +1 -1
- package/dist/elements/preupgrade/fab.css +1 -1
- package/dist/elements/preupgrade/icon-button.css +1 -1
- package/dist/elements/preupgrade/list.css +1 -1
- package/dist/elements/preupgrade/loading-indicator.css +1 -1
- package/dist/elements/preupgrade/menu.css +1 -1
- package/dist/elements/preupgrade/navigation-bar.css +1 -1
- package/dist/elements/preupgrade/navigation-rail.css +1 -1
- package/dist/elements/preupgrade/progress.css +1 -1
- package/dist/elements/preupgrade/radios.css +1 -1
- package/dist/elements/preupgrade/search.css +1 -1
- package/dist/elements/preupgrade/select.css +1 -1
- package/dist/elements/preupgrade/side-sheet.css +1 -1
- package/dist/elements/preupgrade/slider.css +1 -1
- package/dist/elements/preupgrade/snackbar.css +1 -1
- package/dist/elements/preupgrade/split-button.css +1 -1
- package/dist/elements/preupgrade/switch.css +1 -1
- package/dist/elements/preupgrade/tabs.css +1 -1
- package/dist/elements/preupgrade/text-field.css +1 -1
- package/dist/elements/preupgrade/timepicker.css +1 -1
- package/dist/elements/preupgrade/toolbar.css +1 -1
- package/dist/elements/preupgrade/tooltip.css +1 -1
- package/dist/elements/preupgrade/top-app-bar.css +1 -1
- package/dist/elements/preupgrade.css +1 -1
- package/dist/styles/badge.css +1 -1
- package/dist/styles/base-elements.css +1 -1
- package/dist/styles/base-lite.css +1 -1
- package/dist/styles/base.css +1 -1
- package/dist/styles/bottom-app-bar-toolbar.css +2 -0
- package/dist/styles/bottom-app-bar-toolbar.js +2 -0
- package/dist/styles/bottom-app-bar.css +1 -1
- package/dist/styles/bottom-sheet.css +1 -1
- package/dist/styles/button-filled-small-round.css +1 -1
- package/dist/styles/button-group.css +1 -1
- package/dist/styles/button.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/chips.css +1 -1
- package/dist/styles/contrast.css +1 -1
- package/dist/styles/datepicker.css +1 -1
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/divider.css +1 -1
- package/dist/styles/drawer.css +1 -1
- package/dist/styles/extended-fab.css +1 -1
- package/dist/styles/fab-menu.css +1 -1
- package/dist/styles/fab.css +1 -1
- package/dist/styles/icon-button.css +1 -1
- package/dist/styles/list.css +1 -1
- package/dist/styles/listbox.css +2 -0
- package/dist/styles/listbox.js +2 -0
- package/dist/styles/loading-indicator.css +1 -1
- package/dist/styles/menu.css +1 -1
- package/dist/styles/navigation-bar.css +1 -1
- package/dist/styles/navigation-rail.css +1 -1
- package/dist/styles/progress.css +1 -1
- package/dist/styles/radios.css +1 -1
- package/dist/styles/search.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/side-sheet.css +1 -1
- package/dist/styles/slider.css +1 -1
- package/dist/styles/snackbar.css +1 -1
- package/dist/styles/split-button.css +1 -1
- package/dist/styles/switch.css +1 -1
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/timepicker.css +1 -1
- package/dist/styles/toolbar.css +1 -1
- package/dist/styles/tooltip.css +1 -1
- package/dist/styles/top-app-bar.css +1 -1
- package/dist/styles/typography.css +1 -1
- package/dist/styles/utilities.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/themes/autumn-contrast.css +1 -1
- package/dist/themes/autumn.css +1 -1
- package/dist/themes/baseline-contrast.css +1 -1
- package/dist/themes/baseline.css +1 -1
- package/dist/themes/brownbeige-contrast.css +1 -1
- package/dist/themes/brownbeige.css +1 -1
- package/dist/themes/content-contrast.css +1 -1
- package/dist/themes/content.css +1 -1
- package/dist/themes/desert-contrast.css +1 -1
- package/dist/themes/desert.css +1 -1
- package/dist/themes/expressive-contrast.css +1 -1
- package/dist/themes/expressive.css +1 -1
- package/dist/themes/fidelity-contrast.css +1 -1
- package/dist/themes/fidelity.css +1 -1
- package/dist/themes/forest-contrast.css +1 -1
- package/dist/themes/forest.css +1 -1
- package/dist/themes/fruit-salad-contrast.css +1 -1
- package/dist/themes/fruit-salad.css +1 -1
- package/dist/themes/highcontrast-contrast.css +1 -1
- package/dist/themes/highcontrast.css +1 -1
- package/dist/themes/monochrome-contrast.css +1 -1
- package/dist/themes/monochrome.css +1 -1
- package/dist/themes/neutral-contrast.css +1 -1
- package/dist/themes/neutral.css +1 -1
- package/dist/themes/ocean-contrast.css +1 -1
- package/dist/themes/ocean.css +1 -1
- package/dist/themes/rainbow-contrast.css +1 -1
- package/dist/themes/rainbow.css +1 -1
- package/dist/themes/sageivory-contrast.css +1 -1
- package/dist/themes/sageivory.css +1 -1
- package/dist/themes/spring-contrast.css +1 -1
- package/dist/themes/spring.css +1 -1
- package/dist/themes/summer-contrast.css +1 -1
- package/dist/themes/summer.css +1 -1
- package/dist/themes/sunset-contrast.css +1 -1
- package/dist/themes/sunset.css +1 -1
- package/dist/themes/tealcaramel-contrast.css +1 -1
- package/dist/themes/tealcaramel.css +1 -1
- package/dist/themes/vibrant-contrast.css +1 -1
- package/dist/themes/vibrant.css +1 -1
- package/dist/tokens/catalogue.json +3 -3
- package/package.json +19 -1
- package/src/styles/components/_listbox.scss +95 -0
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
import { menuClosed, menuOpened } from "../menu/features/registry.js";
|
|
2
|
+
const attached = new WeakSet();
|
|
3
|
+
let instances = 0;
|
|
4
|
+
function snapshotOptions(list) {
|
|
5
|
+
if (!Array.isArray(list))
|
|
6
|
+
throw new TypeError("listbox options must be an array");
|
|
7
|
+
const seen = new Set();
|
|
8
|
+
return list.map((raw, index) => {
|
|
9
|
+
if (!raw || typeof raw !== "object")
|
|
10
|
+
throw new TypeError(`listbox option ${index} must be an object`);
|
|
11
|
+
const { id, text, disabled, data } = raw;
|
|
12
|
+
if (typeof id !== "string" || id === "")
|
|
13
|
+
throw new TypeError(`listbox option ${index} needs a nonempty string id`);
|
|
14
|
+
if (seen.has(id))
|
|
15
|
+
throw new TypeError(`listbox option id "${id}" is used twice`);
|
|
16
|
+
seen.add(id);
|
|
17
|
+
if (typeof text !== "string")
|
|
18
|
+
throw new TypeError(`listbox option "${id}" needs a string text`);
|
|
19
|
+
if (disabled !== undefined && typeof disabled !== "boolean")
|
|
20
|
+
throw new TypeError(`listbox option "${id}" disabled must be a boolean`);
|
|
21
|
+
return Object.freeze({ id, text, disabled: disabled === true, data });
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function optionSnapshot(option) {
|
|
25
|
+
return { id: option.id, text: option.text, disabled: option.disabled, data: option.data };
|
|
26
|
+
}
|
|
27
|
+
export function createListbox(config) {
|
|
28
|
+
if (!config || typeof config !== "object")
|
|
29
|
+
throw new TypeError("createListbox needs a config object");
|
|
30
|
+
const control = config.control;
|
|
31
|
+
if (!control || control.nodeType !== 1 || control.localName !== "div") {
|
|
32
|
+
throw new TypeError("listbox control must be a div, not a native input, button or select");
|
|
33
|
+
}
|
|
34
|
+
const element = control;
|
|
35
|
+
if (element.isContentEditable || element.hasAttribute("contenteditable")) {
|
|
36
|
+
throw new TypeError("listbox control must not be editable");
|
|
37
|
+
}
|
|
38
|
+
const interactive = element.querySelector("a[href],button,input,select,textarea,audio[controls],video[controls],summary,[tabindex],[contenteditable]");
|
|
39
|
+
if (interactive)
|
|
40
|
+
throw new TypeError(`listbox control contains an interactive ${interactive.localName} element`);
|
|
41
|
+
const role = element.getAttribute("role");
|
|
42
|
+
if (role && role !== "combobox" && role !== "none" && role !== "presentation") {
|
|
43
|
+
throw new TypeError(`listbox control has the conflicting role "${role}"`);
|
|
44
|
+
}
|
|
45
|
+
if (attached.has(element))
|
|
46
|
+
throw new TypeError("this control already has a listbox");
|
|
47
|
+
if (!element.isConnected)
|
|
48
|
+
throw new TypeError("listbox control must be connected to a document");
|
|
49
|
+
if (typeof HTMLElement.prototype.showPopover !== "function") {
|
|
50
|
+
throw new Error("createListbox needs the Popover API: this browser has no showPopover()");
|
|
51
|
+
}
|
|
52
|
+
const ariaLabel = config.ariaLabel;
|
|
53
|
+
if (typeof ariaLabel !== "string" || ariaLabel.trim() === "") {
|
|
54
|
+
throw new TypeError("listbox ariaLabel must be a nonempty string");
|
|
55
|
+
}
|
|
56
|
+
const placeholder = config.placeholder ?? "";
|
|
57
|
+
if (typeof placeholder !== "string")
|
|
58
|
+
throw new TypeError("listbox placeholder must be a string");
|
|
59
|
+
if (config.disabled !== undefined && typeof config.disabled !== "boolean")
|
|
60
|
+
throw new TypeError("listbox disabled must be a boolean");
|
|
61
|
+
if (config.on !== undefined && (typeof config.on !== "object" || config.on === null))
|
|
62
|
+
throw new TypeError("listbox on must be an object");
|
|
63
|
+
let options = snapshotOptions(config.options);
|
|
64
|
+
const initial = config.value ?? null;
|
|
65
|
+
if (initial !== null && (typeof initial !== "string" || !options.some((option) => option.id === initial))) {
|
|
66
|
+
throw new RangeError(`listbox has no option "${String(initial)}"`);
|
|
67
|
+
}
|
|
68
|
+
const selected = initial === null ? undefined : options.find((option) => option.id === initial);
|
|
69
|
+
if (selected && selected.text === ariaLabel)
|
|
70
|
+
throw new TypeError("listbox ariaLabel must name the field, not its value");
|
|
71
|
+
const originalText = element.textContent;
|
|
72
|
+
let writtenText = originalText;
|
|
73
|
+
let valueId = initial;
|
|
74
|
+
let disabled = config.disabled === true;
|
|
75
|
+
let activeIndex = -1;
|
|
76
|
+
let isOpen = false;
|
|
77
|
+
let destroyed = false;
|
|
78
|
+
let generation = 0;
|
|
79
|
+
let buffer = "";
|
|
80
|
+
let bufferAt = 0;
|
|
81
|
+
let tapActivation = false;
|
|
82
|
+
let observer = null;
|
|
83
|
+
const listeners = new Map();
|
|
84
|
+
const owned = new Map();
|
|
85
|
+
const rows = [];
|
|
86
|
+
const bound = [];
|
|
87
|
+
const temporary = [];
|
|
88
|
+
const domIds = new Map();
|
|
89
|
+
let domCounter = 0;
|
|
90
|
+
const popup = document.createElement("div");
|
|
91
|
+
popup.id = `mtrl-listbox-${++instances}`;
|
|
92
|
+
popup.className = "mtrl-listbox";
|
|
93
|
+
popup.setAttribute("popover", "manual");
|
|
94
|
+
popup.setAttribute("role", "listbox");
|
|
95
|
+
popup.setAttribute("aria-label", ariaLabel);
|
|
96
|
+
const setAttr = (name, value) => {
|
|
97
|
+
const entry = owned.get(name) ?? { original: element.getAttribute(name), written: null };
|
|
98
|
+
owned.set(name, entry);
|
|
99
|
+
entry.written = value;
|
|
100
|
+
if (value === null)
|
|
101
|
+
element.removeAttribute(name);
|
|
102
|
+
else
|
|
103
|
+
element.setAttribute(name, value);
|
|
104
|
+
};
|
|
105
|
+
const setText = (text) => {
|
|
106
|
+
writtenText = text;
|
|
107
|
+
element.textContent = text;
|
|
108
|
+
};
|
|
109
|
+
const optionOf = (id) => (id === null ? undefined : options.find((option) => option.id === id));
|
|
110
|
+
const optionIds = () => new Set(options.map((option) => option.id));
|
|
111
|
+
const subscript = (type, handler) => {
|
|
112
|
+
let set = listeners.get(type);
|
|
113
|
+
if (!set)
|
|
114
|
+
listeners.set(type, (set = new Set()));
|
|
115
|
+
set.add(handler);
|
|
116
|
+
};
|
|
117
|
+
const bind = (list, target, type, handler, options) => {
|
|
118
|
+
target.addEventListener(type, handler, options);
|
|
119
|
+
list.push([target, type, handler, options]);
|
|
120
|
+
};
|
|
121
|
+
const unbind = (list) => {
|
|
122
|
+
for (const [target, type, handler, options] of list.splice(0))
|
|
123
|
+
target.removeEventListener(type, handler, options);
|
|
124
|
+
};
|
|
125
|
+
const pathHas = (event, node) => event.composedPath().includes(node);
|
|
126
|
+
const onlyEnabled = (index) => index >= 0 && index < options.length && !options[index].disabled;
|
|
127
|
+
const domId = (option) => {
|
|
128
|
+
let id = domIds.get(option.id);
|
|
129
|
+
if (!id) {
|
|
130
|
+
const taken = optionIds();
|
|
131
|
+
do
|
|
132
|
+
id = `${popup.id}-o-${++domCounter}`;
|
|
133
|
+
while (taken.has(id));
|
|
134
|
+
domIds.set(option.id, id);
|
|
135
|
+
}
|
|
136
|
+
return id;
|
|
137
|
+
};
|
|
138
|
+
const syncActive = () => {
|
|
139
|
+
rows.forEach((row, index) => row.classList.toggle("mtrl-listbox__option--active", index === activeIndex));
|
|
140
|
+
if (!isOpen)
|
|
141
|
+
return;
|
|
142
|
+
const row = rows[activeIndex];
|
|
143
|
+
setAttr("aria-activedescendant", row && onlyEnabled(activeIndex) ? row.id : null);
|
|
144
|
+
};
|
|
145
|
+
const setActive = (index) => {
|
|
146
|
+
if (index === activeIndex)
|
|
147
|
+
return;
|
|
148
|
+
activeIndex = index;
|
|
149
|
+
syncActive();
|
|
150
|
+
if (isOpen)
|
|
151
|
+
rows[index]?.scrollIntoView({ block: "nearest" });
|
|
152
|
+
};
|
|
153
|
+
const updateValue = () => {
|
|
154
|
+
const option = optionOf(valueId);
|
|
155
|
+
setText(option ? option.text : placeholder);
|
|
156
|
+
rows.forEach((row, index) => row.setAttribute("aria-selected", String(options[index]?.id === valueId)));
|
|
157
|
+
};
|
|
158
|
+
const render = () => {
|
|
159
|
+
rows.length = 0;
|
|
160
|
+
popup.replaceChildren(...options.map((option) => {
|
|
161
|
+
const row = document.createElement("div");
|
|
162
|
+
row.className = "mtrl-listbox__option";
|
|
163
|
+
row.id = domId(option);
|
|
164
|
+
row.setAttribute("role", "option");
|
|
165
|
+
row.setAttribute("aria-selected", String(option.id === valueId));
|
|
166
|
+
if (option.disabled)
|
|
167
|
+
row.setAttribute("aria-disabled", "true");
|
|
168
|
+
row.textContent = option.text;
|
|
169
|
+
rows.push(row);
|
|
170
|
+
return row;
|
|
171
|
+
}));
|
|
172
|
+
syncActive();
|
|
173
|
+
};
|
|
174
|
+
const firstEnabled = () => options.findIndex((option) => !option.disabled);
|
|
175
|
+
const lastEnabled = () => {
|
|
176
|
+
for (let index = options.length - 1; index >= 0; index--)
|
|
177
|
+
if (!options[index].disabled)
|
|
178
|
+
return index;
|
|
179
|
+
return -1;
|
|
180
|
+
};
|
|
181
|
+
const selectedEnabled = () => {
|
|
182
|
+
const index = options.findIndex((option) => option.id === valueId);
|
|
183
|
+
return onlyEnabled(index) ? index : -1;
|
|
184
|
+
};
|
|
185
|
+
const nextEnabled = (from, step) => {
|
|
186
|
+
for (let index = from + step; index >= 0 && index < options.length; index += step)
|
|
187
|
+
if (!options[index].disabled)
|
|
188
|
+
return index;
|
|
189
|
+
return -1;
|
|
190
|
+
};
|
|
191
|
+
const moveActive = (distance) => {
|
|
192
|
+
const step = Math.sign(distance);
|
|
193
|
+
let index = activeIndex;
|
|
194
|
+
for (let remaining = Math.abs(distance); remaining > 0; remaining--) {
|
|
195
|
+
const next = nextEnabled(index, step);
|
|
196
|
+
if (next < 0)
|
|
197
|
+
break;
|
|
198
|
+
index = next;
|
|
199
|
+
}
|
|
200
|
+
if (index >= 0)
|
|
201
|
+
setActive(index);
|
|
202
|
+
};
|
|
203
|
+
const startIndex = (start) => {
|
|
204
|
+
const chosen = start === "first" || start === "last" ? -1 : selectedEnabled();
|
|
205
|
+
if (chosen >= 0)
|
|
206
|
+
return chosen;
|
|
207
|
+
return start === "last" || start === "selected-last" ? lastEnabled() : firstEnabled();
|
|
208
|
+
};
|
|
209
|
+
const emit = (type, detail) => {
|
|
210
|
+
for (const handler of [...(listeners.get(type) ?? [])]) {
|
|
211
|
+
if (destroyed)
|
|
212
|
+
return;
|
|
213
|
+
handler(detail);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
const hide = () => {
|
|
217
|
+
try {
|
|
218
|
+
if (popup.matches(":popover-open"))
|
|
219
|
+
popup.hidePopover();
|
|
220
|
+
}
|
|
221
|
+
catch {
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
const restore = () => {
|
|
225
|
+
for (const [name, entry] of owned) {
|
|
226
|
+
if (element.getAttribute(name) !== entry.written)
|
|
227
|
+
continue;
|
|
228
|
+
if (entry.original === null)
|
|
229
|
+
element.removeAttribute(name);
|
|
230
|
+
else
|
|
231
|
+
element.setAttribute(name, entry.original);
|
|
232
|
+
}
|
|
233
|
+
if (element.textContent === writtenText)
|
|
234
|
+
element.textContent = originalText;
|
|
235
|
+
};
|
|
236
|
+
const place = () => {
|
|
237
|
+
const viewport = document.documentElement;
|
|
238
|
+
const width = viewport.clientWidth;
|
|
239
|
+
const height = viewport.clientHeight;
|
|
240
|
+
const rect = element.getBoundingClientRect();
|
|
241
|
+
const rtl = getComputedStyle(element).direction === "rtl";
|
|
242
|
+
popup.style.minWidth = `${Math.min(rect.width, width)}px`;
|
|
243
|
+
popup.style.maxWidth = `${width}px`;
|
|
244
|
+
popup.style.maxHeight = "";
|
|
245
|
+
popup.style.left = `${rtl ? rect.right : rect.left}px`;
|
|
246
|
+
popup.style.top = `${rect.bottom}px`;
|
|
247
|
+
const natural = popup.getBoundingClientRect().height;
|
|
248
|
+
const below = Math.max(0, height - rect.bottom);
|
|
249
|
+
const above = Math.max(0, rect.top);
|
|
250
|
+
const flip = natural > below && above > below;
|
|
251
|
+
popup.style.maxHeight = `${flip ? above : below}px`;
|
|
252
|
+
const placed = popup.getBoundingClientRect();
|
|
253
|
+
popup.style.left = `${Math.max(0, Math.min(rtl ? rect.right - placed.width : rect.left, width - placed.width))}px`;
|
|
254
|
+
popup.style.top = `${flip ? Math.max(0, rect.top - placed.height) : rect.bottom}px`;
|
|
255
|
+
};
|
|
256
|
+
const observe = () => {
|
|
257
|
+
observer = new MutationObserver(() => {
|
|
258
|
+
if (!element.isConnected)
|
|
259
|
+
close();
|
|
260
|
+
});
|
|
261
|
+
observer.observe(element.getRootNode(), { childList: true, subtree: true });
|
|
262
|
+
};
|
|
263
|
+
const listenForDismissal = (opening) => {
|
|
264
|
+
bind(temporary, document, "pointerdown", (event) => {
|
|
265
|
+
if (event === opening || pathHas(event, element) || pathHas(event, popup))
|
|
266
|
+
return;
|
|
267
|
+
close(event);
|
|
268
|
+
}, true);
|
|
269
|
+
bind(temporary, element, "focusout", () => close());
|
|
270
|
+
bind(temporary, window, "scroll", (event) => {
|
|
271
|
+
if (!pathHas(event, popup))
|
|
272
|
+
close(event);
|
|
273
|
+
}, { capture: true, passive: true });
|
|
274
|
+
bind(temporary, window, "resize", () => close());
|
|
275
|
+
const visual = window.visualViewport;
|
|
276
|
+
if (visual) {
|
|
277
|
+
bind(temporary, visual, "resize", () => close());
|
|
278
|
+
bind(temporary, visual, "scroll", () => close());
|
|
279
|
+
}
|
|
280
|
+
const dialog = element.closest("dialog");
|
|
281
|
+
if (dialog)
|
|
282
|
+
bind(temporary, dialog, "close", () => close());
|
|
283
|
+
observe();
|
|
284
|
+
};
|
|
285
|
+
const open = (event, start = "selected-first") => {
|
|
286
|
+
if (destroyed || isOpen || disabled || !element.isConnected)
|
|
287
|
+
return handle;
|
|
288
|
+
const before = ++generation;
|
|
289
|
+
try {
|
|
290
|
+
activeIndex = startIndex(start);
|
|
291
|
+
popup.showPopover();
|
|
292
|
+
place();
|
|
293
|
+
listenForDismissal(event);
|
|
294
|
+
isOpen = true;
|
|
295
|
+
syncActive();
|
|
296
|
+
element.focus({ preventScroll: true });
|
|
297
|
+
if (destroyed || !isOpen || generation !== before)
|
|
298
|
+
return handle;
|
|
299
|
+
setAttr("aria-expanded", "true");
|
|
300
|
+
setAttr("aria-controls", popup.id);
|
|
301
|
+
menuOpened(handle, event);
|
|
302
|
+
}
|
|
303
|
+
catch (error) {
|
|
304
|
+
if (destroyed)
|
|
305
|
+
throw error;
|
|
306
|
+
unbind(temporary);
|
|
307
|
+
observer?.disconnect();
|
|
308
|
+
observer = null;
|
|
309
|
+
hide();
|
|
310
|
+
isOpen = false;
|
|
311
|
+
activeIndex = -1;
|
|
312
|
+
setAttr("aria-expanded", "false");
|
|
313
|
+
setAttr("aria-controls", null);
|
|
314
|
+
setAttr("aria-activedescendant", null);
|
|
315
|
+
throw error;
|
|
316
|
+
}
|
|
317
|
+
if (generation === before && isOpen && !destroyed)
|
|
318
|
+
emit("open", { listbox: handle, originalEvent: event });
|
|
319
|
+
return handle;
|
|
320
|
+
};
|
|
321
|
+
const close = (event) => {
|
|
322
|
+
if (destroyed || !isOpen)
|
|
323
|
+
return handle;
|
|
324
|
+
isOpen = false;
|
|
325
|
+
generation++;
|
|
326
|
+
activeIndex = -1;
|
|
327
|
+
buffer = "";
|
|
328
|
+
unbind(temporary);
|
|
329
|
+
observer?.disconnect();
|
|
330
|
+
observer = null;
|
|
331
|
+
hide();
|
|
332
|
+
setAttr("aria-expanded", "false");
|
|
333
|
+
setAttr("aria-controls", null);
|
|
334
|
+
setAttr("aria-activedescendant", null);
|
|
335
|
+
syncActive();
|
|
336
|
+
menuClosed(handle);
|
|
337
|
+
emit("close", { listbox: handle, originalEvent: event });
|
|
338
|
+
return handle;
|
|
339
|
+
};
|
|
340
|
+
const commit = (event) => {
|
|
341
|
+
const option = options[activeIndex];
|
|
342
|
+
if (!option || option.disabled) {
|
|
343
|
+
close(event);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
const previousValue = valueId;
|
|
347
|
+
const before = generation;
|
|
348
|
+
if (option.id !== previousValue) {
|
|
349
|
+
valueId = option.id;
|
|
350
|
+
updateValue();
|
|
351
|
+
emit("change", { listbox: handle, originalEvent: event, value: option.id, previousValue, option: optionSnapshot(option) });
|
|
352
|
+
}
|
|
353
|
+
if (generation === before)
|
|
354
|
+
close(event);
|
|
355
|
+
};
|
|
356
|
+
const search = (text) => {
|
|
357
|
+
const query = text.toLowerCase();
|
|
358
|
+
const cycling = [...text].every((character) => character === text[0]);
|
|
359
|
+
const length = options.length;
|
|
360
|
+
if (!length)
|
|
361
|
+
return -1;
|
|
362
|
+
const start = activeIndex < 0 ? 0 : cycling ? activeIndex + 1 : activeIndex;
|
|
363
|
+
for (let offset = 0; offset < length; offset++) {
|
|
364
|
+
const index = (start + offset) % length;
|
|
365
|
+
const option = options[index];
|
|
366
|
+
if (!option.disabled && option.text.toLowerCase().startsWith(query))
|
|
367
|
+
return index;
|
|
368
|
+
}
|
|
369
|
+
return -1;
|
|
370
|
+
};
|
|
371
|
+
const typeahead = (character) => {
|
|
372
|
+
const now = performance.now();
|
|
373
|
+
if (now - bufferAt > 500)
|
|
374
|
+
buffer = "";
|
|
375
|
+
buffer += character;
|
|
376
|
+
bufferAt = now;
|
|
377
|
+
let match = search(buffer);
|
|
378
|
+
if (match < 0 && buffer.length > 1) {
|
|
379
|
+
buffer = character;
|
|
380
|
+
match = search(buffer);
|
|
381
|
+
}
|
|
382
|
+
if (match >= 0)
|
|
383
|
+
setActive(match);
|
|
384
|
+
};
|
|
385
|
+
const onKeyDown = (event) => {
|
|
386
|
+
if (destroyed || event.defaultPrevented || event.isComposing || event.keyCode === 229)
|
|
387
|
+
return;
|
|
388
|
+
if (event.ctrlKey || event.metaKey)
|
|
389
|
+
return;
|
|
390
|
+
const key = event.key;
|
|
391
|
+
if (event.altKey) {
|
|
392
|
+
if (key === "ArrowDown" && !isOpen) {
|
|
393
|
+
event.preventDefault();
|
|
394
|
+
open(event);
|
|
395
|
+
}
|
|
396
|
+
else if (key === "ArrowUp" && isOpen) {
|
|
397
|
+
event.preventDefault();
|
|
398
|
+
commit(event);
|
|
399
|
+
}
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
if (!isOpen) {
|
|
403
|
+
if (disabled)
|
|
404
|
+
return;
|
|
405
|
+
if (key === "Enter" || key === " ") {
|
|
406
|
+
event.preventDefault();
|
|
407
|
+
open(event);
|
|
408
|
+
}
|
|
409
|
+
else if (key === "ArrowDown") {
|
|
410
|
+
event.preventDefault();
|
|
411
|
+
open(event, "selected-first");
|
|
412
|
+
}
|
|
413
|
+
else if (key === "ArrowUp") {
|
|
414
|
+
event.preventDefault();
|
|
415
|
+
open(event, "selected-last");
|
|
416
|
+
}
|
|
417
|
+
else if (key === "Home") {
|
|
418
|
+
event.preventDefault();
|
|
419
|
+
open(event, "first");
|
|
420
|
+
}
|
|
421
|
+
else if (key === "End") {
|
|
422
|
+
event.preventDefault();
|
|
423
|
+
open(event, "last");
|
|
424
|
+
}
|
|
425
|
+
else if (key.length === 1) {
|
|
426
|
+
event.preventDefault();
|
|
427
|
+
open(event);
|
|
428
|
+
if (isOpen)
|
|
429
|
+
typeahead(key);
|
|
430
|
+
}
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
if (key === "Enter") {
|
|
434
|
+
event.preventDefault();
|
|
435
|
+
commit(event);
|
|
436
|
+
}
|
|
437
|
+
else if (key === " ") {
|
|
438
|
+
event.preventDefault();
|
|
439
|
+
if (buffer && performance.now() - bufferAt <= 500)
|
|
440
|
+
typeahead(" ");
|
|
441
|
+
else
|
|
442
|
+
commit(event);
|
|
443
|
+
}
|
|
444
|
+
else if (key === "ArrowDown" || key === "PageDown") {
|
|
445
|
+
event.preventDefault();
|
|
446
|
+
moveActive(key === "ArrowDown" ? 1 : 10);
|
|
447
|
+
}
|
|
448
|
+
else if (key === "ArrowUp" || key === "PageUp") {
|
|
449
|
+
event.preventDefault();
|
|
450
|
+
moveActive(key === "ArrowUp" ? -1 : -10);
|
|
451
|
+
}
|
|
452
|
+
else if (key === "Home") {
|
|
453
|
+
event.preventDefault();
|
|
454
|
+
setActive(firstEnabled());
|
|
455
|
+
}
|
|
456
|
+
else if (key === "End") {
|
|
457
|
+
event.preventDefault();
|
|
458
|
+
setActive(lastEnabled());
|
|
459
|
+
}
|
|
460
|
+
else if (key === "Escape") {
|
|
461
|
+
event.preventDefault();
|
|
462
|
+
close(event);
|
|
463
|
+
}
|
|
464
|
+
else if (key === "Tab") {
|
|
465
|
+
commit(event);
|
|
466
|
+
}
|
|
467
|
+
else if (key.length === 1) {
|
|
468
|
+
event.preventDefault();
|
|
469
|
+
typeahead(key);
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
const rowAt = (event) => {
|
|
473
|
+
const target = event.target;
|
|
474
|
+
const row = target && target.nodeType === 1 ? target.closest(".mtrl-listbox__option") : null;
|
|
475
|
+
return row ? rows.indexOf(row) : -1;
|
|
476
|
+
};
|
|
477
|
+
const onPointerDown = (event) => {
|
|
478
|
+
tapActivation = false;
|
|
479
|
+
event.preventDefault();
|
|
480
|
+
};
|
|
481
|
+
const onPointerUp = (event) => {
|
|
482
|
+
if (event.pointerType === "mouse" || event.button !== 0)
|
|
483
|
+
return;
|
|
484
|
+
const index = rowAt(event);
|
|
485
|
+
if (onlyEnabled(index)) {
|
|
486
|
+
activeIndex = index;
|
|
487
|
+
commit(event);
|
|
488
|
+
tapActivation = isOpen;
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
const onPointerMove = (event) => {
|
|
492
|
+
const index = rowAt(event);
|
|
493
|
+
if (onlyEnabled(index))
|
|
494
|
+
setActive(index);
|
|
495
|
+
};
|
|
496
|
+
const onClick = (event) => {
|
|
497
|
+
if (tapActivation) {
|
|
498
|
+
tapActivation = false;
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
const index = rowAt(event);
|
|
502
|
+
if (onlyEnabled(index)) {
|
|
503
|
+
activeIndex = index;
|
|
504
|
+
commit(event);
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
const onControlClick = (event) => {
|
|
508
|
+
if (destroyed || disabled)
|
|
509
|
+
return;
|
|
510
|
+
if (isOpen)
|
|
511
|
+
close(event);
|
|
512
|
+
else
|
|
513
|
+
open(event);
|
|
514
|
+
};
|
|
515
|
+
const handle = {
|
|
516
|
+
element: popup,
|
|
517
|
+
open,
|
|
518
|
+
close,
|
|
519
|
+
toggle: (event) => (isOpen ? close(event) : open(event)),
|
|
520
|
+
isOpen: () => isOpen,
|
|
521
|
+
getValue: () => valueId,
|
|
522
|
+
setValue: (id) => {
|
|
523
|
+
if (destroyed)
|
|
524
|
+
return handle;
|
|
525
|
+
if (id !== null && typeof id !== "string")
|
|
526
|
+
throw new TypeError("listbox value must be a string or null");
|
|
527
|
+
if (id !== null && !optionOf(id))
|
|
528
|
+
throw new RangeError(`listbox has no option "${id}"`);
|
|
529
|
+
valueId = id;
|
|
530
|
+
updateValue();
|
|
531
|
+
if (isOpen) {
|
|
532
|
+
const index = options.findIndex((option) => option.id === id);
|
|
533
|
+
if (onlyEnabled(index))
|
|
534
|
+
setActive(index);
|
|
535
|
+
}
|
|
536
|
+
return handle;
|
|
537
|
+
},
|
|
538
|
+
getOptions: () => options.map(optionSnapshot),
|
|
539
|
+
setOptions: (next) => {
|
|
540
|
+
if (destroyed)
|
|
541
|
+
return handle;
|
|
542
|
+
const snapshot = snapshotOptions(next);
|
|
543
|
+
const previousActive = options[activeIndex]?.id;
|
|
544
|
+
options = snapshot;
|
|
545
|
+
const ids = optionIds();
|
|
546
|
+
for (const id of [...domIds.keys()])
|
|
547
|
+
if (!ids.has(id))
|
|
548
|
+
domIds.delete(id);
|
|
549
|
+
if (valueId !== null && !optionOf(valueId))
|
|
550
|
+
valueId = null;
|
|
551
|
+
activeIndex = -1;
|
|
552
|
+
render();
|
|
553
|
+
updateValue();
|
|
554
|
+
if (isOpen) {
|
|
555
|
+
const kept = previousActive === undefined ? -1 : options.findIndex((option) => option.id === previousActive);
|
|
556
|
+
setActive(onlyEnabled(kept) ? kept : startIndex("selected-first"));
|
|
557
|
+
}
|
|
558
|
+
return handle;
|
|
559
|
+
},
|
|
560
|
+
setDisabled: (next) => {
|
|
561
|
+
if (destroyed)
|
|
562
|
+
return handle;
|
|
563
|
+
disabled = next === true;
|
|
564
|
+
setAttr("aria-disabled", disabled ? "true" : null);
|
|
565
|
+
if (disabled)
|
|
566
|
+
close();
|
|
567
|
+
return handle;
|
|
568
|
+
},
|
|
569
|
+
isDisabled: () => disabled,
|
|
570
|
+
on: (type, handler) => {
|
|
571
|
+
if (!destroyed)
|
|
572
|
+
subscript(type, handler);
|
|
573
|
+
return handle;
|
|
574
|
+
},
|
|
575
|
+
off: (type, handler) => {
|
|
576
|
+
listeners.get(type)?.delete(handler);
|
|
577
|
+
return handle;
|
|
578
|
+
},
|
|
579
|
+
destroy: () => {
|
|
580
|
+
if (destroyed)
|
|
581
|
+
return;
|
|
582
|
+
destroyed = true;
|
|
583
|
+
generation++;
|
|
584
|
+
buffer = "";
|
|
585
|
+
if (isOpen) {
|
|
586
|
+
isOpen = false;
|
|
587
|
+
menuClosed(handle);
|
|
588
|
+
}
|
|
589
|
+
unbind(temporary);
|
|
590
|
+
unbind(bound);
|
|
591
|
+
observer?.disconnect();
|
|
592
|
+
observer = null;
|
|
593
|
+
hide();
|
|
594
|
+
popup.remove();
|
|
595
|
+
restore();
|
|
596
|
+
attached.delete(element);
|
|
597
|
+
},
|
|
598
|
+
};
|
|
599
|
+
attached.add(element);
|
|
600
|
+
try {
|
|
601
|
+
element.after(popup);
|
|
602
|
+
setAttr("role", "combobox");
|
|
603
|
+
setAttr("tabindex", "0");
|
|
604
|
+
setAttr("aria-haspopup", "listbox");
|
|
605
|
+
setAttr("aria-label", ariaLabel);
|
|
606
|
+
setAttr("aria-expanded", "false");
|
|
607
|
+
if (disabled)
|
|
608
|
+
setAttr("aria-disabled", "true");
|
|
609
|
+
bind(bound, element, "keydown", onKeyDown);
|
|
610
|
+
bind(bound, element, "click", onControlClick);
|
|
611
|
+
bind(bound, popup, "pointerdown", onPointerDown);
|
|
612
|
+
bind(bound, popup, "pointerup", onPointerUp);
|
|
613
|
+
bind(bound, popup, "pointermove", onPointerMove);
|
|
614
|
+
bind(bound, popup, "click", onClick);
|
|
615
|
+
render();
|
|
616
|
+
updateValue();
|
|
617
|
+
const handlers = (config.on ?? {});
|
|
618
|
+
for (const [type, handler] of Object.entries(handlers)) {
|
|
619
|
+
if (typeof handler === "function")
|
|
620
|
+
subscript(type, handler);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
catch (error) {
|
|
624
|
+
destroyed = true;
|
|
625
|
+
unbind(bound);
|
|
626
|
+
popup.remove();
|
|
627
|
+
restore();
|
|
628
|
+
attached.delete(element);
|
|
629
|
+
throw error;
|
|
630
|
+
}
|
|
631
|
+
return handle;
|
|
632
|
+
}
|
|
633
|
+
export default createListbox;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! material v3.
|
|
1
|
+
/*! material v3.14.0 | MIT */
|
|
2
2
|
@layer mtrl.preupgrade{m-badge:not(:defined){display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;vertical-align:middle;overflow:hidden;height:16px;min-width:16px;max-width:34px;padding:0 4px;border-radius:var(--mtrl-sys-shape-corner-full, 9999px);font-weight:500;font-size:11px;line-height:16px;background-color:var(--mtrl-sys-color-error);color:var(--mtrl-sys-color-on-error)}m-badge:not(:defined)[color=primary]{background-color:var(--mtrl-sys-color-primary);color:var(--mtrl-sys-color-on-primary)}m-badge:not(:defined)[color=secondary]{background-color:var(--mtrl-sys-color-secondary);color:var(--mtrl-sys-color-on-secondary)}m-badge:not(:defined)[color=tertiary]{background-color:var(--mtrl-sys-color-tertiary);color:var(--mtrl-sys-color-on-tertiary)}m-badge:not(:defined)[color=success]{background-color:var(--mtrl-sys-color-success);color:var(--mtrl-sys-color-on-success)}m-badge:not(:defined)[color=warning]{background-color:var(--mtrl-sys-color-warning);color:var(--mtrl-sys-color-on-warning)}m-badge:not(:defined)[color=info]{background-color:var(--mtrl-sys-color-info);color:var(--mtrl-sys-color-on-info)}m-badge:not(:defined):empty[label]:not([label=""])::before{content:attr(label)}m-badge:not(:defined):not([variant=small]):is(:empty:not([label]),[label=""],[label="0"]){width:0;height:0;min-width:0;max-width:none;padding:0;font-size:0;background-color:rgba(0,0,0,0)}m-badge:not(:defined)[variant=small]{width:6px;height:6px;min-width:6px;max-width:none;padding:0;font-size:0}[data-mtrl-ssr]:not(:defined):not(#\0),[data-mtrl-ssr]:not(:defined):not(#\0)::before,[data-mtrl-ssr]:not(:defined):not(#\0)::after,[data-mtrl-ssr]:not(:defined):not(#\0) > :defined{all:revert-layer}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! material v3.
|
|
1
|
+
/*! material v3.14.0 | MIT */
|
|
2
2
|
@layer mtrl.preupgrade{m-bottom-app-bar:not(:defined){position:absolute;bottom:0;left:0;right:0;display:flex;align-items:center;gap:4px;box-sizing:border-box;height:80px;padding:12px 16px 12px 4px;background-color:var(--mtrl-sys-color-surface-container)}m-bottom-app-bar:not(:defined)>[slot=fab]{margin-left:auto}[data-mtrl-ssr]:not(:defined):not(#\0),[data-mtrl-ssr]:not(:defined):not(#\0)::before,[data-mtrl-ssr]:not(:defined):not(#\0)::after,[data-mtrl-ssr]:not(:defined):not(#\0) > :defined{all:revert-layer}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! material v3.
|
|
1
|
+
/*! material v3.14.0 | MIT */
|
|
2
2
|
@layer mtrl.preupgrade{m-bottom-sheet:not(:defined){display:none}[data-mtrl-ssr]:not(:defined):not(#\0),[data-mtrl-ssr]:not(:defined):not(#\0)::before,[data-mtrl-ssr]:not(:defined):not(#\0)::after,[data-mtrl-ssr]:not(:defined):not(#\0) > :defined{all:revert-layer}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! material v3.
|
|
1
|
+
/*! material v3.14.0 | MIT */
|
|
2
2
|
@layer mtrl.preupgrade{m-button-group:not(:defined){display:inline-flex;vertical-align:baseline;gap:12px;white-space:nowrap}m-button-group:not(:defined)::before{width:0;height:32px;margin-inline-end:-12px;align-self:flex-start;margin-block-start:max(-4px,2px*var(--mtrl-density, 0))}m-button-group:not(:defined):has(>[icon]:empty:first-child){align-items:center}m-button-group:not(:defined):has(>[icon]:empty:first-child)::before{content:""}m-button-group:not(:defined)[size=xs]{gap:18px}m-button-group:not(:defined):is([size=m],[size=l],[size=xl]){gap:8px}m-button-group:not(:defined)[density=comfortable]>*{height:36px}m-button-group:not(:defined)[density=compact]>*{height:32px}m-button-group:not(:defined)[size=xs]>*{height:max(32px, 32px + 4px * var(--mtrl-density, 0));padding:0 13px}m-button-group:not(:defined)[size=xs][density=comfortable]>*{height:32px}m-button-group:not(:defined)[size=xs][density=compact]>*{height:32px}m-button-group:not(:defined)[size=xs]::before{height:26px;margin-block-start:max(0px,2px*var(--mtrl-density, 0));margin-inline-end:-18px}m-button-group:not(:defined)[size=m]>*{height:max(32px, 56px + 4px * var(--mtrl-density, 0));padding:0 25px;font-size:16px;line-height:24px;letter-spacing:.15px}m-button-group:not(:defined)[size=m][density=comfortable]>*{height:52px}m-button-group:not(:defined)[size=m][density=compact]>*{height:48px}m-button-group:not(:defined)[size=m]::before{height:40px;margin-block-start:max(-12px,2px*var(--mtrl-density, 0))}m-button-group:not(:defined)[size=l]>*{height:max(32px, 96px + 4px * var(--mtrl-density, 0));padding:0 50px;font-size:24px;line-height:32px}m-button-group:not(:defined)[size=l][density=comfortable]>*{height:92px}m-button-group:not(:defined)[size=l][density=compact]>*{height:88px}m-button-group:not(:defined)[size=l]::before{height:64px;margin-block-start:max(-32px,2px*var(--mtrl-density, 0))}m-button-group:not(:defined)[size=xl]>*{height:max(32px, 136px + 4px * var(--mtrl-density, 0));padding:0 67px;font-size:32px;line-height:40px}m-button-group:not(:defined)[size=xl][density=comfortable]>*{height:132px}m-button-group:not(:defined)[size=xl][density=compact]>*{height:128px}m-button-group:not(:defined)[size=xl]::before{height:88px;margin-block-start:max(-52px,2px*var(--mtrl-density, 0))}m-button-group:not(:defined):is([size=m],[size=l],[size=xl])::before{margin-inline-end:-8px}m-button-group:not(:defined):is([size=l],[size=xl])>*{letter-spacing:0;font-weight:400}m-button-group:not(:defined)[density=comfortable]::before{margin-block-start:-2px}m-button-group:not(:defined)[density=compact]::before{margin-block-start:-4px}m-button-group:not(:defined)[size=xs][density=comfortable]::before{margin-block-start:0px}m-button-group:not(:defined)[size=xs][density=compact]::before{margin-block-start:0px}m-button-group:not(:defined)[size=m][density=comfortable]::before{margin-block-start:-2px}m-button-group:not(:defined)[size=m][density=compact]::before{margin-block-start:-4px}m-button-group:not(:defined)[size=l][density=comfortable]::before{margin-block-start:-2px}m-button-group:not(:defined)[size=l][density=compact]::before{margin-block-start:-4px}m-button-group:not(:defined)[size=xl][density=comfortable]::before{margin-block-start:-2px}m-button-group:not(:defined)[size=xl][density=compact]::before{margin-block-start:-4px}m-button-group:not(:defined)>*{visibility:hidden;display:inline-flex;align-items:center;flex:none;min-width:58px;font-family:var(--mtrl-ref-typeface-plain, Roboto, sans-serif);height:max(32px, 40px + 4px * var(--mtrl-density, 0));padding:0 17px;font-size:14px;line-height:20px;letter-spacing:.1px;font-weight:500}m-button-group:not(:defined)>*[icon]:empty{min-width:0;padding:0;aspect-ratio:1}m-button-group:not(:defined)[kind=connected]{gap:2px}m-button-group:not(:defined)[kind=connected]::before{margin-inline-end:-2px}m-button-group:not(:defined):is(:not([size]),[size=xs],[size=s])[kind=connected]>*{min-width:48px}[data-mtrl-ssr]:not(:defined):not(#\0),[data-mtrl-ssr]:not(:defined):not(#\0)::before,[data-mtrl-ssr]:not(:defined):not(#\0)::after,[data-mtrl-ssr]:not(:defined):not(#\0) > :defined{all:revert-layer}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! material v3.
|
|
1
|
+
/*! material v3.14.0 | MIT */
|
|
2
2
|
@layer mtrl.preupgrade{m-button:not(:defined){display:inline-flex;vertical-align:middle;align-items:center;justify-content:center;box-sizing:border-box;min-width:58px;white-space:nowrap;background-color:var(--mtrl-sys-color-primary);color:var(--mtrl-sys-color-on-primary);height:max(32px, 40px + 4px * var(--mtrl-density, 0));padding:0 16px;gap:8px;border-radius:max(16px, 20px + 2px * var(--mtrl-density, 0));font-family:var(--mtrl-ref-typeface-plain, Roboto, sans-serif);font-size:14px;line-height:20px;letter-spacing:.1px;font-weight:500}m-button:not(:defined)[icon]::before,m-button:not(:defined)[icon][icon-position=end]::after{width:20px;height:20px}m-button:not(:defined)[size=xs]{height:max(32px, 32px + 4px * var(--mtrl-density, 0));padding:0 12px;gap:4px;border-radius:max(16px, 16px + 2px * var(--mtrl-density, 0));font-family:var(--mtrl-ref-typeface-plain, Roboto, sans-serif);font-size:14px;line-height:20px;letter-spacing:.1px;font-weight:500}m-button:not(:defined)[size=xs][icon]::before,m-button:not(:defined)[size=xs][icon][icon-position=end]::after{width:20px;height:20px}m-button:not(:defined)[size=s]{height:max(32px, 40px + 4px * var(--mtrl-density, 0));padding:0 16px;gap:8px;border-radius:max(16px, 20px + 2px * var(--mtrl-density, 0));font-family:var(--mtrl-ref-typeface-plain, Roboto, sans-serif);font-size:14px;line-height:20px;letter-spacing:.1px;font-weight:500}m-button:not(:defined)[size=s][icon]::before,m-button:not(:defined)[size=s][icon][icon-position=end]::after{width:20px;height:20px}m-button:not(:defined)[size=m]{height:max(32px, 56px + 4px * var(--mtrl-density, 0));padding:0 24px;gap:8px;border-radius:max(16px, 28px + 2px * var(--mtrl-density, 0));font-family:var(--mtrl-ref-typeface-brand, Roboto, sans-serif);font-size:16px;line-height:24px;letter-spacing:.15px;font-weight:500}m-button:not(:defined)[size=m][icon]::before,m-button:not(:defined)[size=m][icon][icon-position=end]::after{width:24px;height:24px}m-button:not(:defined)[size=l]{height:max(32px, 96px + 4px * var(--mtrl-density, 0));padding:0 48px;gap:12px;border-radius:max(16px, 48px + 2px * var(--mtrl-density, 0));font-family:var(--mtrl-ref-typeface-brand, Roboto, sans-serif);font-size:24px;line-height:32px;letter-spacing:0;font-weight:400}m-button:not(:defined)[size=l][icon]::before,m-button:not(:defined)[size=l][icon][icon-position=end]::after{width:32px;height:32px}m-button:not(:defined)[size=xl]{height:max(32px, 136px + 4px * var(--mtrl-density, 0));padding:0 64px;gap:16px;border-radius:max(16px, 68px + 2px * var(--mtrl-density, 0));font-family:var(--mtrl-ref-typeface-brand, Roboto, sans-serif);font-size:32px;line-height:40px;letter-spacing:0;font-weight:400}m-button:not(:defined)[size=xl][icon]::before,m-button:not(:defined)[size=xl][icon][icon-position=end]::after{width:40px;height:40px}m-button:not(:defined)[variant=filled]{background-color:var(--mtrl-sys-color-primary);color:var(--mtrl-sys-color-on-primary)}m-button:not(:defined)[variant=elevated]{background-color:var(--mtrl-sys-color-surface-container-low);color:var(--mtrl-sys-color-primary)}m-button:not(:defined)[variant=tonal]{background-color:var(--mtrl-sys-color-secondary-container);color:var(--mtrl-sys-color-on-secondary-container)}m-button:not(:defined)[variant=outlined]{background-color:rgba(0,0,0,0);color:var(--mtrl-sys-color-on-surface-variant)}m-button:not(:defined)[variant=text]{background-color:rgba(0,0,0,0);color:var(--mtrl-sys-color-primary)}m-button:not(:defined)[variant=outlined]{border:1px solid var(--mtrl-sys-color-outline-variant)}m-button:not(:defined)[variant=text]{padding:0 12px}m-button:not(:defined)[icon]::before,m-button:not(:defined)[icon][icon-position=end]::after{content:"";flex:none}m-button:not(:defined)[icon][icon-position=end]::before{content:none}m-button:not(:defined)[icon]:not([size]),m-button:not(:defined)[icon][size=s]{padding-inline-start:12px}m-button:not(:defined)[icon]:not([size])[icon-position=end],m-button:not(:defined)[icon][size=s][icon-position=end]{padding-inline-start:16px;padding-inline-end:12px}m-button:not(:defined)[variant=text][icon]:not([size]),m-button:not(:defined)[variant=text][icon][size=xs],m-button:not(:defined)[variant=text][icon][size=s]{padding-inline:12px 16px}m-button:not(:defined)[variant=text][icon]:not([size])[icon-position=end],m-button:not(:defined)[variant=text][icon][size=xs][icon-position=end],m-button:not(:defined)[variant=text][icon][size=s][icon-position=end]{padding-inline:16px 12px}m-button:not(:defined)[variant=text][icon][size=m]{padding:0 24px}m-button:not(:defined)[variant=text][icon][size=l]{padding:0 48px}m-button:not(:defined)[variant=text][icon][size=xl]{padding:0 64px}[data-mtrl-ssr]:not(:defined):not(#\0),[data-mtrl-ssr]:not(:defined):not(#\0)::before,[data-mtrl-ssr]:not(:defined):not(#\0)::after,[data-mtrl-ssr]:not(:defined):not(#\0) > :defined{all:revert-layer}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! material v3.
|
|
1
|
+
/*! material v3.14.0 | MIT */
|
|
2
2
|
@layer mtrl.preupgrade{m-card:not(:defined){display:flex;flex-direction:column;box-sizing:border-box;padding:16px;border-radius:var(--mtrl-sys-shape-corner-medium, 12px);background-color:var(--mtrl-sys-color-surface-container-low);color:var(--mtrl-sys-color-on-surface);font-family:var(--mtrl-ref-typeface-plain, Roboto, sans-serif);font-size:14px;line-height:20px;letter-spacing:.25px;font-weight:400}m-card:not(:defined)[variant=filled]{background-color:var(--mtrl-sys-color-surface-container-highest)}m-card:not(:defined)[variant=outlined]{border:1px solid var(--mtrl-sys-color-outline-variant);background-color:var(--mtrl-sys-color-surface)}m-card:not(:defined)[headline]::before{content:attr(headline);order:-2;font-family:var(--mtrl-ref-typeface-brand, Roboto, sans-serif);font-size:22px;line-height:28px;letter-spacing:0;font-weight:400}m-card:not(:defined)[subhead]::after{content:attr(subhead);order:-1;color:var(--mtrl-sys-color-on-surface-variant)}m-card:not(:defined)[headline]:not([subhead])::before,m-card:not(:defined)[subhead]::after{margin-bottom:16px}m-card:not(:defined)>[slot=headline]{order:-2;font-family:var(--mtrl-ref-typeface-brand, Roboto, sans-serif);font-size:22px;line-height:28px;letter-spacing:0;font-weight:400}m-card:not(:defined)>[slot=subhead]{order:-1;color:var(--mtrl-sys-color-on-surface-variant)}m-card:not(:defined):not(:has(>[slot=actions]~[slot=actions]))>[slot=actions]{align-self:flex-end;margin-block:24px -8px;margin-inline:-8px}m-card:not(:defined):not(:has(>[slot=actions]~[slot=actions]))[actions-align=start]>[slot=actions],m-card:not(:defined):not(:has(>[slot=actions]~[slot=actions]))[actions-align=space-between]>[slot=actions]{align-self:flex-start}m-card:not(:defined):not(:has(>[slot=actions]~[slot=actions]))[actions-align=center]>[slot=actions]{align-self:center}[data-mtrl-ssr]:not(:defined):not(#\0),[data-mtrl-ssr]:not(:defined):not(#\0)::before,[data-mtrl-ssr]:not(:defined):not(#\0)::after,[data-mtrl-ssr]:not(:defined):not(#\0) > :defined{all:revert-layer}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! material v3.
|
|
1
|
+
/*! material v3.14.0 | MIT */
|
|
2
2
|
@layer mtrl.preupgrade{m-carousel:not(:defined){display:block}m-carousel:not(:defined)>*{visibility:hidden;display:none}[data-mtrl-ssr]:not(:defined):not(#\0),[data-mtrl-ssr]:not(:defined):not(#\0)::before,[data-mtrl-ssr]:not(:defined):not(#\0)::after,[data-mtrl-ssr]:not(:defined):not(#\0) > :defined{all:revert-layer}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! material v3.
|
|
1
|
+
/*! material v3.14.0 | MIT */
|
|
2
2
|
@layer mtrl.preupgrade{m-checkbox:not(:defined){display:inline-flex;align-items:center;box-sizing:border-box;min-height:48px;padding:4px 0;color:var(--mtrl-sys-color-on-surface);font-family:var(--mtrl-ref-typeface-plain, Roboto, sans-serif);font-size:16px;line-height:24px;letter-spacing:.5px;font-weight:400}m-checkbox:not(:defined)::before{content:"";flex:none;box-sizing:border-box;width:18px;height:18px;margin-inline-end:12px;border:2px solid var(--mtrl-sys-color-on-surface-variant);border-radius:2px}m-checkbox:not(:defined)[checked]::before{border-color:var(--mtrl-sys-color-primary);background-color:var(--mtrl-sys-color-primary)}m-checkbox:not(:defined)[label-position=start]::before{order:1;margin-inline:12px 0}m-checkbox:not(:defined):empty:is(:not([label]),[label=""]){min-width:48px;justify-content:center}m-checkbox:not(:defined):empty:is(:not([label]),[label=""])::before{margin-inline:0}[data-mtrl-ssr]:not(:defined):not(#\0),[data-mtrl-ssr]:not(:defined):not(#\0)::before,[data-mtrl-ssr]:not(:defined):not(#\0)::after,[data-mtrl-ssr]:not(:defined):not(#\0) > :defined{all:revert-layer}}
|