@autoguru/overdrive 4.61.0 → 4.63.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.
Files changed (56) hide show
  1. package/dist/components/Alert/Alert.js +1 -1
  2. package/dist/components/Box/useBox/useBox.d.ts +1 -1
  3. package/dist/components/Button/Button.css.d.ts +13 -1
  4. package/dist/components/Button/Button.css.d.ts.map +1 -1
  5. package/dist/components/Button/Button.css.js +35 -0
  6. package/dist/components/Button/Button.d.ts.map +1 -1
  7. package/dist/components/Button/Button.js +5 -1
  8. package/dist/components/CheckBox/CheckBox.css.d.ts.map +1 -1
  9. package/dist/components/CheckBox/CheckBox.css.js +5 -2
  10. package/dist/components/DateInput/DateInput.js +1 -1
  11. package/dist/components/EditableText/EditableText.css.js +1 -1
  12. package/dist/components/OverdriveProvider/OverdriveProvider.d.ts +13 -1
  13. package/dist/components/OverdriveProvider/OverdriveProvider.d.ts.map +1 -1
  14. package/dist/components/OverdriveProvider/OverdriveProvider.js +6 -1
  15. package/dist/components/OverdriveProvider/useColorOverrides.d.ts +3 -2
  16. package/dist/components/OverdriveProvider/useColorOverrides.d.ts.map +1 -1
  17. package/dist/components/OverdriveProvider/useColorOverrides.js +158 -22
  18. package/dist/components/OverdriveProvider/useColorOverrides.spec.d.ts +2 -0
  19. package/dist/components/OverdriveProvider/useColorOverrides.spec.d.ts.map +1 -0
  20. package/dist/components/OverdriveProvider/useColorOverrides.spec.js +226 -0
  21. package/dist/components/Radio/Radio.css.d.ts.map +1 -1
  22. package/dist/components/Radio/Radio.css.js +3 -2
  23. package/dist/components/StandardModal/StandardModal.js +1 -1
  24. package/dist/components/Switch/Switch.css.d.ts.map +1 -1
  25. package/dist/components/Switch/Switch.css.js +3 -1
  26. package/dist/components/private/InputBase/InputState.css.js +1 -1
  27. package/dist/components/private/InputBase/NotchedBase.css.js +1 -1
  28. package/dist/components/private/InputBase/withEnhancedInput.css.js +1 -1
  29. package/dist/styles/intentColorset.css.d.ts +3 -3
  30. package/dist/styles/sprinkles.css.d.ts +24 -24
  31. package/dist/styles/sprinkles.css.d.ts.map +1 -1
  32. package/dist/styles/sprinkles.css.js +10 -8
  33. package/dist/styles/typography.css.d.ts +1 -1
  34. package/dist/themes/base/contrastGuide.spec.js +11 -2
  35. package/dist/themes/base/index.d.ts +126 -18
  36. package/dist/themes/base/index.d.ts.map +1 -1
  37. package/dist/themes/base/space.spec.js +3 -3
  38. package/dist/themes/base/tokens.d.ts +76 -9
  39. package/dist/themes/base/tokens.d.ts.map +1 -1
  40. package/dist/themes/base/tokens.js +114 -13
  41. package/dist/themes/flat_red/index.d.ts +126 -18
  42. package/dist/themes/flat_red/index.d.ts.map +1 -1
  43. package/dist/themes/flat_red/tokens.d.ts +63 -9
  44. package/dist/themes/flat_red/tokens.d.ts.map +1 -1
  45. package/dist/themes/index.d.ts +126 -18
  46. package/dist/themes/index.d.ts.map +1 -1
  47. package/dist/themes/makeTheme.d.ts +63 -9
  48. package/dist/themes/makeTheme.d.ts.map +1 -1
  49. package/dist/themes/neutral/index.d.ts +126 -18
  50. package/dist/themes/neutral/index.d.ts.map +1 -1
  51. package/dist/themes/neutral/tokens.d.ts +63 -9
  52. package/dist/themes/neutral/tokens.d.ts.map +1 -1
  53. package/dist/themes/theme.css.d.ts +63 -9
  54. package/dist/themes/theme.css.d.ts.map +1 -1
  55. package/dist/themes/theme.css.js +79 -18
  56. package/package.json +1 -1
