@cloudscape-design/components 3.0.365 → 3.0.366

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 (73) hide show
  1. package/app-layout/defaults.d.ts +1 -2
  2. package/app-layout/defaults.d.ts.map +1 -1
  3. package/app-layout/defaults.js.map +1 -1
  4. package/app-layout/drawer/index.d.ts.map +1 -1
  5. package/app-layout/drawer/index.js +3 -9
  6. package/app-layout/drawer/index.js.map +1 -1
  7. package/app-layout/drawer/interfaces.d.ts +5 -1
  8. package/app-layout/drawer/interfaces.d.ts.map +1 -1
  9. package/app-layout/drawer/interfaces.js.map +1 -1
  10. package/app-layout/drawer/resizable-drawer.d.ts.map +1 -1
  11. package/app-layout/drawer/resizable-drawer.js +6 -2
  12. package/app-layout/drawer/resizable-drawer.js.map +1 -1
  13. package/app-layout/index.d.ts.map +1 -1
  14. package/app-layout/index.js +43 -123
  15. package/app-layout/index.js.map +1 -1
  16. package/app-layout/utils/use-drawers.d.ts +28 -0
  17. package/app-layout/utils/use-drawers.d.ts.map +1 -0
  18. package/app-layout/utils/use-drawers.js +86 -0
  19. package/app-layout/utils/use-drawers.js.map +1 -0
  20. package/app-layout/utils/use-resize.d.ts +8 -4
  21. package/app-layout/utils/use-resize.d.ts.map +1 -1
  22. package/app-layout/utils/use-resize.js +5 -37
  23. package/app-layout/utils/use-resize.js.map +1 -1
  24. package/app-layout/visual-refresh/context.d.ts +5 -4
  25. package/app-layout/visual-refresh/context.d.ts.map +1 -1
  26. package/app-layout/visual-refresh/context.js +20 -38
  27. package/app-layout/visual-refresh/context.js.map +1 -1
  28. package/app-layout/visual-refresh/drawers.d.ts.map +1 -1
  29. package/app-layout/visual-refresh/drawers.js +11 -18
  30. package/app-layout/visual-refresh/drawers.js.map +1 -1
  31. package/app-layout/visual-refresh/mobile-toolbar.js +2 -2
  32. package/app-layout/visual-refresh/mobile-toolbar.js.map +1 -1
  33. package/app-layout/visual-refresh/split-panel.js +1 -1
  34. package/app-layout/visual-refresh/split-panel.js.map +1 -1
  35. package/app-layout/visual-refresh/styles.css.js +69 -69
  36. package/app-layout/visual-refresh/styles.scoped.css +167 -166
  37. package/app-layout/visual-refresh/styles.selectors.js +69 -69
  38. package/app-layout/visual-refresh/tools.js +1 -1
  39. package/app-layout/visual-refresh/tools.js.map +1 -1
  40. package/button/icon-helper.d.ts +1 -0
  41. package/button/icon-helper.d.ts.map +1 -1
  42. package/button/icon-helper.js +2 -2
  43. package/button/icon-helper.js.map +1 -1
  44. package/button/internal.d.ts +2 -0
  45. package/button/internal.d.ts.map +1 -1
  46. package/button/internal.js +2 -1
  47. package/button/internal.js.map +1 -1
  48. package/button-dropdown/interfaces.d.ts +10 -1
  49. package/button-dropdown/interfaces.d.ts.map +1 -1
  50. package/button-dropdown/interfaces.js.map +1 -1
  51. package/button-dropdown/internal.d.ts.map +1 -1
  52. package/button-dropdown/internal.js +15 -1
  53. package/button-dropdown/internal.js.map +1 -1
  54. package/button-dropdown/item-element/index.d.ts +4 -0
  55. package/button-dropdown/item-element/index.d.ts.map +1 -1
  56. package/button-dropdown/item-element/index.js +1 -1
  57. package/button-dropdown/item-element/index.js.map +1 -1
  58. package/icon/styles.css.js +21 -21
  59. package/icon/styles.scoped.css +54 -54
  60. package/icon/styles.selectors.js +21 -21
  61. package/internal/base-component/styles.scoped.css +5 -0
  62. package/internal/environment.js +1 -1
  63. package/internal/environment.json +1 -1
  64. package/internal/generated/theming/index.cjs +31 -0
  65. package/internal/generated/theming/index.js +31 -0
  66. package/internal/manifest.json +1 -1
  67. package/package.json +1 -1
  68. package/property-filter/index.d.ts.map +1 -1
  69. package/property-filter/index.js +2 -1
  70. package/property-filter/index.js.map +1 -1
  71. package/property-filter/styles.css.js +30 -29
  72. package/property-filter/styles.scoped.css +38 -32
  73. package/property-filter/styles.selectors.js +30 -29
@@ -1,10 +1,9 @@
1
1
  import { AppLayoutProps } from './interfaces';
