@oslokommune/punkt-elements 18.4.0 → 18.5.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/CHANGELOG.md +25 -0
- package/dist/{accordion-4eAsO-Sr.js → accordion-D814csFx.js} +6 -6
- package/dist/{accordion-DOa5vubf.cjs → accordion-E0-pLzBq.cjs} +6 -6
- package/dist/{alert-BUpd4yWu.js → alert-DNZtr3gd.js} +39 -31
- package/dist/alert-DqM9l5as.cjs +40 -0
- package/dist/{backlink-CA5R69FX.cjs → backlink-DYO8qA9C.cjs} +1 -1
- package/dist/{button-Dk6ued7E.js → button-Drwt7Qe5.js} +28 -25
- package/dist/button-jJfzE9C7.cjs +32 -0
- package/dist/{card-DgRvtnnk.js → card-BhmJZOGh.js} +90 -70
- package/dist/card-D-1JMn_h.cjs +64 -0
- package/dist/{combobox-DuTrCV1l.js → combobox-BNstYIC5.js} +20 -20
- package/dist/{combobox-DQ0yPhEy.cjs → combobox-CRdBlMz1.cjs} +17 -17
- package/dist/components/alert/alert.d.ts +2 -0
- package/dist/components/card/card.d.ts +12 -3
- package/dist/components/linkcard/linkcard.d.ts +1 -1
- package/dist/components/loader/loader.d.ts +2 -2
- package/dist/components/messagebox/messagebox.d.ts +1 -1
- package/dist/components/progressbar/progressbar.d.ts +2 -6
- package/dist/{consent-agJtEZHc.cjs → consent-DaOFbopy.cjs} +1 -1
- package/dist/{consent-yXeRsyAl.js → consent-Yvw7gZI_.js} +1 -1
- package/dist/{datepicker-CYndy_BG.cjs → datepicker-DjvL_Nb8.cjs} +16 -16
- package/dist/{datepicker-C7KtgfDs.js → datepicker-DzTdWHkX.js} +3 -3
- package/dist/{fileupload-BcJSBp9e.js → fileupload-B8Uhfx2d.js} +24 -24
- package/dist/{fileupload-CmxozEde.cjs → fileupload-BJVYPl8u.cjs} +15 -15
- package/dist/{footer-J-fOEOj5.cjs → footer-BGC5PkLa.cjs} +1 -1
- package/dist/{footer-DSrWdWxm.js → footer-BPxKLaut.js} +2 -2
- package/dist/{header-EtPWdXaI.js → header-BPzlBRhY.js} +30 -30
- package/dist/{header-DmJiygel.cjs → header-CAqegPzW.cjs} +34 -34
- package/dist/{header-menu-DpQbRKcm.cjs → header-menu-DBy7Yrd_.cjs} +1 -1
- package/dist/{header-menu-Dgem4HO9.js → header-menu-DWiPoQ58.js} +1 -1
- package/dist/{helptext-Ds8Q9IGV.cjs → helptext-BwDhf6VB.cjs} +2 -2
- package/dist/{helptext-BzLJKMMO.js → helptext-mf-67-fv.js} +2 -2
- package/dist/{input-wrapper-DZhzHSxD.js → input-wrapper-BetB7OLQ.js} +16 -15
- package/dist/{input-wrapper-B9wREHHW.cjs → input-wrapper-CS0qrYcm.cjs} +8 -7
- package/dist/{link-CpwR3BLX.cjs → link-DXnoMJIo.cjs} +3 -3
- package/dist/{link-C9xAIILf.js → link-DkO7a3Fs.js} +3 -3
- package/dist/{linkcard-Bzv3CEw5.cjs → linkcard-2l6z1M2U.cjs} +3 -3
- package/dist/{linkcard-C6ljKc0B.js → linkcard-aVKL5JPP.js} +8 -8
- package/dist/{loader-D6dau_7w.js → loader-CRVUJ-HU.js} +1 -1
- package/dist/{loader-Bv-1vwju.cjs → loader-D23kzlaR.cjs} +1 -1
- package/dist/{messagebox-CmhjIh0n.js → messagebox-CqI6_Ah7.js} +2 -2
- package/dist/{messagebox-DNUfv2FN.cjs → messagebox-DP06cyqc.cjs} +1 -1
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +1 -1
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-fileupload.cjs +1 -1
- package/dist/pkt-fileupload.js +1 -1
- package/dist/pkt-footer.cjs +1 -1
- package/dist/pkt-footer.js +1 -1
- package/dist/pkt-header-menu.cjs +1 -1
- package/dist/pkt-header-menu.js +1 -1
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +31 -31
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -1
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +1 -1
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-searchinput.cjs +1 -1
- package/dist/pkt-searchinput.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +1 -1
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/pkt-timepicker.cjs +1 -1
- package/dist/pkt-timepicker.js +1 -1
- package/dist/progressbar-BPHLC7ce.js +117 -0
- package/dist/progressbar-BpcsDCnG.cjs +31 -0
- package/dist/{radiobutton-B_j_nYCC.js → radiobutton-B2e9Vyp8.js} +0 -1
- package/dist/{radiobutton-DsL-FNDd.cjs → radiobutton-C3nmL9rA.cjs} +0 -1
- package/dist/{searchinput-Dm3T0tGS.cjs → searchinput-CiPB8xvh.cjs} +3 -2
- package/dist/{searchinput-D7Dd2W2z.js → searchinput-DrUcPajl.js} +14 -12
- package/dist/{select-CIGYIrl3.js → select-B7TvZGIL.js} +15 -16
- package/dist/{select-DA5ZBqbg.cjs → select-qxjHJ8bu.cjs} +13 -14
- package/dist/{tabs-DPdDkHSk.js → tabs-C_tCCdBK.js} +18 -18
- package/dist/{tabs-nvIpMwHK.cjs → tabs-DBanbSG1.cjs} +15 -15
- package/dist/tag-BDlwKjgT.cjs +27 -0
- package/dist/{tag-DBCzfbPE.js → tag-CdiDs9zb.js} +10 -10
- package/dist/{textarea-CST8hYg2.cjs → textarea-DgFwd2LY.cjs} +10 -10
- package/dist/{textarea-BqK3V7uZ.js → textarea-YL6JYsB5.js} +14 -14
- package/dist/{textinput-DByVORsj.cjs → textinput-CIxMtaIo.cjs} +10 -10
- package/dist/{textinput-B3xYwLt3.js → textinput-CrJYDOHb.js} +12 -12
- package/dist/{timepicker-DZwmwpWM.js → timepicker-BHWOqlr8.js} +11 -11
- package/dist/{timepicker-Boj-9I40.cjs → timepicker-avaMu1hN.cjs} +8 -8
- package/package.json +2 -2
- package/src/components/accordion/accordion.ts +2 -1
- package/src/components/alert/alert.test.ts +2 -1
- package/src/components/alert/alert.ts +21 -3
- package/src/components/button/button.test.ts +0 -2
- package/src/components/button/button.ts +32 -23
- package/src/components/card/card.test.ts +7 -7
- package/src/components/card/card.ts +99 -80
- package/src/components/helptext/helptext.ts +2 -2
- package/src/components/input-wrapper/input-wrapper.ts +1 -0
- package/src/components/link/link.ts +4 -2
- package/src/components/linkcard/linkcard.test.ts +3 -3
- package/src/components/linkcard/linkcard.ts +1 -1
- package/src/components/loader/loader.test.ts +1 -1
- package/src/components/loader/loader.ts +3 -3
- package/src/components/messagebox/messagebox.test.ts +1 -1
- package/src/components/messagebox/messagebox.ts +2 -2
- package/src/components/progressbar/progressbar.test.ts +10 -8
- package/src/components/progressbar/progressbar.ts +63 -84
- package/src/components/radiobutton/radiobutton.ts +0 -1
- package/src/components/searchinput/searchinput.ts +3 -1
- package/src/components/select/select.test.ts +2 -1
- package/src/components/select/select.ts +0 -1
- package/dist/alert-BYDWYgyL.cjs +0 -35
- package/dist/button-C5BYwmoo.cjs +0 -30
- package/dist/card-DMKvuvNv.cjs +0 -87
- package/dist/progressbar-Bk_RsEjW.js +0 -112
- package/dist/progressbar-T5_MpZGN.cjs +0 -17
- package/dist/tag-Bp9gJnYh.cjs +0 -27
- package/dist/{backlink-BYUtL8cO.js → backlink-BHtxOlTw.js} +1 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { _ as e, d as t, f as n, g as r, h as i, l as a, m as o, n as s, p as c, t as l, u } from "./element-e2MAMNEP.js";
|
|
2
|
+
import { t as d } from "./class-map-BL_YL_Ed.js";
|
|
3
|
+
import { t as f } from "./if-defined-r8tKY4tG.js";
|
|
4
|
+
import "./icon-jEFbKTB_.js";
|
|
5
|
+
import { n as p, t as m } from "./ref-lE1mGUOL.js";
|
|
6
|
+
import { n as h } from "./utils-BwF4QSrq.js";
|
|
7
|
+
//#region ../../node_modules/lit-html/directives/style-map.js
|
|
8
|
+
var g = "important", _ = " !" + g, v = n(class extends c {
|
|
9
|
+
constructor(e) {
|
|
10
|
+
if (super(e), e.type !== o.ATTRIBUTE || e.name !== "style" || e.strings?.length > 2) throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
|
|
11
|
+
}
|
|
12
|
+
render(e) {
|
|
13
|
+
return Object.keys(e).reduce((t, n) => {
|
|
14
|
+
let r = e[n];
|
|
15
|
+
return r == null ? t : t + `${n = n.includes("-") ? n : n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${r};`;
|
|
16
|
+
}, "");
|
|
17
|
+
}
|
|
18
|
+
update(e, [t]) {
|
|
19
|
+
let { style: n } = e.element;
|
|
20
|
+
if (this.ft === void 0) return this.ft = new Set(Object.keys(t)), this.render(t);
|
|
21
|
+
for (let e of this.ft) t[e] ?? (this.ft.delete(e), e.includes("-") ? n.removeProperty(e) : n[e] = null);
|
|
22
|
+
for (let e in t) {
|
|
23
|
+
let r = t[e];
|
|
24
|
+
if (r != null) {
|
|
25
|
+
this.ft.add(e);
|
|
26
|
+
let t = typeof r == "string" && r.endsWith(_);
|
|
27
|
+
e.includes("-") || t ? n.setProperty(e, t ? r.slice(0, -11) : r, t ? g : "") : n[e] = r;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return r;
|
|
31
|
+
}
|
|
32
|
+
}), y = class extends l {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(), this.ariaLabel = null, this.ariaLabelledby = null, this.ariaValueText = null, this.ariaLive = "polite", this.id = h(), this.role = "progressbar", this.skin = "dark-blue", this.statusPlacement = "following", this.statusType = "none", this.title = "", this.titlePosition = "left", this.valueCurrent = 0, this.valueMax = 100, this.valueMin = 0, this.labelWidth = 0, this.progressbarId = this.id, this.resolvedRole = "progressbar", this.labelRef = m(), this.progressBarRef = m();
|
|
35
|
+
}
|
|
36
|
+
willUpdate(e) {
|
|
37
|
+
super.willUpdate(e), this.hasAttribute("id") ? (this.progressbarId = this.getAttribute("id") || this.progressbarId, this.removeAttribute("id")) : this.id && (this.progressbarId = this.id);
|
|
38
|
+
let t = this.getAttribute("role");
|
|
39
|
+
t ? (this.resolvedRole = t, this.removeAttribute("role")) : this.role && (this.resolvedRole = this.role);
|
|
40
|
+
}
|
|
41
|
+
updated(e) {
|
|
42
|
+
super.updated(e), e.has("valueCurrent") && this.labelRef.value && (this.labelWidth = this.labelRef.value.getBoundingClientRect().width || 0);
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
let t = this.statusType !== "none", n = this.valueMax - this.valueMin, r = this.valueCurrent / n * 100, a = this.statusType === "fraction" ? Math.round(r) : Math.round((this.valueCurrent - this.valueMin) / (this.valueMax - this.valueMin) * 100), o = `${this.valueCurrent} av ${n}`, s = this.statusType === "fraction" && !this.ariaValueText ? `${this.valueCurrent} av ${this.valueMax - this.valueMin}` : this.ariaValueText || "", c = this.ariaLabel ? void 0 : this.ariaLabelledby || `${this.progressbarId}-title`, l = d({
|
|
46
|
+
"pkt-progressbar__bar": !0,
|
|
47
|
+
[`pkt-progressbar__bar--${this.skin}`]: !!this.skin
|
|
48
|
+
}), u = d({
|
|
49
|
+
"pkt-progressbar__title": !0,
|
|
50
|
+
"pkt-progressbar__title-center": this.titlePosition === "center"
|
|
51
|
+
}), m = d({
|
|
52
|
+
"pkt-progressbar__status": !0,
|
|
53
|
+
"pkt-progressbar__status--center": this.statusPlacement === "center"
|
|
54
|
+
}), h = d({
|
|
55
|
+
"pkt-progressbar__status-placement--following": this.statusPlacement === "following",
|
|
56
|
+
"pkt-progressbar__status-placement--center": this.statusPlacement === "center",
|
|
57
|
+
"pkt-progressbar__status-placement--left": this.statusPlacement === "left"
|
|
58
|
+
});
|
|
59
|
+
return e`<div
|
|
60
|
+
${p(this.progressBarRef)}
|
|
61
|
+
id=${this.progressbarId}
|
|
62
|
+
role=${this.resolvedRole}
|
|
63
|
+
aria-live=${f(this.ariaLive || void 0)}
|
|
64
|
+
aria-atomic="true"
|
|
65
|
+
aria-valuenow=${this.valueCurrent}
|
|
66
|
+
aria-valuemin=${this.valueMin}
|
|
67
|
+
aria-valuemax=${this.valueMax}
|
|
68
|
+
aria-valuetext=${f(s || void 0)}
|
|
69
|
+
aria-label=${f(this.ariaLabel || void 0)}
|
|
70
|
+
aria-labelledby=${f(c)}
|
|
71
|
+
class="pkt-progressbar"
|
|
72
|
+
>
|
|
73
|
+
<div
|
|
74
|
+
class="pkt-progressbar__container"
|
|
75
|
+
style=${v({
|
|
76
|
+
"--pkt-progress-label-width": `${this.labelWidth}px`,
|
|
77
|
+
"--pkt-progress-width": `${a}%`
|
|
78
|
+
})}
|
|
79
|
+
>
|
|
80
|
+
${this.title ? e`<p id=${`${this.progressbarId}-title`} class=${u}>${this.title}</p>` : i}
|
|
81
|
+
|
|
82
|
+
<div class="pkt-progressbar__bar-wrapper">
|
|
83
|
+
<div class=${l}></div>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
${t ? e`<div class=${m}>
|
|
87
|
+
<span class=${h} ${p(this.labelRef)}>
|
|
88
|
+
${this.statusType === "percentage" ? `${a}%` : o}
|
|
89
|
+
</span>
|
|
90
|
+
</div>` : i}
|
|
91
|
+
</div>
|
|
92
|
+
</div>`;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
s([u({ type: String })], y.prototype, "ariaLabel", void 0), s([u({
|
|
96
|
+
type: String,
|
|
97
|
+
reflect: !0
|
|
98
|
+
})], y.prototype, "ariaLabelledby", void 0), s([u({
|
|
99
|
+
type: String,
|
|
100
|
+
reflect: !0
|
|
101
|
+
})], y.prototype, "ariaValueText", void 0), s([u({ type: String })], y.prototype, "ariaLive", void 0), s([u({ type: String })], y.prototype, "id", void 0), s([u({ type: String })], y.prototype, "role", void 0), s([u({ type: String })], y.prototype, "skin", void 0), s([u({ type: String })], y.prototype, "statusPlacement", void 0), s([u({ type: String })], y.prototype, "statusType", void 0), s([u({
|
|
102
|
+
type: String,
|
|
103
|
+
reflect: !0
|
|
104
|
+
})], y.prototype, "title", void 0), s([u({ type: String })], y.prototype, "titlePosition", void 0), s([u({
|
|
105
|
+
type: Number,
|
|
106
|
+
reflect: !0
|
|
107
|
+
})], y.prototype, "valueCurrent", void 0), s([u({ type: Number })], y.prototype, "valueMax", void 0), s([u({ type: Number })], y.prototype, "valueMin", void 0), s([a()], y.prototype, "labelWidth", void 0), s([a()], y.prototype, "progressbarId", void 0), s([a()], y.prototype, "resolvedRole", void 0);
|
|
108
|
+
try {
|
|
109
|
+
t("pkt-progressbar")(y);
|
|
110
|
+
} catch {
|
|
111
|
+
console.warn("Forsøker å definere <pkt-progressbar>, men den er allerede definert");
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/components/progressbar/index.ts
|
|
115
|
+
var b = y;
|
|
116
|
+
//#endregion
|
|
117
|
+
export { y as n, b as t };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const e=require("./element-DRc10X2R.cjs"),t=require("./class-map-BEib48YL.cjs"),n=require("./if-defined-BeVQnl3C.cjs");require("./icon-DBFTFd-J.cjs");const r=require("./ref-BkV4Cd8U.cjs"),i=require("./utils-63cRpWut.cjs");var a=`important`,o=` !`+a,s=e.f(class extends e.p{constructor(t){if(super(t),t.type!==e.m.ATTRIBUTE||t.name!==`style`||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return r==null?t:t+`${n=n.includes(`-`)?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,`-$&`).toLowerCase()}:${r};`},``)}update(t,[n]){let{style:r}=t.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(n)),this.render(n);for(let e of this.ft)n[e]??(this.ft.delete(e),e.includes(`-`)?r.removeProperty(e):r[e]=null);for(let e in n){let t=n[e];if(t!=null){this.ft.add(e);let n=typeof t==`string`&&t.endsWith(o);e.includes(`-`)||n?r.setProperty(e,n?t.slice(0,-11):t,n?a:``):r[e]=t}}return e.g}}),c=class extends e.t{constructor(){super(),this.ariaLabel=null,this.ariaLabelledby=null,this.ariaValueText=null,this.ariaLive=`polite`,this.id=i.n(),this.role=`progressbar`,this.skin=`dark-blue`,this.statusPlacement=`following`,this.statusType=`none`,this.title=``,this.titlePosition=`left`,this.valueCurrent=0,this.valueMax=100,this.valueMin=0,this.labelWidth=0,this.progressbarId=this.id,this.resolvedRole=`progressbar`,this.labelRef=r.t(),this.progressBarRef=r.t()}willUpdate(e){super.willUpdate(e),this.hasAttribute(`id`)?(this.progressbarId=this.getAttribute(`id`)||this.progressbarId,this.removeAttribute(`id`)):this.id&&(this.progressbarId=this.id);let t=this.getAttribute(`role`);t?(this.resolvedRole=t,this.removeAttribute(`role`)):this.role&&(this.resolvedRole=this.role)}updated(e){super.updated(e),e.has(`valueCurrent`)&&this.labelRef.value&&(this.labelWidth=this.labelRef.value.getBoundingClientRect().width||0)}render(){let i=this.statusType!==`none`,a=this.valueMax-this.valueMin,o=this.valueCurrent/a*100,c=this.statusType===`fraction`?Math.round(o):Math.round((this.valueCurrent-this.valueMin)/(this.valueMax-this.valueMin)*100),l=`${this.valueCurrent} av ${a}`,u=this.statusType===`fraction`&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||``,d=this.ariaLabel?void 0:this.ariaLabelledby||`${this.progressbarId}-title`,f=t.t({"pkt-progressbar__bar":!0,[`pkt-progressbar__bar--${this.skin}`]:!!this.skin}),p=t.t({"pkt-progressbar__title":!0,"pkt-progressbar__title-center":this.titlePosition===`center`}),m=t.t({"pkt-progressbar__status":!0,"pkt-progressbar__status--center":this.statusPlacement===`center`}),h=t.t({"pkt-progressbar__status-placement--following":this.statusPlacement===`following`,"pkt-progressbar__status-placement--center":this.statusPlacement===`center`,"pkt-progressbar__status-placement--left":this.statusPlacement===`left`});return e._`<div
|
|
2
|
+
${r.n(this.progressBarRef)}
|
|
3
|
+
id=${this.progressbarId}
|
|
4
|
+
role=${this.resolvedRole}
|
|
5
|
+
aria-live=${n.t(this.ariaLive||void 0)}
|
|
6
|
+
aria-atomic="true"
|
|
7
|
+
aria-valuenow=${this.valueCurrent}
|
|
8
|
+
aria-valuemin=${this.valueMin}
|
|
9
|
+
aria-valuemax=${this.valueMax}
|
|
10
|
+
aria-valuetext=${n.t(u||void 0)}
|
|
11
|
+
aria-label=${n.t(this.ariaLabel||void 0)}
|
|
12
|
+
aria-labelledby=${n.t(d)}
|
|
13
|
+
class="pkt-progressbar"
|
|
14
|
+
>
|
|
15
|
+
<div
|
|
16
|
+
class="pkt-progressbar__container"
|
|
17
|
+
style=${s({"--pkt-progress-label-width":`${this.labelWidth}px`,"--pkt-progress-width":`${c}%`})}
|
|
18
|
+
>
|
|
19
|
+
${this.title?e._`<p id=${`${this.progressbarId}-title`} class=${p}>${this.title}</p>`:e.h}
|
|
20
|
+
|
|
21
|
+
<div class="pkt-progressbar__bar-wrapper">
|
|
22
|
+
<div class=${f}></div>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
${i?e._`<div class=${m}>
|
|
26
|
+
<span class=${h} ${r.n(this.labelRef)}>
|
|
27
|
+
${this.statusType===`percentage`?`${c}%`:l}
|
|
28
|
+
</span>
|
|
29
|
+
</div>`:e.h}
|
|
30
|
+
</div>
|
|
31
|
+
</div>`}};e.n([e.u({type:String})],c.prototype,`ariaLabel`,void 0),e.n([e.u({type:String,reflect:!0})],c.prototype,`ariaLabelledby`,void 0),e.n([e.u({type:String,reflect:!0})],c.prototype,`ariaValueText`,void 0),e.n([e.u({type:String})],c.prototype,`ariaLive`,void 0),e.n([e.u({type:String})],c.prototype,`id`,void 0),e.n([e.u({type:String})],c.prototype,`role`,void 0),e.n([e.u({type:String})],c.prototype,`skin`,void 0),e.n([e.u({type:String})],c.prototype,`statusPlacement`,void 0),e.n([e.u({type:String})],c.prototype,`statusType`,void 0),e.n([e.u({type:String,reflect:!0})],c.prototype,`title`,void 0),e.n([e.u({type:String})],c.prototype,`titlePosition`,void 0),e.n([e.u({type:Number,reflect:!0})],c.prototype,`valueCurrent`,void 0),e.n([e.u({type:Number})],c.prototype,`valueMax`,void 0),e.n([e.u({type:Number})],c.prototype,`valueMin`,void 0),e.n([e.l()],c.prototype,`labelWidth`,void 0),e.n([e.l()],c.prototype,`progressbarId`,void 0),e.n([e.l()],c.prototype,`resolvedRole`,void 0);try{e.d(`pkt-progressbar`)(c)}catch{console.warn(`Forsøker å definere <pkt-progressbar>, men den er allerede definert`)}var l=c;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-DRc10X2R.cjs"),t=require("./class-map-BEib48YL.cjs");require("./icon-DBFTFd-J.cjs");const
|
|
1
|
+
const e=require("./element-DRc10X2R.cjs"),t=require("./class-map-BEib48YL.cjs"),n=require("./if-defined-BeVQnl3C.cjs");require("./icon-DBFTFd-J.cjs");const r=require("./utils-63cRpWut.cjs"),i=require("./focus-modality-controller-C1ocyv2J.cjs");var a=class extends e.t{constructor(...e){super(...e),this.appearance=`local`,this.inputSize=`medium`,this.disabled=!1,this.fullwidth=!1,this.id=r.n(),this.value=``,this.focusModality=new i.t(this,`.pkt-searchinput`)}willUpdate(e){super.willUpdate(e);let t=this.getAttribute(`aria-label`);t&&(this.inputAriaLabel=t,this.removeAttribute(`aria-label`))}get suggestionsId(){return`${this.id}-suggestions`}dispatchSearch(){this.dispatchEvent(new CustomEvent(`pkt-search`,{detail:{value:this.value},bubbles:!0,composed:!0}))}onInput(e){let t=e.target;this.value=t.value}onInputKeydown(e){e.key===`Enter`&&(this.action||e.preventDefault(),this.dispatchSearch())}onSearchClick(e){this.action||e.preventDefault(),this.dispatchSearch()}onSuggestionClick(e,t,n){let r=new CustomEvent(`pkt-suggestion-click`,{detail:{index:n,suggestion:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(r)||e.preventDefault()}renderSuggestion(t,n){let r=e._`
|
|
2
2
|
${t.title?e._`<h3 class="pkt-searchinput__suggestion-title">${t.title}</h3>`:e.h}
|
|
3
3
|
${t.text?e._`<p class="pkt-searchinput__suggestion-text">${t.text}</p>`:e.h}
|
|
4
4
|
`;return t.href?e._`<a
|
|
@@ -24,6 +24,7 @@ const e=require("./element-DRc10X2R.cjs"),t=require("./class-map-BEib48YL.cjs");
|
|
|
24
24
|
name=${this.name||this.id}
|
|
25
25
|
id=${this.id}
|
|
26
26
|
placeholder=${this.placeholder||r.placeholder}
|
|
27
|
+
value=${this.value}
|
|
27
28
|
.value=${this.value}
|
|
28
29
|
?disabled=${this.disabled}
|
|
29
30
|
autocomplete="off"
|
|
@@ -57,4 +58,4 @@ const e=require("./element-DRc10X2R.cjs"),t=require("./class-map-BEib48YL.cjs");
|
|
|
57
58
|
method=${n.t(this.method)}
|
|
58
59
|
>
|
|
59
60
|
${c}
|
|
60
|
-
</form>`:e._`<div role="search" class=${i}>${c}</div>`}};e.n([e.u({type:String})],
|
|
61
|
+
</form>`:e._`<div role="search" class=${i}>${c}</div>`}};e.n([e.u({type:String})],a.prototype,`appearance`,void 0),e.n([e.u({type:String,attribute:`input-size`})],a.prototype,`inputSize`,void 0),e.n([e.u({type:Boolean,reflect:!0})],a.prototype,`disabled`,void 0),e.n([e.u({type:Boolean,reflect:!0})],a.prototype,`fullwidth`,void 0),e.n([e.u({type:String,reflect:!0})],a.prototype,`id`,void 0),e.n([e.u({type:String})],a.prototype,`label`,void 0),e.n([e.u({type:String})],a.prototype,`name`,void 0),e.n([e.u({type:String})],a.prototype,`placeholder`,void 0),e.n([e.u({type:String})],a.prototype,`value`,void 0),e.n([e.u({type:Array})],a.prototype,`suggestions`,void 0),e.n([e.u({type:String})],a.prototype,`action`,void 0),e.n([e.u({type:String})],a.prototype,`method`,void 0),e.n([e.l()],a.prototype,`inputAriaLabel`,void 0);try{e.d(`pkt-searchinput`)(a)}catch{console.warn(`Forsøker å definere <pkt-searchinput>, men den er allerede definert`)}var o=a;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { _ as e, d as t, h as n, l as r, n as i, t as a, u as o } from "./element-e2MAMNEP.js";
|
|
2
2
|
import { t as s } from "./class-map-BL_YL_Ed.js";
|
|
3
|
-
import "./icon-jEFbKTB_.js";
|
|
4
3
|
import { t as c } from "./if-defined-r8tKY4tG.js";
|
|
5
|
-
import
|
|
4
|
+
import "./icon-jEFbKTB_.js";
|
|
5
|
+
import { n as l } from "./utils-BwF4QSrq.js";
|
|
6
|
+
import { t as u } from "./focus-modality-controller-Dc2S-KqR.js";
|
|
6
7
|
//#region src/components/searchinput/searchinput.ts
|
|
7
|
-
var
|
|
8
|
+
var d = class extends a {
|
|
8
9
|
constructor(...e) {
|
|
9
|
-
super(...e), this.appearance = "local", this.inputSize = "medium", this.disabled = !1, this.fullwidth = !1, this.id =
|
|
10
|
+
super(...e), this.appearance = "local", this.inputSize = "medium", this.disabled = !1, this.fullwidth = !1, this.id = l(), this.value = "", this.focusModality = new u(this, ".pkt-searchinput");
|
|
10
11
|
}
|
|
11
12
|
willUpdate(e) {
|
|
12
13
|
super.willUpdate(e);
|
|
@@ -94,6 +95,7 @@ var u = class extends a {
|
|
|
94
95
|
name=${this.name || this.id}
|
|
95
96
|
id=${this.id}
|
|
96
97
|
placeholder=${this.placeholder || t.placeholder}
|
|
98
|
+
value=${this.value}
|
|
97
99
|
.value=${this.value}
|
|
98
100
|
?disabled=${this.disabled}
|
|
99
101
|
autocomplete="off"
|
|
@@ -131,26 +133,26 @@ var u = class extends a {
|
|
|
131
133
|
</form>` : e`<div role="search" class=${r}>${l}</div>`;
|
|
132
134
|
}
|
|
133
135
|
};
|
|
134
|
-
i([o({ type: String })],
|
|
136
|
+
i([o({ type: String })], d.prototype, "appearance", void 0), i([o({
|
|
135
137
|
type: String,
|
|
136
138
|
attribute: "input-size"
|
|
137
|
-
})],
|
|
139
|
+
})], d.prototype, "inputSize", void 0), i([o({
|
|
138
140
|
type: Boolean,
|
|
139
141
|
reflect: !0
|
|
140
|
-
})],
|
|
142
|
+
})], d.prototype, "disabled", void 0), i([o({
|
|
141
143
|
type: Boolean,
|
|
142
144
|
reflect: !0
|
|
143
|
-
})],
|
|
145
|
+
})], d.prototype, "fullwidth", void 0), i([o({
|
|
144
146
|
type: String,
|
|
145
147
|
reflect: !0
|
|
146
|
-
})],
|
|
148
|
+
})], d.prototype, "id", void 0), i([o({ type: String })], d.prototype, "label", void 0), i([o({ type: String })], d.prototype, "name", void 0), i([o({ type: String })], d.prototype, "placeholder", void 0), i([o({ type: String })], d.prototype, "value", void 0), i([o({ type: Array })], d.prototype, "suggestions", void 0), i([o({ type: String })], d.prototype, "action", void 0), i([o({ type: String })], d.prototype, "method", void 0), i([r()], d.prototype, "inputAriaLabel", void 0);
|
|
147
149
|
try {
|
|
148
|
-
t("pkt-searchinput")(
|
|
150
|
+
t("pkt-searchinput")(d);
|
|
149
151
|
} catch {
|
|
150
152
|
console.warn("Forsøker å definere <pkt-searchinput>, men den er allerede definert");
|
|
151
153
|
}
|
|
152
154
|
//#endregion
|
|
153
155
|
//#region src/components/searchinput/index.ts
|
|
154
|
-
var
|
|
156
|
+
var f = d;
|
|
155
157
|
//#endregion
|
|
156
|
-
export {
|
|
158
|
+
export { d as n, f as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { _ as e, d as t, l as n, n as r, u as i } from "./element-e2MAMNEP.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { t as a } from "./if-defined-r8tKY4tG.js";
|
|
3
|
+
import { n as o } from "./element-with-slot-COOwQUxM.js";
|
|
4
4
|
import { n as s, t as c } from "./ref-lE1mGUOL.js";
|
|
5
5
|
import { t as l } from "./input-element-DxHRTZ3K.js";
|
|
6
6
|
import { t as u } from "./pkt-options-controller-DNDUGQno.js";
|
|
7
|
-
import { r as d } from "./input-wrapper-
|
|
7
|
+
import { r as d } from "./input-wrapper-BetB7OLQ.js";
|
|
8
8
|
//#region src/base-elements/options-input-element.ts
|
|
9
9
|
var f = class extends l {
|
|
10
10
|
constructor(...e) {
|
|
@@ -101,31 +101,30 @@ var p = class extends f {
|
|
|
101
101
|
?requiredTag=${this.requiredTag}
|
|
102
102
|
useWrapper=${this.useWrapper}
|
|
103
103
|
.ariaDescribedby=${this.ariaDescribedby}
|
|
104
|
-
errorMessage=${
|
|
104
|
+
errorMessage=${a(this.errorMessage)}
|
|
105
105
|
forId=${this.id + "-input"}
|
|
106
|
-
helptext=${
|
|
107
|
-
helptextDropdown=${
|
|
108
|
-
helptextDropdownButton=${
|
|
109
|
-
label=${
|
|
110
|
-
optionalText=${
|
|
111
|
-
requiredText=${
|
|
112
|
-
tagText=${
|
|
106
|
+
helptext=${a(this.helptext)}
|
|
107
|
+
helptextDropdown=${a(this.helptextDropdown)}
|
|
108
|
+
helptextDropdownButton=${a(this.helptextDropdownButton)}
|
|
109
|
+
label=${a(this.label)}
|
|
110
|
+
optionalText=${a(this.optionalText)}
|
|
111
|
+
requiredText=${a(this.requiredText)}
|
|
112
|
+
tagText=${a(this.tagText)}
|
|
113
113
|
>
|
|
114
114
|
<select
|
|
115
115
|
class=${t}
|
|
116
116
|
aria-invalid=${this.hasError}
|
|
117
|
-
aria-errormessage=${
|
|
118
|
-
aria-describedby=${
|
|
117
|
+
aria-errormessage=${a(this.hasError ? `${this.id}-input-error` : void 0)}
|
|
118
|
+
aria-describedby=${a(d({
|
|
119
119
|
id: this.id + "-input",
|
|
120
120
|
hasHelptext: !!this.helptext,
|
|
121
121
|
hasCounter: !1,
|
|
122
122
|
ariaDescribedby: this.ariaDescribedby
|
|
123
123
|
}))}
|
|
124
|
-
aria-labelledby=${
|
|
124
|
+
aria-labelledby=${a(this.ariaLabelledby)}
|
|
125
125
|
?disabled=${this.disabled}
|
|
126
126
|
id=${this.id + "-input"}
|
|
127
127
|
name=${(this.name || this.id) + "-input"}
|
|
128
|
-
value=${this.value}
|
|
129
128
|
@change=${(e) => {
|
|
130
129
|
this.touched = !0, this.value = e.target.value, e.stopImmediatePropagation();
|
|
131
130
|
}}
|
|
@@ -149,7 +148,7 @@ var p = class extends f {
|
|
|
149
148
|
${t.label}
|
|
150
149
|
</option>`) : ""}
|
|
151
150
|
</select>
|
|
152
|
-
<div class="pkt-contents" slot="helptext">${
|
|
151
|
+
<div class="pkt-contents" slot="helptext">${o(this, "helptext")}</div>
|
|
153
152
|
</pkt-input-wrapper>
|
|
154
153
|
`;
|
|
155
154
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-DRc10X2R.cjs"),t=require("./
|
|
1
|
+
const e=require("./element-DRc10X2R.cjs"),t=require("./if-defined-BeVQnl3C.cjs"),n=require("./element-with-slot-MkibfzHp.cjs"),r=require("./ref-BkV4Cd8U.cjs"),i=require("./input-element-KpXXnGi0.cjs"),a=require("./pkt-options-controller-CJPuBqvH.cjs"),o=require("./input-wrapper-CS0qrYcm.cjs");var s=class extends i.t{constructor(...e){super(...e),this._optionsProp=[],this._options=[]}get options(){return this._options.map(e=>({...e,selected:this.isOptionSelected(e)}))}set options(e){this._optionsProp=e,this.requestUpdate(`_optionsProp`,this._options)}isOptionSelected(e){return Array.isArray(this.value)?this.value.includes(e.value):e.value===this.value}findOptionByValue(e){return this._options.find(t=>t.value===e)}getSelectedOptions(){return this._options.filter(e=>this.isOptionSelected(e))}parseOptions(){let e=this._optionsProp.length>0,t=this.optionsController?.nodes?.length&&this.optionsController.nodes.length>0;e?this._options=this._optionsProp:t&&(this._options=this.optionsController.options)}willUpdate(e){super.willUpdate(e),this.parseOptions()}};e.n([e.u({type:Array,attribute:`options`})],s.prototype,`_optionsProp`,void 0),e.n([e.l()],s.prototype,`_options`,void 0);var c=class extends s{constructor(){super(),this.inputRef=r.t(),this.value=``,this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new a.t(this)}connectedCallback(){super.connectedCallback(),this.parseOptions(),this._options.forEach(e=>{e.selected&&!this.value&&(this.value=e.value)})}add(e,t){let n={value:e.value||e.text,label:e.text||e.value,selected:e.selected,disabled:e.disabled};if(t===void 0)this._options.push(n);else if(typeof t==`number`)this._options.splice(t,0,n);else{let e=t.value||t.text,r=this._options.findIndex(t=>t.value===e);r>=0?this._options.splice(r,0,n):this._options.push(n)}e.selected&&(this.value=e.value||e.text,this.selectedIndex=this._options.findIndex(e=>e.value===this.value)),this.requestUpdate()}remove(e){typeof e==`number`&&(this.selectedIndex===e&&(this.value=this._options[0]?.value||``),this._options.splice(e,1),this.requestUpdate())}item(e){return this.inputRef.value?.item(e)}namedItem(e){return this.inputRef.value?.namedItem(e)}showPicker(){this.inputRef.value&&`showPicker`in this.inputRef.value&&this.inputRef.value.showPicker()}attributeChangedCallback(e,t,n){e===`options`&&(this._options=n?JSON.parse(n):[]),e===`value`&&this.value!==t&&(this.selectedIndex=this.touched?this.returnNumberOrNull(this.inputRef.value?.selectedIndex):this._options.findIndex(e=>e.value===n),this.selectedOptions=this.inputRef.value?.selectedOptions,this.valueChanged(n,t)),super.attributeChangedCallback(e,t,n)}update(e){super.update(e),e.has(`_optionsProp`)&&this._optionsProp.length>0&&(this._options=this._optionsProp,this.requestUpdate(`_options`),!this.value&&this._options.length>0&&(this.value=this._options[0].value,this.selectedIndex=0)),e.has(`value`)&&this.value!==e.get(`value`)&&(this.selectedIndex=this.touched?this.returnNumberOrNull(this.inputRef.value?.selectedIndex):this._options.findIndex(e=>e.value===this.value),this.selectedOptions=this.inputRef.value?.selectedOptions,this.valueChanged(this.value,e.get(`value`))),e.has(`id`)&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(e){super.firstUpdated(e),this.classList.add(`pkt-select`),this._optionsProp.length&&(this._options=this._optionsProp),!this.value&&this._options.length>0?(this.value=this._options[0].value,this.selectedIndex=0):this.selectedIndex=this._options.findIndex(e=>e.value===this.value),this.selectedOptions=this.inputRef.value?.selectedOptions}render(){let i=`pkt-input pkt-input--${this.inputSize} ${this.fullwidth?`pkt-input--fullwidth`:``}`;return e._`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
3
|
.strings=${this.strings}
|
|
4
4
|
.size=${this.inputSize}
|
|
@@ -10,26 +10,25 @@ const e=require("./element-DRc10X2R.cjs"),t=require("./element-with-slot-MkibfzH
|
|
|
10
10
|
?requiredTag=${this.requiredTag}
|
|
11
11
|
useWrapper=${this.useWrapper}
|
|
12
12
|
.ariaDescribedby=${this.ariaDescribedby}
|
|
13
|
-
errorMessage=${
|
|
13
|
+
errorMessage=${t.t(this.errorMessage)}
|
|
14
14
|
forId=${this.id+`-input`}
|
|
15
|
-
helptext=${
|
|
16
|
-
helptextDropdown=${
|
|
17
|
-
helptextDropdownButton=${
|
|
18
|
-
label=${
|
|
19
|
-
optionalText=${
|
|
20
|
-
requiredText=${
|
|
21
|
-
tagText=${
|
|
15
|
+
helptext=${t.t(this.helptext)}
|
|
16
|
+
helptextDropdown=${t.t(this.helptextDropdown)}
|
|
17
|
+
helptextDropdownButton=${t.t(this.helptextDropdownButton)}
|
|
18
|
+
label=${t.t(this.label)}
|
|
19
|
+
optionalText=${t.t(this.optionalText)}
|
|
20
|
+
requiredText=${t.t(this.requiredText)}
|
|
21
|
+
tagText=${t.t(this.tagText)}
|
|
22
22
|
>
|
|
23
23
|
<select
|
|
24
24
|
class=${i}
|
|
25
25
|
aria-invalid=${this.hasError}
|
|
26
|
-
aria-errormessage=${
|
|
27
|
-
aria-describedby=${
|
|
28
|
-
aria-labelledby=${
|
|
26
|
+
aria-errormessage=${t.t(this.hasError?`${this.id}-input-error`:void 0)}
|
|
27
|
+
aria-describedby=${t.t(o.r({id:this.id+`-input`,hasHelptext:!!this.helptext,hasCounter:!1,ariaDescribedby:this.ariaDescribedby}))}
|
|
28
|
+
aria-labelledby=${t.t(this.ariaLabelledby)}
|
|
29
29
|
?disabled=${this.disabled}
|
|
30
30
|
id=${this.id+`-input`}
|
|
31
31
|
name=${(this.name||this.id)+`-input`}
|
|
32
|
-
value=${this.value}
|
|
33
32
|
@change=${e=>{this.touched=!0,this.value=e.target.value,e.stopImmediatePropagation()}}
|
|
34
33
|
@input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
|
|
35
34
|
@focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
|
|
@@ -45,6 +44,6 @@ const e=require("./element-DRc10X2R.cjs"),t=require("./element-with-slot-MkibfzH
|
|
|
45
44
|
${t.label}
|
|
46
45
|
</option>`):``}
|
|
47
46
|
</select>
|
|
48
|
-
<div class="pkt-contents" slot="helptext">${
|
|
47
|
+
<div class="pkt-contents" slot="helptext">${n.n(this,`helptext`)}</div>
|
|
49
48
|
</pkt-input-wrapper>
|
|
50
49
|
`}returnNumberOrNull(e){return e==null||isNaN(e)?null:e}};e.n([e.u({type:String})],c.prototype,`value`,void 0);try{e.d(`pkt-select`)(c)}catch{console.warn(`Forsøker å definere <pkt-select>, men den er allerede definert`)}var l=c;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { _ as e, d as t, l as n, n as r, u as i } from "./element-e2MAMNEP.js";
|
|
2
|
-
import {
|
|
3
|
-
import { t as s } from "./
|
|
2
|
+
import { t as a } from "./if-defined-r8tKY4tG.js";
|
|
3
|
+
import { n as o, t as s } from "./element-with-slot-COOwQUxM.js";
|
|
4
4
|
import { n as c, r as l, t as u } from "./consume-BDnMAp2g.js";
|
|
5
5
|
import { n as d, t as f } from "./ref-lE1mGUOL.js";
|
|
6
6
|
//#region src/components/tabs/tabs-context.ts
|
|
7
|
-
var p = l(Symbol("pkt-tabs-context")), m = class extends
|
|
7
|
+
var p = l(Symbol("pkt-tabs-context")), m = class extends s {
|
|
8
8
|
constructor(...e) {
|
|
9
9
|
super(...e), this.arrowNav = !0, this.disableArrowNav = !1, this.separatorIconName = "", this.separatorIconPath = "", this.tabRefs = [], this.disabledMap = {}, this.tabCount = 0, this.context = {
|
|
10
10
|
useArrowNav: this.useArrowNav,
|
|
@@ -78,7 +78,7 @@ var p = l(Symbol("pkt-tabs-context")), m = class extends o {
|
|
|
78
78
|
let t = this.useArrowNav ? "tablist" : "navigation", n = this.separatorIconName || this.separatorIconPath ? "pkt-tabs pkt-tabs--with-separator" : "pkt-tabs";
|
|
79
79
|
return e`
|
|
80
80
|
<div class=${n}>
|
|
81
|
-
<div class="pkt-tabs__list" role=${t}>${
|
|
81
|
+
<div class="pkt-tabs__list" role=${t}>${o(this)}</div>
|
|
82
82
|
</div>
|
|
83
83
|
`;
|
|
84
84
|
}
|
|
@@ -107,7 +107,7 @@ try {
|
|
|
107
107
|
}
|
|
108
108
|
//#endregion
|
|
109
109
|
//#region src/components/tabs/tabitem.ts
|
|
110
|
-
var h = class extends
|
|
110
|
+
var h = class extends s {
|
|
111
111
|
constructor() {
|
|
112
112
|
super(), this.active = !1, this.disabled = !1, this.href = "", this.icon = "", this.controls = "", this.tag = "", this.tagSkin = "blue", this.index = 0, this.elementRef = f();
|
|
113
113
|
}
|
|
@@ -134,21 +134,21 @@ var h = class extends o {
|
|
|
134
134
|
this.context && this.context.handleKeyUp(e, this.index);
|
|
135
135
|
}
|
|
136
136
|
render() {
|
|
137
|
-
let t = this.context?.useArrowNav ?? !0, n = this.active && !this.disabled, r = [n ? "active" : "", this.disabled ? "pkt-tabs__item--disabled" : ""].filter(Boolean).join(" "), i = t ? "tab" : void 0,
|
|
137
|
+
let t = this.context?.useArrowNav ?? !0, n = this.active && !this.disabled, r = [n ? "active" : "", this.disabled ? "pkt-tabs__item--disabled" : ""].filter(Boolean).join(" "), i = t ? "tab" : void 0, s = t ? n : void 0, c = this.disabled ? -1 : n || !t ? void 0 : -1, l = `pkt-icon--small ${this.icon === "check" ? "pkt-tabs__status-icon" : ""}`, u = e`
|
|
138
138
|
${this.icon ? e`<pkt-icon name=${this.icon} class=${l}></pkt-icon>` : ""}
|
|
139
|
-
<span>${
|
|
139
|
+
<span>${o(this)}</span>
|
|
140
140
|
${this.tag ? e`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>` : ""}
|
|
141
141
|
`;
|
|
142
142
|
return this.href ? e`
|
|
143
143
|
<a
|
|
144
144
|
${d(this.elementRef)}
|
|
145
|
-
href=${
|
|
145
|
+
href=${a(this.disabled ? void 0 : this.href)}
|
|
146
146
|
class="pkt-tabs__link ${r}"
|
|
147
|
-
role=${
|
|
148
|
-
aria-selected=${s
|
|
149
|
-
aria-disabled=${
|
|
150
|
-
aria-controls=${
|
|
151
|
-
tabindex=${
|
|
147
|
+
role=${a(i)}
|
|
148
|
+
aria-selected=${a(s)}
|
|
149
|
+
aria-disabled=${a(this.disabled ? "true" : void 0)}
|
|
150
|
+
aria-controls=${a(this.controls || void 0)}
|
|
151
|
+
tabindex=${a(c)}
|
|
152
152
|
@click=${this.handleClick}
|
|
153
153
|
@keydown=${this.handleKeyDown}
|
|
154
154
|
>
|
|
@@ -160,11 +160,11 @@ var h = class extends o {
|
|
|
160
160
|
type="button"
|
|
161
161
|
class="pkt-tabs__button pkt-link-button ${r}"
|
|
162
162
|
?disabled=${this.disabled}
|
|
163
|
-
aria-disabled=${
|
|
164
|
-
role=${
|
|
165
|
-
aria-selected=${s
|
|
166
|
-
aria-controls=${
|
|
167
|
-
tabindex=${
|
|
163
|
+
aria-disabled=${a(this.disabled ? "true" : void 0)}
|
|
164
|
+
role=${a(i)}
|
|
165
|
+
aria-selected=${a(s)}
|
|
166
|
+
aria-controls=${a(this.controls || void 0)}
|
|
167
|
+
tabindex=${a(c)}
|
|
168
168
|
@click=${this.handleClick}
|
|
169
169
|
@keydown=${this.handleKeyDown}
|
|
170
170
|
>
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
const e=require("./element-DRc10X2R.cjs"),t=require("./
|
|
1
|
+
const e=require("./element-DRc10X2R.cjs"),t=require("./if-defined-BeVQnl3C.cjs"),n=require("./element-with-slot-MkibfzHp.cjs"),r=require("./consume-Le4HztPo.cjs"),i=require("./ref-BkV4Cd8U.cjs");var a=r.r(Symbol(`pkt-tabs-context`)),o=class extends n.t{constructor(...e){super(...e),this.arrowNav=!0,this.disableArrowNav=!1,this.separatorIconName=``,this.separatorIconPath=``,this.tabRefs=[],this.disabledMap={},this.tabCount=0,this.context={useArrowNav:this.useArrowNav,registerTab:this.registerTab.bind(this),handleClick:this.handleClick.bind(this),handleKeyUp:this.handleKeyUp.bind(this)}}get useArrowNav(){return this.arrowNav&&!this.disableArrowNav}updated(e){(e.has(`arrowNav`)||e.has(`disableArrowNav`))&&(this.context={...this.context,useArrowNav:this.useArrowNav}),this.updateComplete.then(()=>this.syncSeparators())}syncSeparators(){let e=this.querySelector(`.pkt-tabs__list`);if(!e||(e.querySelectorAll(`.pkt-tabs__separator`).forEach(e=>e.remove()),!(this.separatorIconName||this.separatorIconPath)))return;let t=Array.from(e.children).filter(e=>!e.classList.contains(`pkt-tabs__separator`));for(let e=0;e<t.length-1;e++){let n=document.createElement(`span`);if(n.className=`pkt-tabs__separator`,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`role`,`presentation`),this.separatorIconPath){let e=document.createElement(`img`);e.setAttribute(`src`,this.separatorIconPath),e.setAttribute(`alt`,``),e.setAttribute(`aria-hidden`,`true`),n.appendChild(e)}else if(this.separatorIconName){let e=document.createElement(`pkt-icon`);e.setAttribute(`name`,this.separatorIconName),e.classList.add(`pkt-tabs__separator-icon`),n.appendChild(e)}t[e].after(n)}}registerTab(e,t,n=!1){this.tabRefs[t]=e,this.disabledMap[t]=n,this.tabCount=Math.max(this.tabCount,t+1)}isTabDisabled(e){return!!this.disabledMap[e]}findEnabledIndex(e,t){let n=e+t;for(;n>=0&&n<this.tabCount;){if(!this.isTabDisabled(n))return n;n+=t}return null}handleClick(e){this.isTabDisabled(e)||this.dispatchEvent(new CustomEvent(`tab-selected`,{detail:{index:e},bubbles:!0,composed:!0}))}handleKeyUp(e,t){if(this.useArrowNav){if(e.key===`ArrowLeft`){e.preventDefault();let n=this.findEnabledIndex(t,-1);n!==null&&this.tabRefs[n]?.focus()}if(e.key===`ArrowRight`){e.preventDefault();let n=this.findEnabledIndex(t,1);n!==null&&this.tabRefs[n]?.focus()}(e.key===`Enter`||e.key===` `||e.key===`Spacebar`||e.key===`ArrowDown`)&&(e.preventDefault(),this.handleClick(t))}}render(){let t=this.useArrowNav?`tablist`:`navigation`,r=this.separatorIconName||this.separatorIconPath?`pkt-tabs pkt-tabs--with-separator`:`pkt-tabs`;return e._`
|
|
2
2
|
<div class=${r}>
|
|
3
|
-
<div class="pkt-tabs__list" role=${
|
|
3
|
+
<div class="pkt-tabs__list" role=${t}>${n.n(this)}</div>
|
|
4
4
|
</div>
|
|
5
|
-
`}};e.n([e.u({type:Boolean,reflect:!0,attribute:`arrow-nav`})],o.prototype,`arrowNav`,void 0),e.n([e.u({type:Boolean,reflect:!0,attribute:`disable-arrow-nav`})],o.prototype,`disableArrowNav`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`separator-icon-name`})],o.prototype,`separatorIconName`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`separator-icon-path`})],o.prototype,`separatorIconPath`,void 0),e.n([e.l()],o.prototype,`tabRefs`,void 0),e.n([e.l()],o.prototype,`disabledMap`,void 0),e.n([e.l()],o.prototype,`tabCount`,void 0),e.n([r.n({context:a}),e.l()],o.prototype,`context`,void 0);try{e.d(`pkt-tabs`)(o)}catch{console.warn(`Forsøker å definere <pkt-tabs>, men den er allerede definert`)}var s=class extends
|
|
5
|
+
`}};e.n([e.u({type:Boolean,reflect:!0,attribute:`arrow-nav`})],o.prototype,`arrowNav`,void 0),e.n([e.u({type:Boolean,reflect:!0,attribute:`disable-arrow-nav`})],o.prototype,`disableArrowNav`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`separator-icon-name`})],o.prototype,`separatorIconName`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`separator-icon-path`})],o.prototype,`separatorIconPath`,void 0),e.n([e.l()],o.prototype,`tabRefs`,void 0),e.n([e.l()],o.prototype,`disabledMap`,void 0),e.n([e.l()],o.prototype,`tabCount`,void 0),e.n([r.n({context:a}),e.l()],o.prototype,`context`,void 0);try{e.d(`pkt-tabs`)(o)}catch{console.warn(`Forsøker å definere <pkt-tabs>, men den er allerede definert`)}var s=class extends n.t{constructor(){super(),this.active=!1,this.disabled=!1,this.href=``,this.icon=``,this.controls=``,this.tag=``,this.tagSkin=`blue`,this.index=0,this.elementRef=i.t()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)})}updated(){this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)}handleClick(e){if(this.disabled){e.preventDefault(),e.stopPropagation();return}this.context&&this.context.handleClick(this.index)}handleKeyDown(e){if(this.disabled&&(e.key===`Enter`||e.key===` `||e.key===`Spacebar`)){e.preventDefault(),e.stopPropagation();return}this.context&&this.context.handleKeyUp(e,this.index)}render(){let r=this.context?.useArrowNav??!0,a=this.active&&!this.disabled,o=[a?`active`:``,this.disabled?`pkt-tabs__item--disabled`:``].filter(Boolean).join(` `),s=r?`tab`:void 0,c=r?a:void 0,l=this.disabled?-1:a||!r?void 0:-1,u=`pkt-icon--small ${this.icon===`check`?`pkt-tabs__status-icon`:``}`,d=e._`
|
|
6
6
|
${this.icon?e._`<pkt-icon name=${this.icon} class=${u}></pkt-icon>`:``}
|
|
7
|
-
<span>${
|
|
7
|
+
<span>${n.n(this)}</span>
|
|
8
8
|
${this.tag?e._`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>`:``}
|
|
9
9
|
`;return this.href?e._`
|
|
10
10
|
<a
|
|
11
11
|
${i.n(this.elementRef)}
|
|
12
|
-
href=${
|
|
12
|
+
href=${t.t(this.disabled?void 0:this.href)}
|
|
13
13
|
class="pkt-tabs__link ${o}"
|
|
14
|
-
role=${
|
|
15
|
-
aria-selected=${
|
|
16
|
-
aria-disabled=${
|
|
17
|
-
aria-controls=${
|
|
18
|
-
tabindex=${
|
|
14
|
+
role=${t.t(s)}
|
|
15
|
+
aria-selected=${t.t(c)}
|
|
16
|
+
aria-disabled=${t.t(this.disabled?`true`:void 0)}
|
|
17
|
+
aria-controls=${t.t(this.controls||void 0)}
|
|
18
|
+
tabindex=${t.t(l)}
|
|
19
19
|
@click=${this.handleClick}
|
|
20
20
|
@keydown=${this.handleKeyDown}
|
|
21
21
|
>
|
|
@@ -27,11 +27,11 @@ const e=require("./element-DRc10X2R.cjs"),t=require("./element-with-slot-MkibfzH
|
|
|
27
27
|
type="button"
|
|
28
28
|
class="pkt-tabs__button pkt-link-button ${o}"
|
|
29
29
|
?disabled=${this.disabled}
|
|
30
|
-
aria-disabled=${
|
|
31
|
-
role=${
|
|
32
|
-
aria-selected=${
|
|
33
|
-
aria-controls=${
|
|
34
|
-
tabindex=${
|
|
30
|
+
aria-disabled=${t.t(this.disabled?`true`:void 0)}
|
|
31
|
+
role=${t.t(s)}
|
|
32
|
+
aria-selected=${t.t(c)}
|
|
33
|
+
aria-controls=${t.t(this.controls||void 0)}
|
|
34
|
+
tabindex=${t.t(l)}
|
|
35
35
|
@click=${this.handleClick}
|
|
36
36
|
@keydown=${this.handleKeyDown}
|
|
37
37
|
>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const e=require("./element-DRc10X2R.cjs"),t=require("./class-map-BEib48YL.cjs"),n=require("./if-defined-BeVQnl3C.cjs"),r=require("./format-B8meU8Tm.cjs"),i=require("./element-with-slot-MkibfzHp.cjs");require("./icon-DBFTFd-J.cjs");var a={name:`pkt-tag`,react:`PktTag`,"css-class":`pkt-tag`,isElement:!0,"dark-mode":!0,props:{size:{name:`Størrelse`,description:`Størrelsen på taggen`,required:!1,default:`medium`,type:[`small`,`medium`,`large`],category:`ui`},iconName:{name:`Ikon`,description:`Navnet på ikonet som skal vises i taggen`,type:`icon`,required:!1,category:`ui`},skin:{name:`Utseende`,description:`Utseendet til taggen`,required:!1,default:`blue`,type:[`blue`,`blue-light`,`blue-dark`,`green`,`red`,`beige`,`yellow`,`gray`],category:`ui`},closeTag:{name:`Lukk tag`,description:`Skal taggen ha en lukkeknapp?`,type:`boolean`,required:!1,default:!1,category:`ui`},textStyle:{name:`Tekststil`,description:`Stilen på teksten i taggen`,required:!1,default:`normal-text`,type:[`thin-text`,`normal-text`],category:`ui`},type:{name:`Type, dersom lukkeknapp`,description:`Type tag, brukes for å spesifisere om det er en knapp, submit eller reset`,required:!1,default:`button`,type:[`button`,`submit`,`reset`],category:`tech`},ariaLabel:{name:`aria-label`,description:`aria-label for taggen, brukes for tilgjengelighet`,type:`string`,required:!1,category:`accessibility`}},slots:{default:{description:`Teksten til tag`}}},o=class extends i.t{constructor(){super(),this.closeTag=a.props.closeTag.default,this.size=a.props.size.default,this.skin=a.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=a.props.type.default,this.ariaLabel=null,this.buttonTabindex=void 0,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent(`close`,{detail:{origin:e},bubbles:!1,composed:!0})),this.dispatchEvent(new CustomEvent(`on-close`,{detail:{origin:e},bubbles:!1,composed:!0}))},this._isClosed=!1}firstUpdated(e){if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){let e=this.querySelector(`button span, .pkt-tag > span`)?.textContent?.trim();e&&(this._ariaDescription=r.t(this.pktStrings.get(`tag`).remove,{label:e}))}}render(){let r={"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-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-hide":this._isClosed};return this.closeTag?e._`
|
|
2
|
+
<button
|
|
3
|
+
class=${t.t(a)}
|
|
4
|
+
type=${this.type}
|
|
5
|
+
tabindex=${n.t(this.buttonTabindex)}
|
|
6
|
+
@click=${this.close}
|
|
7
|
+
aria-label=${n.t(this.ariaLabel||void 0)}
|
|
8
|
+
aria-description=${n.t(this._ariaDescription||void 0)}
|
|
9
|
+
>
|
|
10
|
+
${this.iconName&&e._`<pkt-icon
|
|
11
|
+
class="pkt-tag__icon"
|
|
12
|
+
name=${this.iconName}
|
|
13
|
+
aria-hidden="true"
|
|
14
|
+
></pkt-icon>`}
|
|
15
|
+
<span>${i.n(this)}</span>
|
|
16
|
+
<pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
|
|
17
|
+
</button>
|
|
18
|
+
`:e._`
|
|
19
|
+
<span class=${t.t(r)}>
|
|
20
|
+
${this.iconName&&e._`<pkt-icon
|
|
21
|
+
class="pkt-tag__icon"
|
|
22
|
+
name=${this.iconName}
|
|
23
|
+
aria-hidden="true"
|
|
24
|
+
></pkt-icon>`}
|
|
25
|
+
<span>${i.n(this)}</span>
|
|
26
|
+
</span>
|
|
27
|
+
`}};e.n([e.u({type:Boolean,reflect:!0})],o.prototype,`closeTag`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`size`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`skin`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`textStyle`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`iconName`,void 0),e.n([e.u({type:String})],o.prototype,`type`,void 0),e.n([e.u({type:String})],o.prototype,`ariaLabel`,void 0),e.n([e.u({type:Number,attribute:`button-tabindex`})],o.prototype,`buttonTabindex`,void 0),e.n([e.l()],o.prototype,`_isClosed`,void 0),e.n([e.l()],o.prototype,`_ariaDescription`,void 0);try{e.d(`pkt-tag`)(o)}catch{console.warn(`Forsøker å definere <pkt-tag>, men den er allerede definert`)}var s=o;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|