@fkui/vue 5.37.0 → 5.37.2

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"core-js/modules/es.array.push.js";import"core-js/modules/es.array-buffer.detached.js";import"core-js/modules/es.array-buffer.transfer.js";import"core-js/modules/es.array-buffer.transfer-to-fixed-length.js";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:true,configurable:true,writable:true,value}):obj[key]=value;var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!=="symbol"?key+"":key,value);import{defineComponent,openBlock,createElementBlock,normalizeClass,renderSlot,mergeProps,createTextVNode,createElementVNode,isVNode,Comment,createApp,resolveComponent,withKeys,createCommentVNode,toDisplayString,createVNode,createBlock,withCtx,Fragment,renderList,withModifiers,resolveDynamicComponent,Teleport,normalizeProps,guardReactiveProps,ref,inject,toValue,Transition,createSlots,withDirectives,vModelSelect,normalizeStyle,vModelDynamic,toHandlers,shallowRef,vShow,onMounted,onUnmounted,watchEffect,toRefs,computed,getCurrentInstance}from"vue";import{TranslationService,isSet,configLogic,focus as focus$1,ElementIdService,pushFocus,findTabbableElements,popFocus,scrollTo,Reference,documentOrderComparator,ValidationService,isValidatableHTMLElement,alertScreenReader,debounce,handleTab,deepClone,formatNumber,parseNumber,parseBankAccountNumber,parseBankgiro,parseClearingNumber,formatPersonnummer,parsePersonnummer,parsePlusgiro,formatPostalCode,parsePercent,formatPercent,parseOrganisationsnummer,isInvalidDatesConfig,isInvalidWeekdaysConfig,parseDate,waitForScreenReader,saveFocus,addFocusListener,removeFocusListener,restoreFocus,DomUtils,focusFirst}from"@fkui/logic";import{getWeekdayNamings,groupByWeek,FDate,DateFormat}from"@fkui/date";import{isEqual as isEqual$2}from"lodash";const statuses=["default","warning","error","success","info"];const _sfc_main$1d=defineComponent({name:"FBadge",props:{/**
1
+ import"core-js/modules/es.array.push.js";import"core-js/modules/es.array-buffer.detached.js";import"core-js/modules/es.array-buffer.transfer.js";import"core-js/modules/es.array-buffer.transfer-to-fixed-length.js";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:true,configurable:true,writable:true,value}):obj[key]=value;var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!=="symbol"?key+"":key,value);import{defineComponent,openBlock,createElementBlock,normalizeClass,renderSlot,mergeProps,createTextVNode,createElementVNode,isVNode,Comment,createApp,resolveComponent,withKeys,createCommentVNode,toDisplayString,createVNode,createBlock,withCtx,Fragment,renderList,withModifiers,resolveDynamicComponent,Teleport,normalizeProps,guardReactiveProps,ref,inject,useSlots,provide,toValue,Transition,createSlots,withDirectives,vModelSelect,normalizeStyle,vModelDynamic,toHandlers,shallowRef,vShow,onMounted,onUnmounted,watchEffect,toRefs,computed,getCurrentInstance}from"vue";import{TranslationService,isSet,configLogic,focus as focus$1,ElementIdService,pushFocus,findTabbableElements,popFocus,scrollTo,Reference,documentOrderComparator,ValidationService,isValidatableHTMLElement,alertScreenReader,debounce,handleTab,deepClone,formatNumber,parseNumber,parseBankAccountNumber,parseBankgiro,parseClearingNumber,formatPersonnummer,parsePersonnummer,parsePlusgiro,formatPostalCode,parsePercent,formatPercent,parseOrganisationsnummer,isInvalidDatesConfig,isInvalidWeekdaysConfig,parseDate,waitForScreenReader,saveFocus,addFocusListener,removeFocusListener,restoreFocus,DomUtils,focusFirst}from"@fkui/logic";import{getWeekdayNamings,groupByWeek,FDate,DateFormat}from"@fkui/date";import{isEqual as isEqual$2}from"lodash";const statuses=["default","warning","error","success","info"];const _sfc_main$1d=defineComponent({name:"FBadge",props:{/**
2
2
  * The status of the badge, can be either 'default', 'warning', 'error', 'success' or 'info'.
3
3
  *
4
4
  */status:{type:String,default:"default",validator:function(value){return statuses.includes(value);}},/**
@@ -164,7 +164,7 @@ isIndex(key,length)))){result.push(key);}}return result;}var _arrayLikeKeys=arra
164
164
  */beforeSubmit:{type:Function,required:false,default(){}},/**
165
165
  * If given, this function is called before the form data is validated and the [[submit]] event is emitted.
166
166
  * See <f-validation-form> `beforeValidation` props for more info.
167
- */beforeValidation:{type:Function,required:false,default(){}},buttons:{type:Array,required:false,default:()=>[{label:TranslationService.provider.translate("fkui.form-modal.button.submit.text","Spara"),event:"submit",type:"primary",submitButton:true},{label:TranslationService.provider.translate("fkui.form-modal.button.cancel.text","Avbryt"),event:"dismiss",type:"secondary"}]}},emits:["cancel","close","submit"],data(){return{};},computed:{preparedButtons(){return prepareButtonList(this.buttons,FKUIConfigButtonOrder.LEFT_TO_RIGHT);},hasDeprecatedSlots(){return hasSlot(this,"cancel-button-text")||hasSlot(this,"submit-button-text");}},methods:{onClose(){ValidationService.resetState(this.$el);this.$emit("cancel");this.$emit("close",{reason:"close"});},async onSubmit(){ValidationService.resetState(this.$el);this.$emit("submit",{data:this.value});this.$emit("close",{reason:"submit",data:this.value});},onCancel(){ValidationService.resetState(this.$el);this.$emit("cancel");this.$emit("close",{reason:"close"});}}});const _hoisted_1$P={class:"button-group"};const _hoisted_2$B=["type","form","onClick"];const _hoisted_3$w={key:0,class:"sr-only"};const _hoisted_4$r=["form"];function _sfc_render$W(_ctx,_cache,$props,$setup,$data,$options){const _component_f_validation_form=resolveComponent("f-validation-form");const _component_f_modal=resolveComponent("f-modal");return openBlock(),createBlock(_component_f_modal,{"data-test":_ctx.dataTest,fullscreen:_ctx.fullscreen,"is-open":_ctx.isOpen,size:_ctx.size,"aria-close-text":_ctx.ariaCloseText,onClose:_ctx.onClose},{header:withCtx(()=>[renderSlot(_ctx.$slots,"header")]),content:withCtx(()=>[createElementVNode("div",null,[renderSlot(_ctx.$slots,"default")]),createTextVNode(),createVNode(_component_f_validation_form,{id:_ctx.formId,"before-submit":_ctx.beforeSubmit,"before-validation":_ctx.beforeValidation,"use-error-list":_ctx.useErrorList,onSubmit:_ctx.onSubmit,onCancel:_ctx.onCancel},{"error-message":withCtx(()=>[renderSlot(_ctx.$slots,"error-message")]),default:withCtx(()=>[createTextVNode(),renderSlot(_ctx.$slots,"input-text-fields")]),_:3/* FORWARDED */},8,["id","before-submit","before-validation","use-error-list","onSubmit","onCancel"])]),footer:withCtx(()=>[createElementVNode("div",_hoisted_1$P,[!_ctx.hasDeprecatedSlots?(openBlock(true),createElementBlock(Fragment,{key:0},renderList(_ctx.preparedButtons,button=>{return openBlock(),createElementBlock("button",{key:button.label,type:button.buttonType,class:normalizeClass([button.classlist,"button-group__item"]),form:button.buttonType==="submit"?_ctx.formId:void 0,onClick:$event=>button.buttonType==="button"?_ctx.onCancel():false},[createElementVNode("span",null,toDisplayString(button.label),1/* TEXT */),createTextVNode(),button.screenreader?(openBlock(),createElementBlock("span",_hoisted_3$w," "+toDisplayString(button.screenreader),1/* TEXT */)):createCommentVNode("v-if",true)],10,_hoisted_2$B);}),128/* KEYED_FRAGMENT */)):(openBlock(),createElementBlock(Fragment,{key:1},[createElementVNode("button",{form:_ctx.formId,"data-test":"submit-button",type:"submit",class:"button button--primary button-group__item button--large"},[renderSlot(_ctx.$slots,"submit-button-text",{},()=>[createTextVNode(toDisplayString(_ctx.$t("fkui.form-modal.button.submit.text","Spara")),1/* TEXT */)])],8,_hoisted_4$r),createTextVNode(),createElementVNode("button",{"data-test":"cancel-button",type:"button",class:"button button--secondary button-group__item button--large",onClick:_cache[0]||(_cache[0]=(...args)=>_ctx.onCancel&&_ctx.onCancel(...args))},[renderSlot(_ctx.$slots,"cancel-button-text",{},()=>[createTextVNode(toDisplayString(_ctx.$t("fkui.form-modal.button.cancel.text","Avbryt")),1/* TEXT */)])])],64/* STABLE_FRAGMENT */))])]),_:3/* FORWARDED */},8,["data-test","fullscreen","is-open","size","aria-close-text","onClose"]);}const FFormModal=/* @__PURE__ */_export_sfc(_sfc_main$14,[["render",_sfc_render$W]]);async function confirmModal(callingInstance,modalData){const buttons=[{label:modalData.confirm,event:"confirm",type:"primary"},{label:modalData.dismiss,event:"dismiss",type:"secondary"}];const{reason}=await openModal(callingInstance,FConfirmModal,{props:{heading:modalData.heading,content:modalData.content,buttons}});return reason==="confirm";}function isVueComponent(element){return Boolean(element&&typeof element==="object"&&"$el"in element);}function focus(element,options={}){if(Array.isArray(element)){return focus(element[0],options);}if(isVueComponent(element)){var _element$focusTarget;const targetElement=(_element$focusTarget=element.focusTarget)!==null&&_element$focusTarget!==void 0?_element$focusTarget:element.$el;return focus(targetElement,options);}if(element instanceof HTMLElement){focus$1(element,options);return true;}return false;}function getInputElement(vm){const inputElement=vm.$el.querySelector("input");if(!inputElement){const id=vm.$el.id;const tag=vm.$el.tagName.toLowerCase();throw new Error(`Could not find input element from element "${tag}#${id}"`);}return inputElement;}function hasSlot(vm,name,props={}){const slot=vm.$slots[name];return Boolean(renderSlotText(slot,props));}function findParentByName(vm,name){let current=vm;while(current){if(current.$options.name===name){return current;}current=current.$parent;}return void 0;}function getParentByName(vm,name){const parentVm=findParentByName(vm,name);if(parentVm===void 0){throw new Error(`Unable to find parent component by given name '${name}'.`);}return parentVm;}function hasParentByName(vm,name){return findParentByName(vm,name)!==void 0;}class ErrorData{constructor(error,vm,info){__publicField(this,"error");__publicField(this,"vm");__publicField(this,"info");this.error=error;this.vm=vm;this.info=info;}}class ErrorViewData{constructor(hasError=false,payload){__publicField(this,"hasError");__publicField(this,"payload");this.hasError=hasError;this.payload=payload;}}class FormErrorList{constructor(fields){__publicField(this,"focusElementId","");__publicField(this,"id","");__publicField(this,"isValid",false);__publicField(this,"numberOfTimesSubmitted",0);__publicField(this,"title","");Object.assign(this,fields);}}class FormStep{constructor(fields){__publicField(this,"isOpen",false);__publicField(this,"isAnyFieldTouched",false);__publicField(this,"focusElementId","");__publicField(this,"id","");__publicField(this,"isValid",false);__publicField(this,"numberOfTimesSubmitted",0);__publicField(this,"title","");Object.assign(this,fields);}}var MenuAction=/* @__PURE__ */(MenuAction2=>{MenuAction2[MenuAction2["MOVE_NEXT"]=0]="MOVE_NEXT";MenuAction2[MenuAction2["MOVE_PREV"]=1]="MOVE_PREV";MenuAction2[MenuAction2["MOVE_FIRST"]=2]="MOVE_FIRST";MenuAction2[MenuAction2["MOVE_LAST"]=3]="MOVE_LAST";MenuAction2[MenuAction2["ACTIVATE"]=4]="ACTIVATE";return MenuAction2;})(MenuAction||{});function actionFromKeyboardEvent(event){switch(event.key){case"End":return MenuAction.MOVE_LAST;case"Home":return MenuAction.MOVE_FIRST;case"Up":case"ArrowUp":return MenuAction.MOVE_PREV;case"Down":case"ArrowDown":return MenuAction.MOVE_NEXT;case"Left":case"ArrowLeft":return MenuAction.MOVE_PREV;case"Right":case"ArrowRight":return MenuAction.MOVE_NEXT;case"Tab":if(event.shiftKey){return MenuAction.MOVE_PREV;}return MenuAction.MOVE_NEXT;case" ":case"Spacebar":case"Enter":return MenuAction.ACTIVATE;default:return null;}}function getValidatableElement(element){if(isValidatableHTMLElement(element)){return element;}const validatableInsideElement=element.querySelector("input, textarea, select");if(validatableInsideElement){return validatableInsideElement;}else{throw new Error(`Couldn't find any validatable element`);}}function triggerInitialValidationToSupportFFormStepValidation(el){const target=getValidatableElement(el);ValidationService.validateElement(target);}function registerValidators(el,binding){const{modifiers:bindingModifiers={},value:bindingValue={}}=binding;const target=getValidatableElement(el);Object.keys(bindingValue).forEach(validatorName=>{if(!bindingModifiers[validatorName]){throw new Error(`Have you forget to add '${validatorName}' to v-validation.${validatorName}?`);}});const validatorConfigs={};Object.keys(bindingModifiers).forEach(validatorName=>{validatorConfigs[validatorName]=bindingValue[validatorName]||{};});ValidationService.addValidatorsToElement(target,validatorConfigs);}const ValidationDirective={beforeMount(el,binding){registerValidators(el,binding);},beforeUnmount(el,_binding){const validatableElement=getValidatableElement(el);dispatchComponentUnmountEvent(validatableElement);ValidationService.removeValidatorsFromElement(validatableElement);},updated(el,binding){if(!isEqual$1(binding.value,binding.oldValue)){registerValidators(el,binding);}},mounted(el){triggerInitialValidationToSupportFFormStepValidation(el);}};const ValidationPrefixDirective={beforeMount(el,binding){el.addEventListener("component-validity",event=>{const e=event;e.detail.errorMessage=`${binding.value}${e.detail.errorMessage}`;});}};const ValidationPlugin={install(app){app.directive("validation",ValidationDirective);app.directive("validationPrefix",ValidationPrefixDirective);}};const UNHANDLED_ERROR_EVENT="unhandled-error";const defaults={captureWarnings:true,logToConsole:true};function errorHandler(options,error,vm,info){if(options.logToConsole){const consoleOutput=info?[`Error in ${info}:`,error,vm]:[error,vm];console.error(...consoleOutput);}if(error instanceof Error){EventBus.$emit(UNHANDLED_ERROR_EVENT,new ErrorData(error,vm,info));}else{EventBus.$emit(UNHANDLED_ERROR_EVENT,new ErrorData(new Error(String(error)),vm,info));}}function warnHandler(options,msg,vm,trace){if(options.logToConsole){console.warn(`Warning:`,msg,trace);}const error={name:"warning",message:msg,stack:trace};EventBus.$emit(UNHANDLED_ERROR_EVENT,new ErrorData(error,vm,"warning"));}const ErrorPlugin={install(app,options){const config2={...defaults,...options};app.config.errorHandler=errorHandler.bind(void 0,config2);if(config2.captureWarnings){app.config.warnHandler=warnHandler.bind(void 0,config2);}}};const _sfc_main$13=defineComponent({name:"FErrorPage",props:{payload:{type:Object,required:false,default:null}}});const _hoisted_1$O={"data-test":"f-error-page"};const _hoisted_2$A=/* @__PURE__ */createElementVNode("h1",null,"Fel",-1/* HOISTED */);const _hoisted_3$v=/* @__PURE__ */createElementVNode("p",null,"Ett fel har uppstått.",-1/* HOISTED */);const _hoisted_4$q=/* @__PURE__ */createElementVNode("a",{href:"/"},"Gå till startsidan",-1/* HOISTED */);function _sfc_render$V(_ctx,_cache,$props,$setup,$data,$options){return openBlock(),createElementBlock("div",_hoisted_1$O,[_hoisted_2$A,createTextVNode(),_hoisted_3$v,createTextVNode(),_hoisted_4$q]);}const FErrorPage=/* @__PURE__ */_export_sfc(_sfc_main$13,[["render",_sfc_render$V]]);const _sfc_main$12=defineComponent({name:"FErrorHandlingApp",props:{defaultComponent:{type:[Function,Object],required:false,default:void 0},errorComponent:{type:[Function,Object],required:false,default:FErrorPage}},data(){return new ErrorViewData();},watch:{$route(){this.hasError=false;}},created(){EventBus.$on(UNHANDLED_ERROR_EVENT,payload=>{this.hasError=true;this.payload=payload;});}});function _sfc_render$U(_ctx,_cache,$props,$setup,$data,$options){return openBlock(),createElementBlock("div",null,[_ctx.hasError?(openBlock(),createBlock(resolveDynamicComponent(_ctx.errorComponent),{key:0,payload:_ctx.payload},null,8,["payload"])):_ctx.defaultComponent?(openBlock(),createBlock(resolveDynamicComponent(_ctx.defaultComponent),{key:1})):renderSlot(_ctx.$slots,"default",{key:2})]);}const FErrorHandlingApp=/* @__PURE__ */_export_sfc(_sfc_main$12,[["render",_sfc_render$U]]);function isMonthBefore(date,minDate){return Boolean(minDate&&date.isBefore(minDate.startOfMonth()));}function isMonthAfter(date,maxDate){return Boolean(maxDate&&date.isAfter(maxDate.endOfMonth()));}function isInvalidMonth(date,minDate,maxDate){const startOfMonth=date.startOfMonth();return isMonthBefore(startOfMonth,minDate)||isMonthAfter(startOfMonth,maxDate);}function getMessage($t,date,minDate,maxDate){const invalidMonth=isInvalidMonth(date,minDate,maxDate);if(!invalidMonth){return void 0;}if(date.isBefore(minDate)){const{day,monthName,year}=minDate;return $t("fkui.calendar.error.below-min-date","Du kan inte välja en dag före {{day}} {{month}} {{year}}",{day,month:monthName,year});}if(date.isAfter(maxDate)){const{day,monthName,year}=maxDate;return $t("fkui.calendar.error.above-max-date","Du kan inte välja en dag efter {{day}} {{month}} {{year}}",{day,month:monthName,year});}}const _sfc_main$11=defineComponent({name:"ICalendarNavbar",components:{FIcon},mixins:[TranslationMixin],props:{/**
167
+ */beforeValidation:{type:Function,required:false,default(){}},buttons:{type:Array,required:false,default:()=>[{label:TranslationService.provider.translate("fkui.form-modal.button.submit.text","Spara"),event:"submit",type:"primary",submitButton:true},{label:TranslationService.provider.translate("fkui.form-modal.button.cancel.text","Avbryt"),event:"dismiss",type:"secondary"}]}},emits:["cancel","close","submit"],data(){return{};},computed:{preparedButtons(){return prepareButtonList(this.buttons,FKUIConfigButtonOrder.LEFT_TO_RIGHT);},hasDeprecatedSlots(){return hasSlot(this,"cancel-button-text")||hasSlot(this,"submit-button-text");}},methods:{onClose(){ValidationService.resetState(this.$el);this.$emit("cancel");this.$emit("close",{reason:"close"});},async onSubmit(){ValidationService.resetState(this.$el);this.$emit("submit",{data:this.value});this.$emit("close",{reason:"submit",data:this.value});},onCancel(){ValidationService.resetState(this.$el);this.$emit("cancel");this.$emit("close",{reason:"close"});}}});const _hoisted_1$P={class:"button-group"};const _hoisted_2$B=["type","form","onClick"];const _hoisted_3$w={key:0,class:"sr-only"};const _hoisted_4$r=["form"];function _sfc_render$W(_ctx,_cache,$props,$setup,$data,$options){const _component_f_validation_form=resolveComponent("f-validation-form");const _component_f_modal=resolveComponent("f-modal");return openBlock(),createBlock(_component_f_modal,{"data-test":_ctx.dataTest,fullscreen:_ctx.fullscreen,"is-open":_ctx.isOpen,size:_ctx.size,"aria-close-text":_ctx.ariaCloseText,onClose:_ctx.onClose},{header:withCtx(()=>[renderSlot(_ctx.$slots,"header")]),content:withCtx(()=>[createElementVNode("div",null,[renderSlot(_ctx.$slots,"default")]),createTextVNode(),createVNode(_component_f_validation_form,{id:_ctx.formId,"before-submit":_ctx.beforeSubmit,"before-validation":_ctx.beforeValidation,"use-error-list":_ctx.useErrorList,onSubmit:_ctx.onSubmit,onCancel:_ctx.onCancel},{"error-message":withCtx(()=>[renderSlot(_ctx.$slots,"error-message")]),default:withCtx(()=>[createTextVNode(),renderSlot(_ctx.$slots,"input-text-fields")]),_:3/* FORWARDED */},8,["id","before-submit","before-validation","use-error-list","onSubmit","onCancel"])]),footer:withCtx(()=>[createElementVNode("div",_hoisted_1$P,[!_ctx.hasDeprecatedSlots?(openBlock(true),createElementBlock(Fragment,{key:0},renderList(_ctx.preparedButtons,button=>{return openBlock(),createElementBlock("button",{key:button.label,type:button.buttonType,class:normalizeClass([button.classlist,"button-group__item"]),form:button.buttonType==="submit"?_ctx.formId:void 0,onClick:$event=>button.buttonType==="button"?_ctx.onCancel():false},[createElementVNode("span",null,toDisplayString(button.label),1/* TEXT */),createTextVNode(),button.screenreader?(openBlock(),createElementBlock("span",_hoisted_3$w," "+toDisplayString(button.screenreader),1/* TEXT */)):createCommentVNode("v-if",true)],10,_hoisted_2$B);}),128/* KEYED_FRAGMENT */)):(openBlock(),createElementBlock(Fragment,{key:1},[createElementVNode("button",{form:_ctx.formId,"data-test":"submit-button",type:"submit",class:"button button--primary button-group__item button--large"},[renderSlot(_ctx.$slots,"submit-button-text",{},()=>[createTextVNode(toDisplayString(_ctx.$t("fkui.form-modal.button.submit.text","Spara")),1/* TEXT */)])],8,_hoisted_4$r),createTextVNode(),createElementVNode("button",{"data-test":"cancel-button",type:"button",class:"button button--secondary button-group__item button--large",onClick:_cache[0]||(_cache[0]=(...args)=>_ctx.onCancel&&_ctx.onCancel(...args))},[renderSlot(_ctx.$slots,"cancel-button-text",{},()=>[createTextVNode(toDisplayString(_ctx.$t("fkui.form-modal.button.cancel.text","Avbryt")),1/* TEXT */)])])],64/* STABLE_FRAGMENT */))])]),_:3/* FORWARDED */},8,["data-test","fullscreen","is-open","size","aria-close-text","onClose"]);}const FFormModal=/* @__PURE__ */_export_sfc(_sfc_main$14,[["render",_sfc_render$W]]);async function confirmModal(callingInstance,modalData){const buttons=[{label:modalData.confirm,event:"confirm",type:"primary"},{label:modalData.dismiss,event:"dismiss",type:"secondary"}];const{reason}=await openModal(callingInstance,FConfirmModal,{props:{heading:modalData.heading,content:modalData.content,buttons}});return reason==="confirm";}function isVueComponent(element){return Boolean(element&&typeof element==="object"&&"$el"in element);}function focus(element,options={}){if(Array.isArray(element)){return focus(element[0],options);}if(isVueComponent(element)){var _element$focusTarget;const targetElement=(_element$focusTarget=element.focusTarget)!==null&&_element$focusTarget!==void 0?_element$focusTarget:element.$el;return focus(targetElement,options);}if(element instanceof HTMLElement){focus$1(element,options);return true;}return false;}function getInputElement(vm){const inputElement=vm.$el.querySelector("input");if(!inputElement){const id=vm.$el.id;const tag=vm.$el.tagName.toLowerCase();throw new Error(`Could not find input element from element "${tag}#${id}"`);}return inputElement;}function hasSlot(vm,name,props={},options={}){const slot=vm.$slots[name];return Boolean(renderSlotText(slot,props,options));}function findParentByName(vm,name){let current=vm;while(current){if(current.$options.name===name){return current;}current=current.$parent;}return void 0;}function getParentByName(vm,name){const parentVm=findParentByName(vm,name);if(parentVm===void 0){throw new Error(`Unable to find parent component by given name '${name}'.`);}return parentVm;}function hasParentByName(vm,name){return findParentByName(vm,name)!==void 0;}class ErrorData{constructor(error,vm,info){__publicField(this,"error");__publicField(this,"vm");__publicField(this,"info");this.error=error;this.vm=vm;this.info=info;}}class ErrorViewData{constructor(hasError=false,payload){__publicField(this,"hasError");__publicField(this,"payload");this.hasError=hasError;this.payload=payload;}}class FormErrorList{constructor(fields){__publicField(this,"focusElementId","");__publicField(this,"id","");__publicField(this,"isValid",false);__publicField(this,"numberOfTimesSubmitted",0);__publicField(this,"title","");Object.assign(this,fields);}}class FormStep{constructor(fields){__publicField(this,"isOpen",false);__publicField(this,"isAnyFieldTouched",false);__publicField(this,"focusElementId","");__publicField(this,"id","");__publicField(this,"isValid",false);__publicField(this,"numberOfTimesSubmitted",0);__publicField(this,"title","");Object.assign(this,fields);}}var MenuAction=/* @__PURE__ */(MenuAction2=>{MenuAction2[MenuAction2["MOVE_NEXT"]=0]="MOVE_NEXT";MenuAction2[MenuAction2["MOVE_PREV"]=1]="MOVE_PREV";MenuAction2[MenuAction2["MOVE_FIRST"]=2]="MOVE_FIRST";MenuAction2[MenuAction2["MOVE_LAST"]=3]="MOVE_LAST";MenuAction2[MenuAction2["ACTIVATE"]=4]="ACTIVATE";return MenuAction2;})(MenuAction||{});function actionFromKeyboardEvent(event){switch(event.key){case"End":return MenuAction.MOVE_LAST;case"Home":return MenuAction.MOVE_FIRST;case"Up":case"ArrowUp":return MenuAction.MOVE_PREV;case"Down":case"ArrowDown":return MenuAction.MOVE_NEXT;case"Left":case"ArrowLeft":return MenuAction.MOVE_PREV;case"Right":case"ArrowRight":return MenuAction.MOVE_NEXT;case"Tab":if(event.shiftKey){return MenuAction.MOVE_PREV;}return MenuAction.MOVE_NEXT;case" ":case"Spacebar":case"Enter":return MenuAction.ACTIVATE;default:return null;}}function getValidatableElement(element){if(isValidatableHTMLElement(element)){return element;}const validatableInsideElement=element.querySelector("input, textarea, select");if(validatableInsideElement){return validatableInsideElement;}else{throw new Error(`Couldn't find any validatable element`);}}function triggerInitialValidationToSupportFFormStepValidation(el){const target=getValidatableElement(el);ValidationService.validateElement(target);}function registerValidators(el,binding){const{modifiers:bindingModifiers={},value:bindingValue={}}=binding;const target=getValidatableElement(el);Object.keys(bindingValue).forEach(validatorName=>{if(!bindingModifiers[validatorName]){throw new Error(`Have you forget to add '${validatorName}' to v-validation.${validatorName}?`);}});const validatorConfigs={};Object.keys(bindingModifiers).forEach(validatorName=>{validatorConfigs[validatorName]=bindingValue[validatorName]||{};});ValidationService.addValidatorsToElement(target,validatorConfigs);}const ValidationDirective={beforeMount(el,binding){registerValidators(el,binding);},beforeUnmount(el,_binding){const validatableElement=getValidatableElement(el);dispatchComponentUnmountEvent(validatableElement);ValidationService.removeValidatorsFromElement(validatableElement);},updated(el,binding){if(!isEqual$1(binding.value,binding.oldValue)){registerValidators(el,binding);}},mounted(el){triggerInitialValidationToSupportFFormStepValidation(el);}};const ValidationPrefixDirective={beforeMount(el,binding){el.addEventListener("component-validity",event=>{const e=event;e.detail.errorMessage=`${binding.value}${e.detail.errorMessage}`;});}};const ValidationPlugin={install(app){app.directive("validation",ValidationDirective);app.directive("validationPrefix",ValidationPrefixDirective);}};const UNHANDLED_ERROR_EVENT="unhandled-error";const defaults={captureWarnings:true,logToConsole:true};function errorHandler(options,error,vm,info){if(options.logToConsole){const consoleOutput=info?[`Error in ${info}:`,error,vm]:[error,vm];console.error(...consoleOutput);}if(error instanceof Error){EventBus.$emit(UNHANDLED_ERROR_EVENT,new ErrorData(error,vm,info));}else{EventBus.$emit(UNHANDLED_ERROR_EVENT,new ErrorData(new Error(String(error)),vm,info));}}function warnHandler(options,msg,vm,trace){if(options.logToConsole){console.warn(`Warning:`,msg,trace);}const error={name:"warning",message:msg,stack:trace};EventBus.$emit(UNHANDLED_ERROR_EVENT,new ErrorData(error,vm,"warning"));}const ErrorPlugin={install(app,options){const config2={...defaults,...options};app.config.errorHandler=errorHandler.bind(void 0,config2);if(config2.captureWarnings){app.config.warnHandler=warnHandler.bind(void 0,config2);}}};const _sfc_main$13=defineComponent({name:"FErrorPage",props:{payload:{type:Object,required:false,default:null}}});const _hoisted_1$O={"data-test":"f-error-page"};const _hoisted_2$A=/* @__PURE__ */createElementVNode("h1",null,"Fel",-1/* HOISTED */);const _hoisted_3$v=/* @__PURE__ */createElementVNode("p",null,"Ett fel har uppstått.",-1/* HOISTED */);const _hoisted_4$q=/* @__PURE__ */createElementVNode("a",{href:"/"},"Gå till startsidan",-1/* HOISTED */);function _sfc_render$V(_ctx,_cache,$props,$setup,$data,$options){return openBlock(),createElementBlock("div",_hoisted_1$O,[_hoisted_2$A,createTextVNode(),_hoisted_3$v,createTextVNode(),_hoisted_4$q]);}const FErrorPage=/* @__PURE__ */_export_sfc(_sfc_main$13,[["render",_sfc_render$V]]);const _sfc_main$12=defineComponent({name:"FErrorHandlingApp",props:{defaultComponent:{type:[Function,Object],required:false,default:void 0},errorComponent:{type:[Function,Object],required:false,default:FErrorPage}},data(){return new ErrorViewData();},watch:{$route(){this.hasError=false;}},created(){EventBus.$on(UNHANDLED_ERROR_EVENT,payload=>{this.hasError=true;this.payload=payload;});}});function _sfc_render$U(_ctx,_cache,$props,$setup,$data,$options){return openBlock(),createElementBlock("div",null,[_ctx.hasError?(openBlock(),createBlock(resolveDynamicComponent(_ctx.errorComponent),{key:0,payload:_ctx.payload},null,8,["payload"])):_ctx.defaultComponent?(openBlock(),createBlock(resolveDynamicComponent(_ctx.defaultComponent),{key:1})):renderSlot(_ctx.$slots,"default",{key:2})]);}const FErrorHandlingApp=/* @__PURE__ */_export_sfc(_sfc_main$12,[["render",_sfc_render$U]]);function isMonthBefore(date,minDate){return Boolean(minDate&&date.isBefore(minDate.startOfMonth()));}function isMonthAfter(date,maxDate){return Boolean(maxDate&&date.isAfter(maxDate.endOfMonth()));}function isInvalidMonth(date,minDate,maxDate){const startOfMonth=date.startOfMonth();return isMonthBefore(startOfMonth,minDate)||isMonthAfter(startOfMonth,maxDate);}function getMessage($t,date,minDate,maxDate){const invalidMonth=isInvalidMonth(date,minDate,maxDate);if(!invalidMonth){return void 0;}if(date.isBefore(minDate)){const{day,monthName,year}=minDate;return $t("fkui.calendar.error.below-min-date","Du kan inte välja en dag före {{day}} {{month}} {{year}}",{day,month:monthName,year});}if(date.isAfter(maxDate)){const{day,monthName,year}=maxDate;return $t("fkui.calendar.error.above-max-date","Du kan inte välja en dag efter {{day}} {{month}} {{year}}",{day,month:monthName,year});}}const _sfc_main$11=defineComponent({name:"ICalendarNavbar",components:{FIcon},mixins:[TranslationMixin],props:{/**
168
168
  * Focused month.
169
169
  */modelValue:{type:Object,required:true},/**
170
170
  * Min date.
@@ -239,22 +239,7 @@ isIndex(key,length)))){result.push(key);}}return result;}var _arrayLikeKeys=arra
239
239
  * The items to be diplayed in the menu
240
240
  */items:{type:Array,required:true},/**
241
241
  * Unique accessible name for navigation landmark.
242
- */ariaLabel:{type:String,required:false,default:"Kontextuell meny"}},emits:["close","select"],setup(){return{contextmenu:ref(null)};},data(){return{selectedItem:"",currentFocusedItemIndex:-1};},computed:{popupItems(){return this.items.filter(isContextMenuTextItem);},separatorPositions(){const res=[];if(this.items.length>1){this.items.forEach((it,i)=>{if(isContextMenuSeparatorItem(it)){const pos=i-1-res.length;if(pos>=0&&pos<this.items.length-1){res.push(pos);}}});}return res;},hasIcons(){return this.items.some(it=>isContextMenuTextItem(it)&&it.icon);}},watch:{isOpen:{immediate:true,async handler(){if(this.isOpen){this.currentFocusedItemIndex=-1;this.selectedItem="";}}}},methods:{hasSeparatorAfterItemAt(index){return this.separatorPositions.includes(index);},closePopup(){this.$emit("close");},onClickItem(item){if(isContextMenuTextItem(item)&&item.key){this.selectedItem=item.key;this.$emit("select",this.selectedItem);this.closePopup();}},tabIndex(index){return index===this.currentFocusedItemIndex?0:-1;},onKeyUp(event){if(preventKeys$3.includes(event.key)){event.preventDefault();}},doHandlePopupMenuTabKey(action){if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex+1===this.popupItems.length){this.closePopup();return true;}else if(action===MenuAction.MOVE_PREV&&(this.currentFocusedItemIndex===0||this.currentFocusedItemIndex===-1)){this.closePopup();return false;}return false;},async onKeyDown(event){if(!preventKeys$3.includes(event.key)){return;}if(event.key==="Escape"){this.$emit("close");return;}const action=actionFromKeyboardEvent(event);if(action===null){return;}if(event.key==="Tab"&&this.doHandlePopupMenuTabKey(action)){return;}if(keyUp$1.includes(event.key)&&this.currentFocusedItemIndex===-1){this.currentFocusedItemIndex=this.popupItems.length>0?this.popupItems.length:1;}event.preventDefault();await doMenuAction$3(action,this);},async setFocusOnItem(index){if(index<0||index>=this.popupItems.length){return;}this.currentFocusedItemIndex=index;await this.$nextTick();if(!this.isOpen){return;}const items=getHTMLElementsFromVueRef(this.$refs.items);if(items.length>0){const popupMenuItem=items[index];focus$1(popupMenuItem,{preventScroll:true});}},async activateItem(index){if(index<0||index>=this.popupItems.length){return;}if(index!==this.currentFocusedItemIndex){await this.setFocusOnItem(index);}this.onClickItem(this.popupItems[this.currentFocusedItemIndex]);}}});const _hoisted_1$I=["aria-label"];const _hoisted_2$w={ref:"contextmenu",role:"menu",tabindex:"-1",class:"contextmenu__list"};const _hoisted_3$s=["onClick"];const _hoisted_4$n=["tabindex"];const _hoisted_5$l={key:0,class:"contextmenu__separator"};function _sfc_render$N(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");const _component_i_popup=resolveComponent("i-popup");return openBlock(),createBlock(_component_i_popup,{"is-open":_ctx.isOpen,"keyboard-trap":false,anchor:_ctx.anchor,"set-focus":true,"focus-element":()=>_ctx.contextmenu,inline:"never",onClose:_cache[2]||(_cache[2]=$event=>_ctx.$emit("close"))},{default:withCtx(()=>[createElementVNode("nav",{class:"contextmenu","aria-label":_ctx.ariaLabel,onKeyup:_cache[0]||(_cache[0]=(...args)=>_ctx.onKeyUp&&_ctx.onKeyUp(...args)),onKeydown:_cache[1]||(_cache[1]=(...args)=>_ctx.onKeyDown&&_ctx.onKeyDown(...args))},[createElementVNode("ul",_hoisted_2$w,[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.popupItems,(item,index)=>{return openBlock(),createElementBlock("li",{key:item.key,role:"menuitem",onClick:$event=>_ctx.onClickItem(item)},[createElementVNode("div",{ref_for:true,ref:"items",tabindex:_ctx.tabIndex(index),class:"contextmenu__list__item"},[_ctx.hasIcons?(openBlock(),createBlock(_component_f_icon,{key:0,class:"contextmenu__lefticon",name:item.icon?item.icon:"",library:item.iconLibrary?item.iconLibrary:"f"},null,8,["name","library"])):createCommentVNode("v-if",true),createTextVNode(),createElementVNode("a",{ref_for:true,ref:"anchors"},toDisplayString(item.label),513/* TEXT, NEED_PATCH */)],8,_hoisted_4$n),createTextVNode(),_ctx.hasSeparatorAfterItemAt(index)?(openBlock(),createElementBlock("hr",_hoisted_5$l)):createCommentVNode("v-if",true)],8,_hoisted_3$s);}),128/* KEYED_FRAGMENT */))],512/* NEED_PATCH */)],40,_hoisted_1$I)]),_:1/* STABLE */},8,["is-open","anchor","focus-element"]);}const FContextMenu=/* @__PURE__ */_export_sfc(_sfc_main$X,[["render",_sfc_render$N]]);const anyType$1=[String,Object,Array,Number,Date,Boolean];const _sfc_main$W=defineComponent({name:"FCheckboxField",inheritAttrs:false,props:{/**
243
- * Set to `true`, empty string `""` or string `"disabled"` to disable this input field.
244
- */disabled:{type:Boolean,required:false,default:false},/**
245
- * The id for the input id attribute.
246
- * The id for the label for attribute.
247
- * If the prop is not set a random value will be generated.
248
- */id:{type:String,required:false,default:()=>ElementIdService.generateElementId()},/**
249
- * The value for the input checked attribute.
250
- * @model
251
- */// ? The rule is disabled so that the `checked` prop can be undefined or null.
252
- /* eslint-disable-next-line vue/require-default-prop -- technical debt,
253
- /* it should contain a default value of undefined and proptype should
254
- /* include undefined (see comment on line above) */modelValue:{type:anyType$1,required:false},/**
255
- * The value for the input.
256
- */value:{type:anyType$1,required:true}},emits:["change","update:modelValue"],setup(){return{showDetails:inject("showDetails","never"),getFieldsetLabelText:inject("getFieldsetLabelText",()=>"")};},data(){return{expanded:false,height:0,initialStyle:{overflow:"hidden",transition:"height 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96)"},hiddenStyle:{height:"auto",position:"absolute",visibility:"hidden"},visibleStyle:{width:"",position:"",visibility:"",height:"0px"},openedStyle:{height:"auto"}};},computed:{attrs(){let checked;if(Array.isArray(this.modelValue)){checked=this.modelValue.findIndex(it=>isEqual$2(toValue(it),toValue(this.value)))>=0;}else{checked=this.value===this.modelValue;}return{...this.$attrs,value:this.value,checked,onChange:event=>{if(event.target instanceof HTMLInputElement){this.emitVModelEvent(event);}},onInput:event=>{event.target.focus();}};},disabledClass(){return this.disabled?"disabled":"";},// eslint-disable-next-line @typescript-eslint/no-explicit-any -- technical debt, nore sure whats going on here
257
- injected(){return this;}},methods:{updateExpandedFlag(){const checkboxInput=getHTMLElementFromVueRef(this.$refs["checkboxInput"]);this.expanded=checkboxInput.checked;},emitVModelEvent(event){let newModel;if(Array.isArray(this.modelValue)){newModel=[...this.modelValue].filter(it=>!isEqual$2(toValue(it),toValue(this.value)));if(this.modelValue.length<=newModel.length){newModel.push(this.value);}}else{if(this.value===this.modelValue){newModel=typeof this.value==="boolean"?false:void 0;}else{const target=event.target;newModel=target.value==="true"?true:this.value;}}this.$emit("update:modelValue",newModel);this.$emit("change",newModel);},onKeydown(event){event.stopPropagation();},onValidity({detail}){if(detail.target!==this.$el.querySelector("input")){return;}let errorMessage="";if(hasSlot(this,"default")){const labelText=this.injected.getFieldsetLabelText();if(labelText){errorMessage=`${labelText} ${renderSlotText(this.$slots.default)}`;}else{errorMessage=`${renderSlotText(this.$slots.default)}`;}}const element=this.$el.querySelector(`#${detail.elementId}`);if(element){dispatchComponentValidityEvent(element,{...detail,errorMessage,focusElementId:detail.elementId});}},enter(element){const htmlElement=getHTMLElementFromVueRef(element);const computedStyle=getComputedStyle(element);Object.assign(htmlElement.style,this.initialStyle);Object.assign(htmlElement.style,this.hiddenStyle);htmlElement.style.width=computedStyle.width;const height=computedStyle.height;Object.assign(htmlElement.style,this.visibleStyle);getComputedStyle(element).height;setTimeout(()=>{this.height=parseInt(height,10);htmlElement.style.height=height;});},afterEnter(element){const htmlElement=getHTMLElementFromVueRef(element);Object.assign(htmlElement.style,this.openedStyle);},leave(element){const htmlElement=getHTMLElementFromVueRef(element);const height=getComputedStyle(element).height;htmlElement.style.height=height;getComputedStyle(element).height;setTimeout(()=>{Object.assign(htmlElement.style,this.visibleStyle);});}}});const _hoisted_1$H=["id","disabled"];const _hoisted_2$v=["for"];const _hoisted_3$r={key:0,class:"checkbox__details"};const _hoisted_4$m=/* @__PURE__ */createElementVNode("br",null,null,-1/* HOISTED */);const _hoisted_5$k={key:0,class:"checkbox__details"};const _hoisted_6$g=/* @__PURE__ */createElementVNode("br",null,null,-1/* HOISTED */);function _sfc_render$M(_ctx,_cache,$props,$setup,$data,$options){return openBlock(),createElementBlock("div",{class:normalizeClass(["checkbox",_ctx.disabledClass]),onValidity:_cache[2]||(_cache[2]=(...args)=>_ctx.onValidity&&_ctx.onValidity(...args))},[createElementVNode("input",mergeProps({id:_ctx.id},_ctx.attrs,{ref:"checkboxInput",type:"checkbox",class:"checkbox__input",disabled:_ctx.disabled,onKeydown:_cache[0]||(_cache[0]=withKeys((...args)=>_ctx.onKeydown&&_ctx.onKeydown(...args),["space"])),onChange:_cache[1]||(_cache[1]=$event=>_ctx.updateExpandedFlag())}),null,16,_hoisted_1$H),createTextVNode(),createElementVNode("label",{class:normalizeClass(_ctx.$slots.details?"checkbox__label checkbox__width":"checkbox__label"),for:_ctx.id},[renderSlot(_ctx.$slots,"default"),createTextVNode(),_ctx.$slots.details?(openBlock(),createElementBlock(Fragment,{key:0},[_ctx.showDetails==="always"?(openBlock(),createElementBlock("span",_hoisted_3$r,[_hoisted_4$m,createTextVNode(),renderSlot(_ctx.$slots,"details")])):createCommentVNode("v-if",true),createTextVNode(),_ctx.showDetails==="when-selected"?(openBlock(),createBlock(Transition,{key:1,onEnter:_ctx.enter,onAfterEnter:_ctx.afterEnter,onLeave:_ctx.leave},{default:withCtx(()=>[_ctx.expanded?(openBlock(),createElementBlock("span",_hoisted_5$k,[_hoisted_6$g,createTextVNode(),renderSlot(_ctx.$slots,"details",{height:_ctx.height})])):createCommentVNode("v-if",true)]),_:3/* FORWARDED */},8,["onEnter","onAfterEnter","onLeave"])):createCommentVNode("v-if",true)],64/* STABLE_FRAGMENT */)):createCommentVNode("v-if",true)],10,_hoisted_2$v)],34/* CLASS, NEED_HYDRATION */);}const FCheckboxField=/* @__PURE__ */_export_sfc(_sfc_main$W,[["render",_sfc_render$M]]);const getFieldsetLabelText=Symbol("getFieldsetLabelText");function*labelClasses(options){const{labelClass}=options;yield"fieldset__label";yield labelClass;}function*contentClasses(options){const{hasRadiobutton,hasCheckbox,contentClass}=options;yield"fieldset__content";if(hasRadiobutton){yield"radio-button-group__content";}if(hasCheckbox){yield"checkbox-group__content";}yield contentClass;}const _sfc_main$V=defineComponent({name:"FFieldset",components:{FIcon},mixins:[TranslationMixin],provide(){return{[getFieldsetLabelText]:()=>{return renderSlotText(this.$slots.label);},sharedName:this.name,showDetails:this.showDetails};},props:{/**
242
+ */ariaLabel:{type:String,required:false,default:"Kontextuell meny"}},emits:["close","select"],setup(){return{contextmenu:ref(null)};},data(){return{selectedItem:"",currentFocusedItemIndex:-1};},computed:{popupItems(){return this.items.filter(isContextMenuTextItem);},separatorPositions(){const res=[];if(this.items.length>1){this.items.forEach((it,i)=>{if(isContextMenuSeparatorItem(it)){const pos=i-1-res.length;if(pos>=0&&pos<this.items.length-1){res.push(pos);}}});}return res;},hasIcons(){return this.items.some(it=>isContextMenuTextItem(it)&&it.icon);}},watch:{isOpen:{immediate:true,async handler(){if(this.isOpen){this.currentFocusedItemIndex=-1;this.selectedItem="";}}}},methods:{hasSeparatorAfterItemAt(index){return this.separatorPositions.includes(index);},closePopup(){this.$emit("close");},onClickItem(item){if(isContextMenuTextItem(item)&&item.key){this.selectedItem=item.key;this.$emit("select",this.selectedItem);this.closePopup();}},tabIndex(index){return index===this.currentFocusedItemIndex?0:-1;},onKeyUp(event){if(preventKeys$3.includes(event.key)){event.preventDefault();}},doHandlePopupMenuTabKey(action){if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex+1===this.popupItems.length){this.closePopup();return true;}else if(action===MenuAction.MOVE_PREV&&(this.currentFocusedItemIndex===0||this.currentFocusedItemIndex===-1)){this.closePopup();return false;}return false;},async onKeyDown(event){if(!preventKeys$3.includes(event.key)){return;}if(event.key==="Escape"){this.$emit("close");return;}const action=actionFromKeyboardEvent(event);if(action===null){return;}if(event.key==="Tab"&&this.doHandlePopupMenuTabKey(action)){return;}if(keyUp$1.includes(event.key)&&this.currentFocusedItemIndex===-1){this.currentFocusedItemIndex=this.popupItems.length>0?this.popupItems.length:1;}event.preventDefault();await doMenuAction$3(action,this);},async setFocusOnItem(index){if(index<0||index>=this.popupItems.length){return;}this.currentFocusedItemIndex=index;await this.$nextTick();if(!this.isOpen){return;}const items=getHTMLElementsFromVueRef(this.$refs.items);if(items.length>0){const popupMenuItem=items[index];focus$1(popupMenuItem,{preventScroll:true});}},async activateItem(index){if(index<0||index>=this.popupItems.length){return;}if(index!==this.currentFocusedItemIndex){await this.setFocusOnItem(index);}this.onClickItem(this.popupItems[this.currentFocusedItemIndex]);}}});const _hoisted_1$I=["aria-label"];const _hoisted_2$w={ref:"contextmenu",role:"menu",tabindex:"-1",class:"contextmenu__list"};const _hoisted_3$s=["onClick"];const _hoisted_4$n=["tabindex"];const _hoisted_5$l={key:0,class:"contextmenu__separator"};function _sfc_render$N(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");const _component_i_popup=resolveComponent("i-popup");return openBlock(),createBlock(_component_i_popup,{"is-open":_ctx.isOpen,"keyboard-trap":false,anchor:_ctx.anchor,"set-focus":true,"focus-element":()=>_ctx.contextmenu,inline:"never",onClose:_cache[2]||(_cache[2]=$event=>_ctx.$emit("close"))},{default:withCtx(()=>[createElementVNode("nav",{class:"contextmenu","aria-label":_ctx.ariaLabel,onKeyup:_cache[0]||(_cache[0]=(...args)=>_ctx.onKeyUp&&_ctx.onKeyUp(...args)),onKeydown:_cache[1]||(_cache[1]=(...args)=>_ctx.onKeyDown&&_ctx.onKeyDown(...args))},[createElementVNode("ul",_hoisted_2$w,[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.popupItems,(item,index)=>{return openBlock(),createElementBlock("li",{key:item.key,role:"menuitem",onClick:$event=>_ctx.onClickItem(item)},[createElementVNode("div",{ref_for:true,ref:"items",tabindex:_ctx.tabIndex(index),class:"contextmenu__list__item"},[_ctx.hasIcons?(openBlock(),createBlock(_component_f_icon,{key:0,class:"contextmenu__lefticon",name:item.icon?item.icon:"",library:item.iconLibrary?item.iconLibrary:"f"},null,8,["name","library"])):createCommentVNode("v-if",true),createTextVNode(),createElementVNode("a",{ref_for:true,ref:"anchors"},toDisplayString(item.label),513/* TEXT, NEED_PATCH */)],8,_hoisted_4$n),createTextVNode(),_ctx.hasSeparatorAfterItemAt(index)?(openBlock(),createElementBlock("hr",_hoisted_5$l)):createCommentVNode("v-if",true)],8,_hoisted_3$s);}),128/* KEYED_FRAGMENT */))],512/* NEED_PATCH */)],40,_hoisted_1$I)]),_:1/* STABLE */},8,["is-open","anchor","focus-element"]);}const FContextMenu=/* @__PURE__ */_export_sfc(_sfc_main$X,[["render",_sfc_render$N]]);function*labelClasses(options){const{labelClass}=options;yield"fieldset__label";yield labelClass;}function*contentClasses(options){const{hasRadiobutton,hasCheckbox,contentClass}=options;yield"fieldset__content";if(hasRadiobutton){yield"radio-button-group__content";}if(hasCheckbox){yield"checkbox-group__content";}yield contentClass;}const injectionKeys={sharedName:Symbol("sharedName"),showDetails:Symbol("showDetails"),getFieldsetLabelText:Symbol("getFieldsetLabelText")};function useFieldset(){return{sharedName:inject(injectionKeys.sharedName,void 0),showDetails:inject(injectionKeys.showDetails,"never"),getFieldsetLabelText:inject(injectionKeys.getFieldsetLabelText,()=>void 0)};}const _sfc_main$W=defineComponent({name:"FFieldset",components:{FIcon},mixins:[TranslationMixin],props:{/**
258
243
  * The id for the fieldset id attribute.
259
244
  * If the prop is not set a random value will be generated.
260
245
  */id:{type:String,required:false,default:()=>ElementIdService.generateElementId()},/**
@@ -278,10 +263,25 @@ injected(){return this;}},methods:{updateExpandedFlag(){const checkboxInput=getH
278
263
  * * `never` (default) - Never show item details.
279
264
  * - `when-selected` - Show item details when selected.
280
265
  * - `always` - Always show item details.
281
- */showDetails:{type:String,default:"never",validator(value){return["never","when-selected","always"].includes(value);}}},data(){return{validity:{validityMode:"INITIAL"},descriptionClass:["label__description"],discreteDescriptionClass:["label__description","label__description--discrete"],validityElement:null,dispatchObject:{},detail:{},hasDocumentListener:false,legendKey:1,oldMessage:"",children:new Array(),hasCheckbox:false,hasRadiobutton:false};},computed:{hasError(){return this.validity.validityMode==="ERROR";},hasErrorMessageSlot(){return hasSlot(this,"error-message");},hasTooltipSlot(){return Boolean(this.$slots.tooltip);},hasDescriptionSlot(){return hasSlot(this,"description");},legendClass(){return this.hasTooltipSlot?["sr-only"]:this.groupLabelClass;},groupLabelClass(){return Array.from(labelClasses(this));},groupContentClass(){return Array.from(contentClasses(this));},classes(){const{hasRadiobutton,hasCheckbox,horizontal,chip,border}=this;return{"radio-button-group":hasRadiobutton,"radio-button-group--chip":chip&&hasRadiobutton,"radio-button-group--horizontal":horizontal&&hasRadiobutton,"radio-button-group--border":border&&hasRadiobutton,"checkbox-group":hasCheckbox,"checkbox-group--chip":chip&&hasCheckbox,"checkbox-group--horizontal":horizontal&&hasCheckbox,"checkbox-group--border":border&&hasCheckbox};},checkedChildren(){return this.children.filter(child=>child.checked);},debouncedUpdateChildren(){return debounce(this.updateCheckboxChildren.bind(this),150);},checkboxCheckedScreenReaderText(){return this.checkedChildren.length===1?this.$t("fkui.checkbox-group.checkbox.checked","Kryssruta kryssad"):this.$t("fkui.checkbox-group.checkbox.not.checked","Kryssruta ej kryssad");},numberOfCheckboxesScreenReaderText(){return this.$t("fkui.checkbox-group.count","Grupp med {{ count }} kryssrutor",{count:String(this.children.length)});},numberOfCheckedCheckboxesScreenText(){return this.$t("fkui.checkbox-group.checked","{{ checked }} kryssad av {{ count }}",{checked:String(this.checkedChildren.length),count:String(this.children.length)});}},async mounted(){await this.$nextTick();const types=Array.from(this.$el.querySelectorAll(`input[type="checkbox"], input[type="radio"]`),it=>it.getAttribute("type"));this.hasCheckbox=types.includes("checkbox");this.hasRadiobutton=types.includes("radio");if(this.hasCheckbox){this.updateCheckboxChildren();}},updated(){if(this.hasCheckbox){this.debouncedUpdateChildren();}},methods:{async onValidity({detail}){var _renderSlotText2;if(detail.target!==this.$el){return;}this.detail=detail;await this.$nextTick();const errorMessage=(_renderSlotText2=renderSlotText(this.$slots.label))!==null&&_renderSlotText2!==void 0?_renderSlotText2:"";const firstFocusableElement=this.$el.querySelector("input:not(disabled), select:not(disabled), textarea:not(disabled)");const focusElementId=firstFocusableElement?firstFocusableElement.id:this.id;this.validityElement=this.$el;this.dispatchObject={...detail,errorMessage,focusElementId};this.validity=this.detail;if(this.validityElement){dispatchComponentValidityEvent(this.validityElement,this.dispatchObject);}const message=detail.validityMode==="INITIAL"?"":detail.validationMessage;if(message!==this.oldMessage){this.forceLegendUpdate();this.oldMessage=message;}},/**
266
+ */showDetails:{type:String,default:"never",validator(value){return["never","when-selected","always"].includes(value);}}},setup(props){const slots=useSlots();provide(injectionKeys.sharedName,props.name);provide(injectionKeys.showDetails,props.showDetails);provide(injectionKeys.getFieldsetLabelText,()=>{return renderSlotText(slots.label);});},data(){return{validity:{validityMode:"INITIAL"},descriptionClass:["label__description"],discreteDescriptionClass:["label__description","label__description--discrete"],validityElement:null,dispatchObject:{},detail:{},hasDocumentListener:false,legendKey:1,oldMessage:"",children:new Array(),hasCheckbox:false,hasRadiobutton:false};},computed:{hasError(){return this.validity.validityMode==="ERROR";},hasErrorMessageSlot(){return hasSlot(this,"error-message");},hasTooltipSlot(){return Boolean(this.$slots.tooltip);},hasDescriptionSlot(){return hasSlot(this,"description");},legendClass(){return this.hasTooltipSlot?["sr-only"]:this.groupLabelClass;},groupLabelClass(){return Array.from(labelClasses(this));},groupContentClass(){return Array.from(contentClasses(this));},classes(){const{hasRadiobutton,hasCheckbox,horizontal,chip,border}=this;return{"radio-button-group":hasRadiobutton,"radio-button-group--chip":chip&&hasRadiobutton,"radio-button-group--horizontal":horizontal&&hasRadiobutton,"radio-button-group--border":border&&hasRadiobutton,"checkbox-group":hasCheckbox,"checkbox-group--chip":chip&&hasCheckbox,"checkbox-group--horizontal":horizontal&&hasCheckbox,"checkbox-group--border":border&&hasCheckbox};},checkedChildren(){return this.children.filter(child=>child.checked);},debouncedUpdateChildren(){return debounce(this.updateCheckboxChildren.bind(this),150);},checkboxCheckedScreenReaderText(){return this.checkedChildren.length===1?this.$t("fkui.checkbox-group.checkbox.checked","Kryssruta kryssad"):this.$t("fkui.checkbox-group.checkbox.not.checked","Kryssruta ej kryssad");},numberOfCheckboxesScreenReaderText(){return this.$t("fkui.checkbox-group.count","Grupp med {{ count }} kryssrutor",{count:String(this.children.length)});},numberOfCheckedCheckboxesScreenText(){return this.$t("fkui.checkbox-group.checked","{{ checked }} kryssad av {{ count }}",{checked:String(this.checkedChildren.length),count:String(this.children.length)});}},async mounted(){await this.$nextTick();const types=Array.from(this.$el.querySelectorAll(`input[type="checkbox"], input[type="radio"]`),it=>it.getAttribute("type"));this.hasCheckbox=types.includes("checkbox");this.hasRadiobutton=types.includes("radio");if(this.hasCheckbox){this.updateCheckboxChildren();}},updated(){if(this.hasCheckbox){this.debouncedUpdateChildren();}},methods:{async onValidity({detail}){var _renderSlotText2;if(detail.target!==this.$el){return;}this.detail=detail;await this.$nextTick();const errorMessage=(_renderSlotText2=renderSlotText(this.$slots.label))!==null&&_renderSlotText2!==void 0?_renderSlotText2:"";const firstFocusableElement=this.$el.querySelector("input:not(disabled), select:not(disabled), textarea:not(disabled)");const focusElementId=firstFocusableElement?firstFocusableElement.id:this.id;this.validityElement=this.$el;this.dispatchObject={...detail,errorMessage,focusElementId};this.validity=this.detail;if(this.validityElement){dispatchComponentValidityEvent(this.validityElement,this.dispatchObject);}const message=detail.validityMode==="INITIAL"?"":detail.validationMessage;if(message!==this.oldMessage){this.forceLegendUpdate();this.oldMessage=message;}},/**
282
267
  * Workaround for NVDA-bug. Force re rendering of legend element due to NVDA not recognizing innerHTML changes.
283
268
  * NVDA has closed the bug as it is related to the browser (works in FF): https://github.com/nvaccess/nvda/issues/13162
284
- */forceLegendUpdate(){this.legendKey++;},async updateCheckboxChildren(){await this.$nextTick();this.children=Array.from(this.$el.querySelectorAll('input[type="checkbox"]'));}}});const _hoisted_1$G=["id"];const _hoisted_2$u={key:0,class:"sr-only"};const _hoisted_3$q={key:0,class:"label__message label__message--error"};const _hoisted_4$l={key:0,"data-test":"checked-boxes",class:"sr-only","aria-live":"polite"};const _hoisted_5$j={key:0};const _hoisted_6$f={key:1};const _hoisted_7$d={class:"sr-separator"};const _hoisted_8$9={class:"tooltip-before","aria-hidden":"true"};const _hoisted_9$5={class:"label tooltip-before__label"};const _hoisted_10$5={key:0,class:"label__message label__message--error"};function _sfc_render$L(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return openBlock(),createElementBlock("fieldset",{id:_ctx.id,class:normalizeClass(["fieldset",_ctx.classes]),onValidity:_cache[0]||(_cache[0]=(...args)=>_ctx.onValidity&&_ctx.onValidity(...args))},[(openBlock(),createElementBlock("legend",{key:_ctx.legendKey,class:normalizeClass(["label",_ctx.legendClass])},[renderSlot(_ctx.$slots,"label"),createTextVNode(),_ctx.hasCheckbox&&_ctx.children.length>1?(openBlock(),createElementBlock("span",_hoisted_2$u,[createElementVNode("span",null,toDisplayString(_ctx.numberOfCheckboxesScreenReaderText),1/* TEXT */)])):createCommentVNode("v-if",true),createTextVNode(),renderSlot(_ctx.$slots,"description",normalizeProps(guardReactiveProps({descriptionClass:_ctx.descriptionClass,discreteDescriptionClass:_ctx.discreteDescriptionClass}))),createTextVNode(),renderSlot(_ctx.$slots,"error-message",normalizeProps(guardReactiveProps({hasError:_ctx.hasError,validationMessage:_ctx.validity.validationMessage})),()=>[_ctx.hasError?(openBlock(),createElementBlock("span",_hoisted_3$q,[createVNode(_component_f_icon,{class:"label__icon--left",name:"error"}),createTextVNode(" "+toDisplayString(_ctx.validity.validationMessage),1/* TEXT */)])):createCommentVNode("v-if",true)])],2/* CLASS */)),createTextVNode(),_ctx.hasCheckbox?(openBlock(),createElementBlock("span",_hoisted_4$l,[_ctx.children.length===1?(openBlock(),createElementBlock("span",_hoisted_5$j,toDisplayString(_ctx.checkboxCheckedScreenReaderText),1/* TEXT */)):(openBlock(),createElementBlock("span",_hoisted_6$f,toDisplayString(_ctx.numberOfCheckedCheckboxesScreenText),1/* TEXT */))])):createCommentVNode("v-if",true),createTextVNode(),_ctx.hasTooltipSlot?(openBlock(),createElementBlock(Fragment,{key:1},[createElementVNode("div",_hoisted_7$d,[createElementVNode("div",_hoisted_8$9,[createElementVNode("div",_hoisted_9$5,[renderSlot(_ctx.$slots,"label")])]),createTextVNode(),renderSlot(_ctx.$slots,"tooltip")]),createTextVNode(),_ctx.hasDescriptionSlot||_ctx.hasErrorMessageSlot||_ctx.hasError?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(["label",_ctx.groupLabelClass]),"aria-hidden":"true"},[renderSlot(_ctx.$slots,"description",normalizeProps(guardReactiveProps({descriptionClass:_ctx.descriptionClass,discreteDescriptionClass:_ctx.discreteDescriptionClass}))),createTextVNode(),renderSlot(_ctx.$slots,"error-message",normalizeProps(guardReactiveProps({hasError:_ctx.hasError,validationMessage:_ctx.validity.validationMessage})),()=>[_ctx.hasError?(openBlock(),createElementBlock("span",_hoisted_10$5,[createVNode(_component_f_icon,{class:"label__icon--left",name:"error"}),createTextVNode(" "+toDisplayString(_ctx.validity.validationMessage),1/* TEXT */)])):createCommentVNode("v-if",true)])],2/* CLASS */)):createCommentVNode("v-if",true)],64/* STABLE_FRAGMENT */)):createCommentVNode("v-if",true),createTextVNode(),createElementVNode("div",{class:normalizeClass(_ctx.groupContentClass)},[renderSlot(_ctx.$slots,"default")],2/* CLASS */)],42,_hoisted_1$G);}const FFieldset=/* @__PURE__ */_export_sfc(_sfc_main$V,[["render",_sfc_render$L]]);const _sfc_main$U=defineComponent({name:"FCheckboxGroup",components:{FFieldset},mixins:[TranslationMixin],inheritAttrs:false,props:{/**
269
+ */forceLegendUpdate(){this.legendKey++;},async updateCheckboxChildren(){await this.$nextTick();this.children=Array.from(this.$el.querySelectorAll('input[type="checkbox"]'));}}});const _hoisted_1$H=["id"];const _hoisted_2$v={key:0,class:"sr-only"};const _hoisted_3$r={key:0,class:"label__message label__message--error"};const _hoisted_4$m={key:0,"data-test":"checked-boxes",class:"sr-only","aria-live":"polite"};const _hoisted_5$k={key:0};const _hoisted_6$g={key:1};const _hoisted_7$d={class:"sr-separator"};const _hoisted_8$9={class:"tooltip-before","aria-hidden":"true"};const _hoisted_9$5={class:"label tooltip-before__label"};const _hoisted_10$5={key:0,class:"label__message label__message--error"};function _sfc_render$M(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return openBlock(),createElementBlock("fieldset",{id:_ctx.id,class:normalizeClass(["fieldset",_ctx.classes]),onValidity:_cache[0]||(_cache[0]=(...args)=>_ctx.onValidity&&_ctx.onValidity(...args))},[(openBlock(),createElementBlock("legend",{key:_ctx.legendKey,class:normalizeClass(["label",_ctx.legendClass])},[renderSlot(_ctx.$slots,"label"),createTextVNode(),_ctx.hasCheckbox&&_ctx.children.length>1?(openBlock(),createElementBlock("span",_hoisted_2$v,[createElementVNode("span",null,toDisplayString(_ctx.numberOfCheckboxesScreenReaderText),1/* TEXT */)])):createCommentVNode("v-if",true),createTextVNode(),renderSlot(_ctx.$slots,"description",normalizeProps(guardReactiveProps({descriptionClass:_ctx.descriptionClass,discreteDescriptionClass:_ctx.discreteDescriptionClass}))),createTextVNode(),renderSlot(_ctx.$slots,"error-message",normalizeProps(guardReactiveProps({hasError:_ctx.hasError,validationMessage:_ctx.validity.validationMessage})),()=>[_ctx.hasError?(openBlock(),createElementBlock("span",_hoisted_3$r,[createVNode(_component_f_icon,{class:"label__icon--left",name:"error"}),createTextVNode(" "+toDisplayString(_ctx.validity.validationMessage),1/* TEXT */)])):createCommentVNode("v-if",true)])],2/* CLASS */)),createTextVNode(),_ctx.hasCheckbox?(openBlock(),createElementBlock("span",_hoisted_4$m,[_ctx.children.length===1?(openBlock(),createElementBlock("span",_hoisted_5$k,toDisplayString(_ctx.checkboxCheckedScreenReaderText),1/* TEXT */)):(openBlock(),createElementBlock("span",_hoisted_6$g,toDisplayString(_ctx.numberOfCheckedCheckboxesScreenText),1/* TEXT */))])):createCommentVNode("v-if",true),createTextVNode(),_ctx.hasTooltipSlot?(openBlock(),createElementBlock(Fragment,{key:1},[createElementVNode("div",_hoisted_7$d,[createElementVNode("div",_hoisted_8$9,[createElementVNode("div",_hoisted_9$5,[renderSlot(_ctx.$slots,"label")])]),createTextVNode(),renderSlot(_ctx.$slots,"tooltip")]),createTextVNode(),_ctx.hasDescriptionSlot||_ctx.hasErrorMessageSlot||_ctx.hasError?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(["label",_ctx.groupLabelClass]),"aria-hidden":"true"},[renderSlot(_ctx.$slots,"description",normalizeProps(guardReactiveProps({descriptionClass:_ctx.descriptionClass,discreteDescriptionClass:_ctx.discreteDescriptionClass}))),createTextVNode(),renderSlot(_ctx.$slots,"error-message",normalizeProps(guardReactiveProps({hasError:_ctx.hasError,validationMessage:_ctx.validity.validationMessage})),()=>[_ctx.hasError?(openBlock(),createElementBlock("span",_hoisted_10$5,[createVNode(_component_f_icon,{class:"label__icon--left",name:"error"}),createTextVNode(" "+toDisplayString(_ctx.validity.validationMessage),1/* TEXT */)])):createCommentVNode("v-if",true)])],2/* CLASS */)):createCommentVNode("v-if",true)],64/* STABLE_FRAGMENT */)):createCommentVNode("v-if",true),createTextVNode(),createElementVNode("div",{class:normalizeClass(_ctx.groupContentClass)},[renderSlot(_ctx.$slots,"default")],2/* CLASS */)],42,_hoisted_1$H);}const FFieldset=/* @__PURE__ */_export_sfc(_sfc_main$W,[["render",_sfc_render$M]]);const anyType$1=[String,Object,Array,Number,Date,Boolean];const _sfc_main$V=defineComponent({name:"FCheckboxField",inheritAttrs:false,props:{/**
270
+ * Set to `true`, empty string `""` or string `"disabled"` to disable this input field.
271
+ */disabled:{type:Boolean,required:false,default:false},/**
272
+ * The id for the input id attribute.
273
+ * The id for the label for attribute.
274
+ * If the prop is not set a random value will be generated.
275
+ */id:{type:String,required:false,default:()=>ElementIdService.generateElementId()},/**
276
+ * The value for the input checked attribute.
277
+ * @model
278
+ */// ? The rule is disabled so that the `checked` prop can be undefined or null.
279
+ /* eslint-disable-next-line vue/require-default-prop -- technical debt,
280
+ /* it should contain a default value of undefined and proptype should
281
+ /* include undefined (see comment on line above) */modelValue:{type:anyType$1,required:false},/**
282
+ * The value for the input.
283
+ */value:{type:anyType$1,required:true}},emits:["change","update:modelValue"],setup(){const{showDetails,getFieldsetLabelText}=useFieldset();return{showDetails,getFieldsetLabelText};},data(){return{expanded:false,height:0,initialStyle:{overflow:"hidden",transition:"height 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96)"},hiddenStyle:{height:"auto",position:"absolute",visibility:"hidden"},visibleStyle:{width:"",position:"",visibility:"",height:"0px"},openedStyle:{height:"auto"}};},computed:{attrs(){let checked;if(Array.isArray(this.modelValue)){checked=this.modelValue.findIndex(it=>isEqual$2(toValue(it),toValue(this.value)))>=0;}else{checked=this.value===this.modelValue;}return{...this.$attrs,value:this.value,checked,onChange:event=>{if(event.target instanceof HTMLInputElement){this.emitVModelEvent(event);}},onInput:event=>{event.target.focus();}};},disabledClass(){return this.disabled?"disabled":"";},// eslint-disable-next-line @typescript-eslint/no-explicit-any -- technical debt, nore sure whats going on here
284
+ injected(){return this;}},methods:{updateExpandedFlag(){const checkboxInput=getHTMLElementFromVueRef(this.$refs["checkboxInput"]);this.expanded=checkboxInput.checked;},emitVModelEvent(event){let newModel;if(Array.isArray(this.modelValue)){newModel=[...this.modelValue].filter(it=>!isEqual$2(toValue(it),toValue(this.value)));if(this.modelValue.length<=newModel.length){newModel.push(this.value);}}else{if(this.value===this.modelValue){newModel=typeof this.value==="boolean"?false:void 0;}else{const target=event.target;newModel=target.value==="true"?true:this.value;}}this.$emit("update:modelValue",newModel);this.$emit("change",newModel);},onKeydown(event){event.stopPropagation();},onValidity({detail}){if(detail.target!==this.$el.querySelector("input")){return;}let errorMessage="";if(hasSlot(this,"default")){const labelText=this.injected.getFieldsetLabelText();if(labelText){errorMessage=`${labelText} ${renderSlotText(this.$slots.default)}`;}else{errorMessage=`${renderSlotText(this.$slots.default)}`;}}const element=this.$el.querySelector(`#${detail.elementId}`);if(element){dispatchComponentValidityEvent(element,{...detail,errorMessage,focusElementId:detail.elementId});}},enter(element){const htmlElement=getHTMLElementFromVueRef(element);const computedStyle=getComputedStyle(element);Object.assign(htmlElement.style,this.initialStyle);Object.assign(htmlElement.style,this.hiddenStyle);htmlElement.style.width=computedStyle.width;const height=computedStyle.height;Object.assign(htmlElement.style,this.visibleStyle);getComputedStyle(element).height;setTimeout(()=>{this.height=parseInt(height,10);htmlElement.style.height=height;});},afterEnter(element){const htmlElement=getHTMLElementFromVueRef(element);Object.assign(htmlElement.style,this.openedStyle);},leave(element){const htmlElement=getHTMLElementFromVueRef(element);const height=getComputedStyle(element).height;htmlElement.style.height=height;getComputedStyle(element).height;setTimeout(()=>{Object.assign(htmlElement.style,this.visibleStyle);});}}});const _hoisted_1$G=["id","disabled"];const _hoisted_2$u=["for"];const _hoisted_3$q={key:0,class:"checkbox__details"};const _hoisted_4$l=/* @__PURE__ */createElementVNode("br",null,null,-1/* HOISTED */);const _hoisted_5$j={key:0,class:"checkbox__details"};const _hoisted_6$f=/* @__PURE__ */createElementVNode("br",null,null,-1/* HOISTED */);function _sfc_render$L(_ctx,_cache,$props,$setup,$data,$options){return openBlock(),createElementBlock("div",{class:normalizeClass(["checkbox",_ctx.disabledClass]),onValidity:_cache[2]||(_cache[2]=(...args)=>_ctx.onValidity&&_ctx.onValidity(...args))},[createElementVNode("input",mergeProps({id:_ctx.id},_ctx.attrs,{ref:"checkboxInput",type:"checkbox",class:"checkbox__input",disabled:_ctx.disabled,onKeydown:_cache[0]||(_cache[0]=withKeys((...args)=>_ctx.onKeydown&&_ctx.onKeydown(...args),["space"])),onChange:_cache[1]||(_cache[1]=$event=>_ctx.updateExpandedFlag())}),null,16,_hoisted_1$G),createTextVNode(),createElementVNode("label",{class:normalizeClass(_ctx.$slots.details?"checkbox__label checkbox__width":"checkbox__label"),for:_ctx.id},[renderSlot(_ctx.$slots,"default"),createTextVNode(),_ctx.$slots.details?(openBlock(),createElementBlock(Fragment,{key:0},[_ctx.showDetails==="always"?(openBlock(),createElementBlock("span",_hoisted_3$q,[_hoisted_4$l,createTextVNode(),renderSlot(_ctx.$slots,"details")])):createCommentVNode("v-if",true),createTextVNode(),_ctx.showDetails==="when-selected"?(openBlock(),createBlock(Transition,{key:1,onEnter:_ctx.enter,onAfterEnter:_ctx.afterEnter,onLeave:_ctx.leave},{default:withCtx(()=>[_ctx.expanded?(openBlock(),createElementBlock("span",_hoisted_5$j,[_hoisted_6$f,createTextVNode(),renderSlot(_ctx.$slots,"details",{height:_ctx.height})])):createCommentVNode("v-if",true)]),_:3/* FORWARDED */},8,["onEnter","onAfterEnter","onLeave"])):createCommentVNode("v-if",true)],64/* STABLE_FRAGMENT */)):createCommentVNode("v-if",true)],10,_hoisted_2$u)],34/* CLASS, NEED_HYDRATION */);}const FCheckboxField=/* @__PURE__ */_export_sfc(_sfc_main$V,[["render",_sfc_render$L]]);const _sfc_main$U=defineComponent({name:"FCheckboxGroup",components:{FFieldset},mixins:[TranslationMixin],inheritAttrs:false,props:{/**
285
285
  * The id for the fieldset id attribute.
286
286
  * If the prop is not set the id will be generated.
287
287
  */id:{type:String,required:false,default:()=>ElementIdService.generateElementId()},/**
@@ -309,7 +309,7 @@ injected(){return this;}},methods:{updateExpandedFlag(){const checkboxInput=getH
309
309
  * Property for changing the "modify" modal heading
310
310
  */modifyModalHeader:{type:String,required:false,default:TranslationService.provider.translate("fkui.crud-dataset.modal.header.modify","Ändra rad")},/**
311
311
  * Property for changing the "delete" modal heading
312
- */deleteModalHeader:{type:String,required:false,default:TranslationService.provider.translate("fkui.crud-dataset.modal.header.delete","Är du säker på att du vill ta bort raden?")}},emits:["change","created","deleted","updated","update:modelValue"],data(){return{result:[],Operation,operation:Operation.NONE,item:null,originalItemToUpdate:null,isFormModalOpen:false,isConfirmModalOpen:false,callbackAfterItemAdd(){},callbackBeforeItemDelete(){}};},computed:{confirmButtonText(){return this.operation===Operation.ADD?this.$t("fkui.crud-dataset.modal.confirm.add","Lägg till"):this.$t("fkui.crud-dataset.modal.confirm.modify","Spara");},cancelButtonText(){return this.operation===Operation.ADD?this.$t("fkui.crud-dataset.modal.cancel.add","Avbryt"):this.$t("fkui.crud-dataset.modal.cancel.modify","Avbryt");},confirmDeleteButtons(){return[{label:this.$t("fkui.crud-dataset.modal.confirm.delete","Ja, ta bort"),type:"primary",event:"confirm"},{label:this.$t("fkui.crud-dataset.modal.cancel.delete","Nej, avbryt"),type:"secondary"}];},hasAddSlot(){return Boolean(this.$slots.add);},hasDeleteSlot(){return Boolean(this.$slots.delete);},hasModifySlot(){return Boolean(this.$slots.modify);},formModalHeader(){return this.operation===Operation.ADD?this.addNewModalHeader:this.modifyModalHeader;}},watch:{modelValue:{immediate:true,deep:true,handler(data){this.result=[...data];}}},mounted(){if(!this.hasAddSlot&&!this.hasDeleteSlot&&!this.hasModifySlot){throw Error("Atleast one template of the following must be defined. #add, #delete or #modify");}},methods:{createItem(){if(!this.hasAddSlot){throw Error("No template is defined for #add");}this.operation=Operation.ADD;this.item=this.beforeCreate?this.beforeCreate():{};this.isFormModalOpen=true;},deleteItem(item){if(!this.hasDeleteSlot){throw Error("No template is defined for #delete");}this.operation=Operation.DELETE;this.item=item;this.isConfirmModalOpen=true;},onDeleteConfirm(){if(!this.item){return;}this.callbackBeforeItemDelete(this.item);this.result=this.result.filter(item=>item!==this.item);this.$emit("deleted",this.item);this.$emit("update:modelValue",this.result);this.$emit("change",this.result);alertScreenReader(this.$t("fkui.crud-dataset.aria-live.delete","Raden har tagits bort"),{assertive:true});},onDeleteClose(e){this.onModalClose();if(e.reason==="close"&&this.onCancel){this.onCancel();}},onModalClose(){this.isFormModalOpen=false;this.isConfirmModalOpen=false;},onFormModalSubmit(){if(!this.item){return;}if(this.operation===Operation.ADD){this.result.push(this.item);this.$emit("created",this.item);this.$emit("update:modelValue",this.result);this.$emit("change",this.result);this.callbackAfterItemAdd(this.item);alertScreenReader(this.$t("fkui.crud-dataset.aria-live.add","En rad har lagts till"),{assertive:true});}else if(this.operation===Operation.MODIFY){if(this.originalItemToUpdate){Object.assign(this.originalItemToUpdate,this.item);}else{this.originalItemToUpdate=this.item;}this.$emit("updated",this.originalItemToUpdate);this.$emit("update:modelValue",this.result);this.$emit("change",this.result);alertScreenReader(this.$t("fkui.crud-dataset.aria-live.modify","Raden har ändrats"),{assertive:true});}this.isFormModalOpen=false;},updateItem(item){if(!this.hasModifySlot){throw Error("No template is defined for #modify");}this.operation=Operation.MODIFY;this.originalItemToUpdate=item;this.item=deepClone(item);this.isFormModalOpen=true;}}});const _hoisted_1$F={class:"crud-dataset"};const _hoisted_2$t={key:0};function _sfc_render$J(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");const _component_f_form_modal=resolveComponent("f-form-modal");const _component_f_confirm_modal=resolveComponent("f-confirm-modal");return openBlock(),createElementBlock("div",_hoisted_1$F,[renderSlot(_ctx.$slots,"default"),createTextVNode(),_ctx.hasAddSlot?(openBlock(),createElementBlock("div",_hoisted_2$t,[createElementVNode("button",{"data-test":"f-crud-dataset-add-button",type:"button",class:"button button--discrete crud-dataset__add-button",onClick:_cache[0]||(_cache[0]=$event=>_ctx.createItem())},[createVNode(_component_f_icon,{class:"button__icon",name:"plus"}),createTextVNode(),renderSlot(_ctx.$slots,"add-button",{},()=>[createTextVNode(toDisplayString(_ctx.$t("fkui.crud-dataset.button.add","Lägg till ny")),1/* TEXT */)])])])):createCommentVNode("v-if",true),createTextVNode(),createVNode(_component_f_form_modal,{"is-open":_ctx.isFormModalOpen,"aria-close-text":_ctx.$t("fkui.crud-dataset.modal.close","Stäng"),"use-error-list":false,"before-submit":_ctx.beforeSubmit,"before-validation":_ctx.beforeValidation,"on-cancel":_ctx.onCancel,onClose:_ctx.onModalClose,onCancel:_ctx.onCancel,onSubmit:_ctx.onFormModalSubmit},{header:withCtx(()=>[createTextVNode(toDisplayString(_ctx.formModalHeader),1/* TEXT */)]),"input-text-fields":withCtx(()=>[_ctx.operation===_ctx.Operation.ADD?renderSlot(_ctx.$slots,"add",normalizeProps(mergeProps({key:0},{item:_ctx.item}))):createCommentVNode("v-if",true),createTextVNode(),_ctx.operation===_ctx.Operation.MODIFY?renderSlot(_ctx.$slots,"modify",normalizeProps(mergeProps({key:1},{item:_ctx.item}))):createCommentVNode("v-if",true)]),"submit-button-text":withCtx(()=>[createTextVNode(toDisplayString(_ctx.confirmButtonText),1/* TEXT */)]),"cancel-button-text":withCtx(()=>[createTextVNode(toDisplayString(_ctx.cancelButtonText),1/* TEXT */)]),_:3/* FORWARDED */},8,["is-open","aria-close-text","before-submit","before-validation","on-cancel","onClose","onCancel","onSubmit"]),createTextVNode(),createVNode(_component_f_confirm_modal,{"is-open":_ctx.isConfirmModalOpen,buttons:_ctx.confirmDeleteButtons,onConfirm:_ctx.onDeleteConfirm,onClose:_ctx.onDeleteClose},{heading:withCtx(()=>[createTextVNode(toDisplayString(_ctx.deleteModalHeader),1/* TEXT */)]),content:withCtx(()=>[renderSlot(_ctx.$slots,"delete",normalizeProps(guardReactiveProps({item:_ctx.item})))]),_:3/* FORWARDED */},8,["is-open","buttons","onConfirm","onClose"])]);}const FCrudDataset=/* @__PURE__ */_export_sfc(_sfc_main$T,[["render",_sfc_render$J]]);function FCrudDatasetInjected(){return{delete:inject("delete"),modify:inject("modify")};}const _sfc_main$S=defineComponent({name:"FCrudButton",components:{FIcon},mixins:[TranslationMixin],props:{action:{type:String,required:true,validator(value){return["delete","modify"].includes(value);}},icon:{type:Boolean,default:false},item:{type:Object,required:true},label:{type:Boolean,default:false}},setup(){return FCrudDatasetInjected();},computed:{iconName(){if(this.action==="delete"){return"trashcan";}else{return"pen";}},buttonText(){if(this.action==="delete"){return this.$t("fkui.crud-button.delete","Ta bort");}else{return this.$t("fkui.crud-button.modify","Ändra");}}},methods:{executeAction(){if(this.action==="delete"){this.delete(this.item);}else{this.modify(this.item);}}}});const _hoisted_1$E={key:1,class:"sr-only"};function _sfc_render$I(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return openBlock(),createElementBlock("button",{type:"button",class:"button button--discrete",onClick:_cache[0]||(_cache[0]=(...args)=>_ctx.executeAction&&_ctx.executeAction(...args))},[_ctx.icon?(openBlock(),createBlock(_component_f_icon,{key:0,class:"button__icon",name:_ctx.iconName},null,8,["name"])):createCommentVNode("v-if",true),createTextVNode(),!_ctx.label?(openBlock(),createElementBlock("span",_hoisted_1$E,[renderSlot(_ctx.$slots,"default",{},()=>[createTextVNode(toDisplayString(_ctx.buttonText),1/* TEXT */)])])):createCommentVNode("v-if",true),createTextVNode(),_ctx.label?renderSlot(_ctx.$slots,"default",{key:2},()=>[createTextVNode(toDisplayString(_ctx.buttonText),1/* TEXT */)]):createCommentVNode("v-if",true)]);}const FCrudButton=/* @__PURE__ */_export_sfc(_sfc_main$S,[["render",_sfc_render$I]]);function ActivateItemInjected(){return{registerCallbackAfterItemAdd:inject("registerCallbackAfterItemAdd",()=>void 0),registerCallbackBeforeItemDelete:inject("registerCallbackBeforeItemDelete",()=>void 0)};}var FTableColumnType=/* @__PURE__ */(FTableColumnType2=>{FTableColumnType2["TEXT"]="text";FTableColumnType2["DATE"]="date";FTableColumnType2["NUMERIC"]="numeric";FTableColumnType2["ACTION"]="action";return FTableColumnType2;})(FTableColumnType||{});var FTableColumnSize=/* @__PURE__ */(FTableColumnSize2=>{FTableColumnSize2["EXPAND"]="table__column--expand";FTableColumnSize2["SHRINK"]="table__column--shrink";return FTableColumnSize2;})(FTableColumnSize||{});var FTableColumnSort=/* @__PURE__ */(FTableColumnSort2=>{FTableColumnSort2["UNSORTED"]="unsorted";FTableColumnSort2["ASCENDING"]="ascending";FTableColumnSort2["DESCENDING"]="descending";return FTableColumnSort2;})(FTableColumnSort||{});function addColumn(src,column){if(!src.some(col=>col.name===column.name)){return[...src,column];}return src;}function setVisibilityColumn(src,id,visible){const column=src.find(col=>col.name===id);if(column){column.visible=visible;}}function updateSortOrder(src,columnName,ascending){src.forEach(column=>{if(column.name===columnName){column.sort=ascending?"ascending":"descending";}else{column.sort="unsorted";}});}function setSortableColumns(src,columnNames){for(const columnName of columnNames){const foundColumn=src.find(col=>col.name===columnName);if(foundColumn){foundColumn.sortable=true;}}}function getSortableIconName(column){switch(column.sort){case"unsorted":return"sort";case"ascending":return"caret-up";case"descending":return"caret-down";default:return"";}}function getSortableIconClasses(column){const classes=["table__column__header__icon"];if(column.sort==="unsorted"){classes.push("table__column__header__icon--discrete");}return classes;}function isTableColumnType(value){return["text","date","numeric","action"].includes(value);}function FTableInjected(){return{addColumn:inject("addColumn"),setVisibilityColumn:inject("setVisibilityColumn"),textFieldTableMode:true};}const _sfc_main$R=defineComponent({name:"FTableColumn",inheritAttrs:false,props:{/**
312
+ */deleteModalHeader:{type:String,required:false,default:TranslationService.provider.translate("fkui.crud-dataset.modal.header.delete","Är du säker på att du vill ta bort raden?")}},emits:["change","created","deleted","updated","update:modelValue"],data(){return{result:[],Operation,operation:Operation.NONE,item:null,originalItemToUpdate:null,isFormModalOpen:false,isConfirmModalOpen:false,callbackAfterItemAdd(){},callbackBeforeItemDelete(){}};},computed:{confirmButtonText(){return this.operation===Operation.ADD?this.$t("fkui.crud-dataset.modal.confirm.add","Lägg till"):this.$t("fkui.crud-dataset.modal.confirm.modify","Spara");},cancelButtonText(){return this.operation===Operation.ADD?this.$t("fkui.crud-dataset.modal.cancel.add","Avbryt"):this.$t("fkui.crud-dataset.modal.cancel.modify","Avbryt");},confirmDeleteButtons(){return[{label:this.$t("fkui.crud-dataset.modal.confirm.delete","Ja, ta bort"),type:"primary",event:"confirm"},{label:this.$t("fkui.crud-dataset.modal.cancel.delete","Nej, avbryt"),type:"secondary"}];},hasAddSlot(){return Boolean(this.$slots.add);},hasDeleteSlot(){return Boolean(this.$slots.delete);},hasModifySlot(){return Boolean(this.$slots.modify);},formModalHeader(){return this.operation===Operation.ADD?this.addNewModalHeader:this.modifyModalHeader;}},watch:{modelValue:{immediate:true,deep:true,handler(data){this.result=[...data];}}},mounted(){if(!this.hasAddSlot&&!this.hasDeleteSlot&&!this.hasModifySlot){throw Error("Atleast one template of the following must be defined. #add, #delete or #modify");}},methods:{createItem(){if(!this.hasAddSlot){throw Error("No template is defined for #add");}this.operation=Operation.ADD;this.item=this.beforeCreate?this.beforeCreate():{};this.isFormModalOpen=true;},deleteItem(item){if(!this.hasDeleteSlot){throw Error("No template is defined for #delete");}this.operation=Operation.DELETE;this.item=item;this.isConfirmModalOpen=true;},onDeleteConfirm(){if(!this.item){return;}this.callbackBeforeItemDelete(this.item);this.result=this.result.filter(item=>item!==this.item);this.$emit("deleted",this.item);this.$emit("update:modelValue",this.result);this.$emit("change",this.result);alertScreenReader(this.$t("fkui.crud-dataset.aria-live.delete","Raden har tagits bort"),{assertive:true});},onDeleteClose(e){this.onModalClose();if(e.reason==="close"&&this.onCancel){this.onCancel();}},onModalClose(){this.isFormModalOpen=false;this.isConfirmModalOpen=false;},onFormModalSubmit(){if(!this.item){return;}if(this.operation===Operation.ADD){this.result.push(this.item);this.$emit("created",this.item);this.$emit("update:modelValue",this.result);this.$emit("change",this.result);this.callbackAfterItemAdd(this.item);alertScreenReader(this.$t("fkui.crud-dataset.aria-live.add","En rad har lagts till"),{assertive:true});}else if(this.operation===Operation.MODIFY){if(this.originalItemToUpdate){Object.assign(this.originalItemToUpdate,this.item);}else{this.originalItemToUpdate=this.item;}this.$emit("updated",this.originalItemToUpdate);this.$emit("update:modelValue",this.result);this.$emit("change",this.result);alertScreenReader(this.$t("fkui.crud-dataset.aria-live.modify","Raden har ändrats"),{assertive:true});}this.isFormModalOpen=false;},updateItem(item){if(!this.hasModifySlot){throw Error("No template is defined for #modify");}this.operation=Operation.MODIFY;this.originalItemToUpdate=item;this.item=deepClone(item);this.isFormModalOpen=true;}}});const _hoisted_1$F={class:"crud-dataset"};const _hoisted_2$t={key:0};function _sfc_render$J(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");const _component_f_form_modal=resolveComponent("f-form-modal");const _component_f_confirm_modal=resolveComponent("f-confirm-modal");return openBlock(),createElementBlock("div",_hoisted_1$F,[renderSlot(_ctx.$slots,"default"),createTextVNode(),_ctx.hasAddSlot?(openBlock(),createElementBlock("div",_hoisted_2$t,[createElementVNode("button",{"data-test":"f-crud-dataset-add-button",type:"button",class:"button button--tertiary crud-dataset__add-button",onClick:_cache[0]||(_cache[0]=$event=>_ctx.createItem())},[createVNode(_component_f_icon,{class:"button__icon",name:"plus"}),createTextVNode(),renderSlot(_ctx.$slots,"add-button",{},()=>[createTextVNode(toDisplayString(_ctx.$t("fkui.crud-dataset.button.add","Lägg till ny")),1/* TEXT */)])])])):createCommentVNode("v-if",true),createTextVNode(),createVNode(_component_f_form_modal,{"is-open":_ctx.isFormModalOpen,"aria-close-text":_ctx.$t("fkui.crud-dataset.modal.close","Stäng"),"use-error-list":false,"before-submit":_ctx.beforeSubmit,"before-validation":_ctx.beforeValidation,"on-cancel":_ctx.onCancel,onClose:_ctx.onModalClose,onCancel:_ctx.onCancel,onSubmit:_ctx.onFormModalSubmit},{header:withCtx(()=>[createTextVNode(toDisplayString(_ctx.formModalHeader),1/* TEXT */)]),"input-text-fields":withCtx(()=>[_ctx.operation===_ctx.Operation.ADD?renderSlot(_ctx.$slots,"add",normalizeProps(mergeProps({key:0},{item:_ctx.item}))):createCommentVNode("v-if",true),createTextVNode(),_ctx.operation===_ctx.Operation.MODIFY?renderSlot(_ctx.$slots,"modify",normalizeProps(mergeProps({key:1},{item:_ctx.item}))):createCommentVNode("v-if",true)]),"submit-button-text":withCtx(()=>[createTextVNode(toDisplayString(_ctx.confirmButtonText),1/* TEXT */)]),"cancel-button-text":withCtx(()=>[createTextVNode(toDisplayString(_ctx.cancelButtonText),1/* TEXT */)]),_:3/* FORWARDED */},8,["is-open","aria-close-text","before-submit","before-validation","on-cancel","onClose","onCancel","onSubmit"]),createTextVNode(),createVNode(_component_f_confirm_modal,{"is-open":_ctx.isConfirmModalOpen,buttons:_ctx.confirmDeleteButtons,onConfirm:_ctx.onDeleteConfirm,onClose:_ctx.onDeleteClose},{heading:withCtx(()=>[createTextVNode(toDisplayString(_ctx.deleteModalHeader),1/* TEXT */)]),content:withCtx(()=>[renderSlot(_ctx.$slots,"delete",normalizeProps(guardReactiveProps({item:_ctx.item})))]),_:3/* FORWARDED */},8,["is-open","buttons","onConfirm","onClose"])]);}const FCrudDataset=/* @__PURE__ */_export_sfc(_sfc_main$T,[["render",_sfc_render$J]]);function FCrudDatasetInjected(){return{delete:inject("delete"),modify:inject("modify")};}const _sfc_main$S=defineComponent({name:"FCrudButton",components:{FIcon},mixins:[TranslationMixin],props:{action:{type:String,required:true,validator(value){return["delete","modify"].includes(value);}},icon:{type:Boolean,default:false},item:{type:Object,required:true},label:{type:Boolean,default:false}},setup(){return FCrudDatasetInjected();},computed:{iconName(){if(this.action==="delete"){return"trashcan";}else{return"pen";}},buttonText(){if(this.action==="delete"){return this.$t("fkui.crud-button.delete","Ta bort");}else{return this.$t("fkui.crud-button.modify","Ändra");}}},methods:{executeAction(){if(this.action==="delete"){this.delete(this.item);}else{this.modify(this.item);}}}});const _hoisted_1$E={key:1,class:"sr-only"};function _sfc_render$I(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return openBlock(),createElementBlock("button",{type:"button",class:"button button--small button--tertiary",onClick:_cache[0]||(_cache[0]=(...args)=>_ctx.executeAction&&_ctx.executeAction(...args))},[_ctx.icon?(openBlock(),createBlock(_component_f_icon,{key:0,class:"button__icon",name:_ctx.iconName},null,8,["name"])):createCommentVNode("v-if",true),createTextVNode(),!_ctx.label?(openBlock(),createElementBlock("span",_hoisted_1$E,[renderSlot(_ctx.$slots,"default",{},()=>[createTextVNode(toDisplayString(_ctx.buttonText),1/* TEXT */)])])):createCommentVNode("v-if",true),createTextVNode(),_ctx.label?renderSlot(_ctx.$slots,"default",{key:2},()=>[createTextVNode(toDisplayString(_ctx.buttonText),1/* TEXT */)]):createCommentVNode("v-if",true)]);}const FCrudButton=/* @__PURE__ */_export_sfc(_sfc_main$S,[["render",_sfc_render$I]]);function ActivateItemInjected(){return{registerCallbackAfterItemAdd:inject("registerCallbackAfterItemAdd",()=>void 0),registerCallbackBeforeItemDelete:inject("registerCallbackBeforeItemDelete",()=>void 0)};}var FTableColumnType=/* @__PURE__ */(FTableColumnType2=>{FTableColumnType2["TEXT"]="text";FTableColumnType2["DATE"]="date";FTableColumnType2["NUMERIC"]="numeric";FTableColumnType2["ACTION"]="action";return FTableColumnType2;})(FTableColumnType||{});var FTableColumnSize=/* @__PURE__ */(FTableColumnSize2=>{FTableColumnSize2["EXPAND"]="table__column--expand";FTableColumnSize2["SHRINK"]="table__column--shrink";return FTableColumnSize2;})(FTableColumnSize||{});var FTableColumnSort=/* @__PURE__ */(FTableColumnSort2=>{FTableColumnSort2["UNSORTED"]="unsorted";FTableColumnSort2["ASCENDING"]="ascending";FTableColumnSort2["DESCENDING"]="descending";return FTableColumnSort2;})(FTableColumnSort||{});function addColumn(src,column){if(!src.some(col=>col.name===column.name)){return[...src,column];}return src;}function setVisibilityColumn(src,id,visible){const column=src.find(col=>col.name===id);if(column){column.visible=visible;}}function updateSortOrder(src,columnName,ascending){src.forEach(column=>{if(column.name===columnName){column.sort=ascending?"ascending":"descending";}else{column.sort="unsorted";}});}function setSortableColumns(src,columnNames){for(const columnName of columnNames){const foundColumn=src.find(col=>col.name===columnName);if(foundColumn){foundColumn.sortable=true;}}}function getSortableIconName(column){switch(column.sort){case"unsorted":return"sort";case"ascending":return"caret-up";case"descending":return"caret-down";default:return"";}}function getSortableIconClasses(column){const classes=["table__column__header__icon"];if(column.sort==="unsorted"){classes.push("table__column__header__icon--discrete");}return classes;}function isTableColumnType(value){return["text","date","numeric","action"].includes(value);}function FTableInjected(){return{addColumn:inject("addColumn"),setVisibilityColumn:inject("setVisibilityColumn"),textFieldTableMode:true};}const _sfc_main$R=defineComponent({name:"FTableColumn",inheritAttrs:false,props:{/**
313
313
  * Unique (per-table) identifier.
314
314
  *
315
315
  * Typically set to the row property displayed but any unique string can
@@ -445,7 +445,8 @@ defaultText:"",descriptionText:"",descriptionScreenReaderText:"",discreteDescrip
445
445
  * @model
446
446
  */decimals:{type:Number,required:false,default:void 0},formatter:{type:Function,required:false,default:defaultFormatter$1},parser:{type:Function,required:false,default:parseNumber}},setup(){return{textFieldTableMode:inject("textFieldTableMode",false)};},mounted(){const inputElement=getInputElement(this);inputElement.setAttribute("inputmode","numeric");inputElement.setAttribute("maxlength","20");ValidationService.addValidatorsToElement(inputElement,{number:{}},true);ValidationService.validateElement(inputElement);}});const _sfc_main$E=defineComponent({name:"FPersonnummerTextField",extends:FTextField,mixins:[TranslationMixin],props:{formatter:{type:Function,required:false,default:formatPersonnummer},parser:{type:Function,required:false,default:parsePersonnummer}},setup(){return{textFieldTableMode:inject("textFieldTableMode",false)};},data(){return{defaultText:this.$t("fkui.personnummer-text-field.label-10-digits","Personnummer"),discreteDescriptionText:this.$t("fkui.personnummer-text-field.example-10-digits","(ååmmdd-nnnn)"),discreteDescriptionScreenReaderText:this.$t("fkui.personnummer-text-field.format-description-10-digits","Skriv personnumret med 10 siffror,")};},mounted(){const inputElement=getInputElement(this);ValidationService.addValidatorsToElement(inputElement,{maxLength:{length:20},personnummerFormat:{},personnummerLuhn:{}},true);inputElement.setAttribute("inputmode","numeric");inputElement.setAttribute("maxlength","23");ValidationService.validateElement(inputElement);}});const _sfc_main$D=defineComponent({name:"FPlusgiroTextField",extends:FTextField,mixins:[TranslationMixin],props:{formatter:{type:Function,required:false,default:parsePlusgiro}},setup(){return{textFieldTableMode:inject("textFieldTableMode",false)};},data(){return{defaultText:this.$t("fkui.plusgiro-text-field.label","Plusgironummer")};},mounted(){const inputElement=getInputElement(this);ValidationService.addValidatorsToElement(inputElement,{maxLength:{length:11},plusgiro:{}},true);inputElement.setAttribute("inputmode","numeric");inputElement.setAttribute("maxlength","16");ValidationService.validateElement(inputElement);}});const _sfc_main$C=defineComponent({name:"FPostalCodeTextField",extends:FTextField,mixins:[TranslationMixin],props:{formatter:{type:Function,required:false,default:formatPostalCode}},setup(){return{textFieldTableMode:inject("textFieldTableMode",false)};},data(){return{defaultText:this.$t("fkui.postal-code-text-field.label","Postnummer"),discreteDescriptionText:this.$t("fkui.postal-code-text-field.example","(123 45)"),discreteDescriptionScreenReaderText:this.$t("fkui.postal-code-text-field.format-description","Formatbeskrivning")};},mounted(){const inputElement=getInputElement(this);ValidationService.addValidatorsToElement(inputElement,{maxLength:{length:13},postalCode:{}},true);inputElement.setAttribute("inputmode","numeric");inputElement.setAttribute("maxlength","15");ValidationService.validateElement(inputElement);}});function defaultFormatter(modelValue){return formatPercent(modelValue,this.decimals);}const _sfc_main$B=defineComponent({name:"FPercentTextField",extends:FTextField,mixins:[TranslationMixin],props:{/**
447
447
  * The number of decimals to format number as.
448
- */decimals:{type:Number,required:false,default:void 0},formatter:{type:Function,required:false,default:defaultFormatter},parser:{type:Function,required:false,default:parsePercent}},setup(){return{textFieldTableMode:inject("textFieldTableMode",false)};},data(){return{defaultText:this.$t("fkui.percent-text-field.label","Procent")};},mounted(){const inputElement=getInputElement(this);inputElement.setAttribute("inputmode",this.decimals?"decimal":"numeric");inputElement.setAttribute("maxlength","10");ValidationService.addValidatorsToElement(inputElement,{percent:{},minValue:{minValue:0},maxValue:{maxValue:999}},true);ValidationService.validateElement(inputElement);}});const _sfc_main$A=defineComponent({name:"FOrganisationsnummerTextField",extends:FTextField,mixins:[TranslationMixin],props:{formatter:{type:Function,required:false,default:parseOrganisationsnummer}},setup(){return{textFieldTableMode:inject("textFieldTableMode",false)};},data(){return{defaultText:this.$t("fkui.organisationsnummer-text-field.label","Organisationsnummer"),discreteDescriptionText:this.$t("fkui.organisationsnummer-text-field.example","(999999-9999)"),discreteDescriptionScreenReaderText:this.$t("fkui.organisationsnummer-text-field.format-description","Formatbeskrivning")};},mounted(){const inputElement=getInputElement(this);ValidationService.addValidatorsToElement(inputElement,{maxLength:{length:11},organisationsnummer:{}},true);inputElement.setAttribute("inputmode","numeric");inputElement.setAttribute("maxlength","20");ValidationService.validateElement(inputElement);}});function sort(list,sortAttribute,ascending){return list.sort((item1,item2)=>compare(item1,item2,sortAttribute,ascending));}function compare(item1,item2,attribute,ascending){const value1=item1[attribute];const value2=item2[attribute];if(!isSet(value1)||!isSet(value2)){return nullCompare(value1,value2);}if(typeof value1==="string"&&typeof value2==="string"){return fixOrder(value1.localeCompare(value2),ascending);}if(typeof value1==="number"&&typeof value2==="number"){return fixOrder(numberCompare(value1,value2),ascending);}if(typeof value1==="boolean"&&typeof value2==="boolean"){return fixOrder(booleanCompare(value1,value2),ascending);}if(typeof value1!==typeof value2){throw Error(`Sorting is not supported for rows containing different types (attribute '${attribute.toString()}')`);}throw Error(`Sorting is only supported for types number, string and boolean (attribute '${attribute.toString()}')`);}function fixOrder(order,ascending){return ascending?order:order-order*2;}function booleanCompare(value1,value2){if(value1===value2){return 0;}else if(value1>value2){return 1;}return-1;}function numberCompare(value1,value2){return value1-value2;}function nullCompare(value1,value2){if(!isSet(value1)&&!isSet(value2)){return 0;}else if(!isSet(value1)){return 1;}return-1;}function includesAllSearchTerms(item,filterAttributes,searchTerms){const values=filterAttributes.map(it=>{const value=item[it];return isSet(value)?value.toString().toLocaleLowerCase():void 0;}).filter(Boolean);for(const searchTerm of searchTerms){const match=values.find(it=>it==null?void 0:it.includes(searchTerm));if(!match){return false;}}return true;}function filter(list,filterAttributes,searchString){searchString=searchString.trim();if(searchString.trim()===""){return list;}const searchTerms=searchString.split(/\s+/).map(word=>word.toLocaleLowerCase());return list.filter(item=>includesAllSearchTerms(item,filterAttributes,searchTerms));}const _sfc_main$z=defineComponent({name:"FSortFilterDataset",components:{FSelectField,FTextField,FIcon,IFlex,IFlexItem},mixins:[TranslationMixin],provide(){return{sort:(attribute,ascending)=>{const foundAttribute=this.sortOrders.find(item=>item.attribute===attribute&&item.ascending===ascending);if(foundAttribute){this.sortAttribute=foundAttribute;}else{this.sortAttribute={attribute:"",ascending:false};}this.sortFilterData();this.$emit("usedSortAttributes",this.sortAttribute);},registerCallbackOnSort:callback=>{this.tableCallbackOnSort=callback;},registerCallbackOnMount:callback=>{this.tableCallbackSortableColumns=callback;}};},props:{/**
448
+ */decimals:{type:Number,required:false,default:void 0},formatter:{type:Function,required:false,default:defaultFormatter},parser:{type:Function,required:false,default:parsePercent}},setup(){return{textFieldTableMode:inject("textFieldTableMode",false)};},data(){return{defaultText:this.$t("fkui.percent-text-field.label","Procent")};},mounted(){const inputElement=getInputElement(this);inputElement.setAttribute("inputmode",this.decimals?"decimal":"numeric");inputElement.setAttribute("maxlength","10");ValidationService.addValidatorsToElement(inputElement,{percent:{},minValue:{minValue:0},maxValue:{maxValue:999}},true);ValidationService.validateElement(inputElement);}});const _sfc_main$A=defineComponent({name:"FOrganisationsnummerTextField",extends:FTextField,mixins:[TranslationMixin],props:{formatter:{type:Function,required:false,default:parseOrganisationsnummer}},setup(){return{textFieldTableMode:inject("textFieldTableMode",false)};},data(){return{defaultText:this.$t("fkui.organisationsnummer-text-field.label","Organisationsnummer"),discreteDescriptionText:this.$t("fkui.organisationsnummer-text-field.example","(999999-9999)"),discreteDescriptionScreenReaderText:this.$t("fkui.organisationsnummer-text-field.format-description","Formatbeskrivning")};},mounted(){const inputElement=getInputElement(this);ValidationService.addValidatorsToElement(inputElement,{maxLength:{length:11},organisationsnummer:{}},true);inputElement.setAttribute("inputmode","numeric");inputElement.setAttribute("maxlength","20");ValidationService.validateElement(inputElement);}});function sort(list,sortAttribute,ascending){return list.sort((item1,item2)=>compare(item1,item2,sortAttribute,ascending));}function compare(item1,item2,attribute,ascending){const value1=item1[attribute];const value2=item2[attribute];if(!isSet(value1)||!isSet(value2)){return nullCompare(value1,value2);}if(!isSupportedType(value1)||!isSupportedType(value2)){throw Error(`Sorting is only supported for types number, string and boolean.
449
+ Attribute '${attribute.toString()}' comparsion of types '${typeof value1}' and '${typeof value2}' is not supported.`);}if(typeof value1==="string"&&typeof value2==="string"){return fixOrder(value1.localeCompare(value2),ascending);}if(typeof value1==="number"&&typeof value2==="number"){return fixOrder(numberCompare(value1,value2),ascending);}if(typeof value1==="boolean"&&typeof value2==="boolean"){return fixOrder(booleanCompare(value1,value2),ascending);}if(typeof value1==="string"){return-1;}else{return 1;}}function isSupportedType(value){return["string","number","boolean"].includes(typeof value);}function fixOrder(order,ascending){return ascending?order:order-order*2;}function booleanCompare(value1,value2){if(value1===value2){return 0;}else if(value1>value2){return 1;}return-1;}function numberCompare(value1,value2){return value1-value2;}function nullCompare(value1,value2){if(!isSet(value1)&&!isSet(value2)){return 0;}else if(!isSet(value1)){return 1;}return-1;}function includesAllSearchTerms(item,filterAttributes,searchTerms){const values=filterAttributes.map(it=>{const value=item[it];return isSet(value)?value.toString().toLocaleLowerCase():void 0;}).filter(Boolean);for(const searchTerm of searchTerms){const match=values.find(it=>it==null?void 0:it.includes(searchTerm));if(!match){return false;}}return true;}function filter(list,filterAttributes,searchString){searchString=searchString.trim();if(searchString.trim()===""){return list;}const searchTerms=searchString.split(/\s+/).map(word=>word.toLocaleLowerCase());return list.filter(item=>includesAllSearchTerms(item,filterAttributes,searchTerms));}const _sfc_main$z=defineComponent({name:"FSortFilterDataset",components:{FSelectField,FTextField,FIcon,IFlex,IFlexItem},mixins:[TranslationMixin],provide(){return{sort:(attribute,ascending)=>{const foundAttribute=this.sortOrders.find(item=>item.attribute===attribute&&item.ascending===ascending);if(foundAttribute){this.sortAttribute=foundAttribute;}else{this.sortAttribute={attribute:"",ascending:false};}this.sortFilterData();this.$emit("usedSortAttributes",this.sortAttribute);},registerCallbackOnSort:callback=>{this.tableCallbackOnSort=callback;},registerCallbackOnMount:callback=>{this.tableCallbackSortableColumns=callback;}};},props:{/**
449
450
  * The data that you wish to sort or filter.
450
451
  */data:{type:Array,required:true,default:()=>[]},/**
451
452
  * All the attributes you want to enable sorting for and the corresponding name to display in the dropdown.
@@ -477,7 +478,7 @@ defaultText:"",descriptionText:"",descriptionScreenReaderText:"",discreteDescrip
477
478
  * - `"vertical"`: Enables vertical scrolling
478
479
  * - `"both"`: Enables scrolling in both directions
479
480
  * - `"none"`: Disables scrolling (default)
480
- */scroll:{type:String,default:TableScroll.NONE,validator:function(value){const types=Object.values(TableScroll);return types.includes(value);}}},setup(){return FSortFilterDatasetInjected();},data(){return{columns:[],emptyRow:emptyTableRow()};},computed:{hasCaption(){return hasSlot(this,"caption");},tableClasses(){const classes=[];if(this.striped){classes.push("table--striped");}return classes;},isEmpty(){return this.rows.length===0;},visibleColumns(){return this.columns.filter(col=>col.visible);},hasInitiateColumns(){return this.columns.length>0;},wrapperClasses(){return tableScrollClasses(this.scroll);},tabindex(){return this.scroll!==TableScroll.NONE?0:void 0;}},mounted(){this.registerCallbackOnSort(this.callbackOnSort);this.registerCallbackOnMount(this.callbackSortableColumns);},methods:{rowKey(item){const key=item[this.keyAttribute];if(typeof key==="undefined"){throw new Error(`Key attribute [${this.keyAttribute}]' is missing in row`);}return String(key);},columnClasses(column){const classes=["table__column",`table__column--${column.type}`,column.size];if(column.sortable){classes.push("table__column--sortable");}return classes;},iconClasses(column){return getSortableIconClasses(column);},iconName(column){return getSortableIconName(column);},onClickColumnHeader(column){if(!column.sortable){return;}let columnName=column.name;if(column.sort===FTableColumnSort.DESCENDING){columnName="";column.sort=FTableColumnSort.UNSORTED;}this.sort(columnName,column.sort!==FTableColumnSort.ASCENDING);},callbackOnSort(columnName,ascending){updateSortOrder(this.columns,columnName,ascending);},callbackSortableColumns(columnNames){setSortableColumns(this.columns,columnNames);},escapeNewlines(value){return value.replace(/\n/g,"<br/>");}}});const _hoisted_1$v=["tabindex"];const _hoisted_2$p={key:0};const _hoisted_3$m={class:"table__row"};const _hoisted_4$h=["innerHTML"];const _hoisted_5$f={key:1,class:"table__column__description"};const _hoisted_6$b={key:0};const _hoisted_7$a={key:1};const _hoisted_8$8=["colspan"];function _sfc_render$y(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return openBlock(),createElementBlock("div",{class:normalizeClass(_ctx.wrapperClasses)},[createElementVNode("table",mergeProps({class:["table",_ctx.tableClasses],tabindex:_ctx.tabindex},_ctx.$attrs),[_ctx.hasCaption?(openBlock(),createElementBlock("caption",_hoisted_2$p,[renderSlot(_ctx.$slots,"caption")])):createCommentVNode("v-if",true),createTextVNode(),createElementVNode("colgroup",null,[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.columns,column=>{return openBlock(),createElementBlock("col",{key:column.id,class:normalizeClass(column.size)},null,2/* CLASS */);}),128/* KEYED_FRAGMENT */))]),createTextVNode(),createElementVNode("thead",null,[createElementVNode("tr",_hoisted_3$m,[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.visibleColumns,column=>{return openBlock(),createElementBlock("th",mergeProps({key:column.id,scope:"col",class:_ctx.columnClasses(column)},toHandlers(column.sortable?{click:()=>_ctx.onClickColumnHeader(column)}:{},true)),[createElementVNode("span",{innerHTML:_ctx.escapeNewlines(column.title)},null,8,_hoisted_4$h),createTextVNode(),column.sortable?(openBlock(),createBlock(_component_f_icon,{key:0,class:normalizeClass(_ctx.iconClasses(column)),name:_ctx.iconName(column)},null,8,["class","name"])):createCommentVNode("v-if",true),createTextVNode(),column.description?(openBlock(),createElementBlock("span",_hoisted_5$f,toDisplayString(column.description),1/* TEXT */)):createCommentVNode("v-if",true)],16/* FULL_PROPS */);}),128/* KEYED_FRAGMENT */))])]),createTextVNode(),createElementVNode("tbody",null,[!_ctx.hasInitiateColumns?(openBlock(),createElementBlock("tr",_hoisted_6$b,[renderSlot(_ctx.$slots,"default",normalizeProps(guardReactiveProps({row:_ctx.emptyRow})))])):createCommentVNode("v-if",true),createTextVNode(),_ctx.isEmpty?(openBlock(),createElementBlock("tr",_hoisted_7$a,[createElementVNode("td",{class:"table__column table__column--action",colspan:_ctx.columns.length},[renderSlot(_ctx.$slots,"empty",{},()=>[createTextVNode(toDisplayString(_ctx.$t("fkui.data-table.empty","Tabellen är tom")),1/* TEXT */)])],8,_hoisted_8$8)])):createCommentVNode("v-if",true),createTextVNode(),(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.rows,row=>{return openBlock(),createElementBlock("tr",{key:_ctx.rowKey(row),class:"table__row"},[renderSlot(_ctx.$slots,"default",mergeProps({ref_for:true},{row}))]);}),128/* KEYED_FRAGMENT */))])],16,_hoisted_1$v)],2/* CLASS */);}const FDataTable=/* @__PURE__ */_export_sfc(_sfc_main$y,[["render",_sfc_render$y]]);function isDayEnabled(day,config2){return passesMinDate(day,config2.minDate)&&passesMaxDate(day,config2.maxDate)&&passesInvalidDates(day,config2.invalidDates)&&passesInvalidWeekdays(day,config2.invalidWeekdays);}function passesMinDate(day,config2){if(!config2){throw new Error("MinDate validator must be set");}if(!config2.limit){throw new Error("Invalid minDate config");}return config2.limit<=day.toString();}function passesMaxDate(day,config2){if(!config2){throw new Error("MaxDate validator must be set");}if(!config2.limit){throw new Error("Invalid maxDate config");}return day.toString()<=config2.limit;}function passesInvalidDates(day,config2){if(!config2){return true;}if(!isInvalidDatesConfig(config2)){throw new Error("Invalid invalidDates config");}return!config2.dates.includes(day.toString());}function passesInvalidWeekdays(day,config2){if(!config2){return true;}if(!isInvalidWeekdaysConfig(config2)){throw new Error("Invalid invalidWeekdays config");}return!config2.days.includes(day.weekDay);}function updateCalendarValue(newValue){const newCalendarValue=FDate.fromIso(newValue);if(!newCalendarValue.isValid()){this.calendarValue=void 0;}else if(isInvalidMonth(newCalendarValue,this.minDate,this.maxDate)){this.calendarValue=void 0;}else if(!this.isDateEnabled(newCalendarValue)){this.calendarValue=void 0;}else if(!this.calendarValue||!this.calendarValue.equals(newCalendarValue)){this.calendarValue=newCalendarValue;}}function getDisplayMonth(minDate,maxDate,selectedDate,initialMonth){let effectiveDate;if(selectedDate&&selectedDate.isValid()){effectiveDate=selectedDate;}else if(initialMonth&&initialMonth.isValid()){effectiveDate=initialMonth;}else{effectiveDate=FDate.now();}let month;if(!isInvalidMonth(effectiveDate,minDate,maxDate)){month=effectiveDate.startOfMonth();}else if(isMonthBefore(effectiveDate,minDate)){month=minDate==null?void 0:minDate.startOfMonth();}else if(isMonthAfter(effectiveDate,maxDate)){month=maxDate==null?void 0:maxDate.startOfMonth();}return month||FDate.now().startOfMonth();}const _sfc_main$x=defineComponent({name:"FDatepickerField",components:{FCalendar,IPopup,FTextField,FIcon,FCalendarDay},mixins:[TranslationMixin],inheritAttrs:false,props:{/** Selected day.
481
+ */scroll:{type:String,default:TableScroll.NONE,validator:function(value){const types=Object.values(TableScroll);return types.includes(value);}}},setup(){return FSortFilterDatasetInjected();},data(){return{columns:[],emptyRow:emptyTableRow()};},computed:{hasCaption(){return hasSlot(this,"caption",{},{stripClasses:[]});},tableClasses(){const classes=[];if(this.striped){classes.push("table--striped");}return classes;},isEmpty(){return this.rows.length===0;},visibleColumns(){return this.columns.filter(col=>col.visible);},hasInitiateColumns(){return this.columns.length>0;},wrapperClasses(){return tableScrollClasses(this.scroll);},tabindex(){return this.scroll!==TableScroll.NONE?0:void 0;}},mounted(){this.registerCallbackOnSort(this.callbackOnSort);this.registerCallbackOnMount(this.callbackSortableColumns);},methods:{rowKey(item){const key=item[this.keyAttribute];if(typeof key==="undefined"){throw new Error(`Key attribute [${this.keyAttribute}]' is missing in row`);}return String(key);},columnClasses(column){const classes=["table__column",`table__column--${column.type}`,column.size];if(column.sortable){classes.push("table__column--sortable");}return classes;},iconClasses(column){return getSortableIconClasses(column);},iconName(column){return getSortableIconName(column);},onClickColumnHeader(column){if(!column.sortable){return;}let columnName=column.name;if(column.sort===FTableColumnSort.DESCENDING){columnName="";column.sort=FTableColumnSort.UNSORTED;}this.sort(columnName,column.sort!==FTableColumnSort.ASCENDING);},callbackOnSort(columnName,ascending){updateSortOrder(this.columns,columnName,ascending);},callbackSortableColumns(columnNames){setSortableColumns(this.columns,columnNames);},escapeNewlines(value){return value.replace(/\n/g,"<br/>");}}});const _hoisted_1$v=["tabindex"];const _hoisted_2$p={key:0};const _hoisted_3$m={class:"table__row"};const _hoisted_4$h=["innerHTML"];const _hoisted_5$f={key:1,class:"table__column__description"};const _hoisted_6$b={key:0};const _hoisted_7$a={key:1};const _hoisted_8$8=["colspan"];function _sfc_render$y(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return openBlock(),createElementBlock("div",{class:normalizeClass(_ctx.wrapperClasses)},[createElementVNode("table",mergeProps({class:["table",_ctx.tableClasses],tabindex:_ctx.tabindex},_ctx.$attrs),[_ctx.hasCaption?(openBlock(),createElementBlock("caption",_hoisted_2$p,[renderSlot(_ctx.$slots,"caption")])):createCommentVNode("v-if",true),createTextVNode(),createElementVNode("colgroup",null,[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.columns,column=>{return openBlock(),createElementBlock("col",{key:column.id,class:normalizeClass(column.size)},null,2/* CLASS */);}),128/* KEYED_FRAGMENT */))]),createTextVNode(),createElementVNode("thead",null,[createElementVNode("tr",_hoisted_3$m,[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.visibleColumns,column=>{return openBlock(),createElementBlock("th",mergeProps({key:column.id,scope:"col",class:_ctx.columnClasses(column)},toHandlers(column.sortable?{click:()=>_ctx.onClickColumnHeader(column)}:{},true)),[createElementVNode("span",{innerHTML:_ctx.escapeNewlines(column.title)},null,8,_hoisted_4$h),createTextVNode(),column.sortable?(openBlock(),createBlock(_component_f_icon,{key:0,class:normalizeClass(_ctx.iconClasses(column)),name:_ctx.iconName(column)},null,8,["class","name"])):createCommentVNode("v-if",true),createTextVNode(),column.description?(openBlock(),createElementBlock("span",_hoisted_5$f,toDisplayString(column.description),1/* TEXT */)):createCommentVNode("v-if",true)],16/* FULL_PROPS */);}),128/* KEYED_FRAGMENT */))])]),createTextVNode(),createElementVNode("tbody",null,[!_ctx.hasInitiateColumns?(openBlock(),createElementBlock("tr",_hoisted_6$b,[renderSlot(_ctx.$slots,"default",normalizeProps(guardReactiveProps({row:_ctx.emptyRow})))])):createCommentVNode("v-if",true),createTextVNode(),_ctx.isEmpty?(openBlock(),createElementBlock("tr",_hoisted_7$a,[createElementVNode("td",{class:"table__column table__column--action",colspan:_ctx.columns.length},[renderSlot(_ctx.$slots,"empty",{},()=>[createTextVNode(toDisplayString(_ctx.$t("fkui.data-table.empty","Tabellen är tom")),1/* TEXT */)])],8,_hoisted_8$8)])):createCommentVNode("v-if",true),createTextVNode(),(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.rows,row=>{return openBlock(),createElementBlock("tr",{key:_ctx.rowKey(row),class:"table__row"},[renderSlot(_ctx.$slots,"default",mergeProps({ref_for:true},{row}))]);}),128/* KEYED_FRAGMENT */))])],16,_hoisted_1$v)],2/* CLASS */);}const FDataTable=/* @__PURE__ */_export_sfc(_sfc_main$y,[["render",_sfc_render$y]]);function isDayEnabled(day,config2){return passesMinDate(day,config2.minDate)&&passesMaxDate(day,config2.maxDate)&&passesInvalidDates(day,config2.invalidDates)&&passesInvalidWeekdays(day,config2.invalidWeekdays);}function passesMinDate(day,config2){if(!config2){throw new Error("MinDate validator must be set");}if(!config2.limit){throw new Error("Invalid minDate config");}return config2.limit<=day.toString();}function passesMaxDate(day,config2){if(!config2){throw new Error("MaxDate validator must be set");}if(!config2.limit){throw new Error("Invalid maxDate config");}return day.toString()<=config2.limit;}function passesInvalidDates(day,config2){if(!config2){return true;}if(!isInvalidDatesConfig(config2)){throw new Error("Invalid invalidDates config");}return!config2.dates.includes(day.toString());}function passesInvalidWeekdays(day,config2){if(!config2){return true;}if(!isInvalidWeekdaysConfig(config2)){throw new Error("Invalid invalidWeekdays config");}return!config2.days.includes(day.weekDay);}function updateCalendarValue(datepicker,newValue){const{isDateEnabled,minDate,maxDate}=datepicker;const newCalendarValue=FDate.fromIso(newValue);if(!newCalendarValue.isValid()){datepicker.calendarValue=void 0;}else if(isInvalidMonth(newCalendarValue,minDate,maxDate)){datepicker.calendarValue=void 0;}else if(!isDateEnabled(newCalendarValue)){datepicker.calendarValue=void 0;}else if(!datepicker.calendarValue||!datepicker.calendarValue.equals(newCalendarValue)){datepicker.calendarValue=newCalendarValue;}}function getDisplayMonth(minDate,maxDate,selectedDate,initialMonth){let effectiveDate;if(selectedDate&&selectedDate.isValid()){effectiveDate=selectedDate;}else if(initialMonth&&initialMonth.isValid()){effectiveDate=initialMonth;}else{effectiveDate=FDate.now();}let month;if(!isInvalidMonth(effectiveDate,minDate,maxDate)){month=effectiveDate.startOfMonth();}else if(isMonthBefore(effectiveDate,minDate)){month=minDate==null?void 0:minDate.startOfMonth();}else if(isMonthAfter(effectiveDate,maxDate)){month=maxDate==null?void 0:maxDate.startOfMonth();}return month||FDate.now().startOfMonth();}const _sfc_main$x=defineComponent({name:"FDatepickerField",components:{FCalendar,IPopup,FTextField,FIcon,FCalendarDay},mixins:[TranslationMixin],inheritAttrs:false,props:{/** Selected day.
481
482
  * @model
482
483
  */modelValue:{type:String,required:false,default:""},/**
483
484
  * Initial month. Applies when no day is selected.
@@ -500,7 +501,7 @@ defaultText:"",descriptionText:"",descriptionScreenReaderText:"",discreteDescrip
500
501
  * ```
501
502
  */inputWidth:{type:String,required:false,default:"sm-12"},/**
502
503
  * Set to `true`, empty string `""` or string `"disabled"` to disable this field.
503
- */disabled:{type:Boolean,required:false,default:false}},emits:["change","update:modelValue"],setup(){const defaultMinDate=FDate.now().addYears(-10);const defaultMaxDate=FDate.now().addYears(10);return{textFieldValue:ref(""),textFieldTouched:ref(false),textFieldValidityRevealed:ref(false),textFieldTableMode:inject("textFieldTableMode",false),componentTouched:ref(false),calendarMonth:shallowRef(getDisplayMonth(defaultMinDate,defaultMaxDate)),calendarValue:shallowRef(void 0),isCalendarOpen:ref(false),validationConfig:ref({}),minDate:shallowRef(defaultMinDate),maxDate:shallowRef(defaultMaxDate),calendarInputs:ref(null)};},computed:{calendarButtonText(){const{calendarValue}=this;if(calendarValue&&calendarValue.isValid()){const prettyDate=calendarValue.toString(DateFormat.FULL);const text=this.$t("fkui.datepicker-field.change","Ändra datum");return`${text} ${prettyDate}`;}else{return this.$t("fkui.datepicker-field.choose","Välj datum");}},popupClass(){return this.textFieldTableMode?"datepicker-field__popup datepicker-field__table":"datepicker-field__popup";}},watch:{modelValue:{async handler(value){if(value!==this.textFieldValue){await this.updateTextFieldValue(value);this.updateCalendarValue(value);}},immediate:true}},mounted(){ValidationService.addValidatorsToElement(getInputElement(this),{date:{},dateFormat:{},minDate:{limit:this.minDate.toString()},maxDate:{limit:this.maxDate.toString()}},true);},methods:{dateFormatter:parseDate,async onValidityTextField({detail}){if(this.textFieldValidityRevealed&&detail.validityMode==="INITIAL"){this.textFieldTouched=false;this.componentTouched=false;}if(!this.textFieldTouched&&["blur","change"].includes(detail.nativeEvent)){this.textFieldTouched=true;}if(this.isCalendarOpen){alertScreenReader(detail.validationMessage,{assertive:true});}this.textFieldValidityRevealed=detail.validityMode!=="INITIAL";if(detail.validityMode==="INITIAL"||!this.textFieldTouched||this.componentTouched){return;}const inputElement=getInputElement(this);const pendingValidityEvent=new CustomEvent("pending-validity",{bubbles:false});inputElement.dispatchEvent(pendingValidityEvent);},onChangeTextField(){this.updateCalendarValue(this.textFieldValue);this.$emit("update:modelValue",this.textFieldValue);this.$emit("change",this.textFieldValue);},onClickCalendarButton(){if(!this.isCalendarOpen){this.calendarMonth=getDisplayMonth(this.minDate,this.maxDate,this.calendarValue,this.initialMonth);}this.isCalendarOpen=!this.isCalendarOpen;},onFocusoutTextFieldButton(e){if(this.componentTouched||this.$refs.component===null){return;}const component=getHTMLElementFromVueRef(this.$refs.component);const relatedTarget=e.relatedTarget;if(!component.contains(relatedTarget)){this.componentTouched=true;const inputElement=getInputElement(this);ValidationService.setTouched(inputElement);ValidationService.validateElement(inputElement);}},async onSelectCalendarDay(date){this.componentTouched=true;this.isCalendarOpen=!this.isDateEnabled(date);if(!this.isCalendarOpen){getHTMLElementFromVueRef(this.$refs.calendarButton).focus();}this.$emit("update:modelValue",date.toString());this.$emit("change",date.toString());await this.updateTextFieldValue(date.toString());this.updateCalendarValue(date.toString());},async onKeyupEsc(){this.isCalendarOpen=false;waitForScreenReader(()=>{getHTMLElementFromVueRef(this.$refs.calendarButton).focus();});},async onClickCloseCalendarButton(){this.isCalendarOpen=false;waitForScreenReader(()=>{getHTMLElementFromVueRef(this.$refs.calendarButton).focus();});},onOpenPopup(){if(!this.isCalendarOpen){return;}const popup=getHTMLElementFromVueRef(this.$refs.popup);const navMonth=popup.querySelector(".calendar-navbar__month");if(navMonth){navMonth.focus({preventScroll:true});}},onClosePopup(){this.isCalendarOpen=false;},async onValidationConfigUpdate(event){this.validationConfig=event.detail.config;if(this.validationConfig.minDate){const minDateConfig=this.validationConfig.minDate;if(!minDateConfig.limit){throw new Error("MinDate validator must be set");}this.minDate=FDate.fromIso(minDateConfig.limit.toString());}if(this.validationConfig.maxDate){const maxDateConfig=this.validationConfig.maxDate;if(!maxDateConfig.limit){throw new Error("MaxDate validator must be set");}this.maxDate=FDate.fromIso(maxDateConfig.limit.toString());}const element=findHTMLElementFromVueRef(this.$refs.calendarInputs);if(element){await this.$nextTick();ValidationService.validateAllElements(element);}},isDateEnabled(day){return isDayEnabled(day,this.validationConfig);},isDaySelected(date){return this.calendarValue?date.equals(this.calendarValue):false;},highlightDay(date){return this.highlightToday&&date.equals(FDate.now());},async updateTextFieldValue(newValue){this.textFieldValue=newValue;await this.$nextTick();ValidationService.validateElement(getInputElement(this));},updateCalendarValue}});const _hoisted_1$u={ref:"component",class:"datepicker-field"};const _hoisted_2$o=["disabled","aria-expanded"];const _hoisted_3$l={class:"sr-only"};const _hoisted_4$g={class:"datepicker-field__close"};function _sfc_render$x(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");const _component_f_text_field=resolveComponent("f-text-field");const _component_f_calendar_day=resolveComponent("f-calendar-day");const _component_f_calendar=resolveComponent("f-calendar");const _component_i_popup=resolveComponent("i-popup");return openBlock(),createElementBlock("div",_hoisted_1$u,[createElementVNode("div",{ref:"calendarInputs",onFocusout:_cache[2]||(_cache[2]=(...args)=>_ctx.onFocusoutTextFieldButton&&_ctx.onFocusoutTextFieldButton(...args))},[createVNode(_component_f_text_field,mergeProps(_ctx.$attrs,{modelValue:_ctx.textFieldValue,"onUpdate:modelValue":_cache[1]||(_cache[1]=$event=>_ctx.textFieldValue=$event),maxlength:"20",disabled:_ctx.disabled,formatter:_ctx.dateFormatter,"label-width":_ctx.labelWidth,"input-width":_ctx.inputWidth,onComponentValidity:_ctx.onValidityTextField,onChange:_ctx.onChangeTextField,onValidationConfigUpdate:_ctx.onValidationConfigUpdate}),createSlots({description:withCtx(({descriptionClass,discreteDescriptionClass})=>[renderSlot(_ctx.$slots,"description",normalizeProps(guardReactiveProps({descriptionClass,discreteDescriptionClass})))]),"error-message":withCtx(({hasError,validationMessage})=>[renderSlot(_ctx.$slots,"error-message",normalizeProps(guardReactiveProps({hasError,validationMessage})))]),"input-right":withCtx(()=>[createElementVNode("button",{ref:"calendarButton",disabled:_ctx.disabled,class:"datepicker-field__button",type:"button","aria-expanded":_ctx.isCalendarOpen?"true":"false","data-test":"calendar-button",onClick:_cache[0]||(_cache[0]=$event=>_ctx.onClickCalendarButton())},[createVNode(_component_f_icon,{name:"calendar"}),createTextVNode(),createElementVNode("span",_hoisted_3$l,toDisplayString(_ctx.calendarButtonText),1/* TEXT */)],8,_hoisted_2$o)]),default:withCtx(()=>[renderSlot(_ctx.$slots,"default",{},()=>[createTextVNode(toDisplayString(_ctx.$t("fkui.datepicker-field.label","Datum")),1/* TEXT */)]),createTextVNode(),createTextVNode(),createTextVNode(),createTextVNode()]),_:2/* DYNAMIC */},[_ctx.$slots.tooltip?{name:"tooltip",fn:withCtx(()=>[renderSlot(_ctx.$slots,"tooltip")]),key:"0"}:void 0]),1040,["modelValue","disabled","formatter","label-width","input-width","onComponentValidity","onChange","onValidationConfigUpdate"])],544/* NEED_HYDRATION, NEED_PATCH */),createTextVNode(),createVNode(_component_i_popup,{"is-open":_ctx.isCalendarOpen,anchor:_ctx.calendarInputs,inline:_ctx.alwaysInline?"always":void 0,"set-focus":false,onOpen:_ctx.onOpenPopup,onClose:_ctx.onClosePopup},{default:withCtx(()=>[createElementVNode("div",{ref:"popup",class:normalizeClass(_ctx.popupClass)},[createVNode(_component_f_calendar,{modelValue:_ctx.calendarMonth,"onUpdate:modelValue":_cache[3]||(_cache[3]=$event=>_ctx.calendarMonth=$event),"tab-date":_ctx.calendarValue,"min-date":_ctx.minDate,"max-date":_ctx.maxDate,onClick:_ctx.onSelectCalendarDay,onKeyup:withKeys(withModifiers(_ctx.onKeyupEsc,["stop"]),["esc","native"])},{default:withCtx(({date,isFocused})=>[createVNode(_component_f_calendar_day,{day:date,enabled:_ctx.isDateEnabled(date),focused:isFocused,highlight:_ctx.highlightDay(date),selected:_ctx.isDaySelected(date)},null,8,["day","enabled","focused","highlight","selected"])]),_:1/* STABLE */},8,["modelValue","tab-date","min-date","max-date","onClick","onKeyup"]),createTextVNode(),createElementVNode("div",_hoisted_4$g,[createElementVNode("button",{class:"button button--discrete button--discrete--black datepicker-field__close__button",type:"button",onClick:_cache[4]||(_cache[4]=(...args)=>_ctx.onClickCloseCalendarButton&&_ctx.onClickCloseCalendarButton(...args)),onKeyup:_cache[5]||(_cache[5]=withKeys(withModifiers((...args)=>_ctx.onKeyupEsc&&_ctx.onKeyupEsc(...args),["stop"]),["esc"]))},[createElementVNode("span",null,toDisplayString(_ctx.$t("fkui.datepicker-field.close","Stäng")),1/* TEXT */),createTextVNode(),createVNode(_component_f_icon,{"aria-hidden":"true",class:"button__icon",name:"close"})],32/* NEED_HYDRATION */)])],2/* CLASS */)]),_:1/* STABLE */},8,["is-open","anchor","inline","onOpen","onClose"])],512/* NEED_PATCH */);}const FDatepickerField=/* @__PURE__ */_export_sfc(_sfc_main$x,[["render",_sfc_render$x]]);const _sfc_main$w=defineComponent({name:"FExpand",data(){return{height:0,initialStyle:{overflow:"hidden",transition:"height 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96)"},hiddenStyle:{height:"auto",position:"absolute",visibility:"hidden"},visibleStyle:{width:"",position:"",visibility:"",height:"0px"},openedStyle:{height:"auto"}};},methods:{enter(element){const htmlElement=getHTMLElementFromVueRef(element);Object.assign(htmlElement.style,this.initialStyle);Object.assign(htmlElement.style,this.hiddenStyle);htmlElement.style.width=getComputedStyle(element).width;const height=getComputedStyle(element).height;Object.assign(htmlElement.style,this.visibleStyle);getComputedStyle(element).height;setTimeout(()=>{this.height=parseInt(height,10);htmlElement.style.height=height;});},afterEnter(element){const htmlElement=getHTMLElementFromVueRef(element);Object.assign(htmlElement.style,this.openedStyle);},leave(element){const htmlElement=getHTMLElementFromVueRef(element);const height=getComputedStyle(element).height;htmlElement.style.height=height;getComputedStyle(element).height;setTimeout(()=>{Object.assign(htmlElement.style,this.visibleStyle);});}}});function _sfc_render$w(_ctx,_cache,$props,$setup,$data,$options){return openBlock(),createBlock(Transition,{onEnter:_ctx.enter,onAfterEnter:_ctx.afterEnter,onLeave:_ctx.leave},{default:withCtx(()=>[renderSlot(_ctx.$slots,"default",{height:_ctx.height})]),_:3/* FORWARDED */},8,["onEnter","onAfterEnter","onLeave"]);}const FExpand=/* @__PURE__ */_export_sfc(_sfc_main$w,[["render",_sfc_render$w]]);const _sfc_main$v=defineComponent({name:"FExpandablePanel",components:{FIcon,FExpand},mixins:[TranslationMixin],inheritAttrs:false,props:{/**
504
+ */disabled:{type:Boolean,required:false,default:false}},emits:["change","update:modelValue"],setup(){const defaultMinDate=FDate.now().addYears(-10);const defaultMaxDate=FDate.now().addYears(10);return{textFieldValue:ref(""),textFieldTouched:ref(false),textFieldValidityRevealed:ref(false),textFieldTableMode:inject("textFieldTableMode",false),componentTouched:ref(false),calendarMonth:shallowRef(getDisplayMonth(defaultMinDate,defaultMaxDate)),calendarValue:shallowRef(void 0),isCalendarOpen:ref(false),validationConfig:ref({}),minDate:shallowRef(defaultMinDate),maxDate:shallowRef(defaultMaxDate),calendarInputs:ref(null)};},computed:{calendarButtonText(){const{calendarValue}=this;if(calendarValue&&calendarValue.isValid()){const prettyDate=calendarValue.toString(DateFormat.FULL);const text=this.$t("fkui.datepicker-field.change","Ändra datum");return`${text} ${prettyDate}`;}else{return this.$t("fkui.datepicker-field.choose","Välj datum");}},popupClass(){return this.textFieldTableMode?"datepicker-field__popup datepicker-field__table":"datepicker-field__popup";}},watch:{modelValue:{async handler(value){if(value!==this.textFieldValue){await this.updateTextFieldValue(value);updateCalendarValue(this,value);}},immediate:true}},mounted(){ValidationService.addValidatorsToElement(getInputElement(this),{date:{},dateFormat:{},minDate:{limit:this.minDate.toString()},maxDate:{limit:this.maxDate.toString()}},true);},methods:{dateFormatter:parseDate,async onValidityTextField({detail}){if(this.textFieldValidityRevealed&&detail.validityMode==="INITIAL"){this.textFieldTouched=false;this.componentTouched=false;}if(!this.textFieldTouched&&["blur","change"].includes(detail.nativeEvent)){this.textFieldTouched=true;}if(this.isCalendarOpen){alertScreenReader(detail.validationMessage,{assertive:true});}this.textFieldValidityRevealed=detail.validityMode!=="INITIAL";if(detail.validityMode==="INITIAL"||!this.textFieldTouched||this.componentTouched){return;}const inputElement=getInputElement(this);const pendingValidityEvent=new CustomEvent("pending-validity",{bubbles:false});inputElement.dispatchEvent(pendingValidityEvent);},onChangeTextField(){updateCalendarValue(this,this.textFieldValue);this.$emit("update:modelValue",this.textFieldValue);this.$emit("change",this.textFieldValue);},onClickCalendarButton(){if(!this.isCalendarOpen){this.calendarMonth=getDisplayMonth(this.minDate,this.maxDate,this.calendarValue,this.initialMonth);}this.isCalendarOpen=!this.isCalendarOpen;},onFocusoutTextFieldButton(e){if(this.componentTouched||this.$refs.component===null){return;}const component=getHTMLElementFromVueRef(this.$refs.component);const relatedTarget=e.relatedTarget;if(!component.contains(relatedTarget)){this.componentTouched=true;const inputElement=getInputElement(this);ValidationService.setTouched(inputElement);ValidationService.validateElement(inputElement);}},async onSelectCalendarDay(date){this.componentTouched=true;this.isCalendarOpen=!this.isDateEnabled(date);if(!this.isCalendarOpen){getHTMLElementFromVueRef(this.$refs.calendarButton).focus();}this.$emit("update:modelValue",date.toString());this.$emit("change",date.toString());await this.updateTextFieldValue(date.toString());updateCalendarValue(this,date.toString());},async onKeyupEsc(){this.isCalendarOpen=false;waitForScreenReader(()=>{getHTMLElementFromVueRef(this.$refs.calendarButton).focus();});},async onClickCloseCalendarButton(){this.isCalendarOpen=false;waitForScreenReader(()=>{getHTMLElementFromVueRef(this.$refs.calendarButton).focus();});},onOpenPopup(){if(!this.isCalendarOpen){return;}const popup=getHTMLElementFromVueRef(this.$refs.popup);const navMonth=popup.querySelector(".calendar-navbar__month");if(navMonth){navMonth.focus({preventScroll:true});}},onClosePopup(){this.isCalendarOpen=false;},async onValidationConfigUpdate(event){this.validationConfig=event.detail.config;if(this.validationConfig.minDate){const minDateConfig=this.validationConfig.minDate;if(!minDateConfig.limit){throw new Error("MinDate validator must be set");}this.minDate=FDate.fromIso(minDateConfig.limit.toString());}if(this.validationConfig.maxDate){const maxDateConfig=this.validationConfig.maxDate;if(!maxDateConfig.limit){throw new Error("MaxDate validator must be set");}this.maxDate=FDate.fromIso(maxDateConfig.limit.toString());}const element=findHTMLElementFromVueRef(this.$refs.calendarInputs);if(element){await this.$nextTick();ValidationService.validateAllElements(element);}},isDateEnabled(day){return isDayEnabled(day,this.validationConfig);},isDaySelected(date){return this.calendarValue?date.equals(this.calendarValue):false;},highlightDay(date){return this.highlightToday&&date.equals(FDate.now());},async updateTextFieldValue(newValue){this.textFieldValue=newValue;await this.$nextTick();ValidationService.validateElement(getInputElement(this));}}});const _hoisted_1$u={ref:"component",class:"datepicker-field"};const _hoisted_2$o=["disabled","aria-expanded"];const _hoisted_3$l={class:"sr-only"};const _hoisted_4$g={class:"datepicker-field__close"};function _sfc_render$x(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");const _component_f_text_field=resolveComponent("f-text-field");const _component_f_calendar_day=resolveComponent("f-calendar-day");const _component_f_calendar=resolveComponent("f-calendar");const _component_i_popup=resolveComponent("i-popup");return openBlock(),createElementBlock("div",_hoisted_1$u,[createElementVNode("div",{ref:"calendarInputs",onFocusout:_cache[2]||(_cache[2]=(...args)=>_ctx.onFocusoutTextFieldButton&&_ctx.onFocusoutTextFieldButton(...args))},[createVNode(_component_f_text_field,mergeProps(_ctx.$attrs,{modelValue:_ctx.textFieldValue,"onUpdate:modelValue":_cache[1]||(_cache[1]=$event=>_ctx.textFieldValue=$event),maxlength:"20",disabled:_ctx.disabled,formatter:_ctx.dateFormatter,"label-width":_ctx.labelWidth,"input-width":_ctx.inputWidth,onComponentValidity:_ctx.onValidityTextField,onChange:_ctx.onChangeTextField,onValidationConfigUpdate:_ctx.onValidationConfigUpdate}),createSlots({description:withCtx(({descriptionClass,discreteDescriptionClass})=>[renderSlot(_ctx.$slots,"description",normalizeProps(guardReactiveProps({descriptionClass,discreteDescriptionClass})))]),"error-message":withCtx(({hasError,validationMessage})=>[renderSlot(_ctx.$slots,"error-message",normalizeProps(guardReactiveProps({hasError,validationMessage})))]),"input-right":withCtx(()=>[createElementVNode("button",{ref:"calendarButton",disabled:_ctx.disabled,class:"datepicker-field__button",type:"button","aria-expanded":_ctx.isCalendarOpen?"true":"false","data-test":"calendar-button",onClick:_cache[0]||(_cache[0]=$event=>_ctx.onClickCalendarButton())},[createVNode(_component_f_icon,{name:"calendar"}),createTextVNode(),createElementVNode("span",_hoisted_3$l,toDisplayString(_ctx.calendarButtonText),1/* TEXT */)],8,_hoisted_2$o)]),default:withCtx(()=>[renderSlot(_ctx.$slots,"default",{},()=>[createTextVNode(toDisplayString(_ctx.$t("fkui.datepicker-field.label","Datum")),1/* TEXT */)]),createTextVNode(),createTextVNode(),createTextVNode(),createTextVNode()]),_:2/* DYNAMIC */},[_ctx.$slots.tooltip?{name:"tooltip",fn:withCtx(()=>[renderSlot(_ctx.$slots,"tooltip")]),key:"0"}:void 0]),1040,["modelValue","disabled","formatter","label-width","input-width","onComponentValidity","onChange","onValidationConfigUpdate"])],544/* NEED_HYDRATION, NEED_PATCH */),createTextVNode(),createVNode(_component_i_popup,{"is-open":_ctx.isCalendarOpen,anchor:_ctx.calendarInputs,inline:_ctx.alwaysInline?"always":void 0,"set-focus":false,onOpen:_ctx.onOpenPopup,onClose:_ctx.onClosePopup},{default:withCtx(()=>[createElementVNode("div",{ref:"popup",class:normalizeClass(_ctx.popupClass)},[createVNode(_component_f_calendar,{modelValue:_ctx.calendarMonth,"onUpdate:modelValue":_cache[3]||(_cache[3]=$event=>_ctx.calendarMonth=$event),"tab-date":_ctx.calendarValue,"min-date":_ctx.minDate,"max-date":_ctx.maxDate,onClick:_ctx.onSelectCalendarDay,onKeyup:withKeys(withModifiers(_ctx.onKeyupEsc,["stop"]),["esc","native"])},{default:withCtx(({date,isFocused})=>[createVNode(_component_f_calendar_day,{day:date,enabled:_ctx.isDateEnabled(date),focused:isFocused,highlight:_ctx.highlightDay(date),selected:_ctx.isDaySelected(date)},null,8,["day","enabled","focused","highlight","selected"])]),_:1/* STABLE */},8,["modelValue","tab-date","min-date","max-date","onClick","onKeyup"]),createTextVNode(),createElementVNode("div",_hoisted_4$g,[createElementVNode("button",{class:"button button--discrete button--discrete--black datepicker-field__close__button",type:"button",onClick:_cache[4]||(_cache[4]=(...args)=>_ctx.onClickCloseCalendarButton&&_ctx.onClickCloseCalendarButton(...args)),onKeyup:_cache[5]||(_cache[5]=withKeys(withModifiers((...args)=>_ctx.onKeyupEsc&&_ctx.onKeyupEsc(...args),["stop"]),["esc"]))},[createElementVNode("span",null,toDisplayString(_ctx.$t("fkui.datepicker-field.close","Stäng")),1/* TEXT */),createTextVNode(),createVNode(_component_f_icon,{"aria-hidden":"true",class:"button__icon",name:"close"})],32/* NEED_HYDRATION */)])],2/* CLASS */)]),_:1/* STABLE */},8,["is-open","anchor","inline","onOpen","onClose"])],512/* NEED_PATCH */);}const FDatepickerField=/* @__PURE__ */_export_sfc(_sfc_main$x,[["render",_sfc_render$x]]);const _sfc_main$w=defineComponent({name:"FExpand",data(){return{height:0,initialStyle:{overflow:"hidden",transition:"height 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96)"},hiddenStyle:{height:"auto",position:"absolute",visibility:"hidden"},visibleStyle:{width:"",position:"",visibility:"",height:"0px"},openedStyle:{height:"auto"}};},methods:{enter(element){const htmlElement=getHTMLElementFromVueRef(element);Object.assign(htmlElement.style,this.initialStyle);Object.assign(htmlElement.style,this.hiddenStyle);htmlElement.style.width=getComputedStyle(element).width;const height=getComputedStyle(element).height;Object.assign(htmlElement.style,this.visibleStyle);getComputedStyle(element).height;setTimeout(()=>{this.height=parseInt(height,10);htmlElement.style.height=height;});},afterEnter(element){const htmlElement=getHTMLElementFromVueRef(element);Object.assign(htmlElement.style,this.openedStyle);},leave(element){const htmlElement=getHTMLElementFromVueRef(element);const height=getComputedStyle(element).height;htmlElement.style.height=height;getComputedStyle(element).height;setTimeout(()=>{Object.assign(htmlElement.style,this.visibleStyle);});}}});function _sfc_render$w(_ctx,_cache,$props,$setup,$data,$options){return openBlock(),createBlock(Transition,{onEnter:_ctx.enter,onAfterEnter:_ctx.afterEnter,onLeave:_ctx.leave},{default:withCtx(()=>[renderSlot(_ctx.$slots,"default",{height:_ctx.height})]),_:3/* FORWARDED */},8,["onEnter","onAfterEnter","onLeave"]);}const FExpand=/* @__PURE__ */_export_sfc(_sfc_main$w,[["render",_sfc_render$w]]);const _sfc_main$v=defineComponent({name:"FExpandablePanel",components:{FIcon,FExpand},mixins:[TranslationMixin],inheritAttrs:false,props:{/**
504
505
  * Toggle expanded/collapsed state
