@oslokommune/punkt-elements 12.32.0 → 12.32.8
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/README.md +2 -1
- package/dist/alert-C2WKLFow.cjs +27 -0
- package/dist/alert-XGjypFHe.js +115 -0
- package/dist/alert.d.ts +14 -14
- package/dist/{backlink-DdNgqA56.js → backlink-BX8HBhw5.js} +2 -2
- package/dist/{backlink-Q2HTG9jm.cjs → backlink-NJdC0FAO.cjs} +1 -1
- package/dist/backlink.d.ts +14 -14
- package/dist/{button-rArIL0-j.js → button-Bn8jVB0f.js} +33 -33
- package/dist/{button-BPyZeW73.cjs → button-Bpbh8A_a.cjs} +2 -2
- package/dist/button.d.ts +14 -14
- package/dist/{calendar-1ryAEdX3.js → calendar-BNHDEEwT.js} +20 -84
- package/dist/{calendar-2DqPLXdD.cjs → calendar-Ds13AKr5.cjs} +4 -4
- package/dist/calendar.d.ts +14 -14
- package/dist/card-CEv3DL-o.js +94 -0
- package/dist/card-c5EEPaNh.cjs +28 -0
- package/dist/card.d.ts +14 -14
- package/dist/{checkbox-BnDG6wIO.cjs → checkbox-DDBBDM85.cjs} +1 -1
- package/dist/{checkbox-Ceui2TLp.js → checkbox-DoMYxp83.js} +9 -9
- package/dist/checkbox.d.ts +14 -14
- package/dist/{class-map-ChuDQU5C.js → class-map-D4tSZX70.js} +2 -2
- package/dist/{class-map-D4rXyUxT.cjs → class-map-DvBKxTiW.cjs} +1 -1
- package/dist/combobox-BflWORVa.cjs +115 -0
- package/dist/combobox-l7LmWQYu.js +491 -0
- package/dist/combobox.d.ts +14 -14
- package/dist/datepicker-Bkiyh5P5.cjs +153 -0
- package/dist/datepicker-nWd89NwP.js +449 -0
- package/dist/datepicker.d.ts +14 -14
- package/dist/directive-C7oCP5Bh.cjs +5 -0
- package/dist/directive-helpers-BmXIK-1b.js +45 -0
- package/dist/directive-helpers-donnvcEO.cjs +5 -0
- package/dist/{directive-B76A7YXI.js → directive-oAbCiebi.js} +4 -4
- package/dist/element-DJpGVXjq.cjs +238 -0
- package/dist/{element-G8JoS0Lj.js → element-DiqKrDty.js} +8845 -8847
- package/dist/{helptext-Y4cSgTkd.js → helptext-DfRusn5R.js} +9 -9
- package/dist/{helptext-B4Uc-d56.cjs → helptext-aHD9icur.cjs} +1 -1
- package/dist/helptext.d.ts +14 -14
- package/dist/{icon-BJnwW0eh.js → icon-BdY52BIt.js} +2 -2
- package/dist/{icon-BTUCDPN5.cjs → icon-UtDKPH3R.cjs} +1 -1
- package/dist/icon.d.ts +14 -14
- package/dist/{if-defined-C1ZDVzYn.cjs → if-defined-CoBDkDGb.cjs} +1 -1
- package/dist/{if-defined-rCqT8Od1.js → if-defined-DeANa4n5.js} +1 -1
- package/dist/index.d.ts +16 -15
- package/dist/{input-element-DM2uSYaW.js → input-element-C4mmTk6h.js} +3 -3
- package/dist/{input-element-AhnBdCb8.cjs → input-element-VNai8bsq.cjs} +1 -1
- package/dist/input-wrapper-8iKEzDRZ.js +40 -0
- package/dist/{input-wrapper-BdZxmQyO.cjs → input-wrapper-DWOw7Yn-.cjs} +1 -1
- package/dist/input-wrapper-EoSAbU-U.cjs +1 -0
- package/dist/{input-wrapper-DQmYzhcy.js → input-wrapper-P_oEi6dk.js} +8 -8
- package/dist/input-wrapper.d.ts +14 -14
- package/dist/link-D9dJ6F-R.js +73 -0
- package/dist/link-DBxXqsnP.cjs +8 -0
- package/dist/link.d.ts +14 -14
- package/dist/{linkcard-DDD92XfD.cjs → linkcard-D5O1hR7N.cjs} +1 -1
- package/dist/{linkcard-CvqqyHVW.js → linkcard-DcEE9IVw.js} +4 -4
- package/dist/linkcard.d.ts +14 -14
- package/dist/{listbox-BTVnrHWv.cjs → listbox-CK1GmwCE.cjs} +1 -1
- package/dist/{listbox-DX-Euxdm.js → listbox-CfJWJDrc.js} +5 -5
- package/dist/listbox.d.ts +14 -14
- package/dist/{loader-BudoV0yd.js → loader-DZvOlXzI.js} +6 -6
- package/dist/{loader-Csq0Yd1k.cjs → loader-SDXJp58K.cjs} +1 -1
- package/dist/loader.d.ts +14 -14
- package/dist/messagebox-Ce5e1gga.js +79 -0
- package/dist/messagebox-D2_-WZQG.cjs +12 -0
- package/dist/messagebox.d.ts +14 -14
- package/dist/modal-CCtUsYKk.cjs +33 -0
- package/dist/{modal-DnYn2Rlg.js → modal-CdgIOp8Q.js} +51 -94
- package/dist/modal.d.ts +14 -14
- 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-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.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-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- 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 +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +27 -27
- 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-CZplGTgu.js → pkt-options-controller-BkWE4pZe.js} +1 -1
- package/dist/{pkt-options-controller-BtU1zEtG.cjs → pkt-options-controller-TJ1apYGF.cjs} +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -2
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-slot-controller-BtVLTZb7.js +79 -0
- package/dist/pkt-slot-controller-plQxXRvV.cjs +1 -0
- 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/{progressbar-czvExwTL.js → progressbar-DvFz9KBo.js} +6 -6
- package/dist/{progressbar-BW_icNId.cjs → progressbar-jASTnhti.cjs} +1 -1
- package/dist/progressbar.d.ts +14 -14
- package/dist/{radiobutton-BeSuCrbp.cjs → radiobutton-C-Xd5sSq.cjs} +1 -1
- package/dist/{radiobutton-DKo27Stm.js → radiobutton-D03aN4yn.js} +5 -5
- package/dist/radiobutton.d.ts +14 -14
- package/dist/{ref-cRTOoM4R.js → ref-B70YZNXm.js} +11 -11
- package/dist/{ref-DsoUUoPU.cjs → ref-CLqTsViF.cjs} +3 -3
- package/dist/{repeat-CArTw6-s.js → repeat-CNLpCTun.js} +3 -3
- package/dist/{repeat-kruY8poV.cjs → repeat-t2oms1o6.cjs} +1 -1
- package/dist/{select-DxHhPEgD.js → select-BLDaK5Rd.js} +8 -8
- package/dist/{select-lvFnhEVg.cjs → select-Dvds7MzS.cjs} +1 -1
- package/dist/select.d.ts +14 -14
- package/dist/{state-BILlRnrD.cjs → state-C4LdlTYO.cjs} +1 -1
- package/dist/{state-gfUuUqVg.js → state-CDwPbiQj.js} +1 -1
- package/dist/tag-C52KeBmR.cjs +18 -0
- package/dist/{tag-CWx1XsGR.js → tag-DoS5S2Bq.js} +28 -77
- package/dist/tag.d.ts +14 -14
- package/dist/{textarea-BNNDbxxO.js → textarea-C9EvdPGi.js} +11 -11
- package/dist/{textarea-CDsLbogK.cjs → textarea-DJvNBmEL.cjs} +1 -1
- package/dist/textarea.d.ts +14 -14
- package/dist/{textinput-C3C088Ki.cjs → textinput-Cg3ObBuw.cjs} +1 -1
- package/dist/{textinput-M8I4dfoP.js → textinput-CxRSSYaN.js} +20 -20
- package/dist/textinput.d.ts +14 -14
- package/package.json +4 -4
- package/src/components/button/button.ts +3 -2
- package/src/components/datepicker/datepicker.ts +4 -4
- package/src/components/tag/tag.ts +1 -1
- package/dist/alert-D5G5UJuo.cjs +0 -27
- package/dist/alert-gERpVuB7.js +0 -163
- package/dist/card-BbMBpvJt.js +0 -176
- package/dist/card-ZX09f_ka.cjs +0 -28
- package/dist/combobox-DH-YlbNh.cjs +0 -115
- package/dist/combobox-DbO6I0GT.js +0 -694
- package/dist/datepicker-8MOgQsyL.js +0 -611
- package/dist/datepicker-BRH-59Q9.cjs +0 -153
- package/dist/directive-C_VV3qwo.cjs +0 -5
- package/dist/directive-helpers-D7XIyCQ_.js +0 -45
- package/dist/directive-helpers-mGjAtADc.cjs +0 -5
- package/dist/element-BBo3JZk5.cjs +0 -238
- package/dist/input-wrapper-Bw9tARAD.js +0 -125
- package/dist/input-wrapper-jPnKsfEC.cjs +0 -1
- package/dist/link-C3lW3z8X.js +0 -109
- package/dist/link-DOVlsg2S.cjs +0 -8
- package/dist/messagebox-8GwnNqb0.cjs +0 -12
- package/dist/messagebox-D6uexEhg.js +0 -114
- package/dist/modal-CLixB4Dz.cjs +0 -33
- package/dist/pkt-slot-controller-CqNvEpFd.cjs +0 -1
- package/dist/pkt-slot-controller-D1DakVrU.js +0 -95
- package/dist/tag-DThwKsrg.cjs +0 -18
|
@@ -1,611 +0,0 @@
|
|
|
1
|
-
import { e as m } from "./class-map-ChuDQU5C.js";
|
|
2
|
-
import { o as d } from "./if-defined-rCqT8Od1.js";
|
|
3
|
-
import { x as p, E as g, n as l, a as w } from "./element-G8JoS0Lj.js";
|
|
4
|
-
import { r as b } from "./state-gfUuUqVg.js";
|
|
5
|
-
import { n as v, f as k, a as R, b as y, d as x } from "./calendar-1ryAEdX3.js";
|
|
6
|
-
import { P as C } from "./input-element-DM2uSYaW.js";
|
|
7
|
-
import { e as f, n as h } from "./ref-cRTOoM4R.js";
|
|
8
|
-
import { c as T } from "./repeat-CArTw6-s.js";
|
|
9
|
-
import "./icon-BJnwW0eh.js";
|
|
10
|
-
import "./input-wrapper-DQmYzhcy.js";
|
|
11
|
-
import "./tag-CWx1XsGR.js";
|
|
12
|
-
import { P as S } from "./pkt-slot-controller-D1DakVrU.js";
|
|
13
|
-
const D = "pkt-datepicker", _ = !0, I = {
|
|
14
|
-
name: {
|
|
15
|
-
type: "string",
|
|
16
|
-
name: "Navn",
|
|
17
|
-
description: "Navn som sendes brukes i skjema ved innsending"
|
|
18
|
-
},
|
|
19
|
-
label: {
|
|
20
|
-
type: "string",
|
|
21
|
-
name: "Etikett",
|
|
22
|
-
description: "Tekst som vises over datovelgeren"
|
|
23
|
-
},
|
|
24
|
-
helptext: {
|
|
25
|
-
type: "string",
|
|
26
|
-
name: "Hjelpetekst",
|
|
27
|
-
description: "Hjelpetekst som vises over datovelgeren"
|
|
28
|
-
},
|
|
29
|
-
helptextDropdown: {
|
|
30
|
-
type: "string",
|
|
31
|
-
name: "Utvidet hjelpetekst",
|
|
32
|
-
description: "Hjelpetekst som vises i en lukket boks man kan åpne"
|
|
33
|
-
},
|
|
34
|
-
helptextDropdownButton: {
|
|
35
|
-
type: "string",
|
|
36
|
-
name: "Knappetekst for hjelpetekst",
|
|
37
|
-
description: "Tekst som vises på knappen for å åpne/lukke utvidet hjelpetekst",
|
|
38
|
-
default: "Les mer"
|
|
39
|
-
},
|
|
40
|
-
dateformat: {
|
|
41
|
-
name: "Datoformat",
|
|
42
|
-
description: "Datoformat for valgte datoer i flervalgsmodus",
|
|
43
|
-
type: "string",
|
|
44
|
-
default: "dd.MM.yyyy"
|
|
45
|
-
},
|
|
46
|
-
currentmonth: {
|
|
47
|
-
name: "Nåværende måned",
|
|
48
|
-
type: "ISOdatestring",
|
|
49
|
-
description: "Måneden som skal vises i datovelgeren"
|
|
50
|
-
},
|
|
51
|
-
value: {
|
|
52
|
-
name: "Verdi",
|
|
53
|
-
type: "ISOdatestring",
|
|
54
|
-
variant: "multiple",
|
|
55
|
-
reflect: !0,
|
|
56
|
-
description: "Kommaseparert liste av valgte datoer"
|
|
57
|
-
},
|
|
58
|
-
excludeweekdays: {
|
|
59
|
-
name: "Utelat ukedager",
|
|
60
|
-
type: "string",
|
|
61
|
-
description: "Kommaseparert liste over ukedager (1-7) som skal ekskluderes"
|
|
62
|
-
},
|
|
63
|
-
excludedates: {
|
|
64
|
-
name: "Utelat datoer",
|
|
65
|
-
type: "ISOdatestring",
|
|
66
|
-
variant: "multiple",
|
|
67
|
-
description: "Kommaseparert liste over datoer som skal ekskluderes"
|
|
68
|
-
},
|
|
69
|
-
min: {
|
|
70
|
-
name: "Tidligst tillatt",
|
|
71
|
-
type: "ISOdatestring",
|
|
72
|
-
default: null,
|
|
73
|
-
description: "Første tillate dato i datovelgeren"
|
|
74
|
-
},
|
|
75
|
-
max: {
|
|
76
|
-
name: "Senest tillatt",
|
|
77
|
-
type: "ISOdatestring",
|
|
78
|
-
default: null,
|
|
79
|
-
description: "Siste tillate dato i datovelgeren"
|
|
80
|
-
},
|
|
81
|
-
weeknumbers: {
|
|
82
|
-
name: "Vis ukenummer",
|
|
83
|
-
type: "boolean",
|
|
84
|
-
reflect: !0,
|
|
85
|
-
default: !1,
|
|
86
|
-
description: "Vis ukedager i datovelgerens kalender"
|
|
87
|
-
},
|
|
88
|
-
withcontrols: {
|
|
89
|
-
name: "Med kontroller",
|
|
90
|
-
type: "boolean",
|
|
91
|
-
reflect: !0,
|
|
92
|
-
default: !1,
|
|
93
|
-
description: "Vis avanserte velgere for måned og år"
|
|
94
|
-
},
|
|
95
|
-
multiple: {
|
|
96
|
-
name: "Flervalg",
|
|
97
|
-
type: "boolean",
|
|
98
|
-
reflect: !0,
|
|
99
|
-
default: !1,
|
|
100
|
-
description: "Tillat valg av flere enn én dato i samme velger"
|
|
101
|
-
},
|
|
102
|
-
maxlength: {
|
|
103
|
-
name: "Maks antall",
|
|
104
|
-
description: "Maks valgte datoer i flervalgsmodus",
|
|
105
|
-
type: "number"
|
|
106
|
-
},
|
|
107
|
-
range: {
|
|
108
|
-
name: "Datotidsrom",
|
|
109
|
-
type: "boolean",
|
|
110
|
-
reflect: !0,
|
|
111
|
-
default: !1,
|
|
112
|
-
description: "Tillat å velge et tidsrom mellom to datoer i samme velger"
|
|
113
|
-
},
|
|
114
|
-
hasError: {
|
|
115
|
-
type: "boolean",
|
|
116
|
-
name: "Feil",
|
|
117
|
-
default: !1,
|
|
118
|
-
description: "Viser feiltilstand for datovelgeren"
|
|
119
|
-
},
|
|
120
|
-
errorMessage: {
|
|
121
|
-
type: "string",
|
|
122
|
-
name: "Feilmelding",
|
|
123
|
-
description: "Tekst som vises under datovelgeren ved feiltilstand"
|
|
124
|
-
},
|
|
125
|
-
disabled: {
|
|
126
|
-
type: "boolean",
|
|
127
|
-
name: "Deaktivert",
|
|
128
|
-
default: !1,
|
|
129
|
-
reflect: !0,
|
|
130
|
-
description: "Er datovelgeren deaktivert?"
|
|
131
|
-
},
|
|
132
|
-
fullwidth: {
|
|
133
|
-
type: "boolean",
|
|
134
|
-
name: "Full bredde",
|
|
135
|
-
default: !1,
|
|
136
|
-
reflect: !0,
|
|
137
|
-
description: "Skal datovelgeren ta opp hele bredden?"
|
|
138
|
-
},
|
|
139
|
-
required: {
|
|
140
|
-
type: "boolean",
|
|
141
|
-
name: "Påkrevd",
|
|
142
|
-
default: !1,
|
|
143
|
-
reflect: !0,
|
|
144
|
-
description: "Er datovelgeren påkrevd?"
|
|
145
|
-
},
|
|
146
|
-
requiredTag: {
|
|
147
|
-
type: "boolean",
|
|
148
|
-
name: "Vise påkrevd-merking",
|
|
149
|
-
default: !1,
|
|
150
|
-
description: "Viser en merking som indikerer at datovelgeren er påkrevd"
|
|
151
|
-
},
|
|
152
|
-
requiredText: {
|
|
153
|
-
type: "string",
|
|
154
|
-
name: "Påkrevd-tekst",
|
|
155
|
-
default: "Må fylles ut",
|
|
156
|
-
description: "Tekst som vises i påkrevd-merkingen"
|
|
157
|
-
},
|
|
158
|
-
optionalTag: {
|
|
159
|
-
type: "boolean",
|
|
160
|
-
name: "Vise valgfritt-merking",
|
|
161
|
-
default: !1,
|
|
162
|
-
description: "Viser en merking som indikerer at datovelgeren er valgfri"
|
|
163
|
-
},
|
|
164
|
-
optionalText: {
|
|
165
|
-
type: "string",
|
|
166
|
-
name: "Valgfritt-tekst",
|
|
167
|
-
default: "Valgfritt",
|
|
168
|
-
description: "Tekst som vises i valgfritt-merkingen"
|
|
169
|
-
},
|
|
170
|
-
useWrapper: {
|
|
171
|
-
type: "boolean",
|
|
172
|
-
name: "Bruk wrapper",
|
|
173
|
-
description: "Indikerer at feltet skal ha synlig label og hjelpetekst",
|
|
174
|
-
displayAsFalse: !0,
|
|
175
|
-
default: !0
|
|
176
|
-
},
|
|
177
|
-
id: {
|
|
178
|
-
type: "string",
|
|
179
|
-
name: "ID",
|
|
180
|
-
description: "Unik identifikasjon for datovelgeren"
|
|
181
|
-
}
|
|
182
|
-
}, O = {
|
|
183
|
-
change: {
|
|
184
|
-
type: "Event",
|
|
185
|
-
description: "Returnerer valgt dato som streng i ISO-format"
|
|
186
|
-
},
|
|
187
|
-
"value-change": {
|
|
188
|
-
type: "CustomEvent",
|
|
189
|
-
description: "Returnerer en <code>array</code> med valgte datoer i ISO-format"
|
|
190
|
-
},
|
|
191
|
-
toggleHelpText: {
|
|
192
|
-
type: "CustomEvent",
|
|
193
|
-
description: "Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes"
|
|
194
|
-
}
|
|
195
|
-
}, c = {
|
|
196
|
-
name: D,
|
|
197
|
-
"css-class": "pkt-datepicker",
|
|
198
|
-
isElement: _,
|
|
199
|
-
props: I,
|
|
200
|
-
events: O
|
|
201
|
-
};
|
|
202
|
-
var P = Object.defineProperty, B = Object.getOwnPropertyDescriptor, n = (e, t, i, r) => {
|
|
203
|
-
for (var s = r > 1 ? void 0 : r ? B(t, i) : t, o = e.length - 1, u; o >= 0; o--)
|
|
204
|
-
(u = e[o]) && (s = (r ? u(t, i, s) : u(s)) || s);
|
|
205
|
-
return r && s && P(t, i, s), s;
|
|
206
|
-
};
|
|
207
|
-
const $ = (e) => new Promise((t) => setTimeout(t, e));
|
|
208
|
-
let a = class extends C {
|
|
209
|
-
/**
|
|
210
|
-
* Housekeeping / lifecycle methods
|
|
211
|
-
*/
|
|
212
|
-
constructor() {
|
|
213
|
-
super(), this.value = "", this._value = this.value ? Array.isArray(this.value) ? this.value : this.value.split(",") : [], this.label = "Datovelger", this.dateformat = c.props.dateformat.default, this.multiple = c.props.multiple.default, this.maxlength = null, this.range = c.props.range.default, this.showRangeLabels = !1, this.min = null, this.max = null, this.weeknumbers = c.props.weeknumbers.default, this.withcontrols = c.props.withcontrols.default, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.calendarOpen = !1, this.timezone = "Europe/Oslo", this.inputClasses = {}, this.buttonClasses = {}, this.inputRef = f(), this.inputRefTo = f(), this.btnRef = f(), this.calRef = f(), this.popupRef = f(), this.helptextSlot = f(), this.addToSelected = (e) => {
|
|
214
|
-
const t = e.target;
|
|
215
|
-
if (!t.value) return;
|
|
216
|
-
const i = this.min ? v(this.min) : null, r = this.max ? v(this.max) : null, s = v(t.value.split(",")[0]);
|
|
217
|
-
s && !isNaN(s.getTime()) && (!i || s >= i) && (!r || s <= r) && this.calRef.value && this.calRef.value.handleDateSelect(s), t.value = "";
|
|
218
|
-
}, this.slotController = new S(this, this.helptextSlot);
|
|
219
|
-
}
|
|
220
|
-
async connectedCallback() {
|
|
221
|
-
super.connectedCallback(), this.isMobileSafari = /iP(ad|od|hone)/i.test(window.navigator.userAgent) && !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/), this.inputType = this.isMobileSafari ? "text" : "date", document && document.body.addEventListener("click", (e) => {
|
|
222
|
-
var t, i;
|
|
223
|
-
(t = this.inputRef) != null && t.value && ((i = this.btnRef) != null && i.value) && !this.inputRef.value.contains(e.target) && !(this.inputRefTo.value && this.inputRefTo.value.contains(e.target)) && !this.btnRef.value.contains(e.target) && !e.target.closest(".pkt-calendar-popup") && this.calendarOpen && (this.onBlur(), this.hideCalendar());
|
|
224
|
-
}), this.value.length && this._value.length === 0 && (this._value = Array.isArray(this.value) ? this.value : this.value.split(",")), this.min = this.min || c.props.min.default, this.max = this.max || c.props.max.default, typeof this.excludedates == "string" && (this.excludedates = this.excludedates.split(",")), typeof this.excludeweekdays == "string" && (this.excludeweekdays = this.excludeweekdays.split(",")), (this.multiple || this.range) && this.name && !this.name.endsWith("[]") && (this.name = this.name + "[]"), this.calendarOpen && (await $(20), this.handleCalendarPosition());
|
|
225
|
-
}
|
|
226
|
-
disconnectedCallback() {
|
|
227
|
-
super.disconnectedCallback(), document && document.body.removeEventListener("click", (e) => {
|
|
228
|
-
var t, i;
|
|
229
|
-
(t = this.inputRef) != null && t.value && ((i = this.btnRef) != null && i.value) && !this.inputRef.value.contains(e.target) && !this.btnRef.value.contains(e.target) && this.hideCalendar();
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
attributeChangedCallback(e, t, i) {
|
|
233
|
-
if (e === "value") {
|
|
234
|
-
if (this.range && (i == null ? void 0 : i.split(",").length) === 1) return;
|
|
235
|
-
this.value !== t && this.valueChanged(i, t);
|
|
236
|
-
}
|
|
237
|
-
e === "excludedates" && typeof this.excludedates == "string" && (this.excludedates = (i == null ? void 0 : i.split(",")) ?? []), e === "excludeweekdays" && typeof this.excludeweekdays == "string" && (this.excludeweekdays = (i == null ? void 0 : i.split(",")) ?? []), super.attributeChangedCallback(e, t, i);
|
|
238
|
-
}
|
|
239
|
-
updated(e) {
|
|
240
|
-
if (e.has("value")) {
|
|
241
|
-
if (this.range && this.value.length === 1) return;
|
|
242
|
-
this.valueChanged(this.value, e.get("value"));
|
|
243
|
-
}
|
|
244
|
-
super.updated(e);
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Rendering
|
|
248
|
-
*/
|
|
249
|
-
renderInput() {
|
|
250
|
-
return p`
|
|
251
|
-
<input
|
|
252
|
-
class="${m(this.inputClasses)}"
|
|
253
|
-
.type=${this.inputType}
|
|
254
|
-
id="${this.id}-input"
|
|
255
|
-
.value=${this._value[0] ?? ""}
|
|
256
|
-
min=${d(this.min)}
|
|
257
|
-
max=${d(this.max)}
|
|
258
|
-
@click=${(e) => {
|
|
259
|
-
e.preventDefault(), this.showCalendar();
|
|
260
|
-
}}
|
|
261
|
-
?disabled=${this.disabled}
|
|
262
|
-
@keydown=${(e) => {
|
|
263
|
-
var t;
|
|
264
|
-
(e.key === "," || e.key === "Enter") && ((t = this.inputRef.value) == null || t.blur()), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e));
|
|
265
|
-
}}
|
|
266
|
-
@input=${(e) => {
|
|
267
|
-
this.onInput(), e.stopImmediatePropagation();
|
|
268
|
-
}}
|
|
269
|
-
@focus=${() => {
|
|
270
|
-
this.onFocus(), this.isMobileSafari && this.showCalendar();
|
|
271
|
-
}}
|
|
272
|
-
@blur=${(e) => {
|
|
273
|
-
var t;
|
|
274
|
-
(t = this.calRef.value) != null && t.contains(e.relatedTarget) || this.onBlur(), this.manageValidity(e.target), this.value = e.target.value;
|
|
275
|
-
}}
|
|
276
|
-
@change=${(e) => {
|
|
277
|
-
e.stopImmediatePropagation();
|
|
278
|
-
}}
|
|
279
|
-
${h(this.inputRef)}
|
|
280
|
-
/>
|
|
281
|
-
`;
|
|
282
|
-
}
|
|
283
|
-
renderRangeInput() {
|
|
284
|
-
const e = {
|
|
285
|
-
"pkt-input-prefix": this.showRangeLabels,
|
|
286
|
-
"pkt-hide": !this.showRangeLabels
|
|
287
|
-
};
|
|
288
|
-
return p`
|
|
289
|
-
${this.showRangeLabels ? p` <div class="pkt-input-prefix">${this.strings.generic.from}</div> ` : g}
|
|
290
|
-
<input
|
|
291
|
-
class=${m(this.inputClasses)}
|
|
292
|
-
.type=${this.inputType}
|
|
293
|
-
id="${this.id}-input"
|
|
294
|
-
.value=${this._value[0] ?? ""}
|
|
295
|
-
min=${d(this.min)}
|
|
296
|
-
max=${d(this.max)}
|
|
297
|
-
?disabled=${this.disabled}
|
|
298
|
-
@click=${(t) => {
|
|
299
|
-
t.preventDefault(), this.showCalendar();
|
|
300
|
-
}}
|
|
301
|
-
@keydown=${(t) => {
|
|
302
|
-
var i;
|
|
303
|
-
(t.key === "," || t.key === "Enter") && ((i = this.inputRef.value) == null || i.blur()), (t.key === "Space" || t.key === " ") && (t.preventDefault(), this.toggleCalendar(t));
|
|
304
|
-
}}
|
|
305
|
-
@input=${(t) => {
|
|
306
|
-
this.onInput(), t.stopImmediatePropagation();
|
|
307
|
-
}}
|
|
308
|
-
@focus=${() => {
|
|
309
|
-
this.onFocus(), this.isMobileSafari && this.showCalendar();
|
|
310
|
-
}}
|
|
311
|
-
@blur=${(t) => {
|
|
312
|
-
var i, r;
|
|
313
|
-
if (t.target.value) {
|
|
314
|
-
this.manageValidity(t.target);
|
|
315
|
-
const s = k(t.target.value);
|
|
316
|
-
s && this._value[0] !== t.target.value && this._value[1] && (this.clearInputValue(), (r = (i = this.calRef) == null ? void 0 : i.value) == null || r.handleDateSelect(s));
|
|
317
|
-
} else this._value[0] && this.clearInputValue();
|
|
318
|
-
}}
|
|
319
|
-
@change=${(t) => {
|
|
320
|
-
t.stopImmediatePropagation();
|
|
321
|
-
}}
|
|
322
|
-
${h(this.inputRef)}
|
|
323
|
-
/>
|
|
324
|
-
<div class="${m(e)}" id="${this.id}-to-label">
|
|
325
|
-
${this.strings.generic.to}
|
|
326
|
-
</div>
|
|
327
|
-
${this.showRangeLabels ? g : p` <div class="pkt-input-separator">–</div> `}
|
|
328
|
-
<input
|
|
329
|
-
class=${m(this.inputClasses)}
|
|
330
|
-
.type=${this.inputType}
|
|
331
|
-
id="${this.id}-to"
|
|
332
|
-
aria-labelledby="${this.id}-to-label"
|
|
333
|
-
.value=${this._value[1] ?? ""}
|
|
334
|
-
min=${d(this.min)}
|
|
335
|
-
max=${d(this.max)}
|
|
336
|
-
?disabled=${this.disabled}
|
|
337
|
-
@click=${(t) => {
|
|
338
|
-
t.preventDefault(), this.showCalendar();
|
|
339
|
-
}}
|
|
340
|
-
@keydown=${(t) => {
|
|
341
|
-
var i;
|
|
342
|
-
(t.key === "," || t.key === "Enter") && ((i = this.inputRefTo.value) == null || i.blur()), (t.key === "Space" || t.key === " ") && (t.preventDefault(), this.toggleCalendar(t));
|
|
343
|
-
}}
|
|
344
|
-
@input=${(t) => {
|
|
345
|
-
this.onInput(), t.stopImmediatePropagation();
|
|
346
|
-
}}
|
|
347
|
-
@focus=${() => {
|
|
348
|
-
this.onFocus(), this.isMobileSafari && this.showCalendar();
|
|
349
|
-
}}
|
|
350
|
-
@blur=${(t) => {
|
|
351
|
-
var i, r, s;
|
|
352
|
-
if ((i = this.calRef.value) != null && i.contains(t.relatedTarget) || this.onBlur(), t.target.value) {
|
|
353
|
-
this.manageValidity(t.target);
|
|
354
|
-
const o = t.target.value;
|
|
355
|
-
this.min && this.min > o ? this.internals.setValidity(
|
|
356
|
-
{ rangeUnderflow: !0 },
|
|
357
|
-
this.strings.forms.messages.rangeUnderflow,
|
|
358
|
-
t.target
|
|
359
|
-
) : this.max && this.max < o && this.internals.setValidity(
|
|
360
|
-
{ rangeOverflow: !0 },
|
|
361
|
-
this.strings.forms.messages.rangeOverflow,
|
|
362
|
-
t.target
|
|
363
|
-
);
|
|
364
|
-
const u = k(t.target.value);
|
|
365
|
-
u && this._value[1] !== R(u) && ((s = (r = this.calRef) == null ? void 0 : r.value) == null || s.handleDateSelect(u));
|
|
366
|
-
}
|
|
367
|
-
}}
|
|
368
|
-
@change=${(t) => {
|
|
369
|
-
t.stopImmediatePropagation();
|
|
370
|
-
}}
|
|
371
|
-
${h(this.inputRefTo)}
|
|
372
|
-
/>
|
|
373
|
-
`;
|
|
374
|
-
}
|
|
375
|
-
renderMultipleInput() {
|
|
376
|
-
return p`
|
|
377
|
-
<input
|
|
378
|
-
class=${m(this.inputClasses)}
|
|
379
|
-
.type=${this.inputType}
|
|
380
|
-
id="${this.id}-input"
|
|
381
|
-
min=${d(this.min)}
|
|
382
|
-
max=${d(this.max)}
|
|
383
|
-
?disabled=${this.disabled || this.maxlength && this._value.length >= this.maxlength}
|
|
384
|
-
@click=${(e) => {
|
|
385
|
-
e.preventDefault(), this.showCalendar();
|
|
386
|
-
}}
|
|
387
|
-
@blur=${(e) => {
|
|
388
|
-
var t;
|
|
389
|
-
(t = this.calRef.value) != null && t.contains(e.relatedTarget) || this.onBlur(), this.addToSelected(e);
|
|
390
|
-
}}
|
|
391
|
-
@input=${(e) => {
|
|
392
|
-
this.onInput(), e.stopImmediatePropagation();
|
|
393
|
-
}}
|
|
394
|
-
@focus=${() => {
|
|
395
|
-
this.onFocus(), this.isMobileSafari && this.showCalendar();
|
|
396
|
-
}}
|
|
397
|
-
@keydown=${(e) => {
|
|
398
|
-
(e.key === "," || e.key === "Enter") && (e.preventDefault(), this.addToSelected(e)), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e));
|
|
399
|
-
}}
|
|
400
|
-
@change=${(e) => {
|
|
401
|
-
e.stopImmediatePropagation();
|
|
402
|
-
}}
|
|
403
|
-
${h(this.inputRef)}
|
|
404
|
-
/>
|
|
405
|
-
`;
|
|
406
|
-
}
|
|
407
|
-
renderTags() {
|
|
408
|
-
return p`
|
|
409
|
-
<div class="pkt-datepicker__tags" aria-live="polite">
|
|
410
|
-
${this._value[0] ? T(
|
|
411
|
-
this._value ?? [],
|
|
412
|
-
(e) => e,
|
|
413
|
-
(e) => p`
|
|
414
|
-
<pkt-tag
|
|
415
|
-
.id="${this.id + e + "-tag"}"
|
|
416
|
-
closeTag
|
|
417
|
-
ariaLabel="${this.strings.calendar.deleteDate} ${y(
|
|
418
|
-
e,
|
|
419
|
-
this.dateformat
|
|
420
|
-
)}"
|
|
421
|
-
@close=${() => {
|
|
422
|
-
var t;
|
|
423
|
-
return (t = this.calRef.value) == null ? void 0 : t.handleDateSelect(k(e));
|
|
424
|
-
}}
|
|
425
|
-
><time datetime="${e}">${y(e, this.dateformat)}</time></pkt-tag
|
|
426
|
-
>
|
|
427
|
-
`
|
|
428
|
-
) : g}
|
|
429
|
-
</div>
|
|
430
|
-
`;
|
|
431
|
-
}
|
|
432
|
-
renderCalendar() {
|
|
433
|
-
return p`<div
|
|
434
|
-
class="pkt-calendar-popup pkt-${this.calendarOpen ? "show" : "hide"}"
|
|
435
|
-
@focusout=${(e) => {
|
|
436
|
-
this.calendarOpen && this.handleFocusOut(e);
|
|
437
|
-
}}
|
|
438
|
-
id="${this.id}-popup"
|
|
439
|
-
${h(this.popupRef)}
|
|
440
|
-
>
|
|
441
|
-
<pkt-calendar
|
|
442
|
-
id="${this.id}-calendar"
|
|
443
|
-
?multiple=${this.multiple}
|
|
444
|
-
?range=${this.range}
|
|
445
|
-
?weeknumbers=${this.weeknumbers}
|
|
446
|
-
?withcontrols=${this.withcontrols}
|
|
447
|
-
.maxMultiple=${this.maxlength}
|
|
448
|
-
.selected=${this._value}
|
|
449
|
-
.earliest=${this.min}
|
|
450
|
-
.latest=${this.max}
|
|
451
|
-
.excludedates=${Array.isArray(this.excludedates) ? this.excludedates : this.excludedates.split(",")}
|
|
452
|
-
.excludeweekdays=${this.excludeweekdays}
|
|
453
|
-
.currentmonth=${this.currentmonth ? v(this.currentmonth) : null}
|
|
454
|
-
@date-selected=${(e) => {
|
|
455
|
-
this.value = !this.multiple && !this.range ? e.detail[0] : e.detail, this._value = e.detail, this.inputRef.value && (this.range && this.inputRefTo.value ? (this.inputRef.value.value = this._value[0] ?? "", this.inputRefTo.value.value = this._value[1] ?? "") : this.multiple || (this.inputRef.value.value = this._value.length ? this._value[0] : ""));
|
|
456
|
-
}}
|
|
457
|
-
@close=${() => {
|
|
458
|
-
this.onBlur(), this.hideCalendar();
|
|
459
|
-
}}
|
|
460
|
-
${h(this.calRef)}
|
|
461
|
-
></pkt-calendar>
|
|
462
|
-
</div>`;
|
|
463
|
-
}
|
|
464
|
-
render() {
|
|
465
|
-
return this.inputClasses = {
|
|
466
|
-
"pkt-input": !0,
|
|
467
|
-
"pkt-datepicker__input": !0,
|
|
468
|
-
"pkt-input--fullwidth": this.fullwidth,
|
|
469
|
-
"pkt-datepicker--hasrangelabels": this.showRangeLabels,
|
|
470
|
-
"pkt-datepicker--multiple": this.multiple,
|
|
471
|
-
"pkt-datepicker--range": this.range
|
|
472
|
-
}, this.buttonClasses = {
|
|
473
|
-
"pkt-input-icon": !0,
|
|
474
|
-
"pkt-btn": !0,
|
|
475
|
-
"pkt-btn--icon-only": !0,
|
|
476
|
-
"pkt-btn--tertiary": !0
|
|
477
|
-
}, p`
|
|
478
|
-
<pkt-input-wrapper
|
|
479
|
-
label="${this.label}"
|
|
480
|
-
forId="${this.id}-input"
|
|
481
|
-
?counter=${this.multiple && !!this.maxlength}
|
|
482
|
-
.counterCurrent=${this.value ? this._value.length : 0}
|
|
483
|
-
.counterMaxLength=${this.maxlength}
|
|
484
|
-
?disabled=${this.disabled}
|
|
485
|
-
?hasError=${this.hasError}
|
|
486
|
-
?hasFieldset=${this.hasFieldset}
|
|
487
|
-
?inline=${this.inline}
|
|
488
|
-
?required=${this.required}
|
|
489
|
-
?optionalTag=${this.optionalTag}
|
|
490
|
-
?requiredTag=${this.requiredTag}
|
|
491
|
-
?useWrapper=${this.useWrapper}
|
|
492
|
-
.optionalText=${this.optionalText}
|
|
493
|
-
.requiredText=${this.requiredText}
|
|
494
|
-
.errorMessage=${this.errorMessage}
|
|
495
|
-
.helptext=${this.helptext}
|
|
496
|
-
.helptextDropdown=${this.helptextDropdown}
|
|
497
|
-
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
498
|
-
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
499
|
-
class="pkt-datepicker"
|
|
500
|
-
>
|
|
501
|
-
<div class="pkt-contents" ${h(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
502
|
-
${this.multiple ? this.renderTags() : g}
|
|
503
|
-
<div
|
|
504
|
-
class="pkt-datepicker__inputs ${this.range && this.showRangeLabels ? "pkt-input__range-inputs" : ""}"
|
|
505
|
-
>
|
|
506
|
-
<div class="pkt-input__container">
|
|
507
|
-
${this.range ? this.renderRangeInput() : this.multiple ? this.renderMultipleInput() : this.renderInput()}
|
|
508
|
-
<button
|
|
509
|
-
class="${m(this.buttonClasses)}"
|
|
510
|
-
type="button"
|
|
511
|
-
@click=${this.toggleCalendar}
|
|
512
|
-
?disabled=${this.disabled}
|
|
513
|
-
${h(this.btnRef)}
|
|
514
|
-
>
|
|
515
|
-
<pkt-icon name="calendar"></pkt-icon>
|
|
516
|
-
<span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
|
|
517
|
-
</button>
|
|
518
|
-
</div>
|
|
519
|
-
</div>
|
|
520
|
-
</pkt-input-wrapper>
|
|
521
|
-
${this.renderCalendar()}
|
|
522
|
-
`;
|
|
523
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* Handlers
|
|
526
|
-
*/
|
|
527
|
-
handleCalendarPosition() {
|
|
528
|
-
var e;
|
|
529
|
-
if (this.popupRef.value && this.inputRef.value) {
|
|
530
|
-
const t = this.multiple && !!this.maxlength, i = ((e = this.inputRef.value.parentElement) == null ? void 0 : e.getBoundingClientRect()) || this.inputRef.value.getBoundingClientRect(), r = t ? i.height + 30 : i.height, s = this.popupRef.value.getBoundingClientRect().height;
|
|
531
|
-
let o = t ? "calc(100% - 30px)" : "100%";
|
|
532
|
-
i && i.top + s > window.innerHeight && i.top - s > 0 && (o = `calc(100% - ${r}px - ${s}px)`), this.popupRef.value.style.top = o;
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
handleFocusOut(e) {
|
|
536
|
-
this.contains(e.target) || (this.onBlur(), this.hideCalendar());
|
|
537
|
-
}
|
|
538
|
-
async showCalendar() {
|
|
539
|
-
var e;
|
|
540
|
-
this.calendarOpen = !0, await $(20), this.handleCalendarPosition(), this.isMobileSafari && ((e = this.calRef.value) == null || e.focusOnCurrentDate());
|
|
541
|
-
}
|
|
542
|
-
hideCalendar() {
|
|
543
|
-
this.calendarOpen = !1;
|
|
544
|
-
}
|
|
545
|
-
async toggleCalendar(e) {
|
|
546
|
-
e.preventDefault(), this.calendarOpen ? this.hideCalendar() : this.showCalendar();
|
|
547
|
-
}
|
|
548
|
-
};
|
|
549
|
-
n([
|
|
550
|
-
l({ type: String, reflect: !0 })
|
|
551
|
-
], a.prototype, "value", 2);
|
|
552
|
-
n([
|
|
553
|
-
l({ type: Array })
|
|
554
|
-
], a.prototype, "_value", 2);
|
|
555
|
-
n([
|
|
556
|
-
l({ type: String, reflect: !0 })
|
|
557
|
-
], a.prototype, "label", 2);
|
|
558
|
-
n([
|
|
559
|
-
l({ type: String })
|
|
560
|
-
], a.prototype, "dateformat", 2);
|
|
561
|
-
n([
|
|
562
|
-
l({ type: Boolean, reflect: !0 })
|
|
563
|
-
], a.prototype, "multiple", 2);
|
|
564
|
-
n([
|
|
565
|
-
l({ type: Number, reflect: !0 })
|
|
566
|
-
], a.prototype, "maxlength", 2);
|
|
567
|
-
n([
|
|
568
|
-
l({ type: Boolean, reflect: !0 })
|
|
569
|
-
], a.prototype, "range", 2);
|
|
570
|
-
n([
|
|
571
|
-
l({ type: Boolean })
|
|
572
|
-
], a.prototype, "showRangeLabels", 2);
|
|
573
|
-
n([
|
|
574
|
-
l({ type: String, reflect: !0 })
|
|
575
|
-
], a.prototype, "min", 2);
|
|
576
|
-
n([
|
|
577
|
-
l({ type: String, reflect: !0 })
|
|
578
|
-
], a.prototype, "max", 2);
|
|
579
|
-
n([
|
|
580
|
-
l({ type: Boolean })
|
|
581
|
-
], a.prototype, "weeknumbers", 2);
|
|
582
|
-
n([
|
|
583
|
-
l({ type: Boolean, reflect: !0 })
|
|
584
|
-
], a.prototype, "withcontrols", 2);
|
|
585
|
-
n([
|
|
586
|
-
l({ converter: x.csvToArray })
|
|
587
|
-
], a.prototype, "excludedates", 2);
|
|
588
|
-
n([
|
|
589
|
-
l({ converter: x.csvToArray })
|
|
590
|
-
], a.prototype, "excludeweekdays", 2);
|
|
591
|
-
n([
|
|
592
|
-
l({ type: String })
|
|
593
|
-
], a.prototype, "currentmonth", 2);
|
|
594
|
-
n([
|
|
595
|
-
l({ type: Boolean, reflect: !0 })
|
|
596
|
-
], a.prototype, "calendarOpen", 2);
|
|
597
|
-
n([
|
|
598
|
-
l({ type: String })
|
|
599
|
-
], a.prototype, "timezone", 2);
|
|
600
|
-
n([
|
|
601
|
-
b()
|
|
602
|
-
], a.prototype, "inputClasses", 2);
|
|
603
|
-
n([
|
|
604
|
-
b()
|
|
605
|
-
], a.prototype, "buttonClasses", 2);
|
|
606
|
-
a = n([
|
|
607
|
-
w("pkt-datepicker")
|
|
608
|
-
], a);
|
|
609
|
-
export {
|
|
610
|
-
a as P
|
|
611
|
-
};
|