@amboss/design-system 4.9.4-canary.4 → 4.10.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 (156) hide show
  1. package/build/cjs/components/CheckboxCard/CheckboxCard.d.ts +1 -1
  2. package/build/cjs/components/Content/ContentCheckbox/ContentCheckbox.d.ts +1 -1
  3. package/build/cjs/components/Content/ContentCitation/ContentCitation.d.ts +3 -3
  4. package/build/cjs/components/Content/ContentFontResizer/FontSizeOffsetContext.d.ts +1 -1
  5. package/build/cjs/components/Content/ContentText/ContentText.d.ts +1 -1
  6. package/build/cjs/components/Content/DosageButton/DosageButton.d.ts +1 -1
  7. package/build/cjs/components/DataTable/DataTable.d.ts +3 -2
  8. package/build/cjs/components/DataTable/TableCell.d.ts +1 -1
  9. package/build/cjs/components/DataTable/internal/tablePrimitives.d.ts +3 -3
  10. package/build/cjs/components/EntityList/styled-components.d.ts +8 -8
  11. package/build/cjs/components/Form/Checkbox/Checkbox.d.ts +2 -2
  12. package/build/cjs/components/Form/Combobox/StyledSelectComponents.d.ts +4 -4
  13. package/build/cjs/components/Form/DatePicker/DatePicker.d.ts +1 -1
  14. package/build/cjs/components/Form/MaskedInput/MaskedInput.d.ts +1 -1
  15. package/build/cjs/components/Form/Radio/Radio.d.ts +2 -2
  16. package/build/cjs/components/Form/RangeInput/RangeInput.d.ts +1 -1
  17. package/build/cjs/components/Form/Textarea/Textarea.d.ts +2 -2
  18. package/build/cjs/components/Form/Toggle/Toggle.d.ts +3 -3
  19. package/build/cjs/components/Form/ToggleButton/ToggleButton.d.ts +1 -1
  20. package/build/cjs/components/Grid/Grid.d.ts +1 -1
  21. package/build/cjs/components/Internal/Drawer/Drawer.js +3 -3
  22. package/build/cjs/components/Internal/LayoutFloat/LayoutFloat.d.ts +13 -1
  23. package/build/cjs/components/Internal/LayoutFloat/useLayoutFloatDrag.d.ts +1 -1
  24. package/build/cjs/components/Internal/Sandwich/useSandwichContext.d.ts +1 -1
  25. package/build/cjs/components/Layout/-types.d.ts +9 -0
  26. package/build/{esm/components/Layout/BottomBar → cjs/components/Layout/BottomBar/BottomBarItem}/LayoutBottomBarItem.d.ts +1 -1
  27. package/build/cjs/components/Layout/BottomBar/LayoutBottomBar.d.ts +2 -10
  28. package/build/cjs/components/Layout/BottomBar/StyledLayoutBottomBar.d.ts +1 -1
  29. package/build/cjs/components/Layout/BottomBar/StyledLayoutBottomBarSection.d.ts +2 -2
  30. package/build/cjs/components/Layout/BottomBar/StyledLayoutBottomBarSection.js +1 -1
  31. package/build/cjs/components/Layout/BottomBar/getBottomBarLayout.d.ts +1 -1
  32. package/build/cjs/components/Layout/BottomBar/getBottomBarLayout.js +1 -1
  33. package/build/cjs/components/Layout/Layout.d.ts +1 -1
  34. package/build/cjs/components/Layout/Layout.js +1 -1
  35. package/build/cjs/components/Layout/LeftPanel/useLeftBarContext.d.ts +1 -1
  36. package/build/cjs/components/Layout/LeftPanel/useLeftPanelCollapseContext.d.ts +1 -1
  37. package/build/cjs/components/Layout/Split/MobileSplitView/StyledMobileSplitSlideLayer.d.ts +1 -1
  38. package/build/cjs/components/Layout/Split/MobileSplitView/useMobileSplitStack.d.ts +1 -1
  39. package/build/cjs/components/Layout/context.d.ts +2 -2
  40. package/build/cjs/components/Layout/index.d.ts +0 -1
  41. package/build/cjs/components/Layout/registry.d.ts +6 -6
  42. package/build/cjs/components/Layout/useLeftPanelId.d.ts +1 -1
  43. package/build/cjs/components/Layout/usePanelAnimations.d.ts +1 -1
  44. package/build/cjs/components/NavBar/NavBar.d.ts +14 -18
  45. package/build/cjs/components/NavBar/NavBarContext.d.ts +1 -1
  46. package/build/cjs/components/NavBar/NavBarDropdownTriggerButton.d.ts +1 -1
  47. package/build/cjs/components/Patterns/Dialog/DialogContext.d.ts +1 -1
  48. package/build/cjs/components/Patterns/EmptyState/EmptyState.d.ts +2 -2
  49. package/build/cjs/components/Patterns/Modal/Modal.d.ts +4 -2
  50. package/build/cjs/components/Patterns/Popover/PopoverContext.d.ts +1 -1
  51. package/build/cjs/components/PromptInput/PromptInput.d.ts +1 -1
  52. package/build/cjs/components/RadioCard/RadioCard.d.ts +1 -1
  53. package/build/cjs/components/SearchResult/SearchResult.d.ts +3 -1
  54. package/build/cjs/components/Sheet/Sheet.js +1 -1
  55. package/build/cjs/components/Sheet/useSheetHeightSync.d.ts +26 -0
  56. package/build/cjs/components/Sheet/useSheetHeightSync.js +1 -0
  57. package/build/cjs/components/SubThemeProvider/SubThemeContext.d.ts +1 -1
  58. package/build/cjs/components/Tooltip/FloatingPositionedContext.d.ts +1 -1
  59. package/build/cjs/components/Utilities/ContainerQuery/ContainerQueryContext.d.ts +1 -1
  60. package/build/cjs/components/Utilities/ScreenReaderText/ScreenReaderText.d.ts +1 -1
  61. package/build/cjs/components/VirtualScrollList/VirtualScrollList.js +1 -1
  62. package/build/cjs/components/VirtualScrollList/VirtualScrollListReducer.d.ts +8 -1
  63. package/build/cjs/components/VirtualScrollList/VirtualScrollListReducer.js +1 -1
  64. package/build/cjs/shared/FocusTrapWrapper.d.ts +1 -1
  65. package/build/cjs/shared/FocusTrapWrapper.js +1 -1
  66. package/build/cjs/shared/components/SelectableButton.d.ts +1 -1
  67. package/build/cjs/shared/useExitAnimation.js +1 -0
  68. package/build/cjs/web-tokens/_sizes.json +55 -55
  69. package/build/cjs/web-tokens/visualConfig.d.ts +14 -0
  70. package/build/cjs/web-tokens/visualConfig.js +1 -1
  71. package/build/esm/components/CheckboxCard/CheckboxCard.d.ts +1 -1
  72. package/build/esm/components/Content/ContentCheckbox/ContentCheckbox.d.ts +1 -1
  73. package/build/esm/components/Content/ContentCitation/ContentCitation.d.ts +3 -3
  74. package/build/esm/components/Content/ContentFontResizer/FontSizeOffsetContext.d.ts +1 -1
  75. package/build/esm/components/Content/ContentText/ContentText.d.ts +1 -1
  76. package/build/esm/components/Content/DosageButton/DosageButton.d.ts +1 -1
  77. package/build/esm/components/DataTable/DataTable.d.ts +3 -2
  78. package/build/esm/components/DataTable/TableCell.d.ts +1 -1
  79. package/build/esm/components/DataTable/internal/tablePrimitives.d.ts +3 -3
  80. package/build/esm/components/EntityList/styled-components.d.ts +8 -8
  81. package/build/esm/components/Form/Checkbox/Checkbox.d.ts +2 -2
  82. package/build/esm/components/Form/Combobox/StyledSelectComponents.d.ts +4 -4
  83. package/build/esm/components/Form/DatePicker/DatePicker.d.ts +1 -1
  84. package/build/esm/components/Form/MaskedInput/MaskedInput.d.ts +1 -1
  85. package/build/esm/components/Form/Radio/Radio.d.ts +2 -2
  86. package/build/esm/components/Form/RangeInput/RangeInput.d.ts +1 -1
  87. package/build/esm/components/Form/Textarea/Textarea.d.ts +2 -2
  88. package/build/esm/components/Form/Toggle/Toggle.d.ts +3 -3
  89. package/build/esm/components/Form/ToggleButton/ToggleButton.d.ts +1 -1
  90. package/build/esm/components/Grid/Grid.d.ts +1 -1
  91. package/build/esm/components/Internal/Drawer/Drawer.js +3 -3
  92. package/build/esm/components/Internal/LayoutFloat/LayoutFloat.d.ts +13 -1
  93. package/build/esm/components/Internal/LayoutFloat/useLayoutFloatDrag.d.ts +1 -1
  94. package/build/esm/components/Internal/Sandwich/useSandwichContext.d.ts +1 -1
  95. package/build/esm/components/Layout/-types.d.ts +9 -0
  96. package/build/{cjs/components/Layout/BottomBar → esm/components/Layout/BottomBar/BottomBarItem}/LayoutBottomBarItem.d.ts +1 -1
  97. package/build/esm/components/Layout/BottomBar/LayoutBottomBar.d.ts +2 -10
  98. package/build/esm/components/Layout/BottomBar/StyledLayoutBottomBar.d.ts +1 -1
  99. package/build/esm/components/Layout/BottomBar/StyledLayoutBottomBarSection.d.ts +2 -2
  100. package/build/esm/components/Layout/BottomBar/StyledLayoutBottomBarSection.js +1 -1
  101. package/build/esm/components/Layout/BottomBar/getBottomBarLayout.d.ts +1 -1
  102. package/build/esm/components/Layout/BottomBar/getBottomBarLayout.js +1 -1
  103. package/build/esm/components/Layout/Layout.d.ts +1 -1
  104. package/build/esm/components/Layout/Layout.js +1 -1
  105. package/build/esm/components/Layout/LeftPanel/useLeftBarContext.d.ts +1 -1
  106. package/build/esm/components/Layout/LeftPanel/useLeftPanelCollapseContext.d.ts +1 -1
  107. package/build/esm/components/Layout/Split/MobileSplitView/StyledMobileSplitSlideLayer.d.ts +1 -1
  108. package/build/esm/components/Layout/Split/MobileSplitView/useMobileSplitStack.d.ts +1 -1
  109. package/build/esm/components/Layout/context.d.ts +2 -2
  110. package/build/esm/components/Layout/index.d.ts +0 -1
  111. package/build/esm/components/Layout/registry.d.ts +6 -6
  112. package/build/esm/components/Layout/useLeftPanelId.d.ts +1 -1
  113. package/build/esm/components/Layout/usePanelAnimations.d.ts +1 -1
  114. package/build/esm/components/NavBar/NavBar.d.ts +14 -18
  115. package/build/esm/components/NavBar/NavBarContext.d.ts +1 -1
  116. package/build/esm/components/NavBar/NavBarDropdownTriggerButton.d.ts +1 -1
  117. package/build/esm/components/Patterns/Dialog/DialogContext.d.ts +1 -1
  118. package/build/esm/components/Patterns/EmptyState/EmptyState.d.ts +2 -2
  119. package/build/esm/components/Patterns/Modal/Modal.d.ts +4 -2
  120. package/build/esm/components/Patterns/Popover/PopoverContext.d.ts +1 -1
  121. package/build/esm/components/PromptInput/PromptInput.d.ts +1 -1
  122. package/build/esm/components/RadioCard/RadioCard.d.ts +1 -1
  123. package/build/esm/components/SearchResult/SearchResult.d.ts +3 -1
  124. package/build/esm/components/Sheet/Sheet.js +1 -1
  125. package/build/esm/components/Sheet/useSheetHeightSync.d.ts +26 -0
  126. package/build/esm/components/Sheet/useSheetHeightSync.js +1 -0
  127. package/build/esm/components/SubThemeProvider/SubThemeContext.d.ts +1 -1
  128. package/build/esm/components/Tooltip/FloatingPositionedContext.d.ts +1 -1
  129. package/build/esm/components/Utilities/ContainerQuery/ContainerQueryContext.d.ts +1 -1
  130. package/build/esm/components/Utilities/ScreenReaderText/ScreenReaderText.d.ts +1 -1
  131. package/build/esm/components/VirtualScrollList/VirtualScrollList.js +1 -1
  132. package/build/esm/components/VirtualScrollList/VirtualScrollListReducer.d.ts +8 -1
  133. package/build/esm/components/VirtualScrollList/VirtualScrollListReducer.js +1 -1
  134. package/build/esm/shared/FocusTrapWrapper.d.ts +1 -1
  135. package/build/esm/shared/FocusTrapWrapper.js +1 -1
  136. package/build/esm/shared/components/SelectableButton.d.ts +1 -1
  137. package/build/esm/shared/useExitAnimation.js +1 -0
  138. package/build/esm/web-tokens/_sizes.json +55 -55
  139. package/build/esm/web-tokens/visualConfig.d.ts +14 -0
  140. package/build/esm/web-tokens/visualConfig.js +1 -1
  141. package/build/scss/_variables.scss +6 -0
  142. package/package.json +9 -10
  143. package/build/cjs/components/Internal/Drawer/useExitAnimation.js +0 -1
  144. package/build/cjs/shared/isWithinScrolledElement.d.ts +0 -1
  145. package/build/cjs/shared/isWithinScrolledElement.js +0 -1
  146. package/build/cjs/shared/useDragDown.d.ts +0 -14
  147. package/build/cjs/shared/useDragDown.js +0 -1
  148. package/build/esm/components/Internal/Drawer/useExitAnimation.js +0 -1
  149. package/build/esm/shared/isWithinScrolledElement.d.ts +0 -1
  150. package/build/esm/shared/isWithinScrolledElement.js +0 -1
  151. package/build/esm/shared/useDragDown.d.ts +0 -14
  152. package/build/esm/shared/useDragDown.js +0 -1
  153. /package/build/cjs/components/Layout/BottomBar/{LayoutBottomBarItem.js → BottomBarItem/LayoutBottomBarItem.js} +0 -0
  154. /package/build/cjs/{components/Internal/Drawer → shared}/useExitAnimation.d.ts +0 -0
  155. /package/build/esm/components/Layout/BottomBar/{LayoutBottomBarItem.js → BottomBarItem/LayoutBottomBarItem.js} +0 -0
  156. /package/build/esm/{components/Internal/Drawer → shared}/useExitAnimation.d.ts +0 -0
