@cloudscape-design/components-themeable 3.0.252 → 3.0.253

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 (118) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/app-layout/constants.scss +5 -0
  3. package/lib/internal/scss/app-layout/drawer/styles.scss +45 -5
  4. package/lib/internal/scss/app-layout/mobile-toolbar/styles.scss +6 -1
  5. package/lib/internal/scss/app-layout/test-classes/styles.scss +15 -0
  6. package/lib/internal/scss/app-layout/visual-refresh/app-bar.scss +6 -3
  7. package/lib/internal/scss/app-layout/visual-refresh/drawers.scss +151 -0
  8. package/lib/internal/scss/app-layout/visual-refresh/split-panel.scss +1 -1
  9. package/lib/internal/scss/app-layout/visual-refresh/styles.scss +1 -0
  10. package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +31 -30
  11. package/lib/internal/scss/space-between/styles.scss +5 -17
  12. package/lib/internal/template/annotation-context/annotation/styles.css.js +24 -24
  13. package/lib/internal/template/annotation-context/annotation/styles.scoped.css +30 -30
  14. package/lib/internal/template/annotation-context/annotation/styles.selectors.js +24 -24
  15. package/lib/internal/template/app-layout/drawer/index.d.ts +3 -21
  16. package/lib/internal/template/app-layout/drawer/index.d.ts.map +1 -1
  17. package/lib/internal/template/app-layout/drawer/index.js +25 -5
  18. package/lib/internal/template/app-layout/drawer/index.js.map +1 -1
  19. package/lib/internal/template/app-layout/drawer/interfaces.d.ts +84 -0
  20. package/lib/internal/template/app-layout/drawer/interfaces.d.ts.map +1 -0
  21. package/lib/internal/template/app-layout/drawer/interfaces.js +2 -0
  22. package/lib/internal/template/app-layout/drawer/interfaces.js.map +1 -0
  23. package/lib/internal/template/app-layout/drawer/resizable-drawer.d.ts +4 -0
  24. package/lib/internal/template/app-layout/drawer/resizable-drawer.d.ts.map +1 -0
  25. package/lib/internal/template/app-layout/drawer/resizable-drawer.js +51 -0
  26. package/lib/internal/template/app-layout/drawer/resizable-drawer.js.map +1 -0
  27. package/lib/internal/template/app-layout/drawer/styles.css.js +10 -5
  28. package/lib/internal/template/app-layout/drawer/styles.scoped.css +46 -10
  29. package/lib/internal/template/app-layout/drawer/styles.selectors.js +10 -5
  30. package/lib/internal/template/app-layout/index.d.ts.map +1 -1
  31. package/lib/internal/template/app-layout/index.js +142 -17
  32. package/lib/internal/template/app-layout/index.js.map +1 -1
  33. package/lib/internal/template/app-layout/mobile-toolbar/index.d.ts +10 -1
  34. package/lib/internal/template/app-layout/mobile-toolbar/index.d.ts.map +1 -1
  35. package/lib/internal/template/app-layout/mobile-toolbar/index.js +3 -2
  36. package/lib/internal/template/app-layout/mobile-toolbar/index.js.map +1 -1
  37. package/lib/internal/template/app-layout/mobile-toolbar/styles.css.js +5 -4
  38. package/lib/internal/template/app-layout/mobile-toolbar/styles.scoped.css +11 -7
  39. package/lib/internal/template/app-layout/mobile-toolbar/styles.selectors.js +5 -4
  40. package/lib/internal/template/app-layout/notifications/styles.css.js +3 -3
  41. package/lib/internal/template/app-layout/notifications/styles.scoped.css +7 -7
  42. package/lib/internal/template/app-layout/notifications/styles.selectors.js +3 -3
  43. package/lib/internal/template/app-layout/test-classes/styles.css.js +18 -13
  44. package/lib/internal/template/app-layout/test-classes/styles.scoped.css +33 -13
  45. package/lib/internal/template/app-layout/test-classes/styles.selectors.js +18 -13
  46. package/lib/internal/template/app-layout/toggles/index.d.ts.map +1 -1
  47. package/lib/internal/template/app-layout/toggles/index.js +2 -2
  48. package/lib/internal/template/app-layout/toggles/index.js.map +1 -1
  49. package/lib/internal/template/app-layout/toggles/interfaces.d.ts +3 -1
  50. package/lib/internal/template/app-layout/toggles/interfaces.d.ts.map +1 -1
  51. package/lib/internal/template/app-layout/toggles/interfaces.js.map +1 -1
  52. package/lib/internal/template/app-layout/utils/use-drawer-focus-control.d.ts +21 -0
  53. package/lib/internal/template/app-layout/utils/use-drawer-focus-control.d.ts.map +1 -0
  54. package/lib/internal/template/app-layout/utils/use-drawer-focus-control.js +65 -0
  55. package/lib/internal/template/app-layout/utils/use-drawer-focus-control.js.map +1 -0
  56. package/lib/internal/template/app-layout/visual-refresh/app-bar.d.ts.map +1 -1
  57. package/lib/internal/template/app-layout/visual-refresh/app-bar.js +8 -6
  58. package/lib/internal/template/app-layout/visual-refresh/app-bar.js.map +1 -1
  59. package/lib/internal/template/app-layout/visual-refresh/context.d.ts +13 -5
  60. package/lib/internal/template/app-layout/visual-refresh/context.d.ts.map +1 -1
  61. package/lib/internal/template/app-layout/visual-refresh/context.js +104 -49
  62. package/lib/internal/template/app-layout/visual-refresh/context.js.map +1 -1
  63. package/lib/internal/template/app-layout/visual-refresh/drawers.d.ts +47 -0
  64. package/lib/internal/template/app-layout/visual-refresh/drawers.d.ts.map +1 -0
  65. package/lib/internal/template/app-layout/visual-refresh/drawers.js +127 -0
  66. package/lib/internal/template/app-layout/visual-refresh/drawers.js.map +1 -0
  67. package/lib/internal/template/app-layout/visual-refresh/header.js +2 -2
  68. package/lib/internal/template/app-layout/visual-refresh/header.js.map +1 -1
  69. package/lib/internal/template/app-layout/visual-refresh/index.d.ts.map +1 -1
  70. package/lib/internal/template/app-layout/visual-refresh/index.js +3 -1
  71. package/lib/internal/template/app-layout/visual-refresh/index.js.map +1 -1
  72. package/lib/internal/template/app-layout/visual-refresh/layout.d.ts.map +1 -1
  73. package/lib/internal/template/app-layout/visual-refresh/layout.js +5 -42
  74. package/lib/internal/template/app-layout/visual-refresh/layout.js.map +1 -1
  75. package/lib/internal/template/app-layout/visual-refresh/main.d.ts.map +1 -1
  76. package/lib/internal/template/app-layout/visual-refresh/main.js +2 -3
  77. package/lib/internal/template/app-layout/visual-refresh/main.js.map +1 -1
  78. package/lib/internal/template/app-layout/visual-refresh/navigation.js +2 -2
  79. package/lib/internal/template/app-layout/visual-refresh/navigation.js.map +1 -1
  80. package/lib/internal/template/app-layout/visual-refresh/notifications.d.ts.map +1 -1
  81. package/lib/internal/template/app-layout/visual-refresh/notifications.js +2 -2
  82. package/lib/internal/template/app-layout/visual-refresh/notifications.js.map +1 -1
  83. package/lib/internal/template/app-layout/visual-refresh/split-panel.js +2 -2
  84. package/lib/internal/template/app-layout/visual-refresh/split-panel.js.map +1 -1
  85. package/lib/internal/template/app-layout/visual-refresh/styles.css.js +71 -61
  86. package/lib/internal/template/app-layout/visual-refresh/styles.scoped.css +437 -229
  87. package/lib/internal/template/app-layout/visual-refresh/styles.selectors.js +71 -61
  88. package/lib/internal/template/app-layout/visual-refresh/tools.d.ts.map +1 -1
  89. package/lib/internal/template/app-layout/visual-refresh/tools.js +7 -3
  90. package/lib/internal/template/app-layout/visual-refresh/tools.js.map +1 -1
  91. package/lib/internal/template/app-layout/visual-refresh/trigger-button.d.ts +4 -3
  92. package/lib/internal/template/app-layout/visual-refresh/trigger-button.d.ts.map +1 -1
  93. package/lib/internal/template/app-layout/visual-refresh/trigger-button.js +5 -4
  94. package/lib/internal/template/app-layout/visual-refresh/trigger-button.js.map +1 -1
  95. package/lib/internal/template/area-chart/internal.js +1 -1
  96. package/lib/internal/template/area-chart/internal.js.map +1 -1
  97. package/lib/internal/template/flashbar/styles.css.js +45 -45
  98. package/lib/internal/template/flashbar/styles.scoped.css +169 -169
  99. package/lib/internal/template/flashbar/styles.selectors.js +45 -45
  100. package/lib/internal/template/internal/base-component/styles.scoped.css +53 -0
  101. package/lib/internal/template/internal/environment.js +1 -1
  102. package/lib/internal/template/internal/generated/custom-css-properties/index.d.ts.map +1 -1
  103. package/lib/internal/template/internal/generated/custom-css-properties/index.js +31 -30
  104. package/lib/internal/template/internal/generated/custom-css-properties/index.js.map +1 -1
  105. package/lib/internal/template/internal/generated/styles/tokens.d.ts +2 -0
  106. package/lib/internal/template/internal/generated/styles/tokens.js +2 -0
  107. package/lib/internal/template/internal/generated/theming/index.cjs +140 -0
  108. package/lib/internal/template/internal/generated/theming/index.js +140 -0
  109. package/lib/internal/template/mixed-line-bar-chart/internal.js +1 -1
  110. package/lib/internal/template/mixed-line-bar-chart/internal.js.map +1 -1
  111. package/lib/internal/template/pie-chart/index.js +1 -1
  112. package/lib/internal/template/pie-chart/index.js.map +1 -1
  113. package/lib/internal/template/space-between/internal.js +1 -1
  114. package/lib/internal/template/space-between/internal.js.map +1 -1
  115. package/lib/internal/template/space-between/styles.css.js +20 -28
  116. package/lib/internal/template/space-between/styles.scoped.css +37 -101
  117. package/lib/internal/template/space-between/styles.selectors.js +20 -28
  118. package/package.json +1 -1
