@cloudscape-design/components-themeable 3.0.328 → 3.0.330

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 (185) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/app-layout/styles.scss +26 -0
  3. package/lib/internal/scss/app-layout/visual-refresh/drawers.scss +17 -13
  4. package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +39 -39
  5. package/lib/internal/scss/split-panel/styles.scss +0 -18
  6. package/lib/internal/scss/table/sticky-scrollbar/styles.scss +26 -0
  7. package/lib/internal/scss/table/styles.scss +0 -22
  8. package/lib/internal/template/annotation-context/annotation/styles.css.js +24 -24
  9. package/lib/internal/template/annotation-context/annotation/styles.scoped.css +30 -30
  10. package/lib/internal/template/annotation-context/annotation/styles.selectors.js +24 -24
  11. package/lib/internal/template/app-layout/drawer/interfaces.d.ts +0 -7
  12. package/lib/internal/template/app-layout/drawer/interfaces.d.ts.map +1 -1
  13. package/lib/internal/template/app-layout/drawer/interfaces.js.map +1 -1
  14. package/lib/internal/template/app-layout/drawer/resizable-drawer.d.ts.map +1 -1
  15. package/lib/internal/template/app-layout/drawer/resizable-drawer.js +3 -3
  16. package/lib/internal/template/app-layout/drawer/resizable-drawer.js.map +1 -1
  17. package/lib/internal/template/app-layout/notifications/styles.css.js +3 -3
  18. package/lib/internal/template/app-layout/notifications/styles.scoped.css +7 -7
  19. package/lib/internal/template/app-layout/notifications/styles.selectors.js +3 -3
  20. package/lib/internal/template/app-layout/runtime-api.d.ts.map +1 -1
  21. package/lib/internal/template/app-layout/runtime-api.js +5 -2
  22. package/lib/internal/template/app-layout/runtime-api.js.map +1 -1
  23. package/lib/internal/template/app-layout/styles.css.js +17 -13
  24. package/lib/internal/template/app-layout/styles.scoped.css +44 -13
  25. package/lib/internal/template/app-layout/styles.selectors.js +17 -13
  26. package/lib/internal/template/app-layout/utils/interfaces.d.ts +10 -0
  27. package/lib/internal/template/app-layout/utils/interfaces.d.ts.map +1 -0
  28. package/lib/internal/template/app-layout/utils/interfaces.js +2 -0
  29. package/lib/internal/template/app-layout/utils/interfaces.js.map +1 -0
  30. package/lib/internal/template/app-layout/utils/use-drawer-focus-control.d.ts.map +1 -1
  31. package/lib/internal/template/app-layout/utils/use-drawer-focus-control.js +8 -3
  32. package/lib/internal/template/app-layout/utils/use-drawer-focus-control.js.map +1 -1
  33. package/lib/internal/template/app-layout/utils/use-keyboard-events.d.ts +4 -0
  34. package/lib/internal/template/app-layout/utils/use-keyboard-events.d.ts.map +1 -0
  35. package/lib/internal/template/{split-panel → app-layout}/utils/use-keyboard-events.js +10 -11
  36. package/lib/internal/template/app-layout/utils/use-keyboard-events.js.map +1 -0
  37. package/lib/internal/template/app-layout/utils/use-pointer-events.d.ts +3 -0
  38. package/lib/internal/template/app-layout/utils/use-pointer-events.d.ts.map +1 -0
  39. package/lib/internal/template/{split-panel → app-layout}/utils/use-pointer-events.js +15 -8
  40. package/lib/internal/template/app-layout/utils/use-pointer-events.js.map +1 -0
  41. package/lib/internal/template/app-layout/utils/use-resize.d.ts +16 -0
  42. package/lib/internal/template/app-layout/utils/use-resize.d.ts.map +1 -0
  43. package/lib/internal/template/app-layout/utils/use-resize.js +84 -0
  44. package/lib/internal/template/app-layout/utils/use-resize.js.map +1 -0
  45. package/lib/internal/template/app-layout/visual-refresh/context.d.ts +11 -6
  46. package/lib/internal/template/app-layout/visual-refresh/context.d.ts.map +1 -1
  47. package/lib/internal/template/app-layout/visual-refresh/context.js +26 -7
  48. package/lib/internal/template/app-layout/visual-refresh/context.js.map +1 -1
  49. package/lib/internal/template/app-layout/visual-refresh/drawers.d.ts +1 -33
  50. package/lib/internal/template/app-layout/visual-refresh/drawers.d.ts.map +1 -1
  51. package/lib/internal/template/app-layout/visual-refresh/drawers.js +14 -7
  52. package/lib/internal/template/app-layout/visual-refresh/drawers.js.map +1 -1
  53. package/lib/internal/template/app-layout/visual-refresh/styles.css.js +69 -68
  54. package/lib/internal/template/app-layout/visual-refresh/styles.scoped.css +294 -298
  55. package/lib/internal/template/app-layout/visual-refresh/styles.selectors.js +69 -68
  56. package/lib/internal/template/app-layout/visual-refresh/trigger-button.d.ts.map +1 -1
  57. package/lib/internal/template/app-layout/visual-refresh/trigger-button.js +1 -2
  58. package/lib/internal/template/app-layout/visual-refresh/trigger-button.js.map +1 -1
  59. package/lib/internal/template/area-chart/{model/async-store.d.ts → async-store/index.d.ts} +1 -1
  60. package/lib/internal/template/area-chart/async-store/index.d.ts.map +1 -0
  61. package/lib/internal/template/area-chart/{model/async-store.js → async-store/index.js} +1 -1
  62. package/lib/internal/template/area-chart/async-store/index.js.map +1 -0
  63. package/lib/internal/template/area-chart/elements/area-chart-legend.d.ts.map +1 -1
  64. package/lib/internal/template/area-chart/elements/area-chart-legend.js +1 -1
  65. package/lib/internal/template/area-chart/elements/area-chart-legend.js.map +1 -1
  66. package/lib/internal/template/area-chart/elements/data-series.js +1 -1
  67. package/lib/internal/template/area-chart/elements/data-series.js.map +1 -1
  68. package/lib/internal/template/area-chart/elements/highlighted-point.js +1 -1
  69. package/lib/internal/template/area-chart/elements/highlighted-point.js.map +1 -1
  70. package/lib/internal/template/area-chart/elements/use-highlight-details.d.ts.map +1 -1
  71. package/lib/internal/template/area-chart/elements/use-highlight-details.js +3 -1
  72. package/lib/internal/template/area-chart/elements/use-highlight-details.js.map +1 -1
  73. package/lib/internal/template/area-chart/elements/vertical-marker.js +1 -1
  74. package/lib/internal/template/area-chart/elements/vertical-marker.js.map +1 -1
  75. package/lib/internal/template/area-chart/model/index.d.ts +1 -1
  76. package/lib/internal/template/area-chart/model/index.d.ts.map +1 -1
  77. package/lib/internal/template/area-chart/model/index.js.map +1 -1
  78. package/lib/internal/template/area-chart/model/interactions-store.d.ts +1 -1
  79. package/lib/internal/template/area-chart/model/interactions-store.d.ts.map +1 -1
  80. package/lib/internal/template/area-chart/model/interactions-store.js +1 -1
  81. package/lib/internal/template/area-chart/model/interactions-store.js.map +1 -1
  82. package/lib/internal/template/area-chart/model/use-chart-model.d.ts.map +1 -1
  83. package/lib/internal/template/area-chart/model/use-chart-model.js +1 -1
  84. package/lib/internal/template/area-chart/model/use-chart-model.js.map +1 -1
  85. package/lib/internal/template/attribute-editor/interfaces.d.ts +1 -1
  86. package/lib/internal/template/attribute-editor/interfaces.d.ts.map +1 -1
  87. package/lib/internal/template/attribute-editor/interfaces.js.map +1 -1
  88. package/lib/internal/template/content-layout/styles.css.js +7 -7
  89. package/lib/internal/template/content-layout/styles.scoped.css +13 -13
  90. package/lib/internal/template/content-layout/styles.selectors.js +7 -7
  91. package/lib/internal/template/expandable-section/expandable-section-container.js +2 -2
  92. package/lib/internal/template/expandable-section/expandable-section-container.js.map +1 -1
  93. package/lib/internal/template/expandable-section/interfaces.d.ts +3 -1
  94. package/lib/internal/template/expandable-section/interfaces.d.ts.map +1 -1
  95. package/lib/internal/template/expandable-section/interfaces.js.map +1 -1
  96. package/lib/internal/template/expandable-section/internal.d.ts.map +1 -1
  97. package/lib/internal/template/expandable-section/internal.js +4 -2
  98. package/lib/internal/template/expandable-section/internal.js.map +1 -1
  99. package/lib/internal/template/flashbar/styles.css.js +45 -45
  100. package/lib/internal/template/flashbar/styles.scoped.css +169 -169
  101. package/lib/internal/template/flashbar/styles.selectors.js +45 -45
  102. package/lib/internal/template/internal/environment.js +1 -1
  103. package/lib/internal/template/internal/generated/custom-css-properties/index.js +39 -39
  104. package/lib/internal/template/internal/generated/custom-css-properties/index.js.map +1 -1
  105. package/lib/internal/template/internal/plugins/drawers-controller.d.ts +5 -0
  106. package/lib/internal/template/internal/plugins/drawers-controller.d.ts.map +1 -1
  107. package/lib/internal/template/internal/plugins/drawers-controller.js.map +1 -1
  108. package/lib/internal/template/mixed-line-bar-chart/data-series.d.ts.map +1 -1
  109. package/lib/internal/template/mixed-line-bar-chart/data-series.js +8 -2
  110. package/lib/internal/template/mixed-line-bar-chart/data-series.js.map +1 -1
  111. package/lib/internal/template/split-panel/index.d.ts.map +1 -1
  112. package/lib/internal/template/split-panel/index.js +3 -3
  113. package/lib/internal/template/split-panel/index.js.map +1 -1
  114. package/lib/internal/template/split-panel/interfaces.d.ts +0 -7
  115. package/lib/internal/template/split-panel/interfaces.d.ts.map +1 -1
  116. package/lib/internal/template/split-panel/interfaces.js.map +1 -1
  117. package/lib/internal/template/split-panel/styles.css.js +56 -59
  118. package/lib/internal/template/split-panel/styles.scoped.css +77 -93
  119. package/lib/internal/template/split-panel/styles.selectors.js +56 -59
  120. package/lib/internal/template/table/body-cell/td-element.d.ts +1 -1
  121. package/lib/internal/template/table/body-cell/td-element.d.ts.map +1 -1
  122. package/lib/internal/template/table/body-cell/td-element.js +1 -1
  123. package/lib/internal/template/table/body-cell/td-element.js.map +1 -1
  124. package/lib/internal/template/table/header-cell/index.d.ts +1 -1
  125. package/lib/internal/template/table/header-cell/index.d.ts.map +1 -1
  126. package/lib/internal/template/table/header-cell/index.js +1 -1
  127. package/lib/internal/template/table/header-cell/index.js.map +1 -1
  128. package/lib/internal/template/table/internal.js +2 -2
  129. package/lib/internal/template/table/internal.js.map +1 -1
  130. package/lib/internal/template/table/sticky-columns/index.d.ts +2 -0
  131. package/lib/internal/template/table/sticky-columns/index.d.ts.map +1 -0
  132. package/lib/internal/template/table/sticky-columns/index.js +4 -0
  133. package/lib/internal/template/table/sticky-columns/index.js.map +1 -0
  134. package/lib/internal/template/table/{use-sticky-columns.d.ts → sticky-columns/use-sticky-columns.d.ts} +1 -1
  135. package/lib/internal/template/table/sticky-columns/use-sticky-columns.d.ts.map +1 -0
  136. package/lib/internal/template/table/{use-sticky-columns.js → sticky-columns/use-sticky-columns.js} +3 -3
  137. package/lib/internal/template/table/sticky-columns/use-sticky-columns.js.map +1 -0
  138. package/lib/internal/template/table/sticky-scrollbar/index.d.ts +2 -0
  139. package/lib/internal/template/table/sticky-scrollbar/index.d.ts.map +1 -0
  140. package/lib/internal/template/table/sticky-scrollbar/index.js +4 -0
  141. package/lib/internal/template/table/sticky-scrollbar/index.js.map +1 -0
  142. package/lib/internal/template/table/sticky-scrollbar/sticky-scrollbar.d.ts.map +1 -0
  143. package/lib/internal/template/table/{sticky-scrollbar.js → sticky-scrollbar/sticky-scrollbar.js} +2 -2
  144. package/lib/internal/template/table/sticky-scrollbar/sticky-scrollbar.js.map +1 -0
  145. package/lib/internal/template/table/sticky-scrollbar/styles.css.js +9 -0
  146. package/lib/internal/template/table/sticky-scrollbar/styles.scoped.css +22 -0
  147. package/lib/internal/template/table/sticky-scrollbar/styles.selectors.js +10 -0
  148. package/lib/internal/template/table/sticky-scrollbar/use-sticky-scrollbar.d.ts.map +1 -0
  149. package/lib/internal/template/table/{use-sticky-scrollbar.js → sticky-scrollbar/use-sticky-scrollbar.js} +3 -3
  150. package/lib/internal/template/table/sticky-scrollbar/use-sticky-scrollbar.js.map +1 -0
  151. package/lib/internal/template/table/styles.css.js +32 -36
  152. package/lib/internal/template/table/styles.scoped.css +40 -59
  153. package/lib/internal/template/table/styles.selectors.js +32 -36
  154. package/lib/internal/template/table/thead.d.ts +1 -1
  155. package/lib/internal/template/table/thead.d.ts.map +1 -1
  156. package/lib/internal/template/table/thead.js +1 -1
  157. package/lib/internal/template/table/thead.js.map +1 -1
  158. package/lib/internal/template/table/utils.d.ts +1 -1
  159. package/lib/internal/template/table/utils.d.ts.map +1 -1
  160. package/lib/internal/template/table/utils.js.map +1 -1
  161. package/lib/internal/template/wizard/styles.css.js +31 -31
  162. package/lib/internal/template/wizard/styles.scoped.css +63 -63
  163. package/lib/internal/template/wizard/styles.selectors.js +31 -31
  164. package/lib/internal/template-tokens/package.json +9 -0
  165. package/lib/theming.d.ts +9 -0
  166. package/lib/theming.d.ts.map +1 -0
  167. package/lib/theming.js +26 -0
  168. package/lib/theming.js.map +1 -0
  169. package/package.json +1 -1
  170. package/lib/internal/template/area-chart/model/async-store.d.ts.map +0 -1
  171. package/lib/internal/template/area-chart/model/async-store.js.map +0 -1
  172. package/lib/internal/template/split-panel/utils/use-keyboard-events.d.ts +0 -4
  173. package/lib/internal/template/split-panel/utils/use-keyboard-events.d.ts.map +0 -1
  174. package/lib/internal/template/split-panel/utils/use-keyboard-events.js.map +0 -1
  175. package/lib/internal/template/split-panel/utils/use-pointer-events.d.ts +0 -3
  176. package/lib/internal/template/split-panel/utils/use-pointer-events.d.ts.map +0 -1
  177. package/lib/internal/template/split-panel/utils/use-pointer-events.js.map +0 -1
  178. package/lib/internal/template/table/sticky-scrollbar.d.ts.map +0 -1
  179. package/lib/internal/template/table/sticky-scrollbar.js.map +0 -1
  180. package/lib/internal/template/table/use-sticky-columns.d.ts.map +0 -1
  181. package/lib/internal/template/table/use-sticky-columns.js.map +0 -1
  182. package/lib/internal/template/table/use-sticky-scrollbar.d.ts.map +0 -1
  183. package/lib/internal/template/table/use-sticky-scrollbar.js.map +0 -1
  184. /package/lib/internal/template/table/{sticky-scrollbar.d.ts → sticky-scrollbar/sticky-scrollbar.d.ts} +0 -0
  185. /package/lib/internal/template/table/{use-sticky-scrollbar.d.ts → sticky-scrollbar/use-sticky-scrollbar.d.ts} +0 -0
