scb-wc-test 0.1.119 → 0.1.121
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-button/scb-button.js +15 -2
- package/mvc/components/scb-calendar/scb-calendar-event.js +3 -9
- package/mvc/components/scb-calendar/scb-calendar.js +82 -77
- package/package.json +2 -2
- package/scb-button/scb-button.d.ts +1 -0
- package/scb-button/scb-button.js +75 -59
- package/scb-calendar/scb-calendar-event.d.ts +3 -1
- package/scb-calendar/scb-calendar-event.js +27 -26
- package/scb-calendar/scb-calendar.d.ts +5 -2
- package/scb-calendar/scb-calendar.js +210 -137
- package/scb-wc-test.bundle.js +2195 -2183
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as
|
|
1
|
+
import{n as l,t as I,i as k,a as w,x as h,E as i}from"../../vendor/vendor.js";import"../../vendor/vendor-material.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(r,a,s){try{customElements.get(r)||e(r,a,s)}catch(d){var c=String(d||"");if(c.indexOf("already been used")===-1&&c.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var T=Object.defineProperty,B=Object.getOwnPropertyDescriptor,A=t=>{throw TypeError(t)},n=(t,e,r,a)=>{for(var s=a>1?void 0:a?B(e,r):e,c=t.length-1,d;c>=0;c--)(d=t[c])&&(s=(a?d(e,r,s):d(s))||s);return a&&s&&T(e,r,s),s},O=(t,e,r)=>e.has(t)||A("Cannot "+r),E=(t,e,r)=>e.has(t)?A("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),$=(t,e,r)=>(O(t,e,"access private method"),r),m,y;let o=class extends k{constructor(){super(...arguments),E(this,m),this.variant="filled",this.type="button",this.label="Button",this.trailingIcon=!1,this.icon="",this.disabled=!1,this.fullWidth=!1,this.href="",this.target="",this.rel="",this.spacing="",this.spacingTop="",this.spacingBottom=""}__getMdHost(){return this.renderRoot.querySelector("md-filled-button, md-outlined-button, md-filled-tonal-button, md-text-button")}__getInnerNativeButton(t){return t?.shadowRoot?.querySelector("button")??null}__syncAriaToInner(){const t=this.__getMdHost(),e=this.__getInnerNativeButton(t);if(!t||!e)return;const r=(this.getAttribute("aria-label")||"").trim(),a=(t.getAttribute("aria-label")||"").trim(),s=this.label.trim()===""?(this.icon||"").trim():"",c=r||a||s;c?e.setAttribute("aria-label",c):e.removeAttribute("aria-label");const d=this.getAttribute("aria-controls");d!==null?e.setAttribute("aria-controls",d):e.removeAttribute("aria-controls");const g=this.getAttribute("aria-expanded");g!==null?e.setAttribute("aria-expanded",g):e.removeAttribute("aria-expanded"),t.removeAttribute("aria-label"),t.removeAttribute("aria-controls"),t.removeAttribute("aria-expanded"),this.removeAttribute("aria-expanded"),this.__ariaObserver?.disconnect(),this.__ariaObserver=new MutationObserver(x=>{const u=this.__getMdHost(),p=this.__getInnerNativeButton(u);if(!(!u||!p)){for(const f of x){if(f.type!=="attributes"||!f.attributeName)continue;const b=f.attributeName,v=this.getAttribute(b);if(b==="aria-label"){const S=(u.getAttribute("aria-label")||"").trim(),_=(v||S||(this.label.trim()===""?(this.icon||"").trim():"")).trim();_?p.setAttribute("aria-label",_):p.removeAttribute("aria-label"),u.removeAttribute("aria-label")}else(b==="aria-controls"||b==="aria-expanded")&&(v===null?p.removeAttribute(b):p.setAttribute(b,v),b==="aria-expanded"&&this.removeAttribute("aria-expanded"))}u.removeAttribute("aria-label"),u.removeAttribute("aria-controls"),u.removeAttribute("aria-expanded")}}),this.__ariaObserver.observe(this,{attributes:!0,attributeFilter:["aria-label","aria-controls","aria-expanded"]})}firstUpdated(){(this.type==="submit"||this.type==="reset")&&this.addEventListener("click",()=>{if(!this.disabled){const t=this.closest("form");t&&(this.type==="submit"&&t.requestSubmit(),this.type==="reset"&&t.reset())}}),this.__syncAriaToInner(),$(this,m,y).call(this)}updated(t){t.has("variant")&&this.__syncAriaToInner(),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom"))&&$(this,m,y).call(this)}disconnectedCallback(){this.__ariaObserver?.disconnect(),super.disconnectedCallback()}mapSpacingToken(t){if(!t)return;const e=String(t).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e}static get styles(){return w`
|
|
2
2
|
/* Gör hosten stretchbar i t.ex. flex/grid */
|
|
3
3
|
:host {
|
|
4
4
|
display: inline-flex;
|
|
@@ -7,6 +7,11 @@ import{n as s,t as I,i as k,a as T,x as h,E as i}from"../../vendor/vendor.js";im
|
|
|
7
7
|
margin-block-end: var(--scb-button-spacing-block-end, 0);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
:host([full-width]) {
|
|
11
|
+
display: flex;
|
|
12
|
+
inline-size: 100%;
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
/* Låt inre md-knappar fylla hostens höjd */
|
|
11
16
|
md-filled-button,
|
|
12
17
|
md-outlined-button,
|
|
@@ -15,6 +20,14 @@ import{n as s,t as I,i as k,a as T,x as h,E as i}from"../../vendor/vendor.js";im
|
|
|
15
20
|
block-size: 100%;
|
|
16
21
|
}
|
|
17
22
|
|
|
23
|
+
:host([full-width]) md-filled-button,
|
|
24
|
+
:host([full-width]) md-outlined-button,
|
|
25
|
+
:host([full-width]) md-filled-tonal-button,
|
|
26
|
+
:host([full-width]) md-text-button {
|
|
27
|
+
inline-size: 100%;
|
|
28
|
+
flex: 1 1 auto;
|
|
29
|
+
}
|
|
30
|
+
|
|
18
31
|
/* Errorvarianter */
|
|
19
32
|
/*
|
|
20
33
|
md-filled-button[variant='error'],
|
|
@@ -119,4 +132,4 @@ import{n as s,t as I,i as k,a as T,x as h,E as i}from"../../vendor/vendor.js";im
|
|
|
119
132
|
${this.label}
|
|
120
133
|
${t&&this.trailingIcon?e:i}
|
|
121
134
|
</md-text-button>
|
|
122
|
-
`;default:return h``}}};m=new WeakSet;
|
|
135
|
+
`;default:return h``}}};m=new WeakSet;y=function(){const t=this.mapSpacingToken(this.spacing),e=this.mapSpacingToken(this.spacingTop)??t,r=this.mapSpacingToken(this.spacingBottom)??t;e?this.style.setProperty("--scb-button-spacing-block-start",e):this.style.removeProperty("--scb-button-spacing-block-start"),r?this.style.setProperty("--scb-button-spacing-block-end",r):this.style.removeProperty("--scb-button-spacing-block-end")};n([l({type:String,reflect:!0})],o.prototype,"variant",2);n([l({type:String,reflect:!0})],o.prototype,"type",2);n([l({type:String})],o.prototype,"label",2);n([l({type:Boolean,attribute:"trailing-icon"})],o.prototype,"trailingIcon",2);n([l({type:String})],o.prototype,"icon",2);n([l({type:Boolean,reflect:!0})],o.prototype,"disabled",2);n([l({type:Boolean,attribute:"full-width",reflect:!0})],o.prototype,"fullWidth",2);n([l({type:String})],o.prototype,"href",2);n([l({type:String})],o.prototype,"target",2);n([l({type:String})],o.prototype,"rel",2);n([l({type:String,reflect:!0})],o.prototype,"spacing",2);n([l({type:String,attribute:"spacing-top",reflect:!0})],o.prototype,"spacingTop",2);n([l({type:String,attribute:"spacing-bottom",reflect:!0})],o.prototype,"spacingBottom",2);o=n([I("scb-button")],o);
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import{a as p,n as
|
|
2
|
-
|
|
3
|
-
<h3>${this.title}</h3>
|
|
4
|
-
<p>${this.date}</p>
|
|
5
|
-
<p>${this.description}</p>
|
|
6
|
-
</div>
|
|
7
|
-
`}};o.styles=p`
|
|
1
|
+
import{a as p,n as l,i as u,x as c,t as _}from"../../vendor/vendor.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var i=customElements.define.bind(customElements);customElements.define=function(r,n,e){try{customElements.get(r)||i(r,n,e)}catch(o){var a=String(o||"");if(a.indexOf("already been used")===-1&&a.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var f=Object.defineProperty,b=Object.getOwnPropertyDescriptor,d=(t,i,r,n)=>{for(var e=n>1?void 0:n?b(i,r):i,a=t.length-1,o;a>=0;a--)(o=t[a])&&(e=(n?o(i,r,e):o(e))||e);return n&&e&&f(i,r,e),e};let s=class extends u{constructor(){super(...arguments),this.title="",this.description="",this.startDate="",this.endDate=""}updated(t){super.updated?.(t),(t.has("title")||t.has("description")||t.has("startDate")||t.has("endDate"))&&this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}render(){return c`
|
|
2
|
+
`}};s.styles=p`
|
|
8
3
|
:host {
|
|
9
4
|
display: block;
|
|
10
|
-
font-family: var(--brand-font, Arial, sans-serif)
|
|
11
5
|
}
|
|
12
|
-
`;
|
|
6
|
+
`;d([l({type:String})],s.prototype,"title",2);d([l({type:String})],s.prototype,"description",2);d([l({type:String,attribute:"start-date"})],s.prototype,"startDate",2);d([l({type:String,attribute:"end-date"})],s.prototype,"endDate",2);s=d([_("scb-calendar-event")],s);
|
|
@@ -1,67 +1,70 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as S,n as k,i as O,x as m,t as C}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 i=typeof globalThis<"u"?globalThis:window;if(!i.__scb_ce_guard_installed__){i.__scb_ce_guard_installed__=!0;var a=customElements.define.bind(customElements);customElements.define=function(c,h,u){try{customElements.get(c)||a(c,h,u)}catch(b){var o=String(b||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw b}}}}catch{}})();var A=Object.defineProperty,P=Object.getOwnPropertyDescriptor,x=(i,a,c,h)=>{for(var u=h>1?void 0:h?P(a,c):a,o=i.length-1,b;o>=0;o--)(b=i[o])&&(u=(h?b(a,c,u):b(u))||u);return h&&u&&A(a,c,u),u};let w=class extends O{constructor(){super(...arguments),this.lang="sv",this._mutationObserver=null,this._onEventChanged=()=>{this.requestUpdate()},this._today=new Date,this._current=new Date,this._popupEvent=null}connectedCallback(){super.connectedCallback(),this.addEventListener("change",this._onEventChanged),this._mutationObserver=new MutationObserver(()=>{this.requestUpdate()}),this._mutationObserver.observe(this,{childList:!0})}disconnectedCallback(){this.removeEventListener("change",this._onEventChanged),super.disconnectedCallback(),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null)}_daysInMonth(i,a){return new Date(i,a+1,0).getDate()}_firstDayOfWeek(i,a){const c=new Date(i,a,1).getDay();return c===0?6:c-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(i){this._popupEvent=i,this.requestUpdate(),setTimeout(()=>{const a=this.shadowRoot?.querySelector("scb-dialog");a&&a.setAttribute("open","");const c=h=>{h.target?.closest(".event-popup")||this._closePopup()};window.addEventListener("mousedown",c,{once:!0})},0)}_closePopup(){const i=this.shadowRoot?.querySelector("scb-dialog");i&&i.removeAttribute("open"),this._popupEvent=null,this.requestUpdate()}render(){const i=this._current.getFullYear(),a=this._current.getMonth(),c=this._daysInMonth(i,a),h=this._firstDayOfWeek(i,a),u=this._today,o=this.lang==="en",b=o?["January","February","March","April","May","June","July","August","September","October","November","December"]:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"],E=o?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]:["Mån","Tis","Ons","Tor","Fre","Lör","Sön"],M=Array.from(this.querySelectorAll("scb-calendar-event")),_=new Map;for(const t of M){const r=t.getAttribute("start-date")||"",l=t.getAttribute("end-date")||"";if(r&&l){const d=new Date(r),n=new Date(l);for(let s=new Date(d);s<=n;s.setDate(s.getDate()+1)){const g=s.toISOString().split("T")[0],e=_.get(g)||[];e.push({title:t.title,description:t.description,start:r,end:l}),_.set(g,e)}}else if(r&&t.title){const d=r.split("T")[0],n=_.get(d)||[];n.push({title:t.title,description:t.description,start:r}),_.set(d,n)}}const $=[];let y=1;for(let t=0;t<6;t++){const r=[];for(let l=0;l<7;l++)if(t===0&&l<h){const d=a===0?11:a-1,n=a===0?i-1:i,g=this._daysInMonth(n,d)-(h-l-1);r.push(m`
|
|
2
2
|
<div class="calendar-day calendar-day--other">
|
|
3
|
-
<span class="calendar-day-number">${
|
|
3
|
+
<span class="calendar-day-number">${g}</span>
|
|
4
4
|
</div>
|
|
5
|
-
`)}else if(c
|
|
5
|
+
`)}else if(y>c)r.push(m`<div></div>`);else{const d=u.getFullYear()===i&&u.getMonth()===a&&u.getDate()===y,n=`${i}-${String(a+1).padStart(2,"0")}-${String(y).padStart(2,"0")}`;let s=_.get(n)||[];s=[...s].sort((e,p)=>{const f=e.start&&n===e.start.split("T")[0]?e.start:e.end&&n===e.end.split("T")[0]?e.end:"",v=p.start&&n===p.start.split("T")[0]?p.start:p.end&&n===p.end.split("T")[0]?p.end:"",T=f&&f.includes("T"),D=v&&v.includes("T");return T&&D?f.localeCompare(v):T?-1:D?1:e.title.localeCompare(p.title)});const g=[...s].map(e=>{let p="",f="";if(e.start&&e.end){const v=e.start.split("T")[0],T=e.end.split("T")[0];n===v&&n===T&&e.start.includes("T")&&e.end.includes("T")?p=e.start.split("T")[1].substring(0,5)+"–"+e.end.split("T")[1].substring(0,5):n===v&&e.start.includes("T")?p=e.start.split("T")[1].substring(0,5):n===T&&e.end.includes("T")?(p=e.end.split("T")[1].substring(0,5),f=o?"cont. ":"fort. "):n!==v&&(p="",f=o?"cont. ":"fort. ")}else e.start&&e.start.includes("T")&&(p=e.start.split("T")[1].substring(0,5));return{...e,time:p,prefix:f}});r.push(m`
|
|
6
6
|
<div
|
|
7
|
-
class="calendar-day${
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
class="calendar-day${d?" today":""}${s.length?" has-event":""}"
|
|
8
|
+
?tabindex=${s.length?0:void 0}
|
|
9
|
+
@click=${s.length?()=>this._showEventPopup({date:n,events:s}):null}
|
|
10
|
+
tabindex=${s.length?"0":void 0}
|
|
11
|
+
@keydown=${s.length?e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this._showEventPopup({date:n,events:s}))}:null}
|
|
12
|
+
title=${s.length===1?s[0].title:s.length>1?s.map(e=>e.title).join(", "):""}
|
|
13
|
+
role=${s.length?"button":void 0}
|
|
14
|
+
aria-label=${s.length?s.length===1?s[0].title:s.map(e=>e.title).join(", "):void 0}
|
|
10
15
|
>
|
|
11
|
-
<
|
|
16
|
+
<md-focus-ring inward></md-focus-ring>
|
|
17
|
+
<span class="calendar-day-number">${y}</span>
|
|
12
18
|
<div class="calendar-titles-wrapper">
|
|
13
|
-
${
|
|
19
|
+
${g.map(e=>m`<span class="calendar-day-event-title">${e.prefix||""}${e.title}</span>`)}
|
|
14
20
|
</div>
|
|
15
21
|
</div>
|
|
16
|
-
`),
|
|
22
|
+
`),y++}if($.push(m`<div class="calendar-grid">${r}</div>`),y>c)break}return m`
|
|
17
23
|
<div class="calendar-header">
|
|
18
|
-
<scb-icon-button @click=${this._prevMonth} icon="chevron_left" aria-label="Föregående månad"></scb-icon-button>
|
|
19
|
-
<span>${
|
|
20
|
-
<scb-icon-button @click=${this._nextMonth} icon="chevron_right" aria-label="Nästa månad"></scb-icon-button>
|
|
24
|
+
<scb-icon-button @click=${this._prevMonth} icon="chevron_left" aria-label="${o?"Previous month":"Föregående månad"}"></scb-icon-button>
|
|
25
|
+
<span>${b[a]} ${i}</span>
|
|
26
|
+
<scb-icon-button @click=${this._nextMonth} icon="chevron_right" aria-label="${o?"Next month":"Nästa månad"}"></scb-icon-button>
|
|
21
27
|
</div>
|
|
22
28
|
<div class="calendar-grid calendar-grid-days">
|
|
23
|
-
|
|
29
|
+
${E.map(t=>m`<div>${t}</div>`)}
|
|
24
30
|
</div>
|
|
25
31
|
<div class="calendar-weeks">
|
|
26
|
-
${
|
|
27
|
-
|
|
28
|
-
${this._popupEvent&&Array.isArray(this._popupEvent.events)?
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
</div>
|
|
32
|
+
${$}
|
|
33
|
+
</div>
|
|
34
|
+
${this._popupEvent&&Array.isArray(this._popupEvent.events)?m`
|
|
35
|
+
<scb-dialog variant="floating" open label="${o?"Events":"Händelser"} ${this._popupEvent.date}">
|
|
36
|
+
<scb-list>
|
|
37
|
+
${[...this._popupEvent.events].sort((t,r)=>{const l=t.start&&t.start.includes("T")?t.start:t.end&&t.end.includes("T")?t.end:"",d=r.start&&r.start.includes("T")?r.start:r.end&&r.end.includes("T")?r.end:"",n=l&&l.includes("T"),s=d&&d.includes("T");return n&&s?l.localeCompare(d):n?-1:s?1:t.title.localeCompare(r.title)}).map(t=>{const r=this._popupEvent?.date??"";let l="",d="",n="";if(t.start&&t.end){const s=t.start.split("T")[0],g=t.end.split("T")[0];s===g&&t.start.includes("T")&&t.end.includes("T")?l=t.start.split("T")[1].substring(0,5)+" – "+t.end.split("T")[1].substring(0,5):r===s&&t.start.includes("T")&&(l="Start: "+t.start.split("T")[1].substring(0,5)+(o?" (Extended event) ":" (Flerdagsevenemang) ")),r===g&&t.end.includes("T")&&s!==g&&(n=(o?"End: ":"Slut: ")+t.end.split("T")[1].substring(0,5)),r!==s&&(d=o?"cont. ":"fort. ")}else t.start&&t.start.includes("T")&&(l=t.start.split("T")[1].substring(0,5));return m`
|
|
38
|
+
<scb-list-item label="${d}${t.title}" supporting-text="${t.description?t.description:""}" overline="${l||""}${n||""}">
|
|
39
|
+
</scb-list-item>`})}
|
|
40
|
+
</scb-list>
|
|
41
|
+
</scb-dialog>
|
|
37
42
|
`:""}
|
|
38
|
-
`}};
|
|
43
|
+
`}};w.styles=S`
|
|
39
44
|
:host {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
border: var(--scb-elevation-2, 0 2px 8px rgba(0,0,0,0.08));
|
|
46
|
-
padding: 16px;
|
|
45
|
+
display: block;
|
|
46
|
+
border: 1px solid var(--md-sys-color-outline-variant);
|
|
47
|
+
padding: var(--spacing-5);
|
|
48
|
+
border-radius: var(--md-sys-shape-corner-large);
|
|
49
|
+
background: var(--md-sys-color-surface);
|
|
47
50
|
}
|
|
48
51
|
.calendar-header {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: space-between;
|
|
55
|
+
margin-bottom: var(--spacing-5);
|
|
53
56
|
border-bottom: 1px solid rgb(224, 224, 224);
|
|
54
|
-
padding-bottom:
|
|
57
|
+
padding-bottom: var(--spacing-3);
|
|
55
58
|
}
|
|
56
59
|
.calendar-grid {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
display: grid;
|
|
61
|
+
grid-template-columns: repeat(7, 1fr);
|
|
62
|
+
gap: var(--spacing-2);
|
|
63
|
+
margin-bottom: var(--spacing-2);
|
|
61
64
|
}
|
|
62
65
|
.calendar-grid-days{
|
|
63
66
|
font-weight: 600;
|
|
64
|
-
margin-bottom:
|
|
67
|
+
margin-bottom: var(--spacing-5);
|
|
65
68
|
}
|
|
66
69
|
.calendar-weeks {
|
|
67
70
|
display: grid;
|
|
@@ -69,55 +72,57 @@ import{a as x,n as m,i as w,x as d,t as $}from"../../vendor/vendor.js";import"./
|
|
|
69
72
|
}
|
|
70
73
|
.calendar-titles-wrapper{
|
|
71
74
|
display: grid;
|
|
72
|
-
gap:
|
|
75
|
+
gap: var(--spacing-2);
|
|
73
76
|
}
|
|
74
77
|
.calendar-day {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
gap:
|
|
82
|
-
border: 1px solid #e0e0e0;
|
|
78
|
+
border-radius: 6px;
|
|
79
|
+
min-height: 50px;
|
|
80
|
+
display: flex;
|
|
81
|
+
padding: var(--spacing-3);
|
|
82
|
+
box-sizing: border-box;
|
|
83
|
+
overflow: hidden;
|
|
84
|
+
gap: var(--spacing-3);
|
|
85
|
+
border: 1px solid var(--md-sys-color-outline-variant, #e0e0e0);
|
|
83
86
|
flex-direction: column;
|
|
84
87
|
}
|
|
88
|
+
.calendar-day.has-event:focus {
|
|
89
|
+
outline: none;
|
|
90
|
+
}
|
|
91
|
+
md-focus-ring {
|
|
92
|
+
border-radius: 6px;
|
|
93
|
+
}
|
|
85
94
|
.calendar-day--other {
|
|
86
|
-
|
|
95
|
+
opacity: 0.4;
|
|
87
96
|
}
|
|
88
97
|
.calendar-day-number {
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
font-size: var(--md-sys-typescale-label-small-size);
|
|
99
|
+
line-height: var(--md-sys-typescale-label-small-line-height); /* vissa tabeller i Figma visar 21 */
|
|
100
|
+
font-weight: var(--md-sys-typescale-label-small-weight);
|
|
101
|
+
letter-spacing: var(--md-sys-typescale-label-small-tracking);
|
|
91
102
|
}
|
|
92
103
|
.calendar-day-event-title {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
font-size: 12px;
|
|
105
|
+
color: var(--md-sys-color-primary);
|
|
106
|
+
white-space: nowrap;
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
text-overflow: ellipsis;
|
|
109
|
+
display: block;
|
|
110
|
+
width: 100%;
|
|
100
111
|
}
|
|
101
112
|
.calendar-day.today {
|
|
102
|
-
|
|
113
|
+
background: var(--md-sys-color-secondary-container);
|
|
114
|
+
|
|
103
115
|
}
|
|
104
116
|
.calendar-day.has-event {
|
|
105
117
|
cursor: pointer;
|
|
106
|
-
|
|
107
|
-
|
|
118
|
+
position: relative;
|
|
119
|
+
border: 1px solid var(--md-sys-color-primary);
|
|
108
120
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
border-radius: 10px;
|
|
115
|
-
box-shadow: 0 4px 24px rgba(0,0,0,0.18);
|
|
116
|
-
min-width: 220px;
|
|
117
|
-
max-width: 320px;
|
|
118
|
-
padding: 16px 20px 16px 20px;
|
|
119
|
-
top: 30%;
|
|
120
|
-
left: 50%;
|
|
121
|
+
|
|
122
|
+
.event-popup-list{
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: column;
|
|
125
|
+
gap: var(--spacing-4);
|
|
121
126
|
}
|
|
122
127
|
|
|
123
|
-
`;
|
|
128
|
+
`;x([k({type:String})],w.prototype,"lang",2);w=x([C("scb-calendar")],w);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.121",
|
|
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": "62D50E7AEB04DF26D21CAC5D5823CD9D286A1A8D4834CDF212EA8705A577DB49"
|
|
357
357
|
}
|
package/scb-button/scb-button.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { LitElement as k, css as
|
|
2
|
-
import { property as
|
|
1
|
+
import { LitElement as k, css as w, html as h, nothing as r } from "lit";
|
|
2
|
+
import { property as a, customElement as B } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/button/filled-button.js";
|
|
4
4
|
import "@material/web/button/outlined-button.js";
|
|
5
5
|
import "@material/web/button/filled-tonal-button.js";
|
|
6
6
|
import "@material/web/button/text-button.js";
|
|
7
7
|
import "@material/web/icon/icon.js";
|
|
8
|
-
var
|
|
8
|
+
var T = Object.defineProperty, O = Object.getOwnPropertyDescriptor, x = (t) => {
|
|
9
9
|
throw TypeError(t);
|
|
10
|
-
},
|
|
11
|
-
for (var
|
|
12
|
-
(
|
|
13
|
-
return
|
|
14
|
-
}, L = (t, e, i) => e.has(t) || x("Cannot " + i), P = (t, e, i) => e.has(t) ? x("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), A = (t, e, i) => (L(t, e, "access private method"), i), m,
|
|
10
|
+
}, n = (t, e, i, s) => {
|
|
11
|
+
for (var l = s > 1 ? void 0 : s ? O(e, i) : e, u = t.length - 1, b; u >= 0; u--)
|
|
12
|
+
(b = t[u]) && (l = (s ? b(e, i, l) : b(l)) || l);
|
|
13
|
+
return s && l && T(e, i, l), l;
|
|
14
|
+
}, L = (t, e, i) => e.has(t) || x("Cannot " + i), P = (t, e, i) => e.has(t) ? x("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), A = (t, e, i) => (L(t, e, "access private method"), i), m, y;
|
|
15
15
|
let o = class extends k {
|
|
16
16
|
constructor() {
|
|
17
|
-
super(...arguments), P(this, m), this.variant = "filled", this.type = "button", this.label = "Button", this.trailingIcon = !1, this.icon = "", this.disabled = !1, this.href = "", this.target = "", this.rel = "", this.spacing = "", this.spacingTop = "", this.spacingBottom = "";
|
|
17
|
+
super(...arguments), P(this, m), this.variant = "filled", this.type = "button", this.label = "Button", this.trailingIcon = !1, this.icon = "", this.disabled = !1, this.fullWidth = !1, this.href = "", this.target = "", this.rel = "", this.spacing = "", this.spacingTop = "", this.spacingBottom = "";
|
|
18
18
|
}
|
|
19
19
|
// Hosta md-* elementet (värden flyttas därifrån in i dess shadow <button>)
|
|
20
20
|
__getMdHost() {
|
|
@@ -32,21 +32,21 @@ let o = class extends k {
|
|
|
32
32
|
var $;
|
|
33
33
|
const t = this.__getMdHost(), e = this.__getInnerNativeButton(t);
|
|
34
34
|
if (!t || !e) return;
|
|
35
|
-
const i = (this.getAttribute("aria-label") || "").trim(),
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
const c = this.__getMdHost(),
|
|
42
|
-
if (!(!c || !
|
|
35
|
+
const i = (this.getAttribute("aria-label") || "").trim(), s = (t.getAttribute("aria-label") || "").trim(), l = this.label.trim() === "" ? (this.icon || "").trim() : "", u = i || s || l;
|
|
36
|
+
u ? e.setAttribute("aria-label", u) : e.removeAttribute("aria-label");
|
|
37
|
+
const b = this.getAttribute("aria-controls");
|
|
38
|
+
b !== null ? e.setAttribute("aria-controls", b) : e.removeAttribute("aria-controls");
|
|
39
|
+
const g = this.getAttribute("aria-expanded");
|
|
40
|
+
g !== null ? e.setAttribute("aria-expanded", g) : e.removeAttribute("aria-expanded"), t.removeAttribute("aria-label"), t.removeAttribute("aria-controls"), t.removeAttribute("aria-expanded"), this.removeAttribute("aria-expanded"), ($ = this.__ariaObserver) == null || $.disconnect(), this.__ariaObserver = new MutationObserver((S) => {
|
|
41
|
+
const c = this.__getMdHost(), p = this.__getInnerNativeButton(c);
|
|
42
|
+
if (!(!c || !p)) {
|
|
43
43
|
for (const f of S) {
|
|
44
44
|
if (f.type !== "attributes" || !f.attributeName) continue;
|
|
45
45
|
const d = f.attributeName, v = this.getAttribute(d);
|
|
46
46
|
if (d === "aria-label") {
|
|
47
47
|
const I = (c.getAttribute("aria-label") || "").trim(), _ = (v || I || (this.label.trim() === "" ? (this.icon || "").trim() : "")).trim();
|
|
48
|
-
_ ?
|
|
49
|
-
} else (d === "aria-controls" || d === "aria-expanded") && (v === null ?
|
|
48
|
+
_ ? p.setAttribute("aria-label", _) : p.removeAttribute("aria-label"), c.removeAttribute("aria-label");
|
|
49
|
+
} else (d === "aria-controls" || d === "aria-expanded") && (v === null ? p.removeAttribute(d) : p.setAttribute(d, v), d === "aria-expanded" && this.removeAttribute("aria-expanded"));
|
|
50
50
|
}
|
|
51
51
|
c.removeAttribute("aria-label"), c.removeAttribute("aria-controls"), c.removeAttribute("aria-expanded");
|
|
52
52
|
}
|
|
@@ -62,11 +62,11 @@ let o = class extends k {
|
|
|
62
62
|
const t = this.closest("form");
|
|
63
63
|
t && (this.type === "submit" && t.requestSubmit(), this.type === "reset" && t.reset());
|
|
64
64
|
}
|
|
65
|
-
}), this.__syncAriaToInner(), A(this, m,
|
|
65
|
+
}), this.__syncAriaToInner(), A(this, m, y).call(this);
|
|
66
66
|
}
|
|
67
67
|
// Kör även när variant/icon/spacing ändras
|
|
68
68
|
updated(t) {
|
|
69
|
-
t.has("variant") && this.__syncAriaToInner(), (t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom")) && A(this, m,
|
|
69
|
+
t.has("variant") && this.__syncAriaToInner(), (t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom")) && A(this, m, y).call(this);
|
|
70
70
|
}
|
|
71
71
|
disconnectedCallback() {
|
|
72
72
|
var t;
|
|
@@ -79,7 +79,7 @@ let o = class extends k {
|
|
|
79
79
|
return /^\d+$/.test(e) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(e, 10)))})` : e;
|
|
80
80
|
}
|
|
81
81
|
static get styles() {
|
|
82
|
-
return
|
|
82
|
+
return w`
|
|
83
83
|
/* Gör hosten stretchbar i t.ex. flex/grid */
|
|
84
84
|
:host {
|
|
85
85
|
display: inline-flex;
|
|
@@ -88,6 +88,11 @@ let o = class extends k {
|
|
|
88
88
|
margin-block-end: var(--scb-button-spacing-block-end, 0);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
:host([full-width]) {
|
|
92
|
+
display: flex;
|
|
93
|
+
inline-size: 100%;
|
|
94
|
+
}
|
|
95
|
+
|
|
91
96
|
/* Låt inre md-knappar fylla hostens höjd */
|
|
92
97
|
md-filled-button,
|
|
93
98
|
md-outlined-button,
|
|
@@ -96,6 +101,14 @@ let o = class extends k {
|
|
|
96
101
|
block-size: 100%;
|
|
97
102
|
}
|
|
98
103
|
|
|
104
|
+
:host([full-width]) md-filled-button,
|
|
105
|
+
:host([full-width]) md-outlined-button,
|
|
106
|
+
:host([full-width]) md-filled-tonal-button,
|
|
107
|
+
:host([full-width]) md-text-button {
|
|
108
|
+
inline-size: 100%;
|
|
109
|
+
flex: 1 1 auto;
|
|
110
|
+
}
|
|
111
|
+
|
|
99
112
|
/* Errorvarianter */
|
|
100
113
|
/*
|
|
101
114
|
md-filled-button[variant='error'],
|
|
@@ -143,17 +156,17 @@ let o = class extends k {
|
|
|
143
156
|
`;
|
|
144
157
|
}
|
|
145
158
|
render() {
|
|
146
|
-
var
|
|
147
|
-
const t = !!((
|
|
159
|
+
var l;
|
|
160
|
+
const t = !!((l = this.icon) != null && l.trim()), e = t ? h`<md-icon slot="icon">${this.icon}</md-icon>` : r, i = r, s = this.label.trim() === "" ? this.icon : void 0;
|
|
148
161
|
switch (this.variant) {
|
|
149
162
|
case "filled":
|
|
150
|
-
return
|
|
163
|
+
return h`
|
|
151
164
|
<md-filled-button
|
|
152
165
|
type=${this.type}
|
|
153
166
|
variant=${i}
|
|
154
167
|
?trailing-icon=${this.trailingIcon}
|
|
155
168
|
?disabled=${this.disabled}
|
|
156
|
-
aria-label=${
|
|
169
|
+
aria-label=${s}
|
|
157
170
|
href=${this.href || r}
|
|
158
171
|
target=${this.target || r}
|
|
159
172
|
rel=${this.rel || r}
|
|
@@ -164,13 +177,13 @@ let o = class extends k {
|
|
|
164
177
|
</md-filled-button>
|
|
165
178
|
`;
|
|
166
179
|
case "outlined":
|
|
167
|
-
return
|
|
180
|
+
return h`
|
|
168
181
|
<md-outlined-button
|
|
169
182
|
type=${this.type}
|
|
170
183
|
variant=${i}
|
|
171
184
|
?trailing-icon=${this.trailingIcon}
|
|
172
185
|
?disabled=${this.disabled}
|
|
173
|
-
aria-label=${
|
|
186
|
+
aria-label=${s}
|
|
174
187
|
href=${this.href || r}
|
|
175
188
|
target=${this.target || r}
|
|
176
189
|
rel=${this.rel || r}
|
|
@@ -181,13 +194,13 @@ let o = class extends k {
|
|
|
181
194
|
</md-outlined-button>
|
|
182
195
|
`;
|
|
183
196
|
case "filled-tonal":
|
|
184
|
-
return
|
|
197
|
+
return h`
|
|
185
198
|
<md-filled-tonal-button
|
|
186
199
|
type=${this.type}
|
|
187
200
|
variant=${i}
|
|
188
201
|
?trailing-icon=${this.trailingIcon}
|
|
189
202
|
?disabled=${this.disabled}
|
|
190
|
-
aria-label=${
|
|
203
|
+
aria-label=${s}
|
|
191
204
|
href=${this.href || r}
|
|
192
205
|
target=${this.target || r}
|
|
193
206
|
rel=${this.rel || r}
|
|
@@ -198,13 +211,13 @@ let o = class extends k {
|
|
|
198
211
|
</md-filled-tonal-button>
|
|
199
212
|
`;
|
|
200
213
|
case "text":
|
|
201
|
-
return
|
|
214
|
+
return h`
|
|
202
215
|
<md-text-button
|
|
203
216
|
type=${this.type}
|
|
204
217
|
variant=${i}
|
|
205
218
|
?trailing-icon=${this.trailingIcon}
|
|
206
219
|
?disabled=${this.disabled}
|
|
207
|
-
aria-label=${
|
|
220
|
+
aria-label=${s}
|
|
208
221
|
href=${this.href || r}
|
|
209
222
|
target=${this.target || r}
|
|
210
223
|
rel=${this.rel || r}
|
|
@@ -215,52 +228,55 @@ let o = class extends k {
|
|
|
215
228
|
</md-text-button>
|
|
216
229
|
`;
|
|
217
230
|
default:
|
|
218
|
-
return
|
|
231
|
+
return h``;
|
|
219
232
|
}
|
|
220
233
|
}
|
|
221
234
|
};
|
|
222
235
|
m = /* @__PURE__ */ new WeakSet();
|
|
223
|
-
|
|
236
|
+
y = function() {
|
|
224
237
|
const t = this.mapSpacingToken(this.spacing), e = this.mapSpacingToken(this.spacingTop) ?? t, i = this.mapSpacingToken(this.spacingBottom) ?? t;
|
|
225
238
|
e ? this.style.setProperty("--scb-button-spacing-block-start", e) : this.style.removeProperty("--scb-button-spacing-block-start"), i ? this.style.setProperty("--scb-button-spacing-block-end", i) : this.style.removeProperty("--scb-button-spacing-block-end");
|
|
226
239
|
};
|
|
227
|
-
|
|
228
|
-
|
|
240
|
+
n([
|
|
241
|
+
a({ type: String, reflect: !0 })
|
|
229
242
|
], o.prototype, "variant", 2);
|
|
230
|
-
|
|
231
|
-
|
|
243
|
+
n([
|
|
244
|
+
a({ type: String, reflect: !0 })
|
|
232
245
|
], o.prototype, "type", 2);
|
|
233
|
-
|
|
234
|
-
|
|
246
|
+
n([
|
|
247
|
+
a({ type: String })
|
|
235
248
|
], o.prototype, "label", 2);
|
|
236
|
-
|
|
237
|
-
|
|
249
|
+
n([
|
|
250
|
+
a({ type: Boolean, attribute: "trailing-icon" })
|
|
238
251
|
], o.prototype, "trailingIcon", 2);
|
|
239
|
-
|
|
240
|
-
|
|
252
|
+
n([
|
|
253
|
+
a({ type: String })
|
|
241
254
|
], o.prototype, "icon", 2);
|
|
242
|
-
|
|
243
|
-
|
|
255
|
+
n([
|
|
256
|
+
a({ type: Boolean, reflect: !0 })
|
|
244
257
|
], o.prototype, "disabled", 2);
|
|
245
|
-
|
|
246
|
-
|
|
258
|
+
n([
|
|
259
|
+
a({ type: Boolean, attribute: "full-width", reflect: !0 })
|
|
260
|
+
], o.prototype, "fullWidth", 2);
|
|
261
|
+
n([
|
|
262
|
+
a({ type: String })
|
|
247
263
|
], o.prototype, "href", 2);
|
|
248
|
-
|
|
249
|
-
|
|
264
|
+
n([
|
|
265
|
+
a({ type: String })
|
|
250
266
|
], o.prototype, "target", 2);
|
|
251
|
-
|
|
252
|
-
|
|
267
|
+
n([
|
|
268
|
+
a({ type: String })
|
|
253
269
|
], o.prototype, "rel", 2);
|
|
254
|
-
|
|
255
|
-
|
|
270
|
+
n([
|
|
271
|
+
a({ type: String, reflect: !0 })
|
|
256
272
|
], o.prototype, "spacing", 2);
|
|
257
|
-
|
|
258
|
-
|
|
273
|
+
n([
|
|
274
|
+
a({ type: String, attribute: "spacing-top", reflect: !0 })
|
|
259
275
|
], o.prototype, "spacingTop", 2);
|
|
260
|
-
|
|
261
|
-
|
|
276
|
+
n([
|
|
277
|
+
a({ type: String, attribute: "spacing-bottom", reflect: !0 })
|
|
262
278
|
], o.prototype, "spacingBottom", 2);
|
|
263
|
-
o =
|
|
279
|
+
o = n([
|
|
264
280
|
B("scb-button")
|
|
265
281
|
], o);
|
|
266
282
|
export {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
export declare class ScbCalendarEvent extends LitElement {
|
|
3
3
|
title: string;
|
|
4
|
-
date: string;
|
|
5
4
|
description: string;
|
|
5
|
+
startDate: string;
|
|
6
|
+
endDate: string;
|
|
6
7
|
static styles: import('lit').CSSResult;
|
|
8
|
+
updated(changedProps: Map<string, any>): void;
|
|
7
9
|
render(): import('lit-html').TemplateResult<1>;
|
|
8
10
|
}
|