@autoguru/overdrive 4.62.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.
- package/dist/components/Button/Button.css.d.ts +13 -1
- package/dist/components/Button/Button.css.d.ts.map +1 -1
- package/dist/components/Button/Button.css.js +35 -0
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +5 -1
- package/dist/components/CheckBox/CheckBox.css.d.ts.map +1 -1
- package/dist/components/CheckBox/CheckBox.css.js +5 -2
- package/dist/components/OverdriveProvider/OverdriveProvider.d.ts +13 -1
- package/dist/components/OverdriveProvider/OverdriveProvider.d.ts.map +1 -1
- package/dist/components/OverdriveProvider/OverdriveProvider.js +6 -1
- package/dist/components/OverdriveProvider/useColorOverrides.d.ts +3 -2
- package/dist/components/OverdriveProvider/useColorOverrides.d.ts.map +1 -1
- package/dist/components/OverdriveProvider/useColorOverrides.js +158 -22
- package/dist/components/OverdriveProvider/useColorOverrides.spec.d.ts +2 -0
- package/dist/components/OverdriveProvider/useColorOverrides.spec.d.ts.map +1 -0
- package/dist/components/OverdriveProvider/useColorOverrides.spec.js +226 -0
- package/dist/components/Radio/Radio.css.d.ts.map +1 -1
- package/dist/components/Radio/Radio.css.js +3 -2
- package/dist/components/Switch/Switch.css.d.ts.map +1 -1
- package/dist/components/Switch/Switch.css.js +3 -1
- package/dist/styles/intentColorset.css.d.ts +3 -3
- package/dist/styles/sprinkles.css.d.ts +12 -12
- package/dist/styles/typography.css.d.ts +1 -1
- package/dist/themes/base/contrastGuide.spec.js +11 -2
- package/dist/themes/base/index.d.ts +8 -0
- package/dist/themes/base/index.d.ts.map +1 -1
- package/dist/themes/base/tokens.d.ts +17 -0
- package/dist/themes/base/tokens.d.ts.map +1 -1
- package/dist/themes/base/tokens.js +18 -0
- package/dist/themes/flat_red/index.d.ts +8 -0
- package/dist/themes/flat_red/index.d.ts.map +1 -1
- package/dist/themes/flat_red/tokens.d.ts +4 -0
- package/dist/themes/flat_red/tokens.d.ts.map +1 -1
- package/dist/themes/index.d.ts +8 -0
- package/dist/themes/index.d.ts.map +1 -1
- package/dist/themes/makeTheme.d.ts +4 -0
- package/dist/themes/makeTheme.d.ts.map +1 -1
- package/dist/themes/neutral/index.d.ts +8 -0
- package/dist/themes/neutral/index.d.ts.map +1 -1
- package/dist/themes/neutral/tokens.d.ts +4 -0
- package/dist/themes/neutral/tokens.d.ts.map +1 -1
- package/dist/themes/theme.css.d.ts +4 -0
- package/dist/themes/theme.css.d.ts.map +1 -1
- package/dist/themes/theme.css.js +16 -0
- package/package.json +1 -1
|
@@ -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?:
|
|
190
|
+
isLoading?: ButtonIsLoading;
|
|
179
191
|
}
|
|
180
192
|
export {};
|
|
181
193
|
//# sourceMappingURL=Button.css.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Button/Button.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAe,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAYzE,eAAO,MAAM,aAAa,QAAkC,CAAC;AAC7D,eAAO,MAAM,cAAc,QAKzB,CAAC;AACH,eAAO,MAAM,OAAO,QAA4B,CAAC;AAGjD,eAAO,MAAM,MAAM;;;;gBA+Cd,CAAC,iBAAiB,CAAC;;;;kBAIlB;;;;;gBAKD,CAAC,iBAAiB,CAAC;;;kBAGlB;;;;;gBAKD,CAAC,iBAAiB,CAAC;;;;kBAIlB;;;;;;;;;gBAUD,CAAC,iBAAiB,CAAC;;kBAElB;;;;;;;gBAQD,CAAC,iBAAiB,CAAC;;;;;;;kBASlB;;;;;gBAKD,CAAC,iBAAiB,CAAC;;;;;;kBAOlB;;;;;gBAKD,CAAC,iBAAiB,CAAC;;;;;;;;;;kBAalB;;;;;gBAKD,CAAC,iBAAiB,CAAC;;;;;;kBAQlB;;;;;gBAKD,CAAC,iBAAiB,CAAC;;;;;;kBAQlB;;;;;gBAKD,CAAC,iBAAiB,CAAC;;;;;;kBAQlB;;;;;gBAKD,CAAC,iBAAiB,CAAC;;;;;;kBAQlB;;;;;;;gBAQD,CAAC,iBAAiB,CAAC;;;;kBAIlB;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file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iB,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;AACjE,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAC7D,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;AACzD,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAC3D,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;AAEzD,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,SAAS,CAAC,EAAE,eAAe,CAAC;CAC5B"}
|
|
@@ -212,6 +212,10 @@ export const button = recipe({
|
|
|
212
212
|
},
|
|
213
213
|
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,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,G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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
|
-
|
|
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,
|
|
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.
|
|
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({
|
|
@@ -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
|
-
/**
|
|
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":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,KAAwD,MAAM,OAAO,CAAC;AAG7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,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,CAAC,CAAC;IACzC,mEAAmE;IACnE,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,eAChB,SAAQ,IAAI,CAAC,aAAa,EAAE,gBAAgB,GAAG,kBAAkB,CAAC;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
|
-
|
|
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,
|
|
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":"
|
|
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
|
|
26
|
+
return true;
|
|
14
27
|
}
|
|
15
28
|
};
|
|
16
|
-
|
|
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
|
|
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 (
|
|
22
|
-
console.warn(`Overdrive Provider: Invalid override color value for ${key}: ${
|
|
23
|
-
delete
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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 =
|
|
36
|
-
colour:
|
|
37
|
-
isDarkTheme
|
|
38
|
-
direction:
|
|
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:
|
|
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: (
|
|
190
|
+
foreground: (_buttonForeground = buttonForeground) !== null && _buttonForeground !== void 0 ? _buttonForeground : undefined,
|
|
58
191
|
//@ts-expect-error no undefined
|
|
59
|
-
border: (
|
|
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:
|
|
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,
|
|
206
|
+
}, [overrides, tokens]);
|
|
71
207
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useColorOverrides.spec.d.ts","sourceRoot":"","sources":["../../../lib/components/OverdriveProvider/useColorOverrides.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,226 @@
|
|
|
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; }
|
|
4
|
+
import { renderHook } from '@testing-library/react';
|
|
5
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
6
|
+
import { colourMap } from "../../themes/base/colours.js";
|
|
7
|
+
import { tokens as baseTokens } from "../../themes/base/tokens.js";
|
|
8
|
+
import { getColourLuminance, getRGBValues } from "../../themes/helpers.js";
|
|
9
|
+
import { useColorOverrides } from "./useColorOverrides.js";
|
|
10
|
+
const BRAND = '#6d39a8'; // Merchant Finder's purple — dark, wants white on it
|
|
11
|
+
const BRIGHT = '#e5bc01'; // a bright yellow — wants dark ink on it
|
|
12
|
+
|
|
13
|
+
const vars = (overrides, tokens = baseTokens) => renderHook(() => useColorOverrides(overrides, tokens)).result.current;
|
|
14
|
+
const luminance = colour => getColourLuminance(getRGBValues(colour));
|
|
15
|
+
describe('useColorOverrides', () => {
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
vi.restoreAllMocks();
|
|
18
|
+
});
|
|
19
|
+
it('generates nothing when no overrides are supplied', () => {
|
|
20
|
+
expect(vars()).toEqual({});
|
|
21
|
+
});
|
|
22
|
+
describe('back-compat with the existing five keys', () => {
|
|
23
|
+
it('writes the legacy primary intent vars it always has', () => {
|
|
24
|
+
const result = vars({
|
|
25
|
+
primaryBackground: BRAND,
|
|
26
|
+
primaryForeground: '#ffffff',
|
|
27
|
+
primaryBorder: '#000000'
|
|
28
|
+
});
|
|
29
|
+
expect(result['--od-colours-intent-primary-background-standard']).toBe(BRAND);
|
|
30
|
+
expect(result['--od-colours-intent-primary-foreground']).toBe('#ffffff');
|
|
31
|
+
expect(result['--od-colours-intent-primary-border']).toBe('#000000');
|
|
32
|
+
expect(result['--od-typography-colour-primary']).toBe(BRAND);
|
|
33
|
+
});
|
|
34
|
+
it('honours explicitly supplied mild and strong values', () => {
|
|
35
|
+
const result = vars({
|
|
36
|
+
primaryBackground: BRAND,
|
|
37
|
+
primaryBackgroundMild: '#eeeeee',
|
|
38
|
+
primaryBackgroundStrong: '#111111'
|
|
39
|
+
});
|
|
40
|
+
expect(result['--od-colours-intent-primary-background-mild']).toBe('#eeeeee');
|
|
41
|
+
expect(result['--od-colours-intent-primary-background-strong']).toBe('#111111');
|
|
42
|
+
});
|
|
43
|
+
it('derives mild lighter and strong darker than the brand, not identical', () => {
|
|
44
|
+
const result = vars({
|
|
45
|
+
primaryBackground: BRAND
|
|
46
|
+
});
|
|
47
|
+
const mild = result['--od-colours-intent-primary-background-mild'];
|
|
48
|
+
const strong = result['--od-colours-intent-primary-background-strong'];
|
|
49
|
+
|
|
50
|
+
// regression guard: these were derived with identical arguments and
|
|
51
|
+
// both resolved to the same lightened colour, so a branded button's
|
|
52
|
+
// hover and active states were indistinguishable from resting
|
|
53
|
+
expect(mild).not.toBe(strong);
|
|
54
|
+
expect(luminance(mild)).toBeGreaterThan(luminance(BRAND));
|
|
55
|
+
expect(luminance(strong)).toBeLessThan(luminance(BRAND));
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
describe('brand accent', () => {
|
|
59
|
+
it('writes the brand pair from the supplied background', () => {
|
|
60
|
+
const result = vars({
|
|
61
|
+
primaryBackground: BRAND
|
|
62
|
+
});
|
|
63
|
+
expect(result['--od-color-brand-solid']).toBe(BRAND);
|
|
64
|
+
});
|
|
65
|
+
it('picks white as on-brand content for a dark brand', () => {
|
|
66
|
+
const result = vars({
|
|
67
|
+
primaryBackground: BRAND
|
|
68
|
+
});
|
|
69
|
+
expect(result['--od-color-brand-on-solid']).toBe(colourMap.white);
|
|
70
|
+
});
|
|
71
|
+
it('picks dark ink as on-brand content for a bright brand', () => {
|
|
72
|
+
const result = vars({
|
|
73
|
+
primaryBackground: BRIGHT
|
|
74
|
+
});
|
|
75
|
+
expect(result['--od-color-brand-on-solid']).toBe(colourMap.gray['900']);
|
|
76
|
+
});
|
|
77
|
+
it('prefers an explicit primaryForeground over the derived value', () => {
|
|
78
|
+
const result = vars({
|
|
79
|
+
primaryBackground: BRIGHT,
|
|
80
|
+
primaryForeground: '#123456'
|
|
81
|
+
});
|
|
82
|
+
expect(result['--od-color-brand-on-solid']).toBe('#123456');
|
|
83
|
+
});
|
|
84
|
+
it('ignores a primaryForeground that would be illegible on the brand', () => {
|
|
85
|
+
// a tenant pairing a light brand with white button text: taken
|
|
86
|
+
// verbatim this puts a white tick on a light checkbox, which is
|
|
87
|
+
// worse than the fixed dark ink these controls had before they
|
|
88
|
+
// followed the brand at all
|
|
89
|
+
const result = vars({
|
|
90
|
+
primaryBackground: '#ff6d00',
|
|
91
|
+
primaryForeground: '#ffffff'
|
|
92
|
+
});
|
|
93
|
+
expect(result['--od-color-brand-on-solid']).toBe(colourMap.gray['900']);
|
|
94
|
+
// the button label still honours what the tenant asked for — that
|
|
95
|
+
// is their stated brand pairing, and it was already the behaviour
|
|
96
|
+
expect(result['--od-colours-intent-primary-foreground']).toBe('#ffffff');
|
|
97
|
+
});
|
|
98
|
+
it('derives the button label too when no primaryForeground is given', () => {
|
|
99
|
+
// otherwise a light brand keeps the theme's white label and the
|
|
100
|
+
// solid button is unreadable, which the prop docs promise against
|
|
101
|
+
const result = vars({
|
|
102
|
+
primaryBackground: BRIGHT
|
|
103
|
+
});
|
|
104
|
+
expect(result['--od-colours-intent-primary-foreground']).toBe(colourMap.gray['900']);
|
|
105
|
+
expect(result['--od-color-brand-on-solid']).toBe(colourMap.gray['900']);
|
|
106
|
+
});
|
|
107
|
+
it('picks its contrast candidates from the active theme, not the base one', () => {
|
|
108
|
+
// the two candidates are the theme's own page background and body
|
|
109
|
+
// ink, so a theme that changes either gets decisions made against
|
|
110
|
+
// what it actually renders
|
|
111
|
+
const recoloured = _objectSpread(_objectSpread({}, baseTokens), {}, {
|
|
112
|
+
color: _objectSpread(_objectSpread({}, baseTokens.color), {}, {
|
|
113
|
+
background: _objectSpread(_objectSpread({}, baseTokens.color.background), {}, {
|
|
114
|
+
default: '#fff8e1'
|
|
115
|
+
}),
|
|
116
|
+
foreground: _objectSpread(_objectSpread({}, baseTokens.color.foreground), {}, {
|
|
117
|
+
primary: '#1a0033'
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
const result = vars({
|
|
122
|
+
primaryBackground: BRIGHT
|
|
123
|
+
}, recoloured);
|
|
124
|
+
expect(result['--od-color-brand-on-solid']).toBe('#1a0033');
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
describe('outlined button', () => {
|
|
128
|
+
it('takes the brand verbatim for border and label', () => {
|
|
129
|
+
const result = vars({
|
|
130
|
+
primaryBackground: BRAND
|
|
131
|
+
});
|
|
132
|
+
expect(result['--od-color-button-primary-outlined-border']).toBe(BRAND);
|
|
133
|
+
expect(result['--od-color-button-primary-outlined-text']).toBe(BRAND);
|
|
134
|
+
});
|
|
135
|
+
it('derives a hover wash paler than the pressed wash', () => {
|
|
136
|
+
const result = vars({
|
|
137
|
+
primaryBackground: BRAND
|
|
138
|
+
});
|
|
139
|
+
const hover = result['--od-color-button-primary-outlined-hover'];
|
|
140
|
+
const pressed = result['--od-color-button-primary-outlined-pressed'];
|
|
141
|
+
expect(luminance(hover)).toBeGreaterThan(luminance(pressed));
|
|
142
|
+
expect(luminance(pressed)).toBeGreaterThan(luminance(BRAND));
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
describe('links and focus rings', () => {
|
|
146
|
+
it('leaves them alone when only a brand background is supplied', () => {
|
|
147
|
+
const result = vars({
|
|
148
|
+
primaryBackground: BRAND
|
|
149
|
+
});
|
|
150
|
+
expect(result['--od-colours-foreground-link']).toBeUndefined();
|
|
151
|
+
expect(result['--od-typography-colour-link']).toBeUndefined();
|
|
152
|
+
});
|
|
153
|
+
it('brands them only when linkColor is passed explicitly', () => {
|
|
154
|
+
const result = vars({
|
|
155
|
+
primaryBackground: BRAND,
|
|
156
|
+
linkColor: BRAND
|
|
157
|
+
});
|
|
158
|
+
expect(result['--od-colours-foreground-link']).toBe(BRAND);
|
|
159
|
+
expect(result['--od-typography-colour-link']).toBe(BRAND);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
describe('invalid values', () => {
|
|
163
|
+
it('warns, drops the key, and does not mutate the caller object', () => {
|
|
164
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
165
|
+
const supplied = {
|
|
166
|
+
primaryBackground: 'not-a-colour',
|
|
167
|
+
primaryForeground: '#ffffff'
|
|
168
|
+
};
|
|
169
|
+
const result = vars(supplied);
|
|
170
|
+
expect(warn).toHaveBeenCalledWith(expect.stringContaining('primaryBackground'));
|
|
171
|
+
expect(result['--od-color-brand-solid']).toBeUndefined();
|
|
172
|
+
// the hook used to `delete` off the prop object itself, which
|
|
173
|
+
// mutates state an MFE may be holding in a GraphQL cache
|
|
174
|
+
expect(supplied.primaryBackground).toBe('not-a-colour');
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
describe('contrast warning', () => {
|
|
178
|
+
it('warns when the brand is too light to read on the page background', () => {
|
|
179
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
180
|
+
// a colour not warned about elsewhere in this file, since the
|
|
181
|
+
// warning is deduplicated for the life of the module
|
|
182
|
+
vars({
|
|
183
|
+
primaryBackground: '#ffd54a'
|
|
184
|
+
});
|
|
185
|
+
expect(warn).toHaveBeenCalledWith(expect.stringContaining('does not meet WCAG AA'));
|
|
186
|
+
});
|
|
187
|
+
it('stays quiet for a brand with enough contrast', () => {
|
|
188
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
189
|
+
vars({
|
|
190
|
+
primaryBackground: BRAND
|
|
191
|
+
});
|
|
192
|
+
expect(warn).not.toHaveBeenCalled();
|
|
193
|
+
});
|
|
194
|
+
it('warns only once for a repeated colour, since the provider re-renders freely', () => {
|
|
195
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
196
|
+
vars({
|
|
197
|
+
primaryBackground: '#ffe08a'
|
|
198
|
+
});
|
|
199
|
+
vars({
|
|
200
|
+
primaryBackground: '#ffe08a'
|
|
201
|
+
});
|
|
202
|
+
vars({
|
|
203
|
+
primaryBackground: '#ffe08a'
|
|
204
|
+
});
|
|
205
|
+
expect(warn).toHaveBeenCalledTimes(1);
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
describe('server rendering', () => {
|
|
209
|
+
it('keeps overrides when the DOM colour check is unavailable', () => {
|
|
210
|
+
// `isValidColor` uses `Option`, a DOM global. Failing closed on the
|
|
211
|
+
// server stripped every override, so a branded page shipped no
|
|
212
|
+
// inline vars and only picked up the brand on hydration.
|
|
213
|
+
const original = globalThis.Option;
|
|
214
|
+
// @ts-expect-error simulating a non-DOM environment
|
|
215
|
+
delete globalThis.Option;
|
|
216
|
+
try {
|
|
217
|
+
const result = vars({
|
|
218
|
+
primaryBackground: BRAND
|
|
219
|
+
});
|
|
220
|
+
expect(result['--od-color-brand-solid']).toBe(BRAND);
|
|
221
|
+
} finally {
|
|
222
|
+
globalThis.Option = original;
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Radio/Radio.css.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,KAAK,QAehB,CAAC;AAEH,eAAO,MAAM,aAAa,QAGxB,CAAC;AAEH,eAAO,MAAM,KAAK,QAYhB,CAAC;AAEH,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"Radio.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Radio/Radio.css.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,KAAK,QAehB,CAAC;AAEH,eAAO,MAAM,aAAa,QAGxB,CAAC;AAEH,eAAO,MAAM,KAAK,QAYhB,CAAC;AAEH,eAAO,MAAM,aAAa,QAQxB,CAAC"}
|
|
@@ -3,7 +3,7 @@ __vanilla_filescope__.setFileScope("lib/components/Radio/Radio.css.ts", "@autogu
|
|
|
3
3
|
import { style } from '@vanilla-extract/css';
|
|
4
4
|
import { overdriveTokens as vars } from "../../themes/theme.css.js";
|
|
5
5
|
import { checkable, nativeInput } from "../private/CheckableBase/CheckableBase.css.js";
|
|
6
|
-
const colorAccent = vars.color.
|
|
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 outerSize = vars.space['6'];
|
|
@@ -42,7 +42,8 @@ export const inner = style([circleBase, {
|
|
|
42
42
|
}
|
|
43
43
|
}], "inner");
|
|
44
44
|
export const innerSelected = style({
|
|
45
|
-
|
|
45
|
+
// on the brand fill, unlike the unselected hover dot above
|
|
46
|
+
backgroundColor: vars.color.brand.onSolid,
|
|
46
47
|
selectors: {
|
|
47
48
|
[`${nativeInput}:hover ~${checkable} &`]: {
|
|
48
49
|
transform: 'scale(0.85)'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Switch/Switch.css.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,IAAI,QAMf,CAAC;AAEH,eAAO,MAAM,MAAM,QAqBjB,CAAC;AAEH,eAAO,MAAM,QAAQ,QAMnB,CAAC;AAEH,eAAO,MAAM,QAAQ,QAOnB,CAAC;AAKH,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"Switch.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Switch/Switch.css.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,IAAI,QAMf,CAAC;AAEH,eAAO,MAAM,MAAM,QAqBjB,CAAC;AAEH,eAAO,MAAM,QAAQ,QAMnB,CAAC;AAEH,eAAO,MAAM,QAAQ,QAOnB,CAAC;AAKH,eAAO,MAAM,MAAM,sCAoCjB,CAAC;AAEH,eAAO,MAAM,UAAU,QAOrB,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { focusOutlineStyle } from "../../styles/focusOutline.css.js";
|
|
|
5
5
|
import { LAYER_ORDER, cssLayerComponent } from "../../styles/layers.css.js";
|
|
6
6
|
import { overdriveTokens as vars } from "../../themes/theme.css.js";
|
|
7
7
|
globalLayer(LAYER_ORDER);
|
|
8
|
-
const colorAccent = vars.color.
|
|
8
|
+
const colorAccent = vars.color.brand.solid;
|
|
9
9
|
const colorContrast = vars.color.background.default;
|
|
10
10
|
const colorMid = vars.colours.background.neutral;
|
|
11
11
|
const colorLight = vars.colours.background.light;
|
|
@@ -78,6 +78,8 @@ export const handle = styleVariants({
|
|
|
78
78
|
[cssLayerComponent]: {
|
|
79
79
|
selectors: {
|
|
80
80
|
[`${toggleOn} &`]: {
|
|
81
|
+
// on the brand track, so on-brand rather than page
|
|
82
|
+
backgroundColor: vars.color.brand.onSolid,
|
|
81
83
|
transform: handleTranslate
|
|
82
84
|
},
|
|
83
85
|
[`${toggle}:not([data-disabled]):hover &`]: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type RecipeVariants } from '@vanilla-extract/recipes';
|
|
2
|
-
export declare const variantIntentionalColors: Record<"success" | "danger" | "warning" | "primary" | "secondary" | "neutral" | "
|
|
3
|
-
export declare const variantIntentionalColorsInverted: Record<"success" | "danger" | "warning" | "primary" | "secondary" | "neutral" | "
|
|
2
|
+
export declare const variantIntentionalColors: Record<"brand" | "success" | "danger" | "warning" | "primary" | "secondary" | "neutral" | "shine" | "information", string>;
|
|
3
|
+
export declare const variantIntentionalColorsInverted: Record<"brand" | "success" | "danger" | "warning" | "primary" | "secondary" | "neutral" | "shine" | "information", string>;
|
|
4
4
|
export declare const styledIntentionalElement: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
5
|
-
intention: Record<"success" | "danger" | "warning" | "primary" | "secondary" | "neutral" | "
|
|
5
|
+
intention: Record<"brand" | "success" | "danger" | "warning" | "primary" | "secondary" | "neutral" | "shine" | "information", object>;
|
|
6
6
|
inverted: {
|
|
7
7
|
true: {};
|
|
8
8
|
false: {};
|
|
@@ -30,18 +30,18 @@ export declare const sprinkles: ((props: {
|
|
|
30
30
|
borderLeftColor?: "white" | "gray900" | "gray800" | "gray700" | "gray600" | "gray500" | "gray400" | "gray300" | "gray200" | "gray100" | "green900" | "green800" | "green700" | "green600" | "green500" | "green400" | "green300" | "green200" | "green100" | "blue900" | "blue800" | "blue700" | "blue600" | "blue500" | "blue400" | "blue300" | "blue200" | "blue100" | "yellow900" | "yellow800" | "yellow700" | "yellow600" | "yellow500" | "yellow400" | "yellow300" | "yellow200" | "yellow100" | "red900" | "red800" | "red700" | "red600" | "red500" | "red400" | "red300" | "red200" | "red100" | "page" | "hard" | "soft" | "accent" | "success" | "info" | "danger" | "warning" | "default" | "emphasis" | "selected" | "strong" | "disabled" | "muted" | "transparent" | undefined;
|
|
31
31
|
borderRightColor?: "white" | "gray900" | "gray800" | "gray700" | "gray600" | "gray500" | "gray400" | "gray300" | "gray200" | "gray100" | "green900" | "green800" | "green700" | "green600" | "green500" | "green400" | "green300" | "green200" | "green100" | "blue900" | "blue800" | "blue700" | "blue600" | "blue500" | "blue400" | "blue300" | "blue200" | "blue100" | "yellow900" | "yellow800" | "yellow700" | "yellow600" | "yellow500" | "yellow400" | "yellow300" | "yellow200" | "yellow100" | "red900" | "red800" | "red700" | "red600" | "red500" | "red400" | "red300" | "red200" | "red100" | "page" | "hard" | "soft" | "accent" | "success" | "info" | "danger" | "warning" | "default" | "emphasis" | "selected" | "strong" | "disabled" | "muted" | "transparent" | undefined;
|
|
32
32
|
borderTopColor?: "white" | "gray900" | "gray800" | "gray700" | "gray600" | "gray500" | "gray400" | "gray300" | "gray200" | "gray100" | "green900" | "green800" | "green700" | "green600" | "green500" | "green400" | "green300" | "green200" | "green100" | "blue900" | "blue800" | "blue700" | "blue600" | "blue500" | "blue400" | "blue300" | "blue200" | "blue100" | "yellow900" | "yellow800" | "yellow700" | "yellow600" | "yellow500" | "yellow400" | "yellow300" | "yellow200" | "yellow100" | "red900" | "red800" | "red700" | "red600" | "red500" | "red400" | "red300" | "red200" | "red100" | "page" | "hard" | "soft" | "accent" | "success" | "info" | "danger" | "warning" | "default" | "emphasis" | "selected" | "strong" | "disabled" | "muted" | "transparent" | undefined;
|
|
33
|
-
borderBottomColour?: "gray" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "
|
|
34
|
-
borderLeftColour?: "gray" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "
|
|
35
|
-
borderRightColour?: "gray" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "
|
|
36
|
-
borderTopColour?: "gray" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "
|
|
33
|
+
borderBottomColour?: "gray" | "brand" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "shine" | "information" | "dark" | undefined;
|
|
34
|
+
borderLeftColour?: "gray" | "brand" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "shine" | "information" | "dark" | undefined;
|
|
35
|
+
borderRightColour?: "gray" | "brand" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "shine" | "information" | "dark" | undefined;
|
|
36
|
+
borderTopColour?: "gray" | "brand" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "shine" | "information" | "dark" | undefined;
|
|
37
37
|
borderLeftStyle?: "none" | "solid" | undefined;
|
|
38
38
|
borderBottomStyle?: "none" | "solid" | undefined;
|
|
39
39
|
borderRightStyle?: "none" | "solid" | undefined;
|
|
40
40
|
borderTopStyle?: "none" | "solid" | undefined;
|
|
41
41
|
color?: "white" | "gray900" | "gray800" | "gray700" | "gray600" | "gray500" | "gray400" | "gray300" | "gray200" | "gray100" | "green900" | "green800" | "green700" | "green600" | "green500" | "green400" | "green300" | "green200" | "green100" | "blue900" | "blue800" | "blue700" | "blue600" | "blue500" | "blue400" | "blue300" | "blue200" | "blue100" | "yellow900" | "yellow800" | "yellow700" | "yellow600" | "yellow500" | "yellow400" | "yellow300" | "yellow200" | "yellow100" | "red900" | "red800" | "red700" | "red600" | "red500" | "red400" | "red300" | "red200" | "red100" | "soft" | "success" | "info" | "danger" | "warning" | "normal" | "inverse" | "placeholder" | "primary" | "secondary" | "reverse" | "tertiary" | "unset" | "infoText" | "infoForeground" | "successText" | "successForeground" | "warningText" | "warningForeground" | "alertText" | "alertForeground" | undefined;
|
|
42
|
-
colour?: "link" | "white" | "body" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "
|
|
42
|
+
colour?: "link" | "white" | "body" | "brand" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "shine" | "information" | "dark" | "muted" | "unset" | undefined;
|
|
43
43
|
backgroundColor?: "white" | "gray900" | "gray800" | "gray700" | "gray600" | "gray500" | "gray400" | "gray300" | "gray200" | "gray100" | "green900" | "green800" | "green700" | "green600" | "green500" | "green400" | "green300" | "green200" | "green100" | "blue900" | "blue800" | "blue700" | "blue600" | "blue500" | "blue400" | "blue300" | "blue200" | "blue100" | "yellow900" | "yellow800" | "yellow700" | "yellow600" | "yellow500" | "yellow400" | "yellow300" | "yellow200" | "yellow100" | "red900" | "red800" | "red700" | "red600" | "red500" | "red400" | "red300" | "red200" | "red100" | "page" | "hard" | "soft" | "accent" | "success" | "info" | "danger" | "warning" | "reverse" | "default" | "inactive" | "emphasisInactive" | "emphasisLight" | "modal" | "transparent" | "infoBackgroundStrong" | "infoBackgroundSubtle" | "successBackgroundStrong" | "successBackgroundSubtle" | "warningBackgroundStrong" | "warningBackgroundSubtle" | "alertBackgroundStrong" | "alertBackgroundSubtle" | undefined;
|
|
44
|
-
backgroundColour?: "white" | "gray900" | "gray800" | "gray700" | "gray600" | "gray500" | "gray400" | "gray300" | "gray200" | "gray100" | "green900" | "green800" | "green700" | "green600" | "green500" | "green400" | "green300" | "green200" | "green100" | "blue900" | "blue800" | "blue700" | "blue600" | "blue500" | "blue400" | "blue300" | "blue200" | "blue100" | "yellow900" | "yellow800" | "yellow700" | "yellow600" | "yellow500" | "yellow400" | "yellow300" | "yellow200" | "yellow100" | "red900" | "red800" | "red700" | "red600" | "red500" | "red400" | "red300" | "red200" | "red100" | "success" | "danger" | "warning" | "primary" | "secondary" | "neutral" | "
|
|
44
|
+
backgroundColour?: "white" | "gray900" | "gray800" | "gray700" | "gray600" | "gray500" | "gray400" | "gray300" | "gray200" | "gray100" | "green900" | "green800" | "green700" | "green600" | "green500" | "green400" | "green300" | "green200" | "green100" | "blue900" | "blue800" | "blue700" | "blue600" | "blue500" | "blue400" | "blue300" | "blue200" | "blue100" | "yellow900" | "yellow800" | "yellow700" | "yellow600" | "yellow500" | "yellow400" | "yellow300" | "yellow200" | "yellow100" | "red900" | "red800" | "red700" | "red600" | "red500" | "red400" | "red300" | "red200" | "red100" | "brand" | "success" | "danger" | "warning" | "primary" | "secondary" | "neutral" | "shine" | "information" | "transparent" | "black900" | undefined;
|
|
45
45
|
opacity?: number | "0" | "1" | undefined;
|
|
46
46
|
fontWeight?: "bold" | "medium" | "normal" | "semiBold" | undefined;
|
|
47
47
|
textTransform?: "capitalize" | "lowercase" | "uppercase" | undefined;
|
|
@@ -56,9 +56,9 @@ export declare const sprinkles: ((props: {
|
|
|
56
56
|
borderColor?: "white" | "gray900" | "gray800" | "gray700" | "gray600" | "gray500" | "gray400" | "gray300" | "gray200" | "gray100" | "green900" | "green800" | "green700" | "green600" | "green500" | "green400" | "green300" | "green200" | "green100" | "blue900" | "blue800" | "blue700" | "blue600" | "blue500" | "blue400" | "blue300" | "blue200" | "blue100" | "yellow900" | "yellow800" | "yellow700" | "yellow600" | "yellow500" | "yellow400" | "yellow300" | "yellow200" | "yellow100" | "red900" | "red800" | "red700" | "red600" | "red500" | "red400" | "red300" | "red200" | "red100" | "page" | "hard" | "soft" | "accent" | "success" | "info" | "danger" | "warning" | "default" | "emphasis" | "selected" | "strong" | "disabled" | "muted" | "transparent" | undefined;
|
|
57
57
|
borderColorX?: "white" | "gray900" | "gray800" | "gray700" | "gray600" | "gray500" | "gray400" | "gray300" | "gray200" | "gray100" | "green900" | "green800" | "green700" | "green600" | "green500" | "green400" | "green300" | "green200" | "green100" | "blue900" | "blue800" | "blue700" | "blue600" | "blue500" | "blue400" | "blue300" | "blue200" | "blue100" | "yellow900" | "yellow800" | "yellow700" | "yellow600" | "yellow500" | "yellow400" | "yellow300" | "yellow200" | "yellow100" | "red900" | "red800" | "red700" | "red600" | "red500" | "red400" | "red300" | "red200" | "red100" | "page" | "hard" | "soft" | "accent" | "success" | "info" | "danger" | "warning" | "default" | "emphasis" | "selected" | "strong" | "disabled" | "muted" | "transparent" | undefined;
|
|
58
58
|
borderColorY?: "white" | "gray900" | "gray800" | "gray700" | "gray600" | "gray500" | "gray400" | "gray300" | "gray200" | "gray100" | "green900" | "green800" | "green700" | "green600" | "green500" | "green400" | "green300" | "green200" | "green100" | "blue900" | "blue800" | "blue700" | "blue600" | "blue500" | "blue400" | "blue300" | "blue200" | "blue100" | "yellow900" | "yellow800" | "yellow700" | "yellow600" | "yellow500" | "yellow400" | "yellow300" | "yellow200" | "yellow100" | "red900" | "red800" | "red700" | "red600" | "red500" | "red400" | "red300" | "red200" | "red100" | "page" | "hard" | "soft" | "accent" | "success" | "info" | "danger" | "warning" | "default" | "emphasis" | "selected" | "strong" | "disabled" | "muted" | "transparent" | undefined;
|
|
59
|
-
borderColour?: "gray" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "
|
|
60
|
-
borderColourX?: "gray" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "
|
|
61
|
-
borderColourY?: "gray" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "
|
|
59
|
+
borderColour?: "gray" | "brand" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "shine" | "information" | "dark" | undefined;
|
|
60
|
+
borderColourX?: "gray" | "brand" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "shine" | "information" | "dark" | undefined;
|
|
61
|
+
borderColourY?: "gray" | "brand" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "shine" | "information" | "dark" | undefined;
|
|
62
62
|
borderStyle?: "none" | "solid" | undefined;
|
|
63
63
|
borderStyleBottom?: "none" | "solid" | undefined;
|
|
64
64
|
borderStyleLeft?: "none" | "solid" | undefined;
|
|
@@ -504,9 +504,9 @@ export declare const valueArrays: {
|
|
|
504
504
|
alignItems: ("stretch" | "center" | "end" | "start" | "baseline" | "centre" | "flexEnd" | "flexStart")[];
|
|
505
505
|
borderColors: ("page" | "hard" | "soft" | "accent" | "success" | "info" | "danger" | "warning" | "default" | "disabled" | "muted")[];
|
|
506
506
|
gapSizesWithVar: ("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "none")[];
|
|
507
|
-
intentBackgroundColoursStandard: ("success" | "danger" | "warning" | "primary" | "secondary" | "neutral" | "
|
|
508
|
-
intentBorderColours: ("success" | "danger" | "warning" | "primary" | "secondary" | "neutral" | "
|
|
509
|
-
intentForegroundColours: ("success" | "danger" | "warning" | "primary" | "secondary" | "neutral" | "
|
|
507
|
+
intentBackgroundColoursStandard: ("brand" | "success" | "danger" | "warning" | "primary" | "secondary" | "neutral" | "shine" | "information")[];
|
|
508
|
+
intentBorderColours: ("brand" | "success" | "danger" | "warning" | "primary" | "secondary" | "neutral" | "shine" | "information")[];
|
|
509
|
+
intentForegroundColours: ("brand" | "success" | "danger" | "warning" | "primary" | "secondary" | "neutral" | "shine" | "information")[];
|
|
510
510
|
justifyContent: ("space-around" | "space-between" | "space-evenly" | "stretch" | "center" | "end" | "start" | "centre" | "spaceAround" | "spaceBetween" | "flexEnd" | "flexStart")[];
|
|
511
511
|
spaceWithNone: ("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "none")[];
|
|
512
512
|
width: ("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "full" | "auto" | "fit-content" | "max-content" | "min-content")[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const sprinklesLegacyText: ((props: {
|
|
2
|
-
color?: "link" | "white" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "
|
|
2
|
+
color?: "link" | "white" | "brand" | "success" | "danger" | "warning" | "primary" | "secondary" | "light" | "neutral" | "shine" | "information" | "dark" | "muted" | "unset" | undefined;
|
|
3
3
|
}) => string) & {
|
|
4
4
|
properties: Set<"color">;
|
|
5
5
|
};
|
|
@@ -32,9 +32,10 @@ describe('contrast guide', () => {
|
|
|
32
32
|
const tokenPairs = tokens => {
|
|
33
33
|
const {
|
|
34
34
|
surface,
|
|
35
|
-
content
|
|
35
|
+
content,
|
|
36
|
+
brand
|
|
36
37
|
} = tokens.color;
|
|
37
|
-
return [['content.normal on surface.page', content.normal, surface.page], ['content.soft on surface.page', content.soft, surface.page], ['content.inverse on surface.hard', content.inverse, surface.hard], ['content.inverse on surface.soft', content.inverse, surface.soft], ['content.info on surface.page', content.info, surface.page], ['content.danger on surface.page', content.danger, surface.page], ['content.success on surface.page', content.success, surface.page], ['content.warning on surface.page', content.warning, surface.page]].concat(_toConsumableArray(Object.entries(tokens.colours.intent).flatMap(([name, intent]) => [[`intent.${name} foreground on background.standard`, intent.foreground, intent.background.standard], [`intent.${name} foreground on background.strong`, intent.foreground, intent.background.strong]])));
|
|
38
|
+
return [['brand.onSolid on brand.solid', brand.onSolid, brand.solid], ['content.normal on surface.page', content.normal, surface.page], ['content.soft on surface.page', content.soft, surface.page], ['content.inverse on surface.hard', content.inverse, surface.hard], ['content.inverse on surface.soft', content.inverse, surface.soft], ['content.info on surface.page', content.info, surface.page], ['content.danger on surface.page', content.danger, surface.page], ['content.success on surface.page', content.success, surface.page], ['content.warning on surface.page', content.warning, surface.page]].concat(_toConsumableArray(Object.entries(tokens.colours.intent).flatMap(([name, intent]) => [[`intent.${name} foreground on background.standard`, intent.foreground, intent.background.standard], [`intent.${name} foreground on background.strong`, intent.foreground, intent.background.strong]])));
|
|
38
39
|
};
|
|
39
40
|
const KNOWN_AA_FAILURES = {
|
|
40
41
|
base: ['content.warning on surface.page', 'intent.brand foreground on background.standard', 'intent.primary foreground on background.standard', 'intent.primary foreground on background.strong', 'intent.shine foreground on background.standard', 'intent.shine foreground on background.strong', 'intent.success foreground on background.standard', 'intent.warning foreground on background.standard', 'intent.warning foreground on background.strong'],
|
|
@@ -42,6 +43,14 @@ const KNOWN_AA_FAILURES = {
|
|
|
42
43
|
neutral: ['content.warning on surface.page', 'intent.brand foreground on background.standard', 'intent.shine foreground on background.standard', 'intent.shine foreground on background.strong', 'intent.success foreground on background.standard', 'intent.warning foreground on background.standard', 'intent.warning foreground on background.strong']
|
|
43
44
|
};
|
|
44
45
|
describe.each([['base', baseTokens], ['flat_red', flatRedTokens], ['neutral', neutralTokens]])('theme token audit: %s', (themeName, tokens) => {
|
|
46
|
+
// The brand pair is seeded to the values its consumers (Switch, Radio,
|
|
47
|
+
// CheckBox) rendered before it existed, which is what makes introducing it a
|
|
48
|
+
// zero-visual-change addition. If someone re-brands the seed without also
|
|
49
|
+
// moving those components, this fails first and says why.
|
|
50
|
+
it('seeds the brand pair to the values its consumers rendered before it existed', () => {
|
|
51
|
+
expect(tokens.color.brand.solid).toBe(tokens.color.foreground.primary);
|
|
52
|
+
expect(tokens.color.brand.onSolid).toBe(tokens.color.background.default);
|
|
53
|
+
});
|
|
45
54
|
it('has no undocumented AA failures in intended pairings', () => {
|
|
46
55
|
const failures = tokenPairs(tokens).filter(([, foreground, background]) => {
|
|
47
56
|
return ratio(foreground, background) < 4.5;
|
|
@@ -87,6 +87,10 @@ declare const _default: {
|
|
|
87
87
|
'100': `var(--${string})`;
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
|
+
brand: {
|
|
91
|
+
solid: `var(--${string})`;
|
|
92
|
+
onSolid: `var(--${string})`;
|
|
93
|
+
};
|
|
90
94
|
surface: {
|
|
91
95
|
page: `var(--${string})`;
|
|
92
96
|
hard: `var(--${string})`;
|
|
@@ -615,6 +619,10 @@ declare const _default: {
|
|
|
615
619
|
};
|
|
616
620
|
white: `var(--${string})`;
|
|
617
621
|
};
|
|
622
|
+
brand: {
|
|
623
|
+
solid: string;
|
|
624
|
+
onSolid: string;
|
|
625
|
+
};
|
|
618
626
|
surface: {
|
|
619
627
|
page: string;
|
|
620
628
|
hard: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/themes/base/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/themes/base/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,wBAKE"}
|
|
@@ -98,6 +98,23 @@ export declare const tokens: {
|
|
|
98
98
|
};
|
|
99
99
|
white: `var(--${string})`;
|
|
100
100
|
};
|
|
101
|
+
/**
|
|
102
|
+
* Seeded to the values the surfaces reading it render today, so adding
|
|
103
|
+
* this pair is byte-identical on every theme: `solid` matches
|
|
104
|
+
* `color.foreground.primary` and `onSolid` matches
|
|
105
|
+
* `color.background.default`.
|
|
106
|
+
*
|
|
107
|
+
* Raw hex, not a `colours.gamut.*` var alias — `color.gamut.*` is a
|
|
108
|
+
* transition bridge onto the legacy gamut, which `flat_red` overrides.
|
|
109
|
+
* Raw hex keeps the resolved value the same in all three themes, and is
|
|
110
|
+
* how `foreground.primary` / `background.default` are already seeded.
|
|
111
|
+
*
|
|
112
|
+
* A tenant re-brands this pair at runtime via `colorOverrides`.
|
|
113
|
+
*/
|
|
114
|
+
brand: {
|
|
115
|
+
solid: string;
|
|
116
|
+
onSolid: string;
|
|
117
|
+
};
|
|
101
118
|
surface: {
|
|
102
119
|
page: string;
|
|
103
120
|
hard: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../lib/themes/base/tokens.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4BjB;;;;;;;;;;WAUG
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../lib/themes/base/tokens.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4BjB;;;;;;;;;;WAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA2DH;;;;;;;;;;;;WAYG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoZkB,CAAC"}
|
|
@@ -105,6 +105,24 @@ export const tokens = {
|
|
|
105
105
|
},
|
|
106
106
|
white: overdriveTokens.colours.gamut.white
|
|
107
107
|
},
|
|
108
|
+
/**
|
|
109
|
+
* Seeded to the values the surfaces reading it render today, so adding
|
|
110
|
+
* this pair is byte-identical on every theme: `solid` matches
|
|
111
|
+
* `color.foreground.primary` and `onSolid` matches
|
|
112
|
+
* `color.background.default`.
|
|
113
|
+
*
|
|
114
|
+
* Raw hex, not a `colours.gamut.*` var alias — `color.gamut.*` is a
|
|
115
|
+
* transition bridge onto the legacy gamut, which `flat_red` overrides.
|
|
116
|
+
* Raw hex keeps the resolved value the same in all three themes, and is
|
|
117
|
+
* how `foreground.primary` / `background.default` are already seeded.
|
|
118
|
+
*
|
|
119
|
+
* A tenant re-brands this pair at runtime via `colorOverrides`.
|
|
120
|
+
*/
|
|
121
|
+
brand: {
|
|
122
|
+
solid: colourMap.gray['900'],
|
|
123
|
+
// #212338
|
|
124
|
+
onSolid: colourMap.white // #ffffff
|
|
125
|
+
},
|
|
108
126
|
surface: {
|
|
109
127
|
page: colourMap.white,
|
|
110
128
|
hard: colourMap.gray['900'],
|
|
@@ -87,6 +87,10 @@ declare const _default: {
|
|
|
87
87
|
'100': `var(--${string})`;
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
|
+
brand: {
|
|
91
|
+
solid: `var(--${string})`;
|
|
92
|
+
onSolid: `var(--${string})`;
|
|
93
|
+
};
|
|
90
94
|
surface: {
|
|
91
95
|
page: `var(--${string})`;
|
|
92
96
|
hard: `var(--${string})`;
|
|
@@ -615,6 +619,10 @@ declare const _default: {
|
|
|
615
619
|
};
|
|
616
620
|
white: `var(--${string})`;
|
|
617
621
|
};
|
|
622
|
+
brand: {
|
|
623
|
+
solid: string;
|
|
624
|
+
onSolid: string;
|
|
625
|
+
};
|
|
618
626
|
surface: {
|
|
619
627
|
page: string;
|
|
620
628
|
hard: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/themes/flat_red/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/themes/flat_red/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,wBAKE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../lib/themes/flat_red/tokens.ts"],"names":[],"mappings":"AAmEA,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../lib/themes/flat_red/tokens.ts"],"names":[],"mappings":"AAmEA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DK,CAAC"}
|
package/dist/themes/index.d.ts
CHANGED
|
@@ -90,6 +90,10 @@ export declare const themes: {
|
|
|
90
90
|
'100': `var(--${string})`;
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
|
+
brand: {
|
|
94
|
+
solid: `var(--${string})`;
|
|
95
|
+
onSolid: `var(--${string})`;
|
|
96
|
+
};
|
|
93
97
|
surface: {
|
|
94
98
|
page: `var(--${string})`;
|
|
95
99
|
hard: `var(--${string})`;
|
|
@@ -618,6 +622,10 @@ export declare const themes: {
|
|
|
618
622
|
};
|
|
619
623
|
white: `var(--${string})`;
|
|
620
624
|
};
|
|
625
|
+
brand: {
|
|
626
|
+
solid: string;
|
|
627
|
+
onSolid: string;
|
|
628
|
+
};
|
|
621
629
|
surface: {
|
|
622
630
|
page: string;
|
|
623
631
|
hard: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/themes/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,WAAW,CAAC;AAEpD,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/themes/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA0C,CAAC;AAC9D,OAAO,EACN,aAAa,EACb,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,aAAa,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,eAAe,EACf,iBAAiB,EACjB,KAAK,WAAW,GAChB,MAAM,aAAa,CAAC;AACrB,mBAAmB,SAAS,CAAC"}
|
|
@@ -99,6 +99,10 @@ export declare const themeTokensWithLayer: (tokens: ThemeTokens) => {
|
|
|
99
99
|
'100': `var(--${string})`;
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
|
+
brand: {
|
|
103
|
+
solid: `var(--${string})`;
|
|
104
|
+
onSolid: `var(--${string})`;
|
|
105
|
+
};
|
|
102
106
|
surface: {
|
|
103
107
|
page: `var(--${string})`;
|
|
104
108
|
hard: `var(--${string})`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeTheme.d.ts","sourceRoot":"","sources":["../../lib/themes/makeTheme.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC;AAE/E,eAAO,MAAM,WAAW,EAAE,WAKzB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,WAAW,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,KAAK,IAAI,WAErD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,QAAO,SAAS,WAAW,EAEpD,CAAC;AAEF,eAAO,MAAM,UAAU,8CAGtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,WAAW
|
|
1
|
+
{"version":3,"file":"makeTheme.d.ts","sourceRoot":"","sources":["../../lib/themes/makeTheme.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AAC,CAAC;AAEjE,eAAO,MAAM,gBAAgB,GAAI,SAAS,SAAS,KAAG,gBAepD,CAAC"}
|
|
@@ -87,6 +87,10 @@ declare const _default: {
|
|
|
87
87
|
'100': `var(--${string})`;
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
|
+
brand: {
|
|
91
|
+
solid: `var(--${string})`;
|
|
92
|
+
onSolid: `var(--${string})`;
|
|
93
|
+
};
|
|
90
94
|
surface: {
|
|
91
95
|
page: `var(--${string})`;
|
|
92
96
|
hard: `var(--${string})`;
|
|
@@ -615,6 +619,10 @@ declare const _default: {
|
|
|
615
619
|
};
|
|
616
620
|
white: `var(--${string})`;
|
|
617
621
|
};
|
|
622
|
+
brand: {
|
|
623
|
+
solid: string;
|
|
624
|
+
onSolid: string;
|
|
625
|
+
};
|
|
618
626
|
surface: {
|
|
619
627
|
page: string;
|
|
620
628
|
hard: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/themes/neutral/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/themes/neutral/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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file":"tokens.d.ts","sourceRoot":"","sources":["../../../lib/themes/neutral/tokens.ts"],"names":[],"mappings":"AAoEA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiLK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.css.d.ts","sourceRoot":"","sources":["../../lib/themes/theme.css.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAKpD,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;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MAAM,SAAS,QAKpB,CAAC"}
|
package/dist/themes/theme.css.js
CHANGED
|
@@ -101,6 +101,22 @@ const THEME_CONTRACT = {
|
|
|
101
101
|
// new colour token structure 2025
|
|
102
102
|
color: {
|
|
103
103
|
gamut: coloursWithWhite,
|
|
104
|
+
/**
|
|
105
|
+
* The tenant brand accent — the "on" colour of a selection control and
|
|
106
|
+
* the seed a tenant re-brands from.
|
|
107
|
+
*
|
|
108
|
+
* Deliberately its own pair rather than a reuse of
|
|
109
|
+
* `color.foreground.primary`: that leaf is body-text ink shared with
|
|
110
|
+
* nine unrelated components, so a tenant branding its checked controls
|
|
111
|
+
* would drag every piece of primary text along with them.
|
|
112
|
+
*
|
|
113
|
+
* `onSolid` is the contrast-safe content placed on top of `solid` — the
|
|
114
|
+
* Switch handle, the Radio dot, the CheckBox tick.
|
|
115
|
+
*/
|
|
116
|
+
brand: {
|
|
117
|
+
solid: 'color-brand-solid',
|
|
118
|
+
onSolid: 'color-brand-on-solid'
|
|
119
|
+
},
|
|
104
120
|
surface: {
|
|
105
121
|
page: null,
|
|
106
122
|
hard: null,
|