@oslokommune/punkt-elements 12.3.8 → 12.3.10

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-j1NPDnPL.cjs → class-map-CFiVus5w.cjs} +1 -1
  2. package/dist/{class-map-Cme3zDHv.js → class-map-DnAEF9tj.js} +1 -1
  3. package/dist/{index-D1du6BqK.js → index-BAKMcM4b.js} +30 -16
  4. package/dist/{index-D16hQiYU.js → index-BoxUN9GL.js} +72 -58
  5. package/dist/{index-xZNrDhoQ.cjs → index-C92NwPcv.cjs} +5 -5
  6. package/dist/{index-CQrIaUIc.js → index-CsKoXqeT.js} +1 -1
  7. package/dist/{index--Z_thODp.cjs → index-DZ0cjZdG.cjs} +1 -1
  8. package/dist/{index-BoJqccWT.cjs → index-DZGlpxj6.cjs} +4 -4
  9. package/dist/index.d.ts +4 -1
  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 +42 -33
  19. package/dist/pkt-datepicker.js +163 -137
  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-CC5SNvNX.js → ref-DzpbHCb_.js} +1 -1
  35. package/dist/{ref-B5fRDLdm.cjs → ref-G2cIenWo.cjs} +1 -1
  36. package/package.json +3 -3
  37. package/src/components/calendar/index.ts +18 -0
  38. package/src/components/datepicker/index.ts +64 -30
  39. package/src/components/element/index.ts +37 -0
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BoJqccWT.cjs");exports.PktElement=e.PktElement;exports.PktInputElement=e.PktInputElement;
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,4 +1,4 @@
1
- import { P as a, a as m } from "./index-D16hQiYU.js";
1
+ import { P as a, a as m } from "./index-BoxUN9GL.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-BoJqccWT.cjs");require("./directive-19_ixLKS.cjs");const e=require("./index--Z_thODp.cjs");Object.defineProperty(exports,"PktIcon",{enumerable:!0,get:()=>e.PktIcon});
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});
package/dist/pkt-icon.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./index-D16hQiYU.js";
1
+ import "./index-BoxUN9GL.js";
2
2
  import "./directive-DA0-wdk7.js";
