@m3e/chips 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/README.md CHANGED
@@ -27,7 +27,7 @@ Alternately, you can explicitly reference the `html-custom-data.json` and `css-c
27
27
  }
28
28
  ```
29
29
 
30
- ## 🚀 Browser Usage
30
+ ## 🚀 Native Module Support
31
31
 
32
32
  This package uses [JavaScript Modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#module_specifiers). To use it directly in a browser without a bundler, use a module script similar to the following.
33
33
 
@@ -2100,6 +2100,57 @@
2100
2100
  "description": "The selected value(s) of the set.",
2101
2101
  "readonly": true
2102
2102
  },
2103
+ {
2104
+ "kind": "method",
2105
+ "name": "#handleSlotChange",
2106
+ "privacy": "private"
2107
+ },
2108
+ {
2109
+ "kind": "method",
2110
+ "name": "#handleKeyDown",
2111
+ "privacy": "private",
2112
+ "return": {
2113
+ "type": {
2114
+ "text": "void"
2115
+ }
2116
+ },
2117
+ "parameters": [
2118
+ {
2119
+ "name": "e",
2120
+ "type": {
2121
+ "text": "KeyboardEvent"
2122
+ }
2123
+ }
2124
+ ]
2125
+ },
2126
+ {
2127
+ "kind": "method",
2128
+ "name": "#handleChange",
2129
+ "privacy": "private",
2130
+ "return": {
2131
+ "type": {
2132
+ "text": "void"
2133
+ }
2134
+ },
2135
+ "parameters": [
2136
+ {
2137
+ "name": "e",
2138
+ "type": {
2139
+ "text": "Event"
2140
+ }
2141
+ }
2142
+ ]
2143
+ },
2144
+ {
2145
+ "kind": "method",
2146
+ "name": "#updateChipRole",
2147
+ "privacy": "private",
2148
+ "return": {
2149
+ "type": {
2150
+ "text": "void"
2151
+ }
2152
+ }
2153
+ },
2103
2154
  {
2104
2155
  "kind": "field",
2105
2156
  "name": "formAssociated",
@@ -2138,20 +2189,6 @@
2138
2189
  "module": "../core/src/shared/mixins/FormAssociated.ts"
2139
2190
  }
2140
2191
  },
2141
- {
2142
- "kind": "method",
2143
- "name": "[_updateLabels]",
2144
- "privacy": "private",
2145
- "return": {
2146
- "type": {
2147
- "text": "void"
2148
- }
2149
- },
2150
- "inheritedFrom": {
2151
- "name": "Labelled",
2152
- "module": "../core/src/shared/mixins/Labelled.ts"
2153
- }
2154
- },
2155
2192
  {
2156
2193
  "kind": "field",
2157
2194
  "name": "dirty",
@@ -6738,6 +6775,11 @@
6738
6775
  "kind": "javascript-module",
6739
6776
  "path": "../core/src/shared/mixins/Labelled.ts",
6740
6777
  "declarations": [
6778
+ {
6779
+ "kind": "variable",
6780
+ "name": "updateLabels",
6781
+ "description": "A symbol through which to update labels to reflect a control's current state."
6782
+ },
6741
6783
  {
6742
6784
  "kind": "function",
6743
6785
  "name": "isLabelledMixin",
@@ -6787,16 +6829,6 @@
6787
6829
  },
6788
6830
  "description": "The label elements that the element is associated with.",
6789
6831
  "readonly": true
6790
- },
6791
- {
6792
- "kind": "method",
6793
- "name": "[_updateLabels]",
6794
- "privacy": "private",
6795
- "return": {
6796
- "type": {
6797
- "text": "void"
6798
- }
6799
- }
6800
6832
  }
6801
6833
  ],
6802
6834
  "parameters": [
@@ -6811,6 +6843,14 @@
6811
6843
  }
6812
6844
  ],
