@oslokommune/punkt-elements 19.5.2 → 19.7.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 (71) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/base-elements/input-element.d.ts +3 -2
  3. package/dist/{checkbox-_NnoYkue.cjs → checkbox-D69leWDh.cjs} +3 -3
  4. package/dist/{checkbox-Bbxt-tVW.js → checkbox-Tq8ESzwH.js} +6 -3
  5. package/dist/combobox-BfdvXLBz.cjs +139 -0
  6. package/dist/{combobox-CjLX_Gfd.js → combobox-CMpYhgln.js} +47 -423
  7. package/dist/components/checkbox/checkbox.d.ts +2 -1
  8. package/dist/components/combobox/combobox-base.d.ts +2 -2
  9. package/dist/components/combobox/combobox.d.ts +9 -26
  10. package/dist/components/input-wrapper/input-wrapper.d.ts +5 -2
  11. package/dist/components/radiobutton/radiobutton.d.ts +2 -0
  12. package/dist/{datepicker-CFCRxFQL.js → datepicker-Bs7Z3EFn.js} +1 -1
  13. package/dist/{datepicker-Bk-m5Zaa.cjs → datepicker-CWHYYj-H.cjs} +1 -1
  14. package/dist/docs/components/radio-checkbox-sizes.d.ts +10 -0
  15. package/dist/{fileupload-B2606SvG.js → fileupload-BQFJx1ok.js} +1 -1
  16. package/dist/{fileupload-COAxc3sX.cjs → fileupload-CMIFZWJ5.cjs} +1 -1
  17. package/dist/{header-BhM7FRoC.cjs → header-C4Uojzoy.cjs} +1 -1
  18. package/dist/{header-BQdc29IO.js → header-Cc1Cy0U3.js} +1 -1
  19. package/dist/{input-wrapper-Bz9GwYrn.js → input-wrapper-BoTugCvh.js} +13 -3
  20. package/dist/{input-wrapper-BBG8EXQ8.cjs → input-wrapper-J3mEKhvR.cjs} +3 -3
  21. package/dist/pkt-checkbox.cjs +1 -1
  22. package/dist/pkt-checkbox.js +1 -1
  23. package/dist/pkt-combobox.cjs +1 -1
  24. package/dist/pkt-combobox.js +1 -1
  25. package/dist/pkt-datepicker.cjs +1 -1
  26. package/dist/pkt-datepicker.js +1 -1
  27. package/dist/pkt-fileupload.cjs +1 -1
  28. package/dist/pkt-fileupload.js +1 -1
  29. package/dist/pkt-header.cjs +1 -1
  30. package/dist/pkt-header.js +1 -1
  31. package/dist/pkt-index.cjs +1 -1
  32. package/dist/pkt-index.js +17 -17
  33. package/dist/pkt-input-wrapper.cjs +1 -1
  34. package/dist/pkt-input-wrapper.js +1 -1
  35. package/dist/pkt-radiobutton.cjs +1 -1
  36. package/dist/pkt-radiobutton.js +1 -1
  37. package/dist/pkt-select.cjs +1 -1
  38. package/dist/pkt-select.js +1 -1
  39. package/dist/pkt-textarea.cjs +1 -1
  40. package/dist/pkt-textarea.js +1 -1
  41. package/dist/pkt-textinput.cjs +1 -1
  42. package/dist/pkt-textinput.js +1 -1
  43. package/dist/pkt-timepicker.cjs +1 -1
  44. package/dist/pkt-timepicker.js +1 -1
  45. package/dist/{radiobutton-C3kEjvHQ.cjs → radiobutton-BPr22VmL.cjs} +3 -3
  46. package/dist/{radiobutton-D9htviZG.js → radiobutton-l_3oGDbb.js} +6 -3
  47. package/dist/{select-BuQxosyi.cjs → select-CZYQ5Dmx.cjs} +1 -1
  48. package/dist/{select-BizHes0n.js → select-DYjKMmHa.js} +1 -1
  49. package/dist/shared-types/checkbox.d.ts +3 -1
  50. package/dist/shared-types/combobox.d.ts +73 -5
  51. package/dist/shared-types/index.d.ts +3 -1
  52. package/dist/shared-types/size.d.ts +3 -2
  53. package/dist/{textarea-CL1yUDVL.js → textarea-C2oaRlfb.js} +1 -1
  54. package/dist/{textarea-BXadsEdL.cjs → textarea-H1Lt2o6K.cjs} +1 -1
  55. package/dist/{textinput-Csil0Zda.js → textinput-C0eu70sH.js} +1 -1
  56. package/dist/{textinput-qi0f5NZH.cjs → textinput-C2Tx-OrN.cjs} +1 -1
  57. package/dist/{timepicker-DNoYMBAL.js → timepicker-B8TwchA2.js} +1 -1
  58. package/dist/{timepicker-CvL2-Siz.cjs → timepicker-DZG_gHIa.cjs} +1 -1
  59. package/package.json +2 -2
  60. package/src/components/checkbox/checkbox.test.ts +26 -0
  61. package/src/components/checkbox/checkbox.ts +3 -2
  62. package/src/components/combobox/combobox-base.ts +14 -8
  63. package/src/components/combobox/combobox-value.ts +2 -2
  64. package/src/components/combobox/combobox.attributes.test.ts +3 -2
  65. package/src/components/combobox/combobox.ts +26 -26
  66. package/src/components/input-wrapper/input-wrapper.test.ts +54 -0
  67. package/src/components/input-wrapper/input-wrapper.ts +12 -2
  68. package/src/components/input-wrapper/wrapper-parity.test.ts +9 -0
  69. package/src/components/radiobutton/radiobutton.test.ts +26 -0
  70. package/src/components/radiobutton/radiobutton.ts +3 -1
  71. package/dist/combobox-BBx87DCG.cjs +0 -139
