@nswds/app 1.31.0 → 1.32.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 +18 -0
- package/dist/index.cjs +113 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +113 -36
- package/dist/index.js.map +1 -1
- package/dist/styles.css +12 -0
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/globals.css
CHANGED
|
@@ -399,6 +399,9 @@
|
|
|
399
399
|
.z-30 {
|
|
400
400
|
z-index: 30;
|
|
401
401
|
}
|
|
402
|
+
.z-40 {
|
|
403
|
+
z-index: 40;
|
|
404
|
+
}
|
|
402
405
|
.z-50 {
|
|
403
406
|
z-index: 50;
|
|
404
407
|
}
|
|
@@ -717,6 +720,9 @@
|
|
|
717
720
|
.h-px {
|
|
718
721
|
height: 1px;
|
|
719
722
|
}
|
|
723
|
+
.h-screen {
|
|
724
|
+
height: 100vh;
|
|
725
|
+
}
|
|
720
726
|
.max-h-\(--radix-context-menu-content-available-height\) {
|
|
721
727
|
max-height: var(--radix-context-menu-content-available-height);
|
|
722
728
|
}
|
|
@@ -2275,6 +2281,18 @@
|
|
|
2275
2281
|
--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
|
|
2276
2282
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
2277
2283
|
}
|
|
2284
|
+
.shadow-grey-900 {
|
|
2285
|
+
--tw-shadow-color: oklch(0.17511812981113217 0.007251980042076026 242.08383926925922);
|
|
2286
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
2287
|
+
--tw-shadow-color: color-mix(in oklab, oklch(0.17511812981113217 0.007251980042076026 242.08383926925922) var(--tw-shadow-alpha), transparent);
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
.shadow-grey-900\/5 {
|
|
2291
|
+
--tw-shadow-color: color-mix(in srgb, oklch(0.17511812981113217 0.007251980042076026 242.08383926925922) 5%, transparent);
|
|
2292
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
2293
|
+
--tw-shadow-color: color-mix(in oklab, color-mix(in oklab, oklch(0.17511812981113217 0.007251980042076026 242.08383926925922) 5%, transparent) var(--tw-shadow-alpha), transparent);
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2278
2296
|
.shadow-slate-900 {
|
|
2279
2297
|
--tw-shadow-color: oklch(20.8% 0.042 265.755);
|
|
2280
2298
|
@supports (color: color-mix(in lab, red, red)) {
|
package/dist/index.cjs
CHANGED
|
@@ -7454,7 +7454,7 @@ function Heading({
|
|
|
7454
7454
|
|
|
7455
7455
|
// package.json
|
|
7456
7456
|
var package_default = {
|
|
7457
|
-
version: "1.
|
|
7457
|
+
version: "1.31.0"};
|
|
7458
7458
|
function Logo(props) {
|
|
7459
7459
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7460
7460
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "NSW Government" }),
|
|
@@ -7558,7 +7558,7 @@ function SiteSearch({ navigation: navigation$1 }) {
|
|
|
7558
7558
|
/* @__PURE__ */ jsxRuntime.jsx(CommandInput, { placeholder: "Type to search across the site..." }),
|
|
7559
7559
|
/* @__PURE__ */ jsxRuntime.jsxs(CommandList, { children: [
|
|
7560
7560
|
/* @__PURE__ */ jsxRuntime.jsx(CommandEmpty, { children: "No results found." }),
|
|
7561
|
-
navigation$1.map((page, index) => /* @__PURE__ */ jsxRuntime.jsx(CommandGroup, { heading: page.title, children: page.links.map((page2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
7561
|
+
navigation$1.map((page, index) => /* @__PURE__ */ jsxRuntime.jsx(CommandGroup, { heading: page.title, children: page.links && page.links.map((page2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
7562
7562
|
CommandItem,
|
|
7563
7563
|
{
|
|
7564
7564
|
onSelect: () => runCommand(() => router.push(page2.href)),
|
|
@@ -7571,13 +7571,14 @@ function SiteSearch({ navigation: navigation$1 }) {
|
|
|
7571
7571
|
] });
|
|
7572
7572
|
}
|
|
7573
7573
|
function Header2({
|
|
7574
|
+
children,
|
|
7574
7575
|
sitename,
|
|
7575
7576
|
navigation,
|
|
7576
7577
|
version = false,
|
|
7577
7578
|
hide = {}
|
|
7578
7579
|
}) {
|
|
7579
7580
|
const [isScrolled, setIsScrolled] = React6.useState(false);
|
|
7580
|
-
const { search =
|
|
7581
|
+
const { search = true, themeSwitcher = true, github = true, shadow = true } = hide;
|
|
7581
7582
|
React6.useEffect(() => {
|
|
7582
7583
|
function onScroll() {
|
|
7583
7584
|
setIsScrolled(window.scrollY > 0);
|
|
@@ -7592,7 +7593,8 @@ function Header2({
|
|
|
7592
7593
|
"header",
|
|
7593
7594
|
{
|
|
7594
7595
|
className: clsx12__default.default(
|
|
7595
|
-
"sticky top-0 z-50 flex flex-none flex-wrap items-center justify-between bg-white px-4 py-5
|
|
7596
|
+
"sticky top-0 z-50 flex flex-none flex-wrap items-center justify-between bg-white px-4 py-5 transition duration-500 sm:px-6 lg:px-12",
|
|
7597
|
+
shadow && "shadow-md shadow-slate-900/5 dark:shadow-none",
|
|
7596
7598
|
isScrolled ? "dark:bg-slate-900/95 dark:backdrop-blur-sm dark:[@supports(backdrop-filter:blur(0))]:bg-slate-900/75" : "dark:bg-transparent"
|
|
7597
7599
|
),
|
|
7598
7600
|
children: [
|
|
@@ -7605,9 +7607,9 @@ function Header2({
|
|
|
7605
7607
|
version && /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "soft", color: "primary", className: "ml-2", children: package_default.version })
|
|
7606
7608
|
] }),
|
|
7607
7609
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex basis-0 justify-end gap-2 sm:gap-4 md:grow", children: [
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7610
|
+
search && /* @__PURE__ */ jsxRuntime.jsx(SiteSearch, { navigation }),
|
|
7611
|
+
themeSwitcher && /* @__PURE__ */ jsxRuntime.jsx(ThemeSwitcher, {}),
|
|
7612
|
+
github && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7611
7613
|
Button2,
|
|
7612
7614
|
{
|
|
7613
7615
|
variant: "surface",
|
|
@@ -7624,7 +7626,8 @@ function Header2({
|
|
|
7624
7626
|
}
|
|
7625
7627
|
)
|
|
7626
7628
|
}
|
|
7627
|
-
)
|
|
7629
|
+
),
|
|
7630
|
+
children
|
|
7628
7631
|
] })
|
|
7629
7632
|
]
|
|
7630
7633
|
}
|
|
@@ -7918,24 +7921,61 @@ function MenubarSubContent({
|
|
|
7918
7921
|
);
|
|
7919
7922
|
}
|
|
7920
7923
|
function MainNavigation({ navigation }) {
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7924
|
+
const [headerHeight, setHeaderHeight] = React6.useState(88);
|
|
7925
|
+
React6.useEffect(() => {
|
|
7926
|
+
const measureHeader = () => {
|
|
7927
|
+
const header2 = document.querySelector("header");
|
|
7928
|
+
if (header2) {
|
|
7929
|
+
setHeaderHeight(header2.offsetHeight);
|
|
7930
|
+
}
|
|
7931
|
+
};
|
|
7932
|
+
const timeoutId = setTimeout(measureHeader, 100);
|
|
7933
|
+
const header = document.querySelector("header");
|
|
7934
|
+
let resizeObserver = null;
|
|
7935
|
+
if (header) {
|
|
7936
|
+
resizeObserver = new ResizeObserver((entries) => {
|
|
7937
|
+
for (const entry of entries) {
|
|
7938
|
+
setHeaderHeight(entry.contentRect.height);
|
|
7939
|
+
}
|
|
7940
|
+
});
|
|
7941
|
+
resizeObserver.observe(header);
|
|
7942
|
+
}
|
|
7943
|
+
return () => {
|
|
7944
|
+
clearTimeout(timeoutId);
|
|
7945
|
+
if (resizeObserver) {
|
|
7946
|
+
resizeObserver.disconnect();
|
|
7947
|
+
}
|
|
7948
|
+
};
|
|
7949
|
+
}, []);
|
|
7950
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7951
|
+
"nav",
|
|
7952
|
+
{
|
|
7953
|
+
className: "shadow-grey-900/5 sticky z-40 hidden bg-gray-100 shadow-md sm:px-6 lg:block lg:px-4 dark:shadow-none",
|
|
7954
|
+
style: {
|
|
7955
|
+
top: `${headerHeight}px`,
|
|
7956
|
+
// Ensure the nav doesn't jump when header height is calculated
|
|
7957
|
+
transition: "top 0.2s ease-in-out"
|
|
7935
7958
|
},
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7959
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative z-50 mx-auto flex items-center justify-between", children: /* @__PURE__ */ jsxRuntime.jsx(Headless.PopoverGroup, { className: "flex justify-start", children: navigation.map(
|
|
7960
|
+
(item, index) => item.links ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
7961
|
+
MegaMenu,
|
|
7962
|
+
{
|
|
7963
|
+
title: item.title,
|
|
7964
|
+
href: item.href !== void 0 ? item.href : "#",
|
|
7965
|
+
links: item.links
|
|
7966
|
+
},
|
|
7967
|
+
index
|
|
7968
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
7969
|
+
TopLevel,
|
|
7970
|
+
{
|
|
7971
|
+
title: item.title,
|
|
7972
|
+
href: item.href !== void 0 ? item.href : "#"
|
|
7973
|
+
},
|
|
7974
|
+
index
|
|
7975
|
+
)
|
|
7976
|
+
) }) })
|
|
7977
|
+
}
|
|
7978
|
+
);
|
|
7939
7979
|
}
|
|
7940
7980
|
function TopLevel({ title, href }) {
|
|
7941
7981
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -8006,14 +8046,35 @@ function Navigation({
|
|
|
8006
8046
|
navigation: navigation$1
|
|
8007
8047
|
}) {
|
|
8008
8048
|
const pathname = navigation.usePathname();
|
|
8009
|
-
return /* @__PURE__ */ jsxRuntime.jsx("nav", { className: clsx12__default.default("text-base lg:text-sm", className), children: /* @__PURE__ */ jsxRuntime.jsx("ul", { role: "list", className: "flex flex-col gap-9", children: navigation$1.map((section) => /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
8010
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-display text-foreground font-medium dark:text-white", children: section.title })
|
|
8049
|
+
return /* @__PURE__ */ jsxRuntime.jsx("nav", { className: clsx12__default.default("text-base lg:text-sm", className), children: /* @__PURE__ */ jsxRuntime.jsx("ul", { role: "list", className: "flex flex-col gap-9", children: navigation$1.map((section, index) => /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
8050
|
+
section.links ? /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-display text-foreground font-medium dark:text-white", children: section.title }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
8051
|
+
"ul",
|
|
8052
|
+
{
|
|
8053
|
+
role: "list",
|
|
8054
|
+
className: "border-nsw-grey-400 dark:border-nsw-grey-200/15 mt-2 flex flex-col gap-2 border-l lg:mt-4",
|
|
8055
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("li", { className: "-ml-px flex flex-col items-start gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8056
|
+
Link10__default.default,
|
|
8057
|
+
{
|
|
8058
|
+
href: section.href || "/",
|
|
8059
|
+
onClick: onLinkClick,
|
|
8060
|
+
className: clsx12__default.default(
|
|
8061
|
+
"text-foreground inline-block border-l border-transparent pl-5 text-base/8 sm:pl-4 sm:text-sm/6",
|
|
8062
|
+
"hover:border-nsw-grey-950 hover:text-nsw-gray-950 hover:font-semibold",
|
|
8063
|
+
"dark:text-nsw-grey-400",
|
|
8064
|
+
"dark:hover:border-nsw-grey-400 dark:hover:text-white",
|
|
8065
|
+
section.href === pathname && "border-primary text-primary border-l font-semibold dark:border-white"
|
|
8066
|
+
),
|
|
8067
|
+
children: section.title
|
|
8068
|
+
}
|
|
8069
|
+
) }, index)
|
|
8070
|
+
}
|
|
8071
|
+
),
|
|
8011
8072
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8012
8073
|
"ul",
|
|
8013
8074
|
{
|
|
8014
8075
|
role: "list",
|
|
8015
8076
|
className: "border-nsw-grey-400 dark:border-nsw-grey-200/15 mt-2 flex flex-col gap-2 border-l lg:mt-4",
|
|
8016
|
-
children: section.links.map((link) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "-ml-px flex flex-col items-start gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8077
|
+
children: section.links && section.links.map((link, index2) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "-ml-px flex flex-col items-start gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8017
8078
|
Link10__default.default,
|
|
8018
8079
|
{
|
|
8019
8080
|
href: link.href,
|
|
@@ -8027,10 +8088,10 @@ function Navigation({
|
|
|
8027
8088
|
),
|
|
8028
8089
|
children: link.title
|
|
8029
8090
|
}
|
|
8030
|
-
) },
|
|
8091
|
+
) }, index2))
|
|
8031
8092
|
}
|
|
8032
8093
|
)
|
|
8033
|
-
] },
|
|
8094
|
+
] }, index)) }) });
|
|
8034
8095
|
}
|
|
8035
8096
|
function NavigationMenu({
|
|
8036
8097
|
className,
|
|
@@ -8295,9 +8356,9 @@ function PrevNextLinksPageLink({
|
|
|
8295
8356
|
function PrevNextLinks({ navigation: navigation$1 }) {
|
|
8296
8357
|
const pathname = navigation.usePathname();
|
|
8297
8358
|
const allLinks = navigation$1.flatMap((section) => section.links);
|
|
8298
|
-
const linkIndex = allLinks.findIndex((link) => link
|
|
8299
|
-
const previousPage = linkIndex >
|
|
8300
|
-
const nextPage = linkIndex > -1 ? allLinks[linkIndex + 1] : null;
|
|
8359
|
+
const linkIndex = allLinks.findIndex((link) => link?.href === pathname);
|
|
8360
|
+
const previousPage = linkIndex > 0 ? allLinks[linkIndex - 1] : null;
|
|
8361
|
+
const nextPage = linkIndex > -1 && linkIndex < allLinks.length - 1 ? allLinks[linkIndex + 1] : null;
|
|
8301
8362
|
if (!nextPage && !previousPage) {
|
|
8302
8363
|
return null;
|
|
8303
8364
|
}
|
|
@@ -8528,13 +8589,29 @@ function SidebarNavigation({
|
|
|
8528
8589
|
}) {
|
|
8529
8590
|
const pathname = navigation.usePathname();
|
|
8530
8591
|
return /* @__PURE__ */ jsxRuntime.jsx("nav", { className: clsx12__default.default("text-base lg:text-sm", className), children: /* @__PURE__ */ jsxRuntime.jsx("ul", { role: "list", className: "flex flex-col gap-9", children: navigation$1.map((section, sectionIndex) => /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
8531
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-display text-foreground font-medium dark:text-white", children: section.title })
|
|
8592
|
+
section.links ? /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-display text-foreground font-medium dark:text-white", children: section.title }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
8593
|
+
"ul",
|
|
8594
|
+
{
|
|
8595
|
+
role: "list",
|
|
8596
|
+
className: "border-nsw-grey-400 dark:border-nsw-grey-200/15 mt-2 flex flex-col gap-2 border-l lg:mt-4",
|
|
8597
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8598
|
+
SidebarLink,
|
|
8599
|
+
{
|
|
8600
|
+
link: { title: section.title, href: "#" },
|
|
8601
|
+
pathname,
|
|
8602
|
+
onLinkClick: onLinkClick || (() => {
|
|
8603
|
+
}),
|
|
8604
|
+
depth: 0
|
|
8605
|
+
}
|
|
8606
|
+
)
|
|
8607
|
+
}
|
|
8608
|
+
),
|
|
8532
8609
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8533
8610
|
"ul",
|
|
8534
8611
|
{
|
|
8535
8612
|
role: "list",
|
|
8536
8613
|
className: "border-nsw-grey-400 dark:border-nsw-grey-200/15 mt-2 flex flex-col gap-2 border-l lg:mt-4",
|
|
8537
|
-
children: section.links.map((link) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8614
|
+
children: section.links && section.links.map((link) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8538
8615
|
SidebarLink,
|
|
8539
8616
|
{
|
|
8540
8617
|
link,
|
|
@@ -8842,7 +8919,7 @@ function StepNavigation({
|
|
|
8842
8919
|
const navigationWithStatus = React6.useMemo(
|
|
8843
8920
|
() => navigation.map((section) => ({
|
|
8844
8921
|
...section,
|
|
8845
|
-
links: section.links.map((link) => ({
|
|
8922
|
+
links: (section.links ?? []).map((link) => ({
|
|
8846
8923
|
...link,
|
|
8847
8924
|
status: getStatus(link.id ?? "", formStatus)
|
|
8848
8925
|
}))
|