@oslokommune/punkt-elements 12.32.0 → 12.32.8

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 (169) hide show
  1. package/README.md +2 -1
  2. package/dist/alert-C2WKLFow.cjs +27 -0
  3. package/dist/alert-XGjypFHe.js +115 -0
  4. package/dist/alert.d.ts +14 -14
  5. package/dist/{backlink-DdNgqA56.js → backlink-BX8HBhw5.js} +2 -2
  6. package/dist/{backlink-Q2HTG9jm.cjs → backlink-NJdC0FAO.cjs} +1 -1
  7. package/dist/backlink.d.ts +14 -14
  8. package/dist/{button-rArIL0-j.js → button-Bn8jVB0f.js} +33 -33
  9. package/dist/{button-BPyZeW73.cjs → button-Bpbh8A_a.cjs} +2 -2
  10. package/dist/button.d.ts +14 -14
  11. package/dist/{calendar-1ryAEdX3.js → calendar-BNHDEEwT.js} +20 -84
  12. package/dist/{calendar-2DqPLXdD.cjs → calendar-Ds13AKr5.cjs} +4 -4
  13. package/dist/calendar.d.ts +14 -14
  14. package/dist/card-CEv3DL-o.js +94 -0
  15. package/dist/card-c5EEPaNh.cjs +28 -0
  16. package/dist/card.d.ts +14 -14
  17. package/dist/{checkbox-BnDG6wIO.cjs → checkbox-DDBBDM85.cjs} +1 -1
  18. package/dist/{checkbox-Ceui2TLp.js → checkbox-DoMYxp83.js} +9 -9
  19. package/dist/checkbox.d.ts +14 -14
  20. package/dist/{class-map-ChuDQU5C.js → class-map-D4tSZX70.js} +2 -2
  21. package/dist/{class-map-D4rXyUxT.cjs → class-map-DvBKxTiW.cjs} +1 -1
  22. package/dist/combobox-BflWORVa.cjs +115 -0
  23. package/dist/combobox-l7LmWQYu.js +491 -0
  24. package/dist/combobox.d.ts +14 -14
  25. package/dist/datepicker-Bkiyh5P5.cjs +153 -0
  26. package/dist/datepicker-nWd89NwP.js +449 -0
  27. package/dist/datepicker.d.ts +14 -14
  28. package/dist/directive-C7oCP5Bh.cjs +5 -0
  29. package/dist/directive-helpers-BmXIK-1b.js +45 -0
  30. package/dist/directive-helpers-donnvcEO.cjs +5 -0
  31. package/dist/{directive-B76A7YXI.js → directive-oAbCiebi.js} +4 -4
  32. package/dist/element-DJpGVXjq.cjs +238 -0
  33. package/dist/{element-G8JoS0Lj.js → element-DiqKrDty.js} +8845 -8847
  34. package/dist/{helptext-Y4cSgTkd.js → helptext-DfRusn5R.js} +9 -9
  35. package/dist/{helptext-B4Uc-d56.cjs → helptext-aHD9icur.cjs} +1 -1
  36. package/dist/helptext.d.ts +14 -14
  37. package/dist/{icon-BJnwW0eh.js → icon-BdY52BIt.js} +2 -2
  38. package/dist/{icon-BTUCDPN5.cjs → icon-UtDKPH3R.cjs} +1 -1
  39. package/dist/icon.d.ts +14 -14
  40. package/dist/{if-defined-C1ZDVzYn.cjs → if-defined-CoBDkDGb.cjs} +1 -1
  41. package/dist/{if-defined-rCqT8Od1.js → if-defined-DeANa4n5.js} +1 -1
  42. package/dist/index.d.ts +16 -15
  43. package/dist/{input-element-DM2uSYaW.js → input-element-C4mmTk6h.js} +3 -3
  44. package/dist/{input-element-AhnBdCb8.cjs → input-element-VNai8bsq.cjs} +1 -1
  45. package/dist/input-wrapper-8iKEzDRZ.js +40 -0
  46. package/dist/{input-wrapper-BdZxmQyO.cjs → input-wrapper-DWOw7Yn-.cjs} +1 -1
  47. package/dist/input-wrapper-EoSAbU-U.cjs +1 -0
  48. package/dist/{input-wrapper-DQmYzhcy.js → input-wrapper-P_oEi6dk.js} +8 -8
  49. package/dist/input-wrapper.d.ts +14 -14
  50. package/dist/link-D9dJ6F-R.js +73 -0
  51. package/dist/link-DBxXqsnP.cjs +8 -0
  52. package/dist/link.d.ts +14 -14
  53. package/dist/{linkcard-DDD92XfD.cjs → linkcard-D5O1hR7N.cjs} +1 -1
  54. package/dist/{linkcard-CvqqyHVW.js → linkcard-DcEE9IVw.js} +4 -4
  55. package/dist/linkcard.d.ts +14 -14
  56. package/dist/{listbox-BTVnrHWv.cjs → listbox-CK1GmwCE.cjs} +1 -1
  57. package/dist/{listbox-DX-Euxdm.js → listbox-CfJWJDrc.js} +5 -5
  58. package/dist/listbox.d.ts +14 -14
  59. package/dist/{loader-BudoV0yd.js → loader-DZvOlXzI.js} +6 -6
  60. package/dist/{loader-Csq0Yd1k.cjs → loader-SDXJp58K.cjs} +1 -1
  61. package/dist/loader.d.ts +14 -14
  62. package/dist/messagebox-Ce5e1gga.js +79 -0
  63. package/dist/messagebox-D2_-WZQG.cjs +12 -0
  64. package/dist/messagebox.d.ts +14 -14
  65. package/dist/modal-CCtUsYKk.cjs +33 -0
  66. package/dist/{modal-DnYn2Rlg.js → modal-CdgIOp8Q.js} +51 -94
  67. package/dist/modal.d.ts +14 -14
  68. package/dist/pkt-alert.cjs +1 -1
  69. package/dist/pkt-alert.js +1 -1
  70. package/dist/pkt-backlink.cjs +1 -1
  71. package/dist/pkt-backlink.js +1 -1
  72. package/dist/pkt-button.cjs +1 -1
  73. package/dist/pkt-button.js +1 -1
  74. package/dist/pkt-calendar.cjs +1 -1
  75. package/dist/pkt-calendar.js +1 -1
  76. package/dist/pkt-card.cjs +1 -1
  77. package/dist/pkt-card.js +1 -1
  78. package/dist/pkt-checkbox.cjs +1 -1
  79. package/dist/pkt-checkbox.js +1 -1
  80. package/dist/pkt-combobox.cjs +1 -1
  81. package/dist/pkt-combobox.js +1 -1
  82. package/dist/pkt-datepicker.cjs +1 -1
  83. package/dist/pkt-datepicker.js +1 -1
  84. package/dist/pkt-helptext.cjs +1 -1
  85. package/dist/pkt-helptext.js +1 -1
  86. package/dist/pkt-icon.cjs +1 -1
  87. package/dist/pkt-icon.js +1 -1
  88. package/dist/pkt-index.cjs +1 -1
  89. package/dist/pkt-index.js +27 -27
  90. package/dist/pkt-input-wrapper.cjs +1 -1
  91. package/dist/pkt-input-wrapper.js +1 -1
  92. package/dist/pkt-link.cjs +1 -1
  93. package/dist/pkt-link.js +1 -1
  94. package/dist/pkt-linkcard.cjs +1 -1
  95. package/dist/pkt-linkcard.js +1 -1
  96. package/dist/pkt-listbox.cjs +1 -1
  97. package/dist/pkt-listbox.js +1 -1
  98. package/dist/pkt-loader.cjs +1 -1
  99. package/dist/pkt-loader.js +1 -1
  100. package/dist/pkt-messagebox.cjs +1 -1
  101. package/dist/pkt-messagebox.js +1 -1
  102. package/dist/pkt-modal.cjs +1 -1
  103. package/dist/pkt-modal.js +1 -1
  104. package/dist/{pkt-options-controller-CZplGTgu.js → pkt-options-controller-BkWE4pZe.js} +1 -1
  105. package/dist/{pkt-options-controller-BtU1zEtG.cjs → pkt-options-controller-TJ1apYGF.cjs} +1 -1
  106. package/dist/pkt-progressbar.cjs +1 -1
  107. package/dist/pkt-progressbar.js +2 -2
  108. package/dist/pkt-radiobutton.cjs +1 -1
  109. package/dist/pkt-radiobutton.js +1 -1
  110. package/dist/pkt-select.cjs +1 -1
  111. package/dist/pkt-select.js +1 -1
  112. package/dist/pkt-slot-controller-BtVLTZb7.js +79 -0
  113. package/dist/pkt-slot-controller-plQxXRvV.cjs +1 -0
  114. package/dist/pkt-tag.cjs +1 -1
  115. package/dist/pkt-tag.js +1 -1
  116. package/dist/pkt-textarea.cjs +1 -1
  117. package/dist/pkt-textarea.js +1 -1
  118. package/dist/pkt-textinput.cjs +1 -1
  119. package/dist/pkt-textinput.js +1 -1
  120. package/dist/{progressbar-czvExwTL.js → progressbar-DvFz9KBo.js} +6 -6
  121. package/dist/{progressbar-BW_icNId.cjs → progressbar-jASTnhti.cjs} +1 -1
  122. package/dist/progressbar.d.ts +14 -14
  123. package/dist/{radiobutton-BeSuCrbp.cjs → radiobutton-C-Xd5sSq.cjs} +1 -1
  124. package/dist/{radiobutton-DKo27Stm.js → radiobutton-D03aN4yn.js} +5 -5
  125. package/dist/radiobutton.d.ts +14 -14
  126. package/dist/{ref-cRTOoM4R.js → ref-B70YZNXm.js} +11 -11
  127. package/dist/{ref-DsoUUoPU.cjs → ref-CLqTsViF.cjs} +3 -3
  128. package/dist/{repeat-CArTw6-s.js → repeat-CNLpCTun.js} +3 -3
  129. package/dist/{repeat-kruY8poV.cjs → repeat-t2oms1o6.cjs} +1 -1
  130. package/dist/{select-DxHhPEgD.js → select-BLDaK5Rd.js} +8 -8
  131. package/dist/{select-lvFnhEVg.cjs → select-Dvds7MzS.cjs} +1 -1
  132. package/dist/select.d.ts +14 -14
  133. package/dist/{state-BILlRnrD.cjs → state-C4LdlTYO.cjs} +1 -1
  134. package/dist/{state-gfUuUqVg.js → state-CDwPbiQj.js} +1 -1
  135. package/dist/tag-C52KeBmR.cjs +18 -0
  136. package/dist/{tag-CWx1XsGR.js → tag-DoS5S2Bq.js} +28 -77
  137. package/dist/tag.d.ts +14 -14
  138. package/dist/{textarea-BNNDbxxO.js → textarea-C9EvdPGi.js} +11 -11
  139. package/dist/{textarea-CDsLbogK.cjs → textarea-DJvNBmEL.cjs} +1 -1
  140. package/dist/textarea.d.ts +14 -14
  141. package/dist/{textinput-C3C088Ki.cjs → textinput-Cg3ObBuw.cjs} +1 -1
  142. package/dist/{textinput-M8I4dfoP.js → textinput-CxRSSYaN.js} +20 -20
  143. package/dist/textinput.d.ts +14 -14
  144. package/package.json +4 -4
  145. package/src/components/button/button.ts +3 -2
  146. package/src/components/datepicker/datepicker.ts +4 -4
  147. package/src/components/tag/tag.ts +1 -1
  148. package/dist/alert-D5G5UJuo.cjs +0 -27
  149. package/dist/alert-gERpVuB7.js +0 -163
  150. package/dist/card-BbMBpvJt.js +0 -176
  151. package/dist/card-ZX09f_ka.cjs +0 -28
  152. package/dist/combobox-DH-YlbNh.cjs +0 -115
  153. package/dist/combobox-DbO6I0GT.js +0 -694
  154. package/dist/datepicker-8MOgQsyL.js +0 -611
  155. package/dist/datepicker-BRH-59Q9.cjs +0 -153
  156. package/dist/directive-C_VV3qwo.cjs +0 -5
  157. package/dist/directive-helpers-D7XIyCQ_.js +0 -45
  158. package/dist/directive-helpers-mGjAtADc.cjs +0 -5
  159. package/dist/element-BBo3JZk5.cjs +0 -238
  160. package/dist/input-wrapper-Bw9tARAD.js +0 -125
  161. package/dist/input-wrapper-jPnKsfEC.cjs +0 -1
  162. package/dist/link-C3lW3z8X.js +0 -109
  163. package/dist/link-DOVlsg2S.cjs +0 -8
  164. package/dist/messagebox-8GwnNqb0.cjs +0 -12
  165. package/dist/messagebox-D6uexEhg.js +0 -114
  166. package/dist/modal-CLixB4Dz.cjs +0 -33
  167. package/dist/pkt-slot-controller-CqNvEpFd.cjs +0 -1
  168. package/dist/pkt-slot-controller-D1DakVrU.js +0 -95
  169. package/dist/tag-DThwKsrg.cjs +0 -18
