@kakadu/components 6.1.1 → 6.3.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.
Files changed (128) hide show
  1. package/build/components/aria-text.d.ts +2 -1
  2. package/build/components/box.d.ts +2 -1
  3. package/build/components/button-tooltip.d.ts +2 -1
  4. package/build/components/button.d.ts +3 -3
  5. package/build/components/button.js +1 -1
  6. package/build/components/button.mjs +27 -25
  7. package/build/components/card.d.ts +2 -2
  8. package/build/components/click-ripples.d.ts +2 -2
  9. package/build/components/click-ripples.js +1 -1
  10. package/build/components/click-ripples.mjs +50 -45
  11. package/build/components/collapsible.d.ts +2 -2
  12. package/build/components/combobox.d.ts +2 -2
  13. package/build/components/combobox.js +1 -1
  14. package/build/components/combobox.mjs +161 -159
  15. package/build/components/copy-icon-button.d.ts +2 -1
  16. package/build/components/datum.d.ts +2 -2
  17. package/build/components/dot.d.ts +2 -2
  18. package/build/components/flex.d.ts +2 -1
  19. package/build/components/footer.d.ts +2 -2
  20. package/build/components/gauge.d.ts +2 -1
  21. package/build/components/header.d.ts +2 -1
  22. package/build/components/hover-gradient.d.ts +2 -2
  23. package/build/components/hover-gradient.js +1 -1
  24. package/build/components/hover-gradient.mjs +48 -35
  25. package/build/components/icon-button.d.ts +2 -2
  26. package/build/components/input.d.ts +3 -3
  27. package/build/components/input.js +2 -2
  28. package/build/components/input.mjs +21 -21
  29. package/build/components/logos/akt-logo.d.ts +2 -2
  30. package/build/components/logos/amedia-logo.d.ts +2 -2
  31. package/build/components/logos/bankaxept-logo.d.ts +2 -2
  32. package/build/components/logos/bankid-logo.d.ts +2 -2
  33. package/build/components/logos/dnb-logo.d.ts +2 -2
  34. package/build/components/logos/entur-logo.d.ts +2 -2
  35. package/build/components/logos/gjensidige-logo.d.ts +2 -2
  36. package/build/components/logos/kakadu-academy-logo.d.ts +2 -2
  37. package/build/components/logos/kakadu-guide-icon.d.ts +2 -1
  38. package/build/components/logos/kakadu-guide-logo.d.ts +3 -3
  39. package/build/components/logos/kakadu-index-logo.d.ts +2 -2
  40. package/build/components/logos/kakadu-logo.d.ts +2 -2
  41. package/build/components/logos/kakadu-play-logo.d.ts +2 -2
  42. package/build/components/logos/kolumbus-logo.d.ts +2 -2
  43. package/build/components/logos/nordea-logo.d.ts +2 -2
  44. package/build/components/logos/norsk-tipping-logo.d.ts +2 -2
  45. package/build/components/logos/ruter-logo.d.ts +2 -2
  46. package/build/components/logos/senteret-for-et-aldersvennlig-norge-logo.d.ts +2 -2
  47. package/build/components/logos/sparebank1-logo.d.ts +2 -2
  48. package/build/components/logos/sparebanken-norge-logo.d.ts +2 -2
  49. package/build/components/logos/sto-logo.d.ts +2 -2
  50. package/build/components/logos/storebrand-logo.d.ts +2 -2
  51. package/build/components/modal.d.ts +6 -6
  52. package/build/components/modal.js +1 -1
  53. package/build/components/modal.mjs +86 -85
  54. package/build/components/moving-gradients.js +1 -1
  55. package/build/components/moving-gradients.mjs +80 -70
  56. package/build/components/moving-stars.js +1 -1
  57. package/build/components/moving-stars.mjs +77 -74
  58. package/build/components/notice.d.ts +2 -2
  59. package/build/components/notification.d.ts +8 -6
  60. package/build/components/notification.js +1 -1
  61. package/build/components/notification.mjs +87 -71
  62. package/build/components/popover-menu.d.ts +3 -3
  63. package/build/components/popover-menu.js +1 -1
  64. package/build/components/popover-menu.mjs +131 -129
  65. package/build/components/popover.d.ts +4 -4
  66. package/build/components/popover.js +1 -1
  67. package/build/components/popover.mjs +82 -73
  68. package/build/components/revealer.d.ts +2 -2
  69. package/build/components/select.d.ts +2 -2
  70. package/build/components/separator.d.ts +5 -5
  71. package/build/components/skeleton.d.ts +3 -2
  72. package/build/components/spinner.d.ts +3 -2
  73. package/build/components/text-button.d.ts +2 -2
  74. package/build/components/text.d.ts +9 -8
  75. package/build/components/theme-setter.d.ts +2 -2
  76. package/build/components/veil.d.ts +2 -1
  77. package/build/components/wrapper.d.ts +2 -2
  78. package/build/components.css +1 -1
  79. package/build/hooks/use-is-document-focused.js +1 -1
  80. package/build/hooks/use-is-document-focused.mjs +30 -14
  81. package/build/icons/anchor-down.d.ts +2 -2
  82. package/build/icons/anchor-up.d.ts +2 -2
  83. package/build/icons/arrow-down.d.ts +2 -2
  84. package/build/icons/arrow-left.d.ts +2 -2
  85. package/build/icons/arrow-right.d.ts +2 -2
  86. package/build/icons/arrow-up.d.ts +2 -2
  87. package/build/icons/caret-down.d.ts +2 -2
  88. package/build/icons/caret-left.d.ts +2 -2
  89. package/build/icons/caret-right.d.ts +2 -2
  90. package/build/icons/caret-up.d.ts +2 -2
  91. package/build/icons/check.d.ts +2 -2
  92. package/build/icons/chevron-down.d.ts +2 -2
  93. package/build/icons/chevron-left.d.ts +2 -2
  94. package/build/icons/chevron-right.d.ts +2 -2
  95. package/build/icons/chevron-up.d.ts +2 -2
  96. package/build/icons/chrome-browser-logo.d.ts +2 -2
  97. package/build/icons/cog.d.ts +2 -2
  98. package/build/icons/copy.d.ts +2 -2
  99. package/build/icons/document.d.ts +2 -2
  100. package/build/icons/dots.d.ts +2 -2
  101. package/build/icons/drag.d.ts +2 -2
  102. package/build/icons/edge-browser-logo.d.ts +2 -2
  103. package/build/icons/edit.d.ts +2 -2
  104. package/build/icons/exclamation-triangle.d.ts +2 -2
  105. package/build/icons/external.d.ts +2 -2
  106. package/build/icons/eye.d.ts +2 -2
  107. package/build/icons/icon.d.ts +2 -2
  108. package/build/icons/information.d.ts +2 -2
  109. package/build/icons/kakadu-guide-glyph.d.ts +2 -2
  110. package/build/icons/kakadu-guide-icon.d.ts +2 -2
  111. package/build/icons/menu.d.ts +2 -2
  112. package/build/icons/package.d.ts +2 -2
  113. package/build/icons/plus.d.ts +2 -2
  114. package/build/icons/select.d.ts +2 -2
  115. package/build/icons/share.d.ts +2 -2
  116. package/build/icons/sparkle.d.ts +2 -2
  117. package/build/icons/test.d.ts +2 -2
  118. package/build/icons/times.d.ts +2 -2
  119. package/build/icons/trash.d.ts +2 -2
  120. package/build/icons/trend-up.d.ts +2 -2
  121. package/build/index.d.ts +2 -0
  122. package/build/index.js +1 -1
  123. package/build/index.mjs +19 -17
  124. package/build/theme.d.ts +2 -1
  125. package/build/utilities/listeners.d.ts +5 -0
  126. package/build/utilities/listeners.js +1 -0
  127. package/build/utilities/listeners.mjs +16 -0
  128. package/package.json +16 -22
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const V=require("../jsx-runtime-BB_1_6y_.js"),s=require("react"),L=require("@kuma-ui/core"),O=require("../hooks/use-is-in-view.js"),T=require("../hooks/use-is-document-focused.js"),B=["rgb(46, 75, 164)","rgb(58, 125, 159)","rgb(42, 81, 142)","rgb(48, 132, 168)","rgb(45, 64, 157)"];function J(S){return S.map(C=>{var n;const[m,b,X]=((n=C.match(/\d+/g))==null?void 0:n.map(Number))??[];return[m,b,X]})}function K({className:S,colors:C=B,maximumGradientsCount:m=10,speed:b=1,opacity:X=.2}){const n=s.useRef(null),[h,E]=s.useState(),[g,$]=s.useState(0),[p,z]=s.useState(0),q=s.useMemo(()=>J(C),[C]),A=s.useMemo(()=>q.length,[q]),Y=s.useCallback(()=>{const f=Math.random(),y=q[Math.floor(A*f)],r=g*1.25,M=g*.25,v=p*1.25,e=p*.25,t=r*Math.random()-M,o=v*Math.random()-e,i=Math.max(r,v);return{color:y,size:i*f+i/2,opacity:0,speed:Math.max(.1,f/2*b),startPosition:[t,o],currentPosition:[t,o],targetPosition:[r*Math.random()-M,v*Math.random()-e]}},[q,A,g,p,b]),H=O.default(n),W=T.default(),F=s.useRef(!1);return F.current=!H||!W,s.useEffect(()=>{const a=Array.from({length:m}).map(()=>Y());let f=m,y=!1,r;function M(){if(!y){if(!h||F.current){r=requestAnimationFrame(M);return}h.clearRect(0,0,g,p);for(let e=a.length;e;e-=1){const t=a[e-1],[o,i]=t.startPosition,[c,u]=t.currentPosition,[l,d]=t.targetPosition;let x=!0;if(o>l?c>l&&(x=!1):c<l&&(x=!1),i>d?u>d&&(x=!1):u<d&&(x=!1),x){a.splice(e-1,1),f-=1;continue}const _=(o+l)/2-o,D=c-o,G=(i+d)/2-i,N=u-i,R=(D/_+N/G)/2;t.opacity=R>1?2-R:R;const j=t.size/2,I=h.createRadialGradient(c,u,j,c,u,0);if(I.addColorStop(0,`rgba(${t.color.join(",")},0)`),I.addColorStop(1,`rgba(${t.color.join(",")},${t.opacity})`),h.fillStyle=I,h.fillRect(c-j,u-j,t.size,t.size),c!==l){const k=Math.abs(o-l),w=Math.abs(i-d),P=Math.min(1,k/w);c<l?t.currentPosition[0]+=t.speed*P:t.currentPosition[0]-=t.speed*P}if(u!==d){const k=Math.abs(o-l),w=Math.abs(i-d),P=Math.min(1,w/k);u<d?t.currentPosition[1]+=t.speed*P:t.currentPosition[1]-=t.speed*P}}r=requestAnimationFrame(M)}}r=requestAnimationFrame(M);const v=setInterval(()=>{if(F.current)return;let e=m-f;if(e>0)for(;e;)a.push(Y()),e-=1,f+=1},1500);return()=>{y=!0,r&&cancelAnimationFrame(r),clearInterval(v)}},[m,Y,h,g,p,b]),s.useEffect(()=>{if(n.current){const a=n.current.getContext("2d");a&&E(a),$(n.current.offsetWidth),z(n.current.offsetHeight)}},[n]),V.jsxRuntimeExports.jsx("canvas",{ref:n,"aria-hidden":!0,role:"presentation",width:g,height:p,style:{"--opacity":X},className:L.cx("kakadu-components-4131181690",S)})}exports.default=K;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N=require("../jsx-runtime-BB_1_6y_.js"),o=require("react"),O=require("@kuma-ui/core"),V=require("../hooks/use-is-in-view.js"),T=require("../hooks/use-is-document-focused.js"),B=require("../utilities/listeners.js"),J=B.default(m=>{window.addEventListener("resize",m,{passive:!0})},m=>{window.removeEventListener("resize",m)}),K=["rgb(46, 75, 164)","rgb(58, 125, 159)","rgb(42, 81, 142)","rgb(48, 132, 168)","rgb(45, 64, 157)"];function Q(m){return m.map(C=>{var t;const[M,q,R]=((t=C.match(/\d+/g))==null?void 0:t.map(Number))??[];return[M,q,R]})}function U({className:m,colors:C=K,maximumGradientsCount:M=10,speed:q=1,opacity:R=.2}){const t=o.useRef(null),[h,H]=o.useState(),[g,j]=o.useState(0),[p,F]=o.useState(0),w=o.useMemo(()=>Q(C),[C]),I=o.useMemo(()=>w.length,[w]),y=o.useCallback(()=>{const n=Math.random(),b=w[Math.floor(I*n)],u=g*1.25,i=g*.25,s=p*1.25,e=p*.25,a=u*Math.random()-i,c=s*Math.random()-e,r=Math.max(u,s);return{color:b,size:r*n+r/2,opacity:0,speed:Math.max(.1,n/2*q),startPosition:[a,c],currentPosition:[a,c],targetPosition:[u*Math.random()-i,s*Math.random()-e]}},[w,I,g,p,q]),L=V.default(t),W=T.default(),k=!L||!W,G=o.useRef(Array.from({length:M}).map(()=>y()));return o.useEffect(()=>{if(k||!h)return;let v=!1,n;function b(){if(v||!h)return;const i=G.current;h.clearRect(0,0,g,p);for(let s=i.length;s;s-=1){const e=i[s-1],[a,c]=e.startPosition,[r,l]=e.currentPosition,[d,f]=e.targetPosition;let x=!0;if(a>d?r>d&&(x=!1):r<d&&(x=!1),c>f?l>f&&(x=!1):l<f&&(x=!1),x){i.splice(s-1,1);continue}const _=(a+d)/2-a,$=r-a,A=(c+f)/2-c,D=l-c,z=($/(_||1)+D/(A||1))/2;e.opacity=z>1?2-z:z;const S=e.size/2,X=h.createRadialGradient(r,l,S,r,l,0);if(X.addColorStop(0,`rgba(${e.color.join(",")},0)`),X.addColorStop(1,`rgba(${e.color.join(",")},${e.opacity})`),h.fillStyle=X,h.fillRect(r-S,l-S,e.size,e.size),r!==d){const Y=Math.abs(a-d),E=Math.abs(c-f),P=Math.min(1,Y/E);r<d?e.currentPosition[0]+=e.speed*P:e.currentPosition[0]-=e.speed*P}if(l!==f){const Y=Math.abs(a-d),E=Math.abs(c-f),P=Math.min(1,E/Y);l<f?e.currentPosition[1]+=e.speed*P:e.currentPosition[1]-=e.speed*P}}n=requestAnimationFrame(b)}n=requestAnimationFrame(b);const u=setInterval(()=>{const i=G.current;let s=i.length,e=M-s;if(e>0)for(;e;)i.push(y()),e-=1,s+=1},1500);return()=>{v=!0,n&&cancelAnimationFrame(n),clearInterval(u)}},[k,h,g,p,M,y]),o.useEffect(()=>{if(t.current){const v=t.current.getContext("2d");v&&H(v),j(t.current.offsetWidth),F(t.current.offsetHeight);const n=()=>{t.current&&(j(t.current.offsetWidth),F(t.current.offsetHeight))},b=J(n),u=new ResizeObserver(n);return u.observe(t.current),()=>{b(),u.disconnect()}}},[t]),N.jsxRuntimeExports.jsx("canvas",{ref:t,"aria-hidden":!0,role:"presentation",width:g,height:p,style:{"--opacity":R},className:O.cx("kakadu-components-4131181690",m)})}exports.default=U;
@@ -1,90 +1,100 @@
1
- import { j as K } from "../jsx-runtime-B4hRZ52C.mjs";
2
- import { useRef as H, useState as z, useMemo as S, useCallback as O, useEffect as W } from "react";
1
+ import { j as J } from "../jsx-runtime-B4hRZ52C.mjs";
2
+ import { useRef as q, useState as I, useMemo as A, useCallback as K, useEffect as S } from "react";
3
3
  import { cx as Q } from "@kuma-ui/core";