@@ -2,29 +2,29 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "arrow": "awsui_arrow_1hpp3_1t5h4_93",
6
- "arrow-outer": "awsui_arrow-outer_1hpp3_1t5h4_97",
7
- "arrow-inner": "awsui_arrow-inner_1hpp3_1t5h4_97",
8
- "arrow-position-right-top": "awsui_arrow-position-right-top_1hpp3_1t5h4_128",
9
- "arrow-position-right-bottom": "awsui_arrow-position-right-bottom_1hpp3_1t5h4_128",
10
- "arrow-position-left-top": "awsui_arrow-position-left-top_1hpp3_1t5h4_131",
11
- "arrow-position-left-bottom": "awsui_arrow-position-left-bottom_1hpp3_1t5h4_131",
12
- "arrow-position-top-center": "awsui_arrow-position-top-center_1hpp3_1t5h4_134",
13
- "arrow-position-top-responsive": "awsui_arrow-position-top-responsive_1hpp3_1t5h4_134",
14
- "arrow-position-bottom-center": "awsui_arrow-position-bottom-center_1hpp3_1t5h4_137",
15
- "arrow-position-bottom-responsive": "awsui_arrow-position-bottom-responsive_1hpp3_1t5h4_137",
16
- "annotation": "awsui_annotation_1hpp3_1t5h4_145",
17
- "next-button": "awsui_next-button_1hpp3_1t5h4_146",
18
- "previous-button": "awsui_previous-button_1hpp3_1t5h4_147",
19
- "finish-button": "awsui_finish-button_1hpp3_1t5h4_148",
20
- "header": "awsui_header_1hpp3_1t5h4_149",
21
- "step-counter-content": "awsui_step-counter-content_1hpp3_1t5h4_150",
22
- "content": "awsui_content_1hpp3_1t5h4_151",
23
- "description": "awsui_description_1hpp3_1t5h4_155",
24
- "actionBar": "awsui_actionBar_1hpp3_1t5h4_160",
25
- "stepCounter": "awsui_stepCounter_1hpp3_1t5h4_167",
26
- "divider": "awsui_divider_1hpp3_1t5h4_171",
27
- "hotspot": "awsui_hotspot_1hpp3_1t5h4_175",
28
- "icon": "awsui_icon_1hpp3_1t5h4_215"
5
+ "arrow": "awsui_arrow_1hpp3_1umef_93",
6
+ "arrow-outer": "awsui_arrow-outer_1hpp3_1umef_97",
7
+ "arrow-inner": "awsui_arrow-inner_1hpp3_1umef_97",
8
+ "arrow-position-right-top": "awsui_arrow-position-right-top_1hpp3_1umef_128",
9
+ "arrow-position-right-bottom": "awsui_arrow-position-right-bottom_1hpp3_1umef_128",
10
+ "arrow-position-left-top": "awsui_arrow-position-left-top_1hpp3_1umef_131",
11
+ "arrow-position-left-bottom": "awsui_arrow-position-left-bottom_1hpp3_1umef_131",
12
+ "arrow-position-top-center": "awsui_arrow-position-top-center_1hpp3_1umef_134",
13
+ "arrow-position-top-responsive": "awsui_arrow-position-top-responsive_1hpp3_1umef_134",
14
+ "arrow-position-bottom-center": "awsui_arrow-position-bottom-center_1hpp3_1umef_137",
15
+ "arrow-position-bottom-responsive": "awsui_arrow-position-bottom-responsive_1hpp3_1umef_137",
16
+ "annotation": "awsui_annotation_1hpp3_1umef_145",
17
+ "next-button": "awsui_next-button_1hpp3_1umef_146",
18
+ "previous-button": "awsui_previous-button_1hpp3_1umef_147",
19
+ "finish-button": "awsui_finish-button_1hpp3_1umef_148",
20
+ "header": "awsui_header_1hpp3_1umef_149",
21
+ "step-counter-content": "awsui_step-counter-content_1hpp3_1umef_150",
22
+ "content": "awsui_content_1hpp3_1umef_151",
23
+ "description": "awsui_description_1hpp3_1umef_155",
24
+ "actionBar": "awsui_actionBar_1hpp3_1umef_160",
25
+ "stepCounter": "awsui_stepCounter_1hpp3_1umef_167",
26
+ "divider": "awsui_divider_1hpp3_1umef_171",
27
+ "hotspot": "awsui_hotspot_1hpp3_1umef_175",
28
+ "icon": "awsui_icon_1hpp3_1umef_215"
29
29
  };
