@oslokommune/punkt-react 13.6.15 → 13.7.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 (67) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/index.d.ts +38 -74
  3. package/dist/punkt-react.es.js +5358 -35971
  4. package/dist/punkt-react.umd.js +418 -548
  5. package/package.json +11 -15
  6. package/src/components/accordion/Accordion.test.tsx +1 -1
  7. package/src/components/accordion/Accordion.tsx +1 -1
  8. package/src/components/accordion/AccordionItem.tsx +6 -5
  9. package/src/components/alert/Alert.tsx +2 -1
  10. package/src/components/breadcrumbs/Breadcrumbs.test.tsx +16 -4
  11. package/src/components/breadcrumbs/Breadcrumbs.tsx +3 -2
  12. package/src/components/button/Button.tsx +3 -2
  13. package/src/components/checkbox/Checkbox.tsx +4 -3
  14. package/src/components/datepicker/Datepicker.test.tsx +393 -0
  15. package/src/components/footer/Footer.tsx +6 -5
  16. package/src/components/footerSimple/FooterSimple.tsx +4 -3
  17. package/src/components/icon/Icon.test.tsx +6 -19
  18. package/src/components/index.ts +0 -2
  19. package/src/components/input/Input.tsx +4 -3
  20. package/src/components/radio/RadioButton.tsx +3 -2
  21. package/src/components/searchinput/SearchInput.tsx +3 -3
  22. package/src/components/stepper/Stepper.tsx +6 -6
  23. package/src/components/table/Table.tsx +2 -1
  24. package/src/components/table/TableBody.tsx +2 -1
  25. package/src/components/table/TableData.tsx +2 -1
  26. package/src/components/table/TableDataCell.tsx +2 -1
  27. package/src/components/table/TableHeader.tsx +2 -1
  28. package/src/components/table/TableHeaderCell.tsx +2 -1
  29. package/src/components/table/TableRow.tsx +2 -1
  30. package/src/components/tag/Tag.tsx +2 -1
  31. package/src/components/preview/Preview.tsx +0 -274
  32. package/src/components/preview/PreviewCode.tsx +0 -118
  33. package/src/components/preview/PreviewPropEditor.tsx +0 -266
  34. package/src/components/preview/PreviewSpecs.tsx +0 -125
  35. package/src/components/preview/PreviewWithJson.tsx +0 -519
  36. package/src/components/preview/preview-types.ts +0 -42
  37. package/src/components/preview/preview-utils.ts +0 -226
  38. package/src/components/preview/previewJson/accordion.json +0 -84
  39. package/src/components/preview/previewJson/alert.json +0 -27
  40. package/src/components/preview/previewJson/backlink.json +0 -14
  41. package/src/components/preview/previewJson/breadcrumbs.json +0 -17
  42. package/src/components/preview/previewJson/button.json +0 -28
  43. package/src/components/preview/previewJson/card.json +0 -41
  44. package/src/components/preview/previewJson/checkbox.json +0 -21
  45. package/src/components/preview/previewJson/combobox.json +0 -24
  46. package/src/components/preview/previewJson/consent.json +0 -14
  47. package/src/components/preview/previewJson/datepicker.json +0 -14
  48. package/src/components/preview/previewJson/footer-simple.json +0 -17
  49. package/src/components/preview/previewJson/footer.json +0 -29
  50. package/src/components/preview/previewJson/header.json +0 -34
  51. package/src/components/preview/previewJson/icon.json +0 -13
  52. package/src/components/preview/previewJson/input-wrapper.json +0 -39
  53. package/src/components/preview/previewJson/link.json +0 -28
  54. package/src/components/preview/previewJson/linkcard.json +0 -30
  55. package/src/components/preview/previewJson/loader.json +0 -28
  56. package/src/components/preview/previewJson/messagebox.json +0 -28
  57. package/src/components/preview/previewJson/modal.json +0 -65
  58. package/src/components/preview/previewJson/progressbar.json +0 -16
  59. package/src/components/preview/previewJson/radiobutton.json +0 -21
  60. package/src/components/preview/previewJson/searchinput.json +0 -20
  61. package/src/components/preview/previewJson/select.json +0 -73
  62. package/src/components/preview/previewJson/steps.json +0 -72
  63. package/src/components/preview/previewJson/table.json +0 -130
  64. package/src/components/preview/previewJson/tabs.json +0 -33
  65. package/src/components/preview/previewJson/tag.json +0 -26
  66. package/src/components/preview/previewJson/textarea.json +0 -18
  67. package/src/components/preview/previewJson/textinput.json +0 -18