3
- import { P as p } from "./index-CQrIaUIc.js";
3
+ import { P as p } from "./index-CsKoXqeT.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-xZNrDhoQ.cjs"),t=require("./pkt-card.cjs"),r=require("./pkt-component-template.cjs"),n=require("./pkt-datepicker.cjs"),o=require("./index--Z_thODp.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-C92NwPcv.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});
package/dist/pkt-index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { P as t } from "./index-D1du6BqK.js";
1
+ import { P as t } from "./index-BAKMcM4b.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-CQrIaUIc.js";
5
+ import { P as f } from "./index-CsKoXqeT.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-BoJqccWT.cjs"),f=require("./ref-B5fRDLdm.cjs"),c=require("./index--Z_thODp.cjs"),u=require("./class-map-j1NPDnPL.cjs"),$=require("./directive-19_ixLKS.cjs");/**
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");/**
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-D16hQiYU.js";
2
- import { i as _, P as D, K as I } from "./ref-CC5SNvNX.js";
3
- import { a as f } from "./index-CQrIaUIc.js";
4
- import { R as c } from "./class-map-Cme3zDHv.js";
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";
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-BoJqccWT.cjs"),c=require("./ref-B5fRDLdm.cjs"),k=require("./class-map-j1NPDnPL.cjs"),h=require("./directive-19_ixLKS.cjs");require("./index--Z_thODp.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-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
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-D16hQiYU.js";
2
- import { i as m, P as d, K as u } from "./ref-CC5SNvNX.js";
3
- import { R as P } from "./class-map-Cme3zDHv.js";
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";
4
4
  import { t as y } from "./directive-DA0-wdk7.js";
5
- import "./index-CQrIaUIc.js";
5
+ import "./index-CsKoXqeT.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-BoJqccWT.cjs"),c=require("./ref-B5fRDLdm.cjs"),p=require("./class-map-j1NPDnPL.cjs"),b=require("./directive-19_ixLKS.cjs");require("./index--Z_thODp.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-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)}>
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-D16hQiYU.js";
2
- import { i as b, P as f, K as k } from "./ref-CC5SNvNX.js";
3
- import { R as u } from "./class-map-Cme3zDHv.js";
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";
4
4
  import { t as y } from "./directive-DA0-wdk7.js";
5
- import "./index-CQrIaUIc.js";
5
+ import "./index-CsKoXqeT.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-j1NPDnPL.cjs"),g=require("./directive-19_ixLKS.cjs"),t=require("./index-BoJqccWT.cjs"),o=require("./ref-B5fRDLdm.cjs");require("./index--Z_thODp.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-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`
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-Cme3zDHv.js";
1
+ import { R as h } from "./class-map-DnAEF9tj.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-D16hQiYU.js";
4
- import { i as m, P as b, K as f } from "./ref-CC5SNvNX.js";
5
- import "./index-CQrIaUIc.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";
6
6
  const S = "pkt-tag", _ = {
7
7
  closeTag: {
8
8
  type: "boolean",
@@ -1,4 +1,4 @@
1
- import { s as p, D as _ } from "./index-D16hQiYU.js";
1
+ import { s as p, D as _ } from "./index-BoxUN9GL.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) {
@@ -1,4 +1,4 @@
1
- "use strict";const a=require("./index-BoJqccWT.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-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}}/**
2
2
  * @license
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-elements",
3
- "version": "12.3.8",
3
+ "version": "12.3.10",
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": "be4a7ca19fb67b079fe05d9901f891a10ebd02d4"
58
+ "gitHead": "aa45340f085d79e1a70decfcce336c99c361791a"
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 (
@@ -134,14 +140,7 @@ export class PktDatepicker extends PktInputElement {
134
140
 
135
141
  attributeChangedCallback(name: string, _old: string | null, value: string | null): void {
136
142
  if (name === 'value') {
137
- if (this.value === '' || this.value.length === 0 || typeof this.value === 'undefined') {
138
- this._value = []
139
- } else if (this.value.length && this._value.length === 0) {
140
- if (!Array.isArray(this.value) && this.value.includes(',')) {
141
- this.value = this.value.split(',')
142
- }
143
- this._value = !Array.isArray(this.value) ? this.value.split(',') : this.value
144
- }
143
+ this.valueChanged(this.value, _old)
145
144
  }
146
145
 
147
146
  if (name === 'excludedates' && typeof this.excludedates === 'string') {
@@ -161,13 +160,8 @@ export class PktDatepicker extends PktInputElement {
161
160
  updated(changedProperties: PropertyValues): void {
162
161
  super.updated(changedProperties)
163
162
  if (changedProperties.has('value')) {
164
- if (this.range && this._value.length === 1) {
165
- return
166
- }
167
- if (changedProperties.get('value')?.toString() === this.value.toString()) {
168
- return
169
- }
170
- this.onInput(this.value)
163
+ if (this.range && this._value.length === 1) return
164
+ this.valueChanged(this.value, changedProperties.get('value'))
171
165
  }
172
166
  }
173
167
 
@@ -238,9 +232,9 @@ export class PktDatepicker extends PktInputElement {
238
232
  return html`
239
233
  <input
240
234
  class="${classMap(this.inputClasses)}"
241
- type="date"
235
+ .type=${this.inputType}
242
236
  id="${this.id}-input"
243
- value=${this.value}
237
+ .value=${this._value[0] ?? ''}
244
238
  min=${this.min}
245
239
  max=${this.max}
246
240
  @click=${(e: MouseEvent) => {
@@ -248,10 +242,19 @@ export class PktDatepicker extends PktInputElement {
248
242
  this.showCalendar()
249
243
  }}
250
244
  ?disabled=${this.disabled}
245
+ @keydown=${(e: KeyboardEvent) => {
246
+ if (e.key === ',' || e.key === 'Enter') {
247
+ this.inputRef.value?.blur()
248
+ }
249
+ }}
250
+ @focus=${() => {
251
+ if (this.isMobileSafari) {
252
+ this.showCalendar()
253
+ }
254
+ }}
251
255
  @blur=${(e: Event) => {
252
256
  this.manageValidity(e.target as HTMLInputElement)
253
257
  this.value = (e.target as HTMLInputElement).value
254
- this._value = this.massageDates((e.target as HTMLInputElement).value.split(','))
255
258
  }}
256
259
  @change=${(e: Event) => {
257
260
  e.stopImmediatePropagation()
@@ -266,9 +269,9 @@ export class PktDatepicker extends PktInputElement {
266
269
  <div class="pkt-input-prefix">Fra</div>
267
270
  <input
268
271
  class=${classMap(this.inputClasses)}
269
- type="date"
272
+ .type=${this.inputType}
270
273
  id="${this.id}-input"
271
- value=${this._value[0] ?? ''}
274
+ .value=${this._value[0] ?? ''}
272
275
  min=${this.min}
273
276
  max=${this.max}
274
277
  @click=${(e: MouseEvent) => {
@@ -276,6 +279,16 @@ export class PktDatepicker extends PktInputElement {
276
279
  this.showCalendar()
277
280
  }}
278
281
  ?disabled=${this.disabled}
282
+ @keydown=${(e: KeyboardEvent) => {
283
+ if (e.key === ',' || e.key === 'Enter') {
284
+ this.inputRef.value?.blur()
285
+ }
286
+ }}
287
+ @focus=${() => {
288
+ if (this.isMobileSafari) {
289
+ this.showCalendar()
290
+ }
291
+ }}
279
292
  @blur=${(e: Event) => {
280
293
  if ((e.target as HTMLInputElement).value) {
281
294
  this.manageValidity(e.target as HTMLInputElement)
@@ -285,6 +298,8 @@ export class PktDatepicker extends PktInputElement {
285
298
  this.calRef?.value?.handleDateSelect(date)
286
299
  }
287
300
  }
301
+ } else if (this._value[0]) {
302
+ this.clearInputValue()
288
303
  }
289
304
  }}
290
305
  @change=${(e: Event) => {
@@ -295,9 +310,9 @@ export class PktDatepicker extends PktInputElement {
295
310
  <div class="pkt-input-prefix">Til</div>
296
311
  <input
297
312
  class=${classMap(this.inputClasses)}
298
- type="date"
313
+ .type=${this.inputType}
299
314
  id="${this.id}-to"
300
- value=${this._value[1] ?? ''}
315
+ .value=${this._value[1] ?? ''}
301
316
  min=${this.min}
302
317
  max=${this.max}
303
318
  @click=${(e: MouseEvent) => {
@@ -305,6 +320,16 @@ export class PktDatepicker extends PktInputElement {
305
320
  this.showCalendar()
306
321
  }}
307
322
  ?disabled=${this.disabled}
323
+ @keydown=${(e: KeyboardEvent) => {
324
+ if (e.key === ',' || e.key === 'Enter') {
325
+ this.inputRefTo.value?.blur()
326
+ }
327
+ }}
328
+ @focus=${() => {
329
+ if (this.isMobileSafari) {
330
+ this.showCalendar()
331
+ }
332
+ }}
308
333
  @blur=${(e: Event) => {
309
334
  if ((e.target as HTMLInputElement).value) {
310
335
  this.manageValidity(e.target as HTMLInputElement)
@@ -342,7 +367,7 @@ export class PktDatepicker extends PktInputElement {
342
367
  return html`
343
368
  <input
344
369
  class=${classMap(this.inputClasses)}
345
- type="date"
370
+ .type=${this.inputType}
346
371
  id="${this.id}-input"
347
372
  min=${this.min}
348
373
  max=${this.max}
@@ -353,6 +378,11 @@ export class PktDatepicker extends PktInputElement {
353
378
  @blur=${(e: Event) => {
354
379
  this.addToSelected(e)
355
380
  }}
381
+ @focus=${() => {
382
+ if (this.isMobileSafari) {
383
+ this.showCalendar()
384
+ }
385
+ }}
356
386
  @keydown=${(e: KeyboardEvent) => {
357
387
  if (e.key === ',' || e.key === 'Enter') {
358
388
  e.preventDefault()
@@ -411,12 +441,7 @@ export class PktDatepicker extends PktInputElement {
411
441
  .excludeweekdays=${this.excludeweekdays}
412
442
  .currentmonth=${new Date(this.currentmonth)}
413
443
  @date-selected=${(e: CustomEvent) => {
414
- this.value =
415
- !this.multiple && !this.range
416
- ? !Array.isArray(e.detail)
417
- ? e.detail.split(',')[0]
418
- : e.detail[0]
419
- : e.detail
444
+ this.value = !this.multiple && !this.range ? e.detail[0] : e.detail
420
445
  this._value = e.detail
421
446
  if (this.inputRef.value) {
422
447
  if (this.range && this.inputRefTo.value) {
@@ -446,6 +471,7 @@ export class PktDatepicker extends PktInputElement {
446
471
  ?required=${this.required}
447
472
  ?optionalTag=${this.optionalTag}
448
473
  ?requiredTag=${this.requiredTag}
474
+ ?focusPreventDefault=${true}
449
475
  .optionalText=${this.optionalText}
450
476
  .requiredText=${this.requiredText}
451
477
  .errorMessage=${this.errorMessage}
@@ -465,6 +491,7 @@ export class PktDatepicker extends PktInputElement {
465
491
  <button
466
492
  class="${classMap(this.buttonClasses)}"
467
493
  @click=${this.toggleCalendar}
494
+ ?disabled=${this.disabled}
468
495
  ${ref(this.btnRef)}
469
496
  >
470
497
  <pkt-icon name="calendar"></pkt-icon>
@@ -532,14 +559,21 @@ export class PktDatepicker extends PktInputElement {
532
559
  this.calendarOpen = true
533
560
  await sleep(20)
534
561
  this.handleCalendarPosition()
562
+ if (this.isMobileSafari) {
563
+ this.calRef.value?.focusOnCurrentDate()
564
+ }
535
565
  }
536
566
 
537
567
  public hideCalendar() {
538
568
  this.calendarOpen = false
539
569
  }
540
570
 
541
- public toggleCalendar(e: Event) {
571
+ public async toggleCalendar(e: Event) {
542
572
  e.preventDefault()
543
573
  this.calendarOpen ? this.hideCalendar() : this.showCalendar()
574
+ await sleep(20)
575
+ if (this.isMobileSafari) {
576
+ this.calRef.value?.focusOnCurrentDate()
577
+ }
544
578
  }
545
579
  }
@@ -171,6 +171,43 @@ export class PktInputElement extends PktElement {
171
171
  }
172
172
  }
173
173
 
174
+ protected valueChanged(value: string | string[] | null, _old: string | string[] | null): void {
175
+ if (typeof value === 'string') {
176
+ if ((this.multiple || this.range) && value.includes(',')) {
177
+ value = value.split(',')
178
+ }
179
+ this.value = value
180
+ this._value = Array.isArray(value) ? value : [value]
181
+ } else if (Array.isArray(value)) {
182
+ this.value = value
183
+ this._value = value
184
+ } else {
185
+ this.value = ''
186
+ this._value = []
187
+ }
188
+ if ((!this.value || this.value.length === 0) && _old && _old.length !== 0) {
189
+ this.clearInputValue()
190
+ } else if (this.value && this.value.toString() !== _old?.toString()) {
191
+ this.onInput(this.value)
192
+ }
193
+ this.updateComplete.then(() => this.requestUpdate())
194
+ }
195
+
196
+ // When input goes from content to no content
197
+ protected clearInputValue(): void {
198
+ const value = this.multiple || this.range ? [] : ''
199
+ this.value = value
200
+ this.internals.setFormValue(value)
201
+ this.dispatchEvent(new Event('change'))
202
+ this.dispatchEvent(
203
+ new CustomEvent('value-change', {
204
+ detail: value,
205
+ bubbles: true,
206
+ composed: true,
207
+ }),
208
+ )
209
+ }
210
+
174
211
  // Trigger this when you want to set the value of the input out to the form
175
212
  protected onInput(value: string | string[]): void {
176
213
  if (!this.touched) {