@oslokommune/punkt-elements 19.4.0 → 19.5.1
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 +13 -0
- package/dist/{accordion-CZ0O4c0_.cjs → accordion-5lSFQToJ.cjs} +6 -6
- package/dist/{accordion-DFcdonl-.js → accordion-BJh6X1Ek.js} +6 -6
- package/dist/{alert-BhvjSA5X.js → alert-C0PiYnot.js} +29 -36
- package/dist/alert-IaZzEgyI.cjs +39 -0
- package/dist/{backlink-Bw6IcRIo.cjs → backlink-BRqhwUr2.cjs} +1 -1
- package/dist/{backlink-DIdgvE2j.js → backlink-BslFewn-.js} +1 -1
- package/dist/{breadcrumbs-BfgCx3Xj.js → breadcrumbs-Cr3GugPv.js} +1 -1
- package/dist/{breadcrumbs-C10K1XLP.cjs → breadcrumbs-DG4i5UCh.cjs} +1 -1
- package/dist/{button-B5rWxfei.js → button-B78im4wB.js} +16 -16
- package/dist/button-BNVTj7nB.cjs +32 -0
- package/dist/{calendar-U8xkRdgF.js → calendar-BLaRXUBl.js} +1 -1
- package/dist/{calendar-D-Ow5DAp.cjs → calendar-TcxvS-1_.cjs} +1 -1
- package/dist/{card-D2YYPZr5.js → card-CYKhPUNI.js} +12 -12
- package/dist/{card-DW1uklP6.cjs → card-CaLEuumN.cjs} +10 -10
- package/dist/{checkbox-C0zLtnCI.cjs → checkbox-DIyi1Cya.cjs} +1 -1
- package/dist/{checkbox-B2O0fkh9.js → checkbox-DKeErDb5.js} +1 -1
- package/dist/{combobox-DpXTwNr4.js → combobox-BKnHg_-E.js} +30 -30
- package/dist/{combobox-BgduqUpf.cjs → combobox-C7FUvv5T.cjs} +22 -22
- package/dist/components/alert/alert.d.ts +0 -2
- package/dist/{consent-CbJG04C1.js → consent-CleJMbVH.js} +1 -1
- package/dist/{consent-DxpJLExu.cjs → consent-Dl-R0iC3.cjs} +1 -1
- package/dist/{datepicker-BLBimRTT.js → datepicker-COFEJpB4.js} +10 -10
- package/dist/{datepicker-53rj_Qqx.cjs → datepicker-CeUpoQuG.cjs} +27 -27
- package/dist/directives/slot-content.d.ts +36 -1
- package/dist/element-with-slot-D7sTqOr3.cjs +1 -0
- package/dist/{element-with-slot-FD826ooP.js → element-with-slot-DQv0cbbD.js} +80 -21
- package/dist/{fileupload-BxfBFhFt.js → fileupload-CUPl41uN.js} +32 -32
- package/dist/{fileupload-4wgr4iAi.cjs → fileupload-CaZGBvZr.cjs} +21 -21
- package/dist/{footer-CBkKAuvh.js → footer-DdLls3F-.js} +14 -14
- package/dist/{footer-DOp_9VdY.cjs → footer-vy9NqT65.cjs} +9 -9
- package/dist/{header-Cs4t2XMM.cjs → header-CgP3-6-b.cjs} +50 -50
- package/dist/{header-CF-Re0nT.js → header-Cq6INZmI.js} +56 -56
- package/dist/{header-menu-C9k9xG9V.js → header-menu-ANj5nL2M.js} +2 -2
- package/dist/{header-menu-BnqZagI6.cjs → header-menu-BfkCp8jw.cjs} +1 -1
- package/dist/{heading-BRHCV_5J.js → heading-CUrZvkrM.js} +1 -1
- package/dist/{heading-u9Arof4p.cjs → heading-zoz-QZJ9.cjs} +1 -1
- package/dist/{helptext-DYgeTMtA.cjs → helptext-BCkwSz1m.cjs} +2 -2
- package/dist/{helptext-sRC8EJqL.js → helptext-DCT_9dw1.js} +2 -2
- package/dist/icon-Dnv6LtPC.cjs +1 -0
- package/dist/{icon-DmRyYNlY.js → icon-JigbxxF7.js} +16 -12
- package/dist/{input-element-B1BntJeJ.js → input-element-5hsxasU3.js} +1 -1
- package/dist/{input-element-W6Gklt2E.cjs → input-element-Ctkz5fQk.cjs} +1 -1
- package/dist/{input-wrapper-CSPPa4uc.cjs → input-wrapper-Cf__-4E-.cjs} +28 -28
- package/dist/{input-wrapper-C1zXIKBU.js → input-wrapper-DACDx6Ie.js} +45 -45
- package/dist/{link-DcxVUj8s.js → link-CmZwAw5u.js} +2 -2
- package/dist/link-LO_5_La8.cjs +7 -0
- package/dist/{linkcard-MJFR7FLT.js → linkcard-CQluSyJJ.js} +8 -8
- package/dist/{linkcard-CWeR6t2a.cjs → linkcard-UKsxADrP.cjs} +3 -3
- package/dist/{listbox-DEzd-dxF.js → listbox-Ct9jIV_5.js} +8 -8
- package/dist/{listbox-BoBwzL4p.cjs → listbox-g-vHHLkD.cjs} +20 -20
- package/dist/{loader-SJ6NauNT.cjs → loader-C_PH05aw.cjs} +2 -2
- package/dist/{loader-CqFQoJlM.js → loader-DzctJ9jW.js} +2 -2
- package/dist/{messagebox-DsKi_rKn.js → messagebox-DPFBuisE.js} +2 -2
- package/dist/messagebox-JWKMJEFc.cjs +13 -0
- package/dist/{modal-DaerHpVi.cjs → modal-BymjMIJi.cjs} +2 -2
- package/dist/{modal-CJqe6y-V.js → modal-CELmA0-8.js} +2 -2
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.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-breadcrumbs.cjs +1 -1
- package/dist/pkt-breadcrumbs.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-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.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 +1 -1
- package/dist/pkt-fileupload.cjs +1 -1
- package/dist/pkt-fileupload.js +1 -1
- package/dist/pkt-footer.cjs +1 -1
- package/dist/pkt-footer.js +1 -1
- package/dist/pkt-header-menu.cjs +1 -1
- package/dist/pkt-header-menu.js +1 -1
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +1 -1
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +1 -1
- 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 +34 -34
- 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-listbox.cjs +1 -1
- package/dist/pkt-listbox.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-options-controller-Dz-rYCG1.cjs → pkt-options-controller-CpEZcomb.cjs} +1 -1
- package/dist/{pkt-options-controller-sUzxHa5A.js → pkt-options-controller-D7l18Iw0.js} +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +1 -1
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-searchinput.cjs +1 -1
- package/dist/pkt-searchinput.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.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/pkt-timepicker.cjs +1 -1
- package/dist/pkt-timepicker.js +1 -1
- package/dist/{progressbar-BrVlAcQI.cjs → progressbar-CIXNSwTy.cjs} +2 -3
- package/dist/{progressbar-Bd0DjiAb.js → progressbar-DH5lIBpx.js} +6 -4
- package/dist/{radiobutton-B0V-jSEX.js → radiobutton-DP791tUe.js} +1 -1
- package/dist/{radiobutton-Cv1BlwLV.cjs → radiobutton-oEYrBiT6.cjs} +1 -1
- package/dist/{searchinput-7-VVdkss.cjs → searchinput-CbClDE-d.cjs} +1 -1
- package/dist/{searchinput-CgzigmiI.js → searchinput-Co8tcq-l.js} +1 -1
- package/dist/{select-BbcGPmPs.js → select-B97S4g1v.js} +18 -18
- package/dist/{select---PCiwmy.cjs → select-QobXCtIL.cjs} +13 -13
- package/dist/shared-types/icon.d.ts +39 -0
- package/dist/shared-types/index.d.ts +2 -0
- package/dist/{tabs-B134M9k2.js → tabs-B8blHQrL.js} +18 -18
- package/dist/{tabs-Dw9E06fL.cjs → tabs-CjX-GWvM.cjs} +15 -15
- package/dist/tag-B5dUg7AD.cjs +27 -0
- package/dist/{tag-wYnHhHLK.js → tag-Bns7Xj1O.js} +11 -11
- package/dist/{textarea-BcgVLLTt.js → textarea-DgW0hRV5.js} +17 -17
- package/dist/{textarea-pA_xv8lI.cjs → textarea-ZMbtZNp3.cjs} +10 -10
- package/dist/{textinput-Czz2affL.cjs → textinput-DfT_1aGb.cjs} +10 -10
- package/dist/{textinput-Dpj1X5yr.js → textinput-s-qz2xSC.js} +15 -15
- package/dist/{timepicker-BwDZkSpo.cjs → timepicker-BAa_VEnf.cjs} +10 -10
- package/dist/{timepicker-CfQMZlaP.js → timepicker-Crj4isb9.js} +16 -16
- package/package.json +2 -2
- package/src/components/alert/alert.test.ts +15 -0
- package/src/components/alert/alert.ts +0 -12
- package/src/components/combobox/combobox.ts +3 -3
- package/src/components/datepicker/datepicker.ts +5 -5
- package/src/components/helptext/helptext-association.test.ts +79 -0
- package/src/components/icon/icon.ts +6 -6
- package/src/components/input-wrapper/input-wrapper.test.ts +49 -0
- package/src/components/input-wrapper/input-wrapper.ts +6 -4
- package/src/components/progressbar/progressbar.test.ts +19 -0
- package/src/components/progressbar/progressbar.ts +2 -6
- package/src/components/select/select.ts +3 -3
- package/src/components/textarea/textarea.ts +3 -3
- package/src/components/textinput/textinput.ts +3 -3
- package/src/components/timepicker/timepicker.ts +3 -3
- package/dist/alert-D1bQjZ7C.cjs +0 -40
- package/dist/button-CmNrMH-c.cjs +0 -32
- package/dist/element-with-slot-2PHu2w7O.cjs +0 -1
- package/dist/icon-CoBsgGUR.cjs +0 -1
- package/dist/link-EMsHusF7.cjs +0 -7
- package/dist/messagebox-D5GYIdjE.cjs +0 -13
- package/dist/tag-HTYKd-iG.cjs +0 -27
package/dist/button-CmNrMH-c.cjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),n=require("./if-defined-2mkIDgOm.cjs"),r=require("./element-with-slot-2PHu2w7O.cjs");require("./icon-CoBsgGUR.cjs");var i=`https://punkt-cdn.oslo.kommune.no/latest/animations/`;typeof window<`u`&&(window.pktAnimationPath=window.pktAnimationPath||i);var a=class a extends r.t{constructor(...e){super(...e),this.iconName=`user`,this.secondIconName=`user`,this.size=`medium`,this.fullWidth=!1,this.fullWidthOnMobile=!1,this.skin=`primary`,this.variant=`label-only`,this.state=void 0,this.type=`button`,this.form=void 0,this.isLoading=!1,this.disabled=!1,this.loadingAnimationPath=typeof window<`u`?window.pktAnimationPath:i,this.relocatedAria={}}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)}static{this.relocatedAriaAttributes=[`aria-haspopup`,`aria-expanded`,`aria-controls`,`aria-label`,`tabindex`]}willUpdate(e){super.willUpdate(e);let t=!1,n={...this.relocatedAria};for(let e of a.relocatedAriaAttributes){let r=this.getAttribute(e);r!==null&&(n[e]=r,this.removeAttribute(e),t=!0)}t&&(this.relocatedAria=n)}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,a={"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--isLoading":!!this.isLoading};return e._`
|
|
2
|
-
<button
|
|
3
|
-
class=${t.t(a)}
|
|
4
|
-
type=${this.type}
|
|
5
|
-
?disabled=${!!this.disabled}
|
|
6
|
-
aria-busy=${n.t(this.isLoading?`true`:void 0)}
|
|
7
|
-
aria-disabled=${n.t(this.disabled||this.isLoading?`true`:void 0)}
|
|
8
|
-
aria-haspopup=${n.t(this.relocatedAria[`aria-haspopup`])}
|
|
9
|
-
aria-expanded=${n.t(this.relocatedAria[`aria-expanded`])}
|
|
10
|
-
aria-controls=${n.t(this.relocatedAria[`aria-controls`])}
|
|
11
|
-
aria-label=${n.t(this.relocatedAria[`aria-label`])}
|
|
12
|
-
tabindex=${n.t(this.relocatedAria.tabindex)}
|
|
13
|
-
form=${n.t(i)}
|
|
14
|
-
>
|
|
15
|
-
${this.isLoading?e._`<pkt-icon
|
|
16
|
-
class="pkt-btn__icon pkt-btn__spinner"
|
|
17
|
-
name="spinner-blue"
|
|
18
|
-
path=${n.t(this.loadingAnimationPath)}
|
|
19
|
-
></pkt-icon>`:e.h}
|
|
20
|
-
${this.variant===`label-only`?e.h:e._`<pkt-icon
|
|
21
|
-
class="pkt-btn__icon pkt-icon"
|
|
22
|
-
name=${this.iconName}
|
|
23
|
-
path=${n.t(this.iconPath)}
|
|
24
|
-
></pkt-icon>`}
|
|
25
|
-
<span class="pkt-btn__text">${r.r(this)}</span>
|
|
26
|
-
${this.variant===`icons-right-and-left`?e._`<pkt-icon
|
|
27
|
-
class="pkt-btn__icon"
|
|
28
|
-
name=${this.secondIconName}
|
|
29
|
-
path=${n.t(this.secondIconPath)}
|
|
30
|
-
></pkt-icon>`:e.h}
|
|
31
|
-
</button>
|
|
32
|
-
`}};e.n([e.u({type:String})],a.prototype,`iconName`,void 0),e.n([e.u({type:String})],a.prototype,`secondIconName`,void 0),e.n([e.u({type:String})],a.prototype,`iconPath`,void 0),e.n([e.u({type:String})],a.prototype,`secondIconPath`,void 0),e.n([e.u({type:String})],a.prototype,`size`,void 0),e.n([e.u({type:Boolean,attribute:`full-width`})],a.prototype,`fullWidth`,void 0),e.n([e.u({type:Boolean,attribute:`full-width-on-mobile`})],a.prototype,`fullWidthOnMobile`,void 0),e.n([e.u({type:String})],a.prototype,`color`,void 0),e.n([e.u({type:String})],a.prototype,`skin`,void 0),e.n([e.u({type:String})],a.prototype,`variant`,void 0),e.n([e.u({type:String,reflect:!0})],a.prototype,`state`,void 0),e.n([e.u({type:String,reflect:!0})],a.prototype,`type`,void 0),e.n([e.u({type:String})],a.prototype,`form`,void 0),e.n([e.u({type:Boolean,reflect:!0})],a.prototype,`isLoading`,void 0),e.n([e.u({type:Boolean,reflect:!0})],a.prototype,`disabled`,void 0),e.n([e.u({type:String})],a.prototype,`loadingAnimationPath`,void 0),e.n([e.l()],a.prototype,`relocatedAria`,void 0);try{e.d(`pkt-button`)(a)}catch{console.warn(`Forsøker å definere <pkt-button>, men den er allerede definert`)}var o=a;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./element-BOmr9YLv.cjs"),t=require("./async-directive-BGoo_npW.cjs");function n(e){return e.classList&&(e.classList.contains(`_dialog_overlay`)||e.classList.contains(`backdrop`))?!0:typeof e.hasAttribute==`function`&&e.hasAttribute(`data-skip`)}function r(e){return e.nodeName===`OPTION`||e.nodeName===`DATA`}function i(e){return e.nodeType===Node.TEXT_NODE&&e.nodeValue?.trim()!==``}var a=new WeakMap;function o(e){let t=a.get(e);return t||(t=new d(e),a.set(e,t)),t}var s=Symbol(`default`);function c(e){return e===void 0?s:e}function l(e,t){if(e.nodeType===Node.COMMENT_NODE)return!1;if(e.nodeType===Node.TEXT_NODE)return i(e)?(u(t,s,e),!0):!1;if(e.nodeType===Node.ELEMENT_NODE){let i=e;if(n(i)||r(i))return!1;if(i instanceof HTMLTemplateElement){let e=Array.from(i.content.childNodes),n=c(i.getAttribute(`slot`)??void 0);for(let r of e)u(t,n,r);return!0}let a=i.getAttribute(`slot`);return u(t,a===null?s:c(a),e),!0}return!1}function u(e,t,n){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}var d=class e{static{this.PLACEHOLDER_PREFIX=`pkt-slot`}constructor(e){this.observer=null,this.nodesBySlot=new Map,this.directives=new Set,this.observing=!1,this.trackedNodes=new Set,this.generation=0,this.initialCollectionDone=!1,this.processingMutations=!1,this.placeholderToNode=new Map,this.nodeToPlaceholder=new Map,this.host=e}collectNodes(){if(this.initialCollectionDone)return;this.initialCollectionDone=!0,this.generation++;let e=Array.from(this.host.childNodes);for(let t of e)l(t,this.nodesBySlot)&&this.trackedNodes.add(t)}addDirective(e){this.directives.add(e),this.startObserving()}removeDirective(e){this.directives.delete(e),this.directives.size===0&&this.stopObserving()}getNodes(e){return this.nodesBySlot.get(c(e))??[]}hasContent(e){return this.getNodes(e).length>0}ensurePlaceholder(t){if(this.nodeToPlaceholder.has(t)||t.parentNode!==this.host)return;let n=document.createComment(e.PLACEHOLDER_PREFIX);this.host.insertBefore(n,t),this.placeholderToNode.set(n,t),this.nodeToPlaceholder.set(t,n)}startObserving(){this.observing||(this.observing=!0,setTimeout(()=>{this.observing&&(this.observer=new MutationObserver(e=>{this.handleMutations(e)}),this.observer.observe(this.host,{childList:!0}))},0))}stopObserving(){this.observing&&(this.observing=!1,this.observer?.disconnect(),this.observer=null)}handleMutations(e){if(this.processingMutations)return;this.processingMutations=!0;let t=!1;for(let n of e)if(n.target===this.host){for(let e of n.removedNodes){let n=this.placeholderToNode.get(e);if(n){n.parentNode?.removeChild(n),this.trackedNodes.delete(n),this.removeFromSlots(n),this.placeholderToNode.delete(e),this.nodeToPlaceholder.delete(n),t=!0;continue}if(this.trackedNodes.has(e)){this.trackedNodes.delete(e),this.removeFromSlots(e);let n=this.nodeToPlaceholder.get(e);n&&(n.parentNode?.removeChild(n),this.placeholderToNode.delete(n),this.nodeToPlaceholder.delete(e)),t=!0}}for(let e of n.addedNodes)this.placeholderToNode.has(e)||!this.trackedNodes.has(e)&&this.isUserContent(e)&&l(e,this.nodesBySlot)&&(this.trackedNodes.add(e),t=!0)}t&&(this.generation++,this.notifyDirectives()),this.observer?.takeRecords(),this.processingMutations=!1}isUserContent(e){if(e.nodeType===Node.COMMENT_NODE)return!1;if(e.nodeType===Node.TEXT_NODE)return i(e);if(e.nodeType===Node.ELEMENT_NODE){let t=e;return!(n(t)||r(t))}return!1}removeFromSlots(e){for(let[t,n]of this.nodesBySlot){let r=n.indexOf(e);if(r!==-1){n.splice(r,1),n.length===0&&this.nodesBySlot.delete(t);return}}}notifyDirectives(){for(let e of this.directives)e.handleNodesChanged()}},f=class extends t.t{constructor(t){if(super(t),this.manager=null,this.lastGeneration=-1,t.type!==e.m.CHILD)throw Error(`slotContent() can only be used in child expressions`)}render(t,n){return e.g}update(e,[t,n]){return this.slotName=n,this.manager||(this.manager=o(t),this.manager.collectNodes(),this.manager.addDirective(this)),this.ensurePlaceholders(),this.getNodesOrNoChange()}handleNodesChanged(){if(!this.isConnected||!this.manager)return;this.ensurePlaceholders();let t=this.getNodesOrNoChange();t!==e.g&&this.setValue(t)}ensurePlaceholders(){if(!this.manager)return;let e=this.manager.getNodes(this.slotName);for(let t of e)this.manager.ensurePlaceholder(t)}disconnected(){this.manager?.removeDirective(this),this.manager=null,this.lastGeneration=-1}reconnected(){}getNodesOrNoChange(){if(!this.manager)return e.g;let t=this.manager.generation;return t===this.lastGeneration?e.g:(this.lastGeneration=t,this.manager.getNodes(this.slotName))}},p=e.f(f),m=class extends e.t{connectedCallback(){o(this).collectNodes(),super.connectedCallback()}hasSlotContent(e){return o(this).hasContent(e)}};Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return m}});
|
package/dist/icon-CoBsgGUR.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./element-BOmr9YLv.cjs");var t=class extends e.p{constructor(t){if(super(t),this.it=e.h,t.type!==e.m.CHILD)throw Error(this.constructor.directiveName+`() can only be used in child bindings`)}render(t){if(t===e.h||t==null)return this._t=void 0,this.it=t;if(t===e.g)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;let n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}};t.directiveName=`unsafeHTML`,t.resultType=1;var n=e.f(t),r=class extends t{};r.directiveName=`unsafeSVG`,r.resultType=2;var i=e.f(r),a=`https://punkt-cdn.oslo.kommune.no/latest/icons/`;typeof window<`u`&&(window.pktFetch=window.pktFetch===void 0?fetch:window.pktFetch,window.pktIconPath=window.pktIconPath||a);var o=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>`,s={},c=2,l=1500,u=typeof Storage<`u`&&typeof sessionStorage<`u`,d=e=>window.pktFetch(e).then(t=>{if(!t.ok)throw Error(`Missing icon: `+e);return t.text()}),f=async(e,t=c)=>{try{return await d(e)}catch{return t>0?(await new Promise(e=>setTimeout(e,l)),f(e,t-1)):(console.error(`Failed to fetch icon: `+e),o)}},p=async(e,t)=>{let n=t+e+`.svg`;return u&&sessionStorage.getItem(n)?sessionStorage.getItem(n):n in s?s[n]:typeof window<`u`&&typeof window.pktFetch==`function`?(s[n]=f(n).then(e=>(e!==o&&u&&sessionStorage.setItem(n,e),delete s[n],e)),s[n]):o},m=class extends e.t{constructor(...e){super(...e),this.path=typeof window<`u`?window.pktIconPath:a,this.name=``,this.ariaHidden=null,this.ariaLabel=null,this.icon=i(o),this._updatedProps=[]}get effectiveAriaHidden(){return this.ariaHidden!==null&&this.ariaHidden!==void 0?this.ariaHidden===``||this.ariaHidden===`true`:!this.ariaLabel}get effectiveAriaLabel(){return this.effectiveAriaHidden?null:this.ariaLabel||this.name||null}connectedCallback(){super.connectedCallback(),this.classList.add(`pkt-icon`)}async attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),(e===`name`||e===`path`)&&this.getIcon(this.name)}async updated(e){super.updated(e),(e.has(`name`)||e.has(`path`))&&this.getIcon(this.name),this.applyAriaToSvg()}applyAriaToSvg(){let e=this.querySelector(`svg`);if(!e)return;e.setAttribute(`aria-hidden`,String(this.effectiveAriaHidden));let t=this.effectiveAriaLabel;t?e.setAttribute(`aria-label`,t):e.removeAttribute(`aria-label`)}async getIcon(e=``){if(this._updatedProps.length>0){this.path||=typeof window<`u`?window.pktIconPath:a;try{this.icon=i(await p(this.name||``,this.path))}catch{this.icon=i(o)}this._updatedProps=[]}else this._updatedProps.includes(e)||this._updatedProps.push(e)}render(){return e._`${this.name&&this.icon}`}};e.n([e.u({type:String,reflect:!1})],m.prototype,`path`,void 0),e.n([e.u({type:String,reflect:!0})],m.prototype,`name`,void 0),e.n([e.u({type:String,attribute:`aria-hidden`,reflect:!0})],m.prototype,`ariaHidden`,void 0),e.n([e.u({type:String,attribute:`aria-label`,reflect:!0})],m.prototype,`ariaLabel`,void 0),e.n([e.u({type:SVGElement})],m.prototype,`icon`,void 0),e.n([e.u({type:Array,noAccessor:!0})],m.prototype,`_updatedProps`,void 0);try{e.d(`pkt-icon`)(m)}catch{console.warn(`Forsøker å definere <pkt-icon>, men den er allerede definert`)}var h=m;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
|
package/dist/link-EMsHusF7.cjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),n=require("./element-with-slot-2PHu2w7O.cjs"),r=require("./define-component-spec-DBNd2FJY.cjs");require("./icon-CoBsgGUR.cjs");var i={href:{type:`string`,description:`Mål-URL for lenken.`,required:!0,reactOnly:!0},className:{type:`string`,description:`CSS-klasser Punkt har satt på lenken.`,required:!0,reactOnly:!0},children:{type:`ReactNode`,description:`Innhold/label som skal rendres inni lenken.`,required:!0,reactOnly:!0},props:{type:`AnchorHTMLAttributes<HTMLAnchorElement>`,description:`Resten av anchor-attributter (f.eks. <code>onClick</code>, <code>aria-*</code>) som skal spreades på lenken.`,required:!0,reactOnly:!0}},a={name:`Egendefinert lenkekomponent`,description:`React: Funksjon for å rendre en egendefinert lenkekomponent (f.eks. Next.js Link eller React Router Link). Mottar et <code>IRenderLink</code>-objekt med href, className, children og props. Standard er et vanlig <code><a></code>-element.`,type:`(args: IRenderLink) => ReactNode`,relatedTypes:[`IRenderLink`],category:`tech`,reactOnly:!0},o={IRenderLink:{title:`IRenderLink`,description:`Objektet som sendes til <code>renderLink</code> i Link, BackLink og Breadcrumbs. Kun React — brukes til å bytte ut standard <code><a></code> med f.eks. Next.js Link eller React Router Link.`,properties:i}},s=r.t({name:`pkt-link`,react:`PktLink`,"css-class":`pkt-link`,"dark-mode":!0,isElement:!0,props:{href:{name:`URL`,description:`URL til lenken`,type:`string`,default:`#`,category:`contents`},target:{name:`Mål`,description:`Mål for lenken`,type:[`_blank`,`_self`,`_parent`,`_top`],default:`_self`,category:`tech`},iconName:{name:`Ikon`,description:`Ikon som skal vises ved siden av lenketeksten`,type:`icon`,category:`ui`},iconPosition:{name:`Ikonposisjon`,description:`Posisjonen til ikonet i forhold til lenketeksten`,type:[`left`,`right`],category:`ui`},renderLink:a},types:{...o},slots:{default:{description:`Innholdet i lenken`}}}).props,c=class extends n.t{constructor(...e){super(...e),this.href=s.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=!1,this.target=s.target.default}render(){let r={"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},i=this.target&&this.target!==`_self`?this.target:e.h;return e._`<a
|
|
2
|
-
class=${t.t(r)}
|
|
3
|
-
href=${this.href}
|
|
4
|
-
target=${i}
|
|
5
|
-
.rel=${this.external?`noopener noreferrer`:e.h}
|
|
6
|
-
>${this.iconName?e._`<pkt-icon name=${this.iconName} class="pkt-link__icon"></pkt-icon>`:``}${n.r(this)}</a
|
|
7
|
-
>`}};e.n([e.u({type:String,reflect:!0})],c.prototype,`href`,void 0),e.n([e.u({type:String,reflect:!0})],c.prototype,`iconName`,void 0),e.n([e.u({type:String,reflect:!0})],c.prototype,`iconPosition`,void 0),e.n([e.u({type:Boolean,reflect:!0})],c.prototype,`external`,void 0),e.n([e.u({type:String,reflect:!0})],c.prototype,`target`,void 0);try{e.d(`pkt-link`)(c)}catch{console.warn(`Forsøker å definere <pkt-link>, men den er allerede definert`)}var l=c;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),n=require("./element-with-slot-2PHu2w7O.cjs"),r=require("./classutils-CbklAJDe.cjs");require("./icon-CoBsgGUR.cjs");var i={name:`pkt-messagebox`,react:`PktMessagebox`,"css-class":`pkt-messagebox`,isElement:!0,isPureReact:!0,events:{onClose:{description:`React: Event som trigges når meldingsboksen lukkes`},"on-close":{description:`Elements: Event som trigges når meldingsboksen lukkes`}},props:{title:{name:`Tittel`,description:`Tittelen på meldingsboksen`,type:`string`,category:`contents`},skin:{name:`Utseende`,description:`Velg farge på meldingsboksen`,type:[`beige`,`blue`,`red`,`green`],category:`ui`,default:`beige`},compact:{name:`Kompakt`,description:`Gjør meldingsboksen mindre`,type:`boolean`,category:`ui`,default:!1},closable:{name:`Kan lukkes`,description:`Viser lukkeknapp`,type:`boolean`,category:`ui`,default:!1}},slots:{default:{description:`Innholdet i meldingsboksen`}}},a=class extends n.t{constructor(){super(),this.closable=i.props.closable.default,this.compact=i.props.compact.default,this.title=``,this.skin=void 0,this._isClosed=!1,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent(`close`,{detail:{origin:e},bubbles:!0})),this.dispatchEvent(new CustomEvent(`on-close`,{detail:{origin:e},bubbles:!0}))},this._isClosed=!1}updated(e){super.updated(e),e.has(`_isClosed`)&&r.t(this,`pkt-hide`,this._isClosed)}render(){let r={"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:!!this.skin,"pkt-messagebox--closable":this.closable,"pkt-hide":this._isClosed};return e._`<div class=${t.t(r)}>
|
|
2
|
-
${this.closable?e._`<div class="pkt-messagebox__close">
|
|
3
|
-
<button
|
|
4
|
-
@click=${this.close}
|
|
5
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
|
|
6
|
-
aria-label=${this.pktStrings.get(`generic`).close}
|
|
7
|
-
>
|
|
8
|
-
<pkt-icon name="close" class="pkt-link__icon"></pkt-icon>
|
|
9
|
-
</button>
|
|
10
|
-
</div>`:e.h}
|
|
11
|
-
${this.title?e._`<div class="pkt-messagebox__title">${this.title}</div>`:e.h}
|
|
12
|
-
<div class="pkt-messagebox__text">${n.r(this)}</div>
|
|
13
|
-
</div>`}};e.n([e.u({type:Boolean,reflect:!0})],a.prototype,`closable`,void 0),e.n([e.u({type:Boolean,reflect:!0})],a.prototype,`compact`,void 0),e.n([e.u({type:String,reflect:!0})],a.prototype,`title`,void 0),e.n([e.u({type:String,reflect:!0})],a.prototype,`skin`,void 0),e.n([e.l()],a.prototype,`_isClosed`,void 0);try{e.d(`pkt-messagebox`)(a)}catch{console.warn(`Forsøker å definere <pkt-messagebox>, men den er allerede definert`)}var o=a;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
|
package/dist/tag-HTYKd-iG.cjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),n=require("./if-defined-2mkIDgOm.cjs"),r=require("./format-B8meU8Tm.cjs"),i=require("./element-with-slot-2PHu2w7O.cjs");require("./icon-CoBsgGUR.cjs");var a={name:`pkt-tag`,react:`PktTag`,"css-class":`pkt-tag`,isElement:!0,"dark-mode":!0,props:{size:{name:`Størrelse`,description:`Størrelsen på taggen`,required:!1,default:`medium`,type:[`small`,`medium`,`large`],category:`ui`},iconName:{name:`Ikon`,description:`Navnet på ikonet som skal vises i taggen`,type:`icon`,required:!1,category:`ui`},skin:{name:`Utseende`,description:`Utseendet til taggen`,required:!1,default:`blue`,type:[`blue`,`blue-light`,`blue-dark`,`green`,`red`,`beige`,`yellow`,`gray`],category:`ui`},closeTag:{name:`Lukk tag`,description:`Skal taggen ha en lukkeknapp?`,type:`boolean`,required:!1,default:!1,category:`ui`},textStyle:{name:`Tekststil`,description:`Stilen på teksten i taggen`,required:!1,default:`normal-text`,type:[`thin-text`,`normal-text`],category:`ui`},type:{name:`Type, dersom lukkeknapp`,description:`Type tag, brukes for å spesifisere om det er en knapp, submit eller reset`,required:!1,default:`button`,type:[`button`,`submit`,`reset`],category:`tech`},ariaLabel:{name:`aria-label`,description:`aria-label for taggen, brukes for tilgjengelighet`,type:`string`,required:!1,category:`accessibility`}},slots:{default:{description:`Teksten til tag`}}},o=class extends i.t{constructor(){super(),this.closeTag=a.props.closeTag.default,this.size=a.props.size.default,this.skin=a.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=a.props.type.default,this.ariaLabel=null,this.buttonTabindex=void 0,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent(`close`,{detail:{origin:e},bubbles:!1,composed:!0})),this.dispatchEvent(new CustomEvent(`on-close`,{detail:{origin:e},bubbles:!1,composed:!0}))},this._isClosed=!1}willUpdate(e){if(super.willUpdate(e),this.closeTag&&!this.ariaLabel){let e=i.n(this).getNodes().map(e=>e.textContent??``).join(``).trim();e&&(this._ariaDescription=r.t(this.pktStrings.get(`tag`).remove,{label:e}))}}render(){let r={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},a={"pkt-tag":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-hide":this._isClosed};return this.closeTag?e._`
|
|
2
|
-
<button
|
|
3
|
-
class=${t.t(a)}
|
|
4
|
-
type=${this.type}
|
|
5
|
-
tabindex=${n.t(this.buttonTabindex)}
|
|
6
|
-
@click=${this.close}
|
|
7
|
-
aria-label=${n.t(this.ariaLabel||void 0)}
|
|
8
|
-
aria-description=${n.t(this._ariaDescription||void 0)}
|
|
9
|
-
>
|
|
10
|
-
${this.iconName&&e._`<pkt-icon
|
|
11
|
-
class="pkt-tag__icon"
|
|
12
|
-
name=${this.iconName}
|
|
13
|
-
aria-hidden="true"
|
|
14
|
-
></pkt-icon>`}
|
|
15
|
-
<span>${i.r(this)}</span>
|
|
16
|
-
<pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
|
|
17
|
-
</button>
|
|
18
|
-
`:e._`
|
|
19
|
-
<span class=${t.t(r)}>
|
|
20
|
-
${this.iconName&&e._`<pkt-icon
|
|
21
|
-
class="pkt-tag__icon"
|
|
22
|
-
name=${this.iconName}
|
|
23
|
-
aria-hidden="true"
|
|
24
|
-
></pkt-icon>`}
|
|
25
|
-
<span>${i.r(this)}</span>
|
|
26
|
-
</span>
|
|
27
|
-
`}};e.n([e.u({type:Boolean,reflect:!0})],o.prototype,`closeTag`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`size`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`skin`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`textStyle`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`iconName`,void 0),e.n([e.u({type:String})],o.prototype,`type`,void 0),e.n([e.u({type:String})],o.prototype,`ariaLabel`,void 0),e.n([e.u({type:Number,attribute:`button-tabindex`})],o.prototype,`buttonTabindex`,void 0),e.n([e.l()],o.prototype,`_isClosed`,void 0),e.n([e.l()],o.prototype,`_ariaDescription`,void 0);try{e.d(`pkt-tag`)(o)}catch{console.warn(`Forsøker å definere <pkt-tag>, men den er allerede definert`)}var s=o;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|