30
30
 
@@ -1,23 +1,5 @@
1
1
  import React from 'react';
2
- import { togglesConfig } from '../toggles';
3
- import { AppLayoutProps } from '../interfaces';
4
- import { FocusControlRefs } from '../utils/use-focus-control';
5
- export interface DesktopDrawerProps {
6
- contentClassName: string;
7
- toggleClassName: string;
8
- closeClassName: string;
9
- toggleRefs: FocusControlRefs;
10
- width: number;
11
- topOffset: number | undefined;
12
- bottomOffset: number | undefined;
13
- ariaLabels: AppLayoutProps.Labels | undefined;
14
- children: React.ReactNode;
15
- type: keyof typeof togglesConfig;
16
- isMobile: boolean;
17
- isOpen: boolean;
18
- onToggle: (isOpen: boolean) => void;
19
- onClick?: (event: React.MouseEvent) => void;
20
- onLoseFocus?: (event: React.FocusEvent) => void;
21
- }
22
- export declare function Drawer({ contentClassName, toggleClassName, closeClassName, width, type, toggleRefs, topOffset, bottomOffset, ariaLabels, children, isOpen, isMobile, onToggle, onClick, onLoseFocus, }: DesktopDrawerProps): JSX.Element;
2
+ import { DesktopDrawerProps, DrawerTriggersBarProps } from './interfaces';
3
+ export declare const Drawer: React.ForwardRefExoticComponent<DesktopDrawerProps & React.RefAttributes<HTMLDivElement>>;
4
+ export declare function DrawerTriggersBar({ isMobile, topOffset, bottomOffset, drawers, contentClassName, }: DrawerTriggersBarProps): JSX.Element;
23
5
  //# sourceMappingURL=index.d.ts.map
@@ -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;AACtC,OAAO,EAAgC,aAAa,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB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les from './styles.css.js';
21
21
  // * https://github.com/nvaccess/nvda/issues/5825
