@amboss/design-system 4.6.6-canary.0 → 4.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/components/Internal/PanelHeader/PanelHeader.d.ts +1 -4
- package/build/cjs/components/Internal/PanelHeader/PanelHeader.js +1 -1
- package/build/cjs/components/Internal/Sandwich/-types.d.ts +0 -5
- package/build/cjs/components/Internal/Sandwich/Sandwich.d.ts +1 -1
- package/build/cjs/components/Internal/Sandwich/Sandwich.js +1 -1
- package/build/cjs/components/Layout/-types.d.ts +7 -52
- package/build/cjs/components/Layout/Layout.d.ts +0 -4
- package/build/cjs/components/Layout/Layout.js +1 -1
- package/build/cjs/components/Layout/LeftPanel/LeftPanel.js +1 -1
- package/build/cjs/components/Layout/LeftPanel/LeftPanelDocked.d.ts +5 -15
- package/build/cjs/components/Layout/LeftPanel/LeftPanelDocked.js +1 -1
- package/build/cjs/components/Layout/LeftPanel/LeftPanelDrawer.js +1 -1
- package/build/cjs/components/Layout/LeftPanel/LeftPanelFooter.js +1 -1
- package/build/cjs/components/Layout/LeftPanel/LeftPanelHeader.js +1 -1
- package/build/cjs/components/Layout/PanelSlideBody.d.ts +18 -0
- package/build/cjs/components/Layout/PanelSlideBody.js +1 -0
- package/build/cjs/components/Layout/rules.js +1 -1
- package/build/cjs/components/Layout/useLayoutRules.js +1 -1
- package/build/cjs/components/Layout/usePanelDockedSlide.d.ts +5 -10
- package/build/cjs/components/Layout/usePanelDockedSlide.js +1 -1
- package/build/cjs/shared/mixins/index.d.ts +0 -1
- package/build/cjs/shared/mixins/index.js +1 -1
- package/build/cjs/web-tokens/_sizes.json +54 -64
- package/build/cjs/web-tokens/visualConfig.d.ts +0 -7
- package/build/cjs/web-tokens/visualConfig.js +1 -1
- package/build/esm/components/Internal/PanelHeader/PanelHeader.d.ts +1 -4
- package/build/esm/components/Internal/PanelHeader/PanelHeader.js +1 -1
- package/build/esm/components/Internal/Sandwich/-types.d.ts +0 -5
- package/build/esm/components/Internal/Sandwich/Sandwich.d.ts +1 -1
- package/build/esm/components/Internal/Sandwich/Sandwich.js +1 -1
- package/build/esm/components/Layout/-types.d.ts +7 -52
- package/build/esm/components/Layout/Layout.d.ts +0 -4
- package/build/esm/components/Layout/Layout.js +1 -1
- package/build/esm/components/Layout/LeftPanel/LeftPanel.js +1 -1
- package/build/esm/components/Layout/LeftPanel/LeftPanelDocked.d.ts +5 -15
- package/build/esm/components/Layout/LeftPanel/LeftPanelDocked.js +1 -1
- package/build/esm/components/Layout/LeftPanel/LeftPanelDrawer.js +1 -1
- package/build/esm/components/Layout/LeftPanel/LeftPanelFooter.js +1 -1
- package/build/esm/components/Layout/LeftPanel/LeftPanelHeader.js +1 -1
- package/build/esm/components/Layout/PanelSlideBody.d.ts +18 -0
- package/build/esm/components/Layout/PanelSlideBody.js +1 -0
- package/build/esm/components/Layout/rules.js +1 -1
- package/build/esm/components/Layout/useLayoutRules.js +1 -1
- package/build/esm/components/Layout/usePanelDockedSlide.d.ts +5 -10
- package/build/esm/components/Layout/usePanelDockedSlide.js +1 -1
- package/build/esm/shared/mixins/index.d.ts +0 -1
- package/build/esm/shared/mixins/index.js +1 -1
- package/build/esm/web-tokens/_sizes.json +54 -64
- package/build/esm/web-tokens/visualConfig.d.ts +0 -7
- package/build/esm/web-tokens/visualConfig.js +1 -1
- package/build/scss/_variables.scss +0 -3
- package/package.json +5 -3
- package/build/cjs/components/Layout/LeftNavBar/LeftNavBar.d.ts +0 -17
- package/build/cjs/components/Layout/LeftNavBar/LeftNavBar.js +0 -1
- package/build/cjs/components/Layout/LeftNavBar/LeftNavBarFooter.d.ts +0 -7
- package/build/cjs/components/Layout/LeftNavBar/LeftNavBarFooter.js +0 -1
- package/build/cjs/components/Layout/LeftPanel/LeftBarLayers.d.ts +0 -36
- package/build/cjs/components/Layout/LeftPanel/LeftBarLayers.js +0 -1
- package/build/cjs/components/Layout/LeftPanel/LeftBarToggle.d.ts +0 -15
- package/build/cjs/components/Layout/LeftPanel/LeftBarToggle.js +0 -1
- package/build/cjs/components/Layout/LeftPanel/LeftPanelOffcanvas.d.ts +0 -29
- package/build/cjs/components/Layout/LeftPanel/LeftPanelOffcanvas.js +0 -1
- package/build/cjs/components/Layout/LeftPanel/useLeftBarContext.d.ts +0 -11
- package/build/cjs/components/Layout/LeftPanel/useLeftBarContext.js +0 -1
- package/build/cjs/components/Layout/LeftPanel/useLeftPanelCollapseContext.d.ts +0 -11
- package/build/cjs/components/Layout/LeftPanel/useLeftPanelCollapseContext.js +0 -1
- package/build/cjs/components/Layout/useLeftPanelId.d.ts +0 -6
- package/build/cjs/components/Layout/useLeftPanelId.js +0 -1
- package/build/cjs/shared/mixins/getLeftPanelFadeStyles.d.ts +0 -19
- package/build/cjs/shared/mixins/getLeftPanelFadeStyles.js +0 -1
- package/build/esm/components/Layout/LeftNavBar/LeftNavBar.d.ts +0 -17
- package/build/esm/components/Layout/LeftNavBar/LeftNavBar.js +0 -1
- package/build/esm/components/Layout/LeftNavBar/LeftNavBarFooter.d.ts +0 -7
- package/build/esm/components/Layout/LeftNavBar/LeftNavBarFooter.js +0 -1
- package/build/esm/components/Layout/LeftPanel/LeftBarLayers.d.ts +0 -36
- package/build/esm/components/Layout/LeftPanel/LeftBarLayers.js +0 -1
- package/build/esm/components/Layout/LeftPanel/LeftBarToggle.d.ts +0 -15
- package/build/esm/components/Layout/LeftPanel/LeftBarToggle.js +0 -1
- package/build/esm/components/Layout/LeftPanel/LeftPanelOffcanvas.d.ts +0 -29
- package/build/esm/components/Layout/LeftPanel/LeftPanelOffcanvas.js +0 -1
- package/build/esm/components/Layout/LeftPanel/useLeftBarContext.d.ts +0 -11
- package/build/esm/components/Layout/LeftPanel/useLeftBarContext.js +0 -1
- package/build/esm/components/Layout/LeftPanel/useLeftPanelCollapseContext.d.ts +0 -11
- package/build/esm/components/Layout/LeftPanel/useLeftPanelCollapseContext.js +0 -1
- package/build/esm/components/Layout/useLeftPanelId.d.ts +0 -6
- package/build/esm/components/Layout/useLeftPanelId.js +0 -1
- package/build/esm/shared/mixins/getLeftPanelFadeStyles.d.ts +0 -19
- package/build/esm/shared/mixins/getLeftPanelFadeStyles.js +0 -1
|
@@ -19,9 +19,6 @@ export type PanelHeaderProps = {
|
|
|
19
19
|
title?: PanelHeaderTitle;
|
|
20
20
|
/** Rendered at the header end, vertically centered. */
|
|
21
21
|
rightSlot?: React.ReactNode;
|
|
22
|
-
/** Fade the leading group out. `rightSlot` is left solid: it is the control
|
|
23
|
-
* that travels down onto the left bar's own and has to survive the dissolve. */
|
|
24
|
-
isContentFaded?: boolean;
|
|
25
22
|
"data-e2e-test-id"?: string;
|
|
26
23
|
};
|
|
27
24
|
/**
|
|
@@ -31,4 +28,4 @@ export type PanelHeaderProps = {
|
|
|
31
28
|
* carries the semantics (heading, buttons). Place it inside `Sandwich.Header`
|
|
32
29
|
* to get the sticky positioning and scroll separator.
|
|
33
30
|
*/
|
|
34
|
-
export declare function PanelHeader({ leftSlot, title, rightSlot,
|
|
31
|
+
export declare function PanelHeader({ leftSlot, title, rightSlot, "data-e2e-test-id": dataE2eTestId, }: PanelHeaderProps): React.ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"PanelHeader",{enumerable:!0,get:function(){return PanelHeader}});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"PanelHeader",{enumerable:!0,get:function(){return PanelHeader}});const _react=/*#__PURE__*/require("@swc/helpers/_/_interop_require_default")._(require("react")),_TextClamped=require("../../../components/Typography/TextClamped/TextClamped"),_Box=require("../../Box/Box"),_Inline=require("../../Inline/Inline"),_Icon=require("../../Icon/Icon"),_Header=require("../../Typography/Header/Header");function PanelHeader({leftSlot,title,rightSlot,"data-e2e-test-id":dataE2eTestId}){let colorTitleItems="primary";return _react.default.createElement(_Box.Box,{space:"s",vSpace:"xs","data-e2e-test-id":dataE2eTestId},_react.default.createElement(_Inline.Inline,{alignItems:"spaceBetween",vAlignItems:"center",noWrap:!0,fullWidth:!0},_react.default.createElement(_Inline.Inline,{space:"xs",vAlignItems:"center",noWrap:!0},_react.default.createElement(_react.default.Fragment,null,leftSlot,title&&!1!==title.isVisible&&_react.default.createElement(_Inline.Inline,{space:"xs",vAlignItems:"center",noWrap:!0},title.icon&&_react.default.createElement(_Icon.Icon,{...title.icon,color:colorTitleItems,size:"s"}),_react.default.createElement(_TextClamped.TextClamped,{as:"span"},_react.default.createElement(_Header.H5,{color:colorTitleItems},title.label))))),_react.default.createElement(_Inline.Inline,{space:"xxs",vAlignItems:"center",noWrap:!0},_react.default.createElement(_react.default.Fragment,null,rightSlot))))}
|
|
@@ -7,11 +7,6 @@ export type SandwichProps = {
|
|
|
7
7
|
onScroll?: React.UIEventHandler<HTMLDivElement>;
|
|
8
8
|
/** Forwarded to the scroll container element (e.g. for scroll restoration). */
|
|
9
9
|
scrollRef?: React.Ref<HTMLDivElement>;
|
|
10
|
-
/** Hides the scroll region's scrollbar and stops it scrolling sideways. For
|
|
11
|
-
* frames too narrow to spare a scrollbar's width - which are the frames
|
|
12
|
-
* holding content wider than themselves, clipped at the edge. The region
|
|
13
|
-
* still scrolls vertically by wheel and keyboard. */
|
|
14
|
-
hideScrollbar?: boolean;
|
|
15
10
|
};
|
|
16
11
|
/**
|
|
17
12
|
* Separator visibility:
|
|
@@ -12,7 +12,7 @@ import { SandwichFooter } from "./SandwichFooter";
|
|
|
12
12
|
* content is scrolled under them; edge state is shared through context (see
|
|
13
13
|
* `useSandwichContext.tsx`).
|
|
14
14
|
*/
|
|
15
|
-
declare function SandwichRoot({ children, scrollRef, onScroll,
|
|
15
|
+
declare function SandwichRoot({ children, scrollRef, onScroll, }: SandwichProps): React.ReactElement;
|
|
16
16
|
/**
|
|
17
17
|
* Compound export: `Sandwich` with `.Header` / `.Footer` attached.
|
|
18
18
|
* Object.assign keeps the static sub-components typed on the root
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"Sandwich",{enumerable:!0,get:function(){return Sandwich}});const _interop_require_default=require("@swc/helpers/_/_interop_require_default"),_react=/*#__PURE__*/require("@swc/helpers/_/_interop_require_wildcard")._(require("react")),_styled=/*#__PURE__*/_interop_require_default._(require("@emotion/styled")),_useSandwichContext=require("./useSandwichContext"),_SandwichHeader=require("./SandwichHeader"),_SandwichFooter=require("./SandwichFooter"),useScrollEdgeTracking=({scrollRef,onScroll,setEdges})=>{let[containerEl,setContainerEl]=(0,_react.useState)(null),[contentEl,setContentEl]=(0,_react.useState)(null),setContainerRef=(0,_react.useCallback)(node=>{setContainerEl(node),"function"==typeof scrollRef?scrollRef(node):scrollRef&&(scrollRef.current=node)},[scrollRef]),recalculateEdges=(0,_react.useCallback)(()=>{if(!containerEl)return;let{scrollTop,scrollHeight,clientHeight}=containerEl;setEdges({atTop:scrollTop<=1,atBottom:scrollTop+clientHeight>=scrollHeight-1})},[containerEl,setEdges]),onContainerScroll=(0,_react.useCallback)(event=>{recalculateEdges(),onScroll?.(event)},[recalculateEdges,onScroll]);return(0,_react.useLayoutEffect)(recalculateEdges,[recalculateEdges]),(0,_react.useEffect)(()=>{if("undefined"==typeof ResizeObserver)return;let observer=new ResizeObserver(()=>recalculateEdges());return containerEl&&observer.observe(containerEl),contentEl&&observer.observe(contentEl),()=>observer.disconnect()},[containerEl,contentEl,recalculateEdges]),{setContainerRef,setContentRef:setContentEl,onContainerScroll}},useSandwichEdgesState=()=>{let[edges,setEdgesState]=(0,_react.useState)({atTop:!0,atBottom:!0}),setEdges=(0,_react.useCallback)(next=>{setEdgesState(prev=>{let merged={...prev,...next};return merged.atTop===prev.atTop&&merged.atBottom===prev.atBottom?prev:merged})},[]);return(0,_react.useMemo)(()=>({...edges,setEdges}),[edges,setEdges])},StyledRoot=(0,_styled.default)("div",{target:"
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"Sandwich",{enumerable:!0,get:function(){return Sandwich}});const _interop_require_default=require("@swc/helpers/_/_interop_require_default"),_react=/*#__PURE__*/require("@swc/helpers/_/_interop_require_wildcard")._(require("react")),_styled=/*#__PURE__*/_interop_require_default._(require("@emotion/styled")),_useSandwichContext=require("./useSandwichContext"),_SandwichHeader=require("./SandwichHeader"),_SandwichFooter=require("./SandwichFooter"),useScrollEdgeTracking=({scrollRef,onScroll,setEdges})=>{let[containerEl,setContainerEl]=(0,_react.useState)(null),[contentEl,setContentEl]=(0,_react.useState)(null),setContainerRef=(0,_react.useCallback)(node=>{setContainerEl(node),"function"==typeof scrollRef?scrollRef(node):scrollRef&&(scrollRef.current=node)},[scrollRef]),recalculateEdges=(0,_react.useCallback)(()=>{if(!containerEl)return;let{scrollTop,scrollHeight,clientHeight}=containerEl;setEdges({atTop:scrollTop<=1,atBottom:scrollTop+clientHeight>=scrollHeight-1})},[containerEl,setEdges]),onContainerScroll=(0,_react.useCallback)(event=>{recalculateEdges(),onScroll?.(event)},[recalculateEdges,onScroll]);return(0,_react.useLayoutEffect)(recalculateEdges,[recalculateEdges]),(0,_react.useEffect)(()=>{if("undefined"==typeof ResizeObserver)return;let observer=new ResizeObserver(()=>recalculateEdges());return containerEl&&observer.observe(containerEl),contentEl&&observer.observe(contentEl),()=>observer.disconnect()},[containerEl,contentEl,recalculateEdges]),{setContainerRef,setContentRef:setContentEl,onContainerScroll}},useSandwichEdgesState=()=>{let[edges,setEdgesState]=(0,_react.useState)({atTop:!0,atBottom:!0}),setEdges=(0,_react.useCallback)(next=>{setEdgesState(prev=>{let merged={...prev,...next};return merged.atTop===prev.atTop&&merged.atBottom===prev.atBottom?prev:merged})},[]);return(0,_react.useMemo)(()=>({...edges,setEdges}),[edges,setEdges])},StyledRoot=(0,_styled.default)("div",{target:"ejnp4220",label:"StyledRoot"})({height:"100%",display:"flex",flexDirection:"column",position:"relative"}),StyledEdgeSlot=(0,_styled.default)("div",{target:"ejnp4221",label:"StyledEdgeSlot"})({flex:"0 0 auto"}),StyledScrollBody=(0,_styled.default)("div",{target:"ejnp4222",label:"StyledScrollBody"})({flex:"1 1 auto",minHeight:0,overflowY:"auto",position:"relative"}),StyledScrollContent=(0,_styled.default)("div",{target:"ejnp4223",label:"StyledScrollContent"})({minHeight:"100%",display:"flex",flexDirection:"column"}),Sandwich=Object.assign(function({children,scrollRef,onScroll}){let edgesValue=useSandwichEdgesState(),{setContainerRef,setContentRef,onContainerScroll}=useScrollEdgeTracking({scrollRef,onScroll,setEdges:edgesValue.setEdges}),[headerSlotNode,setHeaderSlotNode]=(0,_react.useState)(null),[footerSlotNode,setFooterSlotNode]=(0,_react.useState)(null),contextValue=(0,_react.useMemo)(()=>({...edgesValue,headerSlotNode,footerSlotNode}),[edgesValue,headerSlotNode,footerSlotNode]);return _react.default.createElement(_useSandwichContext.SandwichProvider,{value:contextValue},_react.default.createElement(StyledRoot,{"data-ds-id":"Sandwich"},_react.default.createElement(StyledEdgeSlot,{ref:setHeaderSlotNode}),_react.default.createElement(StyledScrollBody,{ref:setContainerRef,onScroll:onContainerScroll,tabIndex:0,"data-ds-id":"SandwichBody"},_react.default.createElement(StyledScrollContent,{ref:setContentRef},children)),_react.default.createElement(StyledEdgeSlot,{ref:setFooterSlotNode})))},{Header:_SandwichHeader.SandwichHeader,Footer:_SandwichFooter.SandwichFooter});
|
|
@@ -15,9 +15,7 @@ import type { SandwichSeparator } from "../Internal/Sandwich/-types";
|
|
|
15
15
|
export type Size = number | string;
|
|
16
16
|
/**
|
|
17
17
|
* - `sidebar` - in-flow resizable panel.
|
|
18
|
-
* - `offcanvas` - detached desktop overlay. ⚠️ **RESERVED
|
|
19
|
-
* not implemented there yet.** Implemented for the left panel, which declares
|
|
20
|
-
* it through {@link LeftPanelVariant}.
|
|
18
|
+
* - `offcanvas` - detached desktop overlay. ⚠️ **RESERVED - not implemented yet.**
|
|
21
19
|
* Currently treated like `sidebar` (renders in-flow); the overlay
|
|
22
20
|
* implementation lands in a later commit.
|
|
23
21
|
* - `float` - detached floating window pinned to the bottom-right viewport
|
|
@@ -31,15 +29,11 @@ export type Variant = "sidebar" | "offcanvas" | "float";
|
|
|
31
29
|
export type RightPanelVariant = Variant;
|
|
32
30
|
/**
|
|
33
31
|
* - `sidebar` - in-flow resizable column.
|
|
34
|
-
* - `drawer` - modal overlay pinned to the left edge
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* - `offcanvas` - the same overlay without the dialog: no backdrop, no focus
|
|
38
|
-
* trap, the page behind stays live. Also out of the row, so it is what a rule
|
|
39
|
-
* switches to when the docked budget has no column left but the panel should
|
|
40
|
-
* stay reachable rather than be hidden.
|
|
32
|
+
* - `drawer` - modal overlay pinned to the left edge. Out of the resizable row,
|
|
33
|
+
* so it costs no docked column - the mobile presentation, and what a rule
|
|
34
|
+
* switches to when the budget has no column left.
|
|
41
35
|
*/
|
|
42
|
-
export type LeftPanelVariant = "sidebar" | "drawer"
|
|
36
|
+
export type LeftPanelVariant = "sidebar" | "drawer";
|
|
43
37
|
export type { PanelKey, SidePanelKey, SlotKey };
|
|
44
38
|
/** Everything both side panels hold. `variant` is declared per slot below, so
|
|
45
39
|
* each panel's state only admits the variants it can actually render. */
|
|
@@ -251,8 +245,7 @@ export type LeftPanelHandle = PanelHandleActions & {
|
|
|
251
245
|
state: LeftPanelState & {
|
|
252
246
|
variant: LeftPanelVariant;
|
|
253
247
|
};
|
|
254
|
-
/** Switch render variant: an in-flow column, the modal drawer
|
|
255
|
-
* non-modal offcanvas overlay. */
|
|
248
|
+
/** Switch render variant: an in-flow column, or the modal drawer. */
|
|
256
249
|
setVariant: (variant: LeftPanelVariant) => void;
|
|
257
250
|
};
|
|
258
251
|
export type RightPanelHandle = PanelHandleActions & {
|
|
@@ -309,28 +302,7 @@ export type SidePanelProps = ForwardedScrollProps & {
|
|
|
309
302
|
/** Called whenever the panel's visibility changes, with the new value. */
|
|
310
303
|
onVisibleChange?: (visible: boolean) => void;
|
|
311
304
|
};
|
|
312
|
-
export type LeftPanelProps =
|
|
313
|
-
/** Pixels. Unlike the other panels the left panel takes no percentage: with a
|
|
314
|
-
* left bar its content is pinned to this width and clipped as the column narrows,
|
|
315
|
-
* and a percentage would resolve against the narrowing column instead of the
|
|
316
|
-
* width it opens to - so the content would reflow mid-slide, which is the one
|
|
317
|
-
* thing the pin exists to prevent.
|
|
318
|
-
*
|
|
319
|
-
* Sets the column's starting width only: the docked panel keeps that width
|
|
320
|
-
* when the window resizes, and `Layout.Content` grows and shrinks around it.
|
|
321
|
-
* Drag-resizing is a separate story - see `resizable`. */
|
|
322
|
-
defaultSize?: number;
|
|
323
|
-
minSize?: number;
|
|
324
|
-
maxSize?: number;
|
|
325
|
-
/** Props forwarded to the panel's internal parts. Required: the left bar
|
|
326
|
-
* always carries the button that opens the panel, and it is icon-only, so its
|
|
327
|
-
* accessible name can only come from here. Give it the action - the panel's
|
|
328
|
-
* own `aria-label` already names the region it opens. */
|
|
329
|
-
slotProps: {
|
|
330
|
-
toggleButton: {
|
|
331
|
-
"aria-label": string;
|
|
332
|
-
};
|
|
333
|
-
};
|
|
305
|
+
export type LeftPanelProps = SidePanelProps & {
|
|
334
306
|
/** Accessible name for the panel. Used to label the modal drawer it renders
|
|
335
307
|
* as on mobile (`role="dialog"`). Ignored by the docked desktop panel. */
|
|
336
308
|
"aria-label": string;
|
|
@@ -407,18 +379,6 @@ export type PanelSlotFooterProps = {
|
|
|
407
379
|
};
|
|
408
380
|
export type LeftPanelHeaderProps = PanelSlotHeaderProps;
|
|
409
381
|
export type LeftPanelFooterProps = PanelSlotFooterProps;
|
|
410
|
-
/**
|
|
411
|
-
* Left bar contents for a `Layout.LeftPanel` whose left bar differs from its panel.
|
|
412
|
-
* Holds the button that opens the panel, plus the consumer's own navigation.
|
|
413
|
-
*/
|
|
414
|
-
export type LeftNavBarProps = {
|
|
415
|
-
/** Content in source order; `Layout.LeftNavBarFooter` sticks to the bottom,
|
|
416
|
-
* everything else scrolls. Optional - a left bar that carries nothing but the
|
|
417
|
-
* button that opens the panel is a left bar too. */
|
|
418
|
-
children?: React.ReactNode;
|
|
419
|
-
"data-e2e-test-id"?: string;
|
|
420
|
-
};
|
|
421
|
-
export type LeftNavBarFooterProps = PanelSlotFooterProps;
|
|
422
382
|
/**
|
|
423
383
|
* Title shown in the right panel header, after `leftSlot`. Visual only — the
|
|
424
384
|
* panel's accessible name comes from `Layout.RightPanel`'s `aria-label`.
|
|
@@ -481,17 +441,12 @@ export type PanelContainerProps = ForwardedScrollProps & {
|
|
|
481
441
|
/** Content in source order. Per-panel header/footer components stick to the
|
|
482
442
|
* edges; everything else scrolls. */
|
|
483
443
|
children: React.ReactNode;
|
|
484
|
-
/** DOM id of the container, so a control outside the panel can reference it. */
|
|
485
|
-
id?: string;
|
|
486
444
|
/** Accessible name; when set, the container renders as a `region` landmark. */
|
|
487
445
|
"aria-label"?: string;
|
|
488
446
|
/** Draws a separator border on the panel's left edge. */
|
|
489
447
|
showBorderLeft?: boolean;
|
|
490
448
|
/** Draws a separator border on the panel's right edge. */
|
|
491
449
|
showBorderRight?: boolean;
|
|
492
|
-
/** Hides the scroll region's scrollbar - for panels too narrow to spare its
|
|
493
|
-
* width. */
|
|
494
|
-
hideScrollbar?: boolean;
|
|
495
450
|
"data-e2e-test-id"?: string;
|
|
496
451
|
};
|
|
497
452
|
export type RightPanelProps = SidePanelProps & {
|
|
@@ -7,8 +7,6 @@ import { RightPanelFooter } from "./RightPanel/RightPanelFooter";
|
|
|
7
7
|
import { LeftPanel } from "./LeftPanel/LeftPanel";
|
|
8
8
|
import { LeftPanelHeader } from "./LeftPanel/LeftPanelHeader";
|
|
9
9
|
import { LeftPanelFooter } from "./LeftPanel/LeftPanelFooter";
|
|
10
|
-
import { LeftNavBar } from "./LeftNavBar/LeftNavBar";
|
|
11
|
-
import { LeftNavBarFooter } from "./LeftNavBar/LeftNavBarFooter";
|
|
12
10
|
import { Split } from "./Split/Split";
|
|
13
11
|
import { SplitHeader } from "./Split/SplitHeader";
|
|
14
12
|
import { SplitFooter } from "./Split/SplitFooter";
|
|
@@ -21,8 +19,6 @@ declare function LayoutBase({ children, persistenceKey, storage, rules, addition
|
|
|
21
19
|
type LayoutComponent = typeof LayoutBase & {
|
|
22
20
|
Provider: typeof LayoutProvider;
|
|
23
21
|
LeftPanel: typeof LeftPanel;
|
|
24
|
-
LeftNavBar: typeof LeftNavBar;
|
|
25
|
-
LeftNavBarFooter: typeof LeftNavBarFooter;
|
|
26
22
|
LeftPanelHeader: typeof LeftPanelHeader;
|
|
27
23
|
LeftPanelFooter: typeof LeftPanelFooter;
|
|
28
24
|
RightPanel: typeof RightPanel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var target=exports,all={get Layout(){return Layout},get PANEL_HOST_DS_ID(){return PANEL_HOST_DS_ID}};for(var name in all)Object.defineProperty(target,name,{enumerable:!0,get:Object.getOwnPropertyDescriptor(all,name).get});const _interop_require_default=require("@swc/helpers/_/_interop_require_default"),_react=/*#__PURE__*/require("@swc/helpers/_/_interop_require_wildcard")._(require("react")),_styled=/*#__PURE__*/_interop_require_default._(require("@emotion/styled")),_Panel=require("../Internal/Panel/Panel"),_LayoutFloat=require("../Internal/LayoutFloat/LayoutFloat"),_useBreakpoints=require("../../shared/useBreakpoints"),_constants=require("./-constants"),_context=require("./context"),_useMobileSplitStack=require("./Split/MobileSplitView/useMobileSplitStack"),_useMobileSplitView=require("./Split/MobileSplitView/useMobileSplitView"),_LayoutProvider=require("./LayoutProvider"),_Content=require("./Content/Content"),_RightPanel=require("./RightPanel/RightPanel"),_RightPanelHeader=require("./RightPanel/RightPanelHeader"),_RightPanelFooter=require("./RightPanel/RightPanelFooter"),_LeftPanel=require("./LeftPanel/LeftPanel"),_LeftPanelHeader=require("./LeftPanel/LeftPanelHeader"),_LeftPanelFooter=require("./LeftPanel/LeftPanelFooter"),_LeftNavBar=require("./LeftNavBar/LeftNavBar"),_LeftNavBarFooter=require("./LeftNavBar/LeftNavBarFooter"),_Split=require("./Split/Split"),_SplitHeader=require("./Split/SplitHeader"),_SplitFooter=require("./Split/SplitFooter"),_registry=require("./registry"),_usePortalTargets=require("./usePortalTargets"),_LayoutFloatDragProvider=require("../Internal/LayoutFloat/LayoutFloatDragProvider"),_LayoutCssVars=require("./LayoutCssVars"),_useLayout=require("./useLayout"),_useLayoutRules=require("./useLayoutRules"),_rules=require("./rules"),resizableFromState=slotState=>"sidePanel"===slotState.kind?slotState.resizable:void 0,useGlobalCssVariables=slotHosts=>{let leftPanelWidthCssVar=(0,_LayoutCssVars.useLayoutVar)(_constants.PANEL_WIDTH_VAR.leftPanel),contentWidthCssVar=(0,_LayoutCssVars.useLayoutVar)(_constants.PANEL_WIDTH_VAR.content),rightPanelWidthCssVar=(0,_LayoutCssVars.useLayoutVar)(_constants.PANEL_WIDTH_VAR.rightPanel);(0,_react.useEffect)(()=>{let targets=[[_constants.Slot.leftPanel,leftPanelWidthCssVar],[_constants.Slot.content,contentWidthCssVar],[_constants.Slot.rightPanel,rightPanelWidthCssVar]],observers=[];return targets.forEach(([slot,handle])=>{let node=slotHosts[slot]??null;if(!node)return void handle.set("0px");let publishNodeWidth=()=>handle.set(`${node.getBoundingClientRect().width}px`);if(publishNodeWidth(),"undefined"==typeof ResizeObserver)return;let observer=new ResizeObserver(publishNodeWidth);observer.observe(node),observers.push(observer)}),()=>observers.forEach(observer=>observer.disconnect())},[leftPanelWidthCssVar,contentWidthCssVar,rightPanelWidthCssVar,slotHosts])},StyledLayout=(0,_styled.default)("div",{target:"e9afqos0",label:"StyledLayout"})({position:"relative",height:"100%",width:"100%"}),StyledPanelRow=(0,_styled.default)("div",{target:"e9afqos1",label:"StyledPanelRow"})(({theme,hasOffcanvasLeftBar})=>({height:"100%",boxSizing:"border-box",...hasOffcanvasLeftBar&&{paddingLeft:theme.variables.size.dimension.leftNavBar.width}})),StyledPanelHost=(0,_styled.default)("div",{target:"e9afqos2",label:"StyledPanelHost"})({position:"relative",height:"100%",width:"100%"}),PANEL_HOST_DS_ID="PanelHost",StyledContentColumn=(0,_styled.default)("div",{shouldForwardProp:prop=>"isSplitOpen"!==prop,target:"e9afqos3",label:"StyledContentColumn"})(({isSplitOpen,theme})=>({display:"flex",height:`calc(100% - ${_constants.PAGE_BOTTOM_BAR_INSET})`,width:"100%",...isSplitOpen&&{maxWidth:theme.variables.layout.split.maxWidth.default,marginInline:"auto",gap:theme.variables.size.spacing.xxs}})),StyledContentColumnHalf=(0,_styled.default)("div",{target:"e9afqos4",label:"StyledContentColumnHalf"})({position:"relative",height:"100%",flex:"1 1 0",minWidth:0}),StyledMobileSplitStackHost=(0,_styled.default)("div",{target:"e9afqos5",label:"StyledMobileSplitStackHost"})({position:"absolute",top:0,left:0,right:0,bottom:_constants.PAGE_BOTTOM_BAR_INSET,overflow:"hidden",pointerEvents:"none"}),isPanelPresent=({slot,declared,present,isShown})=>!!declared[slot]&&(isShown(slot)||present[slot]),defaultSizeFor=({slot,panel,panelState})=>slot===_constants.Slot.content?void 0:panel?.defaultSize!==void 0?panel.defaultSize:panel?.resizable!==!1?panelState.size:void 0,childFor=(slot,contentColumn,slotHostRefs)=>slot===_constants.Slot.content?contentColumn:_react.default.createElement(StyledPanelHost,{"data-ds-id":PANEL_HOST_DS_ID,ref:slotHostRefs[slot]}),Layout=function({children,persistenceKey,storage,rules=_rules.DEFAULT_LAYOUT_RULES,additionalRulesData}){let[declared,setDeclared]=(0,_react.useState)({}),layout=(0,_useLayout.useLayout)(),{state:layoutState,...panelCallbacks}=layout;(0,_useLayoutRules.useLayoutRules)({layout,declared,rules,additionalData:additionalRulesData});let{dispatch}=(0,_context.useLayoutStore)(),persistence=(0,_context.useLayoutPersistence)(),resolvedKey=persistenceKey??persistence.persistenceKey,resolvedStorage=storage??persistence.storage,{isMobile}=(0,_useBreakpoints.useBreakpoints)(),showMobileSplitStack=(0,_useMobileSplitView.useMobileSplitViewEnabled)(),[mobileSplitStackHost,setMobileSplitStackHost]=(0,_react.useState)(null),[splitCount,setSplitCount]=(0,_react.useState)(0),registerSplit=(0,_react.useCallback)(()=>(setSplitCount(count=>count+1),()=>setSplitCount(count=>count-1)),[]),mobileSplitStack=(0,_react.useMemo)(()=>({host:mobileSplitStackHost,isSplitPresent:splitCount>0,registerSplit}),[mobileSplitStackHost,splitCount,registerSplit]),panelsEnabled=(0,_context.useLayoutPanelsEnabled)(),rightPanelVariant=layoutState[_constants.Slot.rightPanel].variant??declared[_constants.Slot.rightPanel]?.variant??"sidebar",isRightPanelFloating=!0===panelsEnabled&&!isMobile&&"float"===rightPanelVariant,hasOffcanvasLeftBar=!!declared[_constants.Slot.leftPanel]&&"offcanvas"===layoutState[_constants.Slot.leftPanel].variant,isShown=slot=>layoutState[slot].visible&&!(slot===_constants.Slot.rightPanel&&(isRightPanelFloating||isMobile))&&!(slot===_constants.Slot.leftPanel&&hasOffcanvasLeftBar),[present,setPresent]=(0,_react.useState)({}),presence=(0,_react.useMemo)(()=>({setPresent:(slot,isPresent)=>setPresent(prev=>prev[slot]===isPresent?prev:{...prev,[slot]:isPresent})}),[]),panelHandles=(0,_react.useRef)({}),panelElements=(0,_react.useRef)({}),resizeSuppressed=(0,_react.useRef)({}),animationControl=(0,_react.useMemo)(()=>({setHandle:(slot,handle)=>{panelHandles.current[slot]=handle},getHandle:slot=>panelHandles.current[slot]??null,setElement:(slot,element)=>{panelElements.current[slot]=element},getElement:slot=>panelElements.current[slot]??null,setResizeSuppressed:(slot,suppressed)=>{resizeSuppressed.current[slot]=suppressed}}),[]),panelRefCallbacks=(0,_react.useMemo)(()=>{let handleCallbacks=new Map,elementCallbacks=new Map;return{handleFor:id=>{let callback=handleCallbacks.get(id);return callback||(callback=handle=>animationControl.setHandle(id,handle),handleCallbacks.set(id,callback)),callback},elementFor:id=>{let callback=elementCallbacks.get(id);return callback||(callback=element=>animationControl.setElement(id,element),elementCallbacks.set(id,callback)),callback}}},[animationControl]),shouldSuppressLayoutCallback=(0,_react.useCallback)(()=>Object.values(resizeSuppressed.current).some(Boolean),[]),registry=(0,_react.useMemo)(()=>({register:(slot,reg)=>setDeclared(prev=>({...prev,[slot]:reg})),unregister:slot=>setDeclared(prev=>{if(!(slot in prev))return prev;let next={...prev};return delete next[slot],next})}),[]),{portalTargets,slotHosts,slotHostRefs,floatHostRef}=(0,_usePortalTargets.usePortalTargets)({slots:_constants.PANEL_ORDER,floatableSlot:_constants.Slot.rightPanel,isFloating:isRightPanelFloating});useGlobalCssVariables(slotHosts);let rowSlots=_constants.PANEL_ORDER.filter(slot=>slot!==_constants.Slot.splitview),declaredSlots=rowSlots.filter(slot=>declared[slot]),isSolo=declaredSlots.length<=1,soloSlot=declaredSlots[0],isSplitOpen=isPanelPresent({slot:_constants.Slot.splitview,declared,present,isShown})&&isPanelPresent({slot:_constants.Slot.content,declared,present,isShown}),contentColumn=_react.default.createElement(StyledContentColumn,{isSplitOpen:isSplitOpen},_react.default.createElement(StyledContentColumnHalf,{ref:slotHostRefs[_constants.Slot.content]}),isSplitOpen&&_react.default.createElement(StyledContentColumnHalf,{ref:slotHostRefs[_constants.Slot.splitview]})),panelItems=rowSlots.filter(slot=>isPanelPresent({slot,declared,present,isShown})).map(slot=>{let panel=declared[slot],panelState=layoutState[slot];return{id:slot,child:childFor(slot,contentColumn,slotHostRefs),defaultSize:defaultSizeFor({slot,panel,panelState}),minSize:panel?.minSize??panelState.minSize,maxSize:panel?.maxSize??panelState.maxSize,collapsible:slot!==_constants.Slot.content&&(panel?.collapsible??!0),lockWidthOnWindowResize:panel?.lockWidthOnWindowResize,resizable:panel?.resizable??resizableFromState(panelState)}}),soloHost=soloSlot&&isShown(soloSlot)?childFor(soloSlot,contentColumn,slotHostRefs):null,panelGroup=panelItems.length>0?_react.default.createElement(_Panel.Panel,{key:resolvedKey,panels:panelItems,persistenceKey:resolvedKey,storage:resolvedStorage,onResize:(id,size)=>{isShown(id)&&dispatch({type:"resize",slot:id,size})},onCollapse:id=>panelCallbacks[id].hide(),panelHandleFor:panelRefCallbacks.handleFor,panelElementFor:panelRefCallbacks.elementFor,shouldSuppressLayoutCallback:shouldSuppressLayoutCallback}):null;return _react.default.createElement(_registry.PanelRegistryContext.Provider,{value:registry},_react.default.createElement(_registry.PanelDeclarationsContext.Provider,{value:declared},_react.default.createElement(_registry.PanelPresenceContext.Provider,{value:presence},_react.default.createElement(_registry.PanelAnimationContext.Provider,{value:animationControl},_react.default.createElement(_registry.LayoutPortalContext.Provider,{value:portalTargets},_react.default.createElement(_LayoutFloatDragProvider.LayoutFloatDragProvider,null,_react.default.createElement(_useMobileSplitStack.MobileSplitStackContext.Provider,{value:mobileSplitStack},_react.default.createElement(StyledLayout,{"data-ds-id":"Layout"},_react.default.createElement(StyledPanelRow,{hasOffcanvasLeftBar:hasOffcanvasLeftBar},isSolo?soloHost:panelGroup),isRightPanelFloating&&layoutState[_constants.Slot.rightPanel].visible&&_react.default.createElement(_LayoutFloat.LayoutFloat,{hostRef:floatHostRef}),children,showMobileSplitStack&&_react.default.createElement(StyledMobileSplitStackHost,{ref:setMobileSplitStackHost})))))))))};Layout.Provider=_LayoutProvider.LayoutProvider,Layout.LeftPanel=_LeftPanel.LeftPanel,Layout.LeftNavBar=_LeftNavBar.LeftNavBar,Layout.LeftNavBarFooter=_LeftNavBarFooter.LeftNavBarFooter,Layout.LeftPanelHeader=_LeftPanelHeader.LeftPanelHeader,Layout.LeftPanelFooter=_LeftPanelFooter.LeftPanelFooter,Layout.RightPanel=_RightPanel.RightPanel,Layout.RightPanelHeader=_RightPanelHeader.RightPanelHeader,Layout.RightPanelFooter=_RightPanelFooter.RightPanelFooter,Layout.Content=_Content.Content,Layout.Split=_Split.Split,Layout.SplitHeader=_SplitHeader.SplitHeader,Layout.SplitFooter=_SplitFooter.SplitFooter;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var target=exports,all={get Layout(){return Layout},get PANEL_HOST_DS_ID(){return PANEL_HOST_DS_ID}};for(var name in all)Object.defineProperty(target,name,{enumerable:!0,get:Object.getOwnPropertyDescriptor(all,name).get});const _interop_require_default=require("@swc/helpers/_/_interop_require_default"),_react=/*#__PURE__*/require("@swc/helpers/_/_interop_require_wildcard")._(require("react")),_styled=/*#__PURE__*/_interop_require_default._(require("@emotion/styled")),_Panel=require("../Internal/Panel/Panel"),_LayoutFloat=require("../Internal/LayoutFloat/LayoutFloat"),_useBreakpoints=require("../../shared/useBreakpoints"),_constants=require("./-constants"),_context=require("./context"),_useMobileSplitStack=require("./Split/MobileSplitView/useMobileSplitStack"),_useMobileSplitView=require("./Split/MobileSplitView/useMobileSplitView"),_LayoutProvider=require("./LayoutProvider"),_Content=require("./Content/Content"),_RightPanel=require("./RightPanel/RightPanel"),_RightPanelHeader=require("./RightPanel/RightPanelHeader"),_RightPanelFooter=require("./RightPanel/RightPanelFooter"),_LeftPanel=require("./LeftPanel/LeftPanel"),_LeftPanelHeader=require("./LeftPanel/LeftPanelHeader"),_LeftPanelFooter=require("./LeftPanel/LeftPanelFooter"),_Split=require("./Split/Split"),_SplitHeader=require("./Split/SplitHeader"),_SplitFooter=require("./Split/SplitFooter"),_registry=require("./registry"),_usePortalTargets=require("./usePortalTargets"),_LayoutFloatDragProvider=require("../Internal/LayoutFloat/LayoutFloatDragProvider"),_LayoutCssVars=require("./LayoutCssVars"),_useLayout=require("./useLayout"),_useLayoutRules=require("./useLayoutRules"),_rules=require("./rules"),resizableFromState=slotState=>"sidePanel"===slotState.kind?slotState.resizable:void 0,useGlobalCssVariables=slotHosts=>{let leftPanelWidthCssVar=(0,_LayoutCssVars.useLayoutVar)(_constants.PANEL_WIDTH_VAR.leftPanel),contentWidthCssVar=(0,_LayoutCssVars.useLayoutVar)(_constants.PANEL_WIDTH_VAR.content),rightPanelWidthCssVar=(0,_LayoutCssVars.useLayoutVar)(_constants.PANEL_WIDTH_VAR.rightPanel);(0,_react.useEffect)(()=>{let targets=[[_constants.Slot.leftPanel,leftPanelWidthCssVar],[_constants.Slot.content,contentWidthCssVar],[_constants.Slot.rightPanel,rightPanelWidthCssVar]],observers=[];return targets.forEach(([slot,handle])=>{let node=slotHosts[slot]??null;if(!node)return void handle.set("0px");let publishNodeWidth=()=>handle.set(`${node.getBoundingClientRect().width}px`);if(publishNodeWidth(),"undefined"==typeof ResizeObserver)return;let observer=new ResizeObserver(publishNodeWidth);observer.observe(node),observers.push(observer)}),()=>observers.forEach(observer=>observer.disconnect())},[leftPanelWidthCssVar,contentWidthCssVar,rightPanelWidthCssVar,slotHosts])},StyledLayout=(0,_styled.default)("div",{target:"e1kuzc310",label:"StyledLayout"})({position:"relative",height:"100%",width:"100%"}),StyledPanelHost=(0,_styled.default)("div",{target:"e1kuzc311",label:"StyledPanelHost"})({position:"relative",height:"100%",width:"100%"}),PANEL_HOST_DS_ID="PanelHost",StyledContentColumn=(0,_styled.default)("div",{shouldForwardProp:prop=>"isSplitOpen"!==prop,target:"e1kuzc312",label:"StyledContentColumn"})(({isSplitOpen,theme})=>({display:"flex",height:`calc(100% - ${_constants.PAGE_BOTTOM_BAR_INSET})`,width:"100%",...isSplitOpen&&{maxWidth:theme.variables.layout.split.maxWidth.default,marginInline:"auto",gap:theme.variables.size.spacing.xxs}})),StyledContentColumnHalf=(0,_styled.default)("div",{target:"e1kuzc313",label:"StyledContentColumnHalf"})({position:"relative",height:"100%",flex:"1 1 0",minWidth:0}),StyledMobileSplitStackHost=(0,_styled.default)("div",{target:"e1kuzc314",label:"StyledMobileSplitStackHost"})({position:"absolute",top:0,left:0,right:0,bottom:_constants.PAGE_BOTTOM_BAR_INSET,overflow:"hidden",pointerEvents:"none"}),isPanelPresent=({slot,declared,present,isShown})=>!!declared[slot]&&(isShown(slot)||present[slot]),defaultSizeFor=({slot,panel,panelState})=>slot===_constants.Slot.content?void 0:panel?.defaultSize!==void 0?panel.defaultSize:panel?.resizable!==!1?panelState.size:void 0,childFor=(slot,contentColumn,slotHostRefs)=>slot===_constants.Slot.content?contentColumn:_react.default.createElement(StyledPanelHost,{"data-ds-id":PANEL_HOST_DS_ID,ref:slotHostRefs[slot]}),Layout=function({children,persistenceKey,storage,rules=_rules.DEFAULT_LAYOUT_RULES,additionalRulesData}){let[declared,setDeclared]=(0,_react.useState)({}),layout=(0,_useLayout.useLayout)(),{state:layoutState,...panelCallbacks}=layout;(0,_useLayoutRules.useLayoutRules)({layout,declared,rules,additionalData:additionalRulesData});let{dispatch}=(0,_context.useLayoutStore)(),persistence=(0,_context.useLayoutPersistence)(),resolvedKey=persistenceKey??persistence.persistenceKey,resolvedStorage=storage??persistence.storage,{isMobile}=(0,_useBreakpoints.useBreakpoints)(),showMobileSplitStack=(0,_useMobileSplitView.useMobileSplitViewEnabled)(),[mobileSplitStackHost,setMobileSplitStackHost]=(0,_react.useState)(null),[splitCount,setSplitCount]=(0,_react.useState)(0),registerSplit=(0,_react.useCallback)(()=>(setSplitCount(count=>count+1),()=>setSplitCount(count=>count-1)),[]),mobileSplitStack=(0,_react.useMemo)(()=>({host:mobileSplitStackHost,isSplitPresent:splitCount>0,registerSplit}),[mobileSplitStackHost,splitCount,registerSplit]),panelsEnabled=(0,_context.useLayoutPanelsEnabled)(),rightPanelVariant=layoutState[_constants.Slot.rightPanel].variant??declared[_constants.Slot.rightPanel]?.variant??"sidebar",isRightPanelFloating=!0===panelsEnabled&&!isMobile&&"float"===rightPanelVariant,isShown=slot=>layoutState[slot].visible&&!(slot===_constants.Slot.rightPanel&&(isRightPanelFloating||isMobile)),[present,setPresent]=(0,_react.useState)({}),presence=(0,_react.useMemo)(()=>({setPresent:(slot,isPresent)=>setPresent(prev=>prev[slot]===isPresent?prev:{...prev,[slot]:isPresent})}),[]),panelHandles=(0,_react.useRef)({}),panelElements=(0,_react.useRef)({}),resizeSuppressed=(0,_react.useRef)({}),animationControl=(0,_react.useMemo)(()=>({setHandle:(slot,handle)=>{panelHandles.current[slot]=handle},getHandle:slot=>panelHandles.current[slot]??null,setElement:(slot,element)=>{panelElements.current[slot]=element},getElement:slot=>panelElements.current[slot]??null,setResizeSuppressed:(slot,suppressed)=>{resizeSuppressed.current[slot]=suppressed}}),[]),panelRefCallbacks=(0,_react.useMemo)(()=>{let handleCallbacks=new Map,elementCallbacks=new Map;return{handleFor:id=>{let callback=handleCallbacks.get(id);return callback||(callback=handle=>animationControl.setHandle(id,handle),handleCallbacks.set(id,callback)),callback},elementFor:id=>{let callback=elementCallbacks.get(id);return callback||(callback=element=>animationControl.setElement(id,element),elementCallbacks.set(id,callback)),callback}}},[animationControl]),shouldSuppressLayoutCallback=(0,_react.useCallback)(()=>Object.values(resizeSuppressed.current).some(Boolean),[]),registry=(0,_react.useMemo)(()=>({register:(slot,reg)=>setDeclared(prev=>({...prev,[slot]:reg})),unregister:slot=>setDeclared(prev=>{if(!(slot in prev))return prev;let next={...prev};return delete next[slot],next})}),[]),{portalTargets,slotHosts,slotHostRefs,floatHostRef}=(0,_usePortalTargets.usePortalTargets)({slots:_constants.PANEL_ORDER,floatableSlot:_constants.Slot.rightPanel,isFloating:isRightPanelFloating});useGlobalCssVariables(slotHosts);let rowSlots=_constants.PANEL_ORDER.filter(slot=>slot!==_constants.Slot.splitview),declaredSlots=rowSlots.filter(slot=>declared[slot]),isSolo=declaredSlots.length<=1,soloSlot=declaredSlots[0],isSplitOpen=isPanelPresent({slot:_constants.Slot.splitview,declared,present,isShown})&&isPanelPresent({slot:_constants.Slot.content,declared,present,isShown}),contentColumn=_react.default.createElement(StyledContentColumn,{isSplitOpen:isSplitOpen},_react.default.createElement(StyledContentColumnHalf,{ref:slotHostRefs[_constants.Slot.content]}),isSplitOpen&&_react.default.createElement(StyledContentColumnHalf,{ref:slotHostRefs[_constants.Slot.splitview]})),panelItems=rowSlots.filter(slot=>isPanelPresent({slot,declared,present,isShown})).map(slot=>{let panel=declared[slot],panelState=layoutState[slot];return{id:slot,child:childFor(slot,contentColumn,slotHostRefs),defaultSize:defaultSizeFor({slot,panel,panelState}),minSize:panel?.minSize??panelState.minSize,maxSize:panel?.maxSize??panelState.maxSize,collapsible:slot!==_constants.Slot.content&&(panel?.collapsible??!0),lockWidthOnWindowResize:panel?.lockWidthOnWindowResize,resizable:panel?.resizable??resizableFromState(panelState)}}),soloHost=soloSlot&&isShown(soloSlot)?childFor(soloSlot,contentColumn,slotHostRefs):null,panelGroup=panelItems.length>0?_react.default.createElement(_Panel.Panel,{key:resolvedKey,panels:panelItems,persistenceKey:resolvedKey,storage:resolvedStorage,onResize:(id,size)=>dispatch({type:"resize",slot:id,size}),onCollapse:id=>panelCallbacks[id].hide(),panelHandleFor:panelRefCallbacks.handleFor,panelElementFor:panelRefCallbacks.elementFor,shouldSuppressLayoutCallback:shouldSuppressLayoutCallback}):null;return _react.default.createElement(_registry.PanelRegistryContext.Provider,{value:registry},_react.default.createElement(_registry.PanelDeclarationsContext.Provider,{value:declared},_react.default.createElement(_registry.PanelPresenceContext.Provider,{value:presence},_react.default.createElement(_registry.PanelAnimationContext.Provider,{value:animationControl},_react.default.createElement(_registry.LayoutPortalContext.Provider,{value:portalTargets},_react.default.createElement(_LayoutFloatDragProvider.LayoutFloatDragProvider,null,_react.default.createElement(_useMobileSplitStack.MobileSplitStackContext.Provider,{value:mobileSplitStack},_react.default.createElement(StyledLayout,{"data-ds-id":"Layout"},isSolo?soloHost:panelGroup,isRightPanelFloating&&layoutState[_constants.Slot.rightPanel].visible&&_react.default.createElement(_LayoutFloat.LayoutFloat,{hostRef:floatHostRef}),children,showMobileSplitStack&&_react.default.createElement(StyledMobileSplitStackHost,{ref:setMobileSplitStackHost})))))))))};Layout.Provider=_LayoutProvider.LayoutProvider,Layout.LeftPanel=_LeftPanel.LeftPanel,Layout.LeftPanelHeader=_LeftPanelHeader.LeftPanelHeader,Layout.LeftPanelFooter=_LeftPanelFooter.LeftPanelFooter,Layout.RightPanel=_RightPanel.RightPanel,Layout.RightPanelHeader=_RightPanelHeader.RightPanelHeader,Layout.RightPanelFooter=_RightPanelFooter.RightPanelFooter,Layout.Content=_Content.Content,Layout.Split=_Split.Split,Layout.SplitHeader=_SplitHeader.SplitHeader,Layout.SplitFooter=_SplitFooter.SplitFooter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"LeftPanel",{enumerable:!0,get:function(){return LeftPanel}});const _react=/*#__PURE__*/require("@swc/helpers/_/
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"LeftPanel",{enumerable:!0,get:function(){return LeftPanel}});const _react=/*#__PURE__*/require("@swc/helpers/_/_interop_require_default")._(require("react")),_constants=require("../-constants"),_registry=require("../registry"),_useLayout=require("../useLayout"),_context=require("../context"),_LeftPanelDocked=require("./LeftPanelDocked"),_LeftPanelDrawer=require("./LeftPanelDrawer"),LeftPanel=({children,defaultSize,minSize,maxSize,collapsible=!0,resizable,onVisibleChange,"aria-label":ariaLabel,scrollContainerRef,onScroll})=>{let{isVisible,hide,state}=(0,_useLayout.useLayout)()[_constants.Slot.leftPanel],canRender=(0,_context.useCanRenderPanel)();(0,_registry.useVisibleChange)(isVisible,onVisibleChange);let isDrawer="drawer"===state.variant;return canRender?isDrawer?_react.default.createElement(_LeftPanelDrawer.LeftPanelDrawer,{isVisible:isVisible,hide:hide,"aria-label":ariaLabel,scrollContainerRef:scrollContainerRef,onScroll:onScroll},children):_react.default.createElement(_LeftPanelDocked.LeftPanelDocked,{"aria-label":ariaLabel,defaultSize:defaultSize,minSize:minSize,maxSize:maxSize,collapsible:collapsible,resizable:resizable,scrollContainerRef:scrollContainerRef,onScroll:onScroll},children):null};
|
|
@@ -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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
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
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"LeftPanelDocked",{enumerable:!0,get:function(){return LeftPanelDocked}});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"LeftPanelDocked",{enumerable:!0,get:function(){return LeftPanelDocked}});const _react=/*#__PURE__*/require("@swc/helpers/_/_interop_require_default")._(require("react")),_constants=require("../-constants"),_registry=require("../registry"),_usePanelDockedSlide=require("../usePanelDockedSlide"),_PanelSlideBody=require("../PanelSlideBody"),_PanelContainer=require("../PanelContainer"),LeftPanelDocked=({children,"aria-label":ariaLabel,defaultSize,minSize,maxSize,collapsible=!0,resizable,scrollContainerRef,onScroll})=>{let{isMounted,pinnedWidth}=(0,_usePanelDockedSlide.usePanelDockedSlide)({slot:_constants.Slot.leftPanel,defaultSize,minSize,maxSize,collapsible,resizable,lockWidthOnWindowResize:!0});return(0,_registry.useLayoutPortal)(_constants.Slot.leftPanel,isMounted?_react.default.createElement(_PanelSlideBody.PanelSlideBody,{anchor:"right",pinnedWidth:pinnedWidth},_react.default.createElement(_PanelContainer.PanelContainer,{showBorderRight:!0,"aria-label":ariaLabel,scrollContainerRef:scrollContainerRef,onScroll:onScroll},children)):null)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"LeftPanelDrawer",{enumerable:!0,get:function(){return LeftPanelDrawer}});const _interop_require_default=require("@swc/helpers/_/_interop_require_default"),_react=/*#__PURE__*/_interop_require_default._(require("react")),_styled=/*#__PURE__*/_interop_require_default._(require("@emotion/styled")),_Drawer=require("../../Internal/Drawer/Drawer"),_PanelContainer=require("../PanelContainer"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"LeftPanelDrawer",{enumerable:!0,get:function(){return LeftPanelDrawer}});const _interop_require_default=require("@swc/helpers/_/_interop_require_default"),_react=/*#__PURE__*/_interop_require_default._(require("react")),_styled=/*#__PURE__*/_interop_require_default._(require("@emotion/styled")),_Drawer=require("../../Internal/Drawer/Drawer"),_PanelContainer=require("../PanelContainer"),StyledLeftPanelBody=(0,_styled.default)("div",{target:"e1pciy730",label:"StyledLeftPanelBody"})({width:"80vw",height:"100dvh"}),LeftPanelDrawer=({children,isVisible,hide,"aria-label":ariaLabel,scrollContainerRef,onScroll})=>_react.default.createElement(_Drawer.Drawer,{isVisible:isVisible,positionX:"left",handleClose:hide,"aria-label":ariaLabel},_react.default.createElement(StyledLeftPanelBody,null,_react.default.createElement(_PanelContainer.PanelContainer,{scrollContainerRef:scrollContainerRef,onScroll:onScroll},children)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"LeftPanelFooter",{enumerable:!0,get:function(){return LeftPanelFooter}});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"LeftPanelFooter",{enumerable:!0,get:function(){return LeftPanelFooter}});const _react=/*#__PURE__*/require("@swc/helpers/_/_interop_require_default")._(require("react")),_Sandwich=require("../../Internal/Sandwich/Sandwich");function LeftPanelFooter({children,"data-e2e-test-id":dataE2eTestId}){return _react.default.createElement(_Sandwich.Sandwich.Footer,{"data-e2e-test-id":dataE2eTestId},children)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"LeftPanelHeader",{enumerable:!0,get:function(){return LeftPanelHeader}});const _react=/*#__PURE__*/require("@swc/helpers/_/_interop_require_default")._(require("react")),_Sandwich=require("../../Internal/Sandwich/Sandwich"),_PanelHeader=require("../../Internal/PanelHeader/PanelHeader")
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"LeftPanelHeader",{enumerable:!0,get:function(){return LeftPanelHeader}});const _react=/*#__PURE__*/require("@swc/helpers/_/_interop_require_default")._(require("react")),_Sandwich=require("../../Internal/Sandwich/Sandwich"),_PanelHeader=require("../../Internal/PanelHeader/PanelHeader");function LeftPanelHeader({leftSlot,rightSlot,"data-e2e-test-id":dataE2eTestId}){return _react.default.createElement(_Sandwich.Sandwich.Header,{"data-e2e-test-id":dataE2eTestId},_react.default.createElement(_PanelHeader.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
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"PanelSlideBody",{enumerable:!0,get:function(){return PanelSlideBody}});const _interop_require_default=require("@swc/helpers/_/_interop_require_default"),_react=/*#__PURE__*/_interop_require_default._(require("react")),_styled=/*#__PURE__*/_interop_require_default._(require("@emotion/styled")),_constants=require("./-constants"),StyledPanelSlideClip=(0,_styled.default)("div",{target:"e1mhh3wi0",label:"StyledPanelSlideClip"})({position:"relative",width:"100%",height:`calc(100% - ${_constants.PAGE_BOTTOM_BAR_INSET})`,overflow:"hidden"}),StyledPanelSlideBody=(0,_styled.default)("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`}})),PanelSlideBody=({pinnedWidth,anchor,children})=>_react.default.createElement(StyledPanelSlideClip,null,_react.default.createElement(StyledPanelSlideBody,{pinnedWidth:pinnedWidth,anchor:anchor},children));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"DEFAULT_LAYOUT_RULES",{enumerable:!0,get:function(){return DEFAULT_LAYOUT_RULES}});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"DEFAULT_LAYOUT_RULES",{enumerable:!0,get:function(){return DEFAULT_LAYOUT_RULES}});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
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"useLayoutRules",{enumerable:!0,get:function(){return useLayoutRules}});const _react=require("react"),_useBreakpoints=require("../../shared/useBreakpoints"),_constants=require("./-constants"),DEFAULT_PRIORITY={[_constants.Slot.rightPanel]:1,[_constants.Slot.splitview]:2,[_constants.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===_constants.Slot.rightPanel?"float"!==state.rightPanel.variant:slot!==_constants.Slot.leftPanel||"
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"useLayoutRules",{enumerable:!0,get:function(){return useLayoutRules}});const _react=require("react"),_useBreakpoints=require("../../shared/useBreakpoints"),_constants=require("./-constants"),DEFAULT_PRIORITY={[_constants.Slot.rightPanel]:1,[_constants.Slot.splitview]:2,[_constants.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===_constants.Slot.rightPanel?"float"!==state.rightPanel.variant:slot!==_constants.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:_constants.PANEL_ORDER.indexOf(slot)<_constants.PANEL_ORDER.indexOf(other)},countStrongerDocked=slot=>_constants.TOGGLABLE_SLOTS.filter(other=>other!==slot&&isDockedPanel({state,declared,slot:other})&&outranks(other,slot)).length;return _constants.TOGGLABLE_SLOTS.filter(slot=>countStrongerDocked(slot)>=freeSlots)};function useLayoutRules({layout,declared,rules,additionalData}){let layoutRef=(0,_react.useRef)(layout);layoutRef.current=layout;let{isMobile,isTablet,isDesktop}=(0,_useBreakpoints.useBreakpoints)(),{state}=layout;(0,_react.useEffect)(()=>{if(!rules)return;let lowPrioSlots=resolveLowPrioSlots({rules,state,declared,breakpoints:{isMobile,isTablet,isDesktop}});_constants.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
|
|
36
|
-
*
|
|
37
|
-
*
|
|
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,
|
|
35
|
+
export declare function usePanelDockedSlide({ slot, defaultSize, minSize, maxSize, collapsible, resizable, lockWidthOnWindowResize, }: PanelDockedSlideOptions): PanelDockedSlide;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"usePanelDockedSlide",{enumerable:!0,get:function(){return usePanelDockedSlide}});const _react=require("react"),_react1=require("@emotion/react"),_useWindow=require("../../shared/useWindow"),_prefersReducedMotion=require("../../shared/prefersReducedMotion"),_registry=require("./registry"),_useLayout=require("./useLayout"),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}}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"usePanelDockedSlide",{enumerable:!0,get:function(){return usePanelDockedSlide}});const _react=require("react"),_react1=require("@emotion/react"),_useWindow=require("../../shared/useWindow"),_prefersReducedMotion=require("../../shared/prefersReducedMotion"),_registry=require("./registry"),_useLayout=require("./useLayout"),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}};function usePanelDockedSlide({slot,defaultSize,minSize,maxSize,collapsible,resizable,lockWidthOnWindowResize}){let{isVisible,state}=(0,_useLayout.useLayout)()[slot],theme=(0,_react1.useTheme)(),window=(0,_useWindow.useWindow)(),animation=(0,_registry.usePanelAnimationControl)(),reducedMotion=(0,_prefersReducedMotion.prefersReducedMotion)(window),[isMounted,setIsMounted]=(0,_react.useState)(isVisible),[phase,setPhase]=(0,_react.useState)("idle"),[pinnedWidth,setPinnedWidth]=(0,_react.useState)(null),[prevVisible,setPrevVisible]=(0,_react.useState)(isVisible);return isVisible!==prevVisible&&(setPrevVisible(isVisible),setPhase(isVisible?"entering":"exiting"),isVisible&&setIsMounted(!0)),(0,_registry.useDeclarePanel)(slot,{defaultSize:"entering"===phase&&collapsible&&!reducedMotion?0:defaultSize,minSize,maxSize,collapsible,resizable,lockWidthOnWindowResize}),(0,_registry.usePanelPresence)(slot,isMounted),(0,_react.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
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var target=exports,all={get getBaseButtonStyles(){return _getBaseButtonStyles.getBaseButtonStyles},get getButtonAppearanceReset(){return _getButtonAppearanceReset.getButtonAppearanceReset},get getDisabledStyles(){return _getDisabledStyles.getDisabledStyles},get getFocusStyles(){return _getFocusStyles.getFocusStyles},get getInputTextPlaceholder(){return _getInputTextPlaceholder.getInputTextPlaceholder},get getInputTextStyles(){return _getInputTextStyles.getInputTextStyles},get
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var target=exports,all={get getBaseButtonStyles(){return _getBaseButtonStyles.getBaseButtonStyles},get getButtonAppearanceReset(){return _getButtonAppearanceReset.getButtonAppearanceReset},get getDisabledStyles(){return _getDisabledStyles.getDisabledStyles},get getFocusStyles(){return _getFocusStyles.getFocusStyles},get getInputTextPlaceholder(){return _getInputTextPlaceholder.getInputTextPlaceholder},get getInputTextStyles(){return _getInputTextStyles.getInputTextStyles},get getPillStyles(){return _getPillStyles.getPillStyles},get getPressedStyles(){return _getPressedStyles.getPressedStyles},get getPrimaryVariantStyles(){return _getVariantStyles.getPrimaryVariantStyles},get getSecondaryVariantStyles(){return _getVariantStyles.getSecondaryVariantStyles},get getTertiaryVariantStyles(){return _getVariantStyles.getTertiaryVariantStyles}};for(var name in all)Object.defineProperty(target,name,{enumerable:!0,get:Object.getOwnPropertyDescriptor(all,name).get});const _getInputTextPlaceholder=require("./TextInput/getInputTextPlaceholder"),_getInputTextStyles=require("./TextInput/getInputTextStyles"),_getDisabledStyles=require("./Button/getDisabledStyles"),_getButtonAppearanceReset=require("./Button/getButtonAppearanceReset"),_getBaseButtonStyles=require("./Button/getBaseButtonStyles"),_getPressedStyles=require("./Button/getPressedStyles"),_getPillStyles=require("./Button/getPillStyles"),_getFocusStyles=require("./getFocusStyles"),_getVariantStyles=require("./Button/getVariantStyles");
|