@principal-ade/panels 1.0.51 → 1.0.52
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/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/panels.css +1 -1
- package/dist/utils/themeMapping.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import r,{useState as o,useRef as i,useCallback as a,useEffect as l,forwardRef as s,useImperativeHandle as c,useMemo as d,useLayoutEffect as u,createContext as p,memo as h,useReducer as m,useContext as f}from"react";import{PanelGroup as g,Panel as v,PanelResizeHandle as b}from"react-resizable-panels";import{flushSync as y,unstable_batchedUpdates as w,createPortal as x}from"react-dom";function C(e){return{"--panel-background":e.colors.background,"--panel-border":e.colors.border,"--panel-handle":e.colors.backgroundSecondary,"--panel-handle-hover":e.colors.backgroundHover,"--panel-handle-active":e.colors.primary,"--panel-button-bg":e.colors.surface,"--panel-button-hover":e.colors.backgroundHover,"--panel-button-border":e.colors.border,"--panel-button-icon":e.colors.textSecondary,"--panel-accent-bg":e.colors.primary+"15"}}function S(e){return{"--tab-list-bg":e.colors.backgroundSecondary,"--tab-border":e.colors.border,"--tab-bg":e.colors.surface,"--tab-bg-hover":e.colors.backgroundHover,"--tab-bg-active":e.colors.primary,"--tab-text":e.colors.textSecondary,"--tab-text-hover":e.colors.text,"--tab-text-active":e.colors.
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import r,{useState as o,useRef as i,useCallback as a,useEffect as l,forwardRef as s,useImperativeHandle as c,useMemo as d,useLayoutEffect as u,createContext as p,memo as h,useReducer as m,useContext as f}from"react";import{PanelGroup as g,Panel as v,PanelResizeHandle as b}from"react-resizable-panels";import{flushSync as y,unstable_batchedUpdates as w,createPortal as x}from"react-dom";function C(e){return{"--panel-background":e.colors.background,"--panel-border":e.colors.border,"--panel-handle":e.colors.backgroundSecondary,"--panel-handle-hover":e.colors.backgroundHover,"--panel-handle-active":e.colors.primary,"--panel-button-bg":e.colors.surface,"--panel-button-hover":e.colors.backgroundHover,"--panel-button-border":e.colors.border,"--panel-button-icon":e.colors.textSecondary,"--panel-accent-bg":e.colors.primary+"15"}}function S(e){return{"--tab-list-bg":e.colors.backgroundSecondary,"--tab-border":e.colors.border,"--tab-bg":e.colors.surface,"--tab-bg-hover":e.colors.backgroundHover,"--tab-bg-active":e.colors.primary,"--tab-text":e.colors.textSecondary,"--tab-text-hover":e.colors.text,"--tab-text-active":e.colors.background,"--tab-icon-color":e.colors.textTertiary,"--tab-icon-active":e.colors.background,"--tab-border-hover":e.colors.textSecondary,"--tab-border-active":e.colors.primary,"--tab-focus":e.colors.primary,"--tab-content-bg":e.colors.background,"--tab-empty-text":e.colors.textMuted,"--tab-font-family":e.fonts.body,"--tab-font-size":"11px","--tab-font-weight":String(e.fontWeights.medium),"--mobile-tab-text-active":e.colors.primary,"--mobile-tab-icon-active":e.colors.primary}}const R=({leftPanel:n,rightPanel:r,collapsibleSide:s="left",defaultSize:c=25,minSize:d=5,className:u="",collapsed:p=!1,style:h,showCollapseButton:m=!1,animationDuration:f=300,animationEasing:y="cubic-bezier(0.4, 0, 0.2, 1)",onCollapseStart:w,onCollapseComplete:x,onExpandStart:S,onExpandComplete:R,theme:N})=>{const[E,D]=o(p),[z,M]=o(!1),[T,A]=o(!1),[k,L]=o(p),[P,F]=o(p?0:c),$=i(null),B=i(void 0),O=i(void 0),I=i(void 0),q=a((e,t,n)=>{if(!$.current)return;B.current&&cancelAnimationFrame(B.current),O.current=performance.now();const r=o=>{if(!O.current||!$.current)return;const i=o-O.current,a=Math.min(i/f,1),l=a<.5?4*a*a*a:1-Math.pow(-2*a+2,3)/2,s=e+(t-e)*l;$.current.resize(s),a<1?B.current=requestAnimationFrame(r):(0===t?$.current.collapse():$.current.resize(t),M(!1),n&&n())};B.current=requestAnimationFrame(r)},[f]),W=a(()=>{z||T||(M(!0),D(!0),w&&w(),q(P,0,()=>{F(0),L(!0),x&&x()}))},[z,T,P,q,w,x]),_=a(()=>{z||T||(M(!0),D(!1),L(!1),S&&S(),q(0,c,()=>{F(c),R&&R()}))},[z,T,c,q,S,R]),j=a(()=>{E?_():W()},[E,W,_]),H=a(e=>{z||(F(e),e>0&&D(!1))},[z]),K=a(()=>{A(!0)},[]),U=a(()=>{A(!1)},[]);l(()=>{p!==E&&(p?W():_())},[p]),l(()=>{p&&!z?L(!0):p||z||L(!1)},[p,z]),l(()=>{const e=B.current,t=I.current;return()=>{e&&cancelAnimationFrame(e),t&&clearTimeout(t)}},[]);const X="left"===s,Y=E?X?"▸":"◂":X?"◂":"▸",V=C(N),J=z&&!T?{transition:`flex ${f}ms ${y}`}:void 0,G=e=>{let t="hybrid-panel";return e&&(t+=" collapsible-panel",z&&!T&&(t+=" animating"),E&&(t+=" collapsed")),t};/* @__PURE__ */
|
|
2
2
|
return e("div",{className:`animated-resizable-layout ${u}`,style:{...V,...h},children:/* @__PURE__ */t(g,{direction:"horizontal",onLayout:U,children:[
|
|
3
3
|
/* @__PURE__ */e(v,{ref:X?$:void 0,collapsible:X,defaultSize:X?p?0:c:void 0,minSize:X?d:30,collapsedSize:0,onResize:X?H:void 0,onCollapse:X?()=>D(!0):void 0,onExpand:X?()=>D(!1):void 0,className:G(X),style:X?J:void 0,children:/* @__PURE__ */e("div",{className:"panel-content-wrapper",style:{opacity:X&&E?0:1,transition:z?`opacity ${.5*f}ms ${y}`:"none"},children:n})}),
|
|
4
4
|
/* @__PURE__ */e(b,{className:"resize-handle "+(k?"collapsed":""),onDragging:K,style:k?{visibility:"hidden",width:0}:void 0,children:m&&/* @__PURE__ */e("div",{className:"handle-bar",children:/* @__PURE__ */e("button",{onClick:j,className:"collapse-toggle",disabled:z,"aria-label":E?"Expand panel":"Collapse panel",children:Y})})}),
|