@oslokommune/punkt-vue 11.5.3 → 11.6.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 +22 -0
- package/dist/punkt-vue-loader.cjs +1 -1
- package/dist/punkt-vue-loader.js +35 -26
- package/package.json +2 -2
- package/src/components/loader/Loader.vue +14 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,28 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [11.6.0](https://github.com/oslokommune/punkt/compare/11.5.4...11.6.0) (2024-02-16)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
* PktLoader kan utsette visning (#1520). * feat(vue,react): PktLoader kan utsette visning
|
|
15
|
+
|
|
16
|
+
* Fjern ReactNode
|
|
17
|
+
|
|
18
|
+
* className
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
Ingen
|
|
23
|
+
|
|
24
|
+
### Chores
|
|
25
|
+
Ingen
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
|
|
8
30
|
## [11.5.0](https://github.com/oslokommune/punkt/compare/11.4.9...11.5.0) (2024-02-14)
|
|
9
31
|
|
|
10
32
|
### ⚠ BREAKING CHANGES
|
|
@@ -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 e=require("vue"),d=require("./Icon-Q_SkpRJa.cjs"),s=require("./plugins-AiK__HqQ.cjs"),c=["aria-busy"],m={key:0},r={__name:"Loader",props:{message:String,size:{type:String,default:"medium",validator:a=>["small","medium","large"].includes(a)},inline:{type:Boolean,default:!1},isLoading:{type:Boolean,default:!0},variant:{type:String,default:"rainbow",validator:a=>["blue","rainbow","shapes"].includes(a)},delay:{type:Number,default:0}},setup(a){const n=a,u=t=>t==="shapes"?"loader":t==="blue"?"spinner-blue":"spinner",{delay:l}=e.toRefs(n);let o=e.ref(!(l.value>0));return l.value>0&&setTimeout(()=>{o.value=!0},l.value),(t,k)=>(e.openBlock(),e.createElementBlock("div",{role:"status","aria-live":"polite","aria-busy":a.isLoading,class:e.normalizeClass(`pkt-loader--${a.inline?"inline":"box"}`)},[a.isLoading?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(o)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(`pkt-loader pkt-loader--${n.size}`),"data-testid":"pkt-loader"},[e.createVNode(d.PktIcon,{name:u(a.variant),"aria-label":"loading",path:"https://punkt-cdn.oslo.kommune.no/latest/animations/",class:e.normalizeClass(`pkt-loader__svg pkt-loader__${a.variant}`)},null,8,["name","class"]),a.message?(e.openBlock(),e.createElementBlock("p",m,e.toDisplayString(a.message),1)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)],64)):e.renderSlot(t.$slots,"default",{key:1})],10,c))}},i={install(a){s.registerComponent(a,r)}};s.use(i);exports.PktLoader=r;exports.default=i;
|
package/dist/punkt-vue-loader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { openBlock as t, createElementBlock as
|
|
2
|
-
import { P as
|
|
3
|
-
import { u as
|
|
4
|
-
const
|
|
1
|
+
import { toRefs as u, ref as m, openBlock as t, createElementBlock as l, normalizeClass as n, Fragment as c, unref as p, createVNode as g, toDisplayString as f, createCommentVNode as r, renderSlot as k } from "vue";
|
|
2
|
+
import { P as y } from "./Icon-s3ZNrtl-.js";
|
|
3
|
+
import { u as v, a as b } from "./plugins-IeJb3XDX.js";
|
|
4
|
+
const h = ["aria-busy"], L = { key: 0 }, S = {
|
|
5
5
|
__name: "Loader",
|
|
6
6
|
props: {
|
|
7
7
|
message: String,
|
|
@@ -22,38 +22,47 @@ const g = ["aria-busy"], k = { key: 0 }, f = {
|
|
|
22
22
|
type: String,
|
|
23
23
|
default: "rainbow",
|
|
24
24
|
validator: (e) => ["blue", "rainbow", "shapes"].includes(e)
|
|
25
|
+
},
|
|
26
|
+
delay: {
|
|
27
|
+
type: Number,
|
|
28
|
+
default: 0
|
|
25
29
|
}
|
|
26
30
|
},
|
|
27
31
|
setup(e) {
|
|
28
|
-
const
|
|
29
|
-
|
|
32
|
+
const o = e, d = (a) => a === "shapes" ? "loader" : a === "blue" ? "spinner-blue" : "spinner", { delay: s } = u(o);
|
|
33
|
+
let i = m(!(s.value > 0));
|
|
34
|
+
return s.value > 0 && setTimeout(() => {
|
|
35
|
+
i.value = !0;
|
|
36
|
+
}, s.value), (a, P) => (t(), l("div", {
|
|
30
37
|
role: "status",
|
|
31
38
|
"aria-live": "polite",
|
|
32
39
|
"aria-busy": e.isLoading,
|
|
33
|
-
class:
|
|
40
|
+
class: n(`pkt-loader--${e.inline ? "inline" : "box"}`)
|
|
34
41
|
}, [
|
|
35
|
-
e.isLoading ? (t(),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
e.isLoading ? (t(), l(c, { key: 0 }, [
|
|
43
|
+
p(i) ? (t(), l("div", {
|
|
44
|
+
key: 0,
|
|
45
|
+
class: n(`pkt-loader pkt-loader--${o.size}`),
|
|
46
|
+
"data-testid": "pkt-loader"
|
|
47
|
+
}, [
|
|
48
|
+
g(y, {
|
|
49
|
+
name: d(e.variant),
|
|
50
|
+
"aria-label": "loading",
|
|
51
|
+
path: "https://punkt-cdn.oslo.kommune.no/latest/animations/",
|
|
52
|
+
class: n(`pkt-loader__svg pkt-loader__${e.variant}`)
|
|
53
|
+
}, null, 8, ["name", "class"]),
|
|
54
|
+
e.message ? (t(), l("p", L, f(e.message), 1)) : r("", !0)
|
|
55
|
+
], 2)) : r("", !0)
|
|
56
|
+
], 64)) : k(a.$slots, "default", { key: 1 })
|
|
57
|
+
], 10, h));
|
|
49
58
|
}
|
|
50
|
-
},
|
|
59
|
+
}, B = {
|
|
51
60
|
install(e) {
|
|
52
|
-
|
|
61
|
+
b(e, S);
|
|
53
62
|
}
|
|
54
63
|
};
|
|
55
|
-
|
|
64
|
+
v(B);
|
|
56
65
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
66
|
+
S as PktLoader,
|
|
67
|
+
B as default
|
|
59
68
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-vue",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.6.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",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
66
66
|
},
|
|
67
67
|
"license": "MIT",
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "625cf310735226cfcdae9d27c3f18c04d335ed14"
|
|
69
69
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div role="status" aria-live="polite" :aria-busy="isLoading" :class="`pkt-loader--${inline ? 'inline' : 'box'}`">
|
|
3
3
|
<template v-if="isLoading">
|
|
4
|
-
<div :class="`pkt-loader pkt-loader--${props.size}`" data-testid="pkt-loader">
|
|
4
|
+
<div v-if="shouldDisplayLoader" :class="`pkt-loader pkt-loader--${props.size}`" data-testid="pkt-loader">
|
|
5
5
|
<PktIcon
|
|
6
6
|
:name="getVariant(variant)"
|
|
7
7
|
aria-label="loading"
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
20
|
<script setup>
|
|
21
|
+
import { ref, toRefs } from 'vue'
|
|
21
22
|
import PktIcon from '../icon/Icon.vue'
|
|
22
23
|
|
|
23
24
|
const props = defineProps({
|
|
@@ -40,9 +41,21 @@ const props = defineProps({
|
|
|
40
41
|
default: 'rainbow',
|
|
41
42
|
validator: (value) => ['blue', 'rainbow', 'shapes'].includes(value),
|
|
42
43
|
},
|
|
44
|
+
delay: {
|
|
45
|
+
type: Number,
|
|
46
|
+
default: 0,
|
|
47
|
+
},
|
|
43
48
|
})
|
|
44
49
|
|
|
45
50
|
const getVariant = (variant) => {
|
|
46
51
|
return variant === 'shapes' ? 'loader' : variant === 'blue' ? 'spinner-blue' : 'spinner'
|
|
47
52
|
}
|
|
53
|
+
|
|
54
|
+
const { delay } = toRefs(props)
|
|
55
|
+
let shouldDisplayLoader = ref(delay.value > 0 ? false : true)
|
|
56
|
+
|
|
57
|
+
delay.value > 0 &&
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
shouldDisplayLoader.value = true
|
|
60
|
+
}, delay.value)
|
|
48
61
|
</script>
|