@descope/web-components-ui 1.0.188 → 1.0.190

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.esm.js CHANGED
@@ -4058,6 +4058,7 @@ const ComboBoxClass = compose(
4058
4058
  overlayFontSize: { property: () => ComboBoxClass.cssVarList.overlay.fontSize },
4059
4059
  overlayFontFamily: { property: () => ComboBoxClass.cssVarList.overlay.fontFamily },
4060
4060
  overlayCursor: { property: () => ComboBoxClass.cssVarList.overlay.cursor },
4061
+ overlayItemBoxShadow: { property: () => ComboBoxClass.cssVarList.overlay.itemBoxShadow },
4061
4062
  },
4062
4063
  }),
4063
4064
  draggableMixin,
@@ -4071,6 +4072,7 @@ const ComboBoxClass = compose(
4071
4072
  cursor: { selector: 'vaadin-combo-box-item' },
4072
4073
  fontFamily: { selector: 'vaadin-combo-box-item' },
4073
4074
  fontSize: { selector: 'vaadin-combo-box-item' },
4075
+ itemBoxShadow: { selector: 'vaadin-combo-box-item', property: 'box-shadow' },
4074
4076
  },
4075
4077
  forward: {
4076
4078
  include: false,
@@ -6945,6 +6947,64 @@ const componentName$2 = getComponentName('button-selection-group');
6945
6947
 
6946
6948
  const customMixin = (superclass) =>
6947
6949
  class ButtonSelectionGroupMixinClass extends superclass {
6950
+ // eslint-disable-next-line class-methods-use-this
6951
+ #renderItem = ({ value, label }) =>
6952
+ `<descope-button-selection-group-item value="${value}">${label}</descope-button-selection-group-item>`;
6953
+
6954
+ #data;
6955
+
6956
+ get renderItem() {
6957
+ return this.#renderItem;
6958
+ }
6959
+
6960
+ set renderItem(renderFn) {
6961
+ this.#renderItem = renderFn;
6962
+ this.renderItems();
6963
+ }
6964
+
6965
+ get data() {
6966
+ if (this.#data) return this.#data;
6967
+
6968
+ try {
6969
+ const data = JSON.parse(this.getAttribute('data'));
6970
+ if (this.isValidDataType(data)) {
6971
+ return data;
6972
+ }
6973
+ } catch (e) {
6974
+ // eslint-disable-next-line no-console
6975
+ console.error('could not parse data string from attribute "data" - ', e.message);
6976
+ }
6977
+
6978
+ return [];
6979
+ }
6980
+
6981
+ set data(data) {
6982
+ if (this.isValidDataType(data)) {
6983
+ this.#data = data;
6984
+ this.renderItems();
6985
+ }
6986
+ }
6987
+
6988
+ // eslint-disable-next-line class-methods-use-this
6989
+ isValidDataType(data) {
6990
+ const isValid = Array.isArray(data);
6991
+ if (!isValid) {
6992
+ // eslint-disable-next-line no-console
6993
+ console.error('data must be an array, received:', data);
6994
+ }
6995
+
6996
+ return isValid;
6997
+ }
6998
+
6999
+ getItemsTemplate() {
7000
+ return this.data?.reduce?.((acc, item) => acc + (this.renderItem?.(item || {}) || ''), '');
7001
+ }
7002
+
7003
+ renderItems() {
7004
+ const template = this.getItemsTemplate();
7005
+ if (template) this.innerHTML = this.getItemsTemplate();
7006
+ }
7007
+
6948
7008
  init() {
6949
7009
  super.init?.();
6950
7010
  const template = document.createElement('template');
@@ -6964,6 +7024,10 @@ const customMixin = (superclass) =>
6964
7024
  this.inputElement = this.shadowRoot.querySelector(componentName$3);
6965
7025
 
6966
7026
  forwardAttrs(this, this.inputElement, { includeAttrs: ['size', 'default-value'] });
7027
+
7028
+ this.renderItems();
7029
+
7030
+ observeAttributes(this, this.renderItems.bind(this), { includeAttrs: ['data'] });
6967
7031
  }
6968
7032
  };
6969
7033
 
@@ -8432,6 +8496,7 @@ const comboBox = {
8432
8496
  [vars$8.overlayFontSize]: refs.fontSize,
8433
8497
  [vars$8.overlayFontFamily]: refs.fontFamily,
8434
8498
  [vars$8.overlayCursor]: 'pointer',
8499
+ [vars$8.overlayItemBoxShadow]: 'none',
8435
8500
 
8436
8501
  // Overlay direct theme:
8437
8502
  [vars$8.overlay.minHeight]: '400px',