@nswds/app 1.76.1 → 1.77.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/index.d.cts CHANGED
@@ -589,7 +589,7 @@ interface IFrameOptions {
589
589
  }
590
590
  interface BaseCodeData<T extends 'single' | 'variant'> {
591
591
  type: T;
592
- githubSlug: string;
592
+ githubSlug?: string;
593
593
  figmaSlug?: string;
594
594
  component: React.ReactNode;
595
595
  }
@@ -618,6 +618,9 @@ interface CodeDemoProps {
618
618
  rtl?: boolean;
619
619
  darkMode?: boolean;
620
620
  themeSelector?: boolean;
621
+ displayCode?: boolean;
622
+ viewToggle?: boolean;
623
+ copyButton?: boolean;
621
624
  };
622
625
  }
623
626
  interface CodeHighlightProps extends React.ComponentProps<'pre'> {
package/dist/index.d.ts CHANGED
@@ -589,7 +589,7 @@ interface IFrameOptions {
589
589
  }
590
590
  interface BaseCodeData<T extends 'single' | 'variant'> {
591
591
  type: T;
592
- githubSlug: string;
592
+ githubSlug?: string;
593
593
  figmaSlug?: string;
594
594
  component: React.ReactNode;
595
595
  }
@@ -618,6 +618,9 @@ interface CodeDemoProps {
618
618
  rtl?: boolean;
619
619
  darkMode?: boolean;
620
620
  themeSelector?: boolean;
621
+ displayCode?: boolean;
622
+ viewToggle?: boolean;
623
+ copyButton?: boolean;
621
624
  };
622
625
  }
623
626
  interface CodeHighlightProps extends React.ComponentProps<'pre'> {
package/dist/index.js CHANGED
@@ -14176,7 +14176,14 @@ function CodeDemoLoading() {
14176
14176
  function CodeDemoContent({ data, hide = {} }) {
14177
14177
  const { resolvedTheme } = useTheme();
14178
14178
  const searchParams = useSearchParams();
14179
- const { rtl = false, darkMode = false, themeSelector = false } = hide;
14179
+ const {
14180
+ rtl = false,
14181
+ darkMode = false,
14182
+ themeSelector = false,
14183
+ displayCode = true,
14184
+ viewToggle = true,
14185
+ copyButton = true
14186
+ } = hide;
14180
14187
  const [tabIndex, setTabIndex] = useState(0);
14181
14188
  const [variant, setVariant] = useState(getInitialVariant(data));
14182
14189
  const [view, setView] = useState("desktop");
@@ -14346,9 +14353,9 @@ function CodeDemoContent({ data, hide = {} }) {
14346
14353
  }, [themeCategory, primaryColor, accentColor, greyColor, isThemeInitialized]);
14347
14354
  return /* @__PURE__ */ jsxs("div", { className: "mt-8", children: [
14348
14355
  /* @__PURE__ */ 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__ */ jsxs("div", { className: "grid grid-cols-2 sm:grid-cols-3", children: [
14349
- /* @__PURE__ */ jsx(EditOnGithubButton, { githubSlug: data.githubSlug }),
14356
+ data.githubSlug && /* @__PURE__ */ jsx(EditOnGithubButton, { githubSlug: data.githubSlug }),
14350
14357
  data.figmaSlug && /* @__PURE__ */ jsx(OpenInFigmaButton, { figmaSlug: data.figmaSlug }),
14351
- /* @__PURE__ */ jsx(ToggleViewButtons, { onSelect: setView }),
14358
+ viewToggle && /* @__PURE__ */ jsx(ToggleViewButtons, { onSelect: setView }),
14352
14359
  /* @__PURE__ */ jsxs("div", { className: "col-span-1 flex justify-end gap-3", children: [
14353
14360
  !themeSelector && /* @__PURE__ */ jsx(
14354
14361
  ThemeSelectorDropDown,
@@ -14394,7 +14401,7 @@ function CodeDemoContent({ data, hide = {} }) {
14394
14401
  ) : /* @__PURE__ */ jsx(Fragment, { children: data.component })
14395
14402
  }
14396
14403
  ),
14397
- /* @__PURE__ */ jsx("div", { className: "code-syntax-wrapper", children: /* @__PURE__ */ jsxs(
14404
+ displayCode && /* @__PURE__ */ jsx("div", { className: "code-syntax-wrapper", children: /* @__PURE__ */ jsxs(
14398
14405
  "div",
14399
14406
  {
14400
14407
  className: twMerge(
@@ -14408,7 +14415,7 @@ function CodeDemoContent({ data, hide = {} }) {
14408
14415
  /* @__PURE__ */ jsx(SelectTrigger, { size: "sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select a variant" }) }),
14409
14416
  /* @__PURE__ */ jsx(SelectContent, { children: variants.map((v) => /* @__PURE__ */ jsx(SelectItem, { value: v, children: variantLabels[v] }, v)) })
14410
14417
  ] }),
14411
- /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(
14418
+ /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: copyButton && /* @__PURE__ */ jsx(
14412
14419
  CopyToClipboardButton,
14413
14420
  {
14414
14421
  isJustCopied,
@@ -14416,14 +14423,20 @@ function CodeDemoContent({ data, hide = {} }) {
14416
14423
  }
14417
14424
  ) })
14418
14425
  ] }),
14419
- /* @__PURE__ */ jsx("div", { className: twMerge("!overflow-y-hidden", shouldExpand && !isExpanded && "max-h-72"), children: /* @__PURE__ */ jsx(
14420
- CodeHighlight,
14426
+ /* @__PURE__ */ jsx(
14427
+ "div",
14421
14428
  {
14422
- className: "!mb-0 !rounded-none",
14423
- code: current.code,
14424
- language: current.language
14429
+ className: twMerge("!overflow-y-hidden", shouldExpand && !isExpanded && "max-h-72"),
14430
+ children: /* @__PURE__ */ jsx(
14431
+ CodeHighlight,
14432
+ {
14433
+ className: "!mb-0 !rounded-none",
14434
+ code: current.code,
14435
+ language: current.language
14436
+ }
14437
+ )
14425
14438
  }
14426
- ) }),
14439
+ ),
14427
14440
  shouldExpand && /* @__PURE__ */ jsx(
14428
14441
  CollapseExpandButton,
14429
14442
  {
@@ -17412,7 +17425,7 @@ function FormatToggle({ format, setFormat }) {
17412
17425
 
17413
17426
  // package.json
17414
17427
  var package_default = {
17415
- version: "1.75.0"};
17428
+ version: "1.76.0"};
17416
17429
  var SluggerContext = React5__default.createContext(null);
17417
17430
  function flattenText(nodes) {
17418
17431
  if (nodes == null || typeof nodes === "boolean") return "";