@gv-tech/design-tokens 1.1.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/package.json +26 -0
- package/src/index.ts +35 -0
- package/src/palette.ts +36 -0
- package/src/radii.ts +26 -0
- package/src/shadows.ts +16 -0
- package/src/spacing.ts +33 -0
- package/src/theme.ts +54 -0
- package/src/typography.ts +36 -0
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gv-tech/design-tokens",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Shared design tokens for the GV Tech design system — palette, theme, spacing, typography, shadows",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./src/index.ts",
|
|
9
|
+
"default": "./src/index.ts"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"main": "src/index.ts",
|
|
13
|
+
"types": "src/index.ts",
|
|
14
|
+
"files": [
|
|
15
|
+
"src"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "echo 'No build step — consumed as TS source by sibling packages'",
|
|
19
|
+
"lint": "echo 'Linted from workspace root'",
|
|
20
|
+
"test": "echo 'No tests yet'",
|
|
21
|
+
"typecheck": "npx tsc --noEmit"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
}
|
|
26
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// @gv-tech/design-tokens
|
|
2
|
+
// Single source of truth for all design tokens in the GV Tech design system.
|
|
3
|
+
// Consumed by both web (ui-web) and native (ui-native) implementations.
|
|
4
|
+
|
|
5
|
+
// Color tokens
|
|
6
|
+
export { palette } from './palette';
|
|
7
|
+
export type { PaletteTokens } from './palette';
|
|
8
|
+
|
|
9
|
+
export { theme } from './theme';
|
|
10
|
+
export type { ThemeTokens } from './theme';
|
|
11
|
+
|
|
12
|
+
// Layout tokens
|
|
13
|
+
export { spacing } from './spacing';
|
|
14
|
+
export type { SpacingTokens } from './spacing';
|
|
15
|
+
|
|
16
|
+
export { radii, radiiNumeric } from './radii';
|
|
17
|
+
export type { RadiiNumericTokens, RadiiTokens } from './radii';
|
|
18
|
+
|
|
19
|
+
// Typography tokens
|
|
20
|
+
export { typography } from './typography';
|
|
21
|
+
export type { TypographyTokens } from './typography';
|
|
22
|
+
|
|
23
|
+
// Elevation tokens
|
|
24
|
+
export { shadows } from './shadows';
|
|
25
|
+
export type { ShadowTokens } from './shadows';
|
|
26
|
+
|
|
27
|
+
// Convenience re-export of all tokens as a single object.
|
|
28
|
+
// Mirrors the legacy `tokens` export from `src/theme/tokens.ts`.
|
|
29
|
+
import { palette } from './palette';
|
|
30
|
+
import { theme } from './theme';
|
|
31
|
+
|
|
32
|
+
export const tokens = {
|
|
33
|
+
palette,
|
|
34
|
+
theme,
|
|
35
|
+
} as const;
|
package/src/palette.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Primitive color palette for the GV Tech design system.
|
|
2
|
+
// These are the raw color values. They should NOT be used directly in components —
|
|
3
|
+
// use semantic tokens from `theme.ts` instead.
|
|
4
|
+
|
|
5
|
+
export const palette = {
|
|
6
|
+
brand: {
|
|
7
|
+
blue: 'hsl(225 73% 57%)', // Royal Blue (Intellect)
|
|
8
|
+
green: 'hsl(151 66% 27%)', // #177245 (Stability)
|
|
9
|
+
floralWhite: 'hsl(40 100% 97%)', // Light Neutral / Floral White
|
|
10
|
+
},
|
|
11
|
+
neutral: {
|
|
12
|
+
white: 'hsl(0 0% 100%)',
|
|
13
|
+
black: 'hsl(0 0% 0%)', // Pure Black
|
|
14
|
+
gray50: 'hsl(0 0% 96%)', // White Smoke
|
|
15
|
+
gray100: 'hsl(0 0% 92%)', // Gainsboro
|
|
16
|
+
gray200: 'hsl(0 0% 89%)', // Light Gray
|
|
17
|
+
gray300: 'hsl(0 0% 88%)', // French Gray
|
|
18
|
+
gray400: 'hsl(0 0% 70%)', // Silver
|
|
19
|
+
gray500: 'hsl(215 16% 47%)', // Steel Blue
|
|
20
|
+
gray600: 'hsl(222 47% 11%)', // Oxford Blue
|
|
21
|
+
gray700: 'hsl(0 0% 18%)', // Raisin Black
|
|
22
|
+
gray800: 'hsl(0 0% 15%)', // Jet
|
|
23
|
+
gray900: 'hsl(0 0% 14%)', // Eerie Black
|
|
24
|
+
gray950: 'hsl(0 0% 11%)', // Night (alt)
|
|
25
|
+
gray975: 'hsl(0 0% 9%)', // Night
|
|
26
|
+
gray990: 'hsl(0 0% 6%)', // Black (almost)
|
|
27
|
+
},
|
|
28
|
+
semantic: {
|
|
29
|
+
success: 'hsl(93 28% 54%)', // Asparagus / Pistachio
|
|
30
|
+
successDark: 'hsl(96 44% 61%)',
|
|
31
|
+
destructive: 'hsl(0 84.2% 60.2%)', // Vivid Red
|
|
32
|
+
destructiveDark: 'hsl(0 62.8% 30.6%)', // Blood Red
|
|
33
|
+
},
|
|
34
|
+
} as const;
|
|
35
|
+
|
|
36
|
+
export type PaletteTokens = typeof palette;
|
package/src/radii.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Border radius tokens for the GV Tech design system.
|
|
2
|
+
|
|
3
|
+
export const radii = {
|
|
4
|
+
none: '0',
|
|
5
|
+
sm: 'calc(var(--radius) - 4px)',
|
|
6
|
+
md: 'calc(var(--radius) - 2px)',
|
|
7
|
+
lg: 'var(--radius)',
|
|
8
|
+
xl: 'calc(var(--radius) + 4px)',
|
|
9
|
+
'2xl': 'calc(var(--radius) + 8px)',
|
|
10
|
+
full: '9999px',
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
// Numeric radius values (in px) for React Native, which doesn't support CSS calc().
|
|
14
|
+
// Based on a default --radius of 0.5rem (8px).
|
|
15
|
+
export const radiiNumeric = {
|
|
16
|
+
none: 0,
|
|
17
|
+
sm: 4, // 8 - 4
|
|
18
|
+
md: 6, // 8 - 2
|
|
19
|
+
lg: 8, // base
|
|
20
|
+
xl: 12, // 8 + 4
|
|
21
|
+
'2xl': 16, // 8 + 8
|
|
22
|
+
full: 9999,
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
25
|
+
export type RadiiTokens = typeof radii;
|
|
26
|
+
export type RadiiNumericTokens = typeof radiiNumeric;
|
package/src/shadows.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Shadow / elevation tokens for the GV Tech design system.
|
|
2
|
+
// Web values use CSS box-shadow syntax.
|
|
3
|
+
// Native consumers should map these to platform-specific elevation or shadow props.
|
|
4
|
+
|
|
5
|
+
export const shadows = {
|
|
6
|
+
none: 'none',
|
|
7
|
+
sm: '0 1px 2px 0 rgb(0 0 0 / 0.05)',
|
|
8
|
+
default: '0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)',
|
|
9
|
+
md: '0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)',
|
|
10
|
+
lg: '0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)',
|
|
11
|
+
xl: '0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)',
|
|
12
|
+
'2xl': '0 25px 50px -12px rgb(0 0 0 / 0.25)',
|
|
13
|
+
inner: 'inset 0 2px 4px 0 rgb(0 0 0 / 0.05)',
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
export type ShadowTokens = typeof shadows;
|
package/src/spacing.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Spacing scale for the GV Tech design system.
|
|
2
|
+
// Based on a 4px baseline grid. Values are in rem (assuming 16px root font size).
|
|
3
|
+
|
|
4
|
+
export const spacing = {
|
|
5
|
+
px: '1px',
|
|
6
|
+
0: '0',
|
|
7
|
+
0.5: '0.125rem', // 2px
|
|
8
|
+
1: '0.25rem', // 4px
|
|
9
|
+
1.5: '0.375rem', // 6px
|
|
10
|
+
2: '0.5rem', // 8px
|
|
11
|
+
2.5: '0.625rem', // 10px
|
|
12
|
+
3: '0.75rem', // 12px
|
|
13
|
+
3.5: '0.875rem', // 14px
|
|
14
|
+
4: '1rem', // 16px
|
|
15
|
+
5: '1.25rem', // 20px
|
|
16
|
+
6: '1.5rem', // 24px
|
|
17
|
+
7: '1.75rem', // 28px
|
|
18
|
+
8: '2rem', // 32px
|
|
19
|
+
9: '2.25rem', // 36px
|
|
20
|
+
10: '2.5rem', // 40px
|
|
21
|
+
12: '3rem', // 48px
|
|
22
|
+
14: '3.5rem', // 56px
|
|
23
|
+
16: '4rem', // 64px
|
|
24
|
+
20: '5rem', // 80px
|
|
25
|
+
24: '6rem', // 96px
|
|
26
|
+
32: '8rem', // 128px
|
|
27
|
+
40: '10rem', // 160px
|
|
28
|
+
48: '12rem', // 192px
|
|
29
|
+
56: '14rem', // 224px
|
|
30
|
+
64: '16rem', // 256px
|
|
31
|
+
} as const;
|
|
32
|
+
|
|
33
|
+
export type SpacingTokens = typeof spacing;
|
package/src/theme.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Semantic theme tokens for the GV Tech design system.
|
|
2
|
+
// These map primitive palette values to semantic roles (background, foreground, etc.)
|
|
3
|
+
// for both light and dark modes. Components should reference these tokens, not palette directly.
|
|
4
|
+
|
|
5
|
+
import { palette } from './palette';
|
|
6
|
+
|
|
7
|
+
export const theme = {
|
|
8
|
+
light: {
|
|
9
|
+
background: palette.neutral.gray50,
|
|
10
|
+
foreground: palette.neutral.gray600,
|
|
11
|
+
card: palette.neutral.white,
|
|
12
|
+
cardForeground: palette.neutral.gray600,
|
|
13
|
+
popover: palette.neutral.white,
|
|
14
|
+
popoverForeground: palette.neutral.gray600,
|
|
15
|
+
primary: palette.brand.blue,
|
|
16
|
+
primaryForeground: palette.neutral.white,
|
|
17
|
+
secondary: palette.semantic.success,
|
|
18
|
+
secondaryForeground: palette.neutral.white,
|
|
19
|
+
muted: palette.neutral.gray100,
|
|
20
|
+
mutedForeground: palette.neutral.gray500,
|
|
21
|
+
accent: palette.neutral.gray300,
|
|
22
|
+
accentForeground: palette.neutral.gray600,
|
|
23
|
+
destructive: palette.semantic.destructive,
|
|
24
|
+
destructiveForeground: palette.neutral.white,
|
|
25
|
+
border: palette.neutral.gray200,
|
|
26
|
+
input: palette.neutral.gray200,
|
|
27
|
+
ring: palette.neutral.gray600,
|
|
28
|
+
radius: '0.5rem',
|
|
29
|
+
},
|
|
30
|
+
dark: {
|
|
31
|
+
background: palette.neutral.gray975,
|
|
32
|
+
foreground: palette.neutral.white,
|
|
33
|
+
card: palette.neutral.gray900,
|
|
34
|
+
cardForeground: palette.neutral.white,
|
|
35
|
+
popover: palette.neutral.gray950,
|
|
36
|
+
popoverForeground: palette.neutral.white,
|
|
37
|
+
primary: 'hsl(227 96% 71%)', // Keeping as specific HSL to match original
|
|
38
|
+
primaryForeground: palette.neutral.gray975,
|
|
39
|
+
secondary: palette.semantic.successDark,
|
|
40
|
+
secondaryForeground: palette.neutral.gray975,
|
|
41
|
+
muted: palette.neutral.gray990,
|
|
42
|
+
mutedForeground: palette.neutral.gray400,
|
|
43
|
+
accent: palette.neutral.gray800,
|
|
44
|
+
accentForeground: palette.neutral.white,
|
|
45
|
+
destructive: palette.semantic.destructiveDark,
|
|
46
|
+
destructiveForeground: palette.neutral.white,
|
|
47
|
+
border: palette.neutral.gray700,
|
|
48
|
+
input: palette.neutral.gray700,
|
|
49
|
+
ring: 'hsl(0 0% 90%)', // Platinum
|
|
50
|
+
radius: '0.5rem',
|
|
51
|
+
},
|
|
52
|
+
} as const;
|
|
53
|
+
|
|
54
|
+
export type ThemeTokens = typeof theme.light;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Typography tokens for the GV Tech design system.
|
|
2
|
+
// Defines font families, sizes, weights, and line heights.
|
|
3
|
+
|
|
4
|
+
export const typography = {
|
|
5
|
+
fontFamily: {
|
|
6
|
+
sans: 'Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
7
|
+
mono: 'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace',
|
|
8
|
+
},
|
|
9
|
+
fontSize: {
|
|
10
|
+
xs: '0.75rem', // 12px
|
|
11
|
+
sm: '0.875rem', // 14px
|
|
12
|
+
base: '1rem', // 16px
|
|
13
|
+
lg: '1.125rem', // 18px
|
|
14
|
+
xl: '1.25rem', // 20px
|
|
15
|
+
'2xl': '1.5rem', // 24px
|
|
16
|
+
'3xl': '1.875rem', // 30px
|
|
17
|
+
'4xl': '2.25rem', // 36px
|
|
18
|
+
'5xl': '3rem', // 48px
|
|
19
|
+
},
|
|
20
|
+
fontWeight: {
|
|
21
|
+
normal: '400',
|
|
22
|
+
medium: '500',
|
|
23
|
+
semibold: '600',
|
|
24
|
+
bold: '700',
|
|
25
|
+
},
|
|
26
|
+
lineHeight: {
|
|
27
|
+
none: '1',
|
|
28
|
+
tight: '1.25',
|
|
29
|
+
snug: '1.375',
|
|
30
|
+
normal: '1.5',
|
|
31
|
+
relaxed: '1.625',
|
|
32
|
+
loose: '2',
|
|
33
|
+
},
|
|
34
|
+
} as const;
|
|
35
|
+
|
|
36
|
+
export type TypographyTokens = typeof typography;
|