6813
6845
  "exports": [
6846
+ {
6847
+ "kind": "js",
6848
+ "name": "updateLabels",
6849
+ "declaration": {
6850
+ "name": "updateLabels",
6851
+ "module": "../core/src/shared/mixins/Labelled.ts"
6852
+ }
6853
+ },
6814
6854
  {
6815
6855
  "kind": "js",
6816
6856
  "name": "isLabelledMixin",
package/dist/index.js CHANGED
@@ -623,7 +623,7 @@ var _M3eFilterChipElement_instances, _M3eFilterChipElement_clickHandler, _M3eFil
623
623
  * @cssprop --m3e-chip-unselected-leading-icon-color - Leading icon color in unselected state.
624
624
  * @cssprop --m3e-chip-unselected-trailing-icon-color - Trailing icon color in unselected state.
625
625
  */
626
- let M3eFilterChipElement = class M3eFilterChipElement extends Selected(KeyboardClick(Focusable(DisabledInteractive(Disabled(AttachInternals(Role(M3eChipElement, "option"), true)))))) {
626
+ let M3eFilterChipElement = class M3eFilterChipElement extends Selected(KeyboardClick(Focusable(DisabledInteractive(Disabled(AttachInternals(Role(M3eChipElement, "radio"), true)))))) {
627
627
  constructor() {
628
628
  super(...arguments);
629
629
  _M3eFilterChipElement_instances.add(this);
@@ -783,7 +783,7 @@ M3eFilterChipElement = __decorate([
783
783
  t$2("m3e-filter-chip")
784
784
  ], M3eFilterChipElement);
785
785
 
786
- var _M3eFilterChipSetElement_instances, _M3eFilterChipSetElement_handleSlotChange, _M3eFilterChipSetElement_handleKeyDown, _M3eFilterChipSetElement_handleChange, _a;
786
+ var _M3eFilterChipSetElement_instances, _M3eFilterChipSetElement_handleSlotChange, _M3eFilterChipSetElement_handleKeyDown, _M3eFilterChipSetElement_handleChange, _M3eFilterChipSetElement_updateChipRole, _a;
787
787
  /**
788
788
  * A container that organizes filter chips into a cohesive group, enabling selection and
789
789
  * deselection of values used to refine content or trigger contextual behavior.
@@ -821,7 +821,7 @@ var _M3eFilterChipSetElement_instances, _M3eFilterChipSetElement_handleSlotChang
821
821
  *
822
822
  * @cssprop --m3e-chip-set-spacing - The spacing (gap) between chips in the set.
823
823
  */
824
- let M3eFilterChipSetElement = class M3eFilterChipSetElement extends Labelled(Dirty(Touched(FormAssociated(Disabled(AttachInternals(Role(M3eChipSetElement, "listbox"))))))) {
824
+ let M3eFilterChipSetElement = class M3eFilterChipSetElement extends Labelled(Dirty(Touched(FormAssociated(Disabled(AttachInternals(Role(M3eChipSetElement, "radiogroup"))))))) {
825
825
  constructor() {
826
826
  super(...arguments);
827
827
  _M3eFilterChipSetElement_instances.add(this);
@@ -882,10 +882,15 @@ let M3eFilterChipSetElement = class M3eFilterChipSetElement extends Labelled(Dir
882
882
  this[selectionManager].disabled = this.disabled;
883
883
  }
884
884
  if (changedProperties.has("multi")) {
885
- this.ariaMultiSelectable = `${this.multi}`;
885
+ this.role = this.multi ? "group" : "radiogroup";
886
+ __classPrivateFieldGet(this, _M3eFilterChipSetElement_instances, "m", _M3eFilterChipSetElement_updateChipRole).call(this);
886
887
  this[selectionManager].multi = this.multi;
887
888
  this[selectionManager].disableRovingTabIndex(this.multi);
888
889
  }
890
+ if (changedProperties.has("multi") || changedProperties.has("disabled")) {
891
+ // aria-disabled is not supported on radiogroup roles.
892
+ this.ariaDisabled = this.multi && this.disabled ? "true" : null;
893
+ }
889
894
  if (changedProperties.has("hideSelectionIndicator")) {
890
895
  this.chips.forEach((x) => x.classList.toggle("-hide-selection", this.hideSelectionIndicator));
891
896
  }
@@ -902,6 +907,7 @@ let M3eFilterChipSetElement = class M3eFilterChipSetElement extends Labelled(Dir
902
907
  _M3eFilterChipSetElement_handleSlotChange = function _M3eFilterChipSetElement_handleSlotChange() {
903
908
  const { added } = this[selectionManager].setItems([...this.querySelectorAll("m3e-filter-chip")]);
904
909
  added.forEach((x) => x.classList.toggle("-hide-selection", this.hideSelectionIndicator));
910
+ __classPrivateFieldGet(this, _M3eFilterChipSetElement_instances, "m", _M3eFilterChipSetElement_updateChipRole).call(this);
905
911
  };
906
912
  _M3eFilterChipSetElement_handleKeyDown = function _M3eFilterChipSetElement_handleKeyDown(e) {
907
913
  if (!this.multi) {
@@ -912,6 +918,9 @@ _M3eFilterChipSetElement_handleChange = function _M3eFilterChipSetElement_handle
912
918
  e.stopPropagation();
913
919
  this.dispatchEvent(new Event("change", { bubbles: true }));
914
920
  };
921
+ _M3eFilterChipSetElement_updateChipRole = function _M3eFilterChipSetElement_updateChipRole() {
922
+ this.chips.forEach((x) => (x.role = this.multi ? "button" : "radio"));
923
+ };
915
924
  __decorate([
916
925
  n$1({ type: Boolean })
917
926
  ], M3eFilterChipSetElement.prototype, "multi", void 0);