@nswds/app 1.21.2 → 1.23.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 +229 -181
- package/dist/index.cjs +224 -149
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +83 -13
- package/dist/index.d.ts +83 -13
- package/dist/index.js +180 -105
- package/dist/index.js.map +1 -1
- package/dist/styles.css +246 -202
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
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
|
|
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
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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(
|
|
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(
|
|
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(
|
|
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 =
|
|
2064
|
-
const [isJustCopied, setJustCopied] =
|
|
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 || "");
|
|
@@ -2446,6 +2446,7 @@ function SegmentedControlTrigger({
|
|
|
2446
2446
|
}
|
|
2447
2447
|
);
|
|
2448
2448
|
}
|
|
2449
|
+
var findGreyKey = (themes) => Object.keys(themes).find((k) => k.toLowerCase().includes("grey")) ?? "";
|
|
2449
2450
|
function ThemeSelector({
|
|
2450
2451
|
themeCategory,
|
|
2451
2452
|
setThemeCategory,
|
|
@@ -2453,12 +2454,18 @@ function ThemeSelector({
|
|
|
2453
2454
|
setPrimaryColor,
|
|
2454
2455
|
accentColor,
|
|
2455
2456
|
setAccentColor,
|
|
2457
|
+
greyColor,
|
|
2458
|
+
setGreyColor,
|
|
2456
2459
|
availableAccentColors,
|
|
2457
2460
|
colorThemes: colorThemes2
|
|
2458
2461
|
}) {
|
|
2459
2462
|
const handleCategoryChange = (newCategory) => {
|
|
2460
2463
|
setThemeCategory(newCategory);
|
|
2461
2464
|
const availableColors = Object.keys(colorThemes2[newCategory]);
|
|
2465
|
+
const neutral = findGreyKey(colorThemes2[newCategory]);
|
|
2466
|
+
if (neutral && neutral !== greyColor) {
|
|
2467
|
+
setGreyColor(neutral);
|
|
2468
|
+
}
|
|
2462
2469
|
if (availableColors.length > 0) {
|
|
2463
2470
|
if (availableColors.includes(primaryColor)) {
|
|
2464
2471
|
const newAccentColor = availableColors.find((color) => color !== primaryColor);
|
|
@@ -5941,21 +5948,48 @@ var colors = {
|
|
|
5941
5948
|
}
|
|
5942
5949
|
};
|
|
5943
5950
|
var colorThemes = generateColorThemes(colors);
|
|
5944
|
-
function CodeDemo({ data }) {
|
|
5951
|
+
function CodeDemo({ data, hide = {} }) {
|
|
5945
5952
|
const { resolvedTheme } = nextThemes.useTheme();
|
|
5946
|
-
const
|
|
5947
|
-
const [
|
|
5948
|
-
const [
|
|
5949
|
-
const [
|
|
5950
|
-
const [
|
|
5951
|
-
const [
|
|
5952
|
-
const [
|
|
5953
|
-
const [
|
|
5954
|
-
const [
|
|
5955
|
-
const [
|
|
5956
|
-
|
|
5953
|
+
const { rtl = false, darkMode = false, themeSelector = false } = hide;
|
|
5954
|
+
const [tabIndex, setTabIndex] = React6.useState(0);
|
|
5955
|
+
const [variant, setVariant] = React6.useState(getInitialVariant(data));
|
|
5956
|
+
const [view, setView] = React6.useState("desktop");
|
|
5957
|
+
const [isRTL, setIsRTL] = React6.useState(false);
|
|
5958
|
+
const [isDarkMode, setDarkMode] = React6.useState(null);
|
|
5959
|
+
const [isExpanded, setExpanded] = React6.useState(false);
|
|
5960
|
+
const [isJustCopied, setJustCopied] = React6.useState(false);
|
|
5961
|
+
const [themeCategory, setThemeCategory] = React6.useState("brand");
|
|
5962
|
+
const [primaryColor, setPrimaryColor] = React6.useState("blue");
|
|
5963
|
+
const [accentColor, setAccentColor] = React6.useState("red");
|
|
5964
|
+
const [greyColor, setGreyColor] = React6.useState("grey");
|
|
5965
|
+
React6.useEffect(() => {
|
|
5957
5966
|
setDarkMode(resolvedTheme === "dark");
|
|
5958
5967
|
}, [resolvedTheme]);
|
|
5968
|
+
const iframeRef = React6.useRef(null);
|
|
5969
|
+
const getShades = (prefix, colorKey, themeCat) => colors[themeCat][colorKey].colors.reduce((acc, shade) => {
|
|
5970
|
+
const suffix = shade.token.split("-").pop();
|
|
5971
|
+
acc[`${prefix}${suffix}`] = shade.hex;
|
|
5972
|
+
return acc;
|
|
5973
|
+
}, {});
|
|
5974
|
+
const themeValues = React6__namespace.default.useMemo(
|
|
5975
|
+
() => ({
|
|
5976
|
+
...getShades("primary", primaryColor, themeCategory),
|
|
5977
|
+
...getShades("accent", accentColor, themeCategory),
|
|
5978
|
+
...getShades("grey", greyColor, themeCategory)
|
|
5979
|
+
}),
|
|
5980
|
+
[themeCategory, primaryColor, accentColor, greyColor]
|
|
5981
|
+
);
|
|
5982
|
+
React6__namespace.default.useEffect(() => {
|
|
5983
|
+
const frame = iframeRef.current;
|
|
5984
|
+
if (!frame) return;
|
|
5985
|
+
const send = () => {
|
|
5986
|
+
const msg = { type: "nswds-theme", payload: themeValues };
|
|
5987
|
+
frame.contentWindow?.postMessage(msg, "*");
|
|
5988
|
+
};
|
|
5989
|
+
send();
|
|
5990
|
+
frame.addEventListener("load", send);
|
|
5991
|
+
return () => frame.removeEventListener("load", send);
|
|
5992
|
+
}, [themeValues]);
|
|
5959
5993
|
function copyToClipboard(value) {
|
|
5960
5994
|
setJustCopied(true);
|
|
5961
5995
|
navigator.clipboard.writeText(value);
|
|
@@ -5999,6 +6033,14 @@ function CodeDemo({ data }) {
|
|
|
5999
6033
|
function countLines(value) {
|
|
6000
6034
|
return (value.match(/\n/g) || "").length + 1;
|
|
6001
6035
|
}
|
|
6036
|
+
function selectIframe(data2, currentVariant) {
|
|
6037
|
+
const { iframe } = data2;
|
|
6038
|
+
if (!iframe) return;
|
|
6039
|
+
if (typeof iframe === "number") return iframe;
|
|
6040
|
+
if ("src" in iframe) return iframe;
|
|
6041
|
+
return iframe[currentVariant];
|
|
6042
|
+
}
|
|
6043
|
+
const iframeData = selectIframe(data, variant);
|
|
6002
6044
|
const variants = getVariants(data);
|
|
6003
6045
|
const code = getCode(data, variant);
|
|
6004
6046
|
const codeItems = getCodeItems(code);
|
|
@@ -6009,7 +6051,7 @@ function CodeDemo({ data }) {
|
|
|
6009
6051
|
/* @__PURE__ */ jsxRuntime.jsx(EditOnGithubButton, { githubSlug: data.githubSlug }),
|
|
6010
6052
|
/* @__PURE__ */ jsxRuntime.jsx(ToggleViewButtons, { onSelect: setView }),
|
|
6011
6053
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-1 flex justify-end gap-3", children: [
|
|
6012
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6054
|
+
!themeSelector && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6013
6055
|
ThemeSelectorDropDown,
|
|
6014
6056
|
{
|
|
6015
6057
|
themeCategory,
|
|
@@ -6017,11 +6059,13 @@ function CodeDemo({ data }) {
|
|
|
6017
6059
|
primaryColor,
|
|
6018
6060
|
setPrimaryColor,
|
|
6019
6061
|
accentColor,
|
|
6020
|
-
setAccentColor
|
|
6062
|
+
setAccentColor,
|
|
6063
|
+
greyColor,
|
|
6064
|
+
setGreyColor
|
|
6021
6065
|
}
|
|
6022
6066
|
),
|
|
6023
|
-
/* @__PURE__ */ jsxRuntime.jsx(ToggleRTLButton, { isRTL, onClick: () => setIsRTL((state) => !state) }),
|
|
6024
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6067
|
+
!rtl && /* @__PURE__ */ jsxRuntime.jsx(ToggleRTLButton, { isRTL, onClick: () => setIsRTL((state) => !state) }),
|
|
6068
|
+
!darkMode && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6025
6069
|
ToggleDarkModeButton,
|
|
6026
6070
|
{
|
|
6027
6071
|
isDarkMode,
|
|
@@ -6036,11 +6080,18 @@ function CodeDemo({ data }) {
|
|
|
6036
6080
|
view,
|
|
6037
6081
|
isRTL,
|
|
6038
6082
|
isDarkMode,
|
|
6039
|
-
iframe:
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6083
|
+
iframe: iframeData,
|
|
6084
|
+
themeValues,
|
|
6085
|
+
children: iframeData ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
6086
|
+
IFrame,
|
|
6087
|
+
{
|
|
6088
|
+
sandbox: "allow-scripts allow-same-origin",
|
|
6089
|
+
ref: iframeRef,
|
|
6090
|
+
iframe: iframeData,
|
|
6091
|
+
isRTL,
|
|
6092
|
+
isDarkMode
|
|
6093
|
+
}
|
|
6094
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: data.component })
|
|
6044
6095
|
}
|
|
6045
6096
|
),
|
|
6046
6097
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "code-syntax-wrapper", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -6085,31 +6136,29 @@ function CodeDemo({ data }) {
|
|
|
6085
6136
|
) })
|
|
6086
6137
|
] });
|
|
6087
6138
|
}
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
}
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
const finalWidth = width === 100 ? "100%" : width;
|
|
6109
|
-
return /* @__PURE__ */ jsxRuntime.jsx("iframe", { ref, src: finalSrc, height, width: finalWidth, className: "w-full" });
|
|
6139
|
+
var IFrame = React6__namespace.default.forwardRef(
|
|
6140
|
+
({ iframe, isRTL, isDarkMode }, ref) => {
|
|
6141
|
+
React6.useEffect(() => {
|
|
6142
|
+
const document2 = ref?.current?.contentDocument;
|
|
6143
|
+
const root = document2?.documentElement;
|
|
6144
|
+
if (document2 && root) {
|
|
6145
|
+
root.setAttribute("dir", isRTL ? "rtl" : "ltr");
|
|
6146
|
+
root.classList.toggle("dark", !!isDarkMode);
|
|
6147
|
+
}
|
|
6148
|
+
}, [isRTL, isDarkMode, ref]);
|
|
6149
|
+
if (typeof iframe === "number") {
|
|
6150
|
+
return /* @__PURE__ */ jsxRuntime.jsx("iframe", { ref, src: "", height: iframe, width: "100%", className: "w-full" });
|
|
6151
|
+
}
|
|
6152
|
+
if (typeof iframe === "object" && iframe?.src) {
|
|
6153
|
+
const { src, height = 0, width = 100, noPadding } = iframe;
|
|
6154
|
+
const finalSrc = noPadding ? `${src}?noPadding` : src;
|
|
6155
|
+
const finalWidth = width === 100 ? "100%" : width;
|
|
6156
|
+
return /* @__PURE__ */ jsxRuntime.jsx("iframe", { ref, src: finalSrc, height, width: finalWidth, className: "w-full" });
|
|
6157
|
+
}
|
|
6158
|
+
return null;
|
|
6110
6159
|
}
|
|
6111
|
-
|
|
6112
|
-
|
|
6160
|
+
);
|
|
6161
|
+
IFrame.displayName = "IFrame";
|
|
6113
6162
|
function Tabs({
|
|
6114
6163
|
tabIndex,
|
|
6115
6164
|
items,
|
|
@@ -6131,19 +6180,22 @@ function CodePreview({
|
|
|
6131
6180
|
isRTL,
|
|
6132
6181
|
isDarkMode,
|
|
6133
6182
|
iframe,
|
|
6134
|
-
|
|
6135
|
-
primaryColor,
|
|
6136
|
-
themeCategory,
|
|
6183
|
+
themeValues,
|
|
6137
6184
|
children
|
|
6138
6185
|
}) {
|
|
6139
|
-
const
|
|
6140
|
-
|
|
6186
|
+
const cssVars = React6__namespace.default.useMemo(() => {
|
|
6187
|
+
const withCssVarNames = Object.entries(themeValues).map(([key, value]) => {
|
|
6188
|
+
const kebab = key.replace(/(\D+)(\d+)/, "$1-$2");
|
|
6189
|
+
return [`--color-${kebab}`, value];
|
|
6190
|
+
});
|
|
6191
|
+
return Object.fromEntries(withCssVarNames);
|
|
6192
|
+
}, [themeValues]);
|
|
6141
6193
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6142
6194
|
"div",
|
|
6143
6195
|
{
|
|
6144
6196
|
...isRTL && { dir: "rtl" },
|
|
6145
6197
|
className: "code-preview-wrapper",
|
|
6146
|
-
style:
|
|
6198
|
+
style: cssVars,
|
|
6147
6199
|
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
6200
|
"div",
|
|
6149
6201
|
{
|
|
@@ -6171,7 +6223,7 @@ function CodePreview({
|
|
|
6171
6223
|
);
|
|
6172
6224
|
}
|
|
6173
6225
|
function EditOnGithubButton({ githubSlug }) {
|
|
6174
|
-
const githubSrcHref = "https://github.com
|
|
6226
|
+
const githubSrcHref = "https://github.com";
|
|
6175
6227
|
const href = `${githubSrcHref}${githubSlug}`;
|
|
6176
6228
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6177
6229
|
Button2,
|
|
@@ -6203,9 +6255,11 @@ function ThemeSelectorDropDown({
|
|
|
6203
6255
|
primaryColor,
|
|
6204
6256
|
setPrimaryColor,
|
|
6205
6257
|
accentColor,
|
|
6206
|
-
setAccentColor
|
|
6258
|
+
setAccentColor,
|
|
6259
|
+
greyColor,
|
|
6260
|
+
setGreyColor
|
|
6207
6261
|
}) {
|
|
6208
|
-
const filteredColorThemes =
|
|
6262
|
+
const filteredColorThemes = React6.useMemo(() => {
|
|
6209
6263
|
const filtered = {};
|
|
6210
6264
|
for (const category of Object.keys(colorThemes)) {
|
|
6211
6265
|
filtered[category] = Object.fromEntries(
|
|
@@ -6216,11 +6270,15 @@ function ThemeSelectorDropDown({
|
|
|
6216
6270
|
}
|
|
6217
6271
|
return filtered;
|
|
6218
6272
|
}, []);
|
|
6219
|
-
const availableAccentColors =
|
|
6273
|
+
const availableAccentColors = React6.useMemo(() => {
|
|
6220
6274
|
const allColors = Object.keys(filteredColorThemes[themeCategory]);
|
|
6221
6275
|
return allColors.filter((color) => color !== primaryColor);
|
|
6222
6276
|
}, [filteredColorThemes, themeCategory, primaryColor]);
|
|
6223
|
-
|
|
6277
|
+
React6.useEffect(() => {
|
|
6278
|
+
const neutralKey = Object.keys(colorThemes[themeCategory]).find((k) => k.toLowerCase().includes("grey")) ?? "";
|
|
6279
|
+
if (neutralKey && neutralKey !== greyColor) {
|
|
6280
|
+
setGreyColor(neutralKey);
|
|
6281
|
+
}
|
|
6224
6282
|
const availableColors = Object.keys(colorThemes[themeCategory]);
|
|
6225
6283
|
if (!availableColors.includes(primaryColor)) {
|
|
6226
6284
|
setPrimaryColor(availableColors[0]);
|
|
@@ -6235,7 +6293,15 @@ function ThemeSelectorDropDown({
|
|
|
6235
6293
|
setAccentColor(newAccentColor);
|
|
6236
6294
|
}
|
|
6237
6295
|
}
|
|
6238
|
-
}, [
|
|
6296
|
+
}, [
|
|
6297
|
+
themeCategory,
|
|
6298
|
+
primaryColor,
|
|
6299
|
+
accentColor,
|
|
6300
|
+
greyColor,
|
|
6301
|
+
setPrimaryColor,
|
|
6302
|
+
setAccentColor,
|
|
6303
|
+
setGreyColor
|
|
6304
|
+
]);
|
|
6239
6305
|
const primaryColorSwatch = colorThemes[themeCategory][primaryColor]?.colors[3]?.hex || "#000000";
|
|
6240
6306
|
const accentColorSwatch = colorThemes[themeCategory][accentColor]?.colors[2]?.hex || "#000000";
|
|
6241
6307
|
return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
|
|
@@ -6256,6 +6322,8 @@ function ThemeSelectorDropDown({
|
|
|
6256
6322
|
setPrimaryColor,
|
|
6257
6323
|
accentColor,
|
|
6258
6324
|
setAccentColor,
|
|
6325
|
+
greyColor,
|
|
6326
|
+
setGreyColor,
|
|
6259
6327
|
availableAccentColors,
|
|
6260
6328
|
colorThemes: filteredColorThemes
|
|
6261
6329
|
}
|
|
@@ -6345,9 +6413,9 @@ function CollapsibleContent2({
|
|
|
6345
6413
|
return /* @__PURE__ */ jsxRuntime.jsx(CollapsiblePrimitive__namespace.CollapsibleContent, { "data-slot": "collapsible-content", ...props });
|
|
6346
6414
|
}
|
|
6347
6415
|
var TruncatingTooltip = ({ children, className }) => {
|
|
6348
|
-
const textRef =
|
|
6349
|
-
const [isTruncated, setIsTruncated] =
|
|
6350
|
-
|
|
6416
|
+
const textRef = React6.useRef(null);
|
|
6417
|
+
const [isTruncated, setIsTruncated] = React6.useState(false);
|
|
6418
|
+
React6.useEffect(() => {
|
|
6351
6419
|
const el = textRef.current;
|
|
6352
6420
|
if (el) {
|
|
6353
6421
|
setIsTruncated(el.scrollWidth > el.clientWidth);
|
|
@@ -6360,7 +6428,7 @@ var TruncatingTooltip = ({ children, className }) => {
|
|
|
6360
6428
|
};
|
|
6361
6429
|
function ColorCard({ name, token, hex, rgb: rgb2, hsl, oklch: oklch2, format, viewMode }) {
|
|
6362
6430
|
const [, copyToClipboardRaw] = usehooks.useCopyToClipboard();
|
|
6363
|
-
const [copied, setCopied] =
|
|
6431
|
+
const [copied, setCopied] = React6.useState(false);
|
|
6364
6432
|
const formattedColor = getColorValue({ oklch: oklch2, hex, rgb: rgb2, hsl }, format);
|
|
6365
6433
|
const copyToClipboard = () => {
|
|
6366
6434
|
copyToClipboardRaw(formattedColor);
|
|
@@ -6932,7 +7000,7 @@ function DrawerDescription({
|
|
|
6932
7000
|
);
|
|
6933
7001
|
}
|
|
6934
7002
|
function DynamicFavicon({ lightModeFavicon, darkModeFavicon }) {
|
|
6935
|
-
|
|
7003
|
+
React6.useEffect(() => {
|
|
6936
7004
|
const updateFavicon = () => {
|
|
6937
7005
|
const isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
6938
7006
|
const favicon = document.querySelector("link[rel='icon']");
|
|
@@ -6952,10 +7020,10 @@ function DynamicFavicon({ lightModeFavicon, darkModeFavicon }) {
|
|
|
6952
7020
|
}, [lightModeFavicon, darkModeFavicon]);
|
|
6953
7021
|
return null;
|
|
6954
7022
|
}
|
|
6955
|
-
var ExpandableSearchContext =
|
|
6956
|
-
var ExpandableSearch =
|
|
6957
|
-
const [value, setValue] =
|
|
6958
|
-
const formRef =
|
|
7023
|
+
var ExpandableSearchContext = React6__namespace.createContext(null);
|
|
7024
|
+
var ExpandableSearch = React6__namespace.forwardRef(({ className, onAction, defaultValue = "", ...props }, ref) => {
|
|
7025
|
+
const [value, setValue] = React6__namespace.useState(defaultValue);
|
|
7026
|
+
const formRef = React6__namespace.useRef(null);
|
|
6959
7027
|
const handleAction = (e) => {
|
|
6960
7028
|
e.preventDefault();
|
|
6961
7029
|
if (onAction) {
|
|
@@ -6973,10 +7041,10 @@ var ExpandableSearch = React5__namespace.forwardRef(({ className, onAction, defa
|
|
|
6973
7041
|
) });
|
|
6974
7042
|
});
|
|
6975
7043
|
ExpandableSearch.displayName = "ExpandableSearch";
|
|
6976
|
-
var ExpandableSearchField =
|
|
6977
|
-
const context =
|
|
7044
|
+
var ExpandableSearchField = React6__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
7045
|
+
const context = React6__namespace.useContext(ExpandableSearchContext);
|
|
6978
7046
|
if (!context) throw new Error("ExpandableSearchField must be used within ExpandableSearch");
|
|
6979
|
-
const [isFocused, setIsFocused] =
|
|
7047
|
+
const [isFocused, setIsFocused] = React6__namespace.useState(false);
|
|
6980
7048
|
const isActive = context.value.length > 0 || isFocused;
|
|
6981
7049
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1", children: [
|
|
6982
7050
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "sr-only", htmlFor: "expandable-search", children: "Search" }),
|
|
@@ -7173,7 +7241,7 @@ function Toggle({
|
|
|
7173
7241
|
}
|
|
7174
7242
|
);
|
|
7175
7243
|
}
|
|
7176
|
-
var ToggleGroupContext =
|
|
7244
|
+
var ToggleGroupContext = React6__namespace.createContext({
|
|
7177
7245
|
size: "default",
|
|
7178
7246
|
variant: "ghost"
|
|
7179
7247
|
});
|
|
@@ -7206,7 +7274,7 @@ function ToggleGroupItem({
|
|
|
7206
7274
|
size,
|
|
7207
7275
|
...props
|
|
7208
7276
|
}) {
|
|
7209
|
-
const context =
|
|
7277
|
+
const context = React6__namespace.useContext(ToggleGroupContext);
|
|
7210
7278
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7211
7279
|
ToggleGroupPrimitive__namespace.Item,
|
|
7212
7280
|
{
|
|
@@ -7248,22 +7316,27 @@ function FormatToggle({ format, setFormat }) {
|
|
|
7248
7316
|
function Heading({
|
|
7249
7317
|
className,
|
|
7250
7318
|
trim = "normal",
|
|
7251
|
-
size =
|
|
7319
|
+
size = 1,
|
|
7252
7320
|
level = 1,
|
|
7321
|
+
display = false,
|
|
7253
7322
|
...props
|
|
7254
7323
|
}) {
|
|
7255
7324
|
const Element = `h${level}`;
|
|
7256
|
-
const
|
|
7257
|
-
1: "text-[calc(var(--font-size-1)_*_var(--heading-font-size-adjust))] leading-[var(--
|
|
7258
|
-
2: "text-[calc(var(--font-size-2)_*_var(--heading-font-size-adjust))] leading-[var(--
|
|
7259
|
-
3: "text-[calc(var(--font-size-3)_*_var(--heading-font-size-adjust))] leading-[var(--
|
|
7260
|
-
4: "text-[calc(var(--font-size-4)_*_var(--heading-font-size-adjust))] leading-[var(--
|
|
7261
|
-
5: "text-[calc(var(--font-size-5)_*_var(--heading-font-size-adjust))] leading-[var(--
|
|
7262
|
-
6: "text-[calc(var(--font-size-6)_*_var(--heading-font-size-adjust))] leading-[var(--
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7325
|
+
const headingSizeClasses = {
|
|
7326
|
+
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))]",
|
|
7327
|
+
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))]",
|
|
7328
|
+
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))]",
|
|
7329
|
+
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))]",
|
|
7330
|
+
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))]",
|
|
7331
|
+
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))]"
|
|
7332
|
+
};
|
|
7333
|
+
const displaySizeClasses = {
|
|
7334
|
+
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))]",
|
|
7335
|
+
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))]",
|
|
7336
|
+
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))]",
|
|
7337
|
+
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))]"
|
|
7266
7338
|
};
|
|
7339
|
+
const sizeClass = display ? displaySizeClasses[size] : headingSizeClasses[size];
|
|
7267
7340
|
const trimClasses = {
|
|
7268
7341
|
normal: ["before:content-none after:content-none"],
|
|
7269
7342
|
start: [
|
|
@@ -7291,7 +7364,7 @@ function Heading({
|
|
|
7291
7364
|
"leading-[var(--line-height)] font-[var(--heading-font-family)] font-bold",
|
|
7292
7365
|
"[--leading-trim-end:var(--heading-leading-trim-end)] [--leading-trim-start:var(--heading-leading-trim-start)]",
|
|
7293
7366
|
"text-primary-800 dark:text-white",
|
|
7294
|
-
|
|
7367
|
+
sizeClass
|
|
7295
7368
|
)
|
|
7296
7369
|
}
|
|
7297
7370
|
);
|
|
@@ -7299,7 +7372,7 @@ function Heading({
|
|
|
7299
7372
|
|
|
7300
7373
|
// package.json
|
|
7301
7374
|
var package_default = {
|
|
7302
|
-
version: "1.
|
|
7375
|
+
version: "1.22.0"};
|
|
7303
7376
|
function Logo(props) {
|
|
7304
7377
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7305
7378
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "NSW Government" }),
|
|
@@ -7341,9 +7414,9 @@ function Logo(props) {
|
|
|
7341
7414
|
}
|
|
7342
7415
|
function ThemeSwitcher() {
|
|
7343
7416
|
const { resolvedTheme, setTheme } = nextThemes.useTheme();
|
|
7344
|
-
const [mounted, setMounted] =
|
|
7417
|
+
const [mounted, setMounted] = React6.useState(false);
|
|
7345
7418
|
const classes = "fill-nsw-grey-600 dark:fill-nsw-grey-100";
|
|
7346
|
-
|
|
7419
|
+
React6.useEffect(() => {
|
|
7347
7420
|
setMounted(true);
|
|
7348
7421
|
}, []);
|
|
7349
7422
|
if (!mounted) {
|
|
@@ -7365,9 +7438,9 @@ function ThemeSwitcher() {
|
|
|
7365
7438
|
);
|
|
7366
7439
|
}
|
|
7367
7440
|
function SiteSearch({ navigation: navigation$1 }) {
|
|
7368
|
-
const [open, setOpen] =
|
|
7441
|
+
const [open, setOpen] = React6__namespace.useState(false);
|
|
7369
7442
|
const router = navigation.useRouter();
|
|
7370
|
-
|
|
7443
|
+
React6__namespace.useEffect(() => {
|
|
7371
7444
|
const down = (e) => {
|
|
7372
7445
|
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
|
|
7373
7446
|
e.preventDefault();
|
|
@@ -7377,7 +7450,7 @@ function SiteSearch({ navigation: navigation$1 }) {
|
|
|
7377
7450
|
document.addEventListener("keydown", down);
|
|
7378
7451
|
return () => document.removeEventListener("keydown", down);
|
|
7379
7452
|
}, []);
|
|
7380
|
-
const runCommand =
|
|
7453
|
+
const runCommand = React6__namespace.useCallback((command) => {
|
|
7381
7454
|
setOpen(false);
|
|
7382
7455
|
command();
|
|
7383
7456
|
}, []);
|
|
@@ -7420,8 +7493,8 @@ function Header2({
|
|
|
7420
7493
|
navigation,
|
|
7421
7494
|
version = false
|
|
7422
7495
|
}) {
|
|
7423
|
-
const [isScrolled, setIsScrolled] =
|
|
7424
|
-
|
|
7496
|
+
const [isScrolled, setIsScrolled] = React6.useState(false);
|
|
7497
|
+
React6.useEffect(() => {
|
|
7425
7498
|
function onScroll() {
|
|
7426
7499
|
setIsScrolled(window.scrollY > 0);
|
|
7427
7500
|
}
|
|
@@ -8311,7 +8384,7 @@ function Slider({
|
|
|
8311
8384
|
max = 100,
|
|
8312
8385
|
...props
|
|
8313
8386
|
}) {
|
|
8314
|
-
const _values =
|
|
8387
|
+
const _values = React6__namespace.useMemo(
|
|
8315
8388
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
8316
8389
|
[value, defaultValue, min, max]
|
|
8317
8390
|
);
|
|
@@ -8520,8 +8593,8 @@ function TableCaption({ className, ...props }) {
|
|
|
8520
8593
|
);
|
|
8521
8594
|
}
|
|
8522
8595
|
function TableOfContents({ tableOfContents }) {
|
|
8523
|
-
const [currentSection, setCurrentSection] =
|
|
8524
|
-
const getHeadings2 =
|
|
8596
|
+
const [currentSection, setCurrentSection] = React6.useState(tableOfContents[0]?.id);
|
|
8597
|
+
const getHeadings2 = React6.useCallback((tableOfContents2) => {
|
|
8525
8598
|
return tableOfContents2.flatMap((node) => [node.id, ...node.children.map((child) => child.id)]).map((id) => {
|
|
8526
8599
|
const el = document.getElementById(id);
|
|
8527
8600
|
if (!el) return null;
|
|
@@ -8531,7 +8604,7 @@ function TableOfContents({ tableOfContents }) {
|
|
|
8531
8604
|
return { id, top };
|
|
8532
8605
|
}).filter((x) => x !== null);
|
|
8533
8606
|
}, []);
|
|
8534
|
-
|
|
8607
|
+
React6.useEffect(() => {
|
|
8535
8608
|
if (tableOfContents.length === 0) return;
|
|
8536
8609
|
const headings = getHeadings2(tableOfContents);
|
|
8537
8610
|
function onScroll() {
|
|
@@ -8663,18 +8736,20 @@ function TabsContent({ className, ...props }) {
|
|
|
8663
8736
|
}
|
|
8664
8737
|
);
|
|
8665
8738
|
}
|
|
8666
|
-
function Text({ className, trim = "normal", size =
|
|
8667
|
-
const
|
|
8668
|
-
1: "text-[
|
|
8669
|
-
2: "text-[
|
|
8670
|
-
3: "text-[
|
|
8671
|
-
4: "text-[
|
|
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))]"
|
|
8739
|
+
function Text({ className, trim = "normal", size = 2, label = false, ...props }) {
|
|
8740
|
+
const textSizeClasses = {
|
|
8741
|
+
1: "text-[length:var(--font-size-1)] leading-[var(--line-height-28)] tracking-[var(--letter-spacing-0)]",
|
|
8742
|
+
2: "text-[length:var(--font-size-2)] leading-[var(--line-height-24)] tracking-[var(--letter-spacing-0)]",
|
|
8743
|
+
3: "text-[length:var(--font-size-3)] leading-[var(--line-height-20)] tracking-[var(--letter-spacing-0)]",
|
|
8744
|
+
4: "text-[length:var(--font-size-4)] leading-[var(--line-height-20)] tracking-[var(--letter-spacing-0)]"
|
|
8677
8745
|
};
|
|
8746
|
+
const labelSizeClasses = {
|
|
8747
|
+
1: "text-[length:var(--font-size-1)] leading-[var(--line-height-24)] tracking-[var(--letter-spacing-0)]",
|
|
8748
|
+
2: "text-[length:var(--font-size-2)] leading-[var(--line-height-20)] tracking-[var(--letter-spacing-0)]",
|
|
8749
|
+
3: "text-[length:var(--font-size-3)] leading-[var(--line-height-16)] tracking-[var(--letter-spacing-0)]",
|
|
8750
|
+
4: "text-[length:var(--font-size-4)] leading-[var(--line-height-16)] tracking-[var(--letter-spacing-0)]"
|
|
8751
|
+
};
|
|
8752
|
+
const sizeClass = label ? labelSizeClasses[size] : textSizeClasses[size];
|
|
8678
8753
|
const trimClasses = {
|
|
8679
8754
|
normal: ["before:content-none after:content-none"],
|
|
8680
8755
|
start: [
|
|
@@ -8696,12 +8771,7 @@ function Text({ className, trim = "normal", size = 8, ...props }) {
|
|
|
8696
8771
|
{
|
|
8697
8772
|
"data-slot": "text",
|
|
8698
8773
|
...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
|
-
)
|
|
8774
|
+
className: clsx11__default.default(className, trimClasses[trim], "text-grey-800 dark:text-grey-400", sizeClass)
|
|
8705
8775
|
}
|
|
8706
8776
|
);
|
|
8707
8777
|
}
|
|
@@ -8767,13 +8837,14 @@ function ThemeColorPalette() {
|
|
|
8767
8837
|
brand,
|
|
8768
8838
|
aboriginal
|
|
8769
8839
|
};
|
|
8770
|
-
const [format, setFormat] =
|
|
8771
|
-
const [viewMode, setViewMode] =
|
|
8772
|
-
const [themeCategory, setThemeCategory] =
|
|
8773
|
-
const [primaryColor, setPrimaryColor] =
|
|
8774
|
-
const [accentColor, setAccentColor] =
|
|
8775
|
-
const [
|
|
8776
|
-
const
|
|
8840
|
+
const [format, setFormat] = React6.useState("hex");
|
|
8841
|
+
const [viewMode, setViewMode] = React6.useState("grid");
|
|
8842
|
+
const [themeCategory, setThemeCategory] = React6.useState("brand");
|
|
8843
|
+
const [primaryColor, setPrimaryColor] = React6.useState("blue");
|
|
8844
|
+
const [accentColor, setAccentColor] = React6.useState("red");
|
|
8845
|
+
const [greyColor, setGreyColor] = React6.useState("grey");
|
|
8846
|
+
const [sheetOpen, setSheetOpen] = React6.useState(false);
|
|
8847
|
+
const filteredColorThemes = React6.useMemo(() => {
|
|
8777
8848
|
const filtered = {};
|
|
8778
8849
|
for (const category of Object.keys(colorThemes)) {
|
|
8779
8850
|
filtered[category] = Object.fromEntries(
|
|
@@ -8784,11 +8855,15 @@ function ThemeColorPalette() {
|
|
|
8784
8855
|
}
|
|
8785
8856
|
return filtered;
|
|
8786
8857
|
}, []);
|
|
8787
|
-
const availableAccentColors =
|
|
8858
|
+
const availableAccentColors = React6.useMemo(() => {
|
|
8788
8859
|
const allColors = Object.keys(filteredColorThemes[themeCategory]);
|
|
8789
8860
|
return allColors.filter((color) => color !== primaryColor);
|
|
8790
8861
|
}, [filteredColorThemes, themeCategory, primaryColor]);
|
|
8791
|
-
|
|
8862
|
+
React6.useEffect(() => {
|
|
8863
|
+
const neutralKey = Object.keys(colorThemes[themeCategory]).find((k) => k.toLowerCase().includes("grey")) ?? "";
|
|
8864
|
+
if (neutralKey && neutralKey !== greyColor) {
|
|
8865
|
+
setGreyColor(neutralKey);
|
|
8866
|
+
}
|
|
8792
8867
|
const availableColors = Object.keys(colorThemes[themeCategory]);
|
|
8793
8868
|
if (!availableColors.includes(primaryColor)) {
|
|
8794
8869
|
setPrimaryColor(availableColors[0]);
|
|
@@ -8803,8 +8878,8 @@ function ThemeColorPalette() {
|
|
|
8803
8878
|
setAccentColor(newAccentColor);
|
|
8804
8879
|
}
|
|
8805
8880
|
}
|
|
8806
|
-
}, [themeCategory, primaryColor, accentColor]);
|
|
8807
|
-
const currentColorPalette =
|
|
8881
|
+
}, [themeCategory, primaryColor, accentColor, greyColor]);
|
|
8882
|
+
const currentColorPalette = React6.useMemo(() => {
|
|
8808
8883
|
if (!colorThemes[themeCategory] || !colorThemes[themeCategory][primaryColor] || !colorThemes[themeCategory][accentColor]) {
|
|
8809
8884
|
return [
|
|
8810
8885
|
{
|
|
@@ -8876,6 +8951,8 @@ function ThemeColorPalette() {
|
|
|
8876
8951
|
setPrimaryColor,
|
|
8877
8952
|
accentColor,
|
|
8878
8953
|
setAccentColor,
|
|
8954
|
+
greyColor,
|
|
8955
|
+
setGreyColor,
|
|
8879
8956
|
availableAccentColors,
|
|
8880
8957
|
colorThemes: filteredColorThemes
|
|
8881
8958
|
}
|
|
@@ -8883,34 +8960,31 @@ function ThemeColorPalette() {
|
|
|
8883
8960
|
] })
|
|
8884
8961
|
] })
|
|
8885
8962
|
] }),
|
|
8886
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-12", children: currentColorPalette.map((theme2) =>
|
|
8887
|
-
|
|
8888
|
-
/* @__PURE__ */ jsxRuntime.
|
|
8889
|
-
|
|
8890
|
-
{
|
|
8891
|
-
|
|
8892
|
-
|
|
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)) })
|
|
8963
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-12", children: currentColorPalette.map((theme2) => {
|
|
8964
|
+
const baseKey = theme2.name === "Primary" ? primaryColor : theme2.name === "Accent" ? accentColor : "grey";
|
|
8965
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
8966
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-semibold", children: theme2.name }),
|
|
8967
|
+
/* @__PURE__ */ jsxRuntime.jsx(BaseColorSwatches, { baseColors: baseColors[themeCategory][baseKey], format }),
|
|
8968
|
+
/* @__PURE__ */ jsxRuntime.jsx(ColourScale, { colorsToUse: theme2.colors }),
|
|
8969
|
+
/* @__PURE__ */ jsxRuntime.jsx(ColorSwatches, { theme: theme2.colors, format, viewMode })
|
|
8970
|
+
] }, theme2.name);
|
|
8971
|
+
}) })
|
|
8898
8972
|
] });
|
|
8899
8973
|
}
|
|
8900
8974
|
function ThemeProvider({ children, ...props }) {
|
|
8901
8975
|
return /* @__PURE__ */ jsxRuntime.jsx(nextThemes.ThemeProvider, { ...props, children });
|
|
8902
8976
|
}
|
|
8903
|
-
var TocContext =
|
|
8977
|
+
var TocContext = React6.createContext({
|
|
8904
8978
|
toc: true,
|
|
8905
8979
|
setToc: () => {
|
|
8906
8980
|
}
|
|
8907
8981
|
});
|
|
8908
8982
|
function TocProvider({ children }) {
|
|
8909
|
-
const [toc, setToc] =
|
|
8983
|
+
const [toc, setToc] = React6.useState(true);
|
|
8910
8984
|
return /* @__PURE__ */ jsxRuntime.jsx(TocContext.Provider, { value: { toc, setToc }, children });
|
|
8911
8985
|
}
|
|
8912
8986
|
function useToc() {
|
|
8913
|
-
return
|
|
8987
|
+
return React6.useContext(TocContext);
|
|
8914
8988
|
}
|
|
8915
8989
|
function getNodeText(node) {
|
|
8916
8990
|
let text = "";
|
|
@@ -8990,7 +9064,8 @@ var languages = [
|
|
|
8990
9064
|
"jsx",
|
|
8991
9065
|
"ts",
|
|
8992
9066
|
"tsx",
|
|
8993
|
-
"typescript"
|
|
9067
|
+
"typescript",
|
|
9068
|
+
"html"
|
|
8994
9069
|
];
|
|
8995
9070
|
|
|
8996
9071
|
exports.Accordion = Accordion;
|