@oslokommune/punkt-elements 12.42.11 → 12.42.13

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.
Files changed (131) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/{accordionitem-aQHOrGzf.js → accordionitem-C9FI-NXW.js} +3 -3
  3. package/dist/{accordionitem-C4NQFQHo.cjs → accordionitem-DjAWPtsn.cjs} +1 -1
  4. package/dist/{alert-sBHt7DSh.js → alert-B0OUR9oD.js} +5 -5
  5. package/dist/{alert-DUWuhtFC.cjs → alert-BH0lJ2ny.cjs} +1 -1
  6. package/dist/{backlink-BnlrDl9O.js → backlink-B13JTp9D.js} +2 -2
  7. package/dist/{backlink-CcAZfB1d.cjs → backlink-C5jQRMwJ.cjs} +1 -1
  8. package/dist/{button-BT-FRGMk.cjs → button-CDocR7iN.cjs} +1 -1
  9. package/dist/{button-B4Oe8Ar0.js → button-DrrEvUy9.js} +4 -4
  10. package/dist/{calendar-D4qfcRtv.cjs → calendar-BZe2D4Sr.cjs} +1 -1
  11. package/dist/{calendar-Df6-FDRW.js → calendar-DevQhOup.js} +4 -4
  12. package/dist/{card-CXhVAeOG.cjs → card-Bx36j0q4.cjs} +1 -1
  13. package/dist/{card-0Kf9L0A_.js → card-Djnd-pgo.js} +6 -6
  14. package/dist/{checkbox-CiXWukkL.cjs → checkbox-CJ4tK9RC.cjs} +1 -1
  15. package/dist/{checkbox-B67_cfqW.js → checkbox-cD_5LDzV.js} +4 -4
  16. package/dist/{class-map-DWDPOqjO.cjs → class-map-BBG2gMX4.cjs} +1 -1
  17. package/dist/{class-map-m7ZCZ49w.js → class-map-BpTj9gtz.js} +1 -1
  18. package/dist/{combobox-Dq7F5v-u.cjs → combobox-Cv6i7BEk.cjs} +1 -1
  19. package/dist/{combobox-CsFDvh8U.js → combobox-kWGI4RHI.js} +11 -11
  20. package/dist/{consent-B17ZIuwm.js → consent-CftYu8Di.js} +3 -3
  21. package/dist/{consent-CILYIgC-.cjs → consent-DrS71kvz.cjs} +1 -1
  22. package/dist/{datepicker-DOf9XK9v.cjs → datepicker-BJe92Vor.cjs} +1 -1
  23. package/dist/{datepicker-Cz6seIz1.js → datepicker-LpbYHx8L.js} +11 -11
  24. package/dist/{directive-helpers-v9b0v7lu.cjs → directive-helpers-BBbxqP2W.cjs} +1 -1
  25. package/dist/{directive-helpers--4ibN__v.js → directive-helpers-r-kOS_Mf.js} +1 -1
  26. package/dist/element-6DBpyGQm.cjs +238 -0
  27. package/dist/{element-gAd63VwC.js → element-CgEWt74-.js} +7039 -7516
  28. package/dist/heading-BRE_iFtR.cjs +1 -0
  29. package/dist/heading-D6jXE_Mz.js +58 -0
  30. package/dist/{helptext-BG_b6ytC.js → helptext-B7eI0iBQ.js} +5 -5
  31. package/dist/{helptext-CC3qLmEz.cjs → helptext-CzQX6YVE.cjs} +1 -1
  32. package/dist/{icon-B1_BRNqf.cjs → icon-B_ryAy4Q.cjs} +1 -1
  33. package/dist/{icon-CO1TLSs5.js → icon-CC1js8eR.js} +1 -1
  34. package/dist/{if-defined-Cj-3Kdsr.js → if-defined-CmuO4Vz9.js} +1 -1
  35. package/dist/{if-defined-C8eotHpL.cjs → if-defined-Cni-RHLS.cjs} +1 -1
  36. package/dist/index.d.ts +33 -32
  37. package/dist/input-element-CHjLWeKt.cjs +1 -0
  38. package/dist/input-element-Cco4PA2M.js +700 -0
  39. package/dist/{input-wrapper-Dk0rKRlz.cjs → input-wrapper-BxZf8wEP.cjs} +1 -1
  40. package/dist/{input-wrapper-CC_R5w7V.js → input-wrapper-gz7ppKrK.js} +6 -6
  41. package/dist/{link-C9X0huxP.js → link-C76H6Qf1.js} +4 -4
  42. package/dist/{link-qTz-qNVI.cjs → link-DTkjNlmy.cjs} +1 -1
  43. package/dist/{linkcard-Bhk2ttou.js → linkcard-BVEsUPwG.js} +3 -3
  44. package/dist/{linkcard-CaBz6i7A.cjs → linkcard-BlMhPNry.cjs} +1 -1
  45. package/dist/{listbox-AjDNhDsQ.cjs → listbox-C4supLfR.cjs} +1 -1
  46. package/dist/{listbox-DCWdrjFp.js → listbox-CLsSW32I.js} +5 -5
  47. package/dist/{loader-BqYcg8Di.cjs → loader-CHPxY9c6.cjs} +1 -1
  48. package/dist/{loader-DMp859px.js → loader-Da4IOk_T.js} +5 -5
  49. package/dist/{messagebox-Do_nAUo3.cjs → messagebox-CqUBJs_D.cjs} +1 -1
  50. package/dist/{messagebox-_1f12rDq.js → messagebox-DwGdcdm7.js} +5 -5
  51. package/dist/{modal-C1inKvts.cjs → modal-BdA5aWGU.cjs} +1 -1
  52. package/dist/{modal-C3kEgTMj.js → modal-DcXPnFus.js} +5 -5
  53. package/dist/pkt-accordion.cjs +1 -1
  54. package/dist/pkt-accordion.js +2 -2
  55. package/dist/pkt-alert.cjs +1 -1
  56. package/dist/pkt-alert.js +1 -1
  57. package/dist/pkt-backlink.cjs +1 -1
  58. package/dist/pkt-backlink.js +1 -1
  59. package/dist/pkt-button.cjs +1 -1
  60. package/dist/pkt-button.js +1 -1
  61. package/dist/pkt-calendar.cjs +1 -1
  62. package/dist/pkt-calendar.js +1 -1
  63. package/dist/pkt-card.cjs +1 -1
  64. package/dist/pkt-card.js +1 -1
  65. package/dist/pkt-checkbox.cjs +1 -1
  66. package/dist/pkt-checkbox.js +1 -1
  67. package/dist/pkt-combobox.cjs +1 -1
  68. package/dist/pkt-combobox.js +1 -1
  69. package/dist/pkt-consent.cjs +1 -1
  70. package/dist/pkt-consent.js +1 -1
  71. package/dist/pkt-datepicker.cjs +1 -1
  72. package/dist/pkt-datepicker.js +1 -1
  73. package/dist/pkt-heading.cjs +1 -1
  74. package/dist/pkt-heading.js +1 -1
  75. package/dist/pkt-helptext.cjs +1 -1
  76. package/dist/pkt-helptext.js +1 -1
  77. package/dist/pkt-icon.cjs +1 -1
  78. package/dist/pkt-icon.js +1 -1
  79. package/dist/pkt-index.cjs +1 -1
  80. package/dist/pkt-index.js +29 -29
  81. package/dist/pkt-input-wrapper.cjs +1 -1
  82. package/dist/pkt-input-wrapper.js +1 -1
  83. package/dist/pkt-link.cjs +1 -1
  84. package/dist/pkt-link.js +1 -1
  85. package/dist/pkt-linkcard.cjs +1 -1
  86. package/dist/pkt-linkcard.js +1 -1
  87. package/dist/pkt-listbox.cjs +1 -1
  88. package/dist/pkt-listbox.js +1 -1
  89. package/dist/pkt-loader.cjs +1 -1
  90. package/dist/pkt-loader.js +1 -1
  91. package/dist/pkt-messagebox.cjs +1 -1
  92. package/dist/pkt-messagebox.js +1 -1
  93. package/dist/pkt-modal.cjs +1 -1
  94. package/dist/pkt-modal.js +1 -1
  95. package/dist/pkt-progressbar.cjs +1 -1
  96. package/dist/pkt-progressbar.js +2 -2
  97. package/dist/pkt-radiobutton.cjs +1 -1
  98. package/dist/pkt-radiobutton.js +1 -1
  99. package/dist/pkt-select.cjs +1 -1
  100. package/dist/pkt-select.js +1 -1
  101. package/dist/pkt-tag.cjs +1 -1
  102. package/dist/pkt-tag.js +1 -1
  103. package/dist/pkt-textarea.cjs +1 -1
  104. package/dist/pkt-textarea.js +1 -1
  105. package/dist/pkt-textinput.cjs +1 -1
  106. package/dist/pkt-textinput.js +1 -1
  107. package/dist/{progressbar-BrXtjUvh.cjs → progressbar-DhMBXkww.cjs} +1 -1
  108. package/dist/{progressbar-BSO0KWzv.js → progressbar-Dj_mI_A6.js} +5 -5
  109. package/dist/{radiobutton-x10h-JEh.cjs → radiobutton-0vVqu-GU.cjs} +1 -1
  110. package/dist/{radiobutton-BaIDDCwK.js → radiobutton-BcFRJFvI.js} +5 -5
  111. package/dist/{ref-DnSbnXsj.js → ref-BBYSqgeW.js} +2 -2
  112. package/dist/{ref-B-w1vCo8.cjs → ref-iJtiv3o2.cjs} +1 -1
  113. package/dist/{repeat-lUFq9w5d.js → repeat-C8BeHwYx.js} +2 -2
  114. package/dist/{repeat-CxQA3AeF.cjs → repeat-CDsZqct8.cjs} +1 -1
  115. package/dist/{select-BlL8T2BX.js → select-BaLHLuvH.js} +6 -6
  116. package/dist/{select-BkVSXR5K.cjs → select-CFpdOlDE.cjs} +1 -1
  117. package/dist/{state-BxrO4zNJ.js → state-Bo2bck5_.js} +1 -1
  118. package/dist/{state-D-Recv7U.cjs → state-DPobt-Yz.cjs} +1 -1
  119. package/dist/{tag-m7OTZaCG.js → tag-BWm6s48d.js} +6 -6
  120. package/dist/{tag-DrbI0ng3.cjs → tag-DPk3fpEg.cjs} +1 -1
  121. package/dist/{textarea-Dc1sUaxx.cjs → textarea-CViiuZdR.cjs} +1 -1
  122. package/dist/{textarea-Dk8hQMD2.js → textarea-EIFo7GZz.js} +9 -9
  123. package/dist/{textinput-6Ip-0aVY.js → textinput-BHS7b-Jt.js} +8 -8
  124. package/dist/{textinput-DuLZ26DB.cjs → textinput-_ZdyMA9O.cjs} +1 -1
  125. package/package.json +3 -3
  126. package/src/components/heading/heading.ts +64 -37
  127. package/dist/element-90YeMNbV.cjs +0 -238
  128. package/dist/heading-CGGKEZve.js +0 -59
  129. package/dist/heading-Cmh5bbTl.cjs +0 -1
  130. package/dist/input-element-BEvaQK4g.js +0 -229
  131. package/dist/input-element-CInrWeac.cjs +0 -1
