@oslokommune/punkt-elements 16.7.1 → 16.7.4

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 (286) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/accordion-BB1JrONI.cjs +34 -0
  3. package/dist/accordion-nNH87Y60.js +130 -0
  4. package/dist/alert-BEEnTiCb.cjs +33 -0
  5. package/dist/alert-ePJuDtmm.js +171 -0
  6. package/dist/async-directive-B9P1Qa0k.cjs +1 -0
  7. package/dist/async-directive-CaQiqjyV.js +55 -0
  8. package/dist/backlink-Ba03LlbB.cjs +13 -0
  9. package/dist/backlink-CiwXrQYD.js +38 -0
  10. package/dist/booleanish-BmcOU-43.js +11 -0
  11. package/dist/booleanish-jJLlnr6-.cjs +1 -0
  12. package/dist/breadcrumbs-CD1zib3s.cjs +43 -0
  13. package/dist/breadcrumbs-CpuVqWhF.js +76 -0
  14. package/dist/button-BIpd1xJh.js +95 -0
  15. package/dist/button-D-TOBaJB.cjs +27 -0
  16. package/dist/calendar-BzEtOJla.js +2031 -0
  17. package/dist/calendar-E5jJLt8D.cjs +90 -0
  18. package/dist/card-BYJu1MYm.js +339 -0
  19. package/dist/card-CUFhMVim.cjs +87 -0
  20. package/dist/checkbox-BARDb9iV.cjs +31 -0
  21. package/dist/checkbox-Cspxcvt_.js +111 -0
  22. package/dist/class-map-C8HuhNzZ.js +27 -0
  23. package/dist/class-map-CJ-msbHs.cjs +1 -0
  24. package/dist/classutils-DEL164Ur.js +7 -0
  25. package/dist/classutils-z8YsPlOf.cjs +1 -0
  26. package/dist/combobox-BcdLZRDU.js +984 -0
  27. package/dist/combobox-CGbFTWq_.cjs +135 -0
  28. package/dist/consent-DeB_5sWH.js +197 -0
  29. package/dist/consent-hwu7pp3S.cjs +11 -0
  30. package/dist/datepicker-DpmlsnH_.cjs +273 -0
  31. package/dist/datepicker-OVd8pmnZ.js +1125 -0
  32. package/dist/dialog-polyfill.esm-1hPr0gl9.js +280 -0
  33. package/dist/dialog-polyfill.esm-D3Oinvk0.cjs +1 -0
  34. package/dist/directive-3THFsVew.js +28 -0
  35. package/dist/directive-CJ2giQBZ.cjs +1 -0
  36. package/dist/directive-helpers-D1QSxY17.cjs +1 -0
  37. package/dist/directive-helpers-Dkv2gKgs.js +25 -0
  38. package/dist/element-DjtxO-1r.cjs +2 -0
  39. package/dist/element-cZ85T_aa.js +693 -0
  40. package/dist/element-with-slot-4J2o3SeU.js +166 -0
  41. package/dist/element-with-slot-CWoTGA1B.cjs +1 -0
  42. package/dist/header-DWgPgGfS.cjs +304 -0
  43. package/dist/header-a6ztVNp3.js +782 -0
  44. package/dist/heading-BgSWIRii.cjs +1 -0
  45. package/dist/heading-DiQLPxdf.js +73 -0
  46. package/dist/helptext-CCBKKLus.js +65 -0
  47. package/dist/helptext-D-3QfZv5.cjs +24 -0
  48. package/dist/icon-Co72KtgF.js +86 -0
  49. package/dist/icon-Dr8sfT2X.cjs +1 -0
  50. package/dist/if-defined-Cjj8qN-Z.js +5 -0
  51. package/dist/if-defined-XKOD_t_V.cjs +1 -0
  52. package/dist/index.d.ts +1 -2
  53. package/dist/input-element-B1yxcfz4.cjs +1 -0
  54. package/dist/input-element-Bw1s6NlF.js +643 -0
  55. package/dist/input-wrapper-BRuVELpK.cjs +54 -0
  56. package/dist/input-wrapper-CDyHTR1V.js +164 -0
  57. package/dist/input-wrapper-Dwd-_sKm.cjs +1 -0
  58. package/dist/input-wrapper-YfTmpSSY.js +117 -0
  59. package/dist/link-CKAFMz9j.js +89 -0
  60. package/dist/link-CyTCpI0k.cjs +7 -0
  61. package/dist/linkcard-B0KOGaGj.js +55 -0
  62. package/dist/linkcard-BE4-FewK.cjs +13 -0
  63. package/dist/listbox-DCA2JoPV.cjs +106 -0
  64. package/dist/listbox-DuBgTFvH.js +397 -0
  65. package/dist/loader-6kFZUErT.js +66 -0
  66. package/dist/loader-CX2rsC01.cjs +16 -0
  67. package/dist/messagebox-Cwlg5sOr.js +110 -0
  68. package/dist/messagebox-Din9X53b.cjs +13 -0
  69. package/dist/modal-C_wtsh9m.js +209 -0
  70. package/dist/modal-DS_wUOIv.cjs +36 -0
  71. package/dist/pkt-accordion.cjs +1 -1
  72. package/dist/pkt-accordion.js +2 -7
  73. package/dist/pkt-alert.cjs +1 -1
  74. package/dist/pkt-alert.js +2 -6
  75. package/dist/pkt-backlink.cjs +1 -1
  76. package/dist/pkt-backlink.js +2 -6
  77. package/dist/pkt-breadcrumbs.cjs +1 -43
  78. package/dist/pkt-breadcrumbs.js +2 -79
  79. package/dist/pkt-button.cjs +1 -1
  80. package/dist/pkt-button.js +2 -6
  81. package/dist/pkt-calendar.cjs +1 -1
  82. package/dist/pkt-calendar.js +2 -6
  83. package/dist/pkt-card.cjs +1 -1
  84. package/dist/pkt-card.js +2 -6
  85. package/dist/pkt-checkbox.cjs +1 -1
  86. package/dist/pkt-checkbox.js +2 -6
  87. package/dist/pkt-combobox.cjs +1 -1
  88. package/dist/pkt-combobox.js +2 -6
  89. package/dist/pkt-consent.cjs +1 -1
  90. package/dist/pkt-consent.js +2 -6
  91. package/dist/pkt-datepicker.cjs +1 -1
  92. package/dist/pkt-datepicker.js +5 -10
  93. package/dist/pkt-header.cjs +1 -304
  94. package/dist/pkt-header.js +2 -855
  95. package/dist/pkt-heading.cjs +1 -1
  96. package/dist/pkt-heading.js +2 -6
  97. package/dist/pkt-helptext.cjs +1 -1
  98. package/dist/pkt-helptext.js +2 -6
  99. package/dist/pkt-icon.cjs +1 -1
  100. package/dist/pkt-icon.js +2 -6
  101. package/dist/pkt-index.cjs +1 -1
  102. package/dist/pkt-index.js +30 -66
  103. package/dist/pkt-input-wrapper.cjs +1 -1
  104. package/dist/pkt-input-wrapper.js +2 -6
  105. package/dist/pkt-link.cjs +1 -1
  106. package/dist/pkt-link.js +2 -6
  107. package/dist/pkt-linkcard.cjs +1 -1
  108. package/dist/pkt-linkcard.js +2 -6
  109. package/dist/pkt-listbox.cjs +1 -1
  110. package/dist/pkt-listbox.js +2 -6
  111. package/dist/pkt-loader.cjs +1 -1
  112. package/dist/pkt-loader.js +2 -6
  113. package/dist/pkt-messagebox.cjs +1 -1
  114. package/dist/pkt-messagebox.js +2 -6
  115. package/dist/pkt-modal.cjs +1 -1
  116. package/dist/pkt-modal.js +2 -6
  117. package/dist/pkt-options-controller-CRrI6WMk.js +43 -0
  118. package/dist/pkt-options-controller-CXUGx134.cjs +1 -0
  119. package/dist/pkt-progressbar.cjs +1 -1
  120. package/dist/pkt-progressbar.js +2 -6
  121. package/dist/pkt-radiobutton.cjs +1 -1
  122. package/dist/pkt-radiobutton.js +2 -6
  123. package/dist/pkt-select.cjs +1 -1
  124. package/dist/pkt-select.js +2 -6
  125. package/dist/pkt-tabs.cjs +1 -1
  126. package/dist/pkt-tabs.js +2 -7
  127. package/dist/pkt-tag.cjs +1 -1
  128. package/dist/pkt-tag.js +2 -6
  129. package/dist/pkt-textarea.cjs +1 -1
  130. package/dist/pkt-textarea.js +2 -6
  131. package/dist/pkt-textinput.cjs +1 -1
  132. package/dist/pkt-textinput.js +2 -6
  133. package/dist/pkt-timepicker.cjs +1 -191
  134. package/dist/pkt-timepicker.js +2 -558
  135. package/dist/progressbar-CdXtmOBb.cjs +17 -0
  136. package/dist/progressbar-Dy9AiYQz.js +113 -0
  137. package/dist/radiobutton-GOnpUbCW.cjs +31 -0
  138. package/dist/radiobutton-V_KPbup_.js +84 -0
  139. package/dist/ref-BaJ0mBT_.cjs +1 -0
  140. package/dist/ref-RS8Uv6uC.js +30 -0
  141. package/dist/repeat-Cepr3469.js +57 -0
  142. package/dist/repeat-CqcDYBxr.cjs +1 -0
  143. package/dist/select-BSAFd8Wa.js +164 -0
  144. package/dist/select-C2i8sOk5.cjs +49 -0
  145. package/dist/tabs-D8nL9rWx.cjs +37 -0
  146. package/dist/tabs-Y7utmJi9.js +318 -0
  147. package/dist/tag-DLthw5b4.cjs +27 -0
  148. package/dist/tag-VwykmuQR.js +179 -0
  149. package/dist/textarea-D7aGOyDf.cjs +46 -0
  150. package/dist/textarea-DYOBhJrN.js +115 -0
  151. package/dist/textinput-BUgntXnM.js +124 -0
  152. package/dist/textinput-DFh8_9cx.cjs +70 -0
  153. package/dist/timepicker-BIfE7KKJ.cjs +191 -0
  154. package/dist/timepicker-DaSwn1FA.js +503 -0
  155. package/dist/utils-CUqCKGvp.js +7 -0
  156. package/dist/utils-CjAbIttF.cjs +1 -0
  157. package/package.json +6 -6
  158. package/src/components/accordion/accordion.ts +6 -1
  159. package/src/components/accordion/accordionitem.ts +6 -1
  160. package/src/components/alert/alert.test.ts +1 -1
  161. package/src/components/alert/alert.ts +12 -7
  162. package/src/components/backlink/backlink.ts +6 -1
  163. package/src/components/breadcrumbs/breadcrumbs.ts +6 -1
  164. package/src/components/button/button.ts +6 -1
  165. package/src/components/calendar/calendar.ts +6 -1
  166. package/src/components/card/card.ts +6 -1
  167. package/src/components/checkbox/checkbox.ts +6 -1
  168. package/src/components/combobox/combobox.ts +6 -1
  169. package/src/components/consent/consent.ts +6 -1
  170. package/src/components/datepicker/date-tags.ts +6 -1
  171. package/src/components/datepicker/datepicker-multiple.ts +6 -1
  172. package/src/components/datepicker/datepicker-popup.ts +6 -1
  173. package/src/components/datepicker/datepicker-range.ts +6 -1
  174. package/src/components/datepicker/datepicker-single.ts +6 -1
  175. package/src/components/datepicker/datepicker-utils.test.ts +16 -23
  176. package/src/components/datepicker/datepicker.ts +6 -1
  177. package/src/components/header/header-service.ts +6 -1
  178. package/src/components/header/header-user-menu.ts +6 -1
  179. package/src/components/header/header.ts +6 -1
  180. package/src/components/heading/heading.ts +6 -1
  181. package/src/components/helptext/helptext.ts +6 -1
  182. package/src/components/icon/icon.ts +6 -1
  183. package/src/components/input-wrapper/input-wrapper.ts +6 -1
  184. package/src/components/link/link.ts +6 -1
  185. package/src/components/linkcard/linkcard.ts +6 -1
  186. package/src/components/listbox/listbox.ts +6 -1
  187. package/src/components/loader/loader.ts +6 -1
  188. package/src/components/messagebox/messagebox.ts +6 -1
  189. package/src/components/modal/modal.ts +6 -1
  190. package/src/components/progressbar/progressbar.ts +6 -1
  191. package/src/components/radiobutton/radiobutton.ts +6 -1
  192. package/src/components/select/select.ts +6 -1
  193. package/src/components/tabs/tabitem.ts +6 -1
  194. package/src/components/tabs/tabs.ts +6 -1
  195. package/src/components/tag/tag.ts +6 -1
  196. package/src/components/textarea/textarea.ts +6 -1
  197. package/src/components/textinput/textinput.ts +6 -1
  198. package/src/components/timepicker/timepicker.ts +6 -1
  199. package/dist/accordionitem-D1Agl1bB.cjs +0 -34
  200. package/dist/accordionitem-ZlaXvjt5.js +0 -138
  201. package/dist/alert-BuAXrnKl.js +0 -115
  202. package/dist/alert-DFkFNTxh.cjs +0 -33
  203. package/dist/async-directive-CMzWMlZ5.js +0 -65
  204. package/dist/async-directive-DoMuclel.cjs +0 -5
  205. package/dist/backlink-EiAXUUZP.cjs +0 -13
  206. package/dist/backlink-V4DAt17e.js +0 -47
  207. package/dist/booleanish-BKVonob4.cjs +0 -1
  208. package/dist/booleanish-C9R0tdXH.js +0 -11
  209. package/dist/button-DEyvt1LI.js +0 -137
  210. package/dist/button-DYv5Dg4M.cjs +0 -27
  211. package/dist/calendar-HIE9nxcc.cjs +0 -90
  212. package/dist/calendar-S63oreVW.js +0 -2138
  213. package/dist/card-CyeH6l1c.cjs +0 -87
  214. package/dist/card-DDiLfuO4.js +0 -231
  215. package/dist/checkbox-BLlwTABj.cjs +0 -31
  216. package/dist/checkbox-ejBUa5qQ.js +0 -145
  217. package/dist/class-map-CEnykyO_.js +0 -34
  218. package/dist/class-map-CsENJXf1.cjs +0 -5
  219. package/dist/classutils-BwNK82ZQ.cjs +0 -1
  220. package/dist/classutils-RQs1k6D9.js +0 -7
  221. package/dist/combobox-BmxSecfE.js +0 -818
  222. package/dist/combobox-Hb2V-fPX.cjs +0 -135
  223. package/dist/consent-iXyx5v6J.js +0 -173
  224. package/dist/consent-ruWAEVXW.cjs +0 -11
  225. package/dist/datepicker-CZl7b8Na.js +0 -1158
  226. package/dist/datepicker-D2H7U6MS.cjs +0 -273
  227. package/dist/dialog-polyfill.esm-CPKZe7AL.cjs +0 -1
  228. package/dist/dialog-polyfill.esm-CbjBMXAG.js +0 -395
  229. package/dist/directive-C7oCP5Bh.cjs +0 -5
  230. package/dist/directive-helpers-BP2WOx60.cjs +0 -5
  231. package/dist/directive-helpers-rm-28gIj.js +0 -38
  232. package/dist/directive-oAbCiebi.js +0 -27
  233. package/dist/element-CPpT3rFQ.js +0 -638
  234. package/dist/element-gR_VtSiD.cjs +0 -27
  235. package/dist/element-with-slot-Dqk6-TRR.js +0 -240
  236. package/dist/element-with-slot-ZX-up7jO.cjs +0 -1
  237. package/dist/heading-CKt7cVn7.js +0 -101
  238. package/dist/heading-Cvz8m1xL.cjs +0 -1
  239. package/dist/helptext-5Mzp65-F.cjs +0 -24
  240. package/dist/helptext-jIoWRcCF.js +0 -80
  241. package/dist/icon-BlKA8YuW.js +0 -103
  242. package/dist/icon-Bqj9oBbl.cjs +0 -9
  243. package/dist/if-defined-B0krMLad.js +0 -10
  244. package/dist/if-defined-BOW3ODSj.cjs +0 -5
  245. package/dist/input-element-8nLwuQS4.js +0 -837
  246. package/dist/input-element-DdVhUvva.cjs +0 -1
  247. package/dist/input-wrapper-B0MkQ0IZ.cjs +0 -54
  248. package/dist/input-wrapper-B2JpK016.js +0 -179
  249. package/dist/input-wrapper-CDgenrYA.js +0 -6
  250. package/dist/input-wrapper-EoSAbU-U.cjs +0 -1
  251. package/dist/link-R_lNhViF.cjs +0 -7
  252. package/dist/link-Z_GizclR.js +0 -53
  253. package/dist/linkcard-BlQvdB1a.js +0 -54
  254. package/dist/linkcard-C7HbSLlX.cjs +0 -13
  255. package/dist/listbox-BQKDZvZn.js +0 -438
  256. package/dist/listbox-CGgV9MAe.cjs +0 -106
  257. package/dist/loader-Ci3CHU8k.js +0 -93
  258. package/dist/loader-e2gs_1xz.cjs +0 -16
  259. package/dist/messagebox-Bf-XMlvW.js +0 -69
  260. package/dist/messagebox-D67w71VX.cjs +0 -13
  261. package/dist/modal-CyvEkbfQ.cjs +0 -36
  262. package/dist/modal-DzGe1g8Z.js +0 -154
  263. package/dist/pkt-options-controller-5LXbEzuk.cjs +0 -1
  264. package/dist/pkt-options-controller-B5YalfCb.js +0 -39
  265. package/dist/progressbar-By7e0lEI.js +0 -162
  266. package/dist/progressbar-DsJ2B9Vm.cjs +0 -21
  267. package/dist/radiobutton-6frNG9J_.js +0 -111
  268. package/dist/radiobutton-Bv-BZ1Hw.cjs +0 -31
  269. package/dist/ref-Bg_Swj5w.js +0 -42
  270. package/dist/ref-CL-Xk9Xm.cjs +0 -5
  271. package/dist/repeat-BD8TKgJb.js +0 -61
  272. package/dist/repeat-Cfq8CDlf.cjs +0 -5
  273. package/dist/select-CXZt1nHS.js +0 -228
  274. package/dist/select-WFhS4Vfp.cjs +0 -49
  275. package/dist/state-C_1EOo3D.js +0 -12
  276. package/dist/state-Dg-53wQ8.cjs +0 -5
  277. package/dist/tabitem-CB8wkKmv.js +0 -332
  278. package/dist/tabitem-DZpspU4Q.cjs +0 -65
  279. package/dist/tag-BuCpqaks.js +0 -115
  280. package/dist/tag-X6xdjR0N.cjs +0 -27
  281. package/dist/textarea-Bzuymclz.js +0 -131
  282. package/dist/textarea-DoeHJ7HR.cjs +0 -50
  283. package/dist/textinput-9lHjs4ce.js +0 -150
  284. package/dist/textinput-BNsLd26i.cjs +0 -70
  285. package/dist/utils-DznhwRXm.js +0 -8
  286. package/dist/utils-byXsEz1u.cjs +0 -1
