@cloudscape-design/components 3.0.370 → 3.0.371
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.
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/internal/utils/dom.d.ts +0 -7
- package/internal/utils/dom.d.ts.map +1 -1
- package/internal/utils/dom.js +0 -12
- package/internal/utils/dom.js.map +1 -1
- package/internal/utils/node-belongs.d.ts +1 -1
- package/internal/utils/node-belongs.d.ts.map +1 -1
- package/internal/utils/node-belongs.js +4 -3
- package/internal/utils/node-belongs.js.map +1 -1
- package/package.json +1 -1
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
package/internal/utils/dom.d.ts
CHANGED
|
@@ -16,11 +16,4 @@ export declare function getContainingBlock(startElement: HTMLElement): HTMLEleme
|
|
|
16
16
|
* the fallback value will be extracted and returned instead.
|
|
17
17
|
*/
|
|
18
18
|
export declare function parseCssVariable(value: string): string;
|
|
19
|
-
/**
|
|
20
|
-
* Checks whether the given node is a descendant of a container.
|
|
21
|
-
* @deprecated use nodeContains from component-toolkit
|
|
22
|
-
* @param container Container node
|
|
23
|
-
* @param node Node that is checked to be a descendant of the container
|
|
24
|
-
*/
|
|
25
|
-
export declare function containsOrEqual(container: Node | null, node: Node): boolean;
|
|
26
19
|
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"lib/default/","sources":["internal/utils/dom.ts"],"names":[],"mappings":"AAKA,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,GAAG,WAAW,GAAG,IAAI,CAY9G;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,YAMrC;AAsBD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAchF;AAID;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,UAiB7C
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"lib/default/","sources":["internal/utils/dom.ts"],"names":[],"mappings":"AAKA,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,GAAG,WAAW,GAAG,IAAI,CAY9G;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,YAMrC;AAsBD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAchF;AAID;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,UAiB7C"}
|
package/internal/utils/dom.js
CHANGED
|
@@ -83,16 +83,4 @@ export function parseCssVariable(value) {
|
|
|
83
83
|
const match = expr.body.match(cssVariableExpression);
|
|
84
84
|
return match ? match[1] : value;
|
|
85
85
|
}
|
|
86
|
-
/**
|
|
87
|
-
* Checks whether the given node is a descendant of a container.
|
|
88
|
-
* @deprecated use nodeContains from component-toolkit
|
|
89
|
-
* @param container Container node
|
|
90
|
-
* @param node Node that is checked to be a descendant of the container
|
|
91
|
-
*/
|
|
92
|
-
export function containsOrEqual(container, node) {
|
|
93
|
-
if (container === null) {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
return container === node || container.contains(node);
|
|
97
|
-
}
|
|
98
86
|
//# sourceMappingURL=dom.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.js","sourceRoot":"lib/default/","sources":["internal/utils/dom.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,UAAU,WAAW,CAAC,IAAiB,EAAE,QAA2C;IAC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AC,MAAM,CAAC,CAAC;IAC3C,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE;QACnB,OAAO,KAAK,CAAC;KACd;IAED,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxD,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,KAAK,CAAC;KACd;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACrD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAClC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport balanced from 'balanced-match';\nimport { calculateOnce } from './calculate-once';\n\nexport function findUpUntil(node: HTMLElement, callback: (element: HTMLElement) => boolean): HTMLElement | null {\n let current: HTMLElement | null = node;\n while (current && !callback(current)) {\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 && !(current instanceof HTMLElement)) {\n current = (current as Element).parentElement;\n }\n }\n return current;\n}\n\n/**\n * Returns whether the browser supports CSS position sticky.\n * In our list of supported browsers, only returns false for IE11.\n */\nexport function supportsStickyPosition() {\n if (typeof window === 'undefined') {\n // render no-sticky UI on server-side\n return false;\n }\n return window.CSS?.supports?.('position', 'sticky') ?? false;\n}\n\n/**\n * Returns whether `position: fixed` can be relative to transformed parents or\n * whether it's always relative to the viewport. Returns `true` on all browsers\n * except IE.\n */\nconst supportsContainingBlockPositioning = calculateOnce(() => {\n const parent = document.createElement('div');\n parent.style.transform = 'translateY(5px)';\n document.body.appendChild(parent);\n\n const child = document.createElement('div');\n child.style.position = 'fixed';\n child.style.top = '0';\n parent.appendChild(child);\n\n const result = parent.getBoundingClientRect().top === child.getBoundingClientRect().top;\n document.body.removeChild(parent);\n return result;\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 supportsContainingBlockPositioning()\n ? (findUpUntil(startElement.parentElement, element => {\n const computedStyle = getComputedStyle(element);\n return (\n (!!computedStyle.transform && computedStyle.transform !== 'none') ||\n (!!computedStyle.perspective && computedStyle.perspective !== 'none')\n );\n }) as HTMLElement)\n : null;\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 (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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Checks whether the given node (target) belongs to the container.
|
|
3
|
-
* The function is similar to
|
|
3
|
+
* The function is similar to nodeContains but also accounts for dropdowns with expandToViewport=true.
|
|
4
4
|
*
|
|
5
5
|
* @param container Container node
|
|
6
6
|
* @param target Node that is checked to be a descendant of the container
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-belongs.d.ts","sourceRoot":"lib/default/","sources":["internal/utils/node-belongs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node-belongs.d.ts","sourceRoot":"lib/default/","sources":["internal/utils/node-belongs.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,IAAI,GAAG,IAAI,EAAE,MAAM,EAAE,IAAI,GAAG,WAAW,GAAG,IAAI,GAAG,OAAO,CAO9F"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import {
|
|
3
|
+
import { findUpUntil } from './dom';
|
|
4
|
+
import { nodeContains } from '@cloudscape-design/component-toolkit/dom';
|
|
4
5
|
/**
|
|
5
6
|
* Checks whether the given node (target) belongs to the container.
|
|
6
|
-
* The function is similar to
|
|
7
|
+
* The function is similar to nodeContains but also accounts for dropdowns with expandToViewport=true.
|
|
7
8
|
*
|
|
8
9
|
* @param container Container node
|
|
9
10
|
* @param target Node that is checked to be a descendant of the container
|
|
@@ -15,6 +16,6 @@ export function nodeBelongs(container, target) {
|
|
|
15
16
|
}
|
|
16
17
|
const portal = findUpUntil(target, node => !!node.dataset.awsuiReferrerId);
|
|
17
18
|
const referrer = portal instanceof HTMLElement ? document.getElementById((_a = portal.dataset.awsuiReferrerId) !== null && _a !== void 0 ? _a : '') : null;
|
|
18
|
-
return referrer ?
|
|
19
|
+
return referrer ? nodeContains(container, referrer) : nodeContains(container, target);
|
|
19
20
|
}
|
|
20
21
|
//# sourceMappingURL=node-belongs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-belongs.js","sourceRoot":"lib/default/","sources":["internal/utils/node-belongs.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"node-belongs.js","sourceRoot":"lib/default/","sources":["internal/utils/node-belongs.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAExE;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,SAAsB,EAAE,MAAiC;;IACnF,IAAI,CAAC,CAAC,MAAM,YAAY,IAAI,CAAC,EAAE;QAC7B,OAAO,KAAK,CAAC;KACd;IACD,MAAM,MAAM,GAAG,WAAW,CAAC,MAAqB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC1F,MAAM,QAAQ,GAAG,MAAM,YAAY,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAA,MAAM,CAAC,OAAO,CAAC,eAAe,mCAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACtH,OAAO,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AACxF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { findUpUntil } from './dom';\nimport { nodeContains } from '@cloudscape-design/component-toolkit/dom';\n\n/**\n * Checks whether the given node (target) belongs to the container.\n * The function is similar to nodeContains but also accounts for dropdowns with expandToViewport=true.\n *\n * @param container Container node\n * @param target Node that is checked to be a descendant of the container\n */\nexport function nodeBelongs(container: Node | null, target: Node | EventTarget | null): boolean {\n if (!(target instanceof Node)) {\n return false;\n }\n const portal = findUpUntil(target as HTMLElement, node => !!node.dataset.awsuiReferrerId);\n const referrer = portal instanceof HTMLElement ? document.getElementById(portal.dataset.awsuiReferrerId ?? '') : null;\n return referrer ? nodeContains(container, referrer) : nodeContains(container, target);\n}\n"]}
|
package/package.json
CHANGED