@cloudscape-design/components 3.0.608 → 3.0.609

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 (49) hide show
  1. package/app-layout/classic.d.ts +9 -3
  2. package/app-layout/classic.d.ts.map +1 -1
  3. package/app-layout/classic.js +26 -25
  4. package/app-layout/classic.js.map +1 -1
  5. package/app-layout/implementation.d.ts +9 -3
  6. package/app-layout/implementation.d.ts.map +1 -1
  7. package/app-layout/index.d.ts.map +1 -1
  8. package/app-layout/index.js +6 -4
  9. package/app-layout/index.js.map +1 -1
  10. package/app-layout/interfaces.d.ts +9 -1
  11. package/app-layout/interfaces.d.ts.map +1 -1
  12. package/app-layout/interfaces.js.map +1 -1
  13. package/app-layout/internal.d.ts +9 -3
  14. package/app-layout/internal.d.ts.map +1 -1
  15. package/app-layout/utils/use-app-layout-placement.d.ts +9 -0
  16. package/app-layout/utils/use-app-layout-placement.d.ts.map +1 -0
  17. package/app-layout/utils/use-app-layout-placement.js +29 -0
  18. package/app-layout/utils/use-app-layout-placement.js.map +1 -0
  19. package/app-layout/visual-refresh/context.d.ts.map +1 -1
  20. package/app-layout/visual-refresh/context.js +10 -41
  21. package/app-layout/visual-refresh/context.js.map +1 -1
  22. package/app-layout/visual-refresh/index.d.ts +9 -3
  23. package/app-layout/visual-refresh/index.d.ts.map +1 -1
  24. package/app-layout/visual-refresh/tools.d.ts.map +1 -1
  25. package/app-layout/visual-refresh/tools.js +2 -9
  26. package/app-layout/visual-refresh/tools.js.map +1 -1
  27. package/internal/environment.js +1 -1
  28. package/internal/environment.json +1 -1
  29. package/internal/manifest.json +1 -1
  30. package/internal/utils/handle-key.d.ts +15 -11
  31. package/internal/utils/handle-key.d.ts.map +1 -1
  32. package/internal/utils/handle-key.js +9 -9
  33. package/internal/utils/handle-key.js.map +1 -1
  34. package/package.json +1 -1
  35. package/test-utils/dom/app-layout/index.d.ts +1 -0
  36. package/test-utils/dom/app-layout/index.js +4 -0
  37. package/test-utils/dom/app-layout/index.js.map +1 -1
  38. package/test-utils/selectors/app-layout/index.d.ts +1 -0
  39. package/test-utils/selectors/app-layout/index.js +4 -0
  40. package/test-utils/selectors/app-layout/index.js.map +1 -1
  41. package/test-utils/tsconfig.tsbuildinfo +1 -1
  42. package/app-layout/utils/use-app-layout-rect.d.ts +0 -8
  43. package/app-layout/utils/use-app-layout-rect.d.ts.map +0 -1
  44. package/app-layout/utils/use-app-layout-rect.js +0 -24
  45. package/app-layout/utils/use-app-layout-rect.js.map +0 -1
  46. package/app-layout/utils/use-content-height.d.ts +0 -8
  47. package/app-layout/utils/use-content-height.d.ts.map +0 -1
  48. package/app-layout/utils/use-content-height.js +0 -25
  49. package/app-layout/utils/use-content-height.js.map +0 -1
