@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 +6 -0
- package/dist/index.cjs +47 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +48 -12
- package/dist/index.js.map +1 -1
- package/dist/styles.css +6 -0
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1204,7 +1204,9 @@ type HeadingProps = ({
|
|
|
1204
1204
|
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
1205
1205
|
trim?: 'normal' | 'start' | 'end' | 'both';
|
|
1206
1206
|
} & BaseProps$1);
|
|
1207
|
-
declare function Heading({ className, trim, size, level, display, ...props }: HeadingProps
|
|
1207
|
+
declare function Heading({ className, trim, id, size, level, display, children, ...props }: HeadingProps & {
|
|
1208
|
+
id?: string;
|
|
1209
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1208
1210
|
|
|
1209
1211
|
declare const heroBannerVariants: (props?: ({
|
|
1210
1212
|
variant?: "white" | "primary-800" | "grey-150" | "accent-800" | "primary-200" | null | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1204,7 +1204,9 @@ type HeadingProps = ({
|
|
|
1204
1204
|
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
1205
1205
|
trim?: 'normal' | 'start' | 'end' | 'both';
|
|
1206
1206
|
} & BaseProps$1);
|
|
1207
|
-
declare function Heading({ className, trim, size, level, display, ...props }: HeadingProps
|
|
1207
|
+
declare function Heading({ className, trim, id, size, level, display, children, ...props }: HeadingProps & {
|
|
1208
|
+
id?: string;
|
|
1209
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1208
1210
|
|
|
1209
1211
|
declare const heroBannerVariants: (props?: ({
|
|
1210
1212
|
variant?: "white" | "primary-800" | "grey-150" | "accent-800" | "primary-200" | null | undefined;
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { twMerge } from 'tailwind-merge';
|
|
|
5
5
|
import { cva } from 'class-variance-authority';
|
|
6
6
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
7
7
|
import * as React5 from 'react';
|
|
8
|
-
import React5__default, { forwardRef, useEffect, createContext, useState, useContext, useMemo, useRef, useInsertionEffect, useLayoutEffect, Fragment as Fragment$1, createElement, useCallback, Suspense, useId, Component } from 'react';
|
|
8
|
+
import React5__default, { forwardRef, useEffect, createContext, useState, useContext, useMemo, useRef, useInsertionEffect, useLayoutEffect, Fragment as Fragment$1, createElement, useCallback, Suspense, useId, Children, Component } from 'react';
|
|
9
9
|
import * as Headless4 from '@headlessui/react';
|
|
10
10
|
import { PopoverGroup, Popover as Popover$1, PopoverButton, PopoverPanel, Dialog as Dialog$1, DialogPanel } from '@headlessui/react';
|
|
11
11
|
import Link12 from 'next/link';
|
|
@@ -51,6 +51,7 @@ import { Drawer as Drawer$1 } from 'vaul';
|
|
|
51
51
|
import { FormProvider, Controller, useFormContext, useFormState } from 'react-hook-form';
|
|
52
52
|
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
|
53
53
|
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
54
|
+
import { slugifyWithCounter } from '@sindresorhus/slugify';
|
|
54
55
|
import Image2 from 'next/image';
|
|
55
56
|
import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
|
|
56
57
|
import { OTPInput, OTPInputContext } from 'input-otp';
|
|
@@ -60,7 +61,6 @@ import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
|
60
61
|
import { tv } from 'tailwind-variants';
|
|
61
62
|
import * as ResizablePrimitive from 'react-resizable-panels';
|
|
62
63
|
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
63
|
-
import { slugifyWithCounter } from '@sindresorhus/slugify';
|
|
64
64
|
import { create } from 'zustand';
|
|
65
65
|
import { persist, createJSONStorage } from 'zustand/middleware';
|
|
66
66
|
|
|
@@ -7353,7 +7353,7 @@ function Breadcrumbs({
|
|
|
7353
7353
|
return "";
|
|
7354
7354
|
}
|
|
7355
7355
|
if (transformLabel) {
|
|
7356
|
-
return segment.replace(
|
|
7356
|
+
return segment.replace(/[-_]/g, " ").toLowerCase().replace(/^\w/, (c) => c.toUpperCase());
|
|
7357
7357
|
}
|
|
7358
7358
|
return segment;
|
|
7359
7359
|
};
|
|
@@ -17412,16 +17412,36 @@ function FormatToggle({ format, setFormat }) {
|
|
|
17412
17412
|
|
|
17413
17413
|
// package.json
|
|
17414
17414
|
var package_default = {
|
|
17415
|
-
version: "1.
|
|
17415
|
+
version: "1.72.4"};
|
|
17416
|
+
function isReactElement(child) {
|
|
17417
|
+
return typeof child === "object" && child !== null && "props" in child;
|
|
17418
|
+
}
|
|
17419
|
+
function textFromChildren(node) {
|
|
17420
|
+
let out = "";
|
|
17421
|
+
Children.forEach(node, (child) => {
|
|
17422
|
+
if (typeof child === "string" || typeof child === "number") {
|
|
17423
|
+
out += String(child);
|
|
17424
|
+
} else if (isReactElement(child) && child.props && typeof child.props === "object" && "children" in child.props) {
|
|
17425
|
+
out += textFromChildren(child.props.children);
|
|
17426
|
+
}
|
|
17427
|
+
});
|
|
17428
|
+
return out.trim();
|
|
17429
|
+
}
|
|
17416
17430
|
function Heading({
|
|
17417
17431
|
className,
|
|
17418
17432
|
trim = "normal",
|
|
17433
|
+
id: id3,
|
|
17419
17434
|
size = 1,
|
|
17420
17435
|
level = 1,
|
|
17421
17436
|
display = false,
|
|
17437
|
+
children,
|
|
17422
17438
|
...props
|
|
17423
17439
|
}) {
|
|
17424
17440
|
const Element2 = `h${level}`;
|
|
17441
|
+
const slugify = slugifyWithCounter();
|
|
17442
|
+
const computedId = id3 ?? slugify(textFromChildren(children));
|
|
17443
|
+
if (typeof window === "undefined") console.log("SSR id:", id3);
|
|
17444
|
+
else console.log("Client id:", id3);
|
|
17425
17445
|
const headingSizeClasses = {
|
|
17426
17446
|
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))]",
|
|
17427
17447
|
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))]",
|
|
@@ -17457,6 +17477,7 @@ function Heading({
|
|
|
17457
17477
|
Element2,
|
|
17458
17478
|
{
|
|
17459
17479
|
...props,
|
|
17480
|
+
id: computedId,
|
|
17460
17481
|
className: clsx12(
|
|
17461
17482
|
className,
|
|
17462
17483
|
trimClasses[trim],
|
|
@@ -17465,7 +17486,8 @@ function Heading({
|
|
|
17465
17486
|
"[--leading-trim-end:var(--heading-leading-trim-end)] [--leading-trim-start:var(--heading-leading-trim-start)]",
|
|
17466
17487
|
"text-primary-800 dark:text-white",
|
|
17467
17488
|
sizeClass
|
|
17468
|
-
)
|
|
17489
|
+
),
|
|
17490
|
+
children
|
|
17469
17491
|
}
|
|
17470
17492
|
);
|
|
17471
17493
|
}
|
|
@@ -29856,12 +29878,24 @@ function useActiveSectionObserver(tableOfContents) {
|
|
|
29856
29878
|
return currentSection;
|
|
29857
29879
|
}
|
|
29858
29880
|
function TableOfContents({ tableOfContents }) {
|
|
29859
|
-
const
|
|
29860
|
-
|
|
29861
|
-
|
|
29862
|
-
|
|
29863
|
-
|
|
29864
|
-
|
|
29881
|
+
const [mounted, setMounted] = useState(false);
|
|
29882
|
+
useEffect(() => setMounted(true), []);
|
|
29883
|
+
const currentSection = useActiveSectionObserver(mounted ? tableOfContents : []);
|
|
29884
|
+
const isActive = useMemo(() => {
|
|
29885
|
+
const check = (section) => {
|
|
29886
|
+
if (section.id === currentSection) return true;
|
|
29887
|
+
return section.children?.some(check) ?? false;
|
|
29888
|
+
};
|
|
29889
|
+
return check;
|
|
29890
|
+
}, [currentSection]);
|
|
29891
|
+
return /* @__PURE__ */ jsx("nav", { "aria-labelledby": "on-this-page-title", className: "w-56", suppressHydrationWarning: true, children: !mounted ? (
|
|
29892
|
+
// lightweight placeholder to avoid layout shift (optional)
|
|
29893
|
+
/* @__PURE__ */ jsxs("div", { "aria-hidden": true, className: "mt-3 space-y-2", children: [
|
|
29894
|
+
/* @__PURE__ */ jsx("div", { className: "h-4 w-40 animate-pulse rounded bg-black/10 dark:bg-white/10" }),
|
|
29895
|
+
/* @__PURE__ */ jsx("div", { className: "h-3 w-32 animate-pulse rounded bg-black/10 dark:bg-white/10" }),
|
|
29896
|
+
/* @__PURE__ */ jsx("div", { className: "h-3 w-48 animate-pulse rounded bg-black/10 dark:bg-white/10" })
|
|
29897
|
+
] })
|
|
29898
|
+
) : tableOfContents.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
29865
29899
|
/* @__PURE__ */ jsx(
|
|
29866
29900
|
"h2",
|
|
29867
29901
|
{
|
|
@@ -29884,6 +29918,7 @@ function TableOfContents({ tableOfContents }) {
|
|
|
29884
29918
|
Link12,
|
|
29885
29919
|
{
|
|
29886
29920
|
href: `#${section.id}`,
|
|
29921
|
+
prefetch: false,
|
|
29887
29922
|
className: clsx12(
|
|
29888
29923
|
"-ml-px inline-block border-l pl-4",
|
|
29889
29924
|
"hover:border-primary-800 dark:hover:border-white",
|
|
@@ -29896,6 +29931,7 @@ function TableOfContents({ tableOfContents }) {
|
|
|
29896
29931
|
Link12,
|
|
29897
29932
|
{
|
|
29898
29933
|
href: `#${subSection.id}`,
|
|
29934
|
+
prefetch: false,
|
|
29899
29935
|
className: clsx12(
|
|
29900
29936
|
"-ml-px inline-block border-l pl-8",
|
|
29901
29937
|
"hover:border-primary-800 dark:hover:border-white",
|
|
@@ -29907,7 +29943,7 @@ function TableOfContents({ tableOfContents }) {
|
|
|
29907
29943
|
] }, section.id))
|
|
29908
29944
|
}
|
|
29909
29945
|
)
|
|
29910
|
-
] }) });
|
|
29946
|
+
] }) : null });
|
|
29911
29947
|
}
|
|
29912
29948
|
function getSubtree(options, content) {
|
|
29913
29949
|
const { asChild, children } = options;
|