@cloudscape-design/components 3.0.1074 → 3.0.1076

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 (113) hide show
  1. package/app-layout/interfaces.d.ts +1 -0
  2. package/app-layout/interfaces.d.ts.map +1 -1
  3. package/app-layout/interfaces.js.map +1 -1
  4. package/app-layout/runtime-drawer/index.d.ts +9 -0
  5. package/app-layout/runtime-drawer/index.d.ts.map +1 -1
  6. package/app-layout/runtime-drawer/index.js +32 -3
  7. package/app-layout/runtime-drawer/index.js.map +1 -1
  8. package/app-layout/runtime-drawer/styles.css.js +2 -1
  9. package/app-layout/runtime-drawer/styles.scoped.css +5 -1
  10. package/app-layout/runtime-drawer/styles.selectors.js +2 -1
  11. package/app-layout/test-classes/styles.css.js +26 -24
  12. package/app-layout/test-classes/styles.scoped.css +26 -24
  13. package/app-layout/test-classes/styles.selectors.js +26 -24
  14. package/app-layout/utils/interfaces.d.ts +1 -1
  15. package/app-layout/utils/interfaces.d.ts.map +1 -1
  16. package/app-layout/utils/interfaces.js.map +1 -1
  17. package/app-layout/utils/use-ai-drawer.d.ts +33 -0
  18. package/app-layout/utils/use-ai-drawer.d.ts.map +1 -0
  19. package/app-layout/utils/use-ai-drawer.js +104 -0
  20. package/app-layout/utils/use-ai-drawer.js.map +1 -0
  21. package/app-layout/utils/use-keyboard-events.js +8 -8
  22. package/app-layout/utils/use-keyboard-events.js.map +1 -1
  23. package/app-layout/utils/use-pointer-events.d.ts.map +1 -1
  24. package/app-layout/utils/use-pointer-events.js +8 -0
  25. package/app-layout/utils/use-pointer-events.js.map +1 -1
  26. package/app-layout/visual-refresh-toolbar/compute-layout.d.ts +4 -1
  27. package/app-layout/visual-refresh-toolbar/compute-layout.d.ts.map +1 -1
  28. package/app-layout/visual-refresh-toolbar/compute-layout.js +6 -2
  29. package/app-layout/visual-refresh-toolbar/compute-layout.js.map +1 -1
  30. package/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.d.ts +35 -0
  31. package/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.d.ts.map +1 -0
  32. package/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js +81 -0
  33. package/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js.map +1 -0
  34. package/app-layout/visual-refresh-toolbar/drawer/global-drawer.d.ts.map +1 -1
  35. package/app-layout/visual-refresh-toolbar/drawer/global-drawer.js +2 -2
  36. package/app-layout/visual-refresh-toolbar/drawer/global-drawer.js.map +1 -1
  37. package/app-layout/visual-refresh-toolbar/drawer/styles.css.js +24 -17
  38. package/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +228 -35
  39. package/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +24 -17
  40. package/app-layout/visual-refresh-toolbar/drawer/use-resize.d.ts +3 -1
  41. package/app-layout/visual-refresh-toolbar/drawer/use-resize.d.ts.map +1 -1
  42. package/app-layout/visual-refresh-toolbar/drawer/use-resize.js +2 -2
  43. package/app-layout/visual-refresh-toolbar/drawer/use-resize.js.map +1 -1
  44. package/app-layout/visual-refresh-toolbar/interfaces.d.ts +12 -0
  45. package/app-layout/visual-refresh-toolbar/interfaces.d.ts.map +1 -1
  46. package/app-layout/visual-refresh-toolbar/interfaces.js.map +1 -1
  47. package/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +25 -23
  48. package/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +56 -44
  49. package/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +25 -23
  50. package/app-layout/visual-refresh-toolbar/state/interfaces.d.ts +2 -0
  51. package/app-layout/visual-refresh-toolbar/state/interfaces.d.ts.map +1 -1
  52. package/app-layout/visual-refresh-toolbar/state/interfaces.js.map +1 -1
  53. package/app-layout/visual-refresh-toolbar/state/props-merger.d.ts.map +1 -1
  54. package/app-layout/visual-refresh-toolbar/state/props-merger.js +8 -1
  55. package/app-layout/visual-refresh-toolbar/state/props-merger.js.map +1 -1
  56. package/app-layout/visual-refresh-toolbar/state/use-app-layout.d.ts.map +1 -1
  57. package/app-layout/visual-refresh-toolbar/state/use-app-layout.js +24 -3
  58. package/app-layout/visual-refresh-toolbar/state/use-app-layout.js.map +1 -1
  59. package/app-layout/visual-refresh-toolbar/state/use-skeleton-slots-attributes.d.ts.map +1 -1
  60. package/app-layout/visual-refresh-toolbar/state/use-skeleton-slots-attributes.js +3 -1
  61. package/app-layout/visual-refresh-toolbar/state/use-skeleton-slots-attributes.js.map +1 -1
  62. package/app-layout/visual-refresh-toolbar/toolbar/index.d.ts +4 -0
  63. package/app-layout/visual-refresh-toolbar/toolbar/index.d.ts.map +1 -1
  64. package/app-layout/visual-refresh-toolbar/toolbar/index.js +28 -4
  65. package/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
  66. package/app-layout/visual-refresh-toolbar/toolbar/styles.css.js +15 -12
  67. package/app-layout/visual-refresh-toolbar/toolbar/styles.scoped.css +126 -24
  68. package/app-layout/visual-refresh-toolbar/toolbar/styles.selectors.js +15 -12
  69. package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.d.ts +2 -0
  70. package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.d.ts.map +1 -1
  71. package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.js +3 -3
  72. package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.js.map +1 -1
  73. package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/styles.css.js +7 -5
  74. package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/styles.scoped.css +30 -22
  75. package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/styles.selectors.js +7 -5
  76. package/app-layout/visual-refresh-toolbar/widget-areas/before-main-slot.d.ts.map +1 -1
  77. package/app-layout/visual-refresh-toolbar/widget-areas/before-main-slot.js +23 -3
  78. package/app-layout/visual-refresh-toolbar/widget-areas/before-main-slot.js.map +1 -1
  79. package/internal/base-component/styles.scoped.css +1 -1
  80. package/internal/components/panel-resize-handle/index.d.ts +2 -1
  81. package/internal/components/panel-resize-handle/index.d.ts.map +1 -1
  82. package/internal/components/panel-resize-handle/index.js +18 -8
  83. package/internal/components/panel-resize-handle/index.js.map +1 -1
  84. package/internal/components/panel-resize-handle/styles.css.js +3 -2
  85. package/internal/components/panel-resize-handle/styles.scoped.css +7 -6
  86. package/internal/components/panel-resize-handle/styles.selectors.js +3 -2
  87. package/internal/context/single-tab-stop-navigation-context.d.ts +0 -2
  88. package/internal/context/single-tab-stop-navigation-context.d.ts.map +1 -1
  89. package/internal/context/single-tab-stop-navigation-context.js +4 -35
  90. package/internal/context/single-tab-stop-navigation-context.js.map +1 -1
  91. package/internal/environment.js +2 -2
  92. package/internal/environment.json +2 -2
  93. package/internal/manifest.json +1 -1
  94. package/internal/plugins/widget/interfaces.d.ts +58 -0
  95. package/internal/plugins/widget/interfaces.d.ts.map +1 -0
  96. package/internal/plugins/widget/interfaces.js +2 -0
  97. package/internal/plugins/widget/interfaces.js.map +1 -0
  98. package/internal/plugins/widget/internal.d.ts +20 -0
  99. package/internal/plugins/widget/internal.d.ts.map +1 -0
  100. package/internal/plugins/widget/internal.js +55 -0
  101. package/internal/plugins/widget/internal.js.map +1 -0
  102. package/internal/plugins/widget.d.ts +2 -0
  103. package/internal/plugins/widget.d.ts.map +1 -0
  104. package/internal/plugins/widget.js +5 -0
  105. package/internal/plugins/widget.js.map +1 -0
  106. package/internal/types.d.ts +5 -1
  107. package/internal/types.d.ts.map +1 -1
  108. package/internal/types.js +8 -1
  109. package/internal/types.js.map +1 -1
  110. package/package.json +1 -1
  111. package/s3-resource-selector/s3-modal/index.d.ts.map +1 -1
  112. package/s3-resource-selector/s3-modal/index.js +1 -4
  113. package/s3-resource-selector/s3-modal/index.js.map +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-ai-drawer.js","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-ai-drawer.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAA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,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useEffect, useRef, useState } from 'react';\n\nimport { useStableCallback } from '@cloudscape-design/component-toolkit/internal';\n\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport { metrics } from '../../internal/metrics';\nimport { AppLayoutMessage, DrawerPayload as RuntimeAiDrawerConfig } from '../../internal/plugins/widget/interfaces';\nimport { getAppLayoutInitialState, registerAppLayoutHandler } from '../../internal/plugins/widget/internal';\nimport { assertNever } from '../../internal/types';\nimport { mapRuntimeConfigToAiDrawer } from '../runtime-drawer';\n\nexport interface OnChangeParams {\n initiatedByUserAction: boolean;\n}\n\nconst DEFAULT_ON_CHANGE_PARAMS = { initiatedByUserAction: true };\n\nfunction useRuntimeAiDrawer(\n isEnabled: boolean,\n activeAiDrawerId: string | null,\n onActiveAiDrawerChange: (newDrawerId: string | null, { initiatedByUserAction }: OnChangeParams) => void,\n onActiveAiDrawerResize: (size: number) => void\n) {\n const [aiDrawer, setAiDrawer] = useState<RuntimeAiDrawerConfig | null>(null);\n const appLayoutMessageHandler = useStableCallback((event: AppLayoutMessage) => {\n if (event.type === 'registerLeftDrawer') {\n setAiDrawer(event.payload);\n if (!aiDrawerWasOpenRef.current && event.payload.defaultActive) {\n onAiDrawersChangeStable(event.payload.id, { initiatedByUserAction: false });\n }\n return;\n }\n if (aiDrawer && aiDrawer.id !== event.payload.id) {\n metrics.sendOpsMetricObject('awsui-widget-drawer-incorrect-id', { oldId: aiDrawer?.id, newId: event.payload.id });\n return;\n }\n switch (event.type) {\n case 'updateDrawerConfig':\n setAiDrawer(current => (current ? { ...current, ...event.payload } : current));\n break;\n case 'openDrawer':\n onActiveAiDrawerChangeStable(event.payload.id, { initiatedByUserAction: false });\n break;\n case 'closeDrawer':\n onActiveAiDrawerChangeStable(null, { initiatedByUserAction: false });\n break;\n case 'resizeDrawer':\n onActiveAiDrawerResizeStable(event.payload.size);\n break;\n /* istanbul ignore next: this code is not intended to be visited */\n default:\n assertNever(event);\n }\n });\n const onAiDrawersChangeStable = useStableCallback(onActiveAiDrawerChange);\n const onActiveAiDrawerResizeStable = useStableCallback(onActiveAiDrawerResize);\n const onActiveAiDrawerChangeStable = useStableCallback(onActiveAiDrawerChange);\n const aiDrawerWasOpenRef = useRef(false);\n aiDrawerWasOpenRef.current = aiDrawerWasOpenRef.current || !!activeAiDrawerId;\n\n useEffect(() => {\n if (!isEnabled) {\n return;\n }\n\n const initialDrawerMessage = getAppLayoutInitialState()?.find(message => message.type === 'registerLeftDrawer');\n if (initialDrawerMessage && initialDrawerMessage.type === 'registerLeftDrawer') {\n setAiDrawer(initialDrawerMessage.payload);\n if (!aiDrawerWasOpenRef.current && initialDrawerMessage.payload.defaultActive) {\n onAiDrawersChangeStable(initialDrawerMessage.payload.id, { initiatedByUserAction: false });\n }\n }\n\n const unsubscribe = registerAppLayoutHandler(appLayoutMessageHandler);\n return () => {\n unsubscribe();\n setAiDrawer(null);\n };\n }, [isEnabled, appLayoutMessageHandler, onAiDrawersChangeStable, onActiveAiDrawerResizeStable]);\n\n return aiDrawer && mapRuntimeConfigToAiDrawer(aiDrawer);\n}\n\nexport const MIN_DRAWER_SIZE = 290;\n\ninterface UseDrawersProps {\n isEnabled: boolean;\n onAiDrawerFocus: () => void;\n expandedDrawerId: string | null;\n setExpandedDrawerId: (value: string | null) => void;\n}\n\nexport function useAiDrawer({ isEnabled, onAiDrawerFocus, expandedDrawerId, setExpandedDrawerId }: UseDrawersProps) {\n const [activeAiDrawerId, setActiveAiDrawerId] = useState<string | null>(null);\n const [size, setSize] = useState<number | null>(null);\n\n function onActiveAiDrawerResize(size: number) {\n setSize(size);\n fireNonCancelableEvent(activeAiDrawer?.onResize, { id: activeAiDrawerId, size });\n }\n\n function onActiveAiDrawerChange(\n newDrawerId: string | null,\n { initiatedByUserAction }: OnChangeParams = DEFAULT_ON_CHANGE_PARAMS\n ) {\n setActiveAiDrawerId(newDrawerId);\n\n if (newDrawerId) {\n fireNonCancelableEvent(aiDrawer?.onToggle, { isOpen: true, initiatedByUserAction });\n }\n\n if (activeAiDrawerId) {\n fireNonCancelableEvent(aiDrawer?.onToggle, { isOpen: false, initiatedByUserAction });\n\n if (activeAiDrawerId === expandedDrawerId) {\n setExpandedDrawerId?.(null);\n }\n }\n\n onAiDrawerFocus?.();\n }\n\n const aiDrawer = useRuntimeAiDrawer(isEnabled, activeAiDrawerId, onActiveAiDrawerChange, onActiveAiDrawerResize);\n const activeAiDrawer = activeAiDrawerId && activeAiDrawerId === aiDrawer?.id ? aiDrawer : null;\n const activeAiDrawerSize = activeAiDrawerId ? (size ?? activeAiDrawer?.defaultSize ?? MIN_DRAWER_SIZE) : 0;\n const minAiDrawerSize = Math.min(activeAiDrawer?.defaultSize ?? MIN_DRAWER_SIZE, MIN_DRAWER_SIZE);\n\n return {\n aiDrawer,\n onActiveAiDrawerChange,\n activeAiDrawer,\n activeAiDrawerId,\n activeAiDrawerSize,\n minAiDrawerSize,\n onActiveAiDrawerResize,\n };\n}\n"]}
