@oslokommune/punkt-elements 16.7.0 → 16.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/accordionitem-_9AiCIvd.cjs +34 -0
  3. package/dist/{accordionitem-ZlaXvjt5.js → accordionitem-dCfSrxh5.js} +57 -55
  4. package/dist/alert-BtOk8yRH.cjs +33 -0
  5. package/dist/{alert-BuAXrnKl.js → alert-DlY2_grU.js} +48 -46
  6. package/dist/backlink-Ce5Vldop.js +49 -0
  7. package/dist/backlink-y3dwjKPC.cjs +13 -0
  8. package/dist/button-B_TXwNzt.cjs +27 -0
  9. package/dist/{button-DEyvt1LI.js → button-BiY-wlKF.js} +79 -77
  10. package/dist/calendar-B2pji2zn.cjs +90 -0
  11. package/dist/{calendar-S63oreVW.js → calendar-DhjQDC4C.js} +689 -687
  12. package/dist/card-BwMNB5Bb.cjs +87 -0
  13. package/dist/{card-DDiLfuO4.js → card-CGlmcMSR.js} +99 -97
  14. package/dist/checkbox-BsJZYA26.js +147 -0
  15. package/dist/checkbox-CTY8f_qn.cjs +31 -0
  16. package/dist/{combobox-BmxSecfE.js → combobox-DSB5WOxg.js} +223 -226
  17. package/dist/{combobox-Hb2V-fPX.cjs → combobox-DbICIgKG.cjs} +4 -4
  18. package/dist/consent-DkOQpbsg.cjs +11 -0
  19. package/dist/{consent-iXyx5v6J.js → consent-SNWV_mMU.js} +48 -46
  20. package/dist/datepicker-BEWl9iz3.cjs +273 -0
  21. package/dist/{datepicker-CZl7b8Na.js → datepicker-euHyzXnb.js} +341 -329
  22. package/dist/{heading-CKt7cVn7.js → heading-D2tVS6lS.js} +30 -28
  23. package/dist/heading-DrzbgDb6.cjs +1 -0
  24. package/dist/helptext-BKtU4mas.js +82 -0
  25. package/dist/helptext-DcRC7wW2.cjs +24 -0
  26. package/dist/icon-CxQcIa5F.js +105 -0
  27. package/dist/icon-q81vqPK_.cjs +9 -0
  28. package/dist/input-wrapper-Bs4CRNst.js +181 -0
  29. package/dist/input-wrapper-Bv9aqqVq.cjs +54 -0
  30. package/dist/link-C0rl-86s.cjs +7 -0
  31. package/dist/link-Cdqgl60z.js +55 -0
  32. package/dist/linkcard-Dimu7Rlx.cjs +13 -0
  33. package/dist/linkcard-Lbq_UhjZ.js +56 -0
  34. package/dist/{listbox-BQKDZvZn.js → listbox-Bia4_tvN.js} +131 -129
  35. package/dist/listbox-La2GZQei.cjs +106 -0
  36. package/dist/loader-D1ugDXGV.cjs +16 -0
  37. package/dist/{loader-Ci3CHU8k.js → loader-DyN6RGC5.js} +51 -49
  38. package/dist/messagebox-BGMVm2t9.js +71 -0
  39. package/dist/messagebox-M0yIgCz9.cjs +13 -0
  40. package/dist/modal-CMO1RtIi.cjs +36 -0
  41. package/dist/{modal-DzGe1g8Z.js → modal-DjPQDE-Z.js} +53 -51
  42. package/dist/pkt-accordion.cjs +1 -1
  43. package/dist/pkt-accordion.js +2 -2
  44. package/dist/pkt-alert.cjs +1 -1
  45. package/dist/pkt-alert.js +3 -4
  46. package/dist/pkt-backlink.cjs +1 -1
  47. package/dist/pkt-backlink.js +2 -3
  48. package/dist/pkt-breadcrumbs.cjs +11 -11
  49. package/dist/pkt-breadcrumbs.js +30 -28
  50. package/dist/pkt-button.cjs +1 -1
  51. package/dist/pkt-button.js +3 -4
  52. package/dist/pkt-calendar.cjs +1 -1
  53. package/dist/pkt-calendar.js +2 -3
  54. package/dist/pkt-card.cjs +1 -1
  55. package/dist/pkt-card.js +2 -3
  56. package/dist/pkt-checkbox.cjs +1 -1
  57. package/dist/pkt-checkbox.js +3 -4
  58. package/dist/pkt-combobox.cjs +1 -1
  59. package/dist/pkt-combobox.js +3 -4
  60. package/dist/pkt-consent.cjs +1 -1
  61. package/dist/pkt-consent.js +2 -3
  62. package/dist/pkt-datepicker.cjs +1 -1
  63. package/dist/pkt-datepicker.js +7 -8
  64. package/dist/pkt-header.cjs +35 -35
  65. package/dist/pkt-header.js +224 -218
  66. package/dist/pkt-heading.cjs +1 -1
  67. package/dist/pkt-heading.js +3 -4
  68. package/dist/pkt-helptext.cjs +1 -1
  69. package/dist/pkt-helptext.js +3 -4
  70. package/dist/pkt-icon.cjs +1 -1
  71. package/dist/pkt-icon.js +3 -4
  72. package/dist/pkt-index.cjs +1 -1
  73. package/dist/pkt-index.js +26 -26
  74. package/dist/pkt-input-wrapper.cjs +1 -1
  75. package/dist/pkt-input-wrapper.js +2 -3
  76. package/dist/pkt-link.cjs +1 -1
  77. package/dist/pkt-link.js +2 -3
  78. package/dist/pkt-linkcard.cjs +1 -1
  79. package/dist/pkt-linkcard.js +3 -4
  80. package/dist/pkt-listbox.cjs +1 -1
  81. package/dist/pkt-listbox.js +3 -4
  82. package/dist/pkt-loader.cjs +1 -1
  83. package/dist/pkt-loader.js +3 -4
  84. package/dist/pkt-messagebox.cjs +1 -1
  85. package/dist/pkt-messagebox.js +3 -4
  86. package/dist/pkt-modal.cjs +1 -1
  87. package/dist/pkt-modal.js +3 -4
  88. package/dist/pkt-progressbar.cjs +1 -1
  89. package/dist/pkt-progressbar.js +2 -3
  90. package/dist/pkt-radiobutton.cjs +1 -1
  91. package/dist/pkt-radiobutton.js +3 -4
  92. package/dist/pkt-select.cjs +1 -1
  93. package/dist/pkt-select.js +3 -4
  94. package/dist/pkt-tabs.cjs +1 -1
  95. package/dist/pkt-tabs.js +2 -2
  96. package/dist/pkt-tag.cjs +1 -1
  97. package/dist/pkt-tag.js +3 -4
  98. package/dist/pkt-textarea.cjs +1 -1
  99. package/dist/pkt-textarea.js +3 -4
  100. package/dist/pkt-textinput.cjs +1 -1
  101. package/dist/pkt-textinput.js +3 -4
  102. package/dist/pkt-timepicker.cjs +22 -19
  103. package/dist/pkt-timepicker.js +84 -76
  104. package/dist/progressbar-BqlMzkM_.cjs +21 -0
  105. package/dist/{progressbar-By7e0lEI.js → progressbar-sbHDFC12.js} +88 -88
  106. package/dist/radiobutton-5ZqVVtTT.cjs +31 -0
  107. package/dist/{radiobutton-6frNG9J_.js → radiobutton-D8Ai8ETa.js} +44 -42
  108. package/dist/select-De-n8on9.js +230 -0
  109. package/dist/select-dTWibR6_.cjs +49 -0
  110. package/dist/tabitem-B9-jeV97.js +334 -0
  111. package/dist/tabitem-BnhzqfW3.cjs +65 -0
  112. package/dist/tag-CbwO8yvD.cjs +27 -0
  113. package/dist/{tag-BuCpqaks.js → tag-D4FI5t3y.js} +42 -40
  114. package/dist/textarea-BmLaKzsc.cjs +50 -0
  115. package/dist/{textarea-Bzuymclz.js → textarea-CMiSJaYL.js} +62 -60
  116. package/dist/textinput-em9y4yrL.cjs +70 -0
  117. package/dist/{textinput-9lHjs4ce.js → textinput-r8udK0IX.js} +57 -55
  118. package/package.json +2 -2
  119. package/src/components/accordion/accordion.ts +6 -1
  120. package/src/components/accordion/accordionitem.ts +6 -1
  121. package/src/components/alert/alert.ts +6 -1
  122. package/src/components/backlink/backlink.ts +6 -1
  123. package/src/components/breadcrumbs/breadcrumbs.ts +6 -1
  124. package/src/components/button/button.ts +6 -1
  125. package/src/components/calendar/calendar.ts +6 -1
  126. package/src/components/card/card.ts +6 -1
  127. package/src/components/checkbox/checkbox.ts +6 -1
  128. package/src/components/combobox/combobox.ts +6 -1
  129. package/src/components/consent/consent.ts +6 -1
  130. package/src/components/datepicker/date-tags.ts +6 -1
  131. package/src/components/datepicker/datepicker-multiple.ts +6 -1
  132. package/src/components/datepicker/datepicker-popup.ts +6 -1
  133. package/src/components/datepicker/datepicker-range.ts +6 -1
  134. package/src/components/datepicker/datepicker-single.ts +6 -1
  135. package/src/components/datepicker/datepicker.ts +6 -1
  136. package/src/components/header/header-service.ts +6 -1
  137. package/src/components/header/header-user-menu.ts +6 -1
  138. package/src/components/header/header.ts +6 -1
  139. package/src/components/heading/heading.ts +6 -1
  140. package/src/components/helptext/helptext.ts +6 -1
  141. package/src/components/icon/icon.ts +6 -1
  142. package/src/components/input-wrapper/input-wrapper.ts +6 -1
  143. package/src/components/link/link.ts +6 -1
  144. package/src/components/linkcard/linkcard.ts +6 -1
  145. package/src/components/listbox/listbox.ts +6 -1
  146. package/src/components/loader/loader.ts +6 -1
  147. package/src/components/messagebox/messagebox.ts +6 -1
  148. package/src/components/modal/modal.ts +6 -1
  149. package/src/components/progressbar/progressbar.ts +6 -1
  150. package/src/components/radiobutton/radiobutton.ts +6 -1
  151. package/src/components/select/select.ts +6 -1
  152. package/src/components/tabs/tabitem.ts +6 -1
  153. package/src/components/tabs/tabs.ts +6 -1
  154. package/src/components/tag/tag.ts +6 -1
  155. package/src/components/textarea/textarea.ts +6 -1
  156. package/src/components/textinput/textinput.ts +6 -1
  157. package/src/components/timepicker/timepicker.ts +14 -2
  158. package/dist/accordionitem-D1Agl1bB.cjs +0 -34
  159. package/dist/alert-DFkFNTxh.cjs +0 -33
  160. package/dist/backlink-EiAXUUZP.cjs +0 -13
  161. package/dist/backlink-V4DAt17e.js +0 -47
  162. package/dist/button-DYv5Dg4M.cjs +0 -27
  163. package/dist/calendar-HIE9nxcc.cjs +0 -90
  164. package/dist/card-CyeH6l1c.cjs +0 -87
  165. package/dist/checkbox-BLlwTABj.cjs +0 -31
  166. package/dist/checkbox-ejBUa5qQ.js +0 -145
  167. package/dist/consent-ruWAEVXW.cjs +0 -11
  168. package/dist/datepicker-D2H7U6MS.cjs +0 -273
  169. package/dist/heading-Cvz8m1xL.cjs +0 -1
  170. package/dist/helptext-5Mzp65-F.cjs +0 -24
  171. package/dist/helptext-jIoWRcCF.js +0 -80
  172. package/dist/icon-BlKA8YuW.js +0 -103
  173. package/dist/icon-Bqj9oBbl.cjs +0 -9
  174. package/dist/input-wrapper-B0MkQ0IZ.cjs +0 -54
  175. package/dist/input-wrapper-B2JpK016.js +0 -179
  176. package/dist/link-R_lNhViF.cjs +0 -7
  177. package/dist/link-Z_GizclR.js +0 -53
  178. package/dist/linkcard-BlQvdB1a.js +0 -54
  179. package/dist/linkcard-C7HbSLlX.cjs +0 -13
  180. package/dist/listbox-CGgV9MAe.cjs +0 -106
  181. package/dist/loader-e2gs_1xz.cjs +0 -16
  182. package/dist/messagebox-Bf-XMlvW.js +0 -69
  183. package/dist/messagebox-D67w71VX.cjs +0 -13
  184. package/dist/modal-CyvEkbfQ.cjs +0 -36
  185. package/dist/progressbar-DsJ2B9Vm.cjs +0 -21
  186. package/dist/radiobutton-Bv-BZ1Hw.cjs +0 -31
  187. package/dist/select-CXZt1nHS.js +0 -228
  188. package/dist/select-WFhS4Vfp.cjs +0 -49
  189. package/dist/tabitem-CB8wkKmv.js +0 -332
  190. package/dist/tabitem-DZpspU4Q.cjs +0 -65
  191. package/dist/tag-X6xdjR0N.cjs +0 -27
  192. package/dist/textarea-DoeHJ7HR.cjs +0 -50
  193. package/dist/textinput-BNsLd26i.cjs +0 -70
