@fluentui/web-components 3.0.0-beta.41 → 3.0.0-beta.42

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +11 -2
  2. package/dist/dts/slider/slider.d.ts +180 -35
  3. package/dist/dts/slider/slider.options.d.ts +2 -2
  4. package/dist/dts/slider/slider.template.d.ts +2 -2
  5. package/dist/dts/styles/states/index.d.ts +5 -0
  6. package/dist/dts/utils/converters.d.ts +17 -0
  7. package/dist/dts/utils/index.d.ts +1 -0
  8. package/dist/esm/accordion/accordion.js.map +1 -1
  9. package/dist/esm/accordion-item/accordion-item.js.map +1 -1
  10. package/dist/esm/anchor-button/anchor-button.js.map +1 -1
  11. package/dist/esm/avatar/avatar.js +2 -1
  12. package/dist/esm/avatar/avatar.js.map +1 -1
  13. package/dist/esm/badge/badge.js.map +1 -1
  14. package/dist/esm/button/button.js +2 -1
  15. package/dist/esm/button/button.js.map +1 -1
  16. package/dist/esm/checkbox/checkbox.js +2 -1
  17. package/dist/esm/checkbox/checkbox.js.map +1 -1
  18. package/dist/esm/counter-badge/counter-badge.js.map +1 -1
  19. package/dist/esm/dialog/dialog.js.map +1 -1
  20. package/dist/esm/dialog-body/dialog-body.js.map +1 -1
  21. package/dist/esm/divider/divider.js.map +1 -1
  22. package/dist/esm/drawer/drawer.js.map +1 -1
  23. package/dist/esm/field/field.js.map +1 -1
  24. package/dist/esm/image/image.js.map +1 -1
  25. package/dist/esm/label/label.js.map +1 -1
  26. package/dist/esm/link/link.js.map +1 -1
  27. package/dist/esm/menu/menu.js.map +1 -1
  28. package/dist/esm/menu-item/menu-item.js.map +1 -1
  29. package/dist/esm/menu-list/menu-list.js +2 -1
  30. package/dist/esm/menu-list/menu-list.js.map +1 -1
  31. package/dist/esm/message-bar/message-bar.js.map +1 -1
  32. package/dist/esm/patterns/aria-globals.js.map +1 -1
  33. package/dist/esm/progress-bar/progress-bar.js.map +1 -1
  34. package/dist/esm/radio-group/radio-group.js +2 -1
  35. package/dist/esm/radio-group/radio-group.js.map +1 -1
  36. package/dist/esm/rating-display/rating-display.js.map +1 -1
  37. package/dist/esm/slider/slider.js +442 -220
  38. package/dist/esm/slider/slider.js.map +1 -1
  39. package/dist/esm/slider/slider.styles.js +107 -132
  40. package/dist/esm/slider/slider.styles.js.map +1 -1
  41. package/dist/esm/slider/slider.template.js +11 -28
  42. package/dist/esm/slider/slider.template.js.map +1 -1
  43. package/dist/esm/spinner/spinner.js.map +1 -1
  44. package/dist/esm/styles/states/index.js +5 -0
  45. package/dist/esm/styles/states/index.js.map +1 -1
  46. package/dist/esm/tab/tab.js.map +1 -1
  47. package/dist/esm/tabs/tabs.js.map +1 -1
  48. package/dist/esm/text-input/text-input.js +2 -1
  49. package/dist/esm/text-input/text-input.js.map +1 -1
  50. package/dist/esm/toggle-button/toggle-button.js.map +1 -1
  51. package/dist/esm/utils/converters.js +26 -0
  52. package/dist/esm/utils/converters.js.map +1 -0
  53. package/dist/esm/utils/index.js +1 -0
  54. package/dist/esm/utils/index.js.map +1 -1
  55. package/dist/web-components.d.ts +181 -101
  56. package/dist/web-components.js +368 -502
  57. package/dist/web-components.min.js +198 -196
  58. package/package.json +1 -1