@@ -0,0 +1,84 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import React, { useState, useEffect, useMemo, useCallback } from 'react';
4
+ import { fireNonCancelableEvent } from '../../internal/events';
5
+ import clsx from 'clsx';
6
+ import ResizeHandler from '../../split-panel/icons/resize-handler';
7
+ import { getLimitedValue } from '../../split-panel/utils/size-utils';
8
+ import { usePointerEvents } from './use-pointer-events';
9
+ import { useKeyboardEvents } from './use-keyboard-events';
10
+ import splitPanelStyles from '../../split-panel/styles.css.js';
11
+ import testutilStyles from '../test-classes/styles.css.js';
12
+ import styles from '../visual-refresh/styles.css.js';
13
+ function useResize(drawerRefObject, drawerResizeProps) {
14
+ var _a, _b;
15
+ const { activeDrawerId, drawers, drawersRefs, isToolsOpen, drawersMaxWidth } = drawerResizeProps;
16
+ const activeDrawer = (_a = drawers === null || drawers === void 0 ? void 0 : drawers.items.find(item => item.id === activeDrawerId)) !== null && _a !== void 0 ? _a : null;
17
+ const drawerItems = useMemo(() => (drawers === null || drawers === void 0 ? void 0 : drawers.items) || [], [drawers === null || drawers === void 0 ? void 0 : drawers.items]);
18
+ const toolsWidth = 290;
19
+ const MIN_WIDTH = (activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.defaultSize) && activeDrawer.defaultSize < 290 ? activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.defaultSize : 290;
20
+ const [relativeSize, setRelativeSize] = useState(0);
21
+ const getDrawerItemSizes = useCallback(() => {
22
+ const sizes = {};
23
+ if (!drawerItems) {
24
+ return {};
25
+ }
26
+ for (const item of drawerItems) {
27
+ if (item.defaultSize) {
28
+ sizes[item.id] = item.defaultSize;
29
+ }
30
+ }
31
+ return sizes;
32
+ }, [drawerItems]);
33
+ const [drawerItemSizes, setDrawerItemSizes] = useState(() => getDrawerItemSizes());
34
+ const drawerSize = !activeDrawerId && !isToolsOpen
35
+ ? 0
36
+ : activeDrawerId && drawerItemSizes[activeDrawerId]
37
+ ? drawerItemSizes[activeDrawerId]
38
+ : toolsWidth;
39
+ useEffect(() => {
40
+ // Ensure we only set new drawer items by performing a shallow merge
41
+ // of the latest drawer item sizes, and previous drawer item sizes.
42
+ setDrawerItemSizes(prev => (Object.assign(Object.assign({}, getDrawerItemSizes()), prev)));
43
+ }, [getDrawerItemSizes]);
44
+ useEffect(() => {
45
+ // effects are called inside out in the components tree
46
+ // wait one frame to allow app-layout to complete its calculations
47
+ const handle = requestAnimationFrame(() => {
48
+ const maxSize = drawersMaxWidth;
49
+ setRelativeSize(((drawerSize - MIN_WIDTH) / (maxSize - MIN_WIDTH)) * 100);
50
+ });
51
+ return () => cancelAnimationFrame(handle);
52
+ }, [drawerSize, drawersMaxWidth, MIN_WIDTH]);
53
+ const drawerResize = (resizeDetail) => {
54
+ const drawerItem = drawers === null || drawers === void 0 ? void 0 : drawers.items.find(item => item.id === resizeDetail.id);
55
+ fireNonCancelableEvent(drawerItem === null || drawerItem === void 0 ? void 0 : drawerItem.onResize, resizeDetail);
56
+ fireNonCancelableEvent(drawers === null || drawers === void 0 ? void 0 : drawers.onResize, resizeDetail);
57
+ setDrawerItemSizes(Object.assign(Object.assign({}, drawerItemSizes), { [resizeDetail.id]: resizeDetail.size }));
58
+ };
59
+ const setSidePanelWidth = (width) => {
60
+ const maxWidth = drawersMaxWidth;
61
+ const size = getLimitedValue(MIN_WIDTH, width, maxWidth);
62
+ const id = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.id;
63
+ if (id && maxWidth >= MIN_WIDTH) {
64
+ drawerResize({ size, id });
65
+ }
66
+ };
67
+ const position = 'side';
68
+ const setBottomPanelHeight = () => { };
69
+ const sizeControlProps = {
70
+ position,
71
+ panelRef: drawerRefObject,
72
+ handleRef: drawersRefs.slider,
73
+ setSidePanelWidth,
74
+ setBottomPanelHeight,
75
+ hasTransitions: true,
76
+ };
77
+ const onSliderPointerDown = usePointerEvents(sizeControlProps);
78
+ const onKeyDown = useKeyboardEvents(sizeControlProps);
79
+ const resizeHandle = (React.createElement("div", { ref: drawersRefs.slider, role: "slider", tabIndex: 0, "aria-label": (_b = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.ariaLabels) === null || _b === void 0 ? void 0 : _b.resizeHandle, "aria-valuemax": 100, "aria-valuemin": 0, "aria-valuenow": relativeSize, className: clsx(splitPanelStyles.slider, splitPanelStyles[`slider-side`], testutilStyles['drawers-slider']), onKeyDown: onKeyDown, onPointerDown: onSliderPointerDown },
80
+ React.createElement(ResizeHandler, { className: clsx(splitPanelStyles['slider-icon'], splitPanelStyles[`slider-icon-side`]) })));
81
+ return { resizeHandle: React.createElement("div", { className: styles['drawer-slider'] }, resizeHandle), drawerSize };
82
+ }
83
+ export default useResize;
84
+ //# sourceMappingURL=use-resize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-resize.js","sourceRoot":"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AG,EAAE,GAAE,CAAC,CAAC;IAEtC,MAAM,gBAAgB,GAAqB;QACzC,QAAQ;QACR,QAAQ,EAAE,eAAe;QACzB,SAAS,EAAE,WAAW,CAAC,MAAM;QAC7B,iBAAiB;QACjB,oBAAoB;QACpB,cAAc,EAAE,IAAI;KACrB,CAAC;IAEF,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAC/D,MAAM,SAAS,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAEtD,MAAM,YAAY,GAAG,CACnB,6BACE,GAAG,EAAE,WAAW,CAAC,MAAM,EACvB,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,gBACC,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,UAAU,0CAAE,YAAY,mBACnC,GAAG,mBACH,CAAC,mBACD,YAAY,EAC3B,SAAS,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,CAAC,aAAa,CAAC,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC,EAC3G,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,mBAAmB;QAElC,oBAAC,aAAa,IAAC,SAAS,EAAE,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,GAAI,CACrG,CACP,CAAC;IAEF,OAAO,EAAE,YAAY,EAAE,6BAAK,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,IAAG,YAAY,CAAO,EAAE,UAAU,EAAE,CAAC;AACrG,CAAC;AAED,eAAe,SAAS,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState, useEffect, useMemo, useCallback } from 'react';\n\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport clsx from 'clsx';\n\nimport ResizeHandler from '../../split-panel/icons/resize-handler';\nimport { getLimitedValue } from '../../split-panel/utils/size-utils';\nimport { usePointerEvents } from './use-pointer-events';\nimport { useKeyboardEvents } from './use-keyboard-events';\nimport { InternalDrawerProps } from '../drawer/interfaces';\n\nimport splitPanelStyles from '../../split-panel/styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from '../visual-refresh/styles.css.js';\nimport { DrawerFocusControlRefs } from './use-drawer-focus-control';\nimport { SizeControlProps } from './interfaces';\n\nexport interface DrawerResizeProps {\n activeDrawerId?: string | null;\n drawers: InternalDrawerProps['drawers'];\n drawersRefs: DrawerFocusControlRefs;\n isToolsOpen: boolean;\n drawersMaxWidth: number;\n}\n\nfunction useResize(drawerRefObject: React.RefObject<HTMLDivElement>, drawerResizeProps: DrawerResizeProps) {\n const { activeDrawerId, drawers, drawersRefs, isToolsOpen, drawersMaxWidth } = drawerResizeProps;\n\n const activeDrawer = drawers?.items.find(item => item.id === activeDrawerId) ?? null;\n const drawerItems = useMemo(() => drawers?.items || [], [drawers?.items]);\n const toolsWidth = 290;\n const MIN_WIDTH = activeDrawer?.defaultSize && activeDrawer.defaultSize < 290 ? activeDrawer?.defaultSize : 290;\n const [relativeSize, setRelativeSize] = useState(0);\n const getDrawerItemSizes = useCallback(() => {\n const sizes: { [id: string]: number } = {};\n if (!drawerItems) {\n return {};\n }\n\n for (const item of drawerItems) {\n if (item.defaultSize) {\n sizes[item.id] = item.defaultSize;\n }\n }\n return sizes;\n }, [drawerItems]);\n const [drawerItemSizes, setDrawerItemSizes] = useState(() => getDrawerItemSizes());\n\n const drawerSize =\n !activeDrawerId && !isToolsOpen\n ? 0\n : activeDrawerId && drawerItemSizes[activeDrawerId]\n ? drawerItemSizes[activeDrawerId]\n : toolsWidth;\n\n useEffect(() => {\n // Ensure we only set new drawer items by performing a shallow merge\n // of the latest drawer item sizes, and previous drawer item sizes.\n setDrawerItemSizes(prev => ({ ...getDrawerItemSizes(), ...prev }));\n }, [getDrawerItemSizes]);\n\n useEffect(() => {\n // effects are called inside out in the components tree\n // wait one frame to allow app-layout to complete its calculations\n const handle = requestAnimationFrame(() => {\n const maxSize = drawersMaxWidth;\n setRelativeSize(((drawerSize - MIN_WIDTH) / (maxSize - MIN_WIDTH)) * 100);\n });\n return () => cancelAnimationFrame(handle);\n }, [drawerSize, drawersMaxWidth, MIN_WIDTH]);\n\n const drawerResize = (resizeDetail: { size: number; id: string }) => {\n const drawerItem = drawers?.items.find(item => item.id === resizeDetail.id);\n fireNonCancelableEvent(drawerItem?.onResize, resizeDetail);\n fireNonCancelableEvent(drawers?.onResize, resizeDetail);\n setDrawerItemSizes({ ...drawerItemSizes, [resizeDetail.id]: resizeDetail.size });\n };\n\n const setSidePanelWidth = (width: number) => {\n const maxWidth = drawersMaxWidth;\n const size = getLimitedValue(MIN_WIDTH, width, maxWidth);\n const id = activeDrawer?.id;\n\n if (id && maxWidth >= MIN_WIDTH) {\n drawerResize({ size, id });\n }\n };\n\n const position = 'side';\n const setBottomPanelHeight = () => {};\n\n const sizeControlProps: SizeControlProps = {\n position,\n panelRef: drawerRefObject,\n handleRef: drawersRefs.slider,\n setSidePanelWidth,\n setBottomPanelHeight,\n hasTransitions: true,\n };\n\n const onSliderPointerDown = usePointerEvents(sizeControlProps);\n const onKeyDown = useKeyboardEvents(sizeControlProps);\n\n const resizeHandle = (\n <div\n ref={drawersRefs.slider}\n role=\"slider\"\n tabIndex={0}\n aria-label={activeDrawer?.ariaLabels?.resizeHandle}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={relativeSize}\n className={clsx(splitPanelStyles.slider, splitPanelStyles[`slider-side`], testutilStyles['drawers-slider'])}\n onKeyDown={onKeyDown}\n onPointerDown={onSliderPointerDown}\n >\n <ResizeHandler className={clsx(splitPanelStyles['slider-icon'], splitPanelStyles[`slider-icon-side`])} />\n </div>\n );\n\n return { resizeHandle: <div className={styles['drawer-slider']}>{resizeHandle}</div>, drawerSize };\n}\n\nexport default useResize;\n"]}
@@ -1,14 +1,18 @@
1
1
  import React from 'react';
