@descope/web-components-ui 1.0.229 → 1.0.231

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[7401],{5400:(e,t,o)=>{o.r(t),o.d(t,{NotificationCardClass:()=>p}),o(6542);var r=o(2061),n=o(4567),a=o(1e3);const d=(0,n.iY)("notification-card"),p=(0,r.qC)((0,a.yk)({mappings:{hostMinWidth:{selector:()=>"::part(content)",property:"min-width"},fontFamily:{},fontSize:{},backgroundColor:{selector:()=>"::part(content)"},textColor:{property:"color"},boxShadow:{},borderWidth:{selector:()=>"::part(content)",property:"border-width"},borderColor:{selector:()=>"::part(content)",property:"border-color"},borderStyle:{selector:()=>"::part(content)",property:"border-style"},borderRadius:[{selector:()=>"::part(content)",property:"border-radius"},{selector:()=>"::part(overlay)",property:"border-radius"}],verticalPadding:[{selector:()=>"::part(content)",property:"padding-top"},{selector:()=>"::part(content)",property:"padding-bottom"}],horizontalPadding:[{selector:()=>"::part(content)",property:"padding-right"},{selector:()=>"::part(content)",property:"padding-left"}]}}),(e=>class extends e{close(){this.baseElement.addEventListener("animationend",(()=>{this.remove(),this.dispatchEvent(new Event("card-closed"))})),this.setAttribute("opened","false")}}))((0,a.DM)({slots:[""],wrappedEleName:"vaadin-notification-card",style:()=>"\n vaadin-notification-card {\n box-shadow: none;\n }\n ::part(overlay) {\n box-shadow: none;\n background: none;\n }\n ",excludeAttrsSync:["tabindex"],componentName:d}));customElements.define(d,p)}}]);
1
+ "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[7401],{5400:(e,t,n)=>{n.r(t),n.d(t,{NotificationCardClass:()=>c}),n(6542);var o=n(2061),r=n(4567),i=n(1e3);const s=(0,r.iY)("notification-card"),a={content:()=>"vaadin-notification-card::part(content)",overlay:()=>"vaadin-notification-card::part(overlay)"},c=(0,o.qC)((0,i.yk)({mappings:{hostMinWidth:{selector:a.content,property:"min-width"},fontFamily:{},fontSize:{},backgroundColor:{selector:a.content},textColor:{property:"color"},boxShadow:{},borderWidth:{selector:a.content,property:"border-width"},borderColor:{selector:a.content,property:"border-color"},borderStyle:{selector:a.content,property:"border-style"},borderRadius:[{selector:a.content,property:"border-radius"},{selector:a.overlay,property:"border-radius"}],verticalPadding:[{selector:a.content,property:"padding-top"},{selector:a.content,property:"padding-bottom"}],horizontalPadding:[{selector:a.content,property:"padding-right"},{selector:a.content,property:"padding-left"}]}}),(e=>class extends e{close(){this.baseElement.addEventListener("animationend",(()=>{this.remove(),this.dispatchEvent(new Event("card-closed"))})),this.setAttribute("opened","false")}constructor(){super(),this.baseElement.innerHTML='\n <div part="root">\n <div part="content">\n <slot></slot>\n </div>\n <div part="close">\n <slot name="close"></slot>\n </div>\n </div>\n ',this.closeEle=this.shadowRoot.querySelector('[part="close"]')}init(){super.init?.(),this.closeEle.onclick=()=>{this.close()}}}))((0,i.DM)({slots:[],wrappedEleName:"vaadin-notification-card",style:()=>'\n vaadin-notification-card {\n box-shadow: none;\n }\n ::part(overlay) {\n box-shadow: none;\n background: none;\n }\n\n [part="close"] {\n cursor: pointer;\n display: flex;\n }\n\n [part="content"] {\n display: flex;\n align-items: center;\n flex-grow: 1;\n }\n\n [part="root"] {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n }\n ',excludeAttrsSync:["tabindex"],componentName:s}));customElements.define(s,c)}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[9655],{1845:(e,t,n)=>{n.r(t),n.d(t,{NotificationClass:()=>s}),n(6542);var i=n(4567);const a=window.customElements.get("vaadin-notification-container");if(!a)throw new Error("could not get vaadin-notification-container class");customElements.define((0,i.iY)("notification-container"),class extends a{}),n(5400);var o=n(2061),c=n(1e3);const r=(0,i.iY)("notification"),s=(0,o.qC)(c.e4,c.Ae,c._A,(e=>class t extends e{#e;constructor(){super();const e=this;Object.defineProperty(this.baseElement,"_container",{get:()=>(t._container||(t._container=document.createElement("descope-notification-container"),document.body.appendChild(t._container)),t._container.isConnected||e.parentNode.appendChild(t._container),t._container)}),Object.defineProperty(this.baseElement,"_card",{get:()=>e.#e});const n=this.baseElement._animatedRemoveNotificationCard;this.baseElement._animatedRemoveNotificationCard=()=>{this.#e=this.#e.shadowRoot.querySelector("vaadin-notification-card"),n.call(this.baseElement)}}init(){super.init?.(),this.createCard(),(0,i.oP)(this,this.#e),(0,i.tg)(this.#e,this,{includeAttrs:["opened"]}),this.baseElement.renderer=e=>{Array.from(this.childNodes).forEach((t=>e.appendChild(t)))}}get isContainerEmpty(){return!this.baseElement._container.children.length}removeContainer(){t._container.remove()}removeNotification(){this.remove(),this.isContainerEmpty&&this.removeContainer()}createCard(){this.#e=document.createElement("descope-notification-card"),this.#e.addEventListener("card-closed",this.removeNotification.bind(this))}}))((0,c.DM)({wrappedEleName:"vaadin-notification",excludeAttrsSync:["tabindex"],componentName:r}));customElements.define(r,s)}}]);
1
+ "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[9655],{1845:(e,t,n)=>{n.r(t),n.d(t,{NotificationClass:()=>s}),n(6542);var i=n(4567);const o=window.customElements.get("vaadin-notification-container");if(!o)throw new Error("could not get vaadin-notification-container class");customElements.define((0,i.iY)("notification-container"),class extends o{}),n(5400);var a=n(2061),c=n(1e3);const r=(0,i.iY)("notification"),s=(0,a.qC)(c.e4,c.Ae,c._A,(e=>class t extends e{#e;constructor(){super();const e=this;Object.defineProperty(this.baseElement,"_container",{get:()=>(t._container||(t._container=document.createElement("descope-notification-container"),document.body.appendChild(t._container)),t._container.isConnected||setTimeout((()=>e.parentNode.appendChild(t._container))),t._container)}),Object.defineProperty(this.baseElement,"_card",{get:()=>e.#e}),this.baseElement._removeNotificationCard=this.close.bind(this)}close(){this.#e.close()}init(){super.init?.(),this.createCard(),(0,i.oP)(this,this.#e),(0,i.tg)(this.#e,this,{includeAttrs:["opened"]}),this.baseElement.renderer=e=>{Array.from(this.childNodes).forEach((t=>e.appendChild(t)))}}get isContainerEmpty(){return!t._container.children.length}removeContainer(){t._container.remove()}removeNotification(){this.remove(),this.isContainerEmpty&&this.removeContainer()}createCard(){this.#e=document.createElement("descope-notification-card"),this.#e.addEventListener("card-closed",this.removeNotification.bind(this))}}))((0,c.DM)({wrappedEleName:"vaadin-notification",excludeAttrsSync:["tabindex"],componentName:r}));customElements.define(r,s)}}]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/web-components-ui",
3
- "version": "1.0.229",
3
+ "version": "1.0.231",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -33,7 +33,7 @@ const NotificationMixin = (superclass) =>
33
33
  if (!NotificationMixinClass._container.isConnected) {
34
34
  // Then, we're adding the container to the parentNode, which is the desired location
35
35
  // for us on the DOM
36
- that.parentNode.appendChild(NotificationMixinClass._container);
36
+ setTimeout(() => that.parentNode.appendChild(NotificationMixinClass._container));
37
37
  }
