ShtukbaseStandard
package file→ .shtukbase/packages/keer-ui/library/lib/utils.ts

library/lib/utils.ts

43 lines, 1000 B.

  1. import { createCn } from "cn/config";
  2. /** The names of the text styles from styles/typography.css. */
  3. export const TEXT_STYLES = [
  4. "page-title",
  5. "section-title",
  6. "card-title",
  7. "metric",
  8. "body",
  9. "body-strong",
  10. "label",
  11. "caption",
  12. "field-label",
  13. "overline",
  14. "code",
  15. "table-head",
  16. "voice",
  17. "row-title",
  18. "row",
  19. "chip",
  20. "nav",
  21. "nav-strong",
  22. "brand",
  23. "account",
  24. "composer",
  25. ] as const;
  26. /**
  27. * Joining classes. Text styles (`text-body`, `text-caption`…) are an alloy of size, weight and spacing:
  28. * for merging they are a “text size”, not a color, otherwise `text-body text-muted-foreground` would lose the style.
  29. */
  30. export const cn = createCn({
  31. extend: {
  32. classGroups: {
  33. "font-size": [{ text: [...TEXT_STYLES] }],
  34. // The mockup weights between the usual ones: 450 and 550.
  35. "font-weight": [{ font: ["book", "strong"] }],
  36. },
  37. conflictingClassGroups: {
  38. "font-size": ["font-weight", "leading", "tracking"],
  39. },
  40. },
  41. });