@@ -1,34 +1,34 @@
1
1
  export { }
2
2
 
3
3
 
4
- /**
5
- * Pkt Select is a wrapper for the native select element using the pkt-input-wrapper component.
6
- *
7
- * The component will prioritize options passed as a prop over options passed as children if both are provided.
8
- * This is to allow for dynamic options that might change in the case of both children/slot and props are provided.
9
- *
10
- * @slot (default) - Options to be rendered as children
11
- * @prop {TSelectOption[]} options - Options to be rendered as children
12
- *
13
- *
14
- */
15
4
  declare global {
16
5
  interface HTMLElementTagNameMap {
17
- 'pkt-select': PktSelect & HTMLSelectElement;
6
+ 'pkt-combobox': PktCombobox & HTMLSelectElement;
18
7
  }
19
8
  }
20
9
 
21
10
 
22
11
  declare global {
23
12
  interface HTMLElementTagNameMap {
24
- 'pkt-combobox': PktCombobox & HTMLSelectElement;
13
+ 'pkt-icon': PktIcon;
25
14
  }
26
15
  }
27
16
 
28
17
 
18
+ /**
19
+ * Pkt Select is a wrapper for the native select element using the pkt-input-wrapper component.
20
+ *
21
+ * The component will prioritize options passed as a prop over options passed as children if both are provided.
22
+ * This is to allow for dynamic options that might change in the case of both children/slot and props are provided.
23
+ *
24
+ * @slot (default) - Options to be rendered as children
25
+ * @prop {TSelectOption[]} options - Options to be rendered as children
26
+ *
27
+ *
28
+ */
29
29
  declare global {
30
30
  interface HTMLElementTagNameMap {
31
- 'pkt-icon': PktIcon;
31
+ 'pkt-select': PktSelect & HTMLSelectElement;
32
32
  }
33
33
  }
