@descope/web-components-ui 1.0.247 → 1.0.249

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.esm.js CHANGED
@@ -11,6 +11,7 @@ import '@vaadin/grid';
11
11
  import { GridSortColumn } from '@vaadin/grid/vaadin-grid-sort-column';
12
12
  import { GridSelectionColumn } from '@vaadin/grid/vaadin-grid-selection-column';
13
13
  import '@vaadin/multi-select-combo-box';
14
+ import '@vaadin/dialog';
14
15
  import merge from 'lodash.merge';
15
16
  import set from 'lodash.set';
16
17
  import Color from 'color';
@@ -566,6 +567,7 @@ const booleanAttributesList = [
566
567
  'password-visible',
567
568
  'opening',
568
569
  'closing',
570
+ 'has-no-options',
569
571
  ];
570
572
 
571
573
  const isBooleanAttribute = (attr) => {
@@ -6921,6 +6923,8 @@ class ButtonMultiSelectionGroupInternalClass extends createBaseButtonSelectionGr
6921
6923
  this.items.forEach((item) => {
6922
6924
  if (values.includes(item.value)) {
6923
6925
  item.setAttribute('selected', 'true');
6926
+ } else {
6927
+ item.removeAttribute('selected');
6924
6928
  }
6925
6929
  });
6926
6930
  }
@@ -7965,6 +7969,111 @@ const BadgeClass = compose(
7965
7969
 
7966
7970
  customElements.define(componentName$3, BadgeClass);
7967
7971
 
7972
+ const componentName$2 = getComponentName('modal');
7973
+
7974
+ const customMixin = (superclass) =>
7975
+ class ModalMixinClass extends superclass {
7976
+ get opened() {
7977
+ return this.getAttribute('opened') === 'true';
7978
+ }
7979
+
7980
+ handleOpened() {
7981
+ forwardAttrs(this, this.baseElement, { includeAttrs: ['opened'] });
7982
+ if (this.opened) {
7983
+ this.style.display = '';
7984
+ } else {
7985
+ this.style.display = 'none';
7986
+ }
7987
+ }
7988
+
7989
+ init() {
7990
+ super.init?.();
7991
+ this.style.display = 'none';
7992
+
7993
+ // vaadin-dialog might not be loaded in time
7994
+ // in order to make sure it's loaded before this block is running
7995
+ // we are wrapping it with setTimeout
7996
+ setTimeout(() => {
7997
+ // we want to sync descope-modal content through vaadin-dialog into the overlay
7998
+ // so we are adding a slot to the overlay, which allows us to forward the content from
7999
+ // vaadin-dialog to vaadin-dialog-overlay
8000
+ this.baseElement.shadowRoot
8001
+ .querySelector('vaadin-dialog-overlay')
8002
+ .appendChild(document.createElement('slot'));
8003
+
8004
+ this.#overrideOverlaySettings();
8005
+
8006
+ // we need to always open the modal in `opened=false`
8007
+ // to prevent it from rendering outside the dialog
8008
+ // first, we have to run `overrideOverlaySettings` to setup
8009
+ // the component.
8010
+ this.handleOpened();
8011
+ });
8012
+ }
8013
+
8014
+ // the default vaadin behavior is to attach the overlay to the body when opened
8015
+ // we do not want that because it's difficult to style the overlay in this way
8016
+ // so we override it to open inside the shadow DOM
8017
+ #overrideOverlaySettings() {
8018
+ const overlay = this.baseElement.shadowRoot.querySelector('vaadin-dialog-overlay');
8019
+
8020
+ overlay._attachOverlay = () => {
8021
+ overlay.bringToFront();
8022
+ this.baseElement.setAttribute('style', 'display:flex!important;');
8023
+ };
8024
+ overlay._detachOverlay = () => {
8025
+ this.baseElement.style.display = 'none';
8026
+ };
8027
+ overlay._enterModalState = () => {};
8028
+
8029
+ overlay.close = () => false;
8030
+ }
8031
+ };
8032
+
8033
+ const ModalClass = compose(
8034
+ createStyleMixin({
8035
+ mappings: {
8036
+ overlayBackgroundColor: { property: () => ModalClass.cssVarList.overlay.backgroundColor },
8037
+ overlayShadow: { property: () => ModalClass.cssVarList.overlay.shadow },
8038
+ overlayWidth: { property: () => ModalClass.cssVarList.overlay.width },
8039
+ },
8040
+ }),
8041
+ portalMixin({
8042
+ name: 'overlay',
8043
+ selector: '',
8044
+ mappings: {
8045
+ hostDisplay: {
8046
+ selector: () => ':host(.descope-modal)',
8047
+ property: 'display',
8048
+ important: true,
8049
+ },
8050
+ backgroundColor: [
8051
+ { selector: () => '::part(content)', property: 'background-color' },
8052
+ { selector: () => '::part(overlay)', property: 'background-color' },
8053
+ ],
8054
+ width: { selector: () => '::part(overlay)', property: 'width' },
8055
+ shadow: { selector: () => '::part(overlay)', property: 'box-shadow' },
8056
+ },
8057
+ forward: {
8058
+ include: false,
8059
+ attributes: ['opened'],
8060
+ },
8061
+ }),
8062
+ draggableMixin,
8063
+ componentNameValidationMixin,
8064
+ customMixin
8065
+ )(
8066
+ createProxy({
8067
+ slots: [''],
8068
+ wrappedEleName: 'vaadin-dialog',
8069
+ style: () => ``,
8070
+ excludeAttrsSync: ['tabindex', 'opened'],
8071
+ componentName: componentName$2,
8072
+ })
8073
+ );
8074
+
8075
+ customElements.define(componentName$2, ModalClass);
8076
+
7968
8077
  const getVarName = (path) => getCssVarName(DESCOPE_PREFIX, ...path);
