@amboss/design-system 4.6.7-canary.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/build/cjs/components/Internal/Panel/Panel.d.ts +3 -7
  2. package/build/cjs/components/Internal/Panel/Panel.js +1 -1
  3. package/build/cjs/components/Internal/PanelHeader/PanelHeader.d.ts +4 -8
  4. package/build/cjs/components/Internal/PanelHeader/PanelHeader.js +1 -1
  5. package/build/cjs/components/Internal/Sandwich/-types.d.ts +0 -5
  6. package/build/cjs/components/Internal/Sandwich/Sandwich.d.ts +1 -1
  7. package/build/cjs/components/Internal/Sandwich/Sandwich.js +1 -1
  8. package/build/cjs/components/Layout/-types.d.ts +8 -64
  9. package/build/cjs/components/Layout/Layout.d.ts +0 -4
  10. package/build/cjs/components/Layout/Layout.js +1 -1
  11. package/build/cjs/components/Layout/LeftPanel/LeftPanel.js +1 -1
  12. package/build/cjs/components/Layout/LeftPanel/LeftPanelDocked.d.ts +5 -15
  13. package/build/cjs/components/Layout/LeftPanel/LeftPanelDocked.js +1 -1
  14. package/build/cjs/components/Layout/LeftPanel/LeftPanelDrawer.js +1 -1
  15. package/build/cjs/components/Layout/LeftPanel/LeftPanelFooter.js +1 -1
  16. package/build/cjs/components/Layout/LeftPanel/LeftPanelHeader.d.ts +3 -5
  17. package/build/cjs/components/Layout/LeftPanel/LeftPanelHeader.js +1 -1
  18. package/build/cjs/components/Layout/PanelSlideBody.d.ts +18 -0
  19. package/build/cjs/components/Layout/PanelSlideBody.js +1 -0
  20. package/build/cjs/components/Layout/registry.d.ts +0 -11
  21. package/build/cjs/components/Layout/registry.js +1 -1
  22. package/build/cjs/components/Layout/rules.js +1 -1
  23. package/build/cjs/components/Layout/useLayoutRules.js +1 -1
  24. package/build/cjs/components/Layout/usePanelDockedSlide.d.ts +5 -10
  25. package/build/cjs/components/Layout/usePanelDockedSlide.js +1 -1
  26. package/build/cjs/shared/mixins/index.d.ts +0 -1
  27. package/build/cjs/shared/mixins/index.js +1 -1
  28. package/build/cjs/web-tokens/_sizes.json +54 -64
  29. package/build/cjs/web-tokens/visualConfig.d.ts +0 -7
  30. package/build/cjs/web-tokens/visualConfig.js +1 -1
  31. package/build/esm/components/Internal/Panel/Panel.d.ts +3 -7
  32. package/build/esm/components/Internal/Panel/Panel.js +1 -1
  33. package/build/esm/components/Internal/PanelHeader/PanelHeader.d.ts +4 -8
  34. package/build/esm/components/Internal/PanelHeader/PanelHeader.js +1 -1
  35. package/build/esm/components/Internal/Sandwich/-types.d.ts +0 -5
  36. package/build/esm/components/Internal/Sandwich/Sandwich.d.ts +1 -1
  37. package/build/esm/components/Internal/Sandwich/Sandwich.js +1 -1
  38. package/build/esm/components/Layout/-types.d.ts +8 -64
  39. package/build/esm/components/Layout/Layout.d.ts +0 -4
  40. package/build/esm/components/Layout/Layout.js +1 -1
  41. package/build/esm/components/Layout/LeftPanel/LeftPanel.js +1 -1
  42. package/build/esm/components/Layout/LeftPanel/LeftPanelDocked.d.ts +5 -15
  43. package/build/esm/components/Layout/LeftPanel/LeftPanelDocked.js +1 -1
  44. package/build/esm/components/Layout/LeftPanel/LeftPanelDrawer.js +1 -1
  45. package/build/esm/components/Layout/LeftPanel/LeftPanelFooter.js +1 -1
  46. package/build/esm/components/Layout/LeftPanel/LeftPanelHeader.d.ts +3 -5
  47. package/build/esm/components/Layout/LeftPanel/LeftPanelHeader.js +1 -1
  48. package/build/esm/components/Layout/PanelSlideBody.d.ts +18 -0
  49. package/build/esm/components/Layout/PanelSlideBody.js +1 -0
  50. package/build/esm/components/Layout/registry.d.ts +0 -11
  51. package/build/esm/components/Layout/registry.js +1 -1
  52. package/build/esm/components/Layout/rules.js +1 -1
  53. package/build/esm/components/Layout/useLayoutRules.js +1 -1
  54. package/build/esm/components/Layout/usePanelDockedSlide.d.ts +5 -10
  55. package/build/esm/components/Layout/usePanelDockedSlide.js +1 -1
  56. package/build/esm/shared/mixins/index.d.ts +0 -1
  57. package/build/esm/shared/mixins/index.js +1 -1
  58. package/build/esm/web-tokens/_sizes.json +54 -64
  59. package/build/esm/web-tokens/visualConfig.d.ts +0 -7
  60. package/build/esm/web-tokens/visualConfig.js +1 -1
  61. package/build/fonts/fontStylesheet.d.ts +4 -0
  62. package/build/fonts/fontStylesheet.js +2 -0
  63. package/build/scss/_variables.scss +0 -3
  64. package/package.json +8 -2
  65. package/build/cjs/components/Layout/LeftNavBar/LeftNavBar.d.ts +0 -17
  66. package/build/cjs/components/Layout/LeftNavBar/LeftNavBar.js +0 -1
  67. package/build/cjs/components/Layout/LeftNavBar/LeftNavBarFooter.d.ts +0 -7
  68. package/build/cjs/components/Layout/LeftNavBar/LeftNavBarFooter.js +0 -1
  69. package/build/cjs/components/Layout/LeftPanel/LeftBarLayers.d.ts +0 -45
  70. package/build/cjs/components/Layout/LeftPanel/LeftBarLayers.js +0 -1
  71. package/build/cjs/components/Layout/LeftPanel/LeftBarToggle.d.ts +0 -15
  72. package/build/cjs/components/Layout/LeftPanel/LeftBarToggle.js +0 -1
  73. package/build/cjs/components/Layout/LeftPanel/LeftPanelOffcanvas.d.ts +0 -29
  74. package/build/cjs/components/Layout/LeftPanel/LeftPanelOffcanvas.js +0 -1
  75. package/build/cjs/components/Layout/LeftPanel/useLeftBarContext.d.ts +0 -11
  76. package/build/cjs/components/Layout/LeftPanel/useLeftBarContext.js +0 -1
  77. package/build/cjs/components/Layout/LeftPanel/useLeftPanelCollapseContext.d.ts +0 -11
  78. package/build/cjs/components/Layout/LeftPanel/useLeftPanelCollapseContext.js +0 -1
  79. package/build/cjs/components/Layout/useLeftPanelId.d.ts +0 -6
  80. package/build/cjs/components/Layout/useLeftPanelId.js +0 -1
  81. package/build/cjs/shared/mixins/getLeftPanelFadeStyles.d.ts +0 -19
  82. package/build/cjs/shared/mixins/getLeftPanelFadeStyles.js +0 -1
  83. package/build/esm/components/Layout/LeftNavBar/LeftNavBar.d.ts +0 -17
  84. package/build/esm/components/Layout/LeftNavBar/LeftNavBar.js +0 -1
  85. package/build/esm/components/Layout/LeftNavBar/LeftNavBarFooter.d.ts +0 -7
  86. package/build/esm/components/Layout/LeftNavBar/LeftNavBarFooter.js +0 -1
  87. package/build/esm/components/Layout/LeftPanel/LeftBarLayers.d.ts +0 -45
  88. package/build/esm/components/Layout/LeftPanel/LeftBarLayers.js +0 -1
  89. package/build/esm/components/Layout/LeftPanel/LeftBarToggle.d.ts +0 -15
  90. package/build/esm/components/Layout/LeftPanel/LeftBarToggle.js +0 -1
  91. package/build/esm/components/Layout/LeftPanel/LeftPanelOffcanvas.d.ts +0 -29
  92. package/build/esm/components/Layout/LeftPanel/LeftPanelOffcanvas.js +0 -1
  93. package/build/esm/components/Layout/LeftPanel/useLeftBarContext.d.ts +0 -11
  94. package/build/esm/components/Layout/LeftPanel/useLeftBarContext.js +0 -1
  95. package/build/esm/components/Layout/LeftPanel/useLeftPanelCollapseContext.d.ts +0 -11
  96. package/build/esm/components/Layout/LeftPanel/useLeftPanelCollapseContext.js +0 -1
  97. package/build/esm/components/Layout/useLeftPanelId.d.ts +0 -6
  98. package/build/esm/components/Layout/useLeftPanelId.js +0 -1
  99. package/build/esm/shared/mixins/getLeftPanelFadeStyles.d.ts +0 -19
  100. package/build/esm/shared/mixins/getLeftPanelFadeStyles.js +0 -1
