@nswds/app 1.72.3 → 1.73.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 CHANGED
@@ -2524,6 +2524,12 @@
2524
2524
  .bg-black {
2525
2525
  background-color: var(--color-black);
2526
2526
  }
2527
+ .bg-black\/10 {
2528
+ background-color: color-mix(in srgb, #000 10%, transparent);
2529
+ @supports (color: color-mix(in lab, red, red)) {
2530
+ background-color: color-mix(in oklab, var(--color-black) 10%, transparent);
2531
+ }
2532
+ }
2527
2533
  .bg-black\/50 {
2528
2534
  background-color: color-mix(in srgb, #000 50%, transparent);
2529
2535
  @supports (color: color-mix(in lab, red, red)) {
package/dist/index.cjs CHANGED
@@ -49,6 +49,7 @@ var vaul = require('vaul');
49
49
  var reactHookForm = require('react-hook-form');
50
50
  var ToggleGroupPrimitive = require('@radix-ui/react-toggle-group');
51
51
  var TogglePrimitive = require('@radix-ui/react-toggle');
52
+ var slugify = require('@sindresorhus/slugify');
52
53
  var Image2 = require('next/image');
53
54
  var HoverCardPrimitive = require('@radix-ui/react-hover-card');
54
55
  var inputOtp = require('input-otp');
@@ -58,7 +59,6 @@ var ProgressPrimitive = require('@radix-ui/react-progress');
58
59
  var tailwindVariants = require('tailwind-variants');
59
60
  var ResizablePrimitive = require('react-resizable-panels');
60
61
  var SliderPrimitive = require('@radix-ui/react-slider');
61
- var slugify = require('@sindresorhus/slugify');
62
62
  var zustand = require('zustand');
63
63
  var middleware = require('zustand/middleware');
64
64
 
@@ -7406,7 +7406,7 @@ function Breadcrumbs({
7406
7406
  return "";
7407
7407
  }
7408
7408
  if (transformLabel) {
7409
- return segment.replace(/-/g, " ").replace(/_/g, " ").split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
7409
+ return segment.replace(/[-_]/g, " ").toLowerCase().replace(/^\w/, (c) => c.toUpperCase());
7410
7410
  }
7411
7411
  return segment;
7412
7412
  };
@@ -17465,16 +17465,36 @@ function FormatToggle({ format, setFormat }) {
17465
17465
 
17466
17466
  // package.json
17467
17467
  var package_default = {
17468
- version: "1.70.0"};
17468
+ version: "1.72.4"};
17469
+ function isReactElement(child) {
17470
+ return typeof child === "object" && child !== null && "props" in child;
17471
+ }
17472
+ function textFromChildren(node) {
17473
+ let out = "";
17474
+ React5.Children.forEach(node, (child) => {
17475
+ if (typeof child === "string" || typeof child === "number") {
17476
+ out += String(child);
17477
+ } else if (isReactElement(child) && child.props && typeof child.props === "object" && "children" in child.props) {
17478
+ out += textFromChildren(child.props.children);
17479
+ }
17480
+ });
17481
+ return out.trim();
17482
+ }
17469
17483
  function Heading({
17470
17484
  className,
17471
17485
  trim = "normal",
17486
+ id: id3,
17472
17487
  size = 1,
17473
17488
  level = 1,
17474
17489
  display = false,
17490
+ children,
17475
17491
  ...props
17476
17492
  }) {
17477
17493
  const Element2 = `h${level}`;
17494
+ const slugify$1 = slugify.slugifyWithCounter();
17495
+ const computedId = id3 ?? slugify$1(textFromChildren(children));
17496
+ if (typeof window === "undefined") console.log("SSR id:", id3);
17497
+ else console.log("Client id:", id3);
17478
17498
  const headingSizeClasses = {
17479
17499
  1: "text-[calc(var(--heading-font-size-1)_*_var(--heading-font-size-adjust))] leading-[var(--line-height-52)] tracking-[calc(var(--heading-letter-spacing-2)_+_var(--heading-letter-spacing))]",
17480
17500
  2: "text-[calc(var(--heading-font-size-2)_*_var(--heading-font-size-adjust))] leading-[var(--line-height-44)] tracking-[calc(var(--heading-letter-spacing-2)_+_var(--heading-letter-spacing))]",
@@ -17510,6 +17530,7 @@ function Heading({
17510
17530
  Element2,
17511
17531
  {
17512
17532
  ...props,
17533
+ id: computedId,
17513
17534
  className: clsx12__default.default(
17514
17535
  className,
17515
17536
  trimClasses[trim],
@@ -17518,7 +17539,8 @@ function Heading({
17518
17539
  "[--leading-trim-end:var(--heading-leading-trim-end)] [--leading-trim-start:var(--heading-leading-trim-start)]",
17519
17540
  "text-primary-800 dark:text-white",
17520
17541
  sizeClass
17521
- )
17542
+ ),
17543
+ children
17522
17544
  }
17523
17545
  );
17524
17546
  }
@@ -29909,12 +29931,24 @@ function useActiveSectionObserver(tableOfContents) {
29909
29931
  return currentSection;
29910
29932
  }
29911
29933
  function TableOfContents({ tableOfContents }) {
29912
- const currentSection = useActiveSectionObserver(tableOfContents);
29913
- function isActive(section) {
29914
- if (section.id === currentSection) return true;
29915
- return section.children?.some(isActive) ?? false;
29916
- }
29917
- return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-labelledby": "on-this-page-title", className: "w-56", children: tableOfContents.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
29934
+ const [mounted, setMounted] = React5.useState(false);
29935
+ React5.useEffect(() => setMounted(true), []);
29936
+ const currentSection = useActiveSectionObserver(mounted ? tableOfContents : []);
29937
+ const isActive = React5.useMemo(() => {
29938
+ const check = (section) => {
29939
+ if (section.id === currentSection) return true;
29940
+ return section.children?.some(check) ?? false;
29941
+ };
29942
+ return check;
29943
+ }, [currentSection]);
29944
+ return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-labelledby": "on-this-page-title", className: "w-56", suppressHydrationWarning: true, children: !mounted ? (
29945
+ // lightweight placeholder to avoid layout shift (optional)
29946
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { "aria-hidden": true, className: "mt-3 space-y-2", children: [
29947
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-40 animate-pulse rounded bg-black/10 dark:bg-white/10" }),
29948
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3 w-32 animate-pulse rounded bg-black/10 dark:bg-white/10" }),
29949
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3 w-48 animate-pulse rounded bg-black/10 dark:bg-white/10" })
29950
+ ] })
29951
+ ) : tableOfContents.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
29918
29952
  /* @__PURE__ */ jsxRuntime.jsx(
29919
29953
  "h2",
29920
29954
  {
@@ -29937,6 +29971,7 @@ function TableOfContents({ tableOfContents }) {
29937
29971
  Link12__default.default,
29938
29972
  {
29939
29973
  href: `#${section.id}`,
29974
+ prefetch: false,
29940
29975
  className: clsx12__default.default(
29941
29976
  "-ml-px inline-block border-l pl-4",
29942
29977
  "hover:border-primary-800 dark:hover:border-white",
@@ -29949,6 +29984,7 @@ function TableOfContents({ tableOfContents }) {
29949
29984
  Link12__default.default,
29950
29985
  {
29951
29986
  href: `#${subSection.id}`,
29987
+ prefetch: false,
29952
29988
  className: clsx12__default.default(
29953
29989
  "-ml-px inline-block border-l pl-8",
29954
29990
  "hover:border-primary-800 dark:hover:border-white",
@@ -29960,7 +29996,7 @@ function TableOfContents({ tableOfContents }) {
29960
29996
  ] }, section.id))
29961
29997
  }
29962
29998
  )
29963
- ] }) });
29999
+ ] }) : null });
29964
30000
  }
29965
30001
  function getSubtree(options, content) {
29966
30002
  const { asChild, children } = options;