@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,118 @@
|
|
|
1
|
+
import { x as h, n as c, a as $ } from "./element-DiqKrDty.js";
|
|
2
|
+
import { r as b } from "./state-CDwPbiQj.js";
|
|
3
|
+
import { e as u, n as d } from "./ref-B70YZNXm.js";
|
|
4
|
+
import { o as s } from "./if-defined-DeANa4n5.js";
|
|
5
|
+
import { P as v } from "./input-element-C4mmTk6h.js";
|
|
6
|
+
import { P as f } from "./pkt-options-controller-BkWE4pZe.js";
|
|
7
|
+
import { P as m } from "./pkt-slot-controller-BtVLTZb7.js";
|
|
8
|
+
import "./input-wrapper-P_oEi6dk.js";
|
|
9
|
+
var g = Object.defineProperty, C = Object.getOwnPropertyDescriptor, a = (e, t, i, o) => {
|
|
10
|
+
for (var r = o > 1 ? void 0 : o ? C(t, i) : t, n = e.length - 1, p; n >= 0; n--)
|
|
11
|
+
(p = e[n]) && (r = (o ? p(t, i, r) : p(r)) || r);
|
|
12
|
+
return o && r && g(t, i, r), r;
|
|
13
|
+
};
|
|
14
|
+
let l = class extends v {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(), this.inputRef = u(), this.helptextSlot = u(), this.options = [], this.value = "", this._options = [], this.optionsController = new f(this), this.slotController = new m(this, this.helptextSlot), this.slotController.skipOptions = !0;
|
|
17
|
+
}
|
|
18
|
+
// Used for initilization
|
|
19
|
+
connectedCallback() {
|
|
20
|
+
super.connectedCallback();
|
|
21
|
+
const e = this.options.length > 0, t = this.optionsController.nodes.length && this.optionsController.nodes.length > 0;
|
|
22
|
+
!e && t ? this.optionsController.nodes.forEach((i) => {
|
|
23
|
+
const o = {
|
|
24
|
+
value: i.getAttribute("value") || i.textContent || "",
|
|
25
|
+
label: i.textContent || i.getAttribute("value") || "",
|
|
26
|
+
disabled: !!i.getAttribute("disabled")
|
|
27
|
+
};
|
|
28
|
+
i.getAttribute("selected") && !this.value && (this.value = o.value), this._options.push(o);
|
|
29
|
+
}) : this._options = this.options;
|
|
30
|
+
}
|
|
31
|
+
attributeChangedCallback(e, t, i) {
|
|
32
|
+
e === "options" && (this._options = i ? JSON.parse(i) : []), e === "value" && this.value !== t && this.valueChanged(i, t), super.attributeChangedCallback(e, t, i);
|
|
33
|
+
}
|
|
34
|
+
updated(e) {
|
|
35
|
+
var t;
|
|
36
|
+
super.updated(e), e.has("value") && (this.counterCurrent = ((t = this.value) == null ? void 0 : t.length) || 0, this.valueChanged(this.value, e.get("value"))), e.has("id") && !this.name && this.id && (this.name = this.id);
|
|
37
|
+
}
|
|
38
|
+
firstUpdated(e) {
|
|
39
|
+
super.firstUpdated(e), this.options.length && (this._options = this.options);
|
|
40
|
+
}
|
|
41
|
+
render() {
|
|
42
|
+
const e = `pkt-input ${this.fullwidth ? "pkt-input--fullwidth" : ""}`;
|
|
43
|
+
return h`
|
|
44
|
+
<pkt-input-wrapper
|
|
45
|
+
?counter=${this.counter}
|
|
46
|
+
?disabled=${this.disabled}
|
|
47
|
+
?hasError=${this.hasError}
|
|
48
|
+
?hasFieldset=${this.hasFieldset}
|
|
49
|
+
?inline=${this.inline}
|
|
50
|
+
?optionalTag=${this.optionalTag}
|
|
51
|
+
?requiredTag=${this.requiredTag}
|
|
52
|
+
?useWrapper=${this.useWrapper}
|
|
53
|
+
ariaDescribedBy=${s(this.ariaDescribedBy)}
|
|
54
|
+
.counterCurrent=${this.counterCurrent}
|
|
55
|
+
.counterMaxLength=${this.counterMaxLength}
|
|
56
|
+
class="pkt-select"
|
|
57
|
+
errorMessage=${s(this.errorMessage)}
|
|
58
|
+
forId=${this.id + "-input"}
|
|
59
|
+
helptext=${s(this.helptext)}
|
|
60
|
+
helptextDropdown=${s(this.helptextDropdown)}
|
|
61
|
+
helptextDropdownButton=${s(this.helptextDropdownButton)}
|
|
62
|
+
label=${s(this.label)}
|
|
63
|
+
optionalText=${s(this.optionalText)}
|
|
64
|
+
requiredText=${s(this.requiredText)}
|
|
65
|
+
>
|
|
66
|
+
<select
|
|
67
|
+
class=${e}
|
|
68
|
+
aria-invalid=${this.hasError}
|
|
69
|
+
aria-errormessage=${`${this.id}-error`}
|
|
70
|
+
aria-labelledby=${s(this.ariaLabelledby)}
|
|
71
|
+
?disabled=${this.disabled}
|
|
72
|
+
id=${this.id + "-input"}
|
|
73
|
+
name=${(this.name || this.id) + "-input"}
|
|
74
|
+
value=${this.value}
|
|
75
|
+
@change=${(t) => {
|
|
76
|
+
this.value = t.target.value, t.stopImmediatePropagation();
|
|
77
|
+
}}
|
|
78
|
+
@input=${(t) => {
|
|
79
|
+
this.onInput(), t.stopImmediatePropagation();
|
|
80
|
+
}}
|
|
81
|
+
@focus=${(t) => {
|
|
82
|
+
this.onFocus(), t.stopImmediatePropagation();
|
|
83
|
+
}}
|
|
84
|
+
@blur=${(t) => {
|
|
85
|
+
this.onBlur(), t.stopImmediatePropagation();
|
|
86
|
+
}}
|
|
87
|
+
${d(this.inputRef)}
|
|
88
|
+
>
|
|
89
|
+
${this._options.length > 0 && this._options.map(
|
|
90
|
+
(t) => h`<option
|
|
91
|
+
value=${t.value}
|
|
92
|
+
?selected=${this.value == t.value}
|
|
93
|
+
?disabled=${t.disabled}
|
|
94
|
+
>
|
|
95
|
+
${t.label}
|
|
96
|
+
</option>`
|
|
97
|
+
)}
|
|
98
|
+
</select>
|
|
99
|
+
<div class="pkt-contents" ${d(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
100
|
+
</pkt-input-wrapper>
|
|
101
|
+
`;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
a([
|
|
105
|
+
c({ type: Array })
|
|
106
|
+
], l.prototype, "options", 2);
|
|
107
|
+
a([
|
|
108
|
+
c({ type: String, reflect: !0 })
|
|
109
|
+
], l.prototype, "value", 2);
|
|
110
|
+
a([
|
|
111
|
+
b()
|
|
112
|
+
], l.prototype, "_options", 2);
|
|
113
|
+
l = a([
|
|
114
|
+
$("pkt-select")
|
|
115
|
+
], l);
|
|
116
|
+
export {
|
|
117
|
+
l as P
|
|
118
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";const r=require("./element-DJpGVXjq.cjs"),u=require("./state-C4LdlTYO.cjs"),l=require("./ref-CLqTsViF.cjs"),o=require("./if-defined-CoBDkDGb.cjs"),d=require("./input-element-VNai8bsq.cjs"),c=require("./pkt-options-controller-TJ1apYGF.cjs"),$=require("./pkt-slot-controller-plQxXRvV.cjs");require("./input-wrapper-DWOw7Yn-.cjs");var b=Object.defineProperty,v=Object.getOwnPropertyDescriptor,n=(a,e,t,i)=>{for(var s=i>1?void 0:i?v(e,t):e,p=a.length-1,h;p>=0;p--)(h=a[p])&&(s=(i?h(e,t,s):h(s))||s);return i&&s&&b(e,t,s),s};exports.PktSelect=class extends d.PktInputElement{constructor(){super(),this.inputRef=l.e(),this.helptextSlot=l.e(),this.options=[],this.value="",this._options=[],this.optionsController=new c.PktOptionsSlotController(this),this.slotController=new $.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback();const e=this.options.length>0,t=this.optionsController.nodes.length&&this.optionsController.nodes.length>0;!e&&t?this.optionsController.nodes.forEach(i=>{const s={value:i.getAttribute("value")||i.textContent||"",label:i.textContent||i.getAttribute("value")||"",disabled:!!i.getAttribute("disabled")};i.getAttribute("selected")&&!this.value&&(this.value=s.value),this._options.push(s)}):this._options=this.options}attributeChangedCallback(e,t,i){e==="options"&&(this._options=i?JSON.parse(i):[]),e==="value"&&this.value!==t&&this.valueChanged(i,t),super.attributeChangedCallback(e,t,i)}updated(e){var t;super.updated(e),e.has("value")&&(this.counterCurrent=((t=this.value)==null?void 0:t.length)||0,this.valueChanged(this.value,e.get("value"))),e.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(e){super.firstUpdated(e),this.options.length&&(this._options=this.options)}render(){const e=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return r.x`
|
|
2
|
+
<pkt-input-wrapper
|
|
3
|
+
?counter=${this.counter}
|
|
4
|
+
?disabled=${this.disabled}
|
|
5
|
+
?hasError=${this.hasError}
|
|
6
|
+
?hasFieldset=${this.hasFieldset}
|
|
7
|
+
?inline=${this.inline}
|
|
8
|
+
?optionalTag=${this.optionalTag}
|
|
9
|
+
?requiredTag=${this.requiredTag}
|
|
10
|
+
?useWrapper=${this.useWrapper}
|
|
11
|
+
ariaDescribedBy=${o.o(this.ariaDescribedBy)}
|
|
12
|
+
.counterCurrent=${this.counterCurrent}
|
|
13
|
+
.counterMaxLength=${this.counterMaxLength}
|
|
14
|
+
class="pkt-select"
|
|
15
|
+
errorMessage=${o.o(this.errorMessage)}
|
|
16
|
+
forId=${this.id+"-input"}
|
|
17
|
+
helptext=${o.o(this.helptext)}
|
|
18
|
+
helptextDropdown=${o.o(this.helptextDropdown)}
|
|
19
|
+
helptextDropdownButton=${o.o(this.helptextDropdownButton)}
|
|
20
|
+
label=${o.o(this.label)}
|
|
21
|
+
optionalText=${o.o(this.optionalText)}
|
|
22
|
+
requiredText=${o.o(this.requiredText)}
|
|
23
|
+
>
|
|
24
|
+
<select
|
|
25
|
+
class=${e}
|
|
26
|
+
aria-invalid=${this.hasError}
|
|
27
|
+
aria-errormessage=${`${this.id}-error`}
|
|
28
|
+
aria-labelledby=${o.o(this.ariaLabelledby)}
|
|
29
|
+
?disabled=${this.disabled}
|
|
30
|
+
id=${this.id+"-input"}
|
|
31
|
+
name=${(this.name||this.id)+"-input"}
|
|
32
|
+
value=${this.value}
|
|
33
|
+
@change=${t=>{this.value=t.target.value,t.stopImmediatePropagation()}}
|
|
34
|
+
@input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
|
|
35
|
+
@focus=${t=>{this.onFocus(),t.stopImmediatePropagation()}}
|
|
36
|
+
@blur=${t=>{this.onBlur(),t.stopImmediatePropagation()}}
|
|
37
|
+
${l.n(this.inputRef)}
|
|
38
|
+
>
|
|
39
|
+
${this._options.length>0&&this._options.map(t=>r.x`<option
|
|
40
|
+
value=${t.value}
|
|
41
|
+
?selected=${this.value==t.value}
|
|
42
|
+
?disabled=${t.disabled}
|
|
43
|
+
>
|
|
44
|
+
${t.label}
|
|
45
|
+
</option>`)}
|
|
46
|
+
</select>
|
|
47
|
+
<div class="pkt-contents" ${l.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
48
|
+
</pkt-input-wrapper>
|
|
49
|
+
`}};n([r.n({type:Array})],exports.PktSelect.prototype,"options",2);n([r.n({type:String,reflect:!0})],exports.PktSelect.prototype,"value",2);n([u.r()],exports.PktSelect.prototype,"_options",2);exports.PktSelect=n([r.t("pkt-select")],exports.PktSelect);
|
package/dist/select.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,18 @@
|
|
|
1
|
+
"use strict";const u=require("./class-map-DvBKxTiW.cjs"),t=require("./element-DJpGVXjq.cjs"),k=require("./state-C4LdlTYO.cjs"),g=require("./pkt-slot-controller-plQxXRvV.cjs"),c=require("./ref-CLqTsViF.cjs");require("./icon-UtDKPH3R.cjs");const h=require("./if-defined-CoBDkDGb.cjs"),f={closeTag:{default:!1},size:{default:"medium"},skin:{default:"blue"},type:{default:"button"}},r={props:f};var d=Object.defineProperty,y=Object.getOwnPropertyDescriptor,i=(n,e,o,a)=>{for(var s=a>1?void 0:a?y(e,o):e,l=n.length-1,p;l>=0;l--)(p=n[l])&&(s=(a?p(e,o,s):p(s))||s);return a&&s&&d(e,o,s),s};exports.PktTag=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),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._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!0,composed:!0}))},this.slotController=new g.PktSlotController(this,this.defaultSlot),this._isClosed=!1}firstUpdated(e){var o,a;if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){const s=(a=(o=this.defaultSlot.value)==null?void 0:o.textContent)==null?void 0:a.trim();s&&(this._ariaDescription=`Klikk for å fjerne ${s}`)}}render(){const e={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},o={"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.x`
|
|
2
|
+
<button
|
|
3
|
+
class=${u.e(o)}
|
|
4
|
+
type=${this.type}
|
|
5
|
+
@click=${this.close}
|
|
6
|
+
aria-label=${h.o(this.ariaLabel||void 0)}
|
|
7
|
+
aria-description=${h.o(this._ariaDescription||void 0)}
|
|
8
|
+
>
|
|
9
|
+
${this.iconName&&t.x`<pkt-icon class="pkt-tag__icon" name=${this.iconName}></pkt-icon>`}
|
|
10
|
+
<span ${c.n(this.defaultSlot)}></span>
|
|
11
|
+
<pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
|
|
12
|
+
</button>
|
|
13
|
+
`:t.x`
|
|
14
|
+
<span class=${u.e(e)}>
|
|
15
|
+
${this.iconName&&t.x`<pkt-icon class="pkt-tag__icon" name=${this.iconName}></pkt-icon>`}
|
|
16
|
+
<span ${c.n(this.defaultSlot)}></span>
|
|
17
|
+
</span>
|
|
18
|
+
`}};i([t.n({type:Boolean,reflect:!0})],exports.PktTag.prototype,"closeTag",2);i([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"size",2);i([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"skin",2);i([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"textStyle",2);i([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"iconName",2);i([t.n({type:String})],exports.PktTag.prototype,"type",2);i([t.n({type:String})],exports.PktTag.prototype,"ariaLabel",2);i([k.r()],exports.PktTag.prototype,"_isClosed",2);i([k.r()],exports.PktTag.prototype,"_ariaDescription",2);exports.PktTag=i([t.t("pkt-tag")],exports.PktTag);
|
|
@@ -1,81 +1,32 @@
|
|
|
1
|
-
import { e as
|
|
2
|
-
import { P as
|
|
3
|
-
import { r as
|
|
4
|
-
import { P as
|
|
5
|
-
import { e as b, n as f } from "./ref-
|
|
6
|
-
import "./icon-
|
|
7
|
-
import { o as d } from "./if-defined-
|
|
8
|
-
const _ =
|
|
1
|
+
import { e as u } from "./class-map-D4tSZX70.js";
|
|
2
|
+
import { P as m, x as l, n as r, a as g } from "./element-DiqKrDty.js";
|
|
3
|
+
import { r as k } from "./state-CDwPbiQj.js";
|
|
4
|
+
import { P as y } from "./pkt-slot-controller-BtVLTZb7.js";
|
|
5
|
+
import { e as b, n as f } from "./ref-B70YZNXm.js";
|
|
6
|
+
import "./icon-BdY52BIt.js";
|
|
7
|
+
import { o as d } from "./if-defined-DeANa4n5.js";
|
|
8
|
+
const _ = {
|
|
9
9
|
closeTag: {
|
|
10
|
-
type: "boolean",
|
|
11
|
-
required: !1,
|
|
12
10
|
default: !1
|
|
13
11
|
},
|
|
14
12
|
size: {
|
|
15
|
-
|
|
16
|
-
default: "medium",
|
|
17
|
-
type: [
|
|
18
|
-
"small",
|
|
19
|
-
"medium",
|
|
20
|
-
"large"
|
|
21
|
-
]
|
|
22
|
-
},
|
|
23
|
-
iconName: {
|
|
24
|
-
type: "icon",
|
|
25
|
-
required: !1
|
|
13
|
+
default: "medium"
|
|
26
14
|
},
|
|
27
15
|
skin: {
|
|
28
|
-
|
|
29
|
-
default: "blue",
|
|
30
|
-
type: [
|
|
31
|
-
"blue",
|
|
32
|
-
"blue-light",
|
|
33
|
-
"blue-dark",
|
|
34
|
-
"green",
|
|
35
|
-
"red",
|
|
36
|
-
"beige",
|
|
37
|
-
"yellow",
|
|
38
|
-
"gray"
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
|
-
textStyle: {
|
|
42
|
-
required: !1,
|
|
43
|
-
default: "normal-text",
|
|
44
|
-
type: [
|
|
45
|
-
"thin-text",
|
|
46
|
-
"normal-text"
|
|
47
|
-
]
|
|
16
|
+
default: "blue"
|
|
48
17
|
},
|
|
49
18
|
type: {
|
|
50
|
-
|
|
51
|
-
default: "button",
|
|
52
|
-
type: [
|
|
53
|
-
"button",
|
|
54
|
-
"submit",
|
|
55
|
-
"reset"
|
|
56
|
-
]
|
|
57
|
-
},
|
|
58
|
-
ariaLabel: {
|
|
59
|
-
type: "string",
|
|
60
|
-
required: !1
|
|
61
|
-
}
|
|
62
|
-
}, x = {
|
|
63
|
-
default: {
|
|
64
|
-
description: "Teksten til tag"
|
|
19
|
+
default: "button"
|
|
65
20
|
}
|
|
66
21
|
}, n = {
|
|
67
|
-
|
|
68
|
-
"css-class": "pkt-tag",
|
|
69
|
-
isElement: $,
|
|
70
|
-
props: S,
|
|
71
|
-
slots: x
|
|
22
|
+
props: _
|
|
72
23
|
};
|
|
73
|
-
var
|
|
74
|
-
for (var a = o > 1 ? void 0 : o ?
|
|
75
|
-
(
|
|
76
|
-
return o && a &&
|
|
24
|
+
var $ = Object.defineProperty, S = Object.getOwnPropertyDescriptor, e = (s, i, p, o) => {
|
|
25
|
+
for (var a = o > 1 ? void 0 : o ? S(i, p) : i, c = s.length - 1, h; c >= 0; c--)
|
|
26
|
+
(h = s[c]) && (a = (o ? h(i, p, a) : h(a)) || a);
|
|
27
|
+
return o && a && $(i, p, a), a;
|
|
77
28
|
};
|
|
78
|
-
let t = class extends
|
|
29
|
+
let t = class extends m {
|
|
79
30
|
constructor() {
|
|
80
31
|
super(), this.defaultSlot = b(), this.closeTag = n.props.closeTag.default, this.size = n.props.size.default, this.skin = n.props.skin.default, this.textStyle = null, this.iconName = void 0, this.type = n.props.type.default, this.ariaLabel = null, this._isClosed = !1, this._ariaDescription = null, this.close = (s) => {
|
|
81
32
|
this._isClosed = !0, this.dispatchEvent(
|
|
@@ -83,15 +34,15 @@ let t = class extends y {
|
|
|
83
34
|
), this.dispatchEvent(
|
|
84
35
|
new CustomEvent("on-close", { detail: { origin: s }, bubbles: !0, composed: !0 })
|
|
85
36
|
);
|
|
86
|
-
}, this.slotController = new
|
|
37
|
+
}, this.slotController = new y(this, this.defaultSlot), this._isClosed = !1;
|
|
87
38
|
}
|
|
88
39
|
/**
|
|
89
40
|
* Lifecycle
|
|
90
41
|
*/
|
|
91
42
|
firstUpdated(s) {
|
|
92
|
-
var i,
|
|
43
|
+
var i, p;
|
|
93
44
|
if (super.firstUpdated(s), this.closeTag && !this.ariaLabel) {
|
|
94
|
-
const o = (
|
|
45
|
+
const o = (p = (i = this.defaultSlot.value) == null ? void 0 : i.textContent) == null ? void 0 : p.trim();
|
|
95
46
|
o && (this._ariaDescription = `Klikk for å fjerne ${o}`);
|
|
96
47
|
}
|
|
97
48
|
}
|
|
@@ -111,21 +62,21 @@ let t = class extends y {
|
|
|
111
62
|
"pkt-btn--icons-right-and-left": this.closeTag && !!this.iconName,
|
|
112
63
|
"pkt-hide": this._isClosed
|
|
113
64
|
};
|
|
114
|
-
return this.closeTag ?
|
|
65
|
+
return this.closeTag ? l`
|
|
115
66
|
<button
|
|
116
|
-
class=${
|
|
67
|
+
class=${u(i)}
|
|
117
68
|
type=${this.type}
|
|
118
69
|
@click=${this.close}
|
|
119
70
|
aria-label=${d(this.ariaLabel || void 0)}
|
|
120
71
|
aria-description=${d(this._ariaDescription || void 0)}
|
|
121
72
|
>
|
|
122
|
-
${this.iconName &&
|
|
73
|
+
${this.iconName && l`<pkt-icon class="pkt-tag__icon" name=${this.iconName}></pkt-icon>`}
|
|
123
74
|
<span ${f(this.defaultSlot)}></span>
|
|
124
75
|
<pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
|
|
125
76
|
</button>
|
|
126
|
-
` :
|
|
127
|
-
<span class=${
|
|
128
|
-
${this.iconName &&
|
|
77
|
+
` : l`
|
|
78
|
+
<span class=${u(s)}>
|
|
79
|
+
${this.iconName && l`<pkt-icon class="pkt-tag__icon" name=${this.iconName}></pkt-icon>`}
|
|
129
80
|
<span ${f(this.defaultSlot)}></span>
|
|
130
81
|
</span>
|
|
131
82
|
`;
|
|
@@ -153,10 +104,10 @@ e([
|
|
|
153
104
|
r({ type: String })
|
|
154
105
|
], t.prototype, "ariaLabel", 2);
|
|
155
106
|
e([
|
|
156
|
-
|
|
107
|
+
k()
|
|
157
108
|
], t.prototype, "_isClosed", 2);
|
|
158
109
|
e([
|
|
159
|
-
|
|
110
|
+
k()
|
|
160
111
|
], t.prototype, "_ariaDescription", 2);
|
|
161
112
|
t = e([
|
|
162
113
|
g("pkt-tag")
|
package/dist/tag.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,22 +1,23 @@
|
|
|
1
|
-
import { T as l, E as $, x as f, n as d, a as g } from "./element-
|
|
2
|
-
import { o as u } from "./if-defined-
|
|
3
|
-
import { r as x } from "./state-
|
|
4
|
-
import {
|
|
5
|
-
import { e as
|
|
6
|
-
import { e as
|
|
7
|
-
import {
|
|
8
|
-
import { P as
|
|
9
|
-
import "./
|
|
10
|
-
import "./
|
|
1
|
+
import { T as l, E as $, x as f, n as d, a as g } from "./element-DiqKrDty.js";
|
|
2
|
+
import { o as u } from "./if-defined-DeANa4n5.js";
|
|
3
|
+
import { r as x } from "./state-CDwPbiQj.js";
|
|
4
|
+
import { e as m, n as c } from "./ref-B70YZNXm.js";
|
|
5
|
+
import { e as v } from "./class-map-D4tSZX70.js";
|
|
6
|
+
import { e as b, i as T, t as a } from "./directive-oAbCiebi.js";
|
|
7
|
+
import { f as y, m as w } from "./directive-helpers-BmXIK-1b.js";
|
|
8
|
+
import { P as C } from "./input-element-C4mmTk6h.js";
|
|
9
|
+
import { P as E } from "./pkt-slot-controller-BtVLTZb7.js";
|
|
10
|
+
import "./input-wrapper-P_oEi6dk.js";
|
|
11
|
+
import "./icon-BdY52BIt.js";
|
|
11
12
|
/**
|
|
12
13
|
* @license
|
|
13
14
|
* Copyright 2020 Google LLC
|
|
14
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
15
16
|
*/
|
|
16
|
-
const P =
|
|
17
|
+
const P = b(class extends T {
|
|
17
18
|
constructor(t) {
|
|
18
19
|
if (super(t), t.type !== a.PROPERTY && t.type !== a.ATTRIBUTE && t.type !== a.BOOLEAN_ATTRIBUTE) throw Error("The `live` directive is not allowed on child or event bindings");
|
|
19
|
-
if (!
|
|
20
|
+
if (!y(t)) throw Error("`live` bindings can only contain a single expression");
|
|
20
21
|
}
|
|
21
22
|
render(t) {
|
|
22
23
|
return t;
|
|
@@ -29,7 +30,7 @@ const P = y(class extends w {
|
|
|
29
30
|
} else if (t.type === a.BOOLEAN_ATTRIBUTE) {
|
|
30
31
|
if (!!r === e.hasAttribute(i)) return l;
|
|
31
32
|
} else if (t.type === a.ATTRIBUTE && e.getAttribute(i) === r + "") return l;
|
|
32
|
-
return
|
|
33
|
+
return w(t), r;
|
|
33
34
|
}
|
|
34
35
|
});
|
|
35
36
|
var B = Object.defineProperty, I = Object.getOwnPropertyDescriptor, n = (t, r, e, i) => {
|
|
@@ -39,7 +40,7 @@ var B = Object.defineProperty, I = Object.getOwnPropertyDescriptor, n = (t, r, e
|
|
|
39
40
|
};
|
|
40
41
|
let o = class extends C {
|
|
41
42
|
constructor() {
|
|
42
|
-
super(), this.inputRef =
|
|
43
|
+
super(), this.inputRef = m(), this.helptextSlot = m(), this.value = "", this.autocomplete = "off", this.rows = null, this.counterCurrent = 0, this.slotController = new E(this, this.helptextSlot);
|
|
43
44
|
}
|
|
44
45
|
attributeChangedCallback(t, r, e) {
|
|
45
46
|
t === "value" && this.value !== r && (this.counterCurrent = e ? e.length : 0, this.valueChanged(e, r)), super.attributeChangedCallback(t, r, e);
|
|
@@ -49,7 +50,7 @@ let o = class extends C {
|
|
|
49
50
|
super.updated(t), t.has("value") && (this.counterCurrent = ((r = this.value) == null ? void 0 : r.length) || 0, this.valueChanged(this.value, t.get("value"))), t.has("id") && !this.name && this.id && (this.name = this.id);
|
|
50
51
|
}
|
|
51
52
|
render() {
|
|
52
|
-
const t =
|
|
53
|
+
const t = v({
|
|
53
54
|
"pkt-input": !0,
|
|
54
55
|
"pkt-input--fullwidth": this.fullwidth,
|
|
55
56
|
"pkt-input--counter-error": this.counter && this.counterMaxLength && this.value.length && this.value.length > this.counterMaxLength
|
|
@@ -76,9 +77,9 @@ let o = class extends C {
|
|
|
76
77
|
.requiredText=${this.requiredText}
|
|
77
78
|
class="pkt-textarea"
|
|
78
79
|
>
|
|
79
|
-
<div class="pkt-contents" ${
|
|
80
|
+
<div class="pkt-contents" ${c(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
80
81
|
<textarea
|
|
81
|
-
${
|
|
82
|
+
${c(this.inputRef)}
|
|
82
83
|
class=${t}
|
|
83
84
|
id=${this.id + "-input"}
|
|
84
85
|
name=${(this.name || this.id) + "-input"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";const s=require("./element-
|
|
1
|
+
"use strict";const s=require("./element-DJpGVXjq.cjs"),p=require("./if-defined-CoBDkDGb.cjs"),c=require("./state-C4LdlTYO.cjs"),l=require("./ref-CLqTsViF.cjs"),$=require("./class-map-DvBKxTiW.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-donnvcEO.cjs"),x=require("./input-element-VNai8bsq.cjs"),T=require("./pkt-slot-controller-plQxXRvV.cjs");require("./input-wrapper-DWOw7Yn-.cjs");require("./icon-UtDKPH3R.cjs");/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2020 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const
|
|
5
|
+
*/const g=a.e(class extends a.i{constructor(r){if(super(r),r.type!==a.t.PROPERTY&&r.type!==a.t.ATTRIBUTE&&r.type!==a.t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!d.f(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(r,[e]){if(e===s.T||e===s.E)return e;const i=r.element,t=r.name;if(r.type===a.t.PROPERTY){if(e===i[t])return s.T}else if(r.type===a.t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(t))return s.T}else if(r.type===a.t.ATTRIBUTE&&i.getAttribute(t)===e+"")return s.T;return d.m(r),e}});var v=Object.defineProperty,f=Object.getOwnPropertyDescriptor,o=(r,e,i,t)=>{for(var n=t>1?void 0:t?f(e,i):e,u=r.length-1,h;u>=0;u--)(h=r[u])&&(n=(t?h(e,i,n):h(n))||n);return t&&n&&v(e,i,n),n};exports.PktTextarea=class extends x.PktInputElement{constructor(){super(),this.inputRef=l.e(),this.helptextSlot=l.e(),this.value="",this.autocomplete="off",this.rows=null,this.counterCurrent=0,this.slotController=new T.PktSlotController(this,this.helptextSlot)}attributeChangedCallback(e,i,t){e==="value"&&this.value!==i&&(this.counterCurrent=t?t.length:0,this.valueChanged(t,i)),super.attributeChangedCallback(e,i,t)}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=$.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 s.x`<pkt-input-wrapper
|
|
6
6
|
label=${this.label}
|
|
7
7
|
?counter=${this.counter}
|
|
8
8
|
?disabled=${this.disabled}
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
.requiredText=${this.requiredText}
|
|
25
25
|
class="pkt-textarea"
|
|
26
26
|
>
|
|
27
|
-
<div class="pkt-contents" ${
|
|
27
|
+
<div class="pkt-contents" ${l.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
28
28
|
<textarea
|
|
29
|
-
${
|
|
29
|
+
${l.n(this.inputRef)}
|
|
30
30
|
class=${e}
|
|
31
31
|
id=${this.id+"-input"}
|
|
32
32
|
name=${(this.name||this.id)+"-input"}
|
|
33
33
|
placeholder=${p.o(this.placeholder)}
|
|
34
|
-
.value=${
|
|
34
|
+
.value=${g(this.value)}
|
|
35
35
|
minlength=${p.o(this.minlength)}
|
|
36
36
|
maxlength=${p.o(this.maxlength)}
|
|
37
37
|
?readonly=${this.readonly}
|
|
@@ -46,4 +46,4 @@
|
|
|
46
46
|
@focus=${t=>{this.onFocus(),t.stopImmediatePropagation()}}
|
|
47
47
|
@blur=${t=>{this.value=t.target.value,this.onBlur(),t.stopImmediatePropagation()}}
|
|
48
48
|
></textarea>
|
|
49
|
-
</pkt-input-wrapper>`}};
|
|
49
|
+
</pkt-input-wrapper>`}};o([s.n({type:String,reflect:!0})],exports.PktTextarea.prototype,"value",2);o([s.n({type:String})],exports.PktTextarea.prototype,"autocomplete",2);o([s.n({type:Number})],exports.PktTextarea.prototype,"rows",2);o([c.r()],exports.PktTextarea.prototype,"counterCurrent",2);exports.PktTextarea=o([s.t("pkt-textarea")],exports.PktTextarea);
|
package/dist/textarea.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,9 +1,10 @@
|
|
|
1
|
-
"use strict";const t=require("./element-
|
|
1
|
+
"use strict";const t=require("./element-DJpGVXjq.cjs"),u=require("./if-defined-CoBDkDGb.cjs"),l=require("./state-C4LdlTYO.cjs"),p=require("./ref-CLqTsViF.cjs"),c=require("./class-map-DvBKxTiW.cjs"),d=require("./input-element-VNai8bsq.cjs"),x=require("./pkt-slot-controller-plQxXRvV.cjs");require("./input-wrapper-DWOw7Yn-.cjs");require("./icon-UtDKPH3R.cjs");var $=Object.defineProperty,g=Object.getOwnPropertyDescriptor,r=(o,i,s,n)=>{for(var e=n>1?void 0:n?g(i,s):i,a=o.length-1,h;a>=0;a--)(h=o[a])&&(e=(n?h(i,s,e):h(e))||e);return n&&e&&$(i,s,e),e};exports.PktTextinput=class extends d.PktInputElement{constructor(){super(),this.inputRef=p.e(),this.helptextSlot=p.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,this.slotController=new x.PktSlotController(this,this.helptextSlot)}attributeChangedCallback(i,s,n){i==="value"&&this.value!==s&&(this.counterCurrent=n?n.length:0,this.valueChanged(n,s)),super.attributeChangedCallback(i,s,n)}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=c.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}),n=this.ariaLabelledby||`${this.id}-input-label`;return t.x`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
3
|
label="${this.label}"
|
|
4
4
|
?counter=${this.counter}
|
|
5
5
|
?disabled=${this.disabled}
|
|
6
6
|
?hasError=${this.hasError}
|
|
7
|
+
?hasFieldset=${this.hasFieldset}
|
|
7
8
|
?inline=${this.inline}
|
|
8
9
|
?optionalTag=${this.optionalTag}
|
|
9
10
|
?required=${this.required}
|
|
@@ -26,13 +27,13 @@
|
|
|
26
27
|
${this.prefix?t.x`<div class="pkt-input-prefix">${this.prefix}</div>`:t.E}
|
|
27
28
|
<input
|
|
28
29
|
${p.n(this.inputRef)}
|
|
29
|
-
class=${
|
|
30
|
+
class=${s}
|
|
30
31
|
type=${this.type}
|
|
31
32
|
name=${(this.name||this.id)+"-input"}
|
|
32
33
|
id=${this.id+"-input"}
|
|
33
34
|
placeholder=${u.o(this.placeholder)}
|
|
34
|
-
aria-labelledby=${
|
|
35
|
-
autocomplete=${this.autocomplete}
|
|
35
|
+
aria-labelledby=${n}
|
|
36
|
+
autocomplete=${this.autocomplete||"off"}
|
|
36
37
|
minlength=${u.o(this.minlength)}
|
|
37
38
|
maxlength=${u.o(this.maxlength)}
|
|
38
39
|
?readonly=${this.readonly}
|