@oslokommune/punkt-elements 17.1.2 → 18.0.0

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 (249) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/{accordion-BeLvLPrB.js → accordion-1_pdxTgJ.js} +27 -27
  3. package/dist/{accordion-B3GBlvUC.cjs → accordion-DobbH-Sv.cjs} +5 -5
  4. package/dist/{alert-Cs4Rmq_J.cjs → alert-COeHz6o2.cjs} +6 -6
  5. package/dist/{alert-DKK_Tb9J.js → alert-xspFetQ8.js} +26 -26
  6. package/dist/{async-directive-Da7TJpnq.cjs → async-directive-B5pcIMfO.cjs} +1 -1
  7. package/dist/{async-directive-BPf6K-V2.js → async-directive-D2Sht790.js} +5 -5
  8. package/dist/{backlink-D1y26pj3.js → backlink-C0jZFnZ2.js} +8 -8
  9. package/dist/{backlink-CMmrKTe4.cjs → backlink-ZMhqHaVs.cjs} +3 -3
  10. package/dist/base-elements/element.d.ts +13 -1
  11. package/dist/base-elements/input-element.d.ts +4 -2
  12. package/dist/{breadcrumbs-B6JGhJgC.cjs → breadcrumbs-BS64xd1s.cjs} +7 -7
  13. package/dist/{breadcrumbs-CcTQ3Grm.js → breadcrumbs-BvMownZN.js} +16 -16
  14. package/dist/{button-2-OSPJkj.js → button-C44vNLFC.js} +28 -28
  15. package/dist/{button-CE97NQIk.cjs → button-CR4CXtnj.cjs} +7 -7
  16. package/dist/{calendar-kn4SrtJy.cjs → calendar-DQ4byeom.cjs} +28 -27
  17. package/dist/{calendar-pOW3R5Pw.js → calendar-DgjCKMMV.js} +82 -68
  18. package/dist/{card-zQ0eKRMV.js → card-DhHqC265.js} +44 -44
  19. package/dist/{card-CETDFkxR.cjs → card-Dpqi6HVt.cjs} +26 -26
  20. package/dist/{checkbox-CH7NpINF.js → checkbox-BQ1K57AB.js} +23 -23
  21. package/dist/{checkbox-CQNr_sEg.cjs → checkbox-CXQxbiaX.cjs} +11 -11
  22. package/dist/{class-map-BeimMvPv.cjs → class-map-CzCE5pqG.cjs} +1 -1
  23. package/dist/{class-map-CnWCnBSX.js → class-map-F1DJHyb7.js} +3 -3
  24. package/dist/{combobox-Bvg0UO9w.cjs → combobox-BV4oDiII.cjs} +19 -18
  25. package/dist/{combobox-CRdYYlxu.js → combobox-DPck39I2.js} +55 -54
  26. package/dist/components/calendar/calendar.d.ts +21 -6
  27. package/dist/components/checkbox/checkbox.d.ts +4 -2
  28. package/dist/components/combobox/combobox-base.d.ts +2 -1
  29. package/dist/components/consent/strings.d.ts +1 -85
  30. package/dist/components/datepicker/datepicker-base.d.ts +0 -3
  31. package/dist/components/datepicker/datepicker-multiple.d.ts +0 -2
  32. package/dist/components/datepicker/datepicker-range.d.ts +0 -2
  33. package/dist/components/datepicker/datepicker-single.d.ts +0 -2
  34. package/dist/components/datepicker/datepicker-utils.d.ts +2 -1
  35. package/dist/components/fileupload/fileupload-base.d.ts +3 -2
  36. package/dist/components/header/header-service.d.ts +3 -1
  37. package/dist/components/header/header.d.ts +2 -1
  38. package/dist/components/helptext/helptext.d.ts +2 -1
  39. package/dist/components/index.d.ts +2 -0
  40. package/dist/components/input-wrapper/input-wrapper.d.ts +4 -2
  41. package/dist/components/radiobutton/radiobutton.d.ts +4 -2
  42. package/dist/components/searchinput/searchinput.d.ts +2 -1
  43. package/dist/{consent-DZEkhgJ1.js → consent-BneInZov.js} +10 -10
  44. package/dist/{consent-CyY3RyoC.cjs → consent-_N9foluG.cjs} +5 -5
  45. package/dist/controllers/strings-controller.d.ts +27 -0
  46. package/dist/{datepicker-VTqSDQk5.cjs → datepicker-9NX5qt2z.cjs} +38 -37
  47. package/dist/{datepicker-ButIas85.js → datepicker-nSSSr1U7.js} +104 -104
  48. package/dist/{directive-helpers-CI8YZqku.js → directive-helpers-BARw3nEZ.js} +1 -1
  49. package/dist/{directive-helpers-BlAV5EQD.cjs → directive-helpers-D6AAMFKs.cjs} +1 -1
  50. package/dist/docs/components/fileupload.d.ts +1 -0
  51. package/dist/element-B8OGznK0.cjs +2 -0
  52. package/dist/{element-ChsFgr_B.js → element-BKSPVgs2.js} +240 -100
  53. package/dist/{element-with-slot-Bj7nm7fO.cjs → element-with-slot-DTxILHVv.cjs} +1 -1
  54. package/dist/{element-with-slot-BvG9ctC-.js → element-with-slot-YUAUFRqw.js} +4 -4
  55. package/dist/fileupload-D05VSbEP.cjs +402 -0
  56. package/dist/{fileupload-D5IQ9HDe.js → fileupload-E0LGGNgj.js} +370 -380
  57. package/dist/{footer-DbYQUYNR.cjs → footer-DBApIdGh.cjs} +32 -32
  58. package/dist/{footer-DrR64HiK.js → footer-DYilVBMC.js} +91 -91
  59. package/dist/format-B8meU8Tm.cjs +1 -0
  60. package/dist/format-BTeSVkED.js +18 -0
  61. package/dist/{header-ClgIac6n.cjs → header-B7tbX-Ok.cjs} +84 -84
  62. package/dist/{header-menu-BAsUNKSx.cjs → header-menu-1FFWhvNc.cjs} +24 -24
  63. package/dist/{header-menu-hVPXsb8g.js → header-menu-D522-VTV.js} +75 -75
  64. package/dist/{header-KvJ1mGwA.js → header-v3GWAzOK.js} +267 -264
  65. package/dist/{heading-CFmiSuCQ.cjs → heading-CvytvcL7.cjs} +1 -1
  66. package/dist/{heading-g-_IUB5T.js → heading-rx_oSCqe.js} +16 -16
  67. package/dist/helptext-DYFdcylX.cjs +27 -0
  68. package/dist/{helptext-DZng1D5i.js → helptext-LShGPm-b.js} +18 -19
  69. package/dist/{icon-9iwd2F2l.cjs → icon-BmMC09mi.cjs} +1 -1
  70. package/dist/{icon-D-LA22xD.js → icon-HYU1f54x.js} +17 -17
  71. package/dist/{if-defined-CGzIlZ9-.js → if-defined-BF8XcDi5.js} +1 -1
  72. package/dist/if-defined-CVYApOgK.cjs +1 -0
  73. package/dist/{input-element-DBMNBplu.js → input-element-D07DmR34.js} +121 -120
  74. package/dist/input-element-DumGj_oJ.cjs +1 -0
  75. package/dist/input-wrapper-Cci_wTvD.js +308 -0
  76. package/dist/input-wrapper-DDfapoRX.cjs +58 -0
  77. package/dist/{link-DK7gvmnj.cjs → link-11g2ZNin.cjs} +4 -4
  78. package/dist/{link-D-Eqm5KH.js → link-CQK0SH4H.js} +13 -13
  79. package/dist/{linkcard-zqbg7Oqm.js → linkcard-B4GlmjJ6.js} +16 -16
  80. package/dist/linkcard-DNYsVlV6.cjs +13 -0
  81. package/dist/{listbox-Dc4rGdPi.cjs → listbox-BlFRhyI7.cjs} +15 -15
  82. package/dist/{listbox-va_E8afs.js → listbox-wd_OofyF.js} +100 -99
  83. package/dist/{loader-D_RDICnw.js → loader-0C3qVk16.js} +14 -14
  84. package/dist/{loader-CMUkVJmE.cjs → loader-B9u2qUlR.cjs} +5 -5
  85. package/dist/{messagebox-Cv8LaSxv.cjs → messagebox-BD5tGmT-.cjs} +5 -5
  86. package/dist/{messagebox-Cw-OWDya.js → messagebox-C-y1ICmr.js} +15 -15
  87. package/dist/{modal-BtInv031.cjs → modal-BzPGQYCs.cjs} +8 -8
  88. package/dist/{modal-D0t_X2dX.js → modal-Cghs3w-d.js} +20 -20
  89. package/dist/pkt-accordion.cjs +1 -1
  90. package/dist/pkt-accordion.js +1 -1
  91. package/dist/pkt-alert.cjs +1 -1
  92. package/dist/pkt-alert.js +1 -1
  93. package/dist/pkt-backlink.cjs +1 -1
  94. package/dist/pkt-backlink.js +1 -1
  95. package/dist/pkt-breadcrumbs.cjs +1 -1
  96. package/dist/pkt-breadcrumbs.js +1 -1
  97. package/dist/pkt-button.cjs +1 -1
  98. package/dist/pkt-button.js +1 -1
  99. package/dist/pkt-calendar.cjs +1 -1
  100. package/dist/pkt-calendar.js +1 -1
  101. package/dist/pkt-card.cjs +1 -1
  102. package/dist/pkt-card.js +1 -1
  103. package/dist/pkt-checkbox.cjs +1 -1
  104. package/dist/pkt-checkbox.js +1 -1
  105. package/dist/pkt-combobox.cjs +1 -1
  106. package/dist/pkt-combobox.js +1 -1
  107. package/dist/pkt-consent.cjs +1 -1
  108. package/dist/pkt-consent.js +1 -1
  109. package/dist/pkt-datepicker.cjs +1 -1
  110. package/dist/pkt-datepicker.js +1 -1
  111. package/dist/pkt-fileupload.cjs +1 -1
  112. package/dist/pkt-fileupload.js +1 -1
  113. package/dist/pkt-footer.cjs +1 -1
  114. package/dist/pkt-footer.js +1 -1
  115. package/dist/pkt-header-menu.cjs +1 -1
  116. package/dist/pkt-header-menu.js +1 -1
  117. package/dist/pkt-header.cjs +1 -1
  118. package/dist/pkt-header.js +1 -1
  119. package/dist/pkt-heading.cjs +1 -1
  120. package/dist/pkt-heading.js +1 -1
  121. package/dist/pkt-helptext.cjs +1 -1
  122. package/dist/pkt-helptext.js +1 -1
  123. package/dist/pkt-icon.cjs +1 -1
  124. package/dist/pkt-icon.js +1 -1
  125. package/dist/pkt-index.cjs +1 -1
  126. package/dist/pkt-index.js +35 -34
  127. package/dist/pkt-input-wrapper.cjs +1 -1
  128. package/dist/pkt-input-wrapper.js +1 -1
  129. package/dist/pkt-link.cjs +1 -1
  130. package/dist/pkt-link.js +1 -1
  131. package/dist/pkt-linkcard.cjs +1 -1
  132. package/dist/pkt-linkcard.js +1 -1
  133. package/dist/pkt-listbox.cjs +1 -1
  134. package/dist/pkt-listbox.js +1 -1
  135. package/dist/pkt-loader.cjs +1 -1
  136. package/dist/pkt-loader.js +1 -1
  137. package/dist/pkt-messagebox.cjs +1 -1
  138. package/dist/pkt-messagebox.js +1 -1
  139. package/dist/pkt-modal.cjs +1 -1
  140. package/dist/pkt-modal.js +1 -1
  141. package/dist/{pkt-options-controller-C5EBX2T0.cjs → pkt-options-controller-CEEAqXaB.cjs} +1 -1
  142. package/dist/{pkt-options-controller-B77vH3PE.js → pkt-options-controller-PtjhmTGk.js} +1 -1
  143. package/dist/pkt-progressbar.cjs +1 -1
  144. package/dist/pkt-progressbar.js +1 -1
  145. package/dist/pkt-radiobutton.cjs +1 -1
  146. package/dist/pkt-radiobutton.js +1 -1
  147. package/dist/pkt-searchinput.cjs +1 -1
  148. package/dist/pkt-searchinput.js +1 -1
  149. package/dist/pkt-select.cjs +1 -1
  150. package/dist/pkt-select.js +1 -1
  151. package/dist/pkt-tabs.cjs +1 -1
  152. package/dist/pkt-tabs.js +1 -1
  153. package/dist/pkt-tag.cjs +1 -1
  154. package/dist/pkt-tag.js +1 -1
  155. package/dist/pkt-textarea.cjs +1 -1
  156. package/dist/pkt-textarea.js +1 -1
  157. package/dist/pkt-textinput.cjs +1 -1
  158. package/dist/pkt-textinput.js +1 -1
  159. package/dist/pkt-timepicker.cjs +1 -1
  160. package/dist/pkt-timepicker.js +1 -1
  161. package/dist/{progressbar-CbcfLerF.js → progressbar-BexQQw1o.js} +21 -21
  162. package/dist/{progressbar-D5MmnQId.cjs → progressbar-X9mSvpjw.cjs} +5 -5
  163. package/dist/{radiobutton-BUnf3EPi.js → radiobutton-CkhTasn4.js} +24 -24
  164. package/dist/{radiobutton-DpsO1F-8.cjs → radiobutton-ln29Ad3U.cjs} +8 -8
  165. package/dist/{ref-CQoEIIp0.cjs → ref-CHbJYtKE.cjs} +1 -1
  166. package/dist/{ref-CWD6PjVd.js → ref-Chc_DZAb.js} +2 -2
  167. package/dist/{repeat-sY6B7fAT.cjs → repeat-CHDs__rN.cjs} +1 -1
  168. package/dist/{repeat-C02g7d5S.js → repeat-P9SMlKd5.js} +4 -4
  169. package/dist/searchinput-CPgMEAZZ.cjs +60 -0
  170. package/dist/{searchinput-DwnjsvJ1.js → searchinput-Da7dKHBH.js} +43 -43
  171. package/dist/{select-BOJi6H6T.cjs → select-DCuvdAuK.cjs} +4 -3
  172. package/dist/{select-DMre80qs.js → select-jabMSjft.js} +21 -20
  173. package/dist/shared-strings/consent.d.ts +71 -0
  174. package/dist/shared-strings/format.d.ts +21 -0
  175. package/dist/shared-strings/index.d.ts +14 -0
  176. package/dist/shared-strings/nb.d.ts +118 -0
  177. package/dist/shared-strings/resolve.d.ts +12 -0
  178. package/dist/shared-strings/store.d.ts +27 -0
  179. package/dist/shared-strings/types.d.ts +29 -0
  180. package/dist/shared-types/fileupload.d.ts +0 -27
  181. package/dist/shared-types/index.d.ts +1 -2
  182. package/dist/shared-utils/combobox/index.d.ts +1 -0
  183. package/dist/shared-utils/combobox/input-utils.d.ts +2 -1
  184. package/dist/shared-utils/combobox/messages.d.ts +7 -0
  185. package/dist/shared-utils/combobox/option-utils.d.ts +2 -1
  186. package/dist/shared-utils/combobox/selection-manager.d.ts +3 -2
  187. package/dist/{tabs-Cf9ai0FD.cjs → tabs-DV5CQNDL.cjs} +7 -7
  188. package/dist/{tabs-TvxgbrCF.js → tabs-D_hoi1zu.js} +32 -32
  189. package/dist/tag-BxYulmZn.cjs +27 -0
  190. package/dist/{tag-Ds6n1LIs.js → tag-DK5SgKry.js} +33 -32
  191. package/dist/tests/strings-override.test.d.ts +0 -0
  192. package/dist/{textarea-vfzIcXhX.js → textarea-BR7Riace.js} +30 -29
  193. package/dist/{textarea-BydiLM9Z.cjs → textarea-ffBD_VHq.cjs} +3 -2
  194. package/dist/{textinput-CMP2jPP_.js → textinput-CRNrsRNV.js} +28 -27
  195. package/dist/{textinput-DGdicNSx.cjs → textinput-CtHFzAux.cjs} +13 -12
  196. package/dist/timepicker-AfgJipo6.cjs +196 -0
  197. package/dist/{timepicker-ClwgYywH.js → timepicker-ixs_E5RY.js} +67 -64
  198. package/package.json +3 -3
  199. package/src/components/backlink/backlink.ts +1 -1
  200. package/src/components/breadcrumbs/breadcrumbs.ts +1 -1
  201. package/src/components/calendar/calendar.ts +56 -26
  202. package/src/components/checkbox/checkbox.test.ts +0 -2
  203. package/src/components/checkbox/checkbox.ts +8 -4
  204. package/src/components/combobox/combobox-base.ts +2 -1
  205. package/src/components/combobox/combobox-value.ts +10 -9
  206. package/src/components/combobox/combobox.selection.test.ts +5 -1
  207. package/src/components/combobox/combobox.ts +4 -1
  208. package/src/components/consent/strings.ts +1 -125
  209. package/src/components/datepicker/date-tags.ts +4 -1
  210. package/src/components/datepicker/datepicker-base.ts +2 -6
  211. package/src/components/datepicker/datepicker-multiple.ts +0 -3
  212. package/src/components/datepicker/datepicker-range.ts +4 -7
  213. package/src/components/datepicker/datepicker-single.ts +0 -3
  214. package/src/components/datepicker/datepicker-utils.test.ts +5 -5
  215. package/src/components/datepicker/datepicker-utils.ts +6 -11
  216. package/src/components/datepicker/datepicker.ts +8 -1
  217. package/src/components/fileupload/fileupload-base.ts +25 -16
  218. package/src/components/fileupload/fileupload-renderers.ts +2 -1
  219. package/src/components/fileupload/fileupload.test.ts +16 -0
  220. package/src/components/fileupload/fileupload.ts +19 -15
  221. package/src/components/header/header-global.ts +3 -3
  222. package/src/components/header/header-service.ts +13 -8
  223. package/src/components/header/header.ts +2 -1
  224. package/src/components/helptext/helptext.test.ts +1 -1
  225. package/src/components/helptext/helptext.ts +3 -3
  226. package/src/components/index.ts +9 -0
  227. package/src/components/input-wrapper/input-wrapper.ts +18 -10
  228. package/src/components/listbox/listbox.ts +3 -3
  229. package/src/components/radiobutton/radiobutton.ts +8 -4
  230. package/src/components/searchinput/searchinput.ts +5 -3
  231. package/src/components/select/select.ts +1 -0
  232. package/src/components/tag/tag.ts +2 -1
  233. package/src/components/textarea/textarea.ts +1 -0
  234. package/src/components/textinput/textinput.ts +1 -0
  235. package/src/components/timepicker/timepicker.ts +23 -21
  236. package/dist/element-BA8v6S7z.cjs +0 -2
  237. package/dist/fileupload-BeWiTAoW.cjs +0 -401
  238. package/dist/helptext-CTtKJcML.cjs +0 -27
  239. package/dist/if-defined-B89_ZeCj.cjs +0 -1
  240. package/dist/input-element-DYmQw-fH.cjs +0 -1
  241. package/dist/input-wrapper-BmxNvznr.js +0 -128
  242. package/dist/input-wrapper-D-fPaTbY.js +0 -176
  243. package/dist/input-wrapper-D5PR0rJn.cjs +0 -1
  244. package/dist/input-wrapper-Q-B-aBeb.cjs +0 -54
  245. package/dist/linkcard-B29cmZqh.cjs +0 -13
  246. package/dist/searchinput-Bh975rjX.cjs +0 -60
  247. package/dist/tag-CzojNU7z.cjs +0 -27
  248. package/dist/timepicker-DYrnLHqN.cjs +0 -195
  249. package/dist/translations/no.json.d.ts +0 -94