505
506
  */expanded:{type:Boolean,required:false,default:false},/**
506
507
  * Element to render for the header element inside the expandable panel.
@@ -632,24 +633,48 @@ onItemFocus(event){if(event&&event.target){event.target.style.position="relative
632
633
  */delay:{type:Boolean,required:false,default:false},/**
633
634
  * Language used for determining fallback value for the loading text. Useful if loader is displayed before
634
635
  * text keys have been downloaded
635
- */language:{type:String,required:false,default:"sv"}},data(){return{oldFocus:void 0};},computed:{defaultLoadingText(){return this.language==="en"?"Please wait":"Vänligen vänta";},classes(){return{"loader--overlay":this.overlay,"loader--delay":this.delay};},teleportTarget(){return config.teleportTarget;},teleportDisabled(){return!this.overlay;}},watch:{show(show){if(show){this.openLoader();}else{this.closeLoader();}}},mounted(){if(this.show){this.openLoader();}},methods:{async listener(){await this.$nextTick();focus(this.$refs["loader-text"]);},async openLoader(){if(this.overlay){saveFocus(document);this.listener();addFocusListener(findTabbableElements(document),this.listener);}},closeLoader(){if(this.overlay){removeFocusListener(findTabbableElements(document),this.listener);restoreFocus();}}}});const _hoisted_1$g={class:"loader__backdrop"};const _hoisted_2$c=/* @__PURE__ */createElementVNode("div",{class:"loader__wrapper"},[/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-1 loader__spinner"},[/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-1-circle1 loader__circle loader__circle--1"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-1-circle2 loader__circle loader__circle--2"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-1-circle3 loader__circle loader__circle--3"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-1-circle4 loader__circle loader__circle--4"})]),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-2 loader__spinner"},[/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-2-circle1 loader__circle loader__circle--1"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-2-circle2 loader__circle loader__circle--2"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-2-circle3 loader__circle loader__circle--3"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-2-circle4 loader__circle loader__circle--4"})]),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-3 loader__spinner"},[/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-3-circle1 loader__circle loader__circle--1"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-3-circle2 loader__circle loader__circle--2"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-3-circle3 loader__circle loader__circle--3"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-3-circle4 loader__circle loader__circle--4"})])],-1/* HOISTED */);const _hoisted_3$a={role:"alert"};function _sfc_render$i(_ctx,_cache,$props,$setup,$data,$options){return openBlock(),createBlock(Teleport,{to:_ctx.teleportTarget,disabled:_ctx.teleportDisabled},[withDirectives(createElementVNode("div",mergeProps(_ctx.$attrs,{class:["loader",_ctx.classes]}),[createElementVNode("div",_hoisted_1$g,[_hoisted_2$c,createTextVNode(),createElementVNode("div",{ref:"loader-text",class:normalizeClass(["loader__wait-text",{"loader--delay":_ctx.delay}]),tabindex:"-1"},[createElementVNode("span",_hoisted_3$a,[renderSlot(_ctx.$slots,"default",{},()=>[createTextVNode(toDisplayString(_ctx.$t("fkui.loader.wait.text",_ctx.defaultLoadingText)),1/* TEXT */)])])],2/* CLASS */)])],16/* FULL_PROPS */),[[vShow,_ctx.show]])],8,["to","disabled"]);}const FLoader=/* @__PURE__ */_export_sfc(_sfc_main$i,[["render",_sfc_render$i]]);function getNewItemIndexFromMenuAction$2(action,index,n){let newIndex;if(n<=0){return 0;}switch(action){case MenuAction.MOVE_NEXT:newIndex=(index+1)%n;break;case MenuAction.MOVE_PREV:newIndex=(index-1+n)%n;break;case MenuAction.MOVE_FIRST:newIndex=0;break;case MenuAction.MOVE_LAST:newIndex=Math.max(n-1,0);break;default:newIndex=index;}return newIndex;}async function doMenuAction$2(action,target){const itemsLength=target.items.length;const currentIndex=target.currentFocusedItemIndex;const newFocusedItemIndex=getNewItemIndexFromMenuAction$2(action,currentIndex,itemsLength);switch(action){case MenuAction.MOVE_NEXT:case MenuAction.MOVE_PREV:case MenuAction.MOVE_FIRST:case MenuAction.MOVE_LAST:await target.setFocusOnItem(newFocusedItemIndex);break;case MenuAction.ACTIVATE:await target.activateItem(newFocusedItemIndex);break;}}const preventKeys$2=["Up","Down","ArrowUp","ArrowDown","Home","End"," ","Spacebar","Enter"];const _sfc_main$h=defineComponent({name:"IPopupMenu",components:{FIcon,IPopup},props:{/**
636
+ */language:{type:String,required:false,default:"sv"}},data(){return{oldFocus:void 0};},computed:{defaultLoadingText(){return this.language==="en"?"Please wait":"Vänligen vänta";},classes(){return{"loader--overlay":this.overlay,"loader--delay":this.delay};},teleportTarget(){return config.teleportTarget;},teleportDisabled(){return!this.overlay;}},watch:{show(show){if(show){this.openLoader();}else{this.closeLoader();}}},mounted(){if(this.show){this.openLoader();}},methods:{async listener(){await this.$nextTick();focus(this.$refs["loader-text"]);},async openLoader(){if(this.overlay){saveFocus(document);this.listener();addFocusListener(findTabbableElements(document),this.listener);}},closeLoader(){if(this.overlay){removeFocusListener(findTabbableElements(document),this.listener);restoreFocus();}}}});const _hoisted_1$g={class:"loader__backdrop"};const _hoisted_2$c=/* @__PURE__ */createElementVNode("div",{class:"loader__wrapper"},[/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-1 loader__spinner"},[/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-1-circle1 loader__circle loader__circle--1"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-1-circle2 loader__circle loader__circle--2"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-1-circle3 loader__circle loader__circle--3"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-1-circle4 loader__circle loader__circle--4"})]),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-2 loader__spinner"},[/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-2-circle1 loader__circle loader__circle--1"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-2-circle2 loader__circle loader__circle--2"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-2-circle3 loader__circle loader__circle--3"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-2-circle4 loader__circle loader__circle--4"})]),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-3 loader__spinner"},[/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-3-circle1 loader__circle loader__circle--1"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-3-circle2 loader__circle loader__circle--2"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-3-circle3 loader__circle loader__circle--3"}),/* @__PURE__ */createTextVNode(),/* @__PURE__ */createElementVNode("div",{class:"loader__spinner-3-circle4 loader__circle loader__circle--4"})])],-1/* HOISTED */);const _hoisted_3$a={role:"alert"};function _sfc_render$i(_ctx,_cache,$props,$setup,$data,$options){return openBlock(),createBlock(Teleport,{to:_ctx.teleportTarget,disabled:_ctx.teleportDisabled},[withDirectives(createElementVNode("div",mergeProps(_ctx.$attrs,{class:["loader",_ctx.classes]}),[createElementVNode("div",_hoisted_1$g,[_hoisted_2$c,createTextVNode(),createElementVNode("div",{ref:"loader-text",class:normalizeClass(["loader__wait-text",{"loader--delay":_ctx.delay}]),tabindex:"-1"},[createElementVNode("span",_hoisted_3$a,[renderSlot(_ctx.$slots,"default",{},()=>[createTextVNode(toDisplayString(_ctx.$t("fkui.loader.wait.text",_ctx.defaultLoadingText)),1/* TEXT */)])])],2/* CLASS */)])],16/* FULL_PROPS */),[[vShow,_ctx.show]])],8,["to","disabled"]);}const FLoader=/* @__PURE__ */_export_sfc(_sfc_main$i,[["render",_sfc_render$i]]);function getNewItemIndexFromMenuAction$2(action,index,n){let newIndex;if(n<=0){return 0;}switch(action){case MenuAction.MOVE_NEXT:newIndex=(index+1)%n;break;case MenuAction.MOVE_PREV:newIndex=(index-1+n)%n;break;case MenuAction.MOVE_FIRST:newIndex=0;break;case MenuAction.MOVE_LAST:newIndex=Math.max(n-1,0);break;default:newIndex=index;}return newIndex;}async function doMenuAction$2(action,target){const itemsLength=target.items.length;const currentIndex=target.currentFocusedItemIndex;const newFocusedItemIndex=getNewItemIndexFromMenuAction$2(action,currentIndex,itemsLength);switch(action){case MenuAction.MOVE_NEXT:case MenuAction.MOVE_PREV:case MenuAction.MOVE_FIRST:case MenuAction.MOVE_LAST:await target.setFocusOnItem(newFocusedItemIndex);break;case MenuAction.ACTIVATE:await target.activateItem(newFocusedItemIndex);break;}}const preventKeys$2=["Tab","Up","Down","ArrowUp","ArrowDown","Home","End"," ","Spacebar","Enter"];const _sfc_main$h=defineComponent({name:"IPopupMenu",components:{FIcon,IPopup},props:{/**
637
+ * Key of the currently selected and highlighted item.
638
+ *
639
+ * @model
640
+ */modelValue:{type:String,required:false,default:""},/**
641
+ * Key of the currently focused item.
642
+ * Sets focus on matching item element when value changes.
643
+ *
644
+ * @model
645
+ */focusedItem:{type:String,required:false,default:""},/**
636
646
  * Toggle open/closed popup.
637
647
  */isOpen:{type:Boolean,required:true},/**
638
648
  * DOM element to position popup at.
639
649
  */anchor:{type:HTMLElement,default:void 0},/**
640
- * The currently highlighted menu item key
641
- * @model
642
- */modelValue:{type:String,required:false,default:""},/**
643
650
  * The items to be diplayed in the menu
644
651
  */items:{type:Array,required:true},/**
645
- * The key of the currently selected focused item
646
- */focusedItemKey:{type:String,required:false,default:""},/**
647
652
  * If true, enable built-in keyboard navigation
648
653
  */enableKeyboardNavigation:{type:Boolean,required:false,default:false},/**
649
654
  * Unique accessible name for navigation landmark.
650
655
  */ariaLabel:{type:String,required:false,default:"Popupmeny"},/**
651
656
  * Text for selected item for screen reader
652
- */selectedMenuItemScreenReaderText:{type:String,required:false,default:"vald nu"}},emits:["close","select","update:modelValue"],data(){return{currentFocusedItemIndex:0,lastSelectedItem:""};},watch:{isOpen:{immediate:true,async handler(){this.currentFocusedItemIndex=0;this.lastSelectedItem="";}},focusedItemKey:{async handler(newVal){if(this.enableKeyboardNavigation){return;}const index=this.indexOfItemByKey(newVal);if(index>=0){await this.setFocusOnItem(index);}else{this.setFocusedItemIndex(0);}}},modelValue:{async handler(newVal){if(this.enableKeyboardNavigation){return;}const index=this.indexOfItemByKey(newVal);if(index>=0){await this.activateItem(index);}else{this.setFocusedItemIndex(0);}}}},methods:{isSelected(index){return this.items[index].key===this.modelValue;},focusElement(){return null;},findItemByKey(key){return this.items.find(it=>it.key===key);},indexOfItemByKey(key){const item=this.findItemByKey(key);if(!item){return-1;}return this.items.indexOf(item);},async onClickItem(item,doClick=false){var _a;if(item.key!==this.lastSelectedItem){this.$emit("update:modelValue",item.key);this.$emit("select",item.key);this.lastSelectedItem=item.key;}this.$emit("close");if(item.href&&doClick){const anchors=getSortedHTMLElementsFromVueRef(this.$refs.anchors);(_a=anchors[this.currentFocusedItemIndex])==null?void 0:_a.click();}},cssClassHighlight(item){return item.key===this.modelValue?"ipopupmenu__list__item--highlight":"";},async setFocusOnItem(index){this.setFocusedItemIndex(index);await this.$nextTick();if(this.isOpen){const anchors=getSortedHTMLElementsFromVueRef(this.$refs.anchors);if(anchors.length>0){const itemAnchor=anchors[index];focus$1(itemAnchor,{preventScroll:true});}}},async activateItem(index){if(index!==this.currentFocusedItemIndex){await this.setFocusOnItem(index);}await this.onClickItem(this.items[index],true);},setFocusedItemIndex(index){this.currentFocusedItemIndex=index;},onKeyUp(event){if(!this.enableKeyboardNavigation){return;}if(preventKeys$2.includes(event.key)){event.preventDefault();}},async onKeyDown(event){if(!this.enableKeyboardNavigation){return;}if(!preventKeys$2.includes(event.key)){return;}const action=actionFromKeyboardEvent(event);if(action!==null){event.preventDefault();await doMenuAction$2(action,this);}}}});const _hoisted_1$f=["aria-label"];const _hoisted_2$b={role:"menu",class:"ipopupmenu__list"};const _hoisted_3$9=["onClick"];const _hoisted_4$7=["data-ref-index","href","target"];const _hoisted_5$7={key:0,class:"sr-only"};function _sfc_render$h(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");const _component_i_popup=resolveComponent("i-popup");return openBlock(),createBlock(_component_i_popup,{class:"ipopupmenu","is-open":_ctx.isOpen,"keyboard-trap":false,anchor:_ctx.anchor,"focus-element":_ctx.focusElement,onClose:_cache[0]||(_cache[0]=$event=>_ctx.$emit("close")),onKeyup:_ctx.onKeyUp,onKeydown:_ctx.onKeyDown},{default:withCtx(()=>[createElementVNode("nav",{class:"ipopupmenu ipopupmenu--vertical","aria-label":_ctx.ariaLabel},[createElementVNode("ul",_hoisted_2$b,[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.items,(item,index)=>{return openBlock(),createElementBlock("li",{ref_for:true,ref:"items",key:item.key,role:"presentation",class:normalizeClass(["ipopupmenu__list__item",_ctx.cssClassHighlight(item)]),onClick:$event=>_ctx.onClickItem(item)},[createElementVNode("a",{ref_for:true,ref:"anchors","data-ref-index":index,href:item.href,role:"menuitem",target:item.target,tabindex:"0"},[_ctx.isSelected(index)?(openBlock(),createElementBlock("span",_hoisted_5$7,[createElementVNode("span",null,toDisplayString(_ctx.selectedMenuItemScreenReaderText)+" ",1/* TEXT */)])):createCommentVNode("v-if",true),createTextVNode(toDisplayString(item.label)+" ",1/* TEXT */),item.iconRight?(openBlock(),createBlock(_component_f_icon,{key:1,name:item.iconRight},null,8,["name"])):createCommentVNode("v-if",true)],8,_hoisted_4$7)],10,_hoisted_3$9);}),128/* KEYED_FRAGMENT */))])],8,_hoisted_1$f)]),_:1/* STABLE */},8,["is-open","anchor","focus-element","onKeyup","onKeydown"]);}const IPopupMenu=/* @__PURE__ */_export_sfc(_sfc_main$h,[["render",_sfc_render$h]]);const menuMoreKey="MENU_MORE";function findOverflowIndex(totalWidth,elements){let sum=0;return elements.findIndex(element=>{sum+=element.offsetWidth;return sum>totalWidth;});}function getNewItemIndexFromMenuAction$1(action,index,n){let newIndex;if(n<=0){return 0;}switch(action){case MenuAction.MOVE_NEXT:newIndex=(index+1)%n;break;case MenuAction.MOVE_PREV:newIndex=(index-1+n)%n;break;case MenuAction.MOVE_FIRST:newIndex=0;break;case MenuAction.MOVE_LAST:newIndex=Math.max(n-1,0);break;default:newIndex=index;}return newIndex;}async function doMenuAction$1(action,target){const itemsLength=target.items.length;const currentIndex=target.currentFocusedItemIndex;const newFocusedItemIndex=getNewItemIndexFromMenuAction$1(action,currentIndex,itemsLength);switch(action){case MenuAction.MOVE_NEXT:case MenuAction.MOVE_PREV:case MenuAction.MOVE_FIRST:case MenuAction.MOVE_LAST:await target.setFocusOnItem(newFocusedItemIndex);break;case MenuAction.ACTIVATE:await target.activateItem(newFocusedItemIndex);break;}}const preventKeys$1=["Tab","Up","Down","Left","Right","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"," ","Spacebar","Enter"];const _sfc_main$g=defineComponent({name:"IMenu",components:{FIcon},props:{/**
657
+ */selectedMenuItemScreenReaderText:{type:String,required:false,default:"vald nu"}},emits:[/**
658
+ * Emitted when an item is selected and when tabbing out of the popup.
659
+ *
660
+ * @event close
661
+ */"close",/**
662
+ * Vue 2 V-model event. Emitted when an item is selected.
663
+ *
664
+ * @event select
665
+ * @deprecated
666
+ * @type {string} item key
667
+ */"select",/**
668
+ * V-model event. Emitted when an item is selected.
669
+ *
670
+ * @event select
671
+ * @type {string} item key
672
+ */"update:modelValue",/**
673
+ * V-model event. Emitted when item focus changes.
674
+ *
675
+ * @event select
676
+ * @type {string} Key of focused item, or empty if no item focused.
677
+ */"update:focusedItem"],data(){return{currentFocusedItemIndex:0,lastSelectedItem:""};},watch:{isOpen:{immediate:true,async handler(newVal){if(newVal){return;}this.currentFocusedItemIndex=0;this.lastSelectedItem="";this.$emit("update:focusedItem","");}},modelValue:{async handler(newVal){if(this.enableKeyboardNavigation){return;}const index=this.indexOfItemByKey(newVal);if(index>=0){await this.activateItem(index);}else{this.setFocusedItemIndex(0);}}},focusedItem:{async handler(newVal){if(newVal.length===0){return;}const index=this.indexOfItemByKey(newVal);if(index>=0){await this.setFocusOnItem(index);}else{this.setFocusedItemIndex(0);}}}},methods:{isSelected(index){return this.items[index].key===this.modelValue;},focusElement(){return null;},findItemByKey(key){return this.items.find(it=>it.key===key);},indexOfItemByKey(key){const item=this.findItemByKey(key);if(!item){return-1;}return this.items.indexOf(item);},async onClickItem(item,doClick=false){var _a;if(item.key!==this.lastSelectedItem){this.$emit("update:modelValue",item.key);this.$emit("select",item.key);this.lastSelectedItem=item.key;}this.$emit("close");if(item.href&&doClick){const anchors=getSortedHTMLElementsFromVueRef(this.$refs.anchors);(_a=anchors[this.currentFocusedItemIndex])==null?void 0:_a.click();}},itemClasses(item){const highlight=item.key===this.modelValue?["ipopupmenu__list__item--highlight"]:[];return["ipopupmenu__list__item",...highlight];},async setFocusOnItem(index){this.setFocusedItemIndex(index);await this.$nextTick();if(!this.isOpen){return;}const anchors=getSortedHTMLElementsFromVueRef(this.$refs.anchors);if(anchors.length===0){return;}const itemAnchor=anchors[index];focus$1(itemAnchor,{preventScroll:true});const key=this.items[index].key;this.$emit("update:focusedItem",key);},async activateItem(index){if(index!==this.currentFocusedItemIndex){await this.setFocusOnItem(index);}await this.onClickItem(this.items[index],true);},setFocusedItemIndex(index){this.currentFocusedItemIndex=index;},onKeyUp(event){if(!this.enableKeyboardNavigation){return;}if(preventKeys$2.includes(event.key)){event.preventDefault();}},async onKeyDown(event){if(!this.enableKeyboardNavigation){return;}if(!preventKeys$2.includes(event.key)){return;}const firstItemFocused=this.currentFocusedItemIndex===0;const lastItemFocused=this.currentFocusedItemIndex===this.items.length-1;const tabOutPrev=event.key==="Tab"&&event.shiftKey&&firstItemFocused;const tabOutNext=event.key==="Tab"&&!event.shiftKey&&lastItemFocused;if(tabOutPrev||tabOutNext){if(tabOutPrev){event.preventDefault();}this.$emit("close");return;}const action=actionFromKeyboardEvent(event);if(action===null){return;}event.preventDefault();await doMenuAction$2(action,this);}}});const _hoisted_1$f=["aria-label"];const _hoisted_2$b={role:"menu",class:"ipopupmenu__list"};const _hoisted_3$9=["onClick"];const _hoisted_4$7=["data-ref-index","href","target"];const _hoisted_5$7={key:0,class:"sr-only"};function _sfc_render$h(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");const _component_i_popup=resolveComponent("i-popup");return openBlock(),createBlock(_component_i_popup,{class:"ipopupmenu","is-open":_ctx.isOpen,"keyboard-trap":false,anchor:_ctx.anchor,"focus-element":_ctx.focusElement,onClose:_cache[0]||(_cache[0]=$event=>_ctx.$emit("close")),onKeyup:_ctx.onKeyUp,onKeydown:_ctx.onKeyDown},{default:withCtx(()=>[createElementVNode("nav",{class:"ipopupmenu ipopupmenu--vertical","aria-label":_ctx.ariaLabel},[createElementVNode("ul",_hoisted_2$b,[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.items,(item,index)=>{return openBlock(),createElementBlock("li",{ref_for:true,ref:"items",key:item.key,role:"presentation",class:normalizeClass(_ctx.itemClasses(item)),onClick:$event=>_ctx.onClickItem(item)},[createElementVNode("a",{ref_for:true,ref:"anchors","data-ref-index":index,href:item.href,role:"menuitem",target:item.target,tabindex:"0"},[_ctx.isSelected(index)?(openBlock(),createElementBlock("span",_hoisted_5$7,[createElementVNode("span",null,toDisplayString(_ctx.selectedMenuItemScreenReaderText)+" ",1/* TEXT */)])):createCommentVNode("v-if",true),createTextVNode(toDisplayString(item.label)+" ",1/* TEXT */),item.iconRight?(openBlock(),createBlock(_component_f_icon,{key:1,name:item.iconRight},null,8,["name"])):createCommentVNode("v-if",true)],8,_hoisted_4$7)],10,_hoisted_3$9);}),128/* KEYED_FRAGMENT */))])],8,_hoisted_1$f)]),_:1/* STABLE */},8,["is-open","anchor","focus-element","onKeyup","onKeydown"]);}const IPopupMenu=/* @__PURE__ */_export_sfc(_sfc_main$h,[["render",_sfc_render$h]]);const menuMoreKey="MENU_MORE";function findOverflowIndex(totalWidth,elements){let sum=0;return elements.findIndex(element=>{sum+=element.offsetWidth;return sum>totalWidth;});}function getNewItemIndexFromMenuAction$1(action,index,n){let newIndex;if(n<=0){return 0;}switch(action){case MenuAction.MOVE_NEXT:newIndex=(index+1)%n;break;case MenuAction.MOVE_PREV:newIndex=(index-1+n)%n;break;case MenuAction.MOVE_FIRST:newIndex=0;break;case MenuAction.MOVE_LAST:newIndex=Math.max(n-1,0);break;default:newIndex=index;}return newIndex;}async function doMenuAction$1(action,target){const itemsLength=target.items.length;const currentIndex=target.currentFocusedItemIndex;const newFocusedItemIndex=getNewItemIndexFromMenuAction$1(action,currentIndex,itemsLength);switch(action){case MenuAction.MOVE_NEXT:case MenuAction.MOVE_PREV:case MenuAction.MOVE_FIRST:case MenuAction.MOVE_LAST:await target.setFocusOnItem(newFocusedItemIndex);break;case MenuAction.ACTIVATE:await target.activateItem(newFocusedItemIndex);break;}}const preventKeys$1=["Tab","Up","Down","Left","Right","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"," ","Spacebar","Enter"];const _sfc_main$g=defineComponent({name:"IMenu",components:{FIcon},props:{/**
653
678
  * The currently highlighted menu item key
654
679
  * @model
655
680
  */modelValue:{type:String,required:false,default:""},/**
@@ -693,7 +718,7 @@ onItemFocus(event){if(event&&event.target){event.target.style.position="relative
693
718
  * @event update:route
694
719
  * @param route
695
720
  * @type {string}
696
- */"update:route"],data(){return{overflowIndex:-1,ignoreNoOverflow:false,selectedMenuItemKey:"",selectedPopupItemKey:"",popupAnchor:this.$el,popupOpen:false,currentFocusedItemIndex:0,focusedMenuItemKey:"",focusedPopupMenuItemKey:"",initPopupNavigationIndex:true};},computed:{items(){return this.routes.map(i=>({label:i.label,key:i.route,href:i.href,target:i.target}));},visibleItems(){if(this.overflowIndex>-1){const visibleItems=this.items.slice(0,this.overflowIndex);visibleItems.push({label:this.$t("fkui.navigation-menu.more-text","Mer"),key:menuMoreKey,iconRight:"arrow-down",ariaHasPopup:true,srMenuMoreTextContents:this.menuMoreScreenReaderText,srMenuMoreTextSelectedContents:this.menuMoreWithSelectedItemsSrText()});return visibleItems;}else{return this.items;}},popupItems(){return this.overflowIndex>-1?this.items.slice(this.overflowIndex):[];},hasPopupMenuSelectedItems(){return this.selectedPopupItemKey!=="";}},watch:{route:{async handler(value){const itemIndex=isSet(value)?this.indexOfItemByKey(this.items,value):-1;if(itemIndex<0){await this.activateItem(-1);return;}const isWithinMoreMenu=!this.findItemByKey(this.visibleItems,value);if(isWithinMoreMenu){const item=this.items[itemIndex];await this.activateInvisibleItem(item);}else{await this.activateItem(itemIndex);}},immediate:true}},mounted(){this.currentFocusedItemIndex=0;},methods:{selectedMenuItemSrText(){if(this.selectedMenuItemScreenReaderText===""){return this.$t("fkui.navigation-menu.current-page","Aktuell sida");}else{return this.selectedMenuItemScreenReaderText;}},menuMoreWithSelectedItemsSrText(){if(this.menuMoreWithSelectedItemsScreenReaderText===""){return this.$t("fkui.navigation-menu.more-selection","underliggande vald nu");}else{return this.menuMoreWithSelectedItemsScreenReaderText;}},findItemByKey(items,key){return items.find(it=>it.key===key);},indexOfItemByKey(items,key){return items.findIndex(it=>it.key===key);},async onOverflow(index){const ignore=this.ignoreNoOverflow;const shouldReset=index===-1&&ignore;const shouldIgnore=index>=0;if(shouldReset){this.ignoreNoOverflow=false;return;}if(shouldIgnore){this.ignoreNoOverflow=true;}this.updateOverflowIndex(index);await this.refreshSelectedItem();const shouldClosePopup=this.overflowIndex>-1&&!this.ignoreNoOverflow;if(shouldClosePopup){await this.setPopupOpen(false);}},async refreshSelectedItem(){const popupStatus=this.popupOpen;if(this.overflowIndex===-1){if(this.visibleItems.some(i=>i.key===this.selectedPopupItemKey)){this.selectedMenuItemKey=this.selectedPopupItemKey;this.selectedPopupItemKey="";}}else{if(this.popupItems.some(i=>i.key===this.selectedMenuItemKey)){var _ref3;this.selectedPopupItemKey=this.selectedMenuItemKey;const lastItem=this.visibleItems.at(-1);this.selectedMenuItemKey=(_ref3=lastItem==null?void 0:lastItem.key)!==null&&_ref3!==void 0?_ref3:"";}}await this.setPopupOpen(popupStatus);},async doSelectItem(key){if(key!==menuMoreKey){this.$emit("update:route",key);this.$emit("selectedRoute",key);}let index=-1;if(this.hasOverflow()){index=this.indexOfItemByKey(this.visibleItems,key);if(index===-1){index=this.indexOfItemByKey(this.items,key);}}else{index=this.indexOfItemByKey(this.items,key);}},async onSelectMenu(key){await this.doSelectItem(key);if(key!==menuMoreKey){if(this.findItemByKey(this.visibleItems,key)&&this.selectedPopupItemKey!==""){this.focusedPopupMenuItemKey="";this.selectedPopupItemKey="";}}else{const anchor=getHTMLElementFromVueRef(this.$refs.menu).querySelector("li:last-child");if(anchor){this.popupAnchor=anchor;}await this.setPopupOpen(true);}},async onSelectPopup(key){await this.setPopupOpen(false);await this.doSelectItem(key);},async onClosePopup(){await this.setPopupOpen(false);},async setPopupOpen(value){if(value){this.focusedPopupMenuItemKey="";}else{this.initPopupNavigationIndex=true;}this.popupOpen=value;await this.$nextTick();},updateOverflowIndex(index){this.overflowIndex=calcOverflowIndexFromIndex(index);},onKeyUp(event){if(preventKeys.includes(event.key)){event.preventDefault();}},doHandleMenuTabKey(action){if(this.hasOverflow()){if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex+1===this.visibleItems.length){return true;}if(action===MenuAction.MOVE_PREV&&this.currentFocusedItemIndex-1===-1){return true;}}else{if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex+1===this.items.length){return true;}if(action===MenuAction.MOVE_PREV&&this.currentFocusedItemIndex-1===-1){return true;}}return false;},async doHandlePopupMenuTabKey(action){if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex+1===this.items.length){await this.setPopupOpen(false);return true;}else if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex===this.overflowIndex){if(this.initPopupNavigationIndex){this.initPopupNavigationIndex=!this.initPopupNavigationIndex;this.setCurrentFocusedItemIndex(this.overflowIndex-1);return false;}}else if(action===MenuAction.MOVE_PREV&&this.currentFocusedItemIndex===this.overflowIndex){await this.setPopupOpen(false);this.setCurrentFocusedItemIndex(this.overflowIndex-1);return false;}return false;},setCurrentFocusedItemIndex(value){this.currentFocusedItemIndex=value;},doInitPopupNavigationIndex(event){if(keyDown.includes(event.key)||event.key==="Tab"){this.setCurrentFocusedItemIndex(this.overflowIndex-1);}else if(keyUp.includes(event.key)){this.setCurrentFocusedItemIndex(this.items.length+1);}},async onKeyDown(event){if(event.key==="Escape"){await this.setPopupOpen(false);return;}let action=actionFromKeyboardEvent(event);if(action===null){return;}if(!this.popupOpen){if(event.key==="Tab"&&this.doHandleMenuTabKey(action)){return;}event.preventDefault();await doMenuAction(action,this,0,this.visibleItems.length);}else{if(event.key==="Tab"&&(await this.doHandlePopupMenuTabKey(action))){return;}event.preventDefault();if(action===MenuAction.ACTIVATE&&this.focusedPopupMenuItemKey===""){action=null;await this.setPopupOpen(false);return;}if(this.initPopupNavigationIndex&&arrowKeys.includes(event.key)){this.initPopupNavigationIndex=!this.initPopupNavigationIndex;this.doInitPopupNavigationIndex(event);}await doMenuAction(action,this,this.overflowIndex,this.items.length);}},async setFocusOnItem(index){var _a,_b;this.setFocusedItemIndex(index);if(!this.hasOverflow()||!this.popupOpen&&index<=this.overflowIndex){this.setFocusedMenuItemKey(((_a=this.visibleItems[index])==null?void 0:_a.key)||"");}else{await this.setFocusedPopupMenuItemKey(((_b=this.items[index])==null?void 0:_b.key)||"");}},hasOverflow(){return this.overflowIndex!==-1;},async activateItem(index){var _a,_b;if(!this.hasOverflow()||!this.popupOpen&&index<=this.overflowIndex){const key=((_a=this.visibleItems[index])==null?void 0:_a.key)||"";await this.setSelectedMenuItemKey(key);await this.onSelectMenu(key);}else{const key=((_b=this.items[index])==null?void 0:_b.key)||"";this.selectedPopupItemKey=key;await this.onSelectPopup(key);}},async activateInvisibleItem(item){await this.setSelectedMenuItemKey(menuMoreKey);await this.onSelectMenu(menuMoreKey);this.selectedPopupItemKey=item.key;await this.onSelectPopup(item.key);if(item.href){const anchor=document.createElement("a");anchor.href=item.href;if(item.target){anchor.target=item.target;}anchor.click();}},setFocusedItemIndex(index){if(index<0){return;}if(!this.popupOpen&&this.hasOverflow()&&index>this.overflowIndex){this.setCurrentFocusedItemIndex(this.overflowIndex);}else{this.setCurrentFocusedItemIndex(index);}},async setFocusedPopupMenuItemKey(key){this.focusedPopupMenuItemKey="";if(key!==""){await this.$nextTick();this.focusedPopupMenuItemKey=key;}},setFocusedMenuItemKey(key){this.focusedMenuItemKey=key;},async setSelectedMenuItemKey(key){this.selectedMenuItemKey="";if(key!==""){await this.$nextTick();this.selectedMenuItemKey=key;}}}});function _sfc_render$f(_ctx,_cache,$props,$setup,$data,$options){const _component_i_menu=resolveComponent("i-menu");const _component_i_popup_menu=resolveComponent("i-popup-menu");return openBlock(),createElementBlock("div",null,[createVNode(_component_i_menu,{ref:"menu",modelValue:_ctx.selectedMenuItemKey,"onUpdate:modelValue":_cache[0]||(_cache[0]=$event=>_ctx.selectedMenuItemKey=$event),items:_ctx.visibleItems,vertical:_ctx.vertical,"focused-item-key":_ctx.focusedMenuItemKey,"selected-menu-item-screen-reader-text":_ctx.selectedMenuItemSrText(),"has-menu-more-selected-items":_ctx.hasPopupMenuSelectedItems,"aria-label":_ctx.menuAriaLabel,onSelect:_ctx.onSelectMenu,onOverflow:_ctx.onOverflow,onKeyup:_ctx.onKeyUp,onKeydown:_ctx.onKeyDown},null,8,["modelValue","items","vertical","focused-item-key","selected-menu-item-screen-reader-text","has-menu-more-selected-items","aria-label","onSelect","onOverflow","onKeyup","onKeydown"]),createTextVNode(),createVNode(_component_i_popup_menu,{ref:"popupMenu",modelValue:_ctx.selectedPopupItemKey,"onUpdate:modelValue":_cache[1]||(_cache[1]=$event=>_ctx.selectedPopupItemKey=$event),items:_ctx.popupItems,"is-open":_ctx.popupOpen,anchor:_ctx.popupAnchor,"focused-item-key":_ctx.focusedPopupMenuItemKey,"selected-menu-item-screen-reader-text":_ctx.selectedMenuItemSrText(),"aria-label":_ctx.popupAriaLabel,onSelect:_ctx.onSelectPopup,onClose:_ctx.onClosePopup,onKeyup:_ctx.onKeyUp,onKeydown:_ctx.onKeyDown},null,8,["modelValue","items","is-open","anchor","focused-item-key","selected-menu-item-screen-reader-text","aria-label","onSelect","onClose","onKeyup","onKeydown"])]);}const FNavigationMenu=/* @__PURE__ */_export_sfc(_sfc_main$f,[["render",_sfc_render$f]]);const EVENTS=["online","offline"];const _sfc_main$e=defineComponent({name:"FOffline",components:{FIcon,IFlex,IFlexItem},data(){return{isOnline:navigator.onLine||false,role:"none",shouldNotRead:true};},created(){EVENTS.forEach(event=>{window.addEventListener(event,this.updateOnlineStatus);});},beforeUnmount(){EVENTS.forEach(event=>{window.removeEventListener(event,this.updateOnlineStatus);});},mounted(){document.body.prepend(getElementFromVueRef(this.$refs.offline));},methods:{updateOnlineStatus(event){switch(event.type){case"online":this.shouldNotRead=false;this.isOnline=true;break;case"offline":this.shouldNotRead=true;this.isOnline=false;break;default:this.shouldNotRead=true;this.isOnline=false;break;}this.role="alert";}}});const _hoisted_1$d=["role"];const _hoisted_2$9={key:0,class:"offline"};const _hoisted_3$7={class:"icon-stack icon-stack--error"};const _hoisted_4$5={class:"offline__content"};const _hoisted_5$5=["aria-hidden"];function _sfc_render$e(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");const _component_i_flex_item=resolveComponent("i-flex-item");const _component_i_flex=resolveComponent("i-flex");return openBlock(),createElementBlock("div",{ref:"offline",class:"offline__wrapper",role:_ctx.role},[!_ctx.isOnline?(openBlock(),createElementBlock("div",_hoisted_2$9,[createVNode(_component_i_flex,{gap:"2x"},{default:withCtx(()=>[createVNode(_component_i_flex_item,{class:"offline__icon",shrink:"",align:"center"},{default:withCtx(()=>[createElementVNode("span",_hoisted_3$7,[createVNode(_component_f_icon,{name:"triangle"}),createTextVNode(),createVNode(_component_f_icon,{name:"alert"})])]),_:1/* STABLE */}),createTextVNode(),createVNode(_component_i_flex_item,{class:"offline_content",grow:"",align:"center"},{default:withCtx(()=>[createElementVNode("p",_hoisted_4$5,[renderSlot(_ctx.$slots,"default",{},()=>[createTextVNode(" Det verkar som att du inte har någon internetuppkoppling just nu ")])])]),_:3/* FORWARDED */})]),_:3/* FORWARDED */})])):createCommentVNode("v-if",true),createTextVNode(),withDirectives(createElementVNode("span",{class:"sr-only","aria-hidden":_ctx.shouldNotRead?"true":void 0},"\n Din internetuppkoppling fungerar igen\n ",8,_hoisted_5$5),[[vShow,_ctx.isOnline]])],8,_hoisted_1$d);}const FOffline=/* @__PURE__ */_export_sfc(_sfc_main$e,[["render",_sfc_render$e]]);const _sfc_main$d=defineComponent({name:"FOutputField",components:{FLabel},inheritAttrs:false,props:{/**
721
+ */"update:route"],data(){return{overflowIndex:-1,ignoreNoOverflow:false,selectedMenuItemKey:"",selectedPopupItemKey:"",popupAnchor:this.$el,popupOpen:false,currentFocusedItemIndex:0,focusedMenuItemKey:"",focusedPopupMenuItemKey:"",initPopupNavigationIndex:true};},computed:{items(){return this.routes.map(i=>({label:i.label,key:i.route,href:i.href,target:i.target}));},visibleItems(){if(this.overflowIndex>-1){const visibleItems=this.items.slice(0,this.overflowIndex);visibleItems.push({label:this.$t("fkui.navigation-menu.more-text","Mer"),key:menuMoreKey,iconRight:"arrow-down",ariaHasPopup:true,srMenuMoreTextContents:this.menuMoreScreenReaderText,srMenuMoreTextSelectedContents:this.menuMoreWithSelectedItemsSrText()});return visibleItems;}else{return this.items;}},popupItems(){return this.overflowIndex>-1?this.items.slice(this.overflowIndex):[];},hasPopupMenuSelectedItems(){return this.selectedPopupItemKey!=="";}},watch:{route:{async handler(value){const itemIndex=isSet(value)?this.indexOfItemByKey(this.items,value):-1;if(itemIndex<0){await this.activateItem(-1);return;}const isWithinMoreMenu=!this.findItemByKey(this.visibleItems,value);if(isWithinMoreMenu){const item=this.items[itemIndex];await this.activateInvisibleItem(item);}else{await this.activateItem(itemIndex);}},immediate:true}},mounted(){this.currentFocusedItemIndex=0;},methods:{selectedMenuItemSrText(){if(this.selectedMenuItemScreenReaderText===""){return this.$t("fkui.navigation-menu.current-page","Aktuell sida");}else{return this.selectedMenuItemScreenReaderText;}},menuMoreWithSelectedItemsSrText(){if(this.menuMoreWithSelectedItemsScreenReaderText===""){return this.$t("fkui.navigation-menu.more-selection","underliggande vald nu");}else{return this.menuMoreWithSelectedItemsScreenReaderText;}},findItemByKey(items,key){return items.find(it=>it.key===key);},indexOfItemByKey(items,key){return items.findIndex(it=>it.key===key);},async onOverflow(index){const ignore=this.ignoreNoOverflow;const shouldReset=index===-1&&ignore;const shouldIgnore=index>=0;if(shouldReset){this.ignoreNoOverflow=false;return;}if(shouldIgnore){this.ignoreNoOverflow=true;}this.updateOverflowIndex(index);await this.refreshSelectedItem();const shouldClosePopup=this.overflowIndex>-1&&!this.ignoreNoOverflow;if(shouldClosePopup){await this.setPopupOpen(false);}},async refreshSelectedItem(){const popupStatus=this.popupOpen;if(this.overflowIndex===-1){if(this.visibleItems.some(i=>i.key===this.selectedPopupItemKey)){this.selectedMenuItemKey=this.selectedPopupItemKey;this.selectedPopupItemKey="";}}else{if(this.popupItems.some(i=>i.key===this.selectedMenuItemKey)){var _ref3;this.selectedPopupItemKey=this.selectedMenuItemKey;const lastItem=this.visibleItems.at(-1);this.selectedMenuItemKey=(_ref3=lastItem==null?void 0:lastItem.key)!==null&&_ref3!==void 0?_ref3:"";}}await this.setPopupOpen(popupStatus);},async doSelectItem(key){if(key!==menuMoreKey){this.$emit("update:route",key);this.$emit("selectedRoute",key);}let index=-1;if(this.hasOverflow()){index=this.indexOfItemByKey(this.visibleItems,key);if(index===-1){index=this.indexOfItemByKey(this.items,key);}}else{index=this.indexOfItemByKey(this.items,key);}},async onSelectMenu(key){await this.doSelectItem(key);if(key!==menuMoreKey){if(this.findItemByKey(this.visibleItems,key)&&this.selectedPopupItemKey!==""){this.focusedPopupMenuItemKey="";this.selectedPopupItemKey="";}}else{const anchor=getHTMLElementFromVueRef(this.$refs.menu).querySelector("li:last-child");if(anchor){this.popupAnchor=anchor;}await this.setPopupOpen(true);}},async onSelectPopup(key){await this.setPopupOpen(false);await this.doSelectItem(key);},async onClosePopup(){await this.setPopupOpen(false);},async setPopupOpen(value){if(value){this.focusedPopupMenuItemKey="";}else{this.initPopupNavigationIndex=true;}this.popupOpen=value;await this.$nextTick();},updateOverflowIndex(index){this.overflowIndex=calcOverflowIndexFromIndex(index);},onKeyUp(event){if(preventKeys.includes(event.key)){event.preventDefault();}},doHandleMenuTabKey(action){if(this.hasOverflow()){if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex+1===this.visibleItems.length){return true;}if(action===MenuAction.MOVE_PREV&&this.currentFocusedItemIndex-1===-1){return true;}}else{if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex+1===this.items.length){return true;}if(action===MenuAction.MOVE_PREV&&this.currentFocusedItemIndex-1===-1){return true;}}return false;},async doHandlePopupMenuTabKey(action){if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex+1===this.items.length){await this.setPopupOpen(false);return true;}else if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex===this.overflowIndex){if(this.initPopupNavigationIndex){this.initPopupNavigationIndex=!this.initPopupNavigationIndex;this.setCurrentFocusedItemIndex(this.overflowIndex-1);return false;}}else if(action===MenuAction.MOVE_PREV&&this.currentFocusedItemIndex===this.overflowIndex){await this.setPopupOpen(false);this.setCurrentFocusedItemIndex(this.overflowIndex-1);return false;}return false;},setCurrentFocusedItemIndex(value){this.currentFocusedItemIndex=value;},doInitPopupNavigationIndex(event){if(keyDown.includes(event.key)||event.key==="Tab"){this.setCurrentFocusedItemIndex(this.overflowIndex-1);}else if(keyUp.includes(event.key)){this.setCurrentFocusedItemIndex(this.items.length+1);}},async onKeyDown(event){if(event.key==="Escape"){await this.setPopupOpen(false);return;}let action=actionFromKeyboardEvent(event);if(action===null){return;}if(!this.popupOpen){if(event.key==="Tab"&&this.doHandleMenuTabKey(action)){return;}event.preventDefault();await doMenuAction(action,this,0,this.visibleItems.length);}else{if(event.key==="Tab"&&(await this.doHandlePopupMenuTabKey(action))){return;}event.preventDefault();if(action===MenuAction.ACTIVATE&&this.focusedPopupMenuItemKey===""){action=null;await this.setPopupOpen(false);return;}if(this.initPopupNavigationIndex&&arrowKeys.includes(event.key)){this.initPopupNavigationIndex=!this.initPopupNavigationIndex;this.doInitPopupNavigationIndex(event);}await doMenuAction(action,this,this.overflowIndex,this.items.length);}},async setFocusOnItem(index){var _a,_b;this.setFocusedItemIndex(index);if(!this.hasOverflow()||!this.popupOpen&&index<=this.overflowIndex){this.setFocusedMenuItemKey(((_a=this.visibleItems[index])==null?void 0:_a.key)||"");}else{await this.setFocusedPopupMenuItemKey(((_b=this.items[index])==null?void 0:_b.key)||"");}},hasOverflow(){return this.overflowIndex!==-1;},async activateItem(index){var _a,_b;if(!this.hasOverflow()||!this.popupOpen&&index<=this.overflowIndex){const key=((_a=this.visibleItems[index])==null?void 0:_a.key)||"";await this.setSelectedMenuItemKey(key);await this.onSelectMenu(key);}else{const key=((_b=this.items[index])==null?void 0:_b.key)||"";this.selectedPopupItemKey=key;await this.onSelectPopup(key);}},async activateInvisibleItem(item){await this.setSelectedMenuItemKey(menuMoreKey);await this.onSelectMenu(menuMoreKey);this.selectedPopupItemKey=item.key;await this.onSelectPopup(item.key);if(item.href){const anchor=document.createElement("a");anchor.href=item.href;if(item.target){anchor.target=item.target;}anchor.click();}},setFocusedItemIndex(index){if(index<0){return;}if(!this.popupOpen&&this.hasOverflow()&&index>this.overflowIndex){this.setCurrentFocusedItemIndex(this.overflowIndex);}else{this.setCurrentFocusedItemIndex(index);}},async setFocusedPopupMenuItemKey(key){this.focusedPopupMenuItemKey="";if(key!==""){await this.$nextTick();this.focusedPopupMenuItemKey=key;}},setFocusedMenuItemKey(key){this.focusedMenuItemKey=key;},async setSelectedMenuItemKey(key){this.selectedMenuItemKey="";if(key!==""){await this.$nextTick();this.selectedMenuItemKey=key;}}}});function _sfc_render$f(_ctx,_cache,$props,$setup,$data,$options){const _component_i_menu=resolveComponent("i-menu");const _component_i_popup_menu=resolveComponent("i-popup-menu");return openBlock(),createElementBlock("div",null,[createVNode(_component_i_menu,{ref:"menu",modelValue:_ctx.selectedMenuItemKey,"onUpdate:modelValue":_cache[0]||(_cache[0]=$event=>_ctx.selectedMenuItemKey=$event),items:_ctx.visibleItems,vertical:_ctx.vertical,"focused-item-key":_ctx.focusedMenuItemKey,"selected-menu-item-screen-reader-text":_ctx.selectedMenuItemSrText(),"has-menu-more-selected-items":_ctx.hasPopupMenuSelectedItems,"aria-label":_ctx.menuAriaLabel,onSelect:_ctx.onSelectMenu,onOverflow:_ctx.onOverflow,onKeyup:_ctx.onKeyUp,onKeydown:_ctx.onKeyDown},null,8,["modelValue","items","vertical","focused-item-key","selected-menu-item-screen-reader-text","has-menu-more-selected-items","aria-label","onSelect","onOverflow","onKeyup","onKeydown"]),createTextVNode(),createVNode(_component_i_popup_menu,{ref:"popupMenu",modelValue:_ctx.selectedPopupItemKey,"onUpdate:modelValue":_cache[1]||(_cache[1]=$event=>_ctx.selectedPopupItemKey=$event),"focused-item":_ctx.focusedPopupMenuItemKey,"onUpdate:focusedItem":_cache[2]||(_cache[2]=$event=>_ctx.focusedPopupMenuItemKey=$event),items:_ctx.popupItems,"is-open":_ctx.popupOpen,anchor:_ctx.popupAnchor,"selected-menu-item-screen-reader-text":_ctx.selectedMenuItemSrText(),"aria-label":_ctx.popupAriaLabel,onSelect:_ctx.onSelectPopup,onClose:_ctx.onClosePopup,onKeyup:_ctx.onKeyUp,onKeydown:_ctx.onKeyDown},null,8,["modelValue","focused-item","items","is-open","anchor","selected-menu-item-screen-reader-text","aria-label","onSelect","onClose","onKeyup","onKeydown"])]);}const FNavigationMenu=/* @__PURE__ */_export_sfc(_sfc_main$f,[["render",_sfc_render$f]]);const EVENTS=["online","offline"];const _sfc_main$e=defineComponent({name:"FOffline",components:{FIcon,IFlex,IFlexItem},data(){return{isOnline:navigator.onLine||false,role:"none",shouldNotRead:true};},created(){EVENTS.forEach(event=>{window.addEventListener(event,this.updateOnlineStatus);});},beforeUnmount(){EVENTS.forEach(event=>{window.removeEventListener(event,this.updateOnlineStatus);});},mounted(){document.body.prepend(getElementFromVueRef(this.$refs.offline));},methods:{updateOnlineStatus(event){switch(event.type){case"online":this.shouldNotRead=false;this.isOnline=true;break;case"offline":this.shouldNotRead=true;this.isOnline=false;break;default:this.shouldNotRead=true;this.isOnline=false;break;}this.role="alert";}}});const _hoisted_1$d=["role"];const _hoisted_2$9={key:0,class:"offline"};const _hoisted_3$7={class:"icon-stack icon-stack--error"};const _hoisted_4$5={class:"offline__content"};const _hoisted_5$5=["aria-hidden"];function _sfc_render$e(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");const _component_i_flex_item=resolveComponent("i-flex-item");const _component_i_flex=resolveComponent("i-flex");return openBlock(),createElementBlock("div",{ref:"offline",class:"offline__wrapper",role:_ctx.role},[!_ctx.isOnline?(openBlock(),createElementBlock("div",_hoisted_2$9,[createVNode(_component_i_flex,{gap:"2x"},{default:withCtx(()=>[createVNode(_component_i_flex_item,{class:"offline__icon",shrink:"",align:"center"},{default:withCtx(()=>[createElementVNode("span",_hoisted_3$7,[createVNode(_component_f_icon,{name:"triangle"}),createTextVNode(),createVNode(_component_f_icon,{name:"alert"})])]),_:1/* STABLE */}),createTextVNode(),createVNode(_component_i_flex_item,{class:"offline_content",grow:"",align:"center"},{default:withCtx(()=>[createElementVNode("p",_hoisted_4$5,[renderSlot(_ctx.$slots,"default",{},()=>[createTextVNode(" Det verkar som att du inte har någon internetuppkoppling just nu ")])])]),_:3/* FORWARDED */})]),_:3/* FORWARDED */})])):createCommentVNode("v-if",true),createTextVNode(),withDirectives(createElementVNode("span",{class:"sr-only","aria-hidden":_ctx.shouldNotRead?"true":void 0},"\n Din internetuppkoppling fungerar igen\n ",8,_hoisted_5$5),[[vShow,_ctx.isOnline]])],8,_hoisted_1$d);}const FOffline=/* @__PURE__ */_export_sfc(_sfc_main$e,[["render",_sfc_render$e]]);const _sfc_main$d=defineComponent({name:"FOutputField",components:{FLabel},inheritAttrs:false,props:{/**
697
722
  * Associate the output field with one or more id's of the elements
698
723
  * contributing or affecting the result of this field. Multiple id's can
699
724
  * be set with a space-separated string or an array of strings.
@@ -747,7 +772,7 @@ onItemFocus(event){if(event&&event.target){event.target.style.position="relative
747
772
  /* it should contain a default value of undefined and proptype should
748
773
  /* include undefined (see comment on line above) */modelValue:{type:anyType,required:false},/**
749
774
  * The value for the input.
750
- */value:{type:anyType,required:true}},emits:["change","update:modelValue"],setup(){return{sharedName:inject("sharedName",void 0),showDetails:inject("showDetails","never"),getFieldsetLabelText:inject("getFieldsetLabelText",()=>"")};},data(){return{height:0,initialStyle:{overflow:"hidden",transition:"height 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96)"},hiddenStyle:{height:"auto",position:"absolute",visibility:"hidden"},visibleStyle:{width:"",position:"",visibility:"",height:"0px"},openedStyle:{height:"auto"}};},computed:{attrs(){var _this$sharedName;return{...this.$attrs,value:this.value,checked:this.value===this.modelValue,name:(_this$sharedName=this.sharedName)!==null&&_this$sharedName!==void 0?_this$sharedName:this.$attrs.name,onChange:event=>{if(event.target instanceof HTMLInputElement){this.$emit("update:modelValue",this.value);this.$emit("change",this.value);}},onInput:event=>{event.target.focus();}};},disabledClass(){return this.disabled?"disabled":"";}},methods:{async onValidity({detail}){if(detail.target!==this.$el.querySelector("input")){return;}await this.$nextTick();let errorMessage="";if(hasSlot(this,"default")){const labelText=this.getFieldsetLabelText();if(labelText){errorMessage=`${labelText} ${renderSlotText(this.$slots.default)}`;}else{errorMessage=`${renderSlotText(this.$slots.default)}`;}}const element=this.$el.querySelector(`#${detail.elementId}`);if(element){dispatchComponentValidityEvent(element,{...detail,errorMessage,focusElementId:detail.elementId});}},enter(element){const htmlElement=getHTMLElementFromVueRef(element);const computedStyle=getComputedStyle(element);Object.assign(htmlElement.style,this.initialStyle);Object.assign(htmlElement.style,this.hiddenStyle);htmlElement.style.width=computedStyle.width;const height=computedStyle.height;Object.assign(htmlElement.style,this.visibleStyle);getComputedStyle(element).height;setTimeout(()=>{this.height=parseInt(height,10);htmlElement.style.height=height;});},afterEnter(element){const htmlElement=getHTMLElementFromVueRef(element);Object.assign(htmlElement.style,this.openedStyle);},leave(element){const htmlElement=getHTMLElementFromVueRef(element);const height=getComputedStyle(element).height;htmlElement.style.height=height;getComputedStyle(element).height;setTimeout(()=>{Object.assign(htmlElement.style,this.visibleStyle);});}}});const _hoisted_1$8=["id","disabled"];const _hoisted_2$5=["for"];const _hoisted_3$4={key:0,class:"radio-button__details"};const _hoisted_4$3=/* @__PURE__ */createElementVNode("br",null,null,-1/* HOISTED */);const _hoisted_5$3={key:0,class:"radio-button__details"};const _hoisted_6$3=/* @__PURE__ */createElementVNode("br",null,null,-1/* HOISTED */);function _sfc_render$9(_ctx,_cache,$props,$setup,$data,$options){return openBlock(),createElementBlock("div",{class:normalizeClass(["radio-button",_ctx.disabledClass]),onValidity:_cache[0]||(_cache[0]=(...args)=>_ctx.onValidity&&_ctx.onValidity(...args))},[createElementVNode("input",mergeProps({id:_ctx.id,type:"radio",class:"radio-button__input",disabled:_ctx.disabled},_ctx.attrs),null,16,_hoisted_1$8),createTextVNode(),createElementVNode("label",{class:normalizeClass(_ctx.$slots.details?"radio-button__label radio-button__width":"radio-button__label"),for:_ctx.id},[renderSlot(_ctx.$slots,"default"),createTextVNode(),_ctx.$slots.details?(openBlock(),createElementBlock(Fragment,{key:0},[_ctx.showDetails==="always"?(openBlock(),createElementBlock("span",_hoisted_3$4,[_hoisted_4$3,createTextVNode(),renderSlot(_ctx.$slots,"details")])):createCommentVNode("v-if",true),createTextVNode(),_ctx.showDetails==="when-selected"?(openBlock(),createBlock(Transition,{key:1,onEnter:_ctx.enter,onAfterEnter:_ctx.afterEnter,onLeave:_ctx.leave},{default:withCtx(()=>[_ctx.value===_ctx.modelValue?(openBlock(),createElementBlock("span",_hoisted_5$3,[_hoisted_6$3,createTextVNode(),renderSlot(_ctx.$slots,"details",{height:_ctx.height})])):createCommentVNode("v-if",true)]),_:3/* FORWARDED */},8,["onEnter","onAfterEnter","onLeave"])):createCommentVNode("v-if",true)],64/* STABLE_FRAGMENT */)):createCommentVNode("v-if",true)],10,_hoisted_2$5)],34/* CLASS, NEED_HYDRATION */);}const FRadioField=/* @__PURE__ */_export_sfc(_sfc_main$9,[["render",_sfc_render$9]]);const _sfc_main$8=defineComponent({name:"FRadioGroup",components:{FFieldset},inheritAttrs:false,props:{/**
775
+ */value:{type:anyType,required:true}},emits:["change","update:modelValue"],setup(){const{sharedName,showDetails,getFieldsetLabelText}=useFieldset();return{sharedName,showDetails,getFieldsetLabelText};},data(){return{height:0,initialStyle:{overflow:"hidden",transition:"height 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96)"},hiddenStyle:{height:"auto",position:"absolute",visibility:"hidden"},visibleStyle:{width:"",position:"",visibility:"",height:"0px"},openedStyle:{height:"auto"}};},computed:{attrs(){var _this$sharedName;return{...this.$attrs,value:this.value,checked:this.value===this.modelValue,name:(_this$sharedName=this.sharedName)!==null&&_this$sharedName!==void 0?_this$sharedName:this.$attrs.name,onChange:event=>{if(event.target instanceof HTMLInputElement){this.$emit("update:modelValue",this.value);this.$emit("change",this.value);}},onInput:event=>{event.target.focus();}};},disabledClass(){return this.disabled?"disabled":"";}},methods:{async onValidity({detail}){if(detail.target!==this.$el.querySelector("input")){return;}await this.$nextTick();let errorMessage="";if(hasSlot(this,"default")){const labelText=this.getFieldsetLabelText();if(labelText){errorMessage=`${labelText} ${renderSlotText(this.$slots.default)}`;}else{errorMessage=`${renderSlotText(this.$slots.default)}`;}}const element=this.$el.querySelector(`#${detail.elementId}`);if(element){dispatchComponentValidityEvent(element,{...detail,errorMessage,focusElementId:detail.elementId});}},enter(element){const htmlElement=getHTMLElementFromVueRef(element);const computedStyle=getComputedStyle(element);Object.assign(htmlElement.style,this.initialStyle);Object.assign(htmlElement.style,this.hiddenStyle);htmlElement.style.width=computedStyle.width;const height=computedStyle.height;Object.assign(htmlElement.style,this.visibleStyle);getComputedStyle(element).height;setTimeout(()=>{this.height=parseInt(height,10);htmlElement.style.height=height;});},afterEnter(element){const htmlElement=getHTMLElementFromVueRef(element);Object.assign(htmlElement.style,this.openedStyle);},leave(element){const htmlElement=getHTMLElementFromVueRef(element);const height=getComputedStyle(element).height;htmlElement.style.height=height;getComputedStyle(element).height;setTimeout(()=>{Object.assign(htmlElement.style,this.visibleStyle);});}}});const _hoisted_1$8=["id","disabled"];const _hoisted_2$5=["for"];const _hoisted_3$4={key:0,class:"radio-button__details"};const _hoisted_4$3=/* @__PURE__ */createElementVNode("br",null,null,-1/* HOISTED */);const _hoisted_5$3={key:0,class:"radio-button__details"};const _hoisted_6$3=/* @__PURE__ */createElementVNode("br",null,null,-1/* HOISTED */);function _sfc_render$9(_ctx,_cache,$props,$setup,$data,$options){return openBlock(),createElementBlock("div",{class:normalizeClass(["radio-button",_ctx.disabledClass]),onValidity:_cache[0]||(_cache[0]=(...args)=>_ctx.onValidity&&_ctx.onValidity(...args))},[createElementVNode("input",mergeProps({id:_ctx.id,type:"radio",class:"radio-button__input",disabled:_ctx.disabled},_ctx.attrs),null,16,_hoisted_1$8),createTextVNode(),createElementVNode("label",{class:normalizeClass(_ctx.$slots.details?"radio-button__label radio-button__width":"radio-button__label"),for:_ctx.id},[renderSlot(_ctx.$slots,"default"),createTextVNode(),_ctx.$slots.details?(openBlock(),createElementBlock(Fragment,{key:0},[_ctx.showDetails==="always"?(openBlock(),createElementBlock("span",_hoisted_3$4,[_hoisted_4$3,createTextVNode(),renderSlot(_ctx.$slots,"details")])):createCommentVNode("v-if",true),createTextVNode(),_ctx.showDetails==="when-selected"?(openBlock(),createBlock(Transition,{key:1,onEnter:_ctx.enter,onAfterEnter:_ctx.afterEnter,onLeave:_ctx.leave},{default:withCtx(()=>[_ctx.value===_ctx.modelValue?(openBlock(),createElementBlock("span",_hoisted_5$3,[_hoisted_6$3,createTextVNode(),renderSlot(_ctx.$slots,"details",{height:_ctx.height})])):createCommentVNode("v-if",true)]),_:3/* FORWARDED */},8,["onEnter","onAfterEnter","onLeave"])):createCommentVNode("v-if",true)],64/* STABLE_FRAGMENT */)):createCommentVNode("v-if",true)],10,_hoisted_2$5)],34/* CLASS, NEED_HYDRATION */);}const FRadioField=/* @__PURE__ */_export_sfc(_sfc_main$9,[["render",_sfc_render$9]]);const _sfc_main$8=defineComponent({name:"FRadioGroup",components:{FFieldset},inheritAttrs:false,props:{/**
751
776
  * The id for the fieldset id attribute.
752
777
  * If the prop is not set the id will be generated.
753
778
  */id:{type:String,required:false,default:()=>ElementIdService.generateElementId()},/**
@@ -797,7 +822,7 @@ onItemFocus(event){if(event&&event.target){event.target.style.position="relative
797
822
  * @event collapse
798
823
  * @param row
799
824
  * @type {ListItem}
800
- */"collapse"],setup(props,context){const sortFilterDatasetInjected=FSortFilterDatasetInjected();const activateItemInjected=ActivateItemInjected();const expandableTable=useExpandableTable(props.expandableAttribute,props.keyAttribute,props.expandableDescribedby,context.emit,context.slots);return{...sortFilterDatasetInjected,...activateItemInjected,...expandableTable};},data(){return{activeRow:void 0,columns:[],emptyRow:emptyTableRow(),selectedRows:[],tr:[]};},computed:{hasCaption(){return hasSlot(this,"caption");},hasCheckboxDescription(){return hasSlot(this,"checkbox-description",{row:this.emptyRow});},hasInitiateColumns(){return this.columns.length>0;},isEmpty(){return this.rows.length===0;},visibleColumns(){return this.columns.filter(col=>col.visible);},tableClasses(){const classes=[];if(this.selectable){classes.push("table--selectable");}if(this.hover){classes.push("table--hover");}return classes;},tableRole(){return this.isExpandableTable?"treegrid":"grid";},wrapperClasses(){return tableScrollClasses(this.scroll);},nbOfColumns(){let columnCount=this.columns.length;if(this.selectable){columnCount++;}if(this.isExpandableTable){columnCount++;}return columnCount;}},watch:{rows:{immediate:true,deep:true,handler:function(){if(this.modelValue){this.selectedRows=this.modelValue.filter(row=>{return includeItem(row,this.rows,this.keyAttribute);});}}}},updated(){const tbodyElement=this.$refs["tbodyElement"];const trElements=[].slice.call(tbodyElement.children);const trInteractableElements=trElements.filter(tr=>{return tr.tabIndex===0;});this.tr=trInteractableElements;},mounted(){this.registerCallbackOnSort(this.callbackOnSort);this.registerCallbackOnMount(this.callbackSortableColumns);this.registerCallbackAfterItemAdd(this.callbackAfterItemAdd);this.registerCallbackBeforeItemDelete(this.callbackBeforeItemDelete);},methods:{isActive(row){return itemEquals(row,this.activeRow,this.keyAttribute);},isSelected(row){return includeItem(row,this.selectedRows,this.keyAttribute);},onKeydownExpandable(event,index){if(event.key===" "||event.key==="Spacebar"){event.preventDefault();return;}onKeydown.call(this,event,index);},onKeydown(event,index){onKeydown.call(this,event,index);},onClick(event,row){const{target}=event;const isRelevant=["TD","TH"].includes(target.nodeName);if(isRelevant){const parent=target.parentElement;this.activate(row,parent);}},activate(row,tr){this.$emit("click",row);if(this.isExpandableTable&&this.hasExpandableContent(row)){this.toggleExpanded(row);}if(!itemEquals(row,this.activeRow,this.keyAttribute)){this.$emit("change",row);this.activeRow=row;if(tr){tr.focus();const td=tr.children[0];forceRepaintIE11(td);}}},rowDescription(row){const slot=this.$slots["row-description"];return renderSlotText(slot,{row});},onSelect(row){if(includeItem(row,this.selectedRows,this.keyAttribute)){this.selectedRows=this.selectedRows.filter(i=>!itemEquals(i,row,this.keyAttribute));this.$emit("unselect",row);}else{this.selectedRows.push(row);this.$emit("select",row);}this.updateVModelWithSelectedRows();this.$forceUpdate();},updateVModelWithSelectedRows(){if(this.modelValue){this.$emit("update:modelValue",this.selectedRows);this.$emit("update",this.selectedRows);}},rowClasses(row,index){const active=this.isActive(row)?["table__row--active"]:[];const selected=this.isSelected(row)?["table__row--selected"]:[];const isExpandableRow=this.isExpandableTable&&this.hasExpandableContent(row);const expandable=isExpandableRow?["table__row--expandable"]:[];const expanded=this.isExpanded(row)?["table__row--expanded-border"]:[];const striped=this.striped&&index%2!==0?["table__row--striped"]:[];return["table__row",...active,...selected,...striped,...expandable,...expanded];},rowKey(row){const key=row[this.keyAttribute];if(typeof key==="undefined"){throw new Error(`Key attribute [${this.keyAttribute}]' is missing in row`);}return String(key);},columnClasses(column){const sortable=column.sortable?["table__column--sortable"]:[];return["table__column",`table__column--${column.type}`,...sortable,column.size];},iconClasses(column){return getSortableIconClasses(column);},iconName(column){return getSortableIconName(column);},onClickColumnHeader(column){if(!column.sortable){return;}let columnName=column.name;if(column.sort===FTableColumnSort.DESCENDING){columnName="";column.sort=FTableColumnSort.UNSORTED;}this.sort(columnName,column.sort!==FTableColumnSort.ASCENDING);},callbackOnSort(columnName,ascending){updateSortOrder(this.columns,columnName,ascending);},callbackSortableColumns(columnNames){setSortableColumns(this.columns,columnNames);},callbackAfterItemAdd(item){this.activate(item,null);},callbackBeforeItemDelete(item){if(this.rows.length===0){return;}let targetIndex=this.rows.indexOf(item)-1;if(targetIndex<0&&this.rows.length>1){targetIndex=1;}else if(targetIndex<0){targetIndex=0;}this.activate(this.rows[targetIndex],this.tr[targetIndex]);},escapeNewlines(value){return value.replace(/\n/g,"<br/>");}}});const _hoisted_1$6=["role"];const _hoisted_2$3={key:0};const _hoisted_3$3={key:0,class:"table__column--shrink"};const _hoisted_4$2={key:1,class:"table__column--shrink"};const _hoisted_5$2={class:"table__row"};const _hoisted_6$2={key:0,scope:"col"};const _hoisted_7$2={class:"sr-only"};const _hoisted_8$2={key:1,scope:"col"};const _hoisted_9$2={class:"sr-only"};const _hoisted_10$2=["innerHTML"];const _hoisted_11$1={key:1,class:"table__column__description"};const _hoisted_12$1={ref:"tbodyElement"};const _hoisted_13$1=["aria-label","aria-expanded","aria-level","aria-describedby","onKeydown","onClick"];const _hoisted_14$1={key:0};const _hoisted_15$1={key:0,class:"table__expand-icon"};const _hoisted_16={key:1,class:"table__column--selectable"};const _hoisted_17={class:"table__input"};const _hoisted_18={key:0,class:"sr-only"};const _hoisted_19=/* @__PURE__ */createElementVNode("td",null,null,-1/* HOISTED */);const _hoisted_20={key:0,class:"table__column--selectable"};const _hoisted_21=["colspan"];const _hoisted_22={key:0};const _hoisted_23={hidden:""};const _hoisted_24=["colspan"];function _sfc_render$6(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");const _component_f_checkbox_field=resolveComponent("f-checkbox-field");return openBlock(),createElementBlock("div",{class:normalizeClass(_ctx.wrapperClasses)},[createElementVNode("table",mergeProps({class:["table",_ctx.tableClasses],role:_ctx.tableRole},_ctx.$attrs),[_ctx.hasCaption?(openBlock(),createElementBlock("caption",_hoisted_2$3,[renderSlot(_ctx.$slots,"caption")])):createCommentVNode("v-if",true),createTextVNode(),createElementVNode("colgroup",null,[_ctx.isExpandableTable?(openBlock(),createElementBlock("col",_hoisted_3$3)):createCommentVNode("v-if",true),createTextVNode(),_ctx.selectable?(openBlock(),createElementBlock("col",_hoisted_4$2)):createCommentVNode("v-if",true),createTextVNode(),(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.columns,column=>{return openBlock(),createElementBlock("col",{key:column.id,class:normalizeClass(column.size)},null,2/* CLASS */);}),128/* KEYED_FRAGMENT */))]),createTextVNode(),createElementVNode("thead",null,[createElementVNode("tr",_hoisted_5$2,[_ctx.isExpandableTable?(openBlock(),createElementBlock("th",_hoisted_6$2,[createElementVNode("span",_hoisted_7$2,toDisplayString(_ctx.$t("fkui.interactive-table.select","Expandera")),1/* TEXT */)])):createCommentVNode("v-if",true),createTextVNode(),_ctx.selectable?(openBlock(),createElementBlock("th",_hoisted_8$2,[createElementVNode("span",_hoisted_9$2,toDisplayString(_ctx.$t("fkui.interactive-table.select","Markera")),1/* TEXT */)])):createCommentVNode("v-if",true),createTextVNode(),(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.visibleColumns,column=>{return openBlock(),createElementBlock("th",mergeProps({key:column.id,scope:"col",class:_ctx.columnClasses(column)},toHandlers(column.sortable?{click:()=>_ctx.onClickColumnHeader(column)}:{},true)),[createElementVNode("span",{innerHTML:_ctx.escapeNewlines(column.title)},null,8,_hoisted_10$2),createTextVNode(),column.sortable?(openBlock(),createBlock(_component_f_icon,{key:0,class:normalizeClass(_ctx.iconClasses(column)),name:_ctx.iconName(column)},null,8,["class","name"])):createCommentVNode("v-if",true),createTextVNode(),column.description?(openBlock(),createElementBlock("span",_hoisted_11$1,toDisplayString(column.description),1/* TEXT */)):createCommentVNode("v-if",true)],16/* FULL_PROPS */);}),128/* KEYED_FRAGMENT */))])]),createTextVNode(),createElementVNode("tbody",_hoisted_12$1,[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.rows,(row,index)=>{return openBlock(),createElementBlock(Fragment,{key:_ctx.rowKey(row)},[createElementVNode("tr",{class:normalizeClass(_ctx.rowClasses(row,index)),"aria-label":_ctx.rowDescription(row),"aria-expanded":_ctx.rowAriaExpanded(row),"aria-level":_ctx.isExpandableTable?1:void 0,"aria-describedby":_ctx.getExpandableDescribedby(row),tabindex:"0",onKeydown:withModifiers($event=>_ctx.onKeydown($event,index),["self"]),onClick:$event=>_ctx.onClick($event,row,index)},[_ctx.isExpandableTable?(openBlock(),createElementBlock("td",_hoisted_14$1,[_ctx.hasExpandableContent(row)?(openBlock(),createElementBlock("div",_hoisted_15$1,[createVNode(_component_f_icon,{name:"arrow-right",rotate:_ctx.isExpanded(row)?"270":"90"},null,8,["rotate"])])):createCommentVNode("v-if",true)])):createCommentVNode("v-if",true),createTextVNode(),_ctx.selectable?(openBlock(),createElementBlock("td",_hoisted_16,[createElementVNode("div",_hoisted_17,[createVNode(_component_f_checkbox_field,{value:true,"model-value":_ctx.isSelected(row),onClick:withModifiers($event=>_ctx.onSelect(row),["self"])},{default:withCtx(()=>[_ctx.hasCheckboxDescription?(openBlock(),createElementBlock("span",_hoisted_18,[renderSlot(_ctx.$slots,"checkbox-description",mergeProps({ref_for:true},{row}))])):createCommentVNode("v-if",true)]),_:2/* DYNAMIC */},1032,["model-value","onClick"])])])):createCommentVNode("v-if",true),createTextVNode(),renderSlot(_ctx.$slots,"default",mergeProps({ref_for:true},{row}))],42,_hoisted_13$1),createTextVNode(),_ctx.isExpandableTable&&_ctx.hasExpandableContent(row)?(openBlock(true),createElementBlock(Fragment,{key:0},renderList(_ctx.expandableRows(row),(expandableRow,expandableIndex)=>{return openBlock(),createElementBlock("tr",{key:_ctx.rowKey(expandableRow),"aria-level":"2",class:normalizeClass(_ctx.expandableRowClasses(row,expandableIndex))},[_hoisted_19,createTextVNode(),_ctx.selectable?(openBlock(),createElementBlock("td",_hoisted_20)):createCommentVNode("v-if",true),createTextVNode(),!_ctx.hasExpandableSlot?(openBlock(true),createElementBlock(Fragment,{key:1},renderList(_ctx.columns,(column,columnIndex)=>{return openBlock(),createElementBlock("td",{key:`${_ctx.rowKey(expandableRow)}${column.name}`,class:normalizeClass(_ctx.expandableColumnClasses(column,columnIndex))},toDisplayString(expandableRow[column.name]),3/* TEXT, CLASS */);}),128/* KEYED_FRAGMENT */)):(openBlock(),createElementBlock("td",{key:2,class:"table__column table__column--indented",colspan:_ctx.columns.length},[renderSlot(_ctx.$slots,"expandable",mergeProps({ref_for:true},{expandableRow,parentRow:row}))],8,_hoisted_21))],2/* CLASS */);}),128/* KEYED_FRAGMENT */)):createCommentVNode("v-if",true)],64/* STABLE_FRAGMENT */);}),128/* KEYED_FRAGMENT */)),createTextVNode(),!_ctx.hasInitiateColumns?(openBlock(),createElementBlock("tr",_hoisted_22,[renderSlot(_ctx.$slots,"default",normalizeProps(guardReactiveProps({row:_ctx.emptyRow})))])):createCommentVNode("v-if",true),createTextVNode(),_ctx.isEmpty?(openBlock(),createElementBlock(Fragment,{key:1},[withDirectives(createElementVNode("tr",_hoisted_23,[renderSlot(_ctx.$slots,"default",normalizeProps(guardReactiveProps({row:_ctx.emptyRow})))],512/* NEED_PATCH */),[[vShow,false]]),createTextVNode(),createElementVNode("tr",null,[createElementVNode("td",{class:"table__column table__column--action",colspan:_ctx.nbOfColumns},[renderSlot(_ctx.$slots,"empty",{},()=>[createTextVNode(toDisplayString(_ctx.$t("fkui.interactive-table.empty","Tabellen är tom")),1/* TEXT */)])],8,_hoisted_24)])],64/* STABLE_FRAGMENT */)):createCommentVNode("v-if",true)],512/* NEED_PATCH */)],16,_hoisted_1$6)],2/* CLASS */);}const FInteractiveTable=/* @__PURE__ */_export_sfc(_sfc_main$6,[["render",_sfc_render$6]]);const _sfc_main$5=defineComponent({name:"FTextareaField",components:{FLabel},inheritAttrs:false,props:{/**
825
+ */"collapse"],setup(props,context){const sortFilterDatasetInjected=FSortFilterDatasetInjected();const activateItemInjected=ActivateItemInjected();const expandableTable=useExpandableTable(props.expandableAttribute,props.keyAttribute,props.expandableDescribedby,context.emit,context.slots);return{...sortFilterDatasetInjected,...activateItemInjected,...expandableTable};},data(){return{activeRow:void 0,columns:[],emptyRow:emptyTableRow(),selectedRows:[],tr:[]};},computed:{hasCaption(){return hasSlot(this,"caption",{},{stripClasses:[]});},hasCheckboxDescription(){return hasSlot(this,"checkbox-description",{row:this.emptyRow});},hasInitiateColumns(){return this.columns.length>0;},isEmpty(){return this.rows.length===0;},visibleColumns(){return this.columns.filter(col=>col.visible);},tableClasses(){const classes=[];if(this.selectable){classes.push("table--selectable");}if(this.hover){classes.push("table--hover");}return classes;},tableRole(){return this.isExpandableTable?"treegrid":"grid";},wrapperClasses(){return tableScrollClasses(this.scroll);},nbOfColumns(){let columnCount=this.columns.length;if(this.selectable){columnCount++;}if(this.isExpandableTable){columnCount++;}return columnCount;}},watch:{rows:{immediate:true,deep:true,handler:function(){if(this.modelValue){this.selectedRows=this.modelValue.filter(row=>{return includeItem(row,this.rows,this.keyAttribute);});}}}},updated(){const tbodyElement=this.$refs["tbodyElement"];const trElements=[].slice.call(tbodyElement.children);const trInteractableElements=trElements.filter(tr=>{return tr.tabIndex===0;});this.tr=trInteractableElements;},mounted(){this.registerCallbackOnSort(this.callbackOnSort);this.registerCallbackOnMount(this.callbackSortableColumns);this.registerCallbackAfterItemAdd(this.callbackAfterItemAdd);this.registerCallbackBeforeItemDelete(this.callbackBeforeItemDelete);},methods:{isActive(row){return itemEquals(row,this.activeRow,this.keyAttribute);},isSelected(row){return includeItem(row,this.selectedRows,this.keyAttribute);},onKeydownExpandable(event,index){if(event.key===" "||event.key==="Spacebar"){event.preventDefault();return;}onKeydown.call(this,event,index);},onKeydown(event,index){onKeydown.call(this,event,index);},onClick(event,row){const{target}=event;const isRelevant=["TD","TH"].includes(target.nodeName);if(isRelevant){const parent=target.parentElement;this.activate(row,parent);}},activate(row,tr){this.$emit("click",row);if(this.isExpandableTable&&this.hasExpandableContent(row)){this.toggleExpanded(row);}if(!itemEquals(row,this.activeRow,this.keyAttribute)){this.$emit("change",row);this.activeRow=row;if(tr){tr.focus();const td=tr.children[0];forceRepaintIE11(td);}}},rowDescription(row){const slot=this.$slots["row-description"];return renderSlotText(slot,{row});},onSelect(row){if(includeItem(row,this.selectedRows,this.keyAttribute)){this.selectedRows=this.selectedRows.filter(i=>!itemEquals(i,row,this.keyAttribute));this.$emit("unselect",row);}else{this.selectedRows.push(row);this.$emit("select",row);}this.updateVModelWithSelectedRows();this.$forceUpdate();},updateVModelWithSelectedRows(){if(this.modelValue){this.$emit("update:modelValue",this.selectedRows);this.$emit("update",this.selectedRows);}},rowClasses(row,index){const active=this.isActive(row)?["table__row--active"]:[];const selected=this.isSelected(row)?["table__row--selected"]:[];const isExpandableRow=this.isExpandableTable&&this.hasExpandableContent(row);const expandable=isExpandableRow?["table__row--expandable"]:[];const expanded=this.isExpanded(row)?["table__row--expanded-border"]:[];const striped=this.striped&&index%2!==0?["table__row--striped"]:[];return["table__row",...active,...selected,...striped,...expandable,...expanded];},rowKey(row){const key=row[this.keyAttribute];if(typeof key==="undefined"){throw new Error(`Key attribute [${this.keyAttribute}]' is missing in row`);}return String(key);},columnClasses(column){const sortable=column.sortable?["table__column--sortable"]:[];return["table__column",`table__column--${column.type}`,...sortable,column.size];},iconClasses(column){return getSortableIconClasses(column);},iconName(column){return getSortableIconName(column);},onClickColumnHeader(column){if(!column.sortable){return;}let columnName=column.name;if(column.sort===FTableColumnSort.DESCENDING){columnName="";column.sort=FTableColumnSort.UNSORTED;}this.sort(columnName,column.sort!==FTableColumnSort.ASCENDING);},callbackOnSort(columnName,ascending){updateSortOrder(this.columns,columnName,ascending);},callbackSortableColumns(columnNames){setSortableColumns(this.columns,columnNames);},callbackAfterItemAdd(item){this.activate(item,null);},callbackBeforeItemDelete(item){if(this.rows.length===0){return;}let targetIndex=this.rows.indexOf(item)-1;if(targetIndex<0&&this.rows.length>1){targetIndex=1;}else if(targetIndex<0){targetIndex=0;}this.activate(this.rows[targetIndex],this.tr[targetIndex]);},escapeNewlines(value){return value.replace(/\n/g,"<br/>");}}});const _hoisted_1$6=["role"];const _hoisted_2$3={key:0};const _hoisted_3$3={key:0,class:"table__column--shrink"};const _hoisted_4$2={key:1,class:"table__column--shrink"};const _hoisted_5$2={class:"table__row"};const _hoisted_6$2={key:0,scope:"col"};const _hoisted_7$2={class:"sr-only"};const _hoisted_8$2={key:1,scope:"col"};const _hoisted_9$2={class:"sr-only"};const _hoisted_10$2=["innerHTML"];const _hoisted_11$1={key:1,class:"table__column__description"};const _hoisted_12$1={ref:"tbodyElement"};const _hoisted_13$1=["aria-label","aria-expanded","aria-level","aria-describedby","onKeydown","onClick"];const _hoisted_14$1={key:0};const _hoisted_15$1={key:0,class:"table__expand-icon"};const _hoisted_16={key:1,class:"table__column--selectable"};const _hoisted_17={class:"table__input"};const _hoisted_18={key:0,class:"sr-only"};const _hoisted_19=/* @__PURE__ */createElementVNode("td",null,null,-1/* HOISTED */);const _hoisted_20={key:0,class:"table__column--selectable"};const _hoisted_21=["colspan"];const _hoisted_22={key:0};const _hoisted_23={hidden:""};const _hoisted_24=["colspan"];function _sfc_render$6(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");const _component_f_checkbox_field=resolveComponent("f-checkbox-field");return openBlock(),createElementBlock("div",{class:normalizeClass(_ctx.wrapperClasses)},[createElementVNode("table",mergeProps({class:["table",_ctx.tableClasses],role:_ctx.tableRole},_ctx.$attrs),[_ctx.hasCaption?(openBlock(),createElementBlock("caption",_hoisted_2$3,[renderSlot(_ctx.$slots,"caption")])):createCommentVNode("v-if",true),createTextVNode(),createElementVNode("colgroup",null,[_ctx.isExpandableTable?(openBlock(),createElementBlock("col",_hoisted_3$3)):createCommentVNode("v-if",true),createTextVNode(),_ctx.selectable?(openBlock(),createElementBlock("col",_hoisted_4$2)):createCommentVNode("v-if",true),createTextVNode(),(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.columns,column=>{return openBlock(),createElementBlock("col",{key:column.id,class:normalizeClass(column.size)},null,2/* CLASS */);}),128/* KEYED_FRAGMENT */))]),createTextVNode(),createElementVNode("thead",null,[createElementVNode("tr",_hoisted_5$2,[_ctx.isExpandableTable?(openBlock(),createElementBlock("th",_hoisted_6$2,[createElementVNode("span",_hoisted_7$2,toDisplayString(_ctx.$t("fkui.interactive-table.select","Expandera")),1/* TEXT */)])):createCommentVNode("v-if",true),createTextVNode(),_ctx.selectable?(openBlock(),createElementBlock("th",_hoisted_8$2,[createElementVNode("span",_hoisted_9$2,toDisplayString(_ctx.$t("fkui.interactive-table.select","Markera")),1/* TEXT */)])):createCommentVNode("v-if",true),createTextVNode(),(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.visibleColumns,column=>{return openBlock(),createElementBlock("th",mergeProps({key:column.id,scope:"col",class:_ctx.columnClasses(column)},toHandlers(column.sortable?{click:()=>_ctx.onClickColumnHeader(column)}:{},true)),[createElementVNode("span",{innerHTML:_ctx.escapeNewlines(column.title)},null,8,_hoisted_10$2),createTextVNode(),column.sortable?(openBlock(),createBlock(_component_f_icon,{key:0,class:normalizeClass(_ctx.iconClasses(column)),name:_ctx.iconName(column)},null,8,["class","name"])):createCommentVNode("v-if",true),createTextVNode(),column.description?(openBlock(),createElementBlock("span",_hoisted_11$1,toDisplayString(column.description),1/* TEXT */)):createCommentVNode("v-if",true)],16/* FULL_PROPS */);}),128/* KEYED_FRAGMENT */))])]),createTextVNode(),createElementVNode("tbody",_hoisted_12$1,[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.rows,(row,index)=>{return openBlock(),createElementBlock(Fragment,{key:_ctx.rowKey(row)},[createElementVNode("tr",{class:normalizeClass(_ctx.rowClasses(row,index)),"aria-label":_ctx.rowDescription(row),"aria-expanded":_ctx.rowAriaExpanded(row),"aria-level":_ctx.isExpandableTable?1:void 0,"aria-describedby":_ctx.getExpandableDescribedby(row),tabindex:"0",onKeydown:withModifiers($event=>_ctx.onKeydown($event,index),["self"]),onClick:$event=>_ctx.onClick($event,row,index)},[_ctx.isExpandableTable?(openBlock(),createElementBlock("td",_hoisted_14$1,[_ctx.hasExpandableContent(row)?(openBlock(),createElementBlock("div",_hoisted_15$1,[createVNode(_component_f_icon,{name:"arrow-right",rotate:_ctx.isExpanded(row)?"270":"90"},null,8,["rotate"])])):createCommentVNode("v-if",true)])):createCommentVNode("v-if",true),createTextVNode(),_ctx.selectable?(openBlock(),createElementBlock("td",_hoisted_16,[createElementVNode("div",_hoisted_17,[createVNode(_component_f_checkbox_field,{value:true,"model-value":_ctx.isSelected(row),onClick:withModifiers($event=>_ctx.onSelect(row),["self"])},{default:withCtx(()=>[_ctx.hasCheckboxDescription?(openBlock(),createElementBlock("span",_hoisted_18,[renderSlot(_ctx.$slots,"checkbox-description",mergeProps({ref_for:true},{row}))])):createCommentVNode("v-if",true)]),_:2/* DYNAMIC */},1032,["model-value","onClick"])])])):createCommentVNode("v-if",true),createTextVNode(),renderSlot(_ctx.$slots,"default",mergeProps({ref_for:true},{row}))],42,_hoisted_13$1),createTextVNode(),_ctx.isExpandableTable&&_ctx.hasExpandableContent(row)?(openBlock(true),createElementBlock(Fragment,{key:0},renderList(_ctx.expandableRows(row),(expandableRow,expandableIndex)=>{return openBlock(),createElementBlock("tr",{key:_ctx.rowKey(expandableRow),"aria-level":"2",class:normalizeClass(_ctx.expandableRowClasses(row,expandableIndex))},[_hoisted_19,createTextVNode(),_ctx.selectable?(openBlock(),createElementBlock("td",_hoisted_20)):createCommentVNode("v-if",true),createTextVNode(),!_ctx.hasExpandableSlot?(openBlock(true),createElementBlock(Fragment,{key:1},renderList(_ctx.columns,(column,columnIndex)=>{return openBlock(),createElementBlock("td",{key:`${_ctx.rowKey(expandableRow)}${column.name}`,class:normalizeClass(_ctx.expandableColumnClasses(column,columnIndex))},toDisplayString(expandableRow[column.name]),3/* TEXT, CLASS */);}),128/* KEYED_FRAGMENT */)):(openBlock(),createElementBlock("td",{key:2,class:"table__column table__column--indented",colspan:_ctx.columns.length},[renderSlot(_ctx.$slots,"expandable",mergeProps({ref_for:true},{expandableRow,parentRow:row}))],8,_hoisted_21))],2/* CLASS */);}),128/* KEYED_FRAGMENT */)):createCommentVNode("v-if",true)],64/* STABLE_FRAGMENT */);}),128/* KEYED_FRAGMENT */)),createTextVNode(),!_ctx.hasInitiateColumns?(openBlock(),createElementBlock("tr",_hoisted_22,[renderSlot(_ctx.$slots,"default",normalizeProps(guardReactiveProps({row:_ctx.emptyRow})))])):createCommentVNode("v-if",true),createTextVNode(),_ctx.isEmpty?(openBlock(),createElementBlock(Fragment,{key:1},[withDirectives(createElementVNode("tr",_hoisted_23,[renderSlot(_ctx.$slots,"default",normalizeProps(guardReactiveProps({row:_ctx.emptyRow})))],512/* NEED_PATCH */),[[vShow,false]]),createTextVNode(),createElementVNode("tr",null,[createElementVNode("td",{class:"table__column table__column--action",colspan:_ctx.nbOfColumns},[renderSlot(_ctx.$slots,"empty",{},()=>[createTextVNode(toDisplayString(_ctx.$t("fkui.interactive-table.empty","Tabellen är tom")),1/* TEXT */)])],8,_hoisted_24)])],64/* STABLE_FRAGMENT */)):createCommentVNode("v-if",true)],512/* NEED_PATCH */)],16,_hoisted_1$6)],2/* CLASS */);}const FInteractiveTable=/* @__PURE__ */_export_sfc(_sfc_main$6,[["render",_sfc_render$6]]);const _sfc_main$5=defineComponent({name:"FTextareaField",components:{FLabel},inheritAttrs:false,props:{/**
801
826
  * The id for the input id attribute.
802
827
  * The id for the label for attribute.
803
828
  * If the prop is not set a random value will be generated.
@@ -909,4 +934,4 @@ this.modelValue.length>=this.maxlength-this.softLimit;},charactersLeftWarningInt
909
934
  * @model
