@oslokommune/punkt-react 12.14.2 → 12.14.3
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 +1273 -1273
- package/dist/punkt-react.umd.js +134 -134
- package/package.json +4 -4
- package/src/components/preview/Preview.tsx +3 -1
- package/src/components/preview/PreviewPropEditor.tsx +2 -2
- package/src/components/preview/PreviewSpecs.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "12.14.
|
|
3
|
+
"version": "12.14.3",
|
|
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",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@lit-labs/ssr-dom-shim": "^1.2.1",
|
|
40
40
|
"@lit/react": "^1.0.5",
|
|
41
|
-
"@oslokommune/punkt-elements": "^12.14.
|
|
41
|
+
"@oslokommune/punkt-elements": "^12.14.3",
|
|
42
42
|
"angular-html-parser": "^6.0.2",
|
|
43
43
|
"html-format": "^1.1.7",
|
|
44
44
|
"prettier": "^3.3.3",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@oslokommune/punkt-assets": "^12.14.0",
|
|
51
|
-
"@oslokommune/punkt-css": "^12.14.
|
|
51
|
+
"@oslokommune/punkt-css": "^12.14.3",
|
|
52
52
|
"@testing-library/jest-dom": "^6.5.0",
|
|
53
53
|
"@testing-library/react": "^16.0.1",
|
|
54
54
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
112
112
|
},
|
|
113
113
|
"license": "MIT",
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "4380e98b4d0e1af5f67e1c3680fe55825a2627a9"
|
|
115
115
|
}
|
|
@@ -42,7 +42,7 @@ export const PktPreview: React.FC<PreviewProps> = ({ specs, children, fullWidth
|
|
|
42
42
|
return acc
|
|
43
43
|
}, {})
|
|
44
44
|
: {}
|
|
45
|
-
|
|
45
|
+
const [iteratedKey, setIteratedKey] = useState(0)
|
|
46
46
|
const [props, setProps] = useState(initialProps)
|
|
47
47
|
const [mode, setMode] = useState<'light' | 'dark'>('light')
|
|
48
48
|
const [htmlContent, setHtmlContent] = useState('')
|
|
@@ -153,6 +153,7 @@ export const PktPreview: React.FC<PreviewProps> = ({ specs, children, fullWidth
|
|
|
153
153
|
)
|
|
154
154
|
|
|
155
155
|
const handleChange = (key: string, value: any, displayAsFalse: boolean = false) => {
|
|
156
|
+
setIteratedKey(iteratedKey + 1)
|
|
156
157
|
if (!displayAsFalse && (!value || value == 'false')) {
|
|
157
158
|
const { [key]: _, ...rest } = props
|
|
158
159
|
setProps(rest)
|
|
@@ -183,6 +184,7 @@ export const PktPreview: React.FC<PreviewProps> = ({ specs, children, fullWidth
|
|
|
183
184
|
<div
|
|
184
185
|
className={`pkt-preview__component ${fullWidth && 'pkt-preview__component--fullwidth'}`}
|
|
185
186
|
ref={previewComponent}
|
|
187
|
+
key={iteratedKey}
|
|
186
188
|
>
|
|
187
189
|
<div>{component}</div>
|
|
188
190
|
</div>
|
|
@@ -41,7 +41,7 @@ export const PktPreviewPropEditor: FC<PropEditorProps> = ({ propKey, spec, props
|
|
|
41
41
|
id={propKey}
|
|
42
42
|
label={propKey}
|
|
43
43
|
type="checkbox"
|
|
44
|
-
checked={props[propKey]}
|
|
44
|
+
checked={props[propKey] || false}
|
|
45
45
|
onChange={(e) => handleChange(propKey, e.target.checked, spec.displayAsFalse)}
|
|
46
46
|
labelPosition="right"
|
|
47
47
|
isSwitch
|
|
@@ -77,7 +77,7 @@ export const PktPreviewPropEditor: FC<PropEditorProps> = ({ propKey, spec, props
|
|
|
77
77
|
label={spec.name || propKey}
|
|
78
78
|
helptext={spec.description || null}
|
|
79
79
|
value={props[propKey]}
|
|
80
|
-
multiple={spec.variant === 'multiple'}
|
|
80
|
+
multiple={!!(spec.variant === 'multiple')}
|
|
81
81
|
maxlength={999}
|
|
82
82
|
onChange={(e) => handleChange(propKey, (e.target as HTMLInputElement).value)}
|
|
83
83
|
requiredTag={spec.required}
|
|
@@ -49,8 +49,8 @@ export const PktPreviewSpecs: React.FC<{ specs: ISpecObject }> = ({ specs }) =>
|
|
|
49
49
|
<PktTable compact>
|
|
50
50
|
<PktTableHeader>
|
|
51
51
|
<PktTableRow>
|
|
52
|
-
<PktTableHeaderCell>Navn</PktTableHeaderCell>
|
|
53
52
|
<PktTableHeaderCell>Prop</PktTableHeaderCell>
|
|
53
|
+
<PktTableHeaderCell>Navn</PktTableHeaderCell>
|
|
54
54
|
<PktTableHeaderCell>Beskrivelse</PktTableHeaderCell>
|
|
55
55
|
<PktTableHeaderCell>Type</PktTableHeaderCell>
|
|
56
56
|
<PktTableHeaderCell>Standardverdi</PktTableHeaderCell>
|
|
@@ -67,7 +67,7 @@ export const PktPreviewSpecs: React.FC<{ specs: ISpecObject }> = ({ specs }) =>
|
|
|
67
67
|
<>
|
|
68
68
|
<PktTableDataCell dataLabel="Beskrivelse"></PktTableDataCell>
|
|
69
69
|
<PktTableDataCell dataLabel="Type">
|
|
70
|
-
<pre>{value.join('
|
|
70
|
+
<pre>{value.join('\n')}</pre>
|
|
71
71
|
</PktTableDataCell>
|
|
72
72
|
</>
|
|
73
73
|
) : (
|