@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 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 a=require("vue"),r=require("./Icon-Q_SkpRJa.cjs"),l=require("./plugins-AiK__HqQ.cjs"),d=["aria-busy"],u={key:0},n={__name:"Loader",props:{message:String,size:{type:String,default:"medium",validator:e=>["small","medium","large"].includes(e)},inline:{type:Boolean,default:!1},isLoading:{type:Boolean,default:!0},variant:{type:String,default:"rainbow",validator:e=>["blue","rainbow","shapes"].includes(e)}},setup(e){const o=e,i=t=>t==="shapes"?"loader":t==="blue"?"spinner-blue":"spinner";return(t,c)=>(a.openBlock(),a.createElementBlock("div",{role:"status","aria-live":"polite","aria-busy":e.isLoading,class:a.normalizeClass(`pkt-loader--${e.inline?"inline":"box"}`)},[e.isLoading?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(`pkt-loader pkt-loader--${o.size}`),"data-testid":"pkt-loader"},[a.createVNode(r.PktIcon,{name:i(e.variant),"aria-label":"loading",path:"https://punkt-cdn.oslo.kommune.no/latest/animations/",class:a.normalizeClass(`pkt-loader__svg pkt-loader__${e.variant}`)},null,8,["name","class"]),e.message?(a.openBlock(),a.createElementBlock("p",u,a.toDisplayString(e.message),1)):a.createCommentVNode("",!0)],2)):a.renderSlot(t.$slots,"default",{key:1})],10,d))}},s={install(e){l.registerComponent(e,n)}};l.use(s);exports.PktLoader=n;exports.default=s;
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;
@@ -1,7 +1,7 @@
1
- import { openBlock as t, createElementBlock as n, normalizeClass as s, createVNode as o, toDisplayString as r, createCommentVNode as d, renderSlot as u } from "vue";
2
- import { P as m } from "./Icon-s3ZNrtl-.js";
3
- import { u as c, a as p } from "./plugins-IeJb3XDX.js";
4
- const g = ["aria-busy"], k = { key: 0 }, f = {
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 i = e, l = (a) => a === "shapes" ? "loader" : a === "blue" ? "spinner-blue" : "spinner";
29
- return (a, b) => (t(), n("div", {
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: s(`pkt-loader--${e.inline ? "inline" : "box"}`)
40
+ class: n(`pkt-loader--${e.inline ? "inline" : "box"}`)
34
41
  }, [
35
- e.isLoading ? (t(), n("div", {
36
- key: 0,
37
- class: s(`pkt-loader pkt-loader--${i.size}`),
38
- "data-testid": "pkt-loader"
39
- }, [
40
- o(m, {
41
- name: l(e.variant),
42
- "aria-label": "loading",
43
- path: "https://punkt-cdn.oslo.kommune.no/latest/animations/",
44
- class: s(`pkt-loader__svg pkt-loader__${e.variant}`)
45
- }, null, 8, ["name", "class"]),
46
- e.message ? (t(), n("p", k, r(e.message), 1)) : d("", !0)
47
- ], 2)) : u(a.$slots, "default", { key: 1 })
48
- ], 10, g));
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
- }, y = {
59
+ }, B = {
51
60
  install(e) {
52
- p(e, f);
61
+ b(e, S);
53
62
  }
54
63
  };
55
- c(y);
64
+ v(B);
56
65
  export {
57
- f as PktLoader,
58
- y as default
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.5.3",
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": "683cde8f21abc895d5bea931ba2ae5a4eb5315ee"
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>