2
2
  import { AppLayoutProps } from '../interfaces';
3
- import { DrawersProps } from './drawers';
4
3
  import { FocusControlRefs } from '../utils/use-focus-control';
4
+ import { DrawerFocusControlRefs } from '../utils/use-drawer-focus-control';
5
5
  import { SplitPanelFocusControlRefs } from '../utils/use-split-panel-focus-control';
6
6
  import { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';
7
+ import { InternalDrawerProps } from '../drawer/interfaces';
7
8
  interface AppLayoutInternals extends AppLayoutProps {
8
- activeDrawerId: string | null;
9
- activeDrawerWidth: number;
10
- drawers: DrawersProps;
11
- drawersRefs: FocusControlRefs;
9
+ activeDrawerId?: string | null;
10
+ drawers?: InternalDrawerProps['drawers'];
11
+ drawersRefs: DrawerFocusControlRefs;
12
+ drawerSize: number;
13
+ drawersMaxWidth: number;
14
+ drawerRef: React.Ref<HTMLElement>;
15
+ resizeHandle: React.ReactElement;
12
16
  drawersTriggerCount: number;
13
17
  dynamicOverlapHeight: number;
14
18
  handleDrawersClick: (activeDrawerId: string | null, skipFocusControl?: boolean) => void;
@@ -22,7 +26,7 @@ interface AppLayoutInternals extends AppLayoutProps {
22
26
  hasDefaultToolsWidth: boolean;
23
27
  hasDrawerViewportOverlay: boolean;
24
28
  hasNotificationsContent: boolean;
25
- hasOpenDrawer: boolean;
29
+ hasOpenDrawer?: boolean;
26
30
  hasStickyBackground: boolean;
27
31
  isMobile: boolean;
28
32
  isNavigationOpen: boolean;
@@ -32,6 +36,7 @@ interface AppLayoutInternals extends AppLayoutProps {
32
36
  layoutElement: React.Ref<HTMLElement>;
33
37
  layoutWidth: number;
34
38
  loseToolsFocus: () => void;
39
+ loseDrawersFocus: () => void;
35
40
  mainElement: React.Ref<HTMLDivElement>;
36
41
  mainOffsetLeft: number;
37
42
  navigationRefs: FocusControlRefs;
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/context.tsx"],"names":[],"mappings":"AAEA,OAAO,KASN,MAAM,OAAO,CAAC;AAIf,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AE,MAAM,CAAC;IAC/B,8BAA8B,EAAE,MAAM,CAAC;IACvC,gBAAgB,EAAE,yBAAyB,CAAC;IAC5C,mBAAmB,EAAE,CAAC,MAAM,EAAE,yBAAyB,KAAK,IAAI,CAAC;IACjE,mBAAmB,EAAE,OAAO,CAAC;IAC7B,cAAc,EAAE,0BAA0B,CAAC;IAC3C,SAAS,EAAE,gBAAgB,CAAC;CAC7B;AASD,UAAU,+BAAgC,SAAQ,cAAc;IAC9D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,qBAAqB,uBAMpC;AAED,eAAO,MAAM,0BAA0B,4GAkjBtC,CAAC"}
@@ -7,6 +7,7 @@ import { AppLayoutContext } from '../../internal/context/app-layout-context';
7
7
  import { DynamicOverlapContext } from '../../internal/context/dynamic-overlap-context';
8
8
  import { fireNonCancelableEvent } from '../../internal/events';
9
9
  import { useFocusControl } from '../utils/use-focus-control';
10
+ import { useDrawerFocusControl } from '../utils/use-drawer-focus-control';
10
11
  import { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';
11
12
  import { isDevelopment } from '../../internal/is-development';
12
13
  import { getSplitPanelPosition } from './split-panel';
@@ -16,6 +17,7 @@ import { useSplitPanelFocusControl } from '../utils/use-split-panel-focus-contro
16
17
  import { useObservedElement } from '../utils/use-observed-element';
17
18
  import { useMobile } from '../../internal/hooks/use-mobile';
18
19
  import { warnOnce } from '@cloudscape-design/component-toolkit/internal';
20
+ import useResize from '../utils/use-resize';
19
21
  import styles from './styles.css.js';
20
22
  /**
21
23
  * The default values are destructured in the context instantiation to
@@ -251,18 +253,30 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
251
253
  controlledProp: 'drawers.activeDrawerId',
252
254
  changeHandler: 'onChange',
253
255
  });
254
- const activeDrawerWidth = 290;
255
- const { refs: drawersRefs, setFocus: focusDrawersButtons } = useFocusControl(activeDrawerId);
256
+ const [drawersMaxWidth, setDrawersMaxWidth] = useState(toolsWidth);
257
+ const activeDrawer = drawers === null || drawers === void 0 ? void 0 : drawers.items.find(drawer => drawer.id === activeDrawerId);
258
+ const { refs: drawersRefs, setFocus: focusDrawersButtons, loseFocus: loseDrawersFocus, setLastInteraction: setDrawerLastInteraction, } = useDrawerFocusControl([activeDrawerId, activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.resizable], activeDrawerId !== undefined, true);
259
+ const drawerRef = useRef(null);
260
+ const { resizeHandle, drawerSize } = useResize(drawerRef, {
261
+ activeDrawerId,
262
+ drawers,
263
+ drawersRefs,
264
+ isToolsOpen,
265
+ drawersMaxWidth,
266
+ });
256
267
  const handleDrawersClick = useCallback(function handleDrawersChange(id, skipFocusControl) {
257
268
  const newActiveDrawerId = id !== activeDrawerId ? id : null;
258
269
  setActiveDrawerId(newActiveDrawerId);
259
270
  !skipFocusControl && focusDrawersButtons();
260
271
  fireNonCancelableEvent(drawers === null || drawers === void 0 ? void 0 : drawers.onChange, newActiveDrawerId);
261
- }, [activeDrawerId, drawers === null || drawers === void 0 ? void 0 : drawers.onChange, focusDrawersButtons, setActiveDrawerId]);
272
+ setDrawerLastInteraction({ type: activeDrawerId ? 'close' : 'open' });
273
+ }, [activeDrawerId, drawers === null || drawers === void 0 ? void 0 : drawers.onChange, focusDrawersButtons, setActiveDrawerId, setDrawerLastInteraction]);
262
274
  const drawersTriggerCount = ((_e = drawers === null || drawers === void 0 ? void 0 : drawers.items.length) !== null && _e !== void 0 ? _e : 0) +
263
275
  (splitPanelDisplayed && splitPanelPosition === 'side' ? 1 : 0) +
264
276
  (!toolsHide ? 1 : 0);
265
- const hasOpenDrawer = activeDrawerId || isToolsOpen || (splitPanelDisplayed && splitPanelPosition === 'side' && isSplitPanelOpen);
277
+ const hasOpenDrawer = activeDrawerId !== null ||
278
+ isToolsOpen ||
279
+ (splitPanelDisplayed && splitPanelPosition === 'side' && isSplitPanelOpen);
266
280
  const hasDrawerViewportOverlay = isMobile && (!!activeDrawerId || (!navigationHide && isNavigationOpen) || (!toolsHide && isToolsOpen));
267
281
  /**
268
282
  * The Layout element is not necessarily synonymous with the client
@@ -347,7 +361,7 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
347
361
  const contentGapRight = 80; // Approximately 40px when rendered but doubled for safety
348
362
  const toolsFormOffsetWidth = 160; // Approximately 80px when rendered but doubled for safety
349
363
  const toolsOffsetWidth = isToolsOpen ? toolsWidth : 0;
350
- const activeDrawerOffsetWidth = activeDrawerId ? activeDrawerWidth : 0;
364
+ const activeDrawerOffsetWidth = activeDrawerId ? drawerSize : 0;
351
365
  setSplitPanelMaxWidth(layoutWidth -
352
366
  mainOffsetLeft -
353
367
  minContentWidth -
@@ -355,9 +369,10 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
355
369
  toolsOffsetWidth -
356
370
  toolsFormOffsetWidth -
357
371
  activeDrawerOffsetWidth);
372
+ setDrawersMaxWidth(layoutWidth - mainOffsetLeft - minContentWidth - contentGapRight - toolsFormOffsetWidth);
358
373
  }, [
359
374
  activeDrawerId,
360
- activeDrawerWidth,
375
+ drawerSize,
361
376
  isNavigationOpen,
362
377
  isToolsOpen,
363
378
  layoutWidth,
@@ -366,10 +381,13 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
366
381
  toolsWidth,
367
382
  ]);
368
383
  return (React.createElement(AppLayoutInternalsContext.Provider, { value: Object.assign(Object.assign({}, props), { activeDrawerId,
369
- activeDrawerWidth,
370
384
  contentType,
371
385
  drawers,
372
386
  drawersRefs,
387
+ drawersMaxWidth,
388
+ drawerSize,
389
+ drawerRef,
390
+ resizeHandle,
373
391
  drawersTriggerCount,
374
392
  dynamicOverlapHeight,
375
393
  headerHeight,
@@ -391,6 +409,7 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
391
409
  layoutElement,
392
410
  layoutWidth,
393
411
  loseToolsFocus,
412
+ loseDrawersFocus,
394
413
  mainElement,
395
414
  mainOffsetLeft,
396
415
  maxContentWidth,
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/context.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EACZ,aAAa,EACb,WAAW,EACX,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,UAAU,GACX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAGvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAoB,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAA8B,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAE/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACzE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAmDrC;;;;GAIG;AACH,MAAM,yBAAyB,GAAG,aAAa,CAA4B,IAAI,CAAC,CAAC;AAMjF,MAAM,UAAU,qBAAqB;IACnC,MAAM,GAAG,GAAG,UAAU,CAAC,yBAAyB,CAAC,CAAC;IAClD,IAAI,CA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ACrB,sBAAsB;YACtB,8BAA8B;YAC9B,cAAc;YACd,gBAAgB;YAChB,mBAAmB;YACnB,cAAc;YACd,SAAS,EACT,SAAS,EAAE,WAAW,EACtB,UAAU;YACV,SAAS;QAGX,oBAAC,gBAAgB,CAAC,QAAQ,IACxB,KAAK,EAAE;gBACL,kBAAkB,EAAE,YAAY;gBAChC,eAAe,EAAE,CAAC;gBAClB,sBAAsB;aACvB;YAED,oBAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,uBAAuB,IAAG,QAAQ,CAAkC,CACjF,CACO,CACtC,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, {\n createContext,\n useCallback,\n useEffect,\n useLayoutEffect,\n useImperativeHandle,\n useRef,\n useState,\n useContext,\n} from 'react';\nimport { applyDefaults } from '../defaults';\nimport { AppLayoutContext } from '../../internal/context/app-layout-context';\nimport { DynamicOverlapContext } from '../../internal/context/dynamic-overlap-context';\nimport { AppLayoutProps } from '../interfaces';\nimport { DrawersProps } from './drawers';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport { FocusControlRefs, useFocusControl } from '../utils/use-focus-control';\nimport { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';\nimport { isDevelopment } from '../../internal/is-development';\nimport { getSplitPanelPosition } from './split-panel';\nimport { useContainerQuery } from '../../internal/hooks/container-queries';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { SplitPanelFocusControlRefs, useSplitPanelFocusControl } from '../utils/use-split-panel-focus-control';\nimport { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';\nimport { useObservedElement } from '../utils/use-observed-element';\nimport { useMobile } from '../../internal/hooks/use-mobile';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport styles from './styles.css.js';\n\ninterface AppLayoutInternals extends AppLayoutProps {\n activeDrawerId: string | null;\n activeDrawerWidth: number;\n drawers: DrawersProps;\n drawersRefs: FocusControlRefs;\n drawersTriggerCount: number;\n dynamicOverlapHeight: number;\n handleDrawersClick: (activeDrawerId: string | null, skipFocusControl?: boolean) => void;\n handleSplitPanelClick: () => void;\n handleNavigationClick: (isOpen: boolean) => void;\n handleSplitPanelPreferencesChange: (detail: AppLayoutProps.SplitPanelPreferences) => void;\n handleSplitPanelResize: (detail: { size: number }) => void;\n handleToolsClick: (value: boolean, skipFocusControl?: boolean) => void;\n hasDefaultToolsWidth: boolean;\n hasDrawerViewportOverlay: boolean;\n hasNotificationsContent: boolean;\n hasOpenDrawer: boolean;\n hasStickyBackground: boolean;\n isMobile: boolean;\n isNavigationOpen: boolean;\n isSplitPanelForcedPosition: boolean;\n isSplitPanelOpen?: boolean;\n isToolsOpen: boolean;\n layoutElement: React.Ref<HTMLElement>;\n layoutWidth: number;\n loseToolsFocus: () => void;\n mainElement: React.Ref<HTMLDivElement>;\n mainOffsetLeft: number;\n navigationRefs: FocusControlRefs;\n notificationsElement: React.Ref<HTMLDivElement>;\n notificationsHeight: number;\n offsetBottom: number;\n setHasStickyBackground: (value: boolean) => void;\n setSplitPanelReportedSize: (value: number) => void;\n setSplitPanelReportedHeaderHeight: (value: number) => void;\n headerHeight: number;\n footerHeight: number;\n splitPanelMaxWidth: number;\n splitPanelMinWidth: number;\n splitPanelPosition: AppLayoutProps.SplitPanelPosition;\n splitPanelReportedSize: number;\n splitPanelReportedHeaderHeight: number;\n splitPanelToggle: SplitPanelSideToggleProps;\n setSplitPanelToggle: (toggle: SplitPanelSideToggleProps) => void;\n splitPanelDisplayed: boolean;\n splitPanelRefs: SplitPanelFocusControlRefs;\n toolsRefs: FocusControlRefs;\n}\n\n/**\n * The default values are destructured in the context instantiation to\n * prevent downstream Typescript errors. This could likely be replaced\n * by a context interface definition that extends the AppLayout interface.\n */\nconst AppLayoutInternalsContext = createContext<AppLayoutInternals | null>(null);\n\ninterface AppLayoutProviderInternalsProps extends AppLayoutProps {\n children: React.ReactNode;\n}\n\nexport function useAppLayoutInternals() {\n const ctx = useContext(AppLayoutInternalsContext);\n if (!ctx) {\n throw new Error('Invariant violation: this context is only available inside app layout');\n }\n return ctx;\n}\n\nexport const AppLayoutInternalsProvider = React.forwardRef(\n (\n {\n toolsHide,\n toolsOpen: controlledToolsOpen,\n navigationHide,\n navigationOpen: controlledNavigationOpen,\n contentType = 'default',\n headerSelector = '#b #h',\n footerSelector = '#b #h',\n children,\n splitPanel,\n ...props\n }: AppLayoutProviderInternalsProps,\n forwardRef: React.Ref<AppLayoutProps.Ref>\n ) => {\n const isMobile = useMobile();\n\n if (isDevelopment) {\n if (controlledToolsOpen && toolsHide) {\n warnOnce(\n 'AppLayout',\n `You have enabled both the \\`toolsOpen\\` prop and the \\`toolsHide\\` prop. This is not supported. Set \\`toolsOpen\\` to \\`false\\` when you set \\`toolsHide\\` to \\`true\\`.`\n );\n }\n }\n\n /**\n * The overlap height has a default set in CSS but can also be dynamically overridden\n * for content types (such as Table and Wizard) that have variable size content in the overlap.\n * If a child component utilizes a sticky header the hasStickyBackground property will determine\n * if the background remains in the same vertical position.\n */\n const [dynamicOverlapHeight, setDynamicOverlapHeight] = useState(0);\n const [hasStickyBackground, setHasStickyBackground] = useState(false);\n\n /**\n * Set the default values for minimum and maximum content width.\n */\n const geckoMaxCssLength = ((1 << 30) - 1) / 60;\n const halfGeckoMaxCssLength = geckoMaxCssLength / 2;\n // CSS lengths in Gecko are limited to at most (1<<30)-1 app units (Gecko uses 60 as app unit).\n // Limit the maxContentWidth to the half of the upper boundary (≈4230^2) to be on the safe side.\n const maxContentWidth =\n props.maxContentWidth && props.maxContentWidth > halfGeckoMaxCssLength\n ? halfGeckoMaxCssLength\n : props.maxContentWidth ?? 0;\n const minContentWidth = props.minContentWidth ?? 280;\n\n /**\n * Determine the default state of the Navigation and Tools drawers.\n * Mobile viewports should be closed by default under all circumstances.\n * If the navigationOpen prop has been set then that should take precedence\n * over the contentType prop. Desktop viewports that do not have the\n * navigationOpen or contentType props set will use the default contentType.\n */\n const contentTypeDefaults = applyDefaults(contentType, { maxContentWidth, minContentWidth }, true);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Navigation drawer. The logic\n * for determining the default state is colocated with the Navigation component.\n *\n * The callback that will be passed to the Navigation and MobileToolbar\n * components to handle the click events that will change the state\n * of the Navigation drawer. It will set the Navigation state with the\n * useControllable hook and also fire the onNavigationChange function to\n * emit the state change.\n */\n const [isNavigationOpen = false, setIsNavigationOpen] = useControllable(\n controlledNavigationOpen,\n props.onNavigationChange,\n isMobile ? false : contentTypeDefaults.navigationOpen,\n { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }\n );\n\n const { refs: navigationRefs, setFocus: focusNavButtons } = useFocusControl(isNavigationOpen);\n\n const handleNavigationClick = useCallback(\n function handleNavigationChange(isOpen: boolean) {\n setIsNavigationOpen(isOpen);\n focusNavButtons();\n fireNonCancelableEvent(props.onNavigationChange, { open: isOpen });\n },\n [props.onNavigationChange, setIsNavigationOpen, focusNavButtons]\n );\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Tools drawer. The logic\n * for determining the default state is colocated with the Tools component.\n *\n * The callback that will be passed to the Navigation and MobileToolbar\n * components to handle the click events that will change the state\n * of the Tools drawer. It will set the Tools state with the\n * useControllable hook and also fire the onToolsChange function to\n * emit the state change.\n */\n const toolsWidth = props.toolsWidth ?? 290;\n const hasDefaultToolsWidth = props.toolsWidth === undefined;\n\n const [isToolsOpen = false, setIsToolsOpen] = useControllable(\n controlledToolsOpen,\n props.onToolsChange,\n isMobile ? false : contentTypeDefaults.toolsOpen,\n { componentName: 'AppLayout', controlledProp: 'toolsOpen', changeHandler: 'onToolsChange' }\n );\n\n const {\n refs: toolsRefs,\n setFocus: focusToolsButtons,\n loseFocus: loseToolsFocus,\n } = useFocusControl(isToolsOpen, true);\n\n const handleToolsClick = useCallback(\n function handleToolsChange(isOpen: boolean, skipFocusControl?: boolean) {\n setIsToolsOpen(isOpen);\n !skipFocusControl && focusToolsButtons();\n fireNonCancelableEvent(props.onToolsChange, { open: isOpen });\n },\n [props.onToolsChange, setIsToolsOpen, focusToolsButtons]\n );\n\n /**\n * On mobile viewports the navigation and tools drawers are adjusted to a fixed position\n * that consumes 100% of the viewport height and width. The body content could potentially\n * be scrollable underneath the drawer. In order to prevent this a CSS class needs to be\n * added to the document body that sets overflow to hidden.\n */\n useEffect(\n function handleBodyScroll() {\n if (isMobile && (isNavigationOpen || isToolsOpen)) {\n document.body.classList.add(styles['block-body-scroll']);\n } else {\n document.body.classList.remove(styles['block-body-scroll']);\n }\n\n // Ensure the CSS class is removed from the body on side effect cleanup\n return function cleanup() {\n document.body.classList.remove(styles['block-body-scroll']);\n };\n },\n [isMobile, isNavigationOpen, isToolsOpen]\n );\n\n /**\n * The useImperativeHandle hook in conjunction with the forwardRef function\n * in the AppLayout component definition expose the following callable\n * functions to component consumers when they put a ref as a property on\n * their component implementation.\n */\n useImperativeHandle(\n forwardRef,\n function createImperativeHandle() {\n return {\n closeNavigationIfNecessary: function () {\n isMobile && handleNavigationClick(false);\n },\n openTools: function () {\n handleToolsClick(true);\n },\n focusToolsClose: () => focusToolsButtons(true),\n };\n },\n [isMobile, handleNavigationClick, handleToolsClick, focusToolsButtons]\n );\n\n /**\n * Query the DOM for the header and footer elements based on the selectors provided\n * by the properties and pass the heights to the custom property definitions.\n */\n const headerHeight = useObservedElement(headerSelector);\n const footerHeight = useObservedElement(footerSelector);\n\n /**\n * Set the default values for the minimum and maximum Split Panel width when it is\n * in the side position. The useLayoutEffect will compute the available space in the\n * DOM for the Split Panel given the current state. The minimum and maximum\n * widths will potentially trigger a side effect that will put the Split Panel into\n * a forced position on the bottom.\n */\n const splitPanelMinWidth = 280;\n const [splitPanelMaxWidth, setSplitPanelMaxWidth] = useState(splitPanelMinWidth);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Split Panel. By default\n * the Split Panel should always be closed on page load.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the click events that will change the state of the SplitPanel\n * to open or closed given the current state. It will set the isSplitPanelOpen\n * controlled state and fire the onSplitPanelToggle event.\n */\n const [isSplitPanelOpen, setIsSplitPanelOpen] = useControllable(\n props.splitPanelOpen,\n props.onSplitPanelToggle,\n false,\n { componentName: 'AppLayout', controlledProp: 'splitPanelOpen', changeHandler: 'onSplitPanelToggle' }\n );\n\n /**\n * The useControllable hook will manage the controlled or uncontrolled\n * state of the splitPanelPreferences. By default the splitPanelPreferences\n * is undefined. When set the object shape should have a single key to indicate\n * either bottom or side position.\n *\n * The callback that will handle changes to the splitPanelPreferences\n * object that will determine if the SplitPanel is rendered either on the\n * bottom of the viewport or within the Tools container.\n */\n const [splitPanelPreferences, setSplitPanelPreferences] = useControllable(\n props.splitPanelPreferences,\n props.onSplitPanelPreferencesChange,\n undefined,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelPreferences',\n changeHandler: 'onSplitPanelPreferencesChange',\n }\n );\n\n const { refs: splitPanelRefs, setLastInteraction: setSplitPanelLastInteraction } = useSplitPanelFocusControl([\n splitPanelPreferences,\n isSplitPanelOpen,\n ]);\n\n const handleSplitPanelClick = useCallback(\n function handleSplitPanelChange() {\n setIsSplitPanelOpen(!isSplitPanelOpen);\n setSplitPanelLastInteraction({ type: isSplitPanelOpen ? 'close' : 'open' });\n fireNonCancelableEvent(props.onSplitPanelToggle, { open: !isSplitPanelOpen });\n },\n [props.onSplitPanelToggle, isSplitPanelOpen, setIsSplitPanelOpen, setSplitPanelLastInteraction]\n );\n\n /**\n * The Split Panel will be in forced (bottom) position if the defined minimum width is\n * greater than the maximum width. In other words, the maximum width is the currently\n * available horizontal space based on all other components that are rendered. If the\n * minimum width exceeds this value then there is not enough horizontal space and we must\n * force it to the bottom position.\n */\n const [isSplitPanelForcedPosition, setSplitPanelForcedPosition] = useState(false);\n const splitPanelPosition = getSplitPanelPosition(isSplitPanelForcedPosition, splitPanelPreferences);\n\n useLayoutEffect(\n function handleSplitPanelForcePosition() {\n setSplitPanelForcedPosition(splitPanelMinWidth > splitPanelMaxWidth);\n },\n [splitPanelMaxWidth, splitPanelMinWidth]\n );\n\n /**\n * The useControllable hook will set the default size of the SplitPanel based\n * on the default position set in the splitPanelPreferences. The logic for the\n * default size is contained in the SplitPanel component. The splitPanelControlledSize\n * will be bound to the size property in the SplitPanel context for rendering.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the resize events that will change the size of the SplitPanel.\n * It will set the splitPanelControlledSize controlled state and fire the\n * onSplitPanelResize event.\n */\n const [splitPanelReportedSize, setSplitPanelReportedSize] = useState(0);\n const [splitPanelReportedHeaderHeight, setSplitPanelReportedHeaderHeight] = useState(0);\n const [splitPanelToggle, setSplitPanelToggle] = useState<SplitPanelSideToggleProps>({\n displayed: false,\n ariaLabel: undefined,\n });\n const splitPanelDisplayed = !!(splitPanelToggle.displayed || isSplitPanelOpen);\n\n const [splitPanelSize, setSplitPanelSize] = useControllable(\n props.splitPanelSize,\n props.onSplitPanelResize,\n getSplitPanelDefaultSize(splitPanelPosition),\n { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' }\n );\n\n const handleSplitPanelResize = useCallback(\n function handleSplitPanelChange(detail: { size: number }) {\n setSplitPanelSize(detail.size);\n fireNonCancelableEvent(props.onSplitPanelResize, detail);\n },\n [props.onSplitPanelResize, setSplitPanelSize]\n );\n\n const handleSplitPanelPreferencesChange = useCallback(\n function handleSplitPanelChange(detail: AppLayoutProps.SplitPanelPreferences) {\n setSplitPanelPreferences(detail);\n setSplitPanelLastInteraction({ type: 'position' });\n fireNonCancelableEvent(props.onSplitPanelPreferencesChange, detail);\n },\n [props.onSplitPanelPreferencesChange, setSplitPanelPreferences, setSplitPanelLastInteraction]\n );\n\n /**\n * The activeDrawerWidth is required in JavaScript to acccurately calculate whether a SplitPanel\n * in the side position should be forced to the bottom based on available horiziontal space.\n *\n * The handleDrawersClick will either open a new drawer or close the currently open drawer by setting\n * the activeDrawerId value. The active drawer can also be closed if a user clicks the Tools trigger\n * button. This will skip the focus handling because the focus should be going to the Tools close\n * button and not one of the drawers trigger buttons.\n *\n * The drawersTriggerCount is computed in order to determine whether the triggers should be persistent\n * in the UI when a drawer is open. The trigger button container is suppressed when a drawer is open\n * and their is only one trigger button.\n *\n * The hasDrawerViewportOverlay property is used to determine if any drawer is obscuring the entire\n * viewport. This currently applies to Navigation, Tools, and Drawers in mobile viewports.\n */\n const drawers = (props as any).drawers;\n\n const [activeDrawerId, setActiveDrawerId] = useControllable(drawers?.activeDrawerId, drawers?.onChange, null, {\n componentName: 'AppLayout',\n controlledProp: 'drawers.activeDrawerId',\n changeHandler: 'onChange',\n });\n\n const activeDrawerWidth = 290;\n\n const { refs: drawersRefs, setFocus: focusDrawersButtons } = useFocusControl(activeDrawerId);\n\n const handleDrawersClick = useCallback(\n function handleDrawersChange(id: string | null, skipFocusControl?: boolean) {\n const newActiveDrawerId = id !== activeDrawerId ? id : null;\n\n setActiveDrawerId(newActiveDrawerId);\n !skipFocusControl && focusDrawersButtons();\n fireNonCancelableEvent(drawers?.onChange, newActiveDrawerId);\n },\n [activeDrawerId, drawers?.onChange, focusDrawersButtons, setActiveDrawerId]\n );\n\n const drawersTriggerCount =\n (drawers?.items.length ?? 0) +\n (splitPanelDisplayed && splitPanelPosition === 'side' ? 1 : 0) +\n (!toolsHide ? 1 : 0);\n const hasOpenDrawer =\n activeDrawerId || isToolsOpen || (splitPanelDisplayed && splitPanelPosition === 'side' && isSplitPanelOpen);\n const hasDrawerViewportOverlay =\n isMobile && (!!activeDrawerId || (!navigationHide && isNavigationOpen) || (!toolsHide && isToolsOpen));\n\n /**\n * The Layout element is not necessarily synonymous with the client\n * viewport width. There can be content in the horizontal viewport\n * that exists on either side of the AppLayout. This resize observer\n * will set the custom property of the Layout element width that\n * is used for various horizontal constraints such as the maximum\n * allowed width of the Tools container.\n *\n * The offsetLeft of the Main will return the distance that the\n * Main element has from the left edge of the Layout component.\n * The offsetLeft value can vary based on the presence and state\n * of the Navigation as well as content gaps in the grid definition.\n * This value is used to determine the max width constraint calculation\n * for the Tools container.\n */\n const [layoutContainerQuery, layoutElement] = useContainerQuery(rect => rect.width);\n const layoutWidth = layoutContainerQuery ?? 0;\n\n const mainElement = useRef<HTMLDivElement>(null);\n const [mainOffsetLeft, setMainOffsetLeft] = useState(0);\n\n useLayoutEffect(\n function handleMainOffsetLeft() {\n setMainOffsetLeft(mainElement?.current?.offsetLeft ?? 0);\n },\n [layoutWidth, isNavigationOpen, isToolsOpen, splitPanelReportedSize]\n );\n\n /**\n * Because the notifications slot does not give us any direction insight into\n * what the state of the child content is we need to have a mechanism for\n * tracking the height of the notifications and whether or not it has content.\n * The height of the notifications is an integer that will be used as a custom\n * property on the Layout component to determine what the sticky offset should\n * be if there are sticky notifications. This could be any number including\n * zero based on how the child content renders. The hasNotificationsContent boolean\n * is simply centralizing the logic of the notifications height being > 0 such\n * that it is not repeated in various components (such as MobileToolbar) that need to\n * know if the notifications slot is empty.\n */\n const [notificationsContainerQuery, notificationsElement] = useContainerQuery(rect => rect.height);\n const [notificationsHeight, setNotificationsHeight] = useState(0);\n const [hasNotificationsContent, setHasNotificationsContent] = useState(false);\n\n useEffect(\n function handleNotificationsContent() {\n setNotificationsHeight(notificationsContainerQuery ?? 0);\n setHasNotificationsContent(notificationsContainerQuery && notificationsContainerQuery > 0 ? true : false);\n },\n [notificationsContainerQuery]\n );\n\n /**\n * Determine the offsetBottom value based on the presence of a footer element and\n * the SplitPanel component. Ignore the SplitPanel if it is not in the bottom\n * position. Use the size property if it is open and the header height if it is closed.\n */\n let offsetBottom = footerHeight;\n\n if (splitPanelDisplayed && splitPanelPosition === 'bottom') {\n if (isSplitPanelOpen) {\n offsetBottom += splitPanelReportedSize;\n } else {\n offsetBottom += splitPanelReportedHeaderHeight;\n }\n }\n\n /**\n * Warning! This is a hack! In order to accurately calculate if there is adequate\n * horizontal space for the Split Panel to be in the side position we need two values\n * that are not available in JavaScript.\n *\n * The first is the the content gap on the right which is stored in a design token\n * and applied in the Layout CSS:\n *\n * $contentGapRight: #{awsui.$space-scaled-2x-xxxl};\n *\n * The second is the width of the element that has the circular buttons for the\n * Tools and Split Panel. This could be suppressed given the state of the Tools\n * drawer returning a zero value. It would, however, be rendered if the Split Panel\n * were to move into the side position. This is calculated in the Tools CSS and\n * the Trigger button CSS with design tokens:\n *\n * padding: awsui.$space-scaled-s awsui.$space-layout-toggle-padding;\n * width: awsui.$space-layout-toggle-diameter;\n *\n * These values will be defined below as static integers that are rough approximations\n * of their computed width when rendered in the DOM, but doubled to ensure adequate\n * spacing for the Split Panel to be in side position.\n */\n useLayoutEffect(\n function handleSplitPanelMaxWidth() {\n const contentGapRight = 80; // Approximately 40px when rendered but doubled for safety\n const toolsFormOffsetWidth = 160; // Approximately 80px when rendered but doubled for safety\n const toolsOffsetWidth = isToolsOpen ? toolsWidth : 0;\n const activeDrawerOffsetWidth = activeDrawerId ? activeDrawerWidth : 0;\n\n setSplitPanelMaxWidth(\n layoutWidth -\n mainOffsetLeft -\n minContentWidth -\n contentGapRight -\n toolsOffsetWidth -\n toolsFormOffsetWidth -\n activeDrawerOffsetWidth\n );\n },\n [\n activeDrawerId,\n activeDrawerWidth,\n isNavigationOpen,\n isToolsOpen,\n layoutWidth,\n mainOffsetLeft,\n minContentWidth,\n toolsWidth,\n ]\n );\n\n return (\n <AppLayoutInternalsContext.Provider\n value={{\n ...props,\n activeDrawerId,\n activeDrawerWidth,\n contentType,\n drawers,\n drawersRefs,\n drawersTriggerCount,\n dynamicOverlapHeight,\n headerHeight,\n footerHeight,\n hasDefaultToolsWidth,\n hasDrawerViewportOverlay,\n handleDrawersClick,\n handleNavigationClick,\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n handleToolsClick,\n hasNotificationsContent,\n hasOpenDrawer,\n hasStickyBackground,\n isMobile,\n isNavigationOpen: isNavigationOpen ?? false,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n isToolsOpen,\n layoutElement,\n layoutWidth,\n loseToolsFocus,\n mainElement,\n mainOffsetLeft,\n maxContentWidth,\n minContentWidth,\n navigationHide,\n navigationRefs,\n notificationsElement,\n notificationsHeight,\n offsetBottom,\n setHasStickyBackground,\n setSplitPanelReportedSize,\n setSplitPanelReportedHeaderHeight,\n splitPanel,\n splitPanelDisplayed,\n splitPanelMaxWidth,\n splitPanelMinWidth,\n splitPanelPosition,\n splitPanelPreferences,\n splitPanelReportedSize,\n splitPanelReportedHeaderHeight,\n splitPanelSize,\n splitPanelToggle,\n setSplitPanelToggle,\n splitPanelRefs,\n toolsHide,\n toolsOpen: isToolsOpen,\n toolsWidth,\n toolsRefs,\n }}\n >\n <AppLayoutContext.Provider\n value={{\n stickyOffsetBottom: offsetBottom,\n stickyOffsetTop: 0, // not used in this design. Sticky headers read a CSS-var instead\n setHasStickyBackground,\n }}\n >\n <DynamicOverlapContext.Provider value={setDynamicOverlapHeight}>{children}</DynamicOverlapContext.Provider>\n </AppLayoutContext.Provider>\n </AppLayoutInternalsContext.Provider>\n );\n }\n);\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/context.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EACZ,aAAa,EACb,WAAW,EACX,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,UAAU,GACX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAEvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAoB,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC/E,O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AhB,gBAAgB,cAAhB,gBAAgB,GAAI,KAAK,EAC3C,0BAA0B;YAC1B,gBAAgB;YAChB,WAAW;YACX,aAAa;YACb,WAAW;YACX,cAAc;YACd,gBAAgB;YAChB,WAAW;YACX,cAAc;YACd,eAAe;YACf,eAAe;YACf,cAAc;YACd,cAAc;YACd,oBAAoB;YACpB,mBAAmB;YACnB,YAAY;YACZ,sBAAsB;YACtB,yBAAyB;YACzB,iCAAiC;YACjC,UAAU;YACV,mBAAmB;YACnB,kBAAkB;YAClB,kBAAkB;YAClB,kBAAkB;YAClB,qBAAqB;YACrB,sBAAsB;YACtB,8BAA8B;YAC9B,cAAc;YACd,gBAAgB;YAChB,mBAAmB;YACnB,cAAc;YACd,SAAS,EACT,SAAS,EAAE,WAAW,EACtB,UAAU;YACV,SAAS;QAGX,oBAAC,gBAAgB,CAAC,QAAQ,IACxB,KAAK,EAAE;gBACL,kBAAkB,EAAE,YAAY;gBAChC,eAAe,EAAE,CAAC;gBAClB,sBAAsB;aACvB;YAED,oBAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,uBAAuB,IAAG,QAAQ,CAAkC,CACjF,CACO,CACtC,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, {\n createContext,\n useCallback,\n useEffect,\n useLayoutEffect,\n useImperativeHandle,\n useRef,\n useState,\n useContext,\n} from 'react';\nimport { applyDefaults } from '../defaults';\nimport { AppLayoutContext } from '../../internal/context/app-layout-context';\nimport { DynamicOverlapContext } from '../../internal/context/dynamic-overlap-context';\nimport { AppLayoutProps } from '../interfaces';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport { FocusControlRefs, useFocusControl } from '../utils/use-focus-control';\nimport { DrawerFocusControlRefs, useDrawerFocusControl } from '../utils/use-drawer-focus-control';\nimport { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';\nimport { isDevelopment } from '../../internal/is-development';\nimport { getSplitPanelPosition } from './split-panel';\nimport { useContainerQuery } from '../../internal/hooks/container-queries';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { SplitPanelFocusControlRefs, useSplitPanelFocusControl } from '../utils/use-split-panel-focus-control';\nimport { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';\nimport { useObservedElement } from '../utils/use-observed-element';\nimport { useMobile } from '../../internal/hooks/use-mobile';\nimport { InternalDrawerProps } from '../drawer/interfaces';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport useResize from '../utils/use-resize';\nimport styles from './styles.css.js';\n\ninterface AppLayoutInternals extends AppLayoutProps {\n activeDrawerId?: string | null;\n drawers?: InternalDrawerProps['drawers'];\n drawersRefs: DrawerFocusControlRefs;\n drawerSize: number;\n drawersMaxWidth: number;\n drawerRef: React.Ref<HTMLElement>;\n resizeHandle: React.ReactElement;\n drawersTriggerCount: number;\n dynamicOverlapHeight: number;\n handleDrawersClick: (activeDrawerId: string | null, skipFocusControl?: boolean) => void;\n handleSplitPanelClick: () => void;\n handleNavigationClick: (isOpen: boolean) => void;\n handleSplitPanelPreferencesChange: (detail: AppLayoutProps.SplitPanelPreferences) => void;\n handleSplitPanelResize: (detail: { size: number }) => void;\n handleToolsClick: (value: boolean, skipFocusControl?: boolean) => void;\n hasDefaultToolsWidth: boolean;\n hasDrawerViewportOverlay: boolean;\n hasNotificationsContent: boolean;\n hasOpenDrawer?: boolean;\n hasStickyBackground: boolean;\n isMobile: boolean;\n isNavigationOpen: boolean;\n isSplitPanelForcedPosition: boolean;\n isSplitPanelOpen?: boolean;\n isToolsOpen: boolean;\n layoutElement: React.Ref<HTMLElement>;\n layoutWidth: number;\n loseToolsFocus: () => void;\n loseDrawersFocus: () => void;\n mainElement: React.Ref<HTMLDivElement>;\n mainOffsetLeft: number;\n navigationRefs: FocusControlRefs;\n notificationsElement: React.Ref<HTMLDivElement>;\n notificationsHeight: number;\n offsetBottom: number;\n setHasStickyBackground: (value: boolean) => void;\n setSplitPanelReportedSize: (value: number) => void;\n setSplitPanelReportedHeaderHeight: (value: number) => void;\n headerHeight: number;\n footerHeight: number;\n splitPanelMaxWidth: number;\n splitPanelMinWidth: number;\n splitPanelPosition: AppLayoutProps.SplitPanelPosition;\n splitPanelReportedSize: number;\n splitPanelReportedHeaderHeight: number;\n splitPanelToggle: SplitPanelSideToggleProps;\n setSplitPanelToggle: (toggle: SplitPanelSideToggleProps) => void;\n splitPanelDisplayed: boolean;\n splitPanelRefs: SplitPanelFocusControlRefs;\n toolsRefs: FocusControlRefs;\n}\n\n/**\n * The default values are destructured in the context instantiation to\n * prevent downstream Typescript errors. This could likely be replaced\n * by a context interface definition that extends the AppLayout interface.\n */\nconst AppLayoutInternalsContext = createContext<AppLayoutInternals | null>(null);\n\ninterface AppLayoutProviderInternalsProps extends AppLayoutProps {\n children: React.ReactNode;\n}\n\nexport function useAppLayoutInternals() {\n const ctx = useContext(AppLayoutInternalsContext);\n if (!ctx) {\n throw new Error('Invariant violation: this context is only available inside app layout');\n }\n return ctx;\n}\n\nexport const AppLayoutInternalsProvider = React.forwardRef(\n (\n {\n toolsHide,\n toolsOpen: controlledToolsOpen,\n navigationHide,\n navigationOpen: controlledNavigationOpen,\n contentType = 'default',\n headerSelector = '#b #h',\n footerSelector = '#b #h',\n children,\n splitPanel,\n ...props\n }: AppLayoutProviderInternalsProps,\n forwardRef: React.Ref<AppLayoutProps.Ref>\n ) => {\n const isMobile = useMobile();\n\n if (isDevelopment) {\n if (controlledToolsOpen && toolsHide) {\n warnOnce(\n 'AppLayout',\n `You have enabled both the \\`toolsOpen\\` prop and the \\`toolsHide\\` prop. This is not supported. Set \\`toolsOpen\\` to \\`false\\` when you set \\`toolsHide\\` to \\`true\\`.`\n );\n }\n }\n\n /**\n * The overlap height has a default set in CSS but can also be dynamically overridden\n * for content types (such as Table and Wizard) that have variable size content in the overlap.\n * If a child component utilizes a sticky header the hasStickyBackground property will determine\n * if the background remains in the same vertical position.\n */\n const [dynamicOverlapHeight, setDynamicOverlapHeight] = useState(0);\n const [hasStickyBackground, setHasStickyBackground] = useState(false);\n\n /**\n * Set the default values for minimum and maximum content width.\n */\n const geckoMaxCssLength = ((1 << 30) - 1) / 60;\n const halfGeckoMaxCssLength = geckoMaxCssLength / 2;\n // CSS lengths in Gecko are limited to at most (1<<30)-1 app units (Gecko uses 60 as app unit).\n // Limit the maxContentWidth to the half of the upper boundary (≈4230^2) to be on the safe side.\n const maxContentWidth =\n props.maxContentWidth && props.maxContentWidth > halfGeckoMaxCssLength\n ? halfGeckoMaxCssLength\n : props.maxContentWidth ?? 0;\n const minContentWidth = props.minContentWidth ?? 280;\n\n /**\n * Determine the default state of the Navigation and Tools drawers.\n * Mobile viewports should be closed by default under all circumstances.\n * If the navigationOpen prop has been set then that should take precedence\n * over the contentType prop. Desktop viewports that do not have the\n * navigationOpen or contentType props set will use the default contentType.\n */\n const contentTypeDefaults = applyDefaults(contentType, { maxContentWidth, minContentWidth }, true);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Navigation drawer. The logic\n * for determining the default state is colocated with the Navigation component.\n *\n * The callback that will be passed to the Navigation and MobileToolbar\n * components to handle the click events that will change the state\n * of the Navigation drawer. It will set the Navigation state with the\n * useControllable hook and also fire the onNavigationChange function to\n * emit the state change.\n */\n const [isNavigationOpen = false, setIsNavigationOpen] = useControllable(\n controlledNavigationOpen,\n props.onNavigationChange,\n isMobile ? false : contentTypeDefaults.navigationOpen,\n { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }\n );\n\n const { refs: navigationRefs, setFocus: focusNavButtons } = useFocusControl(isNavigationOpen);\n\n const handleNavigationClick = useCallback(\n function handleNavigationChange(isOpen: boolean) {\n setIsNavigationOpen(isOpen);\n focusNavButtons();\n fireNonCancelableEvent(props.onNavigationChange, { open: isOpen });\n },\n [props.onNavigationChange, setIsNavigationOpen, focusNavButtons]\n );\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Tools drawer. The logic\n * for determining the default state is colocated with the Tools component.\n *\n * The callback that will be passed to the Navigation and MobileToolbar\n * components to handle the click events that will change the state\n * of the Tools drawer. It will set the Tools state with the\n * useControllable hook and also fire the onToolsChange function to\n * emit the state change.\n */\n const toolsWidth = props.toolsWidth ?? 290;\n const hasDefaultToolsWidth = props.toolsWidth === undefined;\n\n const [isToolsOpen = false, setIsToolsOpen] = useControllable(\n controlledToolsOpen,\n props.onToolsChange,\n isMobile ? false : contentTypeDefaults.toolsOpen,\n { componentName: 'AppLayout', controlledProp: 'toolsOpen', changeHandler: 'onToolsChange' }\n );\n\n const {\n refs: toolsRefs,\n setFocus: focusToolsButtons,\n loseFocus: loseToolsFocus,\n } = useFocusControl(isToolsOpen, true);\n\n const handleToolsClick = useCallback(\n function handleToolsChange(isOpen: boolean, skipFocusControl?: boolean) {\n setIsToolsOpen(isOpen);\n !skipFocusControl && focusToolsButtons();\n fireNonCancelableEvent(props.onToolsChange, { open: isOpen });\n },\n [props.onToolsChange, setIsToolsOpen, focusToolsButtons]\n );\n\n /**\n * On mobile viewports the navigation and tools drawers are adjusted to a fixed position\n * that consumes 100% of the viewport height and width. The body content could potentially\n * be scrollable underneath the drawer. In order to prevent this a CSS class needs to be\n * added to the document body that sets overflow to hidden.\n */\n useEffect(\n function handleBodyScroll() {\n if (isMobile && (isNavigationOpen || isToolsOpen)) {\n document.body.classList.add(styles['block-body-scroll']);\n } else {\n document.body.classList.remove(styles['block-body-scroll']);\n }\n\n // Ensure the CSS class is removed from the body on side effect cleanup\n return function cleanup() {\n document.body.classList.remove(styles['block-body-scroll']);\n };\n },\n [isMobile, isNavigationOpen, isToolsOpen]\n );\n\n /**\n * The useImperativeHandle hook in conjunction with the forwardRef function\n * in the AppLayout component definition expose the following callable\n * functions to component consumers when they put a ref as a property on\n * their component implementation.\n */\n useImperativeHandle(\n forwardRef,\n function createImperativeHandle() {\n return {\n closeNavigationIfNecessary: function () {\n isMobile && handleNavigationClick(false);\n },\n openTools: function () {\n handleToolsClick(true);\n },\n focusToolsClose: () => focusToolsButtons(true),\n };\n },\n [isMobile, handleNavigationClick, handleToolsClick, focusToolsButtons]\n );\n\n /**\n * Query the DOM for the header and footer elements based on the selectors provided\n * by the properties and pass the heights to the custom property definitions.\n */\n const headerHeight = useObservedElement(headerSelector);\n const footerHeight = useObservedElement(footerSelector);\n\n /**\n * Set the default values for the minimum and maximum Split Panel width when it is\n * in the side position. The useLayoutEffect will compute the available space in the\n * DOM for the Split Panel given the current state. The minimum and maximum\n * widths will potentially trigger a side effect that will put the Split Panel into\n * a forced position on the bottom.\n */\n const splitPanelMinWidth = 280;\n const [splitPanelMaxWidth, setSplitPanelMaxWidth] = useState(splitPanelMinWidth);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Split Panel. By default\n * the Split Panel should always be closed on page load.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the click events that will change the state of the SplitPanel\n * to open or closed given the current state. It will set the isSplitPanelOpen\n * controlled state and fire the onSplitPanelToggle event.\n */\n const [isSplitPanelOpen, setIsSplitPanelOpen] = useControllable(\n props.splitPanelOpen,\n props.onSplitPanelToggle,\n false,\n { componentName: 'AppLayout', controlledProp: 'splitPanelOpen', changeHandler: 'onSplitPanelToggle' }\n );\n\n /**\n * The useControllable hook will manage the controlled or uncontrolled\n * state of the splitPanelPreferences. By default the splitPanelPreferences\n * is undefined. When set the object shape should have a single key to indicate\n * either bottom or side position.\n *\n * The callback that will handle changes to the splitPanelPreferences\n * object that will determine if the SplitPanel is rendered either on the\n * bottom of the viewport or within the Tools container.\n */\n const [splitPanelPreferences, setSplitPanelPreferences] = useControllable(\n props.splitPanelPreferences,\n props.onSplitPanelPreferencesChange,\n undefined,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelPreferences',\n changeHandler: 'onSplitPanelPreferencesChange',\n }\n );\n\n const { refs: splitPanelRefs, setLastInteraction: setSplitPanelLastInteraction } = useSplitPanelFocusControl([\n splitPanelPreferences,\n isSplitPanelOpen,\n ]);\n\n const handleSplitPanelClick = useCallback(\n function handleSplitPanelChange() {\n setIsSplitPanelOpen(!isSplitPanelOpen);\n setSplitPanelLastInteraction({ type: isSplitPanelOpen ? 'close' : 'open' });\n fireNonCancelableEvent(props.onSplitPanelToggle, { open: !isSplitPanelOpen });\n },\n [props.onSplitPanelToggle, isSplitPanelOpen, setIsSplitPanelOpen, setSplitPanelLastInteraction]\n );\n\n /**\n * The Split Panel will be in forced (bottom) position if the defined minimum width is\n * greater than the maximum width. In other words, the maximum width is the currently\n * available horizontal space based on all other components that are rendered. If the\n * minimum width exceeds this value then there is not enough horizontal space and we must\n * force it to the bottom position.\n */\n const [isSplitPanelForcedPosition, setSplitPanelForcedPosition] = useState(false);\n const splitPanelPosition = getSplitPanelPosition(isSplitPanelForcedPosition, splitPanelPreferences);\n\n useLayoutEffect(\n function handleSplitPanelForcePosition() {\n setSplitPanelForcedPosition(splitPanelMinWidth > splitPanelMaxWidth);\n },\n [splitPanelMaxWidth, splitPanelMinWidth]\n );\n\n /**\n * The useControllable hook will set the default size of the SplitPanel based\n * on the default position set in the splitPanelPreferences. The logic for the\n * default size is contained in the SplitPanel component. The splitPanelControlledSize\n * will be bound to the size property in the SplitPanel context for rendering.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the resize events that will change the size of the SplitPanel.\n * It will set the splitPanelControlledSize controlled state and fire the\n * onSplitPanelResize event.\n */\n const [splitPanelReportedSize, setSplitPanelReportedSize] = useState(0);\n const [splitPanelReportedHeaderHeight, setSplitPanelReportedHeaderHeight] = useState(0);\n const [splitPanelToggle, setSplitPanelToggle] = useState<SplitPanelSideToggleProps>({\n displayed: false,\n ariaLabel: undefined,\n });\n const splitPanelDisplayed = !!(splitPanelToggle.displayed || isSplitPanelOpen);\n\n const [splitPanelSize, setSplitPanelSize] = useControllable(\n props.splitPanelSize,\n props.onSplitPanelResize,\n getSplitPanelDefaultSize(splitPanelPosition),\n { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' }\n );\n\n const handleSplitPanelResize = useCallback(\n function handleSplitPanelChange(detail: { size: number }) {\n setSplitPanelSize(detail.size);\n fireNonCancelableEvent(props.onSplitPanelResize, detail);\n },\n [props.onSplitPanelResize, setSplitPanelSize]\n );\n\n const handleSplitPanelPreferencesChange = useCallback(\n function handleSplitPanelChange(detail: AppLayoutProps.SplitPanelPreferences) {\n setSplitPanelPreferences(detail);\n setSplitPanelLastInteraction({ type: 'position' });\n fireNonCancelableEvent(props.onSplitPanelPreferencesChange, detail);\n },\n [props.onSplitPanelPreferencesChange, setSplitPanelPreferences, setSplitPanelLastInteraction]\n );\n\n /**\n * The activeDrawerWidth is required in JavaScript to acccurately calculate whether a SplitPanel\n * in the side position should be forced to the bottom based on available horiziontal space.\n *\n * The handleDrawersClick will either open a new drawer or close the currently open drawer by setting\n * the activeDrawerId value. The active drawer can also be closed if a user clicks the Tools trigger\n * button. This will skip the focus handling because the focus should be going to the Tools close\n * button and not one of the drawers trigger buttons.\n *\n * The drawersTriggerCount is computed in order to determine whether the triggers should be persistent\n * in the UI when a drawer is open. The trigger button container is suppressed when a drawer is open\n * and their is only one trigger button.\n *\n * The hasDrawerViewportOverlay property is used to determine if any drawer is obscuring the entire\n * viewport. This currently applies to Navigation, Tools, and Drawers in mobile viewports.\n */\n const drawers = (props as InternalDrawerProps).drawers;\n\n const [activeDrawerId, setActiveDrawerId] = useControllable(drawers?.activeDrawerId, drawers?.onChange, null, {\n componentName: 'AppLayout',\n controlledProp: 'drawers.activeDrawerId',\n changeHandler: 'onChange',\n });\n\n const [drawersMaxWidth, setDrawersMaxWidth] = useState(toolsWidth);\n\n const activeDrawer = drawers?.items.find(drawer => drawer.id === activeDrawerId);\n\n const {\n refs: drawersRefs,\n setFocus: focusDrawersButtons,\n loseFocus: loseDrawersFocus,\n setLastInteraction: setDrawerLastInteraction,\n } = useDrawerFocusControl([activeDrawerId, activeDrawer?.resizable], activeDrawerId !== undefined, true);\n\n const drawerRef = useRef<HTMLDivElement>(null);\n const { resizeHandle, drawerSize } = useResize(drawerRef, {\n activeDrawerId,\n drawers,\n drawersRefs,\n isToolsOpen,\n drawersMaxWidth,\n });\n\n const handleDrawersClick = useCallback(\n function handleDrawersChange(id: string | null, skipFocusControl?: boolean) {\n const newActiveDrawerId = id !== activeDrawerId ? id : null;\n\n setActiveDrawerId(newActiveDrawerId);\n !skipFocusControl && focusDrawersButtons();\n fireNonCancelableEvent(drawers?.onChange, newActiveDrawerId!);\n setDrawerLastInteraction({ type: activeDrawerId ? 'close' : 'open' });\n },\n [activeDrawerId, drawers?.onChange, focusDrawersButtons, setActiveDrawerId, setDrawerLastInteraction]\n );\n\n const drawersTriggerCount =\n (drawers?.items.length ?? 0) +\n (splitPanelDisplayed && splitPanelPosition === 'side' ? 1 : 0) +\n (!toolsHide ? 1 : 0);\n const hasOpenDrawer =\n activeDrawerId !== null ||\n isToolsOpen ||\n (splitPanelDisplayed && splitPanelPosition === 'side' && isSplitPanelOpen);\n const hasDrawerViewportOverlay =\n isMobile && (!!activeDrawerId || (!navigationHide && isNavigationOpen) || (!toolsHide && isToolsOpen));\n\n /**\n * The Layout element is not necessarily synonymous with the client\n * viewport width. There can be content in the horizontal viewport\n * that exists on either side of the AppLayout. This resize observer\n * will set the custom property of the Layout element width that\n * is used for various horizontal constraints such as the maximum\n * allowed width of the Tools container.\n *\n * The offsetLeft of the Main will return the distance that the\n * Main element has from the left edge of the Layout component.\n * The offsetLeft value can vary based on the presence and state\n * of the Navigation as well as content gaps in the grid definition.\n * This value is used to determine the max width constraint calculation\n * for the Tools container.\n */\n const [layoutContainerQuery, layoutElement] = useContainerQuery(rect => rect.width);\n const layoutWidth = layoutContainerQuery ?? 0;\n\n const mainElement = useRef<HTMLDivElement>(null);\n const [mainOffsetLeft, setMainOffsetLeft] = useState(0);\n\n useLayoutEffect(\n function handleMainOffsetLeft() {\n setMainOffsetLeft(mainElement?.current?.offsetLeft ?? 0);\n },\n [layoutWidth, isNavigationOpen, isToolsOpen, splitPanelReportedSize]\n );\n\n /**\n * Because the notifications slot does not give us any direction insight into\n * what the state of the child content is we need to have a mechanism for\n * tracking the height of the notifications and whether or not it has content.\n * The height of the notifications is an integer that will be used as a custom\n * property on the Layout component to determine what the sticky offset should\n * be if there are sticky notifications. This could be any number including\n * zero based on how the child content renders. The hasNotificationsContent boolean\n * is simply centralizing the logic of the notifications height being > 0 such\n * that it is not repeated in various components (such as MobileToolbar) that need to\n * know if the notifications slot is empty.\n */\n const [notificationsContainerQuery, notificationsElement] = useContainerQuery(rect => rect.height);\n const [notificationsHeight, setNotificationsHeight] = useState(0);\n const [hasNotificationsContent, setHasNotificationsContent] = useState(false);\n\n useEffect(\n function handleNotificationsContent() {\n setNotificationsHeight(notificationsContainerQuery ?? 0);\n setHasNotificationsContent(notificationsContainerQuery && notificationsContainerQuery > 0 ? true : false);\n },\n [notificationsContainerQuery]\n );\n\n /**\n * Determine the offsetBottom value based on the presence of a footer element and\n * the SplitPanel component. Ignore the SplitPanel if it is not in the bottom\n * position. Use the size property if it is open and the header height if it is closed.\n */\n let offsetBottom = footerHeight;\n\n if (splitPanelDisplayed && splitPanelPosition === 'bottom') {\n if (isSplitPanelOpen) {\n offsetBottom += splitPanelReportedSize;\n } else {\n offsetBottom += splitPanelReportedHeaderHeight;\n }\n }\n\n /**\n * Warning! This is a hack! In order to accurately calculate if there is adequate\n * horizontal space for the Split Panel to be in the side position we need two values\n * that are not available in JavaScript.\n *\n * The first is the the content gap on the right which is stored in a design token\n * and applied in the Layout CSS:\n *\n * $contentGapRight: #{awsui.$space-scaled-2x-xxxl};\n *\n * The second is the width of the element that has the circular buttons for the\n * Tools and Split Panel. This could be suppressed given the state of the Tools\n * drawer returning a zero value. It would, however, be rendered if the Split Panel\n * were to move into the side position. This is calculated in the Tools CSS and\n * the Trigger button CSS with design tokens:\n *\n * padding: awsui.$space-scaled-s awsui.$space-layout-toggle-padding;\n * width: awsui.$space-layout-toggle-diameter;\n *\n * These values will be defined below as static integers that are rough approximations\n * of their computed width when rendered in the DOM, but doubled to ensure adequate\n * spacing for the Split Panel to be in side position.\n */\n useLayoutEffect(\n function handleSplitPanelMaxWidth() {\n const contentGapRight = 80; // Approximately 40px when rendered but doubled for safety\n const toolsFormOffsetWidth = 160; // Approximately 80px when rendered but doubled for safety\n const toolsOffsetWidth = isToolsOpen ? toolsWidth : 0;\n const activeDrawerOffsetWidth = activeDrawerId ? drawerSize : 0;\n\n setSplitPanelMaxWidth(\n layoutWidth -\n mainOffsetLeft -\n minContentWidth -\n contentGapRight -\n toolsOffsetWidth -\n toolsFormOffsetWidth -\n activeDrawerOffsetWidth\n );\n\n setDrawersMaxWidth(layoutWidth - mainOffsetLeft - minContentWidth - contentGapRight - toolsFormOffsetWidth);\n },\n [\n activeDrawerId,\n drawerSize,\n isNavigationOpen,\n isToolsOpen,\n layoutWidth,\n mainOffsetLeft,\n minContentWidth,\n toolsWidth,\n ]\n );\n\n return (\n <AppLayoutInternalsContext.Provider\n value={{\n ...props,\n activeDrawerId,\n contentType,\n drawers,\n drawersRefs,\n drawersMaxWidth,\n drawerSize,\n drawerRef,\n resizeHandle,\n drawersTriggerCount,\n dynamicOverlapHeight,\n headerHeight,\n footerHeight,\n hasDefaultToolsWidth,\n hasDrawerViewportOverlay,\n handleDrawersClick,\n handleNavigationClick,\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n handleToolsClick,\n hasNotificationsContent,\n hasOpenDrawer,\n hasStickyBackground,\n isMobile,\n isNavigationOpen: isNavigationOpen ?? false,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n isToolsOpen,\n layoutElement,\n layoutWidth,\n loseToolsFocus,\n loseDrawersFocus,\n mainElement,\n mainOffsetLeft,\n maxContentWidth,\n minContentWidth,\n navigationHide,\n navigationRefs,\n notificationsElement,\n notificationsHeight,\n offsetBottom,\n setHasStickyBackground,\n setSplitPanelReportedSize,\n setSplitPanelReportedHeaderHeight,\n splitPanel,\n splitPanelDisplayed,\n splitPanelMaxWidth,\n splitPanelMinWidth,\n splitPanelPosition,\n splitPanelPreferences,\n splitPanelReportedSize,\n splitPanelReportedHeaderHeight,\n splitPanelSize,\n splitPanelToggle,\n setSplitPanelToggle,\n splitPanelRefs,\n toolsHide,\n toolsOpen: isToolsOpen,\n toolsWidth,\n toolsRefs,\n }}\n >\n <AppLayoutContext.Provider\n value={{\n stickyOffsetBottom: offsetBottom,\n stickyOffsetTop: 0, // not used in this design. Sticky headers read a CSS-var instead\n setHasStickyBackground,\n }}\n >\n <DynamicOverlapContext.Provider value={setDynamicOverlapHeight}>{children}</DynamicOverlapContext.Provider>\n </AppLayoutContext.Provider>\n </AppLayoutInternalsContext.Provider>\n );\n }\n);\n"]}
@@ -1,35 +1,4 @@
1
- import React from 'react';
2
- import { IconProps } from '../../icon/interfaces';
3
- import { NonCancelableEventHandler } from '../../internal/events';
4
- export interface DrawersProps {
5
- activeDrawerId?: string;
6
- items: ReadonlyArray<DrawersProps.Drawer>;
7
- onChange?: NonCancelableEventHandler<DrawersProps.ChangeDetail>;
8
- ariaLabel?: string;
9
- }
10
- declare namespace DrawersProps {
11
- export interface Drawer {
12
- ariaLabels?: Labels;
13
- content: React.ReactNode;
14
- id: string;
15
- trigger: Trigger;
16
- }
17
- export interface ChangeDetail {
18
- activeDrawerId: string | null;
19
- }
20
- interface Labels {
21
- closeButton?: string;
22
- content?: string;
23
- triggerButton?: string;
24
- resizeHandle?: string;
25
- }
26
- interface Trigger {
27
- iconName?: IconProps.Name;
28
- iconSvg?: React.ReactNode;
29
- iconUrl?: string;
30
- }
31
- export {};
32
- }
1
+ /// <reference types="react" />
33
2
  /**
34
3
  * The Drawers root component is mounted in the AppLayout index file. It will only
35
4
  * render if the drawers are defined, and it will take over the mounting of and
@@ -44,5 +13,4 @@ export default function Drawers(): JSX.Element | null;
44
13
  * trigger button for the Tools drawer.
45
14
  */
46
15
  export declare function MobileTriggers(): JSX.Element | null;
47
- export {};
48
16
  //# sourceMappingURL=drawers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"drawers.d.ts","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/drawers.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAGtC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAQlE,MAAM,WAAW,YAAY;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,EAAE,yBAAyB,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,kBAAU,YAAY,CAAC;IACrB,MAAM,WAAW,MAAM;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;QACzB,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,OAAO,CAAC;KAClB;IAED,MAAM,WAAW,YAAY;QAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;KAC/B;IAED,UAAU,MAAM;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB;IACD,UAAU,OAAO;QACf,QAAQ,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;QAC1B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;;CACF;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,uBAuB9B;AAkLD;;;;;GAKG;AACH,wBAAgB,cAAc,uBAuE7B"}
1
+ {"version":3,"file":"drawers.d.ts","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/drawers.tsx"],"names":[],"mappings":";AAcA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,uBAuB9B;AA+LD;;;;;GAKG;AACH,wBAAgB,cAAc,uBAuE7B"}
@@ -9,6 +9,7 @@ import TriggerButton from './trigger-button';
9
9
  import { useAppLayoutInternals } from './context';
10
10
  import splitPanelStyles from '../../split-panel/styles.css.js';
11
11
  import styles from './styles.css.js';
12
+ import sharedStyles from '../styles.css.js';
12
13
  import testutilStyles from '../test-classes/styles.css.js';
13
14
  /**
14
15
  * The Drawers root component is mounted in the AppLayout index file. It will only
@@ -39,7 +40,7 @@ export default function Drawers() {
39
40
  */
40
41
  function ActiveDrawer() {
41
42
  var _a, _b, _c;
42
- const { activeDrawerId, activeDrawerWidth, ariaLabels, drawers, drawersRefs, handleDrawersClick, handleToolsClick, hasDrawerViewportOverlay, isMobile, isNavigationOpen, isToolsOpen, navigationHide, tools, toolsRefs, } = useAppLayoutInternals();
43
+ const { activeDrawerId, ariaLabels, drawers, drawersRefs, handleDrawersClick, handleToolsClick, hasDrawerViewportOverlay, isMobile, isNavigationOpen, isToolsOpen, navigationHide, tools, toolsRefs, loseDrawersFocus, resizeHandle, drawerSize, drawersMaxWidth, drawerRef, } = useAppLayoutInternals();
43
44
  const activeDrawer = (_a = drawers === null || drawers === void 0 ? void 0 : drawers.items.find((item) => item.id === activeDrawerId)) !== null && _a !== void 0 ? _a : null;
44
45
  const computedAriaLabels = {
45
46
  closeButton: activeDrawerId ? (_b = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.ariaLabels) === null || _b === void 0 ? void 0 : _b.closeButton : ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.toolsClose,
@@ -47,12 +48,18 @@ function ActiveDrawer() {
47
48
  };
48
49
  const isHidden = !activeDrawerId && !isToolsOpen;
49
50
  const isUnfocusable = isHidden || (hasDrawerViewportOverlay && isNavigationOpen && !navigationHide);
50
- return (React.createElement("aside", { "aria-hidden": isHidden, "aria-label": computedAriaLabels.content, className: clsx(styles.drawer, {
51
+ const size = Math.min(drawersMaxWidth, drawerSize);
52
+ return (React.createElement("aside", { "aria-hidden": isHidden, "aria-label": computedAriaLabels.content, className: clsx(styles.drawer, sharedStyles['with-motion'], {
51
53
  [styles['is-drawer-open']]: activeDrawerId || isToolsOpen,
52
54
  [styles.unfocusable]: isUnfocusable,
53
55
  [testutilStyles['active-drawer']]: activeDrawerId,
54
56
  [testutilStyles.tools]: isToolsOpen,
55
- }), style: Object.assign({}, (!isMobile && activeDrawerWidth && { [customCssProps.activeDrawerWidth]: `${activeDrawerWidth}px` })) },
57
+ }), style: Object.assign({}, (!isMobile && drawerSize && { [customCssProps.drawerSize]: `${size}px` })), ref: drawerRef, onBlur: e => {
58
+ if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {
59
+ loseDrawersFocus();
60
+ }
61
+ } },
62
+ !isMobile && (activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.resizable) && resizeHandle,
56
63
  React.createElement("div", { className: clsx(styles['drawer-close-button']) },
57
64
  React.createElement(InternalButton, { ariaLabel: computedAriaLabels.closeButton, className: clsx({
58
65
  [testutilStyles['active-drawer-close-button']]: activeDrawerId,
@@ -82,7 +89,7 @@ function DesktopTriggers() {
82
89
  return (React.createElement("aside", { className: clsx(styles['drawers-desktop-triggers-container'], testutilStyles['drawers-desktop-triggers-container'], {
83
90
  [styles['has-multiple-triggers']]: hasMultipleTriggers,
84
91
  [styles['has-open-drawer']]: hasOpenDrawer,
85
- }), "aria-label": drawers.ariaLabel },
92
+ }), "aria-label": drawers === null || drawers === void 0 ? void 0 : drawers.ariaLabel },
86
93
  React.createElement("div", { className: clsx(styles['drawers-trigger-content'], {
87
94
  [styles['has-multiple-triggers']]: hasMultipleTriggers,
88
95
  [styles['has-open-drawer']]: hasOpenDrawer,
@@ -90,8 +97,8 @@ function DesktopTriggers() {
90
97
  !toolsHide && tools && (React.createElement(TriggerButton, { ariaLabel: ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.toolsToggle, className: clsx(styles['drawers-trigger'], testutilStyles['tools-toggle']), iconName: "status-info", onClick: () => {
91
98
  activeDrawerId && handleDrawersClick(null, true);
92
99
  handleToolsClick(!isToolsOpen);
93
- }, ref: toolsRefs.toggle, selected: isToolsOpen })),
94
- drawers.items.map((item) => {
100
+ }, ref: toolsRefs.toggle, selected: isToolsOpen })), drawers === null || drawers === void 0 ? void 0 :
101
+ drawers.items.map(item => {
95
102
  var _a;
96
103
  return (React.createElement(TriggerButton, { ariaLabel: (_a = item.ariaLabels) === null || _a === void 0 ? void 0 : _a.triggerButton, className: clsx(styles['drawers-trigger'], testutilStyles['drawers-trigger']), iconName: item.trigger.iconName, iconSvg: item.trigger.iconSvg, key: item.id, onClick: () => {
97
104
  isToolsOpen && handleToolsClick(!isToolsOpen, true);
@@ -120,7 +127,7 @@ export function MobileTriggers() {
120
127
  [styles.unfocusable]: hasDrawerViewportOverlay,
121
128
  }), "aria-label": drawers.ariaLabel },
122
129
  !toolsHide && tools && (React.createElement(InternalButton, { ariaLabel: (_a = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.toolsToggle) !== null && _a !== void 0 ? _a : undefined, ariaExpanded: isToolsOpen, className: testutilStyles['tools-toggle'], disabled: hasDrawerViewportOverlay, formAction: "none", iconName: "status-info", onClick: () => handleToolsClick(true), ref: toolsRefs.toggle, variant: "icon", __nativeAttributes: { 'aria-haspopup': true } })),
123
- drawers.items.map((item) => {
130
+ drawers.items.map(item => {
124
131
  var _a;
125
132
  return (React.createElement(InternalButton, { ariaExpanded: item.id === activeDrawerId, ariaLabel: (_a = item.ariaLabels) === null || _a === void 0 ? void 0 : _a.triggerButton, className: clsx(styles['drawers-trigger'], testutilStyles['drawers-trigger']), disabled: hasDrawerViewportOverlay, formAction: "none", iconName: item.trigger.iconName, iconSvg: item.trigger.iconSvg, key: item.id, onClick: () => handleDrawersClick(item.id), ref: item.id === previousActiveDrawerId.current ? drawersRefs.toggle : undefined, variant: "icon", __nativeAttributes: { 'aria-haspopup': true } }));
126
133
  })));