@oslokommune/punkt-elements 12.27.4 → 12.27.6
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/{datepicker-BC0e34ws.cjs → datepicker-D7pwV39B.cjs} +1 -1
- package/dist/{datepicker-ONV4HuJt.js → datepicker-TJSFbov0.js} +2 -2
- package/dist/index.d.ts +5 -1
- package/dist/{input-element-URKBm_vS.js → input-element-CaWBIGE_.js} +12 -1
- package/dist/input-element-DsNGy841.cjs +1 -0
- package/dist/{input-wrapper-DeCY6nta.cjs → input-wrapper-Bzb_Q9f5.cjs} +1 -1
- package/dist/{input-wrapper-Df18_PvD.js → input-wrapper-DIFdmqZ9.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-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- 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-CtmelHhh.cjs +22 -0
- package/dist/radiobutton-QyoTuTms.js +86 -0
- package/dist/{select-DFlu7Eq6.cjs → select-CIZlf1US.cjs} +1 -1
- package/dist/{select-DVyh7z8C.js → select-MvNPIow8.js} +2 -2
- package/dist/{textarea-WWRAA1LV.cjs → textarea-B5BPghlq.cjs} +1 -1
- package/dist/{textarea-80zuPTTD.js → textarea-Sh0xZcSC.js} +2 -2
- package/dist/{textinput-CZIE3v3S.js → textinput-D8Rq9wE_.js} +2 -2
- package/dist/{textinput-CE5AzOur.cjs → textinput-s0Fu7Mm5.cjs} +1 -1
- package/package.json +2 -2
- package/src/components/input-wrapper/input-wrapper.ts +1 -1
- package/src/components/radiobutton/radiobutton.ts +27 -4
- package/dist/input-element-Dnda8hac.cjs +0 -1
- package/dist/radiobutton-BhQCBJ0I.js +0 -75
- package/dist/radiobutton-HmicLshI.cjs +0 -21
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const $=require("./class-map-aeZWY44S.cjs"),k=require("./if-defined-Br3lDE5v.cjs"),a=require("./element-B0UgldHm.cjs"),T=require("./state-CG-binsl.cjs"),g=require("./calendar-CPEJ1enc.cjs"),S=require("./input-element-
|
|
1
|
+
"use strict";const $=require("./class-map-aeZWY44S.cjs"),k=require("./if-defined-Br3lDE5v.cjs"),a=require("./element-B0UgldHm.cjs"),T=require("./state-CG-binsl.cjs"),g=require("./calendar-CPEJ1enc.cjs"),S=require("./input-element-DsNGy841.cjs"),r=require("./ref-DDYBJ4EB.cjs");require("./icon-PWn7rnfg.cjs");require("./input-wrapper-Bzb_Q9f5.cjs");require("./tag-DGywzHJ5.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,10 +3,10 @@ import { o as k } from "./if-defined-f3M1y6S-.js";
|
|
|
3
3
|
import { e as L, i as j, a as F, T as q, x as v, E as T, n as u, t as H } from "./element-BKrU5soj.js";
|
|
4
4
|
import { r as V } from "./state-C36ZmZgt.js";
|
|
5
5
|
import { n as S, f as _, a as N, b as P, d as A } from "./calendar-DB_8j4en.js";
|
|
6
|
-
import { P as U } from "./input-element-
|
|
6
|
+
import { P as U } from "./input-element-CaWBIGE_.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-D5qG7OFB.js";
|
|
8
8
|
import "./icon-Bsb0MB2h.js";
|
|
9
|
-
import "./input-wrapper-
|
|
9
|
+
import "./input-wrapper-DIFdmqZ9.js";
|
|
10
10
|
import "./tag-W9Lf1doW.js";
|
|
11
11
|
import { P as z } from "./pkt-slot-controller-Clbye6cM.js";
|
|
12
12
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -368,6 +368,7 @@ declare class PktInputElement<T = {}> extends PktElement<Props_2 & T> {
|
|
|
368
368
|
constructor();
|
|
369
369
|
protected manageValidity(input: HTMLInputElement): void;
|
|
370
370
|
protected setFormValue(value: string | string[]): void;
|
|
371
|
+
protected valueChecked(value: string | boolean | null): void;
|
|
371
372
|
protected valueChanged(value: string | string[] | null, _old: string | string[] | null): void;
|
|
372
373
|
protected clearInputValue(): void;
|
|
373
374
|
protected onFocus(): void;
|
|
@@ -508,9 +509,12 @@ export declare class PktRadioButton extends PktInputElement {
|
|
|
508
509
|
checkHelptext: string | null;
|
|
509
510
|
defaultChecked: boolean;
|
|
510
511
|
hasTile: boolean;
|
|
511
|
-
checked: boolean;
|
|
512
|
+
checked: boolean | string;
|
|
512
513
|
role: string | null;
|
|
514
|
+
_checked: boolean;
|
|
513
515
|
connectedCallback(): void;
|
|
516
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
517
|
+
updated(changedProperties: PropertyValues): void;
|
|
514
518
|
render(): TemplateResult<1>;
|
|
515
519
|
private toggleChecked;
|
|
516
520
|
}
|
|
@@ -40,6 +40,17 @@ class i extends y {
|
|
|
40
40
|
} else
|
|
41
41
|
this.internals.setFormValue(t);
|
|
42
42
|
}
|
|
43
|
+
// Trigger this when you want to set the value of the *radio or checkbox* input out to the form
|
|
44
|
+
// Do not use valueChanged or onChange for radios and checkboxes!
|
|
45
|
+
valueChecked(t) {
|
|
46
|
+
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.internals.setFormValue(this.value), this.dispatchEvent(new Event("change")), this.dispatchEvent(
|
|
47
|
+
new CustomEvent("value-change", {
|
|
48
|
+
detail: t,
|
|
49
|
+
bubbles: !0,
|
|
50
|
+
composed: !0
|
|
51
|
+
})
|
|
52
|
+
), this.internals.reportValidity());
|
|
53
|
+
}
|
|
43
54
|
valueChanged(t, r) {
|
|
44
55
|
(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()));
|
|
45
56
|
}
|
|
@@ -72,7 +83,7 @@ class i extends y {
|
|
|
72
83
|
this.touched = !0, t && this.setFormValue(t);
|
|
73
84
|
return;
|
|
74
85
|
}
|
|
75
|
-
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.
|
|
86
|
+
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(
|
|
76
87
|
new CustomEvent("value-change", {
|
|
77
88
|
detail: t,
|
|
78
89
|
bubbles: !0,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./element-B0UgldHm.cjs"),f=require("./state-CG-binsl.cjs"),y=require("./stringutils-CkVRq4jP.cjs"),g=require("./input-wrapper-jPnKsfEC.cjs");var c=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&&c(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=g.specs.props.helptextDropdownButton.default,this.label=null,this.optionalText=e.strings.forms.labels.optional,this.requiredText=e.strings.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.strings.forms.messages.required,t):(r=t.validity)!=null&&r.typeMismatch||(l=t.validity)!=null&&l.badInput?this.internals.setValidity({typeMismatch:!0},e.strings.forms.messages.invalid,t):(a=t.validity)!=null&&a.patternMismatch?this.internals.setValidity({patternMismatch:!0},e.strings.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.strings.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.strings.forms.messages.tooLong,t):(p=t.validity)!=null&&p.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},e.strings.forms.messages.rangeUnderflow,t):(u=t.validity)!=null&&u.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},e.strings.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.internals.setFormValue(this.value),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,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,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./element-B0UgldHm.cjs"),f=require("./pkt-slot-controller-Oc32unDk.cjs"),u=require("./ref-DDYBJ4EB.cjs"),$=require("./icon-PWn7rnfg.cjs"),a=require("./class-map-aeZWY44S.cjs"),I=require("./state-CG-binsl.cjs"),P=require("./stringutils-CkVRq4jP.cjs"),p=require("./input-wrapper-jPnKsfEC.cjs");require("./helptext-xUdEGuNQ.cjs");var W=Object.defineProperty,w=Object.getOwnPropertyDescriptor,e=(h,s,n,o)=>{for(var r=o>1?void 0:o?w(s,n):s,i=h.length-1,l;i>=0;i--)(l=h[i])&&(r=(o?l(s,n,r):l(r))||r);return o&&r&&W(s,n,r),r};exports.PktInputWrapper=class extends t.PktElement{constructor(){super(),this.defaultSlot=u.e(),this.helptextSlot=u.e(),this.hasHelptextSlot=!1,this.forId=P.uuidish(),this.label="",this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=p.specs.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.optionalTag=p.specs.props.optionalTag.default,this.optionalText=p.specs.props.optionalText.default,this.requiredTag=p.specs.props.requiredTag.default,this.requiredText=p.specs.props.requiredText.default,this.hasError=p.specs.props.hasError.default,this.errorMessage="",this.disabled=p.specs.props.disabled.default,this.inline=p.specs.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=p.specs.props.hasFieldset.default,this.useWrapper=p.specs.props.useWrapper.default,this.role="group",this.slotController=new f.PktSlotController(this,this.defaultSlot,this.helptextSlot)}updateSlots(){this.hasHelptextSlot=this.slotController.filledSlots.has("helptext")}updated(s){this.updateSlots(),super.updated(s)}render(){const s={"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},o
|
|
1
|
+
"use strict";const t=require("./element-B0UgldHm.cjs"),f=require("./pkt-slot-controller-Oc32unDk.cjs"),u=require("./ref-DDYBJ4EB.cjs"),$=require("./icon-PWn7rnfg.cjs"),a=require("./class-map-aeZWY44S.cjs"),I=require("./state-CG-binsl.cjs"),P=require("./stringutils-CkVRq4jP.cjs"),p=require("./input-wrapper-jPnKsfEC.cjs");require("./helptext-xUdEGuNQ.cjs");var W=Object.defineProperty,w=Object.getOwnPropertyDescriptor,e=(h,s,n,o)=>{for(var r=o>1?void 0:o?w(s,n):s,i=h.length-1,l;i>=0;i--)(l=h[i])&&(r=(o?l(s,n,r):l(r))||r);return o&&r&&W(s,n,r),r};exports.PktInputWrapper=class extends t.PktElement{constructor(){super(),this.defaultSlot=u.e(),this.helptextSlot=u.e(),this.hasHelptextSlot=!1,this.forId=P.uuidish(),this.label="",this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=p.specs.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.optionalTag=p.specs.props.optionalTag.default,this.optionalText=p.specs.props.optionalText.default,this.requiredTag=p.specs.props.requiredTag.default,this.requiredText=p.specs.props.requiredText.default,this.hasError=p.specs.props.hasError.default,this.errorMessage="",this.disabled=p.specs.props.disabled.default,this.inline=p.specs.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=p.specs.props.hasFieldset.default,this.useWrapper=p.specs.props.useWrapper.default,this.role="group",this.slotController=new f.PktSlotController(this,this.defaultSlot,this.helptextSlot)}updateSlots(){this.hasHelptextSlot=this.slotController.filledSlots.has("helptext")}updated(s){this.updateSlots(),super.updated(s)}render(){const s={"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},o=!!this.helptextDropdown,r={"pkt-inputwrapper__label":!0,"pkt-inputwrapper__fieldset":this.hasFieldset,"pkt-inputwrapper__legend":this.hasFieldset},i=this.ariaDescribedby?this.ariaDescribedby:this.helptext?`${this.forId}-helptext`:t.E,l=()=>this.optionalTag||this.requiredTag?t.x`<span class=${a.e(n)}
|
|
2
2
|
>${this.optionalTag?this.optionalText:this.requiredTag?this.requiredText:t.E}</span
|
|
3
3
|
>`:t.E,c=()=>this.useWrapper?this.hasFieldset?t.x`<legend class="pkt-inputwrapper__legend" id="${this.forId}-label">
|
|
4
4
|
${this.label} ${l()}
|
|
@@ -34,7 +34,7 @@ let t = class extends k {
|
|
|
34
34
|
"pkt-tag--thin-text": !0,
|
|
35
35
|
"pkt-tag--blue-light": this.optionalTag,
|
|
36
36
|
"pkt-tag--beige": !this.optionalTag && this.requiredTag
|
|
37
|
-
}, a = this.helptextDropdown
|
|
37
|
+
}, a = !!this.helptextDropdown, l = {
|
|
38
38
|
"pkt-inputwrapper__label": !0,
|
|
39
39
|
"pkt-inputwrapper__fieldset": this.hasFieldset,
|
|
40
40
|
"pkt-inputwrapper__legend": this.hasFieldset
|
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-D7pwV39B.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 c=require("./alert-uNzcOJR9.cjs"),p=require("./calendar-CPEJ1enc.cjs"),d=require("./card-BaxqXP-k.cjs"),t=require("./element-B0UgldHm.cjs"),P=require("./pkt-slot-controller-Oc32unDk.cjs"),i=require("./ref-DDYBJ4EB.cjs"),k=require("./class-map-aeZWY44S.cjs"),b=require("./datepicker-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./alert-uNzcOJR9.cjs"),p=require("./calendar-CPEJ1enc.cjs"),d=require("./card-BaxqXP-k.cjs"),t=require("./element-B0UgldHm.cjs"),P=require("./pkt-slot-controller-Oc32unDk.cjs"),i=require("./ref-DDYBJ4EB.cjs"),k=require("./class-map-aeZWY44S.cjs"),b=require("./datepicker-D7pwV39B.cjs"),g=require("./helptext-xUdEGuNQ.cjs"),m=require("./icon-PWn7rnfg.cjs"),h=require("./input-wrapper-Bzb_Q9f5.cjs"),f=require("./link-I_LKEBVK.cjs"),y=require("./linkcard-ClXGVwdJ.cjs"),v=require("./messagebox-CC3j63Wp.cjs"),x=require("./modal-KxnVxEio.cjs"),C=require("./progressbar-CkaLjQYa.cjs"),O=require("./radiobutton-CtmelHhh.cjs"),j=require("./tag-DGywzHJ5.cjs"),q=require("./textarea-B5BPghlq.cjs"),S=require("./textinput-s0Fu7Mm5.cjs"),$=require("./select-CIZlf1US.cjs");var _=Object.defineProperty,T=Object.getOwnPropertyDescriptor,o=(a,e,r,s)=>{for(var n=s>1?void 0:s?T(e,r):e,l=a.length-1,u;l>=0;l--)(u=a[l])&&(n=(s?u(e,r,n):u(n))||n);return s&&n&&_(e,r,n),n};exports.PktComponent=class extends t.PktElement{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=i.e(),this.namedSlot=i.e(),this.slotController=new P.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="${k.e(e)}">
|
|
3
3
|
<h1 class="pkt-txt-28">${this.string}</h1>
|
|
4
4
|
|
package/dist/pkt-index.js
CHANGED
|
@@ -6,20 +6,20 @@ import { P as f, x as m, s as k, n, t as c } from "./element-BKrU5soj.js";
|
|
|
6
6
|
import { P as x } from "./pkt-slot-controller-Clbye6cM.js";
|
|
7
7
|
import { e as h, n as d } from "./ref-D5qG7OFB.js";
|
|
8
8
|
import { e as u } from "./class-map-CQzsZCwS.js";
|
|
9
|
-
import { P as D } from "./datepicker-
|
|
9
|
+
import { P as D } from "./datepicker-TJSFbov0.js";
|
|
10
10
|
import { P as R } from "./helptext-DHfBEO42.js";
|
|
11
11
|
import { P as G } from "./icon-Bsb0MB2h.js";
|
|
12
|
-
import { P as M } from "./input-wrapper-
|
|
12
|
+
import { P as M } from "./input-wrapper-DIFdmqZ9.js";
|
|
13
13
|
import { P as N } from "./link-0N9wG5l8.js";
|
|
14
14
|
import { P as W } from "./linkcard-BJeRbpq_.js";
|
|
15
15
|
import { P as z } from "./messagebox-C5M56R8f.js";
|
|
16
16
|
import { P as J } from "./modal-8ATPiGdr.js";
|
|
17
17
|
import { P as V } from "./progressbar-DETyIwXf.js";
|
|
18
|
-
import { P as Y } from "./radiobutton-
|
|
18
|
+
import { P as Y } from "./radiobutton-QyoTuTms.js";
|
|
19
19
|
import { P as tt } from "./tag-W9Lf1doW.js";
|
|
20
|
-
import { P as rt } from "./textarea-
|
|
21
|
-
import { P as ot } from "./textinput-
|
|
22
|
-
import { P as nt } from "./select-
|
|
20
|
+
import { P as rt } from "./textarea-Sh0xZcSC.js";
|
|
21
|
+
import { P as ot } from "./textinput-D8Rq9wE_.js";
|
|
22
|
+
import { P as nt } from "./select-MvNPIow8.js";
|
|
23
23
|
var g = Object.defineProperty, v = Object.getOwnPropertyDescriptor, o = (t, e, i, a) => {
|
|
24
24
|
for (var r = a > 1 ? void 0 : a ? v(e, i) : e, p = t.length - 1, l; p >= 0; p--)
|
|
25
25
|
(l = t[p]) && (r = (a ? l(e, i, r) : l(r)) || r);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./input-wrapper-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./input-wrapper-Bzb_Q9f5.cjs"),t=e.PktInputWrapper;Object.defineProperty(exports,"PktInputWrapper",{enumerable:!0,get:()=>e.PktInputWrapper});exports.default=t;
|
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-CtmelHhh.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-CIZlf1US.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-B5BPghlq.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-s0Fu7Mm5.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,22 @@
|
|
|
1
|
+
"use strict";const t=require("./element-B0UgldHm.cjs"),p=require("./state-CG-binsl.cjs"),r=require("./input-element-DsNGy841.cjs"),l=require("./ref-DDYBJ4EB.cjs"),o=require("./class-map-aeZWY44S.cjs");var d=Object.defineProperty,k=Object.getOwnPropertyDescriptor,i=(n,e,c,h)=>{for(var s=h>1?void 0:h?k(e,c):e,a=n.length-1,u;a>=0;a--)(u=n[a])&&(s=(h?u(e,c,s):u(s))||s);return h&&s&&d(e,c,s),s};exports.PktRadioButton=class extends r.PktInputElement{constructor(){super(...arguments),this.inputRef=l.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=!1,this.role="radio",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,c,h){e==="defaultChecked"&&(this._checked=this.defaultChecked),e==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(e,c,h)}updated(e){super.updated(e),e.has("_checked")&&this.valueChecked(this._checked)}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
|
+
?disabled=${this.disabled}
|
|
9
|
+
name=${this.name+"-internal"}
|
|
10
|
+
${l.n(this.inputRef)}
|
|
11
|
+
@change=${this.toggleChecked}
|
|
12
|
+
@blur=${this.onBlur}
|
|
13
|
+
@focus=${this.onFocus}
|
|
14
|
+
?checked=${this.checked}
|
|
15
|
+
/>
|
|
16
|
+
<label class="pkt-input-check__input-label" for=${this.id+"-internal"}>
|
|
17
|
+
${this.label}
|
|
18
|
+
${this.checkHelptext?t.x`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>`:t.E}
|
|
19
|
+
</label>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
`}toggleChecked(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,"role",2);i([p.r()],exports.PktRadioButton.prototype,"_checked",2);exports.PktRadioButton=i([t.t("pkt-radiobutton")],exports.PktRadioButton);
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { x as o, E as n, n as s, t as d } from "./element-BKrU5soj.js";
|
|
2
|
+
import { r as k } from "./state-C36ZmZgt.js";
|
|
3
|
+
import { P as f } from "./input-element-CaWBIGE_.js";
|
|
4
|
+
import { e as _, n as b } from "./ref-D5qG7OFB.js";
|
|
5
|
+
import { e as u } from "./class-map-CQzsZCwS.js";
|
|
6
|
+
var v = Object.defineProperty, C = Object.getOwnPropertyDescriptor, c = (e, i, l, p) => {
|
|
7
|
+
for (var h = p > 1 ? void 0 : p ? C(i, l) : i, r = e.length - 1, a; r >= 0; r--)
|
|
8
|
+
(a = e[r]) && (h = (p ? a(i, l, h) : a(h)) || h);
|
|
9
|
+
return p && h && v(i, l, h), h;
|
|
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.role = "radio", this._checked = !1;
|
|
14
|
+
}
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
super.connectedCallback();
|
|
17
|
+
}
|
|
18
|
+
attributeChangedCallback(e, i, l) {
|
|
19
|
+
e === "defaultChecked" && (this._checked = this.defaultChecked), e === "checked" && (this._checked = this.checked === "" || this.checked === "true" || this.checked === !0), super.attributeChangedCallback(e, i, l);
|
|
20
|
+
}
|
|
21
|
+
updated(e) {
|
|
22
|
+
super.updated(e), e.has("_checked") && this.valueChecked(this._checked);
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
const e = u({
|
|
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 = u({
|
|
30
|
+
"pkt-input-check__input-checkbox": !0,
|
|
31
|
+
"pkt-input-check__input-checkbox--error": this.hasError
|
|
32
|
+
});
|
|
33
|
+
return o`
|
|
34
|
+
<div class="pkt-input-check">
|
|
35
|
+
<div class=${e}>
|
|
36
|
+
<input
|
|
37
|
+
id=${this.id + "-internal"}
|
|
38
|
+
class=${i}
|
|
39
|
+
type="radio"
|
|
40
|
+
?disabled=${this.disabled}
|
|
41
|
+
name=${this.name + "-internal"}
|
|
42
|
+
${b(this.inputRef)}
|
|
43
|
+
@change=${this.toggleChecked}
|
|
44
|
+
@blur=${this.onBlur}
|
|
45
|
+
@focus=${this.onFocus}
|
|
46
|
+
?checked=${this.checked}
|
|
47
|
+
/>
|
|
48
|
+
<label class="pkt-input-check__input-label" for=${this.id + "-internal"}>
|
|
49
|
+
${this.label}
|
|
50
|
+
${this.checkHelptext ? o`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>` : n}
|
|
51
|
+
</label>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
toggleChecked(e) {
|
|
57
|
+
e.stopImmediatePropagation(), this.touched = !0, this.inputRef.value && (this._checked = this.inputRef.value.matches(":checked"), this.valueChecked(this._checked));
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
c([
|
|
61
|
+
s({ type: String, reflect: !0 })
|
|
62
|
+
], t.prototype, "value", 2);
|
|
63
|
+
c([
|
|
64
|
+
s({ type: String })
|
|
65
|
+
], t.prototype, "checkHelptext", 2);
|
|
66
|
+
c([
|
|
67
|
+
s({ type: Boolean })
|
|
68
|
+
], t.prototype, "defaultChecked", 2);
|
|
69
|
+
c([
|
|
70
|
+
s({ type: Boolean })
|
|
71
|
+
], t.prototype, "hasTile", 2);
|
|
72
|
+
c([
|
|
73
|
+
s({ type: Boolean, reflect: !0 })
|
|
74
|
+
], t.prototype, "checked", 2);
|
|
75
|
+
c([
|
|
76
|
+
s({ type: String, reflect: !0 })
|
|
77
|
+
], t.prototype, "role", 2);
|
|
78
|
+
c([
|
|
79
|
+
k()
|
|
80
|
+
], t.prototype, "_checked", 2);
|
|
81
|
+
t = c([
|
|
82
|
+
d("pkt-radiobutton")
|
|
83
|
+
], t);
|
|
84
|
+
export {
|
|
85
|
+
t as P
|
|
86
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const l=require("./element-B0UgldHm.cjs"),d=require("./state-CG-binsl.cjs"),a=require("./ref-DDYBJ4EB.cjs"),o=require("./if-defined-Br3lDE5v.cjs"),c=require("./input-element-
|
|
1
|
+
"use strict";const l=require("./element-B0UgldHm.cjs"),d=require("./state-CG-binsl.cjs"),a=require("./ref-DDYBJ4EB.cjs"),o=require("./if-defined-Br3lDE5v.cjs"),c=require("./input-element-DsNGy841.cjs"),u=require("./pkt-slot-controller-Oc32unDk.cjs");require("./input-wrapper-Bzb_Q9f5.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,9 +2,9 @@ import { x as p, n as b, t as f } from "./element-BKrU5soj.js";
|
|
|
2
2
|
import { r as v } from "./state-C36ZmZgt.js";
|
|
3
3
|
import { e as u, n as d } from "./ref-D5qG7OFB.js";
|
|
4
4
|
import { o as r } from "./if-defined-f3M1y6S-.js";
|
|
5
|
-
import { P as $ } from "./input-element-
|
|
5
|
+
import { P as $ } from "./input-element-CaWBIGE_.js";
|
|
6
6
|
import { i as c, P as m } from "./pkt-slot-controller-Clbye6cM.js";
|
|
7
|
-
import "./input-wrapper-
|
|
7
|
+
import "./input-wrapper-DIFdmqZ9.js";
|
|
8
8
|
class g {
|
|
9
9
|
constructor(t) {
|
|
10
10
|
this.nodes = [], this.options = [], this.host = t, this.host.addController(this), this.nodes = [], this.options = [], this.observer = new MutationObserver((e) => this.handleMutations(e));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const r=require("./element-B0UgldHm.cjs"),u=require("./state-CG-binsl.cjs"),n=require("./ref-DDYBJ4EB.cjs"),p=require("./class-map-aeZWY44S.cjs"),d=require("./input-element-
|
|
1
|
+
"use strict";const r=require("./element-B0UgldHm.cjs"),u=require("./state-CG-binsl.cjs"),n=require("./ref-DDYBJ4EB.cjs"),p=require("./class-map-aeZWY44S.cjs"),d=require("./input-element-DsNGy841.cjs"),c=require("./pkt-slot-controller-Oc32unDk.cjs");require("./input-wrapper-Bzb_Q9f5.cjs");require("./icon-PWn7rnfg.cjs");/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2020 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -2,9 +2,9 @@ import { e as $, i as g, a as o, T as l, E as h, x as f, n as p, t as x } from "
|
|
|
2
2
|
import { r as v } from "./state-C36ZmZgt.js";
|
|
3
3
|
import { f as b, m as T, e as c, n as m } from "./ref-D5qG7OFB.js";
|
|
4
4
|
import { e as y } from "./class-map-CQzsZCwS.js";
|
|
5
|
-
import { P as w } from "./input-element-
|
|
5
|
+
import { P as w } from "./input-element-CaWBIGE_.js";
|
|
6
6
|
import { P as C } from "./pkt-slot-controller-Clbye6cM.js";
|
|
7
|
-
import "./input-wrapper-
|
|
7
|
+
import "./input-wrapper-DIFdmqZ9.js";
|
|
8
8
|
import "./icon-Bsb0MB2h.js";
|
|
9
9
|
/**
|
|
10
10
|
* @license
|
|
@@ -2,9 +2,9 @@ import { x as h, E as n, n as p, t as $ } from "./element-BKrU5soj.js";
|
|
|
2
2
|
import { r as m } from "./state-C36ZmZgt.js";
|
|
3
3
|
import { e as c, n as d } from "./ref-D5qG7OFB.js";
|
|
4
4
|
import { e as f } from "./class-map-CQzsZCwS.js";
|
|
5
|
-
import { P as g } from "./input-element-
|
|
5
|
+
import { P as g } from "./input-element-CaWBIGE_.js";
|
|
6
6
|
import { P as x } from "./pkt-slot-controller-Clbye6cM.js";
|
|
7
|
-
import "./input-wrapper-
|
|
7
|
+
import "./input-wrapper-DIFdmqZ9.js";
|
|
8
8
|
import "./icon-Bsb0MB2h.js";
|
|
9
9
|
var y = Object.defineProperty, v = Object.getOwnPropertyDescriptor, o = (e, i, r, t) => {
|
|
10
10
|
for (var a = t > 1 ? void 0 : t ? v(i, r) : i, l = e.length - 1, u; l >= 0; l--)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./element-B0UgldHm.cjs"),u=require("./state-CG-binsl.cjs"),p=require("./ref-DDYBJ4EB.cjs"),l=require("./class-map-aeZWY44S.cjs"),c=require("./input-element-
|
|
1
|
+
"use strict";const t=require("./element-B0UgldHm.cjs"),u=require("./state-CG-binsl.cjs"),p=require("./ref-DDYBJ4EB.cjs"),l=require("./class-map-aeZWY44S.cjs"),c=require("./input-element-DsNGy841.cjs"),x=require("./pkt-slot-controller-Oc32unDk.cjs");require("./input-wrapper-Bzb_Q9f5.cjs");require("./icon-PWn7rnfg.cjs");var d=Object.defineProperty,$=Object.getOwnPropertyDescriptor,r=(o,i,n,s)=>{for(var e=s>1?void 0:s?$(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&&d(i,n,e),e};exports.PktTextinput=class extends c.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 x.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=l.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}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "12.27.
|
|
3
|
+
"version": "12.27.6",
|
|
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": "a045a788595aea4d884623c8157494894b73161f"
|
|
61
61
|
}
|
|
@@ -94,7 +94,7 @@ export class PktInputWrapper extends PktElement<Props> {
|
|
|
94
94
|
'pkt-tag--beige': !this.optionalTag && this.requiredTag,
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
const hasDropdown = this.helptextDropdown
|
|
97
|
+
const hasDropdown = !!this.helptextDropdown
|
|
98
98
|
|
|
99
99
|
const wrapperClasses = {
|
|
100
100
|
'pkt-inputwrapper__label': true,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { customElement, property } from 'lit/decorators.js'
|
|
1
|
+
import { customElement, property, state } from 'lit/decorators.js'
|
|
2
2
|
|
|
3
3
|
import { PktInputElement } from '@/base-elements/input-element'
|
|
4
4
|
import { Ref, createRef, ref } from 'lit/directives/ref.js'
|
|
5
|
-
import { html, nothing } from 'lit'
|
|
5
|
+
import { html, nothing, PropertyValues } from 'lit'
|
|
6
6
|
import { classMap } from 'lit/directives/class-map.js'
|
|
7
7
|
|
|
8
8
|
@customElement('pkt-radiobutton')
|
|
@@ -13,13 +13,32 @@ 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 = false
|
|
16
|
+
@property({ type: Boolean, reflect: true }) checked: boolean | string = false
|
|
17
17
|
@property({ type: String, reflect: true }) role: string | null = 'radio'
|
|
18
18
|
|
|
19
|
+
@state() _checked: boolean = false
|
|
20
|
+
|
|
19
21
|
connectedCallback() {
|
|
20
22
|
super.connectedCallback()
|
|
21
23
|
}
|
|
22
24
|
|
|
25
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void {
|
|
26
|
+
if (name === 'defaultChecked') {
|
|
27
|
+
this._checked = this.defaultChecked
|
|
28
|
+
}
|
|
29
|
+
if (name === 'checked') {
|
|
30
|
+
this._checked = this.checked === '' || this.checked === 'true' || this.checked === true
|
|
31
|
+
}
|
|
32
|
+
super.attributeChangedCallback(name, _old, value)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
updated(changedProperties: PropertyValues) {
|
|
36
|
+
super.updated(changedProperties)
|
|
37
|
+
if (changedProperties.has('_checked')) {
|
|
38
|
+
this.valueChecked(this._checked)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
23
42
|
render() {
|
|
24
43
|
const inputTileClasses = classMap({
|
|
25
44
|
'pkt-input-check__input': true,
|
|
@@ -45,6 +64,7 @@ export class PktRadioButton extends PktInputElement {
|
|
|
45
64
|
@change=${this.toggleChecked}
|
|
46
65
|
@blur=${this.onBlur}
|
|
47
66
|
@focus=${this.onFocus}
|
|
67
|
+
?checked=${this.checked}
|
|
48
68
|
/>
|
|
49
69
|
<label class="pkt-input-check__input-label" for=${this.id + '-internal'}>
|
|
50
70
|
${this.label}
|
|
@@ -60,6 +80,9 @@ export class PktRadioButton extends PktInputElement {
|
|
|
60
80
|
private toggleChecked(e: Event) {
|
|
61
81
|
e.stopImmediatePropagation()
|
|
62
82
|
this.touched = true
|
|
63
|
-
|
|
83
|
+
if (this.inputRef.value) {
|
|
84
|
+
this._checked = this.inputRef.value.matches(':checked')
|
|
85
|
+
this.valueChecked(this._checked)
|
|
86
|
+
}
|
|
64
87
|
}
|
|
65
88
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./element-B0UgldHm.cjs"),f=require("./state-CG-binsl.cjs"),y=require("./stringutils-CkVRq4jP.cjs"),g=require("./input-wrapper-jPnKsfEC.cjs");var c=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&&c(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=g.specs.props.helptextDropdownButton.default,this.label=null,this.optionalText=e.strings.forms.labels.optional,this.requiredText=e.strings.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.strings.forms.messages.required,t):(r=t.validity)!=null&&r.typeMismatch||(l=t.validity)!=null&&l.badInput?this.internals.setValidity({typeMismatch:!0},e.strings.forms.messages.invalid,t):(a=t.validity)!=null&&a.patternMismatch?this.internals.setValidity({patternMismatch:!0},e.strings.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.strings.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.strings.forms.messages.tooLong,t):(p=t.validity)!=null&&p.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},e.strings.forms.messages.rangeUnderflow,t):(u=t.validity)!=null&&u.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},e.strings.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)}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.checked!==void 0&&(this.internals.ariaChecked=this.inputRef.value.matches(":checked"),this.checked=this.inputRef.value.matches(":checked")),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,75 +0,0 @@
|
|
|
1
|
-
import { x as a, E as u, n as l, t as d } from "./element-BKrU5soj.js";
|
|
2
|
-
import { P as k } from "./input-element-URKBm_vS.js";
|
|
3
|
-
import { e as f, n as _ } from "./ref-D5qG7OFB.js";
|
|
4
|
-
import { e as h } from "./class-map-CQzsZCwS.js";
|
|
5
|
-
var b = Object.defineProperty, v = Object.getOwnPropertyDescriptor, i = (s, p, c, r) => {
|
|
6
|
-
for (var t = r > 1 ? void 0 : r ? v(p, c) : p, n = s.length - 1, o; n >= 0; n--)
|
|
7
|
-
(o = s[n]) && (t = (r ? o(p, c, t) : o(t)) || t);
|
|
8
|
-
return r && t && b(p, c, t), t;
|
|
9
|
-
};
|
|
10
|
-
let e = class extends k {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(...arguments), this.inputRef = f(), this.value = "", this.checkHelptext = null, this.defaultChecked = !1, this.hasTile = !1, this.checked = !1, this.role = "radio";
|
|
13
|
-
}
|
|
14
|
-
connectedCallback() {
|
|
15
|
-
super.connectedCallback();
|
|
16
|
-
}
|
|
17
|
-
render() {
|
|
18
|
-
const s = h({
|
|
19
|
-
"pkt-input-check__input": !0,
|
|
20
|
-
"pkt-input-check__input--tile": this.hasTile,
|
|
21
|
-
"pkt-input-check__input--tile-disabled": this.disabled && this.hasTile
|
|
22
|
-
}), p = h({
|
|
23
|
-
"pkt-input-check__input-checkbox": !0,
|
|
24
|
-
"pkt-input-check__input-checkbox--error": this.hasError
|
|
25
|
-
});
|
|
26
|
-
return a`
|
|
27
|
-
<div class="pkt-input-check">
|
|
28
|
-
<div class=${s}>
|
|
29
|
-
<input
|
|
30
|
-
id=${this.id + "-internal"}
|
|
31
|
-
class=${p}
|
|
32
|
-
type="radio"
|
|
33
|
-
?disabled=${this.disabled}
|
|
34
|
-
name=${this.name + "-internal"}
|
|
35
|
-
${_(this.inputRef)}
|
|
36
|
-
@change=${this.toggleChecked}
|
|
37
|
-
@blur=${this.onBlur}
|
|
38
|
-
@focus=${this.onFocus}
|
|
39
|
-
/>
|
|
40
|
-
<label class="pkt-input-check__input-label" for=${this.id + "-internal"}>
|
|
41
|
-
${this.label}
|
|
42
|
-
${this.checkHelptext ? a`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>` : u}
|
|
43
|
-
</label>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
`;
|
|
47
|
-
}
|
|
48
|
-
toggleChecked(s) {
|
|
49
|
-
s.stopImmediatePropagation(), this.touched = !0, this.onChange(this.value);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
i([
|
|
53
|
-
l({ type: String, reflect: !0 })
|
|
54
|
-
], e.prototype, "value", 2);
|
|
55
|
-
i([
|
|
56
|
-
l({ type: String })
|
|
57
|
-
], e.prototype, "checkHelptext", 2);
|
|
58
|
-
i([
|
|
59
|
-
l({ type: Boolean })
|
|
60
|
-
], e.prototype, "defaultChecked", 2);
|
|
61
|
-
i([
|
|
62
|
-
l({ type: Boolean })
|
|
63
|
-
], e.prototype, "hasTile", 2);
|
|
64
|
-
i([
|
|
65
|
-
l({ type: Boolean, reflect: !0 })
|
|
66
|
-
], e.prototype, "checked", 2);
|
|
67
|
-
i([
|
|
68
|
-
l({ type: String, reflect: !0 })
|
|
69
|
-
], e.prototype, "role", 2);
|
|
70
|
-
e = i([
|
|
71
|
-
d("pkt-radiobutton")
|
|
72
|
-
], e);
|
|
73
|
-
export {
|
|
74
|
-
e as P
|
|
75
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("./element-B0UgldHm.cjs"),u=require("./input-element-Dnda8hac.cjs"),r=require("./ref-DDYBJ4EB.cjs"),a=require("./class-map-aeZWY44S.cjs");var h=Object.defineProperty,d=Object.getOwnPropertyDescriptor,n=(c,e,s,o)=>{for(var i=o>1?void 0:o?d(e,s):e,l=c.length-1,p;l>=0;l--)(p=c[l])&&(i=(o?p(e,s,i):p(i))||i);return o&&i&&h(e,s,i),i};exports.PktRadioButton=class extends u.PktInputElement{constructor(){super(...arguments),this.inputRef=r.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=!1,this.role="radio"}connectedCallback(){super.connectedCallback()}render(){const e=a.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),s=a.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=${s}
|
|
7
|
-
type="radio"
|
|
8
|
-
?disabled=${this.disabled}
|
|
9
|
-
name=${this.name+"-internal"}
|
|
10
|
-
${r.n(this.inputRef)}
|
|
11
|
-
@change=${this.toggleChecked}
|
|
12
|
-
@blur=${this.onBlur}
|
|
13
|
-
@focus=${this.onFocus}
|
|
14
|
-
/>
|
|
15
|
-
<label class="pkt-input-check__input-label" for=${this.id+"-internal"}>
|
|
16
|
-
${this.label}
|
|
17
|
-
${this.checkHelptext?t.x`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>`:t.E}
|
|
18
|
-
</label>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
`}toggleChecked(e){e.stopImmediatePropagation(),this.touched=!0,this.onChange(this.value)}};n([t.n({type:String,reflect:!0})],exports.PktRadioButton.prototype,"value",2);n([t.n({type:String})],exports.PktRadioButton.prototype,"checkHelptext",2);n([t.n({type:Boolean})],exports.PktRadioButton.prototype,"defaultChecked",2);n([t.n({type:Boolean})],exports.PktRadioButton.prototype,"hasTile",2);n([t.n({type:Boolean,reflect:!0})],exports.PktRadioButton.prototype,"checked",2);n([t.n({type:String,reflect:!0})],exports.PktRadioButton.prototype,"role",2);exports.PktRadioButton=n([t.t("pkt-radiobutton")],exports.PktRadioButton);
|