22
22
  // * https://github.com/nvaccess/nvda/issues/5247
23
23
  // * https://github.com/nvaccess/nvda/pull/8869 (reverted PR that was going to fix it)
24
- export function Drawer({ contentClassName, toggleClassName, closeClassName, width, type, toggleRefs, topOffset, bottomOffset, ariaLabels, children, isOpen, isMobile, onToggle, onClick, onLoseFocus, }) {
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
+ const openButtonWrapperRef = useRef(null);
25
26
  const { TagName, iconName, getLabels } = togglesConfig[type];
26
27
  const { mainLabel, closeLabel, openLabel } = getLabels(ariaLabels);
27
28
  const drawerContentWidthOpen = isMobile ? undefined : width;
28
29
  const drawerContentWidth = isOpen ? drawerContentWidthOpen : undefined;
29
- const openButtonWrapperRef = useRef(null);
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);
30
36
  const regularOpenButton = (React.createElement(TagName, { ref: openButtonWrapperRef, "aria-label": mainLabel, className: styles.toggle, "aria-hidden": isOpen },
31
37
  React.createElement(AppLayoutButton, { ref: toggleRefs.toggle, className: toggleClassName, iconName: iconName, ariaLabel: openLabel, onClick: () => onToggle(true), ariaExpanded: false })));
