@spfx-fast/sharepoint-ui 0.0.0-stage → 0.4.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/AGENTS.md +211 -0
- package/LICENSE +21 -0
- package/README.md +897 -2
- package/components.json +5810 -0
- package/dist/appearance.d.ts +6 -0
- package/dist/appearance.js +217 -0
- package/dist/elements/accordion.d.ts +9 -0
- package/dist/elements/accordion.js +338 -0
- package/dist/elements/alert.d.ts +2 -0
- package/dist/elements/alert.js +62 -0
- package/dist/elements/avatar-group-primitives.d.ts +3 -0
- package/dist/elements/avatar-group-primitives.js +189 -0
- package/dist/elements/avatar-group.d.ts +2 -0
- package/dist/elements/avatar-group.js +110 -0
- package/dist/elements/avatar.d.ts +4 -0
- package/dist/elements/avatar.js +251 -0
- package/dist/elements/badge.d.ts +8 -0
- package/dist/elements/badge.js +182 -0
- package/dist/elements/breadcrumb.d.ts +4 -0
- package/dist/elements/breadcrumb.js +233 -0
- package/dist/elements/button-group.d.ts +1 -0
- package/dist/elements/button-group.js +20 -0
- package/dist/elements/button-variants.d.ts +6 -0
- package/dist/elements/button-variants.js +339 -0
- package/dist/elements/button.d.ts +5 -0
- package/dist/elements/button.js +233 -0
- package/dist/elements/card-primitives.d.ts +3 -0
- package/dist/elements/card-primitives.js +83 -0
- package/dist/elements/card.d.ts +5 -0
- package/dist/elements/card.js +213 -0
- package/dist/elements/carousel.d.ts +92 -0
- package/dist/elements/carousel.js +1112 -0
- package/dist/elements/color-picker.d.ts +24 -0
- package/dist/elements/color-picker.js +1004 -0
- package/dist/elements/combobox.d.ts +1 -0
- package/dist/elements/combobox.js +1012 -0
- package/dist/elements/data-grid-model.d.ts +117 -0
- package/dist/elements/data-grid-model.js +294 -0
- package/dist/elements/data-grid.d.ts +29 -0
- package/dist/elements/data-grid.js +1567 -0
- package/dist/elements/date-picker.d.ts +1 -0
- package/dist/elements/date-picker.js +486 -0
- package/dist/elements/dialog.d.ts +23 -0
- package/dist/elements/dialog.js +409 -0
- package/dist/elements/divider.d.ts +2 -0
- package/dist/elements/divider.js +66 -0
- package/dist/elements/drawer.d.ts +3 -0
- package/dist/elements/drawer.js +308 -0
- package/dist/elements/field-composition.d.ts +26 -0
- package/dist/elements/field-composition.js +133 -0
- package/dist/elements/field.d.ts +1 -0
- package/dist/elements/field.js +67 -0
- package/dist/elements/file-upload.d.ts +6 -0
- package/dist/elements/file-upload.js +211 -0
- package/dist/elements/floating-position.d.ts +26 -0
- package/dist/elements/floating-position.js +39 -0
- package/dist/elements/image.d.ts +28 -0
- package/dist/elements/image.js +38 -0
- package/dist/elements/info.d.ts +9 -0
- package/dist/elements/info.js +102 -0
- package/dist/elements/input.d.ts +5 -0
- package/dist/elements/input.js +255 -0
- package/dist/elements/label.d.ts +15 -0
- package/dist/elements/label.js +56 -0
- package/dist/elements/link.d.ts +1 -0
- package/dist/elements/link.js +92 -0
- package/dist/elements/list.d.ts +19 -0
- package/dist/elements/list.js +297 -0
- package/dist/elements/menu.d.ts +33 -0
- package/dist/elements/menu.js +1103 -0
- package/dist/elements/message-bar.d.ts +10 -0
- package/dist/elements/message-bar.js +299 -0
- package/dist/elements/nav.d.ts +32 -0
- package/dist/elements/nav.js +791 -0
- package/dist/elements/overflow.d.ts +9 -0
- package/dist/elements/overflow.js +218 -0
- package/dist/elements/persona.d.ts +3 -0
- package/dist/elements/persona.js +124 -0
- package/dist/elements/popover.d.ts +77 -0
- package/dist/elements/popover.js +840 -0
- package/dist/elements/progress-bar.d.ts +4 -0
- package/dist/elements/progress-bar.js +82 -0
- package/dist/elements/radio-group.d.ts +1 -0
- package/dist/elements/radio-group.js +303 -0
- package/dist/elements/rating-display.d.ts +2 -0
- package/dist/elements/rating-display.js +125 -0
- package/dist/elements/rating.d.ts +2 -0
- package/dist/elements/rating.js +206 -0
- package/dist/elements/rich-text-editor.d.ts +18 -0
- package/dist/elements/rich-text-editor.js +508 -0
- package/dist/elements/search.d.ts +3 -0
- package/dist/elements/search.js +207 -0
- package/dist/elements/select.d.ts +6 -0
- package/dist/elements/select.js +291 -0
- package/dist/elements/shared.d.ts +19 -0
- package/dist/elements/shared.js +396 -0
- package/dist/elements/skeleton.d.ts +6 -0
- package/dist/elements/skeleton.js +91 -0
- package/dist/elements/slider.d.ts +1 -0
- package/dist/elements/slider.js +248 -0
- package/dist/elements/spin-button.d.ts +7 -0
- package/dist/elements/spin-button.js +499 -0
- package/dist/elements/spinner.d.ts +4 -0
- package/dist/elements/spinner.js +124 -0
- package/dist/elements/swatch-picker.d.ts +5 -0
- package/dist/elements/swatch-picker.js +363 -0
- package/dist/elements/table.d.ts +21 -0
- package/dist/elements/table.js +261 -0
- package/dist/elements/tabs.d.ts +1 -0
- package/dist/elements/tabs.js +276 -0
- package/dist/elements/tag-picker.d.ts +29 -0
- package/dist/elements/tag-picker.js +697 -0
- package/dist/elements/tags.d.ts +21 -0
- package/dist/elements/tags.js +421 -0
- package/dist/elements/teaching-popover.d.ts +32 -0
- package/dist/elements/teaching-popover.js +412 -0
- package/dist/elements/text.d.ts +5 -0
- package/dist/elements/text.js +69 -0
- package/dist/elements/textarea.d.ts +1 -0
- package/dist/elements/textarea.js +182 -0
- package/dist/elements/toast.d.ts +25 -0
- package/dist/elements/toast.js +337 -0
- package/dist/elements/toaster.d.ts +6 -0
- package/dist/elements/toaster.js +356 -0
- package/dist/elements/toggle.d.ts +2 -0
- package/dist/elements/toggle.js +246 -0
- package/dist/elements/toolbar.d.ts +12 -0
- package/dist/elements/toolbar.js +381 -0
- package/dist/elements/tooltip.d.ts +76 -0
- package/dist/elements/tooltip.js +510 -0
- package/dist/elements/tree-model.d.ts +19 -0
- package/dist/elements/tree-model.js +34 -0
- package/dist/elements/tree.d.ts +5 -0
- package/dist/elements/tree.js +273 -0
- package/dist/elements/view-card.d.ts +2 -0
- package/dist/elements/view-card.js +78 -0
- package/dist/elements/virtual-list.d.ts +41 -0
- package/dist/elements/virtual-list.js +369 -0
- package/dist/elements.d.ts +72 -0
- package/dist/elements.js +207 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.js +66 -0
- package/dist/react-theme-styles.d.ts +2 -0
- package/dist/react-theme-styles.js +75 -0
- package/dist/react.d.ts +4540 -0
- package/dist/react.js +6799 -0
- package/dist/theme.d.ts +169 -0
- package/dist/theme.js +167 -0
- package/dist/virtualizer-hooks.d.ts +80 -0
- package/dist/virtualizer-hooks.js +253 -0
- package/package.json +87 -4
- package/scripts/generate-token-index.mjs +43 -0
- package/scripts/sync-component-catalog-signatures.mjs +55 -0
- package/scripts/validate-component-catalog.mjs +44 -0
- package/skills/sharepoint-ui/SKILL.md +12 -0
- package/skills/sharepoint-ui/references/choosing-components.md +20 -0
- package/skills/sharepoint-ui/references/sharepoint-patterns.md +17 -0
- package/tokens.json +3777 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { base, rememberNativeFormControlDefaults, stopHostAccessibleNameSync, syncHostAccessibleName } from "./shared.js";
|
|
2
|
+
export function defineSlider() {
|
|
3
|
+
if (customElements.get("spui-slider"))
|
|
4
|
+
return;
|
|
5
|
+
class SpuiSlider extends HTMLElement {
|
|
6
|
+
static formAssociated = true;
|
|
7
|
+
static observedAttributes = ["label", "value", "default-value", "min", "max", "step", "size", "vertical", "disabled", "name", "aria-label", "aria-labelledby", "aria-description", "aria-describedby", "aria-invalid", "aria-orientation", "aria-required", "aria-valuetext"];
|
|
8
|
+
internals;
|
|
9
|
+
currentValue;
|
|
10
|
+
currentDefaultValue;
|
|
11
|
+
formDisabled = false;
|
|
12
|
+
boundInput;
|
|
13
|
+
slotInputDefaults;
|
|
14
|
+
defaultAriaOrientation;
|
|
15
|
+
get form() { return this.internals?.form ?? null; }
|
|
16
|
+
constructor() {
|
|
17
|
+
super();
|
|
18
|
+
try {
|
|
19
|
+
this.internals = this.attachInternals();
|
|
20
|
+
}
|
|
21
|
+
catch { /* The native range input remains usable without ElementInternals. */ }
|
|
22
|
+
}
|
|
23
|
+
connectedCallback() { this.render(); }
|
|
24
|
+
disconnectedCallback() { stopHostAccessibleNameSync(this); }
|
|
25
|
+
attributeChangedCallback(name, _oldValue, value) {
|
|
26
|
+
if (!this.isConnected)
|
|
27
|
+
return;
|
|
28
|
+
const input = this.getInput();
|
|
29
|
+
if (!input)
|
|
30
|
+
return;
|
|
31
|
+
if (name === "label") {
|
|
32
|
+
const label = this.shadowRoot?.querySelector("label");
|
|
33
|
+
if (label)
|
|
34
|
+
label.textContent = value ?? "";
|
|
35
|
+
}
|
|
36
|
+
else if (name === "value") {
|
|
37
|
+
this.currentValue = value ?? "";
|
|
38
|
+
if (value !== null)
|
|
39
|
+
input.value = value;
|
|
40
|
+
this.syncVisual(input);
|
|
41
|
+
}
|
|
42
|
+
else if (name === "default-value") {
|
|
43
|
+
this.currentDefaultValue = value ?? "";
|
|
44
|
+
if (this.getAttribute("value") === null)
|
|
45
|
+
input.value = value ?? "0";
|
|
46
|
+
this.syncVisual(input);
|
|
47
|
+
}
|
|
48
|
+
else if (["min", "max", "step"].includes(name)) {
|
|
49
|
+
if (value === null)
|
|
50
|
+
input.removeAttribute(name);
|
|
51
|
+
else
|
|
52
|
+
input.setAttribute(name, value);
|
|
53
|
+
this.syncVisual(input);
|
|
54
|
+
}
|
|
55
|
+
else if (name === "size" || name === "vertical") {
|
|
56
|
+
if (value === null || value === "false")
|
|
57
|
+
this.removeAttribute(name);
|
|
58
|
+
if (name === "vertical") {
|
|
59
|
+
if (this.hasAttribute("vertical"))
|
|
60
|
+
input.setAttribute("orient", "vertical");
|
|
61
|
+
else
|
|
62
|
+
input.removeAttribute("orient");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else if (name === "disabled")
|
|
66
|
+
input.disabled = this.formDisabled || this.hasAttribute("disabled") || Boolean(this.slotInputDefaults?.disabled);
|
|
67
|
+
else if (name === "aria-label" || name === "aria-labelledby" || name === "aria-description" || name === "aria-describedby" || name === "aria-invalid" || name === "aria-orientation" || name === "aria-required" || name === "aria-valuetext") {
|
|
68
|
+
if (name === "aria-orientation")
|
|
69
|
+
this.defaultAriaOrientation = undefined;
|
|
70
|
+
value === null ? input.removeAttribute(name) : input.setAttribute(name, value);
|
|
71
|
+
}
|
|
72
|
+
this.syncFormValue(input);
|
|
73
|
+
this.syncSlots();
|
|
74
|
+
}
|
|
75
|
+
get value() { return this.getInput()?.valueAsNumber ?? Number(this.currentValue ?? this.getAttribute("value")); }
|
|
76
|
+
set value(value) {
|
|
77
|
+
this.currentValue = String(value);
|
|
78
|
+
const input = this.getInput();
|
|
79
|
+
if (input) {
|
|
80
|
+
input.value = this.currentValue;
|
|
81
|
+
this.syncFormValue(input);
|
|
82
|
+
this.syncVisual(input);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
get defaultValue() {
|
|
86
|
+
const value = this.currentDefaultValue ?? this.getAttribute("default-value");
|
|
87
|
+
if (value !== null && value !== undefined)
|
|
88
|
+
return Number(value);
|
|
89
|
+
const input = this.getInput();
|
|
90
|
+
const fallback = this.shadowRoot?.querySelector(".input-fallback");
|
|
91
|
+
return Number(input && input !== fallback ? this.slotInputDefaults?.defaultValue ?? input.defaultValue : 0);
|
|
92
|
+
}
|
|
93
|
+
set defaultValue(value) {
|
|
94
|
+
this.currentDefaultValue = String(value);
|
|
95
|
+
this.setAttribute("default-value", this.currentDefaultValue);
|
|
96
|
+
}
|
|
97
|
+
formDisabledCallback(disabled) { this.formDisabled = disabled; this.syncSlots(); }
|
|
98
|
+
formResetCallback() { const input = this.getInput(); if (input) {
|
|
99
|
+
input.value = this.getAttribute("value") ?? String(this.defaultValue);
|
|
100
|
+
this.currentValue = input.value;
|
|
101
|
+
this.syncFormValue(input);
|
|
102
|
+
this.syncVisual(input);
|
|
103
|
+
} }
|
|
104
|
+
formStateRestoreCallback(state) { if (typeof state === "string")
|
|
105
|
+
this.value = Number(state); }
|
|
106
|
+
syncFormValue(input) { this.internals?.setFormValue(input.value); }
|
|
107
|
+
getInput() {
|
|
108
|
+
const slot = this.shadowRoot?.querySelector('slot[name="input"]');
|
|
109
|
+
return slot?.assignedElements().find((element) => element instanceof HTMLInputElement)
|
|
110
|
+
?? this.shadowRoot?.querySelector(".input-fallback") ?? undefined;
|
|
111
|
+
}
|
|
112
|
+
syncVisual(input) {
|
|
113
|
+
const min = Number(input.min || 0);
|
|
114
|
+
const max = Number(input.max || 100);
|
|
115
|
+
const range = max - min;
|
|
116
|
+
const progress = range > 0 ? Math.max(0, Math.min(1, (input.valueAsNumber - min) / range)) : 0;
|
|
117
|
+
const track = this.shadowRoot?.querySelector(".track");
|
|
118
|
+
track?.style.setProperty("--spui-slider-progress", String(progress));
|
|
119
|
+
const thumbSlot = this.shadowRoot?.querySelector('slot[name="thumb"]');
|
|
120
|
+
const thumb = thumbSlot?.assignedElements()[0] ?? this.shadowRoot?.querySelector(".thumb");
|
|
121
|
+
const progressPercent = `${progress * 100}%`;
|
|
122
|
+
track?.style.setProperty("--spui-slider-progress-percent", progressPercent);
|
|
123
|
+
track?.style.setProperty("--spui-slider-fill-percent", progressPercent);
|
|
124
|
+
if (thumb) {
|
|
125
|
+
if (this.hasAttribute("vertical")) {
|
|
126
|
+
thumb.style.insetInlineStart = "50%";
|
|
127
|
+
thumb.style.insetBlockStart = `${(1 - progress) * 100}%`;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
thumb.style.insetInlineStart = `${progress * 100}%`;
|
|
131
|
+
thumb.style.insetBlockStart = "50%";
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
syncSlots() {
|
|
136
|
+
const input = this.getInput();
|
|
137
|
+
if (!input)
|
|
138
|
+
return;
|
|
139
|
+
const fallback = this.shadowRoot?.querySelector(".input-fallback");
|
|
140
|
+
if (input !== fallback)
|
|
141
|
+
this.slotInputDefaults = rememberNativeFormControlDefaults(this.slotInputDefaults, input);
|
|
142
|
+
if (this.boundInput !== input) {
|
|
143
|
+
this.boundInput?.removeEventListener("input", this.handleInput);
|
|
144
|
+
input.addEventListener("input", this.handleInput);
|
|
145
|
+
this.boundInput = input;
|
|
146
|
+
input.value = this.currentValue ?? this.getAttribute("value") ?? this.currentDefaultValue ?? this.getAttribute("default-value") ?? input.value ?? "0";
|
|
147
|
+
}
|
|
148
|
+
if (fallback) {
|
|
149
|
+
const assigned = input !== fallback;
|
|
150
|
+
fallback.hidden = assigned;
|
|
151
|
+
fallback.setAttribute("aria-hidden", String(assigned));
|
|
152
|
+
}
|
|
153
|
+
input.type = "range";
|
|
154
|
+
input.removeAttribute("name");
|
|
155
|
+
if (!input.id)
|
|
156
|
+
input.id = this.shadowRoot?.querySelector("label")?.htmlFor ?? `slider-${crypto.randomUUID()}`;
|
|
157
|
+
if (this.hasAttribute("vertical"))
|
|
158
|
+
input.setAttribute("orient", "vertical");
|
|
159
|
+
else
|
|
160
|
+
input.removeAttribute("orient");
|
|
161
|
+
if (!input.hasAttribute("aria-label") && !input.hasAttribute("aria-labelledby")) {
|
|
162
|
+
const label = this.getAttribute("label");
|
|
163
|
+
if (label)
|
|
164
|
+
input.setAttribute("aria-label", label);
|
|
165
|
+
}
|
|
166
|
+
for (const name of ["min", "max", "step", "aria-description", "aria-describedby", "aria-invalid", "aria-orientation", "aria-required", "aria-valuetext"])
|
|
167
|
+
if (!input.hasAttribute(name)) {
|
|
168
|
+
const value = this.getAttribute(name);
|
|
169
|
+
if (value !== null)
|
|
170
|
+
input.setAttribute(name, value);
|
|
171
|
+
}
|
|
172
|
+
const orientation = this.hasAttribute("vertical") ? "vertical" : "horizontal";
|
|
173
|
+
const previousDefault = this.defaultAriaOrientation;
|
|
174
|
+
const orientationWasDefaulted = previousDefault?.input === input && input.getAttribute("aria-orientation") === previousDefault.value;
|
|
175
|
+
if (orientationWasDefaulted || !input.hasAttribute("aria-orientation")) {
|
|
176
|
+
input.setAttribute("aria-orientation", orientation);
|
|
177
|
+
this.defaultAriaOrientation = { input, value: orientation };
|
|
178
|
+
}
|
|
179
|
+
else
|
|
180
|
+
this.defaultAriaOrientation = undefined;
|
|
181
|
+
syncHostAccessibleName(this, input);
|
|
182
|
+
input.disabled = this.formDisabled || this.hasAttribute("disabled") || Boolean(input === fallback ? false : this.slotInputDefaults?.disabled);
|
|
183
|
+
this.syncFormValue(input);
|
|
184
|
+
this.syncVisual(input);
|
|
185
|
+
}
|
|
186
|
+
handleInput = (event) => {
|
|
187
|
+
const input = event.currentTarget;
|
|
188
|
+
this.currentValue = input.value;
|
|
189
|
+
this.syncFormValue(input);
|
|
190
|
+
this.syncVisual(input);
|
|
191
|
+
this.dispatchEvent(new CustomEvent("spui-change", { detail: { value: input.valueAsNumber, sourceEvent: event }, bubbles: true, composed: true }));
|
|
192
|
+
};
|
|
193
|
+
render() {
|
|
194
|
+
const shadow = this.shadowRoot ?? this.attachShadow({ mode: "open" });
|
|
195
|
+
const id = `slider-${crypto.randomUUID()}`;
|
|
196
|
+
const label = document.createElement("label");
|
|
197
|
+
label.htmlFor = id;
|
|
198
|
+
label.textContent = this.getAttribute("label") ?? "";
|
|
199
|
+
label.part.add("label");
|
|
200
|
+
const input = document.createElement("input");
|
|
201
|
+
input.className = "input-fallback";
|
|
202
|
+
input.id = id;
|
|
203
|
+
input.type = "range";
|
|
204
|
+
if (this.hasAttribute("vertical"))
|
|
205
|
+
input.setAttribute("orient", "vertical");
|
|
206
|
+
input.value = this.currentValue ?? this.getAttribute("value") ?? this.currentDefaultValue ?? this.getAttribute("default-value") ?? "0";
|
|
207
|
+
for (const name of ["min", "max", "step", "aria-label", "aria-description", "aria-describedby", "aria-invalid", "aria-required", "aria-valuetext"]) {
|
|
208
|
+
const value = this.getAttribute(name);
|
|
209
|
+
if (value !== null)
|
|
210
|
+
input.setAttribute(name, value);
|
|
211
|
+
}
|
|
212
|
+
input.disabled = this.hasAttribute("disabled");
|
|
213
|
+
input.part.add("control");
|
|
214
|
+
const track = document.createElement("div");
|
|
215
|
+
track.className = "track";
|
|
216
|
+
track.part.add("track");
|
|
217
|
+
const rail = document.createElement("div");
|
|
218
|
+
rail.className = "rail";
|
|
219
|
+
rail.part.add("rail");
|
|
220
|
+
const railSlot = document.createElement("slot");
|
|
221
|
+
railSlot.name = "rail";
|
|
222
|
+
railSlot.append(rail);
|
|
223
|
+
railSlot.addEventListener("slotchange", () => this.syncSlots());
|
|
224
|
+
const fill = document.createElement("div");
|
|
225
|
+
fill.className = "rail-fill";
|
|
226
|
+
fill.setAttribute("aria-hidden", "true");
|
|
227
|
+
const thumb = document.createElement("span");
|
|
228
|
+
thumb.className = "thumb";
|
|
229
|
+
thumb.part.add("thumb");
|
|
230
|
+
const thumbSlot = document.createElement("slot");
|
|
231
|
+
thumbSlot.name = "thumb";
|
|
232
|
+
thumbSlot.append(thumb);
|
|
233
|
+
thumbSlot.addEventListener("slotchange", () => this.syncSlots());
|
|
234
|
+
const inputSlot = document.createElement("slot");
|
|
235
|
+
inputSlot.name = "input";
|
|
236
|
+
inputSlot.part.add("input");
|
|
237
|
+
inputSlot.append(input);
|
|
238
|
+
inputSlot.addEventListener("slotchange", () => this.syncSlots());
|
|
239
|
+
track.append(railSlot, fill, thumbSlot, inputSlot);
|
|
240
|
+
const style = document.createElement("style");
|
|
241
|
+
style.textContent = `${base}:host{display:grid;gap:var(--spui-control-gap,6px)}label{font-size:14px;font-weight:600;color:var(--spui-ui-muted,var(--spui-semantic-body-text,inherit))}input{width:100%;min-height:var(--spui-control-height,32px);margin:0;accent-color:var(--spui-ui-accent,var(--spui-semantic-primary-button-background,var(--colorBrandBackground,#0f6cbd)));cursor:pointer}input:focus-visible{outline:2px solid var(--spui-focus-ring,#005a9e);outline-offset:3px}input:disabled{opacity:.55;cursor:not-allowed}:host([size=small]) input{min-height:24px}:host([vertical]){display:inline-grid;justify-items:center;align-content:start}:host([vertical]) input{width:var(--spui-control-height,32px);height:160px;min-height:160px;writing-mode:vertical-lr;direction:rtl}:host([vertical]) label{grid-row:2}@media(forced-colors:active){input{accent-color:Highlight}input:focus-visible{outline-color:Highlight}}`;
|
|
242
|
+
style.textContent += `.track{position:relative;width:100%;min-width:0;height:var(--spui-control-height,32px);touch-action:pan-y}.rail{position:absolute;inset-inline:0;inset-block-start:50%;height:4px;transform:translateY(-50%);border-radius:999px;background:var(--spui-slider-rail,var(--spui-ui-stroke,var(--colorNeutralStroke1,#d1d1d1)))}.rail-fill{position:absolute;inset-inline-start:0;inset-block-start:50%;width:var(--spui-slider-fill-percent,0%);height:4px;transform:translateY(-50%);border-radius:999px;background:var(--spui-slider-fill,var(--spui-ui-accent,var(--colorBrandBackground,#0f6cbd)));pointer-events:none}.thumb{position:absolute;inset-inline-start:var(--spui-slider-progress-percent,0%);inset-block-start:50%;width:16px;height:16px;transform:translate(-50%,-50%);border:2px solid var(--spui-slider-thumb-border,var(--spui-ui-accent,var(--colorBrandBackground,#0f6cbd)));border-radius:50%;background:var(--spui-slider-thumb-background,var(--spui-ui-canvas,#fff));box-shadow:var(--shadow2,0 1px 2px rgb(0 0 0 / 20%));pointer-events:none}slot[name=rail]{position:absolute;inset:0;pointer-events:none}slot[name=rail]::slotted(*){position:absolute;inset-inline:0;inset-block-start:50%;height:4px;transform:translateY(-50%);border-radius:999px;background:var(--spui-slider-rail,var(--spui-ui-stroke,var(--colorNeutralStroke1,#d1d1d1)))}slot[name=thumb]{position:absolute;inset:0;pointer-events:none}slot[name=thumb]::slotted(*){position:absolute;inset-inline-start:var(--spui-slider-progress-percent,0%);inset-block-start:50%;width:16px;height:16px;transform:translate(-50%,-50%);border:2px solid var(--spui-slider-thumb-border,var(--spui-ui-accent,var(--colorBrandBackground,#0f6cbd)));border-radius:50%;background:var(--spui-slider-thumb-background,var(--spui-ui-canvas,#fff));box-shadow:var(--shadow2,0 1px 2px rgb(0 0 0 / 20%))}slot[name=input]{position:absolute;inset:0}input{position:absolute;inset:0;width:100%;height:100%;min-height:24px;opacity:0;appearance:none;cursor:pointer}input::-webkit-slider-thumb{appearance:none;width:24px;height:24px}input:focus-visible{outline:0}.track:focus-within{outline:2px solid var(--spui-focus-ring,#005a9e);outline-offset:2px;border-radius:4px}:host([size=small]) .track{height:24px}:host([vertical]) .track{display:block;width:var(--spui-control-height,32px);height:160px;min-height:160px;touch-action:pan-x}:host([vertical]) .rail,:host([vertical]) slot[name=rail]::slotted(*){inset-inline:50%;inset-block:0;width:4px;height:auto;transform:translateX(-50%)}:host([vertical]) .rail-fill{inset-inline-start:50%;inset-block-start:auto;inset-block-end:0;width:4px;height:var(--spui-slider-fill-percent,0%);transform:translateX(-50%)}:host([vertical]) .thumb,:host([vertical]) slot[name=thumb]::slotted(*){inset-inline-start:50%;inset-block-start:calc(100% - var(--spui-slider-progress-percent,0%));transform:translate(-50%,-50%)}:host([vertical]) label{grid-row:2}:host([dir=rtl]) .rail-fill{inset-inline-start:auto;inset-inline-end:0}:host([dir=rtl]) .thumb,:host([dir=rtl]) slot[name=thumb]::slotted(*){inset-inline-start:auto;inset-inline-end:var(--spui-slider-progress-percent,0%);transform:translate(50%,-50%)}@media(forced-colors:active){.rail{background:CanvasText}.rail-fill{background:Highlight}.thumb{border-color:Highlight;background:Canvas}}`;
|
|
243
|
+
shadow.replaceChildren(style, label, track);
|
|
244
|
+
this.syncSlots();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
customElements.define("spui-slider", SpuiSlider);
|
|
248
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type SpinButtonAppearance = "outline" | "underline" | "filled-darker" | "filled-lighter";
|
|
2
|
+
export type SpinButtonSize = "small" | "medium";
|
|
3
|
+
export type SpinButtonChangeData = {
|
|
4
|
+
value: number | null;
|
|
5
|
+
displayValue?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function defineSpinButton(): void;
|