@cloudscape-design/components 3.0.148 → 3.0.149
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app-layout/index.d.ts.map +1 -1
- package/app-layout/index.js +15 -25
- package/app-layout/index.js.map +1 -1
- package/app-layout/utils/use-observed-element.d.ts +1 -1
- package/app-layout/utils/use-observed-element.d.ts.map +1 -1
- package/app-layout/utils/use-observed-element.js +3 -12
- package/app-layout/utils/use-observed-element.js.map +1 -1
- package/app-layout/visual-refresh/context.d.ts +2 -1
- package/app-layout/visual-refresh/context.d.ts.map +1 -1
- package/app-layout/visual-refresh/context.js +33 -27
- package/app-layout/visual-refresh/context.js.map +1 -1
- package/app-layout/visual-refresh/layout.d.ts.map +1 -1
- package/app-layout/visual-refresh/layout.js +2 -30
- package/app-layout/visual-refresh/layout.js.map +1 -1
- package/app-layout/visual-refresh/split-panel.d.ts.map +1 -1
- package/app-layout/visual-refresh/split-panel.js +6 -14
- package/app-layout/visual-refresh/split-panel.js.map +1 -1
- package/internal/context/split-panel-context.d.ts +1 -3
- package/internal/context/split-panel-context.d.ts.map +1 -1
- package/internal/context/split-panel-context.js +2 -4
- package/internal/context/split-panel-context.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/split-panel/bottom.d.ts.map +1 -1
- package/split-panel/bottom.js +11 -3
- package/split-panel/bottom.js.map +1 -1
- package/split-panel/index.d.ts.map +1 -1
- package/split-panel/index.js +2 -2
- package/split-panel/index.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/context.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EACZ,aAAa,EACb,SAAS,EACT,WAAW,EACX,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,QAAQ,GACT,MAAM,OA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AEpD,OAAO,CACL,oBAAC,gBAAgB,CAAC,QAAQ,IACxB,KAAK,iCACA,QAAQ,GACR,KAAK,KACR,WAAW,aAAA,EACX,oBAAoB,sBAAA,EACpB,YAAY,cAAA,EACZ,YAAY,cAAA,EACZ,oBAAoB,sBAAA,EACpB,qBAAqB,uBAAA,EACrB,qBAAqB,uBAAA,EACrB,iCAAiC,mCAAA,EACjC,sBAAsB,wBAAA,EACtB,gBAAgB,kBAAA,EAChB,uBAAuB,yBAAA,EACvB,mBAAmB,qBAAA,EACnB,cAAc,gBAAA,EACd,QAAQ,UAAA,EACR,gBAAgB,EAAE,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,KAAK,EAC3C,0BAA0B,4BAAA,EAC1B,gBAAgB,kBAAA,EAChB,WAAW,aAAA,EACX,aAAa,eAAA,EACb,WAAW,aAAA,EACX,WAAW,aAAA,EACX,cAAc,gBAAA,EACd,eAAe,iBAAA,EACf,eAAe,iBAAA,EACf,cAAc,gBAAA,EACd,oBAAoB,sBAAA,EACpB,mBAAmB,qBAAA,EACnB,YAAY,cAAA,EACZ,uBAAuB,yBAAA,EACvB,sBAAsB,wBAAA,EACtB,eAAe,iBAAA,EACf,yBAAyB,2BAAA,EACzB,kBAAkB,oBAAA,EAClB,kBAAkB,oBAAA,EAClB,kBAAkB,oBAAA,EAClB,qBAAqB,uBAAA,EACrB,sBAAsB,wBAAA,EACtB,cAAc,gBAAA,EACd,SAAS,WAAA,EACT,SAAS,EAAE,WAAW,EACtB,UAAU,YAAA,EACV,iBAAiB,mBAAA,OAGlB,QAAQ,CACiB,CAC7B,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, {\n createContext,\n createRef,\n useCallback,\n useEffect,\n useLayoutEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport { AppLayoutProps } from '../interfaces';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport { getSplitPanelPosition } from './split-panel';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { useMobile } from '../../internal/hooks/use-mobile';\nimport { useContainerQuery, useResizeObserver } from '../../internal/hooks/container-queries';\nimport { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';\nimport styles from './styles.css.js';\nimport { isDevelopment } from '../../internal/is-development';\nimport { warnOnce } from '../../internal/logging';\nimport { applyDefaults } from '../defaults';\nimport { FocusControlState, useFocusControl } from '../utils/use-focus-control';\n\ninterface AppLayoutContextProps extends AppLayoutProps {\n dynamicOverlapHeight: number;\n handleSplitPanelClick: () => void;\n handleNavigationClick: (isOpen: boolean) => void;\n handleSplitPanelPreferencesChange: (detail: AppLayoutProps.SplitPanelPreferences) => void;\n handleSplitPanelResize: (detail: { size: number }) => void;\n handleToolsClick: (value: boolean) => void;\n hasDefaultToolsWidth: boolean;\n hasNotificationsContent: boolean;\n hasStickyBackground: boolean;\n isAnyPanelOpen: boolean;\n isMobile: boolean;\n isNavigationOpen: boolean;\n isSplitPanelForcedPosition: boolean;\n isSplitPanelOpen?: boolean;\n isToolsOpen: boolean;\n layoutElement: React.Ref<HTMLElement>;\n layoutWidth: number;\n mainElement: React.Ref<HTMLDivElement>;\n mainOffsetLeft: number;\n notificationsElement: React.Ref<HTMLDivElement>;\n notificationsHeight: number;\n offsetBottom: number;\n setDynamicOverlapHeight: (value: number) => void;\n setHasStickyBackground: (value: boolean) => void;\n setIsNavigationOpen: (value: boolean) => void;\n setIsToolsOpen: (value: boolean) => void;\n setOffsetBottom: (value: number) => void;\n setSplitPanelReportedSize: (value: number) => void;\n headerHeight: number;\n footerHeight: number;\n splitPanelMaxWidth: number;\n splitPanelMinWidth: number;\n splitPanelPosition: AppLayoutProps.SplitPanelPosition;\n splitPanelReportedSize: number;\n toolsFocusControl: FocusControlState;\n}\n\n// TODO simplify default params + typings\nconst defaults: AppLayoutContextProps = {\n breadcrumbs: null,\n content: null,\n contentHeader: null,\n contentType: 'default',\n disableBodyScroll: false,\n disableContentHeaderOverlap: false,\n disableContentPaddings: false,\n dynamicOverlapHeight: 0,\n headerHeight: 0,\n footerHeight: 0,\n handleNavigationClick: (value: boolean) => value,\n handleSplitPanelClick: () => {},\n handleSplitPanelPreferencesChange: () => {},\n handleSplitPanelResize: () => {},\n handleToolsClick: (value: boolean) => value,\n hasDefaultToolsWidth: true,\n hasNotificationsContent: false,\n hasStickyBackground: false,\n isAnyPanelOpen: false,\n isMobile: false,\n isNavigationOpen: false,\n isSplitPanelForcedPosition: false,\n isSplitPanelOpen: false,\n isToolsOpen: false,\n // TODO: these refs are currently only instantiated once globally\n layoutElement: createRef<HTMLElement>(),\n layoutWidth: 0,\n mainElement: createRef<HTMLDivElement>(),\n mainOffsetLeft: 0,\n maxContentWidth: 0,\n minContentWidth: 280,\n navigation: null,\n navigationHide: false,\n navigationOpen: false,\n notifications: null,\n notificationsElement: createRef<HTMLDivElement>(),\n notificationsHeight: 0,\n offsetBottom: 0,\n onNavigationChange: () => {},\n onSplitPanelResize: () => {},\n onSplitPanelToggle: () => {},\n onSplitPanelPreferencesChange: () => {},\n setDynamicOverlapHeight: (value: number) => void value,\n setHasStickyBackground: (value: boolean) => value,\n setIsNavigationOpen: (value: boolean) => value,\n setIsToolsOpen: (value: boolean) => value,\n setOffsetBottom: (value: number) => void value,\n setSplitPanelReportedSize: (value: number) => void value,\n splitPanelMaxWidth: 280,\n splitPanelMinWidth: 280,\n splitPanelOpen: false,\n splitPanelPosition: 'bottom',\n splitPanelPreferences: { position: 'bottom' },\n splitPanelReportedSize: 0,\n splitPanelSize: 0,\n stickyNotifications: false,\n tools: null,\n toolsFocusControl: {} as FocusControlState,\n};\n\n/**\n * The default values are destructured in the context instantiation to\n * prevent downstream Typescript errors. This could likely be replaced\n * by a context interface definition that extends the AppLayout interface.\n */\nexport const AppLayoutContext = createContext({ ...defaults });\n\ntype AppLayoutProviderProps = AppLayoutProps & {\n children: React.ReactNode;\n};\n\nexport const AppLayoutProvider = React.forwardRef(\n (\n {\n toolsHide,\n toolsOpen: controlledToolsOpen,\n navigationHide,\n navigationOpen: controlledNavigationOpen,\n contentType = 'default',\n headerSelector = '#b #h',\n footerSelector = '#b #h',\n children,\n ...props\n }: AppLayoutProviderProps,\n forwardRef: React.Ref<AppLayoutProps.Ref>\n ) => {\n const isMobile = useMobile();\n\n if (isDevelopment) {\n if (controlledToolsOpen && toolsHide) {\n warnOnce(\n 'AppLayout',\n `You have enabled both the \\`toolsOpen\\` prop and the \\`toolsHide\\` prop. This is not supported. Set \\`toolsOpen\\` to \\`false\\` when you set \\`toolsHide\\` to \\`true\\`.`\n );\n }\n }\n\n /**\n * The overlap height has a default set in CSS but can also be dynamically overridden\n * for content types (such as Table and Wizard) that have variable size content in the overlap.\n * If a child component utilizes a sticky header the hasStickyBackground property will determine\n * if the background remains in the same vertical position.\n */\n const [dynamicOverlapHeight, setDynamicOverlapHeight] = useState(0);\n const [hasStickyBackground, setHasStickyBackground] = useState(false);\n\n /**\n * Set the default values for minimum and maximum content width.\n */\n const geckoMaxCssLength = ((1 << 30) - 1) / 60;\n const halfGeckoMaxCssLength = geckoMaxCssLength / 2;\n // CSS lengths in Gecko are limited to at most (1<<30)-1 app units (Gecko uses 60 as app unit).\n // Limit the maxContentWidth to the half of the upper boundary (≈4230^2) to be on the safe side.\n const maxContentWidth =\n props.maxContentWidth && props.maxContentWidth > halfGeckoMaxCssLength\n ? halfGeckoMaxCssLength\n : props.maxContentWidth ?? 0;\n const minContentWidth = props.minContentWidth ?? 280;\n\n /**\n * Determine the default state of the Navigation and Tools drawers.\n * Mobile viewports should be closed by default under all circumstances.\n * If the navigationOpen prop has been set then that should take precedence\n * over the contentType prop. Desktop viewports that do not have the\n * navigationOpen or contentType props set will use the default contentType.\n */\n const contentTypeDefaults = applyDefaults(contentType, { maxContentWidth, minContentWidth }, true);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Navigation drawer. The logic\n * for determining the default state is colocated with the Navigation component.\n *\n * The callback that will be passed to the Navigation and AppBar\n * components to handle the click events that will change the state\n * of the Navigation drawer. It will set the Navigation state with the\n * useControllable hook and also fire the onNavigationChange function to\n * emit the state change.\n */\n const [isNavigationOpen = false, setIsNavigationOpen] = useControllable(\n controlledNavigationOpen,\n props.onNavigationChange,\n isMobile ? false : contentTypeDefaults.navigationOpen,\n { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }\n );\n\n const handleNavigationClick = useCallback(\n function handleNavigationChange(isOpen: boolean) {\n setIsNavigationOpen(isOpen);\n fireNonCancelableEvent(props.onNavigationChange, { open: isOpen });\n },\n [props.onNavigationChange, setIsNavigationOpen]\n );\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Tools drawer. The logic\n * for determining the default state is colocated with the Tools component.\n *\n * The callback that will be passed to the Navigation and AppBar\n * components to handle the click events that will change the state\n * of the Tools drawer. It will set the Tools state with the\n * useControllable hook and also fire the onToolsChange function to\n * emit the state change.\n */\n const toolsWidth = props.toolsWidth ?? 290;\n const hasDefaultToolsWidth = props.toolsWidth === undefined;\n\n const [isToolsOpen = false, setIsToolsOpen] = useControllable(\n controlledToolsOpen,\n props.onToolsChange,\n isMobile ? false : contentTypeDefaults.toolsOpen,\n { componentName: 'AppLayout', controlledProp: 'toolsOpen', changeHandler: 'onToolsChange' }\n );\n\n const toolsFocusControl = useFocusControl(isToolsOpen, true);\n\n const handleToolsClick = useCallback(\n function handleToolsChange(isOpen: boolean) {\n setIsToolsOpen(isOpen);\n fireNonCancelableEvent(props.onToolsChange, { open: isOpen });\n },\n [props.onToolsChange, setIsToolsOpen]\n );\n\n const navigationVisible = !navigationHide && isNavigationOpen;\n const toolsVisible = !toolsHide && isToolsOpen;\n const isAnyPanelOpen = navigationVisible || toolsVisible;\n\n /**\n * On mobile viewports the navigation and tools drawers are adjusted to a fixed position\n * that consumes 100% of the viewport height and width. The body content could potentially\n * be scrollable underneath the drawer. In order to prevent this a CSS class needs to be\n * added to the document body that sets overflow to hidden.\n */\n useEffect(\n function handleBodyScroll() {\n if (isMobile && (isNavigationOpen || isToolsOpen)) {\n document.body.classList.add(styles['block-body-scroll']);\n } else {\n document.body.classList.remove(styles['block-body-scroll']);\n }\n\n // Ensure the CSS class is removed from the body on side effect cleanup\n return function cleanup() {\n document.body.classList.remove(styles['block-body-scroll']);\n };\n },\n [isMobile, isNavigationOpen, isToolsOpen]\n );\n\n /**\n * The useImperativeHandle hook in conjunction with the forwardRef function\n * in the AppLayout component definition expose the following callable\n * functions to component consumers when they put a ref as a property on\n * their component implementation.\n */\n useImperativeHandle(\n forwardRef,\n function createImperativeHandle() {\n return {\n closeNavigationIfNecessary: function () {\n isMobile && handleNavigationClick(false);\n },\n openTools: function () {\n handleToolsClick(true);\n },\n focusToolsClose: toolsFocusControl.setFocus,\n };\n },\n [isMobile, handleNavigationClick, handleToolsClick, toolsFocusControl.setFocus]\n );\n\n /**\n * Query the DOM for the header and footer elements based on the selectors provided\n * by the properties and pass the heights to the custom property definitions.\n */\n const [headerHeight, setHeaderHeight] = useState(0);\n const getHeader = useCallback(() => document.querySelector(headerSelector), [headerSelector]);\n useResizeObserver(getHeader, entry => setHeaderHeight(entry.borderBoxHeight));\n\n const [footerHeight, setFooterHeight] = useState(0);\n const getFooter = useCallback(() => document.querySelector(footerSelector), [footerSelector]);\n useResizeObserver(getFooter, entry => setFooterHeight(entry.borderBoxHeight));\n\n /**\n * Set the default values for the minimum and maximum Split Panel width when it is\n * in the side position. The useLayoutEffect will compute the available space in the\n * DOM for the Split Panel given the current state. The minimum and maximum\n * widths will potentially trigger a side effect that will put the Split Panel into\n * a forced position on the bottom.\n */\n const splitPanelMinWidth = 280;\n const [splitPanelMaxWidth, setSplitPanelMaxWidth] = useState(splitPanelMinWidth);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Split Panel. By default\n * the Split Panel should always be closed on page load.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the click events that will change the state of the SplitPanel\n * to open or closed given the current state. It will set the isSplitPanelOpen\n * controlled state and fire the onSplitPanelToggle event.\n */\n const [isSplitPanelOpen, setIsSplitPanelOpen] = useControllable(\n props.splitPanelOpen,\n props.onSplitPanelToggle,\n false,\n { componentName: 'AppLayout', controlledProp: 'splitPanelOpen', changeHandler: 'onSplitPanelToggle' }\n );\n\n const handleSplitPanelClick = useCallback(\n function handleSplitPanelChange() {\n setIsSplitPanelOpen(!isSplitPanelOpen);\n fireNonCancelableEvent(props.onSplitPanelToggle, { open: !isSplitPanelOpen });\n },\n [props.onSplitPanelToggle, isSplitPanelOpen, setIsSplitPanelOpen]\n );\n\n /**\n * The useControllable hook will manage the controlled or uncontrolled\n * state of the splitPanelPreferences. By default the splitPanelPreferences\n * is undefined. When set the object shape should have a single key to indicate\n * either bottom or side position.\n *\n * The callback that will handle changes to the splitPanelPreferences\n * object that will determine if the SplitPanel is rendered either on the\n * bottom of the viewport or within the Tools container.\n */\n const [splitPanelPreferences, setSplitPanelPreferences] = useControllable(\n props.splitPanelPreferences,\n props.onSplitPanelPreferencesChange,\n undefined,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelPreferences',\n changeHandler: 'onSplitPanelPreferencesChange',\n }\n );\n\n /**\n * The Split Panel will be in forced (bottom) position if the defined minimum width is\n * greater than the maximum width. In other words, the maximum width is the currently\n * available horizontal space based on all other components that are rendered. If the\n * minimum width exceeds this value then there is not enough horizontal space and we must\n * force it to the bottom position.\n */\n const [isSplitPanelForcedPosition, setSplitPanelForcedPosition] = useState(false);\n const splitPanelPosition = getSplitPanelPosition(isSplitPanelForcedPosition, splitPanelPreferences);\n\n useLayoutEffect(\n function handleSplitPanelForcePosition() {\n setSplitPanelForcedPosition(splitPanelMinWidth > splitPanelMaxWidth);\n },\n [splitPanelMaxWidth, splitPanelMinWidth]\n );\n\n /**\n * The useControllable hook will set the default size of the SplitPanel based\n * on the default position set in the splitPanelPreferences. The logic for the\n * default size is contained in the SplitPanel component. The splitPanelControlledSize\n * will be bound to the size property in the SplitPanel context for rendering.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the resize events that will change the size of the SplitPanel.\n * It will set the splitPanelControlledSize controlled state and fire the\n * onSplitPanelResize event.\n */\n const [splitPanelReportedSize, setSplitPanelReportedSize] = useState(0);\n\n const [splitPanelSize, setSplitPanelSize] = useControllable(\n props.splitPanelSize,\n props.onSplitPanelResize,\n getSplitPanelDefaultSize(splitPanelPosition),\n { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' }\n );\n\n const handleSplitPanelResize = useCallback(\n function handleSplitPanelChange(detail: { size: number }) {\n setSplitPanelSize(detail.size);\n fireNonCancelableEvent(props.onSplitPanelResize, detail);\n },\n [props.onSplitPanelResize, setSplitPanelSize]\n );\n\n const handleSplitPanelPreferencesChange = useCallback(\n function handleSplitPanelChange(detail: AppLayoutProps.SplitPanelPreferences) {\n setSplitPanelPreferences(detail);\n fireNonCancelableEvent(props.onSplitPanelPreferencesChange, detail);\n },\n [props.onSplitPanelPreferencesChange, setSplitPanelPreferences]\n );\n\n /**\n * The Layout element is not necessarily synonymous with the client\n * viewport width. There can be content in the horizontal viewport\n * that exists on either side of the AppLayout. This resize observer\n * will set the custom property of the Layout element width that\n * is used for various horizontal constraints such as the maximum\n * allowed width of the Tools container.\n *\n * The offsetLeft of the Main will return the distance that the\n * Main element has from the left edge of the Layout component.\n * The offsetLeft value can vary based on the presence and state\n * of the Navigation as well as content gaps in the grid definition.\n * This value is used to determine the max width constraint calculation\n * for the Tools container.\n */\n const [layoutContainerQuery, layoutElement] = useContainerQuery(rect => rect.width);\n const layoutWidth = layoutContainerQuery ?? 0;\n\n const mainElement = useRef<HTMLDivElement>(null);\n const [mainOffsetLeft, setMainOffsetLeft] = useState(0);\n\n useLayoutEffect(\n function handleMainOffsetLeft() {\n setMainOffsetLeft(mainElement?.current?.offsetLeft ?? 0);\n },\n [layoutWidth, isNavigationOpen, isToolsOpen, splitPanelReportedSize]\n );\n\n useLayoutEffect(\n function handleSplitPanelMaxWidth() {\n /**\n * Warning! This is a hack! In order to accurately calculate if there is adequate\n * horizontal space for the Split Panel to be in the side position we need two values\n * that are not available in JavaScript.\n *\n * The first is the the content gap on the right which is stored in a design token\n * and applied in the Layout CSS:\n *\n * $contentGapRight: #{awsui.$space-scaled-2x-xxxl};\n *\n * The second is the width of the element that has the circular buttons for the\n * Tools and Split Panel. This could be suppressed given the state of the Tools\n * drawer returning a zero value. It would, however, be rendered if the Split Panel\n * were to move into the side position. This is calculated in the Tools CSS and\n * the Trigger button CSS with design tokens:\n *\n * padding: awsui.$space-scaled-s awsui.$space-layout-toggle-padding;\n * width: awsui.$space-layout-toggle-diameter;\n *\n * These values will be defined below as static integers that are rough approximations\n * of their computed width when rendered in the DOM, but doubled to ensure adequate\n * spacing for the Split Panel to be in side position.\n */\n const contentGapRight = 80; // Approximately 40px when rendered but doubled for safety\n const toolsFormOffsetWidth = 160; // Approximately 80px when rendered but doubled for safety\n const toolsOffsetWidth = isToolsOpen ? toolsWidth : 0;\n\n setSplitPanelMaxWidth(\n layoutWidth - mainOffsetLeft - minContentWidth - contentGapRight - toolsOffsetWidth - toolsFormOffsetWidth\n );\n },\n [isNavigationOpen, isToolsOpen, layoutWidth, mainOffsetLeft, minContentWidth, toolsWidth]\n );\n\n /**\n * Because the notifications slot does not give us any direction insight into\n * what the state of the child content is we need to have a mechanism for\n * tracking the height of the notifications and whether or not it has content.\n * The height of the notifications is an integer that will be used as a custom\n * property on the Layout component to determine what the sticky offset should\n * be if there are sticky notifications. This could be any number including\n * zero based on how the child content renders. The hasNotificationsContent boolean\n * is simply centralizing the logic of the notifications height being > 0 such\n * that it is not repeated in various components (such as AppBar) that need to\n * know if the notifications slot is empty.\n */\n const [notificationsContainerQuery, notificationsElement] = useContainerQuery(rect => rect.height);\n const [notificationsHeight, setNotificationsHeight] = useState(0);\n const [hasNotificationsContent, setHasNotificationsContent] = useState(false);\n\n useEffect(\n function handleNotificationsContent() {\n setNotificationsHeight(notificationsContainerQuery ?? 0);\n setHasNotificationsContent(notificationsContainerQuery && notificationsContainerQuery > 0 ? true : false);\n },\n [notificationsContainerQuery]\n );\n\n /**\n * The offsetBottom value is used to determine the distance from the bottom of the\n * viewport a sticky element should be placed. A non-zero value means that there\n * is either a footer outside of the AppLayout, a SplitPanel in the bottom position\n * within the AppLayout, or both.\n */\n const [offsetBottom, setOffsetBottom] = useState(0);\n\n return (\n <AppLayoutContext.Provider\n value={{\n ...defaults,\n ...props,\n contentType,\n dynamicOverlapHeight,\n headerHeight,\n footerHeight,\n hasDefaultToolsWidth,\n handleNavigationClick,\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n handleToolsClick,\n hasNotificationsContent,\n hasStickyBackground,\n isAnyPanelOpen,\n isMobile,\n isNavigationOpen: isNavigationOpen ?? false,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n isToolsOpen,\n layoutElement,\n layoutWidth,\n mainElement,\n mainOffsetLeft,\n maxContentWidth,\n minContentWidth,\n navigationHide,\n notificationsElement,\n notificationsHeight,\n offsetBottom,\n setDynamicOverlapHeight,\n setHasStickyBackground,\n setOffsetBottom,\n setSplitPanelReportedSize,\n splitPanelMaxWidth,\n splitPanelMinWidth,\n splitPanelPosition,\n splitPanelPreferences,\n splitPanelReportedSize,\n splitPanelSize,\n toolsHide,\n toolsOpen: isToolsOpen,\n toolsWidth,\n toolsFocusControl,\n }}\n >\n {children}\n </AppLayoutContext.Provider>\n );\n }\n);\n"]}
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/context.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EACZ,aAAa,EACb,SAAS,EACT,WAAW,EACX,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,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uBAAuB,yBAAA,EACvB,mBAAmB,qBAAA,EACnB,cAAc,gBAAA,EACd,QAAQ,UAAA,EACR,gBAAgB,EAAE,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,KAAK,EAC3C,0BAA0B,4BAAA,EAC1B,gBAAgB,kBAAA,EAChB,WAAW,aAAA,EACX,aAAa,eAAA,EACb,WAAW,aAAA,EACX,WAAW,aAAA,EACX,cAAc,gBAAA,EACd,eAAe,iBAAA,EACf,eAAe,iBAAA,EACf,cAAc,gBAAA,EACd,oBAAoB,sBAAA,EACpB,mBAAmB,qBAAA,EACnB,YAAY,cAAA,EACZ,uBAAuB,yBAAA,EACvB,sBAAsB,wBAAA,EACtB,yBAAyB,2BAAA,EACzB,iCAAiC,mCAAA,EACjC,UAAU,YAAA,EACV,kBAAkB,oBAAA,EAClB,kBAAkB,oBAAA,EAClB,kBAAkB,oBAAA,EAClB,qBAAqB,uBAAA,EACrB,sBAAsB,wBAAA,EACtB,8BAA8B,gCAAA,EAC9B,cAAc,gBAAA,EACd,SAAS,WAAA,EACT,SAAS,EAAE,WAAW,EACtB,UAAU,YAAA,EACV,iBAAiB,mBAAA,OAGlB,QAAQ,CACiB,CAC7B,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, {\n createContext,\n createRef,\n useCallback,\n useEffect,\n useLayoutEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport { AppLayoutProps } from '../interfaces';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport { getSplitPanelPosition } from './split-panel';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { useMobile } from '../../internal/hooks/use-mobile';\nimport { useContainerQuery } from '../../internal/hooks/container-queries';\nimport { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';\nimport styles from './styles.css.js';\nimport { isDevelopment } from '../../internal/is-development';\nimport { warnOnce } from '../../internal/logging';\nimport { applyDefaults } from '../defaults';\nimport { FocusControlState, useFocusControl } from '../utils/use-focus-control';\nimport { useObservedElement } from '../utils/use-observed-element';\n\ninterface AppLayoutContextProps extends AppLayoutProps {\n dynamicOverlapHeight: number;\n handleSplitPanelClick: () => void;\n handleNavigationClick: (isOpen: boolean) => void;\n handleSplitPanelPreferencesChange: (detail: AppLayoutProps.SplitPanelPreferences) => void;\n handleSplitPanelResize: (detail: { size: number }) => void;\n handleToolsClick: (value: boolean) => void;\n hasDefaultToolsWidth: boolean;\n hasNotificationsContent: boolean;\n hasStickyBackground: boolean;\n isAnyPanelOpen: boolean;\n isMobile: boolean;\n isNavigationOpen: boolean;\n isSplitPanelForcedPosition: boolean;\n isSplitPanelOpen?: boolean;\n isToolsOpen: boolean;\n layoutElement: React.Ref<HTMLElement>;\n layoutWidth: number;\n mainElement: React.Ref<HTMLDivElement>;\n mainOffsetLeft: number;\n notificationsElement: React.Ref<HTMLDivElement>;\n notificationsHeight: number;\n offsetBottom: number;\n setDynamicOverlapHeight: (value: number) => void;\n setHasStickyBackground: (value: boolean) => void;\n setIsNavigationOpen: (value: boolean) => void;\n setIsToolsOpen: (value: boolean) => void;\n setSplitPanelReportedSize: (value: number) => void;\n setSplitPanelReportedHeaderHeight: (value: number) => void;\n headerHeight: number;\n footerHeight: number;\n splitPanelMaxWidth: number;\n splitPanelMinWidth: number;\n splitPanelPosition: AppLayoutProps.SplitPanelPosition;\n splitPanelReportedSize: number;\n splitPanelReportedHeaderHeight: number;\n toolsFocusControl: FocusControlState;\n}\n\n// TODO simplify default params + typings\nconst defaults: AppLayoutContextProps = {\n breadcrumbs: null,\n content: null,\n contentHeader: null,\n contentType: 'default',\n disableBodyScroll: false,\n disableContentHeaderOverlap: false,\n disableContentPaddings: false,\n dynamicOverlapHeight: 0,\n headerHeight: 0,\n footerHeight: 0,\n handleNavigationClick: (value: boolean) => value,\n handleSplitPanelClick: () => {},\n handleSplitPanelPreferencesChange: () => {},\n handleSplitPanelResize: () => {},\n handleToolsClick: (value: boolean) => value,\n hasDefaultToolsWidth: true,\n hasNotificationsContent: false,\n hasStickyBackground: false,\n isAnyPanelOpen: false,\n isMobile: false,\n isNavigationOpen: false,\n isSplitPanelForcedPosition: false,\n isSplitPanelOpen: false,\n isToolsOpen: false,\n // TODO: these refs are currently only instantiated once globally\n layoutElement: createRef<HTMLElement>(),\n layoutWidth: 0,\n mainElement: createRef<HTMLDivElement>(),\n mainOffsetLeft: 0,\n maxContentWidth: 0,\n minContentWidth: 280,\n navigation: null,\n navigationHide: false,\n navigationOpen: false,\n notifications: null,\n notificationsElement: createRef<HTMLDivElement>(),\n notificationsHeight: 0,\n offsetBottom: 0,\n onNavigationChange: () => {},\n onSplitPanelResize: () => {},\n onSplitPanelToggle: () => {},\n onSplitPanelPreferencesChange: () => {},\n setDynamicOverlapHeight: (value: number) => void value,\n setHasStickyBackground: (value: boolean) => value,\n setIsNavigationOpen: (value: boolean) => value,\n setIsToolsOpen: (value: boolean) => value,\n setSplitPanelReportedSize: (value: number) => void value,\n setSplitPanelReportedHeaderHeight: (value: number) => void value,\n splitPanelMaxWidth: 280,\n splitPanelMinWidth: 280,\n splitPanelOpen: false,\n splitPanelPosition: 'bottom',\n splitPanelPreferences: { position: 'bottom' },\n splitPanelReportedSize: 0,\n splitPanelReportedHeaderHeight: 0,\n splitPanelSize: 0,\n stickyNotifications: false,\n tools: null,\n toolsFocusControl: {} as FocusControlState,\n};\n\n/**\n * The default values are destructured in the context instantiation to\n * prevent downstream Typescript errors. This could likely be replaced\n * by a context interface definition that extends the AppLayout interface.\n */\nexport const AppLayoutContext = createContext({ ...defaults });\n\ntype AppLayoutProviderProps = AppLayoutProps & {\n children: React.ReactNode;\n};\n\nexport const AppLayoutProvider = React.forwardRef(\n (\n {\n toolsHide,\n toolsOpen: controlledToolsOpen,\n navigationHide,\n navigationOpen: controlledNavigationOpen,\n contentType = 'default',\n headerSelector = '#b #h',\n footerSelector = '#b #h',\n children,\n splitPanel,\n ...props\n }: AppLayoutProviderProps,\n forwardRef: React.Ref<AppLayoutProps.Ref>\n ) => {\n const isMobile = useMobile();\n\n if (isDevelopment) {\n if (controlledToolsOpen && toolsHide) {\n warnOnce(\n 'AppLayout',\n `You have enabled both the \\`toolsOpen\\` prop and the \\`toolsHide\\` prop. This is not supported. Set \\`toolsOpen\\` to \\`false\\` when you set \\`toolsHide\\` to \\`true\\`.`\n );\n }\n }\n\n /**\n * The overlap height has a default set in CSS but can also be dynamically overridden\n * for content types (such as Table and Wizard) that have variable size content in the overlap.\n * If a child component utilizes a sticky header the hasStickyBackground property will determine\n * if the background remains in the same vertical position.\n */\n const [dynamicOverlapHeight, setDynamicOverlapHeight] = useState(0);\n const [hasStickyBackground, setHasStickyBackground] = useState(false);\n\n /**\n * Set the default values for minimum and maximum content width.\n */\n const geckoMaxCssLength = ((1 << 30) - 1) / 60;\n const halfGeckoMaxCssLength = geckoMaxCssLength / 2;\n // CSS lengths in Gecko are limited to at most (1<<30)-1 app units (Gecko uses 60 as app unit).\n // Limit the maxContentWidth to the half of the upper boundary (≈4230^2) to be on the safe side.\n const maxContentWidth =\n props.maxContentWidth && props.maxContentWidth > halfGeckoMaxCssLength\n ? halfGeckoMaxCssLength\n : props.maxContentWidth ?? 0;\n const minContentWidth = props.minContentWidth ?? 280;\n\n /**\n * Determine the default state of the Navigation and Tools drawers.\n * Mobile viewports should be closed by default under all circumstances.\n * If the navigationOpen prop has been set then that should take precedence\n * over the contentType prop. Desktop viewports that do not have the\n * navigationOpen or contentType props set will use the default contentType.\n */\n const contentTypeDefaults = applyDefaults(contentType, { maxContentWidth, minContentWidth }, true);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Navigation drawer. The logic\n * for determining the default state is colocated with the Navigation component.\n *\n * The callback that will be passed to the Navigation and AppBar\n * components to handle the click events that will change the state\n * of the Navigation drawer. It will set the Navigation state with the\n * useControllable hook and also fire the onNavigationChange function to\n * emit the state change.\n */\n const [isNavigationOpen = false, setIsNavigationOpen] = useControllable(\n controlledNavigationOpen,\n props.onNavigationChange,\n isMobile ? false : contentTypeDefaults.navigationOpen,\n { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }\n );\n\n const handleNavigationClick = useCallback(\n function handleNavigationChange(isOpen: boolean) {\n setIsNavigationOpen(isOpen);\n fireNonCancelableEvent(props.onNavigationChange, { open: isOpen });\n },\n [props.onNavigationChange, setIsNavigationOpen]\n );\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Tools drawer. The logic\n * for determining the default state is colocated with the Tools component.\n *\n * The callback that will be passed to the Navigation and AppBar\n * components to handle the click events that will change the state\n * of the Tools drawer. It will set the Tools state with the\n * useControllable hook and also fire the onToolsChange function to\n * emit the state change.\n */\n const toolsWidth = props.toolsWidth ?? 290;\n const hasDefaultToolsWidth = props.toolsWidth === undefined;\n\n const [isToolsOpen = false, setIsToolsOpen] = useControllable(\n controlledToolsOpen,\n props.onToolsChange,\n isMobile ? false : contentTypeDefaults.toolsOpen,\n { componentName: 'AppLayout', controlledProp: 'toolsOpen', changeHandler: 'onToolsChange' }\n );\n\n const toolsFocusControl = useFocusControl(isToolsOpen, true);\n\n const handleToolsClick = useCallback(\n function handleToolsChange(isOpen: boolean) {\n setIsToolsOpen(isOpen);\n fireNonCancelableEvent(props.onToolsChange, { open: isOpen });\n },\n [props.onToolsChange, setIsToolsOpen]\n );\n\n const navigationVisible = !navigationHide && isNavigationOpen;\n const toolsVisible = !toolsHide && isToolsOpen;\n const isAnyPanelOpen = navigationVisible || toolsVisible;\n\n /**\n * On mobile viewports the navigation and tools drawers are adjusted to a fixed position\n * that consumes 100% of the viewport height and width. The body content could potentially\n * be scrollable underneath the drawer. In order to prevent this a CSS class needs to be\n * added to the document body that sets overflow to hidden.\n */\n useEffect(\n function handleBodyScroll() {\n if (isMobile && (isNavigationOpen || isToolsOpen)) {\n document.body.classList.add(styles['block-body-scroll']);\n } else {\n document.body.classList.remove(styles['block-body-scroll']);\n }\n\n // Ensure the CSS class is removed from the body on side effect cleanup\n return function cleanup() {\n document.body.classList.remove(styles['block-body-scroll']);\n };\n },\n [isMobile, isNavigationOpen, isToolsOpen]\n );\n\n /**\n * The useImperativeHandle hook in conjunction with the forwardRef function\n * in the AppLayout component definition expose the following callable\n * functions to component consumers when they put a ref as a property on\n * their component implementation.\n */\n useImperativeHandle(\n forwardRef,\n function createImperativeHandle() {\n return {\n closeNavigationIfNecessary: function () {\n isMobile && handleNavigationClick(false);\n },\n openTools: function () {\n handleToolsClick(true);\n },\n focusToolsClose: toolsFocusControl.setFocus,\n };\n },\n [isMobile, handleNavigationClick, handleToolsClick, toolsFocusControl.setFocus]\n );\n\n /**\n * Query the DOM for the header and footer elements based on the selectors provided\n * by the properties and pass the heights to the custom property definitions.\n */\n const headerHeight = useObservedElement(headerSelector);\n const footerHeight = useObservedElement(footerSelector);\n\n /**\n * Set the default values for the minimum and maximum Split Panel width when it is\n * in the side position. The useLayoutEffect will compute the available space in the\n * DOM for the Split Panel given the current state. The minimum and maximum\n * widths will potentially trigger a side effect that will put the Split Panel into\n * a forced position on the bottom.\n */\n const splitPanelMinWidth = 280;\n const [splitPanelMaxWidth, setSplitPanelMaxWidth] = useState(splitPanelMinWidth);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Split Panel. By default\n * the Split Panel should always be closed on page load.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the click events that will change the state of the SplitPanel\n * to open or closed given the current state. It will set the isSplitPanelOpen\n * controlled state and fire the onSplitPanelToggle event.\n */\n const [isSplitPanelOpen, setIsSplitPanelOpen] = useControllable(\n props.splitPanelOpen,\n props.onSplitPanelToggle,\n false,\n { componentName: 'AppLayout', controlledProp: 'splitPanelOpen', changeHandler: 'onSplitPanelToggle' }\n );\n\n const handleSplitPanelClick = useCallback(\n function handleSplitPanelChange() {\n setIsSplitPanelOpen(!isSplitPanelOpen);\n fireNonCancelableEvent(props.onSplitPanelToggle, { open: !isSplitPanelOpen });\n },\n [props.onSplitPanelToggle, isSplitPanelOpen, setIsSplitPanelOpen]\n );\n\n /**\n * The useControllable hook will manage the controlled or uncontrolled\n * state of the splitPanelPreferences. By default the splitPanelPreferences\n * is undefined. When set the object shape should have a single key to indicate\n * either bottom or side position.\n *\n * The callback that will handle changes to the splitPanelPreferences\n * object that will determine if the SplitPanel is rendered either on the\n * bottom of the viewport or within the Tools container.\n */\n const [splitPanelPreferences, setSplitPanelPreferences] = useControllable(\n props.splitPanelPreferences,\n props.onSplitPanelPreferencesChange,\n undefined,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelPreferences',\n changeHandler: 'onSplitPanelPreferencesChange',\n }\n );\n\n /**\n * The Split Panel will be in forced (bottom) position if the defined minimum width is\n * greater than the maximum width. In other words, the maximum width is the currently\n * available horizontal space based on all other components that are rendered. If the\n * minimum width exceeds this value then there is not enough horizontal space and we must\n * force it to the bottom position.\n */\n const [isSplitPanelForcedPosition, setSplitPanelForcedPosition] = useState(false);\n const splitPanelPosition = getSplitPanelPosition(isSplitPanelForcedPosition, splitPanelPreferences);\n\n useLayoutEffect(\n function handleSplitPanelForcePosition() {\n setSplitPanelForcedPosition(splitPanelMinWidth > splitPanelMaxWidth);\n },\n [splitPanelMaxWidth, splitPanelMinWidth]\n );\n\n /**\n * The useControllable hook will set the default size of the SplitPanel based\n * on the default position set in the splitPanelPreferences. The logic for the\n * default size is contained in the SplitPanel component. The splitPanelControlledSize\n * will be bound to the size property in the SplitPanel context for rendering.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the resize events that will change the size of the SplitPanel.\n * It will set the splitPanelControlledSize controlled state and fire the\n * onSplitPanelResize event.\n */\n const [splitPanelReportedSize, setSplitPanelReportedSize] = useState(0);\n const [splitPanelReportedHeaderHeight, setSplitPanelReportedHeaderHeight] = useState(0);\n\n const [splitPanelSize, setSplitPanelSize] = useControllable(\n props.splitPanelSize,\n props.onSplitPanelResize,\n getSplitPanelDefaultSize(splitPanelPosition),\n { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' }\n );\n\n const handleSplitPanelResize = useCallback(\n function handleSplitPanelChange(detail: { size: number }) {\n setSplitPanelSize(detail.size);\n fireNonCancelableEvent(props.onSplitPanelResize, detail);\n },\n [props.onSplitPanelResize, setSplitPanelSize]\n );\n\n const handleSplitPanelPreferencesChange = useCallback(\n function handleSplitPanelChange(detail: AppLayoutProps.SplitPanelPreferences) {\n setSplitPanelPreferences(detail);\n fireNonCancelableEvent(props.onSplitPanelPreferencesChange, detail);\n },\n [props.onSplitPanelPreferencesChange, setSplitPanelPreferences]\n );\n\n /**\n * The Layout element is not necessarily synonymous with the client\n * viewport width. There can be content in the horizontal viewport\n * that exists on either side of the AppLayout. This resize observer\n * will set the custom property of the Layout element width that\n * is used for various horizontal constraints such as the maximum\n * allowed width of the Tools container.\n *\n * The offsetLeft of the Main will return the distance that the\n * Main element has from the left edge of the Layout component.\n * The offsetLeft value can vary based on the presence and state\n * of the Navigation as well as content gaps in the grid definition.\n * This value is used to determine the max width constraint calculation\n * for the Tools container.\n */\n const [layoutContainerQuery, layoutElement] = useContainerQuery(rect => rect.width);\n const layoutWidth = layoutContainerQuery ?? 0;\n\n const mainElement = useRef<HTMLDivElement>(null);\n const [mainOffsetLeft, setMainOffsetLeft] = useState(0);\n\n useLayoutEffect(\n function handleMainOffsetLeft() {\n setMainOffsetLeft(mainElement?.current?.offsetLeft ?? 0);\n },\n [layoutWidth, isNavigationOpen, isToolsOpen, splitPanelReportedSize]\n );\n\n useLayoutEffect(\n function handleSplitPanelMaxWidth() {\n /**\n * Warning! This is a hack! In order to accurately calculate if there is adequate\n * horizontal space for the Split Panel to be in the side position we need two values\n * that are not available in JavaScript.\n *\n * The first is the the content gap on the right which is stored in a design token\n * and applied in the Layout CSS:\n *\n * $contentGapRight: #{awsui.$space-scaled-2x-xxxl};\n *\n * The second is the width of the element that has the circular buttons for the\n * Tools and Split Panel. This could be suppressed given the state of the Tools\n * drawer returning a zero value. It would, however, be rendered if the Split Panel\n * were to move into the side position. This is calculated in the Tools CSS and\n * the Trigger button CSS with design tokens:\n *\n * padding: awsui.$space-scaled-s awsui.$space-layout-toggle-padding;\n * width: awsui.$space-layout-toggle-diameter;\n *\n * These values will be defined below as static integers that are rough approximations\n * of their computed width when rendered in the DOM, but doubled to ensure adequate\n * spacing for the Split Panel to be in side position.\n */\n const contentGapRight = 80; // Approximately 40px when rendered but doubled for safety\n const toolsFormOffsetWidth = 160; // Approximately 80px when rendered but doubled for safety\n const toolsOffsetWidth = isToolsOpen ? toolsWidth : 0;\n\n setSplitPanelMaxWidth(\n layoutWidth - mainOffsetLeft - minContentWidth - contentGapRight - toolsOffsetWidth - toolsFormOffsetWidth\n );\n },\n [isNavigationOpen, isToolsOpen, layoutWidth, mainOffsetLeft, minContentWidth, toolsWidth]\n );\n\n /**\n * Because the notifications slot does not give us any direction insight into\n * what the state of the child content is we need to have a mechanism for\n * tracking the height of the notifications and whether or not it has content.\n * The height of the notifications is an integer that will be used as a custom\n * property on the Layout component to determine what the sticky offset should\n * be if there are sticky notifications. This could be any number including\n * zero based on how the child content renders. The hasNotificationsContent boolean\n * is simply centralizing the logic of the notifications height being > 0 such\n * that it is not repeated in various components (such as AppBar) that need to\n * know if the notifications slot is empty.\n */\n const [notificationsContainerQuery, notificationsElement] = useContainerQuery(rect => rect.height);\n const [notificationsHeight, setNotificationsHeight] = useState(0);\n const [hasNotificationsContent, setHasNotificationsContent] = useState(false);\n\n useEffect(\n function handleNotificationsContent() {\n setNotificationsHeight(notificationsContainerQuery ?? 0);\n setHasNotificationsContent(notificationsContainerQuery && notificationsContainerQuery > 0 ? true : false);\n },\n [notificationsContainerQuery]\n );\n\n /**\n * Determine the offsetBottom value based on the presence of a footer element and\n * the SplitPanel component. Ignore the SplitPanel if it is not in the bottom\n * position. Use the size property if it is open and the header height if it is closed.\n */\n let offsetBottom = footerHeight;\n if (splitPanel && splitPanelPosition === 'bottom') {\n if (isSplitPanelOpen) {\n offsetBottom += splitPanelReportedSize;\n } else {\n offsetBottom += splitPanelReportedHeaderHeight;\n }\n }\n\n return (\n <AppLayoutContext.Provider\n value={{\n ...defaults,\n ...props,\n contentType,\n dynamicOverlapHeight,\n headerHeight,\n footerHeight,\n hasDefaultToolsWidth,\n handleNavigationClick,\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n handleToolsClick,\n hasNotificationsContent,\n hasStickyBackground,\n isAnyPanelOpen,\n isMobile,\n isNavigationOpen: isNavigationOpen ?? false,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n isToolsOpen,\n layoutElement,\n layoutWidth,\n mainElement,\n mainOffsetLeft,\n maxContentWidth,\n minContentWidth,\n navigationHide,\n notificationsElement,\n notificationsHeight,\n offsetBottom,\n setDynamicOverlapHeight,\n setHasStickyBackground,\n setSplitPanelReportedSize,\n setSplitPanelReportedHeaderHeight,\n splitPanel,\n splitPanelMaxWidth,\n splitPanelMinWidth,\n splitPanelPosition,\n splitPanelPreferences,\n splitPanelReportedSize,\n splitPanelReportedHeaderHeight,\n splitPanelSize,\n toolsHide,\n toolsOpen: isToolsOpen,\n toolsWidth,\n toolsFocusControl,\n }}\n >\n {children}\n </AppLayoutContext.Provider>\n );\n }\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/layout.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/layout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAQ1C,UAAU,WAAW;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,WAAW,eAwEvD"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import React, { useContext
|
|
4
|
+
import React, { useContext } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { AppLayoutContext } from './context';
|
|
7
|
-
import { SplitPanelContext } from '../../internal/context/split-panel-context';
|
|
8
7
|
import styles from './styles.css.js';
|
|
9
8
|
import testutilStyles from '../test-classes/styles.css.js';
|
|
10
9
|
import customCssProps from '../../internal/generated/custom-css-properties';
|
|
@@ -17,38 +16,11 @@ import customCssProps from '../../internal/generated/custom-css-properties';
|
|
|
17
16
|
export default function Layout(_a) {
|
|
18
17
|
var _b, _c, _d, _e, _f, _g;
|
|
19
18
|
var children = _a.children;
|
|
20
|
-
var _h = useContext(AppLayoutContext), contentHeader = _h.contentHeader, contentType = _h.contentType, disableBodyScroll = _h.disableBodyScroll, disableContentHeaderOverlap = _h.disableContentHeaderOverlap, dynamicOverlapHeight = _h.dynamicOverlapHeight, footerHeight = _h.footerHeight, hasNotificationsContent = _h.hasNotificationsContent, headerHeight = _h.headerHeight, isNavigationOpen = _h.isNavigationOpen, isSplitPanelOpen = _h.isSplitPanelOpen, isToolsOpen = _h.isToolsOpen, layoutElement = _h.layoutElement, layoutWidth = _h.layoutWidth, mainOffsetLeft = _h.mainOffsetLeft, maxContentWidth = _h.maxContentWidth, minContentWidth = _h.minContentWidth, navigationHide = _h.navigationHide, notificationsHeight = _h.notificationsHeight,
|
|
21
|
-
var _j = useContext(SplitPanelContext), getSplitPanelHeader = _j.getHeader, splitPanelPosition = _j.position, splitPanelSize = _j.size;
|
|
19
|
+
var _h = useContext(AppLayoutContext), contentHeader = _h.contentHeader, contentType = _h.contentType, disableBodyScroll = _h.disableBodyScroll, disableContentHeaderOverlap = _h.disableContentHeaderOverlap, dynamicOverlapHeight = _h.dynamicOverlapHeight, footerHeight = _h.footerHeight, hasNotificationsContent = _h.hasNotificationsContent, headerHeight = _h.headerHeight, isNavigationOpen = _h.isNavigationOpen, isSplitPanelOpen = _h.isSplitPanelOpen, isToolsOpen = _h.isToolsOpen, layoutElement = _h.layoutElement, layoutWidth = _h.layoutWidth, mainOffsetLeft = _h.mainOffsetLeft, maxContentWidth = _h.maxContentWidth, minContentWidth = _h.minContentWidth, navigationHide = _h.navigationHide, notificationsHeight = _h.notificationsHeight, splitPanel = _h.splitPanel, splitPanelPosition = _h.splitPanelPosition, stickyNotifications = _h.stickyNotifications, toolsHide = _h.toolsHide;
|
|
22
20
|
var isOverlapDisabled = getOverlapDisabled(dynamicOverlapHeight, contentHeader, disableContentHeaderOverlap);
|
|
23
21
|
// Content gaps on the left and right are used with the minmax function in the CSS grid column definition
|
|
24
22
|
var hasContentGapLeft = getContentGapLeft(isNavigationOpen, navigationHide);
|
|
25
23
|
var hasContentGapRight = getContentGapRight(splitPanelPosition, isSplitPanelOpen, isToolsOpen, splitPanel, toolsHide);
|
|
26
|
-
/**
|
|
27
|
-
* Determine the offsetBottom value based on the presence of a footer element and
|
|
28
|
-
* the SplitPanel component. Ignore the SplitPanel if it is not in the bottom
|
|
29
|
-
* position. Use the size property if it is open and the header height if it is closed.
|
|
30
|
-
*/
|
|
31
|
-
useLayoutEffect(function handleOffsetBottom() {
|
|
32
|
-
var offsetBottom = footerHeight;
|
|
33
|
-
if (splitPanel && splitPanelPosition === 'bottom') {
|
|
34
|
-
if (isSplitPanelOpen) {
|
|
35
|
-
offsetBottom += splitPanelSize;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
var splitPanelHeader = getSplitPanelHeader();
|
|
39
|
-
offsetBottom += splitPanelHeader ? splitPanelHeader.clientHeight : 0;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
setOffsetBottom(offsetBottom);
|
|
43
|
-
}, [
|
|
44
|
-
footerHeight,
|
|
45
|
-
getSplitPanelHeader,
|
|
46
|
-
isSplitPanelOpen,
|
|
47
|
-
setOffsetBottom,
|
|
48
|
-
splitPanelPosition,
|
|
49
|
-
splitPanel,
|
|
50
|
-
splitPanelSize,
|
|
51
|
-
]);
|
|
52
24
|
return (React.createElement("main", { className: clsx(styles.layout, styles["content-type-".concat(contentType)], styles["split-panel-position-".concat(splitPanelPosition !== null && splitPanelPosition !== void 0 ? splitPanelPosition : 'bottom')], (_b = {},
|
|
53
25
|
_b[styles['disable-body-scroll']] = disableBodyScroll,
|
|
54
26
|
_b[testutilStyles['disable-body-scroll-root']] = disableBodyScroll,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/layout.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAE3D,OAAO,cAAc,MAAM,gDAAgD,CAAC;AAM5E;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAyB;;QAAvB,QAAQ,cAAA;IACjC,IAAA,KAuBF,UAAU,CAAC,gBAAgB,CAAC,EAtB9B,aAAa,mBAAA,EACb,WAAW,iBAAA,EACX,iBAAiB,uBAAA,EACjB,2BAA2B,iCAAA,EAC3B,oBAAoB,0BAAA,EACpB,YAAY,kBAAA,EACZ,uBAAuB,6BAAA,EACvB,YAAY,kBAAA,EACZ,gBAAgB,sBAAA,EAChB,gBAAgB,sBAAA,EAChB,WAAW,iBAAA,E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Context, useLayoutEffect } from 'react';\nimport clsx from 'clsx';\nimport { AppLayoutContext } from './context';\nimport { SplitPanelContext } from '../../internal/context/split-panel-context';\nimport styles from './styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\nimport { AppLayoutProps } from '../interfaces';\nimport customCssProps from '../../internal/generated/custom-css-properties';\n\ninterface LayoutProps {\n children: React.ReactNode;\n}\n\n/**\n * The layoutElement ref will be used by the resize observers to calculate the offset from\n * the top and bottom of the viewport based on the header and footer elements. This is to\n * ensure the Layout component minimum height will fill 100% of the viewport less those\n * cumulative heights.\n */\nexport default function Layout({ children }: LayoutProps) {\n const {\n contentHeader,\n contentType,\n disableBodyScroll,\n disableContentHeaderOverlap,\n dynamicOverlapHeight,\n footerHeight,\n hasNotificationsContent,\n headerHeight,\n isNavigationOpen,\n isSplitPanelOpen,\n isToolsOpen,\n layoutElement,\n layoutWidth,\n mainOffsetLeft,\n maxContentWidth,\n minContentWidth,\n navigationHide,\n notificationsHeight,\n setOffsetBottom,\n splitPanel,\n stickyNotifications,\n toolsHide,\n } = useContext(AppLayoutContext);\n\n const {\n getHeader: getSplitPanelHeader,\n position: splitPanelPosition,\n size: splitPanelSize,\n } = useContext(SplitPanelContext);\n\n const isOverlapDisabled = getOverlapDisabled(dynamicOverlapHeight, contentHeader, disableContentHeaderOverlap);\n\n // Content gaps on the left and right are used with the minmax function in the CSS grid column definition\n const hasContentGapLeft = getContentGapLeft(isNavigationOpen, navigationHide);\n const hasContentGapRight = getContentGapRight(\n splitPanelPosition,\n isSplitPanelOpen,\n isToolsOpen,\n splitPanel,\n toolsHide\n );\n\n /**\n * Determine the offsetBottom value based on the presence of a footer element and\n * the SplitPanel component. Ignore the SplitPanel if it is not in the bottom\n * position. Use the size property if it is open and the header height if it is closed.\n */\n useLayoutEffect(\n function handleOffsetBottom() {\n let offsetBottom = footerHeight;\n\n if (splitPanel && splitPanelPosition === 'bottom') {\n if (isSplitPanelOpen) {\n offsetBottom += splitPanelSize;\n } else {\n const splitPanelHeader = getSplitPanelHeader();\n offsetBottom += splitPanelHeader ? splitPanelHeader.clientHeight : 0;\n }\n }\n\n setOffsetBottom(offsetBottom);\n },\n [\n footerHeight,\n getSplitPanelHeader,\n isSplitPanelOpen,\n setOffsetBottom,\n splitPanelPosition,\n splitPanel,\n splitPanelSize,\n ]\n );\n\n return (\n <main\n className={clsx(\n styles.layout,\n styles[`content-type-${contentType}`],\n styles[`split-panel-position-${splitPanelPosition ?? 'bottom'}`],\n {\n [styles['disable-body-scroll']]: disableBodyScroll,\n [testutilStyles['disable-body-scroll-root']]: disableBodyScroll,\n [styles['has-content-gap-left']]: hasContentGapLeft,\n [styles['has-content-gap-right']]: hasContentGapRight,\n [styles['has-max-content-width']]: maxContentWidth && maxContentWidth > 0,\n [styles['has-split-panel']]: splitPanel,\n [styles['has-sticky-notifications']]: stickyNotifications && hasNotificationsContent,\n [styles['is-overlap-disabled']]: isOverlapDisabled,\n },\n testutilStyles.root\n )}\n ref={layoutElement}\n style={{\n [customCssProps.headerHeight]: `${headerHeight}px`,\n [customCssProps.footerHeight]: `${footerHeight}px`,\n [customCssProps.layoutWidth]: `${layoutWidth}px`,\n [customCssProps.mainOffsetLeft]: `${mainOffsetLeft}px`,\n ...(maxContentWidth && { [customCssProps.maxContentWidth]: `${maxContentWidth}px` }),\n ...(minContentWidth && { [customCssProps.minContentWidth]: `${minContentWidth}px` }),\n [customCssProps.notificationsHeight]: `${notificationsHeight}px`,\n ...(!isOverlapDisabled &&\n dynamicOverlapHeight > 0 && { [customCssProps.overlapHeight]: `${dynamicOverlapHeight}px` }),\n }}\n >\n {children}\n </main>\n );\n}\n\n/**\n * When the Navigation and Tools are present the grid definition has the center column\n * touch the first and last columns with no gap. The forms with the circular buttons\n * for Navigation and Tools have internal padding which creates the necessary\n * horizontal space when the drawers are closed. The remaining conditions below\n * determine the necessity of utilizing the content gap left property to create\n * horizontal space between the center column and its adjacent siblings.\n */\nfunction getContentGapRight(\n splitPanelPosition: AppLayoutProps.SplitPanelPosition,\n isSplitPanelOpen?: boolean,\n isToolsOpen?: boolean,\n splitPanel?: React.ReactNode,\n toolsHide?: boolean\n) {\n let hasContentGapRight = false;\n\n // Main is touching the edge of the Layout and needs a content gap\n if (!splitPanel && toolsHide) {\n hasContentGapRight = true;\n }\n\n // Main is touching the Tools drawer and needs a content gap\n if ((!splitPanel || !isSplitPanelOpen) && !toolsHide && isToolsOpen) {\n hasContentGapRight = true;\n }\n\n // Main is touching the edge of the Layout and needs a content gap\n if (splitPanel && splitPanelPosition === 'bottom' && (isToolsOpen || toolsHide)) {\n hasContentGapRight = true;\n }\n\n // Main is touching the Split Panel drawer and needs a content gap\n if (splitPanel && isSplitPanelOpen && splitPanelPosition === 'side') {\n hasContentGapRight = true;\n }\n\n return hasContentGapRight;\n}\n\n/**\n * Additional function to determine whether or not a content gap is needed\n * on the left (see the getContentGapRight function). The same render logic applies\n * regarding the center column touching an adjacent sibling but the only\n * component state that needs to be tracked is the Navigation.\n */\nfunction getContentGapLeft(isNavigationOpen: boolean, navigationHide?: boolean) {\n return isNavigationOpen || navigationHide ? true : false;\n}\n\n/**\n * Determine whether the overlap between the contentHeader and content slots should be disabled.\n * The disableContentHeaderOverlap property is absolute and will always disable the overlap\n * if it is set to true. If there is no contentHeader then the overlap should be disabled\n * unless there is a dynamicOverlapHeight. The dynamicOverlapHeight property is set by a\n * component in the content slot that needs to manually control the overlap height. Components\n * such as the Table (full page variant), Wizard, ContentLayout use this property and will\n * retain the overlap even if there is nothing rendered in the contentHeader slot.\n */\nfunction getOverlapDisabled(\n dynamicOverlapHeight: number,\n contentHeader?: React.ReactNode,\n disableContentHeaderOverlap?: boolean\n) {\n let isOverlapDisabled = false;\n\n if (disableContentHeaderOverlap) {\n isOverlapDisabled = true;\n } else if (!contentHeader && dynamicOverlapHeight <= 0) {\n isOverlapDisabled = true;\n }\n\n return isOverlapDisabled;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../../src/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copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext } from 'react';\nimport clsx from 'clsx';\nimport { AppLayoutContext } from './context';\nimport styles from './styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\nimport { AppLayoutProps } from '../interfaces';\nimport customCssProps from '../../internal/generated/custom-css-properties';\n\ninterface LayoutProps {\n children: React.ReactNode;\n}\n\n/**\n * The layoutElement ref will be used by the resize observers to calculate the offset from\n * the top and bottom of the viewport based on the header and footer elements. This is to\n * ensure the Layout component minimum height will fill 100% of the viewport less those\n * cumulative heights.\n */\nexport default function Layout({ children }: LayoutProps) {\n const {\n contentHeader,\n contentType,\n disableBodyScroll,\n disableContentHeaderOverlap,\n dynamicOverlapHeight,\n footerHeight,\n hasNotificationsContent,\n headerHeight,\n isNavigationOpen,\n isSplitPanelOpen,\n isToolsOpen,\n layoutElement,\n layoutWidth,\n mainOffsetLeft,\n maxContentWidth,\n minContentWidth,\n navigationHide,\n notificationsHeight,\n splitPanel,\n splitPanelPosition,\n stickyNotifications,\n toolsHide,\n } = useContext(AppLayoutContext);\n\n const isOverlapDisabled = getOverlapDisabled(dynamicOverlapHeight, contentHeader, disableContentHeaderOverlap);\n\n // Content gaps on the left and right are used with the minmax function in the CSS grid column definition\n const hasContentGapLeft = getContentGapLeft(isNavigationOpen, navigationHide);\n const hasContentGapRight = getContentGapRight(\n splitPanelPosition,\n isSplitPanelOpen,\n isToolsOpen,\n splitPanel,\n toolsHide\n );\n\n return (\n <main\n className={clsx(\n styles.layout,\n styles[`content-type-${contentType}`],\n styles[`split-panel-position-${splitPanelPosition ?? 'bottom'}`],\n {\n [styles['disable-body-scroll']]: disableBodyScroll,\n [testutilStyles['disable-body-scroll-root']]: disableBodyScroll,\n [styles['has-content-gap-left']]: hasContentGapLeft,\n [styles['has-content-gap-right']]: hasContentGapRight,\n [styles['has-max-content-width']]: maxContentWidth && maxContentWidth > 0,\n [styles['has-split-panel']]: splitPanel,\n [styles['has-sticky-notifications']]: stickyNotifications && hasNotificationsContent,\n [styles['is-overlap-disabled']]: isOverlapDisabled,\n },\n testutilStyles.root\n )}\n ref={layoutElement}\n style={{\n [customCssProps.headerHeight]: `${headerHeight}px`,\n [customCssProps.footerHeight]: `${footerHeight}px`,\n [customCssProps.layoutWidth]: `${layoutWidth}px`,\n [customCssProps.mainOffsetLeft]: `${mainOffsetLeft}px`,\n ...(maxContentWidth && { [customCssProps.maxContentWidth]: `${maxContentWidth}px` }),\n ...(minContentWidth && { [customCssProps.minContentWidth]: `${minContentWidth}px` }),\n [customCssProps.notificationsHeight]: `${notificationsHeight}px`,\n ...(!isOverlapDisabled &&\n dynamicOverlapHeight > 0 && { [customCssProps.overlapHeight]: `${dynamicOverlapHeight}px` }),\n }}\n >\n {children}\n </main>\n );\n}\n\n/**\n * When the Navigation and Tools are present the grid definition has the center column\n * touch the first and last columns with no gap. The forms with the circular buttons\n * for Navigation and Tools have internal padding which creates the necessary\n * horizontal space when the drawers are closed. The remaining conditions below\n * determine the necessity of utilizing the content gap left property to create\n * horizontal space between the center column and its adjacent siblings.\n */\nfunction getContentGapRight(\n splitPanelPosition: AppLayoutProps.SplitPanelPosition,\n isSplitPanelOpen?: boolean,\n isToolsOpen?: boolean,\n splitPanel?: React.ReactNode,\n toolsHide?: boolean\n) {\n let hasContentGapRight = false;\n\n // Main is touching the edge of the Layout and needs a content gap\n if (!splitPanel && toolsHide) {\n hasContentGapRight = true;\n }\n\n // Main is touching the Tools drawer and needs a content gap\n if ((!splitPanel || !isSplitPanelOpen) && !toolsHide && isToolsOpen) {\n hasContentGapRight = true;\n }\n\n // Main is touching the edge of the Layout and needs a content gap\n if (splitPanel && splitPanelPosition === 'bottom' && (isToolsOpen || toolsHide)) {\n hasContentGapRight = true;\n }\n\n // Main is touching the Split Panel drawer and needs a content gap\n if (splitPanel && isSplitPanelOpen && splitPanelPosition === 'side') {\n hasContentGapRight = true;\n }\n\n return hasContentGapRight;\n}\n\n/**\n * Additional function to determine whether or not a content gap is needed\n * on the left (see the getContentGapRight function). The same render logic applies\n * regarding the center column touching an adjacent sibling but the only\n * component state that needs to be tracked is the Navigation.\n */\nfunction getContentGapLeft(isNavigationOpen: boolean, navigationHide?: boolean) {\n return isNavigationOpen || navigationHide ? true : false;\n}\n\n/**\n * Determine whether the overlap between the contentHeader and content slots should be disabled.\n * The disableContentHeaderOverlap property is absolute and will always disable the overlap\n * if it is set to true. If there is no contentHeader then the overlap should be disabled\n * unless there is a dynamicOverlapHeight. The dynamicOverlapHeight property is set by a\n * component in the content slot that needs to manually control the overlap height. Components\n * such as the Table (full page variant), Wizard, ContentLayout use this property and will\n * retain the overlap even if there is nothing rendered in the contentHeader slot.\n */\nfunction getOverlapDisabled(\n dynamicOverlapHeight: number,\n contentHeader?: React.ReactNode,\n disableContentHeaderOverlap?: boolean\n) {\n let isOverlapDisabled = false;\n\n if (disableContentHeaderOverlap) {\n isOverlapDisabled = true;\n } else if (!contentHeader && dynamicOverlapHeight <= 0) {\n isOverlapDisabled = true;\n }\n\n return isOverlapDisabled;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-panel.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/split-panel.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"split-panel.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/split-panel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA+B,MAAM,OAAO,CAAC;AASpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAK/C;;;GAGG;AACH,iBAAS,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,eAoDjE;kBApDQ,UAAU;;;;AAsDnB;;;;;GAKG;AACH,iBAAS,gBAAgB,uBAuCxB;AAED;;;;;GAKG;AACH,iBAAS,cAAc,uBAmCtB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,0BAA0B,EAAE,OAAO,EACnC,qBAAqB,EAAE,cAAc,CAAC,qBAAqB,GAAG,SAAS,qCASxE;AAID,eAAe,UAAU,CAAC"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import React, { useContext,
|
|
4
|
+
import React, { useContext, useState } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { AppLayoutContext } from './context';
|
|
7
7
|
import { SplitPanelContext, } from '../../internal/context/split-panel-context';
|
|
8
8
|
import styles from './styles.css.js';
|
|
9
9
|
import { useEffectOnUpdate } from '../../internal/hooks/use-effect-on-update';
|
|
10
10
|
import { Transition } from '../../internal/components/transition';
|
|
11
|
-
import { useObservedElement } from '../utils/use-observed-element';
|
|
12
11
|
import customCssProps from '../../internal/generated/custom-css-properties';
|
|
13
12
|
/**
|
|
14
13
|
* If there is no Split Panel in the AppLayout context then the SplitPanel
|
|
@@ -16,13 +15,11 @@ import customCssProps from '../../internal/generated/custom-css-properties';
|
|
|
16
15
|
*/
|
|
17
16
|
function SplitPanel(_a) {
|
|
18
17
|
var children = _a.children;
|
|
19
|
-
var _b = useContext(AppLayoutContext), handleSplitPanelClick = _b.handleSplitPanelClick, handleSplitPanelPreferencesChange = _b.handleSplitPanelPreferencesChange, handleSplitPanelResize = _b.handleSplitPanelResize, isMobile = _b.isMobile, isSplitPanelForcedPosition = _b.isSplitPanelForcedPosition, isSplitPanelOpen = _b.isSplitPanelOpen, setSplitPanelReportedSize = _b.setSplitPanelReportedSize, splitPanelPosition = _b.splitPanelPosition, splitPanelSize = _b.splitPanelSize, headerHeight = _b.headerHeight, footerHeight = _b.footerHeight;
|
|
18
|
+
var _b = useContext(AppLayoutContext), handleSplitPanelClick = _b.handleSplitPanelClick, handleSplitPanelPreferencesChange = _b.handleSplitPanelPreferencesChange, handleSplitPanelResize = _b.handleSplitPanelResize, isMobile = _b.isMobile, isSplitPanelForcedPosition = _b.isSplitPanelForcedPosition, isSplitPanelOpen = _b.isSplitPanelOpen, setSplitPanelReportedSize = _b.setSplitPanelReportedSize, setSplitPanelReportedHeaderHeight = _b.setSplitPanelReportedHeaderHeight, splitPanelPosition = _b.splitPanelPosition, splitPanelSize = _b.splitPanelSize, headerHeight = _b.headerHeight, footerHeight = _b.footerHeight;
|
|
20
19
|
var _c = useState(undefined), openButtonAriaLabel = _c[0], setOpenButtonAriaLabel = _c[1];
|
|
21
20
|
var _d = useState(), splitPanelLastInteraction = _d[0], setSplitPanelLastInteraction = _d[1];
|
|
22
21
|
useEffectOnUpdate(function () { return setSplitPanelLastInteraction(isSplitPanelOpen ? { type: 'open' } : { type: 'close' }); }, [isSplitPanelOpen]);
|
|
23
22
|
useEffectOnUpdate(function () { return setSplitPanelLastInteraction({ type: 'position' }); }, [splitPanelPosition]);
|
|
24
|
-
var splitPanelRef = useRef(null);
|
|
25
|
-
var splitPanelHeaderRef = useRef(null);
|
|
26
23
|
var context = {
|
|
27
24
|
bottomOffset: 0,
|
|
28
25
|
getMaxHeight: function () {
|
|
@@ -31,7 +28,6 @@ function SplitPanel(_a) {
|
|
|
31
28
|
return availableHeight < 400 ? availableHeight - 40 : availableHeight - 250;
|
|
32
29
|
},
|
|
33
30
|
getMaxWidth: function () { return document.documentElement.clientWidth; },
|
|
34
|
-
getHeader: function () { return splitPanelHeaderRef.current; },
|
|
35
31
|
isForcedPosition: isSplitPanelForcedPosition,
|
|
36
32
|
isMobile: isMobile,
|
|
37
33
|
isOpen: isSplitPanelOpen,
|
|
@@ -41,10 +37,9 @@ function SplitPanel(_a) {
|
|
|
41
37
|
onToggle: handleSplitPanelClick,
|
|
42
38
|
position: splitPanelPosition,
|
|
43
39
|
reportSize: setSplitPanelReportedSize,
|
|
40
|
+
reportHeaderHeight: setSplitPanelReportedHeaderHeight,
|
|
44
41
|
rightOffset: 0,
|
|
45
42
|
size: splitPanelSize || 0,
|
|
46
|
-
splitPanelRef: splitPanelRef,
|
|
47
|
-
splitPanelHeaderRef: splitPanelHeaderRef,
|
|
48
43
|
topOffset: 0,
|
|
49
44
|
openButtonAriaLabel: openButtonAriaLabel,
|
|
50
45
|
setOpenButtonAriaLabel: setOpenButtonAriaLabel,
|
|
@@ -59,9 +54,7 @@ function SplitPanel(_a) {
|
|
|
59
54
|
* on the the presence and state of the Navigation and Tools components.
|
|
60
55
|
*/
|
|
61
56
|
function SplitPanelBottom() {
|
|
62
|
-
var _a = useContext(AppLayoutContext), disableBodyScroll = _a.disableBodyScroll, isNavigationOpen = _a.isNavigationOpen, isSplitPanelOpen = _a.isSplitPanelOpen, isToolsOpen = _a.isToolsOpen, splitPanel = _a.splitPanel, splitPanelReportedSize = _a.splitPanelReportedSize;
|
|
63
|
-
var _b = useContext(SplitPanelContext), splitPanelPosition = _b.position, getHeader = _b.getHeader;
|
|
64
|
-
var headerHeight = useObservedElement(getHeader);
|
|
57
|
+
var _a = useContext(AppLayoutContext), disableBodyScroll = _a.disableBodyScroll, isNavigationOpen = _a.isNavigationOpen, isSplitPanelOpen = _a.isSplitPanelOpen, isToolsOpen = _a.isToolsOpen, splitPanel = _a.splitPanel, splitPanelPosition = _a.splitPanelPosition, splitPanelReportedSize = _a.splitPanelReportedSize, splitPanelReportedHeaderHeight = _a.splitPanelReportedHeaderHeight;
|
|
65
58
|
if (!splitPanel) {
|
|
66
59
|
return null;
|
|
67
60
|
}
|
|
@@ -75,7 +68,7 @@ function SplitPanelBottom() {
|
|
|
75
68
|
_a[styles['is-tools-open']] = isToolsOpen,
|
|
76
69
|
_a)), ref: transitionEventsRef, style: (_b = {},
|
|
77
70
|
_b[customCssProps.splitPanelReportedSize] = "".concat(splitPanelReportedSize, "px"),
|
|
78
|
-
_b[customCssProps.splitPanelReportedHeaderSize] = "".concat(
|
|
71
|
+
_b[customCssProps.splitPanelReportedHeaderSize] = "".concat(splitPanelReportedHeaderHeight, "px"),
|
|
79
72
|
_b) },
|
|
80
73
|
React.createElement(SplitPanel, null),
|
|
81
74
|
splitPanelPosition === 'bottom' && splitPanel));
|
|
@@ -88,8 +81,7 @@ function SplitPanelBottom() {
|
|
|
88
81
|
* for this position are computed in the Tools component.
|
|
89
82
|
*/
|
|
90
83
|
function SplitPanelSide() {
|
|
91
|
-
var _a = useContext(AppLayoutContext), isSplitPanelOpen = _a.isSplitPanelOpen, splitPanel = _a.splitPanel, splitPanelMaxWidth = _a.splitPanelMaxWidth, splitPanelMinWidth = _a.splitPanelMinWidth, splitPanelReportedSize = _a.splitPanelReportedSize;
|
|
92
|
-
var splitPanelPosition = useContext(SplitPanelContext).position;
|
|
84
|
+
var _a = useContext(AppLayoutContext), isSplitPanelOpen = _a.isSplitPanelOpen, splitPanel = _a.splitPanel, splitPanelPosition = _a.splitPanelPosition, splitPanelMaxWidth = _a.splitPanelMaxWidth, splitPanelMinWidth = _a.splitPanelMinWidth, splitPanelReportedSize = _a.splitPanelReportedSize;
|
|
93
85
|
if (!splitPanel) {
|
|
94
86
|
return null;
|
|
95
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-panel.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/split-panel.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EACL,iBAAiB,GAGlB,MAAM,4CAA4C,CAAC;AACpD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACl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c. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport { AppLayoutContext } from './context';\nimport {\n SplitPanelContext,\n SplitPanelContextProps,\n SplitPanelLastInteraction,\n} from '../../internal/context/split-panel-context';\nimport styles from './styles.css.js';\nimport { AppLayoutProps } from '../interfaces';\nimport { useEffectOnUpdate } from '../../internal/hooks/use-effect-on-update';\nimport { Transition } from '../../internal/components/transition';\nimport { useObservedElement } from '../utils/use-observed-element';\nimport customCssProps from '../../internal/generated/custom-css-properties';\n\n/**\n * If there is no Split Panel in the AppLayout context then the SplitPanel\n * will pass through the AppLayout children without the context.\n */\nfunction SplitPanel({ children }: React.PropsWithChildren<unknown>) {\n const {\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n isMobile,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n setSplitPanelReportedSize,\n splitPanelPosition,\n splitPanelSize,\n headerHeight,\n footerHeight,\n } = useContext(AppLayoutContext);\n\n const [openButtonAriaLabel, setOpenButtonAriaLabel] = useState<undefined | string>(undefined);\n\n const [splitPanelLastInteraction, setSplitPanelLastInteraction] = useState<undefined | SplitPanelLastInteraction>();\n useEffectOnUpdate(\n () => setSplitPanelLastInteraction(isSplitPanelOpen ? { type: 'open' } : { type: 'close' }),\n [isSplitPanelOpen]\n );\n useEffectOnUpdate(() => setSplitPanelLastInteraction({ type: 'position' }), [splitPanelPosition]);\n\n const splitPanelRef = useRef<HTMLDivElement>(null);\n const splitPanelHeaderRef = useRef<HTMLDivElement>(null);\n\n const context: SplitPanelContextProps = {\n bottomOffset: 0,\n getMaxHeight: () => {\n const availableHeight = document.documentElement.clientHeight - headerHeight - footerHeight;\n // If the page is likely zoomed in at 200%, allow the split panel to fill the content area.\n return availableHeight < 400 ? availableHeight - 40 : availableHeight - 250;\n },\n getMaxWidth: () => document.documentElement.clientWidth,\n getHeader: () => splitPanelHeaderRef.current,\n isForcedPosition: isSplitPanelForcedPosition,\n isMobile,\n isOpen: isSplitPanelOpen,\n leftOffset: 0,\n onPreferencesChange: handleSplitPanelPreferencesChange,\n onResize: handleSplitPanelResize,\n onToggle: handleSplitPanelClick,\n position: splitPanelPosition,\n reportSize: setSplitPanelReportedSize,\n rightOffset: 0,\n size: splitPanelSize || 0,\n splitPanelRef,\n splitPanelHeaderRef,\n topOffset: 0,\n openButtonAriaLabel,\n setOpenButtonAriaLabel,\n lastInteraction: splitPanelLastInteraction,\n };\n\n return <SplitPanelContext.Provider value={{ ...context }}>{children}</SplitPanelContext.Provider>;\n}\n\n/**\n * This is the render function for the SplitPanel when it is in bottom position.\n * The Split Panel container will be another row entry in the grid definition in\n * the Layout component. The start and finish columns will be variable based\n * on the the presence and state of the Navigation and Tools components.\n */\nfunction SplitPanelBottom() {\n const { disableBodyScroll, isNavigationOpen, isSplitPanelOpen, isToolsOpen, splitPanel, splitPanelReportedSize } =\n useContext(AppLayoutContext);\n\n const { position: splitPanelPosition, getHeader } = useContext(SplitPanelContext);\n\n const headerHeight = useObservedElement(getHeader);\n\n if (!splitPanel) {\n return null;\n }\n\n return (\n <Transition in={isSplitPanelOpen ?? false} exit={false}>\n {(state, transitionEventsRef) => (\n <section\n className={clsx(styles['split-panel-bottom'], styles[`position-${splitPanelPosition}`], {\n [styles.animating]: state === 'entering',\n [styles['disable-body-scroll']]: disableBodyScroll,\n [styles['is-navigation-open']]: isNavigationOpen,\n [styles['is-split-panel-open']]: isSplitPanelOpen,\n [styles['is-tools-open']]: isToolsOpen,\n })}\n ref={transitionEventsRef}\n style={{\n [customCssProps.splitPanelReportedSize]: `${splitPanelReportedSize}px`,\n [customCssProps.splitPanelReportedHeaderSize]: `${headerHeight}px`,\n }}\n >\n <SplitPanel></SplitPanel>\n {splitPanelPosition === 'bottom' && splitPanel}\n </section>\n )}\n </Transition>\n );\n}\n\n/**\n * This is the render function for the SplitPanel when it is side position.\n * The Split Panel will not be within the grid defined in the Layout component\n * but instead a direct child of the Tools component. The width constraints\n * for this position are computed in the Tools component.\n */\nfunction SplitPanelSide() {\n const { isSplitPanelOpen, splitPanel, splitPanelMaxWidth, splitPanelMinWidth, splitPanelReportedSize } =\n useContext(AppLayoutContext);\n\n const { position: splitPanelPosition } = useContext(SplitPanelContext);\n\n if (!splitPanel) {\n return null;\n }\n\n return (\n <Transition in={isSplitPanelOpen ?? false} exit={false}>\n {(state, transitionEventsRef) => (\n <section\n aria-hidden={!isSplitPanelOpen || splitPanelPosition === 'bottom' ? true : false}\n className={clsx(styles['split-panel-side'], styles[`position-${splitPanelPosition}`], {\n [styles.animating]: state === 'entering',\n [styles['is-split-panel-open']]: isSplitPanelOpen,\n })}\n ref={transitionEventsRef}\n style={{\n [customCssProps.splitPanelMaxWidth]: `${splitPanelMaxWidth}px`,\n [customCssProps.splitPanelMinWidth]: `${splitPanelMinWidth}px`,\n [customCssProps.splitPanelReportedHeaderSize]: `${splitPanelReportedSize}px`,\n }}\n >\n <div className={clsx(styles['animated-content'])}>{splitPanelPosition === 'side' && splitPanel}</div>\n </section>\n )}\n </Transition>\n );\n}\n\n/**\n * This logic will determine what the Split Panel position should be. It reconciles the possibility\n * of being in forced position with the current selected position in the settings.\n */\nexport function getSplitPanelPosition(\n isSplitPanelForcedPosition: boolean,\n splitPanelPreferences: AppLayoutProps.SplitPanelPreferences | undefined\n) {\n let splitPanelPosition: AppLayoutProps.SplitPanelPosition = 'bottom';\n\n if (!isSplitPanelForcedPosition && splitPanelPreferences?.position === 'side') {\n splitPanelPosition = 'side';\n }\n\n return splitPanelPosition;\n}\nSplitPanel.Bottom = SplitPanelBottom;\nSplitPanel.Side = SplitPanelSide;\n\nexport default SplitPanel;\n"]}
|
|
1
|
+
{"version":3,"file":"split-panel.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/split-panel.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QA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ext, useState } from 'react';\nimport clsx from 'clsx';\nimport { AppLayoutContext } from './context';\nimport {\n SplitPanelContext,\n SplitPanelContextProps,\n SplitPanelLastInteraction,\n} from '../../internal/context/split-panel-context';\nimport styles from './styles.css.js';\nimport { AppLayoutProps } from '../interfaces';\nimport { useEffectOnUpdate } from '../../internal/hooks/use-effect-on-update';\nimport { Transition } from '../../internal/components/transition';\nimport customCssProps from '../../internal/generated/custom-css-properties';\n\n/**\n * If there is no Split Panel in the AppLayout context then the SplitPanel\n * will pass through the AppLayout children without the context.\n */\nfunction SplitPanel({ children }: React.PropsWithChildren<unknown>) {\n const {\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n isMobile,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n setSplitPanelReportedSize,\n setSplitPanelReportedHeaderHeight,\n splitPanelPosition,\n splitPanelSize,\n headerHeight,\n footerHeight,\n } = useContext(AppLayoutContext);\n\n const [openButtonAriaLabel, setOpenButtonAriaLabel] = useState<undefined | string>(undefined);\n\n const [splitPanelLastInteraction, setSplitPanelLastInteraction] = useState<undefined | SplitPanelLastInteraction>();\n useEffectOnUpdate(\n () => setSplitPanelLastInteraction(isSplitPanelOpen ? { type: 'open' } : { type: 'close' }),\n [isSplitPanelOpen]\n );\n useEffectOnUpdate(() => setSplitPanelLastInteraction({ type: 'position' }), [splitPanelPosition]);\n\n const context: SplitPanelContextProps = {\n bottomOffset: 0,\n getMaxHeight: () => {\n const availableHeight = document.documentElement.clientHeight - headerHeight - footerHeight;\n // If the page is likely zoomed in at 200%, allow the split panel to fill the content area.\n return availableHeight < 400 ? availableHeight - 40 : availableHeight - 250;\n },\n getMaxWidth: () => document.documentElement.clientWidth,\n isForcedPosition: isSplitPanelForcedPosition,\n isMobile,\n isOpen: isSplitPanelOpen,\n leftOffset: 0,\n onPreferencesChange: handleSplitPanelPreferencesChange,\n onResize: handleSplitPanelResize,\n onToggle: handleSplitPanelClick,\n position: splitPanelPosition,\n reportSize: setSplitPanelReportedSize,\n reportHeaderHeight: setSplitPanelReportedHeaderHeight,\n rightOffset: 0,\n size: splitPanelSize || 0,\n topOffset: 0,\n openButtonAriaLabel,\n setOpenButtonAriaLabel,\n lastInteraction: splitPanelLastInteraction,\n };\n\n return <SplitPanelContext.Provider value={{ ...context }}>{children}</SplitPanelContext.Provider>;\n}\n\n/**\n * This is the render function for the SplitPanel when it is in bottom position.\n * The Split Panel container will be another row entry in the grid definition in\n * the Layout component. The start and finish columns will be variable based\n * on the the presence and state of the Navigation and Tools components.\n */\nfunction SplitPanelBottom() {\n const {\n disableBodyScroll,\n isNavigationOpen,\n isSplitPanelOpen,\n isToolsOpen,\n splitPanel,\n splitPanelPosition,\n splitPanelReportedSize,\n splitPanelReportedHeaderHeight,\n } = useContext(AppLayoutContext);\n\n if (!splitPanel) {\n return null;\n }\n\n return (\n <Transition in={isSplitPanelOpen ?? false} exit={false}>\n {(state, transitionEventsRef) => (\n <section\n className={clsx(styles['split-panel-bottom'], styles[`position-${splitPanelPosition}`], {\n [styles.animating]: state === 'entering',\n [styles['disable-body-scroll']]: disableBodyScroll,\n [styles['is-navigation-open']]: isNavigationOpen,\n [styles['is-split-panel-open']]: isSplitPanelOpen,\n [styles['is-tools-open']]: isToolsOpen,\n })}\n ref={transitionEventsRef}\n style={{\n [customCssProps.splitPanelReportedSize]: `${splitPanelReportedSize}px`,\n [customCssProps.splitPanelReportedHeaderSize]: `${splitPanelReportedHeaderHeight}px`,\n }}\n >\n <SplitPanel></SplitPanel>\n {splitPanelPosition === 'bottom' && splitPanel}\n </section>\n )}\n </Transition>\n );\n}\n\n/**\n * This is the render function for the SplitPanel when it is side position.\n * The Split Panel will not be within the grid defined in the Layout component\n * but instead a direct child of the Tools component. The width constraints\n * for this position are computed in the Tools component.\n */\nfunction SplitPanelSide() {\n const {\n isSplitPanelOpen,\n splitPanel,\n splitPanelPosition,\n splitPanelMaxWidth,\n splitPanelMinWidth,\n splitPanelReportedSize,\n } = useContext(AppLayoutContext);\n\n if (!splitPanel) {\n return null;\n }\n\n return (\n <Transition in={isSplitPanelOpen ?? false} exit={false}>\n {(state, transitionEventsRef) => (\n <section\n aria-hidden={!isSplitPanelOpen || splitPanelPosition === 'bottom' ? true : false}\n className={clsx(styles['split-panel-side'], styles[`position-${splitPanelPosition}`], {\n [styles.animating]: state === 'entering',\n [styles['is-split-panel-open']]: isSplitPanelOpen,\n })}\n ref={transitionEventsRef}\n style={{\n [customCssProps.splitPanelMaxWidth]: `${splitPanelMaxWidth}px`,\n [customCssProps.splitPanelMinWidth]: `${splitPanelMinWidth}px`,\n [customCssProps.splitPanelReportedHeaderSize]: `${splitPanelReportedSize}px`,\n }}\n >\n <div className={clsx(styles['animated-content'])}>{splitPanelPosition === 'side' && splitPanel}</div>\n </section>\n )}\n </Transition>\n );\n}\n\n/**\n * This logic will determine what the Split Panel position should be. It reconciles the possibility\n * of being in forced position with the current selected position in the settings.\n */\nexport function getSplitPanelPosition(\n isSplitPanelForcedPosition: boolean,\n splitPanelPreferences: AppLayoutProps.SplitPanelPreferences | undefined\n) {\n let splitPanelPosition: AppLayoutProps.SplitPanelPosition = 'bottom';\n\n if (!isSplitPanelForcedPosition && splitPanelPreferences?.position === 'side') {\n splitPanelPosition = 'side';\n }\n\n return splitPanelPosition;\n}\nSplitPanel.Bottom = SplitPanelBottom;\nSplitPanel.Side = SplitPanelSide;\n\nexport default SplitPanel;\n"]}
|
|
@@ -15,7 +15,6 @@ export interface SplitPanelContextProps {
|
|
|
15
15
|
size: number;
|
|
16
16
|
getMaxWidth: () => number;
|
|
17
17
|
getMaxHeight: () => number;
|
|
18
|
-
getHeader: () => HTMLElement | null;
|
|
19
18
|
disableContentPaddings?: boolean;
|
|
20
19
|
contentWidthStyles?: React.CSSProperties;
|
|
21
20
|
contentWrapperPaddings?: {
|
|
@@ -26,8 +25,6 @@ export interface SplitPanelContextProps {
|
|
|
26
25
|
isMobile: boolean;
|
|
27
26
|
isForcedPosition: boolean;
|
|
28
27
|
lastInteraction?: SplitPanelLastInteraction;
|
|
29
|
-
splitPanelRef?: React.Ref<any>;
|
|
30
|
-
splitPanelHeaderRef?: React.Ref<any>;
|
|
31
28
|
onResize: (detail: {
|
|
32
29
|
size: number;
|
|
33
30
|
}) => void;
|
|
@@ -36,6 +33,7 @@ export interface SplitPanelContextProps {
|
|
|
36
33
|
position: 'side' | 'bottom';
|
|
37
34
|
}) => void;
|
|
38
35
|
reportSize: (pixels: number) => void;
|
|
36
|
+
reportHeaderHeight: (pixels: number) => void;
|
|
39
37
|
openButtonAriaLabel?: string;
|
|
40
38
|
setOpenButtonAriaLabel?: (value: string) => void;
|
|
41
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-panel-context.d.ts","sourceRoot":"","sources":["../../../../src/internal/context/split-panel-context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAEzD,MAAM,MAAM,yBAAyB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;AAEpG,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,
|
|
1
|
+
{"version":3,"file":"split-panel-context.d.ts","sourceRoot":"","sources":["../../../../src/internal/context/split-panel-context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAEzD,MAAM,MAAM,yBAAyB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,G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EH,wBAAgB,oBAAoB,2BAEnC"}
|
|
@@ -10,17 +10,15 @@ export var SplitPanelContext = createContext({
|
|
|
10
10
|
size: 0,
|
|
11
11
|
getMaxWidth: function () { return 0; },
|
|
12
12
|
getMaxHeight: function () { return 0; },
|
|
13
|
-
getHeader: function () { return null; },
|
|
14
13
|
isOpen: true,
|
|
15
14
|
isMobile: false,
|
|
16
15
|
isForcedPosition: false,
|
|
17
16
|
lastInteraction: undefined,
|
|
18
|
-
splitPanelRef: undefined,
|
|
19
|
-
splitPanelHeaderRef: undefined,
|
|
20
17
|
onResize: function () { },
|
|
21
18
|
onToggle: function () { },
|
|
22
19
|
onPreferencesChange: function () { },
|
|
23
|
-
reportSize: function () { }
|
|
20
|
+
reportSize: function () { },
|
|
21
|
+
reportHeaderHeight: function () { }
|
|
24
22
|
});
|
|
25
23
|
export function useSplitPanelContext() {
|
|
26
24
|
return useContext(SplitPanelContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-panel-context.js","sourceRoot":"","sources":["../../../../src/internal/context/split-panel-context.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"split-panel-context.js","sourceRoot":"","sources":["../../../../src/internal/context/split-panel-context.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAkCzD,MAAM,CAAC,IAAM,iBAAiB,GAAG,aAAa,CAAyB;IACrE,SAAS,EAAE,CAAC;IACZ,YAAY,EAAE,CAAC;IACf,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;IACd,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,CAAC;IACP,WAAW,EAAE,cAAM,OAAA,CAAC,EAAD,CAAC;IACpB,YAAY,EAAE,cAAM,OAAA,CAAC,EAAD,CAAC;IACrB,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,KAAK;IACf,gBAAgB,EAAE,KAAK;IACvB,eAAe,EAAE,SAAS;IAC1B,QAAQ,EAAE,cAAO,CAAC;IAClB,QAAQ,EAAE,cAAO,CAAC;IAClB,mBAAmB,EAAE,cAAO,CAAC;IAC7B,UAAU,EAAE,cAAO,CAAC;IACpB,kBAAkB,EAAE,cAAO,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,UAAU,oBAAoB;IAClC,OAAO,UAAU,CAAC,iBAAiB,CAAC,CAAC;AACvC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, createContext } from 'react';\n\nexport type SplitPanelLastInteraction = { type: 'open' } | { type: 'close' } | { type: 'position' };\n\nexport interface SplitPanelContextProps {\n topOffset: number;\n bottomOffset: number;\n leftOffset: number;\n rightOffset: number;\n position: 'side' | 'bottom';\n size: number;\n getMaxWidth: () => number;\n getMaxHeight: () => number;\n disableContentPaddings?: boolean;\n contentWidthStyles?: React.CSSProperties;\n contentWrapperPaddings?: {\n closedNav: boolean;\n closedTools: boolean;\n };\n isOpen?: boolean;\n isMobile: boolean;\n isForcedPosition: boolean;\n // The lastInteraction property indicates last meaningful state transition used to trigger split-panel effects.\n // We can't observe properties in a regular way because split-panel is being mounted in several places at once.\n lastInteraction?: SplitPanelLastInteraction;\n onResize: (detail: { size: number }) => void;\n onToggle: () => void;\n onPreferencesChange: (detail: { position: 'side' | 'bottom' }) => void;\n reportSize: (pixels: number) => void;\n reportHeaderHeight: (pixels: number) => void;\n openButtonAriaLabel?: string;\n setOpenButtonAriaLabel?: (value: string) => void;\n}\n\nexport const SplitPanelContext = createContext<SplitPanelContextProps>({\n topOffset: 0,\n bottomOffset: 0,\n leftOffset: 0,\n rightOffset: 0,\n position: 'bottom',\n size: 0,\n getMaxWidth: () => 0,\n getMaxHeight: () => 0,\n isOpen: true,\n isMobile: false,\n isForcedPosition: false,\n lastInteraction: undefined,\n onResize: () => {},\n onToggle: () => {},\n onPreferencesChange: () => {},\n reportSize: () => {},\n reportHeaderHeight: () => {},\n});\n\nexport function useSplitPanelContext() {\n return useContext(SplitPanelContext);\n}\n"]}
|
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bottom.d.ts","sourceRoot":"","sources":["../../../src/split-panel/bottom.tsx"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"bottom.d.ts","sourceRoot":"","sources":["../../../src/split-panel/bottom.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAMtD,UAAU,4BAA6B,SAAQ,sBAAsB;IACnE,KAAK,EAAE,gBAAgB,CAAC;IACxB,uBAAuB,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxC,iBAAiB,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAC;CACpD;AAED,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,MAAM,EACN,KAAK,EACL,uBAAuB,EACvB,aAAa,EACb,UAAU,EACV,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,aAAa,EACb,QAAQ,GACT,EAAE,4BAA4B,eA2D9B"}
|
package/split-panel/bottom.js
CHANGED
|
@@ -2,17 +2,25 @@ import { __assign } from "tslib";
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useEffect, useRef } from 'react';
|
|
6
6
|
import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
7
7
|
import styles from './styles.css.js';
|
|
8
8
|
import { useSplitPanelContext } from '../internal/context/split-panel-context';
|
|
9
9
|
import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
10
|
+
import { useResizeObserver } from '../internal/hooks/container-queries';
|
|
10
11
|
export function SplitPanelContentBottom(_a) {
|
|
11
12
|
var _b, _c, _d;
|
|
12
13
|
var baseProps = _a.baseProps, isOpen = _a.isOpen, state = _a.state, transitioningElementRef = _a.transitioningElementRef, splitPanelRef = _a.splitPanelRef, cappedSize = _a.cappedSize, header = _a.header, resizeHandle = _a.resizeHandle, children = _a.children, appLayoutMaxWidth = _a.appLayoutMaxWidth, panelHeaderId = _a.panelHeaderId, onToggle = _a.onToggle;
|
|
13
14
|
var isRefresh = useVisualRefresh();
|
|
14
|
-
var _e = useSplitPanelContext(), bottomOffset = _e.bottomOffset, leftOffset = _e.leftOffset, rightOffset = _e.rightOffset, disableContentPaddings = _e.disableContentPaddings, contentWrapperPaddings = _e.contentWrapperPaddings, isMobile = _e.isMobile,
|
|
15
|
+
var _e = useSplitPanelContext(), bottomOffset = _e.bottomOffset, leftOffset = _e.leftOffset, rightOffset = _e.rightOffset, disableContentPaddings = _e.disableContentPaddings, contentWrapperPaddings = _e.contentWrapperPaddings, isMobile = _e.isMobile, reportHeaderHeight = _e.reportHeaderHeight;
|
|
15
16
|
var transitionContentBottomRef = useMergeRefs(splitPanelRef || null, transitioningElementRef);
|
|
17
|
+
var headerRef = useRef(null);
|
|
18
|
+
useResizeObserver(headerRef, function (entry) { return reportHeaderHeight(entry.borderBoxHeight); });
|
|
19
|
+
useEffect(function () {
|
|
20
|
+
// report empty height when unmounting the panel
|
|
21
|
+
return function () { return reportHeaderHeight(0); };
|
|
22
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
23
|
+
}, []);
|
|
16
24
|
var centeredMaxWidthClasses = clsx((_b = {},
|
|
17
25
|
_b[styles['pane-bottom-center-align']] = isRefresh,
|
|
18
26
|
_b[styles['pane-bottom-content-nav-padding']] = contentWrapperPaddings === null || contentWrapperPaddings === void 0 ? void 0 : contentWrapperPaddings.closedNav,
|
|
@@ -32,7 +40,7 @@ export function SplitPanelContentBottom(_a) {
|
|
|
32
40
|
}, ref: transitionContentBottomRef }),
|
|
33
41
|
isOpen && React.createElement("div", { className: styles['slider-wrapper-bottom'] }, resizeHandle),
|
|
34
42
|
React.createElement("div", { className: styles['drawer-content-bottom'], "aria-labelledby": panelHeaderId, role: "region" },
|
|
35
|
-
React.createElement("div", { className: clsx(styles['pane-header-wrapper-bottom'], centeredMaxWidthClasses), ref:
|
|
43
|
+
React.createElement("div", { className: clsx(styles['pane-header-wrapper-bottom'], centeredMaxWidthClasses), ref: headerRef }, header),
|
|
36
44
|
React.createElement("div", { className: clsx(styles['content-bottom'], centeredMaxWidthClasses), "aria-hidden": !isOpen },
|
|
37
45
|
React.createElement("div", { className: clsx((_d = {}, _d[styles['content-bottom-max-width']] = isRefresh, _d)), style: appLayoutMaxWidth }, children)))));
|
|
38
46
|
}
|