@oslokommune/punkt-elements 20.0.0 → 20.0.5
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 +17 -0
- package/dist/{accordion-5N_ptxrN.cjs → accordion-CSSp30G1.cjs} +1 -1
- package/dist/{accordion-C5cu1xXT.js → accordion-DIjltHSH.js} +11 -14
- package/dist/{alert-CA1fDbyc.js → alert-B00bIA5q.js} +36 -38
- package/dist/{alert-DkyTTo7S.cjs → alert-DPtmkrJq.cjs} +12 -12
- package/dist/{async-directive-DCLIOGR8.cjs → async-directive-Bn7zgxUy.cjs} +1 -1
- package/dist/{async-directive-BcS8rfeC.js → async-directive-Ct3Mrb1M.js} +10 -11
- package/dist/{backlink-CXOxMeyt.cjs → backlink-BAvqdPlG.cjs} +1 -1
- package/dist/{backlink-CDBRcaAu.js → backlink-MBTAhQuD.js} +5 -7
- package/dist/{booleanish-OQJTYSrw.js → booleanish-CBa3Cr2h.js} +1 -2
- package/dist/{breadcrumbs-5oUaCef3.js → breadcrumbs-DtEt1-wn.js} +3 -4
- package/dist/button-BI1PsdE1.cjs +32 -0
- package/dist/{button-Bswo1C0M.js → button-Bd-0TYe7.js} +29 -31
- package/dist/{calendar-BOd-9PDd.js → calendar-CkAAgviq.js} +66 -76
- package/dist/calendar-xYEsKilS.cjs +85 -0
- package/dist/{card-DH1kPnyi.js → card-CsEfBJcP.js} +10 -12
- package/dist/{card-njWrvrHm.cjs → card-XznwedEG.cjs} +1 -1
- package/dist/{checkbox-iMOdzpJ_.cjs → checkbox-Cg7wnn8U.cjs} +1 -1
- package/dist/{checkbox-DIJbuqWm.js → checkbox-XvlUQmg5.js} +8 -10
- package/dist/{checkbox-group-DLLbWgQb.js → checkbox-group-D038oaif.js} +8 -10
- package/dist/{checkbox-group-Kua6HuRE.cjs → checkbox-group-DHi7HgkS.cjs} +1 -1
- package/dist/{class-map-BDwVSgLb.js → class-map-C9n5CNC8.js} +2 -3
- package/dist/{classutils-DcYnSgfc.js → classutils-C4jETHHk.js} +1 -2
- package/dist/{combobox-H5FLG8BV.js → combobox-BR2qOS5z.js} +63 -66
- package/dist/combobox-Bn51heWm.cjs +139 -0
- package/dist/components/tag/tag.d.ts +3 -11
- package/dist/{consent-p-0n2b9x.js → consent-KrraWq7K.js} +5 -7
- package/dist/{consent-UkinU27V.cjs → consent-ifEcAAhG.cjs} +1 -1
- package/dist/{consume-Bp12si68.js → consume-C6aWEFx-.js} +4 -8
- package/dist/{converters-CW6SN0TT.cjs → converters-Dp64-kF1.cjs} +1 -1
- package/dist/{converters-CYgQrWVm.js → converters-v_GK06o3.js} +36 -72
- package/dist/{datepicker-ZSwWg8xW.js → datepicker-BZpiJeLW.js} +86 -90
- package/dist/{datepicker-COar3rRT.cjs → datepicker-Bt8zKLPK.cjs} +53 -53
- package/dist/define-component-spec-wHP10r2x.js +5 -0
- package/dist/{dialog-polyfill.esm-D39dWbRt.js → dialog-polyfill.esm-BGBREnq_.js} +2 -3
- package/dist/dialog-polyfill.esm-BPk0-8XP.cjs +1 -0
- package/dist/{directive-helpers-BoDzpPID.js → directive-helpers-KMRvtO9j.js} +2 -3
- package/dist/{element-DLgZkx5L.js → element-Bwc-likm.js} +9 -18
- package/dist/{element-with-slot-mG-h7Sjw.js → element-with-slot-47quDZRt.js} +4 -6
- package/dist/{element-with-slot-CeKuRE3_.cjs → element-with-slot-D_8fAzCW.cjs} +1 -1
- package/dist/{fetch-header-footer-data-Pc32etrk.js → fetch-header-footer-data-CPVt_P8s.js} +3 -6
- package/dist/{fileupload-vPDmtXiM.js → fileupload-A7RNV7ic.js} +25 -36
- package/dist/{fileupload-DXJtAagE.cjs → fileupload-Cw4xeUZn.cjs} +1 -1
- package/dist/{focus-modality-controller-Dc2S-KqR.js → focus-modality-controller-DVsT6GeR.js} +1 -2
- package/dist/focus-trap-C-PcFOw6.js +42 -0
- package/dist/focus-trap-C9tsr-xL.cjs +1 -0
- package/dist/{footer-D8t0PCPC.js → footer-HqNhiUa1.js} +20 -24
- package/dist/{footer-CpE05IW2.cjs → footer-dnW2aMEr.cjs} +9 -9
- package/dist/{format-BTeSVkED.js → format-DwjTfa9h.js} +1 -2
- package/dist/{header-DzYKgl-k.cjs → header-CKGwNWBI.cjs} +2 -2
- package/dist/{header-Bo8uvddg.js → header-VOj1cfsA.js} +22 -26
- package/dist/{header-menu-Dq9lwNr1.cjs → header-menu-BJMMwrCR.cjs} +1 -1
- package/dist/{header-menu-BrjsNjBH.js → header-menu-k2ACrfOv.js} +9 -11
- package/dist/{heading-DAkjw2Am.cjs → heading-BNlor2MU.cjs} +1 -1
- package/dist/{heading-CMZmPEL9.js → heading-SYKHysr8.js} +19 -21
- package/dist/{helptext-Bse1LpRd.cjs → helptext-CQaNvbiv.cjs} +9 -9
- package/dist/{helptext-BFQzrOw4.js → helptext-kKmVQkwo.js} +20 -22
- package/dist/{icon-C1oCGwEe.js → icon-CZDw42U7.js} +5 -8
- package/dist/if-defined-B3pYog2C.js +4 -0
- package/dist/{input-element-2LHxo0em.cjs → input-element-CfZIyfon.cjs} +1 -1
- package/dist/{input-element-De40zUox.js → input-element-DE0FzjgP.js} +19 -25
- package/dist/{input-wrapper-DkpJS1hR.js → input-wrapper-C6BRd-cu.js} +13 -15
- package/dist/{input-wrapper-C_Rzwxx7.cjs → input-wrapper-CdH6RH0a.cjs} +1 -1
- package/dist/{link-DZgG_8Ni.js → link-Bc4zf-Dj.js} +20 -22
- package/dist/link-lPrxhYq0.cjs +7 -0
- package/dist/{linkcard-DIG6VYpl.cjs → linkcard-Bih7HS2t.cjs} +1 -1
- package/dist/{linkcard-Dr-r8jBO.js → linkcard-LCFAdVsG.js} +7 -9
- package/dist/{listbox-HrH4JonS.cjs → listbox-Du8llYth.cjs} +10 -10
- package/dist/{listbox-DAvIBH4P.js → listbox-df8gHweY.js} +17 -19
- package/dist/{loader-CFidlqSG.js → loader-C-2b3bGK.js} +9 -12
- package/dist/{loader-DTIrOtTo.cjs → loader-DiQSwWpb.cjs} +1 -1
- package/dist/{messagebox-BLYx3AL7.cjs → messagebox-BiG-fJX9.cjs} +1 -1
- package/dist/{messagebox-B_07P0QA.js → messagebox-CH3bKoJO.js} +9 -11
- package/dist/modal-B3rnE83a.cjs +37 -0
- package/dist/{modal-CA_M2Ix6.js → modal-SBJ8aGvM.js} +33 -35
- package/dist/{option-group-element-DzM8YznZ.js → option-group-element-C8oJxuQQ.js} +7 -8
- package/dist/{option-group-element-CVNaBIlP.cjs → option-group-element-_LrpXfK1.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-breadcrumbs.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-checkbox-group.cjs +1 -1
- package/dist/pkt-checkbox-group.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.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 +2 -3
- 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-heading.cjs +1 -1
- package/dist/pkt-heading.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-icon.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +37 -37
- 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-listbox.cjs +1 -1
- package/dist/pkt-listbox.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-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/{pkt-options-controller-CzvBlEPD.js → pkt-options-controller-Dz7DP0wC.js} +2 -3
- package/dist/{pkt-options-controller-9zoH1OBW.cjs → pkt-options-controller-WsHVdPJA.cjs} +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +1 -1
- package/dist/pkt-radio-group.cjs +1 -1
- package/dist/pkt-radio-group.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-CfCc2zhp.js → progressbar-DlbkKRgP.js} +9 -11
- package/dist/{progressbar-BdqIhC1Z.cjs → progressbar-Wyq_Q1Ur.cjs} +1 -1
- package/dist/{provide-_MnlMGnw.js → provide-DFu2tSv_.js} +3 -5
- package/dist/{radio-group-BRY_74od.js → radio-group-Kr2BCSvg.js} +8 -10
- package/dist/{radio-group-CsUgnEv0.cjs → radio-group-RWgTs_uV.cjs} +1 -1
- package/dist/{radiobutton-CQhuG2lj.cjs → radiobutton-86ZvvDmJ.cjs} +1 -1
- package/dist/{radiobutton-lHnq8wX_.js → radiobutton-Bf6aFfYt.js} +8 -10
- package/dist/{ref-B6p6mQkO.cjs → ref-C6VUWwmF.cjs} +1 -1
- package/dist/{ref-BAegS9BR.js → ref-qE1RBrI7.js} +3 -4
- package/dist/{repeat-Cy1M16Di.js → repeat-c2P6osbb.js} +3 -4
- package/dist/{scroll-lock-CR-g54ai.js → scroll-lock-C9jzbJ4E.js} +1 -2
- package/dist/{searchinput-TAqMUJ0B.cjs → searchinput-D5l64Mkb.cjs} +7 -7
- package/dist/{searchinput-BLGaXkP6.js → searchinput-DN8kDZQ1.js} +18 -20
- package/dist/{select-Dle67Uwv.cjs → select-CZ3L48N_.cjs} +15 -15
- package/dist/{select-BvtUxW0Q.js → select-Curv4lWO.js} +15 -18
- package/dist/shared-types/index.d.ts +3 -2
- package/dist/shared-types/skin.d.ts +1 -10
- package/dist/shared-types/tag.d.ts +46 -0
- package/dist/shared-types-BvRk9kiK.js +0 -0
- package/dist/{tabs-Bu_-WfCK.js → tabs-Cg16Sl3u.js} +57 -60
- package/dist/{tabs-Dwk5PKzP.cjs → tabs-n7hQWwyI.cjs} +22 -22
- package/dist/tag-BAikRN2Y.cjs +27 -0
- package/dist/{tag-CkZ2Mn4a.js → tag-HXcXopyA.js} +15 -106
- package/dist/{textarea-Djp5L2Zd.js → textarea-B1iUKCro.js} +12 -14
- package/dist/{textarea-DSX3jMlI.cjs → textarea-DbD7sOLV.cjs} +1 -1
- package/dist/{textinput-CBrOZcvL.js → textinput-CKbUvHNH.js} +11 -13
- package/dist/{textinput-CN2F3Q3H.cjs → textinput-C_5jzdg3.cjs} +1 -1
- package/dist/{timepicker-CkaJkIGn.cjs → timepicker-By-kvx3z.cjs} +20 -20
- package/dist/{timepicker-CT4wfrgQ.js → timepicker-DkXpFBpQ.js} +27 -28
- package/dist/{utils-BwF4QSrq.js → utils-Dn5ykFtS.js} +1 -2
- package/package.json +10 -10
- package/src/components/tag/tag.test.ts +6 -0
- package/src/components/tag/tag.ts +17 -23
- package/dist/button-bVWAX98x.cjs +0 -32
- package/dist/calendar-CDTCgTJn.cjs +0 -85
- package/dist/combobox-BwAxmoG9.cjs +0 -139
- package/dist/define-component-spec-BYOSeplU.js +0 -6
- package/dist/dialog-polyfill.esm-CW51hN2p.cjs +0 -1
- package/dist/focus-trap-DG3pEuyJ.js +0 -60
- package/dist/focus-trap-DSv4Ifqm.cjs +0 -1
- package/dist/if-defined-DiYi2v_Q.js +0 -5
- package/dist/link-B7t4iOKk.cjs +0 -7
- package/dist/modal-BvTfLfFq.cjs +0 -37
- package/dist/shared-types-A6iGIX-f.js +0 -1
- package/dist/tag-1SSexs0H.cjs +0 -27
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { _ as e, d as t, l as n, n as r, u as i } from "./element-
|
|
2
|
-
import { n as a } from "./
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
var f = class extends
|
|
1
|
+
import { _ as e, d as t, l as n, n as r, u as i } from "./element-Bwc-likm.js";
|
|
2
|
+
import { n as a, t as o } from "./ref-qE1RBrI7.js";
|
|
3
|
+
import { t as s } from "./if-defined-B3pYog2C.js";
|
|
4
|
+
import { t as c } from "./input-element-DE0FzjgP.js";
|
|
5
|
+
import { t as l } from "./pkt-options-controller-Dz7DP0wC.js";
|
|
6
|
+
import { n as u } from "./element-with-slot-47quDZRt.js";
|
|
7
|
+
import { r as d } from "./input-wrapper-C6BRd-cu.js";
|
|
8
|
+
// src/base-elements/options-input-element.ts
|
|
9
|
+
var f = class extends c {
|
|
10
10
|
constructor(...e) {
|
|
11
11
|
super(...e), this._optionsProp = [], this._options = [];
|
|
12
12
|
}
|
|
@@ -40,11 +40,10 @@ r([i({
|
|
|
40
40
|
type: Array,
|
|
41
41
|
attribute: "options"
|
|
42
42
|
})], f.prototype, "_optionsProp", void 0), r([n()], f.prototype, "_options", void 0);
|
|
43
|
-
|
|
44
|
-
//#region src/components/select/select.ts
|
|
43
|
+
// src/components/select/select.ts
|
|
45
44
|
var p = class extends f {
|
|
46
45
|
constructor() {
|
|
47
|
-
super(), this.inputRef =
|
|
46
|
+
super(), this.inputRef = o(), this.value = "", this.selectedIndex = -1, this.selectedOptions = void 0, this.defaultedToFirstOption = !1, this.optionsController = new l(this);
|
|
48
47
|
}
|
|
49
48
|
connectedCallback() {
|
|
50
49
|
super.connectedCallback(), this.parseOptions(), this._options.forEach((e) => {
|
|
@@ -94,7 +93,7 @@ var p = class extends f {
|
|
|
94
93
|
let t = `pkt-input pkt-input--${this.inputSize} ${this.fullwidth ? "pkt-input--fullwidth" : ""}`;
|
|
95
94
|
return e`
|
|
96
95
|
<pkt-input-wrapper
|
|
97
|
-
${
|
|
96
|
+
${u(this, ["helptext"])}
|
|
98
97
|
.strings=${this.strings}
|
|
99
98
|
.size=${this.inputSize}
|
|
100
99
|
?disabled=${this.isDisabled}
|
|
@@ -119,7 +118,7 @@ var p = class extends f {
|
|
|
119
118
|
class=${t}
|
|
120
119
|
aria-invalid=${this.hasError}
|
|
121
120
|
aria-errormessage=${s(this.hasError ? `${this.id}-input-error` : void 0)}
|
|
122
|
-
aria-describedby=${s(
|
|
121
|
+
aria-describedby=${s(d({
|
|
123
122
|
id: this.id + "-input",
|
|
124
123
|
hasHelptext: !!this.helptext || this.hasSlotContent("helptext"),
|
|
125
124
|
hasCounter: !1,
|
|
@@ -141,7 +140,7 @@ var p = class extends f {
|
|
|
141
140
|
@blur=${(e) => {
|
|
142
141
|
this.onBlur(), e.stopImmediatePropagation();
|
|
143
142
|
}}
|
|
144
|
-
${
|
|
143
|
+
${a(this.inputRef)}
|
|
145
144
|
>
|
|
146
145
|
${this._options.length > 0 ? this._options.map((t) => e`<option
|
|
147
146
|
value=${t.value}
|
|
@@ -165,8 +164,6 @@ try {
|
|
|
165
164
|
} catch {
|
|
166
165
|
console.warn("Forsøker å definere <pkt-select>, men den er allerede definert");
|
|
167
166
|
}
|
|
168
|
-
|
|
169
|
-
//#region src/components/select/index.ts
|
|
167
|
+
// src/components/select/index.ts
|
|
170
168
|
var m = p;
|
|
171
|
-
//#endregion
|
|
172
169
|
export { p as n, m as t };
|
|
@@ -46,8 +46,9 @@ export type { IPktTextareaBase, ITextareaSpecProps } from './textarea';
|
|
|
46
46
|
export { TEXTINPUT_DEFAULTS, TEXTINPUT_TYPES } from './textinput';
|
|
47
47
|
export type { TPktTextinputType, IPktTextinputBase, ITextinputSpecProps } from './textinput';
|
|
48
48
|
export type { TPktCounterPosition, IPktInputWrapperBase, IInputWrapperSpecProps, } from './input-wrapper';
|
|
49
|
-
export {
|
|
50
|
-
export
|
|
49
|
+
export type { TMessageboxSkin } from './skin';
|
|
50
|
+
export { TAG_SKINS, TAG_STATES, TAG_TEXT_STYLES, TAG_DEFAULTS } from './tag';
|
|
51
|
+
export type { TTagSkin, TTagState, TTagTextStyle, IPktTagBase, ITagSpecProps } from './tag';
|
|
51
52
|
export { MESSAGEBOX_SKINS, MESSAGEBOX_LIGHT_ONLY_SKINS, MESSAGEBOX_DEFAULTS } from './messagebox';
|
|
52
53
|
export type { IPktMessageboxBase, IMessageboxSpecProps } from './messagebox';
|
|
53
54
|
export { CALENDAR_DEFAULTS } from './calendar';
|
|
@@ -9,13 +9,4 @@ export { ALERT_SKINS, type TAlertSkin } from './alert';
|
|
|
9
9
|
export { ACCORDION_SKINS, type TAccordionSkin } from './accordion';
|
|
10
10
|
export { CARD_SKINS, type TCardSkin } from './card';
|
|
11
11
|
export { MESSAGEBOX_SKINS, type TMessageboxSkin } from './messagebox';
|
|
12
|
-
|
|
13
|
-
* Tag component skin variants — shared runtime source for types, specs and demo pages.
|
|
14
|
-
*/
|
|
15
|
-
export declare const TAG_SKINS: readonly ['gray', 'gray-light', 'blue-dark', 'blue', 'blue-light', 'blue-pale', 'green', 'green-light', 'red', 'red-light', 'yellow', 'yellow-light', 'beige', 'beige-light'];
|
|
16
|
-
export type TTagSkin = (typeof TAG_SKINS)[number];
|
|
17
|
-
/**
|
|
18
|
-
* Forces a tag into a visual state without the user interacting with it.
|
|
19
|
-
*/
|
|
20
|
-
export declare const TAG_STATES: readonly ['hover', 'focus', 'active'];
|
|
21
|
-
export type TTagState = (typeof TAG_STATES)[number];
|
|
12
|
+
export { TAG_SKINS, TAG_STATES, type TTagSkin, type TTagState } from './tag';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tag.ts
|
|
3
|
+
*
|
|
4
|
+
* Shared types and defaults for Tag, used by both React and Elements.
|
|
5
|
+
*/
|
|
6
|
+
import type { IPktStringsProps } from '../shared-strings';
|
|
7
|
+
import type { THTMLButtonType } from './form';
|
|
8
|
+
import type { TPktSizeBase } from './size';
|
|
9
|
+
/** Tag skins: shared runtime source for types, specs and demo pages. */
|
|
10
|
+
export declare const TAG_SKINS: readonly ['gray', 'gray-light', 'blue-dark', 'blue', 'blue-light', 'blue-pale', 'green', 'green-light', 'red', 'red-light', 'yellow', 'yellow-light', 'beige', 'beige-light'];
|
|
11
|
+
export type TTagSkin = (typeof TAG_SKINS)[number];
|
|
12
|
+
/** Forces a tag into a visual state without the user interacting with it. */
|
|
13
|
+
export declare const TAG_STATES: readonly ['hover', 'focus', 'active'];
|
|
14
|
+
export type TTagState = (typeof TAG_STATES)[number];
|
|
15
|
+
export declare const TAG_TEXT_STYLES: readonly ['normal-text', 'thin-text'];
|
|
16
|
+
export type TTagTextStyle = (typeof TAG_TEXT_STYLES)[number];
|
|
17
|
+
/**
|
|
18
|
+
* Framework-agnostic props for Tag.
|
|
19
|
+
*
|
|
20
|
+
* @remarks React adds `onClose` and `children`, and only accepts `type` when
|
|
21
|
+
* `closeTag` is `true`. Elements narrows `iconName` to `PktIconName` and
|
|
22
|
+
* dispatches a `close` event instead of `onClose`.
|
|
23
|
+
*/
|
|
24
|
+
export interface IPktTagBase extends IPktStringsProps<'tag'> {
|
|
25
|
+
closeTag?: boolean;
|
|
26
|
+
size?: TPktSizeBase;
|
|
27
|
+
skin?: TTagSkin;
|
|
28
|
+
state?: TTagState | null;
|
|
29
|
+
textStyle?: TTagTextStyle | null;
|
|
30
|
+
iconName?: string;
|
|
31
|
+
type?: THTMLButtonType;
|
|
32
|
+
ariaLabel?: string | null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Props documented in the component spec (docs and Preview).
|
|
36
|
+
* The spec file is type-checked against this.
|
|
37
|
+
*/
|
|
38
|
+
export type ITagSpecProps = Pick<IPktTagBase, 'size' | 'iconName' | 'skin' | 'closeTag' | 'state' | 'textStyle' | 'type' | 'ariaLabel'>;
|
|
39
|
+
/** Default values, shared by React and Elements. */
|
|
40
|
+
export declare const TAG_DEFAULTS: {
|
|
41
|
+
readonly closeTag: false;
|
|
42
|
+
readonly size: 'medium';
|
|
43
|
+
readonly skin: 'gray';
|
|
44
|
+
readonly textStyle: 'normal-text';
|
|
45
|
+
readonly type: 'button';
|
|
46
|
+
};
|
|
File without changes
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as a,
|
|
3
|
-
import { t as s } from "./
|
|
4
|
-
import { n as c, t as l } from "./consume-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import "./tag-
|
|
8
|
-
|
|
9
|
-
var p = c(Symbol("pkt-tabs-context")), m = class extends
|
|
1
|
+
import { i as e, t } from "./element-with-slot-47quDZRt.js";
|
|
2
|
+
import { _ as n, d as r, l as i, n as a, u as o } from "./element-Bwc-likm.js";
|
|
3
|
+
import { t as s } from "./provide-DFu2tSv_.js";
|
|
4
|
+
import { n as c, t as l } from "./consume-C6aWEFx-.js";
|
|
5
|
+
import { n as u, t as d } from "./ref-qE1RBrI7.js";
|
|
6
|
+
import { t as f } from "./if-defined-B3pYog2C.js";
|
|
7
|
+
import "./tag-HXcXopyA.js";
|
|
8
|
+
// src/components/tabs/tabs-context.ts
|
|
9
|
+
var p = c(Symbol("pkt-tabs-context")), m = class extends t {
|
|
10
10
|
constructor(...e) {
|
|
11
11
|
super(...e), this.arrowNav = !0, this.disableArrowNav = !1, this.separatorIconName = "", this.separatorIconPath = "", this.tabRefs = [], this.disabledMap = {}, this.tabCount = 0, this.context = {
|
|
12
12
|
useArrowNav: this.useArrowNav,
|
|
@@ -80,41 +80,40 @@ var p = c(Symbol("pkt-tabs-context")), m = class extends o {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
render() {
|
|
83
|
-
let t = this.useArrowNav ? "tablist" : "navigation",
|
|
84
|
-
return
|
|
85
|
-
<div class=${
|
|
86
|
-
<div class="pkt-tabs__list" role=${t}>${
|
|
83
|
+
let t = this.useArrowNav ? "tablist" : "navigation", r = this.separatorIconName || this.separatorIconPath ? "pkt-tabs pkt-tabs--with-separator" : "pkt-tabs";
|
|
84
|
+
return n`
|
|
85
|
+
<div class=${r}>
|
|
86
|
+
<div class="pkt-tabs__list" role=${t}>${e(this)}</div>
|
|
87
87
|
</div>
|
|
88
88
|
`;
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
-
|
|
91
|
+
a([o({
|
|
92
92
|
type: Boolean,
|
|
93
93
|
reflect: !0,
|
|
94
94
|
attribute: "arrow-nav"
|
|
95
|
-
})], m.prototype, "arrowNav", void 0),
|
|
95
|
+
})], m.prototype, "arrowNav", void 0), a([o({
|
|
96
96
|
type: Boolean,
|
|
97
97
|
reflect: !0,
|
|
98
98
|
attribute: "disable-arrow-nav"
|
|
99
|
-
})], m.prototype, "disableArrowNav", void 0),
|
|
99
|
+
})], m.prototype, "disableArrowNav", void 0), a([o({
|
|
100
100
|
type: String,
|
|
101
101
|
reflect: !0,
|
|
102
102
|
attribute: "separator-icon-name"
|
|
103
|
-
})], m.prototype, "separatorIconName", void 0),
|
|
103
|
+
})], m.prototype, "separatorIconName", void 0), a([o({
|
|
104
104
|
type: String,
|
|
105
105
|
reflect: !0,
|
|
106
106
|
attribute: "separator-icon-path"
|
|
107
|
-
})], m.prototype, "separatorIconPath", void 0),
|
|
107
|
+
})], m.prototype, "separatorIconPath", void 0), a([i()], m.prototype, "tabRefs", void 0), a([i()], m.prototype, "disabledMap", void 0), a([i()], m.prototype, "tabCount", void 0), a([s({ context: p }), i()], m.prototype, "context", void 0);
|
|
108
108
|
try {
|
|
109
|
-
|
|
109
|
+
r("pkt-tabs")(m);
|
|
110
110
|
} catch {
|
|
111
111
|
console.warn("Forsøker å definere <pkt-tabs>, men den er allerede definert");
|
|
112
112
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
var h = class extends o {
|
|
113
|
+
// src/components/tabs/tabitem.ts
|
|
114
|
+
var h = class extends t {
|
|
116
115
|
constructor() {
|
|
117
|
-
super(), this.active = !1, this.disabled = !1, this.href = "", this.icon = "", this.controls = "", this.tag = "", this.tagSkin = "blue", this.index = 0, this.elementRef =
|
|
116
|
+
super(), this.active = !1, this.disabled = !1, this.href = "", this.icon = "", this.controls = "", this.tag = "", this.tagSkin = "blue", this.index = 0, this.elementRef = d();
|
|
118
117
|
}
|
|
119
118
|
connectedCallback() {
|
|
120
119
|
super.connectedCallback(), this.updateComplete.then(() => {
|
|
@@ -131,81 +130,79 @@ var h = class extends o {
|
|
|
131
130
|
this.disabled && (e.key === "Enter" || e.key === " " || e.key === "Spacebar") ? (e.preventDefault(), e.stopPropagation()) : this.context && this.context.handleKeyUp(e, this.index);
|
|
132
131
|
}
|
|
133
132
|
render() {
|
|
134
|
-
let t = this.context?.useArrowNav ?? !0,
|
|
135
|
-
${this.icon ?
|
|
136
|
-
<span>${
|
|
137
|
-
${this.tag ?
|
|
133
|
+
let t = this.context?.useArrowNav ?? !0, r = this.active && !this.disabled, i = [r ? "active" : "", this.disabled ? "pkt-tabs__item--disabled" : ""].filter(Boolean).join(" "), a = t ? "tab" : void 0, o = t ? r : void 0, s = this.disabled ? -1 : r || !t ? void 0 : -1, c = `pkt-icon--small ${this.icon === "check" ? "pkt-tabs__status-icon" : ""}`, l = n`
|
|
134
|
+
${this.icon ? n`<pkt-icon name=${this.icon} class=${c}></pkt-icon>` : ""}
|
|
135
|
+
<span>${e(this)}</span>
|
|
136
|
+
${this.tag ? n`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>` : ""}
|
|
138
137
|
`;
|
|
139
|
-
return this.href ?
|
|
138
|
+
return this.href ? n`
|
|
140
139
|
<a
|
|
141
|
-
${
|
|
142
|
-
href=${
|
|
143
|
-
class="pkt-tabs__link ${
|
|
144
|
-
role=${
|
|
145
|
-
aria-selected=${
|
|
146
|
-
aria-disabled=${
|
|
147
|
-
aria-controls=${
|
|
148
|
-
tabindex=${s
|
|
140
|
+
${u(this.elementRef)}
|
|
141
|
+
href=${f(this.disabled ? void 0 : this.href)}
|
|
142
|
+
class="pkt-tabs__link ${i}"
|
|
143
|
+
role=${f(a)}
|
|
144
|
+
aria-selected=${f(o)}
|
|
145
|
+
aria-disabled=${f(this.disabled ? "true" : void 0)}
|
|
146
|
+
aria-controls=${f(this.controls || void 0)}
|
|
147
|
+
tabindex=${f(s)}
|
|
149
148
|
@click=${this.handleClick}
|
|
150
149
|
@keydown=${this.handleKeyDown}
|
|
151
150
|
>
|
|
152
|
-
${
|
|
151
|
+
${l}
|
|
153
152
|
</a>
|
|
154
|
-
` :
|
|
153
|
+
` : n`
|
|
155
154
|
<button
|
|
156
|
-
${
|
|
155
|
+
${u(this.elementRef)}
|
|
157
156
|
type="button"
|
|
158
|
-
class="pkt-tabs__button pkt-link-button ${
|
|
157
|
+
class="pkt-tabs__button pkt-link-button ${i}"
|
|
159
158
|
?disabled=${this.disabled}
|
|
160
|
-
aria-disabled=${
|
|
161
|
-
role=${
|
|
162
|
-
aria-selected=${
|
|
163
|
-
aria-controls=${
|
|
164
|
-
tabindex=${s
|
|
159
|
+
aria-disabled=${f(this.disabled ? "true" : void 0)}
|
|
160
|
+
role=${f(a)}
|
|
161
|
+
aria-selected=${f(o)}
|
|
162
|
+
aria-controls=${f(this.controls || void 0)}
|
|
163
|
+
tabindex=${f(s)}
|
|
165
164
|
@click=${this.handleClick}
|
|
166
165
|
@keydown=${this.handleKeyDown}
|
|
167
166
|
>
|
|
168
|
-
${
|
|
167
|
+
${l}
|
|
169
168
|
</button>
|
|
170
169
|
`;
|
|
171
170
|
}
|
|
172
171
|
};
|
|
173
|
-
|
|
172
|
+
a([o({
|
|
174
173
|
type: Boolean,
|
|
175
174
|
reflect: !0
|
|
176
|
-
})], h.prototype, "active", void 0),
|
|
175
|
+
})], h.prototype, "active", void 0), a([o({
|
|
177
176
|
type: Boolean,
|
|
178
177
|
reflect: !0
|
|
179
|
-
})], h.prototype, "disabled", void 0),
|
|
178
|
+
})], h.prototype, "disabled", void 0), a([o({
|
|
180
179
|
type: String,
|
|
181
180
|
reflect: !0
|
|
182
|
-
})], h.prototype, "href", void 0),
|
|
181
|
+
})], h.prototype, "href", void 0), a([o({
|
|
183
182
|
type: String,
|
|
184
183
|
reflect: !0
|
|
185
|
-
})], h.prototype, "icon", void 0),
|
|
184
|
+
})], h.prototype, "icon", void 0), a([o({
|
|
186
185
|
type: String,
|
|
187
186
|
reflect: !0
|
|
188
|
-
})], h.prototype, "controls", void 0),
|
|
187
|
+
})], h.prototype, "controls", void 0), a([o({
|
|
189
188
|
type: String,
|
|
190
189
|
reflect: !0
|
|
191
|
-
})], h.prototype, "tag", void 0),
|
|
190
|
+
})], h.prototype, "tag", void 0), a([o({
|
|
192
191
|
type: String,
|
|
193
192
|
reflect: !0,
|
|
194
193
|
attribute: "tag-skin"
|
|
195
|
-
})], h.prototype, "tagSkin", void 0),
|
|
194
|
+
})], h.prototype, "tagSkin", void 0), a([o({
|
|
196
195
|
type: Number,
|
|
197
196
|
reflect: !0
|
|
198
|
-
})], h.prototype, "index", void 0),
|
|
197
|
+
})], h.prototype, "index", void 0), a([l({
|
|
199
198
|
context: p,
|
|
200
199
|
subscribe: !0
|
|
201
|
-
}),
|
|
200
|
+
}), o({ attribute: !1 })], h.prototype, "context", void 0);
|
|
202
201
|
try {
|
|
203
|
-
|
|
202
|
+
r("pkt-tab-item")(h);
|
|
204
203
|
} catch {
|
|
205
204
|
console.warn("Forsøker å definere <pkt-tab-item>, men den er allerede definert");
|
|
206
205
|
}
|
|
207
|
-
|
|
208
|
-
//#region src/components/tabs/index.ts
|
|
206
|
+
// src/components/tabs/index.ts
|
|
209
207
|
var g = m;
|
|
210
|
-
//#endregion
|
|
211
208
|
export { h as n, m as r, g as t };
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-with-slot-D_8fAzCW.cjs"),t=require("./element-CEarCnHH.cjs"),n=require("./provide-Cz18sYug.cjs"),r=require("./consume-kEjgTrAp.cjs"),i=require("./ref-C6VUWwmF.cjs"),a=require("./if-defined-Ci4ZQsgL.cjs");require("./tag-BAikRN2Y.cjs");var o=r.n(Symbol(`pkt-tabs-context`)),s=class extends e.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}willUpdate(e){(e.has(`arrowNav`)||e.has(`disableArrowNav`))&&(this.context={...this.context,useArrowNav:this.useArrowNav})}updated(){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 n=this.useArrowNav?`tablist`:`navigation`,r=this.separatorIconName||this.separatorIconPath?`pkt-tabs pkt-tabs--with-separator`:`pkt-tabs`;return t._`
|
|
2
2
|
<div class=${r}>
|
|
3
|
-
<div class="pkt-tabs__list" role=${n}>${
|
|
3
|
+
<div class="pkt-tabs__list" role=${n}>${e.i(this)}</div>
|
|
4
4
|
</div>
|
|
5
|
-
`}};
|
|
6
|
-
${this.icon?
|
|
7
|
-
<span>${
|
|
8
|
-
${this.tag?
|
|
9
|
-
`;return this.href?
|
|
5
|
+
`}};t.n([t.u({type:Boolean,reflect:!0,attribute:`arrow-nav`})],s.prototype,`arrowNav`,void 0),t.n([t.u({type:Boolean,reflect:!0,attribute:`disable-arrow-nav`})],s.prototype,`disableArrowNav`,void 0),t.n([t.u({type:String,reflect:!0,attribute:`separator-icon-name`})],s.prototype,`separatorIconName`,void 0),t.n([t.u({type:String,reflect:!0,attribute:`separator-icon-path`})],s.prototype,`separatorIconPath`,void 0),t.n([t.l()],s.prototype,`tabRefs`,void 0),t.n([t.l()],s.prototype,`disabledMap`,void 0),t.n([t.l()],s.prototype,`tabCount`,void 0),t.n([n.t({context:o}),t.l()],s.prototype,`context`,void 0);try{t.d(`pkt-tabs`)(s)}catch{console.warn(`Forsøker å definere <pkt-tabs>, men den er allerede definert`)}var c=class extends e.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){this.disabled?(e.preventDefault(),e.stopPropagation()):this.context&&this.context.handleClick(this.index)}handleKeyDown(e){this.disabled&&(e.key===`Enter`||e.key===` `||e.key===`Spacebar`)?(e.preventDefault(),e.stopPropagation()):this.context&&this.context.handleKeyUp(e,this.index)}render(){let n=this.context?.useArrowNav??!0,r=this.active&&!this.disabled,o=[r?`active`:``,this.disabled?`pkt-tabs__item--disabled`:``].filter(Boolean).join(` `),s=n?`tab`:void 0,c=n?r:void 0,l=this.disabled?-1:r||!n?void 0:-1,u=`pkt-icon--small ${this.icon===`check`?`pkt-tabs__status-icon`:``}`,d=t._`
|
|
6
|
+
${this.icon?t._`<pkt-icon name=${this.icon} class=${u}></pkt-icon>`:``}
|
|
7
|
+
<span>${e.i(this)}</span>
|
|
8
|
+
${this.tag?t._`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>`:``}
|
|
9
|
+
`;return this.href?t._`
|
|
10
10
|
<a
|
|
11
|
-
${
|
|
12
|
-
href=${
|
|
11
|
+
${i.n(this.elementRef)}
|
|
12
|
+
href=${a.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=${a.t(s)}
|
|
15
|
+
aria-selected=${a.t(c)}
|
|
16
|
+
aria-disabled=${a.t(this.disabled?`true`:void 0)}
|
|
17
|
+
aria-controls=${a.t(this.controls||void 0)}
|
|
18
|
+
tabindex=${a.t(l)}
|
|
19
19
|
@click=${this.handleClick}
|
|
20
20
|
@keydown=${this.handleKeyDown}
|
|
21
21
|
>
|
|
22
22
|
${d}
|
|
23
23
|
</a>
|
|
24
|
-
`:
|
|
24
|
+
`:t._`
|
|
25
25
|
<button
|
|
26
|
-
${
|
|
26
|
+
${i.n(this.elementRef)}
|
|
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=${a.t(this.disabled?`true`:void 0)}
|
|
31
|
+
role=${a.t(s)}
|
|
32
|
+
aria-selected=${a.t(c)}
|
|
33
|
+
aria-controls=${a.t(this.controls||void 0)}
|
|
34
|
+
tabindex=${a.t(l)}
|
|
35
35
|
@click=${this.handleClick}
|
|
36
36
|
@keydown=${this.handleKeyDown}
|
|
37
37
|
>
|
|
38
38
|
${d}
|
|
39
39
|
</button>
|
|
40
|
-
`}};
|
|
40
|
+
`}};t.n([t.u({type:Boolean,reflect:!0})],c.prototype,`active`,void 0),t.n([t.u({type:Boolean,reflect:!0})],c.prototype,`disabled`,void 0),t.n([t.u({type:String,reflect:!0})],c.prototype,`href`,void 0),t.n([t.u({type:String,reflect:!0})],c.prototype,`icon`,void 0),t.n([t.u({type:String,reflect:!0})],c.prototype,`controls`,void 0),t.n([t.u({type:String,reflect:!0})],c.prototype,`tag`,void 0),t.n([t.u({type:String,reflect:!0,attribute:`tag-skin`})],c.prototype,`tagSkin`,void 0),t.n([t.u({type:Number,reflect:!0})],c.prototype,`index`,void 0),t.n([r.t({context:o,subscribe:!0}),t.u({attribute:!1})],c.prototype,`context`,void 0);try{t.d(`pkt-tab-item`)(c)}catch{console.warn(`Forsøker å definere <pkt-tab-item>, men den er allerede definert`)}var l=s;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-D_8fAzCW.cjs");require("./shared-types-BvRk9kiK.cjs"),require("./icon-5A378_yh.cjs");const i=require("./if-defined-Ci4ZQsgL.cjs");var a={closeTag:!1,size:`medium`,skin:`gray`,textStyle:`normal-text`,type:`button`},o=class extends r.t{constructor(){super(),this.closeTag=a.closeTag,this.size=a.size,this.skin=a.skin,this.state=null,this.textStyle=a.textStyle,this.iconName=void 0,this.type=a.type,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}willUpdate(e){if(super.willUpdate(e),this.closeTag&&!this.ariaLabel){let e=r.r(this).getNodes().map(e=>e.textContent??``).join(``).trim();e&&(this._ariaDescription=n.t(this.pktStrings.get(`tag`).remove,{label:e}))}}render(){let n={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.state}`]:!!this.state,[`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-tag--${this.state}`]:!!this.state,"pkt-hide":this._isClosed};return this.closeTag?e._`
|
|
2
|
+
<button
|
|
3
|
+
class=${t.t(a)}
|
|
4
|
+
type=${this.type}
|
|
5
|
+
tabindex=${i.t(this.buttonTabindex)}
|
|
6
|
+
@click=${this.close}
|
|
7
|
+
aria-label=${i.t(this.ariaLabel||void 0)}
|
|
8
|
+
aria-description=${i.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>${r.i(this)}</span>
|
|
16
|
+
<pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
|
|
17
|
+
</button>
|
|
18
|
+
`:e._`
|
|
19
|
+
<span class=${t.t(n)}>
|
|
20
|
+
${this.iconName&&e._`<pkt-icon
|
|
21
|
+
class="pkt-tag__icon"
|
|
22
|
+
name=${this.iconName}
|
|
23
|
+
aria-hidden="true"
|
|
24
|
+
></pkt-icon>`}
|
|
25
|
+
<span>${r.i(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,`state`,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}});
|
|
@@ -1,109 +1,20 @@
|
|
|
1
|
-
import { _ as e, d as t, l as n, n as r, u as i } from "./element-
|
|
2
|
-
import { t as a } from "./class-map-
|
|
3
|
-
import { t as o } from "./format-
|
|
4
|
-
import { i as s, r as c, t as l } from "./element-with-slot-
|
|
5
|
-
import "./
|
|
6
|
-
import
|
|
1
|
+
import { _ as e, d as t, l as n, n as r, u as i } from "./element-Bwc-likm.js";
|
|
2
|
+
import { t as a } from "./class-map-C9n5CNC8.js";
|
|
3
|
+
import { t as o } from "./format-DwjTfa9h.js";
|
|
4
|
+
import { i as s, r as c, t as l } from "./element-with-slot-47quDZRt.js";
|
|
5
|
+
import "./shared-types-BvRk9kiK.js";
|
|
6
|
+
import "./icon-CZDw42U7.js";
|
|
7
|
+
import { t as u } from "./if-defined-B3pYog2C.js";
|
|
8
|
+
// ../../shared-types/tag.ts
|
|
7
9
|
var d = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
props: {
|
|
14
|
-
size: {
|
|
15
|
-
name: "Størrelse",
|
|
16
|
-
description: "Størrelsen på taggen",
|
|
17
|
-
required: !1,
|
|
18
|
-
default: "medium",
|
|
19
|
-
type: [
|
|
20
|
-
"small",
|
|
21
|
-
"medium",
|
|
22
|
-
"large"
|
|
23
|
-
],
|
|
24
|
-
category: "ui"
|
|
25
|
-
},
|
|
26
|
-
iconName: {
|
|
27
|
-
name: "Ikon",
|
|
28
|
-
description: "Navnet på ikonet som skal vises i taggen",
|
|
29
|
-
type: "icon",
|
|
30
|
-
required: !1,
|
|
31
|
-
category: "ui"
|
|
32
|
-
},
|
|
33
|
-
skin: {
|
|
34
|
-
name: "Utseende",
|
|
35
|
-
description: "Utseendet til taggen. Bare standardutseendet gray har dark mode.",
|
|
36
|
-
required: !1,
|
|
37
|
-
default: "gray",
|
|
38
|
-
type: [
|
|
39
|
-
"gray",
|
|
40
|
-
"gray-light",
|
|
41
|
-
"blue-dark",
|
|
42
|
-
"blue",
|
|
43
|
-
"blue-light",
|
|
44
|
-
"blue-pale",
|
|
45
|
-
"green",
|
|
46
|
-
"green-light",
|
|
47
|
-
"red",
|
|
48
|
-
"red-light",
|
|
49
|
-
"yellow",
|
|
50
|
-
"yellow-light",
|
|
51
|
-
"beige",
|
|
52
|
-
"beige-light"
|
|
53
|
-
],
|
|
54
|
-
category: "ui"
|
|
55
|
-
},
|
|
56
|
-
closeTag: {
|
|
57
|
-
name: "Lukk tag",
|
|
58
|
-
description: "Skal taggen ha en lukkeknapp?",
|
|
59
|
-
type: "boolean",
|
|
60
|
-
required: !1,
|
|
61
|
-
default: !1,
|
|
62
|
-
category: "ui"
|
|
63
|
-
},
|
|
64
|
-
state: {
|
|
65
|
-
name: "Tvungen tilstand",
|
|
66
|
-
description: "Viser taggen i en gitt tilstand uten at brukeren samhandler med den",
|
|
67
|
-
required: !1,
|
|
68
|
-
type: [
|
|
69
|
-
"hover",
|
|
70
|
-
"focus",
|
|
71
|
-
"active"
|
|
72
|
-
],
|
|
73
|
-
category: "ui"
|
|
74
|
-
},
|
|
75
|
-
textStyle: {
|
|
76
|
-
name: "Tekststil",
|
|
77
|
-
description: "Stilen på teksten i taggen",
|
|
78
|
-
required: !1,
|
|
79
|
-
default: "normal-text",
|
|
80
|
-
type: ["thin-text", "normal-text"],
|
|
81
|
-
category: "ui"
|
|
82
|
-
},
|
|
83
|
-
type: {
|
|
84
|
-
name: "Type, dersom lukkeknapp",
|
|
85
|
-
description: "Type tag, brukes for å spesifisere om det er en knapp, submit eller reset",
|
|
86
|
-
required: !1,
|
|
87
|
-
default: "button",
|
|
88
|
-
type: [
|
|
89
|
-
"button",
|
|
90
|
-
"submit",
|
|
91
|
-
"reset"
|
|
92
|
-
],
|
|
93
|
-
category: "tech"
|
|
94
|
-
},
|
|
95
|
-
ariaLabel: {
|
|
96
|
-
name: "aria-label",
|
|
97
|
-
description: "aria-label for taggen, brukes for tilgjengelighet",
|
|
98
|
-
type: "string",
|
|
99
|
-
required: !1,
|
|
100
|
-
category: "accessibility"
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
slots: { default: { description: "Teksten til tag" } }
|
|
10
|
+
closeTag: !1,
|
|
11
|
+
size: "medium",
|
|
12
|
+
skin: "gray",
|
|
13
|
+
textStyle: "normal-text",
|
|
14
|
+
type: "button"
|
|
104
15
|
}, f = class extends l {
|
|
105
16
|
constructor() {
|
|
106
|
-
super(), this.closeTag = d.
|
|
17
|
+
super(), this.closeTag = d.closeTag, this.size = d.size, this.skin = d.skin, this.state = null, this.textStyle = d.textStyle, this.iconName = void 0, this.type = d.type, this.ariaLabel = null, this.buttonTabindex = void 0, this._isClosed = !1, this._ariaDescription = null, this.close = (e) => {
|
|
107
18
|
this._isClosed = !0, this.dispatchEvent(new CustomEvent("close", {
|
|
108
19
|
detail: { origin: e },
|
|
109
20
|
bubbles: !1,
|
|
@@ -192,8 +103,6 @@ try {
|
|
|
192
103
|
} catch {
|
|
193
104
|
console.warn("Forsøker å definere <pkt-tag>, men den er allerede definert");
|
|
194
105
|
}
|
|
195
|
-
|
|
196
|
-
//#region src/components/tag/index.ts
|
|
106
|
+
// src/components/tag/index.ts
|
|
197
107
|
var p = f;
|
|
198
|
-
//#endregion
|
|
199
108
|
export { f as n, p as t };
|
|
@@ -1,14 +1,14 @@
|
|
|
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, u as l } from "./element-
|
|
2
|
-
import { t as u } from "./class-map-
|
|
3
|
-
import { i as d, r as f } from "./directive-helpers-
|
|
4
|
-
import { n as p } from "./element-with-slot-
|
|
5
|
-
import "./shared-types-
|
|
6
|
-
import "./icon-
|
|
7
|
-
import { r as m } from "./input-wrapper-
|
|
8
|
-
import { t as h } from "./if-defined-
|
|
9
|
-
import { n as g, t as _ } from "./ref-
|
|
10
|
-
import { t as v } from "./input-element-
|
|
11
|
-
|
|
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, u as l } from "./element-Bwc-likm.js";
|
|
2
|
+
import { t as u } from "./class-map-C9n5CNC8.js";
|
|
3
|
+
import { i as d, r as f } from "./directive-helpers-KMRvtO9j.js";
|
|
4
|
+
import { n as p } from "./element-with-slot-47quDZRt.js";
|
|
5
|
+
import "./shared-types-BvRk9kiK.js";
|
|
6
|
+
import "./icon-CZDw42U7.js";
|
|
7
|
+
import { r as m } from "./input-wrapper-C6BRd-cu.js";
|
|
8
|
+
import { t as h } from "./if-defined-B3pYog2C.js";
|
|
9
|
+
import { n as g, t as _ } from "./ref-qE1RBrI7.js";
|
|
10
|
+
import { t as v } from "./input-element-DE0FzjgP.js";
|
|
11
|
+
// ../../shared-types/textarea.ts
|
|
12
12
|
var y = {
|
|
13
13
|
autoComplete: "off",
|
|
14
14
|
required: !1,
|
|
@@ -133,8 +133,6 @@ try {
|
|
|
133
133
|
} catch {
|
|
134
134
|
console.warn("Forsøker å definere <pkt-textarea>, men den er allerede definert");
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
//#region src/components/textarea/index.ts
|
|
136
|
+
// src/components/textarea/index.ts
|
|
138
137
|
var S = x;
|
|
139
|
-
//#endregion
|
|
140
138
|
export { x as n, S as t };
|