@oslokommune/punkt-elements 16.8.2 → 16.9.1

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 (245) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/accordion.d.ts +1 -1
  3. package/dist/alert.d.ts +1 -1
  4. package/dist/backlink.d.ts +1 -1
  5. package/dist/base-elements/element-with-slot.d.ts +21 -0
  6. package/dist/base-elements/element.d.ts +32 -0
  7. package/dist/base-elements/input-element.d.ts +173 -0
  8. package/dist/base-elements/options-input-element.d.ts +73 -0
  9. package/dist/breadcrumbs.d.ts +1 -1
  10. package/dist/button.d.ts +1 -1
  11. package/dist/calendar.d.ts +1 -1
  12. package/dist/card.d.ts +1 -1
  13. package/dist/checkbox.d.ts +1 -1
  14. package/dist/combobox.d.ts +1 -1
  15. package/dist/components/accordion/accordion.d.ts +20 -0
  16. package/dist/components/accordion/accordion.test.d.ts +0 -0
  17. package/dist/components/accordion/accordionitem.d.ts +32 -0
  18. package/dist/components/accordion/index.d.ts +5 -0
  19. package/dist/components/alert/alert.d.ts +30 -0
  20. package/dist/components/alert/alert.test.d.ts +13 -0
  21. package/dist/components/alert/index.d.ts +3 -0
  22. package/dist/components/backlink/backlink.d.ts +14 -0
  23. package/dist/components/backlink/backlink.test.d.ts +10 -0
  24. package/dist/components/backlink/index.d.ts +4 -0
  25. package/dist/components/breadcrumbs/breadcrumbs.d.ts +15 -0
  26. package/dist/components/breadcrumbs/breadcrumbs.test.d.ts +0 -0
  27. package/dist/components/breadcrumbs/index.d.ts +2 -0
  28. package/dist/components/button/button.d.ts +53 -0
  29. package/dist/components/button/button.test.d.ts +22 -0
  30. package/dist/components/button/index.d.ts +4 -0
  31. package/dist/components/calendar/calendar.accessibility.test.d.ts +16 -0
  32. package/dist/components/calendar/calendar.constraints.test.d.ts +0 -0
  33. package/dist/components/calendar/calendar.core.test.d.ts +0 -0
  34. package/dist/components/calendar/calendar.d.ts +97 -0
  35. package/dist/components/calendar/calendar.interaction.test.d.ts +0 -0
  36. package/dist/components/calendar/calendar.selection.test.d.ts +0 -0
  37. package/dist/components/calendar/index.d.ts +3 -0
  38. package/dist/components/card/card.d.ts +64 -0
  39. package/dist/components/card/card.test.d.ts +22 -0
  40. package/dist/components/card/index.d.ts +3 -0
  41. package/dist/components/checkbox/checkbox.d.ts +32 -0
  42. package/dist/components/checkbox/checkbox.test.d.ts +24 -0
  43. package/dist/components/checkbox/index.d.ts +3 -0
  44. package/dist/components/combobox/combobox-base.d.ts +74 -0
  45. package/dist/components/combobox/combobox-handlers.d.ts +28 -0
  46. package/dist/components/combobox/combobox-types.d.ts +5 -0
  47. package/dist/components/combobox/combobox-utils.d.ts +41 -0
  48. package/dist/components/combobox/combobox-value.d.ts +17 -0
  49. package/dist/components/combobox/combobox.accessibility.test.d.ts +0 -0
  50. package/dist/components/combobox/combobox.core.test.d.ts +0 -0
  51. package/dist/components/combobox/combobox.d.ts +61 -0
  52. package/dist/components/combobox/combobox.interaction.test.d.ts +0 -0
  53. package/dist/components/combobox/combobox.selection.test.d.ts +0 -0
  54. package/dist/components/combobox/index.d.ts +4 -0
  55. package/dist/components/consent/consent.d.ts +46 -0
  56. package/dist/components/consent/consent.test.d.ts +16 -0
  57. package/dist/components/consent/index.d.ts +4 -0
  58. package/dist/components/consent/strings.d.ts +85 -0
  59. package/dist/components/datepicker/date-tags.d.ts +20 -0
  60. package/dist/components/datepicker/date-tags.test.d.ts +12 -0
  61. package/dist/components/datepicker/datepicker-base.d.ts +39 -0
  62. package/dist/components/datepicker/datepicker-multiple.d.ts +10 -0
  63. package/dist/components/datepicker/datepicker-popup.d.ts +34 -0
  64. package/dist/components/datepicker/datepicker-popup.test.d.ts +4 -0
  65. package/dist/components/datepicker/datepicker-range.d.ts +12 -0
  66. package/dist/components/datepicker/datepicker-single.d.ts +8 -0
  67. package/dist/components/datepicker/datepicker-types.d.ts +6 -0
  68. package/dist/components/datepicker/datepicker-utils.d.ts +77 -0
  69. package/dist/components/datepicker/datepicker-utils.test.d.ts +1 -0
  70. package/dist/components/datepicker/datepicker.accessibility.test.d.ts +0 -0
  71. package/dist/components/datepicker/datepicker.core.test.d.ts +0 -0
  72. package/dist/components/datepicker/datepicker.d.ts +83 -0
  73. package/dist/components/datepicker/datepicker.input.test.d.ts +0 -0
  74. package/dist/components/datepicker/datepicker.selection.test.d.ts +0 -0
  75. package/dist/components/datepicker/datepicker.validation.test.d.ts +0 -0
  76. package/dist/components/datepicker/index.d.ts +6 -0
  77. package/dist/components/header/header-service.d.ts +86 -0
  78. package/dist/components/header/header-service.test.d.ts +18 -0
  79. package/dist/components/header/header-user-menu.d.ts +29 -0
  80. package/dist/components/header/header-utils.d.ts +6 -0
  81. package/dist/components/header/header.d.ts +52 -0
  82. package/dist/components/header/index.d.ts +5 -0
  83. package/dist/components/header/types.d.ts +59 -0
  84. package/dist/components/heading/heading.d.ts +28 -0
  85. package/dist/components/heading/heading.test.d.ts +0 -0
  86. package/dist/components/heading/index.d.ts +4 -0
  87. package/dist/components/helptext/helptext.d.ts +9 -0
  88. package/dist/components/helptext/helptext.test.d.ts +0 -0
  89. package/dist/components/helptext/index.d.ts +3 -0
  90. package/dist/components/icon/icon.d.ts +22 -0
  91. package/dist/components/icon/icon.test.d.ts +10 -0
  92. package/dist/components/icon/index.d.ts +3 -0
  93. package/dist/components/index.d.ts +45 -0
  94. package/dist/components/input-wrapper/index.d.ts +3 -0
  95. package/dist/components/input-wrapper/input-wrapper.d.ts +39 -0
  96. package/dist/components/input-wrapper/input-wrapper.test.d.ts +31 -0
  97. package/dist/components/link/index.d.ts +3 -0
  98. package/dist/components/link/link.d.ts +12 -0
  99. package/dist/components/link/link.test.d.ts +15 -0
  100. package/dist/components/linkcard/index.d.ts +4 -0
  101. package/dist/components/linkcard/linkcard.d.ts +19 -0
  102. package/dist/components/linkcard/linkcard.test.d.ts +9 -0
  103. package/dist/components/listbox/index.d.ts +4 -0
  104. package/dist/components/listbox/listbox.d.ts +64 -0
  105. package/dist/components/listbox/listbox.interaction.test.d.ts +10 -0
  106. package/dist/components/listbox/listbox.test.d.ts +10 -0
  107. package/dist/components/loader/index.d.ts +4 -0
  108. package/dist/components/loader/loader.d.ts +53 -0
  109. package/dist/components/loader/loader.test.d.ts +8 -0
  110. package/dist/components/messagebox/index.d.ts +4 -0
  111. package/dist/components/messagebox/messagebox.d.ts +21 -0
  112. package/dist/components/messagebox/messagebox.test.d.ts +8 -0
  113. package/dist/components/modal/index.d.ts +3 -0
  114. package/dist/components/modal/modal.d.ts +41 -0
  115. package/dist/components/progressbar/index.d.ts +4 -0
  116. package/dist/components/progressbar/progressbar.d.ts +49 -0
  117. package/dist/components/progressbar/progressbar.test.d.ts +8 -0
  118. package/dist/components/radiobutton/index.d.ts +3 -0
  119. package/dist/components/radiobutton/radiobutton.d.ts +24 -0
  120. package/dist/components/radiobutton/radiobutton.test.d.ts +28 -0
  121. package/dist/components/select/index.d.ts +4 -0
  122. package/dist/components/select/select.d.ts +48 -0
  123. package/dist/components/select/select.test.d.ts +21 -0
  124. package/dist/components/tabs/index.d.ts +5 -0
  125. package/dist/components/tabs/tabitem.d.ts +33 -0
  126. package/dist/components/tabs/tabs-context.d.ts +21 -0
  127. package/dist/components/tabs/tabs.d.ts +23 -0
  128. package/dist/components/tabs/tabs.test.d.ts +0 -0
  129. package/dist/components/tag/index.d.ts +4 -0
  130. package/dist/components/tag/tag.d.ts +44 -0
  131. package/dist/components/tag/tag.test.d.ts +8 -0
  132. package/dist/components/textarea/index.d.ts +3 -0
  133. package/dist/components/textarea/textarea.d.ts +16 -0
  134. package/dist/components/textarea/textarea.test.d.ts +27 -0
  135. package/dist/components/textinput/index.d.ts +3 -0
  136. package/dist/components/textinput/textinput.d.ts +21 -0
  137. package/dist/components/textinput/textinput.test.d.ts +32 -0
  138. package/dist/components/timepicker/index.d.ts +2 -0
  139. package/dist/components/timepicker/timepicker.d.ts +94 -0
  140. package/dist/components/timepicker/timepicker.test.d.ts +22 -0
  141. package/dist/consent.d.ts +1 -1
  142. package/dist/controllers/pkt-options-controller.d.ts +21 -0
  143. package/dist/controllers/pkt-slot-utils.d.ts +3 -0
  144. package/dist/datepicker.d.ts +1 -1
  145. package/dist/directives/slot-content.d.ts +128 -0
  146. package/dist/directives/slot-content.test.d.ts +0 -0
  147. package/dist/docs/backlink.d.ts +4 -0
  148. package/dist/docs/components/accordion.d.ts +5 -0
  149. package/dist/docs/components/alert.d.ts +7 -0
  150. package/dist/docs/components/backlink.d.ts +4 -0
  151. package/dist/docs/components/breadcrumbs.d.ts +8 -0
  152. package/dist/docs/components/button.d.ts +11 -0
  153. package/dist/docs/components/calendar.d.ts +4 -0
  154. package/dist/docs/components/card.d.ts +27 -0
  155. package/dist/docs/components/checkbox.d.ts +8 -0
  156. package/dist/docs/components/combobox.d.ts +11 -0
  157. package/dist/docs/components/comboboxdemo.d.ts +4 -0
  158. package/dist/docs/components/consent.d.ts +4 -0
  159. package/dist/docs/components/datepicker.d.ts +4 -0
  160. package/dist/docs/components/datepickermultiple.d.ts +4 -0
  161. package/dist/docs/components/form.d.ts +9 -0
  162. package/dist/docs/components/header-full.d.ts +23 -0
  163. package/dist/docs/components/header.d.ts +18 -0
  164. package/dist/docs/components/heading.d.ts +12 -0
  165. package/dist/docs/components/icon.d.ts +4 -0
  166. package/dist/docs/components/input-wrapper.d.ts +4 -0
  167. package/dist/docs/components/link.d.ts +4 -0
  168. package/dist/docs/components/linkcard.d.ts +4 -0
  169. package/dist/docs/components/loader.d.ts +4 -0
  170. package/dist/docs/components/messagebox.d.ts +4 -0
  171. package/dist/docs/components/modal.d.ts +14 -0
  172. package/dist/docs/components/progressbar.d.ts +9 -0
  173. package/dist/docs/components/radiobutton.d.ts +12 -0
  174. package/dist/docs/components/select.d.ts +10 -0
  175. package/dist/docs/components/slots.d.ts +35 -0
  176. package/dist/docs/components/tabs.d.ts +31 -0
  177. package/dist/docs/components/tag.d.ts +4 -0
  178. package/dist/docs/components/textarea.d.ts +4 -0
  179. package/dist/docs/components/textinput.d.ts +4 -0
  180. package/dist/docs/components/timepicker.d.ts +4 -0
  181. package/dist/docs/header.d.ts +14 -0
  182. package/dist/docs/punkt-docs.d.ts +12 -0
  183. package/dist/header.d.ts +1 -1
  184. package/dist/heading.d.ts +1 -1
  185. package/dist/helpers/converters.d.ts +9 -0
  186. package/dist/helptext.d.ts +1 -1
  187. package/dist/icon.d.ts +1 -1
  188. package/dist/index.d.ts +2 -1971
  189. package/dist/input-wrapper.d.ts +1 -1
  190. package/dist/link.d.ts +1 -1
  191. package/dist/linkcard.d.ts +1 -1
  192. package/dist/listbox.d.ts +1 -1
  193. package/dist/loader.d.ts +1 -1
  194. package/dist/messagebox.d.ts +1 -1
  195. package/dist/modal.d.ts +1 -1
  196. package/dist/progressbar.d.ts +1 -1
  197. package/dist/radiobutton.d.ts +1 -1
  198. package/dist/select.d.ts +1 -1
  199. package/dist/shared-types/aria.d.ts +65 -0
  200. package/dist/shared-types/booleanish.d.ts +13 -0
  201. package/dist/shared-types/calendar.d.ts +41 -0
  202. package/dist/shared-types/combobox.d.ts +34 -0
  203. package/dist/shared-types/datepicker.d.ts +46 -0
  204. package/dist/shared-types/form.d.ts +16 -0
  205. package/dist/shared-types/header.d.ts +88 -0
  206. package/dist/shared-types/heading.d.ts +9 -0
  207. package/dist/shared-types/index.d.ts +17 -0
  208. package/dist/shared-types/layout.d.ts +26 -0
  209. package/dist/shared-types/progressbar.d.ts +5 -0
  210. package/dist/shared-types/size.d.ts +18 -0
  211. package/dist/shared-types/skin.d.ts +24 -0
  212. package/dist/shared-types/timepicker.d.ts +20 -0
  213. package/dist/shared-utils/calendar/calendar-grid.d.ts +16 -0
  214. package/dist/shared-utils/calendar/date-validation.d.ts +22 -0
  215. package/dist/shared-utils/calendar/index.d.ts +10 -0
  216. package/dist/shared-utils/calendar/keyboard-navigation.d.ts +16 -0
  217. package/dist/shared-utils/calendar/selection-manager.d.ts +30 -0
  218. package/dist/shared-utils/combobox/index.d.ts +10 -0
  219. package/dist/shared-utils/combobox/input-utils.d.ts +38 -0
  220. package/dist/shared-utils/combobox/keyboard-navigation.d.ts +39 -0
  221. package/dist/shared-utils/combobox/option-utils.d.ts +50 -0
  222. package/dist/shared-utils/combobox/selection-manager.d.ts +71 -0
  223. package/dist/shared-utils/combobox/typeahead.d.ts +24 -0
  224. package/dist/shared-utils/date-utils.d.ts +138 -0
  225. package/dist/shared-utils/datepicker-utils.d.ts +73 -0
  226. package/dist/shared-utils/device-utils.d.ts +10 -0
  227. package/dist/shared-utils/timepicker/index.d.ts +6 -0
  228. package/dist/shared-utils/timepicker/options.d.ts +19 -0
  229. package/dist/shared-utils/timepicker/stepper.d.ts +20 -0
  230. package/dist/shared-utils/timepicker/time-utils.d.ts +19 -0
  231. package/dist/shared-utils/utils.d.ts +16 -0
  232. package/dist/shared-utils/value-utils.d.ts +17 -0
  233. package/dist/tabs.d.ts +1 -1
  234. package/dist/tag.d.ts +1 -1
  235. package/dist/tests/component-registry.d.ts +64 -0
  236. package/dist/tests/test-framework.d.ts +29 -0
  237. package/dist/textarea.d.ts +1 -1
  238. package/dist/textinput.d.ts +1 -1
  239. package/dist/timepicker.d.ts +1 -1
  240. package/dist/translations/no.json.d.ts +93 -0
  241. package/dist/types/index.d.ts +4 -0
  242. package/dist/types/size.d.ts +1 -0
  243. package/dist/types/typeUtils.d.ts +6 -0
  244. package/dist/utils/classutils.d.ts +12 -0
  245. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -5,6 +5,40 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
