@oslokommune/punkt-elements 12.12.3 → 12.13.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/dist/index.d.ts +23 -0
- package/dist/linkcard-BQh5exrq.js +54 -0
- package/dist/linkcard-BgnHfuNJ.cjs +13 -0
- package/dist/linkcard.d.ts +8 -0
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +16 -14
- package/dist/pkt-linkcard.cjs +1 -0
- package/dist/pkt-linkcard.js +6 -0
- package/package.json +3 -3
- package/src/components/index.ts +1 -0
- package/src/components/linkcard/index.ts +4 -0
- package/src/components/linkcard/linkcard.ts +67 -0
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,15 @@ declare type ICardSkin = 'outlined' | 'gray' | 'beige' | 'green' | 'blue';
|
|
|
15
15
|
|
|
16
16
|
declare type IDirection = 'portrait' | 'landscape';
|
|
17
17
|
|
|
18
|
+
declare interface IPktLinkCard {
|
|
19
|
+
title?: string;
|
|
20
|
+
href?: string;
|
|
21
|
+
iconName?: string;
|
|
22
|
+
external?: boolean;
|
|
23
|
+
openInNewTab?: boolean;
|
|
24
|
+
skin?: LinkCardSkin;
|
|
25
|
+
}
|
|
26
|
+
|
|
18
27
|
declare interface IPktModal {
|
|
19
28
|
headingText?: string;
|
|
20
29
|
removePadding?: boolean;
|
|
@@ -33,6 +42,8 @@ declare interface IPktTag {
|
|
|
33
42
|
ariaLabel?: string;
|
|
34
43
|
}
|
|
35
44
|
|
|
45
|
+
declare type LinkCardSkin = 'normal' | 'blue' | 'beige' | 'green' | 'gray' | 'beige-outline' | 'gray-outline';
|
|
46
|
+
|
|
36
47
|
declare type MessageboxSkin = 'beige' | 'blue' | 'red' | 'green';
|
|
37
48
|
|
|
38
49
|
declare type ModalSize = 'small' | 'medium' | 'large';
|
|
@@ -382,6 +393,18 @@ export declare class PktLink extends PktElement {
|
|
|
382
393
|
private handleClick;
|
|
383
394
|
}
|
|
384
395
|
|
|
396
|
+
export declare class PktLinkCard extends PktElement implements IPktLinkCard {
|
|
397
|
+
defaultSlot: Ref<HTMLElement>;
|
|
398
|
+
title: string;
|
|
399
|
+
href: string;
|
|
400
|
+
iconName: string;
|
|
401
|
+
external: boolean;
|
|
402
|
+
openInNewTab: boolean;
|
|
403
|
+
skin: LinkCardSkin;
|
|
404
|
+
constructor();
|
|
405
|
+
render(): TemplateResult<1>;
|
|
406
|
+
}
|
|
407
|
+
|
|
385
408
|
export declare class PktMessagebox extends PktElement {
|
|
386
409
|
defaultSlot: Ref<HTMLElement>;
|
|
387
410
|
constructor();
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { P as f, x as c, n } from "./index-CZvL4lft.js";
|
|
2
|
+
import { t as h } from "./custom-element-CWfU4dcr.js";
|
|
3
|
+
import { e as k, P as m, n as u } from "./ref-_n0LCr-4.js";
|
|
4
|
+
import "./index-CSOOyHCM.js";
|
|
5
|
+
var _ = Object.defineProperty, d = Object.getOwnPropertyDescriptor, r = (l, i, s, o) => {
|
|
6
|
+
for (var e = o > 1 ? void 0 : o ? d(i, s) : i, a = l.length - 1, p; a >= 0; a--)
|
|
7
|
+
(p = l[a]) && (e = (o ? p(i, s, e) : p(e)) || e);
|
|
8
|
+
return o && e && _(i, s, e), e;
|
|
9
|
+
};
|
|
10
|
+
let t = class extends f {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(), this.defaultSlot = k(), this.title = "", this.href = "#", this.iconName = "", this.external = !1, this.openInNewTab = !1, this.skin = "normal", this.slotController = new m(this, this.defaultSlot);
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
const l = ["pkt-linkcard", this.skin && `pkt-linkcard--${this.skin}`].filter(Boolean).join(" "), i = ["pkt-linkcard__title", this.external && "pkt-link pkt-link--external"].filter(Boolean).join(" ");
|
|
16
|
+
return c`
|
|
17
|
+
<a
|
|
18
|
+
href=${this.href}
|
|
19
|
+
class=${l}
|
|
20
|
+
target=${this.openInNewTab ? "_blank" : "_self"}
|
|
21
|
+
rel=${this.openInNewTab ?? "noopener noreferrer"}
|
|
22
|
+
>
|
|
23
|
+
${this.iconName && c`<pkt-icon class="pkt-link__icon" name="${this.iconName}" />`}
|
|
24
|
+
${this.title && c`<div class=${i}>${this.title}</div>`}
|
|
25
|
+
|
|
26
|
+
<div class="pkt-linkcard__text" ${u(this.defaultSlot)}></div>
|
|
27
|
+
</a>
|
|
28
|
+
`;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
r([
|
|
32
|
+
n({ type: String, reflect: !0 })
|
|
33
|
+
], t.prototype, "title", 2);
|
|
34
|
+
r([
|
|
35
|
+
n({ type: String, reflect: !0 })
|
|
36
|
+
], t.prototype, "href", 2);
|
|
37
|
+
r([
|
|
38
|
+
n({ type: String, reflect: !0 })
|
|
39
|
+
], t.prototype, "iconName", 2);
|
|
40
|
+
r([
|
|
41
|
+
n({ type: Boolean, reflect: !0 })
|
|
42
|
+
], t.prototype, "external", 2);
|
|
43
|
+
r([
|
|
44
|
+
n({ type: Boolean, reflect: !0 })
|
|
45
|
+
], t.prototype, "openInNewTab", 2);
|
|
46
|
+
r([
|
|
47
|
+
n({ type: String, reflect: !0 })
|
|
48
|
+
], t.prototype, "skin", 2);
|
|
49
|
+
t = r([
|
|
50
|
+
h("pkt-linkcard")
|
|
51
|
+
], t);
|
|
52
|
+
export {
|
|
53
|
+
t as P
|
|
54
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";const t=require("./index-DwUOKvXt.cjs"),p=require("./custom-element-B-TlBwRu.cjs"),k=require("./ref-HubvG-Pk.cjs");require("./index-B3C4fgLP.cjs");var c=Object.defineProperty,h=Object.getOwnPropertyDescriptor,r=(s,n,i,l)=>{for(var e=l>1?void 0:l?h(n,i):n,o=s.length-1,a;o>=0;o--)(a=s[o])&&(e=(l?a(n,i,e):a(e))||e);return l&&e&&c(n,i,e),e};exports.PktLinkCard=class extends t.PktElement{constructor(){super(),this.defaultSlot=k.e(),this.title="",this.href="#",this.iconName="",this.external=!1,this.openInNewTab=!1,this.skin="normal",this.slotController=new k.PktSlotController(this,this.defaultSlot)}render(){const n=["pkt-linkcard",this.skin&&`pkt-linkcard--${this.skin}`].filter(Boolean).join(" "),i=["pkt-linkcard__title",this.external&&"pkt-link pkt-link--external"].filter(Boolean).join(" ");return t.x`
|
|
2
|
+
<a
|
|
3
|
+
href=${this.href}
|
|
4
|
+
class=${n}
|
|
5
|
+
target=${this.openInNewTab?"_blank":"_self"}
|
|
6
|
+
rel=${this.openInNewTab??"noopener noreferrer"}
|
|
7
|
+
>
|
|
8
|
+
${this.iconName&&t.x`<pkt-icon class="pkt-link__icon" name="${this.iconName}" />`}
|
|
9
|
+
${this.title&&t.x`<div class=${i}>${this.title}</div>`}
|
|
10
|
+
|
|
11
|
+
<div class="pkt-linkcard__text" ${k.n(this.defaultSlot)}></div>
|
|
12
|
+
</a>
|
|
13
|
+
`}};r([t.n({type:String,reflect:!0})],exports.PktLinkCard.prototype,"title",2);r([t.n({type:String,reflect:!0})],exports.PktLinkCard.prototype,"href",2);r([t.n({type:String,reflect:!0})],exports.PktLinkCard.prototype,"iconName",2);r([t.n({type:Boolean,reflect:!0})],exports.PktLinkCard.prototype,"external",2);r([t.n({type:Boolean,reflect:!0})],exports.PktLinkCard.prototype,"openInNewTab",2);r([t.n({type:String,reflect:!0})],exports.PktLinkCard.prototype,"skin",2);exports.PktLinkCard=r([p.t("pkt-linkcard")],exports.PktLinkCard);
|
package/dist/pkt-index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./pkt-alert.cjs"),t=require("./index-v7tN93-p.cjs"),r=require("./pkt-card.cjs"),n=require("./pkt-component-template.cjs"),o=require("./pkt-datepicker.cjs"),u=require("./helptext-C_tkSNm1.cjs"),a=require("./index-B3C4fgLP.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./pkt-alert.cjs"),t=require("./index-v7tN93-p.cjs"),r=require("./pkt-card.cjs"),n=require("./pkt-component-template.cjs"),o=require("./pkt-datepicker.cjs"),u=require("./helptext-C_tkSNm1.cjs"),a=require("./index-B3C4fgLP.cjs"),i=require("./pkt-input-wrapper.cjs"),P=require("./pkt-link.cjs"),c=require("./linkcard-BgnHfuNJ.cjs"),k=require("./pkt-messagebox.cjs"),p=require("./modal-BJhFSFW-.cjs"),b=require("./pkt-tag.cjs");Object.defineProperty(exports,"PktAlert",{enumerable:!0,get:()=>e.PktAlert});Object.defineProperty(exports,"PktCalendar",{enumerable:!0,get:()=>t.PktCalendar});Object.defineProperty(exports,"PktCard",{enumerable:!0,get:()=>r.PktCard});Object.defineProperty(exports,"PktComponent",{enumerable:!0,get:()=>n.PktComponent});Object.defineProperty(exports,"PktDatepicker",{enumerable:!0,get:()=>o.PktDatepicker});Object.defineProperty(exports,"PktHelptext",{enumerable:!0,get:()=>u.PktHelptext});Object.defineProperty(exports,"PktIcon",{enumerable:!0,get:()=>a.PktIcon});Object.defineProperty(exports,"PktInputWrapper",{enumerable:!0,get:()=>i.PktInputWrapper});Object.defineProperty(exports,"PktLink",{enumerable:!0,get:()=>P.PktLink});Object.defineProperty(exports,"PktLinkCard",{enumerable:!0,get:()=>c.PktLinkCard});Object.defineProperty(exports,"PktMessagebox",{enumerable:!0,get:()=>k.PktMessagebox});Object.defineProperty(exports,"PktModal",{enumerable:!0,get:()=>p.PktModal});Object.defineProperty(exports,"PktTag",{enumerable:!0,get:()=>b.PktTag});
|
package/dist/pkt-index.js
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import { PktAlert as o } from "./pkt-alert.js";
|
|
2
2
|
import { P as p } from "./index-DX_ADdmh.js";
|
|
3
3
|
import { PktCard as k } from "./pkt-card.js";
|
|
4
|
-
import { PktComponent as
|
|
4
|
+
import { PktComponent as a } from "./pkt-component-template.js";
|
|
5
5
|
import { PktDatepicker as f } from "./pkt-datepicker.js";
|
|
6
6
|
import { P as s } from "./helptext-CgkMKrJP.js";
|
|
7
|
-
import { P as
|
|
8
|
-
import { PktInputWrapper as
|
|
9
|
-
import { PktLink as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
7
|
+
import { P as l } from "./index-CSOOyHCM.js";
|
|
8
|
+
import { PktInputWrapper as i } from "./pkt-input-wrapper.js";
|
|
9
|
+
import { PktLink as g } from "./pkt-link.js";
|
|
10
|
+
import { P as L } from "./linkcard-BQh5exrq.js";
|
|
11
|
+
import { PktMessagebox as b } from "./pkt-messagebox.js";
|
|
12
|
+
import { P as A } from "./modal-BfM1Nbwy.js";
|
|
13
|
+
import { PktTag as H } from "./pkt-tag.js";
|
|
13
14
|
export {
|
|
14
15
|
o as PktAlert,
|
|
15
16
|
p as PktCalendar,
|
|
16
17
|
k as PktCard,
|
|
17
|
-
|
|
18
|
+
a as PktComponent,
|
|
18
19
|
f as PktDatepicker,
|
|
19
20
|
s as PktHelptext,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
l as PktIcon,
|
|
22
|
+
i as PktInputWrapper,
|
|
23
|
+
g as PktLink,
|
|
24
|
+
L as PktLinkCard,
|
|
25
|
+
b as PktMessagebox,
|
|
26
|
+
A as PktModal,
|
|
27
|
+
H as PktTag
|
|
26
28
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./linkcard-BgnHfuNJ.cjs"),t=e.PktLinkCard;Object.defineProperty(exports,"PktLinkCard",{enumerable:!0,get:()=>e.PktLinkCard});exports.default=t;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.13.0",
|
|
4
4
|
"description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@oslokommune/punkt-assets": "^12.7.3",
|
|
32
|
-
"@oslokommune/punkt-css": "^12.
|
|
32
|
+
"@oslokommune/punkt-css": "^12.13.0",
|
|
33
33
|
"sass": "^1.78.0",
|
|
34
34
|
"typescript": "^5.6.2",
|
|
35
35
|
"vite": "^5.4.4",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
57
57
|
},
|
|
58
58
|
"license": "MIT",
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "fafdb670e002cbf94fd34acc45dd066344695816"
|
|
60
60
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { PktHelptext } from './helptext'
|
|
|
7
7
|
export { PktIcon } from './icon'
|
|
8
8
|
export { PktInputWrapper } from './input-wrapper'
|
|
9
9
|
export { PktLink } from './link'
|
|
10
|
+
export { PktLinkCard } from './linkcard'
|
|
10
11
|
export { PktMessagebox } from './messagebox'
|
|
11
12
|
export { PktModal } from './modal'
|
|
12
13
|
export { PktTag } from './tag'
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { html } from 'lit'
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
3
|
+
import { PktElement } from '../element'
|
|
4
|
+
import { ref } from 'lit/directives/ref.js'
|
|
5
|
+
import { Ref, createRef } from 'lit/directives/ref.js'
|
|
6
|
+
|
|
7
|
+
import '../icon'
|
|
8
|
+
import { PktSlotController } from '@/controllers/pkt-slot-controller'
|
|
9
|
+
|
|
10
|
+
export type LinkCardSkin =
|
|
11
|
+
| 'normal'
|
|
12
|
+
| 'blue'
|
|
13
|
+
| 'beige'
|
|
14
|
+
| 'green'
|
|
15
|
+
| 'gray'
|
|
16
|
+
| 'beige-outline'
|
|
17
|
+
| 'gray-outline'
|
|
18
|
+
|
|
19
|
+
export interface IPktLinkCard {
|
|
20
|
+
title?: string
|
|
21
|
+
href?: string
|
|
22
|
+
iconName?: string
|
|
23
|
+
external?: boolean
|
|
24
|
+
openInNewTab?: boolean
|
|
25
|
+
skin?: LinkCardSkin
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@customElement('pkt-linkcard')
|
|
29
|
+
export class PktLinkCard extends PktElement implements IPktLinkCard {
|
|
30
|
+
defaultSlot: Ref<HTMLElement> = createRef()
|
|
31
|
+
|
|
32
|
+
@property({ type: String, reflect: true }) title: string = ''
|
|
33
|
+
@property({ type: String, reflect: true }) href: string = '#'
|
|
34
|
+
@property({ type: String, reflect: true }) iconName: string = ''
|
|
35
|
+
@property({ type: Boolean, reflect: true }) external: boolean = false
|
|
36
|
+
@property({ type: Boolean, reflect: true }) openInNewTab: boolean = false
|
|
37
|
+
@property({ type: String, reflect: true }) skin: LinkCardSkin = 'normal'
|
|
38
|
+
|
|
39
|
+
constructor() {
|
|
40
|
+
super()
|
|
41
|
+
this.slotController = new PktSlotController(this, this.defaultSlot)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
render() {
|
|
45
|
+
const classes = ['pkt-linkcard', this.skin && `pkt-linkcard--${this.skin}`]
|
|
46
|
+
.filter(Boolean)
|
|
47
|
+
.join(' ')
|
|
48
|
+
|
|
49
|
+
const titleClasses = ['pkt-linkcard__title', this.external && 'pkt-link pkt-link--external']
|
|
50
|
+
.filter(Boolean)
|
|
51
|
+
.join(' ')
|
|
52
|
+
|
|
53
|
+
return html`
|
|
54
|
+
<a
|
|
55
|
+
href=${this.href}
|
|
56
|
+
class=${classes}
|
|
57
|
+
target=${this.openInNewTab ? '_blank' : '_self'}
|
|
58
|
+
rel=${this.openInNewTab ?? 'noopener noreferrer'}
|
|
59
|
+
>
|
|
60
|
+
${this.iconName && html`<pkt-icon class="pkt-link__icon" name="${this.iconName}" />`}
|
|
61
|
+
${this.title && html`<div class=${titleClasses}>${this.title}</div>`}
|
|
62
|
+
|
|
63
|
+
<div class="pkt-linkcard__text" ${ref(this.defaultSlot)}></div>
|
|
64
|
+
</a>
|
|
65
|
+
`
|
|
66
|
+
}
|
|
67
|
+
}
|