2
- interface AppLayoutState {
2
+ export interface AppLayoutState {
3
3
  navigationOpen?: boolean;
4
4
  toolsOpen?: boolean;
5
5
  minContentWidth?: number;
6
6
  maxContentWidth?: number | undefined;
7
7
  }
8
8
  export declare function applyDefaults(contentType: AppLayoutProps.ContentType, stateFromProps: AppLayoutState, isRefresh: boolean): AppLayoutState;
9
- export {};
10
9
  //# sourceMappingURL=defaults.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"lib/default/","sources":["app-layout/defaults.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAqC9C,UAAU,cAAc;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAED,wBAAgB,aAAa,CAC3B,WAAW,EAAE,cAAc,CAAC,WAAW,EACvC,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE,OAAO,GACjB,cAAc,CAWhB"}
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"lib/default/","sources":["app-layout/defaults.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAqC9C,MAAM,WAAW,cAAc;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAED,wBAAgB,aAAa,CAC3B,WAAW,EAAE,cAAc,CAAC,WAAW,EACvC,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE,OAAO,GACjB,cAAc,CAWhB"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","sourceRoot":"lib/default/","sources":["app-layout/defaults.ts"],"names":[],"mappings":"AAIA,MAAM,uBAAuB,GAAmB;IAC9C,cAAc,EAAE,IAAI;IACpB,eAAe,EAAE,GAAG;IACpB,eAAe,EAAE,SAAS;CAC3B,CAAC;AAEF,MAAM,QAAQ,GAAuD;IACnE,OAAO,oBACF,uBAAuB,CAC3B;IACD,SAAS,oBACJ,uBAAuB,CAC3B;IACD,KAAK,EAAE;QACL,cAAc,EAAE,IAAI;QACpB,eAAe,EAAE,GAAG;QACpB,eAAe,EAAE,SAAS;KAC3B;IACD,IAAI,EAAE;QACJ,cAAc,EAAE,KAAK;QACrB,eAAe,EAAE,GAAG;QACpB,eAAe,EAAE,GAAG;KACrB;IACD,KAAK,EAAE;QACL,cAAc,EAAE,IAAI;QACpB,eAAe,EAAE,GAAG;QACpB,eAAe,EAAE,SAAS;KAC3B;IACD,MAAM,EAAE;QACN,cAAc,EAAE,KAAK;QACrB,eAAe,EAAE,GAAG;QACpB,eAAe,EAAE,IAAI;KACtB;CACF,CAAC;AASF,MAAM,UAAU,aAAa,CAC3B,WAAuC,EACvC,cAA8B,EAC9B,SAAkB;;IAElB,MAAM,mBAAmB,GAAG,SAAS;QACnC,CAAC,iCAAM,QAAQ,CAAC,WAAW,CAAC,KAAE,eAAe,EAAE,SAAS,IACxD,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAE1B,OAAO;QACL,eAAe,EAAE,MAAA,cAAc,CAAC,eAAe,mCAAI,mBAAmB,CAAC,eAAe;QACtF,eAAe,EAAE,MAAA,cAAc,CAAC,eAAe,mCAAI,mBAAmB,CAAC,eAAe;QACtF,cAAc,EAAE,MAAA,cAAc,CAAC,cAAc,mCAAI,mBAAmB,CAAC,cAAc;QACnF,SAAS,EAAE,MAAA,cAAc,CAAC,SAAS,mCAAI,mBAAmB,CAAC,SAAS;KACrE,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AppLayoutProps } from './interfaces';\n\nconst defaultContentTypeState: AppLayoutState = {\n navigationOpen: true,\n minContentWidth: 280,\n maxContentWidth: undefined,\n};\n\nconst defaults: Record<AppLayoutProps.ContentType, AppLayoutState> = {\n default: {\n ...defaultContentTypeState,\n },\n dashboard: {\n ...defaultContentTypeState,\n },\n cards: {\n navigationOpen: true,\n minContentWidth: 280,\n maxContentWidth: undefined,\n },\n form: {\n navigationOpen: false,\n minContentWidth: 280,\n maxContentWidth: 800,\n },\n table: {\n navigationOpen: true,\n minContentWidth: 280,\n maxContentWidth: undefined,\n },\n wizard: {\n navigationOpen: false,\n minContentWidth: 280,\n maxContentWidth: 1080,\n },\n};\n\ninterface AppLayoutState {\n navigationOpen?: boolean;\n toolsOpen?: boolean;\n minContentWidth?: number;\n maxContentWidth?: number | undefined;\n}\n\nexport function applyDefaults(\n contentType: AppLayoutProps.ContentType,\n stateFromProps: AppLayoutState,\n isRefresh: boolean\n): AppLayoutState {\n const contentTypeDefaults = isRefresh\n ? { ...defaults[contentType], maxContentWidth: undefined }\n : defaults[contentType];\n\n return {\n maxContentWidth: stateFromProps.maxContentWidth ?? contentTypeDefaults.maxContentWidth,\n minContentWidth: stateFromProps.minContentWidth ?? contentTypeDefaults.minContentWidth,\n navigationOpen: stateFromProps.navigationOpen ?? contentTypeDefaults.navigationOpen,\n toolsOpen: stateFromProps.toolsOpen ?? contentTypeDefaults.toolsOpen,\n };\n}\n"]}
1
+ {"version":3,"file":"defaults.js","sourceRoot":"lib/default/","sources":["app-layout/defaults.ts"],"names":[],"mappings":"AAIA,MAAM,uBAAuB,GAAmB;IAC9C,cAAc,EAAE,IAAI;IACpB,eAAe,EAAE,GAAG;IACpB,eAAe,EAAE,SAAS;CAC3B,CAAC;AAEF,MAAM,QAAQ,GAAuD;IACnE,OAAO,oBACF,uBAAuB,CAC3B;IACD,SAAS,oBACJ,uBAAuB,CAC3B;IACD,KAAK,EAAE;QACL,cAAc,EAAE,IAAI;QACpB,eAAe,EAAE,GAAG;QACpB,eAAe,EAAE,SAAS;KAC3B;IACD,IAAI,EAAE;QACJ,cAAc,EAAE,KAAK;QACrB,eAAe,EAAE,GAAG;QACpB,eAAe,EAAE,GAAG;KACrB;IACD,KAAK,EAAE;QACL,cAAc,EAAE,IAAI;QACpB,eAAe,EAAE,GAAG;QACpB,eAAe,EAAE,SAAS;KAC3B;IACD,MAAM,EAAE;QACN,cAAc,EAAE,KAAK;QACrB,eAAe,EAAE,GAAG;QACpB,eAAe,EAAE,IAAI;KACtB;CACF,CAAC;AASF,MAAM,UAAU,aAAa,CAC3B,WAAuC,EACvC,cAA8B,EAC9B,SAAkB;;IAElB,MAAM,mBAAmB,GAAG,SAAS;QACnC,CAAC,iCAAM,QAAQ,CAAC,WAAW,CAAC,KAAE,eAAe,EAAE,SAAS,IACxD,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAE1B,OAAO;QACL,eAAe,EAAE,MAAA,cAAc,CAAC,eAAe,mCAAI,mBAAmB,CAAC,eAAe;QACtF,eAAe,EAAE,MAAA,cAAc,CAAC,eAAe,mCAAI,mBAAmB,CAAC,eAAe;QACtF,cAAc,EAAE,MAAA,cAAc,CAAC,cAAc,mCAAI,mBAAmB,CAAC,cAAc;QACnF,SAAS,EAAE,MAAA,cAAc,CAAC,SAAS,mCAAI,mBAAmB,CAAC,SAAS;KACrE,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AppLayoutProps } from './interfaces';\n\nconst defaultContentTypeState: AppLayoutState = {\n navigationOpen: true,\n minContentWidth: 280,\n maxContentWidth: undefined,\n};\n\nconst defaults: Record<AppLayoutProps.ContentType, AppLayoutState> = {\n default: {\n ...defaultContentTypeState,\n },\n dashboard: {\n ...defaultContentTypeState,\n },\n cards: {\n navigationOpen: true,\n minContentWidth: 280,\n maxContentWidth: undefined,\n },\n form: {\n navigationOpen: false,\n minContentWidth: 280,\n maxContentWidth: 800,\n },\n table: {\n navigationOpen: true,\n minContentWidth: 280,\n maxContentWidth: undefined,\n },\n wizard: {\n navigationOpen: false,\n minContentWidth: 280,\n maxContentWidth: 1080,\n },\n};\n\nexport interface AppLayoutState {\n navigationOpen?: boolean;\n toolsOpen?: boolean;\n minContentWidth?: number;\n maxContentWidth?: number | undefined;\n}\n\nexport function applyDefaults(\n contentType: AppLayoutProps.ContentType,\n stateFromProps: AppLayoutState,\n isRefresh: boolean\n): AppLayoutState {\n const contentTypeDefaults = isRefresh\n ? { ...defaults[contentType], maxContentWidth: undefined }\n : defaults[contentType];\n\n return {\n maxContentWidth: stateFromProps.maxContentWidth ?? contentTypeDefaults.maxContentWidth,\n minContentWidth: stateFromProps.minContentWidth ?? contentTypeDefaults.minContentWidth,\n navigationOpen: stateFromProps.navigationOpen ?? contentTypeDefaults.navigationOpen,\n toolsOpen: stateFromProps.toolsOpen ?? contentTypeDefaults.toolsOpen,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["app-layout/drawer/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAKtC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAoC,MAAM,cAAc,CAAC;AAkB5G,eAAO,MAAM,MAAM,2FAyGlB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,eAAe,GAChB,EAAE,sBAAsB,eAoCxB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["app-layout/drawer/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAKtC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAc,MAAM,cAAc,CAAC;AAkBtF,eAAO,MAAM,MAAM,2FAkGlB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,eAAe,GAChB,EAAE,sBAAsB,eAoCxB"}
@@ -24,15 +24,9 @@ import styles from './styles.css.js';
24
24
  export const Drawer = React.forwardRef(({ contentClassName, toggleClassName, closeClassName, width, type, toggleRefs, topOffset, bottomOffset, ariaLabels, drawersAriaLabels, children, isOpen, isMobile, onToggle, onClick, onLoseFocus, drawers, resizeHandle, }, ref) => {
25
25
  const openButtonWrapperRef = useRef(null);
26
26
  const { TagName, iconName, getLabels } = togglesConfig[type];
27
- const { mainLabel, closeLabel, openLabel } = getLabels(ariaLabels);
27
+ const { mainLabel, closeLabel, openLabel } = drawersAriaLabels !== null && drawersAriaLabels !== void 0 ? drawersAriaLabels : getLabels(ariaLabels);
28
28
  const drawerContentWidthOpen = isMobile ? undefined : width;
29
29
  const drawerContentWidth = isOpen ? drawerContentWidthOpen : undefined;
30
- const getDrawersLabels = (labels = {}) => ({
31
- drawerMainLabel: labels === null || labels === void 0 ? void 0 : labels.content,
32
- drawerOpenLabel: labels === null || labels === void 0 ? void 0 : labels.triggerButton,
33
- drawerCloseLabel: labels === null || labels === void 0 ? void 0 : labels.closeButton,
34
- });
35
- const { drawerMainLabel, drawerCloseLabel } = getDrawersLabels(drawersAriaLabels);
36
30
  const regularOpenButton = (React.createElement(TagName, { ref: openButtonWrapperRef, "aria-label": mainLabel, className: styles.toggle, "aria-hidden": isOpen },
37
31
  React.createElement(ToggleButton, { ref: toggleRefs.toggle, className: toggleClassName, iconName: iconName, ariaLabel: openLabel, onClick: () => onToggle(true), ariaExpanded: false })));
38
32
  return (React.createElement("div", { ref: ref, className: clsx(styles.drawer, {
@@ -61,8 +55,8 @@ export const Drawer = React.forwardRef(({ contentClassName, toggleClassName, clo
61
55
  React.createElement("div", { style: { width: drawerContentWidth, top: topOffset, bottom: bottomOffset }, className: clsx(styles['drawer-content'], styles['drawer-content-clickable'], contentClassName) },
62
56
  !isMobile && regularOpenButton,
63
57
  resizeHandle,
64
- React.createElement(TagName, { "aria-label": drawers ? drawerMainLabel : mainLabel, "aria-hidden": !isOpen },
65
- React.createElement(CloseButton, { ref: toggleRefs.close, className: closeClassName, ariaLabel: drawers ? drawerCloseLabel : closeLabel, onClick: () => {
58
+ React.createElement(TagName, { "aria-label": mainLabel, "aria-hidden": !isOpen },
59
+ React.createElement(CloseButton, { ref: toggleRefs.close, className: closeClassName, ariaLabel: closeLabel, onClick: () => {
66
60
  onToggle(false);
67
61
  drawers === null || drawers === void 0 ? void 0 : drawers.onChange({ activeDrawerId: undefined });
68
62
  } }),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["app-layout/drawer/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAGrC,0FAA0F;AAC1F,qFAAqF;AACrF,uFAAuF;AACvF,4EAA4E;AAC5E,wFAAwF;AACxF,0FAA0F;AAC1F,0FAA0F;AAC1F,wBAAwB;AACxB,0FAA0F;AAC1F,4FAA4F;AAC5F,WAAW;AACX,oBAAoB;AACpB,iDAAiD;AACjD,iDAAiD;AACjD,iDAAiD;AACjD,sFAAsF;AACtF,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CACpC,CACE,EACE,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,KAAK,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,WAAW,EACX,OAAO,EACP,YAAY,GACO,EACrB,GAA8B,EAC9B,EAA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Ac,KAAK,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,uBAAuB,CAAC,CACtE,EACD,OAAO,EAAE,GAAG,EAAE,CACZ,OAAO,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;gBAGhG,oBAAC,YAAY,IACX,SAAS,EAAE,eAAe,EAC1B,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,EAC7B,SAAS,EAAE,MAAA,IAAI,CAAC,UAAU,0CAAE,aAAa,EACzC,YAAY,EAAE,OAAO,CAAC,cAAc,KAAK,SAAS,EAClD,MAAM,EAAE,4BAA4B,IAAI,CAAC,EAAE,EAAE,GAC7C,CACG,CACR,CAAA;SAAA,CAAC,CACI,CACT,CACG,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport { ToggleButton, CloseButton, togglesConfig } from '../toggles';\n\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from './styles.css.js';\nimport { DesktopDrawerProps, DrawerTriggersBarProps, DrawerItem, DrawerItemAriaLabels } from './interfaces';\n\n// We are using two landmarks per drawer, i.e. two NAVs and two ASIDEs, because of several\n// known bugs in NVDA that cause focus changes within a container to sometimes not be\n// announced. As a result, we use one region for the open button and one region for the\n// actual drawer content, always hiding the other one when it's not visible.\n// An alternative solution to follow a more classic implementation here to only have one\n// button that triggers the opening/closing of the drawer also did not work due to another\n// series of bugs in NVDA (together with Firefox) which prevent the changed expanded state\n// from being announced.\n// Even with this workaround in place, the announcement of the close button when opening a\n// panel in NVDA is not working correctly. The suspected root cause is one of the bugs below\n// as well.\n// Relevant tickets:\n// * https://github.com/nvaccess/nvda/issues/6606\n// * https://github.com/nvaccess/nvda/issues/5825\n// * https://github.com/nvaccess/nvda/issues/5247\n// * https://github.com/nvaccess/nvda/pull/8869 (reverted PR that was going to fix it)\nexport const Drawer = React.forwardRef(\n (\n {\n contentClassName,\n toggleClassName,\n closeClassName,\n width,\n type,\n toggleRefs,\n topOffset,\n bottomOffset,\n ariaLabels,\n drawersAriaLabels,\n children,\n isOpen,\n isMobile,\n onToggle,\n onClick,\n onLoseFocus,\n drawers,\n resizeHandle,\n }: DesktopDrawerProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n const openButtonWrapperRef = useRef<HTMLElement | null>(null);\n const { TagName, iconName, getLabels } = togglesConfig[type];\n const { mainLabel, closeLabel, openLabel } = getLabels(ariaLabels);\n const drawerContentWidthOpen = isMobile ? undefined : width;\n const drawerContentWidth = isOpen ? drawerContentWidthOpen : undefined;\n\n const getDrawersLabels = (labels: DrawerItemAriaLabels = {}) => ({\n drawerMainLabel: labels?.content,\n drawerOpenLabel: labels?.triggerButton,\n drawerCloseLabel: labels?.closeButton,\n });\n const { drawerMainLabel, drawerCloseLabel } = getDrawersLabels(drawersAriaLabels);\n\n const regularOpenButton = (\n <TagName ref={openButtonWrapperRef} aria-label={mainLabel} className={styles.toggle} aria-hidden={isOpen}>\n <ToggleButton\n ref={toggleRefs.toggle}\n className={toggleClassName}\n iconName={iconName}\n ariaLabel={openLabel}\n onClick={() => onToggle(true)}\n ariaExpanded={false}\n />\n </TagName>\n );\n\n return (\n <div\n ref={ref}\n className={clsx(styles.drawer, {\n [styles['drawer-closed']]: !isOpen,\n [testutilStyles['drawer-closed']]: !isOpen,\n [styles['drawer-mobile']]: isMobile,\n })}\n style={{ width: drawerContentWidth }}\n onBlur={\n onLoseFocus\n ? e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n onLoseFocus(e);\n }\n }\n : undefined\n }\n onClick={event => {\n if (onClick) {\n onClick(event);\n }\n if (!isOpen) {\n // to prevent calling onToggle from the drawer when it's called from the toggle button\n if (\n openButtonWrapperRef.current === event.target ||\n !openButtonWrapperRef.current?.contains(event.target as Node)\n ) {\n onToggle(true);\n }\n }\n }}\n >\n <div\n style={{ width: drawerContentWidth, top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], styles['drawer-content-clickable'], contentClassName)}\n >\n {!isMobile && regularOpenButton}\n {resizeHandle}\n <TagName aria-label={drawers ? drawerMainLabel : mainLabel} aria-hidden={!isOpen}>\n <CloseButton\n ref={toggleRefs.close}\n className={closeClassName}\n ariaLabel={drawers ? drawerCloseLabel : closeLabel}\n onClick={() => {\n onToggle(false);\n drawers?.onChange({ activeDrawerId: undefined });\n }}\n />\n {children}\n </TagName>\n </div>\n </div>\n );\n }\n);\n\nexport function DrawerTriggersBar({\n isMobile,\n topOffset,\n bottomOffset,\n drawers,\n contentClassName,\n toggleClassName,\n}: DrawerTriggersBarProps) {\n return (\n <div\n className={clsx(styles.drawer, styles['drawer-closed'], testutilStyles['drawer-closed'], {\n [styles['drawer-mobile']]: isMobile,\n })}\n >\n <div style={{ top: topOffset, bottom: bottomOffset }} className={styles['drawer-content']}>\n {!isMobile && (\n <aside aria-label={drawers?.ariaLabel} className={clsx(styles['drawer-triggers-wrapper'], contentClassName)}>\n {drawers?.items?.map((item: DrawerItem, index: number) => (\n <span\n key={index}\n className={clsx(\n styles['drawer-trigger'],\n drawers.activeDrawerId === item.id && styles['drawer-trigger-active']\n )}\n onClick={() =>\n drawers.onChange({ activeDrawerId: item.id !== drawers.activeDrawerId ? item.id : undefined })\n }\n >\n <ToggleButton\n className={toggleClassName}\n iconName={item.trigger.iconName}\n iconSvg={item.trigger.iconSvg}\n ariaLabel={item.ariaLabels?.triggerButton}\n ariaExpanded={drawers.activeDrawerId !== undefined}\n testId={`awsui-app-layout-trigger-${item.id}`}\n />\n </span>\n ))}\n </aside>\n )}\n </div>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"index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MAAM,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,IACtF,CAAC,QAAQ,IAAI,CACZ,6CAAmB,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,yBAAyB,CAAC,EAAE,gBAAgB,CAAC,IACxG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,0CAAE,GAAG,CAAC,CAAC,IAAgB,EAAE,KAAa,EAAE,EAAE;;YAAC,OAAA,CACxD,8BACE,GAAG,EAAE,KAAK,EACV,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,gBAAgB,CAAC,EACxB,OAAO,CAAC,cAAc,KAAK,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,uBAAuB,CAAC,CACtE,EACD,OAAO,EAAE,GAAG,EAAE,CACZ,OAAO,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;gBAGhG,oBAAC,YAAY,IACX,SAAS,EAAE,eAAe,EAC1B,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,EAC7B,SAAS,EAAE,MAAA,IAAI,CAAC,UAAU,0CAAE,aAAa,EACzC,YAAY,EAAE,OAAO,CAAC,cAAc,KAAK,SAAS,EAClD,MAAM,EAAE,4BAA4B,IAAI,CAAC,EAAE,EAAE,GAC7C,CACG,CACR,CAAA;SAAA,CAAC,CACI,CACT,CACG,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport { ToggleButton, CloseButton, togglesConfig } from '../toggles';\n\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from './styles.css.js';\nimport { DesktopDrawerProps, DrawerTriggersBarProps, DrawerItem } from './interfaces';\n\n// We are using two landmarks per drawer, i.e. two NAVs and two ASIDEs, because of several\n// known bugs in NVDA that cause focus changes within a container to sometimes not be\n// announced. As a result, we use one region for the open button and one region for the\n// actual drawer content, always hiding the other one when it's not visible.\n// An alternative solution to follow a more classic implementation here to only have one\n// button that triggers the opening/closing of the drawer also did not work due to another\n// series of bugs in NVDA (together with Firefox) which prevent the changed expanded state\n// from being announced.\n// Even with this workaround in place, the announcement of the close button when opening a\n// panel in NVDA is not working correctly. The suspected root cause is one of the bugs below\n// as well.\n// Relevant tickets:\n// * https://github.com/nvaccess/nvda/issues/6606\n// * https://github.com/nvaccess/nvda/issues/5825\n// * https://github.com/nvaccess/nvda/issues/5247\n// * https://github.com/nvaccess/nvda/pull/8869 (reverted PR that was going to fix it)\nexport const Drawer = React.forwardRef(\n (\n {\n contentClassName,\n toggleClassName,\n closeClassName,\n width,\n type,\n toggleRefs,\n topOffset,\n bottomOffset,\n ariaLabels,\n drawersAriaLabels,\n children,\n isOpen,\n isMobile,\n onToggle,\n onClick,\n onLoseFocus,\n drawers,\n resizeHandle,\n }: DesktopDrawerProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n const openButtonWrapperRef = useRef<HTMLElement | null>(null);\n const { TagName, iconName, getLabels } = togglesConfig[type];\n const { mainLabel, closeLabel, openLabel } = drawersAriaLabels ?? getLabels(ariaLabels);\n const drawerContentWidthOpen = isMobile ? undefined : width;\n const drawerContentWidth = isOpen ? drawerContentWidthOpen : undefined;\n\n const regularOpenButton = (\n <TagName ref={openButtonWrapperRef} aria-label={mainLabel} className={styles.toggle} aria-hidden={isOpen}>\n <ToggleButton\n ref={toggleRefs.toggle}\n className={toggleClassName}\n iconName={iconName}\n ariaLabel={openLabel}\n onClick={() => onToggle(true)}\n ariaExpanded={false}\n />\n </TagName>\n );\n\n return (\n <div\n ref={ref}\n className={clsx(styles.drawer, {\n [styles['drawer-closed']]: !isOpen,\n [testutilStyles['drawer-closed']]: !isOpen,\n [styles['drawer-mobile']]: isMobile,\n })}\n style={{ width: drawerContentWidth }}\n onBlur={\n onLoseFocus\n ? e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n onLoseFocus(e);\n }\n }\n : undefined\n }\n onClick={event => {\n if (onClick) {\n onClick(event);\n }\n if (!isOpen) {\n // to prevent calling onToggle from the drawer when it's called from the toggle button\n if (\n openButtonWrapperRef.current === event.target ||\n !openButtonWrapperRef.current?.contains(event.target as Node)\n ) {\n onToggle(true);\n }\n }\n }}\n >\n <div\n style={{ width: drawerContentWidth, top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], styles['drawer-content-clickable'], contentClassName)}\n >\n {!isMobile && regularOpenButton}\n {resizeHandle}\n <TagName aria-label={mainLabel} aria-hidden={!isOpen}>\n <CloseButton\n ref={toggleRefs.close}\n className={closeClassName}\n ariaLabel={closeLabel}\n onClick={() => {\n onToggle(false);\n drawers?.onChange({ activeDrawerId: undefined });\n }}\n />\n {children}\n </TagName>\n </div>\n </div>\n );\n }\n);\n\nexport function DrawerTriggersBar({\n isMobile,\n topOffset,\n bottomOffset,\n drawers,\n contentClassName,\n toggleClassName,\n}: DrawerTriggersBarProps) {\n return (\n <div\n className={clsx(styles.drawer, styles['drawer-closed'], testutilStyles['drawer-closed'], {\n [styles['drawer-mobile']]: isMobile,\n })}\n >\n <div style={{ top: topOffset, bottom: bottomOffset }} className={styles['drawer-content']}>\n {!isMobile && (\n <aside aria-label={drawers?.ariaLabel} className={clsx(styles['drawer-triggers-wrapper'], contentClassName)}>\n {drawers?.items?.map((item: DrawerItem, index: number) => (\n <span\n key={index}\n className={clsx(\n styles['drawer-trigger'],\n drawers.activeDrawerId === item.id && styles['drawer-trigger-active']\n )}\n onClick={() =>\n drawers.onChange({ activeDrawerId: item.id !== drawers.activeDrawerId ? item.id : undefined })\n }\n >\n <ToggleButton\n className={toggleClassName}\n iconName={item.trigger.iconName}\n iconSvg={item.trigger.iconSvg}\n ariaLabel={item.ariaLabels?.triggerButton}\n ariaExpanded={drawers.activeDrawerId !== undefined}\n testId={`awsui-app-layout-trigger-${item.id}`}\n />\n </span>\n ))}\n </aside>\n )}\n </div>\n </div>\n );\n}\n"]}
@@ -20,7 +20,11 @@ export interface DesktopDrawerProps {
20
20
  topOffset: number | undefined;
21
21
  bottomOffset: number | undefined;
22
22
  ariaLabels: AppLayoutProps.Labels | undefined;
23
- drawersAriaLabels?: DrawerItemAriaLabels | undefined;
23
+ drawersAriaLabels?: {
24
+ mainLabel: string | undefined;
25
+ closeLabel: string | undefined;
26
+ openLabel: string | undefined;
27
+ };
24
28
  children: React.ReactNode;
25
29
  type: keyof typeof togglesConfig;
26
30
  isMobile: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["app-layout/drawer/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE;QACV,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC;YAAE,KAAK,IAAI,IAAI,CAAA;SAAE,CAAC,CAAC;QACrC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC;YAAE,KAAK,IAAI,IAAI,CAAA;SAA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ourceRoot":"lib/default/","sources":["app-layout/drawer/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';\nimport { togglesConfig } from '../toggles';\nimport { AppLayoutProps } from '../interfaces';\nimport { IconProps } from '../../icon/interfaces';\nimport { NonCancelableEventHandler } from '../../internal/events';\n\nimport { DrawerFocusControlRefs } from '../utils/use-drawer-focus-control';\n\nexport interface DesktopDrawerProps {\n contentClassName: string;\n toggleClassName: string;\n closeClassName: string;\n toggleRefs: {\n toggle: React.Ref<{ focus(): void }>;\n close: React.Ref<{ focus(): void }>;\n };\n width: number;\n topOffset: number | undefined;\n bottomOffset: number | undefined;\n ariaLabels: AppLayoutProps.Labels | undefined;\n drawersAriaLabels?: DrawerItemAriaLabels | undefined;\n children: React.ReactNode;\n type: keyof typeof togglesConfig;\n isMobile: boolean;\n isOpen: boolean;\n onToggle: (isOpen: boolean) => void;\n onClick?: (event: React.MouseEvent) => void;\n onLoseFocus?: (event: React.FocusEvent) => void;\n drawers?: {\n items: Array<DrawerItem>;\n activeDrawerId: string | undefined;\n onChange: (changeDetail: { activeDrawerId: string | undefined }) => void;\n };\n resizeHandle?: React.ReactNode;\n}\n\nexport interface ResizableDrawerProps extends DesktopDrawerProps {\n activeDrawer?: DrawerItem;\n onResize: (resizeDetail: { size: number; id: string }) => void;\n size: number;\n getMaxWidth: () => number;\n refs: DrawerFocusControlRefs;\n}\n\nexport interface DrawerTriggersBarProps {\n contentClassName: string;\n toggleClassName: string;\n topOffset: number | undefined;\n bottomOffset: number | undefined;\n isMobile: boolean;\n drawers?: {\n items: Array<DrawerItem>;\n activeDrawerId?: string;\n onChange: (changeDetail: { activeDrawerId: string | undefined }) => void;\n ariaLabel?: string;\n };\n}\n\nexport interface DrawerItemAriaLabels {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n}\n\nexport interface DrawerItem {\n id: string;\n content: React.ReactNode;\n trigger: {\n iconName?: IconProps.Name;\n iconSvg?: React.ReactNode;\n };\n ariaLabels: DrawerItemAriaLabels;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n}\n\nexport interface InternalDrawerProps {\n drawers?: {\n items: Array<DrawerItem>;\n activeDrawerId?: string;\n onChange?: NonCancelableEventHandler<string>;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n ariaLabel?: string;\n };\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["app-layout/drawer/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';\nimport { togglesConfig } from '../toggles';\nimport { AppLayoutProps } from '../interfaces';\nimport { IconProps } from '../../icon/interfaces';\nimport { NonCancelableEventHandler } from '../../internal/events';\n\nimport { DrawerFocusControlRefs } from '../utils/use-drawer-focus-control';\n\nexport interface DesktopDrawerProps {\n contentClassName: string;\n toggleClassName: string;\n closeClassName: string;\n toggleRefs: {\n toggle: React.Ref<{ focus(): void }>;\n close: React.Ref<{ focus(): void }>;\n };\n width: number;\n topOffset: number | undefined;\n bottomOffset: number | undefined;\n ariaLabels: AppLayoutProps.Labels | undefined;\n drawersAriaLabels?: { mainLabel: string | undefined; closeLabel: string | undefined; openLabel: string | undefined };\n children: React.ReactNode;\n type: keyof typeof togglesConfig;\n isMobile: boolean;\n isOpen: boolean;\n onToggle: (isOpen: boolean) => void;\n onClick?: (event: React.MouseEvent) => void;\n onLoseFocus?: (event: React.FocusEvent) => void;\n drawers?: {\n items: Array<DrawerItem>;\n activeDrawerId: string | undefined;\n onChange: (changeDetail: { activeDrawerId: string | undefined }) => void;\n };\n resizeHandle?: React.ReactNode;\n}\n\nexport interface ResizableDrawerProps extends DesktopDrawerProps {\n activeDrawer?: DrawerItem;\n onResize: (resizeDetail: { size: number; id: string }) => void;\n size: number;\n getMaxWidth: () => number;\n refs: DrawerFocusControlRefs;\n}\n\nexport interface DrawerTriggersBarProps {\n contentClassName: string;\n toggleClassName: string;\n topOffset: number | undefined;\n bottomOffset: number | undefined;\n isMobile: boolean;\n drawers?: {\n items: Array<DrawerItem>;\n activeDrawerId?: string;\n onChange: (changeDetail: { activeDrawerId: string | undefined }) => void;\n ariaLabel?: string;\n };\n}\n\nexport interface DrawerItemAriaLabels {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n}\n\nexport interface DrawerItem {\n id: string;\n content: React.ReactNode;\n trigger: {\n iconName?: IconProps.Name;\n iconSvg?: React.ReactNode;\n };\n ariaLabels: DrawerItemAriaLabels;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n}\n\nexport interface InternalDrawerProps {\n drawers?: {\n items: Array<DrawerItem>;\n activeDrawerId?: string;\n onChange?: NonCancelableEventHandler<string>;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n ariaLabel?: string;\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"resizable-drawer.d.ts","sourceRoot":"lib/default/","sources":["app-layout/drawer/resizable-drawer.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,eAAO,MAAM,eAAe,kEAOzB,oBAAoB,gBAsEtB,CAAC"}
1
+ {"version":3,"file":"resizable-drawer.d.ts","sourceRoot":"lib/default/","sources":["app-layout/drawer/resizable-drawer.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,eAAO,MAAM,eAAe,kEAOzB,oBAAoB,gBA2EtB,CAAC"}
@@ -11,7 +11,7 @@ import testutilStyles from '../test-classes/styles.css.js';
11
11
  import ResizeHandler from '../../split-panel/icons/resize-handler';
12
12
  import splitPanelStyles from '../../split-panel/styles.css.js';
13
13
  export const ResizableDrawer = (_a) => {
14
- var _b;
14
+ var _b, _c, _d, _e;
15
15
  var { onResize, size, getMaxWidth, refs, activeDrawer } = _a, props = __rest(_a, ["onResize", "size", "getMaxWidth", "refs", "activeDrawer"]);
16
16
  const { isOpen, children, isMobile } = props;
17
17
  const MIN_WIDTH = (activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.defaultSize) && activeDrawer.defaultSize < 280 ? activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.defaultSize : 280;
@@ -48,6 +48,10 @@ export const ResizableDrawer = (_a) => {
48
48
  const resizeHandle = (React.createElement("div", { ref: refs.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 },
49
49
  React.createElement(ResizeHandler, { className: clsx(splitPanelStyles['slider-icon'], splitPanelStyles[`slider-icon-side`]) })));
50
50
  return (React.createElement(Drawer, Object.assign({}, props, { ref: drawerRefObject, resizeHandle: !isMobile &&
51
- (activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.resizable) && React.createElement("div", { className: splitPanelStyles['slider-wrapper-side'] }, resizeHandle) }), children));
51
+ (activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.resizable) && React.createElement("div", { className: splitPanelStyles['slider-wrapper-side'] }, resizeHandle), drawersAriaLabels: {
52
+ openLabel: (_c = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.ariaLabels) === null || _c === void 0 ? void 0 : _c.triggerButton,
53
+ mainLabel: (_d = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.ariaLabels) === null || _d === void 0 ? void 0 : _d.content,
54
+ closeLabel: (_e = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.ariaLabels) === null || _e === void 0 ? void 0 : _e.closeButton,
55
+ } }), children));
52
56
  };
53
57
  //# sourceMappingURL=resizable-drawer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resizable-drawer.js","sourceRoot":"lib/default/","sources":["app-layout/drawer/resizable-drawer.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAE3D,OAAO,aAAa,MAAM,wCAAwC,CAAC;AACnE,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAG/D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAOT,EAAE,EAAE;;QAPK,EAC9B,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,YAAY,OAES,EADlB,KAAK,cANsB,2DAO/B,CADS;IAER,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE7C,MAAM,SAAS,GAAG,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,WAAW,KAAI,YAAY,CAAC,WAAW,GAAG,GAAG,CAAC,CAAC,CAAC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC;IAChH,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;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,IAAI,CAAC,MAAM,EAChB,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,CACL,oBAAC,MAAM,oBACD,KAAK,IACT,GAAG,EAAE,eAAe,EACpB,YAAY,EACV,CAAC,QAAQ;aACT,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,SAAS,CAAA,IAAI,6BAAK,SAAS,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,IAAG,YAAY,CAAO,KAGzG,QAAQ,CACF,CACV,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useEffect, useState, useRef } from 'react';\n\nimport { getLimitedValue } from '../../split-panel/utils/size-utils';\nimport { usePointerEvents } from '../utils/use-pointer-events';\nimport { useKeyboardEvents } from '../utils/use-keyboard-events';\nimport { SizeControlProps } from '../utils/interfaces';\nimport { Drawer } from './index';\nimport testutilStyles from '../test-classes/styles.css.js';\n\nimport ResizeHandler from '../../split-panel/icons/resize-handler';\nimport splitPanelStyles from '../../split-panel/styles.css.js';\nimport { ResizableDrawerProps } from './interfaces';\n\nexport const ResizableDrawer = ({\n onResize,\n size,\n getMaxWidth,\n refs,\n activeDrawer,\n ...props\n}: ResizableDrawerProps) => {\n const { isOpen, children, isMobile } = props;\n\n const MIN_WIDTH = activeDrawer?.defaultSize && activeDrawer.defaultSize < 280 ? activeDrawer?.defaultSize : 280;\n const [relativeSize, setRelativeSize] = useState(0);\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 = getMaxWidth();\n setRelativeSize((size / maxSize) * 100);\n });\n return () => cancelAnimationFrame(handle);\n }, [size, getMaxWidth]);\n\n const setSidePanelWidth = (width: number) => {\n const maxWidth = getMaxWidth();\n const size = getLimitedValue(MIN_WIDTH, width, maxWidth);\n const id = activeDrawer?.id;\n\n if (isOpen && id && maxWidth >= MIN_WIDTH) {\n onResize({ size, id });\n }\n };\n\n const position = 'side';\n const setBottomPanelHeight = () => {};\n const drawerRefObject = useRef<HTMLDivElement>(null);\n\n const sizeControlProps: SizeControlProps = {\n position,\n panelRef: drawerRefObject,\n handleRef: refs.slider,\n setSidePanelWidth,\n setBottomPanelHeight,\n };\n\n const onSliderPointerDown = usePointerEvents(sizeControlProps);\n const onKeyDown = useKeyboardEvents(sizeControlProps);\n\n const resizeHandle = (\n <div\n ref={refs.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 (\n <Drawer\n {...props}\n ref={drawerRefObject}\n resizeHandle={\n !isMobile &&\n activeDrawer?.resizable && <div className={splitPanelStyles['slider-wrapper-side']}>{resizeHandle}</div>\n }\n >\n {children}\n </Drawer>\n );\n};\n"]}
1
+ {"version":3,"file":"resizable-drawer.js","sour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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,CACL,oBAAC,MAAM,oBACD,KAAK,IACT,GAAG,EAAE,eAAe,EACpB,YAAY,EACV,CAAC,QAAQ;aACT,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,SAAS,CAAA,IAAI,6BAAK,SAAS,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,IAAG,YAAY,CAAO,EAE1G,iBAAiB,EAAE;YACjB,SAAS,EAAE,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,UAAU,0CAAE,aAAa;YAClD,SAAS,EAAE,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,UAAU,0CAAE,OAAO;YAC5C,UAAU,EAAE,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,UAAU,0CAAE,WAAW;SAClD,KAEA,QAAQ,CACF,CACV,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useEffect, useState, useRef } from 'react';\n\nimport { getLimitedValue } from '../../split-panel/utils/size-utils';\nimport { usePointerEvents } from '../utils/use-pointer-events';\nimport { useKeyboardEvents } from '../utils/use-keyboard-events';\nimport { SizeControlProps } from '../utils/interfaces';\nimport { Drawer } from './index';\nimport testutilStyles from '../test-classes/styles.css.js';\n\nimport ResizeHandler from '../../split-panel/icons/resize-handler';\nimport splitPanelStyles from '../../split-panel/styles.css.js';\nimport { ResizableDrawerProps } from './interfaces';\n\nexport const ResizableDrawer = ({\n onResize,\n size,\n getMaxWidth,\n refs,\n activeDrawer,\n ...props\n}: ResizableDrawerProps) => {\n const { isOpen, children, isMobile } = props;\n\n const MIN_WIDTH = activeDrawer?.defaultSize && activeDrawer.defaultSize < 280 ? activeDrawer?.defaultSize : 280;\n const [relativeSize, setRelativeSize] = useState(0);\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 = getMaxWidth();\n setRelativeSize((size / maxSize) * 100);\n });\n return () => cancelAnimationFrame(handle);\n }, [size, getMaxWidth]);\n\n const setSidePanelWidth = (width: number) => {\n const maxWidth = getMaxWidth();\n const size = getLimitedValue(MIN_WIDTH, width, maxWidth);\n const id = activeDrawer?.id;\n\n if (isOpen && id && maxWidth >= MIN_WIDTH) {\n onResize({ size, id });\n }\n };\n\n const position = 'side';\n const setBottomPanelHeight = () => {};\n const drawerRefObject = useRef<HTMLDivElement>(null);\n\n const sizeControlProps: SizeControlProps = {\n position,\n panelRef: drawerRefObject,\n handleRef: refs.slider,\n setSidePanelWidth,\n setBottomPanelHeight,\n };\n\n const onSliderPointerDown = usePointerEvents(sizeControlProps);\n const onKeyDown = useKeyboardEvents(sizeControlProps);\n\n const resizeHandle = (\n <div\n ref={refs.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 (\n <Drawer\n {...props}\n ref={drawerRefObject}\n resizeHandle={\n !isMobile &&\n activeDrawer?.resizable && <div className={splitPanelStyles['slider-wrapper-side']}>{resizeHandle}</div>\n }\n drawersAriaLabels={{\n openLabel: activeDrawer?.ariaLabels?.triggerButton,\n mainLabel: activeDrawer?.ariaLabels?.content,\n closeLabel: activeDrawer?.ariaLabels?.closeButton,\n }}\n >\n {children}\n </Drawer>\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["app-layout/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiF,MAAM,OAAO,CAAC;AAMtG,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AA0C9C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,QAAA,MAAM,SAAS,2FAoDd,CAAC;AAwsBF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["app-layout/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAwE,MAAM,OAAO,CAAC;AAM7F,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAwC9C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,QAAA,MAAM,SAAS,2FA8Bd,CAAC;AA8nBF,eAAe,SAAS,CAAC"}
@@ -2,7 +2,7 @@ import { __rest } from "tslib";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  import clsx from 'clsx';
5
- import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
5
+ import React, { useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
6
6
  import { getBaseProps } from '../internal/base-component';
7
7
  import { useControllable } from '../internal/hooks/use-controllable';
8
8
  import { useMobile } from '../internal/hooks/use-mobile';
@@ -25,7 +25,6 @@ import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
25
25
  import ContentWrapper from './content-wrapper';
26
26
  import { Drawer, DrawerTriggersBar } from './drawer';
27
27
  import { ResizableDrawer } from './drawer/resizable-drawer';
28
- import { togglesConfig } from './toggles';
29
28
  import { SideSplitPanelDrawer } from './split-panel-drawer';
30
29
  import useAppLayoutOffsets from './utils/use-content-width';
31
30
  import { isDevelopment } from '../internal/is-development';
@@ -34,14 +33,12 @@ import RefreshedAppLayout from './visual-refresh';
34
33
  import { useInternalI18n } from '../i18n/context';
35
34
  import { useSplitPanelFocusControl } from './utils/use-split-panel-focus-control';
36
35
  import { useDrawerFocusControl } from './utils/use-drawer-focus-control';
37
- import { awsuiPluginsInternal } from '../internal/plugins/api';
38
- import { convertRuntimeDrawers } from './runtime-api';
36
+ import { TOOLS_DRAWER_ID, useDrawers } from './utils/use-drawers';
39
37
  import { useContainerQuery } from '@cloudscape-design/component-toolkit';
40
38
  const AppLayout = React.forwardRef((_a, ref) => {
41
- var _b, _c, _d, _e, _f, _g, _h, _j;
39
+ var _b, _c, _d, _e, _f, _g, _h;
42
40
  var { contentType = 'default', headerSelector = '#b #h', footerSelector = '#b #f' } = _a, rest = __rest(_a, ["contentType", "headerSelector", "footerSelector"]);
43
41
  const { __internalRootRef } = useBaseComponent('AppLayout');
44
- const [runtimeDrawers, setRuntimeDrawers] = useState({ before: [], after: [] });
45
42
  const isRefresh = useVisualRefresh();
46
43
  const i18n = useInternalI18n('app-layout');
47
44
  const ariaLabels = {
@@ -56,71 +53,26 @@ const AppLayout = React.forwardRef((_a, ref) => {
56
53
  // This re-builds the props including the default values
57
54
  const props = Object.assign(Object.assign({ contentType, headerSelector, footerSelector }, rest), { ariaLabels });
58
55
  const baseProps = getBaseProps(rest);
59
- const ownDrawers = props.drawers;
60
- const disableRuntimeDrawers = props.__disableRuntimeDrawers;
61
- const combinedDrawers = [...runtimeDrawers.before, ...((_j = ownDrawers === null || ownDrawers === void 0 ? void 0 : ownDrawers.items) !== null && _j !== void 0 ? _j : []), ...runtimeDrawers.after];
62
- const finalDrawers = combinedDrawers.length > 0 ? Object.assign(Object.assign({}, ownDrawers), { items: combinedDrawers }) : ownDrawers;
63
- useEffect(() => {
64
- if (disableRuntimeDrawers) {
65
- return;
66
- }
67
- const unsubscribe = awsuiPluginsInternal.appLayout.onDrawersRegistered(drawers => setRuntimeDrawers(convertRuntimeDrawers(drawers)));
68
- return () => {
69
- unsubscribe();
70
- setRuntimeDrawers({ before: [], after: [] });
71
- };
72
- }, [disableRuntimeDrawers]);
73
- return (React.createElement("div", Object.assign({ ref: __internalRootRef }, baseProps), isRefresh ? (React.createElement(RefreshedAppLayout, Object.assign({}, props, { drawers: finalDrawers }, { ref: ref }))) : (React.createElement(OldAppLayout, Object.assign({}, props, { drawers: finalDrawers }, { ref: ref })))));
56
+ return (React.createElement("div", Object.assign({ ref: __internalRootRef }, baseProps), isRefresh ? React.createElement(RefreshedAppLayout, Object.assign({}, props, { ref: ref })) : React.createElement(OldAppLayout, Object.assign({}, props, { ref: ref }))));
74
57
  });
75
58
  const OldAppLayout = React.forwardRef((_a, ref) => {
76
- var _b, _c;
59
+ var _b;
77
60
  var { navigation, navigationWidth = 280, navigationHide, navigationOpen: controlledNavigationOpen, tools, toolsWidth = 290, toolsHide, toolsOpen: controlledToolsOpen, breadcrumbs, notifications, stickyNotifications, contentHeader, disableContentHeaderOverlap, content, contentType = 'default', disableContentPaddings, disableBodyScroll, maxContentWidth, minContentWidth, headerSelector = '#b #h', footerSelector = '#b #f', ariaLabels, splitPanel, splitPanelSize: controlledSplitPanelSize, splitPanelOpen: controlledSplitPanelOpen, splitPanelPreferences: controlledSplitPanelPreferences, onSplitPanelPreferencesChange, onSplitPanelResize, onSplitPanelToggle, onNavigationChange, onToolsChange } = _a, props = __rest(_a, ["navigation", "navigationWidth", "navigationHide", "navigationOpen", "tools", "toolsWidth", "toolsHide", "toolsOpen", "breadcrumbs", "notifications", "stickyNotifications", "contentHeader", "disableContentHeaderOverlap", "content", "contentType", "disableContentPaddings", "disableBodyScroll", "maxContentWidth", "minContentWidth", "headerSelector", "footerSelector", "ariaLabels", "splitPanel", "splitPanelSize", "splitPanelOpen", "splitPanelPreferences", "onSplitPanelPreferencesChange", "onSplitPanelResize", "onSplitPanelToggle", "onNavigationChange", "onToolsChange"]);
78
61
  if (isDevelopment) {
79
62
  if (controlledToolsOpen && toolsHide) {
80
63
  warnOnce('AppLayout', `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\`.`);
81
64
  }
82
65
  }
83
- const drawers = props.drawers;
84
- const hasDrawers = drawers && drawers.items.length > 0;
85
66
  const rootRef = useRef(null);
86
67
  const isMobile = useMobile();
87
68
  const defaults = applyDefaults(contentType, { maxContentWidth, minContentWidth }, false);
88
69
  const [navigationOpen = false, setNavigationOpen] = useControllable(controlledNavigationOpen, onNavigationChange, isMobile ? false : defaults.navigationOpen, { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' });
89
70
  const [toolsOpen = false, setToolsOpen] = useControllable(controlledToolsOpen, onToolsChange, isMobile ? false : defaults.toolsOpen, { componentName: 'AppLayout', controlledProp: 'toolsOpen', changeHandler: 'onToolsChange' });
90
- const [activeDrawerId, setActiveDrawerId] = useControllable(drawers === null || drawers === void 0 ? void 0 : drawers.activeDrawerId, drawers === null || drawers === void 0 ? void 0 : drawers.onChange, isMobile ? false : tools ? defaults.toolsOpen : '', {
91
- componentName: 'AppLayout',
92
- controlledProp: 'activeDrawerId',
93
- changeHandler: 'onChange',
94
- });
95
- const { iconName, getLabels } = togglesConfig.tools;
96
- const { mainLabel, closeLabel, openLabel } = getLabels(ariaLabels);
97
- const toolsItem = {
98
- id: 'tools',
99
- content: tools,
100
- resizable: false,
101
- ariaLabels: {
102
- triggerButton: openLabel,
103
- closeButton: closeLabel,
104
- content: mainLabel,
105
- },
106
- trigger: {
107
- iconName: iconName,
108
- },
109
- };
110
- const getAllDrawerItems = () => {
111
- if (!hasDrawers) {
112
- return;
113
- }
114
- return tools ? [toolsItem, ...drawers.items] : drawers.items;
115
- };
116
- const selectedDrawer = tools && toolsOpen
117
- ? toolsItem
118
- : hasDrawers
119
- ? (_b = getAllDrawerItems()) === null || _b === void 0 ? void 0 : _b.filter((drawerItem) => drawerItem.id === activeDrawerId)[0]
120
- : undefined;
71
+ const _c = useDrawers(props, { ariaLabels, tools, toolsOpen, toolsHide, toolsWidth }, defaults), { drawers, activeDrawer, activeDrawerSize, activeDrawerId, onActiveDrawerChange, onActiveDrawerResize } = _c, drawersProps = __rest(_c, ["drawers", "activeDrawer", "activeDrawerSize", "activeDrawerId", "onActiveDrawerChange", "onActiveDrawerResize"]);
72
+ const hasDrawers = drawers.length > 0;
121
73
  const { refs: navigationRefs, setFocus: focusNavButtons } = useFocusControl(navigationOpen);
122
- const { refs: toolsRefs, setFocus: focusToolsButtons, loseFocus: loseToolsFocus, } = useFocusControl(toolsOpen || selectedDrawer !== undefined, true);
123
- const { refs: drawerRefs, setFocus: focusDrawersButtons, loseFocus: loseDrawersFocus, setLastInteraction: setDrawerLastInteraction, } = useDrawerFocusControl([selectedDrawer === null || selectedDrawer === void 0 ? void 0 : selectedDrawer.resizable], toolsOpen || selectedDrawer !== undefined, true);
74
+ const { refs: toolsRefs, setFocus: focusToolsButtons, loseFocus: loseToolsFocus, } = useFocusControl(toolsOpen || activeDrawer !== undefined, true);
75
+ const { refs: drawerRefs, setFocus: focusDrawersButtons, loseFocus: loseDrawersFocus, setLastInteraction: setDrawerLastInteraction, } = useDrawerFocusControl([activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.resizable], toolsOpen || activeDrawer !== undefined, true);
124
76
  const onNavigationToggle = useCallback((open) => {
125
77
  setNavigationOpen(open);
126
78
  focusNavButtons();
@@ -141,7 +93,6 @@ const OldAppLayout = React.forwardRef((_a, ref) => {
141
93
  const toolsVisible = !toolsHide && toolsOpen;
142
94
  const { contentHeightStyle, headerHeight, footerHeight } = useContentHeight(headerSelector, footerSelector, disableBodyScroll);
143
95
  const [isSplitpanelForcedPosition, setIsSplitpanelForcedPosition] = useState(false);
144
- const [isResizeInvalid, setIsResizeInvalid] = useState(false);
145
96
  const [notificationsHeight, notificationsRef] = useContainerQuery(rect => rect.contentBoxHeight);
146
97
  const anyPanelOpen = navigationVisible || toolsVisible;
147
98
  const hasRenderedNotifications = notificationsHeight ? notificationsHeight > 0 : false;
@@ -156,26 +107,6 @@ const OldAppLayout = React.forwardRef((_a, ref) => {
156
107
  controlledProp: 'splitPanelOpen',
157
108
  changeHandler: 'onSplitPanelToggle',
158
109
  });
159
- const drawerItems = useMemo(() => (drawers === null || drawers === void 0 ? void 0 : drawers.items) || [], [drawers === null || drawers === void 0 ? void 0 : drawers.items]);
160
- const getDrawerItemSizes = useCallback(() => {
161
- const sizes = {};
162
- if (!drawerItems) {
163
- return {};
164
- }
165
- for (const item of drawerItems) {
166
- if (item.defaultSize) {
167
- sizes[item.id] = item.defaultSize || toolsWidth;
168
- }
169
- }
170
- return sizes;
171
- }, [drawerItems, toolsWidth]);
172
- const [drawerSizes, setDrawerSizes] = useState(() => getDrawerItemSizes());
173
- useEffect(() => {
174
- // Ensure we only set new drawer items by performing a shallow merge
175
- // of the latest drawer item sizes, and previous drawer item sizes.
176
- setDrawerSizes(prev => (Object.assign(Object.assign({}, getDrawerItemSizes()), prev)));
177
- }, [getDrawerItemSizes]);
178
- const drawerSize = (selectedDrawer === null || selectedDrawer === void 0 ? void 0 : selectedDrawer.id) && drawerSizes[selectedDrawer === null || selectedDrawer === void 0 ? void 0 : selectedDrawer.id] ? drawerSizes[selectedDrawer === null || selectedDrawer === void 0 ? void 0 : selectedDrawer.id] : toolsWidth;
179
110
  const splitPanelPosition = (splitPanelPreferences === null || splitPanelPreferences === void 0 ? void 0 : splitPanelPreferences.position) || 'bottom';
180
111
  const [splitPanelReportedToggle, setSplitPanelReportedToggle] = useState({
181
112
  displayed: false,
@@ -185,13 +116,13 @@ const OldAppLayout = React.forwardRef((_a, ref) => {
185
116
  const closedDrawerWidth = 40;
186
117
  const effectiveNavigationWidth = navigationHide ? 0 : navigationOpen ? navigationWidth : closedDrawerWidth;
187
118
  const getEffectiveToolsWidth = () => {
188
- if (toolsHide && (!splitPanelDisplayed || (splitPanelPreferences === null || splitPanelPreferences === void 0 ? void 0 : splitPanelPreferences.position) !== 'side') && !drawers) {
119
+ if (toolsHide && (!splitPanelDisplayed || (splitPanelPreferences === null || splitPanelPreferences === void 0 ? void 0 : splitPanelPreferences.position) !== 'side') && drawers.length === 0) {
189
120
  return 0;
190
121
  }
191
- if (selectedDrawer === null || selectedDrawer === void 0 ? void 0 : selectedDrawer.resizable) {
192
- return drawerSize;
122
+ if (activeDrawer && activeDrawerSize) {
123
+ return activeDrawerSize;
193
124
  }
194
- if (toolsOpen || activeDrawerId) {
125
+ if (toolsOpen) {
195
126
  return toolsWidth;
196
127
  }
197
128
  return closedDrawerWidth;
@@ -240,13 +171,12 @@ const OldAppLayout = React.forwardRef((_a, ref) => {
240
171
  return NaN;
241
172
  }
242
173
  // Either use the computed width of the drawer or the drawerSize as defined.
243
- const width = parseInt(getComputedStyle(mainContentRef.current).width || `${drawerSize}`);
174
+ const width = parseInt(getComputedStyle(mainContentRef.current).width || `${activeDrawerSize}`);
244
175
  // when disableContentPaddings is true there is less available space,
245
176
  // so we subtract space-scaled-2x-xxxl * 2 for left and right padding
246
177
  const contentPadding = disableContentPaddings ? 80 : 0;
247
178
  const spaceAvailable = width - defaults.minContentWidth - contentPadding;
248
- const spaceTaken = drawerSize;
249
- return Math.max(0, spaceTaken + spaceAvailable);
179
+ return Math.max(0, activeDrawerSize + spaceAvailable);
250
180
  });
251
181
  const getSplitPanelMaxHeight = useStableCallback(() => {
252
182
  if (typeof document === 'undefined') {
@@ -275,14 +205,14 @@ const OldAppLayout = React.forwardRef((_a, ref) => {
275
205
  effectiveToolsWidth -
276
206
  effectiveNavigationWidth -
277
207
  (disableContentPaddings ? 0 : toggleButtonsBarWidth);
208
+ const isResizeInvalid = isMobile || (defaults.minContentWidth || 0) > contentWidthWithSplitPanel;
278
209
  useEffect(() => {
279
210
  const contentWidth = contentWidthWithSplitPanel - splitPanelSize;
280
211
  setIsSplitpanelForcedPosition(isMobile || (defaults.minContentWidth || 0) > contentWidth);
281
- setIsResizeInvalid(isMobile || (defaults.minContentWidth || 0) > contentWidthWithSplitPanel);
282
212
  // This is a workaround to avoid a forced position due to splitPanelSize, which is
283
213
  // user controlled variable.
284
214
  // eslint-disable-next-line react-hooks/exhaustive-deps
285
- }, [contentWidthWithSplitPanel, drawerSize, defaults.minContentWidth, isMobile]);
215
+ }, [contentWidthWithSplitPanel, activeDrawerSize, defaults.minContentWidth, isMobile]);
286
216
  const navigationClosedWidth = navigationHide || isMobile ? 0 : closedDrawerWidth;
287
217
  const toolsClosedWidth = toolsHide || isMobile || (!hasDrawers && toolsHide) ? 0 : closedDrawerWidth;
288
218
  const contentMaxWidthStyle = !isMobile ? { maxWidth: defaults.maxContentWidth } : undefined;
@@ -293,9 +223,9 @@ const OldAppLayout = React.forwardRef((_a, ref) => {
293
223
  return 0;
294
224
  }
295
225
  if (hasDrawers) {
296
- if (activeDrawerId) {
297
- if (!isResizeInvalid && drawerSize) {
298
- return drawerSize + closedDrawerWidth;
226
+ if (activeDrawer) {
227
+ if (!isResizeInvalid && activeDrawerSize) {
228
+ return activeDrawerSize + closedDrawerWidth;
299
229
  }
300
230
  return toolsWidth + closedDrawerWidth;
301
231
  }
@@ -339,7 +269,7 @@ const OldAppLayout = React.forwardRef((_a, ref) => {
339
269
  // tools padding is displayed in one of the three cases
340
270
  // 1. Nothing on the that screen edge (no tools panel and no split panel)
341
271
  toolsHide ||
342
- (hasDrawers && !activeDrawerId && (!splitPanelDisplayed || finalSplitPanePosition !== 'side')) ||
272
+ (hasDrawers && !activeDrawer && (!splitPanelDisplayed || finalSplitPanePosition !== 'side')) ||
343
273
  // 2. Tools panel is present and open
344
274
  toolsVisible ||
345
275
  // 3. Split panel is open in side position
@@ -355,28 +285,27 @@ const OldAppLayout = React.forwardRef((_a, ref) => {
355
285
  },
356
286
  focusToolsClose: () => focusToolsButtons(true),
357
287
  }), [isMobile, onNavigationToggle, onToolsToggle, focusToolsButtons]);
358
- const splitPanelBottomOffset = (_c = (!splitPanelDisplayed || finalSplitPanePosition !== 'bottom'
288
+ const splitPanelBottomOffset = (_b = (!splitPanelDisplayed || finalSplitPanePosition !== 'bottom'
359
289
  ? undefined
360
290
  : splitPanelOpen
361
291
  ? splitPanelReportedSize
362
- : splitPanelReportedHeaderHeight)) !== null && _c !== void 0 ? _c : undefined;
292
+ : splitPanelReportedHeaderHeight)) !== null && _b !== void 0 ? _b : undefined;
363
293
  const [mobileBarHeight, mobileBarRef] = useContainerQuery(rect => rect.contentBoxHeight);
364
294
  return (React.createElement("div", { className: clsx(styles.root, testutilStyles.root, disableBodyScroll && styles['root-no-scroll']), ref: rootRef },
365
295
  React.createElement("div", { className: styles['layout-wrapper'], style: contentHeightStyle },
366
- isMobile && (!toolsHide || !navigationHide || breadcrumbs) && (React.createElement(MobileToolbar, { anyPanelOpen: anyPanelOpen, toggleRefs: { navigation: navigationRefs.toggle, tools: toolsRefs.toggle }, topOffset: headerHeight, ariaLabels: ariaLabels, navigationHide: navigationHide, toolsHide: toolsHide, onNavigationOpen: () => onNavigationToggle(true), onToolsOpen: () => onToolsToggle(true), unfocusable: anyPanelOpen, mobileBarRef: mobileBarRef, drawers: drawers
296
+ isMobile && (!toolsHide || !navigationHide || breadcrumbs) && (React.createElement(MobileToolbar, { anyPanelOpen: anyPanelOpen, toggleRefs: { navigation: navigationRefs.toggle, tools: toolsRefs.toggle }, topOffset: headerHeight, ariaLabels: ariaLabels, navigationHide: navigationHide, toolsHide: toolsHide, onNavigationOpen: () => onNavigationToggle(true), onToolsOpen: () => onToolsToggle(true), unfocusable: anyPanelOpen, mobileBarRef: mobileBarRef, drawers: hasDrawers
367
297
  ? {
368
- items: tools && !toolsHide ? [toolsItem, ...drawers.items] : drawers.items,
369
- activeDrawerId: selectedDrawer === null || selectedDrawer === void 0 ? void 0 : selectedDrawer.id,
298
+ items: drawers,
299
+ activeDrawerId: activeDrawerId,
370
300
  onChange: changeDetail => {
371
- if ((selectedDrawer === null || selectedDrawer === void 0 ? void 0 : selectedDrawer.id) !== changeDetail.activeDrawerId) {
372
- onToolsToggle(changeDetail.activeDrawerId === 'tools');
301
+ onActiveDrawerChange(changeDetail.activeDrawerId);
302
+ if (changeDetail.activeDrawerId !== activeDrawerId) {
303
+ onToolsToggle(changeDetail.activeDrawerId === TOOLS_DRAWER_ID);
373
304
  focusDrawersButtons();
374
- setActiveDrawerId(changeDetail.activeDrawerId);
375
305
  setDrawerLastInteraction({ type: 'open' });
376
- fireNonCancelableEvent(drawers.onChange, changeDetail.activeDrawerId);
377
306
  }
378
307
  },
379
- ariaLabel: drawers.ariaLabel,
308
+ ariaLabel: drawersProps.ariaLabel,
380
309
  }
381
310
  : undefined }, breadcrumbs)),
382
311
  React.createElement("div", { className: clsx(styles.layout, disableBodyScroll && styles['layout-no-scroll']) },
@@ -416,39 +345,30 @@ const OldAppLayout = React.forwardRef((_a, ref) => {
416
345
  } }, content))),
417
346
  finalSplitPanePosition === 'bottom' && splitPanelWrapped),
418
347
  finalSplitPanePosition === 'side' && (React.createElement(SideSplitPanelDrawer, { topOffset: headerHeight, bottomOffset: footerHeight, displayed: splitPanelDisplayed, width: splitPanelOpen && splitPanel ? splitPanelSize : undefined }, splitPanelWrapped)),
419
- ((hasDrawers && (selectedDrawer === null || selectedDrawer === void 0 ? void 0 : selectedDrawer.id)) || (!hasDrawers && !toolsHide)) &&
420
- (hasDrawers ? (React.createElement(ResizableDrawer, { contentClassName: (selectedDrawer === null || selectedDrawer === void 0 ? void 0 : selectedDrawer.id) === 'tools' ? testutilStyles.tools : testutilStyles['active-drawer'], toggleClassName: testutilStyles['tools-toggle'], closeClassName: (selectedDrawer === null || selectedDrawer === void 0 ? void 0 : selectedDrawer.id) === 'tools'
348
+ ((hasDrawers && activeDrawerId) || (!hasDrawers && !toolsHide)) &&
349
+ (hasDrawers ? (React.createElement(ResizableDrawer, { contentClassName: activeDrawerId === TOOLS_DRAWER_ID ? testutilStyles.tools : testutilStyles['active-drawer'], toggleClassName: testutilStyles['tools-toggle'], closeClassName: activeDrawerId === TOOLS_DRAWER_ID
421
350
  ? testutilStyles['tools-close']
422
- : testutilStyles['active-drawer-close-button'], ariaLabels: ariaLabels, drawersAriaLabels: selectedDrawer === null || selectedDrawer === void 0 ? void 0 : selectedDrawer.ariaLabels, width: !isResizeInvalid ? drawerSize : toolsWidth, bottomOffset: footerHeight, topOffset: headerHeight, isMobile: isMobile, onToggle: onToolsToggle, isOpen: toolsOpen || activeDrawerId !== undefined, toggleRefs: toolsRefs, type: "tools", onLoseFocus: hasDrawers ? loseDrawersFocus : loseToolsFocus, activeDrawer: selectedDrawer, drawers: {
423
- items: tools && !toolsHide ? [toolsItem, ...drawers.items] : drawers.items,
424
- activeDrawerId: selectedDrawer === null || selectedDrawer === void 0 ? void 0 : selectedDrawer.id,
351
+ : testutilStyles['active-drawer-close-button'], ariaLabels: ariaLabels, width: !isResizeInvalid ? activeDrawerSize : toolsWidth, bottomOffset: footerHeight, topOffset: headerHeight, isMobile: isMobile, onToggle: onToolsToggle, isOpen: toolsOpen || activeDrawerId !== undefined, toggleRefs: toolsRefs, type: "tools", onLoseFocus: loseDrawersFocus, activeDrawer: activeDrawer, drawers: {
352
+ items: drawers,
353
+ activeDrawerId: activeDrawerId,
425
354
  onChange: changeDetail => {
426
355
  onToolsToggle(false);
427
356
  setDrawerLastInteraction({ type: 'close' });
428
- setActiveDrawerId(changeDetail.activeDrawerId);
429
- fireNonCancelableEvent(drawers.onChange, changeDetail.activeDrawerId);
357
+ onActiveDrawerChange(changeDetail.activeDrawerId);
430
358
  },
431
- }, size: !isResizeInvalid ? drawerSize : toolsWidth, onResize: changeDetail => {
432
- fireNonCancelableEvent(drawers.onResize, changeDetail);
433
- const drawerItem = drawerItems.find(({ id }) => id === changeDetail.id);
434
- if (drawerItem === null || drawerItem === void 0 ? void 0 : drawerItem.onResize) {
435
- fireNonCancelableEvent(drawerItem.onResize, changeDetail);
436
- }
437
- setDrawerSizes(Object.assign(Object.assign({}, drawerSizes), { [changeDetail.id]: changeDetail.size }));
438
- }, refs: drawerRefs, getMaxWidth: getDrawerMaxWidth }, selectedDrawer === null || selectedDrawer === void 0 ? void 0 : selectedDrawer.content)) : (React.createElement(Drawer, { contentClassName: testutilStyles.tools, toggleClassName: testutilStyles['tools-toggle'], closeClassName: testutilStyles['tools-close'], ariaLabels: ariaLabels, width: effectiveToolsWidth, bottomOffset: footerHeight, topOffset: headerHeight, isMobile: isMobile, onToggle: onToolsToggle, isOpen: toolsOpen, toggleRefs: toolsRefs, type: "tools", onLoseFocus: loseToolsFocus }, tools))),
359
+ }, size: !isResizeInvalid ? activeDrawerSize : toolsWidth, onResize: changeDetail => onActiveDrawerResize(changeDetail), refs: drawerRefs, getMaxWidth: getDrawerMaxWidth }, activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.content)) : (React.createElement(Drawer, { contentClassName: testutilStyles.tools, toggleClassName: testutilStyles['tools-toggle'], closeClassName: testutilStyles['tools-close'], ariaLabels: ariaLabels, width: effectiveToolsWidth, bottomOffset: footerHeight, topOffset: headerHeight, isMobile: isMobile, onToggle: onToolsToggle, isOpen: toolsOpen, toggleRefs: toolsRefs, type: "tools", onLoseFocus: loseToolsFocus }, tools))),
439
360
  hasDrawers && (React.createElement(DrawerTriggersBar, { contentClassName: testutilStyles['drawers-desktop-triggers-container'], toggleClassName: testutilStyles['drawers-trigger'], bottomOffset: footerHeight, topOffset: headerHeight, isMobile: isMobile, drawers: {
440
- items: tools && !toolsHide ? [toolsItem, ...drawers.items] : drawers.items,
441
- activeDrawerId: selectedDrawer === null || selectedDrawer === void 0 ? void 0 : selectedDrawer.id,
361
+ items: drawers,
362
+ activeDrawerId: activeDrawerId,
442
363
  onChange: changeDetail => {
443
- if ((selectedDrawer === null || selectedDrawer === void 0 ? void 0 : selectedDrawer.id) !== changeDetail.activeDrawerId) {
444
- onToolsToggle(changeDetail.activeDrawerId === 'tools');
364
+ if (activeDrawerId !== changeDetail.activeDrawerId) {
365
+ onToolsToggle(changeDetail.activeDrawerId === TOOLS_DRAWER_ID);
445
366
  focusDrawersButtons();
446
- setActiveDrawerId(changeDetail.activeDrawerId);
447
367
  setDrawerLastInteraction({ type: 'open' });
448
- fireNonCancelableEvent(drawers.onChange, changeDetail.activeDrawerId);
449
368
  }
369
+ onActiveDrawerChange(changeDetail.activeDrawerId);
450
370
  },
451
- ariaLabel: drawers.ariaLabel,
371
+ ariaLabel: drawersProps.ariaLabel,
452
372
  } }))))));
453
373
  });
454
374
  applyDisplayName(AppLayout, 'AppLayout');