@@ -1,273 +0,0 @@
1
- "use strict";const l=require("./element-gR_VtSiD.cjs"),I=require("./state-Dg-53wQ8.cjs"),u=require("./calendar-HIE9nxcc.cjs"),A=require("./input-element-DdVhUvva.cjs"),o=require("./ref-CL-Xk9Xm.cjs");require("./icon-Bqj9oBbl.cjs");require("./input-wrapper-B0MkQ0IZ.cjs");const m=require("./class-map-CsENJXf1.cjs"),M=require("./repeat-Cfq8CDlf.cjs");require("./tag-X6xdjR0N.cjs");const O=require("./utils-byXsEz1u.cjs"),g=require("./if-defined-BOW3ODSj.cjs"),F=require("./element-with-slot-ZX-up7jO.cjs"),B={calendar:{buttonAltText:"Åpne kalender"}},j={calendar:{buttonAltText:"Åpne kalender"},generic:{from:"Fra",to:"Til"}};var q=Object.defineProperty,L=Object.getOwnPropertyDescriptor,k=(s,e,t,a)=>{for(var i=a>1?void 0:a?L(e,t):e,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(a?n(e,t,i):n(i))||i);return a&&i&&q(e,t,i),i};exports.PktDateTags=class extends l.PktElement{constructor(){super(...arguments),this.dates=[],this.dateformat="dd.MM.yyyy",this.className="pkt-datepicker__tags",this.idBase=O.uuidish()}render(){return this.classes={"pkt-date-tags":!0,[this.className]:!0},l.b`
2
- <div class=${m.e(this.classes)} aria-live="polite">
3
- ${Array.isArray(this.dates)&&this.dates[0]?M.c(u.sortDateStrings((this.dates??[]).filter(Boolean)),e=>e,e=>{var t;return l.b` <pkt-tag
4
- id=${this.idBase+e+"-tag"}
5
- closeTag
6
- @close=${()=>{this.dispatchEvent(new CustomEvent("date-tag-removed",{detail:e}))}}
7
- .ariaLabel=${`${(t=this.strings)==null?void 0:t.calendar.deleteDate} ${u.fromISOtoLocal(e,this.dateformat)}`}
8
- >
9
- <time datetime=${e}>${u.fromISOtoLocal(e,this.dateformat)}</time>
10
- </pkt-tag>`}):l.A}
11
- </div>
12
- `}};k([l.n({type:Array})],exports.PktDateTags.prototype,"dates",2);k([l.n({type:String})],exports.PktDateTags.prototype,"dateformat",2);k([l.n({type:String,attribute:"class"})],exports.PktDateTags.prototype,"className",2);k([l.n({type:String,attribute:"id-base"})],exports.PktDateTags.prototype,"idBase",2);exports.PktDateTags=k([l.t("pkt-date-tags")],exports.PktDateTags);const V={dateformat:{default:"dd.MM.yyyy"},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},range:{default:!1}},$={props:V},y=()=>{const s=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(s)||/Macintosh/.test(s)&&"ontouchend"in document)},K=()=>y()?"text":"date",U=s=>!s||s.length!==2?!0:u.isValidDateRange(s[0],s[1]),N=s=>u.sortDateStrings(s),z=(s,e,t,a,i)=>u.filterSelectableDates(s,e,t,a,i),W=(s,e,t,a,i,r)=>({"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":s,"pkt-datepicker--hasrangelabels":e,"pkt-datepicker--multiple":t,"pkt-datepicker--range":a,"ios-readonly-hack":i===!1&&r==="text"}),H=()=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}),G=s=>({"pkt-input-prefix":s,"pkt-hide":!s}),J=(s,e,t)=>!e&&!t?Array.isArray(s)?s[0]||"":s:Array.isArray(s)?s.join(","):s,Q=(s,e,t=!1)=>{var p;if(!s||!e)return;const a=((p=e.parentElement)==null?void 0:p.getBoundingClientRect())||e.getBoundingClientRect(),i=t?a.height+30:a.height,r=s.getBoundingClientRect().height;let n=t?"calc(100% - 30px)":"100%";a&&a.top+r>window.innerHeight&&a.top-r>0&&(n=`calc(100% - ${i}px - ${r}px)`),s.style.top=n},X=(s,e,t,a,i,r)=>{const{key:n}=s;n===","&&(s.preventDefault(),r?r(s):i&&i()),(n==="Space"||n===" ")&&(s.preventDefault(),e(s)),n==="Enter"&&(s.preventDefault(),t?t():a?a():i&&i())},Y=(s,e)=>{const{key:t}=s;(t==="Enter"||t===" "||t==="Space")&&(s.preventDefault(),e(s))},E={validateRangeOrder:U,sortDates:N,filterSelectableDates:z},Z={getInputType:K},b={submitForm(s){var t;const e=(t=s.internals)==null?void 0:t.form;e&&e.requestSubmit()},submitFormOrFallback(s,e){const t=s==null?void 0:s.form;t?t.requestSubmit():e()},validateDateInput(s,e,t,a,i){var n,p,R,S;const r=s.value;r&&(t&&t>r?e.setValidity({rangeUnderflow:!0},((p=(n=i==null?void 0:i.forms)==null?void 0:n.messages)==null?void 0:p.rangeUnderflow)||"Value is below minimum",s):a&&a<r&&e.setValidity({rangeOverflow:!0},((S=(R=i==null?void 0:i.forms)==null?void 0:R.messages)==null?void 0:S.rangeOverflow)||"Value is above maximum",s))}},w={addToSelected(s,e,t,a){const i=s.target;if(!i.value)return;const r=t?u.newDate(t):null,n=a?u.newDate(a):null,p=u.newDate(i.value.split(",")[0]);p&&!isNaN(p.getTime())&&(!r||p>=r)&&(!n||p<=n)&&e.value&&e.value.handleDateSelect(p),i.value=""},handleCalendarPosition(s,e,t=!1){Q(s.value??null,e.value??null,t)}},x={getInputClasses:W,getButtonClasses:H,getRangeLabelClasses:G},T={processDateSelection:J,updateInputValues(s,e,t,a,i,r){s.value&&(a&&(e!=null&&e.value)?(s.value.value=t[0]??"",e.value.value=t[1]??"",r(s.value),r(e.value)):i||(s.value.value=t.length?t[0]:"",r(s.value)))},processRangeBlur(s,e,t,a,i){var n;const r=s.target;if(r.value){i(r);const p=u.fromISOToDate(r.value);p&&((n=t==null?void 0:t.value)==null||n.handleDateSelect(p))}else e[0]&&a()}},C={handleInputKeydown:X,handleButtonKeydown:Y};var ee=Object.defineProperty,te=Object.getOwnPropertyDescriptor,c=(s,e,t,a)=>{for(var i=a>1?void 0:a?te(e,t):e,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(a?n(e,t,i):n(i))||i);return a&&i&&ee(e,t,i),i};let d=class extends l.PktElement{constructor(){super(...arguments),this.open=!1,this.multiple=!1,this.range=!1,this.weeknumbers=!1,this.withcontrols=!1,this.maxMultiple=null,this.selected=[],this.earliest=null,this.latest=null,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.today=null,this._hasBeenOpened=!1,this.popupRef=o.e(),this.calendarRef=o.e(),this.handleDocumentClick=s=>{if(!this.open)return;const e=s.composedPath(),t=this.parentElement,a=this.popupRef.value;!e.includes(this)&&!e.includes(a)&&!(t&&e.includes(t))&&(this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))},this.handleDocumentKeydown=s=>{this.open&&s.key==="Escape"&&(this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}}firstUpdated(){this.calRef=this.calendarRef}updated(s){super.updated(s),s.has("open")&&(this.open?(this._hasBeenOpened=!0,document.addEventListener("keydown",this.handleDocumentKeydown),document.addEventListener("click",this.handleDocumentClick)):(document.removeEventListener("click",this.handleDocumentClick),document.removeEventListener("keydown",this.handleDocumentKeydown)))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleDocumentClick),document.removeEventListener("keydown",this.handleDocumentKeydown)}show(){var s;this.open=!0,(s=this.calendarRef.value)==null||s.focus()}hide(){this.open=!1}toggle(){this.open?this.hide():this.show()}contains(s){var e;return!!s&&!!((e=this.popupRef.value)!=null&&e.contains(s))}focusOnCurrentDate(){const s=this.calendarRef.value;s&&typeof s.focusOnCurrentDate=="function"&&s.focusOnCurrentDate()}addToSelected(s,e,t){if(this.calendarRef.value&&typeof w.addToSelected=="function")return w.addToSelected(s,this.calendarRef,e,t);const i=s.target;if(!i.value)return;const r=e?u.newDate(e):null,n=t?u.newDate(t):null,p=u.newDate(i.value.split(",")[0]);p&&!isNaN(p.getTime())&&(!r||p>=r)&&(!n||p<=n)&&this.handleDateSelect(p),i.value=""}handleDateSelect(s){const e=this.calendarRef.value;if(e&&typeof e.handleDateSelect=="function")return e.handleDateSelect(s);const t=u.formatISODate(s),i=this.selected.indexOf(t)>=0?this.selected.filter(r=>r!==t):[...this.selected,t];this.selected=i,this.dispatchEvent(new CustomEvent("date-selected",{detail:i,bubbles:!0,composed:!0}))}render(){const s={"pkt-calendar-popup":!0,show:this.open,hide:!this.open};return l.b`
13
- <div
14
- class="${m.e(s)}"
15
- ${o.n(this.popupRef)}
16
- id="date-popup"
17
- ?hidden=${!this.open}
18
- aria-hidden="${!this.open}"
19
- >
20
- ${this.open||this._hasBeenOpened?l.b`<pkt-calendar
21
- ${o.n(this.calendarRef)}
22
- ?multiple=${this.multiple}
23
- ?range=${this.range}
24
- ?weeknumbers=${this.weeknumbers}
25
- ?withcontrols=${this.withcontrols}
26
- .maxMultiple=${this.maxMultiple}
27
- .selected=${this.selected}
28
- .earliest=${this.earliest}
29
- .latest=${this.latest}
30
- .excludedates=${this.excludedates}
31
- .excludeweekdays=${this.excludeweekdays}
32
- .currentmonth=${this.currentmonth}
33
- .today=${this.today}
34
- @date-selected=${e=>{this.selected=e.detail,this.dispatchEvent(new CustomEvent("date-selected",{detail:e.detail,bubbles:!0,composed:!0}))}}
35
- @close=${()=>{this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}}
36
- ></pkt-calendar>`:l.A}
37
- </div>
38
- `}};c([l.n({type:Boolean,reflect:!0})],d.prototype,"open",2);c([l.n({type:Boolean})],d.prototype,"multiple",2);c([l.n({type:Boolean})],d.prototype,"range",2);c([l.n({type:Boolean})],d.prototype,"weeknumbers",2);c([l.n({type:Boolean})],d.prototype,"withcontrols",2);c([l.n({type:Number})],d.prototype,"maxMultiple",2);c([l.n({type:Array})],d.prototype,"selected",2);c([l.n({type:String})],d.prototype,"earliest",2);c([l.n({type:String})],d.prototype,"latest",2);c([l.n({type:Array})],d.prototype,"excludedates",2);c([l.n({type:Array})],d.prototype,"excludeweekdays",2);c([l.n({type:String})],d.prototype,"currentmonth",2);c([l.n({type:String})],d.prototype,"today",2);c([I.r()],d.prototype,"_hasBeenOpened",2);d=c([l.t("pkt-datepicker-popup")],d);var se=Object.defineProperty,v=(s,e,t,a)=>{for(var i=void 0,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=n(e,t,i)||i);return i&&se(e,t,i),i};class f extends l.PktElement{constructor(){super(...arguments),this.inputType="date",this.id="",this.readonly=!1,this.disabled=!1,this.inputClasses={},this.inputRef=o.e(),this.btnRef=o.e()}get inputElement(){return this.inputRef.value}get buttonElement(){return this.btnRef.value}get isInputReadonly(){return this.readonly||this.inputType==="text"}dispatchToggleCalendar(e){this.readonly||this.dispatchEvent(new CustomEvent("toggle-calendar",{detail:e,bubbles:!0,composed:!0}))}dispatchInput(e){this.dispatchEvent(new CustomEvent("input-change",{detail:e,bubbles:!0,composed:!0}))}dispatchFocus(){this.dispatchEvent(new CustomEvent("input-focus",{bubbles:!0,composed:!0}))}dispatchBlur(e){this.dispatchEvent(new CustomEvent("input-blur",{detail:e,bubbles:!0,composed:!0}))}dispatchChange(e){this.dispatchEvent(new CustomEvent("input-changed",{detail:e,bubbles:!0,composed:!0}))}renderCalendarButton(){var e;return l.b`
39
- <button
40
- class="${m.e(x.getButtonClasses())}"
41
- type="button"
42
- @click=${t=>this.dispatchToggleCalendar(t)}
43
- @keydown=${t=>{const{key:a}=t;(a==="Enter"||a===" "||a==="Space")&&(t.preventDefault(),this.dispatchToggleCalendar(t))}}
44
- ?disabled=${this.disabled}
45
- ${this.btnRef}
46
- >
47
- <pkt-icon name="calendar"></pkt-icon>
48
- <span class="pkt-btn__text">${((e=this.strings.calendar)==null?void 0:e.buttonAltText)||"Åpne kalender"}</span>
49
- </button>
50
- `}createRenderRoot(){return this}}v([l.n({type:String})],f.prototype,"inputType");v([l.n({type:String})],f.prototype,"id");v([l.n({type:String})],f.prototype,"min");v([l.n({type:String})],f.prototype,"max");v([l.n({type:String})],f.prototype,"placeholder");v([l.n({type:Boolean})],f.prototype,"readonly");v([l.n({type:Boolean})],f.prototype,"disabled");v([l.n({type:Object})],f.prototype,"inputClasses");v([l.n({type:Object})],f.prototype,"internals");var ie=Object.defineProperty,ae=Object.getOwnPropertyDescriptor,_=(s,e,t,a)=>{for(var i=a>1?void 0:a?ae(e,t):e,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(a?n(e,t,i):n(i))||i);return a&&i&&ie(e,t,i),i};exports.PktDatepickerSingle=class extends f{constructor(){super(...arguments),this.value="",this.strings=B}dispatchManageValidity(e){this.dispatchEvent(new CustomEvent("manage-validity",{detail:e,bubbles:!0,composed:!0}))}render(){return l.b`
51
- <div class="pkt-input__container">
52
- <input
53
- class="${m.e(this.inputClasses)}"
54
- .type=${this.inputType}
55
- id="${this.id}-input"
56
- .value=${this.value}
57
- min=${g.o(this.min)}
58
- max=${g.o(this.max)}
59
- placeholder=${g.o(this.placeholder)}
60
- ?readonly=${this.isInputReadonly}
61
- aria-describedby="${this.id}-helptext"
62
- @click=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
63
- @touchend=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
64
- ?disabled=${this.disabled}
65
- @keydown=${e=>C.handleInputKeydown(e,t=>this.dispatchToggleCalendar(t),()=>b.submitFormOrFallback(this.internals,()=>{var t;return(t=this.inputRef.value)==null?void 0:t.blur()}),void 0,()=>{var t;return(t=this.inputRef.value)==null?void 0:t.blur()})}
66
- @input=${e=>{this.dispatchInput(e),e.stopImmediatePropagation()}}
67
- @focus=${()=>{this.dispatchFocus(),y()&&this.dispatchToggleCalendar(new Event("focus"))}}
68
- @blur=${e=>{this.dispatchBlur(e),this.dispatchManageValidity(e.target),this.dispatchEvent(new CustomEvent("value-change",{detail:e.target.value,bubbles:!0,composed:!0}))}}
69
- @change=${e=>{this.dispatchChange(e),e.stopImmediatePropagation()}}
70
- ${o.n(this.inputRef)}
71
- />
72
- ${this.renderCalendarButton()}
73
- </div>
74
- `}};_([l.n({type:String})],exports.PktDatepickerSingle.prototype,"value",2);_([l.n({type:Object})],exports.PktDatepickerSingle.prototype,"strings",2);exports.PktDatepickerSingle=_([l.t("pkt-datepicker-single")],exports.PktDatepickerSingle);var ne=Object.defineProperty,le=Object.getOwnPropertyDescriptor,D=(s,e,t,a)=>{for(var i=a>1?void 0:a?le(e,t):e,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(a?n(e,t,i):n(i))||i);return a&&i&&ne(e,t,i),i};exports.PktDatepickerRange=class extends f{constructor(){super(...arguments),this.value=[],this.label="",this.showRangeLabels=!1,this.strings=j,this.inputRefTo=o.e()}get inputElementTo(){return this.inputRefTo.value}render(){var t,a,i,r;const e=x.getRangeLabelClasses(this.showRangeLabels);return l.b`
75
- <div class="pkt-input__container">
76
- ${this.showRangeLabels?l.b` <div class="pkt-input-prefix">${(t=this.strings.generic)==null?void 0:t.from}</div> `:l.A}
77
- <input
78
- class=${m.e(this.inputClasses)}
79
- .type=${this.inputType}
80
- id="${this.id}-input"
81
- aria-label="${this.label} ${((a=this.strings.generic)==null?void 0:a.from)??"Fra"}"
82
- .value=${this.value[0]??""}
83
- min=${g.o(this.min)}
84
- max=${g.o(this.max)}
85
- placeholder=${g.o(this.placeholder)}
86
- ?readonly=${this.isInputReadonly}
87
- ?disabled=${this.disabled}
88
- @click=${n=>{n.preventDefault(),this.dispatchToggleCalendar(n)}}
89
- @touchend=${n=>{n.preventDefault(),this.dispatchToggleCalendar(n)}}
90
- @keydown=${n=>C.handleInputKeydown(n,p=>this.dispatchToggleCalendar(p),()=>b.submitFormOrFallback(this.internals,()=>{var p;return(p=this.inputRefTo.value)==null?void 0:p.focus()}),()=>{var p;return(p=this.inputRefTo.value)==null?void 0:p.focus()},()=>{var p;return(p=this.inputRef.value)==null?void 0:p.blur()})}
91
- @input=${n=>{this.dispatchInput(n),n.stopImmediatePropagation()}}
92
- @focus=${()=>{this.dispatchFocus(),y()&&this.dispatchToggleCalendar(new Event("focus"))}}
93
- @blur=${n=>{this.dispatchBlur(n),this.dispatchEvent(new CustomEvent("range-blur",{detail:{event:n,values:this.value,inputType:"from"},bubbles:!0,composed:!0}))}}
94
- @change=${n=>{this.dispatchChange(n),n.stopImmediatePropagation()}}
95
- ${o.n(this.inputRef)}
96
- />
97
- <div class="${m.e(e)}" id="${this.id}-to-label">
98
- ${(i=this.strings.generic)==null?void 0:i.to}
99
- </div>
100
- ${this.showRangeLabels?l.A:l.b` <div class="pkt-input-separator">–</div> `}
101
- <input
102
- class=${m.e(this.inputClasses)}
103
- .type=${this.inputType}
104
- id="${this.id}-to"
105
- aria-label="${this.label} ${((r=this.strings.generic)==null?void 0:r.to)??"Til"}"
106
- .value=${this.value[1]??""}
107
- min=${g.o(this.min)}
108
- max=${g.o(this.max)}
109
- placeholder=${g.o(this.placeholder)}
110
- ?readonly=${this.isInputReadonly}
111
- ?disabled=${this.disabled}
112
- @click=${n=>{n.preventDefault(),this.dispatchToggleCalendar(n)}}
113
- @touchend=${n=>{n.preventDefault(),this.dispatchToggleCalendar(n)}}
114
- @keydown=${n=>C.handleInputKeydown(n,p=>this.dispatchToggleCalendar(p),()=>b.submitFormOrFallback(this.internals,()=>{var p;return(p=this.inputRefTo.value)==null?void 0:p.blur()}),void 0,()=>{var p;return(p=this.inputRefTo.value)==null?void 0:p.blur()})}
115
- @input=${n=>{this.dispatchInput(n),n.stopImmediatePropagation()}}
116
- @focus=${()=>{this.dispatchFocus(),y()&&this.dispatchToggleCalendar(new Event("focus"))}}
117
- @blur=${n=>{this.dispatchBlur(n),this.dispatchEvent(new CustomEvent("range-blur",{detail:{event:n,values:this.value,inputType:"to"},bubbles:!0,composed:!0}))}}
118
- @change=${n=>{this.dispatchChange(n),n.stopImmediatePropagation()}}
119
- ${o.n(this.inputRefTo)}
120
- />
121
- ${this.renderCalendarButton()}
122
- </div>
123
- `}};D([l.n({type:Array})],exports.PktDatepickerRange.prototype,"value",2);D([l.n({type:String})],exports.PktDatepickerRange.prototype,"label",2);D([l.n({type:Boolean})],exports.PktDatepickerRange.prototype,"showRangeLabels",2);D([l.n({type:Object})],exports.PktDatepickerRange.prototype,"strings",2);exports.PktDatepickerRange=D([l.t("pkt-datepicker-range")],exports.PktDatepickerRange);var re=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,P=(s,e,t,a)=>{for(var i=a>1?void 0:a?pe(e,t):e,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(a?n(e,t,i):n(i))||i);return a&&i&&re(e,t,i),i};exports.PktDatepickerMultiple=class extends f{constructor(){super(...arguments),this.value=[],this.strings=B}get isInputDisabled(){return this.disabled||this.maxlength!==void 0&&this.maxlength!==null&&this.value.length>=this.maxlength}dispatchAddToSelected(e){this.dispatchEvent(new CustomEvent("add-to-selected",{detail:e,bubbles:!0,composed:!0}))}render(){return l.b`
124
- <div class="pkt-input__container">
125
- <input
126
- class=${m.e(this.inputClasses)}
127
- .type=${this.inputType}
128
- id="${this.id}-input"
129
- min=${g.o(this.min)}
130
- max=${g.o(this.max)}
131
- placeholder=${g.o(this.placeholder)}
132
- ?readonly=${this.isInputReadonly}
133
- ?disabled=${this.isInputDisabled}
134
- @click=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
135
- @touchend=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
136
- @blur=${e=>{this.dispatchBlur(e),this.dispatchAddToSelected(e)}}
137
- @input=${e=>{this.dispatchInput(e),e.stopImmediatePropagation()}}
138
- @focus=${()=>{this.dispatchFocus(),y()&&this.dispatchToggleCalendar(new Event("focus"))}}
139
- @keydown=${e=>C.handleInputKeydown(e,t=>this.dispatchToggleCalendar(t),()=>b.submitFormOrFallback(this.internals,()=>{var t;return(t=this.inputRef.value)==null?void 0:t.blur()}),void 0,void 0,t=>this.dispatchAddToSelected(t))}
140
- @change=${e=>{this.dispatchChange(e),e.stopImmediatePropagation()}}
141
- ${o.n(this.inputRef)}
142
- />
143
- ${this.renderCalendarButton()}
144
- </div>
145
- `}};P([l.n({type:Array})],exports.PktDatepickerMultiple.prototype,"value",2);P([l.n({type:Number})],exports.PktDatepickerMultiple.prototype,"maxlength",2);P([l.n({type:Object})],exports.PktDatepickerMultiple.prototype,"strings",2);exports.PktDatepickerMultiple=P([l.t("pkt-datepicker-multiple")],exports.PktDatepickerMultiple);var ue=Object.defineProperty,oe=Object.getOwnPropertyDescriptor,h=(s,e,t,a)=>{for(var i=a>1?void 0:a?oe(e,t):e,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(a?n(e,t,i):n(i))||i);return a&&i&&ue(e,t,i),i};exports.PktDatepicker=class extends A.PktInputElement{constructor(){super(...arguments),this._valueProperty="",this._valueProcessing=!1,this.datepickerPopupRef=o.e(),this._value=[],this.label="Datovelger",this.dateformat=$.props.dateformat.default,this.multiple=$.props.multiple.default,this.maxlength=null,this.range=$.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=$.props.weeknumbers.default,this.withcontrols=$.props.withcontrols.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.today=null,this.calendarOpen=!1,this.timezone="Europe/Oslo",this.inputClasses={},this.calRef=o.e(),this.popupRef=o.e(),this.singleInputRef=o.e(),this.rangeInputRef=o.e(),this.multipleInputRef=o.e(),this.addToSelected=e=>{const t=this.datepickerPopupRef.value;return t&&typeof t.addToSelected=="function"?t.addToSelected(e,this.min,this.max):w.addToSelected(e,this.calRef,this.min,this.max)}}get value(){return this._valueProperty}set value(e){const t=this._valueProperty;this._valueProperty=Array.isArray(e)?e.join(","):e||"",this.valueChanged(this._valueProperty,t),this.requestUpdate("value",t)}get inputType(){return Z.getInputType()}connectedCallback(){super.connectedCallback(),this.timezone&&this.timezone!==window.pktTz&&(window.pktTz=this.timezone)}disconnectedCallback(){super.disconnectedCallback()}onInput(){this.dispatchEvent(new Event("input",{bubbles:!0}))}valueChanged(e,t){if(!(this._valueProcessing||e===t)){this._valueProcessing=!0;try{const a=u.valueToArray(e),i=this.multiple&&a.length>1?E.filterSelectableDates(a,this.min,this.max,this.excludedates,this.excludeweekdays):a;if(this.range&&!E.validateRangeOrder(i)){this._value=[],this._valueProperty="",super.valueChanged("",t);return}this._value=i;const r=u.arrayToCsv(i);if(this._valueProperty!==r&&(this._valueProperty=r),this.range&&i.length<2)return;super.valueChanged(r,t)}finally{this._valueProcessing=!1}}}attributeChangedCallback(e,t,a){e==="value"&&this.value!==t&&this.valueChanged(a,t),e==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=u.valueToArray(a||"")),e==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=u.valueToArray(a||"")),super.attributeChangedCallback(e,t,a)}updated(e){if(e.has("value")&&(e.has("multiple")||e.has("range"))){const t=Array.isArray(this.value)?this.value.join(","):this.value,a=e.get("value"),i=Array.isArray(a)?a.join(","):a;this.valueChanged(t,i)}e.has("multiple")&&(this.multiple&&!Array.isArray(this._value)?this._value=u.valueToArray(this.value):!this.multiple&&Array.isArray(this._value)&&(this._value=this._value.filter(Boolean)),!this.multiple&&!this.range&&Array.isArray(this._value)&&(this._value=[this._value[0]??""])),super.updated(e)}get inputRef(){return{value:this.currentInputElement}}get inputRefTo(){return{value:this.currentInputElementTo}}get currentInputElement(){var e,t,a;return this.multiple?(e=this.multipleInputRef.value)==null?void 0:e.inputElement:this.range?(t=this.rangeInputRef.value)==null?void 0:t.inputElement:(a=this.singleInputRef.value)==null?void 0:a.inputElement}get currentInputElementTo(){var e;if(this.range)return(e=this.rangeInputRef.value)==null?void 0:e.inputElementTo}get currentButtonElement(){var e,t,a;return this.multiple?(e=this.multipleInputRef.value)==null?void 0:e.buttonElement:this.range?(t=this.rangeInputRef.value)==null?void 0:t.buttonElement:(a=this.singleInputRef.value)==null?void 0:a.buttonElement}get btnRef(){return{value:this.currentButtonElement}}renderInput(){return l.b`
146
- <pkt-datepicker-single
147
- .value=${this._value[0]??""}
148
- .inputType=${this.inputType}
149
- .id=${this.id}
150
- .min=${this.min}
151
- .max=${this.max}
152
- .placeholder=${this.placeholder}
153
- .readonly=${this.readonly}
154
- .disabled=${this.disabled}
155
- .inputClasses=${this.inputClasses}
156
- .internals=${this.internals}
157
- .strings=${this.strings}
158
- @toggle-calendar=${e=>this.toggleCalendar(e.detail)}
159
- @input-change=${()=>this.onInput()}
160
- @input-focus=${()=>this.onFocus()}
161
- @input-blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.detail.relatedTarget)||this.onBlur()}}
162
- @manage-validity=${e=>this.manageValidity(e.detail)}
163
- @value-change=${e=>{this.value=e.detail}}
164
- @input-changed=${()=>{this.touched=!0}}
165
- ${o.n(this.singleInputRef)}
166
- ></pkt-datepicker-single>
167
- `}renderRangeInput(){return l.b`
168
- <pkt-datepicker-range
169
- .value=${this._value}
170
- .inputType=${this.inputType}
171
- .id=${this.id}
172
- .label=${this.label}
173
- .min=${this.min}
174
- .max=${this.max}
175
- .placeholder=${this.placeholder}
176
- .readonly=${this.readonly}
177
- .disabled=${this.disabled}
178
- .showRangeLabels=${this.showRangeLabels}
179
- .inputClasses=${this.inputClasses}
180
- .internals=${this.internals}
181
- .strings=${this.strings}
182
- @toggle-calendar=${e=>this.toggleCalendar(e.detail)}
183
- @input-change=${()=>this.onInput()}
184
- @input-focus=${()=>this.onFocus()}
185
- @input-blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.detail.relatedTarget)||this.onBlur()}}
186
- @range-blur=${e=>{const t=this.currentInputElement,a=this.currentInputElementTo;if(t&&a){const i=t.value,r=a.value;if(i&&r&&i>r)a.value="",this._value=[i],this.value=i;else{const n=[i,r].filter(Boolean);n.length>0&&(n[0]!==this._value[0]||n[1]!==this._value[1])&&(this._value=n,this.value=n.join(","))}}T.processRangeBlur(e.detail.event,e.detail.values,this.calRef,()=>this.clearInputValue(),i=>this.manageValidity(i))}}
187
- @manage-validity=${e=>this.manageValidity(e.detail)}
188
- @validate-date-input=${e=>{b.validateDateInput(e.detail,this.internals,this.min,this.max,this.strings)}}
189
- @handle-date-select=${e=>{var a,i;const t=u.fromISOToDate(e.detail);if(t){const r=u.formatISODate(t);this._value[0]!==r&&this._value[1]!==r&&((i=(a=this.calRef)==null?void 0:a.value)==null||i.handleDateSelect(t))}}}
190
- @input-changed=${()=>{this.touched=!0}}
191
- ${o.n(this.rangeInputRef)}
192
- ></pkt-datepicker-range>
193
- `}renderMultipleInput(){return l.b`
194
- <pkt-datepicker-multiple
195
- .value=${this._value}
196
- .inputType=${this.inputType}
197
- .id=${this.id}
198
- .min=${this.min}
199
- .max=${this.max}
200
- .placeholder=${this.placeholder}
201
- .readonly=${this.readonly}
202
- .disabled=${this.disabled}
203
- .maxlength=${this.maxlength}
204
- .inputClasses=${this.inputClasses}
205
- .internals=${this.internals}
206
- .strings=${this.strings}
207
- @toggle-calendar=${e=>this.toggleCalendar(e.detail)}
208
- @input-change=${()=>this.onInput()}
209
- @input-focus=${()=>this.onFocus()}
210
- @input-blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.detail.relatedTarget)||this.onBlur()}}
211
- @add-to-selected=${e=>this.addToSelected(e.detail)}
212
- @input-changed=${()=>{this.touched=!0}}
213
- ${o.n(this.multipleInputRef)}
214
- ></pkt-datepicker-multiple>
215
- `}renderCalendar(){return l.b`
216
- <pkt-datepicker-popup
217
- class="pkt-contents"
218
- ?open=${this.calendarOpen}
219
- ?multiple=${this.multiple}
220
- ?range=${this.range}
221
- ?weeknumbers=${this.weeknumbers}
222
- ?withcontrols=${this.withcontrols}
223
- .maxMultiple=${this.maxlength}
224
- .selected=${this._value}
225
- .earliest=${this.min}
226
- .latest=${this.max}
227
- .excludedates=${Array.isArray(this.excludedates)?this.excludedates:this.excludedates.split(",")}
228
- .excludeweekdays=${this.excludeweekdays}
229
- .currentmonth=${this.currentmonth?u.parseISODateString(this.currentmonth):null}
230
- .today=${this.today}
231
- @date-selected=${e=>{this.value=T.processDateSelection(e.detail,this.multiple,this.range),this._value=e.detail,T.updateInputValues(this.inputRef,this.inputRefTo,this._value,this.range,this.multiple,t=>this.manageValidity(t))}}
232
- @close=${()=>{this.onBlur(),this.hideCalendar()}}
233
- ${o.n(this.datepickerPopupRef)}
234
- ></pkt-datepicker-popup>
235
- `}render(){return this.inputClasses=x.getInputClasses(this.fullwidth,this.showRangeLabels,this.multiple,this.range,this.readonly,this.inputType),l.b`
236
- <pkt-input-wrapper
237
- label="${this.label}"
238
- forId="${this.id}-input"
239
- ?counter=${this.multiple&&!!this.maxlength}
240
- .counterCurrent=${this.value?this._value.length:0}
241
- .counterMaxLength=${this.maxlength}
242
- ?disabled=${this.disabled}
243
- ?hasError=${this.hasError}
244
- ?hasFieldset=${this.hasFieldset}
245
- ?inline=${this.inline}
246
- ?required=${this.required}
247
- ?optionalTag=${this.optionalTag}
248
- ?requiredTag=${this.requiredTag}
249
- useWrapper=${this.useWrapper}
250
- .optionalText=${this.optionalText}
251
- .requiredText=${this.requiredText}
252
- .tagText=${this.tagText}
253
- .errorMessage=${this.errorMessage}
254
- .helptext=${this.helptext}
255
- .helptextDropdown=${this.helptextDropdown}
256
- .helptextDropdownButton=${this.helptextDropdownButton}
257
- .ariaDescribedBy=${this.ariaDescribedBy}
258
- class="pkt-datepicker"
259
- >
260
- <div class="pkt-contents" slot="helptext">${F.slotContent(this,"helptext")}</div>
261
- ${this.multiple?l.b`<pkt-date-tags
262
- .dates=${this._value}
263
- dateformat=${this.dateformat}
264
- strings=${this.strings}
265
- id-base=${this.id}
266
- @date-tag-removed=${e=>{var i;const t=this.datepickerPopupRef.value,a=u.fromISOToDate(e.detail);t&&a&&typeof t.handleDateSelect=="function"?t.handleDateSelect(a):(i=this.calRef.value)==null||i.handleDateSelect(a)}}
267
- ></pkt-date-tags>`:l.A}
268
- <div class="pkt-datepicker__inputs ${this.range?"pkt-input__range-inputs":""}">
269
- ${this.range?this.renderRangeInput():this.multiple?this.renderMultipleInput():this.renderInput()}
270
- </div>
271
- </pkt-input-wrapper>
272
- ${this.renderCalendar()}
273
- `}handleCalendarPosition(){const e=this.multiple&&!!this.maxlength;w.handleCalendarPosition(this.popupRef,this.inputRef,e)}async showCalendar(){var t;const e=this.datepickerPopupRef.value;if(this.calendarOpen=!0,e&&typeof e.show=="function"){e.show(),y()&&e.focusOnCurrentDate();return}await O.sleep(20),this.handleCalendarPosition(),y()&&((t=this.calRef.value)==null||t.focusOnCurrentDate())}hideCalendar(){const e=this.datepickerPopupRef.value;if(this.calendarOpen=!1,e&&typeof e.hide=="function")return e.hide()}async toggleCalendar(e){e.preventDefault();const t=this.datepickerPopupRef.value;if(t&&typeof t.toggle=="function"){const a=!!t.open;t.toggle(),this.calendarOpen=!a;return}this.calendarOpen?this.hideCalendar():this.showCalendar()}clearInputValue(){this._value=[],this.value="",this.internals.setFormValue(this.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:this._value,bubbles:!0,composed:!0}))}};h([l.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"value",1);h([l.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"label",2);h([l.n({type:String})],exports.PktDatepicker.prototype,"dateformat",2);h([l.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"multiple",2);h([l.n({type:Number,reflect:!0})],exports.PktDatepicker.prototype,"maxlength",2);h([l.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"range",2);h([l.n({type:Boolean,attribute:"show-range-labels"})],exports.PktDatepicker.prototype,"showRangeLabels",2);h([l.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"min",2);h([l.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"max",2);h([l.n({type:Boolean})],exports.PktDatepicker.prototype,"weeknumbers",2);h([l.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"withcontrols",2);h([l.n({converter:u.converters.csvToArray})],exports.PktDatepicker.prototype,"excludedates",2);h([l.n({converter:u.converters.csvToArray})],exports.PktDatepicker.prototype,"excludeweekdays",2);h([l.n({type:String})],exports.PktDatepicker.prototype,"currentmonth",2);h([l.n({type:String})],exports.PktDatepicker.prototype,"today",2);h([l.n({type:Boolean,reflect:!0,attribute:"calendar-open"})],exports.PktDatepicker.prototype,"calendarOpen",2);h([l.n({type:String})],exports.PktDatepicker.prototype,"timezone",2);h([I.r()],exports.PktDatepicker.prototype,"inputClasses",2);exports.PktDatepicker=h([l.t("pkt-datepicker")],exports.PktDatepicker);
@@ -1 +0,0 @@
1
- "use strict";const i=require("./element-gR_VtSiD.cjs");var n=Object.defineProperty,u=Object.getOwnPropertyDescriptor,a=(r,e,l,t)=>{for(var s=t>1?void 0:t?u(e,l):e,d=r.length-1,h;d>=0;d--)(h=r[d])&&(s=(t?h(e,l,s):h(s))||s);return t&&s&&n(e,l,s),s};exports.PktHeading=class extends i.PktShadowElement{constructor(){super(...arguments),this.size=void 0,this.level=2,this.weight=void 0,this.visuallyHidden=!1,this.align=void 0}connectedCallback(){super.connectedCallback(),this.setAttribute("role","heading"),this.setAttribute("aria-level",String(this.level)),this.updateHostClasses()}attributeChangedCallback(e,l,t){super.attributeChangedCallback(e,l,t),e==="level"&&t&&this.setLevel(Number(t)),e==="visuallyHidden"&&(this.visuallyHidden=t!==null&&t!=="false"),(e==="size"||e==="visuallyHidden"||e==="align"||e==="weight")&&this.updateHostClasses()}updated(e){super.updated(e),e.has("level")&&(this.setLevel(this.level),this.hasAttribute("size")||(this.size=this.defaultSizeForLevel),this.hasAttribute("weight")||(this.weight=this.defaultWeightForLevel)),!this.hasAttribute("size")&&(e.has("level")||this.size===void 0)&&(this.size=this.defaultSizeForLevel),(e.has("size")||e.has("visuallyHidden")||e.has("align")||e.has("weight"))&&this.updateHostClasses()}setLevel(e){e>=1&&e<=6?(this.level=e,this.setAttribute("aria-level",String(e))):console.warn(`Invalid heading level: ${e}. Must be between 1 and 6.`)}get defaultSizeForLevel(){switch(this.level){case 1:return"xlarge";case 2:return"large";case 3:return"medium";case 4:return"small";case 5:return"xsmall";case 6:return"xsmall";default:return"medium"}}get defaultWeightForLevel(){switch(this.level){case 1:return"regular";case 2:return"regular";case 3:return"medium";case 4:return"medium";case 5:return"medium";case 6:return"medium";default:return"medium"}}updateHostClasses(){this.classList.remove("pkt-heading","pkt-heading--xsmall","pkt-heading--small","pkt-heading--medium","pkt-heading--large","pkt-heading--xlarge","pkt-sr-only","pkt-heading--start","pkt-heading--center","pkt-heading--end","pkt-heading--light","pkt-heading--regular","pkt-heading--medium","pkt-heading--bold"),this.classList.add("pkt-heading"),this.size&&this.classList.add(`pkt-heading--${this.size}`),this.weight&&this.classList.add(`pkt-heading--fw-${this.weight}`),this.visuallyHidden&&this.classList.add("pkt-sr-only"),this.align&&this.classList.add(`pkt-heading--${this.align}`)}render(){return i.b`<slot></slot>`}};a([i.n({type:String,reflect:!0})],exports.PktHeading.prototype,"size",2);a([i.n({type:Number,reflect:!0})],exports.PktHeading.prototype,"level",2);a([i.n({type:String,reflect:!0})],exports.PktHeading.prototype,"weight",2);a([i.n({type:Boolean,reflect:!0})],exports.PktHeading.prototype,"visuallyHidden",2);a([i.n({type:String,reflect:!0})],exports.PktHeading.prototype,"align",2);exports.PktHeading=a([i.t("pkt-heading")],exports.PktHeading);
@@ -1,24 +0,0 @@
1
- "use strict";const x=require("./element-with-slot-ZX-up7jO.cjs"),e=require("./element-gR_VtSiD.cjs"),h=require("./icon-Bqj9oBbl.cjs"),c=require("./class-map-CsENJXf1.cjs"),u=require("./state-Dg-53wQ8.cjs"),a=require("./utils-byXsEz1u.cjs"),d=require("./input-wrapper-EoSAbU-U.cjs");var k=Object.defineProperty,_=Object.getOwnPropertyDescriptor,r=(o,p,l,n)=>{for(var t=n>1?void 0:n?_(p,l):p,s=o.length-1,i;s>=0;s--)(i=o[s])&&(t=(n?i(p,l,t):i(t))||t);return n&&t&&k(p,l,t),t};exports.PktHelptext=class extends x.PktElementWithSlot{constructor(){super(...arguments),this.forId=a.uuidish(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=d.specs.props.helptextDropdownButton.default,this.isHelpTextOpen=!1}render(){const p=()=>{const s=!this.isHelpTextOpen;this.isHelpTextOpen=s,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:s}}))},l=c.e({"pkt-inputwrapper__helptext-container":!0,"pkt-inputwrapper__has-helptext":this.helptext||this.helptextDropdown||this.hasSlotContent()}),n=()=>this.helptextDropdown?e.b`<div class="pkt-inputwrapper__helptext-expandable">
2
- <button
3
- class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
4
- type="button"
5
- @click=${p}
6
- >
7
- <pkt-icon
8
- class="pkt-btn__icon"
9
- name="${this.isHelpTextOpen?"chevron-thin-up":"chevron-thin-down"}"
10
- ></pkt-icon>
11
- <span class="pkt-btn__text">${h.o(this.helptextDropdownButton)}</span>
12
- </button>
13
- <div
14
- class="${c.e({"pkt-inputwrapper__helptext":!0,"pkt-inputwrapper__helptext-expandable-open":this.isHelpTextOpen,"pkt-inputwrapper__helptext-expandable-closed":!this.isHelpTextOpen})}"
15
- >
16
- ${h.o(this.helptextDropdown)}
17
- </div>
18
- </div>`:e.A,t=()=>e.b`<div class="${l}">
19
- <div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
20
- <div class="pkt-contents" name="helptext">${x.slotContent(this)}</div>
21
- ${this.helptext&&h.o(this.helptext)}
22
- </div>
23
- ${n()}
24
- </div>`;return e.b`${t()}`}};r([e.n({type:String,reflect:!0})],exports.PktHelptext.prototype,"forId",2);r([e.n({type:String})],exports.PktHelptext.prototype,"helptext",2);r([e.n({type:String})],exports.PktHelptext.prototype,"helptextDropdown",2);r([e.n({type:String})],exports.PktHelptext.prototype,"helptextDropdownButton",2);r([u.r()],exports.PktHelptext.prototype,"isHelpTextOpen",2);exports.PktHelptext=r([e.t("pkt-helptext")],exports.PktHelptext);
@@ -1,80 +0,0 @@
1
- import { P as u, s as c } from "./element-with-slot-Dqk6-TRR.js";
2
- import { b as a, A as _, n as i, t as m } from "./element-CPpT3rFQ.js";
3
- import { o as x } from "./icon-BlKA8YuW.js";
4
- import { e as d } from "./class-map-CEnykyO_.js";
5
- import { r as w } from "./state-C_1EOo3D.js";
6
- import { u as v } from "./utils-DznhwRXm.js";
7
- import { s as f } from "./input-wrapper-CDgenrYA.js";
8
- var k = Object.defineProperty, b = Object.getOwnPropertyDescriptor, n = (s, p, r, o) => {
9
- for (var t = o > 1 ? void 0 : o ? b(p, r) : p, l = s.length - 1, h; l >= 0; l--)
10
- (h = s[l]) && (t = (o ? h(p, r, t) : h(t)) || t);
11
- return o && t && k(p, r, t), t;
12
- };
13
- let e = class extends u {
14
- constructor() {
15
- super(...arguments), this.forId = v(), this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = f.props.helptextDropdownButton.default, this.isHelpTextOpen = !1;
16
- }
17
- render() {
18
- const s = () => {
19
- const t = !this.isHelpTextOpen;
20
- this.isHelpTextOpen = t, this.dispatchEvent(
21
- new CustomEvent("toggleHelpText", {
22
- bubbles: !0,
23
- detail: { isOpen: t }
24
- })
25
- );
26
- }, p = d({
27
- "pkt-inputwrapper__helptext-container": !0,
28
- "pkt-inputwrapper__has-helptext": this.helptext || this.helptextDropdown || this.hasSlotContent()
29
- }), r = () => this.helptextDropdown ? a`<div class="pkt-inputwrapper__helptext-expandable">
30
- <button
31
- class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
32
- type="button"
33
- @click=${s}
34
- >
35
- <pkt-icon
36
- class="pkt-btn__icon"
37
- name="${this.isHelpTextOpen ? "chevron-thin-up" : "chevron-thin-down"}"
38
- ></pkt-icon>
39
- <span class="pkt-btn__text">${x(this.helptextDropdownButton)}</span>
40
- </button>
41
- <div
42
- class="${d({
43
- "pkt-inputwrapper__helptext": !0,
44
- "pkt-inputwrapper__helptext-expandable-open": this.isHelpTextOpen,
45
- "pkt-inputwrapper__helptext-expandable-closed": !this.isHelpTextOpen
46
- })}"
47
- >
48
- ${x(this.helptextDropdown)}
49
- </div>
50
- </div>` : _;
51
- return a`${a`<div class="${p}">
52
- <div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
53
- <div class="pkt-contents" name="helptext">${c(this)}</div>
54
- ${this.helptext && x(this.helptext)}
55
- </div>
56
- ${r()}
57
- </div>`}`;
58
- }
59
- };
60
- n([
61
- i({ type: String, reflect: !0 })
62
- ], e.prototype, "forId", 2);
63
- n([
64
- i({ type: String })
65
- ], e.prototype, "helptext", 2);
66
- n([
67
- i({ type: String })
68
- ], e.prototype, "helptextDropdown", 2);
69
- n([
70
- i({ type: String })
71
- ], e.prototype, "helptextDropdownButton", 2);
72
- n([
73
- w()
74
- ], e.prototype, "isHelpTextOpen", 2);
75
- e = n([
76
- m("pkt-helptext")
77
- ], e);
78
- export {
79
- e as P
80
- };
@@ -1,103 +0,0 @@
1
- import { A as y, E as P, P as k, b as I, n as p, t as _ } from "./element-CPpT3rFQ.js";
2
- import { e as m, i as S, t as b } from "./directive-oAbCiebi.js";
3
- /**
4
- * @license
5
- * Copyright 2017 Google LLC
6
- * SPDX-License-Identifier: BSD-3-Clause
7
- */
8
- class h extends S {
9
- constructor(t) {
10
- if (super(t), this.it = y, t.type !== b.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
11
- }
12
- render(t) {
13
- if (t === y || t == null) return this._t = void 0, this.it = t;
14
- if (t === P) return t;
15
- if (typeof t != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
16
- if (t === this.it) return this._t;
17
- this.it = t;
18
- const n = [t];
19
- return n.raw = n, this._t = { _$litType$: this.constructor.resultType, strings: n, values: [] };
20
- }
21
- }
22
- h.directiveName = "unsafeHTML", h.resultType = 1;
23
- const R = m(h);
24
- /**
25
- * @license
26
- * Copyright 2017 Google LLC
27
- * SPDX-License-Identifier: BSD-3-Clause
28
- */
29
- class l extends h {
30
- }
31
- l.directiveName = "unsafeSVG", l.resultType = 2;
32
- const f = m(l);
33
- var C = Object.defineProperty, E = Object.getOwnPropertyDescriptor, c = (e, t, n, s) => {
34
- for (var o = s > 1 ? void 0 : s ? E(t, n) : t, d = e.length - 1, u; d >= 0; d--)
35
- (u = e[d]) && (o = (s ? u(t, n, o) : u(o)) || o);
36
- return s && o && C(t, n, o), o;
37
- };
38
- const w = "https://punkt-cdn.oslo.kommune.no/latest/icons/";
39
- typeof window < "u" && (window.pktFetch = window.pktFetch === void 0 ? fetch : window.pktFetch, window.pktIconPath = window.pktIconPath || w);
40
- const a = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>', r = {}, T = 2, F = 1500, g = typeof Storage < "u" && typeof sessionStorage < "u", $ = (e) => window.pktFetch(e).then((t) => {
41
- if (!t.ok)
42
- throw new Error("Missing icon: " + e);
43
- return t.text();
44
- }), v = async (e, t = T) => {
45
- try {
46
- return await $(e);
47
- } catch {
48
- return t > 0 ? (await new Promise((s) => setTimeout(s, F)), v(e, t - 1)) : (console.error("Failed to fetch icon: " + e), a);
49
- }
50
- }, A = async (e, t) => {
51
- const n = t + e + ".svg";
52
- return g && sessionStorage.getItem(n) ? sessionStorage.getItem(n) : n in r ? r[n] : typeof window < "u" && typeof window.pktFetch == "function" ? (r[n] = v(n).then((s) => (s !== a && g && sessionStorage.setItem(n, s), delete r[n], s)), r[n]) : a;
53
- };
54
- let i = class extends k {
55
- constructor() {
56
- super(...arguments), this.path = typeof window < "u" ? window.pktIconPath : w, this.name = "", this.icon = f(a), this._updatedProps = [];
57
- }
58
- connectedCallback() {
59
- super.connectedCallback(), this.classList.add("pkt-icon");
60
- }
61
- async attributeChangedCallback(e, t, n) {
62
- super.attributeChangedCallback(e, t, n), (e === "name" || e === "path") && this.getIcon(this.name);
63
- }
64
- async updated(e) {
65
- super.updated(e), (e.has("name") || e.has("path")) && this.getIcon(this.name);
66
- }
67
- async getIcon(e = "") {
68
- if (this._updatedProps.length > 0) {
69
- this.path || (this.path = typeof window < "u" ? window.pktIconPath : w);
70
- try {
71
- this.icon = f(
72
- await A(this.name || "", this.path)
73
- );
74
- } catch {
75
- this.icon = f(a);
76
- }
77
- this._updatedProps = [];
78
- } else
79
- this._updatedProps.includes(e) || this._updatedProps.push(e);
80
- }
81
- render() {
82
- return I`${this.name && this.icon}`;
83
- }
84
- };
85
- c([
86
- p({ type: String, reflect: !1 })
87
- ], i.prototype, "path", 2);
88
- c([
89
- p({ type: String, reflect: !0 })
90
- ], i.prototype, "name", 2);
91
- c([
92
- p({ type: SVGElement })
93
- ], i.prototype, "icon", 2);
94
- c([
95
- p({ type: Array, noAccessor: !0 })
96
- ], i.prototype, "_updatedProps", 2);
97
- i = c([
98
- _("pkt-icon")
99
- ], i);
100
- export {
101
- i as P,
102
- R as o
103
- };
@@ -1,9 +0,0 @@
1
- "use strict";const s=require("./element-gR_VtSiD.cjs"),h=require("./directive-C7oCP5Bh.cjs");/**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */class p extends h.i{constructor(t){if(super(t),this.it=s.A,t.type!==h.t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===s.A||t==null)return this._t=void 0,this.it=t;if(t===s.E)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}p.directiveName="unsafeHTML",p.resultType=1;const k=h.e(p);/**
6
- * @license
7
- * Copyright 2017 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- */class l extends p{}l.directiveName="unsafeSVG",l.resultType=2;const f=h.e(l);var I=Object.defineProperty,P=Object.getOwnPropertyDescriptor,a=(n,t,e,o)=>{for(var i=o>1?void 0:o?P(t,e):t,d=n.length-1,u;d>=0;d--)(u=n[d])&&(i=(o?u(t,e,i):u(i))||i);return o&&i&&I(t,e,i),i};const w="https://punkt-cdn.oslo.kommune.no/latest/icons/";typeof window<"u"&&(window.pktFetch=window.pktFetch===void 0?fetch:window.pktFetch,window.pktIconPath=window.pktIconPath||w);const c='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>',r={},m=2,v=1500,y=typeof Storage<"u"&&typeof sessionStorage<"u",_=n=>window.pktFetch(n).then(t=>{if(!t.ok)throw new Error("Missing icon: "+n);return t.text()}),g=async(n,t=m)=>{try{return await _(n)}catch{return t>0?(await new Promise(o=>setTimeout(o,v)),g(n,t-1)):(console.error("Failed to fetch icon: "+n),c)}},S=async(n,t)=>{const e=t+n+".svg";return y&&sessionStorage.getItem(e)?sessionStorage.getItem(e):e in r?r[e]:typeof window<"u"&&typeof window.pktFetch=="function"?(r[e]=g(e).then(o=>(o!==c&&y&&sessionStorage.setItem(e,o),delete r[e],o)),r[e]):c};exports.PktIcon=class extends s.PktElement{constructor(){super(...arguments),this.path=typeof window<"u"?window.pktIconPath:w,this.name="",this.icon=f(c),this._updatedProps=[]}connectedCallback(){super.connectedCallback(),this.classList.add("pkt-icon")}async attributeChangedCallback(t,e,o){super.attributeChangedCallback(t,e,o),(t==="name"||t==="path")&&this.getIcon(this.name)}async updated(t){super.updated(t),(t.has("name")||t.has("path"))&&this.getIcon(this.name)}async getIcon(t=""){if(this._updatedProps.length>0){this.path||(this.path=typeof window<"u"?window.pktIconPath:w);try{this.icon=f(await S(this.name||"",this.path))}catch{this.icon=f(c)}this._updatedProps=[]}else this._updatedProps.includes(t)||this._updatedProps.push(t)}render(){return s.b`${this.name&&this.icon}`}};a([s.n({type:String,reflect:!1})],exports.PktIcon.prototype,"path",2);a([s.n({type:String,reflect:!0})],exports.PktIcon.prototype,"name",2);a([s.n({type:SVGElement})],exports.PktIcon.prototype,"icon",2);a([s.n({type:Array,noAccessor:!0})],exports.PktIcon.prototype,"_updatedProps",2);exports.PktIcon=a([s.t("pkt-icon")],exports.PktIcon);exports.o=k;
@@ -1,54 +0,0 @@
1
- "use strict";const u=require("./element-with-slot-ZX-up7jO.cjs"),y=require("./if-defined-BOW3ODSj.cjs"),t=require("./element-gR_VtSiD.cjs"),k=require("./icon-Bqj9oBbl.cjs"),$=require("./class-map-CsENJXf1.cjs"),f=require("./utils-byXsEz1u.cjs"),x=require("./booleanish-BKVonob4.cjs"),r=require("./input-wrapper-EoSAbU-U.cjs");require("./helptext-5Mzp65-F.cjs");require("./alert-DFkFNTxh.cjs");var I=Object.defineProperty,P=Object.getOwnPropertyDescriptor,e=(l,p,n,o)=>{for(var s=o>1?void 0:o?P(p,n):p,i=l.length-1,a;i>=0;i--)(a=l[i])&&(s=(o?a(p,n,s):a(s))||s);return o&&s&&I(p,n,s),s};exports.PktInputWrapper=class extends u.PktElementWithSlot{constructor(){super(...arguments),this.forId=f.uuidish(),this.label="",this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=r.specs.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.counterError=null,this.counterPosition="bottom",this.optionalTag=r.specs.props.optionalTag.default,this.optionalText=r.specs.props.optionalText.default,this.requiredTag=r.specs.props.requiredTag.default,this.requiredText=r.specs.props.requiredText.default,this.tagText=null,this.hasError=r.specs.props.hasError.default,this.errorMessage="",this.disabled=r.specs.props.disabled.default,this.inline=r.specs.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=r.specs.props.hasFieldset.default,this.role="group",this.useWrapper=r.specs.props.useWrapper.default}updated(p){super.updated(p)}render(){const p={"pkt-inputwrapper":!0,"pkt-inputwrapper--error":this.hasError,"pkt-inputwrapper--disabled":this.disabled,"pkt-inputwrapper--inline":this.inline},n="pkt-tag pkt-tag--small pkt-tag--thin-text",o=this.ariaDescribedby?this.ariaDescribedby:this.helptext?`${this.forId}-helptext`:t.A,s=()=>t.b`
2
- ${this.tagText?t.b`<span class=${n+" pkt-tag--gray"}>${this.tagText}</span>`:t.A}
3
- ${this.optionalTag?t.b`<span class=${n+" pkt-tag--blue-light"}>${this.optionalText}</span>`:t.A}
4
- ${this.requiredTag?t.b`<span class=${n+" pkt-tag--beige"}>${this.requiredText}</span>`:t.A}
5
- `,i=()=>this.useWrapper?this.hasFieldset?t.b`<legend
6
- class="pkt-inputwrapper__legend"
7
- id="${this.forId}-label"
8
- @click=${this.handleLabelClick}
9
- >
10
- ${this.label} ${s()}
11
- </legend>`:t.b`<label
12
- class="pkt-inputwrapper__label"
13
- for="${this.forId}"
14
- aria-describedby="${o}"
15
- id="${this.forId}-label"
16
- @click=${this.handleLabelClick}
17
- >${this.label}${s()}</label
18
- >`:t.b`<label
19
- for="${this.forId}"
20
- class="pkt-sr-only"
21
- aria-describedby="${o}"
22
- id="${this.forId}-label"
23
- >
24
- ${this.label}
25
- </label>`,a=()=>t.b`
26
- <pkt-helptext
27
- class="${y.o(this.useWrapper?void 0:"pkt-hide")}"
28
- .forId=${this.forId}
29
- .helptext=${this.helptext}
30
- .helptextDropdown=${this.helptextDropdown}
31
- .helptextDropdownButton=${this.helptextDropdownButton||r.specs.props.helptextDropdownButton.default}
32
- @toggleHelpText=${g=>{this.toggleDropdown(g)}}
33
- >${u.slotContent(this,"helptext")}</pkt-helptext>
34
- `,h=()=>this.counter?t.b`<div class="pkt-input__counter" aria-live="polite" aria-atomic="true">
35
- ${this.counterError?this.counterError:t.A} ${this.counterCurrent||0}
36
- ${this.counterMaxLength?`/${this.counterMaxLength}`:t.A}
37
- </div>`:t.A,c=()=>this.hasError&&this.errorMessage?t.b`<pkt-alert
38
- skin="error"
39
- compact
40
- id=${`${this.forId}-error`}
41
- aria-live="assertive"
42
- aria-atomic="true"
43
- >
44
- ${k.o(this.errorMessage)}
45
- </pkt-alert>`:t.A,d=()=>t.b`
46
- ${i()}
47
- ${a()}
48
- ${this.counterPosition==="top"?h():t.A}
49
- <div class="pkt-contents">${u.slotContent(this)}</div>
50
- ${this.counterPosition==="bottom"?h():t.A}
51
- ${c()}
52
- `,b=()=>this.hasFieldset?t.b`<fieldset class="pkt-inputwrapper__fieldset" aria-describedby="${o}">
53
- ${d()}
54
- </fieldset>`:t.b`<div class="pkt-inputwrapper__fieldset">${d()}</div>`;return t.b`<div class=${$.e(p)}>${b()}</div> `}toggleDropdown(p){this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!1,detail:{isOpen:p.detail.isOpen}}))}handleLabelClick(){this.dispatchEvent(new CustomEvent("labelClick",{bubbles:!0,composed:!0,detail:"label clicked"}))}};e([t.n({type:String})],exports.PktInputWrapper.prototype,"forId",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"label",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"helptext",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"helptextDropdown",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"helptextDropdownButton",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"counter",2);e([t.n({type:Number})],exports.PktInputWrapper.prototype,"counterCurrent",2);e([t.n({type:Number})],exports.PktInputWrapper.prototype,"counterMaxLength",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"counterError",2);e([t.n({type:String,reflect:!1})],exports.PktInputWrapper.prototype,"counterPosition",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"optionalTag",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"optionalText",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"requiredTag",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"requiredText",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"tagText",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"hasError",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"errorMessage",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"disabled",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"inline",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"ariaDescribedby",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"hasFieldset",2);e([t.n({type:String,reflect:!0})],exports.PktInputWrapper.prototype,"role",2);e([t.n({type:Boolean,reflect:!0,converter:x.booleanishConverter})],exports.PktInputWrapper.prototype,"useWrapper",2);exports.PktInputWrapper=e([t.t("pkt-input-wrapper")],exports.PktInputWrapper);