@@ -1,15 +1,11 @@
1
1
  import React from "react";
2
- import type { ForwardedScrollProps } from "../-types";
2
+ import type { ForwardedScrollProps, Size } from "../-types";
3
3
  export type LeftPanelDockedProps = ForwardedScrollProps & {
4
4
  children: React.ReactNode;
5
- /** Accessible name for the left bar's open button. */
6
- toggleButtonLabel: string;
7
5
  "aria-label"?: string;
8
- /** Pixel width the column widens to. Resolved by `LeftPanel` from its own
9
- * prop and the provider config, so it is always a width. */
10
- defaultSize: number;
11
- minSize?: number;
12
- maxSize?: number;
6
+ defaultSize?: Size;
7
+ minSize?: Size;
8
+ maxSize?: Size;
13
9
  collapsible?: boolean;
14
10
  resizable?: boolean;
15
11
  };
@@ -17,15 +13,9 @@ export type LeftPanelDockedProps = ForwardedScrollProps & {
17
13
  * Docked (desktop) left panel. Declares the `leftPanel` slot and portals its
18
14
  * content into the Group's host - an in-flow, resizable column whose width
19
15
  * slides open/closed via {@link usePanelDockedSlide} (when collapsible). Content
20
- * lives in {@link LeftBarLayers} so `Layout.LeftPanelHeader` /
16
+ * lives in a {@link PanelContainer} so `Layout.LeftPanelHeader` /
21
17
  * `Layout.LeftPanelFooter` children stick to the edges. The mobile presentation
22
18
  * lives in {@link LeftPanelDrawer}; `LeftPanel` picks between the two by
23
19
  * breakpoint.
24
- *
25
- * The column never leaves the row: it rests at the left bar's width and widens
26
- * to `defaultSize`. Content and footer hold the open width and are clipped, so
27
- * nothing in them moves - the panel simply shows less of itself. The header is
28
- * left to narrow with the column, which walks a control at its trailing edge
29
- * down into the left bar.
30
20
  */
31
21
  export declare const LeftPanelDocked: React.FC<LeftPanelDockedProps>;
@@ -1 +1 @@
1
- import React from"react";import styled from"@emotion/styled";import{useTheme}from"@emotion/react";import{PAGE_BOTTOM_BAR_INSET,Slot}from"../-constants";import{useLayoutPortal}from"../registry";import{usePanelDockedSlide}from"../usePanelDockedSlide";import{LEFT_BAR_TOP_INSET,LeftBarLayers,getLeftBarColumnStyles,getLeftBarTopTransition}from"./LeftBarLayers";import{useLayout}from"../useLayout";let StyledLeftBarColumn=styled("div",{target:"e1apd56i0",label:"StyledLeftBarColumn"})(({theme})=>({position:"absolute",left:0,right:0,top:LEFT_BAR_TOP_INSET,bottom:PAGE_BOTTOM_BAR_INSET,transition:getLeftBarTopTransition(theme),"@media (prefers-reduced-motion: reduce)":{transition:"none"},...getLeftBarColumnStyles(theme)}));export const LeftPanelDocked=({children,toggleButtonLabel,"aria-label":ariaLabel,defaultSize,minSize,maxSize,collapsible=!0,resizable,scrollContainerRef,onScroll})=>{let theme=useTheme(),{isVisible}=useLayout()[Slot.leftPanel];return usePanelDockedSlide({slot:Slot.leftPanel,defaultSize,minSize,maxSize,collapsible,resizable,lockWidthOnWindowResize:!0,collapsedSize:parseFloat(theme.variables.size.dimension.leftNavBar.width)}),useLayoutPortal(Slot.leftPanel,React.createElement(StyledLeftBarColumn,null,React.createElement(LeftBarLayers,{isVisible:isVisible,toggleButtonLabel:toggleButtonLabel,openWidth:`${defaultSize}px`,"aria-label":ariaLabel,scrollContainerRef:scrollContainerRef,onScroll:onScroll},children)))};
1
+ import React from"react";import{Slot}from"../-constants";import{useLayoutPortal}from"../registry";import{usePanelDockedSlide}from"../usePanelDockedSlide";import{PanelSlideBody}from"../PanelSlideBody";import{PanelContainer}from"../PanelContainer";export const LeftPanelDocked=({children,"aria-label":ariaLabel,defaultSize,minSize,maxSize,collapsible=!0,resizable,scrollContainerRef,onScroll})=>{let{isMounted,pinnedWidth}=usePanelDockedSlide({slot:Slot.leftPanel,defaultSize,minSize,maxSize,collapsible,resizable,lockWidthOnWindowResize:!0});return useLayoutPortal(Slot.leftPanel,isMounted?React.createElement(PanelSlideBody,{anchor:"right",pinnedWidth:pinnedWidth},React.createElement(PanelContainer,{showBorderRight:!0,"aria-label":ariaLabel,scrollContainerRef:scrollContainerRef,onScroll:onScroll},children)):null)};
@@ -1 +1 @@
1
- import React from"react";import styled from"@emotion/styled";import{Drawer}from"../../Internal/Drawer/Drawer";import{PanelContainer}from"../PanelContainer";import{useLeftPanelId}from"../useLeftPanelId";let StyledLeftPanelBody=styled("div",{target:"e158aetq0",label:"StyledLeftPanelBody"})({width:"80vw",height:"100dvh"});export const LeftPanelDrawer=({children,isVisible,hide,"aria-label":ariaLabel,scrollContainerRef,onScroll})=>{let leftPanelId=useLeftPanelId();return React.createElement(Drawer,{isVisible:isVisible,positionX:"left",handleClose:hide,"aria-label":ariaLabel},React.createElement(StyledLeftPanelBody,null,React.createElement(PanelContainer,{id:leftPanelId,scrollContainerRef:scrollContainerRef,onScroll:onScroll},children)))};
1
+ import React from"react";import styled from"@emotion/styled";import{Drawer}from"../../Internal/Drawer/Drawer";import{PanelContainer}from"../PanelContainer";let StyledLeftPanelBody=styled("div",{target:"e1pciy730",label:"StyledLeftPanelBody"})({width:"80vw",height:"100dvh"});export const LeftPanelDrawer=({children,isVisible,hide,"aria-label":ariaLabel,scrollContainerRef,onScroll})=>React.createElement(Drawer,{isVisible:isVisible,positionX:"left",handleClose:hide,"aria-label":ariaLabel},React.createElement(StyledLeftPanelBody,null,React.createElement(PanelContainer,{scrollContainerRef:scrollContainerRef,onScroll:onScroll},children)));
@@ -1 +1 @@
1
- import React from"react";import styled from"@emotion/styled";import{getLeftPanelFadeStyles}from"../../../shared/mixins";import{Sandwich}from"../../Internal/Sandwich/Sandwich";import{useLeftPanelCollapseContext}from"./useLeftPanelCollapseContext";let StyledFadingFooter=styled("div",{target:"emmyo1o0",label:"StyledFadingFooter"})(({theme,isFaded,pinnedContentWidth})=>({minWidth:pinnedContentWidth,...getLeftPanelFadeStyles({theme,isFaded})}));export function LeftPanelFooter({children,"data-e2e-test-id":dataE2eTestId}){let{isContentFaded,pinnedContentWidth}=useLeftPanelCollapseContext();return React.createElement(Sandwich.Footer,{"data-e2e-test-id":dataE2eTestId},React.createElement(StyledFadingFooter,{isFaded:isContentFaded,pinnedContentWidth:pinnedContentWidth},children))}
1
+ import React from"react";import{Sandwich}from"../../Internal/Sandwich/Sandwich";export function LeftPanelFooter({children,"data-e2e-test-id":dataE2eTestId}){return React.createElement(Sandwich.Footer,{"data-e2e-test-id":dataE2eTestId},children)}
@@ -1,9 +1,7 @@
1
1
  import React from "react";
2
2
  import type { LeftPanelHeaderProps } from "../-types";
3
3
  /**
4
- * Header for the left panel. Place among `Layout.LeftPanel`'s children; it
5
- * sticks to the top while the rest of the content scrolls. Content is a left
6
- * slot, an optional title, a right slot, and beneath them whatever is passed as
7
- * `children`.
4
+ * Optional sticky header for `Layout.LeftPanel` - place it among the panel's
5
+ * children; it sticks to the top while the rest of the content scrolls.
8
6
  */
9
- export declare function LeftPanelHeader({ leftSlot, title, rightSlot, children, "data-e2e-test-id": dataE2eTestId, }: LeftPanelHeaderProps): React.ReactElement;
7
+ export declare function LeftPanelHeader({ leftSlot, rightSlot, "data-e2e-test-id": dataE2eTestId, }: LeftPanelHeaderProps): React.ReactElement;
@@ -1 +1 @@
1
- import React from"react";import styled from"@emotion/styled";import{getLeftPanelFadeStyles}from"../../../shared/mixins/getLeftPanelFadeStyles";import{Sandwich}from"../../Internal/Sandwich/Sandwich";import{PanelHeader}from"../../Internal/PanelHeader/PanelHeader";import{useLeftPanelCollapseContext}from"./useLeftPanelCollapseContext";let StyledHeaderStrip=styled("div",{target:"e1asip2n0",label:"StyledHeaderStrip"})(({theme,isFaded,pinnedContentWidth})=>({minWidth:pinnedContentWidth,...getLeftPanelFadeStyles({theme,isFaded})}));export function LeftPanelHeader({leftSlot,title,rightSlot,children,"data-e2e-test-id":dataE2eTestId}){let{isContentFaded,pinnedContentWidth}=useLeftPanelCollapseContext();return React.createElement(Sandwich.Header,{"data-e2e-test-id":dataE2eTestId},React.createElement(PanelHeader,{leftSlot:leftSlot,title:title,rightSlot:rightSlot,isContentFaded:isContentFaded}),children&&React.createElement(StyledHeaderStrip,{isFaded:isContentFaded,pinnedContentWidth:pinnedContentWidth},children))}
1
+ import React from"react";import{Sandwich}from"../../Internal/Sandwich/Sandwich";import{PanelHeader}from"../../Internal/PanelHeader/PanelHeader";export function LeftPanelHeader({leftSlot,rightSlot,"data-e2e-test-id":dataE2eTestId}){return React.createElement(Sandwich.Header,{"data-e2e-test-id":dataE2eTestId},React.createElement(PanelHeader,{leftSlot:leftSlot,rightSlot:rightSlot}))}
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ /** Edge the body is pinned to while the column slides - the panel's docked
3
+ * edge (`right` for the left panel, `left` for the right panel). */
4
+ export type PanelSlideAnchor = "left" | "right";
5
+ export type PanelSlideBodyProps = {
6
+ /** Body width (px) while sliding; `null` at rest (fills the column). Comes
7
+ * from {@link usePanelDockedSlide}. */
8
+ pinnedWidth: number | null;
9
+ /** The edge the panel docks against. */
10
+ anchor: PanelSlideAnchor;
11
+ children: React.ReactNode;
12
+ };
13
+ /**
14
+ * The clipped, edge-anchored body a docked side panel's content lives in so
15
+ * its open/close width animation reads as a drawer slide. Pair with
16
+ * {@link usePanelDockedSlide}, which supplies `pinnedWidth`.
17
+ */
18
+ export declare const PanelSlideBody: React.FC<PanelSlideBodyProps>;
@@ -0,0 +1 @@
1
+ import React from"react";import styled from"@emotion/styled";import{PAGE_BOTTOM_BAR_INSET}from"./-constants";let StyledPanelSlideClip=styled("div",{target:"e1mhh3wi0",label:"StyledPanelSlideClip"})({position:"relative",width:"100%",height:`calc(100% - ${PAGE_BOTTOM_BAR_INSET})`,overflow:"hidden"}),StyledPanelSlideBody=styled("div",{shouldForwardProp:prop=>"pinnedWidth"!==prop&&"anchor"!==prop,target:"e1mhh3wi1",label:"StyledPanelSlideBody"})(({pinnedWidth,anchor})=>({width:"100%",height:"100%",...null!=pinnedWidth&&{position:"absolute",top:0,[anchor]:0,width:`${pinnedWidth}px`}}));export const PanelSlideBody=({pinnedWidth,anchor,children})=>React.createElement(StyledPanelSlideClip,null,React.createElement(StyledPanelSlideBody,{pinnedWidth:pinnedWidth,anchor:anchor},children));
@@ -40,17 +40,6 @@ export declare const PanelRegistryContext: React.Context<PanelRegistry>;
40
40
  export declare function useDeclarePanel(slot: SlotKey, reg: PanelReg): void;
41
41
  export type PanelDeclarations = Partial<Record<SlotKey, PanelReg>>;
42
42
  export declare const PanelDeclarationsContext: React.Context<Partial<Record<"content" | "leftPanel" | "splitview" | "rightPanel", PanelReg>>>;
43
- /**
44
- * The ids of the columns in the resizable row, in order, joined with commas.
45
- * Changes when a column joins or leaves the row, and only then. A column that
46
- * has to hold a width of its own across such a change - the left bar column,
47
- * which react-resizable-panels would otherwise put back at whatever width it
48
- * had the last time the same set of columns was on screen - re-checks its rest
49
- * against it.
50
- */
51
- export declare const PanelRowContext: React.Context<string>;
52
- /** The row's current column set, as a stable key. Empty outside a Layout. */
53
- export declare function usePanelRow(): string;
54
43
  /**
55
44
  * Keeps an animating-out panel in the resizable row while its exit plays - the
56
45
  * Group would otherwise drop the column the instant it's hidden. The panel
@@ -1 +1 @@
1
- import{createContext,useContext,useEffect,useLayoutEffect,useRef}from"react";import{createPortal}from"react-dom";import{Slot}from"./-constants";import{useLayoutPanelsEnabled}from"./context";export const LayoutPortalContext=createContext({});export function useLayoutPortal(slot,children){let slotNode=useContext(LayoutPortalContext)[slot]??null;return slotNode?createPortal(children,slotNode):null}export const PanelRegistryContext=createContext(null);export function useDeclarePanel(slot,reg){let registry=useContext(PanelRegistryContext),declarationEnabled=!0===useLayoutPanelsEnabled()||slot===Slot.content,{defaultSize,minSize,maxSize,collapsible,resizable,lockWidthOnWindowResize,variant}=reg;useLayoutEffect(()=>{if(registry&&declarationEnabled)return registry.register(slot,{defaultSize,minSize,maxSize,collapsible,resizable,lockWidthOnWindowResize,variant}),()=>registry.unregister(slot)},[registry,declarationEnabled,slot,defaultSize,minSize,maxSize,collapsible,resizable,lockWidthOnWindowResize,variant])}export const PanelDeclarationsContext=createContext({});export const PanelRowContext=createContext("");export function usePanelRow(){return useContext(PanelRowContext)}export const PanelPresenceContext=createContext(null);export function usePanelPresence(slot,isPresent){let presence=useContext(PanelPresenceContext);useLayoutEffect(()=>{if(presence)return presence.setPresent(slot,isPresent),()=>presence.setPresent(slot,!1)},[presence,slot,isPresent])}export const PanelAnimationContext=createContext(null);export function usePanelAnimationControl(){return useContext(PanelAnimationContext)}export function useRunCallbackOnValueChange(value,onChange){let prev=useRef(value);useEffect(()=>{prev.current!==value&&(prev.current=value,onChange?.(value))},[value,onChange])}export function useVisibleChange(visible,onChange){useRunCallbackOnValueChange(visible,onChange)}
1
+ import{createContext,useContext,useEffect,useLayoutEffect,useRef}from"react";import{createPortal}from"react-dom";import{Slot}from"./-constants";import{useLayoutPanelsEnabled}from"./context";export const LayoutPortalContext=createContext({});export function useLayoutPortal(slot,children){let slotNode=useContext(LayoutPortalContext)[slot]??null;return slotNode?createPortal(children,slotNode):null}export const PanelRegistryContext=createContext(null);export function useDeclarePanel(slot,reg){let registry=useContext(PanelRegistryContext),declarationEnabled=!0===useLayoutPanelsEnabled()||slot===Slot.content,{defaultSize,minSize,maxSize,collapsible,resizable,lockWidthOnWindowResize,variant}=reg;useLayoutEffect(()=>{if(registry&&declarationEnabled)return registry.register(slot,{defaultSize,minSize,maxSize,collapsible,resizable,lockWidthOnWindowResize,variant}),()=>registry.unregister(slot)},[registry,declarationEnabled,slot,defaultSize,minSize,maxSize,collapsible,resizable,lockWidthOnWindowResize,variant])}export const PanelDeclarationsContext=createContext({});export const PanelPresenceContext=createContext(null);export function usePanelPresence(slot,isPresent){let presence=useContext(PanelPresenceContext);useLayoutEffect(()=>{if(presence)return presence.setPresent(slot,isPresent),()=>presence.setPresent(slot,!1)},[presence,slot,isPresent])}export const PanelAnimationContext=createContext(null);export function usePanelAnimationControl(){return useContext(PanelAnimationContext)}export function useRunCallbackOnValueChange(value,onChange){let prev=useRef(value);useEffect(()=>{prev.current!==value&&(prev.current=value,onChange?.(value))},[value,onChange])}export function useVisibleChange(visible,onChange){useRunCallbackOnValueChange(visible,onChange)}
@@ -1 +1 @@
1
- let leftPanelVariantFor=({isMobile,isLowPrio})=>isMobile?"drawer":isLowPrio?"offcanvas":"sidebar";export const DEFAULT_LAYOUT_RULES={maxDockedPanels:{xs:1,m:2,l:3},rightPanel:{priority:1,condition:({isLowPrio,isMobile,layout})=>{isLowPrio&&!isMobile&&layout.rightPanel.setVariant("float")}},splitview:{priority:2,condition:({isLowPrio,isMobile,layout})=>{isLowPrio&&!isMobile&&layout.splitview.hide()}},leftPanel:{priority:3,condition:({isLowPrio,isMobile,layout})=>{let variant=leftPanelVariantFor({isMobile,isLowPrio});variant!==layout.leftPanel.state.variant&&(layout.leftPanel.setVariant(variant),"offcanvas"===variant&&layout.leftPanel.hide())}}};
1
+ export const DEFAULT_LAYOUT_RULES={maxDockedPanels:{xs:1,m:2,l:3},rightPanel:{priority:1,condition:({isLowPrio,isMobile,layout})=>{isLowPrio&&!isMobile&&layout.rightPanel.setVariant("float")}},splitview:{priority:2,condition:({isLowPrio,isMobile,layout})=>{isLowPrio&&!isMobile&&layout.splitview.hide()}},leftPanel:{priority:3,condition:({isLowPrio,isMobile,layout})=>{let variant=isMobile||isLowPrio?"drawer":"sidebar";variant!==layout.leftPanel.state.variant&&(layout.leftPanel.setVariant(variant),"drawer"!==variant||isMobile||layout.leftPanel.hide())}}};
@@ -1 +1 @@
1
- import{useEffect,useRef}from"react";import{useBreakpoints}from"../../shared/useBreakpoints";import{PANEL_ORDER,Slot,TOGGLABLE_SLOTS}from"./-constants";let DEFAULT_PRIORITY={[Slot.rightPanel]:1,[Slot.splitview]:2,[Slot.leftPanel]:3},maxDockedFor=(maxDockedPanels,breakpoints)=>{let{xs,m=xs,l=m}=maxDockedPanels;return breakpoints.isMobile?xs:breakpoints.isTablet?m:l},isDockedPanel=({state,declared,slot})=>!!declared[slot]&&!!state[slot].visible&&(slot===Slot.rightPanel?"float"!==state.rightPanel.variant:slot!==Slot.leftPanel||"sidebar"===state.leftPanel.variant),resolveLowPrioSlots=({rules,state,declared,breakpoints})=>{let freeSlots=Math.max(0,maxDockedFor(rules.maxDockedPanels,breakpoints)-1),priorityFor=slot=>rules[slot]?.priority??DEFAULT_PRIORITY[slot],outranks=(slot,other)=>{let byPriority=priorityFor(slot)-priorityFor(other);return 0!==byPriority?byPriority<0:PANEL_ORDER.indexOf(slot)<PANEL_ORDER.indexOf(other)},countStrongerDocked=slot=>TOGGLABLE_SLOTS.filter(other=>other!==slot&&isDockedPanel({state,declared,slot:other})&&outranks(other,slot)).length;return TOGGLABLE_SLOTS.filter(slot=>countStrongerDocked(slot)>=freeSlots)};export function useLayoutRules({layout,declared,rules,additionalData}){let layoutRef=useRef(layout);layoutRef.current=layout;let{isMobile,isTablet,isDesktop}=useBreakpoints(),{state}=layout;useEffect(()=>{if(!rules)return;let lowPrioSlots=resolveLowPrioSlots({rules,state,declared,breakpoints:{isMobile,isTablet,isDesktop}});TOGGLABLE_SLOTS.forEach(slot=>{let condition=rules[slot]?.condition;condition&&condition({...additionalData,isLowPrio:lowPrioSlots.includes(slot),isMobile,isTablet,isDesktop,layout:layoutRef.current})})},[rules,additionalData,state,declared,isMobile,isTablet,isDesktop])}
1
+ import{useEffect,useRef}from"react";import{useBreakpoints}from"../../shared/useBreakpoints";import{PANEL_ORDER,Slot,TOGGLABLE_SLOTS}from"./-constants";let DEFAULT_PRIORITY={[Slot.rightPanel]:1,[Slot.splitview]:2,[Slot.leftPanel]:3},maxDockedFor=(maxDockedPanels,breakpoints)=>{let{xs,m=xs,l=m}=maxDockedPanels;return breakpoints.isMobile?xs:breakpoints.isTablet?m:l},isDockedPanel=({state,declared,slot})=>!!declared[slot]&&!!state[slot].visible&&(slot===Slot.rightPanel?"float"!==state.rightPanel.variant:slot!==Slot.leftPanel||"drawer"!==state.leftPanel.variant),resolveLowPrioSlots=({rules,state,declared,breakpoints})=>{let freeSlots=Math.max(0,maxDockedFor(rules.maxDockedPanels,breakpoints)-1),priorityFor=slot=>rules[slot]?.priority??DEFAULT_PRIORITY[slot],outranks=(slot,other)=>{let byPriority=priorityFor(slot)-priorityFor(other);return 0!==byPriority?byPriority<0:PANEL_ORDER.indexOf(slot)<PANEL_ORDER.indexOf(other)},countStrongerDocked=slot=>TOGGLABLE_SLOTS.filter(other=>other!==slot&&isDockedPanel({state,declared,slot:other})&&outranks(other,slot)).length;return TOGGLABLE_SLOTS.filter(slot=>countStrongerDocked(slot)>=freeSlots)};export function useLayoutRules({layout,declared,rules,additionalData}){let layoutRef=useRef(layout);layoutRef.current=layout;let{isMobile,isTablet,isDesktop}=useBreakpoints(),{state}=layout;useEffect(()=>{if(!rules)return;let lowPrioSlots=resolveLowPrioSlots({rules,state,declared,breakpoints:{isMobile,isTablet,isDesktop}});TOGGLABLE_SLOTS.forEach(slot=>{let condition=rules[slot]?.condition;condition&&condition({...additionalData,isLowPrio:lowPrioSlots.includes(slot),isMobile,isTablet,isDesktop,layout:layoutRef.current})})},[rules,additionalData,state,declared,isMobile,isTablet,isDesktop])}
@@ -14,12 +14,6 @@ export type PanelDockedSlideOptions = {
14
14
  /** Forwarded to the declaration: lock the column's width when the window
15
15
  * resizes. Doesn't affect the slide, which resizes the column outright. */
16
16
  lockWidthOnWindowResize?: boolean;
17
- /** Width the column rests at while hidden, instead of collapsing to nothing.
18
- * Set it and the column never unmounts: closing narrows it to this, opening
19
- * widens it back, so one box carries both states (a nav left bar that widens
20
- * into the panel). The column stops being collapsible - there is no zero to
21
- * collapse to - and this becomes its `minSize` while it is hidden. */
22
- collapsedSize?: Size;
23
17
  };
