@nswds/app 1.122.0 → 1.123.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
@@ -15147,7 +15147,7 @@ function resolveBackgroundToken(themeCategory, primaryKey, accentKey, preferredT
15147
15147
  function getContrastRatio(backgroundHex, foregroundHex) {
15148
15148
  return culori__namespace.wcagContrast(backgroundHex, foregroundHex) ?? 0;
15149
15149
  }
15150
- function getContrastLevel(contrastRatio) {
15150
+ function getContrastComplianceSummary(contrastRatio) {
15151
15151
  if (contrastRatio >= AAA_NORMAL_CONTRAST_RATIO) {
15152
15152
  return "Passes AA large, AA normal, AAA large, and AAA normal";
15153
15153
  }
@@ -15287,12 +15287,12 @@ function getRecommendedCandidate(themeCategory, background, primaryFamily, accen
15287
15287
  }
15288
15288
  return null;
15289
15289
  }
15290
- function getAccessibleForegroundOptions(themeCategory, background, primaryFamily, accentFamily) {
15290
+ function getForegroundOptionsMeetingAaLarge(themeCategory, background, primaryFamily, accentFamily) {
15291
15291
  return scoreForegroundCandidates(themeCategory, background, primaryFamily, accentFamily).filter((candidate) => candidate.contrastRatio >= AA_LARGE_CONTRAST_RATIO).sort((left, right) => right.contrastRatio - left.contrastRatio);
15292
15292
  }
15293
15293
  function getPreviewAnnouncement(background, foreground) {
15294
15294
  if (!foreground) {
15295
- return `${background.token} selected. No accessible foreground options meeting 3 to 1 are available.`;
15295
+ return `${background.token} selected. No foreground options meeting AA large (3 to 1) are available.`;
15296
15296
  }
15297
15297
  return `${background.token} paired with ${foreground.token}. Contrast ratio ${foreground.contrastRatio.toFixed(2)} to 1.`;
15298
15298
  }
@@ -15350,7 +15350,7 @@ function getInitialPairingState(searchParams) {
15350
15350
  const backgroundShade = [...primaryFamily.shades, ...accentFamily.shades, ...greyFamily.shades].find(
15351
15351
  (shade) => shade.token === selectedBackgroundToken
15352
15352
  ) ?? getShadeForTone(primaryFamily, DEFAULT_BACKGROUND_TONE);
15353
- const selectedForegroundId = getAccessibleForegroundOptions(
15353
+ const selectedForegroundId = getForegroundOptionsMeetingAaLarge(
15354
15354
  themeCategory,
15355
15355
  backgroundShade,
15356
15356
  primaryFamily,
@@ -15567,7 +15567,7 @@ function ForegroundOption({
15567
15567
  " ",
15568
15568
  candidate.contrastRatio.toFixed(2),
15569
15569
  " to 1, ",
15570
- getForegroundOptionBadge(candidate).label
15570
+ badge.label
15571
15571
  ] })
15572
15572
  ]
15573
15573
  }
@@ -15610,7 +15610,12 @@ function ColorPairingToolContent({ visibleFormats }) {
15610
15610
  [backgroundShadeOptions, selectedBackgroundToken]
15611
15611
  );
15612
15612
  const accessibleForegroundOptions = React5.useMemo(
15613
- () => getAccessibleForegroundOptions(themeCategory, backgroundShade, primaryFamily, accentFamily),
15613
+ () => getForegroundOptionsMeetingAaLarge(
15614
+ themeCategory,
15615
+ backgroundShade,
15616
+ primaryFamily,
15617
+ accentFamily
15618
+ ),
15614
15619
  [accentFamily, backgroundShade, primaryFamily, themeCategory]
15615
15620
  );
15616
15621
  const recommendedForeground = React5.useMemo(
@@ -15747,7 +15752,7 @@ function ColorPairingToolContent({ visibleFormats }) {
15747
15752
  `format: ${getColorFormatLabel(resolvedCopyFormat)}`,
15748
15753
  `foreground: ${previewForeground.token} (${getColorValue(previewForeground, resolvedCopyFormat)})`,
15749
15754
  `background: ${backgroundShade.token} (${getColorValue(backgroundShade, resolvedCopyFormat)})`,
15750
- `contrast: ${previewForeground.contrastRatio.toFixed(2)}:1 ${getContrastLevel(previewForeground.contrastRatio)}`
15755
+ `contrast: ${previewForeground.contrastRatio.toFixed(2)}:1 ${getContrastComplianceSummary(previewForeground.contrastRatio)}`
15751
15756
  ].join("\n")
15752
15757
  );
15753
15758
  setCopiedKey("pairing");
@@ -16124,7 +16129,7 @@ function ColorPairingToolContent({ visibleFormats }) {
16124
16129
  onClick: () => handleForegroundChange(candidate.id)
16125
16130
  },
16126
16131
  candidate.id
16127
- )) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "py-3 text-sm text-grey-600", children: "No accessible foreground options meeting 3:1 are available for this background." }) })
16132
+ )) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "py-3 text-sm text-grey-600", children: "No foreground options meeting AA large (3:1) are available for this background." }) })
16128
16133
  ] })
16129
16134
  ] })
16130
16135
  ] }) });
@@ -19025,7 +19030,7 @@ function FormatToggle({ format, setFormat }) {
19025
19030
 
19026
19031
  // package.json
19027
19032
  var package_default = {
19028
- version: "1.121.2"};
19033
+ version: "1.122.0"};
19029
19034
  var SluggerContext = React5__namespace.default.createContext(null);
19030
19035
  function flattenText(nodes) {
19031
19036
  if (nodes == null || typeof nodes === "boolean") return "";