@oslokommune/punkt-elements 12.3.9 → 12.3.11

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 (39) hide show
  1. package/dist/{class-map-DnAEF9tj.js → class-map-CQf6i-xX.js} +1 -1
  2. package/dist/{class-map-CFiVus5w.cjs → class-map-D5yOTE4V.cjs} +1 -1
  3. package/dist/{index-DZ0cjZdG.cjs → index-BGPEwMZQ.cjs} +1 -1
  4. package/dist/{index-ZXmkp0To.cjs → index-Bfdr5FsZ.cjs} +5 -5
  5. package/dist/{index-CsKoXqeT.js → index-BtB1fCeq.js} +1 -1
  6. package/dist/{index-BoxUN9GL.js → index-DFB6cAPd.js} +47 -35
  7. package/dist/{index-DZGlpxj6.cjs → index-cmcwixge.cjs} +7 -7
  8. package/dist/{index-CiTPWPc2.js → index-erLPjF21.js} +30 -16
  9. package/dist/index.d.ts +6 -2
  10. package/dist/pkt-alert.cjs +1 -1
  11. package/dist/pkt-alert.js +4 -4
  12. package/dist/pkt-calendar.cjs +1 -1
  13. package/dist/pkt-calendar.js +4 -4
  14. package/dist/pkt-card.cjs +1 -1
  15. package/dist/pkt-card.js +4 -4
  16. package/dist/pkt-component-template.cjs +1 -1
  17. package/dist/pkt-component-template.js +3 -3
  18. package/dist/pkt-datepicker.cjs +28 -15
  19. package/dist/pkt-datepicker.js +183 -143
  20. package/dist/pkt-element.cjs +1 -1
  21. package/dist/pkt-element.js +1 -1
  22. package/dist/pkt-icon.cjs +1 -1
  23. package/dist/pkt-icon.js +2 -2
  24. package/dist/pkt-index.cjs +1 -1
  25. package/dist/pkt-index.js +2 -2
  26. package/dist/pkt-input-wrapper.cjs +1 -1
  27. package/dist/pkt-input-wrapper.js +4 -4
  28. package/dist/pkt-link.cjs +1 -1
  29. package/dist/pkt-link.js +4 -4
  30. package/dist/pkt-messagebox.cjs +1 -1
  31. package/dist/pkt-messagebox.js +4 -4
  32. package/dist/pkt-tag.cjs +1 -1
  33. package/dist/pkt-tag.js +4 -4
  34. package/dist/{ref-G2cIenWo.cjs → ref-CRbDaFY5.cjs} +1 -1
  35. package/dist/{ref-DzpbHCb_.js → ref-ClWSy3zg.js} +1 -1
  36. package/package.json +3 -3
  37. package/src/components/calendar/index.ts +18 -0
  38. package/src/components/datepicker/index.ts +78 -5
  39. package/src/components/element/index.ts +17 -5
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DZGlpxj6.cjs");exports.PktElement=e.PktElement;exports.PktInputElement=e.PktInputElement;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-cmcwixge.cjs");exports.PktElement=e.PktElement;exports.PktInputElement=e.PktInputElement;
@@ -1,4 +1,4 @@
1
- import { P as a, a as m } from "./index-BoxUN9GL.js";
1
+ import { P as a, a as m } from "./index-DFB6cAPd.js";
2
2
  export {
3
3
  a as PktElement,
4
4
  m as PktInputElement
package/dist/pkt-icon.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-DZGlpxj6.cjs");require("./directive-19_ixLKS.cjs");const e=require("./index-DZ0cjZdG.cjs");Object.defineProperty(exports,"PktIcon",{enumerable:!0,get:()=>e.PktIcon});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-cmcwixge.cjs");require("./directive-19_ixLKS.cjs");const e=require("./index-BGPEwMZQ.cjs");Object.defineProperty(exports,"PktIcon",{enumerable:!0,get:()=>e.PktIcon});
package/dist/pkt-icon.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./index-BoxUN9GL.js";
1
+ import "./index-DFB6cAPd.js";
2
2
  import "./directive-DA0-wdk7.js";
