@oslokommune/punkt-elements 12.17.2 → 12.18.1
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-BHepKxof.cjs +154 -0
- package/dist/datepicker-iNCYioZ9.js +659 -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 +96 -51
- package/dist/input-element-D1Vls6A5.js +184 -0
- package/dist/input-element-DPKoFVwJ.cjs +1 -0
- package/dist/{input-wrapper-6vTrKtsW.js → input-wrapper-BTQk3W8T.js} +10 -10
- 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-BlWQ8jOv.js → linkcard-CUrbzjLK.js} +16 -17
- package/dist/linkcard-DSu3A4Yx.cjs +13 -0
- package/dist/messagebox-C1aWoQbu.cjs +12 -0
- package/dist/messagebox-LpiVQIoM.js +107 -0
- package/dist/{modal-DYTVJjYh.cjs → modal-Avai5eVz.cjs} +2 -2
- package/dist/{modal-3OZTPqee.js → modal-Co1YFmHi.js} +8 -8
- package/dist/pkt-alert.cjs +1 -27
- package/dist/pkt-alert.js +4 -157
- 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 -168
- 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 -30
- 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 -107
- 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 -105
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/pkt-progressbar.cjs +1 -0
- package/dist/pkt-progressbar.js +6 -0
- package/dist/pkt-slot-controller-Ckk_yV0j.cjs +1 -0
- package/dist/pkt-slot-controller-RJvOnbF4.js +61 -0
- package/dist/pkt-tag.cjs +1 -17
- package/dist/pkt-tag.js +4 -148
- 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-BS_oawSB.js +150 -0
- package/dist/progressbar-CuXkbAhJ.cjs +32 -0
- package/dist/ref-DCOsLZQg.cjs +13 -0
- package/dist/ref-DuFGTLVX.js +142 -0
- 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-BTpJjEhO.js → textarea-BAGWR1Hi.js} +29 -29
- package/dist/textarea-BiUrhAlk.cjs +48 -0
- package/dist/{textinput-BIhQEr8z.cjs → textinput-CHOR5PPp.cjs} +2 -2
- package/dist/{textinput-CVo5wG14.js → textinput-pJ3N8m6g.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 +29 -15
- 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/index.ts +12 -0
- package/src/components/progressbar/progressbar.ts +144 -0
- 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/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-DX41tnbj.cjs +0 -46
- package/dist/linkcard-Det6CJ5D.cjs +0 -13
- package/dist/pkt-component-template.cjs +0 -29
- package/dist/pkt-component-template.js +0 -99
- package/dist/pkt-element.cjs +0 -1
- package/dist/pkt-element.js +0 -5
- package/dist/ref-C2yPtMJA.cjs +0 -13
- package/dist/ref-CaiKp3S2.js +0 -202
- package/dist/textarea-B45ZZYpx.cjs +0 -48
- package/src/components/component-template/index.ts +0 -129
- package/src/components/element/index.ts +0 -353
- /package/dist/{component-template.d.ts → progressbar.d.ts} +0 -0
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,33 +20,42 @@ declare interface IPktModal {
|
|
|
28
20
|
removePadding?: boolean;
|
|
29
21
|
hideCloseButton?: boolean;
|
|
30
22
|
closeOnBackdropClick?: boolean;
|
|
31
|
-
size?:
|
|
23
|
+
size?: TPktSize;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export declare interface IPktProgressbar {
|
|
27
|
+
valueCurrent: number;
|
|
28
|
+
valueMax?: number;
|
|
29
|
+
valueMin?: number;
|
|
30
|
+
ariaValueText?: string;
|
|
31
|
+
skin?: TProgressbarSkin;
|
|
32
|
+
title?: string;
|
|
33
|
+
titlePosition?: TProgressbarTitlePosition;
|
|
34
|
+
statusType?: TProgressbarStatusType;
|
|
35
|
+
statusPlacement?: TProgressbarStatusPlacement;
|
|
36
|
+
ariaLabel?: string;
|
|
37
|
+
ariaLabelledby?: string;
|
|
38
|
+
role?: TProgressbarRole;
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
declare interface IPktTag {
|
|
35
42
|
closeTag?: boolean;
|
|
36
|
-
size?:
|
|
37
|
-
skin?:
|
|
43
|
+
size?: TPktSize;
|
|
44
|
+
skin?: TTagSkin;
|
|
38
45
|
textStyle?: string;
|
|
39
46
|
iconName?: string;
|
|
40
|
-
type?:
|
|
47
|
+
type?: TTagType;
|
|
41
48
|
ariaLabel?: string;
|
|
42
49
|
}
|
|
43
50
|
|
|
44
|
-
declare type LinkCardSkin = 'normal' | 'blue' | 'beige' | 'green' | 'gray' | 'beige-outline' | 'gray-outline';
|
|
45
|
-
|
|
46
|
-
declare type MessageboxSkin = 'beige' | 'blue' | 'red' | 'green';
|
|
47
|
-
|
|
48
|
-
declare type ModalSize = 'small' | 'medium' | 'large';
|
|
49
|
-
|
|
50
51
|
export declare class PktAlert extends PktElement {
|
|
51
52
|
defaultSlot: Ref<HTMLElement>;
|
|
52
53
|
constructor();
|
|
53
54
|
compact: boolean;
|
|
54
55
|
title: string;
|
|
55
|
-
skin:
|
|
56
|
-
ariaLive:
|
|
57
|
-
'aria-live':
|
|
56
|
+
skin: TAlertSkin;
|
|
57
|
+
ariaLive: TAriaLive;
|
|
58
|
+
'aria-live': TAriaLive;
|
|
58
59
|
closeAlert: boolean;
|
|
59
60
|
date: string | null;
|
|
60
61
|
_isClosed: boolean;
|
|
@@ -145,8 +146,8 @@ export declare class PktCalendar extends PktElement {
|
|
|
145
146
|
export declare class PktCard extends PktElement {
|
|
146
147
|
defaultSlot: Ref<HTMLElement>;
|
|
147
148
|
constructor();
|
|
148
|
-
skin:
|
|
149
|
-
direction:
|
|
149
|
+
skin: TCardSkin;
|
|
150
|
+
direction: TDirection;
|
|
150
151
|
image: {
|
|
151
152
|
src: string;
|
|
152
153
|
alt: string;
|
|
@@ -316,36 +317,36 @@ export declare class PktIcon extends PktElement {
|
|
|
316
317
|
*/
|
|
317
318
|
declare class PktInputElement extends PktElement {
|
|
318
319
|
static get formAssociated(): boolean;
|
|
319
|
-
id: string;
|
|
320
|
-
name: string;
|
|
321
|
-
required: boolean;
|
|
322
320
|
disabled: boolean;
|
|
323
|
-
|
|
324
|
-
|
|
321
|
+
readonly: boolean;
|
|
322
|
+
required: boolean;
|
|
325
323
|
max: string | number | null;
|
|
326
|
-
minlength: number | null;
|
|
327
324
|
maxlength: number | null;
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
ariaLabelledby: string | null;
|
|
325
|
+
min: string | number | null;
|
|
326
|
+
minlength: number | null;
|
|
331
327
|
ariaDescribedBy: string | null;
|
|
332
|
-
|
|
328
|
+
ariaLabelledby: string | null;
|
|
329
|
+
name: string;
|
|
330
|
+
pattern: string;
|
|
331
|
+
placeholder: string;
|
|
332
|
+
id: string;
|
|
333
|
+
counter: boolean;
|
|
334
|
+
hasError: boolean;
|
|
333
335
|
inline: boolean;
|
|
334
336
|
optionalTag: boolean;
|
|
335
|
-
optionalText: string;
|
|
336
337
|
requiredTag: boolean;
|
|
337
|
-
|
|
338
|
-
|
|
338
|
+
skipForwardTestid: boolean;
|
|
339
|
+
useWrapper: boolean;
|
|
340
|
+
fullwidth: boolean;
|
|
341
|
+
counterMaxLength: number;
|
|
339
342
|
errorMessage: string;
|
|
340
343
|
helptext: string;
|
|
341
|
-
counter: boolean;
|
|
342
|
-
counterMaxLength: number;
|
|
343
344
|
helptextDropdown: string;
|
|
344
345
|
helptextDropdownButton: string | null;
|
|
345
|
-
|
|
346
|
-
|
|
346
|
+
label: string | null;
|
|
347
|
+
optionalText: string;
|
|
348
|
+
requiredText: string;
|
|
347
349
|
dataTestid: string;
|
|
348
|
-
skipForwardTestid: boolean;
|
|
349
350
|
touched: boolean;
|
|
350
351
|
constructor();
|
|
351
352
|
protected manageValidity(input: HTMLInputElement): void;
|
|
@@ -410,7 +411,7 @@ export declare class PktLinkCard extends PktElement implements IPktLinkCard {
|
|
|
410
411
|
iconName: string;
|
|
411
412
|
external: boolean;
|
|
412
413
|
openInNewTab: boolean;
|
|
413
|
-
skin:
|
|
414
|
+
skin: TLinkCardSkin;
|
|
414
415
|
constructor();
|
|
415
416
|
render(): TemplateResult<1>;
|
|
416
417
|
}
|
|
@@ -421,7 +422,7 @@ export declare class PktMessagebox extends PktElement {
|
|
|
421
422
|
closable: boolean;
|
|
422
423
|
compact: boolean;
|
|
423
424
|
title: string;
|
|
424
|
-
skin:
|
|
425
|
+
skin: TMessageboxSkin;
|
|
425
426
|
_isClosed: boolean;
|
|
426
427
|
private close;
|
|
427
428
|
render(): TemplateResult<1>;
|
|
@@ -432,7 +433,7 @@ export declare class PktModal extends PktElement implements IPktModal {
|
|
|
432
433
|
removePadding?: boolean;
|
|
433
434
|
hideCloseButton?: boolean;
|
|
434
435
|
closeOnBackdropClick?: boolean;
|
|
435
|
-
size?:
|
|
436
|
+
size?: TPktSize;
|
|
436
437
|
defaultSlot: Ref<HTMLElement>;
|
|
437
438
|
dialogRef: Ref<HTMLDialogElement>;
|
|
438
439
|
_isOpen: boolean;
|
|
@@ -447,6 +448,28 @@ export declare class PktModal extends PktElement implements IPktModal {
|
|
|
447
448
|
render(): TemplateResult<1>;
|
|
448
449
|
}
|
|
449
450
|
|
|
451
|
+
export declare class PktProgressbar extends PktElement implements IPktProgressbar {
|
|
452
|
+
valueCurrent: number;
|
|
453
|
+
valueMax: number;
|
|
454
|
+
valueMin: number;
|
|
455
|
+
skin: TProgressbarSkin;
|
|
456
|
+
title: string;
|
|
457
|
+
titlePosition: TProgressbarTitlePosition;
|
|
458
|
+
statusType: TProgressbarStatusType;
|
|
459
|
+
statusPlacement: TProgressbarStatusPlacement;
|
|
460
|
+
ariaLabel: string;
|
|
461
|
+
ariaLabelledby: string;
|
|
462
|
+
ariaValueText: string;
|
|
463
|
+
role: TProgressbarRole;
|
|
464
|
+
private labelWidth;
|
|
465
|
+
private progressBarId;
|
|
466
|
+
private labelRef;
|
|
467
|
+
private progressBarRef;
|
|
468
|
+
firstUpdated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
469
|
+
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
470
|
+
render(): TemplateResult<1>;
|
|
471
|
+
}
|
|
472
|
+
|
|
450
473
|
declare class PktSlotController implements ReactiveController {
|
|
451
474
|
host: LitElement & ReactiveControllerHost;
|
|
452
475
|
nodes: Element[];
|
|
@@ -471,11 +494,11 @@ export declare class PktTag extends PktElement {
|
|
|
471
494
|
* Element attributes
|
|
472
495
|
*/
|
|
473
496
|
closeTag: boolean;
|
|
474
|
-
size:
|
|
475
|
-
skin:
|
|
497
|
+
size: TPktSize;
|
|
498
|
+
skin: TTagSkin;
|
|
476
499
|
textStyle: string;
|
|
477
500
|
iconName: string | undefined;
|
|
478
|
-
type:
|
|
501
|
+
type: TTagType;
|
|
479
502
|
ariaLabel: string;
|
|
480
503
|
/**
|
|
481
504
|
* Element state
|
|
@@ -516,11 +539,33 @@ export declare class PktTextinput extends PktInputElement {
|
|
|
516
539
|
render(): TemplateResult<1>;
|
|
517
540
|
}
|
|
518
541
|
|
|
519
|
-
declare type
|
|
542
|
+
declare type TAlertSkin = 'error' | 'success' | 'warning' | 'info';
|
|
543
|
+
|
|
544
|
+
declare type TAriaLive = 'off' | 'polite' | 'assertive' | null;
|
|
545
|
+
|
|
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';
|
|
555
|
+
|
|
556
|
+
export declare type TProgressbarRole = 'progressbar' | 'meter';
|
|
557
|
+
|
|
558
|
+
export declare type TProgressbarSkin = 'dark-blue' | 'light-blue' | 'green' | 'red';
|
|
559
|
+
|
|
560
|
+
export declare type TProgressbarStatusPlacement = 'center' | 'left' | 'following';
|
|
561
|
+
|
|
562
|
+
export declare type TProgressbarStatusType = 'none' | 'percentage' | 'fraction';
|
|
563
|
+
|
|
564
|
+
export declare type TProgressbarTitlePosition = 'left' | 'center';
|
|
520
565
|
|
|
521
|
-
declare type
|
|
566
|
+
export declare type TTagSkin = 'blue' | 'green' | 'red' | 'yellow' | 'beige' | 'blue-light' | 'gray' | 'grey';
|
|
522
567
|
|
|
523
|
-
declare type
|
|
568
|
+
export declare type TTagType = 'button' | 'reset' | 'submit';
|
|
524
569
|
|
|
525
570
|
export { }
|
|
526
571
|
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { n as s, P as d, s as a } from "./icon-wUXeHiBk.js";
|
|
2
|
+
import { r as u } from "./state-BfyXV7EL.js";
|
|
3
|
+
import { u as y } from "./stringutils-DJjRa8dG.js";
|
|
4
|
+
import { s as f } from "./helptext--4FLdAWi.js";
|
|
5
|
+
var m = Object.defineProperty, e = (n, t, r, h) => {
|
|
6
|
+
for (var o = void 0, l = n.length - 1, p; l >= 0; l--)
|
|
7
|
+
(p = n[l]) && (o = p(t, r, o) || o);
|
|
8
|
+
return o && m(t, r, o), o;
|
|
9
|
+
};
|
|
10
|
+
class i extends d {
|
|
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 = y(), 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 = f.props.helptextDropdownButton.default, this.label = null, this.optionalText = a.forms.labels.optional, this.requiredText = a.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
|
+
this.required && !this.value ? this.internals.setValidity({ valueMissing: !0 }, a.forms.messages.required, t) : t.validity.typeMismatch || t.validity.badInput ? this.internals.setValidity({ typeMismatch: !0 }, a.forms.messages.invalid, t) : t.validity.patternMismatch ? this.internals.setValidity(
|
|
19
|
+
{ patternMismatch: !0 },
|
|
20
|
+
a.forms.messages.invalidPattern,
|
|
21
|
+
t
|
|
22
|
+
) : t.validity.tooShort || this.minlength && this.minlength > 0 && this.value.length < this.minlength ? this.internals.setValidity({ tooShort: !0 }, a.forms.messages.tooShort, t) : t.validity.tooLong || this.maxlength && this.maxlength > 0 && this.value.length > this.maxlength ? this.internals.setValidity({ tooLong: !0 }, a.forms.messages.tooLong, t) : t.validity.rangeUnderflow ? this.internals.setValidity(
|
|
23
|
+
{ rangeUnderflow: !0 },
|
|
24
|
+
a.forms.messages.rangeUnderflow,
|
|
25
|
+
t
|
|
26
|
+
) : t.validity.rangeOverflow ? this.internals.setValidity(
|
|
27
|
+
{ rangeOverflow: !0 },
|
|
28
|
+
a.forms.messages.rangeOverflow,
|
|
29
|
+
t
|
|
30
|
+
) : t.validity.customError ? this.internals.setValidity({ customError: !0 }, t.validationMessage, t) : this.internals.setValidity({});
|
|
31
|
+
}
|
|
32
|
+
setFormValue(t) {
|
|
33
|
+
if (this.internals)
|
|
34
|
+
if (Array.isArray(t)) {
|
|
35
|
+
const r = new FormData();
|
|
36
|
+
t.forEach((h) => {
|
|
37
|
+
r.append(this.name, h);
|
|
38
|
+
}), this.internals.setFormValue(r);
|
|
39
|
+
} else
|
|
40
|
+
this.internals.setFormValue(t);
|
|
41
|
+
}
|
|
42
|
+
valueChanged(t, r) {
|
|
43
|
+
(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()));
|
|
44
|
+
}
|
|
45
|
+
// When input goes from content to no content
|
|
46
|
+
clearInputValue() {
|
|
47
|
+
const t = this.multiple || this.range ? [] : "";
|
|
48
|
+
this.value = t, this.internals.setFormValue(t), this.dispatchEvent(new Event("change")), this.dispatchEvent(
|
|
49
|
+
new CustomEvent("value-change", {
|
|
50
|
+
detail: t,
|
|
51
|
+
bubbles: !0,
|
|
52
|
+
composed: !0
|
|
53
|
+
})
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
// When user enters the input, we need to push that event out to the form
|
|
57
|
+
onFocus() {
|
|
58
|
+
this.dispatchEvent(new FocusEvent("focus"));
|
|
59
|
+
}
|
|
60
|
+
// And also when the user leaves the input...
|
|
61
|
+
onBlur() {
|
|
62
|
+
this.dispatchEvent(new FocusEvent("blur"));
|
|
63
|
+
}
|
|
64
|
+
// Trigger this when user types in the input
|
|
65
|
+
onInput() {
|
|
66
|
+
this.dispatchEvent(new InputEvent("input"));
|
|
67
|
+
}
|
|
68
|
+
// Trigger this when you want to set the value of the input out to the form
|
|
69
|
+
onChange(t) {
|
|
70
|
+
if (!this.touched) {
|
|
71
|
+
this.touched = !0, t && this.setFormValue(t);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
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.inputRef2 && this.manageValidity(this.inputRef2.value), this.dispatchEvent(new Event("change")), this.dispatchEvent(
|
|
75
|
+
new CustomEvent("value-change", {
|
|
76
|
+
detail: t,
|
|
77
|
+
bubbles: !0,
|
|
78
|
+
composed: !0
|
|
79
|
+
})
|
|
80
|
+
), this.internals.reportValidity());
|
|
81
|
+
}
|
|
82
|
+
updated(t) {
|
|
83
|
+
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")));
|
|
84
|
+
}
|
|
85
|
+
firstUpdated(t) {
|
|
86
|
+
super.firstUpdated(t), this.required && (this.internals.ariaRequired = !0), this.disabled && (this.internals.ariaDisabled = !0), this.internals.setFormValue(this.value), this.inputRef.value && this.manageValidity(this.inputRef.value);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
e([
|
|
90
|
+
s({ type: Boolean, reflect: !0 })
|
|
91
|
+
], i.prototype, "disabled");
|
|
92
|
+
e([
|
|
93
|
+
s({ type: Boolean, reflect: !0 })
|
|
94
|
+
], i.prototype, "readonly");
|
|
95
|
+
e([
|
|
96
|
+
s({ type: Boolean, reflect: !0 })
|
|
97
|
+
], i.prototype, "required");
|
|
98
|
+
e([
|
|
99
|
+
s({ type: Number, reflect: !0 })
|
|
100
|
+
], i.prototype, "max");
|
|
101
|
+
e([
|
|
102
|
+
s({ type: Number, reflect: !0 })
|
|
103
|
+
], i.prototype, "maxlength");
|
|
104
|
+
e([
|
|
105
|
+
s({ type: Number, reflect: !0 })
|
|
106
|
+
], i.prototype, "min");
|
|
107
|
+
e([
|
|
108
|
+
s({ type: Number, reflect: !0 })
|
|
109
|
+
], i.prototype, "minlength");
|
|
110
|
+
e([
|
|
111
|
+
s({ type: String })
|
|
112
|
+
], i.prototype, "ariaDescribedBy");
|
|
113
|
+
e([
|
|
114
|
+
s({ type: String })
|
|
115
|
+
], i.prototype, "ariaLabelledby");
|
|
116
|
+
e([
|
|
117
|
+
s({ type: String, reflect: !0 })
|
|
118
|
+
], i.prototype, "name");
|
|
119
|
+
e([
|
|
120
|
+
s({ type: String, reflect: !0 })
|
|
121
|
+
], i.prototype, "pattern");
|
|
122
|
+
e([
|
|
123
|
+
s({ type: String, reflect: !0 })
|
|
124
|
+
], i.prototype, "placeholder");
|
|
125
|
+
e([
|
|
126
|
+
s({ type: String, reflect: !0 })
|
|
127
|
+
], i.prototype, "id");
|
|
128
|
+
e([
|
|
129
|
+
s({ type: Boolean })
|
|
130
|
+
], i.prototype, "counter");
|
|
131
|
+
e([
|
|
132
|
+
s({ type: Boolean })
|
|
133
|
+
], i.prototype, "hasError");
|
|
134
|
+
e([
|
|
135
|
+
s({ type: Boolean })
|
|
136
|
+
], i.prototype, "inline");
|
|
137
|
+
e([
|
|
138
|
+
s({ type: Boolean })
|
|
139
|
+
], i.prototype, "optionalTag");
|
|
140
|
+
e([
|
|
141
|
+
s({ type: Boolean })
|
|
142
|
+
], i.prototype, "requiredTag");
|
|
143
|
+
e([
|
|
144
|
+
s({ type: Boolean })
|
|
145
|
+
], i.prototype, "skipForwardTestid");
|
|
146
|
+
e([
|
|
147
|
+
s({ type: Boolean })
|
|
148
|
+
], i.prototype, "useWrapper");
|
|
149
|
+
e([
|
|
150
|
+
s({ type: Boolean, reflect: !0 })
|
|
151
|
+
], i.prototype, "fullwidth");
|
|
152
|
+
e([
|
|
153
|
+
s({ type: Number })
|
|
154
|
+
], i.prototype, "counterMaxLength");
|
|
155
|
+
e([
|
|
156
|
+
s({ type: String })
|
|
157
|
+
], i.prototype, "errorMessage");
|
|
158
|
+
e([
|
|
159
|
+
s({ type: String })
|
|
160
|
+
], i.prototype, "helptext");
|
|
161
|
+
e([
|
|
162
|
+
s({ type: String })
|
|
163
|
+
], i.prototype, "helptextDropdown");
|
|
164
|
+
e([
|
|
165
|
+
s({ type: String })
|
|
166
|
+
], i.prototype, "helptextDropdownButton");
|
|
167
|
+
e([
|
|
168
|
+
s({ type: String })
|
|
169
|
+
], i.prototype, "label");
|
|
170
|
+
e([
|
|
171
|
+
s({ type: String })
|
|
172
|
+
], i.prototype, "optionalText");
|
|
173
|
+
e([
|
|
174
|
+
s({ type: String })
|
|
175
|
+
], i.prototype, "requiredText");
|
|
176
|
+
e([
|
|
177
|
+
s({ type: String, attribute: "data-testid" })
|
|
178
|
+
], i.prototype, "dataTestid");
|
|
179
|
+
e([
|
|
180
|
+
u()
|
|
181
|
+
], i.prototype, "touched");
|
|
182
|
+
export {
|
|
183
|
+
i as P
|
|
184
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./icon-CdMQ6zBT.cjs"),p=require("./state-SKYD8kRO.cjs"),u=require("./stringutils-CkVRq4jP.cjs"),d=require("./helptext-iZEgxz2U.cjs");var y=Object.defineProperty,s=(n,t,r,l)=>{for(var a=void 0,o=n.length-1,h;o>=0;o--)(h=n[o])&&(a=h(t,r,a)||a);return a&&y(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=u.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=d.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){this.required&&!this.value?this.internals.setValidity({valueMissing:!0},e.strings.forms.messages.required,t):t.validity.typeMismatch||t.validity.badInput?this.internals.setValidity({typeMismatch:!0},e.strings.forms.messages.invalid,t):t.validity.patternMismatch?this.internals.setValidity({patternMismatch:!0},e.strings.forms.messages.invalidPattern,t):t.validity.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},e.strings.forms.messages.tooShort,t):t.validity.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},e.strings.forms.messages.tooLong,t):t.validity.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},e.strings.forms.messages.rangeUnderflow,t):t.validity.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},e.strings.forms.messages.rangeOverflow,t):t.validity.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(l=>{r.append(this.name,l)}),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.inputRef2&&this.manageValidity(this.inputRef2.value),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0})),this.internals.reportValidity())}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.value&&this.manageValidity(this.inputRef.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([p.r()],i.prototype,"touched");exports.PktInputElement=i;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { P as x,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { e as u } from "./class-map-
|
|
5
|
-
import {
|
|
6
|
-
import "./helptext
|
|
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";
|
|
7
7
|
var D = Object.defineProperty, B = Object.getOwnPropertyDescriptor, e = (c, h, l, i) => {
|
|
8
8
|
for (var s = i > 1 ? void 0 : i ? B(h, l) : h, n = c.length - 1, d; n >= 0; n--)
|
|
9
9
|
(d = c[n]) && (s = (i ? d(h, l, s) : d(s)) || s);
|
|
@@ -11,7 +11,7 @@ var D = Object.defineProperty, B = Object.getOwnPropertyDescriptor, e = (c, h, l
|
|
|
11
11
|
};
|
|
12
12
|
let t = class extends x {
|
|
13
13
|
constructor() {
|
|
14
|
-
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);
|
|
15
15
|
}
|
|
16
16
|
render() {
|
|
17
17
|
const c = {
|
|
@@ -57,13 +57,13 @@ let t = class extends x {
|
|
|
57
57
|
id="${this.forId}-error"
|
|
58
58
|
>
|
|
59
59
|
<pkt-icon name="alert-error" class="pkt-alert__icon"></pkt-icon>
|
|
60
|
-
<div class="pkt-alert__text">${
|
|
60
|
+
<div class="pkt-alert__text">${m(this.errorMessage)}</div>
|
|
61
61
|
</div>` : a, f = () => p`
|
|
62
62
|
${d()} ${y()}
|
|
63
63
|
${l ? p`<label for="${this.forId}" class="pkt-sr-only" aria-describedby="${s}"
|
|
64
64
|
>${this.label}</label
|
|
65
65
|
>` : a}
|
|
66
|
-
<div class="pkt-contents" ${
|
|
66
|
+
<div class="pkt-contents" ${T(this.defaultSlot)}></div>
|
|
67
67
|
${b()} ${$()}
|
|
68
68
|
`, g = () => this.hasFieldset ? p`<fieldset class=${u(i)} aria-describedby="${s}">
|
|
69
69
|
${f()}
|
|
@@ -136,7 +136,7 @@ e([
|
|
|
136
136
|
r({ type: Boolean })
|
|
137
137
|
], t.prototype, "useWrapper", 2);
|
|
138
138
|
t = e([
|
|
139
|
-
|
|
139
|
+
w("pkt-input-wrapper")
|
|
140
140
|
], t);
|
|
141
141
|
export {
|
|
142
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);
|