@descope/web-components-ui 1.0.260 → 1.0.262

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.
@@ -1020,6 +1020,7 @@ const createProxy = ({
1020
1020
  excludeAttrsSync = [],
1021
1021
  includeAttrsSync = [],
1022
1022
  includeForwardProps = [],
1023
+ delegatesFocus = true,
1023
1024
  }) => {
1024
1025
  class ProxyClass extends createBaseClass({ componentName, baseSelector: wrappedEleName }) {
1025
1026
  #dispatchBlur = createDispatchEvent.bind(this, 'blur');
@@ -1027,7 +1028,7 @@ const createProxy = ({
1027
1028
  #dispatchFocus = createDispatchEvent.bind(this, 'focus');
1028
1029
 
1029
1030
  constructor() {
1030
- super().attachShadow({ mode: 'open', delegatesFocus: true }).innerHTML = `
1031
+ super().attachShadow({ mode: 'open', delegatesFocus }).innerHTML = `
1031
1032
  <style id="create-proxy">${isFunction(style) ? style() : style}</style>
1032
1033
  <${wrappedEleName}>
1033
1034
  ${slots
@@ -8769,6 +8770,7 @@ const GridClass = compose(
8769
8770
  GridMixin
8770
8771
  )(
8771
8772
  createProxy({
8773
+ delegatesFocus: false,
8772
8774
  slots: [''],
8773
8775
  wrappedEleName: 'vaadin-grid',
8774
8776
  style: () => `
@@ -9141,17 +9143,26 @@ const multiSelectComboBoxMixin = (superclass) =>
9141
9143
  });
9142
9144
  }
9143
9145
 
9146
+ // To prevent duplicate items for the multi select options, we dedup them based on the "data-id" attribute
9147
+ // eslint-disable-next-line class-methods-use-this
9148
+ #dedupItems(items) {
9149
+ return Array.from(
9150
+ new Map(items.map((item) => [item.getAttribute('data-id'), item])).values()
9151
+ );
9152
+ }
9153
+
9144
9154
  // vaadin api is to set props on their combo box node,
9145
9155
  // in order to avoid it, we are passing the children of this component
9146
9156
  // to the items & renderer props, so it will be used as the combo box items
9147
9157
  #onChildrenChange() {
9148
9158
  const items = Array.from(this.children);
9159
+ const dedupItems = this.#dedupItems(items);
9149
9160
 
9150
9161
  // we want the data-name attribute to be accessible as an object attribute
9151
9162
  if (items.length) {
9152
9163
  this.removeAttribute('has-no-options');
9153
9164
 
9154
- items.forEach((node) => {
9165
+ dedupItems.forEach((node) => {
9155
9166
  Object.defineProperty(node, 'data-name', {
9156
9167
  value: node.getAttribute('data-name'),
9157
9168
  configurable: true,
@@ -9164,7 +9175,7 @@ const multiSelectComboBoxMixin = (superclass) =>
9164
9175
  });
9165
9176
  });
9166
9177
 
9167
- this.baseElement.items = items;
9178
+ this.baseElement.items = dedupItems;
9168
9179
 
9169
9180
  setTimeout(() => {
9170
9181
  // set timeout to ensure this runs after customValueTransformFn had the chance to be overriden