@kiva/kv-tokens 4.0.3 → 4.2.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/README.md CHANGED
@@ -65,6 +65,7 @@ Our Tailwind config has some differences to the standard install. Notably
65
65
  | `@kiva/kv-tokens/js` | `dist/js/tokens.js` | Generated JS tokens (flat + nested) |
66
66
  | `@kiva/kv-tokens/css` | `dist/css/tokens.css` | Themed CSS custom properties |
67
67
  | `@kiva/kv-tokens/scss` | `dist/scss/tokens.scss` | SCSS `$variable` map |
68
+ | `@kiva/kv-tokens/make-kit/*` | `dist/make-kit/*` | Figma Make kit (guidelines + style context) |
68
69
 
69
70
  ## Importing Source Tokens
70
71
 
@@ -99,6 +100,36 @@ Or read them off disk from `node_modules/@kiva/kv-tokens/tokens/…` — useful
99
100
 
100
101
  For the transformed, resolved-values-with-code-facing-names shape used by component code, prefer the default export of `@kiva/kv-tokens` or the flat-and-nested `@kiva/kv-tokens/js` module.
101
102
 
103
+ ## Figma Make kit
104
+
105
+ `npm run build` emits `dist/make-kit/`, a [Figma Make kit](https://developers.figma.com/docs/code/write-design-system-guidelines/) built from the design-system skills in [`docs/skills/`](docs/skills):
106
+
107
+ ```
108
+ dist/make-kit/
109
+ ├── styles.css # compiled Tailwind stylesheet (base + utilities + type + theme vars)
110
+ └── guidelines/
111
+ ├── Guidelines.md # routing document Make reads first (replaces Make's auto-created stub)
112
+ ├── setup.md # how to consume the kit (styles.css, tw- prefix, theming)
113
+ └── foundations/*.md # one file per design foundation
114
+ ```
115
+
116
+ A skill is included in the kit when its frontmatter sets `make_kit.include: true` (with a `category` and `order`); skills without that block are excluded. Adding a new tagged skill makes it appear in the kit — and in the `Guidelines.md` routing — on the next build, with no script changes. The transform logic lives in [`build/make-kit-transform.js`](build/make-kit-transform.js); the orchestrator is [`build/build-make-kit.js`](build/build-make-kit.js).
117
+
118
+ `styles.css` is the Kiva Tailwind preset compiled to a full stylesheet — base layer (fonts, headings), `tw-`-prefixed token utilities, the `tw-text-*` type system (with responsive variants), and every theme's color variables — so Make can match the design system's measurements and type whether or not it runs Tailwind itself. The safelist of utilities to emit is generated from the token scales ([`build/make-kit-safelist.js`](build/make-kit-safelist.js)), so it stays in sync as tokens change.
119
+
120
+ ### Importing into Figma Make
121
+
122
+ Figma Make has no API to pull these in by path — you upload/drag the files into the kit. One-time setup:
123
+
124
+ 1. **Get the files:** `npm i @kiva/kv-tokens`, then copy from `node_modules/@kiva/kv-tokens/dist/make-kit/` (the `guidelines/` files and `styles.css`).
125
+ 2. In Figma Make: **Settings → Create a kit**.
126
+ 3. Open the **Code** view → the **`guidelines/`** folder. **Upload or drag in** `setup.md` and the `foundations/*.md` files, and replace the auto-created `Guidelines.md` with ours (or paste its contents in).
127
+ 4. Add **`styles.css`** to the project as the kit's style context (drag it into the file explorer).
128
+ 5. *(Optional)* The kit import modal also accepts npm packages and library styles, but Make kits currently support **React** codebases only — so `@kiva/kv-tokens` (a Tailwind/token package, not React) isn't added here; the compiled `styles.css` is the delivery.
129
+ 6. **Test** (prompt Make to build something and confirm it matches), then **Publish kit** to your team/org. Teammates pick it via **"Select a Make kit"** in a Make file.
130
+
131
+ See [Get started with Make kits](https://help.figma.com/hc/en-us/articles/39241689698839-Get-started-with-Make-kits) and [Add guidelines to Figma Make](https://help.figma.com/hc/en-us/articles/33665861260823-Add-guidelines-to-Figma-Make).
132
+
102
133
  ## Local Development
103
134
 
104
135
  The `dist/` directory is gitignored but regenerated automatically by the `prepare` lifecycle script whenever you run `npm install` — both at the monorepo root and inside this package. After a fresh clone, `npm install` leaves `dist/` ready to use, so downstream workspace packages like [`@kiva/kv-components`](../kv-components/) can consume tokens without a separate build step.
@@ -6,7 +6,6 @@ const {
6
6
  fontSizes,
7
7
  fontWeights,
8
8
  letterSpacings,
9
- lineHeights,
10
9
  lineHeightsAbsolute,
11
10
  radii,
12
11
  semanticFontSizes,
@@ -288,99 +287,6 @@ export const textBaseColor = 'rgb(var(--text-primary))';
288
287
  REUSABLE TYPE STYLES
289
288
  */
290
289
  export const textStyles = (() => {
291
- const textJumbo = {
292
- fontFamily: fonts.serif,
293
- fontWeight: fontWeights.medium,
294
- fontSize: rem(fontSizes.jumbo.sm),
295
- letterSpacing: letterSpacings['-1'],
296
- lineHeight: lineHeights.tight,
297
- '@screen md': {
298
- fontSize: rem(fontSizes.jumbo.md),
299
- },
300
- '@screen lg': {
301
- fontSize: rem(fontSizes.jumbo.lg),
302
- },
303
- };
304
-
305
- const textH1 = {
306
- fontFamily: fonts.serif,
307
- fontSize: rem(fontSizes.h1.sm),
308
- fontWeight: fontWeights.medium,
309
- letterSpacing: em(letterSpacings['-0.5'], fontSizes.h1.md),
310
- lineHeight: lineHeights.tight,
311
- '@screen md': {
312
- fontSize: rem(fontSizes.h1.md),
313
- },
314
- '@screen lg': {
315
- fontSize: rem(fontSizes.h1.lg),
316
- },
317
- };
318
-
319
- const textH2 = {
320
- fontFamily: fonts.serif,
321
- fontSize: rem(fontSizes.h2.sm),
322
- fontWeight: fontWeights.medium,
323
- letterSpacing: em(letterSpacings.normal, fontSizes.h2.sm),
324
- lineHeight: lineHeights.tight,
325
- '@screen md': {
326
- fontSize: rem(fontSizes.h2.md),
327
- letterSpacing: em(letterSpacings['-0.3'], fontSizes.h2.md),
328
- },
329
- '@screen lg': {
330
- fontSize: rem(fontSizes.h2.lg),
331
- letterSpacing: em(letterSpacings['-0.3'], fontSizes.h2.lg),
332
- lineHeight: lineHeights['nearly-none'],
333
- },
334
- };
335
-
336
- const textH3 = {
337
- fontSize: rem(fontSizes.h3.sm),
338
- fontWeight: fontWeights.normal,
339
- letterSpacing: em(letterSpacings['-1'], fontSizes.h3.sm),
340
- lineHeight: lineHeights.tight,
341
- '@screen md': {
342
- fontSize: rem(fontSizes.h3.md),
343
- },
344
- '@screen lg': {
345
- fontSize: rem(fontSizes.h3.lg),
346
- },
347
- };
348
-
349
- const textH4 = {
350
- fontSize: rem(fontSizes.h4.sm),
351
- fontWeight: fontWeights.normal,
352
- lineHeight: lineHeights.normal,
353
- textTransform: 'uppercase',
354
- '@screen md': {
355
- fontSize: rem(fontSizes.h4.md),
356
- },
357
- '@screen lg': {
358
- fontSize: rem(fontSizes.h4.lg),
359
- },
360
- };
361
-
362
- const textH5 = {
363
- fontFamily: fonts.sans,
364
- fontSize: rem(fontSizes.h4.sm),
365
- fontWeight: fontWeights.normal,
366
- letterSpacing: em(letterSpacings.normal, fontSizes.subhead.sm),
367
- lineHeight: lineHeights['nearly-none'],
368
- };
369
-
370
- const textSubhead = {
371
- fontFamily: fonts.sans,
372
- fontSize: rem(fontSizes.subhead.sm),
373
- fontWeight: fontWeights.light,
374
- letterSpacing: em(letterSpacings.normal, fontSizes.subhead.sm),
375
- lineHeight: lineHeights.tight,
376
- '@screen md': {
377
- fontSize: rem(fontSizes.subhead.md),
378
- },
379
- '@screen lg': {
380
- fontSize: rem(fontSizes.subhead.lg),
381
- },
382
- };
383
-
384
290
  const textBase = {
385
291
  fontWeight: fontWeights.light,
386
292
  fontSize: rem(fontSizes.base.sm),
@@ -409,21 +315,6 @@ export const textStyles = (() => {
409
315
  fontWeight: fontWeights.light,
410
316
  };
411
317
 
412
- const textBlockquote = {
413
- fontFamily: fonts.serif,
414
- fontSize: rem(fontSizes.h2.sm),
415
- fontStyle: 'italic',
416
- fontWeight: fontWeights.medium,
417
- letterSpacing: em(letterSpacings['-0.5'], fontSizes.h2.sm),
418
- lineHeight: lineHeights.tight,
419
- '@screen md': {
420
- fontSize: rem(fontSizes.h2.md),
421
- },
422
- '@screen lg': {
423
- fontSize: rem(fontSizes.h2.lg),
424
- },
425
- };
426
-
427
318
  const textDisplay = {
428
319
  fontFamily: fonts.serif,
429
320
  fontWeight: fontWeights.medium,
@@ -442,6 +333,8 @@ export const textStyles = (() => {
442
333
  },
443
334
  };
444
335
 
336
+ const textJumbo = { ...textDisplay };
337
+
445
338
  const textHeadline = {
446
339
  fontFamily: fonts.serif,
447
340
  fontWeight: fontWeights.medium,
@@ -451,6 +344,7 @@ export const textStyles = (() => {
451
344
  '@screen md': {
452
345
  fontSize: rem(semanticFontSizes.h1.md),
453
346
  letterSpacing: em(letterSpacings['-200'], semanticFontSizes.h1.md),
347
+ lineHeight: em(lineHeightsAbsolute.h1.md, semanticFontSizes.h1.md),
454
348
  },
455
349
  '@screen lg': {
456
350
  fontSize: rem(semanticFontSizes.h1.lg),
@@ -459,6 +353,8 @@ export const textStyles = (() => {
459
353
  },
460
354
  };
461
355
 
356
+ const textH1 = { ...textHeadline };
357
+
462
358
  const textHeadlineTwo = {
463
359
  fontFamily: fonts.serif,
464
360
  fontWeight: fontWeights.medium,
@@ -468,6 +364,7 @@ export const textStyles = (() => {
468
364
  '@screen md': {
469
365
  fontSize: rem(semanticFontSizes.h2.md),
470
366
  letterSpacing: em(letterSpacings['-200'], semanticFontSizes.h2.md),
367
+ lineHeight: em(lineHeightsAbsolute.h2.md, semanticFontSizes.h2.md),
471
368
  },
472
369
  '@screen lg': {
473
370
  fontSize: rem(semanticFontSizes.h2.lg),
@@ -476,6 +373,13 @@ export const textStyles = (() => {
476
373
  },
477
374
  };
478
375
 
376
+ const textH2 = { ...textHeadlineTwo };
377
+
378
+ const textBlockquote = {
379
+ ...textHeadlineTwo,
380
+ fontStyle: 'italic',
381
+ };
382
+
479
383
  const textSubheadline = {
480
384
  fontFamily: fonts.sans,
481
385
  fontWeight: fontWeights.light,
@@ -484,13 +388,19 @@ export const textStyles = (() => {
484
388
  lineHeight: em(lineHeightsAbsolute.h3.sm, semanticFontSizes.h3.sm),
485
389
  '@screen md': {
486
390
  fontSize: rem(semanticFontSizes.h3.md),
391
+ letterSpacing: em(letterSpacings.normal, semanticFontSizes.h3.md),
392
+ lineHeight: em(lineHeightsAbsolute.h3.md, semanticFontSizes.h3.md),
487
393
  },
488
394
  '@screen lg': {
489
395
  fontSize: rem(semanticFontSizes.h3.lg),
396
+ letterSpacing: em(letterSpacings.normal, semanticFontSizes.h3.lg),
490
397
  lineHeight: em(lineHeightsAbsolute.h3.lg, semanticFontSizes.h3.lg),
491
398
  },
492
399
  };
493
400
 
401
+ const textH3 = { ...textSubheadline };
402
+ const textSubhead = { ...textSubheadline };
403
+
494
404
  const textTitle = {
495
405
  fontFamily: fonts.sans,
496
406
  fontWeight: fontWeights.normal,
@@ -499,13 +409,20 @@ export const textStyles = (() => {
499
409
  lineHeight: em(lineHeightsAbsolute.h3.sm, semanticFontSizes.h3.sm),
500
410
  '@screen md': {
501
411
  fontSize: rem(semanticFontSizes.h3.md),
412
+ letterSpacing: em(letterSpacings.normal, semanticFontSizes.h3.md),
413
+ lineHeight: em(lineHeightsAbsolute.h3.md, semanticFontSizes.h3.md),
502
414
  },
503
415
  '@screen lg': {
504
416
  fontSize: rem(semanticFontSizes.h3.lg),
417
+ letterSpacing: em(letterSpacings.normal, semanticFontSizes.h3.lg),
505
418
  lineHeight: em(lineHeightsAbsolute.h3.lg, semanticFontSizes.h3.lg),
506
419
  },
507
420
  };
508
421
 
422
+ const textH4 = { ...textTitle };
423
+
424
+ const textH5 = { ...textBase };
425
+
509
426
  const textButtonLink = {
510
427
  fontFamily: fonts.sans,
511
428
  fontWeight: fontWeights.medium,
@@ -540,27 +457,27 @@ export const textStyles = (() => {
540
457
  };
541
458
 
542
459
  return {
460
+ textDisplay,
543
461
  textJumbo,
462
+ textHeadline,
544
463
  textH1,
464
+ textHeadlineTwo,
545
465
  textH2,
466
+ textBlockquote,
467
+ textSubheadline,
468
+ textSubhead,
546
469
  textH3,
470
+ textTitle,
547
471
  textH4,
548
472
  textH5,
549
- textSubhead,
550
473
  textBase,
551
474
  textSmall,
475
+ textCaption,
552
476
  textLink,
553
- textPlaceholder,
554
- textBlockquote,
555
- textDisplay,
556
- textHeadline,
557
- textHeadlineTwo,
558
- textSubheadline,
559
- textTitle,
560
477
  textButtonLink,
561
478
  textUpper,
562
479
  textLabel,
563
- textCaption,
480
+ textPlaceholder,
564
481
  };
565
482
  })();
566
483
 
@@ -617,9 +534,16 @@ export const proseOverrides = () => ({
617
534
  h2: false,
618
535
  h3: false,
619
536
  h4: false,
537
+ caption: {
538
+ ...textStyles.textCaption,
539
+ },
620
540
  figcaption: {
621
- fontSize: false,
622
- lineHeight: false,
541
+ // fontSize: false,
542
+ // lineHeight: false,
543
+ ...textStyles.textCaption,
544
+ },
545
+ label: {
546
+ ...textStyles.textLabel,
623
547
  },
624
548
  code: {
625
549
  color: false,
@@ -636,39 +560,47 @@ export const proseOverrides = () => ({
636
560
  marginBottom: rem(space[2]),
637
561
  },
638
562
  blockquote: {
563
+ ...textStyles?.textBlockquote,
639
564
  marginTop: rem(space[2]),
640
565
  marginBottom: rem(space[2]),
641
566
  padding: `0 0 0 ${rem(space['6'])}`,
642
567
  },
643
568
  h1: {
644
- fontSize: false,
645
- letterSpacing: false,
569
+ ...textStyles?.textDisplay,
570
+ // fontSize: false,
571
+ // letterSpacing: false,
646
572
  marginTop: '0',
647
573
  marginBottom: rem(space[2]),
648
574
  color: textBaseColor,
649
575
  },
650
576
  h2: {
651
- fontSize: false,
652
- letterSpacing: false,
577
+ // fontSize: false,
578
+ // letterSpacing: false,
579
+ ...textStyles?.textHeadline,
653
580
  marginTop: rem(space[2]),
654
581
  marginBottom: rem(space[2]),
655
582
  color: textBaseColor,
656
583
  },
657
584
  h3: {
658
- fontSize: false,
659
- letterSpacing: false,
585
+ // fontSize: false,
586
+ // letterSpacing: false,
587
+ ...textStyles?.textHeadlineTwo,
660
588
  marginTop: rem(space[2]),
661
589
  marginBottom: rem(space[2]),
662
590
  color: textBaseColor,
663
591
  },
664
592
  h4: {
665
- letterSpacing: false,
593
+ // fontSize: false,
594
+ // letterSpacing: false,
595
+ ...textStyles?.textSubheadline,
666
596
  marginTop: false,
667
597
  marginBottom: rem(space[2]),
668
598
  color: textBaseColor,
669
599
  },
670
600
  h5: {
671
- letterSpacing: false,
601
+ // fontSize: false,
602
+ // letterSpacing: false,
603
+ ...textStyles?.textTitle,
672
604
  marginTop: false,
673
605
  marginBottom: rem(space[2]),
674
606
  color: textBaseColor,
@@ -215,7 +215,9 @@ export default {
215
215
  fontSize: '0.875em',
216
216
  },
217
217
  blockquote: textStyles.textBlockquote,
218
- 'figure figcaption': textStyles.textBase,
218
+ 'figure figcaption': textStyles.textCaption,
219
+ caption: textStyles.textCaption,
220
+ label: textStyles.textLabel,
219
221
  'button:focus': {
220
222
  outline: 'revert', // undo tailwind button focus styling
221
223
  },
@@ -881,7 +881,7 @@
881
881
  "jumbo": {
882
882
  "sm": {
883
883
  "$type": "number",
884
- "$value": 47
884
+ "$value": 52
885
885
  },
886
886
  "md": {
887
887
  "$type": "number",
package/dist/js/tokens.js CHANGED
@@ -169,7 +169,7 @@ export const lineHeight150 = 1.5;
169
169
  export const lineHeightNearlyNone = 1.05;
170
170
  export const lineHeightTight = 1.25;
171
171
  export const lineHeightNormal = 1.5;
172
- export const lineHeightAbsoluteJumboSm = 47;
172
+ export const lineHeightAbsoluteJumboSm = 52;
173
173
  export const lineHeightAbsoluteJumboMd = 52;
174
174
  export const lineHeightAbsoluteJumboLg = 57;
175
175
  export const lineHeightAbsoluteH1Sm = 31;
@@ -1014,7 +1014,7 @@ const tokens = {
1014
1014
  },
1015
1015
  "lineHeightsAbsolute": {
1016
1016
  "jumbo": {
1017
- "sm": 47,
1017
+ "sm": 52,
1018
1018
  "md": 52,
1019
1019
  "lg": 57
1020
1020
  },
@@ -0,0 +1,13 @@
1
+ # Kiva Design System — Guidelines
2
+
3
+ Guidelines for building with Kiva's design system in Figma Make. Each file below covers one foundation; read the one relevant to the decision you are making. Style context (CSS custom properties for every token) is in `../styles.css`. Read `setup.md` first for how to consume the system.
4
+
5
+ ## Foundations
6
+
7
+ - [tailwind](foundations/tailwind.md) — How to use Tailwind CSS v3 when it is backed by Kiva's design tokens — what the @kiva/kv-tokens preset changes about stock Tailwind (the tw- prefix, themable colors compiled to CSS custom properties, disabled core plugins, token-driven scales, an opinionated base layer), how to wire the preset into a project, and how the preset is compiled from DTCG tokens. Mechanical and integration-focused; for which token to pick, defer to the per-topic skills (color, spacing, radius, typography, layout).
8
+ - [color](foundations/color.md) — Semantic color system from the Kiva design system — primitive palettes (eco-green, marigold, desert-rose, stone, gray, neutral), the five themes (Default, Green Light, Green Dark, Marigold, Stone Light), the role/slot/state token grammar, accessibility levels per pairing, and rules for picking a token by purpose rather than hex value. Sourced from Figma; values describe design intent and may diverge from current code implementation.
9
+ - [color-themes](foundations/color-themes.md) — Per-theme semantic color token tables from the Kiva design system — every token in Default, Green Light, Green Dark, Marigold, and Stone Light, with hex value, primitive source, and Figma-authored description. Plus the shadow color tokens. The reference companion to the conceptual `color` skill.
10
+ - [typography](foundations/typography.md) — Semantic typography guidelines from the Kiva design system — type scale, heading hierarchy, font families, pairing rules, and HTML/Tailwind mappings. Sourced from Figma; values describe design intent and may diverge from current code implementation.
11
+ - [spacing](foundations/spacing.md) — Semantic spacing system from the Kiva design system — token categories (Structure, Component Gap, Component Inset, Micro), the 4px-grain ramp, responsive per-tier values, and rules for picking a token by spatial relationship rather than pixel value. Sourced from Figma; values describe design intent and may diverge from current code implementation.
12
+ - [layout](foundations/layout.md) — Layout grid system from the Kiva design system — breakpoint tiers (XS/SM/MD/LG/XL), columns, gutters, margins, nested grids, and rules for aligning content within the grid. Sourced from Figma; values describe design intent and may diverge from current code implementation.
13
+ - [radius](foundations/radius.md) — Border-radius token system from the Kiva design system — the 8-step scale from none (0px) to full (9999px), per-component use cases, the inner-radius formula for nested elements, and rules for keeping corners consistent. Sourced from Figma; values describe design intent and may diverge from current code implementation.