@oslokommune/punkt-elements 14.0.4 → 14.1.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.
- package/CHANGELOG.md +17 -0
- package/dist/{alert-CCjoJo11.cjs → alert-SvqEDHuW.cjs} +1 -1
- package/dist/{alert-CPY1IhxY.js → alert-UFQFbbzZ.js} +2 -2
- package/dist/{backlink-BzEvli8m.cjs → backlink-BrIIpgJ7.cjs} +1 -1
- package/dist/{backlink-CI_jMGzZ.js → backlink-C7qUmUzs.js} +1 -1
- package/dist/{button-D99MF5nV.js → button-CjXih_Nx.js} +1 -1
- package/dist/{button-abD9URn0.cjs → button-DaM4jvhJ.cjs} +1 -1
- package/dist/{calendar-yxjSI4wd.js → calendar-CvfMj3fA.js} +1 -1
- package/dist/{calendar-BtShW7ER.cjs → calendar-ZzLAjDpv.cjs} +1 -1
- package/dist/{card-BAoH1g6O.cjs → card-C1gRTfXb.cjs} +1 -1
- package/dist/{card-0F02tcJV.js → card-CO3D8wQE.js} +2 -2
- package/dist/{combobox-D-VZRCHk.js → combobox-BMznle0M.js} +3 -3
- package/dist/{combobox-DYYCdlex.cjs → combobox-BWsCkPH2.cjs} +1 -1
- package/dist/{consent-BSNqH1LX.js → consent-BO3Ga8N4.js} +2 -2
- package/dist/{consent-B1N02CuT.cjs → consent-Daj-Xa7w.cjs} +1 -1
- package/dist/{datepicker-D0q75U1Z.js → datepicker-2s6FUxdi.js} +4 -4
- package/dist/{datepicker-DDV382Uu.cjs → datepicker-D1c9oP-2.cjs} +1 -1
- package/dist/{helptext-Cs3QHeEy.js → helptext-Bn17Picx.js} +1 -1
- package/dist/{helptext-EPTR9AIl.cjs → helptext-hlcc584n.cjs} +1 -1
- package/dist/{icon-1dy7UZcu.js → icon-BB7e5iQN.js} +17 -17
- package/dist/icon-MRx-m0Or.cjs +9 -0
- package/dist/{input-wrapper-CnYj-xNE.js → input-wrapper-CAwzMR9o.js} +3 -3
- package/dist/{input-wrapper-WEGSbIA6.cjs → input-wrapper-DXg2N3wx.cjs} +1 -1
- package/dist/{link-DzZCw8j2.js → link-BboUBUcg.js} +1 -1
- package/dist/{link-Da3pZ_CW.cjs → link-Dw39h-YN.cjs} +1 -1
- package/dist/{linkcard-RIK5xqbd.js → linkcard-BqJmHFu8.js} +1 -1
- package/dist/{linkcard-BM23gzhS.cjs → linkcard-DUA3kGGd.cjs} +1 -1
- package/dist/{loader-BVvBzaPI.js → loader-DIum_s_D.js} +1 -1
- package/dist/{loader-Bo8RCbCJ.cjs → loader-DjGxT7C3.cjs} +1 -1
- package/dist/{messagebox-C76IcXTl.cjs → messagebox-ChIKVTO_.cjs} +1 -1
- package/dist/{messagebox-DwdMXoAe.js → messagebox-aPlConlJ.js} +1 -1
- package/dist/{modal-Cdz9JcCX.cjs → modal-B4qq0VFB.cjs} +1 -1
- package/dist/{modal-BGXk3f9u.js → modal-jAUtM-NP.js} +1 -1
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +2 -2
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +4 -4
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +22 -22
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -1
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -2
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/{progressbar-kxcBEspG.js → progressbar-CVt73-JQ.js} +1 -1
- package/dist/{progressbar-8gzOtJyh.cjs → progressbar-CmAQ-DVW.cjs} +1 -1
- package/dist/{select-CtgQkH86.js → select-CteaDnzz.js} +1 -1
- package/dist/{select-BSnylWof.cjs → select-Ds4Ws1_6.cjs} +1 -1
- package/dist/{tag-BkuJjOy7.cjs → tag-B02fKJ66.cjs} +1 -1
- package/dist/{tag-BpCdJuei.js → tag-CES41g0D.js} +1 -1
- package/dist/{textarea-BJGCHy37.js → textarea-D4T9yqw7.js} +2 -2
- package/dist/{textarea-CcIQXCmC.cjs → textarea-zeFp1hxO.cjs} +1 -1
- package/dist/{textinput-B3Q13J8H.js → textinput-Cddq4eF_.js} +2 -2
- package/dist/{textinput-Dn704gQw.cjs → textinput-DFFL5v-U.cjs} +1 -1
- package/package.json +2 -2
- package/src/components/icon/icon.test.ts +5 -5
- package/src/components/icon/icon.ts +7 -7
- package/dist/icon-BGuizDwk.cjs +0 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const s=require("./element-CJ_QKaki.cjs"),p=require("./if-defined-Bc9-_I01.cjs"),c=require("./state-DSjcvzDN.cjs"),l=require("./ref-BFa5Utho.cjs"),$=require("./class-map-C_erArZz.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-4oOjKnGY.cjs"),x=require("./input-element-BmXkhljw.cjs"),T=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-
|
|
1
|
+
"use strict";const s=require("./element-CJ_QKaki.cjs"),p=require("./if-defined-Bc9-_I01.cjs"),c=require("./state-DSjcvzDN.cjs"),l=require("./ref-BFa5Utho.cjs"),$=require("./class-map-C_erArZz.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-4oOjKnGY.cjs"),x=require("./input-element-BmXkhljw.cjs"),T=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-DXg2N3wx.cjs");require("./icon-MRx-m0Or.cjs");/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2020 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -5,8 +5,8 @@ import { e as d, n as m } from "./ref-Xa5dbh--.js";
|
|
|
5
5
|
import { e as g } from "./class-map-wy7PUk0P.js";
|
|
6
6
|
import { P as x } from "./input-element-B0VPRK_E.js";
|
|
7
7
|
import { P as v } from "./pkt-slot-controller-BPGj-LC5.js";
|
|
8
|
-
import "./input-wrapper-
|
|
9
|
-
import "./icon-
|
|
8
|
+
import "./input-wrapper-CAwzMR9o.js";
|
|
9
|
+
import "./icon-BB7e5iQN.js";
|
|
10
10
|
var y = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (i, e, r, t) => {
|
|
11
11
|
for (var n = t > 1 ? void 0 : t ? b(e, r) : e, l = i.length - 1, c; l >= 0; l--)
|
|
12
12
|
(c = i[l]) && (n = (t ? c(e, r, n) : c(n)) || n);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./element-CJ_QKaki.cjs"),a=require("./if-defined-Bc9-_I01.cjs"),l=require("./state-DSjcvzDN.cjs"),h=require("./ref-BFa5Utho.cjs"),c=require("./class-map-C_erArZz.cjs"),d=require("./input-element-BmXkhljw.cjs"),x=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-
|
|
1
|
+
"use strict";const t=require("./element-CJ_QKaki.cjs"),a=require("./if-defined-Bc9-_I01.cjs"),l=require("./state-DSjcvzDN.cjs"),h=require("./ref-BFa5Utho.cjs"),c=require("./class-map-C_erArZz.cjs"),d=require("./input-element-BmXkhljw.cjs"),x=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-DXg2N3wx.cjs");require("./icon-MRx-m0Or.cjs");var $=Object.defineProperty,f=Object.getOwnPropertyDescriptor,r=(u,i,s,n)=>{for(var e=n>1?void 0:n?f(i,s):i,o=u.length-1,p;o>=0;o--)(p=u[o])&&(e=(n?p(i,s,e):p(e))||e);return n&&e&&$(i,s,e),e};exports.PktTextinput=class extends d.PktInputElement{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.value="",this.type="text",this.size=null,this.autocomplete=null,this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0,this.slotController=new x.PktSlotController(this,this.helptextSlot)}attributeChangedCallback(i,s,n){i==="value"&&this.value!==s&&(this.counterCurrent=n?n.length:0,this.valueChanged(n,s)),super.attributeChangedCallback(i,s,n)}updated(i){var s;super.updated(i),i.has("value")&&(this.counterCurrent=((s=this.value)==null?void 0:s.length)||0,this.valueChanged(this.value,i.get("value"))),i.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const i=this.type==="search"&&!this.iconNameRight&&!this.omitSearchIcon,s=c.e({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),n=this.ariaLabelledby||`${this.id}-input-label`;return t.x`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
3
|
label="${this.label}"
|
|
4
4
|
?counter=${this.counter}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "14.0
|
|
3
|
+
"version": "14.1.0",
|
|
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",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
80
80
|
},
|
|
81
81
|
"license": "MIT",
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "5ddba3690f0af28db85f92bd7698af5b54ae8e0b"
|
|
83
83
|
}
|
|
@@ -34,8 +34,8 @@ export const createIconTest = async (config: IconTestConfig = {}) => {
|
|
|
34
34
|
// Cleanup after each test
|
|
35
35
|
afterEach(() => {
|
|
36
36
|
document.body.innerHTML = ''
|
|
37
|
-
// Clean up
|
|
38
|
-
|
|
37
|
+
// Clean up sessionStorage after tests
|
|
38
|
+
sessionStorage.clear()
|
|
39
39
|
// Reset global variables
|
|
40
40
|
delete (window as any).pktFetch
|
|
41
41
|
delete (window as any).pktIconPath
|
|
@@ -145,7 +145,7 @@ describe('PktIcon', () => {
|
|
|
145
145
|
expect(mockFetch).toHaveBeenCalledWith('https://test-cdn.example.com/icons/arrow-right.svg')
|
|
146
146
|
})
|
|
147
147
|
|
|
148
|
-
test('caches loaded icons in
|
|
148
|
+
test('caches loaded icons in sessionStorage', async () => {
|
|
149
149
|
const { icon } = await createIconTest({
|
|
150
150
|
name: 'arrow-right',
|
|
151
151
|
})
|
|
@@ -154,13 +154,13 @@ describe('PktIcon', () => {
|
|
|
154
154
|
// Wait for icon to load
|
|
155
155
|
await new Promise((resolve) => setTimeout(resolve, 100))
|
|
156
156
|
|
|
157
|
-
const cachedIcon =
|
|
157
|
+
const cachedIcon = sessionStorage.getItem('https://test-cdn.example.com/icons/arrow-right.svg')
|
|
158
158
|
expect(cachedIcon).toBe(mockSvgContent)
|
|
159
159
|
})
|
|
160
160
|
|
|
161
161
|
test('uses cached icon when available', async () => {
|
|
162
162
|
// Pre-populate cache
|
|
163
|
-
|
|
163
|
+
sessionStorage.setItem('https://test-cdn.example.com/icons/cached-icon.svg', mockSvgContent)
|
|
164
164
|
|
|
165
165
|
const { icon } = await createIconTest({
|
|
166
166
|
name: 'cached-icon',
|
|
@@ -28,12 +28,12 @@ const downloadIconOrGetFromCache = async (
|
|
|
28
28
|
await sleep(50)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
// Check if
|
|
32
|
-
const
|
|
33
|
-
typeof Storage !== 'undefined' && typeof
|
|
31
|
+
// Check if sessionStorage is available before using it
|
|
32
|
+
const isSessionStorageAvailable =
|
|
33
|
+
typeof Storage !== 'undefined' && typeof sessionStorage !== 'undefined'
|
|
34
34
|
|
|
35
|
-
if (
|
|
36
|
-
return Promise.resolve(
|
|
35
|
+
if (isSessionStorageAvailable && sessionStorage.getItem(path + name + '.svg')) {
|
|
36
|
+
return Promise.resolve(sessionStorage.getItem(path + name + '.svg'))
|
|
37
37
|
} else if (typeof window !== 'undefined' && typeof window.pktFetch === 'function') {
|
|
38
38
|
dlStatus[path + name + '.svg'] = 'fetching'
|
|
39
39
|
return Promise.resolve(
|
|
@@ -49,8 +49,8 @@ const downloadIconOrGetFromCache = async (
|
|
|
49
49
|
}
|
|
50
50
|
})
|
|
51
51
|
.then((text) => {
|
|
52
|
-
if (text !== errorSvg &&
|
|
53
|
-
|
|
52
|
+
if (text !== errorSvg && isSessionStorageAvailable) {
|
|
53
|
+
sessionStorage.setItem(path + name + '.svg', text)
|
|
54
54
|
}
|
|
55
55
|
dlStatus[path + name + '.svg'] = 'fetched'
|
|
56
56
|
return text
|
package/dist/icon-BGuizDwk.cjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";const o=require("./element-CJ_QKaki.cjs"),a=require("./directive-C7oCP5Bh.cjs");/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/class d extends a.i{constructor(t){if(super(t),this.it=o.E,t.type!==a.t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===o.E||t==null)return this._t=void 0,this.it=t;if(t===o.T)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}d.directiveName="unsafeHTML",d.resultType=1;const g=a.e(d);/**
|
|
6
|
-
* @license
|
|
7
|
-
* Copyright 2017 Google LLC
|
|
8
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/class h extends d{}h.directiveName="unsafeSVG",h.resultType=2;const w=a.e(h);var v=Object.defineProperty,y=Object.getOwnPropertyDescriptor,r=(e,t,n,i)=>{for(var s=i>1?void 0:i?y(t,n):t,l=e.length-1,p;l>=0;l--)(p=e[l])&&(s=(i?p(t,n,s):p(s))||s);return i&&s&&v(t,n,s),s};const f="https://punkt-cdn.oslo.kommune.no/latest/icons/";typeof window<"u"&&(window.pktFetch=window.pktFetch===void 0?fetch:window.pktFetch,window.pktIconPath=window.pktIconPath||f);const P=e=>new Promise(t=>setTimeout(t,e)),c='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>',u={},k=async(e,t)=>{let n=0;for(;u[t+e+".svg"]==="fetching"&&(n++,!(n>50));)await P(50);const i=typeof Storage<"u"&&typeof localStorage<"u";return i&&localStorage.getItem(t+e+".svg")?Promise.resolve(localStorage.getItem(t+e+".svg")):typeof window<"u"&&typeof window.pktFetch=="function"?(u[t+e+".svg"]="fetching",Promise.resolve(window.pktFetch(t+e+".svg").then(s=>s.ok?s.text():(console.error("Missing icon: "+t+e+".svg"),c)).then(s=>(s!==c&&i&&localStorage.setItem(t+e+".svg",s),u[t+e+".svg"]="fetched",s)))):Promise.resolve(c)};exports.PktIcon=class extends o.PktElement{constructor(){super(...arguments),this.path=typeof window<"u"?window.pktIconPath:f,this.name="",this.icon=w(c),this._updatedProps=[]}connectedCallback(){super.connectedCallback(),this.classList.add("pkt-icon")}async attributeChangedCallback(t,n,i){super.attributeChangedCallback(t,n,i),(t==="name"||t==="path")&&this.getIcon(this.name)}async updated(t){super.updated(t),(t.has("name")||t.has("path"))&&this.getIcon(this.name)}async getIcon(t=""){this._updatedProps.length>0?(this.path||(this.path=typeof window<"u"?window.pktIconPath:f),this.icon=w(await k(this.name||"",this.path).then(n=>n)),this._updatedProps=[]):this._updatedProps.includes(t)||this._updatedProps.push(t)}render(){return o.x`${this.name&&this.icon}`}};r([o.n({type:String,reflect:!1})],exports.PktIcon.prototype,"path",2);r([o.n({type:String,reflect:!0})],exports.PktIcon.prototype,"name",2);r([o.n({type:SVGElement})],exports.PktIcon.prototype,"icon",2);r([o.n({type:Array,noAccessor:!0})],exports.PktIcon.prototype,"_updatedProps",2);exports.PktIcon=r([o.t("pkt-icon")],exports.PktIcon);exports.o=g;
|