@cloudscape-design/components 3.0.935 → 3.0.937
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/alert/index.d.ts.map +1 -1
- package/alert/index.js +21 -3
- package/alert/index.js.map +1 -1
- package/alert/internal.d.ts +3 -1
- package/alert/internal.d.ts.map +1 -1
- package/alert/internal.js +2 -2
- package/alert/internal.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/interfaces.js.map +1 -1
- package/form/index.d.ts.map +1 -1
- package/form/index.js +34 -6
- package/form/index.js.map +1 -1
- package/form/internal.d.ts +2 -1
- package/form/internal.d.ts.map +1 -1
- package/form/internal.js +2 -2
- package/form/internal.js.map +1 -1
- package/internal/analytics/hooks/use-funnel.d.ts +4 -0
- package/internal/analytics/hooks/use-funnel.d.ts.map +1 -1
- package/internal/analytics/hooks/use-funnel.js +10 -1
- package/internal/analytics/hooks/use-funnel.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/events/index.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/internal/plugins/api.d.ts.map +1 -1
- package/internal/plugins/api.js +2 -0
- package/internal/plugins/api.js.map +1 -1
- package/internal/utils/check-safe-url.d.ts.map +1 -1
- package/internal/utils/check-safe-url.js +2 -0
- package/internal/utils/check-safe-url.js.map +1 -1
- package/package.json +1 -1
- package/split-panel/bottom.d.ts +3 -2
- package/split-panel/bottom.d.ts.map +1 -1
- package/split-panel/bottom.js +11 -8
- package/split-panel/bottom.js.map +1 -1
- package/split-panel/implementation.d.ts.map +1 -1
- package/split-panel/implementation.js +5 -5
- package/split-panel/implementation.js.map +1 -1
- package/split-panel/side.d.ts +3 -2
- package/split-panel/side.d.ts.map +1 -1
- package/split-panel/side.js +4 -3
- package/split-panel/side.js.map +1 -1
- package/split-panel/styles.css.js +27 -26
- package/split-panel/styles.scoped.css +46 -44
- package/split-panel/styles.selectors.js +27 -26
- package/table/body-cell/inline-editor.d.ts.map +1 -1
- package/table/body-cell/inline-editor.js +2 -0
- package/table/body-cell/inline-editor.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/wizard/wizard-form.d.ts.map +1 -1
- package/wizard/wizard-form.js +22 -9
- package/wizard/wizard-form.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/internal/plugins/api.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAwC,MAAM,8BAA8B,CAAC;AAC7G,OAAO,EAGL,2BAA2B,GAC5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAA8B,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACxG,OAAO,EAA0B,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAwC,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAkC,MAAM,qCAAqC,CAAC;AAC1G,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAE/D,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AA0BlD,SAAS,SAAS,CAAC,aAA4B;IAC7C,IAAI;QACF,IAAI,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAG,UAAU,CAAC,EAAE;YAC/B,OAAO,aAAa,CAAC,UAAU,CAAC,CAAC;SAClC;QAED,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,MAAM,KAAK,aAAa,EAAE;YAC5D,4DAA4D;YAC5D,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,SAAS,CAAC,aAAa,CAAC,MAAuB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/internal/plugins/api.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAwC,MAAM,8BAA8B,CAAC;AAC7G,OAAO,EAGL,2BAA2B,GAC5B,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AC,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAE5G,MAAM,YAAY,GAAG,IAAI,2BAA2B,EAAE,CAAC;IACvD,GAAG,CAAC,YAAY,CAAC,YAAY,GAAG,YAAY,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IAC1F,GAAG,CAAC,oBAAoB,CAAC,YAAY,GAAG,YAAY,CAAC,eAAe,CAAC,GAAG,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAE5G,MAAM,eAAe,GAAG,IAAI,uBAAuB,EAAE,CAAC;IACtD,GAAG,CAAC,YAAY,CAAC,QAAQ,GAAG,eAAe,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACrF,GAAG,CAAC,oBAAoB,CAAC,QAAQ,GAAG,eAAe,CAAC,eAAe,CAAC,GAAG,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAEvG,MAAM,WAAW,GAAG,IAAI,qBAAqB,EAAwB,CAAC;IACtE,GAAG,CAAC,oBAAoB,CAAC,WAAW,GAAG,WAAW,CAAC,eAAe,CAAC,GAAG,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAEzG,MAAM,mBAAmB,GAAG,IAAI,mBAAmB,EAAE,CAAC;IACtD,GAAG,CAAC,oBAAoB,CAAC,mBAAmB,GAAG,mBAAmB,CAAC,eAAe,CAChF,GAAG,CAAC,oBAAoB,CAAC,mBAAmB,CAC7C,CAAC;IAEF,OAAO,GAAe,CAAC;AACzB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BreadcrumbGroupProps } from '../../breadcrumb-group/interfaces';\nimport { ActionButtonsController, ActionsApiInternal, ActionsApiPublic } from './controllers/action-buttons';\nimport {\n AlertFlashContentApiInternal,\n AlertFlashContentApiPublic,\n AlertFlashContentController,\n} from './controllers/alert-flash-content';\nimport { AppLayoutWidgetApiInternal, AppLayoutWidgetController } from './controllers/app-layout-widget';\nimport { BreadcrumbsApiInternal, BreadcrumbsController } from './controllers/breadcrumbs';\nimport { DrawersApiInternal, DrawersApiPublic, DrawersController } from './controllers/drawers';\nimport { SharedReactContexts, SharedReactContextsApiInternal } from './controllers/shared-react-contexts';\nimport { reportRuntimeApiLoadMetric } from './helpers/metrics';\n\nconst storageKey = Symbol.for('awsui-plugin-api');\n\ninterface AwsuiApi {\n awsuiPlugins: {\n appLayout: DrawersApiPublic;\n alert: ActionsApiPublic;\n alertContent: AlertFlashContentApiPublic;\n flashbar: ActionsApiPublic;\n flashContent: AlertFlashContentApiPublic;\n };\n awsuiPluginsInternal: {\n appLayout: DrawersApiInternal;\n appLayoutWidget: AppLayoutWidgetApiInternal;\n alert: ActionsApiInternal;\n alertContent: AlertFlashContentApiInternal;\n flashbar: ActionsApiInternal;\n flashContent: AlertFlashContentApiInternal;\n breadcrumbs: BreadcrumbsApiInternal<BreadcrumbGroupProps>;\n sharedReactContexts: SharedReactContextsApiInternal;\n };\n}\n\ninterface WindowWithApi extends Window {\n [storageKey]: AwsuiApi;\n}\n\nfunction findUpApi(currentWindow: WindowWithApi): AwsuiApi | undefined {\n try {\n if (currentWindow?.[storageKey]) {\n return currentWindow[storageKey];\n }\n\n if (!currentWindow || currentWindow.parent === currentWindow) {\n // When the window has no more parents, it references itself\n return undefined;\n }\n\n return findUpApi(currentWindow.parent as WindowWithApi);\n\n // Consumers in the past have not always been able to support not specifiying the value so we keep and ignore\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (ex) {\n // Most likely a cross-origin access error\n return undefined;\n }\n}\n\nexport function loadApi() {\n if (typeof window === 'undefined') {\n return installApi({});\n }\n const win = window as unknown as WindowWithApi;\n const existingApi = findUpApi(win);\n if (!existingApi) {\n reportRuntimeApiLoadMetric();\n }\n win[storageKey] = installApi(existingApi ?? {});\n return win[storageKey];\n}\n\nexport const { awsuiPlugins, awsuiPluginsInternal } = loadApi();\n\ntype DeepPartial<T> = T extends (...args: any) => any ? T : { [P in keyof T]?: DeepPartial<T[P]> };\n\nfunction installApi(api: DeepPartial<AwsuiApi>): AwsuiApi {\n api.awsuiPlugins ??= {};\n api.awsuiPluginsInternal ??= {};\n\n const appLayoutDrawers = new DrawersController();\n api.awsuiPlugins.appLayout = appLayoutDrawers.installPublic(api.awsuiPlugins.appLayout);\n api.awsuiPluginsInternal.appLayout = appLayoutDrawers.installInternal(api.awsuiPluginsInternal.appLayout);\n\n const appLayoutController = new AppLayoutWidgetController();\n api.awsuiPluginsInternal.appLayoutWidget = appLayoutController.installInternal(\n api.awsuiPluginsInternal.appLayoutWidget\n );\n\n const alertActions = new ActionButtonsController();\n api.awsuiPlugins.alert = alertActions.installPublic(api.awsuiPlugins.alert);\n api.awsuiPluginsInternal.alert = alertActions.installInternal(api.awsuiPluginsInternal.alert);\n\n const alertContent = new AlertFlashContentController();\n api.awsuiPlugins.alertContent = alertContent.installPublic(api.awsuiPlugins.alertContent);\n api.awsuiPluginsInternal.alertContent = alertContent.installInternal(api.awsuiPluginsInternal.alertContent);\n\n const flashContent = new AlertFlashContentController();\n api.awsuiPlugins.flashContent = flashContent.installPublic(api.awsuiPlugins.flashContent);\n api.awsuiPluginsInternal.flashContent = flashContent.installInternal(api.awsuiPluginsInternal.flashContent);\n\n const flashbarActions = new ActionButtonsController();\n api.awsuiPlugins.flashbar = flashbarActions.installPublic(api.awsuiPlugins.flashbar);\n api.awsuiPluginsInternal.flashbar = flashbarActions.installInternal(api.awsuiPluginsInternal.flashbar);\n\n const breadcrumbs = new BreadcrumbsController<BreadcrumbGroupProps>();\n api.awsuiPluginsInternal.breadcrumbs = breadcrumbs.installInternal(api.awsuiPluginsInternal.breadcrumbs);\n\n const sharedReactContexts = new SharedReactContexts();\n api.awsuiPluginsInternal.sharedReactContexts = sharedReactContexts.installInternal(\n api.awsuiPluginsInternal.sharedReactContexts\n );\n\n return api as AwsuiApi;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-safe-url.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/check-safe-url.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"check-safe-url.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/check-safe-url.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CA2BpF"}
|
|
@@ -12,6 +12,8 @@ export function checkSafeUrl(component, url) {
|
|
|
12
12
|
let parsedUrl;
|
|
13
13
|
try {
|
|
14
14
|
parsedUrl = new URL(url);
|
|
15
|
+
// Consumers in the past have not always been able to support not specifiying the value so we keep and ignore
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
17
|
}
|
|
16
18
|
catch (e) {
|
|
17
19
|
// If the URL cannot be parsed by the browser, it likely does not pose a security risk.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-safe-url.js","sourceRoot":"","sources":["../../../../src/internal/utils/check-safe-url.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,MAAM,qBAAqB,GAAG,CAAC,oBAAoB,EAAE,qBAAqB,EAAE,cAAc,CAAC,CAAC;AAE5F,MAAM,UAAU,YAAY,CAAC,SAAiB,EAAE,GAA8B;IAC5E,IAAI,CAAC,GAAG,EAAE;QACR,OAAO;KACR;IACD,IAAI,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE;QAC3D,OAAO;KACR;IAED,IAAI,SAAc,CAAC;IACnB,IAAI;QACF,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"check-safe-url.js","sourceRoot":"","sources":["../../../../src/internal/utils/check-safe-url.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,MAAM,qBAAqB,GAAG,CAAC,oBAAoB,EAAE,qBAAqB,EAAE,cAAc,CAAC,CAAC;AAE5F,MAAM,UAAU,YAAY,CAAC,SAAiB,EAAE,GAA8B;IAC5E,IAAI,CAAC,GAAG,EAAE;QACR,OAAO;KACR;IACD,IAAI,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE;QAC3D,OAAO;KACR;IAED,IAAI,SAAc,CAAC;IACnB,IAAI;QACF,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAEzB,6GAA6G;QAC7G,6DAA6D;KAC9D;IAAC,OAAO,CAAC,EAAE;QACV,uFAAuF;QACvF,OAAO;KACR;IAED,IAAI,SAAS,CAAC,QAAQ,KAAK,aAAa,EAAE;QACxC,QAAQ,CAAC,SAAS,EAAE,wEAAwE,GAAG,IAAI,CAAC,CAAC;QACrG,sDAAsD;QACtD,mIAAmI;QACnI,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;KAC5E;IAED,OAAO;AACT,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nconst allowedJavascriptUrls = ['javascript:void(0)', 'javascript:void(0);', 'javascript:;'];\n\nexport function checkSafeUrl(component: string, url: string | undefined | null): void {\n if (!url) {\n return;\n }\n if (allowedJavascriptUrls.indexOf(url.toLowerCase()) !== -1) {\n return;\n }\n\n let parsedUrl: URL;\n try {\n parsedUrl = new URL(url);\n\n // Consumers in the past have not always been able to support not specifiying the value so we keep and ignore\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n // If the URL cannot be parsed by the browser, it likely does not pose a security risk.\n return;\n }\n\n if (parsedUrl.protocol === 'javascript:') {\n warnOnce(component, `A javascript: URL was blocked as a security precaution. The URL was \"${url}\".`);\n // This mirrors the error message that React will use:\n // https://github.com/facebook/react/blob/a724a3b578dce77d427bef313102a4d0e978d9b4/packages/react-dom/src/shared/sanitizeURL.js#L30\n throw new Error(`A javascript: URL was blocked as a security precaution.`);\n }\n\n return;\n}\n"]}
|
package/package.json
CHANGED
package/split-panel/bottom.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { SplitPanelContentProps } from './interfaces';
|
|
2
|
+
import { SplitPanelContentProps, SplitPanelProps } from './interfaces';
|
|
3
3
|
interface SplitPanelContentBottomProps extends SplitPanelContentProps {
|
|
4
4
|
appLayoutMaxWidth: React.CSSProperties | undefined;
|
|
5
|
+
closeBehavior: SplitPanelProps['closeBehavior'];
|
|
5
6
|
}
|
|
6
|
-
export declare function SplitPanelContentBottom({ baseProps, isOpen, splitPanelRef, cappedSize, header, resizeHandle, children, appLayoutMaxWidth, panelHeaderId, onToggle, }: SplitPanelContentBottomProps): JSX.Element;
|
|
7
|
+
export declare function SplitPanelContentBottom({ closeBehavior, baseProps, isOpen, splitPanelRef, cappedSize, header, resizeHandle, children, appLayoutMaxWidth, panelHeaderId, onToggle, }: SplitPanelContentBottomProps): JSX.Element;
|
|
7
8
|
export {};
|
|
8
9
|
//# sourceMappingURL=bottom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bottom.d.ts","sourceRoot":"","sources":["../../../src/split-panel/bottom.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAUjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"bottom.d.ts","sourceRoot":"","sources":["../../../src/split-panel/bottom.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAUjD,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAMvE,UAAU,4BAA6B,SAAQ,sBAAsB;IACnE,iBAAiB,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAC;IACnD,aAAa,EAAE,eAAe,CAAC,eAAe,CAAC,CAAC;CACjD;AAED,wBAAgB,uBAAuB,CAAC,EACtC,aAAa,EACb,SAAS,EACT,MAAM,EACN,aAAa,EACb,UAAU,EACV,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,aAAa,EACb,QAAQ,GACT,EAAE,4BAA4B,eA+E9B"}
|
package/split-panel/bottom.js
CHANGED
|
@@ -11,15 +11,15 @@ import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
|
11
11
|
import sharedStyles from '../app-layout/resize/styles.css.js';
|
|
12
12
|
import styles from './styles.css.js';
|
|
13
13
|
import testUtilStyles from './test-classes/styles.css.js';
|
|
14
|
-
export function SplitPanelContentBottom({ baseProps, isOpen, splitPanelRef, cappedSize, header, resizeHandle, children, appLayoutMaxWidth, panelHeaderId, onToggle, }) {
|
|
14
|
+
export function SplitPanelContentBottom({ closeBehavior, baseProps, isOpen, splitPanelRef, cappedSize, header, resizeHandle, children, appLayoutMaxWidth, panelHeaderId, onToggle, }) {
|
|
15
15
|
const isRefresh = useVisualRefresh();
|
|
16
16
|
const isToolbar = useAppLayoutToolbarDesignEnabled();
|
|
17
17
|
const { bottomOffset, leftOffset, rightOffset, disableContentPaddings, contentWrapperPaddings, reportHeaderHeight, headerHeight: headerBlockSize, animationDisabled, } = useSplitPanelContext();
|
|
18
18
|
const isMobile = useMobile();
|
|
19
19
|
const headerRef = useRef(null);
|
|
20
20
|
useResizeObserver(headerRef, entry => {
|
|
21
|
-
const
|
|
22
|
-
reportHeaderHeight(
|
|
21
|
+
const visibleHeaderSize = closeBehavior === 'hide' && !isOpen ? 0 : entry.borderBoxHeight;
|
|
22
|
+
reportHeaderHeight(visibleHeaderSize);
|
|
23
23
|
});
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
// report empty height when unmounting the panel
|
|
@@ -39,20 +39,23 @@ export function SplitPanelContentBottom({ baseProps, isOpen, splitPanelRef, capp
|
|
|
39
39
|
[styles['drawer-disable-content-paddings']]: disableContentPaddings,
|
|
40
40
|
[styles.refresh]: isRefresh,
|
|
41
41
|
[styles['with-toolbar']]: isToolbar,
|
|
42
|
+
[styles.hidden]: closeBehavior === 'hide' && !isOpen,
|
|
42
43
|
}), onClick: () => !isOpen && onToggle(), style: {
|
|
43
44
|
insetBlockEnd: bottomOffset,
|
|
44
45
|
insetInlineStart: leftOffset,
|
|
45
46
|
insetInlineEnd: rightOffset,
|
|
46
47
|
blockSize: isOpen
|
|
47
48
|
? cappedSize
|
|
48
|
-
:
|
|
49
|
-
?
|
|
50
|
-
: undefined
|
|
51
|
-
|
|
49
|
+
: closeBehavior === 'hide'
|
|
50
|
+
? 0
|
|
51
|
+
: isToolbar && headerBlockSize !== undefined
|
|
52
|
+
? `calc(${headerBlockSize}px + ${tokens.borderPanelTopWidth})`
|
|
53
|
+
: undefined,
|
|
54
|
+
}, ref: splitPanelRef }), closeBehavior === 'hide' && !isOpen ? null : (React.createElement(React.Fragment, null,
|
|
52
55
|
isOpen && React.createElement("div", { className: styles['slider-wrapper-bottom'] }, resizeHandle),
|
|
53
56
|
React.createElement("div", { className: styles['drawer-content-bottom'], "aria-labelledby": panelHeaderId, role: "region" },
|
|
54
57
|
React.createElement("div", { className: clsx(styles['pane-header-wrapper-bottom'], centeredMaxWidthClasses), ref: headerRef }, header),
|
|
55
58
|
React.createElement("div", { className: clsx(styles['content-bottom'], centeredMaxWidthClasses), "aria-hidden": !isOpen },
|
|
56
|
-
React.createElement("div", { className: clsx({ [styles['content-bottom-max-width']]: isRefresh }), style: appLayoutMaxWidth }, children)))));
|
|
59
|
+
React.createElement("div", { className: clsx({ [styles['content-bottom-max-width']]: isRefresh }), style: appLayoutMaxWidth }, children)))))));
|
|
57
60
|
}
|
|
58
61
|
//# sourceMappingURL=bottom.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bottom.js","sourceRoot":"","sources":["../../../src/split-panel/bottom.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,KAAK,MAAM,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE,OAAO,YAAY,MAAM,oCAAoC,CAAC;AAC9D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"bottom.js","sourceRoot":"","sources":["../../../src/split-panel/bottom.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,K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K,SAAS;wBAC1C,CAAC,CAAC,QAAQ,eAAe,QAAQ,MAAM,CAAC,mBAAmB,GAAG;wBAC9D,CAAC,CAAC,SAAS;SAClB,EACD,GAAG,EAAE,aAAa,KAEjB,aAAa,KAAK,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC5C;QACG,MAAM,IAAI,6BAAK,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC,IAAG,YAAY,CAAO;QAChF,6BAAK,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC,qBAAmB,aAAa,EAAE,IAAI,EAAC,QAAQ;YAC5F,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,4BAA4B,CAAC,EAAE,uBAAuB,CAAC,EAAE,GAAG,EAAE,SAAS,IAChG,MAAM,CACH;YACN,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,uBAAuB,CAAC,iBAAe,CAAC,MAAM;gBAC3F,6BAAK,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,iBAAiB,IAChG,QAAQ,CACL,CACF,CACF,CACL,CACJ,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useResizeObserver } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useAppLayoutToolbarDesignEnabled } from '../app-layout/utils/feature-flags';\nimport { useSplitPanelContext } from '../internal/context/split-panel-context';\nimport * as tokens from '../internal/generated/styles/tokens';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { SplitPanelContentProps, SplitPanelProps } from './interfaces';\n\nimport sharedStyles from '../app-layout/resize/styles.css.js';\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\ninterface SplitPanelContentBottomProps extends SplitPanelContentProps {\n appLayoutMaxWidth: React.CSSProperties | undefined;\n closeBehavior: SplitPanelProps['closeBehavior'];\n}\n\nexport function SplitPanelContentBottom({\n closeBehavior,\n baseProps,\n isOpen,\n splitPanelRef,\n cappedSize,\n header,\n resizeHandle,\n children,\n appLayoutMaxWidth,\n panelHeaderId,\n onToggle,\n}: SplitPanelContentBottomProps) {\n const isRefresh = useVisualRefresh();\n const isToolbar = useAppLayoutToolbarDesignEnabled();\n const {\n bottomOffset,\n leftOffset,\n rightOffset,\n disableContentPaddings,\n contentWrapperPaddings,\n reportHeaderHeight,\n headerHeight: headerBlockSize,\n animationDisabled,\n } = useSplitPanelContext();\n const isMobile = useMobile();\n\n const headerRef = useRef<HTMLDivElement>(null);\n\n useResizeObserver(headerRef, entry => {\n const visibleHeaderSize = closeBehavior === 'hide' && !isOpen ? 0 : entry.borderBoxHeight;\n reportHeaderHeight(visibleHeaderSize);\n });\n\n useEffect(() => {\n // report empty height when unmounting the panel\n return () => reportHeaderHeight(0);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const centeredMaxWidthClasses = clsx({\n [styles['pane-bottom-center-align']]: isRefresh,\n [styles['pane-bottom-content-nav-padding']]: contentWrapperPaddings?.closedNav,\n [styles['pane-bottom-content-tools-padding']]: contentWrapperPaddings?.closedTools,\n });\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.drawer, styles['position-bottom'], testUtilStyles.root, {\n [sharedStyles['with-motion-vertical']]: !animationDisabled,\n [testUtilStyles['open-position-bottom']]: isOpen,\n [styles['drawer-closed']]: !isOpen,\n [styles['drawer-mobile']]: isMobile,\n [styles['drawer-disable-content-paddings']]: disableContentPaddings,\n [styles.refresh]: isRefresh,\n [styles['with-toolbar']]: isToolbar,\n [styles.hidden]: closeBehavior === 'hide' && !isOpen,\n })}\n onClick={() => !isOpen && onToggle()}\n style={{\n insetBlockEnd: bottomOffset,\n insetInlineStart: leftOffset,\n insetInlineEnd: rightOffset,\n blockSize: isOpen\n ? cappedSize\n : closeBehavior === 'hide'\n ? 0\n : isToolbar && headerBlockSize !== undefined\n ? `calc(${headerBlockSize}px + ${tokens.borderPanelTopWidth})`\n : undefined,\n }}\n ref={splitPanelRef}\n >\n {closeBehavior === 'hide' && !isOpen ? null : (\n <>\n {isOpen && <div className={styles['slider-wrapper-bottom']}>{resizeHandle}</div>}\n <div className={styles['drawer-content-bottom']} aria-labelledby={panelHeaderId} role=\"region\">\n <div className={clsx(styles['pane-header-wrapper-bottom'], centeredMaxWidthClasses)} ref={headerRef}>\n {header}\n </div>\n <div className={clsx(styles['content-bottom'], centeredMaxWidthClasses)} aria-hidden={!isOpen}>\n <div className={clsx({ [styles['content-bottom-max-width']]: isRefresh })} style={appLayoutMaxWidth}>\n {children}\n </div>\n </div>\n </div>\n </>\n )}\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAKlF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAO/C,MAAM,MAAM,6BAA6B,GAAG,YAAY,CAAC,eAAe,EAAE,uBAAuB,GAAG,eAAe,CAAC,GAClH,0BAA0B,CAAC;AAE7B,wBAAgB,wBAAwB,CAAC,EACvC,iBAAiB,EACjB,MAAM,EACN,QAAQ,EACR,qBAAqB,EACrB,aAAa,EACb,WAAgB,EAChB,GAAG,SAAS,EACb,EAAE,6BAA6B,
|
|
1
|
+
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAKlF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAO/C,MAAM,MAAM,6BAA6B,GAAG,YAAY,CAAC,eAAe,EAAE,uBAAuB,GAAG,eAAe,CAAC,GAClH,0BAA0B,CAAC;AAE7B,wBAAgB,wBAAwB,CAAC,EACvC,iBAAiB,EACjB,MAAM,EACN,QAAQ,EACR,qBAAqB,EACrB,aAAa,EACb,WAAgB,EAChB,GAAG,SAAS,EACb,EAAE,6BAA6B,eA6N/B;AAED,eAAO,MAAM,0BAA0B,2FAAsD,CAAC"}
|
|
@@ -24,7 +24,7 @@ export function SplitPanelImplementation(_a) {
|
|
|
24
24
|
var { __internalRootRef, header, children, hidePreferencesButton, closeBehavior, i18nStrings = {} } = _a, restProps = __rest(_a, ["__internalRootRef", "header", "children", "hidePreferencesButton", "closeBehavior", "i18nStrings"]);
|
|
25
25
|
const isRefresh = useVisualRefresh();
|
|
26
26
|
const isToolbar = useAppLayoutToolbarDesignEnabled();
|
|
27
|
-
const { position, topOffset, bottomOffset, rightOffset, contentWidthStyles, isOpen, isForcedPosition, onPreferencesChange, onResize, onToggle, size, relativeSize, setSplitPanelToggle, refs, } = useSplitPanelContext();
|
|
27
|
+
const { position, topOffset, bottomOffset, rightOffset, contentWidthStyles, isOpen, isForcedPosition, onPreferencesChange, onResize, onToggle, size, relativeSize, setSplitPanelToggle, refs, animationDisabled, } = useSplitPanelContext();
|
|
28
28
|
const baseProps = getBaseProps(restProps);
|
|
29
29
|
const [isPreferencesOpen, setPreferencesOpen] = useState(false);
|
|
30
30
|
const appLayoutMaxWidth = isRefresh && position === 'bottom' ? contentWidthStyles : undefined;
|
|
@@ -55,7 +55,7 @@ export function SplitPanelImplementation(_a) {
|
|
|
55
55
|
!hidePreferencesButton && isOpen && (React.createElement(React.Fragment, null,
|
|
56
56
|
React.createElement(InternalButton, { className: testUtilStyles['preferences-button'], iconName: "settings", variant: "icon", onClick: () => setPreferencesOpen(true), formAction: "none", ariaLabel: i18nStrings.preferencesTitle, ref: refs.preferences }),
|
|
57
57
|
React.createElement("span", { className: styles.divider }))),
|
|
58
|
-
isOpen ? (React.createElement(InternalButton, { className: testUtilStyles['close-button'], iconName: isRefresh && closeBehavior === 'collapse' ? (position === 'side' ? 'angle-right' : 'angle-down') : 'close', variant: "icon", onClick: onToggle, formAction: "none", ariaLabel: i18nStrings.closeButtonAriaLabel, ariaExpanded: isOpen })) : position === 'side' ? null : (React.createElement(InternalButton, { className: testUtilStyles['open-button'], iconName: "angle-up", variant: "icon", formAction: "none", ariaLabel: i18nStrings.openButtonAriaLabel, ref: refs.toggle, ariaExpanded: isOpen })))));
|
|
58
|
+
isOpen ? (React.createElement(InternalButton, { className: testUtilStyles['close-button'], iconName: isRefresh && closeBehavior === 'collapse' ? (position === 'side' ? 'angle-right' : 'angle-down') : 'close', variant: "icon", onClick: onToggle, formAction: "none", ariaLabel: i18nStrings.closeButtonAriaLabel, ariaExpanded: isOpen })) : position === 'side' || closeBehavior === 'hide' ? null : (React.createElement(InternalButton, { className: testUtilStyles['open-button'], iconName: "angle-up", variant: "icon", formAction: "none", ariaLabel: i18nStrings.openButtonAriaLabel, ref: refs.toggle, ariaExpanded: isOpen })))));
|
|
59
59
|
const resizeHandle = (React.createElement(PanelResizeHandle, { ref: refs.slider, className: testUtilStyles.slider, ariaLabel: i18nStrings.resizeHandleAriaLabel,
|
|
60
60
|
// Allows us to use the logical left/right keys to move the slider left/right,
|
|
61
61
|
// but match aria keyboard behavior of using left/right to decrease/increase
|
|
@@ -82,7 +82,7 @@ export function SplitPanelImplementation(_a) {
|
|
|
82
82
|
}
|
|
83
83
|
}, [rightOffset, __internalRootRef]);
|
|
84
84
|
const mergedRef = useMergeRefs(splitPanelRefObject, __internalRootRef);
|
|
85
|
-
if (closeBehavior === 'hide' && !isOpen) {
|
|
85
|
+
if (closeBehavior === 'hide' && !isOpen && (animationDisabled || !isRefresh)) {
|
|
86
86
|
return React.createElement(React.Fragment, null);
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
@@ -95,8 +95,8 @@ export function SplitPanelImplementation(_a) {
|
|
|
95
95
|
return React.createElement(React.Fragment, null);
|
|
96
96
|
}
|
|
97
97
|
return (React.createElement(React.Fragment, null,
|
|
98
|
-
position === 'side' && (React.createElement(SplitPanelContentSide, { style: contentStyle, resizeHandle: resizeHandle, baseProps: baseProps, isOpen: isOpen, splitPanelRef: mergedRef, cappedSize: size, onToggle: onToggle, openButtonAriaLabel: openButtonAriaLabel, toggleRef: refs.toggle, header: wrappedHeader, panelHeaderId: panelHeaderId }, children)),
|
|
99
|
-
position === 'bottom' && (React.createElement(SplitPanelContentBottom, { style: contentStyle, resizeHandle: resizeHandle, baseProps: baseProps, isOpen: isOpen, splitPanelRef: mergedRef, cappedSize: size, onToggle: onToggle, header: wrappedHeader, panelHeaderId: panelHeaderId, appLayoutMaxWidth: appLayoutMaxWidth }, children)),
|
|
98
|
+
position === 'side' && (React.createElement(SplitPanelContentSide, { style: contentStyle, resizeHandle: resizeHandle, baseProps: baseProps, isOpen: isOpen, splitPanelRef: mergedRef, cappedSize: size, onToggle: onToggle, openButtonAriaLabel: openButtonAriaLabel, toggleRef: refs.toggle, header: wrappedHeader, panelHeaderId: panelHeaderId, closeBehavior: closeBehavior }, children)),
|
|
99
|
+
position === 'bottom' && (React.createElement(SplitPanelContentBottom, { style: contentStyle, resizeHandle: resizeHandle, baseProps: baseProps, isOpen: isOpen, splitPanelRef: mergedRef, cappedSize: size, onToggle: onToggle, header: wrappedHeader, panelHeaderId: panelHeaderId, appLayoutMaxWidth: appLayoutMaxWidth, closeBehavior: closeBehavior }, children)),
|
|
100
100
|
isPreferencesOpen && (React.createElement(PreferencesModal, { visible: true, preferences: { position }, disabledSidePosition: position === 'bottom' && isForcedPosition, isRefresh: isRefresh, i18nStrings: {
|
|
101
101
|
header: i18nStrings.preferencesTitle,
|
|
102
102
|
confirm: i18nStrings.preferencesConfirm,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AAErF,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,iBAAiB,MAAM,4CAA4C,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAE/E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,UAAU,MAAM,gCAAgC,CAAC;AAExD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEnD,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAE/C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAK1D,MAAM,UAAU,wBAAwB,CAAC,EAQT;QARS,EACvC,iBAAiB,EACjB,MAAM,EACN,QAAQ,EACR,qB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AAiB,IAAI,CACpB,oBAAC,gBAAgB,IACf,OAAO,EAAE,IAAI,EACb,WAAW,EAAE,EAAE,QAAQ,EAAE,EACzB,oBAAoB,EAAE,QAAQ,KAAK,QAAQ,IAAI,gBAAgB,EAC/D,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE;gBACX,MAAM,EAAE,WAAW,CAAC,gBAAgB;gBACpC,OAAO,EAAE,WAAW,CAAC,kBAAkB;gBACvC,MAAM,EAAE,WAAW,CAAC,iBAAiB;gBACrC,aAAa,EAAE,WAAW,CAAC,wBAAwB;gBACnD,mBAAmB,EAAE,WAAW,CAAC,8BAA8B;gBAC/D,cAAc,EAAE,WAAW,CAAC,yBAAyB;gBACrD,YAAY,EAAE,WAAW,CAAC,uBAAuB;aAClD,EACD,SAAS,EAAE,WAAW,CAAC,EAAE;gBACvB,mBAAmB,mBAAM,WAAW,EAAG,CAAC;gBACxC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC,EACD,SAAS,EAAE,GAAG,EAAE;gBACd,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC,GACD,CACH,CACA,CACJ,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,0BAA0B,GAAG,yBAAyB,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useAppLayoutToolbarDesignEnabled } from '../app-layout/utils/feature-flags';\nimport { SizeControlProps } from '../app-layout/utils/interfaces';\nimport { useKeyboardEvents } from '../app-layout/utils/use-keyboard-events';\nimport { usePointerEvents } from '../app-layout/utils/use-pointer-events';\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport PanelResizeHandle from '../internal/components/panel-resize-handle';\nimport { useSplitPanelContext } from '../internal/context/split-panel-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport globalVars from '../internal/styles/global-vars';\nimport { SomeRequired } from '../internal/types';\nimport { createWidgetizedComponent } from '../internal/widgets';\nimport { SplitPanelContentBottom } from './bottom';\nimport { SplitPanelProps } from './interfaces';\nimport PreferencesModal from './preferences-modal';\nimport { SplitPanelContentSide } from './side';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport type SplitPanelImplementationProps = SomeRequired<SplitPanelProps, 'hidePreferencesButton' | 'closeBehavior'> &\n InternalBaseComponentProps;\n\nexport function SplitPanelImplementation({\n __internalRootRef,\n header,\n children,\n hidePreferencesButton,\n closeBehavior,\n i18nStrings = {},\n ...restProps\n}: SplitPanelImplementationProps) {\n const isRefresh = useVisualRefresh();\n const isToolbar = useAppLayoutToolbarDesignEnabled();\n\n const {\n position,\n topOffset,\n bottomOffset,\n rightOffset,\n contentWidthStyles,\n isOpen,\n isForcedPosition,\n onPreferencesChange,\n onResize,\n onToggle,\n size,\n relativeSize,\n setSplitPanelToggle,\n refs,\n } = useSplitPanelContext();\n const baseProps = getBaseProps(restProps);\n const [isPreferencesOpen, setPreferencesOpen] = useState<boolean>(false);\n\n const appLayoutMaxWidth = isRefresh && position === 'bottom' ? contentWidthStyles : undefined;\n\n const openButtonAriaLabel = i18nStrings.openButtonAriaLabel;\n useEffect(() => {\n setSplitPanelToggle({ displayed: closeBehavior === 'collapse', ariaLabel: openButtonAriaLabel });\n\n return () => {\n setSplitPanelToggle({ displayed: false, ariaLabel: undefined });\n };\n }, [setSplitPanelToggle, openButtonAriaLabel, closeBehavior]);\n\n const splitPanelRefObject = useRef<HTMLDivElement>(null);\n\n const sizeControlProps: SizeControlProps = {\n position,\n panelRef: splitPanelRefObject,\n handleRef: refs.slider,\n onResize,\n };\n const onSliderPointerDown = usePointerEvents(sizeControlProps);\n const onKeyDown = useKeyboardEvents(sizeControlProps);\n\n const contentStyle = {\n [globalVars.stickyVerticalTopOffset]: topOffset,\n [globalVars.stickyVerticalBottomOffset]: bottomOffset,\n };\n\n const panelHeaderId = useUniqueId('split-panel-header');\n\n const wrappedHeader = (\n <div className={clsx(styles.header, isToolbar && styles['with-toolbar'])} style={appLayoutMaxWidth}>\n <h2 className={clsx(styles['header-text'], testUtilStyles['header-text'])} id={panelHeaderId}>\n {header}\n </h2>\n <div className={styles['header-actions']}>\n {!hidePreferencesButton && isOpen && (\n <>\n <InternalButton\n className={testUtilStyles['preferences-button']}\n iconName=\"settings\"\n variant=\"icon\"\n onClick={() => setPreferencesOpen(true)}\n formAction=\"none\"\n ariaLabel={i18nStrings.preferencesTitle}\n ref={refs.preferences}\n />\n <span className={styles.divider} />\n </>\n )}\n\n {isOpen ? (\n <InternalButton\n className={testUtilStyles['close-button']}\n iconName={\n isRefresh && closeBehavior === 'collapse' ? (position === 'side' ? 'angle-right' : 'angle-down') : 'close'\n }\n variant=\"icon\"\n onClick={onToggle}\n formAction=\"none\"\n ariaLabel={i18nStrings.closeButtonAriaLabel}\n ariaExpanded={isOpen}\n />\n ) : position === 'side' ? null : (\n <InternalButton\n className={testUtilStyles['open-button']}\n iconName=\"angle-up\"\n variant=\"icon\"\n formAction=\"none\"\n ariaLabel={i18nStrings.openButtonAriaLabel}\n ref={refs.toggle}\n ariaExpanded={isOpen}\n />\n )}\n </div>\n </div>\n );\n\n const resizeHandle = (\n <PanelResizeHandle\n ref={refs.slider}\n className={testUtilStyles.slider}\n ariaLabel={i18nStrings.resizeHandleAriaLabel}\n // Allows us to use the logical left/right keys to move the slider left/right,\n // but match aria keyboard behavior of using left/right to decrease/increase\n // the slider value.\n ariaValuenow={position === 'bottom' ? relativeSize : 100 - relativeSize}\n position={position}\n onKeyDown={onKeyDown}\n onPointerDown={onSliderPointerDown}\n />\n );\n\n /*\n This effect forces the browser to recalculate the layout\n whenever the split panel might have moved.\n\n This is needed as a workaround for a bug in Safari, which does\n not automatically calculate the new position of the split panel\n _content_ when the split panel moves.\n */\n useLayoutEffect(() => {\n const root = splitPanelRefObject.current;\n\n if (root) {\n const property = 'transform';\n const temporaryValue = 'translateZ(0)';\n\n const valueBefore = root.style[property];\n root.style[property] = temporaryValue;\n\n // This line forces the browser to recalculate the layout\n void root.offsetHeight;\n\n root.style[property] = valueBefore;\n }\n }, [rightOffset, __internalRootRef]);\n\n const mergedRef = useMergeRefs(splitPanelRefObject, __internalRootRef);\n\n if (closeBehavior === 'hide' && !isOpen) {\n return <></>;\n }\n\n /**\n * The AppLayout factor moved the circular buttons out of the\n * SplitPanel and into the Tools component. This conditional\n * is still needed for the early return to prevent execution\n * of the following code.\n */\n if (isRefresh && !isToolbar && !isOpen && position === 'side') {\n return <></>;\n }\n\n return (\n <>\n {position === 'side' && (\n <SplitPanelContentSide\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n openButtonAriaLabel={openButtonAriaLabel}\n toggleRef={refs.toggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n >\n {children}\n </SplitPanelContentSide>\n )}\n\n {position === 'bottom' && (\n <SplitPanelContentBottom\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n appLayoutMaxWidth={appLayoutMaxWidth}\n >\n {children}\n </SplitPanelContentBottom>\n )}\n {isPreferencesOpen && (\n <PreferencesModal\n visible={true}\n preferences={{ position }}\n disabledSidePosition={position === 'bottom' && isForcedPosition}\n isRefresh={isRefresh}\n i18nStrings={{\n header: i18nStrings.preferencesTitle,\n confirm: i18nStrings.preferencesConfirm,\n cancel: i18nStrings.preferencesCancel,\n positionLabel: i18nStrings.preferencesPositionLabel,\n positionDescription: i18nStrings.preferencesPositionDescription,\n positionBottom: i18nStrings.preferencesPositionBottom,\n positionSide: i18nStrings.preferencesPositionSide,\n }}\n onConfirm={preferences => {\n onPreferencesChange({ ...preferences });\n setPreferencesOpen(false);\n }}\n onDismiss={() => {\n setPreferencesOpen(false);\n }}\n />\n )}\n </>\n );\n}\n\nexport const createWidgetizedSplitPanel = createWidgetizedComponent(SplitPanelImplementation);\n"]}
|
|
1
|
+
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AAErF,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,iBAAiB,MAAM,4CAA4C,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAE/E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,UAAU,MAAM,gCAAgC,CAAC;AAExD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEnD,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AACn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useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useAppLayoutToolbarDesignEnabled } from '../app-layout/utils/feature-flags';\nimport { SizeControlProps } from '../app-layout/utils/interfaces';\nimport { useKeyboardEvents } from '../app-layout/utils/use-keyboard-events';\nimport { usePointerEvents } from '../app-layout/utils/use-pointer-events';\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport PanelResizeHandle from '../internal/components/panel-resize-handle';\nimport { useSplitPanelContext } from '../internal/context/split-panel-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport globalVars from '../internal/styles/global-vars';\nimport { SomeRequired } from '../internal/types';\nimport { createWidgetizedComponent } from '../internal/widgets';\nimport { SplitPanelContentBottom } from './bottom';\nimport { SplitPanelProps } from './interfaces';\nimport PreferencesModal from './preferences-modal';\nimport { SplitPanelContentSide } from './side';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport type SplitPanelImplementationProps = SomeRequired<SplitPanelProps, 'hidePreferencesButton' | 'closeBehavior'> &\n InternalBaseComponentProps;\n\nexport function SplitPanelImplementation({\n __internalRootRef,\n header,\n children,\n hidePreferencesButton,\n closeBehavior,\n i18nStrings = {},\n ...restProps\n}: SplitPanelImplementationProps) {\n const isRefresh = useVisualRefresh();\n const isToolbar = useAppLayoutToolbarDesignEnabled();\n\n const {\n position,\n topOffset,\n bottomOffset,\n rightOffset,\n contentWidthStyles,\n isOpen,\n isForcedPosition,\n onPreferencesChange,\n onResize,\n onToggle,\n size,\n relativeSize,\n setSplitPanelToggle,\n refs,\n animationDisabled,\n } = useSplitPanelContext();\n const baseProps = getBaseProps(restProps);\n const [isPreferencesOpen, setPreferencesOpen] = useState<boolean>(false);\n\n const appLayoutMaxWidth = isRefresh && position === 'bottom' ? contentWidthStyles : undefined;\n\n const openButtonAriaLabel = i18nStrings.openButtonAriaLabel;\n useEffect(() => {\n setSplitPanelToggle({ displayed: closeBehavior === 'collapse', ariaLabel: openButtonAriaLabel });\n\n return () => {\n setSplitPanelToggle({ displayed: false, ariaLabel: undefined });\n };\n }, [setSplitPanelToggle, openButtonAriaLabel, closeBehavior]);\n\n const splitPanelRefObject = useRef<HTMLDivElement>(null);\n\n const sizeControlProps: SizeControlProps = {\n position,\n panelRef: splitPanelRefObject,\n handleRef: refs.slider,\n onResize,\n };\n const onSliderPointerDown = usePointerEvents(sizeControlProps);\n const onKeyDown = useKeyboardEvents(sizeControlProps);\n\n const contentStyle = {\n [globalVars.stickyVerticalTopOffset]: topOffset,\n [globalVars.stickyVerticalBottomOffset]: bottomOffset,\n };\n\n const panelHeaderId = useUniqueId('split-panel-header');\n\n const wrappedHeader = (\n <div className={clsx(styles.header, isToolbar && styles['with-toolbar'])} style={appLayoutMaxWidth}>\n <h2 className={clsx(styles['header-text'], testUtilStyles['header-text'])} id={panelHeaderId}>\n {header}\n </h2>\n <div className={styles['header-actions']}>\n {!hidePreferencesButton && isOpen && (\n <>\n <InternalButton\n className={testUtilStyles['preferences-button']}\n iconName=\"settings\"\n variant=\"icon\"\n onClick={() => setPreferencesOpen(true)}\n formAction=\"none\"\n ariaLabel={i18nStrings.preferencesTitle}\n ref={refs.preferences}\n />\n <span className={styles.divider} />\n </>\n )}\n\n {isOpen ? (\n <InternalButton\n className={testUtilStyles['close-button']}\n iconName={\n isRefresh && closeBehavior === 'collapse' ? (position === 'side' ? 'angle-right' : 'angle-down') : 'close'\n }\n variant=\"icon\"\n onClick={onToggle}\n formAction=\"none\"\n ariaLabel={i18nStrings.closeButtonAriaLabel}\n ariaExpanded={isOpen}\n />\n ) : position === 'side' || closeBehavior === 'hide' ? null : (\n <InternalButton\n className={testUtilStyles['open-button']}\n iconName=\"angle-up\"\n variant=\"icon\"\n formAction=\"none\"\n ariaLabel={i18nStrings.openButtonAriaLabel}\n ref={refs.toggle}\n ariaExpanded={isOpen}\n />\n )}\n </div>\n </div>\n );\n\n const resizeHandle = (\n <PanelResizeHandle\n ref={refs.slider}\n className={testUtilStyles.slider}\n ariaLabel={i18nStrings.resizeHandleAriaLabel}\n // Allows us to use the logical left/right keys to move the slider left/right,\n // but match aria keyboard behavior of using left/right to decrease/increase\n // the slider value.\n ariaValuenow={position === 'bottom' ? relativeSize : 100 - relativeSize}\n position={position}\n onKeyDown={onKeyDown}\n onPointerDown={onSliderPointerDown}\n />\n );\n\n /*\n This effect forces the browser to recalculate the layout\n whenever the split panel might have moved.\n\n This is needed as a workaround for a bug in Safari, which does\n not automatically calculate the new position of the split panel\n _content_ when the split panel moves.\n */\n useLayoutEffect(() => {\n const root = splitPanelRefObject.current;\n\n if (root) {\n const property = 'transform';\n const temporaryValue = 'translateZ(0)';\n\n const valueBefore = root.style[property];\n root.style[property] = temporaryValue;\n\n // This line forces the browser to recalculate the layout\n void root.offsetHeight;\n\n root.style[property] = valueBefore;\n }\n }, [rightOffset, __internalRootRef]);\n\n const mergedRef = useMergeRefs(splitPanelRefObject, __internalRootRef);\n\n if (closeBehavior === 'hide' && !isOpen && (animationDisabled || !isRefresh)) {\n return <></>;\n }\n\n /**\n * The AppLayout factor moved the circular buttons out of the\n * SplitPanel and into the Tools component. This conditional\n * is still needed for the early return to prevent execution\n * of the following code.\n */\n if (isRefresh && !isToolbar && !isOpen && position === 'side') {\n return <></>;\n }\n\n return (\n <>\n {position === 'side' && (\n <SplitPanelContentSide\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n openButtonAriaLabel={openButtonAriaLabel}\n toggleRef={refs.toggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n closeBehavior={closeBehavior}\n >\n {children}\n </SplitPanelContentSide>\n )}\n\n {position === 'bottom' && (\n <SplitPanelContentBottom\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n appLayoutMaxWidth={appLayoutMaxWidth}\n closeBehavior={closeBehavior}\n >\n {children}\n </SplitPanelContentBottom>\n )}\n {isPreferencesOpen && (\n <PreferencesModal\n visible={true}\n preferences={{ position }}\n disabledSidePosition={position === 'bottom' && isForcedPosition}\n isRefresh={isRefresh}\n i18nStrings={{\n header: i18nStrings.preferencesTitle,\n confirm: i18nStrings.preferencesConfirm,\n cancel: i18nStrings.preferencesCancel,\n positionLabel: i18nStrings.preferencesPositionLabel,\n positionDescription: i18nStrings.preferencesPositionDescription,\n positionBottom: i18nStrings.preferencesPositionBottom,\n positionSide: i18nStrings.preferencesPositionSide,\n }}\n onConfirm={preferences => {\n onPreferencesChange({ ...preferences });\n setPreferencesOpen(false);\n }}\n onDismiss={() => {\n setPreferencesOpen(false);\n }}\n />\n )}\n </>\n );\n}\n\nexport const createWidgetizedSplitPanel = createWidgetizedComponent(SplitPanelImplementation);\n"]}
|
package/split-panel/side.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ButtonProps } from '../button/interfaces';
|
|
3
|
-
import { SplitPanelContentProps } from './interfaces';
|
|
3
|
+
import { SplitPanelContentProps, SplitPanelProps } from './interfaces';
|
|
4
4
|
interface SplitPanelContentSideProps extends SplitPanelContentProps {
|
|
5
|
+
closeBehavior: SplitPanelProps['closeBehavior'];
|
|
5
6
|
openButtonAriaLabel?: string;
|
|
6
7
|
toggleRef: React.RefObject<ButtonProps.Ref>;
|
|
7
8
|
}
|
|
8
|
-
export declare function SplitPanelContentSide({ style, baseProps, splitPanelRef, toggleRef, header, children, resizeHandle, isOpen, cappedSize, openButtonAriaLabel, panelHeaderId, onToggle, }: SplitPanelContentSideProps): JSX.Element;
|
|
9
|
+
export declare function SplitPanelContentSide({ style, baseProps, splitPanelRef, toggleRef, header, children, resizeHandle, isOpen, cappedSize, openButtonAriaLabel, panelHeaderId, onToggle, closeBehavior, }: SplitPanelContentSideProps): JSX.Element;
|
|
9
10
|
export {};
|
|
10
11
|
//# sourceMappingURL=side.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side.d.ts","sourceRoot":"","sources":["../../../src/split-panel/side.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAInD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"side.d.ts","sourceRoot":"","sources":["../../../src/split-panel/side.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAInD,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAMvE,UAAU,0BAA2B,SAAQ,sBAAsB;IACjE,aAAa,EAAE,eAAe,CAAC,eAAe,CAAC,CAAC;IAChD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;CAC7C;AAED,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,SAAS,EACT,aAAa,EACb,SAAS,EACT,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,UAAU,EACV,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,aAAa,GACd,EAAE,0BAA0B,eAyD5B"}
|
package/split-panel/side.js
CHANGED
|
@@ -9,12 +9,13 @@ import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
|
9
9
|
import sharedStyles from '../app-layout/resize/styles.css.js';
|
|
10
10
|
import styles from './styles.css.js';
|
|
11
11
|
import testUtilStyles from './test-classes/styles.css.js';
|
|
12
|
-
export function SplitPanelContentSide({ style, baseProps, splitPanelRef, toggleRef, header, children, resizeHandle, isOpen, cappedSize, openButtonAriaLabel, panelHeaderId, onToggle, }) {
|
|
12
|
+
export function SplitPanelContentSide({ style, baseProps, splitPanelRef, toggleRef, header, children, resizeHandle, isOpen, cappedSize, openButtonAriaLabel, panelHeaderId, onToggle, closeBehavior, }) {
|
|
13
13
|
const { topOffset, bottomOffset, animationDisabled } = useSplitPanelContext();
|
|
14
14
|
const isRefresh = useVisualRefresh();
|
|
15
15
|
const isToolbar = useAppLayoutToolbarDesignEnabled();
|
|
16
|
+
const disableAnimation = animationDisabled || (closeBehavior === 'hide' && !isOpen);
|
|
16
17
|
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles.drawer, styles['position-side'], testUtilStyles.root, {
|
|
17
|
-
[sharedStyles['with-motion-horizontal']]: !
|
|
18
|
+
[sharedStyles['with-motion-horizontal']]: !disableAnimation,
|
|
18
19
|
[testUtilStyles['open-position-side']]: isOpen,
|
|
19
20
|
[styles['drawer-closed']]: !isOpen,
|
|
20
21
|
[styles['with-toolbar']]: isToolbar,
|
|
@@ -24,7 +25,7 @@ export function SplitPanelContentSide({ style, baseProps, splitPanelRef, toggleR
|
|
|
24
25
|
top: topOffset,
|
|
25
26
|
bottom: bottomOffset,
|
|
26
27
|
}, onClick: () => !isOpen && onToggle(), "aria-labelledby": panelHeaderId, role: "region" },
|
|
27
|
-
isOpen ? (React.createElement("div", { className: clsx(styles['slider-wrapper-side'], isToolbar && styles['with-toolbar']) }, resizeHandle)) : (React.createElement(InternalButton, { className: clsx(testUtilStyles['open-button'], styles['open-button-side']), iconName: "angle-left", variant: "icon", formAction: "none", ariaLabel: openButtonAriaLabel, ariaExpanded: isOpen,
|
|
28
|
+
isOpen ? (React.createElement("div", { className: clsx(styles['slider-wrapper-side'], isToolbar && styles['with-toolbar']) }, resizeHandle)) : closeBehavior === 'hide' ? null : (React.createElement(InternalButton, { className: clsx(testUtilStyles['open-button'], styles['open-button-side']), iconName: "angle-left", variant: "icon", formAction: "none", ariaLabel: openButtonAriaLabel, ariaExpanded: isOpen,
|
|
28
29
|
//toggleRef should only be assigned when there is no other trigger-buttons
|
|
29
30
|
ref: isRefresh || isToolbar ? null : toggleRef })),
|
|
30
31
|
React.createElement("div", { className: clsx(styles['content-side'], isToolbar && styles['with-toolbar']), "aria-hidden": !isOpen, style: { width: isToolbar ? cappedSize : '0px' } },
|
package/split-panel/side.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side.js","sourceRoot":"","sources":["../../../src/split-panel/side.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AAErF,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE,OAAO,YAAY,MAAM,oCAAoC,CAAC;AAC9D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"side.js","sourceRoot":"","sources":["../../../src/split-panel/side.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AAErF,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MA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AAC,IAAG,QAAQ,CAAO,CACjE,CACF,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { useAppLayoutToolbarDesignEnabled } from '../app-layout/utils/feature-flags';\nimport { ButtonProps } from '../button/interfaces';\nimport InternalButton from '../button/internal';\nimport { useSplitPanelContext } from '../internal/context/split-panel-context';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { SplitPanelContentProps, SplitPanelProps } from './interfaces';\n\nimport sharedStyles from '../app-layout/resize/styles.css.js';\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\ninterface SplitPanelContentSideProps extends SplitPanelContentProps {\n closeBehavior: SplitPanelProps['closeBehavior'];\n openButtonAriaLabel?: string;\n toggleRef: React.RefObject<ButtonProps.Ref>;\n}\n\nexport function SplitPanelContentSide({\n style,\n baseProps,\n splitPanelRef,\n toggleRef,\n header,\n children,\n resizeHandle,\n isOpen,\n cappedSize,\n openButtonAriaLabel,\n panelHeaderId,\n onToggle,\n closeBehavior,\n}: SplitPanelContentSideProps) {\n const { topOffset, bottomOffset, animationDisabled } = useSplitPanelContext();\n const isRefresh = useVisualRefresh();\n const isToolbar = useAppLayoutToolbarDesignEnabled();\n const disableAnimation = animationDisabled || (closeBehavior === 'hide' && !isOpen);\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.drawer, styles['position-side'], testUtilStyles.root, {\n [sharedStyles['with-motion-horizontal']]: !disableAnimation,\n [testUtilStyles['open-position-side']]: isOpen,\n [styles['drawer-closed']]: !isOpen,\n [styles['with-toolbar']]: isToolbar,\n [styles.refresh]: isRefresh,\n })}\n style={{\n width: isOpen ? cappedSize : isRefresh ? '0px' : undefined,\n maxWidth: isRefresh ? '100%' : undefined,\n ...style,\n }}\n ref={splitPanelRef}\n >\n <div\n className={styles['drawer-content-side']}\n style={{\n top: topOffset,\n bottom: bottomOffset,\n }}\n onClick={() => !isOpen && onToggle()}\n aria-labelledby={panelHeaderId}\n role=\"region\"\n >\n {isOpen ? (\n <div className={clsx(styles['slider-wrapper-side'], isToolbar && styles['with-toolbar'])}>{resizeHandle}</div>\n ) : closeBehavior === 'hide' ? null : (\n <InternalButton\n className={clsx(testUtilStyles['open-button'], styles['open-button-side'])}\n iconName=\"angle-left\"\n variant=\"icon\"\n formAction=\"none\"\n ariaLabel={openButtonAriaLabel}\n ariaExpanded={isOpen}\n //toggleRef should only be assigned when there is no other trigger-buttons\n ref={isRefresh || isToolbar ? null : toggleRef}\n />\n )}\n <div\n className={clsx(styles['content-side'], isToolbar && styles['with-toolbar'])}\n aria-hidden={!isOpen}\n style={{ width: isToolbar ? cappedSize : '0px' }} // to prevent text wrapping upon entering\n >\n <div className={styles['pane-header-wrapper-side']}>{header}</div>\n <div className={styles['pane-content-wrapper-side']}>{children}</div>\n </div>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"drawer": "
|
|
5
|
-
"drawer-closed": "awsui_drawer-
|
|
6
|
-
"refresh": "
|
|
7
|
-
"drawer-content-side": "awsui_drawer-content-
|
|
8
|
-
"drawer-content-bottom": "awsui_drawer-content-
|
|
9
|
-
"position-bottom": "awsui_position-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"slider-wrapper-
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"drawer-
|
|
18
|
-
"content-
|
|
19
|
-
"
|
|
20
|
-
"pane-bottom-
|
|
21
|
-
"pane-bottom-content-
|
|
22
|
-
"
|
|
23
|
-
"content-
|
|
24
|
-
"
|
|
25
|
-
"pane-
|
|
26
|
-
"
|
|
27
|
-
"header
|
|
28
|
-
"header-
|
|
29
|
-
"
|
|
4
|
+
"drawer": "awsui_drawer_1r9lg_grsjj_153",
|
|
5
|
+
"drawer-closed": "awsui_drawer-closed_1r9lg_grsjj_190",
|
|
6
|
+
"refresh": "awsui_refresh_1r9lg_grsjj_190",
|
|
7
|
+
"drawer-content-side": "awsui_drawer-content-side_1r9lg_grsjj_195",
|
|
8
|
+
"drawer-content-bottom": "awsui_drawer-content-bottom_1r9lg_grsjj_211",
|
|
9
|
+
"position-bottom": "awsui_position-bottom_1r9lg_grsjj_218",
|
|
10
|
+
"hidden": "awsui_hidden_1r9lg_grsjj_226",
|
|
11
|
+
"position-side": "awsui_position-side_1r9lg_grsjj_247",
|
|
12
|
+
"with-toolbar": "awsui_with-toolbar_1r9lg_grsjj_252",
|
|
13
|
+
"slider-wrapper-bottom": "awsui_slider-wrapper-bottom_1r9lg_grsjj_256",
|
|
14
|
+
"slider-wrapper-side": "awsui_slider-wrapper-side_1r9lg_grsjj_267",
|
|
15
|
+
"open-button-side": "awsui_open-button-side_1r9lg_grsjj_281",
|
|
16
|
+
"pane-header-wrapper-bottom": "awsui_pane-header-wrapper-bottom_1r9lg_grsjj_290",
|
|
17
|
+
"drawer-mobile": "awsui_drawer-mobile_1r9lg_grsjj_300",
|
|
18
|
+
"drawer-disable-content-paddings": "awsui_drawer-disable-content-paddings_1r9lg_grsjj_304",
|
|
19
|
+
"content-bottom": "awsui_content-bottom_1r9lg_grsjj_316",
|
|
20
|
+
"pane-bottom-center-align": "awsui_pane-bottom-center-align_1r9lg_grsjj_335",
|
|
21
|
+
"pane-bottom-content-nav-padding": "awsui_pane-bottom-content-nav-padding_1r9lg_grsjj_340",
|
|
22
|
+
"pane-bottom-content-tools-padding": "awsui_pane-bottom-content-tools-padding_1r9lg_grsjj_344",
|
|
23
|
+
"content-bottom-max-width": "awsui_content-bottom-max-width_1r9lg_grsjj_348",
|
|
24
|
+
"content-side": "awsui_content-side_1r9lg_grsjj_353",
|
|
25
|
+
"pane-header-wrapper-side": "awsui_pane-header-wrapper-side_1r9lg_grsjj_365",
|
|
26
|
+
"pane-content-wrapper-side": "awsui_pane-content-wrapper-side_1r9lg_grsjj_374",
|
|
27
|
+
"header": "awsui_header_1r9lg_grsjj_385",
|
|
28
|
+
"header-text": "awsui_header-text_1r9lg_grsjj_398",
|
|
29
|
+
"header-actions": "awsui_header-actions_1r9lg_grsjj_411",
|
|
30
|
+
"divider": "awsui_divider_1r9lg_grsjj_419"
|
|
30
31
|
};
|
|
31
32
|
|