@integritymarketing/ic-tokens
v0.4.0
Published
Palette primitives and CSS custom-property tokens. palette.ts is the only file in the monorepo where a hex literal may appear. Zero runtime dependencies by design, so non-React consumers (email, the Make kit, Figma variables) can install it without pullin
Readme
@integritymarketing/ic-tokens
Palette primitives and CSS custom properties. Zero runtime dependencies.
pnpm add @integritymarketing/ic-tokensimport { cssVariables } from '@integritymarketing/ic-tokens/tokens';
import { navyPalette } from '@integritymarketing/ic-tokens/palette';@import '@integritymarketing/ic-tokens/tokens.css'; /* :root { --navy: …; } */The one rule
src/palette.ts is the only file in this entire monorepo where a hex literal
may appear. Everywhere else a hex is a lint error.
palette.ts raw values, grouped by hue #052A63
↓
tokens.ts semantic CSS custom properties --navy, --divider, --alert-error-bg
↓
components var(--token), never a valueComponents consume the semantic name. That is what lets a colour change once
and land everywhere, and it is why --divider exists rather than fifteen
components each picking their own grey.
If you need a colour the palette does not have: ask. Adding one is a design system decision, not a local one.
What ships
| Export | Contents |
| --------------- | ------------------------------------------------------------------ |
| . | barrel — palette + tokens |
| ./palette | the raw hue groups and shadow definitions |
| ./tokens | cssVariables — 180 CSS custom properties — and CssVariableName |
| ./tokens.css | generated :root { … } for plain-CSS consumers |
| ./tokens.json | generated map, for Figma variables import and tooling |
The last two are emitted by scripts/emit-css.ts during pnpm build, from the
same cssVariables object the components use — so they cannot drift. Never hand-edit dist/.
Why this is separate from theme
@integritymarketing/ic-theme declares MUI as a peer, so installing it pulls in
React's whole ecosystem. This package has no dependencies at all, so anything
that only needs colour values — the email generator, the Figma Make kit, a
Figma variables import — installs this instead.
Coverage
| Category | Count | | -------------------------------------------------- | ------- | | Colour (brand, semantic, alerts, component, chart) | 97 | | Spacing (ladder + layout + shell + touch target) | 26 | | Motion (durations + easings) | 12 | | Typography | 9 | | Elevation / shadow | 8 | | Breakpoints | 5 | | Radius | 2 | | Total | 159 |
All five categories named in the platform proposal exist, plus breakpoints.
One counting trap, because it has caused a miscount already: the --text-*
prefix spans two categories. --text-h1 … --text-label are six type sizes
and count as typography, while --text-primary, --text-secondary and
--text-disabled are colours. Read the value, not the name.
Three worth knowing about:
Spacing uses design's own token names and values, read off the
padding & gap/*group on the Page Template (v2-Organisms, node 8208:220653):none·x-sm(4) ·sm(8) ·sm-plus(12) ·md(16) ·lg(24), plusxl(32) and2xl(40) of ours. The awkwardsm+is deliberate — an earlier conventional ladder put--space-smat 12px while design'ssmis 8px, one step out of phase. In a component prefer MUI'ssx={{ p: 2 }}; the tokens are for consumers that cannot calltheme.spacing.Breakpoints come from the min/max constraints on the same Page Template artboards —
0 / 320 / 768 / 1200 / 1521.breakpointscarries the full range plus the width each size is drawn at;mediaQueriesgives ready-madeupandonlyquery strings;theme.breakpointsis built from the same constants. Do not use the Atomic Library'sbreakpointstoken group (444/600/900/1200/1536): those are MUI's defaults, namedDefault-*, andxs: 444sat above design's own 376px Small artboard — breaking everysx={{ xs: … }}on real phones.Motion is documented in
docs/foundations/motion.md. The duration scale mirrors MUI's andtheme.tsassigns the same constants back totheme.transitionsso the two cannot drift. Reduced motion is handled once here — seereducedMotionOverrides.
Publishing
On any token or palette change. A bump here cascades to theme, ui-core,
ui-connect, ui-pro, email and make-kit — which is correct, because a
token change really does alter all of their output.
