scb-wc-test 0.1.312 → 0.1.314

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.
@@ -1,4 +1,4 @@
1
- import{a as _,n as o,r as c,i as g,x as p,t as b}from"../../vendor/vendor.js";import"../scb-button/scb-button.js";import"../../vendor/vendor-material.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(r,i,l){try{customElements.get(r)||t(r,i,l)}catch(d){var n=String(d||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var f=Object.defineProperty,w=Object.getOwnPropertyDescriptor,a=(e,t,r,i)=>{for(var l=i>1?void 0:i?w(t,r):t,n=e.length-1,d;n>=0;n--)(d=e[n])&&(l=(i?d(t,r,l):d(l))||l);return i&&l&&f(t,r,l),l};let s=class extends g{constructor(){super(),this._internals=null,this.type="default",this.name="",this.multiple=!1,this.label="",this.supportingText="",this.metaText="",this.buttonLabel="",this.replaceButtonLabel="",this.removeButtonLabel="",this.previewEyebrow="",this.emptyPreviewTitle="",this.emptyPreviewMeta="",this.accept="",this.showPreview=!0,this.showExistingPreview=!1,this.disabled=!1,this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this.existingValue="",this.existingValueName="",this.removeValueName="",this._isDragOver=!1,this._selectedPreviewKind="empty",this._selectedPreviewSrc="",this._selectedPreviewAlt="",this._selectedPreviewTitle="",this._selectedPreviewMeta="",this._selectedPreviewItems=[],this._markedForRemoval=!1,this._dragDepth=0,this._previewSource="external","attachInternals"in this&&(this._internals=this.attachInternals())}get _resolvedAccept(){return this.accept.trim()||(this.type==="image"?"image/*,.png,.jpg,.jpeg,.webp,.svg,.gif,.bmp,.avif":"")}get _hasExistingPreview(){return this.multiple||this._markedForRemoval||!this.showExistingPreview?!1:!!this.existingValue.trim()||!!this.previewSrc.trim()||!!this.previewTitle.trim()||!!this.previewMeta.trim()}get _resolvedPreviewKind(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewSrc.trim()?"image":"file":this._selectedPreviewKind}get _hasPreview(){return this._resolvedPreviewKind!=="empty"}get _resolvedLabel(){return this.label||(this.type==="image"?"Ladda upp bild":"Ladda upp fil")}get _resolvedSupportingText(){return this.multiple?this.supportingText||(this.type==="image"?"Dra och släpp en eller flera bilder här, eller välj bilder från din dator.":"Dra och släpp en eller flera filer här, eller välj filer från din dator."):this.supportingText||(this.type==="image"?"Dra och släpp en bild här, eller välj en bild från din dator.":"Dra och släpp en fil här, eller välj en fil från din dator.")}get _resolvedMetaText(){return this.metaText?this.metaText:this.type==="image"?"PNG, JPG, SVG, GIF, BMP, AVIF och WebP stöds.":"Alla filtyper stöds."}get _resolvedButtonLabel(){return this.buttonLabel||(this.type==="image"?"Välj bild":"Välj fil")}get _resolvedReplaceButtonLabel(){return this.replaceButtonLabel?this.replaceButtonLabel:this.multiple||this._resolvedPreviewKind==="multi"?"Lägg till fler filer":this._previewSource==="external"&&this._hasExistingPreview?this._resolvedPreviewKind==="image"?"Ersätt bild":"Ersätt fil":this._resolvedPreviewKind==="image"?"Byt bild":"Byt fil"}get _resolvedRemoveButtonLabel(){return this.removeButtonLabel?this.removeButtonLabel:this._resolvedPreviewKind==="multi"?"Ta bort filer":this._previewSource==="external"&&this._hasExistingPreview?this._resolvedPreviewKind==="image"?"Ta bort befintlig bild":"Ta bort befintlig fil":this._resolvedPreviewKind==="image"?"Ta bort bild":"Ta bort fil"}get _resolvedPreviewEyebrow(){return this.previewEyebrow?this.previewEyebrow:this._hasPreview?this._resolvedPreviewKind==="multi"?"Uppladdade filer":this._previewSource==="external"&&this._hasExistingPreview?this._resolvedPreviewKind==="image"?"Befintlig bild":"Befintlig fil":this._resolvedPreviewKind==="image"?"Uppladdad bild":"Uppladdad fil":"Förhandsvisning"}get _resolvedEmptyPreviewTitle(){return this.emptyPreviewTitle?this.emptyPreviewTitle:this.multiple?this.type==="image"?"Inga bilder uppladdade":"Inga filer uppladdade":this.type==="image"?"Ingen bild uppladdad":"Ingen fil uppladdad"}get _resolvedEmptyPreviewMeta(){return this.emptyPreviewMeta?this.emptyPreviewMeta:this.multiple?this.type==="image"?"Förhandsvisningen visas här när du har laddat upp bilder.":"Förhandsvisningen visas här när du har laddat upp filer.":this.type==="image"?"Förhandsvisningen visas här när du har laddat upp en bild.":"Förhandsvisningen visas här när du har laddat upp en fil."}get _resolvedPreviewSrc(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewSrc.trim():this._selectedPreviewSrc}get _resolvedPreviewAlt(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewAlt:this._selectedPreviewAlt}get _resolvedPreviewTitle(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewTitle||(this._resolvedPreviewKind==="image"?"Befintlig bild":"Befintlig fil"):this._selectedPreviewTitle}get _resolvedPreviewMeta(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewMeta:this._selectedPreviewMeta}disconnectedCallback(){this._revokeObjectUrl(),super.disconnectedCallback()}updated(e){e.has("type")&&this.type==="image"&&this._selectedPreviewKind==="file"&&this._clearSelectedFileState(),(e.has("disabled")||e.has("name")||e.has("multiple")||e.has("existingValueName")||e.has("removeValueName")||e.has("existingValue"))&&this._syncFormValue()}formDisabledCallback(e){this.disabled=e}formResetCallback(){this._clearSelectedFileState(),this._markedForRemoval=!1,this._previewSource="external",this._clearNativeInputValue(),this._syncFormValue()}_syncFormValue(){if(!this._internals)return;const e=this.name.trim(),t=this.existingValueName.trim(),r=this.removeValueName.trim(),i=new FormData;if(!this.disabled&&e&&this._selectedPreviewItems.length&&this._selectedPreviewItems.forEach(l=>{i.append(e,l.file,l.file.name)}),!this.disabled&&!this.multiple&&t&&this.existingValue.trim()&&i.append(t,this.existingValue),!this.disabled&&!this.multiple&&r&&i.append(r,this._markedForRemoval?"true":"false"),[...i.keys()].length===0){this._internals.setFormValue(null);return}this._internals.setFormValue(i)}openPicker(){if(this.disabled)return;const e=this.renderRoot.querySelector('[data-role="native-input"]');if(e){try{e.value=""}catch{}e.click()}}setPreviewState(e){this.previewSrc=e?.src??"",this.previewAlt=e?.alt??"",this.previewTitle=e?.title??"",this.previewMeta=e?.meta??"",this._markedForRemoval=!1,this._previewSource=this._selectedPreviewItems.length?"internal":"external",this._syncFormValue()}setExistingFileState(e){if(this.multiple){this.existingValue="",this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._markedForRemoval=!1,this._syncFormValue();return}this.existingValue=e?.value??"",this.previewSrc=e?.src??"",this.previewAlt=e?.alt??"",this.previewTitle=e?.title??"",this.previewMeta=e?.meta??"",this._markedForRemoval=!1,this._previewSource=this._selectedPreviewItems.length?"internal":"external",this._syncFormValue()}clearPreviewState(){this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._markedForRemoval=!1,this._previewSource="external",this._clearSelectedFileState(),this._clearNativeInputValue(),this._syncFormValue()}clearExistingFileState(){this.existingValue="",this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._markedForRemoval=!1,this._selectedPreviewItems.length||(this._previewSource="external"),this._syncFormValue()}_dispatch(e,t={},r=!1){const i=new CustomEvent(e,{detail:t,bubbles:!0,composed:!0,cancelable:r});return this.dispatchEvent(i),i}_handleFiles(e){const t=Array.from(e??[]).filter(l=>this._isAcceptedFile(l));if(!t.length)return;const r=this.multiple?t:[t[0]];this._setSelectedFilesState(r,this.multiple);const i=this._selectedPreviewItems.map(l=>l.file);this._dispatch("file-selected",{file:i[0],files:i,addedFiles:r,existingValue:this.existingValue,markedForRemoval:this._markedForRemoval}),this._dispatch("change",{file:i[0],files:i,addedFiles:r,existingValue:this.existingValue,markedForRemoval:this._markedForRemoval})}_onZoneClick(e){this.disabled||e.composedPath().some(i=>i instanceof HTMLElement&&i.getAttribute("data-role")==="choose-button")||this.openPicker()}_onZoneKeydown(e){this.disabled||(e.key==="Enter"||e.key===" "||e.key==="Spacebar")&&(e.preventDefault(),this.openPicker())}_preventDefaultDrag(e){e.preventDefault(),e.stopPropagation()}_onDragEnter(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth+=1,this._isDragOver=!0)}_onDragOver(e){this.disabled||(this._preventDefaultDrag(e),this._isDragOver=!0)}_onDragLeave(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth=Math.max(0,this._dragDepth-1),this._dragDepth||(this._isDragOver=!1))}_onDrop(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth=0,this._isDragOver=!1,this._handleFiles(e.dataTransfer?.files??null))}_onNativeInputChange(e){const t=e.currentTarget;this._handleFiles(t?.files??null)}_onChooseButtonClick(e){e.preventDefault(),e.stopPropagation(),this.openPicker()}_onReplaceButtonClick(e){e.preventDefault(),e.stopPropagation(),this.openPicker()}_onRemoveButtonClick(e){if(e.preventDefault(),e.stopPropagation(),!this._dispatch("clear-request",{file:this._selectedPreviewItems[0]?.file??null,files:this._selectedPreviewItems.map(r=>r.file),existingValue:this.existingValue,markedForRemoval:this._markedForRemoval},!0).defaultPrevented){if(this._selectedPreviewItems.length){this._clearSelectedFileState(),this._clearNativeInputValue(),this._previewSource=this._hasExistingPreview?"external":"internal",this._dispatch("change",{file:null,files:[],existingValue:this.existingValue,markedForRemoval:this._markedForRemoval});return}if(this._hasExistingPreview){this._markedForRemoval=!0,this._previewSource="external",this._syncFormValue(),this.requestUpdate(),this._dispatch("change",{file:null,files:[],existingValue:this.existingValue,markedForRemoval:!0});return}this.clearPreviewState()}}_onRemoveSelectedItemClick(e){if(e.preventDefault(),e.stopPropagation(),this.disabled)return;const r=e.currentTarget?.getAttribute("data-index")||"",i=Number.parseInt(r,10);Number.isInteger(i)&&this._removeSelectedItemAt(i)}_isAcceptedFile(e){const t=this._resolvedAccept.trim();if(!t)return!0;const r=e.name.toLowerCase(),i=(e.type||"").toLowerCase(),l=t.split(",").map(n=>n.trim().toLowerCase()).filter(Boolean);return l.length?l.some(n=>n==="*/*"?!0:n.endsWith("/*")?i.startsWith(n.slice(0,-1)):n.startsWith(".")?r.endsWith(n):i===n):!0}_setSelectedFilesState(e,t){const r=e.filter(Boolean);if(!r.length)return;const i=t?this._selectedPreviewItems:[],l=r.map(d=>{const h=this._getPreviewKindForFile(d),v=this._getFileTypeLabel(d),m=this._formatFileSize(d.size),u=h==="image"?URL.createObjectURL(d):"";return{file:d,kind:h,src:u,alt:h==="image"?d.name||"Uppladdad bild":"",title:d.name||(h==="image"?"Uppladdad bild":"Uppladdad fil"),meta:[v,m].filter(Boolean).join(" • ")}});t||this._revokeObjectUrl();const n=this.multiple?[...i,...l]:[l[0]];!this.multiple&&i.length&&this._revokeObjectUrlsForItems(i),this._markedForRemoval=!1,this._applySelectedPreviewItems(n)}_clearSelectedFileState(){this._revokeObjectUrl(),this._applySelectedPreviewItems([])}_applySelectedPreviewItems(e){this._selectedPreviewItems=e;const t=e[0];if(!t){this._selectedPreviewKind="empty",this._selectedPreviewTitle="",this._selectedPreviewMeta="",this._selectedPreviewAlt="",this._selectedPreviewSrc="",this._previewSource="internal",this._syncFormValue();return}if(e.length>1){const r=e.reduce((i,l)=>i+(Number.isFinite(l.file.size)?l.file.size:0),0);this._selectedPreviewKind="multi",this._selectedPreviewTitle=`${e.length} filer valda`,this._selectedPreviewMeta=`Totalt ${this._formatFileSize(r)}`,this._selectedPreviewAlt="",this._selectedPreviewSrc=""}else this._selectedPreviewKind=t.kind,this._selectedPreviewTitle=t.title,this._selectedPreviewMeta=t.meta,this._selectedPreviewAlt=t.alt,this._selectedPreviewSrc=t.src;this._previewSource="internal",this._syncFormValue()}_removeSelectedItemAt(e){if(e<0||e>=this._selectedPreviewItems.length)return;const t=this._selectedPreviewItems[e];t.src&&URL.revokeObjectURL(t.src);const r=this._selectedPreviewItems.filter((i,l)=>l!==e);this._applySelectedPreviewItems(r),this._dispatch("file-removed",{file:t.file,files:r.map(i=>i.file),index:e,existingValue:this.existingValue,markedForRemoval:this._markedForRemoval}),this._dispatch("change",{file:r[0]?.file??null,files:r.map(i=>i.file),removedFile:t.file,removedIndex:e,existingValue:this.existingValue,markedForRemoval:this._markedForRemoval})}_renderSelectedImageCards(){return!this.multiple||this.type!=="image"||!this._selectedPreviewItems.some(t=>t.kind==="image"&&t.src)?null:p`
1
+ import{a as _,n as o,r as c,i as g,x as p,t as b}from"../../vendor/vendor.js";import"../scb-button/scb-button.js";import"../../vendor/vendor-material.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(r,i,l){try{customElements.get(r)||t(r,i,l)}catch(d){var n=String(d||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var f=Object.defineProperty,w=Object.getOwnPropertyDescriptor,a=(e,t,r,i)=>{for(var l=i>1?void 0:i?w(t,r):t,n=e.length-1,d;n>=0;n--)(d=e[n])&&(l=(i?d(t,r,l):d(l))||l);return i&&l&&f(t,r,l),l};let s=class extends g{constructor(){super(),this._internals=null,this.type="default",this.name="",this.multiple=!1,this.label="",this.supportingText="",this.metaText="",this.buttonLabel="",this.replaceButtonLabel="",this.removeButtonLabel="",this.previewEyebrow="",this.emptyPreviewTitle="",this.emptyPreviewMeta="",this.accept="",this.hidePreview=!1,this.showExistingPreview=!1,this.disabled=!1,this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this.existingValue="",this.existingValueName="",this.removeValueName="",this._isDragOver=!1,this._selectedPreviewKind="empty",this._selectedPreviewSrc="",this._selectedPreviewAlt="",this._selectedPreviewTitle="",this._selectedPreviewMeta="",this._selectedPreviewItems=[],this._markedForRemoval=!1,this._dragDepth=0,this._previewSource="external","attachInternals"in this&&(this._internals=this.attachInternals())}get _resolvedAccept(){return this.accept.trim()||(this.type==="image"?"image/*,.png,.jpg,.jpeg,.webp,.svg,.gif,.bmp,.avif":"")}get _hasExistingPreview(){return this.multiple||this._markedForRemoval||!this.showExistingPreview?!1:!!this.existingValue.trim()||!!this.previewSrc.trim()||!!this.previewTitle.trim()||!!this.previewMeta.trim()}get _resolvedPreviewKind(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewSrc.trim()?"image":"file":this._selectedPreviewKind}get _hasPreview(){return this._resolvedPreviewKind!=="empty"}get _resolvedLabel(){return this.label||(this.type==="image"?"Ladda upp bild":"Ladda upp fil")}get _resolvedSupportingText(){return this.multiple?this.supportingText||(this.type==="image"?"Dra och släpp en eller flera bilder här, eller välj bilder från din dator.":"Dra och släpp en eller flera filer här, eller välj filer från din dator."):this.supportingText||(this.type==="image"?"Dra och släpp en bild här, eller välj en bild från din dator.":"Dra och släpp en fil här, eller välj en fil från din dator.")}get _resolvedMetaText(){return this.metaText?this.metaText:this.type==="image"?"PNG, JPG, SVG, GIF, BMP, AVIF och WebP stöds.":"Alla filtyper stöds."}get _resolvedButtonLabel(){return this.buttonLabel||(this.type==="image"?"Välj bild":"Välj fil")}get _resolvedReplaceButtonLabel(){return this.replaceButtonLabel?this.replaceButtonLabel:this.multiple||this._resolvedPreviewKind==="multi"?"Lägg till fler filer":this._previewSource==="external"&&this._hasExistingPreview?this._resolvedPreviewKind==="image"?"Ersätt bild":"Ersätt fil":this._resolvedPreviewKind==="image"?"Byt bild":"Byt fil"}get _resolvedRemoveButtonLabel(){return this.removeButtonLabel?this.removeButtonLabel:this._resolvedPreviewKind==="multi"?"Ta bort filer":this._previewSource==="external"&&this._hasExistingPreview?this._resolvedPreviewKind==="image"?"Ta bort befintlig bild":"Ta bort befintlig fil":this._resolvedPreviewKind==="image"?"Ta bort bild":"Ta bort fil"}get _resolvedPreviewEyebrow(){return this.previewEyebrow?this.previewEyebrow:this._hasPreview?this._resolvedPreviewKind==="multi"?"Uppladdade filer":this._previewSource==="external"&&this._hasExistingPreview?this._resolvedPreviewKind==="image"?"Befintlig bild":"Befintlig fil":this._resolvedPreviewKind==="image"?"Uppladdad bild":"Uppladdad fil":"Förhandsvisning"}get _resolvedEmptyPreviewTitle(){return this.emptyPreviewTitle?this.emptyPreviewTitle:this.multiple?this.type==="image"?"Inga bilder uppladdade":"Inga filer uppladdade":this.type==="image"?"Ingen bild uppladdad":"Ingen fil uppladdad"}get _resolvedEmptyPreviewMeta(){return this.emptyPreviewMeta?this.emptyPreviewMeta:this.multiple?this.type==="image"?"Förhandsvisningen visas här när du har laddat upp bilder.":"Förhandsvisningen visas här när du har laddat upp filer.":this.type==="image"?"Förhandsvisningen visas här när du har laddat upp en bild.":"Förhandsvisningen visas här när du har laddat upp en fil."}get _resolvedPreviewSrc(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewSrc.trim():this._selectedPreviewSrc}get _resolvedPreviewAlt(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewAlt:this._selectedPreviewAlt}get _resolvedPreviewTitle(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewTitle||(this._resolvedPreviewKind==="image"?"Befintlig bild":"Befintlig fil"):this._selectedPreviewTitle}get _resolvedPreviewMeta(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewMeta:this._selectedPreviewMeta}disconnectedCallback(){this._revokeObjectUrl(),super.disconnectedCallback()}updated(e){e.has("type")&&this.type==="image"&&this._selectedPreviewKind==="file"&&this._clearSelectedFileState(),(e.has("disabled")||e.has("name")||e.has("multiple")||e.has("existingValueName")||e.has("removeValueName")||e.has("existingValue"))&&this._syncFormValue()}formDisabledCallback(e){this.disabled=e}formResetCallback(){this._clearSelectedFileState(),this._markedForRemoval=!1,this._previewSource="external",this._clearNativeInputValue(),this._syncFormValue()}_syncFormValue(){if(!this._internals)return;const e=this.name.trim(),t=this.existingValueName.trim(),r=this.removeValueName.trim(),i=new FormData;if(!this.disabled&&e&&this._selectedPreviewItems.length&&this._selectedPreviewItems.forEach(l=>{i.append(e,l.file,l.file.name)}),!this.disabled&&!this.multiple&&t&&this.existingValue.trim()&&i.append(t,this.existingValue),!this.disabled&&!this.multiple&&r&&i.append(r,this._markedForRemoval?"true":"false"),[...i.keys()].length===0){this._internals.setFormValue(null);return}this._internals.setFormValue(i)}openPicker(){if(this.disabled)return;const e=this.renderRoot.querySelector('[data-role="native-input"]');if(e){try{e.value=""}catch{}e.click()}}setPreviewState(e){this.previewSrc=e?.src??"",this.previewAlt=e?.alt??"",this.previewTitle=e?.title??"",this.previewMeta=e?.meta??"",this._markedForRemoval=!1,this._previewSource=this._selectedPreviewItems.length?"internal":"external",this._syncFormValue()}setExistingFileState(e){if(this.multiple){this.existingValue="",this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._markedForRemoval=!1,this._syncFormValue();return}this.existingValue=e?.value??"",this.previewSrc=e?.src??"",this.previewAlt=e?.alt??"",this.previewTitle=e?.title??"",this.previewMeta=e?.meta??"",this._markedForRemoval=!1,this._previewSource=this._selectedPreviewItems.length?"internal":"external",this._syncFormValue()}clearPreviewState(){this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._markedForRemoval=!1,this._previewSource="external",this._clearSelectedFileState(),this._clearNativeInputValue(),this._syncFormValue()}clearExistingFileState(){this.existingValue="",this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._markedForRemoval=!1,this._selectedPreviewItems.length||(this._previewSource="external"),this._syncFormValue()}_dispatch(e,t={},r=!1){const i=new CustomEvent(e,{detail:t,bubbles:!0,composed:!0,cancelable:r});return this.dispatchEvent(i),i}_handleFiles(e){const t=Array.from(e??[]).filter(l=>this._isAcceptedFile(l));if(!t.length)return;const r=this.multiple?t:[t[0]];this._setSelectedFilesState(r,this.multiple);const i=this._selectedPreviewItems.map(l=>l.file);this._dispatch("file-selected",{file:i[0],files:i,addedFiles:r,existingValue:this.existingValue,markedForRemoval:this._markedForRemoval}),this._dispatch("change",{file:i[0],files:i,addedFiles:r,existingValue:this.existingValue,markedForRemoval:this._markedForRemoval})}_onZoneClick(e){this.disabled||e.composedPath().some(i=>i instanceof HTMLElement&&i.getAttribute("data-role")==="choose-button")||this.openPicker()}_onZoneKeydown(e){this.disabled||(e.key==="Enter"||e.key===" "||e.key==="Spacebar")&&(e.preventDefault(),this.openPicker())}_preventDefaultDrag(e){e.preventDefault(),e.stopPropagation()}_onDragEnter(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth+=1,this._isDragOver=!0)}_onDragOver(e){this.disabled||(this._preventDefaultDrag(e),this._isDragOver=!0)}_onDragLeave(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth=Math.max(0,this._dragDepth-1),this._dragDepth||(this._isDragOver=!1))}_onDrop(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth=0,this._isDragOver=!1,this._handleFiles(e.dataTransfer?.files??null))}_onNativeInputChange(e){const t=e.currentTarget;this._handleFiles(t?.files??null)}_onChooseButtonClick(e){e.preventDefault(),e.stopPropagation(),this.openPicker()}_onReplaceButtonClick(e){e.preventDefault(),e.stopPropagation(),this.openPicker()}_onRemoveButtonClick(e){if(e.preventDefault(),e.stopPropagation(),!this._dispatch("clear-request",{file:this._selectedPreviewItems[0]?.file??null,files:this._selectedPreviewItems.map(r=>r.file),existingValue:this.existingValue,markedForRemoval:this._markedForRemoval},!0).defaultPrevented){if(this._selectedPreviewItems.length){this._clearSelectedFileState(),this._clearNativeInputValue(),this._previewSource=this._hasExistingPreview?"external":"internal",this._dispatch("change",{file:null,files:[],existingValue:this.existingValue,markedForRemoval:this._markedForRemoval});return}if(this._hasExistingPreview){this._markedForRemoval=!0,this._previewSource="external",this._syncFormValue(),this.requestUpdate(),this._dispatch("change",{file:null,files:[],existingValue:this.existingValue,markedForRemoval:!0});return}this.clearPreviewState()}}_onRemoveSelectedItemClick(e){if(e.preventDefault(),e.stopPropagation(),this.disabled)return;const r=e.currentTarget?.getAttribute("data-index")||"",i=Number.parseInt(r,10);Number.isInteger(i)&&this._removeSelectedItemAt(i)}_isAcceptedFile(e){const t=this._resolvedAccept.trim();if(!t)return!0;const r=e.name.toLowerCase(),i=(e.type||"").toLowerCase(),l=t.split(",").map(n=>n.trim().toLowerCase()).filter(Boolean);return l.length?l.some(n=>n==="*/*"?!0:n.endsWith("/*")?i.startsWith(n.slice(0,-1)):n.startsWith(".")?r.endsWith(n):i===n):!0}_setSelectedFilesState(e,t){const r=e.filter(Boolean);if(!r.length)return;const i=t?this._selectedPreviewItems:[],l=r.map(d=>{const h=this._getPreviewKindForFile(d),v=this._getFileTypeLabel(d),m=this._formatFileSize(d.size),u=h==="image"?URL.createObjectURL(d):"";return{file:d,kind:h,src:u,alt:h==="image"?d.name||"Uppladdad bild":"",title:d.name||(h==="image"?"Uppladdad bild":"Uppladdad fil"),meta:[v,m].filter(Boolean).join(" • ")}});t||this._revokeObjectUrl();const n=this.multiple?[...i,...l]:[l[0]];!this.multiple&&i.length&&this._revokeObjectUrlsForItems(i),this._markedForRemoval=!1,this._applySelectedPreviewItems(n)}_clearSelectedFileState(){this._revokeObjectUrl(),this._applySelectedPreviewItems([])}_applySelectedPreviewItems(e){this._selectedPreviewItems=e;const t=e[0];if(!t){this._selectedPreviewKind="empty",this._selectedPreviewTitle="",this._selectedPreviewMeta="",this._selectedPreviewAlt="",this._selectedPreviewSrc="",this._previewSource="internal",this._syncFormValue();return}if(e.length>1){const r=e.reduce((i,l)=>i+(Number.isFinite(l.file.size)?l.file.size:0),0);this._selectedPreviewKind="multi",this._selectedPreviewTitle=`${e.length} filer valda`,this._selectedPreviewMeta=`Totalt ${this._formatFileSize(r)}`,this._selectedPreviewAlt="",this._selectedPreviewSrc=""}else this._selectedPreviewKind=t.kind,this._selectedPreviewTitle=t.title,this._selectedPreviewMeta=t.meta,this._selectedPreviewAlt=t.alt,this._selectedPreviewSrc=t.src;this._previewSource="internal",this._syncFormValue()}_removeSelectedItemAt(e){if(e<0||e>=this._selectedPreviewItems.length)return;const t=this._selectedPreviewItems[e];t.src&&URL.revokeObjectURL(t.src);const r=this._selectedPreviewItems.filter((i,l)=>l!==e);this._applySelectedPreviewItems(r),this._dispatch("file-removed",{file:t.file,files:r.map(i=>i.file),index:e,existingValue:this.existingValue,markedForRemoval:this._markedForRemoval}),this._dispatch("change",{file:r[0]?.file??null,files:r.map(i=>i.file),removedFile:t.file,removedIndex:e,existingValue:this.existingValue,markedForRemoval:this._markedForRemoval})}_renderSelectedImageCards(){return!this.multiple||this.type!=="image"||this.hidePreview||!this._selectedPreviewItems.some(t=>t.kind==="image"&&t.src)?null:p`
2
2
  <div class="scb-drop-zone__selected-images" aria-label="Valda bilder">
3
3
  ${this._selectedPreviewItems.map((t,r)=>t.kind!=="image"||!t.src?null:p`
4
4
  <article class="scb-drop-zone__selected-image-card" aria-label=${`${t.title}, ${t.meta}`}>
@@ -63,7 +63,7 @@ import{a as _,n as o,r as c,i as g,x as p,t as b}from"../../vendor/vendor.js";im
63
63
  <span class="scb-drop-zone__preview-placeholder-label">${this.type==="image"?"Bild":"Fil"}</span>
64
64
  </div>
65
65
  </div>
66
- `}_renderPreview(){if(!this.showPreview||this.multiple&&this.type==="image")return null;const e=this._hasPreview?this._resolvedPreviewTitle:this._resolvedEmptyPreviewTitle,t=this._hasPreview?this._resolvedPreviewMeta:this._resolvedEmptyPreviewMeta;return p`
66
+ `}_renderPreview(){if(this.hidePreview||this.multiple&&this.type==="image")return null;const e=this._hasPreview?this._resolvedPreviewTitle:this._resolvedEmptyPreviewTitle,t=this._hasPreview?this._resolvedPreviewMeta:this._resolvedEmptyPreviewMeta;return p`
67
67
  <div class="scb-drop-zone__preview">
68
68
  <div class="scb-drop-zone__preview-media">
69
69
  ${this._renderPreviewMedia()}
@@ -96,7 +96,7 @@ import{a as _,n as o,r as c,i as g,x as p,t as b}from"../../vendor/vendor.js";im
96
96
  </div>
97
97
  `}render(){const e={"scb-drop-zone__surface":!0,"is-dragover":this._isDragOver};return p`
98
98
  <div class="scb-drop-zone">
99
- <div class="scb-drop-zone__layout ${this.showPreview?"scb-drop-zone__layout--with-preview":""}">
99
+ <div class="scb-drop-zone__layout ${this.hidePreview?"":"scb-drop-zone__layout--with-preview"}">
100
100
  <div class="scb-drop-zone__main">
101
101
  <div
102
102
  class=${Object.keys(e).filter(t=>e[t]).join(" ")}
@@ -552,4 +552,4 @@ import{a as _,n as o,r as c,i as g,x as p,t as b}from"../../vendor/vendor.js";im
552
552
  grid-template-columns: 1fr;
553
553
  }
554
554
  }
555
- `;a([o({type:String,reflect:!0})],s.prototype,"type",2);a([o({type:String})],s.prototype,"name",2);a([o({type:Boolean,reflect:!0})],s.prototype,"multiple",2);a([o({type:String})],s.prototype,"label",2);a([o({type:String,attribute:"supporting-text"})],s.prototype,"supportingText",2);a([o({type:String,attribute:"meta-text"})],s.prototype,"metaText",2);a([o({type:String,attribute:"button-label"})],s.prototype,"buttonLabel",2);a([o({type:String,attribute:"replace-button-label"})],s.prototype,"replaceButtonLabel",2);a([o({type:String,attribute:"remove-button-label"})],s.prototype,"removeButtonLabel",2);a([o({type:String,attribute:"preview-eyebrow"})],s.prototype,"previewEyebrow",2);a([o({type:String,attribute:"empty-preview-title"})],s.prototype,"emptyPreviewTitle",2);a([o({type:String,attribute:"empty-preview-meta"})],s.prototype,"emptyPreviewMeta",2);a([o({type:String})],s.prototype,"accept",2);a([o({type:Boolean,attribute:"show-preview",reflect:!0})],s.prototype,"showPreview",2);a([o({type:Boolean,attribute:"show-existing-preview",reflect:!0})],s.prototype,"showExistingPreview",2);a([o({type:Boolean,reflect:!0})],s.prototype,"disabled",2);a([o({type:String,attribute:!1})],s.prototype,"previewSrc",2);a([o({type:String,attribute:!1})],s.prototype,"previewAlt",2);a([o({type:String,attribute:!1})],s.prototype,"previewTitle",2);a([o({type:String,attribute:!1})],s.prototype,"previewMeta",2);a([o({type:String,attribute:"existing-value"})],s.prototype,"existingValue",2);a([o({type:String,attribute:"existing-value-name"})],s.prototype,"existingValueName",2);a([o({type:String,attribute:"remove-value-name"})],s.prototype,"removeValueName",2);a([c()],s.prototype,"_isDragOver",2);a([c()],s.prototype,"_selectedPreviewKind",2);a([c()],s.prototype,"_selectedPreviewSrc",2);a([c()],s.prototype,"_selectedPreviewAlt",2);a([c()],s.prototype,"_selectedPreviewTitle",2);a([c()],s.prototype,"_selectedPreviewMeta",2);a([c()],s.prototype,"_selectedPreviewItems",2);a([c()],s.prototype,"_markedForRemoval",2);s=a([b("scb-drop-zone")],s);
555
+ `;a([o({type:String,reflect:!0})],s.prototype,"type",2);a([o({type:String})],s.prototype,"name",2);a([o({type:Boolean,reflect:!0})],s.prototype,"multiple",2);a([o({type:String})],s.prototype,"label",2);a([o({type:String,attribute:"supporting-text"})],s.prototype,"supportingText",2);a([o({type:String,attribute:"meta-text"})],s.prototype,"metaText",2);a([o({type:String,attribute:"button-label"})],s.prototype,"buttonLabel",2);a([o({type:String,attribute:"replace-button-label"})],s.prototype,"replaceButtonLabel",2);a([o({type:String,attribute:"remove-button-label"})],s.prototype,"removeButtonLabel",2);a([o({type:String,attribute:"preview-eyebrow"})],s.prototype,"previewEyebrow",2);a([o({type:String,attribute:"empty-preview-title"})],s.prototype,"emptyPreviewTitle",2);a([o({type:String,attribute:"empty-preview-meta"})],s.prototype,"emptyPreviewMeta",2);a([o({type:String})],s.prototype,"accept",2);a([o({type:Boolean,attribute:"hide-preview",reflect:!0})],s.prototype,"hidePreview",2);a([o({type:Boolean,attribute:"show-existing-preview",reflect:!0})],s.prototype,"showExistingPreview",2);a([o({type:Boolean,reflect:!0})],s.prototype,"disabled",2);a([o({type:String,attribute:!1})],s.prototype,"previewSrc",2);a([o({type:String,attribute:!1})],s.prototype,"previewAlt",2);a([o({type:String,attribute:!1})],s.prototype,"previewTitle",2);a([o({type:String,attribute:!1})],s.prototype,"previewMeta",2);a([o({type:String,attribute:"existing-value"})],s.prototype,"existingValue",2);a([o({type:String,attribute:"existing-value-name"})],s.prototype,"existingValueName",2);a([o({type:String,attribute:"remove-value-name"})],s.prototype,"removeValueName",2);a([c()],s.prototype,"_isDragOver",2);a([c()],s.prototype,"_selectedPreviewKind",2);a([c()],s.prototype,"_selectedPreviewSrc",2);a([c()],s.prototype,"_selectedPreviewAlt",2);a([c()],s.prototype,"_selectedPreviewTitle",2);a([c()],s.prototype,"_selectedPreviewMeta",2);a([c()],s.prototype,"_selectedPreviewItems",2);a([c()],s.prototype,"_markedForRemoval",2);s=a([b("scb-drop-zone")],s);
@@ -1,4 +1,4 @@
1
- import{a as m,n as p,i as v,x as r,t as y}from"../../vendor/vendor.js";import"../scb-link/scb-link.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import"../../vendor/vendor-material.js";import"../../vendor/preload-helper.js";(function(){try{var i=typeof globalThis<"u"?globalThis:window;if(!i.__scb_ce_guard_installed__){i.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(n,a,s){try{customElements.get(n)||t(n,a,s)}catch(d){var c=String(d||"");if(c.indexOf("already been used")===-1&&c.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var x=Object.defineProperty,_=Object.getOwnPropertyDescriptor,l=(i,t,n,a)=>{for(var s=a>1?void 0:a?_(t,n):t,c=i.length-1,d;c>=0;c--)(d=i[c])&&(s=(a?d(t,n,s):d(s))||s);return a&&s&&x(t,n,s),s};let o=class extends v{constructor(){super(...arguments),this.variant="icon-text",this.page=1,this.totalPages=0,this.pagingHref="",this.paginationAriaLabel="Paginering",this.currentAriaLabel="Nuvarande sida, ",this.pagingNumberAriaLabel="Gå till sida ",this.isNarrow=window.innerWidth<=768,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._onResize=()=>{this.isNarrow=window.innerWidth<=768}}_emitPageChange(i){const t={page:i};this.dispatchEvent(new CustomEvent("page-change",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("pagechange",{detail:t,bubbles:!0,composed:!0}))}_getPagingHref(i){if(this.pagingHref)return`${this.pagingHref}${i}`}_handlePageSelection(i,t){!this.pagingHref&&t&&t.preventDefault(),this.page=i,this._emitPageChange(i)}_prevPage(i){if(this.page<=1){!this.pagingHref&&i&&i.preventDefault();return}this._handlePageSelection(this.page-1,i)}_nextPage(i){if(this.page>=this.totalPages){!this.pagingHref&&i&&i.preventDefault();return}this._handlePageSelection(this.page+1,i)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._onResize),this._onResize()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._onResize)}mapSpacingToken(i){if(i==null)return;const t=String(i).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}__applySpacing(){const i=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??i,n=this.mapSpacingToken(this.spacingBottom)??i,a=this.mapSpacingToken(this.spacingLeft),s=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-pagination-spacing-block-start",t):this.style.removeProperty("--scb-pagination-spacing-block-start"),n?this.style.setProperty("--scb-pagination-spacing-block-end",n):this.style.removeProperty("--scb-pagination-spacing-block-end"),a?this.style.setProperty("--scb-pagination-spacing-inline-start",a):this.style.removeProperty("--scb-pagination-spacing-inline-start"),s?this.style.setProperty("--scb-pagination-spacing-inline-end",s):this.style.removeProperty("--scb-pagination-spacing-inline-end")}firstUpdated(){this.__applySpacing()}updated(i){super.updated(i),(i.has("spacing")||i.has("spacingTop")||i.has("spacingBottom")||i.has("spacingLeft")||i.has("spacingRight"))&&this.__applySpacing()}render(){if(this.totalPages===0)return null;const i=this.variant?`${this.variant.toLowerCase()}`:"",t=[],{page:n,totalPages:a}=this,s=window.innerWidth<=768,c=s?1:2,d=this._getPagingHref(Math.max(1,this.page-1)),h=this._getPagingHref(Math.min(this.totalPages,this.page+1)),b=this.pagingHref?this.variant==="icon"?r`<a
1
+ import{a as m,n as c,i as v,x as r,t as y}from"../../vendor/vendor.js";import"../scb-link/scb-link.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import"../../vendor/vendor-material.js";import"../../vendor/preload-helper.js";(function(){try{var i=typeof globalThis<"u"?globalThis:window;if(!i.__scb_ce_guard_installed__){i.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(n,a,s){try{customElements.get(n)||t(n,a,s)}catch(d){var p=String(d||"");if(p.indexOf("already been used")===-1&&p.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var x=Object.defineProperty,w=Object.getOwnPropertyDescriptor,l=(i,t,n,a)=>{for(var s=a>1?void 0:a?w(t,n):t,p=i.length-1,d;p>=0;p--)(d=i[p])&&(s=(a?d(t,n,s):d(s))||s);return a&&s&&x(t,n,s),s};let o=class extends v{constructor(){super(...arguments),this.variant="icon-text",this.page=1,this.totalPages=0,this.pagingHref="",this.baseUri="",this.paginationAriaLabel="Paginering",this.currentAriaLabel="Nuvarande sida, ",this.pagingNumberAriaLabel="Gå till sida ",this.isNarrow=window.innerWidth<=768,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._onResize=()=>{this.isNarrow=window.innerWidth<=768}}_emitPageChange(i){const t={page:i};this.dispatchEvent(new CustomEvent("page-change",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("pagechange",{detail:t,bubbles:!0,composed:!0}))}_getPagingHref(i){if(!this.pagingHref)return;const t=(this.baseUri||"").trim().replace(/^\?/,"").replace(/&+$/,""),n=window.location.search.replace(/^\?/,"").replace(/&+$/,""),a=t||n;return a?`${a}&${this.pagingHref}${i}`:`${this.pagingHref}${i}`}_handlePageSelection(i,t){!this.pagingHref&&t&&t.preventDefault(),this.page=i,this._emitPageChange(i)}_prevPage(i){if(this.page<=1){!this.pagingHref&&i&&i.preventDefault();return}this._handlePageSelection(this.page-1,i)}_nextPage(i){if(this.page>=this.totalPages){!this.pagingHref&&i&&i.preventDefault();return}this._handlePageSelection(this.page+1,i)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._onResize),this._onResize()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._onResize)}mapSpacingToken(i){if(i==null)return;const t=String(i).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}__applySpacing(){const i=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??i,n=this.mapSpacingToken(this.spacingBottom)??i,a=this.mapSpacingToken(this.spacingLeft),s=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-pagination-spacing-block-start",t):this.style.removeProperty("--scb-pagination-spacing-block-start"),n?this.style.setProperty("--scb-pagination-spacing-block-end",n):this.style.removeProperty("--scb-pagination-spacing-block-end"),a?this.style.setProperty("--scb-pagination-spacing-inline-start",a):this.style.removeProperty("--scb-pagination-spacing-inline-start"),s?this.style.setProperty("--scb-pagination-spacing-inline-end",s):this.style.removeProperty("--scb-pagination-spacing-inline-end")}firstUpdated(){this.__applySpacing()}updated(i){super.updated(i),(i.has("spacing")||i.has("spacingTop")||i.has("spacingBottom")||i.has("spacingLeft")||i.has("spacingRight"))&&this.__applySpacing()}render(){if(this.totalPages===0)return null;const i=this.variant?`${this.variant.toLowerCase()}`:"",t=[],{page:n,totalPages:a}=this,s=window.innerWidth<=768,p=s?1:2,d=this._getPagingHref(Math.max(1,this.page-1)),h=this._getPagingHref(Math.min(this.totalPages,this.page+1)),b=this.pagingHref?this.variant==="icon"?r`<a
2
2
  class="paging-action-link"
3
3
  href=${d}
4
4
  @click=${this._prevPage}
@@ -99,7 +99,7 @@ import{a as m,n as p,i as v,x as r,t as y}from"../../vendor/vendor.js";import"..
99
99
  >${e}</scb-link
100
100
  >
101
101
  </li>
102
- `;if(a<=8)for(let e=1;e<=a;e++)t.push(g(e));else if(t.push(g(1)),n<=4&&!s){for(let e=2;e<=5;e++)t.push(g(e));a>6?(t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),t.push(g(a))):a===6&&t.push(g(a))}else if(n<=3&&s){for(let e=2;e<=3;e++)t.push(g(e));a>4?(t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),t.push(g(a))):a===4&&t.push(g(a))}else if(n>=a-(c+1)){t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`);for(let e=a-c*2;e<=a;e++)e>1&&t.push(g(e))}else{t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`);for(let e=n-c;e<=n+c;e++)e>1&&e<a&&t.push(g(e));t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),t.push(g(a))}return s?r`
102
+ `;if(a<=8)for(let e=1;e<=a;e++)t.push(g(e));else if(t.push(g(1)),n<=4&&!s){for(let e=2;e<=5;e++)t.push(g(e));a>6?(t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),t.push(g(a))):a===6&&t.push(g(a))}else if(n<=3&&s){for(let e=2;e<=3;e++)t.push(g(e));a>4?(t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),t.push(g(a))):a===4&&t.push(g(a))}else if(n>=a-(p+1)){t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`);for(let e=a-p*2;e<=a;e++)e>1&&t.push(g(e))}else{t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`);for(let e=n-p;e<=n+p;e++)e>1&&e<a&&t.push(g(e));t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),t.push(g(a))}return s?r`
103
103
  <nav aria-label="${this.paginationAriaLabel}" class="pagination ${i}">
104
104
  <div class="pagination-row">
105
105
  <div class="prev">
@@ -309,4 +309,4 @@ import{a as m,n as p,i as v,x as r,t as y}from"../../vendor/vendor.js";import"..
309
309
  margin-top: 8px;
310
310
  }
311
311
  }
312
- `];l([p({type:String})],o.prototype,"variant",2);l([p({type:Number})],o.prototype,"page",2);l([p({type:Number,attribute:"total-pages"})],o.prototype,"totalPages",2);l([p({type:String,attribute:"paging-href"})],o.prototype,"pagingHref",2);l([p({type:String,attribute:"pagination-aria-label"})],o.prototype,"paginationAriaLabel",2);l([p({type:String,attribute:"current-aria-label"})],o.prototype,"currentAriaLabel",2);l([p({type:String,attribute:"paging-number-aria-label"})],o.prototype,"pagingNumberAriaLabel",2);l([p({type:Boolean})],o.prototype,"isNarrow",2);l([p({type:String})],o.prototype,"spacing",2);l([p({type:String,attribute:"spacing-top"})],o.prototype,"spacingTop",2);l([p({type:String,attribute:"spacing-bottom"})],o.prototype,"spacingBottom",2);l([p({type:String,attribute:"spacing-left"})],o.prototype,"spacingLeft",2);l([p({type:String,attribute:"spacing-right"})],o.prototype,"spacingRight",2);o=l([y("scb-pagination")],o);
312
+ `];l([c({type:String})],o.prototype,"variant",2);l([c({type:Number})],o.prototype,"page",2);l([c({type:Number,attribute:"total-pages"})],o.prototype,"totalPages",2);l([c({type:String,attribute:"paging-href"})],o.prototype,"pagingHref",2);l([c({type:String,attribute:"base-uri"})],o.prototype,"baseUri",2);l([c({type:String,attribute:"pagination-aria-label"})],o.prototype,"paginationAriaLabel",2);l([c({type:String,attribute:"current-aria-label"})],o.prototype,"currentAriaLabel",2);l([c({type:String,attribute:"paging-number-aria-label"})],o.prototype,"pagingNumberAriaLabel",2);l([c({type:Boolean})],o.prototype,"isNarrow",2);l([c({type:String})],o.prototype,"spacing",2);l([c({type:String,attribute:"spacing-top"})],o.prototype,"spacingTop",2);l([c({type:String,attribute:"spacing-bottom"})],o.prototype,"spacingBottom",2);l([c({type:String,attribute:"spacing-left"})],o.prototype,"spacingLeft",2);l([c({type:String,attribute:"spacing-right"})],o.prototype,"spacingRight",2);o=l([y("scb-pagination")],o);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scb-wc-test",
3
- "version": "0.1.312",
3
+ "version": "0.1.314",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -390,5 +390,5 @@
390
390
  },
391
391
  "./mvc/*": "./mvc/*"
392
392
  },
393
- "buildHash": "C4BF30B40B1B462DE0031F8C63B0E010271517006995DDC0524A75B5CFD21925"
393
+ "buildHash": "6553FBC913DB0C11C22CB36D2B2C7798DAE8B92536532143B116EE4AF8A96FC8"
394
394
  }
@@ -29,8 +29,8 @@ export declare class ScbDropZone extends LitElement {
29
29
  emptyPreviewMeta: string;
30
30
  /** Accept-värde för native file input. */