@@ -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))`;
@@ -8726,372 +8738,11 @@ const definition$9 = RatingDisplay.compose({
8726
8738
 
8727
8739
  definition$9.define(FluentDesignSystem.registry);
8728
8740
 
8729
- Orientation;
8741
+ const SliderOrientation = Orientation;
8730
8742
  const SliderMode = {
8731
8743
  singleValue: "single-value"
8732
8744
  };
8733
8745
 
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
8746
  function convertPixelToPercent(pixelPos, minPosition, maxPosition, direction) {
9096
8747
  let pct = limit(0, 1, (pixelPos - minPosition) / (maxPosition - minPosition));
9097
8748
  if (direction === Direction.rtl) {
@@ -9108,9 +8759,15 @@ var __decorateClass$6 = (decorators, target, key, kind) => {
9108
8759
  if (kind && result) __defProp$6(target, key, result);
9109
8760
  return result;
9110
8761
  };
9111
- class Slider extends FormAssociatedSlider {
8762
+ class Slider extends FASTElement {
9112
8763
  constructor() {
9113
- super(...arguments);
8764
+ super();
8765
+ /**
8766
+ * The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
8767
+ *
8768
+ * @internal
8769
+ */
8770
+ this.elementInternals = this.attachInternals();
9114
8771
  this.direction = Direction.ltr;
9115
8772
  this.isDragging = false;
9116
8773
  this.trackWidth = 0;
@@ -9118,34 +8775,39 @@ class Slider extends FormAssociatedSlider {
9118
8775
  this.trackHeight = 0;
9119
8776
  this.trackLeft = 0;
9120
8777
  this.trackMinHeight = 0;
9121
- this.valueTextFormatter = () => null;
9122
- this.min = 0;
9123
- this.max = 10;
9124
- this.orientation = Orientation.horizontal;
8778
+ this.valueTextFormatter = () => "";
8779
+ this.disabled = false;
8780
+ this.min = "";
8781
+ this.max = "";
8782
+ this.step = "";
9125
8783
  this.mode = SliderMode.singleValue;
9126
- this.keypressHandler = e => {
9127
- if (this.readOnly || this.disabled) {
8784
+ this.keypressHandler = event => {
8785
+ if (this.disabled) {
9128
8786
  return;
9129
8787
  }
9130
- if (e.key === keyHome) {
9131
- e.preventDefault();
9132
- this.direction !== Direction.rtl && this.orientation !== Orientation.vertical ? this.value = `${this.min}` : this.value = `${this.max}`;
9133
- } else if (e.key === keyEnd) {
9134
- e.preventDefault();
9135
- this.direction !== Direction.rtl && this.orientation !== Orientation.vertical ? this.value = `${this.max}` : this.value = `${this.min}`;
9136
- } else if (!e.shiftKey) {
9137
- switch (e.key) {
9138
- case keyArrowRight:
9139
- case keyArrowUp:
9140
- e.preventDefault();
8788
+ switch (event.key) {
8789
+ case keyHome:
8790
+ event.preventDefault();
8791
+ this.value = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical ? `${this.minAsNumber}` : `${this.maxAsNumber}`;
8792
+ break;
8793
+ case keyEnd:
8794
+ event.preventDefault();
8795
+ this.value = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical ? `${this.maxAsNumber}` : `${this.minAsNumber}`;
8796
+ break;
8797
+ case keyArrowRight:
8798
+ case keyArrowUp:
8799
+ if (!event.shiftKey) {
8800
+ event.preventDefault();
9141
8801
  this.increment();
9142
- break;
9143
- case keyArrowLeft:
9144
- case keyArrowDown:
9145
- e.preventDefault();
8802
+ }
8803
+ break;
8804
+ case keyArrowLeft:
8805
+ case keyArrowDown:
8806
+ if (!event.shiftKey) {
8807
+ event.preventDefault();
9146
8808
  this.decrement();
9147
- break;
9148
- }
8809
+ }
8810
+ break;
9149
8811
  }
9150
8812
  };
9151
8813
  this.setupTrackConstraints = () => {
@@ -9159,80 +8821,92 @@ class Slider extends FormAssociatedSlider {
9159
8821
  this.trackWidth = 1;
9160
8822
  }
9161
8823
  };
9162
- //Remove
9163
8824
  this.setupListeners = (remove = false) => {
9164
8825
  this.addEventListener("keydown", this.keypressHandler);
9165
- this.addEventListener("mousedown", this.handleMouseDown);
9166
8826
  if (remove) {
9167
8827
  this.removeEventListener("keydown", this.keypressHandler);
9168
- this.removeEventListener("mousedown", this.handleMouseDown);
9169
8828
  }
9170
8829
  };
9171
- /**
9172
- * @internal
9173
- */
9174
- this.initialValue = "";
9175
8830
  /**
9176
8831
  * Handle mouse moves during a thumb drag operation
9177
8832
  * If the event handler is null it removes the events
9178
8833
  */
9179
- this.handleThumbMouseDown = event => {
8834
+ this.handleThumbPointerDown = event => {
9180
8835
  const windowFn = event !== null ? window.addEventListener : window.removeEventListener;
9181
- windowFn("mouseup", this.handleWindowMouseUp);
9182
- windowFn("mousemove", this.handleMouseMove, {
8836
+ windowFn("pointerup", this.handleWindowPointerUp);
8837
+ windowFn("pointermove", this.handlePointerMove, {
9183
8838
  passive: true
9184
8839
  });
9185
- windowFn("touchmove", this.handleMouseMove, {
8840
+ windowFn("touchmove", this.handlePointerMove, {
9186
8841
  passive: true
9187
8842
  });
9188
- windowFn("touchend", this.handleWindowMouseUp);
8843
+ windowFn("touchend", this.handleWindowPointerUp);
9189
8844
  this.isDragging = event !== null;
9190
8845
  };
9191
8846
  /**
9192
8847
  * Handle mouse moves during a thumb drag operation
9193
8848
  */
9194
- this.handleMouseMove = e => {
9195
- if (this.readOnly || this.disabled || e.defaultPrevented) {
8849
+ this.handlePointerMove = event => {
8850
+ if (this.disabled || event.defaultPrevented) {
9196
8851
  return;
9197
8852
  }
9198
- const sourceEvent = window.TouchEvent && e instanceof TouchEvent ? e.touches[0] : e;
9199
- const eventValue = this.orientation === Orientation.horizontal ? sourceEvent.pageX - document.documentElement.scrollLeft - this.trackLeft : sourceEvent.pageY - document.documentElement.scrollTop;
8853
+ const sourceEvent = window.TouchEvent && event instanceof TouchEvent ? event.touches[0] : event;
8854
+ const eventValue = this.orientation === Orientation.vertical ? sourceEvent.pageY - document.documentElement.scrollTop : sourceEvent.pageX - document.documentElement.scrollLeft - this.trackLeft;
9200
8855
  this.value = `${this.calculateNewValue(eventValue)}`;
9201
8856
  };
9202
8857
  /**
9203
8858
  * Handle a window mouse up during a drag operation
9204
8859
  */
9205
- this.handleWindowMouseUp = event => {
8860
+ this.handleWindowPointerUp = () => {
9206
8861
  this.stopDragging();
9207
8862
  };
9208
8863
  this.stopDragging = () => {
9209
8864
  this.isDragging = false;
9210
- this.handleMouseDown(null);
9211
- this.handleThumbMouseDown(null);
8865
+ this.handlePointerDown(null);
8866
+ this.handleThumbPointerDown(null);
9212
8867
  };
9213
8868
  /**
9214
8869
  *
9215
- * @param e - MouseEvent or null. If there is no event handler it will remove the events
8870
+ * @param event - PointerEvent or null. If there is no event handler it will remove the events
9216
8871
  */
9217
- this.handleMouseDown = e => {
9218
- if (e === null || !this.disabled && !this.readOnly) {
9219
- const windowFn = e !== null ? window.addEventListener : window.removeEventListener;
9220
- const documentFn = e !== null ? document.addEventListener : document.removeEventListener;
9221
- windowFn("mouseup", this.handleWindowMouseUp);
9222
- documentFn("mouseleave", this.handleWindowMouseUp);
9223
- windowFn("mousemove", this.handleMouseMove);
9224
- if (e) {
8872
+ this.handlePointerDown = event => {
8873
+ if (event === null || !this.disabled) {
8874
+ const windowFn = event !== null ? window.addEventListener : window.removeEventListener;
8875
+ const documentFn = event !== null ? document.addEventListener : document.removeEventListener;
8876
+ windowFn("pointerup", this.handleWindowPointerUp);
8877
+ documentFn("mouseleave", this.handleWindowPointerUp);
8878
+ windowFn("pointermove", this.handlePointerMove);
8879
+ if (event) {
9225
8880
  this.setupTrackConstraints();
9226
- const controlValue = this.orientation === Orientation.horizontal ? e.pageX - document.documentElement.scrollLeft - this.trackLeft : e.pageY - document.documentElement.scrollTop;
8881
+ const controlValue = this.orientation === Orientation.vertical ? event.pageY - document.documentElement.scrollTop : event.pageX - document.documentElement.scrollLeft - this.trackLeft;
9227
8882
  this.value = `${this.calculateNewValue(controlValue)}`;
9228
8883
  }
9229
8884
  }
9230
8885
  };
8886
+ this.elementInternals.role = "slider";
8887
+ this.elementInternals.ariaOrientation = this.orientation ?? SliderOrientation.horizontal;
9231
8888
  }
9232
- handleChange(source, propertyName) {
8889
+ /**
8890
+ * A reference to all associated `<label>` elements.
8891
+ *
8892
+ * @public
8893
+ */
8894
+ get labels() {
8895
+ return Object.freeze(Array.from(this.elementInternals.labels));
8896
+ }
8897
+ sizeChanged(prev, next) {
8898
+ if (prev) {
8899
+ toggleState(this.elementInternals, `${prev}`, false);
8900
+ }
8901
+ if (next) {
8902
+ toggleState(this.elementInternals, `${next}`, true);
8903
+ }
8904
+ }
8905
+ handleChange(_, propertyName) {
9233
8906
  switch (propertyName) {
9234
8907
  case "min":
9235
8908
  case "max":
8909
+ this.setSliderPosition(this.direction);
9236
8910
  case "step":
9237
8911
  this.handleStepStyles();
9238
8912
  break;
@@ -9244,74 +8918,257 @@ class Slider extends FormAssociatedSlider {
9244
8918
  */
9245
8919
  handleStepStyles() {
9246
8920
  if (this.step) {
9247
- const totalSteps = 100 / Math.floor((this.max - this.min) / this.step);
8921
+ const totalSteps = 100 / Math.floor((this.maxAsNumber - this.minAsNumber) / this.stepAsNumber);
9248
8922
  if (this.stepStyles !== void 0) {
9249
8923
  this.$fastController.removeStyles(this.stepStyles);
9250
8924
  }
9251
8925
  this.stepStyles = css`
