@cloudscape-design/components-themeable 3.0.1228 → 3.0.1230

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/error-boundary/styles.scss +2 -1
  3. package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
  4. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.d.ts.map +1 -1
  5. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js +52 -46
  6. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js.map +1 -1
  7. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.d.ts.map +1 -1
  8. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.js +66 -64
  9. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.js.map +1 -1
  10. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.d.ts.map +1 -1
  11. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.js +56 -54
  12. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.js.map +1 -1
  13. package/lib/internal/template/app-layout/visual-refresh-toolbar/index.d.ts.map +1 -1
  14. package/lib/internal/template/app-layout/visual-refresh-toolbar/index.js +3 -1
  15. package/lib/internal/template/app-layout/visual-refresh-toolbar/index.js.map +1 -1
  16. package/lib/internal/template/app-layout/visual-refresh-toolbar/internal.d.ts +5 -5
  17. package/lib/internal/template/app-layout/visual-refresh-toolbar/internal.d.ts.map +1 -1
  18. package/lib/internal/template/app-layout/visual-refresh-toolbar/state/index.d.ts +3 -2
  19. package/lib/internal/template/app-layout/visual-refresh-toolbar/state/index.d.ts.map +1 -1
  20. package/lib/internal/template/app-layout/visual-refresh-toolbar/state/index.js +6 -1
  21. package/lib/internal/template/app-layout/visual-refresh-toolbar/state/index.js.map +1 -1
  22. package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.d.ts.map +1 -1
  23. package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js +54 -49
  24. package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js.map +1 -1
  25. package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.d.ts.map +1 -1
  26. package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.js +31 -26
  27. package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
  28. package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/after-main-slot.d.ts +3 -2
  29. package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/after-main-slot.d.ts.map +1 -1
  30. package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/after-main-slot.js +6 -2
  31. package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/after-main-slot.js.map +1 -1
  32. package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/before-main-slot.d.ts +3 -2
  33. package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/before-main-slot.d.ts.map +1 -1
  34. package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/before-main-slot.js +6 -2
  35. package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/before-main-slot.js.map +1 -1
  36. package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/bottom-content-slot.d.ts +3 -2
  37. package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/bottom-content-slot.d.ts.map +1 -1
  38. package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/bottom-content-slot.js +6 -1
  39. package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/bottom-content-slot.js.map +1 -1
  40. package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/top-content-slot.d.ts +3 -2
  41. package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/top-content-slot.d.ts.map +1 -1
  42. package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/top-content-slot.js +4 -1
  43. package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/top-content-slot.js.map +1 -1
  44. package/lib/internal/template/date-range-picker/index.d.ts.map +1 -1
  45. package/lib/internal/template/date-range-picker/index.js +7 -4
  46. package/lib/internal/template/date-range-picker/index.js.map +1 -1
  47. package/lib/internal/template/date-range-picker/interfaces.d.ts +7 -0
  48. package/lib/internal/template/date-range-picker/interfaces.d.ts.map +1 -1
  49. package/lib/internal/template/date-range-picker/interfaces.js.map +1 -1
  50. package/lib/internal/template/error-boundary/interfaces.d.ts +3 -0
  51. package/lib/internal/template/error-boundary/interfaces.d.ts.map +1 -1
  52. package/lib/internal/template/error-boundary/interfaces.js.map +1 -1
  53. package/lib/internal/template/error-boundary/internal.d.ts +2 -1
  54. package/lib/internal/template/error-boundary/internal.d.ts.map +1 -1
  55. package/lib/internal/template/error-boundary/internal.js +11 -0
  56. package/lib/internal/template/error-boundary/internal.js.map +1 -1
  57. package/lib/internal/template/error-boundary/styles.css.js +5 -4
  58. package/lib/internal/template/error-boundary/styles.scoped.css +5 -4
  59. package/lib/internal/template/error-boundary/styles.selectors.js +5 -4
  60. package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
  61. package/lib/internal/template/internal/components/button-trigger/index.d.ts +0 -1
  62. package/lib/internal/template/internal/components/button-trigger/index.d.ts.map +1 -1
  63. package/lib/internal/template/internal/components/button-trigger/index.js +1 -2
  64. package/lib/internal/template/internal/components/button-trigger/index.js.map +1 -1
  65. package/lib/internal/template/internal/environment.js +2 -2
  66. package/lib/internal/template/internal/environment.json +2 -2
  67. package/package.json +1 -1
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "b8108b4268f35b043b537f0dcf13c353fdde2876"
2
+ "commit": "d579b631db8efbb11b7938aa9b4e6f915b8d271f"
3
3
  }
@@ -6,6 +6,7 @@
6
6
  .error-boundary,
7
7
  .header,
8
8
  .description,
9
- .action {
9
+ .action,
10
+ .app-layout-part-fallback {
10
11
  display: contents;
11
12
  }
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Build environment
3
- $awsui-commit-hash: "b8108b42";
3
+ $awsui-commit-hash: "d579b631";
4
4
  // Manually managed CSS-variables
5
5
  $maxContentWidth: --awsui-max-content-width-n6lfw8;
6
6
  $minContentWidth: --awsui-min-content-width-n6lfw8;
@@ -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":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAUtC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAOxD,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,EACV,CAAC,cAAc,GAAG;QAChB,uBAAuB,CAAC,EAAE;YACxB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;SAC9B,CAAC;KACH,CAAC,GACF,IAAI,CAAC;IACT,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,wBAAgB,qCAAqC,CAAC,EACpD,kBAAkB,EAClB,IAAI,EACJ,cAAc,EACd,aAAa,GACd,EAAE,0CAA0C,eAwM5C"}
1
+ {"version":3,"file":"global-ai-drawer.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAWtC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAOxD,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,EACV,CAAC,cAAc,GAAG;QAChB,uBAAuB,CAAC,EAAE;YACxB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;SAC9B,CAAC;KACH,CAAC,GACF,IAAI,CAAC;IACT,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,wBAAgB,qCAAqC,CAAC,EACpD,kBAAkB,EAClB,IAAI,EACJ,cAAc,EACd,aAAa,GACd,EAAE,0CAA0C,eAgN5C"}
@@ -4,6 +4,7 @@ import React, { useRef } from 'react';
4
4
  import { Transition } from 'react-transition-group';
5
5
  import clsx from 'clsx';
6
6
  import ButtonGroup from '../../../button-group/internal';
7
+ import { AppLayoutBuiltInErrorBoundary } from '../../../error-boundary/internal';
7
8
  import PanelResizeHandle from '../../../internal/components/panel-resize-handle';