@@ -10,9 +10,24 @@ import { t as f } from "./repeat-CdxGS-_3.js";
10
10
  import { a as p, c as m, i as h, l as g, o as _, r as v, s as y } from "./listbox-Ct9jIV_5.js";
11
11
  import { t as b } from "./input-element-lLzfwdim.js";
12
12
  import { t as x } from "./pkt-options-controller-D7l18Iw0.js";
13
- import { r as S } from "./input-wrapper-Bz9GwYrn.js";
14
- //#region ../../shared-utils/combobox/input-utils.ts
15
- var C = (e, t, n) => {
13
+ import { r as S } from "./input-wrapper-BoTugCvh.js";
14
+ //#region ../../shared-types/combobox.ts
15
+ var C = {
16
+ multiple: !1,
17
+ typeahead: !1,
18
+ includeSearch: !1,
19
+ allowUserInput: !1,
20
+ displayValueAs: "label",
21
+ inputSize: "medium",
22
+ disabled: !1,
23
+ hasError: !1,
24
+ required: !1,
25
+ requiredTag: !1,
26
+ optionalTag: !1,
27
+ fullwidth: !1,
28
+ inline: !1,
29
+ useWrapper: !0
30
+ }, w = (e, t, n) => {
16
31
  switch (e) {
17
32
  case ",": return n ? "addValue" : null;
18
33
  case "Enter": return "addValue";
@@ -21,7 +36,7 @@ var C = (e, t, n) => {
21
36
  case "Escape": return "closeOptions";
22
37
  default: return null;
23
38
  }
24
- }, w = (e, t, n, r, i) => {
39
+ }, T = (e, t, n, r, i) => {
25
40
  if (!e) return {
26
41
  action: "none",
27
42
  value: null
@@ -43,7 +58,7 @@ var C = (e, t, n) => {
43
58
  action: "none",
44
59
  value: null
45
60
  };
46
- }, T = (e, t, n, r, i) => e.trim().toLowerCase() ? {
61
+ }, E = (e, t, n, r, i) => e.trim().toLowerCase() ? {
47
62
  ...m(e, t, n, r),
48
63
  shouldRemoveValue: !1,
49
64
  shouldResetInput: !1
@@ -52,10 +67,10 @@ var C = (e, t, n) => {
52
67
  userInfoMessage: "",
53
68
  shouldRemoveValue: !i && !!t[0],
54
69
  shouldResetInput: !0
55
- }, E = (e, t, n) => {
70
+ }, D = (e, t, n) => {
56
71
  let r = h(t, e);
57
72
  return n === "label" && r?.label ? r.label : e;
58
- }, D = {
73
+ }, O = {
59
74
  markOptionSelected(e, t) {
60
75
  if (t) {
61
76
  for (let n of e) if (n.value === t) {
@@ -81,7 +96,7 @@ var C = (e, t, n) => {
81
96
  removeUserAddedOptions(e) {
82
97
  return e.filter((e) => !e.userAdded);
83
98
  }
84
- }, O = { parseOptionsFromSlot(e) {
99
+ }, k = { parseOptionsFromSlot(e) {
85
100
  let t = [];
86
101
  return e.forEach((e) => {
87
102
  if (!e.textContent && !e.getAttribute("value")) return;
@@ -91,7 +106,7 @@ var C = (e, t, n) => {
91
106
  };
92
107
  e.getAttribute("data-prefix") && (n.prefix = e.getAttribute("data-prefix") || void 0), e.getAttribute("tagskincolor") && (n.tagSkinColor = e.getAttribute("tagskincolor")), e.getAttribute("description") && (n.description = e.getAttribute("description") || void 0), n.fulltext = v(n), t.push(n);
93
108
  }), t;
94
- } }, k = {
109
+ } }, A = {
95
110
  cloneOptions(e) {
96
111
  return Array.isArray(e) ? e.map((e) => ({ ...e })) : [];
97
112
  },
@@ -107,400 +122,9 @@ var C = (e, t, n) => {
107
122
  mergeWithUserAdded(e, t, n) {
108
123
  return [...t.filter((e) => e?.userAdded && n.includes(e.value)).filter((t) => !(Array.isArray(e) ? e : []).some((e) => e.value === t.value)), ...e];
109
124
  }
110
- }, A = {
111
- name: "pkt-combobox",
112
- react: "PktCombobox",
113
- "css-class": "pkt-combobox",
114
- isElement: !0,
115
- isPureReact: !0,
116
- "dark-mode": !0,
117
- props: {
118
- name: {
119
- type: "string",
120
- name: "Navn",
121
- description: "Navn som brukes i skjema ved innsending",
122
- category: "tech"
123
- },
124
- form: {
125
- name: "Skjema",
126
- description: "ID-en til skjemaet feltet hører til, når feltet ligger utenfor skjemaet",
127
- type: "string",
128
- required: !1,
129
- category: "tech"
130
- },
131
- id: {
132
- type: "string",
133
- name: "ID",
134
- description: "Unik ID for feltet",
135
- category: "tech"
136
- },
137
- label: {
138
- type: "string",
139
- name: "Etikett/label",
140
- description: "Tekst som vises over feltet",
141
- category: "contents"
142
- },
143
- placeholder: {
144
- name: "Hint",
145
- description: "Spesifiserer en kort hint som beskriver forventet verdi av feltet.",
146
- type: "string",
147
- category: "contents",
148
- required: !1
149
- },
150
- multiple: {
151
- type: "boolean",
152
- name: "Flervalg",
153
- default: !1,
154
- description: "Mulighet for å velge flere valg",
155
- category: "functionality"
156
- },
157
- tagPlacement: {
158
- attribute: "tag-placement",
159
- type: ["inside", "outside"],
160
- name: "Plassering av tags i flervalg",
161
- description: "Plassering av valgte verdier i feltet ved flervalg",
162
- category: "functionality",
163
- showIf: { multiple: !0 }
164
- },
165
- maxlength: {
166
- type: "number",
167
- name: "Maks antall i flervalg",
168
- description: "Maks antall valg dersom flervalg er aktivert",
169
- category: "functionality",
170
- showIf: { multiple: !0 }
171
- },
172
- typeahead: {
173
- type: "boolean",
174
- name: "Typeahead",
175
- default: !1,
176
- description: "Mulighet for automatisk utfylling av feltet fra listen over valg",
177
- category: "functionality"
178
- },
179
- includeSearch: {
180
- attribute: "include-search",
181
- type: "boolean",
182
- name: "Inkluder søk",
183
- description: "Mulighet for å søke etter valg inni dropdown",
184
- category: "functionality"
185
- },
186
- allowUserInput: {
187
- attribute: "allow-user-input",
188
- type: "boolean",
189
- name: "Brukervalgte verdier",
190
- description: "Mulighet for å skrive inn egne verdier",
191
- category: "functionality"
192
- },
193
- searchPlaceholder: {
194
- attribute: "search-placeholder",
195
- type: "string",
196
- name: "Søke-plassholder",
197
- description: "Plassholdertekst for søkefeltet i dropdown",
198
- category: "contents",
199
- showIf: { includeSearch: !0 }
200
- },
201
- displayValueAs: {
202
- attribute: "display-value-as",
203
- type: [
204
- "label",
205
- "value",
206
- "prefixAndValue"
207
- ],
208
- name: "Visning av valgt verdi",
209
- description: "Hvordan valgt verdi vises i feltet",
210
- default: "label",
211
- category: "ui"
212
- },
213
- inputSize: {
214
- name: "Størrelse",
215
- description: "Visuell størrelse via input-wrapper. small: kompakt wrapper og felt (42px). xsmall: samme wrapper som small, felt 36px.",
216
- attribute: "input-size",
217
- type: [
218
- "small",
219
- "medium",
220
- "xsmall"
221
- ],
222
- default: "medium",
223
- category: "ui"
224
- },
225
- value: {
226
- name: "Verdi",
227
- type: "string",
228
- description: "Valgt verdi. Streng ved enkelt valg, array av strenger ved flervalg.",
229
- category: "tech"
230
- },
231
- helptext: {
232
- type: "string",
233
- name: "Hjelpetekst",
234
- description: "Hjelpetekst som vises over feltet",
235
- category: "contents"
236
- },
237
- helptextDropdown: {
238
- attribute: "helptextdropdown",
239
- type: "string",
240
- name: "Utvidet hjelpetekst",
241
- description: "Hjelpetekst som vises i en lukket boks man kan åpne",
242
- category: "contents"
243
- },
244
- helptextDropdownButton: {
245
- attribute: "helptextdropdownbutton",
246
- type: "string",
247
- name: "Knappetekst for hjelpetekst",
248
- description: "Tekst som vises på knappen for å åpne/lukke utvidet hjelpetekst",
249
- category: "contents",
250
- default: "Les mer"
251
- },
252
- disabled: {
253
- type: "boolean",
254
- name: "Deaktivert",
255
- description: "Feltet er deaktivert",
256
- category: "tech"
257
- },
258
- hasError: {
259
- attribute: "haserror",
260
- type: "boolean",
261
- name: "Feil",
262
- description: "Feltet har en feil",
263
- category: "ui"
264
- },
265
- errorMessage: {
266
- attribute: "errormessage",
267
- type: "string",
268
- name: "Feilmelding",
269
- description: "Tekst som vises under feltet ved feil",
270
- category: "contents"
271
- },
272
- required: {
273
- type: "boolean",
274
- name: "Påkrevd",
275
- description: "Feltet må fylles ut",
276
- category: "tech"
277
- },
278
- requiredTag: {
279
- attribute: "requiredtag",
280
- type: "boolean",
281
- name: "Påkrevd-merking",
282
- description: "Viser en merking som indikerer at feltet er påkrevd",
283
- category: "ui"
284
- },
285
- requiredText: {
286
- attribute: "requiredtext",
287
- type: "string",
288
- name: "Påkrevd-tekst",
289
- description: "Tekst som vises i påkrevd-merkingen",
290
- category: "contents"
291
- },
292
- optionalTag: {
293
- attribute: "optionaltag",
294
- type: "boolean",
295
- name: "Valgfritt-merking",
296
- description: "Viser en merking som indikerer at feltet er valgfritt",
297
- category: "ui"
298
- },
299
- optionalText: {
300
- attribute: "optionaltext",
301
- type: "string",
302
- name: "Valgfritt-tekst",
303
- description: "Tekst som vises i valgfritt-merkingen",
304
- category: "contents"
305
- },
306
- tagText: {
307
- attribute: "tagtext",
308
- type: "string",
309
- name: "Tag-tekst",
310
- description: "Tekst som vises i en tag ved siden av label",
311
- category: "ui"
312
- },
313
- fullwidth: {
314
- type: "boolean",
315
- name: "Full bredde",
316
- description: "Skal feltet ta opp hele bredden?",
317
- category: "ui"
318
- },
319
- defaultOptions: {
320
- attribute: "default-options",
321
- name: "Initielle valg (default options)",
322
- description: "Liste over valg som kan velges, om options sendes inn som array med objekter (denne vil ikke modifiseres ved endring innad i komponenten)",
323
- type: "IPktComboboxOption[]",
324
- default: [],
325
- previewDefault: [
326
- {
327
- value: "bfr",
328
- label: "Frogner"
329
- },
330
- {
331
- value: "bgo",
332
- label: "Gamle Oslo"
333
- },
334
- {
335
- value: "bgr",
336
- label: "Grorud"
337
- },
338
- {
339
- value: "bxx",
340
- label: "Andre bydeler"
341
- }
342
- ],
343
- items: {
344
- type: "object",
345
- properties: {
346
- value: {
347
- type: "string",
348
- description: "Verdi som sendes ved valg"
349
- },
350
- label: {
351
- type: "string",
352
- description: "Tekst som vises for valget"
353
- },
354
- prefix: {
355
- type: "string",
356
- description: "Tekst som vises før valget"
357
- },
358
- description: {
359
- type: "string",
360
- description: "Beskrivelse av valget"
361
- },
362
- disabled: {
363
- type: "boolean",
364
- description: "Valget er deaktivert"
365
- },
366
- selected: {
367
- type: "boolean",
368
- description: "Valget er valgt"
369
- },
370
- tagSkinColor: {
371
- type: [
372
- "blue",
373
- "blue-dark",
374
- "blue-light",
375
- "green",
376
- "red",
377
- "yellow",
378
- "beige",
379
- "gray",
380
- "grey"
381
- ],
382
- description: "Farge på tag"
383
- }
384
- },
385
- required: ["value"]
386
- },
387
- category: "contents"
388
- },
389
- options: {
390
- name: "Valg",
391
- type: "IPktComboboxOption[]",
392
- description: "Liste over valg som kan velges, om options sendes inn som array med objekter",
393
- default: [],
394
- items: {
395
- type: "object",
396
- properties: {
397
- value: {
398
- type: "string",
399
- description: "Verdi som sendes ved valg"
400
- },
401
- label: {
402
- type: "string",
403
- description: "Tekst som vises for valget"
404
- },
405
- prefix: {
406
- type: "string",
407
- description: "Tekst som vises før valget"
408
- },
409
- description: {
410
- type: "string",
411
- description: "Beskrivelse av valget"
412
- },
413
- disabled: {
414
- type: "boolean",
415
- description: "Valget er deaktivert"
416
- },
417
- selected: {
418
- type: "boolean",
419
- description: "Valget er valgt"
420
- },
421
- tagSkinColor: {
422
- type: [
423
- "blue",
424
- "blue-dark",
425
- "blue-light",
426
- "green",
427
- "red",
428
- "yellow",
429
- "beige",
430
- "gray",
431
- "grey"
432
- ],
433
- description: "Farge på tag"
434
- }
435
- },
436
- required: ["value"]
437
- },
438
- category: "contents"
439
- },
440
- inline: {
441
- name: "Inline",
442
- type: "boolean",
443
- required: !1,
444
- default: !1,
445
- description: "Angir om feltet skal flyte med teksten",
446
- category: "ui"
447
- },
448
- useWrapper: {
449
- attribute: "usewrapper",
450
- name: "Bruk wrapper",
451
- type: "boolean",
452
- required: !1,
453
- displayAsFalse: !0,
454
- default: !0,
455
- description: "Indikerer om skjemaelementet skal bruke en wrapper",
456
- category: "ui"
457
- },
458
- hasFieldset: {
459
- attribute: "hasfieldset",
460
- name: "Bruk fieldset",
461
- type: "boolean",
462
- required: !1,
463
- default: null,
464
- description: "Bruk fieldset og legend i stedet for label. Utledes automatisk når feltet ikke har en input.",
465
- category: "ui"
466
- },
467
- counter: {
468
- name: "Teller",
469
- type: "boolean",
470
- required: !1,
471
- default: null,
472
- description: "Viser teller under feltet. Slås på av seg selv når det finnes en grense å telle mot; sett til false for å skru den av.",
473
- category: "ui"
474
- },
475
- defaultValue: {
476
- attribute: "defaultvalue",
477
- type: "string | string[]",
478
- name: "Standardverdi",
479
- description: "Verdien feltet får ved oppstart og ved nullstilling av skjemaet",
480
- category: "functionality"
481
- }
482
- },
483
- events: {
484
- change: {
485
- type: "Event",
486
- description: "Returnerer valgt verdi som streng. Ved flervalg returneres kommaseparerte verdier."
487
- },
488
- "value-change": {
489
- type: "CustomEvent",
490
- description: "Returnerer valgt verdi. Ved enkeltvalg en streng, ved flervalg en <code>string[]</code>."
491
- },
492
- search: {
493
- type: "CustomEvent",
494
- description: "Returnerer søketeksten som streng i <code>event.detail</code> når brukeren skriver i søkefeltet"
495
- },
496
- toggleHelpText: {
497
- type: "CustomEvent",
498
- description: "Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes"
499
- }
500
- }
501
125
  }, j = class extends b {
502
126
  constructor() {
503
- super(), this.value = "", this.options = [], this.defaultOptions = [], this.allowUserInput = !1, this.typeahead = !1, this.includeSearch = !1, this.searchPlaceholder = null, this.multiple = !1, this.maxlength = null, this.displayValueAs = A.props.displayValueAs.default, this.tagPlacement = null, this.isOpen = !1, this._options = [], this._value = [], this._isOptionsOpen = !1, this._userInfoMessage = "", this._messageValue = null, this._addValueText = null, this._maxIsReached = !1, this._search = "", this._inputFocus = !1, this._skipInputTab = !1, this._optionsFromSlot = !1, this._lastSlotGeneration = 0, this._suppressNextOpen = !1, this.inputRef = d(), this.triggerRef = d(), this.listboxRef = d(), this._pendingDispatchFrom = null, this.optionsController = new x(this);
127
+ super(), this.value = "", this.options = [], this.defaultOptions = [], this.allowUserInput = C.allowUserInput, this.typeahead = C.typeahead, this.includeSearch = C.includeSearch, this.searchPlaceholder = null, this.multiple = C.multiple, this.maxlength = null, this.displayValueAs = C.displayValueAs, this.tagPlacement = null, this.isOpen = !1, this._options = [], this._value = [], this._isOptionsOpen = !1, this._userInfoMessage = "", this._messageValue = null, this._addValueText = null, this._maxIsReached = !1, this._search = "", this._inputFocus = !1, this._skipInputTab = !1, this._optionsFromSlot = !1, this._lastSlotGeneration = 0, this._suppressNextOpen = !1, this.inputRef = d(), this.triggerRef = d(), this.listboxRef = d(), this._pendingDispatchFrom = null, this.optionsController = new x(this);
504
128
  }
505
129
  get _hasTextInput() {
506
130
  return this.typeahead || this.allowUserInput;
@@ -576,7 +200,7 @@ var M = class extends j {
576
200
  if (this.isDisabled) return;
577
201
  this.touched = !0, this._userInfoMessage = "", this._addValueText = null;
578
202
  let t = h(this.options, e)?.value || null, n = this._value.includes(e || t || ""), r = !!t, i = this._options.find((t) => t.value === e)?.disabled || !1, a = !e?.trim(), o = !this.multiple, s = this.multiple, c = g(this._value.length, this.maxlength), l = !1, u = !0, d = "", f = null, p = "";
579
- i || (!r && this.allowUserInput && !a ? (this.addNewUserValue(e), d = "valueAdded", l = s) : !r && !this.allowUserInput ? (o && this._value[0] && this.removeValue(this._value[0]), u = !1, l = !0, d = "noResults") : n ? (this.removeValue(t), l = !0, o && this._hasTextInput && this.inputRef.value && this.inputRef.value.type !== "hidden" && (this.inputRef.value.value = "")) : a && o ? (this.removeAllSelected(), l = !0) : o ? (this._value[0] && this.removeSelected(this._value[0]), this.setSelected(t), l = !1, d = "valueSelected", f = this._hasTextInput ? E(t || "", this.options, this.displayValueAs) : y(h(this.options, t), this.displayValueAs)) : s && !c ? (this.setSelected(t), l = !0) : s && c ? (d = "maxSelected", u = !1, p = e) : (o && this.removeAllSelected(), d = "noValidValue", u = !1, l = !0, p = e), this._isOptionsOpen = l, l || window.setTimeout(() => {
203
+ i || (!r && this.allowUserInput && !a ? (this.addNewUserValue(e), d = "valueAdded", l = s) : !r && !this.allowUserInput ? (o && this._value[0] && this.removeValue(this._value[0]), u = !1, l = !0, d = "noResults") : n ? (this.removeValue(t), l = !0, o && this._hasTextInput && this.inputRef.value && this.inputRef.value.type !== "hidden" && (this.inputRef.value.value = "")) : a && o ? (this.removeAllSelected(), l = !0) : o ? (this._value[0] && this.removeSelected(this._value[0]), this.setSelected(t), l = !1, d = "valueSelected", f = this._hasTextInput ? D(t || "", this.options, this.displayValueAs) : y(h(this.options, t), this.displayValueAs)) : s && !c ? (this.setSelected(t), l = !0) : s && c ? (d = "maxSelected", u = !1, p = e) : (o && this.removeAllSelected(), d = "noValidValue", u = !1, l = !0, p = e), this._isOptionsOpen = l, l || window.setTimeout(() => {
580
204
  this.focusAfterCommit();
581
205
  }, 0), this._search = p || "", this.resetComboboxInput(u), this._userInfoMessage = d, this._messageValue = f, s && this.updateMaxReached());
582
206
  }
@@ -586,14 +210,14 @@ var M = class extends j {
586
210
  this._userInfoMessage = "maxSelected";
587
211
  return;
588
212
  }
589
- !this.multiple && this.removeAllSelected(), this._value = e ? [...this._value, e] : this._value, D.markOptionSelected(this._options, e), this.resetComboboxInput(!0);
213
+ !this.multiple && this.removeAllSelected(), this._value = e ? [...this._value, e] : this._value, O.markOptionSelected(this._options, e), this.resetComboboxInput(!0);
590
214
  }
591
215
  }
592
216
  removeSelected(e) {
593
217
  if (!e) return;
594
218
  this._value = this._value.filter((t) => t !== e);
595
219
  let t = h(this.options, e);
596
- t && (D.markOptionDeselected(this.options, e), t.userAdded ? (this._options = [...this._options.filter((t) => t.value !== e)], this.options = [...this.options.filter((t) => t.value !== e)]) : this._options.some((t) => t.value === e) ? this.refreshOptionsFromValue() : this._options = [...this._options, t]);
220
+ t && (O.markOptionDeselected(this.options, e), t.userAdded ? (this._options = [...this._options.filter((t) => t.value !== e)], this.options = [...this.options.filter((t) => t.value !== e)]) : this._options.some((t) => t.value === e) ? this.refreshOptionsFromValue() : this._options = [...this._options, t]);
597
221
  }
598
222
  addAllOptions() {
599
223
  if (this.multiple) {
@@ -601,11 +225,11 @@ var M = class extends j {
601
225
  this._userInfoMessage = "tooManySelected";
602
226
  return;
603
227
  }
604
- this._value = this._options.map((e) => e.value), D.markAllSelected(this._options), this.requestUpdate();
228
+ this._value = this._options.map((e) => e.value), O.markAllSelected(this._options), this.requestUpdate();
605
229
  }
606
230
  }
607
231
  removeAllSelected() {
608
- this._value = [], D.markAllDeselected(this._options), this._options = D.removeUserAddedOptions(this._options), this.requestUpdate();
232
+ this._value = [], O.markAllDeselected(this._options), this._options = O.removeUserAddedOptions(this._options), this.requestUpdate();
609
233
  }
610
234
  addValue() {
611
235
  let e = this.inputRef.value?.value.trim() || "";
@@ -636,11 +260,11 @@ var M = class extends j {
636
260
  }, 0)), this.requestUpdate();
637
261
  }
638
262
  refreshOptionsFromValue() {
639
- let e = k.cloneOptions(this.options);
640
- e.forEach((e) => e.selected = this._value.includes(e.value)), this._options = k.syncOptionsWithValues(e, this._value).options;
263
+ let e = A.cloneOptions(this.options);
264
+ e.forEach((e) => e.selected = this._value.includes(e.value)), this._options = A.syncOptionsWithValues(e, this._value).options;
641
265
  }
642
266
  resetComboboxInput(e = !0) {
643
- this._addValueText = null, this.inputRef.value && this.inputRef.value.type !== "hidden" && e && (this._search = "", this.multiple ? this.inputRef.value.value = "" : (this.inputRef.value.value = this._value[0] ? E(this._value[0], this.options, this.displayValueAs) : "", this._userInfoMessage = "")), this.refreshOptionsFromValue();
267
+ this._addValueText = null, this.inputRef.value && this.inputRef.value.type !== "hidden" && e && (this._search = "", this.multiple ? this.inputRef.value.value = "" : (this.inputRef.value.value = this._value[0] ? D(this._value[0], this.options, this.displayValueAs) : "", this._userInfoMessage = "")), this.refreshOptionsFromValue();
644
268
  }
645
269
  removeLastValue(e) {
646
270
  if (this._value.length === 0) return;
@@ -666,7 +290,7 @@ var M = class extends j {
666
290
  this._suppressNextOpen = !1, this._inputFocus = !0, this.requestUpdate();
667
291
  return;
668
292
  }
669
- !this.multiple && this._value[0] && this.inputRef.value && this.inputRef.value.type !== "hidden" && (this.inputRef.value.value = E(this._value[0], this.options, this.displayValueAs)), this._inputFocus = !0, this._search = "", this.refreshOptionsFromValue(), this._isOptionsOpen = !0, this.onFocus(), this.requestUpdate();
293
+ !this.multiple && this._value[0] && this.inputRef.value && this.inputRef.value.type !== "hidden" && (this.inputRef.value.value = D(this._value[0], this.options, this.displayValueAs)), this._inputFocus = !0, this._search = "", this.refreshOptionsFromValue(), this._isOptionsOpen = !0, this.onFocus(), this.requestUpdate();
670
294
  }
671
295
  }
672
296
  handleCloseOptions() {
@@ -687,7 +311,7 @@ var M = class extends j {
687
311
  t && t.value !== this._value[0] ? (this._value[0] && this.removeSelected(this._value[0]), this.setSelected(t.value)) : !t && this.allowUserInput && (this._value[0] && this.removeSelected(this._value[0]), this.addNewUserValue(e));
688
312
  }
689
313
  } else if (e !== "") {
690
- let { action: t, value: n } = w(e, this._value, this.options, this.allowUserInput, this.multiple);
314
+ let { action: t, value: n } = T(e, this._value, this.options, this.allowUserInput, this.multiple);
691
315
  switch (t) {
692
316
  case "addUserValue":
693
317
  this.addNewUserValue(n);
@@ -698,7 +322,7 @@ var M = class extends j {
698
322
  case "removeValue": this.removeValue(n);
699
323
  }
700
324
  }
701
- !this.multiple && this._value[0] ? this.inputRef.value.value = E(this._value[0], this.options, this.displayValueAs) : this.inputRef.value.value = "";
325
+ !this.multiple && this._value[0] ? this.inputRef.value.value = D(this._value[0], this.options, this.displayValueAs) : this.inputRef.value.value = "";
702
326
  }
703
327
  this._isOptionsOpen = !1, this.onBlur();
704
328
  }
@@ -756,7 +380,7 @@ var M = class extends j {
756
380
  return;
757
381
  }
758
382
  }
759
- let t = C(e.key, e.shiftKey, this.multiple);
383
+ let t = w(e.key, e.shiftKey, this.multiple);
760
384
  if (t && !(e.key === "Tab" && !this._isOptionsOpen)) {
761
385
  if (t === "focusListbox" && e.key === "Tab" && !this.listboxRef.value?.querySelector("[role=\"option\"]:not([data-disabled]), [data-type=\"new-option\"]")) {
762
386
  this.closeAndProcessInput();
@@ -817,7 +441,7 @@ var M = class extends j {
817
441
  }
818
442
  }
819
443
  checkForMatches() {
820
- let e = T(this.inputRef.value?.value || this._search || "", this._value, this.options, this.allowUserInput, this.multiple);
444
+ let e = E(this.inputRef.value?.value || this._search || "", this._value, this.options, this.allowUserInput, this.multiple);
821
445
  if (e.shouldRemoveValue && this.removeValue(this._value[0]), e.shouldResetInput) {
822
446
  this.resetComboboxInput(!1);
823
447
  return;
@@ -833,10 +457,10 @@ var M = class extends j {
833
457
  connectedCallback() {
834
458
  if (super.connectedCallback(), document?.body.addEventListener("click", this.handleBodyClick), this._options = [], this.defaultOptions && this.defaultOptions.length) {
835
459
  let e = this.options?.filter((e) => e.userAdded) || [];
836
- this.options = [...e, ...JSON.parse(JSON.stringify(this.defaultOptions))], this._options = k.cloneOptions(this.options);
460
+ this.options = [...e, ...JSON.parse(JSON.stringify(this.defaultOptions))], this._options = A.cloneOptions(this.options);
837
461
  }
838
462
  if (this.optionsController?.nodes && this.optionsController.nodes.length) {
839
- let e = O.parseOptionsFromSlot(this.optionsController.nodes);
463
+ let e = k.parseOptionsFromSlot(this.optionsController.nodes);
840
464
  e.length && (this.options = [...e], this._options = [...e], this._optionsFromSlot = !0, this._lastSlotGeneration = this.optionsController.generation);
841
465
  }
842
466
  }
@@ -851,13 +475,13 @@ var M = class extends j {
851
475
  let e = this.optionsController.generation;
852
476
  if (e !== this._lastSlotGeneration) {
853
477
  this._lastSlotGeneration = e;
854
- let t = O.parseOptionsFromSlot(this.optionsController.nodes), n = this._options.filter((e) => e.userAdded);
478
+ let t = k.parseOptionsFromSlot(this.optionsController.nodes), n = this._options.filter((e) => e.userAdded);
855
479
  this.options = [...n, ...t];
856
480
  }
857
481
  }
858
482
  if (super.willUpdate(e), e.has("isOpen") && (this._isOptionsOpen = this.isOpen), e.has("defaultOptions") && this.defaultOptions.length) {
859
483
  let e = (Array.isArray(this.options) ? this.options : []).filter((e) => e.userAdded) || [];
860
- this.options = [...e, ...JSON.parse(JSON.stringify(this.defaultOptions))], this._options = k.cloneOptions(this.options);
484
+ this.options = [...e, ...JSON.parse(JSON.stringify(this.defaultOptions))], this._options = A.cloneOptions(this.options);
861
485
  }
862
486
  let t = e.has("value"), n = e.has("_value");
863
487
  if (t) {
@@ -869,9 +493,9 @@ var M = class extends j {
869
493
  e.length && (this._pendingDispatchFrom ??= [...this._value], this._value = e, this._options.forEach((t) => t.selected = e.includes(t.value)), this._options = [...this._options]);
870
494
  }
871
495
  if (e.has("options")) {
872
- let t = e.get("options") || this._options || [], n = k.mergeWithUserAdded(k.cloneOptions(this.options), t, this._value);
496
+ let t = e.get("options") || this._options || [], n = A.mergeWithUserAdded(A.cloneOptions(this.options), t, this._value);
873
497
  this._options = n, n.length > this.options.length && (this.options = n);
874
- let r = k.syncOptionsWithValues(this._options, this._value);
498
+ let r = A.syncOptionsWithValues(this._options, this._value);
875
499
  this._options = r.options, r.newValues.length > this._value.length && (this._pendingDispatchFrom ??= [...this._value], this._value = r.newValues);
876
500
  }
877
501
  (t || n || e.has("options") || e.has("defaultValue")) && this.updateMaxReached(), this._pendingDispatchFrom && this.syncPublicValue();
@@ -885,7 +509,7 @@ var M = class extends j {
885
509
  detail: this._search,
886
510
  bubbles: !1
887
511
  })), !this._isOptionsOpen && this._hasTextInput && this.inputRef.value && this.inputRef.value.type !== "hidden") {
888
- let e = !this.multiple && this._value[0] ? E(this._value[0], this.options, this.displayValueAs) : "";
512
+ let e = !this.multiple && this._value[0] ? D(this._value[0], this.options, this.displayValueAs) : "";
889
513
  this.inputRef.value.value !== e && (this.inputRef.value.value = e);
890
514
  }
891
515
  this.classList.add("pkt-combobox-component"), this.classList.toggle("pkt-combobox-component--fullwidth", !!this.fullwidth), super.updated(e);
@@ -903,8 +527,8 @@ var M = class extends j {
903
527
  }
904
528
  attributeChangedCallback(e, t, n) {
905
529
  if (e === "options") {
906
- this._options = k.cloneOptions(this.options);
907
- let e = k.syncOptionsWithValues(this._options, this._value);
530
+ this._options = A.cloneOptions(this.options);
531
+ let e = A.syncOptionsWithValues(this._options, this._value);
908
532
  this._options = e.options, e.newValues.length > this._value.length && (this._value = e.newValues), this._search = "";
909
533
  }
910
534
  super.attributeChangedCallback(e, t, n);
@@ -2,7 +2,7 @@ import { PktInputElement } from '../../base-elements/input-element';
2
2
  import { Ref } from 'lit/directives/ref.js';
3
3
  import { PropertyValues } from 'lit';
4
4
  import { ElementProps } from '../../types/typeUtils';
5
- import { TCheckboxLabelPosition } from '../../shared-types';
5
+ import { TCheckboxLabelPosition, TPktInputSize } from '../../shared-types';
6
6
  type Props = ElementProps<PktCheckbox, 'checkHelptext' | 'defaultChecked' | 'hasTile' | 'isSwitch' | 'labelPosition' | 'hideLabel' | 'tagText' | 'optionalTag' | 'optionalText' | 'requiredTag' | 'requiredText'>;
7
7
  export declare class PktCheckbox extends PktInputElement<Props> {
8
8
  inputRef: Ref<HTMLInputElement>;
@@ -16,6 +16,7 @@ export declare class PktCheckbox extends PktInputElement<Props> {
16
16
  checked: boolean | string | null;
17
17
  indeterminate: boolean | 'true' | 'false' | '';
18
18
  type: string;
19
+ inputSize: TPktInputSize | undefined;
19
20
  tagText: string | null;
20
21
  optionalTag: boolean;
21
22
  /** @deprecated Bruk `strings={{ forms: { optional: '…' } }}` eller `setPktStrings()`. */
@@ -1,6 +1,6 @@
1
1
  import { Ref } from 'lit/directives/ref.js';
2
2
  import { PktInputElement } from '../../base-elements/input-element';
3
- import { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types';
3
+ import { IPktComboboxOption, TPktComboboxDisplayValue, TPktComboboxTagPlacement } from './combobox-types';
4
4
  import { IPktStringsProps } from '../../shared-strings';
5
5
  import { default as PktListbox } from '../listbox';
6
6
  import { TComboboxMessageKey } from '../../shared-utils/combobox';
@@ -19,7 +19,7 @@ export declare class ComboboxBase extends PktInputElement<IPktStringsProps<'comb
19
19
  searchPlaceholder: string | null;
20
20
  multiple: boolean;
21
21
  maxlength: number | null;
22
- displayValueAs: string;
22
+ displayValueAs: TPktComboboxDisplayValue;
23
23
  tagPlacement: TPktComboboxTagPlacement | null;
24
24
  isOpen: boolean;
25
25
  _options: IPktComboboxOption[];