@cloudscape-design/components-themeable 3.0.1096 → 3.0.1097
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/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/template/app-layout/runtime-drawer/index.d.ts +3 -0
- package/lib/internal/template/app-layout/runtime-drawer/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/runtime-drawer/index.js +19 -2
- package/lib/internal/template/app-layout/runtime-drawer/index.js.map +1 -1
- package/lib/internal/template/app-layout/utils/use-ai-drawer.d.ts +2 -0
- package/lib/internal/template/app-layout/utils/use-ai-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js +49 -11
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.js +52 -9
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/interfaces.d.ts +4 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/interfaces.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/interfaces.js.map +1 -1
- package/lib/internal/template/button-group/icon-button-item.d.ts +2 -2
- package/lib/internal/template/button-group/icon-button-item.d.ts.map +1 -1
- package/lib/internal/template/button-group/icon-button-item.js +1 -1
- package/lib/internal/template/button-group/icon-button-item.js.map +1 -1
- package/lib/internal/template/button-group/interfaces.d.ts +6 -0
- package/lib/internal/template/button-group/interfaces.d.ts.map +1 -1
- package/lib/internal/template/button-group/interfaces.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/internal/plugins/controllers/drawers.d.ts +3 -0
- package/lib/internal/template/internal/plugins/controllers/drawers.d.ts.map +1 -1
- package/lib/internal/template/internal/plugins/controllers/drawers.js +0 -2
- package/lib/internal/template/internal/plugins/controllers/drawers.js.map +1 -1
- package/lib/internal/template/internal/plugins/widget/interfaces.d.ts +3 -0
- package/lib/internal/template/internal/plugins/widget/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/plugins/widget/interfaces.js.map +1 -1
- package/lib/internal/template/select/parts/filter.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ButtonGroupProps } from '../../button-group/interfaces';
|
|
1
2
|
import { NonCancelableEventHandler } from '../../internal/events';
|
|
2
3
|
import { DrawerConfig as RuntimeDrawerConfig, DrawerStateChangeParams } from '../../internal/plugins/controllers/drawers';
|
|
3
4
|
import { DrawerPayload as RuntimeAiDrawerConfig } from '../../internal/plugins/widget/interfaces';
|
|
@@ -13,10 +14,12 @@ export interface DrawersLayout {
|
|
|
13
14
|
export declare const mapRuntimeConfigToDrawer: (runtimeConfig: RuntimeDrawerConfig) => AppLayoutProps.Drawer & {
|
|
14
15
|
orderPriority?: number;
|
|
15
16
|
onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;
|
|
17
|
+
headerActions?: ReadonlyArray<ButtonGroupProps.Item>;
|
|
16
18
|
};
|
|
17
19
|
export declare const mapRuntimeConfigToAiDrawer: (runtimeConfig: RuntimeAiDrawerConfig) => AppLayoutProps.Drawer & {
|
|
18
20
|
orderPriority?: number;
|
|
19
21
|
onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;
|
|
22
|
+
headerActions?: ReadonlyArray<ButtonGroupProps.Item>;
|
|
20
23
|
};
|
|
21
24
|
export declare function convertRuntimeDrawers(localDrawers: Array<RuntimeDrawerConfig>, globalDrawers: Array<RuntimeDrawerConfig>): DrawersLayout;
|
|
22
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/runtime-drawer/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/runtime-drawer/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAA0B,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EACL,YAAY,IAAI,mBAAmB,EACnC,uBAAuB,EACxB,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAK/C,MAAM,WAAW,aAAc,SAAQ,cAAc,CAAC,MAAM;IAC1D,QAAQ,CAAC,EAAE,yBAAyB,CAAC,uBAAuB,CAAC,CAAC;CAC/D;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAC7B,WAAW,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAClC,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;CAClC;AA0ED,eAAO,MAAM,wBAAwB,kBACpB,mBAAmB,KACjC,eAAe,MAAM,GAAG;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,0BAA0B,uBAAuB,CAAC,CAAC;IAC9D,aAAa,CAAC,EAAE,cAAc,iBAAiB,IAAI,CAAC,CAAC;CA8BtD,CAAC;AAEF,eAAO,MAAM,0BAA0B,kBACtB,qBAAqB,KACnC,eAAe,MAAM,GAAG;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,0BAA0B,uBAAuB,CAAC,CAAC;IAC9D,aAAa,CAAC,EAAE,cAAc,iBAAiB,IAAI,CAAC,CAAC;CAqCtD,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,KAAK,CAAC,mBAAmB,CAAC,EACxC,aAAa,EAAE,KAAK,CAAC,mBAAmB,CAAC,GACxC,aAAa,CAQf"}
|
|
@@ -2,6 +2,7 @@ import { __rest } 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 React, { useContext, useEffect, useRef } from 'react';
|
|
5
|
+
import { warnOnce } from '@cloudscape-design/component-toolkit/internal';
|
|
5
6
|
import { fireNonCancelableEvent } from '../../internal/events';
|
|
6
7
|
import { sortByPriority } from '../../internal/plugins/helpers/utils';
|
|
7
8
|
import { ActiveDrawersContext } from '../utils/visibility-context';
|
|
@@ -42,6 +43,22 @@ function RuntimeDrawerHeader({ mountHeader, unmountHeader }) {
|
|
|
42
43
|
}, []);
|
|
43
44
|
return React.createElement("div", { className: styles['runtime-header-wrapper'], ref: ref });
|
|
44
45
|
}
|
|
46
|
+
function checkForUnsupportedProps(headerActions) {
|
|
47
|
+
const unsupportedProps = new Set([
|
|
48
|
+
'iconSvg',
|
|
49
|
+
'popoverFeedback',
|
|
50
|
+
'pressedIconSvg',
|
|
51
|
+
'popoverFeedback',
|
|
52
|
+
'pressedPopoverFeedback',
|
|
53
|
+
]);
|
|
54
|
+
for (const item of headerActions) {
|
|
55
|
+
const unsupported = Object.keys(item).filter(key => unsupportedProps.has(key));
|
|
56
|
+
if (unsupported.length > 0) {
|
|
57
|
+
warnOnce('AppLayout', `The headerActions properties are not supported for runtime api: ${unsupported.join(' ')}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return headerActions;
|
|
61
|
+
}
|
|
45
62
|
export const mapRuntimeConfigToDrawer = (runtimeConfig) => {
|
|
46
63
|
var _a;
|
|
47
64
|
const { mountContent, unmountContent, trigger } = runtimeConfig, runtimeDrawer = __rest(runtimeConfig, ["mountContent", "unmountContent", "trigger"]);
|
|
@@ -52,7 +69,7 @@ export const mapRuntimeConfigToDrawer = (runtimeConfig) => {
|
|
|
52
69
|
React.createElement("span", { dangerouslySetInnerHTML: { __html: trigger.iconSvg } })),
|
|
53
70
|
})) : undefined, content: (React.createElement(RuntimeDrawerWrapper, { key: runtimeDrawer.id, mountContent: mountContent, unmountContent: unmountContent, id: runtimeDrawer.id })), onResize: event => {
|
|
54
71
|
fireNonCancelableEvent(runtimeDrawer.onResize, { size: event.detail.size, id: runtimeDrawer.id });
|
|
55
|
-
} });
|
|
72
|
+
}, headerActions: runtimeDrawer.headerActions ? checkForUnsupportedProps(runtimeDrawer.headerActions) : undefined });
|
|
56
73
|
};
|
|
57
74
|
export const mapRuntimeConfigToAiDrawer = (runtimeConfig) => {
|
|
58
75
|
var _a;
|
|
@@ -70,7 +87,7 @@ export const mapRuntimeConfigToAiDrawer = (runtimeConfig) => {
|
|
|
70
87
|
header: (React.createElement(RuntimeDrawerHeader, { mountHeader: runtimeDrawer.mountHeader, unmountHeader: runtimeDrawer.unmountHeader })),
|
|
71
88
|
})), { onResize: event => {
|
|
72
89
|
fireNonCancelableEvent(runtimeDrawer.onResize, { size: event.detail.size, id: runtimeDrawer.id });
|
|
73
|
-
} });
|
|
90
|
+
}, headerActions: runtimeDrawer.headerActions ? checkForUnsupportedProps(runtimeDrawer.headerActions) : undefined });
|
|
74
91
|
};
|
|
75
92
|
export function convertRuntimeDrawers(localDrawers, globalDrawers) {
|
|
76
93
|
const converted = localDrawers.map(mapRuntimeConfigToDrawer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/app-layout/runtime-drawer/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,E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,MAAM,EAAE,CACN,oBAAC,mBAAmB,IAAC,WAAW,EAAE,aAAa,CAAC,WAAW,EAAE,aAAa,EAAE,aAAa,CAAC,aAAa,GAAI,CAC5G;KACF,CAAC,KACF,QAAQ,EAAE,KAAK,CAAC,EAAE;YAChB,sBAAsB,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC;QACpG,CAAC,IACD;AACJ,CAAC,CAAC;AAEF,MAAM,UAAU,qBAAqB,CACnC,YAAwC,EACxC,aAAyC;IAEzC,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;IACzC,OAAO;QACL,MAAM,EAAE,cAAc,CAAC,aAAa,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;QACnE,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,WAAC,OAAA,CAAC,MAAA,IAAI,CAAC,aAAa,mCAAI,CAAC,CAAC,GAAG,CAAC,CAAA,EAAA,CAAC;QACjE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,WAAC,OAAA,CAAC,MAAA,IAAI,CAAC,aAAa,mCAAI,CAAC,CAAC,IAAI,CAAC,CAAA,EAAA,CAAC;KAClE,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useEffect, useRef } from 'react';\n\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../../internal/events';\nimport {\n DrawerConfig as RuntimeDrawerConfig,\n DrawerStateChangeParams,\n} from '../../internal/plugins/controllers/drawers';\nimport { sortByPriority } from '../../internal/plugins/helpers/utils';\nimport { DrawerPayload as RuntimeAiDrawerConfig } from '../../internal/plugins/widget/interfaces';\nimport { AppLayoutProps } from '../interfaces';\nimport { ActiveDrawersContext } from '../utils/visibility-context';\n\nimport styles from './styles.css.js';\n\nexport interface RuntimeDrawer extends AppLayoutProps.Drawer {\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n}\n\nexport interface DrawersLayout {\n global: Array<RuntimeDrawer>;\n localBefore: Array<RuntimeDrawer>;\n localAfter: Array<RuntimeDrawer>;\n}\n\ntype VisibilityCallback = (isVisible: boolean) => void;\n\ninterface RuntimeContentWrapperProps {\n id?: string;\n mountContent: RuntimeDrawerConfig['mountContent'];\n unmountContent: RuntimeDrawerConfig['unmountContent'];\n}\n\nfunction RuntimeDrawerWrapper({ mountContent, unmountContent, id }: RuntimeContentWrapperProps) {\n const ref = useRef<HTMLDivElement>(null);\n const visibilityChangeCallback = useRef<VisibilityCallback | null>(null);\n const activeDrawersIds = useContext(ActiveDrawersContext);\n const isVisible = !!id && activeDrawersIds.includes(id);\n\n useEffect(() => {\n const container = ref.current!;\n mountContent(container, {\n onVisibilityChange: cb => {\n visibilityChangeCallback.current = cb;\n },\n });\n return () => {\n unmountContent(container);\n visibilityChangeCallback.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n visibilityChangeCallback.current?.(isVisible);\n }, [isVisible]);\n\n return <div ref={ref} className={styles['runtime-content-wrapper']} data-awsui-runtime-drawer-root-id={id}></div>;\n}\n\ninterface RuntimeContentHeaderProps {\n mountHeader: (container: HTMLElement) => void;\n unmountHeader?: (container: HTMLElement) => void;\n}\n\nfunction RuntimeDrawerHeader({ mountHeader, unmountHeader }: RuntimeContentHeaderProps) {\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const container = ref.current!;\n mountHeader?.(container);\n return () => {\n unmountHeader?.(container);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return <div className={styles['runtime-header-wrapper']} ref={ref} />;\n}\n\nexport const mapRuntimeConfigToDrawer = (\n runtimeConfig: RuntimeDrawerConfig\n): AppLayoutProps.Drawer & {\n orderPriority?: number;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n} => {\n const { mountContent, unmountContent, trigger, ...runtimeDrawer } = runtimeConfig;\n\n return {\n ...runtimeDrawer,\n ariaLabels: { drawerName: runtimeDrawer.ariaLabels.content ?? '', ...runtimeDrawer.ariaLabels },\n trigger: trigger\n ? {\n ...(trigger.iconSvg && {\n iconSvg: (\n // eslint-disable-next-line react/no-danger\n <span dangerouslySetInnerHTML={{ __html: trigger.iconSvg }} />\n ),\n }),\n }\n : undefined,\n content: (\n <RuntimeDrawerWrapper\n key={runtimeDrawer.id}\n mountContent={mountContent}\n unmountContent={unmountContent}\n id={runtimeDrawer.id}\n />\n ),\n onResize: event => {\n fireNonCancelableEvent(runtimeDrawer.onResize, { size: event.detail.size, id: runtimeDrawer.id });\n },\n };\n};\n\nexport const mapRuntimeConfigToAiDrawer = (\n runtimeConfig: RuntimeAiDrawerConfig\n): AppLayoutProps.Drawer & {\n orderPriority?: number;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n} => {\n const { mountContent, unmountContent, trigger, ...runtimeDrawer } = runtimeConfig;\n\n return {\n ...runtimeDrawer,\n ariaLabels: { drawerName: runtimeDrawer.ariaLabels.content ?? '', ...runtimeDrawer.ariaLabels },\n trigger: trigger\n ? {\n customIcon: trigger?.customIcon ? (\n // eslint-disable-next-line react/no-danger\n <span style={{ lineHeight: 0 }} dangerouslySetInnerHTML={{ __html: trigger.customIcon }} />\n ) : undefined,\n iconSvg: trigger.iconSvg ? (\n // eslint-disable-next-line react/no-danger\n <span dangerouslySetInnerHTML={{ __html: trigger.iconSvg }} />\n ) : undefined,\n }\n : undefined,\n content: (\n <RuntimeDrawerWrapper\n key={runtimeDrawer.id}\n mountContent={mountContent}\n unmountContent={unmountContent}\n id={runtimeDrawer.id}\n />\n ),\n ...(runtimeDrawer.mountHeader && {\n header: (\n <RuntimeDrawerHeader mountHeader={runtimeDrawer.mountHeader} unmountHeader={runtimeDrawer.unmountHeader} />\n ),\n }),\n onResize: event => {\n fireNonCancelableEvent(runtimeDrawer.onResize, { size: event.detail.size, id: runtimeDrawer.id });\n },\n };\n};\n\nexport function convertRuntimeDrawers(\n localDrawers: Array<RuntimeDrawerConfig>,\n globalDrawers: Array<RuntimeDrawerConfig>\n): DrawersLayout {\n const converted = localDrawers.map(mapRuntimeConfigToDrawer);\n const sorted = sortByPriority(converted);\n return {\n global: sortByPriority(globalDrawers.map(mapRuntimeConfigToDrawer)),\n localBefore: sorted.filter(item => (item.orderPriority ?? 0) > 0),\n localAfter: sorted.filter(item => (item.orderPriority ?? 0) <= 0),\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/app-layout/runtime-drawer/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAGzE,OAAO,EAAE,sBAAsB,EAA6B,MAAM,uBAAuB,CAAC;AAK1F,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAGtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAoBrC,SAAS,oBAAoB,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,EAA8B;IAC5F,MAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IACzC,MAAM,wBAAwB,GAAG,MAAM,CAA4B,IAAI,CAAC,CAAC;IACzE,MAAM,gBAAgB,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IAC1D,MAAM,SAAS,GAAG,CAAC,CAAC,EAAE,IAAI,gBAAgB,CAAC,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: Apache-2.0\nimport React, { useContext, useEffect, useRef } from 'react';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { ButtonGroupProps } from '../../button-group/interfaces';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../../internal/events';\nimport {\n DrawerConfig as RuntimeDrawerConfig,\n DrawerStateChangeParams,\n} from '../../internal/plugins/controllers/drawers';\nimport { sortByPriority } from '../../internal/plugins/helpers/utils';\nimport { DrawerPayload as RuntimeAiDrawerConfig } from '../../internal/plugins/widget/interfaces';\nimport { AppLayoutProps } from '../interfaces';\nimport { ActiveDrawersContext } from '../utils/visibility-context';\n\nimport styles from './styles.css.js';\n\nexport interface RuntimeDrawer extends AppLayoutProps.Drawer {\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n}\n\nexport interface DrawersLayout {\n global: Array<RuntimeDrawer>;\n localBefore: Array<RuntimeDrawer>;\n localAfter: Array<RuntimeDrawer>;\n}\n\ntype VisibilityCallback = (isVisible: boolean) => void;\n\ninterface RuntimeContentWrapperProps {\n id?: string;\n mountContent: RuntimeDrawerConfig['mountContent'];\n unmountContent: RuntimeDrawerConfig['unmountContent'];\n}\n\nfunction RuntimeDrawerWrapper({ mountContent, unmountContent, id }: RuntimeContentWrapperProps) {\n const ref = useRef<HTMLDivElement>(null);\n const visibilityChangeCallback = useRef<VisibilityCallback | null>(null);\n const activeDrawersIds = useContext(ActiveDrawersContext);\n const isVisible = !!id && activeDrawersIds.includes(id);\n\n useEffect(() => {\n const container = ref.current!;\n mountContent(container, {\n onVisibilityChange: cb => {\n visibilityChangeCallback.current = cb;\n },\n });\n return () => {\n unmountContent(container);\n visibilityChangeCallback.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n visibilityChangeCallback.current?.(isVisible);\n }, [isVisible]);\n\n return <div ref={ref} className={styles['runtime-content-wrapper']} data-awsui-runtime-drawer-root-id={id}></div>;\n}\n\ninterface RuntimeContentHeaderProps {\n mountHeader: (container: HTMLElement) => void;\n unmountHeader?: (container: HTMLElement) => void;\n}\n\nfunction RuntimeDrawerHeader({ mountHeader, unmountHeader }: RuntimeContentHeaderProps) {\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const container = ref.current!;\n mountHeader?.(container);\n return () => {\n unmountHeader?.(container);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return <div className={styles['runtime-header-wrapper']} ref={ref} />;\n}\n\nfunction checkForUnsupportedProps(headerActions: ReadonlyArray<ButtonGroupProps.Item>) {\n const unsupportedProps = new Set([\n 'iconSvg',\n 'popoverFeedback',\n 'pressedIconSvg',\n 'popoverFeedback',\n 'pressedPopoverFeedback',\n ]);\n for (const item of headerActions) {\n const unsupported = Object.keys(item).filter(key => unsupportedProps.has(key));\n if (unsupported.length > 0) {\n warnOnce('AppLayout', `The headerActions properties are not supported for runtime api: ${unsupported.join(' ')}`);\n }\n }\n return headerActions;\n}\n\nexport const mapRuntimeConfigToDrawer = (\n runtimeConfig: RuntimeDrawerConfig\n): AppLayoutProps.Drawer & {\n orderPriority?: number;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n headerActions?: ReadonlyArray<ButtonGroupProps.Item>;\n} => {\n const { mountContent, unmountContent, trigger, ...runtimeDrawer } = runtimeConfig;\n\n return {\n ...runtimeDrawer,\n ariaLabels: { drawerName: runtimeDrawer.ariaLabels.content ?? '', ...runtimeDrawer.ariaLabels },\n trigger: trigger\n ? {\n ...(trigger.iconSvg && {\n iconSvg: (\n // eslint-disable-next-line react/no-danger\n <span dangerouslySetInnerHTML={{ __html: trigger.iconSvg }} />\n ),\n }),\n }\n : undefined,\n content: (\n <RuntimeDrawerWrapper\n key={runtimeDrawer.id}\n mountContent={mountContent}\n unmountContent={unmountContent}\n id={runtimeDrawer.id}\n />\n ),\n onResize: event => {\n fireNonCancelableEvent(runtimeDrawer.onResize, { size: event.detail.size, id: runtimeDrawer.id });\n },\n headerActions: runtimeDrawer.headerActions ? checkForUnsupportedProps(runtimeDrawer.headerActions) : undefined,\n };\n};\n\nexport const mapRuntimeConfigToAiDrawer = (\n runtimeConfig: RuntimeAiDrawerConfig\n): AppLayoutProps.Drawer & {\n orderPriority?: number;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n headerActions?: ReadonlyArray<ButtonGroupProps.Item>;\n} => {\n const { mountContent, unmountContent, trigger, ...runtimeDrawer } = runtimeConfig;\n\n return {\n ...runtimeDrawer,\n ariaLabels: { drawerName: runtimeDrawer.ariaLabels.content ?? '', ...runtimeDrawer.ariaLabels },\n trigger: trigger\n ? {\n customIcon: trigger?.customIcon ? (\n // eslint-disable-next-line react/no-danger\n <span style={{ lineHeight: 0 }} dangerouslySetInnerHTML={{ __html: trigger.customIcon }} />\n ) : undefined,\n iconSvg: trigger.iconSvg ? (\n // eslint-disable-next-line react/no-danger\n <span dangerouslySetInnerHTML={{ __html: trigger.iconSvg }} />\n ) : undefined,\n }\n : undefined,\n content: (\n <RuntimeDrawerWrapper\n key={runtimeDrawer.id}\n mountContent={mountContent}\n unmountContent={unmountContent}\n id={runtimeDrawer.id}\n />\n ),\n ...(runtimeDrawer.mountHeader && {\n header: (\n <RuntimeDrawerHeader mountHeader={runtimeDrawer.mountHeader} unmountHeader={runtimeDrawer.unmountHeader} />\n ),\n }),\n onResize: event => {\n fireNonCancelableEvent(runtimeDrawer.onResize, { size: event.detail.size, id: runtimeDrawer.id });\n },\n headerActions: runtimeDrawer.headerActions ? checkForUnsupportedProps(runtimeDrawer.headerActions) : undefined,\n };\n};\n\nexport function convertRuntimeDrawers(\n localDrawers: Array<RuntimeDrawerConfig>,\n globalDrawers: Array<RuntimeDrawerConfig>\n): DrawersLayout {\n const converted = localDrawers.map(mapRuntimeConfigToDrawer);\n const sorted = sortByPriority(converted);\n return {\n global: sortByPriority(globalDrawers.map(mapRuntimeConfigToDrawer)),\n localBefore: sorted.filter(item => (item.orderPriority ?? 0) > 0),\n localAfter: sorted.filter(item => (item.orderPriority ?? 0) <= 0),\n };\n}\n"]}
|
|
@@ -12,11 +12,13 @@ export declare function useAiDrawer({ isEnabled, onAiDrawerFocus, expandedDrawer
|
|
|
12
12
|
aiDrawer: (import("..").AppLayoutProps.Drawer & {
|
|
13
13
|
orderPriority?: number | undefined;
|
|
14
14
|
onToggle?: import("../../internal/events").NonCancelableEventHandler<import("../../internal/plugins/controllers/drawers").DrawerStateChangeParams> | undefined;
|
|
15
|
+
headerActions?: readonly import("../..").ButtonGroupProps.Item[] | undefined;
|
|
15
16
|
}) | null;
|
|
16
17
|
onActiveAiDrawerChange: (newDrawerId: string | null, { initiatedByUserAction }?: OnChangeParams) => void;
|
|
17
18
|
activeAiDrawer: (import("..").AppLayoutProps.Drawer & {
|
|
18
19
|
orderPriority?: number | undefined;
|
|
19
20
|
onToggle?: import("../../internal/events").NonCancelableEventHandler<import("../../internal/plugins/controllers/drawers").DrawerStateChangeParams> | undefined;
|
|
21
|
+
headerActions?: readonly import("../..").ButtonGroupProps.Item[] | undefined;
|
|
20
22
|
}) | null;
|
|
21
23
|
activeAiDrawerId: string | null;
|
|
22
24
|
activeAiDrawerSize: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-ai-drawer.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-ai-drawer.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,cAAc;IAC7B,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAsED,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC,UAAU,eAAe;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACrD;AAED,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,EAAE,eAAe
|
|
1
|
+
{"version":3,"file":"use-ai-drawer.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-ai-drawer.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,cAAc;IAC7B,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAsED,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC,UAAU,eAAe;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACrD;AAED,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,EAAE,eAAe;;;;;;0CAUjG,MAAM,GAAG,IAAI,8BACC,cAAc;;;;;;;;;mCAPL,MAAM;EAwC7C"}
|
package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-ai-drawer.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"global-ai-drawer.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAOnE,UAAU,aAAa;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC;IAC5C,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,GAAG,CAAC;IAChB,oBAAoB,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACpD,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IACpD,sBAAsB,EAAE,SAAS,GAAG,CAAC,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC,CAAC;IACpG,oBAAoB,EAAE,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACrE,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACrD;AAED,UAAU,0CAA0C;IAClD,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,wBAAgB,qCAAqC,CAAC,EACpD,kBAAkB,EAClB,IAAI,EACJ,cAAc,EACd,aAAa,GACd,EAAE,0CAA0C,eAyL5C"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { useRef } from 'react';
|
|
4
4
|
import { Transition } from 'react-transition-group';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import
|
|
6
|
+
import ButtonGroup from '../../../button-group/internal';
|
|
7
7
|
import PanelResizeHandle from '../../../internal/components/panel-resize-handle';
|
|
8
8
|
import customCssProps from '../../../internal/generated/custom-css-properties';
|
|
9
9
|
import { usePrevious } from '../../../internal/hooks/use-previous';
|
|
@@ -13,7 +13,7 @@ import sharedStyles from '../../resize/styles.css.js';
|
|
|
13
13
|
import testutilStyles from '../../test-classes/styles.css.js';
|
|
14
14
|
import styles from './styles.css.js';
|
|
15
15
|
export function AppLayoutGlobalAiDrawerImplementation({ appLayoutInternals, show, activeAiDrawer, aiDrawerProps, }) {
|
|
16
|
-
var _a, _b;
|
|
16
|
+
var _a, _b, _c, _d;
|
|
17
17
|
const { activeAiDrawerSize, minAiDrawerSize, maxAiDrawerSize, ariaLabels, aiDrawerFocusControl, isMobile, drawersOpenQueue, onActiveAiDrawerChange, onActiveDrawerResize, expandedDrawerId, setExpandedDrawerId, } = aiDrawerProps;
|
|
18
18
|
const { verticalOffsets, placement } = appLayoutInternals;
|
|
19
19
|
const drawerRef = useRef(null);
|
|
@@ -42,9 +42,40 @@ export function AppLayoutGlobalAiDrawerImplementation({ appLayoutInternals, show
|
|
|
42
42
|
// (window is between mobile and desktop sizes). At this point, the drawer can't be
|
|
43
43
|
// resized in either direction, so we disable the resize handler
|
|
44
44
|
const isResizingDisabled = maxAiDrawerSize < activeAiDrawerSize;
|
|
45
|
+
let drawerActions = [
|
|
46
|
+
{
|
|
47
|
+
type: 'icon-button',
|
|
48
|
+
id: 'close',
|
|
49
|
+
iconName: isMobile ? 'close' : 'angle-left',
|
|
50
|
+
text: computedAriaLabels.closeButton,
|
|
51
|
+
analyticsAction: 'close',
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
if (!isMobile && (activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.isExpandable)) {
|
|
55
|
+
drawerActions = [
|
|
56
|
+
{
|
|
57
|
+
type: 'icon-button',
|
|
58
|
+
id: 'expand',
|
|
59
|
+
iconName: isExpanded ? 'shrink' : 'expand',
|
|
60
|
+
text: (_d = (_c = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _c === void 0 ? void 0 : _c.expandedModeButton) !== null && _d !== void 0 ? _d : '',
|
|
61
|
+
analyticsAction: isExpanded ? 'expand' : 'collapse',
|
|
62
|
+
},
|
|
63
|
+
...drawerActions,
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
if (activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.headerActions) {
|
|
67
|
+
drawerActions = [
|
|
68
|
+
{
|
|
69
|
+
type: 'group',
|
|
70
|
+
text: 'Actions',
|
|
71
|
+
items: activeAiDrawer.headerActions,
|
|
72
|
+
},
|
|
73
|
+
...drawerActions,
|
|
74
|
+
];
|
|
75
|
+
}
|
|
45
76
|
return (React.createElement(Transition, { nodeRef: drawerRef, in: show, appear: show, mountOnEnter: true, timeout: 250 }, drawerTransitionState => {
|
|
46
77
|
return (React.createElement(Transition, { nodeRef: drawerRef, in: isExpanded, timeout: 250 }, expandedTransitionState => {
|
|
47
|
-
var _a, _b, _c, _d, _e
|
|
78
|
+
var _a, _b, _c, _d, _e;
|
|
48
79
|
return (React.createElement("aside", { id: activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.id, "aria-hidden": !activeAiDrawer, "aria-label": computedAriaLabels.content, className: clsx(styles.drawer, styles['ai-drawer'], !animationDisabled && isExpanded && styles['with-expanded-motion'], {
|
|
49
80
|
[sharedStyles['with-motion-horizontal']]: !animationDisabled,
|
|
50
81
|
[testutilStyles['active-drawer']]: show,
|
|
@@ -66,15 +97,22 @@ export function AppLayoutGlobalAiDrawerImplementation({ appLayoutInternals, show
|
|
|
66
97
|
React.createElement("header", { className: styles['drawer-content-header'] },
|
|
67
98
|
React.createElement("div", { className: styles['drawer-content-header-content'] }, (_c = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.header) !== null && _c !== void 0 ? _c : React.createElement("div", null),
|
|
68
99
|
React.createElement("div", { className: styles['drawer-actions'] },
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
100
|
+
React.createElement(ButtonGroup, { dropdownExpandToViewport: false, variant: "icon", onItemClick: event => {
|
|
101
|
+
var _a;
|
|
102
|
+
switch (event.detail.id) {
|
|
103
|
+
case 'close':
|
|
104
|
+
onActiveAiDrawerChange === null || onActiveAiDrawerChange === void 0 ? void 0 : onActiveAiDrawerChange(null, { initiatedByUserAction: true });
|
|
105
|
+
break;
|
|
106
|
+
case 'expand':
|
|
107
|
+
setExpandedDrawerId(isExpanded ? null : activeDrawerId);
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
(_a = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.onHeaderActionClick) === null || _a === void 0 ? void 0 : _a.call(activeAiDrawer, event);
|
|
111
|
+
}
|
|
112
|
+
}, ariaLabel: "Left panel actions", items: drawerActions }))),
|
|
113
|
+
!isMobile && isExpanded && ((_d = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _d === void 0 ? void 0 : _d.exitExpandedModeButton) && (React.createElement("div", { className: styles['drawer-back-to-console-slot'] },
|
|
76
114
|
React.createElement("div", { className: styles['drawer-back-to-console-button-wrapper'] },
|
|
77
|
-
React.createElement("button", { className: clsx(testutilStyles['active-ai-drawer-leave-expanded-mode-custom-button'], styles['drawer-back-to-console-button']), formAction: "none", onClick: () => setExpandedDrawerId(null) }, (
|
|
115
|
+
React.createElement("button", { className: clsx(testutilStyles['active-ai-drawer-leave-expanded-mode-custom-button'], styles['drawer-back-to-console-button']), formAction: "none", onClick: () => setExpandedDrawerId(null) }, (_e = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _e === void 0 ? void 0 : _e.exitExpandedModeButton))))), activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 :
|
|
78
116
|
activeAiDrawer.content))));
|
|
79
117
|
}));
|
|
80
118
|
}));
|
package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-ai-drawer.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,iBAAiB,MAAM,kDAAkD,CAAC;AACjF,OAAO,cAAc,MAAM,mDAAmD,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAKxE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAwBrC,MAAM,UAAU,qCAAqC,CAAC,EACpD,kBAAkB,EAClB,IAAI,EACJ,cAAc,EACd,aAAa,GAC8B;;IAC3C,MAAM,EACJ,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACR,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,GACpB,GAAG,aAAa,CAAC;IAClB,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,GAAG,kBAAkB,CAAC;IAC1D,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC/C,MAAM,cAAc,GAAG,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,EAAE,CAAC;IAE1C,MAAM,kBAAkB,GAAG;QACzB,WAAW,EAAE,cAAc,CAAC,CA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Q,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,EAC3C,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB,aAAtB,sBAAsB,uBAAtB,sBAAsB,CAAG,IAAI,EAAE,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAAC,EAC9E,GAAG,EAAE,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,IAAI,CAAC,KAAK,EACrC,OAAO,EAAC,MAAM,EACd,eAAe,EAAC,OAAO,GACvB,CACE,CACF,CACF;4BACL,CAAC,QAAQ,IAAI,UAAU,KAAI,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,0CAAE,sBAAsB,CAAA,IAAI,CAChF,6BAAK,SAAS,EAAE,MAAM,CAAC,6BAA6B,CAAC;gCACnD,6BAAK,SAAS,EAAE,MAAM,CAAC,uCAAuC,CAAC;oCAC7D,gCACE,SAAS,EAAE,IAAI,CACb,cAAc,CAAC,oDAAoD,CAAC,EACpE,MAAM,CAAC,+BAA+B,CAAC,CACxC,EACD,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAEvC,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,0CAAE,sBAAsB,CAC5C,CACL,CACF,CACP,CACM,EACR,cAAc,aAAd,cAAc;wBAAd,cAAc,CAAE,OAAO,CACpB,CACF,CACA,CACT,CAAC;QACJ,CAAC,CACU,CACd,CAAC;IACJ,CAAC,CACU,CACd,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport { Transition } from 'react-transition-group';\nimport clsx from 'clsx';\n\nimport { InternalButton } from '../../../button/internal';\nimport PanelResizeHandle from '../../../internal/components/panel-resize-handle';\nimport customCssProps from '../../../internal/generated/custom-css-properties';\nimport { usePrevious } from '../../../internal/hooks/use-previous';\nimport { getLimitedValue } from '../../../split-panel/utils/size-utils';\nimport { AppLayoutProps } from '../../interfaces';\nimport { OnChangeParams } from '../../utils/use-ai-drawer';\nimport { FocusControlState } from '../../utils/use-focus-control';\nimport { AppLayoutInternals, InternalDrawer } from '../interfaces';\nimport { useResize } from './use-resize';\n\nimport sharedStyles from '../../resize/styles.css.js';\nimport testutilStyles from '../../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface AIDrawerProps {\n activeAiDrawerSize: number;\n minAiDrawerSize: number;\n aiDrawer: AppLayoutProps.Drawer | undefined;\n maxAiDrawerSize: number;\n ariaLabels: any;\n aiDrawerFocusControl: FocusControlState | undefined;\n isMobile: boolean;\n drawersOpenQueue: ReadonlyArray<string> | undefined;\n onActiveAiDrawerChange: undefined | ((newDrawerId: string | null, params?: OnChangeParams) => void);\n onActiveDrawerResize: (detail: { id: string; size: number }) => void;\n expandedDrawerId?: string | null;\n setExpandedDrawerId: (value: string | null) => void;\n}\n\ninterface AppLayoutGlobalAiDrawerImplementationProps {\n appLayoutInternals: AppLayoutInternals;\n show: boolean;\n activeAiDrawer: InternalDrawer | null;\n aiDrawerProps: AIDrawerProps;\n}\n\nexport function AppLayoutGlobalAiDrawerImplementation({\n appLayoutInternals,\n show,\n activeAiDrawer,\n aiDrawerProps,\n}: AppLayoutGlobalAiDrawerImplementationProps) {\n const {\n activeAiDrawerSize,\n minAiDrawerSize,\n maxAiDrawerSize,\n ariaLabels,\n aiDrawerFocusControl,\n isMobile,\n drawersOpenQueue,\n onActiveAiDrawerChange,\n onActiveDrawerResize,\n expandedDrawerId,\n setExpandedDrawerId,\n } = aiDrawerProps;\n const { verticalOffsets, placement } = appLayoutInternals;\n const drawerRef = useRef<HTMLDivElement>(null);\n const activeDrawerId = activeAiDrawer?.id;\n\n const computedAriaLabels = {\n closeButton: activeAiDrawer ? activeAiDrawer.ariaLabels?.closeButton : ariaLabels?.toolsClose,\n content: activeAiDrawer ? activeAiDrawer.ariaLabels?.drawerName : ariaLabels?.tools,\n };\n\n const resizeProps = useResize({\n currentWidth: activeAiDrawerSize,\n minWidth: minAiDrawerSize,\n maxWidth: maxAiDrawerSize,\n panelRef: drawerRef,\n handleRef: aiDrawerFocusControl!.refs.slider,\n onResize: size => {\n onActiveDrawerResize({ id: activeDrawerId!, size });\n },\n position: 'side-start',\n });\n const size = getLimitedValue(minAiDrawerSize, activeAiDrawerSize, maxAiDrawerSize);\n const isExpanded = activeAiDrawer?.isExpandable && expandedDrawerId === activeDrawerId;\n const wasExpanded = usePrevious(isExpanded);\n const animationDisabled =\n (activeAiDrawer?.defaultActive && !drawersOpenQueue?.includes(activeAiDrawer.id)) || (wasExpanded && !isExpanded);\n const drawerHeight = `calc(100vh - ${verticalOffsets.toolbar + placement.insetBlockEnd}px)`;\n // disable resizing when the drawer is at its minimum width in a \"squeezed\" state\n // (window is between mobile and desktop sizes). At this point, the drawer can't be\n // resized in either direction, so we disable the resize handler\n const isResizingDisabled = maxAiDrawerSize < activeAiDrawerSize;\n\n return (\n <Transition nodeRef={drawerRef} in={show} appear={show} mountOnEnter={true} timeout={250}>\n {drawerTransitionState => {\n return (\n <Transition nodeRef={drawerRef} in={isExpanded} timeout={250}>\n {expandedTransitionState => {\n return (\n <aside\n id={activeAiDrawer?.id}\n aria-hidden={!activeAiDrawer}\n aria-label={computedAriaLabels.content}\n className={clsx(\n styles.drawer,\n styles['ai-drawer'],\n !animationDisabled && isExpanded && styles['with-expanded-motion'],\n {\n [sharedStyles['with-motion-horizontal']]: !animationDisabled,\n [testutilStyles['active-drawer']]: show,\n [styles['drawer-hidden']]: !show && drawerTransitionState === 'exited',\n [testutilStyles['drawer-closed']]: !activeAiDrawer,\n [styles['drawer-expanded']]: isExpanded,\n }\n )}\n ref={drawerRef}\n onBlur={e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n aiDrawerFocusControl?.loseFocus();\n }\n }}\n style={{\n blockSize: drawerHeight,\n insetBlockStart: `${placement.insetBlockStart}px`,\n ...(!isMobile && {\n [customCssProps.drawerMinSize]: `${size}px`,\n [customCssProps.drawerSize]: `${['entering', 'entered'].includes(drawerTransitionState) ? size : 0}px`,\n }),\n }}\n data-testid={activeDrawerId && `awsui-app-layout-drawer-${activeDrawerId}`}\n >\n {!isMobile && activeAiDrawer?.resizable && (!isExpanded || expandedTransitionState !== 'entered') && (\n <div className={styles['drawer-slider']}>\n <PanelResizeHandle\n ref={aiDrawerFocusControl?.refs.slider}\n position=\"side-start\"\n className={clsx(testutilStyles['drawers-slider'], styles['ai-drawer-slider-handle'])}\n ariaLabel={activeAiDrawer?.ariaLabels?.resizeHandle}\n tooltipText={activeAiDrawer?.ariaLabels?.resizeHandleTooltipText}\n ariaValuenow={resizeProps.relativeSize}\n onKeyDown={resizeProps.onKeyDown}\n onPointerDown={resizeProps.onPointerDown}\n onDirectionClick={resizeProps.onDirectionClick}\n disabled={isResizingDisabled}\n />\n </div>\n )}\n <div className={clsx(styles['drawer-content-container'], sharedStyles['with-motion-horizontal'])}>\n <div className={styles['drawer-content']}>\n <header className={styles['drawer-content-header']}>\n <div className={styles['drawer-content-header-content']}>\n {activeAiDrawer?.header ?? <div />}\n <div className={styles['drawer-actions']}>\n {!isMobile && activeAiDrawer?.isExpandable && (\n <div className={styles['drawer-expanded-mode-button']}>\n <InternalButton\n ariaLabel={activeAiDrawer?.ariaLabels?.expandedModeButton}\n className={testutilStyles['active-drawer-expanded-mode-button']}\n formAction=\"none\"\n ariaExpanded={isExpanded}\n iconName={isExpanded ? 'shrink' : 'expand'}\n onClick={() => setExpandedDrawerId(isExpanded ? null : activeDrawerId!)}\n variant=\"icon\"\n analyticsAction={isExpanded ? 'expand' : 'collapse'}\n />\n </div>\n )}\n <div className={clsx(styles['drawer-close-button'])}>\n <InternalButton\n ariaLabel={computedAriaLabels.closeButton}\n className={clsx({\n [testutilStyles['active-drawer-close-button']]: activeDrawerId,\n })}\n formAction=\"none\"\n iconName={isMobile ? 'close' : 'angle-left'}\n onClick={() => onActiveAiDrawerChange?.(null, { initiatedByUserAction: true })}\n ref={aiDrawerFocusControl?.refs.close}\n variant=\"icon\"\n analyticsAction=\"close\"\n />\n </div>\n </div>\n </div>\n {!isMobile && isExpanded && activeAiDrawer?.ariaLabels?.exitExpandedModeButton && (\n <div className={styles['drawer-back-to-console-slot']}>\n <div className={styles['drawer-back-to-console-button-wrapper']}>\n <button\n className={clsx(\n testutilStyles['active-ai-drawer-leave-expanded-mode-custom-button'],\n styles['drawer-back-to-console-button']\n )}\n formAction=\"none\"\n onClick={() => setExpandedDrawerId(null)}\n >\n {activeAiDrawer?.ariaLabels?.exitExpandedModeButton}\n </button>\n </div>\n </div>\n )}\n </header>\n {activeAiDrawer?.content}\n </div>\n </div>\n </aside>\n );\n }}\n </Transition>\n );\n }}\n </Transition>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"global-ai-drawer.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,WAAW,MAAM,gCAAgC,CAAC;AACzD,OAAO,iBAAiB,MAAM,kDAAkD,CAAC;AACjF,OAAO,cAAc,MAAM,mDAAmD,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAKxE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAwBrC,MAAM,UAAU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MAAM,CAAC,6BAA6B,CAAC;gCACnD,6BAAK,SAAS,EAAE,MAAM,CAAC,uCAAuC,CAAC;oCAC7D,gCACE,SAAS,EAAE,IAAI,CACb,cAAc,CAAC,oDAAoD,CAAC,EACpE,MAAM,CAAC,+BAA+B,CAAC,CACxC,EACD,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAEvC,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,0CAAE,sBAAsB,CAC5C,CACL,CACF,CACP,CACM,EACR,cAAc,aAAd,cAAc;wBAAd,cAAc,CAAE,OAAO,CACpB,CACF,CACA,CACT,CAAC;QACJ,CAAC,CACU,CACd,CAAC;IACJ,CAAC,CACU,CACd,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport { Transition } from 'react-transition-group';\nimport clsx from 'clsx';\n\nimport { InternalItemOrGroup } from '../../../button-group/interfaces';\nimport ButtonGroup from '../../../button-group/internal';\nimport PanelResizeHandle from '../../../internal/components/panel-resize-handle';\nimport customCssProps from '../../../internal/generated/custom-css-properties';\nimport { usePrevious } from '../../../internal/hooks/use-previous';\nimport { getLimitedValue } from '../../../split-panel/utils/size-utils';\nimport { AppLayoutProps } from '../../interfaces';\nimport { OnChangeParams } from '../../utils/use-ai-drawer';\nimport { FocusControlState } from '../../utils/use-focus-control';\nimport { AppLayoutInternals, InternalDrawer } from '../interfaces';\nimport { useResize } from './use-resize';\n\nimport sharedStyles from '../../resize/styles.css.js';\nimport testutilStyles from '../../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface AIDrawerProps {\n activeAiDrawerSize: number;\n minAiDrawerSize: number;\n aiDrawer: AppLayoutProps.Drawer | undefined;\n maxAiDrawerSize: number;\n ariaLabels: any;\n aiDrawerFocusControl: FocusControlState | undefined;\n isMobile: boolean;\n drawersOpenQueue: ReadonlyArray<string> | undefined;\n onActiveAiDrawerChange: undefined | ((newDrawerId: string | null, params?: OnChangeParams) => void);\n onActiveDrawerResize: (detail: { id: string; size: number }) => void;\n expandedDrawerId?: string | null;\n setExpandedDrawerId: (value: string | null) => void;\n}\n\ninterface AppLayoutGlobalAiDrawerImplementationProps {\n appLayoutInternals: AppLayoutInternals;\n show: boolean;\n activeAiDrawer: InternalDrawer | null;\n aiDrawerProps: AIDrawerProps;\n}\n\nexport function AppLayoutGlobalAiDrawerImplementation({\n appLayoutInternals,\n show,\n activeAiDrawer,\n aiDrawerProps,\n}: AppLayoutGlobalAiDrawerImplementationProps) {\n const {\n activeAiDrawerSize,\n minAiDrawerSize,\n maxAiDrawerSize,\n ariaLabels,\n aiDrawerFocusControl,\n isMobile,\n drawersOpenQueue,\n onActiveAiDrawerChange,\n onActiveDrawerResize,\n expandedDrawerId,\n setExpandedDrawerId,\n } = aiDrawerProps;\n const { verticalOffsets, placement } = appLayoutInternals;\n const drawerRef = useRef<HTMLDivElement>(null);\n const activeDrawerId = activeAiDrawer?.id;\n\n const computedAriaLabels = {\n closeButton: activeAiDrawer ? activeAiDrawer.ariaLabels?.closeButton : ariaLabels?.toolsClose,\n content: activeAiDrawer ? activeAiDrawer.ariaLabels?.drawerName : ariaLabels?.tools,\n };\n\n const resizeProps = useResize({\n currentWidth: activeAiDrawerSize,\n minWidth: minAiDrawerSize,\n maxWidth: maxAiDrawerSize,\n panelRef: drawerRef,\n handleRef: aiDrawerFocusControl!.refs.slider,\n onResize: size => {\n onActiveDrawerResize({ id: activeDrawerId!, size });\n },\n position: 'side-start',\n });\n const size = getLimitedValue(minAiDrawerSize, activeAiDrawerSize, maxAiDrawerSize);\n const isExpanded = activeAiDrawer?.isExpandable && expandedDrawerId === activeDrawerId;\n const wasExpanded = usePrevious(isExpanded);\n const animationDisabled =\n (activeAiDrawer?.defaultActive && !drawersOpenQueue?.includes(activeAiDrawer.id)) || (wasExpanded && !isExpanded);\n const drawerHeight = `calc(100vh - ${verticalOffsets.toolbar + placement.insetBlockEnd}px)`;\n // disable resizing when the drawer is at its minimum width in a \"squeezed\" state\n // (window is between mobile and desktop sizes). At this point, the drawer can't be\n // resized in either direction, so we disable the resize handler\n const isResizingDisabled = maxAiDrawerSize < activeAiDrawerSize;\n let drawerActions: ReadonlyArray<InternalItemOrGroup> = [\n {\n type: 'icon-button',\n id: 'close',\n iconName: isMobile ? 'close' : 'angle-left',\n text: computedAriaLabels.closeButton,\n analyticsAction: 'close',\n },\n ];\n if (!isMobile && activeAiDrawer?.isExpandable) {\n drawerActions = [\n {\n type: 'icon-button',\n id: 'expand',\n iconName: isExpanded ? 'shrink' : 'expand',\n text: activeAiDrawer?.ariaLabels?.expandedModeButton ?? '',\n analyticsAction: isExpanded ? 'expand' : 'collapse',\n },\n ...drawerActions,\n ];\n }\n if (activeAiDrawer?.headerActions) {\n drawerActions = [\n {\n type: 'group',\n text: 'Actions',\n items: activeAiDrawer.headerActions!,\n },\n ...drawerActions,\n ];\n }\n\n return (\n <Transition nodeRef={drawerRef} in={show} appear={show} mountOnEnter={true} timeout={250}>\n {drawerTransitionState => {\n return (\n <Transition nodeRef={drawerRef} in={isExpanded} timeout={250}>\n {expandedTransitionState => {\n return (\n <aside\n id={activeAiDrawer?.id}\n aria-hidden={!activeAiDrawer}\n aria-label={computedAriaLabels.content}\n className={clsx(\n styles.drawer,\n styles['ai-drawer'],\n !animationDisabled && isExpanded && styles['with-expanded-motion'],\n {\n [sharedStyles['with-motion-horizontal']]: !animationDisabled,\n [testutilStyles['active-drawer']]: show,\n [styles['drawer-hidden']]: !show && drawerTransitionState === 'exited',\n [testutilStyles['drawer-closed']]: !activeAiDrawer,\n [styles['drawer-expanded']]: isExpanded,\n }\n )}\n ref={drawerRef}\n onBlur={e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n aiDrawerFocusControl?.loseFocus();\n }\n }}\n style={{\n blockSize: drawerHeight,\n insetBlockStart: `${placement.insetBlockStart}px`,\n ...(!isMobile && {\n [customCssProps.drawerMinSize]: `${size}px`,\n [customCssProps.drawerSize]: `${['entering', 'entered'].includes(drawerTransitionState) ? size : 0}px`,\n }),\n }}\n data-testid={activeDrawerId && `awsui-app-layout-drawer-${activeDrawerId}`}\n >\n {!isMobile && activeAiDrawer?.resizable && (!isExpanded || expandedTransitionState !== 'entered') && (\n <div className={styles['drawer-slider']}>\n <PanelResizeHandle\n ref={aiDrawerFocusControl?.refs.slider}\n position=\"side-start\"\n className={clsx(testutilStyles['drawers-slider'], styles['ai-drawer-slider-handle'])}\n ariaLabel={activeAiDrawer?.ariaLabels?.resizeHandle}\n tooltipText={activeAiDrawer?.ariaLabels?.resizeHandleTooltipText}\n ariaValuenow={resizeProps.relativeSize}\n onKeyDown={resizeProps.onKeyDown}\n onPointerDown={resizeProps.onPointerDown}\n onDirectionClick={resizeProps.onDirectionClick}\n disabled={isResizingDisabled}\n />\n </div>\n )}\n <div className={clsx(styles['drawer-content-container'], sharedStyles['with-motion-horizontal'])}>\n <div className={styles['drawer-content']}>\n <header className={styles['drawer-content-header']}>\n <div className={styles['drawer-content-header-content']}>\n {activeAiDrawer?.header ?? <div />}\n <div className={styles['drawer-actions']}>\n <ButtonGroup\n dropdownExpandToViewport={false}\n variant=\"icon\"\n onItemClick={event => {\n switch (event.detail.id) {\n case 'close':\n onActiveAiDrawerChange?.(null, { initiatedByUserAction: true });\n break;\n case 'expand':\n setExpandedDrawerId(isExpanded ? null : activeDrawerId!);\n break;\n default:\n activeAiDrawer?.onHeaderActionClick?.(event);\n }\n }}\n ariaLabel=\"Left panel actions\"\n items={drawerActions}\n />\n </div>\n </div>\n {!isMobile && isExpanded && activeAiDrawer?.ariaLabels?.exitExpandedModeButton && (\n <div className={styles['drawer-back-to-console-slot']}>\n <div className={styles['drawer-back-to-console-button-wrapper']}>\n <button\n className={clsx(\n testutilStyles['active-ai-drawer-leave-expanded-mode-custom-button'],\n styles['drawer-back-to-console-button']\n )}\n formAction=\"none\"\n onClick={() => setExpandedDrawerId(null)}\n >\n {activeAiDrawer?.ariaLabels?.exitExpandedModeButton}\n </button>\n </div>\n </div>\n )}\n </header>\n {activeAiDrawer?.content}\n </div>\n </div>\n </aside>\n );\n }}\n </Transition>\n );\n }}\n </Transition>\n );\n}\n"]}
|
package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-drawer.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-drawer.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"global-drawer.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-drawer.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAOnE,UAAU,wCAAwC;IAChD,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,kBAAkB,EAAE,cAAc,GAAG,SAAS,CAAC;CAChD;AAED,iBAAS,mCAAmC,CAAC,EAC3C,kBAAkB,EAClB,IAAI,EACJ,kBAAkB,GACnB,EAAE,wCAAwC,eAyL1C;AAED,eAAe,mCAAmC,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { useRef } from 'react';
|
|
4
4
|
import { Transition } from 'react-transition-group';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import
|
|
6
|
+
import ButtonGroup from '../../../button-group/internal';
|
|
7
7
|
import PanelResizeHandle from '../../../internal/components/panel-resize-handle';
|
|
8
8
|
import customCssProps from '../../../internal/generated/custom-css-properties';
|
|
9
9
|
import { usePrevious } from '../../../internal/hooks/use-previous';
|
|
@@ -14,7 +14,7 @@ import sharedStyles from '../../resize/styles.css.js';
|
|
|
14
14
|
import testutilStyles from '../../test-classes/styles.css.js';
|
|
15
15
|
import styles from './styles.css.js';
|
|
16
16
|
function AppLayoutGlobalDrawerImplementation({ appLayoutInternals, show, activeGlobalDrawer, }) {
|
|
17
|
-
var _a, _b, _c, _d, _e, _f;
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
18
18
|
const { ariaLabels, globalDrawersFocusControl, isMobile, placement, onActiveGlobalDrawersChange, onActiveDrawerResize, minGlobalDrawersSizes, maxGlobalDrawersSizes, activeGlobalDrawersSizes, activeGlobalDrawers, verticalOffsets, drawersOpenQueue, expandedDrawerId, setExpandedDrawerId, activeAiDrawer, } = appLayoutInternals;
|
|
19
19
|
const drawerRef = useRef(null);
|
|
20
20
|
const activeDrawerId = (_a = activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.id) !== null && _a !== void 0 ? _a : '';
|
|
@@ -42,8 +42,39 @@ function AppLayoutGlobalDrawerImplementation({ appLayoutInternals, show, activeG
|
|
|
42
42
|
const wasExpanded = usePrevious(isExpanded);
|
|
43
43
|
const animationDisabled = ((activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.defaultActive) && !drawersOpenQueue.includes(activeGlobalDrawer.id)) ||
|
|
44
44
|
(wasExpanded && !isExpanded);
|
|
45
|
+
let drawerActions = [
|
|
46
|
+
{
|
|
47
|
+
type: 'icon-button',
|
|
48
|
+
id: 'close',
|
|
49
|
+
iconName: isMobile ? 'close' : 'angle-right',
|
|
50
|
+
text: (_g = computedAriaLabels.closeButton) !== null && _g !== void 0 ? _g : '',
|
|
51
|
+
analyticsAction: 'close',
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
if (!isMobile && (activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.isExpandable)) {
|
|
55
|
+
drawerActions = [
|
|
56
|
+
{
|
|
57
|
+
type: 'icon-button',
|
|
58
|
+
id: 'expand',
|
|
59
|
+
iconName: isExpanded ? 'shrink' : 'expand',
|
|
60
|
+
text: (_j = (_h = activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.ariaLabels) === null || _h === void 0 ? void 0 : _h.expandedModeButton) !== null && _j !== void 0 ? _j : '',
|
|
61
|
+
analyticsAction: isExpanded ? 'expand' : 'collapse',
|
|
62
|
+
},
|
|
63
|
+
...drawerActions,
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
if (activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.headerActions) {
|
|
67
|
+
drawerActions = [
|
|
68
|
+
{
|
|
69
|
+
type: 'group',
|
|
70
|
+
text: 'Actions',
|
|
71
|
+
items: activeGlobalDrawer.headerActions,
|
|
72
|
+
},
|
|
73
|
+
...drawerActions,
|
|
74
|
+
];
|
|
75
|
+
}
|
|
45
76
|
return (React.createElement(Transition, { nodeRef: drawerRef, in: show || isExpanded, appear: show || isExpanded, timeout: 0 }, state => {
|
|
46
|
-
var _a, _b
|
|
77
|
+
var _a, _b;
|
|
47
78
|
return (React.createElement("aside", { id: activeDrawerId, "aria-hidden": !show, "aria-label": computedAriaLabels.content, className: clsx(styles.drawer, styles['drawer-global'], styles[state], !animationDisabled && sharedStyles['with-motion-horizontal'], !animationDisabled && isExpanded && styles['with-expanded-motion'], {
|
|
48
79
|
[styles['drawer-hidden']]: !show,
|
|
49
80
|
[styles['last-opened']]: (!activeAiDrawer && lastOpenedDrawerId === activeDrawerId) || isExpanded,
|
|
@@ -72,12 +103,24 @@ function AppLayoutGlobalDrawerImplementation({ appLayoutInternals, show, activeG
|
|
|
72
103
|
React.createElement(PanelResizeHandle, { ref: refs === null || refs === void 0 ? void 0 : refs.slider, position: "side", className: testutilStyles['drawers-slider'], ariaLabel: (_a = activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.ariaLabels) === null || _a === void 0 ? void 0 : _a.resizeHandle, tooltipText: (_b = activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.ariaLabels) === null || _b === void 0 ? void 0 : _b.resizeHandleTooltipText, ariaValuenow: resizeProps.relativeSize, onKeyDown: resizeProps.onKeyDown, onDirectionClick: resizeProps.onDirectionClick, onPointerDown: resizeProps.onPointerDown }))),
|
|
73
104
|
React.createElement("div", { className: clsx(styles['drawer-content-container'], sharedStyles['with-motion-horizontal']), "data-testid": `awsui-app-layout-drawer-content-${activeDrawerId}` },
|
|
74
105
|
React.createElement("div", { className: styles['drawer-actions'] },
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
106
|
+
React.createElement(ButtonGroup, { dropdownExpandToViewport: false, variant: "icon", onItemClick: event => {
|
|
107
|
+
var _a;
|
|
108
|
+
switch (event.detail.id) {
|
|
109
|
+
case 'close':
|
|
110
|
+
onActiveGlobalDrawersChange(activeDrawerId, { initiatedByUserAction: true });
|
|
111
|
+
break;
|
|
112
|
+
case 'expand':
|
|
113
|
+
setExpandedDrawerId(isExpanded ? null : activeDrawerId);
|
|
114
|
+
break;
|
|
115
|
+
default:
|
|
116
|
+
(_a = activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.onHeaderActionClick) === null || _a === void 0 ? void 0 : _a.call(activeGlobalDrawer, event);
|
|
117
|
+
}
|
|
118
|
+
}, ariaLabel: "Global panel actions", items: drawerActions, __internalRootRef: (root) => {
|
|
119
|
+
if (!root) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
refs.close = { current: root.querySelector('[data-itemid="close"]') };
|
|
123
|
+
} })),
|
|
81
124
|
React.createElement("div", { className: styles['drawer-content'], style: { blockSize: drawerHeight } }, activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.content)))));
|
|
82
125
|
}));
|
|
83
126
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-drawer.js","sourceR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,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAC1C,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,EACtE,OAAO,EAAC,MAAM,EACd,eAAe,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,GACnD,CACE,CACP;wBACD,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;4BACjD,oBAAC,cAAc,IACb,SAAS,EAAE,kBAAkB,CAAC,WAAW,EACzC,SAAS,EAAE,IAAI,CAAC;oCACd,CAAC,cAAc,CAAC,4BAA4B,CAAC,CAAC,EAAE,cAAc;iCAC/D,CAAC,EACF,UAAU,EAAC,MAAM,EACjB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,EAC5C,OAAO,EAAE,GAAG,EAAE,CAAC,2BAA2B,CAAC,cAAc,EAAE,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAAC,EAC3F,GAAG,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,EAChB,OAAO,EAAC,MAAM,EACd,eAAe,EAAC,OAAO,GACvB,CACE,CACF;oBACN,6BAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,IACzE,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,OAAO,CACxB,CACF,CACF,CACA,CACT,CAAC;IACJ,CAAC,CACU,CACd,CAAC;AACJ,CAAC;AAED,eAAe,mCAAmC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport { Transition } from 'react-transition-group';\nimport clsx from 'clsx';\n\nimport { InternalButton } from '../../../button/internal';\nimport PanelResizeHandle from '../../../internal/components/panel-resize-handle';\nimport customCssProps from '../../../internal/generated/custom-css-properties';\nimport { usePrevious } from '../../../internal/hooks/use-previous';\nimport { getLimitedValue } from '../../../split-panel/utils/size-utils';\nimport { getDrawerStyles } from '../compute-layout';\nimport { AppLayoutInternals, InternalDrawer } from '../interfaces';\nimport { useResize } from './use-resize';\n\nimport sharedStyles from '../../resize/styles.css.js';\nimport testutilStyles from '../../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface AppLayoutGlobalDrawerImplementationProps {\n appLayoutInternals: AppLayoutInternals;\n show: boolean;\n activeGlobalDrawer: InternalDrawer | undefined;\n}\n\nfunction AppLayoutGlobalDrawerImplementation({\n appLayoutInternals,\n show,\n activeGlobalDrawer,\n}: AppLayoutGlobalDrawerImplementationProps) {\n const {\n ariaLabels,\n globalDrawersFocusControl,\n isMobile,\n placement,\n onActiveGlobalDrawersChange,\n onActiveDrawerResize,\n minGlobalDrawersSizes,\n maxGlobalDrawersSizes,\n activeGlobalDrawersSizes,\n activeGlobalDrawers,\n verticalOffsets,\n drawersOpenQueue,\n expandedDrawerId,\n setExpandedDrawerId,\n activeAiDrawer,\n } = appLayoutInternals;\n const drawerRef = useRef<HTMLDivElement>(null);\n const activeDrawerId = activeGlobalDrawer?.id ?? '';\n\n const computedAriaLabels = {\n closeButton: activeGlobalDrawer ? activeGlobalDrawer.ariaLabels?.closeButton : ariaLabels?.toolsClose,\n content: activeGlobalDrawer ? activeGlobalDrawer.ariaLabels?.drawerName : ariaLabels?.tools,\n };\n\n const { drawerTopOffset, drawerHeight } = getDrawerStyles(verticalOffsets, isMobile, placement);\n const activeDrawerSize = (activeDrawerId ? activeGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const minDrawerSize = (activeDrawerId ? minGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const maxDrawerSize = (activeDrawerId ? maxGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const refs = globalDrawersFocusControl.refs[activeDrawerId];\n const resizeProps = useResize({\n currentWidth: activeDrawerSize,\n minWidth: minDrawerSize,\n maxWidth: maxDrawerSize,\n panelRef: drawerRef,\n handleRef: refs?.slider,\n onResize: size => onActiveDrawerResize({ id: activeDrawerId!, size }),\n });\n const size = getLimitedValue(minDrawerSize, activeDrawerSize, maxDrawerSize);\n const lastOpenedDrawerId = drawersOpenQueue.length ? drawersOpenQueue[0] : null;\n const hasTriggerButton = !!activeGlobalDrawer?.trigger;\n const isExpanded = activeGlobalDrawer?.isExpandable && expandedDrawerId === activeDrawerId;\n const wasExpanded = usePrevious(isExpanded);\n const animationDisabled =\n (activeGlobalDrawer?.defaultActive && !drawersOpenQueue.includes(activeGlobalDrawer.id)) ||\n (wasExpanded && !isExpanded);\n\n return (\n <Transition nodeRef={drawerRef} in={show || isExpanded} appear={show || isExpanded} timeout={0}>\n {state => {\n return (\n <aside\n id={activeDrawerId}\n aria-hidden={!show}\n aria-label={computedAriaLabels.content}\n className={clsx(\n styles.drawer,\n styles['drawer-global'],\n styles[state],\n !animationDisabled && sharedStyles['with-motion-horizontal'],\n !animationDisabled && isExpanded && styles['with-expanded-motion'],\n {\n [styles['drawer-hidden']]: !show,\n [styles['last-opened']]: (!activeAiDrawer && lastOpenedDrawerId === activeDrawerId) || isExpanded,\n [testutilStyles['active-drawer']]: show,\n [styles['drawer-expanded']]: isExpanded,\n [styles['has-next-siblings']]:\n activeGlobalDrawers.findIndex(drawer => drawer.id === activeDrawerId) + 1 <\n activeGlobalDrawers.length,\n }\n )}\n ref={drawerRef}\n onBlur={e => {\n // Drawers with trigger buttons follow this restore focus logic:\n // If a previously focused element exists, restore focus on it; otherwise, focus on the associated trigger button.\n // This function resets the previously focused element.\n // If the drawer has no trigger button and loses focus on the previously focused element, it defaults to document.body,\n // which ideally should never happen.\n if (!hasTriggerButton) {\n return;\n }\n\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n globalDrawersFocusControl.loseFocus();\n }\n }}\n style={{\n blockSize: drawerHeight,\n insetBlockStart: drawerTopOffset,\n ...(!isMobile && {\n [customCssProps.drawerSize]: `${['entering', 'entered'].includes(state) ? (isExpanded ? '100%' : size + 'px') : 0}`,\n }),\n }}\n data-testid={`awsui-app-layout-drawer-${activeDrawerId}`}\n >\n <div className={clsx(styles['global-drawer-wrapper'])}>\n {!isMobile && <div className={styles['drawer-gap']}></div>}\n {!isMobile && activeGlobalDrawer?.resizable && !isExpanded && (\n <div className={styles['drawer-slider']}>\n <PanelResizeHandle\n ref={refs?.slider}\n position=\"side\"\n className={testutilStyles['drawers-slider']}\n ariaLabel={activeGlobalDrawer?.ariaLabels?.resizeHandle}\n tooltipText={activeGlobalDrawer?.ariaLabels?.resizeHandleTooltipText}\n ariaValuenow={resizeProps.relativeSize}\n onKeyDown={resizeProps.onKeyDown}\n onDirectionClick={resizeProps.onDirectionClick}\n onPointerDown={resizeProps.onPointerDown}\n />\n </div>\n )}\n\n <div\n className={clsx(styles['drawer-content-container'], sharedStyles['with-motion-horizontal'])}\n data-testid={`awsui-app-layout-drawer-content-${activeDrawerId}`}\n >\n <div className={styles['drawer-actions']}>\n {!isMobile && activeGlobalDrawer?.isExpandable && (\n <div className={styles['drawer-expanded-mode-button']}>\n <InternalButton\n ariaLabel={activeGlobalDrawer?.ariaLabels?.expandedModeButton}\n className={testutilStyles['active-drawer-expanded-mode-button']}\n formAction=\"none\"\n ariaExpanded={isExpanded}\n iconName={isExpanded ? 'shrink' : 'expand'}\n onClick={() => setExpandedDrawerId(isExpanded ? null : activeDrawerId)}\n variant=\"icon\"\n analyticsAction={isExpanded ? 'expand' : 'collapse'}\n />\n </div>\n )}\n <div className={clsx(styles['drawer-close-button'])}>\n <InternalButton\n ariaLabel={computedAriaLabels.closeButton}\n className={clsx({\n [testutilStyles['active-drawer-close-button']]: activeDrawerId,\n })}\n formAction=\"none\"\n iconName={isMobile ? 'close' : 'angle-right'}\n onClick={() => onActiveGlobalDrawersChange(activeDrawerId, { initiatedByUserAction: true })}\n ref={refs?.close}\n variant=\"icon\"\n analyticsAction=\"close\"\n />\n </div>\n </div>\n <div className={styles['drawer-content']} style={{ blockSize: drawerHeight }}>\n {activeGlobalDrawer?.content}\n </div>\n </div>\n </div>\n </aside>\n );\n }}\n </Transition>\n );\n}\n\nexport default AppLayoutGlobalDrawerImplementation;\n"]}
|
|
1
|
+
{"version":3,"file":"global-drawer.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-drawer.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,WAAW,MAAM,gCAAgC,CAAC;AACzD,OAAO,iBAAiB,MAAM,kDAAkD,CAAC;AACjF,OAAO,cAAc,MAAM,mDAAmD,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAQrC,SAAS,mCAAmC,CAAC,EAC3C,kBAAkB,EAClB,IAAI,EACJ,kBAAkB,GACuB;;IACzC,MAAM,EACJ,UAAU,EACV,yBAAyB,EACzB,QAAQ,EACR,SAAS,EACT,2BAA2B,EAC3B,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,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AAC,CAAC;wCACxD,MAAM;oCACR;wCACE,MAAA,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,mBAAmB,mEAAG,KAAK,CAAC,CAAC;iCACpD;4BACH,CAAC,EACD,SAAS,EAAC,sBAAsB,EAChC,KAAK,EAAE,aAAa,EACpB,iBAAiB,EAAE,CAAC,IAAiB,EAAE,EAAE;gCACvC,IAAI,CAAC,IAAI,EAAE;oCACT,OAAO;iCACR;gCACD,IAAI,CAAC,KAAK,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,uBAAuB,CAAyB,EAAE,CAAC;4BAChG,CAAC,GACD,CACE;oBACN,6BAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,IACzE,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,OAAO,CACxB,CACF,CACF,CACA,CACT,CAAC;IACJ,CAAC,CACU,CACd,CAAC;AACJ,CAAC;AAED,eAAe,mCAAmC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport { Transition } from 'react-transition-group';\nimport clsx from 'clsx';\n\nimport { InternalItemOrGroup } from '../../../button-group/interfaces';\nimport ButtonGroup from '../../../button-group/internal';\nimport PanelResizeHandle from '../../../internal/components/panel-resize-handle';\nimport customCssProps from '../../../internal/generated/custom-css-properties';\nimport { usePrevious } from '../../../internal/hooks/use-previous';\nimport { getLimitedValue } from '../../../split-panel/utils/size-utils';\nimport { Focusable } from '../../utils/use-focus-control';\nimport { getDrawerStyles } from '../compute-layout';\nimport { AppLayoutInternals, InternalDrawer } from '../interfaces';\nimport { useResize } from './use-resize';\n\nimport sharedStyles from '../../resize/styles.css.js';\nimport testutilStyles from '../../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface AppLayoutGlobalDrawerImplementationProps {\n appLayoutInternals: AppLayoutInternals;\n show: boolean;\n activeGlobalDrawer: InternalDrawer | undefined;\n}\n\nfunction AppLayoutGlobalDrawerImplementation({\n appLayoutInternals,\n show,\n activeGlobalDrawer,\n}: AppLayoutGlobalDrawerImplementationProps) {\n const {\n ariaLabels,\n globalDrawersFocusControl,\n isMobile,\n placement,\n onActiveGlobalDrawersChange,\n onActiveDrawerResize,\n minGlobalDrawersSizes,\n maxGlobalDrawersSizes,\n activeGlobalDrawersSizes,\n activeGlobalDrawers,\n verticalOffsets,\n drawersOpenQueue,\n expandedDrawerId,\n setExpandedDrawerId,\n activeAiDrawer,\n } = appLayoutInternals;\n const drawerRef = useRef<HTMLDivElement>(null);\n const activeDrawerId = activeGlobalDrawer?.id ?? '';\n\n const computedAriaLabels = {\n closeButton: activeGlobalDrawer ? activeGlobalDrawer.ariaLabels?.closeButton : ariaLabels?.toolsClose,\n content: activeGlobalDrawer ? activeGlobalDrawer.ariaLabels?.drawerName : ariaLabels?.tools,\n };\n\n const { drawerTopOffset, drawerHeight } = getDrawerStyles(verticalOffsets, isMobile, placement);\n const activeDrawerSize = (activeDrawerId ? activeGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const minDrawerSize = (activeDrawerId ? minGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const maxDrawerSize = (activeDrawerId ? maxGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const refs = globalDrawersFocusControl.refs[activeDrawerId];\n const resizeProps = useResize({\n currentWidth: activeDrawerSize,\n minWidth: minDrawerSize,\n maxWidth: maxDrawerSize,\n panelRef: drawerRef,\n handleRef: refs?.slider,\n onResize: size => onActiveDrawerResize({ id: activeDrawerId!, size }),\n });\n const size = getLimitedValue(minDrawerSize, activeDrawerSize, maxDrawerSize);\n const lastOpenedDrawerId = drawersOpenQueue.length ? drawersOpenQueue[0] : null;\n const hasTriggerButton = !!activeGlobalDrawer?.trigger;\n const isExpanded = activeGlobalDrawer?.isExpandable && expandedDrawerId === activeDrawerId;\n const wasExpanded = usePrevious(isExpanded);\n const animationDisabled =\n (activeGlobalDrawer?.defaultActive && !drawersOpenQueue.includes(activeGlobalDrawer.id)) ||\n (wasExpanded && !isExpanded);\n let drawerActions: ReadonlyArray<InternalItemOrGroup> = [\n {\n type: 'icon-button',\n id: 'close',\n iconName: isMobile ? 'close' : 'angle-right',\n text: computedAriaLabels.closeButton ?? '',\n analyticsAction: 'close',\n },\n ];\n if (!isMobile && activeGlobalDrawer?.isExpandable) {\n drawerActions = [\n {\n type: 'icon-button',\n id: 'expand',\n iconName: isExpanded ? 'shrink' : 'expand',\n text: activeGlobalDrawer?.ariaLabels?.expandedModeButton ?? '',\n analyticsAction: isExpanded ? 'expand' : 'collapse',\n },\n ...drawerActions,\n ];\n }\n if (activeGlobalDrawer?.headerActions) {\n drawerActions = [\n {\n type: 'group',\n text: 'Actions',\n items: activeGlobalDrawer.headerActions!,\n },\n ...drawerActions,\n ];\n }\n\n return (\n <Transition nodeRef={drawerRef} in={show || isExpanded} appear={show || isExpanded} timeout={0}>\n {state => {\n return (\n <aside\n id={activeDrawerId}\n aria-hidden={!show}\n aria-label={computedAriaLabels.content}\n className={clsx(\n styles.drawer,\n styles['drawer-global'],\n styles[state],\n !animationDisabled && sharedStyles['with-motion-horizontal'],\n !animationDisabled && isExpanded && styles['with-expanded-motion'],\n {\n [styles['drawer-hidden']]: !show,\n [styles['last-opened']]: (!activeAiDrawer && lastOpenedDrawerId === activeDrawerId) || isExpanded,\n [testutilStyles['active-drawer']]: show,\n [styles['drawer-expanded']]: isExpanded,\n [styles['has-next-siblings']]:\n activeGlobalDrawers.findIndex(drawer => drawer.id === activeDrawerId) + 1 <\n activeGlobalDrawers.length,\n }\n )}\n ref={drawerRef}\n onBlur={e => {\n // Drawers with trigger buttons follow this restore focus logic:\n // If a previously focused element exists, restore focus on it; otherwise, focus on the associated trigger button.\n // This function resets the previously focused element.\n // If the drawer has no trigger button and loses focus on the previously focused element, it defaults to document.body,\n // which ideally should never happen.\n if (!hasTriggerButton) {\n return;\n }\n\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n globalDrawersFocusControl.loseFocus();\n }\n }}\n style={{\n blockSize: drawerHeight,\n insetBlockStart: drawerTopOffset,\n ...(!isMobile && {\n [customCssProps.drawerSize]: `${['entering', 'entered'].includes(state) ? (isExpanded ? '100%' : size + 'px') : 0}`,\n }),\n }}\n data-testid={`awsui-app-layout-drawer-${activeDrawerId}`}\n >\n <div className={clsx(styles['global-drawer-wrapper'])}>\n {!isMobile && <div className={styles['drawer-gap']}></div>}\n {!isMobile && activeGlobalDrawer?.resizable && !isExpanded && (\n <div className={styles['drawer-slider']}>\n <PanelResizeHandle\n ref={refs?.slider}\n position=\"side\"\n className={testutilStyles['drawers-slider']}\n ariaLabel={activeGlobalDrawer?.ariaLabels?.resizeHandle}\n tooltipText={activeGlobalDrawer?.ariaLabels?.resizeHandleTooltipText}\n ariaValuenow={resizeProps.relativeSize}\n onKeyDown={resizeProps.onKeyDown}\n onDirectionClick={resizeProps.onDirectionClick}\n onPointerDown={resizeProps.onPointerDown}\n />\n </div>\n )}\n\n <div\n className={clsx(styles['drawer-content-container'], sharedStyles['with-motion-horizontal'])}\n data-testid={`awsui-app-layout-drawer-content-${activeDrawerId}`}\n >\n <div className={styles['drawer-actions']}>\n <ButtonGroup\n dropdownExpandToViewport={false}\n variant=\"icon\"\n onItemClick={event => {\n switch (event.detail.id) {\n case 'close':\n onActiveGlobalDrawersChange(activeDrawerId, { initiatedByUserAction: true });\n break;\n case 'expand':\n setExpandedDrawerId(isExpanded ? null : activeDrawerId);\n break;\n default:\n activeGlobalDrawer?.onHeaderActionClick?.(event);\n }\n }}\n ariaLabel=\"Global panel actions\"\n items={drawerActions}\n __internalRootRef={(root: HTMLElement) => {\n if (!root) {\n return;\n }\n refs.close = { current: root.querySelector('[data-itemid=\"close\"]') as unknown as Focusable };\n }}\n />\n </div>\n <div className={styles['drawer-content']} style={{ blockSize: drawerHeight }}>\n {activeGlobalDrawer?.content}\n </div>\n </div>\n </div>\n </aside>\n );\n }}\n </Transition>\n );\n}\n\nexport default AppLayoutGlobalDrawerImplementation;\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BreadcrumbGroupProps } from '../../breadcrumb-group/interfaces';
|
|
3
|
+
import { ButtonGroupProps } from '../../button-group/interfaces';
|
|
3
4
|
import { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';
|
|
5
|
+
import { NonCancelableEventHandler } from '../../internal/events';
|
|
4
6
|
import { SomeOptional } from '../../internal/types';
|
|
5
7
|
import { AppLayoutProps, AppLayoutPropsWithDefaults } from '../interfaces';
|
|
6
8
|
import { SplitPanelProviderProps } from '../split-panel';
|
|
@@ -19,6 +21,8 @@ export type InternalDrawer = AppLayoutProps.Drawer & {
|
|
|
19
21
|
exitExpandedModeButton?: string;
|
|
20
22
|
};
|
|
21
23
|
header?: React.ReactNode;
|
|
24
|
+
headerActions?: ReadonlyArray<ButtonGroupProps.Item>;
|
|
25
|
+
onHeaderActionClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;
|
|
22
26
|
};
|
|
23
27
|
export interface AppLayoutInternals {
|
|
24
28
|
ariaLabels: AppLayoutPropsWithDefaults['ariaLabels'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAA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B,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAChC,cAAc,EAAE,OAAO,CAAC;IAExB,eAAe,EAAE,wBAAwB,CAAC;IAE1C,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,mBAAmB,EAAE,uBAAuB,CAAC;CAC9C;AAED,MAAM,MAAM,qBAAqB,GAAG,YAAY,CAC9C,cAAc,EACd,oBAAoB,GAAG,qBAAqB,GAAG,iBAAiB,GAAG,SAAS,CAC7E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\n\nimport { BreadcrumbGroupProps } from '../../breadcrumb-group/interfaces';\nimport { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';\nimport { SomeOptional } from '../../internal/types';\nimport { AppLayoutProps, AppLayoutPropsWithDefaults } from '../interfaces';\nimport { SplitPanelProviderProps } from '../split-panel';\nimport { OnChangeParams } from '../utils/use-drawers';\nimport { FocusControlMultipleStates, FocusControlState } from '../utils/use-focus-control';\nimport { SplitPanelFocusControlState } from '../utils/use-split-panel-focus-control';\nimport { VerticalLayoutOutput } from './compute-layout';\n\nexport interface AppLayoutInternalProps extends AppLayoutPropsWithDefaults {\n navigationTriggerHide?: boolean;\n}\n\nexport type InternalDrawer = AppLayoutProps.Drawer & {\n defaultActive?: boolean;\n isExpandable?: boolean;\n ariaLabels: AppLayoutProps.Drawer['ariaLabels'] & { expandedModeButton?: string; exitExpandedModeButton?: string };\n header?: React.ReactNode;\n};\n\n// Widgetization notice: structures in this file are shared multiple app layout instances, possibly different minor versions.\n// Treat these structures as an API and do not make incompatible changes.\n// Legacy widget interface\nexport interface AppLayoutInternals {\n ariaLabels: AppLayoutPropsWithDefaults['ariaLabels'];\n headerVariant: AppLayoutPropsWithDefaults['headerVariant'];\n placement: AppLayoutPropsWithDefaults['placement'];\n navigationOpen: AppLayoutPropsWithDefaults['navigationOpen'];\n navigationFocusControl: FocusControlState;\n navigation: React.ReactNode;\n splitPanelPosition: AppLayoutProps.SplitPanelPreferences['position'];\n splitPanelOpen: boolean;\n splitPanelControlId: string;\n splitPanelFocusControl: SplitPanelFocusControlState;\n splitPanelToggleConfig: SplitPanelSideToggleProps;\n isMobile: boolean;\n activeDrawer: InternalDrawer | undefined;\n activeDrawerSize: number;\n minDrawerSize: number;\n maxDrawerSize: number;\n minGlobalDrawersSizes: Record<string, number>;\n maxGlobalDrawersSizes: Record<string, number>;\n drawers: ReadonlyArray<InternalDrawer>;\n drawersFocusControl: FocusControlState;\n globalDrawersFocusControl: FocusControlMultipleStates;\n activeGlobalDrawersIds: ReadonlyArray<string>;\n activeGlobalDrawers: ReadonlyArray<InternalDrawer>;\n globalDrawers: ReadonlyArray<InternalDrawer>;\n activeGlobalDrawersSizes: Record<string, number>;\n stickyNotifications: AppLayoutPropsWithDefaults['stickyNotifications'];\n breadcrumbs: React.ReactNode;\n discoveredBreadcrumbs: BreadcrumbGroupProps | null;\n toolbarState: 'show' | 'hide';\n setToolbarState: (state: 'show' | 'hide') => void;\n verticalOffsets: VerticalLayoutOutput;\n drawersOpenQueue: ReadonlyArray<string>;\n setNotificationsHeight: (height: number) => void;\n setToolbarHeight: (height: number) => void;\n onSplitPanelToggle: () => void;\n onNavigationToggle: (open: boolean) => void;\n onActiveDrawerChange: (newDrawerId: string | null, params: OnChangeParams) => void;\n onActiveDrawerResize: (detail: { id: string; size: number }) => void;\n onActiveGlobalDrawersChange: (newDrawerId: string, params: OnChangeParams) => void;\n splitPanelAnimationDisabled?: boolean;\n expandedDrawerId: string | null;\n setExpandedDrawerId: (value: string | null) => void;\n aiDrawer?: InternalDrawer | null;\n onActiveAiDrawerChange?: (newDrawerId: string | null, params?: OnChangeParams) => void;\n activeAiDrawer?: InternalDrawer | null;\n activeAiDrawerId: string | null;\n activeAiDrawerSize?: number;\n minAiDrawerSize?: number;\n maxAiDrawerSize?: number;\n aiDrawerFocusControl?: FocusControlState;\n onActiveAiDrawerResize: (size: number) => void;\n}\n\ninterface AppLayoutWidgetizedState extends AppLayoutInternals {\n isNested: boolean;\n verticalOffsets: VerticalLayoutOutput;\n navigationAnimationDisabled: boolean;\n aiDrawerExpandedMode: boolean;\n splitPanelOffsets: {\n stickyVerticalBottomOffset: number;\n mainContentPaddingBlockEnd: number | undefined;\n };\n}\n\n// New widget interface\nexport interface AppLayoutState {\n rootRef: React.Ref<HTMLElement>;\n isIntersecting: boolean;\n // new state management\n widgetizedState: AppLayoutWidgetizedState;\n // the old object shape for backward compatibility\n appLayoutInternals: AppLayoutInternals;\n splitPanelInternals: SplitPanelProviderProps;\n}\n\nexport type AppLayoutPendingState = SomeOptional<\n AppLayoutState,\n 'appLayoutInternals' | 'splitPanelInternals' | 'widgetizedState' | 'rootRef'\n>;\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\n\nimport { BreadcrumbGroupProps } from '../../breadcrumb-group/interfaces';\nimport { ButtonGroupProps } from '../../button-group/interfaces';\nimport { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';\nimport { NonCancelableEventHandler } from '../../internal/events';\nimport { SomeOptional } from '../../internal/types';\nimport { AppLayoutProps, AppLayoutPropsWithDefaults } from '../interfaces';\nimport { SplitPanelProviderProps } from '../split-panel';\nimport { OnChangeParams } from '../utils/use-drawers';\nimport { FocusControlMultipleStates, FocusControlState } from '../utils/use-focus-control';\nimport { SplitPanelFocusControlState } from '../utils/use-split-panel-focus-control';\nimport { VerticalLayoutOutput } from './compute-layout';\n\nexport interface AppLayoutInternalProps extends AppLayoutPropsWithDefaults {\n navigationTriggerHide?: boolean;\n}\n\nexport type InternalDrawer = AppLayoutProps.Drawer & {\n defaultActive?: boolean;\n isExpandable?: boolean;\n ariaLabels: AppLayoutProps.Drawer['ariaLabels'] & { expandedModeButton?: string; exitExpandedModeButton?: string };\n header?: React.ReactNode;\n headerActions?: ReadonlyArray<ButtonGroupProps.Item>;\n onHeaderActionClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n};\n\n// Widgetization notice: structures in this file are shared multiple app layout instances, possibly different minor versions.\n// Treat these structures as an API and do not make incompatible changes.\n// Legacy widget interface\nexport interface AppLayoutInternals {\n ariaLabels: AppLayoutPropsWithDefaults['ariaLabels'];\n headerVariant: AppLayoutPropsWithDefaults['headerVariant'];\n placement: AppLayoutPropsWithDefaults['placement'];\n navigationOpen: AppLayoutPropsWithDefaults['navigationOpen'];\n navigationFocusControl: FocusControlState;\n navigation: React.ReactNode;\n splitPanelPosition: AppLayoutProps.SplitPanelPreferences['position'];\n splitPanelOpen: boolean;\n splitPanelControlId: string;\n splitPanelFocusControl: SplitPanelFocusControlState;\n splitPanelToggleConfig: SplitPanelSideToggleProps;\n isMobile: boolean;\n activeDrawer: InternalDrawer | undefined;\n activeDrawerSize: number;\n minDrawerSize: number;\n maxDrawerSize: number;\n minGlobalDrawersSizes: Record<string, number>;\n maxGlobalDrawersSizes: Record<string, number>;\n drawers: ReadonlyArray<InternalDrawer>;\n drawersFocusControl: FocusControlState;\n globalDrawersFocusControl: FocusControlMultipleStates;\n activeGlobalDrawersIds: ReadonlyArray<string>;\n activeGlobalDrawers: ReadonlyArray<InternalDrawer>;\n globalDrawers: ReadonlyArray<InternalDrawer>;\n activeGlobalDrawersSizes: Record<string, number>;\n stickyNotifications: AppLayoutPropsWithDefaults['stickyNotifications'];\n breadcrumbs: React.ReactNode;\n discoveredBreadcrumbs: BreadcrumbGroupProps | null;\n toolbarState: 'show' | 'hide';\n setToolbarState: (state: 'show' | 'hide') => void;\n verticalOffsets: VerticalLayoutOutput;\n drawersOpenQueue: ReadonlyArray<string>;\n setNotificationsHeight: (height: number) => void;\n setToolbarHeight: (height: number) => void;\n onSplitPanelToggle: () => void;\n onNavigationToggle: (open: boolean) => void;\n onActiveDrawerChange: (newDrawerId: string | null, params: OnChangeParams) => void;\n onActiveDrawerResize: (detail: { id: string; size: number }) => void;\n onActiveGlobalDrawersChange: (newDrawerId: string, params: OnChangeParams) => void;\n splitPanelAnimationDisabled?: boolean;\n expandedDrawerId: string | null;\n setExpandedDrawerId: (value: string | null) => void;\n aiDrawer?: InternalDrawer | null;\n onActiveAiDrawerChange?: (newDrawerId: string | null, params?: OnChangeParams) => void;\n activeAiDrawer?: InternalDrawer | null;\n activeAiDrawerId: string | null;\n activeAiDrawerSize?: number;\n minAiDrawerSize?: number;\n maxAiDrawerSize?: number;\n aiDrawerFocusControl?: FocusControlState;\n onActiveAiDrawerResize: (size: number) => void;\n}\n\ninterface AppLayoutWidgetizedState extends AppLayoutInternals {\n isNested: boolean;\n verticalOffsets: VerticalLayoutOutput;\n navigationAnimationDisabled: boolean;\n aiDrawerExpandedMode: boolean;\n splitPanelOffsets: {\n stickyVerticalBottomOffset: number;\n mainContentPaddingBlockEnd: number | undefined;\n };\n}\n\n// New widget interface\nexport interface AppLayoutState {\n rootRef: React.Ref<HTMLElement>;\n isIntersecting: boolean;\n // new state management\n widgetizedState: AppLayoutWidgetizedState;\n // the old object shape for backward compatibility\n appLayoutInternals: AppLayoutInternals;\n splitPanelInternals: SplitPanelProviderProps;\n}\n\nexport type AppLayoutPendingState = SomeOptional<\n AppLayoutState,\n 'appLayoutInternals' | 'splitPanelInternals' | 'widgetizedState' | 'rootRef'\n>;\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ButtonProps } from '../button/interfaces.js';
|
|
3
3
|
import { CancelableEventHandler } from '../internal/events/index.js';
|
|
4
|
-
import { ButtonGroupProps } from './interfaces.js';
|
|
4
|
+
import { ButtonGroupProps, InternalIconButton } from './interfaces.js';
|
|
5
5
|
interface IconButtonItemProps {
|
|
6
|
-
item:
|
|
6
|
+
item: InternalIconButton;
|
|
7
7
|
showTooltip: boolean;
|
|
8
8
|
showFeedback: boolean;
|
|
9
9
|
onTooltipDismiss: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button-item.d.ts","sourceRoot":"","sources":["../../../src/button-group/icon-button-item.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAK1C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,EAAE,sBAAsB,EAAuB,MAAM,6BAA6B,CAAC;AAE1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"icon-button-item.d.ts","sourceRoot":"","sources":["../../../src/button-group/icon-button-item.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAK1C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,EAAE,sBAAsB,EAAuB,MAAM,6BAA6B,CAAC;AAE1F,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAIvE,UAAU,mBAAmB;IAC3B,IAAI,EAAE,kBAAkB,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CACzE;AAED,QAAA,MAAM,cAAc,6FAqDnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -17,7 +17,7 @@ const IconButtonItem = forwardRef(({ item, showTooltip, showFeedback, onTooltipD
|
|
|
17
17
|
const canShowTooltip = Boolean(showTooltip && !item.disabled && !item.loading);
|
|
18
18
|
const canShowFeedback = Boolean(showTooltip && showFeedback && item.popoverFeedback);
|
|
19
19
|
return (React.createElement("div", { ref: containerRef },
|
|
20
|
-
React.createElement(InternalButton, { variant: "icon", loading: item.loading, loadingText: item.loadingText, disabled: item.disabled, disabledReason: showFeedback ? undefined : item.disabledReason, __focusable: canShowFeedback, iconName: hasIcon ? item.iconName : 'close', iconUrl: item.iconUrl, iconSvg: item.iconSvg, iconAlt: item.text, ariaLabel: item.text, onClick: event => fireCancelableEvent(onItemClick, { id: item.id }, event), ref: ref, "data-testid": item.id, "data-itemid": item.id, className: clsx(testUtilStyles.item, testUtilStyles['button-group-item']), __title: "" }, item.text),
|
|
20
|
+
React.createElement(InternalButton, { variant: "icon", loading: item.loading, loadingText: item.loadingText, disabled: item.disabled, disabledReason: showFeedback ? undefined : item.disabledReason, __focusable: canShowFeedback, iconName: hasIcon ? item.iconName : 'close', iconUrl: item.iconUrl, iconSvg: item.iconSvg, iconAlt: item.text, ariaLabel: item.text, onClick: event => fireCancelableEvent(onItemClick, { id: item.id }, event), ref: ref, "data-testid": item.id, "data-itemid": item.id, className: clsx(testUtilStyles.item, testUtilStyles['button-group-item']), analyticsAction: item.analyticsAction, __title: "" }, item.text),
|
|
21
21
|
(canShowTooltip || canShowFeedback) && (React.createElement(Tooltip, { trackRef: containerRef, trackKey: item.id, value: (showFeedback && React.createElement(InternalLiveRegion, { tagName: "span" }, item.popoverFeedback)) ||
|
|
22
22
|
item.text, className: clsx(testUtilStyles.tooltip, testUtilStyles['button-group-tooltip']), onDismiss: onTooltipDismiss }))));
|
|
23
23
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button-item.js","sourceRoot":"","sources":["../../../src/button-group/icon-button-item.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE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AAI,CAAC,cAAc,EAC9D,WAAW,EAAE,eAAe,EAC5B,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAC3C,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,OAAO,EAAE,IAAI,CAAC,IAAI,EAClB,SAAS,EAAE,IAAI,CAAC,IAAI,EACpB,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC,WAAW,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,EAC1E,GAAG,EAAE,GAAG,iBACK,IAAI,CAAC,EAAE,iBACP,IAAI,CAAC,EAAE,EACpB,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAAC,EACzE,OAAO,EAAC,EAAE,IAET,IAAI,CAAC,IAAI,CACK;QAChB,CAAC,cAAc,IAAI,eAAe,CAAC,IAAI,CACtC,oBAAC,OAAO,IACN,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,IAAI,CAAC,EAAE,EACjB,KAAK,EACH,CAAC,YAAY,IAAI,oBAAC,kBAAkB,IAAC,OAAO,EAAC,MAAM,IAAE,IAAI,CAAC,eAAe,CAAsB,CAAC;gBAChG,IAAI,CAAC,IAAI,EAEX,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAC,EAC/E,SAAS,EAAE,gBAAgB,GAC3B,CACH,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef } from 'react';\nimport clsx from 'clsx';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { ButtonProps } from '../button/interfaces.js';\nimport { InternalButton } from '../button/internal.js';\nimport Tooltip from '../internal/components/tooltip/index.js';\nimport { CancelableEventHandler, fireCancelableEvent } from '../internal/events/index.js';\nimport InternalLiveRegion from '../live-region/internal.js';\nimport { ButtonGroupProps } from './interfaces.js';\n\nimport testUtilStyles from './test-classes/styles.css.js';\n\ninterface IconButtonItemProps {\n item:
|
|
1
|
+
{"version":3,"file":"icon-button-item.js","sourceRoot":"","sources":["../../../src/button-group/icon-button-item.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAGzE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,OAAO,MAAM,yCAAyC,CAAC;AAC9D,OAAO,EAA0B,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAC1F,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAG5D,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAU1D,MAAM,cAAc,GAAG,UAAU,CAC/B,CACE,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAuB,EACvF,GAA+B,EAC/B,EAAE;IACF,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IACxD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;IAE9D,IAAI,CAAC,OAAO,EAAE;QACZ,QAAQ,CAAC,aAAa,EAAE,kCAAkC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;KACtE;IAED,MAAM,cAAc,GAAG,OAAO,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,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,IAAE,IAAI,CAAC,eAAe,CAAsB,CAAC;gBAChG,IAAI,CAAC,IAAI,EAEX,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAC,EAC/E,SAAS,EAAE,gBAAgB,GAC3B,CACH,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef } from 'react';\nimport clsx from 'clsx';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { ButtonProps } from '../button/interfaces.js';\nimport { InternalButton } from '../button/internal.js';\nimport Tooltip from '../internal/components/tooltip/index.js';\nimport { CancelableEventHandler, fireCancelableEvent } from '../internal/events/index.js';\nimport InternalLiveRegion from '../live-region/internal.js';\nimport { ButtonGroupProps, InternalIconButton } from './interfaces.js';\n\nimport testUtilStyles from './test-classes/styles.css.js';\n\ninterface IconButtonItemProps {\n item: InternalIconButton;\n showTooltip: boolean;\n showFeedback: boolean;\n onTooltipDismiss: () => void;\n onItemClick?: CancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n}\n\nconst IconButtonItem = forwardRef(\n (\n { item, showTooltip, showFeedback, onTooltipDismiss, onItemClick }: IconButtonItemProps,\n ref: React.Ref<ButtonProps.Ref>\n ) => {\n const containerRef = React.useRef<HTMLDivElement>(null);\n const hasIcon = item.iconName || item.iconUrl || item.iconSvg;\n\n if (!hasIcon) {\n warnOnce('ButtonGroup', `Missing icon for item with id: ${item.id}`);\n }\n\n const canShowTooltip = Boolean(showTooltip && !item.disabled && !item.loading);\n const canShowFeedback = Boolean(showTooltip && showFeedback && item.popoverFeedback);\n return (\n <div ref={containerRef}>\n <InternalButton\n variant=\"icon\"\n loading={item.loading}\n loadingText={item.loadingText}\n disabled={item.disabled}\n disabledReason={showFeedback ? undefined : item.disabledReason} // don't show disabled reason when popover feedback is shown\n __focusable={canShowFeedback}\n iconName={hasIcon ? item.iconName : 'close'}\n iconUrl={item.iconUrl}\n iconSvg={item.iconSvg}\n iconAlt={item.text}\n ariaLabel={item.text}\n onClick={event => fireCancelableEvent(onItemClick, { id: item.id }, event)}\n ref={ref}\n data-testid={item.id}\n data-itemid={item.id}\n className={clsx(testUtilStyles.item, testUtilStyles['button-group-item'])}\n analyticsAction={item.analyticsAction}\n __title=\"\"\n >\n {item.text}\n </InternalButton>\n {(canShowTooltip || canShowFeedback) && (\n <Tooltip\n trackRef={containerRef}\n trackKey={item.id}\n value={\n (showFeedback && <InternalLiveRegion tagName=\"span\">{item.popoverFeedback}</InternalLiveRegion>) ||\n item.text\n }\n className={clsx(testUtilStyles.tooltip, testUtilStyles['button-group-tooltip'])}\n onDismiss={onTooltipDismiss}\n />\n )}\n </div>\n );\n }\n);\n\nexport default IconButtonItem;\n"]}
|
|
@@ -101,8 +101,14 @@ export interface ButtonGroupProps extends BaseComponentProps {
|
|
|
101
101
|
*/
|
|
102
102
|
style?: ButtonGroupProps.Style;
|
|
103
103
|
}
|
|
104
|
+
export interface InternalIconButton extends ButtonGroupProps.IconButton {
|
|
105
|
+
analyticsAction?: string;
|
|
106
|
+
}
|
|
107
|
+
export type InternalItemOrGroup = InternalItem | ButtonGroupProps.Group;
|
|
108
|
+
export type InternalItem = InternalIconButton | ButtonGroupProps.IconToggleButton | ButtonGroupProps.IconFileInput | ButtonGroupProps.MenuDropdown;
|
|
104
109
|
export interface InternalButtonGroupProps extends SomeRequired<ButtonGroupProps, 'dropdownExpandToViewport'>, InternalBaseComponentProps {
|
|
105
110
|
style?: ButtonGroupProps.Style;
|
|
111
|
+
items: ReadonlyArray<InternalItemOrGroup>;
|
|
106
112
|
}
|
|
107
113
|
export declare namespace ButtonGroupProps {
|
|
108
114
|
type Variant = 'icon';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/button-group/interfaces.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IAC1D;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC;IAClC;;;;;;;;;;;;OAYG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwDG;IACH,KAAK,EAAE,aAAa,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACnD;;OAEG;IACH,WAAW,CAAC,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAC3E;;OAEG;IACH,aAAa,CAAC,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;IAC/E;;OAEG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC;CAChC;AAED,MAAM,WAAW,wBACf,SAAQ,YAAY,CAAC,gBAAgB,EAAE,0BAA0B,CAAC,EAChE,0BAA0B;IAC5B,KAAK,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/button-group/interfaces.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO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AAE,MAAM,CAAC;YACpB,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB,aAAa,CAAC,EAAE,MAAM,CAAC;YACvB,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,SAAS,CAAC,EAAE;gBACV,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,WAAW,CAAC,EAAE,MAAM,CAAC;aACtB,CAAC;SACH,CAAC;QACF,IAAI,CAAC,EAAE;YACL,KAAK,CAAC,EAAE;gBACN,MAAM,CAAC,EAAE,MAAM,CAAC;gBAChB,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAClB,KAAK,CAAC,EAAE,MAAM,CAAC;aAChB,CAAC;YACF,SAAS,CAAC,EAAE;gBACV,MAAM,CAAC,EAAE,MAAM,CAAC;gBAChB,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAClB,KAAK,CAAC,EAAE,MAAM,CAAC;aAChB,CAAC;YACF,SAAS,CAAC,EAAE;gBACV,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,WAAW,CAAC,EAAE,MAAM,CAAC;aACtB,CAAC;SACH,CAAC;KACH;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/button-group/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ButtonDropdownProps } from '../button-dropdown/interfaces';\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { SomeRequired } from '../internal/types';\n\nexport interface ButtonGroupProps extends BaseComponentProps {\n /**\n * Adds `aria-label` to the button group toolbar element.\n * Use this to provide a unique accessible name for each button group on the page.\n */\n ariaLabel?: string;\n /**\n * Determines the general styling of the button dropdown.\n * * `icon` for icon buttons.\n */\n variant: ButtonGroupProps.Variant;\n /**\n * Use this property to determine dropdown placement strategy for all menu dropdown items.\n *\n * By default, the dropdown height is constrained to fit inside the height of its next scrollable container element.\n * Enabling this property will allow the dropdown to extend beyond that container by using fixed positioning and\n * [React Portals](https://reactjs.org/docs/portals.html).\n *\n * Set this property if the dropdown would otherwise be constrained by a scrollable container,\n * for example inside table and split view layouts.\n *\n * We recommend you use discretion, and don't enable this property unless necessary\n * because fixed positioning results in a slight, visible lag when scrolling complex pages.\n */\n dropdownExpandToViewport?: boolean;\n /**\n * Array of objects with a number of supported types.\n *\n * ### icon-button\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick` handler and to focus the button using `ref.focus(id)`.\n * * `text` (string) - The name shown as a tooltip for this button.\n * * `disabled` (optional, boolean) - The disabled state indication for this button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for this button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `iconName` (optional, string) - Specifies the name of the icon, used with the [icon component](/components/icon/).\n * * `iconAlt` (optional, string) - Specifies alternate text for the icon when using `iconUrl`.\n * * `iconUrl` (optional, string) - Specifies the URL of a custom icon.\n * * `iconSvg` (optional, ReactNode) - Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `popoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button. Use to provide feedback to the user.\n *\n * ### icon-toggle-button\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick` handler and to focus the button using `ref.focus(id)`.\n * * `pressed` (boolean) - The toggle button pressed state.\n * * `text` (string) - The name shown as a tooltip for this button.\n * * `disabled` (optional, boolean) - The disabled state indication for this button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for this button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `iconName` (optional, string) - Specifies the name of the icon, used with the [icon component](/components/icon/).\n * * `iconUrl` (optional, string) - Specifies the URL of a custom icon.\n * * `iconSvg` (optional, ReactNode) - Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `pressedIconName` (optional, string) - Specifies the name of the icon in pressed state, used with the [icon component](/components/icon/).\n * * `pressedIconUrl` (optional, string) - Specifies the URL of a custom icon in pressed state.\n * * `pressedIconSvg` (optional, ReactNode) - Custom SVG icon in pressed state. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `popoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button. Use to provide feedback to the user.\n * * `pressedPopoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button in pressed state. Defaults to `popoverFeedback`.\n *\n * * ### file-input\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onFilesChange`.\n * * `text` (string) - The name of the menu button shown as a tooltip.\n * * `accept` (optional, string) - Specifies the native file input `accept` attribute to describe the allow-list of file types.\n * * `multiple` (optional, string) - Specifies the native file input `multiple` attribute to allow users entering more than one file.\n *\n * ### menu-dropdown\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick`.\n * * `text` (string) - The name of the menu button shown as a tooltip.\n * * `disabled` (optional, boolean) - The disabled state indication for the menu button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for the menu button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `items` (ButtonDropdownProps.ItemOrGroup[]) - The array of dropdown items that belong to this menu.\n *\n * ### group\n *\n * * `text` (string) - The name of the group rendered as ARIA label for this group.\n * * `items` ((ButtonGroupProps.IconButton | ButtonGroupProps.MenuDropdown)[]) - The array of items that belong to this group.\n */\n items: ReadonlyArray<ButtonGroupProps.ItemOrGroup>;\n /**\n * Called when the user clicks on an item, and the item is not disabled. The event detail object contains the id of the clicked item.\n */\n onItemClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n /**\n * Called when the user uploads files. The event detail object contains the id and files from the file input item.\n */\n onFilesChange?: NonCancelableEventHandler<ButtonGroupProps.FilesChangeDetails>;\n /**\n * @awsuiSystem core\n */\n style?: ButtonGroupProps.Style;\n}\n\nexport interface InternalButtonGroupProps\n extends SomeRequired<ButtonGroupProps, 'dropdownExpandToViewport'>,\n InternalBaseComponentProps {\n style?: ButtonGroupProps.Style;\n}\n\nexport namespace ButtonGroupProps {\n export type Variant = 'icon';\n\n export type ItemOrGroup = Item | Group;\n export type Item = IconButton | IconToggleButton | IconFileInput | MenuDropdown;\n\n export interface IconButton {\n type: 'icon-button';\n id: string;\n text: string;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n iconName?: IconProps.Name;\n iconAlt?: string;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n popoverFeedback?: React.ReactNode;\n }\n\n export interface IconToggleButton {\n type: 'icon-toggle-button';\n id: string;\n text: string;\n pressed: boolean;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n pressedIconName?: IconProps.Name;\n pressedIconUrl?: string;\n pressedIconSvg?: React.ReactNode;\n popoverFeedback?: React.ReactNode;\n pressedPopoverFeedback?: React.ReactNode;\n }\n\n export interface IconFileInput {\n type: 'icon-file-input';\n id: string;\n text: string;\n accept?: string;\n multiple?: boolean;\n }\n\n export interface MenuDropdown {\n type: 'menu-dropdown';\n id: string;\n text: string;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n items: ReadonlyArray<ButtonDropdownProps.ItemOrGroup>;\n }\n\n export interface Group {\n type: 'group';\n text: string;\n items: ReadonlyArray<ButtonGroupProps.Item>;\n }\n\n export interface ItemClickDetails {\n id: string;\n pressed?: boolean;\n checked?: boolean;\n }\n\n export interface FilesChangeDetails {\n id: string;\n files: File[];\n }\n\n export interface Ref {\n /**\n * Focuses button group item by id.\n */\n focus(itemId: string): void;\n }\n export interface Style {\n root?: {\n background?: string;\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n paddingBlock?: string;\n paddingInline?: string;\n boxShadow?: string;\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n item?: {\n color?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n boxShadow?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/button-group/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ButtonDropdownProps } from '../button-dropdown/interfaces';\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { SomeRequired } from '../internal/types';\n\nexport interface ButtonGroupProps extends BaseComponentProps {\n /**\n * Adds `aria-label` to the button group toolbar element.\n * Use this to provide a unique accessible name for each button group on the page.\n */\n ariaLabel?: string;\n /**\n * Determines the general styling of the button dropdown.\n * * `icon` for icon buttons.\n */\n variant: ButtonGroupProps.Variant;\n /**\n * Use this property to determine dropdown placement strategy for all menu dropdown items.\n *\n * By default, the dropdown height is constrained to fit inside the height of its next scrollable container element.\n * Enabling this property will allow the dropdown to extend beyond that container by using fixed positioning and\n * [React Portals](https://reactjs.org/docs/portals.html).\n *\n * Set this property if the dropdown would otherwise be constrained by a scrollable container,\n * for example inside table and split view layouts.\n *\n * We recommend you use discretion, and don't enable this property unless necessary\n * because fixed positioning results in a slight, visible lag when scrolling complex pages.\n */\n dropdownExpandToViewport?: boolean;\n /**\n * Array of objects with a number of supported types.\n *\n * ### icon-button\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick` handler and to focus the button using `ref.focus(id)`.\n * * `text` (string) - The name shown as a tooltip for this button.\n * * `disabled` (optional, boolean) - The disabled state indication for this button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for this button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `iconName` (optional, string) - Specifies the name of the icon, used with the [icon component](/components/icon/).\n * * `iconAlt` (optional, string) - Specifies alternate text for the icon when using `iconUrl`.\n * * `iconUrl` (optional, string) - Specifies the URL of a custom icon.\n * * `iconSvg` (optional, ReactNode) - Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `popoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button. Use to provide feedback to the user.\n *\n * ### icon-toggle-button\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick` handler and to focus the button using `ref.focus(id)`.\n * * `pressed` (boolean) - The toggle button pressed state.\n * * `text` (string) - The name shown as a tooltip for this button.\n * * `disabled` (optional, boolean) - The disabled state indication for this button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for this button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `iconName` (optional, string) - Specifies the name of the icon, used with the [icon component](/components/icon/).\n * * `iconUrl` (optional, string) - Specifies the URL of a custom icon.\n * * `iconSvg` (optional, ReactNode) - Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `pressedIconName` (optional, string) - Specifies the name of the icon in pressed state, used with the [icon component](/components/icon/).\n * * `pressedIconUrl` (optional, string) - Specifies the URL of a custom icon in pressed state.\n * * `pressedIconSvg` (optional, ReactNode) - Custom SVG icon in pressed state. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `popoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button. Use to provide feedback to the user.\n * * `pressedPopoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button in pressed state. Defaults to `popoverFeedback`.\n *\n * * ### file-input\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onFilesChange`.\n * * `text` (string) - The name of the menu button shown as a tooltip.\n * * `accept` (optional, string) - Specifies the native file input `accept` attribute to describe the allow-list of file types.\n * * `multiple` (optional, string) - Specifies the native file input `multiple` attribute to allow users entering more than one file.\n *\n * ### menu-dropdown\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick`.\n * * `text` (string) - The name of the menu button shown as a tooltip.\n * * `disabled` (optional, boolean) - The disabled state indication for the menu button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for the menu button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `items` (ButtonDropdownProps.ItemOrGroup[]) - The array of dropdown items that belong to this menu.\n *\n * ### group\n *\n * * `text` (string) - The name of the group rendered as ARIA label for this group.\n * * `items` ((ButtonGroupProps.IconButton | ButtonGroupProps.MenuDropdown)[]) - The array of items that belong to this group.\n */\n items: ReadonlyArray<ButtonGroupProps.ItemOrGroup>;\n /**\n * Called when the user clicks on an item, and the item is not disabled. The event detail object contains the id of the clicked item.\n */\n onItemClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n /**\n * Called when the user uploads files. The event detail object contains the id and files from the file input item.\n */\n onFilesChange?: NonCancelableEventHandler<ButtonGroupProps.FilesChangeDetails>;\n /**\n * @awsuiSystem core\n */\n style?: ButtonGroupProps.Style;\n}\n\nexport interface InternalIconButton extends ButtonGroupProps.IconButton {\n analyticsAction?: string;\n}\n\nexport type InternalItemOrGroup = InternalItem | ButtonGroupProps.Group;\nexport type InternalItem =\n | InternalIconButton\n | ButtonGroupProps.IconToggleButton\n | ButtonGroupProps.IconFileInput\n | ButtonGroupProps.MenuDropdown;\n\nexport interface InternalButtonGroupProps\n extends SomeRequired<ButtonGroupProps, 'dropdownExpandToViewport'>,\n InternalBaseComponentProps {\n style?: ButtonGroupProps.Style;\n items: ReadonlyArray<InternalItemOrGroup>;\n}\n\nexport namespace ButtonGroupProps {\n export type Variant = 'icon';\n\n export type ItemOrGroup = Item | Group;\n export type Item = IconButton | IconToggleButton | IconFileInput | MenuDropdown;\n\n export interface IconButton {\n type: 'icon-button';\n id: string;\n text: string;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n iconName?: IconProps.Name;\n iconAlt?: string;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n popoverFeedback?: React.ReactNode;\n }\n\n export interface IconToggleButton {\n type: 'icon-toggle-button';\n id: string;\n text: string;\n pressed: boolean;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n pressedIconName?: IconProps.Name;\n pressedIconUrl?: string;\n pressedIconSvg?: React.ReactNode;\n popoverFeedback?: React.ReactNode;\n pressedPopoverFeedback?: React.ReactNode;\n }\n\n export interface IconFileInput {\n type: 'icon-file-input';\n id: string;\n text: string;\n accept?: string;\n multiple?: boolean;\n }\n\n export interface MenuDropdown {\n type: 'menu-dropdown';\n id: string;\n text: string;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n items: ReadonlyArray<ButtonDropdownProps.ItemOrGroup>;\n }\n\n export interface Group {\n type: 'group';\n text: string;\n items: ReadonlyArray<ButtonGroupProps.Item>;\n }\n\n export interface ItemClickDetails {\n id: string;\n pressed?: boolean;\n checked?: boolean;\n }\n\n export interface FilesChangeDetails {\n id: string;\n files: File[];\n }\n\n export interface Ref {\n /**\n * Focuses button group item by id.\n */\n focus(itemId: string): void;\n }\n export interface Style {\n root?: {\n background?: string;\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n paddingBlock?: string;\n paddingInline?: string;\n boxShadow?: string;\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n item?: {\n color?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n boxShadow?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export var PACKAGE_SOURCE = "components";
|
|
2
|
-
export var PACKAGE_VERSION = "3.0.0 (
|
|
3
|
-
export var GIT_SHA = "
|
|
2
|
+
export var PACKAGE_VERSION = "3.0.0 (979d2709)";
|
|
3
|
+
export var GIT_SHA = "979d2709";
|
|
4
4
|
export var THEME = "open-source-visual-refresh";
|
|
5
5
|
export var SYSTEM = "console";
|
|
6
6
|
export var ALWAYS_VISUAL_REFRESH = true;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ButtonGroupProps } from '../../../button-group/interfaces';
|
|
1
2
|
import { NonCancelableEventHandler } from '../../events';
|
|
2
3
|
type DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;
|
|
3
4
|
interface MountContentContext {
|
|
@@ -35,6 +36,8 @@ export interface DrawerConfig {
|
|
|
35
36
|
unmountContent: (container: HTMLElement) => void;
|
|
36
37
|
preserveInactiveContent?: boolean;
|
|
37
38
|
onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;
|
|
39
|
+
headerActions?: ReadonlyArray<ButtonGroupProps.Item>;
|
|
40
|
+
onHeaderActionClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;
|
|
38
41
|
}
|
|
39
42
|
declare const updatableProperties: readonly ["badge", "resizable", "defaultSize", "orderPriority", "defaultActive", "onResize"];
|
|
40
43
|
export type UpdateDrawerConfig = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawers.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/drawers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"drawers.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/drawers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAGzD,KAAK,sBAAsB,GAAG,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,KAAK,IAAI,CAAC;AAE/E,UAAU,mBAAmB;IAC3B,kBAAkB,EAAE,sBAAsB,CAAC;CAC5C;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,OAAO,CAAC;IAChB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,UAAU,EAAE;QACV,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,uBAAuB,CAAC,EAAE,MAAM,CAAC;QACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,YAAY,CAAC,EAAE,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;IAClE,OAAO,CAAC,oBAAoB,CAAsC;IAElE,cAAc,aAKR;IAEN,cAAc,WAAY,YAAY,UAMpC;IAEF,YAAY,8BAA+B,kBAAkB,UAgB3D;IAEF,mBAAmB,aAAc,2BAA2B,gBAa1D;IAEF,sBAAsB,aAEpB;IAEF,cAAc,aAAc,sBAAsB,gBAahD;IAEF,cAAc,aAAc,sBAAsB,gBAahD;IAEF,UAAU,aAAc,MAAM,WAAW,qBAAqB,UAE5D;IAEF,WAAW,aAAc,MAAM,WAAW,qBAAqB,UAE7D;IAEF,gBAAgB,aAAc,qBAAqB,gBAMjD;IAEF,cAAc,aAAc,qBAAqB,gBAa/C;IAEF,YAAY,aAAc,MAAM,QAAQ,MAAM,UAE5C;IAEF,eAAe,uBAEb;IAEF,aAAa,CAAC,GAAG,GAAE,OAAO,CAAC,gBAAgB,CAAM,GAAG,gBAAgB;IASpE,eAAe,CAAC,WAAW,GAAE,OAAO,CAAC,kBAAkB,CAAM,GAAG,kBAAkB;CAUnF"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
2
|
import debounce from '../../debounce';
|
|
5
3
|
import { reportRuntimeApiWarning } from '../helpers/metrics';
|
|
6
4
|
const updatableProperties = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawers.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/drawers.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAwC7D,MAAM,mBAAmB,GAAG;IAC1B,OAAO;IACP,WAAW;IACX,aAAa;IACb,eAAe;IACf,eAAe;IACf,UAAU;CACF,CAAC;AAkCX,MAAM,OAAO,iBA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D,MAAA,WAAW,CAAC,cAAc,oCAA1B,WAAW,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QACnD,MAAA,WAAW,CAAC,gBAAgB,oCAA5B,WAAW,CAAC,gBAAgB,GAAK,IAAI,CAAC,gBAAgB,EAAC;QACvD,MAAA,WAAW,CAAC,eAAe,oCAA3B,WAAW,CAAC,eAAe,GAAK,IAAI,CAAC,eAAe,EAAC;QACrD,OAAO,WAAiC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport debounce from '../../debounce';\nimport { NonCancelableEventHandler } from '../../events';\nimport { reportRuntimeApiWarning } from '../helpers/metrics';\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\nexport interface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerConfig {\n id: string;\n type?: 'local' | 'global';\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n resizeHandleTooltipText?: string;\n expandedModeButton?: string;\n };\n isExpandable?: boolean;\n badge?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n orderPriority?: number;\n defaultActive?: boolean;\n trigger?: {\n iconSvg: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n}\n\nconst updatableProperties = [\n 'badge',\n 'resizable',\n 'defaultSize',\n 'orderPriority',\n 'defaultActive',\n 'onResize',\n] as const;\n\nexport type UpdateDrawerConfig = { id: DrawerConfig['id'] } & Partial<\n Pick<DrawerConfig, (typeof updatableProperties)[number]>\n>;\n\ntype DrawersRegistrationListener = (drawers: Array<DrawerConfig>) => void;\ntype DrawersUpdateListener = (drawers: Array<DrawerConfig>) => void;\n\nexport type DrawersToggledListener = (drawerId: string, params?: OpenCloseDrawerParams) => void;\ntype DrawersResizeListener = (drawerId: string, size: number) => void;\n\ninterface OpenCloseDrawerParams {\n initiatedByUserAction: boolean;\n}\n\nexport interface DrawersApiPublic {\n registerDrawer(config: DrawerConfig): void;\n updateDrawer(config: UpdateDrawerConfig): void;\n openDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n closeDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n resizeDrawer(drawerId: string, size: number): void;\n}\n\nexport interface DrawersApiInternal {\n clearRegisteredDrawers(): void;\n onDrawersRegistered(listener: DrawersRegistrationListener): () => void;\n onDrawerOpened(listener: DrawersToggledListener): () => void;\n onDrawerClosed(listener: DrawersToggledListener): () => void;\n onDrawerResize(listener: DrawersResizeListener): () => void;\n onDrawersUpdated(listener: DrawersUpdateListener): void;\n getDrawersState(): Array<DrawerConfig>;\n}\n\nexport class DrawersController {\n private drawers: Array<DrawerConfig> = [];\n private drawersRegistrationListener: DrawersRegistrationListener | null = null;\n private drawerOpenedListener: DrawersToggledListener | null = null;\n private drawerClosedListener: DrawersToggledListener | null = null;\n private drawersUpdateListeners: Array<DrawersUpdateListener> = [];\n private drawerResizeListener: DrawersResizeListener | null = null;\n\n scheduleUpdate = debounce(() => {\n this.drawersRegistrationListener?.(this.drawers);\n this.drawersUpdateListeners.forEach(drawersUpdateListeners => {\n drawersUpdateListeners?.(this.drawers);\n });\n }, 0);\n\n registerDrawer = (config: DrawerConfig) => {\n if (this.drawers.find(drawer => drawer.id === config.id)) {\n reportRuntimeApiWarning('app-layout-drawers', `drawer with id \"${config.id}\" is already registered`);\n }\n this.drawers = this.drawers.concat(config);\n this.scheduleUpdate();\n };\n\n updateDrawer = ({ id: drawerId, ...rest }: UpdateDrawerConfig) => {\n const drawerIndex = this.drawers.findIndex(({ id }) => id === drawerId);\n const oldDrawerConfig = this.drawers?.[drawerIndex];\n if (!oldDrawerConfig) {\n throw new Error(`[AwsUi] [runtime drawers] drawer with id ${drawerId} not found`);\n }\n const drawers = this.drawers.slice();\n const updatedDrawer = { ...oldDrawerConfig };\n for (const key of updatableProperties) {\n if (key in rest) {\n updatedDrawer[key] = (rest as any)[key];\n }\n }\n drawers[drawerIndex] = updatedDrawer;\n this.drawers = drawers;\n this.scheduleUpdate();\n };\n\n onDrawersRegistered = (listener: DrawersRegistrationListener) => {\n if (this.drawersRegistrationListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawersRegistered'\n );\n }\n this.drawersRegistrationListener = listener;\n this.scheduleUpdate();\n return () => {\n this.drawersRegistrationListener = null;\n this.drawersUpdateListeners = [];\n };\n };\n\n clearRegisteredDrawers = () => {\n this.drawers = [];\n };\n\n onDrawerOpened = (listener: DrawersToggledListener) => {\n if (this.drawerOpenedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerOpened'\n );\n }\n\n this.drawerOpenedListener = listener;\n\n return () => {\n this.drawerOpenedListener = null;\n };\n };\n\n onDrawerClosed = (listener: DrawersToggledListener) => {\n if (this.drawerClosedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerClosed'\n );\n }\n\n this.drawerClosedListener = listener;\n\n return () => {\n this.drawerClosedListener = null;\n };\n };\n\n openDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerOpenedListener?.(drawerId, params);\n };\n\n closeDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerClosedListener?.(drawerId, params);\n };\n\n onDrawersUpdated = (listener: DrawersUpdateListener) => {\n this.drawersUpdateListeners.push(listener);\n\n return () => {\n this.drawersUpdateListeners = this.drawersUpdateListeners.filter(item => item !== listener);\n };\n };\n\n onDrawerResize = (listener: DrawersResizeListener) => {\n if (this.drawerResizeListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerResize'\n );\n }\n\n this.drawerResizeListener = listener;\n\n return () => {\n this.drawerResizeListener = null;\n };\n };\n\n resizeDrawer = (drawerId: string, size: number) => {\n this.drawerResizeListener?.(drawerId, size);\n };\n\n getDrawersState = () => {\n return this.drawers;\n };\n\n installPublic(api: Partial<DrawersApiPublic> = {}): DrawersApiPublic {\n api.registerDrawer ??= this.registerDrawer;\n api.updateDrawer ??= this.updateDrawer;\n api.openDrawer ??= this.openDrawer;\n api.closeDrawer ??= this.closeDrawer;\n api.resizeDrawer ??= this.resizeDrawer;\n return api as DrawersApiPublic;\n }\n\n installInternal(internalApi: Partial<DrawersApiInternal> = {}): DrawersApiInternal {\n internalApi.clearRegisteredDrawers ??= this.clearRegisteredDrawers;\n internalApi.onDrawersRegistered ??= this.onDrawersRegistered;\n internalApi.onDrawerOpened ??= this.onDrawerOpened;\n internalApi.onDrawerClosed ??= this.onDrawerClosed;\n internalApi.onDrawerResize ??= this.onDrawerResize;\n internalApi.onDrawersUpdated ??= this.onDrawersUpdated;\n internalApi.getDrawersState ??= this.getDrawersState;\n return internalApi as DrawersApiInternal;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"drawers.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/drawers.ts"],"names":[],"mappings":";AAGA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AA0C7D,MAAM,mBAAmB,GAAG;IAC1B,OAAO;IACP,WAAW;IACX,aAAa;IACb,eAAe;IACf,eAAe;IACf,UAAU;CACF,CAAC;AAkCX,MAAM,OAAO,iBAAiB;IAA9B;QACU,YAAO,GAAwB,EAAE,CAAC;QAClC,gCAA2B,GAAuC,IAAI,CAAC;QACvE,yBAAoB,GAAkC,IAAI,CAAC;QAC3D,yBAAoB,GAAkC,IAAI,CAAC;QAC3D,2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AI,CAAC,gBAAgB,EAAC;QACvD,MAAA,WAAW,CAAC,eAAe,oCAA3B,WAAW,CAAC,eAAe,GAAK,IAAI,CAAC,eAAe,EAAC;QACrD,OAAO,WAAiC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonGroupProps } from '../../../button-group/interfaces';\nimport debounce from '../../debounce';\nimport { NonCancelableEventHandler } from '../../events';\nimport { reportRuntimeApiWarning } from '../helpers/metrics';\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\nexport interface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerConfig {\n id: string;\n type?: 'local' | 'global';\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n resizeHandleTooltipText?: string;\n expandedModeButton?: string;\n };\n isExpandable?: boolean;\n badge?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n orderPriority?: number;\n defaultActive?: boolean;\n trigger?: {\n iconSvg: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n headerActions?: ReadonlyArray<ButtonGroupProps.Item>;\n onHeaderActionClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n}\n\nconst updatableProperties = [\n 'badge',\n 'resizable',\n 'defaultSize',\n 'orderPriority',\n 'defaultActive',\n 'onResize',\n] as const;\n\nexport type UpdateDrawerConfig = { id: DrawerConfig['id'] } & Partial<\n Pick<DrawerConfig, (typeof updatableProperties)[number]>\n>;\n\ntype DrawersRegistrationListener = (drawers: Array<DrawerConfig>) => void;\ntype DrawersUpdateListener = (drawers: Array<DrawerConfig>) => void;\n\nexport type DrawersToggledListener = (drawerId: string, params?: OpenCloseDrawerParams) => void;\ntype DrawersResizeListener = (drawerId: string, size: number) => void;\n\ninterface OpenCloseDrawerParams {\n initiatedByUserAction: boolean;\n}\n\nexport interface DrawersApiPublic {\n registerDrawer(config: DrawerConfig): void;\n updateDrawer(config: UpdateDrawerConfig): void;\n openDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n closeDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n resizeDrawer(drawerId: string, size: number): void;\n}\n\nexport interface DrawersApiInternal {\n clearRegisteredDrawers(): void;\n onDrawersRegistered(listener: DrawersRegistrationListener): () => void;\n onDrawerOpened(listener: DrawersToggledListener): () => void;\n onDrawerClosed(listener: DrawersToggledListener): () => void;\n onDrawerResize(listener: DrawersResizeListener): () => void;\n onDrawersUpdated(listener: DrawersUpdateListener): void;\n getDrawersState(): Array<DrawerConfig>;\n}\n\nexport class DrawersController {\n private drawers: Array<DrawerConfig> = [];\n private drawersRegistrationListener: DrawersRegistrationListener | null = null;\n private drawerOpenedListener: DrawersToggledListener | null = null;\n private drawerClosedListener: DrawersToggledListener | null = null;\n private drawersUpdateListeners: Array<DrawersUpdateListener> = [];\n private drawerResizeListener: DrawersResizeListener | null = null;\n\n scheduleUpdate = debounce(() => {\n this.drawersRegistrationListener?.(this.drawers);\n this.drawersUpdateListeners.forEach(drawersUpdateListeners => {\n drawersUpdateListeners?.(this.drawers);\n });\n }, 0);\n\n registerDrawer = (config: DrawerConfig) => {\n if (this.drawers.find(drawer => drawer.id === config.id)) {\n reportRuntimeApiWarning('app-layout-drawers', `drawer with id \"${config.id}\" is already registered`);\n }\n this.drawers = this.drawers.concat(config);\n this.scheduleUpdate();\n };\n\n updateDrawer = ({ id: drawerId, ...rest }: UpdateDrawerConfig) => {\n const drawerIndex = this.drawers.findIndex(({ id }) => id === drawerId);\n const oldDrawerConfig = this.drawers?.[drawerIndex];\n if (!oldDrawerConfig) {\n throw new Error(`[AwsUi] [runtime drawers] drawer with id ${drawerId} not found`);\n }\n const drawers = this.drawers.slice();\n const updatedDrawer = { ...oldDrawerConfig };\n for (const key of updatableProperties) {\n if (key in rest) {\n updatedDrawer[key] = (rest as any)[key];\n }\n }\n drawers[drawerIndex] = updatedDrawer;\n this.drawers = drawers;\n this.scheduleUpdate();\n };\n\n onDrawersRegistered = (listener: DrawersRegistrationListener) => {\n if (this.drawersRegistrationListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawersRegistered'\n );\n }\n this.drawersRegistrationListener = listener;\n this.scheduleUpdate();\n return () => {\n this.drawersRegistrationListener = null;\n this.drawersUpdateListeners = [];\n };\n };\n\n clearRegisteredDrawers = () => {\n this.drawers = [];\n };\n\n onDrawerOpened = (listener: DrawersToggledListener) => {\n if (this.drawerOpenedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerOpened'\n );\n }\n\n this.drawerOpenedListener = listener;\n\n return () => {\n this.drawerOpenedListener = null;\n };\n };\n\n onDrawerClosed = (listener: DrawersToggledListener) => {\n if (this.drawerClosedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerClosed'\n );\n }\n\n this.drawerClosedListener = listener;\n\n return () => {\n this.drawerClosedListener = null;\n };\n };\n\n openDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerOpenedListener?.(drawerId, params);\n };\n\n closeDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerClosedListener?.(drawerId, params);\n };\n\n onDrawersUpdated = (listener: DrawersUpdateListener) => {\n this.drawersUpdateListeners.push(listener);\n\n return () => {\n this.drawersUpdateListeners = this.drawersUpdateListeners.filter(item => item !== listener);\n };\n };\n\n onDrawerResize = (listener: DrawersResizeListener) => {\n if (this.drawerResizeListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerResize'\n );\n }\n\n this.drawerResizeListener = listener;\n\n return () => {\n this.drawerResizeListener = null;\n };\n };\n\n resizeDrawer = (drawerId: string, size: number) => {\n this.drawerResizeListener?.(drawerId, size);\n };\n\n getDrawersState = () => {\n return this.drawers;\n };\n\n installPublic(api: Partial<DrawersApiPublic> = {}): DrawersApiPublic {\n api.registerDrawer ??= this.registerDrawer;\n api.updateDrawer ??= this.updateDrawer;\n api.openDrawer ??= this.openDrawer;\n api.closeDrawer ??= this.closeDrawer;\n api.resizeDrawer ??= this.resizeDrawer;\n return api as DrawersApiPublic;\n }\n\n installInternal(internalApi: Partial<DrawersApiInternal> = {}): DrawersApiInternal {\n internalApi.clearRegisteredDrawers ??= this.clearRegisteredDrawers;\n internalApi.onDrawersRegistered ??= this.onDrawersRegistered;\n internalApi.onDrawerOpened ??= this.onDrawerOpened;\n internalApi.onDrawerClosed ??= this.onDrawerClosed;\n internalApi.onDrawerResize ??= this.onDrawerResize;\n internalApi.onDrawersUpdated ??= this.onDrawersUpdated;\n internalApi.getDrawersState ??= this.getDrawersState;\n return internalApi as DrawersApiInternal;\n }\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ButtonGroupProps } from '../../../button-group/interfaces';
|
|
1
2
|
import { NonCancelableEventHandler } from '../../events';
|
|
2
3
|
interface Message<Type, Payload> {
|
|
3
4
|
type: Type;
|
|
@@ -40,6 +41,8 @@ export interface DrawerPayload {
|
|
|
40
41
|
onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;
|
|
41
42
|
mountHeader?: (container: HTMLElement) => void;
|
|
42
43
|
unmountHeader?: (container: HTMLElement) => void;
|
|
44
|
+
headerActions?: ReadonlyArray<ButtonGroupProps.Item>;
|
|
45
|
+
onHeaderActionClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;
|
|
43
46
|
}
|
|
44
47
|
export type RegisterDrawerMessage = Message<'registerLeftDrawer', DrawerPayload>;
|
|
45
48
|
export type UpdateDrawerConfigMessage = Message<'updateDrawerConfig', Omit<DrawerPayload, 'mountContent' | 'unmountContent' | 'mountHeader' | 'unmountHeader'>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/widget/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEzD,UAAU,OAAO,CAAC,IAAI,EAAE,OAAO;IAC7B,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,KAAK,sBAAsB,GAAG,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,KAAK,IAAI,CAAC;AAE/E,UAAU,mBAAmB;IAC3B,kBAAkB,EAAE,sBAAsB,CAAC;CAC5C;AAED,UAAU,uBAAuB;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE;QACV,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,uBAAuB,CAAC,EAAE,MAAM,CAAC;QACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,sBAAsB,CAAC,EAAE,MAAM,CAAC;KACjC,CAAC;IACF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,yBAAyB,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC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,IAAI,CAAC,aAAa,EAAE,cAAc,GAAG,gBAAgB,GAAG,aAAa,GAAG,eAAe,CAAC,CACzF,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,YAAY,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AACtE,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,aAAa,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AACxE,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAExF,MAAM,MAAM,sBAAsB,GAC9B,yBAAyB,GACzB,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,CAAC;AAExB,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,GAAG,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/widget/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { NonCancelableEventHandler } from '../../events';\n\ninterface Message<Type, Payload> {\n type: Type;\n payload: Payload;\n}\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\ninterface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerPayload {\n id: string;\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n resizeHandleTooltipText?: string;\n expandedModeButton?: string;\n exitExpandedModeButton?: string;\n };\n isExpandable?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n defaultActive?: boolean;\n trigger?: {\n iconSvg?: string;\n customIcon?: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n mountHeader?: (container: HTMLElement) => void;\n unmountHeader?: (container: HTMLElement) => void;\n}\n\nexport type RegisterDrawerMessage = Message<'registerLeftDrawer', DrawerPayload>;\nexport type UpdateDrawerConfigMessage = Message<\n 'updateDrawerConfig',\n Omit<DrawerPayload, 'mountContent' | 'unmountContent' | 'mountHeader' | 'unmountHeader'>\n>;\nexport type OpenDrawerMessage = Message<'openDrawer', { id: string }>;\nexport type CloseDrawerMessage = Message<'closeDrawer', { id: string }>;\nexport type ResizeDrawerMessage = Message<'resizeDrawer', { id: string; size: number }>;\n\nexport type AppLayoutUpdateMessage =\n | UpdateDrawerConfigMessage\n | OpenDrawerMessage\n | CloseDrawerMessage\n | ResizeDrawerMessage;\n\nexport type AppLayoutMessage = RegisterDrawerMessage | AppLayoutUpdateMessage;\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/widget/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonGroupProps } from '../../../button-group/interfaces';\nimport { NonCancelableEventHandler } from '../../events';\n\ninterface Message<Type, Payload> {\n type: Type;\n payload: Payload;\n}\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\ninterface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerPayload {\n id: string;\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n resizeHandleTooltipText?: string;\n expandedModeButton?: string;\n exitExpandedModeButton?: string;\n };\n isExpandable?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n defaultActive?: boolean;\n trigger?: {\n iconSvg?: string;\n customIcon?: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n mountHeader?: (container: HTMLElement) => void;\n unmountHeader?: (container: HTMLElement) => void;\n headerActions?: ReadonlyArray<ButtonGroupProps.Item>;\n onHeaderActionClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n}\n\nexport type RegisterDrawerMessage = Message<'registerLeftDrawer', DrawerPayload>;\nexport type UpdateDrawerConfigMessage = Message<\n 'updateDrawerConfig',\n Omit<DrawerPayload, 'mountContent' | 'unmountContent' | 'mountHeader' | 'unmountHeader'>\n>;\nexport type OpenDrawerMessage = Message<'openDrawer', { id: string }>;\nexport type CloseDrawerMessage = Message<'closeDrawer', { id: string }>;\nexport type ResizeDrawerMessage = Message<'resizeDrawer', { id: string; size: number }>;\n\nexport type AppLayoutUpdateMessage =\n | UpdateDrawerConfigMessage\n | OpenDrawerMessage\n | CloseDrawerMessage\n | ResizeDrawerMessage;\n\nexport type AppLayoutMessage = RegisterDrawerMessage | AppLayoutUpdateMessage;\n"]}
|
|
@@ -5,6 +5,6 @@ export interface FilterProps extends InternalInputProps {
|
|
|
5
5
|
ref?: React.Ref<HTMLInputElement>;
|
|
6
6
|
filteringType: SelectProps.FilteringType;
|
|
7
7
|
}
|
|
8
|
-
declare const Filter: React.ForwardRefExoticComponent<Pick<FilterProps, "disabled" | "autoComplete" | "autoFocus" | "name" | "className" | "id" | "placeholder" | "inputMode" | "type" | "readOnly" | "step" | "value" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "onKeyUp" | "warning" | "clearAriaLabel" | "ariaLabel" | "__internalRootRef" | "ariaLabelledby" | "ariaDescribedby" | "__injectAnalyticsComponentMetadata" | "__skipNativeAttributesWarnings" | "invalid" | "controlId" | "
|
|
8
|
+
declare const Filter: React.ForwardRefExoticComponent<Pick<FilterProps, "disabled" | "autoComplete" | "autoFocus" | "name" | "className" | "id" | "placeholder" | "inputMode" | "type" | "readOnly" | "step" | "value" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "onKeyUp" | "warning" | "clearAriaLabel" | "ariaLabel" | "__internalRootRef" | "ariaLabelledby" | "ariaDescribedby" | "__injectAnalyticsComponentMetadata" | "__skipNativeAttributesWarnings" | "invalid" | "controlId" | "ariaRequired" | "filteringType" | "nativeInputAttributes" | "disableBrowserAutocorrect" | "spellcheck" | "__leftIcon" | "__leftIconVariant" | "__onLeftIconClick" | "__rightIcon" | "__onRightIconClick" | "__noBorderRadius" | "__onDelayedInput" | "__onBlurWithDetail" | "__inheritFormFieldProps"> & React.RefAttributes<HTMLInputElement>>;
|
|
9
9
|
export default Filter;
|
|
10
10
|
//# sourceMappingURL=filter.d.ts.map
|