@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.js
CHANGED
|
@@ -6,8 +6,8 @@ import { cva } from 'class-variance-authority';
|
|
|
6
6
|
import * as AspectRatioPrimitive from '@radix-ui/react-aspect-ratio';
|
|
7
7
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
8
8
|
import * as Headless from '@headlessui/react';
|
|
9
|
-
import * as
|
|
10
|
-
import { forwardRef, createContext, useRef, useState,
|
|
9
|
+
import * as React6 from 'react';
|
|
10
|
+
import React6__default, { forwardRef, useEffect, createContext, useRef, useState, useMemo, useCallback, useContext } from 'react';
|
|
11
11
|
import Link3 from 'next/link';
|
|
12
12
|
import * as culori from 'culori';
|
|
13
13
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -1809,7 +1809,7 @@ function Breadcrumbs({
|
|
|
1809
1809
|
});
|
|
1810
1810
|
const shouldCollapse = breadcrumbItems.length > maxItems;
|
|
1811
1811
|
if (!shouldCollapse) {
|
|
1812
|
-
return /* @__PURE__ */ jsx(Breadcrumb, { className: "-ml-1", children: /* @__PURE__ */ jsx(BreadcrumbList, { children: breadcrumbItems.map((item, index) => /* @__PURE__ */ jsxs(
|
|
1812
|
+
return /* @__PURE__ */ jsx(Breadcrumb, { className: "-ml-1", children: /* @__PURE__ */ jsx(BreadcrumbList, { children: breadcrumbItems.map((item, index) => /* @__PURE__ */ jsxs(React6.Fragment, { children: [
|
|
1813
1813
|
/* @__PURE__ */ jsx(BreadcrumbItem, { children: item.isCurrent ? /* @__PURE__ */ jsx(BreadcrumbPage, { children: item.label }) : /* @__PURE__ */ jsx(BreadcrumbLink, { asChild: true, children: /* @__PURE__ */ jsx(Link3, { href: item.path, children: item.label }) }) }),
|
|
1814
1814
|
index < breadcrumbItems.length - 1 && /* @__PURE__ */ jsx(BreadcrumbSeparator, {})
|
|
1815
1815
|
] }, item.path)) }) });
|
|
@@ -1820,7 +1820,7 @@ function Breadcrumbs({
|
|
|
1820
1820
|
const itemsAtEnd = breadcrumbItems.slice(-endItems);
|
|
1821
1821
|
const collapsedItems = breadcrumbItems.slice(startItems, breadcrumbItems.length - endItems);
|
|
1822
1822
|
return /* @__PURE__ */ jsx(Breadcrumb, { children: /* @__PURE__ */ jsxs(BreadcrumbList, { children: [
|
|
1823
|
-
itemsAtStart.map((item, index) => /* @__PURE__ */ jsxs(
|
|
1823
|
+
itemsAtStart.map((item, index) => /* @__PURE__ */ jsxs(React6.Fragment, { children: [
|
|
1824
1824
|
/* @__PURE__ */ jsx(BreadcrumbItem, { children: item.isCurrent ? /* @__PURE__ */ jsx(BreadcrumbPage, { children: item.label }) : /* @__PURE__ */ jsx(BreadcrumbLink, { asChild: true, children: /* @__PURE__ */ jsx(Link3, { href: item.path, children: item.label }) }) }),
|
|
1825
1825
|
index < itemsAtStart.length - 1 && /* @__PURE__ */ jsx(BreadcrumbSeparator, {})
|
|
1826
1826
|
] }, item.path)),
|
|
@@ -1833,7 +1833,7 @@ function Breadcrumbs({
|
|
|
1833
1833
|
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", children: collapsedItems.map((item) => /* @__PURE__ */ jsx(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsx(Link3, { href: item.path, children: item.label }) }, item.path)) })
|
|
1834
1834
|
] }) }),
|
|
1835
1835
|
itemsAtEnd.length > 0 && /* @__PURE__ */ jsx(BreadcrumbSeparator, {}),
|
|
1836
|
-
itemsAtEnd.map((item, index) => /* @__PURE__ */ jsxs(
|
|
1836
|
+
itemsAtEnd.map((item, index) => /* @__PURE__ */ jsxs(React6.Fragment, { children: [
|
|
1837
1837
|
/* @__PURE__ */ jsx(BreadcrumbItem, { children: item.isCurrent ? /* @__PURE__ */ jsx(BreadcrumbPage, { children: item.label }) : /* @__PURE__ */ jsx(BreadcrumbLink, { asChild: true, children: /* @__PURE__ */ jsx(Link3, { href: item.path, children: item.label }) }) }),
|
|
1838
1838
|
index < itemsAtEnd.length - 1 && /* @__PURE__ */ jsx(BreadcrumbSeparator, {})
|
|
1839
1839
|
] }, item.path))
|
|
@@ -2394,6 +2394,7 @@ function SegmentedControlTrigger({
|
|
|
2394
2394
|
}
|
|
2395
2395
|
);
|
|
2396
2396
|
}
|
|
2397
|
+
var findGreyKey = (themes) => Object.keys(themes).find((k) => k.toLowerCase().includes("grey")) ?? "";
|
|
2397
2398
|
function ThemeSelector({
|
|
2398
2399
|
themeCategory,
|
|
2399
2400
|
setThemeCategory,
|
|
@@ -2401,12 +2402,18 @@ function ThemeSelector({
|
|
|
2401
2402
|
setPrimaryColor,
|
|
2402
2403
|
accentColor,
|
|
2403
2404
|
setAccentColor,
|
|
2405
|
+
greyColor,
|
|
2406
|
+
setGreyColor,
|
|
2404
2407
|
availableAccentColors,
|
|
2405
2408
|
colorThemes: colorThemes2
|
|
2406
2409
|
}) {
|
|
2407
2410
|
const handleCategoryChange = (newCategory) => {
|
|
2408
2411
|
setThemeCategory(newCategory);
|
|
2409
2412
|
const availableColors = Object.keys(colorThemes2[newCategory]);
|
|
2413
|
+
const neutral = findGreyKey(colorThemes2[newCategory]);
|
|
2414
|
+
if (neutral && neutral !== greyColor) {
|
|
2415
|
+
setGreyColor(neutral);
|
|
2416
|
+
}
|
|
2410
2417
|
if (availableColors.length > 0) {
|
|
2411
2418
|
if (availableColors.includes(primaryColor)) {
|
|
2412
2419
|
const newAccentColor = availableColors.find((color) => color !== primaryColor);
|
|
@@ -5889,8 +5896,9 @@ var colors = {
|
|
|
5889
5896
|
}
|
|
5890
5897
|
};
|
|
5891
5898
|
var colorThemes = generateColorThemes(colors);
|
|
5892
|
-
function CodeDemo({ data }) {
|
|
5899
|
+
function CodeDemo({ data, hide = {} }) {
|
|
5893
5900
|
const { resolvedTheme } = useTheme();
|
|
5901
|
+
const { rtl = false, darkMode = false, themeSelector = false } = hide;
|
|
5894
5902
|
const [tabIndex, setTabIndex] = useState(0);
|
|
5895
5903
|
const [variant, setVariant] = useState(getInitialVariant(data));
|
|
5896
5904
|
const [view, setView] = useState("desktop");
|
|
@@ -5901,9 +5909,35 @@ function CodeDemo({ data }) {
|
|
|
5901
5909
|
const [themeCategory, setThemeCategory] = useState("brand");
|
|
5902
5910
|
const [primaryColor, setPrimaryColor] = useState("blue");
|
|
5903
5911
|
const [accentColor, setAccentColor] = useState("red");
|
|
5912
|
+
const [greyColor, setGreyColor] = useState("grey");
|
|
5904
5913
|
useEffect(() => {
|
|
5905
5914
|
setDarkMode(resolvedTheme === "dark");
|
|
5906
5915
|
}, [resolvedTheme]);
|
|
5916
|
+
const iframeRef = useRef(null);
|
|
5917
|
+
const getShades = (prefix, colorKey, themeCat) => colors[themeCat][colorKey].colors.reduce((acc, shade) => {
|
|
5918
|
+
const suffix = shade.token.split("-").pop();
|
|
5919
|
+
acc[`${prefix}${suffix}`] = shade.hex;
|
|
5920
|
+
return acc;
|
|
5921
|
+
}, {});
|
|
5922
|
+
const themeValues = React6__default.useMemo(
|
|
5923
|
+
() => ({
|
|
5924
|
+
...getShades("primary", primaryColor, themeCategory),
|
|
5925
|
+
...getShades("accent", accentColor, themeCategory),
|
|
5926
|
+
...getShades("grey", greyColor, themeCategory)
|
|
5927
|
+
}),
|
|
5928
|
+
[themeCategory, primaryColor, accentColor, greyColor]
|
|
5929
|
+
);
|
|
5930
|
+
React6__default.useEffect(() => {
|
|
5931
|
+
const frame = iframeRef.current;
|
|
5932
|
+
if (!frame) return;
|
|
5933
|
+
const send = () => {
|
|
5934
|
+
const msg = { type: "nswds-theme", payload: themeValues };
|
|
5935
|
+
frame.contentWindow?.postMessage(msg, "*");
|
|
5936
|
+
};
|
|
5937
|
+
send();
|
|
5938
|
+
frame.addEventListener("load", send);
|
|
5939
|
+
return () => frame.removeEventListener("load", send);
|
|
5940
|
+
}, [themeValues]);
|
|
5907
5941
|
function copyToClipboard(value) {
|
|
5908
5942
|
setJustCopied(true);
|
|
5909
5943
|
navigator.clipboard.writeText(value);
|
|
@@ -5947,6 +5981,14 @@ function CodeDemo({ data }) {
|
|
|
5947
5981
|
function countLines(value) {
|
|
5948
5982
|
return (value.match(/\n/g) || "").length + 1;
|
|
5949
5983
|
}
|
|
5984
|
+
function selectIframe(data2, currentVariant) {
|
|
5985
|
+
const { iframe } = data2;
|
|
5986
|
+
if (!iframe) return;
|
|
5987
|
+
if (typeof iframe === "number") return iframe;
|
|
5988
|
+
if ("src" in iframe) return iframe;
|
|
5989
|
+
return iframe[currentVariant];
|
|
5990
|
+
}
|
|
5991
|
+
const iframeData = selectIframe(data, variant);
|
|
5950
5992
|
const variants = getVariants(data);
|
|
5951
5993
|
const code = getCode(data, variant);
|
|
5952
5994
|
const codeItems = getCodeItems(code);
|
|
@@ -5957,7 +5999,7 @@ function CodeDemo({ data }) {
|
|
|
5957
5999
|
/* @__PURE__ */ jsx(EditOnGithubButton, { githubSlug: data.githubSlug }),
|
|
5958
6000
|
/* @__PURE__ */ jsx(ToggleViewButtons, { onSelect: setView }),
|
|
5959
6001
|
/* @__PURE__ */ jsxs("div", { className: "col-span-1 flex justify-end gap-3", children: [
|
|
5960
|
-
/* @__PURE__ */ jsx(
|
|
6002
|
+
!themeSelector && /* @__PURE__ */ jsx(
|
|
5961
6003
|
ThemeSelectorDropDown,
|
|
5962
6004
|
{
|
|
5963
6005
|
themeCategory,
|
|
@@ -5965,11 +6007,13 @@ function CodeDemo({ data }) {
|
|
|
5965
6007
|
primaryColor,
|
|
5966
6008
|
setPrimaryColor,
|
|
5967
6009
|
accentColor,
|
|
5968
|
-
setAccentColor
|
|
6010
|
+
setAccentColor,
|
|
6011
|
+
greyColor,
|
|
6012
|
+
setGreyColor
|
|
5969
6013
|
}
|
|
5970
6014
|
),
|
|
5971
|
-
/* @__PURE__ */ jsx(ToggleRTLButton, { isRTL, onClick: () => setIsRTL((state) => !state) }),
|
|
5972
|
-
/* @__PURE__ */ jsx(
|
|
6015
|
+
!rtl && /* @__PURE__ */ jsx(ToggleRTLButton, { isRTL, onClick: () => setIsRTL((state) => !state) }),
|
|
6016
|
+
!darkMode && /* @__PURE__ */ jsx(
|
|
5973
6017
|
ToggleDarkModeButton,
|
|
5974
6018
|
{
|
|
5975
6019
|
isDarkMode,
|
|
@@ -5984,11 +6028,18 @@ function CodeDemo({ data }) {
|
|
|
5984
6028
|
view,
|
|
5985
6029
|
isRTL,
|
|
5986
6030
|
isDarkMode,
|
|
5987
|
-
iframe:
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
6031
|
+
iframe: iframeData,
|
|
6032
|
+
themeValues,
|
|
6033
|
+
children: iframeData ? /* @__PURE__ */ jsx(
|
|
6034
|
+
IFrame,
|
|
6035
|
+
{
|
|
6036
|
+
sandbox: "allow-scripts allow-same-origin",
|
|
6037
|
+
ref: iframeRef,
|
|
6038
|
+
iframe: iframeData,
|
|
6039
|
+
isRTL,
|
|
6040
|
+
isDarkMode
|
|
6041
|
+
}
|
|
6042
|
+
) : /* @__PURE__ */ jsx(Fragment, { children: data.component })
|
|
5992
6043
|
}
|
|
5993
6044
|
),
|
|
5994
6045
|
/* @__PURE__ */ jsx("div", { className: "code-syntax-wrapper", children: /* @__PURE__ */ jsxs(
|
|
@@ -6033,31 +6084,29 @@ function CodeDemo({ data }) {
|
|
|
6033
6084
|
) })
|
|
6034
6085
|
] });
|
|
6035
6086
|
}
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
}
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
const finalWidth = width === 100 ? "100%" : width;
|
|
6057
|
-
return /* @__PURE__ */ jsx("iframe", { ref, src: finalSrc, height, width: finalWidth, className: "w-full" });
|
|
6087
|
+
var IFrame = React6__default.forwardRef(
|
|
6088
|
+
({ iframe, isRTL, isDarkMode }, ref) => {
|
|
6089
|
+
useEffect(() => {
|
|
6090
|
+
const document2 = ref?.current?.contentDocument;
|
|
6091
|
+
const root = document2?.documentElement;
|
|
6092
|
+
if (document2 && root) {
|
|
6093
|
+
root.setAttribute("dir", isRTL ? "rtl" : "ltr");
|
|
6094
|
+
root.classList.toggle("dark", !!isDarkMode);
|
|
6095
|
+
}
|
|
6096
|
+
}, [isRTL, isDarkMode, ref]);
|
|
6097
|
+
if (typeof iframe === "number") {
|
|
6098
|
+
return /* @__PURE__ */ jsx("iframe", { ref, src: "", height: iframe, width: "100%", className: "w-full" });
|
|
6099
|
+
}
|
|
6100
|
+
if (typeof iframe === "object" && iframe?.src) {
|
|
6101
|
+
const { src, height = 0, width = 100, noPadding } = iframe;
|
|
6102
|
+
const finalSrc = noPadding ? `${src}?noPadding` : src;
|
|
6103
|
+
const finalWidth = width === 100 ? "100%" : width;
|
|
6104
|
+
return /* @__PURE__ */ jsx("iframe", { ref, src: finalSrc, height, width: finalWidth, className: "w-full" });
|
|
6105
|
+
}
|
|
6106
|
+
return null;
|
|
6058
6107
|
}
|
|
6059
|
-
|
|
6060
|
-
|
|
6108
|
+
);
|
|
6109
|
+
IFrame.displayName = "IFrame";
|
|
6061
6110
|
function Tabs({
|
|
6062
6111
|
tabIndex,
|
|
6063
6112
|
items,
|
|
@@ -6079,19 +6128,22 @@ function CodePreview({
|
|
|
6079
6128
|
isRTL,
|
|
6080
6129
|
isDarkMode,
|
|
6081
6130
|
iframe,
|
|
6082
|
-
|
|
6083
|
-
primaryColor,
|
|
6084
|
-
themeCategory,
|
|
6131
|
+
themeValues,
|
|
6085
6132
|
children
|
|
6086
6133
|
}) {
|
|
6087
|
-
const
|
|
6088
|
-
|
|
6134
|
+
const cssVars = React6__default.useMemo(() => {
|
|
6135
|
+
const withCssVarNames = Object.entries(themeValues).map(([key, value]) => {
|
|
6136
|
+
const kebab = key.replace(/(\D+)(\d+)/, "$1-$2");
|
|
6137
|
+
return [`--color-${kebab}`, value];
|
|
6138
|
+
});
|
|
6139
|
+
return Object.fromEntries(withCssVarNames);
|
|
6140
|
+
}, [themeValues]);
|
|
6089
6141
|
return /* @__PURE__ */ jsx(
|
|
6090
6142
|
"div",
|
|
6091
6143
|
{
|
|
6092
6144
|
...isRTL && { dir: "rtl" },
|
|
6093
6145
|
className: "code-preview-wrapper",
|
|
6094
|
-
style:
|
|
6146
|
+
style: cssVars,
|
|
6095
6147
|
children: /* @__PURE__ */ 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__ */ jsx(
|
|
6096
6148
|
"div",
|
|
6097
6149
|
{
|
|
@@ -6119,7 +6171,7 @@ function CodePreview({
|
|
|
6119
6171
|
);
|
|
6120
6172
|
}
|
|
6121
6173
|
function EditOnGithubButton({ githubSlug }) {
|
|
6122
|
-
const githubSrcHref = "https://github.com
|
|
6174
|
+
const githubSrcHref = "https://github.com";
|
|
6123
6175
|
const href = `${githubSrcHref}${githubSlug}`;
|
|
6124
6176
|
return /* @__PURE__ */ jsxs(
|
|
6125
6177
|
Button2,
|
|
@@ -6151,7 +6203,9 @@ function ThemeSelectorDropDown({
|
|
|
6151
6203
|
primaryColor,
|
|
6152
6204
|
setPrimaryColor,
|
|
6153
6205
|
accentColor,
|
|
6154
|
-
setAccentColor
|
|
6206
|
+
setAccentColor,
|
|
6207
|
+
greyColor,
|
|
6208
|
+
setGreyColor
|
|
6155
6209
|
}) {
|
|
6156
6210
|
const filteredColorThemes = useMemo(() => {
|
|
6157
6211
|
const filtered = {};
|
|
@@ -6169,6 +6223,10 @@ function ThemeSelectorDropDown({
|
|
|
6169
6223
|
return allColors.filter((color) => color !== primaryColor);
|
|
6170
6224
|
}, [filteredColorThemes, themeCategory, primaryColor]);
|
|
6171
6225
|
useEffect(() => {
|
|
6226
|
+
const neutralKey = Object.keys(colorThemes[themeCategory]).find((k) => k.toLowerCase().includes("grey")) ?? "";
|
|
6227
|
+
if (neutralKey && neutralKey !== greyColor) {
|
|
6228
|
+
setGreyColor(neutralKey);
|
|
6229
|
+
}
|
|
6172
6230
|
const availableColors = Object.keys(colorThemes[themeCategory]);
|
|
6173
6231
|
if (!availableColors.includes(primaryColor)) {
|
|
6174
6232
|
setPrimaryColor(availableColors[0]);
|
|
@@ -6183,7 +6241,15 @@ function ThemeSelectorDropDown({
|
|
|
6183
6241
|
setAccentColor(newAccentColor);
|
|
6184
6242
|
}
|
|
6185
6243
|
}
|
|
6186
|
-
}, [
|
|
6244
|
+
}, [
|
|
6245
|
+
themeCategory,
|
|
6246
|
+
primaryColor,
|
|
6247
|
+
accentColor,
|
|
6248
|
+
greyColor,
|
|
6249
|
+
setPrimaryColor,
|
|
6250
|
+
setAccentColor,
|
|
6251
|
+
setGreyColor
|
|
6252
|
+
]);
|
|
6187
6253
|
const primaryColorSwatch = colorThemes[themeCategory][primaryColor]?.colors[3]?.hex || "#000000";
|
|
6188
6254
|
const accentColorSwatch = colorThemes[themeCategory][accentColor]?.colors[2]?.hex || "#000000";
|
|
6189
6255
|
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
@@ -6204,6 +6270,8 @@ function ThemeSelectorDropDown({
|
|
|
6204
6270
|
setPrimaryColor,
|
|
6205
6271
|
accentColor,
|
|
6206
6272
|
setAccentColor,
|
|
6273
|
+
greyColor,
|
|
6274
|
+
setGreyColor,
|
|
6207
6275
|
availableAccentColors,
|
|
6208
6276
|
colorThemes: filteredColorThemes
|
|
6209
6277
|
}
|
|
@@ -6900,10 +6968,10 @@ function DynamicFavicon({ lightModeFavicon, darkModeFavicon }) {
|
|
|
6900
6968
|
}, [lightModeFavicon, darkModeFavicon]);
|
|
6901
6969
|
return null;
|
|
6902
6970
|
}
|
|
6903
|
-
var ExpandableSearchContext =
|
|
6904
|
-
var ExpandableSearch =
|
|
6905
|
-
const [value, setValue] =
|
|
6906
|
-
const formRef =
|
|
6971
|
+
var ExpandableSearchContext = React6.createContext(null);
|
|
6972
|
+
var ExpandableSearch = React6.forwardRef(({ className, onAction, defaultValue = "", ...props }, ref) => {
|
|
6973
|
+
const [value, setValue] = React6.useState(defaultValue);
|
|
6974
|
+
const formRef = React6.useRef(null);
|
|
6907
6975
|
const handleAction = (e) => {
|
|
6908
6976
|
e.preventDefault();
|
|
6909
6977
|
if (onAction) {
|
|
@@ -6921,10 +6989,10 @@ var ExpandableSearch = React5.forwardRef(({ className, onAction, defaultValue =
|
|
|
6921
6989
|
) });
|
|
6922
6990
|
});
|
|
6923
6991
|
ExpandableSearch.displayName = "ExpandableSearch";
|
|
6924
|
-
var ExpandableSearchField =
|
|
6925
|
-
const context =
|
|
6992
|
+
var ExpandableSearchField = React6.forwardRef(({ className, ...props }, ref) => {
|
|
6993
|
+
const context = React6.useContext(ExpandableSearchContext);
|
|
6926
6994
|
if (!context) throw new Error("ExpandableSearchField must be used within ExpandableSearch");
|
|
6927
|
-
const [isFocused, setIsFocused] =
|
|
6995
|
+
const [isFocused, setIsFocused] = React6.useState(false);
|
|
6928
6996
|
const isActive = context.value.length > 0 || isFocused;
|
|
6929
6997
|
return /* @__PURE__ */ jsxs("div", { className: "relative flex-1", children: [
|
|
6930
6998
|
/* @__PURE__ */ jsx("label", { className: "sr-only", htmlFor: "expandable-search", children: "Search" }),
|
|
@@ -7121,7 +7189,7 @@ function Toggle({
|
|
|
7121
7189
|
}
|
|
7122
7190
|
);
|
|
7123
7191
|
}
|
|
7124
|
-
var ToggleGroupContext =
|
|
7192
|
+
var ToggleGroupContext = React6.createContext({
|
|
7125
7193
|
size: "default",
|
|
7126
7194
|
variant: "ghost"
|
|
7127
7195
|
});
|
|
@@ -7154,7 +7222,7 @@ function ToggleGroupItem({
|
|
|
7154
7222
|
size,
|
|
7155
7223
|
...props
|
|
7156
7224
|
}) {
|
|
7157
|
-
const context =
|
|
7225
|
+
const context = React6.useContext(ToggleGroupContext);
|
|
7158
7226
|
return /* @__PURE__ */ jsx(
|
|
7159
7227
|
ToggleGroupPrimitive.Item,
|
|
7160
7228
|
{
|
|
@@ -7196,22 +7264,27 @@ function FormatToggle({ format, setFormat }) {
|
|
|
7196
7264
|
function Heading({
|
|
7197
7265
|
className,
|
|
7198
7266
|
trim = "normal",
|
|
7199
|
-
size =
|
|
7267
|
+
size = 1,
|
|
7200
7268
|
level = 1,
|
|
7269
|
+
display = false,
|
|
7201
7270
|
...props
|
|
7202
7271
|
}) {
|
|
7203
7272
|
const Element = `h${level}`;
|
|
7204
|
-
const
|
|
7205
|
-
1: "text-[calc(var(--font-size-1)_*_var(--heading-font-size-adjust))] leading-[var(--
|
|
7206
|
-
2: "text-[calc(var(--font-size-2)_*_var(--heading-font-size-adjust))] leading-[var(--
|
|
7207
|
-
3: "text-[calc(var(--font-size-3)_*_var(--heading-font-size-adjust))] leading-[var(--
|
|
7208
|
-
4: "text-[calc(var(--font-size-4)_*_var(--heading-font-size-adjust))] leading-[var(--
|
|
7209
|
-
5: "text-[calc(var(--font-size-5)_*_var(--heading-font-size-adjust))] leading-[var(--
|
|
7210
|
-
6: "text-[calc(var(--font-size-6)_*_var(--heading-font-size-adjust))] leading-[var(--
|
|
7211
|
-
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))]",
|
|
7212
|
-
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))]",
|
|
7213
|
-
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))]"
|
|
7273
|
+
const headingSizeClasses = {
|
|
7274
|
+
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))]",
|
|
7275
|
+
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))]",
|
|
7276
|
+
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))]",
|
|
7277
|
+
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))]",
|
|
7278
|
+
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))]",
|
|
7279
|
+
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))]"
|
|
7214
7280
|
};
|
|
7281
|
+
const displaySizeClasses = {
|
|
7282
|
+
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))]",
|
|
7283
|
+
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))]",
|
|
7284
|
+
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))]",
|
|
7285
|
+
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))]"
|
|
7286
|
+
};
|
|
7287
|
+
const sizeClass = display ? displaySizeClasses[size] : headingSizeClasses[size];
|
|
7215
7288
|
const trimClasses = {
|
|
7216
7289
|
normal: ["before:content-none after:content-none"],
|
|
7217
7290
|
start: [
|
|
@@ -7239,7 +7312,7 @@ function Heading({
|
|
|
7239
7312
|
"leading-[var(--line-height)] font-[var(--heading-font-family)] font-bold",
|
|
7240
7313
|
"[--leading-trim-end:var(--heading-leading-trim-end)] [--leading-trim-start:var(--heading-leading-trim-start)]",
|
|
7241
7314
|
"text-primary-800 dark:text-white",
|
|
7242
|
-
|
|
7315
|
+
sizeClass
|
|
7243
7316
|
)
|
|
7244
7317
|
}
|
|
7245
7318
|
);
|
|
@@ -7247,7 +7320,7 @@ function Heading({
|
|
|
7247
7320
|
|
|
7248
7321
|
// package.json
|
|
7249
7322
|
var package_default = {
|
|
7250
|
-
version: "1.
|
|
7323
|
+
version: "1.22.0"};
|
|
7251
7324
|
function Logo(props) {
|
|
7252
7325
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7253
7326
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "NSW Government" }),
|
|
@@ -7313,9 +7386,9 @@ function ThemeSwitcher() {
|
|
|
7313
7386
|
);
|
|
7314
7387
|
}
|
|
7315
7388
|
function SiteSearch({ navigation }) {
|
|
7316
|
-
const [open, setOpen] =
|
|
7389
|
+
const [open, setOpen] = React6.useState(false);
|
|
7317
7390
|
const router = useRouter();
|
|
7318
|
-
|
|
7391
|
+
React6.useEffect(() => {
|
|
7319
7392
|
const down = (e) => {
|
|
7320
7393
|
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
|
|
7321
7394
|
e.preventDefault();
|
|
@@ -7325,7 +7398,7 @@ function SiteSearch({ navigation }) {
|
|
|
7325
7398
|
document.addEventListener("keydown", down);
|
|
7326
7399
|
return () => document.removeEventListener("keydown", down);
|
|
7327
7400
|
}, []);
|
|
7328
|
-
const runCommand =
|
|
7401
|
+
const runCommand = React6.useCallback((command) => {
|
|
7329
7402
|
setOpen(false);
|
|
7330
7403
|
command();
|
|
7331
7404
|
}, []);
|
|
@@ -8259,7 +8332,7 @@ function Slider({
|
|
|
8259
8332
|
max = 100,
|
|
8260
8333
|
...props
|
|
8261
8334
|
}) {
|
|
8262
|
-
const _values =
|
|
8335
|
+
const _values = React6.useMemo(
|
|
8263
8336
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
8264
8337
|
[value, defaultValue, min, max]
|
|
8265
8338
|
);
|
|
@@ -8611,18 +8684,20 @@ function TabsContent({ className, ...props }) {
|
|
|
8611
8684
|
}
|
|
8612
8685
|
);
|
|
8613
8686
|
}
|
|
8614
|
-
function Text({ className, trim = "normal", size =
|
|
8615
|
-
const
|
|
8616
|
-
1: "text-[
|
|
8617
|
-
2: "text-[
|
|
8618
|
-
3: "text-[
|
|
8619
|
-
4: "text-[
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8687
|
+
function Text({ className, trim = "normal", size = 2, label = false, ...props }) {
|
|
8688
|
+
const textSizeClasses = {
|
|
8689
|
+
1: "text-[length:var(--font-size-1)] leading-[var(--line-height-28)] tracking-[var(--letter-spacing-0)]",
|
|
8690
|
+
2: "text-[length:var(--font-size-2)] leading-[var(--line-height-24)] tracking-[var(--letter-spacing-0)]",
|
|
8691
|
+
3: "text-[length:var(--font-size-3)] leading-[var(--line-height-20)] tracking-[var(--letter-spacing-0)]",
|
|
8692
|
+
4: "text-[length:var(--font-size-4)] leading-[var(--line-height-20)] tracking-[var(--letter-spacing-0)]"
|
|
8693
|
+
};
|
|
8694
|
+
const labelSizeClasses = {
|
|
8695
|
+
1: "text-[length:var(--font-size-1)] leading-[var(--line-height-24)] tracking-[var(--letter-spacing-0)]",
|
|
8696
|
+
2: "text-[length:var(--font-size-2)] leading-[var(--line-height-20)] tracking-[var(--letter-spacing-0)]",
|
|
8697
|
+
3: "text-[length:var(--font-size-3)] leading-[var(--line-height-16)] tracking-[var(--letter-spacing-0)]",
|
|
8698
|
+
4: "text-[length:var(--font-size-4)] leading-[var(--line-height-16)] tracking-[var(--letter-spacing-0)]"
|
|
8625
8699
|
};
|
|
8700
|
+
const sizeClass = label ? labelSizeClasses[size] : textSizeClasses[size];
|
|
8626
8701
|
const trimClasses = {
|
|
8627
8702
|
normal: ["before:content-none after:content-none"],
|
|
8628
8703
|
start: [
|
|
@@ -8644,12 +8719,7 @@ function Text({ className, trim = "normal", size = 8, ...props }) {
|
|
|
8644
8719
|
{
|
|
8645
8720
|
"data-slot": "text",
|
|
8646
8721
|
...props,
|
|
8647
|
-
className: clsx11(
|
|
8648
|
-
className,
|
|
8649
|
-
trimClasses[trim],
|
|
8650
|
-
"text-grey-800 dark:text-grey-400 text-base/6 sm:text-sm/6",
|
|
8651
|
-
sizeClasses[size]
|
|
8652
|
-
)
|
|
8722
|
+
className: clsx11(className, trimClasses[trim], "text-grey-800 dark:text-grey-400", sizeClass)
|
|
8653
8723
|
}
|
|
8654
8724
|
);
|
|
8655
8725
|
}
|
|
@@ -8720,6 +8790,7 @@ function ThemeColorPalette() {
|
|
|
8720
8790
|
const [themeCategory, setThemeCategory] = useState("brand");
|
|
8721
8791
|
const [primaryColor, setPrimaryColor] = useState("blue");
|
|
8722
8792
|
const [accentColor, setAccentColor] = useState("red");
|
|
8793
|
+
const [greyColor, setGreyColor] = useState("grey");
|
|
8723
8794
|
const [sheetOpen, setSheetOpen] = useState(false);
|
|
8724
8795
|
const filteredColorThemes = useMemo(() => {
|
|
8725
8796
|
const filtered = {};
|
|
@@ -8737,6 +8808,10 @@ function ThemeColorPalette() {
|
|
|
8737
8808
|
return allColors.filter((color) => color !== primaryColor);
|
|
8738
8809
|
}, [filteredColorThemes, themeCategory, primaryColor]);
|
|
8739
8810
|
useEffect(() => {
|
|
8811
|
+
const neutralKey = Object.keys(colorThemes[themeCategory]).find((k) => k.toLowerCase().includes("grey")) ?? "";
|
|
8812
|
+
if (neutralKey && neutralKey !== greyColor) {
|
|
8813
|
+
setGreyColor(neutralKey);
|
|
8814
|
+
}
|
|
8740
8815
|
const availableColors = Object.keys(colorThemes[themeCategory]);
|
|
8741
8816
|
if (!availableColors.includes(primaryColor)) {
|
|
8742
8817
|
setPrimaryColor(availableColors[0]);
|
|
@@ -8751,7 +8826,7 @@ function ThemeColorPalette() {
|
|
|
8751
8826
|
setAccentColor(newAccentColor);
|
|
8752
8827
|
}
|
|
8753
8828
|
}
|
|
8754
|
-
}, [themeCategory, primaryColor, accentColor]);
|
|
8829
|
+
}, [themeCategory, primaryColor, accentColor, greyColor]);
|
|
8755
8830
|
const currentColorPalette = useMemo(() => {
|
|
8756
8831
|
if (!colorThemes[themeCategory] || !colorThemes[themeCategory][primaryColor] || !colorThemes[themeCategory][accentColor]) {
|
|
8757
8832
|
return [
|
|
@@ -8824,6 +8899,8 @@ function ThemeColorPalette() {
|
|
|
8824
8899
|
setPrimaryColor,
|
|
8825
8900
|
accentColor,
|
|
8826
8901
|
setAccentColor,
|
|
8902
|
+
greyColor,
|
|
8903
|
+
setGreyColor,
|
|
8827
8904
|
availableAccentColors,
|
|
8828
8905
|
colorThemes: filteredColorThemes
|
|
8829
8906
|
}
|
|
@@ -8831,18 +8908,15 @@ function ThemeColorPalette() {
|
|
|
8831
8908
|
] })
|
|
8832
8909
|
] })
|
|
8833
8910
|
] }),
|
|
8834
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-12", children: currentColorPalette.map((theme2) =>
|
|
8835
|
-
|
|
8836
|
-
/* @__PURE__ */
|
|
8837
|
-
|
|
8838
|
-
{
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
/* @__PURE__ */ jsx(ColourScale, { colorsToUse: theme2.colors }, theme2.name),
|
|
8844
|
-
/* @__PURE__ */ jsx(ColorSwatches, { theme: theme2.colors, format, viewMode })
|
|
8845
|
-
] }, theme2.name)) })
|
|
8911
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-12", children: currentColorPalette.map((theme2) => {
|
|
8912
|
+
const baseKey = theme2.name === "Primary" ? primaryColor : theme2.name === "Accent" ? accentColor : "grey";
|
|
8913
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
8914
|
+
/* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold", children: theme2.name }),
|
|
8915
|
+
/* @__PURE__ */ jsx(BaseColorSwatches, { baseColors: baseColors[themeCategory][baseKey], format }),
|
|
8916
|
+
/* @__PURE__ */ jsx(ColourScale, { colorsToUse: theme2.colors }),
|
|
8917
|
+
/* @__PURE__ */ jsx(ColorSwatches, { theme: theme2.colors, format, viewMode })
|
|
8918
|
+
] }, theme2.name);
|
|
8919
|
+
}) })
|
|
8846
8920
|
] });
|
|
8847
8921
|
}
|
|
8848
8922
|
function ThemeProvider({ children, ...props }) {
|
|
@@ -8938,7 +9012,8 @@ var languages = [
|
|
|
8938
9012
|
"jsx",
|
|
8939
9013
|
"ts",
|
|
8940
9014
|
"tsx",
|
|
8941
|
-
"typescript"
|
|
9015
|
+
"typescript",
|
|
9016
|
+
"html"
|
|
8942
9017
|
];
|
|
8943
9018
|
|
|
8944
9019
|
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BadgeButton, BaseColorSwatches, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Breadcrumbs, Button2 as Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Code, CodeDemo, CodeHighlight, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ColorCard, ColorSwatches, ColourScale, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DynamicFavicon, ExpandableSearch, ExpandableSearchField, Footer, FooterAcknowledgement, FooterLegalLinks, FooterSmallPrint, FooterSocialLink, FormatToggle, GenerateInterpolatedColors, Header2 as Header, Heading, Icons, Input, Label3 as Label, Link, Logo, Masthead, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Navigation, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PreWithCopy, PrevNextLinks, PrevNextLinksPageLink, Progress, RadioGroup2 as RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator4 as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, SidebarLink, SidebarNavigation, SiteSearch, Skeleton, Slider, Social, Spinner, Strong, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableOfContents, TableRow, Tabs2 as Tabs, TabsContent, TabsList, TabsTrigger, Text, TextLink, Textarea, ThemeColorPalette, ThemeProvider, ThemeSelector, ThemeSwitcher, Toaster, TocContext, TocProvider, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TouchTarget, ViewToggle, aboriginal, addStartStopToColorArray, allPalettes, badgeVariants, brand, buttonVariants, camelCase, cn, colorDataArray, colorThemes, colors, createColorArray, createColorData, darkenColor, domToSimple, generateColorThemes, getColorValue, getHeadings, getNodeText, getSurroundingColors, interpolateColors, isLightColor, kebabCase, languages, lightenColor, navigationMenuTriggerStyle, oklchConverter, renderColorOutput, renderColorOutputToDTFM, semantic, shades, themeIndices, themeTokens, toggleVariants, truncate, useToc };
|