@@ -0,0 +1,7 @@
1
+ import type { TPktStrings } from '../../shared-strings';
2
+ /**
3
+ * Nøkkelen til en statusmelding i comboboxen, eller tom streng når det ikke er
4
+ * noe å melde. Utvalgslogikken her returnerer nøkler i stedet for ferdig tekst,
5
+ * slik at Elements og React kan slå opp teksten i sin egen tekstkatalog.
6
+ */
7
+ export type TComboboxMessageKey = keyof TPktStrings['combobox'] | '';
@@ -1,3 +1,4 @@
1
+ import type { TComboboxMessageKey } from './messages';
1
2
  /**
2
3
  * Shared combobox option utility functions used by both Elements and React packages.
3
4
  * Only framework-agnostic functions belong here.
@@ -46,5 +47,5 @@ export declare const findTypeaheadMatches: (options: IPktComboboxOption[], searc
46
47
  */
47
48
  export declare const getSearchInfoMessage: (searchValue: string, selectedValues: string[], options: IPktComboboxOption[], allowUserInput: boolean) => {
48
49
  addValueText: string | null;
49
- userInfoMessage: string;
50
+ userInfoMessage: TComboboxMessageKey;
50
51
  };
@@ -1,3 +1,4 @@
1
+ import type { TComboboxMessageKey } from './messages';
1
2
  /**
2
3
  * Shared combobox selection management functions used by both Elements and React packages.
3
4
  * Only framework-agnostic functions belong here.
@@ -20,7 +21,7 @@ export interface IToggleSelectionResult {
20
21
  options: IPktComboboxOption[];
21
22
  shouldOptionsBeOpen: boolean;
22
23
  shouldResetInput: boolean;
23
- userInfoMessage: string;
24
+ userInfoMessage: TComboboxMessageKey;
24
25
  searchValue: string;
25
26
  newUserOption: IPktComboboxOption | null;
26
27
  }
@@ -47,7 +48,7 @@ export declare const deselectOption: (value: string | null, currentValues: strin
47
48
  export declare const selectAllOptions: (options: IPktComboboxOption[], maxlength: number | null) => {
48
49
  values: string[];
49
50
  options: IPktComboboxOption[];
50
- userInfoMessage: string;
51
+ userInfoMessage: TComboboxMessageKey;
51
52
  };
52
53
  /**
53
54
  * Clears all selections.
@@ -1,12 +1,12 @@
1
- const e=require("./element-BA8v6S7z.cjs"),t=require("./element-with-slot-Bj7nm7fO.cjs"),n=require("./if-defined-B89_ZeCj.cjs"),r=require("./consume-Le4HztPo.cjs"),i=require("./ref-CQoEIIp0.cjs");var a=r.r(Symbol(`pkt-tabs-context`)),o=class extends t.t{constructor(...e){super(...e),this.arrowNav=!0,this.disableArrowNav=!1,this.separatorIconName=``,this.separatorIconPath=``,this.tabRefs=[],this.disabledMap={},this.tabCount=0,this.context={useArrowNav:this.useArrowNav,registerTab:this.registerTab.bind(this),handleClick:this.handleClick.bind(this),handleKeyUp:this.handleKeyUp.bind(this)}}get useArrowNav(){return this.arrowNav&&!this.disableArrowNav}updated(e){(e.has(`arrowNav`)||e.has(`disableArrowNav`))&&(this.context={...this.context,useArrowNav:this.useArrowNav}),this.updateComplete.then(()=>this.syncSeparators())}syncSeparators(){let e=this.querySelector(`.pkt-tabs__list`);if(!e||(e.querySelectorAll(`.pkt-tabs__separator`).forEach(e=>e.remove()),!(this.separatorIconName||this.separatorIconPath)))return;let t=Array.from(e.children).filter(e=>!e.classList.contains(`pkt-tabs__separator`));for(let e=0;e<t.length-1;e++){let n=document.createElement(`span`);if(n.className=`pkt-tabs__separator`,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`role`,`presentation`),this.separatorIconPath){let e=document.createElement(`img`);e.setAttribute(`src`,this.separatorIconPath),e.setAttribute(`alt`,``),e.setAttribute(`aria-hidden`,`true`),n.appendChild(e)}else if(this.separatorIconName){let e=document.createElement(`pkt-icon`);e.setAttribute(`name`,this.separatorIconName),e.classList.add(`pkt-tabs__separator-icon`),n.appendChild(e)}t[e].after(n)}}registerTab(e,t,n=!1){this.tabRefs[t]=e,this.disabledMap[t]=n,this.tabCount=Math.max(this.tabCount,t+1)}isTabDisabled(e){return!!this.disabledMap[e]}findEnabledIndex(e,t){let n=e+t;for(;n>=0&&n<this.tabCount;){if(!this.isTabDisabled(n))return n;n+=t}return null}handleClick(e){this.isTabDisabled(e)||this.dispatchEvent(new CustomEvent(`tab-selected`,{detail:{index:e},bubbles:!0,composed:!0}))}handleKeyUp(e,t){if(this.useArrowNav){if(e.key===`ArrowLeft`){e.preventDefault();let n=this.findEnabledIndex(t,-1);n!==null&&this.tabRefs[n]?.focus()}if(e.key===`ArrowRight`){e.preventDefault();let n=this.findEnabledIndex(t,1);n!==null&&this.tabRefs[n]?.focus()}(e.key===`Enter`||e.key===` `||e.key===`Spacebar`||e.key===`ArrowDown`)&&(e.preventDefault(),this.handleClick(t))}}render(){let n=this.useArrowNav?`tablist`:`navigation`,r=this.separatorIconName||this.separatorIconPath?`pkt-tabs pkt-tabs--with-separator`:`pkt-tabs`;return e.p`
1
+ const e=require("./element-B8OGznK0.cjs"),t=require("./element-with-slot-DTxILHVv.cjs"),n=require("./if-defined-CVYApOgK.cjs"),r=require("./consume-Le4HztPo.cjs"),i=require("./ref-CHbJYtKE.cjs");var a=r.r(Symbol(`pkt-tabs-context`)),o=class extends t.t{constructor(...e){super(...e),this.arrowNav=!0,this.disableArrowNav=!1,this.separatorIconName=``,this.separatorIconPath=``,this.tabRefs=[],this.disabledMap={},this.tabCount=0,this.context={useArrowNav:this.useArrowNav,registerTab:this.registerTab.bind(this),handleClick:this.handleClick.bind(this),handleKeyUp:this.handleKeyUp.bind(this)}}get useArrowNav(){return this.arrowNav&&!this.disableArrowNav}updated(e){(e.has(`arrowNav`)||e.has(`disableArrowNav`))&&(this.context={...this.context,useArrowNav:this.useArrowNav}),this.updateComplete.then(()=>this.syncSeparators())}syncSeparators(){let e=this.querySelector(`.pkt-tabs__list`);if(!e||(e.querySelectorAll(`.pkt-tabs__separator`).forEach(e=>e.remove()),!(this.separatorIconName||this.separatorIconPath)))return;let t=Array.from(e.children).filter(e=>!e.classList.contains(`pkt-tabs__separator`));for(let e=0;e<t.length-1;e++){let n=document.createElement(`span`);if(n.className=`pkt-tabs__separator`,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`role`,`presentation`),this.separatorIconPath){let e=document.createElement(`img`);e.setAttribute(`src`,this.separatorIconPath),e.setAttribute(`alt`,``),e.setAttribute(`aria-hidden`,`true`),n.appendChild(e)}else if(this.separatorIconName){let e=document.createElement(`pkt-icon`);e.setAttribute(`name`,this.separatorIconName),e.classList.add(`pkt-tabs__separator-icon`),n.appendChild(e)}t[e].after(n)}}registerTab(e,t,n=!1){this.tabRefs[t]=e,this.disabledMap[t]=n,this.tabCount=Math.max(this.tabCount,t+1)}isTabDisabled(e){return!!this.disabledMap[e]}findEnabledIndex(e,t){let n=e+t;for(;n>=0&&n<this.tabCount;){if(!this.isTabDisabled(n))return n;n+=t}return null}handleClick(e){this.isTabDisabled(e)||this.dispatchEvent(new CustomEvent(`tab-selected`,{detail:{index:e},bubbles:!0,composed:!0}))}handleKeyUp(e,t){if(this.useArrowNav){if(e.key===`ArrowLeft`){e.preventDefault();let n=this.findEnabledIndex(t,-1);n!==null&&this.tabRefs[n]?.focus()}if(e.key===`ArrowRight`){e.preventDefault();let n=this.findEnabledIndex(t,1);n!==null&&this.tabRefs[n]?.focus()}(e.key===`Enter`||e.key===` `||e.key===`Spacebar`||e.key===`ArrowDown`)&&(e.preventDefault(),this.handleClick(t))}}render(){let n=this.useArrowNav?`tablist`:`navigation`,r=this.separatorIconName||this.separatorIconPath?`pkt-tabs pkt-tabs--with-separator`:`pkt-tabs`;return e._`
2
2
  <div class=${r}>
3
3
  <div class="pkt-tabs__list" role=${n}>${t.n(this)}</div>
4
4
  </div>
5
- `}};e.n([e.o({type:Boolean,reflect:!0,attribute:`arrow-nav`})],o.prototype,`arrowNav`,void 0),e.n([e.o({type:Boolean,reflect:!0,attribute:`disable-arrow-nav`})],o.prototype,`disableArrowNav`,void 0),e.n([e.o({type:String,reflect:!0,attribute:`separator-icon-name`})],o.prototype,`separatorIconName`,void 0),e.n([e.o({type:String,reflect:!0,attribute:`separator-icon-path`})],o.prototype,`separatorIconPath`,void 0),e.n([e.a()],o.prototype,`tabRefs`,void 0),e.n([e.a()],o.prototype,`disabledMap`,void 0),e.n([e.a()],o.prototype,`tabCount`,void 0),e.n([r.n({context:a}),e.a()],o.prototype,`context`,void 0);try{e.s(`pkt-tabs`)(o)}catch{console.warn(`Forsøker å definere <pkt-tabs>, men den er allerede definert`)}var s=class extends t.t{constructor(){super(),this.active=!1,this.disabled=!1,this.href=``,this.icon=``,this.controls=``,this.tag=``,this.tagSkin=`blue`,this.index=0,this.elementRef=i.t()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)})}updated(){this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)}handleClick(e){if(this.disabled){e.preventDefault(),e.stopPropagation();return}this.context&&this.context.handleClick(this.index)}handleKeyDown(e){if(this.disabled&&(e.key===`Enter`||e.key===` `||e.key===`Spacebar`)){e.preventDefault(),e.stopPropagation();return}this.context&&this.context.handleKeyUp(e,this.index)}render(){let r=this.context?.useArrowNav??!0,a=this.active&&!this.disabled,o=[a?`active`:``,this.disabled?`pkt-tabs__item--disabled`:``].filter(Boolean).join(` `),s=r?`tab`:void 0,c=r?a:void 0,l=this.disabled?-1:a||!r?void 0:-1,u=`pkt-icon--small ${this.icon===`check`?`pkt-tabs__status-icon`:``}`,d=e.p`
6
- ${this.icon?e.p`<pkt-icon name=${this.icon} class=${u}></pkt-icon>`:``}
5
+ `}};e.n([e.u({type:Boolean,reflect:!0,attribute:`arrow-nav`})],o.prototype,`arrowNav`,void 0),e.n([e.u({type:Boolean,reflect:!0,attribute:`disable-arrow-nav`})],o.prototype,`disableArrowNav`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`separator-icon-name`})],o.prototype,`separatorIconName`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`separator-icon-path`})],o.prototype,`separatorIconPath`,void 0),e.n([e.l()],o.prototype,`tabRefs`,void 0),e.n([e.l()],o.prototype,`disabledMap`,void 0),e.n([e.l()],o.prototype,`tabCount`,void 0),e.n([r.n({context:a}),e.l()],o.prototype,`context`,void 0);try{e.d(`pkt-tabs`)(o)}catch{console.warn(`Forsøker å definere <pkt-tabs>, men den er allerede definert`)}var s=class extends t.t{constructor(){super(),this.active=!1,this.disabled=!1,this.href=``,this.icon=``,this.controls=``,this.tag=``,this.tagSkin=`blue`,this.index=0,this.elementRef=i.t()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)})}updated(){this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)}handleClick(e){if(this.disabled){e.preventDefault(),e.stopPropagation();return}this.context&&this.context.handleClick(this.index)}handleKeyDown(e){if(this.disabled&&(e.key===`Enter`||e.key===` `||e.key===`Spacebar`)){e.preventDefault(),e.stopPropagation();return}this.context&&this.context.handleKeyUp(e,this.index)}render(){let r=this.context?.useArrowNav??!0,a=this.active&&!this.disabled,o=[a?`active`:``,this.disabled?`pkt-tabs__item--disabled`:``].filter(Boolean).join(` `),s=r?`tab`:void 0,c=r?a:void 0,l=this.disabled?-1:a||!r?void 0:-1,u=`pkt-icon--small ${this.icon===`check`?`pkt-tabs__status-icon`:``}`,d=e._`
6
+ ${this.icon?e._`<pkt-icon name=${this.icon} class=${u}></pkt-icon>`:``}
7
7
  <span>${t.n(this)}</span>
8
- ${this.tag?e.p`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>`:``}
9
- `;return this.href?e.p`
8
+ ${this.tag?e._`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>`:``}
9
+ `;return this.href?e._`
10
10
  <a
11
11
  ${i.n(this.elementRef)}
12
12
  href=${n.t(this.disabled?void 0:this.href)}
@@ -21,7 +21,7 @@ const e=require("./element-BA8v6S7z.cjs"),t=require("./element-with-slot-Bj7nm7f
21
21
  >
22
22
  ${d}
23
23
  </a>
24
- `:e.p`
24
+ `:e._`
25
25
  <button
26
26
  ${i.n(this.elementRef)}
27
27
  type="button"
@@ -37,4 +37,4 @@ const e=require("./element-BA8v6S7z.cjs"),t=require("./element-with-slot-Bj7nm7f
37
37
  >
38
38
  ${d}
39
39
  </button>
40
- `}};e.n([e.o({type:Boolean,reflect:!0})],s.prototype,`active`,void 0),e.n([e.o({type:Boolean,reflect:!0})],s.prototype,`disabled`,void 0),e.n([e.o({type:String,reflect:!0})],s.prototype,`href`,void 0),e.n([e.o({type:String,reflect:!0})],s.prototype,`icon`,void 0),e.n([e.o({type:String,reflect:!0})],s.prototype,`controls`,void 0),e.n([e.o({type:String,reflect:!0})],s.prototype,`tag`,void 0),e.n([e.o({type:String,reflect:!0,attribute:`tag-skin`})],s.prototype,`tagSkin`,void 0),e.n([e.o({type:Number,reflect:!0})],s.prototype,`index`,void 0),e.n([r.t({context:a,subscribe:!0}),e.o({attribute:!1})],s.prototype,`context`,void 0);try{e.s(`pkt-tab-item`)(s)}catch{console.warn(`Forsøker å definere <pkt-tab-item>, men den er allerede definert`)}var c=o;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
40
+ `}};e.n([e.u({type:Boolean,reflect:!0})],s.prototype,`active`,void 0),e.n([e.u({type:Boolean,reflect:!0})],s.prototype,`disabled`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`href`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`icon`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`controls`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`tag`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`tag-skin`})],s.prototype,`tagSkin`,void 0),e.n([e.u({type:Number,reflect:!0})],s.prototype,`index`,void 0),e.n([r.t({context:a,subscribe:!0}),e.u({attribute:!1})],s.prototype,`context`,void 0);try{e.d(`pkt-tab-item`)(s)}catch{console.warn(`Forsøker å definere <pkt-tab-item>, men den er allerede definert`)}var c=o;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
@@ -1,8 +1,8 @@
1
- import { a as e, n as t, o as n, p as r, s as i } from "./element-ChsFgr_B.js";
2
- import { n as a, t as o } from "./element-with-slot-BvG9ctC-.js";
3
- import { t as s } from "./if-defined-CGzIlZ9-.js";
1
+ import { _ as e, d as t, l as n, n as r, u as i } from "./element-BKSPVgs2.js";
2
+ import { n as a, t as o } from "./element-with-slot-YUAUFRqw.js";
3
+ import { t as s } from "./if-defined-BF8XcDi5.js";
4
4
  import { n as c, r as l, t as u } from "./consume-BDnMAp2g.js";
5
- import { n as d, t as f } from "./ref-CWD6PjVd.js";
5
+ import { n as d, t as f } from "./ref-Chc_DZAb.js";
6
6
  //#region src/components/tabs/tabs-context.ts
7
7
  var p = l(Symbol("pkt-tabs-context")), m = class extends o {
8
8
  constructor(...e) {
@@ -75,33 +75,33 @@ var p = l(Symbol("pkt-tabs-context")), m = class extends o {
75
75
  }
76
76
  }
77
77
  render() {
78
- let e = this.useArrowNav ? "tablist" : "navigation", t = this.separatorIconName || this.separatorIconPath ? "pkt-tabs pkt-tabs--with-separator" : "pkt-tabs";
79
- return r`
80
- <div class=${t}>
81
- <div class="pkt-tabs__list" role=${e}>${a(this)}</div>
78
+ let t = this.useArrowNav ? "tablist" : "navigation", n = this.separatorIconName || this.separatorIconPath ? "pkt-tabs pkt-tabs--with-separator" : "pkt-tabs";
79
+ return e`
80
+ <div class=${n}>
81
+ <div class="pkt-tabs__list" role=${t}>${a(this)}</div>
82
82
  </div>
83
83
  `;
84
84
  }
85
85
  };
86
- t([n({
86
+ r([i({
87
87
  type: Boolean,
88
88
  reflect: !0,
89
89
  attribute: "arrow-nav"
90
- })], m.prototype, "arrowNav", void 0), t([n({
90
+ })], m.prototype, "arrowNav", void 0), r([i({
91
91
  type: Boolean,
92
92
  reflect: !0,
93
93
  attribute: "disable-arrow-nav"
94
- })], m.prototype, "disableArrowNav", void 0), t([n({
94
+ })], m.prototype, "disableArrowNav", void 0), r([i({
95
95
  type: String,
96
96
  reflect: !0,
97
97
  attribute: "separator-icon-name"
98
- })], m.prototype, "separatorIconName", void 0), t([n({
98
+ })], m.prototype, "separatorIconName", void 0), r([i({
99
99
  type: String,
100
100
  reflect: !0,
101
101
  attribute: "separator-icon-path"
102
- })], m.prototype, "separatorIconPath", void 0), t([e()], m.prototype, "tabRefs", void 0), t([e()], m.prototype, "disabledMap", void 0), t([e()], m.prototype, "tabCount", void 0), t([c({ context: p }), e()], m.prototype, "context", void 0);
102
+ })], m.prototype, "separatorIconPath", void 0), r([n()], m.prototype, "tabRefs", void 0), r([n()], m.prototype, "disabledMap", void 0), r([n()], m.prototype, "tabCount", void 0), r([c({ context: p }), n()], m.prototype, "context", void 0);
103
103
  try {
104
- i("pkt-tabs")(m);
104
+ t("pkt-tabs")(m);
105
105
  } catch {
106
106
  console.warn("Forsøker å definere <pkt-tabs>, men den er allerede definert");
107
107
  }
@@ -134,16 +134,16 @@ var h = class extends o {
134
134
  this.context && this.context.handleKeyUp(e, this.index);
135
135
  }
136
136
  render() {
137
- let e = this.context?.useArrowNav ?? !0, t = this.active && !this.disabled, n = [t ? "active" : "", this.disabled ? "pkt-tabs__item--disabled" : ""].filter(Boolean).join(" "), i = e ? "tab" : void 0, o = e ? t : void 0, c = this.disabled ? -1 : t || !e ? void 0 : -1, l = `pkt-icon--small ${this.icon === "check" ? "pkt-tabs__status-icon" : ""}`, u = r`
138
- ${this.icon ? r`<pkt-icon name=${this.icon} class=${l}></pkt-icon>` : ""}
137
+ let t = this.context?.useArrowNav ?? !0, n = this.active && !this.disabled, r = [n ? "active" : "", this.disabled ? "pkt-tabs__item--disabled" : ""].filter(Boolean).join(" "), i = t ? "tab" : void 0, o = t ? n : void 0, c = this.disabled ? -1 : n || !t ? void 0 : -1, l = `pkt-icon--small ${this.icon === "check" ? "pkt-tabs__status-icon" : ""}`, u = e`
138
+ ${this.icon ? e`<pkt-icon name=${this.icon} class=${l}></pkt-icon>` : ""}
139
139
  <span>${a(this)}</span>
140
- ${this.tag ? r`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>` : ""}
140
+ ${this.tag ? e`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>` : ""}
141
141
  `;
142
- return this.href ? r`
142
+ return this.href ? e`
143
143
  <a
144
144
  ${d(this.elementRef)}
145
145
  href=${s(this.disabled ? void 0 : this.href)}
146
- class="pkt-tabs__link ${n}"
146
+ class="pkt-tabs__link ${r}"
147
147
  role=${s(i)}
148
148
  aria-selected=${s(o)}
149
149
  aria-disabled=${s(this.disabled ? "true" : void 0)}
@@ -154,11 +154,11 @@ var h = class extends o {
154
154
  >
155
155
  ${u}
156
156
  </a>
157
- ` : r`
157
+ ` : e`
158
158
  <button
159
159
  ${d(this.elementRef)}
160
160
  type="button"
161
- class="pkt-tabs__button pkt-link-button ${n}"
161
+ class="pkt-tabs__button pkt-link-button ${r}"
162
162
  ?disabled=${this.disabled}
163
163
  aria-disabled=${s(this.disabled ? "true" : void 0)}
164
164
  role=${s(i)}
@@ -173,37 +173,37 @@ var h = class extends o {
173
173
  `;
174
174
  }
175
175
  };
176
- t([n({
176
+ r([i({
177
177
  type: Boolean,
178
178
  reflect: !0
179
- })], h.prototype, "active", void 0), t([n({
179
+ })], h.prototype, "active", void 0), r([i({
180
180
  type: Boolean,
181
181
  reflect: !0
182
- })], h.prototype, "disabled", void 0), t([n({
182
+ })], h.prototype, "disabled", void 0), r([i({
183
183
  type: String,
184
184
  reflect: !0
185
- })], h.prototype, "href", void 0), t([n({
185
+ })], h.prototype, "href", void 0), r([i({
186
186
  type: String,
187
187
  reflect: !0
188
- })], h.prototype, "icon", void 0), t([n({
188
+ })], h.prototype, "icon", void 0), r([i({
189
189
  type: String,
190
190
  reflect: !0
191
- })], h.prototype, "controls", void 0), t([n({
191
+ })], h.prototype, "controls", void 0), r([i({
192
192
  type: String,
193
193
  reflect: !0
194
- })], h.prototype, "tag", void 0), t([n({
194
+ })], h.prototype, "tag", void 0), r([i({
195
195
  type: String,
196
196
  reflect: !0,
197
197
  attribute: "tag-skin"
198
- })], h.prototype, "tagSkin", void 0), t([n({
198
+ })], h.prototype, "tagSkin", void 0), r([i({
199
199
  type: Number,
200
200
  reflect: !0
201
- })], h.prototype, "index", void 0), t([u({
201
+ })], h.prototype, "index", void 0), r([u({
202
202
  context: p,
203
203
  subscribe: !0
204
- }), n({ attribute: !1 })], h.prototype, "context", void 0);
204
+ }), i({ attribute: !1 })], h.prototype, "context", void 0);
205
205
  try {
206
- i("pkt-tab-item")(h);
206
+ t("pkt-tab-item")(h);
207
207
  } catch {
208
208
  console.warn("Forsøker å definere <pkt-tab-item>, men den er allerede definert");
209
209
  }
@@ -0,0 +1,27 @@
1
+ const e=require("./element-B8OGznK0.cjs"),t=require("./class-map-CzCE5pqG.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-DTxILHVv.cjs");require("./icon-BmMC09mi.cjs");const i=require("./if-defined-CVYApOgK.cjs");var a={name:`pkt-tag`,react:`PktTag`,"css-class":`pkt-tag`,isElement:!0,"dark-mode":!0,props:{size:{name:`Størrelse`,description:`Størrelsen på taggen`,required:!1,default:`medium`,type:[`small`,`medium`,`large`],category:`ui`},iconName:{name:`Ikon`,description:`Navnet på ikonet som skal vises i taggen`,type:`icon`,required:!1,category:`ui`},skin:{name:`Utseende`,description:`Utseendet til taggen`,required:!1,default:`blue`,type:[`blue`,`blue-light`,`blue-dark`,`green`,`red`,`beige`,`yellow`,`gray`],category:`ui`},closeTag:{name:`Lukk tag`,description:`Skal taggen ha en lukkeknapp?`,type:`boolean`,required:!1,default:!1,category:`ui`},textStyle:{name:`Tekststil`,description:`Stilen på teksten i taggen`,required:!1,default:`normal-text`,type:[`thin-text`,`normal-text`],category:`ui`},type:{name:`Type, dersom lukkeknapp`,description:`Type tag, brukes for å spesifisere om det er en knapp, submit eller reset`,required:!1,default:`button`,type:[`button`,`submit`,`reset`],category:`tech`},ariaLabel:{name:`aria-label`,description:`aria-label for taggen, brukes for tilgjengelighet`,type:`string`,required:!1,category:`accessibility`}},slots:{default:{description:`Teksten til tag`}}},o=class extends r.t{constructor(){super(),this.closeTag=a.props.closeTag.default,this.size=a.props.size.default,this.skin=a.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=a.props.type.default,this.ariaLabel=null,this.buttonTabindex=void 0,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent(`close`,{detail:{origin:e},bubbles:!1,composed:!0})),this.dispatchEvent(new CustomEvent(`on-close`,{detail:{origin:e},bubbles:!1,composed:!0}))},this._isClosed=!1}firstUpdated(e){if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){let e=this.querySelector(`button span, .pkt-tag > span`)?.textContent?.trim();e&&(this._ariaDescription=n.t(this.pktStrings.get(`tag`).remove,{label:e}))}}render(){let n={"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-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-hide":this._isClosed};return this.closeTag?e._`
2
+ <button
3
+ class=${t.t(a)}
4
+ type=${this.type}
5
+ tabindex=${i.t(this.buttonTabindex)}
6
+ @click=${this.close}
7
+ aria-label=${i.t(this.ariaLabel||void 0)}
8
+ aria-description=${i.t(this._ariaDescription||void 0)}
9
+ >
10
+ ${this.iconName&&e._`<pkt-icon
11
+ class="pkt-tag__icon"
12
+ name=${this.iconName}
13
+ aria-hidden="true"
14
+ ></pkt-icon>`}
15
+ <span>${r.n(this)}</span>
16
+ <pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
17
+ </button>
18
+ `:e._`
19
+ <span class=${t.t(n)}>
20
+ ${this.iconName&&e._`<pkt-icon
21
+ class="pkt-tag__icon"
22
+ name=${this.iconName}
23
+ aria-hidden="true"
24
+ ></pkt-icon>`}
25
+ <span>${r.n(this)}</span>
26
+ </span>
27
+ `}};e.n([e.u({type:Boolean,reflect:!0})],o.prototype,`closeTag`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`size`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`skin`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`textStyle`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`iconName`,void 0),e.n([e.u({type:String})],o.prototype,`type`,void 0),e.n([e.u({type:String})],o.prototype,`ariaLabel`,void 0),e.n([e.u({type:Number,attribute:`button-tabindex`})],o.prototype,`buttonTabindex`,void 0),e.n([e.l()],o.prototype,`_isClosed`,void 0),e.n([e.l()],o.prototype,`_ariaDescription`,void 0);try{e.d(`pkt-tag`)(o)}catch{console.warn(`Forsøker å definere <pkt-tag>, men den er allerede definert`)}var s=o;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
@@ -1,9 +1,10 @@
1
- import { a as e, n as t, o as n, p as r, s as i } from "./element-ChsFgr_B.js";
2
- import { t as a } from "./class-map-CnWCnBSX.js";
3
- import { n as o, t as s } from "./element-with-slot-BvG9ctC-.js";
4
- import "./icon-D-LA22xD.js";
5
- import { t as c } from "./if-defined-CGzIlZ9-.js";
6
- var l = {
1
+ import { _ as e, d as t, l as n, n as r, u as i } from "./element-BKSPVgs2.js";
2
+ import { t as a } from "./class-map-F1DJHyb7.js";
3
+ import { t as o } from "./format-BTeSVkED.js";
4
+ import { n as s, t as c } from "./element-with-slot-YUAUFRqw.js";
5
+ import "./icon-HYU1f54x.js";
6
+ import { t as l } from "./if-defined-BF8XcDi5.js";
7
+ var u = {
7
8
  name: "pkt-tag",
8
9
  react: "PktTag",
9
10
  "css-class": "pkt-tag",
@@ -83,9 +84,9 @@ var l = {
83
84
  }
84
85
  },
85
86
  slots: { default: { description: "Teksten til tag" } }
86
- }, u = class extends s {
87
+ }, d = class extends c {
87
88
  constructor() {
88
- super(), 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.buttonTabindex = void 0, this._isClosed = !1, this._ariaDescription = null, this.close = (e) => {
89
+ super(), this.closeTag = u.props.closeTag.default, this.size = u.props.size.default, this.skin = u.props.skin.default, this.textStyle = null, this.iconName = void 0, this.type = u.props.type.default, this.ariaLabel = null, this.buttonTabindex = void 0, this._isClosed = !1, this._ariaDescription = null, this.close = (e) => {
89
90
  this._isClosed = !0, this.dispatchEvent(new CustomEvent("close", {
90
91
  detail: { origin: e },
91
92
  bubbles: !1,
@@ -100,77 +101,77 @@ var l = {
100
101
  firstUpdated(e) {
101
102
  if (super.firstUpdated(e), this.closeTag && !this.ariaLabel) {
102
103
  let e = this.querySelector("button span, .pkt-tag > span")?.textContent?.trim();
103
- e && (this._ariaDescription = `Klikk for å fjerne ${e}`);
104
+ e && (this._ariaDescription = o(this.pktStrings.get("tag").remove, { label: e }));
104
105
  }
105
106
  }
106
107
  render() {
107
- let e = {
108
+ let t = {
108
109
  "pkt-tag": !0,
109
110
  [`pkt-tag--${this.size}`]: !!this.size,
110
111
  [`pkt-tag--${this.skin}`]: !!this.skin,
111
112
  [`pkt-tag--${this.textStyle}`]: !!this.textStyle
112
- }, t = {
113
+ }, n = {
113
114
  "pkt-tag": !0,
114
115
  [`pkt-tag--${this.textStyle}`]: !!this.textStyle,
115
116
  [`pkt-tag--${this.size}`]: !!this.size,
116
117
  [`pkt-tag--${this.skin}`]: !!this.skin,
117
118
  "pkt-hide": this._isClosed
118
119
  };
119
- return this.closeTag ? r`
120
+ return this.closeTag ? e`
120
121
  <button
121
- class=${a(t)}
122
+ class=${a(n)}
122
123
  type=${this.type}
123
- tabindex=${c(this.buttonTabindex)}
124
+ tabindex=${l(this.buttonTabindex)}
124
125
  @click=${this.close}
125
- aria-label=${c(this.ariaLabel || void 0)}
126
- aria-description=${c(this._ariaDescription || void 0)}
126
+ aria-label=${l(this.ariaLabel || void 0)}
127
+ aria-description=${l(this._ariaDescription || void 0)}
127
128
  >
128
- ${this.iconName && r`<pkt-icon
129
+ ${this.iconName && e`<pkt-icon
129
130
  class="pkt-tag__icon"
130
131
  name=${this.iconName}
131
132
  aria-hidden="true"
132
133
  ></pkt-icon>`}
133
- <span>${o(this)}</span>
134
+ <span>${s(this)}</span>
134
135
  <pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
135
136
  </button>
136
- ` : r`
137
- <span class=${a(e)}>
138
- ${this.iconName && r`<pkt-icon
137
+ ` : e`
138
+ <span class=${a(t)}>
139
+ ${this.iconName && e`<pkt-icon
139
140
  class="pkt-tag__icon"
140
141
  name=${this.iconName}
141
142
  aria-hidden="true"
142
143
  ></pkt-icon>`}
143
- <span>${o(this)}</span>
144
+ <span>${s(this)}</span>
144
145
  </span>
145
146
  `;
146
147
  }
147
148
  };
148
- t([n({
149
+ r([i({
149
150
  type: Boolean,
150
151
  reflect: !0
151
- })], u.prototype, "closeTag", void 0), t([n({
152
+ })], d.prototype, "closeTag", void 0), r([i({
152
153
  type: String,
153
154
  reflect: !0
154
- })], u.prototype, "size", void 0), t([n({
155
+ })], d.prototype, "size", void 0), r([i({
155
156
  type: String,
156
157
  reflect: !0
157
- })], u.prototype, "skin", void 0), t([n({
158
+ })], d.prototype, "skin", void 0), r([i({
158
159
  type: String,
159
160
  reflect: !0
160
- })], u.prototype, "textStyle", void 0), t([n({
161
+ })], d.prototype, "textStyle", void 0), r([i({
161
162
  type: String,
162
163
  reflect: !0
163
- })], u.prototype, "iconName", void 0), t([n({ type: String })], u.prototype, "type", void 0), t([n({ type: String })], u.prototype, "ariaLabel", void 0), t([n({
164
+ })], d.prototype, "iconName", void 0), r([i({ type: String })], d.prototype, "type", void 0), r([i({ type: String })], d.prototype, "ariaLabel", void 0), r([i({
164
165
  type: Number,
165
166
  attribute: "button-tabindex"
166
- })], u.prototype, "buttonTabindex", void 0), t([e()], u.prototype, "_isClosed", void 0), t([e()], u.prototype, "_ariaDescription", void 0);
167
+ })], d.prototype, "buttonTabindex", void 0), r([n()], d.prototype, "_isClosed", void 0), r([n()], d.prototype, "_ariaDescription", void 0);
167
168
  try {
168
- i("pkt-tag")(u);
169
+ t("pkt-tag")(d);
169
170
  } catch {
170
171
  console.warn("Forsøker å definere <pkt-tag>, men den er allerede definert");
171
172
  }
172
173
  //#endregion
173
174
  //#region src/components/tag/index.ts
174
- var d = u;
175
+ var f = d;
175
176
  //#endregion
176
- export { u as n, d as t };
177
+ export { d as n, f as t };
File without changes
@@ -1,29 +1,29 @@
1
- import { a as e, c as t, d as n, f as r, l as i, n as a, o, p as s, s as c, u as l } from "./element-ChsFgr_B.js";
2
- import { t as u } from "./class-map-CnWCnBSX.js";
3
- import { i as d, r as f } from "./directive-helpers-CI8YZqku.js";
4
- import { n as p } from "./element-with-slot-BvG9ctC-.js";
5
- import "./icon-D-LA22xD.js";
6
- import { t as m } from "./if-defined-CGzIlZ9-.js";
7
- import { n as h, t as g } from "./ref-CWD6PjVd.js";
8
- import { t as _ } from "./input-element-DBMNBplu.js";
9
- import { r as v } from "./input-wrapper-BmxNvznr.js";
1
+ import { _ as e, d as t, f as n, g as r, h as i, l as a, m as o, n as s, p as c, u as l } from "./element-BKSPVgs2.js";
2
+ import { t as u } from "./class-map-F1DJHyb7.js";
3
+ import { i as d, r as f } from "./directive-helpers-BARw3nEZ.js";
4
+ import { n as p } from "./element-with-slot-YUAUFRqw.js";
5
+ import "./icon-HYU1f54x.js";
6
+ import { t as m } from "./if-defined-BF8XcDi5.js";
7
+ import { n as h, t as g } from "./ref-Chc_DZAb.js";
8
+ import { t as _ } from "./input-element-D07DmR34.js";
9
+ import { r as v } from "./input-wrapper-Cci_wTvD.js";
10
10
  //#region ../../node_modules/lit-html/directives/live.js
11
- var y = t(class extends i {
11
+ var y = n(class extends c {
12
12
  constructor(e) {
13
- if (super(e), e.type !== l.PROPERTY && e.type !== l.ATTRIBUTE && e.type !== l.BOOLEAN_ATTRIBUTE) throw Error("The `live` directive is not allowed on child or event bindings");
13
+ if (super(e), e.type !== o.PROPERTY && e.type !== o.ATTRIBUTE && e.type !== o.BOOLEAN_ATTRIBUTE) throw Error("The `live` directive is not allowed on child or event bindings");
14
14
  if (!d(e)) throw Error("`live` bindings can only contain a single expression");
15
15
  }
16
16
  render(e) {
17
17
  return e;
18
18
  }
19
19
  update(e, [t]) {
20
- if (t === r || t === n) return t;
21
- let i = e.element, a = e.name;
22
- if (e.type === l.PROPERTY) {
23
- if (t === i[a]) return r;
24
- } else if (e.type === l.BOOLEAN_ATTRIBUTE) {
25
- if (!!t === i.hasAttribute(a)) return r;
26
- } else if (e.type === l.ATTRIBUTE && i.getAttribute(a) === t + "") return r;
20
+ if (t === r || t === i) return t;
21
+ let n = e.element, a = e.name;
22
+ if (e.type === o.PROPERTY) {
23
+ if (t === n[a]) return r;
24
+ } else if (e.type === o.BOOLEAN_ATTRIBUTE) {
25
+ if (!!t === n.hasAttribute(a)) return r;
26
+ } else if (e.type === o.ATTRIBUTE && n.getAttribute(a) === t + "") return r;
27
27
  return f(e), t;
28
28
  }
29
29
  }), b = class extends _ {
@@ -37,15 +37,16 @@ var y = t(class extends i {
37
37
  super.updated(e), this.classList.add("pkt-textinput", "pkt-textarea"), e.has("value") && (this.counterCurrent = this.value?.length || 0, this.valueChanged(this.value, e.get("value"))), e.has("id") && !this.name && this.id && (this.name = this.id);
38
38
  }
39
39
  render() {
40
- let e = this.effectiveCounter(this.counterMaxLength > 0), t = u({
40
+ let t = this.effectiveCounter(this.counterMaxLength > 0), n = u({
41
41
  "pkt-input": !0,
42
42
  [`pkt-input--${this.inputSize}`]: !0,
43
43
  "pkt-input--fullwidth": this.fullwidth,
44
- "pkt-input--counter-error": e && this.counterMaxLength > 0 && this.value.length > this.counterMaxLength
45
- }), n = this.ariaLabelledby || `${this.id}-input-label`;
46
- return s`<pkt-input-wrapper
44
+ "pkt-input--counter-error": t && this.counterMaxLength > 0 && this.value.length > this.counterMaxLength
45
+ }), r = this.ariaLabelledby || `${this.id}-input-label`;
46
+ return e`<pkt-input-wrapper
47
+ .strings=${this.strings}
47
48
  label=${this.label}
48
- ?counter=${e}
49
+ ?counter=${t}
49
50
  ?hasFieldset=${this.effectiveHasFieldset(!1)}
50
51
  ?disabled=${this.disabled}
51
52
  ?hasError=${this.hasError}
@@ -70,7 +71,7 @@ var y = t(class extends i {
70
71
  <div class="pkt-contents" slot="helptext">${p(this, "helptext")}</div>
71
72
  <textarea
72
73
  ${h(this.inputRef)}
73
- class=${t}
74
+ class=${n}
74
75
  id=${this.id + "-input"}
75
76
  name=${(this.name || this.id) + "-input"}
76
77
  placeholder=${m(this.placeholder)}
@@ -79,13 +80,13 @@ var y = t(class extends i {
79
80
  maxlength=${m(this.maxlength)}
80
81
  ?readonly=${this.readonly}
81
82
  autocomplete=${this.autocomplete}
82
- aria-labelledby=${n}
83
+ aria-labelledby=${r}
83
84
  aria-invalid=${this.hasError}
84
85
  aria-errormessage=${m(this.hasError ? `${this.id}-input-error` : void 0)}
85
86
  aria-describedby=${m(v({
86
87
  id: this.id + "-input",
87
88
  hasHelptext: !!this.helptext,
88
- hasCounter: e,
89
+ hasCounter: t,
89
90
  ariaDescribedby: this.ariaDescribedby
90
91
  }))}
91
92
  rows=${m(this.rows ?? void 0)}
@@ -107,12 +108,12 @@ var y = t(class extends i {
107
108
  </pkt-input-wrapper>`;
108
109
  }
109
110
  };
110
- a([o({
111
+ s([l({
111
112
  type: String,
112
113
  reflect: !0
113
- })], b.prototype, "value", void 0), a([o({ type: String })], b.prototype, "autocomplete", void 0), a([o({ type: Number })], b.prototype, "rows", void 0), a([o({ type: Number })], b.prototype, "cols", void 0), a([e()], b.prototype, "counterCurrent", void 0);
114
+ })], b.prototype, "value", void 0), s([l({ type: String })], b.prototype, "autocomplete", void 0), s([l({ type: Number })], b.prototype, "rows", void 0), s([l({ type: Number })], b.prototype, "cols", void 0), s([a()], b.prototype, "counterCurrent", void 0);
114
115
  try {
115
- c("pkt-textarea")(b);
116
+ t("pkt-textarea")(b);
116
117
  } catch {
117
118
  console.warn("Forsøker å definere <pkt-textarea>, men den er allerede definert");
118
119
  }
@@ -1,4 +1,5 @@
1
- const e=require("./element-BA8v6S7z.cjs"),t=require("./class-map-BeimMvPv.cjs"),n=require("./directive-helpers-BlAV5EQD.cjs"),r=require("./element-with-slot-Bj7nm7fO.cjs");require("./icon-9iwd2F2l.cjs");const i=require("./if-defined-B89_ZeCj.cjs"),a=require("./ref-CQoEIIp0.cjs"),o=require("./input-element-DYmQw-fH.cjs"),s=require("./input-wrapper-Q-B-aBeb.cjs");var c=e.c(class extends e.l{constructor(t){if(super(t),t.type!==e.u.PROPERTY&&t.type!==e.u.ATTRIBUTE&&t.type!==e.u.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!n.i(t))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(t,[r]){if(r===e.f||r===e.d)return r;let i=t.element,a=t.name;if(t.type===e.u.PROPERTY){if(r===i[a])return e.f}else if(t.type===e.u.BOOLEAN_ATTRIBUTE){if(!!r===i.hasAttribute(a))return e.f}else if(t.type===e.u.ATTRIBUTE&&i.getAttribute(a)===r+``)return e.f;return n.r(t),r}}),l=class extends o.t{constructor(...e){super(...e),this.inputRef=a.t(),this.value=``,this.autocomplete=`off`,this.rows=null,this.cols=null,this.counterCurrent=0}attributeChangedCallback(e,t,n){e===`value`&&this.value!==t&&(this.counterCurrent=n?n.length:0),super.attributeChangedCallback(e,t,n)}updated(e){super.updated(e),this.classList.add(`pkt-textinput`,`pkt-textarea`),e.has(`value`)&&(this.counterCurrent=this.value?.length||0,this.valueChanged(this.value,e.get(`value`))),e.has(`id`)&&!this.name&&this.id&&(this.name=this.id)}render(){let n=this.effectiveCounter(this.counterMaxLength>0),o=t.t({"pkt-input":!0,[`pkt-input--${this.inputSize}`]:!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":n&&this.counterMaxLength>0&&this.value.length>this.counterMaxLength}),l=this.ariaLabelledby||`${this.id}-input-label`;return e.p`<pkt-input-wrapper
1
+ const e=require("./element-B8OGznK0.cjs"),t=require("./class-map-CzCE5pqG.cjs"),n=require("./directive-helpers-D6AAMFKs.cjs"),r=require("./element-with-slot-DTxILHVv.cjs");require("./icon-BmMC09mi.cjs");const i=require("./if-defined-CVYApOgK.cjs"),a=require("./ref-CHbJYtKE.cjs"),o=require("./input-element-DumGj_oJ.cjs"),s=require("./input-wrapper-DDfapoRX.cjs");var c=e.f(class extends e.p{constructor(t){if(super(t),t.type!==e.m.PROPERTY&&t.type!==e.m.ATTRIBUTE&&t.type!==e.m.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!n.i(t))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(t,[r]){if(r===e.g||r===e.h)return r;let i=t.element,a=t.name;if(t.type===e.m.PROPERTY){if(r===i[a])return e.g}else if(t.type===e.m.BOOLEAN_ATTRIBUTE){if(!!r===i.hasAttribute(a))return e.g}else if(t.type===e.m.ATTRIBUTE&&i.getAttribute(a)===r+``)return e.g;return n.r(t),r}}),l=class extends o.t{constructor(...e){super(...e),this.inputRef=a.t(),this.value=``,this.autocomplete=`off`,this.rows=null,this.cols=null,this.counterCurrent=0}attributeChangedCallback(e,t,n){e===`value`&&this.value!==t&&(this.counterCurrent=n?n.length:0),super.attributeChangedCallback(e,t,n)}updated(e){super.updated(e),this.classList.add(`pkt-textinput`,`pkt-textarea`),e.has(`value`)&&(this.counterCurrent=this.value?.length||0,this.valueChanged(this.value,e.get(`value`))),e.has(`id`)&&!this.name&&this.id&&(this.name=this.id)}render(){let n=this.effectiveCounter(this.counterMaxLength>0),o=t.t({"pkt-input":!0,[`pkt-input--${this.inputSize}`]:!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":n&&this.counterMaxLength>0&&this.value.length>this.counterMaxLength}),l=this.ariaLabelledby||`${this.id}-input-label`;return e._`<pkt-input-wrapper
2
+ .strings=${this.strings}
2
3
  label=${this.label}
3
4
  ?counter=${n}
4
5
  ?hasFieldset=${this.effectiveHasFieldset(!1)}
@@ -46,4 +47,4 @@ const e=require("./element-BA8v6S7z.cjs"),t=require("./class-map-BeimMvPv.cjs"),
46
47
  @focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
47
48
  @blur=${e=>{this.value=e.target.value,this.onBlur(),e.stopImmediatePropagation()}}
48
49
  ></textarea>
49
- </pkt-input-wrapper>`}};e.n([e.o({type:String,reflect:!0})],l.prototype,`value`,void 0),e.n([e.o({type:String})],l.prototype,`autocomplete`,void 0),e.n([e.o({type:Number})],l.prototype,`rows`,void 0),e.n([e.o({type:Number})],l.prototype,`cols`,void 0),e.n([e.a()],l.prototype,`counterCurrent`,void 0);try{e.s(`pkt-textarea`)(l)}catch{console.warn(`Forsøker å definere <pkt-textarea>, men den er allerede definert`)}var u=l;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
50
+ </pkt-input-wrapper>`}};e.n([e.u({type:String,reflect:!0})],l.prototype,`value`,void 0),e.n([e.u({type:String})],l.prototype,`autocomplete`,void 0),e.n([e.u({type:Number})],l.prototype,`rows`,void 0),e.n([e.u({type:Number})],l.prototype,`cols`,void 0),e.n([e.l()],l.prototype,`counterCurrent`,void 0);try{e.d(`pkt-textarea`)(l)}catch{console.warn(`Forsøker å definere <pkt-textarea>, men den er allerede definert`)}var u=l;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});