31
31
  accept: string;
32
- /** Visar förhandsvisningspanelen. */
33
- showPreview: boolean;
32
+ /** Döljer förhandsvisningspanelen. */
33
+ hidePreview: boolean;
34
34
  /** Visar befintlig fil i förhandsvisningen i enfilsläge. */
35
35
  showExistingPreview: boolean;
36
36
  /** Inaktiverar uppladdning. */
@@ -1,14 +1,14 @@
1
- import { css as _, LitElement as g, html as p } from "lit";
1
+ import { css as _, LitElement as g, html as d } from "lit";
2
2
  import { property as o, state as c, customElement as b } from "lit/decorators.js";
3
3
  import "../scb-button/scb-button.js";
4
4
  var f = Object.defineProperty, w = Object.getOwnPropertyDescriptor, a = (e, i, r, t) => {
5
- for (var l = t > 1 ? void 0 : t ? w(i, r) : i, n = e.length - 1, d; n >= 0; n--)
6
- (d = e[n]) && (l = (t ? d(i, r, l) : d(l)) || l);
5
+ for (var l = t > 1 ? void 0 : t ? w(i, r) : i, n = e.length - 1, p; n >= 0; n--)
6
+ (p = e[n]) && (l = (t ? p(i, r, l) : p(l)) || l);
7
7
  return t && l && f(i, r, l), l;
8
8
  };
