@oslokommune/punkt-elements 16.25.0 → 16.25.2

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 (66) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/{alert-BkzC5mVu.js → alert-B5Y841vH.js} +1 -1
  3. package/dist/{alert-D_45dWPn.cjs → alert-C8OpU_Un.cjs} +1 -1
  4. package/dist/button-Bqk9wjme.cjs +27 -0
  5. package/dist/{button-CR-KWhTT.js → button-CAZEaEW9.js} +14 -13
  6. package/dist/{combobox-D-DY7YcW.js → combobox-BuBvoK-N.js} +1 -1
  7. package/dist/{combobox-x4tBGP3F.cjs → combobox-DJITmrnM.cjs} +1 -1
  8. package/dist/components/header/header-service.d.ts +1 -0
  9. package/dist/components/header/header.d.ts +1 -0
  10. package/dist/components/header/types.d.ts +2 -0
  11. package/dist/{consent-BFdURuBl.js → consent-CCesjQ_e.js} +1 -1
  12. package/dist/{consent-DVt6sMvB.cjs → consent-DkCihETp.cjs} +1 -1
  13. package/dist/{datepicker-Bs95HYGc.cjs → datepicker-ChEi_INm.cjs} +1 -1
  14. package/dist/{datepicker-DxkcKevq.js → datepicker-zOOhs9JK.js} +1 -1
  15. package/dist/{fileupload-bykWTtA6.js → fileupload-BBph8gH3.js} +2 -2
  16. package/dist/{fileupload-BLto9H17.cjs → fileupload-CGaJlMG9.cjs} +1 -1
  17. package/dist/{header-gOdqWZ-o.cjs → header-C6z1KhOR.cjs} +6 -5
  18. package/dist/{header-BdxslVug.js → header-C8dCoJpr.js} +14 -5
  19. package/dist/{input-wrapper-B6WowlWG.js → input-wrapper-C93MmOIg.js} +1 -1
  20. package/dist/{input-wrapper-Dhkt20WW.cjs → input-wrapper-CvtU-Ksb.cjs} +1 -1
  21. package/dist/{loader-gKdQpOOQ.js → loader-B3ToraVk.js} +8 -7
  22. package/dist/loader-CLf_Phfg.cjs +16 -0
  23. package/dist/pkt-alert.cjs +1 -1
  24. package/dist/pkt-alert.js +1 -1
  25. package/dist/pkt-button.cjs +1 -1
  26. package/dist/pkt-button.js +1 -1
  27. package/dist/pkt-combobox.cjs +1 -1
  28. package/dist/pkt-combobox.js +1 -1
  29. package/dist/pkt-consent.cjs +1 -1
  30. package/dist/pkt-consent.js +1 -1
  31. package/dist/pkt-datepicker.cjs +1 -1
  32. package/dist/pkt-datepicker.js +1 -1
  33. package/dist/pkt-fileupload.cjs +1 -1
  34. package/dist/pkt-fileupload.js +1 -1
  35. package/dist/pkt-header.cjs +1 -1
  36. package/dist/pkt-header.js +1 -1
  37. package/dist/pkt-index.cjs +1 -1
  38. package/dist/pkt-index.js +13 -13
  39. package/dist/pkt-input-wrapper.cjs +1 -1
  40. package/dist/pkt-input-wrapper.js +1 -1
  41. package/dist/pkt-loader.cjs +1 -1
  42. package/dist/pkt-loader.js +1 -1
  43. package/dist/pkt-select.cjs +1 -1
  44. package/dist/pkt-select.js +1 -1
  45. package/dist/pkt-textarea.cjs +1 -1
  46. package/dist/pkt-textarea.js +1 -1
  47. package/dist/pkt-textinput.cjs +1 -1
  48. package/dist/pkt-textinput.js +1 -1
  49. package/dist/pkt-timepicker.cjs +1 -1
  50. package/dist/pkt-timepicker.js +1 -1
  51. package/dist/{select-BIgFPp42.js → select-Dz3YiN7b.js} +1 -1
  52. package/dist/{select-DzZHv6Bz.cjs → select-z3hBSk02.cjs} +1 -1
  53. package/dist/{textarea-qHtkhelz.js → textarea-BxBfLk3N.js} +1 -1
  54. package/dist/{textarea-M_S9WK7s.cjs → textarea-rHlURXh5.cjs} +1 -1
  55. package/dist/{textinput-CZrBM-Fj.js → textinput-Bs8DwHwR.js} +1 -1
  56. package/dist/{textinput-C_6kvf87.cjs → textinput-DSYABvB6.cjs} +1 -1
  57. package/dist/{timepicker-O0iCeJyW.js → timepicker-Cb9pxkJa.js} +1 -1
  58. package/dist/{timepicker-WiYLAncb.cjs → timepicker-DVisPbGX.cjs} +1 -1
  59. package/package.json +2 -2
  60. package/src/components/button/button.ts +7 -3
  61. package/src/components/header/header-service.ts +9 -2
  62. package/src/components/header/header.ts +2 -0
  63. package/src/components/header/types.ts +2 -0
  64. package/src/components/loader/loader.ts +7 -3
  65. package/dist/button-Dwv11n6R.cjs +0 -27
  66. package/dist/loader-Uap9qDsV.cjs +0 -16