24
18
  export type PanelDockedSlide = {
25
19
  /** Whether the panel's content should render at all (entering, open, or
@@ -32,9 +26,10 @@ export type PanelDockedSlide = {
32
26
  /**
33
27
  * Animates a docked side panel's open/close as a width slide on its
34
28
  * `react-resizable-panels` column, pushing neighbouring content smoothly
35
- * instead of snapping. Slot-generic - works for either side panel. Falls back to
36
- * an instant open/close when the panel isn't collapsible, no handle is
37
- * available, or reduced motion is requested. The mobile modal-drawer lifecycle lives in
29
+ * instead of snapping. Slot-generic - works for either side panel; render the
30
+ * returned state with {@link PanelSlideBody}. Falls back to an instant
31
+ * open/close when the panel isn't collapsible, no handle is available, or
32
+ * reduced motion is requested. The mobile modal-drawer lifecycle lives in
38
33
  * {@link useExitAnimation} and the Drawer's styled components.
39
34
  */
40
- export declare function usePanelDockedSlide({ slot, defaultSize, minSize, maxSize, collapsible, resizable, lockWidthOnWindowResize, collapsedSize, }: PanelDockedSlideOptions): PanelDockedSlide;
35
+ export declare function usePanelDockedSlide({ slot, defaultSize, minSize, maxSize, collapsible, resizable, lockWidthOnWindowResize, }: PanelDockedSlideOptions): PanelDockedSlide;
@@ -1 +1 @@
1
- import{useLayoutEffect,useRef,useState}from"react";import{useTheme}from"@emotion/react";import{useWindow}from"../../shared/useWindow";import{prefersReducedMotion}from"../../shared/prefersReducedMotion";import{useDeclarePanel,usePanelAnimationControl,usePanelPresence,usePanelRow}from"./registry";import{useLayout}from"./useLayout";let parseDurationMs=duration=>{let trimmed=duration.trim();return trimmed.endsWith("ms")?parseFloat(trimmed):trimmed.endsWith("s")?1e3*parseFloat(trimmed):parseFloat(trimmed)||0},resolveSizePx=(size,groupWidthPx)=>{if("number"==typeof size)return size;if("string"!=typeof size)return null;let parsed=parseFloat(size);return Number.isFinite(parsed)?size.trim().endsWith("px")?parsed:null!=groupWidthPx?parsed/100*groupWidthPx:null:null},groupColumnsOf=element=>{let columns=element.closest("[data-group]")?.querySelectorAll("[data-panel]");return columns?Array.from(columns):[element]},isHandleReady=handle=>{try{return handle.isCollapsed(),!0}catch{return!1}},mountDefaultSizeFor=({collapsedSize,defaultSize,isVisible,isSlidingIn})=>void 0!==collapsedSize?isVisible?defaultSize:collapsedSize:isSlidingIn?0:defaultSize;export function usePanelDockedSlide({slot,defaultSize,minSize,maxSize,collapsible,resizable,lockWidthOnWindowResize,collapsedSize}){let{isVisible,state}=useLayout()[slot],theme=useTheme(),window=useWindow(),animation=usePanelAnimationControl(),rowKey=usePanelRow(),reducedMotion=prefersReducedMotion(window),hasCollapsedRest=void 0!==collapsedSize,isCollapsible=collapsible&&!hasCollapsedRest,[isMounted,setIsMounted]=useState(isVisible),[phase,setPhase]=useState("idle"),[pinnedWidth,setPinnedWidth]=useState(null),[prevVisible,setPrevVisible]=useState(isVisible);isVisible!==prevVisible&&(setPrevVisible(isVisible),setPhase(isVisible?"entering":"exiting"),isVisible&&setIsMounted(!0),animation?.setResizeSuppressed(slot,!0));let openSize=hasCollapsedRest?state.size??defaultSize:defaultSize;useDeclarePanel(slot,{defaultSize:mountDefaultSizeFor({collapsedSize,defaultSize:openSize,isVisible,isSlidingIn:"entering"===phase&&collapsible&&!reducedMotion}),minSize:hasCollapsedRest&&!isVisible?collapsedSize:minSize??collapsedSize,maxSize,collapsible:isCollapsible,resizable,lockWidthOnWindowResize}),usePanelPresence(slot,hasCollapsedRest||isMounted);let latestRest=useRef({isVisible,openSize,phase});return latestRest.current={isVisible,openSize,phase},useLayoutEffect(()=>{if(!hasCollapsedRest)return;let frame=0,cancelled=!1,resizeToRest=attempt=>{if(cancelled)return;let handle=animation?.getHandle(slot)??null;if(handle&&isHandleReady(handle)){let rest=latestRest.current;if("idle"!==rest.phase)return;let restSize=rest.isVisible?rest.openSize??minSize:collapsedSize;try{void 0!==restSize&&handle.resize(restSize)}catch{}return}animation&&!(attempt>=30)&&(frame=window.requestAnimationFrame(()=>resizeToRest(attempt+1)))};return Promise.resolve().then(()=>resizeToRest(0)),()=>{cancelled=!0,window.cancelAnimationFrame(frame)}},[rowKey]),useLayoutEffect(()=>{if("idle"===phase)return;let cancelled=!1,frame=0,settleTimer=0,animatedColumns=[];animation?.setResizeSuppressed(slot,!0);let{duration,timingFunction}=hasCollapsedRest?theme.variables.animation.navSlide.collapse:theme.variables.animation.navSlide.open,durationMs=parseDurationMs(duration),setColumnTransitions=enabled=>{animatedColumns.forEach(column=>{enabled?column.style.setProperty("transition",`flex-grow ${duration} ${timingFunction}`):column.style.removeProperty("transition")})},targetSize=state.size??defaultSize??minSize,openColumn=(handle,targetPx)=>{handle.isCollapsed()&&handle.expand(),handle.resize(targetPx??targetSize??minSize??"20%")},settle=handle=>{if(setColumnTransitions(!1),animation?.setResizeSuppressed(slot,!1),"entering"===phase&&handle&&!hasCollapsedRest)try{handle.getSize().inPixels<1&&openColumn(handle,null)}catch{}setPinnedWidth(null),"exiting"!==phase||hasCollapsedRest||setIsMounted(!1),setPhase("idle")},runSlide=(handle,element)=>{animatedColumns=groupColumnsOf(element);let groupWidthPx=element.closest("[data-group]")?.getBoundingClientRect().width??null,targetPx=resolveSizePx(targetSize,groupWidthPx),collapsedPx=resolveSizePx(collapsedSize,groupWidthPx);setPinnedWidth("entering"===phase?targetPx:handle.getSize().inPixels),reducedMotion||setColumnTransitions(!0),element.getBoundingClientRect();try{"entering"===phase?openColumn(handle,targetPx):hasCollapsedRest?handle.resize(collapsedPx??collapsedSize):handle.collapse()}catch{settle(handle);return}settleTimer=window.setTimeout(()=>settle(handle),reducedMotion?0:durationMs+80)},waitsForRelaxedMinimum="exiting"===phase&&hasCollapsedRest,waitForColumn=attempt=>{if(cancelled)return;if(0===attempt&&waitsForRelaxedMinimum){frame=window.requestAnimationFrame(()=>waitForColumn(attempt+1));return}let handle=animation?.getHandle(slot)??null,element=animation?.getElement(slot)??null;return handle&&element&&isHandleReady(handle)?void runSlide(handle,element):"exiting"===phase||!animation||attempt>=30?void settle(handle):void(frame=window.requestAnimationFrame(()=>waitForColumn(attempt+1)))};return collapsible||hasCollapsedRest?waitForColumn(0):settle(animation?.getHandle(slot)??null),()=>{cancelled=!0,window.cancelAnimationFrame(frame),window.clearTimeout(settleTimer),setColumnTransitions(!1),animation?.setResizeSuppressed(slot,!1)}},[phase,slot,collapsible,hasCollapsedRest,reducedMotion,animation,window,theme]),{isMounted:hasCollapsedRest||isMounted,pinnedWidth}}
1
+ import{useLayoutEffect,useState}from"react";import{useTheme}from"@emotion/react";import{useWindow}from"../../shared/useWindow";import{prefersReducedMotion}from"../../shared/prefersReducedMotion";import{useDeclarePanel,usePanelAnimationControl,usePanelPresence}from"./registry";import{useLayout}from"./useLayout";let parseDurationMs=duration=>{let trimmed=duration.trim();return trimmed.endsWith("ms")?parseFloat(trimmed):trimmed.endsWith("s")?1e3*parseFloat(trimmed):parseFloat(trimmed)||0},resolveSizePx=(size,groupWidthPx)=>{if("number"==typeof size)return size;if("string"!=typeof size)return null;let parsed=parseFloat(size);return Number.isFinite(parsed)?size.trim().endsWith("px")?parsed:null!=groupWidthPx?parsed/100*groupWidthPx:null:null},groupColumnsOf=element=>{let columns=element.closest("[data-group]")?.querySelectorAll("[data-panel]");return columns?Array.from(columns):[element]},isHandleReady=handle=>{try{return handle.isCollapsed(),!0}catch{return!1}};export function usePanelDockedSlide({slot,defaultSize,minSize,maxSize,collapsible,resizable,lockWidthOnWindowResize}){let{isVisible,state}=useLayout()[slot],theme=useTheme(),window=useWindow(),animation=usePanelAnimationControl(),reducedMotion=prefersReducedMotion(window),[isMounted,setIsMounted]=useState(isVisible),[phase,setPhase]=useState("idle"),[pinnedWidth,setPinnedWidth]=useState(null),[prevVisible,setPrevVisible]=useState(isVisible);return isVisible!==prevVisible&&(setPrevVisible(isVisible),setPhase(isVisible?"entering":"exiting"),isVisible&&setIsMounted(!0)),useDeclarePanel(slot,{defaultSize:"entering"===phase&&collapsible&&!reducedMotion?0:defaultSize,minSize,maxSize,collapsible,resizable,lockWidthOnWindowResize}),usePanelPresence(slot,isMounted),useLayoutEffect(()=>{if("idle"===phase)return;let cancelled=!1,frame=0,settleTimer=0,animatedColumns=[];animation?.setResizeSuppressed(slot,!0);let{duration,timingFunction}=theme.variables.animation.navSlide.open,durationMs=parseDurationMs(duration),setColumnTransitions=enabled=>{animatedColumns.forEach(column=>{enabled?column.style.setProperty("transition",`flex-grow ${duration} ${timingFunction}`):column.style.removeProperty("transition")})},targetSize=state.size??defaultSize??minSize,openColumn=(handle,targetPx)=>{handle.isCollapsed()&&handle.expand(),handle.resize(targetPx??targetSize??minSize??"20%")},settle=handle=>{if(setColumnTransitions(!1),animation?.setResizeSuppressed(slot,!1),"entering"===phase&&handle)try{handle.getSize().inPixels<1&&openColumn(handle,null)}catch{}setPinnedWidth(null),"exiting"===phase&&setIsMounted(!1),setPhase("idle")},runSlide=(handle,element)=>{animatedColumns=groupColumnsOf(element);let targetPx=resolveSizePx(targetSize,element.closest("[data-group]")?.getBoundingClientRect().width??null);setPinnedWidth("entering"===phase?targetPx:handle.getSize().inPixels),setColumnTransitions(!0),element.getBoundingClientRect();try{"entering"===phase?openColumn(handle,targetPx):handle.collapse()}catch{settle(handle);return}settleTimer=window.setTimeout(()=>settle(handle),durationMs+80)},waitForColumn=attempt=>{if(cancelled)return;let handle=animation?.getHandle(slot)??null,element=animation?.getElement(slot)??null;return handle&&element&&isHandleReady(handle)?void runSlide(handle,element):"exiting"===phase||!animation||attempt>=30?void settle(handle):void(frame=window.requestAnimationFrame(()=>waitForColumn(attempt+1)))};return!collapsible||reducedMotion?settle(animation?.getHandle(slot)??null):waitForColumn(0),()=>{cancelled=!0,window.cancelAnimationFrame(frame),window.clearTimeout(settleTimer),setColumnTransitions(!1),animation?.setResizeSuppressed(slot,!1)}},[phase,slot,collapsible,animation,window,theme]),{isMounted,pinnedWidth}}
@@ -6,5 +6,4 @@ export { getBaseButtonStyles } from "./Button/getBaseButtonStyles";
6
6
  export { getPressedStyles } from "./Button/getPressedStyles";
7
7
  export { getPillStyles } from "./Button/getPillStyles";
8
8
  export { getFocusStyles } from "./getFocusStyles";
9
- export { getLeftPanelFadeStyles } from "./getLeftPanelFadeStyles";
10
9
  export { getPrimaryVariantStyles, getSecondaryVariantStyles, getTertiaryVariantStyles, } from "./Button/getVariantStyles";
@@ -1 +1 @@
1
- export{getInputTextPlaceholder}from"./TextInput/getInputTextPlaceholder";export{getInputTextStyles}from"./TextInput/getInputTextStyles";export{getDisabledStyles}from"./Button/getDisabledStyles";export{getButtonAppearanceReset}from"./Button/getButtonAppearanceReset";export{getBaseButtonStyles}from"./Button/getBaseButtonStyles";export{getPressedStyles}from"./Button/getPressedStyles";export{getPillStyles}from"./Button/getPillStyles";export{getFocusStyles}from"./getFocusStyles";export{getLeftPanelFadeStyles}from"./getLeftPanelFadeStyles";export{getPrimaryVariantStyles,getSecondaryVariantStyles,getTertiaryVariantStyles}from"./Button/getVariantStyles";
1
+ export{getInputTextPlaceholder}from"./TextInput/getInputTextPlaceholder";export{getInputTextStyles}from"./TextInput/getInputTextStyles";export{getDisabledStyles}from"./Button/getDisabledStyles";export{getButtonAppearanceReset}from"./Button/getButtonAppearanceReset";export{getBaseButtonStyles}from"./Button/getBaseButtonStyles";export{getPressedStyles}from"./Button/getPressedStyles";export{getPillStyles}from"./Button/getPillStyles";export{getFocusStyles}from"./getFocusStyles";export{getPrimaryVariantStyles,getSecondaryVariantStyles,getTertiaryVariantStyles}from"./Button/getVariantStyles";