@nswds/app 1.28.3 → 1.29.0
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/dist/globals.css +285 -14
- package/dist/index.cjs +25 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -15
- package/dist/index.js.map +1 -1
- package/dist/styles.css +285 -14
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7402,7 +7402,7 @@ function Heading({
|
|
|
7402
7402
|
|
|
7403
7403
|
// package.json
|
|
7404
7404
|
var package_default = {
|
|
7405
|
-
version: "1.
|
|
7405
|
+
version: "1.28.3"};
|
|
7406
7406
|
function Logo(props) {
|
|
7407
7407
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7408
7408
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "NSW Government" }),
|
|
@@ -8959,23 +8959,29 @@ function TableOfContents({ tableOfContents }) {
|
|
|
8959
8959
|
}, []);
|
|
8960
8960
|
useEffect(() => {
|
|
8961
8961
|
if (tableOfContents.length === 0) return;
|
|
8962
|
-
const
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8962
|
+
const timer = setTimeout(() => {
|
|
8963
|
+
const headings = getHeadings2(tableOfContents);
|
|
8964
|
+
if (headings.length === 0) return;
|
|
8965
|
+
function onScroll() {
|
|
8966
|
+
const top = window.scrollY;
|
|
8967
|
+
let current = headings[0].id;
|
|
8968
|
+
for (const heading of headings) {
|
|
8969
|
+
if (top >= heading.top - 10) {
|
|
8970
|
+
current = heading.id;
|
|
8971
|
+
} else {
|
|
8972
|
+
break;
|
|
8973
|
+
}
|
|
8971
8974
|
}
|
|
8975
|
+
setCurrentSection(current);
|
|
8972
8976
|
}
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
+
window.addEventListener("scroll", onScroll, { passive: true });
|
|
8978
|
+
onScroll();
|
|
8979
|
+
return () => {
|
|
8980
|
+
window.removeEventListener("scroll", onScroll);
|
|
8981
|
+
};
|
|
8982
|
+
}, 100);
|
|
8977
8983
|
return () => {
|
|
8978
|
-
|
|
8984
|
+
clearTimeout(timer);
|
|
8979
8985
|
};
|
|
8980
8986
|
}, [getHeadings2, tableOfContents]);
|
|
8981
8987
|
function isActive(section) {
|
|
@@ -9334,6 +9340,10 @@ var TocContext = createContext({
|
|
|
9334
9340
|
});
|
|
9335
9341
|
function TocProvider({ children }) {
|
|
9336
9342
|
const [toc, setToc] = useState(true);
|
|
9343
|
+
const pathname = usePathname();
|
|
9344
|
+
useEffect(() => {
|
|
9345
|
+
setToc(true);
|
|
9346
|
+
}, [pathname]);
|
|
9337
9347
|
return /* @__PURE__ */ jsx(TocContext.Provider, { value: { toc, setToc }, children });
|
|
9338
9348
|
}
|
|
9339
9349
|
function useToc() {
|