@cloudscape-design/components-themeable 3.0.858 → 3.0.860

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.
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "a230eef09146c0c6436e4cc6e1d2a23d9189af17"
2
+ "commit": "f4413847a14c84965e452fedd63d41ab3ebc65b8"
3
3
  }
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (a230eef0)";
2
+ export var PACKAGE_VERSION = "3.0.0 (f4413847)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (a230eef0)",
3
+ "PACKAGE_VERSION": "3.0.0 (f4413847)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -1,8 +1,13 @@
1
+ export declare function isContainingBlock(element: HTMLElement): boolean;
1
2
  /**
2
3
  * Returns an element that is used to position the given element.
3
4
  * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block
4
5
  */
5
6
  export declare function getContainingBlock(startElement: HTMLElement): HTMLElement | null;
7
+ export declare function findUpUntilMultiple({ startElement, tests, }: {
8
+ startElement: HTMLElement;
9
+ tests: Record<string, (el: HTMLElement) => boolean>;
10
+ }): Record<string, HTMLElement>;
6
11
  /**
7
12
  * Parses a CSS color value that might contain CSS Custom Properties
8
13
  * and returns a value that will be understood by the browser, no matter of support level.
@@ -1 +1 @@
1
- {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/dom.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAchF;AAID;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,UAqB7C;AAKD,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,IAAI,CAYtD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,WAAW,CAUpE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,UAAU,CAQlE"}
1
+ {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/dom.ts"],"names":[],"mappings":"AAOA,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAQ/D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAMhF;AAOD,wBAAgB,mBAAmB,CAAC,EAClC,YAAY,EACZ,KAAK,GACN,EAAE;IACD,YAAY,EAAE,WAAW,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC;CACrD,+BAmBA;AAID;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,UAqB7C;AAKD,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,IAAI,CAYtD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,WAAW,CAUpE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,UAAU,CAQlE"}
@@ -2,6 +2,14 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import balanced from 'balanced-match';
4
4
  import { findUpUntil } from '@cloudscape-design/component-toolkit/dom';
5
+ export function isContainingBlock(element) {
6
+ var _a;
7
+ const computedStyle = getComputedStyle(element);
8
+ return ((!!computedStyle.transform && computedStyle.transform !== 'none') ||
9
+ (!!computedStyle.perspective && computedStyle.perspective !== 'none') ||
10
+ (!!computedStyle.containerType && computedStyle.containerType !== 'normal') ||
11
+ ((_a = computedStyle.contain) === null || _a === void 0 ? void 0 : _a.split(' ').some(s => ['layout', 'paint', 'strict', 'content'].includes(s))));
12
+ }
5
13
  /**
6
14
  * Returns an element that is used to position the given element.
7
15
  * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block
@@ -10,14 +18,31 @@ export function getContainingBlock(startElement) {
10
18
  if (!startElement.parentElement) {
11
19
  return null;
12
20
  }
13
- return findUpUntil(startElement.parentElement, element => {
14
- var _a;
15
- const computedStyle = getComputedStyle(element);
16
- return ((!!computedStyle.transform && computedStyle.transform !== 'none') ||
17
- (!!computedStyle.perspective && computedStyle.perspective !== 'none') ||
18
- (!!computedStyle.containerType && computedStyle.containerType !== 'normal') ||
19
- ((_a = computedStyle.contain) === null || _a === void 0 ? void 0 : _a.split(' ').some(s => ['layout', 'paint', 'strict', 'content'].includes(s))));
20
- });
21
+ return findUpUntil(startElement.parentElement, isContainingBlock);
22
+ }
23
+ /*
24
+ * Allows to find multiple elements in the page each according to a specific test function,
25
+ * but traversing the DOM only once.
26
+ */
27
+ export function findUpUntilMultiple({ startElement, tests, }) {
28
+ const keys = Object.keys(tests);
29
+ const elements = {};
30
+ let current = startElement;
31
+ while (current && Object.keys(elements).length < keys.length) {
32
+ current = current.parentElement;
33
+ // If a component is used within an svg (i.e. as foreignObject), then it will
34
+ // have some ancestor nodes that are SVGElement. We want to skip those,
35
+ // as they have very different properties to HTMLElements.
36
+ while (current && !isHTMLElement(current)) {
37
+ current = current.parentElement;
38
+ }
39
+ for (const key of keys) {
40
+ if (!elements[key] && current && tests[key](current)) {
41
+ elements[key] = current;
42
+ }
43
+ }
44
+ }
45
+ return elements;
21
46
  }
22
47
  const cssVariableExpression = /--.+?\s*,\s*(.+)/;
