@cloudscape-design/components 3.0.318 → 3.0.319

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 (166) hide show
  1. package/annotation-context/annotation/styles.css.js +24 -24
  2. package/annotation-context/annotation/styles.scoped.css +30 -30
  3. package/annotation-context/annotation/styles.selectors.js +24 -24
  4. package/app-layout/drawer/interfaces.d.ts +0 -7
  5. package/app-layout/drawer/interfaces.d.ts.map +1 -1
  6. package/app-layout/drawer/interfaces.js.map +1 -1
  7. package/app-layout/drawer/resizable-drawer.d.ts.map +1 -1
  8. package/app-layout/drawer/resizable-drawer.js +3 -3
  9. package/app-layout/drawer/resizable-drawer.js.map +1 -1
  10. package/app-layout/notifications/styles.css.js +3 -3
  11. package/app-layout/notifications/styles.scoped.css +7 -7
  12. package/app-layout/notifications/styles.selectors.js +3 -3
  13. package/app-layout/runtime-api.d.ts.map +1 -1
  14. package/app-layout/runtime-api.js +5 -2
  15. package/app-layout/runtime-api.js.map +1 -1
  16. package/app-layout/styles.css.js +17 -13
  17. package/app-layout/styles.scoped.css +44 -13
  18. package/app-layout/styles.selectors.js +17 -13
  19. package/app-layout/utils/interfaces.d.ts +10 -0
  20. package/app-layout/utils/interfaces.d.ts.map +1 -0
  21. package/app-layout/utils/interfaces.js +2 -0
  22. package/app-layout/utils/interfaces.js.map +1 -0
  23. package/app-layout/utils/use-drawer-focus-control.d.ts.map +1 -1
  24. package/app-layout/utils/use-drawer-focus-control.js +8 -3
  25. package/app-layout/utils/use-drawer-focus-control.js.map +1 -1
  26. package/app-layout/utils/use-keyboard-events.d.ts +4 -0
  27. package/app-layout/utils/use-keyboard-events.d.ts.map +1 -0
  28. package/{split-panel → app-layout}/utils/use-keyboard-events.js +10 -11
  29. package/app-layout/utils/use-keyboard-events.js.map +1 -0
  30. package/app-layout/utils/use-pointer-events.d.ts +3 -0
  31. package/app-layout/utils/use-pointer-events.d.ts.map +1 -0
  32. package/{split-panel → app-layout}/utils/use-pointer-events.js +15 -8
  33. package/app-layout/utils/use-pointer-events.js.map +1 -0
  34. package/app-layout/utils/use-resize.d.ts +16 -0
  35. package/app-layout/utils/use-resize.d.ts.map +1 -0
  36. package/app-layout/utils/use-resize.js +84 -0
  37. package/app-layout/utils/use-resize.js.map +1 -0
  38. package/app-layout/visual-refresh/context.d.ts +11 -6
  39. package/app-layout/visual-refresh/context.d.ts.map +1 -1
  40. package/app-layout/visual-refresh/context.js +26 -7
  41. package/app-layout/visual-refresh/context.js.map +1 -1
  42. package/app-layout/visual-refresh/drawers.d.ts +1 -33
  43. package/app-layout/visual-refresh/drawers.d.ts.map +1 -1
  44. package/app-layout/visual-refresh/drawers.js +14 -7
  45. package/app-layout/visual-refresh/drawers.js.map +1 -1
  46. package/app-layout/visual-refresh/styles.css.js +69 -68
  47. package/app-layout/visual-refresh/styles.scoped.css +294 -298
  48. package/app-layout/visual-refresh/styles.selectors.js +69 -68
  49. package/app-layout/visual-refresh/trigger-button.d.ts.map +1 -1
  50. package/app-layout/visual-refresh/trigger-button.js +1 -2
  51. package/app-layout/visual-refresh/trigger-button.js.map +1 -1
  52. package/area-chart/{model/async-store.d.ts → async-store/index.d.ts} +1 -1
  53. package/area-chart/async-store/index.d.ts.map +1 -0
  54. package/area-chart/{model/async-store.js → async-store/index.js} +1 -1
  55. package/area-chart/async-store/index.js.map +1 -0
  56. package/area-chart/elements/area-chart-legend.d.ts.map +1 -1
  57. package/area-chart/elements/area-chart-legend.js +1 -1
  58. package/area-chart/elements/area-chart-legend.js.map +1 -1
  59. package/area-chart/elements/data-series.js +1 -1
  60. package/area-chart/elements/data-series.js.map +1 -1
  61. package/area-chart/elements/highlighted-point.js +1 -1
  62. package/area-chart/elements/highlighted-point.js.map +1 -1
  63. package/area-chart/elements/use-highlight-details.d.ts.map +1 -1
  64. package/area-chart/elements/use-highlight-details.js +3 -1
  65. package/area-chart/elements/use-highlight-details.js.map +1 -1
  66. package/area-chart/elements/vertical-marker.js +1 -1
  67. package/area-chart/elements/vertical-marker.js.map +1 -1
  68. package/area-chart/model/index.d.ts +1 -1
  69. package/area-chart/model/index.d.ts.map +1 -1
  70. package/area-chart/model/index.js.map +1 -1
  71. package/area-chart/model/interactions-store.d.ts +1 -1
  72. package/area-chart/model/interactions-store.d.ts.map +1 -1
  73. package/area-chart/model/interactions-store.js +1 -1
  74. package/area-chart/model/interactions-store.js.map +1 -1
  75. package/area-chart/model/use-chart-model.d.ts.map +1 -1
  76. package/area-chart/model/use-chart-model.js +1 -1
  77. package/area-chart/model/use-chart-model.js.map +1 -1
  78. package/attribute-editor/interfaces.d.ts +1 -1
  79. package/attribute-editor/interfaces.d.ts.map +1 -1
  80. package/attribute-editor/interfaces.js.map +1 -1
  81. package/content-layout/styles.css.js +7 -7
  82. package/content-layout/styles.scoped.css +13 -13
  83. package/content-layout/styles.selectors.js +7 -7
  84. package/flashbar/styles.css.js +45 -45
  85. package/flashbar/styles.scoped.css +169 -169
  86. package/flashbar/styles.selectors.js +45 -45
  87. package/internal/environment.js +1 -1
  88. package/internal/generated/custom-css-properties/index.js +39 -39
  89. package/internal/generated/custom-css-properties/index.js.map +1 -1
  90. package/internal/manifest.json +1 -1
  91. package/internal/plugins/drawers-controller.d.ts +5 -0
  92. package/internal/plugins/drawers-controller.d.ts.map +1 -1
  93. package/internal/plugins/drawers-controller.js.map +1 -1
  94. package/mixed-line-bar-chart/data-series.d.ts.map +1 -1
  95. package/mixed-line-bar-chart/data-series.js +8 -2
  96. package/mixed-line-bar-chart/data-series.js.map +1 -1
  97. package/package.json +1 -1
  98. package/split-panel/index.d.ts.map +1 -1
  99. package/split-panel/index.js +3 -3
  100. package/split-panel/index.js.map +1 -1
  101. package/split-panel/interfaces.d.ts +0 -7
  102. package/split-panel/interfaces.d.ts.map +1 -1
  103. package/split-panel/interfaces.js.map +1 -1
  104. package/split-panel/styles.css.js +56 -59
  105. package/split-panel/styles.scoped.css +77 -93
  106. package/split-panel/styles.selectors.js +56 -59
  107. package/table/body-cell/td-element.d.ts +1 -1
  108. package/table/body-cell/td-element.d.ts.map +1 -1
  109. package/table/body-cell/td-element.js +1 -1
  110. package/table/body-cell/td-element.js.map +1 -1
  111. package/table/header-cell/index.d.ts +1 -1
  112. package/table/header-cell/index.d.ts.map +1 -1
  113. package/table/header-cell/index.js +1 -1
  114. package/table/header-cell/index.js.map +1 -1
  115. package/table/internal.js +2 -2
  116. package/table/internal.js.map +1 -1
  117. package/table/sticky-columns/index.d.ts +2 -0
  118. package/table/sticky-columns/index.d.ts.map +1 -0
  119. package/table/sticky-columns/index.js +4 -0
  120. package/table/sticky-columns/index.js.map +1 -0
  121. package/table/{use-sticky-columns.d.ts → sticky-columns/use-sticky-columns.d.ts} +1 -1
  122. package/table/sticky-columns/use-sticky-columns.d.ts.map +1 -0
  123. package/table/{use-sticky-columns.js → sticky-columns/use-sticky-columns.js} +3 -3
  124. package/table/sticky-columns/use-sticky-columns.js.map +1 -0
  125. package/table/sticky-scrollbar/index.d.ts +2 -0
  126. package/table/sticky-scrollbar/index.d.ts.map +1 -0
  127. package/table/sticky-scrollbar/index.js +4 -0
  128. package/table/sticky-scrollbar/index.js.map +1 -0
  129. package/table/sticky-scrollbar/sticky-scrollbar.d.ts.map +1 -0
  130. package/table/{sticky-scrollbar.js → sticky-scrollbar/sticky-scrollbar.js} +2 -2
  131. package/table/sticky-scrollbar/sticky-scrollbar.js.map +1 -0
  132. package/table/sticky-scrollbar/styles.css.js +9 -0
  133. package/table/sticky-scrollbar/styles.scoped.css +22 -0
  134. package/table/sticky-scrollbar/styles.selectors.js +10 -0
  135. package/table/sticky-scrollbar/use-sticky-scrollbar.d.ts.map +1 -0
  136. package/table/{use-sticky-scrollbar.js → sticky-scrollbar/use-sticky-scrollbar.js} +3 -3
  137. package/table/sticky-scrollbar/use-sticky-scrollbar.js.map +1 -0
  138. package/table/styles.css.js +32 -36
  139. package/table/styles.scoped.css +40 -59
  140. package/table/styles.selectors.js +32 -36
  141. package/table/thead.d.ts +1 -1
  142. package/table/thead.d.ts.map +1 -1
  143. package/table/thead.js +1 -1
  144. package/table/thead.js.map +1 -1
  145. package/table/utils.d.ts +1 -1
  146. package/table/utils.d.ts.map +1 -1
  147. package/table/utils.js.map +1 -1
  148. package/wizard/styles.css.js +31 -31
  149. package/wizard/styles.scoped.css +63 -63
  150. package/wizard/styles.selectors.js +31 -31
  151. package/area-chart/model/async-store.d.ts.map +0 -1
  152. package/area-chart/model/async-store.js.map +0 -1
  153. package/split-panel/utils/use-keyboard-events.d.ts +0 -4
  154. package/split-panel/utils/use-keyboard-events.d.ts.map +0 -1
  155. package/split-panel/utils/use-keyboard-events.js.map +0 -1
  156. package/split-panel/utils/use-pointer-events.d.ts +0 -3
  157. package/split-panel/utils/use-pointer-events.d.ts.map +0 -1
  158. package/split-panel/utils/use-pointer-events.js.map +0 -1
  159. package/table/sticky-scrollbar.d.ts.map +0 -1
  160. package/table/sticky-scrollbar.js.map +0 -1
  161. package/table/use-sticky-columns.d.ts.map +0 -1
  162. package/table/use-sticky-columns.js.map +0 -1
  163. package/table/use-sticky-scrollbar.d.ts.map +0 -1
  164. package/table/use-sticky-scrollbar.js.map +0 -1
  165. /package/table/{sticky-scrollbar.d.ts → sticky-scrollbar/sticky-scrollbar.d.ts} +0 -0
  166. /package/table/{use-sticky-scrollbar.d.ts → sticky-scrollbar/use-sticky-scrollbar.d.ts} +0 -0