9
9
  let s = class extends g {
10
10
  constructor() {
11
- super(), this._internals = null, this.type = "default", this.name = "", this.multiple = !1, this.label = "", this.supportingText = "", this.metaText = "", this.buttonLabel = "", this.replaceButtonLabel = "", this.removeButtonLabel = "", this.previewEyebrow = "", this.emptyPreviewTitle = "", this.emptyPreviewMeta = "", this.accept = "", this.showPreview = !0, this.showExistingPreview = !1, this.disabled = !1, this.previewSrc = "", this.previewAlt = "", this.previewTitle = "", this.previewMeta = "", this.existingValue = "", this.existingValueName = "", this.removeValueName = "", this._isDragOver = !1, this._selectedPreviewKind = "empty", this._selectedPreviewSrc = "", this._selectedPreviewAlt = "", this._selectedPreviewTitle = "", this._selectedPreviewMeta = "", this._selectedPreviewItems = [], this._markedForRemoval = !1, this._dragDepth = 0, this._previewSource = "external", "attachInternals" in this && (this._internals = this.attachInternals());
11
+ super(), this._internals = null, this.type = "default", this.name = "", this.multiple = !1, this.label = "", this.supportingText = "", this.metaText = "", this.buttonLabel = "", this.replaceButtonLabel = "", this.removeButtonLabel = "", this.previewEyebrow = "", this.emptyPreviewTitle = "", this.emptyPreviewMeta = "", this.accept = "", this.hidePreview = !1, this.showExistingPreview = !1, this.disabled = !1, this.previewSrc = "", this.previewAlt = "", this.previewTitle = "", this.previewMeta = "", this.existingValue = "", this.existingValueName = "", this.removeValueName = "", this._isDragOver = !1, this._selectedPreviewKind = "empty", this._selectedPreviewSrc = "", this._selectedPreviewAlt = "", this._selectedPreviewTitle = "", this._selectedPreviewMeta = "", this._selectedPreviewItems = [], this._markedForRemoval = !1, this._dragDepth = 0, this._previewSource = "external", "attachInternals" in this && (this._internals = this.attachInternals());
12
12
  }
13
13
  get _resolvedAccept() {
14
14
  return this.accept.trim() || (this.type === "image" ? "image/*,.png,.jpg,.jpeg,.webp,.svg,.gif,.bmp,.avif" : "");
@@ -206,14 +206,14 @@ let s = class extends g {
206
206
  const r = e.filter(Boolean);
207
207
  if (!r.length)
208
208
  return;
209
- const t = i ? this._selectedPreviewItems : [], l = r.map((d) => {
210
- const h = this._getPreviewKindForFile(d), v = this._getFileTypeLabel(d), m = this._formatFileSize(d.size), u = h === "image" ? URL.createObjectURL(d) : "";
209
+ const t = i ? this._selectedPreviewItems : [], l = r.map((p) => {
210
+ const h = this._getPreviewKindForFile(p), v = this._getFileTypeLabel(p), m = this._formatFileSize(p.size), u = h === "image" ? URL.createObjectURL(p) : "";
211
211
  return {
212
- file: d,
212
+ file: p,
213
213
  kind: h,
214
214
  src: u,
215
- alt: h === "image" ? d.name || "Uppladdad bild" : "",
216
- title: d.name || (h === "image" ? "Uppladdad bild" : "Uppladdad fil"),
215
+ alt: h === "image" ? p.name || "Uppladdad bild" : "",
216
+ title: p.name || (h === "image" ? "Uppladdad bild" : "Uppladdad fil"),
217
217
  meta: [v, m].filter(Boolean).join(" • ")
218
218
  };
219
219
  });
@@ -261,9 +261,9 @@ let s = class extends g {
261
261
  });
262
262
  }
263
263
  _renderSelectedImageCards() {
264
- return !this.multiple || this.type !== "image" || !this._selectedPreviewItems.some((i) => i.kind === "image" && i.src) ? null : p`
264
+ return !this.multiple || this.type !== "image" || this.hidePreview || !this._selectedPreviewItems.some((i) => i.kind === "image" && i.src) ? null : d`
265
265
  <div class="scb-drop-zone__selected-images" aria-label="Valda bilder">
266
- ${this._selectedPreviewItems.map((i, r) => i.kind !== "image" || !i.src ? null : p`
266
+ ${this._selectedPreviewItems.map((i, r) => i.kind !== "image" || !i.src ? null : d`
267
267
  <article class="scb-drop-zone__selected-image-card" aria-label=${`${i.title}, ${i.meta}`}>
268
268
  <img class="scb-drop-zone__selected-image" src=${i.src} alt=${i.alt || i.title} />
269
269
  <span class="scb-drop-zone__selected-image-title">${i.title}</span>
@@ -321,7 +321,7 @@ let s = class extends g {
321
321
  _renderPreviewMedia() {
322
322
  if (this._resolvedPreviewKind === "multi") {
323
323
  if (this.multiple && this.type === "image")
324
- return p`
324
+ return d`
325
325
  <div class="scb-drop-zone__preview-placeholder">
326
326
  <div class="scb-drop-zone__preview-placeholder-inner">
327
327
  <span class="scb-drop-zone__preview-placeholder-label">Bild</span>
@@ -330,11 +330,11 @@ let s = class extends g {
330
330
  </div>
331
331
  `;
332
332
  const e = this._selectedPreviewItems;
333
- return p`
333
+ return d`
334
334
  <ul class="scb-drop-zone__preview-list" aria-label="Valda filer">
335
- ${e.map((i, r) => p`
335
+ ${e.map((i, r) => d`
336
336
  <li class="scb-drop-zone__preview-list-item" aria-label=${`${i.title}, ${i.meta}`}>
337
- ${i.kind === "image" && i.src ? p`<img class="scb-drop-zone__preview-image scb-drop-zone__preview-image--thumb" src=${i.src} alt=${i.alt || i.title} />` : p`
337
+ ${i.kind === "image" && i.src ? d`<img class="scb-drop-zone__preview-image scb-drop-zone__preview-image--thumb" src=${i.src} alt=${i.alt || i.title} />` : d`
338
338
  <span class="scb-drop-zone__preview-list-extension" aria-hidden="true">
339
339
  ${this._getFileExtensionLabel(i.title)}
340
340
  </span>
@@ -358,14 +358,14 @@ let s = class extends g {
358
358
  </ul>
359
359
  `;
360
360
  }
361
- return this._resolvedPreviewKind === "image" && this._resolvedPreviewSrc ? p`<img class="scb-drop-zone__preview-image" src=${this._resolvedPreviewSrc} alt=${this._resolvedPreviewAlt} />` : this._hasPreview ? p`
361
+ return this._resolvedPreviewKind === "image" && this._resolvedPreviewSrc ? d`<img class="scb-drop-zone__preview-image" src=${this._resolvedPreviewSrc} alt=${this._resolvedPreviewAlt} />` : this._hasPreview ? d`
362
362
  <div class="scb-drop-zone__preview-file-card">
363
363
  <div class="scb-drop-zone__preview-file-card-inner">
364
364
  <span class="scb-drop-zone__preview-file-extension">${this._getFileExtensionLabel(this._resolvedPreviewTitle)}</span>
365
365
  <p class="scb-drop-zone__preview-file-label">${this._previewSource === "external" ? "Befintlig fil" : "Vald fil"}</p>
366
366
  </div>
367
367
  </div>
368
- ` : p`
368
+ ` : d`
369
369
  <div class="scb-drop-zone__preview-placeholder">
370
370
  <div class="scb-drop-zone__preview-placeholder-inner">
371
371
  <span class="scb-drop-zone__preview-placeholder-label">${this.type === "image" ? "Bild" : "Fil"}</span>
@@ -374,10 +374,10 @@ let s = class extends g {
374
374
  `;
375
375
  }
376
376
  _renderPreview() {
377
- if (!this.showPreview || this.multiple && this.type === "image")
377
+ if (this.hidePreview || this.multiple && this.type === "image")
378
378
  return null;
379
379
  const e = this._hasPreview ? this._resolvedPreviewTitle : this._resolvedEmptyPreviewTitle, i = this._hasPreview ? this._resolvedPreviewMeta : this._resolvedEmptyPreviewMeta;
380
- return p`
380
+ return d`
381
381
  <div class="scb-drop-zone__preview">
382
382
  <div class="scb-drop-zone__preview-media">
383
383
  ${this._renderPreviewMedia()}
@@ -388,7 +388,7 @@ let s = class extends g {
388
388
  <h3 class="scb-drop-zone__preview-title">${e}</h3>
389
389
  <p class="scb-drop-zone__preview-meta" aria-live="polite">${i}</p>
390
390
 
391
- ${this._hasPreview ? p`
391
+ ${this._hasPreview ? d`
392
392
  <div class="scb-drop-zone__preview-actions">
393
393
  <scb-button
394
394
  data-role="replace-button"
@@ -415,9 +415,9 @@ let s = class extends g {
415
415
  "scb-drop-zone__surface": !0,
416
416
  "is-dragover": this._isDragOver
417
417
  };
418
- return p`
418
+ return d`
419
419
  <div class="scb-drop-zone">
420
- <div class="scb-drop-zone__layout ${this.showPreview ? "scb-drop-zone__layout--with-preview" : ""}">
420
+ <div class="scb-drop-zone__layout ${this.hidePreview ? "" : "scb-drop-zone__layout--with-preview"}">
421
421
  <div class="scb-drop-zone__main">
422
422
  <div
423
423
  class=${Object.keys(e).filter((i) => e[i]).join(" ")}
@@ -445,7 +445,7 @@ let s = class extends g {
445
445
  <div class="scb-drop-zone__inner">
446
446
  <h2 class="scb-drop-zone__title">${this._resolvedLabel}</h2>
447
447
  <p class="scb-drop-zone__lead">${this._resolvedSupportingText}</p>
448
- ${this._resolvedMetaText ? p`<p class="scb-drop-zone__meta">${this._resolvedMetaText}</p>` : null}
448
+ ${this._resolvedMetaText ? d`<p class="scb-drop-zone__meta">${this._resolvedMetaText}</p>` : null}
449
449
 
450
450
  <div class="scb-drop-zone__actions">
451
451
  <scb-button
@@ -918,8 +918,8 @@ a([
918
918
  o({ type: String })
919
919
  ], s.prototype, "accept", 2);
920
920
  a([
921
- o({ type: Boolean, attribute: "show-preview", reflect: !0 })
922
- ], s.prototype, "showPreview", 2);
921
+ o({ type: Boolean, attribute: "hide-preview", reflect: !0 })
922
+ ], s.prototype, "hidePreview", 2);
923
923
  a([
924
924
  o({ type: Boolean, attribute: "show-existing-preview", reflect: !0 })
925
925
  ], s.prototype, "showExistingPreview", 2);
@@ -4,6 +4,7 @@ export declare class ScbPagination extends LitElement {
4
4
  page: number;
5
5
  totalPages: number;
6
6
  pagingHref: string;
7
+ baseUri: string;
7
8
  paginationAriaLabel: string;
8
9
  currentAriaLabel: string;
9
10
  pagingNumberAriaLabel: string;
@@ -12,7 +12,7 @@ var x = Object.defineProperty, w = Object.getOwnPropertyDescriptor, l = (i, t, n
12
12
  };
13
13
  let r = class extends v {
14
14
  constructor() {
15
- super(...arguments), this.variant = "icon-text", this.page = 1, this.totalPages = 0, this.pagingHref = "", this.paginationAriaLabel = "Paginering", this.currentAriaLabel = "Nuvarande sida, ", this.pagingNumberAriaLabel = "Gå till sida ", this.isNarrow = window.innerWidth <= 768, this.spacing = void 0, this.spacingTop = void 0, this.spacingBottom = void 0, this.spacingLeft = void 0, this.spacingRight = void 0, this._onResize = () => {
15
+ super(...arguments), this.variant = "icon-text", this.page = 1, this.totalPages = 0, this.pagingHref = "", this.baseUri = "", this.paginationAriaLabel = "Paginering", this.currentAriaLabel = "Nuvarande sida, ", this.pagingNumberAriaLabel = "Gå till sida ", this.isNarrow = window.innerWidth <= 768, this.spacing = void 0, this.spacingTop = void 0, this.spacingBottom = void 0, this.spacingLeft = void 0, this.spacingRight = void 0, this._onResize = () => {
16
16
  this.isNarrow = window.innerWidth <= 768;
17
17
  };
18
18
  }
@@ -25,8 +25,9 @@ let r = class extends v {
25
25
  );
26
26
  }
27
27
  _getPagingHref(i) {
28
- if (this.pagingHref)
29
- return `${this.pagingHref}${i}`;
28
+ if (!this.pagingHref) return;
29
+ const t = (this.baseUri || "").trim().replace(/^\?/, "").replace(/&+$/, ""), n = window.location.search.replace(/^\?/, "").replace(/&+$/, ""), a = t || n;
30
+ return a ? `${a}&${this.pagingHref}${i}` : `${this.pagingHref}${i}`;
30
31
  }
31
32
  _handlePageSelection(i, t) {
32
33
  !this.pagingHref && t && t.preventDefault(), this.page = i, this._emitPageChange(i);
@@ -428,6 +429,9 @@ l([
428
429
  l([
429
430
  p({ type: String, attribute: "paging-href" })
430
431
  ], r.prototype, "pagingHref", 2);
432
+ l([
433
+ p({ type: String, attribute: "base-uri" })
434
+ ], r.prototype, "baseUri", 2);
431
435
  l([
432
436
  p({ type: String, attribute: "pagination-aria-label" })
433
437
  ], r.prototype, "paginationAriaLabel", 2);