{"version":3,"file":"static/js/6435.4ce28dc5.chunk.js","mappings":"gLAWaA,EAAiB,SAACC,GAC7B,IAAKA,EACH,MAAO,CAAEC,KAAM,CAAC,GAGlB,IAAIC,EASEC,GAPJD,EADkB,kBAATF,EACFI,KAAKC,MAAML,GAEdM,OAAAC,OAAA,GACCP,IAIgBQ,MAEvB,cADON,EAAKM,MACL,CAAEC,UAASN,EAAEF,KAAIC,EAC1B,C,4FCpBaQ,EAAI,W,yCAUf,KAAAC,cAAgB,SAACC,GACf,IAAMC,EAAU,CAAC,UAAW,YAAAC,OAAYX,EAAKY,QAI7C,OAHIH,GACFC,EAAQG,KAAKJ,GAERC,EAAQI,KAAK,I,EAGtB,KAAAC,cAAgB,WACd,IAAMN,EAAwB,WAAhBT,EAAKgB,OAAsB,cAAgB,OACzD,OACEC,EAAAA,EAAAA,GAAA,UAAQC,GAAI,EAAGC,QAAM,IACnBF,EAAAA,EAAAA,GAAA,oBAAkBG,OAAQX,EAAOY,KAAK,a,aArBH,U,YACJ,Q,yCAyBrCZ,EAAAa,UAAAC,OAAA,WACQ,IAAAd,GAAsBb,EAAAA,EAAAA,GAAe4B,KAAKC,MAAxCzB,EAASS,EAAAH,UAAEI,EAAID,EAAAX,KACjB4B,EAAaF,KAAKhB,cAAcR,GAEtC,OACEiB,EAAAA,EAAAA,GAAA,UAAQU,GAAI,IAAMtB,MAAOqB,EAAYP,QAAM,IACzCF,EAAAA,EAAAA,GAAA,IAAAd,OAAAC,OAAA,GAAOM,EAAI,CAAEkB,KAAMJ,KAAKI,KAAMZ,OAAQQ,KAAKR,UACzCC,EAAAA,EAAAA,GAAA,aACCO,KAAKT,iB,IAnCC,G,QCRK,qnyB","sources":["../node_modules/@patentstyret/designsystem/dist/esm-es5/src/utils/parse-helper.ts","../node_modules/@patentstyret/designsystem/dist/esm-es5/src/components/link/link.tsx","../node_modules/@patentstyret/designsystem/dist/esm-es5/src/components/link/link.styles.scss?tag=ps-link"],"sourcesContent":["import { RootProps } from '../types/entities';\r\n\r\n/**\r\n *\r\n * @param args\r\n * Vanilla web components are restricted to string attributes,\r\n * while React and Angular can use object literals as arguments\r\n * \r\n * @returns rootClass: for overwriting the default styles of the component\r\n * @returns attr: attributes which are added to the root element\r\n */\r\nexport const parseRootProps = (args?: RootProps | string): { rootClass?: string; attr: RootProps } => {\r\n if (!args) {\r\n return { attr: {} };\r\n }\r\n\r\n let attr: RootProps;\r\n if (typeof args === 'string') {\r\n attr = JSON.parse(args) as RootProps;\r\n } else {\r\n attr = {\r\n ...args, // immutable\r\n };\r\n }\r\n\r\n const rootClass = attr.class;\r\n delete attr.class;\r\n return { rootClass, attr };\r\n};\r\n","import { h, Component, Prop } from '@stencil/core';\r\nimport { Root } from '../../types/entities';\r\nimport { parseRootProps } from '../../utils/parse-helper';\r\n\r\n@Component({\r\n tag: 'ps-link',\r\n styleUrl: 'link.styles.scss',\r\n})\r\nexport class Link {\r\n @Prop() color: 'primary' | 'secondary' = 'primary';\r\n @Prop() target: '_self' | '_blank' = '_self';\r\n @Prop() href?: string;\r\n @Prop() root?: Root;\r\n\r\n // click is a standard DOM event\r\n // event-definintion is only needed for custom events\r\n // @Event() click: EventEmitter;\r\n\r\n getClassNames = (rootClass: string) => {\r\n const classes = ['ds-link', `ds-link__${this.color}`];\r\n if (rootClass) {\r\n classes.push(rootClass);\r\n }\r\n return classes.join(' ');\r\n };\r\n\r\n getTargetIcon = () => {\r\n const arrow = this.target === '_blank' ? 'open_in_new' : 'east';\r\n return (\r\n \r\n \r\n \r\n );\r\n };\r\n\r\n render() {\r\n const { rootClass, attr } = parseRootProps(this.root);\r\n const classNames = this.getClassNames(rootClass);\r\n\r\n return (\r\n \r\n \r\n \r\n {this.getTargetIcon()}\r\n \r\n \r\n );\r\n }\r\n}\r\n","ps-link {\r\n a {\r\n text-decoration: none;\r\n }\r\n a, a:visited, a:hover, a:active {\r\n color: inherit;\r\n }\r\n}\r\n\r\n.ds-link {\r\n padding-bottom: 2px;\r\n border-width: 0 0 1px 0;\r\n border-style: solid;\r\n\r\n &:hover {\r\n cursor: pointer;\r\n }\r\n}\r\n\r\n.ds-link {\r\n\r\n &__primary {\r\n color: $ds-color-mosegroenn;\r\n border-color: $ds-color-mosegroenn;\r\n\r\n &:hover {\r\n color: $ds-color-spiregroenn;\r\n background-color: $ds-color-mosegroenn;\r\n }\r\n }\r\n \r\n &__secondary {\r\n color: $ds-color-white;\r\n border-color: $ds-color-white;\r\n\r\n &:hover {\r\n color: $ds-color-spiregroenn;\r\n border-color: $ds-color-spiregroenn;\r\n }\r\n }\r\n}\r\n"],"names":["parseRootProps","r","attr","s","t","JSON","parse","Object","assign","class","rootClass","Link","getClassNames","o","f","concat","color","push","join","getTargetIcon","target","h","ml","inline","symbol","size","prototype","render","this","root","n","px","href"],"sourceRoot":""}