5
5
 
6
6
  ---
7
7
 
8
+ ## [16.9.1](https://github.com/oslokommune/punkt/compare/16.9.0...16.9.1) (2026-04-22)
9
+
10
+ ### ⚠ BREAKING CHANGES
11
+ Ingen
12
+
13
+ ### Features
14
+ Ingen
15
+
16
+ ### Bug Fixes
17
+ Ingen
18
+
19
+ ### Chores
20
+ Ingen
21
+
22
+ ---
23
+
24
+
25
+ ## [16.9.0](https://github.com/oslokommune/punkt/compare/16.8.3...16.9.0) (2026-04-21)
26
+
27
+ ### ⚠ BREAKING CHANGES
28
+ Ingen
29
+
30
+ ### Features
31
+ Ingen
32
+
33
+ ### Bug Fixes
34
+ Ingen
35
+
36
+ ### Chores
37
+ Ingen
38
+
39
+ ---
40
+
41
+
8
42
  ## [16.8.2](https://github.com/oslokommune/punkt/compare/16.8.1...16.8.2) (2026-04-21)
9
43
 
10
44
  ### ⚠ BREAKING CHANGES
@@ -1 +1 @@
1
- export { }
1
+ export {}
package/dist/alert.d.ts CHANGED
@@ -1 +1 @@
1
- export { }
1
+ export {}
@@ -1 +1 @@
1
- export { }
1
+ export {}
@@ -0,0 +1,21 @@
1
+ import { PktElement } from './element';
2
+ /**
3
+ * Base class for Punkt light DOM elements that use the slotContent directive.
4
+ * Extends PktElement with slot content collection and distribution.
5
+ *
6
+ * Use this instead of PktElement when the component's template uses slotContent().
7
+ * @extends PktElement
8
+ */
9
+ export declare class PktElementWithSlot<T = {}> extends PktElement<T> {
10
+ /**
11
+ * Pre-collect children before Lit's first render clears them.
12
+ * This ensures slotContent() has access to the original children.
13
+ */
14
+ connectedCallback(): void;
15
+ /**
16
+ * Checks if a slot has content distributed to it via the slotContent directive.
17
+ *
18
+ * @param slotName - Name of the slot. Omit for the default slot.
19
+ */
20
+ hasSlotContent(slotName?: string): boolean;
21
+ }
@@ -0,0 +1,32 @@
1
+ import { LitElement } from 'lit';
2
+ import { ElementProps } from '../types/typeUtils';
3
+ type Props = ElementProps<PktElement, 'strings' | 'role'>;
4
+ /**
5
+ * Base class for Punkt shadow DOM elements
6
+ * @extends LitElement
7
+ */
8
+ export declare class PktShadowElement<T = {}> extends LitElement {
9
+ [key: string]: any;
10
+ strings: any;
11
+ role: string | null;
12
+ /**
13
+ * Here to support prop typing in Vue
14
+ */
15
+ $props: T & Props;
16
+ /**
17
+ * Add support for Hot Module Reloading in dev mode
18
+ */
19
+ hotReplacedCallback(): void;
20
+ }
21
+ /**
22
+ * Base class for Punkt light DOM elements
23
+ * This class extends PktShadowElement but renders in light DOM instead of shadow DOM
24
+ * @extends PktShadowElement
25
+ */
26
+ export declare class PktElement<T = {}> extends PktShadowElement<T> {
27
+ /**
28
+ * Make sure the component renders in light DOM instead of shadow DOM
29
+ */
30
+ createRenderRoot(): this;
31
+ }
32
+ export {};
@@ -0,0 +1,173 @@
1
+ import { PropertyValues } from 'lit';
2
+ import { Booleanish } from '../shared-types';
3
+ import { ElementProps } from '../types/typeUtils';
4
+ import { PktOptionsSlotController } from '../controllers/pkt-options-controller';
5
+ import { PktElementWithSlot } from './element-with-slot';
6
+ /**
7
+ * Base interface for input options used in select, combobox, etc.
8
+ */
9
+ export interface PktInputOption {
10
+ value: string;
11
+ label?: string;
12
+ selected?: boolean;
13
+ disabled?: boolean;
14
+ hidden?: boolean;
15
+ }
16
+ type Props = ElementProps<PktInputElement, 'defaultValue' | 'disabled' | 'readonly' | 'required' | 'max' | 'maxlength' | 'min' | 'minlength' | 'ariaDescribedBy' | 'ariaLabelledby' | 'name' | 'pattern' | 'placeholder' | 'id' | 'counter' | 'hasError' | 'hasFieldset' | 'inline' | 'optionalTag' | 'requiredTag' | 'skipForwardTestid' | 'useWrapper' | 'fullwidth' | 'counterMaxLength' | 'errorMessage' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'label' | 'optionalText' | 'requiredText' | 'dataTestid'>;
17
+ /**
18
+ * Base class for all Punkt input elements
19
+ * @extends PktElementWithSlot
20
+ */
21
+ export declare class PktInputElement<T = {}, TOption extends PktInputOption = PktInputOption> extends PktElementWithSlot<Props & T> {
22
+ static get formAssociated(): boolean;
23
+ internals: any;
24
+ form: HTMLFormElement | null;
25
+ checked?: boolean | string | null;
26
+ defaultChecked?: boolean;
27
+ multiple?: boolean;
28
+ range?: boolean;
29
+ type?: string;
30
+ optionsController?: PktOptionsSlotController;
31
+ _options?: TOption[];
32
+ defaultValue: string | string[] | null;
33
+ disabled: boolean;
34
+ readonly: boolean;
35
+ required: boolean;
36
+ max: string | number | null;
37
+ maxlength: number | null;
38
+ min: string | number | null;
39
+ minlength: number | null;
40
+ step: number | null;
41
+ ariaDescribedBy: string | null;
42
+ ariaLabelledby: string | null;
43
+ name: string;
44
+ pattern: string | null;
45
+ placeholder: string | null;
46
+ id: string;
47
+ counter: boolean;
48
+ hasError: boolean;
49
+ inline: boolean;
50
+ hasFieldset: boolean;
51
+ optionalTag: boolean;
52
+ requiredTag: boolean;
53
+ skipForwardTestid: boolean;
54
+ useWrapper: Booleanish;
55
+ fullwidth: boolean;
56
+ counterMaxLength: number;
57
+ errorMessage: string;
58
+ helptext: string;
59
+ helptextDropdown: string;
60
+ helptextDropdownButton: string | null;
61
+ label: string | null;
62
+ optionalText: string;
63
+ requiredText: string;
64
+ tagText: string | null;
65
+ dataTestid: string;
66
+ touched: boolean;
67
+ constructor();
68
+ /**
69
+ * Manages form validation state based on input validity
70
+ * Called automatically by onChange, but can be called manually if needed
71
+ *
72
+ * @param input - The input element to validate (optional)
73
+ * @protected
74
+ */
75
+ protected manageValidity(input?: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): void;
76
+ /**
77
+ * Updates the form value for this input
78
+ * Handles both single values and arrays (for multi-select)
79
+ *
80
+ * @param value - The value(s) to set in the form
81
+ * @protected
82
+ */
83
+ protected setFormValue(value: string | string[]): void;
84
+ /**
85
+ * Coordinates radio button group by unchecking other radios with the same name
86
+ * Only affects radio inputs within the same form
87
+ *
88
+ * @protected
89
+ */
90
+ protected coordinateRadioGroup(): void;
91
+ /**
92
+ * Updates checked state and form value for checkbox and radio inputs
93
+ * Triggers this when you want to set the value of the radio or checkbox input to the form
94
+ * Do not use valueChanged or onChange for radios and checkboxes!
95
+ *
96
+ * @param value - The checked state (string 'true'/'false', or boolean)
97
+ * @protected
98
+ */
99
+ protected valueChecked(value: string | boolean | null): void;
100
+ /**
101
+ * Called when value changes (text inputs, select, etc.)
102
+ * Subclasses can override to add custom value transformation logic
103
+ *
104
+ * @param value - The new value
105
+ * @param _old - The previous value
106
+ * @protected
107
+ * @example
108
+ * ```typescript
109
+ * protected valueChanged(value: string, old: string): void {
110
+ * const transformed = this.transformValue(value)
111
+ * super.valueChanged(transformed, old)
112
+ * }
113
+ * ```
114
+ */
115
+ protected valueChanged(value: string | string[] | null, _old: string | string[] | null): void;
116
+ /**
117
+ * Dispatches change and value-change events
118
+ *
119
+ * @param value - The value to include in the event detail
120
+ * @protected
121
+ */
122
+ protected dispatchChangeEvents(value: unknown): void;
123
+ /**
124
+ * When input goes from content to no content
125
+ * @protected
126
+ */
127
+ protected clearInputValue(): void;
128
+ /**
129
+ * When user enters the input, dispatch focus event
130
+ * @protected
131
+ */
132
+ protected onFocus(): void;
133
+ /**
134
+ * When user leaves the input, dispatch blur event
135
+ * @protected
136
+ */
137
+ protected onBlur(): void;
138
+ /**
139
+ * Trigger this when user types in the input
140
+ * @protected
141
+ */
142
+ protected onInput(): void;
143
+ /**
144
+ * Normalizes value format based on multiple/range settings
145
+ *
146
+ * @param value - The value to normalize
147
+ * @returns Normalized value (array if multiple/range, string otherwise)
148
+ * @private
149
+ */
150
+ private normalizeValue;
151
+ /**
152
+ * Validates the input element(s)
153
+ * @private
154
+ */
155
+ private validate;
156
+ /**
157
+ * Trigger this when you want to set the value of the input out to the form
158
+ * Handles value normalization, form updates, validation, and event dispatching
159
+ *
160
+ * @param value - The value to set
161
+ * @protected
162
+ */
163
+ protected onChange(value: string | string[]): void;
164
+ /**
165
+ * Called when the form is reset
166
+ * Resets the input to its default state
167
+ * @protected
168
+ */
169
+ protected formResetCallback(): void;
170
+ protected updated(_changedProperties: PropertyValues): void;
171
+ protected firstUpdated(_changedProperties: PropertyValues): void;
172
+ }
173
+ export {};
@@ -0,0 +1,73 @@
1
+ import { PktInputElement, PktInputOption } from './input-element';
2
+ import { PktOptionsSlotController } from '../controllers/pkt-options-controller';
3
+ import { ElementProps } from '../types/typeUtils';
4
+ export type { PktInputOption } from './input-element';
5
+ type Props = ElementProps<PktOptionsInputElement, 'options'>;
6
+ /**
7
+ * Base class for input elements that have options (select, combobox, etc.)
8
+ * Provides common functionality for managing options from props or slots
9
+ * @extends PktInputElement
10
+ */
11
+ export declare abstract class PktOptionsInputElement<T = {}, TOption extends PktInputOption = PktInputOption> extends PktInputElement<Props & T, TOption> {
12
+ /**
13
+ * Options passed as a prop
14
+ * @private
15
+ */
16
+ protected _optionsProp: TOption[];
17
+ /**
18
+ * Internal state for parsed options
19
+ * @protected
20
+ */
21
+ _options: TOption[];
22
+ /**
23
+ * Controller for managing options from slots
24
+ */
25
+ optionsController: PktOptionsSlotController;
26
+ /**
27
+ * Public getter for options that includes selected state
28
+ * Override this in subclasses to customize the selected state logic
29
+ */
30
+ get options(): TOption[];
31
+ /**
32
+ * Public setter for options
33
+ */
34
+ set options(value: TOption[]);
35
+ /**
36
+ * Determines if an option is selected
37
+ * Subclasses should override this to implement their selection logic
38
+ *
39
+ * @param option - The option to check
40
+ * @returns True if the option is selected
41
+ * @protected
42
+ */
43
+ protected isOptionSelected(option: TOption): boolean;
44
+ /**
45
+ * Finds an option by its value
46
+ *
47
+ * @param value - The value to search for
48
+ * @returns The option if found, undefined otherwise
49
+ * @protected
50
+ */
51
+ protected findOptionByValue(value: string): TOption | undefined;
52
+ /**
53
+ * Gets all currently selected options
54
+ *
55
+ * @returns Array of selected options
56
+ * @protected
57
+ */
58
+ protected getSelectedOptions(): TOption[];
59
+ /**
60
+ * Parses options from either props or slot controller
61
+ * Call this in connectedCallback to initialize options
62
+ *
63
+ * @protected
64
+ */
65
+ protected parseOptions(): void;
66
+ /**
67
+ * Re-parse options when the component updates
68
+ * This ensures options stay in sync when they change dynamically
69
+ *
70
+ * @protected
71
+ */
72
+ protected willUpdate(_changedProperties: Map<PropertyKey, unknown>): void;
73
+ }
@@ -1 +1 @@
1
- export { }
1
+ export {}
package/dist/button.d.ts CHANGED
@@ -1 +1 @@
1
- export { }
1
+ export {}
@@ -1 +1 @@
1
- export { }
1
+ export {}
package/dist/card.d.ts CHANGED
@@ -1 +1 @@
1
- export { }
1
+ export {}
@@ -1 +1 @@
1
- export { }
1
+ export {}
@@ -1 +1 @@
1
- export { }
1
+ export {}
@@ -0,0 +1,20 @@
1
+ import { LitElement } from 'lit';
2
+ import { TAccordionSkin } from '../../shared-types';
3
+ export type TPktAccordionSkin = TAccordionSkin;
4
+ export interface IPktAccordion {
5
+ compact?: boolean;
6
+ skin?: TPktAccordionSkin;
7
+ ariaLabelledBy?: string;
8
+ name?: string;
9
+ }
10
+ export declare class PktAccordion extends LitElement implements IPktAccordion {
11
+ ariaLabelledBy: string;
12
+ compact: boolean;
13
+ skin: TPktAccordionSkin;
14
+ name: string;
15
+ updated(changedProperties: Map<string, any>): void;
16
+ private updateAccordionItemNames;
17
+ firstUpdated(): void;
18
+ render(): import('lit-html').TemplateResult<1>;
19
+ }
20
+ export default PktAccordion;
File without changes
@@ -0,0 +1,32 @@
1
+ import { PktElementWithSlot } from '../../base-elements/element-with-slot';
2
+ import { PropertyValues } from 'lit';
3
+ import { Ref } from 'lit/directives/ref.js';
4
+ import { TPktAccordionSkin } from './accordion';
5
+ /**
6
+ * @param toggleProps
7
+ *
8
+ * @description Send in an "isOpen" boolean and "onToggleClick" function
9
+ * to override the automatic toggling
10
+ */
11
+ export interface IPktAccordionItem {
12
+ defaultOpen?: boolean;
13
+ id: string;
14
+ title: string;
15
+ skin?: TPktAccordionSkin;
16
+ compact?: boolean;
17
+ isOpen?: boolean;
18
+ name?: string | undefined;
19
+ }
20
+ export declare class PktAccordionItem extends PktElementWithSlot implements IPktAccordionItem {
21
+ defaultOpen: boolean;
22
+ title: string;
23
+ skin: TPktAccordionSkin | undefined;
24
+ compact: boolean;
25
+ isOpen: boolean;
26
+ name: string | undefined;
27
+ accordionItemRef: Ref<HTMLDivElement>;
28
+ constructor();
29
+ protected firstUpdated(_changedProperties: PropertyValues): void;
30
+ render(): import('lit-html').TemplateResult<1>;
31
+ }
32
+ export default PktAccordionItem;
@@ -0,0 +1,5 @@
1
+ import { default as PktAccordion, IPktAccordion, TPktAccordionSkin } from './accordion';
2
+ import { default as PktAccordionItem, IPktAccordionItem } from './accordionitem';
3
+ export { PktAccordion, PktAccordionItem };
4
+ export type { IPktAccordion, IPktAccordionItem, TPktAccordionSkin };
5
+ export default PktAccordion;
@@ -0,0 +1,30 @@
1
+ import { PropertyValues } from 'lit';
2
+ import { PktElementWithSlot } from '../../base-elements/element-with-slot';
3
+ import { TAriaLive, TAlertSkin } from '../../shared-types';
4
+ export type { TAlertSkin };
5
+ export interface IPktAlert {
6
+ skin?: TAlertSkin;
7
+ closeAlert?: boolean;
8
+ title?: string;
9
+ date?: string | null;
10
+ ariaLive?: TAriaLive | null;
11
+ compact?: boolean;
12
+ role?: string;
13
+ }
14
+ export declare class PktAlert extends PktElementWithSlot implements IPktAlert {
15
+ constructor();
16
+ compact: boolean;
17
+ title: string;
18
+ skin: TAlertSkin;
19
+ ariaLive: TAriaLive;
20
+ ariaLiveAttr: TAriaLive | null;
21
+ closeAlert: boolean;
22
+ date: string | null;
23
+ role: string;
24
+ _isClosed: boolean;
25
+ connectedCallback(): void;
26
+ attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
27
+ protected updated(_changedProperties: PropertyValues): void;
28
+ render(): import('lit-html').TemplateResult<1>;
29
+ private close;
30
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseTestConfig } from '../../tests/test-framework';
2
+ export interface AlertTestConfig extends BaseTestConfig {
3
+ skin?: string;
4
+ compact?: boolean;
5
+ title?: string;
6
+ date?: string;
7
+ closeAlert?: boolean;
8
+ ariaLive?: string;
9
+ }
10
+ export declare const createAlertTest: (config?: AlertTestConfig) => Promise<{
11
+ container: HTMLElement;
12
+ alert: import('./alert').PktAlert;
13
+ }>;
@@ -0,0 +1,3 @@
1
+ import { PktAlert, IPktAlert, TAlertSkin } from './alert';
2
+ export { PktAlert, IPktAlert, TAlertSkin };
3
+ export default PktAlert;
@@ -0,0 +1,14 @@
1
+ import { PktElement } from '../../base-elements/element';
2
+ export interface IPktBackLink {
3
+ href?: string;
4
+ text?: string;
5
+ ariaLabel?: string;
6
+ }
7
+ export declare class PktBackLink extends PktElement<IPktBackLink> implements IPktBackLink {
8
+ href: string;
9
+ text: string;
10
+ ariaLabel: string;
11
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
12
+ render(): import('lit-html').TemplateResult<1>;
13
+ }
14
+ export default PktBackLink;
@@ -0,0 +1,10 @@
1
+ import { BaseTestConfig } from '../../tests/test-framework';
2
+ export interface BacklinkTestConfig extends BaseTestConfig {
3
+ href?: string;
4
+ text?: string;
5
+ ariaLabel?: string;
6
+ }
7
+ export declare const createBacklinkTest: (config?: BacklinkTestConfig) => Promise<{
8
+ container: HTMLElement;
9
+ backlink: import('./backlink').PktBackLink;
10
+ }>;
@@ -0,0 +1,4 @@
1
+ import { PktBackLink } from './backlink';
2
+ export type { IPktBackLink } from './backlink';
3
+ export { PktBackLink };
4
+ export default PktBackLink;
@@ -0,0 +1,15 @@
1
+ import { nothing } from 'lit';
2
+ import { PktElement } from '../../base-elements/element';
3
+ export interface IBreadcrumbItem {
4
+ text: string;
5
+ href: string;
6
+ }
7
+ export interface IPktBreadcrumbs {
8
+ breadcrumbs: IBreadcrumbItem[];
9
+ }
10
+ export declare class PktBreadcrumbs extends PktElement implements IPktBreadcrumbs {
11
+ breadcrumbs: IBreadcrumbItem[];
12
+ private handleLinkClick;
13
+ render(): typeof nothing | import('lit-html').TemplateResult<1>;
14
+ }
15
+ export default PktBreadcrumbs;
@@ -0,0 +1,2 @@
1
+ export { PktBreadcrumbs } from './breadcrumbs';
2
+ export type { IBreadcrumbItem, IPktBreadcrumbs } from './breadcrumbs';
@@ -0,0 +1,53 @@
1
+ import { PktElementWithSlot } from '../../base-elements/element-with-slot';
2
+ import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon';
3
+ import { Booleanish, THTMLButtonType } from '../../shared-types';
4
+ import { PropertyValues } from 'lit';
5
+ export type TPktButtonMode = 'light' | 'dark';
6
+ export type TPktButtonSize = 'small' | 'medium' | 'large';
7
+ export type TPktButtonColor = 'blue' | 'blue-outline' | 'green' | 'green-outline' | 'green-dark' | 'green-dark-outline' | 'beige-light' | 'beige-dark-outline' | 'yellow' | 'yellow-outline' | 'red' | 'red-outline';
8
+ export type TPktButtonSkin = 'primary' | 'secondary' | 'tertiary';
9
+ export type TPktButtonVariant = 'label-only' | 'icon-left' | 'icon-right' | 'icon-only' | 'icons-right-and-left';
10
+ export type TPktButtonState = 'normal' | 'focus' | 'hover' | 'active';
11
+ export type TPktButtonType = THTMLButtonType;
12
+ export interface IPktButton {
13
+ iconName?: PktIconName;
14
+ secondIconName?: PktIconName;
15
+ iconPath?: string;
16
+ secondIconPath?: string;
17
+ mode?: TPktButtonMode;
18
+ size?: TPktButtonSize;
19
+ fullWidth?: Booleanish;
20
+ fullWidthOnMobile?: Booleanish;
21
+ color?: TPktButtonColor;
22
+ skin?: TPktButtonSkin;
23
+ variant?: TPktButtonVariant;
24
+ state?: TPktButtonState;
25
+ type?: TPktButtonType;
26
+ isLoading?: Booleanish;
27
+ disabled?: Booleanish;
28
+ loadingAnimationPath?: string;
29
+ }
30
+ export declare class PktButton extends PktElementWithSlot<IPktButton> implements IPktButton {
31
+ iconName: string;
32
+ secondIconName: string;
33
+ iconPath: string | undefined;
34
+ secondIconPath: string | undefined;
35
+ mode?: TPktButtonMode;
36
+ size: TPktButtonSize;
37
+ fullWidth: Booleanish;
38
+ fullWidthOnMobile: Booleanish;
39
+ color?: TPktButtonColor;
40
+ skin: TPktButtonSkin;
41
+ variant: TPktButtonVariant;
42
+ state?: TPktButtonState;
43
+ type: TPktButtonType;
44
+ form: string | undefined;
45
+ isLoading: Booleanish;
46
+ disabled: Booleanish;
47
+ loadingAnimationPath: string | undefined;
48
+ connectedCallback(): void;
49
+ attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
50
+ protected firstUpdated(_changedProperties: PropertyValues): void;
51
+ render(): import('lit-html').TemplateResult<1>;
52
+ }
53
+ export default PktButton;
@@ -0,0 +1,22 @@
1
+ import { BaseTestConfig } from '../../tests/test-framework';
2
+ export interface ButtonTestConfig extends BaseTestConfig {
3
+ size?: string;
4
+ skin?: string;
5
+ variant?: string;
6
+ color?: string;
7
+ type?: string;
8
+ disabled?: boolean;
9
+ isLoading?: boolean;
10
+ iconName?: string;
11
+ iconNameSecond?: string;
12
+ iconPath?: string;
13
+ secondIconPath?: string;
14
+ iconPosition?: string;
15
+ mode?: string;
16
+ form?: string;
17
+ content?: string;
18
+ }
19
+ export declare const createButtonTest: (config?: ButtonTestConfig) => Promise<{
20
+ container: HTMLElement;
21
+ button: import('./button').PktButton;
22
+ }>;
@@ -0,0 +1,4 @@
1
+ import { PktButton } from './button';
2
+ export type { IPktButton, TPktButtonMode, TPktButtonSize, TPktButtonColor, TPktButtonSkin, TPktButtonVariant, TPktButtonState, TPktButtonType, } from './button';
3
+ export { PktButton };
4
+ export default PktButton;
@@ -0,0 +1,16 @@
1
+ import { BaseTestConfig } from '../../tests/test-framework';
2
+ export interface CalendarTestConfig extends BaseTestConfig {
3
+ withcontrols?: boolean;
4
+ weeknumbers?: boolean;
5
+ multiple?: boolean;
6
+ range?: boolean;
7
+ earliest?: string;
8
+ latest?: string;
9
+ currentmonth?: string;
10
+ excludedates?: string;
11
+ excludeweekdays?: string;
12
+ }
13
+ export declare const createCalendarTest: (config?: CalendarTestConfig) => Promise<{
14
+ container: HTMLElement;
15
+ calendar: import('./calendar').PktCalendar;
16
+ }>;