@oslokommune/punkt-elements 12.30.2 → 12.30.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{checkbox-Dw2CX5zY.js → checkbox-DFrbTMOl.js} +10 -10
- package/dist/{checkbox-CDMUepTW.cjs → checkbox-iA8Wkayp.cjs} +1 -1
- package/dist/{datepicker-NbLoqIKZ.cjs → datepicker-BE8qpEOv.cjs} +1 -1
- package/dist/{datepicker-LKIwV9DD.js → datepicker-C5eaQR3h.js} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/input-element-BtSjmGc0.cjs +1 -0
- package/dist/{input-element-B6BTwL1q.js → input-element-CiqJQwUm.js} +31 -19
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +6 -6
- 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-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/radiobutton-BNtSzT1b.cjs +24 -0
- package/dist/radiobutton-CjdsXnBS.js +88 -0
- package/dist/{select-DJu4Wr1y.cjs → select-CbKKDGge.cjs} +1 -1
- package/dist/{select-CnizDIYN.js → select-D-2lgnqF.js} +1 -1
- package/dist/{textarea-uzzCtHtj.js → textarea-CIDDRs8w.js} +1 -1
- package/dist/{textarea-BKCVcJ6E.cjs → textarea-KNBetKqy.cjs} +1 -1
- package/dist/{textinput-BRupcl9v.cjs → textinput-Co6ifzvP.cjs} +1 -1
- package/dist/{textinput-DRkv93vp.js → textinput-kSYgPYM3.js} +1 -1
- package/package.json +2 -2
- package/src/components/checkbox/checkbox.ts +1 -1
- package/src/components/radiobutton/radiobutton.ts +13 -3
- package/dist/input-element-KOSm5htR.cjs +0 -1
- package/dist/radiobutton-3e105CXX.cjs +0 -24
- package/dist/radiobutton-CcZ2-z8q.js +0 -88
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { x as
|
|
2
|
-
import { P as k } from "./input-element-
|
|
3
|
-
import { e as
|
|
1
|
+
import { x as n, E as r, n as s, a as d } from "./element-D_ZgQsSr.js";
|
|
2
|
+
import { P as k } from "./input-element-CiqJQwUm.js";
|
|
3
|
+
import { e as b, n as f } from "./ref-BSGI8ogR.js";
|
|
4
4
|
import { e as u } from "./class-map-BYCG9U47.js";
|
|
5
5
|
var _ = Object.defineProperty, y = Object.getOwnPropertyDescriptor, i = (e, h, c, l) => {
|
|
6
6
|
for (var p = l > 1 ? void 0 : l ? y(h, c) : h, a = e.length - 1, o; a >= 0; a--)
|
|
@@ -9,7 +9,7 @@ var _ = Object.defineProperty, y = Object.getOwnPropertyDescriptor, i = (e, h, c
|
|
|
9
9
|
};
|
|
10
10
|
let t = class extends k {
|
|
11
11
|
constructor() {
|
|
12
|
-
super(...arguments), this.inputRef =
|
|
12
|
+
super(...arguments), this.inputRef = b(), this.value = "", this.checkHelptext = null, this.defaultChecked = !1, this.hasTile = !1, this.isSwitch = !1, this.labelPosition = "right", this.hideLabel = !1, this.checked = null, this.type = "checkbox";
|
|
13
13
|
}
|
|
14
14
|
connectedCallback() {
|
|
15
15
|
super.connectedCallback();
|
|
@@ -33,30 +33,30 @@ let t = class extends k {
|
|
|
33
33
|
"pkt-input-check__input-label--left": this.labelPosition === "left",
|
|
34
34
|
"pkt-input-check__input-label--right": this.labelPosition === "right",
|
|
35
35
|
"pkt-sr-only": this.hideLabel
|
|
36
|
-
}), l = () =>
|
|
36
|
+
}), l = () => n`
|
|
37
37
|
<label class=${c} for=${this.id + "-internal"}>
|
|
38
38
|
${this.label}
|
|
39
|
-
${this.checkHelptext ?
|
|
39
|
+
${this.checkHelptext ? n`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>` : r}
|
|
40
40
|
</label>
|
|
41
41
|
`;
|
|
42
|
-
return
|
|
42
|
+
return n`
|
|
43
43
|
<div class="pkt-input-check">
|
|
44
44
|
<div class=${e}>
|
|
45
|
-
${this.labelPosition === "left" ? l() :
|
|
45
|
+
${this.labelPosition === "left" ? l() : r}
|
|
46
46
|
<input
|
|
47
47
|
id=${this.id + "-internal"}
|
|
48
48
|
class=${h}
|
|
49
49
|
type="checkbox"
|
|
50
50
|
?disabled=${this.disabled}
|
|
51
51
|
name=${this.name + "-internal"}
|
|
52
|
-
${
|
|
52
|
+
${f(this.inputRef)}
|
|
53
53
|
@change=${this.toggleChecked}
|
|
54
54
|
@blur=${this.onBlur}
|
|
55
55
|
@focus=${this.onFocus}
|
|
56
56
|
?checked=${this.checked}
|
|
57
57
|
role=${this.isSwitch ? "switch" : "checkbox"}
|
|
58
58
|
/>
|
|
59
|
-
${this.labelPosition === "right" ? l() :
|
|
59
|
+
${this.labelPosition === "right" ? l() : r}
|
|
60
60
|
</div>
|
|
61
61
|
</div>
|
|
62
62
|
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("./element-r-PeQ419.cjs"),a=require("./input-element-
|
|
1
|
+
"use strict";const e=require("./element-r-PeQ419.cjs"),a=require("./input-element-BtSjmGc0.cjs"),k=require("./ref-BUWgvhgU.cjs"),o=require("./class-map-Dzci3Pfe.cjs");var r=Object.defineProperty,u=Object.getOwnPropertyDescriptor,c=(l,t,s,h)=>{for(var i=h>1?void 0:h?u(t,s):t,n=l.length-1,p;n>=0;n--)(p=l[n])&&(i=(h?p(t,s,i):p(i))||i);return h&&i&&r(t,s,i),i};exports.PktCheckbox=class extends a.PktInputElement{constructor(){super(...arguments),this.inputRef=k.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.isSwitch=!1,this.labelPosition="right",this.hideLabel=!1,this.checked=null,this.type="checkbox"}connectedCallback(){super.connectedCallback()}attributeChangedCallback(t,s,h){t==="defaultChecked"&&!this.checked&&(this.checked=this.defaultChecked),t==="checked"&&(this.checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(t,s,h)}firstUpdated(t){t.has("defaultChecked")&&!this.checked&&(this.checked=this.defaultChecked),super.firstUpdated(t)}render(){const t=o.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),s=o.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),h=o.e({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--left":this.labelPosition==="left","pkt-input-check__input-label--right":this.labelPosition==="right","pkt-sr-only":this.hideLabel}),i=()=>e.x`
|
|
2
2
|
<label class=${h} for=${this.id+"-internal"}>
|
|
3
3
|
${this.label}
|
|
4
4
|
${this.checkHelptext?e.x`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>`:e.E}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const $=require("./class-map-Dzci3Pfe.cjs"),k=require("./if-defined-CWHk9Kqm.cjs"),a=require("./element-r-PeQ419.cjs"),T=require("./state-B77EXPZ9.cjs"),g=require("./calendar-DUkAC9Hx.cjs"),S=require("./input-element-
|
|
1
|
+
"use strict";const $=require("./class-map-Dzci3Pfe.cjs"),k=require("./if-defined-CWHk9Kqm.cjs"),a=require("./element-r-PeQ419.cjs"),T=require("./state-B77EXPZ9.cjs"),g=require("./calendar-DUkAC9Hx.cjs"),S=require("./input-element-BtSjmGc0.cjs"),r=require("./ref-BUWgvhgU.cjs");require("./icon-DcJIqTIY.cjs");require("./input-wrapper-Dqj4uers.cjs");require("./tag-B3KEILId.cjs");const P=require("./pkt-slot-controller-Oc32unDk.cjs");/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -3,7 +3,7 @@ import { o as k } from "./if-defined-u8oGOhnv.js";
|
|
|
3
3
|
import { e as L, i as j, b as F, T as q, x as v, E as T, n as u, a as H } from "./element-D_ZgQsSr.js";
|
|
4
4
|
import { r as V } from "./state-DuS4ffEQ.js";
|
|
5
5
|
import { n as S, f as _, a as N, b as P, d as A } from "./calendar-DevhqUoj.js";
|
|
6
|
-
import { P as U } from "./input-element-
|
|
6
|
+
import { P as U } from "./input-element-CiqJQwUm.js";
|
|
7
7
|
import { p as K, v as $, r as R, M as I, m as W, e as w, n as y } from "./ref-BSGI8ogR.js";
|
|
8
8
|
import "./icon-BBFK-d-X.js";
|
|
9
9
|
import "./input-wrapper-D-pEAZaj.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -271,7 +271,7 @@ export declare class PktCheckbox extends PktInputElement {
|
|
|
271
271
|
isSwitch: boolean;
|
|
272
272
|
labelPosition: 'right' | 'left';
|
|
273
273
|
hideLabel: boolean;
|
|
274
|
-
checked: boolean | string;
|
|
274
|
+
checked: boolean | string | null;
|
|
275
275
|
type: string;
|
|
276
276
|
connectedCallback(): void;
|
|
277
277
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
@@ -638,7 +638,7 @@ declare class PktRadioButton extends PktInputElement {
|
|
|
638
638
|
checkHelptext: string | null;
|
|
639
639
|
defaultChecked: boolean;
|
|
640
640
|
hasTile: boolean;
|
|
641
|
-
checked: boolean | string;
|
|
641
|
+
checked: boolean | string | null;
|
|
642
642
|
type: string;
|
|
643
643
|
_checked: boolean;
|
|
644
644
|
connectedCallback(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./element-r-PeQ419.cjs"),f=require("./state-B77EXPZ9.cjs"),y=require("./stringutils-CkVRq4jP.cjs"),c=require("./input-wrapper-jPnKsfEC.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=y.uuidish(),this.counter=!1,this.hasError=!1,this.inline=!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=c.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=t,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,"optionalTag");s([e.n({type:Boolean})],i.prototype,"requiredTag");s([e.n({type:Boolean})],i.prototype,"skipForwardTestid");s([e.n({type:Boolean})],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})],i.prototype,"helptextDropdownButton");s([e.n({type:String})],i.prototype,"label");s([e.n({type:String})],i.prototype,"optionalText");s([e.n({type:String})],i.prototype,"requiredText");s([e.n({type:String,attribute:"data-testid"})],i.prototype,"dataTestid");s([f.r()],i.prototype,"touched");exports.PktInputElement=i;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { n as s, P as y, t as
|
|
1
|
+
import { n as s, P as y, t as n } from "./element-D_ZgQsSr.js";
|
|
2
2
|
import { r as c } from "./state-DuS4ffEQ.js";
|
|
3
3
|
import { u as m } from "./stringutils-DJjRa8dG.js";
|
|
4
4
|
import { s as g } from "./input-wrapper-Bw9tARAD.js";
|
|
5
|
-
var v = Object.defineProperty, e = (p, t, r,
|
|
6
|
-
for (var a = void 0,
|
|
7
|
-
(o = p[
|
|
5
|
+
var v = Object.defineProperty, e = (p, t, r, l) => {
|
|
6
|
+
for (var a = void 0, h = p.length - 1, o; h >= 0; h--)
|
|
7
|
+
(o = p[h]) && (a = o(t, r, a) || a);
|
|
8
8
|
return a && v(t, r, a), a;
|
|
9
9
|
};
|
|
10
10
|
class i extends y {
|
|
11
11
|
constructor() {
|
|
12
|
-
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 = m(), this.counter = !1, this.hasError = !1, this.inline = !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 = g.props.helptextDropdownButton.default, this.label = null, this.optionalText =
|
|
12
|
+
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 = m(), this.counter = !1, this.hasError = !1, this.inline = !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 = g.props.helptextDropdownButton.default, this.label = null, this.optionalText = n.forms.labels.optional, this.requiredText = n.forms.labels.required, this.dataTestid = "", this.touched = !1, this.internals = this.attachInternals();
|
|
13
13
|
}
|
|
14
14
|
static get formAssociated() {
|
|
15
15
|
return !0;
|
|
16
16
|
}
|
|
17
17
|
manageValidity(t) {
|
|
18
|
-
var r,
|
|
19
|
-
t && (this.required && !this.value ? this.internals.setValidity({ valueMissing: !0 },
|
|
18
|
+
var r, l, a, h, o, u, d, f;
|
|
19
|
+
t && (this.required && !this.value ? this.internals.setValidity({ valueMissing: !0 }, n.forms.messages.required, t) : (r = t.validity) != null && r.typeMismatch || (l = t.validity) != null && l.badInput ? this.internals.setValidity({ typeMismatch: !0 }, n.forms.messages.invalid, t) : (a = t.validity) != null && a.patternMismatch ? this.internals.setValidity(
|
|
20
20
|
{ patternMismatch: !0 },
|
|
21
|
-
|
|
21
|
+
n.forms.messages.invalidPattern,
|
|
22
22
|
t
|
|
23
|
-
) : (
|
|
23
|
+
) : (h = t.validity) != null && h.tooShort || this.minlength && this.minlength > 0 && this.value.length < this.minlength ? this.internals.setValidity({ tooShort: !0 }, n.forms.messages.tooShort, t) : (o = t.validity) != null && o.tooLong || this.maxlength && this.maxlength > 0 && this.value.length > this.maxlength ? this.internals.setValidity({ tooLong: !0 }, n.forms.messages.tooLong, t) : (u = t.validity) != null && u.rangeUnderflow ? this.internals.setValidity(
|
|
24
24
|
{ rangeUnderflow: !0 },
|
|
25
|
-
|
|
25
|
+
n.forms.messages.rangeUnderflow,
|
|
26
26
|
t
|
|
27
27
|
) : (d = t.validity) != null && d.rangeOverflow ? this.internals.setValidity(
|
|
28
28
|
{ rangeOverflow: !0 },
|
|
29
|
-
|
|
29
|
+
n.forms.messages.rangeOverflow,
|
|
30
30
|
t
|
|
31
31
|
) : (f = t.validity) != null && f.customError ? this.internals.setValidity({ customError: !0 }, t.validationMessage, t) : this.internals.setValidity({}));
|
|
32
32
|
}
|
|
@@ -34,8 +34,8 @@ class i extends y {
|
|
|
34
34
|
if (this.internals)
|
|
35
35
|
if (Array.isArray(t)) {
|
|
36
36
|
const r = new FormData();
|
|
37
|
-
t.forEach((
|
|
38
|
-
r.append(this.name,
|
|
37
|
+
t.forEach((l) => {
|
|
38
|
+
r.append(this.name, l);
|
|
39
39
|
}), this.internals.setFormValue(r);
|
|
40
40
|
} else
|
|
41
41
|
this.internals.setFormValue(t);
|
|
@@ -43,16 +43,20 @@ class i extends y {
|
|
|
43
43
|
// Trigger this when you want to set the value of the *radio or checkbox* input out to the form
|
|
44
44
|
// Do not use valueChanged or onChange for radios and checkboxes!
|
|
45
45
|
valueChecked(t) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
if (!this.touched) return;
|
|
47
|
+
const r = this.internals.form || this.closest("form");
|
|
48
|
+
r && r.querySelectorAll(
|
|
49
|
+
`pkt-radiobutton[name=${this.name}], input[type=radio][name=${this.name}]`
|
|
50
|
+
).forEach((l) => {
|
|
51
|
+
const a = l;
|
|
52
|
+
a.name === this.name && a.value !== this.value && a.checked && (a.checked = !1);
|
|
53
|
+
}), 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(
|
|
50
54
|
new CustomEvent("value-change", {
|
|
51
55
|
detail: this.checked,
|
|
52
56
|
bubbles: !0,
|
|
53
57
|
composed: !0
|
|
54
58
|
})
|
|
55
|
-
), this.internals.reportValidity()
|
|
59
|
+
), this.internals.reportValidity();
|
|
56
60
|
}
|
|
57
61
|
valueChanged(t, r) {
|
|
58
62
|
(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 = t, 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()));
|
|
@@ -98,7 +102,15 @@ class i extends y {
|
|
|
98
102
|
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")));
|
|
99
103
|
}
|
|
100
104
|
firstUpdated(t) {
|
|
101
|
-
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.
|
|
105
|
+
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) {
|
|
106
|
+
const r = this.checked === "" || this.checked === "true" || this.checked === !0;
|
|
107
|
+
this.internals.ariaChecked = r, this.internals.setFormValue(
|
|
108
|
+
r ? this.value || "on" : "",
|
|
109
|
+
r ? this.value || "on" : ""
|
|
110
|
+
);
|
|
111
|
+
} else
|
|
112
|
+
this.internals.setFormValue(this.value);
|
|
113
|
+
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));
|
|
102
114
|
}
|
|
103
115
|
}
|
|
104
116
|
e([
|
package/dist/pkt-checkbox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./checkbox-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./checkbox-iA8Wkayp.cjs"),t=e.PktCheckbox;Object.defineProperty(exports,"PktCheckbox",{enumerable:!0,get:()=>e.PktCheckbox});exports.default=t;
|
package/dist/pkt-checkbox.js
CHANGED
package/dist/pkt-datepicker.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./datepicker-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./datepicker-BE8qpEOv.cjs"),t=e.PktDatepicker;Object.defineProperty(exports,"PktDatepicker",{enumerable:!0,get:()=>e.PktDatepicker});exports.default=t;
|
package/dist/pkt-datepicker.js
CHANGED
package/dist/pkt-index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./alert-CP5oN7df.cjs"),P=require("./button-rngMU-vh.cjs"),c=require("./calendar-DUkAC9Hx.cjs"),k=require("./card-D6VEEvX3.cjs"),b=require("./checkbox-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./alert-CP5oN7df.cjs"),P=require("./button-rngMU-vh.cjs"),c=require("./calendar-DUkAC9Hx.cjs"),k=require("./card-D6VEEvX3.cjs"),b=require("./checkbox-iA8Wkayp.cjs"),t=require("./element-r-PeQ419.cjs"),m=require("./pkt-slot-controller-Oc32unDk.cjs"),s=require("./ref-BUWgvhgU.cjs"),g=require("./class-map-Dzci3Pfe.cjs"),h=require("./datepicker-BE8qpEOv.cjs"),f=require("./helptext-C0mrdhRi.cjs"),y=require("./icon-DcJIqTIY.cjs"),O=require("./input-wrapper-Dqj4uers.cjs"),j=require("./link-C_bwx1Ml.cjs"),x=require("./linkcard-C6mZOE0R.cjs"),q=require("./loader-DQV1hMM3.cjs"),C=require("./messagebox-BSyLVNas.cjs"),v=require("./modal-CblCiNUi.cjs"),S=require("./progressbar-C_q48_qh.cjs"),p=require("./radiobutton-BNtSzT1b.cjs"),$=require("./tag-B3KEILId.cjs"),_=require("./textarea-KNBetKqy.cjs"),L=require("./textinput-Co6ifzvP.cjs"),T=require("./select-CbKKDGge.cjs");var B=Object.defineProperty,M=Object.getOwnPropertyDescriptor,o=(a,e,r,i)=>{for(var n=i>1?void 0:i?M(e,r):e,l=a.length-1,u;l>=0;l--)(u=a[l])&&(n=(i?u(e,r,n):u(n))||n);return i&&n&&B(e,r,n),n};exports.PktComponent=class extends t.PktElement{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=s.e(),this.namedSlot=s.e(),this.slotController=new m.PktSlotController(this,this.defaultSlot,this.namedSlot)}connectedCallback(){this.strings.length&&this.strings.forEach(e=>{this._list.push(e.toUpperCase())}),super.connectedCallback()}render(){const e={"pkt-component":!0,"pkt-component--has-list":this.strings.length>0,"pkt-darkmode":this.darkmode};return t.x`
|
|
2
2
|
<div class="${g.e(e)}">
|
|
3
3
|
<h1 class="pkt-txt-28">${this.string}</h1>
|
|
4
4
|
|
package/dist/pkt-index.js
CHANGED
|
@@ -3,12 +3,12 @@ import { P as O } from "./button-BCcznC7Q.js";
|
|
|
3
3
|
import { c as d } from "./calendar-DevhqUoj.js";
|
|
4
4
|
import { P as T } from "./calendar-DevhqUoj.js";
|
|
5
5
|
import { P as A } from "./card-CGMZxbH_.js";
|
|
6
|
-
import { P as D } from "./checkbox-
|
|
6
|
+
import { P as D } from "./checkbox-DFrbTMOl.js";
|
|
7
7
|
import { P as f, x as P, t as k, n, a as c } from "./element-D_ZgQsSr.js";
|
|
8
8
|
import { P as x } from "./pkt-slot-controller-Clbye6cM.js";
|
|
9
9
|
import { e as m, n as h } from "./ref-BSGI8ogR.js";
|
|
10
10
|
import { e as u } from "./class-map-BYCG9U47.js";
|
|
11
|
-
import { P as G } from "./datepicker-
|
|
11
|
+
import { P as G } from "./datepicker-C5eaQR3h.js";
|
|
12
12
|
import { P as M } from "./helptext-RPq_TKzJ.js";
|
|
13
13
|
import { P as N } from "./icon-BBFK-d-X.js";
|
|
14
14
|
import { P as W } from "./input-wrapper-D-pEAZaj.js";
|
|
@@ -18,11 +18,11 @@ import { P as V } from "./loader-ChVEsONa.js";
|
|
|
18
18
|
import { P as Y } from "./messagebox-Di7LUz4C.js";
|
|
19
19
|
import { P as tt } from "./modal-DZUQb_yG.js";
|
|
20
20
|
import { P as rt } from "./progressbar-CuZj4FWi.js";
|
|
21
|
-
import { P as st, P as at } from "./radiobutton-
|
|
21
|
+
import { P as st, P as at } from "./radiobutton-CjdsXnBS.js";
|
|
22
22
|
import { P as it } from "./tag-BFqxindw.js";
|
|
23
|
-
import { P as lt } from "./textarea-
|
|
24
|
-
import { P as mt } from "./textinput-
|
|
25
|
-
import { P as dt } from "./select-
|
|
23
|
+
import { P as lt } from "./textarea-CIDDRs8w.js";
|
|
24
|
+
import { P as mt } from "./textinput-kSYgPYM3.js";
|
|
25
|
+
import { P as dt } from "./select-D-2lgnqF.js";
|
|
26
26
|
var g = Object.defineProperty, v = Object.getOwnPropertyDescriptor, s = (t, e, i, a) => {
|
|
27
27
|
for (var r = a > 1 ? void 0 : a ? v(e, i) : e, p = t.length - 1, l; p >= 0; p--)
|
|
28
28
|
(l = t[p]) && (r = (a ? l(e, i, r) : l(r)) || r);
|
package/dist/pkt-radiobutton.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./radiobutton-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./radiobutton-BNtSzT1b.cjs"),e=t.PktRadioButton;Object.defineProperty(exports,"PktRadioButton",{enumerable:!0,get:()=>t.PktRadioButton});exports.default=e;
|
package/dist/pkt-radiobutton.js
CHANGED
package/dist/pkt-select.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./select-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./select-CbKKDGge.cjs"),t=e.PktSelect;Object.defineProperty(exports,"PktSelect",{enumerable:!0,get:()=>e.PktSelect});exports.default=t;
|
package/dist/pkt-select.js
CHANGED
package/dist/pkt-textarea.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textarea-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textarea-KNBetKqy.cjs"),t=e.PktTextarea;Object.defineProperty(exports,"PktTextarea",{enumerable:!0,get:()=>e.PktTextarea});exports.default=t;
|
package/dist/pkt-textarea.js
CHANGED
package/dist/pkt-textinput.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textinput-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textinput-Co6ifzvP.cjs"),t=e.PktTextinput;Object.defineProperty(exports,"PktTextinput",{enumerable:!0,get:()=>e.PktTextinput});exports.default=t;
|
package/dist/pkt-textinput.js
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";const t=require("./element-r-PeQ419.cjs"),a=require("./state-B77EXPZ9.cjs"),p=require("./input-element-BtSjmGc0.cjs"),d=require("./ref-BUWgvhgU.cjs"),o=require("./class-map-Dzci3Pfe.cjs");var k=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=(u,e,c,s)=>{for(var h=s>1?void 0:s?r(e,c):e,n=u.length-1,l;n>=0;n--)(l=u[n])&&(h=(s?l(e,c,h):l(h))||h);return s&&h&&k(e,c,h),h};exports.PktRadioButton=class extends p.PktInputElement{constructor(){super(...arguments),this.inputRef=d.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,c,s){e==="defaultChecked"&&(this._checked=this.defaultChecked),e==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(e,c,s)}updated(e){e.has("checked")&&this.checked!==null&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0,(e.get("checked")===""||e.get("checked")==="true"||e.get("checked")===!0)!==this._checked&&this.toggleChecked()),super.updated(e)}render(){const e=o.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),c=o.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError});return t.x`
|
|
2
|
+
<div class="pkt-input-check">
|
|
3
|
+
<div class=${e}>
|
|
4
|
+
<input
|
|
5
|
+
id=${this.id+"-internal"}
|
|
6
|
+
class=${c}
|
|
7
|
+
type="radio"
|
|
8
|
+
role="radio"
|
|
9
|
+
?disabled=${this.disabled}
|
|
10
|
+
name=${this.name+"-internal"}
|
|
11
|
+
${d.n(this.inputRef)}
|
|
12
|
+
@change=${this.toggleChecked}
|
|
13
|
+
@input=${this.onInput}
|
|
14
|
+
@blur=${this.onBlur}
|
|
15
|
+
@focus=${this.onFocus}
|
|
16
|
+
?checked=${this.checked}
|
|
17
|
+
/>
|
|
18
|
+
<label class="pkt-input-check__input-label" for=${this.id+"-internal"}>
|
|
19
|
+
${this.label}
|
|
20
|
+
${this.checkHelptext?t.x`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>`:t.E}
|
|
21
|
+
</label>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
`}toggleChecked(e=null){e&&e.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this._checked=this.inputRef.value.matches(":checked"),this.valueChecked(this._checked))}};i([t.n({type:String,reflect:!0})],exports.PktRadioButton.prototype,"value",2);i([t.n({type:String})],exports.PktRadioButton.prototype,"checkHelptext",2);i([t.n({type:Boolean})],exports.PktRadioButton.prototype,"defaultChecked",2);i([t.n({type:Boolean})],exports.PktRadioButton.prototype,"hasTile",2);i([t.n({type:Boolean,reflect:!0})],exports.PktRadioButton.prototype,"checked",2);i([t.n({type:String,reflect:!0})],exports.PktRadioButton.prototype,"type",2);i([a.r()],exports.PktRadioButton.prototype,"_checked",2);exports.PktRadioButton=i([t.t("pkt-radiobutton")],exports.PktRadioButton);
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { x as r, E as n, n as s, a as o } from "./element-D_ZgQsSr.js";
|
|
2
|
+
import { r as k } from "./state-DuS4ffEQ.js";
|
|
3
|
+
import { P as f } from "./input-element-CiqJQwUm.js";
|
|
4
|
+
import { e as _, n as b } from "./ref-BSGI8ogR.js";
|
|
5
|
+
import { e as a } from "./class-map-BYCG9U47.js";
|
|
6
|
+
var C = Object.defineProperty, v = Object.getOwnPropertyDescriptor, i = (e, t, l, p) => {
|
|
7
|
+
for (var h = p > 1 ? void 0 : p ? v(t, l) : t, u = e.length - 1, d; u >= 0; u--)
|
|
8
|
+
(d = e[u]) && (h = (p ? d(t, l, h) : d(h)) || h);
|
|
9
|
+
return p && h && C(t, l, h), h;
|
|
10
|
+
};
|
|
11
|
+
let c = class extends f {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments), this.inputRef = _(), this.value = "", this.checkHelptext = null, this.defaultChecked = !1, this.hasTile = !1, this.checked = null, this.type = "radio", this._checked = !1;
|
|
14
|
+
}
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
super.connectedCallback();
|
|
17
|
+
}
|
|
18
|
+
attributeChangedCallback(e, t, l) {
|
|
19
|
+
e === "defaultChecked" && (this._checked = this.defaultChecked), e === "checked" && (this._checked = this.checked === "" || this.checked === "true" || this.checked === !0), super.attributeChangedCallback(e, t, l);
|
|
20
|
+
}
|
|
21
|
+
updated(e) {
|
|
22
|
+
e.has("checked") && this.checked !== null && (this._checked = this.checked === "" || this.checked === "true" || this.checked === !0, (e.get("checked") === "" || e.get("checked") === "true" || e.get("checked") === !0) !== this._checked && this.toggleChecked()), super.updated(e);
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
const e = a({
|
|
26
|
+
"pkt-input-check__input": !0,
|
|
27
|
+
"pkt-input-check__input--tile": this.hasTile,
|
|
28
|
+
"pkt-input-check__input--tile-disabled": this.disabled && this.hasTile
|
|
29
|
+
}), t = a({
|
|
30
|
+
"pkt-input-check__input-checkbox": !0,
|
|
31
|
+
"pkt-input-check__input-checkbox--error": this.hasError
|
|
32
|
+
});
|
|
33
|
+
return r`
|
|
34
|
+
<div class="pkt-input-check">
|
|
35
|
+
<div class=${e}>
|
|
36
|
+
<input
|
|
37
|
+
id=${this.id + "-internal"}
|
|
38
|
+
class=${t}
|
|
39
|
+
type="radio"
|
|
40
|
+
role="radio"
|
|
41
|
+
?disabled=${this.disabled}
|
|
42
|
+
name=${this.name + "-internal"}
|
|
43
|
+
${b(this.inputRef)}
|
|
44
|
+
@change=${this.toggleChecked}
|
|
45
|
+
@input=${this.onInput}
|
|
46
|
+
@blur=${this.onBlur}
|
|
47
|
+
@focus=${this.onFocus}
|
|
48
|
+
?checked=${this.checked}
|
|
49
|
+
/>
|
|
50
|
+
<label class="pkt-input-check__input-label" for=${this.id + "-internal"}>
|
|
51
|
+
${this.label}
|
|
52
|
+
${this.checkHelptext ? r`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>` : n}
|
|
53
|
+
</label>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
toggleChecked(e = null) {
|
|
59
|
+
e && e.stopImmediatePropagation(), this.touched = !0, this.inputRef.value && (this._checked = this.inputRef.value.matches(":checked"), this.valueChecked(this._checked));
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
i([
|
|
63
|
+
s({ type: String, reflect: !0 })
|
|
64
|
+
], c.prototype, "value", 2);
|
|
65
|
+
i([
|
|
66
|
+
s({ type: String })
|
|
67
|
+
], c.prototype, "checkHelptext", 2);
|
|
68
|
+
i([
|
|
69
|
+
s({ type: Boolean })
|
|
70
|
+
], c.prototype, "defaultChecked", 2);
|
|
71
|
+
i([
|
|
72
|
+
s({ type: Boolean })
|
|
73
|
+
], c.prototype, "hasTile", 2);
|
|
74
|
+
i([
|
|
75
|
+
s({ type: Boolean, reflect: !0 })
|
|
76
|
+
], c.prototype, "checked", 2);
|
|
77
|
+
i([
|
|
78
|
+
s({ type: String, reflect: !0 })
|
|
79
|
+
], c.prototype, "type", 2);
|
|
80
|
+
i([
|
|
81
|
+
k()
|
|
82
|
+
], c.prototype, "_checked", 2);
|
|
83
|
+
c = i([
|
|
84
|
+
o("pkt-radiobutton")
|
|
85
|
+
], c);
|
|
86
|
+
export {
|
|
87
|
+
c as P
|
|
88
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const l=require("./element-r-PeQ419.cjs"),d=require("./state-B77EXPZ9.cjs"),a=require("./ref-BUWgvhgU.cjs"),o=require("./if-defined-CWHk9Kqm.cjs"),c=require("./input-element-
|
|
1
|
+
"use strict";const l=require("./element-r-PeQ419.cjs"),d=require("./state-B77EXPZ9.cjs"),a=require("./ref-BUWgvhgU.cjs"),o=require("./if-defined-CWHk9Kqm.cjs"),c=require("./input-element-BtSjmGc0.cjs"),u=require("./pkt-slot-controller-Oc32unDk.cjs");require("./input-wrapper-Dqj4uers.cjs");class b{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("aria-hidden","true"),t.setAttribute("data-skip","true"),this.nodes.push(t))}createOptions(){this.options=this.nodes.map(t=>({value:t.getAttribute("value")||t.textContent||"",label:t.textContent||t.getAttribute("value")||"",selected:!!t.getAttribute("selected"),disabled:!!t.getAttribute("disabled")})),this.host.setAttribute("options",JSON.stringify(this.options))}handleMutations(t){let e=!1;t.forEach(s=>{s.type==="childList"&&(s.addedNodes.forEach(i=>{u.isOptionElement(i)&&(this.addNode(i),e=!0)}),s.removedNodes.forEach(i=>{u.isOptionElement(i)&&(this.nodes=this.nodes.filter(r=>r!==i),e=!0)}))}),e&&this.createOptions()}}var v=Object.defineProperty,f=Object.getOwnPropertyDescriptor,h=(n,t,e,s)=>{for(var i=s>1?void 0:s?f(t,e):t,r=n.length-1,p;r>=0;r--)(p=n[r])&&(i=(s?p(t,e,i):p(i))||i);return s&&i&&v(t,e,i),i};exports.PktSelect=class extends c.PktInputElement{constructor(){super(),this.inputRef=a.e(),this.helptextSlot=a.e(),this.options=[],this.value="",this._options=[],this.optionsController=new b(this),this.slotController=new u.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback();const t=this.options.length>0,e=this.optionsController.nodes.length&&this.optionsController.nodes.length>0;!t&&e?this.optionsController.nodes.forEach(s=>{const i={value:s.getAttribute("value")||s.textContent||"",label:s.textContent||s.getAttribute("value")||"",disabled:!!s.getAttribute("disabled")};s.getAttribute("selected")&&!this.value&&(this.value=i.value),this._options.push(i)}):this._options=this.options}attributeChangedCallback(t,e,s){t==="options"&&(this._options=s?JSON.parse(s):[]),t==="value"&&this.value!==e&&this.valueChanged(s,e),super.attributeChangedCallback(t,e,s)}updated(t){var e;super.updated(t),t.has("value")&&(this.counterCurrent=((e=this.value)==null?void 0:e.length)||0,this.valueChanged(this.value,t.get("value"))),t.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(t){super.firstUpdated(t),this.options.length&&(this._options=this.options)}render(){const t=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return l.x`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
3
|
?counter=${this.counter}
|
|
4
4
|
?disabled=${this.disabled}
|
|
@@ -2,7 +2,7 @@ import { x as p, n as b, a as f } from "./element-D_ZgQsSr.js";
|
|
|
2
2
|
import { r as v } from "./state-DuS4ffEQ.js";
|
|
3
3
|
import { e as u, n as d } from "./ref-BSGI8ogR.js";
|
|
4
4
|
import { o as r } from "./if-defined-u8oGOhnv.js";
|
|
5
|
-
import { P as $ } from "./input-element-
|
|
5
|
+
import { P as $ } from "./input-element-CiqJQwUm.js";
|
|
6
6
|
import { i as c, P as m } from "./pkt-slot-controller-Clbye6cM.js";
|
|
7
7
|
import "./input-wrapper-D-pEAZaj.js";
|
|
8
8
|
class g {
|
|
@@ -3,7 +3,7 @@ import { o as u } from "./if-defined-u8oGOhnv.js";
|
|
|
3
3
|
import { r as b } from "./state-DuS4ffEQ.js";
|
|
4
4
|
import { f as T, m as y, e as c, n as m } from "./ref-BSGI8ogR.js";
|
|
5
5
|
import { e as w } from "./class-map-BYCG9U47.js";
|
|
6
|
-
import { P as C } from "./input-element-
|
|
6
|
+
import { P as C } from "./input-element-CiqJQwUm.js";
|
|
7
7
|
import { P as E } from "./pkt-slot-controller-Clbye6cM.js";
|
|
8
8
|
import "./input-wrapper-D-pEAZaj.js";
|
|
9
9
|
import "./icon-BBFK-d-X.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const i=require("./element-r-PeQ419.cjs"),u=require("./if-defined-CWHk9Kqm.cjs"),p=require("./state-B77EXPZ9.cjs"),n=require("./ref-BUWgvhgU.cjs"),d=require("./class-map-Dzci3Pfe.cjs"),c=require("./input-element-
|
|
1
|
+
"use strict";const i=require("./element-r-PeQ419.cjs"),u=require("./if-defined-CWHk9Kqm.cjs"),p=require("./state-B77EXPZ9.cjs"),n=require("./ref-BUWgvhgU.cjs"),d=require("./class-map-Dzci3Pfe.cjs"),c=require("./input-element-BtSjmGc0.cjs"),$=require("./pkt-slot-controller-Oc32unDk.cjs");require("./input-wrapper-Dqj4uers.cjs");require("./icon-DcJIqTIY.cjs");/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2020 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./element-r-PeQ419.cjs"),u=require("./if-defined-CWHk9Kqm.cjs"),l=require("./state-B77EXPZ9.cjs"),p=require("./ref-BUWgvhgU.cjs"),c=require("./class-map-Dzci3Pfe.cjs"),x=require("./input-element-
|
|
1
|
+
"use strict";const t=require("./element-r-PeQ419.cjs"),u=require("./if-defined-CWHk9Kqm.cjs"),l=require("./state-B77EXPZ9.cjs"),p=require("./ref-BUWgvhgU.cjs"),c=require("./class-map-Dzci3Pfe.cjs"),x=require("./input-element-BtSjmGc0.cjs"),d=require("./pkt-slot-controller-Oc32unDk.cjs");require("./input-wrapper-Dqj4uers.cjs");require("./icon-DcJIqTIY.cjs");var $=Object.defineProperty,g=Object.getOwnPropertyDescriptor,r=(o,i,n,s)=>{for(var e=s>1?void 0:s?g(i,n):i,a=o.length-1,h;a>=0;a--)(h=o[a])&&(e=(s?h(i,n,e):h(e))||e);return s&&e&&$(i,n,e),e};exports.PktTextinput=class extends x.PktInputElement{constructor(){super(),this.inputRef=p.e(),this.helptextSlot=p.e(),this.value="",this.type="text",this.size=null,this.autocomplete="off",this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0,this.slotController=new d.PktSlotController(this,this.helptextSlot)}attributeChangedCallback(i,n,s){i==="value"&&this.value!==n&&(this.counterCurrent=s?s.length:0,this.valueChanged(s,n)),super.attributeChangedCallback(i,n,s)}updated(i){var n;super.updated(i),i.has("value")&&(this.counterCurrent=((n=this.value)==null?void 0:n.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,n=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}),s=this.ariaLabelledby||`${this.id}-input-label`;return t.x`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
3
|
label="${this.label}"
|
|
4
4
|
?counter=${this.counter}
|
|
@@ -3,7 +3,7 @@ import { o as c } from "./if-defined-u8oGOhnv.js";
|
|
|
3
3
|
import { r as f } from "./state-DuS4ffEQ.js";
|
|
4
4
|
import { e as d, n as m } from "./ref-BSGI8ogR.js";
|
|
5
5
|
import { e as g } from "./class-map-BYCG9U47.js";
|
|
6
|
-
import { P as x } from "./input-element-
|
|
6
|
+
import { P as x } from "./input-element-CiqJQwUm.js";
|
|
7
7
|
import { P as y } from "./pkt-slot-controller-Clbye6cM.js";
|
|
8
8
|
import "./input-wrapper-D-pEAZaj.js";
|
|
9
9
|
import "./icon-BBFK-d-X.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "12.30.
|
|
3
|
+
"version": "12.30.3",
|
|
4
4
|
"description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
58
58
|
},
|
|
59
59
|
"license": "MIT",
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "f73b87b0bd2a69042d4ed65309b2a5b9542f0b54"
|
|
61
61
|
}
|
|
@@ -16,7 +16,7 @@ export class PktCheckbox extends PktInputElement {
|
|
|
16
16
|
@property({ type: Boolean }) isSwitch: boolean = false
|
|
17
17
|
@property({ type: String }) labelPosition: 'right' | 'left' = 'right'
|
|
18
18
|
@property({ type: Boolean }) hideLabel: boolean = false
|
|
19
|
-
@property({ type: Boolean, reflect: true }) checked: boolean | string =
|
|
19
|
+
@property({ type: Boolean, reflect: true }) checked: boolean | string | null = null
|
|
20
20
|
@property({ type: String, reflect: true }) type: string = 'checkbox'
|
|
21
21
|
|
|
22
22
|
connectedCallback() {
|
|
@@ -13,7 +13,7 @@ export class PktRadioButton extends PktInputElement {
|
|
|
13
13
|
@property({ type: String }) checkHelptext: string | null = null
|
|
14
14
|
@property({ type: Boolean }) defaultChecked: boolean = false
|
|
15
15
|
@property({ type: Boolean }) hasTile: boolean = false
|
|
16
|
-
@property({ type: Boolean, reflect: true }) checked: boolean | string =
|
|
16
|
+
@property({ type: Boolean, reflect: true }) checked: boolean | string | null = null
|
|
17
17
|
@property({ type: String, reflect: true }) type: string = 'radio'
|
|
18
18
|
|
|
19
19
|
@state() _checked: boolean = false
|
|
@@ -33,6 +33,16 @@ export class PktRadioButton extends PktInputElement {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
updated(changedProperties: PropertyValues) {
|
|
36
|
+
if (changedProperties.has('checked') && this.checked !== null) {
|
|
37
|
+
this._checked = this.checked === '' || this.checked === 'true' || this.checked === true
|
|
38
|
+
const oldChecked =
|
|
39
|
+
changedProperties.get('checked') === '' ||
|
|
40
|
+
changedProperties.get('checked') === 'true' ||
|
|
41
|
+
changedProperties.get('checked') === true
|
|
42
|
+
if (oldChecked !== this._checked) {
|
|
43
|
+
this.toggleChecked()
|
|
44
|
+
}
|
|
45
|
+
}
|
|
36
46
|
super.updated(changedProperties)
|
|
37
47
|
}
|
|
38
48
|
|
|
@@ -76,8 +86,8 @@ export class PktRadioButton extends PktInputElement {
|
|
|
76
86
|
`
|
|
77
87
|
}
|
|
78
88
|
|
|
79
|
-
private toggleChecked(e: Event) {
|
|
80
|
-
e.stopImmediatePropagation()
|
|
89
|
+
private toggleChecked(e: Event | null = null) {
|
|
90
|
+
if (e) e.stopImmediatePropagation()
|
|
81
91
|
this.touched = true
|
|
82
92
|
if (this.inputRef.value) {
|
|
83
93
|
this._checked = this.inputRef.value.matches(':checked')
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./element-r-PeQ419.cjs"),f=require("./state-B77EXPZ9.cjs"),y=require("./stringutils-CkVRq4jP.cjs"),c=require("./input-wrapper-jPnKsfEC.cjs");var m=Object.defineProperty,s=(o,t,r,l)=>{for(var a=void 0,n=o.length-1,h;n>=0;n--)(h=o[n])&&(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=y.uuidish(),this.counter=!1,this.hasError=!1,this.inline=!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=c.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,l,a,n,h,p,u,d;t&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},e.translations.forms.messages.required,t):(r=t.validity)!=null&&r.typeMismatch||(l=t.validity)!=null&&l.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):(n=t.validity)!=null&&n.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):(p=t.validity)!=null&&p.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},e.translations.forms.messages.rangeUnderflow,t):(u=t.validity)!=null&&u.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(l=>{r.append(this.name,l)}),this.internals.setFormValue(r)}else this.internals.setFormValue(t)}valueChecked(t){this.touched&&(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.states.add("--checked"):this.internals.states.delete("--checked"),this.internals.setFormValue(this.checked?this.value:null,this.checked?"checked":"unchecked"),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=t,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){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.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,"optionalTag");s([e.n({type:Boolean})],i.prototype,"requiredTag");s([e.n({type:Boolean})],i.prototype,"skipForwardTestid");s([e.n({type:Boolean})],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})],i.prototype,"helptextDropdownButton");s([e.n({type:String})],i.prototype,"label");s([e.n({type:String})],i.prototype,"optionalText");s([e.n({type:String})],i.prototype,"requiredText");s([e.n({type:String,attribute:"data-testid"})],i.prototype,"dataTestid");s([f.r()],i.prototype,"touched");exports.PktInputElement=i;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./element-r-PeQ419.cjs"),l=require("./state-B77EXPZ9.cjs"),r=require("./input-element-KOSm5htR.cjs"),o=require("./ref-BUWgvhgU.cjs"),p=require("./class-map-Dzci3Pfe.cjs");var d=Object.defineProperty,k=Object.getOwnPropertyDescriptor,i=(n,t,c,h)=>{for(var s=h>1?void 0:h?k(t,c):t,u=n.length-1,a;u>=0;u--)(a=n[u])&&(s=(h?a(t,c,s):a(s))||s);return h&&s&&d(t,c,s),s};exports.PktRadioButton=class extends r.PktInputElement{constructor(){super(...arguments),this.inputRef=o.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=!1,this.type="radio",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(t,c,h){t==="defaultChecked"&&(this._checked=this.defaultChecked),t==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(t,c,h)}updated(t){super.updated(t)}render(){const t=p.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),c=p.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError});return e.x`
|
|
2
|
-
<div class="pkt-input-check">
|
|
3
|
-
<div class=${t}>
|
|
4
|
-
<input
|
|
5
|
-
id=${this.id+"-internal"}
|
|
6
|
-
class=${c}
|
|
7
|
-
type="radio"
|
|
8
|
-
role="radio"
|
|
9
|
-
?disabled=${this.disabled}
|
|
10
|
-
name=${this.name+"-internal"}
|
|
11
|
-
${o.n(this.inputRef)}
|
|
12
|
-
@change=${this.toggleChecked}
|
|
13
|
-
@input=${this.onInput}
|
|
14
|
-
@blur=${this.onBlur}
|
|
15
|
-
@focus=${this.onFocus}
|
|
16
|
-
?checked=${this.checked}
|
|
17
|
-
/>
|
|
18
|
-
<label class="pkt-input-check__input-label" for=${this.id+"-internal"}>
|
|
19
|
-
${this.label}
|
|
20
|
-
${this.checkHelptext?e.x`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>`:e.E}
|
|
21
|
-
</label>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
`}toggleChecked(t){t.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this._checked=this.inputRef.value.matches(":checked"),this.valueChecked(this._checked))}};i([e.n({type:String,reflect:!0})],exports.PktRadioButton.prototype,"value",2);i([e.n({type:String})],exports.PktRadioButton.prototype,"checkHelptext",2);i([e.n({type:Boolean})],exports.PktRadioButton.prototype,"defaultChecked",2);i([e.n({type:Boolean})],exports.PktRadioButton.prototype,"hasTile",2);i([e.n({type:Boolean,reflect:!0})],exports.PktRadioButton.prototype,"checked",2);i([e.n({type:String,reflect:!0})],exports.PktRadioButton.prototype,"type",2);i([l.r()],exports.PktRadioButton.prototype,"_checked",2);exports.PktRadioButton=i([e.t("pkt-radiobutton")],exports.PktRadioButton);
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { x as n, E as u, n as h, a as d } from "./element-D_ZgQsSr.js";
|
|
2
|
-
import { r as k } from "./state-DuS4ffEQ.js";
|
|
3
|
-
import { P as f } from "./input-element-B6BTwL1q.js";
|
|
4
|
-
import { e as _, n as b } from "./ref-BSGI8ogR.js";
|
|
5
|
-
import { e as o } from "./class-map-BYCG9U47.js";
|
|
6
|
-
var v = Object.defineProperty, C = Object.getOwnPropertyDescriptor, c = (e, i, p, l) => {
|
|
7
|
-
for (var s = l > 1 ? void 0 : l ? C(i, p) : i, r = e.length - 1, a; r >= 0; r--)
|
|
8
|
-
(a = e[r]) && (s = (l ? a(i, p, s) : a(s)) || s);
|
|
9
|
-
return l && s && v(i, p, s), s;
|
|
10
|
-
};
|
|
11
|
-
let t = class extends f {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments), this.inputRef = _(), this.value = "", this.checkHelptext = null, this.defaultChecked = !1, this.hasTile = !1, this.checked = !1, this.type = "radio", this._checked = !1;
|
|
14
|
-
}
|
|
15
|
-
connectedCallback() {
|
|
16
|
-
super.connectedCallback();
|
|
17
|
-
}
|
|
18
|
-
attributeChangedCallback(e, i, p) {
|
|
19
|
-
e === "defaultChecked" && (this._checked = this.defaultChecked), e === "checked" && (this._checked = this.checked === "" || this.checked === "true" || this.checked === !0), super.attributeChangedCallback(e, i, p);
|
|
20
|
-
}
|
|
21
|
-
updated(e) {
|
|
22
|
-
super.updated(e);
|
|
23
|
-
}
|
|
24
|
-
render() {
|
|
25
|
-
const e = o({
|
|
26
|
-
"pkt-input-check__input": !0,
|
|
27
|
-
"pkt-input-check__input--tile": this.hasTile,
|
|
28
|
-
"pkt-input-check__input--tile-disabled": this.disabled && this.hasTile
|
|
29
|
-
}), i = o({
|
|
30
|
-
"pkt-input-check__input-checkbox": !0,
|
|
31
|
-
"pkt-input-check__input-checkbox--error": this.hasError
|
|
32
|
-
});
|
|
33
|
-
return n`
|
|
34
|
-
<div class="pkt-input-check">
|
|
35
|
-
<div class=${e}>
|
|
36
|
-
<input
|
|
37
|
-
id=${this.id + "-internal"}
|
|
38
|
-
class=${i}
|
|
39
|
-
type="radio"
|
|
40
|
-
role="radio"
|
|
41
|
-
?disabled=${this.disabled}
|
|
42
|
-
name=${this.name + "-internal"}
|
|
43
|
-
${b(this.inputRef)}
|
|
44
|
-
@change=${this.toggleChecked}
|
|
45
|
-
@input=${this.onInput}
|
|
46
|
-
@blur=${this.onBlur}
|
|
47
|
-
@focus=${this.onFocus}
|
|
48
|
-
?checked=${this.checked}
|
|
49
|
-
/>
|
|
50
|
-
<label class="pkt-input-check__input-label" for=${this.id + "-internal"}>
|
|
51
|
-
${this.label}
|
|
52
|
-
${this.checkHelptext ? n`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>` : u}
|
|
53
|
-
</label>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
`;
|
|
57
|
-
}
|
|
58
|
-
toggleChecked(e) {
|
|
59
|
-
e.stopImmediatePropagation(), this.touched = !0, this.inputRef.value && (this._checked = this.inputRef.value.matches(":checked"), this.valueChecked(this._checked));
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
c([
|
|
63
|
-
h({ type: String, reflect: !0 })
|
|
64
|
-
], t.prototype, "value", 2);
|
|
65
|
-
c([
|
|
66
|
-
h({ type: String })
|
|
67
|
-
], t.prototype, "checkHelptext", 2);
|
|
68
|
-
c([
|
|
69
|
-
h({ type: Boolean })
|
|
70
|
-
], t.prototype, "defaultChecked", 2);
|
|
71
|
-
c([
|
|
72
|
-
h({ type: Boolean })
|
|
73
|
-
], t.prototype, "hasTile", 2);
|
|
74
|
-
c([
|
|
75
|
-
h({ type: Boolean, reflect: !0 })
|
|
76
|
-
], t.prototype, "checked", 2);
|
|
77
|
-
c([
|
|
78
|
-
h({ type: String, reflect: !0 })
|
|
79
|
-
], t.prototype, "type", 2);
|
|
80
|
-
c([
|
|
81
|
-
k()
|
|
82
|
-
], t.prototype, "_checked", 2);
|
|
83
|
-
t = c([
|
|
84
|
-
d("pkt-radiobutton")
|
|
85
|
-
], t);
|
|
86
|
-
export {
|
|
87
|
-
t as P
|
|
88
|
-
};
|