@data-fair/lib-common-types 1.16.1 → 1.16.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/theme/index.js +5 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-common-types",
3
- "version": "1.16.1",
3
+ "version": "1.16.2",
4
4
  "description": "Shared schemas and built type definitions in the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/theme/index.js CHANGED
@@ -307,6 +307,8 @@ function readableWarning(readableOptions, locale, colorCode, colorName, bgColorC
307
307
  }
308
308
  }
309
309
  export function getColorsWarnings(locale, colors, themeName, readableOptions) {
310
+ if (locale !== 'fr' && locale !== 'en')
311
+ locale = 'en';
310
312
  const warnings = [];
311
313
  for (const color of ['primary', 'secondary', 'accent', 'info', 'success', 'error', 'warning', 'admin']) {
312
314
  const textColor = colors[`text-${color}`] ?? colors[color];
@@ -321,6 +323,8 @@ export function getColorsWarnings(locale, colors, themeName, readableOptions) {
321
323
  export const readableOptions = { level: 'AA', size: 'small' };
322
324
  export const hcReadableOptions = { level: 'AAA', size: 'small' };
323
325
  export function getSiteColorsWarnings(locale, theme, authProviders) {
326
+ if (locale !== 'fr' && locale !== 'en')
327
+ locale = 'en';
324
328
  let warnings = getColorsWarnings(locale, theme.colors, 'default', readableOptions);
325
329
  if (theme.dark && theme.darkColors)
326
330
  warnings = warnings.concat(getColorsWarnings(locale, theme.darkColors, 'dark', readableOptions));
@@ -332,7 +336,7 @@ export function getSiteColorsWarnings(locale, theme, authProviders) {
332
336
  for (const p of authProviders) {
333
337
  if (p.color && p.title) {
334
338
  if (!tinycolor.isReadable('#FFFFFF', p.color, readableOptions)) {
335
- warnings.push(getMessage(locale, 'colors.readableWarning', { colorCode: '#FFFFFF', colorName: getMessage(locale, 'colors.white'), bgColorCode: p.color, bgColorName: getMessage(locale, 'colors.authProvider', { title: p.title }) }));
339
+ warnings.push(getMessage(locale, 'readableWarning', { colorCode: '#FFFFFF', colorName: getMessage(locale, 'colors.white'), bgColorCode: p.color, bgColorName: getMessage(locale, 'colors.authProvider', { title: p.title }) }));
336
340
  }
337
341
  }
338
342
  }