@oslokommune/punkt-elements 12.6.3 → 12.6.6

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.
Files changed (37) hide show
  1. package/dist/{class-map-Ch54kkX5.cjs → class-map-DjxCaVFk.cjs} +1 -1
  2. package/dist/{class-map-DunDFQn7.js → class-map-luGhSuLj.js} +1 -1
  3. package/dist/{index-CyqOyy_9.js → index-B-KXmo65.js} +1 -1
  4. package/dist/{index-DSyh6tUw.cjs → index-BYZhBzXZ.cjs} +1 -1
  5. package/dist/{index-BI6-RUqp.js → index-BkXggpNp.js} +123 -110
  6. package/dist/{index-CsTujnXs.js → index-CF6_-ZoF.js} +15 -12
  7. package/dist/{index-BNOnscrA.cjs → index-CzPkBTm-.cjs} +29 -18
  8. package/dist/{index-Bpc07w_P.cjs → index-DAWAnAW_.cjs} +1 -1
  9. package/dist/pkt-alert.cjs +1 -1
  10. package/dist/pkt-alert.js +4 -4
  11. package/dist/pkt-calendar.cjs +1 -1
  12. package/dist/pkt-calendar.js +4 -4
  13. package/dist/pkt-card.cjs +1 -1
  14. package/dist/pkt-card.js +4 -4
  15. package/dist/pkt-component-template.cjs +1 -1
  16. package/dist/pkt-component-template.js +3 -3
  17. package/dist/pkt-datepicker.cjs +18 -14
  18. package/dist/pkt-datepicker.js +40 -37
  19. package/dist/pkt-element.cjs +1 -1
  20. package/dist/pkt-element.js +1 -1
  21. package/dist/pkt-icon.cjs +1 -1
  22. package/dist/pkt-icon.js +2 -2
  23. package/dist/pkt-index.cjs +1 -1
  24. package/dist/pkt-index.js +2 -2
  25. package/dist/pkt-input-wrapper.cjs +1 -1
  26. package/dist/pkt-input-wrapper.js +4 -4
  27. package/dist/pkt-link.cjs +1 -1
  28. package/dist/pkt-link.js +4 -4
  29. package/dist/pkt-messagebox.cjs +1 -1
  30. package/dist/pkt-messagebox.js +4 -4
  31. package/dist/pkt-tag.cjs +2 -2
  32. package/dist/pkt-tag.js +13 -13
  33. package/dist/{ref-C3InMDfU.cjs → ref-BuQtfKiL.cjs} +1 -1
  34. package/dist/{ref-By_W8A-f.js → ref-rfvuMlT1.js} +1 -1
  35. package/package.json +3 -3
  36. package/src/components/calendar/index.ts +22 -8
  37. package/src/components/datepicker/index.ts +22 -6
@@ -248,6 +248,10 @@ export class PktDatepicker extends PktInputElement {
248
248
  if (e.key === ',' || e.key === 'Enter') {
249
249
  this.inputRef.value?.blur()
250
250
  }
251
+ if (e.key === 'Space' || e.key === ' ') {
252
+ e.preventDefault()
253
+ this.toggleCalendar(e)
254
+ }
251
255
  }}
252
256
  @input=${(e: Event) => {
253
257
  this.onInput()
@@ -293,6 +297,10 @@ export class PktDatepicker extends PktInputElement {
293
297
  if (e.key === ',' || e.key === 'Enter') {
294
298
  this.inputRef.value?.blur()
295
299
  }
300
+ if (e.key === 'Space' || e.key === ' ') {
301
+ e.preventDefault()
302
+ this.toggleCalendar(e)
303
+ }
296
304
  }}
297
305
  @input=${(e: Event) => {
298
306
  this.onInput()
@@ -323,11 +331,12 @@ export class PktDatepicker extends PktInputElement {
323
331
  }}
324
332
  ${ref(this.inputRef)}
325
333
  />
326
- <div class="pkt-input-prefix">Til</div>
334
+ <div class="pkt-input-prefix" id="${this.id}-to-label">Til</div>
327
335
  <input
328
336
  class=${classMap(this.inputClasses)}
329
337
  .type=${this.inputType}
330
338
  id="${this.id}-to"
339
+ aria-labelledby="${this.id}-to-label"
331
340
  .value=${this._value[1] ?? ''}
332
341
  min=${this.min}
333
342
  max=${this.max}
@@ -340,6 +349,10 @@ export class PktDatepicker extends PktInputElement {
340
349
  if (e.key === ',' || e.key === 'Enter') {
341
350
  this.inputRefTo.value?.blur()
342
351
  }
352
+ if (e.key === 'Space' || e.key === ' ') {
353
+ e.preventDefault()
354
+ this.toggleCalendar(e)
355
+ }
343
356
  }}
344
357
  @input=${(e: Event) => {
345
358
  this.onInput()
@@ -420,6 +433,10 @@ export class PktDatepicker extends PktInputElement {
420
433
  e.preventDefault()
421
434
  this.addToSelected(e)
422
435
  }
436
+ if (e.key === 'Space' || e.key === ' ') {
437
+ e.preventDefault()
438
+ this.toggleCalendar(e)
439
+ }
423
440
  }}
424
441
  ?disabled=${this.disabled || (this.maxlength && this._value.length >= this.maxlength)}
425
442
  @change=${(e: Event) => {
@@ -441,7 +458,8 @@ export class PktDatepicker extends PktInputElement {
441
458
  <pkt-tag
442
459
  .id="${this.id + date + '-tag'}"
443
460
  closeTag
444
- @onClose=${() => this.calRef.value?.handleDateSelect(this.fromISOToDate(date))}
461
+ ariaLabel="${this.strings.calendar.deleteDate} ${this.fromISOtoLocal(date)}"
462
+ @close=${() => this.calRef.value?.handleDateSelect(this.fromISOToDate(date))}
445
463
  >${this.fromISOtoLocal(date)}</pkt-tag
446
464
  >
447
465
  `,
@@ -461,6 +479,7 @@ export class PktDatepicker extends PktInputElement {
461
479
  ${ref(this.popupRef)}
462
480
  >
463
481
  <pkt-calendar
482
+ id="${this.id}-calendar"
464
483
  ?multiple=${this.multiple}
465
484
  ?range=${this.range}
466
485
  ?weeknumbers=${this.weeknumbers}
@@ -527,6 +546,7 @@ export class PktDatepicker extends PktInputElement {
527
546
  : this.renderInput()}
528
547
  <button
529
548
  class="${classMap(this.buttonClasses)}"
549
+ type="button"
530
550
  @click=${this.toggleCalendar}
531
551
  ?disabled=${this.disabled}
532
552
  ${ref(this.btnRef)}
@@ -609,9 +629,5 @@ export class PktDatepicker extends PktInputElement {
609
629
  public async toggleCalendar(e: Event) {
610
630
  e.preventDefault()
611
631
  this.calendarOpen ? this.hideCalendar() : this.showCalendar()
612
- await sleep(20)
613
- if (this.isMobileSafari) {
614
- this.calRef.value?.focusOnCurrentDate()
615
- }
616
632
  }
617
633
  }