@oslokommune/punkt-elements 12.31.2 → 12.32.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/dist/alert-C2WKLFow.cjs +27 -0
  2. package/dist/alert-XGjypFHe.js +115 -0
  3. package/dist/alert.d.ts +32 -0
  4. package/dist/{backlink-CzpB-ih9.js → backlink-BX8HBhw5.js} +2 -2
  5. package/dist/{backlink-Dn4DfWVR.cjs → backlink-NJdC0FAO.cjs} +1 -1
  6. package/dist/backlink.d.ts +32 -0
  7. package/dist/{button-9NwGr-OS.js → button-Bn8jVB0f.js} +33 -33
  8. package/dist/{button-Beo3c7cx.cjs → button-Bpbh8A_a.cjs} +2 -2
  9. package/dist/button.d.ts +32 -0
  10. package/dist/{calendar-BbZNxsKY.js → calendar-BNHDEEwT.js} +20 -84
  11. package/dist/{calendar-CxBo98iI.cjs → calendar-Ds13AKr5.cjs} +4 -4
  12. package/dist/calendar.d.ts +32 -0
  13. package/dist/card-CEv3DL-o.js +94 -0
  14. package/dist/card-c5EEPaNh.cjs +28 -0
  15. package/dist/card.d.ts +32 -0
  16. package/dist/{checkbox-9Zjy_NU7.cjs → checkbox-DDBBDM85.cjs} +1 -1
  17. package/dist/{checkbox-CzDpR6_8.js → checkbox-DoMYxp83.js} +9 -9
  18. package/dist/checkbox.d.ts +32 -0
  19. package/dist/{class-map-DWtqmIRS.js → class-map-D4tSZX70.js} +2 -2
  20. package/dist/{class-map-Dj5mbCUg.cjs → class-map-DvBKxTiW.cjs} +1 -1
  21. package/dist/combobox-BflWORVa.cjs +115 -0
  22. package/dist/combobox-l7LmWQYu.js +491 -0
  23. package/dist/combobox.d.ts +47 -0
  24. package/dist/datepicker-Bkiyh5P5.cjs +153 -0
  25. package/dist/datepicker-nWd89NwP.js +449 -0
  26. package/dist/datepicker.d.ts +32 -0
  27. package/dist/directive-C7oCP5Bh.cjs +5 -0
  28. package/dist/directive-helpers-BmXIK-1b.js +45 -0
  29. package/dist/directive-helpers-donnvcEO.cjs +5 -0
  30. package/dist/{directive-B76A7YXI.js → directive-oAbCiebi.js} +4 -4
  31. package/dist/element-DJpGVXjq.cjs +238 -0
  32. package/dist/{element-C7XjZtLU.js → element-DiqKrDty.js} +8851 -8847
  33. package/dist/{helptext-CqnoPodd.js → helptext-DfRusn5R.js} +13 -13
  34. package/dist/{helptext-B9kxDc2b.cjs → helptext-aHD9icur.cjs} +2 -2
  35. package/dist/helptext.d.ts +32 -0
  36. package/dist/{icon-BEUgV9Wo.js → icon-BdY52BIt.js} +2 -2
  37. package/dist/{icon-BOKusjAA.cjs → icon-UtDKPH3R.cjs} +1 -1
  38. package/dist/icon.d.ts +32 -0
  39. package/dist/{if-defined-CpIkv1A4.cjs → if-defined-CoBDkDGb.cjs} +1 -1
  40. package/dist/{if-defined-eRX4e5zO.js → if-defined-DeANa4n5.js} +1 -1
  41. package/dist/index.d.ts +210 -15
  42. package/dist/{input-element-BK8UkQli.js → input-element-C4mmTk6h.js} +23 -20
  43. package/dist/input-element-VNai8bsq.cjs +1 -0
  44. package/dist/input-wrapper-8iKEzDRZ.js +40 -0
  45. package/dist/input-wrapper-DWOw7Yn-.cjs +52 -0
  46. package/dist/input-wrapper-EoSAbU-U.cjs +1 -0
  47. package/dist/input-wrapper-P_oEi6dk.js +185 -0
  48. package/dist/input-wrapper.d.ts +32 -0
  49. package/dist/link-D9dJ6F-R.js +73 -0
  50. package/dist/link-DBxXqsnP.cjs +8 -0
  51. package/dist/link.d.ts +32 -0
  52. package/dist/{linkcard-2WzDJPZz.cjs → linkcard-D5O1hR7N.cjs} +1 -1
  53. package/dist/{linkcard-CRpo3tiw.js → linkcard-DcEE9IVw.js} +4 -4
  54. package/dist/linkcard.d.ts +32 -0
  55. package/dist/listbox-CK1GmwCE.cjs +95 -0
  56. package/dist/listbox-CfJWJDrc.js +360 -0
  57. package/dist/listbox.d.ts +47 -0
  58. package/dist/{loader-B1edLWTg.js → loader-DZvOlXzI.js} +6 -6
  59. package/dist/{loader-DI74pe25.cjs → loader-SDXJp58K.cjs} +1 -1
  60. package/dist/loader.d.ts +32 -0
  61. package/dist/messagebox-Ce5e1gga.js +79 -0
  62. package/dist/messagebox-D2_-WZQG.cjs +12 -0
  63. package/dist/messagebox.d.ts +32 -0
  64. package/dist/modal-CCtUsYKk.cjs +33 -0
  65. package/dist/{modal-kPX8nO_L.js → modal-CdgIOp8Q.js} +51 -94
  66. package/dist/modal.d.ts +32 -0
  67. package/dist/pkt-alert.cjs +1 -1
  68. package/dist/pkt-alert.js +1 -1
  69. package/dist/pkt-backlink.cjs +1 -1
  70. package/dist/pkt-backlink.js +1 -1
  71. package/dist/pkt-button.cjs +1 -1
  72. package/dist/pkt-button.js +1 -1
  73. package/dist/pkt-calendar.cjs +1 -1
  74. package/dist/pkt-calendar.js +1 -1
  75. package/dist/pkt-card.cjs +1 -1
  76. package/dist/pkt-card.js +1 -1
  77. package/dist/pkt-checkbox.cjs +1 -1
  78. package/dist/pkt-checkbox.js +1 -1
  79. package/dist/pkt-combobox.cjs +1 -0
  80. package/dist/pkt-combobox.js +6 -0
  81. package/dist/pkt-datepicker.cjs +1 -1
  82. package/dist/pkt-datepicker.js +1 -1
  83. package/dist/pkt-helptext.cjs +1 -1
  84. package/dist/pkt-helptext.js +1 -1
  85. package/dist/pkt-icon.cjs +1 -1
  86. package/dist/pkt-icon.js +1 -1
  87. package/dist/pkt-index.cjs +3 -3
  88. package/dist/pkt-index.js +45 -43
  89. package/dist/pkt-input-wrapper.cjs +1 -1
  90. package/dist/pkt-input-wrapper.js +1 -1
  91. package/dist/pkt-link.cjs +1 -1
  92. package/dist/pkt-link.js +1 -1
  93. package/dist/pkt-linkcard.cjs +1 -1
  94. package/dist/pkt-linkcard.js +1 -1
  95. package/dist/pkt-listbox.cjs +1 -0
  96. package/dist/pkt-listbox.js +6 -0
  97. package/dist/pkt-loader.cjs +1 -1
  98. package/dist/pkt-loader.js +1 -1
  99. package/dist/pkt-messagebox.cjs +1 -1
  100. package/dist/pkt-messagebox.js +1 -1
  101. package/dist/pkt-modal.cjs +1 -1
  102. package/dist/pkt-modal.js +1 -1
  103. package/dist/pkt-options-controller-BkWE4pZe.js +38 -0
  104. package/dist/pkt-options-controller-TJ1apYGF.cjs +1 -0
  105. package/dist/pkt-progressbar.cjs +1 -1
  106. package/dist/pkt-progressbar.js +2 -2
  107. package/dist/pkt-radiobutton.cjs +1 -1
  108. package/dist/pkt-radiobutton.js +1 -1
  109. package/dist/pkt-select.cjs +1 -1
  110. package/dist/pkt-select.js +1 -1
  111. package/dist/pkt-slot-controller-BtVLTZb7.js +79 -0
  112. package/dist/pkt-slot-controller-plQxXRvV.cjs +1 -0
  113. package/dist/pkt-tag.cjs +1 -1
  114. package/dist/pkt-tag.js +1 -1
  115. package/dist/pkt-textarea.cjs +1 -1
  116. package/dist/pkt-textarea.js +1 -1
  117. package/dist/pkt-textinput.cjs +1 -1
  118. package/dist/pkt-textinput.js +1 -1
  119. package/dist/{progressbar-D0nxLqHu.js → progressbar-DvFz9KBo.js} +6 -6
  120. package/dist/{progressbar-B6A9UVXS.cjs → progressbar-jASTnhti.cjs} +1 -1
  121. package/dist/progressbar.d.ts +32 -0
  122. package/dist/{radiobutton-BWyQgR_x.cjs → radiobutton-C-Xd5sSq.cjs} +1 -1
  123. package/dist/{radiobutton-DLWjvLBO.js → radiobutton-D03aN4yn.js} +5 -5
  124. package/dist/radiobutton.d.ts +32 -0
  125. package/dist/ref-B70YZNXm.js +102 -0
  126. package/dist/ref-CLqTsViF.cjs +9 -0
  127. package/dist/repeat-CNLpCTun.js +61 -0
  128. package/dist/repeat-t2oms1o6.cjs +5 -0
  129. package/dist/select-BLDaK5Rd.js +118 -0
  130. package/dist/select-Dvds7MzS.cjs +49 -0
  131. package/dist/select.d.ts +32 -0
  132. package/dist/{state-HNj0_316.cjs → state-C4LdlTYO.cjs} +1 -1
  133. package/dist/{state-CDQk0DFQ.js → state-CDwPbiQj.js} +1 -1
  134. package/dist/tag-C52KeBmR.cjs +18 -0
  135. package/dist/{tag-CmFcSdOV.js → tag-DoS5S2Bq.js} +28 -77
  136. package/dist/tag.d.ts +32 -0
  137. package/dist/{textarea-BPqWCymU.js → textarea-C9EvdPGi.js} +18 -17
  138. package/dist/{textarea-VG-UTMLP.cjs → textarea-DJvNBmEL.cjs} +6 -6
  139. package/dist/textarea.d.ts +32 -0
  140. package/dist/{textinput-CEP7QA3E.cjs → textinput-Cg3ObBuw.cjs} +5 -4
  141. package/dist/{textinput-VD74aGzx.js → textinput-CxRSSYaN.js} +34 -33
  142. package/dist/textinput.d.ts +32 -0
  143. package/package.json +4 -4
  144. package/src/components/button/button.ts +3 -2
  145. package/src/components/combobox/combobox.ts +873 -0
  146. package/src/components/combobox/countrycodes.json +927 -0
  147. package/src/components/combobox/index.ts +6 -0
  148. package/src/components/datepicker/datepicker.ts +6 -4
  149. package/src/components/helptext/helptext.ts +1 -1
  150. package/src/components/index.ts +7 -0
  151. package/src/components/input-wrapper/input-wrapper.ts +42 -34
  152. package/src/components/listbox/index.ts +4 -0
  153. package/src/components/listbox/listbox.ts +474 -0
  154. package/src/components/select/select.ts +7 -0
  155. package/src/components/tag/tag.ts +1 -1
  156. package/src/components/textinput/textinput.ts +3 -2
  157. package/dist/alert-BDxxRqgi.cjs +0 -27
  158. package/dist/alert-D0S57u0r.js +0 -163
  159. package/dist/card-C63x_nll.cjs +0 -28
  160. package/dist/card-DQfNKnKl.js +0 -176
  161. package/dist/datepicker-CYUvRGhE.js +0 -663
  162. package/dist/datepicker-FuAL0uNU.cjs +0 -155
  163. package/dist/directive-C_VV3qwo.cjs +0 -5
  164. package/dist/element-CzFXQBoS.cjs +0 -238
  165. package/dist/input-element-Dtyuf6s8.cjs +0 -1
  166. package/dist/input-wrapper-Bo2_t6pA.cjs +0 -50
  167. package/dist/input-wrapper-Bw9tARAD.js +0 -125
  168. package/dist/input-wrapper-DaZZq8c0.js +0 -172
  169. package/dist/input-wrapper-jPnKsfEC.cjs +0 -1
  170. package/dist/link-1iq0Pmuf.cjs +0 -8
  171. package/dist/link-D3U0Jkz8.js +0 -109
  172. package/dist/messagebox-DQpEMkS2.cjs +0 -12
  173. package/dist/messagebox-KP-8-tA9.js +0 -114
  174. package/dist/modal-ytIJwfr3.cjs +0 -33
  175. package/dist/pkt-slot-controller-Clbye6cM.js +0 -85
  176. package/dist/pkt-slot-controller-Oc32unDk.cjs +0 -1
  177. package/dist/ref-2anvRHT4.cjs +0 -13
  178. package/dist/ref-DbOSDQbk.js +0 -143
  179. package/dist/select-CzuxXKll.js +0 -150
  180. package/dist/select-DZL6aa2s.cjs +0 -48
  181. package/dist/tag-BeLSOjNh.cjs +0 -18
