@kakadu/components 4.0.5 → 4.0.6
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/build/_commonjsHelpers-DGT2Y9Xa.js +1 -0
- package/build/_commonjsHelpers-MdHo5S7N.mjs +26 -0
- package/build/components/combobox.js +1 -1
- package/build/components/combobox.mjs +134 -140
- package/build/components/modal.js +1 -1
- package/build/components/modal.mjs +1 -1
- package/build/components/popover.js +1 -1
- package/build/components/popover.mjs +1 -1
- package/build/focus-trap-react-B7f3iC5h.js +9 -0
- package/build/{focus-trap-react-DATIi_Ob.mjs → focus-trap-react-Dr3BYLw6.mjs} +430 -453
- package/package.json +1 -1
- package/build/focus-trap-react-CkKg4ubd.js +0 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function c(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var o=e.default;if(typeof o=="function"){var t=function r(){return this instanceof r?Reflect.construct(o,arguments,this.constructor):o.apply(this,arguments)};t.prototype=o.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var u=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,u.get?u:{enumerable:!0,get:function(){return e[r]}})}),t}exports.getAugmentedNamespace=c;exports.getDefaultExportFromCjs=n;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function n(e) {
|
|
2
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3
|
+
}
|
|
4
|
+
function c(e) {
|
|
5
|
+
if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
|
|
6
|
+
var o = e.default;
|
|
7
|
+
if (typeof o == "function") {
|
|
8
|
+
var t = function r() {
|
|
9
|
+
return this instanceof r ? Reflect.construct(o, arguments, this.constructor) : o.apply(this, arguments);
|
|
10
|
+
};
|
|
11
|
+
t.prototype = o.prototype;
|
|
12
|
+
} else t = {};
|
|
13
|
+
return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) {
|
|
14
|
+
var u = Object.getOwnPropertyDescriptor(e, r);
|
|
15
|
+
Object.defineProperty(t, r, u.get ? u : {
|
|
16
|
+
enumerable: !0,
|
|
17
|
+
get: function() {
|
|
18
|
+
return e[r];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}), t;
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
n as a,
|
|
25
|
+
c as g
|
|
26
|
+
};
|
|
@@ -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 R=require("../jsx-runtime-BB_1_6y_.js"),r=require("react"),G=require("../_commonjsHelpers-DGT2Y9Xa.js"),U=require("@kuma-ui/core"),oe=require("../use-synchronized-value-D0_rS5Wp.js"),re=require("../icons/icon.js"),ae=require("./input.js"),B=require("./text.js"),X=require("./flex.js"),ce=require("./skeleton.js");var K={exports:{}};const _=new Uint32Array(65536),le=(t,c)=>{const o=t.length,p=c.length,l=1<<o-1;let i=-1,f=0,x=o,n=o;for(;n--;)_[t.charCodeAt(n)]|=1<<n;for(n=0;n<p;n++){let m=_[c.charCodeAt(n)];const h=m|f;m|=(m&i)+i^i,f|=~(m|i),i&=m,f&l&&x++,i&l&&x--,f=f<<1|1,i=i<<1|~(h|f),f&=h}for(n=o;n--;)_[t.charCodeAt(n)]=0;return x},ie=(t,c)=>{const o=c.length,p=t.length,l=[],i=[],f=Math.ceil(o/32),x=Math.ceil(p/32);for(let e=0;e<f;e++)i[e]=-1,l[e]=0;let n=0;for(;n<x-1;n++){let e=0,u=-1;const b=n*32,g=Math.min(32,p)+b;for(let s=b;s<g;s++)_[t.charCodeAt(s)]|=1<<s;for(let s=0;s<o;s++){const v=_[c.charCodeAt(s)],k=i[s/32|0]>>>s&1,w=l[s/32|0]>>>s&1,M=v|e,E=((v|w)&u)+u^u|v|w;let S=e|~(E|u),A=u&E;S>>>31^k&&(i[s/32|0]^=1<<s),A>>>31^w&&(l[s/32|0]^=1<<s),S=S<<1|k,A=A<<1|w,u=A|~(M|S),e=S&M}for(let s=b;s<g;s++)_[t.charCodeAt(s)]=0}let m=0,h=-1;const j=n*32,C=Math.min(32,p-j)+j;for(let e=j;e<C;e++)_[t.charCodeAt(e)]|=1<<e;let O=p;for(let e=0;e<o;e++){const u=_[c.charCodeAt(e)],b=i[e/32|0]>>>e&1,g=l[e/32|0]>>>e&1,s=u|m,v=((u|g)&h)+h^h|u|g;let k=m|~(v|h),w=h&v;O+=k>>>p-1&1,O-=w>>>p-1&1,k>>>31^b&&(i[e/32|0]^=1<<e),w>>>31^g&&(l[e/32|0]^=1<<e),k=k<<1|b,w=w<<1|g,h=w|~(s|k),m=k&s}for(let e=j;e<C;e++)_[t.charCodeAt(e)]=0;return O},J=(t,c)=>{if(t.length<c.length){const o=c;c=t,t=o}return c.length===0?t.length:t.length<=32?le(t,c):ie(t,c)},ue=(t,c)=>{let o=1/0,p=0;for(let l=0;l<c.length;l++){const i=J(t,c[l]);i<o&&(o=i,p=l)}return c[p]},fe=Object.freeze(Object.defineProperty({__proto__:null,closest:ue,distance:J},Symbol.toStringTag,{value:"Module"})),de=G.getAugmentedNamespace(fe);var Y;function me(){return Y||(Y=1,(function(t,c){(function(){var o;try{o=typeof Intl<"u"&&typeof Intl.Collator<"u"?Intl.Collator("generic",{sensitivity:"base"}):null}catch{console.log("Collator could not be initialized and wouldn't be used")}var p=de,l=[],i=[],f={get:function(x,n,m){var h=m&&o&&m.useCollator;if(h){var j=x.length,C=n.length;if(j===0)return C;if(C===0)return j;var O,e,u,b,g;for(u=0;u<C;++u)l[u]=u,i[u]=n.charCodeAt(u);l[C]=C;var s;for(u=0;u<j;++u){for(e=u+1,b=0;b<C;++b)O=e,s=o.compare(x.charAt(u),String.fromCharCode(i[b]))===0,e=l[b]+(s?0:1),g=O+1,e>g&&(e=g),g=l[b+1]+1,e>g&&(e=g),l[b]=O;l[b]=e}return e}return p.distance(x,n)}};t!==null&&t.exports===c?t.exports=f:typeof self<"u"&&typeof self.postMessage=="function"&&typeof self.importScripts=="function"?self.Levenshtein=f:typeof window<"u"&&window!==null&&(window.Levenshtein=f)})()})(K,K.exports)),K.exports}var pe=me();const he=G.getDefaultExportFromCjs(pe);function Q(){const{value:t,setValue:c}=oe.useSynchronizedValue("isKeyboardNavigating");return r.useMemo(()=>({isKeyboardNavigating:t,setIsKeyboardNavigating:c}),[t,c])}function T(t){return"text"in t?t.text:t.label}const D="kakadu-components-1144794361",H="kakadu-components-2911184744";function ve({isSelected:t,id:c,value:o,label:p,onSelect:l,onHover:i}){const{isKeyboardNavigating:f}=Q(),x=r.useCallback(()=>{l(o)},[l,o]),n=r.useCallback(h=>{f||h.movementX===0&&h.movementY===0||i(o)},[f,i,o]),m=r.useRef(null);return r.useEffect(()=>{const h=m.current;t&&h&&f&&setTimeout(()=>{h.scrollIntoView({behavior:"smooth",block:"nearest"})},0)},[t,f]),R.jsxRuntimeExports.jsx("li",{ref:m,id:c,role:"option","aria-selected":t,tabIndex:-1,className:U.cx(D,"kakadu-components-4130497639",f?"kakadu-components-962373561":"kakadu-components-1109598791"),onClick:x,onMouseMove:n,children:R.jsxRuntimeExports.jsx(B.Span,{className:U.cx(H,typeof p=="string"&&"kakadu-components-154286052"),children:p})})}function xe({isLoading:t,id:c,activeOptionId:o,selectedValue:p,options:l,onSelect:i,onHover:f}){const x=r.useRef(null);return r.useEffect(()=>{const n=x.current;n&&n.scrollIntoView({behavior:"smooth",block:"nearest"})},[]),R.jsxRuntimeExports.jsxs("ul",{ref:x,id:c,role:"listbox","aria-label":"Options",tabIndex:-1,className:"kakadu-components-1951042708",children:[l.length===0?t?null:R.jsxRuntimeExports.jsxs(X.default,{"aria-atomic":!0,as:"li",role:"status","aria-live":"polite",direction:"row",preset:"start",gap:.5,className:D,children:[R.jsxRuntimeExports.jsx(re.default,{size:15,type:"exclamationTriangle"}),R.jsxRuntimeExports.jsx(B.Span,{className:H,children:"No results."})]}):l.map((n,m)=>R.jsxRuntimeExports.jsx(ve,{...n,id:n.value===p?o:void 0,isSelected:n.value===p,onSelect:i,onHover:f},T(n)+m)),t?R.jsxRuntimeExports.jsx(X.default,{as:"li",alignment:"center",className:D,children:R.jsxRuntimeExports.jsx(B.Span,{className:H,children:R.jsxRuntimeExports.jsx(ce.SkeletonInstance,{width:"100%",height:"1.3em"})})}):null]})}function be({isLoading:t,label:c,options:o,error:p,warning:l,information:i,footnote:f,className:x,onChange:n,onSelect:m,...h}){const j=r.useRef(null),C=r.useId(),O=r.useId(),[e,u]=r.useState(!1),b=r.useCallback(()=>{u(!0)},[]),g=r.useCallback(a=>{var d;(d=j.current)!=null&&d.contains(a.relatedTarget)||u(!1)},[]),[s,v]=r.useState(!1);r.useEffect(()=>{v(e)},[e]);const[k,w]=r.useState(""),{value:M}=h,[E,S]=r.useState(M),[A,W]=r.useState(M),P=r.useRef(A),I=r.useCallback(a=>{W(a),P.current=a},[]);r.useEffect(()=>{S(M),I(M)},[M,I]);const Z=r.useCallback(()=>{E&&(w(""),I(void 0))},[E,I]),ee=r.useCallback((a,d)=>{w(a),n==null||n(a,d),v(!0),S(void 0)},[n]),te=r.useCallback(a=>{var d;(d=j.current)!=null&&d.contains(a.target)&&v(!0)},[]),z=r.useCallback(a=>{const d=a==null?void 0:a.value;I(d),a?w(T(a)):(w(""),n==null||n("")),m==null||m(d)},[I,n,m]),ne=r.useCallback(a=>{const d=o.find(y=>y.value===a);z(d),S(a),v(!1)},[o,z]),se=r.useCallback(a=>{I(a)},[I]),q=r.useMemo(()=>E||k.length===0?o:o.filter(a=>{const y=T(a).toLowerCase(),N=k.toLowerCase();return!!(y.includes(N)||N.includes(y)||he.get(y,N,{useCollator:!0})<=2)}),[E,o,k]);r.useEffect(()=>{!E&&k.length>0&&q.length>0&&!q.some(a=>A===a.value)&&I(q[0].value)},[E,k,q,A,I]);const{setIsKeyboardNavigating:F}=Q();return r.useEffect(()=>{if(!e)return;const a=d=>{d.movementX===0&&d.movementY===0||F(!1)};return window.addEventListener("mousemove",a,{capture:!0}),()=>{window.removeEventListener("mousemove",a,{capture:!0})}},[e,F]),r.useEffect(()=>{if(!e)return;const a=d=>{let y;const N=q.length,$=q.findIndex(V=>V.value===P.current),L=()=>{d.preventDefault(),d.stopPropagation(),d.stopImmediatePropagation()};switch(d.key){case"Enter":{const V=q[$];V&&(L(),F(!0),v(!1),z(V),S(V.value));break}case"Escape":{s?(L(),E?I(void 0):z(void 0),v(!1)):E?(L(),v(!0),z(void 0)):(L(),u(!1),d.target instanceof HTMLInputElement&&d.target.blur());return}case"ArrowDown":{y=$+1,v(!0);break}case"ArrowUp":{y=$-1,v(!0),y<0&&(y=N-1);break}case"Home":{v(!0),y=0;break}case"End":{v(!0),y=N-1;break}case"Backspace":{q.some(V=>V.value===E)&&(L(),z(void 0),v(!0));break}}if(y!==void 0&&(L(),F(!0),N>0)){const V=q[y%N];V&&I(V.value)}};return window.addEventListener("keydown",a,{capture:!0}),()=>{window.removeEventListener("keydown",a,{capture:!0})}},[e,q,F,v,z,S,s,E,I]),R.jsxRuntimeExports.jsx(ae.default,{...h,ref:j,role:"combobox",autoComplete:"off","aria-controls":C,"aria-expanded":s,"aria-activedescendant":s?O:void 0,label:c,value:k,error:p,warning:l,information:i,footnote:f,attachments:s?R.jsxRuntimeExports.jsx(xe,{isLoading:t,id:C,activeOptionId:O,selectedValue:A,options:q,onSelect:ne,onHover:se}):null,className:x,onMouseDown:te,onChange:ee,onBeforeInput:Z,onFocus:b,onBlur:g})}exports.default=be;exports.getComboboxOptionString=T;
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { g as
|
|
4
|
-
import { cx as
|
|
5
|
-
import { u as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { Span as
|
|
9
|
-
import
|
|
10
|
-
import { SkeletonInstance as
|
|
1
|
+
import { j as V } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
+
import { useRef as T, useId as G, useState as D, useCallback as E, useEffect as z, useMemo as Z } from "react";
|
|
3
|
+
import { g as ce, a as le } from "../_commonjsHelpers-MdHo5S7N.mjs";
|
|
4
|
+
import { cx as J } from "@kuma-ui/core";
|
|
5
|
+
import { u as ue } from "../use-synchronized-value-XnIpeq1s.mjs";
|
|
6
|
+
import fe from "../icons/icon.mjs";
|
|
7
|
+
import de from "./input.mjs";
|
|
8
|
+
import { Span as P } from "./text.mjs";
|
|
9
|
+
import Q from "./flex.mjs";
|
|
10
|
+
import { SkeletonInstance as me } from "./skeleton.mjs";
|
|
11
11
|
var R = { exports: {} };
|
|
12
|
-
const
|
|
13
|
-
const r = t.length, m = a.length,
|
|
14
|
-
let
|
|
12
|
+
const _ = new Uint32Array(65536), he = (t, a) => {
|
|
13
|
+
const r = t.length, m = a.length, i = 1 << r - 1;
|
|
14
|
+
let c = -1, u = 0, p = r, n = r;
|
|
15
15
|
for (; n--; )
|
|
16
|
-
|
|
16
|
+
_[t.charCodeAt(n)] |= 1 << n;
|
|
17
17
|
for (n = 0; n < m; n++) {
|
|
18
|
-
let d =
|
|
19
|
-
const
|
|
20
|
-
d |= (d &
|
|
18
|
+
let d = _[a.charCodeAt(n)];
|
|
19
|
+
const h = d | u;
|
|
20
|
+
d |= (d & c) + c ^ c, u |= ~(d | c), c &= d, u & i && p++, c & i && p--, u = u << 1 | 1, c = c << 1 | ~(h | u), u &= h;
|
|
21
21
|
}
|
|
22
22
|
for (n = r; n--; )
|
|
23
|
-
|
|
23
|
+
_[t.charCodeAt(n)] = 0;
|
|
24
24
|
return p;
|
|
25
|
-
},
|
|
26
|
-
const r = a.length, m = t.length,
|
|
25
|
+
}, ve = (t, a) => {
|
|
26
|
+
const r = a.length, m = t.length, i = [], c = [], u = Math.ceil(r / 32), p = Math.ceil(m / 32);
|
|
27
27
|
for (let e = 0; e < u; e++)
|
|
28
|
-
|
|
28
|
+
c[e] = -1, i[e] = 0;
|
|
29
29
|
let n = 0;
|
|
30
30
|
for (; n < p - 1; n++) {
|
|
31
31
|
let e = 0, l = -1;
|
|
32
32
|
const g = n * 32, x = Math.min(32, m) + g;
|
|
33
33
|
for (let o = g; o < x; o++)
|
|
34
|
-
|
|
34
|
+
_[t.charCodeAt(o)] |= 1 << o;
|
|
35
35
|
for (let o = 0; o < r; o++) {
|
|
36
|
-
const
|
|
37
|
-
let N = e | ~(y | l),
|
|
38
|
-
N >>> 31 ^ b && (
|
|
36
|
+
const v = _[a.charCodeAt(o)], b = c[o / 32 | 0] >>> o & 1, w = i[o / 32 | 0] >>> o & 1, q = v | e, y = ((v | w) & l) + l ^ l | v | w;
|
|
37
|
+
let N = e | ~(y | l), S = l & y;
|
|
38
|
+
N >>> 31 ^ b && (c[o / 32 | 0] ^= 1 << o), S >>> 31 ^ w && (i[o / 32 | 0] ^= 1 << o), N = N << 1 | b, S = S << 1 | w, l = S | ~(q | N), e = N & q;
|
|
39
39
|
}
|
|
40
40
|
for (let o = g; o < x; o++)
|
|
41
|
-
|
|
41
|
+
_[t.charCodeAt(o)] = 0;
|
|
42
42
|
}
|
|
43
|
-
let d = 0,
|
|
44
|
-
const A = n * 32,
|
|
45
|
-
for (let e = A; e <
|
|
46
|
-
|
|
43
|
+
let d = 0, h = -1;
|
|
44
|
+
const A = n * 32, O = Math.min(32, m - A) + A;
|
|
45
|
+
for (let e = A; e < O; e++)
|
|
46
|
+
_[t.charCodeAt(e)] |= 1 << e;
|
|
47
47
|
let M = m;
|
|
48
48
|
for (let e = 0; e < r; e++) {
|
|
49
|
-
const l =
|
|
50
|
-
let b = d | ~(
|
|
51
|
-
M += b >>> m - 1 & 1, M -= w >>> m - 1 & 1, b >>> 31 ^ g && (
|
|
49
|
+
const l = _[a.charCodeAt(e)], g = c[e / 32 | 0] >>> e & 1, x = i[e / 32 | 0] >>> e & 1, o = l | d, v = ((l | x) & h) + h ^ h | l | x;
|
|
50
|
+
let b = d | ~(v | h), w = h & v;
|
|
51
|
+
M += b >>> m - 1 & 1, M -= w >>> m - 1 & 1, b >>> 31 ^ g && (c[e / 32 | 0] ^= 1 << e), w >>> 31 ^ x && (i[e / 32 | 0] ^= 1 << e), b = b << 1 | g, w = w << 1 | x, h = w | ~(o | b), d = b & o;
|
|
52
52
|
}
|
|
53
|
-
for (let e = A; e <
|
|
54
|
-
|
|
53
|
+
for (let e = A; e < O; e++)
|
|
54
|
+
_[t.charCodeAt(e)] = 0;
|
|
55
55
|
return M;
|
|
56
56
|
}, ee = (t, a) => {
|
|
57
57
|
if (t.length < a.length) {
|
|
58
58
|
const r = a;
|
|
59
59
|
a = t, t = r;
|
|
60
60
|
}
|
|
61
|
-
return a.length === 0 ? t.length : t.length <= 32 ?
|
|
62
|
-
},
|
|
61
|
+
return a.length === 0 ? t.length : t.length <= 32 ? he(t, a) : ve(t, a);
|
|
62
|
+
}, pe = (t, a) => {
|
|
63
63
|
let r = 1 / 0, m = 0;
|
|
64
|
-
for (let
|
|
65
|
-
const
|
|
66
|
-
|
|
64
|
+
for (let i = 0; i < a.length; i++) {
|
|
65
|
+
const c = ee(t, a[i]);
|
|
66
|
+
c < r && (r = c, m = i);
|
|
67
67
|
}
|
|
68
68
|
return a[m];
|
|
69
|
-
},
|
|
69
|
+
}, ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
70
70
|
__proto__: null,
|
|
71
|
-
closest:
|
|
71
|
+
closest: pe,
|
|
72
72
|
distance: ee
|
|
73
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
74
|
-
var
|
|
75
|
-
function
|
|
76
|
-
return
|
|
73
|
+
}, Symbol.toStringTag, { value: "Module" })), xe = /* @__PURE__ */ ce(ge);
|
|
74
|
+
var W;
|
|
75
|
+
function be() {
|
|
76
|
+
return W || (W = 1, (function(t, a) {
|
|
77
77
|
(function() {
|
|
78
78
|
var r;
|
|
79
79
|
try {
|
|
@@ -81,7 +81,7 @@ function ke() {
|
|
|
81
81
|
} catch {
|
|
82
82
|
console.log("Collator could not be initialized and wouldn't be used");
|
|
83
83
|
}
|
|
84
|
-
var m =
|
|
84
|
+
var m = xe, i = [], c = [], u = {
|
|
85
85
|
/**
|
|
86
86
|
* Calculate levenshtein distance of the two strings.
|
|
87
87
|
*
|
|
@@ -92,20 +92,20 @@ function ke() {
|
|
|
92
92
|
* @return Integer the levenshtein distance (0 and above).
|
|
93
93
|
*/
|
|
94
94
|
get: function(p, n, d) {
|
|
95
|
-
var
|
|
96
|
-
if (
|
|
97
|
-
var A = p.length,
|
|
98
|
-
if (A === 0) return
|
|
99
|
-
if (
|
|
95
|
+
var h = d && r && d.useCollator;
|
|
96
|
+
if (h) {
|
|
97
|
+
var A = p.length, O = n.length;
|
|
98
|
+
if (A === 0) return O;
|
|
99
|
+
if (O === 0) return A;
|
|
100
100
|
var M, e, l, g, x;
|
|
101
|
-
for (l = 0; l <
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
for (l = 0; l < O; ++l)
|
|
102
|
+
i[l] = l, c[l] = n.charCodeAt(l);
|
|
103
|
+
i[O] = O;
|
|
104
104
|
var o;
|
|
105
105
|
for (l = 0; l < A; ++l) {
|
|
106
|
-
for (e = l + 1, g = 0; g <
|
|
107
|
-
M = e, o = r.compare(p.charAt(l), String.fromCharCode(
|
|
108
|
-
|
|
106
|
+
for (e = l + 1, g = 0; g < O; ++g)
|
|
107
|
+
M = e, o = r.compare(p.charAt(l), String.fromCharCode(c[g])) === 0, e = i[g] + (o ? 0 : 1), x = M + 1, e > x && (e = x), x = i[g + 1] + 1, e > x && (e = x), i[g] = M;
|
|
108
|
+
i[g] = e;
|
|
109
109
|
}
|
|
110
110
|
return e;
|
|
111
111
|
}
|
|
@@ -116,143 +116,143 @@ function ke() {
|
|
|
116
116
|
})();
|
|
117
117
|
})(R, R.exports)), R.exports;
|
|
118
118
|
}
|
|
119
|
-
var
|
|
120
|
-
const
|
|
119
|
+
var we = be();
|
|
120
|
+
const ke = /* @__PURE__ */ le(we);
|
|
121
121
|
function te() {
|
|
122
122
|
const {
|
|
123
123
|
value: t,
|
|
124
124
|
setValue: a
|
|
125
|
-
} =
|
|
126
|
-
return
|
|
125
|
+
} = ue("isKeyboardNavigating");
|
|
126
|
+
return Z(() => ({
|
|
127
127
|
isKeyboardNavigating: t,
|
|
128
128
|
setIsKeyboardNavigating: a
|
|
129
129
|
}), [t, a]);
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function $(t) {
|
|
132
132
|
return "text" in t ? t.text : t.label;
|
|
133
133
|
}
|
|
134
|
-
const
|
|
135
|
-
function
|
|
134
|
+
const U = "kakadu-components-1144794361", X = "kakadu-components-2911184744";
|
|
135
|
+
function ye({
|
|
136
136
|
isSelected: t,
|
|
137
137
|
id: a,
|
|
138
138
|
value: r,
|
|
139
139
|
label: m,
|
|
140
|
-
onSelect:
|
|
141
|
-
onHover:
|
|
140
|
+
onSelect: i,
|
|
141
|
+
onHover: c
|
|
142
142
|
}) {
|
|
143
143
|
const {
|
|
144
144
|
isKeyboardNavigating: u
|
|
145
145
|
} = te(), p = E(() => {
|
|
146
|
-
|
|
147
|
-
}, [
|
|
148
|
-
u ||
|
|
149
|
-
}, [u,
|
|
150
|
-
return
|
|
151
|
-
const
|
|
152
|
-
t &&
|
|
153
|
-
|
|
146
|
+
i(r);
|
|
147
|
+
}, [i, r]), n = E((h) => {
|
|
148
|
+
u || h.movementX === 0 && h.movementY === 0 || c(r);
|
|
149
|
+
}, [u, c, r]), d = T(null);
|
|
150
|
+
return z(() => {
|
|
151
|
+
const h = d.current;
|
|
152
|
+
t && h && u && setTimeout(() => {
|
|
153
|
+
h.scrollIntoView({
|
|
154
154
|
behavior: "smooth",
|
|
155
155
|
block: "nearest"
|
|
156
156
|
});
|
|
157
157
|
}, 0);
|
|
158
|
-
}, [t, u]), /* @__PURE__ */
|
|
158
|
+
}, [t, u]), /* @__PURE__ */ V.jsx("li", { ref: d, id: a, role: "option", "aria-selected": t, tabIndex: -1, className: J(U, "kakadu-components-4130497639", u ? "kakadu-components-962373561" : "kakadu-components-1109598791"), onClick: p, onMouseMove: n, children: /* @__PURE__ */ V.jsx(P, { className: J(X, typeof m == "string" && "kakadu-components-154286052"), children: m }) });
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function Ie({
|
|
161
161
|
isLoading: t,
|
|
162
162
|
id: a,
|
|
163
163
|
activeOptionId: r,
|
|
164
164
|
selectedValue: m,
|
|
165
|
-
options:
|
|
166
|
-
onSelect:
|
|
165
|
+
options: i,
|
|
166
|
+
onSelect: c,
|
|
167
167
|
onHover: u
|
|
168
168
|
}) {
|
|
169
|
-
const p =
|
|
170
|
-
return
|
|
169
|
+
const p = T(null);
|
|
170
|
+
return z(() => {
|
|
171
171
|
const n = p.current;
|
|
172
172
|
n && n.scrollIntoView({
|
|
173
173
|
behavior: "smooth",
|
|
174
174
|
block: "nearest"
|
|
175
175
|
});
|
|
176
|
-
}, []), /* @__PURE__ */
|
|
177
|
-
|
|
178
|
-
/* @__PURE__ */
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
-
] }) :
|
|
181
|
-
|
|
176
|
+
}, []), /* @__PURE__ */ V.jsxs("ul", { ref: p, id: a, role: "listbox", "aria-label": "Options", tabIndex: -1, className: "kakadu-components-1951042708", children: [
|
|
177
|
+
i.length === 0 ? t ? null : /* @__PURE__ */ V.jsxs(Q, { "aria-atomic": !0, as: "li", role: "status", "aria-live": "polite", direction: "row", preset: "start", gap: 0.5, className: U, children: [
|
|
178
|
+
/* @__PURE__ */ V.jsx(fe, { size: 15, type: "exclamationTriangle" }),
|
|
179
|
+
/* @__PURE__ */ V.jsx(P, { className: X, children: "No results." })
|
|
180
|
+
] }) : i.map((n, d) => /* @__PURE__ */ V.jsx(
|
|
181
|
+
ye,
|
|
182
182
|
{
|
|
183
183
|
...n,
|
|
184
184
|
id: n.value === m ? r : void 0,
|
|
185
185
|
isSelected: n.value === m,
|
|
186
|
-
onSelect:
|
|
186
|
+
onSelect: c,
|
|
187
187
|
onHover: u
|
|
188
188
|
},
|
|
189
|
-
|
|
189
|
+
$(n) + d
|
|
190
190
|
)),
|
|
191
|
-
t ? /* @__PURE__ */
|
|
191
|
+
t ? /* @__PURE__ */ V.jsx(Q, { as: "li", alignment: "center", className: U, children: /* @__PURE__ */ V.jsx(P, { className: X, children: /* @__PURE__ */ V.jsx(me, { width: "100%", height: "1.3em" }) }) }) : null
|
|
192
192
|
] });
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function qe({
|
|
195
195
|
isLoading: t,
|
|
196
196
|
label: a,
|
|
197
197
|
options: r,
|
|
198
198
|
error: m,
|
|
199
|
-
warning:
|
|
200
|
-
information:
|
|
199
|
+
warning: i,
|
|
200
|
+
information: c,
|
|
201
201
|
footnote: u,
|
|
202
202
|
className: p,
|
|
203
203
|
onChange: n,
|
|
204
204
|
onSelect: d,
|
|
205
|
-
...
|
|
205
|
+
...h
|
|
206
206
|
}) {
|
|
207
|
-
const A =
|
|
207
|
+
const A = T(null), O = G(), M = G(), [e, l] = D(!1), g = E(() => {
|
|
208
208
|
l(!0);
|
|
209
209
|
}, []), x = E((s) => {
|
|
210
210
|
var f;
|
|
211
211
|
(f = A.current) != null && f.contains(s.relatedTarget) || l(!1);
|
|
212
|
-
}, []), [o,
|
|
213
|
-
|
|
214
|
-
|
|
212
|
+
}, []), [o, v] = D(!1);
|
|
213
|
+
z(() => {
|
|
214
|
+
v(e);
|
|
215
215
|
}, [e]);
|
|
216
|
-
const [b, w] =
|
|
217
|
-
value:
|
|
218
|
-
} =
|
|
219
|
-
ne(s),
|
|
216
|
+
const [b, w] = D(""), {
|
|
217
|
+
value: q
|
|
218
|
+
} = h, [y, N] = D(q), [S, ne] = D(q), Y = T(S), I = E((s) => {
|
|
219
|
+
ne(s), Y.current = s;
|
|
220
220
|
}, []);
|
|
221
|
-
|
|
222
|
-
N(
|
|
223
|
-
}, [
|
|
221
|
+
z(() => {
|
|
222
|
+
N(q), I(q);
|
|
223
|
+
}, [q, I]);
|
|
224
224
|
const oe = E(() => {
|
|
225
225
|
y && (w(""), I(void 0));
|
|
226
226
|
}, [y, I]), re = E((s, f) => {
|
|
227
|
-
w(s), n == null || n(s, f),
|
|
227
|
+
w(s), n == null || n(s, f), v(!0), N(void 0);
|
|
228
228
|
}, [n]), se = E((s) => {
|
|
229
229
|
var f;
|
|
230
|
-
(f = A.current) != null && f.contains(s.target) &&
|
|
231
|
-
}, []),
|
|
230
|
+
(f = A.current) != null && f.contains(s.target) && v(!0);
|
|
231
|
+
}, []), L = E((s) => {
|
|
232
232
|
const f = s == null ? void 0 : s.value;
|
|
233
|
-
I(f), s ? w(
|
|
233
|
+
I(f), s ? w($(s)) : (w(""), n == null || n("")), d == null || d(f);
|
|
234
234
|
}, [I, n, d]), ae = E((s) => {
|
|
235
235
|
const f = r.find((k) => k.value === s);
|
|
236
|
-
|
|
237
|
-
}, [r,
|
|
236
|
+
L(f), N(s), v(!1);
|
|
237
|
+
}, [r, L]), ie = E((s) => {
|
|
238
238
|
I(s);
|
|
239
|
-
}, [I]), j =
|
|
240
|
-
const k =
|
|
241
|
-
return !!(k.includes(
|
|
239
|
+
}, [I]), j = Z(() => y || b.length === 0 ? r : r.filter((s) => {
|
|
240
|
+
const k = $(s).toLowerCase(), F = b.toLowerCase();
|
|
241
|
+
return !!(k.includes(F) || F.includes(k) || ke.get(k, F, {
|
|
242
242
|
useCollator: !0
|
|
243
243
|
}) <= 2);
|
|
244
244
|
}), [y, r, b]);
|
|
245
|
-
|
|
246
|
-
!y && b.length > 0 && j.length > 0 && !j.some((s) =>
|
|
247
|
-
}, [y, b, j,
|
|
245
|
+
z(() => {
|
|
246
|
+
!y && b.length > 0 && j.length > 0 && !j.some((s) => S === s.value) && I(j[0].value);
|
|
247
|
+
}, [y, b, j, S, I]);
|
|
248
248
|
const {
|
|
249
|
-
setIsKeyboardNavigating:
|
|
249
|
+
setIsKeyboardNavigating: B
|
|
250
250
|
} = te();
|
|
251
|
-
|
|
251
|
+
return z(() => {
|
|
252
252
|
if (!e)
|
|
253
253
|
return;
|
|
254
254
|
const s = (f) => {
|
|
255
|
-
f.movementX === 0 && f.movementY === 0 ||
|
|
255
|
+
f.movementX === 0 && f.movementY === 0 || B(!1);
|
|
256
256
|
};
|
|
257
257
|
return window.addEventListener("mousemove", s, {
|
|
258
258
|
capture: !0
|
|
@@ -261,47 +261,47 @@ function _e({
|
|
|
261
261
|
capture: !0
|
|
262
262
|
});
|
|
263
263
|
};
|
|
264
|
-
}, [e,
|
|
264
|
+
}, [e, B]), z(() => {
|
|
265
265
|
if (!e)
|
|
266
266
|
return;
|
|
267
267
|
const s = (f) => {
|
|
268
268
|
let k;
|
|
269
|
-
const
|
|
269
|
+
const F = j.length, H = j.findIndex((C) => C.value === Y.current), K = () => {
|
|
270
270
|
f.preventDefault(), f.stopPropagation(), f.stopImmediatePropagation();
|
|
271
271
|
};
|
|
272
272
|
switch (f.key) {
|
|
273
273
|
case "Enter": {
|
|
274
274
|
const C = j[H];
|
|
275
|
-
C && (
|
|
275
|
+
C && (K(), B(!0), v(!1), L(C), N(C.value));
|
|
276
276
|
break;
|
|
277
277
|
}
|
|
278
278
|
case "Escape": {
|
|
279
|
-
o ? (
|
|
279
|
+
o ? (K(), y ? I(void 0) : L(void 0), v(!1)) : y ? (K(), v(!0), L(void 0)) : (K(), l(!1), f.target instanceof HTMLInputElement && f.target.blur());
|
|
280
280
|
return;
|
|
281
281
|
}
|
|
282
282
|
case "ArrowDown": {
|
|
283
|
-
k = H + 1,
|
|
283
|
+
k = H + 1, v(!0);
|
|
284
284
|
break;
|
|
285
285
|
}
|
|
286
286
|
case "ArrowUp": {
|
|
287
|
-
k = H - 1,
|
|
287
|
+
k = H - 1, v(!0), k < 0 && (k = F - 1);
|
|
288
288
|
break;
|
|
289
289
|
}
|
|
290
290
|
case "Home": {
|
|
291
|
-
|
|
291
|
+
v(!0), k = 0;
|
|
292
292
|
break;
|
|
293
293
|
}
|
|
294
294
|
case "End": {
|
|
295
|
-
|
|
295
|
+
v(!0), k = F - 1;
|
|
296
296
|
break;
|
|
297
297
|
}
|
|
298
298
|
case "Backspace": {
|
|
299
|
-
j.some((C) => C.value === y) && (
|
|
299
|
+
j.some((C) => C.value === y) && (K(), L(void 0), v(!0));
|
|
300
300
|
break;
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
if (k !== void 0 && (
|
|
304
|
-
const C = j[k %
|
|
303
|
+
if (k !== void 0 && (K(), B(!0), F > 0)) {
|
|
304
|
+
const C = j[k % F];
|
|
305
305
|
C && I(C.value);
|
|
306
306
|
}
|
|
307
307
|
};
|
|
@@ -312,15 +312,9 @@ function _e({
|
|
|
312
312
|
capture: !0
|
|
313
313
|
});
|
|
314
314
|
};
|
|
315
|
-
}, [e, j,
|
|
316
|
-
const ie = P(() => ({
|
|
317
|
-
clickOutsideDeactivates: !0,
|
|
318
|
-
returnFocusOnDeactivate: !1,
|
|
319
|
-
escapeDeactivates: !1
|
|
320
|
-
}), []);
|
|
321
|
-
return /* @__PURE__ */ O.jsx(fe.FocusTrap, { active: o, focusTrapOptions: ie, children: /* @__PURE__ */ O.jsx(ve, { ...v, ref: A, role: "combobox", autoComplete: "off", "aria-controls": V, "aria-expanded": o, "aria-activedescendant": o ? M : void 0, label: a, value: b, error: m, warning: c, information: i, footnote: u, attachments: o ? /* @__PURE__ */ O.jsx(Ae, { isLoading: t, id: V, activeOptionId: M, selectedValue: F, options: j, onSelect: ae, onHover: ce }) : null, className: p, onMouseDown: se, onChange: re, onBeforeInput: oe, onFocus: g, onBlur: x }) });
|
|
315
|
+
}, [e, j, B, v, L, N, o, y, I]), /* @__PURE__ */ V.jsx(de, { ...h, ref: A, role: "combobox", autoComplete: "off", "aria-controls": O, "aria-expanded": o, "aria-activedescendant": o ? M : void 0, label: a, value: b, error: m, warning: i, information: c, footnote: u, attachments: o ? /* @__PURE__ */ V.jsx(Ie, { isLoading: t, id: O, activeOptionId: M, selectedValue: S, options: j, onSelect: ae, onHover: ie }) : null, className: p, onMouseDown: se, onChange: re, onBeforeInput: oe, onFocus: g, onBlur: x });
|
|
322
316
|
}
|
|
323
317
|
export {
|
|
324
|
-
|
|
325
|
-
|
|
318
|
+
qe as default,
|
|
319
|
+
$ as getComboboxOptionString
|
|
326
320
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("../jsx-runtime-BB_1_6y_.js"),e=require("react"),k=require("@kuma-ui/core"),P=require("react-dom"),$=require("../focus-trap-react-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("../jsx-runtime-BB_1_6y_.js"),e=require("react"),k=require("@kuma-ui/core"),P=require("react-dom"),$=require("../focus-trap-react-B7f3iC5h.js"),B=require("./text-button.js"),T=require("./decorators.js"),I=require("./flex.js"),D=require("./atom.js"),C=require("./text.js"),y=e.createContext({isVisible:!1,isInteractive:!1}),{Provider:z}=y;function _(){return e.useContext(y)}function G(){const{isInteractive:n,close:o}=_(),r=e.useCallback(()=>{o==null||o()},[o]);return s.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2566044647",children:s.jsxRuntimeExports.jsx(B.default,{iconLeft:"times",label:"Close",disabled:!n,onClick:r})})}function J(n){return s.jsxRuntimeExports.jsx(I.default,{gap:2,...n})}function K({as:n,className:o,...r}){return s.jsxRuntimeExports.jsx(C.Heading,{...r,as:n??C.defaultHeadingElementType,className:k.cx("kakadu-components-4275938488",o)})}function Q({as:n,...o}){return s.jsxRuntimeExports.jsx(I.default,{direction:"row",gap:1,preset:"end",...o,as:n??D.defaultAtomElementType})}function U({root:n,outerDecorators:o=[],innerDecorators:r=[],label:f,maxWidth:c,className:m,isVisible:a,isFullWidth:l=!1,shouldCloseOnOutsideClick:i=!0,shouldCloseOnEscapePress:d=!0,showCloseButton:L=!0,onClose:p,children:N}){const v=e.useRef(null),R=e.useRef(null),[M,S]=e.useState(!1),[u,x]=e.useState(!1),b=e.useCallback(t=>{v.current=t,x(!1)},[]),E=e.useRef(null),g=e.useCallback(t=>{t&&(E.current=t)},[]),[h,q]=e.useState(a??!1),A=e.useMemo(()=>({isVisible:h,isInteractive:u,setInitialFocus:g,close:b}),[h,u,g,b]);e.useEffect(()=>{a&&(S(!0),q(!0))},[a]),e.useEffect(()=>{if(a){const t=setTimeout(()=>{x(!0)},100);return()=>{clearTimeout(t)}}x(!1)},[a]),e.useEffect(()=>{if(M&&!u){const t=setTimeout(()=>{p==null||p(v.current??void 0),q(!1)},370);return()=>{clearTimeout(t)}}},[M,u,p]),e.useEffect(()=>{const t=R.current;if(a&&i&&t){const j=H=>{t===H.target&&x(!1)};return t.addEventListener("click",j),()=>{t.removeEventListener("click",j)}}},[a,i]),e.useEffect(()=>{if(!a||!d)return;const t=j=>{j.key==="Escape"&&x(!1)};return window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)}},[a,d]);const F=e.useMemo(()=>({initialFocus:()=>E.current??void 0,onActivate:()=>{var t;return(t=E.current)==null?void 0:t.focus()}}),[]),w=s.jsxRuntimeExports.jsx(T.default,{decorators:o,children:s.jsxRuntimeExports.jsx("div",{"aria-hidden":!u,style:{"--max-width":c?`${c}px`:void 0},className:k.cx("kakadu-components-4119461136",u&&"kakadu-components-2522346797",m),children:s.jsxRuntimeExports.jsx(T.default,{decorators:r,children:s.jsxRuntimeExports.jsx($.focusTrapReactExports.FocusTrap,{active:u,focusTrapOptions:F,children:s.jsxRuntimeExports.jsx("div",{ref:R,className:"kakadu-components-4011815997",children:s.jsxRuntimeExports.jsx("div",{role:"dialog","aria-modal":"true","aria-label":f??"Modal",className:k.cx("kakadu-components-3324483532",l&&"kakadu-components-3799971070",u&&"kakadu-components-968755580"),children:s.jsxRuntimeExports.jsxs(z,{value:A,children:[L?s.jsxRuntimeExports.jsx(G,{}):null,s.jsxRuntimeExports.jsx("div",{className:k.cx("kakadu-components-633990035",l&&"kakadu-components-171969824"),children:N})]})})})})})})});return n?P.createPortal(w,n):w}function V(n,o){const[r,f]=e.useState(!1),c=e.useRef(void 0),m=e.useCallback(async()=>(f(!0),new Promise(i=>{c.current=i})),[]),a=e.useCallback(i=>{var d;f(!1),(d=c.current)==null||d.call(c,i),c.current=void 0},[]),l=e.useMemo(()=>s.jsxRuntimeExports.jsx(n,{...o,isVisible:r,onClose:a}),[n,o,r,a]);return e.useMemo(()=>({isVisible:r,show:m,modal:l}),[r,m,l])}exports.ModalActions=Q;exports.ModalContent=J;exports.ModalHeading=K;exports.default=U;exports.useModal=V;exports.useModalContext=_;
|
|
@@ -2,7 +2,7 @@ import { j as t } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
|
2
2
|
import { createContext as q, useRef as j, useState as h, useCallback as f, useMemo as I, useEffect as m, useContext as z } from "react";
|
|
3
3
|
import { cx as w } from "@kuma-ui/core";
|
|
4
4
|
import { createPortal as G } from "react-dom";
|
|
5
|
-
import { f as J } from "../focus-trap-react-
|
|
5
|
+
import { f as J } from "../focus-trap-react-Dr3BYLw6.mjs";
|
|
6
6
|
import K from "./text-button.mjs";
|
|
7
7
|
import F from "./decorators.mjs";
|
|
8
8
|
import C from "./flex.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../jsx-runtime-BB_1_6y_.js"),f=require("@kuma-ui/core"),e=require("react"),K=require("../focus-trap-react-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../jsx-runtime-BB_1_6y_.js"),f=require("@kuma-ui/core"),e=require("react"),K=require("../focus-trap-react-B7f3iC5h.js"),R=require("./atom.js"),$=e.createContext({isVisible:!1,isPreparingFocus:!1,isFocused:!1}),{Provider:Q}=$;function X(){return e.useContext($)}function Y({as:i,className:s,...o}){return n.jsxRuntimeExports.jsx(R.default,{as:i??R.defaultAtomElementType,...o,className:f.cx("kakadu-components-2845019685",s)})}function Z({as:i,isVisible:s,label:o,shouldCloseOnOutsideClick:d=!0,shouldCloseOnEscapePress:a=!0,children:p,className:u,innerClassName:x,onClose:r,...v}){const I=e.useRef(null),S=e.useRef(null),[q,h]=e.useState(!1),[A,k]=e.useState(!1),[C,H]=e.useState(!1),[c,g]=e.useState(!1),[U,j]=e.useState(!1),M=e.useCallback(t=>{I.current=t,g(!1)},[]),E=e.useRef(null),N=e.useCallback(t=>{t&&(E.current=t)},[]),G=e.useMemo(()=>({initialFocus:()=>E.current??void 0,onPostActivate(){var t;k(!0),h(!1),(t=E.current)==null||t.focus()},clickOutsideDeactivates:d,escapeDeactivates:a,onPostUnpause(){k(!0)},onPause(){k(!1)},onDeactivate(){j(!1),g(!1),k(!1)}}),[d,a]),[L,O]=e.useState(s??!1),J=e.useMemo(()=>({isVisible:L,isPreparingFocus:q,isFocused:A,setInitialFocus:N,close:M}),[L,q,A,N,M]),[l,y]=e.useState("center");return e.useEffect(()=>{const t=S.current;if(t){const P=()=>{const D=t.offsetParent,F=D instanceof HTMLElement?D.getBoundingClientRect():null,V=t.getBoundingClientRect();if(!F){y("center");return}const T=16,_=window.innerWidth-T,b=F.left+F.width/2-V.width/2,z=b+V.width,B=b<T,W=z>_;let m="center";if(B&&W){const w=T-b;m=z-_>w?"right":"left"}else W?m="right":B&&(m="left");y(w=>w===m?w:m)};return P(),window.addEventListener("resize",P),()=>{window.removeEventListener("resize",P)}}},[]),e.useEffect(()=>{s&&(H(!0),O(!0))},[s]),e.useEffect(()=>{if(s){const t=setTimeout(()=>{g(!0)},100);return()=>{clearTimeout(t)}}g(!1)},[s]),e.useEffect(()=>{if(!c){j(!1),h(!1);return}h(!0);const t=window.requestAnimationFrame(()=>{j(!0)});return()=>{window.cancelAnimationFrame(t)}},[c]),e.useEffect(()=>{if(C&&!c){const t=setTimeout(()=>{r==null||r(I.current??void 0),O(!1)},370);return()=>{clearTimeout(t)}}},[C,c,r]),n.jsxRuntimeExports.jsx(R.default,{reference:S,as:i??R.defaultAtomElementType,role:"dialog","aria-hidden":!c,"aria-label":o??"Popover",...v,className:f.cx("kakadu-components-3920007758",l==="left"&&"kakadu-components-611400930",l==="right"&&"kakadu-components-944244368",c&&"kakadu-components-1399012551",u),children:n.jsxRuntimeExports.jsxs("div",{className:f.cx("kakadu-components-1118152266",c&&"kakadu-components-231244945"),children:[n.jsxRuntimeExports.jsx("div",{className:f.cx("kakadu-components-1951789226",l==="left"&&"kakadu-components-1495725644",l==="right"&&"kakadu-components-4235689197")}),n.jsxRuntimeExports.jsx(K.focusTrapReactExports.FocusTrap,{active:U,focusTrapOptions:G,children:n.jsxRuntimeExports.jsxs("div",{className:f.cx("kakadu-components-2488426662",x),children:[n.jsxRuntimeExports.jsx(Q,{value:J,children:p}),n.jsxRuntimeExports.jsx("div",{className:f.cx("kakadu-components-3252390100",l==="left"&&"kakadu-components-3754561431",l==="right"&&"kakadu-components-2265262600")})]})})]})})}function ee(i,s){const[o,d]=e.useState(!1),a=e.useRef(void 0),p=e.useCallback(async()=>(d(!0),new Promise(r=>{a.current=r})),[]),u=e.useCallback(r=>{var v;d(!1),(v=a.current)==null||v.call(a,r),a.current=void 0},[]),x=e.useMemo(()=>n.jsxRuntimeExports.jsx(i,{...s,isVisible:o,onClose:u}),[i,s,o,u]);return e.useMemo(()=>({isVisible:o,show:p,close:u,popover:x}),[o,p,u,x])}exports.PopoverContainer=Y;exports.default=Z;exports.usePopover=ee;exports.usePopoverContext=X;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as s } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
2
|
import { cx as f } from "@kuma-ui/core";
|
|
3
3
|
import { createContext as ee, useRef as F, useState as r, useCallback as P, useMemo as j, useEffect as p, useContext as te } from "react";
|
|
4
|
-
import { f as se } from "../focus-trap-react-
|
|
4
|
+
import { f as se } from "../focus-trap-react-Dr3BYLw6.mjs";
|
|
5
5
|
import K, { defaultAtomElementType as Q } from "./atom.mjs";
|
|
6
6
|
const X = ee({
|
|
7
7
|
isVisible: !1,
|