@@ -1,13 +1,13 @@
1
- import React,{useCallback,useEffect,useRef}from"react";import styled from"@emotion/styled";import{keyframes}from"@emotion/react";import{useOutsideClickDeactivatesWithinPortal}from"../../../shared/useOutsideClickDeactivatesWithinPortal";import{useDocument}from"../../../shared/useDocument";import{FOCUSABLE_SELECTOR}from"../../../shared/focusableSelector";import{Portal,usePortalContainerElement}from"../../Portal/Portal";import{FocusTrapWrapper}from"../../../shared/FocusTrapWrapper";import{DialogContext}from"../../Patterns/Dialog/DialogContext";import{Backdrop}from"../../Utilities/Backdrop/Backdrop";import{useExitAnimation}from"./useExitAnimation";let StyledViewportLayer=styled("div",{target:"e11o9pe90",label:"StyledViewportLayer"})(({theme,isLeaving})=>{let{hidden,visible}=theme.variables.opacity,fadeIn=keyframes`
1
+ import React,{useCallback,useEffect,useRef}from"react";import styled from"@emotion/styled";import{keyframes}from"@emotion/react";import{useOutsideClickDeactivatesWithinPortal}from"../../../shared/useOutsideClickDeactivatesWithinPortal";import{useDocument}from"../../../shared/useDocument";import{FOCUSABLE_SELECTOR}from"../../../shared/focusableSelector";import{Portal,usePortalContainerElement}from"../../Portal/Portal";import{FocusTrapWrapper}from"../../../shared/FocusTrapWrapper";import{DialogContext}from"../../Patterns/Dialog/DialogContext";import{Backdrop}from"../../Utilities/Backdrop/Backdrop";import{useExitAnimation}from"../../../shared/useExitAnimation";let StyledViewportLayer=styled("div",{target:"e1h3k5750",label:"StyledViewportLayer"})(({theme,isLeaving})=>{let{hidden,visible}=theme.variables.opacity,fadeIn=keyframes`
2
2
  from { opacity: ${hidden}; }
3
3
  to { opacity: ${visible}; }
4
4
  `,fadeOut=keyframes`
5
5
  from { opacity: ${visible}; }
6
6
  to { opacity: ${hidden}; }
7
- `,{duration,timingFunction}=theme.variables.animation.modalBackdrop.open;return{position:"fixed",top:0,left:0,zIndex:theme.variables.zIndex.modal,width:"100%",height:"100dvh",animation:`${isLeaving?fadeOut:fadeIn} ${duration} ${timingFunction} both`,"@media (prefers-reduced-motion: reduce)":{animation:"none"}}}),StyledContent=styled("div",{target:"e11o9pe91",label:"StyledContent"})(({theme,positionX,positionY,isLeaving})=>{let restX=positionX?"0%":"-50%",restY=positionY?"0%":"-50%",{x:fromX,y:fromY}="left"===positionX?{x:"-100%",y:restY}:"right"===positionX?{x:"100%",y:restY}:"top"===positionY?{x:restX,y:"-100%"}:"bottom"===positionY?{x:restX,y:"100%"}:{x:restX,y:restY},resting=`translate(${restX}, ${restY})`,offscreen=`translate(${fromX}, ${fromY})`,slideIn=keyframes`
7
+ `,{duration,timingFunction}=theme.variables.animation.modalBackdrop.open;return{position:"fixed",top:0,left:0,zIndex:theme.variables.zIndex.modal,width:"100%",height:"100dvh",animation:`${isLeaving?fadeOut:fadeIn} ${duration} ${timingFunction} both`,"@media (prefers-reduced-motion: reduce)":{animation:"none"}}}),StyledContent=styled("div",{target:"e1h3k5751",label:"StyledContent"})(({theme,positionX,positionY,isLeaving})=>{let restX=positionX?"0%":"-50%",restY=positionY?"0%":"-50%",{x:fromX,y:fromY}="left"===positionX?{x:"-100%",y:restY}:"right"===positionX?{x:"100%",y:restY}:"top"===positionY?{x:restX,y:"-100%"}:"bottom"===positionY?{x:restX,y:"100%"}:{x:restX,y:restY},resting=`translate(${restX}, ${restY})`,offscreen=`translate(${fromX}, ${fromY})`,slideIn=keyframes`
8
8
  from { transform: ${offscreen}; }
9
9
  to { transform: ${resting}; }
10
10
  `,slideOut=keyframes`
11
11
  from { transform: ${resting}; }
12
12
  to { transform: ${offscreen}; }
13
- `,{duration,timingFunction}=theme.variables.animation.navSlide.open;return{position:"fixed",...{..."left"===positionX&&{left:0},..."right"===positionX&&{right:0},...!positionX&&{left:"50%"},..."top"===positionY&&{top:0},..."bottom"===positionY&&{bottom:0},...!positionY&&{top:"50%"}},transform:resting,willChange:"transform",animation:`${isLeaving?slideOut:slideIn} ${duration} ${timingFunction} both`,"@media (prefers-reduced-motion: reduce)":{animation:"none"}}}),StyledBackdrop=styled(Backdrop,{target:"e11o9pe92",label:"StyledBackdrop"})({pointerEvents:"none"});function getFocusTarget(container,document){return container?.querySelector(FOCUSABLE_SELECTOR)??container??document.body}export function Drawer({backdropRef,portalContainer,initialFocus,isDismissible=!0,isVisible=!0,onUnmount,hasBackdrop=!0,positionX,positionY,children,handleClose,privateProps:{skipPortal}={skipPortal:!1},...rest}){let portalContainerElement=usePortalContainerElement(portalContainer),contentRef=useRef(null),document=useDocument(),{isMounted,isLeaving,onAnimationEnd}=useExitAnimation(isVisible),wasMounted=useRef(isMounted);useEffect(()=>{wasMounted.current&&!isMounted&&onUnmount?.(),wasMounted.current=isMounted},[isMounted,onUnmount]);let layerRef=useRef(null),setLayerNode=useCallback(node=>{layerRef.current=node,backdropRef&&(backdropRef.current=node)},[backdropRef]),handleClickOutsideDeactivates=useOutsideClickDeactivatesWithinPortal({portalContainerElement,outerRef:layerRef,isDismissible});if(!isMounted)return null;let content=React.createElement(StyledViewportLayer,{ref:setLayerNode,"data-ds-id":"Drawer",isLeaving:isLeaving},hasBackdrop&&React.createElement(StyledBackdrop,{"data-ds-id":"DrawerBackdrop"}),React.createElement(FocusTrapWrapper,{active:isVisible,focusTrapOptions:{allowOutsideClick:!0,clickOutsideDeactivates:handleClickOutsideDeactivates,escapeDeactivates:isDismissible,preventScroll:!0,initialFocus:()=>{var container;return container=contentRef.current,"string"==typeof initialFocus?initialFocus:initialFocus?.current??getFocusTarget(container,document)},fallbackFocus:()=>getFocusTarget(contentRef.current,document),onPostDeactivate:()=>handleClose?.()}},React.createElement(StyledContent,{...rest,ref:contentRef,positionX:positionX,positionY:positionY,isLeaving:isLeaving,onAnimationEnd:onAnimationEnd,role:"dialog","aria-modal":"true"},children)));return skipPortal?content:React.createElement(DialogContext.Provider,{value:!0},React.createElement(Portal,{portalContainer:portalContainer},content))}
13
+ `,{duration,timingFunction}=theme.variables.animation.navSlide.open;return{position:"fixed",...{..."left"===positionX&&{left:0},..."right"===positionX&&{right:0},...!positionX&&{left:"50%"},..."top"===positionY&&{top:0},..."bottom"===positionY&&{bottom:0},...!positionY&&{top:"50%"}},transform:resting,willChange:"transform",animation:`${isLeaving?slideOut:slideIn} ${duration} ${timingFunction} both`,"@media (prefers-reduced-motion: reduce)":{animation:"none"}}}),StyledBackdrop=styled(Backdrop,{target:"e1h3k5752",label:"StyledBackdrop"})({pointerEvents:"none"});function getFocusTarget(container,document){return container?.querySelector(FOCUSABLE_SELECTOR)??container??document.body}export function Drawer({backdropRef,portalContainer,initialFocus,isDismissible=!0,isVisible=!0,onUnmount,hasBackdrop=!0,positionX,positionY,children,handleClose,privateProps:{skipPortal}={skipPortal:!1},...rest}){let portalContainerElement=usePortalContainerElement(portalContainer),contentRef=useRef(null),document=useDocument(),{isMounted,isLeaving,onAnimationEnd}=useExitAnimation(isVisible),wasMounted=useRef(isMounted);useEffect(()=>{wasMounted.current&&!isMounted&&onUnmount?.(),wasMounted.current=isMounted},[isMounted,onUnmount]);let layerRef=useRef(null),setLayerNode=useCallback(node=>{layerRef.current=node,backdropRef&&(backdropRef.current=node)},[backdropRef]),handleClickOutsideDeactivates=useOutsideClickDeactivatesWithinPortal({portalContainerElement,outerRef:layerRef,isDismissible});if(!isMounted)return null;let content=React.createElement(StyledViewportLayer,{ref:setLayerNode,"data-ds-id":"Drawer",isLeaving:isLeaving},hasBackdrop&&React.createElement(StyledBackdrop,{"data-ds-id":"DrawerBackdrop"}),React.createElement(FocusTrapWrapper,{active:isVisible,focusTrapOptions:{allowOutsideClick:!0,clickOutsideDeactivates:handleClickOutsideDeactivates,escapeDeactivates:isDismissible,preventScroll:!0,initialFocus:()=>{var container;return container=contentRef.current,"string"==typeof initialFocus?initialFocus:initialFocus?.current??getFocusTarget(container,document)},fallbackFocus:()=>getFocusTarget(contentRef.current,document),onPostDeactivate:()=>handleClose?.()}},React.createElement(StyledContent,{...rest,ref:contentRef,positionX:positionX,positionY:positionY,isLeaving:isLeaving,onAnimationEnd:onAnimationEnd,role:"dialog","aria-modal":"true"},children)));return skipPortal?content:React.createElement(DialogContext.Provider,{value:!0},React.createElement(Portal,{portalContainer:portalContainer},content))}
@@ -13,4 +13,16 @@ export type LayoutFloatProps = {
13
13
  hostRef: (el: HTMLDivElement | null) => void;
14
14
  "data-e2e-test-id"?: string;
15
15
  };
16
- export declare const LayoutFloat: React.MemoExoticComponent<({ width, height, hostRef, "data-e2e-test-id": dataE2eTestId, }: LayoutFloatProps) => React.ReactElement>;
16
+ /**
17
+ * The floating shell hosting a layout panel's content while its variant is
18
+ * `"float"`. Pins to the bottom-right viewport corner via the internal
19
+ * `Float` positioner, then becomes freely draggable by its header across the
20
+ * viewport (clamped to `spacing.m` from the edges, matching `Float`'s inset).
21
+ * The header carries the `useMove` handle; this float owns the drag geometry
22
+ * and publishes its move handlers via `useLayoutFloatDrag` for the header to drive.
23
+ * Purely presentational otherwise: the content arrives by the panel's persistent
24
+ * host node being appended into `hostRef`'s element.
25
+ */
26
+ declare const LayoutFloatBase: ({ width, height, hostRef, "data-e2e-test-id": dataE2eTestId, }: LayoutFloatProps) => React.ReactElement;
27
+ export declare const LayoutFloat: React.MemoExoticComponent<typeof LayoutFloatBase>;
28
+ export {};
@@ -10,7 +10,7 @@ export type LayoutFloatDragContextValue = {
10
10
  /** Publish/clear the handlers - for the float. */
11
11
  setHandlers: (handlers: LayoutFloatDragHandlers) => void;
12
12
  };
13
- export declare const LayoutFloatDragContext: React.Context<LayoutFloatDragContextValue>;
13
+ export declare const LayoutFloatDragContext: import("react").Context<LayoutFloatDragContextValue>;
14
14
  /** Read the float-drag channel. Outside a `LayoutFloatDragProvider` the handlers are
15
15
  * `null` and the setter a no-op, so consumers need no existence checks. */
16
16
  export declare const useLayoutFloatDrag: () => LayoutFloatDragContextValue;
@@ -16,6 +16,6 @@ export type SandwichContextValue = SandwichEdges & {
16
16
  /** Static host below the scroll body - `Sandwich.Footer` portals into it. */
17
17
  footerSlotNode: HTMLElement | null;
18
18
  };
19
- export declare const SandwichProvider: React.Provider<SandwichContextValue | null>;
19
+ export declare const SandwichProvider: import("react").Provider<SandwichContextValue | null>;
20
20
  /** Read the Sandwich context, or throw if used outside `<Sandwich>`. */
21
21
  export declare function useSandwichContext(): SandwichContextValue;
@@ -1,4 +1,5 @@
1
1
  import type React from "react";