@@ -18,7 +18,7 @@ export const useKeyboardEvents = ({ position, onResize, panelRef }) => {
18
18
  onDirectionClick: (direction) => {
19
19
  let currentSize;
20
20
  const { panelHeight, panelWidth } = getCurrentSize(panelRef);
21
- if (position === 'side') {
21
+ if (['side', 'side-start'].includes(position)) {
22
22
  currentSize = panelWidth;
23
23
  }
24
24
  else {
@@ -29,11 +29,11 @@ export const useKeyboardEvents = ({ position, onResize, panelRef }) => {
29
29
  switch (direction) {
30
30
  case 'block-start':
31
31
  case 'inline-start':
32
- singleStepUp();
32
+ position === 'side-start' ? singleStepDown() : singleStepUp();
33
33
  break;
34
34
  case 'block-end':
35
35
  case 'inline-end':
36
- singleStepDown();
36
+ position === 'side-start' ? singleStepUp() : singleStepDown();
37
37
  break;
38
38
  }
39
39
  },
@@ -41,7 +41,7 @@ export const useKeyboardEvents = ({ position, onResize, panelRef }) => {
41
41
  let currentSize;
42
42
  let maxSize;
43
43
  const { panelHeight, panelWidth } = getCurrentSize(panelRef);
44
- if (position === 'side') {
44
+ if (['side', 'side-start'].includes(position)) {
45
45
  currentSize = panelWidth;
46
46
  // don't need the exact max size as it's constrained in the set size function
47
47
  maxSize = window.innerWidth;
@@ -58,16 +58,16 @@ export const useKeyboardEvents = ({ position, onResize, panelRef }) => {
58
58
  const multipleStepDown = () => onResize(currentSize - KEYBOARD_MULTIPLE_STEPS_SIZE);
59
59
  handleKey(event, {
60
60
  onBlockStart: () => {
61
- position === 'bottom' ? singleStepUp() : singleStepDown();
61
+ ['bottom', 'side-start'].includes(position) ? singleStepUp() : singleStepDown();
62
62
  },
63
63
  onBlockEnd: () => {
64
- position === 'bottom' ? singleStepDown() : singleStepUp();
64
+ ['bottom', 'side-start'].includes(position) ? singleStepDown() : singleStepUp();
65
65
  },
66
66
  onInlineEnd: () => {
67
- position === 'bottom' ? singleStepUp() : singleStepDown();
67
+ ['bottom', 'side-start'].includes(position) ? singleStepUp() : singleStepDown();
68
68
  },
69
69
  onInlineStart: () => {
70
- position === 'bottom' ? singleStepDown() : singleStepUp();
70
+ ['bottom', 'side-start'].includes(position) ? singleStepDown() : singleStepUp();
71
71
  },
72
72
  onPageDown: () => multipleStepDown(),
73
73
  onPageUp: () => multipleStepUp(),
@@ -1 +1 @@
1
- {"version":3,"file":"use-keyboard-events.js","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-keyboard-events.ts"],"names":[],"mappings":"AAKA,OAAO,SAAS,MAAM,iCAAiC,CAAC;AAGxD,MAAM,yBAAyB,GAAG,EAAE,CAAC;AACrC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAExC,MAAM,cAAc,GAAG,CAAC,QAA0C,EAAE,EAAE;IACpE,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;QAClC,OAAO;YACL,WAAW,EAAE,CAAC;YACd,UAAU,EAAE,CAAC;SACd,CAAC;KACH;IAED,OAAO;QACL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E,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACxB,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,cAAc,GAAG,KAAK,CAAC;aAC1C,CAAC,CAAC;YAEH,IAAI,cAAc,EAAE;gBAClB,KAAK,CAAC,cAAc,EAAE,CAAC;aACxB;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { Direction } from '../../internal/components/drag-handle-wrapper/interfaces';\nimport handleKey from '../../internal/utils/handle-key';\nimport { SizeControlProps } from './interfaces';\n\nconst KEYBOARD_SINGLE_STEP_SIZE = 10;\nconst KEYBOARD_MULTIPLE_STEPS_SIZE = 60;\n\nconst getCurrentSize = (panelRef?: React.RefObject<HTMLDivElement>) => {\n if (!panelRef || !panelRef.current) {\n return {\n panelHeight: 0,\n panelWidth: 0,\n };\n }\n\n return {\n panelHeight: panelRef.current.clientHeight,\n panelWidth: panelRef.current.clientWidth,\n };\n};\n\nexport const useKeyboardEvents = ({ position, onResize, panelRef }: SizeControlProps) => {\n return {\n onDirectionClick: (direction: Direction) => {\n let currentSize: number;\n\n const { panelHeight, panelWidth } = getCurrentSize(panelRef);\n\n if (position === 'side') {\n currentSize = panelWidth;\n } else {\n currentSize = panelHeight;\n }\n\n const singleStepUp = () => onResize(currentSize + KEYBOARD_SINGLE_STEP_SIZE);\n const singleStepDown = () => onResize(currentSize - KEYBOARD_SINGLE_STEP_SIZE);\n\n switch (direction) {\n case 'block-start':\n case 'inline-start':\n singleStepUp();\n break;\n case 'block-end':\n case 'inline-end':\n singleStepDown();\n break;\n }\n },\n\n onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => {\n let currentSize: number;\n let maxSize: number;\n\n const { panelHeight, panelWidth } = getCurrentSize(panelRef);\n\n if (position === 'side') {\n currentSize = panelWidth;\n // don't need the exact max size as it's constrained in the set size function\n maxSize = window.innerWidth;\n } else {\n currentSize = panelHeight;\n // don't need the exact max size as it's constrained in the set size function\n maxSize = window.innerHeight;\n }\n\n let isEventHandled = true;\n\n const singleStepUp = () => onResize(currentSize + KEYBOARD_SINGLE_STEP_SIZE);\n const singleStepDown = () => onResize(currentSize - KEYBOARD_SINGLE_STEP_SIZE);\n const multipleStepUp = () => onResize(currentSize + KEYBOARD_MULTIPLE_STEPS_SIZE);\n const multipleStepDown = () => onResize(currentSize - KEYBOARD_MULTIPLE_STEPS_SIZE);\n\n handleKey(event, {\n onBlockStart: () => {\n position === 'bottom' ? singleStepUp() : singleStepDown();\n },\n onBlockEnd: () => {\n position === 'bottom' ? singleStepDown() : singleStepUp();\n },\n onInlineEnd: () => {\n position === 'bottom' ? singleStepUp() : singleStepDown();\n },\n onInlineStart: () => {\n position === 'bottom' ? singleStepDown() : singleStepUp();\n },\n onPageDown: () => multipleStepDown(),\n onPageUp: () => multipleStepUp(),\n onHome: () => onResize(maxSize),\n onEnd: () => onResize(0),\n onDefault: () => (isEventHandled = false),\n });\n\n if (isEventHandled) {\n event.preventDefault();\n }\n },\n };\n};\n"]}
1
+ {"version":3,"file":"use-keyboard-events.js","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-keyboard-events.ts"],"names":[],"mappings":"AAKA,OAAO,SAAS,MAAM,iCAAiC,CAAC;AAGxD,MAAM,yBAAyB,GAAG,EAAE,CAAC;AACrC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAExC,MAAM,cAAc,GAAG,CAAC,QAA0C,EAAE,EAAE;IACpE,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;QAClC,OAAO;YACL,WAAW,EAAE,CAAC;YACd,UAAU,EAAE,CAAC;SACd,CAAC;KACH;IAED,OAAO;QACL,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,YAAY;QAC1C,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW;KACzC,CAAC;AACJ,CAAC,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C,QAAQ,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;gBAClF,CAAC;gBACD,UAAU,EAAE,GAAG,EAAE,CAAC,gBAAgB,EAAE;gBACpC,QAAQ,EAAE,GAAG,EAAE,CAAC,cAAc,EAAE;gBAChC,MAAM,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAC/B,KAAK,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACxB,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,cAAc,GAAG,KAAK,CAAC;aAC1C,CAAC,CAAC;YAEH,IAAI,cAAc,EAAE;gBAClB,KAAK,CAAC,cAAc,EAAE,CAAC;aACxB;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { Direction } from '../../internal/components/drag-handle-wrapper/interfaces';\nimport handleKey from '../../internal/utils/handle-key';\nimport { SizeControlProps } from './interfaces';\n\nconst KEYBOARD_SINGLE_STEP_SIZE = 10;\nconst KEYBOARD_MULTIPLE_STEPS_SIZE = 60;\n\nconst getCurrentSize = (panelRef?: React.RefObject<HTMLDivElement>) => {\n if (!panelRef || !panelRef.current) {\n return {\n panelHeight: 0,\n panelWidth: 0,\n };\n }\n\n return {\n panelHeight: panelRef.current.clientHeight,\n panelWidth: panelRef.current.clientWidth,\n };\n};\n\nexport const useKeyboardEvents = ({ position, onResize, panelRef }: SizeControlProps) => {\n return {\n onDirectionClick: (direction: Direction) => {\n let currentSize: number;\n\n const { panelHeight, panelWidth } = getCurrentSize(panelRef);\n\n if (['side', 'side-start'].includes(position)) {\n currentSize = panelWidth;\n } else {\n currentSize = panelHeight;\n }\n\n const singleStepUp = () => onResize(currentSize + KEYBOARD_SINGLE_STEP_SIZE);\n const singleStepDown = () => onResize(currentSize - KEYBOARD_SINGLE_STEP_SIZE);\n\n switch (direction) {\n case 'block-start':\n case 'inline-start':\n position === 'side-start' ? singleStepDown() : singleStepUp();\n break;\n case 'block-end':\n case 'inline-end':\n position === 'side-start' ? singleStepUp() : singleStepDown();\n break;\n }\n },\n\n onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => {\n let currentSize: number;\n let maxSize: number;\n\n const { panelHeight, panelWidth } = getCurrentSize(panelRef);\n\n if (['side', 'side-start'].includes(position)) {\n currentSize = panelWidth;\n // don't need the exact max size as it's constrained in the set size function\n maxSize = window.innerWidth;\n } else {\n currentSize = panelHeight;\n // don't need the exact max size as it's constrained in the set size function\n maxSize = window.innerHeight;\n }\n\n let isEventHandled = true;\n\n const singleStepUp = () => onResize(currentSize + KEYBOARD_SINGLE_STEP_SIZE);\n const singleStepDown = () => onResize(currentSize - KEYBOARD_SINGLE_STEP_SIZE);\n const multipleStepUp = () => onResize(currentSize + KEYBOARD_MULTIPLE_STEPS_SIZE);\n const multipleStepDown = () => onResize(currentSize - KEYBOARD_MULTIPLE_STEPS_SIZE);\n\n handleKey(event, {\n onBlockStart: () => {\n ['bottom', 'side-start'].includes(position) ? singleStepUp() : singleStepDown();\n },\n onBlockEnd: () => {\n ['bottom', 'side-start'].includes(position) ? singleStepDown() : singleStepUp();\n },\n onInlineEnd: () => {\n ['bottom', 'side-start'].includes(position) ? singleStepUp() : singleStepDown();\n },\n onInlineStart: () => {\n ['bottom', 'side-start'].includes(position) ? singleStepDown() : singleStepUp();\n },\n onPageDown: () => multipleStepDown(),\n onPageUp: () => multipleStepUp(),\n onHome: () => onResize(maxSize),\n onEnd: () => onResize(0),\n onDefault: () => (isEventHandled = false),\n });\n\n if (isEventHandled) {\n event.preventDefault();\n }\n },\n };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use-pointer-events.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-pointer-events.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIhD,eAAO,MAAM,gBAAgB,gDAAiD,gBAAgB,eAwD7F,CAAC"}
1
+ {"version":3,"file":"use-pointer-events.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-pointer-events.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIhD,eAAO,MAAM,gBAAgB,gDAAiD,gBAAgB,eAkE7F,CAAC"}
@@ -15,6 +15,14 @@ export const usePointerEvents = ({ position, panelRef, handleRef, onResize }) =>
15
15
  const width = getLogicalBoundingClientRect(panelRef.current).insetInlineEnd - mouseClientX + handleOffset;
16
16
  onResize(width);
17
17
  }
18
+ else if (position === 'side-start') {
19
+ const mouseClientX = getLogicalClientX(event, getIsRtl(panelRef.current)) || 0;
20
+ // The handle offset aligns the cursor with the middle of the resize handle.
21
+ const handleOffset = getLogicalBoundingClientRect(handleRef.current).inlineSize / 2;
22
+ const panelBoundingClientRect = getLogicalBoundingClientRect(panelRef.current);
23
+ const width = panelBoundingClientRect.insetInlineEnd + mouseClientX + handleOffset - panelBoundingClientRect.inlineSize;
24
+ onResize(width);
25
+ }
18
26
  else {
19
27
  const mouseClientY = event.clientY || 0;
20
28
  // The handle offset aligns the cursor with the middle of the resize handle.
@@ -1 +1 @@
1
- {"version":3,"file":"use-pointer-events.js","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-pointer-events.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EACL,QAAQ,EACR,4BAA4B,EAC5B,iBAAiB,GAClB,MAAM,+CAA+C,CAAC;AAIvD,OAAO,MAAM,MAAM,yBAAyB,CAAC;AAE7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAoB,EAAE,EAAE;IAChG,MAAM,qBAA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AEnD,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;QAC/D,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,QAAQ,EAAE,CAAC,CAAC,CAAC;QACpE,eAAe,CAAC,mBAAmB,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;QACtE,eAAe,CAAC,mBAAmB,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC;IAC5E,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEhD,MAAM,mBAAmB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC3C,MAAM,YAAY,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC;QACvC,yBAAyB;QACzB,IAAI,CAAC,YAAY,EAAE;YACjB,OAAO;SACR;QACD,MAAM,eAAe,GAAG,YAAY,CAAC,aAAa,CAAC;QACnD,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;QAC5D,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,QAAQ,EAAE,CAAC,CAAC,CAAC;QACjE,eAAe,CAAC,gBAAgB,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;QACnE,eAAe,CAAC,gBAAgB,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC;IACzE,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC,CAAC;IAErE,OAAO,mBAAmB,CAAC;AAC7B,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useCallback } from 'react';\n\nimport {\n getIsRtl,\n getLogicalBoundingClientRect,\n getLogicalClientX,\n} from '@cloudscape-design/component-toolkit/internal';\n\nimport { SizeControlProps } from './interfaces';\n\nimport styles from '../resize/styles.css.js';\n\nexport const usePointerEvents = ({ position, panelRef, handleRef, onResize }: SizeControlProps) => {\n const onDocumentPointerMove = useCallback(\n (event: PointerEvent) => {\n if (!panelRef || !panelRef.current || !handleRef || !handleRef.current) {\n return;\n }\n\n if (position === 'side') {\n const mouseClientX = getLogicalClientX(event, getIsRtl(panelRef.current)) || 0;\n\n // The handle offset aligns the cursor with the middle of the resize handle.\n const handleOffset = getLogicalBoundingClientRect(handleRef.current).inlineSize / 2;\n const width = getLogicalBoundingClientRect(panelRef.current).insetInlineEnd - mouseClientX + handleOffset;\n\n onResize(width);\n } else {\n const mouseClientY = event.clientY || 0;\n\n // The handle offset aligns the cursor with the middle of the resize handle.\n const handleOffset = getLogicalBoundingClientRect(handleRef.current).blockSize / 2;\n const height = getLogicalBoundingClientRect(panelRef.current).insetBlockEnd - mouseClientY + handleOffset;\n\n onResize(height);\n }\n },\n [position, panelRef, handleRef, onResize]\n );\n\n const onDocumentPointerUp = useCallback(() => {\n const panelElement = panelRef?.current;\n /* istanbul ignore if */\n if (!panelElement) {\n return;\n }\n const currentDocument = panelElement.ownerDocument;\n\n currentDocument.body.classList.remove(styles['resize-active']);\n currentDocument.body.classList.remove(styles[`resize-${position}`]);\n currentDocument.removeEventListener('pointerup', onDocumentPointerUp);\n currentDocument.removeEventListener('pointermove', onDocumentPointerMove);\n }, [panelRef, onDocumentPointerMove, position]);\n\n const onSliderPointerDown = useCallback(() => {\n const panelElement = panelRef?.current;\n /* istanbul ignore if */\n if (!panelElement) {\n return;\n }\n const currentDocument = panelElement.ownerDocument;\n currentDocument.body.classList.add(styles['resize-active']);\n currentDocument.body.classList.add(styles[`resize-${position}`]);\n currentDocument.addEventListener('pointerup', onDocumentPointerUp);\n currentDocument.addEventListener('pointermove', onDocumentPointerMove);\n }, [panelRef, onDocumentPointerMove, onDocumentPointerUp, position]);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BAAqB,CAAC,CAAC;IAC5E,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEhD,MAAM,mBAAmB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC3C,MAAM,YAAY,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC;QACvC,yBAAyB;QACzB,IAAI,CAAC,YAAY,EAAE;YACjB,OAAO;SACR;QACD,MAAM,eAAe,GAAG,YAAY,CAAC,aAAa,CAAC;QACnD,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;QAC5D,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,QAAQ,EAAE,CAAC,CAAC,CAAC;QACjE,eAAe,CAAC,gBAAgB,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;QACnE,eAAe,CAAC,gBAAgB,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC;IACzE,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC,CAAC;IAErE,OAAO,mBAAmB,CAAC;AAC7B,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useCallback } from 'react';\n\nimport {\n getIsRtl,\n getLogicalBoundingClientRect,\n getLogicalClientX,\n} from '@cloudscape-design/component-toolkit/internal';\n\nimport { SizeControlProps } from './interfaces';\n\nimport styles from '../resize/styles.css.js';\n\nexport const usePointerEvents = ({ position, panelRef, handleRef, onResize }: SizeControlProps) => {\n const onDocumentPointerMove = useCallback(\n (event: PointerEvent) => {\n if (!panelRef || !panelRef.current || !handleRef || !handleRef.current) {\n return;\n }\n\n if (position === 'side') {\n const mouseClientX = getLogicalClientX(event, getIsRtl(panelRef.current)) || 0;\n\n // The handle offset aligns the cursor with the middle of the resize handle.\n const handleOffset = getLogicalBoundingClientRect(handleRef.current).inlineSize / 2;\n const width = getLogicalBoundingClientRect(panelRef.current).insetInlineEnd - mouseClientX + handleOffset;\n\n onResize(width);\n } else if (position === 'side-start') {\n const mouseClientX = getLogicalClientX(event, getIsRtl(panelRef.current)) || 0;\n\n // The handle offset aligns the cursor with the middle of the resize handle.\n const handleOffset = getLogicalBoundingClientRect(handleRef.current).inlineSize / 2;\n const panelBoundingClientRect = getLogicalBoundingClientRect(panelRef.current);\n const width =\n panelBoundingClientRect.insetInlineEnd + mouseClientX + handleOffset - panelBoundingClientRect.inlineSize;\n\n onResize(width);\n } else {\n const mouseClientY = event.clientY || 0;\n\n // The handle offset aligns the cursor with the middle of the resize handle.\n const handleOffset = getLogicalBoundingClientRect(handleRef.current).blockSize / 2;\n const height = getLogicalBoundingClientRect(panelRef.current).insetBlockEnd - mouseClientY + handleOffset;\n\n onResize(height);\n }\n },\n [position, panelRef, handleRef, onResize]\n );\n\n const onDocumentPointerUp = useCallback(() => {\n const panelElement = panelRef?.current;\n /* istanbul ignore if */\n if (!panelElement) {\n return;\n }\n const currentDocument = panelElement.ownerDocument;\n\n currentDocument.body.classList.remove(styles['resize-active']);\n currentDocument.body.classList.remove(styles[`resize-${position}`]);\n currentDocument.removeEventListener('pointerup', onDocumentPointerUp);\n currentDocument.removeEventListener('pointermove', onDocumentPointerMove);\n }, [panelRef, onDocumentPointerMove, position]);\n\n const onSliderPointerDown = useCallback(() => {\n const panelElement = panelRef?.current;\n /* istanbul ignore if */\n if (!panelElement) {\n return;\n }\n const currentDocument = panelElement.ownerDocument;\n currentDocument.body.classList.add(styles['resize-active']);\n currentDocument.body.classList.add(styles[`resize-${position}`]);\n currentDocument.addEventListener('pointerup', onDocumentPointerUp);\n currentDocument.addEventListener('pointermove', onDocumentPointerMove);\n }, [panelRef, onDocumentPointerMove, onDocumentPointerUp, position]);\n\n return onSliderPointerDown;\n};\n"]}
@@ -10,6 +10,7 @@ interface HorizontalLayoutInput {
10
10
  splitPanelSize: number;
11
11
  isMobile: boolean;
12
12
  activeGlobalDrawersSizes: Record<string, number>;
13
+ activeAiDrawerSize: number;
13
14
  }
14
15
  export declare const CONTENT_PADDING: number;
15
16
  export declare function computeHorizontalLayout({
@@ -22,7 +23,8 @@ export declare function computeHorizontalLayout({
22
23
  splitPanelPosition,
23
24
  splitPanelSize,
24
25
  isMobile,
25
- activeGlobalDrawersSizes
26
+ activeGlobalDrawersSizes,
27
+ activeAiDrawerSize
26
28
  }: HorizontalLayoutInput): {
27
29
  splitPanelPosition: "bottom" | "side";
28
30
  splitPanelForcedPosition: boolean;
@@ -32,6 +34,7 @@ export declare function computeHorizontalLayout({
32
34
  maxGlobalDrawersSizes: Record<string, number>;
33
35
  totalActiveGlobalDrawersSize: number;
34
36
  resizableSpaceAvailable: number;
37
+ maxAiDrawerSize: number;
35
38
  };
36
39
  interface VerticalLayoutInput {
37
40
  topOffset: number;
@@ -1 +1 @@
1
- {"version":3,"file":"compute-layout.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/compute-layout.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAG3D,UAAU,qBAAqB;IAC7B,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,0BAA0B,CAAC,WAAW,CAAC,CAAC;IACnD,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,kBAAkB,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;IAClD,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClD;AAED,eAAO,MAAM,eAAe,QAAS,CAAC;AAEtC,wBAAgB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
+ {"version":3,"file":"compute-layout.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/compute-layout.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAG3D,UAAU,qBAAqB;IAC7B,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,0BAA0B,CAAC,WAAW,CAAC,CAAC;IACnD,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,kBAAkB,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;IAClD,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,eAAe,QAAS,CAAC;AAGtC,wBAAgB,uBAAuB,CAAC,EACtC,cAAc,EACd,eAAe,EACf,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,QAAQ,EACR,wBAAwB,EACxB,kBAAkB,GACnB,EAAE,qBAAqB;;;;;;;;;;EA8CvB;AAED,UAAU,mBAAmB;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,GACpB,EAAE,mBAAmB,GAAG,oBAAoB,CAe5C;AAED,UAAU,qBAAqB;IAC7B,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,0BAA0B,CAAC,WAAW,CAAC,CAAC;IACnD,kBAAkB,EAAE,QAAQ,GAAG,MAAM,CAAC;IACtC,cAAc,EAAE,OAAO,CAAC;IACxB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAgB,wBAAwB,CAAC,EACvC,aAAa,EACb,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,oBAAoB,EACpB,sBAAsB,GACvB,EAAE,qBAAqB;;;;;;EAYvB;AAED,wBAAgB,eAAe,CAC7B,eAAe,EAAE,oBAAoB,EACrC,QAAQ,EAAE,OAAO,EACjB,SAAS,EAAE,0BAA0B,CAAC,WAAW,CAAC,GACjD;IACD,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;CACtB,CAIA"}
@@ -2,9 +2,10 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { shouldSplitPanelBeForcedToBottom } from '../split-panel/split-panel-forced-position';
4
4
  export const CONTENT_PADDING = 2 * 24; // space-xl
5
- export function computeHorizontalLayout({ navigationOpen, navigationWidth, placement, minContentWidth, activeDrawerSize, splitPanelOpen, splitPanelPosition, splitPanelSize, isMobile, activeGlobalDrawersSizes, }) {
5
+ const MOBILE_BREAKPOINT = 688;
6
+ export function computeHorizontalLayout({ navigationOpen, navigationWidth, placement, minContentWidth, activeDrawerSize, splitPanelOpen, splitPanelPosition, splitPanelSize, isMobile, activeGlobalDrawersSizes, activeAiDrawerSize, }) {
6
7
  const activeNavigationWidth = navigationOpen ? navigationWidth : 0;
7
- let resizableSpaceAvailable = Math.max(0, placement.inlineSize - minContentWidth - CONTENT_PADDING - activeNavigationWidth);
8
+ let resizableSpaceAvailable = Math.max(0, placement.inlineSize - minContentWidth - CONTENT_PADDING - activeNavigationWidth - activeAiDrawerSize);
8
9
  const totalActiveGlobalDrawersSize = Object.values(activeGlobalDrawersSizes).reduce((acc, size) => acc + size, 0);
9
10
  const availableWidthForSplitPanel = resizableSpaceAvailable - activeDrawerSize;
10
11
  const splitPanelForcedPosition = shouldSplitPanelBeForcedToBottom({
@@ -16,6 +17,8 @@ export function computeHorizontalLayout({ navigationOpen, navigationWidth, place
16
17
  const maxSplitPanelSize = Math.max(resizableSpaceAvailable - totalActiveGlobalDrawersSize - activeDrawerSize, 0);
17
18
  resizableSpaceAvailable -= sideSplitPanelSize;
18
19
  const maxDrawerSize = resizableSpaceAvailable - totalActiveGlobalDrawersSize;
20
+ // let the ai drawer be resized until the "main screen" hits the mobile breakpoint to have consistent UX
21
+ const maxAiDrawerSize = placement.inlineSize - MOBILE_BREAKPOINT;
19
22
  const maxGlobalDrawersSizes = Object.keys(activeGlobalDrawersSizes).reduce((acc, drawerId) => {
20
23
  return Object.assign(Object.assign({}, acc), { [drawerId]: resizableSpaceAvailable -
21
24
  activeDrawerSize -
@@ -31,6 +34,7 @@ export function computeHorizontalLayout({ navigationOpen, navigationWidth, place
31
34
  maxGlobalDrawersSizes,
32
35
  totalActiveGlobalDrawersSize,
33
36
  resizableSpaceAvailable,
37
+ maxAiDrawerSize,
34
38
  };
35
39
  }
36
40
  export function computeVerticalLayout({ topOffset, hasVisibleToolbar, toolbarHeight, stickyNotifications, notificationsHeight, }) {
@@ -1 +1 @@
1
- {"version":3,"file":"compute-layout.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/compute-layout.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAGtC,OAAO,EAAE,gCAAgC,EAAE,MAAM,4CAA4C,CAAC;AAe9F,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,WAAW;AAElD,MAAM,UAAU,uBAAuB,CAAC,EACtC,cAAc,EACd,eA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A0B,EAAE,uBAAuB,GAAG,SAAS,CAAC,aAAa;QAC7E,0BAA0B,EAAE,uBAAuB;KACpD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,eAAqC,EACrC,QAAiB,EACjB,SAAkD;;IAKlD,MAAM,eAAe,GAAG,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAA,eAAe,CAAC,OAAO,mCAAI,SAAS,CAAC,eAAe,CAAC,CAAC;IACpH,MAAM,YAAY,GAAG,gBAAgB,eAAe,QAAQ,SAAS,CAAC,aAAa,KAAK,CAAC;IACzF,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AppLayoutPropsWithDefaults } from '../interfaces';\nimport { shouldSplitPanelBeForcedToBottom } from '../split-panel/split-panel-forced-position';\n\ninterface HorizontalLayoutInput {\n navigationOpen: boolean;\n navigationWidth: number;\n placement: AppLayoutPropsWithDefaults['placement'];\n minContentWidth: number;\n activeDrawerSize: number;\n splitPanelOpen: boolean;\n splitPanelPosition: 'side' | 'bottom' | undefined;\n splitPanelSize: number;\n isMobile: boolean;\n activeGlobalDrawersSizes: Record<string, number>;\n}\n\nexport const CONTENT_PADDING = 2 * 24; // space-xl\n\nexport function computeHorizontalLayout({\n navigationOpen,\n navigationWidth,\n placement,\n minContentWidth,\n activeDrawerSize,\n splitPanelOpen,\n splitPanelPosition,\n splitPanelSize,\n isMobile,\n activeGlobalDrawersSizes,\n}: HorizontalLayoutInput) {\n const activeNavigationWidth = navigationOpen ? navigationWidth : 0;\n\n let resizableSpaceAvailable = Math.max(\n 0,\n placement.inlineSize - minContentWidth - CONTENT_PADDING - activeNavigationWidth\n );\n const totalActiveGlobalDrawersSize = Object.values(activeGlobalDrawersSizes).reduce((acc, size) => acc + size, 0);\n\n const availableWidthForSplitPanel = resizableSpaceAvailable - activeDrawerSize;\n const splitPanelForcedPosition = shouldSplitPanelBeForcedToBottom({\n isMobile,\n availableWidthForSplitPanel,\n });\n const resolvedSplitPanelPosition = splitPanelForcedPosition ? 'bottom' : (splitPanelPosition ?? 'bottom');\n const sideSplitPanelSize = resolvedSplitPanelPosition === 'side' && splitPanelOpen ? (splitPanelSize ?? 0) : 0;\n const maxSplitPanelSize = Math.max(resizableSpaceAvailable - totalActiveGlobalDrawersSize - activeDrawerSize, 0);\n resizableSpaceAvailable -= sideSplitPanelSize;\n const maxDrawerSize = resizableSpaceAvailable - totalActiveGlobalDrawersSize;\n const maxGlobalDrawersSizes: Record<string, number> = Object.keys(activeGlobalDrawersSizes).reduce(\n (acc, drawerId) => {\n return {\n ...acc,\n [drawerId]:\n resizableSpaceAvailable -\n activeDrawerSize -\n totalActiveGlobalDrawersSize +\n activeGlobalDrawersSizes[drawerId],\n };\n },\n {}\n );\n\n return {\n splitPanelPosition: resolvedSplitPanelPosition,\n splitPanelForcedPosition,\n sideSplitPanelSize,\n maxSplitPanelSize,\n maxDrawerSize,\n maxGlobalDrawersSizes,\n totalActiveGlobalDrawersSize,\n resizableSpaceAvailable,\n };\n}\n\ninterface VerticalLayoutInput {\n topOffset: number;\n hasVisibleToolbar: boolean;\n toolbarHeight: number;\n stickyNotifications: boolean;\n notificationsHeight: number;\n}\n\nexport interface VerticalLayoutOutput {\n toolbar: number;\n notifications: number;\n header: number;\n drawers: number;\n}\n\nexport function computeVerticalLayout({\n topOffset,\n hasVisibleToolbar,\n toolbarHeight,\n stickyNotifications,\n notificationsHeight,\n}: VerticalLayoutInput): VerticalLayoutOutput {\n const toolbar = topOffset;\n let notifications = topOffset;\n let drawers = topOffset;\n\n if (hasVisibleToolbar) {\n notifications += toolbarHeight;\n drawers += toolbarHeight;\n }\n let header = notifications;\n if (stickyNotifications) {\n header += notificationsHeight;\n }\n\n return { toolbar, notifications, header, drawers };\n}\n\ninterface SplitPanelOffsetInput {\n hasSplitPanel: boolean;\n placement: AppLayoutPropsWithDefaults['placement'];\n splitPanelPosition: 'bottom' | 'side';\n splitPanelOpen: boolean;\n splitPanelHeaderHeight: number;\n splitPanelFullHeight: number;\n}\n\nexport function computeSplitPanelOffsets({\n hasSplitPanel,\n splitPanelPosition,\n placement,\n splitPanelOpen,\n splitPanelFullHeight,\n splitPanelHeaderHeight,\n}: SplitPanelOffsetInput) {\n if (!hasSplitPanel || splitPanelPosition !== 'bottom') {\n return {\n stickyVerticalBottomOffset: placement.insetBlockEnd,\n mainContentPaddingBlockEnd: undefined,\n };\n }\n const mainContentBottomOffset = splitPanelOpen ? splitPanelFullHeight : splitPanelHeaderHeight;\n return {\n stickyVerticalBottomOffset: mainContentBottomOffset + placement.insetBlockEnd,\n mainContentPaddingBlockEnd: mainContentBottomOffset,\n };\n}\n\nexport function getDrawerStyles(\n verticalOffsets: VerticalLayoutOutput,\n isMobile: boolean,\n placement: AppLayoutPropsWithDefaults['placement']\n): {\n drawerTopOffset: number;\n drawerHeight: string;\n} {\n const drawerTopOffset = isMobile ? verticalOffsets.toolbar : (verticalOffsets.drawers ?? placement.insetBlockStart);\n const drawerHeight = `calc(100vh - ${drawerTopOffset}px - ${placement.insetBlockEnd}px)`;\n return { drawerTopOffset, drawerHeight };\n}\n"]}
1
+ {"version":3,"file":"compute-layout.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/compute-layout.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAGtC,OAAO,EAAE,gCAAgC,EAAE,MAAM,4CAA4C,CAAC;AAgB9F,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,WAAW;AAClD,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,MAAM,UAAU,uBAAuB,CAAC,EACtC,cAAc,EACd,eAAe,EACf,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,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,sBAAsB,CAAC;IAC/F,OAAO;QACL,0BAA0B,EAAE,uBAAuB,GAAG,SAAS,CAAC,aAAa;QAC7E,0BAA0B,EAAE,uBAAuB;KACpD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,eAAqC,EACrC,QAAiB,EACjB,SAAkD;;IAKlD,MAAM,eAAe,GAAG,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAA,eAAe,CAAC,OAAO,mCAAI,SAAS,CAAC,eAAe,CAAC,CAAC;IACpH,MAAM,YAAY,GAAG,gBAAgB,eAAe,QAAQ,SAAS,CAAC,aAAa,KAAK,CAAC;IACzF,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AppLayoutPropsWithDefaults } from '../interfaces';\nimport { shouldSplitPanelBeForcedToBottom } from '../split-panel/split-panel-forced-position';\n\ninterface HorizontalLayoutInput {\n navigationOpen: boolean;\n navigationWidth: number;\n placement: AppLayoutPropsWithDefaults['placement'];\n minContentWidth: number;\n activeDrawerSize: number;\n splitPanelOpen: boolean;\n splitPanelPosition: 'side' | 'bottom' | undefined;\n splitPanelSize: number;\n isMobile: boolean;\n activeGlobalDrawersSizes: Record<string, number>;\n activeAiDrawerSize: number;\n}\n\nexport const CONTENT_PADDING = 2 * 24; // space-xl\nconst MOBILE_BREAKPOINT = 688;\n\nexport function computeHorizontalLayout({\n navigationOpen,\n navigationWidth,\n placement,\n minContentWidth,\n activeDrawerSize,\n splitPanelOpen,\n splitPanelPosition,\n splitPanelSize,\n isMobile,\n activeGlobalDrawersSizes,\n activeAiDrawerSize,\n}: HorizontalLayoutInput) {\n const activeNavigationWidth = navigationOpen ? navigationWidth : 0;\n\n let resizableSpaceAvailable = Math.max(\n 0,\n placement.inlineSize - minContentWidth - CONTENT_PADDING - activeNavigationWidth - activeAiDrawerSize\n );\n const totalActiveGlobalDrawersSize = Object.values(activeGlobalDrawersSizes).reduce((acc, size) => acc + size, 0);\n\n const availableWidthForSplitPanel = resizableSpaceAvailable - activeDrawerSize;\n const splitPanelForcedPosition = shouldSplitPanelBeForcedToBottom({\n isMobile,\n availableWidthForSplitPanel,\n });\n const resolvedSplitPanelPosition = splitPanelForcedPosition ? 'bottom' : (splitPanelPosition ?? 'bottom');\n const sideSplitPanelSize = resolvedSplitPanelPosition === 'side' && splitPanelOpen ? (splitPanelSize ?? 0) : 0;\n const maxSplitPanelSize = Math.max(resizableSpaceAvailable - totalActiveGlobalDrawersSize - activeDrawerSize, 0);\n resizableSpaceAvailable -= sideSplitPanelSize;\n const maxDrawerSize = resizableSpaceAvailable - totalActiveGlobalDrawersSize;\n // let the ai drawer be resized until the \"main screen\" hits the mobile breakpoint to have consistent UX\n const maxAiDrawerSize = placement.inlineSize - MOBILE_BREAKPOINT;\n const maxGlobalDrawersSizes: Record<string, number> = Object.keys(activeGlobalDrawersSizes).reduce(\n (acc, drawerId) => {\n return {\n ...acc,\n [drawerId]:\n resizableSpaceAvailable -\n activeDrawerSize -\n totalActiveGlobalDrawersSize +\n activeGlobalDrawersSizes[drawerId],\n };\n },\n {}\n );\n\n return {\n splitPanelPosition: resolvedSplitPanelPosition,\n splitPanelForcedPosition,\n sideSplitPanelSize,\n maxSplitPanelSize,\n maxDrawerSize,\n maxGlobalDrawersSizes,\n totalActiveGlobalDrawersSize,\n resizableSpaceAvailable,\n maxAiDrawerSize,\n };\n}\n\ninterface VerticalLayoutInput {\n topOffset: number;\n hasVisibleToolbar: boolean;\n toolbarHeight: number;\n stickyNotifications: boolean;\n notificationsHeight: number;\n}\n\nexport interface VerticalLayoutOutput {\n toolbar: number;\n notifications: number;\n header: number;\n drawers: number;\n}\n\nexport function computeVerticalLayout({\n topOffset,\n hasVisibleToolbar,\n toolbarHeight,\n stickyNotifications,\n notificationsHeight,\n}: VerticalLayoutInput): VerticalLayoutOutput {\n const toolbar = topOffset;\n let notifications = topOffset;\n let drawers = topOffset;\n\n if (hasVisibleToolbar) {\n notifications += toolbarHeight;\n drawers += toolbarHeight;\n }\n let header = notifications;\n if (stickyNotifications) {\n header += notificationsHeight;\n }\n\n return { toolbar, notifications, header, drawers };\n}\n\ninterface SplitPanelOffsetInput {\n hasSplitPanel: boolean;\n placement: AppLayoutPropsWithDefaults['placement'];\n splitPanelPosition: 'bottom' | 'side';\n splitPanelOpen: boolean;\n splitPanelHeaderHeight: number;\n splitPanelFullHeight: number;\n}\n\nexport function computeSplitPanelOffsets({\n hasSplitPanel,\n splitPanelPosition,\n placement,\n splitPanelOpen,\n splitPanelFullHeight,\n splitPanelHeaderHeight,\n}: SplitPanelOffsetInput) {\n if (!hasSplitPanel || splitPanelPosition !== 'bottom') {\n return {\n stickyVerticalBottomOffset: placement.insetBlockEnd,\n mainContentPaddingBlockEnd: undefined,\n };\n }\n const mainContentBottomOffset = splitPanelOpen ? splitPanelFullHeight : splitPanelHeaderHeight;\n return {\n stickyVerticalBottomOffset: mainContentBottomOffset + placement.insetBlockEnd,\n mainContentPaddingBlockEnd: mainContentBottomOffset,\n };\n}\n\nexport function getDrawerStyles(\n verticalOffsets: VerticalLayoutOutput,\n isMobile: boolean,\n placement: AppLayoutPropsWithDefaults['placement']\n): {\n drawerTopOffset: number;\n drawerHeight: string;\n} {\n const drawerTopOffset = isMobile ? verticalOffsets.toolbar : (verticalOffsets.drawers ?? placement.insetBlockStart);\n const drawerHeight = `calc(100vh - ${drawerTopOffset}px - ${placement.insetBlockEnd}px)`;\n return { drawerTopOffset, drawerHeight };\n}\n"]}
@@ -0,0 +1,35 @@
1
+ /// <reference types="react" />
2
+ import { AppLayoutProps } from '../../interfaces';
3
+ import { OnChangeParams } from '../../utils/use-ai-drawer';
4
+ import { FocusControlState } from '../../utils/use-focus-control';
5
+ import { AppLayoutInternals, InternalDrawer } from '../interfaces';
6
+ interface AIDrawerProps {
7
+ activeAiDrawerSize: number;
8
+ minAiDrawerSize: number;
9
+ aiDrawer: AppLayoutProps.Drawer | undefined;
10
+ maxAiDrawerSize: number;
11
+ ariaLabels: any;
12
+ aiDrawerFocusControl: FocusControlState | undefined;
13
+ isMobile: boolean;
14
+ drawersOpenQueue: ReadonlyArray<string> | undefined;
15
+ onActiveAiDrawerChange: undefined | ((newDrawerId: string | null, params?: OnChangeParams) => void);
16
+ onActiveDrawerResize: (detail: {
17
+ id: string;
18
+ size: number;
19
+ }) => void;
20
+ expandedDrawerId?: string | null;
21
+ setExpandedDrawerId: (value: string | null) => void;
22
+ }
23
+ interface AppLayoutGlobalAiDrawerImplementationProps {
24
+ appLayoutInternals: AppLayoutInternals;
25
+ show: boolean;
26
+ activeAiDrawer: InternalDrawer | null;
27
+ aiDrawerProps: AIDrawerProps;
28
+ }
29
+ export declare function AppLayoutGlobalAiDrawerImplementation({
30
+ appLayoutInternals,
31
+ show,
32
+ activeAiDrawer,
33
+ aiDrawerProps
34
+ }: AppLayoutGlobalAiDrawerImplementationProps): JSX.Element;
35
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global-ai-drawer.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAOnE,UAAU,aAAa;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC;IAC5C,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,GAAG,CAAC;IAChB,oBAAoB,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACpD,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IACpD,sBAAsB,EAAE,SAAS,GAAG,CAAC,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC,CAAC;IACpG,oBAAoB,EAAE,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACrE,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACrD;AAED,UAAU,0CAA0C;IAClD,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,wBAAgB,qCAAqC,CAAC,EACpD,kBAAkB,EAClB,IAAI,EACJ,cAAc,EACd,aAAa,GACd,EAAE,0CAA0C,eAmK5C"}
@@ -0,0 +1,81 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import React, { useRef } from 'react';
4
+ import { Transition } from 'react-transition-group';
5
+ import clsx from 'clsx';
6
+ import { InternalButton } from '../../../button/internal';
7
+ import PanelResizeHandle from '../../../internal/components/panel-resize-handle';
8
+ import customCssProps from '../../../internal/generated/custom-css-properties';
9
+ import { usePrevious } from '../../../internal/hooks/use-previous';
10
+ import { getLimitedValue } from '../../../split-panel/utils/size-utils';
11
+ import { useResize } from './use-resize';
12
+ import sharedStyles from '../../resize/styles.css.js';
13
+ import testutilStyles from '../../test-classes/styles.css.js';
14
+ import styles from './styles.css.js';
15
+ export function AppLayoutGlobalAiDrawerImplementation({ appLayoutInternals, show, activeAiDrawer, aiDrawerProps, }) {
16
+ var _a, _b;
17
+ const { activeAiDrawerSize, minAiDrawerSize, maxAiDrawerSize, ariaLabels, aiDrawerFocusControl, isMobile, drawersOpenQueue, onActiveAiDrawerChange, onActiveDrawerResize, expandedDrawerId, setExpandedDrawerId, } = aiDrawerProps;
18
+ const { verticalOffsets, placement } = appLayoutInternals;
19
+ const drawerRef = useRef(null);
20
+ const activeDrawerId = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.id;
21
+ const computedAriaLabels = {
22
+ closeButton: activeAiDrawer ? (_a = activeAiDrawer.ariaLabels) === null || _a === void 0 ? void 0 : _a.closeButton : ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.toolsClose,
23
+ content: activeAiDrawer ? (_b = activeAiDrawer.ariaLabels) === null || _b === void 0 ? void 0 : _b.drawerName : ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.tools,
24
+ };
25
+ const resizeProps = useResize({
26
+ currentWidth: activeAiDrawerSize,
27
+ minWidth: minAiDrawerSize,
28
+ maxWidth: maxAiDrawerSize,
29
+ panelRef: drawerRef,
30
+ handleRef: aiDrawerFocusControl.refs.slider,
31
+ onResize: size => {
32
+ onActiveDrawerResize({ id: activeDrawerId, size });
33
+ },
34
+ position: 'side-start',
35
+ });
36
+ const size = getLimitedValue(minAiDrawerSize, activeAiDrawerSize, maxAiDrawerSize);
37
+ const isExpanded = (activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.isExpandable) && expandedDrawerId === activeDrawerId;
38
+ const wasExpanded = usePrevious(isExpanded);
39
+ const animationDisabled = ((activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.defaultActive) && !(drawersOpenQueue === null || drawersOpenQueue === void 0 ? void 0 : drawersOpenQueue.includes(activeAiDrawer.id))) || (wasExpanded && !isExpanded);
40
+ const drawerHeight = `calc(100vh - ${verticalOffsets.toolbar + placement.insetBlockEnd}px)`;
41
+ // disable resizing when the drawer is at its minimum width in a "squeezed" state
42
+ // (window is between mobile and desktop sizes). At this point, the drawer can't be
43
+ // resized in either direction, so we disable the resize handler
44
+ const isResizingDisabled = maxAiDrawerSize < activeAiDrawerSize;
45
+ return (React.createElement(Transition, { nodeRef: drawerRef, in: show, appear: show, mountOnEnter: true, timeout: 250 }, drawerTransitionState => {
46
+ return (React.createElement(Transition, { nodeRef: drawerRef, in: isExpanded, timeout: 250 }, expandedTransitionState => {
47
+ var _a, _b, _c, _d, _e, _f;
48
+ return (React.createElement("aside", { id: activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.id, "aria-hidden": !activeAiDrawer, "aria-label": computedAriaLabels.content, className: clsx(styles.drawer, styles['ai-drawer'], !animationDisabled && isExpanded && styles['with-expanded-motion'], {
49
+ [sharedStyles['with-motion-horizontal']]: !animationDisabled,
50
+ [testutilStyles['active-drawer']]: show,
51
+ [styles['drawer-hidden']]: !show && drawerTransitionState === 'exited',
52
+ [testutilStyles['drawer-closed']]: !activeAiDrawer,
53
+ [styles['drawer-expanded']]: isExpanded,
54
+ }), ref: drawerRef, onBlur: e => {
55
+ if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {
56
+ aiDrawerFocusControl === null || aiDrawerFocusControl === void 0 ? void 0 : aiDrawerFocusControl.loseFocus();
57
+ }
58
+ }, style: Object.assign({ blockSize: drawerHeight, insetBlockStart: `${placement.insetBlockStart}px` }, (!isMobile && {
59
+ [customCssProps.drawerSize]: `${['entering', 'entered'].includes(drawerTransitionState) ? size : 0}px`,
60
+ })), "data-testid": activeDrawerId && `awsui-app-layout-drawer-${activeDrawerId}` },
61
+ !isMobile && (activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.resizable) && (!isExpanded || expandedTransitionState !== 'entered') && (React.createElement("div", { className: styles['drawer-slider'] },
62
+ React.createElement(PanelResizeHandle, { ref: aiDrawerFocusControl === null || aiDrawerFocusControl === void 0 ? void 0 : aiDrawerFocusControl.refs.slider, position: "side-start", className: clsx(testutilStyles['drawers-slider'], styles['ai-drawer-slider-handle']), ariaLabel: (_a = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _a === void 0 ? void 0 : _a.resizeHandle, tooltipText: (_b = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _b === void 0 ? void 0 : _b.resizeHandleTooltipText, ariaValuenow: resizeProps.relativeSize, onKeyDown: resizeProps.onKeyDown, onPointerDown: resizeProps.onPointerDown, onDirectionClick: resizeProps.onDirectionClick, disabled: isResizingDisabled }))),
63
+ React.createElement("div", { className: clsx(styles['drawer-content-container'], sharedStyles['with-motion-horizontal']) },
64
+ React.createElement("div", { className: styles['drawer-content'] },
65
+ React.createElement("header", { className: styles['drawer-content-header'] },
66
+ React.createElement("div", { className: styles['drawer-content-header-content'] }, (_c = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.header) !== null && _c !== void 0 ? _c : React.createElement("div", null),
67
+ React.createElement("div", { className: styles['drawer-actions'] },
68
+ !isMobile && (activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.isExpandable) && (React.createElement("div", { className: styles['drawer-expanded-mode-button'] },
69
+ React.createElement(InternalButton, { ariaLabel: (_d = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _d === void 0 ? void 0 : _d.expandedModeButton, className: testutilStyles['active-drawer-expanded-mode-button'], formAction: "none", ariaExpanded: isExpanded, iconName: isExpanded ? 'shrink' : 'expand', onClick: () => setExpandedDrawerId(isExpanded ? null : activeDrawerId), variant: "icon", analyticsAction: isExpanded ? 'expand' : 'collapse' }))),
70
+ React.createElement("div", { className: clsx(styles['drawer-close-button']) },
71
+ React.createElement(InternalButton, { ariaLabel: computedAriaLabels.closeButton, className: clsx({
72
+ [testutilStyles['active-drawer-close-button']]: activeDrawerId,
73
+ }), formAction: "none", iconName: isMobile ? 'close' : 'angle-left', onClick: () => onActiveAiDrawerChange === null || onActiveAiDrawerChange === void 0 ? void 0 : onActiveAiDrawerChange(null, { initiatedByUserAction: true }), ref: aiDrawerFocusControl === null || aiDrawerFocusControl === void 0 ? void 0 : aiDrawerFocusControl.refs.close, variant: "icon", analyticsAction: "close" })))),
74
+ !isMobile && isExpanded && ((_e = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _e === void 0 ? void 0 : _e.exitExpandedModeButton) && (React.createElement("div", { className: styles['drawer-back-to-console-slot'] },
75
+ React.createElement("div", { className: styles['drawer-back-to-console-button-wrapper'] },
76
+ React.createElement("button", { className: clsx(testutilStyles['active-ai-drawer-leave-expanded-mode-custom-button'], styles['drawer-back-to-console-button']), formAction: "none", onClick: () => setExpandedDrawerId(null) }, (_f = activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.ariaLabels) === null || _f === void 0 ? void 0 : _f.exitExpandedModeButton))))), activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 :
77
+ activeAiDrawer.content))));
78
+ }));
79
+ }));
80
+ }
81
+ //# sourceMappingURL=global-ai-drawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global-ai-drawer.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,iBAAiB,MAAM,kDAAkD,CAAC;AACjF,OAAO,cAAc,MAAM,mDAAmD,CAAC;AAC/E,OAAO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,6BAAK,SAAS,EAAE,MAAM,CAAC,uCAAuC,CAAC;oCAC7D,gCACE,SAAS,EAAE,IAAI,CACb,cAAc,CAAC,oDAAoD,CAAC,EACpE,MAAM,CAAC,+BAA+B,CAAC,CACxC,EACD,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAEvC,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,0CAAE,sBAAsB,CAC5C,CACL,CACF,CACP,CACM,EACR,cAAc,aAAd,cAAc;wBAAd,cAAc,CAAE,OAAO,CACpB,CACF,CACA,CACT,CAAC;QACJ,CAAC,CACU,CACd,CAAC;IACJ,CAAC,CACU,CACd,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport { Transition } from 'react-transition-group';\nimport clsx from 'clsx';\n\nimport { InternalButton } from '../../../button/internal';\nimport PanelResizeHandle from '../../../internal/components/panel-resize-handle';\nimport customCssProps from '../../../internal/generated/custom-css-properties';\nimport { usePrevious } from '../../../internal/hooks/use-previous';\nimport { getLimitedValue } from '../../../split-panel/utils/size-utils';\nimport { AppLayoutProps } from '../../interfaces';\nimport { OnChangeParams } from '../../utils/use-ai-drawer';\nimport { FocusControlState } from '../../utils/use-focus-control';\nimport { AppLayoutInternals, InternalDrawer } from '../interfaces';\nimport { useResize } from './use-resize';\n\nimport sharedStyles from '../../resize/styles.css.js';\nimport testutilStyles from '../../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface AIDrawerProps {\n activeAiDrawerSize: number;\n minAiDrawerSize: number;\n aiDrawer: AppLayoutProps.Drawer | undefined;\n maxAiDrawerSize: number;\n ariaLabels: any;\n aiDrawerFocusControl: FocusControlState | undefined;\n isMobile: boolean;\n drawersOpenQueue: ReadonlyArray<string> | undefined;\n onActiveAiDrawerChange: undefined | ((newDrawerId: string | null, params?: OnChangeParams) => void);\n onActiveDrawerResize: (detail: { id: string; size: number }) => void;\n expandedDrawerId?: string | null;\n setExpandedDrawerId: (value: string | null) => void;\n}\n\ninterface AppLayoutGlobalAiDrawerImplementationProps {\n appLayoutInternals: AppLayoutInternals;\n show: boolean;\n activeAiDrawer: InternalDrawer | null;\n aiDrawerProps: AIDrawerProps;\n}\n\nexport function AppLayoutGlobalAiDrawerImplementation({\n appLayoutInternals,\n show,\n activeAiDrawer,\n aiDrawerProps,\n}: AppLayoutGlobalAiDrawerImplementationProps) {\n const {\n activeAiDrawerSize,\n minAiDrawerSize,\n maxAiDrawerSize,\n ariaLabels,\n aiDrawerFocusControl,\n isMobile,\n drawersOpenQueue,\n onActiveAiDrawerChange,\n onActiveDrawerResize,\n expandedDrawerId,\n setExpandedDrawerId,\n } = aiDrawerProps;\n const { verticalOffsets, placement } = appLayoutInternals;\n const drawerRef = useRef<HTMLDivElement>(null);\n const activeDrawerId = activeAiDrawer?.id;\n\n const computedAriaLabels = {\n closeButton: activeAiDrawer ? activeAiDrawer.ariaLabels?.closeButton : ariaLabels?.toolsClose,\n content: activeAiDrawer ? activeAiDrawer.ariaLabels?.drawerName : ariaLabels?.tools,\n };\n\n const resizeProps = useResize({\n currentWidth: activeAiDrawerSize,\n minWidth: minAiDrawerSize,\n maxWidth: maxAiDrawerSize,\n panelRef: drawerRef,\n handleRef: aiDrawerFocusControl!.refs.slider,\n onResize: size => {\n onActiveDrawerResize({ id: activeDrawerId!, size });\n },\n position: 'side-start',\n });\n const size = getLimitedValue(minAiDrawerSize, activeAiDrawerSize, maxAiDrawerSize);\n const isExpanded = activeAiDrawer?.isExpandable && expandedDrawerId === activeDrawerId;\n const wasExpanded = usePrevious(isExpanded);\n const animationDisabled =\n (activeAiDrawer?.defaultActive && !drawersOpenQueue?.includes(activeAiDrawer.id)) || (wasExpanded && !isExpanded);\n const drawerHeight = `calc(100vh - ${verticalOffsets.toolbar + placement.insetBlockEnd}px)`;\n // disable resizing when the drawer is at its minimum width in a \"squeezed\" state\n // (window is between mobile and desktop sizes). At this point, the drawer can't be\n // resized in either direction, so we disable the resize handler\n const isResizingDisabled = maxAiDrawerSize < activeAiDrawerSize;\n\n return (\n <Transition nodeRef={drawerRef} in={show} appear={show} mountOnEnter={true} timeout={250}>\n {drawerTransitionState => {\n return (\n <Transition nodeRef={drawerRef} in={isExpanded} timeout={250}>\n {expandedTransitionState => {\n return (\n <aside\n id={activeAiDrawer?.id}\n aria-hidden={!activeAiDrawer}\n aria-label={computedAriaLabels.content}\n className={clsx(\n styles.drawer,\n styles['ai-drawer'],\n !animationDisabled && isExpanded && styles['with-expanded-motion'],\n {\n [sharedStyles['with-motion-horizontal']]: !animationDisabled,\n [testutilStyles['active-drawer']]: show,\n [styles['drawer-hidden']]: !show && drawerTransitionState === 'exited',\n [testutilStyles['drawer-closed']]: !activeAiDrawer,\n [styles['drawer-expanded']]: isExpanded,\n }\n )}\n ref={drawerRef}\n onBlur={e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n aiDrawerFocusControl?.loseFocus();\n }\n }}\n style={{\n blockSize: drawerHeight,\n insetBlockStart: `${placement.insetBlockStart}px`,\n ...(!isMobile && {\n [customCssProps.drawerSize]: `${['entering', 'entered'].includes(drawerTransitionState) ? size : 0}px`,\n }),\n }}\n data-testid={activeDrawerId && `awsui-app-layout-drawer-${activeDrawerId}`}\n >\n {!isMobile && activeAiDrawer?.resizable && (!isExpanded || expandedTransitionState !== 'entered') && (\n <div className={styles['drawer-slider']}>\n <PanelResizeHandle\n ref={aiDrawerFocusControl?.refs.slider}\n position=\"side-start\"\n className={clsx(testutilStyles['drawers-slider'], styles['ai-drawer-slider-handle'])}\n ariaLabel={activeAiDrawer?.ariaLabels?.resizeHandle}\n tooltipText={activeAiDrawer?.ariaLabels?.resizeHandleTooltipText}\n ariaValuenow={resizeProps.relativeSize}\n onKeyDown={resizeProps.onKeyDown}\n onPointerDown={resizeProps.onPointerDown}\n onDirectionClick={resizeProps.onDirectionClick}\n disabled={isResizingDisabled}\n />\n </div>\n )}\n <div className={clsx(styles['drawer-content-container'], sharedStyles['with-motion-horizontal'])}>\n <div className={styles['drawer-content']}>\n <header className={styles['drawer-content-header']}>\n <div className={styles['drawer-content-header-content']}>\n {activeAiDrawer?.header ?? <div />}\n <div className={styles['drawer-actions']}>\n {!isMobile && activeAiDrawer?.isExpandable && (\n <div className={styles['drawer-expanded-mode-button']}>\n <InternalButton\n ariaLabel={activeAiDrawer?.ariaLabels?.expandedModeButton}\n className={testutilStyles['active-drawer-expanded-mode-button']}\n formAction=\"none\"\n ariaExpanded={isExpanded}\n iconName={isExpanded ? 'shrink' : 'expand'}\n onClick={() => setExpandedDrawerId(isExpanded ? null : activeDrawerId!)}\n variant=\"icon\"\n analyticsAction={isExpanded ? 'expand' : 'collapse'}\n />\n </div>\n )}\n <div className={clsx(styles['drawer-close-button'])}>\n <InternalButton\n ariaLabel={computedAriaLabels.closeButton}\n className={clsx({\n [testutilStyles['active-drawer-close-button']]: activeDrawerId,\n })}\n formAction=\"none\"\n iconName={isMobile ? 'close' : 'angle-left'}\n onClick={() => onActiveAiDrawerChange?.(null, { initiatedByUserAction: true })}\n ref={aiDrawerFocusControl?.refs.close}\n variant=\"icon\"\n analyticsAction=\"close\"\n />\n </div>\n </div>\n </div>\n {!isMobile && isExpanded && activeAiDrawer?.ariaLabels?.exitExpandedModeButton && (\n <div className={styles['drawer-back-to-console-slot']}>\n <div className={styles['drawer-back-to-console-button-wrapper']}>\n <button\n className={clsx(\n testutilStyles['active-ai-drawer-leave-expanded-mode-custom-button'],\n styles['drawer-back-to-console-button']\n )}\n formAction=\"none\"\n onClick={() => setExpandedDrawerId(null)}\n >\n {activeAiDrawer?.ariaLabels?.exitExpandedModeButton}\n </button>\n </div>\n </div>\n )}\n </header>\n {activeAiDrawer?.content}\n </div>\n </div>\n </aside>\n );\n }}\n </Transition>\n );\n }}\n </Transition>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"global-drawer.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-drawer.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAOnE,UAAU,wCAAwC;IAChD,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,kBAAkB,EAAE,cAAc,GAAG,SAAS,CAAC;CAChD;AAED,iBAAS,mCAAmC,CAAC,EAC3C,kBAAkB,EAClB,IAAI,EACJ,kBAAkB,GACnB,EAAE,wCAAwC,eA6J1C;AAED,eAAe,mCAAmC,CAAC"}
1
+ {"version":3,"file":"global-drawer.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-drawer.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAOnE,UAAU,wCAAwC;IAChD,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,kBAAkB,EAAE,cAAc,GAAG,SAAS,CAAC;CAChD;AAED,iBAAS,mCAAmC,CAAC,EAC3C,kBAAkB,EAClB,IAAI,EACJ,kBAAkB,GACnB,EAAE,wCAAwC,eA8J1C;AAED,eAAe,mCAAmC,CAAC"}
@@ -15,7 +15,7 @@ import testutilStyles from '../../test-classes/styles.css.js';
15
15
  import styles from './styles.css.js';
16
16
  function AppLayoutGlobalDrawerImplementation({ appLayoutInternals, show, activeGlobalDrawer, }) {
17
17
  var _a, _b, _c, _d, _e, _f;
18
- const { ariaLabels, globalDrawersFocusControl, isMobile, placement, onActiveGlobalDrawersChange, onActiveDrawerResize, minGlobalDrawersSizes, maxGlobalDrawersSizes, activeGlobalDrawersSizes, activeGlobalDrawers, verticalOffsets, drawersOpenQueue, expandedDrawerId, setExpandedDrawerId, } = appLayoutInternals;
18
+ const { ariaLabels, globalDrawersFocusControl, isMobile, placement, onActiveGlobalDrawersChange, onActiveDrawerResize, minGlobalDrawersSizes, maxGlobalDrawersSizes, activeGlobalDrawersSizes, activeGlobalDrawers, verticalOffsets, drawersOpenQueue, expandedDrawerId, setExpandedDrawerId, activeAiDrawer, } = appLayoutInternals;
19
19
  const drawerRef = useRef(null);
20
20
  const activeDrawerId = (_a = activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.id) !== null && _a !== void 0 ? _a : '';
21
21
  const computedAriaLabels = {
@@ -46,7 +46,7 @@ function AppLayoutGlobalDrawerImplementation({ appLayoutInternals, show, activeG
46
46
  var _a, _b, _c;
47
47
  return (React.createElement("aside", { id: activeDrawerId, "aria-hidden": !show, "aria-label": computedAriaLabels.content, className: clsx(styles.drawer, styles['drawer-global'], styles[state], !animationDisabled && sharedStyles['with-motion-horizontal'], !animationDisabled && isExpanded && styles['with-expanded-motion'], {
48
48
  [styles['drawer-hidden']]: !show,
49
- [styles['last-opened']]: lastOpenedDrawerId === activeDrawerId || isExpanded,
49
+ [styles['last-opened']]: (!activeAiDrawer && lastOpenedDrawerId === activeDrawerId) || isExpanded,
50
50
  [testutilStyles['active-drawer']]: show,
51
51
  [styles['drawer-expanded']]: isExpanded,
52
52
  [styles['has-next-siblings']]: activeGlobalDrawers.findIndex(drawer => drawer.id === activeDrawerId) + 1 <
@@ -1 +1 @@
1
- {"version":3,"file":"global-drawer.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-drawer.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,iBAAiB,MAAM,k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BACjD,oBAAC,cAAc,IACb,SAAS,EAAE,kBAAkB,CAAC,WAAW,EACzC,SAAS,EAAE,IAAI,CAAC;oCACd,CAAC,cAAc,CAAC,4BAA4B,CAAC,CAAC,EAAE,cAAc;iCAC/D,CAAC,EACF,UAAU,EAAC,MAAM,EACjB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,EAC5C,OAAO,EAAE,GAAG,EAAE,CAAC,2BAA2B,CAAC,cAAc,EAAE,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAAC,EAC3F,GAAG,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,EAChB,OAAO,EAAC,MAAM,EACd,eAAe,EAAC,OAAO,GACvB,CACE,CACF;oBACN,6BAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,IACzE,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,OAAO,CACxB,CACF,CACF,CACA,CACT,CAAC;IACJ,CAAC,CACU,CACd,CAAC;AACJ,CAAC;AAED,eAAe,mCAAmC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport { Transition } from 'react-transition-group';\nimport clsx from 'clsx';\n\nimport { InternalButton } from '../../../button/internal';\nimport PanelResizeHandle from '../../../internal/components/panel-resize-handle';\nimport customCssProps from '../../../internal/generated/custom-css-properties';\nimport { usePrevious } from '../../../internal/hooks/use-previous';\nimport { getLimitedValue } from '../../../split-panel/utils/size-utils';\nimport { getDrawerStyles } from '../compute-layout';\nimport { AppLayoutInternals, InternalDrawer } from '../interfaces';\nimport { useResize } from './use-resize';\n\nimport sharedStyles from '../../resize/styles.css.js';\nimport testutilStyles from '../../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface AppLayoutGlobalDrawerImplementationProps {\n appLayoutInternals: AppLayoutInternals;\n show: boolean;\n activeGlobalDrawer: InternalDrawer | undefined;\n}\n\nfunction AppLayoutGlobalDrawerImplementation({\n appLayoutInternals,\n show,\n activeGlobalDrawer,\n}: AppLayoutGlobalDrawerImplementationProps) {\n const {\n ariaLabels,\n globalDrawersFocusControl,\n isMobile,\n placement,\n onActiveGlobalDrawersChange,\n onActiveDrawerResize,\n minGlobalDrawersSizes,\n maxGlobalDrawersSizes,\n activeGlobalDrawersSizes,\n activeGlobalDrawers,\n verticalOffsets,\n drawersOpenQueue,\n expandedDrawerId,\n setExpandedDrawerId,\n } = appLayoutInternals;\n const drawerRef = useRef<HTMLDivElement>(null);\n const activeDrawerId = activeGlobalDrawer?.id ?? '';\n\n const computedAriaLabels = {\n closeButton: activeGlobalDrawer ? activeGlobalDrawer.ariaLabels?.closeButton : ariaLabels?.toolsClose,\n content: activeGlobalDrawer ? activeGlobalDrawer.ariaLabels?.drawerName : ariaLabels?.tools,\n };\n\n const { drawerTopOffset, drawerHeight } = getDrawerStyles(verticalOffsets, isMobile, placement);\n const activeDrawerSize = (activeDrawerId ? activeGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const minDrawerSize = (activeDrawerId ? minGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const maxDrawerSize = (activeDrawerId ? maxGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const refs = globalDrawersFocusControl.refs[activeDrawerId];\n const resizeProps = useResize({\n currentWidth: activeDrawerSize,\n minWidth: minDrawerSize,\n maxWidth: maxDrawerSize,\n panelRef: drawerRef,\n handleRef: refs?.slider,\n onResize: size => onActiveDrawerResize({ id: activeDrawerId!, size }),\n });\n const size = getLimitedValue(minDrawerSize, activeDrawerSize, maxDrawerSize);\n const lastOpenedDrawerId = drawersOpenQueue.length ? drawersOpenQueue[0] : null;\n const hasTriggerButton = !!activeGlobalDrawer?.trigger;\n const isExpanded = activeGlobalDrawer?.isExpandable && expandedDrawerId === activeDrawerId;\n const wasExpanded = usePrevious(isExpanded);\n const animationDisabled =\n (activeGlobalDrawer?.defaultActive && !drawersOpenQueue.includes(activeGlobalDrawer.id)) ||\n (wasExpanded && !isExpanded);\n\n return (\n <Transition nodeRef={drawerRef} in={show || isExpanded} appear={show || isExpanded} timeout={0}>\n {state => {\n return (\n <aside\n id={activeDrawerId}\n aria-hidden={!show}\n aria-label={computedAriaLabels.content}\n className={clsx(\n styles.drawer,\n styles['drawer-global'],\n styles[state],\n !animationDisabled && sharedStyles['with-motion-horizontal'],\n !animationDisabled && isExpanded && styles['with-expanded-motion'],\n {\n [styles['drawer-hidden']]: !show,\n [styles['last-opened']]: lastOpenedDrawerId === activeDrawerId || isExpanded,\n [testutilStyles['active-drawer']]: show,\n [styles['drawer-expanded']]: isExpanded,\n [styles['has-next-siblings']]:\n activeGlobalDrawers.findIndex(drawer => drawer.id === activeDrawerId) + 1 <\n activeGlobalDrawers.length,\n }\n )}\n ref={drawerRef}\n onBlur={e => {\n // Drawers with trigger buttons follow this restore focus logic:\n // If a previously focused element exists, restore focus on it; otherwise, focus on the associated trigger button.\n // This function resets the previously focused element.\n // If the drawer has no trigger button and loses focus on the previously focused element, it defaults to document.body,\n // which ideally should never happen.\n if (!hasTriggerButton) {\n return;\n }\n\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n globalDrawersFocusControl.loseFocus();\n }\n }}\n style={{\n blockSize: drawerHeight,\n insetBlockStart: drawerTopOffset,\n ...(!isMobile && {\n [customCssProps.drawerSize]: `${['entering', 'entered'].includes(state) ? (isExpanded ? '100%' : size + 'px') : 0}`,\n }),\n }}\n data-testid={`awsui-app-layout-drawer-${activeDrawerId}`}\n >\n <div className={clsx(styles['global-drawer-wrapper'])}>\n {!isMobile && <div className={styles['drawer-gap']}></div>}\n {!isMobile && activeGlobalDrawer?.resizable && !isExpanded && (\n <div className={styles['drawer-slider']}>\n <PanelResizeHandle\n ref={refs?.slider}\n position=\"side\"\n className={testutilStyles['drawers-slider']}\n ariaLabel={activeGlobalDrawer?.ariaLabels?.resizeHandle}\n tooltipText={activeGlobalDrawer?.ariaLabels?.resizeHandleTooltipText}\n ariaValuenow={resizeProps.relativeSize}\n onKeyDown={resizeProps.onKeyDown}\n onDirectionClick={resizeProps.onDirectionClick}\n onPointerDown={resizeProps.onPointerDown}\n />\n </div>\n )}\n\n <div\n className={clsx(styles['drawer-content-container'], sharedStyles['with-motion-horizontal'])}\n data-testid={`awsui-app-layout-drawer-content-${activeDrawerId}`}\n >\n <div className={styles['drawer-actions']}>\n {!isMobile && activeGlobalDrawer?.isExpandable && (\n <div className={styles['drawer-expanded-mode-button']}>\n <InternalButton\n ariaLabel={activeGlobalDrawer?.ariaLabels?.expandedModeButton}\n className={testutilStyles['active-drawer-expanded-mode-button']}\n formAction=\"none\"\n ariaExpanded={isExpanded}\n iconName={isExpanded ? 'shrink' : 'expand'}\n onClick={() => setExpandedDrawerId(isExpanded ? null : activeDrawerId)}\n variant=\"icon\"\n analyticsAction={isExpanded ? 'expand' : 'collapse'}\n />\n </div>\n )}\n <div className={clsx(styles['drawer-close-button'])}>\n <InternalButton\n ariaLabel={computedAriaLabels.closeButton}\n className={clsx({\n [testutilStyles['active-drawer-close-button']]: activeDrawerId,\n })}\n formAction=\"none\"\n iconName={isMobile ? 'close' : 'angle-right'}\n onClick={() => onActiveGlobalDrawersChange(activeDrawerId, { initiatedByUserAction: true })}\n ref={refs?.close}\n variant=\"icon\"\n analyticsAction=\"close\"\n />\n </div>\n </div>\n <div className={styles['drawer-content']} style={{ blockSize: drawerHeight }}>\n {activeGlobalDrawer?.content}\n </div>\n </div>\n </div>\n </aside>\n );\n }}\n </Transition>\n );\n}\n\nexport default AppLayoutGlobalDrawerImplementation;\n"]}
1
+ {"version":3,"file":"global-drawer.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-drawer.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO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AAmB,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,EACtE,OAAO,EAAC,MAAM,EACd,eAAe,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,GACnD,CACE,CACP;wBACD,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;4BACjD,oBAAC,cAAc,IACb,SAAS,EAAE,kBAAkB,CAAC,WAAW,EACzC,SAAS,EAAE,IAAI,CAAC;oCACd,CAAC,cAAc,CAAC,4BAA4B,CAAC,CAAC,EAAE,cAAc;iCAC/D,CAAC,EACF,UAAU,EAAC,MAAM,EACjB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,EAC5C,OAAO,EAAE,GAAG,EAAE,CAAC,2BAA2B,CAAC,cAAc,EAAE,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAAC,EAC3F,GAAG,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,EAChB,OAAO,EAAC,MAAM,EACd,eAAe,EAAC,OAAO,GACvB,CACE,CACF;oBACN,6BAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,IACzE,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,OAAO,CACxB,CACF,CACF,CACA,CACT,CAAC;IACJ,CAAC,CACU,CACd,CAAC;AACJ,CAAC;AAED,eAAe,mCAAmC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport { Transition } from 'react-transition-group';\nimport clsx from 'clsx';\n\nimport { InternalButton } from '../../../button/internal';\nimport PanelResizeHandle from '../../../internal/components/panel-resize-handle';\nimport customCssProps from '../../../internal/generated/custom-css-properties';\nimport { usePrevious } from '../../../internal/hooks/use-previous';\nimport { getLimitedValue } from '../../../split-panel/utils/size-utils';\nimport { getDrawerStyles } from '../compute-layout';\nimport { AppLayoutInternals, InternalDrawer } from '../interfaces';\nimport { useResize } from './use-resize';\n\nimport sharedStyles from '../../resize/styles.css.js';\nimport testutilStyles from '../../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface AppLayoutGlobalDrawerImplementationProps {\n appLayoutInternals: AppLayoutInternals;\n show: boolean;\n activeGlobalDrawer: InternalDrawer | undefined;\n}\n\nfunction AppLayoutGlobalDrawerImplementation({\n appLayoutInternals,\n show,\n activeGlobalDrawer,\n}: AppLayoutGlobalDrawerImplementationProps) {\n const {\n ariaLabels,\n globalDrawersFocusControl,\n isMobile,\n placement,\n onActiveGlobalDrawersChange,\n onActiveDrawerResize,\n minGlobalDrawersSizes,\n maxGlobalDrawersSizes,\n activeGlobalDrawersSizes,\n activeGlobalDrawers,\n verticalOffsets,\n drawersOpenQueue,\n expandedDrawerId,\n setExpandedDrawerId,\n activeAiDrawer,\n } = appLayoutInternals;\n const drawerRef = useRef<HTMLDivElement>(null);\n const activeDrawerId = activeGlobalDrawer?.id ?? '';\n\n const computedAriaLabels = {\n closeButton: activeGlobalDrawer ? activeGlobalDrawer.ariaLabels?.closeButton : ariaLabels?.toolsClose,\n content: activeGlobalDrawer ? activeGlobalDrawer.ariaLabels?.drawerName : ariaLabels?.tools,\n };\n\n const { drawerTopOffset, drawerHeight } = getDrawerStyles(verticalOffsets, isMobile, placement);\n const activeDrawerSize = (activeDrawerId ? activeGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const minDrawerSize = (activeDrawerId ? minGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const maxDrawerSize = (activeDrawerId ? maxGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const refs = globalDrawersFocusControl.refs[activeDrawerId];\n const resizeProps = useResize({\n currentWidth: activeDrawerSize,\n minWidth: minDrawerSize,\n maxWidth: maxDrawerSize,\n panelRef: drawerRef,\n handleRef: refs?.slider,\n onResize: size => onActiveDrawerResize({ id: activeDrawerId!, size }),\n });\n const size = getLimitedValue(minDrawerSize, activeDrawerSize, maxDrawerSize);\n const lastOpenedDrawerId = drawersOpenQueue.length ? drawersOpenQueue[0] : null;\n const hasTriggerButton = !!activeGlobalDrawer?.trigger;\n const isExpanded = activeGlobalDrawer?.isExpandable && expandedDrawerId === activeDrawerId;\n const wasExpanded = usePrevious(isExpanded);\n const animationDisabled =\n (activeGlobalDrawer?.defaultActive && !drawersOpenQueue.includes(activeGlobalDrawer.id)) ||\n (wasExpanded && !isExpanded);\n\n return (\n <Transition nodeRef={drawerRef} in={show || isExpanded} appear={show || isExpanded} timeout={0}>\n {state => {\n return (\n <aside\n id={activeDrawerId}\n aria-hidden={!show}\n aria-label={computedAriaLabels.content}\n className={clsx(\n styles.drawer,\n styles['drawer-global'],\n styles[state],\n !animationDisabled && sharedStyles['with-motion-horizontal'],\n !animationDisabled && isExpanded && styles['with-expanded-motion'],\n {\n [styles['drawer-hidden']]: !show,\n [styles['last-opened']]: (!activeAiDrawer && lastOpenedDrawerId === activeDrawerId) || isExpanded,\n [testutilStyles['active-drawer']]: show,\n [styles['drawer-expanded']]: isExpanded,\n [styles['has-next-siblings']]:\n activeGlobalDrawers.findIndex(drawer => drawer.id === activeDrawerId) + 1 <\n activeGlobalDrawers.length,\n }\n )}\n ref={drawerRef}\n onBlur={e => {\n // Drawers with trigger buttons follow this restore focus logic:\n // If a previously focused element exists, restore focus on it; otherwise, focus on the associated trigger button.\n // This function resets the previously focused element.\n // If the drawer has no trigger button and loses focus on the previously focused element, it defaults to document.body,\n // which ideally should never happen.\n if (!hasTriggerButton) {\n return;\n }\n\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n globalDrawersFocusControl.loseFocus();\n }\n }}\n style={{\n blockSize: drawerHeight,\n insetBlockStart: drawerTopOffset,\n ...(!isMobile && {\n [customCssProps.drawerSize]: `${['entering', 'entered'].includes(state) ? (isExpanded ? '100%' : size + 'px') : 0}`,\n }),\n }}\n data-testid={`awsui-app-layout-drawer-${activeDrawerId}`}\n >\n <div className={clsx(styles['global-drawer-wrapper'])}>\n {!isMobile && <div className={styles['drawer-gap']}></div>}\n {!isMobile && activeGlobalDrawer?.resizable && !isExpanded && (\n <div className={styles['drawer-slider']}>\n <PanelResizeHandle\n ref={refs?.slider}\n position=\"side\"\n className={testutilStyles['drawers-slider']}\n ariaLabel={activeGlobalDrawer?.ariaLabels?.resizeHandle}\n tooltipText={activeGlobalDrawer?.ariaLabels?.resizeHandleTooltipText}\n ariaValuenow={resizeProps.relativeSize}\n onKeyDown={resizeProps.onKeyDown}\n onDirectionClick={resizeProps.onDirectionClick}\n onPointerDown={resizeProps.onPointerDown}\n />\n </div>\n )}\n\n <div\n className={clsx(styles['drawer-content-container'], sharedStyles['with-motion-horizontal'])}\n data-testid={`awsui-app-layout-drawer-content-${activeDrawerId}`}\n >\n <div className={styles['drawer-actions']}>\n {!isMobile && activeGlobalDrawer?.isExpandable && (\n <div className={styles['drawer-expanded-mode-button']}>\n <InternalButton\n ariaLabel={activeGlobalDrawer?.ariaLabels?.expandedModeButton}\n className={testutilStyles['active-drawer-expanded-mode-button']}\n formAction=\"none\"\n ariaExpanded={isExpanded}\n iconName={isExpanded ? 'shrink' : 'expand'}\n onClick={() => setExpandedDrawerId(isExpanded ? null : activeDrawerId)}\n variant=\"icon\"\n analyticsAction={isExpanded ? 'expand' : 'collapse'}\n />\n </div>\n )}\n <div className={clsx(styles['drawer-close-button'])}>\n <InternalButton\n ariaLabel={computedAriaLabels.closeButton}\n className={clsx({\n [testutilStyles['active-drawer-close-button']]: activeDrawerId,\n })}\n formAction=\"none\"\n iconName={isMobile ? 'close' : 'angle-right'}\n onClick={() => onActiveGlobalDrawersChange(activeDrawerId, { initiatedByUserAction: true })}\n ref={refs?.close}\n variant=\"icon\"\n analyticsAction=\"close\"\n />\n </div>\n </div>\n <div className={styles['drawer-content']} style={{ blockSize: drawerHeight }}>\n {activeGlobalDrawer?.content}\n </div>\n </div>\n </div>\n </aside>\n );\n }}\n </Transition>\n );\n}\n\nexport default AppLayoutGlobalDrawerImplementation;\n"]}