@oslokommune/punkt-elements 18.9.3 → 18.9.5
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 +17 -0
- package/dist/combobox-CFgPKb3j.cjs +139 -0
- package/dist/{combobox-fzSaCPok.js → combobox-Cei828v1.js} +56 -47
- package/dist/components/combobox/combobox.d.ts +1 -0
- package/dist/components/helptext/helptext-association.test.d.ts +0 -0
- package/dist/components/timepicker/timepicker.d.ts +1 -0
- package/dist/{fileupload-Y4bDkaD9.cjs → fileupload-2nliUg_z.cjs} +2 -2
- package/dist/{fileupload-C5lxuood.js → fileupload-BpkvNlxN.js} +3 -3
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-fileupload.cjs +1 -1
- package/dist/pkt-fileupload.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +3 -3
- package/dist/pkt-timepicker.cjs +1 -1
- package/dist/pkt-timepicker.js +1 -1
- package/dist/timepicker-CAD2AYFr.cjs +198 -0
- package/dist/{timepicker--CrfIU_7.js → timepicker-D9liFW1z.js} +29 -20
- package/package.json +2 -2
- package/src/components/combobox/combobox.ts +12 -0
- package/src/components/fileupload/fileupload.ts +1 -3
- package/src/components/helptext/helptext-association.test.ts +108 -0
- package/src/components/timepicker/timepicker.ts +11 -0
- package/dist/combobox-B9Qo7hbt.cjs +0 -137
- package/dist/timepicker-auQ5Y6Et.cjs +0 -196
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,23 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [18.9.5](https://github.com/oslokommune/punkt/compare/18.9.4...18.9.5) (2026-09-18)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
Ingen
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
Ingen
|
|
18
|
+
|
|
19
|
+
### Chores
|
|
20
|
+
Ingen
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
|
|
8
25
|
## [18.9.3](https://github.com/oslokommune/punkt/compare/18.9.2...18.9.3) (2026-09-17)
|
|
9
26
|
|
|
10
27
|
### ⚠ BREAKING CHANGES
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),n=require("./if-defined-BbUZeoaQ.cjs"),r=require("./format-B8meU8Tm.cjs"),i=require("./element-with-slot-C66Jck5e.cjs");require("./icon-BzxBkRyE.cjs");const a=require("./ref-AuNEkS5a.cjs");require("./tag-CGlxtBOH.cjs");const o=require("./repeat-B3ksuY2F.cjs"),s=require("./listbox-kV4OO1Qa.cjs"),c=require("./input-element-PN5nWd1A.cjs"),l=require("./pkt-options-controller-DXAAVcBJ.cjs"),u=require("./input-wrapper-D64Qn-QH.cjs");var d=(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}},f=(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}},p=(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},m=(e,t,n)=>{let r=s.i(t,e);return n===`label`&&r?.label?r.label:e},h={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)}},g={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}},_={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]}},v={name:`pkt-combobox`,react:`PktCombobox`,"css-class":`pkt-combobox`,isElement:!0,isPureReact:!0,props:{name:{type:`string`,name:`Navn`,description:`Navn som brukes i skjema ved innsending`,category:`tech`},form:{name:`Skjema`,description:`ID-en til skjemaet feltet hører til, når feltet ligger utenfor skjemaet`,type:`string`,required:!1,category:`tech`},id:{type:`string`,name:`ID`,description:`Unik ID for feltet`,category:`tech`},label:{type:`string`,name:`Etikett/label`,description:`Tekst som vises over feltet`,category:`contents`},placeholder:{name:`Hint`,description:`Spesifiserer en kort hint som beskriver forventet verdi av feltet.`,type:`string`,category:`contents`,required:!1},multiple:{type:`boolean`,name:`Flervalg`,default:!1,description:`Mulighet for å velge flere valg`,category:`functionality`},tagPlacement:{attribute:`tag-placement`,type:[`inside`,`outside`],name:`Plassering av tags i flervalg`,description:`Plassering av valgte verdier i feltet ved flervalg`,category:`functionality`,showIf:{multiple:!0}},maxlength:{type:`number`,name:`Maks antall i flervalg`,description:`Maks antall valg dersom flervalg er aktivert`,category:`functionality`,showIf:{multiple:!0}},typeahead:{type:`boolean`,name:`Typeahead`,default:!1,description:`Mulighet for automatisk utfylling av feltet fra listen over valg`,category:`functionality`},includeSearch:{attribute:`include-search`,type:`boolean`,name:`Inkluder søk`,description:`Mulighet for å søke etter valg inni dropdown`,category:`functionality`},allowUserInput:{attribute:`allow-user-input`,type:`boolean`,name:`Brukervalgte verdier`,description:`Mulighet for å skrive inn egne verdier`,category:`functionality`},searchPlaceholder:{attribute:`search-placeholder`,type:`string`,name:`Søke-plassholder`,description:`Plassholdertekst for søkefeltet i dropdown`,category:`contents`,showIf:{includeSearch:!0}},displayValueAs:{attribute:`display-value-as`,type:[`label`,`value`,`prefixAndValue`],name:`Visning av valgt verdi`,description:`Hvordan valgt verdi vises i feltet`,default:`label`,category:`ui`},inputSize:{name:`Størrelse`,description:`Visuell størrelse via input-wrapper. small: kompakt wrapper og felt (42px). xsmall: samme wrapper som small, felt 36px.`,attribute:`input-size`,type:[`small`,`medium`,`xsmall`],default:`medium`,category:`ui`},value:{name:`Verdi`,type:`string`,description:`Valgt verdi. Streng ved enkelt valg, array av strenger ved flervalg.`,category:`tech`},helptext:{type:`string`,name:`Hjelpetekst`,description:`Hjelpetekst som vises over feltet`,category:`contents`},helptextDropdown:{attribute:`helptextdropdown`,type:`string`,name:`Utvidet hjelpetekst`,description:`Hjelpetekst som vises i en lukket boks man kan åpne`,category:`contents`},helptextDropdownButton:{attribute:`helptextdropdownbutton`,type:`string`,name:`Knappetekst for hjelpetekst`,description:`Tekst som vises på knappen for å åpne/lukke utvidet hjelpetekst`,category:`contents`,default:`Les mer`},disabled:{type:`boolean`,name:`Deaktivert`,description:`Feltet er deaktivert`,category:`tech`},hasError:{attribute:`haserror`,type:`boolean`,name:`Feil`,description:`Feltet har en feil`,category:`ui`},errorMessage:{attribute:`errormessage`,type:`string`,name:`Feilmelding`,description:`Tekst som vises under feltet ved feil`,category:`contents`},required:{type:`boolean`,name:`Påkrevd`,description:`Feltet må fylles ut`,category:`tech`},requiredTag:{attribute:`requiredtag`,type:`boolean`,name:`Påkrevd-merking`,description:`Viser en merking som indikerer at feltet er påkrevd`,category:`ui`},requiredText:{attribute:`requiredtext`,type:`string`,name:`Påkrevd-tekst`,description:`Tekst som vises i påkrevd-merkingen`,category:`contents`},optionalTag:{attribute:`optionaltag`,type:`boolean`,name:`Valgfritt-merking`,description:`Viser en merking som indikerer at feltet er valgfritt`,category:`ui`},optionalText:{attribute:`optionaltext`,type:`string`,name:`Valgfritt-tekst`,description:`Tekst som vises i valgfritt-merkingen`,category:`contents`},tagText:{attribute:`tagtext`,type:`string`,name:`Tag-tekst`,description:`Tekst som vises i en tag ved siden av label`,category:`ui`},fullwidth:{type:`boolean`,name:`Full bredde`,description:`Skal feltet ta opp hele bredden?`,category:`ui`},defaultOptions:{attribute:`default-options`,name:`Initielle valg (default options)`,description:`Liste over valg som kan velges, om options sendes inn som array med objekter (denne vil ikke modifiseres ved endring innad i komponenten)`,type:`array`,default:[],previewDefault:[{value:`bfr`,label:`Frogner`},{value:`bgo`,label:`Gamle Oslo`},{value:`bgr`,label:`Grorud`},{value:`bxx`,label:`Andre bydeler`}],items:{type:`object`,properties:{value:{type:`string`,description:`Verdi som sendes ved valg`},label:{type:`string`,description:`Tekst som vises for valget`},prefix:{type:`string`,description:`Tekst som vises før valget`},description:{type:`string`,description:`Beskrivelse av valget`},disabled:{type:`boolean`,description:`Valget er deaktivert`},selected:{type:`boolean`,description:`Valget er valgt`},tagSkinColor:{type:[`blue`,`blue-dark`,`blue-light`,`green`,`red`,`yellow`,`beige`,`gray`,`grey`],description:`Farge på tag`}},required:[`value`]},category:`contents`},options:{name:`Valg`,type:`array`,description:`Liste over valg som kan velges, om options sendes inn som array med objekter`,default:[],items:{type:`object`,properties:{value:{type:`string`,description:`Verdi som sendes ved valg`},label:{type:`string`,description:`Tekst som vises for valget`},prefix:{type:`string`,description:`Tekst som vises før valget`},description:{type:`string`,description:`Beskrivelse av valget`},disabled:{type:`boolean`,description:`Valget er deaktivert`},selected:{type:`boolean`,description:`Valget er valgt`},tagSkinColor:{type:[`blue`,`blue-dark`,`blue-light`,`green`,`red`,`yellow`,`beige`,`gray`,`grey`],description:`Farge på tag`}},required:[`value`]},category:`contents`},inline:{name:`Inline`,type:`boolean`,required:!1,default:!1,description:`Angir om feltet skal flyte med teksten`,category:`ui`},useWrapper:{attribute:`usewrapper`,name:`Bruk wrapper`,type:`boolean`,required:!1,displayAsFalse:!0,default:!0,description:`Indikerer om skjemaelementet skal bruke en wrapper`,category:`ui`},hasFieldset:{attribute:`hasfieldset`,name:`Bruk fieldset`,type:`boolean`,required:!1,default:null,description:`Bruk fieldset og legend i stedet for label. Utledes automatisk når feltet ikke har en input.`,category:`ui`},counter:{name:`Teller`,type:`boolean`,required:!1,default:null,description:`Viser teller under feltet. Slås på av seg selv når det finnes en grense å telle mot; sett til false for å skru den av.`,category:`ui`},defaultValue:{attribute:`defaultvalue`,type:`string | string[]`,name:`Standardverdi`,description:`Verdien feltet får ved oppstart og ved nullstilling av skjemaet`,category:`functionality`}},events:{change:{type:`Event`,description:`Returnerer valgt verdi som streng. Ved flervalg returneres kommaseparerte verdier.`},"value-change":{type:`CustomEvent`,description:`Returnerer valgt verdi. Ved enkeltvalg en streng, ved flervalg en <code>string[]</code>.`},search:{type:`CustomEvent`,description:`Returnerer søketeksten som streng i <code>event.detail</code> når brukeren skriver i søkefeltet`},toggleHelpText:{type:`CustomEvent`,description:`Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes`}}},y=class extends c.t{constructor(){super(),this.value=``,this.options=[],this.defaultOptions=[],this.allowUserInput=!1,this.typeahead=!1,this.includeSearch=!1,this.searchPlaceholder=null,this.multiple=!1,this.maxlength=null,this.displayValueAs=v.props.displayValueAs.default,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.disabled)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,h=``;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?m(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,h=e):(o&&this.removeAllSelected(),f=`noValidValue`,d=!1,u=!0,h=e),this._isOptionsOpen=u,u||window.setTimeout(()=>{this.focusAfterCommit()},0),this._search=h||``,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,h.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&&(h.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._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),h.markAllSelected(this._options),this.requestUpdate()}}removeAllSelected(){this._value=[],h.markAllDeselected(this._options),this._options=h.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=_.cloneOptions(this.options);e.forEach(e=>e.selected=this._value.includes(e.value)),this._options=_.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]?m(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.disabled)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.disabled){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=m(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.disabled||!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}=f(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=m(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.disabled){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.disabled||(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.disabled)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=d(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=p(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=_.cloneOptions(this.options)}if(this.optionsController?.nodes&&this.optionsController.nodes.length){let e=g.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=g.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=_.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=_.mergeWithUserAdded(_.cloneOptions(this.options),t,this._value);this._options=n,n.length>this.options.length&&(this.options=n);let r=_.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]?m(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.internals.setFormValue(``),this.internals.ariaInvalid=`false`,this.requestUpdate()}attributeChangedCallback(e,t,n){if(e===`options`){this._options=_.cloneOptions(this.options);let e=_.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
|
+
<pkt-input-wrapper
|
|
3
|
+
.strings=${this.strings}
|
|
4
|
+
.size=${this.inputSize}
|
|
5
|
+
.label=${this.label}
|
|
6
|
+
.helptext=${this.helptext}
|
|
7
|
+
.helptextDropdown=${n.t(this.helptextDropdown)}
|
|
8
|
+
.helptextDropdownButton=${n.t(this.helptextDropdownButton)}
|
|
9
|
+
?fullwidth=${this.fullwidth}
|
|
10
|
+
?counter=${this.effectiveCounter(!!this.multiple&&this.maxlength!=null)}
|
|
11
|
+
.counterCurrent=${this._value.length}
|
|
12
|
+
.counterMaxLength=${this.maxlength??0}
|
|
13
|
+
?hasError=${this.hasError}
|
|
14
|
+
?inline=${this.inline}
|
|
15
|
+
?disabled=${this.disabled}
|
|
16
|
+
.errorMessage=${this.errorMessage}
|
|
17
|
+
?optionalTag=${this.optionalTag}
|
|
18
|
+
.optionalText=${this.optionalText}
|
|
19
|
+
?requiredTag=${this.requiredTag}
|
|
20
|
+
.requiredText=${this.requiredText}
|
|
21
|
+
.tagText=${this.tagText}
|
|
22
|
+
useWrapper=${this.useWrapper}
|
|
23
|
+
.forId=${this._hasTextInput?this.id+`-input`:this.id+`-combobox`}
|
|
24
|
+
?hasFieldset=${this.effectiveHasFieldset(!this._hasTextInput)}
|
|
25
|
+
class="pkt-combobox__wrapper"
|
|
26
|
+
@labelClick=${this.handleInputClick}
|
|
27
|
+
>
|
|
28
|
+
<div class="pkt-contents" slot="helptext">${i.r(this,`helptext`)}</div>
|
|
29
|
+
<div class="pkt-combobox" @focusout=${this.handleFocusOut}>
|
|
30
|
+
<div
|
|
31
|
+
class=${t.t({"pkt-combobox__input":!0,[`pkt-combobox__input--${this.inputSize}`]:!0,"pkt-combobox__input--fullwidth":this.fullwidth,"pkt-combobox__input--open":this._isOptionsOpen,"pkt-combobox__input--error":this.hasError,"pkt-combobox__input--disabled":this.disabled})}
|
|
32
|
+
id=${n.t(this._hasTextInput?void 0:`${this.id}-combobox`)}
|
|
33
|
+
role=${n.t(this._hasTextInput?void 0:`combobox`)}
|
|
34
|
+
aria-expanded=${n.t(this._hasTextInput?void 0:this._isOptionsOpen?`true`:`false`)}
|
|
35
|
+
aria-controls=${n.t(this._hasTextInput?void 0:`${this.id}-listbox`)}
|
|
36
|
+
aria-haspopup=${n.t(this._hasTextInput?void 0:`listbox`)}
|
|
37
|
+
aria-describedby=${n.t(this._hasTextInput?void 0:this._describedBy())}
|
|
38
|
+
aria-labelledby=${n.t(this._hasTextInput?void 0:`${this.id}-combobox-label`)}
|
|
39
|
+
aria-activedescendant=${n.t(!this._hasTextInput&&this._isOptionsOpen&&this._value[0]&&s.i(this.options,this._value[0])?`${this.id}-listbox-${s.a(this._options,this._value[0])}`:void 0)}
|
|
40
|
+
aria-description=${n.t(this._selectionDescription||void 0)}
|
|
41
|
+
tabindex=${this._hasTextInput||this.disabled?`-1`:`0`}
|
|
42
|
+
@click=${this.handleInputClick}
|
|
43
|
+
@keydown=${this._hasTextInput?e.h:this.handleSelectOnlyKeydown}
|
|
44
|
+
@blur=${this.restoreInputTab}
|
|
45
|
+
${a.n(this.triggerRef)}
|
|
46
|
+
>
|
|
47
|
+
${!this._hasTextInput&&this.placeholder&&(!this._value.length||this.multiple&&this.tagPlacement==`outside`)&&!this._inputFocus?e._`<span class="pkt-combobox__placeholder" @click=${this.handlePlaceholderClick}
|
|
48
|
+
>${this.placeholder}</span
|
|
49
|
+
>`:this.tagPlacement===`outside`?e.h:this.renderSingleOrMultipleValues()}
|
|
50
|
+
${this.renderInputField()}
|
|
51
|
+
<pkt-icon
|
|
52
|
+
class=${t.t({"pkt-combobox__arrow-icon":!0,"pkt-combobox__arrow-icon--open":this._isOptionsOpen})}
|
|
53
|
+
name="chevron-thin-down"
|
|
54
|
+
aria-hidden="true"
|
|
55
|
+
></pkt-icon>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<pkt-listbox
|
|
59
|
+
id="${this.id}-listbox"
|
|
60
|
+
.options=${this._options}
|
|
61
|
+
.isOpen=${this._isOptionsOpen}
|
|
62
|
+
.searchPlaceholder=${this.searchPlaceholder}
|
|
63
|
+
.label="Liste: ${this.label||``}"
|
|
64
|
+
?disabled=${this.disabled}
|
|
65
|
+
?include-search=${this.includeSearch}
|
|
66
|
+
?is-multi-select=${this.multiple}
|
|
67
|
+
?allow-user-input=${this.allowUserInput&&!this._maxIsReached}
|
|
68
|
+
?max-is-reached=${this._maxIsReached}
|
|
69
|
+
.customUserInput=${n.t(this._addValueText)}
|
|
70
|
+
.userMessage=${this._userInfoMessage?r.t(this.pktStrings.get(`combobox`)[this._userInfoMessage],{value:this._messageValue??``}):``}
|
|
71
|
+
@search=${this.handleSearch}
|
|
72
|
+
@option-toggle=${this.handleOptionToggled}
|
|
73
|
+
@select-all=${this.addAllOptions}
|
|
74
|
+
@close-options=${this.handleCloseOptions}
|
|
75
|
+
@tab-close=${()=>this.closeAndProcessInput()}
|
|
76
|
+
.searchValue=${this._search||null}
|
|
77
|
+
.maxLength=${this.maxlength||0}
|
|
78
|
+
${a.n(this.listboxRef)}
|
|
79
|
+
></pkt-listbox>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
${this.tagPlacement===`outside`&&this.multiple?e._`<div class="pkt-combobox__tags-outside">
|
|
83
|
+
${this.renderSingleOrMultipleValues()}
|
|
84
|
+
</div>`:e.h}
|
|
85
|
+
</pkt-input-wrapper>
|
|
86
|
+
`}_describedBy(){return u.r({id:this._hasTextInput?`${this.id}-input`:`${this.id}-combobox`,hasHelptext:!!this.helptext,ariaDescribedby:this.ariaDescribedby})}renderInputField(){return this.typeahead||this.allowUserInput?e._`
|
|
87
|
+
<div class="pkt-combobox__input-div combobox__input">
|
|
88
|
+
<input
|
|
89
|
+
type="text"
|
|
90
|
+
id="${this.id}-input"
|
|
91
|
+
name=${(this.name||this.id)+`-input`}
|
|
92
|
+
placeholder=${n.t(!this._value.length||this.multiple&&this.tagPlacement===`outside`?this.placeholder:void 0)}
|
|
93
|
+
@input=${this.handleInput}
|
|
94
|
+
@change=${e=>{e.stopPropagation(),e.stopImmediatePropagation()}}
|
|
95
|
+
tabindex=${n.t(this._skipInputTab?`-1`:void 0)}
|
|
96
|
+
@keydown=${this.handleInputKeydown}
|
|
97
|
+
@focus=${this.handleFocus}
|
|
98
|
+
@blur=${this.handleBlur}
|
|
99
|
+
autocomplete="off"
|
|
100
|
+
role="combobox"
|
|
101
|
+
aria-expanded=${this._isOptionsOpen?`true`:`false`}
|
|
102
|
+
aria-label=${n.t(this.label)}
|
|
103
|
+
aria-describedby=${n.t(this._describedBy())}
|
|
104
|
+
aria-autocomplete=${this.typeahead?`both`:this.allowUserInput?`list`:`none`}
|
|
105
|
+
aria-controls="${this.id}-listbox"
|
|
106
|
+
aria-activedescendant=${n.t(this._isOptionsOpen&&this._value[0]&&s.i(this.options,this._value[0])?`${this.id}-listbox-${s.a(this._options,this._value[0])}`:void 0)}
|
|
107
|
+
aria-description=${n.t(this._selectionDescription||void 0)}
|
|
108
|
+
${a.n(this.inputRef)}
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
111
|
+
`:e._`
|
|
112
|
+
<input
|
|
113
|
+
type="hidden"
|
|
114
|
+
id="${this.id}-input"
|
|
115
|
+
name=${(this.name||this.id)+`-input`}
|
|
116
|
+
.value=${this._value.join(`,`)}
|
|
117
|
+
${a.n(this.inputRef)}
|
|
118
|
+
/>
|
|
119
|
+
`}renderSingleOrMultipleValues(){if(!this.multiple&&this._hasTextInput)return e.h;let t=!this.multiple,n=this.renderValueTag(s.i(this.options,this._value[0])),r=this.tagPlacement===`outside`,i=e._`
|
|
120
|
+
<ul role="list" class="pkt-combobox__tag-list">
|
|
121
|
+
${o.t(this._value,e=>e,(t,n)=>{let i=s.i(this.options,t),a=i?.tagSkinColor;return e._`
|
|
122
|
+
<li
|
|
123
|
+
role="listitem"
|
|
124
|
+
@click=${r?e.h:e=>e.stopPropagation()}
|
|
125
|
+
@mousedown=${r?e.h:e=>e.preventDefault()}
|
|
126
|
+
>
|
|
127
|
+
<pkt-tag
|
|
128
|
+
skin=${a||`blue-dark`}
|
|
129
|
+
?closeTag=${!this.disabled}
|
|
130
|
+
.buttonTabindex=${r?void 0:-1}
|
|
131
|
+
@close=${()=>this.handleTagRemove(t)}
|
|
132
|
+
@keydown=${r?e.h:e=>this.handleTagKeydown(e,n)}
|
|
133
|
+
>
|
|
134
|
+
${this.renderValueTag(i)}
|
|
135
|
+
</pkt-tag>
|
|
136
|
+
</li>
|
|
137
|
+
`})}
|
|
138
|
+
</ul>
|
|
139
|
+
`;return!t&&this._value.length===0?e.h:t?n:i}renderValueTag(t){if(!t)return``;switch(this.displayValueAs){case`prefixAndValue`:return e._`<span class="pkt-combobox__value">${t.prefix||``} ${t.value}</span>`;case`value`:return e._`<span class="pkt-combobox__value">${t.value}</span>`;default:return e._`<span class="pkt-combobox__value">${t.label||t.value}</span>`}}};try{e.d(`pkt-combobox`)(S)}catch{console.warn(`Forsøker å definere <pkt-combobox>, men den er allerede definert`)}var C=S;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return C}});
|
|
@@ -10,9 +10,9 @@ import { t as f } from "./repeat-CZ1oMXnW.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-CrQboPG6.js";
|
|
11
11
|
import { t as b } from "./input-element-BWxgs8L-.js";
|
|
12
12
|
import { t as x } from "./pkt-options-controller-XcIgx_v1.js";
|
|
13
|
-
import "./input-wrapper-Bg06k-cj.js";
|
|
13
|
+
import { r as S } from "./input-wrapper-Bg06k-cj.js";
|
|
14
14
|
//#region ../../shared-utils/combobox/input-utils.ts
|
|
15
|
-
var
|
|
15
|
+
var C = (e, t, n) => {
|
|
16
16
|
switch (e) {
|
|
17
17
|
case ",": return n ? "addValue" : null;
|
|
18
18
|
case "Enter": return "addValue";
|
|
@@ -21,7 +21,7 @@ var S = (e, t, n) => {
|
|
|
21
21
|
case "Escape": return "closeOptions";
|
|
22
22
|
default: return null;
|
|
23
23
|
}
|
|
24
|
-
},
|
|
24
|
+
}, w = (e, t, n, r, i) => {
|
|
25
25
|
if (!e) return {
|
|
26
26
|
action: "none",
|
|
27
27
|
value: null
|
|
@@ -43,7 +43,7 @@ var S = (e, t, n) => {
|
|
|
43
43
|
action: "none",
|
|
44
44
|
value: null
|
|
45
45
|
};
|
|
46
|
-
},
|
|
46
|
+
}, T = (e, t, n, r, i) => e.trim().toLowerCase() ? {
|
|
47
47
|
...m(e, t, n, r),
|
|
48
48
|
shouldRemoveValue: !1,
|
|
49
49
|
shouldResetInput: !1
|
|
@@ -52,10 +52,10 @@ var S = (e, t, n) => {
|
|
|
52
52
|
userInfoMessage: "",
|
|
53
53
|
shouldRemoveValue: !i && !!t[0],
|
|
54
54
|
shouldResetInput: !0
|
|
55
|
-
},
|
|
55
|
+
}, E = (e, t, n) => {
|
|
56
56
|
let r = h(t, e);
|
|
57
57
|
return n === "label" && r?.label ? r.label : e;
|
|
58
|
-
},
|
|
58
|
+
}, D = {
|
|
59
59
|
markOptionSelected(e, t) {
|
|
60
60
|
if (t) {
|
|
61
61
|
for (let n of e) if (n.value === t) {
|
|
@@ -81,7 +81,7 @@ var S = (e, t, n) => {
|
|
|
81
81
|
removeUserAddedOptions(e) {
|
|
82
82
|
return e.filter((e) => !e.userAdded);
|
|
83
83
|
}
|
|
84
|
-
},
|
|
84
|
+
}, O = { parseOptionsFromSlot(e) {
|
|
85
85
|
let t = [];
|
|
86
86
|
return e.forEach((e) => {
|
|
87
87
|
if (!e.textContent && !e.getAttribute("value")) return;
|
|
@@ -91,7 +91,7 @@ var S = (e, t, n) => {
|
|
|
91
91
|
};
|
|
92
92
|
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 = v(n), t.push(n);
|
|
93
93
|
}), t;
|
|
94
|
-
} },
|
|
94
|
+
} }, k = {
|
|
95
95
|
cloneOptions(e) {
|
|
96
96
|
return Array.isArray(e) ? e.map((e) => ({ ...e })) : [];
|
|
97
97
|
},
|
|
@@ -107,7 +107,7 @@ var S = (e, t, n) => {
|
|
|
107
107
|
mergeWithUserAdded(e, t, n) {
|
|
108
108
|
return [...t.filter((e) => e?.userAdded && n.includes(e.value)).filter((t) => !(Array.isArray(e) ? e : []).some((e) => e.value === t.value)), ...e];
|
|
109
109
|
}
|
|
110
|
-
},
|
|
110
|
+
}, A = {
|
|
111
111
|
name: "pkt-combobox",
|
|
112
112
|
react: "PktCombobox",
|
|
113
113
|
"css-class": "pkt-combobox",
|
|
@@ -497,9 +497,9 @@ var S = (e, t, n) => {
|
|
|
497
497
|
description: "Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes"
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
|
-
},
|
|
500
|
+
}, j = class extends b {
|
|
501
501
|
constructor() {
|
|
502
|
-
super(), this.value = "", this.options = [], this.defaultOptions = [], this.allowUserInput = !1, this.typeahead = !1, this.includeSearch = !1, this.searchPlaceholder = null, this.multiple = !1, this.maxlength = null, this.displayValueAs =
|
|
502
|
+
super(), this.value = "", this.options = [], this.defaultOptions = [], this.allowUserInput = !1, this.typeahead = !1, this.includeSearch = !1, this.searchPlaceholder = null, this.multiple = !1, this.maxlength = null, this.displayValueAs = A.props.displayValueAs.default, 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 = d(), this.triggerRef = d(), this.listboxRef = d(), this._pendingDispatchFrom = null, this.optionsController = new x(this);
|
|
503
503
|
}
|
|
504
504
|
get _hasTextInput() {
|
|
505
505
|
return this.typeahead || this.allowUserInput;
|
|
@@ -546,36 +546,36 @@ var S = (e, t, n) => {
|
|
|
546
546
|
i([a({
|
|
547
547
|
type: String,
|
|
548
548
|
reflect: !0
|
|
549
|
-
})],
|
|
549
|
+
})], j.prototype, "value", void 0), i([a({ type: Array })], j.prototype, "options", void 0), i([a({
|
|
550
550
|
type: Array,
|
|
551
551
|
attribute: "default-options"
|
|
552
|
-
})],
|
|
552
|
+
})], j.prototype, "defaultOptions", void 0), i([a({
|
|
553
553
|
type: Boolean,
|
|
554
554
|
attribute: "allow-user-input"
|
|
555
|
-
})],
|
|
555
|
+
})], j.prototype, "allowUserInput", void 0), i([a({ type: Boolean })], j.prototype, "typeahead", void 0), i([a({
|
|
556
556
|
type: Boolean,
|
|
557
557
|
attribute: "include-search"
|
|
558
|
-
})],
|
|
558
|
+
})], j.prototype, "includeSearch", void 0), i([a({
|
|
559
559
|
type: String,
|
|
560
560
|
attribute: "search-placeholder"
|
|
561
|
-
})],
|
|
561
|
+
})], j.prototype, "searchPlaceholder", void 0), i([a({ type: Boolean })], j.prototype, "multiple", void 0), i([a({ type: Number })], j.prototype, "maxlength", void 0), i([a({
|
|
562
562
|
type: String,
|
|
563
563
|
attribute: "display-value-as"
|
|
564
|
-
})],
|
|
564
|
+
})], j.prototype, "displayValueAs", void 0), i([a({
|
|
565
565
|
type: String,
|
|
566
566
|
attribute: "tag-placement"
|
|
567
|
-
})],
|
|
567
|
+
})], j.prototype, "tagPlacement", void 0), i([a({
|
|
568
568
|
type: Boolean,
|
|
569
569
|
attribute: "open"
|
|
570
|
-
})],
|
|
570
|
+
})], j.prototype, "isOpen", void 0), i([r()], j.prototype, "_options", void 0), i([r()], j.prototype, "_value", void 0), i([r()], j.prototype, "_isOptionsOpen", void 0), i([r()], j.prototype, "_userInfoMessage", void 0), i([r()], j.prototype, "_messageValue", void 0), i([r()], j.prototype, "_addValueText", void 0), i([r()], j.prototype, "_maxIsReached", void 0), i([r()], j.prototype, "_search", void 0), i([r()], j.prototype, "_inputFocus", void 0), i([r()], j.prototype, "_skipInputTab", void 0);
|
|
571
571
|
//#endregion
|
|
572
572
|
//#region src/components/combobox/combobox-value.ts
|
|
573
|
-
var
|
|
573
|
+
var M = class extends j {
|
|
574
574
|
toggleValue(e) {
|
|
575
575
|
if (this.disabled) return;
|
|
576
576
|
this.touched = !0, this._userInfoMessage = "", this._addValueText = null;
|
|
577
577
|
let t = h(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, s = this.multiple, c = g(this._value.length, this.maxlength), l = !1, u = !0, d = "", f = null, p = "";
|
|
578
|
-
i || (!r && this.allowUserInput && !a ? (this.addNewUserValue(e), d = "valueAdded", l = s) : !r && !this.allowUserInput ? (o && this._value[0] && this.removeValue(this._value[0]), u = !1, l = !0, d = "noResults") : n ? (this.removeValue(t), l = !0, o && this._hasTextInput && this.inputRef.value && this.inputRef.value.type !== "hidden" && (this.inputRef.value.value = "")) : a && o ? (this.removeAllSelected(), l = !0) : o ? (this._value[0] && this.removeSelected(this._value[0]), this.setSelected(t), l = !1, d = "valueSelected", f = this._hasTextInput ?
|
|
578
|
+
i || (!r && this.allowUserInput && !a ? (this.addNewUserValue(e), d = "valueAdded", l = s) : !r && !this.allowUserInput ? (o && this._value[0] && this.removeValue(this._value[0]), u = !1, l = !0, d = "noResults") : n ? (this.removeValue(t), l = !0, o && this._hasTextInput && this.inputRef.value && this.inputRef.value.type !== "hidden" && (this.inputRef.value.value = "")) : a && o ? (this.removeAllSelected(), l = !0) : o ? (this._value[0] && this.removeSelected(this._value[0]), this.setSelected(t), l = !1, d = "valueSelected", f = this._hasTextInput ? E(t || "", this.options, this.displayValueAs) : y(h(this.options, t), this.displayValueAs)) : s && !c ? (this.setSelected(t), l = !0) : s && c ? (d = "maxSelected", u = !1, p = e) : (o && this.removeAllSelected(), d = "noValidValue", u = !1, l = !0, p = e), this._isOptionsOpen = l, l || window.setTimeout(() => {
|
|
579
579
|
this.focusAfterCommit();
|
|
580
580
|
}, 0), this._search = p || "", this.resetComboboxInput(u), this._userInfoMessage = d, this._messageValue = f, s && this.updateMaxReached());
|
|
581
581
|
}
|
|
@@ -585,14 +585,14 @@ var j = class extends A {
|
|
|
585
585
|
this._userInfoMessage = "maxSelected";
|
|
586
586
|
return;
|
|
587
587
|
}
|
|
588
|
-
!this.multiple && this.removeAllSelected(), this._value = e ? [...this._value, e] : this._value,
|
|
588
|
+
!this.multiple && this.removeAllSelected(), this._value = e ? [...this._value, e] : this._value, D.markOptionSelected(this._options, e), this.resetComboboxInput(!0);
|
|
589
589
|
}
|
|
590
590
|
}
|
|
591
591
|
removeSelected(e) {
|
|
592
592
|
if (!e) return;
|
|
593
593
|
this._value = this._value.filter((t) => t !== e);
|
|
594
594
|
let t = h(this.options, e);
|
|
595
|
-
t && (
|
|
595
|
+
t && (D.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._options = [...this._options, t]));
|
|
596
596
|
}
|
|
597
597
|
addAllOptions() {
|
|
598
598
|
if (this.multiple) {
|
|
@@ -600,11 +600,11 @@ var j = class extends A {
|
|
|
600
600
|
this._userInfoMessage = "tooManySelected";
|
|
601
601
|
return;
|
|
602
602
|
}
|
|
603
|
-
this._value = this._options.map((e) => e.value),
|
|
603
|
+
this._value = this._options.map((e) => e.value), D.markAllSelected(this._options), this.requestUpdate();
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
removeAllSelected() {
|
|
607
|
-
this._value = [],
|
|
607
|
+
this._value = [], D.markAllDeselected(this._options), this._options = D.removeUserAddedOptions(this._options), this.requestUpdate();
|
|
608
608
|
}
|
|
609
609
|
addValue() {
|
|
610
610
|
let e = this.inputRef.value?.value.trim() || "";
|
|
@@ -635,11 +635,11 @@ var j = class extends A {
|
|
|
635
635
|
}, 0)), this.requestUpdate();
|
|
636
636
|
}
|
|
637
637
|
refreshOptionsFromValue() {
|
|
638
|
-
let e =
|
|
639
|
-
e.forEach((e) => e.selected = this._value.includes(e.value)), this._options =
|
|
638
|
+
let e = k.cloneOptions(this.options);
|
|
639
|
+
e.forEach((e) => e.selected = this._value.includes(e.value)), this._options = k.syncOptionsWithValues(e, this._value).options;
|
|
640
640
|
}
|
|
641
641
|
resetComboboxInput(e = !0) {
|
|
642
|
-
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] ?
|
|
642
|
+
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] ? E(this._value[0], this.options, this.displayValueAs) : "", this._userInfoMessage = "")), this.refreshOptionsFromValue();
|
|
643
643
|
}
|
|
644
644
|
removeLastValue(e) {
|
|
645
645
|
if (this._value.length === 0) return;
|
|
@@ -647,7 +647,7 @@ var j = class extends A {
|
|
|
647
647
|
let t = this._value[this._value.length - 1];
|
|
648
648
|
t && this.removeSelected(t), this.updateMaxReached();
|
|
649
649
|
}
|
|
650
|
-
},
|
|
650
|
+
}, N = class extends M {
|
|
651
651
|
handleInput(e) {
|
|
652
652
|
if (e.stopPropagation(), e.stopImmediatePropagation(), this.disabled) return;
|
|
653
653
|
this.touched = !0;
|
|
@@ -665,7 +665,7 @@ var j = class extends A {
|
|
|
665
665
|
this._suppressNextOpen = !1, this._inputFocus = !0, this.requestUpdate();
|
|
666
666
|
return;
|
|
667
667
|
}
|
|
668
|
-
!this.multiple && this._value[0] && this.inputRef.value && this.inputRef.value.type !== "hidden" && (this.inputRef.value.value =
|
|
668
|
+
!this.multiple && this._value[0] && this.inputRef.value && this.inputRef.value.type !== "hidden" && (this.inputRef.value.value = E(this._value[0], this.options, this.displayValueAs)), this._inputFocus = !0, this._search = "", this.refreshOptionsFromValue(), this._isOptionsOpen = !0, this.onFocus(), this.requestUpdate();
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
671
|
handleCloseOptions() {
|
|
@@ -686,7 +686,7 @@ var j = class extends A {
|
|
|
686
686
|
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));
|
|
687
687
|
}
|
|
688
688
|
} else if (e !== "") {
|
|
689
|
-
let { action: t, value: n } =
|
|
689
|
+
let { action: t, value: n } = w(e, this._value, this.options, this.allowUserInput, this.multiple);
|
|
690
690
|
switch (t) {
|
|
691
691
|
case "addUserValue":
|
|
692
692
|
this.addNewUserValue(n);
|
|
@@ -697,7 +697,7 @@ var j = class extends A {
|
|
|
697
697
|
case "removeValue": this.removeValue(n);
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
|
-
!this.multiple && this._value[0] ? this.inputRef.value.value =
|
|
700
|
+
!this.multiple && this._value[0] ? this.inputRef.value.value = E(this._value[0], this.options, this.displayValueAs) : this.inputRef.value.value = "";
|
|
701
701
|
}
|
|
702
702
|
this._isOptionsOpen = !1, this.onBlur();
|
|
703
703
|
}
|
|
@@ -755,7 +755,7 @@ var j = class extends A {
|
|
|
755
755
|
return;
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
|
-
let t =
|
|
758
|
+
let t = C(e.key, e.shiftKey, this.multiple);
|
|
759
759
|
if (t && !(e.key === "Tab" && !this._isOptionsOpen)) {
|
|
760
760
|
if (t === "focusListbox" && e.key === "Tab" && !this.listboxRef.value?.querySelector("[role=\"option\"]:not([data-disabled]), [data-type=\"new-option\"]")) {
|
|
761
761
|
this.closeAndProcessInput();
|
|
@@ -816,14 +816,14 @@ var j = class extends A {
|
|
|
816
816
|
}
|
|
817
817
|
}
|
|
818
818
|
checkForMatches() {
|
|
819
|
-
let e =
|
|
819
|
+
let e = T(this.inputRef.value?.value || this._search || "", this._value, this.options, this.allowUserInput, this.multiple);
|
|
820
820
|
if (e.shouldRemoveValue && this.removeValue(this._value[0]), e.shouldResetInput) {
|
|
821
821
|
this.resetComboboxInput(!1);
|
|
822
822
|
return;
|
|
823
823
|
}
|
|
824
824
|
this._addValueText = e.addValueText, this._userInfoMessage = e.userInfoMessage;
|
|
825
825
|
}
|
|
826
|
-
},
|
|
826
|
+
}, P = class extends N {
|
|
827
827
|
constructor(...e) {
|
|
828
828
|
super(...e), this.handleBodyClick = (e) => {
|
|
829
829
|
this._isOptionsOpen && !this.contains(e.target) && this.closeAndProcessInput();
|
|
@@ -832,10 +832,10 @@ var j = class extends A {
|
|
|
832
832
|
connectedCallback() {
|
|
833
833
|
if (super.connectedCallback(), document?.body.addEventListener("click", this.handleBodyClick), this._options = [], this.defaultOptions && this.defaultOptions.length) {
|
|
834
834
|
let e = this.options?.filter((e) => e.userAdded) || [];
|
|
835
|
-
this.options = [...e, ...JSON.parse(JSON.stringify(this.defaultOptions))], this._options =
|
|
835
|
+
this.options = [...e, ...JSON.parse(JSON.stringify(this.defaultOptions))], this._options = k.cloneOptions(this.options);
|
|
836
836
|
}
|
|
837
837
|
if (this.optionsController?.nodes && this.optionsController.nodes.length) {
|
|
838
|
-
let e =
|
|
838
|
+
let e = O.parseOptionsFromSlot(this.optionsController.nodes);
|
|
839
839
|
e.length && (this.options = [...e], this._options = [...e], this._optionsFromSlot = !0, this._lastSlotGeneration = this.optionsController.generation);
|
|
840
840
|
}
|
|
841
841
|
}
|
|
@@ -850,13 +850,13 @@ var j = class extends A {
|
|
|
850
850
|
let e = this.optionsController.generation;
|
|
851
851
|
if (e !== this._lastSlotGeneration) {
|
|
852
852
|
this._lastSlotGeneration = e;
|
|
853
|
-
let t =
|
|
853
|
+
let t = O.parseOptionsFromSlot(this.optionsController.nodes), n = this._options.filter((e) => e.userAdded);
|
|
854
854
|
this.options = [...n, ...t];
|
|
855
855
|
}
|
|
856
856
|
}
|
|
857
857
|
if (super.willUpdate(e), e.has("isOpen") && (this._isOptionsOpen = this.isOpen), e.has("defaultOptions") && this.defaultOptions.length) {
|
|
858
858
|
let e = (Array.isArray(this.options) ? this.options : []).filter((e) => e.userAdded) || [];
|
|
859
|
-
this.options = [...e, ...JSON.parse(JSON.stringify(this.defaultOptions))], this._options =
|
|
859
|
+
this.options = [...e, ...JSON.parse(JSON.stringify(this.defaultOptions))], this._options = k.cloneOptions(this.options);
|
|
860
860
|
}
|
|
861
861
|
let t = e.has("value"), n = e.has("_value");
|
|
862
862
|
if (t) {
|
|
@@ -868,9 +868,9 @@ var j = class extends A {
|
|
|
868
868
|
e.length && (this._pendingDispatchFrom ??= [...this._value], this._value = e, this._options.forEach((t) => t.selected = e.includes(t.value)), this._options = [...this._options]);
|
|
869
869
|
}
|
|
870
870
|
if (e.has("options")) {
|
|
871
|
-
let t = e.get("options") || this._options || [], n =
|
|
871
|
+
let t = e.get("options") || this._options || [], n = k.mergeWithUserAdded(k.cloneOptions(this.options), t, this._value);
|
|
872
872
|
this._options = n, n.length > this.options.length && (this.options = n);
|
|
873
|
-
let r =
|
|
873
|
+
let r = k.syncOptionsWithValues(this._options, this._value);
|
|
874
874
|
this._options = r.options, r.newValues.length > this._value.length && (this._pendingDispatchFrom ??= [...this._value], this._value = r.newValues);
|
|
875
875
|
}
|
|
876
876
|
(t || n || e.has("options") || e.has("defaultValue")) && this.updateMaxReached(), this._pendingDispatchFrom && this.syncPublicValue();
|
|
@@ -884,7 +884,7 @@ var j = class extends A {
|
|
|
884
884
|
detail: this._search,
|
|
885
885
|
bubbles: !1
|
|
886
886
|
})), !this._isOptionsOpen && this._hasTextInput && this.inputRef.value && this.inputRef.value.type !== "hidden") {
|
|
887
|
-
let e = !this.multiple && this._value[0] ?
|
|
887
|
+
let e = !this.multiple && this._value[0] ? E(this._value[0], this.options, this.displayValueAs) : "";
|
|
888
888
|
this.inputRef.value.value !== e && (this.inputRef.value.value = e);
|
|
889
889
|
}
|
|
890
890
|
this.classList.add("pkt-combobox-component"), this.classList.toggle("pkt-combobox-component--fullwidth", !!this.fullwidth), super.updated(e);
|
|
@@ -902,8 +902,8 @@ var j = class extends A {
|
|
|
902
902
|
}
|
|
903
903
|
attributeChangedCallback(e, t, n) {
|
|
904
904
|
if (e === "options") {
|
|
905
|
-
this._options =
|
|
906
|
-
let e =
|
|
905
|
+
this._options = k.cloneOptions(this.options);
|
|
906
|
+
let e = k.syncOptionsWithValues(this._options, this._value);
|
|
907
907
|
this._options = e.options, e.newValues.length > this._value.length && (this._value = e.newValues), this._search = "";
|
|
908
908
|
}
|
|
909
909
|
super.attributeChangedCallback(e, t, n);
|
|
@@ -952,6 +952,7 @@ var j = class extends A {
|
|
|
952
952
|
aria-expanded=${s(this._hasTextInput ? void 0 : this._isOptionsOpen ? "true" : "false")}
|
|
953
953
|
aria-controls=${s(this._hasTextInput ? void 0 : `${this.id}-listbox`)}
|
|
954
954
|
aria-haspopup=${s(this._hasTextInput ? void 0 : "listbox")}
|
|
955
|
+
aria-describedby=${s(this._hasTextInput ? void 0 : this._describedBy())}
|
|
955
956
|
aria-labelledby=${s(this._hasTextInput ? void 0 : `${this.id}-combobox-label`)}
|
|
956
957
|
aria-activedescendant=${s(!this._hasTextInput && this._isOptionsOpen && this._value[0] && h(this.options, this._value[0]) ? `${this.id}-listbox-${p(this._options, this._value[0])}` : void 0)}
|
|
957
958
|
aria-description=${s(this._selectionDescription || void 0)}
|
|
@@ -1005,6 +1006,13 @@ var j = class extends A {
|
|
|
1005
1006
|
</pkt-input-wrapper>
|
|
1006
1007
|
`;
|
|
1007
1008
|
}
|
|
1009
|
+
_describedBy() {
|
|
1010
|
+
return S({
|
|
1011
|
+
id: this._hasTextInput ? `${this.id}-input` : `${this.id}-combobox`,
|
|
1012
|
+
hasHelptext: !!this.helptext,
|
|
1013
|
+
ariaDescribedby: this.ariaDescribedby
|
|
1014
|
+
});
|
|
1015
|
+
}
|
|
1008
1016
|
renderInputField() {
|
|
1009
1017
|
return this.typeahead || this.allowUserInput ? e`
|
|
1010
1018
|
<div class="pkt-combobox__input-div combobox__input">
|
|
@@ -1025,6 +1033,7 @@ var j = class extends A {
|
|
|
1025
1033
|
role="combobox"
|
|
1026
1034
|
aria-expanded=${this._isOptionsOpen ? "true" : "false"}
|
|
1027
1035
|
aria-label=${s(this.label)}
|
|
1036
|
+
aria-describedby=${s(this._describedBy())}
|
|
1028
1037
|
aria-autocomplete=${this.typeahead ? "both" : this.allowUserInput ? "list" : "none"}
|
|
1029
1038
|
aria-controls="${this.id}-listbox"
|
|
1030
1039
|
aria-activedescendant=${s(this._isOptionsOpen && this._value[0] && h(this.options, this._value[0]) ? `${this.id}-listbox-${p(this._options, this._value[0])}` : void 0)}
|
|
@@ -1080,12 +1089,12 @@ var j = class extends A {
|
|
|
1080
1089
|
}
|
|
1081
1090
|
};
|
|
1082
1091
|
try {
|
|
1083
|
-
t("pkt-combobox")(
|
|
1092
|
+
t("pkt-combobox")(P);
|
|
1084
1093
|
} catch {
|
|
1085
1094
|
console.warn("Forsøker å definere <pkt-combobox>, men den er allerede definert");
|
|
1086
1095
|
}
|
|
1087
1096
|
//#endregion
|
|
1088
1097
|
//#region src/components/combobox/index.ts
|
|
1089
|
-
var
|
|
1098
|
+
var F = P;
|
|
1090
1099
|
//#endregion
|
|
1091
|
-
export {
|
|
1100
|
+
export { P as n, F as t };
|
|
@@ -84,6 +84,7 @@ export declare class PktCombobox extends ComboboxHandlers implements IPktCombobo
|
|
|
84
84
|
protected formResetCallback(): void;
|
|
85
85
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
86
86
|
render(): import('lit-html').TemplateResult<1>;
|
|
87
|
+
private _describedBy;
|
|
87
88
|
private renderInputField;
|
|
88
89
|
private renderSingleOrMultipleValues;
|
|
89
90
|
private renderValueTag;
|
|
File without changes
|
|
@@ -61,6 +61,7 @@ export declare class PktTimepicker extends PktInputElement<Props> {
|
|
|
61
61
|
private _minutesDigitCount;
|
|
62
62
|
private _minutesFirstDigit;
|
|
63
63
|
private _hasFocus;
|
|
64
|
+
private _describedBy;
|
|
64
65
|
private _setAriaInvalid;
|
|
65
66
|
private _outsideClickHandler;
|
|
66
67
|
private _handleComponentFocusIn;
|
|
@@ -253,7 +253,7 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
253
253
|
${w===`idle`?V({file:n,disabled:i,inputName:r,operations:l,activeOperationId:u,onActivateOperation:d,onCloseOperation:f,getFileAttribute:p,setFileAttribute:m}):null}
|
|
254
254
|
${w===`idle`?H({file:n,disabled:i,inputName:r,operations:l,activeOperationId:u,onActivateOperation:d,onCloseOperation:f,getFileAttribute:p,setFileAttribute:m}):null}
|
|
255
255
|
</li>
|
|
256
|
-
`},J=class extends T{constructor(...e){super(...e),this.activeOperationByFileId={},this.isPreviewModalOpen=!1,this.previewCurrentIndex=0,this.failedImageFileIds={},this.closePreview=()=>{this.isPreviewModalOpen=!1},this.onPreviewKeyDown=(e,t)=>{if(this.isPreviewModalOpen){if(e.key===`Tab`){o.r(e,e.currentTarget);return}switch(e.key){case`ArrowLeft`:e.preventDefault(),this.navigatePreview(`prev`,t);break;case`ArrowRight`:e.preventDefault(),this.navigatePreview(`next`,t);break;case`Escape`:e.preventDefault(),this.closePreview()}}}}updated(e){super.updated(e),this.classList.add(`pkt-fileupload-component`)}render(){let n=this.renderContent();return
|
|
256
|
+
`},J=class extends T{constructor(...e){super(...e),this.activeOperationByFileId={},this.isPreviewModalOpen=!1,this.previewCurrentIndex=0,this.failedImageFileIds={},this.closePreview=()=>{this.isPreviewModalOpen=!1},this.onPreviewKeyDown=(e,t)=>{if(this.isPreviewModalOpen){if(e.key===`Tab`){o.r(e,e.currentTarget);return}switch(e.key){case`ArrowLeft`:e.preventDefault(),this.navigatePreview(`prev`,t);break;case`ArrowRight`:e.preventDefault(),this.navigatePreview(`next`,t);break;case`Escape`:e.preventDefault(),this.closePreview()}}}}updated(e){super.updated(e),this.classList.add(`pkt-fileupload-component`)}render(){let n=this.renderContent();return e._`
|
|
257
257
|
<pkt-input-wrapper
|
|
258
258
|
.strings=${this.strings}
|
|
259
259
|
.forId=${`${this.id}-input`}
|
|
@@ -272,7 +272,7 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
272
272
|
>
|
|
273
273
|
${n}
|
|
274
274
|
</pkt-input-wrapper>
|
|
275
|
-
|
|
275
|
+
`}renderContent(){let r=this.getSortedFilesAndTransfers(),i=this.getPreviewableImages(r),a=this.pktStrings.get(`fileupload`),o=this.getSupportedFormatsText(),s=[this.helptext?`${this.id}-input-helptext`:void 0,this.hasEffectiveError?`${this.id}-error`:void 0].filter(Boolean).join(` `)||void 0,c=this.itemRenderer===`thumbnail`?this.multiple?{dragInactive:a.dropZoneDragMultipleThumbnail,dragActive:a.dropZoneDragActiveMultipleThumbnail,openFileDialog:a.dropZoneOpenFileDialogMultipleThumbnail}:{dragInactive:a.dropZoneDragSingleThumbnail,dragActive:a.dropZoneDragActiveSingleThumbnail,openFileDialog:a.dropZoneOpenFileDialogSingleThumbnail}:this.multiple?{dragInactive:a.dropZoneDragMultiple,dragActive:a.dropZoneDragActiveMultiple,openFileDialog:a.dropZoneOpenFileDialogMultiple}:{dragInactive:a.dropZoneDragSingle,dragActive:a.dropZoneDragActiveSingle,openFileDialog:a.dropZoneOpenFileDialogSingle};return e._`
|
|
276
276
|
<div
|
|
277
277
|
class=${t.t({"pkt-fileupload":!0,"pkt-fileupload--full-width":this.fullwidth,"pkt-fileupload--error":this.hasEffectiveError,"pkt-fileupload--disabled":this.disabled})}
|
|
278
278
|
aria-disabled=${String(this.disabled)}
|
|
@@ -1077,7 +1077,7 @@ var M = "comments", N = (e) => {
|
|
|
1077
1077
|
}
|
|
1078
1078
|
render() {
|
|
1079
1079
|
let t = this.renderContent();
|
|
1080
|
-
return
|
|
1080
|
+
return e`
|
|
1081
1081
|
<pkt-input-wrapper
|
|
1082
1082
|
.strings=${this.strings}
|
|
1083
1083
|
.forId=${`${this.id}-input`}
|
|
@@ -1099,10 +1099,10 @@ var M = "comments", N = (e) => {
|
|
|
1099
1099
|
>
|
|
1100
1100
|
${t}
|
|
1101
1101
|
</pkt-input-wrapper>
|
|
1102
|
-
|
|
1102
|
+
`;
|
|
1103
1103
|
}
|
|
1104
1104
|
renderContent() {
|
|
1105
|
-
let t = this.getSortedFilesAndTransfers(), n = this.getPreviewableImages(t), r = this.pktStrings.get("fileupload"), i = this.getSupportedFormatsText(), a = [
|
|
1105
|
+
let t = this.getSortedFilesAndTransfers(), n = this.getPreviewableImages(t), r = this.pktStrings.get("fileupload"), i = this.getSupportedFormatsText(), a = [this.helptext ? `${this.id}-input-helptext` : void 0, this.hasEffectiveError ? `${this.id}-error` : void 0].filter(Boolean).join(" ") || void 0, o = this.itemRenderer === "thumbnail" ? this.multiple ? {
|
|
1106
1106
|
dragInactive: r.dropZoneDragMultipleThumbnail,
|
|
1107
1107
|
dragActive: r.dropZoneDragActiveMultipleThumbnail,
|
|
1108
1108
|
openFileDialog: r.dropZoneOpenFileDialogMultipleThumbnail
|