@oslokommune/punkt-react 13.18.2 → 13.18.3
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/dist/punkt-react.es.js
CHANGED
|
@@ -3487,9 +3487,9 @@ let Gt = class extends K {
|
|
|
3487
3487
|
constructor() {
|
|
3488
3488
|
super(), this.defaultSlot = A(), this.closeTag = Gi.props.closeTag.default, this.size = Gi.props.size.default, this.skin = Gi.props.skin.default, this.textStyle = null, this.iconName = void 0, this.type = Gi.props.type.default, this.ariaLabel = null, this._isClosed = !1, this._ariaDescription = null, this.close = (t) => {
|
|
3489
3489
|
this._isClosed = !0, this.dispatchEvent(
|
|
3490
|
-
new CustomEvent("close", { detail: { origin: t }, bubbles: !
|
|
3490
|
+
new CustomEvent("close", { detail: { origin: t }, bubbles: !1, composed: !0 })
|
|
3491
3491
|
), this.dispatchEvent(
|
|
3492
|
-
new CustomEvent("on-close", { detail: { origin: t }, bubbles: !
|
|
3492
|
+
new CustomEvent("on-close", { detail: { origin: t }, bubbles: !1, composed: !0 })
|
|
3493
3493
|
);
|
|
3494
3494
|
}, this.slotController = new rt(this, this.defaultSlot), this._isClosed = !1;
|
|
3495
3495
|
}
|
package/dist/punkt-react.umd.js
CHANGED
|
@@ -308,7 +308,7 @@
|
|
|
308
308
|
</div>
|
|
309
309
|
</td>`),d++):(g.push(this.renderDayView(d,t)),d++);p.push(u`<tr class="pkt-cal-week-row" role="row">
|
|
310
310
|
${g}
|
|
311
|
-
</tr>`)}return p}isExcluded(t){const e=this.excludedates.map(i=>typeof i=="string"?i:nt(i));return!Ha(t,this.earliest,this.latest,e,this.excludeweekdays)}isPrevMonthAllowed(){const t=be(this.year,this.month,0);return!(this.earliest&&re(this.earliest)>t)}prevMonth(){const t=this.month===0?11:this.month-1,e=this.month===0?this.year-1:this.year;this.changeMonth(e,t)}isNextMonthAllowed(){const t=be(this.month===11?this.year+1:this.year,this.month===11?0:this.month+1,1);return!(this.latest&&re(this.latest)<t)}nextMonth(){const t=this.month===11?0:this.month+1,e=this.month===11?this.year+1:this.year;this.changeMonth(e,t)}changeMonth(t,e){this.year=typeof t=="string"?parseInt(t):t,this.month=typeof e=="string"?parseInt(e):e,this.currentmonth=Ts(new Date(this.year,this.month,1)),this.tabIndexSet=0,this.focusedDate=null,this.selectableDates=[]}isRangeAllowed(t){let e=!0;if(this._selected.length===1){const i=Ci({start:this._selected[0],end:t});if(Array.isArray(i)&&i.length)for(let a=0;a<i.length;a++)this.excludedates.forEach(n=>{n>this._selected[0]&&n<t&&(e=!1)}),this.excludeweekdays.includes(jo(i[a]).toString())&&(e=!1)}return e}emptySelected(){this.selected=[],this._selected=[],this.inRange={}}addToSelected(t){this.selected.includes(nt(t))||(this.selected=[...this.selected,nt(t)],this._selected=[...this._selected,t],this.range&&this.selected.length===2&&(this.convertSelected(),this.close()))}removeFromSelected(t){if(this.selected.length===1)this.emptySelected();else{const e=this.selected.indexOf(nt(t)),i=[...this.selected],a=[...this._selected];i.splice(e,1),a.splice(e,1),this.selected=i,this._selected=a}}toggleSelected(t){const e=nt(t);this.selected.includes(e)?this.removeFromSelected(t):this.maxMultiple&&this.selected.length>=this.maxMultiple||this.addToSelected(t)}handleRangeSelect(t){const e=nt(t);return this.selected.includes(e)?this.selected.indexOf(e)===0?this.emptySelected():this.removeFromSelected(t):this.selected.length>1?(this.emptySelected(),this.addToSelected(t)):(this.selected.length===1&&!this.isRangeAllowed(t)&&this.emptySelected(),this.selected.length===1&&this._selected[0]>t&&this.emptySelected(),this.addToSelected(t)),Promise.resolve()}handleRangeHover(t){if(this.range&&this._selected.length===1&&this.isRangeAllowed(t)&&this._selected[0]<t){this.rangeHovered=t,this.inRange={};const e=Ci({start:this._selected[0],end:t});if(Array.isArray(e)&&e.length)for(let i=0;i<e.length;i++){const a=e[i],n=a>this._selected[0]&&a<t;this.inRange[nt(a)]=n}}else this.rangeHovered=null}handleDateSelect(t){if(t)return this.range?this.handleRangeSelect(t):this.multiple?this.toggleSelected(t):(this.selected.includes(nt(t))?this.emptySelected():(this.emptySelected(),this.addToSelected(t)),this.close()),this.dispatchEvent(new CustomEvent("date-selected",{detail:this.selected,bubbles:!0,composed:!0})),Promise.resolve()}focusOnCurrentDate(){const t=nt(Ts(new Date)),e=this.querySelector(`button[data-date="${t}"]`);if(e instanceof HTMLButtonElement)this.focusedDate=t,e.focus();else{const i=this.selectableDates.find(a=>!a.isDisabled);if(i){const a=this.querySelector(`button[data-date="${i.currentDateISO}"]`);a instanceof HTMLButtonElement&&(this.focusedDate=i.currentDateISO,a.focus())}}}closeEvent(t){!this.contains(t.relatedTarget)&&!t.target.classList.contains("pkt-hide")&&this.close()}close(){this.dispatchEvent(new CustomEvent("close",{detail:!0,bubbles:!0,composed:!0}))}};G([o({type:Boolean})],K.prototype,"multiple",2),G([o({type:Number})],K.prototype,"maxMultiple",2),G([o({type:Boolean})],K.prototype,"range",2),G([o({type:Boolean})],K.prototype,"weeknumbers",2),G([o({type:Boolean})],K.prototype,"withcontrols",2),G([o({converter:Qe.csvToArray})],K.prototype,"selected",2),G([o({type:String})],K.prototype,"earliest",2),G([o({type:String})],K.prototype,"latest",2),G([o({converter:Qe.stringsToDate})],K.prototype,"excludedates",2),G([o({converter:Qe.csvToArray})],K.prototype,"excludeweekdays",2),G([o({converter:Qe.stringToDate})],K.prototype,"currentmonth",2),G([o({type:Array})],K.prototype,"dayStrings",2),G([o({type:Array})],K.prototype,"dayStringsLong",2),G([o({type:Array})],K.prototype,"monthStrings",2),G([o({type:String})],K.prototype,"weekString",2),G([o({type:String})],K.prototype,"prevMonthString",2),G([o({type:String})],K.prototype,"nextMonthString",2),G([o({type:Array})],K.prototype,"_selected",2),G([o({type:Number})],K.prototype,"year",2),G([o({type:Number})],K.prototype,"month",2),G([o({type:Number})],K.prototype,"week",2),G([o({type:Date})],K.prototype,"rangeHovered",2),G([V()],K.prototype,"inRange",2),G([V()],K.prototype,"focusedDate",2),G([V()],K.prototype,"selectableDates",2),G([V()],K.prototype,"currentmonthtouched",2),G([V()],K.prototype,"tabIndexSet",2),K=G([j("pkt-calendar")],K);const il={size:{default:"medium"},skin:{default:"blue"},closeTag:{default:!1},type:{default:"button"}},ai={props:il};var al=Object.defineProperty,nl=Object.getOwnPropertyDescriptor,te=(s,t,e,i)=>{for(var a=i>1?void 0:i?nl(t,e):t,n=s.length-1,r;n>=0;n--)(r=s[n])&&(a=(i?r(t,e,a):r(a))||a);return i&&a&&al(t,e,a),a};let Gt=class extends Y{constructor(){super(),this.defaultSlot=A(),this.closeTag=ai.props.closeTag.default,this.size=ai.props.size.default,this.skin=ai.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=ai.props.type.default,this.ariaLabel=null,this._isClosed=!1,this._ariaDescription=null,this.close=t=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:t},bubbles:!
|
|
311
|
+
</tr>`)}return p}isExcluded(t){const e=this.excludedates.map(i=>typeof i=="string"?i:nt(i));return!Ha(t,this.earliest,this.latest,e,this.excludeweekdays)}isPrevMonthAllowed(){const t=be(this.year,this.month,0);return!(this.earliest&&re(this.earliest)>t)}prevMonth(){const t=this.month===0?11:this.month-1,e=this.month===0?this.year-1:this.year;this.changeMonth(e,t)}isNextMonthAllowed(){const t=be(this.month===11?this.year+1:this.year,this.month===11?0:this.month+1,1);return!(this.latest&&re(this.latest)<t)}nextMonth(){const t=this.month===11?0:this.month+1,e=this.month===11?this.year+1:this.year;this.changeMonth(e,t)}changeMonth(t,e){this.year=typeof t=="string"?parseInt(t):t,this.month=typeof e=="string"?parseInt(e):e,this.currentmonth=Ts(new Date(this.year,this.month,1)),this.tabIndexSet=0,this.focusedDate=null,this.selectableDates=[]}isRangeAllowed(t){let e=!0;if(this._selected.length===1){const i=Ci({start:this._selected[0],end:t});if(Array.isArray(i)&&i.length)for(let a=0;a<i.length;a++)this.excludedates.forEach(n=>{n>this._selected[0]&&n<t&&(e=!1)}),this.excludeweekdays.includes(jo(i[a]).toString())&&(e=!1)}return e}emptySelected(){this.selected=[],this._selected=[],this.inRange={}}addToSelected(t){this.selected.includes(nt(t))||(this.selected=[...this.selected,nt(t)],this._selected=[...this._selected,t],this.range&&this.selected.length===2&&(this.convertSelected(),this.close()))}removeFromSelected(t){if(this.selected.length===1)this.emptySelected();else{const e=this.selected.indexOf(nt(t)),i=[...this.selected],a=[...this._selected];i.splice(e,1),a.splice(e,1),this.selected=i,this._selected=a}}toggleSelected(t){const e=nt(t);this.selected.includes(e)?this.removeFromSelected(t):this.maxMultiple&&this.selected.length>=this.maxMultiple||this.addToSelected(t)}handleRangeSelect(t){const e=nt(t);return this.selected.includes(e)?this.selected.indexOf(e)===0?this.emptySelected():this.removeFromSelected(t):this.selected.length>1?(this.emptySelected(),this.addToSelected(t)):(this.selected.length===1&&!this.isRangeAllowed(t)&&this.emptySelected(),this.selected.length===1&&this._selected[0]>t&&this.emptySelected(),this.addToSelected(t)),Promise.resolve()}handleRangeHover(t){if(this.range&&this._selected.length===1&&this.isRangeAllowed(t)&&this._selected[0]<t){this.rangeHovered=t,this.inRange={};const e=Ci({start:this._selected[0],end:t});if(Array.isArray(e)&&e.length)for(let i=0;i<e.length;i++){const a=e[i],n=a>this._selected[0]&&a<t;this.inRange[nt(a)]=n}}else this.rangeHovered=null}handleDateSelect(t){if(t)return this.range?this.handleRangeSelect(t):this.multiple?this.toggleSelected(t):(this.selected.includes(nt(t))?this.emptySelected():(this.emptySelected(),this.addToSelected(t)),this.close()),this.dispatchEvent(new CustomEvent("date-selected",{detail:this.selected,bubbles:!0,composed:!0})),Promise.resolve()}focusOnCurrentDate(){const t=nt(Ts(new Date)),e=this.querySelector(`button[data-date="${t}"]`);if(e instanceof HTMLButtonElement)this.focusedDate=t,e.focus();else{const i=this.selectableDates.find(a=>!a.isDisabled);if(i){const a=this.querySelector(`button[data-date="${i.currentDateISO}"]`);a instanceof HTMLButtonElement&&(this.focusedDate=i.currentDateISO,a.focus())}}}closeEvent(t){!this.contains(t.relatedTarget)&&!t.target.classList.contains("pkt-hide")&&this.close()}close(){this.dispatchEvent(new CustomEvent("close",{detail:!0,bubbles:!0,composed:!0}))}};G([o({type:Boolean})],K.prototype,"multiple",2),G([o({type:Number})],K.prototype,"maxMultiple",2),G([o({type:Boolean})],K.prototype,"range",2),G([o({type:Boolean})],K.prototype,"weeknumbers",2),G([o({type:Boolean})],K.prototype,"withcontrols",2),G([o({converter:Qe.csvToArray})],K.prototype,"selected",2),G([o({type:String})],K.prototype,"earliest",2),G([o({type:String})],K.prototype,"latest",2),G([o({converter:Qe.stringsToDate})],K.prototype,"excludedates",2),G([o({converter:Qe.csvToArray})],K.prototype,"excludeweekdays",2),G([o({converter:Qe.stringToDate})],K.prototype,"currentmonth",2),G([o({type:Array})],K.prototype,"dayStrings",2),G([o({type:Array})],K.prototype,"dayStringsLong",2),G([o({type:Array})],K.prototype,"monthStrings",2),G([o({type:String})],K.prototype,"weekString",2),G([o({type:String})],K.prototype,"prevMonthString",2),G([o({type:String})],K.prototype,"nextMonthString",2),G([o({type:Array})],K.prototype,"_selected",2),G([o({type:Number})],K.prototype,"year",2),G([o({type:Number})],K.prototype,"month",2),G([o({type:Number})],K.prototype,"week",2),G([o({type:Date})],K.prototype,"rangeHovered",2),G([V()],K.prototype,"inRange",2),G([V()],K.prototype,"focusedDate",2),G([V()],K.prototype,"selectableDates",2),G([V()],K.prototype,"currentmonthtouched",2),G([V()],K.prototype,"tabIndexSet",2),K=G([j("pkt-calendar")],K);const il={size:{default:"medium"},skin:{default:"blue"},closeTag:{default:!1},type:{default:"button"}},ai={props:il};var al=Object.defineProperty,nl=Object.getOwnPropertyDescriptor,te=(s,t,e,i)=>{for(var a=i>1?void 0:i?nl(t,e):t,n=s.length-1,r;n>=0;n--)(r=s[n])&&(a=(i?r(t,e,a):r(a))||a);return i&&a&&al(t,e,a),a};let Gt=class extends Y{constructor(){super(),this.defaultSlot=A(),this.closeTag=ai.props.closeTag.default,this.size=ai.props.size.default,this.skin=ai.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=ai.props.type.default,this.ariaLabel=null,this._isClosed=!1,this._ariaDescription=null,this.close=t=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:t},bubbles:!1,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:t},bubbles:!1,composed:!0}))},this.slotController=new at(this,this.defaultSlot),this._isClosed=!1}firstUpdated(t){var e,i;if(super.firstUpdated(t),this.closeTag&&!this.ariaLabel){const a=(i=(e=this.defaultSlot.value)==null?void 0:e.textContent)==null?void 0:i.trim();a&&(this._ariaDescription=`Klikk for å fjerne ${a}`)}}render(){const t={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},e={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName,"pkt-hide":this._isClosed};return this.closeTag?u`
|
|
312
312
|
<button
|
|
313
313
|
class=${M(e)}
|
|
314
314
|
type=${this.type}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "13.18.
|
|
3
|
+
"version": "13.18.3",
|
|
4
4
|
"description": "React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@lit-labs/ssr-dom-shim": "^1.2.1",
|
|
41
41
|
"@lit/react": "^1.0.7",
|
|
42
|
-
"@oslokommune/punkt-elements": "^13.18.
|
|
42
|
+
"@oslokommune/punkt-elements": "^13.18.3",
|
|
43
43
|
"classnames": "^2.5.1",
|
|
44
44
|
"prettier": "^3.3.3",
|
|
45
45
|
"react-hook-form": "^7.53.0"
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
104
104
|
},
|
|
105
105
|
"license": "MIT",
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "b50b43c71111d884d75d826b789dc97bf0600e70"
|
|
107
107
|
}
|