@@ -1,332 +0,0 @@
1
- import { P as k, s as $ } from "./element-with-slot-Dqk6-TRR.js";
2
- import { b as p, n as h, t as y } from "./element-CPpT3rFQ.js";
3
- import { r as f } from "./state-C_1EOo3D.js";
4
- import { e as _, n as w } from "./ref-Bg_Swj5w.js";
5
- import { o as u } from "./if-defined-B0krMLad.js";
6
- /**
7
- * @license
8
- * Copyright 2021 Google LLC
9
- * SPDX-License-Identifier: BSD-3-Clause
10
- */
11
- let C = class extends Event {
12
- constructor(t, s, i, e) {
13
- super("context-request", { bubbles: !0, composed: !0 }), this.context = t, this.contextTarget = s, this.callback = i, this.subscribe = e ?? !1;
14
- }
15
- };
16
- /**
17
- * @license
18
- * Copyright 2021 Google LLC
19
- * SPDX-License-Identifier: BSD-3-Clause
20
- */
21
- /**
22
- * @license
23
- * Copyright 2021 Google LLC
24
- * SPDX-License-Identifier: BSD-3-Clause
25
- */
26
- let m = class {
27
- constructor(t, s, i, e) {
28
- if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (n, r) => {
29
- this.unsubscribe && (this.unsubscribe !== r && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = n, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(n, r)), this.unsubscribe = r;
30
- }, this.host = t, s.context !== void 0) {
31
- const n = s;
32
- this.context = n.context, this.callback = n.callback, this.subscribe = n.subscribe ?? !1;
33
- } else this.context = s, this.callback = i, this.subscribe = e ?? !1;
34
- this.host.addController(this);
35
- }
36
- hostConnected() {
37
- this.dispatchRequest();
38
- }
39
- hostDisconnected() {
40
- this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0);
41
- }
42
- dispatchRequest() {
43
- this.host.dispatchEvent(new C(this.context, this.host, this.t, this.subscribe));
44
- }
45
- };
46
- /**
47
- * @license
48
- * Copyright 2021 Google LLC
49
- * SPDX-License-Identifier: BSD-3-Clause
50
- */
51
- class N {
52
- get value() {
53
- return this.o;
54
- }
55
- set value(t) {
56
- this.setValue(t);
57
- }
58
- setValue(t, s = !1) {
59
- const i = s || !Object.is(t, this.o);
60
- this.o = t, i && this.updateObservers();
61
- }
62
- constructor(t) {
63
- this.subscriptions = /* @__PURE__ */ new Map(), this.updateObservers = () => {
64
- for (const [s, { disposer: i }] of this.subscriptions) s(this.o, i);
65
- }, t !== void 0 && (this.value = t);
66
- }
67
- addCallback(t, s, i) {
68
- if (!i) return void t(this.value);
69
- this.subscriptions.has(t) || this.subscriptions.set(t, { disposer: () => {
70
- this.subscriptions.delete(t);
71
- }, consumerHost: s });
72
- const { disposer: e } = this.subscriptions.get(t);
73
- t(this.value, e);
74
- }
75
- clearCallbacks() {
76
- this.subscriptions.clear();
77
- }
78
- }
79
- /**
80
- * @license
81
- * Copyright 2021 Google LLC
82
- * SPDX-License-Identifier: BSD-3-Clause
83
- */
84
- let R = class extends Event {
85
- constructor(t, s) {
86
- super("context-provider", { bubbles: !0, composed: !0 }), this.context = t, this.contextTarget = s;
87
- }
88
- };
89
- class g extends N {
90
- constructor(t, s, i) {
91
- var e, n;
92
- super(s.context !== void 0 ? s.initialValue : i), this.onContextRequest = (r) => {
93
- if (r.context !== this.context) return;
94
- const a = r.contextTarget ?? r.composedPath()[0];
95
- a !== this.host && (r.stopPropagation(), this.addCallback(r.callback, a, r.subscribe));
96
- }, this.onProviderRequest = (r) => {
97
- if (r.context !== this.context || (r.contextTarget ?? r.composedPath()[0]) === this.host) return;
98
- const a = /* @__PURE__ */ new Set();
99
- for (const [v, { consumerHost: x }] of this.subscriptions) a.has(v) || (a.add(v), x.dispatchEvent(new C(this.context, x, v, !0)));
100
- r.stopPropagation();
101
- }, this.host = t, s.context !== void 0 ? this.context = s.context : this.context = s, this.attachListeners(), (n = (e = this.host).addController) == null || n.call(e, this);
102
- }
103
- attachListeners() {
104
- this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
105
- }
106
- hostConnected() {
107
- this.host.dispatchEvent(new R(this.context, this.host));
108
- }
109
- }
110
- /**
111
- * @license
112
- * Copyright 2017 Google LLC
113
- * SPDX-License-Identifier: BSD-3-Clause
114
- */
115
- function A({ context: o }) {
116
- return (t, s) => {
117
- const i = /* @__PURE__ */ new WeakMap();
118
- if (typeof s == "object") return { get() {
119
- return t.get.call(this);
120
- }, set(e) {
121
- return i.get(this).setValue(e), t.set.call(this, e);
122
- }, init(e) {
123
- return i.set(this, new g(this, { context: o, initialValue: e })), e;
124
- } };
125
- {
126
- t.constructor.addInitializer(((r) => {
127
- i.set(r, new g(r, { context: o }));
128
- }));
129
- const e = Object.getOwnPropertyDescriptor(t, s);
130
- let n;
131
- if (e === void 0) {
132
- const r = /* @__PURE__ */ new WeakMap();
133
- n = { get() {
134
- return r.get(this);
135
- }, set(a) {
136
- i.get(this).setValue(a), r.set(this, a);
137
- }, configurable: !0, enumerable: !0 };
138
- } else {
139
- const r = e.set;
140
- n = { ...e, set(a) {
141
- i.get(this).setValue(a), r == null || r.call(this, a);
142
- } };
143
- }
144
- return void Object.defineProperty(t, s, n);
145
- }
146
- };
147
- }
148
- /**
149
- * @license
150
- * Copyright 2022 Google LLC
151
- * SPDX-License-Identifier: BSD-3-Clause
152
- */
153
- function O({ context: o, subscribe: t }) {
154
- return (s, i) => {
155
- typeof i == "object" ? i.addInitializer((function() {
156
- new m(this, { context: o, callback: (e) => {
157
- s.set.call(this, e);
158
- }, subscribe: t });
159
- })) : s.constructor.addInitializer(((e) => {
160
- new m(e, { context: o, callback: (n) => {
161
- e[i] = n;
162
- }, subscribe: t });
163
- }));
164
- };
165
- }
166
- const P = Symbol("pkt-tabs-context");
167
- var S = Object.defineProperty, T = Object.getOwnPropertyDescriptor, d = (o, t, s, i) => {
168
- for (var e = i > 1 ? void 0 : i ? T(t, s) : t, n = o.length - 1, r; n >= 0; n--)
169
- (r = o[n]) && (e = (i ? r(t, s, e) : r(e)) || e);
170
- return i && e && S(t, s, e), e;
171
- };
172
- let b = class extends k {
173
- constructor() {
174
- super(...arguments), this.arrowNav = !0, this.disableArrowNav = !1, this.tabRefs = [], this.tabCount = 0, this.context = {
175
- useArrowNav: this.useArrowNav,
176
- registerTab: this.registerTab.bind(this),
177
- handleClick: this.handleClick.bind(this),
178
- handleKeyUp: this.handleKeyUp.bind(this)
179
- };
180
- }
181
- get useArrowNav() {
182
- return this.arrowNav && !this.disableArrowNav;
183
- }
184
- // Update context when properties change
185
- updated(o) {
186
- (o.has("arrowNav") || o.has("disableArrowNav")) && (this.context = {
187
- ...this.context,
188
- useArrowNav: this.useArrowNav
189
- });
190
- }
191
- registerTab(o, t) {
192
- this.tabRefs[t] = o, this.tabCount = Math.max(this.tabCount, t + 1);
193
- }
194
- handleClick(o) {
195
- this.dispatchEvent(
196
- new CustomEvent("tab-selected", {
197
- detail: { index: o },
198
- bubbles: !0,
199
- composed: !0
200
- })
201
- );
202
- }
203
- handleKeyUp(o, t) {
204
- var s, i;
205
- this.useArrowNav && (o.code === "ArrowLeft" && t !== 0 && ((s = this.tabRefs[t - 1]) == null || s.focus()), o.code === "ArrowRight" && t < this.tabCount - 1 && ((i = this.tabRefs[t + 1]) == null || i.focus()), (o.code === "ArrowDown" || o.code === "Space") && this.dispatchEvent(
206
- new CustomEvent("tab-selected", {
207
- detail: { index: t },
208
- bubbles: !0,
209
- composed: !0
210
- })
211
- ));
212
- }
213
- render() {
214
- const o = this.useArrowNav ? "tablist" : "navigation";
215
- return p`
216
- <div class="pkt-tabs">
217
- <div class="pkt-tabs__list" role=${o}>${$(this)}</div>
218
- </div>
219
- `;
220
- }
221
- };
222
- d([
223
- h({ type: Boolean, reflect: !0, attribute: "arrow-nav" })
224
- ], b.prototype, "arrowNav", 2);
225
- d([
226
- h({ type: Boolean, reflect: !0, attribute: "disable-arrow-nav" })
227
- ], b.prototype, "disableArrowNav", 2);
228
- d([
229
- f()
230
- ], b.prototype, "tabRefs", 2);
231
- d([
232
- f()
233
- ], b.prototype, "tabCount", 2);
234
- d([
235
- A({ context: P }),
236
- f()
237
- ], b.prototype, "context", 2);
238
- b = d([
239
- y("pkt-tabs")
240
- ], b);
241
- const M = b;
242
- var j = Object.defineProperty, q = Object.getOwnPropertyDescriptor, l = (o, t, s, i) => {
243
- for (var e = i > 1 ? void 0 : i ? q(t, s) : t, n = o.length - 1, r; n >= 0; n--)
244
- (r = o[n]) && (e = (i ? r(t, s, e) : r(e)) || e);
245
- return i && e && j(t, s, e), e;
246
- };
247
- let c = class extends k {
248
- constructor() {
249
- super(), this.active = !1, this.href = "", this.icon = "", this.controls = "", this.tag = "", this.tagSkin = "blue", this.index = 0, this.elementRef = _();
250
- }
251
- connectedCallback() {
252
- super.connectedCallback(), this.updateComplete.then(() => {
253
- this.elementRef.value && this.context && this.context.registerTab(this.elementRef.value, this.index);
254
- });
255
- }
256
- handleClick() {
257
- this.context && this.context.handleClick(this.index);
258
- }
259
- handleKeyUp(o) {
260
- this.context && this.context.handleKeyUp(o, this.index);
261
- }
262
- render() {
263
- var r;
264
- const o = ((r = this.context) == null ? void 0 : r.useArrowNav) ?? !0, t = this.active ? "active" : "", s = o ? "tab" : void 0, i = o ? this.active : void 0, e = this.active || !o ? void 0 : -1, n = p`
265
- ${this.icon ? p`<pkt-icon name=${this.icon} class="pkt-icon--small"></pkt-icon>` : ""}
266
- <span>${$(this)}</span>
267
- ${this.tag ? p`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>` : ""}
268
- `;
269
- return this.href ? p`
270
- <a
271
- ${w(this.elementRef)}
272
- href=${this.href}
273
- class="pkt-tabs__link ${t}"
274
- role=${u(s)}
275
- aria-selected=${u(i)}
276
- aria-controls=${u(this.controls || void 0)}
277
- tabindex=${u(e)}
278
- @click=${this.handleClick}
279
- @keyup=${this.handleKeyUp}
280
- >
281
- ${n}
282
- </a>
283
- ` : p`
284
- <button
285
- ${w(this.elementRef)}
286
- type="button"
287
- class="pkt-tabs__button pkt-link-button ${t}"
288
- role=${u(s)}
289
- aria-selected=${u(i)}
290
- aria-controls=${u(this.controls || void 0)}
291
- tabindex=${u(e)}
292
- @click=${this.handleClick}
293
- @keyup=${this.handleKeyUp}
294
- >
295
- ${n}
296
- </button>
297
- `;
298
- }
299
- };
300
- l([
301
- h({ type: Boolean, reflect: !0 })
302
- ], c.prototype, "active", 2);
303
- l([
304
- h({ type: String, reflect: !0 })
305
- ], c.prototype, "href", 2);
306
- l([
307
- h({ type: String, reflect: !0 })
308
- ], c.prototype, "icon", 2);
309
- l([
310
- h({ type: String, reflect: !0 })
311
- ], c.prototype, "controls", 2);
312
- l([
313
- h({ type: String, reflect: !0 })
314
- ], c.prototype, "tag", 2);
315
- l([
316
- h({ type: String, reflect: !0, attribute: "tag-skin" })
317
- ], c.prototype, "tagSkin", 2);
318
- l([
319
- h({ type: Number, reflect: !0 })
320
- ], c.prototype, "index", 2);
321
- l([
322
- O({ context: P, subscribe: !0 }),
323
- h({ attribute: !1 })
324
- ], c.prototype, "context", 2);
325
- c = l([
326
- y("pkt-tab-item")
327
- ], c);
328
- const B = c;
329
- export {
330
- B as P,
331
- M as a
332
- };
@@ -1,65 +0,0 @@
1
- "use strict";const d=require("./element-with-slot-ZX-up7jO.cjs"),a=require("./element-gR_VtSiD.cjs"),x=require("./state-Dg-53wQ8.cjs"),f=require("./ref-CL-Xk9Xm.cjs"),u=require("./if-defined-BOW3ODSj.cjs");/**
2
- * @license
3
- * Copyright 2021 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */let m=class extends Event{constructor(t,e,i,s){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=i,this.subscribe=s??!1}};/**
6
- * @license
7
- * Copyright 2021 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- *//**
10
- * @license
11
- * Copyright 2021 Google LLC
12
- * SPDX-License-Identifier: BSD-3-Clause
13
- */let w=class{constructor(t,e,i,s){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(r,o)=>{this.unsubscribe&&(this.unsubscribe!==o&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=r,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(r,o)),this.unsubscribe=o},this.host=t,e.context!==void 0){const r=e;this.context=r.context,this.callback=r.callback,this.subscribe=r.subscribe??!1}else this.context=e,this.callback=i,this.subscribe=s??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new m(this.context,this.host,this.t,this.subscribe))}};/**
14
- * @license
15
- * Copyright 2021 Google LLC
16
- * SPDX-License-Identifier: BSD-3-Clause
17
- */class C{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){const i=e||!Object.is(t,this.o);this.o=t,i&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(const[e,{disposer:i}]of this.subscriptions)e(this.o,i)},t!==void 0&&(this.value=t)}addCallback(t,e,i){if(!i)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});const{disposer:s}=this.subscriptions.get(t);t(this.value,s)}clearCallbacks(){this.subscriptions.clear()}}/**
18
- * @license
19
- * Copyright 2021 Google LLC
20
- * SPDX-License-Identifier: BSD-3-Clause
21
- */let $=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}};class g extends C{constructor(t,e,i){var s,r;super(e.context!==void 0?e.initialValue:i),this.onContextRequest=o=>{if(o.context!==this.context)return;const c=o.contextTarget??o.composedPath()[0];c!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,c,o.subscribe))},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;const c=new Set;for(const[v,{consumerHost:k}]of this.subscriptions)c.has(v)||(c.add(v),k.dispatchEvent(new m(this.context,k,v,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(r=(s=this.host).addController)==null||r.call(s,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new $(this.context,this.host))}}/**
22
- * @license
23
- * Copyright 2017 Google LLC
24
- * SPDX-License-Identifier: BSD-3-Clause
25
- */function P({context:n}){return(t,e)=>{const i=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(s){return i.get(this).setValue(s),t.set.call(this,s)},init(s){return i.set(this,new g(this,{context:n,initialValue:s})),s}};{t.constructor.addInitializer((o=>{i.set(o,new g(o,{context:n}))}));const s=Object.getOwnPropertyDescriptor(t,e);let r;if(s===void 0){const o=new WeakMap;r={get(){return o.get(this)},set(c){i.get(this).setValue(c),o.set(this,c)},configurable:!0,enumerable:!0}}else{const o=s.set;r={...s,set(c){i.get(this).setValue(c),o==null||o.call(this,c)}}}return void Object.defineProperty(t,e,r)}}}/**
26
- * @license
27
- * Copyright 2022 Google LLC
28
- * SPDX-License-Identifier: BSD-3-Clause
29
- */function _({context:n,subscribe:t}){return(e,i)=>{typeof i=="object"?i.addInitializer((function(){new w(this,{context:n,callback:s=>{e.set.call(this,s)},subscribe:t})})):e.constructor.addInitializer((s=>{new w(s,{context:n,callback:r=>{s[i]=r},subscribe:t})}))}}const y=Symbol("pkt-tabs-context");var N=Object.defineProperty,R=Object.getOwnPropertyDescriptor,p=(n,t,e,i)=>{for(var s=i>1?void 0:i?R(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(t,e,s):o(s))||s);return i&&s&&N(t,e,s),s};let b=class extends d.PktElementWithSlot{constructor(){super(...arguments),this.arrowNav=!0,this.disableArrowNav=!1,this.tabRefs=[],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(t){(t.has("arrowNav")||t.has("disableArrowNav"))&&(this.context={...this.context,useArrowNav:this.useArrowNav})}registerTab(t,e){this.tabRefs[e]=t,this.tabCount=Math.max(this.tabCount,e+1)}handleClick(t){this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:t},bubbles:!0,composed:!0}))}handleKeyUp(t,e){var i,s;this.useArrowNav&&(t.code==="ArrowLeft"&&e!==0&&((i=this.tabRefs[e-1])==null||i.focus()),t.code==="ArrowRight"&&e<this.tabCount-1&&((s=this.tabRefs[e+1])==null||s.focus()),(t.code==="ArrowDown"||t.code==="Space")&&this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:e},bubbles:!0,composed:!0})))}render(){const t=this.useArrowNav?"tablist":"navigation";return a.b`
30
- <div class="pkt-tabs">
31
- <div class="pkt-tabs__list" role=${t}>${d.slotContent(this)}</div>
32
- </div>
33
- `}};p([a.n({type:Boolean,reflect:!0,attribute:"arrow-nav"})],b.prototype,"arrowNav",2);p([a.n({type:Boolean,reflect:!0,attribute:"disable-arrow-nav"})],b.prototype,"disableArrowNav",2);p([x.r()],b.prototype,"tabRefs",2);p([x.r()],b.prototype,"tabCount",2);p([P({context:y}),x.r()],b.prototype,"context",2);b=p([a.t("pkt-tabs")],b);const A=b;var S=Object.defineProperty,T=Object.getOwnPropertyDescriptor,l=(n,t,e,i)=>{for(var s=i>1?void 0:i?T(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(t,e,s):o(s))||s);return i&&s&&S(t,e,s),s};let h=class extends d.PktElementWithSlot{constructor(){super(),this.active=!1,this.href="",this.icon="",this.controls="",this.tag="",this.tagSkin="blue",this.index=0,this.elementRef=f.e()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index)})}handleClick(){this.context&&this.context.handleClick(this.index)}handleKeyUp(n){this.context&&this.context.handleKeyUp(n,this.index)}render(){var o;const n=((o=this.context)==null?void 0:o.useArrowNav)??!0,t=this.active?"active":"",e=n?"tab":void 0,i=n?this.active:void 0,s=this.active||!n?void 0:-1,r=a.b`
34
- ${this.icon?a.b`<pkt-icon name=${this.icon} class="pkt-icon--small"></pkt-icon>`:""}
35
- <span>${d.slotContent(this)}</span>
36
- ${this.tag?a.b`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>`:""}
37
- `;return this.href?a.b`
38
- <a
39
- ${f.n(this.elementRef)}
40
- href=${this.href}
41
- class="pkt-tabs__link ${t}"
42
- role=${u.o(e)}
43
- aria-selected=${u.o(i)}
44
- aria-controls=${u.o(this.controls||void 0)}
45
- tabindex=${u.o(s)}
46
- @click=${this.handleClick}
47
- @keyup=${this.handleKeyUp}
48
- >
49
- ${r}
50
- </a>
51
- `:a.b`
52
- <button
53
- ${f.n(this.elementRef)}
54
- type="button"
55
- class="pkt-tabs__button pkt-link-button ${t}"
56
- role=${u.o(e)}
57
- aria-selected=${u.o(i)}
58
- aria-controls=${u.o(this.controls||void 0)}
59
- tabindex=${u.o(s)}
60
- @click=${this.handleClick}
61
- @keyup=${this.handleKeyUp}
62
- >
63
- ${r}
64
- </button>
65
- `}};l([a.n({type:Boolean,reflect:!0})],h.prototype,"active",2);l([a.n({type:String,reflect:!0})],h.prototype,"href",2);l([a.n({type:String,reflect:!0})],h.prototype,"icon",2);l([a.n({type:String,reflect:!0})],h.prototype,"controls",2);l([a.n({type:String,reflect:!0})],h.prototype,"tag",2);l([a.n({type:String,reflect:!0,attribute:"tag-skin"})],h.prototype,"tagSkin",2);l([a.n({type:Number,reflect:!0})],h.prototype,"index",2);l([_({context:y,subscribe:!0}),a.n({attribute:!1})],h.prototype,"context",2);h=l([a.t("pkt-tab-item")],h);const q=h;exports.PktTabItem_default=q;exports.PktTabs=A;
@@ -1,115 +0,0 @@
1
- import { e as d } from "./class-map-CEnykyO_.js";
2
- import { b as n, n as o, t as y } from "./element-CPpT3rFQ.js";
3
- import { r as f } from "./state-C_1EOo3D.js";
4
- import { P as k, s as b } from "./element-with-slot-Dqk6-TRR.js";
5
- import "./icon-BlKA8YuW.js";
6
- import { o as u } from "./if-defined-B0krMLad.js";
7
- const g = { size: { default: "medium" }, skin: { default: "blue" }, closeTag: { default: !1 }, type: { default: "button" } }, l = {
8
- props: g
9
- };
10
- var m = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, e = (s, i, p, a) => {
11
- for (var r = a > 1 ? void 0 : a ? _(i, p) : i, c = s.length - 1, h; c >= 0; c--)
12
- (h = s[c]) && (r = (a ? h(i, p, r) : h(r)) || r);
13
- return a && r && m(i, p, r), r;
14
- };
15
- let t = class extends k {
16
- constructor() {
17
- 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 = (s) => {
18
- this._isClosed = !0, this.dispatchEvent(
19
- new CustomEvent("close", { detail: { origin: s }, bubbles: !1, composed: !0 })
20
- ), this.dispatchEvent(
21
- new CustomEvent("on-close", { detail: { origin: s }, bubbles: !1, composed: !0 })
22
- );
23
- }, this._isClosed = !1;
24
- }
25
- /**
26
- * Lifecycle
27
- */
28
- firstUpdated(s) {
29
- var i, p;
30
- if (super.firstUpdated(s), this.closeTag && !this.ariaLabel) {
31
- const a = (p = (i = this.querySelector("button span, .pkt-tag > span")) == null ? void 0 : i.textContent) == null ? void 0 : p.trim();
32
- a && (this._ariaDescription = `Klikk for å fjerne ${a}`);
33
- }
34
- }
35
- render() {
36
- const s = {
37
- "pkt-tag": !0,
38
- [`pkt-tag--${this.size}`]: !!this.size,
39
- [`pkt-tag--${this.skin}`]: !!this.skin,
40
- [`pkt-tag--${this.textStyle}`]: !!this.textStyle
41
- }, i = {
42
- "pkt-tag": !0,
43
- "pkt-btn": !0,
44
- "pkt-btn--tertiary": !0,
45
- [`pkt-tag--${this.textStyle}`]: !!this.textStyle,
46
- [`pkt-tag--${this.size}`]: !!this.size,
47
- [`pkt-tag--${this.skin}`]: !!this.skin,
48
- "pkt-btn--icons-right-and-left": this.closeTag && !!this.iconName,
49
- "pkt-hide": this._isClosed
50
- };
51
- return this.closeTag ? n`
52
- <button
53
- class=${d(i)}
54
- type=${this.type}
55
- tabindex=${u(this.buttonTabindex)}
56
- @click=${this.close}
57
- aria-label=${u(this.ariaLabel || void 0)}
58
- aria-description=${u(this._ariaDescription || void 0)}
59
- >
60
- ${this.iconName && n`<pkt-icon
61
- class="pkt-tag__icon"
62
- name=${this.iconName}
63
- aria-hidden="true"
64
- ></pkt-icon>`}
65
- <span>${b(this)}</span>
66
- <pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
67
- </button>
68
- ` : n`
69
- <span class=${d(s)}>
70
- ${this.iconName && n`<pkt-icon
71
- class="pkt-tag__icon"
72
- name=${this.iconName}
73
- aria-hidden="true"
74
- ></pkt-icon>`}
75
- <span>${b(this)}</span>
76
- </span>
77
- `;
78
- }
79
- };
80
- e([
81
- o({ type: Boolean, reflect: !0 })
82
- ], t.prototype, "closeTag", 2);
83
- e([
84
- o({ type: String, reflect: !0 })
85
- ], t.prototype, "size", 2);
86
- e([
87
- o({ type: String, reflect: !0 })
88
- ], t.prototype, "skin", 2);
89
- e([
90
- o({ type: String, reflect: !0 })
91
- ], t.prototype, "textStyle", 2);
92
- e([
93
- o({ type: String, reflect: !0 })
94
- ], t.prototype, "iconName", 2);
95
- e([
96
- o({ type: String })
97
- ], t.prototype, "type", 2);
98
- e([
99
- o({ type: String })
100
- ], t.prototype, "ariaLabel", 2);
101
- e([
102
- o({ type: Number, attribute: "button-tabindex" })
103
- ], t.prototype, "buttonTabindex", 2);
104
- e([
105
- f()
106
- ], t.prototype, "_isClosed", 2);
107
- e([
108
- f()
109
- ], t.prototype, "_ariaDescription", 2);
110
- t = e([
111
- y("pkt-tag")
112
- ], t);
113
- export {
114
- t as P
115
- };
@@ -1,27 +0,0 @@
1
- "use strict";const h=require("./class-map-CsENJXf1.cjs"),t=require("./element-gR_VtSiD.cjs"),k=require("./state-Dg-53wQ8.cjs"),c=require("./element-with-slot-ZX-up7jO.cjs");require("./icon-Bqj9oBbl.cjs");const u=require("./if-defined-BOW3ODSj.cjs"),g={size:{default:"medium"},skin:{default:"blue"},closeTag:{default:!1},type:{default:"button"}},o={props:g};var d=Object.defineProperty,b=Object.getOwnPropertyDescriptor,s=(r,e,a,n)=>{for(var i=n>1?void 0:n?b(e,a):e,p=r.length-1,l;p>=0;p--)(l=r[p])&&(i=(n?l(e,a,i):l(i))||i);return n&&i&&d(e,a,i),i};exports.PktTag=class extends c.PktElementWithSlot{constructor(){super(),this.closeTag=o.props.closeTag.default,this.size=o.props.size.default,this.skin=o.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=o.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){var a,n;if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){const i=(n=(a=this.querySelector("button span, .pkt-tag > span"))==null?void 0:a.textContent)==null?void 0:n.trim();i&&(this._ariaDescription=`Klikk for å fjerne ${i}`)}}render(){const e={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},a={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName,"pkt-hide":this._isClosed};return this.closeTag?t.b`
2
- <button
3
- class=${h.e(a)}
4
- type=${this.type}
5
- tabindex=${u.o(this.buttonTabindex)}
6
- @click=${this.close}
7
- aria-label=${u.o(this.ariaLabel||void 0)}
8
- aria-description=${u.o(this._ariaDescription||void 0)}
9
- >
10
- ${this.iconName&&t.b`<pkt-icon
11
- class="pkt-tag__icon"
12
- name=${this.iconName}
13
- aria-hidden="true"
14
- ></pkt-icon>`}
15
- <span>${c.slotContent(this)}</span>
16
- <pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
17
- </button>
18
- `:t.b`
19
- <span class=${h.e(e)}>
20
- ${this.iconName&&t.b`<pkt-icon
21
- class="pkt-tag__icon"
22
- name=${this.iconName}
23
- aria-hidden="true"
24
- ></pkt-icon>`}
25
- <span>${c.slotContent(this)}</span>
26
- </span>
27
- `}};s([t.n({type:Boolean,reflect:!0})],exports.PktTag.prototype,"closeTag",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"size",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"skin",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"textStyle",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"iconName",2);s([t.n({type:String})],exports.PktTag.prototype,"type",2);s([t.n({type:String})],exports.PktTag.prototype,"ariaLabel",2);s([t.n({type:Number,attribute:"button-tabindex"})],exports.PktTag.prototype,"buttonTabindex",2);s([k.r()],exports.PktTag.prototype,"_isClosed",2);s([k.r()],exports.PktTag.prototype,"_ariaDescription",2);exports.PktTag=s([t.t("pkt-tag")],exports.PktTag);
@@ -1,131 +0,0 @@
1
- import { E as l, A as c, b as m, n as d, t as g } from "./element-CPpT3rFQ.js";
2
- import { o as u } from "./if-defined-B0krMLad.js";
3
- import { r as $ } from "./state-C_1EOo3D.js";
4
- import { e as f, n as x } from "./ref-Bg_Swj5w.js";
5
- import { e as v } from "./class-map-CEnykyO_.js";
6
- import { e as b, i as T, t as a } from "./directive-oAbCiebi.js";
7
- import { r as y, p as w } from "./directive-helpers-rm-28gIj.js";
8
- import { P as C } from "./input-element-8nLwuQS4.js";
9
- import { s as E } from "./element-with-slot-Dqk6-TRR.js";
10
- import "./input-wrapper-B2JpK016.js";
11
- import "./icon-BlKA8YuW.js";
12
- /**
13
- * @license
14
- * Copyright 2020 Google LLC
15
- * SPDX-License-Identifier: BSD-3-Clause
16
- */
17
- const P = b(class extends T {
18
- constructor(t) {
19
- if (super(t), t.type !== a.PROPERTY && t.type !== a.ATTRIBUTE && t.type !== a.BOOLEAN_ATTRIBUTE) throw Error("The `live` directive is not allowed on child or event bindings");
20
- if (!y(t)) throw Error("`live` bindings can only contain a single expression");
21
- }
22
- render(t) {
23
- return t;
24
- }
25
- update(t, [r]) {
26
- if (r === l || r === c) return r;
27
- const e = t.element, i = t.name;
28
- if (t.type === a.PROPERTY) {
29
- if (r === e[i]) return l;
30
- } else if (t.type === a.BOOLEAN_ATTRIBUTE) {
31
- if (!!r === e.hasAttribute(i)) return l;
32
- } else if (t.type === a.ATTRIBUTE && e.getAttribute(i) === r + "") return l;
33
- return w(t), r;
34
- }
35
- });
36
- var B = Object.defineProperty, I = Object.getOwnPropertyDescriptor, n = (t, r, e, i) => {
37
- for (var s = i > 1 ? void 0 : i ? I(r, e) : r, h = t.length - 1, p; h >= 0; h--)
38
- (p = t[h]) && (s = (i ? p(r, e, s) : p(s)) || s);
39
- return i && s && B(r, e, s), s;
40
- };
41
- let o = class extends C {
42
- constructor() {
43
- super(...arguments), this.inputRef = f(), this.value = "", this.autocomplete = "off", this.rows = null, this.counterCurrent = 0;
44
- }
45
- attributeChangedCallback(t, r, e) {
46
- t === "value" && this.value !== r && (this.counterCurrent = e ? e.length : 0, this.valueChanged(e, r)), super.attributeChangedCallback(t, r, e);
47
- }
48
- updated(t) {
49
- var r;
50
- super.updated(t), t.has("value") && (this.counterCurrent = ((r = this.value) == null ? void 0 : r.length) || 0, this.valueChanged(this.value, t.get("value"))), t.has("id") && !this.name && this.id && (this.name = this.id);
51
- }
52
- render() {
53
- const t = v({
54
- "pkt-input": !0,
55
- "pkt-input--fullwidth": this.fullwidth,
56
- "pkt-input--counter-error": this.counter && this.counterMaxLength && this.value.length && this.value.length > this.counterMaxLength
57
- }), r = this.ariaLabelledby || `${this.id}-input-label`;
58
- return m`<pkt-input-wrapper
59
- label=${this.label}
60
- ?counter=${this.counter}
61
- ?disabled=${this.disabled}
62
- ?hasError=${this.hasError}
63
- ?inline=${this.inline}
64
- ?optionalTag=${this.optionalTag}
65
- ?required=${this.required}
66
- ?requiredTag=${this.requiredTag}
67
- useWrapper=${this.useWrapper}
68
- .ariaDescribedBy=${this.ariaDescribedBy}
69
- .counterCurrent=${this.counterCurrent}
70
- .counterMaxLength=${this.counterMaxLength}
71
- .errorMessage=${this.errorMessage}
72
- .forId="${this.id + "-input"}"
73
- .helptext=${this.helptext}
74
- .helptextDropdown=${this.helptextDropdown}
75
- .helptextDropdownButton=${this.helptextDropdownButton}
76
- .optionalText=${this.optionalText}
77
- .requiredText=${this.requiredText}
78
- .tagText=${this.tagText}
79
- class="pkt-textarea"
80
- >
81
- <div class="pkt-contents" slot="helptext">${E(this, "helptext")}</div>
82
- <textarea
83
- ${x(this.inputRef)}
84
- class=${t}
85
- id=${this.id + "-input"}
86
- name=${(this.name || this.id) + "-input"}
87
- placeholder=${u(this.placeholder)}
88
- .value=${P(this.value)}
89
- minlength=${u(this.minlength)}
90
- maxlength=${u(this.maxlength)}
91
- ?readonly=${this.readonly}
92
- autocomplete=${this.autocomplete}
93
- aria-labelledby=${r}
94
- aria-invalid=${this.hasError}
95
- aria-errormessage=${`${this.id}-error`}
96
- rows=${this.rows}
97
- ?disabled=${this.disabled}
98
- @input=${(e) => {
99
- this.value = e.target.value, this.onInput(), e.stopImmediatePropagation();
100
- }}
101
- @change=${(e) => {
102
- e.stopImmediatePropagation();
103
- }}
104
- @focus=${(e) => {
105
- this.onFocus(), e.stopImmediatePropagation();
106
- }}
107
- @blur=${(e) => {
108
- this.value = e.target.value, this.onBlur(), e.stopImmediatePropagation();
109
- }}
110
- ></textarea>
111
- </pkt-input-wrapper>`;
112
- }
113
- };
114
- n([
115
- d({ type: String, reflect: !0 })
116
- ], o.prototype, "value", 2);
117
- n([
118
- d({ type: String })
119
- ], o.prototype, "autocomplete", 2);
120
- n([
121
- d({ type: Number })
122
- ], o.prototype, "rows", 2);
123
- n([
124
- $()
125
- ], o.prototype, "counterCurrent", 2);
126
- o = n([
127
- g("pkt-textarea")
128
- ], o);
129
- export {
130
- o as P
131
- };