@oslokommune/punkt-elements 12.1.0 → 12.3.0

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 (91) hide show
  1. package/README.md +30 -0
  2. package/dist/alert.d.ts +1 -0
  3. package/dist/calendar.d.ts +1 -0
  4. package/dist/card.d.ts +1 -0
  5. package/dist/class-map-CA8wadiN.cjs +5 -0
  6. package/dist/class-map-DiT0qP3E.js +34 -0
  7. package/dist/component-template.d.ts +1 -0
  8. package/dist/converters-DNCwIFwr.js +17 -0
  9. package/dist/converters-DhM11VlY.cjs +1 -0
  10. package/dist/datepicker.d.ts +1 -0
  11. package/dist/directive-19_ixLKS.cjs +9 -0
  12. package/dist/directive-DA0-wdk7.js +38 -0
  13. package/dist/element.d.ts +1 -0
  14. package/dist/icon.d.ts +1 -0
  15. package/dist/index-BHzxfdBK.js +807 -0
  16. package/dist/index-BJ_4AGO3.cjs +23 -0
  17. package/dist/index-BlHnvy7v.js +82 -0
  18. package/dist/index-CPvZ03uX.js +577 -0
  19. package/dist/index-DSplpVWQ.cjs +9 -0
  20. package/dist/index-DkGcZra2.cjs +90 -0
  21. package/dist/index.d.ts +393 -3
  22. package/dist/input-wrapper.d.ts +1 -0
  23. package/dist/link.d.ts +1 -0
  24. package/dist/messagebox.d.ts +1 -0
  25. package/dist/pkt-alert.cjs +27 -0
  26. package/dist/pkt-alert.js +86 -0
  27. package/dist/pkt-calendar.cjs +1 -0
  28. package/dist/pkt-calendar.js +10 -0
  29. package/dist/pkt-card.cjs +23 -0
  30. package/dist/pkt-card.js +177 -0
  31. package/dist/pkt-component-template.cjs +29 -0
  32. package/dist/{pkt-el-component-template.js → pkt-component-template.js} +25 -26
  33. package/dist/pkt-datepicker.cjs +140 -0
  34. package/dist/pkt-datepicker.js +1769 -0
  35. package/dist/pkt-element.cjs +1 -0
  36. package/dist/pkt-element.js +5 -0
  37. package/dist/pkt-icon.cjs +1 -0
  38. package/dist/pkt-icon.js +6 -0
  39. package/dist/pkt-index.cjs +1 -0
  40. package/dist/pkt-index.js +20 -0
  41. package/dist/pkt-input-wrapper.cjs +59 -0
  42. package/dist/pkt-input-wrapper.js +293 -0
  43. package/dist/pkt-link.cjs +3 -0
  44. package/dist/pkt-link.js +90 -0
  45. package/dist/pkt-messagebox.cjs +12 -0
  46. package/dist/pkt-messagebox.js +62 -0
  47. package/dist/pkt-tag.cjs +17 -0
  48. package/dist/pkt-tag.js +151 -0
  49. package/dist/ref-Bk590hog.cjs +13 -0
  50. package/dist/ref-Co_S0Cgj.js +173 -0
  51. package/dist/state-BRgFbJX9.js +12 -0
  52. package/dist/state-D2tUtTi6.cjs +5 -0
  53. package/dist/tag.d.ts +1 -0
  54. package/package.json +10 -7
  55. package/src/components/alert/index.ts +86 -0
  56. package/src/components/calendar/index.ts +391 -143
  57. package/src/components/card/index.ts +78 -0
  58. package/src/components/component-template/index.ts +25 -9
  59. package/src/components/datepicker/index.ts +546 -0
  60. package/src/components/element/index.ts +181 -8
  61. package/src/components/icon/index.ts +44 -49
  62. package/src/components/index.ts +7 -1
  63. package/src/components/input-wrapper/index.ts +260 -0
  64. package/src/components/link/index.ts +51 -0
  65. package/src/components/messagebox/index.ts +63 -0
  66. package/src/components/tag/index.ts +110 -0
  67. package/dist/components/calendar/index.d.ts +0 -59
  68. package/dist/components/component-template/index.d.ts +0 -34
  69. package/dist/components/element/index.d.ts +0 -24
  70. package/dist/components/icon/index.d.ts +0 -29
  71. package/dist/components/index.d.ts +0 -3
  72. package/dist/controllers/pkt-slot-controller.d.ts +0 -11
  73. package/dist/converters-Bi8tmNvQ.cjs +0 -5
  74. package/dist/converters-DMveycvc.js +0 -100
  75. package/dist/directive-C7mkmyiy.js +0 -573
  76. package/dist/directive-DfhMJ1ie.cjs +0 -23
  77. package/dist/helpers/converters.d.ts +0 -3
  78. package/dist/index-0PZgk9Oc.js +0 -159
  79. package/dist/index-xoVy6sfy.cjs +0 -13
  80. package/dist/pkt-el-calendar.cjs +0 -60
  81. package/dist/pkt-el-calendar.js +0 -1496
  82. package/dist/pkt-el-component-template.cjs +0 -29
  83. package/dist/pkt-el-element.cjs +0 -1
  84. package/dist/pkt-el-element.js +0 -5
  85. package/dist/pkt-el-icon.cjs +0 -9
  86. package/dist/pkt-el-icon.js +0 -98
  87. package/dist/pkt-el-index.cjs +0 -1
  88. package/dist/pkt-el-index.js +0 -8
  89. package/dist/property-BBVRv-DT.js +0 -47
  90. package/dist/property-CK6SFc5B.cjs +0 -9
  91. package/dist/src/translations/no.json.d.ts +0 -43
