@descope/web-components-ui 1.0.247 → 1.0.248

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';
@@ -7965,6 +7966,111 @@ const BadgeClass = compose(
7965
7966
 
7966
7967
  customElements.define(componentName$3, BadgeClass);
7967
7968
 
7969
+ const componentName$2 = getComponentName('modal');
7970
+
7971
+ const customMixin = (superclass) =>
7972
+ class ModalMixinClass extends superclass {
7973
+ get opened() {
7974
+ return this.getAttribute('opened') === 'true';
7975
+ }
7976
+
7977
+ handleOpened() {
7978
+ forwardAttrs(this, this.baseElement, { includeAttrs: ['opened'] });
7979
+ if (this.opened) {
7980
+ this.style.display = '';
7981
+ } else {
7982
+ this.style.display = 'none';
7983
+ }
7984
+ }
7985
+
7986
+ init() {
7987
+ super.init?.();
7988
+ this.style.display = 'none';
7989
+
7990
+ // vaadin-dialog might not be loaded in time
7991
+ // in order to make sure it's loaded before this block is running
7992
+ // we are wrapping it with setTimeout
7993
+ setTimeout(() => {
7994
+ // we want to sync descope-modal content through vaadin-dialog into the overlay
7995
+ // so we are adding a slot to the overlay, which allows us to forward the content from
7996
+ // vaadin-dialog to vaadin-dialog-overlay
7997
+ this.baseElement.shadowRoot
7998
+ .querySelector('vaadin-dialog-overlay')
7999
+ .appendChild(document.createElement('slot'));
8000
+
8001
+ this.#overrideOverlaySettings();
8002
+
8003
+ // we need to always open the modal in `opened=false`
8004
+ // to prevent it from rendering outside the dialog
8005
+ // first, we have to run `overrideOverlaySettings` to setup
8006
+ // the component.
8007
+ this.handleOpened();
8008
+ });
8009
+ }
8010
+
8011
+ // the default vaadin behavior is to attach the overlay to the body when opened
8012
+ // we do not want that because it's difficult to style the overlay in this way
8013
+ // so we override it to open inside the shadow DOM
8014
+ #overrideOverlaySettings() {
8015
+ const overlay = this.baseElement.shadowRoot.querySelector('vaadin-dialog-overlay');
8016
+
8017
+ overlay._attachOverlay = () => {
8018
+ overlay.bringToFront();
8019
+ this.baseElement.setAttribute('style', 'display:flex!important;');
8020
+ };
8021
+ overlay._detachOverlay = () => {
8022
+ this.baseElement.style.display = 'none';
8023
+ };
8024
+ overlay._enterModalState = () => {};
8025
+
8026
+ overlay.close = () => false;
8027
+ }
8028
+ };
8029
+
8030
+ const ModalClass = compose(
8031
+ createStyleMixin({
8032
+ mappings: {
8033
+ overlayBackgroundColor: { property: () => ModalClass.cssVarList.overlay.backgroundColor },
8034
+ overlayShadow: { property: () => ModalClass.cssVarList.overlay.shadow },
8035
+ overlayWidth: { property: () => ModalClass.cssVarList.overlay.width },
8036
+ },
8037
+ }),
8038
+ portalMixin({
8039
+ name: 'overlay',
8040
+ selector: '',
8041
+ mappings: {
8042
+ hostDisplay: {
8043
+ selector: () => ':host(.descope-modal)',
8044
+ property: 'display',
8045
+ important: true,
8046
+ },
8047
+ backgroundColor: [
8048
+ { selector: () => '::part(content)', property: 'background-color' },
8049
+ { selector: () => '::part(overlay)', property: 'background-color' },
8050
+ ],
8051
+ width: { selector: () => '::part(overlay)', property: 'width' },
8052
+ shadow: { selector: () => '::part(overlay)', property: 'box-shadow' },
8053
+ },
8054
+ forward: {
8055
+ include: false,
8056
+ attributes: ['opened'],
8057
+ },
8058
+ }),
8059
+ draggableMixin,
8060
+ componentNameValidationMixin,
8061
+ customMixin
8062
+ )(
8063
+ createProxy({
8064
+ slots: [''],
8065
+ wrappedEleName: 'vaadin-dialog',
8066
+ style: () => ``,
8067
+ excludeAttrsSync: ['tabindex', 'opened'],
8068
+ componentName: componentName$2,
8069
+ })
8070
+ );
8071
+
8072
+ customElements.define(componentName$2, ModalClass);
8073
+
7968
8074
  const getVarName = (path) => getCssVarName(DESCOPE_PREFIX, ...path);
7969
8075
 
7970
8076
  const transformTheme = (theme, path, getTransformation) => {
@@ -8416,7 +8522,7 @@ var button$1 = /*#__PURE__*/Object.freeze({
8416
8522
  vars: vars$w
8417
8523
  });
8418
8524
 
8419
- const componentName$2 = getComponentName('input-wrapper');
8525
+ const componentName$1 = getComponentName('input-wrapper');
8420
8526
  const globalRefs$h = getThemeRefs(globals);
8421
8527
 
8422
8528
  const [theme$1, refs, vars$v] = createHelperVars(
@@ -8485,7 +8591,7 @@ const [theme$1, refs, vars$v] = createHelperVars(
8485
8591
  backgroundColor: globalRefs$h.colors.surface.main,
8486
8592
  },
8487
8593
  },
8488
- componentName$2
8594
+ componentName$1
8489
8595
  );
8490
8596
 
8491
8597
  var inputWrapper = /*#__PURE__*/Object.freeze({
@@ -9528,109 +9634,6 @@ var buttonMultiSelectionGroup$1 = /*#__PURE__*/Object.freeze({
9528
9634
  vars: vars$6
9529
9635
  });
9530
9636
 
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
9637
  const globalRefs$4 = getThemeRefs(globals);
9635
9638
 
9636
9639
  const compVars = ModalClass.cssVarList;
@@ -10031,5 +10034,5 @@ const vars = Object.keys(components).reduce(
10031
10034
  const defaultTheme = { globals, components: theme };
10032
10035
  const themeVars = { globals: vars$x, components: vars };
10033
10036
 
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 };
10037
+ 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
10038
  //# sourceMappingURL=index.esm.js.map