32
- return (React.createElement("div", { className: clsx(styles.drawer, {
38
+ return (React.createElement("div", { ref: ref, className: clsx(styles.drawer, {
33
39
  [styles['drawer-closed']]: !isOpen,
34
40
  [testutilStyles['drawer-closed']]: !isOpen,
35
41
  [styles['drawer-mobile']]: isMobile,
@@ -54,8 +60,22 @@ export function Drawer({ contentClassName, toggleClassName, closeClassName, widt
54
60
  } },
55
61
  React.createElement("div", { style: { width: drawerContentWidth, top: topOffset, bottom: bottomOffset }, className: clsx(styles['drawer-content'], contentClassName) },
56
62
  !isMobile && regularOpenButton,
57
- React.createElement(TagName, { "aria-label": mainLabel, "aria-hidden": !isOpen },
58
- React.createElement(CloseButton, { ref: toggleRefs.close, className: closeClassName, ariaLabel: closeLabel, onClick: () => onToggle(false) }),
63
+ 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: () => {
66
+ onToggle(false);
67
+ drawers === null || drawers === void 0 ? void 0 : drawers.onChange({ activeDrawerId: undefined });
68
+ } }),
59
69
  children))));
70
+ });
71
+ export function DrawerTriggersBar({ isMobile, topOffset, bottomOffset, drawers, contentClassName, }) {
72
+ var _a;
73
+ return (React.createElement("div", { className: clsx(styles.drawer, styles['drawer-closed'], testutilStyles['drawer-closed'], {
74
+ [styles['drawer-mobile']]: isMobile,
75
+ }) },
76
+ React.createElement("div", { style: { top: topOffset, bottom: bottomOffset }, className: clsx(styles['drawer-content'], styles['non-interactive'], contentClassName) }, !isMobile && (React.createElement("aside", { "aria-label": drawers === null || drawers === void 0 ? void 0 : drawers.ariaLabel, className: styles['drawer-triggers'] }, (_a = drawers === null || drawers === void 0 ? void 0 : drawers.items) === null || _a === void 0 ? void 0 : _a.map((item, index) => {
77
+ var _a;
78
+ return (React.createElement(AppLayoutButton, { className: clsx(styles.trigger, styles['trigger-drawer'], drawers.activeDrawerId === item.id && styles.selected), key: `drawer-trigger-${index}`, iconName: item.trigger.iconName, iconSvg: item.trigger.iconSvg, ariaLabel: (_a = item.ariaLabels) === null || _a === void 0 ? void 0 : _a.triggerButton, onClick: () => drawers.onChange({ activeDrawerId: item.id }), ariaExpanded: drawers.activeDrawerId !== undefined }));
79
+ }))))));
60
80
  }
61
81
  //# sourceMappingURL=index.js.map
@@ -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,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEzE,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAqBrC,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;AAEtF,MAAM,UAAU,MAAM,CAAC,EACrB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,KAAK,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,WAAW,GACQ;IACnB,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IAC7D,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IACnE,MAAM,sBAAsB,GAAG,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;IAC5D,MAAM,kBAAkB,GAAG,MAAM,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,C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A,MAAA,oBAAoB,CAAC,OAAO,0CAAE,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,CAAA,EAC7D;oBACA,QAAQ,CAAC,IAAI,CAAC,CAAC;iBAChB;aACF;QACH,CAAC;QAED,6BACE,KAAK,EAAE,EAAE,KAAK,EAAE,kBAAkB,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,EAC1E,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;YAE1D,CAAC,QAAQ,IAAI,iBAAiB;YAC/B,oBAAC,OAAO,kBAAa,SAAS,iBAAe,CAAC,MAAM;gBAClD,oBAAC,WAAW,IACV,GAAG,EAAE,UAAU,CAAC,KAAK,EACrB,SAAS,EAAE,cAAc,EACzB,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAC9B;gBACD,QAAQ,CACD,CACN,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 { AppLayoutButton, CloseButton, togglesConfig } from '../toggles';\nimport { AppLayoutProps } from '../interfaces';\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from './styles.css.js';\nimport { FocusControlRefs } from '../utils/use-focus-control';\n\nexport interface DesktopDrawerProps {\n contentClassName: string;\n toggleClassName: string;\n closeClassName: string;\n toggleRefs: FocusControlRefs;\n width: number;\n topOffset: number | undefined;\n bottomOffset: number | undefined;\n ariaLabels: AppLayoutProps.Labels | 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}\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)\n\nexport function Drawer({\n contentClassName,\n toggleClassName,\n closeClassName,\n width,\n type,\n toggleRefs,\n topOffset,\n bottomOffset,\n ariaLabels,\n children,\n isOpen,\n isMobile,\n onToggle,\n onClick,\n onLoseFocus,\n}: DesktopDrawerProps) {\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 const openButtonWrapperRef = useRef<HTMLElement | null>(null);\n\n const regularOpenButton = (\n <TagName ref={openButtonWrapperRef} aria-label={mainLabel} className={styles.toggle} aria-hidden={isOpen}>\n <AppLayoutButton\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 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\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'], contentClassName)}\n >\n {!isMobile && regularOpenButton}\n <TagName aria-label={mainLabel} aria-hidden={!isOpen}>\n <CloseButton\n ref={toggleRefs.close}\n className={closeClassName}\n ariaLabel={closeLabel}\n onClick={() => onToggle(false)}\n />\n {children}\n </TagName>\n </div>\n </div>\n );\n}\n"]}
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,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEzE,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,MAA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IACd,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,gBAAgB,CAAC,EACxB,OAAO,CAAC,cAAc,KAAK,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,QAAQ,CACtD,EACD,GAAG,EAAE,kBAAkB,KAAK,EAAE,EAC9B,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,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,EAC5D,YAAY,EAAE,OAAO,CAAC,cAAc,KAAK,SAAS,GAClD,CACH,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 { AppLayoutButton, 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 <AppLayoutButton\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'], 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}: 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\n style={{ top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], styles['non-interactive'], contentClassName)}\n >\n {!isMobile && (\n <aside aria-label={drawers?.ariaLabel} className={styles['drawer-triggers']}>\n {drawers?.items?.map((item: DrawerItem, index: number) => (\n <AppLayoutButton\n className={clsx(\n styles.trigger,\n styles['trigger-drawer'],\n drawers.activeDrawerId === item.id && styles.selected\n )}\n key={`drawer-trigger-${index}`}\n iconName={item.trigger.iconName}\n iconSvg={item.trigger.iconSvg}\n ariaLabel={item.ariaLabels?.triggerButton}\n onClick={() => drawers.onChange({ activeDrawerId: item.id })}\n ariaExpanded={drawers.activeDrawerId !== undefined}\n />\n ))}\n </aside>\n )}\n </div>\n </div>\n );\n}\n"]}
@@ -0,0 +1,84 @@
1
+ import React from 'react';
2
+ import { ButtonProps } from '../../button/interfaces';
3
+ import { togglesConfig } from '../toggles';
4
+ import { AppLayoutProps } from '../interfaces';
5
+ import { IconProps } from '../../icon/interfaces';
6
+ import { DrawerFocusControlRefs } from '../utils/use-drawer-focus-control';
7
+ export interface DesktopDrawerProps {
8
+ contentClassName: string;
9
+ toggleClassName: string;
10
+ closeClassName: string;
11
+ toggleRefs: {
12
+ toggle: React.Ref<ButtonProps.Ref>;
13
+ close: React.Ref<ButtonProps.Ref>;
14
+ };
15
+ width: number;
16
+ topOffset: number | undefined;
17
+ bottomOffset: number | undefined;
18
+ ariaLabels: AppLayoutProps.Labels | undefined;
19
+ drawersAriaLabels?: DrawerItemAriaLabels | undefined;
20
+ children: React.ReactNode;
21
+ type: keyof typeof togglesConfig;
22
+ isMobile: boolean;
23
+ isOpen: boolean;
24
+ onToggle: (isOpen: boolean) => void;
25
+ onClick?: (event: React.MouseEvent) => void;
26
+ onLoseFocus?: (event: React.FocusEvent) => void;
27
+ drawers?: {
28
+ items: Array<DrawerItem>;
29
+ activeDrawerId: string | undefined;
30
+ onChange: (changeDetail: {
31
+ activeDrawerId: string | undefined;
32
+ }) => void;
33
+ };
34
+ resizeHandle?: React.ReactNode;
35
+ }
36
+ export interface ResizableDrawerProps extends DesktopDrawerProps {
37
+ activeDrawer: DrawerItem;
38
+ onResize: (resizeDetail: {
39
+ size: number;
40
+ id: string;
41
+ }) => void;
42
+ size: number;
43
+ getMaxWidth: () => number;
44
+ refs: DrawerFocusControlRefs;
45
+ }
46
+ export interface DrawerTriggersBarProps {
47
+ contentClassName: string;
48
+ topOffset: number | undefined;
49
+ bottomOffset: number | undefined;
50
+ isMobile: boolean;
51
+ drawers?: {
52
+ items: Array<DrawerItem>;
53
+ activeDrawerId: string | undefined;
54
+ onChange: (changeDetail: {
55
+ activeDrawerId: string | undefined;
56
+ }) => void;
57
+ ariaLabel: string;
58
+ };
59
+ }
60
+ export interface DrawerItemAriaLabels {
61
+ content?: string;
62
+ closeButton?: string;
63
+ triggerButton?: string;
64
+ resizeHandle?: string;
65
+ }
66
+ export interface DrawerItem {
67
+ id: string;
68
+ content: React.ReactNode;
69
+ trigger: {
70
+ iconName?: IconProps.Name;
71
+ iconSvg?: React.ReactNode;
72
+ };
73
+ ariaLabels: DrawerItemAriaLabels;
74
+ resizable?: boolean;
75
+ size?: number;
76
+ }
77
+ export interface SizeControlProps {
78
+ position: 'side';
79
+ splitPanelRef?: React.RefObject<HTMLDivElement>;
80
+ handleRef?: React.RefObject<HTMLDivElement>;
81
+ setSidePanelWidth: (width: number) => void;
82
+ setBottomPanelHeight: (height: number) => void;
83
+ }
84
+ //# sourceMappingURL=interfaces.d.ts.map
@@ -0,0 +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,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,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,WAAW,CAAC,GAAG,CAAC,CAAC;QACnC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;KACnC,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,EAAE,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC;IAC9C,iBAAiB,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;IACrD,QAAQ,EAAE,KAA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E,CAAC,YAAY,EAAE;YAAE,cAAc,EAAE,MAAM,GAAG,SAAS,CAAA;SAAE,KAAK,IAAI,CAAC;QACzE,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;QAC1B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;KAC3B,CAAC;IACF,UAAU,EAAE,oBAAoB,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAChD,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;CAChD"}
@@ -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/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 { ButtonProps } from '../../button/interfaces';\nimport { togglesConfig } from '../toggles';\nimport { AppLayoutProps } from '../interfaces';\nimport { IconProps } from '../../icon/interfaces';\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<ButtonProps.Ref>;\n close: React.Ref<ButtonProps.Ref>;\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 topOffset: number | undefined;\n bottomOffset: number | undefined;\n isMobile: boolean;\n drawers?: {\n items: Array<DrawerItem>;\n activeDrawerId: string | undefined;\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 size?: number;\n}\n\nexport interface SizeControlProps {\n position: 'side';\n splitPanelRef?: React.RefObject<HTMLDivElement>;\n handleRef?: React.RefObject<HTMLDivElement>;\n setSidePanelWidth: (width: number) => void;\n setBottomPanelHeight: (height: number) => void;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { ResizableDrawerProps } from './interfaces';
3
+ export declare const ResizableDrawer: ({ onResize, size, getMaxWidth, refs, activeDrawer, ...props }: ResizableDrawerProps) => JSX.Element;
4
+ //# sourceMappingURL=resizable-drawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resizable-drawer.d.ts","sourceRoot":"lib/default/","sources":["app-layout/drawer/resizable-drawer.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAoB,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEtE,eAAO,MAAM,eAAe,kEAOzB,oBAAoB,gBAsEtB,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { __rest } from "tslib";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ import clsx from 'clsx';
5
+ import React, { useEffect, useState, useRef } from 'react';
6
+ import { getLimitedValue } from '../../split-panel/utils/size-utils';
7
+ import { usePointerEvents } from '../../split-panel/utils/use-pointer-events';
8
+ import { useKeyboardEvents } from '../../split-panel/utils/use-keyboard-events';
9
+ import { Drawer } from './index';
10
+ import ResizeHandler from '../../split-panel/icons/resize-handler';
11
+ import splitPanelStyles from '../../split-panel/styles.css.js';
12
+ export const ResizableDrawer = (_a) => {
13
+ var { onResize, size, getMaxWidth, refs, activeDrawer } = _a, props = __rest(_a, ["onResize", "size", "getMaxWidth", "refs", "activeDrawer"]);
14
+ const { isOpen, children, isMobile } = props;
15
+ const MIN_WIDTH = (activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.size) && activeDrawer.size < 280 ? activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.size : 280;
16
+ const [relativeSize, setRelativeSize] = useState(0);
17
+ useEffect(() => {
18
+ // effects are called inside out in the components tree
19
+ // wait one frame to allow app-layout to complete its calculations
20
+ const handle = requestAnimationFrame(() => {
21
+ const maxSize = getMaxWidth();
22
+ setRelativeSize((size / maxSize) * 100);
23
+ });
24
+ return () => cancelAnimationFrame(handle);
25
+ }, [size, getMaxWidth]);
26
+ const setSidePanelWidth = (width) => {
27
+ const maxWidth = getMaxWidth();
28
+ const size = getLimitedValue(MIN_WIDTH, width, maxWidth);
29
+ const id = activeDrawer.id;
30
+ if (isOpen && maxWidth >= MIN_WIDTH) {
31
+ onResize({ size, id });
32
+ }
33
+ };
34
+ const position = 'side';
35
+ const setBottomPanelHeight = () => { };
36
+ const drawerRefObject = useRef(null);
37
+ const sizeControlProps = {
38
+ position,
39
+ splitPanelRef: drawerRefObject,
40
+ handleRef: refs.slider,
41
+ setSidePanelWidth,
42
+ setBottomPanelHeight,
43
+ };
44
+ const onSliderPointerDown = usePointerEvents(sizeControlProps);
45
+ const onKeyDown = useKeyboardEvents(sizeControlProps);
46
+ const resizeHandle = (React.createElement("div", { ref: refs.slider, role: "slider", tabIndex: 0, "aria-label": activeDrawer.ariaLabels.resizeHandle, "aria-valuemax": 100, "aria-valuemin": 0, "aria-valuenow": relativeSize, className: clsx(splitPanelStyles.slider, splitPanelStyles[`slider-side`]), onKeyDown: onKeyDown, onPointerDown: onSliderPointerDown },
47
+ React.createElement(ResizeHandler, { className: clsx(splitPanelStyles['slider-icon'], splitPanelStyles[`slider-icon-side`]) })));
48
+ return (React.createElement(Drawer, Object.assign({}, props, { ref: drawerRefObject, resizeHandle: !isMobile &&
49
+ activeDrawer.resizable && React.createElement("div", { className: splitPanelStyles['slider-wrapper-side'] }, resizeHandle) }), children));
50
+ };
51
+ //# sourceMappingURL=resizable-drawer.js.map
@@ -0,0 +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,CAA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,CAAC,kBAAkB,CAAC,CAAC,GAAI,CACrG,CACP,CAAC;IAEF,OAAO,CACL,oBAAC,MAAM,oBACD,KAAK,IACT,GAAG,EAAE,eAAe,EACpB,YAAY,EACV,CAAC,QAAQ;YACT,YAAY,CAAC,SAAS,IAAI,6BAAK,SAAS,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,IAAG,YAAY,CAAO,KAGxG,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 '../../split-panel/utils/use-pointer-events';\nimport { useKeyboardEvents } from '../../split-panel/utils/use-keyboard-events';\nimport { Drawer } from './index';\n\nimport ResizeHandler from '../../split-panel/icons/resize-handler';\nimport splitPanelStyles from '../../split-panel/styles.css.js';\nimport { SizeControlProps, 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?.size && activeDrawer.size < 280 ? activeDrawer?.size : 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 && 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 splitPanelRef: 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`])}\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,10 +1,15 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "toggle": "awsui_toggle_1uo6m_cnce0_97",
5
- "drawer": "awsui_drawer_1uo6m_cnce0_102",
6
- "drawer-mobile": "awsui_drawer-mobile_1uo6m_cnce0_108",
7
- "drawer-closed": "awsui_drawer-closed_1uo6m_cnce0_111",
8
- "drawer-content": "awsui_drawer-content_1uo6m_cnce0_119"
4
+ "toggle": "awsui_toggle_1uo6m_mpf8p_97",
5
+ "drawer-triggers": "awsui_drawer-triggers_1uo6m_mpf8p_102",
6
+ "drawer": "awsui_drawer_1uo6m_mpf8p_102",
7
+ "drawer-mobile": "awsui_drawer-mobile_1uo6m_mpf8p_112",
8
+ "drawer-closed": "awsui_drawer-closed_1uo6m_mpf8p_115",
9
+ "drawer-content": "awsui_drawer-content_1uo6m_mpf8p_123",
10
+ "non-interactive": "awsui_non-interactive_1uo6m_mpf8p_141",
11
+ "trigger": "awsui_trigger_1uo6m_mpf8p_149",
12
+ "trigger-drawer": "awsui_trigger-drawer_1uo6m_mpf8p_158",
13
+ "selected": "awsui_selected_1uo6m_mpf8p_158"
9
14
  };
10
15
 
@@ -94,46 +94,82 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
94
94
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
95
95
  SPDX-License-Identifier: Apache-2.0
96
96
  */
97
- .awsui_toggle_1uo6m_cnce0_97:not(#\9) {
97
+ .awsui_toggle_1uo6m_mpf8p_97:not(#\9) {
98
98
  box-sizing: border-box;
99
99
  padding: var(--space-xxs-ynfts5, 4px) 7px;
100
100
  }
101
101
 
102
- .awsui_drawer_1uo6m_cnce0_102:not(#\9) {
102
+ .awsui_drawer-triggers_1uo6m_mpf8p_102:not(#\9) {
103
+ box-sizing: border-box;
104
+ }
105
+
106
+ .awsui_drawer_1uo6m_mpf8p_102:not(#\9) {
103
107
  flex-shrink: 0;
104
108
  position: relative;
105
109
  word-wrap: break-word;
106
110
  box-shadow: var(--shadow-panel-v9vx7i, 0 1px 1px 0 rgba(0, 28, 36, 0.3), 1px 1px 1px 0 rgba(0, 28, 36, 0.15), -1px 1px 1px 0 rgba(0, 28, 36, 0.15));
107
111
  }
108
- .awsui_drawer_1uo6m_cnce0_102:not(#\9):not(.awsui_drawer-mobile_1uo6m_cnce0_108) {
112
+ .awsui_drawer_1uo6m_mpf8p_102:not(#\9):not(.awsui_drawer-mobile_1uo6m_mpf8p_112) {
109
113
  z-index: 830;
110
114
  }
111
- .awsui_drawer-closed_1uo6m_cnce0_111:not(#\9) {
115
+ .awsui_drawer-closed_1uo6m_mpf8p_115:not(#\9) {
112
116
  min-width: 40px;
113
117
  cursor: pointer;
114
118
  }
115
- .awsui_drawer-closed_1uo6m_cnce0_111.awsui_drawer-mobile_1uo6m_cnce0_108:not(#\9) {
119
+ .awsui_drawer-closed_1uo6m_mpf8p_115.awsui_drawer-mobile_1uo6m_mpf8p_112:not(#\9) {
116
120
  display: none;
117
121
  }
118
122
 
119
- .awsui_drawer-content_1uo6m_cnce0_119:not(#\9) {
123
+ .awsui_drawer-content_1uo6m_mpf8p_123:not(#\9) {
120
124
  position: fixed;
121
125
  overflow: auto;
122
126
  background-color: var(--color-background-layout-panel-content-r9pdjh, #ffffff);
123
127
  }
124
- .awsui_drawer-mobile_1uo6m_cnce0_108 > .awsui_drawer-content_1uo6m_cnce0_119:not(#\9) {
128
+ .awsui_drawer-mobile_1uo6m_mpf8p_112 > .awsui_drawer-content_1uo6m_mpf8p_123:not(#\9) {
125
129
  z-index: 1001;
126
130
  top: 0;
127
131
  bottom: 0;
128
132
  left: 0;
129
133
  right: 0;
130
134
  }
131
- .awsui_drawer-closed_1uo6m_cnce0_111 > .awsui_drawer-content_1uo6m_cnce0_119:not(#\9) {
135
+ .awsui_drawer-closed_1uo6m_mpf8p_115 > .awsui_drawer-content_1uo6m_mpf8p_123:not(#\9) {
132
136
  width: 40px;
133
137
  }
134
- .awsui_drawer-closed_1uo6m_cnce0_111 > .awsui_drawer-content_1uo6m_cnce0_119:not(#\9):hover {
138
+ .awsui_drawer-closed_1uo6m_mpf8p_115 > .awsui_drawer-content_1uo6m_mpf8p_123:not(#\9):hover {
135
139
  background: var(--color-background-layout-panel-hover-thdv3z, #eaeded);
136
140
  }
137
- .awsui_drawer-content_1uo6m_cnce0_119 > [aria-hidden=true]:not(#\9) {
141
+ .awsui_drawer-closed_1uo6m_mpf8p_115 > .awsui_drawer-content_1uo6m_mpf8p_123.awsui_non-interactive_1uo6m_mpf8p_141:not(#\9):hover {
142
+ background: var(--color-background-layout-panel-content-r9pdjh, #ffffff);
143
+ cursor: default;
144
+ }
145
+ .awsui_drawer-content_1uo6m_mpf8p_123 > [aria-hidden=true]:not(#\9) {
138
146
  display: none;
147
+ }
148
+
149
+ .awsui_drawer-triggers_1uo6m_mpf8p_102 > .awsui_trigger_1uo6m_mpf8p_149:not(#\9) {
150
+ padding: var(--space-scaled-xs-6859qs, 8px) 6px;
151
+ margin: 1px 6px;
152
+ border-radius: 0;
153
+ border: 0;
154
+ }
155
+ .awsui_drawer-triggers_1uo6m_mpf8p_102 > .awsui_trigger_1uo6m_mpf8p_149:not(#\9):not(:last-child) {
156
+ box-shadow: 0px 1px var(--color-shadow-layout-panel-trigger-lceo1i, #d5dbdb);
157
+ }
158
+ .awsui_drawer-triggers_1uo6m_mpf8p_102 > .awsui_trigger-drawer_1uo6m_mpf8p_158:not(#\9):hover:not(.awsui_selected_1uo6m_mpf8p_158) {
159
+ color: var(--color-text-layout-panel-trigger-hover-5qaiq9, #0073bb);
160
+ }
161
+ .awsui_drawer-triggers_1uo6m_mpf8p_102 > .awsui_trigger-drawer_1uo6m_mpf8p_158:not(#\9):hover:not(.awsui_selected_1uo6m_mpf8p_158):not(:last-child) {
162
+ box-shadow: 0px 1px var(--color-shadow-layout-panel-trigger-lceo1i, #d5dbdb);
163
+ }
164
+ .awsui_drawer-triggers_1uo6m_mpf8p_102 > .awsui_trigger_1uo6m_mpf8p_149.awsui_selected_1uo6m_mpf8p_158:not(#\9) {
165
+ padding: var(--space-scaled-xs-6859qs, 8px) var(--space-s-hv8c1d, 12px);
166
+ margin: 0;
167
+ border-top: 1px solid var(--color-background-layout-panel-trigger-active-opo2jh, #0073bb);
168
+ border-bottom: 1px solid var(--color-background-layout-panel-trigger-active-opo2jh, #0073bb);
169
+ background-color: var(--color-background-layout-panel-trigger-active-opo2jh, #0073bb);
170
+ color: var(--color-text-layout-panel-trigger-active-km1y5a, #ffffff);
171
+ box-shadow: none;
172
+ }
173
+ .awsui_drawer-triggers_1uo6m_mpf8p_102 > .awsui_trigger_1uo6m_mpf8p_149.awsui_selected_1uo6m_mpf8p_158:not(#\9):hover {
174
+ cursor: default;
139
175
  }
@@ -2,10 +2,15 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "toggle": "awsui_toggle_1uo6m_cnce0_97",
6
- "drawer": "awsui_drawer_1uo6m_cnce0_102",
7
- "drawer-mobile": "awsui_drawer-mobile_1uo6m_cnce0_108",
8
- "drawer-closed": "awsui_drawer-closed_1uo6m_cnce0_111",
9
- "drawer-content": "awsui_drawer-content_1uo6m_cnce0_119"
5
+ "toggle": "awsui_toggle_1uo6m_mpf8p_97",
6
+ "drawer-triggers": "awsui_drawer-triggers_1uo6m_mpf8p_102",
7
+ "drawer": "awsui_drawer_1uo6m_mpf8p_102",
8
+ "drawer-mobile": "awsui_drawer-mobile_1uo6m_mpf8p_112",
9
+ "drawer-closed": "awsui_drawer-closed_1uo6m_mpf8p_115",
10
+ "drawer-content": "awsui_drawer-content_1uo6m_mpf8p_123",
11
+ "non-interactive": "awsui_non-interactive_1uo6m_mpf8p_141",
12
+ "trigger": "awsui_trigger_1uo6m_mpf8p_149",
13
+ "trigger-drawer": "awsui_trigger-drawer_1uo6m_mpf8p_158",
14
+ "selected": "awsui_selected_1uo6m_mpf8p_158"
10
15
  };
11
16
 
@@ -1 +1 @@
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;AAqC9C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,QAAA,MAAM,SAAS,2FA8Bd,CAAC;AAgeF,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;AAyC9C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,QAAA,MAAM,SAAS,2FA8Bd,CAAC;AAsqBF,eAAe,SAAS,CAAC"}