@@ -75,7 +75,7 @@ export const Alert = ({
75
75
  onClick: onRequestClose,
76
76
  children: /*#__PURE__*/_jsx(Icon, {
77
77
  className: sprinkles({
78
- color: 'tertiaryInactive'
78
+ color: 'tertiary'
79
79
  }),
80
80
  icon: XIcon,
81
81
  size: "medium"
@@ -12,6 +12,7 @@ export declare const useBox: ({ as, className: incomingClassName, odComponent, t
12
12
  placeholder?: string | undefined | undefined;
13
13
  default?: boolean | undefined | undefined;
14
14
  selected?: boolean | undefined | undefined;
15
+ disabled?: boolean | undefined | undefined;
15
16
  min?: number | string | undefined | undefined;
16
17
  muted?: boolean | undefined | undefined;
17
18
  step?: number | string | undefined | undefined;
@@ -23,7 +24,6 @@ export declare const useBox: ({ as, className: incomingClassName, odComponent, t
23
24
  wrap?: string | undefined | undefined;
24
25
  open?: boolean | undefined | undefined;
25
26
  multiple?: boolean | undefined | undefined;
26
- disabled?: boolean | undefined | undefined;
27
27
  span?: number | undefined | undefined;
28
28
  label?: string | undefined | undefined;
29
29
  cite?: string | undefined | undefined;
@@ -148,6 +148,10 @@ export declare const button: import("@vanilla-extract/recipes").RuntimeFn<{
148
148
  isLoading: {
149
149
  true: {};
150
150
  };
151
+ /** Empty here; the appearance lives in the `intent: 'primary'` compound. */
152
+ outlined: {
153
+ true: {};
154
+ };
151
155
  }>;
152
156
  type ButtonRecipeProps = NonNullable<Required<RecipeVariants<typeof button>>>;
153
157
  export type ButtonSize = ButtonRecipeProps['size'];
@@ -156,6 +160,7 @@ export type ButtonIntent = ButtonRecipeProps['intent'];
156
160
  export type ButtonIsFullWidth = ButtonRecipeProps['isFullWidth'];
157
161
  export type ButtonIsLoading = ButtonRecipeProps['isLoading'];
158
162
  export type ButtonMinimal = ButtonRecipeProps['minimal'];
163
+ export type ButtonOutlined = ButtonRecipeProps['outlined'];
159
164
  export type ButtonRounded = ButtonRecipeProps['rounded'];
160
165
  export interface StyledButtonProps {
161
166
  /**
@@ -174,8 +179,15 @@ export interface StyledButtonProps {
174
179
  * Present a borderless minimal appearance
175
180
  */
176
181
  minimal?: ButtonMinimal;
182
+ /**
183
+ * Transparent fill with a brand-coloured border and label.
184
+ *
185
+ * Currently applies to `variant="primary"` only, and ignored when `minimal`
186
+ * is set — the two are opposites.
187
+ */
188
+ outlined?: ButtonOutlined;
177
189
  isFullWidth?: ButtonIsFullWidth;
178
- isLoading?: ButtonIsFullWidth;
190
+ isLoading?: ButtonIsLoading;
179
191
  }
180
192
  export {};
181
193
  //# sourceMappingURL=Button.css.d.ts.map
@@ -1 +1 @@
1
- {"version":3,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  isLoading: {
214
214
  true: {}
215
+ },
216
+ /** Empty here; the appearance lives in the `intent: 'primary'` compound. */
217
+ outlined: {
218
+ true: {}
215
219
  }
216
220
  },
217
221
  compoundVariants: [
@@ -409,6 +413,37 @@ export const button = recipe({
409
413
  }
410
414
  }
411
415
  }
416
+ },
417
+ // Compound class names are index-based — append, never insert.
418
+ {
419
+ variants: {
420
+ intent: 'primary',
421
+ outlined: true
422
+ },
423
+ style: {
424
+ '@layer': {
425
+ [cssLayerComponent]: {
426
+ // intent primary sets this too, at equal specificity.
427
+ backgroundColor: 'transparent',
428
+ border: `1px solid ${vars.color.button.primary.outlined.border}`,
429
+ color: vars.color.button.primary.outlined.text,
430
+ selectors: {
431
+ '&:focus-visible, &:not(:disabled):hover': {
432
+ backgroundColor: vars.color.button.primary.outlined.hover,
433
+ borderColor: vars.color.button.primary.outlined.border,
434
+ color: vars.color.button.primary.outlined.text
435
+ },
436
+ '&:active:not(:disabled, [data-loading])': {
437
+ backgroundColor: vars.color.button.primary.outlined.pressed,
438
+ // Restated: intent primary's nested `:active`
439
+ // (0,3,0) beats this variant's `:focus-visible`.
440
+ borderColor: vars.color.button.primary.outlined.border,
441
+ color: vars.color.button.primary.outlined.text
442
+ }
443
+ }
444
+ }
445
+ }
446
+ }
412
447
  }],
413
448
  defaultVariants: {
414
449
  size: 'medium',
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../lib/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EASb,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,WAAW,EAIhB,KAAK,YAAY,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAM9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD,KAAK,eAAe,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;AAOhD,QAAA,MAAM,m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;AAOhD,QAAA,MAAM,mBAAmB;;CAEf,CAAC;AAEX,KAAK,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,OAAO,mBAAmB,EAAE,MAAM,CAAC,CAAC,CAAC;AAE5E,MAAM,WAAW,WAChB,SAAQ,IAAI,CACV,eAAe,EACb,UAAU,GACV,IAAI,GACJ,QAAQ,GACR,SAAS,GACT,SAAS,GACT,WAAW,GACX,cAAc,GACd,cAAc,GACd,MAAM,GACN,WAAW,CACb,EACD,IAAI,CACH,cAAc,EACZ,YAAY,GACZ,eAAe,GACf,kBAAkB,GAClB,eAAe,GACf,eAAe,CACjB,EACD,iBAAiB,EACjB,UAAU;IACX;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;CACxB;AAcD,eAAO,MAAM,YAAY,GAAI,MAAM,WAAW,CAAC,MAAM,CAAC,uBACnB,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,MAAM,uFA4IlB,CAAC"}
@@ -65,6 +65,7 @@ export const Button = /*#__PURE__*/forwardRef(({
65
65
  isFullWidth = false,
66
66
  localeText,
67
67
  minimal = false,
68
+ outlined = false,
68
69
  rounded = false,
69
70
  size = 'medium',
70
71
  testId,
@@ -84,7 +85,9 @@ export const Button = /*#__PURE__*/forwardRef(({
84
85
  }, ref) => {
85
86
  const [functionallyDisabled, setFunctionallyDisabled] = useState(false);
86
87
  const language = _objectSpread(_objectSpread({}, LOCALE_TEXT_DEFAULT), localeText);
87
- const isInverse = minimal || variant === 'secondary';
88
+ // `minimal` wins; primary-only because only it has outlined tokens.
89
+ const isOutlined = outlined && !minimal && variant === 'primary';
90
+ const isInverse = minimal || isOutlined || variant === 'secondary';
88
91
  const isSingleIconChild = useMemo(() => /*#__PURE__*/isValidElement(children) && children.type === Icon && typeof children.type !== 'string', [children]);
89
92
  const shape = isSingleIconChild && 'iconOnly' || rounded && 'rounded' || 'default';
90
93
  const onClick = useCallback(event => {
@@ -105,6 +108,7 @@ export const Button = /*#__PURE__*/forwardRef(({
105
108
  isFullWidth,
106
109
  isLoading,
107
110
  minimal,
111
+ outlined: isOutlined,
108
112
  rounded,
109
113
  shape,
110
114
  size
@@ -1 +1 @@
1
- {"version":3,"file":"CheckBox.css.d.ts","sourceRoot":"","sources":["../../../lib/components/CheckBox/CheckBox.css.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,QAAQ,wCA0BnB,CAAC;AAEH,eAAO,MAAM,IAAI,QAOf,CAAC"}
1
+ {"version":3,"file":"CheckBox.css.d.ts","sourceRoot":"","sources":["../../../lib/components/CheckBox/CheckBox.css.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,QAAQ,wCA6BnB,CAAC;AAEH,eAAO,MAAM,IAAI,QAOf,CAAC"}
@@ -3,7 +3,7 @@ __vanilla_filescope__.setFileScope("lib/components/CheckBox/CheckBox.css.ts", "@
3
3
  import { style, styleVariants } from '@vanilla-extract/css';
4
4
  import { overdriveTokens as vars } from "../../themes/theme.css.js";
5
5
  import { nativeInput, checkable } from "../private/CheckableBase/CheckableBase.css.js";
6
- const colorAccent = vars.color.foreground.primary;
6
+ const colorAccent = vars.color.brand.solid;
7
7
  const colorContrast = vars.color.background.default;
8
8
  const colorMid = vars.colours.background.neutral;
9
9
  const size = vars.space['6'];
@@ -33,7 +33,10 @@ export const checkbox = styleVariants({
33
33
  },
34
34
  selected: {
35
35
  backgroundColor: colorAccent,
36
- borderColor: colorAccent
36
+ borderColor: colorAccent,
37
+ // On `selected` only — the Icon always renders, hidden by matching
38
+ // the page background.
39
+ color: vars.color.brand.onSolid
37
40
  }
38
41
  }, "checkbox");
39
42
  export const icon = style({
@@ -172,7 +172,7 @@ export const DateInput = withEnhancedInput(({
172
172
  gap: '2',
173
173
  spaceBetween: true
174
174
  }), disabled && sprinkles({
175
- color: 'tertiaryInactive'
175
+ color: 'tertiary'
176
176
  })),
177
177
  children: [/*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({}, fieldProps), {}, {
178
178
  className: styles.verticalCenterStyle,
@@ -7,7 +7,7 @@ globalLayer(LAYER_ORDER);
7
7
  export const root = style({
8
8
  '@layer': {
9
9
  [cssLayerComponent]: {
10
- boxShadow: `inset 0 -1px 0 0 ${vars.color.foreground.tertiaryInactive}`,
10
+ boxShadow: `inset 0 -1px 0 0 ${vars.color.foreground.tertiary}`,
11
11
  transitionDelay: '0s',
12
12
  transitionDuration: '0.2s',
13
13
  transitionProperty: 'box-shadow',
@@ -14,7 +14,19 @@ export interface ProviderProps {
14
14
  breakpoints?: BreakPoints;
15
15
  /** When true, prevents applying theme styles at the body level */
16
16
  noBodyLevelTheming?: boolean;
17
- /** Custom colour overrides for select theme tokens */
17
+ /**
18
+ * Custom colour overrides for select theme tokens — the runtime brand hook.
19
+ *
20
+ * `primaryBackground` drives the primary Button, the brand accent behind
21
+ * Switch/Radio/CheckBox on-states, the outlined Button, and
22
+ * `<Text colour="primary">`. `primaryForeground` is the content placed on
23
+ * top of it; when omitted it is derived for contrast.
24
+ *
25
+ * `linkColor` is deliberately separate rather than following
26
+ * `primaryBackground`: it also drives every focus ring in the library, and a
27
+ * colour picked as a fill behind white text is often illegible as link text
28
+ * on the page background. Pass it explicitly to brand links.
29
+ */
18
30
  colorOverrides?: Partial<ColorOverrides>;
19
31
  /** Reference to an HTML element where portals should be mounted */
20
32
  portalMountPoint?: PortalMountPoint;
@@ -1 +1 @@
1
- {"version":3,"file":"OverdriveProvider.d.ts","sourceRoot":"","sources":["../../../lib/components/OverdriveProvider/OverdriveProvider.tsx"],"names":[],"mappings":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C;IAClE,UAAU,EAAE,CAAC,OAAO,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;IACpD,IAAI,EAAE,aAAa,CAAC;CACpB;AAMD,eAAO,MAAM,QAAQ,uBAIpB,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAO,aAInC,CAAC;AAUF,eAAO,MAAM,QAAQ,GAAI,iGAQtB,aAAa,sBAkEf,CAAC;AAEF,eAAO,MAAM,iBAAiB,2CAK7B,CAAC"}
@@ -66,7 +66,12 @@ export const Provider = ({
66
66
  theme = baseTheme
67
67
  }) => {
68
68
  const runtimeTokens = useMemo(() => makeRuntimeTokens(breakpoints), [breakpoints]);
69
- const styles = useColorOverrides(colorOverrides, String(theme.vars.mode));
69
+ // The theme's resolved tokens, not `theme.vars` — those are CSS var
70
+ // *references* (`var(--od-mode)`), so the mode check downstream never
71
+ // matched and its light/dark branch was dead. Passing the tokens also lets
72
+ // contrast decisions be made against this theme's own page background and
73
+ // body ink rather than the base theme's.
74
+ const styles = useColorOverrides(colorOverrides, theme.tokens);
70
75
  const themeValues = useMemo(() => ({
71
76
  themeClass: theme.themeRef,
72
77
  themeName: theme.name,
@@ -1,7 +1,8 @@
1
+ import { type ThemeTokens } from '../../themes/theme.css';
1
2
  /** valid colour override keys */
2
- declare const colorOverrideKeys: readonly ["primaryBackground", "primaryBackgroundMild", "primaryBackgroundStrong", "primaryBorder", "primaryForeground"];
3
+ declare const colorOverrideKeys: readonly ["primaryBackground", "primaryBackgroundMild", "primaryBackgroundStrong", "primaryBorder", "primaryForeground", "linkColor"];
3
4
  export type ColorOverrides = Record<(typeof colorOverrideKeys)[number], string>;
4
- export declare const useColorOverrides: (overrides: Partial<ColorOverrides> | undefined, themeMode: string) => {
5
+ export declare const useColorOverrides: (overrides: Partial<ColorOverrides> | undefined, tokens: ThemeTokens) => {
5
6
  [cssVarName: string]: string;
6
7
  };
7
8
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"useColorOverrides.d.ts","sourceRoot":"","sources":["../../../lib/components/OverdriveProvider/useColorOverrides.ts"],"names":[],"mappings":"AAMA,iCAAiC;AACjC,QAAA,MAAM,iBAAiB,0HAMb,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;AAYhF,eAAO,MAAM,iBAAiB,GAC7B,WAAW,OAAO,CAAC,cAAc,CAAC,GAAG,SAAS,EAC9C,WAAW,MAAM;;CAgEjB,CAAC"}
1
+ {"version":3,"file":"useColorOverrides.d.ts","sourceRoot":"","sources":["../../../lib/components/OverdriveProvider/useColorOverrides.ts"],"names":[],"mappings":"AAQA,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAe3E,iCAAiC;AACjC,QAAA,MAAM,iBAAiB,uIAOb,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;AAsFhF,eAAO,MAAM,iBAAiB,GAC7B,WAAW,OAAO,CAAC,cAAc,CAAC,GAAG,SAAS,EAC9C,QAAQ,WAAW;;CAgJnB,CAAC"}
@@ -1,71 +1,207 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1
4
  import { assignInlineVars } from '@vanilla-extract/dynamic';
2
5
  import { useMemo } from 'react';
3
- import { shadedColour } from "../../themes/helpers.js";
6
+ import { getContrastRatio, passesAccessibilityContrast, shadedColour } from "../../themes/helpers.js";
4
7
  import { overdriveTokens } from "../../themes/theme.css.js";
8
+ /** The active theme's own values, so contrast decisions match what it renders. */
9
+ const themeContext = tokens => ({
10
+ mode: String(tokens.mode),
11
+ pageBackground: tokens.color.background.default,
12
+ bodyInk: tokens.color.foreground.primary
13
+ });
14
+
5
15
  /** valid colour override keys */
6
- const colorOverrideKeys = ['primaryBackground', 'primaryBackgroundMild', 'primaryBackgroundStrong', 'primaryBorder', 'primaryForeground'];
16
+ const colorOverrideKeys = ['primaryBackground', 'primaryBackgroundMild', 'primaryBackgroundStrong', 'primaryBorder', 'primaryForeground', 'linkColor'];
7
17
  const isValidColor = color => {
18
+ // `Option` is a DOM global, so this throws during SSR. Failing closed there
19
+ // stripped every override, leaving the brand to appear only on hydration.
20
+ if (typeof Option === 'undefined') return true;
8
21
  try {
9
22
  const s = new Option();
10
23
  s.style.color = color !== null && color !== void 0 ? color : '';
11
24
  return s.style.color !== '';
12
25
  } catch {
13
- return false;
26
+ return true;
14
27
  }
15
28
  };
16
- export const useColorOverrides = (overrides, themeMode) => {
29
+
30
+ /** Warn once per message — the provider re-renders on every child change. */
31
+ const warned = new Set();
32
+ const warnOnce = message => {
33
+ if (warned.has(message)) return;
34
+ warned.add(message);
35
+ console.warn(message);
36
+ };
37
+
38
+ /**
39
+ * Contrast-safe content for a brand fill, chosen from the active theme's own
40
+ * page background and body ink.
41
+ *
42
+ * `getContrastRatio` returns `min/max` — the reciprocal of the WCAG ratio — so
43
+ * the SMALLER value wins.
44
+ */
45
+ const onBrandColour = (brand, theme) => getContrastRatio(theme.pageBackground, brand) < getContrastRatio(theme.bodyInk, brand) ? theme.pageBackground : theme.bodyInk;
46
+
47
+ /**
48
+ * Prefer `primaryForeground`, but only while it clears 3:1 on the fill — it was
49
+ * chosen as a button label colour, and a light brand paired with white text
50
+ * would otherwise leave an invisible tick.
51
+ */
52
+ const resolveOnBrand = (brand, theme, suppliedForeground) => {
53
+ if (!suppliedForeground) return onBrandColour(brand, theme);
54
+ const legible = passesAccessibilityContrast({
55
+ colour1: suppliedForeground,
56
+ colour2: brand,
57
+ level: 'AA',
58
+ textSize: 'LARGE'
59
+ });
60
+ if (legible) return suppliedForeground;
61
+ const derived = onBrandColour(brand, theme);
62
+ warnOnce(`Overdrive Provider: primaryForeground (${suppliedForeground}) does not meet 3:1 against primaryBackground (${brand}), so selection controls would be illegible. Using ${derived} for their tick/dot/knob instead.`);
63
+ return derived;
64
+ };
65
+
66
+ /** Dev-only nudge for a colour drawn as text or a border on the page. */
67
+ const warnOnLowContrast = (colour, key, theme) => {
68
+ if (colour && !passesAccessibilityContrast({
69
+ colour1: colour,
70
+ colour2: theme.pageBackground,
71
+ level: 'AA',
72
+ textSize: 'SMALL'
73
+ })) {
74
+ warnOnce(`Overdrive Provider: ${key} (${colour}) does not meet WCAG AA (4.5:1) against the page background. Anything drawn in it as text or a border — outlined buttons, links, focus rings — may be hard to read.`);
75
+ }
76
+ };
77
+ export const useColorOverrides = (overrides, tokens) => {
17
78
  return useMemo(() => {
18
- var _overrides$primaryBac, _mildPrimary, _strongPrimary, _overrides$primaryFor, _overrides$primaryBor, _overrides$primaryBac2;
79
+ var _onBrand, _outlinedHover, _outlinedPressed, _mildPrimary, _strongPrimary, _buttonForeground, _valid$primaryBorder;
19
80
  if (!overrides) return {};
81
+ const theme = themeContext(tokens);
82
+
83
+ // Copy before pruning — callers commonly hold this object in a cache.
84
+ const valid = _objectSpread({}, overrides);
20
85
  colorOverrideKeys.forEach(key => {
21
- if (overrides[key] && !isValidColor(overrides[key])) {
22
- console.warn(`Overdrive Provider: Invalid override color value for ${key}: ${overrides[key]}`);
23
- delete overrides[key];
86
+ if (valid[key] && !isValidColor(valid[key])) {
87
+ console.warn(`Overdrive Provider: Invalid override color value for ${key}: ${valid[key]}`);
88
+ delete valid[key];
24
89
  }
25
90
  });
91
+ const {
92
+ primaryBackground,
93
+ linkColor
94
+ } = valid;
95
+ // unknown modes degrade to light, the common case
96
+ const isDarkTheme = theme.mode === 'dark';
26
97
  let mildPrimary = null;
27
98
  let strongPrimary = null;
28
- if (overrides.primaryBackground) {
29
- mildPrimary = overrides.primaryBackgroundMild || shadedColour({
30
- colour: overrides.primaryBackground,
31
- isDarkTheme: false,
32
- direction: themeMode === 'light' ? 'forward' : 'backward',
99
+ let onBrand = null;
100
+ let buttonForeground = null;
101
+ let outlinedHover = null;
102
+ let outlinedPressed = null;
103
+ if (primaryBackground) {
104
+ var _valid$primaryForegro;
105
+ // Opposite directions: in a light theme mild is the paler wash and
106
+ // strong the deeper press state. These were once identical.
107
+ mildPrimary = valid.primaryBackgroundMild || shadedColour({
108
+ colour: primaryBackground,
109
+ isDarkTheme,
110
+ direction: 'forward',
33
111
  intensity: 0.1
34
112
  });
35
- strongPrimary = overrides.primaryBackgroundStrong || shadedColour({
36
- colour: overrides.primaryBackground,
37
- isDarkTheme: false,
38
- direction: themeMode === 'light' ? 'forward' : 'backward',
113
+ strongPrimary = valid.primaryBackgroundStrong || shadedColour({
114
+ colour: primaryBackground,
115
+ isDarkTheme,
116
+ direction: 'backward',
39
117
  intensity: 0.1
40
118
  });
119
+
120
+ // Honours an explicit value even when poor; only derives if absent.
121
+ buttonForeground = (_valid$primaryForegro = valid.primaryForeground) !== null && _valid$primaryForegro !== void 0 ? _valid$primaryForegro : onBrandColour(primaryBackground, theme);
122
+
123
+ // Stricter — a glyph failing 3:1 on the fill is invisible.
124
+ onBrand = resolveOnBrand(primaryBackground, theme, valid.primaryForeground);
125
+
126
+ // Pale tints behind an outlined button, hover the paler of the two.
127
+ outlinedHover = shadedColour({
128
+ colour: primaryBackground,
129
+ isDarkTheme,
130
+ direction: 'forward',
131
+ intensity: 0.5
132
+ });
133
+ outlinedPressed = shadedColour({
134
+ colour: primaryBackground,
135
+ isDarkTheme,
136
+ direction: 'forward',
137
+ intensity: 0.42
138
+ });
139
+ }
140
+ if (process.env.NODE_ENV !== 'production') {
141
+ warnOnLowContrast(primaryBackground, 'primaryBackground', theme);
142
+ warnOnLowContrast(linkColor, 'linkColor', theme);
41
143
  }
144
+
42
145
  // slightly messy use of ts-expect-error but assignInlineVars only generates css vars to apply to a container
43
146
  // any property that is undefined will not have an inline css var generated
44
147
  return assignInlineVars(overdriveTokens, {
148
+ color: {
149
+ brand: {
150
+ //@ts-expect-error no undefined
151
+ solid: primaryBackground !== null && primaryBackground !== void 0 ? primaryBackground : undefined,
152
+ //@ts-expect-error no undefined
153
+ onSolid: (_onBrand = onBrand) !== null && _onBrand !== void 0 ? _onBrand : undefined
154
+ },
155
+ button: {
156
+ primary: {
157
+ outlined: {
158
+ // Verbatim — tenants expect their own brand.
159
+ //@ts-expect-error no undefined
160
+ border: primaryBackground !== null && primaryBackground !== void 0 ? primaryBackground : undefined,
161
+ //@ts-expect-error no undefined
162
+ text: primaryBackground !== null && primaryBackground !== void 0 ? primaryBackground : undefined,
163
+ //@ts-expect-error no undefined
164
+ hover: (_outlinedHover = outlinedHover) !== null && _outlinedHover !== void 0 ? _outlinedHover : undefined,
165
+ //@ts-expect-error no undefined
166
+ pressed: (_outlinedPressed = outlinedPressed) !== null && _outlinedPressed !== void 0 ? _outlinedPressed : undefined
167
+ }
168
+ }
169
+ }
170
+ },
45
171
  colours: {
172
+ foreground: {
173
+ // also brands every focus ring, via focusOutline.css.ts
174
+ //@ts-expect-error no undefined
175
+ link: linkColor !== null && linkColor !== void 0 ? linkColor : undefined
176
+ },
46
177
  intent: {
47
178
  primary: {
48
179
  background: {
49
180
  //@ts-expect-error no undefined
50
- standard: (_overrides$primaryBac = overrides.primaryBackground) !== null && _overrides$primaryBac !== void 0 ? _overrides$primaryBac : undefined,
181
+ standard: primaryBackground !== null && primaryBackground !== void 0 ? primaryBackground : undefined,
51
182
  //@ts-expect-error no undefined
52
183
  mild: (_mildPrimary = mildPrimary) !== null && _mildPrimary !== void 0 ? _mildPrimary : undefined,
53
184
  //@ts-expect-error no undefined
54
185
  strong: (_strongPrimary = strongPrimary) !== null && _strongPrimary !== void 0 ? _strongPrimary : undefined
55
186
  },
187
+ // Derived — the theme's own value would leave a white
188
+ // label on a light brand.
56
189
  //@ts-expect-error no undefined
57
- foreground: (_overrides$primaryFor = overrides.primaryForeground) !== null && _overrides$primaryFor !== void 0 ? _overrides$primaryFor : undefined,
190
+ foreground: (_buttonForeground = buttonForeground) !== null && _buttonForeground !== void 0 ? _buttonForeground : undefined,
58
191
  //@ts-expect-error no undefined
59
- border: (_overrides$primaryBor = overrides.primaryBorder) !== null && _overrides$primaryBor !== void 0 ? _overrides$primaryBor : undefined
192
+ border: (_valid$primaryBorder = valid.primaryBorder) !== null && _valid$primaryBorder !== void 0 ? _valid$primaryBorder : undefined
60
193
  }
61
194
  }
62
195
  },
63
196
  typography: {
64
197
  colour: {
65
198
  //@ts-expect-error no undefined
66
- primary: (_overrides$primaryBac2 = overrides.primaryBackground) !== null && _overrides$primaryBac2 !== void 0 ? _overrides$primaryBac2 : undefined
199
+ primary: primaryBackground !== null && primaryBackground !== void 0 ? primaryBackground : undefined,
200
+ // read by TextLink and by the `colour="link"` sprinkle
201
+ //@ts-expect-error no undefined
202
+ link: linkColor !== null && linkColor !== void 0 ? linkColor : undefined
67
203
  }
68
204
  }
69
205
  });
70
- }, [overrides, themeMode]);
206
+ }, [overrides, tokens]);
71
207
  };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useColorOverrides.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useColorOverrides.spec.d.ts","sourceRoot":"","sources":["../../../lib/components/OverdriveProvider/useColorOverrides.spec.ts"],"names":[],"mappings":""}