@oslokommune/punkt-elements 12.31.2 → 12.32.7
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/dist/alert-C2WKLFow.cjs +27 -0
- package/dist/alert-XGjypFHe.js +115 -0
- package/dist/alert.d.ts +32 -0
- package/dist/{backlink-CzpB-ih9.js → backlink-BX8HBhw5.js} +2 -2
- package/dist/{backlink-Dn4DfWVR.cjs → backlink-NJdC0FAO.cjs} +1 -1
- package/dist/backlink.d.ts +32 -0
- package/dist/{button-9NwGr-OS.js → button-Bn8jVB0f.js} +33 -33
- package/dist/{button-Beo3c7cx.cjs → button-Bpbh8A_a.cjs} +2 -2
- package/dist/button.d.ts +32 -0
- package/dist/{calendar-BbZNxsKY.js → calendar-BNHDEEwT.js} +20 -84
- package/dist/{calendar-CxBo98iI.cjs → calendar-Ds13AKr5.cjs} +4 -4
- package/dist/calendar.d.ts +32 -0
- package/dist/card-CEv3DL-o.js +94 -0
- package/dist/card-c5EEPaNh.cjs +28 -0
- package/dist/card.d.ts +32 -0
- package/dist/{checkbox-9Zjy_NU7.cjs → checkbox-DDBBDM85.cjs} +1 -1
- package/dist/{checkbox-CzDpR6_8.js → checkbox-DoMYxp83.js} +9 -9
- package/dist/checkbox.d.ts +32 -0
- package/dist/{class-map-DWtqmIRS.js → class-map-D4tSZX70.js} +2 -2
- package/dist/{class-map-Dj5mbCUg.cjs → class-map-DvBKxTiW.cjs} +1 -1
- package/dist/combobox-BflWORVa.cjs +115 -0
- package/dist/combobox-l7LmWQYu.js +491 -0
- package/dist/combobox.d.ts +47 -0
- package/dist/datepicker-Bkiyh5P5.cjs +153 -0
- package/dist/datepicker-nWd89NwP.js +449 -0
- package/dist/datepicker.d.ts +32 -0
- package/dist/directive-C7oCP5Bh.cjs +5 -0
- package/dist/directive-helpers-BmXIK-1b.js +45 -0
- package/dist/directive-helpers-donnvcEO.cjs +5 -0
- package/dist/{directive-B76A7YXI.js → directive-oAbCiebi.js} +4 -4
- package/dist/element-DJpGVXjq.cjs +238 -0
- package/dist/{element-C7XjZtLU.js → element-DiqKrDty.js} +8851 -8847
- package/dist/{helptext-CqnoPodd.js → helptext-DfRusn5R.js} +13 -13
- package/dist/{helptext-B9kxDc2b.cjs → helptext-aHD9icur.cjs} +2 -2
- package/dist/helptext.d.ts +32 -0
- package/dist/{icon-BEUgV9Wo.js → icon-BdY52BIt.js} +2 -2
- package/dist/{icon-BOKusjAA.cjs → icon-UtDKPH3R.cjs} +1 -1
- package/dist/icon.d.ts +32 -0
- package/dist/{if-defined-CpIkv1A4.cjs → if-defined-CoBDkDGb.cjs} +1 -1
- package/dist/{if-defined-eRX4e5zO.js → if-defined-DeANa4n5.js} +1 -1
- package/dist/index.d.ts +210 -15
- package/dist/{input-element-BK8UkQli.js → input-element-C4mmTk6h.js} +23 -20
- package/dist/input-element-VNai8bsq.cjs +1 -0
- package/dist/input-wrapper-8iKEzDRZ.js +40 -0
- package/dist/input-wrapper-DWOw7Yn-.cjs +52 -0
- package/dist/input-wrapper-EoSAbU-U.cjs +1 -0
- package/dist/input-wrapper-P_oEi6dk.js +185 -0
- package/dist/input-wrapper.d.ts +32 -0
- package/dist/link-D9dJ6F-R.js +73 -0
- package/dist/link-DBxXqsnP.cjs +8 -0
- package/dist/link.d.ts +32 -0
- package/dist/{linkcard-2WzDJPZz.cjs → linkcard-D5O1hR7N.cjs} +1 -1
- package/dist/{linkcard-CRpo3tiw.js → linkcard-DcEE9IVw.js} +4 -4
- package/dist/linkcard.d.ts +32 -0
- package/dist/listbox-CK1GmwCE.cjs +95 -0
- package/dist/listbox-CfJWJDrc.js +360 -0
- package/dist/listbox.d.ts +47 -0
- package/dist/{loader-B1edLWTg.js → loader-DZvOlXzI.js} +6 -6
- package/dist/{loader-DI74pe25.cjs → loader-SDXJp58K.cjs} +1 -1
- package/dist/loader.d.ts +32 -0
- package/dist/messagebox-Ce5e1gga.js +79 -0
- package/dist/messagebox-D2_-WZQG.cjs +12 -0
- package/dist/messagebox.d.ts +32 -0
- package/dist/modal-CCtUsYKk.cjs +33 -0
- package/dist/{modal-kPX8nO_L.js → modal-CdgIOp8Q.js} +51 -94
- package/dist/modal.d.ts +32 -0
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-combobox.cjs +1 -0
- package/dist/pkt-combobox.js +6 -0
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +1 -1
- package/dist/pkt-index.cjs +3 -3
- package/dist/pkt-index.js +45 -43
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -1
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-listbox.cjs +1 -0
- package/dist/pkt-listbox.js +6 -0
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/pkt-options-controller-BkWE4pZe.js +38 -0
- package/dist/pkt-options-controller-TJ1apYGF.cjs +1 -0
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -2
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-slot-controller-BtVLTZb7.js +79 -0
- package/dist/pkt-slot-controller-plQxXRvV.cjs +1 -0
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/{progressbar-D0nxLqHu.js → progressbar-DvFz9KBo.js} +6 -6
- package/dist/{progressbar-B6A9UVXS.cjs → progressbar-jASTnhti.cjs} +1 -1
- package/dist/progressbar.d.ts +32 -0
- package/dist/{radiobutton-BWyQgR_x.cjs → radiobutton-C-Xd5sSq.cjs} +1 -1
- package/dist/{radiobutton-DLWjvLBO.js → radiobutton-D03aN4yn.js} +5 -5
- package/dist/radiobutton.d.ts +32 -0
- package/dist/ref-B70YZNXm.js +102 -0
- package/dist/ref-CLqTsViF.cjs +9 -0
- package/dist/repeat-CNLpCTun.js +61 -0
- package/dist/repeat-t2oms1o6.cjs +5 -0
- package/dist/select-BLDaK5Rd.js +118 -0
- package/dist/select-Dvds7MzS.cjs +49 -0
- package/dist/select.d.ts +32 -0
- package/dist/{state-HNj0_316.cjs → state-C4LdlTYO.cjs} +1 -1
- package/dist/{state-CDQk0DFQ.js → state-CDwPbiQj.js} +1 -1
- package/dist/tag-C52KeBmR.cjs +18 -0
- package/dist/{tag-CmFcSdOV.js → tag-DoS5S2Bq.js} +28 -77
- package/dist/tag.d.ts +32 -0
- package/dist/{textarea-BPqWCymU.js → textarea-C9EvdPGi.js} +18 -17
- package/dist/{textarea-VG-UTMLP.cjs → textarea-DJvNBmEL.cjs} +6 -6
- package/dist/textarea.d.ts +32 -0
- package/dist/{textinput-CEP7QA3E.cjs → textinput-Cg3ObBuw.cjs} +5 -4
- package/dist/{textinput-VD74aGzx.js → textinput-CxRSSYaN.js} +34 -33
- package/dist/textinput.d.ts +32 -0
- package/package.json +4 -4
- package/src/components/button/button.ts +3 -2
- package/src/components/combobox/combobox.ts +873 -0
- package/src/components/combobox/countrycodes.json +927 -0
- package/src/components/combobox/index.ts +6 -0
- package/src/components/datepicker/datepicker.ts +6 -4
- package/src/components/helptext/helptext.ts +1 -1
- package/src/components/index.ts +7 -0
- package/src/components/input-wrapper/input-wrapper.ts +42 -34
- package/src/components/listbox/index.ts +4 -0
- package/src/components/listbox/listbox.ts +474 -0
- package/src/components/select/select.ts +7 -0
- package/src/components/tag/tag.ts +1 -1
- package/src/components/textinput/textinput.ts +3 -2
- package/dist/alert-BDxxRqgi.cjs +0 -27
- package/dist/alert-D0S57u0r.js +0 -163
- package/dist/card-C63x_nll.cjs +0 -28
- package/dist/card-DQfNKnKl.js +0 -176
- package/dist/datepicker-CYUvRGhE.js +0 -663
- package/dist/datepicker-FuAL0uNU.cjs +0 -155
- package/dist/directive-C_VV3qwo.cjs +0 -5
- package/dist/element-CzFXQBoS.cjs +0 -238
- package/dist/input-element-Dtyuf6s8.cjs +0 -1
- package/dist/input-wrapper-Bo2_t6pA.cjs +0 -50
- package/dist/input-wrapper-Bw9tARAD.js +0 -125
- package/dist/input-wrapper-DaZZq8c0.js +0 -172
- package/dist/input-wrapper-jPnKsfEC.cjs +0 -1
- package/dist/link-1iq0Pmuf.cjs +0 -8
- package/dist/link-D3U0Jkz8.js +0 -109
- package/dist/messagebox-DQpEMkS2.cjs +0 -12
- package/dist/messagebox-KP-8-tA9.js +0 -114
- package/dist/modal-ytIJwfr3.cjs +0 -33
- package/dist/pkt-slot-controller-Clbye6cM.js +0 -85
- package/dist/pkt-slot-controller-Oc32unDk.cjs +0 -1
- package/dist/ref-2anvRHT4.cjs +0 -13
- package/dist/ref-DbOSDQbk.js +0 -143
- package/dist/select-CzuxXKll.js +0 -150
- package/dist/select-DZL6aa2s.cjs +0 -48
- package/dist/tag-BeLSOjNh.cjs +0 -18
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./element-DJpGVXjq.cjs"),f=require("./state-C4LdlTYO.cjs"),c=require("./stringutils-CkVRq4jP.cjs"),y=require("./input-wrapper-EoSAbU-U.cjs");var m=Object.defineProperty,s=(o,t,r,n)=>{for(var a=void 0,l=o.length-1,h;l>=0;l--)(h=o[l])&&(a=h(t,r,a)||a);return a&&m(t,r,a),a};class i extends e.PktElement{constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=c.uuidish(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=y.specs.props.helptextDropdownButton.default,this.label=null,this.optionalText=e.translations.forms.labels.optional,this.requiredText=e.translations.forms.labels.required,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(t){var r,n,a,l,h,u,p,d;t&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},e.translations.forms.messages.required,t):(r=t.validity)!=null&&r.typeMismatch||(n=t.validity)!=null&&n.badInput?this.internals.setValidity({typeMismatch:!0},e.translations.forms.messages.invalid,t):(a=t.validity)!=null&&a.patternMismatch?this.internals.setValidity({patternMismatch:!0},e.translations.forms.messages.invalidPattern,t):(l=t.validity)!=null&&l.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},e.translations.forms.messages.tooShort,t):(h=t.validity)!=null&&h.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},e.translations.forms.messages.tooLong,t):(u=t.validity)!=null&&u.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},e.translations.forms.messages.rangeUnderflow,t):(p=t.validity)!=null&&p.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},e.translations.forms.messages.rangeOverflow,t):(d=t.validity)!=null&&d.customError?this.internals.setValidity({customError:!0},t.validationMessage,t):this.internals.setValidity({}))}setFormValue(t){if(this.internals)if(Array.isArray(t)){const r=new FormData;t.forEach(n=>{r.append(this.name,n)}),this.internals.setFormValue(r)}else this.internals.setFormValue(t)}valueChecked(t){if(!this.touched)return;const r=this.internals.form||this.closest("form");r&&r.querySelectorAll(`pkt-radiobutton[name=${this.name}], input[type=radio][name=${this.name}]`).forEach(n=>{const a=n;a.name===this.name&&a.value!==this.value&&a.checked&&(a.checked=!1)}),typeof t=="string"?(this.checked=t==="true",this.internals.ariaChecked=t==="true"):typeof t=="boolean"&&(this.checked=t,this.internals.ariaChecked=t),this.checked?(this.internals.setFormValue(this.value||"on",this.value||"on"),this.internals.states.add("--checked")):(this.internals.setFormValue("",""),this.internals.states.delete("--checked")),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:this.checked,bubbles:!0,composed:!0})),this.internals.reportValidity()}valueChanged(t,r){(r!==this.value||r!==this._value)&&(typeof t=="string"?((this.multiple||this.range)&&t.includes(",")&&(t=t.split(",")),this.value=t,this._value=Array.isArray(t)?t:[t]):Array.isArray(t)?(this.value=this.multiple||this.range?t:t[0],this._value=t):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&r&&r.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(r==null?void 0:r.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}clearInputValue(){const t=this.multiple||this.range?[]:"";this.value=t,this.internals.setFormValue(t),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus"))}onBlur(){this.dispatchEvent(new FocusEvent("blur"))}onInput(){this.dispatchEvent(new InputEvent("input"))}onChange(t){if(!this.touched){this.touched=!0,t&&this.setFormValue(t);return}typeof t!="string"&&!Array.isArray(t)||((this.range||this.multiple)&&!Array.isArray(t)&&t.includes(",")&&(t=t.split(",")),!this.multiple&&!this.range&&Array.isArray(t)&&(t=t[0]),this.setFormValue(t),this.manageValidity(this.inputRef.value),this.inputRefTo&&this.manageValidity(this.inputRefTo.value),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0})),this.internals.reportValidity())}updated(t){super.updated(t),t.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(t){if(super.firstUpdated(t),this.value&&this.defaultValue!==null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=!0,this.checked=!0),this.required&&(this.internals.ariaRequired=!0),this.disabled&&(this.internals.ariaDisabled=!0),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const r=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=r,this.internals.setFormValue(r?this.value||"on":"",r?this.value||"on":"")}else this.internals.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}}s([e.n()],i.prototype,"defaultValue");s([e.n({type:Boolean,reflect:!0})],i.prototype,"disabled");s([e.n({type:Boolean,reflect:!0})],i.prototype,"readonly");s([e.n({type:Boolean,reflect:!0})],i.prototype,"required");s([e.n({type:Number,reflect:!0})],i.prototype,"max");s([e.n({type:Number,reflect:!0})],i.prototype,"maxlength");s([e.n({type:Number,reflect:!0})],i.prototype,"min");s([e.n({type:Number,reflect:!0})],i.prototype,"minlength");s([e.n({type:String})],i.prototype,"ariaDescribedBy");s([e.n({type:String})],i.prototype,"ariaLabelledby");s([e.n({type:String,reflect:!0})],i.prototype,"name");s([e.n({type:String,reflect:!0})],i.prototype,"pattern");s([e.n({type:String,reflect:!0})],i.prototype,"placeholder");s([e.n({type:String,reflect:!0})],i.prototype,"id");s([e.n({type:Boolean})],i.prototype,"counter");s([e.n({type:Boolean})],i.prototype,"hasError");s([e.n({type:Boolean})],i.prototype,"inline");s([e.n({type:Boolean})],i.prototype,"hasFieldset");s([e.n({type:Boolean})],i.prototype,"optionalTag");s([e.n({type:Boolean})],i.prototype,"requiredTag");s([e.n({type:Boolean})],i.prototype,"skipForwardTestid");s([e.n({type:Boolean,reflect:!1})],i.prototype,"useWrapper");s([e.n({type:Boolean,reflect:!0})],i.prototype,"fullwidth");s([e.n({type:Number})],i.prototype,"counterMaxLength");s([e.n({type:String})],i.prototype,"errorMessage");s([e.n({type:String})],i.prototype,"helptext");s([e.n({type:String})],i.prototype,"helptextDropdown");s([e.n({type:String,reflect:!1})],i.prototype,"helptextDropdownButton");s([e.n({type:String})],i.prototype,"label");s([e.n({type:String,reflect:!1})],i.prototype,"optionalText");s([e.n({type:String,reflect:!1})],i.prototype,"requiredText");s([e.n({type:String,attribute:"data-testid"})],i.prototype,"dataTestid");s([f.r()],i.prototype,"touched");exports.PktInputElement=i;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
helptextDropdownButton: {
|
|
3
|
+
default: "Les mer <span class='pkt-sr-only'>om feltet</span>"
|
|
4
|
+
},
|
|
5
|
+
counter: {
|
|
6
|
+
default: !1
|
|
7
|
+
},
|
|
8
|
+
optionalTag: {
|
|
9
|
+
default: !1
|
|
10
|
+
},
|
|
11
|
+
optionalText: {
|
|
12
|
+
default: "Valgfritt"
|
|
13
|
+
},
|
|
14
|
+
requiredTag: {
|
|
15
|
+
default: !1
|
|
16
|
+
},
|
|
17
|
+
requiredText: {
|
|
18
|
+
default: "Må fylles ut"
|
|
19
|
+
},
|
|
20
|
+
hasError: {
|
|
21
|
+
default: !1
|
|
22
|
+
},
|
|
23
|
+
disabled: {
|
|
24
|
+
default: !1
|
|
25
|
+
},
|
|
26
|
+
inline: {
|
|
27
|
+
default: !1
|
|
28
|
+
},
|
|
29
|
+
hasFieldset: {
|
|
30
|
+
default: !1
|
|
31
|
+
},
|
|
32
|
+
useWrapper: {
|
|
33
|
+
default: !0
|
|
34
|
+
}
|
|
35
|
+
}, a = {
|
|
36
|
+
props: e
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
a as s
|
|
40
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";const t=require("./element-DJpGVXjq.cjs"),b=require("./pkt-slot-controller-plQxXRvV.cjs"),a=require("./ref-CLqTsViF.cjs"),y=require("./icon-UtDKPH3R.cjs"),c=require("./class-map-DvBKxTiW.cjs"),f=require("./state-C4LdlTYO.cjs"),$=require("./stringutils-CkVRq4jP.cjs"),p=require("./input-wrapper-EoSAbU-U.cjs");require("./helptext-aHD9icur.cjs");var I=Object.defineProperty,P=Object.getOwnPropertyDescriptor,e=(u,r,i,o)=>{for(var s=o>1?void 0:o?P(r,i):r,n=u.length-1,l;n>=0;n--)(l=u[n])&&(s=(o?l(r,i,s):l(s))||s);return o&&s&&I(r,i,s),s};exports.PktInputWrapper=class extends t.PktElement{constructor(){super(),this.defaultSlot=a.e(),this.helptextSlot=a.e(),this.hasHelptextSlot=!0,this.forId=$.uuidish(),this.label="",this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=p.specs.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.counterError=null,this.counterPosition="bottom",this.optionalTag=p.specs.props.optionalTag.default,this.optionalText=p.specs.props.optionalText.default,this.requiredTag=p.specs.props.requiredTag.default,this.requiredText=p.specs.props.requiredText.default,this.hasError=p.specs.props.hasError.default,this.errorMessage="",this.disabled=p.specs.props.disabled.default,this.inline=p.specs.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=p.specs.props.hasFieldset.default,this.useWrapper=p.specs.props.useWrapper.default,this.role="group",this.slotController=new b.PktSlotController(this,this.defaultSlot,this.helptextSlot)}updateSlots(r){this.hasHelptextSlot=r.has("helptext"),this.requestUpdate()}updated(r){super.updated(r)}render(){const r={"pkt-inputwrapper":!0,"pkt-inputwrapper--error":this.hasError,"pkt-inputwrapper--disabled":this.disabled,"pkt-inputwrapper--inline":this.inline},i={"pkt-tag":!0,"pkt-tag--small":!0,"pkt-tag--thin-text":!0,"pkt-tag--blue-light":this.optionalTag,"pkt-tag--beige":!this.optionalTag&&this.requiredTag},o=this.ariaDescribedby?this.ariaDescribedby:this.helptext?`${this.forId}-helptext`:t.E,s=()=>this.optionalTag||this.requiredTag?t.x`<span class=${c.e(i)}
|
|
2
|
+
>${this.optionalTag?this.optionalText:this.requiredTag?this.requiredText:t.E}</span
|
|
3
|
+
>`:t.E,n=()=>this.useWrapper?this.hasFieldset?t.x`<legend
|
|
4
|
+
class="pkt-inputwrapper__legend"
|
|
5
|
+
id="${this.forId}-label"
|
|
6
|
+
@click=${this.handleLabelClick}
|
|
7
|
+
>
|
|
8
|
+
${this.label} ${s()}
|
|
9
|
+
</legend>`:t.x`<label
|
|
10
|
+
class="pkt-inputwrapper__label"
|
|
11
|
+
for="${this.forId}"
|
|
12
|
+
aria-describedby="${o}"
|
|
13
|
+
id="${this.forId}-label"
|
|
14
|
+
@click=${this.handleLabelClick}
|
|
15
|
+
>${this.label}${s()}</label
|
|
16
|
+
>`:t.x`<label
|
|
17
|
+
for="${this.forId}"
|
|
18
|
+
class="pkt-sr-only"
|
|
19
|
+
aria-describedby="${o}"
|
|
20
|
+
id="${this.forId}-label"
|
|
21
|
+
>
|
|
22
|
+
${this.label}
|
|
23
|
+
</label>`,l=()=>!this.helptext&&!this.hasHelptextSlot&&!this.helptextDropdown?t.E:t.x`
|
|
24
|
+
<pkt-helptext
|
|
25
|
+
.forId=${this.forId}
|
|
26
|
+
.helptext=${this.helptext}
|
|
27
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
28
|
+
.helptextDropdownButton=${this.helptextDropdownButton||p.specs.props.helptextDropdownButton.default}
|
|
29
|
+
@toggleHelpText=${g=>{this.toggleDropdown(g)}}
|
|
30
|
+
${a.n(this.helptextSlot)}
|
|
31
|
+
name="helptext"
|
|
32
|
+
></pkt-helptext>
|
|
33
|
+
`,h=()=>this.counter?t.x`<div class="pkt-input__counter" aria-live="polite" aria-atomic="true">
|
|
34
|
+
${this.counterError?this.counterError:t.E} ${this.counterCurrent||0}
|
|
35
|
+
${this.counterMaxLength?`/${this.counterMaxLength}`:t.E}
|
|
36
|
+
</div>`:t.E,k=()=>this.hasError&&this.errorMessage?t.x`<div
|
|
37
|
+
role="alert"
|
|
38
|
+
class="pkt-alert pkt-alert--error pkt-alert--compact"
|
|
39
|
+
aria-live="assertive"
|
|
40
|
+
aria-atomic="true"
|
|
41
|
+
id="${this.forId}-error"
|
|
42
|
+
>
|
|
43
|
+
<pkt-icon name="alert-error" class="pkt-alert__icon"></pkt-icon>
|
|
44
|
+
<div class="pkt-alert__text">${y.o(this.errorMessage)}</div>
|
|
45
|
+
</div>`:t.E,d=()=>t.x`
|
|
46
|
+
${n()} ${l()}
|
|
47
|
+
${this.counterPosition==="top"?h():t.E}
|
|
48
|
+
<div class="pkt-contents" ${a.n(this.defaultSlot)}></div>
|
|
49
|
+
${this.counterPosition==="bottom"?h():t.E} ${k()}
|
|
50
|
+
`,x=()=>this.hasFieldset?t.x`<fieldset class="pkt-inputwrapper__fieldset" aria-describedby="${o}">
|
|
51
|
+
${d()}
|
|
52
|
+
</fieldset>`:t.x`<div class="pkt-inputwrapper__fieldset">${d()}</div>`;return t.x`<div class=${c.e(r)}>${x()}</div> `}toggleDropdown(r){this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!1,detail:{isOpen:r.detail.isOpen}}))}handleLabelClick(r){this.disabled&&(r.preventDefault(),r.stopImmediatePropagation()),this.dispatchEvent(new CustomEvent("labelClick",{bubbles:!0,composed:!0,detail:"label clicked"}))}};e([f.r()],exports.PktInputWrapper.prototype,"hasHelptextSlot",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"forId",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"label",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"helptext",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"helptextDropdown",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"helptextDropdownButton",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"counter",2);e([t.n({type:Number})],exports.PktInputWrapper.prototype,"counterCurrent",2);e([t.n({type:Number})],exports.PktInputWrapper.prototype,"counterMaxLength",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"counterError",2);e([t.n({type:String,reflect:!1})],exports.PktInputWrapper.prototype,"counterPosition",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"optionalTag",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"optionalText",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"requiredTag",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"requiredText",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"hasError",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"errorMessage",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"disabled",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"inline",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"ariaDescribedby",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"hasFieldset",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"useWrapper",2);e([t.n({type:String,reflect:!0})],exports.PktInputWrapper.prototype,"role",2);exports.PktInputWrapper=e([t.t("pkt-input-wrapper")],exports.PktInputWrapper);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e={helptextDropdownButton:{default:"Les mer <span class='pkt-sr-only'>om feltet</span>"},counter:{default:!1},optionalTag:{default:!1},optionalText:{default:"Valgfritt"},requiredTag:{default:!1},requiredText:{default:"Må fylles ut"},hasError:{default:!1},disabled:{default:!1},inline:{default:!1},hasFieldset:{default:!1},useWrapper:{default:!0}},t={props:e};exports.specs=t;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { P as m, E as s, x as p, n as r, a as k } from "./element-DiqKrDty.js";
|
|
2
|
+
import { P as v } from "./pkt-slot-controller-BtVLTZb7.js";
|
|
3
|
+
import { e as f, n as g } from "./ref-B70YZNXm.js";
|
|
4
|
+
import { o as w } from "./icon-BdY52BIt.js";
|
|
5
|
+
import { e as b } from "./class-map-D4tSZX70.js";
|
|
6
|
+
import { r as S } from "./state-CDwPbiQj.js";
|
|
7
|
+
import { u as T } from "./stringutils-DJjRa8dG.js";
|
|
8
|
+
import { s as i } from "./input-wrapper-8iKEzDRZ.js";
|
|
9
|
+
import "./helptext-DfRusn5R.js";
|
|
10
|
+
var E = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, e = (o, h, a, n) => {
|
|
11
|
+
for (var l = n > 1 ? void 0 : n ? _(h, a) : h, u = o.length - 1, d; u >= 0; u--)
|
|
12
|
+
(d = o[u]) && (l = (n ? d(h, a, l) : d(l)) || l);
|
|
13
|
+
return n && l && E(h, a, l), l;
|
|
14
|
+
};
|
|
15
|
+
let t = class extends m {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(), this.defaultSlot = f(), this.helptextSlot = f(), this.hasHelptextSlot = !0, this.forId = T(), this.label = "", this.helptext = null, this.helptextDropdown = null, this.helptextDropdownButton = null, this.counter = i.props.counter.default, this.counterCurrent = 0, this.counterMaxLength = 0, this.counterError = null, this.counterPosition = "bottom", this.optionalTag = i.props.optionalTag.default, this.optionalText = i.props.optionalText.default, this.requiredTag = i.props.requiredTag.default, this.requiredText = i.props.requiredText.default, this.hasError = i.props.hasError.default, this.errorMessage = "", this.disabled = i.props.disabled.default, this.inline = i.props.inline.default, this.ariaDescribedby = void 0, this.hasFieldset = i.props.hasFieldset.default, this.useWrapper = i.props.useWrapper.default, this.role = "group", this.slotController = new v(this, this.defaultSlot, this.helptextSlot);
|
|
18
|
+
}
|
|
19
|
+
updateSlots(o) {
|
|
20
|
+
this.hasHelptextSlot = o.has("helptext"), this.requestUpdate();
|
|
21
|
+
}
|
|
22
|
+
updated(o) {
|
|
23
|
+
super.updated(o);
|
|
24
|
+
}
|
|
25
|
+
render() {
|
|
26
|
+
const o = {
|
|
27
|
+
"pkt-inputwrapper": !0,
|
|
28
|
+
"pkt-inputwrapper--error": this.hasError,
|
|
29
|
+
"pkt-inputwrapper--disabled": this.disabled,
|
|
30
|
+
"pkt-inputwrapper--inline": this.inline
|
|
31
|
+
}, h = {
|
|
32
|
+
"pkt-tag": !0,
|
|
33
|
+
"pkt-tag--small": !0,
|
|
34
|
+
"pkt-tag--thin-text": !0,
|
|
35
|
+
"pkt-tag--blue-light": this.optionalTag,
|
|
36
|
+
"pkt-tag--beige": !this.optionalTag && this.requiredTag
|
|
37
|
+
}, a = this.ariaDescribedby ? this.ariaDescribedby : this.helptext ? `${this.forId}-helptext` : s, n = () => this.optionalTag || this.requiredTag ? p`<span class=${b(h)}
|
|
38
|
+
>${this.optionalTag ? this.optionalText : this.requiredTag ? this.requiredText : s}</span
|
|
39
|
+
>` : s, l = () => this.useWrapper ? this.hasFieldset ? p`<legend
|
|
40
|
+
class="pkt-inputwrapper__legend"
|
|
41
|
+
id="${this.forId}-label"
|
|
42
|
+
@click=${this.handleLabelClick}
|
|
43
|
+
>
|
|
44
|
+
${this.label} ${n()}
|
|
45
|
+
</legend>` : p`<label
|
|
46
|
+
class="pkt-inputwrapper__label"
|
|
47
|
+
for="${this.forId}"
|
|
48
|
+
aria-describedby="${a}"
|
|
49
|
+
id="${this.forId}-label"
|
|
50
|
+
@click=${this.handleLabelClick}
|
|
51
|
+
>${this.label}${n()}</label
|
|
52
|
+
>` : p`<label
|
|
53
|
+
for="${this.forId}"
|
|
54
|
+
class="pkt-sr-only"
|
|
55
|
+
aria-describedby="${a}"
|
|
56
|
+
id="${this.forId}-label"
|
|
57
|
+
>
|
|
58
|
+
${this.label}
|
|
59
|
+
</label>`, u = () => !this.helptext && !this.hasHelptextSlot && !this.helptextDropdown ? s : p`
|
|
60
|
+
<pkt-helptext
|
|
61
|
+
.forId=${this.forId}
|
|
62
|
+
.helptext=${this.helptext}
|
|
63
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
64
|
+
.helptextDropdownButton=${this.helptextDropdownButton || i.props.helptextDropdownButton.default}
|
|
65
|
+
@toggleHelpText=${($) => {
|
|
66
|
+
this.toggleDropdown($);
|
|
67
|
+
}}
|
|
68
|
+
${g(this.helptextSlot)}
|
|
69
|
+
name="helptext"
|
|
70
|
+
></pkt-helptext>
|
|
71
|
+
`, d = () => this.counter ? p`<div class="pkt-input__counter" aria-live="polite" aria-atomic="true">
|
|
72
|
+
${this.counterError ? this.counterError : s} ${this.counterCurrent || 0}
|
|
73
|
+
${this.counterMaxLength ? `/${this.counterMaxLength}` : s}
|
|
74
|
+
</div>` : s, y = () => this.hasError && this.errorMessage ? p`<div
|
|
75
|
+
role="alert"
|
|
76
|
+
class="pkt-alert pkt-alert--error pkt-alert--compact"
|
|
77
|
+
aria-live="assertive"
|
|
78
|
+
aria-atomic="true"
|
|
79
|
+
id="${this.forId}-error"
|
|
80
|
+
>
|
|
81
|
+
<pkt-icon name="alert-error" class="pkt-alert__icon"></pkt-icon>
|
|
82
|
+
<div class="pkt-alert__text">${w(this.errorMessage)}</div>
|
|
83
|
+
</div>` : s, c = () => p`
|
|
84
|
+
${l()} ${u()}
|
|
85
|
+
${this.counterPosition === "top" ? d() : s}
|
|
86
|
+
<div class="pkt-contents" ${g(this.defaultSlot)}></div>
|
|
87
|
+
${this.counterPosition === "bottom" ? d() : s} ${y()}
|
|
88
|
+
`, x = () => this.hasFieldset ? p`<fieldset class="pkt-inputwrapper__fieldset" aria-describedby="${a}">
|
|
89
|
+
${c()}
|
|
90
|
+
</fieldset>` : p`<div class="pkt-inputwrapper__fieldset">${c()}</div>`;
|
|
91
|
+
return p`<div class=${b(o)}>${x()}</div> `;
|
|
92
|
+
}
|
|
93
|
+
toggleDropdown(o) {
|
|
94
|
+
this.dispatchEvent(
|
|
95
|
+
new CustomEvent("toggleHelpText", {
|
|
96
|
+
bubbles: !1,
|
|
97
|
+
detail: { isOpen: o.detail.isOpen }
|
|
98
|
+
})
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
handleLabelClick(o) {
|
|
102
|
+
this.disabled && (o.preventDefault(), o.stopImmediatePropagation()), this.dispatchEvent(
|
|
103
|
+
new CustomEvent("labelClick", {
|
|
104
|
+
bubbles: !0,
|
|
105
|
+
composed: !0,
|
|
106
|
+
detail: "label clicked"
|
|
107
|
+
})
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
e([
|
|
112
|
+
S()
|
|
113
|
+
], t.prototype, "hasHelptextSlot", 2);
|
|
114
|
+
e([
|
|
115
|
+
r({ type: String })
|
|
116
|
+
], t.prototype, "forId", 2);
|
|
117
|
+
e([
|
|
118
|
+
r({ type: String })
|
|
119
|
+
], t.prototype, "label", 2);
|
|
120
|
+
e([
|
|
121
|
+
r({ type: String })
|
|
122
|
+
], t.prototype, "helptext", 2);
|
|
123
|
+
e([
|
|
124
|
+
r({ type: String })
|
|
125
|
+
], t.prototype, "helptextDropdown", 2);
|
|
126
|
+
e([
|
|
127
|
+
r({ type: String })
|
|
128
|
+
], t.prototype, "helptextDropdownButton", 2);
|
|
129
|
+
e([
|
|
130
|
+
r({ type: Boolean })
|
|
131
|
+
], t.prototype, "counter", 2);
|
|
132
|
+
e([
|
|
133
|
+
r({ type: Number })
|
|
134
|
+
], t.prototype, "counterCurrent", 2);
|
|
135
|
+
e([
|
|
136
|
+
r({ type: Number })
|
|
137
|
+
], t.prototype, "counterMaxLength", 2);
|
|
138
|
+
e([
|
|
139
|
+
r({ type: String })
|
|
140
|
+
], t.prototype, "counterError", 2);
|
|
141
|
+
e([
|
|
142
|
+
r({ type: String, reflect: !1 })
|
|
143
|
+
], t.prototype, "counterPosition", 2);
|
|
144
|
+
e([
|
|
145
|
+
r({ type: Boolean })
|
|
146
|
+
], t.prototype, "optionalTag", 2);
|
|
147
|
+
e([
|
|
148
|
+
r({ type: String })
|
|
149
|
+
], t.prototype, "optionalText", 2);
|
|
150
|
+
e([
|
|
151
|
+
r({ type: Boolean })
|
|
152
|
+
], t.prototype, "requiredTag", 2);
|
|
153
|
+
e([
|
|
154
|
+
r({ type: String })
|
|
155
|
+
], t.prototype, "requiredText", 2);
|
|
156
|
+
e([
|
|
157
|
+
r({ type: Boolean })
|
|
158
|
+
], t.prototype, "hasError", 2);
|
|
159
|
+
e([
|
|
160
|
+
r({ type: String })
|
|
161
|
+
], t.prototype, "errorMessage", 2);
|
|
162
|
+
e([
|
|
163
|
+
r({ type: Boolean })
|
|
164
|
+
], t.prototype, "disabled", 2);
|
|
165
|
+
e([
|
|
166
|
+
r({ type: Boolean })
|
|
167
|
+
], t.prototype, "inline", 2);
|
|
168
|
+
e([
|
|
169
|
+
r({ type: String })
|
|
170
|
+
], t.prototype, "ariaDescribedby", 2);
|
|
171
|
+
e([
|
|
172
|
+
r({ type: Boolean })
|
|
173
|
+
], t.prototype, "hasFieldset", 2);
|
|
174
|
+
e([
|
|
175
|
+
r({ type: Boolean })
|
|
176
|
+
], t.prototype, "useWrapper", 2);
|
|
177
|
+
e([
|
|
178
|
+
r({ type: String, reflect: !0 })
|
|
179
|
+
], t.prototype, "role", 2);
|
|
180
|
+
t = e([
|
|
181
|
+
k("pkt-input-wrapper")
|
|
182
|
+
], t);
|
|
183
|
+
export {
|
|
184
|
+
t as P
|
|
185
|
+
};
|
package/dist/input-wrapper.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export { }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
declare global {
|
|
5
|
+
interface HTMLElementTagNameMap {
|
|
6
|
+
'pkt-combobox': PktCombobox & HTMLSelectElement;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
4
11
|
declare global {
|
|
5
12
|
interface HTMLElementTagNameMap {
|
|
6
13
|
'pkt-icon': PktIcon;
|
|
@@ -8,6 +15,31 @@ declare global {
|
|
|
8
15
|
}
|
|
9
16
|
|
|
10
17
|
|
|
18
|
+
declare global {
|
|
19
|
+
interface HTMLElementTagNameMap {
|
|
20
|
+
'pkt-listbox': PktListbox;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Pkt Select is a wrapper for the native select element using the pkt-input-wrapper component.
|
|
27
|
+
*
|
|
28
|
+
* The component will prioritize options passed as a prop over options passed as children if both are provided.
|
|
29
|
+
* This is to allow for dynamic options that might change in the case of both children/slot and props are provided.
|
|
30
|
+
*
|
|
31
|
+
* @slot (default) - Options to be rendered as children
|
|
32
|
+
* @prop {TSelectOption[]} options - Options to be rendered as children
|
|
33
|
+
*
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
declare global {
|
|
37
|
+
interface HTMLElementTagNameMap {
|
|
38
|
+
'pkt-select': PktSelect & HTMLSelectElement;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
11
43
|
declare global {
|
|
12
44
|
interface Window {
|
|
13
45
|
pktTz: string;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { P as f, E as u, x as h, n as i, a as k } from "./element-DiqKrDty.js";
|
|
2
|
+
import { P as m } from "./pkt-slot-controller-BtVLTZb7.js";
|
|
3
|
+
import { e as d, n as P } from "./ref-B70YZNXm.js";
|
|
4
|
+
import { e as g } from "./class-map-D4tSZX70.js";
|
|
5
|
+
import "./icon-BdY52BIt.js";
|
|
6
|
+
const v = {
|
|
7
|
+
href: {
|
|
8
|
+
default: "#"
|
|
9
|
+
},
|
|
10
|
+
target: {
|
|
11
|
+
default: "_self"
|
|
12
|
+
},
|
|
13
|
+
external: {
|
|
14
|
+
default: !1
|
|
15
|
+
}
|
|
16
|
+
}, c = {
|
|
17
|
+
props: v
|
|
18
|
+
};
|
|
19
|
+
var x = Object.defineProperty, y = Object.getOwnPropertyDescriptor, r = (o, n, l, s) => {
|
|
20
|
+
for (var t = s > 1 ? void 0 : s ? y(n, l) : n, a = o.length - 1, p; a >= 0; a--)
|
|
21
|
+
(p = o[a]) && (t = (s ? p(n, l, t) : p(t)) || t);
|
|
22
|
+
return s && t && x(n, l, t), t;
|
|
23
|
+
};
|
|
24
|
+
let e = class extends f {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(), this.defaultSlot = d(), this.href = c.props.href.default, this.iconName = void 0, this.iconPosition = void 0, this.external = c.props.external.default, this.target = c.props.target.default, this.slotController = new m(this, this.defaultSlot);
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
const o = {
|
|
30
|
+
"pkt-link": !0,
|
|
31
|
+
"pkt-link--icon-left": !!this.iconName && this.iconPosition === "left" || !!(this.iconName && !this.iconPosition),
|
|
32
|
+
"pkt-link--icon-right": !!this.iconName && this.iconPosition === "right",
|
|
33
|
+
"pkt-link--external": this.external
|
|
34
|
+
};
|
|
35
|
+
return h`<a
|
|
36
|
+
class=${g(o)}
|
|
37
|
+
href=${this.href}
|
|
38
|
+
@click=${this.handleClick}
|
|
39
|
+
.target=${this.target}
|
|
40
|
+
.rel=${this.external ? "noopener noreferrer" : u}
|
|
41
|
+
>${this.iconName ? h`<pkt-icon name=${this.iconName} class="pkt-link__icon"></pkt-icon>` : ""} <span ${P(this.defaultSlot)}>Link</span></a
|
|
42
|
+
>`;
|
|
43
|
+
}
|
|
44
|
+
handleClick() {
|
|
45
|
+
this.dispatchEvent(
|
|
46
|
+
new CustomEvent("click", {
|
|
47
|
+
detail: "pkt-link-clicked",
|
|
48
|
+
bubbles: !0
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
r([
|
|
54
|
+
i({ type: String, reflect: !0 })
|
|
55
|
+
], e.prototype, "href", 2);
|
|
56
|
+
r([
|
|
57
|
+
i({ type: String, reflect: !0 })
|
|
58
|
+
], e.prototype, "iconName", 2);
|
|
59
|
+
r([
|
|
60
|
+
i({ type: String, reflect: !0 })
|
|
61
|
+
], e.prototype, "iconPosition", 2);
|
|
62
|
+
r([
|
|
63
|
+
i({ type: Boolean, reflect: !0 })
|
|
64
|
+
], e.prototype, "external", 2);
|
|
65
|
+
r([
|
|
66
|
+
i({ type: String, reflect: !0 })
|
|
67
|
+
], e.prototype, "target", 2);
|
|
68
|
+
e = r([
|
|
69
|
+
k("pkt-link")
|
|
70
|
+
], e);
|
|
71
|
+
export {
|
|
72
|
+
e as P
|
|
73
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";const t=require("./element-DJpGVXjq.cjs"),k=require("./pkt-slot-controller-plQxXRvV.cjs"),p=require("./ref-CLqTsViF.cjs"),h=require("./class-map-DvBKxTiW.cjs");require("./icon-UtDKPH3R.cjs");const f={href:{default:"#"},target:{default:"_self"},external:{default:!1}},a={props:f};var u=Object.defineProperty,P=Object.getOwnPropertyDescriptor,n=(o,i,s,r)=>{for(var e=r>1?void 0:r?P(i,s):i,l=o.length-1,c;l>=0;l--)(c=o[l])&&(e=(r?c(i,s,e):c(e))||e);return r&&e&&u(i,s,e),e};exports.PktLink=class extends t.PktElement{constructor(){super(),this.defaultSlot=p.e(),this.href=a.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=a.props.external.default,this.target=a.props.target.default,this.slotController=new k.PktSlotController(this,this.defaultSlot)}render(){const i={"pkt-link":!0,"pkt-link--icon-left":!!this.iconName&&this.iconPosition==="left"||!!(this.iconName&&!this.iconPosition),"pkt-link--icon-right":!!this.iconName&&this.iconPosition==="right","pkt-link--external":this.external};return t.x`<a
|
|
2
|
+
class=${h.e(i)}
|
|
3
|
+
href=${this.href}
|
|
4
|
+
@click=${this.handleClick}
|
|
5
|
+
.target=${this.target}
|
|
6
|
+
.rel=${this.external?"noopener noreferrer":t.E}
|
|
7
|
+
>${this.iconName?t.x`<pkt-icon name=${this.iconName} class="pkt-link__icon"></pkt-icon>`:""} <span ${p.n(this.defaultSlot)}>Link</span></a
|
|
8
|
+
>`}handleClick(){this.dispatchEvent(new CustomEvent("click",{detail:"pkt-link-clicked",bubbles:!0}))}};n([t.n({type:String,reflect:!0})],exports.PktLink.prototype,"href",2);n([t.n({type:String,reflect:!0})],exports.PktLink.prototype,"iconName",2);n([t.n({type:String,reflect:!0})],exports.PktLink.prototype,"iconPosition",2);n([t.n({type:Boolean,reflect:!0})],exports.PktLink.prototype,"external",2);n([t.n({type:String,reflect:!0})],exports.PktLink.prototype,"target",2);exports.PktLink=n([t.t("pkt-link")],exports.PktLink);
|
package/dist/link.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export { }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
declare global {
|
|
5
|
+
interface HTMLElementTagNameMap {
|
|
6
|
+
'pkt-combobox': PktCombobox & HTMLSelectElement;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
4
11
|
declare global {
|
|
5
12
|
interface HTMLElementTagNameMap {
|
|
6
13
|
'pkt-icon': PktIcon;
|
|
@@ -8,6 +15,31 @@ declare global {
|
|
|
8
15
|
}
|
|
9
16
|
|
|
10
17
|
|
|
18
|
+
declare global {
|
|
19
|
+
interface HTMLElementTagNameMap {
|
|
20
|
+
'pkt-listbox': PktListbox;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Pkt Select is a wrapper for the native select element using the pkt-input-wrapper component.
|
|
27
|
+
*
|
|
28
|
+
* The component will prioritize options passed as a prop over options passed as children if both are provided.
|
|
29
|
+
* This is to allow for dynamic options that might change in the case of both children/slot and props are provided.
|
|
30
|
+
*
|
|
31
|
+
* @slot (default) - Options to be rendered as children
|
|
32
|
+
* @prop {TSelectOption[]} options - Options to be rendered as children
|
|
33
|
+
*
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
declare global {
|
|
37
|
+
interface HTMLElementTagNameMap {
|
|
38
|
+
'pkt-select': PktSelect & HTMLSelectElement;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
11
43
|
declare global {
|
|
12
44
|
interface Window {
|
|
13
45
|
pktTz: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./element-
|
|
1
|
+
"use strict";const t=require("./element-DJpGVXjq.cjs"),k=require("./ref-CLqTsViF.cjs"),p=require("./pkt-slot-controller-plQxXRvV.cjs");require("./icon-UtDKPH3R.cjs");var c=Object.defineProperty,h=Object.getOwnPropertyDescriptor,r=(s,n,i,l)=>{for(var e=l>1?void 0:l?h(n,i):n,o=s.length-1,a;o>=0;o--)(a=s[o])&&(e=(l?a(n,i,e):a(e))||e);return l&&e&&c(n,i,e),e};exports.PktLinkCard=class extends t.PktElement{constructor(){super(),this.defaultSlot=k.e(),this.title="",this.href="#",this.iconName="",this.external=!1,this.openInNewTab=!1,this.skin="normal",this.slotController=new p.PktSlotController(this,this.defaultSlot)}render(){const n=["pkt-linkcard",this.skin&&`pkt-linkcard--${this.skin}`].filter(Boolean).join(" "),i=["pkt-linkcard__title",this.external&&"pkt-link pkt-link--external"].filter(Boolean).join(" ");return t.x`
|
|
2
2
|
<a
|
|
3
3
|
href=${this.href}
|
|
4
4
|
class=${n}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as f, x as c, n, a as h } from "./element-
|
|
2
|
-
import { e as k, n as m } from "./ref-
|
|
3
|
-
import { P as u } from "./pkt-slot-controller-
|
|
4
|
-
import "./icon-
|
|
1
|
+
import { P as f, x as c, n, a as h } from "./element-DiqKrDty.js";
|
|
2
|
+
import { e as k, n as m } from "./ref-B70YZNXm.js";
|
|
3
|
+
import { P as u } from "./pkt-slot-controller-BtVLTZb7.js";
|
|
4
|
+
import "./icon-BdY52BIt.js";
|
|
5
5
|
var _ = Object.defineProperty, d = Object.getOwnPropertyDescriptor, r = (l, i, s, o) => {
|
|
6
6
|
for (var e = o > 1 ? void 0 : o ? d(i, s) : i, a = l.length - 1, p; a >= 0; a--)
|
|
7
7
|
(p = l[a]) && (e = (o ? p(i, s, e) : p(e)) || e);
|
package/dist/linkcard.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export { }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
declare global {
|
|
5
|
+
interface HTMLElementTagNameMap {
|
|
6
|
+
'pkt-combobox': PktCombobox & HTMLSelectElement;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
4
11
|
declare global {
|
|
5
12
|
interface HTMLElementTagNameMap {
|
|
6
13
|
'pkt-icon': PktIcon;
|
|
@@ -8,6 +15,31 @@ declare global {
|
|
|
8
15
|
}
|
|
9
16
|
|
|
10
17
|
|
|
18
|
+
declare global {
|
|
19
|
+
interface HTMLElementTagNameMap {
|
|
20
|
+
'pkt-listbox': PktListbox;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Pkt Select is a wrapper for the native select element using the pkt-input-wrapper component.
|
|
27
|
+
*
|
|
28
|
+
* The component will prioritize options passed as a prop over options passed as children if both are provided.
|
|
29
|
+
* This is to allow for dynamic options that might change in the case of both children/slot and props are provided.
|
|
30
|
+
*
|
|
31
|
+
* @slot (default) - Options to be rendered as children
|
|
32
|
+
* @prop {TSelectOption[]} options - Options to be rendered as children
|
|
33
|
+
*
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
declare global {
|
|
37
|
+
interface HTMLElementTagNameMap {
|
|
38
|
+
'pkt-select': PktSelect & HTMLSelectElement;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
11
43
|
declare global {
|
|
12
44
|
interface Window {
|
|
13
45
|
pktTz: string;
|