@oslokommune/punkt-elements 19.5.2 → 19.6.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 (62) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/base-elements/input-element.d.ts +2 -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-CjLX_Gfd.js → combobox-CWzWHBaw.js} +1 -1
  6. package/dist/{combobox-BBx87DCG.cjs → combobox-FCguoyDH.cjs} +1 -1
  7. package/dist/components/checkbox/checkbox.d.ts +2 -1
  8. package/dist/components/input-wrapper/input-wrapper.d.ts +4 -2
  9. package/dist/components/radiobutton/radiobutton.d.ts +2 -0
  10. package/dist/{datepicker-CFCRxFQL.js → datepicker-Bs7Z3EFn.js} +1 -1
  11. package/dist/{datepicker-Bk-m5Zaa.cjs → datepicker-CWHYYj-H.cjs} +1 -1
  12. package/dist/docs/components/radio-checkbox-sizes.d.ts +10 -0
  13. package/dist/{fileupload-B2606SvG.js → fileupload-BQFJx1ok.js} +1 -1
  14. package/dist/{fileupload-COAxc3sX.cjs → fileupload-CMIFZWJ5.cjs} +1 -1
  15. package/dist/{header-BhM7FRoC.cjs → header-C4Uojzoy.cjs} +1 -1
  16. package/dist/{header-BQdc29IO.js → header-Cc1Cy0U3.js} +1 -1
  17. package/dist/{input-wrapper-Bz9GwYrn.js → input-wrapper-BoTugCvh.js} +13 -3
  18. package/dist/{input-wrapper-BBG8EXQ8.cjs → input-wrapper-J3mEKhvR.cjs} +3 -3
  19. package/dist/pkt-checkbox.cjs +1 -1
  20. package/dist/pkt-checkbox.js +1 -1
  21. package/dist/pkt-combobox.cjs +1 -1
  22. package/dist/pkt-combobox.js +1 -1
  23. package/dist/pkt-datepicker.cjs +1 -1
  24. package/dist/pkt-datepicker.js +1 -1
  25. package/dist/pkt-fileupload.cjs +1 -1
  26. package/dist/pkt-fileupload.js +1 -1
  27. package/dist/pkt-header.cjs +1 -1
  28. package/dist/pkt-header.js +1 -1
  29. package/dist/pkt-index.cjs +1 -1
  30. package/dist/pkt-index.js +11 -11
  31. package/dist/pkt-input-wrapper.cjs +1 -1
  32. package/dist/pkt-input-wrapper.js +1 -1
  33. package/dist/pkt-radiobutton.cjs +1 -1
  34. package/dist/pkt-radiobutton.js +1 -1
  35. package/dist/pkt-select.cjs +1 -1
  36. package/dist/pkt-select.js +1 -1
  37. package/dist/pkt-textarea.cjs +1 -1
  38. package/dist/pkt-textarea.js +1 -1
  39. package/dist/pkt-textinput.cjs +1 -1
  40. package/dist/pkt-textinput.js +1 -1
  41. package/dist/pkt-timepicker.cjs +1 -1
  42. package/dist/pkt-timepicker.js +1 -1
  43. package/dist/{radiobutton-C3kEjvHQ.cjs → radiobutton-BPr22VmL.cjs} +3 -3
  44. package/dist/{radiobutton-D9htviZG.js → radiobutton-l_3oGDbb.js} +6 -3
  45. package/dist/{select-BuQxosyi.cjs → select-CZYQ5Dmx.cjs} +1 -1
  46. package/dist/{select-BizHes0n.js → select-DYjKMmHa.js} +1 -1
  47. package/dist/shared-types/checkbox.d.ts +3 -1
  48. package/dist/shared-types/size.d.ts +2 -1
  49. package/dist/{textarea-CL1yUDVL.js → textarea-C2oaRlfb.js} +1 -1
  50. package/dist/{textarea-BXadsEdL.cjs → textarea-H1Lt2o6K.cjs} +1 -1
  51. package/dist/{textinput-Csil0Zda.js → textinput-C0eu70sH.js} +1 -1
  52. package/dist/{textinput-qi0f5NZH.cjs → textinput-C2Tx-OrN.cjs} +1 -1
  53. package/dist/{timepicker-DNoYMBAL.js → timepicker-B8TwchA2.js} +1 -1
  54. package/dist/{timepicker-CvL2-Siz.cjs → timepicker-DZG_gHIa.cjs} +1 -1
  55. package/package.json +2 -2
  56. package/src/components/checkbox/checkbox.test.ts +26 -0
  57. package/src/components/checkbox/checkbox.ts +3 -2
  58. package/src/components/input-wrapper/input-wrapper.test.ts +54 -0
  59. package/src/components/input-wrapper/input-wrapper.ts +11 -2
  60. package/src/components/input-wrapper/wrapper-parity.test.ts +9 -0
  61. package/src/components/radiobutton/radiobutton.test.ts +26 -0
  62. package/src/components/radiobutton/radiobutton.ts +3 -1
