@cloudscape-design/components 3.0.1056 → 3.0.1057

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.
@@ -2039,5 +2039,5 @@
2039
2039
  }
2040
2040
  }
2041
2041
  :root {
2042
- --awsui-version-info-8d13105b: true;
2042
+ --awsui-version-info-77f47115: true;
2043
2043
  }
@@ -1,6 +1,6 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (8d13105b)";
3
- export var GIT_SHA = "8d13105b";
2
+ export var PACKAGE_VERSION = "3.0.0 (77f47115)";
3
+ export var GIT_SHA = "77f47115";
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 (8d13105b)",
4
- "GIT_SHA": "8d13105b",
3
+ "PACKAGE_VERSION": "3.0.0 (77f47115)",
4
+ "GIT_SHA": "77f47115",
5
5
  "THEME": "open-source-visual-refresh",
6
6
  "SYSTEM": "console",
7
7
  "ALWAYS_VISUAL_REFRESH": true
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-intersection-observer/index.ts"],"names":[],"mappings":"AAKA,UAAU,6BAA6B;IACrC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,WAAW,EAAE,EAC7D,YAAoB,GACrB,GAAE,6BAAkC;;;EAkCpC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-intersection-observer/index.ts"],"names":[],"mappings":"AAKA,UAAU,6BAA6B;IACrC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,WAAW,EAAE,EAC7D,YAAoB,GACrB,GAAE,6BAAkC;;;EA0CpC"}
@@ -31,7 +31,15 @@ export function useIntersectionObserver({ initialState = false, } = {}) {
31
31
  catch (_a) {
32
32
  // Tried to access a cross-origin iframe. Fall back to current IntersectionObserver.
33
33
  }
34
- observerRef.current = new TopLevelIntersectionObserver(([entry]) => setIsIntersecting(entry.isIntersecting));
34
+ observerRef.current = new TopLevelIntersectionObserver(entries => {
35
+ let latestEntry = entries[0];
36
+ for (const entry of entries) {
37
+ if (entry.time > latestEntry.time) {
38
+ latestEntry = entry;
39
+ }
40
+ }
41
+ setIsIntersecting(latestEntry.isIntersecting);
42
+ });
35
43
  observerRef.current.observe(targetElement);
36
44
  }
