@fluentui/web-components 3.0.0-beta.41 → 3.0.0-beta.43
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/CHANGELOG.md +22 -2
- package/dist/dts/button/button.d.ts +8 -0
- package/dist/dts/slider/slider.d.ts +180 -35
- package/dist/dts/slider/slider.options.d.ts +2 -2
- package/dist/dts/slider/slider.template.d.ts +2 -2
- package/dist/dts/styles/states/index.d.ts +5 -0
- package/dist/dts/utils/converters.d.ts +17 -0
- package/dist/dts/utils/index.d.ts +1 -0
- package/dist/esm/accordion/accordion.js.map +1 -1
- package/dist/esm/accordion-item/accordion-item.js.map +1 -1
- package/dist/esm/anchor-button/anchor-button.js.map +1 -1
- package/dist/esm/avatar/avatar.js +2 -1
- package/dist/esm/avatar/avatar.js.map +1 -1
- package/dist/esm/badge/badge.js.map +1 -1
- package/dist/esm/button/button.js +14 -2
- package/dist/esm/button/button.js.map +1 -1
- package/dist/esm/button/button.template.js +1 -1
- package/dist/esm/button/button.template.js.map +1 -1
- package/dist/esm/checkbox/checkbox.js +2 -1
- package/dist/esm/checkbox/checkbox.js.map +1 -1
- package/dist/esm/compound-button/compound-button.template.js +1 -1
- package/dist/esm/compound-button/compound-button.template.js.map +1 -1
- package/dist/esm/counter-badge/counter-badge.js.map +1 -1
- package/dist/esm/dialog/dialog.js.map +1 -1
- package/dist/esm/dialog-body/dialog-body.js.map +1 -1
- package/dist/esm/divider/divider.js.map +1 -1
- package/dist/esm/drawer/drawer.js.map +1 -1
- package/dist/esm/field/field.js.map +1 -1
- package/dist/esm/image/image.js.map +1 -1
- package/dist/esm/label/label.js.map +1 -1
- package/dist/esm/link/link.js.map +1 -1
- package/dist/esm/menu/menu.js.map +1 -1
- package/dist/esm/menu-item/menu-item.js.map +1 -1
- package/dist/esm/menu-item/menu-item.styles.js +7 -1
- package/dist/esm/menu-item/menu-item.styles.js.map +1 -1
- package/dist/esm/menu-list/menu-list.js +2 -1
- package/dist/esm/menu-list/menu-list.js.map +1 -1
- package/dist/esm/message-bar/message-bar.js.map +1 -1
- package/dist/esm/patterns/aria-globals.js.map +1 -1
- package/dist/esm/progress-bar/progress-bar.js.map +1 -1
- package/dist/esm/radio-group/radio-group.js +2 -1
- package/dist/esm/radio-group/radio-group.js.map +1 -1
- package/dist/esm/rating-display/rating-display.js.map +1 -1
- package/dist/esm/slider/slider.js +442 -220
- package/dist/esm/slider/slider.js.map +1 -1
- package/dist/esm/slider/slider.styles.js +107 -132
- package/dist/esm/slider/slider.styles.js.map +1 -1
- package/dist/esm/slider/slider.template.js +11 -28
- package/dist/esm/slider/slider.template.js.map +1 -1
- package/dist/esm/spinner/spinner.js.map +1 -1
- package/dist/esm/styles/states/index.js +5 -0
- package/dist/esm/styles/states/index.js.map +1 -1
- package/dist/esm/tab/tab.js.map +1 -1
- package/dist/esm/tabs/tabs.js.map +1 -1
- package/dist/esm/text-input/text-input.js +2 -1
- package/dist/esm/text-input/text-input.js.map +1 -1
- package/dist/esm/toggle-button/toggle-button.js.map +1 -1
- package/dist/esm/utils/converters.js +26 -0
- package/dist/esm/utils/converters.js.map +1 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/web-components.d.ts +189 -101
- package/dist/web-components.js +377 -505
- package/dist/web-components.min.js +186 -184
- package/package.json +1 -1
package/dist/web-components.js
CHANGED
|
@@ -3450,6 +3450,17 @@ __decorateClass$u([attr({
|
|
|
3450
3450
|
attribute: "aria-roledescription"
|
|
3451
3451
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaRoledescription", 2);
|
|
3452
3452
|
|
|
3453
|
+
const numberLikeStringConverter = {
|
|
3454
|
+
fromView(value) {
|
|
3455
|
+
const valueAsNumber = parseFloat(value);
|
|
3456
|
+
return Number.isNaN(valueAsNumber) ? "" : valueAsNumber.toString();
|
|
3457
|
+
},
|
|
3458
|
+
toView(value) {
|
|
3459
|
+
const valueAsNumber = parseFloat(value);
|
|
3460
|
+
return Number.isNaN(valueAsNumber) ? void 0 : valueAsNumber.toString();
|
|
3461
|
+
}
|
|
3462
|
+
};
|
|
3463
|
+
|
|
3453
3464
|
const getDirection = rootNode => {
|
|
3454
3465
|
return rootNode.closest("[dir]")?.dir === "rtl" ? Direction.rtl : Direction.ltr;
|
|
3455
3466
|
};
|
|
@@ -3743,6 +3754,7 @@ const squareState = css.partial`:is([state--square], :state(square))`;
|
|
|
3743
3754
|
const tinyState = css.partial`:is([state--tiny], :state(tiny))`;
|
|
3744
3755
|
const extraSmallState = css.partial`:is([state--extra-small], :state(extra-small))`;
|
|
3745
3756
|
const smallState = css.partial`:is([state--small], :state(small))`;
|
|
3757
|
+
css.partial`:is([state--medium], :state(medium))`;
|
|
3746
3758
|
const largeState = css.partial`:is([state--large], :state(large))`;
|
|
3747
3759
|
const extraLargeState = css.partial`:is([state--extra-large], :state(extra-large))`;
|
|
3748
3760
|
const hugeState = css.partial`:is([state--huge], :state(huge))`;
|
|
@@ -5143,6 +5155,7 @@ class Button extends FASTElement {
|
|
|
5143
5155
|
constructor() {
|
|
5144
5156
|
super();
|
|
5145
5157
|
this.disabledFocusable = false;
|
|
5158
|
+
this.tabIndex = 0;
|
|
5146
5159
|
/**
|
|
5147
5160
|
* The internal {@link https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
5148
5161
|
*
|
|
@@ -5399,6 +5412,11 @@ __decorateClass$o([attr({
|
|
|
5399
5412
|
attribute: "disabled-focusable",
|
|
5400
5413
|
mode: "boolean"
|
|
5401
5414
|
})], Button.prototype, "disabledFocusable", 2);
|
|
5415
|
+
__decorateClass$o([attr({
|
|
5416
|
+
attribute: "tabindex",
|
|
5417
|
+
mode: "fromView",
|
|
5418
|
+
converter: nullableNumberConverter
|
|
5419
|
+
})], Button.prototype, "tabIndex", 2);
|
|
5402
5420
|
__decorateClass$o([attr({
|
|
5403
5421
|
attribute: "formaction"
|
|
5404
5422
|
})], Button.prototype, "formAction", 2);
|
|
@@ -5430,7 +5448,7 @@ __decorateClass$o([attr], Button.prototype, "value", 2);
|
|
|
5430
5448
|
applyMixins(Button, StartEnd);
|
|
5431
5449
|
|
|
5432
5450
|
function buttonTemplate$1(options = {}) {
|
|
5433
|
-
return html`<template tabindex="${x => x.disabled ?
|
|
5451
|
+
return html`<template tabindex="${x => x.disabled ? null : x.tabIndex ?? 0}" @click="${(x, c) => x.clickHandler(c.event)}" @keypress="${(x, c) => x.keypressHandler(c.event)}">${startSlotTemplate(options)}<span class="content" part="content"><slot ${slotted("defaultSlottedContent")}></slot></span>${endSlotTemplate(options)}</template>`;
|
|
5434
5452
|
}
|
|
5435
5453
|
const template$u = buttonTemplate$1();
|
|
5436
5454
|
|
|
@@ -5927,7 +5945,7 @@ const styles$r = css`
|
|
|
5927
5945
|
::slotted([slot='description']){color:${colorNeutralForegroundDisabled}}:host(${smallState}){padding:8px;padding-bottom:10px}:host(${iconOnlyState}){min-width:52px;max-width:52px;padding:${spacingHorizontalSNudge}}:host(${iconOnlyState}${smallState}){min-width:48px;max-width:48px;padding:${spacingHorizontalXS}}:host(${iconOnlyState}${largeState}){min-width:56px;max-width:56px;padding:${spacingHorizontalS}}:host(${largeState}){padding-top:18px;padding-inline:16px;padding-bottom:20px;font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host(${largeState}) ::slotted([slot='description']){font-size:${fontSizeBase300}}`;
|
|
5928
5946
|
|
|
5929
5947
|
function buttonTemplate(options = {}) {
|
|
5930
|
-
return html`<template ?disabled="${x => x.disabled}" tabindex="${x => x.disabled ?
|
|
5948
|
+
return html`<template ?disabled="${x => x.disabled}" tabindex="${x => x.disabled ? null : x.tabIndex ?? 0}">${startSlotTemplate(options)}<span class="content" part="content"><slot ${slotted("defaultSlottedContent")}></slot><slot name="description"></slot></span>${endSlotTemplate(options)}</template>`;
|
|
5931
5949
|
}
|
|
5932
5950
|
const template$s = buttonTemplate();
|
|
5933
5951
|
|
|
@@ -7237,7 +7255,7 @@ const submenuState = css.partial`:is([state--submenu], :state(submenu))`;
|
|
|
7237
7255
|
const styles$g = css`
|
|
7238
7256
|
${display("grid")}
|
|
7239
7257
|
|
|
7240
|
-
:host{--indent:0;align-items:center;background:${colorNeutralBackground1};border-radius:${borderRadiusMedium};color:${colorNeutralForeground2};contain:layout;cursor:pointer;flex-shrink:0;font:${fontWeightRegular} ${fontSizeBase300} / ${lineHeightBase300} ${fontFamilyBase};grid-gap:4px;grid-template-columns:20px 20px auto 20px;height:32px;overflow:visible;padding:0 10px}:host(:hover){background:${colorNeutralBackground1Hover};color:${colorNeutralForeground2Hover}}:host(:active){background-color:${colorNeutralBackground1Selected};color:${colorNeutralForeground2Pressed}}:host(:active) ::slotted([slot='start']){color:${colorCompoundBrandForeground1Pressed}}:host(${disabledState}){background-color:${colorNeutralBackgroundDisabled};color:${colorNeutralForegroundDisabled}}:host(${disabledState}) ::slotted([slot='start']),:host(${disabledState}) ::slotted([slot='end']){color:${colorNeutralForegroundDisabled}}:host(:focus-visible){border-radius:${borderRadiusMedium};outline:2px solid ${colorStrokeFocus2}}.content{white-space:nowrap;flex-grow:1;grid-column:auto / span 2;padding:0 2px}:host(:not(${checkedState})) .indicator,:host(:not(${checkedState})) ::slotted([slot='indicator']),:host(:not(${submenuState})) .submenu-glyph,:host(:not(${submenuState})) ::slotted([slot='submenu-glyph']){display:none}::slotted([slot='end']){color:${colorNeutralForeground3};font:${fontWeightRegular} ${fontSizeBase200} / ${lineHeightBase200} ${fontFamilyBase};white-space:nowrap}:host([data-indent='1']){--indent:1}:host([data-indent='2']){--indent:2;grid-template-columns:20px 20px auto auto}:host(${submenuState}){grid-template-columns:20px auto auto 20px}:host([data-indent='2']${submenuState}){grid-template-columns:20px 20px auto auto 20px}.indicator,::slotted([slot='indicator']){grid-column:1 / span 1;width:20px}::slotted([slot='start']){display:inline-flex;grid-column:calc(var(--indent)) / span 1}.content{grid-column:calc(var(--indent) + 1) / span 1}::slotted([slot='end']){grid-column:calc(var(--indent) + 2) / span 1;justify-self:end}.submenu-glyph,::slotted([slot='submenu-glyph']){grid-column:-2 / span 1;justify-self:end}@layer popover{:host{anchor-name:--menu-trigger;position:relative}::slotted([popover]){
|
|
7258
|
+
:host{--indent:0;align-items:center;background:${colorNeutralBackground1};border-radius:${borderRadiusMedium};color:${colorNeutralForeground2};contain:layout;cursor:pointer;flex-shrink:0;font:${fontWeightRegular} ${fontSizeBase300} / ${lineHeightBase300} ${fontFamilyBase};grid-gap:4px;grid-template-columns:20px 20px auto 20px;height:32px;overflow:visible;padding:0 10px}:host(:hover){background:${colorNeutralBackground1Hover};color:${colorNeutralForeground2Hover}}:host(:active){background-color:${colorNeutralBackground1Selected};color:${colorNeutralForeground2Pressed}}:host(:active) ::slotted([slot='start']){color:${colorCompoundBrandForeground1Pressed}}:host(${disabledState}){background-color:${colorNeutralBackgroundDisabled};color:${colorNeutralForegroundDisabled}}:host(${disabledState}) ::slotted([slot='start']),:host(${disabledState}) ::slotted([slot='end']){color:${colorNeutralForegroundDisabled}}:host(:focus-visible){border-radius:${borderRadiusMedium};outline:2px solid ${colorStrokeFocus2}}.content{white-space:nowrap;flex-grow:1;grid-column:auto / span 2;padding:0 2px}:host(:not(${checkedState})) .indicator,:host(:not(${checkedState})) ::slotted([slot='indicator']),:host(:not(${submenuState})) .submenu-glyph,:host(:not(${submenuState})) ::slotted([slot='submenu-glyph']){display:none}::slotted([slot='end']){color:${colorNeutralForeground3};font:${fontWeightRegular} ${fontSizeBase200} / ${lineHeightBase200} ${fontFamilyBase};white-space:nowrap}:host([data-indent='1']){--indent:1}:host([data-indent='2']){--indent:2;grid-template-columns:20px 20px auto auto}:host(${submenuState}){grid-template-columns:20px auto auto 20px}:host([data-indent='2']${submenuState}){grid-template-columns:20px 20px auto auto 20px}.indicator,::slotted([slot='indicator']){grid-column:1 / span 1;width:20px}::slotted([slot='start']){display:inline-flex;grid-column:calc(var(--indent)) / span 1}.content{grid-column:calc(var(--indent) + 1) / span 1}::slotted([slot='end']){grid-column:calc(var(--indent) + 2) / span 1;justify-self:end}.submenu-glyph,::slotted([slot='submenu-glyph']){grid-column:-2 / span 1;justify-self:end}@layer popover{:host{anchor-name:--menu-trigger;position:relative}::slotted([popover]){inset-area:inline-end span-block-end;margin:0;max-height:var(--menu-max-height,auto);position:absolute;position-anchor:--menu-trigger;position-try-options:flip-inline,inset-area(block-start);z-index:1}::slotted([popover]:not(:popover-open)){display:none}::slotted([popover]:popover-open){inset:unset}@supports not (anchor-name:--menu-trigger){::slotted([popover]){align-self:start}}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
7241
7259
|
:host(${disabledState}),:host(${disabledState}) ::slotted([slot='start']),:host(${disabledState}) ::slotted([slot='end']){color:GrayText}`));
|
|
7242
7260
|
|
|
7243
7261
|
const Checkmark16Filled = html.partial(`<svg class="indicator" fill="currentColor" aria-hidden="true" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.05 3.49c.28.3.27.77-.04 1.06l-7.93 7.47A.85.85 0 014.9 12L2.22 9.28a.75.75 0 111.06-1.06l2.24 2.27 7.47-7.04a.75.75 0 011.06.04z" fill="currentColor"></path></svg>`);
|
|
@@ -8726,372 +8744,11 @@ const definition$9 = RatingDisplay.compose({
|
|
|
8726
8744
|
|
|
8727
8745
|
definition$9.define(FluentDesignSystem.registry);
|
|
8728
8746
|
|
|
8729
|
-
Orientation;
|
|
8747
|
+
const SliderOrientation = Orientation;
|
|
8730
8748
|
const SliderMode = {
|
|
8731
8749
|
singleValue: "single-value"
|
|
8732
8750
|
};
|
|
8733
8751
|
|
|
8734
|
-
const proxySlotName = "form-associated-proxy";
|
|
8735
|
-
const ElementInternalsKey = "ElementInternals";
|
|
8736
|
-
const supportsElementInternals = ElementInternalsKey in window && "setFormValue" in window[ElementInternalsKey].prototype;
|
|
8737
|
-
const InternalsMap = /* @__PURE__ */new WeakMap();
|
|
8738
|
-
function FormAssociated(BaseCtor) {
|
|
8739
|
-
const C = class extends BaseCtor {
|
|
8740
|
-
constructor(...args) {
|
|
8741
|
-
super(...args);
|
|
8742
|
-
/**
|
|
8743
|
-
* Track whether the value has been changed from the initial value
|
|
8744
|
-
*/
|
|
8745
|
-
this.dirtyValue = false;
|
|
8746
|
-
/**
|
|
8747
|
-
* The initial value of the form. This value sets the `value` property
|
|
8748
|
-
* only when the `value` property has not been explicitly set.
|
|
8749
|
-
*
|
|
8750
|
-
* @remarks
|
|
8751
|
-
* HTML Attribute: value
|
|
8752
|
-
*/
|
|
8753
|
-
this.initialValue = "";
|
|
8754
|
-
/**
|
|
8755
|
-
* Sets the element's disabled state. A disabled element will not be included during form submission.
|
|
8756
|
-
*
|
|
8757
|
-
* @remarks
|
|
8758
|
-
* HTML Attribute: disabled
|
|
8759
|
-
*/
|
|
8760
|
-
this.disabled = false;
|
|
8761
|
-
/**
|
|
8762
|
-
* These are events that are still fired by the proxy
|
|
8763
|
-
* element based on user / programmatic interaction.
|
|
8764
|
-
*
|
|
8765
|
-
* The proxy implementation should be transparent to
|
|
8766
|
-
* the app author, so block these events from emitting.
|
|
8767
|
-
*/
|
|
8768
|
-
this.proxyEventsToBlock = ["change", "click"];
|
|
8769
|
-
this.proxyInitialized = false;
|
|
8770
|
-
this.required = false;
|
|
8771
|
-
this.initialValue = this.initialValue || "";
|
|
8772
|
-
if (!this.elementInternals) {
|
|
8773
|
-
this.formResetCallback = this.formResetCallback.bind(this);
|
|
8774
|
-
}
|
|
8775
|
-
}
|
|
8776
|
-
/**
|
|
8777
|
-
* Must evaluate to true to enable elementInternals.
|
|
8778
|
-
* Feature detects API support and resolve respectively
|
|
8779
|
-
*
|
|
8780
|
-
* @internal
|
|
8781
|
-
*/
|
|
8782
|
-
static get formAssociated() {
|
|
8783
|
-
return supportsElementInternals;
|
|
8784
|
-
}
|
|
8785
|
-
/**
|
|
8786
|
-
* Returns the validity state of the element
|
|
8787
|
-
*
|
|
8788
|
-
* @beta
|
|
8789
|
-
*/
|
|
8790
|
-
get validity() {
|
|
8791
|
-
return this.elementInternals ? this.elementInternals.validity : this.proxy.validity;
|
|
8792
|
-
}
|
|
8793
|
-
/**
|
|
8794
|
-
* Retrieve a reference to the associated form.
|
|
8795
|
-
* Returns null if not associated to any form.
|
|
8796
|
-
*
|
|
8797
|
-
* @beta
|
|
8798
|
-
*/
|
|
8799
|
-
get form() {
|
|
8800
|
-
return this.elementInternals ? this.elementInternals.form : this.proxy.form;
|
|
8801
|
-
}
|
|
8802
|
-
/**
|
|
8803
|
-
* Retrieve the localized validation message,
|
|
8804
|
-
* or custom validation message if set.
|
|
8805
|
-
*
|
|
8806
|
-
* @beta
|
|
8807
|
-
*/
|
|
8808
|
-
get validationMessage() {
|
|
8809
|
-
return this.elementInternals ? this.elementInternals.validationMessage : this.proxy.validationMessage;
|
|
8810
|
-
}
|
|
8811
|
-
/**
|
|
8812
|
-
* Whether the element will be validated when the
|
|
8813
|
-
* form is submitted
|
|
8814
|
-
*/
|
|
8815
|
-
get willValidate() {
|
|
8816
|
-
return this.elementInternals ? this.elementInternals.willValidate : this.proxy.willValidate;
|
|
8817
|
-
}
|
|
8818
|
-
/**
|
|
8819
|
-
* A reference to all associated label elements
|
|
8820
|
-
*/
|
|
8821
|
-
get labels() {
|
|
8822
|
-
if (this.elementInternals) {
|
|
8823
|
-
return Object.freeze(Array.from(this.elementInternals.labels));
|
|
8824
|
-
} else if (this.proxy instanceof HTMLElement && this.proxy.ownerDocument && this.id) {
|
|
8825
|
-
const parentLabels = this.proxy.labels;
|
|
8826
|
-
const forLabels = Array.from(this.proxy.getRootNode().querySelectorAll(`[for='${this.id}']`));
|
|
8827
|
-
const labels = parentLabels ? forLabels.concat(Array.from(parentLabels)) : forLabels;
|
|
8828
|
-
return Object.freeze(labels);
|
|
8829
|
-
} else {
|
|
8830
|
-
return emptyArray;
|
|
8831
|
-
}
|
|
8832
|
-
}
|
|
8833
|
-
/**
|
|
8834
|
-
* Invoked when the `value` property changes
|
|
8835
|
-
* @param previous - the previous value
|
|
8836
|
-
* @param next - the new value
|
|
8837
|
-
*
|
|
8838
|
-
* @remarks
|
|
8839
|
-
* If elements extending `FormAssociated` implement a `valueChanged` method
|
|
8840
|
-
* They must be sure to invoke `super.valueChanged(previous, next)` to ensure
|
|
8841
|
-
* proper functioning of `FormAssociated`
|
|
8842
|
-
*/
|
|
8843
|
-
valueChanged(previous, next) {
|
|
8844
|
-
this.dirtyValue = true;
|
|
8845
|
-
if (this.proxy instanceof HTMLElement) {
|
|
8846
|
-
this.proxy.value = this.value;
|
|
8847
|
-
}
|
|
8848
|
-
this.currentValue = this.value;
|
|
8849
|
-
this.setFormValue(this.value);
|
|
8850
|
-
this.validate();
|
|
8851
|
-
}
|
|
8852
|
-
currentValueChanged() {
|
|
8853
|
-
this.value = this.currentValue;
|
|
8854
|
-
}
|
|
8855
|
-
/**
|
|
8856
|
-
* Invoked when the `initialValue` property changes
|
|
8857
|
-
*
|
|
8858
|
-
* @param previous - the previous value
|
|
8859
|
-
* @param next - the new value
|
|
8860
|
-
*
|
|
8861
|
-
* @remarks
|
|
8862
|
-
* If elements extending `FormAssociated` implement a `initialValueChanged` method
|
|
8863
|
-
* They must be sure to invoke `super.initialValueChanged(previous, next)` to ensure
|
|
8864
|
-
* proper functioning of `FormAssociated`
|
|
8865
|
-
*/
|
|
8866
|
-
initialValueChanged(previous, next) {
|
|
8867
|
-
if (!this.dirtyValue) {
|
|
8868
|
-
this.value = this.initialValue;
|
|
8869
|
-
this.dirtyValue = false;
|
|
8870
|
-
}
|
|
8871
|
-
}
|
|
8872
|
-
/**
|
|
8873
|
-
* Invoked when the `disabled` property changes
|
|
8874
|
-
*
|
|
8875
|
-
* @param previous - the previous value
|
|
8876
|
-
* @param next - the new value
|
|
8877
|
-
*
|
|
8878
|
-
* @remarks
|
|
8879
|
-
* If elements extending `FormAssociated` implement a `disabledChanged` method
|
|
8880
|
-
* They must be sure to invoke `super.disabledChanged(previous, next)` to ensure
|
|
8881
|
-
* proper functioning of `FormAssociated`
|
|
8882
|
-
*/
|
|
8883
|
-
disabledChanged(previous, next) {
|
|
8884
|
-
if (this.proxy instanceof HTMLElement) {
|
|
8885
|
-
this.proxy.disabled = this.disabled;
|
|
8886
|
-
}
|
|
8887
|
-
Updates.enqueue(() => this.classList.toggle("disabled", this.disabled));
|
|
8888
|
-
}
|
|
8889
|
-
/**
|
|
8890
|
-
* Invoked when the `name` property changes
|
|
8891
|
-
*
|
|
8892
|
-
* @param previous - the previous value
|
|
8893
|
-
* @param next - the new value
|
|
8894
|
-
*
|
|
8895
|
-
* @remarks
|
|
8896
|
-
* If elements extending `FormAssociated` implement a `nameChanged` method
|
|
8897
|
-
* They must be sure to invoke `super.nameChanged(previous, next)` to ensure
|
|
8898
|
-
* proper functioning of `FormAssociated`
|
|
8899
|
-
*/
|
|
8900
|
-
nameChanged(previous, next) {
|
|
8901
|
-
if (this.proxy instanceof HTMLElement) {
|
|
8902
|
-
this.proxy.name = this.name;
|
|
8903
|
-
}
|
|
8904
|
-
}
|
|
8905
|
-
/**
|
|
8906
|
-
* Invoked when the `required` property changes
|
|
8907
|
-
*
|
|
8908
|
-
* @param previous - the previous value
|
|
8909
|
-
* @param next - the new value
|
|
8910
|
-
*
|
|
8911
|
-
* @remarks
|
|
8912
|
-
* If elements extending `FormAssociated` implement a `requiredChanged` method
|
|
8913
|
-
* They must be sure to invoke `super.requiredChanged(previous, next)` to ensure
|
|
8914
|
-
* proper functioning of `FormAssociated`
|
|
8915
|
-
*/
|
|
8916
|
-
requiredChanged(prev, next) {
|
|
8917
|
-
if (this.proxy instanceof HTMLElement) {
|
|
8918
|
-
this.proxy.required = this.required;
|
|
8919
|
-
}
|
|
8920
|
-
Updates.enqueue(() => this.classList.toggle("required", this.required));
|
|
8921
|
-
this.validate();
|
|
8922
|
-
}
|
|
8923
|
-
/**
|
|
8924
|
-
* The element internals object. Will only exist
|
|
8925
|
-
* in browsers supporting the attachInternals API
|
|
8926
|
-
*/
|
|
8927
|
-
get elementInternals() {
|
|
8928
|
-
if (!supportsElementInternals) {
|
|
8929
|
-
return null;
|
|
8930
|
-
}
|
|
8931
|
-
let internals = InternalsMap.get(this);
|
|
8932
|
-
if (!internals) {
|
|
8933
|
-
internals = this.attachInternals();
|
|
8934
|
-
InternalsMap.set(this, internals);
|
|
8935
|
-
}
|
|
8936
|
-
return internals;
|
|
8937
|
-
}
|
|
8938
|
-
/**
|
|
8939
|
-
* @internal
|
|
8940
|
-
*/
|
|
8941
|
-
connectedCallback() {
|
|
8942
|
-
super.connectedCallback();
|
|
8943
|
-
this.addEventListener("keypress", this._keypressHandler);
|
|
8944
|
-
if (!this.value) {
|
|
8945
|
-
this.value = this.initialValue;
|
|
8946
|
-
this.dirtyValue = false;
|
|
8947
|
-
}
|
|
8948
|
-
if (!this.elementInternals) {
|
|
8949
|
-
this.attachProxy();
|
|
8950
|
-
if (this.form) {
|
|
8951
|
-
this.form.addEventListener("reset", this.formResetCallback);
|
|
8952
|
-
}
|
|
8953
|
-
}
|
|
8954
|
-
}
|
|
8955
|
-
/**
|
|
8956
|
-
* @internal
|
|
8957
|
-
*/
|
|
8958
|
-
disconnectedCallback() {
|
|
8959
|
-
this.proxyEventsToBlock.forEach(name => this.proxy.removeEventListener(name, this.stopPropagation));
|
|
8960
|
-
if (!this.elementInternals && this.form) {
|
|
8961
|
-
this.form.removeEventListener("reset", this.formResetCallback);
|
|
8962
|
-
}
|
|
8963
|
-
}
|
|
8964
|
-
/**
|
|
8965
|
-
* Return the current validity of the element.
|
|
8966
|
-
*/
|
|
8967
|
-
checkValidity() {
|
|
8968
|
-
return this.elementInternals ? this.elementInternals.checkValidity() : this.proxy.checkValidity();
|
|
8969
|
-
}
|
|
8970
|
-
/**
|
|
8971
|
-
* Return the current validity of the element.
|
|
8972
|
-
* If false, fires an invalid event at the element.
|
|
8973
|
-
*/
|
|
8974
|
-
reportValidity() {
|
|
8975
|
-
return this.elementInternals ? this.elementInternals.reportValidity() : this.proxy.reportValidity();
|
|
8976
|
-
}
|
|
8977
|
-
/**
|
|
8978
|
-
* Set the validity of the control. In cases when the elementInternals object is not
|
|
8979
|
-
* available (and the proxy element is used to report validity), this function will
|
|
8980
|
-
* do nothing unless a message is provided, at which point the setCustomValidity method
|
|
8981
|
-
* of the proxy element will be invoked with the provided message.
|
|
8982
|
-
* @param flags - Validity flags
|
|
8983
|
-
* @param message - Optional message to supply
|
|
8984
|
-
* @param anchor - Optional element used by UA to display an interactive validation UI
|
|
8985
|
-
*/
|
|
8986
|
-
setValidity(flags, message, anchor) {
|
|
8987
|
-
if (this.elementInternals) {
|
|
8988
|
-
this.elementInternals.setValidity(flags, message, anchor);
|
|
8989
|
-
} else if (typeof message === "string") {
|
|
8990
|
-
this.proxy.setCustomValidity(message);
|
|
8991
|
-
}
|
|
8992
|
-
}
|
|
8993
|
-
/**
|
|
8994
|
-
* Invoked when a connected component's form or fieldset has its disabled
|
|
8995
|
-
* state changed.
|
|
8996
|
-
* @param disabled - the disabled value of the form / fieldset
|
|
8997
|
-
*/
|
|
8998
|
-
formDisabledCallback(disabled) {
|
|
8999
|
-
this.disabled = disabled;
|
|
9000
|
-
}
|
|
9001
|
-
formResetCallback() {
|
|
9002
|
-
this.value = this.initialValue;
|
|
9003
|
-
this.dirtyValue = false;
|
|
9004
|
-
}
|
|
9005
|
-
/**
|
|
9006
|
-
* Attach the proxy element to the DOM
|
|
9007
|
-
*/
|
|
9008
|
-
attachProxy() {
|
|
9009
|
-
if (!this.proxyInitialized) {
|
|
9010
|
-
this.proxyInitialized = true;
|
|
9011
|
-
this.proxy.style.display = "none";
|
|
9012
|
-
this.proxyEventsToBlock.forEach(name => this.proxy.addEventListener(name, this.stopPropagation));
|
|
9013
|
-
this.proxy.disabled = this.disabled;
|
|
9014
|
-
this.proxy.required = this.required;
|
|
9015
|
-
if (typeof this.name === "string") {
|
|
9016
|
-
this.proxy.name = this.name;
|
|
9017
|
-
}
|
|
9018
|
-
if (typeof this.value === "string") {
|
|
9019
|
-
this.proxy.value = this.value;
|
|
9020
|
-
}
|
|
9021
|
-
this.proxy.setAttribute("slot", proxySlotName);
|
|
9022
|
-
this.proxySlot = document.createElement("slot");
|
|
9023
|
-
this.proxySlot.setAttribute("name", proxySlotName);
|
|
9024
|
-
}
|
|
9025
|
-
this.shadowRoot?.appendChild(this.proxySlot);
|
|
9026
|
-
this.appendChild(this.proxy);
|
|
9027
|
-
}
|
|
9028
|
-
/**
|
|
9029
|
-
* Detach the proxy element from the DOM
|
|
9030
|
-
*/
|
|
9031
|
-
detachProxy() {
|
|
9032
|
-
this.removeChild(this.proxy);
|
|
9033
|
-
this.shadowRoot?.removeChild(this.proxySlot);
|
|
9034
|
-
}
|
|
9035
|
-
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
9036
|
-
validate(anchor) {
|
|
9037
|
-
if (this.proxy instanceof HTMLElement) {
|
|
9038
|
-
this.setValidity(this.proxy.validity, this.proxy.validationMessage, anchor);
|
|
9039
|
-
}
|
|
9040
|
-
}
|
|
9041
|
-
/**
|
|
9042
|
-
* Associates the provided value (and optional state) with the parent form.
|
|
9043
|
-
* @param value - The value to set
|
|
9044
|
-
* @param state - The state object provided to during session restores and when autofilling.
|
|
9045
|
-
*/
|
|
9046
|
-
setFormValue(value, state) {
|
|
9047
|
-
if (this.elementInternals) {
|
|
9048
|
-
this.elementInternals.setFormValue(value, state || value);
|
|
9049
|
-
}
|
|
9050
|
-
}
|
|
9051
|
-
_keypressHandler(e) {
|
|
9052
|
-
switch (e.key) {
|
|
9053
|
-
case keyEnter:
|
|
9054
|
-
if (this.form instanceof HTMLFormElement) {
|
|
9055
|
-
const defaultButton = this.form.querySelector("[type=submit]");
|
|
9056
|
-
defaultButton?.click();
|
|
9057
|
-
}
|
|
9058
|
-
break;
|
|
9059
|
-
}
|
|
9060
|
-
}
|
|
9061
|
-
/**
|
|
9062
|
-
* Used to stop propagation of proxy element events
|
|
9063
|
-
* @param e - Event object
|
|
9064
|
-
*/
|
|
9065
|
-
stopPropagation(e) {
|
|
9066
|
-
e.stopPropagation();
|
|
9067
|
-
}
|
|
9068
|
-
};
|
|
9069
|
-
attr({
|
|
9070
|
-
mode: "boolean"
|
|
9071
|
-
})(C.prototype, "disabled");
|
|
9072
|
-
attr({
|
|
9073
|
-
mode: "fromView",
|
|
9074
|
-
attribute: "value"
|
|
9075
|
-
})(C.prototype, "initialValue");
|
|
9076
|
-
attr({
|
|
9077
|
-
attribute: "current-value"
|
|
9078
|
-
})(C.prototype, "currentValue");
|
|
9079
|
-
attr(C.prototype, "name");
|
|
9080
|
-
attr({
|
|
9081
|
-
mode: "boolean"
|
|
9082
|
-
})(C.prototype, "required");
|
|
9083
|
-
observable(C.prototype, "value");
|
|
9084
|
-
return C;
|
|
9085
|
-
}
|
|
9086
|
-
|
|
9087
|
-
class _Slider extends FASTElement {}
|
|
9088
|
-
class FormAssociatedSlider extends FormAssociated(_Slider) {
|
|
9089
|
-
constructor() {
|
|
9090
|
-
super(...arguments);
|
|
9091
|
-
this.proxy = document.createElement("input");
|
|
9092
|
-
}
|
|
9093
|
-
}
|
|
9094
|
-
|
|
9095
8752
|
function convertPixelToPercent(pixelPos, minPosition, maxPosition, direction) {
|
|
9096
8753
|
let pct = limit(0, 1, (pixelPos - minPosition) / (maxPosition - minPosition));
|
|
9097
8754
|
if (direction === Direction.rtl) {
|
|
@@ -9108,9 +8765,15 @@ var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
|
9108
8765
|
if (kind && result) __defProp$6(target, key, result);
|
|
9109
8766
|
return result;
|
|
9110
8767
|
};
|
|
9111
|
-
class Slider extends
|
|
8768
|
+
class Slider extends FASTElement {
|
|
9112
8769
|
constructor() {
|
|
9113
|
-
super(
|
|
8770
|
+
super();
|
|
8771
|
+
/**
|
|
8772
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
8773
|
+
*
|
|
8774
|
+
* @internal
|
|
8775
|
+
*/
|
|
8776
|
+
this.elementInternals = this.attachInternals();
|
|
9114
8777
|
this.direction = Direction.ltr;
|
|
9115
8778
|
this.isDragging = false;
|
|
9116
8779
|
this.trackWidth = 0;
|
|
@@ -9118,34 +8781,39 @@ class Slider extends FormAssociatedSlider {
|
|
|
9118
8781
|
this.trackHeight = 0;
|
|
9119
8782
|
this.trackLeft = 0;
|
|
9120
8783
|
this.trackMinHeight = 0;
|
|
9121
|
-
this.valueTextFormatter = () =>
|
|
9122
|
-
this.
|
|
9123
|
-
this.
|
|
9124
|
-
this.
|
|
8784
|
+
this.valueTextFormatter = () => "";
|
|
8785
|
+
this.disabled = false;
|
|
8786
|
+
this.min = "";
|
|
8787
|
+
this.max = "";
|
|
8788
|
+
this.step = "";
|
|
9125
8789
|
this.mode = SliderMode.singleValue;
|
|
9126
|
-
this.keypressHandler =
|
|
9127
|
-
if (this.
|
|
8790
|
+
this.keypressHandler = event => {
|
|
8791
|
+
if (this.disabled) {
|
|
9128
8792
|
return;
|
|
9129
8793
|
}
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
8794
|
+
switch (event.key) {
|
|
8795
|
+
case keyHome:
|
|
8796
|
+
event.preventDefault();
|
|
8797
|
+
this.value = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical ? `${this.minAsNumber}` : `${this.maxAsNumber}`;
|
|
8798
|
+
break;
|
|
8799
|
+
case keyEnd:
|
|
8800
|
+
event.preventDefault();
|
|
8801
|
+
this.value = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical ? `${this.maxAsNumber}` : `${this.minAsNumber}`;
|
|
8802
|
+
break;
|
|
8803
|
+
case keyArrowRight:
|
|
8804
|
+
case keyArrowUp:
|
|
8805
|
+
if (!event.shiftKey) {
|
|
8806
|
+
event.preventDefault();
|
|
9141
8807
|
this.increment();
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
8808
|
+
}
|
|
8809
|
+
break;
|
|
8810
|
+
case keyArrowLeft:
|
|
8811
|
+
case keyArrowDown:
|
|
8812
|
+
if (!event.shiftKey) {
|
|
8813
|
+
event.preventDefault();
|
|
9146
8814
|
this.decrement();
|
|
9147
|
-
|
|
9148
|
-
|
|
8815
|
+
}
|
|
8816
|
+
break;
|
|
9149
8817
|
}
|
|
9150
8818
|
};
|
|
9151
8819
|
this.setupTrackConstraints = () => {
|
|
@@ -9159,80 +8827,92 @@ class Slider extends FormAssociatedSlider {
|
|
|
9159
8827
|
this.trackWidth = 1;
|
|
9160
8828
|
}
|
|
9161
8829
|
};
|
|
9162
|
-
//Remove
|
|
9163
8830
|
this.setupListeners = (remove = false) => {
|
|
9164
8831
|
this.addEventListener("keydown", this.keypressHandler);
|
|
9165
|
-
this.addEventListener("mousedown", this.handleMouseDown);
|
|
9166
8832
|
if (remove) {
|
|
9167
8833
|
this.removeEventListener("keydown", this.keypressHandler);
|
|
9168
|
-
this.removeEventListener("mousedown", this.handleMouseDown);
|
|
9169
8834
|
}
|
|
9170
8835
|
};
|
|
9171
|
-
/**
|
|
9172
|
-
* @internal
|
|
9173
|
-
*/
|
|
9174
|
-
this.initialValue = "";
|
|
9175
8836
|
/**
|
|
9176
8837
|
* Handle mouse moves during a thumb drag operation
|
|
9177
8838
|
* If the event handler is null it removes the events
|
|
9178
8839
|
*/
|
|
9179
|
-
this.
|
|
8840
|
+
this.handleThumbPointerDown = event => {
|
|
9180
8841
|
const windowFn = event !== null ? window.addEventListener : window.removeEventListener;
|
|
9181
|
-
windowFn("
|
|
9182
|
-
windowFn("
|
|
8842
|
+
windowFn("pointerup", this.handleWindowPointerUp);
|
|
8843
|
+
windowFn("pointermove", this.handlePointerMove, {
|
|
9183
8844
|
passive: true
|
|
9184
8845
|
});
|
|
9185
|
-
windowFn("touchmove", this.
|
|
8846
|
+
windowFn("touchmove", this.handlePointerMove, {
|
|
9186
8847
|
passive: true
|
|
9187
8848
|
});
|
|
9188
|
-
windowFn("touchend", this.
|
|
8849
|
+
windowFn("touchend", this.handleWindowPointerUp);
|
|
9189
8850
|
this.isDragging = event !== null;
|
|
9190
8851
|
};
|
|
9191
8852
|
/**
|
|
9192
8853
|
* Handle mouse moves during a thumb drag operation
|
|
9193
8854
|
*/
|
|
9194
|
-
this.
|
|
9195
|
-
if (this.
|
|
8855
|
+
this.handlePointerMove = event => {
|
|
8856
|
+
if (this.disabled || event.defaultPrevented) {
|
|
9196
8857
|
return;
|
|
9197
8858
|
}
|
|
9198
|
-
const sourceEvent = window.TouchEvent &&
|
|
9199
|
-
const eventValue = this.orientation === Orientation.
|
|
8859
|
+
const sourceEvent = window.TouchEvent && event instanceof TouchEvent ? event.touches[0] : event;
|
|
8860
|
+
const eventValue = this.orientation === Orientation.vertical ? sourceEvent.pageY - document.documentElement.scrollTop : sourceEvent.pageX - document.documentElement.scrollLeft - this.trackLeft;
|
|
9200
8861
|
this.value = `${this.calculateNewValue(eventValue)}`;
|
|
9201
8862
|
};
|
|
9202
8863
|
/**
|
|
9203
8864
|
* Handle a window mouse up during a drag operation
|
|
9204
8865
|
*/
|
|
9205
|
-
this.
|
|
8866
|
+
this.handleWindowPointerUp = () => {
|
|
9206
8867
|
this.stopDragging();
|
|
9207
8868
|
};
|
|
9208
8869
|
this.stopDragging = () => {
|
|
9209
8870
|
this.isDragging = false;
|
|
9210
|
-
this.
|
|
9211
|
-
this.
|
|
8871
|
+
this.handlePointerDown(null);
|
|
8872
|
+
this.handleThumbPointerDown(null);
|
|
9212
8873
|
};
|
|
9213
8874
|
/**
|
|
9214
8875
|
*
|
|
9215
|
-
* @param
|
|
8876
|
+
* @param event - PointerEvent or null. If there is no event handler it will remove the events
|
|
9216
8877
|
*/
|
|
9217
|
-
this.
|
|
9218
|
-
if (
|
|
9219
|
-
const windowFn =
|
|
9220
|
-
const documentFn =
|
|
9221
|
-
windowFn("
|
|
9222
|
-
documentFn("mouseleave", this.
|
|
9223
|
-
windowFn("
|
|
9224
|
-
if (
|
|
8878
|
+
this.handlePointerDown = event => {
|
|
8879
|
+
if (event === null || !this.disabled) {
|
|
8880
|
+
const windowFn = event !== null ? window.addEventListener : window.removeEventListener;
|
|
8881
|
+
const documentFn = event !== null ? document.addEventListener : document.removeEventListener;
|
|
8882
|
+
windowFn("pointerup", this.handleWindowPointerUp);
|
|
8883
|
+
documentFn("mouseleave", this.handleWindowPointerUp);
|
|
8884
|
+
windowFn("pointermove", this.handlePointerMove);
|
|
8885
|
+
if (event) {
|
|
9225
8886
|
this.setupTrackConstraints();
|
|
9226
|
-
const controlValue = this.orientation === Orientation.
|
|
8887
|
+
const controlValue = this.orientation === Orientation.vertical ? event.pageY - document.documentElement.scrollTop : event.pageX - document.documentElement.scrollLeft - this.trackLeft;
|
|
9227
8888
|
this.value = `${this.calculateNewValue(controlValue)}`;
|
|
9228
8889
|
}
|
|
9229
8890
|
}
|
|
9230
8891
|
};
|
|
8892
|
+
this.elementInternals.role = "slider";
|
|
8893
|
+
this.elementInternals.ariaOrientation = this.orientation ?? SliderOrientation.horizontal;
|
|
9231
8894
|
}
|
|
9232
|
-
|
|
8895
|
+
/**
|
|
8896
|
+
* A reference to all associated `<label>` elements.
|
|
8897
|
+
*
|
|
8898
|
+
* @public
|
|
8899
|
+
*/
|
|
8900
|
+
get labels() {
|
|
8901
|
+
return Object.freeze(Array.from(this.elementInternals.labels));
|
|
8902
|
+
}
|
|
8903
|
+
sizeChanged(prev, next) {
|
|
8904
|
+
if (prev) {
|
|
8905
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
8906
|
+
}
|
|
8907
|
+
if (next) {
|
|
8908
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
8909
|
+
}
|
|
8910
|
+
}
|
|
8911
|
+
handleChange(_, propertyName) {
|
|
9233
8912
|
switch (propertyName) {
|
|
9234
8913
|
case "min":
|
|
9235
8914
|
case "max":
|
|
8915
|
+
this.setSliderPosition(this.direction);
|
|
9236
8916
|
case "step":
|
|
9237
8917
|
this.handleStepStyles();
|
|
9238
8918
|
break;
|
|
@@ -9244,74 +8924,257 @@ class Slider extends FormAssociatedSlider {
|
|
|
9244
8924
|
*/
|
|
9245
8925
|
handleStepStyles() {
|
|
9246
8926
|
if (this.step) {
|
|
9247
|
-
const totalSteps = 100 / Math.floor((this.
|
|
8927
|
+
const totalSteps = 100 / Math.floor((this.maxAsNumber - this.minAsNumber) / this.stepAsNumber);
|
|
9248
8928
|
if (this.stepStyles !== void 0) {
|
|
9249
8929
|
this.$fastController.removeStyles(this.stepStyles);
|
|
9250
8930
|
}
|
|
9251
8931
|
this.stepStyles = css`
|
|
9252
|
-
:host{--step-rate:${totalSteps}
|
|
8932
|
+
:host{--step-rate:${totalSteps}%}`;
|
|
9253
8933
|
this.$fastController.addStyles(this.stepStyles);
|
|
9254
8934
|
} else if (this.stepStyles !== void 0) {
|
|
9255
8935
|
this.$fastController.removeStyles(this.stepStyles);
|
|
9256
8936
|
}
|
|
9257
8937
|
}
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
8938
|
+
/**
|
|
8939
|
+
* Sets the value of the input when the value attribute changes.
|
|
8940
|
+
*
|
|
8941
|
+
* @param prev - The previous value
|
|
8942
|
+
* @param next - The current value
|
|
8943
|
+
* @internal
|
|
8944
|
+
*/
|
|
8945
|
+
initialValueChanged(_, next) {
|
|
8946
|
+
if (this.$fastController.isConnected) {
|
|
8947
|
+
this.value = next;
|
|
8948
|
+
} else {
|
|
8949
|
+
this._value = next;
|
|
9262
8950
|
}
|
|
9263
8951
|
}
|
|
9264
8952
|
/**
|
|
9265
|
-
* The
|
|
8953
|
+
* The element's validity state.
|
|
9266
8954
|
*
|
|
9267
8955
|
* @public
|
|
8956
|
+
* @remarks
|
|
8957
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/validity | `ElementInternals.validity`} property.
|
|
9268
8958
|
*/
|
|
9269
|
-
get
|
|
9270
|
-
return
|
|
8959
|
+
get validity() {
|
|
8960
|
+
return this.elementInternals.validity;
|
|
9271
8961
|
}
|
|
9272
|
-
|
|
9273
|
-
|
|
8962
|
+
/**
|
|
8963
|
+
* The element's validation message.
|
|
8964
|
+
*
|
|
8965
|
+
* @public
|
|
8966
|
+
* @remarks
|
|
8967
|
+
* Reflects the {@link https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/validationMessage | `ElemenentInternals.validationMessage`} property.
|
|
8968
|
+
*/
|
|
8969
|
+
get validationMessage() {
|
|
8970
|
+
return this.elementInternals.validationMessage;
|
|
9274
8971
|
}
|
|
9275
8972
|
/**
|
|
8973
|
+
* Whether the element is a candidate for its owning form's constraint validation.
|
|
8974
|
+
*
|
|
8975
|
+
* @public
|
|
8976
|
+
* @remarks
|
|
8977
|
+
* Reflects the {@link https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/willValidate | `ElemenentInternals.willValidate`} property.
|
|
8978
|
+
*/
|
|
8979
|
+
get willValidate() {
|
|
8980
|
+
return this.elementInternals.willValidate;
|
|
8981
|
+
}
|
|
8982
|
+
/**
|
|
8983
|
+
* Checks the element's validity.
|
|
8984
|
+
* @public
|
|
8985
|
+
* @remarks
|
|
8986
|
+
* Reflects the {@link https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/checkValidity | `ElemenentInternals.checkValidity`} method.
|
|
8987
|
+
*/
|
|
8988
|
+
checkValidity() {
|
|
8989
|
+
return this.elementInternals.checkValidity();
|
|
8990
|
+
}
|
|
8991
|
+
/**
|
|
8992
|
+
* Reports the element's validity.
|
|
8993
|
+
* @public
|
|
8994
|
+
* @remarks
|
|
8995
|
+
* Reflects the {@link https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/reportValidity | `ElemenentInternals.reportValidity`} method.
|
|
8996
|
+
*/
|
|
8997
|
+
reportValidity() {
|
|
8998
|
+
return this.elementInternals.reportValidity();
|
|
8999
|
+
}
|
|
9000
|
+
/**
|
|
9001
|
+
* Sets a custom validity message.
|
|
9002
|
+
* @public
|
|
9003
|
+
*/
|
|
9004
|
+
setCustomValidity(message) {
|
|
9005
|
+
this.setValidity({
|
|
9006
|
+
customError: !!message
|
|
9007
|
+
}, message);
|
|
9008
|
+
}
|
|
9009
|
+
/**
|
|
9010
|
+
* Sets the validity of the control.
|
|
9011
|
+
*
|
|
9012
|
+
* @param flags - Validity flags to set.
|
|
9013
|
+
* @param message - Optional message to supply. If not provided, the control's `validationMessage` will be used.
|
|
9014
|
+
* @param anchor - Optional anchor to use for the validation message.
|
|
9015
|
+
*
|
|
9276
9016
|
* @internal
|
|
9277
9017
|
*/
|
|
9278
|
-
|
|
9018
|
+
setValidity(flags, message, anchor) {
|
|
9279
9019
|
if (this.$fastController.isConnected) {
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
if (value !== next) {
|
|
9283
|
-
this.value = value;
|
|
9020
|
+
if (this.disabled) {
|
|
9021
|
+
this.elementInternals.setValidity({});
|
|
9284
9022
|
return;
|
|
9285
9023
|
}
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
|
|
9024
|
+
this.elementInternals.setValidity({
|
|
9025
|
+
customError: !!message,
|
|
9026
|
+
...flags
|
|
9027
|
+
}, message ?? this.validationMessage, anchor);
|
|
9028
|
+
}
|
|
9029
|
+
}
|
|
9030
|
+
/**
|
|
9031
|
+
* The current value of the input.
|
|
9032
|
+
*
|
|
9033
|
+
* @public
|
|
9034
|
+
*/
|
|
9035
|
+
get value() {
|
|
9036
|
+
Observable.track(this, "value");
|
|
9037
|
+
return this._value.toString();
|
|
9038
|
+
}
|
|
9039
|
+
set value(value) {
|
|
9040
|
+
if (!this.$fastController.isConnected) {
|
|
9041
|
+
this._value = value.toString();
|
|
9042
|
+
return;
|
|
9289
9043
|
}
|
|
9044
|
+
const nextAsNumber = parseFloat(value);
|
|
9045
|
+
const newValue = limit(this.minAsNumber, this.maxAsNumber, this.convertToConstrainedValue(nextAsNumber)).toString();
|
|
9046
|
+
if (newValue !== value) {
|
|
9047
|
+
this.value = newValue;
|
|
9048
|
+
return;
|
|
9049
|
+
}
|
|
9050
|
+
this._value = value.toString();
|
|
9051
|
+
this.elementInternals.ariaValueNow = this._value;
|
|
9052
|
+
this.elementInternals.ariaValueText = this.valueTextFormatter(this._value);
|
|
9053
|
+
this.setSliderPosition(this.direction);
|
|
9054
|
+
this.$emit("change");
|
|
9055
|
+
this.setFormValue(value);
|
|
9056
|
+
Observable.notify(this, "value");
|
|
9057
|
+
}
|
|
9058
|
+
/**
|
|
9059
|
+
* Resets the form value to its initial value when the form is reset.
|
|
9060
|
+
*
|
|
9061
|
+
* @internal
|
|
9062
|
+
*/
|
|
9063
|
+
formResetCallback() {
|
|
9064
|
+
this.value = this.initialValue ?? this.midpoint;
|
|
9065
|
+
}
|
|
9066
|
+
/**
|
|
9067
|
+
* Disabled the component when its associated form is disabled.
|
|
9068
|
+
*
|
|
9069
|
+
* @internal
|
|
9070
|
+
*
|
|
9071
|
+
* @privateRemarks
|
|
9072
|
+
* DO NOT change the `disabled` property or attribute here, because if the
|
|
9073
|
+
* `disabled` attribute is present, reenabling an ancestor `<fieldset>`
|
|
9074
|
+
* element will not reenabling this component.
|
|
9075
|
+
*/
|
|
9076
|
+
formDisabledCallback(disabled) {
|
|
9077
|
+
this.setDisabledSideEffect(disabled);
|
|
9078
|
+
}
|
|
9079
|
+
/**
|
|
9080
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/setFormValue | `ElementInternals.setFormValue()`} method.
|
|
9081
|
+
*
|
|
9082
|
+
* @internal
|
|
9083
|
+
*/
|
|
9084
|
+
setFormValue(value, state) {
|
|
9085
|
+
this.elementInternals.setFormValue(value, value ?? state);
|
|
9086
|
+
}
|
|
9087
|
+
/**
|
|
9088
|
+
* The value property, typed as a number.
|
|
9089
|
+
*
|
|
9090
|
+
* @public
|
|
9091
|
+
*/
|
|
9092
|
+
get valueAsNumber() {
|
|
9093
|
+
return parseFloat(this.value);
|
|
9094
|
+
}
|
|
9095
|
+
set valueAsNumber(next) {
|
|
9096
|
+
this.value = next.toString();
|
|
9097
|
+
}
|
|
9098
|
+
valueTextFormatterChanged() {
|
|
9099
|
+
if (typeof this.valueTextFormatter === "function") {
|
|
9100
|
+
this.elementInternals.ariaValueText = this.valueTextFormatter(this._value);
|
|
9101
|
+
} else {
|
|
9102
|
+
this.elementInternals.ariaValueText = "";
|
|
9103
|
+
}
|
|
9104
|
+
}
|
|
9105
|
+
disabledChanged() {
|
|
9106
|
+
this.setDisabledSideEffect(this.disabled);
|
|
9290
9107
|
}
|
|
9291
|
-
// Map to proxy element.
|
|
9292
9108
|
minChanged() {
|
|
9293
|
-
|
|
9294
|
-
|
|
9109
|
+
this.elementInternals.ariaValueMin = `${this.minAsNumber}`;
|
|
9110
|
+
if (this.$fastController.isConnected && this.minAsNumber > this.valueAsNumber) {
|
|
9111
|
+
this.value = this.min;
|
|
9112
|
+
}
|
|
9113
|
+
}
|
|
9114
|
+
/**
|
|
9115
|
+
* Returns the min property or the default value
|
|
9116
|
+
*
|
|
9117
|
+
* @internal
|
|
9118
|
+
*/
|
|
9119
|
+
get minAsNumber() {
|
|
9120
|
+
if (this.min !== void 0) {
|
|
9121
|
+
const parsed = parseFloat(this.min);
|
|
9122
|
+
if (!Number.isNaN(parsed)) {
|
|
9123
|
+
return parsed;
|
|
9124
|
+
}
|
|
9295
9125
|
}
|
|
9296
|
-
|
|
9126
|
+
return 0;
|
|
9297
9127
|
}
|
|
9298
|
-
// Map to proxy element.
|
|
9299
9128
|
maxChanged() {
|
|
9300
|
-
|
|
9301
|
-
|
|
9129
|
+
this.elementInternals.ariaValueMax = `${this.maxAsNumber}`;
|
|
9130
|
+
if (this.$fastController.isConnected && this.maxAsNumber < this.valueAsNumber) {
|
|
9131
|
+
this.value = this.max;
|
|
9302
9132
|
}
|
|
9303
|
-
this.validate();
|
|
9304
9133
|
}
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
9134
|
+
/**
|
|
9135
|
+
* Returns the max property or the default value
|
|
9136
|
+
*
|
|
9137
|
+
* @internal
|
|
9138
|
+
*/
|
|
9139
|
+
get maxAsNumber() {
|
|
9140
|
+
if (this.max !== void 0) {
|
|
9141
|
+
const parsed = parseFloat(this.max);
|
|
9142
|
+
if (!Number.isNaN(parsed)) {
|
|
9143
|
+
return parsed;
|
|
9144
|
+
}
|
|
9308
9145
|
}
|
|
9146
|
+
return 100;
|
|
9147
|
+
}
|
|
9148
|
+
stepChanged() {
|
|
9309
9149
|
this.updateStepMultiplier();
|
|
9310
|
-
this.
|
|
9150
|
+
if (this.$fastController.isConnected) {
|
|
9151
|
+
this.value = this._value;
|
|
9152
|
+
}
|
|
9311
9153
|
}
|
|
9312
|
-
|
|
9154
|
+
/**
|
|
9155
|
+
* Returns the step property as a number.
|
|
9156
|
+
*
|
|
9157
|
+
* @internal
|
|
9158
|
+
*/
|
|
9159
|
+
get stepAsNumber() {
|
|
9160
|
+
if (this.step !== void 0) {
|
|
9161
|
+
const parsed = parseFloat(this.step);
|
|
9162
|
+
if (!Number.isNaN(parsed) && parsed > 0) {
|
|
9163
|
+
return parsed;
|
|
9164
|
+
}
|
|
9165
|
+
}
|
|
9166
|
+
return 1;
|
|
9167
|
+
}
|
|
9168
|
+
orientationChanged(prev, next) {
|
|
9169
|
+
this.elementInternals.ariaOrientation = next ?? Orientation.horizontal;
|
|
9170
|
+
if (prev) {
|
|
9171
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
9172
|
+
}
|
|
9173
|
+
if (next) {
|
|
9174
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
9175
|
+
}
|
|
9313
9176
|
if (this.$fastController.isConnected) {
|
|
9314
|
-
this.
|
|
9177
|
+
this.setSliderPosition(this.direction);
|
|
9315
9178
|
}
|
|
9316
9179
|
}
|
|
9317
9180
|
/**
|
|
@@ -9319,13 +9182,13 @@ class Slider extends FormAssociatedSlider {
|
|
|
9319
9182
|
*/
|
|
9320
9183
|
connectedCallback() {
|
|
9321
9184
|
super.connectedCallback();
|
|
9322
|
-
this.proxy.setAttribute("type", "range");
|
|
9323
9185
|
this.direction = getDirection(this);
|
|
9186
|
+
this.setDisabledSideEffect(this.disabled);
|
|
9324
9187
|
this.updateStepMultiplier();
|
|
9325
9188
|
this.setupTrackConstraints();
|
|
9326
9189
|
this.setupListeners();
|
|
9327
9190
|
this.setupDefaultValue();
|
|
9328
|
-
this.
|
|
9191
|
+
this.setSliderPosition(this.direction);
|
|
9329
9192
|
Observable.getNotifier(this).subscribe(this, "max");
|
|
9330
9193
|
Observable.getNotifier(this).subscribe(this, "min");
|
|
9331
9194
|
Observable.getNotifier(this).subscribe(this, "step");
|
|
@@ -9347,9 +9210,9 @@ class Slider extends FormAssociatedSlider {
|
|
|
9347
9210
|
* @public
|
|
9348
9211
|
*/
|
|
9349
9212
|
increment() {
|
|
9350
|
-
const newVal = this.direction !== Direction.rtl
|
|
9213
|
+
const newVal = this.direction !== Direction.rtl ? Number(this.value) + this.stepAsNumber : Number(this.value) - this.stepAsNumber;
|
|
9351
9214
|
const incrementedVal = this.convertToConstrainedValue(newVal);
|
|
9352
|
-
const incrementedValString = incrementedVal <
|
|
9215
|
+
const incrementedValString = incrementedVal < this.maxAsNumber ? `${incrementedVal}` : `${this.maxAsNumber}`;
|
|
9353
9216
|
this.value = incrementedValString;
|
|
9354
9217
|
}
|
|
9355
9218
|
/**
|
|
@@ -9358,56 +9221,43 @@ class Slider extends FormAssociatedSlider {
|
|
|
9358
9221
|
* @public
|
|
9359
9222
|
*/
|
|
9360
9223
|
decrement() {
|
|
9361
|
-
const newVal = this.direction !== Direction.rtl
|
|
9224
|
+
const newVal = this.direction !== Direction.rtl ? Number(this.value) - Number(this.stepAsNumber) : Number(this.value) + Number(this.stepAsNumber);
|
|
9362
9225
|
const decrementedVal = this.convertToConstrainedValue(newVal);
|
|
9363
|
-
const decrementedValString = decrementedVal >
|
|
9226
|
+
const decrementedValString = decrementedVal > this.minAsNumber ? `${decrementedVal}` : `${this.minAsNumber}`;
|
|
9364
9227
|
this.value = decrementedValString;
|
|
9365
9228
|
}
|
|
9366
|
-
/**
|
|
9367
|
-
* Gets the actual step value for the slider
|
|
9368
|
-
*
|
|
9369
|
-
*/
|
|
9370
|
-
get stepValue() {
|
|
9371
|
-
return this.step === void 0 ? 1 : this.step;
|
|
9372
|
-
}
|
|
9373
9229
|
/**
|
|
9374
9230
|
* Places the thumb based on the current value
|
|
9375
9231
|
*
|
|
9376
|
-
* @public
|
|
9377
9232
|
* @param direction - writing mode
|
|
9378
9233
|
*/
|
|
9379
|
-
|
|
9380
|
-
const newPct = convertPixelToPercent(
|
|
9234
|
+
setSliderPosition(direction) {
|
|
9235
|
+
const newPct = convertPixelToPercent(parseFloat(this.value), this.minAsNumber, this.maxAsNumber, direction);
|
|
9381
9236
|
const percentage = (1 - newPct) * 100;
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
}
|
|
9385
|
-
this.position = this.isDragging ? `top: ${percentage}%; transition: none;` : `top: ${percentage}%; transition: all 0.2s ease;`;
|
|
9386
|
-
}
|
|
9237
|
+
const thumbPosition = `calc(100% - ${percentage}%)`;
|
|
9238
|
+
const trackProgress = !(this.orientation === Orientation.vertical) && direction === Direction.rtl ? `${percentage}%` : `calc(100% - ${percentage}%)`;
|
|
9239
|
+
this.position = `--slider-thumb: ${thumbPosition}; --slider-progress: ${trackProgress}`;
|
|
9387
9240
|
}
|
|
9388
9241
|
/**
|
|
9389
9242
|
* Update the step multiplier used to ensure rounding errors from steps that
|
|
9390
9243
|
* are not whole numbers
|
|
9391
9244
|
*/
|
|
9392
9245
|
updateStepMultiplier() {
|
|
9393
|
-
const stepString = this.
|
|
9394
|
-
const decimalPlacesOfStep = !!(this.
|
|
9246
|
+
const stepString = this.stepAsNumber + "";
|
|
9247
|
+
const decimalPlacesOfStep = !!(this.stepAsNumber % 1) ? stepString.length - stepString.indexOf(".") - 1 : 0;
|
|
9395
9248
|
this.stepMultiplier = Math.pow(10, decimalPlacesOfStep);
|
|
9396
9249
|
}
|
|
9397
9250
|
get midpoint() {
|
|
9398
|
-
return `${this.convertToConstrainedValue((this.
|
|
9251
|
+
return `${this.convertToConstrainedValue((this.maxAsNumber + this.minAsNumber) / 2)}`;
|
|
9399
9252
|
}
|
|
9400
9253
|
setupDefaultValue() {
|
|
9401
|
-
if (
|
|
9402
|
-
|
|
9403
|
-
|
|
9404
|
-
|
|
9405
|
-
|
|
9406
|
-
if (!Number.isNaN(value) && (value < this.min || value > this.max)) {
|
|
9407
|
-
this.value = this.midpoint;
|
|
9408
|
-
}
|
|
9409
|
-
}
|
|
9254
|
+
if (!this._value) {
|
|
9255
|
+
this.value = this.initialValue ?? this.midpoint;
|
|
9256
|
+
}
|
|
9257
|
+
if (!Number.isNaN(this.valueAsNumber) && (this.valueAsNumber < this.minAsNumber || this.valueAsNumber > this.maxAsNumber)) {
|
|
9258
|
+
this.value = this.midpoint;
|
|
9410
9259
|
}
|
|
9260
|
+
this.elementInternals.ariaValueNow = this.value;
|
|
9411
9261
|
}
|
|
9412
9262
|
/**
|
|
9413
9263
|
* Calculate the new value based on the given raw pixel value.
|
|
@@ -9419,26 +9269,43 @@ class Slider extends FormAssociatedSlider {
|
|
|
9419
9269
|
*/
|
|
9420
9270
|
calculateNewValue(rawValue) {
|
|
9421
9271
|
this.setupTrackConstraints();
|
|
9422
|
-
const newPosition = convertPixelToPercent(rawValue, this.orientation === Orientation.
|
|
9423
|
-
const newValue = (this.
|
|
9272
|
+
const newPosition = convertPixelToPercent(rawValue, this.orientation === Orientation.vertical ? this.trackMinHeight : this.trackMinWidth, this.orientation === Orientation.vertical ? this.trackHeight : this.trackWidth, this.direction);
|
|
9273
|
+
const newValue = (this.maxAsNumber - this.minAsNumber) * newPosition + this.minAsNumber;
|
|
9424
9274
|
return this.convertToConstrainedValue(newValue);
|
|
9425
9275
|
}
|
|
9426
9276
|
convertToConstrainedValue(value) {
|
|
9427
9277
|
if (isNaN(value)) {
|
|
9428
|
-
value = this.
|
|
9278
|
+
value = this.minAsNumber;
|
|
9429
9279
|
}
|
|
9430
|
-
let constrainedValue = value - this.
|
|
9431
|
-
const roundedConstrainedValue = Math.round(constrainedValue / this.
|
|
9432
|
-
const remainderValue = constrainedValue - roundedConstrainedValue * (this.stepMultiplier * this.
|
|
9433
|
-
constrainedValue = remainderValue >= Number(this.
|
|
9434
|
-
return constrainedValue + this.
|
|
9280
|
+
let constrainedValue = value - this.minAsNumber;
|
|
9281
|
+
const roundedConstrainedValue = Math.round(constrainedValue / this.stepAsNumber);
|
|
9282
|
+
const remainderValue = constrainedValue - roundedConstrainedValue * (this.stepMultiplier * this.stepAsNumber) / this.stepMultiplier;
|
|
9283
|
+
constrainedValue = remainderValue >= Number(this.stepAsNumber) / 2 ? constrainedValue - remainderValue + Number(this.stepAsNumber) : constrainedValue - remainderValue;
|
|
9284
|
+
return constrainedValue + this.minAsNumber;
|
|
9285
|
+
}
|
|
9286
|
+
/**
|
|
9287
|
+
* Makes sure the side effects of set up when the disabled state changes.
|
|
9288
|
+
*/
|
|
9289
|
+
setDisabledSideEffect(disabled) {
|
|
9290
|
+
if (!this.$fastController.isConnected) {
|
|
9291
|
+
return;
|
|
9292
|
+
}
|
|
9293
|
+
this.elementInternals.ariaDisabled = disabled.toString();
|
|
9294
|
+
this.tabIndex = disabled ? -1 : 0;
|
|
9435
9295
|
}
|
|
9436
9296
|
}
|
|
9297
|
+
/**
|
|
9298
|
+
* The form-associated flag.
|
|
9299
|
+
* @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-face-example | Form-associated custom elements}
|
|
9300
|
+
*
|
|
9301
|
+
* @public
|
|
9302
|
+
*/
|
|
9303
|
+
Slider.formAssociated = true;
|
|
9437
9304
|
__decorateClass$6([attr], Slider.prototype, "size", 2);
|
|
9438
9305
|
__decorateClass$6([attr({
|
|
9439
|
-
attribute: "
|
|
9440
|
-
mode: "
|
|
9441
|
-
})], Slider.prototype, "
|
|
9306
|
+
attribute: "value",
|
|
9307
|
+
mode: "fromView"
|
|
9308
|
+
})], Slider.prototype, "initialValue", 2);
|
|
9442
9309
|
__decorateClass$6([observable], Slider.prototype, "direction", 2);
|
|
9443
9310
|
__decorateClass$6([observable], Slider.prototype, "isDragging", 2);
|
|
9444
9311
|
__decorateClass$6([observable], Slider.prototype, "position", 2);
|
|
@@ -9449,28 +9316,33 @@ __decorateClass$6([observable], Slider.prototype, "trackLeft", 2);
|
|
|
9449
9316
|
__decorateClass$6([observable], Slider.prototype, "trackMinHeight", 2);
|
|
9450
9317
|
__decorateClass$6([observable], Slider.prototype, "valueTextFormatter", 2);
|
|
9451
9318
|
__decorateClass$6([attr({
|
|
9452
|
-
|
|
9319
|
+
mode: "boolean"
|
|
9320
|
+
})], Slider.prototype, "disabled", 2);
|
|
9321
|
+
__decorateClass$6([attr({
|
|
9322
|
+
converter: numberLikeStringConverter
|
|
9453
9323
|
})], Slider.prototype, "min", 2);
|
|
9454
9324
|
__decorateClass$6([attr({
|
|
9455
|
-
converter:
|
|
9325
|
+
converter: numberLikeStringConverter
|
|
9456
9326
|
})], Slider.prototype, "max", 2);
|
|
9457
9327
|
__decorateClass$6([attr({
|
|
9458
|
-
converter:
|
|
9328
|
+
converter: numberLikeStringConverter
|
|
9459
9329
|
})], Slider.prototype, "step", 2);
|
|
9460
9330
|
__decorateClass$6([attr], Slider.prototype, "orientation", 2);
|
|
9461
9331
|
__decorateClass$6([attr], Slider.prototype, "mode", 2);
|
|
9462
9332
|
|
|
9463
9333
|
const styles$8 = css`
|
|
9464
|
-
${display("inline-grid")}
|
|
9334
|
+
${display("inline-grid")}
|
|
9335
|
+
|
|
9336
|
+
:host{--thumb-size:20px;--track-margin-inline:calc(var(--thumb-size) / 2);--track-size:4px;--track-overhang:calc(var(--track-size) / -2);--slider-direction:90deg;--border-radius:${borderRadiusMedium};--step-marker-inset:var(--track-overhang) -1px;position:relative;align-items:center;justify-content:center;box-sizing:border-box;outline:none;user-select:none;touch-action:none;min-width:120px;min-height:32px;grid-template-rows:1fr var(--thumb-size) 1fr;grid-template-columns:var(--track-margin-inline) 1fr var(--track-margin-inline)}:host(:not(:disabled)){cursor:pointer}:host(:dir(rtl)){--slider-direction:-90deg}:host(${smallState}){--thumb-size:16px;--track-overhang:-1px;--track-size:2px;--border-radius:${borderRadiusSmall}}:host(${verticalState}){--slider-direction:0deg;--step-marker-inset:-1px var(--track-overhang);min-height:120px;grid-template-rows:var(--track-margin-inline) 1fr var(--track-margin-inline);grid-template-columns:1fr var(--thumb-size) 1fr;width:unset;min-width:32px;justify-items:center}:host(:not([slot='input']):focus-visible){box-shadow:0 0 0 2pt ${colorStrokeFocus2};outline:1px solid ${colorStrokeFocus1}}.track{position:relative;background-color:${colorNeutralStrokeAccessible};border-radius:var(--border-radius);grid-row:2 / 2;grid-column:2 / 2;width:100%;height:var(--track-size);forced-color-adjust:none}:host(${verticalState}) .track{top:var(--track-overhang);bottom:var(--track-overhang);width:var(--track-size);height:100%}.track::before{content:'';position:absolute;height:100%;border-radius:inherit;inset-inline-start:0;width:var(--slider-progress)}:host(${verticalState}) .track::before{width:100%;bottom:0;height:var(--slider-progress)}:host([step]) .track::after{content:'';position:absolute;border-radius:inherit;inset:var(--step-marker-inset);background-image:repeating-linear-gradient(
|
|
9465
9337
|
var(--slider-direction),#0000 0%,#0000 calc(var(--step-rate) - 1px),${colorNeutralBackground1} calc(var(--step-rate) - 1px),${colorNeutralBackground1} var(--step-rate)
|
|
9466
|
-
)}
|
|
9467
|
-
.track:hover,.track:active,.track{background:WindowText}.thumb
|
|
9338
|
+
)}.thumb-container{position:absolute;grid-row:2 / 2;grid-column:2 / 2;transform:translateX(-50%);left:var(--slider-thumb)}:host(${verticalState}) .thumb-container{transform:translateY(50%);left:unset;bottom:var(--slider-thumb)}:host(:not(:active)) :is(.thumb-container,.track::before){transition:all 0.2s ease}.thumb{width:var(--thumb-size);height:var(--thumb-size);border-radius:${borderRadiusCircular};box-shadow:0 0 0 calc(var(--thumb-size) * 0.2) ${colorNeutralBackground1} inset;border:calc(var(--thumb-size) * 0.05) solid ${colorNeutralStroke1};box-sizing:border-box}.thumb,.track::before{background-color:${colorCompoundBrandBackground}}:host(:hover) .thumb,:host(:hover) .track::before{background-color:${colorCompoundBrandBackgroundHover}}:host(:active) .thumb,:host(:active) .track::before{background-color:${colorCompoundBrandBackgroundPressed}}:host(:disabled) .track{background-color:${colorNeutralBackgroundDisabled}}:host(:disabled) .thumb,:host(:disabled) .track::before{background-color:${colorNeutralForegroundDisabled}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
9339
|
+
.track:hover,.track:active,.track{background:WindowText}.thumb:hover,.thumb:active,.thumb{background:ButtonText}:host(:hover) .track::before,:host(:active) .track::before,.track::before{background:Highlight}`));
|
|
9468
9340
|
|
|
9469
9341
|
function sliderTemplate(options = {}) {
|
|
9470
|
-
return html`<template
|
|
9342
|
+
return html`<template tabindex="${x => x.disabled ? null : 0}" @pointerdown="${(x, c) => x.handlePointerDown(c.event)}"><div ${ref("track")} part="track-container" class="track" style="${x => x.position}"></div><div ${ref("thumb")} part="thumb-container" class="thumb-container" style="${x => x.position}" @pointerdown="${(x, c) => x.handleThumbPointerDown(c.event)}"><slot name="thumb">${staticallyCompose(options.thumb)}</slot></div></template>`;
|
|
9471
9343
|
}
|
|
9472
9344
|
const template$8 = sliderTemplate({
|
|
9473
|
-
thumb: `<div class="thumb
|
|
9345
|
+
thumb: `<div class="thumb"></div>`
|
|
9474
9346
|
});
|
|
9475
9347
|
|
|
9476
9348
|
const definition$8 = Slider.compose({
|