@oslokommune/punkt-elements 13.6.12 → 13.6.15

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.
@@ -0,0 +1,198 @@
1
+ import { html } from 'lit'
2
+ import { customElement, property } from 'lit/decorators.js'
3
+ import { classMap } from 'lit/directives/class-map.js'
4
+ import { ifDefined } from 'lit/directives/if-defined.js'
5
+ import { Ref, createRef, ref } from 'lit/directives/ref.js'
6
+ import { PktElement } from '@/base-elements/element'
7
+ import { keyboardUtils, formUtils, deviceDetection, cssUtils } from './datepicker-utils'
8
+ import '@/components/icon'
9
+
10
+ @customElement('pkt-datepicker-single')
11
+ export class PktDatepickerSingle extends PktElement {
12
+ @property({ type: String })
13
+ value: string = ''
14
+
15
+ @property({ type: String })
16
+ inputType: string = 'date'
17
+
18
+ @property({ type: String })
19
+ id: string = ''
20
+
21
+ @property({ type: String })
22
+ min?: string
23
+
24
+ @property({ type: String })
25
+ max?: string
26
+
27
+ @property({ type: String })
28
+ placeholder?: string
29
+
30
+ @property({ type: Boolean })
31
+ readonly: boolean = false
32
+
33
+ @property({ type: Boolean })
34
+ disabled: boolean = false
35
+
36
+ @property({ type: Object })
37
+ inputClasses: Record<string, boolean> = {}
38
+
39
+ @property({ type: Object })
40
+ internals?: any
41
+
42
+ @property({ type: Object })
43
+ strings: any = { calendar: { buttonAltText: 'Åpne kalender' } }
44
+
45
+ inputRef: Ref<HTMLInputElement> = createRef()
46
+ btnRef: Ref<HTMLButtonElement> = createRef()
47
+
48
+ get inputElement(): HTMLInputElement | undefined {
49
+ return this.inputRef.value
50
+ }
51
+
52
+ get buttonElement(): HTMLButtonElement | undefined {
53
+ return this.btnRef.value
54
+ }
55
+
56
+ get isInputReadonly(): boolean {
57
+ return this.readonly || this.inputType === 'text'
58
+ }
59
+
60
+ private dispatchToggleCalendar(e: Event) {
61
+ if (this.readonly) return
62
+
63
+ this.dispatchEvent(
64
+ new CustomEvent('toggle-calendar', {
65
+ detail: e,
66
+ bubbles: true,
67
+ composed: true,
68
+ }),
69
+ )
70
+ }
71
+
72
+ private dispatchInput(e: Event) {
73
+ this.dispatchEvent(
74
+ new CustomEvent('input-change', {
75
+ detail: e,
76
+ bubbles: true,
77
+ composed: true,
78
+ }),
79
+ )
80
+ }
81
+
82
+ private dispatchFocus() {
83
+ this.dispatchEvent(
84
+ new CustomEvent('input-focus', {
85
+ bubbles: true,
86
+ composed: true,
87
+ }),
88
+ )
89
+ }
90
+
91
+ private dispatchBlur(e: FocusEvent) {
92
+ this.dispatchEvent(
93
+ new CustomEvent('input-blur', {
94
+ detail: e,
95
+ bubbles: true,
96
+ composed: true,
97
+ }),
98
+ )
99
+ }
100
+
101
+ private dispatchChange(e: Event) {
102
+ this.dispatchEvent(
103
+ new CustomEvent('input-changed', {
104
+ detail: e,
105
+ bubbles: true,
106
+ composed: true,
107
+ }),
108
+ )
109
+ }
110
+
111
+ private dispatchManageValidity(input: HTMLInputElement) {
112
+ this.dispatchEvent(
113
+ new CustomEvent('manage-validity', {
114
+ detail: input,
115
+ bubbles: true,
116
+ composed: true,
117
+ }),
118
+ )
119
+ }
120
+
121
+ createRenderRoot() {
122
+ return this
123
+ }
124
+
125
+ render() {
126
+ return html`
127
+ <div class="pkt-input__container">
128
+ <input
129
+ class="${classMap(this.inputClasses)}"
130
+ .type=${this.inputType}
131
+ id="${this.id}-input"
132
+ .value=${this.value}
133
+ min=${ifDefined(this.min)}
134
+ max=${ifDefined(this.max)}
135
+ placeholder=${ifDefined(this.placeholder)}
136
+ ?readonly=${this.isInputReadonly}
137
+ aria-describedby="${this.id}-helptext"
138
+ @click=${(e: MouseEvent) => {
139
+ e.preventDefault()
140
+ this.dispatchToggleCalendar(e)
141
+ }}
142
+ @touchend=${(e: TouchEvent) => {
143
+ e.preventDefault()
144
+ this.dispatchToggleCalendar(e)
145
+ }}
146
+ ?disabled=${this.disabled}
147
+ @keydown=${(e: KeyboardEvent) =>
148
+ keyboardUtils.handleInputKeydown(
149
+ e,
150
+ (event) => this.dispatchToggleCalendar(event),
151
+ () =>
152
+ formUtils.submitFormOrFallback(this.internals, () => this.inputRef.value?.blur()),
153
+ undefined,
154
+ () => this.inputRef.value?.blur(),
155
+ )}
156
+ @input=${(e: Event) => {
157
+ this.dispatchInput(e)
158
+ e.stopImmediatePropagation()
159
+ }}
160
+ @focus=${() => {
161
+ this.dispatchFocus()
162
+ if (deviceDetection.isIOS()) {
163
+ this.dispatchToggleCalendar(new Event('focus'))
164
+ }
165
+ }}
166
+ @blur=${(e: FocusEvent) => {
167
+ this.dispatchBlur(e)
168
+ this.dispatchManageValidity(e.target as HTMLInputElement)
169
+ this.dispatchEvent(
170
+ new CustomEvent('value-change', {
171
+ detail: (e.target as HTMLInputElement).value,
172
+ bubbles: true,
173
+ composed: true,
174
+ }),
175
+ )
176
+ }}
177
+ @change=${(e: Event) => {
178
+ this.dispatchChange(e)
179
+ e.stopImmediatePropagation()
180
+ }}
181
+ ${ref(this.inputRef)}
182
+ />
183
+ <button
184
+ class="${classMap(cssUtils.getButtonClasses())}"
185
+ type="button"
186
+ @click=${(e: Event) => this.dispatchToggleCalendar(e)}
187
+ @keydown=${(e: KeyboardEvent) =>
188
+ keyboardUtils.handleButtonKeydown(e, (event) => this.dispatchToggleCalendar(event))}
189
+ ?disabled=${this.disabled}
190
+ ${ref(this.btnRef)}
191
+ >
192
+ <pkt-icon name="calendar"></pkt-icon>
193
+ <span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
194
+ </button>
195
+ </div>
196
+ `
197
+ }
198
+ }
@@ -322,7 +322,14 @@ export const cssUtils = {
322
322
  /**
323
323
  * Generates input classes for datepicker
324
324
  */
325
- getInputClasses(fullwidth: boolean, showRangeLabels: boolean, multiple: boolean, range: boolean) {
325
+ getInputClasses(
326
+ fullwidth: boolean,
327
+ showRangeLabels: boolean,
328
+ multiple: boolean,
329
+ range: boolean,
330
+ readonly?: boolean,
331
+ inputType?: string
332
+ ) {
326
333
  return {
327
334
  'pkt-input': true,
328
335
  'pkt-datepicker__input': true,
@@ -330,6 +337,7 @@ export const cssUtils = {
330
337
  'pkt-datepicker--hasrangelabels': showRangeLabels,
331
338
  'pkt-datepicker--multiple': multiple,
332
339
  'pkt-datepicker--range': range,
340
+ 'ios-readonly-hack': readonly === false && inputType === 'text',
333
341
  }
334
342
  },
335
343
 
@@ -1,5 +1,3 @@
1
- import { classMap } from 'lit/directives/class-map.js'
2
- import { ifDefined } from 'lit/directives/if-defined.js'
3
1
  import { customElement, property, state } from 'lit/decorators.js'
4
2
  import { formatISODate, fromISOToDate, parseISODateString } from '@/utils/dateutils'
5
3
  import { html, nothing, PropertyValues } from 'lit'
@@ -13,8 +11,10 @@ import '@/components/icon'
13
11
  import '@/components/input-wrapper'
14
12
  import './date-tags'
15
13
  import './datepicker-popup'
14
+ import './datepicker-single'
15
+ import './datepicker-range'
16
+ import './datepicker-multiple'
16
17
  import { PktSlotController } from '@/controllers/pkt-slot-controller'
17
- import { keyboardUtils } from './datepicker-utils'
18
18
  import {
19
19
  sleep,
20
20
  deviceDetection,
@@ -26,6 +26,9 @@ import {
26
26
  formUtils,
27
27
  } from './datepicker-utils'
28
28
  import { PktDatepickerPopup } from './datepicker-popup'
29
+ import { PktDatepickerSingle } from './datepicker-single'
30
+ import { PktDatepickerRange } from './datepicker-range'
31
+ import { PktDatepickerMultiple } from './datepicker-multiple'
29
32
  import { ElementProps } from '@/types/typeUtils'
30
33
 
31
34
  type Props = ElementProps<
@@ -116,7 +119,6 @@ export class PktDatepicker extends PktInputElement<Props> {
116
119
  timezone: string = 'Europe/Oslo'
117
120
 
118
121
  @state() inputClasses = {}
119
- @state() buttonClasses = {}
120
122
 
121
123
  /**
122
124
  * Computed properties
@@ -229,239 +231,178 @@ export class PktDatepicker extends PktInputElement<Props> {
229
231
  * Element references
230
232
  */
231
233
 
232
- // When using PktInputElement, we always need to define `inputRef`
233
- inputRef: Ref<HTMLInputElement> = createRef()
234
- inputRefTo: Ref<HTMLInputElement> = createRef()
235
- btnRef: Ref<HTMLButtonElement> = createRef()
234
+ // Override the inputRef and inputRefTo for compatibility
235
+ get inputRef(): Ref<HTMLInputElement> {
236
+ const element = this.currentInputElement
237
+ return { value: element } as Ref<HTMLInputElement>
238
+ }
239
+
240
+ get inputRefTo(): Ref<HTMLInputElement> {
241
+ const element = this.currentInputElementTo
242
+ return { value: element } as Ref<HTMLInputElement>
243
+ }
244
+
236
245
  calRef: Ref<PktCalendar> = createRef()
237
246
  popupRef: Ref<HTMLDivElement> = createRef()
238
247
  helptextSlot: Ref<HTMLElement> = createRef()
239
248
 
249
+ // Child component refs
250
+ singleInputRef: Ref<PktDatepickerSingle> = createRef()
251
+ rangeInputRef: Ref<PktDatepickerRange> = createRef()
252
+ multipleInputRef: Ref<PktDatepickerMultiple> = createRef()
253
+
254
+ // Getters for backward compatibility with input refs
255
+ get currentInputElement(): HTMLInputElement | undefined {
256
+ if (this.multiple) {
257
+ return this.multipleInputRef.value?.inputElement
258
+ } else if (this.range) {
259
+ return this.rangeInputRef.value?.inputElement
260
+ } else {
261
+ return this.singleInputRef.value?.inputElement
262
+ }
263
+ }
264
+
265
+ get currentInputElementTo(): HTMLInputElement | undefined {
266
+ if (this.range) {
267
+ return this.rangeInputRef.value?.inputElementTo
268
+ }
269
+ return undefined
270
+ }
271
+
272
+ get currentButtonElement(): HTMLButtonElement | undefined {
273
+ if (this.multiple) {
274
+ return this.multipleInputRef.value?.buttonElement
275
+ } else if (this.range) {
276
+ return this.rangeInputRef.value?.buttonElement
277
+ } else {
278
+ return this.singleInputRef.value?.buttonElement
279
+ }
280
+ }
281
+
282
+ // Override btnRef for compatibility
283
+ get btnRef(): Ref<HTMLButtonElement> {
284
+ const element = this.currentButtonElement
285
+ return { value: element } as Ref<HTMLButtonElement>
286
+ }
287
+
240
288
  /**
241
289
  * Rendering
242
290
  */
243
291
  renderInput() {
244
292
  return html`
245
- <input
246
- class="${classMap(this.inputClasses)}"
247
- .type=${this.inputType}
248
- id="${this.id}-input"
293
+ <pkt-datepicker-single
249
294
  .value=${this._value[0] ?? ''}
250
- min=${ifDefined(this.min)}
251
- max=${ifDefined(this.max)}
252
- placeholder=${ifDefined(this.placeholder)}
253
- ?readonly=${this.readonly}
254
- aria-describedby="${this.id}-helptext"
255
- @click=${(e: MouseEvent) => {
256
- e.preventDefault()
257
- this.showCalendar()
258
- }}
259
- ?disabled=${this.disabled}
260
- @keydown=${(e: KeyboardEvent) =>
261
- keyboardUtils.handleInputKeydown(
262
- // event, toggleCalendar, submitForm, focusNext, blur, comma
263
- e,
264
- (event) => this.toggleCalendar(event),
265
- () => formUtils.submitFormOrFallback(this.internals, () => this.inputRef.value?.blur()),
266
- undefined,
267
- () => this.inputRef.value?.blur(),
268
- )}
269
- @input=${(e: Event) => {
270
- this.onInput()
271
- e.stopImmediatePropagation()
272
- }}
273
- @focus=${() => {
274
- this.onFocus()
275
- if (deviceDetection.isIOS()) {
276
- this.showCalendar()
277
- }
278
- }}
279
- @blur=${(e: FocusEvent) => {
280
- if (!this.calRef.value?.contains(e.relatedTarget as Node)) {
295
+ .inputType=${this.inputType}
296
+ .id=${this.id}
297
+ .min=${this.min}
298
+ .max=${this.max}
299
+ .placeholder=${this.placeholder}
300
+ .readonly=${this.readonly}
301
+ .disabled=${this.disabled}
302
+ .inputClasses=${this.inputClasses}
303
+ .internals=${this.internals}
304
+ .strings=${this.strings}
305
+ @toggle-calendar=${(e: CustomEvent) => this.toggleCalendar(e.detail)}
306
+ @input-change=${() => this.onInput()}
307
+ @input-focus=${() => this.onFocus()}
308
+ @input-blur=${(e: CustomEvent) => {
309
+ if (!this.calRef.value?.contains(e.detail.relatedTarget as Node)) {
281
310
  this.onBlur()
282
311
  }
283
- this.manageValidity(e.target as HTMLInputElement)
284
- this.value = (e.target as HTMLInputElement).value
285
312
  }}
286
- @change=${(e: Event) => {
313
+ @manage-validity=${(e: CustomEvent) => this.manageValidity(e.detail)}
314
+ @value-change=${(e: CustomEvent) => {
315
+ this.value = e.detail
316
+ }}
317
+ @input-changed=${() => {
287
318
  this.touched = true
288
- e.stopImmediatePropagation()
289
319
  }}
290
- ${ref(this.inputRef)}
291
- />
320
+ ${ref(this.singleInputRef)}
321
+ ></pkt-datepicker-single>
292
322
  `
293
323
  }
294
324
 
295
325
  renderRangeInput() {
296
- const rangeLabelClasses = cssUtils.getRangeLabelClasses(this.showRangeLabels)
297
326
  return html`
298
- ${this.showRangeLabels
299
- ? html` <div class="pkt-input-prefix">${this.strings.generic.from}</div> `
300
- : nothing}
301
- <input
302
- class=${classMap(this.inputClasses)}
303
- .type=${this.inputType}
304
- id="${this.id}-input"
305
- .value=${this._value[0] ?? ''}
306
- min=${ifDefined(this.min)}
307
- max=${ifDefined(this.max)}
308
- placeholder=${ifDefined(this.placeholder)}
309
- ?readonly=${this.readonly}
310
- ?disabled=${this.disabled}
311
- @click=${(e: MouseEvent) => {
312
- e.preventDefault()
313
- this.showCalendar()
314
- }}
315
- @keydown=${(e: KeyboardEvent) =>
316
- keyboardUtils.handleInputKeydown(
317
- // event, toggleCalendar, submitForm, focusNext, blur, comma
318
- e,
319
- (event) => this.toggleCalendar(event),
320
- () =>
321
- formUtils.submitFormOrFallback(this.internals, () => this.inputRefTo.value?.focus()),
322
- () => this.inputRefTo.value?.focus(),
323
- () => this.inputRef.value?.blur(),
324
- )}
325
- @input=${(e: Event) => {
326
- this.onInput()
327
- e.stopImmediatePropagation()
328
- }}
329
- @focus=${() => {
330
- this.onFocus()
331
- if (deviceDetection.isIOS()) {
332
- this.showCalendar()
327
+ <pkt-datepicker-range
328
+ .value=${this._value}
329
+ .inputType=${this.inputType}
330
+ .id=${this.id}
331
+ .min=${this.min}
332
+ .max=${this.max}
333
+ .placeholder=${this.placeholder}
334
+ .readonly=${this.readonly}
335
+ .disabled=${this.disabled}
336
+ .showRangeLabels=${this.showRangeLabels}
337
+ .inputClasses=${this.inputClasses}
338
+ .internals=${this.internals}
339
+ .strings=${this.strings}
340
+ @toggle-calendar=${(e: CustomEvent) => this.toggleCalendar(e.detail)}
341
+ @input-change=${() => this.onInput()}
342
+ @input-focus=${() => this.onFocus()}
343
+ @input-blur=${(e: CustomEvent) => {
344
+ if (!this.calRef.value?.contains(e.detail.relatedTarget as Node)) {
345
+ this.onBlur()
333
346
  }
334
347
  }}
335
- @blur=${(e: Event) => {
348
+ @range-blur=${(e: CustomEvent) => {
336
349
  dateProcessingUtils.processRangeBlur(
337
- e,
338
- this._value,
350
+ e.detail.event,
351
+ e.detail.values,
339
352
  this.calRef,
340
353
  () => this.clearInputValue(),
341
354
  (input) => this.manageValidity(input),
342
355
  )
343
356
  }}
344
- @change=${(e: Event) => {
345
- e.stopImmediatePropagation()
346
- }}
347
- ${ref(this.inputRef)}
348
- />
349
- <div class="${classMap(rangeLabelClasses)}" id="${this.id}-to-label">
350
- ${this.strings.generic.to}
351
- </div>
352
- ${!this.showRangeLabels ? html` <div class="pkt-input-separator">–</div> ` : nothing}
353
- <input
354
- class=${classMap(this.inputClasses)}
355
- .type=${this.inputType}
356
- id="${this.id}-to"
357
- aria-labelledby="${this.id}-to-label"
358
- .value=${this._value[1] ?? ''}
359
- min=${ifDefined(this.min)}
360
- max=${ifDefined(this.max)}
361
- placeholder=${ifDefined(this.placeholder)}
362
- ?readonly=${this.readonly}
363
- ?disabled=${this.disabled}
364
- @click=${(e: MouseEvent) => {
365
- e.preventDefault()
366
- this.showCalendar()
357
+ @manage-validity=${(e: CustomEvent) => this.manageValidity(e.detail)}
358
+ @validate-date-input=${(e: CustomEvent) => {
359
+ formUtils.validateDateInput(e.detail, this.internals, this.min, this.max, this.strings)
367
360
  }}
368
- @keydown=${(e: KeyboardEvent) =>
369
- keyboardUtils.handleInputKeydown(
370
- // event, toggleCalendar, submitForm, focusNext, blur, comma
371
- e,
372
- (event) => this.toggleCalendar(event),
373
- () =>
374
- formUtils.submitFormOrFallback(this.internals, () => this.inputRefTo.value?.blur()),
375
- undefined,
376
- () => this.inputRefTo.value?.blur(),
377
- )}
378
- @input=${(e: Event) => {
379
- this.onInput()
380
- e.stopImmediatePropagation()
381
- }}
382
- @focus=${() => {
383
- this.onFocus()
384
- if (deviceDetection.isIOS()) {
385
- this.showCalendar()
386
- }
387
- }}
388
- @blur=${(e: FocusEvent) => {
389
- if (!this.calRef.value?.contains(e.relatedTarget as Node)) {
390
- this.onBlur()
391
- }
392
- if ((e.target as HTMLInputElement).value) {
393
- this.manageValidity(e.target as HTMLInputElement)
394
- formUtils.validateDateInput(
395
- e.target as HTMLInputElement,
396
- this.internals,
397
- this.min,
398
- this.max,
399
- this.strings,
400
- )
401
- const date = fromISOToDate((e.target as HTMLInputElement).value)
402
- if (date) {
403
- if (this._value[1] !== formatISODate(date)) {
404
- this.calRef?.value?.handleDateSelect(date)
405
- }
361
+ @handle-date-select=${(e: CustomEvent) => {
362
+ const date = fromISOToDate(e.detail)
363
+ if (date) {
364
+ if (this._value[1] !== formatISODate(date)) {
365
+ this.calRef?.value?.handleDateSelect(date)
406
366
  }
407
367
  }
408
368
  }}
409
- @change=${(e: Event) => {
369
+ @input-changed=${() => {
410
370
  this.touched = true
411
- e.stopImmediatePropagation()
412
371
  }}
413
- ${ref(this.inputRefTo)}
414
- />
372
+ ${ref(this.rangeInputRef)}
373
+ ></pkt-datepicker-range>
415
374
  `
416
375
  }
417
376
 
418
377
  renderMultipleInput() {
419
378
  return html`
420
- <input
421
- class=${classMap(this.inputClasses)}
422
- .type=${this.inputType}
423
- id="${this.id}-input"
424
- min=${ifDefined(this.min)}
425
- max=${ifDefined(this.max)}
426
- placeholder=${ifDefined(this.placeholder)}
427
- ?readonly=${this.readonly}
428
- ?disabled=${this.disabled || (this.maxlength && this._value.length >= this.maxlength)}
429
- @click=${(e: MouseEvent) => {
430
- e.preventDefault()
431
- this.showCalendar()
432
- }}
433
- @blur=${(e: FocusEvent) => {
434
- if (!this.calRef.value?.contains(e.relatedTarget as Node)) {
379
+ <pkt-datepicker-multiple
380
+ .value=${this._value}
381
+ .inputType=${this.inputType}
382
+ .id=${this.id}
383
+ .min=${this.min}
384
+ .max=${this.max}
385
+ .placeholder=${this.placeholder}
386
+ .readonly=${this.readonly}
387
+ .disabled=${this.disabled}
388
+ .maxlength=${this.maxlength}
389
+ .inputClasses=${this.inputClasses}
390
+ .internals=${this.internals}
391
+ .strings=${this.strings}
392
+ @toggle-calendar=${(e: CustomEvent) => this.toggleCalendar(e.detail)}
393
+ @input-change=${() => this.onInput()}
394
+ @input-focus=${() => this.onFocus()}
395
+ @input-blur=${(e: CustomEvent) => {
396
+ if (!this.calRef.value?.contains(e.detail.relatedTarget as Node)) {
435
397
  this.onBlur()
436
398
  }
437
- this.addToSelected(e)
438
- }}
439
- @input=${(e: Event) => {
440
- this.onInput()
441
- e.stopImmediatePropagation()
442
- }}
443
- @focus=${() => {
444
- this.onFocus()
445
- if (deviceDetection.isIOS()) {
446
- this.showCalendar()
447
- }
448
399
  }}
449
- @keydown=${(e: KeyboardEvent) =>
450
- keyboardUtils.handleInputKeydown(
451
- // event, toggleCalendar, submitForm, focusNext, blur, comma
452
- e,
453
- (event) => this.toggleCalendar(event),
454
- () => formUtils.submitFormOrFallback(this.internals, () => this.inputRef.value?.blur()),
455
- undefined,
456
- undefined,
457
- (event) => this.addToSelected(event),
458
- )}
459
- @change=${(e: Event) => {
400
+ @add-to-selected=${(e: CustomEvent) => this.addToSelected(e.detail)}
401
+ @input-changed=${() => {
460
402
  this.touched = true
461
- e.stopImmediatePropagation()
462
403
  }}
463
- ${ref(this.inputRef)}
464
- />
404
+ ${ref(this.multipleInputRef)}
405
+ ></pkt-datepicker-multiple>
465
406
  `
466
407
  }
467
408
 
@@ -510,8 +451,9 @@ export class PktDatepicker extends PktInputElement<Props> {
510
451
  this.showRangeLabels,
511
452
  this.multiple,
512
453
  this.range,
454
+ this.readonly,
455
+ this.inputType,
513
456
  )
514
- this.buttonClasses = cssUtils.getButtonClasses()
515
457
 
516
458
  return html`
517
459
  <pkt-input-wrapper
@@ -561,25 +503,11 @@ export class PktDatepicker extends PktInputElement<Props> {
561
503
  ? 'pkt-input__range-inputs'
562
504
  : ''}"
563
505
  >
564
- <div class="pkt-input__container">
565
- ${this.range
566
- ? this.renderRangeInput()
567
- : this.multiple
568
- ? this.renderMultipleInput()
569
- : this.renderInput()}
570
- <button
571
- class="${classMap(this.buttonClasses)}"
572
- type="button"
573
- @click=${this.toggleCalendar}
574
- @keydown=${(e: KeyboardEvent) =>
575
- keyboardUtils.handleButtonKeydown(e, (event) => this.toggleCalendar(event))}
576
- ?disabled=${this.disabled}
577
- ${ref(this.btnRef)}
578
- >
579
- <pkt-icon name="calendar"></pkt-icon>
580
- <span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
581
- </button>
582
- </div>
506
+ ${this.range
507
+ ? this.renderRangeInput()
508
+ : this.multiple
509
+ ? this.renderMultipleInput()
510
+ : this.renderInput()}
583
511
  </div>
584
512
  </pkt-input-wrapper>
585
513
  ${this.renderCalendar()}
@@ -1,3 +1,7 @@
1
1
  import { PktDatepicker } from './datepicker'
2
- export { PktDatepicker }
2
+ import { PktDatepickerSingle } from './datepicker-single'
3
+ import { PktDatepickerRange } from './datepicker-range'
4
+ import { PktDatepickerMultiple } from './datepicker-multiple'
5
+
6
+ export { PktDatepicker, PktDatepickerSingle, PktDatepickerRange, PktDatepickerMultiple }
3
7
  export default PktDatepicker