@nswds/app 1.92.0 → 1.93.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
@@ -9718,6 +9718,11 @@
9718
9718
  }
9719
9719
  }
9720
9720
  }
9721
+ .dark\:bg-grey-600 {
9722
+ &:where([data-theme=dark], [data-theme=dark] *) {
9723
+ background-color: var(--color-grey-600);
9724
+ }
9725
+ }
9721
9726
  .dark\:bg-grey-700 {
9722
9727
  &:where([data-theme=dark], [data-theme=dark] *) {
9723
9728
  background-color: var(--color-grey-700);
@@ -12974,7 +12979,7 @@
12974
12979
  background-color: #111827;
12975
12980
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fillRule='evenodd'%3E%3Cg fill='%236b7280' fill-opacity='0.4'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9zm-1 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 5V0H5v5H0v1h5v94h1V6h94V5H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
12976
12981
  }
12977
- .dark code[class*='language-'], .dark pre[class*='language-'] {
12982
+ .dark code[class*='language-'], .dark pre[class*='language-'], pre.dark[class*='language-'] {
12978
12983
  --tw-text-opacity: 1;
12979
12984
  color: rgb(241 126 184 / var(--tw-text-opacity, 1));
12980
12985
  }
@@ -12982,7 +12987,7 @@
12982
12987
  --tw-bg-opacity: 1;
12983
12988
  background-color: rgb(55 65 81 / var(--tw-bg-opacity, 1));
12984
12989
  }
12985
- .dark .code-preview-wrapper + .code-syntax-wrapper > .code-syntax > .relative > [data-code-wrapper] > .highlight > pre[class*='language-'], .dark .highlight pre[class*='language-'], .dark :not(pre) > code[class*='language-'], .dark pre[class*='language-'] {
12990
+ .dark .code-preview-wrapper + .code-syntax-wrapper > .code-syntax > .relative > [data-code-wrapper] > .highlight > pre[class*='language-'], .dark .highlight pre[class*='language-'], .dark :not(pre) > code[class*='language-'], .dark pre[class*='language-'], pre.dark[class*='language-'] {
12986
12991
  --tw-bg-opacity: 1;
12987
12992
  background-color: rgb(31 41 55 / var(--tw-bg-opacity, 1));
12988
12993
  }
package/dist/index.cjs CHANGED
@@ -13602,17 +13602,27 @@ function CodeHighlight({
13602
13602
  language,
13603
13603
  className,
13604
13604
  withCopy = false,
13605
+ "data-theme": dataTheme,
13605
13606
  ...props
13606
13607
  }) {
13607
13608
  const highlightedCode = Prism__default.default.highlight(code.trim(), Prism__default.default.languages[language], language);
13608
13609
  const Component2 = withCopy ? PreWithCopy : "pre";
13609
- return /* @__PURE__ */ jsxRuntime.jsx(Component2, { className: tailwindMerge.twMerge(`language-${language}`, className), ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
13610
- "code",
13610
+ const themeClassName = dataTheme !== void 0 ? dataTheme === "dark" ? "dark" : "light" : void 0;
13611
+ return /* @__PURE__ */ jsxRuntime.jsx(
13612
+ Component2,
13611
13613
  {
13612
- className: `language-${language}`,
13613
- dangerouslySetInnerHTML: { __html: highlightedCode }
13614
+ className: tailwindMerge.twMerge(`language-${language}`, themeClassName, className),
13615
+ "data-theme": dataTheme,
13616
+ ...props,
13617
+ children: /* @__PURE__ */ jsxRuntime.jsx(
13618
+ "code",
13619
+ {
13620
+ className: `language-${language}`,
13621
+ dangerouslySetInnerHTML: { __html: highlightedCode }
13622
+ }
13623
+ )
13614
13624
  }
13615
- ) });
13625
+ );
13616
13626
  }
13617
13627
  function Popover({ ...props }) {
13618
13628
  return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Root, { "data-slot": "popover", ...props });
@@ -14286,18 +14296,18 @@ function TooltipContent({
14286
14296
  function CodeDemoLoading() {
14287
14297
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-8 animate-pulse", children: [
14288
14298
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full rounded-t-xl border border-grey-200 bg-grey-50 p-4 dark:border-grey-600 dark:bg-grey-700", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 sm:grid-cols-3", children: [
14289
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-10 w-32 rounded bg-grey-200" }),
14290
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-10 w-32 rounded bg-grey-200" }),
14299
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-10 w-32 rounded bg-grey-200 dark:bg-grey-600" }),
14300
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-10 w-32 rounded bg-grey-200 dark:bg-grey-600" }),
14291
14301
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-3", children: [
14292
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-10 w-20 rounded bg-grey-200" }),
14293
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-10 w-16 rounded bg-grey-200" }),
14294
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-10 w-10 rounded bg-grey-200" })
14302
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-10 w-20 rounded bg-grey-200 dark:bg-grey-600" }),
14303
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-10 w-16 rounded bg-grey-200 dark:bg-grey-600" }),
14304
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-10 w-10 rounded bg-grey-200 dark:bg-grey-600" })
14295
14305
  ] })
14296
14306
  ] }) }),
