@oslokommune/punkt-react 4.2.0 → 4.2.1
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 +19 -0
- package/dist/button/Button.d.ts +1 -0
- package/dist/punkt-react.es.js +1 -0
- package/dist/punkt-react.umd.js +1 -1
- package/package.json +2 -2
- package/src/components/alert/Alert.tsx +46 -42
- package/src/components/button/Button.tsx +18 -14
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,25 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [4.3.0](https://github.com/oslokommune/punkt/compare/4.2.0...4.3.0) (2023-05-23)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
Ingen
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
* Legg til type i PktButton slik at skjema ikke sendes inn … (#875). * fix(vue2,react): Legg til type i PktButton slik at skjema ikke sendes inn av en vanlig knapp
|
|
18
|
+
* fix(vue2,react): type="button" på lukkeknappen i PktAlert
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Chores
|
|
22
|
+
Ingen
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
|
|
8
27
|
## [4.2.0](https://github.com/oslokommune/punkt/compare/4.1.0...4.2.0) (2023-05-16)
|
|
9
28
|
|
|
10
29
|
### ⚠ BREAKING CHANGES
|
package/dist/button/Button.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface IPktButton extends React.ButtonHTMLAttributes<HTMLButtonElement
|
|
|
7
7
|
skin?: 'primary' | 'secondary' | 'tertiary';
|
|
8
8
|
variant?: 'label-only' | 'icon-left' | 'icon-right' | 'icon-only' | 'icons-right-and-left';
|
|
9
9
|
state?: 'normal' | 'focus' | 'hover' | 'active';
|
|
10
|
+
type?: 'button' | 'submit' | 'reset';
|
|
10
11
|
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
11
12
|
}
|
|
12
13
|
export declare const PktButton: React.ForwardRefExoticComponent<IPktButton & React.RefAttributes<HTMLButtonElement>>;
|
package/dist/punkt-react.es.js
CHANGED
|
@@ -657,6 +657,7 @@ const Se = te.Fragment, t = te.jsx, d = te.jsxs, y = ({
|
|
|
657
657
|
c && /* @__PURE__ */ t("div", { className: "pkt-alert__close", children: /* @__PURE__ */ t(
|
|
658
658
|
"button",
|
|
659
659
|
{
|
|
660
|
+
type: "button",
|
|
660
661
|
className: "pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",
|
|
661
662
|
tabIndex: 0,
|
|
662
663
|
"aria-label": "close",
|
package/dist/punkt-react.umd.js
CHANGED
|
@@ -24,7 +24,7 @@ Check the render method of \``+e+"`."}return""}}function wt(e){{if(e!==void 0){v
|
|
|
24
24
|
|
|
25
25
|
Check your code at `+t+":"+a+"."}return""}}var Oe={};function Pt(e){{var t=Se();if(!t){var a=typeof e=="string"?e:e.displayName||e.name;a&&(t=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+a+">.")}return t}}function Ce(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=Pt(t);if(Oe[a])return;Oe[a]=!0;var i="";e&&e._owner&&e._owner!==ee.current&&(i=" It was passed a child from "+O(e._owner.type)+"."),A(e),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,i),A(null)}}function Fe(e,t){{if(typeof e!="object")return;if(q(e))for(var a=0;a<e.length;a++){var i=e[a];re(i)&&Ce(i,t)}else if(re(e))e._store&&(e._store.validated=!0);else if(e){var m=Qe(e);if(typeof m=="function"&&m!==e.entries)for(var h=m.call(e),f;!(f=h.next()).done;)re(f.value)&&Ce(f.value,t)}}}function Tt(e){{var t=e.type;if(t==null||typeof t=="string")return;var a;if(typeof t=="function")a=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===v||t.$$typeof===j))a=t.propTypes;else return;if(a){var i=O(t);dt(a,e.props,"prop",i,e)}else if(t.PropTypes!==void 0&&!te){te=!0;var m=O(t);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",m||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function xt(e){{for(var t=Object.keys(e.props),a=0;a<t.length;a++){var i=t[a];if(i!=="children"&&i!=="key"){A(e),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",i),A(null);break}}e.ref!==null&&(A(e),E("Invalid attribute `ref` supplied to `React.Fragment`."),A(null))}}function De(e,t,a,i,m,h){{var f=it(e);if(!f){var u="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(u+=" 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 w=wt(m);w?u+=w:u+=Se();var k;e===null?k="null":q(e)?k="array":e!==void 0&&e.$$typeof===l?(k="<"+(O(e.type)||"Unknown")+" />",u=" Did you accidentally export a JSX literal instead of a component?"):k=typeof e,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",k,u)}var N=Et(e,t,a,m,h);if(N==null)return N;if(f){var x=t.children;if(x!==void 0)if(i)if(q(x)){for(var $=0;$<x.length;$++)Fe(x[$],e);Object.freeze&&Object.freeze(x)}else E("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 Fe(x,e)}return e===c?xt(N):Tt(N),N}}function jt(e,t,a){return De(e,t,a,!0)}function St(e,t,a){return De(e,t,a,!1)}var Ot=St,Ct=jt;Y.Fragment=c,Y.jsx=Ot,Y.jsxs=Ct}()),Y}process.env.NODE_ENV==="production"?H.exports=$e():H.exports=We();var J=H.exports;const oe=J.Fragment,r=J.jsx,p=J.jsxs,y=({className:o,name:l,viewBox:s="0 0 32 32",...c})=>{const d=[o].filter(Boolean).join(" ");return r("svg",{...c,className:d,viewBox:s,children:r("use",{href:`#${l}`})})},Ye=P.forwardRef(({children:o,className:l,skin:s="info",closeAlert:c=!1,onClose:d,title:n,date:_,ariaLive:g="polite",...v},T)=>{const R=[l,"pkt-alert",s&&`pkt-alert--${s}`].filter(Boolean).join(" "),[j,S]=P.useState(!0),D=()=>{S(!1),d&&d()};return j?p("div",{...v,className:R,"aria-live":g,ref:T,children:[r("div",{className:"pkt-alert__icon",children:r(y,{name:s==="info"?"alert-information":`alert-${s}`})}),c&&r("div",{className:"pkt-alert__close",children:r("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",tabIndex:0,"aria-label":"close",onClick:D,children:r(y,{name:"close",className:"pkt-btn__icon","aria-hidden":"true"})})}),n&&r("div",{className:"pkt-alert__title",children:n}),r("div",{className:"pkt-alert__text",children:o}),_&&p("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",_]})]}):null}),ie=P.forwardRef(({children:o,className:l,iconName:s="user",secondIconName:c="user",size:d="medium",skin:n="primary",type:_="button",variant:g="label-only",...v},T)=>{const R=[l,"pkt-btn",d&&`pkt-btn--${d}`,n&&`pkt-btn--${n}`,g&&`pkt-btn--${g}`].filter(Boolean).join(" ");return p("button",{...v,className:R,type:_,ref:T,children:[r(y,{className:"pkt-btn__icon",name:s}),r("span",{className:"pkt-btn__text",children:o}),g==="icons-right-and-left"&&r(y,{className:"pkt-btn__icon",name:c})]})});ie.displayName="PktButton";const Be=({columnOne:o,columnTwo:l,socialLinks:s})=>{var c,d;return r("footer",{className:"pkt-footer","data-mode":"dark",children:p("div",{className:"pkt-footer__container",children:[p("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[p("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[r("h2",{className:"pkt-footer__title",children:o.title}),p("ul",{className:"pkt-footer__list",children:[o.text&&r("li",{className:"pkt-footer__text",children:o.text}),(c=o.links)==null?void 0:c.map((n,_)=>r("li",{className:"pkt-footer__list-item",children:p("a",{className:`pkt-footer__link ${n.external?"pkt-link--external":""}`,href:n.href,target:n.openInNewTab?"_blank":"_self",rel:n.openInNewTab?"noopener noreferrer":void 0,children:[r(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),n.text]})},`links-${_}`))]})]}),p("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[r("h2",{className:"pkt-footer__title",children:l.title}),p("ul",{className:"pkt-footer__list",children:[l.text&&r("li",{className:"pkt-footer__text",children:l.text}),(d=l.links)==null?void 0:d.map((n,_)=>r("li",{className:"pkt-footer__list-item",children:p("a",{className:`pkt-footer__link ${n.external?"pkt-link--external":""}`,href:n.href,target:n.openInNewTab?"_blank":"_self",rel:n.openInNewTab?"noopener noreferrer":void 0,children:[r(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),n.text]})},`links-${_}`))]})]}),p("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[r("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),p("ul",{className:"pkt-footer__list",children:[r("li",{className:"pkt-footer__list-item",children:p("a",{className:"pkt-footer__link",href:"https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",children:[r(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),r("li",{className:"pkt-footer__list-item",children:p("a",{className:"pkt-footer__link",href:"https://www.oslo.kommune.no/tilgjengelighet/",children:[r(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})]})]}),s&&p("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[r("div",{className:"pkt-footer__social-languages",children:s.filter(n=>n.language).map((n,_)=>r("div",{className:"pkt-footer__social-language",children:r("a",{href:n.href,"aria-label":`til ${n.language} versjon av nettsiden`,target:n.openInNewTab?"_blank":"_self",rel:n.openInNewTab?"noopener noreferrer":void 0,children:n.language})},`sociallinks-language-${_}`))}),r("div",{className:"pkt-footer__social-icons",children:s.filter(n=>n.iconName).map((n,_)=>r(P.Fragment,{children:r("a",{href:n.href,"aria-label":`til ${n.iconName}`,className:"pkt-footer__social-icon-link",target:n.openInNewTab?"_blank":"_self",rel:n.openInNewTab?"noopener noreferrer":void 0,children:r("svg",{className:"pkt-footer__social-icon",viewBox:"0 0 32 32","aria-hidden":"true",children:r("use",{href:`#${n.iconName}`})})})},`sociallinks-${_}`))})]})]})})},Me=({links:o=[]})=>r("footer",{className:"pkt-footer-simple","data-mode":"dark",children:r("div",{className:"pkt-footer-simple__container",children:p("ul",{className:"pkt-footer-simple__list",children:[o.map((l,s)=>r("li",{className:"pkt-footer-simple__list-item",children:p("a",{className:`pkt-footer-simple__link ${l.external?" pkt-link--external":""}`,href:l.href,target:l.openInNewTab?"_blank":"_self",rel:l.openInNewTab?"noopener noreferrer":void 0,children:[r(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),l.text]})},s)),r("li",{className:"pkt-footer-simple__list-item",children:p("a",{className:"pkt-footer-simple__link",href:"https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",children:[r(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),r("li",{className:"pkt-footer-simple__list-item",children:p("a",{className:"pkt-footer-simple__link",href:"https://www.oslo.kommune.no/tilgjengelighet/",children:[r(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})})}),Le=({className:o,logoLink:l="https://www.oslo.kommune.no/",isLoggedIn:s=!1,representing:c="",canChangeRepresentation:d=!1,showLogInButton:n=!0,onLogIn:_,onLogOut:g,onChangeRepresentation:v})=>{const T=[o,"pkt-header"].filter(Boolean).join(" ");return p("header",{id:"pkt-header",className:T,"aria-label":"Topp",children:[r("div",{className:"pkt-header__logo",children:r("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:l,children:r(y,{name:"oslologo",className:"pkt-header__logo-svg",viewBox:"0 0 60 31","aria-hidden":"true"})})}),p("div",{className:"pkt-header__actions",children:[s&&d&&p("button",{className:"pkt-btn pkt-btn--secondary pkt-btn--icon-right","aria-label":`Bytt bruker fra ${c}`,onClick:v,children:[r(y,{name:"user",className:"pkt-btn__icon pkt-show-tablet-up"}),r("span",{className:"pkt-header__action-change pkt-hide pkt-show-tablet-up ml-size-15",children:"Endre"}),r("span",{className:"pkt-btn__text pkt-hide-tablet-up",children:"Endre"}),r("span",{className:"pkt-btn__text--representing pkt-hide pkt-show-tablet-up",children:c})]}),s&&!d&&p("div",{className:"pkt-header__action",children:[r("span",{className:"pkt-header__action-text",children:r("span",{className:"pkt-btn__text pkt-header__action-textrow text-row-inline pkt-truncate-text",children:c})}),r("span",{className:"pkt-header__action-icon pkt-show-phablet-up",children:r(y,{name:"user"})})]}),n&&s&&p("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--icon-right","aria-label":"Logg ut",onClick:g,children:[r(y,{className:"pkt-btn__icon pkt-show-tablet-up",name:"exit"}),r("span",{className:"pkt-btn__text",children:"Logg ut"})]}),n&&!s&&p("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--icon-right","aria-label":"Logg inn",onClick:_,children:[r(y,{className:"pkt-btn__icon",name:"user"}),r("span",{className:"pkt-btn__text",children:"Logg inn"})]})]})]})},le=P.forwardRef(({label:o,id:l,children:s,...c},d)=>p("div",{className:"pkt-form-group",children:[r("label",{htmlFor:l,className:"pkt-form-label",children:o}),r("input",{className:"pkt-form-input",id:l,...c,ref:d}),s]}));le.displayName="PktInput";const Ve=({children:o,className:l,iconName:s="user",openInNewTab:c=!1,skin:d="",href:n="#",title:_})=>{const g=[l,"pkt-linkcard",d&&`pkt-linkcard--${d}`].filter(Boolean).join(" ");return p("a",{href:n,className:`pkt-linkcard pkt-link ${g}`,target:c?"_blank":"_self",rel:c?"noopener noreferrer":void 0,children:[r(y,{className:"pkt-link__icon",name:s}),p("div",{className:"pkt-linkcard__content",children:[r("div",{className:"pkt-linkcard__title",children:_}),r("div",{className:"pkt-linkcard__text",children:o})]})]})},Ue=({children:o,skin:l="beige",title:s,...c})=>{const d=["pkt-messagebox",l&&`pkt-messagebox--${l}`].filter(Boolean).join(" ");return p("div",{...c,className:d,children:[r("div",{className:"pkt-messagebox__title",children:s}),r("div",{className:"pkt-messagebox__text",children:o})]})},se=P.forwardRef(({id:o,name:l,label:s,value:c,...d},n)=>p("div",{className:"pkt-form-group",children:[r("input",{type:"radio",className:"pkt-form-check-input",id:o,name:l,value:c,ref:n,...d}),r("label",{className:"pkt-form-label",htmlFor:o,children:s})]}));se.displayName="PktRadio";const Ge=({label:o,children:l})=>p(oe,{children:[r("p",{children:o}),r("div",{className:"pkt-form-group",children:l})]});var ce={exports:{}};/*!
|
|
27
|
+
Check the top-level render call using <`+a+">.")}return t}}function Ce(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=Pt(t);if(Oe[a])return;Oe[a]=!0;var i="";e&&e._owner&&e._owner!==ee.current&&(i=" It was passed a child from "+O(e._owner.type)+"."),A(e),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,i),A(null)}}function Fe(e,t){{if(typeof e!="object")return;if(q(e))for(var a=0;a<e.length;a++){var i=e[a];re(i)&&Ce(i,t)}else if(re(e))e._store&&(e._store.validated=!0);else if(e){var m=Qe(e);if(typeof m=="function"&&m!==e.entries)for(var h=m.call(e),f;!(f=h.next()).done;)re(f.value)&&Ce(f.value,t)}}}function Tt(e){{var t=e.type;if(t==null||typeof t=="string")return;var a;if(typeof t=="function")a=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===v||t.$$typeof===j))a=t.propTypes;else return;if(a){var i=O(t);dt(a,e.props,"prop",i,e)}else if(t.PropTypes!==void 0&&!te){te=!0;var m=O(t);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",m||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function xt(e){{for(var t=Object.keys(e.props),a=0;a<t.length;a++){var i=t[a];if(i!=="children"&&i!=="key"){A(e),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",i),A(null);break}}e.ref!==null&&(A(e),E("Invalid attribute `ref` supplied to `React.Fragment`."),A(null))}}function De(e,t,a,i,m,h){{var f=it(e);if(!f){var u="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(u+=" 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 w=wt(m);w?u+=w:u+=Se();var k;e===null?k="null":q(e)?k="array":e!==void 0&&e.$$typeof===l?(k="<"+(O(e.type)||"Unknown")+" />",u=" Did you accidentally export a JSX literal instead of a component?"):k=typeof e,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",k,u)}var N=Et(e,t,a,m,h);if(N==null)return N;if(f){var x=t.children;if(x!==void 0)if(i)if(q(x)){for(var $=0;$<x.length;$++)Fe(x[$],e);Object.freeze&&Object.freeze(x)}else E("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 Fe(x,e)}return e===c?xt(N):Tt(N),N}}function jt(e,t,a){return De(e,t,a,!0)}function St(e,t,a){return De(e,t,a,!1)}var Ot=St,Ct=jt;Y.Fragment=c,Y.jsx=Ot,Y.jsxs=Ct}()),Y}process.env.NODE_ENV==="production"?H.exports=$e():H.exports=We();var J=H.exports;const oe=J.Fragment,r=J.jsx,p=J.jsxs,y=({className:o,name:l,viewBox:s="0 0 32 32",...c})=>{const d=[o].filter(Boolean).join(" ");return r("svg",{...c,className:d,viewBox:s,children:r("use",{href:`#${l}`})})},Ye=P.forwardRef(({children:o,className:l,skin:s="info",closeAlert:c=!1,onClose:d,title:n,date:_,ariaLive:g="polite",...v},T)=>{const R=[l,"pkt-alert",s&&`pkt-alert--${s}`].filter(Boolean).join(" "),[j,S]=P.useState(!0),D=()=>{S(!1),d&&d()};return j?p("div",{...v,className:R,"aria-live":g,ref:T,children:[r("div",{className:"pkt-alert__icon",children:r(y,{name:s==="info"?"alert-information":`alert-${s}`})}),c&&r("div",{className:"pkt-alert__close",children:r("button",{type:"button",className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",tabIndex:0,"aria-label":"close",onClick:D,children:r(y,{name:"close",className:"pkt-btn__icon","aria-hidden":"true"})})}),n&&r("div",{className:"pkt-alert__title",children:n}),r("div",{className:"pkt-alert__text",children:o}),_&&p("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",_]})]}):null}),ie=P.forwardRef(({children:o,className:l,iconName:s="user",secondIconName:c="user",size:d="medium",skin:n="primary",type:_="button",variant:g="label-only",...v},T)=>{const R=[l,"pkt-btn",d&&`pkt-btn--${d}`,n&&`pkt-btn--${n}`,g&&`pkt-btn--${g}`].filter(Boolean).join(" ");return p("button",{...v,className:R,type:_,ref:T,children:[r(y,{className:"pkt-btn__icon",name:s}),r("span",{className:"pkt-btn__text",children:o}),g==="icons-right-and-left"&&r(y,{className:"pkt-btn__icon",name:c})]})});ie.displayName="PktButton";const Be=({columnOne:o,columnTwo:l,socialLinks:s})=>{var c,d;return r("footer",{className:"pkt-footer","data-mode":"dark",children:p("div",{className:"pkt-footer__container",children:[p("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[p("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[r("h2",{className:"pkt-footer__title",children:o.title}),p("ul",{className:"pkt-footer__list",children:[o.text&&r("li",{className:"pkt-footer__text",children:o.text}),(c=o.links)==null?void 0:c.map((n,_)=>r("li",{className:"pkt-footer__list-item",children:p("a",{className:`pkt-footer__link ${n.external?"pkt-link--external":""}`,href:n.href,target:n.openInNewTab?"_blank":"_self",rel:n.openInNewTab?"noopener noreferrer":void 0,children:[r(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),n.text]})},`links-${_}`))]})]}),p("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[r("h2",{className:"pkt-footer__title",children:l.title}),p("ul",{className:"pkt-footer__list",children:[l.text&&r("li",{className:"pkt-footer__text",children:l.text}),(d=l.links)==null?void 0:d.map((n,_)=>r("li",{className:"pkt-footer__list-item",children:p("a",{className:`pkt-footer__link ${n.external?"pkt-link--external":""}`,href:n.href,target:n.openInNewTab?"_blank":"_self",rel:n.openInNewTab?"noopener noreferrer":void 0,children:[r(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),n.text]})},`links-${_}`))]})]}),p("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[r("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),p("ul",{className:"pkt-footer__list",children:[r("li",{className:"pkt-footer__list-item",children:p("a",{className:"pkt-footer__link",href:"https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",children:[r(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),r("li",{className:"pkt-footer__list-item",children:p("a",{className:"pkt-footer__link",href:"https://www.oslo.kommune.no/tilgjengelighet/",children:[r(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})]})]}),s&&p("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[r("div",{className:"pkt-footer__social-languages",children:s.filter(n=>n.language).map((n,_)=>r("div",{className:"pkt-footer__social-language",children:r("a",{href:n.href,"aria-label":`til ${n.language} versjon av nettsiden`,target:n.openInNewTab?"_blank":"_self",rel:n.openInNewTab?"noopener noreferrer":void 0,children:n.language})},`sociallinks-language-${_}`))}),r("div",{className:"pkt-footer__social-icons",children:s.filter(n=>n.iconName).map((n,_)=>r(P.Fragment,{children:r("a",{href:n.href,"aria-label":`til ${n.iconName}`,className:"pkt-footer__social-icon-link",target:n.openInNewTab?"_blank":"_self",rel:n.openInNewTab?"noopener noreferrer":void 0,children:r("svg",{className:"pkt-footer__social-icon",viewBox:"0 0 32 32","aria-hidden":"true",children:r("use",{href:`#${n.iconName}`})})})},`sociallinks-${_}`))})]})]})})},Me=({links:o=[]})=>r("footer",{className:"pkt-footer-simple","data-mode":"dark",children:r("div",{className:"pkt-footer-simple__container",children:p("ul",{className:"pkt-footer-simple__list",children:[o.map((l,s)=>r("li",{className:"pkt-footer-simple__list-item",children:p("a",{className:`pkt-footer-simple__link ${l.external?" pkt-link--external":""}`,href:l.href,target:l.openInNewTab?"_blank":"_self",rel:l.openInNewTab?"noopener noreferrer":void 0,children:[r(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),l.text]})},s)),r("li",{className:"pkt-footer-simple__list-item",children:p("a",{className:"pkt-footer-simple__link",href:"https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",children:[r(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),r("li",{className:"pkt-footer-simple__list-item",children:p("a",{className:"pkt-footer-simple__link",href:"https://www.oslo.kommune.no/tilgjengelighet/",children:[r(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})})}),Le=({className:o,logoLink:l="https://www.oslo.kommune.no/",isLoggedIn:s=!1,representing:c="",canChangeRepresentation:d=!1,showLogInButton:n=!0,onLogIn:_,onLogOut:g,onChangeRepresentation:v})=>{const T=[o,"pkt-header"].filter(Boolean).join(" ");return p("header",{id:"pkt-header",className:T,"aria-label":"Topp",children:[r("div",{className:"pkt-header__logo",children:r("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:l,children:r(y,{name:"oslologo",className:"pkt-header__logo-svg",viewBox:"0 0 60 31","aria-hidden":"true"})})}),p("div",{className:"pkt-header__actions",children:[s&&d&&p("button",{className:"pkt-btn pkt-btn--secondary pkt-btn--icon-right","aria-label":`Bytt bruker fra ${c}`,onClick:v,children:[r(y,{name:"user",className:"pkt-btn__icon pkt-show-tablet-up"}),r("span",{className:"pkt-header__action-change pkt-hide pkt-show-tablet-up ml-size-15",children:"Endre"}),r("span",{className:"pkt-btn__text pkt-hide-tablet-up",children:"Endre"}),r("span",{className:"pkt-btn__text--representing pkt-hide pkt-show-tablet-up",children:c})]}),s&&!d&&p("div",{className:"pkt-header__action",children:[r("span",{className:"pkt-header__action-text",children:r("span",{className:"pkt-btn__text pkt-header__action-textrow text-row-inline pkt-truncate-text",children:c})}),r("span",{className:"pkt-header__action-icon pkt-show-phablet-up",children:r(y,{name:"user"})})]}),n&&s&&p("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--icon-right","aria-label":"Logg ut",onClick:g,children:[r(y,{className:"pkt-btn__icon pkt-show-tablet-up",name:"exit"}),r("span",{className:"pkt-btn__text",children:"Logg ut"})]}),n&&!s&&p("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--icon-right","aria-label":"Logg inn",onClick:_,children:[r(y,{className:"pkt-btn__icon",name:"user"}),r("span",{className:"pkt-btn__text",children:"Logg inn"})]})]})]})},le=P.forwardRef(({label:o,id:l,children:s,...c},d)=>p("div",{className:"pkt-form-group",children:[r("label",{htmlFor:l,className:"pkt-form-label",children:o}),r("input",{className:"pkt-form-input",id:l,...c,ref:d}),s]}));le.displayName="PktInput";const Ve=({children:o,className:l,iconName:s="user",openInNewTab:c=!1,skin:d="",href:n="#",title:_})=>{const g=[l,"pkt-linkcard",d&&`pkt-linkcard--${d}`].filter(Boolean).join(" ");return p("a",{href:n,className:`pkt-linkcard pkt-link ${g}`,target:c?"_blank":"_self",rel:c?"noopener noreferrer":void 0,children:[r(y,{className:"pkt-link__icon",name:s}),p("div",{className:"pkt-linkcard__content",children:[r("div",{className:"pkt-linkcard__title",children:_}),r("div",{className:"pkt-linkcard__text",children:o})]})]})},Ue=({children:o,skin:l="beige",title:s,...c})=>{const d=["pkt-messagebox",l&&`pkt-messagebox--${l}`].filter(Boolean).join(" ");return p("div",{...c,className:d,children:[r("div",{className:"pkt-messagebox__title",children:s}),r("div",{className:"pkt-messagebox__text",children:o})]})},se=P.forwardRef(({id:o,name:l,label:s,value:c,...d},n)=>p("div",{className:"pkt-form-group",children:[r("input",{type:"radio",className:"pkt-form-check-input",id:o,name:l,value:c,ref:n,...d}),r("label",{className:"pkt-form-label",htmlFor:o,children:s})]}));se.displayName="PktRadio";const Ge=({label:o,children:l})=>p(oe,{children:[r("p",{children:o}),r("div",{className:"pkt-form-group",children:l})]});var ce={exports:{}};/*!
|
|
28
28
|
Copyright (c) 2018 Jed Watson.
|
|
29
29
|
Licensed under the MIT License (MIT), see
|
|
30
30
|
http://jedwatson.github.io/classnames
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.1",
|
|
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",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
91
91
|
},
|
|
92
92
|
"license": "MIT",
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "8e4ba5f90021ff42fbe941c4726ecb58563fed27"
|
|
94
94
|
}
|
|
@@ -11,54 +11,58 @@ export interface IPktAlert extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
11
11
|
ariaLive?: 'off' | 'polite' | 'assertive'
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export const PktAlert = forwardRef(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
export const PktAlert = forwardRef(
|
|
15
|
+
(
|
|
16
|
+
{
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
skin = 'info',
|
|
20
|
+
closeAlert = false,
|
|
21
|
+
onClose,
|
|
22
|
+
title,
|
|
23
|
+
date,
|
|
24
|
+
ariaLive = 'polite',
|
|
25
|
+
...props
|
|
26
|
+
}: IPktAlert,
|
|
27
|
+
ref: ForwardedRef<HTMLDivElement>,
|
|
28
|
+
) => {
|
|
29
|
+
const classes = [className, 'pkt-alert', skin && `pkt-alert--${skin}`].filter(Boolean).join(' ')
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
const [isDisplayed, setIsDisplayed] = useState(true)
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
const handleClose = () => {
|
|
34
|
+
setIsDisplayed(false)
|
|
35
|
+
if (onClose) {
|
|
36
|
+
onClose()
|
|
37
|
+
}
|
|
33
38
|
}
|
|
34
|
-
}
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
{closeAlert && (
|
|
43
|
-
<div className="pkt-alert__close">
|
|
44
|
-
<button
|
|
45
|
-
|
|
46
|
-
className="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
|
|
47
|
-
tabIndex={0}
|
|
48
|
-
aria-label="close"
|
|
49
|
-
onClick={handleClose}
|
|
50
|
-
>
|
|
51
|
-
<PktIcon name="close" className="pkt-btn__icon" aria-hidden="true" />
|
|
52
|
-
</button>
|
|
40
|
+
return isDisplayed ? (
|
|
41
|
+
<div {...props} className={classes} aria-live={ariaLive} ref={ref}>
|
|
42
|
+
<div className="pkt-alert__icon">
|
|
43
|
+
<PktIcon name={skin === 'info' ? 'alert-information' : `alert-${skin}`} />
|
|
53
44
|
</div>
|
|
54
|
-
)}
|
|
55
45
|
|
|
56
|
-
|
|
46
|
+
{closeAlert && (
|
|
47
|
+
<div className="pkt-alert__close">
|
|
48
|
+
<button
|
|
49
|
+
type="button"
|
|
50
|
+
className="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
|
|
51
|
+
tabIndex={0}
|
|
52
|
+
aria-label="close"
|
|
53
|
+
onClick={handleClose}
|
|
54
|
+
>
|
|
55
|
+
<PktIcon name="close" className="pkt-btn__icon" aria-hidden="true" />
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|
|
58
|
+
)}
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
{title && <div className="pkt-alert__title">{title}</div>}
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
<div className="pkt-alert__text">{children}</div>
|
|
63
|
+
|
|
64
|
+
{date && <div className="pkt-alert__date">Sist oppdatert: {date}</div>}
|
|
65
|
+
</div>
|
|
66
|
+
) : null
|
|
67
|
+
},
|
|
64
68
|
)
|
|
@@ -10,20 +10,25 @@ export interface IPktButton extends React.ButtonHTMLAttributes<HTMLButtonElement
|
|
|
10
10
|
skin?: 'primary' | 'secondary' | 'tertiary'
|
|
11
11
|
variant?: 'label-only' | 'icon-left' | 'icon-right' | 'icon-only' | 'icons-right-and-left'
|
|
12
12
|
state?: 'normal' | 'focus' | 'hover' | 'active'
|
|
13
|
+
type?: 'button' | 'submit' | 'reset'
|
|
13
14
|
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
export const PktButton = forwardRef(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
export const PktButton = forwardRef(
|
|
18
|
+
(
|
|
19
|
+
{
|
|
20
|
+
children,
|
|
21
|
+
className,
|
|
22
|
+
iconName = 'user',
|
|
23
|
+
secondIconName = 'user',
|
|
24
|
+
size = 'medium',
|
|
25
|
+
skin = 'primary',
|
|
26
|
+
type = 'button',
|
|
27
|
+
variant = 'label-only',
|
|
28
|
+
...props
|
|
29
|
+
}: IPktButton,
|
|
30
|
+
ref: ForwardedRef<HTMLButtonElement>,
|
|
31
|
+
) => {
|
|
27
32
|
const classes = [
|
|
28
33
|
className,
|
|
29
34
|
'pkt-btn',
|
|
@@ -43,8 +48,7 @@ export const PktButton = forwardRef(({
|
|
|
43
48
|
)}
|
|
44
49
|
</button>
|
|
45
50
|
)
|
|
46
|
-
}
|
|
51
|
+
},
|
|
47
52
|
)
|
|
48
53
|
|
|
49
|
-
PktButton.displayName = 'PktButton'
|
|
50
|
-
|
|
54
|
+
PktButton.displayName = 'PktButton'
|