@oslokommune/punkt-react 11.5.2 → 11.5.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
CHANGED
|
@@ -5,6 +5,24 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [11.5.4](https://github.com/oslokommune/punkt/compare/11.5.3...11.5.4) (2024-02-16)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
Ingen
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
* oppdatere onClick med event i PktBacklink (#1521).
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Chores
|
|
21
|
+
Ingen
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
|
|
8
26
|
## [11.5.0](https://github.com/oslokommune/punkt/compare/11.4.9...11.5.0) (2024-02-14)
|
|
9
27
|
|
|
10
28
|
### ⚠ BREAKING CHANGES
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
export interface IPktBackLink extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
3
3
|
href?: string;
|
|
4
4
|
text?: string;
|
|
5
|
-
onClick?: () => void;
|
|
6
5
|
className?: string;
|
|
7
6
|
}
|
|
8
7
|
export declare const PktBackLink: React.ForwardRefExoticComponent<IPktBackLink & React.RefAttributes<HTMLAnchorElement>>;
|
package/dist/punkt-react.es.js
CHANGED
|
@@ -699,8 +699,8 @@ const X = Je.Fragment, i = Je.jsx, k = Je.jsxs, Fe = {}, kn = '<svg xmlns="http:
|
|
|
699
699
|
l,
|
|
700
700
|
"pkt-back-link"
|
|
701
701
|
].filter(Boolean).join(" ");
|
|
702
|
-
return /* @__PURE__ */ i("nav", { ref: o, className: s, "aria-label": "Gå tilbake et steg", children: /* @__PURE__ */ k("a", { href: e || "/", className: "pkt-link pkt-link--icon-left", onClick: () => {
|
|
703
|
-
a && a();
|
|
702
|
+
return /* @__PURE__ */ i("nav", { ref: o, className: s, "aria-label": "Gå tilbake et steg", children: /* @__PURE__ */ k("a", { href: e || "/", className: "pkt-link pkt-link--icon-left", onClick: (p) => {
|
|
703
|
+
a && a(p);
|
|
704
704
|
}, ...r, children: [
|
|
705
705
|
/* @__PURE__ */ i(E, { className: "pkt-back-link__icon pkt-icon pkt-link__icon", name: "chevron-thin-left", "aria-hidden": "true" }),
|
|
706
706
|
/* @__PURE__ */ i("span", { className: "pkt-back-link__text", children: n || "Forsiden" })
|
package/dist/punkt-react.umd.js
CHANGED
|
@@ -24,7 +24,7 @@ Check the render method of \``+t+"`."}return""}}function vr(t){{if(t!==void 0){v
|
|
|
24
24
|
|
|
25
25
|
Check your code at `+p+":"+m+"."}return""}}var Lt={};function _r(t){{var p=It();if(!p){var m=typeof t=="string"?t:t.displayName||t.name;m&&(p=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+m+">.")}return p}}function Ft(t,p){{if(!t._store||t._store.validated||t.key!=null)return;t._store.validated=!0;var m=_r(p);if(Lt[m])return;Lt[m]=!0;var b="";t&&t._owner&&t._owner!==ze.current&&(b=" It was passed a child from "+L(t._owner.type)+"."),ie(t),C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',m,b),ie(null)}}function Ut(t,p){{if(typeof t!="object")return;if(Ke(t))for(var m=0;m<t.length;m++){var b=t[m];Ge(b)&&Ft(b,p)}else if(Ge(t))t._store&&(t._store.validated=!0);else if(t){var O=I(t);if(typeof O=="function"&&O!==t.entries)for(var D=O.call(t),P;!(P=D.next()).done;)Ge(P.value)&&Ft(P.value,p)}}}function br(t){{var p=t.type;if(p==null||typeof p=="string")return;var m;if(typeof p=="function")m=p.propTypes;else if(typeof p=="object"&&(p.$$typeof===f||p.$$typeof===k))m=p.propTypes;else return;if(m){var b=L(p);lr(m,t.props,"prop",b,t)}else if(p.PropTypes!==void 0&&!qe){qe=!0;var O=L(p);C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",O||"Unknown")}typeof p.getDefaultProps=="function"&&!p.getDefaultProps.isReactClassApproved&&C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function gr(t){{for(var p=Object.keys(t.props),m=0;m<p.length;m++){var b=p[m];if(b!=="children"&&b!=="key"){ie(t),C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",b),ie(null);break}}t.ref!==null&&(ie(t),C("Invalid attribute `ref` supplied to `React.Fragment`."),ie(null))}}function At(t,p,m,b,O,D){{var P=G(t);if(!P){var x="";(t===void 0||typeof t=="object"&&t!==null&&Object.keys(t).length===0)&&(x+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Y=vr(O);Y?x+=Y:x+=It();var U;t===null?U="null":Ke(t)?U="array":t!==void 0&&t.$$typeof===n?(U="<"+(L(t.type)||"Unknown")+" />",x=" Did you accidentally export a JSX literal instead of a component?"):U=typeof t,C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",U,x)}var A=kr(t,p,m,O,D);if(A==null)return A;if(P){var H=p.children;if(H!==void 0)if(b)if(Ke(H)){for(var oe=0;oe<H.length;oe++)Ut(H[oe],t);Object.freeze&&Object.freeze(H)}else C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ut(H,t)}return t===l?gr(A):br(A),A}}function Nr(t,p,m){return At(t,p,m,!0)}function yr(t,p,m){return At(t,p,m,!1)}var wr=yr,Er=Nr;ce.Fragment=l,ce.jsx=wr,ce.jsxs=Er}()),ce}process.env.NODE_ENV==="production"?Re.exports=Mt():Re.exports=Yt();var Te=Re.exports;const X=Te.Fragment,i=Te.jsx,h=Te.jsxs,Oe={},Kt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>',Jt="https://punkt-cdn.oslo.kommune.no/11.5/icons/",zt=(e,n)=>(!Oe[e]&&typeof window.fetch=="function"&&(Oe[e]=window.fetch(n+e+".svg").then(a=>a.ok?a.text():(console.error("Missing icon: "+n+e+".svg"),Kt)).then(a=>a)),Promise.resolve(Oe[e])),qt={fetchIcon:async(e,n)=>zt(e,n||Jt)},Ze=g.createContext(qt),w=({name:e,path:n,className:a="",...l})=>{const[r,o]=g.useState(null),s=g.useContext(Ze);return g.useEffect(()=>{e?s.fetchIcon(e,n).then(o):o(null)},[e,n]),r?i("span",{className:`pkt-icon ${a}`,dangerouslySetInnerHTML:{__html:r},...l}):null},Qe=g.forwardRef(({children:e,className:n,skin:a="info",closeAlert:l=!1,onClose:r,title:o,date:s,ariaLive:c="polite",compact:f=!1,...u},d)=>{const k=[n,"pkt-alert",a&&`pkt-alert--${a}`,f&&"pkt-alert--compact"].filter(Boolean).join(" "),[_,R]=g.useState(!0),S=()=>{R(!1),r&&r()};return _?h("div",{...u,className:k,"aria-live":c,ref:d,children:[i(w,{className:"pkt-alert__icon",name:a==="info"?"alert-information":`alert-${a}`}),l&&i("div",{className:"pkt-alert__close",children:i("button",{type:"button",className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",tabIndex:0,"aria-label":"close",onClick:S,children:i(w,{name:"close",className:"pkt-btn__icon","aria-hidden":"true"})})}),o&&i("div",{className:"pkt-alert__title",children:o}),i("div",{className:"pkt-alert__text",children:e}),s&&h("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",s]})]}):null}),Gt=g.forwardRef(({href:e,text:n,onClick:a,className:l,...r},o)=>{const s=[l,"pkt-back-link"].filter(Boolean).join(" ");return i("nav",{ref:o,className:s,"aria-label":"Gå tilbake et steg",children:h("a",{href:e||"/",className:"pkt-link pkt-link--icon-left",onClick:
|
|
27
|
+
Check the top-level render call using <`+m+">.")}return p}}function Ft(t,p){{if(!t._store||t._store.validated||t.key!=null)return;t._store.validated=!0;var m=_r(p);if(Lt[m])return;Lt[m]=!0;var b="";t&&t._owner&&t._owner!==ze.current&&(b=" It was passed a child from "+L(t._owner.type)+"."),ie(t),C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',m,b),ie(null)}}function Ut(t,p){{if(typeof t!="object")return;if(Ke(t))for(var m=0;m<t.length;m++){var b=t[m];Ge(b)&&Ft(b,p)}else if(Ge(t))t._store&&(t._store.validated=!0);else if(t){var O=I(t);if(typeof O=="function"&&O!==t.entries)for(var D=O.call(t),P;!(P=D.next()).done;)Ge(P.value)&&Ft(P.value,p)}}}function br(t){{var p=t.type;if(p==null||typeof p=="string")return;var m;if(typeof p=="function")m=p.propTypes;else if(typeof p=="object"&&(p.$$typeof===f||p.$$typeof===k))m=p.propTypes;else return;if(m){var b=L(p);lr(m,t.props,"prop",b,t)}else if(p.PropTypes!==void 0&&!qe){qe=!0;var O=L(p);C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",O||"Unknown")}typeof p.getDefaultProps=="function"&&!p.getDefaultProps.isReactClassApproved&&C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function gr(t){{for(var p=Object.keys(t.props),m=0;m<p.length;m++){var b=p[m];if(b!=="children"&&b!=="key"){ie(t),C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",b),ie(null);break}}t.ref!==null&&(ie(t),C("Invalid attribute `ref` supplied to `React.Fragment`."),ie(null))}}function At(t,p,m,b,O,D){{var P=G(t);if(!P){var x="";(t===void 0||typeof t=="object"&&t!==null&&Object.keys(t).length===0)&&(x+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Y=vr(O);Y?x+=Y:x+=It();var U;t===null?U="null":Ke(t)?U="array":t!==void 0&&t.$$typeof===n?(U="<"+(L(t.type)||"Unknown")+" />",x=" Did you accidentally export a JSX literal instead of a component?"):U=typeof t,C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",U,x)}var A=kr(t,p,m,O,D);if(A==null)return A;if(P){var H=p.children;if(H!==void 0)if(b)if(Ke(H)){for(var oe=0;oe<H.length;oe++)Ut(H[oe],t);Object.freeze&&Object.freeze(H)}else C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ut(H,t)}return t===l?gr(A):br(A),A}}function Nr(t,p,m){return At(t,p,m,!0)}function yr(t,p,m){return At(t,p,m,!1)}var wr=yr,Er=Nr;ce.Fragment=l,ce.jsx=wr,ce.jsxs=Er}()),ce}process.env.NODE_ENV==="production"?Re.exports=Mt():Re.exports=Yt();var Te=Re.exports;const X=Te.Fragment,i=Te.jsx,h=Te.jsxs,Oe={},Kt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>',Jt="https://punkt-cdn.oslo.kommune.no/11.5/icons/",zt=(e,n)=>(!Oe[e]&&typeof window.fetch=="function"&&(Oe[e]=window.fetch(n+e+".svg").then(a=>a.ok?a.text():(console.error("Missing icon: "+n+e+".svg"),Kt)).then(a=>a)),Promise.resolve(Oe[e])),qt={fetchIcon:async(e,n)=>zt(e,n||Jt)},Ze=g.createContext(qt),w=({name:e,path:n,className:a="",...l})=>{const[r,o]=g.useState(null),s=g.useContext(Ze);return g.useEffect(()=>{e?s.fetchIcon(e,n).then(o):o(null)},[e,n]),r?i("span",{className:`pkt-icon ${a}`,dangerouslySetInnerHTML:{__html:r},...l}):null},Qe=g.forwardRef(({children:e,className:n,skin:a="info",closeAlert:l=!1,onClose:r,title:o,date:s,ariaLive:c="polite",compact:f=!1,...u},d)=>{const k=[n,"pkt-alert",a&&`pkt-alert--${a}`,f&&"pkt-alert--compact"].filter(Boolean).join(" "),[_,R]=g.useState(!0),S=()=>{R(!1),r&&r()};return _?h("div",{...u,className:k,"aria-live":c,ref:d,children:[i(w,{className:"pkt-alert__icon",name:a==="info"?"alert-information":`alert-${a}`}),l&&i("div",{className:"pkt-alert__close",children:i("button",{type:"button",className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",tabIndex:0,"aria-label":"close",onClick:S,children:i(w,{name:"close",className:"pkt-btn__icon","aria-hidden":"true"})})}),o&&i("div",{className:"pkt-alert__title",children:o}),i("div",{className:"pkt-alert__text",children:e}),s&&h("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",s]})]}):null}),Gt=g.forwardRef(({href:e,text:n,onClick:a,className:l,...r},o)=>{const s=[l,"pkt-back-link"].filter(Boolean).join(" ");return i("nav",{ref:o,className:s,"aria-label":"Gå tilbake et steg",children:h("a",{href:e||"/",className:"pkt-link pkt-link--icon-left",onClick:f=>{a&&a(f)},...r,children:[i(w,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left","aria-hidden":"true"}),i("span",{className:"pkt-back-link__text",children:n||"Forsiden"})]})})});/**
|
|
28
28
|
* @remix-run/router v1.14.0
|
|
29
29
|
*
|
|
30
30
|
* Copyright (c) Remix Software Inc.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "11.5.
|
|
3
|
+
"version": "11.5.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",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@oslokommune/punkt-assets": "^11.5.0",
|
|
36
|
-
"@oslokommune/punkt-css": "^11.5.
|
|
36
|
+
"@oslokommune/punkt-css": "^11.5.3",
|
|
37
37
|
"@testing-library/jest-dom": "^5.16.5",
|
|
38
38
|
"@testing-library/react": "^14.0.0",
|
|
39
39
|
"@testing-library/user-event": "^14.4.3",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
92
92
|
},
|
|
93
93
|
"license": "MIT",
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "9fa5c4a2e824eb957a748d9d20a4a10a0d9f94ff"
|
|
95
95
|
}
|
|
@@ -5,7 +5,6 @@ import { PktIcon } from '../icon/Icon'
|
|
|
5
5
|
export interface IPktBackLink extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
6
6
|
href?: string;
|
|
7
7
|
text?: string;
|
|
8
|
-
onClick?: () => void; // Custom navigation handler
|
|
9
8
|
className?: string;
|
|
10
9
|
}
|
|
11
10
|
|
|
@@ -22,9 +21,9 @@ export const PktBackLink = forwardRef(
|
|
|
22
21
|
].filter(Boolean)
|
|
23
22
|
.join(' ')
|
|
24
23
|
|
|
25
|
-
const handleClick = () => {
|
|
24
|
+
const handleClick = (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
|
|
26
25
|
if (onClick) {
|
|
27
|
-
onClick();
|
|
26
|
+
onClick(event);
|
|
28
27
|
}
|
|
29
28
|
};
|
|
30
29
|
|