38
38
 
39
39
  return NotificationMixinClass._container;
@@ -46,13 +46,12 @@ const NotificationMixin = (superclass) =>
46
46
  },
47
47
  });
48
48
 
49
- // we want to replace the card with vaadin's notification card, so the notification removal process
50
- // will work properly.
51
- const origAnimatedRemoveNotificationCard = this.baseElement._animatedRemoveNotificationCard;
52
- this.baseElement._animatedRemoveNotificationCard = () => {
53
- this.#card = this.#card.shadowRoot.querySelector('vaadin-notification-card');
54
- origAnimatedRemoveNotificationCard.call(this.baseElement);
55
- };
49
+ // we want to replace the card with vaadin's remove notification so it will not throw
50
+ this.baseElement._removeNotificationCard = this.close.bind(this);
51
+ }
52
+
53
+ close() {
54
+ this.#card.close();
56
55
  }
57
56
 
58
57
  init() {
@@ -68,8 +67,9 @@ const NotificationMixin = (superclass) =>
68
67
  };
69
68
  }
70
69
 
70
+ // eslint-disable-next-line class-methods-use-this
71
71
  get isContainerEmpty() {
72
- return !this.baseElement._container.children.length;
72
+ return !NotificationMixinClass._container.children.length;
73
73
  }