@@ -1,24 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { useResizeObserver } from '@cloudscape-design/component-toolkit/internal';
4
- import { useCallback, useEffect, useState } from 'react';
5
- export default function useAppLayoutRect(element) {
6
- const [offsets, setOffsets] = useState({ left: 0, right: 0, width: Number.POSITIVE_INFINITY });
7
- const updatePosition = useCallback(() => {
8
- // skip reading sizes in JSDOM
9
- if (!element || !document.body.clientWidth) {
10
- return;
11
- }
12
- const { left, right } = element.getBoundingClientRect();
13
- const bodyWidth = document.body.clientWidth;
14
- setOffsets({ left, right: bodyWidth - right, width: bodyWidth });
15
- }, [element]);
16
- useEffect(() => {
17
- window.addEventListener('resize', updatePosition);
18
- return () => window.removeEventListener('resize', updatePosition);
19
- }, [updatePosition]);
20
- const getElement = useCallback(() => element, [element]);
21
- useResizeObserver(getElement, updatePosition);
22
- return offsets;
23
- }
24
- //# sourceMappingURL=use-app-layout-rect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-app-layout-rect.js","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-app-layout-rect.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAs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amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useResizeObserver } from '@cloudscape-design/component-toolkit/internal';\nimport { useCallback, useEffect, useState } from 'react';\n\ninterface AppLayoutRect {\n left: number;\n right: number;\n width: number;\n}\n\nexport default function useAppLayoutRect(element: HTMLDivElement | null): AppLayoutRect {\n const [offsets, setOffsets] = useState({ left: 0, right: 0, width: Number.POSITIVE_INFINITY });\n\n const updatePosition = useCallback(() => {\n // skip reading sizes in JSDOM\n if (!element || !document.body.clientWidth) {\n return;\n }\n const { left, right } = element.getBoundingClientRect();\n const bodyWidth = document.body.clientWidth;\n\n setOffsets({ left, right: bodyWidth - right, width: bodyWidth });\n }, [element]);\n\n useEffect(() => {\n window.addEventListener('resize', updatePosition);\n return () => window.removeEventListener('resize', updatePosition);\n }, [updatePosition]);\n\n const getElement = useCallback(() => element, [element]);\n useResizeObserver(getElement, updatePosition);\n\n return offsets;\n}\n"]}
@@ -1,8 +0,0 @@
1
- export default function useContentHeight(headerSelector: string, footerSelector: string, disableBodyScroll?: boolean): {
2
- headerHeight: number;
3
- footerHeight: number;
4
- contentHeightStyle: {
5
- [x: string]: string;
6
- };
7
- };
8
- //# sourceMappingURL=use-content-height.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-content-height.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-content-height.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO;;;;;;EAsBnH"}
@@ -1,25 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { useEffect, useState } from 'react';
4
- import { useObservedElement } from './use-observed-element';
5
- export default function useContentHeight(headerSelector, footerSelector, disableBodyScroll) {
6
- const headerHeight = useObservedElement(headerSelector);
7
- const footerHeight = useObservedElement(footerSelector);
8
- const [headerFooterHeight, setHeaderFooterHeight] = useState(0);
9
- // Delay applying changes in header/footer height, as applying them immediately can cause
10
- // ResizeOberver warnings due to the algorithm thinking that the change might have side-effects
11
- // further up the tree, therefore blocking notifications to prevent loops
12
- useEffect(() => {
13
- const id = requestAnimationFrame(() => setHeaderFooterHeight(headerHeight + footerHeight));
14
- return () => cancelAnimationFrame(id);
15
- }, [headerHeight, footerHeight]);
16
- const heightStyleValue = `calc(100vh - ${headerFooterHeight}px)`;
17
- return {
18
- headerHeight,
19
- footerHeight,
20
- contentHeightStyle: {
21
- [disableBodyScroll ? 'height' : 'minHeight']: heightStyleValue,
22
- },
23
- };
24
- }
25
- //# sourceMappingURL=use-content-height.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-content-height.js","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-content-height.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,cAAsB,EAAE,cAAsB,EAAE,iBAA2B;IAClH,MAAM,YAAY,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;IACxD,MAAM,YAAY,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;IACxD,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEhE,yFAAyF;IACzF,+FAA+F;IAC/F,yEAAyE;IACzE,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,EAAE,GAAG,qBAAqB,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC;QAC3F,OAAO,GAAG,EAAE,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC;IAEjC,MAAM,gBAAgB,GAAG,gBAAgB,kBAAkB,KAAK,CAAC;IAEjE,OAAO;QACL,YAAY;QACZ,YAAY;QACZ,kBAAkB,EAAE;YAClB,CAAC,iBAAiB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,gBAAgB;SAC/D;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useEffect, useState } from 'react';\nimport { useObservedElement } from './use-observed-element';\n\nexport default function useContentHeight(headerSelector: string, footerSelector: string, disableBodyScroll?: boolean) {\n const headerHeight = useObservedElement(headerSelector);\n const footerHeight = useObservedElement(footerSelector);\n const [headerFooterHeight, setHeaderFooterHeight] = useState(0);\n\n // Delay applying changes in header/footer height, as applying them immediately can cause\n // ResizeOberver warnings due to the algorithm thinking that the change might have side-effects\n // further up the tree, therefore blocking notifications to prevent loops\n useEffect(() => {\n const id = requestAnimationFrame(() => setHeaderFooterHeight(headerHeight + footerHeight));\n return () => cancelAnimationFrame(id);\n }, [headerHeight, footerHeight]);\n\n const heightStyleValue = `calc(100vh - ${headerFooterHeight}px)`;\n\n return {\n headerHeight,\n footerHeight,\n contentHeightStyle: {\n [disableBodyScroll ? 'height' : 'minHeight']: heightStyleValue,\n },\n };\n}\n"]}