8
9
  import customCssProps from '../../../internal/generated/custom-css-properties';
9
10
  import { usePrevious } from '../../../internal/hooks/use-previous';
@@ -73,51 +74,56 @@ export function AppLayoutGlobalAiDrawerImplementation({ appLayoutInternals, show
73
74
  ...drawerActions,
74
75
  ];
75
76
  }
76
- return (React.createElement(Transition, { nodeRef: drawerRef, in: show, appear: show, mountOnEnter: true, timeout: 250 }, drawerTransitionState => {
77
- return (React.createElement(Transition, { nodeRef: drawerRef, in: isExpanded, timeout: 250 }, expandedTransitionState => {
78
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
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'], {
80
- [sharedStyles['with-motion-horizontal']]: !animationDisabled,
81
- [testutilStyles['active-drawer']]: show,
82
- [styles['drawer-hidden']]: !show && drawerTransitionState === 'exited',
83
- [testutilStyles['drawer-closed']]: !activeAiDrawer,
84
- [styles['drawer-expanded']]: isExpanded,
85
- }), ref: drawerRef, onBlur: e => {
86
- if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {
87
- aiDrawerFocusControl === null || aiDrawerFocusControl === void 0 ? void 0 : aiDrawerFocusControl.loseFocus();
88
- }
89
- }, style: {
90
- blockSize: drawerHeight,
91
- insetBlockStart: `${placement.insetBlockStart}px`,
92
- ...(!isMobile && {
93
- [customCssProps.drawerMinSize]: `${size}px`,
94
- [customCssProps.drawerSize]: `${['entering', 'entered'].includes(drawerTransitionState) ? size : 0}px`,
95
- }),
96
- }, "data-testid": activeDrawerId && `awsui-app-layout-drawer-${activeDrawerId}` },
97
- !isMobile && (activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.resizable) && (!isExpanded || expandedTransitionState !== 'entered') && (React.createElement("div", { className: styles['drawer-slider'] },
98
- React.createElement(PanelResizeHandle, { ref: aiDrawerFocusControl === null || aiDrawerFocusControl === void 0 ? void 0 : aiDrawerFocusControl.refs.slider, position: "side-start", className: clsx(testutilStyles['drawers-slider'], styles['ai-drawer-slider-handle']), ariaLabel: (_a = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _a === void 0 ? void 0 : _a.resizeHandle, tooltipText: (_b = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _b === void 0 ? void 0 : _b.resizeHandleTooltipText, ariaValuenow: resizeProps.relativeSize, onKeyDown: resizeProps.onKeyDown, onPointerDown: resizeProps.onPointerDown, onDirectionClick: resizeProps.onDirectionClick, disabled: isResizingDisabled }))),
99
- React.createElement("div", { className: clsx(styles['drawer-content-container'], sharedStyles['with-motion-horizontal']) },
100
- React.createElement("div", { className: styles['drawer-content'] },
101
- React.createElement("header", { className: styles['drawer-content-header'] },
102
- 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),
103
- React.createElement("div", { className: styles['drawer-actions'] },
104
- React.createElement(ButtonGroup, { dropdownExpandToViewport: false, variant: "icon", onItemClick: event => {
105
- var _a;
106
- switch (event.detail.id) {
107
- case 'close':
108
- onActiveAiDrawerChange === null || onActiveAiDrawerChange === void 0 ? void 0 : onActiveAiDrawerChange(null, { initiatedByUserAction: true });
109
- break;
110
- case 'expand':
111
- setExpandedDrawerId(isExpanded ? null : activeDrawerId);
112
- break;
113
- default:
114
- (_a = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.onHeaderActionClick) === null || _a === void 0 ? void 0 : _a.call(activeAiDrawer, event);
115
- }
116
- }, ariaLabel: "Left panel actions", items: drawerActions }))),
117
- !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'] },
118
- React.createElement("div", { className: styles['drawer-back-to-console-button-wrapper'] }, ((_e = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.exitExpandedModeTrigger) === null || _e === void 0 ? void 0 : _e.customIcon) ? (React.createElement("button", { className: clsx(testutilStyles['active-ai-drawer-leave-expanded-mode-custom-button'], styles['drawer-back-to-console-custom-button']), formAction: "none", onClick: () => setExpandedDrawerId(null), "aria-label": (_f = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _f === void 0 ? void 0 : _f.exitExpandedModeButton }, (_g = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.exitExpandedModeTrigger) === null || _g === void 0 ? void 0 : _g.customIcon)) : (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), "aria-label": (_h = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _h === void 0 ? void 0 : _h.exitExpandedModeButton }, (_j = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _j === void 0 ? void 0 : _j.exitExpandedModeButton)))))),
119
- React.createElement("div", { className: styles['drawer-content-content'] }, activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.content)))));
120
- }));
121
- }));
77
+ return (React.createElement(AppLayoutBuiltInErrorBoundary, null,
78
+ React.createElement(Transition, { nodeRef: drawerRef, in: show, appear: show, mountOnEnter: true, timeout: 250 }, drawerTransitionState => {
79
+ return (React.createElement(Transition, { nodeRef: drawerRef, in: isExpanded, timeout: 250 }, expandedTransitionState => {
80
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
81
+ 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'], {
82
+ [sharedStyles['with-motion-horizontal']]: !animationDisabled,
83
+ [testutilStyles['active-drawer']]: show,
84
+ [styles['drawer-hidden']]: !show && drawerTransitionState === 'exited',
85
+ [testutilStyles['drawer-closed']]: !activeAiDrawer,
86
+ [styles['drawer-expanded']]: isExpanded,
87
+ }), ref: drawerRef, onBlur: e => {
88
+ if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {
89
+ aiDrawerFocusControl === null || aiDrawerFocusControl === void 0 ? void 0 : aiDrawerFocusControl.loseFocus();
90
+ }
91
+ }, style: {
92
+ blockSize: drawerHeight,
93
+ insetBlockStart: `${placement.insetBlockStart}px`,
94
+ ...(!isMobile && {
95
+ [customCssProps.drawerMinSize]: `${size}px`,
96
+ [customCssProps.drawerSize]: `${['entering', 'entered'].includes(drawerTransitionState) ? size : 0}px`,
97
+ }),
98
+ }, "data-testid": activeDrawerId && `awsui-app-layout-drawer-${activeDrawerId}` },
99
+ !isMobile &&
100
+ (activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.resizable) &&
101
+ (!isExpanded || expandedTransitionState !== 'entered') && (React.createElement("div", { className: styles['drawer-slider'] },
102
+ React.createElement(PanelResizeHandle, { ref: aiDrawerFocusControl === null || aiDrawerFocusControl === void 0 ? void 0 : aiDrawerFocusControl.refs.slider, position: "side-start", className: clsx(testutilStyles['drawers-slider'], styles['ai-drawer-slider-handle']), ariaLabel: (_a = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _a === void 0 ? void 0 : _a.resizeHandle, tooltipText: (_b = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _b === void 0 ? void 0 : _b.resizeHandleTooltipText, ariaValuenow: resizeProps.relativeSize, onKeyDown: resizeProps.onKeyDown, onPointerDown: resizeProps.onPointerDown, onDirectionClick: resizeProps.onDirectionClick, disabled: isResizingDisabled }))),
103
+ React.createElement("div", { className: clsx(styles['drawer-content-container'], sharedStyles['with-motion-horizontal']) },
104
+ React.createElement("div", { className: styles['drawer-content'] },
105
+ React.createElement("header", { className: styles['drawer-content-header'] },
106
+ React.createElement("div", { className: styles['drawer-content-header-content'] },
107
+ React.createElement(AppLayoutBuiltInErrorBoundary, { renderFallback: () => React.createElement("div", null) }, (_c = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.header) !== null && _c !== void 0 ? _c : React.createElement("div", null)),
108
+ React.createElement("div", { className: styles['drawer-actions'] },
109
+ React.createElement(ButtonGroup, { dropdownExpandToViewport: false, variant: "icon", onItemClick: event => {
110
+ var _a;
111
+ switch (event.detail.id) {
112
+ case 'close':
113
+ onActiveAiDrawerChange === null || onActiveAiDrawerChange === void 0 ? void 0 : onActiveAiDrawerChange(null, { initiatedByUserAction: true });
114
+ break;
115
+ case 'expand':
116
+ setExpandedDrawerId(isExpanded ? null : activeDrawerId);
117
+ break;
118
+ default:
119
+ (_a = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.onHeaderActionClick) === null || _a === void 0 ? void 0 : _a.call(activeAiDrawer, event);
120
+ }
121
+ }, ariaLabel: "Left panel actions", items: drawerActions }))),
122
+ !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'] },
123
+ React.createElement("div", { className: styles['drawer-back-to-console-button-wrapper'] }, ((_e = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.exitExpandedModeTrigger) === null || _e === void 0 ? void 0 : _e.customIcon) ? (React.createElement("button", { className: clsx(testutilStyles['active-ai-drawer-leave-expanded-mode-custom-button'], styles['drawer-back-to-console-custom-button']), formAction: "none", onClick: () => setExpandedDrawerId(null), "aria-label": (_f = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _f === void 0 ? void 0 : _f.exitExpandedModeButton }, (_g = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.exitExpandedModeTrigger) === null || _g === void 0 ? void 0 : _g.customIcon)) : (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), "aria-label": (_h = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _h === void 0 ? void 0 : _h.exitExpandedModeButton }, (_j = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _j === void 0 ? void 0 : _j.exitExpandedModeButton)))))),
124
+ React.createElement(AppLayoutBuiltInErrorBoundary, null,
125
+ React.createElement("div", { className: styles['drawer-content-content'] }, activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.content))))));
126
+ }));
127
+ })));
122
128
  }
