@cloudscape-design/components 3.0.1110 → 3.0.1111

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.
@@ -2043,5 +2043,5 @@
2043
2043
  }
2044
2044
  }
2045
2045
  :root {
2046
- --awsui-version-info-917de812: true;
2046
+ --awsui-version-info-d52c074d: true;
2047
2047
  }
@@ -1,6 +1,6 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (917de812)";
3
- export var GIT_SHA = "917de812";
2
+ export var PACKAGE_VERSION = "3.0.0 (d52c074d)";
3
+ export var GIT_SHA = "d52c074d";
4
4
  export var THEME = "open-source-visual-refresh";
5
5
  export var SYSTEM = "console";
6
6
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (917de812)",
4
- "GIT_SHA": "917de812",
3
+ "PACKAGE_VERSION": "3.0.0 (d52c074d)",
4
+ "GIT_SHA": "d52c074d",
5
5
  "THEME": "open-source-visual-refresh",
6
6
  "SYSTEM": "console",
7
7
  "ALWAYS_VISUAL_REFRESH": true
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "917de81204a28eb9231022693f19cd151863759f"
2
+ "commit": "d52c074d07d2880ee17b6cd8f32a66b8a2336952"
3
3
  }
@@ -1 +1 @@
1
- {"version":3,"file":"create-category-color-scale.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/create-category-color-scale.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,CAAC,EAChD,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,WAAW,GAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAqB,EAC/C,WAAW,GAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,MAAmB,GACnD,MAAM,EAAE,CAeV"}
1
+ {"version":3,"file":"create-category-color-scale.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/create-category-color-scale.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,CAAC,EAChD,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,WAAW,GAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAqB,EAC/C,WAAW,GAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,MAAmB,GACnD,MAAM,EAAE,CAeV"}
@@ -2,14 +2,13 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { colorChartsThresholdNeutral as thresholdColor } from '../generated/styles/tokens';
4
4
  import { categoryPalette } from '../styles/colors';