@@ -1,59 +0,0 @@
1
- import { P as f, x as l, n as o, a as d } from "./element-gAd63VwC.js";
2
- import { P as g } from "./pkt-slot-controller-BPGj-LC5.js";
3
- import { e as r } from "./class-map-m7ZCZ49w.js";
4
- import { e as $, n as i } from "./ref-DnSbnXsj.js";
5
- var S = Object.defineProperty, y = Object.getOwnPropertyDescriptor, a = (t, n, p, h) => {
6
- for (var e = h > 1 ? void 0 : h ? y(n, p) : n, u = t.length - 1, c; u >= 0; u--)
7
- (c = t[u]) && (e = (h ? c(n, p, e) : c(e)) || e);
8
- return h && e && S(n, p, e), e;
9
- };
10
- let s = class extends f {
11
- constructor() {
12
- super(), this.defaultSlot = $(), this.size = "medium", this.level = 2, this.noSpacing = !0, this.visuallyHidden = !1, this.align = "start", this.slotController = new g(this, this.defaultSlot);
13
- }
14
- render() {
15
- const t = {
16
- "pkt-heading": !0,
17
- [`pkt-heading--${this.size}`]: this.size,
18
- "pkt-heading--noSpacing": this.noSpacing,
19
- "pkt-sr-only": this.visuallyHidden,
20
- [`pkt-heading--${this.align}`]: this.align
21
- };
22
- switch (this.level) {
23
- case 2:
24
- return l`<h2 class=${r(t)} ${i(this.defaultSlot)}></h2>`;
25
- case 3:
26
- return l`<h3 class=${r(t)} ${i(this.defaultSlot)}></h3>`;
27
- case 4:
28
- return l`<h4 class=${r(t)} ${i(this.defaultSlot)}></h4>`;
29
- case 5:
30
- return l`<h5 class=${r(t)} ${i(this.defaultSlot)}></h5>`;
31
- case 6:
32
- return l`<h6 class=${r(t)} ${i(this.defaultSlot)}></h6>`;
33
- case 1:
34
- default:
35
- return l`<h1 class=${r(t)} ${i(this.defaultSlot)}></h1>`;
36
- }
37
- }
38
- };
39
- a([
40
- o({ type: String, reflect: !0 })
41
- ], s.prototype, "size", 2);
42
- a([
43
- o({ type: Number, reflect: !0 })
44
- ], s.prototype, "level", 2);
45
- a([
46
- o({ type: Boolean, reflect: !0 })
47
- ], s.prototype, "noSpacing", 2);
48
- a([
49
- o({ type: Boolean, reflect: !0 })
50
- ], s.prototype, "visuallyHidden", 2);
51
- a([
52
- o({ type: String, reflect: !0 })
53
- ], s.prototype, "align", 2);
54
- s = a([
55
- d("pkt-heading")
56
- ], s);
57
- export {
58
- s as P
59
- };
@@ -1 +0,0 @@
1
- "use strict";const e=require("./element-90YeMNbV.cjs"),c=require("./pkt-slot-controller-BzddBp7z.cjs"),l=require("./class-map-DWDPOqjO.cjs"),n=require("./ref-B-w1vCo8.cjs");var p=Object.defineProperty,d=Object.getOwnPropertyDescriptor,r=(a,t,o,i)=>{for(var s=i>1?void 0:i?d(t,o):t,h=a.length-1,u;h>=0;h--)(u=a[h])&&(s=(i?u(t,o,s):u(s))||s);return i&&s&&p(t,o,s),s};exports.PktHeading=class extends e.PktElement{constructor(){super(),this.defaultSlot=n.e(),this.size="medium",this.level=2,this.noSpacing=!0,this.visuallyHidden=!1,this.align="start",this.slotController=new c.PktSlotController(this,this.defaultSlot)}render(){const t={"pkt-heading":!0,[`pkt-heading--${this.size}`]:this.size,"pkt-heading--noSpacing":this.noSpacing,"pkt-sr-only":this.visuallyHidden,[`pkt-heading--${this.align}`]:this.align};switch(this.level){case 2:return e.x`<h2 class=${l.e(t)} ${n.n(this.defaultSlot)}></h2>`;case 3:return e.x`<h3 class=${l.e(t)} ${n.n(this.defaultSlot)}></h3>`;case 4:return e.x`<h4 class=${l.e(t)} ${n.n(this.defaultSlot)}></h4>`;case 5:return e.x`<h5 class=${l.e(t)} ${n.n(this.defaultSlot)}></h5>`;case 6:return e.x`<h6 class=${l.e(t)} ${n.n(this.defaultSlot)}></h6>`;case 1:default:return e.x`<h1 class=${l.e(t)} ${n.n(this.defaultSlot)}></h1>`}}};r([e.n({type:String,reflect:!0})],exports.PktHeading.prototype,"size",2);r([e.n({type:Number,reflect:!0})],exports.PktHeading.prototype,"level",2);r([e.n({type:Boolean,reflect:!0})],exports.PktHeading.prototype,"noSpacing",2);r([e.n({type:Boolean,reflect:!0})],exports.PktHeading.prototype,"visuallyHidden",2);r([e.n({type:String,reflect:!0})],exports.PktHeading.prototype,"align",2);exports.PktHeading=r([e.t("pkt-heading")],exports.PktHeading);
@@ -1,229 +0,0 @@
1
- import { P as g, t as a, n as s } from "./element-gAd63VwC.js";
2
- import { r as v } from "./state-BxrO4zNJ.js";
3
- import { u as b } from "./stringutils-DJjRa8dG.js";
4
- import { s as V } from "./input-wrapper-8iKEzDRZ.js";
5
- var k = Object.defineProperty, e = (u, t, r, n) => {
6
- for (var l = void 0, h = u.length - 1, o; h >= 0; h--)
7
- (o = u[h]) && (l = o(t, r, l) || l);
8
- return l && k(t, r, l), l;
9
- };
10
- class i extends g {
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.step = null, this.ariaDescribedBy = null, this.ariaLabelledby = null, this.name = "", this.pattern = null, this.placeholder = null, this.id = b(), this.counter = !1, this.hasError = !1, this.inline = !1, this.hasFieldset = !1, this.optionalTag = !1, this.requiredTag = !1, this.skipForwardTestid = !1, this.useWrapper = !0, this.fullwidth = !1, this.counterMaxLength = 0, this.errorMessage = "", this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = V.props.helptextDropdownButton.default, this.label = null, this.optionalText = a.forms.labels.optional, this.requiredText = a.forms.labels.required, this.dataTestid = "", this.touched = !1, this.internals = this.attachInternals();
13
- }
14
- static get formAssociated() {
15
- return !0;
16
- }
17
- manageValidity(t) {
18
- var r, n, l, h, o, p, d, f, c, m, y;
19
- t && (this.required && !this.value ? this.internals.setValidity({ valueMissing: !0 }, a.forms.messages.required, t) : (r = t.validity) != null && r.typeMismatch || (n = t.validity) != null && n.badInput ? this.internals.setValidity({ typeMismatch: !0 }, a.forms.messages.invalid, t) : (l = t.validity) != null && l.patternMismatch ? this.internals.setValidity(
20
- { patternMismatch: !0 },
21
- a.forms.messages.invalidPattern,
22
- t
23
- ) : (h = t.validity) != null && h.tooShort || this.minlength && this.minlength > 0 && this.value.length < this.minlength ? this.internals.setValidity({ tooShort: !0 }, a.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 }, a.forms.messages.tooLong, t) : (p = t.validity) != null && p.rangeUnderflow ? this.internals.setValidity(
24
- { rangeUnderflow: !0 },
25
- this.min ? a.forms.messages.rangeUnderflowMin.replace("{min}", (d = this.min) == null ? void 0 : d.toString()) : a.forms.messages.rangeUnderflow,
26
- t
27
- ) : (f = t.validity) != null && f.stepMismatch ? this.internals.setValidity({ stepMismatch: !0 }, a.forms.messages.invalid, t) : (c = t.validity) != null && c.rangeOverflow ? this.internals.setValidity(
28
- { rangeOverflow: !0 },
29
- this.max ? a.forms.messages.rangeOverflowMax.replace("{max}", (m = this.max) == null ? void 0 : m.toString()) : a.forms.messages.rangeOverflow,
30
- t
31
- ) : (y = t.validity) != null && y.customError ? this.internals.setValidity({ customError: !0 }, t.validationMessage, t) : this.internals.setValidity({}));
32
- }
33
- setFormValue(t) {
34
- if (this.internals)
35
- if (Array.isArray(t)) {
36
- const r = new FormData();
37
- t.forEach((n) => {
38
- r.append(this.name, n);
39
- }), this.internals.setFormValue(r);
40
- } else
41
- this.internals.setFormValue(t);
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
- if (!this.touched) return;
47
- const r = this.internals.form || this.closest("form"), n = r ? new FormData(r) : null;
48
- r && r.querySelectorAll(
49
- `pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`
50
- ).forEach((l) => {
51
- const h = l;
52
- h.name === this.name && h.value !== this.value && h.checked && (h.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"), n && n.append(this.name, this.value || "on"), this.internals.states.add("--checked")) : (this.internals.setFormValue(null, null), n && n.delete(this.name), this.internals.states.delete("--checked")), this.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 })), this.dispatchEvent(
54
- new CustomEvent("value-change", {
55
- detail: this.checked,
56
- bubbles: !0,
57
- composed: !0
58
- })
59
- ), this.internals.reportValidity();
60
- }
61
- valueChanged(t, r) {
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 = this.multiple || this.range ? t : t[0], this._value = t) : (this.value = "", this._value = []), (!this.value || this.value.length === 0) && r && r.length !== 0 ? this.clearInputValue() : this.value && this.value.toString() !== (r == null ? void 0 : r.toString()) && this.onChange(this.value), this.updateComplete.then(() => this.requestUpdate()));
63
- }
64
- // When input goes from content to no content
65
- clearInputValue() {
66
- const t = this.multiple || this.range ? [] : "";
67
- this.value = t, this.internals.setFormValue(t), this.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 })), this.dispatchEvent(
68
- new CustomEvent("value-change", {
69
- detail: t,
70
- bubbles: !0,
71
- composed: !0
72
- })
73
- );
74
- }
75
- // When user enters the input, we need to push that event out to the form
76
- onFocus() {
77
- this.dispatchEvent(new FocusEvent("focus", { bubbles: !0, composed: !0 }));
78
- }
79
- // And also when the user leaves the input...
80
- onBlur() {
81
- this.dispatchEvent(new FocusEvent("blur", { bubbles: !0, composed: !0 }));
82
- }
83
- // Trigger this when user types in the input
84
- onInput() {
85
- this.dispatchEvent(new InputEvent("input", { bubbles: !0, composed: !0 }));
86
- }
87
- // Trigger this when you want to set the value of the input out to the form
88
- onChange(t) {
89
- if (!this.touched) {
90
- this.touched = !0, t && this.setFormValue(t);
91
- return;
92
- }
93
- 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", { bubbles: !0, composed: !0 })), this.dispatchEvent(
94
- new CustomEvent("value-change", {
95
- detail: t,
96
- bubbles: !0,
97
- composed: !0
98
- })
99
- ));
100
- }
101
- formResetCallback() {
102
- this.touched = !1, this._options && this._options.length && this._options.forEach((t) => {
103
- t.selected = !1;
104
- }), this.checked !== void 0 ? (this.checked = !1, this.internals.ariaChecked = !1, this.internals.setFormValue("", ""), this.inputRef.value.checked = !1, this.valueChecked(this.checked)) : (this.internals.setFormValue(""), this.value = this.defaultValue || (this.multiple || this.range ? [] : ""), this._value = this.value, this.valueChanged(this.value, null)), this.internals.ariaInvalid = !1;
105
- }
106
- updated(t) {
107
- 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")));
108
- }
109
- firstUpdated(t) {
110
- if (super.firstUpdated(t), !this.form) {
111
- const r = this.internals.form || this.closest("form");
112
- this.form = r;
113
- }
114
- if (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) {
115
- const r = this.checked === "" || this.checked === "true" || this.checked === !0;
116
- this.internals.ariaChecked = r, this.internals.setFormValue(
117
- r ? this.value || "on" : "",
118
- r ? this.value || "on" : ""
119
- );
120
- } else
121
- this.internals.setFormValue(this.value);
122
- 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));
123
- }
124
- }
125
- e([
126
- s()
127
- ], i.prototype, "defaultValue");
128
- e([
129
- s({ type: Boolean, reflect: !0 })
130
- ], i.prototype, "disabled");
131
- e([
132
- s({ type: Boolean, reflect: !0 })
133
- ], i.prototype, "readonly");
134
- e([
135
- s({ type: Boolean, reflect: !0 })
136
- ], i.prototype, "required");
137
- e([
138
- s({ type: Number, reflect: !0 })
139
- ], i.prototype, "max");
140
- e([
141
- s({ type: Number, reflect: !0 })
142
- ], i.prototype, "maxlength");
143
- e([
144
- s({ type: Number, reflect: !0 })
145
- ], i.prototype, "min");
146
- e([
147
- s({ type: Number, reflect: !0 })
148
- ], i.prototype, "minlength");
149
- e([
150
- s({ type: Number, reflect: !0 })
151
- ], i.prototype, "step");
152
- e([
153
- s({ type: String })
154
- ], i.prototype, "ariaDescribedBy");
155
- e([
156
- s({ type: String })
157
- ], i.prototype, "ariaLabelledby");
158
- e([
159
- s({ type: String, reflect: !0 })
160
- ], i.prototype, "name");
161
- e([
162
- s({ type: String, reflect: !0 })
163
- ], i.prototype, "pattern");
164
- e([
165
- s({ type: String, reflect: !0 })
166
- ], i.prototype, "placeholder");
167
- e([
168
- s({ type: String, reflect: !0 })
169
- ], i.prototype, "id");
170
- e([
171
- s({ type: Boolean })
172
- ], i.prototype, "counter");
173
- e([
174
- s({ type: Boolean })
175
- ], i.prototype, "hasError");
176
- e([
177
- s({ type: Boolean })
178
- ], i.prototype, "inline");
179
- e([
180
- s({ type: Boolean })
181
- ], i.prototype, "hasFieldset");
182
- e([
183
- s({ type: Boolean })
184
- ], i.prototype, "optionalTag");
185
- e([
186
- s({ type: Boolean })
187
- ], i.prototype, "requiredTag");
188
- e([
189
- s({ type: Boolean })
190
- ], i.prototype, "skipForwardTestid");
191
- e([
192
- s({ type: Boolean, reflect: !1 })
193
- ], i.prototype, "useWrapper");
194
- e([
195
- s({ type: Boolean, reflect: !0 })
196
- ], i.prototype, "fullwidth");
197
- e([
198
- s({ type: Number })
199
- ], i.prototype, "counterMaxLength");
200
- e([
201
- s({ type: String })
202
- ], i.prototype, "errorMessage");
203
- e([
204
- s({ type: String })
205
- ], i.prototype, "helptext");
206
- e([
207
- s({ type: String })
208
- ], i.prototype, "helptextDropdown");
209
- e([
210
- s({ type: String, reflect: !1 })
211
- ], i.prototype, "helptextDropdownButton");
212
- e([
213
- s({ type: String })
214
- ], i.prototype, "label");
215
- e([
216
- s({ type: String, reflect: !1 })
217
- ], i.prototype, "optionalText");
218
- e([
219
- s({ type: String, reflect: !1 })
220
- ], i.prototype, "requiredText");
221
- e([
222
- s({ type: String, attribute: "data-testid" })
223
- ], i.prototype, "dataTestid");
224
- e([
225
- v()
226
- ], i.prototype, "touched");
227
- export {
228
- i as P
229
- };
@@ -1 +0,0 @@
1
- "use strict";const e=require("./element-90YeMNbV.cjs"),y=require("./state-D-Recv7U.cjs"),g=require("./stringutils-CkVRq4jP.cjs"),v=require("./input-wrapper-EoSAbU-U.cjs");var b=Object.defineProperty,i=(o,t,a,l)=>{for(var r=void 0,n=o.length-1,h;n>=0;n--)(h=o[n])&&(r=h(t,a,r)||r);return r&&b(t,a,r),r};class s 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.step=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=g.uuidish(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=v.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 a,l,r,n,h,u,p,d,f,c,m;t&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},e.translations.forms.messages.required,t):(a=t.validity)!=null&&a.typeMismatch||(l=t.validity)!=null&&l.badInput?this.internals.setValidity({typeMismatch:!0},e.translations.forms.messages.invalid,t):(r=t.validity)!=null&&r.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):(u=t.validity)!=null&&u.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?e.translations.forms.messages.rangeUnderflowMin.replace("{min}",(p=this.min)==null?void 0:p.toString()):e.translations.forms.messages.rangeUnderflow,t):(d=t.validity)!=null&&d.stepMismatch?this.internals.setValidity({stepMismatch:!0},e.translations.forms.messages.invalid,t):(f=t.validity)!=null&&f.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?e.translations.forms.messages.rangeOverflowMax.replace("{max}",(c=this.max)==null?void 0:c.toString()):e.translations.forms.messages.rangeOverflow,t):(m=t.validity)!=null&&m.customError?this.internals.setValidity({customError:!0},t.validationMessage,t):this.internals.setValidity({}))}setFormValue(t){if(this.internals)if(Array.isArray(t)){const a=new FormData;t.forEach(l=>{a.append(this.name,l)}),this.internals.setFormValue(a)}else this.internals.setFormValue(t)}valueChecked(t){if(!this.touched)return;const a=this.internals.form||this.closest("form"),l=a?new FormData(a):null;a&&a.querySelectorAll(`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`).forEach(r=>{const n=r;n.name===this.name&&n.value!==this.value&&n.checked&&(n.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"),l&&l.append(this.name,this.value||"on"),this.internals.states.add("--checked")):(this.internals.setFormValue(null,null),l&&l.delete(this.name),this.internals.states.delete("--checked")),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:this.checked,bubbles:!0,composed:!0})),this.internals.reportValidity()}valueChanged(t,a){(a!==this.value||a!==this._value)&&(typeof t=="string"?((this.multiple||this.range)&&t.includes(",")&&(t=t.split(",")),this.value=t,this._value=Array.isArray(t)?t:[t]):Array.isArray(t)?(this.value=this.multiple||this.range?t:t[0],this._value=t):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&a&&a.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(a==null?void 0:a.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",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}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",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0})))}formResetCallback(){this.touched=!1,this._options&&this._options.length&&this._options.forEach(t=>{t.selected=!1}),this.checked!==void 0?(this.checked=!1,this.internals.ariaChecked=!1,this.internals.setFormValue("",""),this.inputRef.value.checked=!1,this.valueChecked(this.checked)):(this.internals.setFormValue(""),this.value=this.defaultValue||(this.multiple||this.range?[]:""),this._value=this.value,this.valueChanged(this.value,null)),this.internals.ariaInvalid=!1}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.form){const a=this.internals.form||this.closest("form");this.form=a}if(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 a=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=a,this.internals.setFormValue(a?this.value||"on":"",a?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))}}i([e.n()],s.prototype,"defaultValue");i([e.n({type:Boolean,reflect:!0})],s.prototype,"disabled");i([e.n({type:Boolean,reflect:!0})],s.prototype,"readonly");i([e.n({type:Boolean,reflect:!0})],s.prototype,"required");i([e.n({type:Number,reflect:!0})],s.prototype,"max");i([e.n({type:Number,reflect:!0})],s.prototype,"maxlength");i([e.n({type:Number,reflect:!0})],s.prototype,"min");i([e.n({type:Number,reflect:!0})],s.prototype,"minlength");i([e.n({type:Number,reflect:!0})],s.prototype,"step");i([e.n({type:String})],s.prototype,"ariaDescribedBy");i([e.n({type:String})],s.prototype,"ariaLabelledby");i([e.n({type:String,reflect:!0})],s.prototype,"name");i([e.n({type:String,reflect:!0})],s.prototype,"pattern");i([e.n({type:String,reflect:!0})],s.prototype,"placeholder");i([e.n({type:String,reflect:!0})],s.prototype,"id");i([e.n({type:Boolean})],s.prototype,"counter");i([e.n({type:Boolean})],s.prototype,"hasError");i([e.n({type:Boolean})],s.prototype,"inline");i([e.n({type:Boolean})],s.prototype,"hasFieldset");i([e.n({type:Boolean})],s.prototype,"optionalTag");i([e.n({type:Boolean})],s.prototype,"requiredTag");i([e.n({type:Boolean})],s.prototype,"skipForwardTestid");i([e.n({type:Boolean,reflect:!1})],s.prototype,"useWrapper");i([e.n({type:Boolean,reflect:!0})],s.prototype,"fullwidth");i([e.n({type:Number})],s.prototype,"counterMaxLength");i([e.n({type:String})],s.prototype,"errorMessage");i([e.n({type:String})],s.prototype,"helptext");i([e.n({type:String})],s.prototype,"helptextDropdown");i([e.n({type:String,reflect:!1})],s.prototype,"helptextDropdownButton");i([e.n({type:String})],s.prototype,"label");i([e.n({type:String,reflect:!1})],s.prototype,"optionalText");i([e.n({type:String,reflect:!1})],s.prototype,"requiredText");i([e.n({type:String,attribute:"data-testid"})],s.prototype,"dataTestid");i([y.r()],s.prototype,"touched");exports.PktInputElement=s;