@oslokommune/punkt-elements 16.7.1 → 16.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/accordionitem-_9AiCIvd.cjs +34 -0
- package/dist/{accordionitem-ZlaXvjt5.js → accordionitem-dCfSrxh5.js} +57 -55
- package/dist/alert-BtOk8yRH.cjs +33 -0
- package/dist/{alert-BuAXrnKl.js → alert-DlY2_grU.js} +48 -46
- package/dist/backlink-Ce5Vldop.js +49 -0
- package/dist/backlink-y3dwjKPC.cjs +13 -0
- package/dist/button-B_TXwNzt.cjs +27 -0
- package/dist/{button-DEyvt1LI.js → button-BiY-wlKF.js} +79 -77
- package/dist/calendar-B2pji2zn.cjs +90 -0
- package/dist/{calendar-S63oreVW.js → calendar-DhjQDC4C.js} +689 -687
- package/dist/card-BwMNB5Bb.cjs +87 -0
- package/dist/{card-DDiLfuO4.js → card-CGlmcMSR.js} +99 -97
- package/dist/checkbox-BsJZYA26.js +147 -0
- package/dist/checkbox-CTY8f_qn.cjs +31 -0
- package/dist/{combobox-BmxSecfE.js → combobox-DSB5WOxg.js} +223 -226
- package/dist/{combobox-Hb2V-fPX.cjs → combobox-DbICIgKG.cjs} +4 -4
- package/dist/consent-DkOQpbsg.cjs +11 -0
- package/dist/{consent-iXyx5v6J.js → consent-SNWV_mMU.js} +48 -46
- package/dist/datepicker-BEWl9iz3.cjs +273 -0
- package/dist/{datepicker-CZl7b8Na.js → datepicker-euHyzXnb.js} +341 -329
- package/dist/{heading-CKt7cVn7.js → heading-D2tVS6lS.js} +30 -28
- package/dist/heading-DrzbgDb6.cjs +1 -0
- package/dist/helptext-BKtU4mas.js +82 -0
- package/dist/helptext-DcRC7wW2.cjs +24 -0
- package/dist/icon-CxQcIa5F.js +105 -0
- package/dist/icon-q81vqPK_.cjs +9 -0
- package/dist/input-wrapper-Bs4CRNst.js +181 -0
- package/dist/input-wrapper-Bv9aqqVq.cjs +54 -0
- package/dist/link-C0rl-86s.cjs +7 -0
- package/dist/link-Cdqgl60z.js +55 -0
- package/dist/linkcard-Dimu7Rlx.cjs +13 -0
- package/dist/linkcard-Lbq_UhjZ.js +56 -0
- package/dist/{listbox-BQKDZvZn.js → listbox-Bia4_tvN.js} +131 -129
- package/dist/listbox-La2GZQei.cjs +106 -0
- package/dist/loader-D1ugDXGV.cjs +16 -0
- package/dist/{loader-Ci3CHU8k.js → loader-DyN6RGC5.js} +51 -49
- package/dist/messagebox-BGMVm2t9.js +71 -0
- package/dist/messagebox-M0yIgCz9.cjs +13 -0
- package/dist/modal-CMO1RtIi.cjs +36 -0
- package/dist/{modal-DzGe1g8Z.js → modal-DjPQDE-Z.js} +53 -51
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +2 -2
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +3 -4
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +2 -3
- package/dist/pkt-breadcrumbs.cjs +11 -11
- package/dist/pkt-breadcrumbs.js +30 -28
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +3 -4
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +2 -3
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +2 -3
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +3 -4
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +3 -4
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +2 -3
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +7 -8
- package/dist/pkt-header.cjs +35 -35
- package/dist/pkt-header.js +224 -218
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +3 -4
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +3 -4
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +3 -4
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +26 -26
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +2 -3
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +2 -3
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +3 -4
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +3 -4
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +3 -4
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +3 -4
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +3 -4
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -3
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +3 -4
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +3 -4
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +2 -2
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +3 -4
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +3 -4
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +3 -4
- package/dist/pkt-timepicker.cjs +16 -16
- package/dist/pkt-timepicker.js +91 -89
- package/dist/progressbar-BqlMzkM_.cjs +21 -0
- package/dist/{progressbar-By7e0lEI.js → progressbar-sbHDFC12.js} +88 -88
- package/dist/radiobutton-5ZqVVtTT.cjs +31 -0
- package/dist/{radiobutton-6frNG9J_.js → radiobutton-D8Ai8ETa.js} +44 -42
- package/dist/select-De-n8on9.js +230 -0
- package/dist/select-dTWibR6_.cjs +49 -0
- package/dist/tabitem-B9-jeV97.js +334 -0
- package/dist/tabitem-BnhzqfW3.cjs +65 -0
- package/dist/tag-CbwO8yvD.cjs +27 -0
- package/dist/{tag-BuCpqaks.js → tag-D4FI5t3y.js} +42 -40
- package/dist/textarea-BmLaKzsc.cjs +50 -0
- package/dist/{textarea-Bzuymclz.js → textarea-CMiSJaYL.js} +62 -60
- package/dist/textinput-em9y4yrL.cjs +70 -0
- package/dist/{textinput-9lHjs4ce.js → textinput-r8udK0IX.js} +57 -55
- package/package.json +2 -2
- package/src/components/accordion/accordion.ts +6 -1
- package/src/components/accordion/accordionitem.ts +6 -1
- package/src/components/alert/alert.ts +6 -1
- package/src/components/backlink/backlink.ts +6 -1
- package/src/components/breadcrumbs/breadcrumbs.ts +6 -1
- package/src/components/button/button.ts +6 -1
- package/src/components/calendar/calendar.ts +6 -1
- package/src/components/card/card.ts +6 -1
- package/src/components/checkbox/checkbox.ts +6 -1
- package/src/components/combobox/combobox.ts +6 -1
- package/src/components/consent/consent.ts +6 -1
- package/src/components/datepicker/date-tags.ts +6 -1
- package/src/components/datepicker/datepicker-multiple.ts +6 -1
- package/src/components/datepicker/datepicker-popup.ts +6 -1
- package/src/components/datepicker/datepicker-range.ts +6 -1
- package/src/components/datepicker/datepicker-single.ts +6 -1
- package/src/components/datepicker/datepicker.ts +6 -1
- package/src/components/header/header-service.ts +6 -1
- package/src/components/header/header-user-menu.ts +6 -1
- package/src/components/header/header.ts +6 -1
- package/src/components/heading/heading.ts +6 -1
- package/src/components/helptext/helptext.ts +6 -1
- package/src/components/icon/icon.ts +6 -1
- package/src/components/input-wrapper/input-wrapper.ts +6 -1
- package/src/components/link/link.ts +6 -1
- package/src/components/linkcard/linkcard.ts +6 -1
- package/src/components/listbox/listbox.ts +6 -1
- package/src/components/loader/loader.ts +6 -1
- package/src/components/messagebox/messagebox.ts +6 -1
- package/src/components/modal/modal.ts +6 -1
- package/src/components/progressbar/progressbar.ts +6 -1
- package/src/components/radiobutton/radiobutton.ts +6 -1
- package/src/components/select/select.ts +6 -1
- package/src/components/tabs/tabitem.ts +6 -1
- package/src/components/tabs/tabs.ts +6 -1
- package/src/components/tag/tag.ts +6 -1
- package/src/components/textarea/textarea.ts +6 -1
- package/src/components/textinput/textinput.ts +6 -1
- package/src/components/timepicker/timepicker.ts +6 -1
- package/dist/accordionitem-D1Agl1bB.cjs +0 -34
- package/dist/alert-DFkFNTxh.cjs +0 -33
- package/dist/backlink-EiAXUUZP.cjs +0 -13
- package/dist/backlink-V4DAt17e.js +0 -47
- package/dist/button-DYv5Dg4M.cjs +0 -27
- package/dist/calendar-HIE9nxcc.cjs +0 -90
- package/dist/card-CyeH6l1c.cjs +0 -87
- package/dist/checkbox-BLlwTABj.cjs +0 -31
- package/dist/checkbox-ejBUa5qQ.js +0 -145
- package/dist/consent-ruWAEVXW.cjs +0 -11
- package/dist/datepicker-D2H7U6MS.cjs +0 -273
- package/dist/heading-Cvz8m1xL.cjs +0 -1
- package/dist/helptext-5Mzp65-F.cjs +0 -24
- package/dist/helptext-jIoWRcCF.js +0 -80
- package/dist/icon-BlKA8YuW.js +0 -103
- package/dist/icon-Bqj9oBbl.cjs +0 -9
- package/dist/input-wrapper-B0MkQ0IZ.cjs +0 -54
- package/dist/input-wrapper-B2JpK016.js +0 -179
- package/dist/link-R_lNhViF.cjs +0 -7
- package/dist/link-Z_GizclR.js +0 -53
- package/dist/linkcard-BlQvdB1a.js +0 -54
- package/dist/linkcard-C7HbSLlX.cjs +0 -13
- package/dist/listbox-CGgV9MAe.cjs +0 -106
- package/dist/loader-e2gs_1xz.cjs +0 -16
- package/dist/messagebox-Bf-XMlvW.js +0 -69
- package/dist/messagebox-D67w71VX.cjs +0 -13
- package/dist/modal-CyvEkbfQ.cjs +0 -36
- package/dist/progressbar-DsJ2B9Vm.cjs +0 -21
- package/dist/radiobutton-Bv-BZ1Hw.cjs +0 -31
- package/dist/select-CXZt1nHS.js +0 -228
- package/dist/select-WFhS4Vfp.cjs +0 -49
- package/dist/tabitem-CB8wkKmv.js +0 -332
- package/dist/tabitem-DZpspU4Q.cjs +0 -65
- package/dist/tag-X6xdjR0N.cjs +0 -27
- package/dist/textarea-DoeHJ7HR.cjs +0 -50
- package/dist/textinput-BNsLd26i.cjs +0 -70
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";const p=require("./element-with-slot-ZX-up7jO.cjs"),a=require("./element-gR_VtSiD.cjs"),x=require("./state-Dg-53wQ8.cjs"),v=require("./ref-CL-Xk9Xm.cjs"),l=require("./if-defined-BOW3ODSj.cjs");/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/let m=class extends Event{constructor(t,e,r,s){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=s??!1}};/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2021 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
*//**
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright 2021 Google LLC
|
|
12
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
+
*/let g=class{constructor(t,e,r,s){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,i)=>{this.unsubscribe&&(this.unsubscribe!==i&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(o,i)),this.unsubscribe=i},this.host=t,e.context!==void 0){const o=e;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=s??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new m(this.context,this.host,this.t,this.subscribe))}};/**
|
|
14
|
+
* @license
|
|
15
|
+
* Copyright 2021 Google LLC
|
|
16
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
+
*/class C{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){const r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(const[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});const{disposer:s}=this.subscriptions.get(t);t(this.value,s)}clearCallbacks(){this.subscriptions.clear()}}/**
|
|
18
|
+
* @license
|
|
19
|
+
* Copyright 2021 Google LLC
|
|
20
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
21
|
+
*/let $=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}};class w extends C{constructor(t,e,r){var s,o;super(e.context!==void 0?e.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;const c=i.contextTarget??i.composedPath()[0];c!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,c,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;const c=new Set;for(const[f,{consumerHost:k}]of this.subscriptions)c.has(f)||(c.add(f),k.dispatchEvent(new m(this.context,k,f,!0)));i.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(o=(s=this.host).addController)==null||o.call(s,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new $(this.context,this.host))}}/**
|
|
22
|
+
* @license
|
|
23
|
+
* Copyright 2017 Google LLC
|
|
24
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
+
*/function N({context:n}){return(t,e)=>{const r=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(s){return r.get(this).setValue(s),t.set.call(this,s)},init(s){return r.set(this,new w(this,{context:n,initialValue:s})),s}};{t.constructor.addInitializer((i=>{r.set(i,new w(i,{context:n}))}));const s=Object.getOwnPropertyDescriptor(t,e);let o;if(s===void 0){const i=new WeakMap;o={get(){return i.get(this)},set(c){r.get(this).setValue(c),i.set(this,c)},configurable:!0,enumerable:!0}}else{const i=s.set;o={...s,set(c){r.get(this).setValue(c),i==null||i.call(this,c)}}}return void Object.defineProperty(t,e,o)}}}/**
|
|
26
|
+
* @license
|
|
27
|
+
* Copyright 2022 Google LLC
|
|
28
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
29
|
+
*/function P({context:n,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer((function(){new g(this,{context:n,callback:s=>{e.set.call(this,s)},subscribe:t})})):e.constructor.addInitializer((s=>{new g(s,{context:n,callback:o=>{s[r]=o},subscribe:t})}))}}const y=Symbol("pkt-tabs-context");var R=Object.defineProperty,d=(n,t,e,r)=>{for(var s=void 0,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=i(t,e,s)||s);return s&&R(t,e,s),s};class b extends p.PktElementWithSlot{constructor(){super(...arguments),this.arrowNav=!0,this.disableArrowNav=!1,this.tabRefs=[],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}updated(t){(t.has("arrowNav")||t.has("disableArrowNav"))&&(this.context={...this.context,useArrowNav:this.useArrowNav})}registerTab(t,e){this.tabRefs[e]=t,this.tabCount=Math.max(this.tabCount,e+1)}handleClick(t){this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:t},bubbles:!0,composed:!0}))}handleKeyUp(t,e){var r,s;this.useArrowNav&&(t.code==="ArrowLeft"&&e!==0&&((r=this.tabRefs[e-1])==null||r.focus()),t.code==="ArrowRight"&&e<this.tabCount-1&&((s=this.tabRefs[e+1])==null||s.focus()),(t.code==="ArrowDown"||t.code==="Space")&&this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:e},bubbles:!0,composed:!0})))}render(){const t=this.useArrowNav?"tablist":"navigation";return a.b`
|
|
30
|
+
<div class="pkt-tabs">
|
|
31
|
+
<div class="pkt-tabs__list" role=${t}>${p.slotContent(this)}</div>
|
|
32
|
+
</div>
|
|
33
|
+
`}}d([a.n({type:Boolean,reflect:!0,attribute:"arrow-nav"})],b.prototype,"arrowNav");d([a.n({type:Boolean,reflect:!0,attribute:"disable-arrow-nav"})],b.prototype,"disableArrowNav");d([x.r()],b.prototype,"tabRefs");d([x.r()],b.prototype,"tabCount");d([N({context:y}),x.r()],b.prototype,"context");try{a.t("pkt-tabs")(b)}catch{console.warn("Forsøker å definere <pkt-tabs>, men den er allerede definert")}var A=Object.defineProperty,u=(n,t,e,r)=>{for(var s=void 0,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=i(t,e,s)||s);return s&&A(t,e,s),s};class h extends p.PktElementWithSlot{constructor(){super(),this.active=!1,this.href="",this.icon="",this.controls="",this.tag="",this.tagSkin="blue",this.index=0,this.elementRef=v.e()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index)})}handleClick(){this.context&&this.context.handleClick(this.index)}handleKeyUp(t){this.context&&this.context.handleKeyUp(t,this.index)}render(){var c;const t=((c=this.context)==null?void 0:c.useArrowNav)??!0,e=this.active?"active":"",r=t?"tab":void 0,s=t?this.active:void 0,o=this.active||!t?void 0:-1,i=a.b`
|
|
34
|
+
${this.icon?a.b`<pkt-icon name=${this.icon} class="pkt-icon--small"></pkt-icon>`:""}
|
|
35
|
+
<span>${p.slotContent(this)}</span>
|
|
36
|
+
${this.tag?a.b`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>`:""}
|
|
37
|
+
`;return this.href?a.b`
|
|
38
|
+
<a
|
|
39
|
+
${v.n(this.elementRef)}
|
|
40
|
+
href=${this.href}
|
|
41
|
+
class="pkt-tabs__link ${e}"
|
|
42
|
+
role=${l.o(r)}
|
|
43
|
+
aria-selected=${l.o(s)}
|
|
44
|
+
aria-controls=${l.o(this.controls||void 0)}
|
|
45
|
+
tabindex=${l.o(o)}
|
|
46
|
+
@click=${this.handleClick}
|
|
47
|
+
@keyup=${this.handleKeyUp}
|
|
48
|
+
>
|
|
49
|
+
${i}
|
|
50
|
+
</a>
|
|
51
|
+
`:a.b`
|
|
52
|
+
<button
|
|
53
|
+
${v.n(this.elementRef)}
|
|
54
|
+
type="button"
|
|
55
|
+
class="pkt-tabs__button pkt-link-button ${e}"
|
|
56
|
+
role=${l.o(r)}
|
|
57
|
+
aria-selected=${l.o(s)}
|
|
58
|
+
aria-controls=${l.o(this.controls||void 0)}
|
|
59
|
+
tabindex=${l.o(o)}
|
|
60
|
+
@click=${this.handleClick}
|
|
61
|
+
@keyup=${this.handleKeyUp}
|
|
62
|
+
>
|
|
63
|
+
${i}
|
|
64
|
+
</button>
|
|
65
|
+
`}}u([a.n({type:Boolean,reflect:!0})],h.prototype,"active");u([a.n({type:String,reflect:!0})],h.prototype,"href");u([a.n({type:String,reflect:!0})],h.prototype,"icon");u([a.n({type:String,reflect:!0})],h.prototype,"controls");u([a.n({type:String,reflect:!0})],h.prototype,"tag");u([a.n({type:String,reflect:!0,attribute:"tag-skin"})],h.prototype,"tagSkin");u([a.n({type:Number,reflect:!0})],h.prototype,"index");u([P({context:y,subscribe:!0}),a.n({attribute:!1})],h.prototype,"context");try{a.t("pkt-tab-item")(h)}catch{console.warn("Forsøker å definere <pkt-tab-item>, men den er allerede definert")}exports.PktTabItem=h;exports.PktTabs=b;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";const d=require("./class-map-CsENJXf1.cjs"),t=require("./element-gR_VtSiD.cjs"),k=require("./state-Dg-53wQ8.cjs"),c=require("./element-with-slot-ZX-up7jO.cjs");require("./icon-q81vqPK_.cjs");const h=require("./if-defined-BOW3ODSj.cjs"),b={size:{default:"medium"},skin:{default:"blue"},closeTag:{default:!1},type:{default:"button"}},r={props:b};var f=Object.defineProperty,s=(o,i,a,p)=>{for(var n=void 0,l=o.length-1,u;l>=0;l--)(u=o[l])&&(n=u(i,a,n)||n);return n&&f(i,a,n),n};class e extends c.PktElementWithSlot{constructor(){super(),this.closeTag=r.props.closeTag.default,this.size=r.props.size.default,this.skin=r.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=r.props.type.default,this.ariaLabel=null,this.buttonTabindex=void 0,this._isClosed=!1,this._ariaDescription=null,this.close=i=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:i},bubbles:!1,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:i},bubbles:!1,composed:!0}))},this._isClosed=!1}firstUpdated(i){var a,p;if(super.firstUpdated(i),this.closeTag&&!this.ariaLabel){const n=(p=(a=this.querySelector("button span, .pkt-tag > span"))==null?void 0:a.textContent)==null?void 0:p.trim();n&&(this._ariaDescription=`Klikk for å fjerne ${n}`)}}render(){const i={"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-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName,"pkt-hide":this._isClosed};return this.closeTag?t.b`
|
|
2
|
+
<button
|
|
3
|
+
class=${d.e(a)}
|
|
4
|
+
type=${this.type}
|
|
5
|
+
tabindex=${h.o(this.buttonTabindex)}
|
|
6
|
+
@click=${this.close}
|
|
7
|
+
aria-label=${h.o(this.ariaLabel||void 0)}
|
|
8
|
+
aria-description=${h.o(this._ariaDescription||void 0)}
|
|
9
|
+
>
|
|
10
|
+
${this.iconName&&t.b`<pkt-icon
|
|
11
|
+
class="pkt-tag__icon"
|
|
12
|
+
name=${this.iconName}
|
|
13
|
+
aria-hidden="true"
|
|
14
|
+
></pkt-icon>`}
|
|
15
|
+
<span>${c.slotContent(this)}</span>
|
|
16
|
+
<pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
|
|
17
|
+
</button>
|
|
18
|
+
`:t.b`
|
|
19
|
+
<span class=${d.e(i)}>
|
|
20
|
+
${this.iconName&&t.b`<pkt-icon
|
|
21
|
+
class="pkt-tag__icon"
|
|
22
|
+
name=${this.iconName}
|
|
23
|
+
aria-hidden="true"
|
|
24
|
+
></pkt-icon>`}
|
|
25
|
+
<span>${c.slotContent(this)}</span>
|
|
26
|
+
</span>
|
|
27
|
+
`}}s([t.n({type:Boolean,reflect:!0})],e.prototype,"closeTag");s([t.n({type:String,reflect:!0})],e.prototype,"size");s([t.n({type:String,reflect:!0})],e.prototype,"skin");s([t.n({type:String,reflect:!0})],e.prototype,"textStyle");s([t.n({type:String,reflect:!0})],e.prototype,"iconName");s([t.n({type:String})],e.prototype,"type");s([t.n({type:String})],e.prototype,"ariaLabel");s([t.n({type:Number,attribute:"button-tabindex"})],e.prototype,"buttonTabindex");s([k.r()],e.prototype,"_isClosed");s([k.r()],e.prototype,"_ariaDescription");try{t.t("pkt-tag")(e)}catch{console.warn("Forsøker å definere <pkt-tag>, men den er allerede definert")}exports.PktTag=e;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { e as
|
|
2
|
-
import {
|
|
3
|
-
import { r as
|
|
4
|
-
import { P as
|
|
5
|
-
import "./icon-
|
|
6
|
-
import { o as
|
|
7
|
-
const g = { size: { default: "medium" }, skin: { default: "blue" }, closeTag: { default: !1 }, type: { default: "button" } },
|
|
1
|
+
import { e as u } from "./class-map-CEnykyO_.js";
|
|
2
|
+
import { t as b, b as n, n as o } from "./element-CPpT3rFQ.js";
|
|
3
|
+
import { r as k } from "./state-C_1EOo3D.js";
|
|
4
|
+
import { P as y, s as f } from "./element-with-slot-Dqk6-TRR.js";
|
|
5
|
+
import "./icon-CxQcIa5F.js";
|
|
6
|
+
import { o as h } from "./if-defined-B0krMLad.js";
|
|
7
|
+
const g = { size: { default: "medium" }, skin: { default: "blue" }, closeTag: { default: !1 }, type: { default: "button" } }, p = {
|
|
8
8
|
props: g
|
|
9
9
|
};
|
|
10
|
-
var m = Object.defineProperty,
|
|
11
|
-
for (var
|
|
12
|
-
(
|
|
13
|
-
return
|
|
10
|
+
var m = Object.defineProperty, e = (r, s, a, l) => {
|
|
11
|
+
for (var i = void 0, c = r.length - 1, d; c >= 0; c--)
|
|
12
|
+
(d = r[c]) && (i = d(s, a, i) || i);
|
|
13
|
+
return i && m(s, a, i), i;
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
class t extends y {
|
|
16
16
|
constructor() {
|
|
17
|
-
super(), this.closeTag =
|
|
17
|
+
super(), this.closeTag = p.props.closeTag.default, this.size = p.props.size.default, this.skin = p.props.skin.default, this.textStyle = null, this.iconName = void 0, this.type = p.props.type.default, this.ariaLabel = null, this.buttonTabindex = void 0, this._isClosed = !1, this._ariaDescription = null, this.close = (s) => {
|
|
18
18
|
this._isClosed = !0, this.dispatchEvent(
|
|
19
19
|
new CustomEvent("close", { detail: { origin: s }, bubbles: !1, composed: !0 })
|
|
20
20
|
), this.dispatchEvent(
|
|
@@ -26,10 +26,10 @@ let t = class extends k {
|
|
|
26
26
|
* Lifecycle
|
|
27
27
|
*/
|
|
28
28
|
firstUpdated(s) {
|
|
29
|
-
var
|
|
29
|
+
var a, l;
|
|
30
30
|
if (super.firstUpdated(s), this.closeTag && !this.ariaLabel) {
|
|
31
|
-
const
|
|
32
|
-
|
|
31
|
+
const i = (l = (a = this.querySelector("button span, .pkt-tag > span")) == null ? void 0 : a.textContent) == null ? void 0 : l.trim();
|
|
32
|
+
i && (this._ariaDescription = `Klikk for å fjerne ${i}`);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
render() {
|
|
@@ -38,7 +38,7 @@ let t = class extends k {
|
|
|
38
38
|
[`pkt-tag--${this.size}`]: !!this.size,
|
|
39
39
|
[`pkt-tag--${this.skin}`]: !!this.skin,
|
|
40
40
|
[`pkt-tag--${this.textStyle}`]: !!this.textStyle
|
|
41
|
-
},
|
|
41
|
+
}, a = {
|
|
42
42
|
"pkt-tag": !0,
|
|
43
43
|
"pkt-btn": !0,
|
|
44
44
|
"pkt-btn--tertiary": !0,
|
|
@@ -50,66 +50,68 @@ let t = class extends k {
|
|
|
50
50
|
};
|
|
51
51
|
return this.closeTag ? n`
|
|
52
52
|
<button
|
|
53
|
-
class=${
|
|
53
|
+
class=${u(a)}
|
|
54
54
|
type=${this.type}
|
|
55
|
-
tabindex=${
|
|
55
|
+
tabindex=${h(this.buttonTabindex)}
|
|
56
56
|
@click=${this.close}
|
|
57
|
-
aria-label=${
|
|
58
|
-
aria-description=${
|
|
57
|
+
aria-label=${h(this.ariaLabel || void 0)}
|
|
58
|
+
aria-description=${h(this._ariaDescription || void 0)}
|
|
59
59
|
>
|
|
60
60
|
${this.iconName && n`<pkt-icon
|
|
61
61
|
class="pkt-tag__icon"
|
|
62
62
|
name=${this.iconName}
|
|
63
63
|
aria-hidden="true"
|
|
64
64
|
></pkt-icon>`}
|
|
65
|
-
<span>${
|
|
65
|
+
<span>${f(this)}</span>
|
|
66
66
|
<pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
|
|
67
67
|
</button>
|
|
68
68
|
` : n`
|
|
69
|
-
<span class=${
|
|
69
|
+
<span class=${u(s)}>
|
|
70
70
|
${this.iconName && n`<pkt-icon
|
|
71
71
|
class="pkt-tag__icon"
|
|
72
72
|
name=${this.iconName}
|
|
73
73
|
aria-hidden="true"
|
|
74
74
|
></pkt-icon>`}
|
|
75
|
-
<span>${
|
|
75
|
+
<span>${f(this)}</span>
|
|
76
76
|
</span>
|
|
77
77
|
`;
|
|
78
78
|
}
|
|
79
|
-
}
|
|
79
|
+
}
|
|
80
80
|
e([
|
|
81
81
|
o({ type: Boolean, reflect: !0 })
|
|
82
|
-
], t.prototype, "closeTag"
|
|
82
|
+
], t.prototype, "closeTag");
|
|
83
83
|
e([
|
|
84
84
|
o({ type: String, reflect: !0 })
|
|
85
|
-
], t.prototype, "size"
|
|
85
|
+
], t.prototype, "size");
|
|
86
86
|
e([
|
|
87
87
|
o({ type: String, reflect: !0 })
|
|
88
|
-
], t.prototype, "skin"
|
|
88
|
+
], t.prototype, "skin");
|
|
89
89
|
e([
|
|
90
90
|
o({ type: String, reflect: !0 })
|
|
91
|
-
], t.prototype, "textStyle"
|
|
91
|
+
], t.prototype, "textStyle");
|
|
92
92
|
e([
|
|
93
93
|
o({ type: String, reflect: !0 })
|
|
94
|
-
], t.prototype, "iconName"
|
|
94
|
+
], t.prototype, "iconName");
|
|
95
95
|
e([
|
|
96
96
|
o({ type: String })
|
|
97
|
-
], t.prototype, "type"
|
|
97
|
+
], t.prototype, "type");
|
|
98
98
|
e([
|
|
99
99
|
o({ type: String })
|
|
100
|
-
], t.prototype, "ariaLabel"
|
|
100
|
+
], t.prototype, "ariaLabel");
|
|
101
101
|
e([
|
|
102
102
|
o({ type: Number, attribute: "button-tabindex" })
|
|
103
|
-
], t.prototype, "buttonTabindex"
|
|
103
|
+
], t.prototype, "buttonTabindex");
|
|
104
104
|
e([
|
|
105
|
-
|
|
106
|
-
], t.prototype, "_isClosed"
|
|
105
|
+
k()
|
|
106
|
+
], t.prototype, "_isClosed");
|
|
107
107
|
e([
|
|
108
|
-
|
|
109
|
-
], t.prototype, "_ariaDescription"
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
k()
|
|
109
|
+
], t.prototype, "_ariaDescription");
|
|
110
|
+
try {
|
|
111
|
+
b("pkt-tag")(t);
|
|
112
|
+
} catch {
|
|
113
|
+
console.warn("Forsøker å definere <pkt-tag>, men den er allerede definert");
|
|
114
|
+
}
|
|
113
115
|
export {
|
|
114
116
|
t as P
|
|
115
117
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";const n=require("./element-gR_VtSiD.cjs"),h=require("./if-defined-BOW3ODSj.cjs"),$=require("./state-Dg-53wQ8.cjs"),d=require("./ref-CL-Xk9Xm.cjs"),g=require("./class-map-CsENJXf1.cjs"),s=require("./directive-C7oCP5Bh.cjs"),c=require("./directive-helpers-BP2WOx60.cjs"),f=require("./input-element-DdVhUvva.cjs"),x=require("./element-with-slot-ZX-up7jO.cjs");require("./input-wrapper-Bv9aqqVq.cjs");require("./icon-q81vqPK_.cjs");/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/const m=s.e(class extends s.i{constructor(t){if(super(t),t.type!==s.t.PROPERTY&&t.type!==s.t.ATTRIBUTE&&t.type!==s.t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!c.r(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===n.E||e===n.A)return e;const i=t.element,r=t.name;if(t.type===s.t.PROPERTY){if(e===i[r])return n.E}else if(t.type===s.t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(r))return n.E}else if(t.type===s.t.ATTRIBUTE&&i.getAttribute(r)===e+"")return n.E;return c.p(t),e}});var v=Object.defineProperty,l=(t,e,i,r)=>{for(var a=void 0,u=t.length-1,p;u>=0;u--)(p=t[u])&&(a=p(e,i,a)||a);return a&&v(e,i,a),a};class o extends f.PktInputElement{constructor(){super(...arguments),this.inputRef=d.e(),this.value="",this.autocomplete="off",this.rows=null,this.counterCurrent=0}attributeChangedCallback(e,i,r){e==="value"&&this.value!==i&&(this.counterCurrent=r?r.length:0,this.valueChanged(r,i)),super.attributeChangedCallback(e,i,r)}updated(e){var i;super.updated(e),e.has("value")&&(this.counterCurrent=((i=this.value)==null?void 0:i.length)||0,this.valueChanged(this.value,e.get("value"))),e.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const e=g.e({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),i=this.ariaLabelledby||`${this.id}-input-label`;return n.b`<pkt-input-wrapper
|
|
6
|
+
label=${this.label}
|
|
7
|
+
?counter=${this.counter}
|
|
8
|
+
?disabled=${this.disabled}
|
|
9
|
+
?hasError=${this.hasError}
|
|
10
|
+
?inline=${this.inline}
|
|
11
|
+
?optionalTag=${this.optionalTag}
|
|
12
|
+
?required=${this.required}
|
|
13
|
+
?requiredTag=${this.requiredTag}
|
|
14
|
+
useWrapper=${this.useWrapper}
|
|
15
|
+
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
16
|
+
.counterCurrent=${this.counterCurrent}
|
|
17
|
+
.counterMaxLength=${this.counterMaxLength}
|
|
18
|
+
.errorMessage=${this.errorMessage}
|
|
19
|
+
.forId="${this.id+"-input"}"
|
|
20
|
+
.helptext=${this.helptext}
|
|
21
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
22
|
+
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
23
|
+
.optionalText=${this.optionalText}
|
|
24
|
+
.requiredText=${this.requiredText}
|
|
25
|
+
.tagText=${this.tagText}
|
|
26
|
+
class="pkt-textarea"
|
|
27
|
+
>
|
|
28
|
+
<div class="pkt-contents" slot="helptext">${x.slotContent(this,"helptext")}</div>
|
|
29
|
+
<textarea
|
|
30
|
+
${d.n(this.inputRef)}
|
|
31
|
+
class=${e}
|
|
32
|
+
id=${this.id+"-input"}
|
|
33
|
+
name=${(this.name||this.id)+"-input"}
|
|
34
|
+
placeholder=${h.o(this.placeholder)}
|
|
35
|
+
.value=${m(this.value)}
|
|
36
|
+
minlength=${h.o(this.minlength)}
|
|
37
|
+
maxlength=${h.o(this.maxlength)}
|
|
38
|
+
?readonly=${this.readonly}
|
|
39
|
+
autocomplete=${this.autocomplete}
|
|
40
|
+
aria-labelledby=${i}
|
|
41
|
+
aria-invalid=${this.hasError}
|
|
42
|
+
aria-errormessage=${`${this.id}-error`}
|
|
43
|
+
rows=${this.rows}
|
|
44
|
+
?disabled=${this.disabled}
|
|
45
|
+
@input=${r=>{this.value=r.target.value,this.onInput(),r.stopImmediatePropagation()}}
|
|
46
|
+
@change=${r=>{r.stopImmediatePropagation()}}
|
|
47
|
+
@focus=${r=>{this.onFocus(),r.stopImmediatePropagation()}}
|
|
48
|
+
@blur=${r=>{this.value=r.target.value,this.onBlur(),r.stopImmediatePropagation()}}
|
|
49
|
+
></textarea>
|
|
50
|
+
</pkt-input-wrapper>`}}l([n.n({type:String,reflect:!0})],o.prototype,"value");l([n.n({type:String})],o.prototype,"autocomplete");l([n.n({type:Number})],o.prototype,"rows");l([$.r()],o.prototype,"counterCurrent");try{n.t("pkt-textarea")(o)}catch{console.warn("Forsøker å definere <pkt-textarea>, men den er allerede definert")}exports.PktTextarea=o;
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
import { o as
|
|
1
|
+
import { E as o, A as c, t as m, b as g, n as u } from "./element-CPpT3rFQ.js";
|
|
2
|
+
import { o as p } from "./if-defined-B0krMLad.js";
|
|
3
3
|
import { r as $ } from "./state-C_1EOo3D.js";
|
|
4
4
|
import { e as f, n as x } from "./ref-Bg_Swj5w.js";
|
|
5
5
|
import { e as v } from "./class-map-CEnykyO_.js";
|
|
6
|
-
import { e as b, i as T, t as
|
|
6
|
+
import { e as b, i as T, t as s } from "./directive-oAbCiebi.js";
|
|
7
7
|
import { r as y, p as w } from "./directive-helpers-rm-28gIj.js";
|
|
8
8
|
import { P as C } from "./input-element-8nLwuQS4.js";
|
|
9
9
|
import { s as E } from "./element-with-slot-Dqk6-TRR.js";
|
|
10
|
-
import "./input-wrapper-
|
|
11
|
-
import "./icon-
|
|
10
|
+
import "./input-wrapper-Bs4CRNst.js";
|
|
11
|
+
import "./icon-CxQcIa5F.js";
|
|
12
12
|
/**
|
|
13
13
|
* @license
|
|
14
14
|
* Copyright 2020 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
const
|
|
18
|
-
constructor(
|
|
19
|
-
if (super(
|
|
20
|
-
if (!y(
|
|
17
|
+
const k = b(class extends T {
|
|
18
|
+
constructor(e) {
|
|
19
|
+
if (super(e), e.type !== s.PROPERTY && e.type !== s.ATTRIBUTE && e.type !== s.BOOLEAN_ATTRIBUTE) throw Error("The `live` directive is not allowed on child or event bindings");
|
|
20
|
+
if (!y(e)) throw Error("`live` bindings can only contain a single expression");
|
|
21
21
|
}
|
|
22
|
-
render(
|
|
23
|
-
return
|
|
22
|
+
render(e) {
|
|
23
|
+
return e;
|
|
24
24
|
}
|
|
25
|
-
update(
|
|
26
|
-
if (
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
if (
|
|
30
|
-
} else if (
|
|
31
|
-
if (!!
|
|
32
|
-
} else if (
|
|
33
|
-
return w(
|
|
25
|
+
update(e, [t]) {
|
|
26
|
+
if (t === o || t === c) return t;
|
|
27
|
+
const i = e.element, r = e.name;
|
|
28
|
+
if (e.type === s.PROPERTY) {
|
|
29
|
+
if (t === i[r]) return o;
|
|
30
|
+
} else if (e.type === s.BOOLEAN_ATTRIBUTE) {
|
|
31
|
+
if (!!t === i.hasAttribute(r)) return o;
|
|
32
|
+
} else if (e.type === s.ATTRIBUTE && i.getAttribute(r) === t + "") return o;
|
|
33
|
+
return w(e), t;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
-
var B = Object.defineProperty,
|
|
37
|
-
for (var
|
|
38
|
-
(
|
|
39
|
-
return
|
|
36
|
+
var B = Object.defineProperty, l = (e, t, i, r) => {
|
|
37
|
+
for (var a = void 0, h = e.length - 1, d; h >= 0; h--)
|
|
38
|
+
(d = e[h]) && (a = d(t, i, a) || a);
|
|
39
|
+
return a && B(t, i, a), a;
|
|
40
40
|
};
|
|
41
|
-
|
|
41
|
+
class n extends C {
|
|
42
42
|
constructor() {
|
|
43
43
|
super(...arguments), this.inputRef = f(), this.value = "", this.autocomplete = "off", this.rows = null, this.counterCurrent = 0;
|
|
44
44
|
}
|
|
45
|
-
attributeChangedCallback(t,
|
|
46
|
-
t === "value" && this.value !==
|
|
45
|
+
attributeChangedCallback(t, i, r) {
|
|
46
|
+
t === "value" && this.value !== i && (this.counterCurrent = r ? r.length : 0, this.valueChanged(r, i)), super.attributeChangedCallback(t, i, r);
|
|
47
47
|
}
|
|
48
48
|
updated(t) {
|
|
49
|
-
var
|
|
50
|
-
super.updated(t), t.has("value") && (this.counterCurrent = ((
|
|
49
|
+
var i;
|
|
50
|
+
super.updated(t), t.has("value") && (this.counterCurrent = ((i = this.value) == null ? void 0 : i.length) || 0, this.valueChanged(this.value, t.get("value"))), t.has("id") && !this.name && this.id && (this.name = this.id);
|
|
51
51
|
}
|
|
52
52
|
render() {
|
|
53
53
|
const t = v({
|
|
54
54
|
"pkt-input": !0,
|
|
55
55
|
"pkt-input--fullwidth": this.fullwidth,
|
|
56
56
|
"pkt-input--counter-error": this.counter && this.counterMaxLength && this.value.length && this.value.length > this.counterMaxLength
|
|
57
|
-
}),
|
|
58
|
-
return
|
|
57
|
+
}), i = this.ariaLabelledby || `${this.id}-input-label`;
|
|
58
|
+
return g`<pkt-input-wrapper
|
|
59
59
|
label=${this.label}
|
|
60
60
|
?counter=${this.counter}
|
|
61
61
|
?disabled=${this.disabled}
|
|
@@ -84,48 +84,50 @@ let o = class extends C {
|
|
|
84
84
|
class=${t}
|
|
85
85
|
id=${this.id + "-input"}
|
|
86
86
|
name=${(this.name || this.id) + "-input"}
|
|
87
|
-
placeholder=${
|
|
88
|
-
.value=${
|
|
89
|
-
minlength=${
|
|
90
|
-
maxlength=${
|
|
87
|
+
placeholder=${p(this.placeholder)}
|
|
88
|
+
.value=${k(this.value)}
|
|
89
|
+
minlength=${p(this.minlength)}
|
|
90
|
+
maxlength=${p(this.maxlength)}
|
|
91
91
|
?readonly=${this.readonly}
|
|
92
92
|
autocomplete=${this.autocomplete}
|
|
93
|
-
aria-labelledby=${
|
|
93
|
+
aria-labelledby=${i}
|
|
94
94
|
aria-invalid=${this.hasError}
|
|
95
95
|
aria-errormessage=${`${this.id}-error`}
|
|
96
96
|
rows=${this.rows}
|
|
97
97
|
?disabled=${this.disabled}
|
|
98
|
-
@input=${(
|
|
99
|
-
this.value =
|
|
98
|
+
@input=${(r) => {
|
|
99
|
+
this.value = r.target.value, this.onInput(), r.stopImmediatePropagation();
|
|
100
100
|
}}
|
|
101
|
-
@change=${(
|
|
102
|
-
|
|
101
|
+
@change=${(r) => {
|
|
102
|
+
r.stopImmediatePropagation();
|
|
103
103
|
}}
|
|
104
|
-
@focus=${(
|
|
105
|
-
this.onFocus(),
|
|
104
|
+
@focus=${(r) => {
|
|
105
|
+
this.onFocus(), r.stopImmediatePropagation();
|
|
106
106
|
}}
|
|
107
|
-
@blur=${(
|
|
108
|
-
this.value =
|
|
107
|
+
@blur=${(r) => {
|
|
108
|
+
this.value = r.target.value, this.onBlur(), r.stopImmediatePropagation();
|
|
109
109
|
}}
|
|
110
110
|
></textarea>
|
|
111
111
|
</pkt-input-wrapper>`;
|
|
112
112
|
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
],
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
],
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
],
|
|
123
|
-
|
|
113
|
+
}
|
|
114
|
+
l([
|
|
115
|
+
u({ type: String, reflect: !0 })
|
|
116
|
+
], n.prototype, "value");
|
|
117
|
+
l([
|
|
118
|
+
u({ type: String })
|
|
119
|
+
], n.prototype, "autocomplete");
|
|
120
|
+
l([
|
|
121
|
+
u({ type: Number })
|
|
122
|
+
], n.prototype, "rows");
|
|
123
|
+
l([
|
|
124
124
|
$()
|
|
125
|
-
],
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
], n.prototype, "counterCurrent");
|
|
126
|
+
try {
|
|
127
|
+
m("pkt-textarea")(n);
|
|
128
|
+
} catch {
|
|
129
|
+
console.warn("Forsøker å definere <pkt-textarea>, men den er allerede definert");
|
|
130
|
+
}
|
|
129
131
|
export {
|
|
130
|
-
|
|
132
|
+
n as P
|
|
131
133
|
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";const t=require("./element-gR_VtSiD.cjs"),h=require("./if-defined-BOW3ODSj.cjs"),c=require("./state-Dg-53wQ8.cjs"),l=require("./ref-CL-Xk9Xm.cjs"),d=require("./class-map-CsENJXf1.cjs"),$=require("./input-element-DdVhUvva.cjs"),f=require("./element-with-slot-ZX-up7jO.cjs");require("./input-wrapper-Bv9aqqVq.cjs");require("./icon-q81vqPK_.cjs");var g=Object.defineProperty,r=(u,i,s,a)=>{for(var e=void 0,o=u.length-1,p;o>=0;o--)(p=u[o])&&(e=p(i,s,e)||e);return e&&g(i,s,e),e};class n extends $.PktInputElement{constructor(){super(...arguments),this.inputRef=l.e(),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(i,s,a){i==="value"&&this.value!==s&&(this.counterCurrent=a?a.length:0,this.valueChanged(a,s)),super.attributeChangedCallback(i,s,a)}updated(i){var s;super.updated(i),i.has("value")&&(this.counterCurrent=((s=this.value)==null?void 0:s.length)||0,this.valueChanged(this.value,i.get("value"))),i.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const i=this.type==="search"&&!this.iconNameRight&&!this.omitSearchIcon,s=d.e({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),a=this.ariaLabelledby||`${this.id}-input-label`;return t.b`
|
|
2
|
+
<pkt-input-wrapper
|
|
3
|
+
label="${this.label}"
|
|
4
|
+
?counter=${this.counter}
|
|
5
|
+
?disabled=${this.disabled}
|
|
6
|
+
?hasError=${this.hasError}
|
|
7
|
+
?hasFieldset=${this.hasFieldset}
|
|
8
|
+
?inline=${this.inline}
|
|
9
|
+
?optionalTag=${this.optionalTag}
|
|
10
|
+
?required=${this.required}
|
|
11
|
+
?requiredTag=${this.requiredTag}
|
|
12
|
+
useWrapper=${this.useWrapper}
|
|
13
|
+
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
14
|
+
.counterCurrent=${this.counterCurrent}
|
|
15
|
+
.counterMaxLength=${this.counterMaxLength}
|
|
16
|
+
.errorMessage=${this.errorMessage}
|
|
17
|
+
.forId="${this.id+"-input"}"
|
|
18
|
+
.helptext=${this.helptext}
|
|
19
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
20
|
+
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
21
|
+
.optionalText=${this.optionalText}
|
|
22
|
+
.requiredText=${this.requiredText}
|
|
23
|
+
.tagText=${this.tagText}
|
|
24
|
+
class="pkt-textinput"
|
|
25
|
+
>
|
|
26
|
+
<div class="pkt-contents" slot="helptext">${f.slotContent(this,"helptext")}</div>
|
|
27
|
+
<div class="pkt-input__container">
|
|
28
|
+
${this.prefix?t.b`<div class="pkt-input-prefix">${this.prefix}</div>`:t.A}
|
|
29
|
+
<input
|
|
30
|
+
${l.n(this.inputRef)}
|
|
31
|
+
class=${s}
|
|
32
|
+
type=${this.type}
|
|
33
|
+
name=${(this.name||this.id)+"-input"}
|
|
34
|
+
id=${this.id+"-input"}
|
|
35
|
+
placeholder=${h.o(this.placeholder)}
|
|
36
|
+
aria-labelledby=${a}
|
|
37
|
+
autocomplete=${this.autocomplete||"off"}
|
|
38
|
+
minlength=${h.o(this.minlength||void 0)}
|
|
39
|
+
maxlength=${h.o(this.maxlength||void 0)}
|
|
40
|
+
min=${h.o(this.min||void 0)}
|
|
41
|
+
max=${h.o(this.max||void 0)}
|
|
42
|
+
step=${h.o(this.step||void 0)}
|
|
43
|
+
?readonly=${this.readonly}
|
|
44
|
+
size=${this.size||t.A}
|
|
45
|
+
.value=${this.value}
|
|
46
|
+
?disabled=${this.disabled}
|
|
47
|
+
aria-invalid=${this.hasError}
|
|
48
|
+
aria-errormessage=${`${this.id}-error`}
|
|
49
|
+
@input=${e=>{this.value=e.target.value,this.onInput(),e.stopImmediatePropagation()}}
|
|
50
|
+
@change=${e=>{e.stopImmediatePropagation()}}
|
|
51
|
+
@focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
|
|
52
|
+
@blur=${e=>{this.value=e.target.value,this.onBlur(),e.stopImmediatePropagation()}}
|
|
53
|
+
@keydown=${e=>{var o;if(e.key==="Enter"){const p=this.internals.form;p?p.requestSubmit():(o=this.inputRef.value)==null||o.blur()}}}
|
|
54
|
+
/>
|
|
55
|
+
${this.suffix?t.b`<div class="pkt-input-suffix">
|
|
56
|
+
${this.suffix}
|
|
57
|
+
${this.iconNameRight?t.b`<pkt-icon
|
|
58
|
+
class="pkt-input-suffix-icon"
|
|
59
|
+
name=${this.iconNameRight}
|
|
60
|
+
></pkt-icon>`:t.A}
|
|
61
|
+
${i?t.b`<pkt-icon
|
|
62
|
+
class="pkt-input-suffix-icon"
|
|
63
|
+
name="magnifying-glass-big"
|
|
64
|
+
></pkt-icon>`:t.A}
|
|
65
|
+
</div>`:t.A}
|
|
66
|
+
${!this.suffix&&this.iconNameRight?t.b`<pkt-icon class="pkt-input-icon" name=${this.iconNameRight}></pkt-icon>`:t.A}
|
|
67
|
+
${!this.suffix&&i?t.b`<pkt-icon class="pkt-input-icon" name="magnifying-glass-big"></pkt-icon>`:t.A}
|
|
68
|
+
</div>
|
|
69
|
+
</pkt-input-wrapper>
|
|
70
|
+
`}}r([t.n({type:String,reflect:!0})],n.prototype,"value");r([t.n({type:String})],n.prototype,"type");r([t.n({type:Number})],n.prototype,"size");r([t.n({type:String})],n.prototype,"autocomplete");r([t.n({type:String})],n.prototype,"iconNameRight");r([t.n({type:String})],n.prototype,"prefix");r([t.n({type:String})],n.prototype,"suffix");r([t.n({type:Boolean})],n.prototype,"omitSearchIcon");r([c.r()],n.prototype,"counterCurrent");try{t.t("pkt-textinput")(n)}catch{console.warn("Forsøker å definere <pkt-textinput>, men den er allerede definert")}exports.PktTextinput=n;
|