@cloudscape-design/components 3.0.1 → 3.0.4

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 (68) hide show
  1. package/alert/interfaces.d.ts +1 -0
  2. package/alert/interfaces.d.ts.map +1 -1
  3. package/alert/interfaces.js.map +1 -1
  4. package/app-layout/index.d.ts.map +1 -1
  5. package/app-layout/index.js +16 -11
  6. package/app-layout/index.js.map +1 -1
  7. package/app-layout/test-classes/styles.css.js +13 -12
  8. package/app-layout/test-classes/styles.scoped.css +17 -13
  9. package/app-layout/test-classes/styles.selectors.js +13 -12
  10. package/app-layout/visual-refresh/context.d.ts +4 -2
  11. package/app-layout/visual-refresh/context.d.ts.map +1 -1
  12. package/app-layout/visual-refresh/context.js +31 -21
  13. package/app-layout/visual-refresh/context.js.map +1 -1
  14. package/app-layout/visual-refresh/layout.d.ts.map +1 -1
  15. package/app-layout/visual-refresh/layout.js +3 -13
  16. package/app-layout/visual-refresh/layout.js.map +1 -1
  17. package/app-layout/visual-refresh/split-panel.d.ts.map +1 -1
  18. package/app-layout/visual-refresh/split-panel.js +6 -2
  19. package/app-layout/visual-refresh/split-panel.js.map +1 -1
  20. package/code-editor/preferences-modal.js +2 -2
  21. package/code-editor/preferences-modal.js.map +1 -1
  22. package/container/styles.css.js +15 -14
  23. package/container/styles.scoped.css +28 -24
  24. package/container/styles.selectors.js +15 -14
  25. package/container/use-sticky-header.d.ts.map +1 -1
  26. package/container/use-sticky-header.js +19 -12
  27. package/container/use-sticky-header.js.map +1 -1
  28. package/flashbar/interfaces.d.ts +4 -4
  29. package/flashbar/interfaces.js.map +1 -1
  30. package/form-field/internal.js +3 -3
  31. package/form-field/internal.js.map +1 -1
  32. package/internal/base-component/styles.scoped.css +3 -0
  33. package/internal/components/dropdown/dropdown-fit-handler.js +1 -1
  34. package/internal/components/dropdown/dropdown-fit-handler.js.map +1 -1
  35. package/internal/context/app-layout-context.d.ts +1 -1
  36. package/internal/context/app-layout-context.d.ts.map +1 -1
  37. package/internal/context/app-layout-context.js +3 -4
  38. package/internal/context/app-layout-context.js.map +1 -1
  39. package/internal/context/form-field-context.d.ts +1 -1
  40. package/internal/context/form-field-context.d.ts.map +1 -1
  41. package/internal/context/form-field-context.js +3 -4
  42. package/internal/context/form-field-context.js.map +1 -1
  43. package/internal/environment.js +1 -1
  44. package/internal/generated/theming/index.cjs +14 -3
  45. package/internal/generated/theming/index.js +14 -3
  46. package/internal/utils/scrollable-containers.js +1 -1
  47. package/internal/utils/scrollable-containers.js.map +1 -1
  48. package/package.json +1 -1
  49. package/select/utils/use-select.d.ts.map +1 -1
  50. package/select/utils/use-select.js +1 -0
  51. package/select/utils/use-select.js.map +1 -1
  52. package/split-panel/index.js +2 -2
  53. package/split-panel/index.js.map +1 -1
  54. package/split-panel/utils/size-utils.d.ts +11 -0
  55. package/split-panel/utils/size-utils.d.ts.map +1 -1
  56. package/split-panel/utils/size-utils.js +12 -1
  57. package/split-panel/utils/size-utils.js.map +1 -1
  58. package/tag-editor/index.js +1 -1
  59. package/tag-editor/index.js.map +1 -1
  60. package/tag-editor/interfaces.d.ts +1 -1
  61. package/tag-editor/interfaces.d.ts.map +1 -1
  62. package/tag-editor/interfaces.js.map +1 -1
  63. package/tutorial-panel/components/tutorial-list/index.js +1 -1
  64. package/tutorial-panel/components/tutorial-list/index.js.map +1 -1
  65. package/internal/hooks/dom-context/index.d.ts +0 -14
  66. package/internal/hooks/dom-context/index.d.ts.map +0 -1
  67. package/internal/hooks/dom-context/index.js +0 -70
  68. package/internal/hooks/dom-context/index.js.map +0 -1
@@ -6,7 +6,7 @@ import { fireNonCancelableEvent } from '../../internal/events';
6
6
  import { getSplitPanelPosition } from './split-panel';
7
7
  import { useControllable } from '../../internal/hooks/use-controllable';
8
8
  import { useMobile } from '../../internal/hooks/use-mobile';