@@ -64,6 +64,15 @@ const OMITTED: Record<string, Partial<Record<keyof typeof COMPONENTS, string>>>
64
64
  timepicker: 'teller over feltet er aldri støttet',
65
65
  fileupload: 'teller over feltet er aldri støttet',
66
66
  },
67
+ layout: {
68
+ textinput: 'layout gjelder alternativer i en gruppe, ikke ett felt',
69
+ textarea: 'layout gjelder alternativer i en gruppe, ikke ett felt',
70
+ select: 'layout gjelder alternativer i en gruppe, ikke ett felt',
71
+ combobox: 'layout gjelder alternativer i en gruppe, ikke ett felt',
72
+ datepicker: 'layout gjelder alternativer i en gruppe, ikke ett felt',
73
+ timepicker: 'layout gjelder alternativer i en gruppe, ikke ett felt',
74
+ fileupload: 'layout gjelder alternativer i en gruppe, ikke ett felt',
75
+ },
67
76
  hasFieldset: {
68
77
  fileupload: 'ikke støttet',
69
78
  },
@@ -271,3 +271,29 @@ describe('pkt-radiobutton', () => {
271
271
  expect(results).toHaveNoViolations()
272
272
  })
273
273
  })
274
+
275
+ describe('pkt-radiobutton inputSize', () => {
276
+ const root = async (attributes = '') => {
277
+ document.body.innerHTML = `<pkt-radiobutton id="s" name="s" label="Valg" ${attributes}></pkt-radiobutton>`
278
+ const el = document.querySelector('pkt-radiobutton') as HTMLElement & { updateComplete: Promise<unknown> }
279
+ await el.updateComplete
280
+ return el.querySelector('.pkt-input-check') as HTMLElement
281
+ }
282
+
283
+ afterEach(() => {
284
+ document.body.innerHTML = ''
285
+ })
286
+
287
+ test('adds no size class without input-size, so the size is inherited', async () => {
288
+ expect((await root()).className).toBe('pkt-input-check')
289
+ })
290
+
291
+ test('adds the size class for input-size', async () => {
292
+ expect(await root('input-size="small"')).toHaveClass('pkt-input-check--small')
293
+ expect(await root('input-size="xsmall"')).toHaveClass('pkt-input-check--xsmall')
294
+ })
295
+
296
+ test('adds the medium class when medium is set explicitly', async () => {
297
+ expect(await root('input-size="medium"')).toHaveClass('pkt-input-check--medium')
298
+ })
299
+ })
@@ -5,6 +5,7 @@ import { Ref, createRef, ref } from 'lit/directives/ref.js'
5
5
  import { html, nothing } from 'lit'
6
6
  import { classMap } from 'lit/directives/class-map.js'
7
7
  import { ElementProps } from '@/types/typeUtils'
8
+ import type { TPktInputSize } from 'shared-types'
8
9
 
9
10
  type Props = ElementProps<
10
11
  PktRadioButton,
@@ -27,6 +28,7 @@ export class PktRadioButton extends PktInputElement<Props> {
27
28
  @property({ type: Boolean }) hasTile: boolean = false
28
29
  @property({ type: Boolean, reflect: true }) checked: boolean | string | null = null
29
30
  @property({ type: String, reflect: true }) type: string = 'radio'
31
+ @property({ type: String, attribute: 'input-size' }) inputSize: TPktInputSize | undefined = undefined
30
32
  @property({ type: String }) tagText: string | null = null
31
33
  @property({ type: Boolean }) optionalTag: boolean = false
32
34
  /** @deprecated Bruk `strings={{ forms: { optional: '…' } }}` eller `setPktStrings()`. */
@@ -113,7 +115,7 @@ export class PktRadioButton extends PktInputElement<Props> {
113
115
  }
114
116
 
115
117
  return html`
116
- <div class="pkt-input-check">
118
+ <div class="pkt-input-check${this.inputSize ? ` pkt-input-check--${this.inputSize}` : ''}">
117
119
  <div class=${inputTileClasses}>
118
120
  <input
119
121
  id=${this.id + '-internal'}