@@ -1,28 +0,0 @@
1
- {
2
- "name": "LinkPreview",
3
- "type": "PktLink",
4
- "spec": "link",
5
- "previewProps": ["href", "iconName", "iconPosition", "external"],
6
- "children": [
7
- {
8
- "name": "Innhold",
9
- "type": "text"
10
- }
11
- ],
12
- "preview": {
13
- "type": "PktLink",
14
- "props": {
15
- "href": "#",
16
- "target": "_self",
17
- "iconName": "",
18
- "iconPosition": "left",
19
- "external": false
20
- },
21
- "children": [
22
- {
23
- "type": "text",
24
- "children": "Dette er en lenke"
25
- }
26
- ]
27
- }
28
- }
@@ -1,30 +0,0 @@
1
- {
2
- "name": "LinkCardPreview",
3
- "type": "PktLinkCard",
4
- "spec": "linkcard",
5
- "previewProps": ["title", "skin", "iconName", "external"],
6
- "children": [
7
- {
8
- "name": "Innhold",
9
- "type": "text",
10
- "defaults": "Dette er innholdet i kortet."
11
- }
12
- ],
13
- "preview": {
14
- "type": "PktLinkCard",
15
- "props": {
16
- "title": "Dette er en linkcard",
17
- "href": "#",
18
- "skin": "beige-outline",
19
- "iconName": "chevron-right",
20
- "openInNewTab": false,
21
- "external": false
22
- },
23
- "children": [
24
- {
25
- "type": "text",
26
- "children": "Dette er innholdet i kortet. Her kan du skrive hva du vil."
27
- }
28
- ]
29
- }
30
- }
@@ -1,28 +0,0 @@
1
- {
2
- "name": "LoaderPreview",
3
- "type": "PktLoader",
4
- "spec": "loader",
5
- "previewProps": ["message", "variant", "isLoading"],
6
- "children": [
7
- {
8
- "name": "Innhold",
9
- "type": "text",
10
- "defaults": "Dette er innholdet som lastes inn."
11
- }
12
- ],
13
- "preview": {
14
- "type": "PktLoader",
15
- "props": {
16
- "message": "Laster innhold...",
17
- "size": "large",
18
- "variant": "rainbow",
19
- "isLoading": true
20
- },
21
- "children": [
22
- {
23
- "type": "text",
24
- "children": "Dette er innholdet som lastes inn. Det vil først vise seg når lastingen er fullført (isLoading er false)."
25
- }
26
- ]
27
- }
28
- }
@@ -1,28 +0,0 @@
1
- {
2
- "name": "MessageboxPreview",
3
- "type": "PktMessagebox",
4
- "spec": "messagebox",
5
- "previewProps": ["title", "skin", "compact", "closable"],
6
- "children": [
7
- {
8
- "name": "Innhold",
9
- "type": "text",
10
- "defaults": "Dette er innholdet i meldingsboksen."
11
- }
12
- ],
13
- "preview": {
14
- "type": "PktMessagebox",
15
- "props": {
16
- "title": "Dette er en meldingsboks",
17
- "skin": "beige",
18
- "compact": false,
19
- "closable": false
20
- },
21
- "children": [
22
- {
23
- "type": "text",
24
- "children": "Dette er innholdet i meldingsboksen."
25
- }
26
- ]
27
- }
28
- }
@@ -1,65 +0,0 @@
1
- {
2
- "name": "ModalPreview",
3
- "type": "PktModal",
4
- "spec": "div",
5
- "children": [
6
- {
7
- "name": "Button",
8
- "type": "PktButton",
9
- "spec": "button",
10
- "children": [
11
- {
12
- "type": "text",
13
- "name": "Innhold"
14
- }
15
- ]
16
- },
17
- {
18
- "name": "Modal",
19
- "type": "PktModal",
20
- "spec": "modal",
21
- "children": [
22
- {
23
- "type": "text",
24
- "name": "Innhold"
25
- }
26
- ]
27
- }
28
- ],
29
- "previewProps": [],
30
- "preview": {
31
- "type": "div",
32
- "props": {},
33
- "children": [
34
- {
35
- "type": "PktButton",
36
- "props": {
37
- "skin": "primary",
38
- "size": "medium",
39
- "onClick": "openModal"
40
- },
41
- "children": [
42
- {
43
- "type": "text",
44
- "children": "Åpne modal"
45
- }
46
- ]
47
- },
48
- {
49
- "type": "PktModal",
50
- "props": {
51
- "headingText": "Dette er en modal",
52
- "size": "medium",
53
- "variant": "dialog",
54
- "closeOnBackdropClick": true
55
- },
56
- "children": [
57
- {
58
- "type": "text",
59
- "children": "Her er innholdet i modalen."
60
- }
61
- ]
62
- }
63
- ]
64
- }
65
- }
@@ -1,16 +0,0 @@
1
- {
2
- "name": "ProgressbarPreview",
3
- "type": "PktProgressbar",
4
- "spec": "progressbar",
5
- "previewProps": ["title", "valueCurrent", "skin"],
6
- "preview": {
7
- "type": "PktProgressbar",
8
- "props": {
9
- "title": "Fremdrift",
10
- "valueMin": 0,
11
- "valueMax": 100,
12
- "valueCurrent": 40,
13
- "statusType": "percentage"
14
- }
15
- }
16
- }
@@ -1,21 +0,0 @@
1
- {
2
- "name": "RadiobuttonPreview",
3
- "type": "PktRadioButton",
4
- "spec": "radiobutton",
5
- "previewProps": ["label", "checkHelptext", "checked", "hasTile"],
6
- "preview": {
7
- "type": "PktRadioButton",
8
- "props": {
9
- "id": "radio-1",
10
- "name": "gruppe1",
11
- "label": "Velg dette alternativet",
12
- "checked": false,
13
- "defaultChecked": false,
14
- "hasTile": false,
15
- "disabled": false,
16
- "checkHelptext": "Dette er hjelpetekst for radioknappen.",
17
- "value": "alternativ1",
18
- "hasError": false
19
- }
20
- }
21
- }
@@ -1,20 +0,0 @@
1
- {
2
- "name": "SearchinputPreview",
3
- "type": "PktSearchInput",
4
- "spec": "searchinput",
5
- "previewProps": ["label", "appearance", "disabled"],
6
- "preview": {
7
- "type": "PktSearchInput",
8
- "props": {
9
- "appearance": "global",
10
- "placeholder": "Søk...",
11
- "label": "Søk i byer",
12
- "value": "Oslo",
13
- "action": "",
14
- "suggestions": [
15
- { "title": "Oslo", "text": "Hovedstaden i Norge", "href": "https://oslo.kommune.no" },
16
- { "title": "Bergen", "text": "Vestlandets hovedstad", "href": "https://bergen.kommune.no" }
17
- ]
18
- }
19
- }
20
- }
@@ -1,73 +0,0 @@
1
- {
2
- "name": "SelectPreview",
3
- "type": "PktSelect",
4
- "spec": "select",
5
- "previewProps": ["label", "helptext", "requiredTag", "optionalTag", "hasError", "disabled"],
6
- "children": [
7
- {
8
- "name": "Valg",
9
- "type": "option",
10
- "spec": "option",
11
- "props": {
12
- "value": { "type": "string" },
13
- "selected": { "type": "boolean", "required": false },
14
- "disabled": { "type": "boolean", "required": false }
15
- },
16
- "children": [
17
- {
18
- "name": "Tekst",
19
- "type": "text"
20
- }
21
- ]
22
- }
23
- ],
24
- "preview": {
25
- "type": "PktSelect",
26
- "props": {
27
- "label": "Velg et alternativ",
28
- "name": "valg",
29
- "id": "select-1",
30
- "helptext": "Dette er hjelpetekst."
31
- },
32
- "children": [
33
- {
34
- "type": "option",
35
- "props": {
36
- "value": "a"
37
- },
38
- "children": [
39
- {
40
- "type": "text",
41
- "children": "Alternativ A"
42
- }
43
- ]
44
- },
45
- {
46
- "type": "option",
47
- "props": {
48
- "value": "b",
49
- "selected": true
50
- },
51
- "children": [
52
- {
53
- "type": "text",
54
- "children": "Alternativ B"
55
- }
56
- ]
57
- },
58
- {
59
- "type": "option",
60
- "props": {
61
- "value": "c",
62
- "disabled": true
63
- },
64
- "children": [
65
- {
66
- "type": "text",
67
- "children": "Alternativ C"
68
- }
69
- ]
70
- }
71
- ]
72
- }
73
- }
@@ -1,72 +0,0 @@
1
- {
2
- "name": "StepsPreview",
3
- "type": "PktStepper",
4
- "spec": "steps",
5
- "previewProps": ["orientation", "hideNonActiveStepsContent"],
6
- "children": [
7
- {
8
- "name": "Step",
9
- "type": "PktStep",
10
- "spec": "stepItem",
11
- "defaults": {
12
- "title": "Steg $n",
13
- "status": "incomplete"
14
- },
15
- "children": [
16
- {
17
- "type": "text",
18
- "content": "Dette er innholdet for steg $n"
19
- }
20
- ]
21
- }
22
- ],
23
- "preview": {
24
- "type": "PktStepper",
25
- "props": {
26
- "activeStep": 1,
27
- "hideNonActiveStepsContent": false,
28
- "orientation": "vertical"
29
- },
30
- "children": [
31
- {
32
- "type": "PktStep",
33
- "props": {
34
- "title": "Steg 1",
35
- "status": "completed"
36
- },
37
- "children": [
38
- {
39
- "type": "text",
40
- "children": "Dette er innholdet for steg 1"
41
- }
42
- ]
43
- },
44
- {
45
- "type": "PktStep",
46
- "props": {
47
- "title": "Steg 2",
48
- "status": "current"
49
- },
50
- "children": [
51
- {
52
- "type": "text",
53
- "children": "Dette er innholdet for steg 2"
54
- }
55
- ]
56
- },
57
- {
58
- "type": "PktStep",
59
- "props": {
60
- "title": "Steg 3",
61
- "status": "incomplete"
62
- },
63
- "children": [
64
- {
65
- "type": "text",
66
- "children": "Dette er innholdet for steg 3"
67
- }
68
- ]
69
- }
70
- ]
71
- }
72
- }
@@ -1,130 +0,0 @@
1
- {
2
- "name": "TablePreview",
3
- "type": "PktTable",
4
- "spec": "table",
5
- "previewProps": ["compact", "skin", "responsiveView"],
6
- "children": [
7
- {
8
- "name": "Header",
9
- "type": "PktTableHeader",
10
- "spec": "table-header",
11
- "children": [
12
- {
13
- "name": "HeaderCell",
14
- "type": "PktTableHeaderCell",
15
- "spec": "table-header-cell",
16
- "defaults": {
17
- "children": "Kolonne $n"
18
- }
19
- }
20
- ]
21
- },
22
- {
23
- "name": "Body",
24
- "type": "PktTableBody",
25
- "spec": "table-body",
26
- "children": [
27
- {
28
- "name": "Row",
29
- "type": "PktTableRow",
30
- "spec": "table-row",
31
- "children": [
32
- {
33
- "name": "DataCell",
34
- "type": "PktTableDataCell",
35
- "spec": "table-data-cell",
36
- "defaults": {
37
- "children": "Rad $row, celle $col"
38
- }
39
- }
40
- ]
41
- }
42
- ]
43
- }
44
- ],
45
- "preview": {
46
- "type": "PktTable",
47
- "props": {
48
- "compact": false,
49
- "skin": "basic",
50
- "responsiveView": true
51
- },
52
- "children": [
53
- {
54
- "type": "PktTableHeader",
55
- "props": {},
56
- "children": [
57
- {
58
- "type": "PktTableRow",
59
- "props": {},
60
- "children": [
61
- {
62
- "type": "PktTableHeaderCell",
63
- "props": {},
64
- "children": "Navn"
65
- },
66
- {
67
- "type": "PktTableHeaderCell",
68
- "props": {},
69
- "children": "Alder"
70
- },
71
- {
72
- "type": "PktTableHeaderCell",
73
- "props": {},
74
- "children": "By"
75
- }
76
- ]
77
- }
78
- ]
79
- },
80
- {
81
- "type": "PktTableBody",
82
- "props": {},
83
- "children": [
84
- {
85
- "type": "PktTableRow",
86
- "props": {},
87
- "children": [
88
- {
89
- "type": "PktTableDataCell",
90
- "props": {},
91
- "children": "Ola Nordmann"
92
- },
93
- {
94
- "type": "PktTableDataCell",
95
- "props": {},
96
- "children": "35"
97
- },
98
- {
99
- "type": "PktTableDataCell",
100
- "props": {},
101
- "children": "Oslo"
102
- }
103
- ]
104
- },
105
- {
106
- "type": "PktTableRow",
107
- "props": {},
108
- "children": [
109
- {
110
- "type": "PktTableDataCell",
111
- "props": {},
112
- "children": "Kari Nordmann"
113
- },
114
- {
115
- "type": "PktTableDataCell",
116
- "props": {},
117
- "children": "32"
118
- },
119
- {
120
- "type": "PktTableDataCell",
121
- "props": {},
122
- "children": "Bergen"
123
- }
124
- ]
125
- }
126
- ]
127
- }
128
- ]
129
- }
130
- }
@@ -1,33 +0,0 @@
1
- {
2
- "name": "TabsPreview",
3
- "type": "PktTabs",
4
- "spec": "tabs",
5
- "previewProps": ["tabs"],
6
- "preview": {
7
- "type": "PktTabs",
8
- "props": {
9
- "tabs": [
10
- {
11
- "text": "Tab 1",
12
- "href": "#tab1",
13
- "active": true,
14
- "tag": {
15
- "skin": "blue",
16
- "text": "Ny"
17
- },
18
- "icon": "user"
19
- },
20
- {
21
- "text": "Tab 2",
22
- "href": "#tab2",
23
- "active": false
24
- },
25
- {
26
- "text": "Tab 3",
27
- "href": "#tab3",
28
- "active": false
29
- }
30
- ]
31
- }
32
- }
33
- }
@@ -1,26 +0,0 @@
1
- {
2
- "name": "TagPreview",
3
- "type": "PktTag",
4
- "spec": "tag",
5
- "rerender": true,
6
- "previewProps": ["size", "iconName", "skin", "closeTag"],
7
- "children": [
8
- {
9
- "name": "Tekst",
10
- "type": "text",
11
- "defaults": "Dette er en tag"
12
- }
13
- ],
14
- "preview": {
15
- "type": "PktTag",
16
- "props": {
17
- "closeTag": true
18
- },
19
- "children": [
20
- {
21
- "type": "text",
22
- "children": "Dette er en tag"
23
- }
24
- ]
25
- }
26
- }
@@ -1,18 +0,0 @@
1
- {
2
- "name": "TextareaPreview",
3
- "type": "PktTextarea",
4
- "spec": "textarea",
5
- "previewProps": ["label", "helptext", "requiredTag", "hasError", "disabled", "counter"],
6
- "preview": {
7
- "type": "PktTextarea",
8
- "props": {
9
- "label": "Fyll inn teksten din",
10
- "name": "kommentar",
11
- "placeholder": "Skriv inn kommentar",
12
- "helptext": "Dette er hjelpetekst.",
13
- "rows": 4,
14
- "id": "textarea-1",
15
- "useWrapper": true
16
- }
17
- }
18
- }
@@ -1,18 +0,0 @@
1
- {
2
- "name": "TextinputPreview",
3
- "type": "PktTextinput",
4
- "spec": "textinput",
5
- "previewProps": ["label", "helptext", "type", "requiredTag", "disabled", "counter"],
6
- "preview": {
7
- "type": "PktTextinput",
8
- "props": {
9
- "label": "Fornavn",
10
- "name": "fornavn",
11
- "placeholder": "Skriv inn fornavn",
12
- "helptext": "Dette er hjelpetekst.",
13
- "type": "text",
14
- "id": "textinput-1",
15
- "useWrapper": true
16
- }
17
- }
18
- }