@oslokommune/punkt-vue 11.13.13 → 11.14.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
CHANGED
|
@@ -5,6 +5,24 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [11.14.0](https://github.com/oslokommune/punkt/compare/11.13.14...11.14.0) (2024-06-26)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
* Progressbar.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
Ingen
|
|
19
|
+
|
|
20
|
+
### Chores
|
|
21
|
+
Ingen
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
|
|
8
26
|
## [11.13.12](https://github.com/oslokommune/punkt/compare/11.13.11...11.13.12) (2024-06-10)
|
|
9
27
|
|
|
10
28
|
### ⚠ BREAKING CHANGES
|
package/dist/punkt-vue-index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const q=require("./punkt-vue-alert.cjs"),t=require("./punkt-vue-accordion.cjs"),a=require("./punkt-vue-backlink.cjs"),r=require("./punkt-vue-breadcrumbs.cjs"),g=require("./punkt-vue-button.cjs"),o=require("./punkt-vue-checkbox.cjs"),l=require("./punkt-vue-footer.cjs"),u=require("./punkt-vue-footersimple.cjs"),d=require("./punkt-vue-header.cjs"),x=require("./punkt-vue-icon.cjs"),m=require("./punkt-vue-inputwrapper.cjs"),n=require("./punkt-vue-messagebox.cjs"),c=require("./punkt-vue-linkcard.cjs"),i=require("./punkt-vue-loader.cjs"),k=require("./punkt-vue-progressbar.cjs"),s=require("./punkt-vue-radiobutton.cjs"),b=require("./punkt-vue-select.cjs"),e=require("./punkt-vue-table.cjs"),f=require("./punkt-vue-tabs.cjs"),B=require("./punkt-vue-tag.cjs"),P=require("./punkt-vue-textarea.cjs"),T=require("./punkt-vue-textinput.cjs"),I=require("./plugins-IAlvxbZ2.cjs"),L=require("./Alert-VmiRg_3U.cjs"),S=require("./Button-fJVVmqZU.cjs"),y=require("./Icon-7iwiZOEn.cjs"),F=require("./InputWrapper-tRopywnC.cjs"),R=require("./Tag-1MK-d3wL.cjs");require("vue");require("./_plugin-vue_export-helper-jfW5FsfF.cjs");const p=Object.freeze(Object.defineProperty({__proto__:null,Accordion:t.default,AccordionItem:t.default,Alert:q.default,BackLink:a.default,Breadcrumbs:r.default,Button:g.default,Checkbox:o.default,Footer:l.default,FooterSimple:u.default,Header:d.default,Icon:x.default,InputWrapper:m.default,Linkcard:c.default,Loader:i.default,Messagebox:n.default,Progressbar:k.default,Radiobutton:s.default,Select:b.default,Table:e.default,TableBody:e.default,TableDataCell:e.default,TableHeader:e.default,TableHeaderCell:e.default,TableRow:e.default,Tabs:f.default,Tag:B.default,Textarea:P.default,Textinput:T.default},Symbol.toStringTag,{value:"Module"})),A={install(C,M={}){for(const H in p)I.registerPlugin(C,p[H])}};I.use(A);exports.Alert=q.default;exports.Accordion=t.default;exports.AccordionItem=t.default;exports.PktAccordion=t.PktAccordion;exports.PktAccordionItem=t.PktAccordionItem;exports.BackLink=a.default;exports.PktBackLink=a.PktBackLink;exports.Breadcrumbs=r.default;exports.PktBreadcrumbs=r.PktBreadcrumbs;exports.Button=g.default;exports.Checkbox=o.default;exports.PktCheckbox=o.PktCheckbox;exports.Footer=l.default;exports.PktFooter=l.PktFooter;exports.FooterSimple=u.default;exports.PktFooterSimple=u.PktFooterSimple;exports.Header=d.default;exports.PktHeader=d.PktHeader;exports.Icon=x.default;exports.InputWrapper=m.default;exports.Messagebox=n.default;exports.PktMessagebox=n.PktMessagebox;exports.Linkcard=c.default;exports.PktLinkcard=c.PktLinkcard;exports.Loader=i.default;exports.PktLoader=i.PktLoader;exports.PktProgressbar=k.PktProgressbar;exports.Progressbar=k.default;exports.PktRadiobutton=s.PktRadiobutton;exports.Radiobutton=s.default;exports.PktSelect=b.PktSelect;exports.Select=b.default;exports.PktTable=e.PktTable;exports.PktTableBody=e.PktTableBody;exports.PktTableDataCell=e.PktTableDataCell;exports.PktTableHeader=e.PktTableHeader;exports.PktTableHeaderCell=e.PktTableHeaderCell;exports.PktTableRow=e.PktTableRow;exports.Table=e.default;exports.TableBody=e.default;exports.TableDataCell=e.default;exports.TableHeader=e.default;exports.TableHeaderCell=e.default;exports.TableRow=e.default;exports.PktTabs=f.PktTabs;exports.Tabs=f.default;exports.Tag=B.default;exports.PktTextarea=P.PktTextarea;exports.Textarea=P.default;exports.PktTextinput=T.PktTextinput;exports.Textinput=T.default;exports.PktAlert=L.PktAlert;exports.PktButton=S.PktButton;exports.PktIcon=y.PktIcon;exports.PktInputWrapper=F.PktInputWrapper;exports.PktTag=R.Tag;exports.default=A;
|
package/dist/punkt-vue-index.js
CHANGED
|
@@ -1,49 +1,51 @@
|
|
|
1
1
|
import m from "./punkt-vue-alert.js";
|
|
2
2
|
import r from "./punkt-vue-accordion.js";
|
|
3
|
-
import { PktAccordion as
|
|
3
|
+
import { PktAccordion as eo, PktAccordionItem as to } from "./punkt-vue-accordion.js";
|
|
4
4
|
import i from "./punkt-vue-backlink.js";
|
|
5
|
-
import { PktBackLink as
|
|
5
|
+
import { PktBackLink as mo } from "./punkt-vue-backlink.js";
|
|
6
6
|
import l from "./punkt-vue-breadcrumbs.js";
|
|
7
|
-
import { PktBreadcrumbs as
|
|
7
|
+
import { PktBreadcrumbs as lo } from "./punkt-vue-breadcrumbs.js";
|
|
8
8
|
import p from "./punkt-vue-button.js";
|
|
9
9
|
import n from "./punkt-vue-checkbox.js";
|
|
10
|
-
import { PktCheckbox as
|
|
10
|
+
import { PktCheckbox as no } from "./punkt-vue-checkbox.js";
|
|
11
11
|
import s from "./punkt-vue-footer.js";
|
|
12
|
-
import { PktFooter as
|
|
12
|
+
import { PktFooter as Po } from "./punkt-vue-footer.js";
|
|
13
13
|
import P from "./punkt-vue-footersimple.js";
|
|
14
|
-
import { PktFooterSimple as
|
|
14
|
+
import { PktFooterSimple as uo } from "./punkt-vue-footersimple.js";
|
|
15
15
|
import f from "./punkt-vue-header.js";
|
|
16
|
-
import { PktHeader as
|
|
16
|
+
import { PktHeader as bo } from "./punkt-vue-header.js";
|
|
17
17
|
import u from "./punkt-vue-icon.js";
|
|
18
18
|
import k from "./punkt-vue-inputwrapper.js";
|
|
19
19
|
import b from "./punkt-vue-messagebox.js";
|
|
20
|
-
import { PktMessagebox as
|
|
20
|
+
import { PktMessagebox as go } from "./punkt-vue-messagebox.js";
|
|
21
21
|
import c from "./punkt-vue-linkcard.js";
|
|
22
|
-
import { PktLinkcard as
|
|
23
|
-
import
|
|
24
|
-
import { PktLoader as
|
|
25
|
-
import x from "./punkt-vue-
|
|
26
|
-
import {
|
|
27
|
-
import
|
|
28
|
-
import {
|
|
22
|
+
import { PktLinkcard as To } from "./punkt-vue-linkcard.js";
|
|
23
|
+
import g from "./punkt-vue-loader.js";
|
|
24
|
+
import { PktLoader as Bo } from "./punkt-vue-loader.js";
|
|
25
|
+
import x from "./punkt-vue-progressbar.js";
|
|
26
|
+
import { PktProgressbar as Co } from "./punkt-vue-progressbar.js";
|
|
27
|
+
import d from "./punkt-vue-radiobutton.js";
|
|
28
|
+
import { PktRadiobutton as Io } from "./punkt-vue-radiobutton.js";
|
|
29
|
+
import T from "./punkt-vue-select.js";
|
|
30
|
+
import { PktSelect as So } from "./punkt-vue-select.js";
|
|
29
31
|
import o from "./punkt-vue-table.js";
|
|
30
|
-
import { PktTable as
|
|
31
|
-
import
|
|
32
|
-
import { PktTabs as
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import { PktTextarea as
|
|
36
|
-
import
|
|
37
|
-
import { PktTextinput as
|
|
38
|
-
import { u as
|
|
39
|
-
import { P as
|
|
40
|
-
import { P as
|
|
41
|
-
import { P as
|
|
42
|
-
import { P as
|
|
43
|
-
import { T as
|
|
32
|
+
import { PktTable as Fo, PktTableBody as Ro, PktTableDataCell as ho, PktTableHeader as Mo, PktTableHeaderCell as _o, PktTableRow as jo } from "./punkt-vue-table.js";
|
|
33
|
+
import $ from "./punkt-vue-tabs.js";
|
|
34
|
+
import { PktTabs as Do } from "./punkt-vue-tabs.js";
|
|
35
|
+
import B from "./punkt-vue-tag.js";
|
|
36
|
+
import A from "./punkt-vue-textarea.js";
|
|
37
|
+
import { PktTextarea as Oo } from "./punkt-vue-textarea.js";
|
|
38
|
+
import C from "./punkt-vue-textinput.js";
|
|
39
|
+
import { PktTextinput as zo } from "./punkt-vue-textinput.js";
|
|
40
|
+
import { u as H, r as I } from "./plugins-UPM181Xt.js";
|
|
41
|
+
import { P as qo } from "./Alert-LNP7MGFo.js";
|
|
42
|
+
import { P as Go } from "./Button-5obh_jeA.js";
|
|
43
|
+
import { P as No } from "./Icon-8MjQJfqx.js";
|
|
44
|
+
import { P as Uo } from "./InputWrapper-aBvhZpl8.js";
|
|
45
|
+
import { T as Xo } from "./Tag-jpZpXEPw.js";
|
|
44
46
|
import "vue";
|
|
45
47
|
import "./_plugin-vue_export-helper-hUChTQA_.js";
|
|
46
|
-
const
|
|
48
|
+
const e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
47
49
|
__proto__: null,
|
|
48
50
|
Accordion: r,
|
|
49
51
|
AccordionItem: r,
|
|
@@ -58,27 +60,28 @@ const t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
58
60
|
Icon: u,
|
|
59
61
|
InputWrapper: k,
|
|
60
62
|
Linkcard: c,
|
|
61
|
-
Loader:
|
|
63
|
+
Loader: g,
|
|
62
64
|
Messagebox: b,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
Progressbar: x,
|
|
66
|
+
Radiobutton: d,
|
|
67
|
+
Select: T,
|
|
65
68
|
Table: o,
|
|
66
69
|
TableBody: o,
|
|
67
70
|
TableDataCell: o,
|
|
68
71
|
TableHeader: o,
|
|
69
72
|
TableHeaderCell: o,
|
|
70
73
|
TableRow: o,
|
|
71
|
-
Tabs:
|
|
72
|
-
Tag:
|
|
73
|
-
Textarea:
|
|
74
|
-
Textinput:
|
|
75
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
76
|
-
install(
|
|
77
|
-
for (const a in
|
|
78
|
-
|
|
74
|
+
Tabs: $,
|
|
75
|
+
Tag: B,
|
|
76
|
+
Textarea: A,
|
|
77
|
+
Textinput: C
|
|
78
|
+
}, Symbol.toStringTag, { value: "Module" })), L = {
|
|
79
|
+
install(t, S = {}) {
|
|
80
|
+
for (const a in e)
|
|
81
|
+
I(t, e[a]);
|
|
79
82
|
}
|
|
80
83
|
};
|
|
81
|
-
|
|
84
|
+
H(L);
|
|
82
85
|
export {
|
|
83
86
|
r as Accordion,
|
|
84
87
|
r as AccordionItem,
|
|
@@ -93,46 +96,48 @@ export {
|
|
|
93
96
|
u as Icon,
|
|
94
97
|
k as InputWrapper,
|
|
95
98
|
c as Linkcard,
|
|
96
|
-
|
|
99
|
+
g as Loader,
|
|
97
100
|
b as Messagebox,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
101
|
+
eo as PktAccordion,
|
|
102
|
+
to as PktAccordionItem,
|
|
103
|
+
qo as PktAlert,
|
|
104
|
+
mo as PktBackLink,
|
|
105
|
+
lo as PktBreadcrumbs,
|
|
106
|
+
Go as PktButton,
|
|
107
|
+
no as PktCheckbox,
|
|
108
|
+
Po as PktFooter,
|
|
109
|
+
uo as PktFooterSimple,
|
|
110
|
+
bo as PktHeader,
|
|
111
|
+
No as PktIcon,
|
|
112
|
+
Uo as PktInputWrapper,
|
|
113
|
+
To as PktLinkcard,
|
|
114
|
+
Bo as PktLoader,
|
|
115
|
+
go as PktMessagebox,
|
|
116
|
+
Co as PktProgressbar,
|
|
117
|
+
Io as PktRadiobutton,
|
|
118
|
+
So as PktSelect,
|
|
119
|
+
Fo as PktTable,
|
|
120
|
+
Ro as PktTableBody,
|
|
121
|
+
ho as PktTableDataCell,
|
|
122
|
+
Mo as PktTableHeader,
|
|
123
|
+
_o as PktTableHeaderCell,
|
|
124
|
+
jo as PktTableRow,
|
|
125
|
+
Do as PktTabs,
|
|
126
|
+
Xo as PktTag,
|
|
127
|
+
Oo as PktTextarea,
|
|
128
|
+
zo as PktTextinput,
|
|
129
|
+
x as Progressbar,
|
|
130
|
+
d as Radiobutton,
|
|
131
|
+
T as Select,
|
|
127
132
|
o as Table,
|
|
128
133
|
o as TableBody,
|
|
129
134
|
o as TableDataCell,
|
|
130
135
|
o as TableHeader,
|
|
131
136
|
o as TableHeaderCell,
|
|
132
137
|
o as TableRow,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
$ as Tabs,
|
|
139
|
+
B as Tag,
|
|
140
|
+
A as Textarea,
|
|
141
|
+
C as Textinput,
|
|
142
|
+
L as default
|
|
138
143
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),m=require("./plugins-IAlvxbZ2.cjs");var l=[];for(var i=0;i<256;++i)l.push((i+256).toString(16).slice(1));function P(e,t=0){return(l[e[t+0]]+l[e[t+1]]+l[e[t+2]]+l[e[t+3]]+"-"+l[e[t+4]]+l[e[t+5]]+"-"+l[e[t+6]]+l[e[t+7]]+"-"+l[e[t+8]]+l[e[t+9]]+"-"+l[e[t+10]]+l[e[t+11]]+l[e[t+12]]+l[e[t+13]]+l[e[t+14]]+l[e[t+15]]).toLowerCase()}var s,U=new Uint8Array(16);function V(){if(!s&&(s=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!s))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return s(U)}var f=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const v={randomUUID:f};function N(e,t,n){if(v.randomUUID&&!t&&!e)return v.randomUUID();e=e||{};var r=e.random||(e.rng||V)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(var u=0;u<16;++u)t[n+u]=r[u];return t}return P(r)}const B=["id"],R=["id"],T=["role","aria-valuemin","aria-valuemax","aria-valuenow","aria-labelledby","aria-label","aria-valuetext"],g={__name:"Progressbar",props:{valueCurrent:{type:Number,required:!0},valueMax:{type:Number,default:100},valueMin:{type:Number,default:0},skin:{type:String,default:"dark-blue",validator:e=>["dark-blue","light-blue","green","red"].includes(e)},title:{type:String},titlePosition:{type:String,default:"left",validator:e=>["left","center"].includes(e)},statusType:{type:String,default:"none",validator:e=>["none","percentage","fraction"].includes(e)},statusPlacement:{type:String,default:"following",validator:e=>["center","left","following"].includes(e)},id:{type:String},ariaLabel:{type:String},ariaLabelledby:{type:String},ariaValueText:{type:String},role:{type:String,default:"progressbar",validator:e=>["progressbar","meter"].includes(e)},className:{type:String}},setup(e){const t=e,n=a.ref(null),r=a.ref(0);a.onMounted(()=>{n.value&&(r.value=n.value.getBoundingClientRect().width)}),a.watch(()=>t.valueCurrent,(d,p)=>{d!==p&&n.value&&(r.value=n.value.getBoundingClientRect().width)});const u=a.computed(()=>t.valueMax-t.valueMin),y=a.computed(()=>t.valueCurrent/u.value*100),c=a.computed(()=>t.valueMax!==100||t.valueMin!==0?Math.round(y.value):t.valueCurrent),k=a.computed(()=>`${t.valueCurrent} av ${t.valueMax}`),S=a.computed(()=>t.statusType!=="none"&&t.role==="progressbar"),o=a.computed(()=>t.id||N()),C=a.computed(()=>t.ariaLabelledby||t.title&&`${o.value}-title`),x=a.computed(()=>`pkt-progressbar__bar pkt-progressbar__bar--${t.skin}`),h=a.computed(()=>({"pkt-progressbar__title":!0,"pkt-progressbar__title-center":t.titlePosition==="center"})),_=a.computed(()=>({"pkt-progressbar__status":!0,"pkt-progressbar__status--center":t.statusPlacement==="center"})),w=a.computed(()=>({"pkt-progressbar__status-placement--following":t.statusPlacement==="following","pkt-progressbar__status-placement--center":t.statusPlacement==="center","pkt-progressbar__status-placement--left":t.statusPlacement==="left"})),M=a.computed(()=>({"--pkt-progress-label-width":`${r.value}px`,"--pkt-progress-width":`${c.value}%`}));return(d,p)=>(a.openBlock(),a.createElementBlock("div",{id:o.value,class:a.normalizeClass(["pkt-progressbar__container",e.className]),style:a.normalizeStyle(M.value)},[e.title?(a.openBlock(),a.createElementBlock("p",{key:0,id:`${o.value}-title`,class:a.normalizeClass(h.value)},a.toDisplayString(e.title),11,R)):a.createCommentVNode("",!0),a.createElementVNode("div",{role:e.role,class:"pkt-progressbar__bar-wrapper","aria-valuemin":e.valueMin,"aria-valuemax":e.valueMax,"aria-valuenow":e.valueCurrent,"aria-labelledby":C.value,"aria-label":e.ariaLabel,"aria-valuetext":e.ariaValueText},[a.createElementVNode("div",{class:a.normalizeClass(x.value)},null,2)],8,T),S.value?(a.openBlock(),a.createElementBlock("div",{key:1,class:a.normalizeClass(_.value)},[a.createElementVNode("span",{class:a.normalizeClass(w.value),ref_key:"labelRef",ref:n},a.toDisplayString(e.statusType==="percentage"?`${c.value}%`:k.value),3)],2)):a.createCommentVNode("",!0)],14,B))}},b={install(e){m.registerComponent(e,g)}};m.use(b);exports.PktProgressbar=g;exports.default=b;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { ref as y, onMounted as V, watch as $, computed as r, openBlock as c, createElementBlock as d, normalizeClass as u, normalizeStyle as N, toDisplayString as k, createCommentVNode as x, createElementVNode as p } from "vue";
|
|
2
|
+
import { u as T, a as D } from "./plugins-UPM181Xt.js";
|
|
3
|
+
var a = [];
|
|
4
|
+
for (var v = 0; v < 256; ++v)
|
|
5
|
+
a.push((v + 256).toString(16).slice(1));
|
|
6
|
+
function I(e, t = 0) {
|
|
7
|
+
return (a[e[t + 0]] + a[e[t + 1]] + a[e[t + 2]] + a[e[t + 3]] + "-" + a[e[t + 4]] + a[e[t + 5]] + "-" + a[e[t + 6]] + a[e[t + 7]] + "-" + a[e[t + 8]] + a[e[t + 9]] + "-" + a[e[t + 10]] + a[e[t + 11]] + a[e[t + 12]] + a[e[t + 13]] + a[e[t + 14]] + a[e[t + 15]]).toLowerCase();
|
|
8
|
+
}
|
|
9
|
+
var i, L = new Uint8Array(16);
|
|
10
|
+
function B() {
|
|
11
|
+
if (!i && (i = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !i))
|
|
12
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
13
|
+
return i(L);
|
|
14
|
+
}
|
|
15
|
+
var E = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
16
|
+
const S = {
|
|
17
|
+
randomUUID: E
|
|
18
|
+
};
|
|
19
|
+
function z(e, t, n) {
|
|
20
|
+
if (S.randomUUID && !t && !e)
|
|
21
|
+
return S.randomUUID();
|
|
22
|
+
e = e || {};
|
|
23
|
+
var l = e.random || (e.rng || B)();
|
|
24
|
+
if (l[6] = l[6] & 15 | 64, l[8] = l[8] & 63 | 128, t) {
|
|
25
|
+
n = n || 0;
|
|
26
|
+
for (var s = 0; s < 16; ++s)
|
|
27
|
+
t[n + s] = l[s];
|
|
28
|
+
return t;
|
|
29
|
+
}
|
|
30
|
+
return I(l);
|
|
31
|
+
}
|
|
32
|
+
const A = ["id"], j = ["id"], q = ["role", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-labelledby", "aria-label", "aria-valuetext"], H = {
|
|
33
|
+
__name: "Progressbar",
|
|
34
|
+
props: {
|
|
35
|
+
valueCurrent: {
|
|
36
|
+
type: Number,
|
|
37
|
+
required: !0
|
|
38
|
+
},
|
|
39
|
+
valueMax: {
|
|
40
|
+
type: Number,
|
|
41
|
+
default: 100
|
|
42
|
+
},
|
|
43
|
+
valueMin: {
|
|
44
|
+
type: Number,
|
|
45
|
+
default: 0
|
|
46
|
+
},
|
|
47
|
+
skin: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "dark-blue",
|
|
50
|
+
validator: (e) => ["dark-blue", "light-blue", "green", "red"].includes(e)
|
|
51
|
+
},
|
|
52
|
+
title: {
|
|
53
|
+
type: String
|
|
54
|
+
},
|
|
55
|
+
titlePosition: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: "left",
|
|
58
|
+
validator: (e) => ["left", "center"].includes(e)
|
|
59
|
+
},
|
|
60
|
+
statusType: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: "none",
|
|
63
|
+
validator: (e) => ["none", "percentage", "fraction"].includes(e)
|
|
64
|
+
},
|
|
65
|
+
statusPlacement: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: "following",
|
|
68
|
+
validator: (e) => ["center", "left", "following"].includes(e)
|
|
69
|
+
},
|
|
70
|
+
id: {
|
|
71
|
+
type: String
|
|
72
|
+
},
|
|
73
|
+
ariaLabel: {
|
|
74
|
+
type: String
|
|
75
|
+
},
|
|
76
|
+
ariaLabelledby: {
|
|
77
|
+
type: String
|
|
78
|
+
},
|
|
79
|
+
ariaValueText: {
|
|
80
|
+
type: String
|
|
81
|
+
},
|
|
82
|
+
role: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: "progressbar",
|
|
85
|
+
validator: (e) => ["progressbar", "meter"].includes(e)
|
|
86
|
+
},
|
|
87
|
+
className: {
|
|
88
|
+
type: String
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
setup(e) {
|
|
92
|
+
const t = e, n = y(null), l = y(0);
|
|
93
|
+
V(() => {
|
|
94
|
+
n.value && (l.value = n.value.getBoundingClientRect().width);
|
|
95
|
+
}), $(
|
|
96
|
+
() => t.valueCurrent,
|
|
97
|
+
(m, b) => {
|
|
98
|
+
m !== b && n.value && (l.value = n.value.getBoundingClientRect().width);
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
const s = r(() => t.valueMax - t.valueMin), h = r(() => t.valueCurrent / s.value * 100), g = r(
|
|
102
|
+
() => t.valueMax !== 100 || t.valueMin !== 0 ? Math.round(h.value) : t.valueCurrent
|
|
103
|
+
), w = r(() => `${t.valueCurrent} av ${t.valueMax}`), C = r(() => t.statusType !== "none" && t.role === "progressbar"), o = r(() => t.id || z()), _ = r(() => t.ariaLabelledby || t.title && `${o.value}-title`), P = r(() => `pkt-progressbar__bar pkt-progressbar__bar--${t.skin}`), M = r(() => ({
|
|
104
|
+
"pkt-progressbar__title": !0,
|
|
105
|
+
"pkt-progressbar__title-center": t.titlePosition === "center"
|
|
106
|
+
})), U = r(() => ({
|
|
107
|
+
"pkt-progressbar__status": !0,
|
|
108
|
+
"pkt-progressbar__status--center": t.statusPlacement === "center"
|
|
109
|
+
})), f = r(() => ({
|
|
110
|
+
"pkt-progressbar__status-placement--following": t.statusPlacement === "following",
|
|
111
|
+
"pkt-progressbar__status-placement--center": t.statusPlacement === "center",
|
|
112
|
+
"pkt-progressbar__status-placement--left": t.statusPlacement === "left"
|
|
113
|
+
})), R = r(() => ({
|
|
114
|
+
"--pkt-progress-label-width": `${l.value}px`,
|
|
115
|
+
"--pkt-progress-width": `${g.value}%`
|
|
116
|
+
}));
|
|
117
|
+
return (m, b) => (c(), d("div", {
|
|
118
|
+
id: o.value,
|
|
119
|
+
class: u(["pkt-progressbar__container", e.className]),
|
|
120
|
+
style: N(R.value)
|
|
121
|
+
}, [
|
|
122
|
+
e.title ? (c(), d("p", {
|
|
123
|
+
key: 0,
|
|
124
|
+
id: `${o.value}-title`,
|
|
125
|
+
class: u(M.value)
|
|
126
|
+
}, k(e.title), 11, j)) : x("", !0),
|
|
127
|
+
p("div", {
|
|
128
|
+
role: e.role,
|
|
129
|
+
class: "pkt-progressbar__bar-wrapper",
|
|
130
|
+
"aria-valuemin": e.valueMin,
|
|
131
|
+
"aria-valuemax": e.valueMax,
|
|
132
|
+
"aria-valuenow": e.valueCurrent,
|
|
133
|
+
"aria-labelledby": _.value,
|
|
134
|
+
"aria-label": e.ariaLabel,
|
|
135
|
+
"aria-valuetext": e.ariaValueText
|
|
136
|
+
}, [
|
|
137
|
+
p("div", {
|
|
138
|
+
class: u(P.value)
|
|
139
|
+
}, null, 2)
|
|
140
|
+
], 8, q),
|
|
141
|
+
C.value ? (c(), d("div", {
|
|
142
|
+
key: 1,
|
|
143
|
+
class: u(U.value)
|
|
144
|
+
}, [
|
|
145
|
+
p("span", {
|
|
146
|
+
class: u(f.value),
|
|
147
|
+
ref_key: "labelRef",
|
|
148
|
+
ref: n
|
|
149
|
+
}, k(e.statusType === "percentage" ? `${g.value}%` : w.value), 3)
|
|
150
|
+
], 2)) : x("", !0)
|
|
151
|
+
], 14, A));
|
|
152
|
+
}
|
|
153
|
+
}, O = {
|
|
154
|
+
install(e) {
|
|
155
|
+
D(e, H);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
T(O);
|
|
159
|
+
export {
|
|
160
|
+
H as PktProgressbar,
|
|
161
|
+
O as default
|
|
162
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-vue",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.14.0",
|
|
4
4
|
"description": "Vue komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"preview": "vite preview"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@oslokommune/punkt-assets": "^11.13.
|
|
30
|
-
"@oslokommune/punkt-css": "^11.
|
|
29
|
+
"@oslokommune/punkt-assets": "^11.13.14",
|
|
30
|
+
"@oslokommune/punkt-css": "^11.14.0",
|
|
31
31
|
"@vitejs/plugin-vue": "^4.5.2",
|
|
32
32
|
"edit-json-file": "^1.7.0",
|
|
33
33
|
"sass": "^1.69.5",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
66
66
|
},
|
|
67
67
|
"license": "MIT",
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "bb16f0f94234a0251ca4b9ebec68f65385cd7fa4"
|
|
69
69
|
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :id="progressId" :class="['pkt-progressbar__container', className]" :style="containerStyles">
|
|
3
|
+
<p v-if="title" :id="`${progressId}-title`" :class="titleClasses">
|
|
4
|
+
{{ title }}
|
|
5
|
+
</p>
|
|
6
|
+
<div
|
|
7
|
+
:role="role"
|
|
8
|
+
class="pkt-progressbar__bar-wrapper"
|
|
9
|
+
:aria-valuemin="valueMin"
|
|
10
|
+
:aria-valuemax="valueMax"
|
|
11
|
+
:aria-valuenow="valueCurrent"
|
|
12
|
+
:aria-labelledby="computedAriaLabelledby"
|
|
13
|
+
:aria-label="ariaLabel"
|
|
14
|
+
:aria-valuetext="ariaValueText"
|
|
15
|
+
>
|
|
16
|
+
<div :class="barClasses"></div>
|
|
17
|
+
</div>
|
|
18
|
+
<div v-if="hasStatus" :class="statusClasses">
|
|
19
|
+
<span :class="placementClasses" ref="labelRef">
|
|
20
|
+
{{ statusType === 'percentage' ? `${currentPercentage}%` : formattedTitle }}
|
|
21
|
+
</span>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script setup>
|
|
27
|
+
import { ref, computed, onMounted, watch } from 'vue'
|
|
28
|
+
import { v4 as uuidv4 } from 'uuid'
|
|
29
|
+
|
|
30
|
+
const props = defineProps({
|
|
31
|
+
valueCurrent: {
|
|
32
|
+
type: Number,
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
valueMax: {
|
|
36
|
+
type: Number,
|
|
37
|
+
default: 100,
|
|
38
|
+
},
|
|
39
|
+
valueMin: {
|
|
40
|
+
type: Number,
|
|
41
|
+
default: 0,
|
|
42
|
+
},
|
|
43
|
+
skin: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: 'dark-blue',
|
|
46
|
+
validator: (value) => ['dark-blue', 'light-blue', 'green', 'red'].includes(value),
|
|
47
|
+
},
|
|
48
|
+
title: {
|
|
49
|
+
type: String,
|
|
50
|
+
},
|
|
51
|
+
titlePosition: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: 'left',
|
|
54
|
+
validator: (value) => ['left', 'center'].includes(value),
|
|
55
|
+
},
|
|
56
|
+
statusType: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: 'none',
|
|
59
|
+
validator: (value) => ['none', 'percentage', 'fraction'].includes(value),
|
|
60
|
+
},
|
|
61
|
+
statusPlacement: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: 'following',
|
|
64
|
+
validator: (value) => ['center', 'left', 'following'].includes(value),
|
|
65
|
+
},
|
|
66
|
+
id: {
|
|
67
|
+
type: String,
|
|
68
|
+
},
|
|
69
|
+
ariaLabel: {
|
|
70
|
+
type: String,
|
|
71
|
+
},
|
|
72
|
+
ariaLabelledby: {
|
|
73
|
+
type: String,
|
|
74
|
+
},
|
|
75
|
+
ariaValueText: {
|
|
76
|
+
type: String,
|
|
77
|
+
},
|
|
78
|
+
role: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: 'progressbar',
|
|
81
|
+
validator: (value) => ['progressbar', 'meter'].includes(value),
|
|
82
|
+
},
|
|
83
|
+
className: {
|
|
84
|
+
type: String,
|
|
85
|
+
},
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
const labelRef = ref(null)
|
|
89
|
+
const labelWidth = ref(0)
|
|
90
|
+
|
|
91
|
+
onMounted(() => {
|
|
92
|
+
if (labelRef.value) {
|
|
93
|
+
labelWidth.value = labelRef.value.getBoundingClientRect().width
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
watch(
|
|
98
|
+
() => props.valueCurrent,
|
|
99
|
+
(newVal, oldVal) => {
|
|
100
|
+
if (newVal !== oldVal && labelRef.value) {
|
|
101
|
+
labelWidth.value = labelRef.value.getBoundingClientRect().width
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
const totalSteps = computed(() => props.valueMax - props.valueMin)
|
|
107
|
+
const percentageOfSteps = computed(() => (props.valueCurrent / totalSteps.value) * 100)
|
|
108
|
+
const currentPercentage = computed(() =>
|
|
109
|
+
props.valueMax !== 100 || props.valueMin !== 0 ? Math.round(percentageOfSteps.value) : props.valueCurrent,
|
|
110
|
+
)
|
|
111
|
+
const formattedTitle = computed(() => `${props.valueCurrent} av ${props.valueMax}`)
|
|
112
|
+
const hasStatus = computed(() => props.statusType !== 'none' && props.role === 'progressbar')
|
|
113
|
+
const progressId = computed(() => props.id || uuidv4())
|
|
114
|
+
const computedAriaLabelledby = computed(() => {
|
|
115
|
+
return props.ariaLabelledby || (props.title && `${progressId.value}-title`)
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
const barClasses = computed(() => `pkt-progressbar__bar pkt-progressbar__bar--${props.skin}`)
|
|
119
|
+
const titleClasses = computed(() => ({
|
|
120
|
+
'pkt-progressbar__title': true,
|
|
121
|
+
'pkt-progressbar__title-center': props.titlePosition === 'center',
|
|
122
|
+
}))
|
|
123
|
+
const statusClasses = computed(() => ({
|
|
124
|
+
'pkt-progressbar__status': true,
|
|
125
|
+
'pkt-progressbar__status--center': props.statusPlacement === 'center',
|
|
126
|
+
}))
|
|
127
|
+
const placementClasses = computed(() => ({
|
|
128
|
+
'pkt-progressbar__status-placement--following': props.statusPlacement === 'following',
|
|
129
|
+
'pkt-progressbar__status-placement--center': props.statusPlacement === 'center',
|
|
130
|
+
'pkt-progressbar__status-placement--left': props.statusPlacement === 'left',
|
|
131
|
+
}))
|
|
132
|
+
|
|
133
|
+
const containerStyles = computed(() => ({
|
|
134
|
+
'--pkt-progress-label-width': `${labelWidth.value}px`,
|
|
135
|
+
'--pkt-progress-width': `${currentPercentage.value}%`,
|
|
136
|
+
}))
|
|
137
|
+
</script>
|