9
- import { useContainerQuery } from '../../internal/hooks/container-queries';
9
+ import { useContainerQuery, useResizeObserver } from '../../internal/hooks/container-queries';
10
10
  import { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';
11
11
  import styles from './styles.css.js';
12
12
  import { isDevelopment } from '../../internal/is-development';
@@ -22,7 +22,8 @@ var defaults = {
22
22
  disableContentHeaderOverlap: false,
23
23
  disableContentPaddings: false,
24
24
  dynamicOverlapHeight: 0,
25
- footerSelector: '#b #f',
25
+ headerHeight: 0,
26
+ footerHeight: 0,
26
27
  handleNavigationClick: function (value) { return value; },
27
28
  handleSplitPanelClick: function () { },
28
29
  handleSplitPanelPreferencesChange: function () { },
@@ -30,7 +31,6 @@ var defaults = {
30
31
  handleToolsClick: function (value) { return value; },
31
32
  hasDefaultToolsWidth: true,
32
33
  hasNotificationsContent: false,
33
- headerSelector: '#b #h',
34
34
  isAnyPanelOpen: false,
35
35
  isMobile: false,
36
36
  isNavigationOpen: false,
@@ -78,7 +78,7 @@ var defaults = {
78
78
  export var AppLayoutContext = createContext(__assign({}, defaults));
79
79
  export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
80
80
  var _b, _c, _d;
81
- var toolsHide = _a.toolsHide, controlledToolsOpen = _a.toolsOpen, navigationHide = _a.navigationHide, controlledNavigationOpen = _a.navigationOpen, _e = _a.contentType, contentType = _e === void 0 ? 'default' : _e, children = _a.children, props = __rest(_a, ["toolsHide", "toolsOpen", "navigationHide", "navigationOpen", "contentType", "children"]);
81
+ var toolsHide = _a.toolsHide, controlledToolsOpen = _a.toolsOpen, navigationHide = _a.navigationHide, controlledNavigationOpen = _a.navigationOpen, _e = _a.contentType, contentType = _e === void 0 ? 'default' : _e, _f = _a.headerSelector, headerSelector = _f === void 0 ? '#b #h' : _f, _g = _a.footerSelector, footerSelector = _g === void 0 ? '#b #h' : _g, children = _a.children, props = __rest(_a, ["toolsHide", "toolsOpen", "navigationHide", "navigationOpen", "contentType", "headerSelector", "footerSelector", "children"]);
82
82
  var isMobile = useMobile();
83
83
  if (isDevelopment) {
84
84
  if (controlledToolsOpen && toolsHide) {
@@ -89,7 +89,7 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
89
89
  * The overlap height has a default set in CSS but can also be dynamically overridden
90
90
  * for content types (such as Table and Wizard) that have variable size content in the overlap.
91
91
  */
92
- var _f = useState(0), dynamicOverlapHeight = _f[0], setDynamicOverlapHeight = _f[1];
92
+ var _h = useState(0), dynamicOverlapHeight = _h[0], setDynamicOverlapHeight = _h[1];
93
93
  /**
94
94
  * Set the default values for minimum and maximum content width.
95
95
  */
@@ -120,7 +120,7 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
120
120
  * useControllable hook and also fire the onNavigationChange function to
121
121
  * emit the state change.
122
122
  */
123
- var _g = useControllable(controlledNavigationOpen, props.onNavigationChange, isMobile ? false : contentTypeDefaults.navigationOpen, { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }), _h = _g[0], isNavigationOpen = _h === void 0 ? false : _h, setIsNavigationOpen = _g[1];
123
+ var _j = useControllable(controlledNavigationOpen, props.onNavigationChange, isMobile ? false : contentTypeDefaults.navigationOpen, { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }), _k = _j[0], isNavigationOpen = _k === void 0 ? false : _k, setIsNavigationOpen = _j[1];
124
124
  var handleNavigationClick = useCallback(function handleNavigationChange(isOpen) {
125
125
  setIsNavigationOpen(isOpen);
126
126
  fireNonCancelableEvent(props.onNavigationChange, { open: isOpen });
@@ -138,7 +138,7 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
138
138
  */
139
139
  var toolsWidth = (_d = props.toolsWidth) !== null && _d !== void 0 ? _d : 290;
140
140
  var hasDefaultToolsWidth = props.toolsWidth === undefined;
141
- var _j = useControllable(controlledToolsOpen, props.onToolsChange, isMobile ? false : contentTypeDefaults.toolsOpen, { componentName: 'AppLayout', controlledProp: 'toolsOpen', changeHandler: 'onToolsChange' }), _k = _j[0], isToolsOpen = _k === void 0 ? false : _k, setIsToolsOpen = _j[1];
141
+ var _l = useControllable(controlledToolsOpen, props.onToolsChange, isMobile ? false : contentTypeDefaults.toolsOpen, { componentName: 'AppLayout', controlledProp: 'toolsOpen', changeHandler: 'onToolsChange' }), _m = _l[0], isToolsOpen = _m === void 0 ? false : _m, setIsToolsOpen = _l[1];
142
142
  var handleToolsClick = useCallback(function handleToolsChange(isOpen) {
143
143
  setIsToolsOpen(isOpen);
144
144
  fireNonCancelableEvent(props.onToolsChange, { open: isOpen });
@@ -180,6 +180,16 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
180
180
  }
181
181
  };
182
182
  }, [isMobile, handleNavigationClick, handleToolsClick]);
183
+ /**
184
+ * Query the DOM for the header and footer elements based on the selectors provided
185
+ * by the properties and pass the heights to the custom property definitions.
186
+ */
187
+ var _o = useState(0), headerHeight = _o[0], setHeaderHeight = _o[1];
188
+ var getHeader = useCallback(function () { return document.querySelector(headerSelector); }, [headerSelector]);
189
+ useResizeObserver(getHeader, function (entry) { return setHeaderHeight(entry.borderBoxHeight); });
190
+ var _p = useState(0), footerHeight = _p[0], setFooterHeight = _p[1];
191
+ var getFooter = useCallback(function () { return document.querySelector(footerSelector); }, [footerSelector]);
192
+ useResizeObserver(getFooter, function (entry) { return setFooterHeight(entry.borderBoxHeight); });
183
193
  /**
184
194
  * Set the default values for the minimum and maximum Split Panel width when it is
185
195
  * in the side position. The useLayoutEffect will compute the available space in the
@@ -188,7 +198,7 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
188
198
  * a forced position on the bottom.
189
199
  */
190
200
  var splitPanelMinWidth = 280;
191
- var _l = useState(splitPanelMinWidth), splitPanelMaxWidth = _l[0], setSplitPanelMaxWidth = _l[1];
201
+ var _q = useState(splitPanelMinWidth), splitPanelMaxWidth = _q[0], setSplitPanelMaxWidth = _q[1];
192
202
  /**
193
203
  * The useControllable hook will set the default value and manage either
194
204
  * the controlled or uncontrolled state of the Split Panel. By default
@@ -199,7 +209,7 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
199
209
  * to open or closed given the current state. It will set the isSplitPanelOpen
200
210
  * controlled state and fire the onSplitPanelToggle event.
201
211
  */
202
- var _m = useControllable(props.splitPanelOpen, props.onSplitPanelToggle, false, { componentName: 'AppLayout', controlledProp: 'splitPanelOpen', changeHandler: 'onSplitPanelToggle' }), isSplitPanelOpen = _m[0], setIsSplitPanelOpen = _m[1];
212
+ var _r = useControllable(props.splitPanelOpen, props.onSplitPanelToggle, false, { componentName: 'AppLayout', controlledProp: 'splitPanelOpen', changeHandler: 'onSplitPanelToggle' }), isSplitPanelOpen = _r[0], setIsSplitPanelOpen = _r[1];
203
213
  var handleSplitPanelClick = useCallback(function handleSplitPanelChange() {
204
214
  setIsSplitPanelOpen(!isSplitPanelOpen);
205
215
  fireNonCancelableEvent(props.onSplitPanelToggle, { open: !isSplitPanelOpen });
@@ -214,11 +224,11 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
214
224
  * object that will determine if the SplitPanel is rendered either on the
215
225
  * bottom of the viewport or within the Tools container.
216
226
  */
217
- var _o = useControllable(props.splitPanelPreferences, props.onSplitPanelPreferencesChange, undefined, {
227
+ var _s = useControllable(props.splitPanelPreferences, props.onSplitPanelPreferencesChange, undefined, {
218
228
  componentName: 'AppLayout',
219
229
  controlledProp: 'splitPanelPreferences',
220
230
  changeHandler: 'onSplitPanelPreferencesChange'
221
- }), splitPanelPreferences = _o[0], setSplitPanelPreferences = _o[1];
231
+ }), splitPanelPreferences = _s[0], setSplitPanelPreferences = _s[1];
222
232
  /**
223
233
  * The Split Panel will be in forced (bottom) position if the defined minimum width is
224
234
  * greater than the maximum width. In other words, the maximum width is the currently
@@ -226,7 +236,7 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
226
236
  * minimum width exceeds this value then there is not enough horizontal space and we must
227
237
  * force it to the bottom position.
228
238
  */
229
- var _p = useState(false), isSplitPanelForcedPosition = _p[0], setSplitPanelForcedPosition = _p[1];
239
+ var _t = useState(false), isSplitPanelForcedPosition = _t[0], setSplitPanelForcedPosition = _t[1];
230
240
  var splitPanelPosition = getSplitPanelPosition(isSplitPanelForcedPosition, splitPanelPreferences);
231
241
  useLayoutEffect(function handleSplitPanelForcePosition() {
232
242
  setSplitPanelForcedPosition(splitPanelMinWidth > splitPanelMaxWidth);
@@ -242,8 +252,8 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
242
252
  * It will set the splitPanelControlledSize controlled state and fire the
243
253
  * onSplitPanelResize event.
244
254
  */
245
- var _q = useState(0), splitPanelReportedSize = _q[0], setSplitPanelReportedSize = _q[1];
246
- var _r = useControllable(props.splitPanelSize, props.onSplitPanelResize, getSplitPanelDefaultSize(splitPanelPosition), { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' }), splitPanelSize = _r[0], setSplitPanelSize = _r[1];
255
+ var _u = useState(0), splitPanelReportedSize = _u[0], setSplitPanelReportedSize = _u[1];
256
+ var _v = useControllable(props.splitPanelSize, props.onSplitPanelResize, getSplitPanelDefaultSize(splitPanelPosition), { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' }), splitPanelSize = _v[0], setSplitPanelSize = _v[1];
247
257
  var handleSplitPanelResize = useCallback(function handleSplitPanelChange(detail) {
248
258
  setSplitPanelSize(detail.size);
249
259
  fireNonCancelableEvent(props.onSplitPanelResize, detail);
@@ -267,10 +277,10 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
267
277
  * This value is used to determine the max width constraint calculation
268
278
  * for the Tools container.
269
279
  */
270
- var _s = useContainerQuery(function (rect) { return rect.width; }), layoutContainerQuery = _s[0], layoutElement = _s[1];
280
+ var _w = useContainerQuery(function (rect) { return rect.width; }), layoutContainerQuery = _w[0], layoutElement = _w[1];
271
281
  var layoutWidth = layoutContainerQuery !== null && layoutContainerQuery !== void 0 ? layoutContainerQuery : 0;
272
282
  var mainElement = useRef(null);
273
- var _t = useState(0), mainOffsetLeft = _t[0], setMainOffsetLeft = _t[1];
283
+ var _x = useState(0), mainOffsetLeft = _x[0], setMainOffsetLeft = _x[1];
274
284
  useLayoutEffect(function handleMainOffsetLeft() {
275
285
  var _a, _b;
276
286
  setMainOffsetLeft((_b = (_a = mainElement === null || mainElement === void 0 ? void 0 : mainElement.current) === null || _a === void 0 ? void 0 : _a.offsetLeft) !== null && _b !== void 0 ? _b : 0);
@@ -316,9 +326,9 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
316
326
  * that it is not repeated in various components (such as AppBar) that need to
317
327
  * know if the notifications slot is empty.
318
328
  */
319
- var _u = useContainerQuery(function (rect) { return rect.height; }), notificationsContainerQuery = _u[0], notificationsElement = _u[1];
320
- var _v = useState(0), notificationsHeight = _v[0], setNotificationsHeight = _v[1];
321
- var _w = useState(false), hasNotificationsContent = _w[0], setHasNotificationsContent = _w[1];
329
+ var _y = useContainerQuery(function (rect) { return rect.height; }), notificationsContainerQuery = _y[0], notificationsElement = _y[1];
330
+ var _z = useState(0), notificationsHeight = _z[0], setNotificationsHeight = _z[1];
331
+ var _0 = useState(false), hasNotificationsContent = _0[0], setHasNotificationsContent = _0[1];
322
332
  useEffect(function handleNotificationsContent() {
323
333
  setNotificationsHeight(notificationsContainerQuery !== null && notificationsContainerQuery !== void 0 ? notificationsContainerQuery : 0);
324
334
  setHasNotificationsContent(notificationsContainerQuery && notificationsContainerQuery > 0 ? true : false);
@@ -329,7 +339,7 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
329
339
  * is either a footer outside of the AppLayout, a SplitPanel in the bottom position
330
340
  * within the AppLayout, or both.
331
341
  */
332
- var _x = useState(0), offsetBottom = _x[0], setOffsetBottom = _x[1];
333
- return (React.createElement(AppLayoutContext.Provider, { value: __assign(__assign(__assign({}, defaults), props), { contentType: contentType, dynamicOverlapHeight: dynamicOverlapHeight, hasDefaultToolsWidth: hasDefaultToolsWidth, handleNavigationClick: handleNavigationClick, handleSplitPanelClick: handleSplitPanelClick, handleSplitPanelPreferencesChange: handleSplitPanelPreferencesChange, handleSplitPanelResize: handleSplitPanelResize, handleToolsClick: handleToolsClick, hasNotificationsContent: hasNotificationsContent, isAnyPanelOpen: isAnyPanelOpen, isMobile: isMobile, isNavigationOpen: isNavigationOpen !== null && isNavigationOpen !== void 0 ? isNavigationOpen : false, isSplitPanelForcedPosition: isSplitPanelForcedPosition, isSplitPanelOpen: isSplitPanelOpen, isToolsOpen: isToolsOpen, layoutElement: layoutElement, layoutWidth: layoutWidth, mainElement: mainElement, mainOffsetLeft: mainOffsetLeft, maxContentWidth: maxContentWidth, minContentWidth: minContentWidth, navigationHide: navigationHide, notificationsElement: notificationsElement, notificationsHeight: notificationsHeight, offsetBottom: offsetBottom, setDynamicOverlapHeight: setDynamicOverlapHeight, setOffsetBottom: setOffsetBottom, setSplitPanelReportedSize: setSplitPanelReportedSize, splitPanelMaxWidth: splitPanelMaxWidth, splitPanelMinWidth: splitPanelMinWidth, splitPanelPosition: splitPanelPosition, splitPanelPreferences: splitPanelPreferences, splitPanelReportedSize: splitPanelReportedSize, splitPanelSize: splitPanelSize, toolsHide: toolsHide, toolsOpen: isToolsOpen, toolsWidth: toolsWidth }) }, children));
342
+ var _1 = useState(0), offsetBottom = _1[0], setOffsetBottom = _1[1];
343
+ return (React.createElement(AppLayoutContext.Provider, { value: __assign(__assign(__assign({}, defaults), props), { contentType: contentType, dynamicOverlapHeight: dynamicOverlapHeight, headerHeight: headerHeight, footerHeight: footerHeight, hasDefaultToolsWidth: hasDefaultToolsWidth, handleNavigationClick: handleNavigationClick, handleSplitPanelClick: handleSplitPanelClick, handleSplitPanelPreferencesChange: handleSplitPanelPreferencesChange, handleSplitPanelResize: handleSplitPanelResize, handleToolsClick: handleToolsClick, hasNotificationsContent: hasNotificationsContent, isAnyPanelOpen: isAnyPanelOpen, isMobile: isMobile, isNavigationOpen: isNavigationOpen !== null && isNavigationOpen !== void 0 ? isNavigationOpen : false, isSplitPanelForcedPosition: isSplitPanelForcedPosition, isSplitPanelOpen: isSplitPanelOpen, isToolsOpen: isToolsOpen, layoutElement: layoutElement, layoutWidth: layoutWidth, mainElement: mainElement, mainOffsetLeft: mainOffsetLeft, maxContentWidth: maxContentWidth, minContentWidth: minContentWidth, navigationHide: navigationHide, notificationsElement: notificationsElement, notificationsHeight: notificationsHeight, offsetBottom: offsetBottom, setDynamicOverlapHeight: setDynamicOverlapHeight, setOffsetBottom: setOffsetBottom, setSplitPanelReportedSize: setSplitPanelReportedSize, splitPanelMaxWidth: splitPanelMaxWidth, splitPanelMinWidth: splitPanelMinWidth, splitPanelPosition: splitPanelPosition, splitPanelPreferences: splitPanelPreferences, splitPanelReportedSize: splitPanelReportedSize, splitPanelSize: splitPanelSize, toolsHide: toolsHide, toolsOpen: isToolsOpen, toolsWidth: toolsWidth }) }, children));
334
344
  });
335
345
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/context.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EACZ,aAAa,EACb,SAAS,EACT,WAAW,EACX,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,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AC1B,gBAAgB,kBAAA,EAChB,WAAW,aAAA,EACX,aAAa,eAAA,EACb,WAAW,aAAA,EACX,WAAW,aAAA,EACX,cAAc,gBAAA,EACd,eAAe,iBAAA,EACf,eAAe,iBAAA,EACf,cAAc,gBAAA,EACd,oBAAoB,sBAAA,EACpB,mBAAmB,qBAAA,EACnB,YAAY,cAAA,EACZ,uBAAuB,yBAAA,EACvB,eAAe,iBAAA,EACf,yBAAyB,2BAAA,EACzB,kBAAkB,oBAAA,EAClB,kBAAkB,oBAAA,EAClB,kBAAkB,oBAAA,EAClB,qBAAqB,uBAAA,EACrB,sBAAsB,wBAAA,EACtB,cAAc,gBAAA,EACd,SAAS,WAAA,EACT,SAAS,EAAE,WAAW,EACtB,UAAU,YAAA,OAGX,QAAQ,CACiB,CAC7B,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, {\n createContext,\n createRef,\n useCallback,\n useEffect,\n useLayoutEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport { AppLayoutProps } from '../interfaces';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport { getSplitPanelPosition } from './split-panel';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { useMobile } from '../../internal/hooks/use-mobile';\nimport { useContainerQuery } from '../../internal/hooks/container-queries';\nimport { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';\nimport styles from './styles.css.js';\nimport { isDevelopment } from '../../internal/is-development';\nimport { warnOnce } from '../../internal/logging';\nimport { applyDefaults } from '../defaults';\n\ninterface AppLayoutContextProps extends AppLayoutProps {\n dynamicOverlapHeight: number;\n handleSplitPanelClick: () => void;\n handleNavigationClick: (isOpen: boolean) => void;\n handleSplitPanelPreferencesChange: (detail: AppLayoutProps.SplitPanelPreferences) => void;\n handleSplitPanelResize: (detail: { size: number }) => void;\n handleToolsClick: (value: boolean) => void;\n hasDefaultToolsWidth: boolean;\n hasNotificationsContent: boolean;\n isAnyPanelOpen: boolean;\n isMobile: boolean;\n isNavigationOpen: boolean;\n isSplitPanelForcedPosition: boolean;\n isSplitPanelOpen?: boolean;\n isToolsOpen?: boolean;\n layoutElement: React.Ref<HTMLElement>;\n layoutWidth: number;\n mainElement: React.Ref<HTMLDivElement>;\n mainOffsetLeft: number;\n notificationsElement: React.Ref<HTMLDivElement>;\n notificationsHeight: number;\n offsetBottom: number;\n setDynamicOverlapHeight: (value: number) => void;\n setIsNavigationOpen: (value: boolean) => void;\n setIsToolsOpen: (value: boolean) => void;\n setOffsetBottom: (value: number) => void;\n setSplitPanelReportedSize: (value: number) => void;\n splitPanelMaxWidth: number;\n splitPanelMinWidth: number;\n splitPanelPosition: AppLayoutProps.SplitPanelPosition;\n splitPanelReportedSize: number;\n // overwritten styles - marking as required since we provide default values in the context\n headerSelector: string;\n footerSelector: string;\n}\n\n// TODO simplify default params + typings\nconst defaults: AppLayoutContextProps = {\n breadcrumbs: null,\n content: null,\n contentHeader: null,\n contentType: 'default',\n disableBodyScroll: false,\n disableContentHeaderOverlap: false,\n disableContentPaddings: false,\n dynamicOverlapHeight: 0,\n footerSelector: '#b #f',\n handleNavigationClick: (value: boolean) => value,\n handleSplitPanelClick: () => {},\n handleSplitPanelPreferencesChange: () => {},\n handleSplitPanelResize: () => {},\n handleToolsClick: (value: boolean) => value,\n hasDefaultToolsWidth: true,\n hasNotificationsContent: false,\n headerSelector: '#b #h',\n isAnyPanelOpen: false,\n isMobile: false,\n isNavigationOpen: false,\n isSplitPanelForcedPosition: false,\n isSplitPanelOpen: false,\n isToolsOpen: false,\n // TODO: these refs are currently only instantiated once globally\n layoutElement: createRef<HTMLElement>(),\n layoutWidth: 0,\n mainElement: createRef<HTMLDivElement>(),\n mainOffsetLeft: 0,\n maxContentWidth: 0,\n minContentWidth: 280,\n navigation: null,\n navigationHide: false,\n navigationOpen: false,\n notifications: null,\n notificationsElement: createRef<HTMLDivElement>(),\n notificationsHeight: 0,\n offsetBottom: 0,\n onNavigationChange: () => {},\n onSplitPanelResize: () => {},\n onSplitPanelToggle: () => {},\n onSplitPanelPreferencesChange: () => {},\n setDynamicOverlapHeight: (value: number) => void value,\n setIsNavigationOpen: (value: boolean) => value,\n setIsToolsOpen: (value: boolean) => value,\n setOffsetBottom: (value: number) => void value,\n setSplitPanelReportedSize: (value: number) => void value,\n splitPanelMaxWidth: 280,\n splitPanelMinWidth: 280,\n splitPanelOpen: false,\n splitPanelPosition: 'bottom',\n splitPanelPreferences: { position: 'bottom' },\n splitPanelReportedSize: 0,\n splitPanelSize: 0,\n stickyNotifications: false,\n tools: null,\n};\n\n/**\n * The default values are destructured in the context instantiation to\n * prevent downstream Typescript errors. This could likely be replaced\n * by a context interface definition that extends the AppLayout interface.\n */\nexport const AppLayoutContext = createContext({ ...defaults });\n\ntype AppLayoutProviderProps = AppLayoutProps & {\n children: React.ReactNode;\n};\n\nexport const AppLayoutProvider = React.forwardRef(\n (\n {\n toolsHide,\n toolsOpen: controlledToolsOpen,\n navigationHide,\n navigationOpen: controlledNavigationOpen,\n contentType = 'default',\n children,\n ...props\n }: AppLayoutProviderProps,\n forwardRef: React.Ref<AppLayoutProps.Ref>\n ) => {\n const isMobile = useMobile();\n\n if (isDevelopment) {\n if (controlledToolsOpen && toolsHide) {\n warnOnce(\n 'AppLayout',\n `You have enabled both the \\`toolsOpen\\` prop and the \\`toolsHide\\` prop. This is not supported. Set \\`toolsOpen\\` to \\`false\\` when you set \\`toolsHide\\` to \\`true\\`.`\n );\n }\n }\n\n /**\n * The overlap height has a default set in CSS but can also be dynamically overridden\n * for content types (such as Table and Wizard) that have variable size content in the overlap.\n */\n const [dynamicOverlapHeight, setDynamicOverlapHeight] = useState(0);\n\n /**\n * Set the default values for minimum and maximum content width.\n */\n const geckoMaxCssLength = ((1 << 30) - 1) / 60;\n const halfGeckoMaxCssLength = geckoMaxCssLength / 2;\n // CSS lengths in Gecko are limited to at most (1<<30)-1 app units (Gecko uses 60 as app unit).\n // Limit the maxContentWidth to the half of the upper boundary (≈4230^2) to be on the safe side.\n const maxContentWidth =\n props.maxContentWidth && props.maxContentWidth > halfGeckoMaxCssLength\n ? halfGeckoMaxCssLength\n : props.maxContentWidth ?? 0;\n const minContentWidth = props.minContentWidth ?? 280;\n\n /**\n * Determine the default state of the Navigation and Tools drawers.\n * Mobile viewports should be closed by default under all circumstances.\n * If the navigationOpen prop has been set then that should take precedence\n * over the contentType prop. Desktop viewports that do not have the\n * navigationOpen or contentType props set will use the default contentType.\n */\n const contentTypeDefaults = applyDefaults(contentType, { maxContentWidth, minContentWidth }, true);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Navigation drawer. The logic\n * for determining the default state is colocated with the Navigation component.\n *\n * The callback that will be passed to the Navigation and AppBar\n * components to handle the click events that will change the state\n * of the Navigation drawer. It will set the Navigation state with the\n * useControllable hook and also fire the onNavigationChange function to\n * emit the state change.\n */\n const [isNavigationOpen = false, setIsNavigationOpen] = useControllable(\n controlledNavigationOpen,\n props.onNavigationChange,\n isMobile ? false : contentTypeDefaults.navigationOpen,\n { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }\n );\n\n const handleNavigationClick = useCallback(\n function handleNavigationChange(isOpen: boolean) {\n setIsNavigationOpen(isOpen);\n fireNonCancelableEvent(props.onNavigationChange, { open: isOpen });\n },\n [props.onNavigationChange, setIsNavigationOpen]\n );\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Tools drawer. The logic\n * for determining the default state is colocated with the Tools component.\n *\n * The callback that will be passed to the Navigation and AppBar\n * components to handle the click events that will change the state\n * of the Tools drawer. It will set the Tools state with the\n * useControllable hook and also fire the onToolsChange function to\n * emit the state change.\n */\n const toolsWidth = props.toolsWidth ?? 290;\n const hasDefaultToolsWidth = props.toolsWidth === undefined;\n\n const [isToolsOpen = false, setIsToolsOpen] = useControllable(\n controlledToolsOpen,\n props.onToolsChange,\n isMobile ? false : contentTypeDefaults.toolsOpen,\n { componentName: 'AppLayout', controlledProp: 'toolsOpen', changeHandler: 'onToolsChange' }\n );\n\n const handleToolsClick = useCallback(\n function handleToolsChange(isOpen: boolean) {\n setIsToolsOpen(isOpen);\n fireNonCancelableEvent(props.onToolsChange, { open: isOpen });\n },\n [props.onToolsChange, setIsToolsOpen]\n );\n\n const navigationVisible = !navigationHide && isNavigationOpen;\n const toolsVisible = !toolsHide && isToolsOpen;\n const isAnyPanelOpen = navigationVisible || toolsVisible;\n\n /**\n * On mobile viewports the navigation and tools drawers are adjusted to a fixed position\n * that consumes 100% of the viewport height and width. The body content could potentially\n * be scrollable underneath the drawer. In order to prevent this a CSS class needs to be\n * added to the document body that sets overflow to hidden.\n */\n useEffect(\n function handleBodyScroll() {\n if (isMobile && (isNavigationOpen || isToolsOpen)) {\n document.body.classList.add(styles['block-body-scroll']);\n } else {\n document.body.classList.remove(styles['block-body-scroll']);\n }\n\n // Ensure the CSS class is removed from the body on side effect cleanup\n return function cleanup() {\n document.body.classList.remove(styles['block-body-scroll']);\n };\n },\n [isMobile, isNavigationOpen, isToolsOpen]\n );\n\n /**\n * The useImperativeHandle hook in conjunction with the forwardRef function\n * in the AppLayout component definition expose the following callable\n * functions to component consumers when they put a ref as a property on\n * their component implementation.\n */\n useImperativeHandle(\n forwardRef,\n function createImperativeHandle() {\n return {\n closeNavigationIfNecessary: function () {\n isMobile && handleNavigationClick(false);\n },\n openTools: function () {\n handleToolsClick(true);\n },\n };\n },\n [isMobile, handleNavigationClick, handleToolsClick]\n );\n\n /**\n * Set the default values for the minimum and maximum Split Panel width when it is\n * in the side position. The useLayoutEffect will compute the available space in the\n * DOM for the Split Panel given the current state. The minimum and maximum\n * widths will potentially trigger a side effect that will put the Split Panel into\n * a forced position on the bottom.\n */\n const splitPanelMinWidth = 280;\n const [splitPanelMaxWidth, setSplitPanelMaxWidth] = useState(splitPanelMinWidth);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Split Panel. By default\n * the Split Panel should always be closed on page load.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the click events that will change the state of the SplitPanel\n * to open or closed given the current state. It will set the isSplitPanelOpen\n * controlled state and fire the onSplitPanelToggle event.\n */\n const [isSplitPanelOpen, setIsSplitPanelOpen] = useControllable(\n props.splitPanelOpen,\n props.onSplitPanelToggle,\n false,\n { componentName: 'AppLayout', controlledProp: 'splitPanelOpen', changeHandler: 'onSplitPanelToggle' }\n );\n\n const handleSplitPanelClick = useCallback(\n function handleSplitPanelChange() {\n setIsSplitPanelOpen(!isSplitPanelOpen);\n fireNonCancelableEvent(props.onSplitPanelToggle, { open: !isSplitPanelOpen });\n },\n [props.onSplitPanelToggle, isSplitPanelOpen, setIsSplitPanelOpen]\n );\n\n /**\n * The useControllable hook will manage the controlled or uncontrolled\n * state of the splitPanelPreferences. By default the splitPanelPreferences\n * is undefined. When set the object shape should have a single key to indicate\n * either bottom or side position.\n *\n * The callback that will handle changes to the splitPanelPreferences\n * object that will determine if the SplitPanel is rendered either on the\n * bottom of the viewport or within the Tools container.\n */\n const [splitPanelPreferences, setSplitPanelPreferences] = useControllable(\n props.splitPanelPreferences,\n props.onSplitPanelPreferencesChange,\n undefined,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelPreferences',\n changeHandler: 'onSplitPanelPreferencesChange',\n }\n );\n\n /**\n * The Split Panel will be in forced (bottom) position if the defined minimum width is\n * greater than the maximum width. In other words, the maximum width is the currently\n * available horizontal space based on all other components that are rendered. If the\n * minimum width exceeds this value then there is not enough horizontal space and we must\n * force it to the bottom position.\n */\n const [isSplitPanelForcedPosition, setSplitPanelForcedPosition] = useState(false);\n const splitPanelPosition = getSplitPanelPosition(isSplitPanelForcedPosition, splitPanelPreferences);\n\n useLayoutEffect(\n function handleSplitPanelForcePosition() {\n setSplitPanelForcedPosition(splitPanelMinWidth > splitPanelMaxWidth);\n },\n [splitPanelMaxWidth, splitPanelMinWidth]\n );\n\n /**\n * The useControllable hook will set the default size of the SplitPanel based\n * on the default position set in the splitPanelPreferences. The logic for the\n * default size is contained in the SplitPanel component. The splitPanelControlledSize\n * will be bound to the size property in the SplitPanel context for rendering.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the resize events that will change the size of the SplitPanel.\n * It will set the splitPanelControlledSize controlled state and fire the\n * onSplitPanelResize event.\n */\n const [splitPanelReportedSize, setSplitPanelReportedSize] = useState(0);\n\n const [splitPanelSize, setSplitPanelSize] = useControllable(\n props.splitPanelSize,\n props.onSplitPanelResize,\n getSplitPanelDefaultSize(splitPanelPosition),\n { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' }\n );\n\n const handleSplitPanelResize = useCallback(\n function handleSplitPanelChange(detail: { size: number }) {\n setSplitPanelSize(detail.size);\n fireNonCancelableEvent(props.onSplitPanelResize, detail);\n },\n [props.onSplitPanelResize, setSplitPanelSize]\n );\n\n const handleSplitPanelPreferencesChange = useCallback(\n function handleSplitPanelChange(detail: AppLayoutProps.SplitPanelPreferences) {\n setSplitPanelPreferences(detail);\n fireNonCancelableEvent(props.onSplitPanelPreferencesChange, detail);\n },\n [props.onSplitPanelPreferencesChange, setSplitPanelPreferences]\n );\n\n /**\n * The Layout element is not necessarily synonymous with the client\n * viewport width. There can be content in the horizontal viewport\n * that exists on either side of the AppLayout. This resize observer\n * will set the custom property of the Layout element width that\n * is used for various horizontal constraints such as the maximum\n * allowed width of the Tools container.\n *\n * The offsetLeft of the Main will return the distance that the\n * Main element has from the left edge of the Layout component.\n * The offsetLeft value can vary based on the presence and state\n * of the Navigation as well as content gaps in the grid definition.\n * This value is used to determine the max width constraint calculation\n * for the Tools container.\n */\n const [layoutContainerQuery, layoutElement] = useContainerQuery(rect => rect.width);\n const layoutWidth = layoutContainerQuery ?? 0;\n\n const mainElement = useRef<HTMLDivElement>(null);\n const [mainOffsetLeft, setMainOffsetLeft] = useState(0);\n\n useLayoutEffect(\n function handleMainOffsetLeft() {\n setMainOffsetLeft(mainElement?.current?.offsetLeft ?? 0);\n },\n [layoutWidth, isNavigationOpen, isToolsOpen, splitPanelReportedSize]\n );\n\n useLayoutEffect(\n function handleSplitPanelMaxWidth() {\n /**\n * Warning! This is a hack! In order to accurately calculate if there is adequate\n * horizontal space for the Split Panel to be in the side position we need two values\n * that are not available in JavaScript.\n *\n * The first is the the content gap on the right which is stored in a design token\n * and applied in the Layout CSS:\n *\n * $contentGapRight: #{awsui.$space-scaled-2x-xxxl};\n *\n * The second is the width of the element that has the circular buttons for the\n * Tools and Split Panel. This could be suppressed given the state of the Tools\n * drawer returning a zero value. It would, however, be rendered if the Split Panel\n * were to move into the side position. This is calculated in the Tools CSS and\n * the Trigger button CSS with design tokens:\n *\n * padding: awsui.$space-scaled-s awsui.$space-layout-toggle-padding;\n * width: awsui.$space-layout-toggle-diameter;\n *\n * These values will be defined below as static integers that are rough approximations\n * of their computed width when rendered in the DOM, but doubled to ensure adequate\n * spacing for the Split Panel to be in side position.\n */\n const contentGapRight = 80; // Approximately 40px when rendered but doubled for safety\n const toolsFormOffsetWidth = 160; // Approximately 80px when rendered but doubled for safety\n const toolsOffsetWidth = isToolsOpen ? toolsWidth : 0;\n\n setSplitPanelMaxWidth(\n layoutWidth - mainOffsetLeft - minContentWidth - contentGapRight - toolsOffsetWidth - toolsFormOffsetWidth\n );\n },\n [isNavigationOpen, isToolsOpen, layoutWidth, mainOffsetLeft, minContentWidth, toolsWidth]\n );\n\n /**\n * Because the notifications slot does not give us any direction insight into\n * what the state of the child content is we need to have a mechanism for\n * tracking the height of the notifications and whether or not it has content.\n * The height of the notifications is an integer that will be used as a custom\n * property on the Layout component to determine what the sticky offset should\n * be if there are sticky notifications. This could be any number including\n * zero based on how the child content renders. The hasNotificationsContent boolean\n * is simply centralizing the logic of the notifications height being > 0 such\n * that it is not repeated in various components (such as AppBar) that need to\n * know if the notifications slot is empty.\n */\n const [notificationsContainerQuery, notificationsElement] = useContainerQuery(rect => rect.height);\n const [notificationsHeight, setNotificationsHeight] = useState(0);\n const [hasNotificationsContent, setHasNotificationsContent] = useState(false);\n\n useEffect(\n function handleNotificationsContent() {\n setNotificationsHeight(notificationsContainerQuery ?? 0);\n setHasNotificationsContent(notificationsContainerQuery && notificationsContainerQuery > 0 ? true : false);\n },\n [notificationsContainerQuery]\n );\n\n /**\n * The offsetBottom value is used to determine the distance from the bottom of the\n * viewport a sticky element should be placed. A non-zero value means that there\n * is either a footer outside of the AppLayout, a SplitPanel in the bottom position\n * within the AppLayout, or both.\n */\n const [offsetBottom, setOffsetBottom] = useState(0);\n\n return (\n <AppLayoutContext.Provider\n value={{\n ...defaults,\n ...props,\n contentType,\n dynamicOverlapHeight,\n hasDefaultToolsWidth,\n handleNavigationClick,\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n handleToolsClick,\n hasNotificationsContent,\n isAnyPanelOpen,\n isMobile,\n isNavigationOpen: isNavigationOpen ?? false,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n isToolsOpen,\n layoutElement,\n layoutWidth,\n mainElement,\n mainOffsetLeft,\n maxContentWidth,\n minContentWidth,\n navigationHide,\n notificationsElement,\n notificationsHeight,\n offsetBottom,\n setDynamicOverlapHeight,\n setOffsetBottom,\n setSplitPanelReportedSize,\n splitPanelMaxWidth,\n splitPanelMinWidth,\n splitPanelPosition,\n splitPanelPreferences,\n splitPanelReportedSize,\n splitPanelSize,\n toolsHide,\n toolsOpen: isToolsOpen,\n toolsWidth,\n }}\n >\n {children}\n </AppLayoutContext.Provider>\n );\n }\n);\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/context.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EACZ,aAAa,EACb,SAAS,EACT,WAAW,EACX,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,QAAQ,GACT,MAAM,OAAO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,KAAK,EAC3C,0BAA0B,4BAAA,EAC1B,gBAAgB,kBAAA,EAChB,WAAW,aAAA,EACX,aAAa,eAAA,EACb,WAAW,aAAA,EACX,WAAW,aAAA,EACX,cAAc,gBAAA,EACd,eAAe,iBAAA,EACf,eAAe,iBAAA,EACf,cAAc,gBAAA,EACd,oBAAoB,sBAAA,EACpB,mBAAmB,qBAAA,EACnB,YAAY,cAAA,EACZ,uBAAuB,yBAAA,EACvB,eAAe,iBAAA,EACf,yBAAyB,2BAAA,EACzB,kBAAkB,oBAAA,EAClB,kBAAkB,oBAAA,EAClB,kBAAkB,oBAAA,EAClB,qBAAqB,uBAAA,EACrB,sBAAsB,wBAAA,EACtB,cAAc,gBAAA,EACd,SAAS,WAAA,EACT,SAAS,EAAE,WAAW,EACtB,UAAU,YAAA,OAGX,QAAQ,CACiB,CAC7B,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, {\n createContext,\n createRef,\n useCallback,\n useEffect,\n useLayoutEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport { AppLayoutProps } from '../interfaces';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport { getSplitPanelPosition } from './split-panel';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { useMobile } from '../../internal/hooks/use-mobile';\nimport { useContainerQuery, useResizeObserver } from '../../internal/hooks/container-queries';\nimport { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';\nimport styles from './styles.css.js';\nimport { isDevelopment } from '../../internal/is-development';\nimport { warnOnce } from '../../internal/logging';\nimport { applyDefaults } from '../defaults';\n\ninterface AppLayoutContextProps extends AppLayoutProps {\n dynamicOverlapHeight: number;\n handleSplitPanelClick: () => void;\n handleNavigationClick: (isOpen: boolean) => void;\n handleSplitPanelPreferencesChange: (detail: AppLayoutProps.SplitPanelPreferences) => void;\n handleSplitPanelResize: (detail: { size: number }) => void;\n handleToolsClick: (value: boolean) => void;\n hasDefaultToolsWidth: boolean;\n hasNotificationsContent: boolean;\n isAnyPanelOpen: boolean;\n isMobile: boolean;\n isNavigationOpen: boolean;\n isSplitPanelForcedPosition: boolean;\n isSplitPanelOpen?: boolean;\n isToolsOpen?: boolean;\n layoutElement: React.Ref<HTMLElement>;\n layoutWidth: number;\n mainElement: React.Ref<HTMLDivElement>;\n mainOffsetLeft: number;\n notificationsElement: React.Ref<HTMLDivElement>;\n notificationsHeight: number;\n offsetBottom: number;\n setDynamicOverlapHeight: (value: number) => void;\n setIsNavigationOpen: (value: boolean) => void;\n setIsToolsOpen: (value: boolean) => void;\n setOffsetBottom: (value: number) => void;\n setSplitPanelReportedSize: (value: number) => void;\n headerHeight: number;\n footerHeight: number;\n splitPanelMaxWidth: number;\n splitPanelMinWidth: number;\n splitPanelPosition: AppLayoutProps.SplitPanelPosition;\n splitPanelReportedSize: number;\n}\n\n// TODO simplify default params + typings\nconst defaults: AppLayoutContextProps = {\n breadcrumbs: null,\n content: null,\n contentHeader: null,\n contentType: 'default',\n disableBodyScroll: false,\n disableContentHeaderOverlap: false,\n disableContentPaddings: false,\n dynamicOverlapHeight: 0,\n headerHeight: 0,\n footerHeight: 0,\n handleNavigationClick: (value: boolean) => value,\n handleSplitPanelClick: () => {},\n handleSplitPanelPreferencesChange: () => {},\n handleSplitPanelResize: () => {},\n handleToolsClick: (value: boolean) => value,\n hasDefaultToolsWidth: true,\n hasNotificationsContent: false,\n isAnyPanelOpen: false,\n isMobile: false,\n isNavigationOpen: false,\n isSplitPanelForcedPosition: false,\n isSplitPanelOpen: false,\n isToolsOpen: false,\n // TODO: these refs are currently only instantiated once globally\n layoutElement: createRef<HTMLElement>(),\n layoutWidth: 0,\n mainElement: createRef<HTMLDivElement>(),\n mainOffsetLeft: 0,\n maxContentWidth: 0,\n minContentWidth: 280,\n navigation: null,\n navigationHide: false,\n navigationOpen: false,\n notifications: null,\n notificationsElement: createRef<HTMLDivElement>(),\n notificationsHeight: 0,\n offsetBottom: 0,\n onNavigationChange: () => {},\n onSplitPanelResize: () => {},\n onSplitPanelToggle: () => {},\n onSplitPanelPreferencesChange: () => {},\n setDynamicOverlapHeight: (value: number) => void value,\n setIsNavigationOpen: (value: boolean) => value,\n setIsToolsOpen: (value: boolean) => value,\n setOffsetBottom: (value: number) => void value,\n setSplitPanelReportedSize: (value: number) => void value,\n splitPanelMaxWidth: 280,\n splitPanelMinWidth: 280,\n splitPanelOpen: false,\n splitPanelPosition: 'bottom',\n splitPanelPreferences: { position: 'bottom' },\n splitPanelReportedSize: 0,\n splitPanelSize: 0,\n stickyNotifications: false,\n tools: null,\n};\n\n/**\n * The default values are destructured in the context instantiation to\n * prevent downstream Typescript errors. This could likely be replaced\n * by a context interface definition that extends the AppLayout interface.\n */\nexport const AppLayoutContext = createContext({ ...defaults });\n\ntype AppLayoutProviderProps = AppLayoutProps & {\n children: React.ReactNode;\n};\n\nexport const AppLayoutProvider = React.forwardRef(\n (\n {\n toolsHide,\n toolsOpen: controlledToolsOpen,\n navigationHide,\n navigationOpen: controlledNavigationOpen,\n contentType = 'default',\n headerSelector = '#b #h',\n footerSelector = '#b #h',\n children,\n ...props\n }: AppLayoutProviderProps,\n forwardRef: React.Ref<AppLayoutProps.Ref>\n ) => {\n const isMobile = useMobile();\n\n if (isDevelopment) {\n if (controlledToolsOpen && toolsHide) {\n warnOnce(\n 'AppLayout',\n `You have enabled both the \\`toolsOpen\\` prop and the \\`toolsHide\\` prop. This is not supported. Set \\`toolsOpen\\` to \\`false\\` when you set \\`toolsHide\\` to \\`true\\`.`\n );\n }\n }\n\n /**\n * The overlap height has a default set in CSS but can also be dynamically overridden\n * for content types (such as Table and Wizard) that have variable size content in the overlap.\n */\n const [dynamicOverlapHeight, setDynamicOverlapHeight] = useState(0);\n\n /**\n * Set the default values for minimum and maximum content width.\n */\n const geckoMaxCssLength = ((1 << 30) - 1) / 60;\n const halfGeckoMaxCssLength = geckoMaxCssLength / 2;\n // CSS lengths in Gecko are limited to at most (1<<30)-1 app units (Gecko uses 60 as app unit).\n // Limit the maxContentWidth to the half of the upper boundary (≈4230^2) to be on the safe side.\n const maxContentWidth =\n props.maxContentWidth && props.maxContentWidth > halfGeckoMaxCssLength\n ? halfGeckoMaxCssLength\n : props.maxContentWidth ?? 0;\n const minContentWidth = props.minContentWidth ?? 280;\n\n /**\n * Determine the default state of the Navigation and Tools drawers.\n * Mobile viewports should be closed by default under all circumstances.\n * If the navigationOpen prop has been set then that should take precedence\n * over the contentType prop. Desktop viewports that do not have the\n * navigationOpen or contentType props set will use the default contentType.\n */\n const contentTypeDefaults = applyDefaults(contentType, { maxContentWidth, minContentWidth }, true);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Navigation drawer. The logic\n * for determining the default state is colocated with the Navigation component.\n *\n * The callback that will be passed to the Navigation and AppBar\n * components to handle the click events that will change the state\n * of the Navigation drawer. It will set the Navigation state with the\n * useControllable hook and also fire the onNavigationChange function to\n * emit the state change.\n */\n const [isNavigationOpen = false, setIsNavigationOpen] = useControllable(\n controlledNavigationOpen,\n props.onNavigationChange,\n isMobile ? false : contentTypeDefaults.navigationOpen,\n { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }\n );\n\n const handleNavigationClick = useCallback(\n function handleNavigationChange(isOpen: boolean) {\n setIsNavigationOpen(isOpen);\n fireNonCancelableEvent(props.onNavigationChange, { open: isOpen });\n },\n [props.onNavigationChange, setIsNavigationOpen]\n );\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Tools drawer. The logic\n * for determining the default state is colocated with the Tools component.\n *\n * The callback that will be passed to the Navigation and AppBar\n * components to handle the click events that will change the state\n * of the Tools drawer. It will set the Tools state with the\n * useControllable hook and also fire the onToolsChange function to\n * emit the state change.\n */\n const toolsWidth = props.toolsWidth ?? 290;\n const hasDefaultToolsWidth = props.toolsWidth === undefined;\n\n const [isToolsOpen = false, setIsToolsOpen] = useControllable(\n controlledToolsOpen,\n props.onToolsChange,\n isMobile ? false : contentTypeDefaults.toolsOpen,\n { componentName: 'AppLayout', controlledProp: 'toolsOpen', changeHandler: 'onToolsChange' }\n );\n\n const handleToolsClick = useCallback(\n function handleToolsChange(isOpen: boolean) {\n setIsToolsOpen(isOpen);\n fireNonCancelableEvent(props.onToolsChange, { open: isOpen });\n },\n [props.onToolsChange, setIsToolsOpen]\n );\n\n const navigationVisible = !navigationHide && isNavigationOpen;\n const toolsVisible = !toolsHide && isToolsOpen;\n const isAnyPanelOpen = navigationVisible || toolsVisible;\n\n /**\n * On mobile viewports the navigation and tools drawers are adjusted to a fixed position\n * that consumes 100% of the viewport height and width. The body content could potentially\n * be scrollable underneath the drawer. In order to prevent this a CSS class needs to be\n * added to the document body that sets overflow to hidden.\n */\n useEffect(\n function handleBodyScroll() {\n if (isMobile && (isNavigationOpen || isToolsOpen)) {\n document.body.classList.add(styles['block-body-scroll']);\n } else {\n document.body.classList.remove(styles['block-body-scroll']);\n }\n\n // Ensure the CSS class is removed from the body on side effect cleanup\n return function cleanup() {\n document.body.classList.remove(styles['block-body-scroll']);\n };\n },\n [isMobile, isNavigationOpen, isToolsOpen]\n );\n\n /**\n * The useImperativeHandle hook in conjunction with the forwardRef function\n * in the AppLayout component definition expose the following callable\n * functions to component consumers when they put a ref as a property on\n * their component implementation.\n */\n useImperativeHandle(\n forwardRef,\n function createImperativeHandle() {\n return {\n closeNavigationIfNecessary: function () {\n isMobile && handleNavigationClick(false);\n },\n openTools: function () {\n handleToolsClick(true);\n },\n };\n },\n [isMobile, handleNavigationClick, handleToolsClick]\n );\n\n /**\n * Query the DOM for the header and footer elements based on the selectors provided\n * by the properties and pass the heights to the custom property definitions.\n */\n const [headerHeight, setHeaderHeight] = useState(0);\n const getHeader = useCallback(() => document.querySelector(headerSelector), [headerSelector]);\n useResizeObserver(getHeader, entry => setHeaderHeight(entry.borderBoxHeight));\n\n const [footerHeight, setFooterHeight] = useState(0);\n const getFooter = useCallback(() => document.querySelector(footerSelector), [footerSelector]);\n useResizeObserver(getFooter, entry => setFooterHeight(entry.borderBoxHeight));\n\n /**\n * Set the default values for the minimum and maximum Split Panel width when it is\n * in the side position. The useLayoutEffect will compute the available space in the\n * DOM for the Split Panel given the current state. The minimum and maximum\n * widths will potentially trigger a side effect that will put the Split Panel into\n * a forced position on the bottom.\n */\n const splitPanelMinWidth = 280;\n const [splitPanelMaxWidth, setSplitPanelMaxWidth] = useState(splitPanelMinWidth);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Split Panel. By default\n * the Split Panel should always be closed on page load.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the click events that will change the state of the SplitPanel\n * to open or closed given the current state. It will set the isSplitPanelOpen\n * controlled state and fire the onSplitPanelToggle event.\n */\n const [isSplitPanelOpen, setIsSplitPanelOpen] = useControllable(\n props.splitPanelOpen,\n props.onSplitPanelToggle,\n false,\n { componentName: 'AppLayout', controlledProp: 'splitPanelOpen', changeHandler: 'onSplitPanelToggle' }\n );\n\n const handleSplitPanelClick = useCallback(\n function handleSplitPanelChange() {\n setIsSplitPanelOpen(!isSplitPanelOpen);\n fireNonCancelableEvent(props.onSplitPanelToggle, { open: !isSplitPanelOpen });\n },\n [props.onSplitPanelToggle, isSplitPanelOpen, setIsSplitPanelOpen]\n );\n\n /**\n * The useControllable hook will manage the controlled or uncontrolled\n * state of the splitPanelPreferences. By default the splitPanelPreferences\n * is undefined. When set the object shape should have a single key to indicate\n * either bottom or side position.\n *\n * The callback that will handle changes to the splitPanelPreferences\n * object that will determine if the SplitPanel is rendered either on the\n * bottom of the viewport or within the Tools container.\n */\n const [splitPanelPreferences, setSplitPanelPreferences] = useControllable(\n props.splitPanelPreferences,\n props.onSplitPanelPreferencesChange,\n undefined,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelPreferences',\n changeHandler: 'onSplitPanelPreferencesChange',\n }\n );\n\n /**\n * The Split Panel will be in forced (bottom) position if the defined minimum width is\n * greater than the maximum width. In other words, the maximum width is the currently\n * available horizontal space based on all other components that are rendered. If the\n * minimum width exceeds this value then there is not enough horizontal space and we must\n * force it to the bottom position.\n */\n const [isSplitPanelForcedPosition, setSplitPanelForcedPosition] = useState(false);\n const splitPanelPosition = getSplitPanelPosition(isSplitPanelForcedPosition, splitPanelPreferences);\n\n useLayoutEffect(\n function handleSplitPanelForcePosition() {\n setSplitPanelForcedPosition(splitPanelMinWidth > splitPanelMaxWidth);\n },\n [splitPanelMaxWidth, splitPanelMinWidth]\n );\n\n /**\n * The useControllable hook will set the default size of the SplitPanel based\n * on the default position set in the splitPanelPreferences. The logic for the\n * default size is contained in the SplitPanel component. The splitPanelControlledSize\n * will be bound to the size property in the SplitPanel context for rendering.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the resize events that will change the size of the SplitPanel.\n * It will set the splitPanelControlledSize controlled state and fire the\n * onSplitPanelResize event.\n */\n const [splitPanelReportedSize, setSplitPanelReportedSize] = useState(0);\n\n const [splitPanelSize, setSplitPanelSize] = useControllable(\n props.splitPanelSize,\n props.onSplitPanelResize,\n getSplitPanelDefaultSize(splitPanelPosition),\n { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' }\n );\n\n const handleSplitPanelResize = useCallback(\n function handleSplitPanelChange(detail: { size: number }) {\n setSplitPanelSize(detail.size);\n fireNonCancelableEvent(props.onSplitPanelResize, detail);\n },\n [props.onSplitPanelResize, setSplitPanelSize]\n );\n\n const handleSplitPanelPreferencesChange = useCallback(\n function handleSplitPanelChange(detail: AppLayoutProps.SplitPanelPreferences) {\n setSplitPanelPreferences(detail);\n fireNonCancelableEvent(props.onSplitPanelPreferencesChange, detail);\n },\n [props.onSplitPanelPreferencesChange, setSplitPanelPreferences]\n );\n\n /**\n * The Layout element is not necessarily synonymous with the client\n * viewport width. There can be content in the horizontal viewport\n * that exists on either side of the AppLayout. This resize observer\n * will set the custom property of the Layout element width that\n * is used for various horizontal constraints such as the maximum\n * allowed width of the Tools container.\n *\n * The offsetLeft of the Main will return the distance that the\n * Main element has from the left edge of the Layout component.\n * The offsetLeft value can vary based on the presence and state\n * of the Navigation as well as content gaps in the grid definition.\n * This value is used to determine the max width constraint calculation\n * for the Tools container.\n */\n const [layoutContainerQuery, layoutElement] = useContainerQuery(rect => rect.width);\n const layoutWidth = layoutContainerQuery ?? 0;\n\n const mainElement = useRef<HTMLDivElement>(null);\n const [mainOffsetLeft, setMainOffsetLeft] = useState(0);\n\n useLayoutEffect(\n function handleMainOffsetLeft() {\n setMainOffsetLeft(mainElement?.current?.offsetLeft ?? 0);\n },\n [layoutWidth, isNavigationOpen, isToolsOpen, splitPanelReportedSize]\n );\n\n useLayoutEffect(\n function handleSplitPanelMaxWidth() {\n /**\n * Warning! This is a hack! In order to accurately calculate if there is adequate\n * horizontal space for the Split Panel to be in the side position we need two values\n * that are not available in JavaScript.\n *\n * The first is the the content gap on the right which is stored in a design token\n * and applied in the Layout CSS:\n *\n * $contentGapRight: #{awsui.$space-scaled-2x-xxxl};\n *\n * The second is the width of the element that has the circular buttons for the\n * Tools and Split Panel. This could be suppressed given the state of the Tools\n * drawer returning a zero value. It would, however, be rendered if the Split Panel\n * were to move into the side position. This is calculated in the Tools CSS and\n * the Trigger button CSS with design tokens:\n *\n * padding: awsui.$space-scaled-s awsui.$space-layout-toggle-padding;\n * width: awsui.$space-layout-toggle-diameter;\n *\n * These values will be defined below as static integers that are rough approximations\n * of their computed width when rendered in the DOM, but doubled to ensure adequate\n * spacing for the Split Panel to be in side position.\n */\n const contentGapRight = 80; // Approximately 40px when rendered but doubled for safety\n const toolsFormOffsetWidth = 160; // Approximately 80px when rendered but doubled for safety\n const toolsOffsetWidth = isToolsOpen ? toolsWidth : 0;\n\n setSplitPanelMaxWidth(\n layoutWidth - mainOffsetLeft - minContentWidth - contentGapRight - toolsOffsetWidth - toolsFormOffsetWidth\n );\n },\n [isNavigationOpen, isToolsOpen, layoutWidth, mainOffsetLeft, minContentWidth, toolsWidth]\n );\n\n /**\n * Because the notifications slot does not give us any direction insight into\n * what the state of the child content is we need to have a mechanism for\n * tracking the height of the notifications and whether or not it has content.\n * The height of the notifications is an integer that will be used as a custom\n * property on the Layout component to determine what the sticky offset should\n * be if there are sticky notifications. This could be any number including\n * zero based on how the child content renders. The hasNotificationsContent boolean\n * is simply centralizing the logic of the notifications height being > 0 such\n * that it is not repeated in various components (such as AppBar) that need to\n * know if the notifications slot is empty.\n */\n const [notificationsContainerQuery, notificationsElement] = useContainerQuery(rect => rect.height);\n const [notificationsHeight, setNotificationsHeight] = useState(0);\n const [hasNotificationsContent, setHasNotificationsContent] = useState(false);\n\n useEffect(\n function handleNotificationsContent() {\n setNotificationsHeight(notificationsContainerQuery ?? 0);\n setHasNotificationsContent(notificationsContainerQuery && notificationsContainerQuery > 0 ? true : false);\n },\n [notificationsContainerQuery]\n );\n\n /**\n * The offsetBottom value is used to determine the distance from the bottom of the\n * viewport a sticky element should be placed. A non-zero value means that there\n * is either a footer outside of the AppLayout, a SplitPanel in the bottom position\n * within the AppLayout, or both.\n */\n const [offsetBottom, setOffsetBottom] = useState(0);\n\n return (\n <AppLayoutContext.Provider\n value={{\n ...defaults,\n ...props,\n contentType,\n dynamicOverlapHeight,\n headerHeight,\n footerHeight,\n hasDefaultToolsWidth,\n handleNavigationClick,\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n handleToolsClick,\n hasNotificationsContent,\n isAnyPanelOpen,\n isMobile,\n isNavigationOpen: isNavigationOpen ?? false,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n isToolsOpen,\n layoutElement,\n layoutWidth,\n mainElement,\n mainOffsetLeft,\n maxContentWidth,\n minContentWidth,\n navigationHide,\n notificationsElement,\n notificationsHeight,\n offsetBottom,\n setDynamicOverlapHeight,\n setOffsetBottom,\n setSplitPanelReportedSize,\n splitPanelMaxWidth,\n splitPanelMinWidth,\n splitPanelPosition,\n splitPanelPreferences,\n splitPanelReportedSize,\n splitPanelSize,\n toolsHide,\n toolsOpen: isToolsOpen,\n toolsWidth,\n }}\n >\n {children}\n </AppLayoutContext.Provider>\n );\n }\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/layout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAUlF,UAAU,WAAW;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,WAAW,eAwHvD"}
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/layout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAS3D,UAAU,WAAW;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,WAAW,eA6GvD"}
@@ -1,11 +1,10 @@
1
1
  import { __assign } from "tslib";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
- import React, { useCallback, useContext, useLayoutEffect, useState } from 'react';
4
+ import React, { useContext, useLayoutEffect } from 'react';
5
5
  import clsx from 'clsx';
6
6
  import { AppLayoutContext } from './context';
7
7
  import { SplitPanelContext } from '../../internal/context/split-panel-context';
8
- import { useResizeObserver } from '../../internal/hooks/container-queries';
9
8
  import styles from './styles.css.js';
10
9
  import testutilStyles from '../test-classes/styles.css.js';
11
10
  import customCssProps from '../../internal/generated/custom-css-properties';
@@ -18,19 +17,9 @@ import customCssProps from '../../internal/generated/custom-css-properties';
18
17
  export default function Layout(_a) {
19
18
  var _b, _c, _d, _e, _f, _g;
20
19
  var children = _a.children;
21
- var _h = useContext(AppLayoutContext), contentHeader = _h.contentHeader, contentType = _h.contentType, disableBodyScroll = _h.disableBodyScroll, disableContentHeaderOverlap = _h.disableContentHeaderOverlap, dynamicOverlapHeight = _h.dynamicOverlapHeight, footerSelector = _h.footerSelector, hasNotificationsContent = _h.hasNotificationsContent, headerSelector = _h.headerSelector, isNavigationOpen = _h.isNavigationOpen, isSplitPanelOpen = _h.isSplitPanelOpen, isToolsOpen = _h.isToolsOpen, layoutElement = _h.layoutElement, layoutWidth = _h.layoutWidth, mainOffsetLeft = _h.mainOffsetLeft, maxContentWidth = _h.maxContentWidth, minContentWidth = _h.minContentWidth, navigationHide = _h.navigationHide, notificationsHeight = _h.notificationsHeight, setOffsetBottom = _h.setOffsetBottom, splitPanel = _h.splitPanel, stickyNotifications = _h.stickyNotifications, toolsHide = _h.toolsHide;
20
+ var _h = useContext(AppLayoutContext), contentHeader = _h.contentHeader, contentType = _h.contentType, disableBodyScroll = _h.disableBodyScroll, disableContentHeaderOverlap = _h.disableContentHeaderOverlap, dynamicOverlapHeight = _h.dynamicOverlapHeight, footerHeight = _h.footerHeight, hasNotificationsContent = _h.hasNotificationsContent, headerHeight = _h.headerHeight, isNavigationOpen = _h.isNavigationOpen, isSplitPanelOpen = _h.isSplitPanelOpen, isToolsOpen = _h.isToolsOpen, layoutElement = _h.layoutElement, layoutWidth = _h.layoutWidth, mainOffsetLeft = _h.mainOffsetLeft, maxContentWidth = _h.maxContentWidth, minContentWidth = _h.minContentWidth, navigationHide = _h.navigationHide, notificationsHeight = _h.notificationsHeight, setOffsetBottom = _h.setOffsetBottom, splitPanel = _h.splitPanel, stickyNotifications = _h.stickyNotifications, toolsHide = _h.toolsHide;
22
21
  var _j = useContext(SplitPanelContext), getSplitPanelHeader = _j.getHeader, splitPanelPosition = _j.position, splitPanelSize = _j.size;
23
22
  var isOverlapDisabled = getOverlapDisabled(dynamicOverlapHeight, contentHeader, disableContentHeaderOverlap);
24
- /**
25
- * Query the DOM for the header and footer elements based on the selectors provided
26
- * by the properties and pass the heights to the custom property definitions.
27
- */
28
- var _k = useState(0), headerHeight = _k[0], setHeaderHeight = _k[1];
29
- var getHeader = useCallback(function () { return document.querySelector(headerSelector); }, [headerSelector]);
30
- useResizeObserver(getHeader, function (entry) { return setHeaderHeight(entry.borderBoxHeight); });
31
- var _l = useState(0), footerHeight = _l[0], setFooterHeight = _l[1];
32
- var getFooter = useCallback(function () { return document.querySelector(footerSelector); }, [footerSelector]);
33
- useResizeObserver(getFooter, function (entry) { return setFooterHeight(entry.borderBoxHeight); });
34
23
  // Content gaps on the left and right are used with the minmax function in the CSS grid column definition
35
24
  var hasContentGapLeft = getContentGapLeft(isNavigationOpen, navigationHide);
36
25
  var hasContentGapRight = getContentGapRight(splitPanelPosition, isSplitPanelOpen, isToolsOpen, splitPanel, toolsHide);
@@ -62,6 +51,7 @@ export default function Layout(_a) {
62
51
  ]);
63
52
  return (React.createElement("main", { className: clsx(styles.layout, styles["content-type-".concat(contentType)], styles["split-panel-position-".concat(splitPanelPosition !== null && splitPanelPosition !== void 0 ? splitPanelPosition : 'bottom')], (_b = {},
64
53
  _b[styles['disable-body-scroll']] = disableBodyScroll,
54
+ _b[testutilStyles['disable-body-scroll-root']] = disableBodyScroll,
65
55
  _b[styles['has-content-gap-left']] = hasContentGapLeft,
66
56
  _b[styles['has-content-gap-right']] = hasContentGapRight,
67
57
  _b[styles['has-max-content-width']] = maxContentWidth && maxContentWidth > 0,
@@ -1 +1 @@
1
- {"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/layout.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClF,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,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CACzB,kBAAqD,EACrD,gBAA0B,EAC1B,WAAqB,EACrB,UAA4B,EAC5B,SAAmB;IAEnB,IAAI,kBAAkB,GAAG,KAAK,CAAC;IAE/B,kEAAkE;IAClE,IAAI,CAAC,UAAU,IAAI,SAAS,EAAE;QAC5B,kBAAkB,GAAG,IAAI,CAAC;KAC3B;IAED,4DAA4D;IAC5D,IAAI,CAAC,CAAC,UAAU,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,IAAI,WAAW,EAAE;QACnE,kBAAkB,GAAG,IAAI,CAAC;KAC3B;IAED,kEAAkE;IAClE,IAAI,UAAU,IAAI,kBAAkB,KAAK,QAAQ,IAAI,CAAC,WAAW,IAAI,SAAS,CAAC,EAAE;QAC/E,kBAAkB,GAAG,IAAI,CAAC;KAC3B;IAED,kEAAkE;IAClE,IAAI,UAAU,IAAI,gBAAgB,IAAI,kBAAkB,KAAK,MAAM,EAAE;QACnE,kBAAkB,GAAG,IAAI,CAAC;KAC3B;IAED,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED;;;;;GAKG;AACH,SAAS,iBAAiB,CAAC,gBAAyB,EAAE,cAAwB;IAC5E,OAAO,gBAAgB,IAAI,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAC3D,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,kBAAkB,CACzB,oBAA4B,EAC5B,aAA+B,EAC/B,2BAAqC;IAErC,IAAI,iBAAiB,GAAG,KAAK,CAAC;IAE9B,IAAI,2BAA2B,EAAE;QAC/B,iBAAiB,GAAG,IAAI,CAAC;KAC1B;SAAM,IAAI,CAAC,aAAa,IAAI,oBAAoB,IAAI,CAAC,EAAE;QACtD,iBAAiB,GAAG,IAAI,CAAC;KAC1B;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useContext, useLayoutEffect, useState } from 'react';\nimport clsx from 'clsx';\nimport { AppLayoutContext } from './context';\nimport { SplitPanelContext } from '../../internal/context/split-panel-context';\nimport { useResizeObserver } from '../../internal/hooks/container-queries';\nimport styles from './styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\nimport { AppLayoutProps } from '../interfaces';\nimport customCssProps from '../../internal/generated/custom-css-properties';\n\ninterface LayoutProps {\n children: React.ReactNode;\n}\n\n/**\n * The layoutElement ref will be used by the resize observers to calculate the offset from\n * the top and bottom of the viewport based on the header and footer elements. This is to\n * ensure the Layout component minimum height will fill 100% of the viewport less those\n * cumulative heights.\n */\nexport default function Layout({ children }: LayoutProps) {\n const {\n contentHeader,\n contentType,\n disableBodyScroll,\n disableContentHeaderOverlap,\n dynamicOverlapHeight,\n footerSelector,\n hasNotificationsContent,\n headerSelector,\n isNavigationOpen,\n isSplitPanelOpen,\n isToolsOpen,\n layoutElement,\n layoutWidth,\n mainOffsetLeft,\n maxContentWidth,\n minContentWidth,\n navigationHide,\n notificationsHeight,\n setOffsetBottom,\n splitPanel,\n stickyNotifications,\n toolsHide,\n } = useContext(AppLayoutContext);\n\n const {\n getHeader: getSplitPanelHeader,\n position: splitPanelPosition,\n size: splitPanelSize,\n } = useContext(SplitPanelContext);\n\n const isOverlapDisabled = getOverlapDisabled(dynamicOverlapHeight, contentHeader, disableContentHeaderOverlap);\n\n /**\n * Query the DOM for the header and footer elements based on the selectors provided\n * by the properties and pass the heights to the custom property definitions.\n */\n const [headerHeight, setHeaderHeight] = useState(0);\n const getHeader = useCallback(() => document.querySelector(headerSelector), [headerSelector]);\n useResizeObserver(getHeader, entry => setHeaderHeight(entry.borderBoxHeight));\n\n const [footerHeight, setFooterHeight] = useState(0);\n const getFooter = useCallback(() => document.querySelector(footerSelector), [footerSelector]);\n useResizeObserver(getFooter, entry => setFooterHeight(entry.borderBoxHeight));\n\n // Content gaps on the left and right are used with the minmax function in the CSS grid column definition\n const hasContentGapLeft = getContentGapLeft(isNavigationOpen, navigationHide);\n const hasContentGapRight = getContentGapRight(\n splitPanelPosition,\n isSplitPanelOpen,\n isToolsOpen,\n splitPanel,\n toolsHide\n );\n\n /**\n * Determine the offsetBottom value based on the presence of a footer element and\n * the SplitPanel component. Ignore the SplitPanel if it is not in the bottom\n * position. Use the size property if it is open and the header height if it is closed.\n */\n useLayoutEffect(\n function handleOffsetBottom() {\n let offsetBottom = footerHeight;\n\n if (splitPanel && splitPanelPosition === 'bottom') {\n if (isSplitPanelOpen) {\n offsetBottom += splitPanelSize;\n } else {\n const splitPanelHeader = getSplitPanelHeader();\n offsetBottom += splitPanelHeader ? splitPanelHeader.clientHeight : 0;\n }\n }\n\n setOffsetBottom(offsetBottom);\n },\n [\n footerHeight,\n getSplitPanelHeader,\n isSplitPanelOpen,\n setOffsetBottom,\n splitPanelPosition,\n splitPanel,\n splitPanelSize,\n ]\n );\n\n return (\n <main\n className={clsx(\n styles.layout,\n styles[`content-type-${contentType}`],\n styles[`split-panel-position-${splitPanelPosition ?? 'bottom'}`],\n {\n [styles['disable-body-scroll']]: disableBodyScroll,\n [styles['has-content-gap-left']]: hasContentGapLeft,\n [styles['has-content-gap-right']]: hasContentGapRight,\n [styles['has-max-content-width']]: maxContentWidth && maxContentWidth > 0,\n [styles['has-split-panel']]: splitPanel,\n [styles['has-sticky-notifications']]: stickyNotifications && hasNotificationsContent,\n [styles['is-overlap-disabled']]: isOverlapDisabled,\n },\n testutilStyles.root\n )}\n ref={layoutElement}\n style={{\n [customCssProps.headerHeight]: `${headerHeight}px`,\n [customCssProps.footerHeight]: `${footerHeight}px`,\n [customCssProps.layoutWidth]: `${layoutWidth}px`,\n [customCssProps.mainOffsetLeft]: `${mainOffsetLeft}px`,\n ...(maxContentWidth && { [customCssProps.maxContentWidth]: `${maxContentWidth}px` }),\n ...(minContentWidth && { [customCssProps.minContentWidth]: `${minContentWidth}px` }),\n [customCssProps.notificationsHeight]: `${notificationsHeight}px`,\n ...(!isOverlapDisabled &&\n dynamicOverlapHeight > 0 && { [customCssProps.overlapHeight]: `${dynamicOverlapHeight}px` }),\n }}\n >\n {children}\n </main>\n );\n}\n\n/**\n * When the Navigation and Tools are present the grid definition has the center column\n * touch the first and last columns with no gap. The forms with the circular buttons\n * for Navigation and Tools have internal padding which creates the necessary\n * horizontal space when the drawers are closed. The remaining conditions below\n * determine the necessity of utilizing the content gap left property to create\n * horizontal space between the center column and its adjacent siblings.\n */\nfunction getContentGapRight(\n splitPanelPosition: AppLayoutProps.SplitPanelPosition,\n isSplitPanelOpen?: boolean,\n isToolsOpen?: boolean,\n splitPanel?: React.ReactNode,\n toolsHide?: boolean\n) {\n let hasContentGapRight = false;\n\n // Main is touching the edge of the Layout and needs a content gap\n if (!splitPanel && toolsHide) {\n hasContentGapRight = true;\n }\n\n // Main is touching the Tools drawer and needs a content gap\n if ((!splitPanel || !isSplitPanelOpen) && !toolsHide && isToolsOpen) {\n hasContentGapRight = true;\n }\n\n // Main is touching the edge of the Layout and needs a content gap\n if (splitPanel && splitPanelPosition === 'bottom' && (isToolsOpen || toolsHide)) {\n hasContentGapRight = true;\n }\n\n // Main is touching the Split Panel drawer and needs a content gap\n if (splitPanel && isSplitPanelOpen && splitPanelPosition === 'side') {\n hasContentGapRight = true;\n }\n\n return hasContentGapRight;\n}\n\n/**\n * Additional function to determine whether or not a content gap is needed\n * on the left (see the getContentGapRight function). The same render logic applies\n * regarding the center column touching an adjacent sibling but the only\n * component state that needs to be tracked is the Navigation.\n */\nfunction getContentGapLeft(isNavigationOpen: boolean, navigationHide?: boolean) {\n return isNavigationOpen || navigationHide ? true : false;\n}\n\n/**\n * Determine whether the overlap between the contentHeader and content slots should be disabled.\n * The disableContentHeaderOverlap property is absolute and will always disable the overlap\n * if it is set to true. If there is no contentHeader then the overlap should be disabled\n * unless there is a dynamicOverlapHeight. The dynamicOverlapHeight property is set by a\n * component in the content slot that needs to manually control the overlap height. Components\n * such as the Table (full page variant), Wizard, ContentLayout use this property and will\n * retain the overlap even if there is nothing rendered in the contentHeader slot.\n */\nfunction getOverlapDisabled(\n dynamicOverlapHeight: number,\n contentHeader?: React.ReactNode,\n disableContentHeaderOverlap?: boolean\n) {\n let isOverlapDisabled = false;\n\n if (disableContentHeaderOverlap) {\n isOverlapDisabled = true;\n } else if (!contentHeader && dynamicOverlapHeight <= 0) {\n isOverlapDisabled = true;\n }\n\n return isOverlapDisabled;\n}\n"]}
1
+ {"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/layout.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAE3D,OAAO,cAAc,MAAM,gDAAgD,CAAC;AAM5E;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAyB;;QAAvB,QAAQ,cAAA;IACjC,IAAA,KAuBF,UAAU,CAAC,gBAAgB,CAAC,EAtB9B,aAAa,mBAAA,EACb,WAAW,iBAAA,EACX,iBAAiB,uBAAA,EACjB,2BAA2B,iCAAA,EAC3B,oBAAoB,0BAAA,EACpB,YAAY,kBAAA,EACZ,uBAAuB,6BAAA,EACvB,YAAY,kBAAA,EACZ,gBAAgB,sBAAA,EAChB,gBAAgB,sBAAA,EAChB,WAAW,iBAAA,EACX,aAAa,mBAAA,EACb,WAAW,iBAAA,EACX,cAAc,oBAAA,EACd,eAAe,qBAAA,EACf,eAAe,qBAAA,EACf,cAAc,oBAAA,EACd,mBAAmB,yBAAA,EACnB,eAAe,qBAAA,EACf,UAAU,gBAAA,EACV,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AE;QAC5B,kBAAkB,GAAG,IAAI,CAAC;KAC3B;IAED,4DAA4D;IAC5D,IAAI,CAAC,CAAC,UAAU,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,IAAI,WAAW,EAAE;QACnE,kBAAkB,GAAG,IAAI,CAAC;KAC3B;IAED,kEAAkE;IAClE,IAAI,UAAU,IAAI,kBAAkB,KAAK,QAAQ,IAAI,CAAC,WAAW,IAAI,SAAS,CAAC,EAAE;QAC/E,kBAAkB,GAAG,IAAI,CAAC;KAC3B;IAED,kEAAkE;IAClE,IAAI,UAAU,IAAI,gBAAgB,IAAI,kBAAkB,KAAK,MAAM,EAAE;QACnE,kBAAkB,GAAG,IAAI,CAAC;KAC3B;IAED,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED;;;;;GAKG;AACH,SAAS,iBAAiB,CAAC,gBAAyB,EAAE,cAAwB;IAC5E,OAAO,gBAAgB,IAAI,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAC3D,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,kBAAkB,CACzB,oBAA4B,EAC5B,aAA+B,EAC/B,2BAAqC;IAErC,IAAI,iBAAiB,GAAG,KAAK,CAAC;IAE9B,IAAI,2BAA2B,EAAE;QAC/B,iBAAiB,GAAG,IAAI,CAAC;KAC1B;SAAM,IAAI,CAAC,aAAa,IAAI,oBAAoB,IAAI,CAAC,EAAE;QACtD,iBAAiB,GAAG,IAAI,CAAC;KAC1B;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useLayoutEffect } from 'react';\nimport clsx from 'clsx';\nimport { AppLayoutContext } from './context';\nimport { SplitPanelContext } from '../../internal/context/split-panel-context';\nimport styles from './styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\nimport { AppLayoutProps } from '../interfaces';\nimport customCssProps from '../../internal/generated/custom-css-properties';\n\ninterface LayoutProps {\n children: React.ReactNode;\n}\n\n/**\n * The layoutElement ref will be used by the resize observers to calculate the offset from\n * the top and bottom of the viewport based on the header and footer elements. This is to\n * ensure the Layout component minimum height will fill 100% of the viewport less those\n * cumulative heights.\n */\nexport default function Layout({ children }: LayoutProps) {\n const {\n contentHeader,\n contentType,\n disableBodyScroll,\n disableContentHeaderOverlap,\n dynamicOverlapHeight,\n footerHeight,\n hasNotificationsContent,\n headerHeight,\n isNavigationOpen,\n isSplitPanelOpen,\n isToolsOpen,\n layoutElement,\n layoutWidth,\n mainOffsetLeft,\n maxContentWidth,\n minContentWidth,\n navigationHide,\n notificationsHeight,\n setOffsetBottom,\n splitPanel,\n stickyNotifications,\n toolsHide,\n } = useContext(AppLayoutContext);\n\n const {\n getHeader: getSplitPanelHeader,\n position: splitPanelPosition,\n size: splitPanelSize,\n } = useContext(SplitPanelContext);\n\n const isOverlapDisabled = getOverlapDisabled(dynamicOverlapHeight, contentHeader, disableContentHeaderOverlap);\n\n // Content gaps on the left and right are used with the minmax function in the CSS grid column definition\n const hasContentGapLeft = getContentGapLeft(isNavigationOpen, navigationHide);\n const hasContentGapRight = getContentGapRight(\n splitPanelPosition,\n isSplitPanelOpen,\n isToolsOpen,\n splitPanel,\n toolsHide\n );\n\n /**\n * Determine the offsetBottom value based on the presence of a footer element and\n * the SplitPanel component. Ignore the SplitPanel if it is not in the bottom\n * position. Use the size property if it is open and the header height if it is closed.\n */\n useLayoutEffect(\n function handleOffsetBottom() {\n let offsetBottom = footerHeight;\n\n if (splitPanel && splitPanelPosition === 'bottom') {\n if (isSplitPanelOpen) {\n offsetBottom += splitPanelSize;\n } else {\n const splitPanelHeader = getSplitPanelHeader();\n offsetBottom += splitPanelHeader ? splitPanelHeader.clientHeight : 0;\n }\n }\n\n setOffsetBottom(offsetBottom);\n },\n [\n footerHeight,\n getSplitPanelHeader,\n isSplitPanelOpen,\n setOffsetBottom,\n splitPanelPosition,\n splitPanel,\n splitPanelSize,\n ]\n );\n\n return (\n <main\n className={clsx(\n styles.layout,\n styles[`content-type-${contentType}`],\n styles[`split-panel-position-${splitPanelPosition ?? 'bottom'}`],\n {\n [styles['disable-body-scroll']]: disableBodyScroll,\n [testutilStyles['disable-body-scroll-root']]: disableBodyScroll,\n [styles['has-content-gap-left']]: hasContentGapLeft,\n [styles['has-content-gap-right']]: hasContentGapRight,\n [styles['has-max-content-width']]: maxContentWidth && maxContentWidth > 0,\n [styles['has-split-panel']]: splitPanel,\n [styles['has-sticky-notifications']]: stickyNotifications && hasNotificationsContent,\n [styles['is-overlap-disabled']]: isOverlapDisabled,\n },\n testutilStyles.root\n )}\n ref={layoutElement}\n style={{\n [customCssProps.headerHeight]: `${headerHeight}px`,\n [customCssProps.footerHeight]: `${footerHeight}px`,\n [customCssProps.layoutWidth]: `${layoutWidth}px`,\n [customCssProps.mainOffsetLeft]: `${mainOffsetLeft}px`,\n ...(maxContentWidth && { [customCssProps.maxContentWidth]: `${maxContentWidth}px` }),\n ...(minContentWidth && { [customCssProps.minContentWidth]: `${minContentWidth}px` }),\n [customCssProps.notificationsHeight]: `${notificationsHeight}px`,\n ...(!isOverlapDisabled &&\n dynamicOverlapHeight > 0 && { [customCssProps.overlapHeight]: `${dynamicOverlapHeight}px` }),\n }}\n >\n {children}\n </main>\n );\n}\n\n/**\n * When the Navigation and Tools are present the grid definition has the center column\n * touch the first and last columns with no gap. The forms with the circular buttons\n * for Navigation and Tools have internal padding which creates the necessary\n * horizontal space when the drawers are closed. The remaining conditions below\n * determine the necessity of utilizing the content gap left property to create\n * horizontal space between the center column and its adjacent siblings.\n */\nfunction getContentGapRight(\n splitPanelPosition: AppLayoutProps.SplitPanelPosition,\n isSplitPanelOpen?: boolean,\n isToolsOpen?: boolean,\n splitPanel?: React.ReactNode,\n toolsHide?: boolean\n) {\n let hasContentGapRight = false;\n\n // Main is touching the edge of the Layout and needs a content gap\n if (!splitPanel && toolsHide) {\n hasContentGapRight = true;\n }\n\n // Main is touching the Tools drawer and needs a content gap\n if ((!splitPanel || !isSplitPanelOpen) && !toolsHide && isToolsOpen) {\n hasContentGapRight = true;\n }\n\n // Main is touching the edge of the Layout and needs a content gap\n if (splitPanel && splitPanelPosition === 'bottom' && (isToolsOpen || toolsHide)) {\n hasContentGapRight = true;\n }\n\n // Main is touching the Split Panel drawer and needs a content gap\n if (splitPanel && isSplitPanelOpen && splitPanelPosition === 'side') {\n hasContentGapRight = true;\n }\n\n return hasContentGapRight;\n}\n\n/**\n * Additional function to determine whether or not a content gap is needed\n * on the left (see the getContentGapRight function). The same render logic applies\n * regarding the center column touching an adjacent sibling but the only\n * component state that needs to be tracked is the Navigation.\n */\nfunction getContentGapLeft(isNavigationOpen: boolean, navigationHide?: boolean) {\n return isNavigationOpen || navigationHide ? true : false;\n}\n\n/**\n * Determine whether the overlap between the contentHeader and content slots should be disabled.\n * The disableContentHeaderOverlap property is absolute and will always disable the overlap\n * if it is set to true. If there is no contentHeader then the overlap should be disabled\n * unless there is a dynamicOverlapHeight. The dynamicOverlapHeight property is set by a\n * component in the content slot that needs to manually control the overlap height. Components\n * such as the Table (full page variant), Wizard, ContentLayout use this property and will\n * retain the overlap even if there is nothing rendered in the contentHeader slot.\n */\nfunction getOverlapDisabled(\n dynamicOverlapHeight: number,\n contentHeader?: React.ReactNode,\n disableContentHeaderOverlap?: boolean\n) {\n let isOverlapDisabled = false;\n\n if (disableContentHeaderOverlap) {\n isOverlapDisabled = true;\n } else if (!contentHeader && dynamicOverlapHeight <= 0) {\n isOverlapDisabled = true;\n }\n\n return isOverlapDisabled;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"split-panel.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/split-panel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAS5D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAM/C;;;GAGG;AACH,iBAAS,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,eAmDjE;kBAnDQ,UAAU;;;;AAqDnB;;;;;GAKG;AACH,iBAAS,gBAAgB,uBAmCxB;AAED;;;;;GAKG;AACH,iBAAS,cAAc,uBA+BtB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,0BAA0B,EAAE,OAAO,EACnC,qBAAqB,EAAE,cAAc,CAAC,qBAAqB,GAAG,SAAS,qCASxE;AAID,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"split-panel.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/split-panel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAS5D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAM/C;;;GAGG;AACH,iBAAS,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,eAyDjE;kBAzDQ,UAAU;;;;AA2DnB;;;;;GAKG;AACH,iBAAS,gBAAgB,uBAmCxB;AAED;;;;;GAKG;AACH,iBAAS,cAAc,uBA+BtB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,0BAA0B,EAAE,OAAO,EACnC,qBAAqB,EAAE,cAAc,CAAC,qBAAqB,GAAG,SAAS,qCASxE;AAID,eAAe,UAAU,CAAC"}
@@ -16,7 +16,7 @@ import customCssProps from '../../internal/generated/custom-css-properties';
16
16
  */
17
17
  function SplitPanel(_a) {
18
18
  var children = _a.children;
19
- var _b = useContext(AppLayoutContext), handleSplitPanelClick = _b.handleSplitPanelClick, handleSplitPanelPreferencesChange = _b.handleSplitPanelPreferencesChange, handleSplitPanelResize = _b.handleSplitPanelResize, isMobile = _b.isMobile, isSplitPanelForcedPosition = _b.isSplitPanelForcedPosition, isSplitPanelOpen = _b.isSplitPanelOpen, setSplitPanelReportedSize = _b.setSplitPanelReportedSize, splitPanelPosition = _b.splitPanelPosition, splitPanelSize = _b.splitPanelSize;
19
+ var _b = useContext(AppLayoutContext), handleSplitPanelClick = _b.handleSplitPanelClick, handleSplitPanelPreferencesChange = _b.handleSplitPanelPreferencesChange, handleSplitPanelResize = _b.handleSplitPanelResize, isMobile = _b.isMobile, isSplitPanelForcedPosition = _b.isSplitPanelForcedPosition, isSplitPanelOpen = _b.isSplitPanelOpen, setSplitPanelReportedSize = _b.setSplitPanelReportedSize, splitPanelPosition = _b.splitPanelPosition, splitPanelSize = _b.splitPanelSize, headerHeight = _b.headerHeight, footerHeight = _b.footerHeight;
20
20
  var _c = useState(undefined), openButtonAriaLabel = _c[0], setOpenButtonAriaLabel = _c[1];
21
21
  var _d = useState(), splitPanelLastInteraction = _d[0], setSplitPanelLastInteraction = _d[1];
22
22
  useEffectOnUpdate(function () { return setSplitPanelLastInteraction(isSplitPanelOpen ? { type: 'open' } : { type: 'close' }); }, [isSplitPanelOpen]);
@@ -25,7 +25,11 @@ function SplitPanel(_a) {
25
25
  var splitPanelHeaderRef = useRef(null);
26
26
  var context = {
27
27
  bottomOffset: 0,
28
- getMaxHeight: function () { return document.documentElement.clientHeight - 250; },
28
+ getMaxHeight: function () {
29
+ var availableHeight = document.documentElement.clientHeight - headerHeight - footerHeight;
30
+ // If the page is likely zoomed in at 200%, allow the split panel to fill the content area.
31
+ return availableHeight < 400 ? availableHeight - 40 : availableHeight - 250;
32
+ },
29
33
  getMaxWidth: function () { return document.documentElement.clientWidth; },
30
34
  getHeader: function () { return splitPanelHeaderRef.current; },
31
35
  isForcedPosition: isSplitPanelForcedPosition,
@@ -1 +1 @@
1
- {"version":3,"file":"split-panel.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/split-panel.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,IAAI,M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B,CAAC;AACrC,UAAU,CAAC,IAAI,GAAG,cAAc,CAAC;AAEjC,eAAe,UAAU,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport { AppLayoutContext } from './context';\nimport {\n SplitPanelContext,\n SplitPanelContextProps,\n SplitPanelLastInteraction,\n} from '../../internal/context/split-panel-context';\nimport styles from './styles.css.js';\nimport { AppLayoutProps } from '../interfaces';\nimport { useEffectOnUpdate } from '../../internal/hooks/use-effect-on-update';\nimport { Transition } from '../../internal/components/transition';\nimport { useObservedElement } from '../utils/use-observed-element';\nimport customCssProps from '../../internal/generated/custom-css-properties';\n\n/**\n * If there is no Split Panel in the AppLayout context then the SplitPanel\n * will pass through the AppLayout children without the context.\n */\nfunction SplitPanel({ children }: React.PropsWithChildren<unknown>) {\n const {\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n isMobile,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n setSplitPanelReportedSize,\n splitPanelPosition,\n splitPanelSize,\n } = useContext(AppLayoutContext);\n\n const [openButtonAriaLabel, setOpenButtonAriaLabel] = useState<undefined | string>(undefined);\n\n const [splitPanelLastInteraction, setSplitPanelLastInteraction] = useState<undefined | SplitPanelLastInteraction>();\n useEffectOnUpdate(\n () => setSplitPanelLastInteraction(isSplitPanelOpen ? { type: 'open' } : { type: 'close' }),\n [isSplitPanelOpen]\n );\n useEffectOnUpdate(() => setSplitPanelLastInteraction({ type: 'position' }), [splitPanelPosition]);\n\n const splitPanelRef = useRef<HTMLDivElement>(null);\n const splitPanelHeaderRef = useRef<HTMLDivElement>(null);\n\n const context: SplitPanelContextProps = {\n bottomOffset: 0,\n getMaxHeight: () => document.documentElement.clientHeight - 250,\n getMaxWidth: () => document.documentElement.clientWidth,\n getHeader: () => splitPanelHeaderRef.current,\n isForcedPosition: isSplitPanelForcedPosition,\n isMobile,\n isOpen: isSplitPanelOpen,\n isRefresh: true,\n leftOffset: 0,\n onPreferencesChange: handleSplitPanelPreferencesChange,\n onResize: handleSplitPanelResize,\n onToggle: handleSplitPanelClick,\n position: splitPanelPosition,\n reportSize: setSplitPanelReportedSize,\n rightOffset: 0,\n size: splitPanelSize || 0,\n splitPanelRef,\n splitPanelHeaderRef,\n topOffset: 0,\n openButtonAriaLabel,\n setOpenButtonAriaLabel,\n lastInteraction: splitPanelLastInteraction,\n };\n\n return <SplitPanelContext.Provider value={{ ...context }}>{children}</SplitPanelContext.Provider>;\n}\n\n/**\n * This is the render function for the SplitPanel when it is in bottom position.\n * The Split Panel container will be another row entry in the grid definition in\n * the Layout component. The start and finish columns will be variable based\n * on the the presence and state of the Navigation and Tools components.\n */\nfunction SplitPanelBottom() {\n const { disableBodyScroll, isNavigationOpen, isSplitPanelOpen, isToolsOpen, splitPanel, splitPanelReportedSize } =\n useContext(AppLayoutContext);\n\n const { position: splitPanelPosition, getHeader } = useContext(SplitPanelContext);\n\n const headerHeight = useObservedElement(getHeader);\n\n if (!splitPanel) {\n return null;\n }\n\n return (\n <Transition in={isSplitPanelOpen ?? false} exit={false}>\n {(state, transitionEventsRef) => (\n <section\n className={clsx(styles['split-panel-bottom'], styles[`position-${splitPanelPosition}`], {\n [styles.animating]: state === 'entering',\n [styles['disable-body-scroll']]: disableBodyScroll,\n [styles['is-navigation-open']]: isNavigationOpen,\n [styles['is-split-panel-open']]: isSplitPanelOpen,\n [styles['is-tools-open']]: isToolsOpen,\n })}\n ref={transitionEventsRef}\n style={{\n [customCssProps.splitPanelReportedSize]: `${splitPanelReportedSize}px`,\n [customCssProps.splitPanelReportedHeaderSize]: `${headerHeight}px`,\n }}\n >\n <SplitPanel></SplitPanel>\n {splitPanelPosition === 'bottom' && splitPanel}\n </section>\n )}\n </Transition>\n );\n}\n\n/**\n * This is the render function for the SplitPanel when it is side position.\n * The Split Panel will not be within the grid defined in the Layout component\n * but instead a direct child of the Tools component. The width constraints\n * for this position are computed in the Tools component.\n */\nfunction SplitPanelSide() {\n const { isSplitPanelOpen, splitPanel, splitPanelMaxWidth, splitPanelMinWidth, splitPanelReportedSize } =\n useContext(AppLayoutContext);\n\n const { position: splitPanelPosition } = useContext(SplitPanelContext);\n\n if (!splitPanel) {\n return null;\n }\n\n return (\n <Transition in={isSplitPanelOpen ?? false} exit={false}>\n {(state, transitionEventsRef) => (\n <section\n aria-hidden={!isSplitPanelOpen || splitPanelPosition === 'bottom' ? true : false}\n className={clsx(styles['split-panel-side'], styles[`position-${splitPanelPosition}`], {\n [styles.animating]: state === 'entering',\n [styles['is-split-panel-open']]: isSplitPanelOpen,\n })}\n ref={transitionEventsRef}\n style={{\n [customCssProps.splitPanelMaxWidth]: `${splitPanelMaxWidth}px`,\n [customCssProps.splitPanelMinWidth]: `${splitPanelMinWidth}px`,\n [customCssProps.splitPanelReportedHeaderSize]: `${splitPanelReportedSize}px`,\n }}\n >\n <div className={clsx(styles['animated-content'])}>{splitPanelPosition === 'side' && splitPanel}</div>\n </section>\n )}\n </Transition>\n );\n}\n\n/**\n * This logic will determine what the Split Panel position should be. It reconciles the possibility\n * of being in forced position with the current selected position in the settings.\n */\nexport function getSplitPanelPosition(\n isSplitPanelForcedPosition: boolean,\n splitPanelPreferences: AppLayoutProps.SplitPanelPreferences | undefined\n) {\n let splitPanelPosition: AppLayoutProps.SplitPanelPosition = 'bottom';\n\n if (!isSplitPanelForcedPosition && splitPanelPreferences?.position === 'side') {\n splitPanelPosition = 'side';\n }\n\n return splitPanelPosition;\n}\nSplitPanel.Bottom = SplitPanelBottom;\nSplitPanel.Side = SplitPanelSide;\n\nexport default SplitPanel;\n"]}
1
+ {"version":3,"file":"split-panel.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/split-panel.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,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AQ,CAAC;IAErE,IAAI,CAAC,0BAA0B,IAAI,CAAA,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,QAAQ,MAAK,MAAM,EAAE;QAC7E,kBAAkB,GAAG,MAAM,CAAC;KAC7B;IAED,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AACD,UAAU,CAAC,MAAM,GAAG,gBAAgB,CAAC;AACrC,UAAU,CAAC,IAAI,GAAG,cAAc,CAAC;AAEjC,eAAe,UAAU,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport { AppLayoutContext } from './context';\nimport {\n SplitPanelContext,\n SplitPanelContextProps,\n SplitPanelLastInteraction,\n} from '../../internal/context/split-panel-context';\nimport styles from './styles.css.js';\nimport { AppLayoutProps } from '../interfaces';\nimport { useEffectOnUpdate } from '../../internal/hooks/use-effect-on-update';\nimport { Transition } from '../../internal/components/transition';\nimport { useObservedElement } from '../utils/use-observed-element';\nimport customCssProps from '../../internal/generated/custom-css-properties';\n\n/**\n * If there is no Split Panel in the AppLayout context then the SplitPanel\n * will pass through the AppLayout children without the context.\n */\nfunction SplitPanel({ children }: React.PropsWithChildren<unknown>) {\n const {\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n isMobile,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n setSplitPanelReportedSize,\n splitPanelPosition,\n splitPanelSize,\n headerHeight,\n footerHeight,\n } = useContext(AppLayoutContext);\n\n const [openButtonAriaLabel, setOpenButtonAriaLabel] = useState<undefined | string>(undefined);\n\n const [splitPanelLastInteraction, setSplitPanelLastInteraction] = useState<undefined | SplitPanelLastInteraction>();\n useEffectOnUpdate(\n () => setSplitPanelLastInteraction(isSplitPanelOpen ? { type: 'open' } : { type: 'close' }),\n [isSplitPanelOpen]\n );\n useEffectOnUpdate(() => setSplitPanelLastInteraction({ type: 'position' }), [splitPanelPosition]);\n\n const splitPanelRef = useRef<HTMLDivElement>(null);\n const splitPanelHeaderRef = useRef<HTMLDivElement>(null);\n\n const context: SplitPanelContextProps = {\n bottomOffset: 0,\n getMaxHeight: () => {\n const availableHeight = document.documentElement.clientHeight - headerHeight - footerHeight;\n // If the page is likely zoomed in at 200%, allow the split panel to fill the content area.\n return availableHeight < 400 ? availableHeight - 40 : availableHeight - 250;\n },\n getMaxWidth: () => document.documentElement.clientWidth,\n getHeader: () => splitPanelHeaderRef.current,\n isForcedPosition: isSplitPanelForcedPosition,\n isMobile,\n isOpen: isSplitPanelOpen,\n isRefresh: true,\n leftOffset: 0,\n onPreferencesChange: handleSplitPanelPreferencesChange,\n onResize: handleSplitPanelResize,\n onToggle: handleSplitPanelClick,\n position: splitPanelPosition,\n reportSize: setSplitPanelReportedSize,\n rightOffset: 0,\n size: splitPanelSize || 0,\n splitPanelRef,\n splitPanelHeaderRef,\n topOffset: 0,\n openButtonAriaLabel,\n setOpenButtonAriaLabel,\n lastInteraction: splitPanelLastInteraction,\n };\n\n return <SplitPanelContext.Provider value={{ ...context }}>{children}</SplitPanelContext.Provider>;\n}\n\n/**\n * This is the render function for the SplitPanel when it is in bottom position.\n * The Split Panel container will be another row entry in the grid definition in\n * the Layout component. The start and finish columns will be variable based\n * on the the presence and state of the Navigation and Tools components.\n */\nfunction SplitPanelBottom() {\n const { disableBodyScroll, isNavigationOpen, isSplitPanelOpen, isToolsOpen, splitPanel, splitPanelReportedSize } =\n useContext(AppLayoutContext);\n\n const { position: splitPanelPosition, getHeader } = useContext(SplitPanelContext);\n\n const headerHeight = useObservedElement(getHeader);\n\n if (!splitPanel) {\n return null;\n }\n\n return (\n <Transition in={isSplitPanelOpen ?? false} exit={false}>\n {(state, transitionEventsRef) => (\n <section\n className={clsx(styles['split-panel-bottom'], styles[`position-${splitPanelPosition}`], {\n [styles.animating]: state === 'entering',\n [styles['disable-body-scroll']]: disableBodyScroll,\n [styles['is-navigation-open']]: isNavigationOpen,\n [styles['is-split-panel-open']]: isSplitPanelOpen,\n [styles['is-tools-open']]: isToolsOpen,\n })}\n ref={transitionEventsRef}\n style={{\n [customCssProps.splitPanelReportedSize]: `${splitPanelReportedSize}px`,\n [customCssProps.splitPanelReportedHeaderSize]: `${headerHeight}px`,\n }}\n >\n <SplitPanel></SplitPanel>\n {splitPanelPosition === 'bottom' && splitPanel}\n </section>\n )}\n </Transition>\n );\n}\n\n/**\n * This is the render function for the SplitPanel when it is side position.\n * The Split Panel will not be within the grid defined in the Layout component\n * but instead a direct child of the Tools component. The width constraints\n * for this position are computed in the Tools component.\n */\nfunction SplitPanelSide() {\n const { isSplitPanelOpen, splitPanel, splitPanelMaxWidth, splitPanelMinWidth, splitPanelReportedSize } =\n useContext(AppLayoutContext);\n\n const { position: splitPanelPosition } = useContext(SplitPanelContext);\n\n if (!splitPanel) {\n return null;\n }\n\n return (\n <Transition in={isSplitPanelOpen ?? false} exit={false}>\n {(state, transitionEventsRef) => (\n <section\n aria-hidden={!isSplitPanelOpen || splitPanelPosition === 'bottom' ? true : false}\n className={clsx(styles['split-panel-side'], styles[`position-${splitPanelPosition}`], {\n [styles.animating]: state === 'entering',\n [styles['is-split-panel-open']]: isSplitPanelOpen,\n })}\n ref={transitionEventsRef}\n style={{\n [customCssProps.splitPanelMaxWidth]: `${splitPanelMaxWidth}px`,\n [customCssProps.splitPanelMinWidth]: `${splitPanelMinWidth}px`,\n [customCssProps.splitPanelReportedHeaderSize]: `${splitPanelReportedSize}px`,\n }}\n >\n <div className={clsx(styles['animated-content'])}>{splitPanelPosition === 'side' && splitPanel}</div>\n </section>\n )}\n </Transition>\n );\n}\n\n/**\n * This logic will determine what the Split Panel position should be. It reconciles the possibility\n * of being in forced position with the current selected position in the settings.\n */\nexport function getSplitPanelPosition(\n isSplitPanelForcedPosition: boolean,\n splitPanelPreferences: AppLayoutProps.SplitPanelPreferences | undefined\n) {\n let splitPanelPosition: AppLayoutProps.SplitPanelPosition = 'bottom';\n\n if (!isSplitPanelForcedPosition && splitPanelPreferences?.position === 'side') {\n splitPanelPosition = 'side';\n }\n\n return splitPanelPosition;\n}\nSplitPanel.Bottom = SplitPanelBottom;\nSplitPanel.Side = SplitPanelSide;\n\nexport default SplitPanel;\n"]}
@@ -10,7 +10,7 @@ import InternalFormField from '../form-field/internal';
10
10
  import InternalModal from '../modal/internal';
11
11
  import InternalSelect from '../select/internal';
12
12
  import InternalSpaceBetween from '../space-between/internal';
13
- import { FormFieldDomContext } from '../internal/context/form-field-context';
13
+ import { FormFieldContext } from '../internal/context/form-field-context';
14
14
  import { LightThemes, DarkThemes } from './ace-themes';
15
15
  export default (function (props) {
16
16
  var _a, _b, _c, _d;
@@ -21,7 +21,7 @@ export default (function (props) {
21
21
  setTheme(e.detail.selectedOption.value);
22
22
  setSelectedThemeOption(e.detail.selectedOption);
23
23
  };
24
- return (React.createElement(FormFieldDomContext.RootProvider, { value: {} },
24
+ return (React.createElement(FormFieldContext.Provider, { value: {} },
25
25
  React.createElement(InternalModal, { size: "medium", visible: true, onDismiss: props.onDismiss, header: props.i18nStrings.header, closeAriaLabel: props.i18nStrings.cancel, footer: React.createElement(InternalBox, { float: "right" },
26
26
  React.createElement(InternalSpaceBetween, { direction: "horizontal", size: "xs" },
27
27
  React.createElement(InternalButton, { onClick: props.onDismiss }, props.i18nStrings.cancel),
@@ -1 +1 @@
1
- {"version":3,"file":"preferences-modal.js","sourceRoot":"","sources":["../../../src/code-editor/preferences-modal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,iBAAiB,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or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\n\nimport InternalBox from '../box/internal';\nimport { InternalButton } from '../button/internal';\nimport InternalCheckbox from '../checkbox/internal';\nimport InternalColumnLayout from '../column-layout/internal';\nimport InternalFormField from '../form-field/internal';\nimport InternalModal from '../modal/internal';\nimport { SelectProps } from '../select/interfaces';\nimport InternalSelect from '../select/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { FormFieldDomContext } from '../internal/context/form-field-context';\nimport { NonCancelableCustomEvent } from '../internal/events';\nimport { LightThemes, DarkThemes } from './ace-themes';\nimport { CodeEditorProps } from './interfaces';\n\ninterface PreferencesModali18nStrings {\n header: string;\n cancel: string;\n confirm: string;\n wrapLines: string;\n theme: string;\n lightThemes: string;\n darkThemes: string;\n}\n\ninterface PreferencesModalProps {\n preferences?: Partial<CodeEditorProps.Preferences>;\n\n i18nStrings: PreferencesModali18nStrings;\n\n defaultTheme: CodeEditorProps.Theme;\n\n onConfirm: (preferences: CodeEditorProps.Preferences) => void;\n onDismiss: () => void;\n}\n\nexport default (props: PreferencesModalProps) => {\n const [wrapLines, setWrapLines] = useState<boolean>(props.preferences?.wrapLines ?? true);\n const [theme, setTheme] = useState<CodeEditorProps.Theme>(props.preferences?.theme ?? props.defaultTheme);\n const [selectedThemeOption, setSelectedThemeOption] = useState<SelectProps.Option>(\n () => [...LightThemes, ...DarkThemes].filter(t => t.value === theme)[0]\n );\n\n const onThemeSelected = (e: NonCancelableCustomEvent<SelectProps.ChangeDetail>) => {\n setTheme(e.detail.selectedOption.value as CodeEditorProps.Theme);\n setSelectedThemeOption(e.detail.selectedOption);\n };\n\n return (\n <FormFieldDomContext.RootProvider value={{}}>\n <InternalModal\n size=\"medium\"\n visible={true}\n onDismiss={props.onDismiss}\n header={props.i18nStrings.header}\n closeAriaLabel={props.i18nStrings.cancel}\n footer={\n <InternalBox float=\"right\">\n <InternalSpaceBetween direction=\"horizontal\" size=\"xs\">\n <InternalButton onClick={props.onDismiss}>{props.i18nStrings.cancel}</InternalButton>\n <InternalButton onClick={() => props.onConfirm({ wrapLines, theme })} variant=\"primary\">\n {props.i18nStrings.confirm}\n </InternalButton>\n </InternalSpaceBetween>\n </InternalBox>\n }\n >\n <InternalColumnLayout columns={2} variant=\"text-grid\">\n <div>\n <InternalCheckbox checked={wrapLines} onChange={e => setWrapLines(e.detail.checked)}>\n {props.i18nStrings.wrapLines}\n </InternalCheckbox>\n </div>\n <div>\n <InternalFormField label={props.i18nStrings.theme}>\n <InternalSelect\n selectedOption={selectedThemeOption}\n onChange={onThemeSelected}\n options={[\n { label: props.i18nStrings.lightThemes, options: LightThemes },\n { label: props.i18nStrings.darkThemes, options: DarkThemes },\n ]}\n filteringType=\"auto\"\n />\n </InternalFormField>\n </div>\n </InternalColumnLayout>\n </InternalModal>\n </FormFieldDomContext.RootProvider>\n );\n};\n"]}
1
+ {"version":3,"file":"preferences-modal.js","sourceRoot":"","sources":["../../../src/code-editor/preferences-modal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAE9C,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAwBvD,gBAAe,UAAC,KAA4B;;IACpC,IAAA,KAA4B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Ac,IAAC,OAAO,EAAE,cAAM,OAAA,KAAK,CAAC,SAAS,CAAC,EAAE,SAAS,WAAA,EAAE,KAAK,OAAA,EAAE,CAAC,EAArC,CAAqC,EAAE,OAAO,EAAC,SAAS,IACpF,KAAK,CAAC,WAAW,CAAC,OAAO,CACX,CACI,CACX;YAGhB,oBAAC,oBAAoB,IAAC,OAAO,EAAE,CAAC,EAAE,OAAO,EAAC,WAAW;gBACnD;oBACE,oBAAC,gBAAgB,IAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAA,CAAC,IAAI,OAAA,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAA9B,CAA8B,IAChF,KAAK,CAAC,WAAW,CAAC,SAAS,CACX,CACf;gBACN;oBACE,oBAAC,iBAAiB,IAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,KAAK;wBAC/C,oBAAC,cAAc,IACb,cAAc,EAAE,mBAAmB,EACnC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE;gCACP,EAAE,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE;gCAC9D,EAAE,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE;6BAC7D,EACD,aAAa,EAAC,MAAM,GACpB,CACgB,CAChB,CACe,CACT,CACU,CAC7B,CAAC;AACJ,CAAC,EAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\n\nimport InternalBox from '../box/internal';\nimport { InternalButton } from '../button/internal';\nimport InternalCheckbox from '../checkbox/internal';\nimport InternalColumnLayout from '../column-layout/internal';\nimport InternalFormField from '../form-field/internal';\nimport InternalModal from '../modal/internal';\nimport { SelectProps } from '../select/interfaces';\nimport InternalSelect from '../select/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { FormFieldContext } from '../internal/context/form-field-context';\nimport { NonCancelableCustomEvent } from '../internal/events';\nimport { LightThemes, DarkThemes } from './ace-themes';\nimport { CodeEditorProps } from './interfaces';\n\ninterface PreferencesModali18nStrings {\n header: string;\n cancel: string;\n confirm: string;\n wrapLines: string;\n theme: string;\n lightThemes: string;\n darkThemes: string;\n}\n\ninterface PreferencesModalProps {\n preferences?: Partial<CodeEditorProps.Preferences>;\n\n i18nStrings: PreferencesModali18nStrings;\n\n defaultTheme: CodeEditorProps.Theme;\n\n onConfirm: (preferences: CodeEditorProps.Preferences) => void;\n onDismiss: () => void;\n}\n\nexport default (props: PreferencesModalProps) => {\n const [wrapLines, setWrapLines] = useState<boolean>(props.preferences?.wrapLines ?? true);\n const [theme, setTheme] = useState<CodeEditorProps.Theme>(props.preferences?.theme ?? props.defaultTheme);\n const [selectedThemeOption, setSelectedThemeOption] = useState<SelectProps.Option>(\n () => [...LightThemes, ...DarkThemes].filter(t => t.value === theme)[0]\n );\n\n const onThemeSelected = (e: NonCancelableCustomEvent<SelectProps.ChangeDetail>) => {\n setTheme(e.detail.selectedOption.value as CodeEditorProps.Theme);\n setSelectedThemeOption(e.detail.selectedOption);\n };\n\n return (\n <FormFieldContext.Provider value={{}}>\n <InternalModal\n size=\"medium\"\n visible={true}\n onDismiss={props.onDismiss}\n header={props.i18nStrings.header}\n closeAriaLabel={props.i18nStrings.cancel}\n footer={\n <InternalBox float=\"right\">\n <InternalSpaceBetween direction=\"horizontal\" size=\"xs\">\n <InternalButton onClick={props.onDismiss}>{props.i18nStrings.cancel}</InternalButton>\n <InternalButton onClick={() => props.onConfirm({ wrapLines, theme })} variant=\"primary\">\n {props.i18nStrings.confirm}\n </InternalButton>\n </InternalSpaceBetween>\n </InternalBox>\n }\n >\n <InternalColumnLayout columns={2} variant=\"text-grid\">\n <div>\n <InternalCheckbox checked={wrapLines} onChange={e => setWrapLines(e.detail.checked)}>\n {props.i18nStrings.wrapLines}\n </InternalCheckbox>\n </div>\n <div>\n <InternalFormField label={props.i18nStrings.theme}>\n <InternalSelect\n selectedOption={selectedThemeOption}\n onChange={onThemeSelected}\n options={[\n { label: props.i18nStrings.lightThemes, options: LightThemes },\n { label: props.i18nStrings.darkThemes, options: DarkThemes },\n ]}\n filteringType=\"auto\"\n />\n </InternalFormField>\n </div>\n </InternalColumnLayout>\n </InternalModal>\n </FormFieldContext.Provider>\n );\n};\n"]}