@oslokommune/punkt-react 12.36.1 → 12.37.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 +18 -0
- package/dist/index.d.ts +16 -0
- package/dist/punkt-react.es.js +8230 -8036
- package/dist/punkt-react.umd.js +276 -266
- package/package.json +5 -5
- package/src/components/backlink/BackLink.tsx +1 -1
- package/src/components/consent/Consent.tsx +21 -0
- package/src/components/footer/Footer.tsx +22 -0
- package/src/components/footerSimple/FooterSimple.tsx +12 -0
- package/src/components/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.37.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",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@lit-labs/ssr-dom-shim": "^1.2.1",
|
|
40
40
|
"@lit/react": "^1.0.7",
|
|
41
|
-
"@oslokommune/punkt-elements": "^12.
|
|
41
|
+
"@oslokommune/punkt-elements": "^12.37.0",
|
|
42
42
|
"angular-html-parser": "^6.0.2",
|
|
43
43
|
"html-format": "^1.1.7",
|
|
44
44
|
"prettier": "^3.3.3",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@babel/plugin-proposal-private-property-in-object": "^7.18.6",
|
|
51
|
-
"@oslokommune/punkt-assets": "^12.
|
|
52
|
-
"@oslokommune/punkt-css": "^12.
|
|
51
|
+
"@oslokommune/punkt-assets": "^12.37.0",
|
|
52
|
+
"@oslokommune/punkt-css": "^12.37.0",
|
|
53
53
|
"@testing-library/jest-dom": "^6.5.0",
|
|
54
54
|
"@testing-library/react": "^16.0.1",
|
|
55
55
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
113
113
|
},
|
|
114
114
|
"license": "MIT",
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "119c31d1536757ed597224baa05966cf8bca5ecc"
|
|
116
116
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ForwardRefExoticComponent, LegacyRef, AnchorHTMLAttributes, MouseEventHandler } from 'react'
|
|
2
|
-
import { createComponent
|
|
2
|
+
import { createComponent } from '@lit/react'
|
|
3
3
|
import { PktBackLink as PktElBackLink } from '@oslokommune/punkt-elements'
|
|
4
4
|
import type { IPktBackLink as IPktElBackLink } from '@oslokommune/punkt-elements'
|
|
5
5
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { ForwardRefExoticComponent, LegacyRef } from 'react'
|
|
2
|
+
import { createComponent, EventName } from '@lit/react'
|
|
3
|
+
import { PktConsent as PktElConsent } from '@oslokommune/punkt-elements'
|
|
4
|
+
import type { IPktConsent as IPktElConsent } from '@oslokommune/punkt-elements'
|
|
5
|
+
|
|
6
|
+
export interface IPktConsent extends IPktElConsent {
|
|
7
|
+
ref?: LegacyRef<HTMLDivElement>
|
|
8
|
+
onToggleConsent?: (e: CustomEvent) => void
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const PktConsent: ForwardRefExoticComponent<IPktConsent> = createComponent({
|
|
12
|
+
tagName: 'pkt-consent',
|
|
13
|
+
elementClass: PktElConsent,
|
|
14
|
+
react: React,
|
|
15
|
+
displayName: 'PktConsent',
|
|
16
|
+
events: {
|
|
17
|
+
onToggleConsent: 'toggle-consent' as EventName<CustomEvent>,
|
|
18
|
+
},
|
|
19
|
+
}) as ForwardRefExoticComponent<IPktConsent>
|
|
20
|
+
|
|
21
|
+
PktConsent.displayName = 'PktConsent'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
3
|
import { PktIcon } from '../icon/Icon'
|
|
4
|
+
import { PktConsent } from '../consent/Consent'
|
|
4
5
|
|
|
5
6
|
interface Link {
|
|
6
7
|
href: string
|
|
@@ -29,6 +30,10 @@ export interface IPktFooter extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
29
30
|
personvernOgInfoLink?: string
|
|
30
31
|
tilgjengelighetLink?: string
|
|
31
32
|
openLinksInNewTab?: boolean
|
|
33
|
+
includeConsent?: boolean
|
|
34
|
+
hotjarId?: string | null
|
|
35
|
+
googleAnalyticsId?: string | null
|
|
36
|
+
onToggleConsent?: (e: CustomEvent) => void
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
export const PktFooter: React.FC<IPktFooter> = ({
|
|
@@ -39,8 +44,15 @@ export const PktFooter: React.FC<IPktFooter> = ({
|
|
|
39
44
|
openLinksInNewTab = false,
|
|
40
45
|
personvernOgInfoLink = 'https://www.oslo.kommune.no/personvern-og-informasjonskapsler/',
|
|
41
46
|
tilgjengelighetLink = 'https://www.oslo.kommune.no/tilgjengelighet/',
|
|
47
|
+
includeConsent = false,
|
|
48
|
+
hotjarId = null,
|
|
49
|
+
googleAnalyticsId = null,
|
|
50
|
+
onToggleConsent = (e: CustomEvent) => {
|
|
51
|
+
console.log(e.detail)
|
|
52
|
+
},
|
|
42
53
|
}) => {
|
|
43
54
|
const classNames = [className, 'pkt-footer'].filter(Boolean).join(' ')
|
|
55
|
+
|
|
44
56
|
return (
|
|
45
57
|
<footer className={classNames} data-mode="dark">
|
|
46
58
|
<div className="pkt-footer__container">
|
|
@@ -108,6 +120,16 @@ export const PktFooter: React.FC<IPktFooter> = ({
|
|
|
108
120
|
Tilgjengelighet
|
|
109
121
|
</a>
|
|
110
122
|
</li>
|
|
123
|
+
{includeConsent && (
|
|
124
|
+
<li className="pkt-footer__list-item">
|
|
125
|
+
<PktConsent
|
|
126
|
+
triggerType="footerlink"
|
|
127
|
+
hotjarId={hotjarId}
|
|
128
|
+
googleAnalyticsId={googleAnalyticsId}
|
|
129
|
+
onToggleConsent={onToggleConsent}
|
|
130
|
+
/>
|
|
131
|
+
</li>
|
|
132
|
+
)}
|
|
111
133
|
</ul>
|
|
112
134
|
</div>
|
|
113
135
|
</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
3
|
import { PktIcon } from '../icon/Icon'
|
|
4
|
+
import { PktConsent } from '../consent/Consent'
|
|
4
5
|
|
|
5
6
|
export interface IPktFooterSimple extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
7
|
links?: Array<{
|
|
@@ -12,6 +13,9 @@ export interface IPktFooterSimple extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
12
13
|
personvernOgInfoLink?: string
|
|
13
14
|
tilgjengelighetLink?: string
|
|
14
15
|
openLinksInNewTab?: boolean
|
|
16
|
+
includeConsent?: boolean
|
|
17
|
+
hotjarId?: string | null
|
|
18
|
+
googleAnalyticsId?: string | null
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
export const PktFooterSimple: React.FC<IPktFooterSimple> = ({
|
|
@@ -19,6 +23,9 @@ export const PktFooterSimple: React.FC<IPktFooterSimple> = ({
|
|
|
19
23
|
openLinksInNewTab = false,
|
|
20
24
|
personvernOgInfoLink = 'https://www.oslo.kommune.no/personvern-og-informasjonskapsler/',
|
|
21
25
|
tilgjengelighetLink = 'https://www.oslo.kommune.no/tilgjengelighet/',
|
|
26
|
+
includeConsent = false,
|
|
27
|
+
hotjarId = null,
|
|
28
|
+
googleAnalyticsId = null,
|
|
22
29
|
className,
|
|
23
30
|
}) => {
|
|
24
31
|
const classNames = [className, 'pkt-footer-simple'].filter(Boolean).join(' ')
|
|
@@ -61,6 +68,11 @@ export const PktFooterSimple: React.FC<IPktFooterSimple> = ({
|
|
|
61
68
|
Tilgjengelighet
|
|
62
69
|
</a>
|
|
63
70
|
</li>
|
|
71
|
+
{includeConsent && (
|
|
72
|
+
<li className="pkt-footer-simple__list-item">
|
|
73
|
+
<PktConsent triggerType="footerlink" hotjarId={hotjarId} googleAnalyticsId={googleAnalyticsId} />
|
|
74
|
+
</li>
|
|
75
|
+
)}
|
|
64
76
|
</ul>
|
|
65
77
|
</div>
|
|
66
78
|
</footer>
|
package/src/components/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { PktButton } from './button/Button'
|
|
|
7
7
|
export { PktCard } from './card/Card'
|
|
8
8
|
export { PktCheckbox } from './checkbox/Checkbox'
|
|
9
9
|
export { PktCombobox } from './combobox/Combobox'
|
|
10
|
+
export { PktConsent } from './consent/Consent'
|
|
10
11
|
export { PktDatepicker } from './datepicker/Datepicker'
|
|
11
12
|
export { PktFooter } from './footer/Footer'
|
|
12
13
|
export { PktFooterSimple } from './footerSimple/FooterSimple'
|