@oslokommune/punkt-elements 12.31.0 → 12.31.2
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/{card-BWslf2mu.cjs → card-C63x_nll.cjs} +1 -1
- package/dist/{card-B0uNyDCw.js → card-DQfNKnKl.js} +1 -1
- package/dist/{datepicker-CQZ84VOS.js → datepicker-CYUvRGhE.js} +1 -1
- package/dist/{datepicker-BczZqaup.cjs → datepicker-FuAL0uNU.cjs} +1 -1
- package/dist/index.d.ts +89 -5
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +3 -3
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +1 -1
- package/dist/tag-BeLSOjNh.cjs +18 -0
- package/dist/{tag-CHtPXyP5.js → tag-CmFcSdOV.js} +44 -30
- package/package.json +2 -2
- package/src/components/tag/tag.ts +27 -7
- package/dist/tag-D6ARkq2Z.cjs +0 -17
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const g=require("./class-map-Dj5mbCUg.cjs"),d=require("./if-defined-CpIkv1A4.cjs"),t=require("./element-CzFXQBoS.cjs"),k=require("./pkt-slot-controller-Oc32unDk.cjs"),l=require("./ref-2anvRHT4.cjs");require("./icon-BOKusjAA.cjs");require("./tag-
|
|
1
|
+
"use strict";const g=require("./class-map-Dj5mbCUg.cjs"),d=require("./if-defined-CpIkv1A4.cjs"),t=require("./element-CzFXQBoS.cjs"),k=require("./pkt-slot-controller-Oc32unDk.cjs"),l=require("./ref-2anvRHT4.cjs");require("./icon-BOKusjAA.cjs");require("./tag-BeLSOjNh.cjs");const u="pkt-card",h=!0,m={heading:{type:"string",name:"Heading",description:"Tittel på kortet"},subheading:{type:"string",name:"Subheading",description:"Undertittel på kortet"},skin:{type:["outlined","gray","blue","beige","green"],name:"Skin",description:"Farge på kortet",default:"outlined"},direction:{type:["landscape","portrait"],name:"Direction",description:"Retningen innholdet skal ligge i forhold til kortet",default:"portrait"},tags:{type:"array",description:"Liste av tags på kortet. Tar inn en array med objekter med følgende stringproperties: skin, iconName, ariaLabel, text",name:"Tags",items:{type:"object",properties:{skin:{type:["blue","green","red","yellow"],description:"Farge på tag"},iconName:{type:"icon",description:"Id på ikonet du ønsker å bruke til tag"},ariaLabel:{type:"string",description:"Tekst for aria-label"},text:{type:"string",description:"Tekst på tag",required:!0}}}},image:{type:"object",name:"Bilde",description:"Bilde på kortet. Tar inn et objekt av typen {src: string, alt: string}. src er stien til bildet, og alt er tekst for aria-label.",properties:{src:{type:"string",description:"Bilde på kortet",required:!0},alt:{type:"string",description:"Tekst for aria-label",required:!0}}}},y={default:{description:"Innholdet i kortet"}},c={name:u,"css-class":"pkt-card",isElement:h,props:m,slots:y};var f=Object.defineProperty,b=Object.getOwnPropertyDescriptor,i=(a,s,e,n)=>{for(var r=n>1?void 0:n?b(s,e):s,o=a.length-1,p;o>=0;o--)(p=a[o])&&(r=(n?p(s,e,r):p(r))||r);return n&&r&&f(s,e,r),r};exports.PktCard=class extends t.PktElement{constructor(){super(),this.defaultSlot=l.e(),this.skin=c.props.skin.default,this.direction=c.props.direction.default,this.image={src:"",alt:""},this.heading="",this.subheading="",this.tags=[],this.slotController=new k.PktSlotController(this,this.defaultSlot)}connectedCallback(){super.connectedCallback()}render(){const s={"pkt-card":!0,[`pkt-card--${this.skin}`]:this.skin,[`pkt-card--${this.direction}`]:this.direction};return t.x`
|
|
2
2
|
<div class=${g.e(s)}>
|
|
3
3
|
${this.image.src&&t.x`
|
|
4
4
|
<div class="pkt-card__image">
|
|
@@ -4,7 +4,7 @@ import { P as m, x as r, E as k, n as a, a as u } from "./element-C7XjZtLU.js";
|
|
|
4
4
|
import { P as y } from "./pkt-slot-controller-Clbye6cM.js";
|
|
5
5
|
import { e as f, n as b } from "./ref-DbOSDQbk.js";
|
|
6
6
|
import "./icon-BEUgV9Wo.js";
|
|
7
|
-
import "./tag-
|
|
7
|
+
import "./tag-CmFcSdOV.js";
|
|
8
8
|
const $ = "pkt-card", v = !0, _ = {
|
|
9
9
|
heading: {
|
|
10
10
|
type: "string",
|
|
@@ -8,7 +8,7 @@ import { p as H, v as $, r as R, M as I, m as N, e as w, n as y } from "./ref-Db
|
|
|
8
8
|
import { e as U, i as K, t as W } from "./directive-B76A7YXI.js";
|
|
9
9
|
import "./icon-BEUgV9Wo.js";
|
|
10
10
|
import "./input-wrapper-DaZZq8c0.js";
|
|
11
|
-
import "./tag-
|
|
11
|
+
import "./tag-CmFcSdOV.js";
|
|
12
12
|
import { P as z } from "./pkt-slot-controller-Clbye6cM.js";
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const $=require("./class-map-Dj5mbCUg.cjs"),k=require("./if-defined-CpIkv1A4.cjs"),n=require("./element-CzFXQBoS.cjs"),S=require("./state-HNj0_316.cjs"),g=require("./calendar-CxBo98iI.cjs"),P=require("./input-element-Dtyuf6s8.cjs"),r=require("./ref-2anvRHT4.cjs"),w=require("./directive-C_VV3qwo.cjs");require("./icon-BOKusjAA.cjs");require("./input-wrapper-Bo2_t6pA.cjs");require("./tag-
|
|
1
|
+
"use strict";const $=require("./class-map-Dj5mbCUg.cjs"),k=require("./if-defined-CpIkv1A4.cjs"),n=require("./element-CzFXQBoS.cjs"),S=require("./state-HNj0_316.cjs"),g=require("./calendar-CxBo98iI.cjs"),P=require("./input-element-Dtyuf6s8.cjs"),r=require("./ref-2anvRHT4.cjs"),w=require("./directive-C_VV3qwo.cjs");require("./icon-BOKusjAA.cjs");require("./input-wrapper-Bo2_t6pA.cjs");require("./tag-BeLSOjNh.cjs");const I=require("./pkt-slot-controller-Oc32unDk.cjs");/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,55 @@ import { TZDate } from '@date-fns/tz';
|
|
|
14
14
|
*/
|
|
15
15
|
declare type ElementProps<Element, PropKeys extends keyof Element> = Partial<Pick<Element, PropKeys>>;
|
|
16
16
|
|
|
17
|
+
declare interface IAriaAttributes {
|
|
18
|
+
'aria-activedescendant'?: string;
|
|
19
|
+
'aria-controls'?: string;
|
|
20
|
+
'aria-describedby'?: string;
|
|
21
|
+
'aria-details'?: string;
|
|
22
|
+
'aria-errormessage'?: string;
|
|
23
|
+
'aria-flowto'?: string;
|
|
24
|
+
'aria-label'?: string;
|
|
25
|
+
'aria-labelledby'?: string;
|
|
26
|
+
'aria-owns'?: string;
|
|
27
|
+
'aria-roledescription'?: string;
|
|
28
|
+
'aria-autocomplete'?: TAriaAutoComplete;
|
|
29
|
+
'aria-checked'?: TAriaBooleanMixed;
|
|
30
|
+
'aria-current'?: TAriaCurrent;
|
|
31
|
+
'aria-disabled'?: TAriaBoolean;
|
|
32
|
+
'aria-expanded'?: TAriaBoolean;
|
|
33
|
+
'aria-haspopup'?: TAriaHasPopup;
|
|
34
|
+
'aria-hidden'?: TAriaBoolean;
|
|
35
|
+
'aria-invalid'?: TAriaInvalid;
|
|
36
|
+
'aria-keyshortcuts'?: string;
|
|
37
|
+
'aria-level'?: number;
|
|
38
|
+
'aria-modal'?: TAriaBoolean;
|
|
39
|
+
'aria-multiline'?: TAriaBoolean;
|
|
40
|
+
'aria-multiselectable'?: TAriaBoolean;
|
|
41
|
+
'aria-orientation'?: TAriaOrientation;
|
|
42
|
+
'aria-placeholder'?: string;
|
|
43
|
+
'aria-pressed'?: TAriaBooleanMixed;
|
|
44
|
+
'aria-readonly'?: TAriaBoolean;
|
|
45
|
+
'aria-required'?: TAriaBoolean;
|
|
46
|
+
'aria-selected'?: TAriaBoolean;
|
|
47
|
+
'aria-sort'?: TAriaSort;
|
|
48
|
+
'aria-atomic'?: TAriaBoolean;
|
|
49
|
+
'aria-busy'?: TAriaBoolean;
|
|
50
|
+
'aria-live'?: TAriaLive;
|
|
51
|
+
'aria-relevant'?: TAriaRelevant | string;
|
|
52
|
+
'aria-colcount'?: number;
|
|
53
|
+
'aria-colindex'?: number;
|
|
54
|
+
'aria-colspan'?: number;
|
|
55
|
+
'aria-rowcount'?: number;
|
|
56
|
+
'aria-rowindex'?: number;
|
|
57
|
+
'aria-rowspan'?: number;
|
|
58
|
+
'aria-posinset'?: number;
|
|
59
|
+
'aria-setsize'?: number;
|
|
60
|
+
'aria-valuemax'?: number;
|
|
61
|
+
'aria-valuemin'?: number;
|
|
62
|
+
'aria-valuenow'?: number;
|
|
63
|
+
'aria-valuetext'?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
17
66
|
declare interface IPktAlert {
|
|
18
67
|
skin?: TAlertSkin;
|
|
19
68
|
closeAlert?: boolean;
|
|
@@ -125,10 +174,10 @@ declare interface IPktTag {
|
|
|
125
174
|
closeTag?: boolean;
|
|
126
175
|
size?: TPktSize;
|
|
127
176
|
skin?: TTagSkin;
|
|
128
|
-
textStyle?: string;
|
|
129
|
-
iconName?:
|
|
177
|
+
textStyle?: string | null;
|
|
178
|
+
iconName?: PktIconName;
|
|
130
179
|
type?: TTagType;
|
|
131
|
-
ariaLabel?:
|
|
180
|
+
ariaLabel?: IAriaAttributes['aria-label'] | null;
|
|
132
181
|
}
|
|
133
182
|
|
|
134
183
|
export declare class PktAlert extends PktElement implements IPktAlert {
|
|
@@ -706,7 +755,7 @@ declare class PktSlotController implements ReactiveController {
|
|
|
706
755
|
private handleMutations;
|
|
707
756
|
}
|
|
708
757
|
|
|
709
|
-
export declare class PktTag extends PktElement {
|
|
758
|
+
export declare class PktTag extends PktElement implements IPktTag {
|
|
710
759
|
slotController: PktSlotController;
|
|
711
760
|
defaultSlot: Ref<HTMLElement>;
|
|
712
761
|
constructor();
|
|
@@ -719,11 +768,16 @@ export declare class PktTag extends PktElement {
|
|
|
719
768
|
textStyle: string | null;
|
|
720
769
|
iconName: string | undefined;
|
|
721
770
|
type: TTagType;
|
|
722
|
-
ariaLabel: string;
|
|
771
|
+
ariaLabel: string | null;
|
|
723
772
|
/**
|
|
724
773
|
* Element state
|
|
725
774
|
*/
|
|
726
775
|
_isClosed: boolean;
|
|
776
|
+
_ariaDescription: string | null;
|
|
777
|
+
/**
|
|
778
|
+
* Lifecycle
|
|
779
|
+
*/
|
|
780
|
+
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
727
781
|
/**
|
|
728
782
|
* Element functions
|
|
729
783
|
*/
|
|
@@ -774,8 +828,38 @@ declare type Props_5 = ElementProps<PktTextinput, 'value' | 'type' | 'size' | 'a
|
|
|
774
828
|
|
|
775
829
|
declare type TAlertSkin = 'error' | 'success' | 'warning' | 'info';
|
|
776
830
|
|
|
831
|
+
declare type TAriaAutoComplete = 'none' | 'inline' | 'list' | 'both';
|
|
832
|
+
|
|
833
|
+
/**
|
|
834
|
+
* aria.ts
|
|
835
|
+
*
|
|
836
|
+
* Typedefinisjoner for ARIA-attributter og roller.
|
|
837
|
+
* Eksportert slik at de kan importere andre steder:
|
|
838
|
+
*
|
|
839
|
+
* import type {
|
|
840
|
+
* TAriaAttributes,
|
|
841
|
+
* TAriaLive,
|
|
842
|
+
* // ...
|
|
843
|
+
* } from './aria-types';
|
|
844
|
+
*/
|
|
845
|
+
declare type TAriaBoolean = boolean | 'true' | 'false';
|
|
846
|
+
|
|
847
|
+
declare type TAriaBooleanMixed = TAriaBoolean | 'mixed';
|
|
848
|
+
|
|
849
|
+
declare type TAriaCurrent = TAriaBoolean | 'page' | 'step' | 'location' | 'date' | 'time';
|
|
850
|
+
|
|
851
|
+
declare type TAriaHasPopup = TAriaBoolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
|
|
852
|
+
|
|
853
|
+
declare type TAriaInvalid = TAriaBoolean | 'grammar' | 'spelling';
|
|
854
|
+
|
|
777
855
|
declare type TAriaLive = 'off' | 'polite' | 'assertive';
|
|
778
856
|
|
|
857
|
+
declare type TAriaOrientation = 'horizontal' | 'vertical';
|
|
858
|
+
|
|
859
|
+
declare type TAriaRelevant = 'additions' | 'removals' | 'text' | 'all';
|
|
860
|
+
|
|
861
|
+
declare type TAriaSort = 'none' | 'ascending' | 'descending' | 'other';
|
|
862
|
+
|
|
779
863
|
declare type TCardSkin = 'outlined' | 'gray' | 'beige' | 'green' | 'blue';
|
|
780
864
|
|
|
781
865
|
declare type TDirection = 'portrait' | 'landscape';
|
package/dist/pkt-card.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./card-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./card-C63x_nll.cjs"),t=e.PktCard;Object.defineProperty(exports,"PktCard",{enumerable:!0,get:()=>e.PktCard});exports.default=t;
|
package/dist/pkt-card.js
CHANGED
package/dist/pkt-datepicker.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./datepicker-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./datepicker-FuAL0uNU.cjs"),t=e.PktDatepicker;Object.defineProperty(exports,"PktDatepicker",{enumerable:!0,get:()=>e.PktDatepicker});exports.default=t;
|
package/dist/pkt-datepicker.js
CHANGED
package/dist/pkt-index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./alert-BDxxRqgi.cjs"),d=require("./backlink-Dn4DfWVR.cjs"),P=require("./button-Beo3c7cx.cjs"),c=require("./calendar-CxBo98iI.cjs"),b=require("./card-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./alert-BDxxRqgi.cjs"),d=require("./backlink-Dn4DfWVR.cjs"),P=require("./button-Beo3c7cx.cjs"),c=require("./calendar-CxBo98iI.cjs"),b=require("./card-C63x_nll.cjs"),m=require("./checkbox-9Zjy_NU7.cjs"),t=require("./element-CzFXQBoS.cjs"),g=require("./pkt-slot-controller-Oc32unDk.cjs"),s=require("./ref-2anvRHT4.cjs"),h=require("./class-map-Dj5mbCUg.cjs"),f=require("./datepicker-FuAL0uNU.cjs"),y=require("./helptext-B9kxDc2b.cjs"),O=require("./icon-BOKusjAA.cjs"),j=require("./input-wrapper-Bo2_t6pA.cjs"),q=require("./link-1iq0Pmuf.cjs"),x=require("./linkcard-2WzDJPZz.cjs"),C=require("./loader-DI74pe25.cjs"),v=require("./messagebox-DQpEMkS2.cjs"),S=require("./modal-ytIJwfr3.cjs"),$=require("./progressbar-B6A9UVXS.cjs"),p=require("./radiobutton-BWyQgR_x.cjs"),L=require("./tag-BeLSOjNh.cjs"),_=require("./textarea-VG-UTMLP.cjs"),B=require("./textinput-CEP7QA3E.cjs"),T=require("./select-DZL6aa2s.cjs");var M=Object.defineProperty,R=Object.getOwnPropertyDescriptor,o=(a,e,r,i)=>{for(var n=i>1?void 0:i?R(e,r):e,u=a.length-1,l;u>=0;u--)(l=a[u])&&(n=(i?l(e,r,n):l(n))||n);return i&&n&&M(e,r,n),n};exports.PktComponent=class extends t.PktElement{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=s.e(),this.namedSlot=s.e(),this.slotController=new g.PktSlotController(this,this.defaultSlot,this.namedSlot)}connectedCallback(){this.strings.length&&this.strings.forEach(e=>{this._list.push(e.toUpperCase())}),super.connectedCallback()}render(){const e={"pkt-component":!0,"pkt-component--has-list":this.strings.length>0,"pkt-darkmode":this.darkmode};return t.x`
|
|
2
2
|
<div class="${h.e(e)}">
|
|
3
3
|
<h1 class="pkt-txt-28">${this.string}</h1>
|
|
4
4
|
|
package/dist/pkt-index.js
CHANGED
|
@@ -3,13 +3,13 @@ import { P as E } from "./backlink-CzpB-ih9.js";
|
|
|
3
3
|
import { P as R } from "./button-9NwGr-OS.js";
|
|
4
4
|
import { c as d } from "./calendar-BbZNxsKY.js";
|
|
5
5
|
import { P as j } from "./calendar-BbZNxsKY.js";
|
|
6
|
-
import { P as D } from "./card-
|
|
6
|
+
import { P as D } from "./card-DQfNKnKl.js";
|
|
7
7
|
import { P as G } from "./checkbox-CzDpR6_8.js";
|
|
8
8
|
import { P as f, x as P, t as k, n, a as c } from "./element-C7XjZtLU.js";
|
|
9
9
|
import { P as x } from "./pkt-slot-controller-Clbye6cM.js";
|
|
10
10
|
import { e as m, n as h } from "./ref-DbOSDQbk.js";
|
|
11
11
|
import { e as u } from "./class-map-DWtqmIRS.js";
|
|
12
|
-
import { P as M } from "./datepicker-
|
|
12
|
+
import { P as M } from "./datepicker-CYUvRGhE.js";
|
|
13
13
|
import { P as N } from "./helptext-CqnoPodd.js";
|
|
14
14
|
import { P as W } from "./icon-BEUgV9Wo.js";
|
|
15
15
|
import { P as z } from "./input-wrapper-DaZZq8c0.js";
|
|
@@ -20,7 +20,7 @@ import { P as tt } from "./messagebox-KP-8-tA9.js";
|
|
|
20
20
|
import { P as rt } from "./modal-kPX8nO_L.js";
|
|
21
21
|
import { P as st } from "./progressbar-D0nxLqHu.js";
|
|
22
22
|
import { P as nt, P as it } from "./radiobutton-DLWjvLBO.js";
|
|
23
|
-
import { P as lt } from "./tag-
|
|
23
|
+
import { P as lt } from "./tag-CmFcSdOV.js";
|
|
24
24
|
import { P as mt } from "./textarea-BPqWCymU.js";
|
|
25
25
|
import { P as dt } from "./textinput-VD74aGzx.js";
|
|
26
26
|
import { P as kt } from "./select-CzuxXKll.js";
|
package/dist/pkt-tag.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./tag-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./tag-BeLSOjNh.cjs"),t=e.PktTag;Object.defineProperty(exports,"PktTag",{enumerable:!0,get:()=>e.PktTag});exports.default=t;
|
package/dist/pkt-tag.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";const u=require("./class-map-Dj5mbCUg.cjs"),t=require("./element-CzFXQBoS.cjs"),g=require("./state-HNj0_316.cjs"),d=require("./pkt-slot-controller-Oc32unDk.cjs"),c=require("./ref-2anvRHT4.cjs");require("./icon-BOKusjAA.cjs");const h=require("./if-defined-CpIkv1A4.cjs"),k="pkt-tag",f=!0,y={closeTag:{type:"boolean",required:!1,default:!1},size:{required:!1,default:"medium",type:["small","medium","large"]},iconName:{type:"icon",required:!1},skin:{required:!1,default:"blue",type:["blue","blue-light","blue-dark","green","red","beige","yellow","gray"]},textStyle:{required:!1,default:"normal-text",type:["thin-text","normal-text"]},type:{required:!1,default:"button",type:["button","submit","reset"]},ariaLabel:{type:"string",required:!1}},b={default:{description:"Teksten til tag"}},l={name:k,"css-class":"pkt-tag",isElement:f,props:y,slots:b};var m=Object.defineProperty,T=Object.getOwnPropertyDescriptor,i=(o,e,a,r)=>{for(var s=r>1?void 0:r?T(e,a):e,n=o.length-1,p;n>=0;n--)(p=o[n])&&(s=(r?p(e,a,s):p(s))||s);return r&&s&&m(e,a,s),s};exports.PktTag=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.closeTag=l.props.closeTag.default,this.size=l.props.size.default,this.skin=l.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=l.props.type.default,this.ariaLabel=null,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!0,composed:!0}))},this.slotController=new d.PktSlotController(this,this.defaultSlot),this._isClosed=!1}firstUpdated(e){var a,r;if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){const s=(r=(a=this.defaultSlot.value)==null?void 0:a.textContent)==null?void 0:r.trim();s&&(this._ariaDescription=`Klikk for å fjerne ${s}`)}}render(){const e={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},a={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName,"pkt-hide":this._isClosed};return this.closeTag?t.x`
|
|
2
|
+
<button
|
|
3
|
+
class=${u.e(a)}
|
|
4
|
+
type=${this.type}
|
|
5
|
+
@click=${this.close}
|
|
6
|
+
aria-label=${h.o(this.ariaLabel||void 0)}
|
|
7
|
+
aria-description=${h.o(this._ariaDescription||void 0)}
|
|
8
|
+
>
|
|
9
|
+
${this.iconName&&t.x`<pkt-icon class="pkt-tag__icon" name=${this.iconName}></pkt-icon>`}
|
|
10
|
+
<span ${c.n(this.defaultSlot)}></span>
|
|
11
|
+
<pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
|
|
12
|
+
</button>
|
|
13
|
+
`:t.x`
|
|
14
|
+
<span class=${u.e(e)}>
|
|
15
|
+
${this.iconName&&t.x`<pkt-icon class="pkt-tag__icon" name=${this.iconName}></pkt-icon>`}
|
|
16
|
+
<span ${c.n(this.defaultSlot)}></span>
|
|
17
|
+
</span>
|
|
18
|
+
`}};i([t.n({type:Boolean,reflect:!0})],exports.PktTag.prototype,"closeTag",2);i([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"size",2);i([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"skin",2);i([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"textStyle",2);i([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"iconName",2);i([t.n({type:String})],exports.PktTag.prototype,"type",2);i([t.n({type:String})],exports.PktTag.prototype,"ariaLabel",2);i([g.r()],exports.PktTag.prototype,"_isClosed",2);i([g.r()],exports.PktTag.prototype,"_ariaDescription",2);exports.PktTag=i([t.t("pkt-tag")],exports.PktTag);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { e as h } from "./class-map-DWtqmIRS.js";
|
|
2
|
-
import { P as
|
|
3
|
-
import { r as
|
|
4
|
-
import { P as
|
|
5
|
-
import { e as
|
|
2
|
+
import { P as y, x as p, n as r, a as g } from "./element-C7XjZtLU.js";
|
|
3
|
+
import { r as m } from "./state-CDQk0DFQ.js";
|
|
4
|
+
import { P as k } from "./pkt-slot-controller-Clbye6cM.js";
|
|
5
|
+
import { e as b, n as f } from "./ref-DbOSDQbk.js";
|
|
6
6
|
import "./icon-BEUgV9Wo.js";
|
|
7
|
-
|
|
7
|
+
import { o as d } from "./if-defined-eRX4e5zO.js";
|
|
8
|
+
const _ = "pkt-tag", $ = !0, S = {
|
|
8
9
|
closeTag: {
|
|
9
10
|
type: "boolean",
|
|
10
11
|
required: !1,
|
|
@@ -56,34 +57,43 @@ const b = "pkt-tag", $ = !0, S = {
|
|
|
56
57
|
},
|
|
57
58
|
ariaLabel: {
|
|
58
59
|
type: "string",
|
|
59
|
-
required: !1
|
|
60
|
-
default: "Lukk"
|
|
60
|
+
required: !1
|
|
61
61
|
}
|
|
62
|
-
},
|
|
62
|
+
}, x = {
|
|
63
63
|
default: {
|
|
64
64
|
description: "Teksten til tag"
|
|
65
65
|
}
|
|
66
|
-
},
|
|
67
|
-
name:
|
|
66
|
+
}, n = {
|
|
67
|
+
name: _,
|
|
68
68
|
"css-class": "pkt-tag",
|
|
69
69
|
isElement: $,
|
|
70
70
|
props: S,
|
|
71
|
-
slots:
|
|
71
|
+
slots: x
|
|
72
72
|
};
|
|
73
|
-
var
|
|
74
|
-
for (var
|
|
75
|
-
(u = s[c]) && (
|
|
76
|
-
return
|
|
73
|
+
var v = Object.defineProperty, C = Object.getOwnPropertyDescriptor, e = (s, i, l, o) => {
|
|
74
|
+
for (var a = o > 1 ? void 0 : o ? C(i, l) : i, c = s.length - 1, u; c >= 0; c--)
|
|
75
|
+
(u = s[c]) && (a = (o ? u(i, l, a) : u(a)) || a);
|
|
76
|
+
return o && a && v(i, l, a), a;
|
|
77
77
|
};
|
|
78
|
-
let t = class extends
|
|
78
|
+
let t = class extends y {
|
|
79
79
|
constructor() {
|
|
80
|
-
super(), this.defaultSlot =
|
|
80
|
+
super(), this.defaultSlot = b(), this.closeTag = n.props.closeTag.default, this.size = n.props.size.default, this.skin = n.props.skin.default, this.textStyle = null, this.iconName = void 0, this.type = n.props.type.default, this.ariaLabel = null, this._isClosed = !1, this._ariaDescription = null, this.close = (s) => {
|
|
81
81
|
this._isClosed = !0, this.dispatchEvent(
|
|
82
82
|
new CustomEvent("close", { detail: { origin: s }, bubbles: !0, composed: !0 })
|
|
83
83
|
), this.dispatchEvent(
|
|
84
84
|
new CustomEvent("on-close", { detail: { origin: s }, bubbles: !0, composed: !0 })
|
|
85
85
|
);
|
|
86
|
-
}, this.slotController = new
|
|
86
|
+
}, this.slotController = new k(this, this.defaultSlot), this._isClosed = !1;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Lifecycle
|
|
90
|
+
*/
|
|
91
|
+
firstUpdated(s) {
|
|
92
|
+
var i, l;
|
|
93
|
+
if (super.firstUpdated(s), this.closeTag && !this.ariaLabel) {
|
|
94
|
+
const o = (l = (i = this.defaultSlot.value) == null ? void 0 : i.textContent) == null ? void 0 : l.trim();
|
|
95
|
+
o && (this._ariaDescription = `Klikk for å fjerne ${o}`);
|
|
96
|
+
}
|
|
87
97
|
}
|
|
88
98
|
render() {
|
|
89
99
|
const s = {
|
|
@@ -91,7 +101,7 @@ let t = class extends d {
|
|
|
91
101
|
[`pkt-tag--${this.size}`]: !!this.size,
|
|
92
102
|
[`pkt-tag--${this.skin}`]: !!this.skin,
|
|
93
103
|
[`pkt-tag--${this.textStyle}`]: !!this.textStyle
|
|
94
|
-
},
|
|
104
|
+
}, i = {
|
|
95
105
|
"pkt-tag": !0,
|
|
96
106
|
"pkt-btn": !0,
|
|
97
107
|
"pkt-btn--tertiary": !0,
|
|
@@ -103,10 +113,11 @@ let t = class extends d {
|
|
|
103
113
|
};
|
|
104
114
|
return this.closeTag ? p`
|
|
105
115
|
<button
|
|
106
|
-
class=${h(
|
|
116
|
+
class=${h(i)}
|
|
107
117
|
type=${this.type}
|
|
108
|
-
aria-label=${this.ariaLabel}
|
|
109
118
|
@click=${this.close}
|
|
119
|
+
aria-label=${d(this.ariaLabel || void 0)}
|
|
120
|
+
aria-description=${d(this._ariaDescription || void 0)}
|
|
110
121
|
>
|
|
111
122
|
${this.iconName && p`<pkt-icon class="pkt-tag__icon" name=${this.iconName}></pkt-icon>`}
|
|
112
123
|
<span ${f(this.defaultSlot)}></span>
|
|
@@ -121,31 +132,34 @@ let t = class extends d {
|
|
|
121
132
|
}
|
|
122
133
|
};
|
|
123
134
|
e([
|
|
124
|
-
|
|
135
|
+
r({ type: Boolean, reflect: !0 })
|
|
125
136
|
], t.prototype, "closeTag", 2);
|
|
126
137
|
e([
|
|
127
|
-
|
|
138
|
+
r({ type: String, reflect: !0 })
|
|
128
139
|
], t.prototype, "size", 2);
|
|
129
140
|
e([
|
|
130
|
-
|
|
141
|
+
r({ type: String, reflect: !0 })
|
|
131
142
|
], t.prototype, "skin", 2);
|
|
132
143
|
e([
|
|
133
|
-
|
|
144
|
+
r({ type: String, reflect: !0 })
|
|
134
145
|
], t.prototype, "textStyle", 2);
|
|
135
146
|
e([
|
|
136
|
-
|
|
147
|
+
r({ type: String, reflect: !0 })
|
|
137
148
|
], t.prototype, "iconName", 2);
|
|
138
149
|
e([
|
|
139
|
-
|
|
150
|
+
r({ type: String })
|
|
140
151
|
], t.prototype, "type", 2);
|
|
141
152
|
e([
|
|
142
|
-
|
|
153
|
+
r({ type: String })
|
|
143
154
|
], t.prototype, "ariaLabel", 2);
|
|
144
155
|
e([
|
|
145
|
-
|
|
156
|
+
m()
|
|
146
157
|
], t.prototype, "_isClosed", 2);
|
|
158
|
+
e([
|
|
159
|
+
m()
|
|
160
|
+
], t.prototype, "_ariaDescription", 2);
|
|
147
161
|
t = e([
|
|
148
|
-
|
|
162
|
+
g("pkt-tag")
|
|
149
163
|
], t);
|
|
150
164
|
export {
|
|
151
165
|
t as P
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "12.31.
|
|
3
|
+
"version": "12.31.2",
|
|
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",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
58
58
|
},
|
|
59
59
|
"license": "MIT",
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "bb030d6ba98fa9e45a95cf3092d95b46a750a730"
|
|
61
61
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { classMap } from 'lit/directives/class-map.js'
|
|
2
2
|
import { customElement, property, state } from 'lit/decorators.js'
|
|
3
|
-
import { html } from 'lit'
|
|
3
|
+
import { html, PropertyValues } from 'lit'
|
|
4
4
|
import { PktElement } from '@/base-elements/element'
|
|
5
5
|
import { PktSlotController } from '@/controllers/pkt-slot-controller'
|
|
6
6
|
import { ref } from 'lit/directives/ref.js'
|
|
@@ -9,6 +9,9 @@ import { TPktSize } from '@/types/size'
|
|
|
9
9
|
import specs from 'componentSpecs/tag.json'
|
|
10
10
|
|
|
11
11
|
import '@/components/icon'
|
|
12
|
+
import { IAriaAttributes } from '@/types/aria'
|
|
13
|
+
import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon'
|
|
14
|
+
import { ifDefined } from 'lit/directives/if-defined.js'
|
|
12
15
|
|
|
13
16
|
export type TTagSkin =
|
|
14
17
|
| 'blue'
|
|
@@ -26,14 +29,14 @@ export interface IPktTag {
|
|
|
26
29
|
closeTag?: boolean
|
|
27
30
|
size?: TPktSize
|
|
28
31
|
skin?: TTagSkin
|
|
29
|
-
textStyle?: string
|
|
30
|
-
iconName?:
|
|
32
|
+
textStyle?: string | null
|
|
33
|
+
iconName?: PktIconName
|
|
31
34
|
type?: TTagType
|
|
32
|
-
ariaLabel?:
|
|
35
|
+
ariaLabel?: IAriaAttributes['aria-label'] | null
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
@customElement('pkt-tag')
|
|
36
|
-
export class PktTag extends PktElement {
|
|
39
|
+
export class PktTag extends PktElement implements IPktTag {
|
|
37
40
|
slotController: PktSlotController
|
|
38
41
|
defaultSlot: Ref<HTMLElement> = createRef()
|
|
39
42
|
|
|
@@ -52,12 +55,28 @@ export class PktTag extends PktElement {
|
|
|
52
55
|
@property({ type: String, reflect: true }) textStyle: string | null = null
|
|
53
56
|
@property({ type: String, reflect: true }) iconName: string | undefined = undefined
|
|
54
57
|
@property({ type: String }) type: TTagType = specs.props.type.default as TTagType
|
|
55
|
-
@property({ type: String }) ariaLabel: string =
|
|
58
|
+
@property({ type: String }) ariaLabel: string | null = null
|
|
56
59
|
|
|
57
60
|
/**
|
|
58
61
|
* Element state
|
|
59
62
|
*/
|
|
60
63
|
@state() _isClosed: boolean = false
|
|
64
|
+
@state() _ariaDescription: string | null = null
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Lifecycle
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
protected firstUpdated(_changedProperties: PropertyValues): void {
|
|
71
|
+
super.firstUpdated(_changedProperties)
|
|
72
|
+
|
|
73
|
+
if (this.closeTag && !this.ariaLabel) {
|
|
74
|
+
const label = this.defaultSlot.value?.textContent?.trim()
|
|
75
|
+
if (label) {
|
|
76
|
+
this._ariaDescription = `Klikk for å fjerne ${label}`
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
61
80
|
|
|
62
81
|
/**
|
|
63
82
|
* Element functions
|
|
@@ -97,8 +116,9 @@ export class PktTag extends PktElement {
|
|
|
97
116
|
<button
|
|
98
117
|
class=${classMap(btnClasses)}
|
|
99
118
|
type=${this.type}
|
|
100
|
-
aria-label=${this.ariaLabel}
|
|
101
119
|
@click=${this.close}
|
|
120
|
+
aria-label=${ifDefined(this.ariaLabel || undefined)}
|
|
121
|
+
aria-description=${ifDefined(this._ariaDescription || undefined)}
|
|
102
122
|
>
|
|
103
123
|
${this.iconName &&
|
|
104
124
|
html`<pkt-icon class="pkt-tag__icon" name=${this.iconName}></pkt-icon>`}
|
package/dist/tag-D6ARkq2Z.cjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";const u=require("./class-map-Dj5mbCUg.cjs"),t=require("./element-CzFXQBoS.cjs"),h=require("./state-HNj0_316.cjs"),g=require("./pkt-slot-controller-Oc32unDk.cjs"),c=require("./ref-2anvRHT4.cjs");require("./icon-BOKusjAA.cjs");const k="pkt-tag",d=!0,f={closeTag:{type:"boolean",required:!1,default:!1},size:{required:!1,default:"medium",type:["small","medium","large"]},iconName:{type:"icon",required:!1},skin:{required:!1,default:"blue",type:["blue","blue-light","blue-dark","green","red","beige","yellow","gray"]},textStyle:{required:!1,default:"normal-text",type:["thin-text","normal-text"]},type:{required:!1,default:"button",type:["button","submit","reset"]},ariaLabel:{type:"string",required:!1,default:"Lukk"}},y={default:{description:"Teksten til tag"}},l={name:k,"css-class":"pkt-tag",isElement:d,props:f,slots:y};var b=Object.defineProperty,m=Object.getOwnPropertyDescriptor,s=(o,e,a,r)=>{for(var i=r>1?void 0:r?m(e,a):e,n=o.length-1,p;n>=0;n--)(p=o[n])&&(i=(r?p(e,a,i):p(i))||i);return r&&i&&b(e,a,i),i};exports.PktTag=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.closeTag=l.props.closeTag.default,this.size=l.props.size.default,this.skin=l.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=l.props.type.default,this.ariaLabel=l.props.ariaLabel.default,this._isClosed=!1,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!0,composed:!0}))},this.slotController=new g.PktSlotController(this,this.defaultSlot),this._isClosed=!1}render(){const e={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},a={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName,"pkt-hide":this._isClosed};return this.closeTag?t.x`
|
|
2
|
-
<button
|
|
3
|
-
class=${u.e(a)}
|
|
4
|
-
type=${this.type}
|
|
5
|
-
aria-label=${this.ariaLabel}
|
|
6
|
-
@click=${this.close}
|
|
7
|
-
>
|
|
8
|
-
${this.iconName&&t.x`<pkt-icon class="pkt-tag__icon" name=${this.iconName}></pkt-icon>`}
|
|
9
|
-
<span ${c.n(this.defaultSlot)}></span>
|
|
10
|
-
<pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
|
|
11
|
-
</button>
|
|
12
|
-
`:t.x`
|
|
13
|
-
<span class=${u.e(e)}>
|
|
14
|
-
${this.iconName&&t.x`<pkt-icon class="pkt-tag__icon" name=${this.iconName}></pkt-icon>`}
|
|
15
|
-
<span ${c.n(this.defaultSlot)}></span>
|
|
16
|
-
</span>
|
|
17
|
-
`}};s([t.n({type:Boolean,reflect:!0})],exports.PktTag.prototype,"closeTag",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"size",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"skin",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"textStyle",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"iconName",2);s([t.n({type:String})],exports.PktTag.prototype,"type",2);s([t.n({type:String})],exports.PktTag.prototype,"ariaLabel",2);s([h.r()],exports.PktTag.prototype,"_isClosed",2);exports.PktTag=s([t.t("pkt-tag")],exports.PktTag);
|