@m3e/core 1.0.0-rc.3 → 1.0.0-rc.4
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/dist/a11y.js.map +1 -1
- package/dist/a11y.min.js.map +1 -1
- package/dist/custom-elements.json +253 -250
- package/dist/index.js +23 -11
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/src/shared/mixins/ConstraintValidation.d.ts.map +1 -1
- package/dist/src/shared/mixins/Labelled.d.ts +4 -0
- package/dist/src/shared/mixins/Labelled.d.ts.map +1 -1
- package/dist/src/shared/mixins/Selected.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -984,10 +984,17 @@ function Selected(base) {
|
|
|
984
984
|
if (this.role === "button") {
|
|
985
985
|
this.ariaPressed = `${this.selected}`;
|
|
986
986
|
this.ariaSelected = null;
|
|
987
|
+
this.ariaChecked = null;
|
|
988
|
+
}
|
|
989
|
+
else if (this.role === "radio") {
|
|
990
|
+
this.ariaChecked = `${this.selected}`;
|
|
991
|
+
this.ariaSelected = null;
|
|
992
|
+
this.ariaPressed = null;
|
|
987
993
|
}
|
|
988
994
|
else if (this.role && this.role !== "none" && this.role !== "presentation") {
|
|
989
995
|
this.ariaSelected = `${this.selected}`;
|
|
990
996
|
this.ariaPressed = null;
|
|
997
|
+
this.ariaChecked = null;
|
|
991
998
|
}
|
|
992
999
|
}
|
|
993
1000
|
}
|
|
@@ -1118,12 +1125,12 @@ function Touched(base) {
|
|
|
1118
1125
|
connectedCallback() {
|
|
1119
1126
|
this.markAsUntouched();
|
|
1120
1127
|
super.connectedCallback();
|
|
1121
|
-
this.addEventListener("focusout", this[_eventHandler$1]);
|
|
1128
|
+
this.addEventListener("focusout", this[_eventHandler$1], { capture: true });
|
|
1122
1129
|
}
|
|
1123
1130
|
/** @inheritdoc */
|
|
1124
1131
|
disconnectedCallback() {
|
|
1125
1132
|
super.disconnectedCallback();
|
|
1126
|
-
this.removeEventListener("focusout", this[_eventHandler$1]);
|
|
1133
|
+
this.removeEventListener("focusout", this[_eventHandler$1], { capture: true });
|
|
1127
1134
|
}
|
|
1128
1135
|
/** Marks the element as touched. */
|
|
1129
1136
|
markAsTouched() {
|
|
@@ -1875,6 +1882,8 @@ function DisabledInteractive(base) {
|
|
|
1875
1882
|
return _DisabledInteractiveMixin;
|
|
1876
1883
|
}
|
|
1877
1884
|
|
|
1885
|
+
/** A symbol through which to update labels to reflect a control's current state. */
|
|
1886
|
+
const updateLabels = Symbol("updateLabels");
|
|
1878
1887
|
/**
|
|
1879
1888
|
* Determines whether a value is a `LabelledMixin`.
|
|
1880
1889
|
* @param {unknown} value The value to test.
|
|
@@ -1883,7 +1892,6 @@ function DisabledInteractive(base) {
|
|
|
1883
1892
|
function isLabelledMixin(value) {
|
|
1884
1893
|
return hasKeys(value, "labels") && isAttachInternalsMixin(value);
|
|
1885
1894
|
}
|
|
1886
|
-
const _updateLabels = Symbol("_updateLabels");
|
|
1887
1895
|
const _eventHandler = Symbol("_eventHandler");
|
|
1888
1896
|
/**
|
|
1889
1897
|
* Mixin to augment an element with support for labelling.
|
|
@@ -1899,7 +1907,7 @@ function Labelled(base) {
|
|
|
1899
1907
|
/** @private */
|
|
1900
1908
|
this[_a] = (e) => {
|
|
1901
1909
|
if (!e.defaultPrevented) {
|
|
1902
|
-
this[
|
|
1910
|
+
this[updateLabels]();
|
|
1903
1911
|
}
|
|
1904
1912
|
};
|
|
1905
1913
|
}
|
|
@@ -1922,18 +1930,19 @@ function Labelled(base) {
|
|
|
1922
1930
|
/** @inheritdoc */
|
|
1923
1931
|
update(changedProperties) {
|
|
1924
1932
|
super.update(changedProperties);
|
|
1925
|
-
this[
|
|
1933
|
+
this[updateLabels]();
|
|
1926
1934
|
}
|
|
1927
|
-
/** @
|
|
1928
|
-
[(_a = _eventHandler,
|
|
1935
|
+
/** @internal */
|
|
1936
|
+
[(_a = _eventHandler, updateLabels)]() {
|
|
1929
1937
|
const focusable = this.hasAttribute("tabindex");
|
|
1930
1938
|
const disabled = (isDisabledMixin(this) && this.disabled) || (isDisabledInteractiveMixin(this) && this.disabledInteractive);
|
|
1931
|
-
|
|
1939
|
+
const invalid = isTouchedMixin(this) && this.touched && (this.ariaInvalid || this.classList.contains("-invalid"));
|
|
1940
|
+
for (const label of this.labels ?? []) {
|
|
1932
1941
|
label.style.userSelect = focusable ? "none" : "";
|
|
1933
|
-
label.style.cursor = !disabled ? "pointer" : "";
|
|
1942
|
+
label.style.cursor = !disabled && focusable ? "pointer" : "";
|
|
1934
1943
|
label.style.color = disabled
|
|
1935
1944
|
? `color-mix(in srgb, ${DesignToken.color.onSurface} 38%, transparent)`
|
|
1936
|
-
:
|
|
1945
|
+
: invalid
|
|
1937
1946
|
? `${DesignToken.color.error}`
|
|
1938
1947
|
: "";
|
|
1939
1948
|
}
|
|
@@ -2170,6 +2179,9 @@ function ConstraintValidation(base) {
|
|
|
2170
2179
|
this[internals].setValidity(validity, validityMessage);
|
|
2171
2180
|
this.ariaInvalid = invalid ? "true" : null;
|
|
2172
2181
|
this.classList.toggle("-invalid", invalid === true);
|
|
2182
|
+
if (isLabelledMixin(this)) {
|
|
2183
|
+
this[updateLabels]?.();
|
|
2184
|
+
}
|
|
2173
2185
|
}
|
|
2174
2186
|
}
|
|
2175
2187
|
__ConstraintValidation_getNativeMessage = function __ConstraintValidation_getNativeMessage(flags) {
|
|
@@ -4722,5 +4734,5 @@ M3eTextHighlightElement = M3eTextHighlightElement_1 = __decorate([
|
|
|
4722
4734
|
t$2("m3e-text-highlight")
|
|
4723
4735
|
], M3eTextHighlightElement);
|
|
4724
4736
|
|
|
4725
|
-
export { AttachInternals, Checked, CheckedIndeterminate, ConstraintValidation, DesignToken, Dirty, Disabled, DisabledInteractive, EventAttribute, FocusController, Focusable, FormAssociated, FormSubmitter, HoverController, HtmlFor, IntersectionController, KeyboardClick, Labelled, LinkButton, LongPressController, M3eCollapsibleElement, M3eElevationElement, M3eFocusRingElement, M3ePseudoCheckboxElement, M3ePseudoRadioElement, M3eRippleElement, M3eScrollContainerElement, M3eSlide, M3eStateLayerElement, M3eTextHighlightElement, M3eTextOverflowElement, MutationController, PressedController, ReadOnly, Required, RequiredConstraintValidation, ResizeController, Role, ScrollController, Selected, Touched, Vertical, checkOrSelect, debounce, defaultValue, formValue, getTextContent, guid, hasAssignedNodes, hasKeys, internals, isAttachInternalsMixin, isCheckedIndeterminateMixin, isCheckedMixin, isCheckedOrSelected, isCheckedOrSelectedMixin, isConstraintValidationMixin, isDirtyMixin, isDisabledInteractiveMixin, isDisabledMixin, isFormAssociatedMixin, isFormSubmitterMixin, isHtmlForMixin, isLabelledMixin, isLinkButtonMixin, isReadOnlyMixin, isRequiredConstraintValidationMixin, isRequiredMixin, isSelectedMixin, isTouchedMixin, isVerticalMixin, prefersReducedMotion, renderPseudoLink, safeStyleMap, scrollIntoViewIfNeeded, validate };
|
|
4737
|
+
export { AttachInternals, Checked, CheckedIndeterminate, ConstraintValidation, DesignToken, Dirty, Disabled, DisabledInteractive, EventAttribute, FocusController, Focusable, FormAssociated, FormSubmitter, HoverController, HtmlFor, IntersectionController, KeyboardClick, Labelled, LinkButton, LongPressController, M3eCollapsibleElement, M3eElevationElement, M3eFocusRingElement, M3ePseudoCheckboxElement, M3ePseudoRadioElement, M3eRippleElement, M3eScrollContainerElement, M3eSlide, M3eStateLayerElement, M3eTextHighlightElement, M3eTextOverflowElement, MutationController, PressedController, ReadOnly, Required, RequiredConstraintValidation, ResizeController, Role, ScrollController, Selected, Touched, Vertical, checkOrSelect, debounce, defaultValue, formValue, getTextContent, guid, hasAssignedNodes, hasKeys, internals, isAttachInternalsMixin, isCheckedIndeterminateMixin, isCheckedMixin, isCheckedOrSelected, isCheckedOrSelectedMixin, isConstraintValidationMixin, isDirtyMixin, isDisabledInteractiveMixin, isDisabledMixin, isFormAssociatedMixin, isFormSubmitterMixin, isHtmlForMixin, isLabelledMixin, isLinkButtonMixin, isReadOnlyMixin, isRequiredConstraintValidationMixin, isRequiredMixin, isSelectedMixin, isTouchedMixin, isVerticalMixin, prefersReducedMotion, renderPseudoLink, safeStyleMap, scrollIntoViewIfNeeded, updateLabels, validate };
|
|
4726
4738
|
//# sourceMappingURL=index.js.map
|