9252
- :host{--step-rate:${totalSteps}%;color:blue}`;
8926
+ :host{--step-rate:${totalSteps}%}`;
9253
8927
  this.$fastController.addStyles(this.stepStyles);
9254
8928
  } else if (this.stepStyles !== void 0) {
9255
8929
  this.$fastController.removeStyles(this.stepStyles);
9256
8930
  }
9257
8931
  }
9258
- // Map to proxy element
9259
- readOnlyChanged() {
9260
- if (this.proxy instanceof HTMLInputElement) {
9261
- this.proxy.readOnly = this.readOnly;
8932
+ /**
8933
+ * Sets the value of the input when the value attribute changes.
8934
+ *
8935
+ * @param prev - The previous value
8936
+ * @param next - The current value
8937
+ * @internal
8938
+ */
8939
+ initialValueChanged(_, next) {
8940
+ if (this.$fastController.isConnected) {
8941
+ this.value = next;
8942
+ } else {
8943
+ this._value = next;
9262
8944
  }
9263
8945
  }
9264
8946
  /**
9265
- * The value property, typed as a number.
8947
+ * The element's validity state.
9266
8948
  *
9267
8949
  * @public
8950
+ * @remarks
8951
+ * Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/validity | `ElementInternals.validity`} property.
9268
8952
  */
9269
- get valueAsNumber() {
9270
- return parseFloat(super.value);
8953
+ get validity() {
8954
+ return this.elementInternals.validity;
9271
8955
  }
9272
- set valueAsNumber(next) {
9273
- this.value = next.toString();
8956
+ /**
8957
+ * The element's validation message.
8958
+ *
8959
+ * @public
8960
+ * @remarks
8961
+ * Reflects the {@link https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/validationMessage | `ElemenentInternals.validationMessage`} property.
8962
+ */
8963
+ get validationMessage() {
8964
+ return this.elementInternals.validationMessage;
8965
+ }
8966
+ /**
8967
+ * Whether the element is a candidate for its owning form's constraint validation.
8968
+ *
8969
+ * @public
8970
+ * @remarks
8971
+ * Reflects the {@link https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/willValidate | `ElemenentInternals.willValidate`} property.
8972
+ */
8973
+ get willValidate() {
8974
+ return this.elementInternals.willValidate;
8975
+ }
8976
+ /**
8977
+ * Checks the element's validity.
8978
+ * @public
8979
+ * @remarks
8980
+ * Reflects the {@link https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/checkValidity | `ElemenentInternals.checkValidity`} method.
8981
+ */
8982
+ checkValidity() {
8983
+ return this.elementInternals.checkValidity();
8984
+ }
8985
+ /**
8986
+ * Reports the element's validity.
8987
+ * @public
8988
+ * @remarks
8989
+ * Reflects the {@link https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/reportValidity | `ElemenentInternals.reportValidity`} method.
8990
+ */
8991
+ reportValidity() {
8992
+ return this.elementInternals.reportValidity();
8993
+ }
8994
+ /**
8995
+ * Sets a custom validity message.
8996
+ * @public
8997
+ */
8998
+ setCustomValidity(message) {
8999
+ this.setValidity({
9000
+ customError: !!message
9001
+ }, message);
9274
9002
  }
9275
9003
  /**
9004
+ * Sets the validity of the control.
9005
+ *
9006
+ * @param flags - Validity flags to set.
9007
+ * @param message - Optional message to supply. If not provided, the control's `validationMessage` will be used.
9008
+ * @param anchor - Optional anchor to use for the validation message.
9009
+ *
9276
9010
  * @internal
9277
9011
  */
9278
- valueChanged(previous, next) {
9012
+ setValidity(flags, message, anchor) {
9279
9013
  if (this.$fastController.isConnected) {
9280
- const nextAsNumber = parseFloat(next);
9281
- const value = limit(this.min, this.max, this.convertToConstrainedValue(nextAsNumber)).toString();
9282
- if (value !== next) {
9283
- this.value = value;
9014
+ if (this.disabled) {
9015
+ this.elementInternals.setValidity({});
9284
9016
  return;
9285
9017
  }
9286
- super.valueChanged(previous, next);
9287
- this.setThumbPositionForOrientation(this.direction);
9288
- this.$emit("change");
9018
+ this.elementInternals.setValidity({
9019
+ customError: !!message,
9020
+ ...flags
9021
+ }, message ?? this.validationMessage, anchor);
9022
+ }
9023
+ }
9024
+ /**
9025
+ * The current value of the input.
9026
+ *
9027
+ * @public
9028
+ */
9029
+ get value() {
9030
+ Observable.track(this, "value");
9031
+ return this._value.toString();
9032
+ }
9033
+ set value(value) {
9034
+ if (!this.$fastController.isConnected) {
9035
+ this._value = value.toString();
9036
+ return;
9037
+ }
9038
+ const nextAsNumber = parseFloat(value);
9039
+ const newValue = limit(this.minAsNumber, this.maxAsNumber, this.convertToConstrainedValue(nextAsNumber)).toString();
9040
+ if (newValue !== value) {
9041
+ this.value = newValue;
9042
+ return;
9043
+ }
9044
+ this._value = value.toString();
9045
+ this.elementInternals.ariaValueNow = this._value;
9046
+ this.elementInternals.ariaValueText = this.valueTextFormatter(this._value);
9047
+ this.setSliderPosition(this.direction);
9048
+ this.$emit("change");
9049
+ this.setFormValue(value);
9050
+ Observable.notify(this, "value");
9051
+ }
9052
+ /**
9053
+ * Resets the form value to its initial value when the form is reset.
9054
+ *
9055
+ * @internal
9056
+ */
9057
+ formResetCallback() {
9058
+ this.value = this.initialValue ?? this.midpoint;
9059
+ }
9060
+ /**
9061
+ * Disabled the component when its associated form is disabled.
9062
+ *
9063
+ * @internal
9064
+ *
9065
+ * @privateRemarks
9066
+ * DO NOT change the `disabled` property or attribute here, because if the
9067
+ * `disabled` attribute is present, reenabling an ancestor `<fieldset>`
9068
+ * element will not reenabling this component.
9069
+ */
9070
+ formDisabledCallback(disabled) {
9071
+ this.setDisabledSideEffect(disabled);
9072
+ }
9073
+ /**
9074
+ * Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/setFormValue | `ElementInternals.setFormValue()`} method.
9075
+ *
9076
+ * @internal
9077
+ */
9078
+ setFormValue(value, state) {
9079
+ this.elementInternals.setFormValue(value, value ?? state);
9080
+ }
9081
+ /**
9082
+ * The value property, typed as a number.
9083
+ *
9084
+ * @public
9085
+ */
9086
+ get valueAsNumber() {
9087
+ return parseFloat(this.value);
9088
+ }
9089
+ set valueAsNumber(next) {
9090
+ this.value = next.toString();
9091
+ }
9092
+ valueTextFormatterChanged() {
9093
+ if (typeof this.valueTextFormatter === "function") {
9094
+ this.elementInternals.ariaValueText = this.valueTextFormatter(this._value);
9095
+ } else {
9096
+ this.elementInternals.ariaValueText = "";
9289
9097
  }
9290
9098
  }
9291
- // Map to proxy element.
9099
+ disabledChanged() {
9100
+ this.setDisabledSideEffect(this.disabled);
9101
+ }
9292
9102
  minChanged() {
9293
- if (this.proxy instanceof HTMLInputElement) {
9294
- this.proxy.min = `${this.min}`;
9103
+ this.elementInternals.ariaValueMin = `${this.minAsNumber}`;
9104
+ if (this.$fastController.isConnected && this.minAsNumber > this.valueAsNumber) {
9105
+ this.value = this.min;
9106
+ }
9107
+ }
9108
+ /**
9109
+ * Returns the min property or the default value
9110
+ *
9111
+ * @internal
9112
+ */
9113
+ get minAsNumber() {
9114
+ if (this.min !== void 0) {
9115
+ const parsed = parseFloat(this.min);
9116
+ if (!Number.isNaN(parsed)) {
9117
+ return parsed;
9118
+ }
9295
9119
  }
9296
- this.validate();
9120
+ return 0;
9297
9121
  }
9298
- // Map to proxy element.
9299
9122
  maxChanged() {
9300
- if (this.proxy instanceof HTMLInputElement) {
9301
- this.proxy.max = `${this.max}`;
9123
+ this.elementInternals.ariaValueMax = `${this.maxAsNumber}`;
9124
+ if (this.$fastController.isConnected && this.maxAsNumber < this.valueAsNumber) {
9125
+ this.value = this.max;
9302
9126
  }
9303
- this.validate();
9304
9127
  }
9305
- stepChanged() {
9306
- if (this.proxy instanceof HTMLInputElement) {
9307
- this.proxy.step = `${this.step}`;
9128
+ /**
9129
+ * Returns the max property or the default value
9130
+ *
9131
+ * @internal
9132
+ */
9133
+ get maxAsNumber() {
9134
+ if (this.max !== void 0) {
9135
+ const parsed = parseFloat(this.max);
9136
+ if (!Number.isNaN(parsed)) {
9137
+ return parsed;
9138
+ }
9308
9139
  }
9140
+ return 100;
9141
+ }
9142
+ stepChanged() {
9309
9143
  this.updateStepMultiplier();
9310
- this.validate();
9144
+ if (this.$fastController.isConnected) {
9145
+ this.value = this._value;
9146
+ }
9311
9147
  }
9312
- orientationChanged() {
9148
+ /**
9149
+ * Returns the step property as a number.
9150
+ *
9151
+ * @internal
9152
+ */
9153
+ get stepAsNumber() {
9154
+ if (this.step !== void 0) {
9155
+ const parsed = parseFloat(this.step);
9156
+ if (!Number.isNaN(parsed) && parsed > 0) {
9157
+ return parsed;
9158
+ }
9159
+ }
9160
+ return 1;
9161
+ }
9162
+ orientationChanged(prev, next) {
9163
+ this.elementInternals.ariaOrientation = next ?? Orientation.horizontal;
9164
+ if (prev) {
9165
+ toggleState(this.elementInternals, `${prev}`, false);
9166
+ }
9167
+ if (next) {
9168
+ toggleState(this.elementInternals, `${next}`, true);
9169
+ }
9313
9170
  if (this.$fastController.isConnected) {
9314
- this.setThumbPositionForOrientation(this.direction);
9171
+ this.setSliderPosition(this.direction);
9315
9172
  }
9316
9173
  }
9317
9174
  /**
@@ -9319,13 +9176,13 @@ class Slider extends FormAssociatedSlider {
9319
9176
  */
9320
9177
  connectedCallback() {
9321
9178
  super.connectedCallback();
9322
- this.proxy.setAttribute("type", "range");
9323
9179
  this.direction = getDirection(this);
9180
+ this.setDisabledSideEffect(this.disabled);
9324
9181
  this.updateStepMultiplier();
9325
9182
  this.setupTrackConstraints();
9326
9183
  this.setupListeners();
9327
9184
  this.setupDefaultValue();
9328
- this.setThumbPositionForOrientation(this.direction);
9185
+ this.setSliderPosition(this.direction);
9329
9186
  Observable.getNotifier(this).subscribe(this, "max");
9330
9187
  Observable.getNotifier(this).subscribe(this, "min");
9331
9188
  Observable.getNotifier(this).subscribe(this, "step");
@@ -9347,9 +9204,9 @@ class Slider extends FormAssociatedSlider {
9347
9204
  * @public
9348
9205
  */
9349
9206
  increment() {
9350
- const newVal = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical ? Number(this.value) + Number(this.stepValue) : Number(this.value) + Number(this.stepValue);
9207
+ const newVal = this.direction !== Direction.rtl ? Number(this.value) + this.stepAsNumber : Number(this.value) - this.stepAsNumber;
9351
9208
  const incrementedVal = this.convertToConstrainedValue(newVal);
9352
- const incrementedValString = incrementedVal < Number(this.max) ? `${incrementedVal}` : `${this.max}`;
9209
+ const incrementedValString = incrementedVal < this.maxAsNumber ? `${incrementedVal}` : `${this.maxAsNumber}`;
9353
9210
  this.value = incrementedValString;
9354
9211
  }
9355
9212
  /**
@@ -9358,56 +9215,43 @@ class Slider extends FormAssociatedSlider {
9358
9215
  * @public
9359
9216
  */
9360
9217
  decrement() {
9361
- const newVal = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical ? Number(this.value) - Number(this.stepValue) : Number(this.value) - Number(this.stepValue);
9218
+ const newVal = this.direction !== Direction.rtl ? Number(this.value) - Number(this.stepAsNumber) : Number(this.value) + Number(this.stepAsNumber);
9362
9219
  const decrementedVal = this.convertToConstrainedValue(newVal);
9363
- const decrementedValString = decrementedVal > Number(this.min) ? `${decrementedVal}` : `${this.min}`;
9220
+ const decrementedValString = decrementedVal > this.minAsNumber ? `${decrementedVal}` : `${this.minAsNumber}`;
9364
9221
  this.value = decrementedValString;
9365
9222
  }
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
9223
  /**
9374
9224
  * Places the thumb based on the current value
9375
9225
  *
9376
- * @public
9377
9226
  * @param direction - writing mode
9378
9227
  */
9379
- setThumbPositionForOrientation(direction) {
9380
- const newPct = convertPixelToPercent(Number(this.value), Number(this.min), Number(this.max), direction);
9228
+ setSliderPosition(direction) {
9229
+ const newPct = convertPixelToPercent(parseFloat(this.value), this.minAsNumber, this.maxAsNumber, direction);
9381
9230
  const percentage = (1 - newPct) * 100;
9382
- if (this.orientation === Orientation.horizontal) {
9383
- this.position = this.isDragging ? `right: ${percentage}%; transition: none;` : `right: ${percentage}%; transition: all 0.2s ease;`;
9384
- } else {
9385
- this.position = this.isDragging ? `top: ${percentage}%; transition: none;` : `top: ${percentage}%; transition: all 0.2s ease;`;
9386
- }
9231
+ const thumbPosition = `calc(100% - ${percentage}%)`;
9232
+ const trackProgress = !(this.orientation === Orientation.vertical) && direction === Direction.rtl ? `${percentage}%` : `calc(100% - ${percentage}%)`;
9233
+ this.position = `--slider-thumb: ${thumbPosition}; --slider-progress: ${trackProgress}`;
9387
9234
  }
9388
9235
  /**
9389
9236
  * Update the step multiplier used to ensure rounding errors from steps that
9390
9237
  * are not whole numbers
9391
9238
  */
9392
9239
  updateStepMultiplier() {
9393
- const stepString = this.stepValue + "";
9394
- const decimalPlacesOfStep = !!(this.stepValue % 1) ? stepString.length - stepString.indexOf(".") - 1 : 0;
9240
+ const stepString = this.stepAsNumber + "";
9241
+ const decimalPlacesOfStep = !!(this.stepAsNumber % 1) ? stepString.length - stepString.indexOf(".") - 1 : 0;
9395
9242
  this.stepMultiplier = Math.pow(10, decimalPlacesOfStep);
9396
9243
  }
9397
9244
  get midpoint() {
9398
- return `${this.convertToConstrainedValue((this.max + this.min) / 2)}`;
9245
+ return `${this.convertToConstrainedValue((this.maxAsNumber + this.minAsNumber) / 2)}`;
9399
9246
  }
9400
9247
  setupDefaultValue() {
9401
- if (typeof this.value === "string") {
9402
- if (this.value.length === 0) {
9403
- this.initialValue = this.midpoint;
9404
- } else {
9405
- const value = parseFloat(this.value);
9406
- if (!Number.isNaN(value) && (value < this.min || value > this.max)) {
9407
- this.value = this.midpoint;
9408
- }
9409
- }
9248
+ if (!this._value) {
9249
+ this.value = this.initialValue ?? this.midpoint;
9250
+ }
9251
+ if (!Number.isNaN(this.valueAsNumber) && (this.valueAsNumber < this.minAsNumber || this.valueAsNumber > this.maxAsNumber)) {
9252
+ this.value = this.midpoint;
9410
9253
  }
9254
+ this.elementInternals.ariaValueNow = this.value;
9411
9255
  }
9412
9256
  /**
9413
9257
  * Calculate the new value based on the given raw pixel value.
@@ -9419,26 +9263,43 @@ class Slider extends FormAssociatedSlider {
9419
9263
  */
9420
9264
  calculateNewValue(rawValue) {
9421
9265
  this.setupTrackConstraints();
9422
- const newPosition = convertPixelToPercent(rawValue, this.orientation === Orientation.horizontal ? this.trackMinWidth : this.trackMinHeight, this.orientation === Orientation.horizontal ? this.trackWidth : this.trackHeight, this.direction);
9423
- const newValue = (this.max - this.min) * newPosition + this.min;
9266
+ const newPosition = convertPixelToPercent(rawValue, this.orientation === Orientation.vertical ? this.trackMinHeight : this.trackMinWidth, this.orientation === Orientation.vertical ? this.trackHeight : this.trackWidth, this.direction);
9267
+ const newValue = (this.maxAsNumber - this.minAsNumber) * newPosition + this.minAsNumber;
9424
9268
  return this.convertToConstrainedValue(newValue);
9425
9269
  }
9426
9270
  convertToConstrainedValue(value) {
9427
9271
  if (isNaN(value)) {
9428
- value = this.min;
9272
+ value = this.minAsNumber;
9429
9273
  }
9430
- let constrainedValue = value - this.min;
9431
- const roundedConstrainedValue = Math.round(constrainedValue / this.stepValue);
9432
- const remainderValue = constrainedValue - roundedConstrainedValue * (this.stepMultiplier * this.stepValue) / this.stepMultiplier;
9433
- constrainedValue = remainderValue >= Number(this.stepValue) / 2 ? constrainedValue - remainderValue + Number(this.stepValue) : constrainedValue - remainderValue;
9434
- return constrainedValue + this.min;
9274
+ let constrainedValue = value - this.minAsNumber;
9275
+ const roundedConstrainedValue = Math.round(constrainedValue / this.stepAsNumber);
9276
+ const remainderValue = constrainedValue - roundedConstrainedValue * (this.stepMultiplier * this.stepAsNumber) / this.stepMultiplier;
9277
+ constrainedValue = remainderValue >= Number(this.stepAsNumber) / 2 ? constrainedValue - remainderValue + Number(this.stepAsNumber) : constrainedValue - remainderValue;
9278
+ return constrainedValue + this.minAsNumber;
9279
+ }
9280
+ /**
9281
+ * Makes sure the side effects of set up when the disabled state changes.
9282
+ */
9283
+ setDisabledSideEffect(disabled) {
9284
+ if (!this.$fastController.isConnected) {
9285
+ return;
9286
+ }
9287
+ this.elementInternals.ariaDisabled = disabled.toString();
9288
+ this.tabIndex = disabled ? -1 : 0;
9435
9289
  }
9436
9290
  }
9291
+ /**
9292
+ * The form-associated flag.
9293
+ * @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-face-example | Form-associated custom elements}
9294
+ *
9295
+ * @public
9296
+ */
9297
+ Slider.formAssociated = true;
9437
9298
  __decorateClass$6([attr], Slider.prototype, "size", 2);
9438
9299
  __decorateClass$6([attr({
9439
- attribute: "readonly",
9440
- mode: "boolean"
9441
- })], Slider.prototype, "readOnly", 2);
9300
+ attribute: "value",
9301
+ mode: "fromView"
9302
+ })], Slider.prototype, "initialValue", 2);
9442
9303
  __decorateClass$6([observable], Slider.prototype, "direction", 2);
9443
9304
  __decorateClass$6([observable], Slider.prototype, "isDragging", 2);
9444
9305
  __decorateClass$6([observable], Slider.prototype, "position", 2);
@@ -9449,28 +9310,33 @@ __decorateClass$6([observable], Slider.prototype, "trackLeft", 2);
9449
9310
  __decorateClass$6([observable], Slider.prototype, "trackMinHeight", 2);
9450
9311
  __decorateClass$6([observable], Slider.prototype, "valueTextFormatter", 2);
9451
9312
  __decorateClass$6([attr({
9452
- converter: nullableNumberConverter
9313
+ mode: "boolean"
9314
+ })], Slider.prototype, "disabled", 2);
9315
+ __decorateClass$6([attr({
9316
+ converter: numberLikeStringConverter
9453
9317
  })], Slider.prototype, "min", 2);
9454
9318
  __decorateClass$6([attr({
9455
- converter: nullableNumberConverter
9319
+ converter: numberLikeStringConverter
9456
9320
  })], Slider.prototype, "max", 2);
9457
9321
  __decorateClass$6([attr({
9458
- converter: nullableNumberConverter
9322
+ converter: numberLikeStringConverter
9459
9323
  })], Slider.prototype, "step", 2);
9460
9324
  __decorateClass$6([attr], Slider.prototype, "orientation", 2);
9461
9325
  __decorateClass$6([attr], Slider.prototype, "mode", 2);
9462
9326
 
9463
9327
  const styles$8 = css`
9464
- ${display("inline-grid")} :host{--thumb-size:18px;--thumb-padding:3px;--thumb-translate:calc(var(--thumb-size) * -0.5 + var(--track-width) / 2);--track-overhang:-2px;--track-width:4px;--fast-slider-height:calc(var(--thumb-size) * 10);--slider-direction:90deg;align-items:center;box-sizing:border-box;outline:none;cursor:pointer;user-select:none;border-radius:${borderRadiusSmall};touch-action:pan-y;min-width:calc(var(--thumb-size) * 1px);width:100%}:host([size='small']){--thumb-size:14px;--track-width:2px;--thumb-padding:3px}:host([orientation='vertical']){--slider-direction:0deg;height:160px;min-height:var(--thumb-size);touch-action:pan-x;padding:8px 0;width:auto;min-width:auto}:host([disabled]:hover){cursor:initial}:host(:focus-visible){box-shadow:0 0 0 2pt ${colorStrokeFocus2};outline:1px solid ${colorStrokeFocus1}}.thumb-cursor:focus{outline:0}.thumb-container{position:absolute;height:var(--thumb-size);width:var(--thumb-size);transition:all 0.2s ease}.thumb-container{transform:translateX(calc(var(--thumb-size) * 0.5)) translateY(calc(var(--thumb-translate) * -1.5))}:host([size='small']) .thumb-container{transform:translateX(calc(var(--thumb-size) * 0.5)) translateY(calc(var(--thumb-translate) * -1.35))}:host([orientation='vertical']) .thumb-container{transform:translateX(calc(var(--thumb-translate) * -1.5)) translateY(calc(var(--thumb-size) * -0.5))}:host([orientation='vertical'][size='small']) .thumb-container{transform:translateX(calc(var(--thumb-translate) * -1.35)) translateY(calc(var(--thumb-size) * -0.5))}.thumb-cursor{height:var(--thumb-size);width:var(--thumb-size);background-color:${colorBrandBackground};border-radius:${borderRadiusCircular};box-shadow:inset 0 0 0 var(--thumb-padding) ${colorNeutralBackground1},0 0 0 1px ${colorNeutralStroke1}}.thumb-cursor:hover{background-color:${colorCompoundBrandBackgroundHover}}.thumb-cursor:active{background-color:${colorCompoundBrandBackgroundPressed}}:host([disabled]) .thumb-cursor{background-color:${colorNeutralForegroundDisabled};box-shadow:inset 0 0 0 var(--thumb-padding) ${colorNeutralBackground1},0 0 0 1px ${colorNeutralStrokeDisabled}}.positioning-region{position:relative;display:grid}:host([orientation='horizontal']) .positioning-region{margin:0 8px;grid-template-rows:var(--thumb-size) var(--thumb-size)}:host([orientation='vertical']) .positioning-region{margin:8px 0;height:100%;grid-template-columns:var(--thumb-size) var(--thumb-size)}.track{align-self:start;position:absolute;background-color:${colorNeutralStrokeAccessible};border-radius:${borderRadiusMedium};overflow:hidden}:host([step]) .track::after{content:'';position:absolute;border-radius:${borderRadiusMedium};width:100%;inset:0 2px;background-image:repeating-linear-gradient(
9328
+ ${display("inline-grid")}
9329
+
9330
+ :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
9331
  var(--slider-direction),#0000 0%,#0000 calc(var(--step-rate) - 1px),${colorNeutralBackground1} calc(var(--step-rate) - 1px),${colorNeutralBackground1} var(--step-rate)
9466
- )}:host([orientation='vertical'][step]) .track::after{inset:-2px 0}:host([disabled]) .track{background-color:${colorNeutralBackgroundDisabled}}:host([orientation='horizontal']) .track{right:var(--track-overhang);left:var(--track-overhang);align-self:start;height:var(--track-width);grid-row:2 / auto}:host([orientation='vertical']) .track{top:var(--track-overhang);bottom:var(--track-overhang);width:var(--track-width);height:100%;grid-column:2 / auto}.track-start{background-color:${colorCompoundBrandBackground};position:absolute;height:100%;left:0;border-radius:${borderRadiusMedium}}:host([disabled]) .track-start{background-color:${colorNeutralForegroundDisabled}}:host(:hover) .track-start{background-color:${colorCompoundBrandBackgroundHover}}:host([disabled]:hover) .track-start{background-color:${colorNeutralForegroundDisabled}}.track-start:active{background-color:${colorCompoundBrandBackgroundPressed}}:host([orientation='vertical']) .track-start{height:auto;width:100%;bottom:0}`.withBehaviors(forcedColorsStylesheetBehavior(css`
9467
- .track:hover,.track:active,.track{background:WindowText}.thumb-cursor:hover,.thumb-cursor:active,.thumb-cursor{background:ButtonText}:host(:hover) .track-start,.track-start:active,.track-start{background:Highlight}`));
9332
+ )}.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`
9333
+ .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
9334
 
9469
9335
  function sliderTemplate(options = {}) {
9470
- return html`<template role="slider" tabindex="${x => x.disabled ? null : 0}" aria-valuetext="${x => x.valueTextFormatter(x.value)}" aria-valuenow="${x => x.value}" aria-valuemin="${x => x.min}" aria-valuemax="${x => x.max}" aria-disabled="${x => x.disabled ? true : void 0}" aria-readonly="${x => x.readOnly ? true : void 0}" aria-orientation="${x => x.orientation}" class="${x => x.orientation}"><div part="positioning-region" class="positioning-region"><div ${ref("track")} part="track-container" class="track"><slot name="track"></slot><div part="track-start" class="track-start" style="${x => x.position}"><slot name="track-start"></slot></div></div><slot></slot><div ${ref("thumb")} part="thumb-container" class="thumb-container" style="${x => x.position}" @mousedown="${(x, c) => x.handleThumbMouseDown(c.event)}" @touchstart="${(x, c) => x.handleThumbMouseDown(c.event)}"><slot name="thumb">${staticallyCompose(options.thumb)}</slot></div></div></template>`;
9336
+ 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
9337
  }
9472
9338
  const template$8 = sliderTemplate({
9473
- thumb: `<div class="thumb-cursor"></div>`
9339
+ thumb: `<div class="thumb"></div>`
9474
9340
  });
9475
9341
 
9476
9342
  const definition$8 = Slider.compose({