@nswds/app 1.21.2 → 1.22.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.cjs CHANGED
@@ -8,7 +8,7 @@ var classVarianceAuthority = require('class-variance-authority');
8
8
  var AspectRatioPrimitive = require('@radix-ui/react-aspect-ratio');
9
9
  var AvatarPrimitive = require('@radix-ui/react-avatar');
10
10
  var Headless = require('@headlessui/react');
11
- var React5 = require('react');
11
+ var React6 = require('react');
12
12
  var Link3 = require('next/link');
13
13
  var culori = require('culori');
14
14
  var reactSlot = require('@radix-ui/react-slot');
@@ -74,7 +74,7 @@ var clsx11__default = /*#__PURE__*/_interopDefault(clsx11);
74
74
  var AspectRatioPrimitive__namespace = /*#__PURE__*/_interopNamespace(AspectRatioPrimitive);
75
75
  var AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespace(AvatarPrimitive);
76
76
  var Headless__namespace = /*#__PURE__*/_interopNamespace(Headless);
77
- var React5__namespace = /*#__PURE__*/_interopNamespace(React5);
77
+ var React6__namespace = /*#__PURE__*/_interopNamespace(React6);
78
78
  var Link3__default = /*#__PURE__*/_interopDefault(Link3);
79
79
  var culori__namespace = /*#__PURE__*/_interopNamespace(culori);
80
80
  var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
@@ -367,7 +367,7 @@ function AvatarFallback({
367
367
  }
368
368
  );
369
369
  }
370
- var Link = React5.forwardRef(function Link2(props, ref) {
370
+ var Link = React6.forwardRef(function Link2(props, ref) {
371
371
  return /* @__PURE__ */ jsxRuntime.jsx(Headless__namespace.DataInteractive, { children: /* @__PURE__ */ jsxRuntime.jsx(Link3__default.default, { ...props, ref }) });
372
372
  });
373
373
  var styles = {
@@ -679,7 +679,7 @@ var buttonVariants = classVarianceAuthority.cva(styles.base, {
679
679
  size: "default"
680
680
  }
681
681
  });
682
- var Button2 = React5.forwardRef(function Button3({ className, variant, color, size, children, ...props }, ref) {
682
+ var Button2 = React6.forwardRef(function Button3({ className, variant, color, size, children, ...props }, ref) {
683
683
  const classes = cn(buttonVariants({ variant, color, size }), className);
684
684
  return "href" in props ? /* @__PURE__ */ jsxRuntime.jsx(
685
685
  Link,
@@ -1152,7 +1152,7 @@ function Badge({
1152
1152
  }
1153
1153
  );
1154
1154
  }
1155
- var BadgeButton = React5.forwardRef(function BadgeButton2({
1155
+ var BadgeButton = React6.forwardRef(function BadgeButton2({
1156
1156
  variant,
1157
1157
  color,
1158
1158
  size,
@@ -1861,7 +1861,7 @@ function Breadcrumbs({
1861
1861
  });
1862
1862
  const shouldCollapse = breadcrumbItems.length > maxItems;
1863
1863
  if (!shouldCollapse) {
1864
- return /* @__PURE__ */ jsxRuntime.jsx(Breadcrumb, { className: "-ml-1", children: /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbList, { children: breadcrumbItems.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(React5__namespace.Fragment, { children: [
1864
+ return /* @__PURE__ */ jsxRuntime.jsx(Breadcrumb, { className: "-ml-1", children: /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbList, { children: breadcrumbItems.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(React6__namespace.Fragment, { children: [
1865
1865
  /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbItem, { children: item.isCurrent ? /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbPage, { children: item.label }) : /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbLink, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Link3__default.default, { href: item.path, children: item.label }) }) }),
1866
1866
  index < breadcrumbItems.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbSeparator, {})
1867
1867
  ] }, item.path)) }) });
@@ -1872,7 +1872,7 @@ function Breadcrumbs({
1872
1872
  const itemsAtEnd = breadcrumbItems.slice(-endItems);
1873
1873
  const collapsedItems = breadcrumbItems.slice(startItems, breadcrumbItems.length - endItems);
1874
1874
  return /* @__PURE__ */ jsxRuntime.jsx(Breadcrumb, { children: /* @__PURE__ */ jsxRuntime.jsxs(BreadcrumbList, { children: [
1875
- itemsAtStart.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(React5__namespace.Fragment, { children: [
1875
+ itemsAtStart.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(React6__namespace.Fragment, { children: [
1876
1876
  /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbItem, { children: item.isCurrent ? /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbPage, { children: item.label }) : /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbLink, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Link3__default.default, { href: item.path, children: item.label }) }) }),
1877
1877
  index < itemsAtStart.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbSeparator, {})
1878
1878
  ] }, item.path)),
@@ -1885,7 +1885,7 @@ function Breadcrumbs({
1885
1885
  /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuContent, { align: "start", children: collapsedItems.map((item) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Link3__default.default, { href: item.path, children: item.label }) }, item.path)) })
1886
1886
  ] }) }),
1887
1887
  itemsAtEnd.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbSeparator, {}),
1888
- itemsAtEnd.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(React5__namespace.Fragment, { children: [
1888
+ itemsAtEnd.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(React6__namespace.Fragment, { children: [
1889
1889
  /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbItem, { children: item.isCurrent ? /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbPage, { children: item.label }) : /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbLink, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Link3__default.default, { href: item.path, children: item.label }) }) }),
1890
1890
  index < itemsAtEnd.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbSeparator, {})
1891
1891
  ] }, item.path))
@@ -2060,8 +2060,8 @@ function TooltipContent({
2060
2060
  ) });
2061
2061
  }
