@oslokommune/punkt-elements 19.15.3 → 19.17.1
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 +14 -0
- package/dist/{accordion-BlsqYbJf.js → accordion-B0zAUNUV.js} +5 -5
- package/dist/{accordion-DukAa2ED.cjs → accordion-Cx-Gh3hc.cjs} +1 -1
- package/dist/{alert-CuXM6TnC.cjs → alert-BRZDpVMt.cjs} +1 -1
- package/dist/{alert-Xt26J9yX.js → alert-JnRrtTOW.js} +5 -5
- package/dist/{async-directive-yh8hG41Q.js → async-directive-C4LocQwR.js} +2 -2
- package/dist/{backlink-ogvv493Y.js → backlink-D8Rv46lA.js} +3 -3
- package/dist/{breadcrumbs-53QVnTFP.js → breadcrumbs-ybOBe_op.js} +2 -2
- package/dist/{button-BFG-7bDB.cjs → button-Ca_V13cQ.cjs} +1 -1
- package/dist/{button-DhCqyX4D.js → button-ChdHZYBF.js} +5 -5
- package/dist/{calendar-CtWc545R.js → calendar-BQCjUQvP.js} +7 -11
- package/dist/{calendar-5XCeDtZX.cjs → calendar-CFTrX0C5.cjs} +2 -2
- package/dist/{card-Diivw_vm.cjs → card-COseC8ZL.cjs} +1 -1
- package/dist/{card-DCc3wfUb.js → card-DSTEL8Kv.js} +6 -6
- package/dist/{checkbox-BDwOYcNM.js → checkbox-CKYNnLDh.js} +5 -9
- package/dist/{checkbox-BwI9QNSh.cjs → checkbox-DkFswqr-.cjs} +2 -2
- package/dist/{checkbox-group-Bum7k828.js → checkbox-group-1ghi5uHp.js} +3 -3
- package/dist/{checkbox-group-BLurd7sf.cjs → checkbox-group-lcxR3cYR.cjs} +1 -1
- package/dist/{class-map-Bf-QzUpN.js → class-map-BkEYw5uE.js} +1 -1
- package/dist/combobox-CaWnlvTX.cjs +139 -0
- package/dist/{combobox-C7tUHbG4.js → combobox-iXYiaWbN.js} +63 -96
- package/dist/components/index.d.ts +1 -0
- package/dist/components/input-wrapper/index.d.ts +1 -0
- package/dist/components/input-wrapper/input-wrapper.d.ts +13 -6
- package/dist/{consent-DBYZaCTp.cjs → consent-BwH89xk_.cjs} +1 -1
- package/dist/{consent-BUS6GEUu.js → consent-DiD0iQ5h.js} +5 -5
- package/dist/converters-CW6SN0TT.cjs +1 -0
- package/dist/{converters-CkjLSYpa.js → converters-CYgQrWVm.js} +138 -141
- package/dist/{datepicker-CJLcIDVk.js → datepicker-DTcow1ih.js} +15 -25
- package/dist/{datepicker-DmZi4CNk.cjs → datepicker-Da8SfyVG.cjs} +3 -3
- package/dist/{dialog-polyfill.esm-B-g35ove.cjs → dialog-polyfill.esm-CW51hN2p.cjs} +1 -1
- package/dist/{dialog-polyfill.esm-DHSvqor8.js → dialog-polyfill.esm-D39dWbRt.js} +2 -2
- package/dist/{directive-helpers-CwxFepWh.js → directive-helpers-BAinC437.js} +1 -1
- package/dist/{element-DBugHPKM.js → element-ckeMVgMz.js} +1 -1
- package/dist/{element-with-slot-CVmm0_IE.js → element-with-slot-C0bH0T0H.js} +27 -38
- package/dist/element-with-slot-DkyaNnm0.cjs +1 -0
- package/dist/{fileupload-DehKWas6.js → fileupload-BNAQ9tNR.js} +16 -23
- package/dist/{fileupload-A_suUEPU.cjs → fileupload-Cb1c7ul0.cjs} +3 -3
- package/dist/{footer-L2vhQTAS.js → footer-BOwcLSsz.js} +4 -4
- package/dist/{footer-C6ajmlq2.cjs → footer-Cl_Da5Iq.cjs} +1 -1
- package/dist/{header-BzAPmAsZ.cjs → header-CvER8wo6.cjs} +2 -2
- package/dist/{header-C6xhv3Ib.js → header-Cwr995oK.js} +13 -13
- package/dist/{header-menu-F3tZZ5vO.js → header-menu-CsL4DZE2.js} +5 -5
- package/dist/{header-menu-Cz7G7Q2R.cjs → header-menu-D-wOwG1V.cjs} +1 -1
- package/dist/{heading-BluavR6A.cjs → heading-D4Kkb6-N.cjs} +1 -1
- package/dist/{heading-y72aIgB8.js → heading-DhTyaJms.js} +2 -2
- package/dist/{helptext-Dujce_W9.js → helptext-DN0jjgVu.js} +4 -4
- package/dist/{helptext-Bdv80rcs.cjs → helptext-p0nwJsyf.cjs} +1 -1
- package/dist/{icon-Bao96Zb8.js → icon-CLMJYuTL.js} +1 -1
- package/dist/{if-defined-O59_I-e-.js → if-defined-D18nY_K_.js} +1 -1
- package/dist/{input-element-mTphzs9b.js → input-element-0yYtRu0p.js} +3 -3
- package/dist/{input-element-BjnKPikY.cjs → input-element-BOi7rBbw.cjs} +1 -1
- package/dist/input-wrapper-4PTk8aX3.cjs +62 -0
- package/dist/{input-wrapper-xRJo_iVf.js → input-wrapper-BSjQc4Vx.js} +29 -197
- package/dist/{link-sO401Ieh.js → link-39EvU2ng.js} +5 -5
- package/dist/{link-CRLAhYi0.cjs → link-Dj6SbcaD.cjs} +1 -1
- package/dist/{linkcard-DnZgMzqL.cjs → linkcard-BoQIfci8.cjs} +1 -1
- package/dist/{linkcard-DdmGxzAP.js → linkcard-K9vvKg1u.js} +4 -4
- package/dist/{listbox-CvduK_YU.cjs → listbox-BbdUu-IV.cjs} +3 -3
- package/dist/{listbox-BDesthOp.js → listbox-DFd-1faX.js} +15 -16
- package/dist/{loader-Zo_VSsNw.cjs → loader-BRYL5kTN.cjs} +1 -1
- package/dist/{loader-Di5kHEQ4.js → loader-MoI2VRFr.js} +4 -4
- package/dist/{messagebox-CR59jv8N.cjs → messagebox-CiOQUt0C.cjs} +1 -1
- package/dist/{messagebox-CzaFlrYz.js → messagebox-Dr-k3pnZ.js} +4 -4
- package/dist/{modal-wEEmCcUx.cjs → modal-DGiq84MG.cjs} +1 -1
- package/dist/{modal-0D0paY70.js → modal-DbzEnZNF.js} +8 -8
- package/dist/option-group-element-CH0sgVIl.cjs +23 -0
- package/dist/{option-group-element-fpMneBWa.js → option-group-element-DC364Rw_.js} +3 -3
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +1 -2
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -2
- package/dist/pkt-backlink.js +1 -2
- package/dist/pkt-breadcrumbs.js +1 -2
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -2
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -2
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -2
- package/dist/pkt-checkbox-group.cjs +1 -1
- package/dist/pkt-checkbox-group.js +1 -2
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -2
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -2
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -2
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-fileupload.cjs +1 -1
- package/dist/pkt-fileupload.js +1 -2
- package/dist/pkt-footer.cjs +1 -1
- package/dist/pkt-footer.js +1 -2
- package/dist/pkt-header-menu.cjs +1 -1
- package/dist/pkt-header-menu.js +1 -2
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +1 -2
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +1 -2
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -2
- package/dist/pkt-icon.js +1 -2
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +37 -37
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -2
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -2
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -2
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +1 -2
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +1 -2
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -2
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -2
- package/dist/{pkt-options-controller-CHosj1Oo.js → pkt-options-controller-BikFfGcZ.js} +1 -1
- package/dist/{pkt-options-controller-139UsV4h.cjs → pkt-options-controller-D1sKTkbR.cjs} +1 -1
- package/dist/pkt-progressbar.js +1 -2
- package/dist/pkt-radio-group.cjs +1 -1
- package/dist/pkt-radio-group.js +1 -2
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -2
- package/dist/pkt-searchinput.js +1 -2
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -2
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +1 -2
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +1 -2
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -2
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -2
- package/dist/pkt-timepicker.cjs +1 -1
- package/dist/pkt-timepicker.js +1 -2
- package/dist/{progressbar-DZHiq7B0.js → progressbar-t0zgEke0.js} +5 -5
- package/dist/{radio-group-BmJ3kcba.js → radio-group-DJikniZi.js} +3 -3
- package/dist/{radio-group-Q75EtJzu.cjs → radio-group-XCYKqoLD.cjs} +1 -1
- package/dist/{radiobutton-DwDErNo5.cjs → radiobutton-DgkML7sd.cjs} +1 -1
- package/dist/{radiobutton-BK-V6Itu.js → radiobutton-PYQKVnNQ.js} +4 -4
- package/dist/{ref-y_5qv9vU.js → ref-D4OwQYdf.js} +2 -2
- package/dist/{repeat-CV9S4zya.js → repeat-BGbBqnfz.js} +2 -2
- package/dist/{scroll-lock-BALd8hF9.js → scroll-lock-CR-g54ai.js} +1 -1
- package/dist/{scroll-lock-B46ur0FF.cjs → scroll-lock-x0VxhKWZ.cjs} +1 -1
- package/dist/{searchinput-Bkcr3Fby.js → searchinput-BzYifHBf.js} +4 -4
- package/dist/{select-ByPSk9WT.js → select-CorofYxz.js} +21 -21
- package/dist/{select-CCY2_EbI.cjs → select-D8TC1msV.cjs} +14 -14
- package/dist/shared-types/icon.d.ts +2 -0
- package/dist/shared-types/index.d.ts +3 -1
- package/dist/shared-types/input-wrapper.d.ts +59 -0
- package/dist/{tabs-R1Jzzj3-.cjs → tabs-B63J6MXb.cjs} +2 -2
- package/dist/{tabs-DBW3P90Z.js → tabs-DDakCTkY.js} +7 -15
- package/dist/{tag-BMtnaJ1A.cjs → tag-6IPe9bwQ.cjs} +1 -1
- package/dist/{tag-uVXp7uP-.js → tag-BPvGZcKf.js} +5 -5
- package/dist/{textarea-DB7FMtTf.js → textarea-BZCUHjEj.js} +19 -19
- package/dist/{textarea-D9RWiR6u.cjs → textarea-BiCZBjOe.cjs} +10 -10
- package/dist/{textinput-l31MdBd4.cjs → textinput-BZPGcxZV.cjs} +12 -12
- package/dist/{textinput-Djl_yr1D.js → textinput-D_oEaI41.js} +19 -19
- package/dist/{timepicker-Bw8zkwV9.cjs → timepicker-C0d92R8u.cjs} +12 -12
- package/dist/{timepicker-D_gNCZ2v.js → timepicker-JBOeZg-7.js} +24 -32
- package/package.json +2 -2
- package/src/components/consent/consent.ts +2 -2
- package/src/components/index.ts +1 -0
- package/src/components/input-wrapper/index.ts +1 -0
- package/src/components/input-wrapper/input-wrapper.ts +36 -17
- package/src/components/input-wrapper/wrapper-parity.test.ts +4 -2
- package/dist/combobox-BsXDULXd.cjs +0 -139
- package/dist/converters-BJ9Fe0kW.cjs +0 -1
- package/dist/element-with-slot-CcJPCLgn.cjs +0 -1
- package/dist/input-wrapper-BEmV0DGo.cjs +0 -62
- package/dist/option-group-element-A2cOZRWA.cjs +0 -23
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { _ as e, d as t, l as n, n as r, u as i } from "./element-
|
|
2
|
-
import { n as a } from "./element-with-slot-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as l } from "./
|
|
6
|
-
import { t as u } from "./
|
|
7
|
-
import {
|
|
1
|
+
import { _ as e, d as t, l as n, n as r, u as i } from "./element-ckeMVgMz.js";
|
|
2
|
+
import { n as a } from "./element-with-slot-C0bH0T0H.js";
|
|
3
|
+
import { r as o } from "./input-wrapper-BSjQc4Vx.js";
|
|
4
|
+
import { t as s } from "./if-defined-D18nY_K_.js";
|
|
5
|
+
import { n as c, t as l } from "./ref-D4OwQYdf.js";
|
|
6
|
+
import { t as u } from "./input-element-0yYtRu0p.js";
|
|
7
|
+
import { t as d } from "./pkt-options-controller-BikFfGcZ.js";
|
|
8
8
|
//#region src/base-elements/options-input-element.ts
|
|
9
|
-
var f = class extends
|
|
9
|
+
var f = class extends u {
|
|
10
10
|
constructor(...e) {
|
|
11
11
|
super(...e), this._optionsProp = [], this._options = [];
|
|
12
12
|
}
|
|
@@ -44,7 +44,7 @@ r([i({
|
|
|
44
44
|
//#region src/components/select/select.ts
|
|
45
45
|
var p = class extends f {
|
|
46
46
|
constructor() {
|
|
47
|
-
super(), this.inputRef =
|
|
47
|
+
super(), this.inputRef = l(), this.value = "", this.selectedIndex = -1, this.selectedOptions = void 0, this.optionsController = new d(this);
|
|
48
48
|
}
|
|
49
49
|
connectedCallback() {
|
|
50
50
|
super.connectedCallback(), this.parseOptions(), this._options.forEach((e) => {
|
|
@@ -102,27 +102,27 @@ var p = class extends f {
|
|
|
102
102
|
?requiredTag=${this.requiredTag}
|
|
103
103
|
useWrapper=${this.useWrapper}
|
|
104
104
|
.ariaDescribedby=${this.ariaDescribedby}
|
|
105
|
-
errorMessage=${
|
|
105
|
+
errorMessage=${s(this.errorMessage)}
|
|
106
106
|
forId=${this.id + "-input"}
|
|
107
|
-
helptext=${
|
|
108
|
-
helptextDropdown=${
|
|
109
|
-
helptextDropdownButton=${
|
|
110
|
-
label=${
|
|
111
|
-
optionalText=${
|
|
112
|
-
requiredText=${
|
|
113
|
-
tagText=${
|
|
107
|
+
helptext=${s(this.helptext)}
|
|
108
|
+
helptextDropdown=${s(this.helptextDropdown)}
|
|
109
|
+
helptextDropdownButton=${s(this.helptextDropdownButton)}
|
|
110
|
+
label=${s(this.label)}
|
|
111
|
+
optionalText=${s(this.optionalText)}
|
|
112
|
+
requiredText=${s(this.requiredText)}
|
|
113
|
+
tagText=${s(this.tagText)}
|
|
114
114
|
>
|
|
115
115
|
<select
|
|
116
116
|
class=${t}
|
|
117
117
|
aria-invalid=${this.hasError}
|
|
118
|
-
aria-errormessage=${
|
|
119
|
-
aria-describedby=${o(
|
|
118
|
+
aria-errormessage=${s(this.hasError ? `${this.id}-input-error` : void 0)}
|
|
119
|
+
aria-describedby=${s(o({
|
|
120
120
|
id: this.id + "-input",
|
|
121
121
|
hasHelptext: !!this.helptext || this.hasSlotContent("helptext"),
|
|
122
122
|
hasCounter: !1,
|
|
123
123
|
ariaDescribedby: this.ariaDescribedby
|
|
124
124
|
}))}
|
|
125
|
-
aria-labelledby=${
|
|
125
|
+
aria-labelledby=${s(this.ariaLabelledby)}
|
|
126
126
|
?disabled=${this.isDisabled}
|
|
127
127
|
id=${this.id + "-input"}
|
|
128
128
|
name=${(this.name || this.id) + "-input"}
|
|
@@ -138,7 +138,7 @@ var p = class extends f {
|
|
|
138
138
|
@blur=${(e) => {
|
|
139
139
|
this.onBlur(), e.stopImmediatePropagation();
|
|
140
140
|
}}
|
|
141
|
-
${
|
|
141
|
+
${c(this.inputRef)}
|
|
142
142
|
>
|
|
143
143
|
${this._options.length > 0 ? this._options.map((t) => e`<option
|
|
144
144
|
value=${t.value}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-C6WTyJFE.cjs"),t=require("./element-with-slot-
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./element-with-slot-DkyaNnm0.cjs"),n=require("./input-wrapper-4PTk8aX3.cjs"),r=require("./if-defined-CiML3MTM.cjs"),i=require("./ref-CB7e9nMY.cjs"),a=require("./input-element-BOi7rBbw.cjs"),o=require("./pkt-options-controller-D1sKTkbR.cjs");var s=class extends a.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=i.t(),this.value=``,this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new o.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 a=`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}
|
|
@@ -11,22 +11,22 @@ const e=require("./element-C6WTyJFE.cjs"),t=require("./element-with-slot-CcJPCLg
|
|
|
11
11
|
?requiredTag=${this.requiredTag}
|
|
12
12
|
useWrapper=${this.useWrapper}
|
|
13
13
|
.ariaDescribedby=${this.ariaDescribedby}
|
|
14
|
-
errorMessage=${
|
|
14
|
+
errorMessage=${r.t(this.errorMessage)}
|
|
15
15
|
forId=${this.id+`-input`}
|
|
16
|
-
helptext=${
|
|
17
|
-
helptextDropdown=${
|
|
18
|
-
helptextDropdownButton=${
|
|
19
|
-
label=${
|
|
20
|
-
optionalText=${
|
|
21
|
-
requiredText=${
|
|
22
|
-
tagText=${
|
|
16
|
+
helptext=${r.t(this.helptext)}
|
|
17
|
+
helptextDropdown=${r.t(this.helptextDropdown)}
|
|
18
|
+
helptextDropdownButton=${r.t(this.helptextDropdownButton)}
|
|
19
|
+
label=${r.t(this.label)}
|
|
20
|
+
optionalText=${r.t(this.optionalText)}
|
|
21
|
+
requiredText=${r.t(this.requiredText)}
|
|
22
|
+
tagText=${r.t(this.tagText)}
|
|
23
23
|
>
|
|
24
24
|
<select
|
|
25
|
-
class=${
|
|
25
|
+
class=${a}
|
|
26
26
|
aria-invalid=${this.hasError}
|
|
27
|
-
aria-errormessage=${
|
|
28
|
-
aria-describedby=${
|
|
29
|
-
aria-labelledby=${
|
|
27
|
+
aria-errormessage=${r.t(this.hasError?`${this.id}-input-error`:void 0)}
|
|
28
|
+
aria-describedby=${r.t(n.r({id:this.id+`-input`,hasHelptext:!!this.helptext||this.hasSlotContent(`helptext`),hasCounter:!1,ariaDescribedby:this.ariaDescribedby}))}
|
|
29
|
+
aria-labelledby=${r.t(this.ariaLabelledby)}
|
|
30
30
|
?disabled=${this.isDisabled}
|
|
31
31
|
id=${this.id+`-input`}
|
|
32
32
|
name=${(this.name||this.id)+`-input`}
|
|
@@ -34,7 +34,7 @@ const e=require("./element-C6WTyJFE.cjs"),t=require("./element-with-slot-CcJPCLg
|
|
|
34
34
|
@input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
|
|
35
35
|
@focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
|
|
36
36
|
@blur=${e=>{this.onBlur(),e.stopImmediatePropagation()}}
|
|
37
|
-
${
|
|
37
|
+
${i.n(this.inputRef)}
|
|
38
38
|
>
|
|
39
39
|
${this._options.length>0?this._options.map(t=>e._`<option
|
|
40
40
|
value=${t.value}
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
import type { Booleanish } from './booleanish';
|
|
8
8
|
/** Default CDN path for icons. Overridden globally by `window.pktIconPath`. */
|
|
9
9
|
export declare const ICON_DEFAULT_PATH = "https://punkt-cdn.oslo.kommune.no/latest/icons/";
|
|
10
|
+
/** Default CDN path for loading animations. Overridden globally by `window.pktAnimationPath`. */
|
|
11
|
+
export declare const ANIMATION_DEFAULT_PATH = "https://punkt-cdn.oslo.kommune.no/latest/animations/";
|
|
10
12
|
/** Icon size modifier classes — shared runtime source for types, specs, and Preview. */
|
|
11
13
|
export declare const ICON_SIZE_CLASSES: readonly ['pkt-icon--small', 'pkt-icon--medium', 'pkt-icon--large'];
|
|
12
14
|
export type TIconSizeClass = (typeof ICON_SIZE_CLASSES)[number];
|
|
@@ -19,7 +19,7 @@ export { OPTION_GROUP_DEFAULTS } from './option-group';
|
|
|
19
19
|
export type { IPktOptionGroupBase, IPktRadioGroupBase, IPktCheckboxGroupBase, IRadioGroupSpecProps, ICheckboxGroupSpecProps, } from './option-group';
|
|
20
20
|
export { CONSENT_TRIGGER_TYPES, CONSENT_TRIGGER_TYPE_OPTIONS, CONSENT_DEFAULTS } from './consent';
|
|
21
21
|
export type { TPktConsentTriggerType, IConsentItem, IConsentValue, ICookieConsentEvent, TConsentDetailsMap, TCookieEventHandler, ICookieEvents, ICookieBannerApi, IPktConsentBase, IConsentSpecProps, } from './consent';
|
|
22
|
-
export { ICON_DEFAULT_PATH, ICON_SIZE_CLASSES, ICON_DEFAULTS } from './icon';
|
|
22
|
+
export { ANIMATION_DEFAULT_PATH, ICON_DEFAULT_PATH, ICON_SIZE_CLASSES, ICON_DEFAULTS } from './icon';
|
|
23
23
|
export type { TIconSizeClass, IPktIconBase, IIconSpecProps } from './icon';
|
|
24
24
|
export { LAYOUT_DIRECTIONS } from './layout';
|
|
25
25
|
export type { TLayout, TVerticalPosition, THorizontalPosition, TPosition, TPositionWithCenter, } from './layout';
|
|
@@ -38,6 +38,8 @@ export type { TBreadcrumbsNavigationType, IBreadcrumb, IBreadcrumbItem, IBreadcr
|
|
|
38
38
|
export type { IRenderLink, TRenderLink } from './render-link';
|
|
39
39
|
export type { IPktStringsProps } from '../shared-strings';
|
|
40
40
|
export type { IHelptextProps, ITagOptionalRequiredProps, IFormFieldLabelProps, IFormFieldErrorProps, IFormFieldCommonProps, TFormFieldCommonSpecKeys, } from './form-field';
|
|
41
|
+
export { COUNTER_POSITIONS, INPUT_WRAPPER_DEFAULTS } from './input-wrapper';
|
|
42
|
+
export type { TPktCounterPosition, IPktInputWrapperBase, IInputWrapperSpecProps, } from './input-wrapper';
|
|
41
43
|
export type { TTagSkin } from './skin';
|
|
42
44
|
export { MESSAGEBOX_SKINS, MESSAGEBOX_DEFAULTS } from './messagebox';
|
|
43
45
|
export type { TMessageboxSkin, IPktMessageboxBase, IMessageboxSpecProps } from './messagebox';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* input-wrapper.ts
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for pkt-input-wrapper.
|
|
5
|
+
* Used by React, Elements, and typed component specs.
|
|
6
|
+
*/
|
|
7
|
+
import type { IFormFieldCommonProps } from './form-field';
|
|
8
|
+
import type { TLayout } from './layout';
|
|
9
|
+
import type { TPktInputSize } from './size';
|
|
10
|
+
/**
|
|
11
|
+
* Counter placement relative to the wrapped field — shared runtime source for types, specs, and Preview.
|
|
12
|
+
*/
|
|
13
|
+
export declare const COUNTER_POSITIONS: readonly ['top', 'bottom'];
|
|
14
|
+
export type TPktCounterPosition = (typeof COUNTER_POSITIONS)[number];
|
|
15
|
+
/**
|
|
16
|
+
* Input wrapper props shared by React, Elements, and typed component specs.
|
|
17
|
+
*
|
|
18
|
+
* @remarks React requires `forId` and `label`, and widens `helptext`, `helptextDropdown` and
|
|
19
|
+
* `errorMessage` to `ReactNode`. Elements widens `helptext`, `helptextDropdown`,
|
|
20
|
+
* `helptextDropdownButton` and `role` to `| null` (Lit uses `null` for an unset attribute),
|
|
21
|
+
* and `useWrapper` to `Booleanish`.
|
|
22
|
+
*/
|
|
23
|
+
export interface IPktInputWrapperBase extends IFormFieldCommonProps<'forms' | 'validation'> {
|
|
24
|
+
forId?: string;
|
|
25
|
+
ariaDescribedby?: string;
|
|
26
|
+
counter?: boolean;
|
|
27
|
+
counterCurrent?: number;
|
|
28
|
+
counterMaxLength?: number;
|
|
29
|
+
counterPosition?: TPktCounterPosition;
|
|
30
|
+
inline?: boolean;
|
|
31
|
+
hasFieldset?: boolean;
|
|
32
|
+
layout?: TLayout;
|
|
33
|
+
useWrapper?: boolean;
|
|
34
|
+
role?: string;
|
|
35
|
+
size?: TPktInputSize;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Documented InputWrapper props (subset of `IPktInputWrapperBase`).
|
|
39
|
+
* Used for typed component specs in documentation.
|
|
40
|
+
*/
|
|
41
|
+
export type IInputWrapperSpecProps = Pick<IPktInputWrapperBase, 'forId' | 'label' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'ariaDescribedby' | 'counter' | 'counterCurrent' | 'counterMaxLength' | 'counterPosition' | 'optionalTag' | 'optionalText' | 'requiredTag' | 'requiredText' | 'tagText' | 'hasError' | 'errorMessage' | 'disabled' | 'inline' | 'hasFieldset' | 'layout' | 'useWrapper' | 'role' | 'size'>;
|
|
42
|
+
/**
|
|
43
|
+
* Default values for pkt-input-wrapper. Single source of truth for both frameworks.
|
|
44
|
+
* `forId` is intentionally absent — each instance generates its own id when unset.
|
|
45
|
+
*/
|
|
46
|
+
export declare const INPUT_WRAPPER_DEFAULTS: {
|
|
47
|
+
readonly counter: false;
|
|
48
|
+
readonly counterCurrent: 0;
|
|
49
|
+
readonly counterPosition: 'bottom';
|
|
50
|
+
readonly optionalTag: false;
|
|
51
|
+
readonly requiredTag: false;
|
|
52
|
+
readonly hasError: false;
|
|
53
|
+
readonly disabled: false;
|
|
54
|
+
readonly inline: false;
|
|
55
|
+
readonly hasFieldset: false;
|
|
56
|
+
readonly layout: 'vertical';
|
|
57
|
+
readonly useWrapper: true;
|
|
58
|
+
readonly size: 'medium';
|
|
59
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const e=require("./element-C6WTyJFE.cjs"),t=require("./element-with-slot-
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./element-with-slot-DkyaNnm0.cjs"),n=require("./if-defined-CiML3MTM.cjs"),r=require("./consume-kEjgTrAp.cjs"),i=require("./provide-Cz18sYug.cjs"),a=require("./ref-CB7e9nMY.cjs");require("./tag-6IPe9bwQ.cjs");var o=r.n(Symbol(`pkt-tabs-context`)),s=class extends t.t{constructor(...e){super(...e),this.arrowNav=!0,this.disableArrowNav=!1,this.separatorIconName=``,this.separatorIconPath=``,this.tabRefs=[],this.disabledMap={},this.tabCount=0,this.context={useArrowNav:this.useArrowNav,registerTab:this.registerTab.bind(this),handleClick:this.handleClick.bind(this),handleKeyUp:this.handleKeyUp.bind(this)}}get useArrowNav(){return this.arrowNav&&!this.disableArrowNav}willUpdate(e){(e.has(`arrowNav`)||e.has(`disableArrowNav`))&&(this.context={...this.context,useArrowNav:this.useArrowNav})}updated(){this.updateComplete.then(()=>this.syncSeparators())}syncSeparators(){let e=this.querySelector(`.pkt-tabs__list`);if(!e||(e.querySelectorAll(`.pkt-tabs__separator`).forEach(e=>e.remove()),!(this.separatorIconName||this.separatorIconPath)))return;let t=Array.from(e.children).filter(e=>!e.classList.contains(`pkt-tabs__separator`));for(let e=0;e<t.length-1;e++){let n=document.createElement(`span`);if(n.className=`pkt-tabs__separator`,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`role`,`presentation`),this.separatorIconPath){let e=document.createElement(`img`);e.setAttribute(`src`,this.separatorIconPath),e.setAttribute(`alt`,``),e.setAttribute(`aria-hidden`,`true`),n.appendChild(e)}else if(this.separatorIconName){let e=document.createElement(`pkt-icon`);e.setAttribute(`name`,this.separatorIconName),e.classList.add(`pkt-tabs__separator-icon`),n.appendChild(e)}t[e].after(n)}}registerTab(e,t,n=!1){this.tabRefs[t]=e,this.disabledMap[t]=n,this.tabCount=Math.max(this.tabCount,t+1)}isTabDisabled(e){return!!this.disabledMap[e]}findEnabledIndex(e,t){let n=e+t;for(;n>=0&&n<this.tabCount;){if(!this.isTabDisabled(n))return n;n+=t}return null}handleClick(e){this.isTabDisabled(e)||this.dispatchEvent(new CustomEvent(`tab-selected`,{detail:{index:e},bubbles:!0,composed:!0}))}handleKeyUp(e,t){if(this.useArrowNav){if(e.key===`ArrowLeft`){e.preventDefault();let n=this.findEnabledIndex(t,-1);n!==null&&this.tabRefs[n]?.focus()}if(e.key===`ArrowRight`){e.preventDefault();let n=this.findEnabledIndex(t,1);n!==null&&this.tabRefs[n]?.focus()}(e.key===`Enter`||e.key===` `||e.key===`Spacebar`||e.key===`ArrowDown`)&&(e.preventDefault(),this.handleClick(t))}}render(){let n=this.useArrowNav?`tablist`:`navigation`,r=this.separatorIconName||this.separatorIconPath?`pkt-tabs pkt-tabs--with-separator`:`pkt-tabs`;return e._`
|
|
2
2
|
<div class=${r}>
|
|
3
3
|
<div class="pkt-tabs__list" role=${n}>${t.i(this)}</div>
|
|
4
4
|
</div>
|
|
5
|
-
`}};e.n([e.u({type:Boolean,reflect:!0,attribute:`arrow-nav`})],s.prototype,`arrowNav`,void 0),e.n([e.u({type:Boolean,reflect:!0,attribute:`disable-arrow-nav`})],s.prototype,`disableArrowNav`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`separator-icon-name`})],s.prototype,`separatorIconName`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`separator-icon-path`})],s.prototype,`separatorIconPath`,void 0),e.n([e.l()],s.prototype,`tabRefs`,void 0),e.n([e.l()],s.prototype,`disabledMap`,void 0),e.n([e.l()],s.prototype,`tabCount`,void 0),e.n([i.t({context:o}),e.l()],s.prototype,`context`,void 0);try{e.d(`pkt-tabs`)(s)}catch{console.warn(`Forsøker å definere <pkt-tabs>, men den er allerede definert`)}var c=class extends t.t{constructor(){super(),this.active=!1,this.disabled=!1,this.href=``,this.icon=``,this.controls=``,this.tag=``,this.tagSkin=`blue`,this.index=0,this.elementRef=a.t()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)})}updated(){this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)}handleClick(e){
|
|
5
|
+
`}};e.n([e.u({type:Boolean,reflect:!0,attribute:`arrow-nav`})],s.prototype,`arrowNav`,void 0),e.n([e.u({type:Boolean,reflect:!0,attribute:`disable-arrow-nav`})],s.prototype,`disableArrowNav`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`separator-icon-name`})],s.prototype,`separatorIconName`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`separator-icon-path`})],s.prototype,`separatorIconPath`,void 0),e.n([e.l()],s.prototype,`tabRefs`,void 0),e.n([e.l()],s.prototype,`disabledMap`,void 0),e.n([e.l()],s.prototype,`tabCount`,void 0),e.n([i.t({context:o}),e.l()],s.prototype,`context`,void 0);try{e.d(`pkt-tabs`)(s)}catch{console.warn(`Forsøker å definere <pkt-tabs>, men den er allerede definert`)}var c=class extends t.t{constructor(){super(),this.active=!1,this.disabled=!1,this.href=``,this.icon=``,this.controls=``,this.tag=``,this.tagSkin=`blue`,this.index=0,this.elementRef=a.t()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)})}updated(){this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)}handleClick(e){this.disabled?(e.preventDefault(),e.stopPropagation()):this.context&&this.context.handleClick(this.index)}handleKeyDown(e){this.disabled&&(e.key===`Enter`||e.key===` `||e.key===`Spacebar`)?(e.preventDefault(),e.stopPropagation()):this.context&&this.context.handleKeyUp(e,this.index)}render(){let r=this.context?.useArrowNav??!0,i=this.active&&!this.disabled,o=[i?`active`:``,this.disabled?`pkt-tabs__item--disabled`:``].filter(Boolean).join(` `),s=r?`tab`:void 0,c=r?i:void 0,l=this.disabled?-1:i||!r?void 0:-1,u=`pkt-icon--small ${this.icon===`check`?`pkt-tabs__status-icon`:``}`,d=e._`
|
|
6
6
|
${this.icon?e._`<pkt-icon name=${this.icon} class=${u}></pkt-icon>`:``}
|
|
7
7
|
<span>${t.i(this)}</span>
|
|
8
8
|
${this.tag?e._`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>`:``}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { _ as e, d as t, l as n, n as r, u as i } from "./element-
|
|
2
|
-
import { i as a, t as o } from "./element-with-slot-
|
|
3
|
-
import { t as s } from "./if-defined-
|
|
1
|
+
import { _ as e, d as t, l as n, n as r, u as i } from "./element-ckeMVgMz.js";
|
|
2
|
+
import { i as a, t as o } from "./element-with-slot-C0bH0T0H.js";
|
|
3
|
+
import { t as s } from "./if-defined-D18nY_K_.js";
|
|
4
4
|
import { n as c, t as l } from "./consume-Bp12si68.js";
|
|
5
5
|
import { t as u } from "./provide-_MnlMGnw.js";
|
|
6
|
-
import { n as d, t as f } from "./ref-
|
|
7
|
-
import "./tag-
|
|
6
|
+
import { n as d, t as f } from "./ref-D4OwQYdf.js";
|
|
7
|
+
import "./tag-BPvGZcKf.js";
|
|
8
8
|
//#region src/components/tabs/tabs-context.ts
|
|
9
9
|
var p = c(Symbol("pkt-tabs-context")), m = class extends o {
|
|
10
10
|
constructor(...e) {
|
|
@@ -125,18 +125,10 @@ var h = class extends o {
|
|
|
125
125
|
this.elementRef.value && this.context && this.context.registerTab(this.elementRef.value, this.index, this.disabled);
|
|
126
126
|
}
|
|
127
127
|
handleClick(e) {
|
|
128
|
-
|
|
129
|
-
e.preventDefault(), e.stopPropagation();
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
this.context && this.context.handleClick(this.index);
|
|
128
|
+
this.disabled ? (e.preventDefault(), e.stopPropagation()) : this.context && this.context.handleClick(this.index);
|
|
133
129
|
}
|
|
134
130
|
handleKeyDown(e) {
|
|
135
|
-
|
|
136
|
-
e.preventDefault(), e.stopPropagation();
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
this.context && this.context.handleKeyUp(e, this.index);
|
|
131
|
+
this.disabled && (e.key === "Enter" || e.key === " " || e.key === "Spacebar") ? (e.preventDefault(), e.stopPropagation()) : this.context && this.context.handleKeyUp(e, this.index);
|
|
140
132
|
}
|
|
141
133
|
render() {
|
|
142
134
|
let t = this.context?.useArrowNav ?? !0, n = this.active && !this.disabled, r = [n ? "active" : "", this.disabled ? "pkt-tabs__item--disabled" : ""].filter(Boolean).join(" "), i = t ? "tab" : void 0, o = t ? n : void 0, c = this.disabled ? -1 : n || !t ? void 0 : -1, l = `pkt-icon--small ${this.icon === "check" ? "pkt-tabs__status-icon" : ""}`, u = e`
|
|
@@ -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-
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-DkyaNnm0.cjs");require("./icon-jPhyZD1z.cjs");const i=require("./if-defined-CiML3MTM.cjs");var a={name:`pkt-tag`,react:`PktTag`,"css-class":`pkt-tag`,isElement:!0,"dark-mode":!0,props:{size:{name:`Størrelse`,description:`Størrelsen på taggen`,required:!1,default:`medium`,type:[`small`,`medium`,`large`],category:`ui`},iconName:{name:`Ikon`,description:`Navnet på ikonet som skal vises i taggen`,type:`icon`,required:!1,category:`ui`},skin:{name:`Utseende`,description:`Utseendet til taggen`,required:!1,default:`blue`,type:[`blue`,`blue-light`,`blue-dark`,`green`,`red`,`beige`,`yellow`,`gray`],category:`ui`},closeTag:{name:`Lukk tag`,description:`Skal taggen ha en lukkeknapp?`,type:`boolean`,required:!1,default:!1,category:`ui`},textStyle:{name:`Tekststil`,description:`Stilen på teksten i taggen`,required:!1,default:`normal-text`,type:[`thin-text`,`normal-text`],category:`ui`},type:{name:`Type, dersom lukkeknapp`,description:`Type tag, brukes for å spesifisere om det er en knapp, submit eller reset`,required:!1,default:`button`,type:[`button`,`submit`,`reset`],category:`tech`},ariaLabel:{name:`aria-label`,description:`aria-label for taggen, brukes for tilgjengelighet`,type:`string`,required:!1,category:`accessibility`}},slots:{default:{description:`Teksten til tag`}}},o=class extends r.t{constructor(){super(),this.closeTag=a.props.closeTag.default,this.size=a.props.size.default,this.skin=a.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=a.props.type.default,this.ariaLabel=null,this.buttonTabindex=void 0,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent(`close`,{detail:{origin:e},bubbles:!1,composed:!0})),this.dispatchEvent(new CustomEvent(`on-close`,{detail:{origin:e},bubbles:!1,composed:!0}))},this._isClosed=!1}willUpdate(e){if(super.willUpdate(e),this.closeTag&&!this.ariaLabel){let e=r.r(this).getNodes().map(e=>e.textContent??``).join(``).trim();e&&(this._ariaDescription=n.t(this.pktStrings.get(`tag`).remove,{label:e}))}}render(){let n={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},a={"pkt-tag":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-hide":this._isClosed};return this.closeTag?e._`
|
|
2
2
|
<button
|
|
3
3
|
class=${t.t(a)}
|
|
4
4
|
type=${this.type}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { _ as e, d as t, l as n, n as r, u as i } from "./element-
|
|
2
|
-
import { t as a } from "./class-map-
|
|
1
|
+
import { _ as e, d as t, l as n, n as r, u as i } from "./element-ckeMVgMz.js";
|
|
2
|
+
import { t as a } from "./class-map-BkEYw5uE.js";
|
|
3
3
|
import { t as o } from "./format-BTeSVkED.js";
|
|
4
|
-
import { i as s, r as c, t as l } from "./element-with-slot-
|
|
5
|
-
import "./icon-
|
|
6
|
-
import { t as u } from "./if-defined-
|
|
4
|
+
import { i as s, r as c, t as l } from "./element-with-slot-C0bH0T0H.js";
|
|
5
|
+
import "./icon-CLMJYuTL.js";
|
|
6
|
+
import { t as u } from "./if-defined-D18nY_K_.js";
|
|
7
7
|
var d = {
|
|
8
8
|
name: "pkt-tag",
|
|
9
9
|
react: "PktTag",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { _ as e, d as t, f as n, g as r, h as i, l as a, m as o, n as s, p as c, u as l } from "./element-
|
|
2
|
-
import { t as u } from "./class-map-
|
|
3
|
-
import { i as d, r as f } from "./directive-helpers-
|
|
4
|
-
import { n as p } from "./element-with-slot-
|
|
5
|
-
import "./icon-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as _ } from "./
|
|
9
|
-
import {
|
|
1
|
+
import { _ as e, d as t, f as n, g as r, h as i, l as a, m as o, n as s, p as c, u as l } from "./element-ckeMVgMz.js";
|
|
2
|
+
import { t as u } from "./class-map-BkEYw5uE.js";
|
|
3
|
+
import { i as d, r as f } from "./directive-helpers-BAinC437.js";
|
|
4
|
+
import { n as p } from "./element-with-slot-C0bH0T0H.js";
|
|
5
|
+
import "./icon-CLMJYuTL.js";
|
|
6
|
+
import { r as m } from "./input-wrapper-BSjQc4Vx.js";
|
|
7
|
+
import { t as h } from "./if-defined-D18nY_K_.js";
|
|
8
|
+
import { n as g, t as _ } from "./ref-D4OwQYdf.js";
|
|
9
|
+
import { t as v } from "./input-element-0yYtRu0p.js";
|
|
10
10
|
//#region ../../node_modules/lit-html/directives/live.js
|
|
11
11
|
var y = n(class extends c {
|
|
12
12
|
constructor(e) {
|
|
@@ -26,9 +26,9 @@ var y = n(class extends c {
|
|
|
26
26
|
} else if (e.type === o.ATTRIBUTE && n.getAttribute(a) === t + "") return r;
|
|
27
27
|
return f(e), t;
|
|
28
28
|
}
|
|
29
|
-
}), b = class extends
|
|
29
|
+
}), b = class extends v {
|
|
30
30
|
constructor(...e) {
|
|
31
|
-
super(...e), this.inputRef =
|
|
31
|
+
super(...e), this.inputRef = _(), this.value = "", this.autocomplete = "off", this.rows = null, this.cols = null, this.counterCurrent = 0;
|
|
32
32
|
}
|
|
33
33
|
attributeChangedCallback(e, t, n) {
|
|
34
34
|
e === "value" && this.value !== t && (this.counterCurrent = n ? n.length : 0), super.attributeChangedCallback(e, t, n);
|
|
@@ -73,27 +73,27 @@ var y = n(class extends c {
|
|
|
73
73
|
.size=${this.inputSize}
|
|
74
74
|
>
|
|
75
75
|
<textarea
|
|
76
|
-
${
|
|
76
|
+
${g(this.inputRef)}
|
|
77
77
|
class=${n}
|
|
78
78
|
id=${this.id + "-input"}
|
|
79
79
|
name=${(this.name || this.id) + "-input"}
|
|
80
|
-
placeholder=${
|
|
80
|
+
placeholder=${h(this.placeholder)}
|
|
81
81
|
.value=${y(this.value)}
|
|
82
|
-
minlength=${
|
|
83
|
-
maxlength=${
|
|
82
|
+
minlength=${h(this.minlength)}
|
|
83
|
+
maxlength=${h(this.maxlength)}
|
|
84
84
|
?readonly=${this.readonly}
|
|
85
85
|
autocomplete=${this.autocomplete}
|
|
86
86
|
aria-labelledby=${r}
|
|
87
87
|
aria-invalid=${this.hasError}
|
|
88
|
-
aria-errormessage=${
|
|
89
|
-
aria-describedby=${m(
|
|
88
|
+
aria-errormessage=${h(this.hasError ? `${this.id}-input-error` : void 0)}
|
|
89
|
+
aria-describedby=${h(m({
|
|
90
90
|
id: this.id + "-input",
|
|
91
91
|
hasHelptext: !!this.helptext || this.hasSlotContent("helptext"),
|
|
92
92
|
hasCounter: t,
|
|
93
93
|
ariaDescribedby: this.ariaDescribedby
|
|
94
94
|
}))}
|
|
95
|
-
rows=${
|
|
96
|
-
cols=${
|
|
95
|
+
rows=${h(this.rows ?? void 0)}
|
|
96
|
+
cols=${h(this.cols ?? void 0)}
|
|
97
97
|
?disabled=${this.isDisabled}
|
|
98
98
|
@input=${(e) => {
|
|
99
99
|
this.value = e.target.value, this.onInput(), e.stopImmediatePropagation();
|
|
@@ -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-
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./directive-helpers-Bv70GjQh.cjs"),r=require("./element-with-slot-DkyaNnm0.cjs");require("./icon-jPhyZD1z.cjs");const i=require("./input-wrapper-4PTk8aX3.cjs"),a=require("./if-defined-CiML3MTM.cjs"),o=require("./ref-CB7e9nMY.cjs"),s=require("./input-element-BOi7rBbw.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 s.t{constructor(...e){super(...e),this.inputRef=o.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),s=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}
|
|
@@ -25,22 +25,22 @@ const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),
|
|
|
25
25
|
.size=${this.inputSize}
|
|
26
26
|
>
|
|
27
27
|
<textarea
|
|
28
|
-
${
|
|
29
|
-
class=${
|
|
28
|
+
${o.n(this.inputRef)}
|
|
29
|
+
class=${s}
|
|
30
30
|
id=${this.id+`-input`}
|
|
31
31
|
name=${(this.name||this.id)+`-input`}
|
|
32
|
-
placeholder=${
|
|
32
|
+
placeholder=${a.t(this.placeholder)}
|
|
33
33
|
.value=${c(this.value)}
|
|
34
|
-
minlength=${
|
|
35
|
-
maxlength=${
|
|
34
|
+
minlength=${a.t(this.minlength)}
|
|
35
|
+
maxlength=${a.t(this.maxlength)}
|
|
36
36
|
?readonly=${this.readonly}
|
|
37
37
|
autocomplete=${this.autocomplete}
|
|
38
38
|
aria-labelledby=${l}
|
|
39
39
|
aria-invalid=${this.hasError}
|
|
40
|
-
aria-errormessage=${
|
|
41
|
-
aria-describedby=${
|
|
42
|
-
rows=${
|
|
43
|
-
cols=${
|
|
40
|
+
aria-errormessage=${a.t(this.hasError?`${this.id}-input-error`:void 0)}
|
|
41
|
+
aria-describedby=${a.t(i.r({id:this.id+`-input`,hasHelptext:!!this.helptext||this.hasSlotContent(`helptext`),hasCounter:n,ariaDescribedby:this.ariaDescribedby}))}
|
|
42
|
+
rows=${a.t(this.rows??void 0)}
|
|
43
|
+
cols=${a.t(this.cols??void 0)}
|
|
44
44
|
?disabled=${this.isDisabled}
|
|
45
45
|
@input=${e=>{this.value=e.target.value,this.onInput(),e.stopImmediatePropagation()}}
|
|
46
46
|
@change=${e=>{e.stopImmediatePropagation()}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./element-with-slot-
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./element-with-slot-DkyaNnm0.cjs");require("./icon-jPhyZD1z.cjs");const r=require("./input-wrapper-4PTk8aX3.cjs"),i=require("./if-defined-CiML3MTM.cjs"),a=require("./ref-CB7e9nMY.cjs"),o=require("./input-element-BOi7rBbw.cjs");var s=class extends o.t{constructor(...e){super(...e),this.inputRef=a.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 o=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}
|
|
@@ -28,26 +28,26 @@ const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),
|
|
|
28
28
|
<div class=${`pkt-input__container pkt-input__container--${this.inputSize}`}>
|
|
29
29
|
${this.prefix?e._`<div class="pkt-input-prefix">${this.prefix}</div>`:e.h}
|
|
30
30
|
<input
|
|
31
|
-
${
|
|
31
|
+
${a.n(this.inputRef)}
|
|
32
32
|
class=${c}
|
|
33
33
|
type=${this.type}
|
|
34
34
|
name=${(this.name||this.id)+`-input`}
|
|
35
35
|
id=${this.id+`-input`}
|
|
36
|
-
placeholder=${
|
|
36
|
+
placeholder=${i.t(this.placeholder)}
|
|
37
37
|
aria-labelledby=${l}
|
|
38
38
|
autocomplete=${this.autocomplete||`off`}
|
|
39
|
-
minlength=${
|
|
40
|
-
maxlength=${
|
|
41
|
-
min=${
|
|
42
|
-
max=${
|
|
43
|
-
step=${
|
|
39
|
+
minlength=${i.t(this.minlength||void 0)}
|
|
40
|
+
maxlength=${i.t(this.maxlength||void 0)}
|
|
41
|
+
min=${i.t(this.min||void 0)}
|
|
42
|
+
max=${i.t(this.max||void 0)}
|
|
43
|
+
step=${i.t(this.step||void 0)}
|
|
44
44
|
?readonly=${this.readonly}
|
|
45
45
|
size=${this.size||e.h}
|
|
46
46
|
.value=${this.value}
|
|
47
47
|
?disabled=${this.isDisabled}
|
|
48
48
|
aria-invalid=${this.hasError}
|
|
49
|
-
aria-errormessage=${
|
|
50
|
-
aria-describedby=${
|
|
49
|
+
aria-errormessage=${i.t(this.hasError?`${this.id}-input-error`:void 0)}
|
|
50
|
+
aria-describedby=${i.t(r.r({id:this.id+`-input`,hasHelptext:!!this.helptext||this.hasSlotContent(`helptext`),hasCounter:s,ariaDescribedby:this.ariaDescribedby}))}
|
|
51
51
|
@input=${e=>{this.value=e.target.value,this.onInput(),e.stopImmediatePropagation()}}
|
|
52
52
|
@change=${e=>{e.stopImmediatePropagation()}}
|
|
53
53
|
@focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
|
|
@@ -60,13 +60,13 @@ const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),
|
|
|
60
60
|
class="pkt-input-suffix-icon"
|
|
61
61
|
name=${this.iconNameRight}
|
|
62
62
|
></pkt-icon>`:e.h}
|
|
63
|
-
${
|
|
63
|
+
${o?e._`<pkt-icon
|
|
64
64
|
class="pkt-input-suffix-icon"
|
|
65
65
|
name="magnifying-glass-big"
|
|
66
66
|
></pkt-icon>`:e.h}
|
|
67
67
|
</div>`:e.h}
|
|
68
68
|
${!this.suffix&&this.iconNameRight?e._`<pkt-icon class="pkt-input-icon" name=${this.iconNameRight}></pkt-icon>`:e.h}
|
|
69
|
-
${!this.suffix&&
|
|
69
|
+
${!this.suffix&&o?e._`<pkt-icon class="pkt-input-icon" name="magnifying-glass-big"></pkt-icon>`:e.h}
|
|
70
70
|
</div>
|
|
71
71
|
</pkt-input-wrapper>
|
|
72
72
|
`}};e.n([e.u({type:String,reflect:!0})],s.prototype,`value`,void 0),e.n([e.u({type:String})],s.prototype,`type`,void 0),e.n([e.u({type:Number})],s.prototype,`size`,void 0),e.n([e.u({type:String})],s.prototype,`autocomplete`,void 0),e.n([e.u({type:String})],s.prototype,`iconNameRight`,void 0),e.n([e.u({type:String})],s.prototype,`prefix`,void 0),e.n([e.u({type:String})],s.prototype,`suffix`,void 0),e.n([e.u({type:Boolean})],s.prototype,`omitSearchIcon`,void 0),e.n([e.l()],s.prototype,`counterCurrent`,void 0);try{e.d(`pkt-textinput`)(s)}catch{console.warn(`Forsøker å definere <pkt-textinput>, 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}});
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { _ as e, d as t, h as n, l as r, n as i, u as a } from "./element-
|
|
2
|
-
import { t as o } from "./class-map-
|
|
3
|
-
import { n as s } from "./element-with-slot-
|
|
4
|
-
import "./icon-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { t as d } from "./
|
|
8
|
-
import {
|
|
1
|
+
import { _ as e, d as t, h as n, l as r, n as i, u as a } from "./element-ckeMVgMz.js";
|
|
2
|
+
import { t as o } from "./class-map-BkEYw5uE.js";
|
|
3
|
+
import { n as s } from "./element-with-slot-C0bH0T0H.js";
|
|
4
|
+
import "./icon-CLMJYuTL.js";
|
|
5
|
+
import { r as c } from "./input-wrapper-BSjQc4Vx.js";
|
|
6
|
+
import { t as l } from "./if-defined-D18nY_K_.js";
|
|
7
|
+
import { n as u, t as d } from "./ref-D4OwQYdf.js";
|
|
8
|
+
import { t as f } from "./input-element-0yYtRu0p.js";
|
|
9
9
|
//#region src/components/textinput/textinput.ts
|
|
10
|
-
var p = class extends
|
|
10
|
+
var p = class extends f {
|
|
11
11
|
constructor(...e) {
|
|
12
|
-
super(...e), this.inputRef =
|
|
12
|
+
super(...e), this.inputRef = d(), 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;
|
|
13
13
|
}
|
|
14
14
|
attributeChangedCallback(e, t, n) {
|
|
15
15
|
e === "value" && this.value !== t && (this.counterCurrent = n ? n.length : 0), super.attributeChangedCallback(e, t, n);
|
|
@@ -57,26 +57,26 @@ var p = class extends d {
|
|
|
57
57
|
<div class=${`pkt-input__container pkt-input__container--${this.inputSize}`}>
|
|
58
58
|
${this.prefix ? e`<div class="pkt-input-prefix">${this.prefix}</div>` : n}
|
|
59
59
|
<input
|
|
60
|
-
${
|
|
60
|
+
${u(this.inputRef)}
|
|
61
61
|
class=${i}
|
|
62
62
|
type=${this.type}
|
|
63
63
|
name=${(this.name || this.id) + "-input"}
|
|
64
64
|
id=${this.id + "-input"}
|
|
65
|
-
placeholder=${
|
|
65
|
+
placeholder=${l(this.placeholder)}
|
|
66
66
|
aria-labelledby=${a}
|
|
67
67
|
autocomplete=${this.autocomplete || "off"}
|
|
68
|
-
minlength=${
|
|
69
|
-
maxlength=${
|
|
70
|
-
min=${
|
|
71
|
-
max=${
|
|
72
|
-
step=${
|
|
68
|
+
minlength=${l(this.minlength || void 0)}
|
|
69
|
+
maxlength=${l(this.maxlength || void 0)}
|
|
70
|
+
min=${l(this.min || void 0)}
|
|
71
|
+
max=${l(this.max || void 0)}
|
|
72
|
+
step=${l(this.step || void 0)}
|
|
73
73
|
?readonly=${this.readonly}
|
|
74
74
|
size=${this.size || n}
|
|
75
75
|
.value=${this.value}
|
|
76
76
|
?disabled=${this.isDisabled}
|
|
77
77
|
aria-invalid=${this.hasError}
|
|
78
|
-
aria-errormessage=${
|
|
79
|
-
aria-describedby=${c(
|
|
78
|
+
aria-errormessage=${l(this.hasError ? `${this.id}-input-error` : void 0)}
|
|
79
|
+
aria-describedby=${l(c({
|
|
80
80
|
id: this.id + "-input",
|
|
81
81
|
hasHelptext: !!this.helptext || this.hasSlotContent("helptext"),
|
|
82
82
|
hasCounter: r,
|