2
+ import type { ConditionalAccessibleName } from "../../types/a11y";
2
3
  import type { PanelKey, SidePanelKey, SlotKey } from "./-constants";
3
4
  import type { PanelHeaderTitle } from "../Internal/PanelHeader/PanelHeader";
4
5
  import type { SandwichSeparator } from "../Internal/Sandwich/-types";
@@ -496,3 +497,11 @@ export type RightPanelProps = SidePanelProps & {
496
497
  * floating panel isn't part of the resizable row. */
497
498
  collapsible?: boolean;
498
499
  };
500
+ export type LayoutBottomBarProps = ConditionalAccessibleName & {
501
+ /** Layout.BottomBarItem declarations for the page's actions. */
502
+ children: React.ReactNode;
503
+ /** Background of each section; gaps stay transparent. Defaults to transparent. */
504
+ background?: "primary" | "secondary" | "transparent";
505
+ /** Identifier applied to the action group. */
506
+ "data-e2e-test-id"?: string;
507
+ };
@@ -1,5 +1,5 @@
1
1
  import type { FC, ReactNode } from "react";
2
- import type { SlotKey } from "../-types";
2
+ import type { SlotKey } from "../../-types";
3
3
  export type LayoutBottomBarFallback = "hide" | "remaining" | "full";
