@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,31 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("./element-gR_VtSiD.cjs"),r=require("./state-Dg-53wQ8.cjs"),u=require("./input-element-DdVhUvva.cjs"),h=require("./ref-CL-Xk9Xm.cjs"),c=require("./class-map-CsENJXf1.cjs");var d=Object.defineProperty,k=Object.getOwnPropertyDescriptor,i=(p,e,n,a)=>{for(var s=a>1?void 0:a?k(e,n):e,o=p.length-1,l;o>=0;o--)(l=p[o])&&(s=(a?l(e,n,s):l(s))||s);return a&&s&&d(e,n,s),s};exports.PktRadioButton=class extends u.PktInputElement{constructor(){super(...arguments),this.inputRef=h.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,n,a){e==="defaultChecked"&&(this._checked=this.defaultChecked),e==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(e,n,a)}render(){const e=c.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),n=c.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),a=c.e({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-sr-only":this.hideLabel}),s="pkt-tag pkt-tag--small pkt-tag--thin-text",o=()=>t.b`
|
|
2
|
-
${this.tagText?t.b`<span class=${s+" pkt-tag--gray"}>${this.tagText}</span>`:t.A}
|
|
3
|
-
${this.optionalTag?t.b`<span class=${s+" pkt-tag--blue-light"}>${this.optionalText}</span>`:t.A}
|
|
4
|
-
${this.requiredTag?t.b`<span class=${s+" pkt-tag--beige"}>${this.requiredText}</span>`:t.A}
|
|
5
|
-
`,l=()=>t.b`
|
|
6
|
-
<label class=${a} for=${this.id+"-internal"}>
|
|
7
|
-
${this.label} ${o()}
|
|
8
|
-
${this.checkHelptext?t.b`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>`:t.A}
|
|
9
|
-
</label>
|
|
10
|
-
`;return t.b`
|
|
11
|
-
<div class="pkt-input-check">
|
|
12
|
-
<div class=${e}>
|
|
13
|
-
<input
|
|
14
|
-
id=${this.id+"-internal"}
|
|
15
|
-
class=${n}
|
|
16
|
-
type="radio"
|
|
17
|
-
role="radio"
|
|
18
|
-
?disabled=${this.disabled}
|
|
19
|
-
form=""
|
|
20
|
-
name=${this.name+"-internal"}
|
|
21
|
-
${h.n(this.inputRef)}
|
|
22
|
-
@change=${this.toggleChecked}
|
|
23
|
-
@input=${this.onInput}
|
|
24
|
-
@blur=${this.onBlur}
|
|
25
|
-
@focus=${this.onFocus}
|
|
26
|
-
?checked=${this.checked}
|
|
27
|
-
/>
|
|
28
|
-
${l()}
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
`}toggleChecked(e=null){e&&e.preventDefault(),e&&e.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this._checked=this.inputRef.value.matches(":checked"),this.valueChecked(this._checked))}};i([t.n({type:String,reflect:!0})],exports.PktRadioButton.prototype,"value",2);i([t.n({type:String})],exports.PktRadioButton.prototype,"checkHelptext",2);i([t.n({type:Boolean})],exports.PktRadioButton.prototype,"defaultChecked",2);i([t.n({type:Boolean})],exports.PktRadioButton.prototype,"hasTile",2);i([t.n({type:Boolean,reflect:!0})],exports.PktRadioButton.prototype,"checked",2);i([t.n({type:String,reflect:!0})],exports.PktRadioButton.prototype,"type",2);i([t.n({type:String})],exports.PktRadioButton.prototype,"tagText",2);i([t.n({type:Boolean})],exports.PktRadioButton.prototype,"optionalTag",2);i([t.n({type:String})],exports.PktRadioButton.prototype,"optionalText",2);i([t.n({type:Boolean})],exports.PktRadioButton.prototype,"requiredTag",2);i([t.n({type:String})],exports.PktRadioButton.prototype,"requiredText",2);i([r.r()],exports.PktRadioButton.prototype,"_checked",2);exports.PktRadioButton=i([t.t("pkt-radiobutton")],exports.PktRadioButton);
|
package/dist/select-CXZt1nHS.js
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import { n as u, b as a, t as v } from "./element-CPpT3rFQ.js";
|
|
2
|
-
import { e as f, n as _ } from "./ref-Bg_Swj5w.js";
|
|
3
|
-
import { o as l } from "./if-defined-B0krMLad.js";
|
|
4
|
-
import { r as $ } from "./state-C_1EOo3D.js";
|
|
5
|
-
import { P as x } from "./input-element-8nLwuQS4.js";
|
|
6
|
-
import { P as m } from "./pkt-options-controller-B5YalfCb.js";
|
|
7
|
-
import { s as b } from "./element-with-slot-Dqk6-TRR.js";
|
|
8
|
-
import "./input-wrapper-B2JpK016.js";
|
|
9
|
-
var g = Object.defineProperty, d = (e, t, s, o) => {
|
|
10
|
-
for (var i = void 0, n = e.length - 1, p; n >= 0; n--)
|
|
11
|
-
(p = e[n]) && (i = p(t, s, i) || i);
|
|
12
|
-
return i && g(t, s, i), i;
|
|
13
|
-
};
|
|
14
|
-
class h extends x {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(...arguments), this._optionsProp = [], this._options = [];
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Public getter for options that includes selected state
|
|
20
|
-
* Override this in subclasses to customize the selected state logic
|
|
21
|
-
*/
|
|
22
|
-
get options() {
|
|
23
|
-
return this._options.map((t) => ({
|
|
24
|
-
...t,
|
|
25
|
-
selected: this.isOptionSelected(t)
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Public setter for options
|
|
30
|
-
*/
|
|
31
|
-
set options(t) {
|
|
32
|
-
this._optionsProp = t, this.requestUpdate("_optionsProp", this._options);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Determines if an option is selected
|
|
36
|
-
* Subclasses should override this to implement their selection logic
|
|
37
|
-
*
|
|
38
|
-
* @param option - The option to check
|
|
39
|
-
* @returns True if the option is selected
|
|
40
|
-
* @protected
|
|
41
|
-
*/
|
|
42
|
-
isOptionSelected(t) {
|
|
43
|
-
return Array.isArray(this.value) ? this.value.includes(t.value) : t.value === this.value;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Finds an option by its value
|
|
47
|
-
*
|
|
48
|
-
* @param value - The value to search for
|
|
49
|
-
* @returns The option if found, undefined otherwise
|
|
50
|
-
* @protected
|
|
51
|
-
*/
|
|
52
|
-
findOptionByValue(t) {
|
|
53
|
-
return this._options.find((s) => s.value === t);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Gets all currently selected options
|
|
57
|
-
*
|
|
58
|
-
* @returns Array of selected options
|
|
59
|
-
* @protected
|
|
60
|
-
*/
|
|
61
|
-
getSelectedOptions() {
|
|
62
|
-
return this._options.filter((t) => this.isOptionSelected(t));
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Parses options from either props or slot controller
|
|
66
|
-
* Call this in connectedCallback to initialize options
|
|
67
|
-
*
|
|
68
|
-
* @protected
|
|
69
|
-
*/
|
|
70
|
-
parseOptions() {
|
|
71
|
-
var o, i;
|
|
72
|
-
const t = this._optionsProp.length > 0, s = ((i = (o = this.optionsController) == null ? void 0 : o.nodes) == null ? void 0 : i.length) && this.optionsController.nodes.length > 0;
|
|
73
|
-
t ? this._options = this._optionsProp : s && (this._options = this.optionsController.options);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Re-parse options when the component updates
|
|
77
|
-
* This ensures options stay in sync when they change dynamically
|
|
78
|
-
*
|
|
79
|
-
* @protected
|
|
80
|
-
*/
|
|
81
|
-
willUpdate(t) {
|
|
82
|
-
super.willUpdate(t), this.parseOptions();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
d([
|
|
86
|
-
u({ type: Array, attribute: "options" })
|
|
87
|
-
], h.prototype, "_optionsProp");
|
|
88
|
-
d([
|
|
89
|
-
$()
|
|
90
|
-
], h.prototype, "_options");
|
|
91
|
-
var O = Object.defineProperty, P = Object.getOwnPropertyDescriptor, c = (e, t, s, o) => {
|
|
92
|
-
for (var i = o > 1 ? void 0 : o ? P(t, s) : t, n = e.length - 1, p; n >= 0; n--)
|
|
93
|
-
(p = e[n]) && (i = (o ? p(t, s, i) : p(i)) || i);
|
|
94
|
-
return o && i && O(t, s, i), i;
|
|
95
|
-
};
|
|
96
|
-
let r = class extends h {
|
|
97
|
-
constructor() {
|
|
98
|
-
super(), this.inputRef = f(), this.value = "", this.selectedIndex = -1, this.selectedOptions = void 0, this.optionsController = new m(this);
|
|
99
|
-
}
|
|
100
|
-
connectedCallback() {
|
|
101
|
-
super.connectedCallback(), this.parseOptions(), this._options.forEach((e) => {
|
|
102
|
-
e.selected && !this.value && (this.value = e.value);
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
// Support native Select method `add`
|
|
106
|
-
add(e, t) {
|
|
107
|
-
const s = {
|
|
108
|
-
value: e.value || e.text,
|
|
109
|
-
label: e.text || e.value,
|
|
110
|
-
selected: e.selected,
|
|
111
|
-
disabled: e.disabled
|
|
112
|
-
};
|
|
113
|
-
if (t === void 0)
|
|
114
|
-
this._options.push(s);
|
|
115
|
-
else if (typeof t == "number")
|
|
116
|
-
this._options.splice(t, 0, s);
|
|
117
|
-
else {
|
|
118
|
-
const o = t.value || t.text, i = this._options.findIndex((n) => n.value === o);
|
|
119
|
-
i >= 0 ? this._options.splice(i, 0, s) : this._options.push(s);
|
|
120
|
-
}
|
|
121
|
-
e.selected && (this.value = e.value || e.text, this.selectedIndex = this._options.findIndex((o) => o.value === this.value)), this.requestUpdate();
|
|
122
|
-
}
|
|
123
|
-
// Support native Select method `remove`
|
|
124
|
-
remove(e) {
|
|
125
|
-
var t;
|
|
126
|
-
typeof e == "number" && (this.selectedIndex === e && (this.value = ((t = this._options[0]) == null ? void 0 : t.value) || ""), this._options.splice(e, 1), this.requestUpdate());
|
|
127
|
-
}
|
|
128
|
-
// Support native Select method `item`
|
|
129
|
-
item(e) {
|
|
130
|
-
var t;
|
|
131
|
-
return (t = this.inputRef.value) == null ? void 0 : t.item(e);
|
|
132
|
-
}
|
|
133
|
-
// Support native Select method `namedItem`
|
|
134
|
-
namedItem(e) {
|
|
135
|
-
var t;
|
|
136
|
-
return (t = this.inputRef.value) == null ? void 0 : t.namedItem(e);
|
|
137
|
-
}
|
|
138
|
-
// Support native Select method `showPicker`
|
|
139
|
-
showPicker() {
|
|
140
|
-
this.inputRef.value && "showPicker" in this.inputRef.value && this.inputRef.value.showPicker();
|
|
141
|
-
}
|
|
142
|
-
attributeChangedCallback(e, t, s) {
|
|
143
|
-
var o, i;
|
|
144
|
-
e === "options" && (this._options = s ? JSON.parse(s) : []), e === "value" && this.value !== t && (this.selectedIndex = this.touched ? this.returnNumberOrNull((o = this.inputRef.value) == null ? void 0 : o.selectedIndex) : this._options.findIndex((n) => n.value === s), this.selectedOptions = (i = this.inputRef.value) == null ? void 0 : i.selectedOptions, this.valueChanged(s, t)), super.attributeChangedCallback(e, t, s);
|
|
145
|
-
}
|
|
146
|
-
update(e) {
|
|
147
|
-
var t, s;
|
|
148
|
-
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((t = this.inputRef.value) == null ? void 0 : t.selectedIndex) : this._options.findIndex((o) => o.value === this.value), this.selectedOptions = (s = this.inputRef.value) == null ? void 0 : s.selectedOptions, this.valueChanged(this.value, e.get("value"))), e.has("id") && !this.name && this.id && (this.name = this.id);
|
|
149
|
-
}
|
|
150
|
-
firstUpdated(e) {
|
|
151
|
-
var t;
|
|
152
|
-
super.firstUpdated(e), 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((s) => s.value === this.value), this.selectedOptions = (t = this.inputRef.value) == null ? void 0 : t.selectedOptions;
|
|
153
|
-
}
|
|
154
|
-
render() {
|
|
155
|
-
const e = `pkt-input ${this.fullwidth ? "pkt-input--fullwidth" : ""}`;
|
|
156
|
-
return a`
|
|
157
|
-
<pkt-input-wrapper
|
|
158
|
-
?counter=${this.counter}
|
|
159
|
-
?disabled=${this.disabled}
|
|
160
|
-
?hasError=${this.hasError}
|
|
161
|
-
?hasFieldset=${this.hasFieldset}
|
|
162
|
-
?inline=${this.inline}
|
|
163
|
-
?optionalTag=${this.optionalTag}
|
|
164
|
-
?requiredTag=${this.requiredTag}
|
|
165
|
-
useWrapper=${this.useWrapper}
|
|
166
|
-
ariaDescribedBy=${l(this.ariaDescribedBy)}
|
|
167
|
-
class="pkt-select"
|
|
168
|
-
errorMessage=${l(this.errorMessage)}
|
|
169
|
-
forId=${this.id + "-input"}
|
|
170
|
-
helptext=${l(this.helptext)}
|
|
171
|
-
helptextDropdown=${l(this.helptextDropdown)}
|
|
172
|
-
helptextDropdownButton=${l(this.helptextDropdownButton)}
|
|
173
|
-
label=${l(this.label)}
|
|
174
|
-
optionalText=${l(this.optionalText)}
|
|
175
|
-
requiredText=${l(this.requiredText)}
|
|
176
|
-
tagText=${l(this.tagText)}
|
|
177
|
-
>
|
|
178
|
-
<select
|
|
179
|
-
class=${e}
|
|
180
|
-
aria-invalid=${this.hasError}
|
|
181
|
-
aria-errormessage=${`${this.id}-error`}
|
|
182
|
-
aria-labelledby=${l(this.ariaLabelledby)}
|
|
183
|
-
?disabled=${this.disabled}
|
|
184
|
-
id=${this.id + "-input"}
|
|
185
|
-
name=${(this.name || this.id) + "-input"}
|
|
186
|
-
value=${this.value}
|
|
187
|
-
@change=${(t) => {
|
|
188
|
-
this.touched = !0, this.value = t.target.value, t.stopImmediatePropagation();
|
|
189
|
-
}}
|
|
190
|
-
@input=${(t) => {
|
|
191
|
-
this.onInput(), t.stopImmediatePropagation();
|
|
192
|
-
}}
|
|
193
|
-
@focus=${(t) => {
|
|
194
|
-
this.onFocus(), t.stopImmediatePropagation();
|
|
195
|
-
}}
|
|
196
|
-
@blur=${(t) => {
|
|
197
|
-
this.onBlur(), t.stopImmediatePropagation();
|
|
198
|
-
}}
|
|
199
|
-
${_(this.inputRef)}
|
|
200
|
-
>
|
|
201
|
-
${this._options.length > 0 ? this._options.map(
|
|
202
|
-
(t) => a`<option
|
|
203
|
-
value=${t.value}
|
|
204
|
-
?selected=${this.value == t.value || t.selected}
|
|
205
|
-
?disabled=${t.disabled}
|
|
206
|
-
?hidden=${t.hidden}
|
|
207
|
-
>
|
|
208
|
-
${t.label}
|
|
209
|
-
</option>`
|
|
210
|
-
) : ""}
|
|
211
|
-
</select>
|
|
212
|
-
<div class="pkt-contents" slot="helptext">${b(this, "helptext")}</div>
|
|
213
|
-
</pkt-input-wrapper>
|
|
214
|
-
`;
|
|
215
|
-
}
|
|
216
|
-
returnNumberOrNull(e) {
|
|
217
|
-
return e == null || isNaN(e) ? null : e;
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
c([
|
|
221
|
-
u({ type: String })
|
|
222
|
-
], r.prototype, "value", 2);
|
|
223
|
-
r = c([
|
|
224
|
-
v("pkt-select")
|
|
225
|
-
], r);
|
|
226
|
-
export {
|
|
227
|
-
r as P
|
|
228
|
-
};
|
package/dist/select-WFhS4Vfp.cjs
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";const p=require("./element-gR_VtSiD.cjs"),a=require("./ref-CL-Xk9Xm.cjs"),l=require("./if-defined-BOW3ODSj.cjs"),c=require("./state-Dg-53wQ8.cjs"),v=require("./input-element-DdVhUvva.cjs"),f=require("./pkt-options-controller-5LXbEzuk.cjs"),_=require("./element-with-slot-ZX-up7jO.cjs");require("./input-wrapper-B0MkQ0IZ.cjs");var $=Object.defineProperty,u=(r,t,e,i)=>{for(var s=void 0,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=n(t,e,s)||s);return s&&$(t,e,s),s};class h extends v.PktInputElement{constructor(){super(...arguments),this._optionsProp=[],this._options=[]}get options(){return this._options.map(t=>({...t,selected:this.isOptionSelected(t)}))}set options(t){this._optionsProp=t,this.requestUpdate("_optionsProp",this._options)}isOptionSelected(t){return Array.isArray(this.value)?this.value.includes(t.value):t.value===this.value}findOptionByValue(t){return this._options.find(e=>e.value===t)}getSelectedOptions(){return this._options.filter(t=>this.isOptionSelected(t))}parseOptions(){var i,s;const t=this._optionsProp.length>0,e=((s=(i=this.optionsController)==null?void 0:i.nodes)==null?void 0:s.length)&&this.optionsController.nodes.length>0;t?this._options=this._optionsProp:e&&(this._options=this.optionsController.options)}willUpdate(t){super.willUpdate(t),this.parseOptions()}}u([p.n({type:Array,attribute:"options"})],h.prototype,"_optionsProp");u([c.r()],h.prototype,"_options");var x=Object.defineProperty,b=Object.getOwnPropertyDescriptor,d=(r,t,e,i)=>{for(var s=i>1?void 0:i?b(t,e):t,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&x(t,e,s),s};exports.PktSelect=class extends h{constructor(){super(),this.inputRef=a.e(),this.value="",this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new f.PktOptionsSlotController(this)}connectedCallback(){super.connectedCallback(),this.parseOptions(),this._options.forEach(t=>{t.selected&&!this.value&&(this.value=t.value)})}add(t,e){const i={value:t.value||t.text,label:t.text||t.value,selected:t.selected,disabled:t.disabled};if(e===void 0)this._options.push(i);else if(typeof e=="number")this._options.splice(e,0,i);else{const s=e.value||e.text,o=this._options.findIndex(n=>n.value===s);o>=0?this._options.splice(o,0,i):this._options.push(i)}t.selected&&(this.value=t.value||t.text,this.selectedIndex=this._options.findIndex(s=>s.value===this.value)),this.requestUpdate()}remove(t){var e;typeof t=="number"&&(this.selectedIndex===t&&(this.value=((e=this._options[0])==null?void 0:e.value)||""),this._options.splice(t,1),this.requestUpdate())}item(t){var e;return(e=this.inputRef.value)==null?void 0:e.item(t)}namedItem(t){var e;return(e=this.inputRef.value)==null?void 0:e.namedItem(t)}showPicker(){this.inputRef.value&&"showPicker"in this.inputRef.value&&this.inputRef.value.showPicker()}attributeChangedCallback(t,e,i){var s,o;t==="options"&&(this._options=i?JSON.parse(i):[]),t==="value"&&this.value!==e&&(this.selectedIndex=this.touched?this.returnNumberOrNull((s=this.inputRef.value)==null?void 0:s.selectedIndex):this._options.findIndex(n=>n.value===i),this.selectedOptions=(o=this.inputRef.value)==null?void 0:o.selectedOptions,this.valueChanged(i,e)),super.attributeChangedCallback(t,e,i)}update(t){var e,i;super.update(t),t.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)),t.has("value")&&this.value!==t.get("value")&&(this.selectedIndex=this.touched?this.returnNumberOrNull((e=this.inputRef.value)==null?void 0:e.selectedIndex):this._options.findIndex(s=>s.value===this.value),this.selectedOptions=(i=this.inputRef.value)==null?void 0:i.selectedOptions,this.valueChanged(this.value,t.get("value"))),t.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(t){var e;super.firstUpdated(t),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(i=>i.value===this.value),this.selectedOptions=(e=this.inputRef.value)==null?void 0:e.selectedOptions}render(){const t=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return p.b`
|
|
2
|
-
<pkt-input-wrapper
|
|
3
|
-
?counter=${this.counter}
|
|
4
|
-
?disabled=${this.disabled}
|
|
5
|
-
?hasError=${this.hasError}
|
|
6
|
-
?hasFieldset=${this.hasFieldset}
|
|
7
|
-
?inline=${this.inline}
|
|
8
|
-
?optionalTag=${this.optionalTag}
|
|
9
|
-
?requiredTag=${this.requiredTag}
|
|
10
|
-
useWrapper=${this.useWrapper}
|
|
11
|
-
ariaDescribedBy=${l.o(this.ariaDescribedBy)}
|
|
12
|
-
class="pkt-select"
|
|
13
|
-
errorMessage=${l.o(this.errorMessage)}
|
|
14
|
-
forId=${this.id+"-input"}
|
|
15
|
-
helptext=${l.o(this.helptext)}
|
|
16
|
-
helptextDropdown=${l.o(this.helptextDropdown)}
|
|
17
|
-
helptextDropdownButton=${l.o(this.helptextDropdownButton)}
|
|
18
|
-
label=${l.o(this.label)}
|
|
19
|
-
optionalText=${l.o(this.optionalText)}
|
|
20
|
-
requiredText=${l.o(this.requiredText)}
|
|
21
|
-
tagText=${l.o(this.tagText)}
|
|
22
|
-
>
|
|
23
|
-
<select
|
|
24
|
-
class=${t}
|
|
25
|
-
aria-invalid=${this.hasError}
|
|
26
|
-
aria-errormessage=${`${this.id}-error`}
|
|
27
|
-
aria-labelledby=${l.o(this.ariaLabelledby)}
|
|
28
|
-
?disabled=${this.disabled}
|
|
29
|
-
id=${this.id+"-input"}
|
|
30
|
-
name=${(this.name||this.id)+"-input"}
|
|
31
|
-
value=${this.value}
|
|
32
|
-
@change=${e=>{this.touched=!0,this.value=e.target.value,e.stopImmediatePropagation()}}
|
|
33
|
-
@input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
|
|
34
|
-
@focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
|
|
35
|
-
@blur=${e=>{this.onBlur(),e.stopImmediatePropagation()}}
|
|
36
|
-
${a.n(this.inputRef)}
|
|
37
|
-
>
|
|
38
|
-
${this._options.length>0?this._options.map(e=>p.b`<option
|
|
39
|
-
value=${e.value}
|
|
40
|
-
?selected=${this.value==e.value||e.selected}
|
|
41
|
-
?disabled=${e.disabled}
|
|
42
|
-
?hidden=${e.hidden}
|
|
43
|
-
>
|
|
44
|
-
${e.label}
|
|
45
|
-
</option>`):""}
|
|
46
|
-
</select>
|
|
47
|
-
<div class="pkt-contents" slot="helptext">${_.slotContent(this,"helptext")}</div>
|
|
48
|
-
</pkt-input-wrapper>
|
|
49
|
-
`}returnNumberOrNull(t){return t==null||isNaN(t)?null:t}};d([p.n({type:String})],exports.PktSelect.prototype,"value",2);exports.PktSelect=d([p.t("pkt-select")],exports.PktSelect);
|
package/dist/tabitem-CB8wkKmv.js
DELETED
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
import { P as k, s as $ } from "./element-with-slot-Dqk6-TRR.js";
|
|
2
|
-
import { b as p, n as h, t as y } from "./element-CPpT3rFQ.js";
|
|
3
|
-
import { r as f } from "./state-C_1EOo3D.js";
|
|
4
|
-
import { e as _, n as w } from "./ref-Bg_Swj5w.js";
|
|
5
|
-
import { o as u } from "./if-defined-B0krMLad.js";
|
|
6
|
-
/**
|
|
7
|
-
* @license
|
|
8
|
-
* Copyright 2021 Google LLC
|
|
9
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
10
|
-
*/
|
|
11
|
-
let C = class extends Event {
|
|
12
|
-
constructor(t, s, i, e) {
|
|
13
|
-
super("context-request", { bubbles: !0, composed: !0 }), this.context = t, this.contextTarget = s, this.callback = i, this.subscribe = e ?? !1;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* @license
|
|
18
|
-
* Copyright 2021 Google LLC
|
|
19
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* @license
|
|
23
|
-
* Copyright 2021 Google LLC
|
|
24
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
-
*/
|
|
26
|
-
let m = class {
|
|
27
|
-
constructor(t, s, i, e) {
|
|
28
|
-
if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (n, r) => {
|
|
29
|
-
this.unsubscribe && (this.unsubscribe !== r && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = n, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(n, r)), this.unsubscribe = r;
|
|
30
|
-
}, this.host = t, s.context !== void 0) {
|
|
31
|
-
const n = s;
|
|
32
|
-
this.context = n.context, this.callback = n.callback, this.subscribe = n.subscribe ?? !1;
|
|
33
|
-
} else this.context = s, this.callback = i, this.subscribe = e ?? !1;
|
|
34
|
-
this.host.addController(this);
|
|
35
|
-
}
|
|
36
|
-
hostConnected() {
|
|
37
|
-
this.dispatchRequest();
|
|
38
|
-
}
|
|
39
|
-
hostDisconnected() {
|
|
40
|
-
this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0);
|
|
41
|
-
}
|
|
42
|
-
dispatchRequest() {
|
|
43
|
-
this.host.dispatchEvent(new C(this.context, this.host, this.t, this.subscribe));
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* @license
|
|
48
|
-
* Copyright 2021 Google LLC
|
|
49
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
50
|
-
*/
|
|
51
|
-
class N {
|
|
52
|
-
get value() {
|
|
53
|
-
return this.o;
|
|
54
|
-
}
|
|
55
|
-
set value(t) {
|
|
56
|
-
this.setValue(t);
|
|
57
|
-
}
|
|
58
|
-
setValue(t, s = !1) {
|
|
59
|
-
const i = s || !Object.is(t, this.o);
|
|
60
|
-
this.o = t, i && this.updateObservers();
|
|
61
|
-
}
|
|
62
|
-
constructor(t) {
|
|
63
|
-
this.subscriptions = /* @__PURE__ */ new Map(), this.updateObservers = () => {
|
|
64
|
-
for (const [s, { disposer: i }] of this.subscriptions) s(this.o, i);
|
|
65
|
-
}, t !== void 0 && (this.value = t);
|
|
66
|
-
}
|
|
67
|
-
addCallback(t, s, i) {
|
|
68
|
-
if (!i) return void t(this.value);
|
|
69
|
-
this.subscriptions.has(t) || this.subscriptions.set(t, { disposer: () => {
|
|
70
|
-
this.subscriptions.delete(t);
|
|
71
|
-
}, consumerHost: s });
|
|
72
|
-
const { disposer: e } = this.subscriptions.get(t);
|
|
73
|
-
t(this.value, e);
|
|
74
|
-
}
|
|
75
|
-
clearCallbacks() {
|
|
76
|
-
this.subscriptions.clear();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* @license
|
|
81
|
-
* Copyright 2021 Google LLC
|
|
82
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
83
|
-
*/
|
|
84
|
-
let R = class extends Event {
|
|
85
|
-
constructor(t, s) {
|
|
86
|
-
super("context-provider", { bubbles: !0, composed: !0 }), this.context = t, this.contextTarget = s;
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
class g extends N {
|
|
90
|
-
constructor(t, s, i) {
|
|
91
|
-
var e, n;
|
|
92
|
-
super(s.context !== void 0 ? s.initialValue : i), this.onContextRequest = (r) => {
|
|
93
|
-
if (r.context !== this.context) return;
|
|
94
|
-
const a = r.contextTarget ?? r.composedPath()[0];
|
|
95
|
-
a !== this.host && (r.stopPropagation(), this.addCallback(r.callback, a, r.subscribe));
|
|
96
|
-
}, this.onProviderRequest = (r) => {
|
|
97
|
-
if (r.context !== this.context || (r.contextTarget ?? r.composedPath()[0]) === this.host) return;
|
|
98
|
-
const a = /* @__PURE__ */ new Set();
|
|
99
|
-
for (const [v, { consumerHost: x }] of this.subscriptions) a.has(v) || (a.add(v), x.dispatchEvent(new C(this.context, x, v, !0)));
|
|
100
|
-
r.stopPropagation();
|
|
101
|
-
}, this.host = t, s.context !== void 0 ? this.context = s.context : this.context = s, this.attachListeners(), (n = (e = this.host).addController) == null || n.call(e, this);
|
|
102
|
-
}
|
|
103
|
-
attachListeners() {
|
|
104
|
-
this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
|
|
105
|
-
}
|
|
106
|
-
hostConnected() {
|
|
107
|
-
this.host.dispatchEvent(new R(this.context, this.host));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* @license
|
|
112
|
-
* Copyright 2017 Google LLC
|
|
113
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
114
|
-
*/
|
|
115
|
-
function A({ context: o }) {
|
|
116
|
-
return (t, s) => {
|
|
117
|
-
const i = /* @__PURE__ */ new WeakMap();
|
|
118
|
-
if (typeof s == "object") return { get() {
|
|
119
|
-
return t.get.call(this);
|
|
120
|
-
}, set(e) {
|
|
121
|
-
return i.get(this).setValue(e), t.set.call(this, e);
|
|
122
|
-
}, init(e) {
|
|
123
|
-
return i.set(this, new g(this, { context: o, initialValue: e })), e;
|
|
124
|
-
} };
|
|
125
|
-
{
|
|
126
|
-
t.constructor.addInitializer(((r) => {
|
|
127
|
-
i.set(r, new g(r, { context: o }));
|
|
128
|
-
}));
|
|
129
|
-
const e = Object.getOwnPropertyDescriptor(t, s);
|
|
130
|
-
let n;
|
|
131
|
-
if (e === void 0) {
|
|
132
|
-
const r = /* @__PURE__ */ new WeakMap();
|
|
133
|
-
n = { get() {
|
|
134
|
-
return r.get(this);
|
|
135
|
-
}, set(a) {
|
|
136
|
-
i.get(this).setValue(a), r.set(this, a);
|
|
137
|
-
}, configurable: !0, enumerable: !0 };
|
|
138
|
-
} else {
|
|
139
|
-
const r = e.set;
|
|
140
|
-
n = { ...e, set(a) {
|
|
141
|
-
i.get(this).setValue(a), r == null || r.call(this, a);
|
|
142
|
-
} };
|
|
143
|
-
}
|
|
144
|
-
return void Object.defineProperty(t, s, n);
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* @license
|
|
150
|
-
* Copyright 2022 Google LLC
|
|
151
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
152
|
-
*/
|
|
153
|
-
function O({ context: o, subscribe: t }) {
|
|
154
|
-
return (s, i) => {
|
|
155
|
-
typeof i == "object" ? i.addInitializer((function() {
|
|
156
|
-
new m(this, { context: o, callback: (e) => {
|
|
157
|
-
s.set.call(this, e);
|
|
158
|
-
}, subscribe: t });
|
|
159
|
-
})) : s.constructor.addInitializer(((e) => {
|
|
160
|
-
new m(e, { context: o, callback: (n) => {
|
|
161
|
-
e[i] = n;
|
|
162
|
-
}, subscribe: t });
|
|
163
|
-
}));
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
const P = Symbol("pkt-tabs-context");
|
|
167
|
-
var S = Object.defineProperty, T = Object.getOwnPropertyDescriptor, d = (o, t, s, i) => {
|
|
168
|
-
for (var e = i > 1 ? void 0 : i ? T(t, s) : t, n = o.length - 1, r; n >= 0; n--)
|
|
169
|
-
(r = o[n]) && (e = (i ? r(t, s, e) : r(e)) || e);
|
|
170
|
-
return i && e && S(t, s, e), e;
|
|
171
|
-
};
|
|
172
|
-
let b = class extends k {
|
|
173
|
-
constructor() {
|
|
174
|
-
super(...arguments), this.arrowNav = !0, this.disableArrowNav = !1, this.tabRefs = [], this.tabCount = 0, this.context = {
|
|
175
|
-
useArrowNav: this.useArrowNav,
|
|
176
|
-
registerTab: this.registerTab.bind(this),
|
|
177
|
-
handleClick: this.handleClick.bind(this),
|
|
178
|
-
handleKeyUp: this.handleKeyUp.bind(this)
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
get useArrowNav() {
|
|
182
|
-
return this.arrowNav && !this.disableArrowNav;
|
|
183
|
-
}
|
|
184
|
-
// Update context when properties change
|
|
185
|
-
updated(o) {
|
|
186
|
-
(o.has("arrowNav") || o.has("disableArrowNav")) && (this.context = {
|
|
187
|
-
...this.context,
|
|
188
|
-
useArrowNav: this.useArrowNav
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
registerTab(o, t) {
|
|
192
|
-
this.tabRefs[t] = o, this.tabCount = Math.max(this.tabCount, t + 1);
|
|
193
|
-
}
|
|
194
|
-
handleClick(o) {
|
|
195
|
-
this.dispatchEvent(
|
|
196
|
-
new CustomEvent("tab-selected", {
|
|
197
|
-
detail: { index: o },
|
|
198
|
-
bubbles: !0,
|
|
199
|
-
composed: !0
|
|
200
|
-
})
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
handleKeyUp(o, t) {
|
|
204
|
-
var s, i;
|
|
205
|
-
this.useArrowNav && (o.code === "ArrowLeft" && t !== 0 && ((s = this.tabRefs[t - 1]) == null || s.focus()), o.code === "ArrowRight" && t < this.tabCount - 1 && ((i = this.tabRefs[t + 1]) == null || i.focus()), (o.code === "ArrowDown" || o.code === "Space") && this.dispatchEvent(
|
|
206
|
-
new CustomEvent("tab-selected", {
|
|
207
|
-
detail: { index: t },
|
|
208
|
-
bubbles: !0,
|
|
209
|
-
composed: !0
|
|
210
|
-
})
|
|
211
|
-
));
|
|
212
|
-
}
|
|
213
|
-
render() {
|
|
214
|
-
const o = this.useArrowNav ? "tablist" : "navigation";
|
|
215
|
-
return p`
|
|
216
|
-
<div class="pkt-tabs">
|
|
217
|
-
<div class="pkt-tabs__list" role=${o}>${$(this)}</div>
|
|
218
|
-
</div>
|
|
219
|
-
`;
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
d([
|
|
223
|
-
h({ type: Boolean, reflect: !0, attribute: "arrow-nav" })
|
|
224
|
-
], b.prototype, "arrowNav", 2);
|
|
225
|
-
d([
|
|
226
|
-
h({ type: Boolean, reflect: !0, attribute: "disable-arrow-nav" })
|
|
227
|
-
], b.prototype, "disableArrowNav", 2);
|
|
228
|
-
d([
|
|
229
|
-
f()
|
|
230
|
-
], b.prototype, "tabRefs", 2);
|
|
231
|
-
d([
|
|
232
|
-
f()
|
|
233
|
-
], b.prototype, "tabCount", 2);
|
|
234
|
-
d([
|
|
235
|
-
A({ context: P }),
|
|
236
|
-
f()
|
|
237
|
-
], b.prototype, "context", 2);
|
|
238
|
-
b = d([
|
|
239
|
-
y("pkt-tabs")
|
|
240
|
-
], b);
|
|
241
|
-
const M = b;
|
|
242
|
-
var j = Object.defineProperty, q = Object.getOwnPropertyDescriptor, l = (o, t, s, i) => {
|
|
243
|
-
for (var e = i > 1 ? void 0 : i ? q(t, s) : t, n = o.length - 1, r; n >= 0; n--)
|
|
244
|
-
(r = o[n]) && (e = (i ? r(t, s, e) : r(e)) || e);
|
|
245
|
-
return i && e && j(t, s, e), e;
|
|
246
|
-
};
|
|
247
|
-
let c = class extends k {
|
|
248
|
-
constructor() {
|
|
249
|
-
super(), this.active = !1, this.href = "", this.icon = "", this.controls = "", this.tag = "", this.tagSkin = "blue", this.index = 0, this.elementRef = _();
|
|
250
|
-
}
|
|
251
|
-
connectedCallback() {
|
|
252
|
-
super.connectedCallback(), this.updateComplete.then(() => {
|
|
253
|
-
this.elementRef.value && this.context && this.context.registerTab(this.elementRef.value, this.index);
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
handleClick() {
|
|
257
|
-
this.context && this.context.handleClick(this.index);
|
|
258
|
-
}
|
|
259
|
-
handleKeyUp(o) {
|
|
260
|
-
this.context && this.context.handleKeyUp(o, this.index);
|
|
261
|
-
}
|
|
262
|
-
render() {
|
|
263
|
-
var r;
|
|
264
|
-
const o = ((r = this.context) == null ? void 0 : r.useArrowNav) ?? !0, t = this.active ? "active" : "", s = o ? "tab" : void 0, i = o ? this.active : void 0, e = this.active || !o ? void 0 : -1, n = p`
|
|
265
|
-
${this.icon ? p`<pkt-icon name=${this.icon} class="pkt-icon--small"></pkt-icon>` : ""}
|
|
266
|
-
<span>${$(this)}</span>
|
|
267
|
-
${this.tag ? p`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>` : ""}
|
|
268
|
-
`;
|
|
269
|
-
return this.href ? p`
|
|
270
|
-
<a
|
|
271
|
-
${w(this.elementRef)}
|
|
272
|
-
href=${this.href}
|
|
273
|
-
class="pkt-tabs__link ${t}"
|
|
274
|
-
role=${u(s)}
|
|
275
|
-
aria-selected=${u(i)}
|
|
276
|
-
aria-controls=${u(this.controls || void 0)}
|
|
277
|
-
tabindex=${u(e)}
|
|
278
|
-
@click=${this.handleClick}
|
|
279
|
-
@keyup=${this.handleKeyUp}
|
|
280
|
-
>
|
|
281
|
-
${n}
|
|
282
|
-
</a>
|
|
283
|
-
` : p`
|
|
284
|
-
<button
|
|
285
|
-
${w(this.elementRef)}
|
|
286
|
-
type="button"
|
|
287
|
-
class="pkt-tabs__button pkt-link-button ${t}"
|
|
288
|
-
role=${u(s)}
|
|
289
|
-
aria-selected=${u(i)}
|
|
290
|
-
aria-controls=${u(this.controls || void 0)}
|
|
291
|
-
tabindex=${u(e)}
|
|
292
|
-
@click=${this.handleClick}
|
|
293
|
-
@keyup=${this.handleKeyUp}
|
|
294
|
-
>
|
|
295
|
-
${n}
|
|
296
|
-
</button>
|
|
297
|
-
`;
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
l([
|
|
301
|
-
h({ type: Boolean, reflect: !0 })
|
|
302
|
-
], c.prototype, "active", 2);
|
|
303
|
-
l([
|
|
304
|
-
h({ type: String, reflect: !0 })
|
|
305
|
-
], c.prototype, "href", 2);
|
|
306
|
-
l([
|
|
307
|
-
h({ type: String, reflect: !0 })
|
|
308
|
-
], c.prototype, "icon", 2);
|
|
309
|
-
l([
|
|
310
|
-
h({ type: String, reflect: !0 })
|
|
311
|
-
], c.prototype, "controls", 2);
|
|
312
|
-
l([
|
|
313
|
-
h({ type: String, reflect: !0 })
|
|
314
|
-
], c.prototype, "tag", 2);
|
|
315
|
-
l([
|
|
316
|
-
h({ type: String, reflect: !0, attribute: "tag-skin" })
|
|
317
|
-
], c.prototype, "tagSkin", 2);
|
|
318
|
-
l([
|
|
319
|
-
h({ type: Number, reflect: !0 })
|
|
320
|
-
], c.prototype, "index", 2);
|
|
321
|
-
l([
|
|
322
|
-
O({ context: P, subscribe: !0 }),
|
|
323
|
-
h({ attribute: !1 })
|
|
324
|
-
], c.prototype, "context", 2);
|
|
325
|
-
c = l([
|
|
326
|
-
y("pkt-tab-item")
|
|
327
|
-
], c);
|
|
328
|
-
const B = c;
|
|
329
|
-
export {
|
|
330
|
-
B as P,
|
|
331
|
-
M as a
|
|
332
|
-
};
|