@oslokommune/punkt-react 13.0.3 → 13.0.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.
- package/CHANGELOG.md +18 -0
- package/dist/punkt-react.es.js +398 -384
- package/dist/punkt-react.umd.js +126 -126
- package/package.json +2 -2
- package/src/components/checkbox/Checkbox.tsx +31 -6
- package/src/components/radio/RadioButton.tsx +22 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.4",
|
|
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": "
|
|
115
|
+
"gitHead": "b17a65e093bc83b470feabc13eba6ae162b5b9cb"
|
|
116
116
|
}
|
|
@@ -28,7 +28,7 @@ export const PktCheckbox = forwardRef(
|
|
|
28
28
|
className,
|
|
29
29
|
isSwitch = false,
|
|
30
30
|
hideLabel = false,
|
|
31
|
-
labelPosition,
|
|
31
|
+
labelPosition = 'right',
|
|
32
32
|
defaultChecked,
|
|
33
33
|
checked,
|
|
34
34
|
...props
|
|
@@ -37,9 +37,32 @@ export const PktCheckbox = forwardRef(
|
|
|
37
37
|
): React.ReactElement => {
|
|
38
38
|
const classes = [className, 'pkt-input-check'].filter(Boolean).join(' ')
|
|
39
39
|
|
|
40
|
+
const labelClasses = [
|
|
41
|
+
'pkt-input-check__input-label',
|
|
42
|
+
disabled ? 'pkt-input-check__input-label--disabled' : '',
|
|
43
|
+
`pkt-input-check__input-label--${labelPosition}`,
|
|
44
|
+
hideLabel ? 'pkt-sr-only' : '',
|
|
45
|
+
]
|
|
46
|
+
.filter(Boolean)
|
|
47
|
+
.join(' ')
|
|
48
|
+
|
|
49
|
+
const inputTileClasses = [
|
|
50
|
+
'pkt-input-check__input',
|
|
51
|
+
hasTile ? 'pkt-input-check__input--tile' : '',
|
|
52
|
+
disabled && hasTile ? 'pkt-input-check__input--tile-disabled' : '',
|
|
53
|
+
]
|
|
54
|
+
.filter(Boolean)
|
|
55
|
+
.join(' ')
|
|
56
|
+
|
|
40
57
|
return (
|
|
41
58
|
<div className={classes}>
|
|
42
|
-
<div className={
|
|
59
|
+
<div className={inputTileClasses}>
|
|
60
|
+
{labelPosition === 'left' && (
|
|
61
|
+
<label className={labelClasses} htmlFor={id}>
|
|
62
|
+
{label}
|
|
63
|
+
{checkHelptext && <div className="pkt-input-check__input-helptext">{checkHelptext}</div>}
|
|
64
|
+
</label>
|
|
65
|
+
)}
|
|
43
66
|
<input
|
|
44
67
|
role={isSwitch ? 'switch' : 'checkbox'}
|
|
45
68
|
ref={ref}
|
|
@@ -50,10 +73,12 @@ export const PktCheckbox = forwardRef(
|
|
|
50
73
|
{...(checked !== undefined ? { checked } : { defaultChecked })}
|
|
51
74
|
{...props}
|
|
52
75
|
/>
|
|
53
|
-
|
|
54
|
-
{
|
|
55
|
-
|
|
56
|
-
|
|
76
|
+
{labelPosition === 'right' && (
|
|
77
|
+
<label className={labelClasses} htmlFor={id}>
|
|
78
|
+
{label}
|
|
79
|
+
{checkHelptext && <div className="pkt-input-check__input-helptext">{checkHelptext}</div>}
|
|
80
|
+
</label>
|
|
81
|
+
)}
|
|
57
82
|
</div>
|
|
58
83
|
</div>
|
|
59
84
|
)
|
|
@@ -33,24 +33,39 @@ export const PktRadioButton = forwardRef(
|
|
|
33
33
|
): React.ReactElement => {
|
|
34
34
|
const classes = [className, 'pkt-input-check'].filter(Boolean).join(' ')
|
|
35
35
|
|
|
36
|
+
const inputTileClasses = [
|
|
37
|
+
'pkt-input-check__input',
|
|
38
|
+
hasTile ? 'pkt-input-check__input--tile' : '',
|
|
39
|
+
disabled && hasTile ? 'pkt-input-check__input--tile-disabled' : '',
|
|
40
|
+
]
|
|
41
|
+
.filter(Boolean)
|
|
42
|
+
.join(' ')
|
|
43
|
+
|
|
44
|
+
const inputCheckBoxClasses = [
|
|
45
|
+
'pkt-input-check__input-checkbox',
|
|
46
|
+
hasError ? 'pkt-input-check__input-checkbox--error' : '',
|
|
47
|
+
]
|
|
48
|
+
.filter(Boolean)
|
|
49
|
+
.join(' ')
|
|
50
|
+
|
|
51
|
+
const labelClasses = ['pkt-input-check__input-label', disabled ? 'pkt-input-check__input-label--disabled' : '']
|
|
52
|
+
.filter(Boolean)
|
|
53
|
+
.join(' ')
|
|
54
|
+
|
|
36
55
|
return (
|
|
37
56
|
<div className={classes}>
|
|
38
|
-
<div
|
|
39
|
-
className={`pkt-input-check__input ${hasTile ? 'pkt-input-check__input--tile' : ''} ${
|
|
40
|
-
disabled && hasTile ? 'pkt-input-check__input--tile-disabled' : ''
|
|
41
|
-
}`}
|
|
42
|
-
>
|
|
57
|
+
<div className={inputTileClasses}>
|
|
43
58
|
<input
|
|
44
59
|
ref={ref}
|
|
45
60
|
id={id}
|
|
46
61
|
type="radio"
|
|
47
62
|
name={name}
|
|
48
63
|
disabled={disabled}
|
|
49
|
-
className={
|
|
64
|
+
className={inputCheckBoxClasses}
|
|
50
65
|
{...(checked !== undefined ? { checked } : { defaultChecked })}
|
|
51
66
|
{...props}
|
|
52
67
|
/>
|
|
53
|
-
<label className=
|
|
68
|
+
<label className={labelClasses} htmlFor={id}>
|
|
54
69
|
{label}
|
|
55
70
|
{checkHelptext && <div className="pkt-input-check__input-helptext">{checkHelptext}</div>}
|
|
56
71
|
</label>
|