@@ -6,9 +6,12 @@ import { slotContent } from '@/directives/slot-content'
6
6
  import { TPktSize } from '@/types/size'
7
7
  import '@/components/icon'
8
8
 
9
+ const defaultAnimationPath = 'https://punkt-cdn.oslo.kommune.no/latest/animations/'
10
+
9
11
  // Allow global override of animation assets path
10
- window.pktAnimationPath =
11
- window.pktAnimationPath || 'https://punkt-cdn.oslo.kommune.no/latest/animations/'
12
+ if (typeof window !== 'undefined') {
13
+ window.pktAnimationPath = window.pktAnimationPath || defaultAnimationPath
14
+ }
12
15
 
13
16
  export type TPktLoaderVariant = 'blue' | 'rainbow' | 'shapes'
14
17
 
@@ -54,7 +57,8 @@ export class PktLoader extends PktElementWithSlot implements IPktLoader {
54
57
  @property({ type: String }) message: string | null = null
55
58
  @property({ type: String }) size: TPktSize = 'medium'
56
59
  @property({ type: String }) variant: TPktLoaderVariant = 'shapes'
57
- @property({ type: String }) loadingAnimationPath: string | undefined = window.pktAnimationPath
60
+ @property({ type: String }) loadingAnimationPath: string | undefined =
61
+ typeof window !== 'undefined' ? window.pktAnimationPath : defaultAnimationPath
58
62
 
59
63
  @state() private _shouldDisplayLoader: boolean = false
60
64
 
@@ -1,27 +0,0 @@
1
- const e=require(`./element-CXAtr6Gu.cjs`),t=require(`./class-map-B8Ja0q7n.cjs`),n=require(`./element-with-slot-Cmxb9h4H.cjs`);require(`./icon-Dw6I0HDV.cjs`);const r=require(`./if-defined-LTjAScFG.cjs`);window.pktAnimationPath=window.pktAnimationPath||`https://punkt-cdn.oslo.kommune.no/latest/animations/`;var i=class extends n.t{constructor(...e){super(...e),this.iconName=`user`,this.secondIconName=`user`,this.mode=`light`,this.size=`medium`,this.fullWidth=!1,this.fullWidthOnMobile=!1,this.skin=`primary`,this.variant=`label-only`,this.state=`normal`,this.type=`button`,this.form=void 0,this.isLoading=!1,this.disabled=!1,this.loadingAnimationPath=window.pktAnimationPath}connectedCallback(){super.connectedCallback(),this.addEventListener(`click`,e=>{(this.disabled||this.hasAttribute(`disabled`)||this.isLoading)&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.addEventListener(`keydown`,e=>{(this.disabled||this.hasAttribute(`disabled`)||this.isLoading)&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopImmediatePropagation())},!0)}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e===`disabled`&&n===`false`&&(this.disabled=!1),(e===`isloading`||e===`isLoading`)&&n===`false`&&(this.isLoading=!1)}firstUpdated(e){super.firstUpdated(e),this.disabled===`false`&&(this.disabled=!1),this.isLoading===`false`&&(this.isLoading=!1)}render(){let i=this.form??this.getAttribute(`form`)??void 0;return e.p`
2
- <button
3
- class=${t.t({"pkt-btn":!0,[`pkt-btn--${this.size}`]:!!this.size,[`pkt-btn--${this.skin}`]:!!this.skin,[`pkt-btn--${this.variant}`]:!!this.variant,[`pkt-btn--${this.color}`]:!!this.color,[`pkt-btn--${this.state}`]:!!this.state,"pkt-btn--full":!!this.fullWidth,"pkt-btn--full-small":!!this.fullWidthOnMobile,"pkt-btn--disabled":!!this.disabled,"pkt-btn--isLoading":!!this.isLoading})}
4
- type=${this.type}
5
- ?disabled=${!!this.disabled}
6
- aria-busy=${r.t(this.isLoading?`true`:void 0)}
7
- aria-disabled=${r.t(this.disabled||this.isLoading?`true`:void 0)}
8
- form=${r.t(i)}
9
- >
10
- ${this.isLoading?e.p`<pkt-icon
11
- class="pkt-btn__icon pkt-btn__spinner"
12
- name="spinner-blue"
13
- path=${r.t(this.loadingAnimationPath)}
14
- ></pkt-icon>`:e.d}
15
- ${this.variant===`label-only`?e.d:e.p`<pkt-icon
16
- class="pkt-btn__icon pkt-icon"
17
- name=${this.iconName}
18
- path=${r.t(this.iconPath)}
19
- ></pkt-icon>`}
20
- <span class="pkt-btn__text">${n.n(this)}</span>
21
- ${this.variant===`icons-right-and-left`?e.p`<pkt-icon
22
- class="pkt-btn__icon"
23
- name=${this.secondIconName}
24
- path=${r.t(this.secondIconPath)}
25
- ></pkt-icon>`:e.d}
26
- </button>
27
- `}};e.n([e.o({type:String})],i.prototype,`iconName`,void 0),e.n([e.o({type:String})],i.prototype,`secondIconName`,void 0),e.n([e.o({type:String})],i.prototype,`iconPath`,void 0),e.n([e.o({type:String})],i.prototype,`secondIconPath`,void 0),e.n([e.o({type:String})],i.prototype,`mode`,void 0),e.n([e.o({type:String})],i.prototype,`size`,void 0),e.n([e.o({type:Boolean,attribute:`full-width`})],i.prototype,`fullWidth`,void 0),e.n([e.o({type:Boolean,attribute:`full-width-on-mobile`})],i.prototype,`fullWidthOnMobile`,void 0),e.n([e.o({type:String})],i.prototype,`color`,void 0),e.n([e.o({type:String})],i.prototype,`skin`,void 0),e.n([e.o({type:String})],i.prototype,`variant`,void 0),e.n([e.o({type:String,reflect:!0})],i.prototype,`state`,void 0),e.n([e.o({type:String,reflect:!0})],i.prototype,`type`,void 0),e.n([e.o({type:String})],i.prototype,`form`,void 0),e.n([e.o({type:Boolean,reflect:!0})],i.prototype,`isLoading`,void 0),e.n([e.o({type:Boolean,reflect:!0})],i.prototype,`disabled`,void 0),e.n([e.o({type:String})],i.prototype,`loadingAnimationPath`,void 0);try{e.s(`pkt-button`)(i)}catch{console.warn(`Forsøker å definere <pkt-button>, men den er allerede definert`)}var a=i;Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return a}});
@@ -1,16 +0,0 @@
1
- const e=require(`./element-CXAtr6Gu.cjs`),t=require(`./class-map-B8Ja0q7n.cjs`),n=require(`./element-with-slot-Cmxb9h4H.cjs`);require(`./icon-Dw6I0HDV.cjs`),window.pktAnimationPath=window.pktAnimationPath||`https://punkt-cdn.oslo.kommune.no/latest/animations/`;var r=class extends n.t{constructor(...e){super(...e),this.delay=0,this.inline=!1,this.isLoading=!0,this.message=null,this.size=`medium`,this.variant=`shapes`,this.loadingAnimationPath=window.pktAnimationPath,this._shouldDisplayLoader=!1}connectedCallback(){super.connectedCallback(),this._shouldDisplayLoader=this.delay===0,this.delay>0&&this.setupLoader()}updated(e){e.has(`delay`)&&this.setupLoader()}render(){let r=t.t({"pkt-loader":!0,[`pkt-loader--${this.inline?`inline`:`box`}`]:!0,[`pkt-loader--${this.size}`]:!0}),i=t.t({"pkt-contents":!0,"pkt-hide":this.isLoading});return e.p`<div
2
- role="status"
3
- aria-live="polite"
4
- aria-busy=${this.isLoading?`true`:`false`}
5
- class=${r}
6
- >
7
- ${this.isLoading&&this._shouldDisplayLoader?e.p`<div class="pkt-loader__spinner">
8
- <pkt-icon
9
- name=${this.getVariant(this.variant)}
10
- path=${this.loadingAnimationPath}
11
- class="pkt-loader__svg pkt-loader__${this.variant}"
12
- ></pkt-icon>
13
- ${this.message&&e.p`<p>${this.message}</p>`}
14
- </div>`:e.d}
15
- <div class=${i}>${n.n(this)}</div>
16
- </div>`}getVariant(e){switch(e){case`blue`:return`spinner-blue`;case`rainbow`:return`spinner`;default:return`loader`}}setupLoader(){this.delay>0&&(this._shouldDisplayLoader=!1,setTimeout(()=>{this._shouldDisplayLoader=!0,this.requestUpdate()},this.delay))}};e.n([e.o({type:Number})],r.prototype,`delay`,void 0),e.n([e.o({type:Boolean})],r.prototype,`inline`,void 0),e.n([e.o({type:Boolean})],r.prototype,`isLoading`,void 0),e.n([e.o({type:String})],r.prototype,`message`,void 0),e.n([e.o({type:String})],r.prototype,`size`,void 0),e.n([e.o({type:String})],r.prototype,`variant`,void 0),e.n([e.o({type:String})],r.prototype,`loadingAnimationPath`,void 0),e.n([e.a()],r.prototype,`_shouldDisplayLoader`,void 0);try{e.s(`pkt-loader`)(r)}catch{console.warn(`Forsøker å definere <pkt-loader>, men den er allerede definert`)}var i=r;Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return i}});