3
- import { P as p } from "./index-CsKoXqeT.js";
3
+ import { P as p } from "./index-BtB1fCeq.js";
4
4
  export {
5
5
  p as PktIcon
6
6
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-ZXmkp0To.cjs"),t=require("./pkt-card.cjs"),r=require("./pkt-component-template.cjs"),n=require("./pkt-datepicker.cjs"),o=require("./index-DZ0cjZdG.cjs"),a=require("./pkt-input-wrapper.cjs"),u=require("./pkt-link.cjs"),c=require("./pkt-messagebox.cjs"),i=require("./pkt-tag.cjs");Object.defineProperty(exports,"PktCalendar",{enumerable:!0,get:()=>e.PktCalendar});Object.defineProperty(exports,"PktCard",{enumerable:!0,get:()=>t.PktCard});Object.defineProperty(exports,"PktComponent",{enumerable:!0,get:()=>r.PktComponent});Object.defineProperty(exports,"PktDatepicker",{enumerable:!0,get:()=>n.PktDatepicker});Object.defineProperty(exports,"PktIcon",{enumerable:!0,get:()=>o.PktIcon});Object.defineProperty(exports,"PktInputWrapper",{enumerable:!0,get:()=>a.PktInputWrapper});Object.defineProperty(exports,"PktLink",{enumerable:!0,get:()=>u.PktLink});Object.defineProperty(exports,"PktMessagebox",{enumerable:!0,get:()=>c.PktMessagebox});Object.defineProperty(exports,"PktTag",{enumerable:!0,get:()=>i.PktTag});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-Bfdr5FsZ.cjs"),t=require("./pkt-card.cjs"),r=require("./pkt-component-template.cjs"),n=require("./pkt-datepicker.cjs"),o=require("./index-BGPEwMZQ.cjs"),a=require("./pkt-input-wrapper.cjs"),u=require("./pkt-link.cjs"),c=require("./pkt-messagebox.cjs"),i=require("./pkt-tag.cjs");Object.defineProperty(exports,"PktCalendar",{enumerable:!0,get:()=>e.PktCalendar});Object.defineProperty(exports,"PktCard",{enumerable:!0,get:()=>t.PktCard});Object.defineProperty(exports,"PktComponent",{enumerable:!0,get:()=>r.PktComponent});Object.defineProperty(exports,"PktDatepicker",{enumerable:!0,get:()=>n.PktDatepicker});Object.defineProperty(exports,"PktIcon",{enumerable:!0,get:()=>o.PktIcon});Object.defineProperty(exports,"PktInputWrapper",{enumerable:!0,get:()=>a.PktInputWrapper});Object.defineProperty(exports,"PktLink",{enumerable:!0,get:()=>u.PktLink});Object.defineProperty(exports,"PktMessagebox",{enumerable:!0,get:()=>c.PktMessagebox});Object.defineProperty(exports,"PktTag",{enumerable:!0,get:()=>i.PktTag});
package/dist/pkt-index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { P as t } from "./index-CiTPWPc2.js";
1
+ import { P as t } from "./index-erLPjF21.js";
2
2
  import { PktCard as p } from "./pkt-card.js";
3
3
  import { PktComponent as P } from "./pkt-component-template.js";
4
4
  import { PktDatepicker as x } from "./pkt-datepicker.js";
5
- import { P as f } from "./index-CsKoXqeT.js";
5
+ import { P as f } from "./index-BtB1fCeq.js";
6
6
  import { PktInputWrapper as s } from "./pkt-input-wrapper.js";
7
7
  import { PktLink as c } from "./pkt-link.js";