2062
2062
  function PreWithCopy(props) {
2063
- const textInput = React5.useRef(null);
2064
- const [isJustCopied, setJustCopied] = React5.useState(false);
2063
+ const textInput = React6.useRef(null);
2064
+ const [isJustCopied, setJustCopied] = React6.useState(false);
2065
2065
  function handleCopy() {
2066
2066
  if (textInput.current) {
2067
2067
  navigator.clipboard.writeText(textInput.current.textContent || "");
@@ -5941,21 +5941,46 @@ var colors = {
5941
5941
  }
5942
5942
  };
5943
5943
  var colorThemes = generateColorThemes(colors);
5944
- function CodeDemo({ data }) {
5944
+ function CodeDemo({ data, hide = {} }) {
5945
5945
  const { resolvedTheme } = nextThemes.useTheme();
5946
- const [tabIndex, setTabIndex] = React5.useState(0);
5947
- const [variant, setVariant] = React5.useState(getInitialVariant(data));
5948
- const [view, setView] = React5.useState("desktop");
5949
- const [isRTL, setIsRTL] = React5.useState(false);
5950
- const [isDarkMode, setDarkMode] = React5.useState(null);
5951
- const [isExpanded, setExpanded] = React5.useState(false);
5952
- const [isJustCopied, setJustCopied] = React5.useState(false);
5953
- const [themeCategory, setThemeCategory] = React5.useState("brand");
5954
- const [primaryColor, setPrimaryColor] = React5.useState("blue");
5955
- const [accentColor, setAccentColor] = React5.useState("red");
5956
- React5.useEffect(() => {
5946
+ const { rtl = false, darkMode = false, themeSelector = false } = hide;
5947
+ const [tabIndex, setTabIndex] = React6.useState(0);
5948
+ const [variant, setVariant] = React6.useState(getInitialVariant(data));
5949
+ const [view, setView] = React6.useState("desktop");
5950
+ const [isRTL, setIsRTL] = React6.useState(false);
5951
+ const [isDarkMode, setDarkMode] = React6.useState(null);
5952
+ const [isExpanded, setExpanded] = React6.useState(false);
5953
+ const [isJustCopied, setJustCopied] = React6.useState(false);
5954
+ const [themeCategory, setThemeCategory] = React6.useState("brand");
5955
+ const [primaryColor, setPrimaryColor] = React6.useState("blue");
5956
+ const [accentColor, setAccentColor] = React6.useState("red");
5957
+ React6.useEffect(() => {
5957
5958
  setDarkMode(resolvedTheme === "dark");
5958
5959
  }, [resolvedTheme]);
5960
+ const iframeRef = React6.useRef(null);
5961
+ const getShades = (prefix, colorKey, themeCat) => colors[themeCat][colorKey].colors.reduce((acc, shade) => {
5962
+ const suffix = shade.token.split("-").pop();
5963
+ acc[`${prefix}${suffix}`] = shade.hex;
5964
+ return acc;
5965
+ }, {});
5966
+ const themeValues = React6__namespace.default.useMemo(
5967
+ () => ({
5968
+ ...getShades("primary", primaryColor, themeCategory),
5969
+ ...getShades("accent", accentColor, themeCategory)
5970
+ }),
5971
+ [themeCategory, primaryColor, accentColor]
5972
+ );
5973
+ React6__namespace.default.useEffect(() => {
5974
+ const frame = iframeRef.current;
5975
+ if (!frame) return;
5976
+ const send = () => {
5977
+ const msg = { type: "nswds-theme", payload: themeValues };
5978
+ frame.contentWindow?.postMessage(msg, "*");
5979
+ };
5980
+ send();
5981
+ frame.addEventListener("load", send);
5982
+ return () => frame.removeEventListener("load", send);
5983
+ }, [themeValues]);
5959
5984
  function copyToClipboard(value) {
5960
5985
  setJustCopied(true);
5961
5986
  navigator.clipboard.writeText(value);
@@ -6009,7 +6034,7 @@ function CodeDemo({ data }) {
6009
6034
  /* @__PURE__ */ jsxRuntime.jsx(EditOnGithubButton, { githubSlug: data.githubSlug }),
6010
6035
  /* @__PURE__ */ jsxRuntime.jsx(ToggleViewButtons, { onSelect: setView }),
6011
6036
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-1 flex justify-end gap-3", children: [
6012
- /* @__PURE__ */ jsxRuntime.jsx(
6037
+ !themeSelector && /* @__PURE__ */ jsxRuntime.jsx(
6013
6038
  ThemeSelectorDropDown,
6014
6039
  {
6015
6040
  themeCategory,
@@ -6020,8 +6045,8 @@ function CodeDemo({ data }) {
6020
6045
  setAccentColor
6021
6046
  }
6022
6047
  ),
6023
- /* @__PURE__ */ jsxRuntime.jsx(ToggleRTLButton, { isRTL, onClick: () => setIsRTL((state) => !state) }),
6024
- /* @__PURE__ */ jsxRuntime.jsx(
6048
+ !rtl && /* @__PURE__ */ jsxRuntime.jsx(ToggleRTLButton, { isRTL, onClick: () => setIsRTL((state) => !state) }),
6049
+ !darkMode && /* @__PURE__ */ jsxRuntime.jsx(
6025
6050
  ToggleDarkModeButton,
6026
6051
  {
6027
6052
  isDarkMode,
@@ -6037,10 +6062,17 @@ function CodeDemo({ data }) {
6037
6062
  isRTL,
6038
6063
  isDarkMode,
6039
6064
  iframe: data.iframe,
6040
- accentColor,
6041
- primaryColor,
6042
- themeCategory,
6043
- children: data.iframe ? /* @__PURE__ */ jsxRuntime.jsx(IFrame, { data, isRTL, isDarkMode }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: data.component })
6065
+ themeValues,
6066
+ children: data.iframe ? /* @__PURE__ */ jsxRuntime.jsx(
6067
+ IFrame,
6068
+ {
6069
+ sandbox: "allow-scripts allow-same-origin",
6070
+ ref: iframeRef,
6071
+ data,
6072
+ isRTL,
6073
+ isDarkMode
6074
+ }
6075
+ ) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: data.component })
6044
6076
  }
6045
6077
  ),
6046
6078
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "code-syntax-wrapper", children: /* @__PURE__ */ jsxRuntime.jsxs(
@@ -6085,31 +6117,29 @@ function CodeDemo({ data }) {
6085
6117
  ) })
6086
6118
  ] });
6087
6119
  }
6088
- function IFrame({
6089
- data,
6090
- isRTL,
6091
- isDarkMode
6092
- }) {
6093
- const ref = React5.useRef(null);
6094
- React5.useEffect(() => {
6095
- const document2 = ref.current?.contentDocument;
6096
- const root = document2?.documentElement;
6097
- if (document2 && root) {
6098
- root.setAttribute("dir", isRTL ? "rtl" : "ltr");
6099
- root.classList.toggle("dark", !!isDarkMode);
6100
- }
6101
- }, [isRTL, isDarkMode]);
6102
- if (typeof data.iframe === "number") {
6103
- return /* @__PURE__ */ jsxRuntime.jsx("iframe", { ref, src: "", height: data.iframe, width: "100%", className: "w-full" });
6104
- }
6105
- if (typeof data.iframe === "object" && data.iframe?.src) {
6106
- const { src, height = 0, width = 100, noPadding } = data.iframe;
6107
- const finalSrc = noPadding ? `${src}?noPadding` : src;
6108
- const finalWidth = width === 100 ? "100%" : width;
6109
- return /* @__PURE__ */ jsxRuntime.jsx("iframe", { ref, src: finalSrc, height, width: finalWidth, className: "w-full" });
6120
+ var IFrame = React6__namespace.default.forwardRef(
6121
+ ({ data, isRTL, isDarkMode }, ref) => {
6122
+ React6.useEffect(() => {
6123
+ const document2 = ref?.current?.contentDocument;
6124
+ const root = document2?.documentElement;
6125
+ if (document2 && root) {
6126
+ root.setAttribute("dir", isRTL ? "rtl" : "ltr");
6127
+ root.classList.toggle("dark", !!isDarkMode);
6128
+ }
6129
+ }, [isRTL, isDarkMode, ref]);
6130
+ if (typeof data.iframe === "number") {
6131
+ return /* @__PURE__ */ jsxRuntime.jsx("iframe", { ref, src: "", height: data.iframe, width: "100%", className: "w-full" });
6132
+ }
6133
+ if (typeof data.iframe === "object" && data.iframe?.src) {
6134
+ const { src, height = 0, width = 100, noPadding } = data.iframe;
6135
+ const finalSrc = noPadding ? `${src}?noPadding` : src;
6136
+ const finalWidth = width === 100 ? "100%" : width;
6137
+ return /* @__PURE__ */ jsxRuntime.jsx("iframe", { ref, src: finalSrc, height, width: finalWidth, className: "w-full" });
6138
+ }
6139
+ return null;
6110
6140
  }
6111
- return null;
6112
- }
6141
+ );
6142
+ IFrame.displayName = "IFrame";
6113
6143
  function Tabs({
6114
6144
  tabIndex,
6115
6145
  items,
@@ -6131,19 +6161,22 @@ function CodePreview({
6131
6161
  isRTL,
6132
6162
  isDarkMode,
6133
6163
  iframe,
6134
- accentColor,
6135
- primaryColor,
6136
- themeCategory,
6164
+ themeValues,
6137
6165
  children
6138
6166
  }) {
6139
- const primary = colorThemes[themeCategory][primaryColor]?.colors[3]?.hex;
6140
- const accent = colorThemes[themeCategory][accentColor]?.colors[2]?.hex;
6167
+ const cssVars = React6__namespace.default.useMemo(() => {
6168
+ const withCssVarNames = Object.entries(themeValues).map(([key, value]) => {
6169
+ const kebab = key.replace(/(\D+)(\d+)/, "$1-$2");
6170
+ return [`--color-${kebab}`, value];
6171
+ });
6172
+ return Object.fromEntries(withCssVarNames);
6173
+ }, [themeValues]);
6141
6174
  return /* @__PURE__ */ jsxRuntime.jsx(
6142
6175
  "div",
6143
6176
  {
6144
6177
  ...isRTL && { dir: "rtl" },
6145
6178
  className: "code-preview-wrapper",
6146
- style: { "--color-primary-800": primary, "--color-accent-600": accent },
6179
+ style: cssVars,
6147
6180
  children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-grey-200 dark:border-grey-600 dark:bg-grey-900 flex border-x bg-white bg-gradient-to-r p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
6148
6181
  "div",
6149
6182
  {
@@ -6171,7 +6204,7 @@ function CodePreview({
6171
6204
  );
6172
6205
  }
6173
6206
  function EditOnGithubButton({ githubSlug }) {
6174
- const githubSrcHref = "https://github.com/digitalnsw/nswds-app/src/examples/";
6207
+ const githubSrcHref = "https://github.com";
6175
6208
  const href = `${githubSrcHref}${githubSlug}`;
6176
6209
  return /* @__PURE__ */ jsxRuntime.jsxs(
6177
6210
  Button2,
@@ -6205,7 +6238,7 @@ function ThemeSelectorDropDown({
6205
6238
  accentColor,
6206
6239
  setAccentColor
6207
6240
  }) {
6208
- const filteredColorThemes = React5.useMemo(() => {
6241
+ const filteredColorThemes = React6.useMemo(() => {
6209
6242
  const filtered = {};
6210
6243
  for (const category of Object.keys(colorThemes)) {
6211
6244
  filtered[category] = Object.fromEntries(
@@ -6216,11 +6249,11 @@ function ThemeSelectorDropDown({
6216
6249
  }
6217
6250
  return filtered;
6218
6251
  }, []);
6219
- const availableAccentColors = React5.useMemo(() => {
6252
+ const availableAccentColors = React6.useMemo(() => {
6220
6253
  const allColors = Object.keys(filteredColorThemes[themeCategory]);
6221
6254
  return allColors.filter((color) => color !== primaryColor);
6222
6255
  }, [filteredColorThemes, themeCategory, primaryColor]);
6223
- React5.useEffect(() => {
6256
+ React6.useEffect(() => {
6224
6257
  const availableColors = Object.keys(colorThemes[themeCategory]);
6225
6258
  if (!availableColors.includes(primaryColor)) {
6226
6259
  setPrimaryColor(availableColors[0]);
@@ -6345,9 +6378,9 @@ function CollapsibleContent2({
6345
6378
  return /* @__PURE__ */ jsxRuntime.jsx(CollapsiblePrimitive__namespace.CollapsibleContent, { "data-slot": "collapsible-content", ...props });
6346
6379
  }
6347
6380
  var TruncatingTooltip = ({ children, className }) => {
6348
- const textRef = React5.useRef(null);
6349
- const [isTruncated, setIsTruncated] = React5.useState(false);
6350
- React5.useEffect(() => {
6381
+ const textRef = React6.useRef(null);
6382
+ const [isTruncated, setIsTruncated] = React6.useState(false);
6383
+ React6.useEffect(() => {
6351
6384
  const el = textRef.current;
6352
6385
  if (el) {
6353
6386
  setIsTruncated(el.scrollWidth > el.clientWidth);
@@ -6360,7 +6393,7 @@ var TruncatingTooltip = ({ children, className }) => {
6360
6393
  };
6361
6394
  function ColorCard({ name, token, hex, rgb: rgb2, hsl, oklch: oklch2, format, viewMode }) {
6362
6395
  const [, copyToClipboardRaw] = usehooks.useCopyToClipboard();
6363
- const [copied, setCopied] = React5.useState(false);
6396
+ const [copied, setCopied] = React6.useState(false);
6364
6397
  const formattedColor = getColorValue({ oklch: oklch2, hex, rgb: rgb2, hsl }, format);
6365
6398
  const copyToClipboard = () => {
6366
6399
  copyToClipboardRaw(formattedColor);
@@ -6932,7 +6965,7 @@ function DrawerDescription({
6932
6965
  );
6933
6966
  }
6934
6967
  function DynamicFavicon({ lightModeFavicon, darkModeFavicon }) {
6935
- React5.useEffect(() => {
6968
+ React6.useEffect(() => {
6936
6969
  const updateFavicon = () => {
6937
6970
  const isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches;
6938
6971
  const favicon = document.querySelector("link[rel='icon']");
@@ -6952,10 +6985,10 @@ function DynamicFavicon({ lightModeFavicon, darkModeFavicon }) {
6952
6985
  }, [lightModeFavicon, darkModeFavicon]);
6953
6986
  return null;
6954
6987
  }
6955
- var ExpandableSearchContext = React5__namespace.createContext(null);
6956
- var ExpandableSearch = React5__namespace.forwardRef(({ className, onAction, defaultValue = "", ...props }, ref) => {
6957
- const [value, setValue] = React5__namespace.useState(defaultValue);
6958
- const formRef = React5__namespace.useRef(null);
6988
+ var ExpandableSearchContext = React6__namespace.createContext(null);
6989
+ var ExpandableSearch = React6__namespace.forwardRef(({ className, onAction, defaultValue = "", ...props }, ref) => {
6990
+ const [value, setValue] = React6__namespace.useState(defaultValue);
6991
+ const formRef = React6__namespace.useRef(null);
6959
6992
  const handleAction = (e) => {
6960
6993
  e.preventDefault();
6961
6994
  if (onAction) {
@@ -6973,10 +7006,10 @@ var ExpandableSearch = React5__namespace.forwardRef(({ className, onAction, defa
6973
7006
  ) });
6974
7007
  });
6975
7008
  ExpandableSearch.displayName = "ExpandableSearch";
6976
- var ExpandableSearchField = React5__namespace.forwardRef(({ className, ...props }, ref) => {
6977
- const context = React5__namespace.useContext(ExpandableSearchContext);
7009
+ var ExpandableSearchField = React6__namespace.forwardRef(({ className, ...props }, ref) => {
7010
+ const context = React6__namespace.useContext(ExpandableSearchContext);
6978
7011
  if (!context) throw new Error("ExpandableSearchField must be used within ExpandableSearch");
6979
- const [isFocused, setIsFocused] = React5__namespace.useState(false);
7012
+ const [isFocused, setIsFocused] = React6__namespace.useState(false);
6980
7013
  const isActive = context.value.length > 0 || isFocused;
6981
7014
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1", children: [
6982
7015
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "sr-only", htmlFor: "expandable-search", children: "Search" }),
@@ -7173,7 +7206,7 @@ function Toggle({
7173
7206
  }
7174
7207
  );
7175
7208
  }
7176
- var ToggleGroupContext = React5__namespace.createContext({
7209
+ var ToggleGroupContext = React6__namespace.createContext({
7177
7210
  size: "default",
7178
7211
  variant: "ghost"
7179
7212
  });
@@ -7206,7 +7239,7 @@ function ToggleGroupItem({
7206
7239
  size,
7207
7240
  ...props
7208
7241
  }) {
7209
- const context = React5__namespace.useContext(ToggleGroupContext);
7242
+ const context = React6__namespace.useContext(ToggleGroupContext);
7210
7243
  return /* @__PURE__ */ jsxRuntime.jsx(
7211
7244
  ToggleGroupPrimitive__namespace.Item,
7212
7245
  {
@@ -7248,22 +7281,27 @@ function FormatToggle({ format, setFormat }) {
7248
7281
  function Heading({
7249
7282
  className,
7250
7283
  trim = "normal",
7251
- size = 8,
7284
+ size = 1,
7252
7285
  level = 1,
7286
+ display = false,
7253
7287
  ...props
7254
7288
  }) {
7255
7289
  const Element = `h${level}`;
7256
- const sizeClasses = {
7257
- 1: "text-[calc(var(--font-size-1)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-1)] tracking-[calc(var(--letter-spacing-1)_+_var(--heading-letter-spacing))]",
7258
- 2: "text-[calc(var(--font-size-2)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-2)] tracking-[calc(var(--letter-spacing-2)_+_var(--heading-letter-spacing))]",
7259
- 3: "text-[calc(var(--font-size-3)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-3)] tracking-[calc(var(--letter-spacing-3)_+_var(--heading-letter-spacing))]",
7260
- 4: "text-[calc(var(--font-size-4)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-4)] tracking-[calc(var(--letter-spacing-4)_+_var(--heading-letter-spacing))]",
7261
- 5: "text-[calc(var(--font-size-5)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-5)] tracking-[calc(var(--letter-spacing-5)_+_var(--heading-letter-spacing))]",
7262
- 6: "text-[calc(var(--font-size-6)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-6)] tracking-[calc(var(--letter-spacing-6)_+_var(--heading-letter-spacing))]",
7263
- 7: "text-[calc(var(--font-size-7)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-7)] tracking-[calc(var(--letter-spacing-7)_+_var(--heading-letter-spacing))]",
7264
- 8: "text-[calc(var(--font-size-8)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-8)] tracking-[calc(var(--letter-spacing-8)_+_var(--heading-letter-spacing))]",
7265
- 9: "text-[calc(var(--font-size-9)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-9)] tracking-[calc(var(--letter-spacing-9)_+_var(--heading-letter-spacing))]"
7290
+ const headingSizeClasses = {
7291
+ 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))]",
7292
+ 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))]",
7293
+ 3: "text-[calc(var(--heading-font-size-3)_*_var(--heading-font-size-adjust))] leading-[var(--line-height-40)] tracking-[calc(var(--heading-letter-spacing-2)_+_var(--heading-letter-spacing))]",
7294
+ 4: "text-[calc(var(--heading-font-size-4)_*_var(--heading-font-size-adjust))] leading-[var(--line-height-36)] tracking-[calc(var(--heading-letter-spacing-1)_+_var(--heading-letter-spacing))]",
7295
+ 5: "text-[calc(var(--heading-font-size-5)_*_var(--heading-font-size-adjust))] leading-[var(--line-height-32)] tracking-[calc(var(--heading-letter-spacing-1)_+_var(--heading-letter-spacing))]",
7296
+ 6: "text-[calc(var(--heading-font-size-6)_*_var(--heading-font-size-adjust))] leading-[var(--line-height-28)] tracking-[calc(var(--letter-spacing-0)_+_var(--heading-letter-spacing))]"
7266
7297
  };
7298
+ const displaySizeClasses = {
7299
+ 1: "text-[calc(var(--display-font-size-1)_*_var(--heading-font-size-adjust))] leading-[var(--line-height-96)] tracking-[calc(var(--heading-letter-spacing-3)_+_var(--heading-letter-spacing))]",
7300
+ 2: "text-[calc(var(--display-font-size-2)_*_var(--heading-font-size-adjust))] leading-[var(--line-height-60)] tracking-[calc(var(--heading-letter-spacing-2)_+_var(--heading-letter-spacing))]",
7301
+ 3: "text-[calc(var(--display-font-size-3)_*_var(--heading-font-size-adjust))] leading-[var(--line-height-52)] tracking-[calc(var(--heading-letter-spacing-2)_+_var(--heading-letter-spacing))]",
7302
+ 4: "text-[calc(var(--display-font-size-4)_*_var(--heading-font-size-adjust))] leading-[var(--line-height-44)] tracking-[calc(var(--heading-letter-spacing-2)_+_var(--heading-letter-spacing))]"
7303
+ };
7304
+ const sizeClass = display ? displaySizeClasses[size] : headingSizeClasses[size];
7267
7305
  const trimClasses = {
7268
7306
  normal: ["before:content-none after:content-none"],
7269
7307
  start: [
@@ -7291,7 +7329,7 @@ function Heading({
7291
7329
  "leading-[var(--line-height)] font-[var(--heading-font-family)] font-bold",
7292
7330
  "[--leading-trim-end:var(--heading-leading-trim-end)] [--leading-trim-start:var(--heading-leading-trim-start)]",
7293
7331
  "text-primary-800 dark:text-white",
7294
- sizeClasses[size]
7332
+ sizeClass
7295
7333
  )
7296
7334
  }
7297
7335
  );
@@ -7299,7 +7337,7 @@ function Heading({
7299
7337
 
7300
7338
  // package.json
7301
7339
  var package_default = {
7302
- version: "1.20.0"};
7340
+ version: "1.21.0"};
7303
7341
  function Logo(props) {
7304
7342
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7305
7343
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "NSW Government" }),
@@ -7341,9 +7379,9 @@ function Logo(props) {
7341
7379
  }
7342
7380
  function ThemeSwitcher() {
7343
7381
  const { resolvedTheme, setTheme } = nextThemes.useTheme();
7344
- const [mounted, setMounted] = React5.useState(false);
7382
+ const [mounted, setMounted] = React6.useState(false);
7345
7383
  const classes = "fill-nsw-grey-600 dark:fill-nsw-grey-100";
7346
- React5.useEffect(() => {
7384
+ React6.useEffect(() => {
7347
7385
  setMounted(true);
7348
7386
  }, []);
7349
7387
  if (!mounted) {
@@ -7365,9 +7403,9 @@ function ThemeSwitcher() {
7365
7403
  );
7366
7404
  }
7367
7405
  function SiteSearch({ navigation: navigation$1 }) {
7368
- const [open, setOpen] = React5__namespace.useState(false);
7406
+ const [open, setOpen] = React6__namespace.useState(false);
7369
7407
  const router = navigation.useRouter();
7370
- React5__namespace.useEffect(() => {
7408
+ React6__namespace.useEffect(() => {
7371
7409
  const down = (e) => {
7372
7410
  if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
7373
7411
  e.preventDefault();
@@ -7377,7 +7415,7 @@ function SiteSearch({ navigation: navigation$1 }) {
7377
7415
  document.addEventListener("keydown", down);
7378
7416
  return () => document.removeEventListener("keydown", down);
7379
7417
  }, []);
7380
- const runCommand = React5__namespace.useCallback((command) => {
7418
+ const runCommand = React6__namespace.useCallback((command) => {
7381
7419
  setOpen(false);
7382
7420
  command();
7383
7421
  }, []);
@@ -7420,8 +7458,8 @@ function Header2({
7420
7458
  navigation,
7421
7459
  version = false
7422
7460
  }) {
7423
- const [isScrolled, setIsScrolled] = React5.useState(false);
7424
- React5.useEffect(() => {
7461
+ const [isScrolled, setIsScrolled] = React6.useState(false);
7462
+ React6.useEffect(() => {
7425
7463
  function onScroll() {
7426
7464
  setIsScrolled(window.scrollY > 0);
7427
7465
  }
@@ -8311,7 +8349,7 @@ function Slider({
8311
8349
  max = 100,
8312
8350
  ...props
8313
8351
  }) {
8314
- const _values = React5__namespace.useMemo(
8352
+ const _values = React6__namespace.useMemo(
8315
8353
  () => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
8316
8354
  [value, defaultValue, min, max]
8317
8355
  );
@@ -8520,8 +8558,8 @@ function TableCaption({ className, ...props }) {
8520
8558
  );
8521
8559
  }
8522
8560
  function TableOfContents({ tableOfContents }) {
8523
- const [currentSection, setCurrentSection] = React5.useState(tableOfContents[0]?.id);
8524
- const getHeadings2 = React5.useCallback((tableOfContents2) => {
8561
+ const [currentSection, setCurrentSection] = React6.useState(tableOfContents[0]?.id);
8562
+ const getHeadings2 = React6.useCallback((tableOfContents2) => {
8525
8563
  return tableOfContents2.flatMap((node) => [node.id, ...node.children.map((child) => child.id)]).map((id) => {
8526
8564
  const el = document.getElementById(id);
8527
8565
  if (!el) return null;
@@ -8531,7 +8569,7 @@ function TableOfContents({ tableOfContents }) {
8531
8569
  return { id, top };
8532
8570
  }).filter((x) => x !== null);
8533
8571
  }, []);
8534
- React5.useEffect(() => {
8572
+ React6.useEffect(() => {
8535
8573
  if (tableOfContents.length === 0) return;
8536
8574
  const headings = getHeadings2(tableOfContents);
8537
8575
  function onScroll() {
@@ -8663,18 +8701,20 @@ function TabsContent({ className, ...props }) {
8663
8701
  }
8664
8702
  );
8665
8703
  }
8666
- function Text({ className, trim = "normal", size = 8, ...props }) {
8667
- const sizeClasses = {
8668
- 1: "text-[calc(var(--font-size-1)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-1)] tracking-[calc(var(--letter-spacing-1)_+_var(--heading-letter-spacing))]",
8669
- 2: "text-[calc(var(--font-size-2)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-2)] tracking-[calc(var(--letter-spacing-2)_+_var(--heading-letter-spacing))]",
8670
- 3: "text-[calc(var(--font-size-3)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-3)] tracking-[calc(var(--letter-spacing-3)_+_var(--heading-letter-spacing))]",
8671
- 4: "text-[calc(var(--font-size-4)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-4)] tracking-[calc(var(--letter-spacing-4)_+_var(--heading-letter-spacing))]",
8672
- 5: "text-[calc(var(--font-size-5)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-5)] tracking-[calc(var(--letter-spacing-5)_+_var(--heading-letter-spacing))]",
8673
- 6: "text-[calc(var(--font-size-6)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-6)] tracking-[calc(var(--letter-spacing-6)_+_var(--heading-letter-spacing))]",
8674
- 7: "text-[calc(var(--font-size-7)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-7)] tracking-[calc(var(--letter-spacing-7)_+_var(--heading-letter-spacing))]",
8675
- 8: "text-[calc(var(--font-size-8)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-8)] tracking-[calc(var(--letter-spacing-8)_+_var(--heading-letter-spacing))]",
8676
- 9: "text-[calc(var(--font-size-9)_*_var(--heading-font-size-adjust))] leading-[var(--heading-line-height-9)] tracking-[calc(var(--letter-spacing-9)_+_var(--heading-letter-spacing))]"
8704
+ function Text({ className, trim = "normal", size = 2, label = false, ...props }) {
8705
+ const textSizeClasses = {
8706
+ 1: "text-[length:var(--font-size-1)] leading-[var(--line-height-28)] tracking-[var(--letter-spacing-0)]",
8707
+ 2: "text-[length:var(--font-size-2)] leading-[var(--line-height-24)] tracking-[var(--letter-spacing-0)]",
8708
+ 3: "text-[length:var(--font-size-3)] leading-[var(--line-height-20)] tracking-[var(--letter-spacing-0)]",
8709
+ 4: "text-[length:var(--font-size-4)] leading-[var(--line-height-20)] tracking-[var(--letter-spacing-0)]"
8710
+ };
8711
+ const labelSizeClasses = {
8712
+ 1: "text-[length:var(--font-size-1)] leading-[var(--line-height-24)] tracking-[var(--letter-spacing-0)]",
8713
+ 2: "text-[length:var(--font-size-2)] leading-[var(--line-height-20)] tracking-[var(--letter-spacing-0)]",
8714
+ 3: "text-[length:var(--font-size-3)] leading-[var(--line-height-16)] tracking-[var(--letter-spacing-0)]",
8715
+ 4: "text-[length:var(--font-size-4)] leading-[var(--line-height-16)] tracking-[var(--letter-spacing-0)]"
8677
8716
  };
8717
+ const sizeClass = label ? labelSizeClasses[size] : textSizeClasses[size];
8678
8718
  const trimClasses = {
8679
8719
  normal: ["before:content-none after:content-none"],
8680
8720
  start: [
@@ -8696,12 +8736,7 @@ function Text({ className, trim = "normal", size = 8, ...props }) {
8696
8736
  {
8697
8737
  "data-slot": "text",
8698
8738
  ...props,
8699
- className: clsx11__default.default(
8700
- className,
8701
- trimClasses[trim],
8702
- "text-grey-800 dark:text-grey-400 text-base/6 sm:text-sm/6",
8703
- sizeClasses[size]
8704
- )
8739
+ className: clsx11__default.default(className, trimClasses[trim], "text-grey-800 dark:text-grey-400", sizeClass)
8705
8740
  }
8706
8741
  );
8707
8742
  }
@@ -8767,13 +8802,13 @@ function ThemeColorPalette() {
8767
8802
  brand,
8768
8803
  aboriginal
8769
8804
  };
8770
- const [format, setFormat] = React5.useState("hex");
8771
- const [viewMode, setViewMode] = React5.useState("grid");
8772
- const [themeCategory, setThemeCategory] = React5.useState("brand");
8773
- const [primaryColor, setPrimaryColor] = React5.useState("blue");
8774
- const [accentColor, setAccentColor] = React5.useState("red");
8775
- const [sheetOpen, setSheetOpen] = React5.useState(false);
8776
- const filteredColorThemes = React5.useMemo(() => {
8805
+ const [format, setFormat] = React6.useState("hex");
8806
+ const [viewMode, setViewMode] = React6.useState("grid");
8807
+ const [themeCategory, setThemeCategory] = React6.useState("brand");
8808
+ const [primaryColor, setPrimaryColor] = React6.useState("blue");
8809
+ const [accentColor, setAccentColor] = React6.useState("red");
8810
+ const [sheetOpen, setSheetOpen] = React6.useState(false);
8811
+ const filteredColorThemes = React6.useMemo(() => {
8777
8812
  const filtered = {};
8778
8813
  for (const category of Object.keys(colorThemes)) {
8779
8814
  filtered[category] = Object.fromEntries(
@@ -8784,11 +8819,11 @@ function ThemeColorPalette() {
8784
8819
  }
8785
8820
  return filtered;
8786
8821
  }, []);
8787
- const availableAccentColors = React5.useMemo(() => {
8822
+ const availableAccentColors = React6.useMemo(() => {
8788
8823
  const allColors = Object.keys(filteredColorThemes[themeCategory]);
8789
8824
  return allColors.filter((color) => color !== primaryColor);
8790
8825
  }, [filteredColorThemes, themeCategory, primaryColor]);
8791
- React5.useEffect(() => {
8826
+ React6.useEffect(() => {
8792
8827
  const availableColors = Object.keys(colorThemes[themeCategory]);
8793
8828
  if (!availableColors.includes(primaryColor)) {
8794
8829
  setPrimaryColor(availableColors[0]);
@@ -8804,7 +8839,7 @@ function ThemeColorPalette() {
8804
8839
  }
8805
8840
  }
8806
8841
  }, [themeCategory, primaryColor, accentColor]);
8807
- const currentColorPalette = React5.useMemo(() => {
8842
+ const currentColorPalette = React6.useMemo(() => {
8808
8843
  if (!colorThemes[themeCategory] || !colorThemes[themeCategory][primaryColor] || !colorThemes[themeCategory][accentColor]) {
8809
8844
  return [
8810
8845
  {
@@ -8883,34 +8918,31 @@ function ThemeColorPalette() {
8883
8918
  ] })
8884
8919
  ] })
8885
8920
  ] }),
8886
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-12", children: currentColorPalette.map((theme2) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
8887
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-semibold", children: theme2.name }),
8888
- /* @__PURE__ */ jsxRuntime.jsx(
8889
- BaseColorSwatches,
8890
- {
8891
- baseColors: baseColors[themeCategory][primaryColor],
8892
- format
8893
- }
8894
- ),
8895
- /* @__PURE__ */ jsxRuntime.jsx(ColourScale, { colorsToUse: theme2.colors }, theme2.name),
8896
- /* @__PURE__ */ jsxRuntime.jsx(ColorSwatches, { theme: theme2.colors, format, viewMode })
8897
- ] }, theme2.name)) })
8921
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-12", children: currentColorPalette.map((theme2) => {
8922
+ const baseKey = theme2.name === "Primary" ? primaryColor : theme2.name === "Accent" ? accentColor : "grey";
8923
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
8924
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-semibold", children: theme2.name }),
8925
+ /* @__PURE__ */ jsxRuntime.jsx(BaseColorSwatches, { baseColors: baseColors[themeCategory][baseKey], format }),
8926
+ /* @__PURE__ */ jsxRuntime.jsx(ColourScale, { colorsToUse: theme2.colors }),
8927
+ /* @__PURE__ */ jsxRuntime.jsx(ColorSwatches, { theme: theme2.colors, format, viewMode })
8928
+ ] }, theme2.name);
8929
+ }) })
8898
8930
  ] });
8899
8931
  }
8900
8932
  function ThemeProvider({ children, ...props }) {
8901
8933
  return /* @__PURE__ */ jsxRuntime.jsx(nextThemes.ThemeProvider, { ...props, children });
8902
8934
  }
8903
- var TocContext = React5.createContext({
8935
+ var TocContext = React6.createContext({
8904
8936
  toc: true,
8905
8937
  setToc: () => {
8906
8938
  }
8907
8939
  });
8908
8940
  function TocProvider({ children }) {
8909
- const [toc, setToc] = React5.useState(true);
8941
+ const [toc, setToc] = React6.useState(true);
8910
8942
  return /* @__PURE__ */ jsxRuntime.jsx(TocContext.Provider, { value: { toc, setToc }, children });
8911
8943
  }
8912
8944
  function useToc() {
8913
- return React5.useContext(TocContext);
8945
+ return React6.useContext(TocContext);
8914
8946
  }
8915
8947
  function getNodeText(node) {
8916
8948
  let text = "";
@@ -8990,7 +9022,8 @@ var languages = [
8990
9022
  "jsx",
8991
9023
  "ts",
8992
9024
  "tsx",
8993
- "typescript"
9025
+ "typescript",
9026
+ "html"
8994
9027
  ];
8995
9028
 
8996
9029
  exports.Accordion = Accordion;