scb-wc-test 0.1.122 → 0.1.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mvc/components/scb-calendar/scb-calendar.js +27 -25
- package/mvc/components/scb-cookies-consent/scb-cookies-consent.js +26 -4
- package/mvc/components/scb-dialog/scb-dialog.js +4 -2
- package/package.json +2 -2
- package/scb-calendar/scb-calendar.d.ts +10 -0
- package/scb-calendar/scb-calendar.js +180 -124
- package/scb-cookies-consent/scb-cookies-consent.js +56 -28
- package/scb-dialog/scb-dialog.js +37 -34
- package/scb-wc-test.bundle.js +299 -273
|
@@ -1,46 +1,45 @@
|
|
|
1
|
-
import{a as P,n as
|
|
1
|
+
import{a as P,n as S,i as j,x as v,t as q}from"../../vendor/vendor.js";import"./scb-calendar-event.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-dialog/scb-dialog.js";import"../scb-list/scb-list.js";import"../../vendor/vendor-material.js";import"../../vendor/preload-helper.js";import"../scb-button/scb-button.js";import"../scb-textfield/scb-textfield.js";import"../scb-datepicker/scb-datepicker.js";import"../scb-divider/scb-divider.js";import"../scb-checkbox/scb-checkbox.js";import"../scb-checkbox/scb-checkbox-group.js";import"../scb-radio-button/scb-radio-button.js";import"../scb-radio-button/scb-radio-group.js";import"../scb-switch/scb-switch.js";import"../scb-chip/scb-chip.js";import"../scb-list/scb-list-item.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(s,i,d){try{customElements.get(s)||e(s,i,d)}catch(c){var n=String(c||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw c}}}}catch{}})();var W=Object.defineProperty,L=Object.getOwnPropertyDescriptor,x=(t,e,s,i)=>{for(var d=i>1?void 0:i?L(e,s):e,n=t.length-1,c;n>=0;n--)(c=t[n])&&(d=(i?c(e,s,d):c(d))||d);return i&&d&&W(e,s,d),d};let E=class extends j{constructor(){super(...arguments),this._lastActiveDay=null,this.lang="sv",this.disableWeekend=!1,this.publicHolidays=!0,this._mutationObserver=null,this._onCalendarKeyDown=t=>{const s=Array.from(this.shadowRoot?.querySelectorAll(".calendar-day.has-event")??[]),i=this.shadowRoot?.activeElement,d=i&&s.includes(i)?i:document.activeElement,n=s.indexOf(d);if(n===-1)return;let c=n;const h=this.disableWeekend?5:7;switch(t.key){case"ArrowRight":c=n+1<s.length?n+1:n;break;case"ArrowLeft":c=n-1>=0?n-1:n;break;case"ArrowDown":c=n+h<s.length?n+h:n;break;case"ArrowUp":c=n-h>=0?n-h:n;break;default:return}c!==n&&(t.preventDefault(),s[c].focus())},this._onEventChanged=()=>{this.requestUpdate()},this._today=new Date,this._current=new Date,this._popupEvent=null,this._restoreDayFocus=()=>{this._lastActiveDay&&setTimeout(()=>{this._lastActiveDay?.focus(),this._lastActiveDay=null},0)},this._easterDateCalculated={}}connectedCallback(){super.connectedCallback(),this.addEventListener("change",this._onEventChanged),this._mutationObserver=new MutationObserver(()=>{this.requestUpdate()}),this._mutationObserver.observe(this,{childList:!0}),this.addEventListener("keydown",this._onCalendarKeyDown)}disconnectedCallback(){this.removeEventListener("change",this._onEventChanged),super.disconnectedCallback(),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null),this.removeEventListener("keydown",this._onCalendarKeyDown)}_daysInMonth(t,e){return new Date(t,e+1,0).getDate()}_firstDayOfWeek(t,e){const s=new Date(t,e,1).getDay();return s===0?6:s-1}_prevMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()-1,1),this.requestUpdate()}_nextMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()+1,1),this.requestUpdate()}_showEventPopup(t){this._popupEvent=t,this._lastActiveDay=this.shadowRoot?.activeElement||document.activeElement,this.requestUpdate(),setTimeout(()=>{const e=this.shadowRoot?.querySelector("scb-dialog");e&&(document.activeElement&&(e.__lastTriggerEl=document.activeElement),e.open=!0,e.addEventListener("close",this._restoreDayFocus,{once:!0}));const s=i=>{i.target?.closest(".event-popup")||this._closePopup()};window.addEventListener("mousedown",s,{once:!0})},0)}_closePopup(){const t=this.shadowRoot?.querySelector("scb-dialog");t&&t.removeAttribute("open"),this._popupEvent=null,this.requestUpdate()}_addDays(t,e){const s=new Date(t.valueOf());return s.setDate(s.getDate()+e),s}_easterDay(t){if(typeof this._easterDateCalculated["Ar"+t]<"u")return new Date(this._easterDateCalculated["Ar"+t]);let e=t;e<100&&(e=e+1900),e<1950&&(e=e+100);const s=e%19,i=e%4,d=e%7,n=(19*s+24)%30,c=(2*i+4*d+6*n+5)%7;let h=22+n+c,k=0;h==57&&(h-=7),h==56&&n==28&&c==6&&s>10&&(h-=7),h>31?(h-=31,k=4):k=3;const _=new Date(e,k-1,h);return this._easterDateCalculated["Ar"+t]=_,new Date(this._easterDateCalculated["Ar"+t])}_isSwedishHoliday(t){const e=t.getMonth();if(e===1||e===6||e===7||e===8)return!1;const s=t.getMonth()+1,i=t.getDate();if(s===1&&i===1||s===1&&i===6)return!0;const d=this._easterDay(t.getFullYear());return+t==+this._addDays(d,-2)||+t==+d||+t==+this._addDays(d,1)||+t==+this._addDays(d,39)?!0:+t==+this._addDays(d,50)?t.getFullYear()<2005:s===5&&i===1?!0:s===6&&i===6?t.getFullYear()>=2005:s===6&&i>=19&&i<=25&&t.getDay()===5||s===6&&i>=20&&i<=26&&t.getDay()===6||s===12&&i===24||s===12&&i===25||s===12&&i===26||s===10&&i>=31&&t.getDay()===6||s===11&&i<=6&&t.getDay()===6}render(){const t=this._current.getFullYear(),e=this._current.getMonth(),s=this._daysInMonth(t,e),i=this._firstDayOfWeek(t,e),d=this._today,n=this.lang==="en",c=n?["January","February","March","April","May","June","July","August","September","October","November","December"]:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"];let h=n?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]:["Mån","Tis","Ons","Tor","Fre","Lör","Sön"];this.disableWeekend&&(h=h.slice(0,5));const k=Array.from(this.querySelectorAll("scb-calendar-event")),_=new Map;for(const r of k){const o=r.getAttribute("start-date")||"",y=r.getAttribute("end-date")||"";if(o&&y){const l=new Date(o),g=new Date(y);for(let u=new Date(l);u<=g;u.setDate(u.getDate()+1)){const m=u.toISOString().split("T")[0],T=_.get(m)||[];T.push({title:r.title,description:r.description,start:o,end:y}),_.set(m,T)}}else if(o&&r.title){const l=o.split("T")[0],g=_.get(l)||[];g.push({title:r.title,description:r.description,start:o}),_.set(l,g)}}const O=[];let A=1;for(let r=0;r<6;r++){const o=[],y=this.disableWeekend?[0,1,2,3,4]:[0,1,2,3,4,5,6];let l=A;for(let g=0;g<y.length;g++){const u=y[g];if(r===0&&u<i){if(!this.disableWeekend||u<5){const m=e===0?11:e-1,T=e===0?t-1:t,M=this._daysInMonth(T,m)-(i-u-1);o.push(v`
|
|
2
2
|
<div class="calendar-day calendar-day--other">
|
|
3
|
-
<span class="calendar-day-number">${
|
|
3
|
+
<span class="calendar-day-number">${M}</span>
|
|
4
4
|
</div>
|
|
5
|
-
`)}}else if(
|
|
5
|
+
`)}}else if(l>s)o.push(v`<div></div>`);else{let m=new Date(t,e,l);if(this.disableWeekend)for(;m.getDay()===0||m.getDay()===6;)l++,m=new Date(t,e,l);if(l>s){o.push(v`<div></div>`);continue}const T=d.getFullYear()===t&&d.getMonth()===e&&d.getDate()===l,b=`${t}-${String(e+1).padStart(2,"0")}-${String(l).padStart(2,"0")}`,M=new Date(t,e,l);let C=!1;this.publicHolidays&&(C=this._isSwedishHoliday(M));let p=_.get(b)||[];p=[...p].sort((a,f)=>{const D=a.start&&b===a.start.split("T")[0]?a.start:a.end&&b===a.end.split("T")[0]?a.end:"",w=f.start&&b===f.start.split("T")[0]?f.start:f.end&&f.end.split("T")[0]?f.end:"",$=D&&D.includes("T"),F=w&&w.includes("T");return $&&F?D.localeCompare(w):$?-1:F?1:a.title.localeCompare(f.title)});const H=[...p].map(a=>{let f="",D="";if(a.start&&a.end){const w=a.start.split("T")[0],$=a.end.split("T")[0];b===w&&b===$&&a.start.includes("T")&&a.end.includes("T")?f=a.start.split("T")[1].substring(0,5)+"–"+a.end.split("T")[1].substring(0,5):b===w&&a.start.includes("T")?f=a.start.split("T")[1].substring(0,5):b===$&&a.end.includes("T")?(f=a.end.split("T")[1].substring(0,5),D=n?"cont. ":"fort. "):b!==w&&(f="",D=n?"cont. ":"fort. ")}else a.start&&a.start.includes("T")&&(f=a.start.split("T")[1].substring(0,5));return{...a,time:f,prefix:D}});o.push(v`
|
|
6
6
|
<div
|
|
7
|
-
class="calendar-day${T?" today":""}${
|
|
8
|
-
|
|
9
|
-
@click=${
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
aria-label=${a.length?a.length===1?a[0].title:a.map(e=>e.title).join(", "):void 0}
|
|
7
|
+
class="calendar-day${T?" today":""}${p.length?" has-event":""}${C?" calendar-day--holiday":""}"
|
|
8
|
+
tabindex=${p.length?"0":void 0}
|
|
9
|
+
@click=${p.length?()=>this._showEventPopup({date:b,events:p}):null}
|
|
10
|
+
@keydown=${p.length?a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),this._showEventPopup({date:b,events:p}))}:null}
|
|
11
|
+
title=${p.length===1?p[0].title:p.length>1?p.map(a=>a.title).join(", "):""}
|
|
12
|
+
role=${p.length?"button":void 0}
|
|
13
|
+
aria-label=${p.length?p.length===1?p[0].title:p.map(a=>a.title).join(", "):void 0}
|
|
15
14
|
>
|
|
16
15
|
<md-focus-ring inward></md-focus-ring>
|
|
17
|
-
<span class="calendar-day-number">${
|
|
16
|
+
<span class="calendar-day-number">${l}</span>
|
|
18
17
|
<div class="calendar-titles-wrapper">
|
|
19
|
-
${
|
|
18
|
+
${H.map(a=>v`<span class="calendar-day-event-title">${a.prefix||""}${a.title}</span>`)}
|
|
20
19
|
</div>
|
|
21
20
|
</div>
|
|
22
|
-
`),
|
|
21
|
+
`),l++}}if(A=l,O.push(v`<div class="calendar-grid">${o}</div>`),A>s)break}return v`
|
|
23
22
|
<div class="calendar-header">
|
|
24
|
-
<scb-icon-button @click=${this._prevMonth} icon="chevron_left" aria-label="${
|
|
25
|
-
<span>${
|
|
26
|
-
<scb-icon-button @click=${this._nextMonth} icon="chevron_right" aria-label="${
|
|
23
|
+
<scb-icon-button @click=${this._prevMonth} icon="chevron_left" aria-label="${n?"Previous month":"Föregående månad"}"></scb-icon-button>
|
|
24
|
+
<span>${c[e]} ${t}</span>
|
|
25
|
+
<scb-icon-button @click=${this._nextMonth} icon="chevron_right" aria-label="${n?"Next month":"Nästa månad"}"></scb-icon-button>
|
|
27
26
|
</div>
|
|
28
27
|
<div class="calendar-grid calendar-grid-days">
|
|
29
|
-
${
|
|
28
|
+
${h.map(r=>v`<div>${r}</div>`)}
|
|
30
29
|
</div>
|
|
31
30
|
<div class="calendar-weeks">
|
|
32
|
-
${
|
|
31
|
+
${O}
|
|
33
32
|
</div>
|
|
34
|
-
${this._popupEvent&&Array.isArray(this._popupEvent.events)?
|
|
35
|
-
<scb-dialog variant="floating" open label="${
|
|
33
|
+
${this._popupEvent&&Array.isArray(this._popupEvent.events)?v`
|
|
34
|
+
<scb-dialog variant="floating" open label="${n?"Events":"Händelser"} ${this._popupEvent.date}">
|
|
36
35
|
<scb-list>
|
|
37
|
-
${[...this._popupEvent.events].sort((
|
|
38
|
-
<scb-list-item label="${
|
|
36
|
+
${[...this._popupEvent.events].sort((r,o)=>{const y=r.start&&r.start.includes("T")?r.start:r.end&&r.end.includes("T")?r.end:"",l=o.start&&o.start.includes("T")?o.start:o.end&&o.end.includes("T")?o.end:"",g=y&&y.includes("T"),u=l&&l.includes("T");return g&&u?y.localeCompare(l):g?-1:u?1:r.title.localeCompare(o.title)}).map(r=>{const o=this._popupEvent?.date??"";let y="",l="",g="";if(r.start&&r.end){const u=r.start.split("T")[0],m=r.end.split("T")[0];u===m&&r.start.includes("T")&&r.end.includes("T")?y=r.start.split("T")[1].substring(0,5)+" – "+r.end.split("T")[1].substring(0,5):o===u&&r.start.includes("T")&&(y="Start: "+r.start.split("T")[1].substring(0,5)+(n?" (Extended event) ":" (Flerdagsevenemang) ")),o===m&&r.end.includes("T")&&u!==m&&(g=(n?"End: ":"Slut: ")+r.end.split("T")[1].substring(0,5)),o!==u&&(l=n?"cont. ":"fort. ")}else r.start&&r.start.includes("T")&&(y=r.start.split("T")[1].substring(0,5));return v`
|
|
37
|
+
<scb-list-item label="${l}${r.title}" supporting-text="${r.description?r.description:""}" overline="${y||""}${g||""}">
|
|
39
38
|
</scb-list-item>`})}
|
|
40
39
|
</scb-list>
|
|
41
40
|
</scb-dialog>
|
|
42
41
|
`:""}
|
|
43
|
-
`}};
|
|
42
|
+
`}};E.styles=P`
|
|
44
43
|
:host {
|
|
45
44
|
display: block;
|
|
46
45
|
border: 1px solid var(--md-sys-color-outline-variant);
|
|
@@ -88,6 +87,9 @@ import{a as P,n as M,i as F,x as y,t as j}from"../../vendor/vendor.js";import"./
|
|
|
88
87
|
border: 1px solid var(--md-sys-color-outline-variant, #e0e0e0);
|
|
89
88
|
flex-direction: column;
|
|
90
89
|
}
|
|
90
|
+
.calendar-day--holiday {
|
|
91
|
+
background: var(--md-sys-color-error-container);
|
|
92
|
+
}
|
|
91
93
|
.calendar-day.has-event:focus {
|
|
92
94
|
outline: none;
|
|
93
95
|
}
|
|
@@ -128,4 +130,4 @@ import{a as P,n as M,i as F,x as y,t as j}from"../../vendor/vendor.js";import"./
|
|
|
128
130
|
gap: var(--spacing-4);
|
|
129
131
|
}
|
|
130
132
|
|
|
131
|
-
`;x([
|
|
133
|
+
`;x([S({type:String})],E.prototype,"lang",2);x([S({type:Boolean,attribute:"disable-weekend"})],E.prototype,"disableWeekend",2);x([S({type:Boolean,attribute:"public-holidays"})],E.prototype,"publicHolidays",2);E=x([q("scb-calendar")],E);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as c,n as d,i as p,x as f,t as u}from"../../vendor/vendor.js";import"../scb-button/scb-button.js";import"../../vendor/vendor-material.js";(function(){try{var i=typeof globalThis<"u"?globalThis:window;if(!i.__scb_ce_guard_installed__){i.__scb_ce_guard_installed__=!0;var o=customElements.define.bind(customElements);customElements.define=function(t,n,e){try{customElements.get(t)||o(t,n,e)}catch(a){var r=String(a||"");if(r.indexOf("already been used")===-1&&r.indexOf("NotSupportedError")===-1)throw a}}}}catch{}})();var h=Object.defineProperty,x=Object.getOwnPropertyDescriptor,l=(i,o,t,n)=>{for(var e=n>1?void 0:n?x(o,t):o,r=i.length-1,a;r>=0;r--)(a=i[r])&&(e=(n?a(o,t,e):a(e))||e);return n&&e&&h(o,t,e),e};let s=class extends p{constructor(){super(...arguments),this.open=!0,this.title="",this.supportingText="",this.ariaLabel="Cookie-inställningar"}firstUpdated(){const i=()=>{const o=window.innerWidth<=480,t=this.shadowRoot.querySelector('slot[name="buttons"]');t&&t.assignedElements().forEach(e=>{o?e.setAttribute("full-width",""):e.removeAttribute("full-width")})};i(),window.addEventListener("resize",i),this.addEventListener("click",o=>{const t=o.target;t.slot==="buttons"&&(t.id==="accept-btn"?this.closeAndRemove("cookies-accept"):t.id==="decline-btn"?this.closeAndRemove("cookies-decline"):t.id==="handle-btn"&&this.closeAndRemove("cookies-handle"))})}connectedCallback(){super.connectedCallback(),this.id||(this.id="cookie-consent")}closeAndRemove(i){this.dispatchEvent(new CustomEvent(i)),this.remove()}render(){return this.open?f`
|
|
2
2
|
<div role="dialog" class="cookies-consent" aria-modal="true" aria-label=${this.ariaLabel}>
|
|
3
3
|
<h2>${this.title}</h2>
|
|
4
4
|
<div>
|
|
@@ -8,10 +8,10 @@ import{a as p,n as c,i as d,x as f,t as u}from"../../vendor/vendor.js";import"..
|
|
|
8
8
|
<slot name="buttons"></slot>
|
|
9
9
|
</div>
|
|
10
10
|
</div>
|
|
11
|
-
`:null}};
|
|
11
|
+
`:null}};s.styles=c`
|
|
12
12
|
:host {
|
|
13
13
|
position: fixed;
|
|
14
|
-
width:
|
|
14
|
+
width: 100%;
|
|
15
15
|
display: flex;
|
|
16
16
|
flex-direction: column;
|
|
17
17
|
bottom: 32px;
|
|
@@ -42,10 +42,32 @@ import{a as p,n as c,i as d,x as f,t as u}from"../../vendor/vendor.js";import"..
|
|
|
42
42
|
font-size: 16px;
|
|
43
43
|
line-height: 24px;
|
|
44
44
|
margin: 0;
|
|
45
|
+
hyphens: auto;
|
|
45
46
|
}
|
|
46
47
|
.button-container {
|
|
47
48
|
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
48
50
|
gap: 8px;
|
|
49
51
|
justify-content: flex-start;
|
|
50
52
|
}
|
|
51
|
-
|
|
53
|
+
|
|
54
|
+
::slotted{
|
|
55
|
+
md-filled-button {
|
|
56
|
+
width: 100%;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@media only screen and (min-width: 481px) {
|
|
61
|
+
:host {
|
|
62
|
+
width: auto;
|
|
63
|
+
max-width: 650px;
|
|
64
|
+
}
|
|
65
|
+
.button-container {
|
|
66
|
+
flex-direction: row;
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-wrap: wrap;
|
|
69
|
+
gap: 8px;
|
|
70
|
+
justify-content: flex-start;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
`;l([d({type:Boolean})],s.prototype,"open",2);l([d({type:String,reflect:!0})],s.prototype,"title",2);l([d({type:String,attribute:"supporting-text",reflect:!0})],s.prototype,"supportingText",2);l([d({type:String,attribute:"aria-label",reflect:!0})],s.prototype,"ariaLabel",2);s=l([u("scb-cookies-consent")],s);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as u,n
|
|
1
|
+
import{a as u,n,i as h,E as p,x as r,t as m}from"../../vendor/vendor.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-textfield/scb-textfield.js";import"../scb-checkbox/scb-checkbox.js";import"../scb-radio-button/scb-radio-button.js";import"../scb-switch/scb-switch.js";import"../scb-chip/scb-chip.js";import"../../vendor/vendor-material.js";import"../../vendor/preload-helper.js";import"../scb-datepicker/scb-datepicker.js";import"../scb-divider/scb-divider.js";import"../scb-checkbox/scb-checkbox-group.js";import"../scb-radio-button/scb-radio-group.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(o,c,a){try{customElements.get(o)||e(o,c,a)}catch(d){var l=String(d||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var b=Object.defineProperty,f=Object.getOwnPropertyDescriptor,s=(t,e,o,c)=>{for(var a=c>1?void 0:c?f(e,o):e,l=t.length-1,d;l>=0;l--)(d=t[l])&&(a=(c?d(e,o,a):d(a))||a);return c&&a&&b(e,o,a),a};let i=class extends h{constructor(){super(...arguments),this.open=!1,this.inSb=!1,this.scrimClose=!0,this.variant="basic",this.label="",this.icon="",this.supportingText="",this.okButton="OK",this.cancelButton="Avbryt",this.deleteButton="Delete",this.confirmButton="Ta bort",this.denyButton="Avbryt",this.resetButton="Återställ",this.submitButton="Spara",this.formId="",this.formAction="",this.formMethod="",this.__lastTriggerEl=null,this.__onDocumentClick=t=>{this.__getActionFromEvent(t)==="toggle"&&(this.__setOpen(!this.open),t.stopPropagation())},this.__onDocumentKeydown=t=>{this.open&&t.key==="Escape"&&(this.__fire("esc"),this.__setOpen(!1))},this.__onScrimClick=()=>{this.scrimClose&&(this.__fire("scrim"),this.__setOpen(!1))},this.__onOk=()=>{this.__fire("ok"),this.__setOpen(!1)},this.__onCancel=()=>{this.__fire("cancel"),this.__setOpen(!1)},this.__onConfirm=()=>{this.__fire("confirm"),this.__setOpen(!1)},this.__onDeny=()=>{this.__fire("deny"),this.__setOpen(!1)},this.__onReset=()=>{this.shadowRoot?.querySelector("form")?.reset(),(this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:!0})??[]).forEach(e=>{const o=e.tagName;o==="SCB-TEXTFIELD"&&(e.value=""),o==="SCB-CHECKBOX"&&(e.checked=!1),o==="SCB-RADIO-BUTTON"&&(e.checked=!1),o==="SCB-SWITCH"&&(e.selected=!1),o==="SCB-CHIP"&&(e.selected=!1)}),this.__fire("reset")},this.__onSubmit=()=>{this.shadowRoot?.querySelector("form")?.requestSubmit(),this.__fire("submit"),this.__setOpen(!1)},this.__onKeydownTrap=t=>{if(!this.open||t.key!=="Tab")return;const e=Array.from(this.shadowRoot.querySelectorAll('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])')).filter(a=>!a.hasAttribute("disabled"));if(!e.length)return;const o=e[0],c=e[e.length-1];t.shiftKey&&document.activeElement===o?(c.focus(),t.preventDefault()):!t.shiftKey&&document.activeElement===c&&(o.focus(),t.preventDefault())}}__getActionFromEvent(t){if(!this.id)return null;for(const e of t.composedPath())if(e instanceof Element){if(e.getAttribute("data-dialog-toggle")===this.id)return this.__lastTriggerEl=e,"toggle";if(e.getAttribute("aria-controls")===this.id)return this.__lastTriggerEl=e,"toggle"}return null}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.__onDocumentClick,!1),document.addEventListener("keydown",this.__onDocumentKeydown,!0),this.addEventListener("keydown",this.__onKeydownTrap)}disconnectedCallback(){document.removeEventListener("click",this.__onDocumentClick,!1),document.removeEventListener("keydown",this.__onDocumentKeydown,!0),this.removeEventListener("keydown",this.__onKeydownTrap),super.disconnectedCallback()}updated(t){if(t.has("open")){const e=t.get("open");this.__updateTriggersExpanded(),this.open&&!e?this.updateComplete.then(()=>{const o=this.shadowRoot?.querySelector('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])');o?o.focus():this.shadowRoot?.querySelector(".container")?.focus()}):!this.open&&e&&this.__lastTriggerEl?.focus?.(),this.__toggleScrollLock(this.open)}}__updateTriggersExpanded(){this.id&&document.querySelectorAll(`[aria-controls="${this.id}"], [data-dialog-toggle="${this.id}"]`).forEach(t=>{t.hasAttribute("aria-controls")&&t.setAttribute("aria-expanded",String(this.open))})}__toggleScrollLock(t){if(this.inSb)return;const e=document.documentElement;e.style.overflow=t?"hidden":""}__setOpen(t){this.open=t,this.__fire(t?"open":"close")}__fire(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}__slotIsEmpty(){const t=this.shadowRoot?.querySelector("slot");return t?t.assignedElements({flatten:!0}).length===0:!0}renderHeader(t){const e=this.variant==="form"||this.variant==="floating";return r`
|
|
2
2
|
<div class="header">
|
|
3
3
|
<div class="title">
|
|
4
4
|
${this.icon?r`<md-icon class="dialog-icon">${this.icon}</md-icon>`:p}
|
|
@@ -37,6 +37,7 @@ import{a as u,n as s,i as h,E as p,x as r,t as m}from"../../vendor/vendor.js";im
|
|
|
37
37
|
<div class="scrim" @click=${this.__onScrimClick} aria-hidden="true"></div>
|
|
38
38
|
<div
|
|
39
39
|
class="container"
|
|
40
|
+
tabindex="-1"
|
|
40
41
|
role="dialog"
|
|
41
42
|
aria-modal="true"
|
|
42
43
|
aria-labelledby=${t}
|
|
@@ -63,6 +64,7 @@ import{a as u,n as s,i as h,E as p,x as r,t as m}from"../../vendor/vendor.js";im
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
.container {
|
|
67
|
+
outline: none;
|
|
66
68
|
position: var(--scb-dialog-container-position, fixed);
|
|
67
69
|
inset: 50% auto auto 50%;
|
|
68
70
|
transform: translate(-50%, -50%) scale(1);
|
|
@@ -158,4 +160,4 @@ import{a as u,n as s,i as h,E as p,x as r,t as m}from"../../vendor/vendor.js";im
|
|
|
158
160
|
display:block;
|
|
159
161
|
margin-block: var(--scb-choice-gap, 6px);
|
|
160
162
|
}
|
|
161
|
-
`;
|
|
163
|
+
`;s([n({type:Boolean,reflect:!0})],i.prototype,"open",2);s([n({type:Boolean,attribute:!1})],i.prototype,"inSb",2);s([n({type:Boolean,attribute:"scrim-close"})],i.prototype,"scrimClose",2);s([n({type:String})],i.prototype,"variant",2);s([n({type:String})],i.prototype,"label",2);s([n({type:String})],i.prototype,"icon",2);s([n({type:String,attribute:"supporting-text"})],i.prototype,"supportingText",2);s([n({type:String,attribute:"ok-button"})],i.prototype,"okButton",2);s([n({type:String,attribute:"cancel-button"})],i.prototype,"cancelButton",2);s([n({type:String,attribute:"delete-button"})],i.prototype,"deleteButton",2);s([n({type:String,attribute:"confirm-button"})],i.prototype,"confirmButton",2);s([n({type:String,attribute:"deny-button"})],i.prototype,"denyButton",2);s([n({type:String,attribute:"reset-button"})],i.prototype,"resetButton",2);s([n({type:String,attribute:"submit-button"})],i.prototype,"submitButton",2);s([n({type:String,attribute:"form-id"})],i.prototype,"formId",2);s([n({type:String,attribute:"form-action"})],i.prototype,"formAction",2);s([n({type:String,attribute:"form-method"})],i.prototype,"formMethod",2);i=s([m("scb-dialog")],i);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.124",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -353,5 +353,5 @@
|
|
|
353
353
|
},
|
|
354
354
|
"./mvc/*": "./mvc/*"
|
|
355
355
|
},
|
|
356
|
-
"buildHash": "
|
|
356
|
+
"buildHash": "15C896A6F817249ACF8E2D94EF0E8815DBBB82FF107219F06BAFF3ECC3150B22"
|
|
357
357
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
export declare class ScbCalendar extends LitElement {
|
|
3
|
+
private _lastActiveDay;
|
|
3
4
|
lang: string;
|
|
4
5
|
disableWeekend: boolean;
|
|
5
6
|
publicHolidays: boolean;
|
|
@@ -7,6 +8,10 @@ export declare class ScbCalendar extends LitElement {
|
|
|
7
8
|
private _mutationObserver;
|
|
8
9
|
connectedCallback(): void;
|
|
9
10
|
disconnectedCallback(): void;
|
|
11
|
+
/**
|
|
12
|
+
* Hanterar tangentbordsnavigation mellan dagar enligt ARIA practices
|
|
13
|
+
*/
|
|
14
|
+
private _onCalendarKeyDown;
|
|
10
15
|
private _onEventChanged;
|
|
11
16
|
private _today;
|
|
12
17
|
private _current;
|
|
@@ -16,6 +21,11 @@ export declare class ScbCalendar extends LitElement {
|
|
|
16
21
|
private _prevMonth;
|
|
17
22
|
private _nextMonth;
|
|
18
23
|
private _showEventPopup;
|
|
24
|
+
private _restoreDayFocus;
|
|
19
25
|
private _closePopup;
|
|
26
|
+
private _easterDateCalculated;
|
|
27
|
+
private _addDays;
|
|
28
|
+
private _easterDay;
|
|
29
|
+
private _isSwedishHoliday;
|
|
20
30
|
render(): import('lit-html').TemplateResult<1>;
|
|
21
31
|
}
|