@oslokommune/punkt-elements 12.42.7 → 12.42.9
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 +34 -0
- package/dist/{accordionitem-Dz6jwPpb.cjs → accordionitem-C4NQFQHo.cjs} +1 -1
- package/dist/{accordionitem-DkE9or0K.js → accordionitem-aQHOrGzf.js} +1 -1
- package/dist/{alert-BY97zZYx.cjs → alert-DUWuhtFC.cjs} +1 -1
- package/dist/{alert-oh7nc3ip.js → alert-sBHt7DSh.js} +1 -1
- package/dist/{button-OLSvT2Im.js → button-B4Oe8Ar0.js} +62 -47
- package/dist/button-BT-FRGMk.cjs +19 -0
- package/dist/{card-BxHlJq4J.js → card-0Kf9L0A_.js} +2 -2
- package/dist/{card-CmdIb2X9.cjs → card-CXhVAeOG.cjs} +1 -1
- package/dist/{combobox-hYeZxIku.js → combobox-CsFDvh8U.js} +4 -4
- package/dist/{combobox-CZJrOopi.cjs → combobox-Dq7F5v-u.cjs} +1 -1
- package/dist/{consent-ChCTj6FB.js → consent-B17ZIuwm.js} +1 -1
- package/dist/{consent-B7w1--m7.cjs → consent-CILYIgC-.cjs} +1 -1
- package/dist/{datepicker-Cf45KOxr.js → datepicker-Cz6seIz1.js} +3 -3
- package/dist/{datepicker-CE5oM9D3.cjs → datepicker-DOf9XK9v.cjs} +1 -1
- package/dist/{heading-Bxonbv8M.js → heading-CGGKEZve.js} +1 -1
- package/dist/{heading-CxJ0IqpU.cjs → heading-Cmh5bbTl.cjs} +1 -1
- package/dist/helptext-BG_b6ytC.js +87 -0
- package/dist/helptext-CC3qLmEz.cjs +24 -0
- package/dist/index.d.ts +3 -2
- package/dist/{input-wrapper-DnyRiuHR.js → input-wrapper-CC_R5w7V.js} +61 -68
- package/dist/input-wrapper-Dk0rKRlz.cjs +53 -0
- package/dist/{link-Qj1bJCPw.js → link-C9X0huxP.js} +1 -1
- package/dist/{link-BWJrqWi7.cjs → link-qTz-qNVI.cjs} +1 -1
- package/dist/{linkcard-Byt10fUI.js → linkcard-Bhk2ttou.js} +1 -1
- package/dist/{linkcard-0KLDuaGM.cjs → linkcard-CaBz6i7A.cjs} +1 -1
- package/dist/{loader--5h6NKGl.cjs → loader-BqYcg8Di.cjs} +1 -1
- package/dist/{loader-xkMMWgaj.js → loader-DMp859px.js} +1 -1
- package/dist/{messagebox-IJOkv427.cjs → messagebox-Do_nAUo3.cjs} +1 -1
- package/dist/{messagebox-BLTBG8nD.js → messagebox-_1f12rDq.js} +1 -1
- package/dist/{modal-CBURcXBd.cjs → modal-C1inKvts.cjs} +1 -1
- package/dist/{modal-C6ljjVs6.js → modal-C3kEgTMj.js} +1 -1
- 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 +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +20 -20
- 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-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-CZO1nxZ8.js +39 -0
- package/dist/pkt-options-controller-CiuBG6Lt.cjs +1 -0
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/{pkt-slot-controller-DtDaD9q_.js → pkt-slot-controller-BPGj-LC5.js} +39 -28
- package/dist/pkt-slot-controller-BzddBp7z.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/{select-BNGnC2U9.cjs → select-BkVSXR5K.cjs} +1 -1
- package/dist/{select-Drl_8-OU.js → select-BlL8T2BX.js} +18 -18
- package/dist/{tag-lU4vz70a.cjs → tag-DrbI0ng3.cjs} +1 -1
- package/dist/{tag-CX-zbR-7.js → tag-m7OTZaCG.js} +1 -1
- package/dist/{textarea-DcpZnWkt.cjs → textarea-Dc1sUaxx.cjs} +1 -1
- package/dist/{textarea-CctE69uw.js → textarea-Dk8hQMD2.js} +2 -2
- package/dist/{textinput-BAPxDvKu.js → textinput-6Ip-0aVY.js} +2 -2
- package/dist/{textinput-DcES1ibY.cjs → textinput-DuLZ26DB.cjs} +1 -1
- package/package.json +3 -3
- package/src/components/button/button.ts +28 -2
- package/src/components/helptext/helptext.ts +13 -1
- package/src/components/input-wrapper/input-wrapper.ts +1 -10
- package/src/components/select/select.ts +1 -1
- package/dist/button-KzBZ-Bff.cjs +0 -19
- package/dist/helptext-AqNI_oFG.cjs +0 -24
- package/dist/helptext-DBearL3P.js +0 -78
- package/dist/input-wrapper-Uw7_cZ4w.cjs +0 -53
- package/dist/pkt-options-controller-C_Yl_3P6.js +0 -39
- package/dist/pkt-options-controller-ftMgG5DP.cjs +0 -1
- package/dist/pkt-slot-controller-Da-RgXfS.cjs +0 -1
package/dist/button-KzBZ-Bff.cjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("./element-90YeMNbV.cjs"),h=require("./pkt-slot-controller-Da-RgXfS.cjs"),u=require("./class-map-DWDPOqjO.cjs"),a=require("./if-defined-C8eotHpL.cjs"),d=require("./ref-B-w1vCo8.cjs");var c=Object.defineProperty,k=Object.getOwnPropertyDescriptor,i=(r,n,o,e)=>{for(var s=e>1?void 0:e?k(n,o):n,p=r.length-1,l;p>=0;p--)(l=r[p])&&(s=(e?l(n,o,s):l(s))||s);return e&&s&&c(n,o,s),s};window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/latest/animations/";exports.PktButton=class extends t.PktElement{constructor(){super(),this.defaultSlot=d.e(),this.iconName="user",this.secondIconName="user",this.mode="light",this.size="medium",this.skin="primary",this.variant="label-only",this.state="normal",this.type="button",this.form=void 0,this.isLoading=!1,this.disabled=!1,this.loadingAnimationPath=window.pktAnimationPath,this.slotController=new h.PktSlotController(this,this.defaultSlot)}attributeChangedCallback(n,o,e){super.attributeChangedCallback(n,o,e),n==="disabled"&&e==="false"&&(this.disabled=!1),(n==="isloading"||n==="isLoading")&&e==="false"&&(this.isLoading=!1)}firstUpdated(n){super.firstUpdated(n),this.disabled==="false"&&(this.disabled=!1),this.isLoading==="false"&&(this.isLoading=!1)}render(){const n=this.form??this.getAttribute("form")??void 0,o={"pkt-btn":!0,[`pkt-btn--${this.size}`]:!!this.size,[`pkt-btn--${this.skin}`]:!!this.skin,[`pkt-btn--${this.variant}`]:!!this.variant,[`pkt-btn--${this.color}`]:!!this.color,[`pkt-btn--${this.state}`]:!!this.state,"pkt-btn--disabled":!!this.disabled,"pkt-btn--isLoading":!!this.isLoading};return t.x`
|
|
2
|
-
<button
|
|
3
|
-
class=${u.e(o)}
|
|
4
|
-
type=${this.type}
|
|
5
|
-
?disabled=${!!this.disabled}
|
|
6
|
-
aria-busy=${a.o(this.isLoading?"true":void 0)}
|
|
7
|
-
aria-disabled=${a.o(this.disabled?"true":void 0)}
|
|
8
|
-
form=${a.o(n)}
|
|
9
|
-
>
|
|
10
|
-
${this.isLoading?t.x`<pkt-icon
|
|
11
|
-
class="pkt-btn__icon pkt-btn__spinner"
|
|
12
|
-
name="spinner-blue"
|
|
13
|
-
path=${a.o(this.loadingAnimationPath)}
|
|
14
|
-
></pkt-icon>`:t.E}
|
|
15
|
-
${this.variant!=="label-only"?t.x`<pkt-icon class="pkt-btn__icon pkt-icon" name=${this.iconName}></pkt-icon>`:t.E}
|
|
16
|
-
<span class="pkt-btn__text" ${d.n(this.defaultSlot)}></span>
|
|
17
|
-
${this.variant==="icons-right-and-left"?t.x`<pkt-icon class="pkt-btn__icon" name=${this.secondIconName}></pkt-icon>`:t.E}
|
|
18
|
-
</button>
|
|
19
|
-
`}};i([t.n({type:String})],exports.PktButton.prototype,"iconName",2);i([t.n({type:String})],exports.PktButton.prototype,"secondIconName",2);i([t.n({type:String})],exports.PktButton.prototype,"mode",2);i([t.n({type:String})],exports.PktButton.prototype,"size",2);i([t.n({type:String})],exports.PktButton.prototype,"color",2);i([t.n({type:String})],exports.PktButton.prototype,"skin",2);i([t.n({type:String})],exports.PktButton.prototype,"variant",2);i([t.n({type:String,reflect:!0})],exports.PktButton.prototype,"state",2);i([t.n({type:String})],exports.PktButton.prototype,"type",2);i([t.n({type:String})],exports.PktButton.prototype,"form",2);i([t.n({type:Boolean,reflect:!0})],exports.PktButton.prototype,"isLoading",2);i([t.n({type:Boolean,reflect:!0})],exports.PktButton.prototype,"disabled",2);i([t.n({type:String})],exports.PktButton.prototype,"loadingAnimationPath",2);exports.PktButton=i([t.t("pkt-button")],exports.PktButton);
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./element-90YeMNbV.cjs"),x=require("./ref-B-w1vCo8.cjs"),h=require("./icon-B1_BRNqf.cjs"),u=require("./class-map-DWDPOqjO.cjs"),c=require("./state-D-Recv7U.cjs"),a=require("./stringutils-CkVRq4jP.cjs"),d=require("./input-wrapper-EoSAbU-U.cjs"),k=require("./pkt-slot-controller-Da-RgXfS.cjs");var _=Object.defineProperty,w=Object.getOwnPropertyDescriptor,r=(s,p,l,n)=>{for(var t=n>1?void 0:n?w(p,l):p,o=s.length-1,i;o>=0;o--)(i=s[o])&&(t=(n?i(p,l,t):i(t))||t);return n&&t&&_(p,l,t),t};exports.PktHelptext=class extends e.PktElement{constructor(){super(),this.defaultSlot=x.e(),this.forId=a.uuidish(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=d.specs.props.helptextDropdownButton.default,this.isHelpTextOpen=!1,this.slotController=new k.PktSlotController(this,this.defaultSlot)}render(){const p=()=>{const t=!this.isHelpTextOpen;this.isHelpTextOpen=t,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:t}}))},l=()=>this.helptextDropdown?e.x`<div class="pkt-inputwrapper__helptext-expandable">
|
|
2
|
-
<button
|
|
3
|
-
class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
|
|
4
|
-
type="button"
|
|
5
|
-
@click=${p}
|
|
6
|
-
>
|
|
7
|
-
<pkt-icon
|
|
8
|
-
class="pkt-btn__icon"
|
|
9
|
-
name="${this.isHelpTextOpen?"chevron-thin-up":"chevron-thin-down"}"
|
|
10
|
-
></pkt-icon>
|
|
11
|
-
<span class="pkt-btn__text">${h.o(this.helptextDropdownButton)}</span>
|
|
12
|
-
</button>
|
|
13
|
-
<div
|
|
14
|
-
class="${u.e({"pkt-inputwrapper__helptext":!0,"pkt-inputwrapper__helptext-expandable-open":this.isHelpTextOpen,"pkt-inputwrapper__helptext-expandable-closed":!this.isHelpTextOpen})}"
|
|
15
|
-
>
|
|
16
|
-
${h.o(this.helptextDropdown)}
|
|
17
|
-
</div>
|
|
18
|
-
</div>`:e.E,n=()=>e.x`<div class="pkt-inputwrapper__helptext-container">
|
|
19
|
-
<div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
|
|
20
|
-
<div class="pkt-contents" ${x.n(this.defaultSlot)} name="helptext"></div>
|
|
21
|
-
${this.helptext&&h.o(this.helptext)}
|
|
22
|
-
</div>
|
|
23
|
-
${l()}
|
|
24
|
-
</div>`;return e.x`${n()}`}};r([e.n({type:String,reflect:!0})],exports.PktHelptext.prototype,"forId",2);r([e.n({type:String})],exports.PktHelptext.prototype,"helptext",2);r([e.n({type:String})],exports.PktHelptext.prototype,"helptextDropdown",2);r([e.n({type:String})],exports.PktHelptext.prototype,"helptextDropdownButton",2);r([c.r()],exports.PktHelptext.prototype,"isHelpTextOpen",2);exports.PktHelptext=r([e.t("pkt-helptext")],exports.PktHelptext);
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { P as d, x as a, E as u, n as i, a as c } from "./element-gAd63VwC.js";
|
|
2
|
-
import { e as f, n as m } from "./ref-DnSbnXsj.js";
|
|
3
|
-
import { o as x } from "./icon-CO1TLSs5.js";
|
|
4
|
-
import { e as _ } from "./class-map-m7ZCZ49w.js";
|
|
5
|
-
import { r as w } from "./state-BxrO4zNJ.js";
|
|
6
|
-
import { u as v } from "./stringutils-DJjRa8dG.js";
|
|
7
|
-
import { s as k } from "./input-wrapper-8iKEzDRZ.js";
|
|
8
|
-
import { P as b } from "./pkt-slot-controller-DtDaD9q_.js";
|
|
9
|
-
var D = Object.defineProperty, O = Object.getOwnPropertyDescriptor, n = (r, o, s, t) => {
|
|
10
|
-
for (var e = t > 1 ? void 0 : t ? O(o, s) : o, l = r.length - 1, h; l >= 0; l--)
|
|
11
|
-
(h = r[l]) && (e = (t ? h(o, s, e) : h(e)) || e);
|
|
12
|
-
return t && e && D(o, s, e), e;
|
|
13
|
-
};
|
|
14
|
-
let p = class extends d {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(), this.defaultSlot = f(), this.forId = v(), this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = k.props.helptextDropdownButton.default, this.isHelpTextOpen = !1, this.slotController = new b(this, this.defaultSlot);
|
|
17
|
-
}
|
|
18
|
-
render() {
|
|
19
|
-
const r = () => {
|
|
20
|
-
const t = !this.isHelpTextOpen;
|
|
21
|
-
this.isHelpTextOpen = t, this.dispatchEvent(
|
|
22
|
-
new CustomEvent("toggleHelpText", {
|
|
23
|
-
bubbles: !0,
|
|
24
|
-
detail: { isOpen: t }
|
|
25
|
-
})
|
|
26
|
-
);
|
|
27
|
-
}, o = () => this.helptextDropdown ? a`<div class="pkt-inputwrapper__helptext-expandable">
|
|
28
|
-
<button
|
|
29
|
-
class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
|
|
30
|
-
type="button"
|
|
31
|
-
@click=${r}
|
|
32
|
-
>
|
|
33
|
-
<pkt-icon
|
|
34
|
-
class="pkt-btn__icon"
|
|
35
|
-
name="${this.isHelpTextOpen ? "chevron-thin-up" : "chevron-thin-down"}"
|
|
36
|
-
></pkt-icon>
|
|
37
|
-
<span class="pkt-btn__text">${x(this.helptextDropdownButton)}</span>
|
|
38
|
-
</button>
|
|
39
|
-
<div
|
|
40
|
-
class="${_({
|
|
41
|
-
"pkt-inputwrapper__helptext": !0,
|
|
42
|
-
"pkt-inputwrapper__helptext-expandable-open": this.isHelpTextOpen,
|
|
43
|
-
"pkt-inputwrapper__helptext-expandable-closed": !this.isHelpTextOpen
|
|
44
|
-
})}"
|
|
45
|
-
>
|
|
46
|
-
${x(this.helptextDropdown)}
|
|
47
|
-
</div>
|
|
48
|
-
</div>` : u;
|
|
49
|
-
return a`${a`<div class="pkt-inputwrapper__helptext-container">
|
|
50
|
-
<div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
|
|
51
|
-
<div class="pkt-contents" ${m(this.defaultSlot)} name="helptext"></div>
|
|
52
|
-
${this.helptext && x(this.helptext)}
|
|
53
|
-
</div>
|
|
54
|
-
${o()}
|
|
55
|
-
</div>`}`;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
n([
|
|
59
|
-
i({ type: String, reflect: !0 })
|
|
60
|
-
], p.prototype, "forId", 2);
|
|
61
|
-
n([
|
|
62
|
-
i({ type: String })
|
|
63
|
-
], p.prototype, "helptext", 2);
|
|
64
|
-
n([
|
|
65
|
-
i({ type: String })
|
|
66
|
-
], p.prototype, "helptextDropdown", 2);
|
|
67
|
-
n([
|
|
68
|
-
i({ type: String })
|
|
69
|
-
], p.prototype, "helptextDropdownButton", 2);
|
|
70
|
-
n([
|
|
71
|
-
w()
|
|
72
|
-
], p.prototype, "isHelpTextOpen", 2);
|
|
73
|
-
p = n([
|
|
74
|
-
c("pkt-helptext")
|
|
75
|
-
], p);
|
|
76
|
-
export {
|
|
77
|
-
p as P
|
|
78
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("./element-90YeMNbV.cjs"),x=require("./pkt-slot-controller-Da-RgXfS.cjs"),u=require("./ref-B-w1vCo8.cjs"),g=require("./if-defined-C8eotHpL.cjs"),y=require("./icon-B1_BRNqf.cjs"),c=require("./class-map-DWDPOqjO.cjs"),$=require("./state-D-Recv7U.cjs"),I=require("./stringutils-CkVRq4jP.cjs"),s=require("./input-wrapper-EoSAbU-U.cjs");require("./helptext-AqNI_oFG.cjs");var P=Object.defineProperty,W=Object.getOwnPropertyDescriptor,e=(p,r,n,i)=>{for(var o=i>1?void 0:i?W(r,n):r,l=p.length-1,a;l>=0;l--)(a=p[l])&&(o=(i?a(r,n,o):a(o))||o);return i&&o&&P(r,n,o),o};const E={fromAttribute(p){return p==null?!1:p===""||p==="true"||p===!0?!0:p==="false"||p===!1?!1:!!p},toAttribute(p){return p?"true":"false"}};exports.PktInputWrapper=class extends t.PktElement{constructor(){super(),this.defaultSlot=u.e(),this.helptextSlot=u.e(),this.hasHelptextSlot=!0,this.forId=I.uuidish(),this.label="",this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=s.specs.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.counterError=null,this.counterPosition="bottom",this.optionalTag=s.specs.props.optionalTag.default,this.optionalText=s.specs.props.optionalText.default,this.requiredTag=s.specs.props.requiredTag.default,this.requiredText=s.specs.props.requiredText.default,this.hasError=s.specs.props.hasError.default,this.errorMessage="",this.disabled=s.specs.props.disabled.default,this.inline=s.specs.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=s.specs.props.hasFieldset.default,this.role="group",this.useWrapper=s.specs.props.useWrapper.default,this.slotController=new x.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},n={"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},i=this.ariaDescribedby?this.ariaDescribedby:this.helptext?`${this.forId}-helptext`:t.E,o=()=>this.optionalTag||this.requiredTag?t.x`<span class=${c.e(n)}
|
|
2
|
-
>${this.optionalTag?this.optionalText:this.requiredTag?this.requiredText:t.E}</span
|
|
3
|
-
>`:t.E,l=()=>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} ${o()}
|
|
9
|
-
</legend>`:t.x`<label
|
|
10
|
-
class="pkt-inputwrapper__label"
|
|
11
|
-
for="${this.forId}"
|
|
12
|
-
aria-describedby="${i}"
|
|
13
|
-
id="${this.forId}-label"
|
|
14
|
-
@click=${this.handleLabelClick}
|
|
15
|
-
>${this.label}${o()}</label
|
|
16
|
-
>`:t.x`<label
|
|
17
|
-
for="${this.forId}"
|
|
18
|
-
class="pkt-sr-only"
|
|
19
|
-
aria-describedby="${i}"
|
|
20
|
-
id="${this.forId}-label"
|
|
21
|
-
>
|
|
22
|
-
${this.label}
|
|
23
|
-
</label>`,a=()=>!this.helptext&&!this.hasHelptextSlot&&!this.helptextDropdown?t.E:t.x`
|
|
24
|
-
<pkt-helptext
|
|
25
|
-
class="${g.o(this.useWrapper?void 0:"pkt-hide")}"
|
|
26
|
-
.forId=${this.forId}
|
|
27
|
-
.helptext=${this.helptext}
|
|
28
|
-
.helptextDropdown=${this.helptextDropdown}
|
|
29
|
-
.helptextDropdownButton=${this.helptextDropdownButton||s.specs.props.helptextDropdownButton.default}
|
|
30
|
-
@toggleHelpText=${b=>{this.toggleDropdown(b)}}
|
|
31
|
-
${u.n(this.helptextSlot)}
|
|
32
|
-
name="helptext"
|
|
33
|
-
></pkt-helptext>
|
|
34
|
-
`,h=()=>this.counter?t.x`<div class="pkt-input__counter" aria-live="polite" aria-atomic="true">
|
|
35
|
-
${this.counterError?this.counterError:t.E} ${this.counterCurrent||0}
|
|
36
|
-
${this.counterMaxLength?`/${this.counterMaxLength}`:t.E}
|
|
37
|
-
</div>`:t.E,f=()=>this.hasError&&this.errorMessage?t.x`<div
|
|
38
|
-
role="alert"
|
|
39
|
-
class="pkt-alert pkt-alert--error pkt-alert--compact"
|
|
40
|
-
aria-live="assertive"
|
|
41
|
-
aria-atomic="true"
|
|
42
|
-
id="${this.forId}-error"
|
|
43
|
-
>
|
|
44
|
-
<pkt-icon name="alert-error" class="pkt-alert__icon"></pkt-icon>
|
|
45
|
-
<div class="pkt-alert__text">${y.o(this.errorMessage)}</div>
|
|
46
|
-
</div>`:t.E,d=()=>t.x`
|
|
47
|
-
${l()} ${a()}
|
|
48
|
-
${this.counterPosition==="top"?h():t.E}
|
|
49
|
-
<div class="pkt-contents" ${u.n(this.defaultSlot)}></div>
|
|
50
|
-
${this.counterPosition==="bottom"?h():t.E} ${f()}
|
|
51
|
-
`,k=()=>this.hasFieldset?t.x`<fieldset class="pkt-inputwrapper__fieldset" aria-describedby="${i}">
|
|
52
|
-
${d()}
|
|
53
|
-
</fieldset>`:t.x`<div class="pkt-inputwrapper__fieldset">${d()}</div>`;return t.x`<div class=${c.e(r)}>${k()}</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([$.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:String,reflect:!0})],exports.PktInputWrapper.prototype,"role",2);e([t.n({type:Boolean,reflect:!0,converter:E})],exports.PktInputWrapper.prototype,"useWrapper",2);exports.PktInputWrapper=e([t.t("pkt-input-wrapper")],exports.PktInputWrapper);
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { i as o } from "./pkt-slot-controller-DtDaD9q_.js";
|
|
2
|
-
class d {
|
|
3
|
-
constructor(t) {
|
|
4
|
-
this.nodes = [], this.options = [], this.host = t, this.host.addController(this), this.nodes = [], this.options = [], this.observer = new MutationObserver((e) => this.handleMutations(e));
|
|
5
|
-
}
|
|
6
|
-
hostConnected() {
|
|
7
|
-
Array.from(this.host.childNodes).forEach((t) => {
|
|
8
|
-
(t.nodeName === "OPTION" || t.nodeName === "DATA") && this.addNode(t);
|
|
9
|
-
}), this.observer.observe(this.host, { childList: !0 });
|
|
10
|
-
}
|
|
11
|
-
hostDisconnected() {
|
|
12
|
-
this.observer.disconnect();
|
|
13
|
-
}
|
|
14
|
-
addNode(t) {
|
|
15
|
-
(t.nodeName === "OPTION" || t.nodeName === "DATA") && (t.setAttribute("class", "pkt-hide"), t.setAttribute("role", "presentation"), t.setAttribute("aria-hidden", "true"), t.setAttribute("data-skip", "true"), this.nodes.push(t));
|
|
16
|
-
}
|
|
17
|
-
createOptions() {
|
|
18
|
-
this.options = this.nodes.map((t) => ({
|
|
19
|
-
value: t.hasAttribute("value") ? t.getAttribute("value") ?? "" : t.textContent ?? "",
|
|
20
|
-
label: t.textContent || t.getAttribute("value") || "",
|
|
21
|
-
selected: t.hasAttribute("selected"),
|
|
22
|
-
disabled: t.hasAttribute("disabled"),
|
|
23
|
-
hidden: t.hasAttribute("hidden")
|
|
24
|
-
})), this.host.setAttribute("options", JSON.stringify(this.options));
|
|
25
|
-
}
|
|
26
|
-
handleMutations(t) {
|
|
27
|
-
let e = !1;
|
|
28
|
-
t.forEach((i) => {
|
|
29
|
-
i.type === "childList" && (i.addedNodes.forEach((s) => {
|
|
30
|
-
o(s) && (this.addNode(s), e = !0);
|
|
31
|
-
}), i.removedNodes.forEach((s) => {
|
|
32
|
-
o(s) && (this.nodes = this.nodes.filter((r) => r !== s), e = !0);
|
|
33
|
-
}));
|
|
34
|
-
}), e && this.createOptions();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export {
|
|
38
|
-
d as P
|
|
39
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const o=require("./pkt-slot-controller-Da-RgXfS.cjs");class h{constructor(t){this.nodes=[],this.options=[],this.host=t,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(e=>this.handleMutations(e))}hostConnected(){Array.from(this.host.childNodes).forEach(t=>{(t.nodeName==="OPTION"||t.nodeName==="DATA")&&this.addNode(t)}),this.observer.observe(this.host,{childList:!0})}hostDisconnected(){this.observer.disconnect()}addNode(t){(t.nodeName==="OPTION"||t.nodeName==="DATA")&&(t.setAttribute("class","pkt-hide"),t.setAttribute("role","presentation"),t.setAttribute("aria-hidden","true"),t.setAttribute("data-skip","true"),this.nodes.push(t))}createOptions(){this.options=this.nodes.map(t=>({value:t.hasAttribute("value")?t.getAttribute("value")??"":t.textContent??"",label:t.textContent||t.getAttribute("value")||"",selected:t.hasAttribute("selected"),disabled:t.hasAttribute("disabled"),hidden:t.hasAttribute("hidden")})),this.host.setAttribute("options",JSON.stringify(this.options))}handleMutations(t){let e=!1;t.forEach(i=>{i.type==="childList"&&(i.addedNodes.forEach(s=>{o.isOptionElement(s)&&(this.addNode(s),e=!0)}),i.removedNodes.forEach(s=>{o.isOptionElement(s)&&(this.nodes=this.nodes.filter(r=>r!==s),e=!0)}))}),e&&this.createOptions()}}exports.PktOptionsSlotController=h;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function d(e,s){return s.some(t=>t.value===e)}function n(e){return e.classList&&(e.classList.contains("_dialog_overlay")||e.classList.contains("backdrop"))?!0:typeof e.hasAttribute=="function"&&e.hasAttribute("data-skip")}function r(e){return e.nodeName==="OPTION"||e.nodeName==="DATA"}function u(e,s){return e.nodeType===Node.ELEMENT_NODE&&!d(e,s)}function a(e){var s;return e.nodeType===Node.TEXT_NODE&&((s=e.nodeValue)==null?void 0:s.trim())!==""}class c{constructor(s,...t){this.nodes=[],this.filledSlots=new Set,this.skipOptions=!1,this.updatingSlots=!1,this.host=s,this.host.addController(this),this.slots=t,this.nodes=[],this.observer=new MutationObserver(o=>this.handleMutations(o)),this.contentObserver=new MutationObserver(o=>this.handleSlotMutations(o))}hostConnected(){this.updateNodes(),this.observer.observe(this.host,{childList:!0}),this.contentObserver.observe(this.host,{childList:!0,subtree:!0})}hostDisconnected(){this.observer.disconnect(),this.contentObserver.disconnect()}hostUpdated(){this.updateSlots()}updateNodes(){this.nodes=[],Array.from(this.host.childNodes).forEach(t=>{n(t)||r(t)&&this.skipOptions||(!d(t,this.slots)||a(t))&&this.nodes.push(t)})}updateSlots(){if(this.updatingSlots)return;this.updatingSlots=!0;const s=new Set;this.slots.forEach(t=>{if(!t.value)return;const o=t.value.getAttribute("name"),h=this.nodes.flatMap(l=>a(l)||l.getAttribute&&l.getAttribute("slot")==o&&!n(l)?l:[]).filter(l=>t.value&&!t.value.contains(l)&&!l.contains(t.value));if(h.length>0)if(s.add(o),typeof t.value.replaceChildren!="function"){for(;t.value.firstChild;)t.value.removeChild(t.value.firstChild);t.value.append(...h)}else t.value.replaceChildren(...h)}),(this.filledSlots.size!==s.size||![...this.filledSlots].every(t=>s.has(t)))&&(this.filledSlots=s,this.host.requestUpdate()),this.updatingSlots=!1}handleMutations(s){let t=!1;s.forEach(o=>{o.type==="childList"&&(o.addedNodes.forEach(i=>{n(i)||r(i)&&this.skipOptions||(u(i,this.slots)||a(i))&&(this.nodes.push(i),t=!0)}),o.removedNodes.forEach(i=>{n(i)||r(i)&&this.skipOptions||(this.nodes=this.nodes.filter(h=>h!==i),t=!0)}))}),t&&this.updateSlots()}handleSlotMutations(s){let t=!1;s.forEach(o=>{const i=o.target.parentElement;if(i!=null&&i.hasAttribute("slot")){const h=i.getAttribute("slot"),l=i.hasChildNodes();l&&!this.filledSlots.has(h)?(this.filledSlots.add(h),t=!0):!l&&this.filledSlots.has(h)&&(this.filledSlots.delete(h),t=!0)}}),t&&typeof this.host.updateSlots=="function"&&this.host.updateSlots(this.filledSlots)}}exports.PktSlotController=c;exports.isOptionElement=r;
|