@@ -1,33 +0,0 @@
1
- "use strict";const d=require("./class-map-Dj5mbCUg.cjs"),s=require("./element-CzFXQBoS.cjs"),k=require("./state-HNj0_316.cjs"),m=require("./pkt-slot-controller-Oc32unDk.cjs"),r=require("./ref-2anvRHT4.cjs");require("./icon-BOKusjAA.cjs");const h="pkt-modal",g=!0,f={"background-click":{description:"Event som trigges når bakgrunnen trykkes på"},close:{description:"Event som trigges når meldingsboksen lukkes"}},v={headingText:{name:"Heading text",description:"Heading tekst på modalen",type:"string"},hideCloseButton:{name:"Gjem 'Lukk'-knapp",description:"Gjemmer lukkeknappen. Dersom denne er satt til true, vil ikke lukkeknappen vises, og dermed er det viktig at man tilbyr en annen måte som f.eks. en knapp for å lukke modalen på.",type:"boolean",default:!1},closeOnBackdropClick:{name:"Lukk modalen når bakgrunnen trykkes på",description:"Lukk modalen når bakgrunnen trykkes på",type:"boolean",default:!1},closeButtonSkin:{name:"Stil på lukkeknappen",description:"Stil på lukkeknappen",type:["blue","yellow-filled"],default:"blue"},size:{name:"Størrelse",description:"Størrelsen på modalen",type:["small","medium","large"],default:"medium"}},b={default:{description:"Innholdet i meldingen. Her tilbyr vi støtteklasser for å style 1-3 knapper i modalen."}},u={name:h,"css-class":"pkt-modal",isElements:g,events:f,props:v,slots:b};var y=Object.defineProperty,_=Object.getOwnPropertyDescriptor,l=(c,e,t,n)=>{for(var o=n>1?void 0:n?_(e,t):e,i=c.length-1,a;i>=0;i--)(a=c[i])&&(o=(n?a(e,t,o):a(o))||o);return n&&o&&y(e,t,o),o};exports.PktModal=class extends s.PktElement{constructor(){super(),this.headingText="",this.removePadding=!1,this.hideCloseButton=u.props.hideCloseButton.default,this.closeOnBackdropClick=u.props.closeOnBackdropClick.default,this.closeButtonSkin="blue",this.size=u.props.size.default,this.defaultSlot=r.e(),this.dialogRef=r.e(),this._isOpen=!1,this.close=(e,t=!1)=>{var o;if(!this._isOpen)return;this._isOpen=!1,document.body.classList.remove("pkt-modal--open");const n=document.activeElement;n&&!this.isElementInViewport(n)&&n.scrollIntoView({behavior:"smooth",block:"nearest"}),this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),t||(o=this.dialogRef.value)==null||o.close(),this.requestUpdate()},this.showModal=e=>{var n;this._isOpen=!0,(n=this.dialogRef.value)==null||n.showModal();const t=document.querySelector(".pkt-modal");requestAnimationFrame(()=>{var o;this.dialogRef.value&&((o=this.dialogRef.value)==null||o.focus())}),t&&document.body.classList.add("pkt-modal--open"),this.dispatchEvent(new CustomEvent("showModal",{detail:{origin:e},bubbles:!0,composed:!0})),this.requestUpdate()},this.slotController=new m.PktSlotController(this,this.defaultSlot),this._isOpen=!1}async connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("click",this.handleBackdropClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("click",this.handleBackdropClick)}handleKeyDown(e){e.key==="Escape"&&this.close(e)}handleBackdropClick(e){var t;this.closeOnBackdropClick&&e.target===((t=this.dialogRef)==null?void 0:t.value)&&this.close(e)}isElementInViewport(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}render(){const e={"pkt-modal":!0,"pkt-modal--removePadding":this.removePadding??!1,"pkt-modal--noHeadingText":this.headingText===""||this.headingText===void 0,[`pkt-modal--${this.size}`]:this.size!==void 0},t={"pkt-modal__headingText":!0,"pkt-txt-24":!0},n={"pkt-modal__content":!0,"pkt-txt-18-light":!0},o=this.closeButtonSkin==="blue",i={"pkt-modal__closeButton":!0,[`pkt-modal__closeButton--${this.closeButtonSkin}`]:!0},a={"pkt-btn":!0,[`pkt-btn--${o?"tertiary":"primary"}`]:!0,"pkt-btn--icon-only":!0,"pkt-btn--medium":!0};return s.x`
2
- <dialog
3
- class=${d.e(e)}
4
- ${r.n(this.dialogRef)}
5
- aria-labelledby="pkt-modal__headingText"
6
- aria-describedby="pkt-modal__content"
7
- @close=${p=>this.close(p,!0)}
8
- >
9
- <div class="pkt-modal__header">
10
- <div class="pkt-modal__header-background"></div>
11
- ${this.headingText?s.x`<h1 id="pkt-modal__headingText" class=${d.e(t)}>
12
- ${this.headingText}
13
- </h1>`:s.E}
14
- ${this.hideCloseButton?s.E:s.x`<div class="${d.e(i)}">
15
- <pkt-button
16
- @click=${p=>this.close(p)}
17
- class=${d.e(a)}
18
- aria-label="close"
19
- iconname="close"
20
- variant="icon-only"
21
- >
22
- </pkt-button>
23
- </div>`}
24
- </div>
25
- <div class="pkt-modal__container">
26
- <div
27
- id="pkt-modal__content"
28
- class=${d.e(n)}
29
- ${r.n(this.defaultSlot)}
30
- ></div>
31
- </div>
32
- </dialog>
33
- `}};l([s.n({type:String,reflect:!0})],exports.PktModal.prototype,"headingText",2);l([s.n({type:Boolean,reflect:!0})],exports.PktModal.prototype,"removePadding",2);l([s.n({type:Boolean,reflect:!0})],exports.PktModal.prototype,"hideCloseButton",2);l([s.n({type:Boolean,reflect:!0})],exports.PktModal.prototype,"closeOnBackdropClick",2);l([s.n({type:String,reflect:!0})],exports.PktModal.prototype,"closeButtonSkin",2);l([s.n({type:String,reflect:!0})],exports.PktModal.prototype,"size",2);l([k.r()],exports.PktModal.prototype,"_isOpen",2);exports.PktModal=l([s.t("pkt-modal")],exports.PktModal);
@@ -1,85 +0,0 @@
1
- function a(s, e) {
2
- return e.some((t) => t.value === s);
3
- }
4
- function d(s, e) {
5
- var t;
6
- return s.hasAttribute("data-skip") ? [] : s === ((t = e.value) == null ? void 0 : t.parentNode) ? [] : s instanceof HTMLTemplateElement ? Array.from(s.content.childNodes) : [s];
7
- }
8
- function r(s) {
9
- return typeof s.hasAttribute == "function" && s.hasAttribute("data-skip");
10
- }
11
- function h(s) {
12
- return s.nodeName === "OPTION" || s.nodeName === "DATA";
13
- }
14
- function u(s, e) {
15
- return s.nodeType === Node.ELEMENT_NODE && !a(s, e);
16
- }
17
- function p(s) {
18
- var e;
19
- return s.nodeType === Node.TEXT_NODE && ((e = s.nodeValue) == null ? void 0 : e.trim()) !== "";
20
- }
21
- class f {
22
- constructor(e, ...t) {
23
- this.nodes = [], this.filledSlots = /* @__PURE__ */ new Set(), this.skipOptions = !1, this.updatingSlots = !1, this.host = e, this.host.addController(this), this.slots = t, this.nodes = [], this.observer = new MutationObserver((o) => this.handleMutations(o));
24
- }
25
- hostConnected() {
26
- this.updateNodes(), this.observer.observe(this.host, { childList: !0 });
27
- }
28
- hostDisconnected() {
29
- this.observer.disconnect();
30
- }
31
- hostUpdated() {
32
- this.updateSlots();
33
- }
34
- updateNodes() {
35
- this.nodes = [], Array.from(this.host.childNodes).forEach((t) => {
36
- var o;
37
- if (!r(t) && !(h(t) && this.skipOptions))
38
- if (t.nodeType === Node.TEXT_NODE && ((o = t.nodeValue) != null && o.trim())) {
39
- const i = document == null ? void 0 : document.createElement("template");
40
- i.content.appendChild(t), this.nodes.push(i);
41
- } else a(t, this.slots) || this.nodes.push(t);
42
- });
43
- }
44
- updateSlots() {
45
- if (this.updatingSlots) return;
46
- this.updatingSlots = !0;
47
- const e = /* @__PURE__ */ new Set();
48
- this.slots.forEach((t) => {
49
- if (!t.value) return;
50
- const o = t.value.getAttribute("name"), l = this.nodes.flatMap(
51
- (n) => n.getAttribute && n.getAttribute("slot") == o && !n.hasAttribute("data-skip") ? d(n, t) : []
52
- ).filter(
53
- (n) => t.value && !t.value.contains(n) && !n.contains(t.value)
54
- );
55
- if (l.length > 0)
56
- if (e.add(o), typeof t.value.replaceChildren != "function") {
57
- for (; t.value.firstChild; )
58
- t.value.removeChild(t.value.firstChild);
59
- t.value.append(...l);
60
- } else
61
- t.value.replaceChildren(...l);
62
- }), (this.filledSlots.size !== e.size || ![...this.filledSlots].every((t) => e.has(t))) && (this.filledSlots = e, Array.from(this.filledSlots).length && !(Array.from(this.filledSlots).length === 1 && Array.from(this.filledSlots)[0] !== null) && this.host.requestUpdate()), this.updatingSlots = !1;
63
- }
64
- handleMutations(e) {
65
- let t = !1;
66
- e.forEach((o) => {
67
- o.type === "childList" && (o.addedNodes.forEach((i) => {
68
- if (!r(i) && !(h(i) && this.skipOptions)) {
69
- if (u(i, this.slots))
70
- this.nodes.push(i), t = !0;
71
- else if (p(i)) {
72
- const l = document == null ? void 0 : document.createElement("template");
73
- l.content.appendChild(i), this.nodes.push(l), t = !0;
74
- }
75
- }
76
- }), o.removedNodes.forEach((i) => {
77
- r(i) || h(i) && this.skipOptions || (this.nodes = this.nodes.filter((l) => l !== i), t = !0);
78
- }));
79
- }), t && this.updateSlots();
80
- }
81
- }
82
- export {
83
- f as P,
84
- h as i
85
- };
@@ -1 +0,0 @@
1
- "use strict";function a(s,e){return e.some(t=>t.value===s)}function d(s,e){var t;return s.hasAttribute("data-skip")?[]:s===((t=e.value)==null?void 0:t.parentNode)?[]:s instanceof HTMLTemplateElement?Array.from(s.content.childNodes):[s]}function h(s){return typeof s.hasAttribute=="function"&&s.hasAttribute("data-skip")}function r(s){return s.nodeName==="OPTION"||s.nodeName==="DATA"}function u(s,e){return s.nodeType===Node.ELEMENT_NODE&&!a(s,e)}function p(s){var e;return s.nodeType===Node.TEXT_NODE&&((e=s.nodeValue)==null?void 0:e.trim())!==""}class f{constructor(e,...t){this.nodes=[],this.filledSlots=new Set,this.skipOptions=!1,this.updatingSlots=!1,this.host=e,this.host.addController(this),this.slots=t,this.nodes=[],this.observer=new MutationObserver(o=>this.handleMutations(o))}hostConnected(){this.updateNodes(),this.observer.observe(this.host,{childList:!0})}hostDisconnected(){this.observer.disconnect()}hostUpdated(){this.updateSlots()}updateNodes(){this.nodes=[],Array.from(this.host.childNodes).forEach(t=>{var o;if(!h(t)&&!(r(t)&&this.skipOptions))if(t.nodeType===Node.TEXT_NODE&&((o=t.nodeValue)!=null&&o.trim())){const i=document==null?void 0:document.createElement("template");i.content.appendChild(t),this.nodes.push(i)}else a(t,this.slots)||this.nodes.push(t)})}updateSlots(){if(this.updatingSlots)return;this.updatingSlots=!0;const e=new Set;this.slots.forEach(t=>{if(!t.value)return;const o=t.value.getAttribute("name"),l=this.nodes.flatMap(n=>n.getAttribute&&n.getAttribute("slot")==o&&!n.hasAttribute("data-skip")?d(n,t):[]).filter(n=>t.value&&!t.value.contains(n)&&!n.contains(t.value));if(l.length>0)if(e.add(o),typeof t.value.replaceChildren!="function"){for(;t.value.firstChild;)t.value.removeChild(t.value.firstChild);t.value.append(...l)}else t.value.replaceChildren(...l)}),(this.filledSlots.size!==e.size||![...this.filledSlots].every(t=>e.has(t)))&&(this.filledSlots=e,Array.from(this.filledSlots).length&&!(Array.from(this.filledSlots).length===1&&Array.from(this.filledSlots)[0]!==null)&&this.host.requestUpdate()),this.updatingSlots=!1}handleMutations(e){let t=!1;e.forEach(o=>{o.type==="childList"&&(o.addedNodes.forEach(i=>{if(!h(i)&&!(r(i)&&this.skipOptions)){if(u(i,this.slots))this.nodes.push(i),t=!0;else if(p(i)){const l=document==null?void 0:document.createElement("template");l.content.appendChild(i),this.nodes.push(l),t=!0}}}),o.removedNodes.forEach(i=>{h(i)||r(i)&&this.skipOptions||(this.nodes=this.nodes.filter(l=>l!==i),t=!0)}))}),t&&this.updateSlots()}}exports.PktSlotController=f;exports.isOptionElement=r;
@@ -1,13 +0,0 @@
1
- "use strict";const l=require("./element-CzFXQBoS.cjs"),d=require("./directive-C_VV3qwo.cjs");/**
2
- * @license
3
- * Copyright 2020 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */const{I:p}=l.Z,u=t=>t.strings===void 0,a=()=>document.createComment(""),Y=(t,s,e)=>{var h;const i=t._$AA.parentNode,n=s===void 0?t._$AB:s._$AA;if(e===void 0){const c=i.insertBefore(a(),n),$=i.insertBefore(a(),n);e=new p(c,$,t,t.options)}else{const c=e._$AB.nextSibling,$=e._$AM,f=$!==t;if(f){let o;(h=e._$AQ)==null||h.call(e,t),e._$AM=t,e._$AP!==void 0&&(o=t._$AU)!==$._$AU&&e._$AP(o)}if(c!==n||f){let o=e._$AA;for(;o!==c;){const g=o.nextSibling;i.insertBefore(o,n),o=g}}}return e},C=(t,s,e=t)=>(t._$AI(s,e),t),M={},m=(t,s=M)=>t._$AH=s,b=t=>t._$AH,N=t=>{var i;(i=t._$AP)==null||i.call(t,!1,!0);let s=t._$AA;const e=t._$AB.nextSibling;for(;s!==e;){const n=s.nextSibling;s.remove(),s=n}};/**
6
- * @license
7
- * Copyright 2017 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- */const r=(t,s)=>{var i;const e=t._$AN;if(e===void 0)return!1;for(const n of e)(i=n._$AO)==null||i.call(n,s,!1),r(n,s);return!0},A=t=>{let s,e;do{if((s=t._$AM)===void 0)break;e=s._$AN,e.delete(t),t=s}while((e==null?void 0:e.size)===0)},v=t=>{for(let s;s=t._$AM;t=s){let e=s._$AN;if(e===void 0)s._$AN=e=new Set;else if(e.has(t))break;e.add(t),B(s)}};function w(t){this._$AN!==void 0?(A(this),this._$AM=t,v(this)):this._$AM=t}function x(t,s=!1,e=0){const i=this._$AH,n=this._$AN;if(n!==void 0&&n.size!==0)if(s)if(Array.isArray(i))for(let h=e;h<i.length;h++)r(i[h],!1),A(i[h]);else i!=null&&(r(i,!1),A(i));else r(this,t)}const B=t=>{t.type==d.t.CHILD&&(t._$AP??(t._$AP=x),t._$AQ??(t._$AQ=w))};class y extends d.i{constructor(){super(...arguments),this._$AN=void 0}_$AT(s,e,i){super._$AT(s,e,i),v(this),this.isConnected=s._$AU}_$AO(s,e=!0){var i,n;s!==this.isConnected&&(this.isConnected=s,s?(i=this.reconnected)==null||i.call(this):(n=this.disconnected)==null||n.call(this)),e&&(r(this,s),A(this))}setValue(s){if(u(this._$Ct))this._$Ct._$AI(s,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=s,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}/**
10
- * @license
11
- * Copyright 2020 Google LLC
12
- * SPDX-License-Identifier: BSD-3-Clause
13
- */const H=()=>new I;class I{}const _=new WeakMap,S=d.e(class extends y{render(t){return l.E}update(t,[s]){var i;const e=s!==this.Y;return e&&this.Y!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=s,this.ht=(i=t.options)==null?void 0:i.host,this.rt(this.ct=t.element)),l.E}rt(t){if(this.isConnected||(t=void 0),typeof this.Y=="function"){const s=this.ht??globalThis;let e=_.get(s);e===void 0&&(e=new WeakMap,_.set(s,e)),e.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),e.set(this.Y,t),t!==void 0&&this.Y.call(this.ht,t)}else this.Y.value=t}get lt(){var t,s;return typeof this.Y=="function"?(t=_.get(this.ht??globalThis))==null?void 0:t.get(this.Y):(s=this.Y)==null?void 0:s.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});exports.M=N;exports.e=H;exports.f=u;exports.m=m;exports.n=S;exports.p=b;exports.r=Y;exports.v=C;
@@ -1,143 +0,0 @@
1
- import { Z as u, E as d } from "./element-C7XjZtLU.js";
2
- import { i as p, t as g, e as Y } from "./directive-B76A7YXI.js";
3
- /**
4
- * @license
5
- * Copyright 2020 Google LLC
6
- * SPDX-License-Identifier: BSD-3-Clause
7
- */
8
- const { I: m } = u, C = (t) => t.strings === void 0, f = () => document.createComment(""), I = (t, s, e) => {
9
- var o;
10
- const i = t._$AA.parentNode, n = s === void 0 ? t._$AB : s._$AA;
11
- if (e === void 0) {
12
- const c = i.insertBefore(f(), n), $ = i.insertBefore(f(), n);
13
- e = new m(c, $, t, t.options);
14
- } else {
15
- const c = e._$AB.nextSibling, $ = e._$AM, l = $ !== t;
16
- if (l) {
17
- let h;
18
- (o = e._$AQ) == null || o.call(e, t), e._$AM = t, e._$AP !== void 0 && (h = t._$AU) !== $._$AU && e._$AP(h);
19
- }
20
- if (c !== n || l) {
21
- let h = e._$AA;
22
- for (; h !== c; ) {
23
- const v = h.nextSibling;
24
- i.insertBefore(h, n), h = v;
25
- }
26
- }
27
- }
28
- return e;
29
- }, S = (t, s, e = t) => (t._$AI(s, e), t), M = {}, k = (t, s = M) => t._$AH = s, P = (t) => t._$AH, T = (t) => {
30
- var i;
31
- (i = t._$AP) == null || i.call(t, !1, !0);
32
- let s = t._$AA;
33
- const e = t._$AB.nextSibling;
34
- for (; s !== e; ) {
35
- const n = s.nextSibling;
36
- s.remove(), s = n;
37
- }
38
- };
39
- /**
40
- * @license
41
- * Copyright 2017 Google LLC
42
- * SPDX-License-Identifier: BSD-3-Clause
43
- */
44
- const r = (t, s) => {
45
- var i;
46
- const e = t._$AN;
47
- if (e === void 0) return !1;
48
- for (const n of e) (i = n._$AO) == null || i.call(n, s, !1), r(n, s);
49
- return !0;
50
- }, A = (t) => {
51
- let s, e;
52
- do {
53
- if ((s = t._$AM) === void 0) break;
54
- e = s._$AN, e.delete(t), t = s;
55
- } while ((e == null ? void 0 : e.size) === 0);
56
- }, a = (t) => {
57
- for (let s; s = t._$AM; t = s) {
58
- let e = s._$AN;
59
- if (e === void 0) s._$AN = e = /* @__PURE__ */ new Set();
60
- else if (e.has(t)) break;
61
- e.add(t), x(s);
62
- }
63
- };
64
- function b(t) {
65
- this._$AN !== void 0 ? (A(this), this._$AM = t, a(this)) : this._$AM = t;
66
- }
67
- function N(t, s = !1, e = 0) {
68
- const i = this._$AH, n = this._$AN;
69
- if (n !== void 0 && n.size !== 0) if (s) if (Array.isArray(i)) for (let o = e; o < i.length; o++) r(i[o], !1), A(i[o]);
70
- else i != null && (r(i, !1), A(i));
71
- else r(this, t);
72
- }
73
- const x = (t) => {
74
- t.type == g.CHILD && (t._$AP ?? (t._$AP = N), t._$AQ ?? (t._$AQ = b));
75
- };
76
- class w extends p {
77
- constructor() {
78
- super(...arguments), this._$AN = void 0;
79
- }
80
- _$AT(s, e, i) {
81
- super._$AT(s, e, i), a(this), this.isConnected = s._$AU;
82
- }
83
- _$AO(s, e = !0) {
84
- var i, n;
85
- s !== this.isConnected && (this.isConnected = s, s ? (i = this.reconnected) == null || i.call(this) : (n = this.disconnected) == null || n.call(this)), e && (r(this, s), A(this));
86
- }
87
- setValue(s) {
88
- if (C(this._$Ct)) this._$Ct._$AI(s, this);
89
- else {
90
- const e = [...this._$Ct._$AH];
91
- e[this._$Ci] = s, this._$Ct._$AI(e, this, 0);
92
- }
93
- }
94
- disconnected() {
95
- }
96
- reconnected() {
97
- }
98
- }
99
- /**
100
- * @license
101
- * Copyright 2020 Google LLC
102
- * SPDX-License-Identifier: BSD-3-Clause
103
- */
104
- const U = () => new B();
105
- class B {
106
- }
107
- const _ = /* @__PURE__ */ new WeakMap(), z = Y(class extends w {
108
- render(t) {
109
- return d;
110
- }
111
- update(t, [s]) {
112
- var i;
113
- const e = s !== this.Y;
114
- return e && this.Y !== void 0 && this.rt(void 0), (e || this.lt !== this.ct) && (this.Y = s, this.ht = (i = t.options) == null ? void 0 : i.host, this.rt(this.ct = t.element)), d;
115
- }
116
- rt(t) {
117
- if (this.isConnected || (t = void 0), typeof this.Y == "function") {
118
- const s = this.ht ?? globalThis;
119
- let e = _.get(s);
120
- e === void 0 && (e = /* @__PURE__ */ new WeakMap(), _.set(s, e)), e.get(this.Y) !== void 0 && this.Y.call(this.ht, void 0), e.set(this.Y, t), t !== void 0 && this.Y.call(this.ht, t);
121
- } else this.Y.value = t;
122
- }
123
- get lt() {
124
- var t, s;
125
- return typeof this.Y == "function" ? (t = _.get(this.ht ?? globalThis)) == null ? void 0 : t.get(this.Y) : (s = this.Y) == null ? void 0 : s.value;
126
- }
127
- disconnected() {
128
- this.lt === this.ct && this.rt(void 0);
129
- }
130
- reconnected() {
131
- this.rt(this.ct);
132
- }
133
- });
134
- export {
135
- T as M,
136
- U as e,
137
- C as f,
138
- k as m,
139
- z as n,
140
- P as p,
141
- I as r,
142
- S as v
143
- };
@@ -1,150 +0,0 @@
1
- import { x as p, n as b, a as f } from "./element-C7XjZtLU.js";
2
- import { r as v } from "./state-CDQk0DFQ.js";
3
- import { e as u, n as d } from "./ref-DbOSDQbk.js";
4
- import { o as r } from "./if-defined-eRX4e5zO.js";
5
- import { P as $ } from "./input-element-BK8UkQli.js";
6
- import { i as c, P as m } from "./pkt-slot-controller-Clbye6cM.js";
7
- import "./input-wrapper-DaZZq8c0.js";
8
- class g {
9
- constructor(t) {
10
- this.nodes = [], this.options = [], this.host = t, this.host.addController(this), this.nodes = [], this.options = [], this.observer = new MutationObserver((e) => this.handleMutations(e));
11
- }
12
- hostConnected() {
13
- Array.from(this.host.childNodes).forEach((t) => {
14
- (t.nodeName === "OPTION" || t.nodeName === "DATA") && this.addNode(t);
15
- }), this.observer.observe(this.host, { childList: !0 });
16
- }
17
- hostDisconnected() {
18
- this.observer.disconnect();
19
- }
20
- addNode(t) {
21
- (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));
22
- }
23
- createOptions() {
24
- this.options = this.nodes.map((t) => ({
25
- value: t.getAttribute("value") || t.textContent || "",
26
- label: t.textContent || t.getAttribute("value") || "",
27
- selected: !!t.getAttribute("selected"),
28
- disabled: !!t.getAttribute("disabled")
29
- })), this.host.setAttribute("options", JSON.stringify(this.options));
30
- }
31
- handleMutations(t) {
32
- let e = !1;
33
- t.forEach((o) => {
34
- o.type === "childList" && (o.addedNodes.forEach((i) => {
35
- c(i) && (this.addNode(i), e = !0);
36
- }), o.removedNodes.forEach((i) => {
37
- c(i) && (this.nodes = this.nodes.filter((a) => a !== i), e = !0);
38
- }));
39
- }), e && this.createOptions();
40
- }
41
- }
42
- var C = Object.defineProperty, x = Object.getOwnPropertyDescriptor, l = (s, t, e, o) => {
43
- for (var i = o > 1 ? void 0 : o ? x(t, e) : t, a = s.length - 1, n; a >= 0; a--)
44
- (n = s[a]) && (i = (o ? n(t, e, i) : n(i)) || i);
45
- return o && i && C(t, e, i), i;
46
- };
47
- let h = class extends $ {
48
- constructor() {
49
- super(), this.inputRef = u(), this.helptextSlot = u(), this.options = [], this.value = "", this._options = [], this.optionsController = new g(this), this.slotController = new m(this, this.helptextSlot), this.slotController.skipOptions = !0;
50
- }
51
- // Used for initilization
52
- connectedCallback() {
53
- super.connectedCallback();
54
- const s = this.options.length > 0, t = this.optionsController.nodes.length && this.optionsController.nodes.length > 0;
55
- !s && t ? this.optionsController.nodes.forEach((e) => {
56
- const o = {
57
- value: e.getAttribute("value") || e.textContent || "",
58
- label: e.textContent || e.getAttribute("value") || "",
59
- disabled: !!e.getAttribute("disabled")
60
- };
61
- e.getAttribute("selected") && !this.value && (this.value = o.value), this._options.push(o);
62
- }) : this._options = this.options;
63
- }
64
- attributeChangedCallback(s, t, e) {
65
- s === "options" && (this._options = e ? JSON.parse(e) : []), s === "value" && this.value !== t && this.valueChanged(e, t), super.attributeChangedCallback(s, t, e);
66
- }
67
- updated(s) {
68
- var t;
69
- super.updated(s), s.has("value") && (this.counterCurrent = ((t = this.value) == null ? void 0 : t.length) || 0, this.valueChanged(this.value, s.get("value"))), s.has("id") && !this.name && this.id && (this.name = this.id);
70
- }
71
- firstUpdated(s) {
72
- super.firstUpdated(s), this.options.length && (this._options = this.options);
73
- }
74
- render() {
75
- const s = `pkt-input ${this.fullwidth ? "pkt-input--fullwidth" : ""}`;
76
- return p`
77
- <pkt-input-wrapper
78
- ?counter=${this.counter}
79
- ?disabled=${this.disabled}
80
- ?hasError=${this.hasError}
81
- ?inline=${this.inline}
82
- ?optionalTag=${this.optionalTag}
83
- ?requiredTag=${this.requiredTag}
84
- ?useWrapper=${this.useWrapper}
85
- ariaDescribedBy=${r(this.ariaDescribedBy)}
86
- .counterCurrent=${this.counterCurrent}
87
- .counterMaxLength=${this.counterMaxLength}
88
- class="pkt-select"
89
- errorMessage=${r(this.errorMessage)}
90
- forId=${this.id + "-input"}
91
- helptext=${r(this.helptext)}
92
- helptextDropdown=${r(this.helptextDropdown)}
93
- helptextDropdownButton=${r(this.helptextDropdownButton)}
94
- label=${r(this.label)}
95
- optionalText=${r(this.optionalText)}
96
- requiredText=${r(this.requiredText)}
97
- >
98
- <select
99
- class=${s}
100
- aria-invalid=${this.hasError}
101
- aria-errormessage=${`${this.id}-error`}
102
- aria-labelledby=${r(this.ariaLabelledby)}
103
- ?disabled=${this.disabled}
104
- id=${this.id + "-input"}
105
- name=${(this.name || this.id) + "-input"}
106
- value=${this.value}
107
- @change=${(t) => {
108
- this.value = t.target.value, t.stopImmediatePropagation();
109
- }}
110
- @input=${(t) => {
111
- this.onInput(), t.stopImmediatePropagation();
112
- }}
113
- @focus=${(t) => {
114
- this.onFocus(), t.stopImmediatePropagation();
115
- }}
116
- @blur=${(t) => {
117
- this.onBlur(), t.stopImmediatePropagation();
118
- }}
119
- ${d(this.inputRef)}
120
- >
121
- ${this._options.length > 0 && this._options.map(
122
- (t) => p`<option
123
- value=${t.value}
124
- ?selected=${this.value == t.value}
125
- ?disabled=${t.disabled}
126
- >
127
- ${t.label}
128
- </option>`
129
- )}
130
- </select>
131
- <div class="pkt-contents" ${d(this.helptextSlot)} name="helptext" slot="helptext"></div>
132
- </pkt-input-wrapper>
133
- `;
134
- }
135
- };
136
- l([
137
- b({ type: Array })
138
- ], h.prototype, "options", 2);
139
- l([
140
- b({ type: String, reflect: !0 })
141
- ], h.prototype, "value", 2);
142
- l([
143
- v()
144
- ], h.prototype, "_options", 2);
145
- h = l([
146
- f("pkt-select")
147
- ], h);
148
- export {
149
- h as P
150
- };
@@ -1,48 +0,0 @@
1
- "use strict";const l=require("./element-CzFXQBoS.cjs"),d=require("./state-HNj0_316.cjs"),a=require("./ref-2anvRHT4.cjs"),o=require("./if-defined-CpIkv1A4.cjs"),c=require("./input-element-Dtyuf6s8.cjs"),u=require("./pkt-slot-controller-Oc32unDk.cjs");require("./input-wrapper-Bo2_t6pA.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
- <pkt-input-wrapper
3
- ?counter=${this.counter}
4
- ?disabled=${this.disabled}
5
- ?hasError=${this.hasError}
6
- ?inline=${this.inline}
7
- ?optionalTag=${this.optionalTag}
8
- ?requiredTag=${this.requiredTag}
9
- ?useWrapper=${this.useWrapper}
10
- ariaDescribedBy=${o.o(this.ariaDescribedBy)}
11
- .counterCurrent=${this.counterCurrent}
12
- .counterMaxLength=${this.counterMaxLength}
13
- class="pkt-select"
14
- errorMessage=${o.o(this.errorMessage)}
15
- forId=${this.id+"-input"}
16
- helptext=${o.o(this.helptext)}
17
- helptextDropdown=${o.o(this.helptextDropdown)}
18
- helptextDropdownButton=${o.o(this.helptextDropdownButton)}
19
- label=${o.o(this.label)}
20
- optionalText=${o.o(this.optionalText)}
21
- requiredText=${o.o(this.requiredText)}
22
- >
23
- <select
24
- class=${t}
25
- aria-invalid=${this.hasError}
26
- aria-errormessage=${`${this.id}-error`}
27
- aria-labelledby=${o.o(this.ariaLabelledby)}
28
- ?disabled=${this.disabled}
29
- id=${this.id+"-input"}
30
- name=${(this.name||this.id)+"-input"}
31
- value=${this.value}
32
- @change=${e=>{this.value=e.target.value,e.stopImmediatePropagation()}}
33
- @input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
34
- @focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
35
- @blur=${e=>{this.onBlur(),e.stopImmediatePropagation()}}
36
- ${a.n(this.inputRef)}
37
- >
38
- ${this._options.length>0&&this._options.map(e=>l.x`<option
39
- value=${e.value}
40
- ?selected=${this.value==e.value}
41
- ?disabled=${e.disabled}
42
- >
43
- ${e.label}
44
- </option>`)}
45
- </select>
46
- <div class="pkt-contents" ${a.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
47
- </pkt-input-wrapper>
48
- `}};h([l.n({type:Array})],exports.PktSelect.prototype,"options",2);h([l.n({type:String,reflect:!0})],exports.PktSelect.prototype,"value",2);h([d.r()],exports.PktSelect.prototype,"_options",2);exports.PktSelect=h([l.t("pkt-select")],exports.PktSelect);
@@ -1,18 +0,0 @@
1
- "use strict";const u=require("./class-map-Dj5mbCUg.cjs"),t=require("./element-CzFXQBoS.cjs"),g=require("./state-HNj0_316.cjs"),d=require("./pkt-slot-controller-Oc32unDk.cjs"),c=require("./ref-2anvRHT4.cjs");require("./icon-BOKusjAA.cjs");const h=require("./if-defined-CpIkv1A4.cjs"),k="pkt-tag",f=!0,y={closeTag:{type:"boolean",required:!1,default:!1},size:{required:!1,default:"medium",type:["small","medium","large"]},iconName:{type:"icon",required:!1},skin:{required:!1,default:"blue",type:["blue","blue-light","blue-dark","green","red","beige","yellow","gray"]},textStyle:{required:!1,default:"normal-text",type:["thin-text","normal-text"]},type:{required:!1,default:"button",type:["button","submit","reset"]},ariaLabel:{type:"string",required:!1}},b={default:{description:"Teksten til tag"}},l={name:k,"css-class":"pkt-tag",isElement:f,props:y,slots:b};var m=Object.defineProperty,T=Object.getOwnPropertyDescriptor,i=(o,e,a,r)=>{for(var s=r>1?void 0:r?T(e,a):e,n=o.length-1,p;n>=0;n--)(p=o[n])&&(s=(r?p(e,a,s):p(s))||s);return r&&s&&m(e,a,s),s};exports.PktTag=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.closeTag=l.props.closeTag.default,this.size=l.props.size.default,this.skin=l.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=l.props.type.default,this.ariaLabel=null,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!0,composed:!0}))},this.slotController=new d.PktSlotController(this,this.defaultSlot),this._isClosed=!1}firstUpdated(e){var a,r;if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){const s=(r=(a=this.defaultSlot.value)==null?void 0:a.textContent)==null?void 0:r.trim();s&&(this._ariaDescription=`Klikk for å fjerne ${s}`)}}render(){const e={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},a={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName,"pkt-hide":this._isClosed};return this.closeTag?t.x`
2
- <button
3
- class=${u.e(a)}
4
- type=${this.type}
5
- @click=${this.close}
6
- aria-label=${h.o(this.ariaLabel||void 0)}
7
- aria-description=${h.o(this._ariaDescription||void 0)}
8
- >
9
- ${this.iconName&&t.x`<pkt-icon class="pkt-tag__icon" name=${this.iconName}></pkt-icon>`}
10
- <span ${c.n(this.defaultSlot)}></span>
11
- <pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
12
- </button>
13
- `:t.x`
14
- <span class=${u.e(e)}>
15
- ${this.iconName&&t.x`<pkt-icon class="pkt-tag__icon" name=${this.iconName}></pkt-icon>`}
16
- <span ${c.n(this.defaultSlot)}></span>
17
- </span>
18
- `}};i([t.n({type:Boolean,reflect:!0})],exports.PktTag.prototype,"closeTag",2);i([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"size",2);i([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"skin",2);i([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"textStyle",2);i([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"iconName",2);i([t.n({type:String})],exports.PktTag.prototype,"type",2);i([t.n({type:String})],exports.PktTag.prototype,"ariaLabel",2);i([g.r()],exports.PktTag.prototype,"_isClosed",2);i([g.r()],exports.PktTag.prototype,"_ariaDescription",2);exports.PktTag=i([t.t("pkt-tag")],exports.PktTag);