8
8
  import { PktMessagebox as g } from "./pkt-messagebox.js";
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DZGlpxj6.cjs"),f=require("./ref-G2cIenWo.cjs"),c=require("./index-DZ0cjZdG.cjs"),u=require("./class-map-CFiVus5w.cjs"),$=require("./directive-19_ixLKS.cjs");/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-cmcwixge.cjs"),f=require("./ref-CRbDaFY5.cjs"),c=require("./index-BGPEwMZQ.cjs"),u=require("./class-map-D5yOTE4V.cjs"),$=require("./directive-19_ixLKS.cjs");/**
2
2
  * @license
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1,7 +1,7 @@
1
- import { P as w, v as T, D as o, k as i, n as r } from "./index-BoxUN9GL.js";
2
- import { i as _, P as D, K as I } from "./ref-DzpbHCb_.js";
3
- import { a as f } from "./index-CsKoXqeT.js";
4
- import { R as c } from "./class-map-DnAEF9tj.js";
1
+ import { P as w, v as T, D as o, k as i, n as r } from "./index-DFB6cAPd.js";
2
+ import { i as _, P as D, K as I } from "./ref-ClWSy3zg.js";
3
+ import { a as f } from "./index-BtB1fCeq.js";
4
+ import { R as c } from "./class-map-CQf6i-xX.js";
5
5
  import { t as S } from "./directive-DA0-wdk7.js";
6
6
  /**
7
7
  * @license
package/dist/pkt-link.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DZGlpxj6.cjs"),c=require("./ref-G2cIenWo.cjs"),k=require("./class-map-CFiVus5w.cjs"),h=require("./directive-19_ixLKS.cjs");require("./index-DZ0cjZdG.cjs");const 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"}},p={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 t=o>1?void 0:o?y(n,r):n,l=s.length-1,a;l>=0;l--)(a=s[l])&&(t=(o?a(n,r,t):a(t))||t);return o&&t&&P(n,r,t),t};exports.PktLink=class extends e.PktElement{constructor(){super(),this.defaultSlot=c.ii(),this.href=p.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=p.props.external.default,this.target=p.props.target.default,this.slotController=new c.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 e.ke`<a
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-cmcwixge.cjs"),c=require("./ref-CRbDaFY5.cjs"),k=require("./class-map-D5yOTE4V.cjs"),h=require("./directive-19_ixLKS.cjs");require("./index-BGPEwMZQ.cjs");const 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"}},p={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 t=o>1?void 0:o?y(n,r):n,l=s.length-1,a;l>=0;l--)(a=s[l])&&(t=(o?a(n,r,t):a(t))||t);return o&&t&&P(n,r,t),t};exports.PktLink=class extends e.PktElement{constructor(){super(),this.defaultSlot=c.ii(),this.href=p.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=p.props.external.default,this.target=p.props.target.default,this.slotController=new c.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 e.ke`<a
2
2
  class=${k.Rt(n)}
3
3
  href=${this.href}
4
4
  @click=${this.handleClick}
package/dist/pkt-link.js CHANGED
@@ -1,8 +1,8 @@
1
- import { P as f, k, D as h, n as i } from "./index-BoxUN9GL.js";
2
- import { i as m, P as d, K as u } from "./ref-DzpbHCb_.js";
3
- import { R as P } from "./class-map-DnAEF9tj.js";
1
+ import { P as f, k, D as h, n as i } from "./index-DFB6cAPd.js";
2
+ import { i as m, P as d, K as u } from "./ref-ClWSy3zg.js";
3
+ import { R as P } from "./class-map-CQf6i-xX.js";
4
4
  import { t as y } from "./directive-DA0-wdk7.js";
5
- import "./index-CsKoXqeT.js";
5
+ import "./index-BtB1fCeq.js";
6
6
  const g = "pkt-link", v = !0, _ = {
7
7
  href: {
8
8
  name: "URL",
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DZGlpxj6.cjs"),c=require("./ref-G2cIenWo.cjs"),p=require("./class-map-CFiVus5w.cjs"),b=require("./directive-19_ixLKS.cjs");require("./index-DZ0cjZdG.cjs");var k=Object.defineProperty,u=Object.getOwnPropertyDescriptor,s=(i,o,r,l)=>{for(var t=l>1?void 0:l?u(o,r):o,a=i.length-1,n;a>=0;a--)(n=i[a])&&(t=(l?n(o,r,t):n(t))||t);return l&&t&&k(o,r,t),t};exports.PktMessagebox=class extends e.PktElement{constructor(){super(),this.defaultSlot=c.ii(),this.closable=!1,this.compact=!1,this.title="",this.skin="beige",this.isDisplayed=!0,this.slotController=new c.PktSlotController(this,this.defaultSlot)}handleClose(){this.isDisplayed=!1,this.onClose&&this.onClose()}render(){const o={"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:this.skin,"pkt-messagebox--closable":this.closable};return this.isDisplayed?e.ke`<div class=${p.Rt(o)}>
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-cmcwixge.cjs"),c=require("./ref-CRbDaFY5.cjs"),p=require("./class-map-D5yOTE4V.cjs"),b=require("./directive-19_ixLKS.cjs");require("./index-BGPEwMZQ.cjs");var k=Object.defineProperty,u=Object.getOwnPropertyDescriptor,s=(i,o,r,l)=>{for(var t=l>1?void 0:l?u(o,r):o,a=i.length-1,n;a>=0;a--)(n=i[a])&&(t=(l?n(o,r,t):n(t))||t);return l&&t&&k(o,r,t),t};exports.PktMessagebox=class extends e.PktElement{constructor(){super(),this.defaultSlot=c.ii(),this.closable=!1,this.compact=!1,this.title="",this.skin="beige",this.isDisplayed=!0,this.slotController=new c.PktSlotController(this,this.defaultSlot)}handleClose(){this.isDisplayed=!1,this.onClose&&this.onClose()}render(){const o={"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:this.skin,"pkt-messagebox--closable":this.closable};return this.isDisplayed?e.ke`<div class=${p.Rt(o)}>
2
2
  ${this.closable?e.ke`<div class="pkt-messagebox__close">
3
3
  <button
4
4
  @click=${this.handleClose}
@@ -1,8 +1,8 @@
1
- import { P as m, D as c, k as h, n as o } from "./index-BoxUN9GL.js";
2
- import { i as b, P as f, K as k } from "./ref-DzpbHCb_.js";
3
- import { R as u } from "./class-map-DnAEF9tj.js";
1
+ import { P as m, D as c, k as h, n as o } from "./index-DFB6cAPd.js";
2
+ import { i as b, P as f, K as k } from "./ref-ClWSy3zg.js";
3
+ import { R as u } from "./class-map-CQf6i-xX.js";
4
4
  import { t as y } from "./directive-DA0-wdk7.js";
5
- import "./index-CsKoXqeT.js";
5
+ import "./index-BtB1fCeq.js";
6
6
  var d = Object.defineProperty, v = Object.getOwnPropertyDescriptor, s = (l, i, p, r) => {
7
7
  for (var e = r > 1 ? void 0 : r ? v(i, p) : i, a = l.length - 1, n; a >= 0; a--)
8
8
  (n = l[a]) && (e = (r ? n(i, p, e) : n(e)) || e);
package/dist/pkt-tag.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./class-map-CFiVus5w.cjs"),g=require("./directive-19_ixLKS.cjs"),t=require("./index-DZGlpxj6.cjs"),o=require("./ref-G2cIenWo.cjs");require("./index-DZ0cjZdG.cjs");const h="pkt-tag",k={closeTag:{type:"boolean",required:!1,default:!1},size:{required:!1,default:"medium",type:["small","medium","large"]},iconName:{type:"string",required:!1},skin:{required:!1,default:"blue",type:["blue","green","red","beige","yellow","gray","blue-light"]},textStyle:{required:!1,default:"normal-text",type:["thin-text","normal-text"]},type:{required:!1,default:"button",type:["button","submit","reset"]},ariaLabel:{type:"string",required:!1,default:"close"}},f={default:{description:"Teksten til tag"}},a={name:h,"css-class":"pkt-tag",props:k,slots:f};var d=Object.defineProperty,y=Object.getOwnPropertyDescriptor,e=(n,s,r,l)=>{for(var i=l>1?void 0:l?y(s,r):s,p=n.length-1,c;p>=0;p--)(c=n[p])&&(i=(l?c(s,r,i):c(i))||i);return l&&i&&d(s,r,i),i};exports.PktTag=class extends t.PktElement{constructor(){super(),this.defaultSlot=o.ii(),this.closeTag=a.props.closeTag.default,this.size=a.props.size.default,this.skin=a.props.skin.default,this.textStyle=a.props.textStyle.default,this.iconName=void 0,this.type=a.props.type.default,this.ariaLabel=a.props.ariaLabel.default,this._isClosed=!1,this.close=s=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("onClose",{detail:{origin:s},bubbles:!0,composed:!0}))},this.slotController=new o.PktSlotController(this,this.defaultSlot),this._isClosed=!1}render(){const s={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},r={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName};return this.closeTag?this._isClosed?t.D:t.ke`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./class-map-D5yOTE4V.cjs"),g=require("./directive-19_ixLKS.cjs"),t=require("./index-cmcwixge.cjs"),o=require("./ref-CRbDaFY5.cjs");require("./index-BGPEwMZQ.cjs");const h="pkt-tag",k={closeTag:{type:"boolean",required:!1,default:!1},size:{required:!1,default:"medium",type:["small","medium","large"]},iconName:{type:"string",required:!1},skin:{required:!1,default:"blue",type:["blue","green","red","beige","yellow","gray","blue-light"]},textStyle:{required:!1,default:"normal-text",type:["thin-text","normal-text"]},type:{required:!1,default:"button",type:["button","submit","reset"]},ariaLabel:{type:"string",required:!1,default:"close"}},f={default:{description:"Teksten til tag"}},a={name:h,"css-class":"pkt-tag",props:k,slots:f};var d=Object.defineProperty,y=Object.getOwnPropertyDescriptor,e=(n,s,r,l)=>{for(var i=l>1?void 0:l?y(s,r):s,p=n.length-1,c;p>=0;p--)(c=n[p])&&(i=(l?c(s,r,i):c(i))||i);return l&&i&&d(s,r,i),i};exports.PktTag=class extends t.PktElement{constructor(){super(),this.defaultSlot=o.ii(),this.closeTag=a.props.closeTag.default,this.size=a.props.size.default,this.skin=a.props.skin.default,this.textStyle=a.props.textStyle.default,this.iconName=void 0,this.type=a.props.type.default,this.ariaLabel=a.props.ariaLabel.default,this._isClosed=!1,this.close=s=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("onClose",{detail:{origin:s},bubbles:!0,composed:!0}))},this.slotController=new o.PktSlotController(this,this.defaultSlot),this._isClosed=!1}render(){const s={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},r={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName};return this.closeTag?this._isClosed?t.D:t.ke`
2
2
  <button
3
3
  class=${u.Rt(r)}
4
4
  type=${this.type}
package/dist/pkt-tag.js CHANGED
@@ -1,8 +1,8 @@
1
- import { R as h } from "./class-map-DnAEF9tj.js";
1
+ import { R as h } from "./class-map-CQf6i-xX.js";
2
2
  import { t as y } from "./directive-DA0-wdk7.js";
3
- import { r as d, P as g, k as p, D as k, n as i } from "./index-BoxUN9GL.js";
4
- import { i as m, P as b, K as f } from "./ref-DzpbHCb_.js";
5
- import "./index-CsKoXqeT.js";
3
+ import { r as d, P as g, k as p, D as k, n as i } from "./index-DFB6cAPd.js";
4
+ import { i as m, P as b, K as f } from "./ref-ClWSy3zg.js";
5
+ import "./index-BtB1fCeq.js";
6
6
  const S = "pkt-tag", _ = {
7
7
  closeTag: {
8
8
  type: "boolean",
@@ -1,4 +1,4 @@
1
- "use strict";const a=require("./index-DZGlpxj6.cjs"),$=require("./directive-19_ixLKS.cjs");class p{constructor(e,...s){this.nodes=[],this.host=e,this.host.addController(this),this.slots=s,this.nodes=[]}hostConnected(){Array.from(this.host.childNodes).forEach(e=>{var s;if(e.nodeName==="#text"){if((s=e.nodeValue)!=null&&s.trim()){const i=document==null?void 0:document.createElement("template");i.content.appendChild(e),this.nodes.push(i)}}else this.nodes.push(e)})}hostUpdated(){this.slots.forEach(e=>{if(!e.value)return;const s=e.value.getAttribute("name"),i=this.nodes.flatMap(n=>n.getAttribute&&n.getAttribute("slot")==s?this.nodeFromElement(n,e):[]);i.length&&e.value.replaceChildren(...i)})}nodeFromElement(e,s){var i;return e===((i=s.value)==null?void 0:i.parentNode)?[]:e instanceof HTMLTemplateElement?Array.from(e.content.childNodes):e}}/**
1
+ "use strict";const a=require("./index-cmcwixge.cjs"),$=require("./directive-19_ixLKS.cjs");class p{constructor(e,...s){this.nodes=[],this.host=e,this.host.addController(this),this.slots=s,this.nodes=[]}hostConnected(){Array.from(this.host.childNodes).forEach(e=>{var s;if(e.nodeName==="#text"){if((s=e.nodeValue)!=null&&s.trim()){const i=document==null?void 0:document.createElement("template");i.content.appendChild(e),this.nodes.push(i)}}else this.nodes.push(e)})}hostUpdated(){this.slots.forEach(e=>{if(!e.value)return;const s=e.value.getAttribute("name"),i=this.nodes.flatMap(n=>n.getAttribute&&n.getAttribute("slot")==s?this.nodeFromElement(n,e):[]);i.length&&e.value.replaceChildren(...i)})}nodeFromElement(e,s){var i;return e===((i=s.value)==null?void 0:i.parentNode)?[]:e instanceof HTMLTemplateElement?Array.from(e.content.childNodes):e}}/**
2
2
  * @license
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1,4 +1,4 @@
1
- import { s as p, D as _ } from "./index-BoxUN9GL.js";
1
+ import { s as p, D as _ } from "./index-DFB6cAPd.js";
2
2
  import { i as v, a as m, e as g } from "./directive-DA0-wdk7.js";
3
3
  class H {
4
4
  constructor(e, ...s) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-elements",
3
- "version": "12.3.9",
3
+ "version": "12.3.11",
4
4
  "description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo Origo",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "@oslokommune/punkt-assets": "^12.1.0",
31
- "@oslokommune/punkt-css": "^12.3.4",
31
+ "@oslokommune/punkt-css": "^12.3.10",
32
32
  "sass": "^1.78.0",
33
33
  "typescript": "^5.6.2",
34
34
  "vite": "^5.4.4",
@@ -55,5 +55,5 @@
55
55
  "url": "https://github.com/oslokommune/punkt/issues"
56
56
  },
57
57
  "license": "MIT",
58
- "gitHead": "794e48054ce7da8965056cca1d34a731d5edc318"
58
+ "gitHead": "cab2d7b27cf3ba82a6ab36ca5b119a533e027a54"
59
59
  }
@@ -621,6 +621,24 @@ export class PktCalendar extends PktElement {
621
621
  return Promise.resolve()
622
622
  }
623
623
 
624
+ public focusOnCurrentDate() {
625
+ const currentDateISO = this.formatISODate(new Date())
626
+ const el = this.querySelector(`div[data-date="${currentDateISO}"]`)
627
+ if (el instanceof HTMLDivElement) {
628
+ el.focus()
629
+ } else {
630
+ const firstSelectable = this.selectableDates.find((x) => !x.isDisabled)
631
+ if (firstSelectable) {
632
+ const firstSelectableEl = this.querySelector(
633
+ `div[data-date="${firstSelectable.currentDateISO}"]`,
634
+ )
635
+ if (firstSelectableEl instanceof HTMLDivElement) {
636
+ firstSelectableEl.focus()
637
+ }
638
+ }
639
+ }
640
+ }
641
+
624
642
  public closeEvent(e: FocusEvent) {
625
643
  if (!this.contains(e.relatedTarget as Node)) {
626
644
  this.close()
@@ -79,6 +79,12 @@ export class PktDatepicker extends PktInputElement {
79
79
 
80
80
  async connectedCallback() {
81
81
  super.connectedCallback()
82
+
83
+ this.isMobileSafari =
84
+ /iP(ad|od|hone)/i.test(window.navigator.userAgent) &&
85
+ !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/)
86
+ this.inputType = this.isMobileSafari ? 'text' : 'date'
87
+
82
88
  document &&
83
89
  document.body.addEventListener('click', (e: MouseEvent) => {
84
90
  if (
@@ -226,7 +232,7 @@ export class PktDatepicker extends PktInputElement {
226
232
  return html`
227
233
  <input
228
234
  class="${classMap(this.inputClasses)}"
229
- type="date"
235
+ .type=${this.inputType}
230
236
  id="${this.id}-input"
231
237
  .value=${this._value[0] ?? ''}
232
238
  min=${this.min}
@@ -236,7 +242,23 @@ export class PktDatepicker extends PktInputElement {
236
242
  this.showCalendar()
237
243
  }}
238
244
  ?disabled=${this.disabled}
245
+ @keydown=${(e: KeyboardEvent) => {
246
+ if (e.key === ',' || e.key === 'Enter') {
247
+ this.inputRef.value?.blur()
248
+ }
249
+ }}
250
+ @input=${(e: Event) => {
251
+ this.onInput()
252
+ e.stopImmediatePropagation()
253
+ }}
254
+ @focus=${() => {
255
+ this.onFocus()
256
+ if (this.isMobileSafari) {
257
+ this.showCalendar()
258
+ }
259
+ }}
239
260
  @blur=${(e: Event) => {
261
+ this.onBlur()
240
262
  this.manageValidity(e.target as HTMLInputElement)
241
263
  this.value = (e.target as HTMLInputElement).value
242
264
  }}
@@ -253,7 +275,7 @@ export class PktDatepicker extends PktInputElement {
253
275
  <div class="pkt-input-prefix">Fra</div>
254
276
  <input
255
277
  class=${classMap(this.inputClasses)}
256
- type="date"
278
+ .type=${this.inputType}
257
279
  id="${this.id}-input"
258
280
  .value=${this._value[0] ?? ''}
259
281
  min=${this.min}
@@ -263,6 +285,21 @@ export class PktDatepicker extends PktInputElement {
263
285
  this.showCalendar()
264
286
  }}
265
287
  ?disabled=${this.disabled}
288
+ @keydown=${(e: KeyboardEvent) => {
289
+ if (e.key === ',' || e.key === 'Enter') {
290
+ this.inputRef.value?.blur()
291
+ }
292
+ }}
293
+ @input=${(e: Event) => {
294
+ this.onInput()
295
+ e.stopImmediatePropagation()
296
+ }}
297
+ @focus=${() => {
298
+ this.onFocus()
299
+ if (this.isMobileSafari) {
300
+ this.showCalendar()
301
+ }
302
+ }}
266
303
  @blur=${(e: Event) => {
267
304
  if ((e.target as HTMLInputElement).value) {
268
305
  this.manageValidity(e.target as HTMLInputElement)
@@ -284,7 +321,7 @@ export class PktDatepicker extends PktInputElement {
284
321
  <div class="pkt-input-prefix">Til</div>
285
322
  <input
286
323
  class=${classMap(this.inputClasses)}
287
- type="date"
324
+ .type=${this.inputType}
288
325
  id="${this.id}-to"
289
326
  .value=${this._value[1] ?? ''}
290
327
  min=${this.min}
@@ -294,7 +331,23 @@ export class PktDatepicker extends PktInputElement {
294
331
  this.showCalendar()
295
332
  }}
296
333
  ?disabled=${this.disabled}
334
+ @keydown=${(e: KeyboardEvent) => {
335
+ if (e.key === ',' || e.key === 'Enter') {
336
+ this.inputRefTo.value?.blur()
337
+ }
338
+ }}
339
+ @input=${(e: Event) => {
340
+ this.onInput()
341
+ e.stopImmediatePropagation()
342
+ }}
343
+ @focus=${() => {
344
+ this.onFocus()
345
+ if (this.isMobileSafari) {
346
+ this.showCalendar()
347
+ }
348
+ }}
297
349
  @blur=${(e: Event) => {
350
+ this.onBlur()
298
351
  if ((e.target as HTMLInputElement).value) {
299
352
  this.manageValidity(e.target as HTMLInputElement)
300
353
  const val = (e.target as HTMLInputElement).value
@@ -331,7 +384,7 @@ export class PktDatepicker extends PktInputElement {
331
384
  return html`
332
385
  <input
333
386
  class=${classMap(this.inputClasses)}
334
- type="date"
387
+ .type=${this.inputType}
335
388
  id="${this.id}-input"
336
389
  min=${this.min}
337
390
  max=${this.max}
@@ -340,8 +393,19 @@ export class PktDatepicker extends PktInputElement {
340
393
  this.showCalendar()
341
394
  }}
342
395
  @blur=${(e: Event) => {
396
+ this.onBlur()
343
397
  this.addToSelected(e)
344
398
  }}
399
+ @input=${(e: Event) => {
400
+ this.onInput()
401
+ e.stopImmediatePropagation()
402
+ }}
403
+ @focus=${() => {
404
+ this.onFocus()
405
+ if (this.isMobileSafari) {
406
+ this.showCalendar()
407
+ }
408
+ }}
345
409
  @keydown=${(e: KeyboardEvent) => {
346
410
  if (e.key === ',' || e.key === 'Enter') {
347
411
  e.preventDefault()
@@ -430,6 +494,7 @@ export class PktDatepicker extends PktInputElement {
430
494
  ?required=${this.required}
431
495
  ?optionalTag=${this.optionalTag}
432
496
  ?requiredTag=${this.requiredTag}
497
+ ?focusPreventDefault=${true}
433
498
  .optionalText=${this.optionalText}
434
499
  .requiredText=${this.requiredText}
435
500
  .errorMessage=${this.errorMessage}
@@ -449,6 +514,7 @@ export class PktDatepicker extends PktInputElement {
449
514
  <button
450
515
  class="${classMap(this.buttonClasses)}"
451
516
  @click=${this.toggleCalendar}
517
+ ?disabled=${this.disabled}
452
518
  ${ref(this.btnRef)}
453
519
  >
454
520
  <pkt-icon name="calendar"></pkt-icon>
@@ -516,14 +582,21 @@ export class PktDatepicker extends PktInputElement {
516
582
  this.calendarOpen = true
517
583
  await sleep(20)
518
584
  this.handleCalendarPosition()
585
+ if (this.isMobileSafari) {
586
+ this.calRef.value?.focusOnCurrentDate()
587
+ }
519
588
  }
520
589
 
521
590
  public hideCalendar() {
522
591
  this.calendarOpen = false
523
592
  }
524
593
 
525
- public toggleCalendar(e: Event) {
594
+ public async toggleCalendar(e: Event) {
526
595
  e.preventDefault()
527
596
  this.calendarOpen ? this.hideCalendar() : this.showCalendar()
597
+ await sleep(20)
598
+ if (this.isMobileSafari) {
599
+ this.calRef.value?.focusOnCurrentDate()
600
+ }
528
601
  }
529
602
  }
@@ -188,7 +188,7 @@ export class PktInputElement extends PktElement {
188
188
  if ((!this.value || this.value.length === 0) && _old && _old.length !== 0) {
189
189
  this.clearInputValue()
190
190
  } else if (this.value && this.value.toString() !== _old?.toString()) {
191
- this.onInput(this.value)
191
+ this.onChange(this.value)
192
192
  }
193
193
  this.updateComplete.then(() => this.requestUpdate())
194
194
  }
@@ -208,8 +208,23 @@ export class PktInputElement extends PktElement {
208
208
  )
209
209
  }
210
210
 
211
+ // When user enters the input, we need to push that event out to the form
212
+ protected onFocus(): void {
213
+ this.dispatchEvent(new Event('focus'))
214
+ }
215
+
216
+ // And also when the user leaves the input...
217
+ protected onBlur(): void {
218
+ this.dispatchEvent(new Event('blur'))
219
+ }
220
+
221
+ // Trigger this when user types in the input
222
+ protected onInput(): void {
223
+ this.dispatchEvent(new Event('input'))
224
+ }
225
+
211
226
  // Trigger this when you want to set the value of the input out to the form
212
- protected onInput(value: string | string[]): void {
227
+ protected onChange(value: string | string[]): void {
213
228
  if (!this.touched) {
214
229
  this.touched = true
215
230
  value && this.setFormValue(value)
@@ -234,9 +249,6 @@ export class PktInputElement extends PktElement {
234
249
  this.manageValidity(this.inputRef2.value)
235
250
  }
236
251
 
237
- // This should be moved to a separate trigger for text inputs
238
- this.dispatchEvent(new Event('input'))
239
-
240
252
  // Change events
241
253
  this.dispatchEvent(new Event('change'))
242
254
  this.dispatchEvent(