@oslokommune/punkt-elements 19.13.0 → 19.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/base-elements/input-element.d.ts +1 -0
- package/dist/{checkbox-CmosufvS.js → checkbox-BDwOYcNM.js} +1 -1
- package/dist/{checkbox-C1ax-sLh.cjs → checkbox-BwI9QNSh.cjs} +1 -1
- package/dist/{checkbox-group-BhivKFgO.js → checkbox-group-C8mo9dkO.js} +1 -1
- package/dist/{checkbox-group-BYNl7VNJ.cjs → checkbox-group-adbFTj8y.cjs} +1 -1
- package/dist/{combobox-BoA7AUZ2.js → combobox-B8IeuEF0.js} +1 -1
- package/dist/{combobox-oZoauZTz.cjs → combobox-jsPpImVF.cjs} +1 -1
- package/dist/{datepicker-BPxydYDE.cjs → datepicker-CZYpIyJd.cjs} +1 -1
- package/dist/{datepicker-BUevmbMe.js → datepicker-CjUY_mLR.js} +1 -1
- package/dist/{header-D5FK0J-j.js → header-20rqKJFb.js} +1 -1
- package/dist/{header-DfhjtbtK.cjs → header-BCrefip0.cjs} +1 -1
- package/dist/{input-element-BMEyYMGT.cjs → input-element-BjnKPikY.cjs} +1 -1
- package/dist/{input-element-CHSaC4Vl.js → input-element-mTphzs9b.js} +4 -1
- package/dist/pkt-checkbox-group.cjs +1 -1
- package/dist/pkt-checkbox-group.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +11 -11
- package/dist/pkt-radio-group.cjs +1 -1
- package/dist/pkt-radio-group.js +1 -1
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/pkt-timepicker.cjs +1 -1
- package/dist/pkt-timepicker.js +1 -1
- package/dist/{radio-group-DtsCD1Mf.js → radio-group-CtZhXMF8.js} +1 -1
- package/dist/{radio-group-Bzj5t0OJ.cjs → radio-group-MxNLGu-0.cjs} +1 -1
- package/dist/{radiobutton-DCncPKTW.js → radiobutton-BK-V6Itu.js} +1 -1
- package/dist/{radiobutton-Dcql5zNz.cjs → radiobutton-DwDErNo5.cjs} +1 -1
- package/dist/{select-BdljPpah.js → select-Bs-Z5Thd.js} +1 -1
- package/dist/{select-Dilcsvkk.cjs → select-Czz1y2nI.cjs} +1 -1
- package/dist/shared-types/index.d.ts +2 -0
- package/dist/shared-types/table.d.ts +51 -0
- package/dist/{textarea-DQU2ec3B.cjs → textarea-C-sdNBRk.cjs} +1 -1
- package/dist/{textarea-Jicug3YH.js → textarea-COHaMHpP.js} +1 -1
- package/dist/{textinput-Dqad6Kni.js → textinput-0DZeMqBr.js} +1 -1
- package/dist/{textinput-CkEqZRLx.cjs → textinput-BqBgsBZF.cjs} +1 -1
- package/dist/{timepicker-D-uPUK-n.cjs → timepicker-C_k-K1jA.cjs} +1 -1
- package/dist/{timepicker-wenCQ3LT.js → timepicker-CvdI7jDN.js} +1 -1
- package/package.json +3 -3
- package/src/components/combobox/combobox.selection.test.ts +45 -0
- package/src/components/datepicker/datepicker.selection.test.ts +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [19.14.3](https://github.com/oslokommune/punkt/compare/19.14.2...19.14.3) (2026-10-16)
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
* [3692](https://github.com/oslokommune/punkt/issues/3692) min-/maxlength validerer med feil verdi i combobox og datepicker med multiple (#3737). closes #3692
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
|
|
8
16
|
## [19.13.0](https://github.com/oslokommune/punkt/compare/19.12.3...19.13.0) (2026-10-14)
|
|
9
17
|
|
|
10
18
|
### Features
|
|
@@ -112,6 +112,7 @@ export declare class PktInputElement<T = {}, TOption extends PktInputOption = Pk
|
|
|
112
112
|
*/
|
|
113
113
|
protected setFormValue(value: string | string[]): void;
|
|
114
114
|
private radioGroupMembers;
|
|
115
|
+
private get valueLength();
|
|
115
116
|
private get isCheckable();
|
|
116
117
|
private checkableGroup;
|
|
117
118
|
private get isRequired();
|
|
@@ -2,7 +2,7 @@ import { _ as e, d as t, h as n, l as r, n as i, u as a } from "./element-DBugHP
|
|
|
2
2
|
import { t as o } from "./class-map-Bf-QzUpN.js";
|
|
3
3
|
import { n as s, t as c } from "./consume-Bp12si68.js";
|
|
4
4
|
import { n as l, t as u } from "./ref-y_5qv9vU.js";
|
|
5
|
-
import { t as d } from "./input-element-
|
|
5
|
+
import { t as d } from "./input-element-mTphzs9b.js";
|
|
6
6
|
//#region ../../shared-types/checkbox.ts
|
|
7
7
|
var f = {
|
|
8
8
|
defaultChecked: !1,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./consume-kEjgTrAp.cjs"),r=require("./ref-CB7e9nMY.cjs"),i=require("./input-element-
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./consume-kEjgTrAp.cjs"),r=require("./ref-CB7e9nMY.cjs"),i=require("./input-element-BjnKPikY.cjs");var a={defaultChecked:!1,indeterminate:!1,hasTile:!1,disabled:!1,hasError:!1,isSwitch:!1,hideLabel:!1,labelPosition:`right`,requiredTag:!1,optionalTag:!1},o=n.n(Symbol(`pkt-checkbox-group-context`)),s=class extends i.t{constructor(...e){super(...e),this.inputRef=r.t(),this.value=``,this.checkHelptext=null,this.defaultChecked=a.defaultChecked,this.hasTile=a.hasTile,this.isSwitch=a.isSwitch,this.labelPosition=a.labelPosition,this.hideLabel=a.hideLabel,this.checked=null,this.indeterminate=a.indeterminate,this.type=`checkbox`,this.inputSize=void 0,this.tagText=null,this.optionalTag=a.optionalTag,this.requiredTag=a.requiredTag}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,t,n){e===`checked`&&(this.checked=this.checked===``||this.checked===`true`||this.checked===!0,this.inputRef.value&&(this.inputRef.value.checked=this.checked)),e===`indeterminate`&&(this.indeterminate=this.indeterminate===``||this.indeterminate===`true`||this.indeterminate===!0,this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate)),super.attributeChangedCallback(e,t,n)}firstUpdated(e){this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===``||this.indeterminate===`true`||this.indeterminate===!0),super.firstUpdated(e)}willUpdate(e){super.willUpdate(e),e.has(`defaultChecked`)&&!this.checked&&(this.checked=this.defaultChecked)}updated(e){e.has(`checked`)&&this.inputRef.value&&(this.inputRef.value.checked=this.checked===``||this.checked===`true`||this.checked===!0),e.has(`indeterminate`)&&this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===``||this.indeterminate===`true`||this.indeterminate===!0),super.updated(e)}render(){let n=this.hasTile||!!this.groupContext?.hasTile,i=t.t({"pkt-input-check__input":!0,"pkt-input-check__input--tile":n,"pkt-input-check__input--tile-disabled":this.isDisabled&&n}),a=t.t({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError||!!this.groupContext?.hasError}),o=t.t({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.isDisabled,"pkt-input-check__input-label--left":this.labelPosition===`left`,"pkt-input-check__input-label--right":this.labelPosition===`right`,"pkt-sr-only":this.hideLabel}),s=`pkt-tag pkt-tag--small pkt-tag--thin-text`,c=this.pktStrings.get(`forms`),l=()=>e._`
|
|
2
2
|
${this.tagText?e._`<span class=${s+` pkt-tag--gray`}>${this.tagText}</span>`:e.h}
|
|
3
3
|
${this.optionalTag?e._`<span class=${s+` pkt-tag--blue-light`}
|
|
4
4
|
>${this.optionalText??c.optional}</span
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as e, l as t, n, u as r } from "./element-DBugHPKM.js";
|
|
2
|
-
import { r as i } from "./checkbox-
|
|
2
|
+
import { r as i } from "./checkbox-BDwOYcNM.js";
|
|
3
3
|
import { i as a, n as o, r as s, t as c } from "./option-group-element-D5PgGNdt.js";
|
|
4
4
|
import { t as l } from "./provide-_MnlMGnw.js";
|
|
5
5
|
//#region src/components/checkbox-group/checkbox-group.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./element-C6WTyJFE.cjs"),t=require("./checkbox-
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./checkbox-BwI9QNSh.cjs"),n=require("./option-group-element-CzehfgVZ.cjs"),r=require("./provide-Cz18sYug.cjs");var i=class extends n.t{constructor(...e){super(...e),this.optionSelector=`pkt-checkbox`,this.groupContext={name:``,hasTile:!1,hasError:!1},this.storedValue=null,this.validityApplied=!1}get value(){return this.options().filter(e=>n.n(e)&&!n.r(e)).map(n.i)}set value(e){let t=this.value;this.storedValue=Array.isArray(e)?e:e?e.split(`,`):[],this.applyStoredValue(this.options()),this.requestUpdate(`value`,t)}get hasStoredValue(){return this.storedValue!==null}storeCurrentValue(){this.storedValue=this.value}applyStoredValue(e){e.forEach(e=>{let t=!!this.storedValue?.includes(n.i(e));n.n(e)!==t&&(e.checked=t)})}syncValidity(){if(!this.required&&!this.validityApplied)return;this.validityApplied=this.required;let e=this.options(),t=this.required&&!e.some(e=>n.n(e)&&!n.r(e))?this.pktStrings.get(`validation`).checkboxGroupValueMissing:``;e.forEach(e=>e.setGroupValidity?.(t))}};e.n([r.t({context:t.r}),e.l()],i.prototype,`groupContext`,void 0),e.n([e.u({type:String})],i.prototype,`value`,null);try{e.d(`pkt-checkbox-group`)(i)}catch{console.warn(`Forsøker å definere <pkt-checkbox-group>, men den er allerede definert`)}var a=i;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
|
|
@@ -8,7 +8,7 @@ import { n as u, t as d } from "./ref-y_5qv9vU.js";
|
|
|
8
8
|
import "./tag-uVXp7uP-.js";
|
|
9
9
|
import { t as f } from "./repeat-CV9S4zya.js";
|
|
10
10
|
import { a as p, c as m, i as h, l as g, o as _, r as v, s as y } from "./listbox-BDesthOp.js";
|
|
11
|
-
import { t as b } from "./input-element-
|
|
11
|
+
import { t as b } from "./input-element-mTphzs9b.js";
|
|
12
12
|
import { t as x } from "./pkt-options-controller-CHosj1Oo.js";
|
|
13
13
|
import { r as S } from "./input-wrapper-Bb6CZxmg.js";
|
|
14
14
|
//#region ../../shared-types/combobox.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-CcJPCLgn.cjs");require("./icon-jPhyZD1z.cjs");const i=require("./if-defined-CiML3MTM.cjs"),a=require("./ref-CB7e9nMY.cjs");require("./tag-BMtnaJ1A.cjs");const o=require("./repeat-CnnigVcj.cjs"),s=require("./listbox-CvduK_YU.cjs"),c=require("./input-element-BMEyYMGT.cjs"),l=require("./pkt-options-controller-139UsV4h.cjs"),u=require("./input-wrapper-BwzajfFX.cjs");var d={multiple:!1,typeahead:!1,includeSearch:!1,allowUserInput:!1,displayValueAs:`label`,inputSize:`medium`,disabled:!1,hasError:!1,required:!1,requiredTag:!1,optionalTag:!1,fullwidth:!1,inline:!1,useWrapper:!0},f=(e,t,n)=>{switch(e){case`,`:return n?`addValue`:null;case`Enter`:return`addValue`;case`Tab`:case`ArrowDown`:return t?null:`focusListbox`;case`Escape`:return`closeOptions`;default:return null}},p=(e,t,n,r,i)=>{if(!e)return{action:`none`,value:null};let a=s.i(n,e);return!t.includes(e)&&!a?r?{action:`addUserValue`,value:e}:i?{action:`none`,value:null}:{action:`removeValue`,value:t[0]}:a&&!t.includes(a.value)?{action:`selectOption`,value:a.value}:{action:`none`,value:null}},m=(e,t,n,r,i)=>e.trim().toLowerCase()?{...s.c(e,t,n,r),shouldRemoveValue:!1,shouldResetInput:!1}:{addValueText:null,userInfoMessage:``,shouldRemoveValue:!i&&!!t[0],shouldResetInput:!0},h=(e,t,n)=>{let r=s.i(t,e);return n===`label`&&r?.label?r.label:e},g={markOptionSelected(e,t){if(t){for(let n of e)if(n.value===t){n.selected=!0;break}}},markOptionDeselected(e,t){if(t){for(let n of e)if(n.value===t){n.selected=!1;break}}},markAllSelected(e){for(let t of e)t.selected=!0},markAllDeselected(e){for(let t of e)t.selected=!1},removeUserAddedOptions(e){return e.filter(e=>!e.userAdded)}},_={parseOptionsFromSlot(e){let t=[];return e.forEach(e=>{if(!e.textContent&&!e.getAttribute(`value`))return;let n={value:e.getAttribute(`value`)||e.textContent||``,label:e.textContent||e.getAttribute(`value`)||``};e.getAttribute(`data-prefix`)&&(n.prefix=e.getAttribute(`data-prefix`)||void 0),e.getAttribute(`tagskincolor`)&&(n.tagSkinColor=e.getAttribute(`tagskincolor`)),e.getAttribute(`description`)&&(n.description=e.getAttribute(`description`)||void 0),n.fulltext=s.r(n),t.push(n)}),t}},v={cloneOptions(e){return Array.isArray(e)?e.map(e=>({...e})):[]},syncOptionsWithValues(e,t){let n=[...t];return e.forEach(e=>{e.value&&!e.label&&(e.label=e.value),e.selected&&!n.includes(e.value)&&n.push(e.value),e.fulltext=s.r(e),e.selected=e.selected||n.includes(e.value)}),{options:e,newValues:n}},mergeWithUserAdded(e,t,n){return[...t.filter(e=>e?.userAdded&&n.includes(e.value)).filter(t=>!(Array.isArray(e)?e:[]).some(e=>e.value===t.value)),...e]}},y=class extends c.t{constructor(){super(),this.value=``,this.options=[],this.defaultOptions=[],this.allowUserInput=d.allowUserInput,this.typeahead=d.typeahead,this.includeSearch=d.includeSearch,this.searchPlaceholder=null,this.multiple=d.multiple,this.maxlength=null,this.displayValueAs=d.displayValueAs,this.tagPlacement=null,this.isOpen=!1,this._options=[],this._value=[],this._isOptionsOpen=!1,this._userInfoMessage=``,this._messageValue=null,this._addValueText=null,this._maxIsReached=!1,this._search=``,this._inputFocus=!1,this._skipInputTab=!1,this._optionsFromSlot=!1,this._lastSlotGeneration=0,this._suppressNextOpen=!1,this.inputRef=a.t(),this.triggerRef=a.t(),this.listboxRef=a.t(),this._pendingDispatchFrom=null,this.optionsController=new l.t(this)}get _hasTextInput(){return this.typeahead||this.allowUserInput}get _selectionDescription(){if(!(!this.multiple||this._value.length===0))return`${this._value.length} valgt`}focusTrigger(){this._hasTextInput?this.inputRef.value?.focus():this.triggerRef.value?.focus()}focusAfterCommit(){this._skipInputTab=!0;let e=this.inputRef.value;e&&e.type!==`hidden`&&e.setAttribute(`tabindex`,`-1`),this.triggerRef.value?.focus()}restoreInputTab(){this._skipInputTab=!1}parseValue(){return this.parseToValues(this.value)}parseToValues(e){return Array.isArray(e)?this.multiple?e:e.length>0?[e[0]]:[]:e&&this.multiple?e.split(`,`):e?[e]:[]}updateMaxReached(){this._maxIsReached=s.l(this._value.length,this.maxlength)}syncPublicValue(){let e=this.multiple?this._value.join(`,`):this._value[0]||``;e!==(Array.isArray(this.value)?this.value.join(`,`):String(this.value||``))&&(this.value=e)}dispatchValueChange(e){let t=this._value;if(e?.join(`,`)!==t.join(`,`)){let e=this.multiple?[...t]:t[0]||``;this.onChange(e)}else t.length===0&&e&&e.length>0&&this.clearInputValue()}onChange(e){this.touched=!0,super.onChange(e)}valueChanged(){}};e.n([e.u({type:String,reflect:!0})],y.prototype,`value`,void 0),e.n([e.u({type:Array})],y.prototype,`options`,void 0),e.n([e.u({type:Array,attribute:`default-options`})],y.prototype,`defaultOptions`,void 0),e.n([e.u({type:Boolean,attribute:`allow-user-input`})],y.prototype,`allowUserInput`,void 0),e.n([e.u({type:Boolean})],y.prototype,`typeahead`,void 0),e.n([e.u({type:Boolean,attribute:`include-search`})],y.prototype,`includeSearch`,void 0),e.n([e.u({type:String,attribute:`search-placeholder`})],y.prototype,`searchPlaceholder`,void 0),e.n([e.u({type:Boolean})],y.prototype,`multiple`,void 0),e.n([e.u({type:Number})],y.prototype,`maxlength`,void 0),e.n([e.u({type:String,attribute:`display-value-as`})],y.prototype,`displayValueAs`,void 0),e.n([e.u({type:String,attribute:`tag-placement`})],y.prototype,`tagPlacement`,void 0),e.n([e.u({type:Boolean,attribute:`open`})],y.prototype,`isOpen`,void 0),e.n([e.l()],y.prototype,`_options`,void 0),e.n([e.l()],y.prototype,`_value`,void 0),e.n([e.l()],y.prototype,`_isOptionsOpen`,void 0),e.n([e.l()],y.prototype,`_userInfoMessage`,void 0),e.n([e.l()],y.prototype,`_messageValue`,void 0),e.n([e.l()],y.prototype,`_addValueText`,void 0),e.n([e.l()],y.prototype,`_maxIsReached`,void 0),e.n([e.l()],y.prototype,`_search`,void 0),e.n([e.l()],y.prototype,`_inputFocus`,void 0),e.n([e.l()],y.prototype,`_skipInputTab`,void 0);var b=class extends y{toggleValue(e){if(this.isDisabled)return;this.touched=!0,this._userInfoMessage=``,this._addValueText=null;let t=s.i(this.options,e)?.value||null,n=this._value.includes(e||t||``),r=!!t,i=this._options.find(t=>t.value===e)?.disabled||!1,a=!e?.trim(),o=!this.multiple,c=this.multiple,l=s.l(this._value.length,this.maxlength),u=!1,d=!0,f=``,p=null,m=``;i||(!r&&this.allowUserInput&&!a?(this.addNewUserValue(e),f=`valueAdded`,u=c):!r&&!this.allowUserInput?(o&&this._value[0]&&this.removeValue(this._value[0]),d=!1,u=!0,f=`noResults`):n?(this.removeValue(t),u=!0,o&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=``)):a&&o?(this.removeAllSelected(),u=!0):o?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t),u=!1,f=`valueSelected`,p=this._hasTextInput?h(t||``,this.options,this.displayValueAs):s.s(s.i(this.options,t),this.displayValueAs)):c&&!l?(this.setSelected(t),u=!0):c&&l?(f=`maxSelected`,d=!1,m=e):(o&&this.removeAllSelected(),f=`noValidValue`,d=!1,u=!0,m=e),this._isOptionsOpen=u,u||window.setTimeout(()=>{this.focusAfterCommit()},0),this._search=m||``,this.resetComboboxInput(d),this._userInfoMessage=f,this._messageValue=p,c&&this.updateMaxReached())}setSelected(e){if(!this._value.includes(e)){if(this.multiple&&s.l(this._value.length,this.maxlength)){this._userInfoMessage=`maxSelected`;return}!this.multiple&&this.removeAllSelected(),this._value=e?[...this._value,e]:this._value,g.markOptionSelected(this._options,e),this.resetComboboxInput(!0)}}removeSelected(e){if(!e)return;this._value=this._value.filter(t=>t!==e);let t=s.i(this.options,e);t&&(g.markOptionDeselected(this.options,e),t.userAdded?(this._options=[...this._options.filter(t=>t.value!==e)],this.options=[...this.options.filter(t=>t.value!==e)]):this._options.some(t=>t.value===e)?this.refreshOptionsFromValue():this._options=[...this._options,t])}addAllOptions(){if(this.multiple){if(this.maxlength&&this._options.length>this.maxlength){this._userInfoMessage=`tooManySelected`;return}this._value=this._options.map(e=>e.value),g.markAllSelected(this._options),this.requestUpdate()}}removeAllSelected(){this._value=[],g.markAllDeselected(this._options),this._options=g.removeUserAddedOptions(this._options),this.requestUpdate()}addValue(){let e=this.inputRef.value?.value.trim()||``;if(this._search=e,e&&this._value.includes(e)){this.resetComboboxInput(!0),this._userInfoMessage=`alreadySelected`;return}this.toggleValue(e)}removeValue(e){this._value=this.multiple?this._value.filter(t=>t!==e):[],this.removeSelected(e)}addNewUserValue(e){if(!e||e.trim()===``)return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[e];else if(!s.i(this.options,e)){if(s.l(this._value.length,this.maxlength))return;this._value=[...this._value,e]}let t={value:e,label:e,userAdded:!0,selected:!0};this.options=[t,...this.options],this._options=[t,...this._options],this.resetComboboxInput(!0),this.multiple||(this._isOptionsOpen=!1,window.setTimeout(()=>{this.focusAfterCommit()},0)),this.requestUpdate()}refreshOptionsFromValue(){let e=v.cloneOptions(this.options);e.forEach(e=>e.selected=this._value.includes(e.value)),this._options=v.syncOptionsWithValues(e,this._value).options}resetComboboxInput(e=!0){this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!==`hidden`&&e&&(this._search=``,this.multiple?this.inputRef.value.value=``:(this.inputRef.value.value=this._value[0]?h(this._value[0],this.options,this.displayValueAs):``,this._userInfoMessage=``)),this.refreshOptionsFromValue()}removeLastValue(e){if(this._value.length===0)return;e.preventDefault();let t=this._value[this._value.length-1];t&&this.removeSelected(t),this.updateMaxReached()}},x=class extends b{handleInput(e){if(e.stopPropagation(),e.stopImmediatePropagation(),this.isDisabled)return;this.touched=!0;let t=e.target;if(this._search=t.value,this.checkForMatches(),this.typeahead){if(this._search){let{filtered:n,suggestion:r}=s.o(this.options,this._search);this._options=n,e.inputType!==`deleteContentBackward`&&r?.label&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(t.value=r.label,window.setTimeout(()=>t.setSelectionRange(this._search.length,t.value.length),0),t.selectionDirection=`backward`)}else this.refreshOptionsFromValue()}}handleFocus(){if(!this.isDisabled){if(this._skipInputTab=!1,this._suppressNextOpen){this._suppressNextOpen=!1,this._inputFocus=!0,this.requestUpdate();return}!this.multiple&&this._value[0]&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=h(this._value[0],this.options,this.displayValueAs)),this._inputFocus=!0,this._search=``,this.refreshOptionsFromValue(),this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleCloseOptions(){this._isOptionsOpen=!1,this._hasTextInput&&(this._suppressNextOpen=!0),this.focusTrigger()}handleFocusOut(e){if(this.isDisabled||!this._isOptionsOpen)return;let t=e.relatedTarget;t?.closest(`pkt-combobox`)?.id===this.id||e.target?.classList?.contains(`pkt-combobox__value`)||t===this.inputRef.value||t===this.triggerRef.value||this.closeAndProcessInput()}closeAndProcessInput(){if(this._inputFocus=!1,this._addValueText=null,this._userInfoMessage=``,this._search=``,this.inputRef.value&&this.inputRef.value.type!==`hidden`){let e=this.inputRef.value.value;if(!this.multiple){if(!e)this._value[0]&&this.removeSelected(this._value[0]);else{let t=s.i(this.options,e);t&&t.value!==this._value[0]?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t.value)):!t&&this.allowUserInput&&(this._value[0]&&this.removeSelected(this._value[0]),this.addNewUserValue(e))}}else if(e!==``){let{action:t,value:n}=p(e,this._value,this.options,this.allowUserInput,this.multiple);switch(t){case`addUserValue`:this.addNewUserValue(n);break;case`selectOption`:this.setSelected(n);break;case`removeValue`:this.removeValue(n)}}!this.multiple&&this._value[0]?this.inputRef.value.value=h(this._value[0],this.options,this.displayValueAs):this.inputRef.value.value=``}this._isOptionsOpen=!1,this.onBlur()}handleBlur(){this._inputFocus=!1,this.onBlur()}handleInputClick(e){if(this.isDisabled){e.preventDefault(),e.stopImmediatePropagation();return}this._hasTextInput?(this.inputRef.value?.focus(),this.requestUpdate()):(e.stopImmediatePropagation(),e.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen&&this.listboxRef.value?.focusFirstOrSelectedOption())}handlePlaceholderClick(e){this.isDisabled||(e.stopPropagation(),this._hasTextInput&&this.inputRef.value?(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()):(this._isOptionsOpen=!this._isOptionsOpen,this.requestUpdate()))}handleSelectOnlyKeydown(e){if(!this.isDisabled)switch(e.key){case`Enter`:case` `:case`ArrowDown`:case`ArrowUp`:e.preventDefault(),this._isOptionsOpen?this._isOptionsOpen=!1:(this._isOptionsOpen=!0,this.listboxRef.value?.focusFirstOrSelectedOption());break;case`Escape`:this._isOptionsOpen&&=(e.preventDefault(),!1);break;case`Home`:case`End`:e.preventDefault(),this._isOptionsOpen||=!0,this.listboxRef.value?.focusFirstOrSelectedOption();break;case`ArrowLeft`:this.multiple&&this._value.length>0&&(e.preventDefault(),this.focusTag(this._value.length-1));break;case`Backspace`:case`Delete`:this.multiple&&this._value.length>0&&(e.preventDefault(),this.removeSelected(this._value[this._value.length-1]))}}handleOptionToggled(e){this.toggleValue(e.detail)}handleSearch(e){e.stopPropagation(),this._search=e.detail.toLowerCase(),this.checkForMatches()}handleInputKeydown(e){if(e.key===`Backspace`){let t=!this.inputRef.value?.value;!this._search&&t&&this.multiple&&this._value.length>0&&this.removeLastValue(e);return}if(e.key===`ArrowLeft`&&this.multiple&&this._value.length>0){let t=this.inputRef.value;if(t&&t.selectionStart===0&&!t.value){e.preventDefault(),this.focusTag(this._value.length-1);return}}let t=f(e.key,e.shiftKey,this.multiple);if(t&&!(e.key===`Tab`&&!this._isOptionsOpen)){if(t===`focusListbox`&&e.key===`Tab`&&!this.listboxRef.value?.querySelector(`[role="option"]:not([data-disabled]), [data-type="new-option"]`)){this.closeAndProcessInput();return}switch(e.preventDefault(),t){case`addValue`:this.addValue();break;case`focusListbox`:this.listboxRef.value?.focusFirstOrSelectedOption();break;case`closeOptions`:this._isOptionsOpen=!1}}}handleTagRemove(e){this.removeSelected(e),this._hasTextInput&&this.inputRef.value&&(this._inputFocus=!0,this.inputRef.value.focus(),this.requestUpdate())}getInsideTags(){return Array.from(this.querySelectorAll(`.pkt-combobox__input .pkt-combobox__tag-list pkt-tag`))}focusTag(e){let t=this.getInsideTags();t.forEach((t,n)=>{t.buttonTabindex=n===e?0:-1}),(t[e]?.querySelector(`button`))?.focus()}resetTagTabindices(){this.getInsideTags().forEach(e=>{e.buttonTabindex=-1})}handleTagKeydown(e,t){e.stopPropagation();let n=()=>{this.resetTagTabindices(),this._hasTextInput&&this.inputRef.value?this.inputRef.value.focus():this.triggerRef.value?.focus()};switch(e.key){case`ArrowLeft`:e.preventDefault(),t>0&&this.focusTag(t-1);break;case`ArrowRight`:e.preventDefault(),t<this._value.length-1?this.focusTag(t+1):n();break;case`Backspace`:case`Delete`:e.preventDefault();{let e=this._value[t],r=t>=this._value.length-1?t-1:t;this.removeSelected(e),r>=0?(this.requestUpdate(),this.updateComplete.then(()=>this.focusTag(r))):n()}break;case`Tab`:this.resetTagTabindices();break;case`Escape`:e.preventDefault(),n()}}checkForMatches(){let e=m(this.inputRef.value?.value||this._search||``,this._value,this.options,this.allowUserInput,this.multiple);if(e.shouldRemoveValue&&this.removeValue(this._value[0]),e.shouldResetInput){this.resetComboboxInput(!1);return}this._addValueText=e.addValueText,this._userInfoMessage=e.userInfoMessage}},S=class extends x{constructor(...e){super(...e),this.handleBodyClick=e=>{this._isOptionsOpen&&!this.contains(e.target)&&this.closeAndProcessInput()}}connectedCallback(){if(super.connectedCallback(),document?.body.addEventListener(`click`,this.handleBodyClick),this._options=[],this.defaultOptions&&this.defaultOptions.length){let e=this.options?.filter(e=>e.userAdded)||[];this.options=[...e,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=v.cloneOptions(this.options)}if(this.optionsController?.nodes&&this.optionsController.nodes.length){let e=_.parseOptionsFromSlot(this.optionsController.nodes);e.length&&(this.options=[...e],this._options=[...e],this._optionsFromSlot=!0,this._lastSlotGeneration=this.optionsController.generation)}}disconnectedCallback(){super.disconnectedCallback(),document?.body.removeEventListener(`click`,this.handleBodyClick)}firstUpdated(e){this.defaultValue!==null&&!this.value&&(this.value=this.defaultValue),super.firstUpdated(e)}willUpdate(e){if(this._optionsFromSlot&&this.optionsController){let e=this.optionsController.generation;if(e!==this._lastSlotGeneration){this._lastSlotGeneration=e;let t=_.parseOptionsFromSlot(this.optionsController.nodes),n=this._options.filter(e=>e.userAdded);this.options=[...n,...t]}}if(super.willUpdate(e),e.has(`isOpen`)&&(this._isOptionsOpen=this.isOpen),e.has(`defaultOptions`)&&this.defaultOptions.length){let e=(Array.isArray(this.options)?this.options:[]).filter(e=>e.userAdded)||[];this.options=[...e,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=v.cloneOptions(this.options)}let t=e.has(`value`),n=e.has(`_value`);if(t){let e=[...this._value],t=this.parseValue();t.join(`,`)!==this._value.join(`,`)&&(this._value=t,this._options.forEach(e=>e.selected=t.includes(e.value)),this._options=[...this._options]),this._pendingDispatchFrom??=e}else n&&(this._pendingDispatchFrom??=e.get(`_value`)??[]);if(e.has(`defaultValue`)&&this.defaultValue!=null&&!this._value.length){let e=this.parseToValues(this.defaultValue);e.length&&(this._pendingDispatchFrom??=[...this._value],this._value=e,this._options.forEach(t=>t.selected=e.includes(t.value)),this._options=[...this._options])}if(e.has(`options`)){let t=e.get(`options`)||this._options||[],n=v.mergeWithUserAdded(v.cloneOptions(this.options),t,this._value);this._options=n,n.length>this.options.length&&(this.options=n);let r=v.syncOptionsWithValues(this._options,this._value);this._options=r.options,r.newValues.length>this._value.length&&(this._pendingDispatchFrom??=[...this._value],this._value=r.newValues)}(t||n||e.has(`options`)||e.has(`defaultValue`))&&this.updateMaxReached(),this._pendingDispatchFrom&&this.syncPublicValue()}updated(e){if(this._pendingDispatchFrom){let e=this._pendingDispatchFrom;this._pendingDispatchFrom=null,this.dispatchValueChange(e)}if(e.has(`_search`)&&this.dispatchEvent(new CustomEvent(`search`,{detail:this._search,bubbles:!1})),!this._isOptionsOpen&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!==`hidden`){let e=!this.multiple&&this._value[0]?h(this._value[0],this.options,this.displayValueAs):``;this.inputRef.value.value!==e&&(this.inputRef.value.value=e)}this.classList.add(`pkt-combobox-component`),this.classList.toggle(`pkt-combobox-component--fullwidth`,!!this.fullwidth),super.updated(e)}formResetCallback(){this.touched=!1;let e=this.defaultValue||(this.multiple,``);this.value=e,this._value=this.parseValue(),this._options=this._options.filter(e=>!e.userAdded).map(e=>({...e,selected:this._value.includes(e.value)})),this.options=this.options.filter(e=>!e.userAdded).map(e=>({...e,selected:this._value.includes(e.value)})),this._search=``,this._isOptionsOpen=!1,this._userInfoMessage=``,this._addValueText=null,this._inputFocus=!1,this.updateMaxReached(),this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=``),this.setFormValue(``),this.internals.ariaInvalid=`false`,this.requestUpdate()}attributeChangedCallback(e,t,n){if(e===`options`){this._options=v.cloneOptions(this.options);let e=v.syncOptionsWithValues(this._options,this._value);this._options=e.options,e.newValues.length>this._value.length&&(this._value=e.newValues),this._search=``}super.attributeChangedCallback(e,t,n)}render(){return e._`
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-CcJPCLgn.cjs");require("./icon-jPhyZD1z.cjs");const i=require("./if-defined-CiML3MTM.cjs"),a=require("./ref-CB7e9nMY.cjs");require("./tag-BMtnaJ1A.cjs");const o=require("./repeat-CnnigVcj.cjs"),s=require("./listbox-CvduK_YU.cjs"),c=require("./input-element-BjnKPikY.cjs"),l=require("./pkt-options-controller-139UsV4h.cjs"),u=require("./input-wrapper-BwzajfFX.cjs");var d={multiple:!1,typeahead:!1,includeSearch:!1,allowUserInput:!1,displayValueAs:`label`,inputSize:`medium`,disabled:!1,hasError:!1,required:!1,requiredTag:!1,optionalTag:!1,fullwidth:!1,inline:!1,useWrapper:!0},f=(e,t,n)=>{switch(e){case`,`:return n?`addValue`:null;case`Enter`:return`addValue`;case`Tab`:case`ArrowDown`:return t?null:`focusListbox`;case`Escape`:return`closeOptions`;default:return null}},p=(e,t,n,r,i)=>{if(!e)return{action:`none`,value:null};let a=s.i(n,e);return!t.includes(e)&&!a?r?{action:`addUserValue`,value:e}:i?{action:`none`,value:null}:{action:`removeValue`,value:t[0]}:a&&!t.includes(a.value)?{action:`selectOption`,value:a.value}:{action:`none`,value:null}},m=(e,t,n,r,i)=>e.trim().toLowerCase()?{...s.c(e,t,n,r),shouldRemoveValue:!1,shouldResetInput:!1}:{addValueText:null,userInfoMessage:``,shouldRemoveValue:!i&&!!t[0],shouldResetInput:!0},h=(e,t,n)=>{let r=s.i(t,e);return n===`label`&&r?.label?r.label:e},g={markOptionSelected(e,t){if(t){for(let n of e)if(n.value===t){n.selected=!0;break}}},markOptionDeselected(e,t){if(t){for(let n of e)if(n.value===t){n.selected=!1;break}}},markAllSelected(e){for(let t of e)t.selected=!0},markAllDeselected(e){for(let t of e)t.selected=!1},removeUserAddedOptions(e){return e.filter(e=>!e.userAdded)}},_={parseOptionsFromSlot(e){let t=[];return e.forEach(e=>{if(!e.textContent&&!e.getAttribute(`value`))return;let n={value:e.getAttribute(`value`)||e.textContent||``,label:e.textContent||e.getAttribute(`value`)||``};e.getAttribute(`data-prefix`)&&(n.prefix=e.getAttribute(`data-prefix`)||void 0),e.getAttribute(`tagskincolor`)&&(n.tagSkinColor=e.getAttribute(`tagskincolor`)),e.getAttribute(`description`)&&(n.description=e.getAttribute(`description`)||void 0),n.fulltext=s.r(n),t.push(n)}),t}},v={cloneOptions(e){return Array.isArray(e)?e.map(e=>({...e})):[]},syncOptionsWithValues(e,t){let n=[...t];return e.forEach(e=>{e.value&&!e.label&&(e.label=e.value),e.selected&&!n.includes(e.value)&&n.push(e.value),e.fulltext=s.r(e),e.selected=e.selected||n.includes(e.value)}),{options:e,newValues:n}},mergeWithUserAdded(e,t,n){return[...t.filter(e=>e?.userAdded&&n.includes(e.value)).filter(t=>!(Array.isArray(e)?e:[]).some(e=>e.value===t.value)),...e]}},y=class extends c.t{constructor(){super(),this.value=``,this.options=[],this.defaultOptions=[],this.allowUserInput=d.allowUserInput,this.typeahead=d.typeahead,this.includeSearch=d.includeSearch,this.searchPlaceholder=null,this.multiple=d.multiple,this.maxlength=null,this.displayValueAs=d.displayValueAs,this.tagPlacement=null,this.isOpen=!1,this._options=[],this._value=[],this._isOptionsOpen=!1,this._userInfoMessage=``,this._messageValue=null,this._addValueText=null,this._maxIsReached=!1,this._search=``,this._inputFocus=!1,this._skipInputTab=!1,this._optionsFromSlot=!1,this._lastSlotGeneration=0,this._suppressNextOpen=!1,this.inputRef=a.t(),this.triggerRef=a.t(),this.listboxRef=a.t(),this._pendingDispatchFrom=null,this.optionsController=new l.t(this)}get _hasTextInput(){return this.typeahead||this.allowUserInput}get _selectionDescription(){if(!(!this.multiple||this._value.length===0))return`${this._value.length} valgt`}focusTrigger(){this._hasTextInput?this.inputRef.value?.focus():this.triggerRef.value?.focus()}focusAfterCommit(){this._skipInputTab=!0;let e=this.inputRef.value;e&&e.type!==`hidden`&&e.setAttribute(`tabindex`,`-1`),this.triggerRef.value?.focus()}restoreInputTab(){this._skipInputTab=!1}parseValue(){return this.parseToValues(this.value)}parseToValues(e){return Array.isArray(e)?this.multiple?e:e.length>0?[e[0]]:[]:e&&this.multiple?e.split(`,`):e?[e]:[]}updateMaxReached(){this._maxIsReached=s.l(this._value.length,this.maxlength)}syncPublicValue(){let e=this.multiple?this._value.join(`,`):this._value[0]||``;e!==(Array.isArray(this.value)?this.value.join(`,`):String(this.value||``))&&(this.value=e)}dispatchValueChange(e){let t=this._value;if(e?.join(`,`)!==t.join(`,`)){let e=this.multiple?[...t]:t[0]||``;this.onChange(e)}else t.length===0&&e&&e.length>0&&this.clearInputValue()}onChange(e){this.touched=!0,super.onChange(e)}valueChanged(){}};e.n([e.u({type:String,reflect:!0})],y.prototype,`value`,void 0),e.n([e.u({type:Array})],y.prototype,`options`,void 0),e.n([e.u({type:Array,attribute:`default-options`})],y.prototype,`defaultOptions`,void 0),e.n([e.u({type:Boolean,attribute:`allow-user-input`})],y.prototype,`allowUserInput`,void 0),e.n([e.u({type:Boolean})],y.prototype,`typeahead`,void 0),e.n([e.u({type:Boolean,attribute:`include-search`})],y.prototype,`includeSearch`,void 0),e.n([e.u({type:String,attribute:`search-placeholder`})],y.prototype,`searchPlaceholder`,void 0),e.n([e.u({type:Boolean})],y.prototype,`multiple`,void 0),e.n([e.u({type:Number})],y.prototype,`maxlength`,void 0),e.n([e.u({type:String,attribute:`display-value-as`})],y.prototype,`displayValueAs`,void 0),e.n([e.u({type:String,attribute:`tag-placement`})],y.prototype,`tagPlacement`,void 0),e.n([e.u({type:Boolean,attribute:`open`})],y.prototype,`isOpen`,void 0),e.n([e.l()],y.prototype,`_options`,void 0),e.n([e.l()],y.prototype,`_value`,void 0),e.n([e.l()],y.prototype,`_isOptionsOpen`,void 0),e.n([e.l()],y.prototype,`_userInfoMessage`,void 0),e.n([e.l()],y.prototype,`_messageValue`,void 0),e.n([e.l()],y.prototype,`_addValueText`,void 0),e.n([e.l()],y.prototype,`_maxIsReached`,void 0),e.n([e.l()],y.prototype,`_search`,void 0),e.n([e.l()],y.prototype,`_inputFocus`,void 0),e.n([e.l()],y.prototype,`_skipInputTab`,void 0);var b=class extends y{toggleValue(e){if(this.isDisabled)return;this.touched=!0,this._userInfoMessage=``,this._addValueText=null;let t=s.i(this.options,e)?.value||null,n=this._value.includes(e||t||``),r=!!t,i=this._options.find(t=>t.value===e)?.disabled||!1,a=!e?.trim(),o=!this.multiple,c=this.multiple,l=s.l(this._value.length,this.maxlength),u=!1,d=!0,f=``,p=null,m=``;i||(!r&&this.allowUserInput&&!a?(this.addNewUserValue(e),f=`valueAdded`,u=c):!r&&!this.allowUserInput?(o&&this._value[0]&&this.removeValue(this._value[0]),d=!1,u=!0,f=`noResults`):n?(this.removeValue(t),u=!0,o&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=``)):a&&o?(this.removeAllSelected(),u=!0):o?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t),u=!1,f=`valueSelected`,p=this._hasTextInput?h(t||``,this.options,this.displayValueAs):s.s(s.i(this.options,t),this.displayValueAs)):c&&!l?(this.setSelected(t),u=!0):c&&l?(f=`maxSelected`,d=!1,m=e):(o&&this.removeAllSelected(),f=`noValidValue`,d=!1,u=!0,m=e),this._isOptionsOpen=u,u||window.setTimeout(()=>{this.focusAfterCommit()},0),this._search=m||``,this.resetComboboxInput(d),this._userInfoMessage=f,this._messageValue=p,c&&this.updateMaxReached())}setSelected(e){if(!this._value.includes(e)){if(this.multiple&&s.l(this._value.length,this.maxlength)){this._userInfoMessage=`maxSelected`;return}!this.multiple&&this.removeAllSelected(),this._value=e?[...this._value,e]:this._value,g.markOptionSelected(this._options,e),this.resetComboboxInput(!0)}}removeSelected(e){if(!e)return;this._value=this._value.filter(t=>t!==e);let t=s.i(this.options,e);t&&(g.markOptionDeselected(this.options,e),t.userAdded?(this._options=[...this._options.filter(t=>t.value!==e)],this.options=[...this.options.filter(t=>t.value!==e)]):this._options.some(t=>t.value===e)?this.refreshOptionsFromValue():this._options=[...this._options,t])}addAllOptions(){if(this.multiple){if(this.maxlength&&this._options.length>this.maxlength){this._userInfoMessage=`tooManySelected`;return}this._value=this._options.map(e=>e.value),g.markAllSelected(this._options),this.requestUpdate()}}removeAllSelected(){this._value=[],g.markAllDeselected(this._options),this._options=g.removeUserAddedOptions(this._options),this.requestUpdate()}addValue(){let e=this.inputRef.value?.value.trim()||``;if(this._search=e,e&&this._value.includes(e)){this.resetComboboxInput(!0),this._userInfoMessage=`alreadySelected`;return}this.toggleValue(e)}removeValue(e){this._value=this.multiple?this._value.filter(t=>t!==e):[],this.removeSelected(e)}addNewUserValue(e){if(!e||e.trim()===``)return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[e];else if(!s.i(this.options,e)){if(s.l(this._value.length,this.maxlength))return;this._value=[...this._value,e]}let t={value:e,label:e,userAdded:!0,selected:!0};this.options=[t,...this.options],this._options=[t,...this._options],this.resetComboboxInput(!0),this.multiple||(this._isOptionsOpen=!1,window.setTimeout(()=>{this.focusAfterCommit()},0)),this.requestUpdate()}refreshOptionsFromValue(){let e=v.cloneOptions(this.options);e.forEach(e=>e.selected=this._value.includes(e.value)),this._options=v.syncOptionsWithValues(e,this._value).options}resetComboboxInput(e=!0){this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!==`hidden`&&e&&(this._search=``,this.multiple?this.inputRef.value.value=``:(this.inputRef.value.value=this._value[0]?h(this._value[0],this.options,this.displayValueAs):``,this._userInfoMessage=``)),this.refreshOptionsFromValue()}removeLastValue(e){if(this._value.length===0)return;e.preventDefault();let t=this._value[this._value.length-1];t&&this.removeSelected(t),this.updateMaxReached()}},x=class extends b{handleInput(e){if(e.stopPropagation(),e.stopImmediatePropagation(),this.isDisabled)return;this.touched=!0;let t=e.target;if(this._search=t.value,this.checkForMatches(),this.typeahead){if(this._search){let{filtered:n,suggestion:r}=s.o(this.options,this._search);this._options=n,e.inputType!==`deleteContentBackward`&&r?.label&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(t.value=r.label,window.setTimeout(()=>t.setSelectionRange(this._search.length,t.value.length),0),t.selectionDirection=`backward`)}else this.refreshOptionsFromValue()}}handleFocus(){if(!this.isDisabled){if(this._skipInputTab=!1,this._suppressNextOpen){this._suppressNextOpen=!1,this._inputFocus=!0,this.requestUpdate();return}!this.multiple&&this._value[0]&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=h(this._value[0],this.options,this.displayValueAs)),this._inputFocus=!0,this._search=``,this.refreshOptionsFromValue(),this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleCloseOptions(){this._isOptionsOpen=!1,this._hasTextInput&&(this._suppressNextOpen=!0),this.focusTrigger()}handleFocusOut(e){if(this.isDisabled||!this._isOptionsOpen)return;let t=e.relatedTarget;t?.closest(`pkt-combobox`)?.id===this.id||e.target?.classList?.contains(`pkt-combobox__value`)||t===this.inputRef.value||t===this.triggerRef.value||this.closeAndProcessInput()}closeAndProcessInput(){if(this._inputFocus=!1,this._addValueText=null,this._userInfoMessage=``,this._search=``,this.inputRef.value&&this.inputRef.value.type!==`hidden`){let e=this.inputRef.value.value;if(!this.multiple){if(!e)this._value[0]&&this.removeSelected(this._value[0]);else{let t=s.i(this.options,e);t&&t.value!==this._value[0]?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t.value)):!t&&this.allowUserInput&&(this._value[0]&&this.removeSelected(this._value[0]),this.addNewUserValue(e))}}else if(e!==``){let{action:t,value:n}=p(e,this._value,this.options,this.allowUserInput,this.multiple);switch(t){case`addUserValue`:this.addNewUserValue(n);break;case`selectOption`:this.setSelected(n);break;case`removeValue`:this.removeValue(n)}}!this.multiple&&this._value[0]?this.inputRef.value.value=h(this._value[0],this.options,this.displayValueAs):this.inputRef.value.value=``}this._isOptionsOpen=!1,this.onBlur()}handleBlur(){this._inputFocus=!1,this.onBlur()}handleInputClick(e){if(this.isDisabled){e.preventDefault(),e.stopImmediatePropagation();return}this._hasTextInput?(this.inputRef.value?.focus(),this.requestUpdate()):(e.stopImmediatePropagation(),e.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen&&this.listboxRef.value?.focusFirstOrSelectedOption())}handlePlaceholderClick(e){this.isDisabled||(e.stopPropagation(),this._hasTextInput&&this.inputRef.value?(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()):(this._isOptionsOpen=!this._isOptionsOpen,this.requestUpdate()))}handleSelectOnlyKeydown(e){if(!this.isDisabled)switch(e.key){case`Enter`:case` `:case`ArrowDown`:case`ArrowUp`:e.preventDefault(),this._isOptionsOpen?this._isOptionsOpen=!1:(this._isOptionsOpen=!0,this.listboxRef.value?.focusFirstOrSelectedOption());break;case`Escape`:this._isOptionsOpen&&=(e.preventDefault(),!1);break;case`Home`:case`End`:e.preventDefault(),this._isOptionsOpen||=!0,this.listboxRef.value?.focusFirstOrSelectedOption();break;case`ArrowLeft`:this.multiple&&this._value.length>0&&(e.preventDefault(),this.focusTag(this._value.length-1));break;case`Backspace`:case`Delete`:this.multiple&&this._value.length>0&&(e.preventDefault(),this.removeSelected(this._value[this._value.length-1]))}}handleOptionToggled(e){this.toggleValue(e.detail)}handleSearch(e){e.stopPropagation(),this._search=e.detail.toLowerCase(),this.checkForMatches()}handleInputKeydown(e){if(e.key===`Backspace`){let t=!this.inputRef.value?.value;!this._search&&t&&this.multiple&&this._value.length>0&&this.removeLastValue(e);return}if(e.key===`ArrowLeft`&&this.multiple&&this._value.length>0){let t=this.inputRef.value;if(t&&t.selectionStart===0&&!t.value){e.preventDefault(),this.focusTag(this._value.length-1);return}}let t=f(e.key,e.shiftKey,this.multiple);if(t&&!(e.key===`Tab`&&!this._isOptionsOpen)){if(t===`focusListbox`&&e.key===`Tab`&&!this.listboxRef.value?.querySelector(`[role="option"]:not([data-disabled]), [data-type="new-option"]`)){this.closeAndProcessInput();return}switch(e.preventDefault(),t){case`addValue`:this.addValue();break;case`focusListbox`:this.listboxRef.value?.focusFirstOrSelectedOption();break;case`closeOptions`:this._isOptionsOpen=!1}}}handleTagRemove(e){this.removeSelected(e),this._hasTextInput&&this.inputRef.value&&(this._inputFocus=!0,this.inputRef.value.focus(),this.requestUpdate())}getInsideTags(){return Array.from(this.querySelectorAll(`.pkt-combobox__input .pkt-combobox__tag-list pkt-tag`))}focusTag(e){let t=this.getInsideTags();t.forEach((t,n)=>{t.buttonTabindex=n===e?0:-1}),(t[e]?.querySelector(`button`))?.focus()}resetTagTabindices(){this.getInsideTags().forEach(e=>{e.buttonTabindex=-1})}handleTagKeydown(e,t){e.stopPropagation();let n=()=>{this.resetTagTabindices(),this._hasTextInput&&this.inputRef.value?this.inputRef.value.focus():this.triggerRef.value?.focus()};switch(e.key){case`ArrowLeft`:e.preventDefault(),t>0&&this.focusTag(t-1);break;case`ArrowRight`:e.preventDefault(),t<this._value.length-1?this.focusTag(t+1):n();break;case`Backspace`:case`Delete`:e.preventDefault();{let e=this._value[t],r=t>=this._value.length-1?t-1:t;this.removeSelected(e),r>=0?(this.requestUpdate(),this.updateComplete.then(()=>this.focusTag(r))):n()}break;case`Tab`:this.resetTagTabindices();break;case`Escape`:e.preventDefault(),n()}}checkForMatches(){let e=m(this.inputRef.value?.value||this._search||``,this._value,this.options,this.allowUserInput,this.multiple);if(e.shouldRemoveValue&&this.removeValue(this._value[0]),e.shouldResetInput){this.resetComboboxInput(!1);return}this._addValueText=e.addValueText,this._userInfoMessage=e.userInfoMessage}},S=class extends x{constructor(...e){super(...e),this.handleBodyClick=e=>{this._isOptionsOpen&&!this.contains(e.target)&&this.closeAndProcessInput()}}connectedCallback(){if(super.connectedCallback(),document?.body.addEventListener(`click`,this.handleBodyClick),this._options=[],this.defaultOptions&&this.defaultOptions.length){let e=this.options?.filter(e=>e.userAdded)||[];this.options=[...e,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=v.cloneOptions(this.options)}if(this.optionsController?.nodes&&this.optionsController.nodes.length){let e=_.parseOptionsFromSlot(this.optionsController.nodes);e.length&&(this.options=[...e],this._options=[...e],this._optionsFromSlot=!0,this._lastSlotGeneration=this.optionsController.generation)}}disconnectedCallback(){super.disconnectedCallback(),document?.body.removeEventListener(`click`,this.handleBodyClick)}firstUpdated(e){this.defaultValue!==null&&!this.value&&(this.value=this.defaultValue),super.firstUpdated(e)}willUpdate(e){if(this._optionsFromSlot&&this.optionsController){let e=this.optionsController.generation;if(e!==this._lastSlotGeneration){this._lastSlotGeneration=e;let t=_.parseOptionsFromSlot(this.optionsController.nodes),n=this._options.filter(e=>e.userAdded);this.options=[...n,...t]}}if(super.willUpdate(e),e.has(`isOpen`)&&(this._isOptionsOpen=this.isOpen),e.has(`defaultOptions`)&&this.defaultOptions.length){let e=(Array.isArray(this.options)?this.options:[]).filter(e=>e.userAdded)||[];this.options=[...e,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=v.cloneOptions(this.options)}let t=e.has(`value`),n=e.has(`_value`);if(t){let e=[...this._value],t=this.parseValue();t.join(`,`)!==this._value.join(`,`)&&(this._value=t,this._options.forEach(e=>e.selected=t.includes(e.value)),this._options=[...this._options]),this._pendingDispatchFrom??=e}else n&&(this._pendingDispatchFrom??=e.get(`_value`)??[]);if(e.has(`defaultValue`)&&this.defaultValue!=null&&!this._value.length){let e=this.parseToValues(this.defaultValue);e.length&&(this._pendingDispatchFrom??=[...this._value],this._value=e,this._options.forEach(t=>t.selected=e.includes(t.value)),this._options=[...this._options])}if(e.has(`options`)){let t=e.get(`options`)||this._options||[],n=v.mergeWithUserAdded(v.cloneOptions(this.options),t,this._value);this._options=n,n.length>this.options.length&&(this.options=n);let r=v.syncOptionsWithValues(this._options,this._value);this._options=r.options,r.newValues.length>this._value.length&&(this._pendingDispatchFrom??=[...this._value],this._value=r.newValues)}(t||n||e.has(`options`)||e.has(`defaultValue`))&&this.updateMaxReached(),this._pendingDispatchFrom&&this.syncPublicValue()}updated(e){if(this._pendingDispatchFrom){let e=this._pendingDispatchFrom;this._pendingDispatchFrom=null,this.dispatchValueChange(e)}if(e.has(`_search`)&&this.dispatchEvent(new CustomEvent(`search`,{detail:this._search,bubbles:!1})),!this._isOptionsOpen&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!==`hidden`){let e=!this.multiple&&this._value[0]?h(this._value[0],this.options,this.displayValueAs):``;this.inputRef.value.value!==e&&(this.inputRef.value.value=e)}this.classList.add(`pkt-combobox-component`),this.classList.toggle(`pkt-combobox-component--fullwidth`,!!this.fullwidth),super.updated(e)}formResetCallback(){this.touched=!1;let e=this.defaultValue||(this.multiple,``);this.value=e,this._value=this.parseValue(),this._options=this._options.filter(e=>!e.userAdded).map(e=>({...e,selected:this._value.includes(e.value)})),this.options=this.options.filter(e=>!e.userAdded).map(e=>({...e,selected:this._value.includes(e.value)})),this._search=``,this._isOptionsOpen=!1,this._userInfoMessage=``,this._addValueText=null,this._inputFocus=!1,this.updateMaxReached(),this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=``),this.setFormValue(``),this.internals.ariaInvalid=`false`,this.requestUpdate()}attributeChangedCallback(e,t,n){if(e===`options`){this._options=v.cloneOptions(this.options);let e=v.syncOptionsWithValues(this._options,this._value);this._options=e.options,e.newValues.length>this._value.length&&(this._value=e.newValues),this._search=``}super.attributeChangedCallback(e,t,n)}render(){return e._`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
3
|
${r.n(this,[`helptext`])}
|
|
4
4
|
.strings=${this.strings}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./element-with-slot-CcJPCLgn.cjs");require("./icon-jPhyZD1z.cjs"),require("./calendar-C5QwPrbk.cjs");const r=require("./if-defined-CiML3MTM.cjs"),i=require("./ref-CB7e9nMY.cjs"),a=require("./converters-BJ9Fe0kW.cjs");require("./tag-BMtnaJ1A.cjs");const o=require("./repeat-CnnigVcj.cjs"),s=require("./utils-63cRpWut.cjs"),c=require("./input-element-
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./element-with-slot-CcJPCLgn.cjs");require("./icon-jPhyZD1z.cjs"),require("./calendar-C5QwPrbk.cjs");const r=require("./if-defined-CiML3MTM.cjs"),i=require("./ref-CB7e9nMY.cjs"),a=require("./converters-BJ9Fe0kW.cjs");require("./tag-BMtnaJ1A.cjs");const o=require("./repeat-CnnigVcj.cjs"),s=require("./utils-63cRpWut.cjs"),c=require("./input-element-BjnKPikY.cjs");require("./input-wrapper-BwzajfFX.cjs");var l=class extends e.t{constructor(...e){super(...e),this.dates=[],this.dateformat=`dd.MM.yyyy`,this.className=`pkt-datepicker__tags`,this.idBase=s.n()}render(){return this.classes={"pkt-date-tags":!0,[this.className]:!0},e._`
|
|
2
2
|
<div class=${t.t(this.classes)} aria-live="polite">
|
|
3
3
|
${Array.isArray(this.dates)&&this.dates[0]?o.t(a.h((this.dates??[]).filter(Boolean)),e=>e,t=>e._` <pkt-tag
|
|
4
4
|
id=${this.idBase+t+`-tag`}
|
|
@@ -9,7 +9,7 @@ import { a as f, c as p, d as m, h, i as g, m as _, n as v, r as y, s as b, t as
|
|
|
9
9
|
import "./tag-uVXp7uP-.js";
|
|
10
10
|
import { t as C } from "./repeat-CV9S4zya.js";
|
|
11
11
|
import { n as w, t as T } from "./utils-BwF4QSrq.js";
|
|
12
|
-
import { t as E } from "./input-element-
|
|
12
|
+
import { t as E } from "./input-element-mTphzs9b.js";
|
|
13
13
|
import "./input-wrapper-Bb6CZxmg.js";
|
|
14
14
|
//#region src/components/datepicker/date-tags.ts
|
|
15
15
|
var D = class extends o {
|
|
@@ -11,7 +11,7 @@ import { n as g, t as _ } from "./ref-y_5qv9vU.js";
|
|
|
11
11
|
import { n as v, t as y } from "./focus-trap-DG3pEuyJ.js";
|
|
12
12
|
import { n as b, t as x } from "./scroll-lock-BALd8hF9.js";
|
|
13
13
|
import "./link-sO401Ieh.js";
|
|
14
|
-
import "./textinput-
|
|
14
|
+
import "./textinput-0DZeMqBr.js";
|
|
15
15
|
import "./searchinput-Bkcr3Fby.js";
|
|
16
16
|
import "./header-menu-F3tZZ5vO.js";
|
|
17
17
|
//#region ../../shared-types/header.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-CcJPCLgn.cjs"),i=require("./booleanish-BF8l4scU.cjs"),a=require("./fetch-header-footer-data-CUKV0biS.cjs");require("./icon-jPhyZD1z.cjs");const o=require("./if-defined-CiML3MTM.cjs");require("./button-BFG-7bDB.cjs");const s=require("./ref-CB7e9nMY.cjs"),c=require("./focus-trap-DSv4Ifqm.cjs"),l=require("./scroll-lock-B46ur0FF.cjs");require("./link-CRLAhYi0.cjs"),require("./textinput-
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-CcJPCLgn.cjs"),i=require("./booleanish-BF8l4scU.cjs"),a=require("./fetch-header-footer-data-CUKV0biS.cjs");require("./icon-jPhyZD1z.cjs");const o=require("./if-defined-CiML3MTM.cjs");require("./button-BFG-7bDB.cjs");const s=require("./ref-CB7e9nMY.cjs"),c=require("./focus-trap-DSv4Ifqm.cjs"),l=require("./scroll-lock-B46ur0FF.cjs");require("./link-CRLAhYi0.cjs"),require("./textinput-BqBgsBZF.cjs"),require("./searchinput-Mdc9Ihld.cjs"),require("./header-menu-Cz7G7Q2R.cjs");var u=e=>typeof e.target==`string`?{title:e.title,iconName:e.iconName,href:e.target}:{title:e.title,iconName:e.iconName,onClick:e.target},d=e=>u(e),f=e=>{if(!e)return;let t=typeof e==`string`?new Date(e):e;if(!isNaN(t.getTime()))return t.toLocaleDateString(`nb-NO`,{day:`numeric`,month:`long`,year:`numeric`,hour:`2-digit`,minute:`2-digit`})},p=class{constructor(e,t){this.isMobile=!1,this.isTablet=!1,this.isHidden=!1,this.pauseScrollHide=!1,this.componentWidth=typeof window<`u`?window.innerWidth:0,this.lastScrollPosition=0,this.scrollLockToken=l.t(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1,this.handleScroll=()=>{if(this.getOptions().scrollBehavior!==`hide`||this.pauseScrollHide)return;let e=window.pageYOffset||document.documentElement.scrollTop;if(e<0||Math.abs(e-this.lastScrollPosition)<60)return;let t=e>this.lastScrollPosition;this.lastScrollPosition=e,t!==this.isHidden&&(this.isHidden=t,this.host.requestUpdate())},this.host=e,this.getOptions=t,e.addController(this)}hostConnected(){window.addEventListener(`scroll`,this.handleScroll)}hostDisconnected(){this.resizeObserver?.disconnect(),window.removeEventListener(`scroll`,this.handleScroll),l.n(this.scrollLockToken,!1)}observe(e){e&&(this.componentWidth=e.offsetWidth,this.refreshBreakpoints(),this.resizeObserver=new ResizeObserver(e=>{for(let t of e)this.componentWidth=t.borderBoxSize&&t.borderBoxSize.length>0?t.borderBoxSize[0].inlineSize:t.contentRect.width,this.refreshBreakpoints()}),this.resizeObserver.observe(e))}refreshBreakpoints(){let{mobileBreakpoint:e,tabletBreakpoint:t}=this.getOptions(),n=this.componentWidth<e,r=this.componentWidth<t;(n!==this.isMobile||r!==this.isTablet)&&(this.isMobile=n,this.isTablet=r,this.host.requestUpdate())}setScrollLock(e){l.n(this.scrollLockToken,e)}captureFocus(){this.lastFocusedElement=document.activeElement}flagRestoreFocus(){this.shouldRestoreFocus=!0}restoreFocus(){this.shouldRestoreFocus&&this.lastFocusedElement&&document.contains(this.lastFocusedElement)&&this.lastFocusedElement.focus(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1}},m=class extends e.t{constructor(...e){super(...e),this.canChangeRepresentation=!1,this.logoutOnClick=!1}handleChangeRepresentation(){this.dispatchEvent(new CustomEvent(`change-representation`,{bubbles:!0,composed:!0}))}handleLogout(){this.dispatchEvent(new CustomEvent(`log-out`,{bubbles:!0,composed:!0}))}handleMenuItemClick(e){`onClick`in e&&typeof e.onClick==`function`&&e.onClick()}renderLinkOrButton(n,r){let i=`href`in n,a=t.t({"pkt-user-menu__link":!0,"pkt-link-button":!i,"pkt-link":!i,"pkt-link--icon-left":!i,[r||``]:!!r});return i?e._`
|
|
2
2
|
<pkt-link
|
|
3
3
|
iconName=${n.iconName||e.h}
|
|
4
4
|
href=${n.href}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./element-C6WTyJFE.cjs"),t=require("./format-B8meU8Tm.cjs"),n=require("./element-with-slot-CcJPCLgn.cjs"),r=require("./booleanish-BF8l4scU.cjs"),i=require("./utils-63cRpWut.cjs");var a=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,f=new WeakMap,p=new WeakMap,m=new WeakMap,h=new WeakMap,g=new WeakMap,_=new WeakMap,v=new WeakMap,y=new WeakMap,b=(e,t,n)=>{e.getAttribute(t)!==n&&e.setAttribute(t,n)},x=(e,t)=>{e.toggleAttribute(`internals-disabled`,t),t?b(e,`aria-disabled`,`true`):e.removeAttribute(`aria-disabled`),e.formDisabledCallback&&e.formDisabledCallback.apply(e,[t])},S=e=>{s.get(e).forEach(e=>{e.remove()}),s.set(e,[])},C=(e,t)=>{let n=document.createElement(`input`);return n.type=`hidden`,n.name=e.getAttribute(`name`),e.after(n),s.get(t).push(n),n},w=(e,t)=>{if(t.length){let n=Array.from(t);n.forEach(t=>t.addEventListener(`click`,e.click.bind(e)));let[r]=n,i=r.id;r.id||=(i=`${r.htmlFor}_Label`,i),b(e,`aria-labelledby`,i)}},T=e=>{let t=Array.from(e.elements).filter(e=>!e.tagName.includes(`-`)&&e.validity).map(e=>e.validity.valid),n=f.get(e)||[],r=Array.from(n).filter(e=>e.isConnected).map(e=>c.get(e).validity.valid),i=[...t,...r].includes(!1);e.toggleAttribute(`internals-invalid`,i),e.toggleAttribute(`internals-valid`,!i)},ee=e=>{T(E(e.target))},te=e=>{T(E(e.target))},ne=e=>{let t=[`button[type=submit]`,`input[type=submit]`,`button:not([type])`].map(e=>`${e}:not([disabled])`).map(t=>`${t}:not([form])${e.id?`,${t}[form='${e.id}']`:``}`).join(`,`);e.addEventListener(`click`,n=>{if(n.target.closest(t)){let t=f.get(e);if(e.noValidate)return;t.size&&Array.from(t).reverse().map(e=>c.get(e).reportValidity()).includes(!1)&&n.preventDefault()}})},re=e=>{let t=f.get(e.target);t&&t.size&&t.forEach(e=>{e.constructor.formAssociated&&e.formResetCallback&&e.formResetCallback.apply(e)})},ie=(e,t,n)=>{if(t){let r=f.get(t);if(r)r.add(e);else{let n=new Set;n.add(e),f.set(t,n),ne(t),t.addEventListener(`reset`,re),t.addEventListener(`input`,ee),t.addEventListener(`change`,te)}u.set(t,{ref:e,internals:n}),e.constructor.formAssociated&&e.formAssociatedCallback&&setTimeout(()=>{e.formAssociatedCallback.apply(e,[t])},0),T(t)}},E=e=>{let t=e.parentNode;return t&&t.tagName!==`FORM`&&(t=E(t)),t},D=(e,t,n=DOMException)=>{if(!e.constructor.formAssociated)throw new n(t)},O=(e,t,n)=>{let r=f.get(e);return r&&r.size&&r.forEach(e=>{c.get(e)[n]()||(t=!1)}),t},k=e=>{let t=!1;if(e.constructor.formAssociated){let n=c.get(e);n===void 0&&(e.attachInternals(),n=c.get(e),t=!0);let{labels:r,form:i}=n;w(e,r),ie(e,i,n)}return t};function A(){return typeof MutationObserver<`u`}var j={ariaAtomic:`aria-atomic`,ariaAutoComplete:`aria-autocomplete`,ariaBrailleLabel:`aria-braillelabel`,ariaBrailleRoleDescription:`aria-brailleroledescription`,ariaBusy:`aria-busy`,ariaChecked:`aria-checked`,ariaColCount:`aria-colcount`,ariaColIndex:`aria-colindex`,ariaColIndexText:`aria-colindextext`,ariaColSpan:`aria-colspan`,ariaCurrent:`aria-current`,ariaDescription:`aria-description`,ariaDisabled:`aria-disabled`,ariaExpanded:`aria-expanded`,ariaHasPopup:`aria-haspopup`,ariaHidden:`aria-hidden`,ariaInvalid:`aria-invalid`,ariaKeyShortcuts:`aria-keyshortcuts`,ariaLabel:`aria-label`,ariaLevel:`aria-level`,ariaLive:`aria-live`,ariaModal:`aria-modal`,ariaMultiLine:`aria-multiline`,ariaMultiSelectable:`aria-multiselectable`,ariaOrientation:`aria-orientation`,ariaPlaceholder:`aria-placeholder`,ariaPosInSet:`aria-posinset`,ariaPressed:`aria-pressed`,ariaReadOnly:`aria-readonly`,ariaRelevant:`aria-relevant`,ariaRequired:`aria-required`,ariaRoleDescription:`aria-roledescription`,ariaRowCount:`aria-rowcount`,ariaRowIndex:`aria-rowindex`,ariaRowIndexText:`aria-rowindextext`,ariaRowSpan:`aria-rowspan`,ariaSelected:`aria-selected`,ariaSetSize:`aria-setsize`,ariaSort:`aria-sort`,ariaValueMax:`aria-valuemax`,ariaValueMin:`aria-valuemin`,ariaValueNow:`aria-valuenow`,ariaValueText:`aria-valuetext`,role:`role`},ae=(e,t)=>{for(let n in j){t[n]=null;let r=null,i=j[n];Object.defineProperty(t,n,{get(){return r},set(n){r=n,e.isConnected?b(e,i,n):m.set(e,t)}})}},oe=(e,t)=>{s.set(t,[]),F.observe?.(e,P)};function M(e){let t=c.get(e),{form:n}=t;ie(e,n,t),w(e,t.labels)}var N=(e,t=!1)=>{let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return c.has(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),r=n.nextNode(),i=!t||e.disabled;for(;r;)r.formDisabledCallback&&i&&x(r,e.disabled),r=n.nextNode()},P={attributes:!0,attributeFilter:[`disabled`,`name`]},F=A()?new MutationObserver(e=>{for(let t of e){let e=t.target;if(t.attributeName===`disabled`&&(e.constructor.formAssociated?x(e,e.hasAttribute(`disabled`)):e.localName===`fieldset`&&N(e)),t.attributeName===`name`&&e.constructor.formAssociated){let t=c.get(e),n=p.get(e);t.setFormValue(n)}}}):{};function I(e){e.forEach(e=>{let{addedNodes:t,removedNodes:n}=e,r=Array.from(t),i=Array.from(n);r.forEach(e=>{if(c.has(e)&&e.constructor.formAssociated&&M(e),m.has(e)){let t=m.get(e);Object.keys(j).filter(e=>t[e]!==null).forEach(n=>{b(e,j[n],t[n])}),m.delete(e)}if(y.has(e)){let t=y.get(e);b(e,`internals-valid`,t.validity.valid.toString()),b(e,`internals-invalid`,(!t.validity.valid).toString()),b(e,`aria-invalid`,(!t.validity.valid).toString()),y.delete(e)}if(e.localName===`form`){let t=f.get(e),n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return c.has(e)&&e.constructor.formAssociated&&!(t&&t.has(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),r=n.nextNode();for(;r;)M(r),r=n.nextNode()}e.localName===`fieldset`&&(F.observe?.(e,P),N(e,!0))}),i.forEach(e=>{let t=c.get(e);t&&s.get(t)&&S(t),d.has(e)&&d.get(e).disconnect()})})}function se(e){e.forEach(e=>{let{removedNodes:t}=e;t.forEach(t=>{let n=_.get(e.target);c.has(t)&&k(t),n.disconnect()})})}var ce=e=>{let t=new MutationObserver(se);window?.ShadyDOM?.inUse&&e.mode&&e.host&&(e=e.host),t.observe?.(e,{childList:!0}),_.set(e,t)};A()&&new MutationObserver(I);var L={childList:!0,subtree:!0},le=class{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}},ue=e=>(e.badInput=!1,e.customError=!1,e.patternMismatch=!1,e.rangeOverflow=!1,e.rangeUnderflow=!1,e.stepMismatch=!1,e.tooLong=!1,e.tooShort=!1,e.typeMismatch=!1,e.valid=!0,e.valueMissing=!1,e),de=(e,t,n)=>(e.valid=fe(t),Object.keys(t).forEach(n=>e[n]=t[n]),n&&T(n),e),fe=e=>{let t=!0;for(let n in e)n!==`valid`&&e[n]!==!1&&(t=!1);return t},R=new WeakMap;function z(e,t){e.toggleAttribute(t,!0),e.part&&e.part.add(t)}var B=class extends Set{static get isPolyfilled(){return!0}constructor(e){if(super(),!e||!e.tagName||e.tagName.indexOf(`-`)===-1)throw TypeError(`Illegal constructor`);R.set(this,e)}add(e){if(!/^--/.test(e)||typeof e!=`string`)throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${e} must start with '--'.`);let t=super.add(e),n=R.get(this),r=`state${e}`;return n.isConnected?z(n,r):setTimeout(()=>{z(n,r)}),t}clear(){for(let[e]of this.entries())this.delete(e);super.clear()}delete(e){let t=super.delete(e),n=R.get(this);return n.isConnected?(n.toggleAttribute(`state${e}`,!1),n.part&&n.part.remove(`state${e}`)):setTimeout(()=>{n.toggleAttribute(`state${e}`,!1),n.part&&n.part.remove(`state${e}`)}),t}},pe=function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},V=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},H,me=class{constructor(e){H.set(this,void 0),pe(this,H,e,`f`);for(let t=0;t<e.length;t++){let n=e[t];this[t]=n,n.hasAttribute(`name`)&&(this[n.getAttribute(`name`)]=n)}Object.freeze(this)}get length(){return V(this,H,`f`).length}[(H=new WeakMap,Symbol.iterator)](){return V(this,H,`f`)[Symbol.iterator]()}item(e){return this[e]==null?null:this[e]}namedItem(e){return this[e]==null?null:this[e]}};function he(){let e=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=n;let t=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=r;function n(...t){let n=e.apply(this,t);return O(this,n,`checkValidity`)}function r(...e){let n=t.apply(this,e);return O(this,n,`reportValidity`)}let{get:i}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,`elements`);Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...e){let t=i.call(this,...e),n=Array.from(f.get(this)||[]);return n.length===0?t:new me(Array.from(t).concat(n).sort((e,t)=>e.compareDocumentPosition?e.compareDocumentPosition(t)&2?1:-1:0))}})}var U=class{static get isPolyfilled(){return!0}constructor(e){if(!e||!e.tagName||e.tagName.indexOf(`-`)===-1)throw TypeError(`Illegal constructor`);let t=e.getRootNode(),n=new le;this.states=new B(e),a.set(this,e),o.set(this,n),c.set(e,this),ae(e,this),oe(e,this),Object.seal(this),t instanceof DocumentFragment&&ce(t)}checkValidity(){let e=a.get(this);if(D(e,`Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!this.willValidate)return!0;let t=o.get(this);if(!t.valid){let t=new Event(`invalid`,{bubbles:!1,cancelable:!0,composed:!1});e.dispatchEvent(t)}return t.valid}get form(){let e=a.get(this);D(e,`Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.`);let t;return e.constructor.formAssociated===!0&&(t=E(e)),t}get labels(){let e=a.get(this);D(e,`Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.`);let t=e.getAttribute(`id`),n=e.getRootNode();return n&&t?n.querySelectorAll(`[for="${t}"]`):[]}reportValidity(){let e=a.get(this);if(D(e,`Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!this.willValidate)return!0;let t=this.checkValidity(),n=g.get(this);if(n&&!e.constructor.formAssociated)throw new DOMException(`Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.`);return!t&&n&&(e.focus(),n.focus()),t}setFormValue(e){let t=a.get(this);if(D(t,`Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element.`),S(this),e!=null&&!(e instanceof FormData)){if(t.getAttribute(`name`)){let n=C(t,this);n.value=e}}else e!=null&&e instanceof FormData&&Array.from(e).reverse().forEach(([e,n])=>{if(typeof n==`string`){let r=C(t,this);r.name=e,r.value=n}});p.set(t,e)}setValidity(e,t,n){let r=a.get(this);if(D(r,`Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!e)throw TypeError(`Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.`);g.set(this,n);let i=o.get(this),s={};for(let t in e)s[t]=e[t];Object.keys(s).length===0&&ue(i);let c={...i,...s};delete c.valid;let{valid:u}=de(i,c,this.form);if(!u&&!t)throw new DOMException(`Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.`);l.set(this,u?``:t),r.isConnected?(r.toggleAttribute(`internals-invalid`,!u),r.toggleAttribute(`internals-valid`,u),b(r,`aria-invalid`,`${!u}`)):y.set(r,this)}get shadowRoot(){let e=a.get(this);return h.get(e)||null}get validationMessage(){return D(a.get(this),`Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element.`),l.get(this)}get validity(){return D(a.get(this),`Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element.`),o.get(this)}get willValidate(){let e=a.get(this);return D(e,`Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element.`),!(e.matches(`:disabled`)||e.disabled||e.hasAttribute(`disabled`)||e.hasAttribute(`readonly`))}};function ge(){if(typeof window>`u`||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class e extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}let t=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,``)}`;customElements.define(t,e);let n=new e;return[`shadowRoot`,`form`,`willValidate`,`validity`,`validationMessage`,`labels`,`setFormValue`,`setValidity`,`checkValidity`,`reportValidity`].every(e=>e in n.internals)}var W=!1,G=!1;function K(e){G||(G=!0,window.CustomStateSet=B,e&&(HTMLElement.prototype.attachInternals=function(...t){let n=e.call(this,t);return n.states=new B(this),n}))}function _e(e=!0){let t=!1;if(!W){if(W=!0,typeof window<`u`&&(window.ElementInternals=U),typeof CustomElementRegistry<`u`){let e=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(n,r,i){if(r.formAssociated){let e=r.prototype.connectedCallback;r.prototype.connectedCallback=function(){v.has(this)||(v.set(this,!0),this.hasAttribute(`disabled`)&&x(this,!0)),e?.apply(this),t=k(this)}}e.call(this,n,r,i)}}if(typeof HTMLElement<`u`&&(HTMLElement.prototype.attachInternals=function(){if(!this.tagName)return{};if(this.tagName.indexOf(`-`)===-1)throw Error(`Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.`);if(c.has(this)&&!t)throw new DOMException(`DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.`);return new U(this)}),typeof Element<`u`){function n(...t){let n=e.apply(this,t);if(h.set(this,n),A()){let e=new MutationObserver(I);window.ShadyDOM?e.observe(this,L):e.observe(n,L),d.set(this,e)}return n}let e=Element.prototype.attachShadow;Element.prototype.attachShadow=n}A()&&typeof document<`u`&&new MutationObserver(I).observe(document.documentElement,L),typeof HTMLFormElement<`u`&&he(),(e||typeof window<`u`&&!window.CustomStateSet)&&K()}}customElements.polyfillWrapFlushCallback||(ge()?typeof window<`u`&&!window.CustomStateSet&&K(HTMLElement.prototype.attachInternals):_e(!1));var q=`on`,J=`--checked`,Y=`,`,X=e=>e===!0||e===``||e===`true`,Z=new WeakMap,ve=0,ye=e=>{let t=Z.get(e);return t||(t=e.id||`form${++ve}`,Z.set(e,t)),t},Q=()=>!!globalThis.ElementInternals?.isPolyfilled,$=class e extends n.t{static get formAssociated(){return!0}get form(){let e=this.getAttribute(`form`);if(e!==null){if(!e)return null;let t=this.getRootNode(),n=typeof t.getElementById==`function`?t.getElementById(e):this.ownerDocument?.getElementById(e);return n instanceof HTMLFormElement?n:null}return this.internals?.form??this.closest(`form`)}get ariaDescribedBy(){return this.ariaDescribedby}set ariaDescribedBy(e){this.ariaDescribedby=e}formDisabledCallback(e){this.formDisabled=e}get isDisabled(){return this.disabled||this.formDisabled}get optionGroup(){return this.groupContext}setGroupValidity(e){this.groupValidityMessage!==e&&(this.groupValidityMessage=e,this.inputRef?.value&&this.manageValidity(this.inputRef.value))}syncGroupName(){let e=this.optionGroup?.name;if(!e)return;let t=!this.name||this.name===this.derivedName;t&&this.name!==e&&(this.name=e),t&&(this.derivedName=e)}effectiveCounter(e){return this.counter??e}effectiveHasFieldset(e){return this.hasFieldset??e}constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.step=null,this.ariaDescribedby=null,this.ariaLabelledby=null,this.name=``,this.pattern=null,this.placeholder=null,this.id=i.n(),this.counter=null,this.hasError=!1,this.inline=!1,this.hasFieldset=null,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage=``,this.helptext=``,this.helptextDropdown=``,this.helptextDropdownButton=null,this.label=null,this.tagText=null,this.inputSize=`medium`,this.dataTestid=``,this.formDisabled=!1,this.derivedName=null,this.groupValidityMessage=``,this.touched=!1,this._initialized=!1,this.polyfillFormValue=null,this._didInitDerivedState=!1,this._defaultCheckedState=!1,this.internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),Q()&&queueMicrotask(()=>{this.isConnected&&this.polyfillFormValue&&this.internals.setFormValue(this.polyfillFormValue.value)})}get internalName(){let e=this.form;return e?`${this.name}-internal-${ye(e)}`:`${this.name}-internal`}formAssociatedCallback(){this.requestUpdate()}writeFormValue(e){this.internals.setFormValue(e),Q()&&(this.polyfillFormValue={value:e})}manageValidity(e,n){if(!e){console.warn(`manageValidity called without valid input element`);return}let r=this.pktStrings.get(`validation`);(this.isCheckable?this.checkableValueMissing(n??this.checkableGroup()):this.required&&!this.value)?this.internals.setValidity(this.groupValidityMessage?{valueMissing:!0,customError:!0}:{valueMissing:!0},this.groupValidityMessage||r.valueMissing,e):e.validity?.typeMismatch||e.validity?.badInput?this.internals.setValidity({typeMismatch:!0},r.typeMismatch,e):e.validity?.patternMismatch?this.internals.setValidity({patternMismatch:!0},r.patternMismatch,e):e.validity?.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},r.tooShort,e):e.validity?.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},r.tooLong,e):e.validity?.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?t.t(r.rangeUnderflowMin,{min:this.min.toString()}):r.rangeUnderflow,e):e.validity?.stepMismatch?this.internals.setValidity({stepMismatch:!0},r.typeMismatch,e):e.validity?.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?t.t(r.rangeOverflowMax,{max:this.max.toString()}):r.rangeOverflow,e):e.validity?.customError?this.internals.setValidity({customError:!0},e.validationMessage,e):this.groupValidityMessage?this.internals.setValidity({customError:!0},this.groupValidityMessage,e):this.internals.setValidity({})}setFormValue(e){if(this.internals){if(Array.isArray(e)){let t=new FormData;e.forEach(e=>{t.append(this.name,e)}),this.writeFormValue(t)}else this.writeFormValue(e)}}radioGroupMembers(){let e=this.getRootNode();if(typeof e.querySelectorAll!=`function`)return[];let t=this.form;return Array.from(e.querySelectorAll(`pkt-radiobutton, input[type="radio"]`)).filter(e=>e!==this&&e.getAttribute(`name`)===this.name&&e.form===t)}get isCheckable(){return this.type===`checkbox`||this.type===`radio`}checkableGroup(){return this.type===`radio`?[this,...this.radioGroupMembers()]:[this]}get isRequired(){return this.required||this.type===`radio`&&!!this.optionGroup?.required}checkableValueMissing(t){return this.type===`radio`?t.some(t=>t instanceof e?t.isRequired:t.required)&&!t.some(e=>X(e.checked)):this.required&&!X(this.checked)}syncCheckedState(){if(!this.internals)return;let e=X(this.checked);this.internals.ariaChecked=String(e),e?(this.writeFormValue((typeof this.value==`string`?this.value:``)||q),this.internals.states?.add(J)):(this.writeFormValue(null),this.internals.states?.delete(J)),this.inputRef?.value&&this.inputRef.value.checked!==e&&(this.inputRef.value.checked=e)}validateCheckable(){let t=this.checkableGroup();t.forEach(n=>{if(!(n instanceof e))return;let r=n;r.inputRef?.value&&r.manageValidity(r.inputRef.value,t)})}coordinateRadioGroup(){!this.name||this.type!==`radio`||this.radioGroupMembers().forEach(t=>{t instanceof e?X(t.checked)&&(t.checked=!1,t.syncCheckedState()):t.checked&&=!1})}valueChecked(e){this.touched&&(this.type===`radio`&&this.coordinateRadioGroup(),typeof e==`string`?this.checked=e===`true`:typeof e==`boolean`&&(this.checked=e),this.syncCheckedState(),this.validateCheckable(),this.onInput(),this.dispatchChangeEvents(this.checked))}valueChanged(e,t){let n=e;if(typeof n==`number`||typeof n==`boolean`)e=String(n);else if(n!=null&&typeof n!=`string`&&!Array.isArray(n)){let e=typeof n==`object`?n?.constructor?.name??`object`:typeof n;console.warn(`${this.localName}: value må være en streng eller et tall, men fikk ${e}. Verdien ignoreres. For dato-/tidsfelt, send en ISO-formatert streng (f.eks. "2026-07-09" eller "13:45").`)}(t!==this.value||t!==this._value)&&(typeof e==`string`?((this.multiple||this.range)&&e.includes(Y)&&(e=e.split(Y)),this.value=e,this._value=Array.isArray(e)?e:[e]):Array.isArray(e)?(this.value=this.multiple||this.range?e:e[0],this._value=e):(this.value=``,this._value=[]),(!this.value||this.value.length===0)&&t&&t.length!==0?this.clearInputValue():this.value&&this.value.toString()!==t?.toString()&&this.onChange(this.value))}dispatchChangeEvents(e){this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`value-change`,{detail:e,bubbles:!0,composed:!0}))}clearInputValue(){let e=this.multiple||this.range?[]:``;this.value=e,this.setFormValue(e),this.dispatchChangeEvents(e)}onFocus(){this.dispatchEvent(new FocusEvent(`focus`,{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent(`blur`,{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent(`input`,{bubbles:!0,composed:!0}))}normalizeValue(e){return(this.range||this.multiple)&&typeof e==`string`&&e.includes(Y)?e.split(Y):!this.multiple&&!this.range&&Array.isArray(e)?e[0]||``:e}validate(){this.inputRef?.value&&this.manageValidity(this.inputRef.value),this.inputRefTo?.value&&this.manageValidity(this.inputRefTo.value)}onChange(e){if(this.touched=!0,typeof e!=`string`&&!Array.isArray(e))return;let t=this.normalizeValue(e);this.setFormValue(t),this.validate(),this._initialized&&this.dispatchChangeEvents(t)}formResetCallback(){if(this.touched=!1,this._options&&this._options.length&&this._options.forEach(e=>{`selected`in e&&(e.selected=!1)}),this.checked!==void 0)this.checked=this._defaultCheckedState,this.syncCheckedState(),this.validateCheckable();else{this.writeFormValue(``);let e=this.defaultValue||(this.multiple||this.range?[]:``);this.value=e,this._value=Array.isArray(e)?e:[e],this.valueChanged(this.value,null)}this.internals.ariaInvalid=`false`}updated(e){super.updated(e),this.isCheckable&&this._initialized&&(e.has(`defaultChecked`)&&e.get(`defaultChecked`)!==void 0&&(this._defaultCheckedState=!!this.defaultChecked),e.has(`groupContext`)&&this.isRequired&&(this.internals.ariaRequired=`true`),[`checked`,`value`,`required`,`name`,`groupContext`].some(t=>e.has(t))&&(this.syncCheckedState(),this.validateCheckable())),e.has(`dataTestid`)&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute(`data-testid`)||this.setAttribute(`data-testid`,this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute(`data-testid`)))}willUpdate(e){super.willUpdate(e),e.has(`disabled`)&&this.toggleAttribute(`disabled`,this.disabled),this.syncGroupName(),!this._didInitDerivedState&&(this._didInitDerivedState=!0,this.defaultChecked&&(this.checked=!0),this.id&&!this.name&&(this.name=this.id,this.derivedName=this.id),this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null))}firstUpdated(e){if(super.firstUpdated(e),this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=`true`),this.isRequired&&(this.internals.ariaRequired=`true`),this.disabled&&(this.internals.ariaDisabled=`true`),this.checked!==void 0){let e=X(this.checked);this._defaultCheckedState=e,this.internals.ariaChecked=String(e);let t=e?(typeof this.value==`string`?this.value:``)||q:null;this.writeFormValue(t)}else this.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute(`form`,``),this.isCheckable?this.validateCheckable():this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute(`form`,``),this.manageValidity(this.inputRefTo.value)),this.updateComplete.then(()=>{this._initialized=!0})}};e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`checked`,void 0),e.n([e.u({type:Boolean})],$.prototype,`defaultChecked`,void 0),e.n([e.u({type:Boolean})],$.prototype,`multiple`,void 0),e.n([e.u({type:Boolean})],$.prototype,`range`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`type`,void 0),e.n([e.u()],$.prototype,`defaultValue`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`disabled`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`readonly`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`required`,void 0),e.n([e.u({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],$.prototype,`max`,void 0),e.n([e.u({type:Number,reflect:!0})],$.prototype,`maxlength`,void 0),e.n([e.u({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],$.prototype,`min`,void 0),e.n([e.u({type:Number,reflect:!0})],$.prototype,`minlength`,void 0),e.n([e.u({type:Number,reflect:!0})],$.prototype,`step`,void 0),e.n([e.u({type:String,attribute:`aria-describedby`})],$.prototype,`ariaDescribedby`,void 0),e.n([e.u({type:String,attribute:`aria-labelledby`})],$.prototype,`ariaLabelledby`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`name`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`pattern`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`placeholder`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`id`,void 0),e.n([e.u({type:Boolean,converter:r.n})],$.prototype,`counter`,void 0),e.n([e.u({type:Boolean})],$.prototype,`hasError`,void 0),e.n([e.u({type:Boolean})],$.prototype,`inline`,void 0),e.n([e.u({type:Boolean,converter:r.n})],$.prototype,`hasFieldset`,void 0),e.n([e.u({type:Boolean})],$.prototype,`optionalTag`,void 0),e.n([e.u({type:Boolean})],$.prototype,`requiredTag`,void 0),e.n([e.u({type:Boolean})],$.prototype,`skipForwardTestid`,void 0),e.n([e.u({type:Boolean,reflect:!0,converter:r.t})],$.prototype,`useWrapper`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`fullwidth`,void 0),e.n([e.u({type:Number})],$.prototype,`counterMaxLength`,void 0),e.n([e.u({type:String})],$.prototype,`errorMessage`,void 0),e.n([e.u({type:String})],$.prototype,`helptext`,void 0),e.n([e.u({type:String})],$.prototype,`helptextDropdown`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`helptextDropdownButton`,void 0),e.n([e.u({type:String})],$.prototype,`label`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`optionalText`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`requiredText`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`tagText`,void 0),e.n([e.u({type:String,attribute:`input-size`})],$.prototype,`inputSize`,void 0),e.n([e.u({type:String,attribute:`data-testid`})],$.prototype,`dataTestid`,void 0),e.n([e.l()],$.prototype,`formDisabled`,void 0),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}});
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./format-B8meU8Tm.cjs"),n=require("./element-with-slot-CcJPCLgn.cjs"),r=require("./booleanish-BF8l4scU.cjs"),i=require("./utils-63cRpWut.cjs");var a=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,f=new WeakMap,p=new WeakMap,m=new WeakMap,h=new WeakMap,g=new WeakMap,_=new WeakMap,v=new WeakMap,y=new WeakMap,b=(e,t,n)=>{e.getAttribute(t)!==n&&e.setAttribute(t,n)},x=(e,t)=>{e.toggleAttribute(`internals-disabled`,t),t?b(e,`aria-disabled`,`true`):e.removeAttribute(`aria-disabled`),e.formDisabledCallback&&e.formDisabledCallback.apply(e,[t])},S=e=>{s.get(e).forEach(e=>{e.remove()}),s.set(e,[])},C=(e,t)=>{let n=document.createElement(`input`);return n.type=`hidden`,n.name=e.getAttribute(`name`),e.after(n),s.get(t).push(n),n},w=(e,t)=>{if(t.length){let n=Array.from(t);n.forEach(t=>t.addEventListener(`click`,e.click.bind(e)));let[r]=n,i=r.id;r.id||=(i=`${r.htmlFor}_Label`,i),b(e,`aria-labelledby`,i)}},T=e=>{let t=Array.from(e.elements).filter(e=>!e.tagName.includes(`-`)&&e.validity).map(e=>e.validity.valid),n=f.get(e)||[],r=Array.from(n).filter(e=>e.isConnected).map(e=>c.get(e).validity.valid),i=[...t,...r].includes(!1);e.toggleAttribute(`internals-invalid`,i),e.toggleAttribute(`internals-valid`,!i)},ee=e=>{T(E(e.target))},te=e=>{T(E(e.target))},ne=e=>{let t=[`button[type=submit]`,`input[type=submit]`,`button:not([type])`].map(e=>`${e}:not([disabled])`).map(t=>`${t}:not([form])${e.id?`,${t}[form='${e.id}']`:``}`).join(`,`);e.addEventListener(`click`,n=>{if(n.target.closest(t)){let t=f.get(e);if(e.noValidate)return;t.size&&Array.from(t).reverse().map(e=>c.get(e).reportValidity()).includes(!1)&&n.preventDefault()}})},re=e=>{let t=f.get(e.target);t&&t.size&&t.forEach(e=>{e.constructor.formAssociated&&e.formResetCallback&&e.formResetCallback.apply(e)})},ie=(e,t,n)=>{if(t){let r=f.get(t);if(r)r.add(e);else{let n=new Set;n.add(e),f.set(t,n),ne(t),t.addEventListener(`reset`,re),t.addEventListener(`input`,ee),t.addEventListener(`change`,te)}u.set(t,{ref:e,internals:n}),e.constructor.formAssociated&&e.formAssociatedCallback&&setTimeout(()=>{e.formAssociatedCallback.apply(e,[t])},0),T(t)}},E=e=>{let t=e.parentNode;return t&&t.tagName!==`FORM`&&(t=E(t)),t},D=(e,t,n=DOMException)=>{if(!e.constructor.formAssociated)throw new n(t)},O=(e,t,n)=>{let r=f.get(e);return r&&r.size&&r.forEach(e=>{c.get(e)[n]()||(t=!1)}),t},k=e=>{let t=!1;if(e.constructor.formAssociated){let n=c.get(e);n===void 0&&(e.attachInternals(),n=c.get(e),t=!0);let{labels:r,form:i}=n;w(e,r),ie(e,i,n)}return t};function A(){return typeof MutationObserver<`u`}var j={ariaAtomic:`aria-atomic`,ariaAutoComplete:`aria-autocomplete`,ariaBrailleLabel:`aria-braillelabel`,ariaBrailleRoleDescription:`aria-brailleroledescription`,ariaBusy:`aria-busy`,ariaChecked:`aria-checked`,ariaColCount:`aria-colcount`,ariaColIndex:`aria-colindex`,ariaColIndexText:`aria-colindextext`,ariaColSpan:`aria-colspan`,ariaCurrent:`aria-current`,ariaDescription:`aria-description`,ariaDisabled:`aria-disabled`,ariaExpanded:`aria-expanded`,ariaHasPopup:`aria-haspopup`,ariaHidden:`aria-hidden`,ariaInvalid:`aria-invalid`,ariaKeyShortcuts:`aria-keyshortcuts`,ariaLabel:`aria-label`,ariaLevel:`aria-level`,ariaLive:`aria-live`,ariaModal:`aria-modal`,ariaMultiLine:`aria-multiline`,ariaMultiSelectable:`aria-multiselectable`,ariaOrientation:`aria-orientation`,ariaPlaceholder:`aria-placeholder`,ariaPosInSet:`aria-posinset`,ariaPressed:`aria-pressed`,ariaReadOnly:`aria-readonly`,ariaRelevant:`aria-relevant`,ariaRequired:`aria-required`,ariaRoleDescription:`aria-roledescription`,ariaRowCount:`aria-rowcount`,ariaRowIndex:`aria-rowindex`,ariaRowIndexText:`aria-rowindextext`,ariaRowSpan:`aria-rowspan`,ariaSelected:`aria-selected`,ariaSetSize:`aria-setsize`,ariaSort:`aria-sort`,ariaValueMax:`aria-valuemax`,ariaValueMin:`aria-valuemin`,ariaValueNow:`aria-valuenow`,ariaValueText:`aria-valuetext`,role:`role`},ae=(e,t)=>{for(let n in j){t[n]=null;let r=null,i=j[n];Object.defineProperty(t,n,{get(){return r},set(n){r=n,e.isConnected?b(e,i,n):m.set(e,t)}})}},oe=(e,t)=>{s.set(t,[]),F.observe?.(e,P)};function M(e){let t=c.get(e),{form:n}=t;ie(e,n,t),w(e,t.labels)}var N=(e,t=!1)=>{let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return c.has(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),r=n.nextNode(),i=!t||e.disabled;for(;r;)r.formDisabledCallback&&i&&x(r,e.disabled),r=n.nextNode()},P={attributes:!0,attributeFilter:[`disabled`,`name`]},F=A()?new MutationObserver(e=>{for(let t of e){let e=t.target;if(t.attributeName===`disabled`&&(e.constructor.formAssociated?x(e,e.hasAttribute(`disabled`)):e.localName===`fieldset`&&N(e)),t.attributeName===`name`&&e.constructor.formAssociated){let t=c.get(e),n=p.get(e);t.setFormValue(n)}}}):{};function I(e){e.forEach(e=>{let{addedNodes:t,removedNodes:n}=e,r=Array.from(t),i=Array.from(n);r.forEach(e=>{if(c.has(e)&&e.constructor.formAssociated&&M(e),m.has(e)){let t=m.get(e);Object.keys(j).filter(e=>t[e]!==null).forEach(n=>{b(e,j[n],t[n])}),m.delete(e)}if(y.has(e)){let t=y.get(e);b(e,`internals-valid`,t.validity.valid.toString()),b(e,`internals-invalid`,(!t.validity.valid).toString()),b(e,`aria-invalid`,(!t.validity.valid).toString()),y.delete(e)}if(e.localName===`form`){let t=f.get(e),n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return c.has(e)&&e.constructor.formAssociated&&!(t&&t.has(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),r=n.nextNode();for(;r;)M(r),r=n.nextNode()}e.localName===`fieldset`&&(F.observe?.(e,P),N(e,!0))}),i.forEach(e=>{let t=c.get(e);t&&s.get(t)&&S(t),d.has(e)&&d.get(e).disconnect()})})}function se(e){e.forEach(e=>{let{removedNodes:t}=e;t.forEach(t=>{let n=_.get(e.target);c.has(t)&&k(t),n.disconnect()})})}var ce=e=>{let t=new MutationObserver(se);window?.ShadyDOM?.inUse&&e.mode&&e.host&&(e=e.host),t.observe?.(e,{childList:!0}),_.set(e,t)};A()&&new MutationObserver(I);var L={childList:!0,subtree:!0},le=class{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}},ue=e=>(e.badInput=!1,e.customError=!1,e.patternMismatch=!1,e.rangeOverflow=!1,e.rangeUnderflow=!1,e.stepMismatch=!1,e.tooLong=!1,e.tooShort=!1,e.typeMismatch=!1,e.valid=!0,e.valueMissing=!1,e),de=(e,t,n)=>(e.valid=fe(t),Object.keys(t).forEach(n=>e[n]=t[n]),n&&T(n),e),fe=e=>{let t=!0;for(let n in e)n!==`valid`&&e[n]!==!1&&(t=!1);return t},R=new WeakMap;function z(e,t){e.toggleAttribute(t,!0),e.part&&e.part.add(t)}var B=class extends Set{static get isPolyfilled(){return!0}constructor(e){if(super(),!e||!e.tagName||e.tagName.indexOf(`-`)===-1)throw TypeError(`Illegal constructor`);R.set(this,e)}add(e){if(!/^--/.test(e)||typeof e!=`string`)throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${e} must start with '--'.`);let t=super.add(e),n=R.get(this),r=`state${e}`;return n.isConnected?z(n,r):setTimeout(()=>{z(n,r)}),t}clear(){for(let[e]of this.entries())this.delete(e);super.clear()}delete(e){let t=super.delete(e),n=R.get(this);return n.isConnected?(n.toggleAttribute(`state${e}`,!1),n.part&&n.part.remove(`state${e}`)):setTimeout(()=>{n.toggleAttribute(`state${e}`,!1),n.part&&n.part.remove(`state${e}`)}),t}},pe=function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},V=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},H,me=class{constructor(e){H.set(this,void 0),pe(this,H,e,`f`);for(let t=0;t<e.length;t++){let n=e[t];this[t]=n,n.hasAttribute(`name`)&&(this[n.getAttribute(`name`)]=n)}Object.freeze(this)}get length(){return V(this,H,`f`).length}[(H=new WeakMap,Symbol.iterator)](){return V(this,H,`f`)[Symbol.iterator]()}item(e){return this[e]==null?null:this[e]}namedItem(e){return this[e]==null?null:this[e]}};function he(){let e=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=n;let t=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=r;function n(...t){let n=e.apply(this,t);return O(this,n,`checkValidity`)}function r(...e){let n=t.apply(this,e);return O(this,n,`reportValidity`)}let{get:i}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,`elements`);Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...e){let t=i.call(this,...e),n=Array.from(f.get(this)||[]);return n.length===0?t:new me(Array.from(t).concat(n).sort((e,t)=>e.compareDocumentPosition?e.compareDocumentPosition(t)&2?1:-1:0))}})}var U=class{static get isPolyfilled(){return!0}constructor(e){if(!e||!e.tagName||e.tagName.indexOf(`-`)===-1)throw TypeError(`Illegal constructor`);let t=e.getRootNode(),n=new le;this.states=new B(e),a.set(this,e),o.set(this,n),c.set(e,this),ae(e,this),oe(e,this),Object.seal(this),t instanceof DocumentFragment&&ce(t)}checkValidity(){let e=a.get(this);if(D(e,`Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!this.willValidate)return!0;let t=o.get(this);if(!t.valid){let t=new Event(`invalid`,{bubbles:!1,cancelable:!0,composed:!1});e.dispatchEvent(t)}return t.valid}get form(){let e=a.get(this);D(e,`Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.`);let t;return e.constructor.formAssociated===!0&&(t=E(e)),t}get labels(){let e=a.get(this);D(e,`Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.`);let t=e.getAttribute(`id`),n=e.getRootNode();return n&&t?n.querySelectorAll(`[for="${t}"]`):[]}reportValidity(){let e=a.get(this);if(D(e,`Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!this.willValidate)return!0;let t=this.checkValidity(),n=g.get(this);if(n&&!e.constructor.formAssociated)throw new DOMException(`Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.`);return!t&&n&&(e.focus(),n.focus()),t}setFormValue(e){let t=a.get(this);if(D(t,`Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element.`),S(this),e!=null&&!(e instanceof FormData)){if(t.getAttribute(`name`)){let n=C(t,this);n.value=e}}else e!=null&&e instanceof FormData&&Array.from(e).reverse().forEach(([e,n])=>{if(typeof n==`string`){let r=C(t,this);r.name=e,r.value=n}});p.set(t,e)}setValidity(e,t,n){let r=a.get(this);if(D(r,`Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!e)throw TypeError(`Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.`);g.set(this,n);let i=o.get(this),s={};for(let t in e)s[t]=e[t];Object.keys(s).length===0&&ue(i);let c={...i,...s};delete c.valid;let{valid:u}=de(i,c,this.form);if(!u&&!t)throw new DOMException(`Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.`);l.set(this,u?``:t),r.isConnected?(r.toggleAttribute(`internals-invalid`,!u),r.toggleAttribute(`internals-valid`,u),b(r,`aria-invalid`,`${!u}`)):y.set(r,this)}get shadowRoot(){let e=a.get(this);return h.get(e)||null}get validationMessage(){return D(a.get(this),`Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element.`),l.get(this)}get validity(){return D(a.get(this),`Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element.`),o.get(this)}get willValidate(){let e=a.get(this);return D(e,`Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element.`),!(e.matches(`:disabled`)||e.disabled||e.hasAttribute(`disabled`)||e.hasAttribute(`readonly`))}};function ge(){if(typeof window>`u`||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class e extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}let t=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,``)}`;customElements.define(t,e);let n=new e;return[`shadowRoot`,`form`,`willValidate`,`validity`,`validationMessage`,`labels`,`setFormValue`,`setValidity`,`checkValidity`,`reportValidity`].every(e=>e in n.internals)}var W=!1,G=!1;function K(e){G||(G=!0,window.CustomStateSet=B,e&&(HTMLElement.prototype.attachInternals=function(...t){let n=e.call(this,t);return n.states=new B(this),n}))}function _e(e=!0){let t=!1;if(!W){if(W=!0,typeof window<`u`&&(window.ElementInternals=U),typeof CustomElementRegistry<`u`){let e=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(n,r,i){if(r.formAssociated){let e=r.prototype.connectedCallback;r.prototype.connectedCallback=function(){v.has(this)||(v.set(this,!0),this.hasAttribute(`disabled`)&&x(this,!0)),e?.apply(this),t=k(this)}}e.call(this,n,r,i)}}if(typeof HTMLElement<`u`&&(HTMLElement.prototype.attachInternals=function(){if(!this.tagName)return{};if(this.tagName.indexOf(`-`)===-1)throw Error(`Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.`);if(c.has(this)&&!t)throw new DOMException(`DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.`);return new U(this)}),typeof Element<`u`){function n(...t){let n=e.apply(this,t);if(h.set(this,n),A()){let e=new MutationObserver(I);window.ShadyDOM?e.observe(this,L):e.observe(n,L),d.set(this,e)}return n}let e=Element.prototype.attachShadow;Element.prototype.attachShadow=n}A()&&typeof document<`u`&&new MutationObserver(I).observe(document.documentElement,L),typeof HTMLFormElement<`u`&&he(),(e||typeof window<`u`&&!window.CustomStateSet)&&K()}}customElements.polyfillWrapFlushCallback||(ge()?typeof window<`u`&&!window.CustomStateSet&&K(HTMLElement.prototype.attachInternals):_e(!1));var q=`on`,J=`--checked`,Y=`,`,X=e=>e===!0||e===``||e===`true`,Z=new WeakMap,ve=0,ye=e=>{let t=Z.get(e);return t||(t=e.id||`form${++ve}`,Z.set(e,t)),t},Q=()=>!!globalThis.ElementInternals?.isPolyfilled,$=class e extends n.t{static get formAssociated(){return!0}get form(){let e=this.getAttribute(`form`);if(e!==null){if(!e)return null;let t=this.getRootNode(),n=typeof t.getElementById==`function`?t.getElementById(e):this.ownerDocument?.getElementById(e);return n instanceof HTMLFormElement?n:null}return this.internals?.form??this.closest(`form`)}get ariaDescribedBy(){return this.ariaDescribedby}set ariaDescribedBy(e){this.ariaDescribedby=e}formDisabledCallback(e){this.formDisabled=e}get isDisabled(){return this.disabled||this.formDisabled}get optionGroup(){return this.groupContext}setGroupValidity(e){this.groupValidityMessage!==e&&(this.groupValidityMessage=e,this.inputRef?.value&&this.manageValidity(this.inputRef.value))}syncGroupName(){let e=this.optionGroup?.name;if(!e)return;let t=!this.name||this.name===this.derivedName;t&&this.name!==e&&(this.name=e),t&&(this.derivedName=e)}effectiveCounter(e){return this.counter??e}effectiveHasFieldset(e){return this.hasFieldset??e}constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.step=null,this.ariaDescribedby=null,this.ariaLabelledby=null,this.name=``,this.pattern=null,this.placeholder=null,this.id=i.n(),this.counter=null,this.hasError=!1,this.inline=!1,this.hasFieldset=null,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage=``,this.helptext=``,this.helptextDropdown=``,this.helptextDropdownButton=null,this.label=null,this.tagText=null,this.inputSize=`medium`,this.dataTestid=``,this.formDisabled=!1,this.derivedName=null,this.groupValidityMessage=``,this.touched=!1,this._initialized=!1,this.polyfillFormValue=null,this._didInitDerivedState=!1,this._defaultCheckedState=!1,this.internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),Q()&&queueMicrotask(()=>{this.isConnected&&this.polyfillFormValue&&this.internals.setFormValue(this.polyfillFormValue.value)})}get internalName(){let e=this.form;return e?`${this.name}-internal-${ye(e)}`:`${this.name}-internal`}formAssociatedCallback(){this.requestUpdate()}writeFormValue(e){this.internals.setFormValue(e),Q()&&(this.polyfillFormValue={value:e})}manageValidity(e,n){if(!e){console.warn(`manageValidity called without valid input element`);return}let r=this.pktStrings.get(`validation`);(this.isCheckable?this.checkableValueMissing(n??this.checkableGroup()):this.required&&!this.value)?this.internals.setValidity(this.groupValidityMessage?{valueMissing:!0,customError:!0}:{valueMissing:!0},this.groupValidityMessage||r.valueMissing,e):e.validity?.typeMismatch||e.validity?.badInput?this.internals.setValidity({typeMismatch:!0},r.typeMismatch,e):e.validity?.patternMismatch?this.internals.setValidity({patternMismatch:!0},r.patternMismatch,e):e.validity?.tooShort||this.minlength&&this.minlength>0&&this.valueLength<this.minlength?this.internals.setValidity({tooShort:!0},r.tooShort,e):e.validity?.tooLong||this.maxlength&&this.maxlength>0&&this.valueLength>this.maxlength?this.internals.setValidity({tooLong:!0},r.tooLong,e):e.validity?.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?t.t(r.rangeUnderflowMin,{min:this.min.toString()}):r.rangeUnderflow,e):e.validity?.stepMismatch?this.internals.setValidity({stepMismatch:!0},r.typeMismatch,e):e.validity?.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?t.t(r.rangeOverflowMax,{max:this.max.toString()}):r.rangeOverflow,e):e.validity?.customError?this.internals.setValidity({customError:!0},e.validationMessage,e):this.groupValidityMessage?this.internals.setValidity({customError:!0},this.groupValidityMessage,e):this.internals.setValidity({})}setFormValue(e){if(this.internals){if(Array.isArray(e)){let t=new FormData;e.forEach(e=>{t.append(this.name,e)}),this.writeFormValue(t)}else this.writeFormValue(e)}}radioGroupMembers(){let e=this.getRootNode();if(typeof e.querySelectorAll!=`function`)return[];let t=this.form;return Array.from(e.querySelectorAll(`pkt-radiobutton, input[type="radio"]`)).filter(e=>e!==this&&e.getAttribute(`name`)===this.name&&e.form===t)}get valueLength(){return!this.multiple||Array.isArray(this.value)?this.value.length:this.value?this.value.split(Y).length:0}get isCheckable(){return this.type===`checkbox`||this.type===`radio`}checkableGroup(){return this.type===`radio`?[this,...this.radioGroupMembers()]:[this]}get isRequired(){return this.required||this.type===`radio`&&!!this.optionGroup?.required}checkableValueMissing(t){return this.type===`radio`?t.some(t=>t instanceof e?t.isRequired:t.required)&&!t.some(e=>X(e.checked)):this.required&&!X(this.checked)}syncCheckedState(){if(!this.internals)return;let e=X(this.checked);this.internals.ariaChecked=String(e),e?(this.writeFormValue((typeof this.value==`string`?this.value:``)||q),this.internals.states?.add(J)):(this.writeFormValue(null),this.internals.states?.delete(J)),this.inputRef?.value&&this.inputRef.value.checked!==e&&(this.inputRef.value.checked=e)}validateCheckable(){let t=this.checkableGroup();t.forEach(n=>{if(!(n instanceof e))return;let r=n;r.inputRef?.value&&r.manageValidity(r.inputRef.value,t)})}coordinateRadioGroup(){!this.name||this.type!==`radio`||this.radioGroupMembers().forEach(t=>{t instanceof e?X(t.checked)&&(t.checked=!1,t.syncCheckedState()):t.checked&&=!1})}valueChecked(e){this.touched&&(this.type===`radio`&&this.coordinateRadioGroup(),typeof e==`string`?this.checked=e===`true`:typeof e==`boolean`&&(this.checked=e),this.syncCheckedState(),this.validateCheckable(),this.onInput(),this.dispatchChangeEvents(this.checked))}valueChanged(e,t){let n=e;if(typeof n==`number`||typeof n==`boolean`)e=String(n);else if(n!=null&&typeof n!=`string`&&!Array.isArray(n)){let e=typeof n==`object`?n?.constructor?.name??`object`:typeof n;console.warn(`${this.localName}: value må være en streng eller et tall, men fikk ${e}. Verdien ignoreres. For dato-/tidsfelt, send en ISO-formatert streng (f.eks. "2026-07-09" eller "13:45").`)}(t!==this.value||t!==this._value)&&(typeof e==`string`?((this.multiple||this.range)&&e.includes(Y)&&(e=e.split(Y)),this.value=e,this._value=Array.isArray(e)?e:[e]):Array.isArray(e)?(this.value=this.multiple||this.range?e:e[0],this._value=e):(this.value=``,this._value=[]),(!this.value||this.value.length===0)&&t&&t.length!==0?this.clearInputValue():this.value&&this.value.toString()!==t?.toString()&&this.onChange(this.value))}dispatchChangeEvents(e){this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`value-change`,{detail:e,bubbles:!0,composed:!0}))}clearInputValue(){let e=this.multiple||this.range?[]:``;this.value=e,this.setFormValue(e),this.dispatchChangeEvents(e)}onFocus(){this.dispatchEvent(new FocusEvent(`focus`,{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent(`blur`,{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent(`input`,{bubbles:!0,composed:!0}))}normalizeValue(e){return(this.range||this.multiple)&&typeof e==`string`&&e.includes(Y)?e.split(Y):!this.multiple&&!this.range&&Array.isArray(e)?e[0]||``:e}validate(){this.inputRef?.value&&this.manageValidity(this.inputRef.value),this.inputRefTo?.value&&this.manageValidity(this.inputRefTo.value)}onChange(e){if(this.touched=!0,typeof e!=`string`&&!Array.isArray(e))return;let t=this.normalizeValue(e);this.setFormValue(t),this.validate(),this._initialized&&this.dispatchChangeEvents(t)}formResetCallback(){if(this.touched=!1,this._options&&this._options.length&&this._options.forEach(e=>{`selected`in e&&(e.selected=!1)}),this.checked!==void 0)this.checked=this._defaultCheckedState,this.syncCheckedState(),this.validateCheckable();else{this.writeFormValue(``);let e=this.defaultValue||(this.multiple||this.range?[]:``);this.value=e,this._value=Array.isArray(e)?e:[e],this.valueChanged(this.value,null)}this.internals.ariaInvalid=`false`}updated(e){super.updated(e),this.isCheckable&&this._initialized&&(e.has(`defaultChecked`)&&e.get(`defaultChecked`)!==void 0&&(this._defaultCheckedState=!!this.defaultChecked),e.has(`groupContext`)&&this.isRequired&&(this.internals.ariaRequired=`true`),[`checked`,`value`,`required`,`name`,`groupContext`].some(t=>e.has(t))&&(this.syncCheckedState(),this.validateCheckable())),e.has(`dataTestid`)&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute(`data-testid`)||this.setAttribute(`data-testid`,this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute(`data-testid`)))}willUpdate(e){super.willUpdate(e),e.has(`disabled`)&&this.toggleAttribute(`disabled`,this.disabled),this.syncGroupName(),!this._didInitDerivedState&&(this._didInitDerivedState=!0,this.defaultChecked&&(this.checked=!0),this.id&&!this.name&&(this.name=this.id,this.derivedName=this.id),this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null))}firstUpdated(e){if(super.firstUpdated(e),this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=`true`),this.isRequired&&(this.internals.ariaRequired=`true`),this.disabled&&(this.internals.ariaDisabled=`true`),this.checked!==void 0){let e=X(this.checked);this._defaultCheckedState=e,this.internals.ariaChecked=String(e);let t=e?(typeof this.value==`string`?this.value:``)||q:null;this.writeFormValue(t)}else this.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute(`form`,``),this.isCheckable?this.validateCheckable():this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute(`form`,``),this.manageValidity(this.inputRefTo.value)),this.updateComplete.then(()=>{this._initialized=!0})}};e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`checked`,void 0),e.n([e.u({type:Boolean})],$.prototype,`defaultChecked`,void 0),e.n([e.u({type:Boolean})],$.prototype,`multiple`,void 0),e.n([e.u({type:Boolean})],$.prototype,`range`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`type`,void 0),e.n([e.u()],$.prototype,`defaultValue`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`disabled`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`readonly`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`required`,void 0),e.n([e.u({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],$.prototype,`max`,void 0),e.n([e.u({type:Number,reflect:!0})],$.prototype,`maxlength`,void 0),e.n([e.u({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],$.prototype,`min`,void 0),e.n([e.u({type:Number,reflect:!0})],$.prototype,`minlength`,void 0),e.n([e.u({type:Number,reflect:!0})],$.prototype,`step`,void 0),e.n([e.u({type:String,attribute:`aria-describedby`})],$.prototype,`ariaDescribedby`,void 0),e.n([e.u({type:String,attribute:`aria-labelledby`})],$.prototype,`ariaLabelledby`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`name`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`pattern`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`placeholder`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`id`,void 0),e.n([e.u({type:Boolean,converter:r.n})],$.prototype,`counter`,void 0),e.n([e.u({type:Boolean})],$.prototype,`hasError`,void 0),e.n([e.u({type:Boolean})],$.prototype,`inline`,void 0),e.n([e.u({type:Boolean,converter:r.n})],$.prototype,`hasFieldset`,void 0),e.n([e.u({type:Boolean})],$.prototype,`optionalTag`,void 0),e.n([e.u({type:Boolean})],$.prototype,`requiredTag`,void 0),e.n([e.u({type:Boolean})],$.prototype,`skipForwardTestid`,void 0),e.n([e.u({type:Boolean,reflect:!0,converter:r.t})],$.prototype,`useWrapper`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`fullwidth`,void 0),e.n([e.u({type:Number})],$.prototype,`counterMaxLength`,void 0),e.n([e.u({type:String})],$.prototype,`errorMessage`,void 0),e.n([e.u({type:String})],$.prototype,`helptext`,void 0),e.n([e.u({type:String})],$.prototype,`helptextDropdown`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`helptextDropdownButton`,void 0),e.n([e.u({type:String})],$.prototype,`label`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`optionalText`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`requiredText`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`tagText`,void 0),e.n([e.u({type:String,attribute:`input-size`})],$.prototype,`inputSize`,void 0),e.n([e.u({type:String,attribute:`data-testid`})],$.prototype,`dataTestid`,void 0),e.n([e.l()],$.prototype,`formDisabled`,void 0),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}});
|
|
@@ -535,7 +535,7 @@ var X = "on", ve = "--checked", Z = ",", Q = (e) => e === !0 || e === "" || e ==
|
|
|
535
535
|
(this.isCheckable ? this.checkableValueMissing(t ?? this.checkableGroup()) : this.required && !this.value) ? this.internals.setValidity(this.groupValidityMessage ? {
|
|
536
536
|
valueMissing: !0,
|
|
537
537
|
customError: !0
|
|
538
|
-
} : { valueMissing: !0 }, this.groupValidityMessage || n.valueMissing, e) : e.validity?.typeMismatch || e.validity?.badInput ? this.internals.setValidity({ typeMismatch: !0 }, n.typeMismatch, e) : e.validity?.patternMismatch ? this.internals.setValidity({ patternMismatch: !0 }, n.patternMismatch, e) : e.validity?.tooShort || this.minlength && this.minlength > 0 && this.
|
|
538
|
+
} : { valueMissing: !0 }, this.groupValidityMessage || n.valueMissing, e) : e.validity?.typeMismatch || e.validity?.badInput ? this.internals.setValidity({ typeMismatch: !0 }, n.typeMismatch, e) : e.validity?.patternMismatch ? this.internals.setValidity({ patternMismatch: !0 }, n.patternMismatch, e) : e.validity?.tooShort || this.minlength && this.minlength > 0 && this.valueLength < this.minlength ? this.internals.setValidity({ tooShort: !0 }, n.tooShort, e) : e.validity?.tooLong || this.maxlength && this.maxlength > 0 && this.valueLength > this.maxlength ? this.internals.setValidity({ tooLong: !0 }, n.tooLong, e) : e.validity?.rangeUnderflow ? this.internals.setValidity({ rangeUnderflow: !0 }, this.min ? r(n.rangeUnderflowMin, { min: this.min.toString() }) : n.rangeUnderflow, e) : e.validity?.stepMismatch ? this.internals.setValidity({ stepMismatch: !0 }, n.typeMismatch, e) : e.validity?.rangeOverflow ? this.internals.setValidity({ rangeOverflow: !0 }, this.max ? r(n.rangeOverflowMax, { max: this.max.toString() }) : n.rangeOverflow, e) : e.validity?.customError ? this.internals.setValidity({ customError: !0 }, e.validationMessage, e) : this.groupValidityMessage ? this.internals.setValidity({ customError: !0 }, this.groupValidityMessage, e) : this.internals.setValidity({});
|
|
539
539
|
}
|
|
540
540
|
setFormValue(e) {
|
|
541
541
|
if (this.internals) {
|
|
@@ -553,6 +553,9 @@ var X = "on", ve = "--checked", Z = ",", Q = (e) => e === !0 || e === "" || e ==
|
|
|
553
553
|
let t = this.form;
|
|
554
554
|
return Array.from(e.querySelectorAll("pkt-radiobutton, input[type=\"radio\"]")).filter((e) => e !== this && e.getAttribute("name") === this.name && e.form === t);
|
|
555
555
|
}
|
|
556
|
+
get valueLength() {
|
|
557
|
+
return !this.multiple || Array.isArray(this.value) ? this.value.length : this.value ? this.value.split(Z).length : 0;
|
|
558
|
+
}
|
|
556
559
|
get isCheckable() {
|
|
557
560
|
return this.type === "checkbox" || this.type === "radio";
|
|
558
561
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./checkbox-group-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./checkbox-group-adbFTj8y.cjs");exports.PktCheckboxGroup=e.n,exports.default=e.t;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "./checkbox-group-
|
|
1
|
+
import { n as e, t } from "./checkbox-group-C8mo9dkO.js";
|
|
2
2
|
export { e as PktCheckboxGroup, t as default };
|
package/dist/pkt-checkbox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./checkbox-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./checkbox-BwI9QNSh.cjs");exports.PktCheckbox=e.n,exports.default=e.t;
|
package/dist/pkt-checkbox.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "./checkbox-
|
|
1
|
+
import { n as e, t } from "./checkbox-BDwOYcNM.js";
|
|
2
2
|
export { e as PktCheckbox, t as default };
|
package/dist/pkt-combobox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./combobox-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./combobox-jsPpImVF.cjs");exports.PktCombobox=e.n,exports.default=e.t;
|
package/dist/pkt-combobox.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "./combobox-
|
|
1
|
+
import { n as e, t } from "./combobox-B8IeuEF0.js";
|
|
2
2
|
export { e as PktCombobox, t as default };
|
package/dist/pkt-datepicker.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./datepicker-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./datepicker-CZYpIyJd.cjs");var t=e.t;exports.PktDatepicker=e.t,exports.PktDatepickerMultiple=e.n,exports.PktDatepickerRange=e.r,exports.PktDatepickerSingle=e.i,exports.default=t;
|
package/dist/pkt-datepicker.js
CHANGED
package/dist/pkt-header.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./header-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./header-BCrefip0.cjs");exports.PktHeader=e.t,exports.PktHeaderGlobal=e.n,exports.PktHeaderService=e.r,exports.PktHeaderUserMenu=e.i,exports.formatLastLoggedIn=e.a;
|
package/dist/pkt-header.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, i as t, n, r, t as i } from "./header-
|
|
1
|
+
import { a as e, i as t, n, r, t as i } from "./header-20rqKJFb.js";
|
|
2
2
|
export { i as PktHeader, n as PktHeaderGlobal, r as PktHeaderService, t as PktHeaderUserMenu, e as formatLastLoggedIn };
|
package/dist/pkt-index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./element-C6WTyJFE.cjs"),t=require("./consent-DBYZaCTp.cjs"),n=require("./alert-CuXM6TnC.cjs"),r=require("./header-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./element-C6WTyJFE.cjs"),t=require("./consent-DBYZaCTp.cjs"),n=require("./alert-CuXM6TnC.cjs"),r=require("./header-BCrefip0.cjs"),i=require("./card-Diivw_vm.cjs"),a=require("./checkbox-BwI9QNSh.cjs"),o=require("./radiobutton-DwDErNo5.cjs"),s=require("./icon-jPhyZD1z.cjs"),c=require("./accordion-DukAa2ED.cjs"),l=require("./messagebox-CR59jv8N.cjs"),u=require("./calendar-C5QwPrbk.cjs"),d=require("./combobox-jsPpImVF.cjs"),f=require("./button-BFG-7bDB.cjs"),p=require("./backlink-CsFeerTH.cjs"),m=require("./breadcrumbs-D03id_ha.cjs"),h=require("./tag-BMtnaJ1A.cjs"),g=require("./input-wrapper-BwzajfFX.cjs"),_=require("./helptext-Bdv80rcs.cjs"),v=require("./checkbox-group-adbFTj8y.cjs"),y=require("./fileupload-CyLRyoVU.cjs"),b=require("./modal-BKeSXrzi.cjs"),x=require("./progressbar-CnX4fFfR.cjs"),S=require("./datepicker-CZYpIyJd.cjs"),C=require("./footer-C6ajmlq2.cjs"),w=require("./link-CRLAhYi0.cjs"),T=require("./textinput-BqBgsBZF.cjs"),E=require("./searchinput-Mdc9Ihld.cjs"),D=require("./header-menu-Cz7G7Q2R.cjs"),O=require("./heading-BluavR6A.cjs"),k=require("./linkcard-DnZgMzqL.cjs"),A=require("./loader-Zo_VSsNw.cjs"),j=require("./radio-group-MxNLGu-0.cjs"),M=require("./tabs-R1Jzzj3-.cjs"),N=require("./textarea-C-sdNBRk.cjs"),P=require("./select-Czz1y2nI.cjs"),F=require("./timepicker-C_k-K1jA.cjs");exports.PktAccordion=c.r,exports.PktAccordionItem=c.n,exports.PktAlert=n.n,exports.PktBackLink=p.n,exports.PktBreadcrumbs=m.t,exports.PktButton=f.n,exports.PktCalendar=u.n,exports.PktCard=i.n,exports.PktCheckbox=a.n,exports.PktCheckboxGroup=v.n,exports.PktCombobox=d.n,exports.PktConsent=t.n,exports.PktDateTags=S.a,exports.PktDatepicker=S.t,Object.defineProperty(exports,"PktFileUpload",{enumerable:!0,get:function(){return y.n}}),exports.PktFooter=C.n,exports.PktFooterSimple=C.t,exports.PktHeader=r.t,exports.PktHeaderGlobal=r.n,exports.PktHeaderMenu=D.n,exports.PktHeaderService=r.r,exports.PktHeaderUserMenu=r.i,exports.PktHeading=O.n,exports.PktHelptext=_.n,exports.PktIcon=s.n,exports.PktInputWrapper=g.n,exports.PktLink=w.n,exports.PktLinkCard=k.n,exports.PktLoader=A.n,exports.PktMessagebox=l.n,exports.PktModal=b.n,exports.PktProgressbar=x.n,exports.PktRadioButton=o.n,exports.PktRadiobutton=o.n,exports.PktRadioGroup=j.n,exports.PktSearchInput=E.n,exports.PktSelect=P.n,exports.PktTabItem=M.n,exports.PktTabs=M.r,exports.PktTag=h.n,exports.PktTextarea=N.n,exports.PktTextinput=T.n,exports.PktTimepicker=F.t,exports.getPktStrings=e.r,exports.pktStringsNb=e.s,exports.resetPktStrings=e.i,exports.setPktStrings=e.a,exports.subscribePktStrings=e.o;
|
package/dist/pkt-index.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { a as e, i as t, o as n, r, s as i } from "./element-DBugHPKM.js";
|
|
2
2
|
import { n as a } from "./consent-BUS6GEUu.js";
|
|
3
3
|
import { n as o } from "./alert-Xt26J9yX.js";
|
|
4
|
-
import { i as s, n as c, r as l, t as u } from "./header-
|
|
4
|
+
import { i as s, n as c, r as l, t as u } from "./header-20rqKJFb.js";
|
|
5
5
|
import { n as d } from "./card-DCc3wfUb.js";
|
|
6
|
-
import { n as f } from "./checkbox-
|
|
7
|
-
import { n as p } from "./radiobutton-
|
|
6
|
+
import { n as f } from "./checkbox-BDwOYcNM.js";
|
|
7
|
+
import { n as p } from "./radiobutton-BK-V6Itu.js";
|
|
8
8
|
import { n as m } from "./icon-Bao96Zb8.js";
|
|
9
9
|
import { n as h, r as g } from "./accordion-BlsqYbJf.js";
|
|
10
10
|
import { n as _ } from "./messagebox-CzaFlrYz.js";
|
|
11
11
|
import { n as v } from "./calendar-D9w8M99G.js";
|
|
12
|
-
import { n as y } from "./combobox-
|
|
12
|
+
import { n as y } from "./combobox-B8IeuEF0.js";
|
|
13
13
|
import { n as b } from "./button-DhCqyX4D.js";
|
|
14
14
|
import { n as x } from "./backlink-ogvv493Y.js";
|
|
15
15
|
import { t as S } from "./breadcrumbs-53QVnTFP.js";
|
|
16
16
|
import { n as C } from "./tag-uVXp7uP-.js";
|
|
17
17
|
import { n as w } from "./input-wrapper-Bb6CZxmg.js";
|
|
18
18
|
import { n as T } from "./helptext-Dujce_W9.js";
|
|
19
|
-
import { n as E } from "./checkbox-group-
|
|
19
|
+
import { n as E } from "./checkbox-group-C8mo9dkO.js";
|
|
20
20
|
import { n as D } from "./fileupload-BmfFC748.js";
|
|
21
21
|
import { n as O } from "./modal-B3CQEBBB.js";
|
|
22
22
|
import { n as k } from "./progressbar-DZHiq7B0.js";
|
|
23
|
-
import { a as A, t as j } from "./datepicker-
|
|
23
|
+
import { a as A, t as j } from "./datepicker-CjUY_mLR.js";
|
|
24
24
|
import { n as M, t as N } from "./footer-L2vhQTAS.js";
|
|
25
25
|
import { n as P } from "./link-sO401Ieh.js";
|
|
26
|
-
import { n as F } from "./textinput-
|
|
26
|
+
import { n as F } from "./textinput-0DZeMqBr.js";
|
|
27
27
|
import { n as I } from "./searchinput-Bkcr3Fby.js";
|
|
28
28
|
import { n as L } from "./header-menu-F3tZZ5vO.js";
|
|
29
29
|
import { n as R } from "./heading-y72aIgB8.js";
|
|
30
30
|
import { n as z } from "./linkcard-DdmGxzAP.js";
|
|
31
31
|
import { n as B } from "./loader-Di5kHEQ4.js";
|
|
32
|
-
import { n as V } from "./radio-group-
|
|
32
|
+
import { n as V } from "./radio-group-CtZhXMF8.js";
|
|
33
33
|
import { n as H, r as U } from "./tabs-DBW3P90Z.js";
|
|
34
|
-
import { n as W } from "./textarea-
|
|
35
|
-
import { n as G } from "./select-
|
|
36
|
-
import { t as K } from "./timepicker-
|
|
34
|
+
import { n as W } from "./textarea-COHaMHpP.js";
|
|
35
|
+
import { n as G } from "./select-Bs-Z5Thd.js";
|
|
36
|
+
import { t as K } from "./timepicker-CvdI7jDN.js";
|
|
37
37
|
export { g as PktAccordion, h as PktAccordionItem, o as PktAlert, x as PktBackLink, S as PktBreadcrumbs, b as PktButton, v as PktCalendar, d as PktCard, f as PktCheckbox, E as PktCheckboxGroup, y as PktCombobox, a as PktConsent, A as PktDateTags, j as PktDatepicker, D as PktFileUpload, M as PktFooter, N as PktFooterSimple, u as PktHeader, c as PktHeaderGlobal, L as PktHeaderMenu, l as PktHeaderService, s as PktHeaderUserMenu, R as PktHeading, T as PktHelptext, m as PktIcon, w as PktInputWrapper, P as PktLink, z as PktLinkCard, B as PktLoader, _ as PktMessagebox, O as PktModal, k as PktProgressbar, p as PktRadioButton, p as PktRadiobutton, V as PktRadioGroup, I as PktSearchInput, G as PktSelect, H as PktTabItem, U as PktTabs, C as PktTag, W as PktTextarea, F as PktTextinput, K as PktTimepicker, r as getPktStrings, i as pktStringsNb, t as resetPktStrings, e as setPktStrings, n as subscribePktStrings };
|
package/dist/pkt-radio-group.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./radio-group-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./radio-group-MxNLGu-0.cjs");exports.PktRadioGroup=e.n,exports.default=e.t;
|
package/dist/pkt-radio-group.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "./radio-group-
|
|
1
|
+
import { n as e, t } from "./radio-group-CtZhXMF8.js";
|
|
2
2
|
export { e as PktRadioGroup, t as default };
|
package/dist/pkt-radiobutton.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./radiobutton-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./radiobutton-DwDErNo5.cjs");exports.PktRadioButton=e.n,exports.default=e.t;
|
package/dist/pkt-radiobutton.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "./radiobutton-
|
|
1
|
+
import { n as e, t } from "./radiobutton-BK-V6Itu.js";
|
|
2
2
|
export { e as PktRadioButton, t as default };
|
package/dist/pkt-select.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./select-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./select-Czz1y2nI.cjs");exports.PktSelect=e.n,exports.default=e.t;
|
package/dist/pkt-select.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "./select-
|
|
1
|
+
import { n as e, t } from "./select-Bs-Z5Thd.js";
|
|
2
2
|
export { e as PktSelect, t as default };
|
package/dist/pkt-textarea.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./textarea-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./textarea-C-sdNBRk.cjs");exports.PktTextarea=e.n,exports.default=e.t;
|
package/dist/pkt-textarea.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "./textarea-
|
|
1
|
+
import { n as e, t } from "./textarea-COHaMHpP.js";
|
|
2
2
|
export { e as PktTextarea, t as default };
|
package/dist/pkt-textinput.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./textinput-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./textinput-BqBgsBZF.cjs");exports.PktTextinput=e.n,exports.default=e.t;
|
package/dist/pkt-textinput.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "./textinput-
|
|
1
|
+
import { n as e, t } from "./textinput-0DZeMqBr.js";
|
|
2
2
|
export { e as PktTextinput, t as default };
|
package/dist/pkt-timepicker.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./timepicker-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./timepicker-C_k-K1jA.cjs");exports.PktTimepicker=e.t;
|
package/dist/pkt-timepicker.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "./timepicker-
|
|
1
|
+
import { t as e } from "./timepicker-CvdI7jDN.js";
|
|
2
2
|
export { e as PktTimepicker };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as e, l as t, n, u as r } from "./element-DBugHPKM.js";
|
|
2
|
-
import { r as i } from "./radiobutton-
|
|
2
|
+
import { r as i } from "./radiobutton-BK-V6Itu.js";
|
|
3
3
|
import { i as a, n as o, t as s } from "./option-group-element-D5PgGNdt.js";
|
|
4
4
|
import { t as c } from "./provide-_MnlMGnw.js";
|
|
5
5
|
//#region src/components/radio-group/radio-group.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./element-C6WTyJFE.cjs"),t=require("./radiobutton-
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./radiobutton-DwDErNo5.cjs"),n=require("./option-group-element-CzehfgVZ.cjs"),r=require("./provide-Cz18sYug.cjs");var i=class extends n.t{constructor(...e){super(...e),this.optionSelector=`pkt-radiobutton`,this.groupContext={name:``,hasTile:!1,hasError:!1,required:!1},this.storedValue=null}get value(){let e=this.options().find(n.n);return e?n.i(e):``}set value(e){let t=this.value;this.storedValue=e??``,this.applyStoredValue(this.options()),this.requestUpdate(`value`,t)}get hasStoredValue(){return this.storedValue!==null}storeCurrentValue(){this.storedValue=this.value}applyStoredValue(e){e.forEach(e=>{let t=this.storedValue!==``&&n.i(e)===this.storedValue;n.n(e)!==t&&(e.checked=t)})}createGroupContext(){return{...super.createGroupContext(),required:this.required}}};e.n([r.t({context:t.r}),e.l()],i.prototype,`groupContext`,void 0),e.n([e.u({type:String})],i.prototype,`value`,null);try{e.d(`pkt-radio-group`)(i)}catch{console.warn(`Forsøker å definere <pkt-radio-group>, men den er allerede definert`)}var a=i;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
|
|
@@ -2,7 +2,7 @@ import { _ as e, d as t, h as n, l as r, n as i, u as a } from "./element-DBugHP
|
|
|
2
2
|
import { t as o } from "./class-map-Bf-QzUpN.js";
|
|
3
3
|
import { n as s, t as c } from "./consume-Bp12si68.js";
|
|
4
4
|
import { n as l, t as u } from "./ref-y_5qv9vU.js";
|
|
5
|
-
import { t as d } from "./input-element-
|
|
5
|
+
import { t as d } from "./input-element-mTphzs9b.js";
|
|
6
6
|
//#region ../../shared-types/radiobutton.ts
|
|
7
7
|
var f = {
|
|
8
8
|
defaultChecked: !1,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./consume-kEjgTrAp.cjs"),r=require("./ref-CB7e9nMY.cjs"),i=require("./input-element-
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./consume-kEjgTrAp.cjs"),r=require("./ref-CB7e9nMY.cjs"),i=require("./input-element-BjnKPikY.cjs");var a={defaultChecked:!1,hasTile:!1,disabled:!1,hasError:!1,requiredTag:!1,optionalTag:!1},o=n.n(Symbol(`pkt-radio-group-context`)),s=class extends i.t{constructor(...e){super(...e),this.inputRef=r.t(),this.value=``,this.checkHelptext=null,this.defaultChecked=a.defaultChecked,this.hasTile=a.hasTile,this.checked=null,this.type=`radio`,this.inputSize=void 0,this.tagText=null,this.optionalTag=a.optionalTag,this.requiredTag=a.requiredTag,this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,t,n){e===`checked`&&(this._checked=this.checked===``||this.checked===`true`||this.checked===!0),super.attributeChangedCallback(e,t,n)}render(){let n=this.hasTile||!!this.groupContext?.hasTile,i=t.t({"pkt-input-check__input":!0,"pkt-input-check__input--tile":n,"pkt-input-check__input--tile-disabled":this.isDisabled&&n}),a=t.t({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError||!!this.groupContext?.hasError}),o=t.t({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.isDisabled,"pkt-sr-only":this.hideLabel}),s=`pkt-tag pkt-tag--small pkt-tag--thin-text`,c=this.pktStrings.get(`forms`),l=()=>e._`
|
|
2
2
|
${this.tagText?e._`<span class=${s+` pkt-tag--gray`}>${this.tagText}</span>`:e.h}
|
|
3
3
|
${this.optionalTag?e._`<span class=${s+` pkt-tag--blue-light`}
|
|
4
4
|
>${this.optionalText??c.optional}</span
|
|
@@ -2,7 +2,7 @@ import { _ as e, d as t, l as n, n as r, u as i } from "./element-DBugHPKM.js";
|
|
|
2
2
|
import { n as a } from "./element-with-slot-CVmm0_IE.js";
|
|
3
3
|
import { t as o } from "./if-defined-O59_I-e-.js";
|
|
4
4
|
import { n as s, t as c } from "./ref-y_5qv9vU.js";
|
|
5
|
-
import { t as l } from "./input-element-
|
|
5
|
+
import { t as l } from "./input-element-mTphzs9b.js";
|
|
6
6
|
import { t as u } from "./pkt-options-controller-CHosj1Oo.js";
|
|
7
7
|
import { r as d } from "./input-wrapper-Bb6CZxmg.js";
|
|
8
8
|
//#region src/base-elements/options-input-element.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-C6WTyJFE.cjs"),t=require("./element-with-slot-CcJPCLgn.cjs"),n=require("./if-defined-CiML3MTM.cjs"),r=require("./ref-CB7e9nMY.cjs"),i=require("./input-element-
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./element-with-slot-CcJPCLgn.cjs"),n=require("./if-defined-CiML3MTM.cjs"),r=require("./ref-CB7e9nMY.cjs"),i=require("./input-element-BjnKPikY.cjs"),a=require("./pkt-options-controller-139UsV4h.cjs"),o=require("./input-wrapper-BwzajfFX.cjs");var s=class extends i.t{constructor(...e){super(...e),this._optionsProp=[],this._options=[]}get options(){return this._options.map(e=>({...e,selected:this.isOptionSelected(e)}))}set options(e){this._optionsProp=e,this.requestUpdate(`_optionsProp`,this._options)}isOptionSelected(e){return Array.isArray(this.value)?this.value.includes(e.value):e.value===this.value}findOptionByValue(e){return this._options.find(t=>t.value===e)}getSelectedOptions(){return this._options.filter(e=>this.isOptionSelected(e))}parseOptions(){let e=this._optionsProp.length>0,t=this.optionsController?.nodes?.length&&this.optionsController.nodes.length>0;e?this._options=this._optionsProp:t&&(this._options=this.optionsController.options)}willUpdate(e){super.willUpdate(e),this.parseOptions()}};e.n([e.u({type:Array,attribute:`options`})],s.prototype,`_optionsProp`,void 0),e.n([e.l()],s.prototype,`_options`,void 0);var c=class extends s{constructor(){super(),this.inputRef=r.t(),this.value=``,this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new a.t(this)}connectedCallback(){super.connectedCallback(),this.parseOptions(),this._options.forEach(e=>{e.selected&&!this.value&&(this.value=e.value)})}add(e,t){let n={value:e.value||e.text,label:e.text||e.value,selected:e.selected,disabled:e.disabled};if(t===void 0)this._options.push(n);else if(typeof t==`number`)this._options.splice(t,0,n);else{let e=t.value||t.text,r=this._options.findIndex(t=>t.value===e);r>=0?this._options.splice(r,0,n):this._options.push(n)}e.selected&&(this.value=e.value||e.text,this.selectedIndex=this._options.findIndex(e=>e.value===this.value)),this.requestUpdate()}remove(e){typeof e==`number`&&(this.selectedIndex===e&&(this.value=this._options[0]?.value||``),this._options.splice(e,1),this.requestUpdate())}item(e){return this.inputRef.value?.item(e)}namedItem(e){return this.inputRef.value?.namedItem(e)}showPicker(){this.inputRef.value&&`showPicker`in this.inputRef.value&&this.inputRef.value.showPicker()}attributeChangedCallback(e,t,n){e===`options`&&(this._options=n?JSON.parse(n):[]),e===`value`&&this.value!==t&&(this.selectedIndex=this.touched?this.returnNumberOrNull(this.inputRef.value?.selectedIndex):this._options.findIndex(e=>e.value===n),this.selectedOptions=this.inputRef.value?.selectedOptions,this.valueChanged(n,t)),super.attributeChangedCallback(e,t,n)}update(e){super.update(e),e.has(`_optionsProp`)&&this._optionsProp.length>0&&(this._options=this._optionsProp,this.requestUpdate(`_options`),!this.value&&this._options.length>0&&(this.value=this._options[0].value,this.selectedIndex=0)),e.has(`value`)&&this.value!==e.get(`value`)&&(this.selectedIndex=this.touched?this.returnNumberOrNull(this.inputRef.value?.selectedIndex):this._options.findIndex(e=>e.value===this.value),this.selectedOptions=this.inputRef.value?.selectedOptions,this.valueChanged(this.value,e.get(`value`))),e.has(`id`)&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(e){super.firstUpdated(e),this.classList.add(`pkt-select`),this._optionsProp.length&&(this._options=this._optionsProp),!this.value&&this._options.length>0?(this.value=this._options[0].value,this.selectedIndex=0):this.selectedIndex=this._options.findIndex(e=>e.value===this.value),this.selectedOptions=this.inputRef.value?.selectedOptions}render(){let i=`pkt-input pkt-input--${this.inputSize} ${this.fullwidth?`pkt-input--fullwidth`:``}`;return e._`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
3
|
${t.n(this,[`helptext`])}
|
|
4
4
|
.strings=${this.strings}
|
|
@@ -52,6 +52,8 @@ export { COMBOBOX_TAG_SKINS, COMBOBOX_DISPLAY_VALUES, COMBOBOX_TAG_PLACEMENTS, C
|
|
|
52
52
|
export type { IPktComboboxOption, TPktComboboxTagSkin, TPktComboboxDisplayValue, TPktComboboxTagPlacement, IPktComboboxBase, IComboboxSpecProps, } from './combobox';
|
|
53
53
|
export { SELECT_DEFAULTS } from './select';
|
|
54
54
|
export type { IPktSelectOption, TSelectOption, IPktSelectBase, ISelectSpecProps } from './select';
|
|
55
|
+
export { TABLE_SKINS, TABLE_DEFAULTS } from './table';
|
|
56
|
+
export type { TPktTableSkin, IPktTableBase, ITableSpecProps, IPktTableDataCellBase, ITableDataCellSpecProps, ITableSectionSpecProps, } from './table';
|
|
55
57
|
export type { TPktSearchInputAppearance, TPktSearchInputMethod, IPktSearchInputSuggestion, IPktSearchInput, } from './searchinput';
|
|
56
58
|
export { UPLOAD_STRATEGIES, FILE_UPLOAD_ITEM_RENDERERS, PREVIEW_UPLOAD_STATUS } from './fileupload';
|
|
57
59
|
export type { TUploadStrategy as TFileUploadStrategy, TFileUploadItemRenderer, TPreviewUploadStatus, TFilesChangedReason, TFileValidator, TTransferProgress, IFileItem, IFileTransfer, IFileValidateDetail, ITransferCancelledDetail, IFilesChangedDetail, IFileUploadSpecProps, IPktFileUploadBase, } from './fileupload';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* table.ts
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for pkt-table and its sub-components.
|
|
5
|
+
* Used by React and typed component specs. There is no Elements version —
|
|
6
|
+
* outside React the table is used as plain HTML with the `pkt-table` CSS classes.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Visual skins for pkt-table — shared runtime source for types, specs, and Preview.
|
|
10
|
+
*/
|
|
11
|
+
export declare const TABLE_SKINS: readonly ['basic', 'zebra-blue'];
|
|
12
|
+
export type TPktTableSkin = (typeof TABLE_SKINS)[number];
|
|
13
|
+
/**
|
|
14
|
+
* Table props shared by React and typed component specs.
|
|
15
|
+
*/
|
|
16
|
+
export interface IPktTableBase {
|
|
17
|
+
compact?: boolean;
|
|
18
|
+
skin?: TPktTableSkin;
|
|
19
|
+
responsiveView?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Documented Table props (subset of `IPktTableBase`).
|
|
23
|
+
* Used for typed component specs in documentation.
|
|
24
|
+
*/
|
|
25
|
+
export type ITableSpecProps = Pick<IPktTableBase, 'compact' | 'skin' | 'responsiveView'>;
|
|
26
|
+
/**
|
|
27
|
+
* Default values for pkt-table. Single source of truth.
|
|
28
|
+
*/
|
|
29
|
+
export declare const TABLE_DEFAULTS: {
|
|
30
|
+
readonly compact: false;
|
|
31
|
+
readonly skin: 'basic';
|
|
32
|
+
readonly responsiveView: true;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Table data cell props shared by React and typed component specs.
|
|
36
|
+
*
|
|
37
|
+
* @remarks `dataLabel` is rendered as `data-label` and shown next to the cell content
|
|
38
|
+
* when the table is responsive. Without it, the cell has no label on small screens.
|
|
39
|
+
*/
|
|
40
|
+
export interface IPktTableDataCellBase {
|
|
41
|
+
dataLabel?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Documented TableDataCell props (subset of `IPktTableDataCellBase`).
|
|
45
|
+
* Used for typed component specs in documentation.
|
|
46
|
+
*/
|
|
47
|
+
export type ITableDataCellSpecProps = Pick<IPktTableDataCellBase, 'dataLabel'>;
|
|
48
|
+
/**
|
|
49
|
+
* Header, body, row and header cell have no props of their own beyond native HTML attributes.
|
|
50
|
+
*/
|
|
51
|
+
export type ITableSectionSpecProps = Record<never, never>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./directive-helpers-Bv70GjQh.cjs"),r=require("./element-with-slot-CcJPCLgn.cjs");require("./icon-jPhyZD1z.cjs");const i=require("./if-defined-CiML3MTM.cjs"),a=require("./ref-CB7e9nMY.cjs"),o=require("./input-element-
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./directive-helpers-Bv70GjQh.cjs"),r=require("./element-with-slot-CcJPCLgn.cjs");require("./icon-jPhyZD1z.cjs");const i=require("./if-defined-CiML3MTM.cjs"),a=require("./ref-CB7e9nMY.cjs"),o=require("./input-element-BjnKPikY.cjs"),s=require("./input-wrapper-BwzajfFX.cjs");var c=e.f(class extends e.p{constructor(t){if(super(t),t.type!==e.m.PROPERTY&&t.type!==e.m.ATTRIBUTE&&t.type!==e.m.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!n.i(t))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(t,[r]){if(r===e.g||r===e.h)return r;let i=t.element,a=t.name;if(t.type===e.m.PROPERTY){if(r===i[a])return e.g}else if(t.type===e.m.BOOLEAN_ATTRIBUTE){if(!!r===i.hasAttribute(a))return e.g}else if(t.type===e.m.ATTRIBUTE&&i.getAttribute(a)===r+``)return e.g;return n.r(t),r}}),l=class extends o.t{constructor(...e){super(...e),this.inputRef=a.t(),this.value=``,this.autocomplete=`off`,this.rows=null,this.cols=null,this.counterCurrent=0}attributeChangedCallback(e,t,n){e===`value`&&this.value!==t&&(this.counterCurrent=n?n.length:0),super.attributeChangedCallback(e,t,n)}willUpdate(e){super.willUpdate(e),e.has(`value`)&&(this.counterCurrent=this.value?.length||0),e.has(`id`)&&!this.name&&this.id&&(this.name=this.id)}updated(e){super.updated(e),this.classList.add(`pkt-textinput`,`pkt-textarea`),e.has(`value`)&&this.valueChanged(this.value,e.get(`value`))}render(){let n=this.effectiveCounter(this.counterMaxLength>0),o=t.t({"pkt-input":!0,[`pkt-input--${this.inputSize}`]:!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":n&&this.counterMaxLength>0&&this.value.length>this.counterMaxLength}),l=this.ariaLabelledby||`${this.id}-input-label`;return e._`<pkt-input-wrapper
|
|
2
2
|
${r.n(this,[`helptext`])}
|
|
3
3
|
.strings=${this.strings}
|
|
4
4
|
label=${this.label}
|
|
@@ -5,7 +5,7 @@ import { n as p } from "./element-with-slot-CVmm0_IE.js";
|
|
|
5
5
|
import "./icon-Bao96Zb8.js";
|
|
6
6
|
import { t as m } from "./if-defined-O59_I-e-.js";
|
|
7
7
|
import { n as h, t as g } from "./ref-y_5qv9vU.js";
|
|
8
|
-
import { t as _ } from "./input-element-
|
|
8
|
+
import { t as _ } from "./input-element-mTphzs9b.js";
|
|
9
9
|
import { r as v } from "./input-wrapper-Bb6CZxmg.js";
|
|
10
10
|
//#region ../../node_modules/lit-html/directives/live.js
|
|
11
11
|
var y = n(class extends c {
|
|
@@ -4,7 +4,7 @@ import { n as s } from "./element-with-slot-CVmm0_IE.js";
|
|
|
4
4
|
import "./icon-Bao96Zb8.js";
|
|
5
5
|
import { t as c } from "./if-defined-O59_I-e-.js";
|
|
6
6
|
import { n as l, t as u } from "./ref-y_5qv9vU.js";
|
|
7
|
-
import { t as d } from "./input-element-
|
|
7
|
+
import { t as d } from "./input-element-mTphzs9b.js";
|
|
8
8
|
import { r as f } from "./input-wrapper-Bb6CZxmg.js";
|
|
9
9
|
//#region src/components/textinput/textinput.ts
|
|
10
10
|
var p = class extends d {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./element-with-slot-CcJPCLgn.cjs");require("./icon-jPhyZD1z.cjs");const r=require("./if-defined-CiML3MTM.cjs"),i=require("./ref-CB7e9nMY.cjs"),a=require("./input-element-
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./element-with-slot-CcJPCLgn.cjs");require("./icon-jPhyZD1z.cjs");const r=require("./if-defined-CiML3MTM.cjs"),i=require("./ref-CB7e9nMY.cjs"),a=require("./input-element-BjnKPikY.cjs"),o=require("./input-wrapper-BwzajfFX.cjs");var s=class extends a.t{constructor(...e){super(...e),this.inputRef=i.t(),this.value=``,this.type=`text`,this.size=null,this.autocomplete=null,this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0}attributeChangedCallback(e,t,n){e===`value`&&this.value!==t&&(this.counterCurrent=n?n.length:0),super.attributeChangedCallback(e,t,n)}willUpdate(e){super.willUpdate(e),e.has(`value`)&&(this.counterCurrent=this.value?.length||0),e.has(`id`)&&!this.name&&this.id&&(this.name=this.id)}updated(e){super.updated(e),this.classList.add(`pkt-textinput`),e.has(`value`)&&this.valueChanged(this.value,e.get(`value`))}render(){let a=this.type===`search`&&!this.iconNameRight&&!this.omitSearchIcon,s=this.effectiveCounter(this.counterMaxLength>0),c=t.t({"pkt-input":!0,[`pkt-input--${this.inputSize}`]:!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":s&&this.counterMaxLength>0&&this.value.length>this.counterMaxLength}),l=this.ariaLabelledby||`${this.id}-input-label`;return e._`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
3
|
${n.n(this,[`helptext`])}
|
|
4
4
|
.strings=${this.strings}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-CcJPCLgn.cjs");require("./icon-jPhyZD1z.cjs");const i=require("./if-defined-CiML3MTM.cjs"),a=require("./ref-CB7e9nMY.cjs"),o=require("./input-element-BMEyYMGT.cjs"),s=require("./input-wrapper-BwzajfFX.cjs");var c=e=>/^\d{2}:\d{2}$/.test(e)&&parseInt(e.slice(0,2),10)<=23&&parseInt(e.slice(3),10)<=59,l=e=>{let[t,n]=e.split(`:`).map(Number);return t*60+n},u=e=>e?Math.max(1,Math.round(e/60)):1,d=(e,t)=>{let n=e?parseInt(String(e).split(`:`)[0],10):0,r=t?parseInt(String(t).split(`:`)[0],10):23;return Array.from({length:r-n+1},(e,t)=>t+n)},f=e=>{let t=u(e);return Array.from({length:Math.floor(60/t)},(e,n)=>n*t)},p=(e,t,n,r)=>{let i=e===``?n===1?0:23:parseInt(e,10),a=t===``?n===1?0:Math.floor(59/r)*r:parseInt(t,10);return a+=n*r,a>59?(a=0,i=(i+1)%24):a<0&&(a=Math.floor(59/r)*r,i=(i-1+24)%24),{hours:String(i).padStart(2,`0`),minutes:String(a).padStart(2,`0`)}},m=class extends o.t{constructor(...e){super(...e),this.hiddenInputRef=a.t(),this.hoursInputRef=a.t(),this.minutesInputRef=a.t(),this.buttonRef=a.t(),this.value=``,this.hidePicker=!1,this.stepArrows=!1,this._hours=``,this._minutes=``,this._isOpen=!1,this._hoursDigitCount=0,this._hoursFirstDigit=-1,this._minutesDigitCount=0,this._minutesFirstDigit=-1,this._hasFocus=!1,this._outsideClickHandler=e=>{this.contains(e.target)||this._closePopup()},this._handleComponentFocusIn=()=>{this._hasFocus||(this._hasFocus=!0,this.onFocus())},this._handleComponentFocusOut=e=>{this.contains(e.relatedTarget)||(this._hasFocus=!1,this.onBlur())},this._handleHoursKeydown=e=>{let t=e.target;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=this._hours===``?0:parseInt(this._hours,10);this._hours=String((t+1)%24).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowDown`:{e.preventDefault();let t=this._hours===``?0:parseInt(this._hours,10);this._hours=String((t-1+24)%24).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowRight`:e.preventDefault(),this.minutesInputRef.value?.focus();break;case`Backspace`:case`Delete`:this._hoursDigitCount=0,this._hoursFirstDigit=-1;break;case`Tab`:break;case`Enter`:{e.preventDefault();let n=this.internals.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(this._hoursDigitCount===0)this._hoursFirstDigit=t,this._hours=String(t).padStart(2,`0`),this._hoursDigitCount=1,this.onInput(),t>=3&&(this._hoursFirstDigit=-1,this._hoursDigitCount=0,this._syncValueFromDisplay(),this.minutesInputRef.value?.focus());else{let e=this._hoursFirstDigit*10+t;this._hours=e<=23?String(e).padStart(2,`0`):String(t).padStart(2,`0`),this._hoursFirstDigit=-1,this._hoursDigitCount=0,this._syncValueFromDisplay(),this.onInput(),this.minutesInputRef.value?.focus()}}else e.preventDefault()}},this._handleHoursBlur=()=>{this._hours!==``&&(this._hours=String(parseInt(this._hours,10)).padStart(2,`0`)),this._hoursDigitCount=0,this._hoursFirstDigit=-1,this._syncValueFromDisplay()},this._handleMinutesKeydown=e=>{let t=e.target;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=this._minutes===``?0:parseInt(this._minutes,10);this._minutes=String((t+this._minuteStep)%60).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowDown`:{e.preventDefault();let t=this._minutes===``?0:parseInt(this._minutes,10);this._minutes=String((t-this._minuteStep+60)%60).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowLeft`:e.preventDefault(),this.hoursInputRef.value?.focus();break;case`Backspace`:case`Delete`:this._minutesDigitCount=0,this._minutesFirstDigit=-1;break;case`Tab`:break;case`Enter`:{e.preventDefault();let n=this.internals.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(this._minutesDigitCount===0)this._minutesFirstDigit=t,this._minutes=String(t).padStart(2,`0`),this._minutesDigitCount=1,this.onInput(),t>=6&&(this._minutesFirstDigit=-1,this._minutesDigitCount=0,this._syncValueFromDisplay());else{let e=this._minutesFirstDigit*10+t;this._minutes=e<=59?String(e).padStart(2,`0`):String(t).padStart(2,`0`),this._minutesFirstDigit=-1,this._minutesDigitCount=0,this._syncValueFromDisplay(),this.onInput()}}else e.preventDefault()}},this._handleMinutesBlur=()=>{this._minutes!==``&&(this._minutes=String(parseInt(this._minutes,10)).padStart(2,`0`)),this._minutesDigitCount=0,this._minutesFirstDigit=-1,this._syncValueFromDisplay()},this._handlePopupKeydown=e=>{let t=document.activeElement,n=t.closest(`.pkt-timepicker-popup__col`);if(!n)return;let r=Array.from(n.querySelectorAll(`.pkt-timepicker-popup__option`)),i=r.indexOf(t),a=t.dataset.type??``;switch(e.key){case`ArrowDown`:e.preventDefault(),this._focusOptionAndSync(r[Math.min(i+1,r.length-1)],a);break;case`ArrowUp`:e.preventDefault(),this._focusOptionAndSync(r[Math.max(i-1,0)],a);break;case`Home`:e.preventDefault(),this._focusOptionAndSync(r[0],a);break;case`End`:e.preventDefault(),this._focusOptionAndSync(r[r.length-1],a);break;case`ArrowRight`:e.preventDefault(),a===`hour`&&(this._focusOptionAndSync(t,a),this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`minute`)}));break;case`ArrowLeft`:e.preventDefault(),a===`minute`&&(this._focusOptionAndSync(t,a),this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`hour`)}));break;case`Enter`:case` `:e.preventDefault(),t.click();break;case`Escape`:e.preventDefault(),this._closePopup(),this.buttonRef.value?.focus()}}}get inputRef(){return this.hiddenInputRef}manageValidity(e){let t=this.hoursInputRef.value;if(!t)return;let r=this.pktStrings.get(`validation`);if(this.required&&!this.value){this.internals.setValidity({valueMissing:!0},r.valueMissing,t),this._setAriaInvalid(!0);return}if(!this.value){this.internals.setValidity({}),this._setAriaInvalid(!1);return}let i=l(this.value),a=u(this.step);if(this.min&&i<l(String(this.min))){this.internals.setValidity({rangeUnderflow:!0},n.t(r.rangeUnderflowMin,{min:String(this.min)}),t),this._setAriaInvalid(!0);return}if(this.max&&i>l(String(this.max))){this.internals.setValidity({rangeOverflow:!0},n.t(r.rangeOverflowMax,{max:String(this.max)}),t),this._setAriaInvalid(!0);return}if(this.step&&i%a!==0){let e=a===60?r.timeStepMismatchHour:a===30?r.timeStepMismatchHalfHour:n.t(r.timeStepMismatch,{step:`${a}, ${a*2}, ${a*3}`});this.internals.setValidity({stepMismatch:!0},e,t),this._setAriaInvalid(!0);return}this.internals.setValidity({}),this._setAriaInvalid(!1)}_describedBy(){return s.r({id:`${this.id}-hours`,hasHelptext:!!this.helptext||this.hasSlotContent(`helptext`),ariaDescribedby:this.ariaDescribedby})}_setAriaInvalid(e){if(!this.touched&&e)return;let t=this.hoursInputRef.value,n=this.minutesInputRef.value;if(e)t?.setAttribute(`aria-invalid`,`true`),n?.setAttribute(`aria-invalid`,`true`);else{if(this.hasError)return;t?.removeAttribute(`aria-invalid`),n?.removeAttribute(`aria-invalid`)}}connectedCallback(){super.connectedCallback(),this.addEventListener(`focusin`,this._handleComponentFocusIn),this.addEventListener(`focusout`,this._handleComponentFocusOut),document.addEventListener(`click`,this._outsideClickHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`focusin`,this._handleComponentFocusIn),this.removeEventListener(`focusout`,this._handleComponentFocusOut),document.removeEventListener(`click`,this._outsideClickHandler)}willUpdate(e){super.willUpdate(e),e.has(`value`)&&this._syncDisplayFromValue()}updated(e){super.updated(e),this.classList.add(`pkt-timepicker`),this.classList.toggle(`pkt-timepicker--stepper`,this.stepArrows),this.classList.toggle(`pkt-timepicker--fullwidth`,this.fullwidth),this.classList.toggle(`pkt-timepicker--medium`,this.inputSize===`medium`),this.classList.toggle(`pkt-timepicker--small`,this.inputSize===`small`),this.classList.toggle(`pkt-timepicker--xsmall`,this.inputSize===`xsmall`),e.has(`step`)&&this.step!==null&&!this._isValidStep(this.step)&&console.warn(`pkt-timepicker: step="${this.step}" er ikke en gyldig verdi. Step må være et multiplum av 60 (hele minutter) eller nøyaktig 3600 (hel time).`)}formResetCallback(){super.formResetCallback(),this._hours=``,this._minutes=``,this._isOpen=!1}_isValidStep(e){return e===3600||e<3600&&3600%e==0&&e%60==0}_syncDisplayFromValue(){let e=c(this.value)?this.value.split(`:`):null;e?(this._hours=e[0],this._minutes=e[1]):(this._hours=``,this._minutes=``)}_syncValueFromDisplay(){if(this._hours!==``&&this._minutes!==``){let e=`${this._hours}:${this._minutes}`;e!==this.value&&(this.value=e,this.onChange(e))}else this.value!==``&&(this.value=``,this.onChange(``))}get _minuteStep(){return u(this.step)}get _hourOptions(){return d(this.min,this.max)}get _minuteOptions(){return f(this.step)}_openPopup(){this._isOpen=!0,this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`hour`)})}_closePopup(){this._isOpen=!1,this._syncValueFromDisplay()}_togglePopup(){this._isOpen?this._closePopup():this._openPopup()}_scrollToSelected(){let e=this.querySelector(`.pkt-timepicker-popup`);e&&e.querySelectorAll(`.pkt-timepicker-popup__col`).forEach(e=>{let t=e.querySelector(`.pkt-timepicker-popup__option--selected`);t&&t.scrollIntoView({block:`center`})})}_focusSelectedOrFirst(e){let t=this.querySelector(`.pkt-timepicker-popup`);if(!t)return;let n=t.querySelectorAll(`.pkt-timepicker-popup__col`),r=e===`hour`?n[0]:n[1];if(!r)return;let i=r.querySelector(`.pkt-timepicker-popup__option--selected`),a=r.querySelector(`.pkt-timepicker-popup__option`);(i||a)?.focus()}_handleOptionClick(e,t){let n=String(e).padStart(2,`0`);t===`hour`?(this._hours=n,this.updateComplete.then(()=>this._focusSelectedOrFirst(`minute`))):(this._minutes=n,this._closePopup(),this.buttonRef.value?.focus())}_focusOptionAndSync(e,t){if(!e)return;let n=parseInt(e.dataset.value??`0`,10);t===`hour`?this._hours=String(n).padStart(2,`0`):this._minutes=String(n).padStart(2,`0`),e.focus()}_stepTime(e){let t=p(this._hours,this._minutes,e,this._minuteStep);this._hours=t.hours,this._minutes=t.minutes,this._syncValueFromDisplay()}_renderOption(n,r){let i=String(n).padStart(2,`0`),a=n===(r===`hour`?this._hours===``?NaN:parseInt(this._hours,10):this._minutes===``?NaN:parseInt(this._minutes,10));return e._`
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-CcJPCLgn.cjs");require("./icon-jPhyZD1z.cjs");const i=require("./if-defined-CiML3MTM.cjs"),a=require("./ref-CB7e9nMY.cjs"),o=require("./input-element-BjnKPikY.cjs"),s=require("./input-wrapper-BwzajfFX.cjs");var c=e=>/^\d{2}:\d{2}$/.test(e)&&parseInt(e.slice(0,2),10)<=23&&parseInt(e.slice(3),10)<=59,l=e=>{let[t,n]=e.split(`:`).map(Number);return t*60+n},u=e=>e?Math.max(1,Math.round(e/60)):1,d=(e,t)=>{let n=e?parseInt(String(e).split(`:`)[0],10):0,r=t?parseInt(String(t).split(`:`)[0],10):23;return Array.from({length:r-n+1},(e,t)=>t+n)},f=e=>{let t=u(e);return Array.from({length:Math.floor(60/t)},(e,n)=>n*t)},p=(e,t,n,r)=>{let i=e===``?n===1?0:23:parseInt(e,10),a=t===``?n===1?0:Math.floor(59/r)*r:parseInt(t,10);return a+=n*r,a>59?(a=0,i=(i+1)%24):a<0&&(a=Math.floor(59/r)*r,i=(i-1+24)%24),{hours:String(i).padStart(2,`0`),minutes:String(a).padStart(2,`0`)}},m=class extends o.t{constructor(...e){super(...e),this.hiddenInputRef=a.t(),this.hoursInputRef=a.t(),this.minutesInputRef=a.t(),this.buttonRef=a.t(),this.value=``,this.hidePicker=!1,this.stepArrows=!1,this._hours=``,this._minutes=``,this._isOpen=!1,this._hoursDigitCount=0,this._hoursFirstDigit=-1,this._minutesDigitCount=0,this._minutesFirstDigit=-1,this._hasFocus=!1,this._outsideClickHandler=e=>{this.contains(e.target)||this._closePopup()},this._handleComponentFocusIn=()=>{this._hasFocus||(this._hasFocus=!0,this.onFocus())},this._handleComponentFocusOut=e=>{this.contains(e.relatedTarget)||(this._hasFocus=!1,this.onBlur())},this._handleHoursKeydown=e=>{let t=e.target;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=this._hours===``?0:parseInt(this._hours,10);this._hours=String((t+1)%24).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowDown`:{e.preventDefault();let t=this._hours===``?0:parseInt(this._hours,10);this._hours=String((t-1+24)%24).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowRight`:e.preventDefault(),this.minutesInputRef.value?.focus();break;case`Backspace`:case`Delete`:this._hoursDigitCount=0,this._hoursFirstDigit=-1;break;case`Tab`:break;case`Enter`:{e.preventDefault();let n=this.internals.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(this._hoursDigitCount===0)this._hoursFirstDigit=t,this._hours=String(t).padStart(2,`0`),this._hoursDigitCount=1,this.onInput(),t>=3&&(this._hoursFirstDigit=-1,this._hoursDigitCount=0,this._syncValueFromDisplay(),this.minutesInputRef.value?.focus());else{let e=this._hoursFirstDigit*10+t;this._hours=e<=23?String(e).padStart(2,`0`):String(t).padStart(2,`0`),this._hoursFirstDigit=-1,this._hoursDigitCount=0,this._syncValueFromDisplay(),this.onInput(),this.minutesInputRef.value?.focus()}}else e.preventDefault()}},this._handleHoursBlur=()=>{this._hours!==``&&(this._hours=String(parseInt(this._hours,10)).padStart(2,`0`)),this._hoursDigitCount=0,this._hoursFirstDigit=-1,this._syncValueFromDisplay()},this._handleMinutesKeydown=e=>{let t=e.target;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=this._minutes===``?0:parseInt(this._minutes,10);this._minutes=String((t+this._minuteStep)%60).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowDown`:{e.preventDefault();let t=this._minutes===``?0:parseInt(this._minutes,10);this._minutes=String((t-this._minuteStep+60)%60).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowLeft`:e.preventDefault(),this.hoursInputRef.value?.focus();break;case`Backspace`:case`Delete`:this._minutesDigitCount=0,this._minutesFirstDigit=-1;break;case`Tab`:break;case`Enter`:{e.preventDefault();let n=this.internals.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(this._minutesDigitCount===0)this._minutesFirstDigit=t,this._minutes=String(t).padStart(2,`0`),this._minutesDigitCount=1,this.onInput(),t>=6&&(this._minutesFirstDigit=-1,this._minutesDigitCount=0,this._syncValueFromDisplay());else{let e=this._minutesFirstDigit*10+t;this._minutes=e<=59?String(e).padStart(2,`0`):String(t).padStart(2,`0`),this._minutesFirstDigit=-1,this._minutesDigitCount=0,this._syncValueFromDisplay(),this.onInput()}}else e.preventDefault()}},this._handleMinutesBlur=()=>{this._minutes!==``&&(this._minutes=String(parseInt(this._minutes,10)).padStart(2,`0`)),this._minutesDigitCount=0,this._minutesFirstDigit=-1,this._syncValueFromDisplay()},this._handlePopupKeydown=e=>{let t=document.activeElement,n=t.closest(`.pkt-timepicker-popup__col`);if(!n)return;let r=Array.from(n.querySelectorAll(`.pkt-timepicker-popup__option`)),i=r.indexOf(t),a=t.dataset.type??``;switch(e.key){case`ArrowDown`:e.preventDefault(),this._focusOptionAndSync(r[Math.min(i+1,r.length-1)],a);break;case`ArrowUp`:e.preventDefault(),this._focusOptionAndSync(r[Math.max(i-1,0)],a);break;case`Home`:e.preventDefault(),this._focusOptionAndSync(r[0],a);break;case`End`:e.preventDefault(),this._focusOptionAndSync(r[r.length-1],a);break;case`ArrowRight`:e.preventDefault(),a===`hour`&&(this._focusOptionAndSync(t,a),this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`minute`)}));break;case`ArrowLeft`:e.preventDefault(),a===`minute`&&(this._focusOptionAndSync(t,a),this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`hour`)}));break;case`Enter`:case` `:e.preventDefault(),t.click();break;case`Escape`:e.preventDefault(),this._closePopup(),this.buttonRef.value?.focus()}}}get inputRef(){return this.hiddenInputRef}manageValidity(e){let t=this.hoursInputRef.value;if(!t)return;let r=this.pktStrings.get(`validation`);if(this.required&&!this.value){this.internals.setValidity({valueMissing:!0},r.valueMissing,t),this._setAriaInvalid(!0);return}if(!this.value){this.internals.setValidity({}),this._setAriaInvalid(!1);return}let i=l(this.value),a=u(this.step);if(this.min&&i<l(String(this.min))){this.internals.setValidity({rangeUnderflow:!0},n.t(r.rangeUnderflowMin,{min:String(this.min)}),t),this._setAriaInvalid(!0);return}if(this.max&&i>l(String(this.max))){this.internals.setValidity({rangeOverflow:!0},n.t(r.rangeOverflowMax,{max:String(this.max)}),t),this._setAriaInvalid(!0);return}if(this.step&&i%a!==0){let e=a===60?r.timeStepMismatchHour:a===30?r.timeStepMismatchHalfHour:n.t(r.timeStepMismatch,{step:`${a}, ${a*2}, ${a*3}`});this.internals.setValidity({stepMismatch:!0},e,t),this._setAriaInvalid(!0);return}this.internals.setValidity({}),this._setAriaInvalid(!1)}_describedBy(){return s.r({id:`${this.id}-hours`,hasHelptext:!!this.helptext||this.hasSlotContent(`helptext`),ariaDescribedby:this.ariaDescribedby})}_setAriaInvalid(e){if(!this.touched&&e)return;let t=this.hoursInputRef.value,n=this.minutesInputRef.value;if(e)t?.setAttribute(`aria-invalid`,`true`),n?.setAttribute(`aria-invalid`,`true`);else{if(this.hasError)return;t?.removeAttribute(`aria-invalid`),n?.removeAttribute(`aria-invalid`)}}connectedCallback(){super.connectedCallback(),this.addEventListener(`focusin`,this._handleComponentFocusIn),this.addEventListener(`focusout`,this._handleComponentFocusOut),document.addEventListener(`click`,this._outsideClickHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`focusin`,this._handleComponentFocusIn),this.removeEventListener(`focusout`,this._handleComponentFocusOut),document.removeEventListener(`click`,this._outsideClickHandler)}willUpdate(e){super.willUpdate(e),e.has(`value`)&&this._syncDisplayFromValue()}updated(e){super.updated(e),this.classList.add(`pkt-timepicker`),this.classList.toggle(`pkt-timepicker--stepper`,this.stepArrows),this.classList.toggle(`pkt-timepicker--fullwidth`,this.fullwidth),this.classList.toggle(`pkt-timepicker--medium`,this.inputSize===`medium`),this.classList.toggle(`pkt-timepicker--small`,this.inputSize===`small`),this.classList.toggle(`pkt-timepicker--xsmall`,this.inputSize===`xsmall`),e.has(`step`)&&this.step!==null&&!this._isValidStep(this.step)&&console.warn(`pkt-timepicker: step="${this.step}" er ikke en gyldig verdi. Step må være et multiplum av 60 (hele minutter) eller nøyaktig 3600 (hel time).`)}formResetCallback(){super.formResetCallback(),this._hours=``,this._minutes=``,this._isOpen=!1}_isValidStep(e){return e===3600||e<3600&&3600%e==0&&e%60==0}_syncDisplayFromValue(){let e=c(this.value)?this.value.split(`:`):null;e?(this._hours=e[0],this._minutes=e[1]):(this._hours=``,this._minutes=``)}_syncValueFromDisplay(){if(this._hours!==``&&this._minutes!==``){let e=`${this._hours}:${this._minutes}`;e!==this.value&&(this.value=e,this.onChange(e))}else this.value!==``&&(this.value=``,this.onChange(``))}get _minuteStep(){return u(this.step)}get _hourOptions(){return d(this.min,this.max)}get _minuteOptions(){return f(this.step)}_openPopup(){this._isOpen=!0,this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`hour`)})}_closePopup(){this._isOpen=!1,this._syncValueFromDisplay()}_togglePopup(){this._isOpen?this._closePopup():this._openPopup()}_scrollToSelected(){let e=this.querySelector(`.pkt-timepicker-popup`);e&&e.querySelectorAll(`.pkt-timepicker-popup__col`).forEach(e=>{let t=e.querySelector(`.pkt-timepicker-popup__option--selected`);t&&t.scrollIntoView({block:`center`})})}_focusSelectedOrFirst(e){let t=this.querySelector(`.pkt-timepicker-popup`);if(!t)return;let n=t.querySelectorAll(`.pkt-timepicker-popup__col`),r=e===`hour`?n[0]:n[1];if(!r)return;let i=r.querySelector(`.pkt-timepicker-popup__option--selected`),a=r.querySelector(`.pkt-timepicker-popup__option`);(i||a)?.focus()}_handleOptionClick(e,t){let n=String(e).padStart(2,`0`);t===`hour`?(this._hours=n,this.updateComplete.then(()=>this._focusSelectedOrFirst(`minute`))):(this._minutes=n,this._closePopup(),this.buttonRef.value?.focus())}_focusOptionAndSync(e,t){if(!e)return;let n=parseInt(e.dataset.value??`0`,10);t===`hour`?this._hours=String(n).padStart(2,`0`):this._minutes=String(n).padStart(2,`0`),e.focus()}_stepTime(e){let t=p(this._hours,this._minutes,e,this._minuteStep);this._hours=t.hours,this._minutes=t.minutes,this._syncValueFromDisplay()}_renderOption(n,r){let i=String(n).padStart(2,`0`),a=n===(r===`hour`?this._hours===``?NaN:parseInt(this._hours,10):this._minutes===``?NaN:parseInt(this._minutes,10));return e._`
|
|
2
2
|
<button
|
|
3
3
|
class=${t.t({"pkt-btn":!0,"pkt-btn--tertiary":!0,"pkt-btn--small":!0,"pkt-btn--label-only":!0,"pkt-timepicker-popup__option":!0,"pkt-timepicker-popup__option--selected":a})}
|
|
4
4
|
type="button"
|
|
@@ -5,7 +5,7 @@ import { n as c } from "./element-with-slot-CVmm0_IE.js";
|
|
|
5
5
|
import "./icon-Bao96Zb8.js";
|
|
6
6
|
import { t as l } from "./if-defined-O59_I-e-.js";
|
|
7
7
|
import { n as u, t as d } from "./ref-y_5qv9vU.js";
|
|
8
|
-
import { t as f } from "./input-element-
|
|
8
|
+
import { t as f } from "./input-element-mTphzs9b.js";
|
|
9
9
|
import { r as p } from "./input-wrapper-Bb6CZxmg.js";
|
|
10
10
|
//#region ../../shared-utils/timepicker/time-utils.ts
|
|
11
11
|
var m = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && parseInt(e.slice(3), 10) <= 59, h = (e) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.14.3",
|
|
4
4
|
"description": "Komponentbiblioteket til Punkt, designsystem for Oslo kommune",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo kommune",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@babel/plugin-transform-private-property-in-object": "^7.27.1",
|
|
43
43
|
"@babel/preset-env": "^7.28.3",
|
|
44
44
|
"@babel/preset-typescript": "^7.28.3",
|
|
45
|
-
"@oslokommune/punkt-assets": "^19.
|
|
45
|
+
"@oslokommune/punkt-assets": "^19.14.2",
|
|
46
46
|
"@testing-library/dom": "^10.4.1",
|
|
47
47
|
"@testing-library/jest-dom": "^6.9.1",
|
|
48
48
|
"@types/jest-axe": "^3.5.9",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"engines": {
|
|
85
85
|
"node": "^22.19.0 || ^24.0.0 || ^26.0.0"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "c81c6cf722332d44ad8590517eb989fc8d46b33d"
|
|
88
88
|
}
|
|
@@ -302,6 +302,51 @@ describe('PktCombobox', () => {
|
|
|
302
302
|
})
|
|
303
303
|
})
|
|
304
304
|
|
|
305
|
+
describe('Maxlength validity', () => {
|
|
306
|
+
const mount = async (props: string) => {
|
|
307
|
+
const container = await createCombobox(`id="test" name="test" label="Test" ${props}`)
|
|
308
|
+
const combobox = container.querySelector('pkt-combobox') as PktCombobox
|
|
309
|
+
combobox.options = getDefaultOptions()
|
|
310
|
+
await combobox.updateComplete
|
|
311
|
+
return combobox
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
test('is valid when the number of selected options is within maxlength', async () => {
|
|
315
|
+
const combobox = await mount('multiple maxlength="2"')
|
|
316
|
+
;(combobox as any).toggleValue('apple')
|
|
317
|
+
await combobox.updateComplete
|
|
318
|
+
;(combobox as any).toggleValue('banana')
|
|
319
|
+
await combobox.updateComplete
|
|
320
|
+
|
|
321
|
+
expect(combobox['_value']).toEqual(['apple', 'banana'])
|
|
322
|
+
expect(combobox.internals.validity.tooLong).toBe(false)
|
|
323
|
+
expect(combobox.internals.validity.valid).toBe(true)
|
|
324
|
+
})
|
|
325
|
+
|
|
326
|
+
test('is too long when more options are selected than maxlength', async () => {
|
|
327
|
+
const combobox = await mount('multiple maxlength="2"')
|
|
328
|
+
combobox.value = 'apple,banana,cherry'
|
|
329
|
+
await combobox.updateComplete
|
|
330
|
+
|
|
331
|
+
expect(combobox['_value']).toEqual(['apple', 'banana', 'cherry'])
|
|
332
|
+
expect(combobox.internals.validity.tooLong).toBe(true)
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
test('is too short when fewer options are selected than minlength', async () => {
|
|
336
|
+
const combobox = await mount('multiple minlength="2"')
|
|
337
|
+
;(combobox as any).toggleValue('banana')
|
|
338
|
+
await combobox.updateComplete
|
|
339
|
+
|
|
340
|
+
expect(combobox.internals.validity.tooShort).toBe(true)
|
|
341
|
+
|
|
342
|
+
;(combobox as any).toggleValue('cherry')
|
|
343
|
+
await combobox.updateComplete
|
|
344
|
+
|
|
345
|
+
expect(combobox.internals.validity.tooShort).toBe(false)
|
|
346
|
+
expect(combobox.internals.validity.valid).toBe(true)
|
|
347
|
+
})
|
|
348
|
+
})
|
|
349
|
+
|
|
305
350
|
describe('Disabled options', () => {
|
|
306
351
|
test('does not select disabled options', async () => {
|
|
307
352
|
const optionsWithDisabled: IPktComboboxOption[] = [
|
|
@@ -110,6 +110,18 @@ describe('PktDatepicker', () => {
|
|
|
110
110
|
expect(tags.length).toBeLessThanOrEqual(2)
|
|
111
111
|
})
|
|
112
112
|
|
|
113
|
+
test('validates maxlength against the number of dates in multiple mode', async () => {
|
|
114
|
+
const container = await createDatepicker('multiple maxlength="2"')
|
|
115
|
+
const datepicker = container.querySelector('pkt-datepicker') as PktDatepicker
|
|
116
|
+
await datepicker.updateComplete
|
|
117
|
+
|
|
118
|
+
datepicker.value = '2024-06-15,2024-06-20'
|
|
119
|
+
await datepicker.updateComplete
|
|
120
|
+
|
|
121
|
+
expect(datepicker.internals.validity.tooLong).toBe(false)
|
|
122
|
+
expect(datepicker.internals.validity.valid).toBe(true)
|
|
123
|
+
})
|
|
124
|
+
|
|
113
125
|
test('sorts multiple dates chronologically', async () => {
|
|
114
126
|
const unsortedDates = '2024-06-25,2024-06-15,2024-06-20'
|
|
115
127
|
const container = await createDatepicker(`value="${unsortedDates}" multiple`)
|