@oslokommune/punkt-react 13.0.0 → 13.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-react",
3
- "version": "13.0.0",
3
+ "version": "13.0.1",
4
4
  "description": "React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo Origo",
@@ -112,5 +112,5 @@
112
112
  "url": "https://github.com/oslokommune/punkt/issues"
113
113
  },
114
114
  "license": "MIT",
115
- "gitHead": "8012adb5b795a7ab26d844a3311435fef05121c4"
115
+ "gitHead": "70e58130f5507903eb6053396d5226d8e5fec9c1"
116
116
  }
@@ -1,4 +1,4 @@
1
- import React, { ForwardedRef, forwardRef } from 'react'
1
+ import React, { ChangeEventHandler, ForwardedRef, forwardRef } from 'react'
2
2
 
3
3
  export interface IPktCheckbox extends React.InputHTMLAttributes<HTMLInputElement> {
4
4
  id: string
@@ -8,11 +8,12 @@ export interface IPktCheckbox extends React.InputHTMLAttributes<HTMLInputElement
8
8
  checkHelptext?: string
9
9
  hasError?: boolean
10
10
  defaultChecked?: boolean
11
+ checked?: boolean
11
12
  value?: string
12
13
  isSwitch?: boolean
13
14
  hideLabel?: boolean
14
15
  labelPosition?: 'right' | 'left'
15
- checked?: boolean
16
+ onChange?: ChangeEventHandler<HTMLInputElement>
16
17
  }
17
18
 
18
19
  export const PktCheckbox = forwardRef(
@@ -28,6 +29,7 @@ export const PktCheckbox = forwardRef(
28
29
  isSwitch = false,
29
30
  hideLabel = false,
30
31
  labelPosition,
32
+ defaultChecked,
31
33
  checked,
32
34
  ...props
33
35
  }: IPktCheckbox,
@@ -45,6 +47,7 @@ export const PktCheckbox = forwardRef(
45
47
  type="checkbox"
46
48
  id={id}
47
49
  disabled={disabled}
50
+ defaultChecked={defaultChecked || checked}
48
51
  {...props}
49
52
  />
50
53
  <label className="pkt-input-check__input-label" htmlFor={id}>
@@ -133,7 +133,7 @@ export const PktInputWrapper = forwardRef(
133
133
 
134
134
  return (
135
135
  <>
136
- {helptext && (
136
+ {helptext && useWrapper && (
137
137
  <div className="pkt-inputwrapper__helptext" id={`${forId}-helptext`}>
138
138
  {helptext}
139
139
  </div>
@@ -1,4 +1,4 @@
1
- import React, { ForwardedRef, forwardRef } from 'react'
1
+ import React, { ChangeEventHandler, ForwardedRef, forwardRef } from 'react'
2
2
 
3
3
  export interface IPktRadioButton extends React.InputHTMLAttributes<HTMLInputElement> {
4
4
  id: string
@@ -7,8 +7,11 @@ export interface IPktRadioButton extends React.InputHTMLAttributes<HTMLInputElem
7
7
  hasTile?: boolean
8
8
  disabled?: boolean
9
9
  checkHelptext?: string | React.ReactNode | React.ReactNode[]
10
+ defaultChecked?: boolean
11
+ checked?: boolean
10
12
  hasError?: boolean
11
13
  value?: string
14
+ onChange?: ChangeEventHandler<HTMLInputElement>
12
15
  }
13
16
 
14
17
  export const PktRadioButton = forwardRef(
@@ -22,6 +25,8 @@ export const PktRadioButton = forwardRef(
22
25
  disabled = false,
23
26
  checkHelptext,
24
27
  hasError = false,
28
+ defaultChecked,
29
+ checked,
25
30
  ...props
26
31
  }: IPktRadioButton,
27
32
  ref: ForwardedRef<HTMLInputElement>,
@@ -42,6 +47,7 @@ export const PktRadioButton = forwardRef(
42
47
  name={name}
43
48
  disabled={disabled}
44
49
  className={`pkt-input-check__input-checkbox ${hasError ? 'pkt-input-check__input-checkbox--error' : ''}`}
50
+ defaultChecked={defaultChecked || checked}
45
51
  {...props}
46
52
  />
47
53
  <label className="pkt-input-check__input-label" htmlFor={id}>