23
48
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"dom.js","sourceRoot":"","sources":["../../../../src/internal/utils/dom.ts"],"names":[],"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AO,CACL,MAAM,YAAY,UAAU;QAC5B,CAAC,MAAM,CAAC,MAAM,CAAC;YACb,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;YACrC,iBAAiB,IAAI,MAAM;YAC3B,OAAO,MAAM,CAAC,eAAe,KAAK,QAAQ,CAAC,CAC9C,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport balanced from 'balanced-match';\n\nimport { findUpUntil } from '@cloudscape-design/component-toolkit/dom';\n\n/**\n * Returns an element that is used to position the given element.\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block\n */\nexport function getContainingBlock(startElement: HTMLElement): HTMLElement | null {\n if (!startElement.parentElement) {\n return null;\n }\n\n return findUpUntil(startElement.parentElement, element => {\n const computedStyle = getComputedStyle(element);\n return (\n (!!computedStyle.transform && computedStyle.transform !== 'none') ||\n (!!computedStyle.perspective && computedStyle.perspective !== 'none') ||\n (!!computedStyle.containerType && computedStyle.containerType !== 'normal') ||\n computedStyle.contain?.split(' ').some(s => ['layout', 'paint', 'strict', 'content'].includes(s))\n );\n }) as HTMLElement;\n}\n\nconst cssVariableExpression = /--.+?\\s*,\\s*(.+)/;\n\n/**\n * Parses a CSS color value that might contain CSS Custom Properties\n * and returns a value that will be understood by the browser, no matter of support level.\n * If the browser support CSS Custom Properties, the value will be return as is. Otherwise,\n * the fallback value will be extracted and returned instead.\n */\nexport function parseCssVariable(value: string) {\n if (typeof window === 'undefined') {\n return value;\n }\n\n if (window.CSS?.supports?.('color', 'var(--dummy, #000)') ?? false) {\n return value;\n }\n\n const varIndex = value.lastIndexOf('var(');\n if (varIndex === -1) {\n return value;\n }\n\n const expr = balanced('(', ')', value.substr(varIndex));\n if (!expr) {\n return value;\n }\n\n const match = expr.body.match(cssVariableExpression);\n return match ? match[1] : value;\n}\n\n// The instanceof Node/HTMLElement/SVGElement checks can fail if the target element\n// belongs to a different window than the respective type.\n\nexport function isNode(target: unknown): target is Node {\n return (\n target instanceof Node ||\n (target !== null &&\n typeof target === 'object' &&\n 'nodeType' in target &&\n typeof target.nodeType === 'number' &&\n 'nodeName' in target &&\n typeof target.nodeName === 'string' &&\n 'parentNode' in target &&\n typeof target.parentNode === 'object')\n );\n}\n\nexport function isHTMLElement(target: unknown): target is HTMLElement {\n return (\n target instanceof HTMLElement ||\n (isNode(target) &&\n target.nodeType === Node.ELEMENT_NODE &&\n 'style' in target &&\n typeof target.style === 'object' &&\n typeof target.ownerDocument === 'object' &&\n !isSVGElement(target))\n );\n}\n\nexport function isSVGElement(target: unknown): target is SVGElement {\n return (\n target instanceof SVGElement ||\n (isNode(target) &&\n target.nodeType === Node.ELEMENT_NODE &&\n 'ownerSVGElement' in target &&\n typeof target.ownerSVGElement === 'object')\n );\n}\n"]}
1
+ {"version":3,"file":"dom.js","sourceRoot":"","sources":["../../../../src/internal/utils/dom.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAEvE,MAAM,UAAU,iBAAiB,CAAC,OAAoB;;IACpD,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAChD,OAAO,CACL,CAAC,CAAC,CAAC,aAAa,CAAC,SAAS,IAAI,aAAa,CAAC,SAAS,KAAK,MAAM,CAAC;QACjE,CAAC,CAAC,CAAC,aAAa,CAAC,WAAW,IAAI,aAAa,CAAC,WAAW,KAAK,MAAM,CAAC;QACrE,CAAC,CAAC,CAAC,aAAa,CAAC,aAAa,IAAI,aAAa,CAAC,aAAa,KAAK,QAAQ,CAAC;SAC3E,MAAA,aAAa,CAAC,OAAO,0CAAE,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,SAA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AK,QAAQ;YAChC,OAAO,MAAM,CAAC,aAAa,KAAK,QAAQ;YACxC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CACzB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAe;IAC1C,OAAO,CACL,MAAM,YAAY,UAAU;QAC5B,CAAC,MAAM,CAAC,MAAM,CAAC;YACb,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;YACrC,iBAAiB,IAAI,MAAM;YAC3B,OAAO,MAAM,CAAC,eAAe,KAAK,QAAQ,CAAC,CAC9C,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport balanced from 'balanced-match';\n\nimport { findUpUntil } from '@cloudscape-design/component-toolkit/dom';\n\nexport function isContainingBlock(element: HTMLElement): boolean {\n const computedStyle = getComputedStyle(element);\n return (\n (!!computedStyle.transform && computedStyle.transform !== 'none') ||\n (!!computedStyle.perspective && computedStyle.perspective !== 'none') ||\n (!!computedStyle.containerType && computedStyle.containerType !== 'normal') ||\n computedStyle.contain?.split(' ').some(s => ['layout', 'paint', 'strict', 'content'].includes(s))\n );\n}\n\n/**\n * Returns an element that is used to position the given element.\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block\n */\nexport function getContainingBlock(startElement: HTMLElement): HTMLElement | null {\n if (!startElement.parentElement) {\n return null;\n }\n\n return findUpUntil(startElement.parentElement, isContainingBlock) as HTMLElement;\n}\n\n/*\n * Allows to find multiple elements in the page each according to a specific test function,\n * but traversing the DOM only once.\n */\n\nexport function findUpUntilMultiple({\n startElement,\n tests,\n}: {\n startElement: HTMLElement;\n tests: Record<string, (el: HTMLElement) => boolean>;\n}) {\n const keys = Object.keys(tests);\n const elements: Record<string, HTMLElement> = {};\n let current: HTMLElement | null = startElement;\n while (current && Object.keys(elements).length < keys.length) {\n current = current.parentElement;\n // If a component is used within an svg (i.e. as foreignObject), then it will\n // have some ancestor nodes that are SVGElement. We want to skip those,\n // as they have very different properties to HTMLElements.\n while (current && !isHTMLElement(current)) {\n current = (current as Element).parentElement;\n }\n for (const key of keys) {\n if (!elements[key] && current && tests[key](current)) {\n elements[key] = current;\n }\n }\n }\n return elements;\n}\n\nconst cssVariableExpression = /--.+?\\s*,\\s*(.+)/;\n\n/**\n * Parses a CSS color value that might contain CSS Custom Properties\n * and returns a value that will be understood by the browser, no matter of support level.\n * If the browser support CSS Custom Properties, the value will be return as is. Otherwise,\n * the fallback value will be extracted and returned instead.\n */\nexport function parseCssVariable(value: string) {\n if (typeof window === 'undefined') {\n return value;\n }\n\n if (window.CSS?.supports?.('color', 'var(--dummy, #000)') ?? false) {\n return value;\n }\n\n const varIndex = value.lastIndexOf('var(');\n if (varIndex === -1) {\n return value;\n }\n\n const expr = balanced('(', ')', value.substr(varIndex));\n if (!expr) {\n return value;\n }\n\n const match = expr.body.match(cssVariableExpression);\n return match ? match[1] : value;\n}\n\n// The instanceof Node/HTMLElement/SVGElement checks can fail if the target element\n// belongs to a different window than the respective type.\n\nexport function isNode(target: unknown): target is Node {\n return (\n target instanceof Node ||\n (target !== null &&\n typeof target === 'object' &&\n 'nodeType' in target &&\n typeof target.nodeType === 'number' &&\n 'nodeName' in target &&\n typeof target.nodeName === 'string' &&\n 'parentNode' in target &&\n typeof target.parentNode === 'object')\n );\n}\n\nexport function isHTMLElement(target: unknown): target is HTMLElement {\n return (\n target instanceof HTMLElement ||\n (isNode(target) &&\n target.nodeType === Node.ELEMENT_NODE &&\n 'style' in target &&\n typeof target.style === 'object' &&\n typeof target.ownerDocument === 'object' &&\n !isSVGElement(target))\n );\n}\n\nexport function isSVGElement(target: unknown): target is SVGElement {\n return (\n target instanceof SVGElement ||\n (isNode(target) &&\n target.nodeType === Node.ELEMENT_NODE &&\n 'ownerSVGElement' in target &&\n typeof target.ownerSVGElement === 'object')\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use-popover-position.d.ts","sourceRoot":"","sources":["../../../src/popover/use-popover-position.ts"],"names":[],"mappings":"AAGA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAW7D,OAAO,EAAe,gBAAgB,EAAE,MAAM,EAAE,YAAY,EAAQ,MAAM,cAAc,CAAC;AAGzF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,UAAU,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,GACjB,EAAE;IACD,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACnD,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAChD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACjD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC,CAAC;IAC3D,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACnD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,iBAAiB,EAAE,YAAY,CAAC,QAAQ,CAAC;IACzC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;;;;qDAOyC,IAAI;;EA0J7C"}
1
+ {"version":3,"file":"use-popover-position.d.ts","sourceRoot":"","sources":["../../../src/popover/use-popover-position.ts"],"names":[],"mappings":"AAGA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAW7D,OAAO,EAAe,gBAAgB,EAAE,MAAM,EAAE,YAAY,EAAQ,MAAM,cAAc,CAAC;AAGzF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,UAAU,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,GACjB,EAAE;IACD,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACnD,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAChD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACjD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC,CAAC;IAC3D,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACnD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,iBAAiB,EAAE,YAAY,CAAC,QAAQ,CAAC;IACzC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;;;;qDAOyC,IAAI;;EAqK7C"}
@@ -3,7 +3,7 @@
3
3
  import { useCallback, useRef, useState } from 'react';
4
4
  import { nodeContains } from '@cloudscape-design/component-toolkit/dom';
5
5
  import { getLogicalBoundingClientRect } from '@cloudscape-design/component-toolkit/internal';
6
- import { getContainingBlock } from '../internal/utils/dom';
6
+ import { findUpUntilMultiple, isContainingBlock } from '../internal/utils/dom';
7
7
  import { calculateScroll, getFirstScrollableParent, scrollRectangleIntoView, } from '../internal/utils/scrollable-containers';
8
8
  import { calculatePosition, getDimensions, getOffsetDimensions, isCenterOutside } from './utils/positions';
9
9
  export default function usePopoverPosition({ popoverRef, bodyRef, arrowRef, trackRef, contentRef, allowScrollToFit, allowVerticalOverflow, preferredPosition, renderWithPortal, keepPosition, hideOnOverscroll, }) {
@@ -47,8 +47,17 @@ export default function usePopoverPosition({ popoverRef, bodyRef, arrowRef, trac
47
47
  const viewportRect = getViewportRect(document.defaultView);
48
48
  const trackRect = getLogicalBoundingClientRect(track);
49
49
  const arrowRect = getDimensions(arrow);
50
- const containingBlock = getContainingBlock(popover);
50
+ const { containingBlock, boundary } = findUpUntilMultiple({
51
+ startElement: popover,
52
+ tests: {
53
+ containingBlock: isContainingBlock,
54
+ boundary: (element) => isContainingBlock(element) || isBoundary(element),
55
+ },
56
+ });
57
+ // Rectangle for the containing block, which provides the reference frame for the popover coordinates.
51
58
  const containingBlockRect = containingBlock ? getLogicalBoundingClientRect(containingBlock) : viewportRect;
59
+ // Rectangle outside of which the popover should not be positioned, because it would be clipped.
60
+ const boundaryRect = boundary ? getLogicalBoundingClientRect(boundary) : getDocumentRect(document);
52
61
  const bodyBorderWidth = getBorderWidth(body);
53
62
  const contentRect = getLogicalBoundingClientRect(contentRef.current);
54
63
  const contentBoundingBox = {
@@ -67,12 +76,12 @@ export default function usePopoverPosition({ popoverRef, bodyRef, arrowRef, trac
67
76
  trigger: trackRect,
68
77
  arrow: arrowRect,
69
78
  body: contentBoundingBox,
70
- container: containingBlock ? containingBlockRect : getDocumentRect(document),
79
+ container: boundaryRect,
71
80
  viewport: viewportRect,
72
81
  renderWithPortal,
73
82
  allowVerticalOverflow,
74
83
  });
75
- // Get the position of the popover relative to the offset parent.
84
+ // Get the position of the popover relative to the containing block.
76
85
  const popoverOffset = toRelativePosition(rect, containingBlockRect);
77
86
  // Cache the distance between the trigger and the popover (which stays the same as you scroll),
78
87
  // and use that to recalculate the new popover position.
@@ -168,4 +177,8 @@ function getDocumentRect(document) {
168
177
  blockSize: document.documentElement.scrollHeight,
169
178
  };
170
179
  }
180
+ function isBoundary(element) {
181
+ const computedStyle = getComputedStyle(element);
182
+ return !!computedStyle.clipPath && computedStyle.clipPath !== 'none';
183
+ }
171
184
  //# sourceMappingURL=use-popover-position.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-popover-position.js","sourceRoot":"","sources":["../../../src/popover/use-popover-position.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAc,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAE7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE3G,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,UAAU,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,GAajB;IACC,MAAM,2BAA2B,GAAG,MAAM,CAA0B,IAAI,CAAC,CAAC;IAC1E,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAkB,EAAE,CAAC,CAAC;IACtE,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAA0B,IAAI,CAAC,CAAC;IACxF,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9D,oGAAoG;IACpG,MAAM,kBAAkB,GAAG,MAAM,CAAa,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAExD,MAAM,0BAA0B,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;IAE7D,MAAM,qBA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kBAAkB,CAAC,OAAe,EAAE,MAAc;IACzD,OAAO;QACL,eAAe,EAAE,OAAO,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe;QACjE,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB;KACrE,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,MAAc;;IACrC,OAAO;QACL,eAAe,EAAE,CAAC;QAClB,gBAAgB,EAAE,CAAC;QACnB,UAAU,EAAE,MAAA,MAAA,MAAM,CAAC,cAAc,0CAAE,KAAK,mCAAI,MAAM,CAAC,UAAU;QAC7D,SAAS,EAAE,MAAA,MAAA,MAAM,CAAC,cAAc,0CAAE,MAAM,mCAAI,MAAM,CAAC,WAAW;KAC/D,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,QAAkB;IACzC,MAAM,EAAE,eAAe,EAAE,gBAAgB,EAAE,GAAG,4BAA4B,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAErG,OAAO;QACL,eAAe;QACf,gBAAgB;QAChB,UAAU,EAAE,QAAQ,CAAC,eAAe,CAAC,WAAW;QAChD,SAAS,EAAE,QAAQ,CAAC,eAAe,CAAC,YAAY;KACjD,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useCallback, useRef, useState } from 'react';\n\nimport { nodeContains } from '@cloudscape-design/component-toolkit/dom';\nimport { getLogicalBoundingClientRect } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getContainingBlock } from '../internal/utils/dom';\nimport {\n calculateScroll,\n getFirstScrollableParent,\n scrollRectangleIntoView,\n} from '../internal/utils/scrollable-containers';\nimport { BoundingBox, InternalPosition, Offset, PopoverProps, Rect } from './interfaces';\nimport { calculatePosition, getDimensions, getOffsetDimensions, isCenterOutside } from './utils/positions';\n\nexport default function usePopoverPosition({\n popoverRef,\n bodyRef,\n arrowRef,\n trackRef,\n contentRef,\n allowScrollToFit,\n allowVerticalOverflow,\n preferredPosition,\n renderWithPortal,\n keepPosition,\n hideOnOverscroll,\n}: {\n popoverRef: React.RefObject<HTMLDivElement | null>;\n bodyRef: React.RefObject<HTMLDivElement | null>;\n arrowRef: React.RefObject<HTMLDivElement | null>;\n trackRef: React.RefObject<HTMLElement | SVGElement | null>;\n contentRef: React.RefObject<HTMLDivElement | null>;\n allowScrollToFit?: boolean;\n allowVerticalOverflow?: boolean;\n preferredPosition: PopoverProps.Position;\n renderWithPortal?: boolean;\n keepPosition?: boolean;\n hideOnOverscroll?: boolean;\n}) {\n const previousInternalPositionRef = useRef<InternalPosition | null>(null);\n const [popoverStyle, setPopoverStyle] = useState<Partial<Offset>>({});\n const [internalPosition, setInternalPosition] = useState<InternalPosition | null>(null);\n const [isOverscrolling, setIsOverscrolling] = useState(false);\n\n // Store the handler in a ref so that it can still be replaced from outside of the listener closure.\n const positionHandlerRef = useRef<() => void>(() => {});\n\n const scrollableContainerRectRef = useRef<Rect | null>(null);\n\n const updatePositionHandler = useCallback(\n (onContentResize = false) => {\n if (!trackRef.current || !popoverRef.current || !bodyRef.current || !contentRef.current || !arrowRef.current) {\n return;\n }\n\n // Get important elements\n const popover = popoverRef.current;\n const body = bodyRef.current;\n const arrow = arrowRef.current;\n const document = popover.ownerDocument;\n const track = trackRef.current;\n\n // If the popover body isn't being rendered for whatever reason (e.g. \"display: none\" or JSDOM),\n // or track does not belong to the document - bail on calculating dimensions.\n const { offsetWidth, offsetHeight } = getOffsetDimensions(popover);\n if (offsetWidth === 0 || offsetHeight === 0 || !nodeContains(document.body, track)) {\n return;\n }\n\n // Imperatively move body off-screen to give it room to expand.\n // Not doing this in React because this recalculation should happen\n // in the span of a single frame without rerendering anything.\n const prevInsetBlockStart = popover.style.insetBlockStart;\n const prevInsetInlineStart = popover.style.insetInlineStart;\n\n popover.style.insetBlockStart = '0';\n popover.style.insetInlineStart = '0';\n // Imperatively remove body styles that can remain from the previous computation.\n body.style.maxBlockSize = '';\n body.style.overflowX = '';\n body.style.overflowY = '';\n\n // Get rects representing key elements\n // Use getComputedStyle for arrowRect to avoid modifications made by transform\n const viewportRect = getViewportRect(document.defaultView!);\n const trackRect = getLogicalBoundingClientRect(track);\n const arrowRect = getDimensions(arrow);\n const containingBlock = getContainingBlock(popover);\n const containingBlockRect = containingBlock ? getLogicalBoundingClientRect(containingBlock) : viewportRect;\n\n const bodyBorderWidth = getBorderWidth(body);\n const contentRect = getLogicalBoundingClientRect(contentRef.current);\n const contentBoundingBox = {\n inlineSize: contentRect.inlineSize + 2 * bodyBorderWidth,\n blockSize: contentRect.blockSize + 2 * bodyBorderWidth,\n };\n\n // When keepPosition is true and the recalculation was triggered by a resize of the popover content,\n // we maintain the previously defined internal position,\n // but we still call calculatePosition to know if the popover should be scrollable.\n const shouldKeepPosition = keepPosition && onContentResize && !!previousInternalPositionRef.current;\n const fixedInternalPosition = (shouldKeepPosition && previousInternalPositionRef.current) ?? undefined;\n\n // Calculate the arrow direction and viewport-relative position of the popover.\n const {\n scrollable,\n internalPosition: newInternalPosition,\n rect,\n } = calculatePosition({\n preferredPosition,\n fixedInternalPosition,\n trigger: trackRect,\n arrow: arrowRect,\n body: contentBoundingBox,\n container: containingBlock ? containingBlockRect : getDocumentRect(document),\n viewport: viewportRect,\n renderWithPortal,\n allowVerticalOverflow,\n });\n\n // Get the position of the popover relative to the offset parent.\n const popoverOffset = toRelativePosition(rect, containingBlockRect);\n\n // Cache the distance between the trigger and the popover (which stays the same as you scroll),\n // and use that to recalculate the new popover position.\n const trackRelativeOffset = toRelativePosition(popoverOffset, toRelativePosition(trackRect, containingBlockRect));\n\n // Bring back the container to its original position to prevent any flashing.\n popover.style.insetBlockStart = prevInsetBlockStart;\n popover.style.insetInlineStart = prevInsetInlineStart;\n\n // Allow popover body to scroll if can't fit the popover into the container/viewport otherwise.\n if (scrollable) {\n body.style.maxBlockSize = rect.blockSize + 'px';\n body.style.overflowX = 'hidden';\n body.style.overflowY = 'auto';\n }\n\n // Remember the internal position in case we want to keep it later.\n previousInternalPositionRef.current = newInternalPosition;\n setInternalPosition(newInternalPosition);\n\n const shouldScroll = allowScrollToFit && !shouldKeepPosition;\n\n // Position the popover\n const insetBlockStart = shouldScroll\n ? popoverOffset.insetBlockStart + calculateScroll(rect)\n : popoverOffset.insetBlockStart;\n setPopoverStyle({ insetBlockStart, insetInlineStart: popoverOffset.insetInlineStart });\n\n // Scroll if necessary\n if (shouldScroll) {\n const scrollableParent = getFirstScrollableParent(popover);\n scrollRectangleIntoView(rect, scrollableParent);\n }\n\n if (hideOnOverscroll && trackRef.current instanceof HTMLElement) {\n const scrollableContainer = getFirstScrollableParent(trackRef.current);\n if (scrollableContainer) {\n scrollableContainerRectRef.current = getLogicalBoundingClientRect(scrollableContainer);\n }\n }\n\n positionHandlerRef.current = () => {\n const trackRect = getLogicalBoundingClientRect(track);\n\n const newTrackOffset = toRelativePosition(\n trackRect,\n containingBlock ? getLogicalBoundingClientRect(containingBlock) : viewportRect\n );\n\n setPopoverStyle({\n insetBlockStart: newTrackOffset.insetBlockStart + trackRelativeOffset.insetBlockStart,\n insetInlineStart: newTrackOffset.insetInlineStart + trackRelativeOffset.insetInlineStart,\n });\n\n if (hideOnOverscroll && scrollableContainerRectRef.current) {\n // Assuming the arrow tip is at the vertical center of the popover trigger.\n // This is good enough for disabled reason tooltip in select and multiselect.\n // Can be further refined to take the exact arrow position into account if hideOnOverscroll is to be used in other cases.\n setIsOverscrolling(isCenterOutside(trackRect, scrollableContainerRectRef.current));\n }\n };\n },\n [\n trackRef,\n popoverRef,\n bodyRef,\n contentRef,\n arrowRef,\n keepPosition,\n preferredPosition,\n renderWithPortal,\n allowVerticalOverflow,\n allowScrollToFit,\n hideOnOverscroll,\n ]\n );\n return { updatePositionHandler, popoverStyle, internalPosition, positionHandlerRef, isOverscrolling };\n}\n\nfunction getBorderWidth(element: HTMLElement) {\n return parseInt(getComputedStyle(element).borderWidth) || 0;\n}\n\n/**\n * Convert a viewport-relative offset to an element-relative offset.\n */\nfunction toRelativePosition(element: Offset, parent: Offset): Offset {\n return {\n insetBlockStart: element.insetBlockStart - parent.insetBlockStart,\n insetInlineStart: element.insetInlineStart - parent.insetInlineStart,\n };\n}\n\n/**\n * Get a BoundingBox that represents the visible viewport.\n */\nfunction getViewportRect(window: Window): BoundingBox {\n return {\n insetBlockStart: 0,\n insetInlineStart: 0,\n inlineSize: window.visualViewport?.width ?? window.innerWidth,\n blockSize: window.visualViewport?.height ?? window.innerHeight,\n };\n}\n\nfunction getDocumentRect(document: Document): BoundingBox {\n const { insetBlockStart, insetInlineStart } = getLogicalBoundingClientRect(document.documentElement);\n\n return {\n insetBlockStart,\n insetInlineStart,\n inlineSize: document.documentElement.scrollWidth,\n blockSize: document.documentElement.scrollHeight,\n };\n}\n"]}
1
+ {"version":3,"file":"use-popover-position.js","sourceRoot":"","sources":["../../../src/popover/use-popover-position.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAc,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAE7F,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE3G,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,UAAU,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,gBAAg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AAC,WAAW;KAC/D,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,QAAkB;IACzC,MAAM,EAAE,eAAe,EAAE,gBAAgB,EAAE,GAAG,4BAA4B,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAErG,OAAO;QACL,eAAe;QACf,gBAAgB;QAChB,UAAU,EAAE,QAAQ,CAAC,eAAe,CAAC,WAAW;QAChD,SAAS,EAAE,QAAQ,CAAC,eAAe,CAAC,YAAY;KACjD,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,OAAoB;IACtC,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAChD,OAAO,CAAC,CAAC,aAAa,CAAC,QAAQ,IAAI,aAAa,CAAC,QAAQ,KAAK,MAAM,CAAC;AACvE,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useCallback, useRef, useState } from 'react';\n\nimport { nodeContains } from '@cloudscape-design/component-toolkit/dom';\nimport { getLogicalBoundingClientRect } from '@cloudscape-design/component-toolkit/internal';\n\nimport { findUpUntilMultiple, isContainingBlock } from '../internal/utils/dom';\nimport {\n calculateScroll,\n getFirstScrollableParent,\n scrollRectangleIntoView,\n} from '../internal/utils/scrollable-containers';\nimport { BoundingBox, InternalPosition, Offset, PopoverProps, Rect } from './interfaces';\nimport { calculatePosition, getDimensions, getOffsetDimensions, isCenterOutside } from './utils/positions';\n\nexport default function usePopoverPosition({\n popoverRef,\n bodyRef,\n arrowRef,\n trackRef,\n contentRef,\n allowScrollToFit,\n allowVerticalOverflow,\n preferredPosition,\n renderWithPortal,\n keepPosition,\n hideOnOverscroll,\n}: {\n popoverRef: React.RefObject<HTMLDivElement | null>;\n bodyRef: React.RefObject<HTMLDivElement | null>;\n arrowRef: React.RefObject<HTMLDivElement | null>;\n trackRef: React.RefObject<HTMLElement | SVGElement | null>;\n contentRef: React.RefObject<HTMLDivElement | null>;\n allowScrollToFit?: boolean;\n allowVerticalOverflow?: boolean;\n preferredPosition: PopoverProps.Position;\n renderWithPortal?: boolean;\n keepPosition?: boolean;\n hideOnOverscroll?: boolean;\n}) {\n const previousInternalPositionRef = useRef<InternalPosition | null>(null);\n const [popoverStyle, setPopoverStyle] = useState<Partial<Offset>>({});\n const [internalPosition, setInternalPosition] = useState<InternalPosition | null>(null);\n const [isOverscrolling, setIsOverscrolling] = useState(false);\n\n // Store the handler in a ref so that it can still be replaced from outside of the listener closure.\n const positionHandlerRef = useRef<() => void>(() => {});\n\n const scrollableContainerRectRef = useRef<Rect | null>(null);\n\n const updatePositionHandler = useCallback(\n (onContentResize = false) => {\n if (!trackRef.current || !popoverRef.current || !bodyRef.current || !contentRef.current || !arrowRef.current) {\n return;\n }\n\n // Get important elements\n const popover = popoverRef.current;\n const body = bodyRef.current;\n const arrow = arrowRef.current;\n const document = popover.ownerDocument;\n const track = trackRef.current;\n\n // If the popover body isn't being rendered for whatever reason (e.g. \"display: none\" or JSDOM),\n // or track does not belong to the document - bail on calculating dimensions.\n const { offsetWidth, offsetHeight } = getOffsetDimensions(popover);\n if (offsetWidth === 0 || offsetHeight === 0 || !nodeContains(document.body, track)) {\n return;\n }\n\n // Imperatively move body off-screen to give it room to expand.\n // Not doing this in React because this recalculation should happen\n // in the span of a single frame without rerendering anything.\n const prevInsetBlockStart = popover.style.insetBlockStart;\n const prevInsetInlineStart = popover.style.insetInlineStart;\n\n popover.style.insetBlockStart = '0';\n popover.style.insetInlineStart = '0';\n // Imperatively remove body styles that can remain from the previous computation.\n body.style.maxBlockSize = '';\n body.style.overflowX = '';\n body.style.overflowY = '';\n\n // Get rects representing key elements\n // Use getComputedStyle for arrowRect to avoid modifications made by transform\n const viewportRect = getViewportRect(document.defaultView!);\n const trackRect = getLogicalBoundingClientRect(track);\n const arrowRect = getDimensions(arrow);\n const { containingBlock, boundary } = findUpUntilMultiple({\n startElement: popover,\n tests: {\n containingBlock: isContainingBlock,\n boundary: (element: HTMLElement) => isContainingBlock(element) || isBoundary(element),\n },\n });\n\n // Rectangle for the containing block, which provides the reference frame for the popover coordinates.\n const containingBlockRect = containingBlock ? getLogicalBoundingClientRect(containingBlock) : viewportRect;\n\n // Rectangle outside of which the popover should not be positioned, because it would be clipped.\n const boundaryRect = boundary ? getLogicalBoundingClientRect(boundary) : getDocumentRect(document);\n\n const bodyBorderWidth = getBorderWidth(body);\n const contentRect = getLogicalBoundingClientRect(contentRef.current);\n const contentBoundingBox = {\n inlineSize: contentRect.inlineSize + 2 * bodyBorderWidth,\n blockSize: contentRect.blockSize + 2 * bodyBorderWidth,\n };\n\n // When keepPosition is true and the recalculation was triggered by a resize of the popover content,\n // we maintain the previously defined internal position,\n // but we still call calculatePosition to know if the popover should be scrollable.\n const shouldKeepPosition = keepPosition && onContentResize && !!previousInternalPositionRef.current;\n const fixedInternalPosition = (shouldKeepPosition && previousInternalPositionRef.current) ?? undefined;\n\n // Calculate the arrow direction and viewport-relative position of the popover.\n const {\n scrollable,\n internalPosition: newInternalPosition,\n rect,\n } = calculatePosition({\n preferredPosition,\n fixedInternalPosition,\n trigger: trackRect,\n arrow: arrowRect,\n body: contentBoundingBox,\n container: boundaryRect,\n viewport: viewportRect,\n renderWithPortal,\n allowVerticalOverflow,\n });\n\n // Get the position of the popover relative to the containing block.\n const popoverOffset = toRelativePosition(rect, containingBlockRect);\n\n // Cache the distance between the trigger and the popover (which stays the same as you scroll),\n // and use that to recalculate the new popover position.\n const trackRelativeOffset = toRelativePosition(popoverOffset, toRelativePosition(trackRect, containingBlockRect));\n\n // Bring back the container to its original position to prevent any flashing.\n popover.style.insetBlockStart = prevInsetBlockStart;\n popover.style.insetInlineStart = prevInsetInlineStart;\n\n // Allow popover body to scroll if can't fit the popover into the container/viewport otherwise.\n if (scrollable) {\n body.style.maxBlockSize = rect.blockSize + 'px';\n body.style.overflowX = 'hidden';\n body.style.overflowY = 'auto';\n }\n\n // Remember the internal position in case we want to keep it later.\n previousInternalPositionRef.current = newInternalPosition;\n setInternalPosition(newInternalPosition);\n\n const shouldScroll = allowScrollToFit && !shouldKeepPosition;\n\n // Position the popover\n const insetBlockStart = shouldScroll\n ? popoverOffset.insetBlockStart + calculateScroll(rect)\n : popoverOffset.insetBlockStart;\n setPopoverStyle({ insetBlockStart, insetInlineStart: popoverOffset.insetInlineStart });\n\n // Scroll if necessary\n if (shouldScroll) {\n const scrollableParent = getFirstScrollableParent(popover);\n scrollRectangleIntoView(rect, scrollableParent);\n }\n\n if (hideOnOverscroll && trackRef.current instanceof HTMLElement) {\n const scrollableContainer = getFirstScrollableParent(trackRef.current);\n if (scrollableContainer) {\n scrollableContainerRectRef.current = getLogicalBoundingClientRect(scrollableContainer);\n }\n }\n\n positionHandlerRef.current = () => {\n const trackRect = getLogicalBoundingClientRect(track);\n\n const newTrackOffset = toRelativePosition(\n trackRect,\n containingBlock ? getLogicalBoundingClientRect(containingBlock) : viewportRect\n );\n\n setPopoverStyle({\n insetBlockStart: newTrackOffset.insetBlockStart + trackRelativeOffset.insetBlockStart,\n insetInlineStart: newTrackOffset.insetInlineStart + trackRelativeOffset.insetInlineStart,\n });\n\n if (hideOnOverscroll && scrollableContainerRectRef.current) {\n // Assuming the arrow tip is at the vertical center of the popover trigger.\n // This is good enough for disabled reason tooltip in select and multiselect.\n // Can be further refined to take the exact arrow position into account if hideOnOverscroll is to be used in other cases.\n setIsOverscrolling(isCenterOutside(trackRect, scrollableContainerRectRef.current));\n }\n };\n },\n [\n trackRef,\n popoverRef,\n bodyRef,\n contentRef,\n arrowRef,\n keepPosition,\n preferredPosition,\n renderWithPortal,\n allowVerticalOverflow,\n allowScrollToFit,\n hideOnOverscroll,\n ]\n );\n return { updatePositionHandler, popoverStyle, internalPosition, positionHandlerRef, isOverscrolling };\n}\n\nfunction getBorderWidth(element: HTMLElement) {\n return parseInt(getComputedStyle(element).borderWidth) || 0;\n}\n\n/**\n * Convert a viewport-relative offset to an element-relative offset.\n */\nfunction toRelativePosition(element: Offset, parent: Offset): Offset {\n return {\n insetBlockStart: element.insetBlockStart - parent.insetBlockStart,\n insetInlineStart: element.insetInlineStart - parent.insetInlineStart,\n };\n}\n\n/**\n * Get a BoundingBox that represents the visible viewport.\n */\nfunction getViewportRect(window: Window): BoundingBox {\n return {\n insetBlockStart: 0,\n insetInlineStart: 0,\n inlineSize: window.visualViewport?.width ?? window.innerWidth,\n blockSize: window.visualViewport?.height ?? window.innerHeight,\n };\n}\n\nfunction getDocumentRect(document: Document): BoundingBox {\n const { insetBlockStart, insetInlineStart } = getLogicalBoundingClientRect(document.documentElement);\n\n return {\n insetBlockStart,\n insetInlineStart,\n inlineSize: document.documentElement.scrollWidth,\n blockSize: document.documentElement.scrollHeight,\n };\n}\n\nfunction isBoundary(element: HTMLElement) {\n const computedStyle = getComputedStyle(element);\n return !!computedStyle.clipPath && computedStyle.clipPath !== 'none';\n}\n"]}
@@ -61,7 +61,7 @@ export interface WizardProps extends BaseComponentProps {
61
61
  * - `cancelButton` (string) - The text of the button that enables the user to exit the flow.
62
62
  * - `previousButton` (string) - The text of the button that enables the user to return to the previous step.
63
63
  * - `nextButton` (string) - The text of the button that enables the user to move to the next step.
64
- * - `submitButton` (string) - The text of the button that enables the user to submit the form. **Deprecated**, replaced by the `submitButtonText` component property.
64
+ * - `submitButton` (string) - The text of the button that enables the user to submit the form. **Deprecated**, replaced by the `submitButtonText` component property. `submitButton` is not supported by the I18nProvider.
65
65
  * - `optional` (string) - The text displayed next to the step title and form header title when a step is declared optional.
66
66
  * - `nextButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *next* button is in a loading state.
67
67
  * - `submitButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *submit* button is in a loading state.
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/wizard/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { FlowType } from '../internal/analytics/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport namespace WizardProps {\n export interface AnalyticsMetadata {\n instanceIdentifier?: string;\n flowType?: FlowType;\n resourceType?: string;\n }\n}\n\nexport interface WizardProps extends BaseComponentProps {\n /**\n * Specifies additional analytics-related metadata.\n * * `instanceIdentifier` - A unique string that identifies this component instance in your application.\n * * `flowType` - Identifies the type of flow represented by the component.\n * * `resourceType` - Identifies the type of resource represented by the flow. **Note:** This API is currently experimental.\n * @analytics\n */\n analyticsMetadata?: WizardProps.AnalyticsMetadata;\n\n /**\n * Array of step objects. Each object represents a step in the wizard with the following properties:\n *\n * - `title` (string) - Text that's displayed as the title in the navigation pane and form header.\n * - `info` (ReactNode) - (Optional) Area for a page level info link that's displayed in the form header.\n * The page level info link should trigger the default help panel content for the step. Use the [link component](/components/link/) to display the link.\n * - `description` (ReactNode) - (Optional) Area below the form header for a page level description text to further explain the purpose, goal, or main actions of the step.\n * - `content` (ReactNode) - Main content area to display form sections, form fields, and controls.\n * - `errorText` (ReactNode) - (Optional) Error text that's displayed in a page level error alert.\n * Use this for rendering actionable server-side validation failure messages.\n * - `isOptional` (boolean) - Specifies whether the step is optional or required. If set to `true`, the text from `i18nStrings.optional`\n * is rendered next to the `title` in the navigation step label and the form header title.\n * - `analyticsMetadata` (WizardProps.StepAnalyticsMetadata) - (Optional) Specifies additional analytics-related metadata.\n * @analytics\n */\n steps: ReadonlyArray<WizardProps.Step>;\n\n /**\n * Index of the step that's currently displayed. The first step has an index of zero (0).\n *\n * If you don't set this property, the component starts on the first step and switches step automatically\n * when a user navigates using the buttons or an enabled step link in the navigation pane (that is, uncontrolled behavior).\n *\n * If you provide a value for this property, you must also set an `onNavigate` listener to update the property when\n * a user navigates (that is, controlled behavior).\n *\n * If you set it to a value that exceeds the maximum value (that is, the number of steps minus 1), its value is ignored and the component uses the maximum value.\n */\n activeStepIndex?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n *\n * - `stepNumberLabel` ((stepNumber: number) => string) - A function that accepts a number (1-based indexing),\n * and returns a human-readable, localized string displaying the step number in the navigation pane. For example, \"Step 1\" or \"Step 2\".\n * - `collapsedStepsLabel` ((stepNumber: number, stepsCount: number) => string) - A function that accepts two number parameters (1-based indexing),\n * and returns a string responsible for the navigation summary on smaller screens. For example, \"Step 1 of 3\". The parameters are as follows:\n * - `stepNumber` (number) - The step number that the user is currently on.\n * - `stepsCount` (number) - The total number of steps in the wizard.\n * - `skipToButtonLabel`: ((targetStep: WizardProps.Step, targetStepNumber: number) => string) - An optional function that accepts the target step object\n * and the target step number (1-based indexing), and returns a string to be used as the *skip-to* button label. For example, \"Skip to Step 2\" or \"Skip to end\".\n * - `navigationAriaLabel` (string) - The aria label for the navigation pane.\n * - `cancelButton` (string) - The text of the button that enables the user to exit the flow.\n * - `previousButton` (string) - The text of the button that enables the user to return to the previous step.\n * - `nextButton` (string) - The text of the button that enables the user to move to the next step.\n * - `submitButton` (string) - The text of the button that enables the user to submit the form. **Deprecated**, replaced by the `submitButtonText` component property.\n * - `optional` (string) - The text displayed next to the step title and form header title when a step is declared optional.\n * - `nextButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *next* button is in a loading state.\n * - `submitButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *submit* button is in a loading state.\n * @i18n\n */\n i18nStrings?: WizardProps.I18nStrings;\n\n /**\n * The text of the button that enables the user to submit the form.\n */\n submitButtonText?: string;\n\n /**\n * Renders the *next* or *submit* button in a loading state.\n *\n * Use this if you need to wait for a response from the server before the user can proceed to the next step, such as during server-side validation or retrieving the next step's information.\n */\n isLoadingNextStep?: boolean;\n\n /**\n * When set to `false`, the *skip-to* button is never shown.\n * When set to `true`, the *skip-to* button may appear to offer faster navigation for the user.\n *\n * The *skip-to* button only allows to skip optional steps. It is shown when there is one or more optional\n * steps ahead having no required steps in-between.\n *\n * Note: the *skip-to* button requires the function i18nStrings.skipToButtonLabel to be defined.\n *\n * Defaults to `false`.\n */\n allowSkipTo?: boolean;\n\n /**\n * Specifies left-aligned secondary actions for the wizard. Use a button dropdown if multiple actions are required.\n */\n secondaryActions?: React.ReactNode;\n\n /**\n * Called when a user clicks the *cancel* button.\n * If a user has entered data in the form, you should prompt the user with a modal before exiting the wizard flow.\n */\n onCancel?: NonCancelableEventHandler;\n\n /**\n * Called when a user clicks the *submit* button.\n */\n onSubmit?: NonCancelableEventHandler;\n\n /**\n * Called when a user clicks the *next* button, the *previous* button, or an enabled step link in the navigation pane.\n *\n * The event `detail` includes the following:\n * - `requestedStepIndex` - The index of the requested step.\n * - `reason` - The user action that triggered the navigation event. It can be `next` (when the user clicks the *next* button),\n * `previous` (when the user clicks the *previous* button), `step` (an enabled step link in the navigation pane),\n * or `skip` (when navigated using navigation pane or the *skip-to* button to the previously unvisited step).\n */\n onNavigate?: NonCancelableEventHandler<WizardProps.NavigateDetail>;\n}\n\nexport namespace WizardProps {\n export interface StepAnalyticsMetadata {\n instanceIdentifier?: string;\n }\n export interface Step {\n title: string;\n info?: React.ReactNode;\n description?: React.ReactNode;\n content: React.ReactNode;\n errorText?: React.ReactNode;\n isOptional?: boolean;\n analyticsMetadata?: StepAnalyticsMetadata;\n }\n\n export interface I18nStrings {\n /**\n * @deprecated Use `submitButtonText` on the component instead.\n */\n submitButton?: string;\n\n stepNumberLabel?(stepNumber: number): string;\n collapsedStepsLabel?(stepNumber: number, stepsCount: number): string;\n skipToButtonLabel?(targetStep: WizardProps.Step, targetStepNumber: number): string;\n navigationAriaLabel?: string;\n errorIconAriaLabel?: string;\n cancelButton?: string;\n previousButton?: string;\n nextButton?: string;\n optional?: string;\n nextButtonLoadingAnnouncement?: string;\n submitButtonLoadingAnnouncement?: string;\n }\n\n export interface NavigateDetail {\n requestedStepIndex: number;\n reason: WizardProps.NavigationReason;\n }\n\n export type NavigationReason = 'next' | 'previous' | 'step' | 'skip';\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/wizard/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { FlowType } from '../internal/analytics/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport namespace WizardProps {\n export interface AnalyticsMetadata {\n instanceIdentifier?: string;\n flowType?: FlowType;\n resourceType?: string;\n }\n}\n\nexport interface WizardProps extends BaseComponentProps {\n /**\n * Specifies additional analytics-related metadata.\n * * `instanceIdentifier` - A unique string that identifies this component instance in your application.\n * * `flowType` - Identifies the type of flow represented by the component.\n * * `resourceType` - Identifies the type of resource represented by the flow. **Note:** This API is currently experimental.\n * @analytics\n */\n analyticsMetadata?: WizardProps.AnalyticsMetadata;\n\n /**\n * Array of step objects. Each object represents a step in the wizard with the following properties:\n *\n * - `title` (string) - Text that's displayed as the title in the navigation pane and form header.\n * - `info` (ReactNode) - (Optional) Area for a page level info link that's displayed in the form header.\n * The page level info link should trigger the default help panel content for the step. Use the [link component](/components/link/) to display the link.\n * - `description` (ReactNode) - (Optional) Area below the form header for a page level description text to further explain the purpose, goal, or main actions of the step.\n * - `content` (ReactNode) - Main content area to display form sections, form fields, and controls.\n * - `errorText` (ReactNode) - (Optional) Error text that's displayed in a page level error alert.\n * Use this for rendering actionable server-side validation failure messages.\n * - `isOptional` (boolean) - Specifies whether the step is optional or required. If set to `true`, the text from `i18nStrings.optional`\n * is rendered next to the `title` in the navigation step label and the form header title.\n * - `analyticsMetadata` (WizardProps.StepAnalyticsMetadata) - (Optional) Specifies additional analytics-related metadata.\n * @analytics\n */\n steps: ReadonlyArray<WizardProps.Step>;\n\n /**\n * Index of the step that's currently displayed. The first step has an index of zero (0).\n *\n * If you don't set this property, the component starts on the first step and switches step automatically\n * when a user navigates using the buttons or an enabled step link in the navigation pane (that is, uncontrolled behavior).\n *\n * If you provide a value for this property, you must also set an `onNavigate` listener to update the property when\n * a user navigates (that is, controlled behavior).\n *\n * If you set it to a value that exceeds the maximum value (that is, the number of steps minus 1), its value is ignored and the component uses the maximum value.\n */\n activeStepIndex?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n *\n * - `stepNumberLabel` ((stepNumber: number) => string) - A function that accepts a number (1-based indexing),\n * and returns a human-readable, localized string displaying the step number in the navigation pane. For example, \"Step 1\" or \"Step 2\".\n * - `collapsedStepsLabel` ((stepNumber: number, stepsCount: number) => string) - A function that accepts two number parameters (1-based indexing),\n * and returns a string responsible for the navigation summary on smaller screens. For example, \"Step 1 of 3\". The parameters are as follows:\n * - `stepNumber` (number) - The step number that the user is currently on.\n * - `stepsCount` (number) - The total number of steps in the wizard.\n * - `skipToButtonLabel`: ((targetStep: WizardProps.Step, targetStepNumber: number) => string) - An optional function that accepts the target step object\n * and the target step number (1-based indexing), and returns a string to be used as the *skip-to* button label. For example, \"Skip to Step 2\" or \"Skip to end\".\n * - `navigationAriaLabel` (string) - The aria label for the navigation pane.\n * - `cancelButton` (string) - The text of the button that enables the user to exit the flow.\n * - `previousButton` (string) - The text of the button that enables the user to return to the previous step.\n * - `nextButton` (string) - The text of the button that enables the user to move to the next step.\n * - `submitButton` (string) - The text of the button that enables the user to submit the form. **Deprecated**, replaced by the `submitButtonText` component property. `submitButton` is not supported by the I18nProvider.\n * - `optional` (string) - The text displayed next to the step title and form header title when a step is declared optional.\n * - `nextButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *next* button is in a loading state.\n * - `submitButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *submit* button is in a loading state.\n * @i18n\n */\n i18nStrings?: WizardProps.I18nStrings;\n\n /**\n * The text of the button that enables the user to submit the form.\n */\n submitButtonText?: string;\n\n /**\n * Renders the *next* or *submit* button in a loading state.\n *\n * Use this if you need to wait for a response from the server before the user can proceed to the next step, such as during server-side validation or retrieving the next step's information.\n */\n isLoadingNextStep?: boolean;\n\n /**\n * When set to `false`, the *skip-to* button is never shown.\n * When set to `true`, the *skip-to* button may appear to offer faster navigation for the user.\n *\n * The *skip-to* button only allows to skip optional steps. It is shown when there is one or more optional\n * steps ahead having no required steps in-between.\n *\n * Note: the *skip-to* button requires the function i18nStrings.skipToButtonLabel to be defined.\n *\n * Defaults to `false`.\n */\n allowSkipTo?: boolean;\n\n /**\n * Specifies left-aligned secondary actions for the wizard. Use a button dropdown if multiple actions are required.\n */\n secondaryActions?: React.ReactNode;\n\n /**\n * Called when a user clicks the *cancel* button.\n * If a user has entered data in the form, you should prompt the user with a modal before exiting the wizard flow.\n */\n onCancel?: NonCancelableEventHandler;\n\n /**\n * Called when a user clicks the *submit* button.\n */\n onSubmit?: NonCancelableEventHandler;\n\n /**\n * Called when a user clicks the *next* button, the *previous* button, or an enabled step link in the navigation pane.\n *\n * The event `detail` includes the following:\n * - `requestedStepIndex` - The index of the requested step.\n * - `reason` - The user action that triggered the navigation event. It can be `next` (when the user clicks the *next* button),\n * `previous` (when the user clicks the *previous* button), `step` (an enabled step link in the navigation pane),\n * or `skip` (when navigated using navigation pane or the *skip-to* button to the previously unvisited step).\n */\n onNavigate?: NonCancelableEventHandler<WizardProps.NavigateDetail>;\n}\n\nexport namespace WizardProps {\n export interface StepAnalyticsMetadata {\n instanceIdentifier?: string;\n }\n export interface Step {\n title: string;\n info?: React.ReactNode;\n description?: React.ReactNode;\n content: React.ReactNode;\n errorText?: React.ReactNode;\n isOptional?: boolean;\n analyticsMetadata?: StepAnalyticsMetadata;\n }\n\n export interface I18nStrings {\n /**\n * @deprecated Use `submitButtonText` on the component instead.\n */\n submitButton?: string;\n\n stepNumberLabel?(stepNumber: number): string;\n collapsedStepsLabel?(stepNumber: number, stepsCount: number): string;\n skipToButtonLabel?(targetStep: WizardProps.Step, targetStepNumber: number): string;\n navigationAriaLabel?: string;\n errorIconAriaLabel?: string;\n cancelButton?: string;\n previousButton?: string;\n nextButton?: string;\n optional?: string;\n nextButtonLoadingAnnouncement?: string;\n submitButtonLoadingAnnouncement?: string;\n }\n\n export interface NavigateDetail {\n requestedStepIndex: number;\n reason: WizardProps.NavigationReason;\n }\n\n export type NavigationReason = 'next' | 'previous' | 'step' | 'skip';\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudscape-design/components-themeable",
3
- "version": "3.0.858",
3
+ "version": "3.0.860",
4
4
  "files": [
5
5
  "lib"
6
6
  ],