37
45
  }, []);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-intersection-observer/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAe,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMnE;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAwB,EAC7D,YAAY,GAAG,KAAK,MACa,EAAE;IACnC,MAAM,WAAW,GAAG,MAAM,CAA8B,IAAI,CAAC,CAAC;IAC9D,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IAEnE,MAAM,GAAG,GAAG,WAAW,CAAiB,aAAa,CAAC,EAAE;QACtD,IAAI,OAAO,oBAAoB,KAAK,WAAW,EAAE;YAC/C,wCAAwC;YACxC,OAAO;SACR;QAED,IAAI,WAAW,CAAC,OAAO,EAAE;YACvB,uDAAuD;YACvD,WAAW,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;SAClC;QAED,gDAAgD;QAChD,IAAI,aAAa,EAAE;YACjB,4EAA4E;YAC5E,iFAAiF;YACjF,2FAA2F;YAC3F,IAAI,4BAA4B,GAAG,oBAAoB,CAAC;YACxD,IAAI;gBACF,IAAI,MAAM,CAAC,GAAG,EAAE;oBACd,4BAA4B,GAAI,MAAM,CAAC,GAAqB,CAAC,oBAAoB,CAAC;iBACnF;aACF;YAAC,WAAM;gBACN,oFAAoF;aACrF;YACD,WAAW,CAAC,OAAO,GAAG,IAAI,4BAA4B,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;YAC7G,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;SAC5C;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,CAAC;AACjC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { RefCallback, useCallback, useRef, useState } from 'react';\n\ninterface UseIntersectionObserverConfig {\n initialState?: boolean;\n}\n\n/**\n * A hook that uses an Intersection Observer on the target element ref\n * and detects if the element is intersecting with its parent.\n */\nexport function useIntersectionObserver<T extends HTMLElement>({\n initialState = false,\n}: UseIntersectionObserverConfig = {}) {\n const observerRef = useRef<IntersectionObserver | null>(null);\n const [isIntersecting, setIsIntersecting] = useState(initialState);\n\n const ref = useCallback<RefCallback<T>>(targetElement => {\n if (typeof IntersectionObserver === 'undefined') {\n // Do nothing in environments like JSDOM\n return;\n }\n\n if (observerRef.current) {\n // Dismiss previous observer because the target changed\n observerRef.current.disconnect();\n }\n\n // Create a new observer with the target element\n if (targetElement) {\n // Fix for AWSUI-60898: In Firefox, IntersectionObserver instances inside an\n // iframe context can't detect visibility changes caused by changes to elements\n // outside the iframe (e.g. if an element wrapping the iframe is set to `display: none`).\n let TopLevelIntersectionObserver = IntersectionObserver;\n try {\n if (window.top) {\n TopLevelIntersectionObserver = (window.top as typeof window).IntersectionObserver;\n }\n } catch {\n // Tried to access a cross-origin iframe. Fall back to current IntersectionObserver.\n }\n observerRef.current = new TopLevelIntersectionObserver(([entry]) => setIsIntersecting(entry.isIntersecting));\n observerRef.current.observe(targetElement);\n }\n }, []);\n\n return { ref, isIntersecting };\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-intersection-observer/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAe,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMnE;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAwB,EAC7D,YAAY,GAAG,KAAK,MACa,EAAE;IACnC,MAAM,WAAW,GAAG,MAAM,CAA8B,IAAI,CAAC,CAAC;IAC9D,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IAEnE,MAAM,GAAG,GAAG,WAAW,CAAiB,aAAa,CAAC,EAAE;QACtD,IAAI,OAAO,oBAAoB,KAAK,WAAW,EAAE;YAC/C,wCAAwC;YACxC,OAAO;SACR;QAED,IAAI,WAAW,CAAC,OAAO,EAAE;YACvB,uDAAuD;YACvD,WAAW,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;SAClC;QAED,gDAAgD;QAChD,IAAI,aAAa,EAAE;YACjB,4EAA4E;YAC5E,iFAAiF;YACjF,2FAA2F;YAC3F,IAAI,4BAA4B,GAAG,oBAAoB,CAAC;YACxD,IAAI;gBACF,IAAI,MAAM,CAAC,GAAG,EAAE;oBACd,4BAA4B,GAAI,MAAM,CAAC,GAAqB,CAAC,oBAAoB,CAAC;iBACnF;aACF;YAAC,WAAM;gBACN,oFAAoF;aACrF;YACD,WAAW,CAAC,OAAO,GAAG,IAAI,4BAA4B,CAAC,OAAO,CAAC,EAAE;gBAC/D,IAAI,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;gBAC7B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE;oBAC3B,IAAI,KAAK,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,EAAE;wBACjC,WAAW,GAAG,KAAK,CAAC;qBACrB;iBACF;gBACD,iBAAiB,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;YAChD,CAAC,CAAC,CAAC;YACH,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;SAC5C;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,CAAC;AACjC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { RefCallback, useCallback, useRef, useState } from 'react';\n\ninterface UseIntersectionObserverConfig {\n initialState?: boolean;\n}\n\n/**\n * A hook that uses an Intersection Observer on the target element ref\n * and detects if the element is intersecting with its parent.\n */\nexport function useIntersectionObserver<T extends HTMLElement>({\n initialState = false,\n}: UseIntersectionObserverConfig = {}) {\n const observerRef = useRef<IntersectionObserver | null>(null);\n const [isIntersecting, setIsIntersecting] = useState(initialState);\n\n const ref = useCallback<RefCallback<T>>(targetElement => {\n if (typeof IntersectionObserver === 'undefined') {\n // Do nothing in environments like JSDOM\n return;\n }\n\n if (observerRef.current) {\n // Dismiss previous observer because the target changed\n observerRef.current.disconnect();\n }\n\n // Create a new observer with the target element\n if (targetElement) {\n // Fix for AWSUI-60898: In Firefox, IntersectionObserver instances inside an\n // iframe context can't detect visibility changes caused by changes to elements\n // outside the iframe (e.g. if an element wrapping the iframe is set to `display: none`).\n let TopLevelIntersectionObserver = IntersectionObserver;\n try {\n if (window.top) {\n TopLevelIntersectionObserver = (window.top as typeof window).IntersectionObserver;\n }\n } catch {\n // Tried to access a cross-origin iframe. Fall back to current IntersectionObserver.\n }\n observerRef.current = new TopLevelIntersectionObserver(entries => {\n let latestEntry = entries[0];\n for (const entry of entries) {\n if (entry.time > latestEntry.time) {\n latestEntry = entry;\n }\n }\n setIsIntersecting(latestEntry.isIntersecting);\n });\n observerRef.current.observe(targetElement);\n }\n }, []);\n\n return { ref, isIntersecting };\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "8d13105b1f0e3134bcf3b956e8e8338cd212803f"
2
+ "commit": "77f471153f1baadf5870d6b339b6ecd7744a1297"
3
3
  }
package/package.json CHANGED
@@ -150,7 +150,7 @@
150
150
  "./internal/base-component/index.js",
151
151
  "./internal/base-component/styles.css.js"
152
152
  ],
153
- "version": "3.0.1056",
153
+ "version": "3.0.1057",
154
154
  "repository": {
155
155
  "type": "git",
156
156
  "url": "https://github.com/cloudscape-design/components.git"