910
935
  */modelValue:{type:Object,required:true},/**
911
936
  * Dialogue tree
912
- */dialogueTree:{type:Object,required:true}},emits:["change","update:modelValue"],data(){return{currentStep:this.dialogueTree,steps:[]};},computed:{userData(){if(isDialogueTreeEndQuestion(this.currentStep)){return this.currentStep.userData;}return void 0;},options(){if(!isDialogueTreeEndQuestion(this.currentStep)){return this.currentStep.options;}return[];}},created(){this.currentStep=this.dialogueTree;if(isDialogueTreeEndQuestion(this.currentStep)){this.emitChange(true);}else{this.emitChange(false);}},methods:{async onClickedOption(option,index){this.steps.push(index);this.currentStep=option.question;if(isDialogueTreeEndQuestion(option.question)){this.emitChange(true);await this.$nextTick();focusFirst(this.$el);}else{this.emitChange(false);await this.$nextTick();const firstElement=getHTMLElementsFromVueRef(this.$refs["dialogueButton-0"])[0];if(firstElement){focus$1(firstElement);}}},emitChange(lastStep){const emit={label:this.currentStep.label,lastStep,steps:this.steps};this.$emit("update:modelValue",emit);this.$emit("change",emit);}}});const _hoisted_1={class:"dialogue-tree"};const _hoisted_2={key:0,class:"dialogue-tree__list"};const _hoisted_3=["onClick"];function _sfc_render(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return openBlock(),createElementBlock("div",_hoisted_1,[_ctx.options.length>0?(openBlock(),createElementBlock("ul",_hoisted_2,[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.options,(option,index)=>{return openBlock(),createElementBlock("li",{key:option.label,class:"dialogue-tree__list-item"},[createElementVNode("button",{ref_for:true,ref:`dialogueButton-${index}`,type:"button",onClick:$event=>_ctx.onClickedOption(option,index)},[createElementVNode("span",null,toDisplayString(option.label),1/* TEXT */),createTextVNode(),createVNode(_component_f_icon,{name:"arrow-right"})],8,_hoisted_3)]);}),128/* KEYED_FRAGMENT */))])):renderSlot(_ctx.$slots,"default",normalizeProps(mergeProps({key:1},{userData:_ctx.userData})))]);}const FDialogueTree=/* @__PURE__ */_export_sfc(_sfc_main,[["render",_sfc_render]]);export{ActivateItemInjected,ErrorData,ErrorPlugin,ErrorViewData,EventBus,FBadge,_sfc_main$I as FBankAccountNumberTextField,_sfc_main$H as FBankgiroTextField,FCalendar,FCalendarDay,FCard,FCheckboxField,FCheckboxGroup,FCheckboxField as FCheckboxGroupField,_sfc_main$G as FClearingnumberTextField,FConfirmModal,FContextMenu,FCrudButton,FCrudDataset,_sfc_main$K as FCurrencyTextField,FDataTable,FDatepickerField,FDialogueTree,FEmailTextField,FErrorHandlingApp,FErrorList,FExpand,FExpandablePanel,FExpandableParagraph,FFieldset,FFileItem,FFileSelector,FForm,FFormModal,FValidationFormAction as FFormModalAction,FFormStep,FFormStepButton,FIcon,FInteractiveTable,FKUIConfigButtonOrder,FLabel,FLayoutApplicationTemplate,FLayoutLeftPanel,FLayoutRightPanel,FLayoutRightPanelService,FList,FLoader,FMessageBox,FModal,FNavigationMenu,_sfc_main$F as FNumericTextField,FOffline,_sfc_main$A as FOrganisationsnummerTextField,FOutputField,FPageHeader,_sfc_main$B as FPercentTextField,_sfc_main$E as FPersonnummerTextField,FPhoneTextField,_sfc_main$D as FPlusgiroTextField,_sfc_main$C as FPostalCodeTextField,FProgressbar,FRadioField,FRadioGroup,FRadioField as FRadioGroupField,FSearchTextField,FSelectField,FSortFilterDataset,FSortFilterDatasetInjected,FStaticField,FTableColumn,FTableColumnSize,FTableColumnSort,FTableColumnType,FTextField,FTextareaField,FTooltip,FValidationForm,FValidationFormAction,FValidationGroup,FWizard,FWizardStep,FValidationFormAction as FWizardStepAction,FormErrorList,FormStep,IAnimateExpand,ICalendarMonth,ICalendarMonthGrid,ICalendarNavbar,IFlex,IFlexItem,IMenu,IPopup,IPopupError,IPopupMenu,ISkipLink,FValidationForm as IValidationForm,MenuAction,ModalReason,Operation,TableScroll,TestPlugin,TranslationMixin,TranslationPlugin,UNHANDLED_ERROR_EVENT,ValidationPlugin,actionFromKeyboardEvent,cleanUpElements,config,confirmModal,createFFormProvideOptions,dispatchComponentUnmountEvent,dispatchComponentValidityEvent,emptyTableRow,findElementFromVueRef,findHTMLElementFromVueRef,findParentByName,focus,formModal,getDayEndOffset,getDayStartOffset,getElementFromVueRef,getElementsFromVueRef,getHTMLElementFromVueRef,getHTMLElementsFromVueRef,getInputElement,getParentByName,getRef,getSortedHTMLElementsFromVueRef,getTextFromScopedSlot,handleKeyboardFocusNavigation,hasParentByName,hasSlot,includeItem,isContextMenuSeparatorItem,isContextMenuTextItem,isDialogueTreeEndQuestion,isFormStepReference,itemEquals,mountComponent,openModal,refIsElement,refIsElementArray,refIsHTMLElementArray,refIsVue,refIsVueArray,renderSlotText,setIsOpen,setRef,setRunningContext,sortComponentsWithErrorsOnDOMOrder,tableScrollClasses,updateCalendarValue,useTranslate};
937
+ */dialogueTree:{type:Object,required:true}},emits:["change","update:modelValue"],data(){return{currentStep:this.dialogueTree,steps:[]};},computed:{userData(){if(isDialogueTreeEndQuestion(this.currentStep)){return this.currentStep.userData;}return void 0;},options(){if(!isDialogueTreeEndQuestion(this.currentStep)){return this.currentStep.options;}return[];}},created(){this.currentStep=this.dialogueTree;if(isDialogueTreeEndQuestion(this.currentStep)){this.emitChange(true);}else{this.emitChange(false);}},methods:{async onClickedOption(option,index){this.steps.push(index);this.currentStep=option.question;if(isDialogueTreeEndQuestion(option.question)){this.emitChange(true);await this.$nextTick();focusFirst(this.$el);}else{this.emitChange(false);await this.$nextTick();const firstElement=getHTMLElementsFromVueRef(this.$refs["dialogueButton-0"])[0];if(firstElement){focus$1(firstElement);}}},emitChange(lastStep){const emit={label:this.currentStep.label,lastStep,steps:this.steps};this.$emit("update:modelValue",emit);this.$emit("change",emit);}}});const _hoisted_1={class:"dialogue-tree"};const _hoisted_2={key:0,class:"dialogue-tree__list"};const _hoisted_3=["onClick"];function _sfc_render(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return openBlock(),createElementBlock("div",_hoisted_1,[_ctx.options.length>0?(openBlock(),createElementBlock("ul",_hoisted_2,[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.options,(option,index)=>{return openBlock(),createElementBlock("li",{key:option.label,class:"dialogue-tree__list-item"},[createElementVNode("button",{ref_for:true,ref:`dialogueButton-${index}`,type:"button",onClick:$event=>_ctx.onClickedOption(option,index)},[createElementVNode("span",null,toDisplayString(option.label),1/* TEXT */),createTextVNode(),createVNode(_component_f_icon,{name:"arrow-right"})],8,_hoisted_3)]);}),128/* KEYED_FRAGMENT */))])):renderSlot(_ctx.$slots,"default",normalizeProps(mergeProps({key:1},{userData:_ctx.userData})))]);}const FDialogueTree=/* @__PURE__ */_export_sfc(_sfc_main,[["render",_sfc_render]]);export{ActivateItemInjected,ErrorData,ErrorPlugin,ErrorViewData,EventBus,FBadge,_sfc_main$I as FBankAccountNumberTextField,_sfc_main$H as FBankgiroTextField,FCalendar,FCalendarDay,FCard,FCheckboxField,FCheckboxGroup,FCheckboxField as FCheckboxGroupField,_sfc_main$G as FClearingnumberTextField,FConfirmModal,FContextMenu,FCrudButton,FCrudDataset,_sfc_main$K as FCurrencyTextField,FDataTable,FDatepickerField,FDialogueTree,FEmailTextField,FErrorHandlingApp,FErrorList,FExpand,FExpandablePanel,FExpandableParagraph,FFieldset,FFileItem,FFileSelector,FForm,FFormModal,FValidationFormAction as FFormModalAction,FFormStep,FFormStepButton,FIcon,FInteractiveTable,FKUIConfigButtonOrder,FLabel,FLayoutApplicationTemplate,FLayoutLeftPanel,FLayoutRightPanel,FLayoutRightPanelService,FList,FLoader,FMessageBox,FModal,FNavigationMenu,_sfc_main$F as FNumericTextField,FOffline,_sfc_main$A as FOrganisationsnummerTextField,FOutputField,FPageHeader,_sfc_main$B as FPercentTextField,_sfc_main$E as FPersonnummerTextField,FPhoneTextField,_sfc_main$D as FPlusgiroTextField,_sfc_main$C as FPostalCodeTextField,FProgressbar,FRadioField,FRadioGroup,FRadioField as FRadioGroupField,FSearchTextField,FSelectField,FSortFilterDataset,FSortFilterDatasetInjected,FStaticField,FTableColumn,FTableColumnSize,FTableColumnSort,FTableColumnType,FTextField,FTextareaField,FTooltip,FValidationForm,FValidationFormAction,FValidationGroup,FWizard,FWizardStep,FValidationFormAction as FWizardStepAction,FormErrorList,FormStep,IAnimateExpand,ICalendarMonth,ICalendarMonthGrid,ICalendarNavbar,IFlex,IFlexItem,IMenu,IPopup,IPopupError,IPopupMenu,ISkipLink,FValidationForm as IValidationForm,MenuAction,ModalReason,Operation,Placement,TableScroll,TestPlugin,TranslationMixin,TranslationPlugin,UNHANDLED_ERROR_EVENT,ValidationPlugin,actionFromKeyboardEvent,cleanUpElements,config,confirmModal,createFFormProvideOptions,dispatchComponentUnmountEvent,dispatchComponentValidityEvent,emptyTableRow,findElementFromVueRef,findHTMLElementFromVueRef,findParentByName,focus,formModal,getDayEndOffset,getDayStartOffset,getElementFromVueRef,getElementsFromVueRef,getHTMLElementFromVueRef,getHTMLElementsFromVueRef,getInputElement,getParentByName,getRef,getSortedHTMLElementsFromVueRef,getTextFromScopedSlot,handleKeyboardFocusNavigation,hasParentByName,hasSlot,includeItem,isContextMenuSeparatorItem,isContextMenuTextItem,isDialogueTreeEndQuestion,isFormStepReference,itemEquals,mountComponent,openModal,refIsElement,refIsElementArray,refIsHTMLElementArray,refIsVue,refIsVueArray,renderSlotText,setIsOpen,setRef,setRunningContext,sortComponentsWithErrorsOnDOMOrder,tableScrollClasses,useTranslate};