${this.showRangeLabels
? html`
${this.strings.generic?.from}
`
: nothing}
{
e.preventDefault()
this.dispatchToggleCalendar(e)
}}
@touchend=${(e: TouchEvent) => {
e.preventDefault()
this.dispatchToggleCalendar(e)
}}
@keydown=${(e: KeyboardEvent) =>
keyboardUtils.handleInputKeydown(
e,
(event) => this.dispatchToggleCalendar(event),
() =>
formUtils.submitFormOrFallback(this.internals, () =>
this.inputRefTo.value?.focus(),
),
() => this.inputRefTo.value?.focus(),
() => this.inputRef.value?.blur(),
)}
@input=${(e: Event) => {
this.dispatchInput(e)
e.stopImmediatePropagation()
}}
@focus=${() => {
this.dispatchFocus()
if (isIOS()) {
this.dispatchToggleCalendar(new Event('focus'))
}
}}
@blur=${(e: FocusEvent) => {
this.dispatchBlur(e)
this.dispatchEvent(
new CustomEvent('range-blur', {
detail: {
event: e,
values: this.value,
inputType: 'from',
},
bubbles: true,
composed: true,
}),
)
}}
@change=${(e: Event) => {
this.dispatchChange(e)
e.stopImmediatePropagation()
}}
${ref(this.inputRef)}
/>
${this.strings.generic?.to}
${!this.showRangeLabels ? html`
–
` : nothing}
{
e.preventDefault()
this.dispatchToggleCalendar(e)
}}
@touchend=${(e: TouchEvent) => {
e.preventDefault()
this.dispatchToggleCalendar(e)
}}
@keydown=${(e: KeyboardEvent) =>
keyboardUtils.handleInputKeydown(
e,
(event) => this.dispatchToggleCalendar(event),
() =>
formUtils.submitFormOrFallback(this.internals, () => this.inputRefTo.value?.blur()),
undefined,
() => this.inputRefTo.value?.blur(),
)}
@input=${(e: Event) => {
this.dispatchInput(e)
e.stopImmediatePropagation()
}}
@focus=${() => {
this.dispatchFocus()
if (isIOS()) {
this.dispatchToggleCalendar(new Event('focus'))
}
}}
@blur=${(e: FocusEvent) => {
this.dispatchBlur(e)
this.dispatchEvent(
new CustomEvent('range-blur', {
detail: {
event: e,
values: this.value,
inputType: 'to',
},
bubbles: true,
composed: true,
}),
)
}}
@change=${(e: Event) => {
this.dispatchChange(e)
e.stopImmediatePropagation()
}}
${ref(this.inputRefTo)}
/>
${this.renderCalendarButton()}
`
}
}
try {
customElement('pkt-datepicker-range')(PktDatepickerRange)
} catch (e) {
console.warn('Forsøker å definere