5
- import { parseCssVariable } from './dom';
6
5
  export default function createCategoryColorScale(items, isThreshold = () => false, getOwnColor = () => null) {
7
6
  const colors = [];
8
7
  let categoryIndex = 0;
9
8
  for (const it of items) {
10
9
  const ownColor = getOwnColor(it);
11
10
  const defaultColor = isThreshold(it) ? thresholdColor : categoryPalette[categoryIndex % categoryPalette.length];
12
- colors.push(parseCssVariable(ownColor || defaultColor));
11
+ colors.push(ownColor || defaultColor);
13
12
  if (!isThreshold(it) && !ownColor) {
14
13
  categoryIndex++;
15
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"create-category-color-scale.js","sourceRoot":"","sources":["../../../../src/internal/utils/create-category-color-scale.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,2BAA2B,IAAI,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEzC,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,KAAmB,EACnB,cAAoC,GAAG,EAAE,CAAC,KAAK,EAC/C,cAA0C,GAAG,EAAE,CAAC,IAAI;IAEpD,MAAM,MAAM,GAAG,EAAE,CAAC;IAElB,IAAI,aAAa,GAAG,CAAC,CAAC;IACtB,KAAK,MAAM,EAAE,IAAI,KAAK,EAAE;QACtB,MAAM,QAAQ,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;QACjC,MAAM,YAAY,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,eAAe,CAAC,aAAa,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QAChH,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,IAAI,YAAY,CAAC,CAAC,CAAC;QAExD,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE;YACjC,aAAa,EAAE,CAAC;SACjB;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { colorChartsThresholdNeutral as thresholdColor } from '../generated/styles/tokens';\nimport { categoryPalette } from '../styles/colors';\nimport { parseCssVariable } from './dom';\n\nexport default function createCategoryColorScale<T>(\n items: readonly T[],\n isThreshold: (item: T) => boolean = () => false,\n getOwnColor: (item: T) => null | string = () => null\n): string[] {\n const colors = [];\n\n let categoryIndex = 0;\n for (const it of items) {\n const ownColor = getOwnColor(it);\n const defaultColor = isThreshold(it) ? thresholdColor : categoryPalette[categoryIndex % categoryPalette.length];\n colors.push(parseCssVariable(ownColor || defaultColor));\n\n if (!isThreshold(it) && !ownColor) {\n categoryIndex++;\n }\n }\n\n return colors;\n}\n"]}
1
+ {"version":3,"file":"create-category-color-scale.js","sourceRoot":"","sources":["../../../../src/internal/utils/create-category-color-scale.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,2BAA2B,IAAI,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,KAAmB,EACnB,cAAoC,GAAG,EAAE,CAAC,KAAK,EAC/C,cAA0C,GAAG,EAAE,CAAC,IAAI;IAEpD,MAAM,MAAM,GAAG,EAAE,CAAC;IAElB,IAAI,aAAa,GAAG,CAAC,CAAC;IACtB,KAAK,MAAM,EAAE,IAAI,KAAK,EAAE;QACtB,MAAM,QAAQ,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;QACjC,MAAM,YAAY,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,eAAe,CAAC,aAAa,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QAChH,MAAM,CAAC,IAAI,CAAC,QAAQ,IAAI,YAAY,CAAC,CAAC;QAEtC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE;YACjC,aAAa,EAAE,CAAC;SACjB;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { colorChartsThresholdNeutral as thresholdColor } from '../generated/styles/tokens';\nimport { categoryPalette } from '../styles/colors';\n\nexport default function createCategoryColorScale<T>(\n items: readonly T[],\n isThreshold: (item: T) => boolean = () => false,\n getOwnColor: (item: T) => null | string = () => null\n): string[] {\n const colors = [];\n\n let categoryIndex = 0;\n for (const it of items) {\n const ownColor = getOwnColor(it);\n const defaultColor = isThreshold(it) ? thresholdColor : categoryPalette[categoryIndex % categoryPalette.length];\n colors.push(ownColor || defaultColor);\n\n if (!isThreshold(it) && !ownColor) {\n categoryIndex++;\n }\n }\n\n return colors;\n}\n"]}
@@ -11,13 +11,6 @@ export declare function findUpUntilMultiple({
11
11
  startElement: HTMLElement;
12
12
  tests: Record<string, (el: HTMLElement) => boolean>;
13
13
  }): Record<string, HTMLElement>;
14
- /**
15
- * Parses a CSS color value that might contain CSS Custom Properties
16
- * and returns a value that will be understood by the browser, no matter of support level.
17
- * If the browser support CSS Custom Properties, the value will be return as is. Otherwise,
18
- * the fallback value will be extracted and returned instead.
19
- */
20
- export declare function parseCssVariable(value: string): string;
21
14
  export declare function isNode(target: unknown): target is Node;
22
15
  export declare function isHTMLElement(target: unknown): target is HTMLElement;
23
16
  export declare function isSVGElement(target: unknown): target is SVGElement;
@@ -1 +1 @@
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,CAO/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"}
1
+ {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/dom.ts"],"names":[],"mappings":"AAKA,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAO/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;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,6 +1,5 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import balanced from 'balanced-match';
4
3
  import { findUpUntil } from '@cloudscape-design/component-toolkit/dom';
5
4
  export function isContainingBlock(element) {
6
5
  var _a;
@@ -43,32 +42,6 @@ export function findUpUntilMultiple({ startElement, tests, }) {
43
42
  }
44
43
  return elements;
45
44
  }
46
- const cssVariableExpression = /--.+?\s*,\s*(.+)/;
47
- /**
48
- * Parses a CSS color value that might contain CSS Custom Properties
49
- * and returns a value that will be understood by the browser, no matter of support level.
50
- * If the browser support CSS Custom Properties, the value will be return as is. Otherwise,
51
- * the fallback value will be extracted and returned instead.
52
- */
53
- export function parseCssVariable(value) {
54
- var _a, _b, _c;
55
- if (typeof window === 'undefined') {
56
- return value;
57
- }
58
- if ((_c = (_b = (_a = window.CSS) === null || _a === void 0 ? void 0 : _a.supports) === null || _b === void 0 ? void 0 : _b.call(_a, 'color', 'var(--dummy, #000)')) !== null && _c !== void 0 ? _c : false) {
59
- return value;
60
- }
61
- const varIndex = value.lastIndexOf('var(');
62
- if (varIndex === -1) {
63
- return value;
64
- }
65
- const expr = balanced('(', ')', value.substr(varIndex));
66
- if (!expr) {
67
- return value;
68
- }
69
- const match = expr.body.match(cssVariableExpression);
70
- return match ? match[1] : value;
71
- }
72
45
  // The instanceof Node/HTMLElement/SVGElement checks can fail if the target element
73
46
  // belongs to a different window than the respective type.
74
47
  export function isNode(target) {
@@ -1 +1 @@
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;SACrE,MAAA,aAAa,CAAC,OAAO,0CAAE,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA,CAClG,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,YAAyB;IAC1D,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE;QAC/B,OAAO,IAAI,CAAC;KACb;IAED,OAAO,WAAW,CAAC,YAAY,CAAC,aAAa,EAAE,iBAAiB,CAAgB,CAAC;AACnF,CAAC;AAED;;;GAGG;AAEH,MAAM,UAAU,mBAAmB,CAAC,EAClC,YAAY,EACZ,KAAK,GAIN;IACC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,QAAQ,GAAgC,EAAE,CAAC;IACjD,IAA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ced-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.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
+ {"version":3,"file":"dom.js","sourceRoot":"","sources":["../../../../src/internal/utils/dom.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;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;SACrE,MAAA,aAAa,CAAC,OAAO,0CAAE,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,O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AK,QAAQ;YAC1B,UAAU,IAAI,MAAM;YACpB,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ;YACnC,UAAU,IAAI,MAAM;YACpB,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ;YACnC,YAAY,IAAI,MAAM;YACtB,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,CAAC,CACzC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAe;IAC3C,OAAO,CACL,MAAM,YAAY,WAAW;QAC7B,CAAC,MAAM,CAAC,MAAM,CAAC;YACb,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;YACrC,OAAO,IAAI,MAAM;YACjB,OAAO,MAAM,CAAC,KAAK,KAAK,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 { 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.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\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"]}
package/package.json CHANGED
@@ -151,7 +151,7 @@
151
151
  "./internal/base-component/index.js",
152
152
  "./internal/base-component/styles.css.js"
153
153
  ],
154
- "version": "3.0.1110",
154
+ "version": "3.0.1111",
155
155
  "repository": {
156
156
  "type": "git",
157
157
  "url": "https://github.com/cloudscape-design/components.git"
@@ -166,7 +166,6 @@
166
166
  "@dnd-kit/sortable": "^7.0.2",
167
167
  "@dnd-kit/utilities": "^3.2.1",
168
168
  "ace-builds": "^1.34.0",
169
- "balanced-match": "^1.0.2",
170
169
  "clsx": "^1.1.0",
171
170
  "d3-shape": "^1.3.7",
172
171
  "date-fns": "^2.25.0",