7969
8078
 
7970
8079
  const transformTheme = (theme, path, getTransformation) => {
@@ -8416,7 +8525,7 @@ var button$1 = /*#__PURE__*/Object.freeze({
8416
8525
  vars: vars$w
8417
8526
  });
8418
8527
 
8419
- const componentName$2 = getComponentName('input-wrapper');
8528
+ const componentName$1 = getComponentName('input-wrapper');
8420
8529
  const globalRefs$h = getThemeRefs(globals);
8421
8530
 
8422
8531
  const [theme$1, refs, vars$v] = createHelperVars(
@@ -8485,7 +8594,7 @@ const [theme$1, refs, vars$v] = createHelperVars(
8485
8594
  backgroundColor: globalRefs$h.colors.surface.main,
8486
8595
  },
8487
8596
  },
8488
- componentName$2
8597
+ componentName$1
8489
8598
  );
8490
8599
 
8491
8600
  var inputWrapper = /*#__PURE__*/Object.freeze({
@@ -9528,109 +9637,6 @@ var buttonMultiSelectionGroup$1 = /*#__PURE__*/Object.freeze({
9528
9637
  vars: vars$6
9529
9638
  });
9530
9639
 
9531
- const componentName$1 = getComponentName('modal');
9532
-
9533
- const customMixin = (superclass) =>
9534
- class ModalMixinClass extends superclass {
9535
- get opened() {
9536
- return this.getAttribute('opened') === 'true';
9537
- }
9538
-
9539
- handleOpened() {
9540
- forwardAttrs(this, this.baseElement, { includeAttrs: ['opened'] });
9541
- if (this.opened) {
9542
- this.style.display = '';
9543
- } else {
9544
- this.style.display = 'none';
9545
- }
9546
- }
9547
-
9548
- init() {
9549
- super.init?.();
9550
- this.style.display = 'none';
9551
-
9552
- // vaadin-dialog might not be loaded in time
9553
- // in order to make sure it's loaded before this block is running
9554
- // we are wrapping it with setTimeout
9555
- setTimeout(() => {
9556
- // we want to sync descope-modal content through vaadin-dialog into the overlay
9557
- // so we are adding a slot to the overlay, which allows us to forward the content from
9558
- // vaadin-dialog to vaadin-dialog-overlay
9559
- this.baseElement.shadowRoot
9560
- .querySelector('vaadin-dialog-overlay')
9561
- .appendChild(document.createElement('slot'));
9562
-
9563
- this.#overrideOverlaySettings();
9564
-
9565
- // we need to always open the modal in `opened=false`
9566
- // to prevent it from rendering outside the dialog
9567
- // first, we have to run `overrideOverlaySettings` to setup
9568
- // the component.
9569
- this.handleOpened();
9570
- });
9571
- }
9572
-
9573
- // the default vaadin behavior is to attach the overlay to the body when opened
9574
- // we do not want that because it's difficult to style the overlay in this way
9575
- // so we override it to open inside the shadow DOM
9576
- #overrideOverlaySettings() {
9577
- const overlay = this.baseElement.shadowRoot.querySelector('vaadin-dialog-overlay');
9578
-
9579
- overlay._attachOverlay = () => {
9580
- overlay.bringToFront();
9581
- this.baseElement.setAttribute('style', 'display:flex!important;');
9582
- };
9583
- overlay._detachOverlay = () => {
9584
- this.baseElement.style.display = 'none';
9585
- };
9586
- overlay._enterModalState = () => {};
9587
-
9588
- overlay.close = () => false;
9589
- }
9590
- };
9591
-
9592
- const ModalClass = compose(
9593
- createStyleMixin({
9594
- mappings: {
9595
- overlayBackgroundColor: { property: () => ModalClass.cssVarList.overlay.backgroundColor },
9596
- overlayShadow: { property: () => ModalClass.cssVarList.overlay.shadow },
9597
- overlayWidth: { property: () => ModalClass.cssVarList.overlay.width },
9598
- },
9599
- }),
9600
- portalMixin({
9601
- name: 'overlay',
9602
- selector: '',
9603
- mappings: {
9604
- hostDisplay: {
9605
- selector: () => ':host(.descope-modal)',
9606
- property: 'display',
9607
- important: true,
9608
- },
9609
- backgroundColor: [
9610
- { selector: () => '::part(content)', property: 'background-color' },
9611
- { selector: () => '::part(overlay)', property: 'background-color' },
9612
- ],
9613
- width: { selector: () => '::part(overlay)', property: 'width' },
9614
- shadow: { selector: () => '::part(overlay)', property: 'box-shadow' },
9615
- },
9616
- forward: {
9617
- include: false,
9618
- attributes: ['opened'],
9619
- },
9620
- }),
9621
- draggableMixin,
9622
- componentNameValidationMixin,
9623
- customMixin
9624
- )(
9625
- createProxy({
9626
- slots: [''],
9627
- wrappedEleName: 'vaadin-dialog',
9628
- style: () => ``,
9629
- excludeAttrsSync: ['tabindex', 'opened'],
9630
- componentName: componentName$1,
9631
- })
9632
- );
9633
-
9634
9640
  const globalRefs$4 = getThemeRefs(globals);
9635
9641
 
9636
9642
  const compVars = ModalClass.cssVarList;
@@ -10031,5 +10037,5 @@ const vars = Object.keys(components).reduce(
10031
10037
  const defaultTheme = { globals, components: theme };
10032
10038
  const themeVars = { globals: vars$x, components: vars };
10033
10039
 
10034
- export { BadgeClass, ButtonClass, ButtonMultiSelectionGroupClass, ButtonSelectionGroupClass, CheckboxClass, ContainerClass, DividerClass, EmailFieldClass, GridClass, ImageClass, LinkClass, LoaderLinearClass, LoaderRadialClass, LogoClass, MultiSelectComboBoxClass, NewPasswordClass, NumberFieldClass, PasscodeClass, PasswordClass, PhoneFieldClass, PhoneFieldInputBoxClass, RecaptchaClass, SwitchToggleClass, TextAreaClass, TextClass, TextFieldClass, TotpImageClass, UploadFileClass, componentsThemeManager, createComponentsTheme, defaultTheme, genColor, globalsThemeToStyle, themeToStyle, themeVars };
10040
+ export { BadgeClass, ButtonClass, ButtonMultiSelectionGroupClass, ButtonSelectionGroupClass, CheckboxClass, ContainerClass, DividerClass, EmailFieldClass, GridClass, ImageClass, LinkClass, LoaderLinearClass, LoaderRadialClass, LogoClass, ModalClass, MultiSelectComboBoxClass, NewPasswordClass, NumberFieldClass, PasscodeClass, PasswordClass, PhoneFieldClass, PhoneFieldInputBoxClass, RecaptchaClass, SwitchToggleClass, TextAreaClass, TextClass, TextFieldClass, TotpImageClass, UploadFileClass, componentsThemeManager, createComponentsTheme, defaultTheme, genColor, globalsThemeToStyle, themeToStyle, themeVars };
10035
10041
  //# sourceMappingURL=index.esm.js.map