@oslokommune/punkt-elements 16.7.0 → 16.7.3
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 +34 -0
- package/dist/accordionitem-_9AiCIvd.cjs +34 -0
- package/dist/{accordionitem-ZlaXvjt5.js → accordionitem-dCfSrxh5.js} +57 -55
- package/dist/alert-BtOk8yRH.cjs +33 -0
- package/dist/{alert-BuAXrnKl.js → alert-DlY2_grU.js} +48 -46
- package/dist/backlink-Ce5Vldop.js +49 -0
- package/dist/backlink-y3dwjKPC.cjs +13 -0
- package/dist/button-B_TXwNzt.cjs +27 -0
- package/dist/{button-DEyvt1LI.js → button-BiY-wlKF.js} +79 -77
- package/dist/calendar-B2pji2zn.cjs +90 -0
- package/dist/{calendar-S63oreVW.js → calendar-DhjQDC4C.js} +689 -687
- package/dist/card-BwMNB5Bb.cjs +87 -0
- package/dist/{card-DDiLfuO4.js → card-CGlmcMSR.js} +99 -97
- package/dist/checkbox-BsJZYA26.js +147 -0
- package/dist/checkbox-CTY8f_qn.cjs +31 -0
- package/dist/{combobox-BmxSecfE.js → combobox-DSB5WOxg.js} +223 -226
- package/dist/{combobox-Hb2V-fPX.cjs → combobox-DbICIgKG.cjs} +4 -4
- package/dist/consent-DkOQpbsg.cjs +11 -0
- package/dist/{consent-iXyx5v6J.js → consent-SNWV_mMU.js} +48 -46
- package/dist/datepicker-BEWl9iz3.cjs +273 -0
- package/dist/{datepicker-CZl7b8Na.js → datepicker-euHyzXnb.js} +341 -329
- package/dist/{heading-CKt7cVn7.js → heading-D2tVS6lS.js} +30 -28
- package/dist/heading-DrzbgDb6.cjs +1 -0
- package/dist/helptext-BKtU4mas.js +82 -0
- package/dist/helptext-DcRC7wW2.cjs +24 -0
- package/dist/icon-CxQcIa5F.js +105 -0
- package/dist/icon-q81vqPK_.cjs +9 -0
- package/dist/input-wrapper-Bs4CRNst.js +181 -0
- package/dist/input-wrapper-Bv9aqqVq.cjs +54 -0
- package/dist/link-C0rl-86s.cjs +7 -0
- package/dist/link-Cdqgl60z.js +55 -0
- package/dist/linkcard-Dimu7Rlx.cjs +13 -0
- package/dist/linkcard-Lbq_UhjZ.js +56 -0
- package/dist/{listbox-BQKDZvZn.js → listbox-Bia4_tvN.js} +131 -129
- package/dist/listbox-La2GZQei.cjs +106 -0
- package/dist/loader-D1ugDXGV.cjs +16 -0
- package/dist/{loader-Ci3CHU8k.js → loader-DyN6RGC5.js} +51 -49
- package/dist/messagebox-BGMVm2t9.js +71 -0
- package/dist/messagebox-M0yIgCz9.cjs +13 -0
- package/dist/modal-CMO1RtIi.cjs +36 -0
- package/dist/{modal-DzGe1g8Z.js → modal-DjPQDE-Z.js} +53 -51
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +2 -2
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +3 -4
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +2 -3
- package/dist/pkt-breadcrumbs.cjs +11 -11
- package/dist/pkt-breadcrumbs.js +30 -28
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +3 -4
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +2 -3
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +2 -3
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +3 -4
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +3 -4
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +2 -3
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +7 -8
- package/dist/pkt-header.cjs +35 -35
- package/dist/pkt-header.js +224 -218
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +3 -4
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +3 -4
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +3 -4
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +26 -26
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +2 -3
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +2 -3
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +3 -4
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +3 -4
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +3 -4
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +3 -4
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +3 -4
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -3
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +3 -4
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +3 -4
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +2 -2
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +3 -4
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +3 -4
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +3 -4
- package/dist/pkt-timepicker.cjs +22 -19
- package/dist/pkt-timepicker.js +84 -76
- package/dist/progressbar-BqlMzkM_.cjs +21 -0
- package/dist/{progressbar-By7e0lEI.js → progressbar-sbHDFC12.js} +88 -88
- package/dist/radiobutton-5ZqVVtTT.cjs +31 -0
- package/dist/{radiobutton-6frNG9J_.js → radiobutton-D8Ai8ETa.js} +44 -42
- package/dist/select-De-n8on9.js +230 -0
- package/dist/select-dTWibR6_.cjs +49 -0
- package/dist/tabitem-B9-jeV97.js +334 -0
- package/dist/tabitem-BnhzqfW3.cjs +65 -0
- package/dist/tag-CbwO8yvD.cjs +27 -0
- package/dist/{tag-BuCpqaks.js → tag-D4FI5t3y.js} +42 -40
- package/dist/textarea-BmLaKzsc.cjs +50 -0
- package/dist/{textarea-Bzuymclz.js → textarea-CMiSJaYL.js} +62 -60
- package/dist/textinput-em9y4yrL.cjs +70 -0
- package/dist/{textinput-9lHjs4ce.js → textinput-r8udK0IX.js} +57 -55
- package/package.json +2 -2
- package/src/components/accordion/accordion.ts +6 -1
- package/src/components/accordion/accordionitem.ts +6 -1
- package/src/components/alert/alert.ts +6 -1
- package/src/components/backlink/backlink.ts +6 -1
- package/src/components/breadcrumbs/breadcrumbs.ts +6 -1
- package/src/components/button/button.ts +6 -1
- package/src/components/calendar/calendar.ts +6 -1
- package/src/components/card/card.ts +6 -1
- package/src/components/checkbox/checkbox.ts +6 -1
- package/src/components/combobox/combobox.ts +6 -1
- package/src/components/consent/consent.ts +6 -1
- package/src/components/datepicker/date-tags.ts +6 -1
- package/src/components/datepicker/datepicker-multiple.ts +6 -1
- package/src/components/datepicker/datepicker-popup.ts +6 -1
- package/src/components/datepicker/datepicker-range.ts +6 -1
- package/src/components/datepicker/datepicker-single.ts +6 -1
- package/src/components/datepicker/datepicker.ts +6 -1
- package/src/components/header/header-service.ts +6 -1
- package/src/components/header/header-user-menu.ts +6 -1
- package/src/components/header/header.ts +6 -1
- package/src/components/heading/heading.ts +6 -1
- package/src/components/helptext/helptext.ts +6 -1
- package/src/components/icon/icon.ts +6 -1
- package/src/components/input-wrapper/input-wrapper.ts +6 -1
- package/src/components/link/link.ts +6 -1
- package/src/components/linkcard/linkcard.ts +6 -1
- package/src/components/listbox/listbox.ts +6 -1
- package/src/components/loader/loader.ts +6 -1
- package/src/components/messagebox/messagebox.ts +6 -1
- package/src/components/modal/modal.ts +6 -1
- package/src/components/progressbar/progressbar.ts +6 -1
- package/src/components/radiobutton/radiobutton.ts +6 -1
- package/src/components/select/select.ts +6 -1
- package/src/components/tabs/tabitem.ts +6 -1
- package/src/components/tabs/tabs.ts +6 -1
- package/src/components/tag/tag.ts +6 -1
- package/src/components/textarea/textarea.ts +6 -1
- package/src/components/textinput/textinput.ts +6 -1
- package/src/components/timepicker/timepicker.ts +14 -2
- package/dist/accordionitem-D1Agl1bB.cjs +0 -34
- package/dist/alert-DFkFNTxh.cjs +0 -33
- package/dist/backlink-EiAXUUZP.cjs +0 -13
- package/dist/backlink-V4DAt17e.js +0 -47
- package/dist/button-DYv5Dg4M.cjs +0 -27
- package/dist/calendar-HIE9nxcc.cjs +0 -90
- package/dist/card-CyeH6l1c.cjs +0 -87
- package/dist/checkbox-BLlwTABj.cjs +0 -31
- package/dist/checkbox-ejBUa5qQ.js +0 -145
- package/dist/consent-ruWAEVXW.cjs +0 -11
- package/dist/datepicker-D2H7U6MS.cjs +0 -273
- package/dist/heading-Cvz8m1xL.cjs +0 -1
- package/dist/helptext-5Mzp65-F.cjs +0 -24
- package/dist/helptext-jIoWRcCF.js +0 -80
- package/dist/icon-BlKA8YuW.js +0 -103
- package/dist/icon-Bqj9oBbl.cjs +0 -9
- package/dist/input-wrapper-B0MkQ0IZ.cjs +0 -54
- package/dist/input-wrapper-B2JpK016.js +0 -179
- package/dist/link-R_lNhViF.cjs +0 -7
- package/dist/link-Z_GizclR.js +0 -53
- package/dist/linkcard-BlQvdB1a.js +0 -54
- package/dist/linkcard-C7HbSLlX.cjs +0 -13
- package/dist/listbox-CGgV9MAe.cjs +0 -106
- package/dist/loader-e2gs_1xz.cjs +0 -16
- package/dist/messagebox-Bf-XMlvW.js +0 -69
- package/dist/messagebox-D67w71VX.cjs +0 -13
- package/dist/modal-CyvEkbfQ.cjs +0 -36
- package/dist/progressbar-DsJ2B9Vm.cjs +0 -21
- package/dist/radiobutton-Bv-BZ1Hw.cjs +0 -31
- package/dist/select-CXZt1nHS.js +0 -228
- package/dist/select-WFhS4Vfp.cjs +0 -49
- package/dist/tabitem-CB8wkKmv.js +0 -332
- package/dist/tabitem-DZpspU4Q.cjs +0 -65
- package/dist/tag-X6xdjR0N.cjs +0 -27
- package/dist/textarea-DoeHJ7HR.cjs +0 -50
- package/dist/textinput-BNsLd26i.cjs +0 -70
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var o = Object.defineProperty,
|
|
3
|
-
for (var i =
|
|
4
|
-
(
|
|
5
|
-
return
|
|
1
|
+
import { t as u, a as g, b as p, n as a } from "./element-CPpT3rFQ.js";
|
|
2
|
+
var o = Object.defineProperty, l = (r, e, d, t) => {
|
|
3
|
+
for (var i = void 0, h = r.length - 1, n; h >= 0; h--)
|
|
4
|
+
(n = r[h]) && (i = n(e, d, i) || i);
|
|
5
|
+
return i && o(e, d, i), i;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
class s extends g {
|
|
8
8
|
constructor() {
|
|
9
9
|
super(...arguments), this.size = void 0, this.level = 2, this.weight = void 0, this.visuallyHidden = !1, this.align = void 0;
|
|
10
10
|
}
|
|
11
11
|
connectedCallback() {
|
|
12
12
|
super.connectedCallback(), this.setAttribute("role", "heading"), this.setAttribute("aria-level", String(this.level)), this.updateHostClasses();
|
|
13
13
|
}
|
|
14
|
-
attributeChangedCallback(e,
|
|
15
|
-
super.attributeChangedCallback(e,
|
|
14
|
+
attributeChangedCallback(e, d, t) {
|
|
15
|
+
super.attributeChangedCallback(e, d, t), e === "level" && t && this.setLevel(Number(t)), e === "visuallyHidden" && (this.visuallyHidden = t !== null && t !== "false"), (e === "size" || e === "visuallyHidden" || e === "align" || e === "weight") && this.updateHostClasses();
|
|
16
16
|
}
|
|
17
17
|
updated(e) {
|
|
18
18
|
super.updated(e), e.has("level") && (this.setLevel(this.level), this.hasAttribute("size") || (this.size = this.defaultSizeForLevel), this.hasAttribute("weight") || (this.weight = this.defaultWeightForLevel)), !this.hasAttribute("size") && (e.has("level") || this.size === void 0) && (this.size = this.defaultSizeForLevel), (e.has("size") || e.has("visuallyHidden") || e.has("align") || e.has("weight")) && this.updateHostClasses();
|
|
@@ -75,27 +75,29 @@ let s = class extends n {
|
|
|
75
75
|
), this.classList.add("pkt-heading"), this.size && this.classList.add(`pkt-heading--${this.size}`), this.weight && this.classList.add(`pkt-heading--fw-${this.weight}`), this.visuallyHidden && this.classList.add("pkt-sr-only"), this.align && this.classList.add(`pkt-heading--${this.align}`);
|
|
76
76
|
}
|
|
77
77
|
render() {
|
|
78
|
-
return
|
|
78
|
+
return p`<slot></slot>`;
|
|
79
79
|
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
], s.prototype, "size"
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
], s.prototype, "level"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
], s.prototype, "weight"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
], s.prototype, "visuallyHidden"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
], s.prototype, "align"
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
80
|
+
}
|
|
81
|
+
l([
|
|
82
|
+
a({ type: String, reflect: !0 })
|
|
83
|
+
], s.prototype, "size");
|
|
84
|
+
l([
|
|
85
|
+
a({ type: Number, reflect: !0 })
|
|
86
|
+
], s.prototype, "level");
|
|
87
|
+
l([
|
|
88
|
+
a({ type: String, reflect: !0 })
|
|
89
|
+
], s.prototype, "weight");
|
|
90
|
+
l([
|
|
91
|
+
a({ type: Boolean, reflect: !0 })
|
|
92
|
+
], s.prototype, "visuallyHidden");
|
|
93
|
+
l([
|
|
94
|
+
a({ type: String, reflect: !0 })
|
|
95
|
+
], s.prototype, "align");
|
|
96
|
+
try {
|
|
97
|
+
u("pkt-heading")(s);
|
|
98
|
+
} catch {
|
|
99
|
+
console.warn("Forsøker å definere <pkt-heading>, men den er allerede definert");
|
|
100
|
+
}
|
|
99
101
|
export {
|
|
100
102
|
s as P
|
|
101
103
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("./element-gR_VtSiD.cjs");var u=Object.defineProperty,l=(r,e,d,s)=>{for(var a=void 0,h=r.length-1,n;h>=0;h--)(n=r[h])&&(a=n(e,d,a)||a);return a&&u(e,d,a),a};class i extends t.PktShadowElement{constructor(){super(...arguments),this.size=void 0,this.level=2,this.weight=void 0,this.visuallyHidden=!1,this.align=void 0}connectedCallback(){super.connectedCallback(),this.setAttribute("role","heading"),this.setAttribute("aria-level",String(this.level)),this.updateHostClasses()}attributeChangedCallback(e,d,s){super.attributeChangedCallback(e,d,s),e==="level"&&s&&this.setLevel(Number(s)),e==="visuallyHidden"&&(this.visuallyHidden=s!==null&&s!=="false"),(e==="size"||e==="visuallyHidden"||e==="align"||e==="weight")&&this.updateHostClasses()}updated(e){super.updated(e),e.has("level")&&(this.setLevel(this.level),this.hasAttribute("size")||(this.size=this.defaultSizeForLevel),this.hasAttribute("weight")||(this.weight=this.defaultWeightForLevel)),!this.hasAttribute("size")&&(e.has("level")||this.size===void 0)&&(this.size=this.defaultSizeForLevel),(e.has("size")||e.has("visuallyHidden")||e.has("align")||e.has("weight"))&&this.updateHostClasses()}setLevel(e){e>=1&&e<=6?(this.level=e,this.setAttribute("aria-level",String(e))):console.warn(`Invalid heading level: ${e}. Must be between 1 and 6.`)}get defaultSizeForLevel(){switch(this.level){case 1:return"xlarge";case 2:return"large";case 3:return"medium";case 4:return"small";case 5:return"xsmall";case 6:return"xsmall";default:return"medium"}}get defaultWeightForLevel(){switch(this.level){case 1:return"regular";case 2:return"regular";case 3:return"medium";case 4:return"medium";case 5:return"medium";case 6:return"medium";default:return"medium"}}updateHostClasses(){this.classList.remove("pkt-heading","pkt-heading--xsmall","pkt-heading--small","pkt-heading--medium","pkt-heading--large","pkt-heading--xlarge","pkt-sr-only","pkt-heading--start","pkt-heading--center","pkt-heading--end","pkt-heading--light","pkt-heading--regular","pkt-heading--medium","pkt-heading--bold"),this.classList.add("pkt-heading"),this.size&&this.classList.add(`pkt-heading--${this.size}`),this.weight&&this.classList.add(`pkt-heading--fw-${this.weight}`),this.visuallyHidden&&this.classList.add("pkt-sr-only"),this.align&&this.classList.add(`pkt-heading--${this.align}`)}render(){return t.b`<slot></slot>`}}l([t.n({type:String,reflect:!0})],i.prototype,"size");l([t.n({type:Number,reflect:!0})],i.prototype,"level");l([t.n({type:String,reflect:!0})],i.prototype,"weight");l([t.n({type:Boolean,reflect:!0})],i.prototype,"visuallyHidden");l([t.n({type:String,reflect:!0})],i.prototype,"align");try{t.t("pkt-heading")(i)}catch{console.warn("Forsøker å definere <pkt-heading>, men den er allerede definert")}exports.PktHeading=i;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { P as c, s as u } from "./element-with-slot-Dqk6-TRR.js";
|
|
2
|
+
import { t as k, b as l, A as m, n as i } from "./element-CPpT3rFQ.js";
|
|
3
|
+
import { o as h } from "./icon-CxQcIa5F.js";
|
|
4
|
+
import { e as d } from "./class-map-CEnykyO_.js";
|
|
5
|
+
import { r as _ } from "./state-C_1EOo3D.js";
|
|
6
|
+
import { u as f } from "./utils-DznhwRXm.js";
|
|
7
|
+
import { s as w } from "./input-wrapper-CDgenrYA.js";
|
|
8
|
+
var v = Object.defineProperty, n = (r, o, s, a) => {
|
|
9
|
+
for (var t = void 0, e = r.length - 1, x; e >= 0; e--)
|
|
10
|
+
(x = r[e]) && (t = x(o, s, t) || t);
|
|
11
|
+
return t && v(o, s, t), t;
|
|
12
|
+
};
|
|
13
|
+
class p extends c {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments), this.forId = f(), this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = w.props.helptextDropdownButton.default, this.isHelpTextOpen = !1;
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
const o = () => {
|
|
19
|
+
const e = !this.isHelpTextOpen;
|
|
20
|
+
this.isHelpTextOpen = e, this.dispatchEvent(
|
|
21
|
+
new CustomEvent("toggleHelpText", {
|
|
22
|
+
bubbles: !0,
|
|
23
|
+
detail: { isOpen: e }
|
|
24
|
+
})
|
|
25
|
+
);
|
|
26
|
+
}, s = d({
|
|
27
|
+
"pkt-inputwrapper__helptext-container": !0,
|
|
28
|
+
"pkt-inputwrapper__has-helptext": this.helptext || this.helptextDropdown || this.hasSlotContent()
|
|
29
|
+
}), a = () => this.helptextDropdown ? l`<div class="pkt-inputwrapper__helptext-expandable">
|
|
30
|
+
<button
|
|
31
|
+
class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
|
|
32
|
+
type="button"
|
|
33
|
+
@click=${o}
|
|
34
|
+
>
|
|
35
|
+
<pkt-icon
|
|
36
|
+
class="pkt-btn__icon"
|
|
37
|
+
name="${this.isHelpTextOpen ? "chevron-thin-up" : "chevron-thin-down"}"
|
|
38
|
+
></pkt-icon>
|
|
39
|
+
<span class="pkt-btn__text">${h(this.helptextDropdownButton)}</span>
|
|
40
|
+
</button>
|
|
41
|
+
<div
|
|
42
|
+
class="${d({
|
|
43
|
+
"pkt-inputwrapper__helptext": !0,
|
|
44
|
+
"pkt-inputwrapper__helptext-expandable-open": this.isHelpTextOpen,
|
|
45
|
+
"pkt-inputwrapper__helptext-expandable-closed": !this.isHelpTextOpen
|
|
46
|
+
})}"
|
|
47
|
+
>
|
|
48
|
+
${h(this.helptextDropdown)}
|
|
49
|
+
</div>
|
|
50
|
+
</div>` : m;
|
|
51
|
+
return l`${l`<div class="${s}">
|
|
52
|
+
<div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
|
|
53
|
+
<div class="pkt-contents" name="helptext">${u(this)}</div>
|
|
54
|
+
${this.helptext && h(this.helptext)}
|
|
55
|
+
</div>
|
|
56
|
+
${a()}
|
|
57
|
+
</div>`}`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
n([
|
|
61
|
+
i({ type: String, reflect: !0 })
|
|
62
|
+
], p.prototype, "forId");
|
|
63
|
+
n([
|
|
64
|
+
i({ type: String })
|
|
65
|
+
], p.prototype, "helptext");
|
|
66
|
+
n([
|
|
67
|
+
i({ type: String })
|
|
68
|
+
], p.prototype, "helptextDropdown");
|
|
69
|
+
n([
|
|
70
|
+
i({ type: String })
|
|
71
|
+
], p.prototype, "helptextDropdownButton");
|
|
72
|
+
n([
|
|
73
|
+
_()
|
|
74
|
+
], p.prototype, "isHelpTextOpen");
|
|
75
|
+
try {
|
|
76
|
+
k("pkt-helptext")(p);
|
|
77
|
+
} catch {
|
|
78
|
+
console.warn("Forsøker å definere <pkt-helptext>, men den er allerede definert");
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
p as P
|
|
82
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";const c=require("./element-with-slot-ZX-up7jO.cjs"),t=require("./element-gR_VtSiD.cjs"),l=require("./icon-q81vqPK_.cjs"),d=require("./class-map-CsENJXf1.cjs"),u=require("./state-Dg-53wQ8.cjs"),x=require("./utils-byXsEz1u.cjs"),k=require("./input-wrapper-EoSAbU-U.cjs");var _=Object.defineProperty,r=(s,i,o,h)=>{for(var e=void 0,n=s.length-1,a;n>=0;n--)(a=s[n])&&(e=a(i,o,e)||e);return e&&_(i,o,e),e};class p extends c.PktElementWithSlot{constructor(){super(...arguments),this.forId=x.uuidish(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=k.specs.props.helptextDropdownButton.default,this.isHelpTextOpen=!1}render(){const i=()=>{const n=!this.isHelpTextOpen;this.isHelpTextOpen=n,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:n}}))},o=d.e({"pkt-inputwrapper__helptext-container":!0,"pkt-inputwrapper__has-helptext":this.helptext||this.helptextDropdown||this.hasSlotContent()}),h=()=>this.helptextDropdown?t.b`<div class="pkt-inputwrapper__helptext-expandable">
|
|
2
|
+
<button
|
|
3
|
+
class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
|
|
4
|
+
type="button"
|
|
5
|
+
@click=${i}
|
|
6
|
+
>
|
|
7
|
+
<pkt-icon
|
|
8
|
+
class="pkt-btn__icon"
|
|
9
|
+
name="${this.isHelpTextOpen?"chevron-thin-up":"chevron-thin-down"}"
|
|
10
|
+
></pkt-icon>
|
|
11
|
+
<span class="pkt-btn__text">${l.o(this.helptextDropdownButton)}</span>
|
|
12
|
+
</button>
|
|
13
|
+
<div
|
|
14
|
+
class="${d.e({"pkt-inputwrapper__helptext":!0,"pkt-inputwrapper__helptext-expandable-open":this.isHelpTextOpen,"pkt-inputwrapper__helptext-expandable-closed":!this.isHelpTextOpen})}"
|
|
15
|
+
>
|
|
16
|
+
${l.o(this.helptextDropdown)}
|
|
17
|
+
</div>
|
|
18
|
+
</div>`:t.A,e=()=>t.b`<div class="${o}">
|
|
19
|
+
<div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
|
|
20
|
+
<div class="pkt-contents" name="helptext">${c.slotContent(this)}</div>
|
|
21
|
+
${this.helptext&&l.o(this.helptext)}
|
|
22
|
+
</div>
|
|
23
|
+
${h()}
|
|
24
|
+
</div>`;return t.b`${e()}`}}r([t.n({type:String,reflect:!0})],p.prototype,"forId");r([t.n({type:String})],p.prototype,"helptext");r([t.n({type:String})],p.prototype,"helptextDropdown");r([t.n({type:String})],p.prototype,"helptextDropdownButton");r([u.r()],p.prototype,"isHelpTextOpen");try{t.t("pkt-helptext")(p)}catch{console.warn("Forsøker å definere <pkt-helptext>, men den er allerede definert")}exports.PktHelptext=p;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { A as y, E as v, t as I, P, b as _, n as d } from "./element-CPpT3rFQ.js";
|
|
2
|
+
import { e as m, i as S, t as b } from "./directive-oAbCiebi.js";
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2017 Google LLC
|
|
6
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
class c extends S {
|
|
9
|
+
constructor(t) {
|
|
10
|
+
if (super(t), this.it = y, t.type !== b.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
|
|
11
|
+
}
|
|
12
|
+
render(t) {
|
|
13
|
+
if (t === y || t == null) return this._t = void 0, this.it = t;
|
|
14
|
+
if (t === v) return t;
|
|
15
|
+
if (typeof t != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
|
|
16
|
+
if (t === this.it) return this._t;
|
|
17
|
+
this.it = t;
|
|
18
|
+
const e = [t];
|
|
19
|
+
return e.raw = e, this._t = { _$litType$: this.constructor.resultType, strings: e, values: [] };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
c.directiveName = "unsafeHTML", c.resultType = 1;
|
|
23
|
+
const R = m(c);
|
|
24
|
+
/**
|
|
25
|
+
* @license
|
|
26
|
+
* Copyright 2017 Google LLC
|
|
27
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
28
|
+
*/
|
|
29
|
+
class f extends c {
|
|
30
|
+
}
|
|
31
|
+
f.directiveName = "unsafeSVG", f.resultType = 2;
|
|
32
|
+
const u = m(f);
|
|
33
|
+
var C = Object.defineProperty, h = (n, t, e, s) => {
|
|
34
|
+
for (var o = void 0, p = n.length - 1, w; p >= 0; p--)
|
|
35
|
+
(w = n[p]) && (o = w(t, e, o) || o);
|
|
36
|
+
return o && C(t, e, o), o;
|
|
37
|
+
};
|
|
38
|
+
const l = "https://punkt-cdn.oslo.kommune.no/latest/icons/";
|
|
39
|
+
typeof window < "u" && (window.pktFetch = window.pktFetch === void 0 ? fetch : window.pktFetch, window.pktIconPath = window.pktIconPath || l);
|
|
40
|
+
const r = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>', i = {}, E = 2, F = 1500, g = typeof Storage < "u" && typeof sessionStorage < "u", T = (n) => window.pktFetch(n).then((t) => {
|
|
41
|
+
if (!t.ok)
|
|
42
|
+
throw new Error("Missing icon: " + n);
|
|
43
|
+
return t.text();
|
|
44
|
+
}), k = async (n, t = E) => {
|
|
45
|
+
try {
|
|
46
|
+
return await T(n);
|
|
47
|
+
} catch {
|
|
48
|
+
return t > 0 ? (await new Promise((s) => setTimeout(s, F)), k(n, t - 1)) : (console.error("Failed to fetch icon: " + n), r);
|
|
49
|
+
}
|
|
50
|
+
}, $ = async (n, t) => {
|
|
51
|
+
const e = t + n + ".svg";
|
|
52
|
+
return g && sessionStorage.getItem(e) ? sessionStorage.getItem(e) : e in i ? i[e] : typeof window < "u" && typeof window.pktFetch == "function" ? (i[e] = k(e).then((s) => (s !== r && g && sessionStorage.setItem(e, s), delete i[e], s)), i[e]) : r;
|
|
53
|
+
};
|
|
54
|
+
class a extends P {
|
|
55
|
+
constructor() {
|
|
56
|
+
super(...arguments), this.path = typeof window < "u" ? window.pktIconPath : l, this.name = "", this.icon = u(r), this._updatedProps = [];
|
|
57
|
+
}
|
|
58
|
+
connectedCallback() {
|
|
59
|
+
super.connectedCallback(), this.classList.add("pkt-icon");
|
|
60
|
+
}
|
|
61
|
+
async attributeChangedCallback(t, e, s) {
|
|
62
|
+
super.attributeChangedCallback(t, e, s), (t === "name" || t === "path") && this.getIcon(this.name);
|
|
63
|
+
}
|
|
64
|
+
async updated(t) {
|
|
65
|
+
super.updated(t), (t.has("name") || t.has("path")) && this.getIcon(this.name);
|
|
66
|
+
}
|
|
67
|
+
async getIcon(t = "") {
|
|
68
|
+
if (this._updatedProps.length > 0) {
|
|
69
|
+
this.path || (this.path = typeof window < "u" ? window.pktIconPath : l);
|
|
70
|
+
try {
|
|
71
|
+
this.icon = u(
|
|
72
|
+
await $(this.name || "", this.path)
|
|
73
|
+
);
|
|
74
|
+
} catch {
|
|
75
|
+
this.icon = u(r);
|
|
76
|
+
}
|
|
77
|
+
this._updatedProps = [];
|
|
78
|
+
} else
|
|
79
|
+
this._updatedProps.includes(t) || this._updatedProps.push(t);
|
|
80
|
+
}
|
|
81
|
+
render() {
|
|
82
|
+
return _`${this.name && this.icon}`;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
h([
|
|
86
|
+
d({ type: String, reflect: !1 })
|
|
87
|
+
], a.prototype, "path");
|
|
88
|
+
h([
|
|
89
|
+
d({ type: String, reflect: !0 })
|
|
90
|
+
], a.prototype, "name");
|
|
91
|
+
h([
|
|
92
|
+
d({ type: SVGElement })
|
|
93
|
+
], a.prototype, "icon");
|
|
94
|
+
h([
|
|
95
|
+
d({ type: Array, noAccessor: !0 })
|
|
96
|
+
], a.prototype, "_updatedProps");
|
|
97
|
+
try {
|
|
98
|
+
I("pkt-icon")(a);
|
|
99
|
+
} catch {
|
|
100
|
+
console.warn("Forsøker å definere <pkt-icon>, men den er allerede definert");
|
|
101
|
+
}
|
|
102
|
+
export {
|
|
103
|
+
a as P,
|
|
104
|
+
R as o
|
|
105
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";const i=require("./element-gR_VtSiD.cjs"),d=require("./directive-C7oCP5Bh.cjs");/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/class h extends d.i{constructor(t){if(super(t),this.it=i.A,t.type!==d.t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===i.A||t==null)return this._t=void 0,this.it=t;if(t===i.E)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}h.directiveName="unsafeHTML",h.resultType=1;const m=d.e(h);/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2017 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
*/class l extends h{}l.directiveName="unsafeSVG",l.resultType=2;const f=d.e(l);var v=Object.defineProperty,p=(n,t,e,s)=>{for(var o=void 0,u=n.length-1,y;u>=0;u--)(y=n[u])&&(o=y(t,e,o)||o);return o&&v(t,e,o),o};const w="https://punkt-cdn.oslo.kommune.no/latest/icons/";typeof window<"u"&&(window.pktFetch=window.pktFetch===void 0?fetch:window.pktFetch,window.pktIconPath=window.pktIconPath||w);const a='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>',c={},I=2,P=1500,g=typeof Storage<"u"&&typeof sessionStorage<"u",_=n=>window.pktFetch(n).then(t=>{if(!t.ok)throw new Error("Missing icon: "+n);return t.text()}),k=async(n,t=I)=>{try{return await _(n)}catch{return t>0?(await new Promise(s=>setTimeout(s,P)),k(n,t-1)):(console.error("Failed to fetch icon: "+n),a)}},S=async(n,t)=>{const e=t+n+".svg";return g&&sessionStorage.getItem(e)?sessionStorage.getItem(e):e in c?c[e]:typeof window<"u"&&typeof window.pktFetch=="function"?(c[e]=k(e).then(s=>(s!==a&&g&&sessionStorage.setItem(e,s),delete c[e],s)),c[e]):a};class r extends i.PktElement{constructor(){super(...arguments),this.path=typeof window<"u"?window.pktIconPath:w,this.name="",this.icon=f(a),this._updatedProps=[]}connectedCallback(){super.connectedCallback(),this.classList.add("pkt-icon")}async attributeChangedCallback(t,e,s){super.attributeChangedCallback(t,e,s),(t==="name"||t==="path")&&this.getIcon(this.name)}async updated(t){super.updated(t),(t.has("name")||t.has("path"))&&this.getIcon(this.name)}async getIcon(t=""){if(this._updatedProps.length>0){this.path||(this.path=typeof window<"u"?window.pktIconPath:w);try{this.icon=f(await S(this.name||"",this.path))}catch{this.icon=f(a)}this._updatedProps=[]}else this._updatedProps.includes(t)||this._updatedProps.push(t)}render(){return i.b`${this.name&&this.icon}`}}p([i.n({type:String,reflect:!1})],r.prototype,"path");p([i.n({type:String,reflect:!0})],r.prototype,"name");p([i.n({type:SVGElement})],r.prototype,"icon");p([i.n({type:Array,noAccessor:!0})],r.prototype,"_updatedProps");try{i.t("pkt-icon")(r)}catch{console.warn("Forsøker å definere <pkt-icon>, men den er allerede definert")}exports.PktIcon=r;exports.o=m;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { P as x, s as y } from "./element-with-slot-Dqk6-TRR.js";
|
|
2
|
+
import { o as m } from "./if-defined-B0krMLad.js";
|
|
3
|
+
import { t as k, A as i, b as o, n as e } from "./element-CPpT3rFQ.js";
|
|
4
|
+
import { o as w } from "./icon-CxQcIa5F.js";
|
|
5
|
+
import { e as v } from "./class-map-CEnykyO_.js";
|
|
6
|
+
import { u as T } from "./utils-DznhwRXm.js";
|
|
7
|
+
import { b as E } from "./booleanish-C9R0tdXH.js";
|
|
8
|
+
import { s as p } from "./input-wrapper-CDgenrYA.js";
|
|
9
|
+
import "./helptext-BKtU4mas.js";
|
|
10
|
+
import "./alert-DlY2_grU.js";
|
|
11
|
+
var D = Object.defineProperty, r = (h, l, a, d) => {
|
|
12
|
+
for (var s = void 0, n = h.length - 1, u; n >= 0; n--)
|
|
13
|
+
(u = h[n]) && (s = u(l, a, s) || s);
|
|
14
|
+
return s && D(l, a, s), s;
|
|
15
|
+
};
|
|
16
|
+
class t extends x {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments), this.forId = T(), this.label = "", this.helptext = null, this.helptextDropdown = null, this.helptextDropdownButton = null, this.counter = p.props.counter.default, this.counterCurrent = 0, this.counterMaxLength = 0, this.counterError = null, this.counterPosition = "bottom", this.optionalTag = p.props.optionalTag.default, this.optionalText = p.props.optionalText.default, this.requiredTag = p.props.requiredTag.default, this.requiredText = p.props.requiredText.default, this.tagText = null, this.hasError = p.props.hasError.default, this.errorMessage = "", this.disabled = p.props.disabled.default, this.inline = p.props.inline.default, this.ariaDescribedby = void 0, this.hasFieldset = p.props.hasFieldset.default, this.role = "group", this.useWrapper = p.props.useWrapper.default;
|
|
19
|
+
}
|
|
20
|
+
updated(l) {
|
|
21
|
+
super.updated(l);
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
const l = {
|
|
25
|
+
"pkt-inputwrapper": !0,
|
|
26
|
+
"pkt-inputwrapper--error": this.hasError,
|
|
27
|
+
"pkt-inputwrapper--disabled": this.disabled,
|
|
28
|
+
"pkt-inputwrapper--inline": this.inline
|
|
29
|
+
}, a = "pkt-tag pkt-tag--small pkt-tag--thin-text", d = this.ariaDescribedby ? this.ariaDescribedby : this.helptext ? `${this.forId}-helptext` : i, s = () => o`
|
|
30
|
+
${this.tagText ? o`<span class=${a + " pkt-tag--gray"}>${this.tagText}</span>` : i}
|
|
31
|
+
${this.optionalTag ? o`<span class=${a + " pkt-tag--blue-light"}>${this.optionalText}</span>` : i}
|
|
32
|
+
${this.requiredTag ? o`<span class=${a + " pkt-tag--beige"}>${this.requiredText}</span>` : i}
|
|
33
|
+
`, n = () => this.useWrapper ? this.hasFieldset ? o`<legend
|
|
34
|
+
class="pkt-inputwrapper__legend"
|
|
35
|
+
id="${this.forId}-label"
|
|
36
|
+
@click=${this.handleLabelClick}
|
|
37
|
+
>
|
|
38
|
+
${this.label} ${s()}
|
|
39
|
+
</legend>` : o`<label
|
|
40
|
+
class="pkt-inputwrapper__label"
|
|
41
|
+
for="${this.forId}"
|
|
42
|
+
aria-describedby="${d}"
|
|
43
|
+
id="${this.forId}-label"
|
|
44
|
+
@click=${this.handleLabelClick}
|
|
45
|
+
>${this.label}${s()}</label
|
|
46
|
+
>` : o`<label
|
|
47
|
+
for="${this.forId}"
|
|
48
|
+
class="pkt-sr-only"
|
|
49
|
+
aria-describedby="${d}"
|
|
50
|
+
id="${this.forId}-label"
|
|
51
|
+
>
|
|
52
|
+
${this.label}
|
|
53
|
+
</label>`, u = () => o`
|
|
54
|
+
<pkt-helptext
|
|
55
|
+
class="${m(this.useWrapper ? void 0 : "pkt-hide")}"
|
|
56
|
+
.forId=${this.forId}
|
|
57
|
+
.helptext=${this.helptext}
|
|
58
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
59
|
+
.helptextDropdownButton=${this.helptextDropdownButton || p.props.helptextDropdownButton.default}
|
|
60
|
+
@toggleHelpText=${($) => {
|
|
61
|
+
this.toggleDropdown($);
|
|
62
|
+
}}
|
|
63
|
+
>${y(this, "helptext")}</pkt-helptext>
|
|
64
|
+
`, c = () => this.counter ? o`<div class="pkt-input__counter" aria-live="polite" aria-atomic="true">
|
|
65
|
+
${this.counterError ? this.counterError : i} ${this.counterCurrent || 0}
|
|
66
|
+
${this.counterMaxLength ? `/${this.counterMaxLength}` : i}
|
|
67
|
+
</div>` : i, b = () => this.hasError && this.errorMessage ? o`<pkt-alert
|
|
68
|
+
skin="error"
|
|
69
|
+
compact
|
|
70
|
+
id=${`${this.forId}-error`}
|
|
71
|
+
aria-live="assertive"
|
|
72
|
+
aria-atomic="true"
|
|
73
|
+
>
|
|
74
|
+
${w(this.errorMessage)}
|
|
75
|
+
</pkt-alert>` : i, g = () => o`
|
|
76
|
+
${n()}
|
|
77
|
+
${u()}
|
|
78
|
+
${this.counterPosition === "top" ? c() : i}
|
|
79
|
+
<div class="pkt-contents">${y(this)}</div>
|
|
80
|
+
${this.counterPosition === "bottom" ? c() : i}
|
|
81
|
+
${b()}
|
|
82
|
+
`, f = () => this.hasFieldset ? o`<fieldset class="pkt-inputwrapper__fieldset" aria-describedby="${d}">
|
|
83
|
+
${g()}
|
|
84
|
+
</fieldset>` : o`<div class="pkt-inputwrapper__fieldset">${g()}</div>`;
|
|
85
|
+
return o`<div class=${v(l)}>${f()}</div> `;
|
|
86
|
+
}
|
|
87
|
+
toggleDropdown(l) {
|
|
88
|
+
this.dispatchEvent(
|
|
89
|
+
new CustomEvent("toggleHelpText", {
|
|
90
|
+
bubbles: !1,
|
|
91
|
+
detail: { isOpen: l.detail.isOpen }
|
|
92
|
+
})
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
handleLabelClick() {
|
|
96
|
+
this.dispatchEvent(
|
|
97
|
+
new CustomEvent("labelClick", {
|
|
98
|
+
bubbles: !0,
|
|
99
|
+
composed: !0,
|
|
100
|
+
detail: "label clicked"
|
|
101
|
+
})
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
r([
|
|
106
|
+
e({ type: String })
|
|
107
|
+
], t.prototype, "forId");
|
|
108
|
+
r([
|
|
109
|
+
e({ type: String })
|
|
110
|
+
], t.prototype, "label");
|
|
111
|
+
r([
|
|
112
|
+
e({ type: String })
|
|
113
|
+
], t.prototype, "helptext");
|
|
114
|
+
r([
|
|
115
|
+
e({ type: String })
|
|
116
|
+
], t.prototype, "helptextDropdown");
|
|
117
|
+
r([
|
|
118
|
+
e({ type: String })
|
|
119
|
+
], t.prototype, "helptextDropdownButton");
|
|
120
|
+
r([
|
|
121
|
+
e({ type: Boolean })
|
|
122
|
+
], t.prototype, "counter");
|
|
123
|
+
r([
|
|
124
|
+
e({ type: Number })
|
|
125
|
+
], t.prototype, "counterCurrent");
|
|
126
|
+
r([
|
|
127
|
+
e({ type: Number })
|
|
128
|
+
], t.prototype, "counterMaxLength");
|
|
129
|
+
r([
|
|
130
|
+
e({ type: String })
|
|
131
|
+
], t.prototype, "counterError");
|
|
132
|
+
r([
|
|
133
|
+
e({ type: String, reflect: !1 })
|
|
134
|
+
], t.prototype, "counterPosition");
|
|
135
|
+
r([
|
|
136
|
+
e({ type: Boolean })
|
|
137
|
+
], t.prototype, "optionalTag");
|
|
138
|
+
r([
|
|
139
|
+
e({ type: String })
|
|
140
|
+
], t.prototype, "optionalText");
|
|
141
|
+
r([
|
|
142
|
+
e({ type: Boolean })
|
|
143
|
+
], t.prototype, "requiredTag");
|
|
144
|
+
r([
|
|
145
|
+
e({ type: String })
|
|
146
|
+
], t.prototype, "requiredText");
|
|
147
|
+
r([
|
|
148
|
+
e({ type: String })
|
|
149
|
+
], t.prototype, "tagText");
|
|
150
|
+
r([
|
|
151
|
+
e({ type: Boolean })
|
|
152
|
+
], t.prototype, "hasError");
|
|
153
|
+
r([
|
|
154
|
+
e({ type: String })
|
|
155
|
+
], t.prototype, "errorMessage");
|
|
156
|
+
r([
|
|
157
|
+
e({ type: Boolean })
|
|
158
|
+
], t.prototype, "disabled");
|
|
159
|
+
r([
|
|
160
|
+
e({ type: Boolean })
|
|
161
|
+
], t.prototype, "inline");
|
|
162
|
+
r([
|
|
163
|
+
e({ type: String })
|
|
164
|
+
], t.prototype, "ariaDescribedby");
|
|
165
|
+
r([
|
|
166
|
+
e({ type: Boolean })
|
|
167
|
+
], t.prototype, "hasFieldset");
|
|
168
|
+
r([
|
|
169
|
+
e({ type: String, reflect: !0 })
|
|
170
|
+
], t.prototype, "role");
|
|
171
|
+
r([
|
|
172
|
+
e({ type: Boolean, reflect: !0, converter: E })
|
|
173
|
+
], t.prototype, "useWrapper");
|
|
174
|
+
try {
|
|
175
|
+
k("pkt-input-wrapper")(t);
|
|
176
|
+
} catch {
|
|
177
|
+
console.warn("Forsøker å definere <pkt-input-wrapper>, men den er allerede definert");
|
|
178
|
+
}
|
|
179
|
+
export {
|
|
180
|
+
t as P
|
|
181
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";const h=require("./element-with-slot-ZX-up7jO.cjs"),$=require("./if-defined-BOW3ODSj.cjs"),e=require("./element-gR_VtSiD.cjs"),f=require("./icon-q81vqPK_.cjs"),x=require("./class-map-CsENJXf1.cjs"),k=require("./utils-byXsEz1u.cjs"),w=require("./booleanish-BKVonob4.cjs"),s=require("./input-wrapper-EoSAbU-U.cjs");require("./helptext-DcRC7wW2.cjs");require("./alert-BtOk8yRH.cjs");var v=Object.defineProperty,r=(l,o,i,a)=>{for(var p=void 0,n=l.length-1,u;n>=0;n--)(u=l[n])&&(p=u(o,i,p)||p);return p&&v(o,i,p),p};class t extends h.PktElementWithSlot{constructor(){super(...arguments),this.forId=k.uuidish(),this.label="",this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=s.specs.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.counterError=null,this.counterPosition="bottom",this.optionalTag=s.specs.props.optionalTag.default,this.optionalText=s.specs.props.optionalText.default,this.requiredTag=s.specs.props.requiredTag.default,this.requiredText=s.specs.props.requiredText.default,this.tagText=null,this.hasError=s.specs.props.hasError.default,this.errorMessage="",this.disabled=s.specs.props.disabled.default,this.inline=s.specs.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=s.specs.props.hasFieldset.default,this.role="group",this.useWrapper=s.specs.props.useWrapper.default}updated(o){super.updated(o)}render(){const o={"pkt-inputwrapper":!0,"pkt-inputwrapper--error":this.hasError,"pkt-inputwrapper--disabled":this.disabled,"pkt-inputwrapper--inline":this.inline},i="pkt-tag pkt-tag--small pkt-tag--thin-text",a=this.ariaDescribedby?this.ariaDescribedby:this.helptext?`${this.forId}-helptext`:e.A,p=()=>e.b`
|
|
2
|
+
${this.tagText?e.b`<span class=${i+" pkt-tag--gray"}>${this.tagText}</span>`:e.A}
|
|
3
|
+
${this.optionalTag?e.b`<span class=${i+" pkt-tag--blue-light"}>${this.optionalText}</span>`:e.A}
|
|
4
|
+
${this.requiredTag?e.b`<span class=${i+" pkt-tag--beige"}>${this.requiredText}</span>`:e.A}
|
|
5
|
+
`,n=()=>this.useWrapper?this.hasFieldset?e.b`<legend
|
|
6
|
+
class="pkt-inputwrapper__legend"
|
|
7
|
+
id="${this.forId}-label"
|
|
8
|
+
@click=${this.handleLabelClick}
|
|
9
|
+
>
|
|
10
|
+
${this.label} ${p()}
|
|
11
|
+
</legend>`:e.b`<label
|
|
12
|
+
class="pkt-inputwrapper__label"
|
|
13
|
+
for="${this.forId}"
|
|
14
|
+
aria-describedby="${a}"
|
|
15
|
+
id="${this.forId}-label"
|
|
16
|
+
@click=${this.handleLabelClick}
|
|
17
|
+
>${this.label}${p()}</label
|
|
18
|
+
>`:e.b`<label
|
|
19
|
+
for="${this.forId}"
|
|
20
|
+
class="pkt-sr-only"
|
|
21
|
+
aria-describedby="${a}"
|
|
22
|
+
id="${this.forId}-label"
|
|
23
|
+
>
|
|
24
|
+
${this.label}
|
|
25
|
+
</label>`,u=()=>e.b`
|
|
26
|
+
<pkt-helptext
|
|
27
|
+
class="${$.o(this.useWrapper?void 0:"pkt-hide")}"
|
|
28
|
+
.forId=${this.forId}
|
|
29
|
+
.helptext=${this.helptext}
|
|
30
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
31
|
+
.helptextDropdownButton=${this.helptextDropdownButton||s.specs.props.helptextDropdownButton.default}
|
|
32
|
+
@toggleHelpText=${y=>{this.toggleDropdown(y)}}
|
|
33
|
+
>${h.slotContent(this,"helptext")}</pkt-helptext>
|
|
34
|
+
`,d=()=>this.counter?e.b`<div class="pkt-input__counter" aria-live="polite" aria-atomic="true">
|
|
35
|
+
${this.counterError?this.counterError:e.A} ${this.counterCurrent||0}
|
|
36
|
+
${this.counterMaxLength?`/${this.counterMaxLength}`:e.A}
|
|
37
|
+
</div>`:e.A,b=()=>this.hasError&&this.errorMessage?e.b`<pkt-alert
|
|
38
|
+
skin="error"
|
|
39
|
+
compact
|
|
40
|
+
id=${`${this.forId}-error`}
|
|
41
|
+
aria-live="assertive"
|
|
42
|
+
aria-atomic="true"
|
|
43
|
+
>
|
|
44
|
+
${f.o(this.errorMessage)}
|
|
45
|
+
</pkt-alert>`:e.A,c=()=>e.b`
|
|
46
|
+
${n()}
|
|
47
|
+
${u()}
|
|
48
|
+
${this.counterPosition==="top"?d():e.A}
|
|
49
|
+
<div class="pkt-contents">${h.slotContent(this)}</div>
|
|
50
|
+
${this.counterPosition==="bottom"?d():e.A}
|
|
51
|
+
${b()}
|
|
52
|
+
`,g=()=>this.hasFieldset?e.b`<fieldset class="pkt-inputwrapper__fieldset" aria-describedby="${a}">
|
|
53
|
+
${c()}
|
|
54
|
+
</fieldset>`:e.b`<div class="pkt-inputwrapper__fieldset">${c()}</div>`;return e.b`<div class=${x.e(o)}>${g()}</div> `}toggleDropdown(o){this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!1,detail:{isOpen:o.detail.isOpen}}))}handleLabelClick(){this.dispatchEvent(new CustomEvent("labelClick",{bubbles:!0,composed:!0,detail:"label clicked"}))}}r([e.n({type:String})],t.prototype,"forId");r([e.n({type:String})],t.prototype,"label");r([e.n({type:String})],t.prototype,"helptext");r([e.n({type:String})],t.prototype,"helptextDropdown");r([e.n({type:String})],t.prototype,"helptextDropdownButton");r([e.n({type:Boolean})],t.prototype,"counter");r([e.n({type:Number})],t.prototype,"counterCurrent");r([e.n({type:Number})],t.prototype,"counterMaxLength");r([e.n({type:String})],t.prototype,"counterError");r([e.n({type:String,reflect:!1})],t.prototype,"counterPosition");r([e.n({type:Boolean})],t.prototype,"optionalTag");r([e.n({type:String})],t.prototype,"optionalText");r([e.n({type:Boolean})],t.prototype,"requiredTag");r([e.n({type:String})],t.prototype,"requiredText");r([e.n({type:String})],t.prototype,"tagText");r([e.n({type:Boolean})],t.prototype,"hasError");r([e.n({type:String})],t.prototype,"errorMessage");r([e.n({type:Boolean})],t.prototype,"disabled");r([e.n({type:Boolean})],t.prototype,"inline");r([e.n({type:String})],t.prototype,"ariaDescribedby");r([e.n({type:Boolean})],t.prototype,"hasFieldset");r([e.n({type:String,reflect:!0})],t.prototype,"role");r([e.n({type:Boolean,reflect:!0,converter:w.booleanishConverter})],t.prototype,"useWrapper");try{e.t("pkt-input-wrapper")(t)}catch{console.warn("Forsøker å definere <pkt-input-wrapper>, men den er allerede definert")}exports.PktInputWrapper=t;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";const c=require("./element-with-slot-ZX-up7jO.cjs"),e=require("./element-gR_VtSiD.cjs"),h=require("./class-map-CsENJXf1.cjs");require("./icon-q81vqPK_.cjs");const f={href:{default:"#"},target:{default:"_self"}},p={props:f};var k=Object.defineProperty,n=(i,o,l,u)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(o,l,r)||r);return r&&k(o,l,r),r};class t extends c.PktElementWithSlot{constructor(){super(...arguments),this.href=p.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=!1,this.target=p.props.target.default}render(){const o={"pkt-link":!0,"pkt-link--icon-left":!!this.iconName&&this.iconPosition==="left"||!!(this.iconName&&!this.iconPosition),"pkt-link--icon-right":!!this.iconName&&this.iconPosition==="right","pkt-link--external":this.external};return e.b`<a
|
|
2
|
+
class=${h.e(o)}
|
|
3
|
+
href=${this.href}
|
|
4
|
+
.target=${this.target}
|
|
5
|
+
.rel=${this.external?"noopener noreferrer":e.A}
|
|
6
|
+
>${this.iconName?e.b`<pkt-icon name=${this.iconName} class="pkt-link__icon"></pkt-icon>`:""} <span>${c.slotContent(this)}</span></a
|
|
7
|
+
>`}}n([e.n({type:String,reflect:!0})],t.prototype,"href");n([e.n({type:String,reflect:!0})],t.prototype,"iconName");n([e.n({type:String,reflect:!0})],t.prototype,"iconPosition");n([e.n({type:Boolean,reflect:!0})],t.prototype,"external");n([e.n({type:String,reflect:!0})],t.prototype,"target");try{e.t("pkt-link")(t)}catch{console.warn("Forsøker å definere <pkt-link>, men den er allerede definert")}exports.PktLink=t;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { P as f, s as h } from "./element-with-slot-Dqk6-TRR.js";
|
|
2
|
+
import { t as k, A as m, b as l, n as r } from "./element-CPpT3rFQ.js";
|
|
3
|
+
import { e as u } from "./class-map-CEnykyO_.js";
|
|
4
|
+
import "./icon-CxQcIa5F.js";
|
|
5
|
+
const d = { href: { default: "#" }, target: { default: "_self" } }, c = {
|
|
6
|
+
props: d
|
|
7
|
+
};
|
|
8
|
+
var g = Object.defineProperty, i = (n, o, a, y) => {
|
|
9
|
+
for (var t = void 0, s = n.length - 1, p; s >= 0; s--)
|
|
10
|
+
(p = n[s]) && (t = p(o, a, t) || t);
|
|
11
|
+
return t && g(o, a, t), t;
|
|
12
|
+
};
|
|
13
|
+
class e extends f {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments), this.href = c.props.href.default, this.iconName = void 0, this.iconPosition = void 0, this.external = !1, this.target = c.props.target.default;
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
const o = {
|
|
19
|
+
"pkt-link": !0,
|
|
20
|
+
"pkt-link--icon-left": !!this.iconName && this.iconPosition === "left" || !!(this.iconName && !this.iconPosition),
|
|
21
|
+
"pkt-link--icon-right": !!this.iconName && this.iconPosition === "right",
|
|
22
|
+
"pkt-link--external": this.external
|
|
23
|
+
};
|
|
24
|
+
return l`<a
|
|
25
|
+
class=${u(o)}
|
|
26
|
+
href=${this.href}
|
|
27
|
+
.target=${this.target}
|
|
28
|
+
.rel=${this.external ? "noopener noreferrer" : m}
|
|
29
|
+
>${this.iconName ? l`<pkt-icon name=${this.iconName} class="pkt-link__icon"></pkt-icon>` : ""} <span>${h(this)}</span></a
|
|
30
|
+
>`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
i([
|
|
34
|
+
r({ type: String, reflect: !0 })
|
|
35
|
+
], e.prototype, "href");
|
|
36
|
+
i([
|
|
37
|
+
r({ type: String, reflect: !0 })
|
|
38
|
+
], e.prototype, "iconName");
|
|
39
|
+
i([
|
|
40
|
+
r({ type: String, reflect: !0 })
|
|
41
|
+
], e.prototype, "iconPosition");
|
|
42
|
+
i([
|
|
43
|
+
r({ type: Boolean, reflect: !0 })
|
|
44
|
+
], e.prototype, "external");
|
|
45
|
+
i([
|
|
46
|
+
r({ type: String, reflect: !0 })
|
|
47
|
+
], e.prototype, "target");
|
|
48
|
+
try {
|
|
49
|
+
k("pkt-link")(e);
|
|
50
|
+
} catch {
|
|
51
|
+
console.warn("Forsøker å definere <pkt-link>, men den er allerede definert");
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
e as P
|
|
55
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";const e=require("./element-gR_VtSiD.cjs"),p=require("./element-with-slot-ZX-up7jO.cjs");require("./icon-q81vqPK_.cjs");const c=require("./if-defined-BOW3ODSj.cjs");var k=Object.defineProperty,r=(i,l,s,f)=>{for(var n=void 0,o=i.length-1,a;o>=0;o--)(a=i[o])&&(n=a(l,s,n)||n);return n&&k(l,s,n),n};class t extends p.PktElementWithSlot{constructor(){super(...arguments),this.title="",this.href="#",this.iconName="",this.external=!1,this.openInNewTab=!1,this.skin="normal"}render(){const l=["pkt-linkcard",this.skin&&`pkt-linkcard--${this.skin}`].filter(Boolean).join(" "),s=["pkt-linkcard__title",this.external&&"pkt-link pkt-link--external"].filter(Boolean).join(" ");return e.b`
|
|
2
|
+
<a
|
|
3
|
+
href=${this.href}
|
|
4
|
+
class=${l}
|
|
5
|
+
target=${this.openInNewTab?"_blank":"_self"}
|
|
6
|
+
rel=${c.o(this.openInNewTab?"noopener noreferrer":void 0)}
|
|
7
|
+
>
|
|
8
|
+
${this.iconName&&e.b`<pkt-icon class="pkt-link__icon" name="${this.iconName}" />`}
|
|
9
|
+
${this.title&&e.b`<div class=${s}>${this.title}</div>`}
|
|
10
|
+
|
|
11
|
+
<div class="pkt-linkcard__text">${p.slotContent(this)}</div>
|
|
12
|
+
</a>
|
|
13
|
+
`}}r([e.n({type:String,reflect:!0})],t.prototype,"title");r([e.n({type:String,reflect:!0})],t.prototype,"href");r([e.n({type:String,reflect:!0})],t.prototype,"iconName");r([e.n({type:Boolean,reflect:!0})],t.prototype,"external");r([e.n({type:Boolean,reflect:!0})],t.prototype,"openInNewTab");r([e.n({type:String,reflect:!0})],t.prototype,"skin");try{e.t("pkt-linkcard")(t)}catch{console.warn("Forsøker å definere <pkt-linkcard>, men den er allerede definert")}exports.PktLinkCard=t;
|