@oslokommune/punkt-react 12.1.0 → 12.3.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.
- package/CHANGELOG.md +44 -0
- package/README.md +1 -1
- package/dist/index.d.ts +71 -3
- package/dist/punkt-react.es.js +10609 -6256
- package/dist/punkt-react.umd.js +549 -87
- package/package.json +7 -3
- package/src/components/accordion/Accordion.tsx +2 -0
- package/src/components/accordion/AccordionItem.tsx +2 -0
- package/src/components/alert/Alert.tsx +2 -0
- package/src/components/backlink/BackLink.tsx +2 -0
- package/src/components/breadcrumbs/Breadcrumbs.tsx +2 -0
- package/src/components/button/Button.tsx +2 -0
- package/src/components/card/Card.tsx +37 -0
- package/src/components/checkbox/Checkbox.tsx +2 -0
- package/src/components/childrenWrapper/childrenWrapper.tsx +20 -0
- package/src/components/datepicker/Datepicker.tsx +52 -0
- package/src/components/footer/Footer.tsx +2 -0
- package/src/components/footerSimple/FooterSimple.tsx +2 -1
- package/src/components/header/Header.tsx +10 -4
- package/src/components/icon/IconContext.tsx +2 -0
- package/src/components/index.ts +3 -0
- package/src/components/input/Input.tsx +2 -0
- package/src/components/inputwrapper/InputWrapper.tsx +2 -0
- package/src/components/link/Link.tsx +37 -0
- package/src/components/linkcard/LinkCard.test.tsx +2 -0
- package/src/components/linkcard/LinkCard.tsx +3 -1
- package/src/components/preview/Preview.tsx +50 -10
- package/src/components/preview/PreviewSpecs.tsx +15 -3
- package/src/components/progressbar/Progressbar.tsx +2 -0
- package/src/components/radio/RadioButton.tsx +2 -0
- package/src/components/searchinput/SearchInput.tsx +2 -0
- package/src/components/select/Select.tsx +2 -0
- package/src/components/stepper/Step.tsx +2 -0
- package/src/components/stepper/Stepper.tsx +2 -0
- package/src/components/table/Table.tsx +2 -0
- package/src/components/table/TableBody.tsx +2 -0
- package/src/components/table/TableData.tsx +2 -0
- package/src/components/table/TableDataCell.tsx +2 -0
- package/src/components/table/TableHeader.tsx +2 -0
- package/src/components/table/TableHeaderCell.tsx +2 -0
- package/src/components/table/TableRow.tsx +2 -0
- package/src/components/tabs/Tabs.tsx +1 -1
- package/src/components/tag/Tag.tsx +81 -93
- package/src/components/textarea/Textarea.tsx +2 -0
- package/src/components/textinput/Textinput.tsx +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.3.0",
|
|
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",
|
|
@@ -32,15 +32,19 @@
|
|
|
32
32
|
"test": "react-scripts test --env=jsdom"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
+
"@lit-labs/ssr-dom-shim": "^1.2.1",
|
|
36
|
+
"@lit/react": "^1.0.5",
|
|
35
37
|
"angular-html-parser": "^6.0.2",
|
|
36
38
|
"html-format": "^1.1.7",
|
|
37
39
|
"prettier": "^3.3.3",
|
|
38
40
|
"react-element-to-jsx-string": "^15.0.0",
|
|
41
|
+
"react-hook-form": "^7.53.0",
|
|
39
42
|
"react-syntax-highlighter": "^15.5.0"
|
|
40
43
|
},
|
|
41
44
|
"devDependencies": {
|
|
42
45
|
"@oslokommune/punkt-assets": "^12.1.0",
|
|
43
|
-
"@oslokommune/punkt-css": "^12.
|
|
46
|
+
"@oslokommune/punkt-css": "^12.3.0",
|
|
47
|
+
"@oslokommune/punkt-elements": "^12.3.0",
|
|
44
48
|
"@testing-library/jest-dom": "^6.5.0",
|
|
45
49
|
"@testing-library/react": "^16.0.1",
|
|
46
50
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -98,5 +102,5 @@
|
|
|
98
102
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
99
103
|
},
|
|
100
104
|
"license": "MIT",
|
|
101
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "464d3d6b9981108d7a53912cb58e14fc73c9be10"
|
|
102
106
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React, { FC, ReactElement, forwardRef, ReactNode, ForwardedRef } from 'react'
|
|
4
|
+
import { createComponent } from '@lit/react'
|
|
5
|
+
import { PktCard as PktElCard } from '@oslokommune/punkt-elements'
|
|
6
|
+
import type { PktElType, PktElConstructor } from '@/interfaces/IPktElements'
|
|
7
|
+
import { IPktTag } from '../tag/Tag'
|
|
8
|
+
|
|
9
|
+
interface IPktCard extends PktElType {
|
|
10
|
+
direction?: 'portrait' | 'landscape'
|
|
11
|
+
skin?: 'outlined' | 'gray' | 'beige' | 'green' | 'blue'
|
|
12
|
+
heading?: string
|
|
13
|
+
subheading?: string
|
|
14
|
+
tags?: (Omit<IPktTag, 'closeTag'> & { text: string })[]
|
|
15
|
+
image?: { src: string; alt: string }
|
|
16
|
+
children?: ReactNode | ReactNode[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const LitComponent: FC<IPktCard> = createComponent({
|
|
20
|
+
tagName: 'pkt-card',
|
|
21
|
+
elementClass: PktElCard as PktElConstructor<HTMLElement>,
|
|
22
|
+
react: React,
|
|
23
|
+
displayName: 'PktCard',
|
|
24
|
+
events: {},
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export const PktCard: FC<IPktCard> = forwardRef(
|
|
28
|
+
({ children, ...props }: IPktCard, ref: ForwardedRef<HTMLElement>): ReactElement => {
|
|
29
|
+
return (
|
|
30
|
+
<LitComponent {...props} ref={ref}>
|
|
31
|
+
<div className="pkt-contents">{children}</div>
|
|
32
|
+
</LitComponent>
|
|
33
|
+
)
|
|
34
|
+
},
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
PktCard.displayName = 'PktCard'
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface childrenWrapperProps {
|
|
4
|
+
wrapperType?: 'div' | 'span';
|
|
5
|
+
children?: React.ReactNode | React.ReactNode[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function childrenWrapper<P>(
|
|
9
|
+
Component: React.ComponentType<P>,
|
|
10
|
+
defaultWrapper: 'div' | 'span' = 'div'
|
|
11
|
+
): React.FC<P & childrenWrapperProps> { return ({ wrapperType = defaultWrapper, children, ...props }) => {
|
|
12
|
+
const Tag = wrapperType;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<Component {...(props as P)}>
|
|
16
|
+
<Tag className="pkt-contents">{children}</Tag>
|
|
17
|
+
</Component>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React, { FC } from 'react'
|
|
4
|
+
import { createComponent, EventName } from '@lit/react'
|
|
5
|
+
import { PktDatepicker as PktEl } from '@oslokommune/punkt-elements'
|
|
6
|
+
import type { PktElType, PktElConstructor } from '@/interfaces/IPktElements'
|
|
7
|
+
|
|
8
|
+
interface IPktDatepicker extends PktElType {
|
|
9
|
+
value?: string | string[]
|
|
10
|
+
label?: string
|
|
11
|
+
id?: string
|
|
12
|
+
dateformat?: string
|
|
13
|
+
multiple?: boolean
|
|
14
|
+
maxlength?: number
|
|
15
|
+
disabled?: boolean
|
|
16
|
+
range?: boolean
|
|
17
|
+
weeknumbers?: boolean
|
|
18
|
+
withcontrols?: boolean
|
|
19
|
+
fullWidth?: boolean
|
|
20
|
+
min?: string | number | undefined
|
|
21
|
+
max?: string | number | undefined
|
|
22
|
+
excludedates?: string[]
|
|
23
|
+
excludeweekdays?: string[]
|
|
24
|
+
currentmonth?: string
|
|
25
|
+
calendarOpen?: boolean
|
|
26
|
+
required?: boolean
|
|
27
|
+
requiredTag?: boolean
|
|
28
|
+
requiredText?: string
|
|
29
|
+
optionalTag?: boolean
|
|
30
|
+
optionalText?: string
|
|
31
|
+
helptext?: string
|
|
32
|
+
helptextDropdown?: string
|
|
33
|
+
helptextDropdownButton?: string
|
|
34
|
+
hasError?: boolean
|
|
35
|
+
errorMessage?: string
|
|
36
|
+
strings?: any
|
|
37
|
+
onChange?: (e: Event) => void
|
|
38
|
+
onValueChange?: (e: CustomEvent) => void
|
|
39
|
+
onToggleHelpText?: (e: CustomEvent) => void
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const PktDatepicker: FC<IPktDatepicker> = createComponent({
|
|
43
|
+
tagName: 'pkt-datepicker',
|
|
44
|
+
elementClass: PktEl as PktElConstructor<HTMLElement>,
|
|
45
|
+
react: React,
|
|
46
|
+
displayName: 'PktDatepicker',
|
|
47
|
+
events: {
|
|
48
|
+
onChange: 'change' as EventName<Event>,
|
|
49
|
+
onValueChange: 'value-change' as EventName<CustomEvent>,
|
|
50
|
+
onToggleHelpText: 'toggleHelpText' as EventName<CustomEvent>,
|
|
51
|
+
},
|
|
52
|
+
})
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
1
3
|
import classNames from 'classnames'
|
|
2
4
|
import React, { ForwardedRef, forwardRef, HTMLAttributes } from 'react'
|
|
3
5
|
|
|
@@ -90,11 +92,15 @@ export const PktHeader = forwardRef(
|
|
|
90
92
|
const userMenuRef = React.useRef<HTMLLIElement>(null)
|
|
91
93
|
|
|
92
94
|
React.useEffect(() => {
|
|
93
|
-
document
|
|
94
|
-
|
|
95
|
+
if (document) {
|
|
96
|
+
document.addEventListener('mouseup', clickOutside)
|
|
97
|
+
window.addEventListener('scroll', onScroll)
|
|
98
|
+
}
|
|
95
99
|
return () => {
|
|
96
|
-
document
|
|
97
|
-
|
|
100
|
+
if (document) {
|
|
101
|
+
document.removeEventListener('mouseup', clickOutside)
|
|
102
|
+
window.removeEventListener('scroll', onScroll)
|
|
103
|
+
}
|
|
98
104
|
}
|
|
99
105
|
})
|
|
100
106
|
|
package/src/components/index.ts
CHANGED
|
@@ -4,7 +4,9 @@ export { PktAlert } from './alert/Alert'
|
|
|
4
4
|
export { PktBackLink } from './backlink/BackLink'
|
|
5
5
|
export { PktBreadcrumbs } from './breadcrumbs/Breadcrumbs'
|
|
6
6
|
export { PktButton } from './button/Button'
|
|
7
|
+
export { PktCard } from './card/Card'
|
|
7
8
|
export { PktCheckbox } from './checkbox/Checkbox'
|
|
9
|
+
export { PktDatepicker } from './datepicker/Datepicker'
|
|
8
10
|
export { PktFooter } from './footer/Footer'
|
|
9
11
|
export { PktFooterSimple } from './footerSimple/FooterSimple'
|
|
10
12
|
export { PktHeader } from './header/Header'
|
|
@@ -12,6 +14,7 @@ export { PktIcon } from './icon/Icon'
|
|
|
12
14
|
export { PktIconContext } from './icon/IconContext'
|
|
13
15
|
export { PktInput } from './input/Input'
|
|
14
16
|
export { PktInputWrapper } from './inputwrapper/InputWrapper'
|
|
17
|
+
export { PktLink } from './link/Link'
|
|
15
18
|
export { PktLinkCard } from './linkcard/LinkCard'
|
|
16
19
|
export { PktLoader } from './loader/Loader'
|
|
17
20
|
export { PktMessagebox } from './messagebox/Messagebox'
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React, { FC, ForwardedRef, forwardRef, ReactElement } from 'react'
|
|
4
|
+
import { createComponent, EventName } from '@lit/react'
|
|
5
|
+
import { PktLink as PktElLink } from '@oslokommune/punkt-elements'
|
|
6
|
+
import type { PktElType, PktElConstructor } from '@/interfaces/IPktElements'
|
|
7
|
+
|
|
8
|
+
interface IPktLink extends PktElType {
|
|
9
|
+
href?: string
|
|
10
|
+
iconName?: string | undefined
|
|
11
|
+
iconPosition?: string | undefined
|
|
12
|
+
external?: boolean
|
|
13
|
+
onClick?: (e: CustomEvent) => void
|
|
14
|
+
children?: React.ReactNode | React.ReactNode[]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const LitComponent: FC<IPktLink> = createComponent({
|
|
18
|
+
tagName: 'pkt-link',
|
|
19
|
+
elementClass: PktElLink as PktElConstructor<HTMLElement>,
|
|
20
|
+
react: React,
|
|
21
|
+
displayName: 'PktLink',
|
|
22
|
+
events: {
|
|
23
|
+
onClick: 'click' as EventName<CustomEvent>,
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export const PktLink: FC<IPktLink> = forwardRef(
|
|
28
|
+
({ children, ...props }: IPktLink, ref: ForwardedRef<HTMLElement>): ReactElement => {
|
|
29
|
+
return (
|
|
30
|
+
<LitComponent {...props} ref={ref}>
|
|
31
|
+
<span className="pkt-contents">{children}</span>
|
|
32
|
+
</LitComponent>
|
|
33
|
+
)
|
|
34
|
+
},
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
PktLink.displayName = 'PktLink'
|
|
@@ -40,6 +40,7 @@ describe('PktLinkCard', () => {
|
|
|
40
40
|
<PktLinkCard title="Beige" skin="beige" />
|
|
41
41
|
<PktLinkCard title="Beige outline" skin="beige-outline" />
|
|
42
42
|
<PktLinkCard title="Grey outline" skin="grey-outline" />
|
|
43
|
+
<PktLinkCard title="Gray outline" skin="gray-outline" />
|
|
43
44
|
</div>,
|
|
44
45
|
)
|
|
45
46
|
|
|
@@ -48,6 +49,7 @@ describe('PktLinkCard', () => {
|
|
|
48
49
|
expect(container.querySelectorAll('.pkt-linkcard--beige')).toHaveLength(1)
|
|
49
50
|
expect(container.querySelectorAll('.pkt-linkcard--beige-outline')).toHaveLength(1)
|
|
50
51
|
expect(container.querySelectorAll('.pkt-linkcard--grey-outline')).toHaveLength(1)
|
|
52
|
+
expect(container.querySelectorAll('.pkt-linkcard--gray-outline')).toHaveLength(1)
|
|
51
53
|
})
|
|
52
54
|
})
|
|
53
55
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
1
3
|
import React, { ForwardedRef, forwardRef } from 'react'
|
|
2
4
|
|
|
3
5
|
import { PktIcon } from '../icon/Icon'
|
|
4
6
|
|
|
5
7
|
export interface IPktLinkCard extends React.HTMLAttributes<HTMLAnchorElement> {
|
|
6
|
-
skin?: 'normal' | 'blue' | 'beige' | 'beige-outline' | 'green' | 'grey' | 'grey-outline'
|
|
8
|
+
skin?: 'normal' | 'blue' | 'beige' | 'beige-outline' | 'green' | 'grey' | 'gray' | 'grey-outline'| 'gray-outline'
|
|
7
9
|
title?: string
|
|
8
10
|
href?: string
|
|
9
11
|
iconName?: string
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React, { cloneElement, isValidElement, ReactElement, ReactNode, useRef, useState } from 'react'
|
|
2
4
|
import reactElementToJSXString from 'react-element-to-jsx-string'
|
|
3
5
|
import * as prettier from 'prettier/standalone'
|
|
4
6
|
import * as parserHtml from 'prettier/parser-html'
|
|
@@ -12,6 +14,7 @@ import { PktSelect } from '../select/Select'
|
|
|
12
14
|
import { PktTabs } from '../tabs/Tabs'
|
|
13
15
|
import { PktTag } from '../tag/Tag'
|
|
14
16
|
import { PktTextinput } from '../textinput/Textinput'
|
|
17
|
+
import { PktDatepicker } from '../datepicker/Datepicker'
|
|
15
18
|
import icons from '../../../../../apps/docs-astro/src/pages/json/icons.json'
|
|
16
19
|
import { PktPreviewSpecs, ISpecObject } from './PreviewSpecs'
|
|
17
20
|
|
|
@@ -27,7 +30,12 @@ export const PktPreview: React.FC<PreviewProps> = ({ specs, children, fullWidth
|
|
|
27
30
|
const initialProps =
|
|
28
31
|
specs.props && typeof specs.props === 'object' && !Array.isArray(specs.props)
|
|
29
32
|
? Object.entries(specs.props).reduce<Record<string, any>>((acc, [key, value]) => {
|
|
30
|
-
if (
|
|
33
|
+
if (
|
|
34
|
+
typeof value === 'object' &&
|
|
35
|
+
!Array.isArray(value) &&
|
|
36
|
+
value.default !== undefined &&
|
|
37
|
+
value.default !== null
|
|
38
|
+
) {
|
|
31
39
|
if (value.default === 'false') {
|
|
32
40
|
value.default = false
|
|
33
41
|
}
|
|
@@ -58,7 +66,7 @@ export const PktPreview: React.FC<PreviewProps> = ({ specs, children, fullWidth
|
|
|
58
66
|
active: false,
|
|
59
67
|
},
|
|
60
68
|
{
|
|
61
|
-
text:
|
|
69
|
+
text: `Kode (${specs.isElement ? 'Element' : 'HTML'})`,
|
|
62
70
|
icon: 'code',
|
|
63
71
|
active: false,
|
|
64
72
|
},
|
|
@@ -70,8 +78,12 @@ export const PktPreview: React.FC<PreviewProps> = ({ specs, children, fullWidth
|
|
|
70
78
|
])
|
|
71
79
|
|
|
72
80
|
const changeContent = (id: number) => {
|
|
73
|
-
if (id
|
|
74
|
-
|
|
81
|
+
if (id === 1) {
|
|
82
|
+
fetchJsx()
|
|
83
|
+
}
|
|
84
|
+
if (id === 2) {
|
|
85
|
+
fetchJsx()
|
|
86
|
+
fetchHtml()
|
|
75
87
|
}
|
|
76
88
|
setCopied('')
|
|
77
89
|
setTabs((prevTabs) =>
|
|
@@ -85,16 +97,31 @@ export const PktPreview: React.FC<PreviewProps> = ({ specs, children, fullWidth
|
|
|
85
97
|
const previewComponent = useRef<any>(null)
|
|
86
98
|
|
|
87
99
|
const fetchHtml = async () => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
100
|
+
if (specs.isElement && isValidElement(component)) {
|
|
101
|
+
fetchJsx().then(() => {
|
|
102
|
+
const componentType = isValidElement(component)
|
|
103
|
+
? (component.type as any).displayName || (component.type as any).name
|
|
104
|
+
: specs.name
|
|
105
|
+
setHtmlContent(
|
|
106
|
+
jsxContent
|
|
107
|
+
.replaceAll(componentType, specs.name || '')
|
|
108
|
+
.replaceAll('{', '"')
|
|
109
|
+
.replaceAll('}', '"'),
|
|
110
|
+
)
|
|
111
|
+
})
|
|
112
|
+
} else {
|
|
113
|
+
const html = await prettier.format(previewComponent.current.innerHTML, {
|
|
114
|
+
parser: 'html',
|
|
115
|
+
plugins: [parserHtml as any],
|
|
116
|
+
})
|
|
117
|
+
setHtmlContent(html.replace(/<\!--.*?-->/g, ''))
|
|
118
|
+
}
|
|
93
119
|
}
|
|
94
120
|
|
|
95
121
|
const fetchJsx = async () => {
|
|
96
122
|
const jsx = reactElementToJSXString(component)
|
|
97
123
|
setJsxContent(jsx)
|
|
124
|
+
return Promise.resolve()
|
|
98
125
|
}
|
|
99
126
|
|
|
100
127
|
const copyToClipboard = (type: string, content: string) => {
|
|
@@ -197,6 +224,19 @@ export const PktPreview: React.FC<PreviewProps> = ({ specs, children, fullWidth
|
|
|
197
224
|
))}
|
|
198
225
|
</PktSelect>
|
|
199
226
|
)
|
|
227
|
+
} else if (spec.type === 'ISOdatestring') {
|
|
228
|
+
return (
|
|
229
|
+
<PktDatepicker
|
|
230
|
+
id={key}
|
|
231
|
+
label={spec.name || key}
|
|
232
|
+
helptext={spec.description || null}
|
|
233
|
+
value={props[key]}
|
|
234
|
+
multiple={spec.variant === 'multiple'}
|
|
235
|
+
maxlength={999}
|
|
236
|
+
onChange={(e) => handleChange(key, (e.target as HTMLInputElement).value)}
|
|
237
|
+
requiredTag={spec.required}
|
|
238
|
+
/>
|
|
239
|
+
)
|
|
200
240
|
} else {
|
|
201
241
|
return (
|
|
202
242
|
<PktTextinput
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
1
3
|
import React from 'react'
|
|
2
4
|
import { PktTable } from '../table/Table'
|
|
3
5
|
import { PktTableHeader } from '../table/TableHeader'
|
|
@@ -10,6 +12,7 @@ export interface ISpecObject {
|
|
|
10
12
|
name?: string
|
|
11
13
|
'css-class'?: string
|
|
12
14
|
'dark-mode'?: boolean
|
|
15
|
+
isElement?: boolean
|
|
13
16
|
props?: Record<string, PropObject | string[]>
|
|
14
17
|
events?: Record<string, PropObject>
|
|
15
18
|
slots?: Record<string, any>
|
|
@@ -20,6 +23,7 @@ type PropObject = {
|
|
|
20
23
|
name?: string
|
|
21
24
|
description?: string
|
|
22
25
|
type?: string | string[]
|
|
26
|
+
variant?: string
|
|
23
27
|
converter?: string
|
|
24
28
|
reflect?: boolean
|
|
25
29
|
default?: any
|
|
@@ -47,6 +51,7 @@ export const PktPreviewSpecs: React.FC<{ specs: ISpecObject }> = ({ specs }) =>
|
|
|
47
51
|
<PktTable compact>
|
|
48
52
|
<PktTableHeader>
|
|
49
53
|
<PktTableRow>
|
|
54
|
+
<PktTableHeaderCell>Navn</PktTableHeaderCell>
|
|
50
55
|
<PktTableHeaderCell>Prop</PktTableHeaderCell>
|
|
51
56
|
<PktTableHeaderCell>Beskrivelse</PktTableHeaderCell>
|
|
52
57
|
<PktTableHeaderCell>Type</PktTableHeaderCell>
|
|
@@ -59,6 +64,7 @@ export const PktPreviewSpecs: React.FC<{ specs: ISpecObject }> = ({ specs }) =>
|
|
|
59
64
|
<PktTableDataCell dataLabel="Prop">
|
|
60
65
|
<pre>{key}</pre>
|
|
61
66
|
</PktTableDataCell>
|
|
67
|
+
<PktTableDataCell dataLabel="Navn">{(!Array.isArray(value) && value.name) || key}</PktTableDataCell>
|
|
62
68
|
{Array.isArray(value) ? (
|
|
63
69
|
<>
|
|
64
70
|
<PktTableDataCell dataLabel="Beskrivelse"></PktTableDataCell>
|
|
@@ -68,7 +74,9 @@ export const PktPreviewSpecs: React.FC<{ specs: ISpecObject }> = ({ specs }) =>
|
|
|
68
74
|
</>
|
|
69
75
|
) : (
|
|
70
76
|
<>
|
|
71
|
-
<PktTableDataCell dataLabel="Beskrivelse">
|
|
77
|
+
<PktTableDataCell dataLabel="Beskrivelse">
|
|
78
|
+
<span dangerouslySetInnerHTML={{ __html: value.description || '' }}></span>
|
|
79
|
+
</PktTableDataCell>
|
|
72
80
|
<PktTableDataCell dataLabel="Type">
|
|
73
81
|
<pre>{value.type && formatType(value.type)}</pre>
|
|
74
82
|
</PktTableDataCell>
|
|
@@ -97,7 +105,9 @@ export const PktPreviewSpecs: React.FC<{ specs: ISpecObject }> = ({ specs }) =>
|
|
|
97
105
|
<PktTableDataCell dataLabel="Event">
|
|
98
106
|
<pre>{key}</pre>
|
|
99
107
|
</PktTableDataCell>
|
|
100
|
-
<PktTableDataCell dataLabel="Beskrivelse">
|
|
108
|
+
<PktTableDataCell dataLabel="Beskrivelse">
|
|
109
|
+
<span dangerouslySetInnerHTML={{ __html: value.description || '' }}></span>
|
|
110
|
+
</PktTableDataCell>
|
|
101
111
|
</PktTableRow>
|
|
102
112
|
))}
|
|
103
113
|
</PktTableBody>
|
|
@@ -120,7 +130,9 @@ export const PktPreviewSpecs: React.FC<{ specs: ISpecObject }> = ({ specs }) =>
|
|
|
120
130
|
<PktTableDataCell dataLabel="Slot">
|
|
121
131
|
<pre>{key}</pre>
|
|
122
132
|
</PktTableDataCell>
|
|
123
|
-
<PktTableDataCell dataLabel="Beskrivelse">
|
|
133
|
+
<PktTableDataCell dataLabel="Beskrivelse">
|
|
134
|
+
<span dangerouslySetInnerHTML={{ __html: value.description || '' }}></span>
|
|
135
|
+
</PktTableDataCell>
|
|
124
136
|
</PktTableRow>
|
|
125
137
|
))}
|
|
126
138
|
</PktTableBody>
|
|
@@ -4,7 +4,7 @@ import React, { forwardRef, Ref, useRef, useEffect, KeyboardEvent, Fragment } fr
|
|
|
4
4
|
import { PktIcon } from '../icon/Icon'
|
|
5
5
|
import { PktTag } from '../tag/Tag'
|
|
6
6
|
|
|
7
|
-
export type TSkin = 'blue' | 'green' | 'red' | 'beige' | 'yellow' | 'grey' | 'blue-light'
|
|
7
|
+
export type TSkin = 'blue' | 'green' | 'red' | 'beige' | 'yellow' | 'grey' | 'gray' | 'blue-light'
|
|
8
8
|
|
|
9
9
|
export interface Tab {
|
|
10
10
|
text: string
|