@@ -2,18 +2,22 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "root": "awsui_root_lm6vo_j1rmw_97",
6
- "layout-wrapper": "awsui_layout-wrapper_lm6vo_j1rmw_98",
7
- "root-no-scroll": "awsui_root-no-scroll_lm6vo_j1rmw_105",
8
- "layout": "awsui_layout_lm6vo_j1rmw_98",
9
- "layout-no-scroll": "awsui_layout-no-scroll_lm6vo_j1rmw_116",
10
- "layout-main": "awsui_layout-main_lm6vo_j1rmw_120",
11
- "layout-main-scrollable": "awsui_layout-main-scrollable_lm6vo_j1rmw_126",
12
- "unfocusable": "awsui_unfocusable_lm6vo_j1rmw_131",
13
- "breadcrumbs-desktop": "awsui_breadcrumbs-desktop_lm6vo_j1rmw_135",
14
- "content-header-wrapper": "awsui_content-header-wrapper_lm6vo_j1rmw_140",
15
- "content-wrapper": "awsui_content-wrapper_lm6vo_j1rmw_144",
16
- "content-overlapped": "awsui_content-overlapped_lm6vo_j1rmw_148",
17
- "content-extra-top-padding": "awsui_content-extra-top-padding_lm6vo_j1rmw_152"
5
+ "resize-active": "awsui_resize-active_lm6vo_1hwq2_98",
6
+ "resize-side": "awsui_resize-side_lm6vo_1hwq2_104",
7
+ "resize-bottom": "awsui_resize-bottom_lm6vo_1hwq2_107",
8
+ "with-motion": "awsui_with-motion_lm6vo_1hwq2_112",
9
+ "root": "awsui_root_lm6vo_1hwq2_127",
10
+ "layout-wrapper": "awsui_layout-wrapper_lm6vo_1hwq2_128",
11
+ "root-no-scroll": "awsui_root-no-scroll_lm6vo_1hwq2_135",
12
+ "layout": "awsui_layout_lm6vo_1hwq2_128",
13
+ "layout-no-scroll": "awsui_layout-no-scroll_lm6vo_1hwq2_146",
14
+ "layout-main": "awsui_layout-main_lm6vo_1hwq2_150",
15
+ "layout-main-scrollable": "awsui_layout-main-scrollable_lm6vo_1hwq2_156",
16
+ "unfocusable": "awsui_unfocusable_lm6vo_1hwq2_161",
17
+ "breadcrumbs-desktop": "awsui_breadcrumbs-desktop_lm6vo_1hwq2_165",
18
+ "content-header-wrapper": "awsui_content-header-wrapper_lm6vo_1hwq2_170",
19
+ "content-wrapper": "awsui_content-wrapper_lm6vo_1hwq2_174",
20
+ "content-overlapped": "awsui_content-overlapped_lm6vo_1hwq2_178",
21
+ "content-extra-top-padding": "awsui_content-extra-top-padding_lm6vo_1hwq2_182"
18
22
  };
