@oslokommune/punkt-elements 12.18.0 → 12.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alert-BbVWu2lm.cjs +27 -0
- package/dist/alert-Dh6A96vo.js +159 -0
- package/dist/{index-D2jSRMrn.js → calendar-BUqcNvfI.js} +41 -29
- package/dist/calendar-QSulz7im.cjs +108 -0
- package/dist/card-B0GPdG5M.cjs +23 -0
- package/dist/card-kWt0BA2a.js +170 -0
- package/dist/{class-map-a5HUzP83.cjs → class-map-Boa7BqCc.cjs} +2 -2
- package/dist/{class-map-CBvUV2N3.js → class-map-hz16xq5a.js} +9 -10
- package/dist/datepicker-BhavwiBZ.js +659 -0
- package/dist/datepicker-vX74tb3R.cjs +154 -0
- package/dist/helptext--4FLdAWi.js +194 -0
- package/dist/helptext-iZEgxz2U.cjs +23 -0
- package/dist/icon-CdMQ6zBT.cjs +250 -0
- package/dist/{index-CFDwiDTU.js → icon-wUXeHiBk.js} +7371 -7559
- package/dist/if-defined-DEDlGbAc.cjs +5 -0
- package/dist/if-defined-ZFE4ti2t.js +10 -0
- package/dist/index.d.ts +49 -51
- package/dist/input-element-BQTCZtNQ.js +185 -0
- package/dist/input-element-DNklGY_O.cjs +1 -0
- package/dist/{input-wrapper-DVXNuxVu.js → input-wrapper-BTQk3W8T.js} +10 -11
- package/dist/input-wrapper-D-PNRJB_.cjs +46 -0
- package/dist/link-BpqavGSD.cjs +8 -0
- package/dist/link-Bx9nVgZi.js +108 -0
- package/dist/linkcard-CUrbzjLK.js +53 -0
- package/dist/linkcard-DSu3A4Yx.cjs +13 -0
- package/dist/messagebox-C1aWoQbu.cjs +12 -0
- package/dist/messagebox-LpiVQIoM.js +107 -0
- package/dist/modal-Avai5eVz.cjs +30 -0
- package/dist/{modal-lQfiTbGh.js → modal-Co1YFmHi.js} +7 -8
- package/dist/pkt-alert.cjs +1 -27
- package/dist/pkt-alert.js +4 -158
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +4 -7
- package/dist/pkt-card.cjs +1 -23
- package/dist/pkt-card.js +4 -169
- package/dist/pkt-datepicker.cjs +1 -154
- package/dist/pkt-datepicker.js +4 -657
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +4 -4
- package/dist/pkt-index.cjs +29 -1
- package/dist/pkt-index.js +127 -32
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -8
- package/dist/pkt-link.js +4 -108
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -12
- package/dist/pkt-messagebox.js +4 -106
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -2
- package/dist/pkt-tag.cjs +1 -17
- package/dist/pkt-tag.js +4 -149
- 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/{progressbar-1PEs_SMc.js → progressbar-BS_oawSB.js} +42 -47
- package/dist/{progressbar-BlzTFI9U.cjs → progressbar-CuXkbAhJ.cjs} +7 -11
- package/dist/ref-DCOsLZQg.cjs +13 -0
- package/dist/{ref-Dzme4zb6.js → ref-DuFGTLVX.js} +26 -27
- package/dist/state-BfyXV7EL.js +12 -0
- package/dist/state-SKYD8kRO.cjs +5 -0
- package/dist/stringutils-CkVRq4jP.cjs +1 -0
- package/dist/stringutils-DJjRa8dG.js +7 -0
- package/dist/tag-CGy2mSLE.cjs +17 -0
- package/dist/tag-DGFgUF3l.js +150 -0
- package/dist/textarea-BFWHQHLs.cjs +48 -0
- package/dist/{textarea-BXzQA_ub.js → textarea-BYtGXst8.js} +29 -29
- package/dist/{textinput-52G3CfwA.cjs → textinput-33wZwZ4O.cjs} +2 -2
- package/dist/{textinput-CTNWiIaP.js → textinput-IgHewJDJ.js} +23 -23
- package/package.json +2 -2
- package/src/components/alert/alert.ts +115 -0
- package/src/components/alert/index.ts +4 -113
- package/src/components/calendar/calendar.ts +711 -0
- package/src/components/calendar/index.ts +3 -711
- package/src/components/card/card.ts +78 -0
- package/src/components/card/index.ts +4 -77
- package/src/components/datepicker/datepicker.ts +619 -0
- package/src/components/datepicker/index.ts +3 -618
- package/src/components/helptext/helptext.ts +2 -2
- package/src/components/icon/icon.ts +99 -0
- package/src/components/icon/index.ts +3 -98
- package/src/components/index.ts +21 -17
- package/src/components/input-wrapper/input-wrapper.ts +2 -2
- package/src/components/link/index.ts +3 -56
- package/src/components/link/link.ts +57 -0
- package/src/components/linkcard/index.ts +1 -1
- package/src/components/linkcard/linkcard.ts +5 -6
- package/src/components/messagebox/index.ts +4 -69
- package/src/components/messagebox/messagebox.ts +69 -0
- package/src/components/modal/index.ts +0 -1
- package/src/components/modal/modal.ts +5 -7
- package/src/components/progressbar/progressbar.ts +2 -2
- package/src/components/tag/index.ts +4 -109
- package/src/components/tag/tag.ts +118 -0
- package/src/components/textarea/textarea.ts +5 -4
- package/src/components/textinput/textinput.ts +3 -3
- package/dist/component-template.d.ts +0 -8
- package/dist/converters-DNCwIFwr.js +0 -17
- package/dist/converters-DhM11VlY.cjs +0 -1
- package/dist/custom-element-B-TlBwRu.cjs +0 -9
- package/dist/custom-element-CWfU4dcr.js +0 -38
- package/dist/element.d.ts +0 -8
- package/dist/helptext-DBolvFI4.js +0 -72
- package/dist/helptext-_fMLOOCL.cjs +0 -23
- package/dist/index-CR7t1zY9.cjs +0 -238
- package/dist/index-CmTjXoAb.cjs +0 -9
- package/dist/index-RwtTBIhT.js +0 -88
- package/dist/index-tvpcg-ad.cjs +0 -108
- package/dist/input-wrapper-tJE-X4Ac.cjs +0 -46
- package/dist/linkcard-BHokvuVN.js +0 -55
- package/dist/linkcard-CUXMP6BH.cjs +0 -13
- package/dist/modal-CjsQgmmH.cjs +0 -30
- package/dist/pkt-component-template.cjs +0 -29
- package/dist/pkt-component-template.js +0 -100
- package/dist/pkt-element.cjs +0 -1
- package/dist/pkt-element.js +0 -5
- package/dist/ref-CA2-0S_W.cjs +0 -13
- package/dist/textarea-D_ud1Mpa.cjs +0 -48
- package/src/components/component-template/index.ts +0 -129
- package/src/components/element/index.ts +0 -353
package/dist/index.d.ts
CHANGED
|
@@ -6,21 +6,13 @@ import { Ref } from 'lit/directives/ref.js';
|
|
|
6
6
|
import { TemplateResult } from 'lit-html';
|
|
7
7
|
import { TZDate } from '@date-fns/tz';
|
|
8
8
|
|
|
9
|
-
declare type AlertAriaLive = 'off' | 'polite' | 'assertive' | null;
|
|
10
|
-
|
|
11
|
-
declare type AlertSkin = 'error' | 'success' | 'warning' | 'info';
|
|
12
|
-
|
|
13
|
-
declare type ICardSkin = 'outlined' | 'gray' | 'beige' | 'green' | 'blue';
|
|
14
|
-
|
|
15
|
-
declare type IDirection = 'portrait' | 'landscape';
|
|
16
|
-
|
|
17
9
|
declare interface IPktLinkCard {
|
|
18
10
|
title?: string;
|
|
19
11
|
href?: string;
|
|
20
12
|
iconName?: string;
|
|
21
13
|
external?: boolean;
|
|
22
14
|
openInNewTab?: boolean;
|
|
23
|
-
skin?:
|
|
15
|
+
skin?: TLinkCardSkin;
|
|
24
16
|
}
|
|
25
17
|
|
|
26
18
|
declare interface IPktModal {
|
|
@@ -28,7 +20,7 @@ declare interface IPktModal {
|
|
|
28
20
|
removePadding?: boolean;
|
|
29
21
|
hideCloseButton?: boolean;
|
|
30
22
|
closeOnBackdropClick?: boolean;
|
|
31
|
-
size?:
|
|
23
|
+
size?: TPktSize;
|
|
32
24
|
}
|
|
33
25
|
|
|
34
26
|
export declare interface IPktProgressbar {
|
|
@@ -48,28 +40,22 @@ export declare interface IPktProgressbar {
|
|
|
48
40
|
|
|
49
41
|
declare interface IPktTag {
|
|
50
42
|
closeTag?: boolean;
|
|
51
|
-
size?:
|
|
52
|
-
skin?:
|
|
43
|
+
size?: TPktSize;
|
|
44
|
+
skin?: TTagSkin;
|
|
53
45
|
textStyle?: string;
|
|
54
46
|
iconName?: string;
|
|
55
|
-
type?:
|
|
47
|
+
type?: TTagType;
|
|
56
48
|
ariaLabel?: string;
|
|
57
49
|
}
|
|
58
50
|
|
|
59
|
-
declare type LinkCardSkin = 'normal' | 'blue' | 'beige' | 'green' | 'gray' | 'beige-outline' | 'gray-outline';
|
|
60
|
-
|
|
61
|
-
declare type MessageboxSkin = 'beige' | 'blue' | 'red' | 'green';
|
|
62
|
-
|
|
63
|
-
declare type ModalSize = 'small' | 'medium' | 'large';
|
|
64
|
-
|
|
65
51
|
export declare class PktAlert extends PktElement {
|
|
66
52
|
defaultSlot: Ref<HTMLElement>;
|
|
67
53
|
constructor();
|
|
68
54
|
compact: boolean;
|
|
69
55
|
title: string;
|
|
70
|
-
skin:
|
|
71
|
-
ariaLive:
|
|
72
|
-
'aria-live':
|
|
56
|
+
skin: TAlertSkin;
|
|
57
|
+
ariaLive: TAriaLive;
|
|
58
|
+
'aria-live': TAriaLive;
|
|
73
59
|
closeAlert: boolean;
|
|
74
60
|
date: string | null;
|
|
75
61
|
_isClosed: boolean;
|
|
@@ -160,8 +146,8 @@ export declare class PktCalendar extends PktElement {
|
|
|
160
146
|
export declare class PktCard extends PktElement {
|
|
161
147
|
defaultSlot: Ref<HTMLElement>;
|
|
162
148
|
constructor();
|
|
163
|
-
skin:
|
|
164
|
-
direction:
|
|
149
|
+
skin: TCardSkin;
|
|
150
|
+
direction: TDirection;
|
|
165
151
|
image: {
|
|
166
152
|
src: string;
|
|
167
153
|
alt: string;
|
|
@@ -331,36 +317,36 @@ export declare class PktIcon extends PktElement {
|
|
|
331
317
|
*/
|
|
332
318
|
declare class PktInputElement extends PktElement {
|
|
333
319
|
static get formAssociated(): boolean;
|
|
334
|
-
id: string;
|
|
335
|
-
name: string;
|
|
336
|
-
required: boolean;
|
|
337
320
|
disabled: boolean;
|
|
338
|
-
|
|
339
|
-
|
|
321
|
+
readonly: boolean;
|
|
322
|
+
required: boolean;
|
|
340
323
|
max: string | number | null;
|
|
341
|
-
minlength: number | null;
|
|
342
324
|
maxlength: number | null;
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
ariaLabelledby: string | null;
|
|
325
|
+
min: string | number | null;
|
|
326
|
+
minlength: number | null;
|
|
346
327
|
ariaDescribedBy: string | null;
|
|
347
|
-
|
|
328
|
+
ariaLabelledby: string | null;
|
|
329
|
+
name: string;
|
|
330
|
+
pattern: string;
|
|
331
|
+
placeholder: string;
|
|
332
|
+
id: string;
|
|
333
|
+
counter: boolean;
|
|
334
|
+
hasError: boolean;
|
|
348
335
|
inline: boolean;
|
|
349
336
|
optionalTag: boolean;
|
|
350
|
-
optionalText: string;
|
|
351
337
|
requiredTag: boolean;
|
|
352
|
-
|
|
353
|
-
|
|
338
|
+
skipForwardTestid: boolean;
|
|
339
|
+
useWrapper: boolean;
|
|
340
|
+
fullwidth: boolean;
|
|
341
|
+
counterMaxLength: number;
|
|
354
342
|
errorMessage: string;
|
|
355
343
|
helptext: string;
|
|
356
|
-
counter: boolean;
|
|
357
|
-
counterMaxLength: number;
|
|
358
344
|
helptextDropdown: string;
|
|
359
345
|
helptextDropdownButton: string | null;
|
|
360
|
-
|
|
361
|
-
|
|
346
|
+
label: string | null;
|
|
347
|
+
optionalText: string;
|
|
348
|
+
requiredText: string;
|
|
362
349
|
dataTestid: string;
|
|
363
|
-
skipForwardTestid: boolean;
|
|
364
350
|
touched: boolean;
|
|
365
351
|
constructor();
|
|
366
352
|
protected manageValidity(input: HTMLInputElement): void;
|
|
@@ -425,7 +411,7 @@ export declare class PktLinkCard extends PktElement implements IPktLinkCard {
|
|
|
425
411
|
iconName: string;
|
|
426
412
|
external: boolean;
|
|
427
413
|
openInNewTab: boolean;
|
|
428
|
-
skin:
|
|
414
|
+
skin: TLinkCardSkin;
|
|
429
415
|
constructor();
|
|
430
416
|
render(): TemplateResult<1>;
|
|
431
417
|
}
|
|
@@ -436,7 +422,7 @@ export declare class PktMessagebox extends PktElement {
|
|
|
436
422
|
closable: boolean;
|
|
437
423
|
compact: boolean;
|
|
438
424
|
title: string;
|
|
439
|
-
skin:
|
|
425
|
+
skin: TMessageboxSkin;
|
|
440
426
|
_isClosed: boolean;
|
|
441
427
|
private close;
|
|
442
428
|
render(): TemplateResult<1>;
|
|
@@ -447,7 +433,7 @@ export declare class PktModal extends PktElement implements IPktModal {
|
|
|
447
433
|
removePadding?: boolean;
|
|
448
434
|
hideCloseButton?: boolean;
|
|
449
435
|
closeOnBackdropClick?: boolean;
|
|
450
|
-
size?:
|
|
436
|
+
size?: TPktSize;
|
|
451
437
|
defaultSlot: Ref<HTMLElement>;
|
|
452
438
|
dialogRef: Ref<HTMLDialogElement>;
|
|
453
439
|
_isOpen: boolean;
|
|
@@ -508,11 +494,11 @@ export declare class PktTag extends PktElement {
|
|
|
508
494
|
* Element attributes
|
|
509
495
|
*/
|
|
510
496
|
closeTag: boolean;
|
|
511
|
-
size:
|
|
512
|
-
skin:
|
|
497
|
+
size: TPktSize;
|
|
498
|
+
skin: TTagSkin;
|
|
513
499
|
textStyle: string;
|
|
514
500
|
iconName: string | undefined;
|
|
515
|
-
type:
|
|
501
|
+
type: TTagType;
|
|
516
502
|
ariaLabel: string;
|
|
517
503
|
/**
|
|
518
504
|
* Element state
|
|
@@ -553,11 +539,19 @@ export declare class PktTextinput extends PktInputElement {
|
|
|
553
539
|
render(): TemplateResult<1>;
|
|
554
540
|
}
|
|
555
541
|
|
|
556
|
-
declare type
|
|
542
|
+
declare type TAlertSkin = 'error' | 'success' | 'warning' | 'info';
|
|
557
543
|
|
|
558
|
-
declare type
|
|
544
|
+
declare type TAriaLive = 'off' | 'polite' | 'assertive' | null;
|
|
559
545
|
|
|
560
|
-
declare type
|
|
546
|
+
declare type TCardSkin = 'outlined' | 'gray' | 'beige' | 'green' | 'blue';
|
|
547
|
+
|
|
548
|
+
declare type TDirection = 'portrait' | 'landscape';
|
|
549
|
+
|
|
550
|
+
declare type TLinkCardSkin = 'normal' | 'blue' | 'beige' | 'green' | 'gray' | 'beige-outline' | 'gray-outline';
|
|
551
|
+
|
|
552
|
+
declare type TMessageboxSkin = 'beige' | 'blue' | 'red' | 'green';
|
|
553
|
+
|
|
554
|
+
declare type TPktSize = 'small' | 'medium' | 'large';
|
|
561
555
|
|
|
562
556
|
export declare type TProgressbarRole = 'progressbar' | 'meter';
|
|
563
557
|
|
|
@@ -569,6 +563,10 @@ export declare type TProgressbarStatusType = 'none' | 'percentage' | 'fraction';
|
|
|
569
563
|
|
|
570
564
|
export declare type TProgressbarTitlePosition = 'left' | 'center';
|
|
571
565
|
|
|
566
|
+
export declare type TTagSkin = 'blue' | 'green' | 'red' | 'yellow' | 'beige' | 'blue-light' | 'gray' | 'grey';
|
|
567
|
+
|
|
568
|
+
export declare type TTagType = 'button' | 'reset' | 'submit';
|
|
569
|
+
|
|
572
570
|
export { }
|
|
573
571
|
|
|
574
572
|
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { n as s, P as f, s as o } from "./icon-wUXeHiBk.js";
|
|
2
|
+
import { r as m } from "./state-BfyXV7EL.js";
|
|
3
|
+
import { u as g } from "./stringutils-DJjRa8dG.js";
|
|
4
|
+
import { s as c } from "./helptext--4FLdAWi.js";
|
|
5
|
+
var v = Object.defineProperty, e = (p, t, r, l) => {
|
|
6
|
+
for (var a = void 0, n = p.length - 1, h; n >= 0; n--)
|
|
7
|
+
(h = p[n]) && (a = h(t, r, a) || a);
|
|
8
|
+
return a && v(t, r, a), a;
|
|
9
|
+
};
|
|
10
|
+
class i extends f {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(), this.disabled = !1, this.readonly = !1, this.required = !1, this.max = null, this.maxlength = 0, this.min = null, this.minlength = 0, this.ariaDescribedBy = null, this.ariaLabelledby = null, this.name = "", this.pattern = "", this.placeholder = "", this.id = g(), this.counter = !1, this.hasError = !1, this.inline = !1, this.optionalTag = !1, this.requiredTag = !1, this.skipForwardTestid = !1, this.useWrapper = !0, this.fullwidth = !1, this.counterMaxLength = 0, this.errorMessage = "", this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = c.props.helptextDropdownButton.default, this.label = null, this.optionalText = o.forms.labels.optional, this.requiredText = o.forms.labels.required, this.dataTestid = "", this.touched = !1, this.internals = this.attachInternals();
|
|
13
|
+
}
|
|
14
|
+
static get formAssociated() {
|
|
15
|
+
return !0;
|
|
16
|
+
}
|
|
17
|
+
manageValidity(t) {
|
|
18
|
+
var r, l, a, n, h, u, d, y;
|
|
19
|
+
t && (this.required && !this.value ? this.internals.setValidity({ valueMissing: !0 }, o.forms.messages.required, t) : (r = t.validity) != null && r.typeMismatch || (l = t.validity) != null && l.badInput ? this.internals.setValidity({ typeMismatch: !0 }, o.forms.messages.invalid, t) : (a = t.validity) != null && a.patternMismatch ? this.internals.setValidity(
|
|
20
|
+
{ patternMismatch: !0 },
|
|
21
|
+
o.forms.messages.invalidPattern,
|
|
22
|
+
t
|
|
23
|
+
) : (n = t.validity) != null && n.tooShort || this.minlength && this.minlength > 0 && this.value.length < this.minlength ? this.internals.setValidity({ tooShort: !0 }, o.forms.messages.tooShort, t) : (h = t.validity) != null && h.tooLong || this.maxlength && this.maxlength > 0 && this.value.length > this.maxlength ? this.internals.setValidity({ tooLong: !0 }, o.forms.messages.tooLong, t) : (u = t.validity) != null && u.rangeUnderflow ? this.internals.setValidity(
|
|
24
|
+
{ rangeUnderflow: !0 },
|
|
25
|
+
o.forms.messages.rangeUnderflow,
|
|
26
|
+
t
|
|
27
|
+
) : (d = t.validity) != null && d.rangeOverflow ? this.internals.setValidity(
|
|
28
|
+
{ rangeOverflow: !0 },
|
|
29
|
+
o.forms.messages.rangeOverflow,
|
|
30
|
+
t
|
|
31
|
+
) : (y = t.validity) != null && y.customError ? this.internals.setValidity({ customError: !0 }, t.validationMessage, t) : this.internals.setValidity({}));
|
|
32
|
+
}
|
|
33
|
+
setFormValue(t) {
|
|
34
|
+
if (this.internals)
|
|
35
|
+
if (Array.isArray(t)) {
|
|
36
|
+
const r = new FormData();
|
|
37
|
+
t.forEach((l) => {
|
|
38
|
+
r.append(this.name, l);
|
|
39
|
+
}), this.internals.setFormValue(r);
|
|
40
|
+
} else
|
|
41
|
+
this.internals.setFormValue(t);
|
|
42
|
+
}
|
|
43
|
+
valueChanged(t, r) {
|
|
44
|
+
(r !== this.value || r !== this._value) && (typeof t == "string" ? ((this.multiple || this.range) && t.includes(",") && (t = t.split(",")), this.value = t, this._value = Array.isArray(t) ? t : [t]) : Array.isArray(t) ? (this.value = t, this._value = t) : (this.value = "", this._value = []), (!this.value || this.value.length === 0) && r && r.length !== 0 ? this.clearInputValue() : this.value && this.value.toString() !== (r == null ? void 0 : r.toString()) && this.onChange(this.value), this.updateComplete.then(() => this.requestUpdate()));
|
|
45
|
+
}
|
|
46
|
+
// When input goes from content to no content
|
|
47
|
+
clearInputValue() {
|
|
48
|
+
const t = this.multiple || this.range ? [] : "";
|
|
49
|
+
this.value = t, this.internals.setFormValue(t), this.dispatchEvent(new Event("change")), this.dispatchEvent(
|
|
50
|
+
new CustomEvent("value-change", {
|
|
51
|
+
detail: t,
|
|
52
|
+
bubbles: !0,
|
|
53
|
+
composed: !0
|
|
54
|
+
})
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
// When user enters the input, we need to push that event out to the form
|
|
58
|
+
onFocus() {
|
|
59
|
+
this.dispatchEvent(new FocusEvent("focus"));
|
|
60
|
+
}
|
|
61
|
+
// And also when the user leaves the input...
|
|
62
|
+
onBlur() {
|
|
63
|
+
this.dispatchEvent(new FocusEvent("blur"));
|
|
64
|
+
}
|
|
65
|
+
// Trigger this when user types in the input
|
|
66
|
+
onInput() {
|
|
67
|
+
this.dispatchEvent(new InputEvent("input"));
|
|
68
|
+
}
|
|
69
|
+
// Trigger this when you want to set the value of the input out to the form
|
|
70
|
+
onChange(t) {
|
|
71
|
+
if (!this.touched) {
|
|
72
|
+
this.touched = !0, t && this.setFormValue(t);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
typeof t != "string" && !Array.isArray(t) || ((this.range || this.multiple) && !Array.isArray(t) && t.includes(",") && (t = t.split(",")), !this.multiple && !this.range && Array.isArray(t) && (t = t[0]), this.setFormValue(t), this.manageValidity(this.inputRef.value), this.inputRefTo && this.manageValidity(this.inputRefTo.value), this.dispatchEvent(new Event("change")), this.dispatchEvent(
|
|
76
|
+
new CustomEvent("value-change", {
|
|
77
|
+
detail: t,
|
|
78
|
+
bubbles: !0,
|
|
79
|
+
composed: !0
|
|
80
|
+
})
|
|
81
|
+
), this.internals.reportValidity());
|
|
82
|
+
}
|
|
83
|
+
updated(t) {
|
|
84
|
+
super.updated(t), t.has("dataTestid") && this.dataTestid && this.inputRef.value && (this.skipForwardTestid ? this.hasAttribute("data-testid") || this.setAttribute("data-testid", this.dataTestid) : (this.inputRef.value.dataset.testid = this.dataTestid, this.removeAttribute("data-testid")));
|
|
85
|
+
}
|
|
86
|
+
firstUpdated(t) {
|
|
87
|
+
super.firstUpdated(t), this.required && (this.internals.ariaRequired = !0), this.disabled && (this.internals.ariaDisabled = !0), this.internals.setFormValue(this.value), this.inputRef && this.inputRef.value && (this.inputRef.value.setAttribute("form", ""), this.manageValidity(this.inputRef.value)), this.inputRefTo && this.inputRefTo.value && (this.inputRefTo.value.setAttribute("form", ""), this.manageValidity(this.inputRefTo.value));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
e([
|
|
91
|
+
s({ type: Boolean, reflect: !0 })
|
|
92
|
+
], i.prototype, "disabled");
|
|
93
|
+
e([
|
|
94
|
+
s({ type: Boolean, reflect: !0 })
|
|
95
|
+
], i.prototype, "readonly");
|
|
96
|
+
e([
|
|
97
|
+
s({ type: Boolean, reflect: !0 })
|
|
98
|
+
], i.prototype, "required");
|
|
99
|
+
e([
|
|
100
|
+
s({ type: Number, reflect: !0 })
|
|
101
|
+
], i.prototype, "max");
|
|
102
|
+
e([
|
|
103
|
+
s({ type: Number, reflect: !0 })
|
|
104
|
+
], i.prototype, "maxlength");
|
|
105
|
+
e([
|
|
106
|
+
s({ type: Number, reflect: !0 })
|
|
107
|
+
], i.prototype, "min");
|
|
108
|
+
e([
|
|
109
|
+
s({ type: Number, reflect: !0 })
|
|
110
|
+
], i.prototype, "minlength");
|
|
111
|
+
e([
|
|
112
|
+
s({ type: String })
|
|
113
|
+
], i.prototype, "ariaDescribedBy");
|
|
114
|
+
e([
|
|
115
|
+
s({ type: String })
|
|
116
|
+
], i.prototype, "ariaLabelledby");
|
|
117
|
+
e([
|
|
118
|
+
s({ type: String, reflect: !0 })
|
|
119
|
+
], i.prototype, "name");
|
|
120
|
+
e([
|
|
121
|
+
s({ type: String, reflect: !0 })
|
|
122
|
+
], i.prototype, "pattern");
|
|
123
|
+
e([
|
|
124
|
+
s({ type: String, reflect: !0 })
|
|
125
|
+
], i.prototype, "placeholder");
|
|
126
|
+
e([
|
|
127
|
+
s({ type: String, reflect: !0 })
|
|
128
|
+
], i.prototype, "id");
|
|
129
|
+
e([
|
|
130
|
+
s({ type: Boolean })
|
|
131
|
+
], i.prototype, "counter");
|
|
132
|
+
e([
|
|
133
|
+
s({ type: Boolean })
|
|
134
|
+
], i.prototype, "hasError");
|
|
135
|
+
e([
|
|
136
|
+
s({ type: Boolean })
|
|
137
|
+
], i.prototype, "inline");
|
|
138
|
+
e([
|
|
139
|
+
s({ type: Boolean })
|
|
140
|
+
], i.prototype, "optionalTag");
|
|
141
|
+
e([
|
|
142
|
+
s({ type: Boolean })
|
|
143
|
+
], i.prototype, "requiredTag");
|
|
144
|
+
e([
|
|
145
|
+
s({ type: Boolean })
|
|
146
|
+
], i.prototype, "skipForwardTestid");
|
|
147
|
+
e([
|
|
148
|
+
s({ type: Boolean })
|
|
149
|
+
], i.prototype, "useWrapper");
|
|
150
|
+
e([
|
|
151
|
+
s({ type: Boolean, reflect: !0 })
|
|
152
|
+
], i.prototype, "fullwidth");
|
|
153
|
+
e([
|
|
154
|
+
s({ type: Number })
|
|
155
|
+
], i.prototype, "counterMaxLength");
|
|
156
|
+
e([
|
|
157
|
+
s({ type: String })
|
|
158
|
+
], i.prototype, "errorMessage");
|
|
159
|
+
e([
|
|
160
|
+
s({ type: String })
|
|
161
|
+
], i.prototype, "helptext");
|
|
162
|
+
e([
|
|
163
|
+
s({ type: String })
|
|
164
|
+
], i.prototype, "helptextDropdown");
|
|
165
|
+
e([
|
|
166
|
+
s({ type: String })
|
|
167
|
+
], i.prototype, "helptextDropdownButton");
|
|
168
|
+
e([
|
|
169
|
+
s({ type: String })
|
|
170
|
+
], i.prototype, "label");
|
|
171
|
+
e([
|
|
172
|
+
s({ type: String })
|
|
173
|
+
], i.prototype, "optionalText");
|
|
174
|
+
e([
|
|
175
|
+
s({ type: String })
|
|
176
|
+
], i.prototype, "requiredText");
|
|
177
|
+
e([
|
|
178
|
+
s({ type: String, attribute: "data-testid" })
|
|
179
|
+
], i.prototype, "dataTestid");
|
|
180
|
+
e([
|
|
181
|
+
m()
|
|
182
|
+
], i.prototype, "touched");
|
|
183
|
+
export {
|
|
184
|
+
i as P
|
|
185
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./icon-CdMQ6zBT.cjs"),y=require("./state-SKYD8kRO.cjs"),f=require("./stringutils-CkVRq4jP.cjs"),g=require("./helptext-iZEgxz2U.cjs");var m=Object.defineProperty,s=(h,t,r,o)=>{for(var a=void 0,n=h.length-1,l;n>=0;n--)(l=h[n])&&(a=l(t,r,a)||a);return a&&m(t,r,a),a};class i extends e.PktElement{constructor(){super(),this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=0,this.min=null,this.minlength=0,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern="",this.placeholder="",this.id=f.uuidish(),this.counter=!1,this.hasError=!1,this.inline=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=g.specs.props.helptextDropdownButton.default,this.label=null,this.optionalText=e.strings.forms.labels.optional,this.requiredText=e.strings.forms.labels.required,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(t){var r,o,a,n,l,p,u,d;t&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},e.strings.forms.messages.required,t):(r=t.validity)!=null&&r.typeMismatch||(o=t.validity)!=null&&o.badInput?this.internals.setValidity({typeMismatch:!0},e.strings.forms.messages.invalid,t):(a=t.validity)!=null&&a.patternMismatch?this.internals.setValidity({patternMismatch:!0},e.strings.forms.messages.invalidPattern,t):(n=t.validity)!=null&&n.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},e.strings.forms.messages.tooShort,t):(l=t.validity)!=null&&l.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},e.strings.forms.messages.tooLong,t):(p=t.validity)!=null&&p.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},e.strings.forms.messages.rangeUnderflow,t):(u=t.validity)!=null&&u.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},e.strings.forms.messages.rangeOverflow,t):(d=t.validity)!=null&&d.customError?this.internals.setValidity({customError:!0},t.validationMessage,t):this.internals.setValidity({}))}setFormValue(t){if(this.internals)if(Array.isArray(t)){const r=new FormData;t.forEach(o=>{r.append(this.name,o)}),this.internals.setFormValue(r)}else this.internals.setFormValue(t)}valueChanged(t,r){(r!==this.value||r!==this._value)&&(typeof t=="string"?((this.multiple||this.range)&&t.includes(",")&&(t=t.split(",")),this.value=t,this._value=Array.isArray(t)?t:[t]):Array.isArray(t)?(this.value=t,this._value=t):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&r&&r.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(r==null?void 0:r.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}clearInputValue(){const t=this.multiple||this.range?[]:"";this.value=t,this.internals.setFormValue(t),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus"))}onBlur(){this.dispatchEvent(new FocusEvent("blur"))}onInput(){this.dispatchEvent(new InputEvent("input"))}onChange(t){if(!this.touched){this.touched=!0,t&&this.setFormValue(t);return}typeof t!="string"&&!Array.isArray(t)||((this.range||this.multiple)&&!Array.isArray(t)&&t.includes(",")&&(t=t.split(",")),!this.multiple&&!this.range&&Array.isArray(t)&&(t=t[0]),this.setFormValue(t),this.manageValidity(this.inputRef.value),this.inputRefTo&&this.manageValidity(this.inputRefTo.value),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0})),this.internals.reportValidity())}updated(t){super.updated(t),t.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(t){super.firstUpdated(t),this.required&&(this.internals.ariaRequired=!0),this.disabled&&(this.internals.ariaDisabled=!0),this.internals.setFormValue(this.value),this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}}s([e.n({type:Boolean,reflect:!0})],i.prototype,"disabled");s([e.n({type:Boolean,reflect:!0})],i.prototype,"readonly");s([e.n({type:Boolean,reflect:!0})],i.prototype,"required");s([e.n({type:Number,reflect:!0})],i.prototype,"max");s([e.n({type:Number,reflect:!0})],i.prototype,"maxlength");s([e.n({type:Number,reflect:!0})],i.prototype,"min");s([e.n({type:Number,reflect:!0})],i.prototype,"minlength");s([e.n({type:String})],i.prototype,"ariaDescribedBy");s([e.n({type:String})],i.prototype,"ariaLabelledby");s([e.n({type:String,reflect:!0})],i.prototype,"name");s([e.n({type:String,reflect:!0})],i.prototype,"pattern");s([e.n({type:String,reflect:!0})],i.prototype,"placeholder");s([e.n({type:String,reflect:!0})],i.prototype,"id");s([e.n({type:Boolean})],i.prototype,"counter");s([e.n({type:Boolean})],i.prototype,"hasError");s([e.n({type:Boolean})],i.prototype,"inline");s([e.n({type:Boolean})],i.prototype,"optionalTag");s([e.n({type:Boolean})],i.prototype,"requiredTag");s([e.n({type:Boolean})],i.prototype,"skipForwardTestid");s([e.n({type:Boolean})],i.prototype,"useWrapper");s([e.n({type:Boolean,reflect:!0})],i.prototype,"fullwidth");s([e.n({type:Number})],i.prototype,"counterMaxLength");s([e.n({type:String})],i.prototype,"errorMessage");s([e.n({type:String})],i.prototype,"helptext");s([e.n({type:String})],i.prototype,"helptextDropdown");s([e.n({type:String})],i.prototype,"helptextDropdownButton");s([e.n({type:String})],i.prototype,"label");s([e.n({type:String})],i.prototype,"optionalText");s([e.n({type:String})],i.prototype,"requiredText");s([e.n({type:String,attribute:"data-testid"})],i.prototype,"dataTestid");s([y.r()],i.prototype,"touched");exports.PktInputElement=i;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { P as x,
|
|
2
|
-
import { P as
|
|
3
|
-
import { e as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import "./helptext-DBolvFI4.js";
|
|
1
|
+
import { P as x, E as a, x as p, n as r, t as w, o as m } from "./icon-wUXeHiBk.js";
|
|
2
|
+
import { P as k } from "./pkt-slot-controller-RJvOnbF4.js";
|
|
3
|
+
import { e as v, n as T } from "./ref-DuFGTLVX.js";
|
|
4
|
+
import { e as u } from "./class-map-hz16xq5a.js";
|
|
5
|
+
import { u as _ } from "./stringutils-DJjRa8dG.js";
|
|
6
|
+
import { s as o } from "./helptext--4FLdAWi.js";
|
|
8
7
|
var D = Object.defineProperty, B = Object.getOwnPropertyDescriptor, e = (c, h, l, i) => {
|
|
9
8
|
for (var s = i > 1 ? void 0 : i ? B(h, l) : h, n = c.length - 1, d; n >= 0; n--)
|
|
10
9
|
(d = c[n]) && (s = (i ? d(h, l, s) : d(s)) || s);
|
|
@@ -12,7 +11,7 @@ var D = Object.defineProperty, B = Object.getOwnPropertyDescriptor, e = (c, h, l
|
|
|
12
11
|
};
|
|
13
12
|
let t = class extends x {
|
|
14
13
|
constructor() {
|
|
15
|
-
super(), this.defaultSlot =
|
|
14
|
+
super(), this.defaultSlot = v(), this.forId = _(), this.label = "", this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = o.props.helptextDropdownButton.default, this.counter = o.props.counter.default, this.counterCurrent = 0, this.counterMaxLength = 0, this.optionalTag = o.props.optionalTag.default, this.optionalText = o.props.optionalText.default, this.requiredTag = o.props.requiredTag.default, this.requiredText = o.props.requiredText.default, this.hasError = o.props.hasError.default, this.errorMessage = "", this.disabled = o.props.disabled.default, this.inline = o.props.inline.default, this.ariaDescribedby = void 0, this.hasFieldset = o.props.hasFieldset.default, this.useWrapper = o.props.useWrapper.default, this.slotController = new k(this, this.defaultSlot);
|
|
16
15
|
}
|
|
17
16
|
render() {
|
|
18
17
|
const c = {
|
|
@@ -58,13 +57,13 @@ let t = class extends x {
|
|
|
58
57
|
id="${this.forId}-error"
|
|
59
58
|
>
|
|
60
59
|
<pkt-icon name="alert-error" class="pkt-alert__icon"></pkt-icon>
|
|
61
|
-
<div class="pkt-alert__text">${
|
|
60
|
+
<div class="pkt-alert__text">${m(this.errorMessage)}</div>
|
|
62
61
|
</div>` : a, f = () => p`
|
|
63
62
|
${d()} ${y()}
|
|
64
63
|
${l ? p`<label for="${this.forId}" class="pkt-sr-only" aria-describedby="${s}"
|
|
65
64
|
>${this.label}</label
|
|
66
65
|
>` : a}
|
|
67
|
-
<div class="pkt-contents" ${
|
|
66
|
+
<div class="pkt-contents" ${T(this.defaultSlot)}></div>
|
|
68
67
|
${b()} ${$()}
|
|
69
68
|
`, g = () => this.hasFieldset ? p`<fieldset class=${u(i)} aria-describedby="${s}">
|
|
70
69
|
${f()}
|
|
@@ -137,7 +136,7 @@ e([
|
|
|
137
136
|
r({ type: Boolean })
|
|
138
137
|
], t.prototype, "useWrapper", 2);
|
|
139
138
|
t = e([
|
|
140
|
-
|
|
139
|
+
w("pkt-input-wrapper")
|
|
141
140
|
], t);
|
|
142
141
|
export {
|
|
143
142
|
t as P
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";const t=require("./icon-CdMQ6zBT.cjs"),f=require("./pkt-slot-controller-Ckk_yV0j.cjs"),d=require("./ref-DCOsLZQg.cjs"),l=require("./class-map-Boa7BqCc.cjs"),g=require("./stringutils-CkVRq4jP.cjs"),r=require("./helptext-iZEgxz2U.cjs");var $=Object.defineProperty,I=Object.getOwnPropertyDescriptor,e=(u,n,a,s)=>{for(var p=s>1?void 0:s?I(n,a):n,o=u.length-1,i;o>=0;o--)(i=u[o])&&(p=(s?i(n,a,p):i(p))||p);return s&&p&&$(n,a,p),p};exports.PktInputWrapper=class extends t.PktElement{constructor(){super(),this.defaultSlot=d.e(),this.forId=g.uuidish(),this.label="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=r.specs.props.helptextDropdownButton.default,this.counter=r.specs.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.optionalTag=r.specs.props.optionalTag.default,this.optionalText=r.specs.props.optionalText.default,this.requiredTag=r.specs.props.requiredTag.default,this.requiredText=r.specs.props.requiredText.default,this.hasError=r.specs.props.hasError.default,this.errorMessage="",this.disabled=r.specs.props.disabled.default,this.inline=r.specs.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=r.specs.props.hasFieldset.default,this.useWrapper=r.specs.props.useWrapper.default,this.slotController=new f.PktSlotController(this,this.defaultSlot)}render(){const n={"pkt-inputwrapper":!0,"pkt-inputwrapper--error":this.hasError,"pkt-inputwrapper--disabled":this.disabled,"pkt-inputwrapper--inline":this.inline},a={"pkt-tag":!0,"pkt-tag--small":!0,"pkt-tag--thin-text":!0,"pkt-tag--blue-light":this.optionalTag,"pkt-tag--beige":!this.optionalTag&&this.requiredTag},s=this.helptextDropdown!=="",p={"pkt-inputwrapper__label":!0,"pkt-inputwrapper__fieldset":this.hasFieldset,"pkt-inputwrapper__legend":this.hasFieldset},o=this.ariaDescribedby?this.ariaDescribedby:this.helptext?`${this.forId}-helptext`:t.E,i=()=>this.optionalTag||this.requiredTag?t.x`<span class=${l.e(a)}
|
|
2
|
+
>${this.optionalTag?this.optionalText:this.requiredTag?this.requiredText:t.E}</span
|
|
3
|
+
>`:t.E,c=()=>this.useWrapper?this.hasFieldset?t.x`<legend class="pkt-inputwrapper__legend" id="${this.forId}-label">
|
|
4
|
+
${this.label} ${i()}
|
|
5
|
+
</legend>`:s?t.x`<h2>${this.label} ${i()}</h2>`:t.x`<span>${this.label} ${i()}</span>`:t.x`<label
|
|
6
|
+
for="${this.forId}"
|
|
7
|
+
class="pkt-sr-only"
|
|
8
|
+
aria-describedby="${o}"
|
|
9
|
+
id="${this.forId}-label"
|
|
10
|
+
>
|
|
11
|
+
${this.label}
|
|
12
|
+
</label>`,x=()=>this.useWrapper&&(this.helptext||this.helptextDropdown)?t.x`
|
|
13
|
+
<pkt-helptext
|
|
14
|
+
.forId=${this.forId}
|
|
15
|
+
.helptext=${this.helptext}
|
|
16
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
17
|
+
.helptextDropdownButton=${this.helptextDropdownButton||r.specs.props.helptextDropdownButton.default}
|
|
18
|
+
></pkt-helptext>
|
|
19
|
+
`:t.E,y=()=>this.counter?t.x`<div class="pkt-input__counter" aria-live="polite" aria-atomic="true">
|
|
20
|
+
${this.counterCurrent||0}
|
|
21
|
+
${this.counterMaxLength?`/${this.counterMaxLength}`:t.E}
|
|
22
|
+
</div>`:t.E,k=()=>this.hasError&&this.errorMessage?t.x`<div
|
|
23
|
+
class="pkt-alert pkt-alert--error pkt-alert--compact"
|
|
24
|
+
aria-live="assertive"
|
|
25
|
+
aria-atomic="true"
|
|
26
|
+
id="${this.forId}-error"
|
|
27
|
+
>
|
|
28
|
+
<pkt-icon name="alert-error" class="pkt-alert__icon"></pkt-icon>
|
|
29
|
+
<div class="pkt-alert__text">${t.o(this.errorMessage)}</div>
|
|
30
|
+
</div>`:t.E,h=()=>t.x`
|
|
31
|
+
${c()} ${x()}
|
|
32
|
+
${s?t.x`<label for="${this.forId}" class="pkt-sr-only" aria-describedby="${o}"
|
|
33
|
+
>${this.label}</label
|
|
34
|
+
>`:t.E}
|
|
35
|
+
<div class="pkt-contents" ${d.n(this.defaultSlot)}></div>
|
|
36
|
+
${y()} ${k()}
|
|
37
|
+
`,b=()=>this.hasFieldset?t.x`<fieldset class=${l.e(p)} aria-describedby="${o}">
|
|
38
|
+
${h()}
|
|
39
|
+
</fieldset>`:s?t.x`<div class=${l.e(p)}>${h()}</div>`:t.x`<label
|
|
40
|
+
class=${l.e(p)}
|
|
41
|
+
for="${this.forId}"
|
|
42
|
+
aria-describedby="${o}"
|
|
43
|
+
id="${this.forId}-label"
|
|
44
|
+
>
|
|
45
|
+
${h()}
|
|
46
|
+
</label>`;return t.x`<div class=${l.e(n)}>${b()}</div> `}};e([t.n({type:String})],exports.PktInputWrapper.prototype,"forId",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"label",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"helptext",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"helptextDropdown",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"helptextDropdownButton",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"counter",2);e([t.n({type:Number})],exports.PktInputWrapper.prototype,"counterCurrent",2);e([t.n({type:Number})],exports.PktInputWrapper.prototype,"counterMaxLength",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"optionalTag",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"optionalText",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"requiredTag",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"requiredText",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"hasError",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"errorMessage",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"disabled",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"inline",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"ariaDescribedby",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"hasFieldset",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"useWrapper",2);exports.PktInputWrapper=e([t.t("pkt-input-wrapper")],exports.PktInputWrapper);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";const t=require("./icon-CdMQ6zBT.cjs"),k=require("./pkt-slot-controller-Ckk_yV0j.cjs"),p=require("./ref-DCOsLZQg.cjs"),h=require("./class-map-Boa7BqCc.cjs"),f="pkt-link",u=!0,d={href:{name:"URL",description:"URL til lenken",type:"string",default:"#"},target:{name:"Mål",description:"Mål for lenken",type:["_blank","_self","_parent","_top"],default:"_self"},iconName:{name:"Ikon",description:"Ikon som skal vises ved siden av lenketeksten",type:"icon"},iconPosition:{name:"Ikonposisjon",description:"Posisjonen til ikonet i forhold til lenketeksten",type:["left","right"]},external:{name:"Ekstern lenke",description:"Vis ikon for ekstern lenke",type:"boolean",default:!1}},m={default:{description:"Innholdet i lenken"}},a={name:f,"css-class":"pkt-link","dark-mode":!0,isElement:u,props:d,slots:m};var P=Object.defineProperty,y=Object.getOwnPropertyDescriptor,i=(s,n,r,o)=>{for(var e=o>1?void 0:o?y(n,r):n,l=s.length-1,c;l>=0;l--)(c=s[l])&&(e=(o?c(n,r,e):c(e))||e);return o&&e&&P(n,r,e),e};exports.PktLink=class extends t.PktElement{constructor(){super(),this.defaultSlot=p.e(),this.href=a.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=a.props.external.default,this.target=a.props.target.default,this.slotController=new k.PktSlotController(this,this.defaultSlot)}render(){const n={"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 t.x`<a
|
|
2
|
+
class=${h.e(n)}
|
|
3
|
+
href=${this.href}
|
|
4
|
+
@click=${this.handleClick}
|
|
5
|
+
.target=${this.target}
|
|
6
|
+
.rel=${this.external?"noopener noreferrer":t.E}
|
|
7
|
+
>${this.iconName?t.x`<pkt-icon name=${this.iconName} class="pkt-link__icon"></pkt-icon>`:""} <span ${p.n(this.defaultSlot)}>Link</span></a
|
|
8
|
+
>`}handleClick(){this.dispatchEvent(new CustomEvent("click",{detail:"pkt-link-clicked",bubbles:!0}))}};i([t.n({type:String,reflect:!0})],exports.PktLink.prototype,"href",2);i([t.n({type:String,reflect:!0})],exports.PktLink.prototype,"iconName",2);i([t.n({type:String,reflect:!0})],exports.PktLink.prototype,"iconPosition",2);i([t.n({type:Boolean,reflect:!0})],exports.PktLink.prototype,"external",2);i([t.n({type:String,reflect:!0})],exports.PktLink.prototype,"target",2);exports.PktLink=i([t.t("pkt-link")],exports.PktLink);
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { P as f, x as k, E as h, n as i, t as m } from "./icon-wUXeHiBk.js";
|
|
2
|
+
import { P as d } from "./pkt-slot-controller-RJvOnbF4.js";
|
|
3
|
+
import { e as u, n as P } from "./ref-DuFGTLVX.js";
|
|
4
|
+
import { e as y } from "./class-map-hz16xq5a.js";
|
|
5
|
+
const g = "pkt-link", v = !0, _ = {
|
|
6
|
+
href: {
|
|
7
|
+
name: "URL",
|
|
8
|
+
description: "URL til lenken",
|
|
9
|
+
type: "string",
|
|
10
|
+
default: "#"
|
|
11
|
+
},
|
|
12
|
+
target: {
|
|
13
|
+
name: "Mål",
|
|
14
|
+
description: "Mål for lenken",
|
|
15
|
+
type: [
|
|
16
|
+
"_blank",
|
|
17
|
+
"_self",
|
|
18
|
+
"_parent",
|
|
19
|
+
"_top"
|
|
20
|
+
],
|
|
21
|
+
default: "_self"
|
|
22
|
+
},
|
|
23
|
+
iconName: {
|
|
24
|
+
name: "Ikon",
|
|
25
|
+
description: "Ikon som skal vises ved siden av lenketeksten",
|
|
26
|
+
type: "icon"
|
|
27
|
+
},
|
|
28
|
+
iconPosition: {
|
|
29
|
+
name: "Ikonposisjon",
|
|
30
|
+
description: "Posisjonen til ikonet i forhold til lenketeksten",
|
|
31
|
+
type: [
|
|
32
|
+
"left",
|
|
33
|
+
"right"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
external: {
|
|
37
|
+
name: "Ekstern lenke",
|
|
38
|
+
description: "Vis ikon for ekstern lenke",
|
|
39
|
+
type: "boolean",
|
|
40
|
+
default: !1
|
|
41
|
+
}
|
|
42
|
+
}, x = {
|
|
43
|
+
default: {
|
|
44
|
+
description: "Innholdet i lenken"
|
|
45
|
+
}
|
|
46
|
+
}, c = {
|
|
47
|
+
name: g,
|
|
48
|
+
"css-class": "pkt-link",
|
|
49
|
+
"dark-mode": !0,
|
|
50
|
+
isElement: v,
|
|
51
|
+
props: _,
|
|
52
|
+
slots: x
|
|
53
|
+
};
|
|
54
|
+
var $ = Object.defineProperty, N = Object.getOwnPropertyDescriptor, n = (o, s, l, r) => {
|
|
55
|
+
for (var e = r > 1 ? void 0 : r ? N(s, l) : s, a = o.length - 1, p; a >= 0; a--)
|
|
56
|
+
(p = o[a]) && (e = (r ? p(s, l, e) : p(e)) || e);
|
|
57
|
+
return r && e && $(s, l, e), e;
|
|
58
|
+
};
|
|
59
|
+
let t = class extends f {
|
|
60
|
+
constructor() {
|
|
61
|
+
super(), this.defaultSlot = u(), this.href = c.props.href.default, this.iconName = void 0, this.iconPosition = void 0, this.external = c.props.external.default, this.target = c.props.target.default, this.slotController = new d(this, this.defaultSlot);
|
|
62
|
+
}
|
|
63
|
+
render() {
|
|
64
|
+
const o = {
|
|
65
|
+
"pkt-link": !0,
|
|
66
|
+
"pkt-link--icon-left": !!this.iconName && this.iconPosition === "left" || !!(this.iconName && !this.iconPosition),
|
|
67
|
+
"pkt-link--icon-right": !!this.iconName && this.iconPosition === "right",
|
|
68
|
+
"pkt-link--external": this.external
|
|
69
|
+
};
|
|
70
|
+
return k`<a
|
|
71
|
+
class=${y(o)}
|
|
72
|
+
href=${this.href}
|
|
73
|
+
@click=${this.handleClick}
|
|
74
|
+
.target=${this.target}
|
|
75
|
+
.rel=${this.external ? "noopener noreferrer" : h}
|
|
76
|
+
>${this.iconName ? k`<pkt-icon name=${this.iconName} class="pkt-link__icon"></pkt-icon>` : ""} <span ${P(this.defaultSlot)}>Link</span></a
|
|
77
|
+
>`;
|
|
78
|
+
}
|
|
79
|
+
handleClick() {
|
|
80
|
+
this.dispatchEvent(
|
|
81
|
+
new CustomEvent("click", {
|
|
82
|
+
detail: "pkt-link-clicked",
|
|
83
|
+
bubbles: !0
|
|
84
|
+
})
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
n([
|
|
89
|
+
i({ type: String, reflect: !0 })
|
|
90
|
+
], t.prototype, "href", 2);
|
|
91
|
+
n([
|
|
92
|
+
i({ type: String, reflect: !0 })
|
|
93
|
+
], t.prototype, "iconName", 2);
|
|
94
|
+
n([
|
|
95
|
+
i({ type: String, reflect: !0 })
|
|
96
|
+
], t.prototype, "iconPosition", 2);
|
|
97
|
+
n([
|
|
98
|
+
i({ type: Boolean, reflect: !0 })
|
|
99
|
+
], t.prototype, "external", 2);
|
|
100
|
+
n([
|
|
101
|
+
i({ type: String, reflect: !0 })
|
|
102
|
+
], t.prototype, "target", 2);
|
|
103
|
+
t = n([
|
|
104
|
+
m("pkt-link")
|
|
105
|
+
], t);
|
|
106
|
+
export {
|
|
107
|
+
t as P
|
|
108
|
+
};
|