123
129
  //# sourceMappingURL=global-ai-drawer.js.map
@@ -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;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;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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 { FocusControlState } from '../../utils/use-focus-control';\nimport { AppLayoutInternals, InternalDrawer } from '../interfaces';\nimport { OnChangeParams } from '../state/use-ai-drawer';\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:\n | (InternalDrawer & {\n exitExpandedModeTrigger?: {\n customIcon?: React.ReactNode;\n };\n })\n | 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 {activeAiDrawer?.exitExpandedModeTrigger?.customIcon ? (\n <button\n className={clsx(\n testutilStyles['active-ai-drawer-leave-expanded-mode-custom-button'],\n styles['drawer-back-to-console-custom-button']\n )}\n formAction=\"none\"\n onClick={() => setExpandedDrawerId(null)}\n aria-label={activeAiDrawer?.ariaLabels?.exitExpandedModeButton}\n >\n {activeAiDrawer?.exitExpandedModeTrigger?.customIcon}\n </button>\n ) : (\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 aria-label={activeAiDrawer?.ariaLabels?.exitExpandedModeButton}\n >\n {activeAiDrawer?.ariaLabels?.exitExpandedModeButton}\n </button>\n )}\n </div>\n </div>\n )}\n </header>\n <div className={styles['drawer-content-content']}>{activeAiDrawer?.content}</div>\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,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,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;AA8BrC,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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CAC/C,EACD,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,gBAC5B,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,0CAAE,sBAAsB,IAE7D,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,uBAAuB,0CAAE,UAAU,CAC7C,CACV,CAAC,CAAC,CAAC,CACF,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,gBAC5B,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,0CAAE,sBAAsB,IAE7D,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,0CAAE,sBAAsB,CAC5C,CACV,CACG,CACF,CACP,CACM;4BACT,oBAAC,6BAA6B;gCAC5B,6BAAK,SAAS,EAAE,MAAM,CAAC,wBAAwB,CAAC,IAAG,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,OAAO,CAAO,CACnD,CAC5B,CACF,CACA,CACT,CAAC;YACJ,CAAC,CACU,CACd,CAAC;QACJ,CAAC,CACU,CACiB,CACjC,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 { AppLayoutBuiltInErrorBoundary } from '../../../error-boundary/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 { FocusControlState } from '../../utils/use-focus-control';\nimport { AppLayoutInternals, InternalDrawer } from '../interfaces';\nimport { OnChangeParams } from '../state/use-ai-drawer';\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:\n | (InternalDrawer & {\n exitExpandedModeTrigger?: {\n customIcon?: React.ReactNode;\n };\n })\n | 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 <AppLayoutBuiltInErrorBoundary>\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 &&\n activeAiDrawer?.resizable &&\n (!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 <AppLayoutBuiltInErrorBoundary renderFallback={() => <div />}>\n {activeAiDrawer?.header ?? <div />}\n </AppLayoutBuiltInErrorBoundary>\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 {activeAiDrawer?.exitExpandedModeTrigger?.customIcon ? (\n <button\n className={clsx(\n testutilStyles['active-ai-drawer-leave-expanded-mode-custom-button'],\n styles['drawer-back-to-console-custom-button']\n )}\n formAction=\"none\"\n onClick={() => setExpandedDrawerId(null)}\n aria-label={activeAiDrawer?.ariaLabels?.exitExpandedModeButton}\n >\n {activeAiDrawer?.exitExpandedModeTrigger?.customIcon}\n </button>\n ) : (\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 aria-label={activeAiDrawer?.ariaLabels?.exitExpandedModeButton}\n >\n {activeAiDrawer?.ariaLabels?.exitExpandedModeButton}\n </button>\n )}\n </div>\n </div>\n )}\n </header>\n <AppLayoutBuiltInErrorBoundary>\n <div className={styles['drawer-content-content']}>{activeAiDrawer?.content}</div>\n </AppLayoutBuiltInErrorBoundary>\n </div>\n </div>\n </aside>\n );\n }}\n </Transition>\n );\n }}\n </Transition>\n </AppLayoutBuiltInErrorBoundary>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"global-bottom-drawer.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAOzE,wBAAgB,4BAA4B,CAAC,EAAE,eAAe,EAAE,EAAE;IAAE,eAAe,EAAE,wBAAwB,CAAA;CAAE,eA4B9G;AAED,UAAU,wCAAwC;IAChD,eAAe,EAAE,wBAAwB,CAAC;IAC1C,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,cAAc,GAAG,SAAS,CAAC;CAC1C;AAKD,iBAAS,yCAAyC,CAAC,EACjD,eAAe,EACf,IAAI,EACJ,YAAY,GACb,EAAE,wCAAwC,eA4P1C;AAED,eAAe,yCAAyC,CAAC"}
1
+ {"version":3,"file":"global-bottom-drawer.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAMzE,wBAAgB,4BAA4B,CAAC,EAAE,eAAe,EAAE,EAAE;IAAE,eAAe,EAAE,wBAAwB,CAAA;CAAE,eA4B9G;AAED,UAAU,wCAAwC;IAChD,eAAe,EAAE,wBAAwB,CAAC;IAC1C,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,cAAc,GAAG,SAAS,CAAC;CAC1C;AAKD,iBAAS,yCAAyC,CAAC,EACjD,eAAe,EACf,IAAI,EACJ,YAAY,GACb,EAAE,wCAAwC,eA8P1C;AAED,eAAe,yCAAyC,CAAC"}
@@ -4,6 +4,7 @@ import React, { useEffect, useRef } from 'react';
4
4
  import { Transition } from 'react-transition-group';
5
5
  import clsx from 'clsx';
6
6
  import ButtonGroup from '../../../button-group/internal';
7
+ import { AppLayoutBuiltInErrorBoundary } from '../../../error-boundary/internal';
7
8
  import PanelResizeHandle from '../../../internal/components/panel-resize-handle';
8
9
  import customCssProps from '../../../internal/generated/custom-css-properties';
9
10
  import { usePrevious } from '../../../internal/hooks/use-previous';
@@ -125,70 +126,71 @@ function AppLayoutGlobalBottomDrawerImplementation({ widgetizedState, show, acti
125
126
  useEffect(() => {
126
127
  reportBottomDrawerSize(size);
127
128
  }, [reportBottomDrawerSize, size]);
128
- return (React.createElement(Transition, { nodeRef: drawerRef, in: show || isExpanded, appear: show || isExpanded, mountOnEnter: true, timeout: 250 }, state => {
129
- var _a, _b, _c, _d, _e;
130
- return (React.createElement("aside", { id: activeDrawerId, "aria-hidden": !show, "aria-label": computedAriaLabels.content, className: clsx(styles.drawer, styles['bottom-drawer'], styles[state], !animationDisabled && sharedStyles['with-motion-vertical'], !animationDisabled && isExpanded && styles['with-expanded-motion'], {
131
- [styles['drawer-hidden']]: !show && state === 'exited',
132
- [styles['last-opened']]: (!activeAiDrawer && lastOpenedDrawerId === activeDrawerId) || isExpanded,
133
- [testutilStyles['active-drawer']]: show,
134
- [styles['drawer-expanded']]: isExpanded,
135
- }), ref: drawerRef, onBlur: e => {
136
- // Drawers with trigger buttons follow this restore focus logic:
137
- // If a previously focused element exists, restore focus on it; otherwise, focus on the associated trigger button.
138
- // This function resets the previously focused element.
139
- // If the drawer has no trigger button and loses focus on the previously focused element, it defaults to document.body,
140
- // which ideally should never happen.
141
- if (!hasTriggerButton) {
142
- return;
143
- }
144
- if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {
145
- bottomDrawersFocusControl.loseFocus();
146
- }
147
- }, style: {
148
- ...(isMobile && {
149
- blockSize: drawerFullScreenHeight,
150
- insetBlockStart: mobileDrawerTopOffset,
151
- }),
152
- ...(!isMobile && {
153
- [customCssProps.bottomDrawerSize]: `${['entering', 'entered'].includes(state) ? (isExpanded ? drawerFullScreenHeight : size + 'px') : 0}`,
154
- }),
155
- }, "data-testid": `awsui-app-layout-drawer-${activeDrawerId}` },
156
- React.createElement("div", { className: clsx(styles['global-drawer-wrapper']) },
157
- !isMobile && !isExpanded && React.createElement("div", { className: styles['drawer-gap'] }),
158
- !isMobile && (activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.resizable) && !isExpanded && (
159
- // Prevents receiving focus in Firefox
160
- React.createElement("div", { className: styles['drawer-slider'], tabIndex: -1 },
161
- React.createElement(PanelResizeHandle, { ref: refs === null || refs === void 0 ? void 0 : refs.slider, position: "bottom", className: testutilStyles['drawers-slider'], ariaLabel: (_a = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.ariaLabels) === null || _a === void 0 ? void 0 : _a.resizeHandle, tooltipText: (_b = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.ariaLabels) === null || _b === void 0 ? void 0 : _b.resizeHandleTooltipText, ariaValuenow: resizeProps.relativeSize, onKeyDown: resizeProps.onKeyDown, onDirectionClick: resizeProps.onDirectionClick, onPointerDown: resizeProps.onPointerDown }))),
162
- React.createElement("header", { className: styles['bottom-drawer-content-header'], ref: headerRef },
163
- React.createElement("div", { className: styles['bottom-drawer-content-header-content'] }, (_c = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.header) !== null && _c !== void 0 ? _c : React.createElement("div", null),
164
- React.createElement("div", { className: styles['bottom-drawer-actions'] },
165
- React.createElement(ButtonGroup, { dropdownExpandToViewport: false, variant: "icon", onItemClick: event => {
166
- var _a;
167
- switch (event.detail.id) {
168
- case 'close':
169
- onActiveGlobalBottomDrawerChange(null, { initiatedByUserAction: true });
170
- break;
171
- case 'expand':
172
- setExpandedDrawerId(isExpanded ? null : activeDrawerId);
173
- break;
174
- default:
175
- (_a = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.onHeaderActionClick) === null || _a === void 0 ? void 0 : _a.call(activeDrawer, event);
176
- }
177
- }, ariaLabel: "Global panel actions", items: drawerActions, __internalRootRef: (root) => {
178
- if (!root) {
179
- return;
180
- }
181
- refs.close = {
182
- current: root.querySelector('[data-itemid="close"]'),
183
- };
184
- } })))),
185
- React.createElement("div", { className: clsx(styles['drawer-content-container'], sharedStyles['with-motion-horizontal']), "data-testid": `awsui-app-layout-drawer-content-${activeDrawerId}` },
186
- React.createElement("div", { className: styles['drawer-content'], style: {
187
- blockSize: isMobile || isExpanded
188
- ? drawerFullScreenHeight
189
- : `${size - GAP_HEIGHT - RESIZE_HANDLER_HEIGHT - ((_e = (_d = headerRef === null || headerRef === void 0 ? void 0 : headerRef.current) === null || _d === void 0 ? void 0 : _d.clientHeight) !== null && _e !== void 0 ? _e : 0)}px`,
190
- } }, activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.content)))));
191
- }));
129
+ return (React.createElement(AppLayoutBuiltInErrorBoundary, null,
130
+ React.createElement(Transition, { nodeRef: drawerRef, in: show || isExpanded, appear: show || isExpanded, mountOnEnter: true, timeout: 250 }, state => {
131
+ var _a, _b, _c, _d, _e;
132
+ return (React.createElement("aside", { id: activeDrawerId, "aria-hidden": !show, "aria-label": computedAriaLabels.content, className: clsx(styles.drawer, styles['bottom-drawer'], styles[state], !animationDisabled && sharedStyles['with-motion-vertical'], !animationDisabled && isExpanded && styles['with-expanded-motion'], {
133
+ [styles['drawer-hidden']]: !show && state === 'exited',
134
+ [styles['last-opened']]: (!activeAiDrawer && lastOpenedDrawerId === activeDrawerId) || isExpanded,
135
+ [testutilStyles['active-drawer']]: show,
136
+ [styles['drawer-expanded']]: isExpanded,
137
+ }), ref: drawerRef, onBlur: e => {
138
+ // Drawers with trigger buttons follow this restore focus logic:
139
+ // If a previously focused element exists, restore focus on it; otherwise, focus on the associated trigger button.
140
+ // This function resets the previously focused element.
141
+ // If the drawer has no trigger button and loses focus on the previously focused element, it defaults to document.body,
142
+ // which ideally should never happen.
143
+ if (!hasTriggerButton) {
144
+ return;
145
+ }
146
+ if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {
147
+ bottomDrawersFocusControl.loseFocus();
148
+ }
149
+ }, style: {
150
+ ...(isMobile && {
151
+ blockSize: drawerFullScreenHeight,
152
+ insetBlockStart: mobileDrawerTopOffset,
153
+ }),
154
+ ...(!isMobile && {
155
+ [customCssProps.bottomDrawerSize]: `${['entering', 'entered'].includes(state) ? (isExpanded ? drawerFullScreenHeight : size + 'px') : 0}`,
156
+ }),
157
+ }, "data-testid": `awsui-app-layout-drawer-${activeDrawerId}` },
158
+ React.createElement("div", { className: clsx(styles['global-drawer-wrapper']) },
159
+ !isMobile && !isExpanded && React.createElement("div", { className: styles['drawer-gap'] }),
160
+ !isMobile && (activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.resizable) && !isExpanded && (
161
+ // Prevents receiving focus in Firefox
162
+ React.createElement("div", { className: styles['drawer-slider'], tabIndex: -1 },
163
+ React.createElement(PanelResizeHandle, { ref: refs === null || refs === void 0 ? void 0 : refs.slider, position: "bottom", className: testutilStyles['drawers-slider'], ariaLabel: (_a = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.ariaLabels) === null || _a === void 0 ? void 0 : _a.resizeHandle, tooltipText: (_b = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.ariaLabels) === null || _b === void 0 ? void 0 : _b.resizeHandleTooltipText, ariaValuenow: resizeProps.relativeSize, onKeyDown: resizeProps.onKeyDown, onDirectionClick: resizeProps.onDirectionClick, onPointerDown: resizeProps.onPointerDown }))),
164
+ React.createElement("header", { className: styles['bottom-drawer-content-header'], ref: headerRef },
165
+ React.createElement("div", { className: styles['bottom-drawer-content-header-content'] }, (_c = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.header) !== null && _c !== void 0 ? _c : React.createElement("div", null),
166
+ React.createElement("div", { className: styles['bottom-drawer-actions'] },
167
+ React.createElement(ButtonGroup, { dropdownExpandToViewport: false, variant: "icon", onItemClick: event => {
168
+ var _a;
169
+ switch (event.detail.id) {
170
+ case 'close':
171
+ onActiveGlobalBottomDrawerChange(null, { initiatedByUserAction: true });
172
+ break;
173
+ case 'expand':
174
+ setExpandedDrawerId(isExpanded ? null : activeDrawerId);
175
+ break;
176
+ default:
177
+ (_a = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.onHeaderActionClick) === null || _a === void 0 ? void 0 : _a.call(activeDrawer, event);
178
+ }
179
+ }, ariaLabel: "Global panel actions", items: drawerActions, __internalRootRef: (root) => {
180
+ if (!root) {
181
+ return;
182
+ }
183
+ refs.close = {
184
+ current: root.querySelector('[data-itemid="close"]'),
185
+ };
186
+ } })))),
187
+ React.createElement("div", { className: clsx(styles['drawer-content-container'], sharedStyles['with-motion-horizontal']), "data-testid": `awsui-app-layout-drawer-content-${activeDrawerId}` },
188
+ React.createElement("div", { className: styles['drawer-content'], style: {
189
+ blockSize: isMobile || isExpanded
190
+ ? drawerFullScreenHeight
191
+ : `${size - GAP_HEIGHT - RESIZE_HANDLER_HEIGHT - ((_e = (_d = headerRef === null || headerRef === void 0 ? void 0 : headerRef.current) === null || _d === void 0 ? void 0 : _d.clientHeight) !== null && _e !== void 0 ? _e : 0)}px`,
192
+ } }, activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.content)))));
193
+ })));
192
194
  }
193
195
  export default AppLayoutGlobalBottomDrawerImplementation;
194
196
  //# sourceMappingURL=global-bottom-drawer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"global-bottom-drawer.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,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,CA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// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, 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 { AppLayoutWidgetizedState, 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\nexport function AppLayoutBottomDrawerWrapper({ widgetizedState }: { widgetizedState: AppLayoutWidgetizedState }) {\n const { activeGlobalBottomDrawerId, bottomDrawers } = widgetizedState;\n const openBottomDrawersHistory = useRef<Set<string>>(new Set());\n useEffect(() => {\n if (activeGlobalBottomDrawerId) {\n openBottomDrawersHistory.current.add(activeGlobalBottomDrawerId);\n }\n }, [activeGlobalBottomDrawerId]);\n\n return (\n <>\n {bottomDrawers.map(drawer => {\n return (\n <AppLayoutGlobalBottomDrawerImplementation\n key={drawer.id}\n activeDrawer={\n activeGlobalBottomDrawerId === drawer.id ||\n (drawer.preserveInactiveContent && openBottomDrawersHistory.current.has(drawer.id))\n ? drawer\n : undefined\n }\n show={activeGlobalBottomDrawerId === drawer.id}\n widgetizedState={widgetizedState}\n />\n );\n })}\n </>\n );\n}\n\ninterface AppLayoutGlobalDrawerImplementationProps {\n widgetizedState: AppLayoutWidgetizedState;\n show: boolean;\n activeDrawer: InternalDrawer | undefined;\n}\n\nconst GAP_HEIGHT = 10;\nconst RESIZE_HANDLER_HEIGHT = 18;\n\nfunction AppLayoutGlobalBottomDrawerImplementation({\n widgetizedState,\n show,\n activeDrawer,\n}: AppLayoutGlobalDrawerImplementationProps) {\n const {\n ariaLabels,\n isMobile,\n onActiveGlobalBottomDrawerChange,\n onActiveBottomDrawerResize,\n minGlobalBottomDrawerSize,\n activeGlobalBottomDrawerSize,\n drawersOpenQueue,\n expandedDrawerId,\n setExpandedDrawerId,\n activeAiDrawer,\n bottomDrawersFocusControl,\n getMaxGlobalBottomDrawerHeight,\n reportBottomDrawerSize,\n verticalOffsets,\n placement,\n } = widgetizedState;\n const drawerRef = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLHeadingElement>(null);\n const activeDrawerId = activeDrawer?.id ?? '';\n\n const computedAriaLabels = {\n closeButton: activeDrawer ? activeDrawer.ariaLabels?.closeButton : ariaLabels?.toolsClose,\n content: activeDrawer ? activeDrawer.ariaLabels?.drawerName : ariaLabels?.tools,\n };\n\n const { drawerTopOffset: mobileDrawerTopOffset, drawerHeight: drawerFullScreenHeight } = getDrawerStyles(\n verticalOffsets,\n isMobile,\n placement\n );\n const activeDrawerSize = activeGlobalBottomDrawerSize ?? 0;\n const minDrawerSize = minGlobalBottomDrawerSize ?? 0;\n const maxDrawerSize = getMaxGlobalBottomDrawerHeight();\n const refs = bottomDrawersFocusControl.refs;\n const resizeProps = useResize({\n currentWidth: activeDrawerSize,\n minWidth: minDrawerSize,\n maxWidth: maxDrawerSize,\n panelRef: drawerRef,\n handleRef: refs?.slider,\n onResize: size => onActiveBottomDrawerResize({ id: activeDrawerId!, size }),\n position: 'bottom',\n });\n const size = getLimitedValue(minDrawerSize, activeDrawerSize, maxDrawerSize);\n const lastOpenedDrawerId = drawersOpenQueue.length ? drawersOpenQueue[0] : null;\n const hasTriggerButton = !!activeDrawer?.trigger;\n const isExpanded = activeDrawer?.isExpandable && expandedDrawerId === activeDrawerId;\n const wasExpanded = usePrevious(isExpanded);\n const animationDisabled =\n (activeDrawer?.defaultActive && !drawersOpenQueue.includes(activeDrawer.id)) || (wasExpanded && !isExpanded);\n\n // Prevent main content scroll when bottom drawer opens with animations\n useEffect(() => {\n if (show && drawerRef.current) {\n const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;\n const abortController = new AbortController();\n\n // Temporarily prevent scrolling during animation\n const preventScroll = () => {\n document.documentElement.scrollTop = scrollTop;\n document.body.scrollTop = scrollTop;\n };\n\n // Handle transition end to remove scroll prevention\n const handleTransitionEnd = (event: TransitionEvent) => {\n // Only handle transitions on the drawer element itself\n if (event.target === drawerRef.current) {\n abortController.abort();\n }\n };\n\n // Add scroll prevention during animation\n document.addEventListener('scroll', preventScroll, {\n passive: false,\n signal: abortController.signal,\n });\n\n drawerRef.current.addEventListener('transitionend', handleTransitionEnd, {\n signal: abortController.signal,\n });\n\n return () => {\n abortController.abort();\n };\n }\n }, [show]);\n\n let drawerActions: ReadonlyArray<InternalItemOrGroup> = [\n {\n type: 'icon-button',\n id: 'close',\n iconName: isMobile ? 'close' : 'angle-down',\n text: computedAriaLabels.closeButton ?? '',\n analyticsAction: 'close',\n },\n ];\n if (!isMobile && activeDrawer?.isExpandable) {\n drawerActions = [\n {\n type: 'icon-toggle-button',\n id: 'expand',\n iconName: isExpanded ? 'shrink' : 'expand',\n text: activeDrawer?.ariaLabels?.expandedModeButton ?? '',\n pressed: !!isExpanded,\n analyticsAction: isExpanded ? 'expand' : 'collapse',\n },\n ...drawerActions,\n ];\n }\n if (activeDrawer?.headerActions) {\n drawerActions = [\n {\n type: 'group',\n text: 'Actions',\n items: activeDrawer.headerActions!,\n },\n ...drawerActions,\n ];\n }\n\n useEffect(() => {\n reportBottomDrawerSize(size);\n }, [reportBottomDrawerSize, size]);\n\n return (\n <Transition\n nodeRef={drawerRef}\n in={show || isExpanded}\n appear={show || isExpanded}\n mountOnEnter={true}\n timeout={250}\n >\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['bottom-drawer'],\n styles[state],\n !animationDisabled && sharedStyles['with-motion-vertical'],\n !animationDisabled && isExpanded && styles['with-expanded-motion'],\n {\n [styles['drawer-hidden']]: !show && state === 'exited',\n [styles['last-opened']]: (!activeAiDrawer && lastOpenedDrawerId === activeDrawerId) || isExpanded,\n [testutilStyles['active-drawer']]: show,\n [styles['drawer-expanded']]: isExpanded,\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 bottomDrawersFocusControl.loseFocus();\n }\n }}\n style={{\n ...(isMobile && {\n blockSize: drawerFullScreenHeight,\n insetBlockStart: mobileDrawerTopOffset,\n }),\n ...(!isMobile && {\n [customCssProps.bottomDrawerSize]: `${['entering', 'entered'].includes(state) ? (isExpanded ? drawerFullScreenHeight : size + 'px') : 0}`,\n }),\n }}\n data-testid={`awsui-app-layout-drawer-${activeDrawerId}`}\n >\n <div className={clsx(styles['global-drawer-wrapper'])}>\n {!isMobile && !isExpanded && <div className={styles['drawer-gap']} />}\n {!isMobile && activeDrawer?.resizable && !isExpanded && (\n // Prevents receiving focus in Firefox\n <div className={styles['drawer-slider']} tabIndex={-1}>\n <PanelResizeHandle\n ref={refs?.slider}\n position=\"bottom\"\n className={testutilStyles['drawers-slider']}\n ariaLabel={activeDrawer?.ariaLabels?.resizeHandle}\n tooltipText={activeDrawer?.ariaLabels?.resizeHandleTooltipText}\n ariaValuenow={resizeProps.relativeSize}\n onKeyDown={resizeProps.onKeyDown}\n onDirectionClick={resizeProps.onDirectionClick}\n onPointerDown={resizeProps.onPointerDown}\n />\n </div>\n )}\n <header className={styles['bottom-drawer-content-header']} ref={headerRef}>\n <div className={styles['bottom-drawer-content-header-content']}>\n {activeDrawer?.header ?? <div />}\n <div className={styles['bottom-drawer-actions']}>\n <ButtonGroup\n dropdownExpandToViewport={false}\n variant=\"icon\"\n onItemClick={event => {\n switch (event.detail.id) {\n case 'close':\n onActiveGlobalBottomDrawerChange(null, { initiatedByUserAction: true });\n break;\n case 'expand':\n setExpandedDrawerId(isExpanded ? null : activeDrawerId);\n break;\n default:\n activeDrawer?.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 = {\n current: root.querySelector('[data-itemid=\"close\"]') as unknown as Focusable,\n };\n }}\n />\n </div>\n </div>\n </header>\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\n className={styles['drawer-content']}\n style={{\n blockSize:\n isMobile || isExpanded\n ? drawerFullScreenHeight\n : `${size - GAP_HEIGHT - RESIZE_HANDLER_HEIGHT - (headerRef?.current?.clientHeight ?? 0)}px`,\n }}\n >\n {activeDrawer?.content}\n </div>\n </div>\n </div>\n </aside>\n );\n }}\n </Transition>\n );\n}\n\nexport default AppLayoutGlobalBottomDrawerImplementation;\n"]}
1
+ {"version":3,"file":"global-bottom-drawer.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,WAAW,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,iBAAiB,MAAM,kDAAkD,CAAC;AACjF,OAAO,cAAc,MAAM,mDAAmD,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM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esContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, 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 { AppLayoutBuiltInErrorBoundary } from '../../../error-boundary/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 { AppLayoutWidgetizedState, 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';\nexport function AppLayoutBottomDrawerWrapper({ widgetizedState }: { widgetizedState: AppLayoutWidgetizedState }) {\n const { activeGlobalBottomDrawerId, bottomDrawers } = widgetizedState;\n const openBottomDrawersHistory = useRef<Set<string>>(new Set());\n useEffect(() => {\n if (activeGlobalBottomDrawerId) {\n openBottomDrawersHistory.current.add(activeGlobalBottomDrawerId);\n }\n }, [activeGlobalBottomDrawerId]);\n\n return (\n <>\n {bottomDrawers.map(drawer => {\n return (\n <AppLayoutGlobalBottomDrawerImplementation\n key={drawer.id}\n activeDrawer={\n activeGlobalBottomDrawerId === drawer.id ||\n (drawer.preserveInactiveContent && openBottomDrawersHistory.current.has(drawer.id))\n ? drawer\n : undefined\n }\n show={activeGlobalBottomDrawerId === drawer.id}\n widgetizedState={widgetizedState}\n />\n );\n })}\n </>\n );\n}\n\ninterface AppLayoutGlobalDrawerImplementationProps {\n widgetizedState: AppLayoutWidgetizedState;\n show: boolean;\n activeDrawer: InternalDrawer | undefined;\n}\n\nconst GAP_HEIGHT = 10;\nconst RESIZE_HANDLER_HEIGHT = 18;\n\nfunction AppLayoutGlobalBottomDrawerImplementation({\n widgetizedState,\n show,\n activeDrawer,\n}: AppLayoutGlobalDrawerImplementationProps) {\n const {\n ariaLabels,\n isMobile,\n onActiveGlobalBottomDrawerChange,\n onActiveBottomDrawerResize,\n minGlobalBottomDrawerSize,\n activeGlobalBottomDrawerSize,\n drawersOpenQueue,\n expandedDrawerId,\n setExpandedDrawerId,\n activeAiDrawer,\n bottomDrawersFocusControl,\n getMaxGlobalBottomDrawerHeight,\n reportBottomDrawerSize,\n verticalOffsets,\n placement,\n } = widgetizedState;\n const drawerRef = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLHeadingElement>(null);\n const activeDrawerId = activeDrawer?.id ?? '';\n\n const computedAriaLabels = {\n closeButton: activeDrawer ? activeDrawer.ariaLabels?.closeButton : ariaLabels?.toolsClose,\n content: activeDrawer ? activeDrawer.ariaLabels?.drawerName : ariaLabels?.tools,\n };\n\n const { drawerTopOffset: mobileDrawerTopOffset, drawerHeight: drawerFullScreenHeight } = getDrawerStyles(\n verticalOffsets,\n isMobile,\n placement\n );\n const activeDrawerSize = activeGlobalBottomDrawerSize ?? 0;\n const minDrawerSize = minGlobalBottomDrawerSize ?? 0;\n const maxDrawerSize = getMaxGlobalBottomDrawerHeight();\n const refs = bottomDrawersFocusControl.refs;\n const resizeProps = useResize({\n currentWidth: activeDrawerSize,\n minWidth: minDrawerSize,\n maxWidth: maxDrawerSize,\n panelRef: drawerRef,\n handleRef: refs?.slider,\n onResize: size => onActiveBottomDrawerResize({ id: activeDrawerId!, size }),\n position: 'bottom',\n });\n const size = getLimitedValue(minDrawerSize, activeDrawerSize, maxDrawerSize);\n const lastOpenedDrawerId = drawersOpenQueue.length ? drawersOpenQueue[0] : null;\n const hasTriggerButton = !!activeDrawer?.trigger;\n const isExpanded = activeDrawer?.isExpandable && expandedDrawerId === activeDrawerId;\n const wasExpanded = usePrevious(isExpanded);\n const animationDisabled =\n (activeDrawer?.defaultActive && !drawersOpenQueue.includes(activeDrawer.id)) || (wasExpanded && !isExpanded);\n\n // Prevent main content scroll when bottom drawer opens with animations\n useEffect(() => {\n if (show && drawerRef.current) {\n const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;\n const abortController = new AbortController();\n\n // Temporarily prevent scrolling during animation\n const preventScroll = () => {\n document.documentElement.scrollTop = scrollTop;\n document.body.scrollTop = scrollTop;\n };\n\n // Handle transition end to remove scroll prevention\n const handleTransitionEnd = (event: TransitionEvent) => {\n // Only handle transitions on the drawer element itself\n if (event.target === drawerRef.current) {\n abortController.abort();\n }\n };\n\n // Add scroll prevention during animation\n document.addEventListener('scroll', preventScroll, {\n passive: false,\n signal: abortController.signal,\n });\n\n drawerRef.current.addEventListener('transitionend', handleTransitionEnd, {\n signal: abortController.signal,\n });\n\n return () => {\n abortController.abort();\n };\n }\n }, [show]);\n\n let drawerActions: ReadonlyArray<InternalItemOrGroup> = [\n {\n type: 'icon-button',\n id: 'close',\n iconName: isMobile ? 'close' : 'angle-down',\n text: computedAriaLabels.closeButton ?? '',\n analyticsAction: 'close',\n },\n ];\n if (!isMobile && activeDrawer?.isExpandable) {\n drawerActions = [\n {\n type: 'icon-toggle-button',\n id: 'expand',\n iconName: isExpanded ? 'shrink' : 'expand',\n text: activeDrawer?.ariaLabels?.expandedModeButton ?? '',\n pressed: !!isExpanded,\n analyticsAction: isExpanded ? 'expand' : 'collapse',\n },\n ...drawerActions,\n ];\n }\n if (activeDrawer?.headerActions) {\n drawerActions = [\n {\n type: 'group',\n text: 'Actions',\n items: activeDrawer.headerActions!,\n },\n ...drawerActions,\n ];\n }\n\n useEffect(() => {\n reportBottomDrawerSize(size);\n }, [reportBottomDrawerSize, size]);\n\n return (\n <AppLayoutBuiltInErrorBoundary>\n <Transition\n nodeRef={drawerRef}\n in={show || isExpanded}\n appear={show || isExpanded}\n mountOnEnter={true}\n timeout={250}\n >\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['bottom-drawer'],\n styles[state],\n !animationDisabled && sharedStyles['with-motion-vertical'],\n !animationDisabled && isExpanded && styles['with-expanded-motion'],\n {\n [styles['drawer-hidden']]: !show && state === 'exited',\n [styles['last-opened']]: (!activeAiDrawer && lastOpenedDrawerId === activeDrawerId) || isExpanded,\n [testutilStyles['active-drawer']]: show,\n [styles['drawer-expanded']]: isExpanded,\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 bottomDrawersFocusControl.loseFocus();\n }\n }}\n style={{\n ...(isMobile && {\n blockSize: drawerFullScreenHeight,\n insetBlockStart: mobileDrawerTopOffset,\n }),\n ...(!isMobile && {\n [customCssProps.bottomDrawerSize]: `${['entering', 'entered'].includes(state) ? (isExpanded ? drawerFullScreenHeight : size + 'px') : 0}`,\n }),\n }}\n data-testid={`awsui-app-layout-drawer-${activeDrawerId}`}\n >\n <div className={clsx(styles['global-drawer-wrapper'])}>\n {!isMobile && !isExpanded && <div className={styles['drawer-gap']} />}\n {!isMobile && activeDrawer?.resizable && !isExpanded && (\n // Prevents receiving focus in Firefox\n <div className={styles['drawer-slider']} tabIndex={-1}>\n <PanelResizeHandle\n ref={refs?.slider}\n position=\"bottom\"\n className={testutilStyles['drawers-slider']}\n ariaLabel={activeDrawer?.ariaLabels?.resizeHandle}\n tooltipText={activeDrawer?.ariaLabels?.resizeHandleTooltipText}\n ariaValuenow={resizeProps.relativeSize}\n onKeyDown={resizeProps.onKeyDown}\n onDirectionClick={resizeProps.onDirectionClick}\n onPointerDown={resizeProps.onPointerDown}\n />\n </div>\n )}\n <header className={styles['bottom-drawer-content-header']} ref={headerRef}>\n <div className={styles['bottom-drawer-content-header-content']}>\n {activeDrawer?.header ?? <div />}\n <div className={styles['bottom-drawer-actions']}>\n <ButtonGroup\n dropdownExpandToViewport={false}\n variant=\"icon\"\n onItemClick={event => {\n switch (event.detail.id) {\n case 'close':\n onActiveGlobalBottomDrawerChange(null, { initiatedByUserAction: true });\n break;\n case 'expand':\n setExpandedDrawerId(isExpanded ? null : activeDrawerId);\n break;\n default:\n activeDrawer?.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 = {\n current: root.querySelector('[data-itemid=\"close\"]') as unknown as Focusable,\n };\n }}\n />\n </div>\n </div>\n </header>\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\n className={styles['drawer-content']}\n style={{\n blockSize:\n isMobile || isExpanded\n ? drawerFullScreenHeight\n : `${size - GAP_HEIGHT - RESIZE_HANDLER_HEIGHT - (headerRef?.current?.clientHeight ?? 0)}px`,\n }}\n >\n {activeDrawer?.content}\n </div>\n </div>\n </div>\n </aside>\n );\n }}\n </Transition>\n </AppLayoutBuiltInErrorBoundary>\n );\n}\n\nexport default AppLayoutGlobalBottomDrawerImplementation;\n"]}
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"global-drawer.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-drawer.tsx"],"names":[],"mappings":"AAeA,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,eA2L1C;AAED,eAAe,mCAAmC,CAAC"}