@object-ui/layout 3.0.3 → 3.1.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/.turbo/turbo-build.log +11 -8
- package/dist/index.js +3760 -299
- package/dist/index.umd.cjs +6 -2
- package/dist/layout/src/AppSchemaRenderer.d.ts +68 -0
- package/dist/layout/src/NavigationRenderer.d.ts +104 -0
- package/dist/layout/src/SidebarNav.d.ts +11 -2
- package/dist/layout/src/index.d.ts +2 -0
- package/package.json +11 -8
- package/src/AppSchemaRenderer.tsx +480 -0
- package/src/AppShell.tsx +1 -1
- package/src/NavigationRenderer.tsx +746 -0
- package/src/SidebarNav.tsx +130 -19
- package/src/__tests__/AppSchemaRenderer.test.tsx +408 -0
- package/src/__tests__/NavigationRenderer.test.tsx +562 -0
- package/src/index.ts +26 -0
- package/src/stories/SidebarNav.stories.tsx +223 -0
package/dist/index.umd.cjs
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(P,se){typeof exports=="object"&&typeof module<"u"?se(exports,require("@object-ui/core"),require("react"),require("@object-ui/components"),require("react-router-dom"),require("lucide-react"),require("react-dom"),require("@object-ui/types"),require("@object-ui/react")):typeof define=="function"&&define.amd?define(["exports","@object-ui/core","react","@object-ui/components","react-router-dom","lucide-react","react-dom","@object-ui/types","@object-ui/react"],se):(P=typeof globalThis<"u"?globalThis:P||self,se(P.ObjectUILayout={},P.core,P.React,P.components,P.reactRouterDom,P.LucideIcons,P.reactDom,P.types,P.react))})(this,(function(P,se,l,v,Ce,gt,_e,$n,zn){"use strict";function Bn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const V=Bn(gt);var et={exports:{}},$e={};var Ft;function Fn(){if(Ft)return $e;Ft=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,s){var i=null;if(s!==void 0&&(i=""+s),o.key!==void 0&&(i=""+o.key),"key"in o){s={};for(var a in o)a!=="key"&&(s[a]=o[a])}else s=o;return o=s.ref,{$$typeof:e,type:r,key:i,ref:o!==void 0?o:null,props:s}}return $e.Fragment=t,$e.jsx=n,$e.jsxs=n,$e}var ze={};var Yt;function Yn(){return Yt||(Yt=1,process.env.NODE_ENV!=="production"&&(function(){function e(f){if(f==null)return null;if(typeof f=="function")return f.$$typeof===T?null:f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case m:return"Fragment";case D:return"Profiler";case C:return"StrictMode";case I:return"Suspense";case y:return"SuspenseList";case _:return"Activity"}if(typeof f=="object")switch(typeof f.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),f.$$typeof){case x:return"Portal";case N:return f.displayName||"Context";case E:return(f._context.displayName||"Context")+".Consumer";case M:var w=f.render;return f=f.displayName,f||(f=w.displayName||w.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case j:return w=f.displayName||null,w!==null?w:e(f.type)||"Memo";case A:w=f._payload,f=f._init;try{return e(f(w))}catch{}}return null}function t(f){return""+f}function n(f){try{t(f);var w=!1}catch{w=!0}if(w){w=console;var O=w.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&f[Symbol.toStringTag]||f.constructor.name||"Object";return O.call(w,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),t(f)}}function r(f){if(f===m)return"<>";if(typeof f=="object"&&f!==null&&f.$$typeof===A)return"<...>";try{var w=e(f);return w?"<"+w+">":"<...>"}catch{return"<...>"}}function o(){var f=Y.A;return f===null?null:f.getOwner()}function s(){return Error("react-stack-top-frame")}function i(f){if(z.call(f,"key")){var w=Object.getOwnPropertyDescriptor(f,"key").get;if(w&&w.isReactWarning)return!1}return f.key!==void 0}function a(f,w){function O(){le||(le=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",w))}O.isReactWarning=!0,Object.defineProperty(f,"key",{get:O,configurable:!0})}function u(){var f=e(this.type);return q[f]||(q[f]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),f=this.props.ref,f!==void 0?f:null}function d(f,w,O,R,ue,X){var $=O.ref;return f={$$typeof:S,type:f,key:w,props:O,_owner:R},($!==void 0?$:null)!==null?Object.defineProperty(f,"ref",{enumerable:!1,get:u}):Object.defineProperty(f,"ref",{enumerable:!1,value:null}),f._store={},Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(f,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(f,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ue}),Object.defineProperty(f,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f}function g(f,w,O,R,ue,X){var $=w.children;if($!==void 0)if(R)if(W($)){for(R=0;R<$.length;R++)h($[R]);Object.freeze&&Object.freeze($)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h($);if(z.call(w,"key")){$=e(f);var J=Object.keys(w).filter(function(L){return L!=="key"});R=0<J.length?"{key: someKey, "+J.join(": ..., ")+": ...}":"{key: someKey}",be[$+R]||(J=0<J.length?"{"+J.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,
|
|
6
|
+
<%s key={someKey} {...props} />`,R,$,J,$),be[$+R]=!0)}if($=null,O!==void 0&&(n(O),$=""+O),i(w)&&(n(w.key),$=""+w.key),"key"in w){O={};for(var Q in w)Q!=="key"&&(O[Q]=w[Q])}else O=w;return $&&a(O,typeof f=="function"?f.displayName||f.name||"Unknown":f),d(f,$,O,o(),ue,X)}function h(f){b(f)?f._store&&(f._store.validated=1):typeof f=="object"&&f!==null&&f.$$typeof===A&&(f._payload.status==="fulfilled"?b(f._payload.value)&&f._payload.value._store&&(f._payload.value._store.validated=1):f._store&&(f._store.validated=1))}function b(f){return typeof f=="object"&&f!==null&&f.$$typeof===S}var p=l,S=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),N=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),T=Symbol.for("react.client.reference"),Y=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=Object.prototype.hasOwnProperty,W=Array.isArray,B=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(f){return f()}};var le,q={},je=p.react_stack_bottom_frame.bind(p,s)(),re=B(r(s)),be={};ze.Fragment=m,ze.jsx=function(f,w,O){var R=1e4>Y.recentlyCreatedOwnerStacks++;return g(f,w,O,!1,R?Error("react-stack-top-frame"):je,R?B(r(f)):re)},ze.jsxs=function(f,w,O){var R=1e4>Y.recentlyCreatedOwnerStacks++;return g(f,w,O,!0,R?Error("react-stack-top-frame"):je,R?B(r(f)):re)}})()),ze}var Gt;function Gn(){return Gt||(Gt=1,process.env.NODE_ENV==="production"?et.exports=Fn():et.exports=Yn()),et.exports}var c=Gn();function tt({title:e,description:t,action:n,className:r,children:o,...s}){return c.jsx("div",{className:v.cn("flex flex-col gap-4 pb-4 md:pb-8",r),...s,children:c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:e}),t&&c.jsx("p",{className:"text-sm text-muted-foreground",children:t})]}),(n||o)&&c.jsxs("div",{className:"flex items-center gap-2",children:[n,o]})]})})}function Vt(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return null;const n=parseInt(t[1],16)/255,r=parseInt(t[2],16)/255,o=parseInt(t[3],16)/255,s=Math.max(n,r,o),i=Math.min(n,r,o);let a=0,u=0;const d=(s+i)/2;if(s!==i){const g=s-i;switch(u=d>.5?g/(2-s-i):g/(s+i),s){case n:a=((r-o)/g+(r<o?6:0))/6;break;case r:a=((o-n)/g+2)/6;break;case o:a=((n-r)/g+4)/6;break}}return`${Math.round(a*360)} ${Math.round(u*100)}% ${Math.round(d*100)}%`}function Ut(e,t){l.useEffect(()=>{const n=document.documentElement;if(e?.primaryColor){const r=Vt(e.primaryColor);r&&(n.style.setProperty("--brand-primary",e.primaryColor),n.style.setProperty("--brand-primary-hsl",r))}else n.style.removeProperty("--brand-primary"),n.style.removeProperty("--brand-primary-hsl");if(e?.accentColor){const r=Vt(e.accentColor);r&&(n.style.setProperty("--brand-accent",e.accentColor),n.style.setProperty("--brand-accent-hsl",r))}else n.style.removeProperty("--brand-accent"),n.style.removeProperty("--brand-accent-hsl");if(e?.favicon){const r=document.querySelector("#favicon")||document.querySelector('link[rel="icon"]');r&&(r.href=e.favicon)}return t&&(document.title=t),()=>{n.style.removeProperty("--brand-primary"),n.style.removeProperty("--brand-primary-hsl"),n.style.removeProperty("--brand-accent"),n.style.removeProperty("--brand-accent-hsl")}},[e?.primaryColor,e?.accentColor,e?.favicon,t])}function pt({sidebar:e,navbar:t,children:n,className:r,defaultOpen:o=!0,branding:s}){return Ut(s,s?.title),c.jsxs(v.SidebarProvider,{defaultOpen:o,children:[e,c.jsxs(v.SidebarInset,{children:[c.jsxs("header",{className:"flex h-14 sm:h-16 shrink-0 items-center gap-2 border-b bg-background px-2 sm:px-4",children:[c.jsx(v.SidebarTrigger,{className:"-ml-1"}),c.jsx("div",{className:"w-px h-4 bg-border mx-1 sm:mx-2"}),t]}),c.jsx("main",{className:v.cn("flex-1 min-w-0 overflow-auto p-3 sm:p-4 md:p-6",r),children:n})]})]})}function Wt({className:e,children:t,...n}){return c.jsx("div",{className:v.cn("rounded-xl border bg-card text-card-foreground shadow",e),...n,children:c.jsx("div",{className:"p-6",children:t})})}const Vn={xs:{1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",6:"grid-cols-6",12:"grid-cols-12"},sm:{1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",6:"sm:grid-cols-6",12:"sm:grid-cols-12"},md:{1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",6:"md:grid-cols-6",12:"md:grid-cols-12"},lg:{1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",6:"lg:grid-cols-6",12:"lg:grid-cols-12"},xl:{1:"xl:grid-cols-1",2:"xl:grid-cols-2",3:"xl:grid-cols-3",4:"xl:grid-cols-4",6:"xl:grid-cols-6",12:"xl:grid-cols-12"},"2xl":{1:"2xl:grid-cols-1",2:"2xl:grid-cols-2",3:"2xl:grid-cols-3",4:"2xl:grid-cols-4",6:"2xl:grid-cols-6",12:"2xl:grid-cols-12"}};function Un(e){if(!e)return"grid-cols-1";const t=[];for(const[n,r]of Object.entries(e)){const o=Vn[n];if(o&&r){const i=Object.keys(o).map(Number).reduce((a,u)=>Math.abs(u-r)<Math.abs(a-r)?u:a);t.push(o[i])}}return t.join(" ")||"grid-cols-1"}const Wn={0:"gap-0",1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6",8:"gap-8"},qt=({columns:e,gap:t=4,className:n,children:r})=>{const o=Un(e),s=typeof t=="number"?Wn[t]||`gap-${t}`:"";return c.jsx("div",{className:v.cn("grid",o,s,n),children:r})};function qn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return l.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const nt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ee(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function vt(e){return"nodeType"in e}function K(e){var t,n;return e?Ee(e)?e:vt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function bt(e){const{Document:t}=K(e);return e instanceof t}function Be(e){return Ee(e)?!1:e instanceof K(e).HTMLElement}function Xt(e){return e instanceof K(e).SVGElement}function Ne(e){return e?Ee(e)?e.document:vt(e)?bt(e)?e:Be(e)||Xt(e)?e.ownerDocument:document:document:document}const ce=nt?l.useLayoutEffect:l.useEffect;function xt(e){const t=l.useRef(e);return ce(()=>{t.current=e}),l.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Xn(){const e=l.useRef(null),t=l.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=l.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Fe(e,t){t===void 0&&(t=[e]);const n=l.useRef(e);return ce(()=>{n.current!==e&&(n.current=e)},t),n}function Ye(e,t){const n=l.useRef();return l.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function rt(e){const t=xt(e),n=l.useRef(null),r=l.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function mt(e){const t=l.useRef();return l.useEffect(()=>{t.current=e},[e]),t.current}let yt={};function Ge(e,t){return l.useMemo(()=>{if(t)return t;const n=yt[e]==null?0:yt[e]+1;return yt[e]=n,e+"-"+n},[e,t])}function Ht(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((s,i)=>{const a=Object.entries(i);for(const[u,d]of a){const g=s[u];g!=null&&(s[u]=g+e*d)}return s},{...t})}}const De=Ht(1),ot=Ht(-1);function Hn(e){return"clientX"in e&&"clientY"in e}function wt(e){if(!e)return!1;const{KeyboardEvent:t}=K(e.target);return t&&e instanceof t}function Jn(e){if(!e)return!1;const{TouchEvent:t}=K(e.target);return t&&e instanceof t}function St(e){if(Jn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Hn(e)?{x:e.clientX,y:e.clientY}:null}const Ve=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Ve.Translate.toString(e),Ve.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Jt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Kn(e){return e.matches(Jt)?e:e.querySelector(Jt)}const Qn={display:"none"};function Zn(e){let{id:t,value:n}=e;return l.createElement("div",{id:t,style:Qn},n)}function er(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return l.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function tr(){const[e,t]=l.useState("");return{announce:l.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Kt=l.createContext(null);function nr(e){const t=l.useContext(Kt);l.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function rr(){const[e]=l.useState(()=>new Set),t=l.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[l.useCallback(r=>{let{type:o,event:s}=r;e.forEach(i=>{var a;return(a=i[o])==null?void 0:a.call(i,s)})},[e]),t]}const or={draggable:`
|
|
7
|
+
To pick up a draggable item, press the space bar.
|
|
8
|
+
While dragging, use the arrow keys to move the item.
|
|
9
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
10
|
+
`},sr={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function ir(e){let{announcements:t=sr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=or}=e;const{announce:s,announcement:i}=tr(),a=Ge("DndLiveRegion"),[u,d]=l.useState(!1);if(l.useEffect(()=>{d(!0)},[]),nr(l.useMemo(()=>({onDragStart(h){let{active:b}=h;s(t.onDragStart({active:b}))},onDragMove(h){let{active:b,over:p}=h;t.onDragMove&&s(t.onDragMove({active:b,over:p}))},onDragOver(h){let{active:b,over:p}=h;s(t.onDragOver({active:b,over:p}))},onDragEnd(h){let{active:b,over:p}=h;s(t.onDragEnd({active:b,over:p}))},onDragCancel(h){let{active:b,over:p}=h;s(t.onDragCancel({active:b,over:p}))}}),[s,t])),!u)return null;const g=l.createElement(l.Fragment,null,l.createElement(Zn,{id:r,value:o.draggable}),l.createElement(er,{id:a,announcement:i}));return n?_e.createPortal(g,n):g}var F;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(F||(F={}));function st(){}function Qt(e,t){return l.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function ar(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return l.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ie=Object.freeze({x:0,y:0});function lr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function cr(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ur(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function dr(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Zt(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const fr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Zt(t,t.left,t.top),s=[];for(const i of r){const{id:a}=i,u=n.get(a);if(u){const d=lr(Zt(u),o);s.push({id:a,data:{droppableContainer:i,value:d}})}}return s.sort(cr)};function hr(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),i=o-r,a=s-n;if(r<o&&n<s){const u=t.width*t.height,d=e.width*e.height,g=i*a,h=g/(u+d-g);return Number(h.toFixed(4))}return 0}const gr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:i}=s,a=n.get(i);if(a){const u=hr(a,t);u>0&&o.push({id:i,data:{droppableContainer:s,value:u}})}}return o.sort(ur)};function pr(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function en(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ie}function vr(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((i,a)=>({...i,top:i.top+e*a.y,bottom:i.bottom+e*a.y,left:i.left+e*a.x,right:i.right+e*a.x}),{...n})}}const br=vr(1);function xr(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function mr(e,t,n){const r=xr(t);if(!r)return e;const{scaleX:o,scaleY:s,x:i,y:a}=r,u=e.left-i-(1-o)*parseFloat(n),d=e.top-a-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,h=s?e.height/s:e.height;return{width:g,height:h,top:d,right:u+g,bottom:d+h,left:u}}const yr={ignoreTransform:!1};function Ae(e,t){t===void 0&&(t=yr);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=K(e).getComputedStyle(e);d&&(n=mr(n,d,g))}const{top:r,left:o,width:s,height:i,bottom:a,right:u}=n;return{top:r,left:o,width:s,height:i,bottom:a,right:u}}function tn(e){return Ae(e,{ignoreTransform:!0})}function wr(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Sr(e,t){return t===void 0&&(t=K(e).getComputedStyle(e)),t.position==="fixed"}function Cr(e,t){t===void 0&&(t=K(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function Ct(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(bt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Be(o)||Xt(o)||n.includes(o))return n;const s=K(e).getComputedStyle(o);return o!==e&&Cr(o,s)&&n.push(o),Sr(o,s)?n:r(o.parentNode)}return e?r(e):n}function nn(e){const[t]=Ct(e,1);return t??null}function jt(e){return!nt||!e?null:Ee(e)?e:vt(e)?bt(e)||e===Ne(e).scrollingElement?window:Be(e)?e:null:null}function rn(e){return Ee(e)?e.scrollX:e.scrollLeft}function on(e){return Ee(e)?e.scrollY:e.scrollTop}function Et(e){return{x:rn(e),y:on(e)}}var G;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(G||(G={}));function sn(e){return!nt||!e?!1:e===document.scrollingElement}function an(e){const t={x:0,y:0},n=sn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:i,isRight:a,maxScroll:r,minScroll:t}}const jr={x:.2,y:.2};function Er(e,t,n,r,o){let{top:s,left:i,right:a,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=jr);const{isTop:d,isBottom:g,isLeft:h,isRight:b}=an(e),p={x:0,y:0},S={x:0,y:0},x={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+x.height?(p.y=G.Backward,S.y=r*Math.abs((t.top+x.height-s)/x.height)):!g&&u>=t.bottom-x.height&&(p.y=G.Forward,S.y=r*Math.abs((t.bottom-x.height-u)/x.height)),!b&&a>=t.right-x.width?(p.x=G.Forward,S.x=r*Math.abs((t.right-x.width-a)/x.width)):!h&&i<=t.left+x.width&&(p.x=G.Backward,S.x=r*Math.abs((t.left+x.width-i)/x.width)),{direction:p,speed:S}}function Nr(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:i}=window;return{top:0,left:0,right:s,bottom:i,width:s,height:i}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function ln(e){return e.reduce((t,n)=>De(t,Et(n)),ie)}function Dr(e){return e.reduce((t,n)=>t+rn(n),0)}function Ar(e){return e.reduce((t,n)=>t+on(n),0)}function Ir(e,t){if(t===void 0&&(t=Ae),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);nn(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Mr=[["x",["left","right"],Dr],["y",["top","bottom"],Ar]];class Nt{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Ct(n),o=ln(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,i,a]of Mr)for(const u of i)Object.defineProperty(this,u,{get:()=>{const d=a(r),g=o[s]-d;return this.rect[u]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ue{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Tr(e){const{EventTarget:t}=K(e);return e instanceof t?e:Ne(e)}function Dt(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var ne;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ne||(ne={}));function cn(e){e.preventDefault()}function Or(e){e.stopPropagation()}var k;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(k||(k={}));const un={start:[k.Space,k.Enter],cancel:[k.Esc],end:[k.Space,k.Enter,k.Tab]},kr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case k.Right:return{...n,x:n.x+25};case k.Left:return{...n,x:n.x-25};case k.Down:return{...n,y:n.y+25};case k.Up:return{...n,y:n.y-25}}};class At{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ue(Ne(n)),this.windowListeners=new Ue(K(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ne.Resize,this.handleCancel),this.windowListeners.add(ne.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ne.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Ir(r),n(ie)}handleKeyDown(t){if(wt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=un,coordinateGetter:i=kr,scrollBehavior:a="smooth"}=o,{code:u}=t;if(s.end.includes(u)){this.handleEnd(t);return}if(s.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:ie;this.referenceCoordinates||(this.referenceCoordinates=g);const h=i(t,{active:n,context:r.current,currentCoordinates:g});if(h){const b=ot(h,g),p={x:0,y:0},{scrollableAncestors:S}=r.current;for(const x of S){const m=t.code,{isTop:C,isRight:D,isLeft:E,isBottom:N,maxScroll:M,minScroll:I}=an(x),y=Nr(x),j={x:Math.min(m===k.Right?y.right-y.width/2:y.right,Math.max(m===k.Right?y.left:y.left+y.width/2,h.x)),y:Math.min(m===k.Down?y.bottom-y.height/2:y.bottom,Math.max(m===k.Down?y.top:y.top+y.height/2,h.y))},A=m===k.Right&&!D||m===k.Left&&!E,_=m===k.Down&&!N||m===k.Up&&!C;if(A&&j.x!==h.x){const T=x.scrollLeft+b.x,Y=m===k.Right&&T<=M.x||m===k.Left&&T>=I.x;if(Y&&!b.y){x.scrollTo({left:T,behavior:a});return}Y?p.x=x.scrollLeft-T:p.x=m===k.Right?x.scrollLeft-M.x:x.scrollLeft-I.x,p.x&&x.scrollBy({left:-p.x,behavior:a});break}else if(_&&j.y!==h.y){const T=x.scrollTop+b.y,Y=m===k.Down&&T<=M.y||m===k.Up&&T>=I.y;if(Y&&!b.x){x.scrollTo({top:T,behavior:a});return}Y?p.y=x.scrollTop-T:p.y=m===k.Down?x.scrollTop-M.y:x.scrollTop-I.y,p.y&&x.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(t,De(ot(h,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}At.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=un,onActivation:o}=t,{active:s}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const a=s.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function dn(e){return!!(e&&"distance"in e)}function fn(e){return!!(e&&"delay"in e)}class It{constructor(t,n,r){var o;r===void 0&&(r=Tr(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:i}=s;this.props=t,this.events=n,this.document=Ne(i),this.documentListeners=new Ue(this.document),this.listeners=new Ue(r),this.windowListeners=new Ue(K(i)),this.initialCoordinates=(o=St(s))!=null?o:ie,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ne.Resize,this.handleCancel),this.windowListeners.add(ne.DragStart,cn),this.windowListeners.add(ne.VisibilityChange,this.handleCancel),this.windowListeners.add(ne.ContextMenu,cn),this.documentListeners.add(ne.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(fn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(dn(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ne.Click,Or,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ne.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:i,options:{activationConstraint:a}}=s;if(!o)return;const u=(n=St(t))!=null?n:ie,d=ot(o,u);if(!r&&a){if(dn(a)){if(a.tolerance!=null&&Dt(d,a.tolerance))return this.handleCancel();if(Dt(d,a.distance))return this.handleStart()}if(fn(a)&&Dt(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}t.cancelable&&t.preventDefault(),i(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===k.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Lr={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Mt extends It{constructor(t){const{event:n}=t,r=Ne(n.target);super(t,Lr,r)}}Mt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Rr={move:{name:"mousemove"},end:{name:"mouseup"}};var Tt;(function(e){e[e.RightClick=2]="RightClick"})(Tt||(Tt={}));class Pr extends It{constructor(t){super(t,Rr,Ne(t.event.target))}}Pr.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Tt.RightClick?!1:(r?.({event:n}),!0)}}];const Ot={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class _r extends It{constructor(t){super(t,Ot)}static setup(){return window.addEventListener(Ot.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ot.move.name,t)};function t(){}}}_r.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var We;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(We||(We={}));var it;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(it||(it={}));function $r(e){let{acceleration:t,activator:n=We.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:i=5,order:a=it.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:g,delta:h,threshold:b}=e;const p=Br({delta:h,disabled:!s}),[S,x]=Xn(),m=l.useRef({x:0,y:0}),C=l.useRef({x:0,y:0}),D=l.useMemo(()=>{switch(n){case We.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case We.DraggableRect:return o}},[n,o,u]),E=l.useRef(null),N=l.useCallback(()=>{const I=E.current;if(!I)return;const y=m.current.x*C.current.x,j=m.current.y*C.current.y;I.scrollBy(y,j)},[]),M=l.useMemo(()=>a===it.TreeOrder?[...d].reverse():d,[a,d]);l.useEffect(()=>{if(!s||!d.length||!D){x();return}for(const I of M){if(r?.(I)===!1)continue;const y=d.indexOf(I),j=g[y];if(!j)continue;const{direction:A,speed:_}=Er(I,j,D,t,b);for(const T of["x","y"])p[T][A[T]]||(_[T]=0,A[T]=0);if(_.x>0||_.y>0){x(),E.current=I,S(N,i),m.current=_,C.current=A;return}}m.current={x:0,y:0},C.current={x:0,y:0},x()},[t,N,r,x,s,i,JSON.stringify(D),JSON.stringify(p),S,d,M,g,JSON.stringify(b)])}const zr={x:{[G.Backward]:!1,[G.Forward]:!1},y:{[G.Backward]:!1,[G.Forward]:!1}};function Br(e){let{delta:t,disabled:n}=e;const r=mt(t);return Ye(o=>{if(n||!r||!o)return zr;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[G.Backward]:o.x[G.Backward]||s.x===-1,[G.Forward]:o.x[G.Forward]||s.x===1},y:{[G.Backward]:o.y[G.Backward]||s.y===-1,[G.Forward]:o.y[G.Forward]||s.y===1}}},[n,t,r])}function Fr(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Ye(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function Yr(e,t){return l.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...s]},[]),[e,t])}var qe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(qe||(qe={}));var kt;(function(e){e.Optimized="optimized"})(kt||(kt={}));const hn=new Map;function Gr(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,i]=l.useState(null),{frequency:a,measure:u,strategy:d}=o,g=l.useRef(e),h=m(),b=Fe(h),p=l.useCallback(function(C){C===void 0&&(C=[]),!b.current&&i(D=>D===null?C:D.concat(C.filter(E=>!D.includes(E))))},[b]),S=l.useRef(null),x=Ye(C=>{if(h&&!n)return hn;if(!C||C===hn||g.current!==e||s!=null){const D=new Map;for(let E of e){if(!E)continue;if(s&&s.length>0&&!s.includes(E.id)&&E.rect.current){D.set(E.id,E.rect.current);continue}const N=E.node.current,M=N?new Nt(u(N),N):null;E.rect.current=M,M&&D.set(E.id,M)}return D}return C},[e,s,n,h,u]);return l.useEffect(()=>{g.current=e},[e]),l.useEffect(()=>{h||p()},[n,h]),l.useEffect(()=>{s&&s.length>0&&i(null)},[JSON.stringify(s)]),l.useEffect(()=>{h||typeof a!="number"||S.current!==null||(S.current=setTimeout(()=>{p(),S.current=null},a))},[a,h,p,...r]),{droppableRects:x,measureDroppableContainers:p,measuringScheduled:s!=null};function m(){switch(d){case qe.Always:return!1;case qe.BeforeDragging:return n;default:return!n}}}function gn(e,t){return Ye(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Vr(e,t){return gn(e,t)}function Ur(e){let{callback:t,disabled:n}=e;const r=xt(t),o=l.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return l.useEffect(()=>()=>o?.disconnect(),[o]),o}function at(e){let{callback:t,disabled:n}=e;const r=xt(t),o=l.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return l.useEffect(()=>()=>o?.disconnect(),[o]),o}function Wr(e){return new Nt(Ae(e),e)}function pn(e,t,n){t===void 0&&(t=Wr);const[r,o]=l.useState(null);function s(){o(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??n)!=null?d:null}const g=t(e);return JSON.stringify(u)===JSON.stringify(g)?u:g})}const i=Ur({callback(u){if(e)for(const d of u){const{type:g,target:h}=d;if(g==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),a=at({callback:s});return ce(()=>{s(),e?(a?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),i?.disconnect())},[e]),r}function qr(e){const t=gn(e);return en(e,t)}const vn=[];function Xr(e){const t=l.useRef(e),n=Ye(r=>e?r&&r!==vn&&e&&t.current&&e.parentNode===t.current.parentNode?r:Ct(e):vn,[e]);return l.useEffect(()=>{t.current=e},[e]),n}function Hr(e){const[t,n]=l.useState(null),r=l.useRef(e),o=l.useCallback(s=>{const i=jt(s.target);i&&n(a=>a?(a.set(i,Et(i)),new Map(a)):null)},[]);return l.useEffect(()=>{const s=r.current;if(e!==s){i(s);const a=e.map(u=>{const d=jt(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Et(d)]):null}).filter(u=>u!=null);n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(s)};function i(a){a.forEach(u=>{const d=jt(u);d?.removeEventListener("scroll",o)})}},[o,e]),l.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,i)=>De(s,i),ie):ln(e):ie,[e,t])}function bn(e,t){t===void 0&&(t=[]);const n=l.useRef(null);return l.useEffect(()=>{n.current=null},t),l.useEffect(()=>{const r=e!==ie;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ot(e,n.current):ie}function Jr(e){l.useEffect(()=>{if(!nt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Kr(e,t){return l.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=i=>{s(i,t)},n},{}),[e,t])}function xn(e){return l.useMemo(()=>e?wr(e):null,[e])}const mn=[];function Qr(e,t){t===void 0&&(t=Ae);const[n]=e,r=xn(n?K(n):null),[o,s]=l.useState(mn);function i(){s(()=>e.length?e.map(u=>sn(u)?r:new Nt(t(u),u)):mn)}const a=at({callback:i});return ce(()=>{a?.disconnect(),i(),e.forEach(u=>a?.observe(u))},[e]),o}function Zr(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Be(t)?t:e}function eo(e){let{measure:t}=e;const[n,r]=l.useState(null),o=l.useCallback(d=>{for(const{target:g}of d)if(Be(g)){r(h=>{const b=t(g);return h?{...h,width:b.width,height:b.height}:b});break}},[t]),s=at({callback:o}),i=l.useCallback(d=>{const g=Zr(d);s?.disconnect(),g&&s?.observe(g),r(g?t(g):null)},[t,s]),[a,u]=rt(i);return l.useMemo(()=>({nodeRef:a,rect:n,setRef:u}),[n,a,u])}const to=[{sensor:Mt,options:{}},{sensor:At,options:{}}],no={current:{}},lt={draggable:{measure:tn},droppable:{measure:tn,strategy:qe.WhileDragging,frequency:kt.Optimized},dragOverlay:{measure:Ae}};class Xe extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const ro={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Xe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:st},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:lt,measureDroppableContainers:st,windowRect:null,measuringScheduled:!1},oo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:st,draggableNodes:new Map,over:null,measureDroppableContainers:st},ct=l.createContext(oo),yn=l.createContext(ro);function so(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Xe}}}function io(e,t){switch(t.type){case F.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case F.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case F.DragEnd:case F.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case F.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Xe(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case F.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new Xe(e.droppable.containers);return i.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case F.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Xe(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function ao(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=l.useContext(ct),s=mt(r),i=mt(n?.id);return l.useEffect(()=>{if(!t&&!r&&s&&i!=null){if(!wt(s)||document.activeElement===s.target)return;const a=o.get(i);if(!a)return;const{activatorNode:u,node:d}=a;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[u.current,d.current]){if(!g)continue;const h=Kn(g);if(h){h.focus();break}}})}},[r,t,o,i,s]),null}function lo(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function co(e){return l.useMemo(()=>({draggable:{...lt.draggable,...e?.draggable},droppable:{...lt.droppable,...e?.droppable},dragOverlay:{...lt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function uo(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=l.useRef(!1),{x:i,y:a}=typeof o=="boolean"?{x:o,y:o}:o;ce(()=>{if(!i&&!a||!t){s.current=!1;return}if(s.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const g=n(d),h=en(g,r);if(i||(h.x=0),a||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const b=nn(d);b&&b.scrollBy({top:h.y,left:h.x})}},[t,i,a,r,n])}const wn=l.createContext({...ie,scaleX:1,scaleY:1});var ve;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ve||(ve={}));const fo=l.memo(function(t){var n,r,o,s;let{id:i,accessibility:a,autoScroll:u=!0,children:d,sensors:g=to,collisionDetection:h=gr,measuring:b,modifiers:p,...S}=t;const x=l.useReducer(io,void 0,so),[m,C]=x,[D,E]=rr(),[N,M]=l.useState(ve.Uninitialized),I=N===ve.Initialized,{draggable:{active:y,nodes:j,translate:A},droppable:{containers:_}}=m,T=y!=null?j.get(y):null,Y=l.useRef({initial:null,translated:null}),z=l.useMemo(()=>{var H;return y!=null?{id:y,data:(H=T?.data)!=null?H:no,rect:Y}:null},[y,T]),W=l.useRef(null),[B,le]=l.useState(null),[q,je]=l.useState(null),re=Fe(S,Object.values(S)),be=Ge("DndDescribedBy",i),f=l.useMemo(()=>_.getEnabled(),[_]),w=co(b),{droppableRects:O,measureDroppableContainers:R,measuringScheduled:ue}=Gr(f,{dragging:I,dependencies:[A.x,A.y],config:w.droppable}),X=Fr(j,y),$=l.useMemo(()=>q?St(q):null,[q]),J=ts(),Q=Vr(X,w.draggable.measure);uo({activeNode:y!=null?j.get(y):null,config:J.layoutShiftCompensation,initialRect:Q,measure:w.draggable.measure});const L=pn(X,w.draggable.measure,Q),He=pn(X?X.parentElement:null),de=l.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:O,draggableNodes:j,draggingNode:null,draggingNodeRect:null,droppableContainers:_,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Te=_.getNodeFor((n=de.current.over)==null?void 0:n.id),ge=eo({measure:w.dragOverlay.measure}),Oe=(r=ge.nodeRef.current)!=null?r:X,ke=I?(o=ge.rect)!=null?o:L:null,Mn=!!(ge.nodeRef.current&&ge.rect),Tn=qr(Mn?null:L),$t=xn(Oe?K(Oe):null),xe=Xr(I?Te??X:null),ft=Qr(xe),ht=lo(p,{transform:{x:A.x-Tn.x,y:A.y-Tn.y,scaleX:1,scaleY:1},activatorEvent:q,active:z,activeNodeRect:L,containerNodeRect:He,draggingNodeRect:ke,over:de.current.over,overlayNodeRect:ge.rect,scrollableAncestors:xe,scrollableAncestorRects:ft,windowRect:$t}),On=$?De($,A):null,kn=Hr(xe),Xo=bn(kn),Ho=bn(kn,[L]),Le=De(ht,Xo),Re=ke?br(ke,ht):null,Je=z&&Re?h({active:z,collisionRect:Re,droppableRects:O,droppableContainers:f,pointerCoordinates:On}):null,Ln=dr(Je,"id"),[me,Rn]=l.useState(null),Jo=Mn?ht:De(ht,Ho),Ko=pr(Jo,(s=me?.rect)!=null?s:null,L),zt=l.useRef(null),Pn=l.useCallback((H,Z)=>{let{sensor:ee,options:ye}=Z;if(W.current==null)return;const oe=j.get(W.current);if(!oe)return;const te=H.nativeEvent,fe=new ee({active:W.current,activeNode:oe,event:te,options:ye,context:de,onAbort(U){if(!j.get(U))return;const{onDragAbort:he}=re.current,pe={id:U};he?.(pe),D({type:"onDragAbort",event:pe})},onPending(U,we,he,pe){if(!j.get(U))return;const{onDragPending:Qe}=re.current,Se={id:U,constraint:we,initialCoordinates:he,offset:pe};Qe?.(Se),D({type:"onDragPending",event:Se})},onStart(U){const we=W.current;if(we==null)return;const he=j.get(we);if(!he)return;const{onDragStart:pe}=re.current,Ke={activatorEvent:te,active:{id:we,data:he.data,rect:Y}};_e.unstable_batchedUpdates(()=>{pe?.(Ke),M(ve.Initializing),C({type:F.DragStart,initialCoordinates:U,active:we}),D({type:"onDragStart",event:Ke}),le(zt.current),je(te)})},onMove(U){C({type:F.DragMove,coordinates:U})},onEnd:Pe(F.DragEnd),onCancel:Pe(F.DragCancel)});zt.current=fe;function Pe(U){return async function(){const{active:he,collisions:pe,over:Ke,scrollAdjustedTranslate:Qe}=de.current;let Se=null;if(he&&Qe){const{cancelDrop:Ze}=re.current;Se={activatorEvent:te,active:he,collisions:pe,delta:Qe,over:Ke},U===F.DragEnd&&typeof Ze=="function"&&await Promise.resolve(Ze(Se))&&(U=F.DragCancel)}W.current=null,_e.unstable_batchedUpdates(()=>{C({type:U}),M(ve.Uninitialized),Rn(null),le(null),je(null),zt.current=null;const Ze=U===F.DragEnd?"onDragEnd":"onDragCancel";if(Se){const Bt=re.current[Ze];Bt?.(Se),D({type:Ze,event:Se})}})}}},[j]),Qo=l.useCallback((H,Z)=>(ee,ye)=>{const oe=ee.nativeEvent,te=j.get(ye);if(W.current!==null||!te||oe.dndKit||oe.defaultPrevented)return;const fe={active:te};H(ee,Z.options,fe)===!0&&(oe.dndKit={capturedBy:Z.sensor},W.current=ye,Pn(ee,Z))},[j,Pn]),_n=Yr(g,Qo);Jr(g),ce(()=>{L&&N===ve.Initializing&&M(ve.Initialized)},[L,N]),l.useEffect(()=>{const{onDragMove:H}=re.current,{active:Z,activatorEvent:ee,collisions:ye,over:oe}=de.current;if(!Z||!ee)return;const te={active:Z,activatorEvent:ee,collisions:ye,delta:{x:Le.x,y:Le.y},over:oe};_e.unstable_batchedUpdates(()=>{H?.(te),D({type:"onDragMove",event:te})})},[Le.x,Le.y]),l.useEffect(()=>{const{active:H,activatorEvent:Z,collisions:ee,droppableContainers:ye,scrollAdjustedTranslate:oe}=de.current;if(!H||W.current==null||!Z||!oe)return;const{onDragOver:te}=re.current,fe=ye.get(Ln),Pe=fe&&fe.rect.current?{id:fe.id,rect:fe.rect.current,data:fe.data,disabled:fe.disabled}:null,U={active:H,activatorEvent:Z,collisions:ee,delta:{x:oe.x,y:oe.y},over:Pe};_e.unstable_batchedUpdates(()=>{Rn(Pe),te?.(U),D({type:"onDragOver",event:U})})},[Ln]),ce(()=>{de.current={activatorEvent:q,active:z,activeNode:X,collisionRect:Re,collisions:Je,droppableRects:O,draggableNodes:j,draggingNode:Oe,draggingNodeRect:ke,droppableContainers:_,over:me,scrollableAncestors:xe,scrollAdjustedTranslate:Le},Y.current={initial:ke,translated:Re}},[z,X,Je,Re,j,Oe,ke,O,_,me,xe,Le]),$r({...J,delta:A,draggingRect:Re,pointerCoordinates:On,scrollableAncestors:xe,scrollableAncestorRects:ft});const Zo=l.useMemo(()=>({active:z,activeNode:X,activeNodeRect:L,activatorEvent:q,collisions:Je,containerNodeRect:He,dragOverlay:ge,draggableNodes:j,droppableContainers:_,droppableRects:O,over:me,measureDroppableContainers:R,scrollableAncestors:xe,scrollableAncestorRects:ft,measuringConfiguration:w,measuringScheduled:ue,windowRect:$t}),[z,X,L,q,Je,He,ge,j,_,O,me,R,xe,ft,w,ue,$t]),es=l.useMemo(()=>({activatorEvent:q,activators:_n,active:z,activeNodeRect:L,ariaDescribedById:{draggable:be},dispatch:C,draggableNodes:j,over:me,measureDroppableContainers:R}),[q,_n,z,L,C,be,j,me,R]);return l.createElement(Kt.Provider,{value:E},l.createElement(ct.Provider,{value:es},l.createElement(yn.Provider,{value:Zo},l.createElement(wn.Provider,{value:Ko},d)),l.createElement(ao,{disabled:a?.restoreFocus===!1})),l.createElement(ir,{...a,hiddenTextDescribedById:be}));function ts(){const H=B?.autoScrollEnabled===!1,Z=typeof u=="object"?u.enabled===!1:u===!1,ee=I&&!H&&!Z;return typeof u=="object"?{...u,enabled:ee}:{enabled:ee}}}),ho=l.createContext(null),Sn="button",go="Draggable";function po(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=Ge(go),{activators:i,activatorEvent:a,active:u,activeNodeRect:d,ariaDescribedById:g,draggableNodes:h,over:b}=l.useContext(ct),{role:p=Sn,roleDescription:S="draggable",tabIndex:x=0}=o??{},m=u?.id===t,C=l.useContext(m?wn:ho),[D,E]=rt(),[N,M]=rt(),I=Kr(i,t),y=Fe(n);ce(()=>(h.set(t,{id:t,key:s,node:D,activatorNode:N,data:y}),()=>{const A=h.get(t);A&&A.key===s&&h.delete(t)}),[h,t]);const j=l.useMemo(()=>({role:p,tabIndex:x,"aria-disabled":r,"aria-pressed":m&&p===Sn?!0:void 0,"aria-roledescription":S,"aria-describedby":g.draggable}),[r,p,x,m,S,g.draggable]);return{active:u,activatorEvent:a,activeNodeRect:d,attributes:j,isDragging:m,listeners:r?void 0:I,node:D,over:b,setNodeRef:E,setActivatorNodeRef:M,transform:C}}function vo(){return l.useContext(yn)}const bo="Droppable",xo={timeout:25};function mo(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=Ge(bo),{active:i,dispatch:a,over:u,measureDroppableContainers:d}=l.useContext(ct),g=l.useRef({disabled:n}),h=l.useRef(!1),b=l.useRef(null),p=l.useRef(null),{disabled:S,updateMeasurementsFor:x,timeout:m}={...xo,...o},C=Fe(x??r),D=l.useCallback(()=>{if(!h.current){h.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(C.current)?C.current:[C.current]),p.current=null},m)},[m]),E=at({callback:D,disabled:S||!i}),N=l.useCallback((j,A)=>{E&&(A&&(E.unobserve(A),h.current=!1),j&&E.observe(j))},[E]),[M,I]=rt(N),y=Fe(t);return l.useEffect(()=>{!E||!M.current||(E.disconnect(),h.current=!1,E.observe(M.current))},[M,E]),l.useEffect(()=>(a({type:F.RegisterDroppable,element:{id:r,key:s,disabled:n,node:M,rect:b,data:y}}),()=>a({type:F.UnregisterDroppable,key:s,id:r})),[r]),l.useEffect(()=>{n!==g.current.disabled&&(a({type:F.SetDroppableDisabled,id:r,key:s,disabled:n}),g.current.disabled=n)},[r,s,n,a]),{active:i,rect:b,isOver:u?.id===r,node:M,over:u,setNodeRef:I}}function Lt(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function yo(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function ut(e){return e!==null&&e>=0}function wo(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function So(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Cn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=Lt(t,r,n),i=t[o],a=s[o];return!a||!i?null:{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}},dt={scaleX:1,scaleY:1},Co=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:i}=e;const a=(t=s[n])!=null?t:r;if(!a)return null;if(o===n){const d=s[i];return d?{x:0,y:n<i?d.top+d.height-(a.top+a.height):d.top-a.top,...dt}:null}const u=jo(s,o,n);return o>n&&o<=i?{x:0,y:-a.height-u,...dt}:o<n&&o>=i?{x:0,y:a.height+u,...dt}:{x:0,y:0,...dt}};function jo(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.top-(o.top+o.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const jn="Sortable",En=l.createContext({activeIndex:-1,containerId:jn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Cn,disabled:{draggable:!1,droppable:!1}});function Eo(e){let{children:t,id:n,items:r,strategy:o=Cn,disabled:s=!1}=e;const{active:i,dragOverlay:a,droppableRects:u,over:d,measureDroppableContainers:g}=vo(),h=Ge(jn,n),b=a.rect!==null,p=l.useMemo(()=>r.map(I=>typeof I=="object"&&"id"in I?I.id:I),[r]),S=i!=null,x=i?p.indexOf(i.id):-1,m=d?p.indexOf(d.id):-1,C=l.useRef(p),D=!wo(p,C.current),E=m!==-1&&x===-1||D,N=So(s);ce(()=>{D&&S&&g(p)},[D,p,S,g]),l.useEffect(()=>{C.current=p},[p]);const M=l.useMemo(()=>({activeIndex:x,containerId:h,disabled:N,disableTransforms:E,items:p,overIndex:m,useDragOverlay:b,sortedRects:yo(p,u),strategy:o}),[x,h,N.draggable,N.droppable,E,p,m,u,b,o]);return l.createElement(En.Provider,{value:M},t)}const No=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Lt(n,r,o).indexOf(t)},Do=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:i,previousItems:a,previousContainerId:u,transition:d}=e;return!d||!r||a!==s&&o===i?!1:n?!0:i!==o&&t===u},Ao={duration:200,easing:"ease"},Nn="transform",Io=Ve.Transition.toString({property:Nn,duration:0,easing:"linear"}),Mo={roleDescription:"sortable"};function To(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,i]=l.useState(null),a=l.useRef(n);return ce(()=>{if(!t&&n!==a.current&&r.current){const u=o.current;if(u){const d=Ae(r.current,{ignoreTransform:!0}),g={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(g.x||g.y)&&i(g)}}n!==a.current&&(a.current=n)},[t,n,r,o]),l.useEffect(()=>{s&&i(null)},[s]),s}function Oo(e){let{animateLayoutChanges:t=Do,attributes:n,disabled:r,data:o,getNewIndex:s=No,id:i,strategy:a,resizeObserverConfig:u,transition:d=Ao}=e;const{items:g,containerId:h,activeIndex:b,disabled:p,disableTransforms:S,sortedRects:x,overIndex:m,useDragOverlay:C,strategy:D}=l.useContext(En),E=ko(r,p),N=g.indexOf(i),M=l.useMemo(()=>({sortable:{containerId:h,index:N,items:g},...o}),[h,o,N,g]),I=l.useMemo(()=>g.slice(g.indexOf(i)),[g,i]),{rect:y,node:j,isOver:A,setNodeRef:_}=mo({id:i,data:M,disabled:E.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...u}}),{active:T,activatorEvent:Y,activeNodeRect:z,attributes:W,setNodeRef:B,listeners:le,isDragging:q,over:je,setActivatorNodeRef:re,transform:be}=po({id:i,data:M,attributes:{...Mo,...n},disabled:E.draggable}),f=qn(_,B),w=!!T,O=w&&!S&&ut(b)&&ut(m),R=!C&&q,ue=R&&O?be:null,$=O?ue??(a??D)({rects:x,activeNodeRect:z,activeIndex:b,overIndex:m,index:N}):null,J=ut(b)&&ut(m)?s({id:i,items:g,activeIndex:b,overIndex:m}):N,Q=T?.id,L=l.useRef({activeId:Q,items:g,newIndex:J,containerId:h}),He=g!==L.current.items,de=t({active:T,containerId:h,isDragging:q,isSorting:w,id:i,index:N,items:g,newIndex:L.current.newIndex,previousItems:L.current.items,previousContainerId:L.current.containerId,transition:d,wasDragging:L.current.activeId!=null}),Te=To({disabled:!de,index:N,node:j,rect:y});return l.useEffect(()=>{w&&L.current.newIndex!==J&&(L.current.newIndex=J),h!==L.current.containerId&&(L.current.containerId=h),g!==L.current.items&&(L.current.items=g)},[w,J,h,g]),l.useEffect(()=>{if(Q===L.current.activeId)return;if(Q!=null&&L.current.activeId==null){L.current.activeId=Q;return}const Oe=setTimeout(()=>{L.current.activeId=Q},50);return()=>clearTimeout(Oe)},[Q]),{active:T,activeIndex:b,attributes:W,data:M,rect:y,index:N,newIndex:J,items:g,isOver:A,isSorting:w,isDragging:q,listeners:le,node:j,overIndex:m,over:je,setNodeRef:f,setActivatorNodeRef:re,setDroppableNodeRef:_,setDraggableNodeRef:B,transform:Te??$,transition:ge()};function ge(){if(Te||He&&L.current.newIndex===N)return Io;if(!(R&&!wt(Y)||!d)&&(w||de))return Ve.Transition.toString({...d,property:Nn})}}function ko(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}k.Down,k.Right,k.Up,k.Left;const Rt=new Map;function Ie(e){if(!e)return V.FileText;const t=Rt.get(e);if(t)return t;if(V[e])return Rt.set(e,V[e]),V[e];const n=e.split("-").filter(Boolean).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("");return V[n]?(Rt.set(e,V[n]),V[n]):V.FileText}function ae(e,t){if(typeof e=="string")return e;if(t){const n=t(e.key,{defaultValue:e.defaultValue,...e.params});if(n&&n!==e.key)return n}return e.defaultValue||e.key}function Lo(e,t,n){const r=ae(e.label,n);return t&&e.type==="object"&&e.objectName&&typeof e.label=="string"?t(e.objectName,r):r}const Ro=e=>!(e===!1||e==="false"),Po=()=>!0;function _o(e,t){switch(e.type){case"object":{const n=`${t}/${e.objectName??""}`;return{href:e.viewName?`${n}/view/${e.viewName}`:n,external:!1}}case"dashboard":return{href:e.dashboardName?`${t}/dashboard/${e.dashboardName}`:"#",external:!1};case"page":return{href:e.pageName?`${t}/page/${e.pageName}`:"#",external:!1};case"report":return{href:e.reportName?`${t}/report/${e.reportName}`:"#",external:!1};case"url":return{href:e.url??"#",external:e.target==="_blank"};default:return{href:"#",external:!1}}}function Pt(e,t){if(!t.trim())return e;const n=t.toLowerCase().trim();return e.reduce((r,o)=>{if(o.type==="separator")return r;if(o.type==="group"&&o.children?.length){const s=Pt(o.children,t);return s.length>0&&r.push({...o,children:s}),r}return ae(o.label).toLowerCase().includes(n)&&r.push(o),r},[])}const $o=5;function zo({item:e,basePath:t,evalVis:n,checkPerm:r,onAction:o,enablePinning:s,onPinToggle:i,enableReorder:a,resolveObjectLabel:u,t:d}){const{attributes:g,listeners:h,setNodeRef:b,transform:p,transition:S,isDragging:x}=Oo({id:e.id,disabled:!a}),m={transform:Ve.Transform.toString(p),transition:S,opacity:x?.5:void 0,zIndex:x?10:void 0};return c.jsx("div",{ref:b,style:m,...g,children:c.jsx(Me,{item:e,basePath:t,evalVis:n,checkPerm:r,onAction:o,enablePinning:s,onPinToggle:i,dragListeners:a?h:void 0,resolveObjectLabel:u,t:d})})}function Me({item:e,basePath:t,evalVis:n,checkPerm:r,onAction:o,enablePinning:s,onPinToggle:i,dragListeners:a,resolveObjectLabel:u,t:d}){const g=Ce.useLocation(),[h,b]=l.useState(e.defaultOpen!==!1);if(!n(e.visible)||e.requiredPermissions?.length&&!r(e.requiredPermissions))return null;if(e.type==="separator")return c.jsx(v.Separator,{className:"my-2"});if(e.type==="group"){const E=(e.children??[]).slice().sort((N,M)=>(N.order??0)-(M.order??0));return c.jsx(v.Collapsible,{open:h,onOpenChange:b,children:c.jsxs(v.SidebarGroup,{children:[c.jsx(v.SidebarGroupLabel,{asChild:!0,children:c.jsxs(v.CollapsibleTrigger,{className:"flex w-full items-center justify-between",children:[ae(e.label,d),c.jsx(V.ChevronRight,{className:`ml-auto h-4 w-4 transition-transform ${h?"rotate-90":""}`})]})}),c.jsx(v.CollapsibleContent,{children:c.jsx(v.SidebarGroupContent,{children:c.jsx(v.SidebarMenu,{children:E.map(N=>c.jsx(Me,{item:N,basePath:t,evalVis:n,checkPerm:r,onAction:o,enablePinning:s,onPinToggle:i,resolveObjectLabel:u,t:d},N.id))})})})]})})}if(e.type==="action"){const E=Ie(e.icon);return c.jsxs(v.SidebarMenuItem,{children:[a&&c.jsx("span",{className:"absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground","aria-label":"Drag to reorder",...a,children:c.jsx(V.GripVertical,{className:"h-3.5 w-3.5"})}),c.jsxs(v.SidebarMenuButton,{tooltip:ae(e.label,d),onClick:()=>o?.(e),children:[c.jsx(E,{className:"h-4 w-4"}),c.jsx("span",{children:ae(e.label,d)}),e.badge!=null&&c.jsx(v.Badge,{variant:e.badgeVariant??"default",className:"ml-auto text-[10px] px-1.5 py-0",children:e.badge})]}),s&&i&&c.jsx(v.SidebarMenuAction,{showOnHover:!e.pinned,onClick:()=>i(e.id,!e.pinned),"aria-label":e.pinned?`Unpin ${ae(e.label,d)}`:`Pin ${ae(e.label,d)}`,children:e.pinned?c.jsx(V.PinOff,{className:"h-3.5 w-3.5"}):c.jsx(V.Pin,{className:"h-3.5 w-3.5"})})]})}const p=Ie(e.icon),{href:S,external:x}=_o(e,t),m=S!=="#"&&g.pathname.startsWith(S),C=Lo(e,u,d),D=c.jsxs(c.Fragment,{children:[c.jsx(p,{className:"h-4 w-4"}),c.jsx("span",{children:C}),e.badge!=null&&c.jsx(v.Badge,{variant:e.badgeVariant??"default",className:"ml-auto text-[10px] px-1.5 py-0",children:e.badge})]});return c.jsxs(v.SidebarMenuItem,{children:[a&&c.jsx("span",{className:"absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground","aria-label":"Drag to reorder",...a,children:c.jsx(V.GripVertical,{className:"h-3.5 w-3.5"})}),c.jsx(v.SidebarMenuButton,{asChild:!0,isActive:m,tooltip:C,children:x?c.jsx("a",{href:S,target:"_blank",rel:"noopener noreferrer",children:D}):c.jsx(Ce.Link,{to:S,children:D})}),s&&i&&c.jsx(v.SidebarMenuAction,{showOnHover:!e.pinned,onClick:()=>i(e.id,!e.pinned),"aria-label":e.pinned?`Unpin ${C}`:`Pin ${C}`,children:e.pinned?c.jsx(V.PinOff,{className:"h-3.5 w-3.5"}):c.jsx(V.Pin,{className:"h-3.5 w-3.5"})})]})}function _t({items:e,basePath:t="",evaluateVisibility:n=Ro,checkPermission:r=Po,onAction:o,searchQuery:s,enablePinning:i,onPinToggle:a,enableReorder:u,onReorder:d,resolveObjectLabel:g,t:h}){const b=l.useMemo(()=>s?Pt(e,s):e,[e,s]),p=l.useMemo(()=>Dn(b),[b]),S=b.slice().sort((y,j)=>(y.order??0)-(j.order??0)),x=ar(Qt(Mt,{activationConstraint:{distance:$o}}),Qt(At)),m=y=>{const{active:j,over:A}=y;if(!A||j.id===A.id||!d)return;const _=S.findIndex(z=>z.id===j.id),T=S.findIndex(z=>z.id===A.id);if(_===-1||T===-1)return;const Y=Lt(S,_,T).map((z,W)=>({...z,order:W}));d(Y)},C={basePath:t,evalVis:n,checkPerm:r,onAction:o,enablePinning:i,onPinToggle:a,resolveObjectLabel:g,t:h},D=S.some(y=>y.type==="group"),E=p.length>0&&i?c.jsxs(v.SidebarGroup,{children:[c.jsxs(v.SidebarGroupLabel,{className:"flex items-center gap-1.5",children:[c.jsx(V.Star,{className:"h-3.5 w-3.5"}),"Favorites"]}),c.jsx(v.SidebarGroupContent,{children:c.jsx(v.SidebarMenu,{children:p.map(y=>c.jsx(Me,{item:y,...C},`fav-${y.id}`))})})]}):null;if(!D){const y=S.filter(A=>A.type!=="group").map(A=>A.id),j=u?c.jsx(fo,{sensors:x,collisionDetection:fr,onDragEnd:m,children:c.jsx(Eo,{items:y,strategy:Co,children:c.jsx(v.SidebarMenu,{children:S.map(A=>c.jsx(zo,{item:A,enableReorder:u,...C},A.id))})})}):c.jsx(v.SidebarMenu,{children:S.map(A=>c.jsx(Me,{item:A,...C},A.id))});return c.jsxs(c.Fragment,{children:[E,c.jsx(v.SidebarGroup,{children:c.jsx(v.SidebarGroupContent,{children:j})})]})}const N=[];let M=[];const I=y=>{if(M.length===0)return;const j=M;M=[],N.push(c.jsx(v.SidebarGroup,{children:c.jsx(v.SidebarGroupContent,{children:c.jsx(v.SidebarMenu,{children:j.map(A=>c.jsx(Me,{item:A,...C},A.id))})})},y))};return S.forEach((y,j)=>{y.type==="group"?(I(`leaf-${j}`),N.push(c.jsx(Me,{item:y,...C},y.id))):M.push(y)}),I("leaf-end"),c.jsxs(c.Fragment,{children:[E,N]})}function Dn(e){const t=[];for(const n of e)n.pinned&&n.type!=="group"&&n.type!=="separator"&&t.push(n),n.children?.length&&t.push(...Dn(n.children));return t}function Bo({areas:e,activeAreaId:t,onAreaChange:n,evalVis:r,checkPerm:o}){const s=e.filter(i=>!(!r(i.visible)||i.requiredPermissions?.length&&!o(i.requiredPermissions)));return s.length<=1?null:c.jsxs(v.SidebarGroup,{children:[c.jsxs(v.SidebarGroupLabel,{className:"flex items-center gap-1.5",children:[c.jsx(V.Layers,{className:"h-3.5 w-3.5"}),"Area"]}),c.jsx(v.SidebarGroupContent,{children:c.jsx(v.SidebarMenu,{children:s.map(i=>{const a=Ie(i.icon);return c.jsx(v.SidebarMenuItem,{children:c.jsxs(v.SidebarMenuButton,{isActive:i.id===t,tooltip:ae(i.label),onClick:()=>n(i.id),children:[c.jsx(a,{className:"h-4 w-4"}),c.jsx("span",{children:ae(i.label)})]})},i.id)})})})]})}function Fo({items:e,basePath:t}){const n=Ce.useLocation(),r=e.filter(o=>o.type!=="group"&&o.type!=="separator").slice(0,5);return r.length===0?null:c.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-50 flex items-center justify-around border-t bg-background/95 backdrop-blur-sm px-2 py-1 sm:hidden safe-area-bottom",role:"navigation","aria-label":"Mobile navigation",children:r.map(o=>{const s=Ie(o.icon);let i="#";o.type==="object"?(i=`${t}/${o.objectName}`,o.viewName&&(i+=`/view/${o.viewName}`)):o.type==="dashboard"?i=o.dashboardName?`${t}/dashboard/${o.dashboardName}`:"#":o.type==="page"?i=o.pageName?`${t}/page/${o.pageName}`:"#":o.type==="report"?i=o.reportName?`${t}/report/${o.reportName}`:"#":o.type==="url"&&(i=o.url??"#");const a=i!=="#"&&n.pathname.startsWith(i);return c.jsxs(Ce.Link,{to:i,className:`flex flex-col items-center gap-0.5 px-2 py-1.5 transition-colors min-w-[44px] min-h-[44px] justify-center ${a?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c.jsx(s,{className:"h-5 w-5"}),c.jsx("span",{className:"text-[10px] truncate max-w-[60px]",children:ae(o.label)})]},o.id)})})}function Yo({schema:e,basePath:t,evalVis:n,checkPerm:r,onAction:o,sidebarHeader:s,sidebarFooter:i,sidebarExtra:a,activeAreaId:u,setActiveAreaId:d,resolvedNavigation:g,enableSearch:h,enablePinning:b,onPinToggle:p,enableReorder:S,onReorder:x}){const m=Ie(e.logo),C=e.areas??[],[D,E]=l.useState("");return c.jsxs(v.Sidebar,{collapsible:"icon",children:[c.jsxs(v.SidebarHeader,{children:[s??c.jsx(v.SidebarMenu,{children:c.jsx(v.SidebarMenuItem,{children:c.jsxs(v.SidebarMenuButton,{size:"lg",tooltip:e.title??e.name,children:[c.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground",children:e.logo&&e.logo.startsWith("http")?c.jsx("img",{src:e.logo,alt:e.title??"",className:"size-6 object-contain"}):c.jsx(m,{className:"size-4"})}),c.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[c.jsx("span",{className:"truncate font-semibold",children:e.title??e.name??"App"}),e.description&&c.jsx("span",{className:"truncate text-xs text-muted-foreground",children:e.description})]})]})})}),h&&c.jsx(v.SidebarInput,{placeholder:"Search navigation…",value:D,onChange:N=>E(N.target.value),"aria-label":"Search navigation"})]}),c.jsxs(v.SidebarContent,{children:[C.length>1&&u&&c.jsx(Bo,{areas:C,activeAreaId:u,onAreaChange:d,evalVis:n,checkPerm:r}),c.jsx(_t,{items:g,basePath:t,evaluateVisibility:n,checkPermission:r,onAction:o,searchQuery:D,enablePinning:b,onPinToggle:p,enableReorder:S,onReorder:x}),a]}),i&&c.jsx(v.SidebarFooter,{children:i})]})}function An({schema:e,basePath:t="",mobileNavMode:n="drawer",evaluateVisibility:r,checkPermission:o,onAction:s,navbar:i,sidebarHeader:a,sidebarFooter:u,sidebarExtra:d,children:g,className:h,defaultOpen:b=!0,enableSearch:p,enablePinning:S,onPinToggle:x,enableReorder:m,onReorder:C}){const D=r??(B=>!(B===!1||B==="false")),E=o??(()=>!0),N=l.useMemo(()=>(e.menu??[]).map((B,le)=>$n.menuItemToNavigationItem(B,le)),[e.menu]),M=e.navigation??N,I=e.areas??[],[y,j]=l.useState(()=>I.length>0?I[0].id:null),A=I.map(B=>B.id).join(",");l.useEffect(()=>{I.length>0?j(B=>I.some(le=>le.id===B)?B:I[0].id):j(null)},[e.name,A]);const T=I.find(B=>B.id===y)?.navigation??M,Y={title:e.title,favicon:e.favicon,logo:e.logo},z=c.jsx(Yo,{schema:e,basePath:t,evalVis:D,checkPerm:E,onAction:s,sidebarHeader:a,sidebarFooter:u,sidebarExtra:d,activeAreaId:y,setActiveAreaId:j,resolvedNavigation:T,enableSearch:p,enablePinning:S,onPinToggle:x,enableReorder:m,onReorder:C}),W=n==="bottom_nav";return c.jsxs(c.Fragment,{children:[c.jsx(pt,{sidebar:z,navbar:i,className:h,defaultOpen:b,branding:Y,children:g}),W&&c.jsx(Fo,{items:T,basePath:t})]})}const Go=e=>e?Array.isArray(e)?e:[e]:[];function Vo({schema:e,className:t,style:n,id:r,...o}){const s=Go(e.children);return c.jsxs("div",{id:r||e.id,className:v.cn("flex flex-col h-full space-y-4",t),style:n,children:[c.jsx(tt,{title:e.title,description:e.description}),c.jsx("div",{className:"flex-1 overflow-auto",children:s.map((i,a)=>c.jsx(zn.SchemaRenderer,{schema:i,...o},i?.id||a))})]})}function Uo(e){return"items"in e&&!("href"in e)}function Wo({item:e,pathname:t}){return e.children&&e.children.length>0?c.jsx(v.Collapsible,{asChild:!0,defaultOpen:!0,className:"group/collapsible",children:c.jsxs(v.SidebarMenuItem,{children:[c.jsx(v.CollapsibleTrigger,{asChild:!0,children:c.jsxs(v.SidebarMenuButton,{tooltip:e.title,children:[e.icon&&c.jsx(e.icon,{}),c.jsx("span",{children:e.title}),e.badge!=null&&c.jsx(v.Badge,{variant:e.badgeVariant||"default",className:"ml-auto mr-1 h-5 min-w-5 px-1 text-xs",children:e.badge}),c.jsx(gt.ChevronRight,{className:"ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"})]})}),c.jsx(v.CollapsibleContent,{children:c.jsx(v.SidebarMenuSub,{children:e.children.map(n=>c.jsx(v.SidebarMenuSubItem,{children:c.jsx(v.SidebarMenuSubButton,{asChild:!0,isActive:t===n.href,children:c.jsxs(Ce.NavLink,{to:n.href,children:[n.icon&&c.jsx(n.icon,{}),c.jsx("span",{children:n.title}),n.badge!=null&&c.jsx(v.Badge,{variant:n.badgeVariant||"default",className:"ml-auto h-5 min-w-5 px-1 text-xs",children:n.badge})]})})},n.href))})})]})}):c.jsx(v.SidebarMenuItem,{children:c.jsx(v.SidebarMenuButton,{asChild:!0,isActive:t===e.href,tooltip:e.title,children:c.jsxs(Ce.NavLink,{to:e.href,children:[e.icon&&c.jsx(e.icon,{}),c.jsx("span",{children:e.title}),e.badge!=null&&c.jsx(v.Badge,{variant:e.badgeVariant||"default",className:"ml-auto h-5 min-w-5 px-1 text-xs",children:e.badge})]})})})}function qo({items:e,title:t="Application",className:n,collapsible:r="icon",searchEnabled:o=!1,searchPlaceholder:s="Search..."}){const i=Ce.useLocation(),[a,u]=l.useState(""),d=l.useMemo(()=>e.length===0?[]:Uo(e[0])?e.map(h=>({groupLabel:h.label,items:h.items})):[{items:e}],[e]),g=l.useMemo(()=>{if(!a)return d;const h=a.toLowerCase();return d.map(b=>({...b,items:b.items.filter(p=>p.title.toLowerCase().includes(h)||p.children?.some(S=>S.title.toLowerCase().includes(h)))})).filter(b=>b.items.length>0)},[d,a]);return c.jsx(v.Sidebar,{className:n,collapsible:r,children:c.jsxs(v.SidebarContent,{children:[o&&c.jsx("div",{className:"px-3 py-2",children:c.jsxs("div",{className:"relative",children:[c.jsx(gt.Search,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),c.jsx(v.Input,{type:"search",placeholder:s,value:a,onChange:h=>u(h.target.value),className:"pl-8 h-9"})]})}),g.map((h,b)=>c.jsxs(v.SidebarGroup,{children:[c.jsx(v.SidebarGroupLabel,{children:h.groupLabel||t}),c.jsx(v.SidebarGroupContent,{children:c.jsx(v.SidebarMenu,{children:h.items.map(p=>c.jsx(Wo,{item:p,pathname:i.pathname},p.href))})})]},h.groupLabel||b))]})})}function In(){se.ComponentRegistry.register("page-header",tt,{namespace:"layout",label:"Page Header",category:"Layout",inputs:[{name:"title",type:"string"},{name:"description",type:"string"}]}),se.ComponentRegistry.register("page:header",tt,{namespace:"layout"}),se.ComponentRegistry.register("page:card",Wt,{namespace:"layout",label:"Page Card",category:"Layout",isContainer:!0}),se.ComponentRegistry.register("app-shell",pt,{namespace:"layout",label:"App Shell",category:"Layout"}),se.ComponentRegistry.register("responsive-grid",qt,{namespace:"layout",label:"Responsive Grid",category:"Layout",isContainer:!0,inputs:[{name:"columns",type:"object"},{name:"gap",type:"number"}]}),se.ComponentRegistry.register("navigation-renderer",_t,{namespace:"layout",label:"Navigation Renderer",category:"Layout",inputs:[{name:"items",type:"object"},{name:"basePath",type:"string"}]}),se.ComponentRegistry.register("app-schema-renderer",An,{namespace:"layout",label:"App Schema Renderer",category:"Layout",isContainer:!0,inputs:[{name:"schema",type:"object"},{name:"basePath",type:"string"},{name:"mobileNavMode",type:"string"}]})}try{In()}catch{}P.AppSchemaRenderer=An,P.AppShell=pt,P.NavigationRenderer=_t,P.Page=Vo,P.PageCard=Wt,P.PageHeader=tt,P.ResponsiveGrid=qt,P.SidebarNav=qo,P.filterNavigationItems=Pt,P.registerLayout=In,P.resolveIcon=Ie,P.resolveLabel=ae,P.useAppShellBranding=Ut,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AppSchema, NavigationItem } from '../../types/src';
|
|
3
|
+
import { VisibilityEvaluator, PermissionChecker } from './NavigationRenderer';
|
|
4
|
+
/** Mobile navigation display mode */
|
|
5
|
+
export type MobileNavMode = 'drawer' | 'bottom_nav' | 'hamburger';
|
|
6
|
+
export interface AppSchemaRendererProps {
|
|
7
|
+
/** The AppSchema JSON to render */
|
|
8
|
+
schema: AppSchema;
|
|
9
|
+
/** Base URL prefix for generated hrefs (e.g. "/apps/crm") */
|
|
10
|
+
basePath?: string;
|
|
11
|
+
/** Mobile navigation mode @default "drawer" */
|
|
12
|
+
mobileNavMode?: MobileNavMode;
|
|
13
|
+
/** Optional visibility evaluator passed to NavigationRenderer */
|
|
14
|
+
evaluateVisibility?: VisibilityEvaluator;
|
|
15
|
+
/** Optional permission checker passed to NavigationRenderer */
|
|
16
|
+
checkPermission?: PermissionChecker;
|
|
17
|
+
/** Called when an action-type navigation item is clicked */
|
|
18
|
+
onAction?: (item: NavigationItem) => void;
|
|
19
|
+
/** Slot: top navbar content (rendered beside the sidebar trigger) */
|
|
20
|
+
navbar?: React.ReactNode;
|
|
21
|
+
/** Slot: sidebar header (e.g. app switcher dropdown). Replaces default branding header when provided. */
|
|
22
|
+
sidebarHeader?: React.ReactNode;
|
|
23
|
+
/** Slot: sidebar footer (e.g. user profile menu) */
|
|
24
|
+
sidebarFooter?: React.ReactNode;
|
|
25
|
+
/** Slot: extra sidebar content rendered after navigation (e.g. favorites, recent items) */
|
|
26
|
+
sidebarExtra?: React.ReactNode;
|
|
27
|
+
/** Page content */
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
/** Extra class on the <main> content area */
|
|
30
|
+
className?: string;
|
|
31
|
+
/** Whether the sidebar starts open @default true */
|
|
32
|
+
defaultOpen?: boolean;
|
|
33
|
+
/** Show a search input in the sidebar to filter navigation items */
|
|
34
|
+
enableSearch?: boolean;
|
|
35
|
+
/** Enable pin/favorite toggle on navigation items */
|
|
36
|
+
enablePinning?: boolean;
|
|
37
|
+
/** Called when a navigation item is pinned or unpinned */
|
|
38
|
+
onPinToggle?: (itemId: string, pinned: boolean) => void;
|
|
39
|
+
/** Enable drag-to-reorder for navigation items */
|
|
40
|
+
enableReorder?: boolean;
|
|
41
|
+
/** Called when navigation items are reordered via drag */
|
|
42
|
+
onReorder?: (reorderedItems: NavigationItem[]) => void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Renders a complete application shell from an `AppSchema` JSON document.
|
|
46
|
+
*
|
|
47
|
+
* Responsibilities:
|
|
48
|
+
* - Reads `name`, `title`, `description`, `logo`, `favicon` for branding
|
|
49
|
+
* - Renders sidebar navigation from `navigation` or `areas[].navigation`
|
|
50
|
+
* - Area switcher when multiple `areas` are defined
|
|
51
|
+
* - Mobile modes: `drawer` (sheet overlay, default), `bottom_nav` (fixed
|
|
52
|
+
* bottom bar), `hamburger` (collapsed sidebar)
|
|
53
|
+
* - Evaluates `visible` expressions and `requiredPermissions` on every item
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* <AppSchemaRenderer
|
|
58
|
+
* schema={appJson}
|
|
59
|
+
* basePath="/apps/sales"
|
|
60
|
+
* mobileNavMode="bottom_nav"
|
|
61
|
+
* evaluateVisibility={(expr) => evaluateVisibility(expr, evaluator)}
|
|
62
|
+
* checkPermission={(perms) => perms.every(p => can(p))}
|
|
63
|
+
* >
|
|
64
|
+
* <Outlet />
|
|
65
|
+
* </AppSchemaRenderer>
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare function AppSchemaRenderer({ schema, basePath, mobileNavMode, evaluateVisibility: evalVisProp, checkPermission: checkPermProp, onAction, navbar, sidebarHeader, sidebarFooter, sidebarExtra, children, className, defaultOpen, enableSearch, enablePinning, onPinToggle, enableReorder, onReorder, }: AppSchemaRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { NavigationItem } from '../../types/src';
|
|
3
|
+
/**
|
|
4
|
+
* Callback to evaluate a visibility expression.
|
|
5
|
+
* Return `true` if the item should be visible.
|
|
6
|
+
* When not provided, all items default to visible.
|
|
7
|
+
*/
|
|
8
|
+
export type VisibilityEvaluator = (expression: string | boolean | undefined) => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Callback to check whether the current user satisfies **all** of the
|
|
11
|
+
* given permission strings. Each string is opaque — the consumer decides
|
|
12
|
+
* the format (e.g. `"object:action"` or a named role).
|
|
13
|
+
* When not provided, all items default to permitted.
|
|
14
|
+
*/
|
|
15
|
+
export type PermissionChecker = (permissions: string[]) => boolean;
|
|
16
|
+
export interface NavigationRendererProps {
|
|
17
|
+
/** Navigation items to render */
|
|
18
|
+
items: NavigationItem[];
|
|
19
|
+
/**
|
|
20
|
+
* Base URL prefix prepended to generated hrefs.
|
|
21
|
+
* @example "/apps/crm"
|
|
22
|
+
*/
|
|
23
|
+
basePath?: string;
|
|
24
|
+
/** Optional visibility evaluator for `visible` expressions */
|
|
25
|
+
evaluateVisibility?: VisibilityEvaluator;
|
|
26
|
+
/** Optional permission checker for `requiredPermissions` */
|
|
27
|
+
checkPermission?: PermissionChecker;
|
|
28
|
+
/** Called when an `action`-type item is clicked */
|
|
29
|
+
onAction?: (item: NavigationItem) => void;
|
|
30
|
+
/** Search query to filter navigation items by label */
|
|
31
|
+
searchQuery?: string;
|
|
32
|
+
/** Enable pin/favorite toggle on navigation items */
|
|
33
|
+
enablePinning?: boolean;
|
|
34
|
+
/** Called when a navigation item is pinned or unpinned */
|
|
35
|
+
onPinToggle?: (itemId: string, pinned: boolean) => void;
|
|
36
|
+
/** Enable drag-to-reorder for navigation items */
|
|
37
|
+
enableReorder?: boolean;
|
|
38
|
+
/** Called when navigation items are reordered via drag */
|
|
39
|
+
onReorder?: (reorderedItems: NavigationItem[]) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Optional label resolver for object-type navigation items.
|
|
42
|
+
* When provided, called with `(objectName, fallbackLabel)` for items
|
|
43
|
+
* where `item.type === 'object'` and `item.label` is a plain string.
|
|
44
|
+
* Enables convention-based i18n auto-resolution without coupling
|
|
45
|
+
* the layout package to i18n.
|
|
46
|
+
*/
|
|
47
|
+
resolveObjectLabel?: (objectName: string, fallbackLabel: string) => string;
|
|
48
|
+
/**
|
|
49
|
+
* Optional i18n translation function for resolving I18nLabel objects
|
|
50
|
+
* (`{ key, defaultValue }`). When provided, labels are translated
|
|
51
|
+
* through i18next; otherwise falls back to `defaultValue`.
|
|
52
|
+
*/
|
|
53
|
+
t?: (key: string, options?: any) => string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Resolve a Lucide icon component by name string.
|
|
57
|
+
* Supports PascalCase, camelCase, and kebab-case.
|
|
58
|
+
*/
|
|
59
|
+
export declare function resolveIcon(name?: string): React.ComponentType<any>;
|
|
60
|
+
/**
|
|
61
|
+
* Resolve a NavigationItem label to a plain string.
|
|
62
|
+
* Handles both plain strings and I18nLabel objects { key, defaultValue }.
|
|
63
|
+
* When a `t` function is provided, I18nLabel objects are translated via i18next.
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveLabel(label: string | {
|
|
66
|
+
key: string;
|
|
67
|
+
defaultValue?: string;
|
|
68
|
+
params?: Record<string, any>;
|
|
69
|
+
}, t?: (key: string, options?: any) => string): string;
|
|
70
|
+
/**
|
|
71
|
+
* Recursively filter navigation items by search query (case-insensitive label match).
|
|
72
|
+
* Groups are kept if any child matches, with non-matching children pruned.
|
|
73
|
+
*/
|
|
74
|
+
export declare function filterNavigationItems(items: NavigationItem[], query: string): NavigationItem[];
|
|
75
|
+
/**
|
|
76
|
+
* Renders a `NavigationItem[]` tree into Shadcn Sidebar components.
|
|
77
|
+
*
|
|
78
|
+
* Features:
|
|
79
|
+
* - 7 navigation item types + separators
|
|
80
|
+
* - Nested collapsible groups
|
|
81
|
+
* - Badge indicators
|
|
82
|
+
* - Visibility expression evaluation
|
|
83
|
+
* - RBAC permission guards
|
|
84
|
+
* - Active-route highlighting
|
|
85
|
+
* - Search filtering across navigation tree
|
|
86
|
+
* - Pin/favorite items with dedicated "Favorites" section
|
|
87
|
+
* - Drag-to-reorder navigation items
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```tsx
|
|
91
|
+
* <NavigationRenderer
|
|
92
|
+
* items={appSchema.navigation}
|
|
93
|
+
* basePath="/apps/crm"
|
|
94
|
+
* evaluateVisibility={(expr) => evaluateVisibility(expr, evaluator)}
|
|
95
|
+
* checkPermission={(perms) => perms.every(p => can(p))}
|
|
96
|
+
* searchQuery={searchTerm}
|
|
97
|
+
* enablePinning
|
|
98
|
+
* onPinToggle={(id, pinned) => updatePin(id, pinned)}
|
|
99
|
+
* enableReorder
|
|
100
|
+
* onReorder={(items) => saveOrder(items)}
|
|
101
|
+
* />
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare function NavigationRenderer({ items, basePath, evaluateVisibility: evalVis, checkPermission: checkPerm, onAction, searchQuery, enablePinning, onPinToggle, enableReorder, onReorder, resolveObjectLabel, t: tProp, }: NavigationRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,11 +5,20 @@ export interface NavItem {
|
|
|
5
5
|
icon?: React.ComponentType<{
|
|
6
6
|
className?: string;
|
|
7
7
|
}>;
|
|
8
|
+
badge?: string | number;
|
|
9
|
+
badgeVariant?: 'default' | 'destructive' | 'outline';
|
|
10
|
+
children?: NavItem[];
|
|
8
11
|
}
|
|
9
|
-
export interface
|
|
12
|
+
export interface NavGroup {
|
|
13
|
+
label: string;
|
|
10
14
|
items: NavItem[];
|
|
15
|
+
}
|
|
16
|
+
export interface SidebarNavProps {
|
|
17
|
+
items: NavItem[] | NavGroup[];
|
|
11
18
|
title?: string;
|
|
12
19
|
className?: string;
|
|
13
20
|
collapsible?: "offcanvas" | "icon" | "none";
|
|
21
|
+
searchEnabled?: boolean;
|
|
22
|
+
searchPlaceholder?: string;
|
|
14
23
|
}
|
|
15
|
-
export declare function SidebarNav({ items, title, className, collapsible }: SidebarNavProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare function SidebarNav({ items, title, className, collapsible, searchEnabled, searchPlaceholder }: SidebarNavProps): import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/layout",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/index.umd.cjs",
|
|
@@ -14,15 +14,18 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
+
"@dnd-kit/core": "^6.3.1",
|
|
18
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
19
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
17
20
|
"clsx": "^2.1.1",
|
|
18
|
-
"lucide-react": "^0.
|
|
21
|
+
"lucide-react": "^0.576.0",
|
|
19
22
|
"react": "19.2.4",
|
|
20
23
|
"react-dom": "19.2.4",
|
|
21
|
-
"tailwind-merge": "^
|
|
22
|
-
"@object-ui/components": "3.0
|
|
23
|
-
"@object-ui/core": "3.0
|
|
24
|
-
"@object-ui/react": "3.0
|
|
25
|
-
"@object-ui/types": "3.0
|
|
24
|
+
"tailwind-merge": "^3.5.0",
|
|
25
|
+
"@object-ui/components": "3.1.0",
|
|
26
|
+
"@object-ui/core": "3.1.0",
|
|
27
|
+
"@object-ui/react": "3.1.0",
|
|
28
|
+
"@object-ui/types": "3.1.0"
|
|
26
29
|
},
|
|
27
30
|
"peerDependencies": {
|
|
28
31
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -31,7 +34,7 @@
|
|
|
31
34
|
},
|
|
32
35
|
"devDependencies": {
|
|
33
36
|
"@vitejs/plugin-react": "^5.1.4",
|
|
34
|
-
"react-router-dom": "^7.13.
|
|
37
|
+
"react-router-dom": "^7.13.1",
|
|
35
38
|
"vite": "^7.3.1",
|
|
36
39
|
"vite-plugin-dts": "^4.5.4"
|
|
37
40
|
},
|