4
4
  import T from "../hooks/use-is-in-view.mjs";
5
5
  import U from "../hooks/use-is-document-focused.mjs";
6
- const Z = ["rgb(46, 75, 164)", "rgb(58, 125, 159)", "rgb(42, 81, 142)", "rgb(48, 132, 168)", "rgb(45, 64, 157)"];
7
- function _(X) {
8
- return X.map((P) => {
9
- var n;
10
- const [f, M, Y] = ((n = P.match(/\d+/g)) == null ? void 0 : n.map(Number)) ?? [];
11
- return [f, M, Y];
6
+ import Z from "../utilities/listeners.mjs";
7
+ const _ = Z((f) => {
8
+ window.addEventListener("resize", f, {
9
+ passive: !0
10
+ });
11
+ }, (f) => {
12
+ window.removeEventListener("resize", f);
13
+ }), tt = ["rgb(46, 75, 164)", "rgb(58, 125, 159)", "rgb(42, 81, 142)", "rgb(48, 132, 168)", "rgb(45, 64, 157)"];
14
+ function et(f) {
15
+ return f.map((C) => {
16
+ var e;
17
+ const [b, P, z] = ((e = C.match(/\d+/g)) == null ? void 0 : e.map(Number)) ?? [];
18
+ return [b, P, z];
12
19
  });
13
20
  }
14
- function st({
15
- className: X,
16
- colors: P = Z,
17
- maximumGradientsCount: f = 10,
18
- speed: M = 1,
19
- opacity: Y = 0.2
21
+ function ct({
22
+ className: f,
23
+ colors: C = tt,
24
+ maximumGradientsCount: b = 10,
25
+ speed: P = 1,
26
+ opacity: z = 0.2
20
27
  }) {
21
- const n = H(null), [m, k] = z(), [h, D] = z(0), [p, $] = z(0), C = S(() => _(P), [P]), E = S(() => C.length, [C]), F = O(() => {
22
- const d = Math.random(), y = C[Math.floor(E * d)], o = h * 1.25, g = h * 0.25, b = p * 1.25, e = p * 0.25, t = o * Math.random() - g, r = b * Math.random() - e, s = Math.max(o, b);
28
+ const e = q(null), [m, k] = I(), [h, L] = I(0), [p, j] = I(0), w = A(() => et(C), [C]), G = A(() => w.length, [w]), y = K(() => {
29
+ const n = Math.random(), v = w[Math.floor(G * n)], c = h * 1.25, o = h * 0.25, r = p * 1.25, t = p * 0.25, i = c * Math.random() - o, a = r * Math.random() - t, s = Math.max(c, r);
23
30
  return {
24
- color: y,
25
- size: s * d + s / 2,
31
+ color: v,
32
+ size: s * n + s / 2,
26
33
  opacity: 0,
27
- speed: Math.max(0.1, d / 2 * M),
28
- startPosition: [t, r],
29
- currentPosition: [t, r],
30
- targetPosition: [o * Math.random() - g, b * Math.random() - e]
34
+ speed: Math.max(0.1, n / 2 * P),
35
+ startPosition: [i, a],
36
+ currentPosition: [i, a],
37
+ targetPosition: [c * Math.random() - o, r * Math.random() - t]
31
38
  };
32
- }, [C, E, h, p, M]), G = T(n), N = U(), I = H(!1);
33
- return I.current = !G || !N, W(() => {
34
- const i = Array.from({
35
- length: f
36
- }).map(() => F());
37
- let d = f, y = !1, o;
38
- function g() {
39
- if (!y) {
40
- if (!m || I.current) {
41
- o = requestAnimationFrame(g);
42
- return;
39
+ }, [w, G, h, p, P]), D = T(e), $ = U(), H = !D || !$, W = q(Array.from({
40
+ length: b
41
+ }).map(() => y()));
42
+ return S(() => {
43
+ if (H || !m)
44
+ return;
45
+ let g = !1, n;
46
+ function v() {
47
+ if (g || !m)
48
+ return;
49
+ const o = W.current;
50
+ m.clearRect(0, 0, h, p);
51
+ for (let r = o.length; r; r -= 1) {
52
+ const t = o[r - 1], [i, a] = t.startPosition, [s, l] = t.currentPosition, [u, d] = t.targetPosition;
53
+ let M = !0;
54
+ if (i > u ? s > u && (M = !1) : s < u && (M = !1), a > d ? l > d && (M = !1) : l < d && (M = !1), M) {
55
+ o.splice(r - 1, 1);
56
+ continue;
43
57
  }
44
- m.clearRect(0, 0, h, p);
45
- for (let e = i.length; e; e -= 1) {
46
- const t = i[e - 1], [r, s] = t.startPosition, [a, c] = t.currentPosition, [l, u] = t.targetPosition;
47
- let v = !0;
48
- if (r > l ? a > l && (v = !1) : a < l && (v = !1), s > u ? c > u && (v = !1) : c < u && (v = !1), v) {
49
- i.splice(e - 1, 1), d -= 1;
50
- continue;
51
- }
52
- const V = (r + l) / 2 - r, L = a - r, B = (s + u) / 2 - s, J = c - s, j = (L / V + J / B) / 2;
53
- t.opacity = j > 1 ? 2 - j : j;
54
- const q = t.size / 2, w = m.createRadialGradient(a, c, q, a, c, 0);
55
- if (w.addColorStop(0, `rgba(${t.color.join(",")},0)`), w.addColorStop(1, `rgba(${t.color.join(",")},${t.opacity})`), m.fillStyle = w, m.fillRect(a - q, c - q, t.size, t.size), a !== l) {
56
- const A = Math.abs(r - l), R = Math.abs(s - u), x = Math.min(1, A / R);
57
- a < l ? t.currentPosition[0] += t.speed * x : t.currentPosition[0] -= t.speed * x;
58
- }
59
- if (c !== u) {
60
- const A = Math.abs(r - l), R = Math.abs(s - u), x = Math.min(1, R / A);
61
- c < u ? t.currentPosition[1] += t.speed * x : t.currentPosition[1] -= t.speed * x;
62
- }
58
+ const N = (i + u) / 2 - i, V = s - i, O = (a + d) / 2 - a, B = l - a, R = (V / (N || 1) + B / (O || 1)) / 2;
59
+ t.opacity = R > 1 ? 2 - R : R;
60
+ const X = t.size / 2, Y = m.createRadialGradient(s, l, X, s, l, 0);
61
+ if (Y.addColorStop(0, `rgba(${t.color.join(",")},0)`), Y.addColorStop(1, `rgba(${t.color.join(",")},${t.opacity})`), m.fillStyle = Y, m.fillRect(s - X, l - X, t.size, t.size), s !== u) {
62
+ const E = Math.abs(i - u), F = Math.abs(a - d), x = Math.min(1, E / F);
63
+ s < u ? t.currentPosition[0] += t.speed * x : t.currentPosition[0] -= t.speed * x;
64
+ }
65
+ if (l !== d) {
66
+ const E = Math.abs(i - u), F = Math.abs(a - d), x = Math.min(1, F / E);
67
+ l < d ? t.currentPosition[1] += t.speed * x : t.currentPosition[1] -= t.speed * x;
63
68
  }
64
- o = requestAnimationFrame(g);
65
69
  }
70
+ n = requestAnimationFrame(v);
66
71
  }
67
- o = requestAnimationFrame(g);
68
- const b = setInterval(() => {
69
- if (I.current)
70
- return;
71
- let e = f - d;
72
- if (e > 0)
73
- for (; e; )
74
- i.push(F()), e -= 1, d += 1;
72
+ n = requestAnimationFrame(v);
73
+ const c = setInterval(() => {
74
+ const o = W.current;
75
+ let r = o.length, t = b - r;
76
+ if (t > 0)
77
+ for (; t; )
78
+ o.push(y()), t -= 1, r += 1;
75
79
  }, 1500);
76
80
  return () => {
77
- y = !0, o && cancelAnimationFrame(o), clearInterval(b);
81
+ g = !0, n && cancelAnimationFrame(n), clearInterval(c);
78
82
  };
79
- }, [f, F, m, h, p, M]), W(() => {
80
- if (n.current) {
81
- const i = n.current.getContext("2d");
82
- i && k(i), D(n.current.offsetWidth), $(n.current.offsetHeight);
83
+ }, [H, m, h, p, b, y]), S(() => {
84
+ if (e.current) {
85
+ const g = e.current.getContext("2d");
86
+ g && k(g), L(e.current.offsetWidth), j(e.current.offsetHeight);
87
+ const n = () => {
88
+ e.current && (L(e.current.offsetWidth), j(e.current.offsetHeight));
89
+ }, v = _(n), c = new ResizeObserver(n);
90
+ return c.observe(e.current), () => {
91
+ v(), c.disconnect();
92
+ };
83
93
  }
84
- }, [n]), /* @__PURE__ */ K.jsx("canvas", { ref: n, "aria-hidden": !0, role: "presentation", width: h, height: p, style: {
85
- "--opacity": Y
86
- }, className: Q("kakadu-components-4131181690", X) });
94
+ }, [e]), /* @__PURE__ */ J.jsx("canvas", { ref: e, "aria-hidden": !0, role: "presentation", width: h, height: p, style: {
95
+ "--opacity": z
96
+ }, className: Q("kakadu-components-4131181690", f) });
87
97
  }
88
98
  export {
89
- st as default
99
+ ct as default
90
100
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("../jsx-runtime-BB_1_6y_.js"),r=require("react"),B=require("@kuma-ui/core"),G=require("../hooks/use-is-in-view.js"),J=require("../hooks/use-is-document-focused.js");function K({color:q,opacity:H,className:W,minimumSize:I=1,maximumSize:A=5,maximumStarsCount:x=50,speed:w=1,hasMask:j=!1}){const e=r.useRef(null),[o,_]=r.useState(),[f,R]=r.useState(0),[d,S]=r.useState(0),y=r.useCallback(()=>{const n=f*1.5,s=f*.25,a=d*1.5,i=d*.25,M=n*Math.random()-s,h=a*Math.random()-i;return{size:Math.max(I,A*Math.random()),opacity:0,speed:Math.max(.1,Math.random()/2*w),startPosition:[M,h],currentPosition:[M,h],targetPosition:[n*Math.random()-s,a*Math.random()-i]}},[f,d,I,A,w]),C=r.useCallback(()=>q??(e.current?getComputedStyle(e.current).color:"#000"),[q,e]),z=G.default(e),D=J.default(),k=r.useRef(!1);return k.current=!z||!D,r.useEffect(()=>{const n=Array.from({length:x}).map(()=>y());let s=x,a=!1,i,M=C();function h(){if(!a){if(!o||k.current){i=requestAnimationFrame(h);return}o.clearRect(0,0,f,d);for(let c=n.length;c;c-=1){const t=n[c-1],[v,p]=t.startPosition,[g,m]=t.currentPosition,[u,l]=t.targetPosition;let P=!0;if(v>u?g>u&&(P=!1):g<u&&(P=!1),p>l?m>l&&(P=!1):m<l&&(P=!1),P){n.splice(c-1,1),s-=1;continue}const O=(v+u)/2-v,V=g-v,$=(p+l)/2-p,N=m-p,X=(V/O+N/$)/2;t.opacity=X>1?2-X:X;const Y=t.size/2;if(o.beginPath(),o.arc(g-Y,m-Y,Y,0,2*Math.PI,!1),o.globalAlpha=t.opacity,o.fillStyle=M,o.fill(),g!==u){const E=Math.abs(v-u),F=Math.abs(p-l),b=Math.min(1,E/F);g<u?t.currentPosition[0]+=t.speed*b:t.currentPosition[0]-=t.speed*b}if(m!==l){const E=Math.abs(v-u),F=Math.abs(p-l),b=Math.min(1,F/E);m<l?t.currentPosition[1]+=t.speed*b:t.currentPosition[1]-=t.speed*b}}i=requestAnimationFrame(h)}}i=requestAnimationFrame(h);const L=setInterval(()=>{if(k.current)return;M=C();let c=x-s;if(c>0)for(;c;)n.push(y()),c-=1,s+=1},500);return()=>{a=!0,i&&cancelAnimationFrame(i),clearInterval(L)}},[x,y,C,o,f,d,w]),r.useEffect(()=>{if(e.current){const n=e.current.getContext("2d");n&&_(n),R(e.current.offsetWidth),S(e.current.offsetHeight);const s=()=>{e.current&&(R(e.current.offsetWidth),S(e.current.offsetHeight))},a=new ResizeObserver(s);return a.observe(e.current),window.addEventListener("resize",s,{passive:!0}),()=>{a.disconnect(),window.removeEventListener("resize",s)}}},[e]),T.jsxRuntimeExports.jsx("canvas",{ref:e,"aria-hidden":!0,role:"presentation",style:{"--color":q,"--opacity":H},className:B.cx("kakadu-components-3366903902",j&&"kakadu-components-4049648322",W),width:f,height:d})}exports.default=K;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("../jsx-runtime-BB_1_6y_.js"),o=require("react"),B=require("@kuma-ui/core"),G=require("../hooks/use-is-in-view.js"),J=require("../hooks/use-is-document-focused.js"),K=require("../utilities/listeners.js"),Q=K.default(l=>{window.addEventListener("resize",l,{passive:!0})},l=>{window.removeEventListener("resize",l)});function U({color:l,opacity:H,className:W,minimumSize:X=1,maximumSize:Y=5,maximumStarsCount:q=50,speed:E=1,hasMask:_=!1}){const t=o.useRef(null),[n,j]=o.useState(),[h,I]=o.useState(0),[v,F]=o.useState(0),C=o.useCallback(()=>{const i=h*1.5,s=h*.25,d=v*1.5,a=v*.25,x=i*Math.random()-s,r=d*Math.random()-a;return{size:Math.max(X,Y*Math.random()),opacity:0,speed:Math.max(.1,Math.random()/2*E),startPosition:[x,r],currentPosition:[x,r],targetPosition:[i*Math.random()-s,d*Math.random()-a]}},[h,v,X,Y,E]),w=o.useCallback(()=>l??(t.current?getComputedStyle(t.current).color:"#000"),[l,t]),L=G.default(t),D=J.default(),z=!L||!D,A=o.useRef(Array.from({length:q}).map(()=>C()));return o.useEffect(()=>{if(z||!n)return;let i=!1,s,d=w();function a(){if(i||!n)return;const r=A.current;n.clearRect(0,0,h,v);for(let f=r.length;f;f-=1){const e=r[f-1],[p,g]=e.startPosition,[m,M]=e.currentPosition,[c,u]=e.targetPosition;let P=!0;if(p>c?m>c&&(P=!1):m<c&&(P=!1),g>u?M>u&&(P=!1):M<u&&(P=!1),P){r.splice(f-1,1);continue}const O=(p+c)/2-p,V=m-p,$=(g+u)/2-g,N=M-g,y=(V/(O||1)+N/($||1))/2;e.opacity=y>1?2-y:y;const S=e.size/2;if(n.beginPath(),n.arc(m-S,M-S,S,0,2*Math.PI,!1),n.globalAlpha=e.opacity,n.fillStyle=d,n.fill(),m!==c){const k=Math.abs(p-c),R=Math.abs(g-u),b=Math.min(1,k/R);m<c?e.currentPosition[0]+=e.speed*b:e.currentPosition[0]-=e.speed*b}if(M!==u){const k=Math.abs(p-c),R=Math.abs(g-u),b=Math.min(1,R/k);M<u?e.currentPosition[1]+=e.speed*b:e.currentPosition[1]-=e.speed*b}}s=requestAnimationFrame(a)}s=requestAnimationFrame(a);const x=setInterval(()=>{d=w();const r=A.current;let f=r.length,e=q-f;if(e>0)for(;e;)r.push(C()),e-=1,f+=1},500);return()=>{i=!0,s&&cancelAnimationFrame(s),clearInterval(x)}},[z,n,w,h,v,q,C]),o.useEffect(()=>{if(t.current){const i=t.current.getContext("2d");i&&j(i),I(t.current.offsetWidth),F(t.current.offsetHeight);const s=()=>{t.current&&(I(t.current.offsetWidth),F(t.current.offsetHeight))},d=Q(s),a=new ResizeObserver(s);return a.observe(t.current),()=>{d(),a.disconnect()}}},[t]),T.jsxRuntimeExports.jsx("canvas",{ref:t,"aria-hidden":!0,role:"presentation",style:{"--color":l,"--opacity":H},className:B.cx("kakadu-components-3366903902",_&&"kakadu-components-4049648322",W),width:h,height:v})}exports.default=U;
@@ -1,94 +1,97 @@
1
1
  import { j as T } from "../jsx-runtime-B4hRZ52C.mjs";
2
- import { useRef as R, useState as E, useCallback as j, useEffect as z } from "react";
2
+ import { useRef as S, useState as E, useCallback as W, useEffect as q } from "react";
3
3
  import { cx as U } from "@kuma-ui/core";
4
4
  import Z from "../hooks/use-is-in-view.mjs";
5
5
  import _ from "../hooks/use-is-document-focused.mjs";
6
- function st({
7
- color: b,
8
- opacity: D,
9
- className: L,
10
- minimumSize: k = 1,
11
- maximumSize: q = 5,
12
- maximumStarsCount: x = 50,
13
- speed: w = 1,
14
- hasMask: S = !1
6
+ import $ from "../utilities/listeners.mjs";
7
+ const tt = $((l) => {
8
+ window.addEventListener("resize", l, {
9
+ passive: !0
10
+ });
11
+ }, (l) => {
12
+ window.removeEventListener("resize", l);
13
+ });
14
+ function at({
15
+ color: l,
16
+ opacity: j,
17
+ className: D,
18
+ minimumSize: F = 1,
19
+ maximumSize: R = 5,
20
+ maximumStarsCount: b = 50,
21
+ speed: k = 1,
22
+ hasMask: V = !1
15
23
  }) {
16
- const t = R(null), [s, V] = E(), [u, H] = E(0), [f, W] = E(0), y = j(() => {
17
- const n = u * 1.5, r = u * 0.25, o = f * 1.5, i = f * 0.25, g = n * Math.random() - r, d = o * Math.random() - i;
24
+ const e = S(null), [s, N] = E(), [d, z] = E(0), [h, A] = E(0), w = W(() => {
25
+ const o = d * 1.5, n = d * 0.25, u = h * 1.5, i = h * 0.25, x = o * Math.random() - n, r = u * Math.random() - i;
18
26
  return {
19
- size: Math.max(k, q * Math.random()),
27
+ size: Math.max(F, R * Math.random()),
20
28
  opacity: 0,
21
- speed: Math.max(0.1, Math.random() / 2 * w),
22
- startPosition: [g, d],
23
- currentPosition: [g, d],
24
- targetPosition: [n * Math.random() - r, o * Math.random() - i]
29
+ speed: Math.max(0.1, Math.random() / 2 * k),
30
+ startPosition: [x, r],
31
+ currentPosition: [x, r],
32
+ targetPosition: [o * Math.random() - n, u * Math.random() - i]
25
33
  };
26
- }, [u, f, k, q, w]), C = j(() => b ?? (t.current ? getComputedStyle(t.current).color : "#000"), [b, t]), N = Z(t), O = _(), X = R(!1);
27
- return X.current = !N || !O, z(() => {
28
- const n = Array.from({
29
- length: x
30
- }).map(() => y());
31
- let r = x, o = !1, i, g = C();
32
- function d() {
33
- if (!o) {
34
- if (!s || X.current) {
35
- i = requestAnimationFrame(d);
36
- return;
34
+ }, [d, h, F, R, k]), C = W(() => l ?? (e.current ? getComputedStyle(e.current).color : "#000"), [l, e]), O = Z(e), B = _(), H = !O || !B, L = S(Array.from({
35
+ length: b
36
+ }).map(() => w()));
37
+ return q(() => {
38
+ if (H || !s)
39
+ return;
40
+ let o = !1, n, u = C();
41
+ function i() {
42
+ if (o || !s)
43
+ return;
44
+ const r = L.current;
45
+ s.clearRect(0, 0, d, h);
46
+ for (let f = r.length; f; f -= 1) {
47
+ const t = r[f - 1], [m, p] = t.startPosition, [v, g] = t.currentPosition, [a, c] = t.targetPosition;
48
+ let M = !0;
49
+ if (m > a ? v > a && (M = !1) : v < a && (M = !1), p > c ? g > c && (M = !1) : g < c && (M = !1), M) {
50
+ r.splice(f - 1, 1);
51
+ continue;
52
+ }
53
+ const G = (m + a) / 2 - m, J = v - m, K = (p + c) / 2 - p, Q = g - p, y = (J / (G || 1) + Q / (K || 1)) / 2;
54
+ t.opacity = y > 1 ? 2 - y : y;
55
+ const X = t.size / 2;
56
+ if (s.beginPath(), s.arc(v - X, g - X, X, 0, 2 * Math.PI, !1), s.globalAlpha = t.opacity, s.fillStyle = u, s.fill(), v !== a) {
57
+ const Y = Math.abs(m - a), I = Math.abs(p - c), P = Math.min(1, Y / I);
58
+ v < a ? t.currentPosition[0] += t.speed * P : t.currentPosition[0] -= t.speed * P;
37
59
  }
38
- s.clearRect(0, 0, u, f);
39
- for (let a = n.length; a; a -= 1) {
40
- const e = n[a - 1], [h, m] = e.startPosition, [p, v] = e.currentPosition, [c, l] = e.targetPosition;
41
- let M = !0;
42
- if (h > c ? p > c && (M = !1) : p < c && (M = !1), m > l ? v > l && (M = !1) : v < l && (M = !1), M) {
43
- n.splice(a - 1, 1), r -= 1;
44
- continue;
45
- }
46
- const G = (h + c) / 2 - h, J = p - h, K = (m + l) / 2 - m, Q = v - m, Y = (J / G + Q / K) / 2;
47
- e.opacity = Y > 1 ? 2 - Y : Y;
48
- const F = e.size / 2;
49
- if (s.beginPath(), s.arc(p - F, v - F, F, 0, 2 * Math.PI, !1), s.globalAlpha = e.opacity, s.fillStyle = g, s.fill(), p !== c) {
50
- const I = Math.abs(h - c), A = Math.abs(m - l), P = Math.min(1, I / A);
51
- p < c ? e.currentPosition[0] += e.speed * P : e.currentPosition[0] -= e.speed * P;
52
- }
53
- if (v !== l) {
54
- const I = Math.abs(h - c), A = Math.abs(m - l), P = Math.min(1, A / I);
55
- v < l ? e.currentPosition[1] += e.speed * P : e.currentPosition[1] -= e.speed * P;
56
- }
60
+ if (g !== c) {
61
+ const Y = Math.abs(m - a), I = Math.abs(p - c), P = Math.min(1, I / Y);
62
+ g < c ? t.currentPosition[1] += t.speed * P : t.currentPosition[1] -= t.speed * P;
57
63
  }
58
- i = requestAnimationFrame(d);
59
64
  }
65
+ n = requestAnimationFrame(i);
60
66
  }
61
- i = requestAnimationFrame(d);
62
- const B = setInterval(() => {
63
- if (X.current)
64
- return;
65
- g = C();
66
- let a = x - r;
67
- if (a > 0)
68
- for (; a; )
69
- n.push(y()), a -= 1, r += 1;
67
+ n = requestAnimationFrame(i);
68
+ const x = setInterval(() => {
69
+ u = C();
70
+ const r = L.current;
71
+ let f = r.length, t = b - f;
72
+ if (t > 0)
73
+ for (; t; )
74
+ r.push(w()), t -= 1, f += 1;
70
75
  }, 500);
71
76
  return () => {
72
- o = !0, i && cancelAnimationFrame(i), clearInterval(B);
77
+ o = !0, n && cancelAnimationFrame(n), clearInterval(x);
73
78
  };
74
- }, [x, y, C, s, u, f, w]), z(() => {
75
- if (t.current) {
76
- const n = t.current.getContext("2d");
77
- n && V(n), H(t.current.offsetWidth), W(t.current.offsetHeight);
78
- const r = () => {
79
- t.current && (H(t.current.offsetWidth), W(t.current.offsetHeight));
80
- }, o = new ResizeObserver(r);
81
- return o.observe(t.current), window.addEventListener("resize", r, {
82
- passive: !0
83
- }), () => {
84
- o.disconnect(), window.removeEventListener("resize", r);
79
+ }, [H, s, C, d, h, b, w]), q(() => {
80
+ if (e.current) {
81
+ const o = e.current.getContext("2d");
82
+ o && N(o), z(e.current.offsetWidth), A(e.current.offsetHeight);
83
+ const n = () => {
84
+ e.current && (z(e.current.offsetWidth), A(e.current.offsetHeight));
85
+ }, u = tt(n), i = new ResizeObserver(n);
86
+ return i.observe(e.current), () => {
87
+ u(), i.disconnect();
85
88
  };
86
89
  }
87
- }, [t]), /* @__PURE__ */ T.jsx("canvas", { ref: t, "aria-hidden": !0, role: "presentation", style: {
88
- "--color": b,
89
- "--opacity": D
90
- }, className: U("kakadu-components-3366903902", S && "kakadu-components-4049648322", L), width: u, height: f });
90
+ }, [e]), /* @__PURE__ */ T.jsx("canvas", { ref: e, "aria-hidden": !0, role: "presentation", style: {
91
+ "--color": l,
92
+ "--opacity": j
93
+ }, className: U("kakadu-components-3366903902", V && "kakadu-components-4049648322", D), width: d, height: h });
91
94
  }
92
95
  export {
93
- st as default
96
+ at as default
94
97
  };
@@ -1,4 +1,4 @@
1
- import { type HTMLProps } from 'react';
1
+ import React, { type HTMLProps } from 'react';
2
2
  import { type IconType } from '../icons/icon';
3
3
  export declare const noticeTypes: readonly ["default", "success", "information", "warning", "danger"];
4
4
  export type NoticeType = (typeof noticeTypes)[number];
@@ -6,4 +6,4 @@ export type NoticeProperties = HTMLProps<HTMLDivElement> & {
6
6
  readonly type?: NoticeType;
7
7
  readonly icon?: IconType;
8
8
  };
9
- export default function Notice({ type, icon, className, children, ...properties }: NoticeProperties): import("react/jsx-runtime").JSX.Element;
9
+ export default function Notice({ type, icon, className, children, ...properties }: NoticeProperties): React.JSX.Element;
@@ -1,4 +1,4 @@
1
- import { type HTMLProps, type ReactNode } from 'react';
1
+ import React, { type HTMLProps, type ReactNode } from 'react';
2
2
  import { type IconType } from '../icons/icon';
3
3
  import { type NoticeType } from './notice';
4
4
  export { noticeTypes as notificationTypes } from './notice';
@@ -8,12 +8,14 @@ export type NotificationProperties = {
8
8
  readonly type?: NoticeType;
9
9
  readonly icon?: IconType;
10
10
  readonly children: ReactNode;
11
- readonly onDismiss?: (index: number) => void;
11
+ readonly onDismiss?: (id: string) => void;
12
12
  };
13
- export default function Notification({ type, icon, index, className, children, onDismiss, ...properties }: NotificationProperties & {
13
+ export default function Notification({ type, icon, id, index: inputIndex, shouldDismiss, className, children, onDismiss, ...properties }: NotificationProperties & {
14
14
  readonly index?: number;
15
- } & HTMLProps<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
15
+ readonly shouldDismiss?: boolean;
16
+ } & HTMLProps<HTMLDivElement>): React.JSX.Element;
16
17
  export declare function useCreateNotification(): (notification: NotificationProperties) => void;
17
- export declare function NotificationProvider({ children, }: {
18
+ export declare function NotificationProvider({ limit, children, }: {
19
+ readonly limit?: number;
18
20
  readonly children: ReactNode;
19
- }): import("react/jsx-runtime").JSX.Element;
21
+ }): React.JSX.Element;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../jsx-runtime-BB_1_6y_.js"),e=require("react"),p=require("@kuma-ui/core"),M=require("../utilities/generate-random-id.js"),j=require("./notice.js");function E({type:n,icon:d,index:u,className:c,children:m,onDismiss:s,...o}){const[t,a]=e.useState(!1),[l,C]=e.useState(!1),[f,k]=e.useState(!1);e.useEffect(()=>{const r=setTimeout(()=>{a(!0)},250);return()=>{clearTimeout(r)}},[]);const N=e.useRef(0),v=e.useRef(0),R=e.useCallback(()=>{k(!0)},[]),b=e.useCallback(()=>{k(!1)},[]);e.useEffect(()=>{if(f){v.current+=Date.now()-N.current;return}if(t){N.current=Date.now();const r=6e3-v.current,h=setTimeout(()=>{a(!1),C(!0)},r);return()=>{clearTimeout(h)}}},[f,t]);const x=u??0;return e.useEffect(()=>{if(l&&!t){const r=setTimeout(()=>{s==null||s(x)},300);return()=>{clearTimeout(r)}}},[l,t,s,x]),i.jsxRuntimeExports.jsx("div",{...o,style:{"--index":x},className:p.cx("kakadu-components-1727618227",t&&"kakadu-components-3003995416",c),children:i.jsxRuntimeExports.jsxs(j.default,{role:"status","aria-live":"polite","aria-atomic":"true",type:n,icon:d,className:p.cx("kakadu-components-3951461646",t&&"kakadu-components-2837603142"),onMouseEnter:R,onMouseLeave:b,children:[m,i.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2751825161",children:i.jsxRuntimeExports.jsx("div",{className:p.cx("kakadu-components-47664046",f?"kakadu-components-758522476":"kakadu-components-3914681513")})})]})})}const T=e.createContext({createNotification(){throw new Error("useCreateNotification must be used within a NotificationProvider")}});function S(){const{createNotification:n}=e.useContext(T);return n}function q({children:n}){const[d,u]=e.useState([]),c=e.useCallback(o=>{const t=M.default();u(a=>[...a,{...o,id:t}])},[]),m=e.useCallback(o=>{u(t=>t.filter((a,l)=>l!==o))},[]),s=e.useMemo(()=>({createNotification:c}),[c]);return i.jsxRuntimeExports.jsxs(T.Provider,{value:s,children:[n,d.map((o,t)=>i.jsxRuntimeExports.jsx(E,{...o,index:t,onDismiss:m},o.id))]})}exports.notificationTypes=j.noticeTypes;exports.NotificationProvider=q;exports.default=E;exports.useCreateNotification=S;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("../jsx-runtime-BB_1_6y_.js"),e=require("react"),E=require("@kuma-ui/core"),I=require("../utilities/generate-random-id.js"),T=require("./notice.js");function R({type:i,icon:p,id:u,index:d,shouldDismiss:r,className:k,children:N,onDismiss:c,...s}){const[t,a]=e.useState(!1),[o,m]=e.useState(!1),[n,x]=e.useState(!1),v=d??0,[h,M]=e.useState(v);e.useEffect(()=>{if(r||o)return;const l=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(l)}},[r,o]);const j=e.useRef(0),C=e.useRef(0),S=e.useCallback(()=>{x(!0)},[]),q=e.useCallback(()=>{x(!1)},[]);return e.useEffect(()=>{if(n){C.current+=Date.now()-j.current;return}if(t){j.current=Date.now();const l=6e3-C.current,w=setTimeout(()=>{a(!1),m(!0)},l);return()=>{clearTimeout(w)}}},[n,t]),e.useEffect(()=>{r&&!o&&(a(!1),m(!0))},[r,o]),e.useEffect(()=>{if(o&&!t){const l=setTimeout(()=>{u&&(c==null||c(u))},300);return()=>{clearTimeout(l)}}},[o,t,u,c]),e.useEffect(()=>{n||M(v)},[n,v]),f.jsxRuntimeExports.jsx("div",{...s,style:{"--index":h},className:E.cx("kakadu-components-1727618227",t&&"kakadu-components-3003995416",k),children:f.jsxRuntimeExports.jsxs(T.default,{role:"status","aria-live":"polite","aria-atomic":"true",type:i,icon:p,className:E.cx("kakadu-components-3951461646",t&&"kakadu-components-2837603142"),onMouseEnter:S,onMouseLeave:q,children:[N,f.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2751825161",children:f.jsxRuntimeExports.jsx("div",{className:E.cx("kakadu-components-4050948330",n?"kakadu-components-758522476":"kakadu-components-3914681513")})})]})})}const b=e.createContext({createNotification(){throw new Error("useCreateNotification must be used within a NotificationProvider")}});function g(){const{createNotification:i}=e.useContext(b);return i}function P({limit:i=5,children:p}){const[u,d]=e.useState([]),r=e.useCallback(s=>{const t=I.default();d(a=>{const o=[...a,{...s,id:t}];if(o.length<=i)return o;const m=o.length-i;return o.map((n,x)=>x<m?{...n,shouldDismiss:!0}:n)})},[i]),k=e.useCallback(s=>{d(t=>t.filter(a=>a.id!==s))},[]),N=e.useMemo(()=>({createNotification:r}),[r]),c=e.useMemo(()=>[...u].reverse(),[u]);return f.jsxRuntimeExports.jsxs(b.Provider,{value:N,children:[p,c.map((s,t)=>f.jsxRuntimeExports.jsx(R,{...s,index:t,onDismiss:k},s.id))]})}exports.notificationTypes=T.noticeTypes;exports.NotificationProvider=P;exports.default=R;exports.useCreateNotification=g;