19
23
 
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export interface SizeControlProps {
3
+ position: 'side' | 'bottom';
4
+ panelRef?: React.RefObject<HTMLDivElement>;
5
+ handleRef?: React.RefObject<HTMLDivElement>;
6
+ setSidePanelWidth: (width: number) => void;
7
+ setBottomPanelHeight: (height: number) => void;
8
+ hasTransitions?: boolean;
9
+ }
10
+ //# sourceMappingURL=interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["app-layout/utils/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC5C,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["app-layout/utils/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nexport interface SizeControlProps {\n position: 'side' | 'bottom';\n panelRef?: React.RefObject<HTMLDivElement>;\n handleRef?: React.RefObject<HTMLDivElement>;\n setSidePanelWidth: (width: number) => void;\n setBottomPanelHeight: (height: number) => void;\n hasTransitions?: boolean;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use-drawer-focus-control.d.ts","sourceRoot":"lib/default/","sources":["app-layout/utils/use-drawer-focus-control.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,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IAClC,MAAM,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;CACnC;AAED,UAAU,iBAAiB;IACzB,IAAI,EAAE,sBAAsB,CAAC;IAC7B,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACpC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,kBAAkB,EAAE,CAAC,WAAW,EAAE,qBAAqB,KAAK,IAAI,CAAC;CAClE;AAED,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,cAAc,EAC5B,MAAM,EAAE,OAAO,EACf,YAAY,UAAQ,GACnB,iBAAiB,CAiEnB"}
@@ -11,13 +11,18 @@ export function useDrawerFocusControl(dependencies, isOpen, restoreFocus = false
11
11
  const shouldFocus = useRef(false);
12
12
  const lastInteraction = useRef(null);
13
13
  useEffect(() => {
14
- var _a, _b, _c;
14
+ var _a, _b, _c, _d;
15
15
  switch ((_a = lastInteraction.current) === null || _a === void 0 ? void 0 : _a.type) {
16
16
  case 'open':
17
- (_b = refs.slider.current) === null || _b === void 0 ? void 0 : _b.focus();
17
+ if (refs.slider.current) {
18
+ (_b = refs.slider.current) === null || _b === void 0 ? void 0 : _b.focus();
19
+ }
20
+ else {
21
+ (_c = refs.close.current) === null || _c === void 0 ? void 0 : _c.focus();
22
+ }
18
23
  break;
19
24
  case 'close':
20
- (_c = refs.toggle.current) === null || _c === void 0 ? void 0 : _c.focus();
25
+ (_d = refs.toggle.current) === null || _d === void 0 ? void 0 : _d.focus();
21
26
  break;
22
27
  }
23
28
  lastInteraction.current = null;
@@ -1 +1 @@
1
- {"version":3,"file":"use-drawer-focus-control.js","sourceRoot":"lib/default/","sources":["app-layout/utils/use-drawer-focus-control.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAA6B,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAkBlF,MAAM,UAAU,qBAAqB,CACnC,YAA4B,EAC5B,MAAe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C;gBACvC,sBAAsB,CAAC,OAAO,GAAG,SAAS,CAAC;aAC5C;iBAAM;gBACL,MAAA,IAAI,CAAC,MAAM,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;aAC9B;SACF;QACD,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;IAC9B,CAAC,CAAC;IAEF,kEAAkE;IAClE,uDAAuD;IACvD,SAAS,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAE7B,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE;QACjC,sBAAsB,CAAC,OAAO,GAAG,SAAS,CAAC;IAC7C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,IAAI;QACJ,QAAQ,EAAE,KAAK,CAAC,EAAE;YAChB,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;YAC3B,IAAI,KAAK,IAAI,MAAM,EAAE;gBACnB,OAAO,EAAE,CAAC;aACX;QACH,CAAC;QACD,SAAS;QACT,kBAAkB,EAAE,CAAC,WAAkC,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,OAAO,GAAG,WAAW,CAAC;KACpG,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { DependencyList, RefObject, useEffect, useRef, useCallback } from 'react';\nimport { ButtonProps } from '../../button/interfaces';\n\nexport type DrawerLastInteraction = { type: 'open' } | { type: 'close' };\n\nexport interface DrawerFocusControlRefs {\n toggle: RefObject<ButtonProps.Ref>;\n close: RefObject<ButtonProps.Ref>;\n slider: RefObject<HTMLDivElement>;\n}\n\ninterface FocusControlState {\n refs: DrawerFocusControlRefs;\n setFocus: (force?: boolean) => void;\n loseFocus: () => void;\n setLastInteraction: (interaction: DrawerLastInteraction) => void;\n}\n\nexport function useDrawerFocusControl(\n dependencies: DependencyList,\n isOpen: boolean,\n restoreFocus = false\n): FocusControlState {\n const refs = {\n toggle: useRef<ButtonProps.Ref>(null),\n close: useRef<ButtonProps.Ref>(null),\n slider: useRef<HTMLDivElement>(null),\n };\n const previousFocusedElement = useRef<HTMLElement>();\n const shouldFocus = useRef(false);\n const lastInteraction = useRef<DrawerLastInteraction | null>(null);\n\n useEffect(() => {\n switch (lastInteraction.current?.type) {\n case 'open':\n refs.slider.current?.focus();\n break;\n case 'close':\n refs.toggle.current?.focus();\n break;\n }\n lastInteraction.current = null;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n\n const doFocus = () => {\n if (!shouldFocus.current) {\n return;\n }\n if (isOpen) {\n previousFocusedElement.current =\n document.activeElement !== document.body ? (document.activeElement as HTMLElement) : undefined;\n refs.close.current?.focus();\n } else {\n if (restoreFocus && previousFocusedElement.current && document.contains(previousFocusedElement.current)) {\n previousFocusedElement.current.focus();\n previousFocusedElement.current = undefined;\n } else {\n refs.toggle.current?.focus();\n }\n }\n shouldFocus.current = false;\n };\n\n // We explictly want this effect to run when only `isOpen` changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(doFocus, [isOpen]);\n\n const loseFocus = useCallback(() => {\n previousFocusedElement.current = undefined;\n }, []);\n\n return {\n refs,\n setFocus: force => {\n shouldFocus.current = true;\n if (force && isOpen) {\n doFocus();\n }\n },\n loseFocus,\n setLastInteraction: (interaction: DrawerLastInteraction) => (lastInteraction.current = interaction),\n };\n}\n"]}
1
+ {"version":3,"file":"use-drawer-focus-control.js","sourceRoot":"lib/default/","sources":["app-layout/utils/use-drawer-focus-control.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAA6B,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAkBlF,MAAM,UAAU,qBAAqB,CACnC,YAA4B,EAC5B,MAAe,EACf,YAAY,GAAG,KAAK;IAEpB,MAAM,IAAI,GAAG;QACX,MAAM,EAAE,MAAM,CAAkB,IAAI,CAAC;QACrC,KAAK,EAAE,MAA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AO,CAAC,KAAK,EAAE,CAAC;gBACvC,sBAAsB,CAAC,OAAO,GAAG,SAAS,CAAC;aAC5C;iBAAM;gBACL,MAAA,IAAI,CAAC,MAAM,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;aAC9B;SACF;QACD,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;IAC9B,CAAC,CAAC;IAEF,kEAAkE;IAClE,uDAAuD;IACvD,SAAS,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAE7B,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE;QACjC,sBAAsB,CAAC,OAAO,GAAG,SAAS,CAAC;IAC7C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,IAAI;QACJ,QAAQ,EAAE,KAAK,CAAC,EAAE;YAChB,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;YAC3B,IAAI,KAAK,IAAI,MAAM,EAAE;gBACnB,OAAO,EAAE,CAAC;aACX;QACH,CAAC;QACD,SAAS;QACT,kBAAkB,EAAE,CAAC,WAAkC,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,OAAO,GAAG,WAAW,CAAC;KACpG,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { DependencyList, RefObject, useEffect, useRef, useCallback } from 'react';\nimport { ButtonProps } from '../../button/interfaces';\n\nexport type DrawerLastInteraction = { type: 'open' } | { type: 'close' };\n\nexport interface DrawerFocusControlRefs {\n toggle: RefObject<ButtonProps.Ref>;\n close: RefObject<ButtonProps.Ref>;\n slider: RefObject<HTMLDivElement>;\n}\n\ninterface FocusControlState {\n refs: DrawerFocusControlRefs;\n setFocus: (force?: boolean) => void;\n loseFocus: () => void;\n setLastInteraction: (interaction: DrawerLastInteraction) => void;\n}\n\nexport function useDrawerFocusControl(\n dependencies: DependencyList,\n isOpen: boolean,\n restoreFocus = false\n): FocusControlState {\n const refs = {\n toggle: useRef<ButtonProps.Ref>(null),\n close: useRef<ButtonProps.Ref>(null),\n slider: useRef<HTMLDivElement>(null),\n };\n const previousFocusedElement = useRef<HTMLElement>();\n const shouldFocus = useRef(false);\n const lastInteraction = useRef<DrawerLastInteraction | null>(null);\n\n useEffect(() => {\n switch (lastInteraction.current?.type) {\n case 'open':\n if (refs.slider.current) {\n refs.slider.current?.focus();\n } else {\n refs.close.current?.focus();\n }\n break;\n case 'close':\n refs.toggle.current?.focus();\n break;\n }\n lastInteraction.current = null;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n\n const doFocus = () => {\n if (!shouldFocus.current) {\n return;\n }\n if (isOpen) {\n previousFocusedElement.current =\n document.activeElement !== document.body ? (document.activeElement as HTMLElement) : undefined;\n refs.close.current?.focus();\n } else {\n if (restoreFocus && previousFocusedElement.current && document.contains(previousFocusedElement.current)) {\n previousFocusedElement.current.focus();\n previousFocusedElement.current = undefined;\n } else {\n refs.toggle.current?.focus();\n }\n }\n shouldFocus.current = false;\n };\n\n // We explictly want this effect to run when only `isOpen` changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(doFocus, [isOpen]);\n\n const loseFocus = useCallback(() => {\n previousFocusedElement.current = undefined;\n }, []);\n\n return {\n refs,\n setFocus: force => {\n shouldFocus.current = true;\n if (force && isOpen) {\n doFocus();\n }\n },\n loseFocus,\n setLastInteraction: (interaction: DrawerLastInteraction) => (lastInteraction.current = interaction),\n };\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { SizeControlProps } from './interfaces';
3
+ export declare const useKeyboardEvents: ({ position, setSidePanelWidth, setBottomPanelHeight, panelRef, }: SizeControlProps) => (event: React.KeyboardEvent) => void;
4
+ //# sourceMappingURL=use-keyboard-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-keyboard-events.d.ts","sourceRoot":"lib/default/","sources":["app-layout/utils/use-keyboard-events.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAmBhD,eAAO,MAAM,iBAAiB,qEAK3B,gBAAgB,aACF,mBAAmB,SAwDnC,CAAC"}
@@ -1,34 +1,33 @@
1
1
  import { KeyCode } from '../../internal/keycode';
2
2
  const KEYBOARD_SINGLE_STEP_SIZE = 10;
3
3
  const KEYBOARD_MULTIPLE_STEPS_SIZE = 60;
4
- const getCurrentSize = (splitPanelRef) => {
5
- if (!splitPanelRef || !splitPanelRef.current) {
4
+ const getCurrentSize = (panelRef) => {
5
+ if (!panelRef || !panelRef.current) {
6
6
  return {
7
- splitPanelHeight: 0,
8
- splitPanelWidth: 0,
7
+ panelHeight: 0,
8
+ panelWidth: 0,
9
9
  };
10
10
  }
11
- const safeParseFloat = (size = '') => parseFloat(size) || 0;
12
11
  return {
13
- splitPanelHeight: safeParseFloat(splitPanelRef.current.style.height),
14
- splitPanelWidth: safeParseFloat(splitPanelRef.current.style.width),
12
+ panelHeight: panelRef.current.clientHeight,
13
+ panelWidth: panelRef.current.clientWidth,
15
14
  };
16
15
  };
17
- export const useKeyboardEvents = ({ position, setSidePanelWidth, setBottomPanelHeight, splitPanelRef, }) => {
16
+ export const useKeyboardEvents = ({ position, setSidePanelWidth, setBottomPanelHeight, panelRef, }) => {
18
17
  return (event) => {
19
18
  let setSizeFunction;
20
19
  let currentSize;
21
20
  let maxSize;
22
- const { splitPanelHeight, splitPanelWidth } = getCurrentSize(splitPanelRef);
21
+ const { panelHeight, panelWidth } = getCurrentSize(panelRef);
23
22
  if (position === 'side') {
24
23
  setSizeFunction = setSidePanelWidth;
25
- currentSize = splitPanelWidth;
24
+ currentSize = panelWidth;
26
25
  // don't need the exact max size as it's constrained in the set size function
27
26
  maxSize = window.innerWidth;
28
27
  }
29
28
  else {
30
29
  setSizeFunction = setBottomPanelHeight;
31
- currentSize = splitPanelHeight;
30
+ currentSize = panelHeight;
32
31
  // don't need the exact max size as it's constrained in the set size function
33
32
  maxSize = window.innerHeight;
34
33
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-keyboard-events.js","sourceRoot":"lib/default/","sources":["app-layout/utils/use-keyboard-events.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,MAAM,yBAAyB,GAAG,EAAE,CAAC;AACrC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAExC,MAAM,cAAc,GAAG,CAAC,QAA0C,EAAE,EAAE;IACpE,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;QAClC,OAAO;YACL,WAAW,EAAE,CAAC;YACd,UAAU,EAAE,CAAC;SACd,CAAC;KACH;IAED,OAAO;QACL,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,YAAY;QAC1C,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW;KACzC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAChC,QAAQ,EACR,iBAAiB,EACjB,oBAAoB,EACpB,QAAQ,GACS,EAAE,EAAE;IACrB,OAAO,CAAC,KAA0B,EAAE,EAAE;QACpC,IAAI,eAAe,CAAC;QACpB,IAAI,WAAW,CAAC;QAChB,IAAI,OAAO,CAAC;QAEZ,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;QAE7D,IAAI,QAAQ,KAAK,MAAM,EAAE;YACvB,eAAe,GAAG,iBAAiB,CAAC;YACpC,WAAW,GAAG,UAAU,CAAC;YACzB,6EAA6E;YAC7E,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC;SAC7B;aAAM;YACL,eAAe,GAAG,oBAAoB,CAAC;YACvC,WAAW,GAAG,WAAW,CAAC;YAC1B,6EAA6E;YAC7E,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC;SAC9B;QAED,MAA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AK,CAAC,eAAe,EAAE,CAAC;SACzB;IACH,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { KeyCode } from '../../internal/keycode';\nimport { SizeControlProps } from './interfaces';\n\nconst KEYBOARD_SINGLE_STEP_SIZE = 10;\nconst KEYBOARD_MULTIPLE_STEPS_SIZE = 60;\n\nconst getCurrentSize = (panelRef?: React.RefObject<HTMLDivElement>) => {\n if (!panelRef || !panelRef.current) {\n return {\n panelHeight: 0,\n panelWidth: 0,\n };\n }\n\n return {\n panelHeight: panelRef.current.clientHeight,\n panelWidth: panelRef.current.clientWidth,\n };\n};\n\nexport const useKeyboardEvents = ({\n position,\n setSidePanelWidth,\n setBottomPanelHeight,\n panelRef,\n}: SizeControlProps) => {\n return (event: React.KeyboardEvent) => {\n let setSizeFunction;\n let currentSize;\n let maxSize;\n\n const { panelHeight, panelWidth } = getCurrentSize(panelRef);\n\n if (position === 'side') {\n setSizeFunction = setSidePanelWidth;\n currentSize = panelWidth;\n // don't need the exact max size as it's constrained in the set size function\n maxSize = window.innerWidth;\n } else {\n setSizeFunction = setBottomPanelHeight;\n currentSize = panelHeight;\n // don't need the exact max size as it's constrained in the set size function\n maxSize = window.innerHeight;\n }\n\n const primaryGrowKey = position === 'bottom' ? KeyCode.up : KeyCode.left;\n const primaryShrinkKey = position === 'bottom' ? KeyCode.down : KeyCode.right;\n const altGrowKey = position === 'bottom' ? KeyCode.right : KeyCode.down;\n const altShrinkKey = position === 'bottom' ? KeyCode.left : KeyCode.up;\n\n let isEventHandled = true;\n switch (event.keyCode) {\n case primaryGrowKey:\n case altGrowKey:\n setSizeFunction(currentSize + KEYBOARD_SINGLE_STEP_SIZE);\n\n break;\n case primaryShrinkKey:\n case altShrinkKey:\n setSizeFunction(currentSize - KEYBOARD_SINGLE_STEP_SIZE);\n break;\n case KeyCode.pageUp:\n setSizeFunction(currentSize + KEYBOARD_MULTIPLE_STEPS_SIZE);\n break;\n case KeyCode.pageDown:\n setSizeFunction(currentSize - KEYBOARD_MULTIPLE_STEPS_SIZE);\n break;\n case KeyCode.home:\n setSizeFunction(maxSize);\n break;\n case KeyCode.end:\n setSizeFunction(0);\n break;\n default:\n isEventHandled = false;\n }\n\n if (isEventHandled) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n};\n"]}
@@ -0,0 +1,3 @@
1
+ import { SizeControlProps } from './interfaces';
2
+ export declare const usePointerEvents: ({ position, panelRef, handleRef, setSidePanelWidth, setBottomPanelHeight, hasTransitions, }: SizeControlProps) => () => void;
3
+ //# sourceMappingURL=use-pointer-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-pointer-events.d.ts","sourceRoot":"lib/default/","sources":["app-layout/utils/use-pointer-events.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,eAAO,MAAM,gBAAgB,gGAO1B,gBAAgB,eAoDlB,CAAC"}
@@ -2,32 +2,39 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { useCallback } from 'react';
4
4
  import styles from '../styles.css.js';
5
- export const usePointerEvents = ({ position, splitPanelRef, handleRef, setSidePanelWidth, setBottomPanelHeight, }) => {
5
+ export const usePointerEvents = ({ position, panelRef, handleRef, setSidePanelWidth, setBottomPanelHeight, hasTransitions = false, }) => {
6
6
  const onDocumentPointerMove = useCallback((event) => {
7
- if (!splitPanelRef || !splitPanelRef.current || !handleRef || !handleRef.current) {
7
+ if (!panelRef || !panelRef.current || !handleRef || !handleRef.current) {
8
8
  return;
9
9
  }
10
+ panelRef.current.classList.remove(styles['with-motion']);
10
11
  if (position === 'side') {
11
- const mouseClientX = event.clientX;
12
+ const mouseClientX = event.clientX || 0;
12
13
  // The handle offset aligns the cursor with the middle of the resize handle.
13
14
  const handleOffset = handleRef.current.getBoundingClientRect().width / 2;
14
- const width = splitPanelRef.current.getBoundingClientRect().right - mouseClientX + handleOffset;
15
+ const width = panelRef.current.getBoundingClientRect().right - mouseClientX + handleOffset;
15
16
  setSidePanelWidth(width);
16
17
  }
17
18
  else {
18
- const mouseClientY = event.clientY;
19
+ const mouseClientY = event.clientY || 0;
19
20
  // The handle offset aligns the cursor with the middle of the resize handle.
20
21
  const handleOffset = handleRef.current.getBoundingClientRect().height / 2;
21
- const height = splitPanelRef.current.getBoundingClientRect().bottom - mouseClientY + handleOffset;
22
+ const height = panelRef.current.getBoundingClientRect().bottom - mouseClientY + handleOffset;
22
23
  setBottomPanelHeight(height);
23
24
  }
24
- }, [position, splitPanelRef, handleRef, setSidePanelWidth, setBottomPanelHeight]);
25
+ }, [position, panelRef, handleRef, setSidePanelWidth, setBottomPanelHeight]);
25
26
  const onDocumentPointerUp = useCallback(() => {
27
+ if (!panelRef || !panelRef.current) {
28
+ return;
29
+ }
30
+ if (hasTransitions) {
31
+ panelRef.current.classList.add(styles['with-motion']);
32
+ }
26
33
  document.body.classList.remove(styles['resize-active']);
27
34
  document.body.classList.remove(styles[`resize-${position}`]);
28
35
  document.removeEventListener('pointerup', onDocumentPointerUp);
29
36
  document.removeEventListener('pointermove', onDocumentPointerMove);
30
- }, [onDocumentPointerMove, position]);
37
+ }, [panelRef, onDocumentPointerMove, position, hasTransitions]);
31
38
  const onSliderPointerDown = useCallback(() => {
32
39
  document.body.classList.add(styles['resize-active']);
33
40
  document.body.classList.add(styles[`resize-${position}`]);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-pointer-events.js","sourceRoot":"lib/default/","sources":["app-layout/utils/use-pointer-events.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAGtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,iBAAiB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O,EAAE;YAClC,OAAO;SACR;QAED,IAAI,cAAc,EAAE;YAClB,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;SACvD;QACD,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;QACxD,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC7D,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;QAC/D,QAAQ,CAAC,mBAAmB,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC;IACrE,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC;IAEhE,MAAM,mBAAmB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC3C,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;QACrD,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC1D,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;QAC5D,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC;IAClE,CAAC,EAAE,CAAC,qBAAqB,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE3D,OAAO,mBAAmB,CAAC;AAC7B,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useCallback } from 'react';\nimport styles from '../styles.css.js';\nimport { SizeControlProps } from './interfaces';\n\nexport const usePointerEvents = ({\n position,\n panelRef,\n handleRef,\n setSidePanelWidth,\n setBottomPanelHeight,\n hasTransitions = false,\n}: SizeControlProps) => {\n const onDocumentPointerMove = useCallback(\n (event: PointerEvent) => {\n if (!panelRef || !panelRef.current || !handleRef || !handleRef.current) {\n return;\n }\n\n panelRef.current.classList.remove(styles['with-motion']);\n\n if (position === 'side') {\n const mouseClientX = event.clientX || 0;\n\n // The handle offset aligns the cursor with the middle of the resize handle.\n const handleOffset = handleRef.current.getBoundingClientRect().width / 2;\n const width = panelRef.current.getBoundingClientRect().right - mouseClientX + handleOffset;\n\n setSidePanelWidth(width);\n } else {\n const mouseClientY = event.clientY || 0;\n\n // The handle offset aligns the cursor with the middle of the resize handle.\n const handleOffset = handleRef.current.getBoundingClientRect().height / 2;\n const height = panelRef.current.getBoundingClientRect().bottom - mouseClientY + handleOffset;\n\n setBottomPanelHeight(height);\n }\n },\n [position, panelRef, handleRef, setSidePanelWidth, setBottomPanelHeight]\n );\n\n const onDocumentPointerUp = useCallback(() => {\n if (!panelRef || !panelRef.current) {\n return;\n }\n\n if (hasTransitions) {\n panelRef.current.classList.add(styles['with-motion']);\n }\n document.body.classList.remove(styles['resize-active']);\n document.body.classList.remove(styles[`resize-${position}`]);\n document.removeEventListener('pointerup', onDocumentPointerUp);\n document.removeEventListener('pointermove', onDocumentPointerMove);\n }, [panelRef, onDocumentPointerMove, position, hasTransitions]);\n\n const onSliderPointerDown = useCallback(() => {\n document.body.classList.add(styles['resize-active']);\n document.body.classList.add(styles[`resize-${position}`]);\n document.addEventListener('pointerup', onDocumentPointerUp);\n document.addEventListener('pointermove', onDocumentPointerMove);\n }, [onDocumentPointerMove, onDocumentPointerUp, position]);\n\n return onSliderPointerDown;\n};\n"]}
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { InternalDrawerProps } from '../drawer/interfaces';
3
+ import { DrawerFocusControlRefs } from './use-drawer-focus-control';
4
+ export interface DrawerResizeProps {
5
+ activeDrawerId?: string | null;
6
+ drawers: InternalDrawerProps['drawers'];
7
+ drawersRefs: DrawerFocusControlRefs;
8
+ isToolsOpen: boolean;
9
+ drawersMaxWidth: number;
10
+ }
11
+ declare function useResize(drawerRefObject: React.RefObject<HTMLDivElement>, drawerResizeProps: DrawerResizeProps): {
12
+ resizeHandle: JSX.Element;
13
+ drawerSize: number;
14
+ };
15
+ export default useResize;
16
+ //# sourceMappingURL=use-resize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-resize.d.ts","sourceRoot":"lib/default/","sources":["app-layout/utils/use-resize.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoD,MAAM,OAAO,CAAC;AASzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAK3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACxC,WAAW,EAAE,sBAAsB,CAAC;IACpC,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,iBAAS,SAAS,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,iBAAiB,EAAE,iBAAiB;;;EAgGxG;AAED,eAAe,SAAS,CAAC"}
@@ -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":"lib/default/","sources":["app-layout/utils/use-resize.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,aAAa,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAC/D,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,MAAM,MAAM,iCAAiC,CAAC;AAYrD,SAAS,SAAS,CAAC,eAAgD,EAAE,iBAAoC;;IACvG,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,iBAAiB,CAAC;IAEjG,MAAM,YAAY,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,cAAc,CAAC,mCAAI,IAAI,CAAC;IACrF,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,KAAI,EAAE,EAAE,CAAC,OAAO,aAAP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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,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAmB,MAAM,4BAA4B,CAAC;AAM/E,OAAO,EAAE,0BAA0B,EAA6B,MAAM,wCAAwC,CAAC;AAC/G,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAMvF,UAAU,kBAAmB,SAAQ,cAAc;IACjD,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,YAAY,CAAC;IACtB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,kBAAkB,EAAE,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,EAAE,gBAAgB,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACxF,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAClC,qBAAqB,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,iCAAiC,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,qBAAqB,KAAK,IAAI,CAAC;IAC1F,sBAAsB,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC3D,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,gBAAgB,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACvE,oBAAoB,EAAE,OAAO,CAAC;IAC9B,wBAAwB,EAAE,OAAO,CAA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;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,cAAc,CAAC,kBAAkB,CAAC;IACtD,sBAAsB,EAAE,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,