4
4
  export type LayoutBottomBarItemProps = {
5
5
  /** Layout region whose column the item follows. */
@@ -1,11 +1,3 @@
1
- import { type ReactElement, type ReactNode } from "react";
2
- import type { ConditionalAccessibleName } from "../../../types/a11y";
3
- export type LayoutBottomBarProps = ConditionalAccessibleName & {
4
- /** Layout.BottomBarItem declarations for the page's actions. */
5
- children: ReactNode;
6
- /** Background of each section; gaps stay transparent. Defaults to transparent. */
7
- background?: "primary" | "secondary" | "transparent";
8
- /** Identifier applied to the action group. */
9
- "data-e2e-test-id"?: string;
10
- };
1
+ import { type ReactElement } from "react";
2
+ import type { LayoutBottomBarProps } from "../-types";
11
3
  export declare function LayoutBottomBar({ children, background, "data-e2e-test-id": dataE2eTestId, ...accessibleName }: LayoutBottomBarProps): ReactElement | null;
@@ -7,5 +7,5 @@ type StyledLayoutBottomBarProps = {
7
7
  export declare const StyledLayoutBottomBar: import("@emotion/styled").StyledComponent<{
8
8
  theme?: import("@emotion/react").Theme;
9
9
  as?: React.ElementType;
10
- } & StyledLayoutBottomBarProps, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
10
+ } & StyledLayoutBottomBarProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
11
11
  export {};
@@ -1,4 +1,4 @@
1
- import type { LayoutBottomBarProps } from "./LayoutBottomBar";
1
+ import type { LayoutBottomBarProps } from "../-types";
2
2
  type StyledLayoutBottomBarSectionProps = {
3
3
  background: NonNullable<LayoutBottomBarProps["background"]>;
4
4
  columnIndex?: number;
@@ -9,5 +9,5 @@ type StyledLayoutBottomBarSectionProps = {
9
9
  export declare const StyledLayoutBottomBarSection: import("@emotion/styled").StyledComponent<{
10
10
  theme?: import("@emotion/react").Theme;
11
11
  as?: React.ElementType;
12
- } & StyledLayoutBottomBarSectionProps, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
12
+ } & StyledLayoutBottomBarSectionProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
13
13
  export {};
@@ -1 +1 @@
1
- import styled from"@emotion/styled";export const StyledLayoutBottomBarSection=styled("div",{target:"e5xujxr0",label:"StyledLayoutBottomBarSection"})(({theme,background,columnIndex,rowIndex,fullWidth,hasPanelDivider})=>({gridColumn:fullWidth?"1 / -1":(columnIndex??0)+1,gridRow:rowIndex+1,alignItems:"center",boxSizing:"border-box",backgroundColor:"transparent"===background?"transparent":theme.values.color.background[background].default,display:"flex",minWidth:0,whiteSpace:"nowrap",...hasPanelDivider&&{position:"relative","&::after":{content:'""',position:"absolute",top:0,bottom:0,right:0,width:1,backgroundColor:theme.values.color.border.secondary.default,pointerEvents:"none"}}}));
1
+ import styled from"@emotion/styled";import isPropValid from"@emotion/is-prop-valid";export const StyledLayoutBottomBarSection=styled("div",{shouldForwardProp:prop=>"background"!==prop&&isPropValid(prop),target:"e1dq38by0",label:"StyledLayoutBottomBarSection"})(({theme,background,columnIndex,rowIndex,fullWidth,hasPanelDivider})=>({gridColumn:fullWidth?"1 / -1":(columnIndex??0)+1,gridRow:rowIndex+1,alignItems:"center",boxSizing:"border-box",backgroundColor:"transparent"===background?"transparent":theme.values.color.background[background].default,display:"flex",minWidth:0,whiteSpace:"nowrap",...hasPanelDivider&&{position:"relative","&::after":{content:'""',position:"absolute",top:0,bottom:0,right:0,width:1,backgroundColor:theme.values.color.border.secondary.default,pointerEvents:"none"}}}));
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type { LayoutValue, SlotKey } from "../-types";
3
- import { type LayoutBottomBarItemProps, type LayoutBottomBarFallback } from "./LayoutBottomBarItem";
3
+ import { type LayoutBottomBarItemProps, type LayoutBottomBarFallback } from "./BottomBarItem/LayoutBottomBarItem";
4
4
  type BottomBarLayout = Pick<LayoutValue, SlotKey>;
5
5
  type BottomBarItemMode = "column" | LayoutBottomBarFallback;
6
6
  type VisibleSection = LayoutBottomBarItemProps & {
@@ -1 +1 @@
1
- import{Children,isValidElement}from"react";import{PANEL_ORDER}from"../-constants";import{LayoutBottomBarItem}from"./LayoutBottomBarItem";let getBottomBarItemMode=({region,fallback,layout})=>{let handle=layout[region];return"column"===handle.presentation?"column":("leftPanel"!==region||"sidebar"!==layout.leftPanel.state.variant)&&("rightPanel"!==region||"sidebar"!==layout.rightPanel.state.variant)||handle.isVisible||null===handle.animation?fallback:"column"},getVisibleSections=(children,layout)=>Children.toArray(children).flatMap(child=>{if(!isValidElement(child)||child.type!==LayoutBottomBarItem||null==child.props.children||!1===child.props.children)return[];let{region,fallback="hide"}=child.props,placement=getBottomBarItemMode({region,fallback,layout});return"hide"===placement?[]:[{...child.props,placement,fallback}]}),shouldPreserveSplitColumnWidth=sections=>{let hasLeftFallback=sections.some(({region,fallback})=>"leftPanel"===region&&"remaining"===fallback),hasContentColumn=sections.some(({region,placement})=>"content"===region&&"column"===placement),hasSplitColumn=sections.some(({region,placement})=>"splitview"===region&&"column"===placement),hasRightFallback=sections.some(({region,fallback})=>"rightPanel"===region&&"remaining"===fallback);return hasLeftFallback&&hasContentColumn&&hasSplitColumn&&!hasRightFallback},getSharedRowCells=sections=>{if(!sections.length)return[];let firstSection=sections[0],lastSection=sections[sections.length-1],hasRemainingActions=sections.some(({fallback})=>"remaining"===fallback),preserveSplitColumn=shouldPreserveSplitColumnWidth(sections),flexibleColumns={leftPanel:!1,content:hasRemainingActions,splitview:hasRemainingActions&&!preserveSplitColumn,rightPanel:!1},hasFlexibleColumn=sections.some(({region,placement})=>"column"===placement&&flexibleColumns[region]),needsFlexibleGap=hasRemainingActions&&!hasFlexibleColumn,rightActions=sections.find(({region})=>"rightPanel"===region);return[..."column"===firstSection.placement?[{kind:"leading-gap",region:firstSection.region}]:[],...sections.flatMap((section,index)=>{let previousSection=sections[index-1];return[..."column"===section.placement&&previousSection?.placement==="column"?[{kind:"column-gap",region:section.region,previousRegion:previousSection.region}]:[],...needsFlexibleGap&&section===rightActions?[{kind:"flexible-gap"}]:[],{kind:"section",section,flexible:flexibleColumns[section.region]}]}),...!hasRemainingActions||preserveSplitColumn?[{kind:"trailing-gap",region:lastSection.region}]:[],...needsFlexibleGap&&!rightActions?[{kind:"flexible-gap"}]:[]]};export const getBottomBarLayout=({children,layout})=>{let sections=getVisibleSections(children,layout),sharedSections=PANEL_ORDER.flatMap(region=>sections.filter(section=>section.region===region&&"full"!==section.placement)),fullWidthSections=sections.filter(({placement})=>"full"===placement),sharedRowCount=+!!sharedSections.length,cells=getSharedRowCells(sharedSections);return{cells,sections:[...cells.flatMap((cell,column)=>"section"===cell.kind?[{...cell.section,columnIndex:column,rowIndex:0}]:[]),...fullWidthSections.map((section,row)=>({...section,rowIndex:sharedRowCount+row}))],rowCount:sharedRowCount+fullWidthSections.length,hasRightPanel:sections.some(({region})=>"rightPanel"===region)}};
1
+ import{Children,isValidElement}from"react";import{PANEL_ORDER}from"../-constants";import{LayoutBottomBarItem}from"./BottomBarItem/LayoutBottomBarItem";let getBottomBarItemMode=({region,fallback,layout})=>{let handle=layout[region];return"column"===handle.presentation?"column":("leftPanel"!==region||"sidebar"!==layout.leftPanel.state.variant)&&("rightPanel"!==region||"sidebar"!==layout.rightPanel.state.variant)||handle.isVisible||null===handle.animation?fallback:"column"},getVisibleSections=(children,layout)=>Children.toArray(children).flatMap(child=>{if(!isValidElement(child)||child.type!==LayoutBottomBarItem||null==child.props.children||!1===child.props.children)return[];let{region,fallback="hide"}=child.props,placement=getBottomBarItemMode({region,fallback,layout});return"hide"===placement?[]:[{...child.props,placement,fallback}]}),shouldPreserveSplitColumnWidth=sections=>{let hasLeftFallback=sections.some(({region,fallback})=>"leftPanel"===region&&"remaining"===fallback),hasContentColumn=sections.some(({region,placement})=>"content"===region&&"column"===placement),hasSplitColumn=sections.some(({region,placement})=>"splitview"===region&&"column"===placement),hasRightFallback=sections.some(({region,fallback})=>"rightPanel"===region&&"remaining"===fallback);return hasLeftFallback&&hasContentColumn&&hasSplitColumn&&!hasRightFallback},getSharedRowCells=sections=>{if(!sections.length)return[];let firstSection=sections[0],lastSection=sections[sections.length-1],hasRemainingActions=sections.some(({fallback})=>"remaining"===fallback),preserveSplitColumn=shouldPreserveSplitColumnWidth(sections),flexibleColumns={leftPanel:!1,content:hasRemainingActions,splitview:hasRemainingActions&&!preserveSplitColumn,rightPanel:!1},hasFlexibleColumn=sections.some(({region,placement})=>"column"===placement&&flexibleColumns[region]),needsFlexibleGap=hasRemainingActions&&!hasFlexibleColumn,rightActions=sections.find(({region})=>"rightPanel"===region);return[..."column"===firstSection.placement?[{kind:"leading-gap",region:firstSection.region}]:[],...sections.flatMap((section,index)=>{let previousSection=sections[index-1];return[..."column"===section.placement&&previousSection?.placement==="column"?[{kind:"column-gap",region:section.region,previousRegion:previousSection.region}]:[],...needsFlexibleGap&&section===rightActions?[{kind:"flexible-gap"}]:[],{kind:"section",section,flexible:flexibleColumns[section.region]}]}),...!hasRemainingActions||preserveSplitColumn?[{kind:"trailing-gap",region:lastSection.region}]:[],...needsFlexibleGap&&!rightActions?[{kind:"flexible-gap"}]:[]]};export const getBottomBarLayout=({children,layout})=>{let sections=getVisibleSections(children,layout),sharedSections=PANEL_ORDER.flatMap(region=>sections.filter(section=>section.region===region&&"full"!==section.placement)),fullWidthSections=sections.filter(({placement})=>"full"===placement),sharedRowCount=+!!sharedSections.length,cells=getSharedRowCells(sharedSections);return{cells,sections:[...cells.flatMap((cell,column)=>"section"===cell.kind?[{...cell.section,columnIndex:column,rowIndex:0}]:[]),...fullWidthSections.map((section,row)=>({...section,rowIndex:sharedRowCount+row}))],rowCount:sharedRowCount+fullWidthSections.length,hasRightPanel:sections.some(({region})=>"rightPanel"===region)}};
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { LayoutProvider } from "./LayoutProvider";
3
3
  import { LayoutBottomBar } from "./BottomBar/LayoutBottomBar";
4
- import { LayoutBottomBarItem } from "./BottomBar/LayoutBottomBarItem";
4
+ import { LayoutBottomBarItem } from "./BottomBar/BottomBarItem/LayoutBottomBarItem";
5
5
  import { Content } from "./Content/Content";
6
6
  import { RightPanel } from "./RightPanel/RightPanel";
7
7
  import { RightPanelHeader } from "./RightPanel/RightPanelHeader";
@@ -1 +1 @@
1
- import React,{useCallback,useLayoutEffect,useMemo,useRef,useState}from"react";import styled from"@emotion/styled";import{Panel}from"../Internal/Panel/Panel";import{LayoutFloat}from"../Internal/LayoutFloat/LayoutFloat";import{useBreakpoints}from"../../shared/useBreakpoints";import{PAGE_BOTTOM_BAR_INSET,PANEL_ORDER,PANEL_WIDTH_VAR,PANEL_START_VAR,LAYOUT_REGIONS_READY_VAR,Slot}from"./-constants";import{useLayoutPersistence,useLayoutStore}from"./context";import{MobileSplitStackContext}from"./Split/MobileSplitView/useMobileSplitStack";import{useMobileSplitViewEnabled}from"./Split/MobileSplitView/useMobileSplitView";import{LayoutProvider}from"./LayoutProvider";import{LayoutBottomBar}from"./BottomBar/LayoutBottomBar";import{LayoutBottomBarItem}from"./BottomBar/LayoutBottomBarItem";import{Content}from"./Content/Content";import{RightPanel}from"./RightPanel/RightPanel";import{RightPanelHeader}from"./RightPanel/RightPanelHeader";import{RightPanelFooter}from"./RightPanel/RightPanelFooter";import{LeftPanel}from"./LeftPanel/LeftPanel";import{LeftPanelHeader}from"./LeftPanel/LeftPanelHeader";import{LeftPanelFooter}from"./LeftPanel/LeftPanelFooter";import{LeftNavBar}from"./LeftNavBar/LeftNavBar";import{LeftNavBarFooter}from"./LeftNavBar/LeftNavBarFooter";import{Split}from"./Split/Split";import{SplitHeader}from"./Split/SplitHeader";import{SplitFooter}from"./Split/SplitFooter";import{LayoutPortalContext,PanelRegistryContext,PanelDeclarationsContext,PanelPresenceContext,PanelAnimationContext,PanelRowContext}from"./registry";import{usePortalTargets}from"./usePortalTargets";import{LayoutFloatDragProvider}from"../Internal/LayoutFloat/LayoutFloatDragProvider";import{useLayoutVar}from"./LayoutCssVars";import{useLayout}from"./useLayout";import{useLayoutRules}from"./useLayoutRules";import{DEFAULT_LAYOUT_RULES}from"./rules";let resizableFromState=slotState=>"sidePanel"===slotState.kind?slotState.resizable:void 0,useGlobalCssVariables=({slotHosts,root,mobileHost})=>{let leftPanelWidthCssVar=useLayoutVar(PANEL_WIDTH_VAR.leftPanel),contentWidthCssVar=useLayoutVar(PANEL_WIDTH_VAR.content),splitviewWidthCssVar=useLayoutVar(PANEL_WIDTH_VAR.splitview),rightPanelWidthCssVar=useLayoutVar(PANEL_WIDTH_VAR.rightPanel),leftPanelStartCssVar=useLayoutVar(PANEL_START_VAR.leftPanel),contentStartCssVar=useLayoutVar(PANEL_START_VAR.content),splitviewStartCssVar=useLayoutVar(PANEL_START_VAR.splitview),rightPanelStartCssVar=useLayoutVar(PANEL_START_VAR.rightPanel),regionsReadyCssVar=useLayoutVar(LAYOUT_REGIONS_READY_VAR),publishRegions=useCallback(()=>{if(!root)return;let targets=[[Slot.leftPanel,leftPanelWidthCssVar,leftPanelStartCssVar],[Slot.content,contentWidthCssVar,contentStartCssVar],[Slot.splitview,splitviewWidthCssVar,splitviewStartCssVar],[Slot.rightPanel,rightPanelWidthCssVar,rightPanelStartCssVar]],rootRect=root.getBoundingClientRect();targets.forEach(([slot,widthCssVar,startCssVar])=>{let rect=slotHosts[slot]?.getBoundingClientRect(),isMobileRegion=!!mobileHost&&(slot===Slot.content||slot===Slot.splitview),width=isMobileRegion?rootRect.width:rect?.width??0,start=isMobileRegion||!rect?0:rect.left-rootRect.left;widthCssVar.set(`${width}px`),startCssVar.set(`${start}px`)}),regionsReadyCssVar.set("1")},[slotHosts,root,mobileHost,leftPanelWidthCssVar,contentWidthCssVar,splitviewWidthCssVar,rightPanelWidthCssVar,leftPanelStartCssVar,contentStartCssVar,splitviewStartCssVar,rightPanelStartCssVar,regionsReadyCssVar]);useLayoutEffect(()=>{publishRegions()},[publishRegions]),useLayoutEffect(()=>{if(!root||"undefined"==typeof ResizeObserver)return;let observer=new ResizeObserver(publishRegions);return observer.observe(root),Object.values(slotHosts).forEach(host=>{host&&observer.observe(host)}),()=>observer.disconnect()},[root,slotHosts,publishRegions])},StyledLayout=styled("div",{target:"e1kh2kot0",label:"StyledLayout"})({position:"relative",height:"100%",width:"100%"}),StyledPanelRow=styled("div",{target:"e1kh2kot1",label:"StyledPanelRow"})(({theme,hasOffcanvasLeftBar})=>({height:"100%",boxSizing:"border-box",...hasOffcanvasLeftBar&&{paddingLeft:theme.variables.size.dimension.leftNavBar.width}})),StyledPanelHost=styled("div",{target:"e1kh2kot2",label:"StyledPanelHost"})({position:"relative",height:"100%",width:"100%"});export const PANEL_HOST_DS_ID="PanelHost";let StyledContentColumn=styled("div",{shouldForwardProp:prop=>"isSplitOpen"!==prop,target:"e1kh2kot3",label:"StyledContentColumn"})(({isSplitOpen,theme})=>({display:"flex",height:`calc(100% - ${PAGE_BOTTOM_BAR_INSET})`,width:"100%",...isSplitOpen&&{maxWidth:theme.variables.layout.split.maxWidth.default,marginInline:"auto",gap:theme.variables.size.spacing.xxs}})),StyledContentColumnHalf=styled("div",{target:"e1kh2kot4",label:"StyledContentColumnHalf"})({position:"relative",height:"100%",flex:"1 1 0",minWidth:0}),StyledMobileSplitStackHost=styled("div",{target:"e1kh2kot5",label:"StyledMobileSplitStackHost"})({position:"absolute",top:0,left:0,right:0,bottom:PAGE_BOTTOM_BAR_INSET,overflow:"hidden",pointerEvents:"none"}),isPanelPresent=({slot,declared,present,isShown})=>!!(declared[slot]&&(isShown(slot)||present[slot])),defaultSizeFor=({slot,panel,panelState})=>slot===Slot.content?void 0:panel?.defaultSize!==void 0?panel.defaultSize:panel?.resizable!==!1?panelState.size:void 0,childFor=(slot,contentColumn,slotHostRefs)=>slot===Slot.content?contentColumn:React.createElement(StyledPanelHost,{"data-ds-id":"PanelHost",ref:slotHostRefs[slot]});export const Layout=function({children,persistenceKey,storage,rules=DEFAULT_LAYOUT_RULES,additionalRulesData}){let[declared,setDeclared]=useState({}),layout=useLayout(),{state:layoutState,...panelCallbacks}=layout;useLayoutRules({layout,declared,rules,additionalData:additionalRulesData});let{dispatch}=useLayoutStore(),persistence=useLayoutPersistence(),resolvedKey=persistenceKey??persistence.persistenceKey,resolvedStorage=storage??persistence.storage,{isMobile}=useBreakpoints(),showMobileSplitStack=useMobileSplitViewEnabled(),[mobileSplitStackHost,setMobileSplitStackHost]=useState(null),[splitCount,setSplitCount]=useState(0),registerSplit=useCallback(()=>(setSplitCount(count=>count+1),()=>setSplitCount(count=>count-1)),[]),mobileSplitStack=useMemo(()=>({host:mobileSplitStackHost,isSplitPresent:splitCount>0,registerSplit}),[mobileSplitStackHost,splitCount,registerSplit]),rightPanelVariant=layoutState[Slot.rightPanel].variant??declared[Slot.rightPanel]?.variant??"sidebar",isRightPanelFloating=!isMobile&&"float"===rightPanelVariant,hasOffcanvasLeftBar=!!declared[Slot.leftPanel]&&"offcanvas"===layoutState[Slot.leftPanel].variant,isShown=slot=>layoutState[slot].visible&&!(slot===Slot.rightPanel&&(isRightPanelFloating||isMobile))&&(slot!==Slot.leftPanel||"sidebar"===layoutState.leftPanel.variant),[present,setPresent]=useState({}),presence=useMemo(()=>({setPresent:(slot,isPresent)=>setPresent(prev=>prev[slot]===isPresent?prev:{...prev,[slot]:isPresent})}),[]),panelHandles=useRef({}),panelElements=useRef({}),resizeSuppressed=useRef({}),animationControl=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=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=useCallback(()=>Object.values(resizeSuppressed.current).some(Boolean),[]),registry=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}=usePortalTargets({slots:PANEL_ORDER,floatableSlot:Slot.rightPanel,isFloating:isRightPanelFloating}),[layoutRoot,setLayoutRoot]=useState(null),rootPortalTargets=useMemo(()=>({...portalTargets,root:layoutRoot}),[portalTargets,layoutRoot]);useGlobalCssVariables({slotHosts,root:layoutRoot,mobileHost:mobileSplitStackHost});let rowSlots=PANEL_ORDER.filter(slot=>slot!==Slot.splitview),declaredSlots=rowSlots.filter(slot=>declared[slot]),isSolo=declaredSlots.length<=1,soloSlot=declaredSlots[0],isSplitOpen=isPanelPresent({slot:Slot.splitview,declared,present,isShown})&&isPanelPresent({slot:Slot.content,declared,present,isShown}),contentColumn=React.createElement(StyledContentColumn,{isSplitOpen:isSplitOpen},React.createElement(StyledContentColumnHalf,{ref:slotHostRefs[Slot.content]}),isSplitOpen&&React.createElement(StyledContentColumnHalf,{ref:slotHostRefs[Slot.splitview]})),panelItems=rowSlots.filter(slot=>isPanelPresent({slot,declared,present,isShown})).map(slot=>{let panel=declared[slot],panelState=layoutState[slot];return{id:slot,gapBefore:slot===Slot.rightPanel,child:childFor(slot,contentColumn,slotHostRefs),defaultSize:defaultSizeFor({slot,panel,panelState}),minSize:panel?.minSize,maxSize:panel?.maxSize,collapsible:slot!==Slot.content&&(panel?.collapsible??!0),lockWidthOnWindowResize:panel?.lockWidthOnWindowResize,resizable:panel?.resizable??resizableFromState(panelState)}}),rowKey=panelItems.map(item=>item.id).join(","),soloHost=soloSlot&&isShown(soloSlot)?childFor(soloSlot,contentColumn,slotHostRefs):null,panelGroup=panelItems.length>0?React.createElement(Panel,{key:resolvedKey,panels:panelItems,persistenceKey:resolvedKey,storage:resolvedStorage,onResize:(id,size)=>{isShown(id)&&declared[id]?.resizable!==!1&&dispatch({type:"resize",slot:id,size:declared[id]?.lockWidthOnWindowResize?Math.round(size.inPixels):`${size.asPercentage}%`})},onCollapse:id=>panelCallbacks[id].hide(),panelHandleFor:panelRefCallbacks.handleFor,panelElementFor:panelRefCallbacks.elementFor,shouldSuppressLayoutCallback:shouldSuppressLayoutCallback}):null;return React.createElement(PanelRegistryContext.Provider,{value:registry},React.createElement(PanelDeclarationsContext.Provider,{value:declared},React.createElement(PanelPresenceContext.Provider,{value:presence},React.createElement(PanelAnimationContext.Provider,{value:animationControl},React.createElement(PanelRowContext.Provider,{value:rowKey},React.createElement(LayoutPortalContext.Provider,{value:rootPortalTargets},React.createElement(LayoutFloatDragProvider,null,React.createElement(MobileSplitStackContext.Provider,{value:mobileSplitStack},React.createElement(StyledLayout,{ref:setLayoutRoot,"data-ds-id":"Layout"},React.createElement(StyledPanelRow,{hasOffcanvasLeftBar:hasOffcanvasLeftBar},isSolo?soloHost:panelGroup),isRightPanelFloating&&layoutState[Slot.rightPanel].visible&&React.createElement(LayoutFloat,{hostRef:floatHostRef}),children,showMobileSplitStack&&React.createElement(StyledMobileSplitStackHost,{ref:setMobileSplitStackHost}))))))))))};Layout.Provider=LayoutProvider,Layout.BottomBar=LayoutBottomBar,Layout.BottomBarItem=LayoutBottomBarItem,Layout.LeftPanel=LeftPanel,Layout.LeftNavBar=LeftNavBar,Layout.LeftNavBarFooter=LeftNavBarFooter,Layout.LeftPanelHeader=LeftPanelHeader,Layout.LeftPanelFooter=LeftPanelFooter,Layout.RightPanel=RightPanel,Layout.RightPanelHeader=RightPanelHeader,Layout.RightPanelFooter=RightPanelFooter,Layout.Content=Content,Layout.Split=Split,Layout.SplitHeader=SplitHeader,Layout.SplitFooter=SplitFooter;
1
+ import React,{useCallback,useLayoutEffect,useMemo,useRef,useState}from"react";import styled from"@emotion/styled";import{Panel}from"../Internal/Panel/Panel";import{LayoutFloat}from"../Internal/LayoutFloat/LayoutFloat";import{useBreakpoints}from"../../shared/useBreakpoints";import{PAGE_BOTTOM_BAR_INSET,PANEL_ORDER,PANEL_WIDTH_VAR,PANEL_START_VAR,LAYOUT_REGIONS_READY_VAR,Slot}from"./-constants";import{useLayoutPersistence,useLayoutStore}from"./context";import{MobileSplitStackContext}from"./Split/MobileSplitView/useMobileSplitStack";import{useMobileSplitViewEnabled}from"./Split/MobileSplitView/useMobileSplitView";import{LayoutProvider}from"./LayoutProvider";import{LayoutBottomBar}from"./BottomBar/LayoutBottomBar";import{LayoutBottomBarItem}from"./BottomBar/BottomBarItem/LayoutBottomBarItem";import{Content}from"./Content/Content";import{RightPanel}from"./RightPanel/RightPanel";import{RightPanelHeader}from"./RightPanel/RightPanelHeader";import{RightPanelFooter}from"./RightPanel/RightPanelFooter";import{LeftPanel}from"./LeftPanel/LeftPanel";import{LeftPanelHeader}from"./LeftPanel/LeftPanelHeader";import{LeftPanelFooter}from"./LeftPanel/LeftPanelFooter";import{LeftNavBar}from"./LeftNavBar/LeftNavBar";import{LeftNavBarFooter}from"./LeftNavBar/LeftNavBarFooter";import{Split}from"./Split/Split";import{SplitHeader}from"./Split/SplitHeader";import{SplitFooter}from"./Split/SplitFooter";import{LayoutPortalContext,PanelRegistryContext,PanelDeclarationsContext,PanelPresenceContext,PanelAnimationContext,PanelRowContext}from"./registry";import{usePortalTargets}from"./usePortalTargets";import{LayoutFloatDragProvider}from"../Internal/LayoutFloat/LayoutFloatDragProvider";import{useLayoutVar}from"./LayoutCssVars";import{useLayout}from"./useLayout";import{useLayoutRules}from"./useLayoutRules";import{DEFAULT_LAYOUT_RULES}from"./rules";let resizableFromState=slotState=>"sidePanel"===slotState.kind?slotState.resizable:void 0,useGlobalCssVariables=({slotHosts,root,mobileHost})=>{let leftPanelWidthCssVar=useLayoutVar(PANEL_WIDTH_VAR.leftPanel),contentWidthCssVar=useLayoutVar(PANEL_WIDTH_VAR.content),splitviewWidthCssVar=useLayoutVar(PANEL_WIDTH_VAR.splitview),rightPanelWidthCssVar=useLayoutVar(PANEL_WIDTH_VAR.rightPanel),leftPanelStartCssVar=useLayoutVar(PANEL_START_VAR.leftPanel),contentStartCssVar=useLayoutVar(PANEL_START_VAR.content),splitviewStartCssVar=useLayoutVar(PANEL_START_VAR.splitview),rightPanelStartCssVar=useLayoutVar(PANEL_START_VAR.rightPanel),regionsReadyCssVar=useLayoutVar(LAYOUT_REGIONS_READY_VAR),publishRegions=useCallback(()=>{if(!root)return;let targets=[[Slot.leftPanel,leftPanelWidthCssVar,leftPanelStartCssVar],[Slot.content,contentWidthCssVar,contentStartCssVar],[Slot.splitview,splitviewWidthCssVar,splitviewStartCssVar],[Slot.rightPanel,rightPanelWidthCssVar,rightPanelStartCssVar]],rootRect=root.getBoundingClientRect();targets.forEach(([slot,widthCssVar,startCssVar])=>{let rect=slotHosts[slot]?.getBoundingClientRect(),isMobileRegion=!!mobileHost&&(slot===Slot.content||slot===Slot.splitview),width=isMobileRegion?rootRect.width:rect?.width??0,start=isMobileRegion||!rect?0:rect.left-rootRect.left;widthCssVar.set(`${width}px`),startCssVar.set(`${start}px`)}),regionsReadyCssVar.set("1")},[slotHosts,root,mobileHost,leftPanelWidthCssVar,contentWidthCssVar,splitviewWidthCssVar,rightPanelWidthCssVar,leftPanelStartCssVar,contentStartCssVar,splitviewStartCssVar,rightPanelStartCssVar,regionsReadyCssVar]);useLayoutEffect(()=>{publishRegions()},[publishRegions]),useLayoutEffect(()=>{if(!root||"undefined"==typeof ResizeObserver)return;let observer=new ResizeObserver(publishRegions);return observer.observe(root),Object.values(slotHosts).forEach(host=>{host&&observer.observe(host)}),()=>observer.disconnect()},[root,slotHosts,publishRegions])},StyledLayout=styled("div",{target:"e1tobjas0",label:"StyledLayout"})({position:"relative",height:"100%",width:"100%"}),StyledPanelRow=styled("div",{target:"e1tobjas1",label:"StyledPanelRow"})(({theme,hasOffcanvasLeftBar})=>({height:"100%",boxSizing:"border-box",...hasOffcanvasLeftBar&&{paddingLeft:theme.variables.size.dimension.leftNavBar.width}})),StyledPanelHost=styled("div",{target:"e1tobjas2",label:"StyledPanelHost"})({position:"relative",height:"100%",width:"100%"});export const PANEL_HOST_DS_ID="PanelHost";let StyledContentColumn=styled("div",{shouldForwardProp:prop=>"isSplitOpen"!==prop,target:"e1tobjas3",label:"StyledContentColumn"})(({isSplitOpen,theme})=>({display:"flex",height:`calc(100% - ${PAGE_BOTTOM_BAR_INSET})`,width:"100%",...isSplitOpen&&{maxWidth:theme.variables.layout.split.maxWidth.default,marginInline:"auto",gap:theme.variables.size.spacing.xxs}})),StyledContentColumnHalf=styled("div",{target:"e1tobjas4",label:"StyledContentColumnHalf"})({position:"relative",height:"100%",flex:"1 1 0",minWidth:0}),StyledMobileSplitStackHost=styled("div",{target:"e1tobjas5",label:"StyledMobileSplitStackHost"})({position:"absolute",top:0,left:0,right:0,bottom:PAGE_BOTTOM_BAR_INSET,overflow:"hidden",pointerEvents:"none"}),isPanelPresent=({slot,declared,present,isShown})=>!!(declared[slot]&&(isShown(slot)||present[slot])),defaultSizeFor=({slot,panel,panelState})=>slot===Slot.content?void 0:panel?.defaultSize!==void 0?panel.defaultSize:panel?.resizable!==!1?panelState.size:void 0,childFor=(slot,contentColumn,slotHostRefs)=>slot===Slot.content?contentColumn:React.createElement(StyledPanelHost,{"data-ds-id":"PanelHost",ref:slotHostRefs[slot]});export const Layout=function({children,persistenceKey,storage,rules=DEFAULT_LAYOUT_RULES,additionalRulesData}){let[declared,setDeclared]=useState({}),layout=useLayout(),{state:layoutState,...panelCallbacks}=layout;useLayoutRules({layout,declared,rules,additionalData:additionalRulesData});let{dispatch}=useLayoutStore(),persistence=useLayoutPersistence(),resolvedKey=persistenceKey??persistence.persistenceKey,resolvedStorage=storage??persistence.storage,{isMobile}=useBreakpoints(),showMobileSplitStack=useMobileSplitViewEnabled(),[mobileSplitStackHost,setMobileSplitStackHost]=useState(null),[splitCount,setSplitCount]=useState(0),registerSplit=useCallback(()=>(setSplitCount(count=>count+1),()=>setSplitCount(count=>count-1)),[]),mobileSplitStack=useMemo(()=>({host:mobileSplitStackHost,isSplitPresent:splitCount>0,registerSplit}),[mobileSplitStackHost,splitCount,registerSplit]),rightPanelVariant=layoutState[Slot.rightPanel].variant??declared[Slot.rightPanel]?.variant??"sidebar",isRightPanelFloating=!isMobile&&"float"===rightPanelVariant,hasOffcanvasLeftBar=!!declared[Slot.leftPanel]&&"offcanvas"===layoutState[Slot.leftPanel].variant,isShown=slot=>layoutState[slot].visible&&!(slot===Slot.rightPanel&&(isRightPanelFloating||isMobile))&&(slot!==Slot.leftPanel||"sidebar"===layoutState.leftPanel.variant),[present,setPresent]=useState({}),presence=useMemo(()=>({setPresent:(slot,isPresent)=>setPresent(prev=>prev[slot]===isPresent?prev:{...prev,[slot]:isPresent})}),[]),panelHandles=useRef({}),panelElements=useRef({}),resizeSuppressed=useRef({}),animationControl=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=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=useCallback(()=>Object.values(resizeSuppressed.current).some(Boolean),[]),registry=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}=usePortalTargets({slots:PANEL_ORDER,floatableSlot:Slot.rightPanel,isFloating:isRightPanelFloating}),[layoutRoot,setLayoutRoot]=useState(null),rootPortalTargets=useMemo(()=>({...portalTargets,root:layoutRoot}),[portalTargets,layoutRoot]);useGlobalCssVariables({slotHosts,root:layoutRoot,mobileHost:mobileSplitStackHost});let rowSlots=PANEL_ORDER.filter(slot=>slot!==Slot.splitview),declaredSlots=rowSlots.filter(slot=>declared[slot]),isSolo=declaredSlots.length<=1,soloSlot=declaredSlots[0],isSplitOpen=isPanelPresent({slot:Slot.splitview,declared,present,isShown})&&isPanelPresent({slot:Slot.content,declared,present,isShown}),contentColumn=React.createElement(StyledContentColumn,{isSplitOpen:isSplitOpen},React.createElement(StyledContentColumnHalf,{ref:slotHostRefs[Slot.content]}),isSplitOpen&&React.createElement(StyledContentColumnHalf,{ref:slotHostRefs[Slot.splitview]})),panelItems=rowSlots.filter(slot=>isPanelPresent({slot,declared,present,isShown})).map(slot=>{let panel=declared[slot],panelState=layoutState[slot];return{id:slot,gapBefore:slot===Slot.rightPanel,child:childFor(slot,contentColumn,slotHostRefs),defaultSize:defaultSizeFor({slot,panel,panelState}),minSize:panel?.minSize,maxSize:panel?.maxSize,collapsible:slot!==Slot.content&&(panel?.collapsible??!0),lockWidthOnWindowResize:panel?.lockWidthOnWindowResize,resizable:panel?.resizable??resizableFromState(panelState)}}),rowKey=panelItems.map(item=>item.id).join(","),soloHost=soloSlot&&isShown(soloSlot)?childFor(soloSlot,contentColumn,slotHostRefs):null,panelGroup=panelItems.length>0?React.createElement(Panel,{key:resolvedKey,panels:panelItems,persistenceKey:resolvedKey,storage:resolvedStorage,onResize:(id,size)=>{isShown(id)&&declared[id]?.resizable!==!1&&dispatch({type:"resize",slot:id,size:declared[id]?.lockWidthOnWindowResize?Math.round(size.inPixels):`${size.asPercentage}%`})},onCollapse:id=>panelCallbacks[id].hide(),panelHandleFor:panelRefCallbacks.handleFor,panelElementFor:panelRefCallbacks.elementFor,shouldSuppressLayoutCallback:shouldSuppressLayoutCallback}):null;return React.createElement(PanelRegistryContext.Provider,{value:registry},React.createElement(PanelDeclarationsContext.Provider,{value:declared},React.createElement(PanelPresenceContext.Provider,{value:presence},React.createElement(PanelAnimationContext.Provider,{value:animationControl},React.createElement(PanelRowContext.Provider,{value:rowKey},React.createElement(LayoutPortalContext.Provider,{value:rootPortalTargets},React.createElement(LayoutFloatDragProvider,null,React.createElement(MobileSplitStackContext.Provider,{value:mobileSplitStack},React.createElement(StyledLayout,{ref:setLayoutRoot,"data-ds-id":"Layout"},React.createElement(StyledPanelRow,{hasOffcanvasLeftBar:hasOffcanvasLeftBar},isSolo?soloHost:panelGroup),isRightPanelFloating&&layoutState[Slot.rightPanel].visible&&React.createElement(LayoutFloat,{hostRef:floatHostRef}),children,showMobileSplitStack&&React.createElement(StyledMobileSplitStackHost,{ref:setMobileSplitStackHost}))))))))))};Layout.Provider=LayoutProvider,Layout.BottomBar=LayoutBottomBar,Layout.BottomBarItem=LayoutBottomBarItem,Layout.LeftPanel=LeftPanel,Layout.LeftNavBar=LeftNavBar,Layout.LeftNavBarFooter=LeftNavBarFooter,Layout.LeftPanelHeader=LeftPanelHeader,Layout.LeftPanelFooter=LeftPanelFooter,Layout.RightPanel=RightPanel,Layout.RightPanelHeader=RightPanelHeader,Layout.RightPanelFooter=RightPanelFooter,Layout.Content=Content,Layout.Split=Split,Layout.SplitHeader=SplitHeader,Layout.SplitFooter=SplitFooter;
@@ -6,6 +6,6 @@ export type LeftBarSlot = {
6
6
  * content alone. */
7
7
  slotNode: HTMLElement | null;
8
8
  };
9
- export declare const LeftBarProvider: React.Provider<LeftBarSlot>;
9
+ export declare const LeftBarProvider: import("react").Provider<LeftBarSlot>;
10
10
  /** The left bar slot behind the left panel, if this presentation has one. */
11
11
  export declare const useLeftBarContext: () => LeftBarSlot;
@@ -6,6 +6,6 @@ export type LeftPanelCollapseState = {
6
6
  * at the column's edge so nothing inside reflows on the way down. */
7
7
  fixedContentWidth?: string;
8
8
  };
9
- export declare const LeftPanelCollapseProvider: React.Provider<LeftPanelCollapseState>;
9
+ export declare const LeftPanelCollapseProvider: import("react").Provider<LeftPanelCollapseState>;
10
10
  /** How the left panel's parts have to behave while its column narrows. */
11
11
  export declare const useLeftPanelCollapseContext: () => LeftPanelCollapseState;
@@ -18,5 +18,5 @@ export declare const StyledMobileSplitSlideLayer: import("@emotion/styled").Styl
18
18
  } & {
19
19
  offset: MobileSplitViewOffset;
20
20
  layer: MobileSplitLayer;
21
- }, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
21
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
22
22
  export {};