@@ -1,29 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./directive-DfhMJ1ie.cjs"),n=require("./property-CK6SFc5B.cjs"),h=require("./index-xoVy6sfy.cjs"),c=require("./converters-Bi8tmNvQ.cjs");var d=Object.defineProperty,u=Object.getOwnPropertyDescriptor,r=(i,t,e,o)=>{for(var s=o>1?void 0:o?u(t,e):t,l=i.length-1,p;l>=0;l--)(p=i[l])&&(s=(o?p(t,e,s):p(s))||s);return o&&s&&d(t,e,s),s};exports.PktComponent=class extends h.PktElement{constructor(){super(...arguments),this.string="",this.strings=[],this.darkmode=!1,this._list=[]}connectedCallback(){this.strings.length&&this.strings.forEach(t=>{this._list.push(t.toUpperCase())}),super.connectedCallback()}render(){const t={"pkt-component":!0,"pkt-component--has-list":this.strings.length>0,"pkt-darkmode":this.darkmode};return a.ke`
2
- <div class="${c.Rt(t)}">
3
- <h1 class="pkt-txt-28">${this.string}</h1>
4
-
5
- <h2 class="pkt-txt-22">Innhold fra attributter og funksjoner</h2>
6
- <div>${this.renderList(this.strings)}</div>
7
- <div>${this.renderList(this.doStuff(this._list))}</div>
8
-
9
- <h2 class="pkt-txt-22">Slot</h2>
10
- <div ${h.Kt(this.defaultSlot)}>defaultSlotRef</div>
11
- <h2 class="pkt-txt-22">Named slot</h2>
12
- <select
13
- name="named-slot"
14
- ${h.Kt(this.namedSlot)}
15
- @change=${e=>alert(e.target.value)}
16
- >
17
- namedSlotRef
18
- </select>
19
-
20
- <h2 class="pkt-txt-22">Knapp som emitter en event</h2>
21
- <button type="button" @click=${()=>this.handleGreeting()}>
22
- Si ${c.translations.example.hi}
23
- </button>
24
- </div>
25
- `}renderList(t){return a.ke`
26
- <ul>
27
- ${t.map(e=>a.ke`<li>${e}</li>`)}
28
- </ul>
29
- `}doStuff(t){return t.reverse()}handleGreeting(){this.dispatchEvent(new CustomEvent("pkt-greeting",{detail:"Hei på deg!",bubbles:!0,composed:!0}))}};r([n.n({type:String})],exports.PktComponent.prototype,"string",2);r([n.n({converter:c.csvToArray})],exports.PktComponent.prototype,"strings",2);r([n.n({type:Boolean})],exports.PktComponent.prototype,"darkmode",2);r([n.n({type:Array})],exports.PktComponent.prototype,"_list",2);exports.PktComponent=r([n.t("pkt-el-component")],exports.PktComponent);
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./directive-DfhMJ1ie.cjs");const e=require("./index-xoVy6sfy.cjs");exports.PktElement=e.PktElement;
@@ -1,5 +0,0 @@
1
- import "./directive-C7mkmyiy.js";
2
- import { P as o } from "./index-0PZgk9Oc.js";
3
- export {
4
- o as PktElement
5
- };
@@ -1,9 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./directive-DfhMJ1ie.cjs"),c=require("./property-CK6SFc5B.cjs");/**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */class f extends i.i{constructor(e){if(super(e),this.it=i.D,e.type!==i.t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===i.D||e==null)return this._t=void 0,this.it=e;if(e===i.R)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const r=[e];return r.raw=r,this._t={_$litType$:this.constructor.resultType,strings:r,values:[]}}}f.directiveName="unsafeHTML",f.resultType=1;/**
6
- * @license
7
- * Copyright 2017 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- */class v extends f{}v.directiveName="unsafeSVG",v.resultType=2;const h=i.e(v);var d=Object.defineProperty,y=Object.getOwnPropertyDescriptor,l=(t,e,r,s)=>{for(var n=s>1?void 0:s?y(e,r):e,a=t.length-1,u;a>=0;a--)(u=t[a])&&(n=(s?u(e,r,n):u(n))||n);return s&&n&&d(e,r,n),n};const m=t=>new Promise(e=>setTimeout(e,t)),o='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>',p={},g=async(t,e)=>{let r=0;for(;p[e+t+".svg"]==="fetching"&&(r++,!(r>50));)await m(50);return localStorage.getItem(e+t+".svg")?Promise.resolve(localStorage.getItem(e+t+".svg")):typeof window.fetch=="function"?(p[e+t+".svg"]="fetching",Promise.resolve(fetch(e+t+".svg").then(s=>s.ok?s.text():(console.error("Missing icon: "+e+t+".svg"),o)).then(s=>(s!==o&&localStorage.setItem(e+t+".svg",s),p[e+t+".svg"]="fetched",s)))):Promise.resolve(o)};exports.PktIcon=class extends i.h{constructor(){super(...arguments),this.name="",this.path="https://punkt-cdn.oslo.kommune.no/latest/icons/",this.icon=h(o)}createRenderRoot(){return this}hotReplacedCallback(){this.requestUpdate()}async connectedCallback(){this.name&&this.path&&(this.icon=h(await g(this.name,this.path).then(e=>e))),super.connectedCallback()}async update(e){e.has("name")&&this.name&&this.path&&(this.icon=h(await g(this.name,this.path).then(r=>r))),super.update(e)}render(){return i.ke`${this.icon}`}};l([c.n({type:String,reflect:!0})],exports.PktIcon.prototype,"name",2);l([c.n({type:String,reflect:!0})],exports.PktIcon.prototype,"path",2);l([c.n({type:SVGElement})],exports.PktIcon.prototype,"icon",2);exports.PktIcon=l([c.t("pkt-el-icon")],exports.PktIcon);
@@ -1,98 +0,0 @@
1
- import { i as m, D as g, t as w, R as y, e as _, h as S, k as b } from "./directive-C7mkmyiy.js";
2
- import { n as v, t as P } from "./property-BBVRv-DT.js";
3
- /**
4
- * @license
5
- * Copyright 2017 Google LLC
6
- * SPDX-License-Identifier: BSD-3-Clause
7
- */
8
- class p extends m {
9
- constructor(e) {
10
- if (super(e), this.it = g, e.type !== w.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
11
- }
12
- render(e) {
13
- if (e === g || e == null) return this._t = void 0, this.it = e;
14
- if (e === y) return e;
15
- if (typeof e != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
16
- if (e === this.it) return this._t;
17
- this.it = e;
18
- const s = [e];
19
- return s.raw = s, this._t = { _$litType$: this.constructor.resultType, strings: s, values: [] };
20
- }
21
- }
22
- p.directiveName = "unsafeHTML", p.resultType = 1;
23
- /**
24
- * @license
25
- * Copyright 2017 Google LLC
26
- * SPDX-License-Identifier: BSD-3-Clause
27
- */
28
- class f extends p {
29
- }
30
- f.directiveName = "unsafeSVG", f.resultType = 2;
31
- const h = _(f);
32
- var k = Object.defineProperty, C = Object.getOwnPropertyDescriptor, c = (t, e, s, r) => {
33
- for (var i = r > 1 ? void 0 : r ? C(e, s) : e, l = t.length - 1, a; l >= 0; l--)
34
- (a = t[l]) && (i = (r ? a(e, s, i) : a(i)) || i);
35
- return r && i && k(e, s, i), i;
36
- };
37
- const I = (t) => new Promise((e) => setTimeout(e, t)), o = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>', u = {}, d = async (t, e) => {
38
- let s = 0;
39
- for (; u[e + t + ".svg"] === "fetching" && (s++, !(s > 50)); )
40
- await I(50);
41
- return localStorage.getItem(e + t + ".svg") ? Promise.resolve(localStorage.getItem(e + t + ".svg")) : typeof window.fetch == "function" ? (u[e + t + ".svg"] = "fetching", Promise.resolve(
42
- fetch(e + t + ".svg").then((r) => r.ok ? r.text() : (console.error("Missing icon: " + e + t + ".svg"), o)).then((r) => (r !== o && localStorage.setItem(e + t + ".svg", r), u[e + t + ".svg"] = "fetched", r))
43
- )) : Promise.resolve(o);
44
- };
45
- let n = class extends S {
46
- constructor() {
47
- super(...arguments), this.name = "", this.path = "https://punkt-cdn.oslo.kommune.no/latest/icons/", this.icon = h(o);
48
- }
49
- /**
50
- * Make sure the component renders in light DOM instead of shadow DOM
51
- */
52
- createRenderRoot() {
53
- return this;
54
- }
55
- /**
56
- * Add support for Hot Module Reloading in dev mode
57
- */
58
- hotReplacedCallback() {
59
- this.requestUpdate();
60
- }
61
- /**
62
- * Runs on mount, used to set up various values and whatever you need to run
63
- */
64
- async connectedCallback() {
65
- this.name && this.path && (this.icon = h(
66
- await d(this.name, this.path).then((t) => t)
67
- )), super.connectedCallback();
68
- }
69
- /**
70
- * Runs every time a property changes
71
- */
72
- async update(t) {
73
- t.has("name") && this.name && this.path && (this.icon = h(
74
- await d(this.name, this.path).then((e) => e)
75
- )), super.update(t);
76
- }
77
- /**
78
- * Component functionality and render
79
- */
80
- render() {
81
- return b`${this.icon}`;
82
- }
83
- };
84
- c([
85
- v({ type: String, reflect: !0 })
86
- ], n.prototype, "name", 2);
87
- c([
88
- v({ type: String, reflect: !0 })
89
- ], n.prototype, "path", 2);
90
- c([
91
- v({ type: SVGElement })
92
- ], n.prototype, "icon", 2);
93
- n = c([
94
- P("pkt-el-icon")
95
- ], n);
96
- export {
97
- n as PktIcon
98
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./pkt-el-calendar.cjs"),t=require("./pkt-el-icon.cjs"),r=require("./pkt-el-component-template.cjs");Object.defineProperty(exports,"PktCalendar",{enumerable:!0,get:()=>e.PktCalendar});Object.defineProperty(exports,"PktIcon",{enumerable:!0,get:()=>t.PktIcon});Object.defineProperty(exports,"PktComponent",{enumerable:!0,get:()=>r.PktComponent});
@@ -1,8 +0,0 @@
1
- import { PktCalendar as t } from "./pkt-el-calendar.js";
2
- import { PktIcon as m } from "./pkt-el-icon.js";
3
- import { PktComponent as p } from "./pkt-el-component-template.js";
4
- export {
5
- t as PktCalendar,
6
- p as PktComponent,
7
- m as PktIcon
8
- };
@@ -1,47 +0,0 @@
1
- import { u as d, f as l } from "./directive-C7mkmyiy.js";
2
- /**
3
- * @license
4
- * Copyright 2017 Google LLC
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */
7
- const f = (e) => (r, t) => {
8
- t !== void 0 ? t.addInitializer(() => {
9
- customElements.define(e, r);
10
- }) : customElements.define(e, r);
11
- };
12
- /**
13
- * @license
14
- * Copyright 2017 Google LLC
15
- * SPDX-License-Identifier: BSD-3-Clause
16
- */
17
- const p = { attribute: !0, type: String, converter: d, reflect: !1, hasChanged: l }, u = (e = p, r, t) => {
18
- const { kind: s, metadata: i } = t;
19
- let o = globalThis.litPropertyMetadata.get(i);
20
- if (o === void 0 && globalThis.litPropertyMetadata.set(i, o = /* @__PURE__ */ new Map()), o.set(t.name, e), s === "accessor") {
21
- const { name: n } = t;
22
- return { set(a) {
23
- const c = r.get.call(this);
24
- r.set.call(this, a), this.requestUpdate(n, c, e);
25
- }, init(a) {
26
- return a !== void 0 && this.P(n, void 0, e), a;
27
- } };
28
- }
29
- if (s === "setter") {
30
- const { name: n } = t;
31
- return function(a) {
32
- const c = this[n];
33
- r.call(this, a), this.requestUpdate(n, c, e);
34
- };
35
- }
36
- throw Error("Unsupported decorator location: " + s);
37
- };
38
- function m(e) {
39
- return (r, t) => typeof t == "object" ? u(e, r, t) : ((s, i, o) => {
40
- const n = i.hasOwnProperty(o);
41
- return i.constructor.createProperty(o, n ? { ...s, wrapped: !0 } : s), n ? Object.getOwnPropertyDescriptor(i, o) : void 0;
42
- })(e, r, t);
43
- }
44
- export {
45
- m as n,
46
- f as t
47
- };
@@ -1,9 +0,0 @@
1
- "use strict";const d=require("./directive-DfhMJ1ie.cjs");/**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */const l=e=>(r,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(e,r)}):customElements.define(e,r)};/**
6
- * @license
7
- * Copyright 2017 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- */const u={attribute:!0,type:String,converter:d.u,reflect:!1,hasChanged:d.f},p=(e=u,r,t)=>{const{kind:i,metadata:o}=t;let s=globalThis.litPropertyMetadata.get(o);if(s===void 0&&globalThis.litPropertyMetadata.set(o,s=new Map),s.set(t.name,e),i==="accessor"){const{name:n}=t;return{set(a){const c=r.get.call(this);r.set.call(this,a),this.requestUpdate(n,c,e)},init(a){return a!==void 0&&this.P(n,void 0,e),a}}}if(i==="setter"){const{name:n}=t;return function(a){const c=this[n];r.call(this,a),this.requestUpdate(n,c,e)}}throw Error("Unsupported decorator location: "+i)};function h(e){return(r,t)=>typeof t=="object"?p(e,r,t):((i,o,s)=>{const n=o.hasOwnProperty(s);return o.constructor.createProperty(s,n?{...i,wrapped:!0}:i),n?Object.getOwnPropertyDescriptor(o,s):void 0})(e,r,t)}exports.n=h;exports.t=l;
@@ -1,43 +0,0 @@
1
- declare const _default: {
2
- "example": {
3
- "hi": "Hei!"
4
- },
5
- "dates": {
6
- "days": ["Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"],
7
- "daysShort": ["Man", "Tir", "Ons", "Tor", "Fre", "Lør", "Søn"],
8
- "months": [
9
- "Januar",
10
- "Februar",
11
- "Mars",
12
- "April",
13
- "Mai",
14
- "Juni",
15
- "Juli",
16
- "August",
17
- "September",
18
- "Oktober",
19
- "November",
20
- "Desember"
21
- ],
22
- "monthsShort": [
23
- "Jan",
24
- "Feb",
25
- "Mar",
26
- "Apr",
27
- "Mai",
28
- "Jun",
29
- "Jul",
30
- "Aug",
31
- "Sep",
32
- "Okt",
33
- "Nov",
34
- "Des"
35
- ],
36
- "week": "Uke",
37
- "prevMonth": "Forrige måned",
38
- "nextMonth": "Neste måned"
39
- }
40
- }
41
- ;
42
-
43
- export default _default;