74
74
 
75
75
  // eslint-disable-next-line class-methods-use-this
@@ -88,21 +88,6 @@ const NotificationMixin = (superclass) =>
88
88
  this.#card = document.createElement('descope-notification-card');
89
89
  this.#card.addEventListener('card-closed', this.removeNotification.bind(this));
90
90
  }
91
-
92
- // animatedRemoveNotificationCard() {
93
- // const vaadinCard = this.baseElement._card.shadowRoot.querySelector('vaadin-notification-card');
94
- // vaadinCard.setAttribute('closing', '');
95
- // const name = getComputedStyle(vaadinCard).getPropertyValue('animation-name');
96
- // if (name && name !== 'none') {
97
- // const listener = () => {
98
- // this._removeNotificationCard();
99
- // vaadinCard.removeEventListener('animationend', listener);
100
- // };
101
- // vaadinCard.addEventListener('animationend', listener);
102
- // } else {
103
- // this._removeNotificationCard();
104
- // }
105
- // }
106
91
  };
107
92
 
108
93
  export const NotificationClass = compose(
@@ -10,7 +10,7 @@ const notificationCardMixin = (superclass) =>
10
10
  // if animation is not applied to the element, the node will not be removed
11
11
  // from the DOM. We should avoid that. So, if in any case we allow
12
12
  // customizing the animation - we should check if animation is applied
13
- // and if it's not applied - remove the elemnt from the DOM and dispatch
13
+ // and if it's not applied - remove the element from the DOM and dispatch
14
14
  // `card-closed` event.
15
15
  this.baseElement.addEventListener('animationend', () => {
16
16
  this.remove();
@@ -19,38 +19,68 @@ const notificationCardMixin = (superclass) =>
19
19
 
20
20
  this.setAttribute('opened', 'false');
21
21
  }
22
+
23
+ constructor() {
24
+ super();
25
+
26
+ this.baseElement.innerHTML = `
27
+ <div part="root">
28
+ <div part="content">
29
+ <slot></slot>
30
+ </div>
31
+ <div part="close">
32
+ <slot name="close"></slot>
33
+ </div>
34
+ </div>
35
+ `;
36
+
37
+ this.closeEle = this.shadowRoot.querySelector('[part="close"]');
38
+ }
39
+
40
+ init() {
41
+ super.init?.();
42
+
43
+ this.closeEle.onclick = () => {
44
+ this.close();
45
+ };
46
+ }
22
47
  };
23
48
 
49
+ const selectors = {
50
+ content: () => 'vaadin-notification-card::part(content)',
51
+ overlay: () => 'vaadin-notification-card::part(overlay)',
52
+ };
53
+
24
54
  export const NotificationCardClass = compose(
25
55
  createStyleMixin({
26
56
  mappings: {
27
- hostMinWidth: { selector: () => '::part(content)', property: 'min-width' },
57
+ hostMinWidth: { selector: selectors.content, property: 'min-width' },
28
58
  fontFamily: {},
29
59
  fontSize: {},
30
- backgroundColor: { selector: () => '::part(content)' },
60
+ backgroundColor: { selector: selectors.content },
31
61
  textColor: { property: 'color' },
32
62
  boxShadow: {},
33
- borderWidth: { selector: () => '::part(content)', property: 'border-width' },
34
- borderColor: { selector: () => '::part(content)', property: 'border-color' },
35
- borderStyle: { selector: () => '::part(content)', property: 'border-style' },
63
+ borderWidth: { selector: selectors.content, property: 'border-width' },
64
+ borderColor: { selector: selectors.content, property: 'border-color' },
65
+ borderStyle: { selector: selectors.content, property: 'border-style' },
36
66
  borderRadius: [
37
- { selector: () => '::part(content)', property: 'border-radius' },
38
- { selector: () => '::part(overlay)', property: 'border-radius' },
67
+ { selector: selectors.content, property: 'border-radius' },
68
+ { selector: selectors.overlay, property: 'border-radius' },
39
69
  ],
40
70
  verticalPadding: [
41
- { selector: () => '::part(content)', property: 'padding-top' },
42
- { selector: () => '::part(content)', property: 'padding-bottom' },
71
+ { selector: selectors.content, property: 'padding-top' },
72
+ { selector: selectors.content, property: 'padding-bottom' },
43
73
  ],
44
74
  horizontalPadding: [
45
- { selector: () => '::part(content)', property: 'padding-right' },
46
- { selector: () => '::part(content)', property: 'padding-left' },
75
+ { selector: selectors.content, property: 'padding-right' },
76
+ { selector: selectors.content, property: 'padding-left' },
47
77
  ],
48
78
  },
49
79
  }),
50
80
  notificationCardMixin
51
81
  )(
52
82
  createProxy({
53
- slots: [''],
83
+ slots: [],
54
84
  wrappedEleName: 'vaadin-notification-card',
55
85
  style: () => `
56
86
  vaadin-notification-card {
@@ -60,6 +90,24 @@ export const NotificationCardClass = compose(
60
90
  box-shadow: none;
61
91
  background: none;
62
92
  }
93
+
94
+ [part="close"] {
95
+ cursor: pointer;
96
+ display: flex;
97
+ }
98
+
99
+ [part="content"] {
100
+ display: flex;
101
+ align-items: center;
102
+ flex-grow: 1;
103
+ }
104
+
105
+ [part="root"] {
106
+ display: flex;
107
+ align-items: center;
108
+ justify-content: space-between;
109
+ width: 100%;
110
+ }
63
111
  `,
64
112
  excludeAttrsSync: ['tabindex'],
65
113
  componentName,
@@ -1,6 +1,6 @@
1
1
  import globals from '../globals';
2
2
  import { getThemeRefs } from '../../helpers/themeHelpers';
3
- import { NotificationCardClass } from '../../components/descope-notification/descope-notification-card';
3
+ import { NotificationCardClass } from '../../components/descope-notification/descope-notification-card/NotificationCardClass';
4
4
 
5
5
  const globalRefs = getThemeRefs(globals);
6
6
  const vars = NotificationCardClass.cssVarList;
@@ -16,10 +16,7 @@ const notification = {
16
16
  [vars.boxShadow]: `${globalRefs.shadow.wide.xl} ${shadowColor}, ${globalRefs.shadow.narrow.xl} ${shadowColor}`,
17
17
  [vars.verticalPadding]: '0.45em',
18
18
  [vars.horizontalPadding]: '1em',
19
- [vars.verticalMargin]: '1em',
20
- [vars.horizontalMargin]: '1em',
21
19
  [vars.borderRadius]: globalRefs.radius.md,
22
- [vars.contentSpacing]: '0.5em',
23
20
 
24
21
  _bordered: {
25
22
  [vars.borderWidth]: globalRefs.border.sm,