34
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-elements",
3
- "version": "12.32.0",
3
+ "version": "12.32.8",
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",
@@ -30,10 +30,10 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@oslokommune/punkt-assets": "^12.30.1",
33
- "@oslokommune/punkt-css": "^12.32.0",
33
+ "@oslokommune/punkt-css": "^12.32.8",
34
34
  "sass": "^1.78.0",
35
35
  "typescript": "^5.6.2",
36
- "vite": "^5.4.4",
36
+ "vite": "^5.4.18",
37
37
  "vite-plugin-dts": "^4.2.1",
38
38
  "vite-plugin-web-components-hmr": "^0.1.3"
39
39
  },
@@ -57,5 +57,5 @@
57
57
  "url": "https://github.com/oslokommune/punkt/issues"
58
58
  },
59
59
  "license": "MIT",
60
- "gitHead": "8d17b2b21d83b498b237d837747e753c64570285"
60
+ "gitHead": "2be6c93ef32da3656e4c88367201849e772d0017"
61
61
  }
@@ -47,6 +47,7 @@ export interface IPktButton {
47
47
  export class PktButton extends PktElement<IPktButton> implements IPktButton {
48
48
  static formAssociated = true
49
49
  private internals = this.attachInternals()
50
+ slotController: PktSlotController
50
51
  defaultSlot: Ref<HTMLElement> = createRef()
51
52
 
52
53
  constructor() {
@@ -94,7 +95,7 @@ export class PktButton extends PktElement<IPktButton> implements IPktButton {
94
95
  this.setAttribute('tabindex', '0')
95
96
  }
96
97
  if (this.getAttribute('aria-disabled') !== 'false') {
97
- this.setAttribute('aria-disabled', 'false')
98
+ this.removeAttribute('aria-disabled')
98
99
  }
99
100
  }
100
101
  if (this.isLoading) {
@@ -114,7 +115,7 @@ export class PktButton extends PktElement<IPktButton> implements IPktButton {
114
115
 
115
116
  render() {
116
117
  return html`
117
- <div class="pkt-btn__element-content">
118
+ <div class="pkt-contents">
118
119
  ${this.isLoading
119
120
  ? html`<pkt-icon
120
121
  class="pkt-btn__icon pkt-btn__spinner"
@@ -91,10 +91,10 @@ export class PktDatepicker extends PktInputElement {
91
91
  async connectedCallback() {
92
92
  super.connectedCallback()
93
93
 
94
- this.isMobileSafari =
95
- /iP(ad|od|hone)/i.test(window.navigator.userAgent) &&
96
- !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/)
97
- this.inputType = this.isMobileSafari ? 'text' : 'date'
94
+ const ua = navigator.userAgent
95
+ const isIOS = /iP(hone|od|ad)/.test(ua)
96
+
97
+ this.inputType = isIOS ? 'text' : 'date'
98
98
 
99
99
  document &&
100
100
  document.body.addEventListener('click', (e: MouseEvent) => {
@@ -36,7 +36,7 @@ export interface IPktTag {
36
36
  }
37
37
 
38
38
  @customElement('pkt-tag')
39
- export class PktTag extends PktElement implements IPktTag {
39
+ export class PktTag extends PktElement<IPktTag> implements IPktTag {
40
40
  slotController: PktSlotController
41
41
  defaultSlot: Ref<HTMLElement> = createRef()
42
42
 
@@ -1,27 +0,0 @@
1
- "use strict";const d=require("./class-map-D4rXyUxT.cjs"),e=require("./element-BBo3JZk5.cjs"),k=require("./state-BILlRnrD.cjs"),u=require("./pkt-slot-controller-CqNvEpFd.cjs"),c=require("./ref-DsoUUoPU.cjs"),h=require("./classutils-BwNK82ZQ.cjs");require("./icon-BTUCDPN5.cjs");const v="pkt-alert",f=!0,m={onClose:{description:"React: Klikk-event for 'Lukk'-knappen"},close:{description:"Vue: Klikk-event for 'Lukk'-knappen"}},b={title:{name:"Tittel",description:"Tittelen som vises øverst i på meldingen",type:"string"},skin:{name:"Utseende",description:"Hvordan type melding er dette?",type:["info","success","warning","error"],default:"info"},date:{name:"Sist oppdatert",description:"Dato som vises nederst i på meldingen",type:"string"},ariaLive:{name:"aria-live",description:"Hvordan skal skjermleseren lese opp meldingen?",type:["off","polite","assertive"],default:"polite"},compact:{name:"Kompakt",description:"Gjør meldingen mindre",type:"boolean",default:!1},closeAlert:{name:"Vis 'Lukk'-knapp",description:"Viser 'Lukk'-knappen",type:"boolean",default:!1}},y={default:{description:"Innholdet i meldingen"}},a={name:v,"css-class":"pkt-alert","dark-mode":!0,isElement:f,events:m,props:b,slots:y};var _=Object.defineProperty,C=Object.getOwnPropertyDescriptor,s=(n,t,r,i)=>{for(var l=i>1?void 0:i?C(t,r):t,o=n.length-1,p;o>=0;o--)(p=n[o])&&(l=(i?p(t,r,l):p(l))||l);return i&&l&&_(t,r,l),l};exports.PktAlert=class extends e.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.compact=a.props.compact.default,this.title="",this.skin=a.props.skin.default,this.ariaLive=a.props.ariaLive.default,this["aria-live"]=null,this.closeAlert=a.props.closeAlert.default,this.date=null,this._isClosed=!1,this.close=t=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:t},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:t},bubbles:!0,composed:!0}))},this.slotController=new u.PktSlotController(this,this.defaultSlot),this._isClosed=!1}connectedCallback(){super.connectedCallback(),this["aria-live"]=this.getAttribute("aria-live")||this.ariaLive}attributeChangedCallback(t,r,i){t==="ariaLive"&&(this["aria-live"]=i),super.attributeChangedCallback(t,r,i)}updated(t){super.updated(t),t.has("ariaLive")&&(this["aria-live"]=this.ariaLive),t.has("_isClosed")&&h.updateClassAttribute(this,"pkt-hide",this._isClosed)}render(){const t={"pkt-alert":!0,"pkt-alert--compact":this.compact,[`pkt-alert--${this.skin}`]:this.skin,"pkt-hide":this._isClosed};return e.x`
2
- <div class=${d.e(t)}>
3
- <pkt-icon
4
- class="pkt-alert__icon"
5
- name=${this.skin==="info"?"alert-information":`alert-${this.skin}`}
6
- ></pkt-icon>
7
-
8
- ${this.closeAlert?e.x`
9
- <div class="pkt-alert__close">
10
- <button
11
- type="button"
12
- class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
13
- tabindex="0"
14
- aria-label="close"
15
- @click=${this.close}
16
- >
17
- <pkt-icon name="close" class="pkt-btn__icon" aria-hidden="true"></pkt-icon>
18
- </button>
19
- </div>
20
- `:e.E}
21
- ${this.title?e.x`<div class="pkt-alert__title">${this.title}</div>`:e.E}
22
-
23
- <div class="pkt-alert__text" ${c.n(this.defaultSlot)}></div>
24
-
25
- ${this.date?e.x`<div class="pkt-alert__date">Sist oppdatert: ${this.date}</div>`:e.E}
26
- </div>
27
- `}};s([e.n({type:Boolean,reflect:!1})],exports.PktAlert.prototype,"compact",2);s([e.n({type:String,reflect:!0})],exports.PktAlert.prototype,"title",2);s([e.n({type:String,reflect:!0})],exports.PktAlert.prototype,"skin",2);s([e.n({type:String})],exports.PktAlert.prototype,"ariaLive",2);s([e.n({type:String,reflect:!0})],exports.PktAlert.prototype,"aria-live",2);s([e.n({type:Boolean,reflect:!0})],exports.PktAlert.prototype,"closeAlert",2);s([e.n({type:String,reflect:!0})],exports.PktAlert.prototype,"date",2);s([k.r()],exports.PktAlert.prototype,"_isClosed",2);exports.PktAlert=s([e.t("pkt-alert")],exports.PktAlert);
@@ -1,163 +0,0 @@
1
- import { e as k } from "./class-map-ChuDQU5C.js";
2
- import { P as m, x as n, E as u, n as r, a as h } from "./element-G8JoS0Lj.js";
3
- import { r as f } from "./state-gfUuUqVg.js";
4
- import { P as v } from "./pkt-slot-controller-D1DakVrU.js";
5
- import { e as b, n as y } from "./ref-cRTOoM4R.js";
6
- import { u as _ } from "./classutils-RQs1k6D9.js";
7
- import "./icon-BJnwW0eh.js";
8
- const C = "pkt-alert", g = !0, $ = {
9
- onClose: {
10
- description: "React: Klikk-event for 'Lukk'-knappen"
11
- },
12
- close: {
13
- description: "Vue: Klikk-event for 'Lukk'-knappen"
14
- }
15
- }, L = {
16
- title: {
17
- name: "Tittel",
18
- description: "Tittelen som vises øverst i på meldingen",
19
- type: "string"
20
- },
21
- skin: {
22
- name: "Utseende",
23
- description: "Hvordan type melding er dette?",
24
- type: [
25
- "info",
26
- "success",
27
- "warning",
28
- "error"
29
- ],
30
- default: "info"
31
- },
32
- date: {
33
- name: "Sist oppdatert",
34
- description: "Dato som vises nederst i på meldingen",
35
- type: "string"
36
- },
37
- ariaLive: {
38
- name: "aria-live",
39
- description: "Hvordan skal skjermleseren lese opp meldingen?",
40
- type: [
41
- "off",
42
- "polite",
43
- "assertive"
44
- ],
45
- default: "polite"
46
- },
47
- compact: {
48
- name: "Kompakt",
49
- description: "Gjør meldingen mindre",
50
- type: "boolean",
51
- default: !1
52
- },
53
- closeAlert: {
54
- name: "Vis 'Lukk'-knapp",
55
- description: "Viser 'Lukk'-knappen",
56
- type: "boolean",
57
- default: !1
58
- }
59
- }, S = {
60
- default: {
61
- description: "Innholdet i meldingen"
62
- }
63
- }, p = {
64
- name: C,
65
- "css-class": "pkt-alert",
66
- "dark-mode": !0,
67
- isElement: g,
68
- events: $,
69
- props: L,
70
- slots: S
71
- };
72
- var A = Object.defineProperty, E = Object.getOwnPropertyDescriptor, i = (t, a, l, o) => {
73
- for (var s = o > 1 ? void 0 : o ? E(a, l) : a, c = t.length - 1, d; c >= 0; c--)
74
- (d = t[c]) && (s = (o ? d(a, l, s) : d(s)) || s);
75
- return o && s && A(a, l, s), s;
76
- };
77
- let e = class extends m {
78
- constructor() {
79
- super(), this.defaultSlot = b(), this.compact = p.props.compact.default, this.title = "", this.skin = p.props.skin.default, this.ariaLive = p.props.ariaLive.default, this["aria-live"] = null, this.closeAlert = p.props.closeAlert.default, this.date = null, this._isClosed = !1, this.close = (t) => {
80
- this._isClosed = !0, this.dispatchEvent(
81
- new CustomEvent("close", { detail: { origin: t }, bubbles: !0, composed: !0 })
82
- ), this.dispatchEvent(
83
- new CustomEvent("on-close", { detail: { origin: t }, bubbles: !0, composed: !0 })
84
- );
85
- }, this.slotController = new v(this, this.defaultSlot), this._isClosed = !1;
86
- }
87
- // Lifecycle
88
- connectedCallback() {
89
- super.connectedCallback(), this["aria-live"] = this.getAttribute("aria-live") || this.ariaLive;
90
- }
91
- attributeChangedCallback(t, a, l) {
92
- t === "ariaLive" && (this["aria-live"] = l), super.attributeChangedCallback(t, a, l);
93
- }
94
- updated(t) {
95
- super.updated(t), t.has("ariaLive") && (this["aria-live"] = this.ariaLive), t.has("_isClosed") && _(this, "pkt-hide", this._isClosed);
96
- }
97
- // Render
98
- render() {
99
- const t = {
100
- "pkt-alert": !0,
101
- "pkt-alert--compact": this.compact,
102
- [`pkt-alert--${this.skin}`]: this.skin,
103
- "pkt-hide": this._isClosed
104
- };
105
- return n`
106
- <div class=${k(t)}>
107
- <pkt-icon
108
- class="pkt-alert__icon"
109
- name=${this.skin === "info" ? "alert-information" : `alert-${this.skin}`}
110
- ></pkt-icon>
111
-
112
- ${this.closeAlert ? n`
113
- <div class="pkt-alert__close">
114
- <button
115
- type="button"
116
- class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
117
- tabindex="0"
118
- aria-label="close"
119
- @click=${this.close}
120
- >
121
- <pkt-icon name="close" class="pkt-btn__icon" aria-hidden="true"></pkt-icon>
122
- </button>
123
- </div>
124
- ` : u}
125
- ${this.title ? n`<div class="pkt-alert__title">${this.title}</div>` : u}
126
-
127
- <div class="pkt-alert__text" ${y(this.defaultSlot)}></div>
128
-
129
- ${this.date ? n`<div class="pkt-alert__date">Sist oppdatert: ${this.date}</div>` : u}
130
- </div>
131
- `;
132
- }
133
- };
134
- i([
135
- r({ type: Boolean, reflect: !1 })
136
- ], e.prototype, "compact", 2);
137
- i([
138
- r({ type: String, reflect: !0 })
139
- ], e.prototype, "title", 2);
140
- i([
141
- r({ type: String, reflect: !0 })
142
- ], e.prototype, "skin", 2);
143
- i([
144
- r({ type: String })
145
- ], e.prototype, "ariaLive", 2);
146
- i([
147
- r({ type: String, reflect: !0 })
148
- ], e.prototype, "aria-live", 2);
149
- i([
150
- r({ type: Boolean, reflect: !0 })
151
- ], e.prototype, "closeAlert", 2);
152
- i([
153
- r({ type: String, reflect: !0 })
154
- ], e.prototype, "date", 2);
155
- i([
156
- f()
157
- ], e.prototype, "_isClosed", 2);
158
- e = i([
159
- h("pkt-alert")
160
- ], e);
161
- export {
162
- e as P
163
- };
@@ -1,176 +0,0 @@
1
- import { e as h } from "./class-map-ChuDQU5C.js";
2
- import { o as c } from "./if-defined-rCqT8Od1.js";
3
- import { P as m, x as r, E as k, n as a, a as u } from "./element-G8JoS0Lj.js";
4
- import { P as y } from "./pkt-slot-controller-D1DakVrU.js";
5
- import { e as f, n as b } from "./ref-cRTOoM4R.js";
6
- import "./icon-BJnwW0eh.js";
7
- import "./tag-CWx1XsGR.js";
8
- const $ = "pkt-card", v = !0, _ = {
9
- heading: {
10
- type: "string",
11
- name: "Heading",
12
- description: "Tittel på kortet"
13
- },
14
- subheading: {
15
- type: "string",
16
- name: "Subheading",
17
- description: "Undertittel på kortet"
18
- },
19
- skin: {
20
- type: [
21
- "outlined",
22
- "gray",
23
- "blue",
24
- "beige",
25
- "green"
26
- ],
27
- name: "Skin",
28
- description: "Farge på kortet",
29
- default: "outlined"
30
- },
31
- direction: {
32
- type: [
33
- "landscape",
34
- "portrait"
35
- ],
36
- name: "Direction",
37
- description: "Retningen innholdet skal ligge i forhold til kortet",
38
- default: "portrait"
39
- },
40
- tags: {
41
- type: "array",
42
- description: "Liste av tags på kortet. Tar inn en array med objekter med følgende stringproperties: skin, iconName, ariaLabel, text",
43
- name: "Tags",
44
- items: {
45
- type: "object",
46
- properties: {
47
- skin: {
48
- type: [
49
- "blue",
50
- "green",
51
- "red",
52
- "yellow"
53
- ],
54
- description: "Farge på tag"
55
- },
56
- iconName: {
57
- type: "icon",
58
- description: "Id på ikonet du ønsker å bruke til tag"
59
- },
60
- ariaLabel: {
61
- type: "string",
62
- description: "Tekst for aria-label"
63
- },
64
- text: {
65
- type: "string",
66
- description: "Tekst på tag",
67
- required: !0
68
- }
69
- }
70
- }
71
- },
72
- image: {
73
- type: "object",
74
- name: "Bilde",
75
- description: "Bilde på kortet. Tar inn et objekt av typen {src: string, alt: string}. src er stien til bildet, og alt er tekst for aria-label.",
76
- properties: {
77
- src: {
78
- type: "string",
79
- description: "Bilde på kortet",
80
- required: !0
81
- },
82
- alt: {
83
- type: "string",
84
- description: "Tekst for aria-label",
85
- required: !0
86
- }
87
- }
88
- }
89
- }, S = {
90
- default: {
91
- description: "Innholdet i kortet"
92
- }
93
- }, g = {
94
- name: $,
95
- "css-class": "pkt-card",
96
- isElement: v,
97
- props: _,
98
- slots: S
99
- };
100
- var x = Object.defineProperty, P = Object.getOwnPropertyDescriptor, s = (n, t, p, o) => {
101
- for (var i = o > 1 ? void 0 : o ? P(t, p) : t, l = n.length - 1, d; l >= 0; l--)
102
- (d = n[l]) && (i = (o ? d(t, p, i) : d(i)) || i);
103
- return o && i && x(t, p, i), i;
104
- };
105
- let e = class extends m {
106
- constructor() {
107
- super(), this.defaultSlot = f(), this.skin = g.props.skin.default, this.direction = g.props.direction.default, this.image = {
108
- src: "",
109
- alt: ""
110
- }, this.heading = "", this.subheading = "", this.tags = [], this.slotController = new y(this, this.defaultSlot);
111
- }
112
- connectedCallback() {
113
- super.connectedCallback();
114
- }
115
- render() {
116
- const n = {
117
- "pkt-card": !0,
118
- [`pkt-card--${this.skin}`]: this.skin,
119
- [`pkt-card--${this.direction}`]: this.direction
120
- };
121
- return r`
122
- <div class=${h(n)}>
123
- ${this.image.src && r`
124
- <div class="pkt-card__image">
125
- <img src=${this.image.src} alt=${this.image.alt || ""} />
126
- </div>
127
- `}
128
- <div class="pkt-card__wrapper">
129
- ${this.tags.length > 0 ? r`
130
- <div class="pkt-card__tags">
131
- ${this.tags.map(
132
- (t) => r`
133
- <pkt-tag
134
- textStyle="normal-text"
135
- size="medium"
136
- skin=${c(t.skin)}
137
- iconName=${c(t.iconName)}
138
- >
139
- ${t.text}
140
- </pkt-tag>
141
- `
142
- )}
143
- </div>
144
- ` : k}
145
- ${this.heading && r`<h3 class="pkt-txt-30-medium">${this.heading}</h3>`}
146
- ${this.subheading && r`<p class="pkt-txt-20-light">${this.subheading}</p>`}
147
- ${this.defaultSlot && r`<div class="pkt-card__content" ${b(this.defaultSlot)}></div>`}
148
- </div>
149
- </div>
150
- `;
151
- }
152
- };
153
- s([
154
- a({ type: String, reflect: !0 })
155
- ], e.prototype, "skin", 2);
156
- s([
157
- a({ type: String, reflect: !0 })
158
- ], e.prototype, "direction", 2);
159
- s([
160
- a({ type: Object, reflect: !0 })
161
- ], e.prototype, "image", 2);
162
- s([
163
- a({ type: String, reflect: !0 })
164
- ], e.prototype, "heading", 2);
165
- s([
166
- a({ type: String, reflect: !0 })
167
- ], e.prototype, "subheading", 2);
168
- s([
169
- a({ type: Array, reflect: !0 })
170
- ], e.prototype, "tags", 2);
171
- e = s([
172
- u("pkt-card")
173
- ], e);
174
- export {
175
- e as P
176
- };
@@ -1,28 +0,0 @@
1
- "use strict";const g=require("./class-map-D4rXyUxT.cjs"),d=require("./if-defined-C1ZDVzYn.cjs"),t=require("./element-BBo3JZk5.cjs"),k=require("./pkt-slot-controller-CqNvEpFd.cjs"),l=require("./ref-DsoUUoPU.cjs");require("./icon-BTUCDPN5.cjs");require("./tag-DThwKsrg.cjs");const u="pkt-card",h=!0,m={heading:{type:"string",name:"Heading",description:"Tittel på kortet"},subheading:{type:"string",name:"Subheading",description:"Undertittel på kortet"},skin:{type:["outlined","gray","blue","beige","green"],name:"Skin",description:"Farge på kortet",default:"outlined"},direction:{type:["landscape","portrait"],name:"Direction",description:"Retningen innholdet skal ligge i forhold til kortet",default:"portrait"},tags:{type:"array",description:"Liste av tags på kortet. Tar inn en array med objekter med følgende stringproperties: skin, iconName, ariaLabel, text",name:"Tags",items:{type:"object",properties:{skin:{type:["blue","green","red","yellow"],description:"Farge på tag"},iconName:{type:"icon",description:"Id på ikonet du ønsker å bruke til tag"},ariaLabel:{type:"string",description:"Tekst for aria-label"},text:{type:"string",description:"Tekst på tag",required:!0}}}},image:{type:"object",name:"Bilde",description:"Bilde på kortet. Tar inn et objekt av typen {src: string, alt: string}. src er stien til bildet, og alt er tekst for aria-label.",properties:{src:{type:"string",description:"Bilde på kortet",required:!0},alt:{type:"string",description:"Tekst for aria-label",required:!0}}}},y={default:{description:"Innholdet i kortet"}},c={name:u,"css-class":"pkt-card",isElement:h,props:m,slots:y};var f=Object.defineProperty,b=Object.getOwnPropertyDescriptor,i=(a,s,e,n)=>{for(var r=n>1?void 0:n?b(s,e):s,o=a.length-1,p;o>=0;o--)(p=a[o])&&(r=(n?p(s,e,r):p(r))||r);return n&&r&&f(s,e,r),r};exports.PktCard=class extends t.PktElement{constructor(){super(),this.defaultSlot=l.e(),this.skin=c.props.skin.default,this.direction=c.props.direction.default,this.image={src:"",alt:""},this.heading="",this.subheading="",this.tags=[],this.slotController=new k.PktSlotController(this,this.defaultSlot)}connectedCallback(){super.connectedCallback()}render(){const s={"pkt-card":!0,[`pkt-card--${this.skin}`]:this.skin,[`pkt-card--${this.direction}`]:this.direction};return t.x`
2
- <div class=${g.e(s)}>
3
- ${this.image.src&&t.x`
4
- <div class="pkt-card__image">
5
- <img src=${this.image.src} alt=${this.image.alt||""} />
6
- </div>
7
- `}
8
- <div class="pkt-card__wrapper">
9
- ${this.tags.length>0?t.x`
10
- <div class="pkt-card__tags">
11
- ${this.tags.map(e=>t.x`
12
- <pkt-tag
13
- textStyle="normal-text"
14
- size="medium"
15
- skin=${d.o(e.skin)}
16
- iconName=${d.o(e.iconName)}
17
- >
18
- ${e.text}
19
- </pkt-tag>
20
- `)}
21
- </div>
22
- `:t.E}
23
- ${this.heading&&t.x`<h3 class="pkt-txt-30-medium">${this.heading}</h3>`}
24
- ${this.subheading&&t.x`<p class="pkt-txt-20-light">${this.subheading}</p>`}
25
- ${this.defaultSlot&&t.x`<div class="pkt-card__content" ${l.n(this.defaultSlot)}></div>`}
26
- </div>
27
- </div>
28
- `}};i([t.n({type:String,reflect:!0})],exports.PktCard.prototype,"skin",2);i([t.n({type:String,reflect:!0})],exports.PktCard.prototype,"direction",2);i([t.n({type:Object,reflect:!0})],exports.PktCard.prototype,"image",2);i([t.n({type:String,reflect:!0})],exports.PktCard.prototype,"heading",2);i([t.n({type:String,reflect:!0})],exports.PktCard.prototype,"subheading",2);i([t.n({type:Array,reflect:!0})],exports.PktCard.prototype,"tags",2);exports.PktCard=i([t.t("pkt-card")],exports.PktCard);