@@ -16,5 +16,5 @@ export type MobileSplitStackValue = {
16
16
  * front isn't stored here - it derives from the `splitview` slot's visibility
17
17
  * (see {@link useMobileSplitView}).
18
18
  */
19
- export declare const MobileSplitStackContext: React.Context<MobileSplitStackValue | null>;
19
+ export declare const MobileSplitStackContext: import("react").Context<MobileSplitStackValue | null>;
20
20
  export declare const useMobileSplitStack: () => MobileSplitStackValue;
@@ -1,5 +1,5 @@
1
1
  import type { LayoutState, LayoutStorage, LayoutStore } from "./-types";
2
- export declare const LayoutStoreProvider: React.Provider<LayoutStore | null>;
2
+ export declare const LayoutStoreProvider: import("react").Provider<LayoutStore | null>;
3
3
  /** Get the store from context, or throw if used outside the provider. */
4
4
  export declare function useLayoutStore(): LayoutStore;
5
5
  /**
@@ -11,7 +11,7 @@ export type LayoutPersistence = {
11
11
  persistenceKey?: string;
12
12
  storage?: LayoutStorage;
13
13
  };
14
- export declare const LayoutPersistenceProvider: React.Provider<LayoutPersistence>;
14
+ export declare const LayoutPersistenceProvider: import("react").Provider<LayoutPersistence>;
15
15
  /** Persistence config from the nearest `Layout.Provider` (empty if none). */
16
16
  export declare function useLayoutPersistence(): LayoutPersistence;
17
17
  /**
@@ -7,4 +7,3 @@ export { useAutoScrollToBottom } from "./useAutoScrollToBottom";
7
7
  export { createLayoutStore } from "./store";
8
8
  export { createInitialState, layoutReducer } from "./reducer";
9
9
  export * from "./-types";
10
- export type { LayoutBottomBarProps } from "./BottomBar/LayoutBottomBar";
@@ -5,7 +5,7 @@ export type PortalTargets = Partial<Record<SlotKey, HTMLElement | null>>;
5
5
  type LayoutPortalTargets = PortalTargets & {
6
6
  root?: HTMLElement | null;
7
7
  };
8
- export declare const LayoutPortalContext: React.Context<LayoutPortalTargets>;
8
+ export declare const LayoutPortalContext: import("react").Context<LayoutPortalTargets>;
9
9
  /**
10
10
  * Portal `children` into the host DOM node registered for `slot`. Returns the
11
11
  * portal (or `null` if the host isn't mounted yet). Call unconditionally -
@@ -38,11 +38,11 @@ export type PanelRegistry = {
38
38
  register: (slot: SlotKey, reg: PanelReg) => void;
39
39
  unregister: (slot: SlotKey) => void;
40
40
  };
41
- export declare const PanelRegistryContext: React.Context<PanelRegistry | null>;
41
+ export declare const PanelRegistryContext: import("react").Context<PanelRegistry | null>;
42
42
  /** Register this slot as a panel for the marker's lifetime. */
43
43
  export declare function useDeclarePanel(slot: SlotKey, reg: PanelReg): void;
44
44
  export type PanelDeclarations = Partial<Record<SlotKey, PanelReg>>;
45
- export declare const PanelDeclarationsContext: React.Context<Partial<Record<"content" | "leftPanel" | "rightPanel" | "splitview", PanelReg>>>;
45
+ export declare const PanelDeclarationsContext: import("react").Context<Partial<Record<"content" | "leftPanel" | "rightPanel" | "splitview", PanelReg>>>;
46
46
  /**
47
47
  * The ids of the columns in the resizable row, in order, joined with commas.
48
48
  * Changes when a column joins or leaves the row, and only then. A column that
@@ -51,7 +51,7 @@ export declare const PanelDeclarationsContext: React.Context<Partial<Record<"con
51
51
  * had the last time the same set of columns was on screen - re-checks its rest
52
52
  * against it.
53
53
  */
54
- export declare const PanelRowContext: React.Context<string>;
54
+ export declare const PanelRowContext: import("react").Context<string>;
55
55
  /** The row's current column set, as a stable key. Empty outside a Layout. */
56
56
  export declare const usePanelRow: () => string;
57
57
  /**
@@ -63,7 +63,7 @@ export declare const usePanelRow: () => string;
63
63
  export type PanelPresence = {
64
64
  setPresent: (slot: SlotKey, isPresent: boolean) => void;
65
65
  };
66
- export declare const PanelPresenceContext: React.Context<PanelPresence | null>;
66
+ export declare const PanelPresenceContext: import("react").Context<PanelPresence | null>;
67
67
  /** Report this slot's live presence so the Layout keeps its column mounted
68
68
  * through the exit animation. No-op outside a Layout. */
69
69
  export declare function usePanelPresence(slot: SlotKey, isPresent: boolean): void;
@@ -85,7 +85,7 @@ export type PanelAnimationControl = {
85
85
  /** Mute the Group's resize/collapse/persist callbacks for a slot mid-slide. */
86
86
  setResizeSuppressed: (slot: SlotKey, suppressed: boolean) => void;
87
87
  };
88
- export declare const PanelAnimationContext: React.Context<PanelAnimationControl | null>;
88
+ export declare const PanelAnimationContext: import("react").Context<PanelAnimationControl | null>;
89
89
  /** Access the Layout's panel-animation control. Null outside a Layout. */
90
90
  export declare function usePanelAnimationControl(): PanelAnimationControl | null;
91
91
  /** Run `onChange(value)` when `value` transitions (not on initial mount). */
@@ -2,5 +2,5 @@
2
2
  * control living OUTSIDE the panel - the nav left bar's open button - point
3
3
  * `aria-controls` at it without the two components knowing each other. Empty
4
4
  * outside a `Layout`, where there is no panel to reference. */
5
- export declare const LeftPanelIdContext: React.Context<string>;
5
+ export declare const LeftPanelIdContext: import("react").Context<string>;
6
6
  export declare const useLeftPanelId: () => string;
@@ -5,7 +5,7 @@ type PanelAnimationsStore = {
5
5
  subscribe: (listener: () => void) => () => void;
6
6
  set: (slot: SlotKey, animation: PanelAnimation | null) => void;
7
7
  };
8
- export declare const PanelAnimationsProvider: React.Provider<PanelAnimationsStore | null>;
8
+ export declare const PanelAnimationsProvider: import("react").Provider<PanelAnimationsStore | null>;
9
9
  export declare const usePanelAnimationsStore: () => PanelAnimationsStore | null;
10
10
  export declare const createPanelAnimationsStore: () => PanelAnimationsStore;
11
11
  export declare const usePanelAnimations: () => Animations;
@@ -1,5 +1,11 @@
1
1
  import React from "react";
2
+ import { NavBarSubMenuContainer } from "./NavBarSubMenuContainer";
3
+ import { NavBarDropdownTriggerButton } from "./NavBarDropdownTriggerButton";
4
+ import { NavBarSearchInput } from "./NavBarSearchInput";
2
5
  import { NavBarOverlayBar } from "./NavBarOverlayBar";
6
+ import { PrimaryNavContainer, PrimaryNav } from "./NavBarPrimaryNav";
7
+ import { PrimaryNavLinkItem } from "./NavBarPrimaryNavLinkItem";
8
+ import { SecondaryNav } from "./NavBarSecondaryNav";
3
9
  import { NavBarName } from "./types";
4
10
  type NavBarProps = React.PropsWithChildren<{
5
11
  subTheme: NavBarName;
@@ -7,23 +13,13 @@ type NavBarProps = React.PropsWithChildren<{
7
13
  }>;
8
14
  export declare function NavBar({ children, subTheme, isCompact, }: NavBarProps): React.ReactElement;
9
15
  export declare namespace NavBar {
10
- var PrimaryNavContainer: typeof import("./NavBarPrimaryNav").PrimaryNavContainer;
11
- var PrimaryNav: typeof import("./NavBarPrimaryNav").PrimaryNav;
12
- var PrimaryNavItem: React.ForwardRefExoticComponent<{
13
- label: string;
14
- isActive?: boolean;
15
- as?: React.ElementType;
16
- to?: string;
17
- } & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "children"> & React.RefAttributes<HTMLAnchorElement>>;
18
- var SubMenuContainer: React.ForwardRefExoticComponent<{
19
- "data-e2e-test-id"?: string;
20
- children: React.ReactNode;
21
- } & React.RefAttributes<HTMLDivElement>>;
22
- var OverlayBar: typeof NavBarOverlayBar;
23
- var SecondaryNav: typeof import("./NavBarSecondaryNav").SecondaryNav;
24
- var DropdownTriggerButton: React.ForwardRefExoticComponent<Pick<import("../..").ButtonProps, "onFocus" | "onBlur" | "onClick" | "disabled"> & {
25
- children?: React.ReactNode | undefined;
26
- } & React.RefAttributes<HTMLButtonElement>>;
27
- var SearchInput: React.ForwardRefExoticComponent<import("./NavBarSearchInput").NavBarSearchInputProps & React.RefAttributes<HTMLButtonElement>>;
16
+ export { PrimaryNavContainer };
17
+ export { PrimaryNav };
18
+ export { PrimaryNavLinkItem as PrimaryNavItem };
19
+ export { NavBarSubMenuContainer as SubMenuContainer };
20
+ export { NavBarOverlayBar as OverlayBar };
21
+ export { SecondaryNav };
22
+ export { NavBarDropdownTriggerButton as DropdownTriggerButton };
23
+ export { NavBarSearchInput as SearchInput };
28
24
  }
29
25
  export {};
@@ -6,6 +6,6 @@ type NavBarContextValue = {
6
6
  primaryNavRef: RefObject<HTMLElement>;
7
7
  secondaryNavRef: RefObject<HTMLElement>;
8
8
  };
9
- export declare const NavBarContext: React.Context<NavBarContextValue>;
9
+ export declare const NavBarContext: import("react").Context<NavBarContextValue>;
10
10
  export declare function useNavBarContext(): NavBarContextValue;
11
11
  export {};
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
2
  import type { ButtonProps } from "../Button/Button";
3
- export declare const NavBarDropdownTriggerButton: React.ForwardRefExoticComponent<Pick<ButtonProps, "onFocus" | "onBlur" | "onClick" | "disabled"> & {
3
+ export declare const NavBarDropdownTriggerButton: React.ForwardRefExoticComponent<Pick<ButtonProps, "disabled" | "onBlur" | "onClick" | "onFocus"> & {
4
4
  children?: React.ReactNode | undefined;
5
5
  } & React.RefAttributes<HTMLButtonElement>>;
@@ -1 +1 @@
1
- export declare const DialogContext: React.Context<boolean>;
1
+ export declare const DialogContext: import("react").Context<boolean>;
@@ -20,8 +20,8 @@ export type EmptyStateProps = {
20
20
  };
21
21
  export declare function EmptyState({ title, titleAs, description, variant, icon, children, "data-e2e-test-id": dataE2eTestId, ...ariaAttributes }: EmptyStateProps): React.ReactElement;
22
22
  export declare namespace EmptyState {
23
- var ButtonGroup: typeof EmptyStateButtonGroup;
24
- var Link: typeof EmptyStateLink;
23
+ export { EmptyStateButtonGroup as ButtonGroup };
24
+ export { EmptyStateLink as Link };
25
25
  }
26
26
  declare function EmptyStateButtonGroup<C extends React.ElementType = "button">({ ...rest }: Omit<ButtonGroupProps<C>, "buttonSize">): React.ReactElement;
27
27
  declare function EmptyStateLink({ children, ...rest }: Omit<LinkProps, "size" | "color" | "weight"> & React.AnchorHTMLAttributes<HTMLAnchorElement> & {
@@ -102,9 +102,11 @@ type ImageProps = {
102
102
  ImageComponent: React.ElementType<any>;
103
103
  };
104
104
  export type ModalProps = BaseProps & ConditionalRoleProps & LabelProps & ImageProps & Pick<PortalProps, "portalContainer">;
105
+ declare const ModalStack: ({ children, ...rest }: Omit<StackProps, "space">) => React.JSX.Element;
106
+ declare const ModalText: ({ children, ...rest }: Omit<TextProps, "size" | "variant">) => React.JSX.Element;
105
107
  export declare function Modal({ header, subHeader, labelHeader, children, imageUrl, ImageComponent, secondaryButton, cancelButtonLabel, isDismissible, isFullScreen, isMaxWidthLimit, actionButton, role, onAction, size, privateProps: { skipPortal, height, zeroPadding, tabbableOptions }, portalContainer, closeButtonAriaLabel, "data-e2e-test-id": dataE2eTestId, imageAlt, initialFocus, ...ariaAttributes }: ModalProps): React.ReactElement;
106
108
  export declare namespace Modal {
107
- var Stack: ({ children, ...rest }: Omit<StackProps, "space">) => React.JSX.Element;
108
- var Text: ({ children, ...rest }: Omit<TextProps, "size" | "variant">) => React.JSX.Element;
109
+ export { ModalStack as Stack };
110
+ export { ModalText as Text };
109
111
  }
110
112
  export {};
@@ -6,4 +6,4 @@ export type PopoverContextValue = {
6
6
  */
7
7
  portalContainer?: HTMLElement | null;
8
8
  };
9
- export declare const PopoverContext: React.Context<PopoverContextValue>;
9
+ export declare const PopoverContext: import("react").Context<PopoverContextValue>;
@@ -70,5 +70,5 @@ export declare const PromptInput: React.ForwardRefExoticComponent<{
70
70
  onEnterKey: () => void;
71
71
  /** Renders an icon to the left inside the textarea */
72
72
  leftIcon?: IconName;
73
- } & Omit<PromptTextAreaProps, "size" | "selectedListItem" | "isAutocompleteListOpen" | "hasAutocomplete" | "hasLeftIcon"> & Pick<AutocompleteListProps, "portalContainer" | "autocompleteListItems" | "autocompleteListFooter"> & React.RefAttributes<HTMLTextAreaElement>>;
73
+ } & Omit<PromptTextAreaProps, "hasAutocomplete" | "hasLeftIcon" | "isAutocompleteListOpen" | "selectedListItem" | "size"> & Pick<AutocompleteListProps, "autocompleteListFooter" | "autocompleteListItems" | "portalContainer"> & React.RefAttributes<HTMLTextAreaElement>>;
74
74
  export {};
@@ -13,4 +13,4 @@ export declare const RadioCard: React.ForwardRefExoticComponent<{
13
13
  renderContent?: (params: {
14
14
  isSelected: boolean;
15
15
  }) => React.ReactNode;
16
- } & Omit<RadioProps, "errorMessages" | "hint" | "hideLabel"> & React.RefAttributes<HTMLInputElement>>;
16
+ } & Omit<RadioProps, "errorMessages" | "hideLabel" | "hint"> & React.RefAttributes<HTMLInputElement>>;
@@ -33,7 +33,9 @@ export type SearchResultProps = {
33
33
  /** The test id for the result's primary target. */
34
34
  "data-e2e-test-id"?: string;
35
35
  };
36
+ declare const defaultProps: Partial<SearchResultProps>;
36
37
  export declare function SearchResult({ title, subtitle, icon, details, body, secondaryTargets, link, labels, "data-e2e-test-id": dataE2eTestId, ...ariaAttributes }: SearchResultProps): React.ReactElement;
37
38
  export declare namespace SearchResult {
38
- var defaultProps: Partial<SearchResultProps>;
39
+ export { defaultProps };
39
40
  }
41
+ export {};
@@ -1 +1 @@
1
- import React,{useRef,useLayoutEffect,useState,useEffect,useCallback}from"react";import styled from"@emotion/styled";import{createPortal}from"react-dom";import{keyframes,Global}from"@emotion/react";import{FocusTrapWrapper}from"../../shared/FocusTrapWrapper";import{Container}from"../Container/Container";import{useDragDown}from"../../shared/useDragDown";import{StyledBackdrop}from"../Lightbox/Lightbox";import{isWithinScrolledElement}from"../../shared/isWithinScrolledElement";export const SHEET_MAX_HEIGHT="80svh";let StyledContainer=styled("div",{target:"e137uunh0",label:"StyledContainer"})(({theme,containerHeight,isClosing,isOpening,dragOffset=0})=>{let animation;if(containerHeight){let slideOut=keyframes({from:{transform:`translateY(${dragOffset}px)`},to:{transform:`translateY(${containerHeight}px)`}}),slideIn=keyframes({from:{transform:`translateY(${containerHeight}px)`},to:{transform:"translateY(0px)"}});animation=isClosing?`200ms ease-out forwards ${slideOut}`:isOpening?`300ms ease-out forwards ${slideIn}`:"none"}return{position:"fixed",left:0,bottom:0,width:"100vw",transformOrigin:"bottom",animation,boxSizing:"border-box",zIndex:theme.variables.zIndex.modal,"> div":{borderBottomLeftRadius:0,borderBottomRightRadius:0}}}),StyledContentContainer=styled("div",{target:"e137uunh1",label:"StyledContentContainer"})(({theme,isClosing,isOpening})=>{let animation,fadeOut=keyframes({from:{opacity:theme.variables.opacity.visible},to:{opacity:theme.variables.opacity.hidden}}),fadeIn=keyframes({from:{opacity:theme.variables.opacity.hidden},to:{opacity:theme.variables.opacity.visible}}),opacity=theme.variables.opacity.hidden;return isClosing?animation=`50ms ease-out forwards ${fadeOut}`:isOpening?animation=`50ms ease-out 250ms forwards ${fadeIn}`:(animation="none",opacity=theme.variables.opacity.visible),{overflow:"auto",maxHeight:"80svh",boxSizing:"border-box",overscrollBehavior:"none",backgroundColor:theme.values.color.background.elevated.default,opacity,animation}}),StyledHandleContainer=styled("div",{target:"e137uunh2",label:"StyledHandleContainer"})(({theme,isContentContainerScrolled})=>({padding:`${theme.variables.size.spacing.xs} 0`,display:"flex",justifyContent:"center",backgroundColor:theme.values.color.background.elevated.default,...isContentContainerScrolled&&{boxShadow:theme.values.elevation[1]}})),StyledHandle=styled("div",{target:"e137uunh3",label:"StyledHandle"})(({theme})=>({width:"80px",height:"4px",borderRadius:theme.variables.size.borderRadius.xs,backgroundColor:theme.values.color.divider.secondary}));export function Sheet({id,children,hasBackdrop,isVisible,onClose,onUnmount,portalContainer,dismissOnOutsideClick=!0,disableInitialFocus,disableReturnFocusToTrigger,onClickOutsideDeactivates,"data-e2e-test-id":dataE2eTestId,role,...ariaAttributes}){let[isClosing,setClosing]=useState(!1),[isOpening,setOpening]=useState(!1),[containerHeight,setContainerHeight]=useState(0),[isContentContainerScrolled,setContentContainerScrolled]=useState(!1),containerRef=useRef(null),contentContainerRef=useRef(null),handleContainerRef=useRef(null),prevVisibleState=useRef(!1),dragOffset=useRef(0),isDragStarted=useRef(!1);useLayoutEffect(()=>{isVisible&&setOpening(!0)},[isVisible]),useLayoutEffect(()=>{isVisible&&containerRef.current&&setContainerHeight(containerRef.current.getBoundingClientRect().height)},[isVisible,children]),useEffect(()=>{!isVisible&&prevVisibleState.current&&setClosing(!0),prevVisibleState.current=isVisible},[isVisible]),useEffect(()=>{isVisible&&isClosing&&onClose()},[isVisible,isClosing,onClose]);let handleDragStart=useCallback(()=>{requestAnimationFrame(()=>{contentContainerRef.current?.scrollTop===0&&containerRef.current&&(containerRef.current.style.animation="none",containerRef.current.style.transition="transform 0.1s ease",containerRef.current.style.transform="translateY(0px)",dragOffset.current=0,isDragStarted.current=!0)})},[containerRef,contentContainerRef]),handleDrag=useCallback((_,offsetFromStart)=>{let containerCurrentHeight=containerRef.current?.getBoundingClientRect()?.height??0;requestAnimationFrame(()=>{isDragStarted.current&&containerRef.current&&contentContainerRef.current?.scrollTop===0&&offsetFromStart<containerCurrentHeight&&(containerRef.current.style.transform=`translateY(${offsetFromStart}px)`,dragOffset.current=offsetFromStart)})},[containerRef,contentContainerRef]),handleDragEnd=useCallback((_,offsetFromStart)=>{let containerCurrentHeight=containerRef.current?.getBoundingClientRect()?.height??0,minDragDistance=containerCurrentHeight<300?containerCurrentHeight/4:150;requestAnimationFrame(()=>{isDragStarted.current&&(offsetFromStart>=minDragDistance&&contentContainerRef.current?.scrollTop===0?onClose():containerRef.current&&(containerRef.current.style.transform="translateY(0px)",dragOffset.current=0)),isDragStarted.current=!1})},[containerRef,onClose]),handleDragCancel=useCallback(()=>{requestAnimationFrame(()=>{isDragStarted.current&&containerRef.current&&(containerRef.current.style.transform="translateY(0px)",dragOffset.current=0),isDragStarted.current=!1})},[containerRef]),shouldInitiateDrag=useCallback(event=>{let target=event.target;return!!handleContainerRef.current?.contains(target)||!(isWithinScrolledElement(target,containerRef.current)||(contentContainerRef.current?.scrollTop??0)>0)},[containerRef,contentContainerRef,handleContainerRef]);useDragDown({ref:containerRef,isVisible,onDragStart:handleDragStart,onDrag:handleDrag,onDragEnd:handleDragEnd,onDragCancel:handleDragCancel,shouldInitiateDrag});let handlePostDeactivate=useCallback(()=>{onClose()},[onClose]);if(!((isVisible||isClosing)&&!(isVisible&&isClosing)))return null;let sheetElm=React.createElement(React.Fragment,null,React.createElement(Global,{styles:[{html:{overflow:"hidden",overscrollBehavior:"none"}}]}),React.createElement(FocusTrapWrapper,{active:isVisible,focusTrapOptions:{clickOutsideDeactivates:dismissOnOutsideClick&&onClickOutsideDeactivates?onClickOutsideDeactivates:dismissOnOutsideClick,allowOutsideClick:!0,escapeDeactivates:!0,preventScroll:!0,initialFocus:()=>!disableInitialFocus,returnFocusOnDeactivate:!disableReturnFocusToTrigger,fallbackFocus:'[data-ds-id="Sheet"]',onPostDeactivate:handlePostDeactivate}},React.createElement(StyledContainer,{...id?{id}:{},"data-e2e-test-id":dataE2eTestId,"data-ds-id":"Sheet",containerHeight:containerHeight,isClosing:isClosing,isOpening:isOpening,ref:containerRef,dragOffset:dragOffset.current,onAnimationEnd:()=>{isClosing?(setClosing(!1),setContainerHeight(0),dragOffset.current=0,onUnmount&&onUnmount()):isOpening&&setOpening(!1)},role:role,...ariaAttributes},React.createElement(Container,{elevation:4},React.createElement(StyledHandleContainer,{ref:handleContainerRef,isContentContainerScrolled:isContentContainerScrolled},React.createElement(StyledHandle,null)),React.createElement(StyledContentContainer,{isClosing:isClosing,isOpening:isOpening,ref:contentContainerRef,onScroll:()=>{setContentContainerScrolled(contentContainerRef.current?.scrollTop!==0)},onAnimationEnd:evt=>evt.stopPropagation()},children))))),wrappedSheet=hasBackdrop&&!isClosing?React.createElement(StyledBackdrop,null,sheetElm):sheetElm,container=portalContainer||!!document&&document.body;return container&&createPortal(wrappedSheet,container)}
1
+ import React,{useRef,useState,useEffect,useCallback}from"react";import styled from"@emotion/styled";import{createPortal}from"react-dom";import{keyframes,Global,useTheme}from"@emotion/react";import{FocusTrapWrapper}from"../../shared/FocusTrapWrapper";import{Container}from"../Container/Container";import{useExitAnimation}from"../../shared/useExitAnimation";import{useDocument}from"../../shared/useDocument";import{SHEET_HEIGHT_VAR,useSheetHeightSync}from"./useSheetHeightSync";export const SHEET_MAX_HEIGHT="80svh";let SCROLL_TIMELINE="--sheet-scroll",supportsScrollDrivenAnimations=()=>"undefined"!=typeof CSS&&"function"==typeof CSS.supports&&CSS.supports("animation-timeline: scroll()"),globalStyles={html:{overflow:"hidden",overscrollBehavior:"none"}},slideIn=keyframes({from:{transform:"translateY(100%)"},to:{transform:"translateY(0)"}},"label:slideIn"),slideOut=keyframes({from:{transform:"translateY(0)"},to:{transform:"translateY(100%)"}},"label:slideOut"),canScrollFurther=({element,direction})=>{if(!(direction<0?element.scrollTop>0:element.scrollTop+element.clientHeight<element.scrollHeight-1))return!1;let overflowY=element.ownerDocument.defaultView?.getComputedStyle(element).overflowY;return!!overflowY&&["auto","scroll","overlay"].includes(overflowY)},canContentTakeScroll=({target,boundary,direction})=>{let element=target instanceof Element?target:null;for(;element&&element!==boundary;){if(canScrollFurther({element,direction}))return!0;element=element.parentElement}return!1},SCROLL_KEY_DIRECTIONS={ArrowUp:-1,PageUp:-1,Home:-1,ArrowDown:1,PageDown:1,End:1},getScrollKeyDirection=({event,scroller})=>{let{target,key,shiftKey}=event;if(!(target instanceof HTMLElement&&(target.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(target.tagName)))){if(" "===key){if(target!==scroller)return;return shiftKey?-1:1}return SCROLL_KEY_DIRECTIONS[key]}},StyledRoot=styled("div",{target:"e1prhk2x0",label:"StyledRoot"})(({theme})=>({position:"fixed",inset:0,zIndex:theme.variables.zIndex.modal,pointerEvents:"none",timelineScope:SCROLL_TIMELINE})),holdStill=keyframes({from:{transform:"translateY(0)"},to:{transform:"translateY(0)"}},"label:holdStill"),getSlideAnimation=({isLeaving,isSwipedAway,theme})=>{let{enter,exit}=theme.variables.animation.sheet;return isLeaving?isSwipedAway?`${holdStill} ${exit.duration} linear forwards`:`${slideOut} ${exit.duration} ${exit.timingFunction} forwards`:`${slideIn} ${enter.duration} ${enter.timingFunction} both`},StyledBackdrop=styled("div",{target:"e1prhk2x1",label:"StyledBackdrop"})(({theme,isLeaving})=>{let{hidden,visible}=theme.variables.opacity,fadeIn=keyframes({from:{opacity:hidden},to:{opacity:visible}}),fadeOut=keyframes({from:{opacity:visible},to:{opacity:hidden}}),{enter,exit}=theme.variables.animation.sheet;return{position:"absolute",inset:0,pointerEvents:isLeaving?"none":"auto",animation:isLeaving?`${fadeOut} ${exit.duration} ${enter.timingFunction} forwards`:`${fadeIn} ${enter.duration} ${enter.timingFunction} both`,"@media (prefers-reduced-motion: reduce)":{animation:"none"}}}),StyledBackdropFill=styled("div",{target:"e1prhk2x2",label:"StyledBackdropFill"})(({theme})=>{let{hidden,visible}=theme.variables.opacity,dimWithSheet=keyframes({from:{opacity:hidden},to:{opacity:visible}});return{position:"absolute",inset:0,background:theme.values.color.background.backdrop.default,"@supports (animation-timeline: scroll())":{animation:`${dimWithSheet} linear both`,animationTimeline:SCROLL_TIMELINE}}}),StyledFrame=styled("div",{target:"e1prhk2x3",label:"StyledFrame"})(({theme})=>({position:"absolute",left:0,right:0,bottom:0,height:`var(${SHEET_HEIGHT_VAR}, auto)`,"::after":{content:'""',position:"absolute",top:"calc(100% - 1px)",left:0,right:0,height:SHEET_MAX_HEIGHT,backgroundColor:theme.values.color.background.elevated.default}})),StyledScroller=styled("div",{target:"e1prhk2x4",label:"StyledScroller"})(({theme,isLeaving,isSwipedAway})=>({position:"absolute",left:0,right:0,bottom:0,height:"calc(100% + 112px)",overflowY:"scroll",scrollSnapType:"y mandatory",overscrollBehavior:"none",scrollbarWidth:"none","::-webkit-scrollbar":{display:"none"},scrollTimeline:`${SCROLL_TIMELINE} y`,pointerEvents:isLeaving?"none":"auto",outline:"none",animation:getSlideAnimation({isLeaving,isSwipedAway,theme}),"@media (prefers-reduced-motion: reduce)":{animation:"none"}})),StyledClosedSnapPoint=styled("div",{target:"e1prhk2x5",label:"StyledClosedSnapPoint"})({height:"calc(100% + 64px + 1px)",scrollSnapAlign:"start"}),StyledSurface=styled("div",{target:"e1prhk2x6",label:"StyledSurface"})({scrollSnapAlign:"end","> div":{borderBottomLeftRadius:0,borderBottomRightRadius:0}}),StyledContentContainer=styled("div",{target:"e1prhk2x7",label:"StyledContentContainer"})(({theme})=>({overflow:"auto",maxHeight:SHEET_MAX_HEIGHT,boxSizing:"border-box",backgroundColor:theme.values.color.background.elevated.default})),StyledHandleContainer=styled("div",{target:"e1prhk2x8",label:"StyledHandleContainer"})(({theme,isContentContainerScrolled})=>({padding:`${theme.variables.size.spacing.xs} 0`,display:"flex",justifyContent:"center",backgroundColor:theme.values.color.background.elevated.default,...isContentContainerScrolled&&{boxShadow:theme.values.elevation[1]}})),StyledHandle=styled("div",{target:"e1prhk2x9",label:"StyledHandle"})(({theme})=>({width:"80px",height:"4px",borderRadius:theme.variables.size.borderRadius.xs,backgroundColor:theme.values.color.divider.secondary}));export function Sheet({id,children,hasBackdrop,isVisible,onClose,onUnmount,portalContainer,dismissOnOutsideClick=!0,disableInitialFocus,disableReturnFocusToTrigger,onClickOutsideDeactivates,"data-e2e-test-id":dataE2eTestId,role,...ariaAttributes}){let theme=useTheme(),document=useDocument(),{isMounted,isLeaving,onAnimationEnd}=useExitAnimation(isVisible),[isContentContainerScrolled,setContentContainerScrolled]=useState(!1),[isSwipedAway,setSwipedAway]=useState(!1),frameRef=useRef(null),scrollerRef=useRef(null),surfaceRef=useRef(null),backdropFillRef=useRef(null),contentContainerRef=useRef(null),wasMounted=useRef(isMounted);useEffect(()=>{wasMounted.current&&!isMounted&&onUnmount?.(),wasMounted.current=isMounted},[isMounted,onUnmount]),useSheetHeightSync({frameRef,scrollerRef,surfaceRef,isOpen:isVisible,resize:theme.variables.animation.sheet.resize}),useEffect(()=>{isVisible&&setSwipedAway(!1)},[isVisible]),useEffect(()=>{let scroller=scrollerRef.current,surface=surfaceRef.current;if(!isVisible||!scroller||!surface||"undefined"==typeof IntersectionObserver)return;let isHidden=!1,isTouching=!1,closeIfHidden=()=>{isHidden&&!isTouching&&(setSwipedAway(!0),onClose())},intersectionObserver=new IntersectionObserver(([entry])=>{isHidden=entry.intersectionRatio<.01,closeIfHidden()},{root:scroller,threshold:[.01]}),handleTouchStart=()=>{isTouching=!0},handleTouchEnd=()=>{isTouching=!1,closeIfHidden()};return intersectionObserver.observe(surface),scroller.addEventListener("touchstart",handleTouchStart,{passive:!0}),scroller.addEventListener("touchend",handleTouchEnd,{passive:!0}),scroller.addEventListener("touchcancel",handleTouchEnd,{passive:!0}),()=>{intersectionObserver.disconnect(),scroller.removeEventListener("touchstart",handleTouchStart),scroller.removeEventListener("touchend",handleTouchEnd),scroller.removeEventListener("touchcancel",handleTouchEnd)}},[isVisible,onClose]),useEffect(()=>{let scroller=scrollerRef.current;if(!isMounted||!scroller)return;let handleScrollerWheel=event=>{if(event.ctrlKey||0===event.deltaY)return;let direction=event.deltaY<0?-1:1;canContentTakeScroll({target:event.target,boundary:scroller,direction})||event.preventDefault()},handleScrollerKeyDown=event=>{let direction=getScrollKeyDirection({event,scroller});direction&&!canContentTakeScroll({target:event.target,boundary:scroller,direction})&&event.preventDefault()};return scroller.addEventListener("wheel",handleScrollerWheel,{passive:!1}),scroller.addEventListener("keydown",handleScrollerKeyDown),()=>{scroller.removeEventListener("wheel",handleScrollerWheel),scroller.removeEventListener("keydown",handleScrollerKeyDown)}},[isMounted]),useEffect(()=>{let scroller=scrollerRef.current,backdropFill=backdropFillRef.current;if(!isMounted||!scroller||!backdropFill||supportsScrollDrivenAnimations())return;let handleScrollerScroll=()=>{let maxScrollTop=scroller.scrollHeight-scroller.clientHeight;backdropFill.style.opacity=String(maxScrollTop>0?scroller.scrollTop/maxScrollTop:1)};return handleScrollerScroll(),scroller.addEventListener("scroll",handleScrollerScroll,{passive:!0}),()=>scroller.removeEventListener("scroll",handleScrollerScroll)},[isMounted,hasBackdrop]);let handlePostDeactivate=useCallback(()=>{onClose()},[onClose]);if(!isMounted)return null;let sheetElm=React.createElement(React.Fragment,null,React.createElement(Global,{styles:[globalStyles]}),React.createElement(StyledRoot,null,hasBackdrop&&React.createElement(StyledBackdrop,{isLeaving:isLeaving},React.createElement(StyledBackdropFill,{ref:backdropFillRef})),React.createElement(StyledFrame,{ref:frameRef},React.createElement(FocusTrapWrapper,{active:isVisible,focusTrapOptions:{clickOutsideDeactivates:dismissOnOutsideClick&&onClickOutsideDeactivates?onClickOutsideDeactivates:dismissOnOutsideClick,allowOutsideClick:!0,escapeDeactivates:!0,preventScroll:!0,initialFocus:()=>!disableInitialFocus,returnFocusOnDeactivate:!disableReturnFocusToTrigger,fallbackFocus:'[data-ds-id="Sheet"]',onPostDeactivate:handlePostDeactivate}},React.createElement(StyledScroller,{...id?{id}:{},"data-e2e-test-id":dataE2eTestId,"data-ds-id":"Sheet",ref:scrollerRef,isLeaving:isLeaving,isSwipedAway:isSwipedAway,onAnimationEnd:onAnimationEnd,onClick:event=>{!surfaceRef.current?.contains(event.target)&&dismissOnOutsideClick&&onClose()},role:role,...ariaAttributes},React.createElement(StyledClosedSnapPoint,null),React.createElement(StyledSurface,{ref:surfaceRef},React.createElement(Container,{elevation:4},React.createElement(StyledHandleContainer,{isContentContainerScrolled:isContentContainerScrolled},React.createElement(StyledHandle,null)),React.createElement(StyledContentContainer,{ref:contentContainerRef,onScroll:()=>{setContentContainerScrolled(contentContainerRef.current?.scrollTop!==0)}},children)))))))),container=portalContainer||document?.body;return container?createPortal(sheetElm,container):null}
@@ -0,0 +1,26 @@
1
+ import type { RefObject } from "react";
2
+ /** CSS variable the scroller reads its height from */
3
+ export declare const SHEET_HEIGHT_VAR = "--sheet-height";
4
+ type Motion = {
5
+ duration: string;
6
+ timingFunction: string;
7
+ };
8
+ type UseSheetHeightSyncOptions = {
9
+ /** Wraps the scroller: sized to the sheet, and moved to glide height changes */
10
+ frameRef: RefObject<HTMLElement | null>;
11
+ /** Snap scroller filling the frame */
12
+ scrollerRef: RefObject<HTMLElement | null>;
13
+ /** The sheet surface inside it */
14
+ surfaceRef: RefObject<HTMLElement | null>;
15
+ isOpen: boolean;
16
+ resize: Motion;
17
+ };
18
+ /**
19
+ * Keeps the snap scroller sized to the sheet and parked at the open position,
20
+ * and glides height changes instead of jumping: the sheet takes its new size
21
+ * at once and a compositor transform on the frame plays its top edge from the
22
+ * old position into place (FLIP). The frame sits outside the scroller, where a
23
+ * transform can't stretch the scrollable area and upset the snap position.
24
+ */
25
+ export declare function useSheetHeightSync({ frameRef, scrollerRef, surfaceRef, isOpen, resize: { duration, timingFunction }, }: UseSheetHeightSyncOptions): void;
26
+ export {};
@@ -0,0 +1 @@
1
+ import{useEffect,useLayoutEffect}from"react";import{useWindow}from"../../shared/useWindow";import{prefersReducedMotion}from"../../shared/prefersReducedMotion";export const SHEET_HEIGHT_VAR="--sheet-height";let sizeFrameToSheet=({frame,sheetHeight})=>frame.style.setProperty("--sheet-height",`${sheetHeight}px`),fitScrollerToSheet=({frame,scroller,sheetHeight})=>{sizeFrameToSheet({frame,sheetHeight}),scroller.scrollTop=scroller.scrollHeight},toMilliseconds=duration=>{let value=parseFloat(duration);return duration.trim().endsWith("ms")?value:duration.trim().endsWith("s")?1e3*value:value},getRenderedTranslateY=(element,window)=>{let{transform}=window.getComputedStyle(element);return"none"===transform?0:new DOMMatrixReadOnly(transform).m42};export function useSheetHeightSync({frameRef,scrollerRef,surfaceRef,isOpen,resize:{duration,timingFunction}}){let window=useWindow();useLayoutEffect(()=>{let frame=frameRef.current,scroller=scrollerRef.current,surface=surfaceRef.current;isOpen&&frame&&scroller&&surface&&fitScrollerToSheet({frame,scroller,sheetHeight:surface.offsetHeight})},[isOpen,frameRef,scrollerRef,surfaceRef]),useEffect(()=>{let heightAnimation,frame=frameRef.current,scroller=scrollerRef.current,surface=surfaceRef.current;if(!isOpen||!frame||!scroller||!surface||"undefined"==typeof ResizeObserver)return;let previousHeight=surface.offsetHeight,isTouching=!1,handleTouchStart=()=>{isTouching=!0,heightAnimation?.playState==="running"&&heightAnimation.pause()},handleTouchEnd=()=>{isTouching=!1,heightAnimation?.playState==="paused"&&heightAnimation.play()},resizeObserver=new ResizeObserver(()=>{let sheetHeight=surface.offsetHeight,heightDelta=sheetHeight-previousHeight;if(previousHeight=sheetHeight,0===heightDelta)return;if(isTouching)return void sizeFrameToSheet({frame,sheetHeight});let inFlightOffset=heightAnimation&&"finished"!==heightAnimation.playState?getRenderedTranslateY(frame,window):0;heightAnimation?.cancel(),fitScrollerToSheet({frame,scroller,sheetHeight}),"function"!=typeof frame.animate||prefersReducedMotion(window)||(heightAnimation=frame.animate([{transform:`translateY(${heightDelta+inFlightOffset}px)`},{transform:"none"}],{duration:toMilliseconds(duration),easing:timingFunction}))});return resizeObserver.observe(surface),scroller.addEventListener("touchstart",handleTouchStart,{passive:!0}),scroller.addEventListener("touchend",handleTouchEnd,{passive:!0}),scroller.addEventListener("touchcancel",handleTouchEnd,{passive:!0}),()=>{resizeObserver.disconnect(),heightAnimation?.cancel(),scroller.removeEventListener("touchstart",handleTouchStart),scroller.removeEventListener("touchend",handleTouchEnd),scroller.removeEventListener("touchcancel",handleTouchEnd)}},[isOpen,frameRef,scrollerRef,surfaceRef,window,duration,timingFunction])}