@descope/web-components-ui 1.0.256 → 1.0.258

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.esm.js CHANGED
@@ -1306,6 +1306,7 @@ const resetStyles = `
1306
1306
  box-shadow: none;
1307
1307
  }
1308
1308
  vaadin-button::part(label) {
1309
+ justify-content: center;
1309
1310
  padding: 0;
1310
1311
  width: 100%;
1311
1312
  }
@@ -1359,7 +1360,7 @@ const ButtonClass = compose(
1359
1360
  labelTextColor: { property: 'color' },
1360
1361
  labelTextDecoration: { ...label$a, property: 'text-decoration' },
1361
1362
  labelSpacing: { ...label$a, property: 'gap' },
1362
- textAlign: { ...label$a, property: 'justify-content' },
1363
+ textAlign: { ...label$a, property: 'justify-content', important: true },
1363
1364
  },
1364
1365
  }),
1365
1366
  clickableMixin,
@@ -7535,7 +7536,7 @@ const multiSelectComboBoxMixin = (superclass) =>
7535
7536
  }
7536
7537
  }
7537
7538
 
7538
- get allowCustomValue() {
7539
+ get allowCustomValues() {
7539
7540
  return this.getAttribute('allow-custom-value') === 'true';
7540
7541
  }
7541
7542
 
@@ -7674,7 +7675,7 @@ const multiSelectComboBoxMixin = (superclass) =>
7674
7675
  }
7675
7676
 
7676
7677
  #handleCustomValues() {
7677
- if (this.allowCustomValue) {
7678
+ if (this.allowCustomValues) {
7678
7679
  this.baseElement.addEventListener('custom-value-set', (e) => {
7679
7680
  const newItemHtml = this.#renderItem({
7680
7681
  label: e.detail,
@@ -7782,6 +7783,33 @@ const multiSelectComboBoxMixin = (superclass) =>
7782
7783
  const selectedChildren = this.baseElement.items?.filter((item) =>
7783
7784
  vals.includes(item['data-id'])
7784
7785
  );
7786
+
7787
+ // If the component allows custom values, we need to add the values that are not present in the children
7788
+ if (this.allowCustomValues) {
7789
+ const existingValues =
7790
+ selectedChildren?.map((child) => child.getAttribute('data-id')) || [];
7791
+ const missingValues = vals.filter((val) => !existingValues.includes(val));
7792
+
7793
+ if (missingValues.length) {
7794
+ const newItemsHtml = missingValues.reduce((acc, val) => {
7795
+ const newItemHtml = this.#renderItem({
7796
+ label: val,
7797
+ displayName: val,
7798
+ value: val,
7799
+ });
7800
+ return acc + newItemHtml;
7801
+ }, '');
7802
+ this.innerHTML += newItemsHtml;
7803
+
7804
+ // The value needs to be set with a timeout because it needs to execute after
7805
+ // the custom values are added to the items by the children change observer
7806
+ setTimeout(() => {
7807
+ this.value = vals;
7808
+ }, 0);
7809
+ return;
7810
+ }
7811
+ }
7812
+
7785
7813
  const newSelectedValues =
7786
7814
  selectedChildren?.map((child) => child.getAttribute('data-id')) || [];
7787
7815
  if (!compareArraysUnordered(this.#value, newSelectedValues)) {