scb-wc 0.1.201 → 0.1.202
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/README.md +17 -20
- package/all.js +0 -12
- package/index.js +85 -97
- package/mvc/components/all.js +0 -7
- package/mvc/components/scb-accordion/scb-accordion-item.js +1 -1
- package/mvc/components/scb-accordion/scb-accordion.js +1 -1
- package/mvc/components/scb-app-bar/scb-app-bar.js +1 -1
- package/mvc/components/scb-button/scb-button.js +3 -3
- package/mvc/components/scb-calendar/scb-calendar.js +1 -1
- package/mvc/components/scb-calendar-card/scb-calendar-card.js +4 -4
- package/mvc/components/scb-card/scb-card.js +2 -2
- package/mvc/components/scb-cookies-consent/scb-cookies-consent.js +1 -1
- package/mvc/components/scb-dialog/scb-dialog.js +1 -1
- package/mvc/components/scb-drawer/scb-drawer.js +3 -3
- package/mvc/components/scb-drop-zone/scb-drop-zone.js +1 -1
- package/mvc/components/scb-dropdown/scb-dropdown.js +2 -2
- package/mvc/components/scb-fact-card/scb-fact-card.js +1 -1
- package/mvc/components/scb-header/scb-header.js +2 -2
- package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +6 -6
- package/mvc/components/scb-icon-button/scb-icon-button.js +5 -5
- package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +6 -6
- package/mvc/components/scb-link/scb-link.js +1 -1
- package/mvc/components/scb-link-button/scb-link-button.js +1 -1
- package/mvc/components/scb-list/scb-list-item.js +6 -6
- package/mvc/components/scb-menu/scb-menu-item.js +1 -1
- package/mvc/components/scb-nav/scb-nav.js +1 -1
- package/mvc/components/scb-notification-card/scb-notification-card.js +1 -1
- package/mvc/components/scb-options-menu/scb-options-menu-item.js +1 -1
- package/mvc/components/scb-options-menu/scb-options-menu.js +2 -2
- package/mvc/components/scb-options-menu/scb-options-sub-menu.js +1 -1
- package/mvc/components/scb-overlay/scb-overlay.js +3 -3
- package/mvc/components/scb-pagination/scb-pagination.js +1 -1
- package/mvc/components/scb-progress-stepper/scb-progress-step.js +1 -1
- package/mvc/components/scb-search/scb-search.js +3 -3
- package/mvc/components/scb-segmented-button/scb-segmented-item.js +1 -1
- package/mvc/components/scb-select/scb-select-option.js +1 -1
- package/mvc/components/scb-select/scb-select.js +1 -1
- package/mvc/components/scb-snackbar/scb-snackbar.js +1 -1
- package/mvc/components/scb-stepper/scb-step.js +1 -1
- package/mvc/components/scb-table/scb-table.js +1 -1
- package/mvc/components/scb-table-advanced/scb-table-advanced.js +1 -1
- package/mvc/components/scb-textfield/scb-textfield.js +175 -33
- package/mvc/components/scb-toc/scb-toc-item.js +1 -1
- package/mvc/components/scb-tooltip/scb-tooltip.js +1 -1
- package/mvc/{components/shared → vendor}/component-size-token.js +1 -1
- package/mvc/vendor/lazy-focus-ring.js +2 -0
- package/mvc/vendor/lazy-ripple.js +2 -0
- package/mvc/{components/shared → vendor}/manual-popover.js +1 -1
- package/mvc/{components/scb-chevron → vendor}/scb-chevron.js +1 -1
- package/mvc/vendor/scb-icon-svg.js +11 -0
- package/package.json +2 -2
- package/scb-viz/scb-viz-series-differentiation-registry.js +7 -10
- package/scb-viz/scb-viz.js +43 -43
- package/scb-wc-public-entry/index.d.ts +94 -0
- package/scb-wc.bundle.js +288 -288
- package/scb-wc.d.ts +188 -212
- package/shared/scb-icon-svg.js +2 -5
- package/mvc/components/scb-datepicker/scb-datepicker.js +0 -143
- package/mvc/components/shared/lazy-focus-ring.js +0 -2
- package/mvc/components/shared/lazy-ripple.js +0 -2
- package/mvc/components/shared/scb-icon-svg.js +0 -11
- package/scb-components/index.d.ts +0 -106
- package/scb-components/scb-chevron/scb-chevron.d.ts +0 -11
- package/scb-components/scb-datepicker/scb-datepicker.d.ts +0 -47
- package/scb-components/scb-viz/scb-viz-actions-runtime.d.ts +0 -26
- package/scb-components/scb-viz/scb-viz-print-runtime.d.ts +0 -30
- package/scb-components/scb-viz/scb-viz-series-differentiation-registry.d.ts +0 -21
- package/scb-components/scb-viz/scb-viz-series-differentiation-runtime.d.ts +0 -42
- package/scb-components/scb-viz/scb-viz-table-runtime.d.ts +0 -28
- package/scb-components/shared/component-size-token.d.ts +0 -1
- package/scb-components/shared/lazy-focus-ring.d.ts +0 -4
- package/scb-components/shared/lazy-ripple.d.ts +0 -9
- package/scb-components/shared/manual-popover.d.ts +0 -7
- package/scb-components/shared/scb-icon-svg.d.ts +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as J,h as X,m as Z,p as _,v as k,y as V}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{addLazyFocusRingListeners as ee}from"../shared/lazy-focus-ring.js";import{componentSizeToken as I}from"../shared/component-size-token.js";import{t as f}from"../../vendor/decorate.js";import{t as W}from"../../vendor/assertClassBrand.js";import{t as te}from"../../vendor/classPrivateMethodInitSpec.js";import"../scb-icon-button/scb-icon-button.js";import"./scb-calendar-event.js";import"../scb-dialog/scb-dialog.js";import"../scb-list/scb-list.js";(function(){try{var $=typeof globalThis<"u"?globalThis:window;if(!$.__scb_ce_guard_installed__){$.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,a,s){try{customElements.get(t)||e(t,a,s)}catch(r){var n=String(r||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw r}}}}catch{}})();var L,O,P={fromAttribute($){if($===null)return!1;const e=$.trim().toLowerCase();return e!=="false"&&e!=="0"&&e!=="no"}},m=(L=new WeakSet,O=class extends X{constructor(...e){super(...e),te(this,L),this._lastActiveDay=null,this.lang="sv",this.disableWeekend=!1,this.publicHolidays=!0,this.displayYear=new Date().getFullYear(),this.displayMonth=new Date().getMonth()+1,this.selectedDate="",this.eventsJson=void 0,this._eventsFromJson=null,this._eventsJsonLast=void 0,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._mutationObserver=null,this._syncingDisplay=!1,this._onCalendarKeyDown=t=>{const a=Array.from(this.shadowRoot?.querySelectorAll(".calendar-day[data-date]")??[]),s=this.shadowRoot?.activeElement,n=s&&a.includes(s)?s:document.activeElement,r=a.indexOf(n);if(r===-1)return;let l;switch(t.key){case"ArrowRight":l=a[r+1];break;case"ArrowLeft":l=a[r-1];break;case"ArrowDown":l=this.__dayOffsetFrom(n,7);break;case"ArrowUp":l=this.__dayOffsetFrom(n,-7);break;case"Home":l=Array.from(n.closest('[role="row"]')?.querySelectorAll(".calendar-day[data-date]")??[])[0];break;case"End":{const o=Array.from(n.closest('[role="row"]')?.querySelectorAll(".calendar-day[data-date]")??[]);l=o[o.length-1];break}case"PageUp":t.preventDefault(),this.__focusAdjacentMonth(n,-1);return;case"PageDown":t.preventDefault(),this.__focusAdjacentMonth(n,1);return;default:return}l&&l!==n&&(t.preventDefault(),this.__focusCalendarDay(l))},this._onEventChanged=()=>{this.requestUpdate()},this._today=new Date,this._current=new Date,this._rovingDate="",this._popupEvent=null,this._handleDialogClose=()=>{this._popupEvent=null,this.requestUpdate(),this._restoreDayFocus()},this._restoreDayFocus=()=>{this._lastActiveDay&&setTimeout(()=>{this._lastActiveDay?.focus(),this._lastActiveDay=null},0)},this._easterDateCalculated={}}get value(){return this.selectedDate}set value(e){const t=(e??"")+"";t!==this.selectedDate&&(this.selectedDate=t)}static get observedAttributes(){return[...super.observedAttributes??[],"value"]}attributeChangedCallback(e,t,a){super.attributeChangedCallback(e,t,a),e==="value"&&(this.value=a??"")}connectedCallback(){super.connectedCallback(),this._removeLazyFocusRingListeners=ee(this,this.renderRoot),W(L,this,H).call(this);const e=Number(this.displayYear),t=Number(this.displayMonth);!Number.isNaN(e)&&!Number.isNaN(t)&&t>=1&&t<=12&&(this._current=new Date(e,t-1,1)),this._syncDisplayFromCurrent(!1),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),this._removeLazyFocusRingListeners?.(),this._removeLazyFocusRingListeners=void 0,super.disconnectedCallback(),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null),this.removeEventListener("keydown",this._onCalendarKeyDown)}mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}updated(e){if(super.updated?.(e),e.has("eventsJson")&&(this._eventsJsonLast=void 0,this._eventsFromJson=null),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&W(L,this,H).call(this),!this._syncingDisplay&&(e.has("displayYear")||e.has("displayMonth"))){const t=Number(this.displayYear),a=Number(this.displayMonth);if(!Number.isNaN(t)&&!Number.isNaN(a)&&a>=1&&a<=12){const s=this._current.getFullYear(),n=this._current.getMonth()+1;(s!==t||n!==a)&&(this._current=new Date(t,a-1,1),this._dispatchMonthChange(t,a),this.requestUpdate())}}}_ensureEventsFromJson(){const e=(this.eventsJson??"").trim();if(!e){this._eventsFromJson=null,this._eventsJsonLast=e;return}if(!(this._eventsJsonLast===e&&this._eventsFromJson!==null)){this._eventsJsonLast=e;try{const t=JSON.parse(e);Array.isArray(t)?this._eventsFromJson=t:this._eventsFromJson=[]}catch{this._eventsFromJson=[]}}}_getEventInputs(){return Array.isArray(this.events)?this.events:(this._ensureEventsFromJson(),this._eventsFromJson!==null?this._eventsFromJson:null)}_normalizeEventInput(e){const t=e.title??"",a=e.description??"",s=e.href??"",n=e.startDate??e["start-date"]??e.start??e.date??"",r=e.endDate??e["end-date"]??e.end??"";return{title:t+"",description:a?a+"":void 0,href:s?s+"":void 0,start:n?n+"":void 0,end:r?r+"":void 0}}_toLocalEventDate(e,t){const a=(e??"").trim();if(!a)return null;if(!a.includes("T")){const n=a.split("-").map(d=>Number(d));if(n.length!==3||n.some(d=>Number.isNaN(d)))return null;const[r,l,o]=n;return t?new Date(r,l-1,o,23,59,59,999):new Date(r,l-1,o,0,0,0,0)}const s=new Date(a);return Number.isNaN(s.getTime())?null:s}_toDateKey(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}_buildEventMapFromInputs(e){const t=new Map;for(const a of e){const s=this._normalizeEventInput(a),n=s.start||"",r=s.end||"";if(!(!n||!s.title))if(n&&r){const l=this._toLocalEventDate(n,!1),o=this._toLocalEventDate(r,!0);if(!l||!o)continue;if(o<l){const d=n.split("T")[0],u=t.get(d)||[];u.push({title:s.title,description:s.description,href:s.href,start:n,end:r}),t.set(d,u);continue}for(let d=new Date(l);d<=o;d.setDate(d.getDate()+1)){const u=this._toDateKey(d),E=t.get(u)||[];E.push({title:s.title,description:s.description,href:s.href,start:n,end:r}),t.set(u,E)}}else{const l=n.split("T")[0],o=t.get(l)||[];o.push({title:s.title,description:s.description,href:s.href,start:n}),t.set(l,o)}}return t}_buildEventMapFromChildren(){const e=Array.from(this.querySelectorAll("scb-calendar-event")),t=new Map;for(const a of e){const s=a,n=(s.startDate??s.date??"")+""||a.getAttribute("start-date")||a.getAttribute("date")||"",r=(s.endDate??"")+""||a.getAttribute("end-date")||"";if(n&&r){const l=this._toLocalEventDate(n,!1),o=this._toLocalEventDate(r,!0);if(!l||!o)continue;if(o<l){const d=n.split("T")[0],u=t.get(d)||[];u.push({title:a.title??"",description:a.description,href:s.href||a.getAttribute("href")||void 0,start:n,end:r}),t.set(d,u);continue}for(let d=new Date(l);d<=o;d.setDate(d.getDate()+1)){const u=this._toDateKey(d),E=t.get(u)||[];E.push({title:a.title??"",description:a.description,href:s.href||a.getAttribute("href")||void 0,start:n,end:r}),t.set(u,E)}}else if(n&&a.title){const l=n.split("T")[0],o=t.get(l)||[];o.push({title:a.title,description:a.description,href:s.href||a.getAttribute("href")||void 0,start:n}),t.set(l,o)}}return t}_syncDisplayFromCurrent(e=!0){const t=this._current.getFullYear(),a=this._current.getMonth()+1;this._syncingDisplay=!0;try{this.displayYear=t,this.displayMonth=a}finally{this._syncingDisplay=!1}e&&this._dispatchMonthChange(t,a)}_dispatchMonthChange(e,t){const a={displayYear:e,displayMonth:t};this.dispatchEvent(new CustomEvent("scb-calendar-month-change",{bubbles:!0,composed:!0,detail:a})),this.dispatchEvent(new CustomEvent("scbcalendarmonthchange",{bubbles:!0,composed:!0,detail:a}))}_dispatchSelect(e){const t={selectedDate:e};this.dispatchEvent(new CustomEvent("scb-calendar-select",{bubbles:!0,composed:!0,detail:t})),this.dispatchEvent(new CustomEvent("scbcalendarselect",{bubbles:!0,composed:!0,detail:t}))}_formatDayLabel(e){return new Intl.DateTimeFormat(this.lang==="en"?"en-GB":"sv-SE",{day:"numeric",month:"long",year:"numeric"}).format(e)}_formatDayAriaLabel(e,t,a){const s=a.map(r=>`${r.prefix||""}${r.title}`.trim()).filter(Boolean),n=[this._formatDayLabel(e)];return t&&n.push(t),s.length===1?n.push(this.lang==="en"?`1 event: ${s[0]}`:`1 händelse: ${s[0]}`):s.length>1&&n.push(this.lang==="en"?`${s.length} events: ${s.join(", ")}`:`${s.length} händelser: ${s.join(", ")}`),n.join(". ")}__dayOffsetFrom(e,t){const a=e.dataset.date;if(!a)return;const s=new Date(`${a}T12:00:00`);s.setDate(s.getDate()+t);const n=this.__formatDateKey(s);return this.shadowRoot?.querySelector(`.calendar-day[data-date="${n}"]`)??void 0}__formatDateKey(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}__focusCalendarDay(e){this.shadowRoot?.querySelectorAll(".calendar-day[data-date]").forEach(t=>{t.tabIndex=t===e?0:-1}),this._rovingDate=e.dataset.date??"",e.focus()}__focusAdjacentMonth(e,t){const a=e.dataset.date;if(!a)return;const s=new Date(`${a}T12:00:00`),n=new Date(s.getFullYear(),s.getMonth()+t,1),r=Math.min(s.getDate(),this._daysInMonth(n.getFullYear(),n.getMonth())),l=new Date(n.getFullYear(),n.getMonth(),r);this._current=new Date(l.getFullYear(),l.getMonth(),1),this.selectedDate="",this._popupEvent=null,this._rovingDate=this.__formatDateKey(l),this._syncDisplayFromCurrent(),this.requestUpdate(),this.updateComplete.then(()=>{const o=this.shadowRoot?.querySelector(`.calendar-day[data-date="${this._rovingDate}"]`);o&&this.__focusCalendarDay(o)})}_daysInMonth(e,t){return new Date(e,t+1,0).getDate()}_firstDayOfWeek(e,t){const a=new Date(e,t,1).getDay();return a===0?6:a-1}_prevMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()-1,1),this.selectedDate="",this._popupEvent=null,this._syncDisplayFromCurrent(),this.requestUpdate()}_nextMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()+1,1),this.selectedDate="",this._popupEvent=null,this._syncDisplayFromCurrent(),this.requestUpdate()}_showEventPopup(e){this._popupEvent=e,this.selectedDate=e.date,this._dispatchSelect(e.date),this._lastActiveDay=this.shadowRoot?.activeElement||document.activeElement,this.requestUpdate(),this.updateComplete.then(()=>{const t=this.shadowRoot?.querySelector("scb-dialog");t&&(document.activeElement&&(t.__lastTriggerEl=document.activeElement),requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.open=!0})}),t.addEventListener("close",this._handleDialogClose,{once:!0}))})}_addDays(e,t){const a=new Date(e.valueOf());return a.setDate(a.getDate()+t),a}_easterDay(e){if(typeof this._easterDateCalculated["Ar"+e]<"u")return new Date(this._easterDateCalculated["Ar"+e]);let t=e;t<100&&(t=t+1900),t<1950&&(t=t+100);const a=t%19,s=t%4,n=t%7,r=(19*a+24)%30,l=(2*s+4*n+6*r+5)%7;let o=22+r+l,d=0;o==57&&(o-=7),o==56&&r==28&&l==6&&a>10&&(o-=7),o>31?(o-=31,d=4):d=3;const u=new Date(t,d-1,o);return this._easterDateCalculated["Ar"+e]=u,new Date(this._easterDateCalculated["Ar"+e])}_swedishHolidayName(e){const t=e.getMonth();if(t===1||t===6||t===7||t===8)return null;const a=e.getMonth()+1,s=e.getDate(),n=e.getFullYear(),r=this._easterDay(n),l=this.lang==="en",o=[["Nyårsdagen","New Year's Day",a===1&&s===1],["Trettondedag jul","Epiphany",a===1&&s===6],["Långfredag","Good Friday",+e==+this._addDays(r,-2)],["Påskdagen","Easter Sunday",+e==+r],["Annandag påsk","Easter Monday",+e==+this._addDays(r,1)],["Kristi himmelsfärdsdag","Ascension Day",+e==+this._addDays(r,39)],["Pingstdagen","Pentecost",+e==+this._addDays(r,50)&&n<2005],["Första maj","May Day",a===5&&s===1],["Nationaldagen","National Day",a===6&&s===6&&n>=2005],["Midsommarafton","Midsummer's Eve",a===6&&s>=19&&s<=25&&e.getDay()===5],["Midsommardagen","Midsummer's Day",a===6&&s>=20&&s<=26&&e.getDay()===6],["Julafton","Christmas Eve",a===12&&s===24],["Juldagen","Christmas Day",a===12&&s===25],["Annandag jul","Boxing Day",a===12&&s===26],["Alla helgons dag","All Saints' Day",a===10&&s>=31&&e.getDay()===6||a===11&&s<=6&&e.getDay()===6]];for(const d of o){const[u,E,M]=d;if(M)return l?E:u}return null}render(){const e=this._current.getFullYear(),t=this._current.getMonth(),a=this._daysInMonth(e,t),s=this._firstDayOfWeek(e,t),n=this._today,r=this.lang==="en",l=r?["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 o=r?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]:["Mån","Tis","Ons","Tor","Fre","Lör","Sön"];this.disableWeekend&&(o=o.slice(0,5));const d=this._getEventInputs(),u=d?this._buildEventMapFromInputs(d):this._buildEventMapFromChildren(),E=`${e}-${String(t+1).padStart(2,"0")}-`,M=new Date(e,t,1);if(this.disableWeekend)for(;M.getDay()===0||M.getDay()===6;)M.setDate(M.getDate()+1);const B=this.__formatDateKey(n),U=[...u.keys()].find(i=>{if(!i.startsWith(E))return!1;if(!this.disableWeekend)return!0;const h=new Date(`${i}T12:00:00`);return h.getDay()!==0&&h.getDay()!==6}),G=[this._rovingDate,this.selectedDate,B,U,this.__formatDateKey(M)].find(i=>i?.startsWith(E))??this.__formatDateKey(M),K=[];let N=1;for(let i=0;i<6;i++){const h=[],b=this.disableWeekend?[0,1,2,3,4]:[0,1,2,3,4,5,6];let p=N;for(let D=0;D<b.length;D++){const w=b[D];if(i===0&&w<s){if(!this.disableWeekend||w<5){const T=t===0?11:t-1,C=t===0?e-1:e,y=this._daysInMonth(C,T)-(s-w-1),z=new Date(C,T,y);h.push(k`
|
|
1
|
+
import{g as J,h as X,m as Z,p as _,v as k,y as V}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as ee}from"../../vendor/lazy-focus-ring.js";import{t as I}from"../../vendor/component-size-token.js";import{t as f}from"../../vendor/decorate.js";import{t as W}from"../../vendor/assertClassBrand.js";import{t as te}from"../../vendor/classPrivateMethodInitSpec.js";import"../scb-icon-button/scb-icon-button.js";import"./scb-calendar-event.js";import"../scb-dialog/scb-dialog.js";import"../scb-list/scb-list.js";(function(){try{var $=typeof globalThis<"u"?globalThis:window;if(!$.__scb_ce_guard_installed__){$.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,a,s){try{customElements.get(t)||e(t,a,s)}catch(r){var n=String(r||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw r}}}}catch{}})();var L,O,P={fromAttribute($){if($===null)return!1;const e=$.trim().toLowerCase();return e!=="false"&&e!=="0"&&e!=="no"}},m=(L=new WeakSet,O=class extends X{constructor(...e){super(...e),te(this,L),this._lastActiveDay=null,this.lang="sv",this.disableWeekend=!1,this.publicHolidays=!0,this.displayYear=new Date().getFullYear(),this.displayMonth=new Date().getMonth()+1,this.selectedDate="",this.eventsJson=void 0,this._eventsFromJson=null,this._eventsJsonLast=void 0,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._mutationObserver=null,this._syncingDisplay=!1,this._onCalendarKeyDown=t=>{const a=Array.from(this.shadowRoot?.querySelectorAll(".calendar-day[data-date]")??[]),s=this.shadowRoot?.activeElement,n=s&&a.includes(s)?s:document.activeElement,r=a.indexOf(n);if(r===-1)return;let l;switch(t.key){case"ArrowRight":l=a[r+1];break;case"ArrowLeft":l=a[r-1];break;case"ArrowDown":l=this.__dayOffsetFrom(n,7);break;case"ArrowUp":l=this.__dayOffsetFrom(n,-7);break;case"Home":l=Array.from(n.closest('[role="row"]')?.querySelectorAll(".calendar-day[data-date]")??[])[0];break;case"End":{const o=Array.from(n.closest('[role="row"]')?.querySelectorAll(".calendar-day[data-date]")??[]);l=o[o.length-1];break}case"PageUp":t.preventDefault(),this.__focusAdjacentMonth(n,-1);return;case"PageDown":t.preventDefault(),this.__focusAdjacentMonth(n,1);return;default:return}l&&l!==n&&(t.preventDefault(),this.__focusCalendarDay(l))},this._onEventChanged=()=>{this.requestUpdate()},this._today=new Date,this._current=new Date,this._rovingDate="",this._popupEvent=null,this._handleDialogClose=()=>{this._popupEvent=null,this.requestUpdate(),this._restoreDayFocus()},this._restoreDayFocus=()=>{this._lastActiveDay&&setTimeout(()=>{this._lastActiveDay?.focus(),this._lastActiveDay=null},0)},this._easterDateCalculated={}}get value(){return this.selectedDate}set value(e){const t=(e??"")+"";t!==this.selectedDate&&(this.selectedDate=t)}static get observedAttributes(){return[...super.observedAttributes??[],"value"]}attributeChangedCallback(e,t,a){super.attributeChangedCallback(e,t,a),e==="value"&&(this.value=a??"")}connectedCallback(){super.connectedCallback(),this._removeLazyFocusRingListeners=ee(this,this.renderRoot),W(L,this,H).call(this);const e=Number(this.displayYear),t=Number(this.displayMonth);!Number.isNaN(e)&&!Number.isNaN(t)&&t>=1&&t<=12&&(this._current=new Date(e,t-1,1)),this._syncDisplayFromCurrent(!1),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),this._removeLazyFocusRingListeners?.(),this._removeLazyFocusRingListeners=void 0,super.disconnectedCallback(),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null),this.removeEventListener("keydown",this._onCalendarKeyDown)}mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}updated(e){if(super.updated?.(e),e.has("eventsJson")&&(this._eventsJsonLast=void 0,this._eventsFromJson=null),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&W(L,this,H).call(this),!this._syncingDisplay&&(e.has("displayYear")||e.has("displayMonth"))){const t=Number(this.displayYear),a=Number(this.displayMonth);if(!Number.isNaN(t)&&!Number.isNaN(a)&&a>=1&&a<=12){const s=this._current.getFullYear(),n=this._current.getMonth()+1;(s!==t||n!==a)&&(this._current=new Date(t,a-1,1),this._dispatchMonthChange(t,a),this.requestUpdate())}}}_ensureEventsFromJson(){const e=(this.eventsJson??"").trim();if(!e){this._eventsFromJson=null,this._eventsJsonLast=e;return}if(!(this._eventsJsonLast===e&&this._eventsFromJson!==null)){this._eventsJsonLast=e;try{const t=JSON.parse(e);Array.isArray(t)?this._eventsFromJson=t:this._eventsFromJson=[]}catch{this._eventsFromJson=[]}}}_getEventInputs(){return Array.isArray(this.events)?this.events:(this._ensureEventsFromJson(),this._eventsFromJson!==null?this._eventsFromJson:null)}_normalizeEventInput(e){const t=e.title??"",a=e.description??"",s=e.href??"",n=e.startDate??e["start-date"]??e.start??e.date??"",r=e.endDate??e["end-date"]??e.end??"";return{title:t+"",description:a?a+"":void 0,href:s?s+"":void 0,start:n?n+"":void 0,end:r?r+"":void 0}}_toLocalEventDate(e,t){const a=(e??"").trim();if(!a)return null;if(!a.includes("T")){const n=a.split("-").map(d=>Number(d));if(n.length!==3||n.some(d=>Number.isNaN(d)))return null;const[r,l,o]=n;return t?new Date(r,l-1,o,23,59,59,999):new Date(r,l-1,o,0,0,0,0)}const s=new Date(a);return Number.isNaN(s.getTime())?null:s}_toDateKey(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}_buildEventMapFromInputs(e){const t=new Map;for(const a of e){const s=this._normalizeEventInput(a),n=s.start||"",r=s.end||"";if(!(!n||!s.title))if(n&&r){const l=this._toLocalEventDate(n,!1),o=this._toLocalEventDate(r,!0);if(!l||!o)continue;if(o<l){const d=n.split("T")[0],u=t.get(d)||[];u.push({title:s.title,description:s.description,href:s.href,start:n,end:r}),t.set(d,u);continue}for(let d=new Date(l);d<=o;d.setDate(d.getDate()+1)){const u=this._toDateKey(d),E=t.get(u)||[];E.push({title:s.title,description:s.description,href:s.href,start:n,end:r}),t.set(u,E)}}else{const l=n.split("T")[0],o=t.get(l)||[];o.push({title:s.title,description:s.description,href:s.href,start:n}),t.set(l,o)}}return t}_buildEventMapFromChildren(){const e=Array.from(this.querySelectorAll("scb-calendar-event")),t=new Map;for(const a of e){const s=a,n=(s.startDate??s.date??"")+""||a.getAttribute("start-date")||a.getAttribute("date")||"",r=(s.endDate??"")+""||a.getAttribute("end-date")||"";if(n&&r){const l=this._toLocalEventDate(n,!1),o=this._toLocalEventDate(r,!0);if(!l||!o)continue;if(o<l){const d=n.split("T")[0],u=t.get(d)||[];u.push({title:a.title??"",description:a.description,href:s.href||a.getAttribute("href")||void 0,start:n,end:r}),t.set(d,u);continue}for(let d=new Date(l);d<=o;d.setDate(d.getDate()+1)){const u=this._toDateKey(d),E=t.get(u)||[];E.push({title:a.title??"",description:a.description,href:s.href||a.getAttribute("href")||void 0,start:n,end:r}),t.set(u,E)}}else if(n&&a.title){const l=n.split("T")[0],o=t.get(l)||[];o.push({title:a.title,description:a.description,href:s.href||a.getAttribute("href")||void 0,start:n}),t.set(l,o)}}return t}_syncDisplayFromCurrent(e=!0){const t=this._current.getFullYear(),a=this._current.getMonth()+1;this._syncingDisplay=!0;try{this.displayYear=t,this.displayMonth=a}finally{this._syncingDisplay=!1}e&&this._dispatchMonthChange(t,a)}_dispatchMonthChange(e,t){const a={displayYear:e,displayMonth:t};this.dispatchEvent(new CustomEvent("scb-calendar-month-change",{bubbles:!0,composed:!0,detail:a})),this.dispatchEvent(new CustomEvent("scbcalendarmonthchange",{bubbles:!0,composed:!0,detail:a}))}_dispatchSelect(e){const t={selectedDate:e};this.dispatchEvent(new CustomEvent("scb-calendar-select",{bubbles:!0,composed:!0,detail:t})),this.dispatchEvent(new CustomEvent("scbcalendarselect",{bubbles:!0,composed:!0,detail:t}))}_formatDayLabel(e){return new Intl.DateTimeFormat(this.lang==="en"?"en-GB":"sv-SE",{day:"numeric",month:"long",year:"numeric"}).format(e)}_formatDayAriaLabel(e,t,a){const s=a.map(r=>`${r.prefix||""}${r.title}`.trim()).filter(Boolean),n=[this._formatDayLabel(e)];return t&&n.push(t),s.length===1?n.push(this.lang==="en"?`1 event: ${s[0]}`:`1 händelse: ${s[0]}`):s.length>1&&n.push(this.lang==="en"?`${s.length} events: ${s.join(", ")}`:`${s.length} händelser: ${s.join(", ")}`),n.join(". ")}__dayOffsetFrom(e,t){const a=e.dataset.date;if(!a)return;const s=new Date(`${a}T12:00:00`);s.setDate(s.getDate()+t);const n=this.__formatDateKey(s);return this.shadowRoot?.querySelector(`.calendar-day[data-date="${n}"]`)??void 0}__formatDateKey(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}__focusCalendarDay(e){this.shadowRoot?.querySelectorAll(".calendar-day[data-date]").forEach(t=>{t.tabIndex=t===e?0:-1}),this._rovingDate=e.dataset.date??"",e.focus()}__focusAdjacentMonth(e,t){const a=e.dataset.date;if(!a)return;const s=new Date(`${a}T12:00:00`),n=new Date(s.getFullYear(),s.getMonth()+t,1),r=Math.min(s.getDate(),this._daysInMonth(n.getFullYear(),n.getMonth())),l=new Date(n.getFullYear(),n.getMonth(),r);this._current=new Date(l.getFullYear(),l.getMonth(),1),this.selectedDate="",this._popupEvent=null,this._rovingDate=this.__formatDateKey(l),this._syncDisplayFromCurrent(),this.requestUpdate(),this.updateComplete.then(()=>{const o=this.shadowRoot?.querySelector(`.calendar-day[data-date="${this._rovingDate}"]`);o&&this.__focusCalendarDay(o)})}_daysInMonth(e,t){return new Date(e,t+1,0).getDate()}_firstDayOfWeek(e,t){const a=new Date(e,t,1).getDay();return a===0?6:a-1}_prevMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()-1,1),this.selectedDate="",this._popupEvent=null,this._syncDisplayFromCurrent(),this.requestUpdate()}_nextMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()+1,1),this.selectedDate="",this._popupEvent=null,this._syncDisplayFromCurrent(),this.requestUpdate()}_showEventPopup(e){this._popupEvent=e,this.selectedDate=e.date,this._dispatchSelect(e.date),this._lastActiveDay=this.shadowRoot?.activeElement||document.activeElement,this.requestUpdate(),this.updateComplete.then(()=>{const t=this.shadowRoot?.querySelector("scb-dialog");t&&(document.activeElement&&(t.__lastTriggerEl=document.activeElement),requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.open=!0})}),t.addEventListener("close",this._handleDialogClose,{once:!0}))})}_addDays(e,t){const a=new Date(e.valueOf());return a.setDate(a.getDate()+t),a}_easterDay(e){if(typeof this._easterDateCalculated["Ar"+e]<"u")return new Date(this._easterDateCalculated["Ar"+e]);let t=e;t<100&&(t=t+1900),t<1950&&(t=t+100);const a=t%19,s=t%4,n=t%7,r=(19*a+24)%30,l=(2*s+4*n+6*r+5)%7;let o=22+r+l,d=0;o==57&&(o-=7),o==56&&r==28&&l==6&&a>10&&(o-=7),o>31?(o-=31,d=4):d=3;const u=new Date(t,d-1,o);return this._easterDateCalculated["Ar"+e]=u,new Date(this._easterDateCalculated["Ar"+e])}_swedishHolidayName(e){const t=e.getMonth();if(t===1||t===6||t===7||t===8)return null;const a=e.getMonth()+1,s=e.getDate(),n=e.getFullYear(),r=this._easterDay(n),l=this.lang==="en",o=[["Nyårsdagen","New Year's Day",a===1&&s===1],["Trettondedag jul","Epiphany",a===1&&s===6],["Långfredag","Good Friday",+e==+this._addDays(r,-2)],["Påskdagen","Easter Sunday",+e==+r],["Annandag påsk","Easter Monday",+e==+this._addDays(r,1)],["Kristi himmelsfärdsdag","Ascension Day",+e==+this._addDays(r,39)],["Pingstdagen","Pentecost",+e==+this._addDays(r,50)&&n<2005],["Första maj","May Day",a===5&&s===1],["Nationaldagen","National Day",a===6&&s===6&&n>=2005],["Midsommarafton","Midsummer's Eve",a===6&&s>=19&&s<=25&&e.getDay()===5],["Midsommardagen","Midsummer's Day",a===6&&s>=20&&s<=26&&e.getDay()===6],["Julafton","Christmas Eve",a===12&&s===24],["Juldagen","Christmas Day",a===12&&s===25],["Annandag jul","Boxing Day",a===12&&s===26],["Alla helgons dag","All Saints' Day",a===10&&s>=31&&e.getDay()===6||a===11&&s<=6&&e.getDay()===6]];for(const d of o){const[u,E,M]=d;if(M)return l?E:u}return null}render(){const e=this._current.getFullYear(),t=this._current.getMonth(),a=this._daysInMonth(e,t),s=this._firstDayOfWeek(e,t),n=this._today,r=this.lang==="en",l=r?["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 o=r?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]:["Mån","Tis","Ons","Tor","Fre","Lör","Sön"];this.disableWeekend&&(o=o.slice(0,5));const d=this._getEventInputs(),u=d?this._buildEventMapFromInputs(d):this._buildEventMapFromChildren(),E=`${e}-${String(t+1).padStart(2,"0")}-`,M=new Date(e,t,1);if(this.disableWeekend)for(;M.getDay()===0||M.getDay()===6;)M.setDate(M.getDate()+1);const B=this.__formatDateKey(n),U=[...u.keys()].find(i=>{if(!i.startsWith(E))return!1;if(!this.disableWeekend)return!0;const h=new Date(`${i}T12:00:00`);return h.getDay()!==0&&h.getDay()!==6}),G=[this._rovingDate,this.selectedDate,B,U,this.__formatDateKey(M)].find(i=>i?.startsWith(E))??this.__formatDateKey(M),K=[];let N=1;for(let i=0;i<6;i++){const h=[],b=this.disableWeekend?[0,1,2,3,4]:[0,1,2,3,4,5,6];let p=N;for(let D=0;D<b.length;D++){const w=b[D];if(i===0&&w<s){if(!this.disableWeekend||w<5){const T=t===0?11:t-1,C=t===0?e-1:e,y=this._daysInMonth(C,T)-(s-w-1),z=new Date(C,T,y);h.push(k`
|
|
2
2
|
<div
|
|
3
3
|
class="calendar-day calendar-day--other"
|
|
4
4
|
role="gridcell"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["
|
|
2
|
-
import{h as T,m as C,p as r,v as n,y as P}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as H}from"../../vendor/preload-helper.js";import{t as a}from"../../vendor/decorate.js";(function(){try{var
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/lazy-focus-ring.js","../../vendor/rolldown-runtime.js","../../vendor/preload-helper.js","../../vendor/lazy-ripple.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{h as T,m as C,p as r,v as n,y as P}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as H}from"../../vendor/preload-helper.js";import{t as a}from"../../vendor/decorate.js";(function(){try{var l=typeof globalThis<"u"?globalThis:window;if(!l.__scb_ce_guard_installed__){l.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(i,d,c){try{customElements.get(i)||t(i,d,c)}catch(o){var s=String(o||"");if(s.indexOf("already been used")===-1&&s.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var g,L=new Intl.DateTimeFormat("sv-SE",{month:"short"}),p={fromAttribute:l=>l??"",toAttribute:l=>typeof l!="string"||l.trim()===""?null:l},h,b;function I(){return h??(h=H(()=>import("../../vendor/lazy-focus-ring.js").then(l=>l.i),__vite__mapDeps([0,1,2]),import.meta.url)),h}function S(){return b??(b=H(()=>import("../../vendor/lazy-ripple.js"),__vite__mapDeps([3,2]),import.meta.url)),b}var e=(g=class extends T{constructor(...t){super(...t),this.variant="default",this.date=null,this.direction="horizontal",this.title="",this.calendarCardTitle="",this.subtitle="",this.supportingText="",this.cardHref="",this.cardHrefNav="",this.showMedia=null,this.dateLabelPrefix="Datum:",this.mediaWidth="",this.mediaHeight="",this.mediaAspect="",this.width="",this.maxWidth="",this.minWidth="",this.height="",this.maxHeight="",this.minHeight="",this.sizing="",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.__focusRingRequested=!1,this.__focusRingLoaded=!1,this.__rippleRequested=!1,this.__rippleLoaded=!1,this.__pendingRippleClick=!1,this.__onPointerInteraction=i=>{this.__ensureRipple(i)},this.__ensureFocusRingOnFocusVisible=()=>{this.__focusRingLoaded||this.__focusRingRequested||(this.__focusRingRequested=!0,I().then(({ensureFocusRingReady:i})=>i()).then(()=>{this.__focusRingLoaded=!0,this.requestUpdate()}))}}__hasSlottedContent(t){return!!this.querySelector(`[slot="${t}"]`)}__getSlottedText(t){return this.querySelector(`[slot="${t}"]`)?.textContent?.trim()??""}get __resolvedTitle(){return this.__getSlottedText("heading")||this.calendarCardTitle||this.title}get __resolvedSubtitle(){return this.__getSlottedText("subtitle")||this.subtitle}get __resolvedLabel(){return this.__resolvedTitle||this.__resolvedSubtitle||"Kalenderkort"}firstUpdated(){this.__applyInnerSizing(),this.__applySpacing()}__ensureRipple(t){if(this.cardHref){if(t&&(this.__pendingRippleEvent=t),this.__rippleLoaded){this.__syncRipple();return}this.__rippleRequested||(this.__rippleRequested=!0,S().then(({ensureRippleReady:i})=>i()).then(()=>{this.__rippleLoaded=!0,this.requestUpdate(),this.updateComplete.then(()=>this.__syncRipple())}))}}async __syncRipple(){const t=this.renderRoot.querySelector("md-ripple"),i=this.renderRoot.querySelector(".calendar-card"),d=this.__pendingRippleEvent,c=this.__pendingRippleClick;this.__pendingRippleEvent=void 0,this.__pendingRippleClick=!1;const{syncRippleToControl:s}=await S();await s(t,i,d,c)}render(){const t=this.variant?`${this.variant.toLowerCase()}`:"",i=this.direction?`${this.direction.toLowerCase()}`:"",d=this.cardHref?"clickable":"",c=this.__hasSlottedContent("heading"),s=this.__hasSlottedContent("subtitle"),o=this.__hasSlottedContent("supporting-text"),u=this.calendarCardTitle||this.title,v=this.subtitle,f=this.supportingText,m=c||!!u,y=s||!!v,R=o||!!f,{day:_,month:w}=this.__getDateParts(),z=this.mediaWidth&&this.mediaWidth.trim()!==""?this.mediaWidth:"",x=this.mediaHeight&&this.mediaHeight.trim()!==""?this.mediaHeight:"",k=this.mediaAspect&&this.mediaAspect.trim()!==""?this.mediaAspect:"",$=`${z?`inline-size:${z};`:""}${x?`block-size:${x};`:""}${k?`aspect-ratio:${k};`:""}`;return n`
|
|
3
3
|
<div
|
|
4
|
-
class="calendar-card ${i} ${
|
|
4
|
+
class="calendar-card ${i} ${d} ${t}"
|
|
5
5
|
role="${this.cardHref?"link":"group"}"
|
|
6
6
|
aria-label="${this.__resolvedLabel}"
|
|
7
7
|
tabindex="${this.cardHref?"0":"-1"}"
|
|
@@ -38,4 +38,4 @@ import{h as T,m as C,p as r,v as n,y as P}from"../../vendor/vendor.js";import"..
|
|
|
38
38
|
</div>
|
|
39
39
|
</div>
|
|
40
40
|
${this.cardHref&&this.__focusRingLoaded?n`<md-focus-ring></md-focus-ring>`:""}
|
|
41
|
-
`}__getDateParts(){const t={day:1,month:"Jan"};if(!this.date)return t;const i=this.date instanceof Date?this.date:(()=>{const s=new Date(String(this.date));return Number.isNaN(s.getTime())?null:s})();if(!i)return t;const l=i.getDate(),c=L.format(i).replace(".","").trim();return{day:l,month:c.charAt(0).toUpperCase()+c.slice(1)}}__applyInnerSizing(){const t=this.renderRoot.querySelector(".calendar-card");t&&(this.width&&this.width.trim()!==""?(t.style.inlineSize="100%",t.style.maxInlineSize="100%"):(t.style.removeProperty("inline-size"),t.style.removeProperty("max-inline-size")),this.height&&this.height.trim()!==""||this.sizing==="stretch"?t.style.blockSize="100%":t.style.removeProperty("block-size"),this.maxHeight&&this.maxHeight.trim()!==""?t.style.maxBlockSize="100%":t.style.removeProperty("max-block-size"))}_onKeyDown(t){(t.key==="Enter"||t.key===" ")&&this.cardHref&&(t.preventDefault(),this.__navigate())}_handleHrefNavigation(){this.cardHref&&((!this.__rippleLoaded||this.__pendingRippleEvent)&&(this.__pendingRippleClick=!0,this.__ensureRipple()),this.__navigate())}__navigate(){this.cardHref&&(this.cardHrefNav==="tab"?window.open(this.cardHref,"_blank"):this.cardHrefNav==="window"?window.open(this.cardHref,"_blank","noopener,noreferrer,width=800,height=600"):window.open(this.cardHref,"_self"))}mapSpacingToken(t){if(!t)return;const i=String(t).trim();if(i)return/^\d+$/.test(i)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(i,10)))})`:i}__applySpacing(){const t=this.mapSpacingToken(this.spacing),i=this.mapSpacingToken(this.spacingTop)??t,l=this.mapSpacingToken(this.spacingBottom)??t,c=this.mapSpacingToken(this.spacingLeft),s=this.mapSpacingToken(this.spacingRight);i?this.style.setProperty("--scb-calendar-card-spacing-block-start",i):this.style.removeProperty("--scb-calendar-card-spacing-block-start"),l?this.style.setProperty("--scb-calendar-card-spacing-block-end",l):this.style.removeProperty("--scb-calendar-card-spacing-block-end"),c?this.style.setProperty("--scb-calendar-card-spacing-inline-start",c):this.style.removeProperty("--scb-calendar-card-spacing-inline-start"),s?this.style.setProperty("--scb-calendar-card-spacing-inline-end",s):this.style.removeProperty("--scb-calendar-card-spacing-inline-end")}updated(t){t.has("width")&&(this.width?this.style.inlineSize=this.width:this.style.removeProperty("inline-size")),t.has("maxWidth")&&(this.maxWidth?this.style.maxInlineSize=this.maxWidth:this.style.removeProperty("max-inline-size")),t.has("minWidth")&&(this.minWidth?this.style.minInlineSize=this.minWidth:this.style.removeProperty("min-inline-size")),t.has("height")&&(this.height?this.style.blockSize=this.height:this.style.removeProperty("block-size")),t.has("maxHeight")&&(this.maxHeight?this.style.maxBlockSize=this.maxHeight:this.style.removeProperty("max-block-size")),t.has("minHeight")&&(this.minHeight?this.style.minBlockSize=this.minHeight:this.style.removeProperty("min-block-size")),(t.has("width")||t.has("height")||t.has("maxHeight")||t.has("sizing"))&&this.__applyInnerSizing(),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&this.__applySpacing()}},g.styles=P`:host{--scb-cards-title-font-weight-current:var(--scb-cards-title-large-font-weight, var(--scb-cards-title-large-weight, var(--scb-cards-title-font-weight, var(--scb-cards-title-weight))));--scb-cards-title-letter-spacing-current:var(--scb-cards-title-large-letter-spacing, var(--scb-cards-title-large-tracking, var(--scb-cards-title-letter-spacing, var(--scb-cards-title-tracking))));--scb-cards-title-line-height-current:var(--scb-cards-title-large-line-height, var(--scb-cards-title-line-height));--scb-cards-title-tracking-current:var(--scb-cards-title-large-tracking, var(--scb-cards-title-large-letter-spacing, var(--scb-cards-title-tracking, var(--scb-cards-title-letter-spacing))));--scb-cards-title-weight-current:var(--scb-cards-title-large-weight, var(--scb-cards-title-large-font-weight, var(--scb-cards-title-weight, var(--scb-cards-title-font-weight))));--scb-cards-title-size-current:var(--scb-cards-title-large-size, var(--scb-cards-title-size));--scb-cards-title-font-current:var(--scb-cards-title-large-font, var(--scb-cards-title-font));--scb-cards-subtitle-font-weight-current:var(--scb-cards-subtitle-large-font-weight, var(--scb-cards-subtitle-large-weight, var(--scb-cards-subtitle-font-weight, var(--scb-cards-subtitle-weight))));--scb-cards-subtitle-letter-spacing-current:var(--scb-cards-subtitle-large-letter-spacing, var(--scb-cards-subtitle-large-tracking, var(--scb-cards-subtitle-letter-spacing, var(--scb-cards-subtitle-tracking))));--scb-cards-subtitle-line-height-current:var(--scb-cards-subtitle-large-line-height, var(--scb-cards-subtitle-line-height));--scb-cards-subtitle-tracking-current:var(--scb-cards-subtitle-large-tracking, var(--scb-cards-subtitle-large-letter-spacing, var(--scb-cards-subtitle-tracking, var(--scb-cards-subtitle-letter-spacing))));--scb-cards-subtitle-weight-current:var(--scb-cards-subtitle-large-weight, var(--scb-cards-subtitle-large-font-weight, var(--scb-cards-subtitle-weight, var(--scb-cards-subtitle-font-weight))));--scb-cards-subtitle-size-current:var(--scb-cards-subtitle-large-size, var(--scb-cards-subtitle-size));--scb-cards-subtitle-font-current:var(--scb-cards-subtitle-large-font, var(--scb-cards-subtitle-font));--scb-cards-supporting-font-weight-current:var(--scb-cards-supporting-large-font-weight, var(--scb-cards-supporting-large-weight, var(--scb-cards-supporting-font-weight, var(--scb-cards-supporting-weight))));--scb-cards-supporting-letter-spacing-current:var(--scb-cards-supporting-large-letter-spacing, var(--scb-cards-supporting-large-tracking, var(--scb-cards-supporting-letter-spacing, var(--scb-cards-supporting-tracking))));--scb-cards-supporting-line-height-current:var(--scb-cards-supporting-large-line-height, var(--scb-cards-supporting-line-height));--scb-cards-supporting-tracking-current:var(--scb-cards-supporting-large-tracking, var(--scb-cards-supporting-large-letter-spacing, var(--scb-cards-supporting-tracking, var(--scb-cards-supporting-letter-spacing))));--scb-cards-supporting-weight-current:var(--scb-cards-supporting-large-weight, var(--scb-cards-supporting-large-font-weight, var(--scb-cards-supporting-weight, var(--scb-cards-supporting-font-weight))));--scb-cards-supporting-size-current:var(--scb-cards-supporting-large-size, var(--scb-cards-supporting-size));--scb-cards-supporting-font-current:var(--scb-cards-supporting-large-font, var(--scb-cards-supporting-font));display:block;position:relative;box-sizing:border-box;inline-size:100%;min-inline-size:0;padding:var(--scb-calendar-card-focus-ring-gap, 4px);margin-block-start:var(--scb-calendar-card-spacing-block-start, 0);margin-block-end:var(--scb-calendar-card-spacing-block-end, 0);margin-inline-start:var(--scb-calendar-card-spacing-inline-start, 0);margin-inline-end:var(--scb-calendar-card-spacing-inline-end, 0);--scb-calendar-card-padding-block:var(--scb-calendar-card-padding, var(--scb-cards-content-padding-block-large, var(--spacing-7, 24px)));--scb-calendar-card-padding-inline:var(--scb-calendar-card-padding, var(--scb-cards-content-padding-block-large, var(--spacing-7, 24px)));--scb-calendar-card-surface-radius:var(--scb-cards-surface-radius-large, var(--radius-large, 16px));--scb-calendar-card-border-width:var(--scb-cards-border-width-large, var(--stroke-border, 1px));--scb-calendar-card-gap:var(--scb-cards-calendar-gap-large, var(--spacing-4, 12px));--scb-calendar-card-horizontal-gap:var(--scb-cards-calendar-horizontal-gap-large, var(--spacing-6, 20px));--scb-calendar-card-horizontal-min-block-size:var(--scb-cards-calendar-horizontal-min-block-size-large, 112px);--scb-calendar-card-unframed-state-gap:var(--spacing-2, 4px);--scb-calendar-card-unframed-state-color:color-mix(in srgb, currentColor 8%, transparent);--scb-calendar-card-media-size:var(--scb-cards-calendar-media-size-large, var(--spacing-11, 64px));--scb-calendar-card-media-radius:var(--scb-cards-calendar-media-radius-large, var(--radius-small, 8px));--scb-calendar-card-media-gap:var(--scb-cards-calendar-media-gap-large, var(--spacing-2, 4px));--scb-calendar-card-day-size:var(--scb-cards-calendar-date-day-size-large, var(--scale-07, 28px));--scb-calendar-card-day-letter-spacing:-0.6px;--scb-calendar-card-month-size:var(--scb-cards-calendar-date-month-size-large, var(--scale-02, 14px));--scb-calendar-card-content-gap:var(--scb-cards-calendar-content-gap-large, var(--spacing-4, 12px));--scb-calendar-card-header-gap:var(--scb-cards-calendar-title-gap-large, var(--spacing-2, 4px));--scb-calendar-card-title-min-block-size:var(--scb-calendar-card-title-line-height);--scb-calendar-card-icon-size:var(--scb-cards-calendar-icon-size-large, var(--icon-size-medium, 24px));--scb-calendar-card-title-font-family:var(--scb-cards-title-font-current, var(--scb-typography-headline-small-font, var(--md-sys-typescale-headline-small-font, var(--brand-font, var(--brand, "Inter"), sans-serif))));--scb-calendar-card-title-font-size:var(--scb-cards-title-size-current, var(--scb-typography-headline-small-size, var(--md-sys-typescale-headline-small-size, 22px)));--scb-calendar-card-title-font-weight:var(--scb-cards-title-font-weight-current, var(--scb-cards-title-weight-current, var(--scb-typography-headline-small-weight, var(--md-sys-typescale-headline-small-weight, var(--weight-bold, 700)))));--scb-calendar-card-title-line-height:var(--scb-cards-title-line-height-current, var(--scb-typography-headline-small-line-height, var(--md-sys-typescale-headline-small-line-height, 28px)));--scb-calendar-card-title-letter-spacing:var(--scb-cards-title-letter-spacing-current, var(--scb-cards-title-tracking-current, var(--scb-typography-headline-small-tracking, var(--md-sys-typescale-headline-small-tracking, -0.5px))));--scb-calendar-card-subtitle-font-family:var(--scb-cards-subtitle-font-current, var(--scb-typography-title-medium-font, var(--md-sys-typescale-title-medium-font, var(--brand-font, var(--brand, "Inter"), sans-serif))));--scb-calendar-card-subtitle-font-size:var(--scb-cards-subtitle-size-current, var(--scb-typography-title-medium-size, var(--md-sys-typescale-title-medium-size, 18px)));--scb-calendar-card-subtitle-font-weight:var(--scb-cards-subtitle-font-weight-current, var(--scb-cards-subtitle-weight-current, var(--scb-typography-title-medium-weight, var(--md-sys-typescale-title-medium-weight, var(--weight-semibold, 600)))));--scb-calendar-card-subtitle-line-height:var(--scb-cards-subtitle-line-height-current, var(--scb-typography-title-medium-line-height, var(--md-sys-typescale-title-medium-line-height, 26px)));--scb-calendar-card-subtitle-letter-spacing:var(--scb-cards-subtitle-letter-spacing-current, var(--scb-cards-subtitle-tracking-current, var(--scb-typography-title-medium-tracking, var(--md-sys-typescale-title-medium-tracking, -0.3px))));--scb-calendar-card-supporting-font-family:var(--scb-cards-supporting-font-current, var(--scb-typography-body-large-font, var(--md-sys-typescale-body-large-font, var(--brand-font, var(--brand, "Inter"), sans-serif))));--scb-calendar-card-supporting-font-size:var(--scb-cards-supporting-size-current, var(--scb-typography-body-large-size, var(--md-sys-typescale-body-large-size, 18px)));--scb-calendar-card-supporting-font-weight:var(--scb-cards-supporting-font-weight-current, var(--scb-cards-supporting-weight-current, var(--scb-typography-body-large-weight, var(--md-sys-typescale-body-large-weight, var(--weight-regular, 400)))));--scb-calendar-card-supporting-line-height:var(--scb-cards-supporting-line-height-current, var(--scb-typography-body-large-line-height, var(--md-sys-typescale-body-large-line-height, 26px)));--scb-calendar-card-supporting-letter-spacing:var(--scb-cards-supporting-letter-spacing-current, var(--scb-cards-supporting-tracking-current, var(--scb-typography-body-large-tracking, var(--md-sys-typescale-body-large-tracking, -0.3px))))}:host([sizing='stretch']){inline-size:100%;block-size:100%;max-inline-size:none}:host([sizing='content-width']){display:inline-block;inline-size:auto;block-size:auto}:host([sizing='content-width']) .calendar-card{inline-size:max-content}:host([sizing='content-height']){inline-size:100%;block-size:auto;max-inline-size:none}md-focus-ring{position:absolute;inset:0;pointer-events:none;display:none;border-radius:var(--scb-calendar-card-focus-ring-radius, var(--scb-calendar-card-surface-radius, var(--radius-large, 16px)))}.calendar-card:focus-visible+md-focus-ring{display:block}.calendar-card{box-sizing:border-box;overflow:hidden;position:relative;isolation:isolate;display:flex;color:var(--scb-calendar-card-content-color, var(--scb-cards-content-color, var(--md-sys-color-on-surface, var(--p-20))));font-family:var(--brand-font, var(--brand, "Inter"), sans-serif);font-style:normal;flex-direction:column;align-items:flex-start;gap:var(--scb-calendar-card-gap);align-self:stretch;transition:transform .18s ease,background-color .18s ease,border-color .18s ease;inline-size:100%;max-inline-size:100%}.calendar-card.clickable{cursor:pointer}.calendar-card.clickable.default{overflow:visible}.calendar-card.clickable.default::before{content:"";position:absolute;inset:calc(var(--scb-calendar-card-unframed-state-gap)*-1);border-radius:calc(var(--scb-calendar-card-surface-radius, var(--radius-l, 16px)) + var(--scb-calendar-card-unframed-state-gap));background:var(--scb-calendar-card-unframed-state-color);opacity:0;pointer-events:none;transition:opacity .18s ease;z-index:0}.calendar-card.clickable.default:hover::before{opacity:1}.calendar-card.clickable.default>:not(md-ripple){position:relative;z-index:1}.calendar-card,.calendar-card .subtitle,.calendar-card .supporting-text,.calendar-card .title{font-variant-numeric:proportional-nums;font-feature-settings:"tnum"0,"pnum"1}.calendar-card:focus,.calendar-card:focus-visible{outline:0}.calendar-card.horizontal{flex-direction:row;align-items:flex-start;max-width:none;width:100%;gap:var(--scb-calendar-card-horizontal-gap);min-block-size:var(--scb-calendar-card-horizontal-min-block-size)}.calendar-card.outlined{border-radius:var(--scb-calendar-card-surface-radius, var(--radius-large, 16px));border:var(--scb-calendar-card-border-width, 1px) solid var(--scb-cards-outline-color, var(--md-sys-color-outline-variant, var(--n-80)));background:var(--scb-calendar-card-surface-color, var(--scb-cards-surface-color, var(--md-sys-color-surface, var(--nv-100))));padding-block:var(--scb-calendar-card-padding-block);padding-inline:var(--scb-calendar-card-padding-inline)}.calendar-card.filled,.media{background:var(--scb-cards-filled-surface-color, var(--md-sys-color-surface-dim, var(--nv-95)))}.calendar-card.filled{border-radius:var(--scb-calendar-card-surface-radius, var(--radius-large, 16px));padding-block:var(--scb-calendar-card-padding-block);padding-inline:var(--scb-calendar-card-padding-inline)}.calendar-card.filled .media{background:var(--scb-calendar-card-media-surface-color, var(--md-sys-color-surface, var(--nv-100)))}md-ripple{border-radius:var(--scb-calendar-card-surface-radius, var(--radius-l, 16px))}.calendar-card.clickable.default md-ripple{position:absolute;inset:calc(var(--scb-calendar-card-unframed-state-gap)*-1);border-radius:calc(var(--scb-calendar-card-surface-radius, var(--radius-l, 16px)) + var(--scb-calendar-card-unframed-state-gap));z-index:2}.media{width:var(--scb-calendar-card-media-size);min-width:var(--scb-calendar-card-media-size);max-width:var(--scb-calendar-card-media-size);height:var(--scb-calendar-card-media-size);padding:var(--spacing-0, 0)0;justify-content:center;align-items:center;gap:var(--scb-calendar-card-media-gap);border-radius:var(--scb-calendar-card-media-radius, var(--md-sys-shape-corner-small))}.calendar-card.horizontal .media{align-self:flex-start}.media .day{font-size:var(--scb-calendar-card-day-size);font-weight:var(--weight-bold, 700);line-height:100%;letter-spacing:var(--scb-calendar-card-day-letter-spacing);font-variant-numeric:tabular-nums}.media .month{font-size:var(--scb-calendar-card-month-size);font-weight:var(--weight-regular, 400);line-height:100%}.container,.header-container,.media{display:flex;flex-direction:column}.container{flex:1 1 auto;min-width:0;gap:var(--scb-calendar-card-content-gap);width:100%;align-self:flex-start}.header-container{gap:var(--scb-calendar-card-header-gap)}.title-container{width:100%;flex:0 0 auto;display:flex;align-items:center;gap:var(--spacing-3, 8px);color:inherit;text-decoration:none;min-block-size:var(--scb-calendar-card-title-min-block-size)}.title{font-family:var(--scb-calendar-card-title-font-family);font-size:var(--scb-calendar-card-title-font-size);font-weight:var(--scb-calendar-card-title-font-weight);line-height:var(--scb-calendar-card-title-line-height);letter-spacing:var(--scb-calendar-card-title-letter-spacing);flex:1 1 auto;min-inline-size:0;white-space:normal;word-break:normal;overflow-wrap:break-word;hyphens:auto;overflow:visible;text-overflow:clip}.title-container .calendar-card-icon{inline-size:var(--scb-calendar-card-icon-size);block-size:var(--scb-calendar-card-icon-size);flex:0 0 auto}.calendar-card-icon,.icon-container{align-items:center;justify-content:center}.icon-container{display:flex;width:var(--spacing-7, 24px);height:var(--spacing-7, 24px)}.calendar-card-icon{display:inline-flex;overflow:hidden;font-family:"Material Symbols Outlined";font-size:var(--icon-size-medium, 24px);line-height:1;white-space:nowrap;text-transform:none;word-wrap:normal;direction:ltr;font-variation-settings:normal;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.calendar-card-icon.scb-svg-icon{fill:currentColor;font:inherit}.subtitle,.supporting-text{font-family:var(--scb-calendar-card-subtitle-font-family);font-size:var(--scb-calendar-card-subtitle-font-size);font-weight:var(--scb-calendar-card-subtitle-font-weight);line-height:var(--scb-calendar-card-subtitle-line-height);letter-spacing:var(--scb-calendar-card-subtitle-letter-spacing);white-space:normal;word-break:normal;overflow-wrap:break-word;hyphens:manual;overflow:visible;text-overflow:clip}.supporting-text{font-family:var(--scb-calendar-card-supporting-font-family);font-size:var(--scb-calendar-card-supporting-font-size);font-weight:var(--scb-calendar-card-supporting-font-weight);line-height:var(--scb-calendar-card-supporting-line-height);letter-spacing:var(--scb-calendar-card-supporting-letter-spacing)}.title ::slotted(*){margin:0;color:inherit;font-family:var(--scb-calendar-card-title-font-family)!important;font-size:var(--scb-calendar-card-title-font-size)!important;font-weight:var(--scb-calendar-card-title-font-weight)!important;line-height:var(--scb-calendar-card-title-line-height)!important;letter-spacing:var(--scb-calendar-card-title-letter-spacing)!important}.subtitle ::slotted(*){margin:0;color:inherit;font-family:var(--scb-calendar-card-subtitle-font-family)!important;font-size:var(--scb-calendar-card-subtitle-font-size)!important;font-weight:var(--scb-calendar-card-subtitle-font-weight)!important;line-height:var(--scb-calendar-card-subtitle-line-height)!important;letter-spacing:var(--scb-calendar-card-subtitle-letter-spacing)!important}.supporting-text ::slotted(*){margin:0;color:inherit;font-family:var(--scb-calendar-card-supporting-font-family)!important;font-size:var(--scb-calendar-card-supporting-font-size)!important;font-weight:var(--scb-calendar-card-supporting-font-weight)!important;line-height:var(--scb-calendar-card-supporting-line-height)!important;letter-spacing:var(--scb-calendar-card-supporting-letter-spacing)!important}.supporting-text ::slotted(*),.supporting-text ::slotted(scb-link){--scb-link-font-size:var(--scb-calendar-card-supporting-font-size);--scb-link-line-height:var(--scb-calendar-card-supporting-line-height);--scb-link-letter-spacing:var(--scb-calendar-card-supporting-letter-spacing)}`,g);a([r({type:String,reflect:!0})],e.prototype,"variant",void 0);a([r({type:String,attribute:"date"})],e.prototype,"date",void 0);a([r({type:String,reflect:!0})],e.prototype,"direction",void 0);a([r({type:String,reflect:!0,converter:p})],e.prototype,"title",void 0);a([r({type:String,attribute:"calendar-card-title",reflect:!0,converter:p})],e.prototype,"calendarCardTitle",void 0);a([r({type:String,reflect:!0,converter:p})],e.prototype,"subtitle",void 0);a([r({type:String,attribute:"supporting-text",reflect:!0,converter:p})],e.prototype,"supportingText",void 0);a([r({type:String,attribute:"card-href"})],e.prototype,"cardHref",void 0);a([r({type:String,attribute:"card-href-nav"})],e.prototype,"cardHrefNav",void 0);a([r({type:Boolean,reflect:!0,attribute:"show-media"})],e.prototype,"showMedia",void 0);a([r({type:String,attribute:"date-label-prefix"})],e.prototype,"dateLabelPrefix",void 0);a([r({type:String,attribute:"media-width"})],e.prototype,"mediaWidth",void 0);a([r({type:String,attribute:"media-height"})],e.prototype,"mediaHeight",void 0);a([r({type:String,attribute:"media-aspect"})],e.prototype,"mediaAspect",void 0);a([r({type:String,reflect:!0})],e.prototype,"width",void 0);a([r({type:String,reflect:!0,attribute:"max-width"})],e.prototype,"maxWidth",void 0);a([r({type:String,attribute:"min-width"})],e.prototype,"minWidth",void 0);a([r({type:String,reflect:!0})],e.prototype,"height",void 0);a([r({type:String,reflect:!0,attribute:"max-height"})],e.prototype,"maxHeight",void 0);a([r({type:String,attribute:"min-height"})],e.prototype,"minHeight",void 0);a([r({type:String,reflect:!0,converter:p})],e.prototype,"sizing",void 0);a([r({type:String,reflect:!0})],e.prototype,"spacing",void 0);a([r({type:String,attribute:"spacing-top",reflect:!0})],e.prototype,"spacingTop",void 0);a([r({type:String,attribute:"spacing-bottom",reflect:!0})],e.prototype,"spacingBottom",void 0);a([r({type:String,attribute:"spacing-left",reflect:!0})],e.prototype,"spacingLeft",void 0);a([r({type:String,attribute:"spacing-right",reflect:!0})],e.prototype,"spacingRight",void 0);e=a([C("scb-calendar-card")],e);
|
|
41
|
+
`}__getDateParts(){const t={day:1,month:"Jan"};if(!this.date)return t;const i=this.date instanceof Date?this.date:(()=>{const s=new Date(String(this.date));return Number.isNaN(s.getTime())?null:s})();if(!i)return t;const d=i.getDate(),c=L.format(i).replace(".","").trim();return{day:d,month:c.charAt(0).toUpperCase()+c.slice(1)}}__applyInnerSizing(){const t=this.renderRoot.querySelector(".calendar-card");t&&(this.width&&this.width.trim()!==""?(t.style.inlineSize="100%",t.style.maxInlineSize="100%"):(t.style.removeProperty("inline-size"),t.style.removeProperty("max-inline-size")),this.height&&this.height.trim()!==""||this.sizing==="stretch"?t.style.blockSize="100%":t.style.removeProperty("block-size"),this.maxHeight&&this.maxHeight.trim()!==""?t.style.maxBlockSize="100%":t.style.removeProperty("max-block-size"))}_onKeyDown(t){(t.key==="Enter"||t.key===" ")&&this.cardHref&&(t.preventDefault(),this.__navigate())}_handleHrefNavigation(){this.cardHref&&((!this.__rippleLoaded||this.__pendingRippleEvent)&&(this.__pendingRippleClick=!0,this.__ensureRipple()),this.__navigate())}__navigate(){this.cardHref&&(this.cardHrefNav==="tab"?window.open(this.cardHref,"_blank"):this.cardHrefNav==="window"?window.open(this.cardHref,"_blank","noopener,noreferrer,width=800,height=600"):window.open(this.cardHref,"_self"))}mapSpacingToken(t){if(!t)return;const i=String(t).trim();if(i)return/^\d+$/.test(i)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(i,10)))})`:i}__applySpacing(){const t=this.mapSpacingToken(this.spacing),i=this.mapSpacingToken(this.spacingTop)??t,d=this.mapSpacingToken(this.spacingBottom)??t,c=this.mapSpacingToken(this.spacingLeft),s=this.mapSpacingToken(this.spacingRight);i?this.style.setProperty("--scb-calendar-card-spacing-block-start",i):this.style.removeProperty("--scb-calendar-card-spacing-block-start"),d?this.style.setProperty("--scb-calendar-card-spacing-block-end",d):this.style.removeProperty("--scb-calendar-card-spacing-block-end"),c?this.style.setProperty("--scb-calendar-card-spacing-inline-start",c):this.style.removeProperty("--scb-calendar-card-spacing-inline-start"),s?this.style.setProperty("--scb-calendar-card-spacing-inline-end",s):this.style.removeProperty("--scb-calendar-card-spacing-inline-end")}updated(t){t.has("width")&&(this.width?this.style.inlineSize=this.width:this.style.removeProperty("inline-size")),t.has("maxWidth")&&(this.maxWidth?this.style.maxInlineSize=this.maxWidth:this.style.removeProperty("max-inline-size")),t.has("minWidth")&&(this.minWidth?this.style.minInlineSize=this.minWidth:this.style.removeProperty("min-inline-size")),t.has("height")&&(this.height?this.style.blockSize=this.height:this.style.removeProperty("block-size")),t.has("maxHeight")&&(this.maxHeight?this.style.maxBlockSize=this.maxHeight:this.style.removeProperty("max-block-size")),t.has("minHeight")&&(this.minHeight?this.style.minBlockSize=this.minHeight:this.style.removeProperty("min-block-size")),(t.has("width")||t.has("height")||t.has("maxHeight")||t.has("sizing"))&&this.__applyInnerSizing(),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&this.__applySpacing()}},g.styles=P`:host{--scb-cards-title-font-weight-current:var(--scb-cards-title-large-font-weight, var(--scb-cards-title-large-weight, var(--scb-cards-title-font-weight, var(--scb-cards-title-weight))));--scb-cards-title-letter-spacing-current:var(--scb-cards-title-large-letter-spacing, var(--scb-cards-title-large-tracking, var(--scb-cards-title-letter-spacing, var(--scb-cards-title-tracking))));--scb-cards-title-line-height-current:var(--scb-cards-title-large-line-height, var(--scb-cards-title-line-height));--scb-cards-title-tracking-current:var(--scb-cards-title-large-tracking, var(--scb-cards-title-large-letter-spacing, var(--scb-cards-title-tracking, var(--scb-cards-title-letter-spacing))));--scb-cards-title-weight-current:var(--scb-cards-title-large-weight, var(--scb-cards-title-large-font-weight, var(--scb-cards-title-weight, var(--scb-cards-title-font-weight))));--scb-cards-title-size-current:var(--scb-cards-title-large-size, var(--scb-cards-title-size));--scb-cards-title-font-current:var(--scb-cards-title-large-font, var(--scb-cards-title-font));--scb-cards-subtitle-font-weight-current:var(--scb-cards-subtitle-large-font-weight, var(--scb-cards-subtitle-large-weight, var(--scb-cards-subtitle-font-weight, var(--scb-cards-subtitle-weight))));--scb-cards-subtitle-letter-spacing-current:var(--scb-cards-subtitle-large-letter-spacing, var(--scb-cards-subtitle-large-tracking, var(--scb-cards-subtitle-letter-spacing, var(--scb-cards-subtitle-tracking))));--scb-cards-subtitle-line-height-current:var(--scb-cards-subtitle-large-line-height, var(--scb-cards-subtitle-line-height));--scb-cards-subtitle-tracking-current:var(--scb-cards-subtitle-large-tracking, var(--scb-cards-subtitle-large-letter-spacing, var(--scb-cards-subtitle-tracking, var(--scb-cards-subtitle-letter-spacing))));--scb-cards-subtitle-weight-current:var(--scb-cards-subtitle-large-weight, var(--scb-cards-subtitle-large-font-weight, var(--scb-cards-subtitle-weight, var(--scb-cards-subtitle-font-weight))));--scb-cards-subtitle-size-current:var(--scb-cards-subtitle-large-size, var(--scb-cards-subtitle-size));--scb-cards-subtitle-font-current:var(--scb-cards-subtitle-large-font, var(--scb-cards-subtitle-font));--scb-cards-supporting-font-weight-current:var(--scb-cards-supporting-large-font-weight, var(--scb-cards-supporting-large-weight, var(--scb-cards-supporting-font-weight, var(--scb-cards-supporting-weight))));--scb-cards-supporting-letter-spacing-current:var(--scb-cards-supporting-large-letter-spacing, var(--scb-cards-supporting-large-tracking, var(--scb-cards-supporting-letter-spacing, var(--scb-cards-supporting-tracking))));--scb-cards-supporting-line-height-current:var(--scb-cards-supporting-large-line-height, var(--scb-cards-supporting-line-height));--scb-cards-supporting-tracking-current:var(--scb-cards-supporting-large-tracking, var(--scb-cards-supporting-large-letter-spacing, var(--scb-cards-supporting-tracking, var(--scb-cards-supporting-letter-spacing))));--scb-cards-supporting-weight-current:var(--scb-cards-supporting-large-weight, var(--scb-cards-supporting-large-font-weight, var(--scb-cards-supporting-weight, var(--scb-cards-supporting-font-weight))));--scb-cards-supporting-size-current:var(--scb-cards-supporting-large-size, var(--scb-cards-supporting-size));--scb-cards-supporting-font-current:var(--scb-cards-supporting-large-font, var(--scb-cards-supporting-font));display:block;position:relative;box-sizing:border-box;inline-size:100%;min-inline-size:0;padding:var(--scb-calendar-card-focus-ring-gap, 4px);margin-block-start:var(--scb-calendar-card-spacing-block-start, 0);margin-block-end:var(--scb-calendar-card-spacing-block-end, 0);margin-inline-start:var(--scb-calendar-card-spacing-inline-start, 0);margin-inline-end:var(--scb-calendar-card-spacing-inline-end, 0);--scb-calendar-card-padding-block:var(--scb-calendar-card-padding, var(--scb-cards-content-padding-block-large, var(--spacing-7, 24px)));--scb-calendar-card-padding-inline:var(--scb-calendar-card-padding, var(--scb-cards-content-padding-block-large, var(--spacing-7, 24px)));--scb-calendar-card-surface-radius:var(--scb-cards-surface-radius-large, var(--radius-large, 16px));--scb-calendar-card-border-width:var(--scb-cards-border-width-large, var(--stroke-border, 1px));--scb-calendar-card-gap:var(--scb-cards-calendar-gap-large, var(--spacing-4, 12px));--scb-calendar-card-horizontal-gap:var(--scb-cards-calendar-horizontal-gap-large, var(--spacing-6, 20px));--scb-calendar-card-horizontal-min-block-size:var(--scb-cards-calendar-horizontal-min-block-size-large, 112px);--scb-calendar-card-unframed-state-gap:var(--spacing-2, 4px);--scb-calendar-card-unframed-state-color:color-mix(in srgb, currentColor 8%, transparent);--scb-calendar-card-media-size:var(--scb-cards-calendar-media-size-large, var(--spacing-11, 64px));--scb-calendar-card-media-radius:var(--scb-cards-calendar-media-radius-large, var(--radius-small, 8px));--scb-calendar-card-media-gap:var(--scb-cards-calendar-media-gap-large, var(--spacing-2, 4px));--scb-calendar-card-day-size:var(--scb-cards-calendar-date-day-size-large, var(--scale-07, 28px));--scb-calendar-card-day-letter-spacing:-0.6px;--scb-calendar-card-month-size:var(--scb-cards-calendar-date-month-size-large, var(--scale-02, 14px));--scb-calendar-card-content-gap:var(--scb-cards-calendar-content-gap-large, var(--spacing-4, 12px));--scb-calendar-card-header-gap:var(--scb-cards-calendar-title-gap-large, var(--spacing-2, 4px));--scb-calendar-card-title-min-block-size:var(--scb-calendar-card-title-line-height);--scb-calendar-card-icon-size:var(--scb-cards-calendar-icon-size-large, var(--icon-size-medium, 24px));--scb-calendar-card-title-font-family:var(--scb-cards-title-font-current, var(--scb-typography-headline-small-font, var(--md-sys-typescale-headline-small-font, var(--brand-font, var(--brand, "Inter"), sans-serif))));--scb-calendar-card-title-font-size:var(--scb-cards-title-size-current, var(--scb-typography-headline-small-size, var(--md-sys-typescale-headline-small-size, 22px)));--scb-calendar-card-title-font-weight:var(--scb-cards-title-font-weight-current, var(--scb-cards-title-weight-current, var(--scb-typography-headline-small-weight, var(--md-sys-typescale-headline-small-weight, var(--weight-bold, 700)))));--scb-calendar-card-title-line-height:var(--scb-cards-title-line-height-current, var(--scb-typography-headline-small-line-height, var(--md-sys-typescale-headline-small-line-height, 28px)));--scb-calendar-card-title-letter-spacing:var(--scb-cards-title-letter-spacing-current, var(--scb-cards-title-tracking-current, var(--scb-typography-headline-small-tracking, var(--md-sys-typescale-headline-small-tracking, -0.5px))));--scb-calendar-card-subtitle-font-family:var(--scb-cards-subtitle-font-current, var(--scb-typography-title-medium-font, var(--md-sys-typescale-title-medium-font, var(--brand-font, var(--brand, "Inter"), sans-serif))));--scb-calendar-card-subtitle-font-size:var(--scb-cards-subtitle-size-current, var(--scb-typography-title-medium-size, var(--md-sys-typescale-title-medium-size, 18px)));--scb-calendar-card-subtitle-font-weight:var(--scb-cards-subtitle-font-weight-current, var(--scb-cards-subtitle-weight-current, var(--scb-typography-title-medium-weight, var(--md-sys-typescale-title-medium-weight, var(--weight-semibold, 600)))));--scb-calendar-card-subtitle-line-height:var(--scb-cards-subtitle-line-height-current, var(--scb-typography-title-medium-line-height, var(--md-sys-typescale-title-medium-line-height, 26px)));--scb-calendar-card-subtitle-letter-spacing:var(--scb-cards-subtitle-letter-spacing-current, var(--scb-cards-subtitle-tracking-current, var(--scb-typography-title-medium-tracking, var(--md-sys-typescale-title-medium-tracking, -0.3px))));--scb-calendar-card-supporting-font-family:var(--scb-cards-supporting-font-current, var(--scb-typography-body-large-font, var(--md-sys-typescale-body-large-font, var(--brand-font, var(--brand, "Inter"), sans-serif))));--scb-calendar-card-supporting-font-size:var(--scb-cards-supporting-size-current, var(--scb-typography-body-large-size, var(--md-sys-typescale-body-large-size, 18px)));--scb-calendar-card-supporting-font-weight:var(--scb-cards-supporting-font-weight-current, var(--scb-cards-supporting-weight-current, var(--scb-typography-body-large-weight, var(--md-sys-typescale-body-large-weight, var(--weight-regular, 400)))));--scb-calendar-card-supporting-line-height:var(--scb-cards-supporting-line-height-current, var(--scb-typography-body-large-line-height, var(--md-sys-typescale-body-large-line-height, 26px)));--scb-calendar-card-supporting-letter-spacing:var(--scb-cards-supporting-letter-spacing-current, var(--scb-cards-supporting-tracking-current, var(--scb-typography-body-large-tracking, var(--md-sys-typescale-body-large-tracking, -0.3px))))}:host([sizing='stretch']){inline-size:100%;block-size:100%;max-inline-size:none}:host([sizing='content-width']){display:inline-block;inline-size:auto;block-size:auto}:host([sizing='content-width']) .calendar-card{inline-size:max-content}:host([sizing='content-height']){inline-size:100%;block-size:auto;max-inline-size:none}md-focus-ring{position:absolute;inset:0;pointer-events:none;display:none;border-radius:var(--scb-calendar-card-focus-ring-radius, var(--scb-calendar-card-surface-radius, var(--radius-large, 16px)))}.calendar-card:focus-visible+md-focus-ring{display:block}.calendar-card{box-sizing:border-box;overflow:hidden;position:relative;isolation:isolate;display:flex;color:var(--scb-calendar-card-content-color, var(--scb-cards-content-color, var(--md-sys-color-on-surface, var(--p-20))));font-family:var(--brand-font, var(--brand, "Inter"), sans-serif);font-style:normal;flex-direction:column;align-items:flex-start;gap:var(--scb-calendar-card-gap);align-self:stretch;transition:transform .18s ease,background-color .18s ease,border-color .18s ease;inline-size:100%;max-inline-size:100%}.calendar-card.clickable{cursor:pointer}.calendar-card.clickable.default{overflow:visible}.calendar-card.clickable.default::before{content:"";position:absolute;inset:calc(var(--scb-calendar-card-unframed-state-gap)*-1);border-radius:calc(var(--scb-calendar-card-surface-radius, var(--radius-l, 16px)) + var(--scb-calendar-card-unframed-state-gap));background:var(--scb-calendar-card-unframed-state-color);opacity:0;pointer-events:none;transition:opacity .18s ease;z-index:0}.calendar-card.clickable.default:hover::before{opacity:1}.calendar-card.clickable.default>:not(md-ripple){position:relative;z-index:1}.calendar-card,.calendar-card .subtitle,.calendar-card .supporting-text,.calendar-card .title{font-variant-numeric:proportional-nums;font-feature-settings:"tnum"0,"pnum"1}.calendar-card:focus,.calendar-card:focus-visible{outline:0}.calendar-card.horizontal{flex-direction:row;align-items:flex-start;max-width:none;width:100%;gap:var(--scb-calendar-card-horizontal-gap);min-block-size:var(--scb-calendar-card-horizontal-min-block-size)}.calendar-card.outlined{border-radius:var(--scb-calendar-card-surface-radius, var(--radius-large, 16px));border:var(--scb-calendar-card-border-width, 1px) solid var(--scb-cards-outline-color, var(--md-sys-color-outline-variant, var(--n-80)));background:var(--scb-calendar-card-surface-color, var(--scb-cards-surface-color, var(--md-sys-color-surface, var(--nv-100))));padding-block:var(--scb-calendar-card-padding-block);padding-inline:var(--scb-calendar-card-padding-inline)}.calendar-card.filled,.media{background:var(--scb-cards-filled-surface-color, var(--md-sys-color-surface-dim, var(--nv-95)))}.calendar-card.filled{border-radius:var(--scb-calendar-card-surface-radius, var(--radius-large, 16px));padding-block:var(--scb-calendar-card-padding-block);padding-inline:var(--scb-calendar-card-padding-inline)}.calendar-card.filled .media{background:var(--scb-calendar-card-media-surface-color, var(--md-sys-color-surface, var(--nv-100)))}md-ripple{border-radius:var(--scb-calendar-card-surface-radius, var(--radius-l, 16px))}.calendar-card.clickable.default md-ripple{position:absolute;inset:calc(var(--scb-calendar-card-unframed-state-gap)*-1);border-radius:calc(var(--scb-calendar-card-surface-radius, var(--radius-l, 16px)) + var(--scb-calendar-card-unframed-state-gap));z-index:2}.media{width:var(--scb-calendar-card-media-size);min-width:var(--scb-calendar-card-media-size);max-width:var(--scb-calendar-card-media-size);height:var(--scb-calendar-card-media-size);padding:var(--spacing-0, 0)0;justify-content:center;align-items:center;gap:var(--scb-calendar-card-media-gap);border-radius:var(--scb-calendar-card-media-radius, var(--md-sys-shape-corner-small))}.calendar-card.horizontal .media{align-self:flex-start}.media .day{font-size:var(--scb-calendar-card-day-size);font-weight:var(--weight-bold, 700);line-height:100%;letter-spacing:var(--scb-calendar-card-day-letter-spacing);font-variant-numeric:tabular-nums}.media .month{font-size:var(--scb-calendar-card-month-size);font-weight:var(--weight-regular, 400);line-height:100%}.container,.header-container,.media{display:flex;flex-direction:column}.container{flex:1 1 auto;min-width:0;gap:var(--scb-calendar-card-content-gap);width:100%;align-self:flex-start}.header-container{gap:var(--scb-calendar-card-header-gap)}.title-container{width:100%;flex:0 0 auto;display:flex;align-items:center;gap:var(--spacing-3, 8px);color:inherit;text-decoration:none;min-block-size:var(--scb-calendar-card-title-min-block-size)}.title{font-family:var(--scb-calendar-card-title-font-family);font-size:var(--scb-calendar-card-title-font-size);font-weight:var(--scb-calendar-card-title-font-weight);line-height:var(--scb-calendar-card-title-line-height);letter-spacing:var(--scb-calendar-card-title-letter-spacing);flex:1 1 auto;min-inline-size:0;white-space:normal;word-break:normal;overflow-wrap:break-word;hyphens:auto;overflow:visible;text-overflow:clip}.title-container .calendar-card-icon{inline-size:var(--scb-calendar-card-icon-size);block-size:var(--scb-calendar-card-icon-size);flex:0 0 auto}.calendar-card-icon,.icon-container{align-items:center;justify-content:center}.icon-container{display:flex;width:var(--spacing-7, 24px);height:var(--spacing-7, 24px)}.calendar-card-icon{display:inline-flex;overflow:hidden;font-family:"Material Symbols Outlined";font-size:var(--icon-size-medium, 24px);line-height:1;white-space:nowrap;text-transform:none;word-wrap:normal;direction:ltr;font-variation-settings:normal;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.calendar-card-icon.scb-svg-icon{fill:currentColor;font:inherit}.subtitle,.supporting-text{font-family:var(--scb-calendar-card-subtitle-font-family);font-size:var(--scb-calendar-card-subtitle-font-size);font-weight:var(--scb-calendar-card-subtitle-font-weight);line-height:var(--scb-calendar-card-subtitle-line-height);letter-spacing:var(--scb-calendar-card-subtitle-letter-spacing);white-space:normal;word-break:normal;overflow-wrap:break-word;hyphens:manual;overflow:visible;text-overflow:clip}.supporting-text{font-family:var(--scb-calendar-card-supporting-font-family);font-size:var(--scb-calendar-card-supporting-font-size);font-weight:var(--scb-calendar-card-supporting-font-weight);line-height:var(--scb-calendar-card-supporting-line-height);letter-spacing:var(--scb-calendar-card-supporting-letter-spacing)}.title ::slotted(*){margin:0;color:inherit;font-family:var(--scb-calendar-card-title-font-family)!important;font-size:var(--scb-calendar-card-title-font-size)!important;font-weight:var(--scb-calendar-card-title-font-weight)!important;line-height:var(--scb-calendar-card-title-line-height)!important;letter-spacing:var(--scb-calendar-card-title-letter-spacing)!important}.subtitle ::slotted(*){margin:0;color:inherit;font-family:var(--scb-calendar-card-subtitle-font-family)!important;font-size:var(--scb-calendar-card-subtitle-font-size)!important;font-weight:var(--scb-calendar-card-subtitle-font-weight)!important;line-height:var(--scb-calendar-card-subtitle-line-height)!important;letter-spacing:var(--scb-calendar-card-subtitle-letter-spacing)!important}.supporting-text ::slotted(*){margin:0;color:inherit;font-family:var(--scb-calendar-card-supporting-font-family)!important;font-size:var(--scb-calendar-card-supporting-font-size)!important;font-weight:var(--scb-calendar-card-supporting-font-weight)!important;line-height:var(--scb-calendar-card-supporting-line-height)!important;letter-spacing:var(--scb-calendar-card-supporting-letter-spacing)!important}.supporting-text ::slotted(*),.supporting-text ::slotted(scb-link){--scb-link-font-size:var(--scb-calendar-card-supporting-font-size);--scb-link-line-height:var(--scb-calendar-card-supporting-line-height);--scb-link-letter-spacing:var(--scb-calendar-card-supporting-letter-spacing)}`,g);a([r({type:String,reflect:!0})],e.prototype,"variant",void 0);a([r({type:String,attribute:"date"})],e.prototype,"date",void 0);a([r({type:String,reflect:!0})],e.prototype,"direction",void 0);a([r({type:String,reflect:!0,converter:p})],e.prototype,"title",void 0);a([r({type:String,attribute:"calendar-card-title",reflect:!0,converter:p})],e.prototype,"calendarCardTitle",void 0);a([r({type:String,reflect:!0,converter:p})],e.prototype,"subtitle",void 0);a([r({type:String,attribute:"supporting-text",reflect:!0,converter:p})],e.prototype,"supportingText",void 0);a([r({type:String,attribute:"card-href"})],e.prototype,"cardHref",void 0);a([r({type:String,attribute:"card-href-nav"})],e.prototype,"cardHrefNav",void 0);a([r({type:Boolean,reflect:!0,attribute:"show-media"})],e.prototype,"showMedia",void 0);a([r({type:String,attribute:"date-label-prefix"})],e.prototype,"dateLabelPrefix",void 0);a([r({type:String,attribute:"media-width"})],e.prototype,"mediaWidth",void 0);a([r({type:String,attribute:"media-height"})],e.prototype,"mediaHeight",void 0);a([r({type:String,attribute:"media-aspect"})],e.prototype,"mediaAspect",void 0);a([r({type:String,reflect:!0})],e.prototype,"width",void 0);a([r({type:String,reflect:!0,attribute:"max-width"})],e.prototype,"maxWidth",void 0);a([r({type:String,attribute:"min-width"})],e.prototype,"minWidth",void 0);a([r({type:String,reflect:!0})],e.prototype,"height",void 0);a([r({type:String,reflect:!0,attribute:"max-height"})],e.prototype,"maxHeight",void 0);a([r({type:String,attribute:"min-height"})],e.prototype,"minHeight",void 0);a([r({type:String,reflect:!0,converter:p})],e.prototype,"sizing",void 0);a([r({type:String,reflect:!0})],e.prototype,"spacing",void 0);a([r({type:String,attribute:"spacing-top",reflect:!0})],e.prototype,"spacingTop",void 0);a([r({type:String,attribute:"spacing-bottom",reflect:!0})],e.prototype,"spacingBottom",void 0);a([r({type:String,attribute:"spacing-left",reflect:!0})],e.prototype,"spacingLeft",void 0);a([r({type:String,attribute:"spacing-right",reflect:!0})],e.prototype,"spacingRight",void 0);e=a([C("scb-calendar-card")],e);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["
|
|
2
|
-
import{g as l,h as ft,m as f,p as r,v as d,y as yt}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as m}from"../../vendor/preload-helper.js";import{componentSizeToken as zt}from"../shared/component-size-token.js";import{t as _t}from"../../vendor/component-defaults.js";import{t as a}from"../../vendor/decorate.js";(function(){try{var p=typeof globalThis<"u"?globalThis:window;if(!p.__scb_ce_guard_installed__){p.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,i,c){try{customElements.get(t)||e(t,i,c)}catch(b){var n=String(b||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw b}}}}catch{}})();var C,xt=new Set(["social-comments-text","social-comments","social-comments-disabled","social-comments-href","social-comments-link-label","social-likes-text","social-like-label","social-likes","social-likes-disabled","social-likes-hover-content","social-has-liked","social-likes-interactive","social-author","social-author-text","social-author-href","social-reply-enabled","social-reply-label","social-edit-enabled","social-edit-label","social-delete-enabled","social-delete-label"]),z="data-scb-card-managed-list-size",_="data-scb-card-managed-action-button-size",R="data-scb-card-managed-avatar-size",kt=new Set(["small","medium","large"]),wt=new Set(["small","medium","large","extra-large"]),$,P,I,E,B,D,H,O,V,N;function St(){return O??(O=m(()=>import("../shared/lazy-focus-ring.js"),__vite__mapDeps([0,1]),import.meta.url)),O}function U(){return V??(V=m(()=>import("../shared/lazy-ripple.js"),__vite__mapDeps([2,1]),import.meta.url)),V}function At(){return $??($=m(()=>import("../scb-list/scb-list.js"),__vite__mapDeps([3,4,5,6,7,8,1,9]),import.meta.url)),$}function Tt(){return P??(P=m(()=>import("../scb-icon-button/scb-icon-button.js"),__vite__mapDeps([10,4,5,1,6,7,11,12]),import.meta.url)),P}function Lt(){return I??(I=m(()=>import("../scb-button/scb-button.js"),__vite__mapDeps([13,4,5,1,6,7,11,12]),import.meta.url)),I}function Ct(){return E??(E=m(()=>import("../scb-link/scb-link.js"),__vite__mapDeps([14,4,5,0,1,7,11,12,15]),import.meta.url)),E}function Rt(){return B??(B=m(()=>import("../scb-chip/scb-chip.js"),__vite__mapDeps([16,4,5,1,7,11,12]),import.meta.url)),B}function $t(){return D??(D=m(()=>import("../scb-avatar/scb-avatar.js"),__vite__mapDeps([17,4,5,1,6,7,11,12]),import.meta.url)),D}function Pt(){return H??(H=m(()=>import("../scb-tooltip/scb-tooltip.js"),__vite__mapDeps([18,4,5,19,20,1,9,7,21]),import.meta.url)),H}function It(){return N??(N=m(()=>import("../../vendor/scb-card-variants.internal.js"),__vite__mapDeps([22,4,5]),import.meta.url)),N}var o={fromAttribute:p=>p??"",toAttribute:p=>typeof p!="string"||p.trim()===""?null:p},s=(C=class extends ft{constructor(...e){super(...e),this.__dependencyKey="",this.__focusRingRequested=!1,this.__focusRingLoaded=!1,this.__rippleRequested=!1,this.__rippleLoaded=!1,this.__pendingRippleClick=!1,this.__isSyncingManagedSocialAttributes=!1,this.type="standard",this.variant="standard",this.direction="dynamic",this.size=_t["scb-card"].size,this.mediaType="",this.mediaHref="",this.mediaAlt="",this.mediaSrcset="",this.mediaSizes="",this.mediaLoading="auto",this.mediaDecoding="async",this.mediaFetchPriority="auto",this.mediaFit="cover",this.mediaPosition="center",this.mediaWidth="",this.mediaHeight="",this.mediaAspect="",this.mediaPlaceholder=!1,this.cardHref="",this.href="",this.title="",this.cardTitle="",this.subtitle="",this.vignette="",this.vignetteVariant="filled",this.vignetteSpacing=void 0,this.vignetteSpacingTop=void 0,this.vignetteSpacingBottom=void 0,this.vignetteSpacingLeft=void 0,this.vignetteSpacingRight=void 0,this.supportingText="",this.commentsText="",this.commentsDisabled=!1,this.commentsHref="",this.commentsLinkLabel="Gå till kommentarer",this.likesText="",this.likeLabel="",this.likesDisabled=!1,this.likesHoverContent="",this.hasLiked=!1,this.likesInteractive=!0,this.author=!1,this.authorText="",this.authorHref="",this.replyEnabled=!1,this.replyLabel="Svara",this.editEnabled=!1,this.editLabel="Redigera",this.deleteEnabled=!1,this.deleteLabel="Ta bort",this.width="",this.maxWidth="",this.height="",this.maxHeight="",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.innerPadding=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.__onImgLoad=t=>{const i=t.currentTarget.closest(".media");i&&i.classList.add("is-loaded")},this.__ensureRippleOnInteraction=(t,i=!1)=>{if(this.__primaryHref()){if(t&&(this.__pendingRippleEvent=t),i&&(this.__pendingRippleClick=!0),this.__rippleLoaded){this.__syncRipple();return}this.__rippleRequested||(this.__rippleRequested=!0,U().then(({ensureRippleReady:c})=>c()).then(()=>{this.__rippleLoaded=!0,this.requestUpdate(),this.updateComplete.then(()=>this.__syncRipple())}))}},this.__syncRipple=async()=>{const t=this.renderRoot.querySelector("md-ripple"),i=this.renderRoot.querySelector(".scb-card"),c=this.__pendingRippleEvent,n=this.__pendingRippleClick;this.__pendingRippleEvent=void 0,this.__pendingRippleClick=!1;const{syncRippleToControl:b}=await U();await b(t,i,c,n)},this.__ensureFocusRingOnFocusVisible=()=>{this.__focusRingLoaded||this.__focusRingRequested||(this.__focusRingRequested=!0,St().then(({ensureFocusRingReady:t})=>t()).then(()=>{this.__focusRingLoaded=!0,this.requestUpdate()}))},this.__onKeyDown=t=>{if(t.target!==t.currentTarget)return;const i=this.__primaryHref();(t.key==="Enter"||t.key===" ")&&i&&(t.preventDefault(),this.__ensureRippleOnInteraction(void 0,!0),this.__navigate(i,t))},this.__handleHrefNavigation=t=>{const i=this.__primaryHref();i&&(t.target.closest("a")||this.__navigate(i,t))},this.__handleSlottedCardLinkClick=t=>{const i=t.composedPath().find(c=>c instanceof HTMLAnchorElement&&c.getAttribute("slot")==="card-link")?.getAttribute("href")||this.__primaryHref();i&&(this.__dispatchCardNavigate(i,t)||t.preventDefault())}}attributeChangedCallback(e,t,i){this.__isSyncingManagedSocialAttributes&&xt.has(e)||super.attributeChangedCallback(e,t,i)}get likeButton(){return this.cardType!=="social"?null:this.renderRoot.querySelector(".likes scb-icon-button")}__calcAspectWH(e){const t=(e||"").trim();if(!t)return{w:600,h:400};const i=t.includes("/")?t.split("/"):t.includes(":")?t.split(":"):t.includes("x")?t.split("x"):null;if(i&&i.length===2){const n=Number(i[0]),b=Number(i[1]);if(n>0&&b>0)return{w:n,h:b}}const c=Number(t);return isFinite(c)&&c>0?{w:1e3,h:Math.round(1e3/c)}:{w:600,h:400}}__mediaReserveAspect(e=""){const t=(this.mediaAspect||"").trim();if(t)return t;const i=Number(this.mediaWidth)||0,c=Number(this.mediaHeight)||0;return i>0&&c>0?`${i} / ${c}`:e}__mediaReserveStyle(e=""){const t=this.__mediaReserveAspect(e);return t?`--scb-card-media-aspect:${t};`:""}__slottedMediaAspect(){const e=this.querySelector('[slot="media"]');if(!e)return"";const t=Number(e.getAttribute("width"))||0,i=Number(e.getAttribute("height"))||0;return t>0&&i>0?`${t} / ${i}`:""}__isAvatarMedia(){return(this.mediaType||"").toLowerCase()==="avatar"?!0:this.querySelector(':scope > [slot="media"]')?.localName==="scb-avatar"}get __resolvedTitle(){return this.cardTitle||this.title}get cardType(){const e=(this.type||"standard").toLowerCase();switch(e){case"standard":case"list":case"social":case"link":case"action":case"container":return e;default:return"standard"}}__ensureVariantRenderer(){return this.cardType==="standard"||this.__variantRenderer?Promise.resolve():It().then(e=>{this.__variantRenderer!==e&&(this.__variantRenderer=e,e.ensureScbCardVariantStyles(this.renderRoot),this.requestUpdate())})}__dispatchCardNavigate(e,t){const i={href:e,originalEvent:t},c=new CustomEvent("card-navigate",{bubbles:!0,composed:!0,cancelable:!0,detail:i});if(this.dispatchEvent(c),c.defaultPrevented)return!1;const n=new CustomEvent("cardnavigate",{bubbles:!0,composed:!0,cancelable:!0,detail:i});return this.dispatchEvent(n),!n.defaultPrevented}__effectiveHref(){return this.cardHref||this.href}__slottedCardLink(){return this.querySelector(':scope > a[slot="card-link"]')}__primaryHref(){return this.__effectiveHref()||this.__slottedCardLink()?.getAttribute("href")||""}__navigate(e,t){e&&this.__dispatchCardNavigate(e,t)&&window.open(e,"_self")}__slotNames(){const e=new Set;for(const t of Array.from(this.children)){const i=t.getAttribute("slot");i&&e.add(i)}return e}__hasSlottedContent(e,t){return t?t.has(e):Array.from(this.children).some(i=>i.getAttribute("slot")===e)}__hasLightDomElement(e){return!!this.querySelector(e)}__syncListCardListSize(){const e=Array.from(this.querySelectorAll("scb-list"));if(this.cardType!=="list"){for(const i of e){const c=i.getAttribute(z);c!==null&&i.getAttribute("size")===c&&i.removeAttribute("size"),i.removeAttribute(z)}return}const t=this.size||"large";for(const i of e){const c=i.getAttribute(z);if(c!==null&&i.getAttribute("size")!==c){i.removeAttribute(z);continue}(!i.hasAttribute("size")||c!==null)&&(i.setAttribute("size",t),i.setAttribute(z,t))}}__actionCardButtonSize(){const e=getComputedStyle(this).getPropertyValue("--scb-card-size-actions-button-size").trim();return kt.has(e)?e:"medium"}__cardAvatarSize(){const e=getComputedStyle(this).getPropertyValue("--scb-card-size-avatar-component-size").trim();return wt.has(e)?e:"medium"}__syncAvatarSizes(){const e=Array.from(this.querySelectorAll(':scope > scb-avatar[slot="media"]')),t=this.__cardAvatarSize();for(const i of e){const c=i.getAttribute(R);if(c!==null&&i.getAttribute("size")!==c){i.removeAttribute(R);continue}(!i.hasAttribute("size")||c!==null)&&(i.setAttribute("size",t),i.setAttribute(R,t))}}__socialIconButtonSize(){return zt(this,"--scb-card-size-social-icon-button-component-size",["tiny","extra-small","small","medium","large"],this.size==="small"?"small":"medium")}__syncActionCardButtonSizes(){const e=Array.from(this.querySelectorAll(':scope > [slot="actions"] scb-button, :scope > scb-button[slot="actions"]'));if(this.cardType!=="action"){for(const i of e){const c=i.getAttribute(_);c!==null&&i.getAttribute("size")===c&&i.removeAttribute("size"),i.removeAttribute(_)}return}const t=this.__actionCardButtonSize();for(const i of e){const c=i.getAttribute(_);if(c!==null&&i.getAttribute("size")!==c){i.removeAttribute(_);continue}(!i.hasAttribute("size")||c!==null)&&(i.setAttribute("size",t),i.setAttribute(_,t))}}__slottedText(e){return(this.querySelector(`:scope > [slot="${e}"]`)?.textContent??"").replace(/\s+/g," ").trim()}__ensureDependenciesReady(){const e=[],t=[],i=this.cardType,c=!!this.vignette?.trim(),n=(v,h)=>{t.push(v),e.push(h())};(i==="list"||this.__hasLightDomElement("scb-list, scb-list-item"))&&n("list",At),i!=="standard"&&n("card-variants",()=>this.__ensureVariantRenderer()),(i==="social"&&(!this.likesDisabled&&this.likesInteractive||!this.commentsDisabled&&this.commentsHref||this.replyEnabled||this.editEnabled||this.deleteEnabled)||this.__hasLightDomElement("scb-icon-button"))&&n("icon-button",Tt),this.__hasLightDomElement("scb-button")&&n("button",Lt),this.__hasLightDomElement("scb-link")&&n("link",Ct),(c||this.__hasLightDomElement("scb-chip"))&&n("chip",Rt),((this.mediaType||"").toLowerCase()==="avatar"||this.__hasLightDomElement("scb-avatar"))&&n("avatar",$t),(i==="social"&&this.likesHoverContent||this.__hasLightDomElement("scb-tooltip"))&&n("tooltip",Pt);const b=t.sort().join("|");b!==this.__dependencyKey&&(this.__dependencyKey=b,e.length>0&&Promise.all(e).then(()=>this.requestUpdate()))}__mediaTemplate(e){const t=this.__isAvatarMedia();if(this.__hasSlottedContent("media",e)){const i=t?"":this.__mediaReserveStyle(this.__slottedMediaAspect());return d`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/lazy-focus-ring.js","../../vendor/rolldown-runtime.js","../../vendor/preload-helper.js","../../vendor/lazy-ripple.js","../scb-list/scb-list.js","../../vendor/vendor.js","../../vendor/vendor-lit.js","../../vendor/component-defaults.js","../../vendor/decorate.js","../scb-list/scb-list-item.js","../../vendor/component-size-token.js","../scb-icon-button/scb-icon-button.js","../../vendor/assertClassBrand.js","../../vendor/classPrivateMethodInitSpec.js","../scb-button/scb-button.js","../scb-link/scb-link.js","../../vendor/classPrivateFieldGet2.js","../scb-chip/scb-chip.js","../scb-avatar/scb-avatar.js","../scb-tooltip/scb-tooltip.js","../../vendor/icon.js","../../vendor/manual-popover.js","../../vendor/scb-card-variants.internal.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{g as l,h as ft,m as f,p as r,v as d,y as yt}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as m}from"../../vendor/preload-helper.js";import{t as zt}from"../../vendor/component-size-token.js";import{t as _t}from"../../vendor/component-defaults.js";import{t as a}from"../../vendor/decorate.js";(function(){try{var p=typeof globalThis<"u"?globalThis:window;if(!p.__scb_ce_guard_installed__){p.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,i,c){try{customElements.get(t)||e(t,i,c)}catch(b){var n=String(b||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw b}}}}catch{}})();var C,xt=new Set(["social-comments-text","social-comments","social-comments-disabled","social-comments-href","social-comments-link-label","social-likes-text","social-like-label","social-likes","social-likes-disabled","social-likes-hover-content","social-has-liked","social-likes-interactive","social-author","social-author-text","social-author-href","social-reply-enabled","social-reply-label","social-edit-enabled","social-edit-label","social-delete-enabled","social-delete-label"]),z="data-scb-card-managed-list-size",_="data-scb-card-managed-action-button-size",R="data-scb-card-managed-avatar-size",kt=new Set(["small","medium","large"]),wt=new Set(["small","medium","large","extra-large"]),$,P,I,E,B,D,H,O,V,N;function St(){return O??(O=m(()=>import("../../vendor/lazy-focus-ring.js").then(p=>p.i),__vite__mapDeps([0,1,2]),import.meta.url)),O}function U(){return V??(V=m(()=>import("../../vendor/lazy-ripple.js"),__vite__mapDeps([3,2]),import.meta.url)),V}function At(){return $??($=m(()=>import("../scb-list/scb-list.js"),__vite__mapDeps([4,5,6,7,8,9,2,10]),import.meta.url)),$}function Tt(){return P??(P=m(()=>import("../scb-icon-button/scb-icon-button.js"),__vite__mapDeps([11,5,6,2,7,8,12,13]),import.meta.url)),P}function Lt(){return I??(I=m(()=>import("../scb-button/scb-button.js"),__vite__mapDeps([14,5,6,2,7,8,12,13]),import.meta.url)),I}function Ct(){return E??(E=m(()=>import("../scb-link/scb-link.js"),__vite__mapDeps([15,5,6,0,1,2,8,12,13,16]),import.meta.url)),E}function Rt(){return B??(B=m(()=>import("../scb-chip/scb-chip.js"),__vite__mapDeps([17,5,6,2,8,12,13]),import.meta.url)),B}function $t(){return D??(D=m(()=>import("../scb-avatar/scb-avatar.js"),__vite__mapDeps([18,5,6,2,7,8,12,13]),import.meta.url)),D}function Pt(){return H??(H=m(()=>import("../scb-tooltip/scb-tooltip.js"),__vite__mapDeps([19,5,6,20,1,2,10,8,21]),import.meta.url)),H}function It(){return N??(N=m(()=>import("../../vendor/scb-card-variants.internal.js"),__vite__mapDeps([22,5,6]),import.meta.url)),N}var o={fromAttribute:p=>p??"",toAttribute:p=>typeof p!="string"||p.trim()===""?null:p},s=(C=class extends ft{constructor(...e){super(...e),this.__dependencyKey="",this.__focusRingRequested=!1,this.__focusRingLoaded=!1,this.__rippleRequested=!1,this.__rippleLoaded=!1,this.__pendingRippleClick=!1,this.__isSyncingManagedSocialAttributes=!1,this.type="standard",this.variant="standard",this.direction="dynamic",this.size=_t["scb-card"].size,this.mediaType="",this.mediaHref="",this.mediaAlt="",this.mediaSrcset="",this.mediaSizes="",this.mediaLoading="auto",this.mediaDecoding="async",this.mediaFetchPriority="auto",this.mediaFit="cover",this.mediaPosition="center",this.mediaWidth="",this.mediaHeight="",this.mediaAspect="",this.mediaPlaceholder=!1,this.cardHref="",this.href="",this.title="",this.cardTitle="",this.subtitle="",this.vignette="",this.vignetteVariant="filled",this.vignetteSpacing=void 0,this.vignetteSpacingTop=void 0,this.vignetteSpacingBottom=void 0,this.vignetteSpacingLeft=void 0,this.vignetteSpacingRight=void 0,this.supportingText="",this.commentsText="",this.commentsDisabled=!1,this.commentsHref="",this.commentsLinkLabel="Gå till kommentarer",this.likesText="",this.likeLabel="",this.likesDisabled=!1,this.likesHoverContent="",this.hasLiked=!1,this.likesInteractive=!0,this.author=!1,this.authorText="",this.authorHref="",this.replyEnabled=!1,this.replyLabel="Svara",this.editEnabled=!1,this.editLabel="Redigera",this.deleteEnabled=!1,this.deleteLabel="Ta bort",this.width="",this.maxWidth="",this.height="",this.maxHeight="",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.innerPadding=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.__onImgLoad=t=>{const i=t.currentTarget.closest(".media");i&&i.classList.add("is-loaded")},this.__ensureRippleOnInteraction=(t,i=!1)=>{if(this.__primaryHref()){if(t&&(this.__pendingRippleEvent=t),i&&(this.__pendingRippleClick=!0),this.__rippleLoaded){this.__syncRipple();return}this.__rippleRequested||(this.__rippleRequested=!0,U().then(({ensureRippleReady:c})=>c()).then(()=>{this.__rippleLoaded=!0,this.requestUpdate(),this.updateComplete.then(()=>this.__syncRipple())}))}},this.__syncRipple=async()=>{const t=this.renderRoot.querySelector("md-ripple"),i=this.renderRoot.querySelector(".scb-card"),c=this.__pendingRippleEvent,n=this.__pendingRippleClick;this.__pendingRippleEvent=void 0,this.__pendingRippleClick=!1;const{syncRippleToControl:b}=await U();await b(t,i,c,n)},this.__ensureFocusRingOnFocusVisible=()=>{this.__focusRingLoaded||this.__focusRingRequested||(this.__focusRingRequested=!0,St().then(({ensureFocusRingReady:t})=>t()).then(()=>{this.__focusRingLoaded=!0,this.requestUpdate()}))},this.__onKeyDown=t=>{if(t.target!==t.currentTarget)return;const i=this.__primaryHref();(t.key==="Enter"||t.key===" ")&&i&&(t.preventDefault(),this.__ensureRippleOnInteraction(void 0,!0),this.__navigate(i,t))},this.__handleHrefNavigation=t=>{const i=this.__primaryHref();i&&(t.target.closest("a")||this.__navigate(i,t))},this.__handleSlottedCardLinkClick=t=>{const i=t.composedPath().find(c=>c instanceof HTMLAnchorElement&&c.getAttribute("slot")==="card-link")?.getAttribute("href")||this.__primaryHref();i&&(this.__dispatchCardNavigate(i,t)||t.preventDefault())}}attributeChangedCallback(e,t,i){this.__isSyncingManagedSocialAttributes&&xt.has(e)||super.attributeChangedCallback(e,t,i)}get likeButton(){return this.cardType!=="social"?null:this.renderRoot.querySelector(".likes scb-icon-button")}__calcAspectWH(e){const t=(e||"").trim();if(!t)return{w:600,h:400};const i=t.includes("/")?t.split("/"):t.includes(":")?t.split(":"):t.includes("x")?t.split("x"):null;if(i&&i.length===2){const n=Number(i[0]),b=Number(i[1]);if(n>0&&b>0)return{w:n,h:b}}const c=Number(t);return isFinite(c)&&c>0?{w:1e3,h:Math.round(1e3/c)}:{w:600,h:400}}__mediaReserveAspect(e=""){const t=(this.mediaAspect||"").trim();if(t)return t;const i=Number(this.mediaWidth)||0,c=Number(this.mediaHeight)||0;return i>0&&c>0?`${i} / ${c}`:e}__mediaReserveStyle(e=""){const t=this.__mediaReserveAspect(e);return t?`--scb-card-media-aspect:${t};`:""}__slottedMediaAspect(){const e=this.querySelector('[slot="media"]');if(!e)return"";const t=Number(e.getAttribute("width"))||0,i=Number(e.getAttribute("height"))||0;return t>0&&i>0?`${t} / ${i}`:""}__isAvatarMedia(){return(this.mediaType||"").toLowerCase()==="avatar"?!0:this.querySelector(':scope > [slot="media"]')?.localName==="scb-avatar"}get __resolvedTitle(){return this.cardTitle||this.title}get cardType(){const e=(this.type||"standard").toLowerCase();switch(e){case"standard":case"list":case"social":case"link":case"action":case"container":return e;default:return"standard"}}__ensureVariantRenderer(){return this.cardType==="standard"||this.__variantRenderer?Promise.resolve():It().then(e=>{this.__variantRenderer!==e&&(this.__variantRenderer=e,e.ensureScbCardVariantStyles(this.renderRoot),this.requestUpdate())})}__dispatchCardNavigate(e,t){const i={href:e,originalEvent:t},c=new CustomEvent("card-navigate",{bubbles:!0,composed:!0,cancelable:!0,detail:i});if(this.dispatchEvent(c),c.defaultPrevented)return!1;const n=new CustomEvent("cardnavigate",{bubbles:!0,composed:!0,cancelable:!0,detail:i});return this.dispatchEvent(n),!n.defaultPrevented}__effectiveHref(){return this.cardHref||this.href}__slottedCardLink(){return this.querySelector(':scope > a[slot="card-link"]')}__primaryHref(){return this.__effectiveHref()||this.__slottedCardLink()?.getAttribute("href")||""}__navigate(e,t){e&&this.__dispatchCardNavigate(e,t)&&window.open(e,"_self")}__slotNames(){const e=new Set;for(const t of Array.from(this.children)){const i=t.getAttribute("slot");i&&e.add(i)}return e}__hasSlottedContent(e,t){return t?t.has(e):Array.from(this.children).some(i=>i.getAttribute("slot")===e)}__hasLightDomElement(e){return!!this.querySelector(e)}__syncListCardListSize(){const e=Array.from(this.querySelectorAll("scb-list"));if(this.cardType!=="list"){for(const i of e){const c=i.getAttribute(z);c!==null&&i.getAttribute("size")===c&&i.removeAttribute("size"),i.removeAttribute(z)}return}const t=this.size||"large";for(const i of e){const c=i.getAttribute(z);if(c!==null&&i.getAttribute("size")!==c){i.removeAttribute(z);continue}(!i.hasAttribute("size")||c!==null)&&(i.setAttribute("size",t),i.setAttribute(z,t))}}__actionCardButtonSize(){const e=getComputedStyle(this).getPropertyValue("--scb-card-size-actions-button-size").trim();return kt.has(e)?e:"medium"}__cardAvatarSize(){const e=getComputedStyle(this).getPropertyValue("--scb-card-size-avatar-component-size").trim();return wt.has(e)?e:"medium"}__syncAvatarSizes(){const e=Array.from(this.querySelectorAll(':scope > scb-avatar[slot="media"]')),t=this.__cardAvatarSize();for(const i of e){const c=i.getAttribute(R);if(c!==null&&i.getAttribute("size")!==c){i.removeAttribute(R);continue}(!i.hasAttribute("size")||c!==null)&&(i.setAttribute("size",t),i.setAttribute(R,t))}}__socialIconButtonSize(){return zt(this,"--scb-card-size-social-icon-button-component-size",["tiny","extra-small","small","medium","large"],this.size==="small"?"small":"medium")}__syncActionCardButtonSizes(){const e=Array.from(this.querySelectorAll(':scope > [slot="actions"] scb-button, :scope > scb-button[slot="actions"]'));if(this.cardType!=="action"){for(const i of e){const c=i.getAttribute(_);c!==null&&i.getAttribute("size")===c&&i.removeAttribute("size"),i.removeAttribute(_)}return}const t=this.__actionCardButtonSize();for(const i of e){const c=i.getAttribute(_);if(c!==null&&i.getAttribute("size")!==c){i.removeAttribute(_);continue}(!i.hasAttribute("size")||c!==null)&&(i.setAttribute("size",t),i.setAttribute(_,t))}}__slottedText(e){return(this.querySelector(`:scope > [slot="${e}"]`)?.textContent??"").replace(/\s+/g," ").trim()}__ensureDependenciesReady(){const e=[],t=[],i=this.cardType,c=!!this.vignette?.trim(),n=(v,h)=>{t.push(v),e.push(h())};(i==="list"||this.__hasLightDomElement("scb-list, scb-list-item"))&&n("list",At),i!=="standard"&&n("card-variants",()=>this.__ensureVariantRenderer()),(i==="social"&&(!this.likesDisabled&&this.likesInteractive||!this.commentsDisabled&&this.commentsHref||this.replyEnabled||this.editEnabled||this.deleteEnabled)||this.__hasLightDomElement("scb-icon-button"))&&n("icon-button",Tt),this.__hasLightDomElement("scb-button")&&n("button",Lt),this.__hasLightDomElement("scb-link")&&n("link",Ct),(c||this.__hasLightDomElement("scb-chip"))&&n("chip",Rt),((this.mediaType||"").toLowerCase()==="avatar"||this.__hasLightDomElement("scb-avatar"))&&n("avatar",$t),(i==="social"&&this.likesHoverContent||this.__hasLightDomElement("scb-tooltip"))&&n("tooltip",Pt);const b=t.sort().join("|");b!==this.__dependencyKey&&(this.__dependencyKey=b,e.length>0&&Promise.all(e).then(()=>this.requestUpdate()))}__mediaTemplate(e){const t=this.__isAvatarMedia();if(this.__hasSlottedContent("media",e)){const i=t?"":this.__mediaReserveStyle(this.__slottedMediaAspect());return d`
|
|
3
3
|
<div class="media ${t?"avatar-media":""} ${i?"has-reserved-space":""}" style=${i||l}>
|
|
4
4
|
<slot name="media"></slot>
|
|
5
5
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../scb-button/scb-button.js","../../vendor/vendor.js","../../vendor/vendor-lit.js","../../vendor/preload-helper.js","../../vendor/component-defaults.js","../../vendor/decorate.js","../../vendor/assertClassBrand.js","../../vendor/classPrivateMethodInitSpec.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{h as g,m,p as r,v,y}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as f}from"../../vendor/preload-helper.js";import{
|
|
2
|
+
import{h as g,m,p as r,v,y}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as f}from"../../vendor/preload-helper.js";import{t as k}from"../../vendor/component-size-token.js";import{t as n}from"../../vendor/decorate.js";import{a as _,t as h}from"../../vendor/manual-popover.js";(function(){try{var a=typeof globalThis<"u"?globalThis:window;if(!a.__scb_ce_guard_installed__){a.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(o,e,i){try{customElements.get(o)||t(o,e,i)}catch(u){var c=String(u||"");if(c.indexOf("already been used")===-1&&c.indexOf("NotSupportedError")===-1)throw u}}}}catch{}})();var p,l,d="data-scb-cookies-consent-managed-button-size";function x(){return!!document.querySelector('script[src*="/scb-button/scb-button.js"],script[src$="scb-button.js"]')}var b={fromAttribute(a){if(a===null)return!1;const t=a.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!=="no"}},s=(p=class extends g{constructor(...t){super(...t),this.open=!0,this.autoRemove=!0,this.title="",this.supportingText="",this.ariaLabel="Cookie-inställningar",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._updateButtonWidth=()=>{const o=window.innerWidth<=480,e=this.shadowRoot.querySelector('slot[name="buttons"]');e&&e.assignedElements().forEach(i=>{o?i.setAttribute("full-width",""):i.removeAttribute("full-width")})},this.__onButtonHydrationInteraction=o=>{const e=o.target;e instanceof Element&&e.closest('scb-button[slot="buttons"]')&&this.__ensureSlottedButtonsReady(!0)},this.__onButtonsSlotChange=()=>{this.__ensureSlottedButtonsReady(),this.__syncButtonSizes(),this._updateButtonWidth()}}__syncButtonSizes(){const t=k(this,"--scb-cookies-consent-action-button-size",["small","medium","large"],"medium"),o=Array.from(this.querySelectorAll(':scope > scb-button[slot="buttons"]'));for(const e of o){const i=e.getAttribute(d);if(i!==null&&e.getAttribute("size")!==i){e.removeAttribute(d);continue}(!e.hasAttribute("size")||i!==null)&&(e.setAttribute("size",t),e.setAttribute(d,t))}}__ensureSlottedButtonsReady(t=!1){if(!(!this.querySelector('scb-button[slot="buttons"]')||customElements.get("scb-button"))){if(x()){customElements.whenDefined("scb-button").then(()=>this.requestUpdate());return}t&&(l??(l=f(()=>import("../scb-button/scb-button.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url)),l.then(()=>this.requestUpdate()))}}mapSpacingToken(t){if(!t)return;const o=String(t).trim();if(o)return/^\d+$/.test(o)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(o,10)))})`:o}applySpacing(){const t=this.mapSpacingToken(this.spacing),o=this.mapSpacingToken(this.spacingTop)??t,e=this.mapSpacingToken(this.spacingBottom)??t,i=this.mapSpacingToken(this.spacingLeft),c=this.mapSpacingToken(this.spacingRight);o?this.style.setProperty("--scb-cookies-consent-spacing-block-start",o):this.style.removeProperty("--scb-cookies-consent-spacing-block-start"),e?this.style.setProperty("--scb-cookies-consent-spacing-block-end",e):this.style.removeProperty("--scb-cookies-consent-spacing-block-end"),i?this.style.setProperty("--scb-cookies-consent-spacing-inline-start",i):this.style.removeProperty("--scb-cookies-consent-spacing-inline-start"),c?this.style.setProperty("--scb-cookies-consent-spacing-inline-end",c):this.style.removeProperty("--scb-cookies-consent-spacing-inline-end")}firstUpdated(t){this.__ensureSlottedButtonsReady(),this.__syncButtonSizes(),this._updateButtonWidth(),window.addEventListener("resize",this._updateButtonWidth),this.addEventListener("pointerover",this.__onButtonHydrationInteraction,{capture:!0}),this.addEventListener("focusin",this.__onButtonHydrationInteraction,{capture:!0}),this.addEventListener("pointerdown",this.__onButtonHydrationInteraction,{capture:!0}),this.addEventListener("keydown",this.__onButtonHydrationInteraction,{capture:!0}),this.addEventListener("click",o=>{const e=o.target;e.slot==="buttons"&&(e.id==="accept-btn"?this.closeAndRemove("cookies-accept"):e.id==="decline-btn"?this.closeAndRemove("cookies-decline"):e.id==="handle-btn"&&this.closeAndRemove("cookies-handle"))}),this.applySpacing(),this.__syncTopLayer()}__syncTopLayer(){this.open&&getComputedStyle(this).position==="fixed"?_(this):h(this)}updated(t){super.updated(t),this.__syncButtonSizes(),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&this.applySpacing(),t.has("open")&&(this.__syncTopLayer(),t.get("open")!==void 0&&(this.open&&this._updateButtonWidth(),this.dispatchEvent(new CustomEvent("openchange",{bubbles:!0,composed:!0,detail:{open:this.open}}))))}connectedCallback(){super.connectedCallback(),this.id||(this.id="cookie-consent")}disconnectedCallback(){h(this),super.disconnectedCallback(),window.removeEventListener("resize",this._updateButtonWidth),this.removeEventListener("pointerover",this.__onButtonHydrationInteraction,{capture:!0}),this.removeEventListener("focusin",this.__onButtonHydrationInteraction,{capture:!0}),this.removeEventListener("pointerdown",this.__onButtonHydrationInteraction,{capture:!0}),this.removeEventListener("keydown",this.__onButtonHydrationInteraction,{capture:!0})}closeAndRemove(t){const o={bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent(t,o));const e=t.includes("-")?t.replace(/-/g,""):"";e&&e!==t&&this.dispatchEvent(new CustomEvent(e,o)),this.autoRemove?this.remove():this.open=!1}render(){return this.open?v`
|
|
3
3
|
<div role="dialog" class="cookies-consent" aria-modal="true" aria-label=${this.ariaLabel}>
|
|
4
4
|
<h2><slot name="title">${this.title}</slot></h2>
|
|
5
5
|
<div class="supporting-text">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as h,h as x,m as E,p as c,v as d,y as w}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import{componentSizeToken as b}from"../shared/component-size-token.js";import{t as l}from"../../vendor/decorate.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import{closeManualPopover as v,closeManualPopoverAfterAnimations as T,closeNestedPopupSurfaces as C,isManualPopoverOpen as F,openManualPopover as A}from"../shared/manual-popover.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";(function(){try{var g=typeof globalThis<"u"?globalThis:window;if(!g.__scb_ce_guard_installed__){g.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,i,s){try{customElements.get(t)||e(t,i,s)}catch(o){var n=String(o||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var m,a,k={fromAttribute(g){if(g===null)return!1;const e=g.trim().toLowerCase();return e!=="false"&&e!=="0"&&e!=="no"}},_=new Set,y="",S="",r=(m=class extends x{constructor(...e){super(...e),this.open=!1,this.inSb=!1,this.scrimClose=!0,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 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.closeLabel="Stäng dialog",this.formId="",this.formAction="",this.formMethod="",this.formEnctype="",this.__lastTriggerEl=null,this.__focusBeforeOpen=null,this.__stackInactive=!1,this.__submitting=!1,this.__redirectingFocus=!1,this.__scrollLocked=!1,this.__initialControlStates=new Map,this.__onDocumentClick=t=>{this.__getActionFromEvent(t)==="toggle"&&(this.__setOpen(!this.open),t.stopPropagation())},this.__onDocumentKeydown=t=>{if(!this.open||t.key!=="Escape")return;const i=a.__getTopmostOpenDialog();i&&i!==this||this.__hasOpenNestedOverlay(t)||(t.preventDefault(),t.stopPropagation(),this.__fireCancelable("esc")&&this.__setOpen(!1))},this.__onDocumentFocusIn=t=>{this.__redirectingFocus||a.__getTopmostOpenDialog()!==this||t.composedPath().includes(this)||(this.__redirectingFocus=!0,queueMicrotask(()=>{this.__focusInitial(),this.__redirectingFocus=!1}))},this.__rememberInitialControlStates=()=>{for(const t of this.__getSlottedElements()){if(!(t instanceof HTMLElement)||this.__initialControlStates.has(t))continue;const i={},s=t;"value"in s&&(i.value=s.value),"checked"in s&&(i.checked=s.checked),"selected"in s&&(i.selected=s.selected),Object.keys(i).length>0&&this.__initialControlStates.set(t,i)}},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=()=>{const t=this.shadowRoot?.querySelector("form");t instanceof HTMLFormElement&&(this.__clearGeneratedFormValues(t),t.reset()),this.__rememberInitialControlStates();for(const[i,s]of this.__initialControlStates){if(!i.isConnected)continue;if(i instanceof HTMLInputElement){i.type==="file"?i.value="":i.value=i.defaultValue,i.checked=i.defaultChecked;continue}if(i instanceof HTMLTextAreaElement){i.value=i.defaultValue;continue}if(i instanceof HTMLSelectElement){for(const o of Array.from(i.options))o.selected=o.defaultSelected;continue}const n=i;n.formResetCallback?.(),"value"in s&&(n.value=s.value),"checked"in s&&(n.checked=s.checked),"selected"in s&&(n.selected=s.selected),n.requestUpdate?.()}this.__fire("reset")},this.__onSubmit=()=>{if(this.__submitting)return;const t=this.shadowRoot?.querySelector("form");if(t instanceof HTMLFormElement){if(!this.__validateFormAndSlottedFields(t))return;t.requestSubmit()}},this.__onFormSubmit=async t=>{const i=t.currentTarget;if(!(i instanceof HTMLFormElement)||(t.preventDefault(),t.stopPropagation(),this.__submitting)||!this.__validateFormAndSlottedFields(i))return;const s=this.__createFormData(i),n=this.__getFormMethod(),o=i.action;if(this.__fireCancelable("submit",{form:i,formData:s,method:n,action:o})){if(this.formAction.trim()&&(n==="PUT"||n==="DELETE")){const p=new AbortController;this.__submitAbortController=p,this.__submitting=!0,this.setAttribute("aria-busy","true");try{const u=await fetch(o,{method:n,body:s,credentials:"same-origin",signal:p.signal}),f={form:i,formData:s,method:n,action:o,response:u,status:u.status};if(!u.ok){this.__fire("submit-error",f);return}this.__fire("submit-success",f),this.open&&this.__setOpen(!1)}catch(u){u instanceof DOMException&&u.name==="AbortError"&&!this.isConnected||this.__fire("submit-error",{form:i,formData:s,method:n,action:o,error:u})}finally{this.__submitAbortController===p&&(this.__submitAbortController=void 0,this.__submitting=!1,this.removeAttribute("aria-busy"))}return}if(this.formAction.trim()){const p=f=>{this.__appendSlottedFiles(i,f.formData)},u=i.getAttribute("enctype");Array.from(s.values()).some(f=>f instanceof File)&&!this.formEnctype.trim()&&(i.enctype="multipart/form-data"),i.addEventListener("formdata",p,{once:!0});try{this.__setOpen(!1),HTMLFormElement.prototype.submit.call(i)}finally{i.removeEventListener("formdata",p),u===null?i.removeAttribute("enctype"):i.setAttribute("enctype",u)}return}this.__setOpen(!1)}},this.__onKeydownTrap=t=>{if(!this.open||t.key!=="Tab"||a.__getTopmostOpenDialog()&&a.__getTopmostOpenDialog()!==this)return;const i=this.__collectFocusableElements();if(!i.length)return;const s=i[0],n=i[i.length-1],o=this.__currentFocusableFromEvent(t,i);!o||!i.includes(o)?((t.shiftKey?n:s).focus(),t.preventDefault()):t.shiftKey&&o===s?(n.focus(),t.preventDefault()):!t.shiftKey&&o===n&&(s.focus(),t.preventDefault())}}__getActionFromEvent(e){if(!this.id)return null;for(const t of e.composedPath())if(t instanceof Element){if(t.getAttribute("data-dialog-toggle")===this.id)return this.__lastTriggerEl=t,"toggle";if(t.getAttribute("aria-controls")===this.id)return this.__lastTriggerEl=t,"toggle"}return null}__hasOpenNestedOverlay(e){const t="scb-options-menu, scb-dropdown, scb-select",i=s=>s instanceof Element&&s!==this&&s.matches(t)&&!!s.open;return e.composedPath().some(i)?!0:Array.from(this.querySelectorAll(t)).some(s=>!!s.open)}__isModalOverlay(){return!this.inSb&&!this.__usesInPlaceLayout()}static __getTopmostOpenDialog(){return[...a.__openDialogs].reverse().find(e=>e.open&&e.isConnected&&e.__isModalOverlay())}static __restoreBackgroundInert(){for(const[e,t]of a.__backgroundInertSnapshot)e.inert=t;a.__backgroundInertSnapshot.clear()}static __setBackgroundInert(e){if(a.__restoreBackgroundInert(),!e)return;let t=e;for(;;){const i=t.parentNode;if(i instanceof Element||i instanceof ShadowRoot)for(const s of Array.from(i.children))s===t||!(s instanceof HTMLElement)||(a.__backgroundInertSnapshot.set(s,s.inert),s.inert=!0);if(i instanceof ShadowRoot){t=i.host;continue}if(i instanceof Element){t=i;continue}break}}__getRequestedZIndex(){if(typeof this.zIndex=="number"&&Number.isFinite(this.zIndex))return Math.trunc(this.zIndex);const e=Number.parseInt(getComputedStyle(this).getPropertyValue("--scb-layer-dialog-scrim"),10);return Number.isFinite(e)?e:1e3}__setStackLayer(e){this.style.setProperty("--z-dialog-scrim",String(e)),this.style.setProperty("--z-dialog",String(e+1))}__setStackInactive(e){this.__stackInactive!==e&&(this.__stackInactive=e,this.requestUpdate())}static __syncModalStack(){a.__openDialogs=a.__openDialogs.filter(s=>s.open&&s.isConnected&&s.__isModalOverlay());const e=a.__getTopmostOpenDialog(),t=a.__openDialogs.map(s=>s.__getRequestedZIndex()),i=t.length?Math.max(...t):1e3;a.__openDialogs.forEach((s,n)=>{s.__setStackInactive(s!==e),s.__setStackLayer(i+n*2)}),a.__setBackgroundInert(e)}__registerOpenDialog(){this.__isModalOverlay()&&(a.__openDialogs=a.__openDialogs.filter(e=>e!==this),a.__openDialogs.push(this),a.__syncModalStack())}__unregisterOpenDialog(){const e=[...a.__openDialogs].reverse().find(t=>t===this||t.open&&t.isConnected)===this;return a.__openDialogs=a.__openDialogs.filter(t=>t!==this),this.__setStackInactive(!1),a.__syncModalStack(),this.__applyZIndex(),e}__getDeepActiveElement(){let e=this.ownerDocument.activeElement;for(;e instanceof HTMLElement&&e.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e instanceof HTMLElement?e:null}__isInsideDialog(e){let t=e;for(;t;){if(t===this)return!0;t instanceof ShadowRoot?t=t.host:t=t.parentNode}return!1}__focusInitial(){if(!this.open||this.__stackInactive||a.__getTopmostOpenDialog()!==this)return;const e=this.__collectFocusableElements()[0];if(e){e.focus();return}this.shadowRoot?.querySelector(".container")?.focus()}__clearSavedFocus(){this.__lastTriggerEl=null,this.__focusBeforeOpen=null}async __restoreFocusAfterClose(){const e=this.__lastTriggerEl?.isConnected?this.__lastTriggerEl:this.__focusBeforeOpen?.isConnected?this.__focusBeforeOpen:null;this.__clearSavedFocus(),await Promise.resolve();const t=a.__getTopmostOpenDialog();if(t){await t.updateComplete,e&&t.__isInsideDialog(e)&&e.focus();const i=t.__getDeepActiveElement();(!i||!t.__isInsideDialog(i))&&t.__focusInitial();return}e?.focus()}connectedCallback(){super.connectedCallback(),this.__applyZIndex(),this.__applyMaxSize(),document.addEventListener("click",this.__onDocumentClick,!1),document.addEventListener("keydown",this.__onDocumentKeydown,!0),document.addEventListener("focusin",this.__onDocumentFocusIn,!0),this.addEventListener("keydown",this.__onKeydownTrap),this.open&&this.hasUpdated&&(this.__focusBeforeOpen=this.__getDeepActiveElement(),this.__registerOpenDialog(),this.__toggleScrollLock(!0),this.__isModalOverlay()&&this.updateComplete.then(()=>this.__focusInitial()))}disconnectedCallback(){document.removeEventListener("click",this.__onDocumentClick,!1),document.removeEventListener("keydown",this.__onDocumentKeydown,!0),document.removeEventListener("focusin",this.__onDocumentFocusIn,!0),this.removeEventListener("keydown",this.__onKeydownTrap),this.__submitAbortController?.abort(),v(this.shadowRoot?.querySelector(".layer"));const e=this.__unregisterOpenDialog();this.__toggleScrollLock(!1),e?this.__restoreFocusAfterClose():this.__clearSavedFocus(),super.disconnectedCallback()}__applyZIndex(){const e=typeof this.zIndex=="number"&&Number.isFinite(this.zIndex)?this.zIndex:void 0;if(e===void 0){this.style.removeProperty("--z-dialog-scrim"),this.style.removeProperty("--z-dialog");return}this.style.setProperty("--z-dialog-scrim",String(e)),this.style.setProperty("--z-dialog",String(e+1))}__applyMaxSize(){const e=(this.maxW??"").trim(),t=(this.maxH??"").trim();e?(this.style.setProperty("--scb-dialog-max-w",e),this.style.setProperty("--scb-dialog-width",`min(${e}, 90vw)`)):(this.style.removeProperty("--scb-dialog-max-w"),this.style.removeProperty("--scb-dialog-width")),t?this.style.setProperty("--scb-dialog-max-h",t):this.style.removeProperty("--scb-dialog-max-h")}updated(e){if(e.has("zIndex")&&(this.open&&this.__isModalOverlay()?a.__syncModalStack():this.__applyZIndex()),(e.has("maxW")||e.has("maxH"))&&this.__applyMaxSize(),e.has("open")){const t=e.get("open");this.__updateTriggersExpanded(),this.open&&!t?(this.__focusBeforeOpen=this.__getDeepActiveElement(),this.__registerOpenDialog(),this.__isModalOverlay()&&this.updateComplete.then(()=>this.__focusInitial())):!this.open&&t&&(this.__unregisterOpenDialog()?this.__restoreFocusAfterClose():this.__clearSavedFocus()),this.__toggleScrollLock(this.open)}if(e.has("inSb")&&this.open&&(this.__unregisterOpenDialog(),this.__registerOpenDialog(),this.__toggleScrollLock(!1),this.__toggleScrollLock(!0)),e.has("open")||e.has("inSb")){const t=this.shadowRoot?.querySelector(".layer");if(this.open&&this.__isModalOverlay())A(t);else if(this.open||C(this),!this.open&&F(t)){const i=this.shadowRoot?.querySelector(".container");T(t,void 0,i??t??void 0)}else v(t)}(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&this.__applySpacing()}__updateTriggersExpanded(){this.id&&document.querySelectorAll(`[aria-controls="${this.id}"], [data-dialog-toggle="${this.id}"]`).forEach(e=>{e.hasAttribute("aria-controls")&&e.setAttribute("aria-expanded",String(this.open))})}__usesInPlaceLayout(){const e=getComputedStyle(this);return e.getPropertyValue("--scb-dialog-scrim-position").trim()==="relative"||e.getPropertyValue("--scb-dialog-container-position").trim()==="absolute"}__toggleScrollLock(e){const t=document.documentElement,i=document.body;if(e){if(this.__scrollLocked||this.inSb||this.__usesInPlaceLayout())return;if(_.size===0){y=t.style.overflow,S=i.style.paddingRight;const s=window.innerWidth-t.clientWidth;if(t.style.overflow="hidden",s>0){const n=Number.parseFloat(getComputedStyle(i).paddingRight)||0;i.style.paddingRight=`${n+s}px`}}_.add(this),this.__scrollLocked=!0;return}this.__scrollLocked&&(_.delete(this),_.size===0&&(t.style.overflow=y,i.style.paddingRight=S),this.__scrollLocked=!1)}mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}__applySpacing(){const e=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??e,i=this.mapSpacingToken(this.spacingBottom)??e,s=this.mapSpacingToken(this.spacingLeft),n=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-dialog-spacing-block-start",t):this.style.removeProperty("--scb-dialog-spacing-block-start"),i?this.style.setProperty("--scb-dialog-spacing-block-end",i):this.style.removeProperty("--scb-dialog-spacing-block-end"),s?this.style.setProperty("--scb-dialog-spacing-inline-start",s):this.style.removeProperty("--scb-dialog-spacing-inline-start"),n?this.style.setProperty("--scb-dialog-spacing-inline-end",n):this.style.removeProperty("--scb-dialog-spacing-inline-end")}__setOpen(e){this.open=e,this.__fire(e?"open":"close")}__fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}__fireCancelable(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0,cancelable:!0}))}__getFormMethod(){const e=String(this.formMethod||"GET").trim().toUpperCase();return e==="POST"||e==="PUT"||e==="DELETE"?e:"GET"}__getSlottedElements(){const e=this.shadowRoot?.querySelector("slot");if(!(e instanceof HTMLSlotElement))return[];const t=e.assignedElements({flatten:!0}),i=[];for(const s of t)i.push(s,...Array.from(s.querySelectorAll("*")));return i}__appendHiddenFormValue(e,t,i){const s=document.createElement("input");s.type="hidden",s.name=t,s.value=i,s.setAttribute("data-scb-dialog-generated","true"),e.append(s)}__clearGeneratedFormValues(e){e.querySelectorAll('input[data-scb-dialog-generated="true"]').forEach(t=>t.remove())}__syncSlottedFormValues(e){this.__clearGeneratedFormValues(e),this.__getSlottedElements().forEach(t=>{if(!(t instanceof HTMLElement))return;const i=(t.getAttribute("name")??"").trim();if(i&&!(t.disabled===!0||t.hasAttribute("disabled"))){if(t instanceof HTMLInputElement){if(t.form===e)return;const s=(t.type||"").toLowerCase();if(s==="file")return;if(s==="checkbox"||s==="radio"){t.checked&&this.__appendHiddenFormValue(e,i,t.value||"on");return}this.__appendHiddenFormValue(e,i,t.value??"");return}if(t instanceof HTMLTextAreaElement){if(t.form===e)return;this.__appendHiddenFormValue(e,i,t.value??"");return}if(t instanceof HTMLSelectElement){if(t.form===e)return;if(t.multiple){Array.from(t.selectedOptions).forEach(s=>{this.__appendHiddenFormValue(e,i,s.value)});return}this.__appendHiddenFormValue(e,i,t.value??"");return}switch(t.tagName){case"SCB-TEXTFIELD":if(String(t.type??"").toLowerCase()==="file")return;this.__appendHiddenFormValue(e,i,String(t.value??""));return;case"SCB-CHECKBOX":t.checked&&this.__appendHiddenFormValue(e,i,String(t.value??t.getAttribute("value")??"on"));return;case"SCB-RADIO-BUTTON":t.checked&&this.__appendHiddenFormValue(e,i,String(t.value??t.getAttribute("value")??"on"));return;case"SCB-SWITCH":(t.selected||t.checked)&&this.__appendHiddenFormValue(e,i,String(t.value??t.getAttribute("value")??"on"));return;case"SCB-CHIP":t.selected&&this.__appendHiddenFormValue(e,i,String(t.value??t.getAttribute("value")??"on"));return;default:"value"in t&&this.__appendHiddenFormValue(e,i,String(t.value??""))}}})}__appendSlottedFiles(e,t){for(const i of this.__getSlottedElements()){if(!(i instanceof HTMLElement))continue;const s=(i.getAttribute("name")??"").trim();if(!(!s||i.disabled===!0||i.hasAttribute("disabled"))){if(i instanceof HTMLInputElement&&i.type==="file"){if(i.form===e)continue;for(const n of Array.from(i.files??[]))t.append(s,n);continue}if(i.tagName==="SCB-TEXTFIELD"&&String(i.type??"").toLowerCase()==="file"){const n=i.files;for(const o of Array.from(n??[]))t.append(s,o)}}}}__createFormData(e){this.__syncSlottedFormValues(e);const t=new FormData(e);return this.__appendSlottedFiles(e,t),t}__validateFormAndSlottedFields(e){const t=o=>o.disabled===!0||o.hasAttribute("disabled");let i=e.reportValidity(),s=null;const n=new Set;return this.__getSlottedElements().forEach(o=>{if(!(o instanceof HTMLElement)||n.has(o)||t(o))return;n.add(o);const p=o;if(o.tagName==="SCB-TEXTFIELD"&&p.error===!0){s||(s=o),i=!1;return}if(typeof p.reportValidity=="function"){const u=!!p.reportValidity();!u&&!s&&(s=o),i=i&&u}}),!i&&s&&s.focus(),i}__isFocusableElement(e){if(!(e instanceof HTMLElement)||!e.matches(a.__focusableSelector)||e.disabled||e.getAttribute("aria-hidden")==="true")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}__collectAssignedFocusableElements(e){const t=[];return this.__isFocusableElement(e)&&t.push(e),t.push(...Array.from(e.querySelectorAll(a.__focusableSelector)).filter(i=>this.__isFocusableElement(i))),t}__collectFocusableElements(){const e=this.shadowRoot;if(!e)return[];const t=[],i=new Set,s=o=>{i.has(o)||(i.add(o),t.push(o))},n=o=>{if(o instanceof HTMLSlotElement){o.assignedElements({flatten:!0}).flatMap(p=>this.__collectAssignedFocusableElements(p)).forEach(s);return}o instanceof HTMLElement&&this.__isFocusableElement(o)&&s(o),o.childNodes.forEach(n)};return e.childNodes.forEach(n),t}__currentFocusableFromEvent(e,t){const i=e.composedPath();return t.find(s=>i.includes(s))??(this.shadowRoot?.activeElement instanceof HTMLElement?this.shadowRoot.activeElement:null)??(document.activeElement instanceof HTMLElement?document.activeElement:null)}__slotIsEmpty(){const e=this.shadowRoot?.querySelector("slot");return e?e.assignedElements({flatten:!0}).length===0:!0}renderHeader(e){const t=this.variant==="form"||this.variant==="floating"||this.variant==="iframe";return d`
|
|
1
|
+
import{g as h,h as x,m as E,p as c,v as d,y as w}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import{t as b}from"../../vendor/component-size-token.js";import{t as l}from"../../vendor/decorate.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import{a as T,i as C,n as F,r as A,t as v}from"../../vendor/manual-popover.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";(function(){try{var g=typeof globalThis<"u"?globalThis:window;if(!g.__scb_ce_guard_installed__){g.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,i,s){try{customElements.get(t)||e(t,i,s)}catch(o){var n=String(o||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var m,a,k={fromAttribute(g){if(g===null)return!1;const e=g.trim().toLowerCase();return e!=="false"&&e!=="0"&&e!=="no"}},_=new Set,y="",S="",r=(m=class extends x{constructor(...e){super(...e),this.open=!1,this.inSb=!1,this.scrimClose=!0,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 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.closeLabel="Stäng dialog",this.formId="",this.formAction="",this.formMethod="",this.formEnctype="",this.__lastTriggerEl=null,this.__focusBeforeOpen=null,this.__stackInactive=!1,this.__submitting=!1,this.__redirectingFocus=!1,this.__scrollLocked=!1,this.__initialControlStates=new Map,this.__onDocumentClick=t=>{this.__getActionFromEvent(t)==="toggle"&&(this.__setOpen(!this.open),t.stopPropagation())},this.__onDocumentKeydown=t=>{if(!this.open||t.key!=="Escape")return;const i=a.__getTopmostOpenDialog();i&&i!==this||this.__hasOpenNestedOverlay(t)||(t.preventDefault(),t.stopPropagation(),this.__fireCancelable("esc")&&this.__setOpen(!1))},this.__onDocumentFocusIn=t=>{this.__redirectingFocus||a.__getTopmostOpenDialog()!==this||t.composedPath().includes(this)||(this.__redirectingFocus=!0,queueMicrotask(()=>{this.__focusInitial(),this.__redirectingFocus=!1}))},this.__rememberInitialControlStates=()=>{for(const t of this.__getSlottedElements()){if(!(t instanceof HTMLElement)||this.__initialControlStates.has(t))continue;const i={},s=t;"value"in s&&(i.value=s.value),"checked"in s&&(i.checked=s.checked),"selected"in s&&(i.selected=s.selected),Object.keys(i).length>0&&this.__initialControlStates.set(t,i)}},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=()=>{const t=this.shadowRoot?.querySelector("form");t instanceof HTMLFormElement&&(this.__clearGeneratedFormValues(t),t.reset()),this.__rememberInitialControlStates();for(const[i,s]of this.__initialControlStates){if(!i.isConnected)continue;if(i instanceof HTMLInputElement){i.type==="file"?i.value="":i.value=i.defaultValue,i.checked=i.defaultChecked;continue}if(i instanceof HTMLTextAreaElement){i.value=i.defaultValue;continue}if(i instanceof HTMLSelectElement){for(const o of Array.from(i.options))o.selected=o.defaultSelected;continue}const n=i;n.formResetCallback?.(),"value"in s&&(n.value=s.value),"checked"in s&&(n.checked=s.checked),"selected"in s&&(n.selected=s.selected),n.requestUpdate?.()}this.__fire("reset")},this.__onSubmit=()=>{if(this.__submitting)return;const t=this.shadowRoot?.querySelector("form");if(t instanceof HTMLFormElement){if(!this.__validateFormAndSlottedFields(t))return;t.requestSubmit()}},this.__onFormSubmit=async t=>{const i=t.currentTarget;if(!(i instanceof HTMLFormElement)||(t.preventDefault(),t.stopPropagation(),this.__submitting)||!this.__validateFormAndSlottedFields(i))return;const s=this.__createFormData(i),n=this.__getFormMethod(),o=i.action;if(this.__fireCancelable("submit",{form:i,formData:s,method:n,action:o})){if(this.formAction.trim()&&(n==="PUT"||n==="DELETE")){const p=new AbortController;this.__submitAbortController=p,this.__submitting=!0,this.setAttribute("aria-busy","true");try{const u=await fetch(o,{method:n,body:s,credentials:"same-origin",signal:p.signal}),f={form:i,formData:s,method:n,action:o,response:u,status:u.status};if(!u.ok){this.__fire("submit-error",f);return}this.__fire("submit-success",f),this.open&&this.__setOpen(!1)}catch(u){u instanceof DOMException&&u.name==="AbortError"&&!this.isConnected||this.__fire("submit-error",{form:i,formData:s,method:n,action:o,error:u})}finally{this.__submitAbortController===p&&(this.__submitAbortController=void 0,this.__submitting=!1,this.removeAttribute("aria-busy"))}return}if(this.formAction.trim()){const p=f=>{this.__appendSlottedFiles(i,f.formData)},u=i.getAttribute("enctype");Array.from(s.values()).some(f=>f instanceof File)&&!this.formEnctype.trim()&&(i.enctype="multipart/form-data"),i.addEventListener("formdata",p,{once:!0});try{this.__setOpen(!1),HTMLFormElement.prototype.submit.call(i)}finally{i.removeEventListener("formdata",p),u===null?i.removeAttribute("enctype"):i.setAttribute("enctype",u)}return}this.__setOpen(!1)}},this.__onKeydownTrap=t=>{if(!this.open||t.key!=="Tab"||a.__getTopmostOpenDialog()&&a.__getTopmostOpenDialog()!==this)return;const i=this.__collectFocusableElements();if(!i.length)return;const s=i[0],n=i[i.length-1],o=this.__currentFocusableFromEvent(t,i);!o||!i.includes(o)?((t.shiftKey?n:s).focus(),t.preventDefault()):t.shiftKey&&o===s?(n.focus(),t.preventDefault()):!t.shiftKey&&o===n&&(s.focus(),t.preventDefault())}}__getActionFromEvent(e){if(!this.id)return null;for(const t of e.composedPath())if(t instanceof Element){if(t.getAttribute("data-dialog-toggle")===this.id)return this.__lastTriggerEl=t,"toggle";if(t.getAttribute("aria-controls")===this.id)return this.__lastTriggerEl=t,"toggle"}return null}__hasOpenNestedOverlay(e){const t="scb-options-menu, scb-dropdown, scb-select",i=s=>s instanceof Element&&s!==this&&s.matches(t)&&!!s.open;return e.composedPath().some(i)?!0:Array.from(this.querySelectorAll(t)).some(s=>!!s.open)}__isModalOverlay(){return!this.inSb&&!this.__usesInPlaceLayout()}static __getTopmostOpenDialog(){return[...a.__openDialogs].reverse().find(e=>e.open&&e.isConnected&&e.__isModalOverlay())}static __restoreBackgroundInert(){for(const[e,t]of a.__backgroundInertSnapshot)e.inert=t;a.__backgroundInertSnapshot.clear()}static __setBackgroundInert(e){if(a.__restoreBackgroundInert(),!e)return;let t=e;for(;;){const i=t.parentNode;if(i instanceof Element||i instanceof ShadowRoot)for(const s of Array.from(i.children))s===t||!(s instanceof HTMLElement)||(a.__backgroundInertSnapshot.set(s,s.inert),s.inert=!0);if(i instanceof ShadowRoot){t=i.host;continue}if(i instanceof Element){t=i;continue}break}}__getRequestedZIndex(){if(typeof this.zIndex=="number"&&Number.isFinite(this.zIndex))return Math.trunc(this.zIndex);const e=Number.parseInt(getComputedStyle(this).getPropertyValue("--scb-layer-dialog-scrim"),10);return Number.isFinite(e)?e:1e3}__setStackLayer(e){this.style.setProperty("--z-dialog-scrim",String(e)),this.style.setProperty("--z-dialog",String(e+1))}__setStackInactive(e){this.__stackInactive!==e&&(this.__stackInactive=e,this.requestUpdate())}static __syncModalStack(){a.__openDialogs=a.__openDialogs.filter(s=>s.open&&s.isConnected&&s.__isModalOverlay());const e=a.__getTopmostOpenDialog(),t=a.__openDialogs.map(s=>s.__getRequestedZIndex()),i=t.length?Math.max(...t):1e3;a.__openDialogs.forEach((s,n)=>{s.__setStackInactive(s!==e),s.__setStackLayer(i+n*2)}),a.__setBackgroundInert(e)}__registerOpenDialog(){this.__isModalOverlay()&&(a.__openDialogs=a.__openDialogs.filter(e=>e!==this),a.__openDialogs.push(this),a.__syncModalStack())}__unregisterOpenDialog(){const e=[...a.__openDialogs].reverse().find(t=>t===this||t.open&&t.isConnected)===this;return a.__openDialogs=a.__openDialogs.filter(t=>t!==this),this.__setStackInactive(!1),a.__syncModalStack(),this.__applyZIndex(),e}__getDeepActiveElement(){let e=this.ownerDocument.activeElement;for(;e instanceof HTMLElement&&e.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e instanceof HTMLElement?e:null}__isInsideDialog(e){let t=e;for(;t;){if(t===this)return!0;t instanceof ShadowRoot?t=t.host:t=t.parentNode}return!1}__focusInitial(){if(!this.open||this.__stackInactive||a.__getTopmostOpenDialog()!==this)return;const e=this.__collectFocusableElements()[0];if(e){e.focus();return}this.shadowRoot?.querySelector(".container")?.focus()}__clearSavedFocus(){this.__lastTriggerEl=null,this.__focusBeforeOpen=null}async __restoreFocusAfterClose(){const e=this.__lastTriggerEl?.isConnected?this.__lastTriggerEl:this.__focusBeforeOpen?.isConnected?this.__focusBeforeOpen:null;this.__clearSavedFocus(),await Promise.resolve();const t=a.__getTopmostOpenDialog();if(t){await t.updateComplete,e&&t.__isInsideDialog(e)&&e.focus();const i=t.__getDeepActiveElement();(!i||!t.__isInsideDialog(i))&&t.__focusInitial();return}e?.focus()}connectedCallback(){super.connectedCallback(),this.__applyZIndex(),this.__applyMaxSize(),document.addEventListener("click",this.__onDocumentClick,!1),document.addEventListener("keydown",this.__onDocumentKeydown,!0),document.addEventListener("focusin",this.__onDocumentFocusIn,!0),this.addEventListener("keydown",this.__onKeydownTrap),this.open&&this.hasUpdated&&(this.__focusBeforeOpen=this.__getDeepActiveElement(),this.__registerOpenDialog(),this.__toggleScrollLock(!0),this.__isModalOverlay()&&this.updateComplete.then(()=>this.__focusInitial()))}disconnectedCallback(){document.removeEventListener("click",this.__onDocumentClick,!1),document.removeEventListener("keydown",this.__onDocumentKeydown,!0),document.removeEventListener("focusin",this.__onDocumentFocusIn,!0),this.removeEventListener("keydown",this.__onKeydownTrap),this.__submitAbortController?.abort(),v(this.shadowRoot?.querySelector(".layer"));const e=this.__unregisterOpenDialog();this.__toggleScrollLock(!1),e?this.__restoreFocusAfterClose():this.__clearSavedFocus(),super.disconnectedCallback()}__applyZIndex(){const e=typeof this.zIndex=="number"&&Number.isFinite(this.zIndex)?this.zIndex:void 0;if(e===void 0){this.style.removeProperty("--z-dialog-scrim"),this.style.removeProperty("--z-dialog");return}this.style.setProperty("--z-dialog-scrim",String(e)),this.style.setProperty("--z-dialog",String(e+1))}__applyMaxSize(){const e=(this.maxW??"").trim(),t=(this.maxH??"").trim();e?(this.style.setProperty("--scb-dialog-max-w",e),this.style.setProperty("--scb-dialog-width",`min(${e}, 90vw)`)):(this.style.removeProperty("--scb-dialog-max-w"),this.style.removeProperty("--scb-dialog-width")),t?this.style.setProperty("--scb-dialog-max-h",t):this.style.removeProperty("--scb-dialog-max-h")}updated(e){if(e.has("zIndex")&&(this.open&&this.__isModalOverlay()?a.__syncModalStack():this.__applyZIndex()),(e.has("maxW")||e.has("maxH"))&&this.__applyMaxSize(),e.has("open")){const t=e.get("open");this.__updateTriggersExpanded(),this.open&&!t?(this.__focusBeforeOpen=this.__getDeepActiveElement(),this.__registerOpenDialog(),this.__isModalOverlay()&&this.updateComplete.then(()=>this.__focusInitial())):!this.open&&t&&(this.__unregisterOpenDialog()?this.__restoreFocusAfterClose():this.__clearSavedFocus()),this.__toggleScrollLock(this.open)}if(e.has("inSb")&&this.open&&(this.__unregisterOpenDialog(),this.__registerOpenDialog(),this.__toggleScrollLock(!1),this.__toggleScrollLock(!0)),e.has("open")||e.has("inSb")){const t=this.shadowRoot?.querySelector(".layer");if(this.open&&this.__isModalOverlay())T(t);else if(this.open||A(this),!this.open&&C(t)){const i=this.shadowRoot?.querySelector(".container");F(t,void 0,i??t??void 0)}else v(t)}(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&this.__applySpacing()}__updateTriggersExpanded(){this.id&&document.querySelectorAll(`[aria-controls="${this.id}"], [data-dialog-toggle="${this.id}"]`).forEach(e=>{e.hasAttribute("aria-controls")&&e.setAttribute("aria-expanded",String(this.open))})}__usesInPlaceLayout(){const e=getComputedStyle(this);return e.getPropertyValue("--scb-dialog-scrim-position").trim()==="relative"||e.getPropertyValue("--scb-dialog-container-position").trim()==="absolute"}__toggleScrollLock(e){const t=document.documentElement,i=document.body;if(e){if(this.__scrollLocked||this.inSb||this.__usesInPlaceLayout())return;if(_.size===0){y=t.style.overflow,S=i.style.paddingRight;const s=window.innerWidth-t.clientWidth;if(t.style.overflow="hidden",s>0){const n=Number.parseFloat(getComputedStyle(i).paddingRight)||0;i.style.paddingRight=`${n+s}px`}}_.add(this),this.__scrollLocked=!0;return}this.__scrollLocked&&(_.delete(this),_.size===0&&(t.style.overflow=y,i.style.paddingRight=S),this.__scrollLocked=!1)}mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}__applySpacing(){const e=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??e,i=this.mapSpacingToken(this.spacingBottom)??e,s=this.mapSpacingToken(this.spacingLeft),n=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-dialog-spacing-block-start",t):this.style.removeProperty("--scb-dialog-spacing-block-start"),i?this.style.setProperty("--scb-dialog-spacing-block-end",i):this.style.removeProperty("--scb-dialog-spacing-block-end"),s?this.style.setProperty("--scb-dialog-spacing-inline-start",s):this.style.removeProperty("--scb-dialog-spacing-inline-start"),n?this.style.setProperty("--scb-dialog-spacing-inline-end",n):this.style.removeProperty("--scb-dialog-spacing-inline-end")}__setOpen(e){this.open=e,this.__fire(e?"open":"close")}__fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}__fireCancelable(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0,cancelable:!0}))}__getFormMethod(){const e=String(this.formMethod||"GET").trim().toUpperCase();return e==="POST"||e==="PUT"||e==="DELETE"?e:"GET"}__getSlottedElements(){const e=this.shadowRoot?.querySelector("slot");if(!(e instanceof HTMLSlotElement))return[];const t=e.assignedElements({flatten:!0}),i=[];for(const s of t)i.push(s,...Array.from(s.querySelectorAll("*")));return i}__appendHiddenFormValue(e,t,i){const s=document.createElement("input");s.type="hidden",s.name=t,s.value=i,s.setAttribute("data-scb-dialog-generated","true"),e.append(s)}__clearGeneratedFormValues(e){e.querySelectorAll('input[data-scb-dialog-generated="true"]').forEach(t=>t.remove())}__syncSlottedFormValues(e){this.__clearGeneratedFormValues(e),this.__getSlottedElements().forEach(t=>{if(!(t instanceof HTMLElement))return;const i=(t.getAttribute("name")??"").trim();if(i&&!(t.disabled===!0||t.hasAttribute("disabled"))){if(t instanceof HTMLInputElement){if(t.form===e)return;const s=(t.type||"").toLowerCase();if(s==="file")return;if(s==="checkbox"||s==="radio"){t.checked&&this.__appendHiddenFormValue(e,i,t.value||"on");return}this.__appendHiddenFormValue(e,i,t.value??"");return}if(t instanceof HTMLTextAreaElement){if(t.form===e)return;this.__appendHiddenFormValue(e,i,t.value??"");return}if(t instanceof HTMLSelectElement){if(t.form===e)return;if(t.multiple){Array.from(t.selectedOptions).forEach(s=>{this.__appendHiddenFormValue(e,i,s.value)});return}this.__appendHiddenFormValue(e,i,t.value??"");return}switch(t.tagName){case"SCB-TEXTFIELD":if(String(t.type??"").toLowerCase()==="file")return;this.__appendHiddenFormValue(e,i,String(t.value??""));return;case"SCB-CHECKBOX":t.checked&&this.__appendHiddenFormValue(e,i,String(t.value??t.getAttribute("value")??"on"));return;case"SCB-RADIO-BUTTON":t.checked&&this.__appendHiddenFormValue(e,i,String(t.value??t.getAttribute("value")??"on"));return;case"SCB-SWITCH":(t.selected||t.checked)&&this.__appendHiddenFormValue(e,i,String(t.value??t.getAttribute("value")??"on"));return;case"SCB-CHIP":t.selected&&this.__appendHiddenFormValue(e,i,String(t.value??t.getAttribute("value")??"on"));return;default:"value"in t&&this.__appendHiddenFormValue(e,i,String(t.value??""))}}})}__appendSlottedFiles(e,t){for(const i of this.__getSlottedElements()){if(!(i instanceof HTMLElement))continue;const s=(i.getAttribute("name")??"").trim();if(!(!s||i.disabled===!0||i.hasAttribute("disabled"))){if(i instanceof HTMLInputElement&&i.type==="file"){if(i.form===e)continue;for(const n of Array.from(i.files??[]))t.append(s,n);continue}if(i.tagName==="SCB-TEXTFIELD"&&String(i.type??"").toLowerCase()==="file"){const n=i.files;for(const o of Array.from(n??[]))t.append(s,o)}}}}__createFormData(e){this.__syncSlottedFormValues(e);const t=new FormData(e);return this.__appendSlottedFiles(e,t),t}__validateFormAndSlottedFields(e){const t=o=>o.disabled===!0||o.hasAttribute("disabled");let i=e.reportValidity(),s=null;const n=new Set;return this.__getSlottedElements().forEach(o=>{if(!(o instanceof HTMLElement)||n.has(o)||t(o))return;n.add(o);const p=o;if(o.tagName==="SCB-TEXTFIELD"&&p.error===!0){s||(s=o),i=!1;return}if(typeof p.reportValidity=="function"){const u=!!p.reportValidity();!u&&!s&&(s=o),i=i&&u}}),!i&&s&&s.focus(),i}__isFocusableElement(e){if(!(e instanceof HTMLElement)||!e.matches(a.__focusableSelector)||e.disabled||e.getAttribute("aria-hidden")==="true")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}__collectAssignedFocusableElements(e){const t=[];return this.__isFocusableElement(e)&&t.push(e),t.push(...Array.from(e.querySelectorAll(a.__focusableSelector)).filter(i=>this.__isFocusableElement(i))),t}__collectFocusableElements(){const e=this.shadowRoot;if(!e)return[];const t=[],i=new Set,s=o=>{i.has(o)||(i.add(o),t.push(o))},n=o=>{if(o instanceof HTMLSlotElement){o.assignedElements({flatten:!0}).flatMap(p=>this.__collectAssignedFocusableElements(p)).forEach(s);return}o instanceof HTMLElement&&this.__isFocusableElement(o)&&s(o),o.childNodes.forEach(n)};return e.childNodes.forEach(n),t}__currentFocusableFromEvent(e,t){const i=e.composedPath();return t.find(s=>i.includes(s))??(this.shadowRoot?.activeElement instanceof HTMLElement?this.shadowRoot.activeElement:null)??(document.activeElement instanceof HTMLElement?document.activeElement:null)}__slotIsEmpty(){const e=this.shadowRoot?.querySelector("slot");return e?e.assignedElements({flatten:!0}).length===0:!0}renderHeader(e){const t=this.variant==="form"||this.variant==="floating"||this.variant==="iframe";return d`
|
|
2
2
|
<div class="header">
|
|
3
3
|
<div class="title">
|
|
4
4
|
${this.icon?d`<md-icon class="dialog-icon">${this.icon}</md-icon>`:h}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as f,h as y,m,p as c,v as b,y as g}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as l}from"../../vendor/decorate.js";import{
|
|
1
|
+
import{g as f,h as y,m,p as c,v as b,y as g}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as l}from"../../vendor/decorate.js";import{a as h,i as w,n as p,r as E,t as v}from"../../vendor/manual-popover.js";import"../scb-divider/scb-divider.js";(function(){try{var _=typeof globalThis<"u"?globalThis:window;if(!_.__scb_ce_guard_installed__){_.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,o,s){try{customElements.get(t)||e(t,o,s)}catch(n){var u=String(n||"");if(u.indexOf("already been used")===-1&&u.indexOf("NotSupportedError")===-1)throw n}}}}catch{}})();var i,r,d={fromAttribute(_){if(_===null)return!1;const e=_.trim().toLowerCase();return e!=="false"&&e!=="0"&&e!=="no"}},a=(i=class extends y{constructor(...e){super(...e),this.floating=!0,this.left=!0,this.right=!1,this.open=!1,this.overlay=!1,this.lockScroll=!1,this.closeOnOverlay=!0,this.modal=!1,this.ariaLabel="Sidopanel",this.__effectiveSide="left",this.__lastTriggerEl=null,this.__lastTriggerWasAriaControls=!1,this.__onDocumentClick=t=>{const o=this.__getActionFromEvent(t);if(o){o==="open"&&this.__setOpen(!0),o==="close"&&this.__setOpen(!1),o==="toggle"&&this.__setOpen(!this.open),t.stopPropagation();return}this.floating&&this.open&&!this.overlay&&(t.composedPath().includes(this)||this.__setOpen(!1))},this.__onDocumentKeydown=t=>{if(this.open){if(t.key==="Escape"){if(this.__hasOpenNestedOverlay(t))return;t.preventDefault(),t.stopPropagation(),this.__setOpen(!1);return}if(this.overlay&&t.key==="Tab"){const o=this.__getFocusable();if(o.length===0)return;const s=o[0],u=o[o.length-1],n=this.__currentFocusableFromEvent(t,o);t.shiftKey?(n===s||!n)&&(t.preventDefault(),u.focus()):(n===u||!n)&&(t.preventDefault(),s.focus())}}}}static __ensureOverlayStyles(){if(typeof document>"u"||document.getElementById("scb-drawer-overlay-styles"))return;const e=document.createElement("style");e.id="scb-drawer-overlay-styles",e.textContent=`
|
|
2
2
|
.scb-drawer-global-overlay {
|
|
3
3
|
position: fixed;
|
|
4
4
|
inset: 0;
|
|
@@ -27,7 +27,7 @@ import{g as f,h as y,m,p as c,v as b,y as g}from"../../vendor/vendor.js";import"
|
|
|
27
27
|
@media (prefers-reduced-motion: reduce) {
|
|
28
28
|
.scb-drawer-global-overlay { transition: none; }
|
|
29
29
|
}
|
|
30
|
-
`,document.head.appendChild(e)}static __ensureOverlay(){if(typeof document>"u"||r.__overlayEl)return;r.__ensureOverlayStyles();const e=document.createElement("div");e.className="scb-drawer-global-overlay",e.addEventListener("pointerdown",()=>{const t=r.__overlayStack[r.__overlayStack.length-1];t&&t.closeOnOverlay&&t.__setOpen(!1)},{passive:!0}),document.body.appendChild(e),r.__overlayEl=e}static __showOverlay(e){r.__ensureOverlay(),r.__overlayEl&&(r.__overlayStack.includes(e)||r.__overlayStack.push(e),r.__syncOverlayColors(e),
|
|
30
|
+
`,document.head.appendChild(e)}static __ensureOverlay(){if(typeof document>"u"||r.__overlayEl)return;r.__ensureOverlayStyles();const e=document.createElement("div");e.className="scb-drawer-global-overlay",e.addEventListener("pointerdown",()=>{const t=r.__overlayStack[r.__overlayStack.length-1];t&&t.closeOnOverlay&&t.__setOpen(!1)},{passive:!0}),document.body.appendChild(e),r.__overlayEl=e}static __showOverlay(e){r.__ensureOverlay(),r.__overlayEl&&(r.__overlayStack.includes(e)||r.__overlayStack.push(e),r.__syncOverlayColors(e),h(r.__overlayEl),r.__overlayEl.classList.add("is-visible"))}static __hideOverlay(e){const t=r.__overlayStack.indexOf(e);t>=0&&r.__overlayStack.splice(t,1);const o=r.__overlayStack[r.__overlayStack.length-1];o&&r.__syncOverlayColors(o),r.__overlayStack.length===0&&r.__overlayEl&&(r.__overlayEl.classList.remove("is-visible"),p(r.__overlayEl),r.__overlayEl.style.removeProperty("--scb-drawer-overlay-color"),r.__overlayEl.style.removeProperty("--scb-drawer-scrim-color"))}static __syncOverlayColors(e){if(!r.__overlayEl||typeof getComputedStyle!="function")return;const t=getComputedStyle(e);for(const o of["--scb-drawer-overlay-color","--scb-drawer-scrim-color"]){const s=t.getPropertyValue(o).trim();s?r.__overlayEl.style.setProperty(o,s):r.__overlayEl.style.removeProperty(o)}}static __lockScrollEnable(){if(!(typeof document>"u")){if(r.__lockedCount===0){r.__prevDocOverflow=document.documentElement.style.overflow||"",r.__prevBodyOverflow=document.body.style.overflow||"",r.__prevDocPaddingRight=document.documentElement.style.paddingRight||"",r.__prevBodyPaddingRight=document.body.style.paddingRight||"";const e=Math.max(0,window.innerWidth-document.documentElement.clientWidth);if(e>0){const t=Number.parseFloat(getComputedStyle(document.documentElement).paddingRight||"0"),o=Number.parseFloat(getComputedStyle(document.body).paddingRight||"0");document.documentElement.style.paddingRight=`${t+e}px`,document.body.style.paddingRight=`${o+e}px`}document.documentElement.style.overflow="hidden",document.body.style.overflow="hidden"}r.__lockedCount++}}static __lockScrollDisable(){typeof document>"u"||(r.__lockedCount=Math.max(0,r.__lockedCount-1),r.__lockedCount===0&&(document.documentElement.style.overflow=r.__prevDocOverflow??"",document.body.style.overflow=r.__prevBodyOverflow??"",document.documentElement.style.paddingRight=r.__prevDocPaddingRight??"",document.body.style.paddingRight=r.__prevBodyPaddingRight??""))}render(){const e=this.modal&&this.overlay&&this.floating;return b`
|
|
31
31
|
<div
|
|
32
32
|
class="root"
|
|
33
33
|
role=${e?"dialog":f}
|
|
@@ -36,6 +36,6 @@ import{g as f,h as y,m,p as c,v as b,y as g}from"../../vendor/vendor.js";import"
|
|
|
36
36
|
>
|
|
37
37
|
<div class="panel"><slot></slot></div>
|
|
38
38
|
</div>
|
|
39
|
-
`}connectedCallback(){super.connectedCallback(),this.__syncEffectiveSide(new Map),document.addEventListener("click",this.__onDocumentClick,!1)}disconnectedCallback(){document.removeEventListener("click",this.__onDocumentClick,!1),document.removeEventListener("keydown",this.__onDocumentKeydown,!0),this.overlay&&(r.__hideOverlay(this),this.lockScroll&&r.__lockScrollDisable()),
|
|
39
|
+
`}connectedCallback(){super.connectedCallback(),this.__syncEffectiveSide(new Map),document.addEventListener("click",this.__onDocumentClick,!1)}disconnectedCallback(){document.removeEventListener("click",this.__onDocumentClick,!1),document.removeEventListener("keydown",this.__onDocumentKeydown,!0),this.overlay&&(r.__hideOverlay(this),this.lockScroll&&r.__lockScrollDisable()),v(this),super.disconnectedCallback()}__getActionFromEvent(e){if(!this.id)return null;const t=e.composedPath();for(const o of t)if(o instanceof Element){if(o.getAttribute("data-drawer-open")===this.id)return this.__lastTriggerEl=o,this.__lastTriggerWasAriaControls=!1,"open";if(o.getAttribute("data-drawer-close")===this.id)return this.contains(o)||(this.__lastTriggerEl=o,this.__lastTriggerWasAriaControls=!1),"close";if(o.getAttribute("data-drawer-toggle")===this.id)return this.__lastTriggerEl=o,this.__lastTriggerWasAriaControls=!1,"toggle";if(o.getAttribute("aria-controls")===this.id)return this.__lastTriggerEl=o,this.__lastTriggerWasAriaControls=!0,"toggle"}return null}__hasOpenNestedOverlay(e){const t="scb-options-menu, scb-dropdown, scb-select",o=s=>s instanceof Element&&s!==this&&s.matches(t)&&!!s.open;return e.composedPath().some(o)?!0:Array.from(this.querySelectorAll(t)).some(s=>!!s.open)}__getFocusable(){const e=["button","[href]","input","select","textarea",'[tabindex]:not([tabindex="-1"])',"scb-button","scb-icon-button","scb-textfield","scb-checkbox","scb-radio-button","scb-switch","scb-chip","scb-menu-item"].join(", "),t=new Set,o=s=>{s.querySelectorAll(e).forEach(u=>{const n=this.__resolveFocusable(u);n&&t.add(n)})};return o(this),o(this.renderRoot),Array.from(t).filter(s=>!this.__isDisabledOrHidden(s))}__resolveFocusable(e){return this.__isDisabledOrHidden(e)?null:e.tagName==="SCB-BUTTON"||e.tagName==="SCB-ICON-BUTTON"?e.shadowRoot?.querySelector(".native-button, button, a")??e:e.tagName==="SCB-MENU-ITEM"?e.shadowRoot?.querySelector(".scb-menu-label-text")??e:e}__isDisabledOrHidden(e){if(e.disabled||e.getAttribute("aria-hidden")==="true")return!0;const t=getComputedStyle(e);return t.display==="none"||t.visibility==="hidden"}__currentFocusableFromEvent(e,t){const o=e.composedPath();return t.find(s=>o.includes(s))??(this.shadowRoot?.activeElement instanceof HTMLElement?this.shadowRoot.activeElement:null)??(document.activeElement instanceof HTMLElement?document.activeElement:null)}__setOpen(e){this.open=e}async __focusFirstControl(){await this.updateComplete;for(let e=0;e<4;e+=1){await new Promise(o=>requestAnimationFrame(()=>o()));const t=this.__getFocusable()[0];if(t?.focus?.({preventScroll:!0}),t&&this.__isFocused(t))return}}__isFocused(e){if(document.activeElement===e)return!0;const t=e.getRootNode();return t instanceof ShadowRoot&&t.activeElement===e}__syncLastTriggerExpanded(e){this.__lastTriggerEl&&this.__lastTriggerWasAriaControls&&this.__lastTriggerEl.getAttribute("aria-controls")===this.id&&this.__lastTriggerEl.setAttribute("aria-expanded",String(e))}__syncEffectiveSide(e){const t=this.left&&this.right;let o;t?e.has("left")&&this.left&&!e.has("right")?o="left":o="right":this.right?o="right":o="left",this.__effectiveSide!==o&&(this.__effectiveSide=o),this.getAttribute("data-side")!==o&&this.setAttribute("data-side",o)}willUpdate(e){this.__syncEffectiveSide(e)}updated(e){if(this.open&&this.floating&&this.overlay&&r.__syncOverlayColors(this),e.has("open")){const t=!!e.get("open");this.__applyOpenSideEffects(t,this.open)}(e.has("open")||e.has("floating"))&&(this.open&&this.floating?h(this):(this.open||E(this),!this.open&&w(this)?p(this):v(this)))}__applyOpenSideEffects(e,t){if(t&&!e)this.__syncLastTriggerExpanded(!0),this.floating&&this.overlay&&(r.__showOverlay(this),this.lockScroll&&r.__lockScrollEnable()),document.addEventListener("keydown",this.__onDocumentKeydown,!0),this.__focusFirstControl(),this.dispatchEvent(new CustomEvent("scb-drawer-opened",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbdraweropened",{bubbles:!0,composed:!0}));else if(!t&&e){this.__syncLastTriggerExpanded(!1),this.floating&&this.overlay&&(r.__hideOverlay(this),this.lockScroll&&r.__lockScrollDisable()),document.removeEventListener("keydown",this.__onDocumentKeydown,!0);const o=this.__lastTriggerEl;requestAnimationFrame(()=>{this.open||o?.focus?.({preventScroll:!0})}),this.dispatchEvent(new CustomEvent("scb-drawer-closed",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbdrawerclosed",{bubbles:!0,composed:!0}))}}},r=i,i.__overlayEl=null,i.__overlayStack=[],i.__lockedCount=0,i.__prevDocOverflow=null,i.__prevBodyOverflow=null,i.__prevDocPaddingRight=null,i.__prevBodyPaddingRight=null,i.styles=g`:host{display:block;color:var(--scb-drawer-content-color, var(--md-sys-color-on-surface));padding:var(--scb-drawer-padding, var(--spacing-4, 12px));background:var(--scb-drawer-background,
|
|
40
40
|
var(--md-sys-color-surface-container)
|
|
41
41
|
);font-family:var(--brand-font)}:host([popover]){inset:auto;margin:0;border:0}:host([floating]){box-sizing:border-box;position:fixed;top:0;height:100vh;height:100dvh;width:clamp(var(--scb-drawer-min-width, 280px),var(--scb-drawer-fluid-width, 70vw),var(--scb-drawer-max-width, 360px));--scb-drawer-background:var(--scb-drawer-surface-color, var(--md-sys-color-surface-container-lowest));box-shadow:var(--scb-drawer-elevation, var(--scb-shadow-drawer-start));border-radius:var(--scb-drawer-surface-radius, 0);z-index:var(--scb-drawer-z, var(--scb-layer-drawer, 1000));transition:transform .3s ease,opacity .3s ease,visibility .3s;opacity:0;visibility:hidden;pointer-events:none;will-change:transform;font-family:var(--brand-font);overflow:hidden}@media (prefers-reduced-motion:reduce){:host([floating]){transition:none}}:host([floating][data-side="left"]){left:0;transform:translateX(-100%)}:host([floating][data-side="left"][open]){transform:translateX(0);opacity:1;visibility:visible;pointer-events:auto}:host([floating][data-side="right"]){right:0;transform:translateX(100%);box-shadow:var(--scb-drawer-elevation, var(--scb-shadow-drawer-end))}:host([floating][data-side="right"][open]){transform:translateX(0);opacity:1;visibility:visible;pointer-events:auto}::slotted(scb-menu){background:var(--scb-drawer-surface-color, var(--md-sys-color-surface-container-lowest));--scb-menu-background:var(--scb-drawer-surface-color, var(--md-sys-color-surface-container-lowest))}.root{height:100%;display:flex;flex-direction:column;min-height:0}.panel{contain:layout paint style;flex:1 1 auto;min-height:0;overflow:auto;scrollbar-gutter:stable;-webkit-overflow-scrolling:touch}:host([floating]:not([open])) .panel{content-visibility:auto;contain-intrinsic-size:0 600px}@supports not (scrollbar-gutter:stable){.panel{overflow-y:scroll}}`,i);l([c({type:Boolean,reflect:!0,converter:d})],a.prototype,"floating",void 0);l([c({type:Boolean,reflect:!0,converter:d})],a.prototype,"left",void 0);l([c({type:Boolean,reflect:!0,converter:d})],a.prototype,"right",void 0);l([c({type:Boolean,reflect:!0,converter:d})],a.prototype,"open",void 0);l([c({type:Boolean,reflect:!0,converter:d})],a.prototype,"overlay",void 0);l([c({type:Boolean,reflect:!0,attribute:"lock-scroll",converter:d})],a.prototype,"lockScroll",void 0);l([c({type:Boolean,reflect:!0,attribute:"close-on-overlay",converter:d})],a.prototype,"closeOnOverlay",void 0);l([c({type:Boolean,reflect:!0,converter:d})],a.prototype,"modal",void 0);l([c({type:String,reflect:!0,attribute:"aria-label"})],a.prototype,"ariaLabel",void 0);a=r=l([m("scb-drawer")],a);export{a as ScbDrawer};
|