14297
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex border-x border-grey-200 bg-white bg-gradient-to-r p-5 dark:border-grey-600 dark:bg-grey-900", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-64 w-full rounded bg-grey-200" }) }),
14307
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex border-x border-grey-200 bg-white bg-gradient-to-r p-5 dark:border-grey-600 dark:bg-grey-900", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-64 w-full rounded bg-grey-200 dark:bg-grey-600" }) }),
14298
14308
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border border-grey-200 dark:border-grey-600", children: [
14299
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full rounded-t-md border-b border-grey-200 bg-grey-50 p-2 dark:border-grey-600 dark:bg-grey-700", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-8 w-24 rounded bg-grey-200" }) }),
14300
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-48 bg-grey-100" })
14309
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full rounded-t-md border-b border-grey-200 bg-grey-50 p-2 dark:border-grey-600 dark:bg-grey-700", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-8 w-24 rounded bg-grey-200 dark:bg-grey-600" }) }),
14310
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-48 bg-grey-100 dark:bg-grey-800" })
14301
14311
  ] })
14302
14312
  ] });
14303
14313
  }
@@ -14453,6 +14463,7 @@ function CodeDemoContent({ data, showCode = true, controls = defaultControls })
14453
14463
  const codeItems = getCodeItems(code);
14454
14464
  const current = getCurrent(codeItems, tabIndex);
14455
14465
  const shouldExpand = getShouldExpand(current.code.trim());
14466
+ const codeTheme = isDarkMode === null ? void 0 : isDarkMode ? "dark" : "light";
14456
14467
  const variantLabels = React5__namespace.default.useMemo(() => {
14457
14468
  const explicit = data.labels ?? {};
14458
14469
  return Object.fromEntries(variants.map((v) => [v, explicit[v] ?? humaniseVariant(v)]));
@@ -14561,7 +14572,8 @@ function CodeDemoContent({ data, showCode = true, controls = defaultControls })
14561
14572
  {
14562
14573
  className: "!mb-0 !rounded-none",
14563
14574
  code: current.code,
14564
- language: current.language
14575
+ language: current.language,
14576
+ "data-theme": codeTheme
14565
14577
  }
14566
14578
  )
14567
14579
  }
@@ -14584,12 +14596,21 @@ function CodeDemo(props) {
14584
14596
  var IFrame = React5__namespace.default.forwardRef(
14585
14597
  ({ iframe, isRTL, isDarkMode }, ref) => {
14586
14598
  React5.useEffect(() => {
14587
- const document2 = ref?.current?.contentDocument;
14588
- const root = document2?.documentElement;
14589
- if (document2 && root) {
14599
+ const frame2 = ref?.current;
14600
+ if (!frame2) return;
14601
+ const applyFrameSettings = () => {
14602
+ const document2 = frame2.contentDocument;
14603
+ const root = document2?.documentElement;
14604
+ if (!document2 || !root) return;
14590
14605
  root.setAttribute("dir", isRTL ? "rtl" : "ltr");
14591
- root.classList.toggle("dark", !!isDarkMode);
14592
- }
14606
+ if (isDarkMode !== null) {
14607
+ root.setAttribute("data-theme", isDarkMode ? "dark" : "light");
14608
+ root.classList.toggle("dark", !!isDarkMode);
14609
+ }
14610
+ };
14611
+ applyFrameSettings();
14612
+ frame2.addEventListener("load", applyFrameSettings);
14613
+ return () => frame2.removeEventListener("load", applyFrameSettings);
14593
14614
  }, [isRTL, isDarkMode, ref]);
14594
14615
  if (typeof iframe === "number") {
14595
14616
  return /* @__PURE__ */ jsxRuntime.jsx("iframe", { ref, src: "", height: iframe, width: "100%", className: "w-full" });
@@ -14646,9 +14667,9 @@ function CodePreview({
14646
14667
  {
14647
14668
  className: tailwindMerge.twMerge(
14648
14669
  "code-responsive-wrapper w-full",
14649
- isDarkMode !== null && (isDarkMode ? "dark" : "light")
14670
+ isDarkMode !== null ? isDarkMode ? "dark" : "light" : void 0
14650
14671
  ),
14651
- "data-theme": isDarkMode !== null && (isDarkMode ? "dark" : "light"),
14672
+ "data-theme": isDarkMode !== null ? isDarkMode ? "dark" : "light" : void 0,
14652
14673
  children: /* @__PURE__ */ jsxRuntime.jsx(
14653
14674
  "div",
14654
14675
  {
@@ -17572,7 +17593,7 @@ function FormatToggle({ format, setFormat }) {
17572
17593
 
17573
17594
  // package.json
17574
17595
  var package_default = {
17575
- version: "1.91.0"};
17596
+ version: "1.92.0"};
17576
17597
  var SluggerContext = React5__namespace.default.createContext(null);
17577
17598
  function flattenText(nodes) {
17578
17599
  if (nodes == null || typeof nodes === "boolean") return "";