@umituz/web-design-system 2.8.0 → 3.0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/web-design-system",
3
- "version": "2.8.0",
3
+ "version": "3.0.0",
4
4
  "private": false,
5
5
  "description": "Web Design System - Atomic Design components (Atoms, Molecules, Organisms, Templates) for React applications",
6
6
  "main": "./src/index.ts",
@@ -1,243 +1,224 @@
1
1
  /**
2
- * Responsive Design Tokens
3
- * @description Centralized mapping of size variants to Tailwind spacing scale values
2
+ * Responsive Design Tokens (Formula-Based)
3
+ * @description Centralized responsive scale generation using formulas
4
4
  *
5
- * Scale values align with Tailwind's default spacing scale:
6
- * 3=12px, 4=16px, 5=20px, 6=24px, 8=32px, 10=40px, 12=48px, 16=64px, 20=80px
5
+ * All responsive values are generated dynamically from base values and formulas.
6
+ * This provides ZERO code duplication and single source of truth.
7
7
  *
8
- * All responsive calculations are centralized here - components should NOT
9
- * define their own size styles or do any spacing calculations.
8
+ * To modify responsive behavior:
9
+ * 1. Change base values (BASE_* constants)
10
+ * 2. Modify formula functions (*Formula)
11
+ * 3. Entire system updates automatically
10
12
  */
11
13
 
12
14
  import type { SizeVariant, Breakpoint } from '../types';
15
+ import { SPACING_SCALE } from '../../infrastructure/constants/spacing.constants';
16
+ import { TEXT_SIZES, type TextSizeKey } from '../../infrastructure/constants/typography.constants';
17
+ import { BREAKPOINT_ORDER } from '../../infrastructure/constants/breakpoint.constants';
13
18
 
14
19
  /**
15
- * Spacing scale values for padding, margin, and gap
16
- * Format: Tailwind spacing unit numbers (as strings for easier concatenation)
17
- */
18
- export type SpacingScale = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '12' | '14' | '16' | '20' | '24';
19
-
20
- /**
21
- * Responsive spacing mapping by size variant and breakpoint
22
- */
23
- export const RESPONSIVE_SPACING: Record<
24
- SizeVariant,
25
- Partial<Record<Breakpoint, SpacingScale>>
26
- > = {
27
- xs: {
28
- xs: '2',
29
- sm: '3',
30
- md: '3',
31
- lg: '4',
32
- xl: '4',
33
- '2xl': '5',
34
- },
35
- sm: {
36
- xs: '3',
37
- sm: '4',
38
- md: '4',
39
- lg: '5',
40
- xl: '6',
41
- '2xl': '8',
42
- },
43
- md: {
44
- xs: '4',
45
- sm: '5',
46
- md: '5',
47
- lg: '6',
48
- xl: '8',
49
- '2xl': '10',
50
- },
51
- lg: {
52
- xs: '5',
53
- sm: '6',
54
- md: '6',
55
- lg: '8',
56
- xl: '10',
57
- '2xl': '12',
58
- },
59
- xl: {
60
- xs: '6',
61
- sm: '8',
62
- md: '8',
63
- lg: '10',
64
- xl: '12',
65
- '2xl': '16',
66
- },
67
- } as const;
68
-
69
- /**
70
- * Icon size scale values (height/width)
71
- */
72
- export const RESPONSIVE_ICON_SIZE: Record<
73
- SizeVariant,
74
- Partial<Record<Breakpoint, SpacingScale>>
75
- > = {
76
- xs: {
77
- xs: '3',
78
- sm: '4',
79
- md: '5',
80
- lg: '5',
81
- xl: '6',
82
- '2xl': '7',
83
- },
84
- sm: {
85
- xs: '4',
86
- sm: '5',
87
- md: '6',
88
- lg: '6',
89
- xl: '8',
90
- '2xl': '8',
91
- },
92
- md: {
93
- xs: '5',
94
- sm: '6',
95
- md: '7',
96
- lg: '8',
97
- xl: '9',
98
- '2xl': '10',
99
- },
100
- lg: {
101
- xs: '6',
102
- sm: '7',
103
- md: '8',
104
- lg: '9',
105
- xl: '10',
106
- '2xl': '12',
107
- },
108
- xl: {
109
- xs: '8',
110
- sm: '9',
111
- md: '10',
112
- lg: '12',
113
- xl: '14',
114
- '2xl': '16',
115
- },
116
- } as const;
117
-
118
- /**
119
- * Container/icon wrapper size (for rounded containers that hold icons)
120
- */
121
- export const RESPONSIVE_CONTAINER_SIZE: Record<
122
- SizeVariant,
123
- Partial<Record<Breakpoint, SpacingScale>>
124
- > = {
125
- xs: {
126
- xs: '6',
127
- sm: '8',
128
- md: '8',
129
- lg: '10',
130
- xl: '10',
131
- '2xl': '12',
132
- },
133
- sm: {
134
- xs: '8',
135
- sm: '10',
136
- md: '10',
137
- lg: '12',
138
- xl: '12',
139
- '2xl': '14',
140
- },
141
- md: {
142
- xs: '10',
143
- sm: '12',
144
- md: '12',
145
- lg: '14',
146
- xl: '14',
147
- '2xl': '16',
148
- },
149
- lg: {
150
- xs: '12',
151
- sm: '14',
152
- md: '14',
153
- lg: '16',
154
- xl: '16',
155
- '2xl': '20',
156
- },
157
- xl: {
158
- xs: '14',
159
- sm: '16',
160
- md: '16',
161
- lg: '20',
162
- xl: '20',
163
- '2xl': '24',
164
- },
165
- } as const;
166
-
167
- /**
168
- * Text size scale (Tailwind text utilities)
169
- */
170
- export const RESPONSIVE_TEXT_SIZE: Record<
171
- SizeVariant,
172
- Partial<Record<'mobile' | 'tablet', string>>
173
- > = {
174
- xs: {
175
- mobile: 'text-xs',
176
- tablet: 'sm:text-xs',
177
- },
178
- sm: {
179
- mobile: 'text-xs',
180
- tablet: 'sm:text-sm',
181
- },
182
- md: {
183
- mobile: 'text-sm',
184
- tablet: 'sm:text-base',
185
- },
186
- lg: {
187
- mobile: 'text-base',
188
- tablet: 'sm:text-lg',
189
- },
190
- xl: {
191
- mobile: 'text-lg',
192
- tablet: 'sm:text-xl',
193
- },
194
- } as const;
195
-
196
- /**
197
- * Gap/Spacing between elements (space-y-*, space-x-*, gap-*)
198
- */
199
- export const RESPONSIVE_GAP: Record<
200
- SizeVariant,
201
- Partial<Record<Breakpoint, SpacingScale>>
202
- > = {
203
- xs: {
204
- xs: '1',
205
- sm: '2',
206
- md: '2',
207
- lg: '3',
208
- xl: '3',
209
- '2xl': '4',
210
- },
211
- sm: {
212
- xs: '2',
213
- sm: '3',
214
- md: '3',
215
- lg: '4',
216
- xl: '4',
217
- '2xl': '5',
218
- },
219
- md: {
220
- xs: '3',
221
- sm: '4',
222
- md: '4',
223
- lg: '5',
224
- xl: '5',
225
- '2xl': '6',
226
- },
227
- lg: {
228
- xs: '4',
229
- sm: '5',
230
- md: '5',
231
- lg: '6',
232
- xl: '6',
233
- '2xl': '8',
234
- },
235
- xl: {
236
- xs: '5',
237
- sm: '6',
238
- md: '6',
239
- lg: '8',
240
- xl: '8',
241
- '2xl': '10',
242
- },
243
- } as const;
20
+ * Type for scale generation formula
21
+ * Input: base value for size variant, current breakpoint
22
+ * Output: spacing scale index (as number, will be converted to string)
23
+ */
24
+ type ScaleFormula = (base: number, breakpoint: Breakpoint) => number;
25
+
26
+ /**
27
+ * Type for generator result
28
+ */
29
+ type ResponsiveScale = Record<SizeVariant, Partial<Record<Breakpoint, string>>>;
30
+
31
+ // ============================================================================
32
+ // BASE VALUES - Single source of truth for size variants
33
+ // ============================================================================
34
+
35
+ /**
36
+ * Base spacing values for each size variant
37
+ * Defines the starting point for responsive spacing calculation
38
+ */
39
+ const SPACING_BASES: Record<SizeVariant, number> = {
40
+ xs: 1, // SPACING_SCALE['1'] = 4px
41
+ sm: 2, // SPACING_SCALE['2'] = 8px
42
+ md: 3, // SPACING_SCALE['3'] = 12px
43
+ lg: 4, // SPACING_SCALE['4'] = 16px
44
+ xl: 5, // SPACING_SCALE['5'] = 20px
45
+ };
46
+
47
+ /**
48
+ * Base icon size values for each size variant
49
+ */
50
+ const ICON_BASES: Record<SizeVariant, number> = {
51
+ xs: 4,
52
+ sm: 5,
53
+ md: 6,
54
+ lg: 8,
55
+ xl: 10,
56
+ };
57
+
58
+ /**
59
+ * Base container size values (for icon wrappers)
60
+ */
61
+ const CONTAINER_BASES: Record<SizeVariant, number> = {
62
+ xs: 6,
63
+ sm: 8,
64
+ md: 10,
65
+ lg: 12,
66
+ xl: 14,
67
+ };
68
+
69
+ /**
70
+ * Base gap/spacing values for layout
71
+ */
72
+ const GAP_BASES: Record<SizeVariant, number> = {
73
+ xs: 1,
74
+ sm: 2,
75
+ md: 3,
76
+ lg: 4,
77
+ xl: 5,
78
+ };
79
+
80
+ // ============================================================================
81
+ // FORMULAS - Define responsive behavior for each token type
82
+ // ============================================================================
83
+
84
+ /**
85
+ * Spacing formula for padding, margin, gap
86
+ * Progression: xs/sm→base, md/lg→base+1, xl→base+2, 2xl→base+3
87
+ */
88
+ const spacingFormula: ScaleFormula = (base, bp) => {
89
+ const bpIndex = BREAKPOINT_ORDER.indexOf(bp);
90
+ if (bpIndex <= 1) return base; // xs, sm
91
+ if (bpIndex <= 3) return base + 1; // md, lg
92
+ if (bpIndex === 4) return base + 2; // xl
93
+ return base + 3; // 2xl
94
+ };
95
+
96
+ /**
97
+ * Icon size formula
98
+ * Progression: More gradual increase across breakpoints
99
+ */
100
+ const iconFormula: ScaleFormula = (base, bp) => {
101
+ const bpIndex = BREAKPOINT_ORDER.indexOf(bp);
102
+ if (bp === 'xs') return base - 1;
103
+ if (bp === 'sm') return base;
104
+ if (bp === 'md') return base + 1;
105
+ if (bp === 'lg') return base + 2;
106
+ if (bp === 'xl') return base + 3;
107
+ return base + 3; // 2xl
108
+ };
109
+
110
+ /**
111
+ * Container size formula (for icon wrappers)
112
+ * Consistent size increase
113
+ */
114
+ const containerFormula: ScaleFormula = (base, bp) => {
115
+ const bpIndex = BREAKPOINT_ORDER.indexOf(bp);
116
+ if (bpIndex <= 3) return base + 2; // xs, sm, md, lg
117
+ if (bpIndex === 4) return base + 2; // xl
118
+ return base + 2; // 2xl
119
+ };
120
+
121
+ /**
122
+ * Gap formula for layout spacing
123
+ */
124
+ const gapFormula: ScaleFormula = (base, bp) => {
125
+ const bpIndex = BREAKPOINT_ORDER.indexOf(bp);
126
+ if (bpIndex <= 1) return base; // xs, sm
127
+ if (bpIndex <= 3) return base + 1; // md, lg
128
+ if (bpIndex === 4) return base + 1; // xl
129
+ return base + 2; // 2xl
130
+ };
131
+
132
+ // ============================================================================
133
+ // GENERATORS - Create responsive scales dynamically
134
+ // ============================================================================
135
+
136
+ /**
137
+ * Generate responsive scale for any token type
138
+ * @param bases - Base values for each size variant
139
+ * @param formula - Formula to calculate value at each breakpoint
140
+ * @returns Complete responsive scale object
141
+ */
142
+ function generateResponsiveScale(
143
+ bases: Record<SizeVariant, number>,
144
+ formula: ScaleFormula
145
+ ): ResponsiveScale {
146
+ const result: Partial<ResponsiveScale> = {};
147
+
148
+ for (const size of Object.keys(bases) as SizeVariant[]) {
149
+ const base = bases[size];
150
+ result[size] = {};
151
+
152
+ for (const bp of BREAKPOINT_ORDER) {
153
+ const scaleIndex = formula(base, bp);
154
+ const scaleKey = scaleIndex.toString() as keyof typeof SPACING_SCALE;
155
+
156
+ // Validate and get spacing scale value
157
+ if (scaleKey in SPACING_SCALE) {
158
+ result[size]![bp] = SPACING_SCALE[scaleKey];
159
+ }
160
+ }
161
+ }
162
+
163
+ return result as ResponsiveScale;
164
+ }
165
+
166
+ /**
167
+ * Generate responsive text sizes
168
+ * Text sizes use string literals, not spacing scale
169
+ */
170
+ function generateResponsiveTextSizes() {
171
+ const textSizeKeys: Record<SizeVariant, { mobile: TextSizeKey; tablet: TextSizeKey }> = {
172
+ xs: { mobile: 'xs', tablet: 'xs' },
173
+ sm: { mobile: 'xs', tablet: 'sm' },
174
+ md: { mobile: 'sm', tablet: 'base' },
175
+ lg: { mobile: 'base', tablet: 'lg' },
176
+ xl: { mobile: 'lg', tablet: 'xl' },
177
+ };
178
+
179
+ const result: Partial<Record<SizeVariant, Partial<Record<'mobile' | 'tablet', string>>>> = {};
180
+
181
+ for (const size of Object.keys(textSizeKeys) as SizeVariant[]) {
182
+ const keys = textSizeKeys[size];
183
+ result[size] = {
184
+ mobile: TEXT_SIZES[keys.mobile],
185
+ tablet: `sm:${TEXT_SIZES[keys.tablet]}`,
186
+ };
187
+ }
188
+
189
+ return result as Record<SizeVariant, Partial<Record<'mobile' | 'tablet', string>>>;
190
+ }
191
+
192
+ // ============================================================================
193
+ // EXPORTS - All responsive tokens (one line each!)
194
+ // ============================================================================
195
+
196
+ /**
197
+ * Responsive spacing scale for padding, margin, space-*, gap-*
198
+ */
199
+ export const RESPONSIVE_SPACING = generateResponsiveScale(SPACING_BASES, spacingFormula);
200
+
201
+ /**
202
+ * Responsive icon sizes (height/width)
203
+ */
204
+ export const RESPONSIVE_ICON_SIZE = generateResponsiveScale(ICON_BASES, iconFormula);
205
+
206
+ /**
207
+ * Responsive container sizes for icon wrappers
208
+ */
209
+ export const RESPONSIVE_CONTAINER_SIZE = generateResponsiveScale(CONTAINER_BASES, containerFormula);
210
+
211
+ /**
212
+ * Responsive gap/spacing for layouts
213
+ */
214
+ export const RESPONSIVE_GAP = generateResponsiveScale(GAP_BASES, gapFormula);
215
+
216
+ /**
217
+ * Responsive text sizes (mobile + tablet)
218
+ */
219
+ export const RESPONSIVE_TEXT_SIZE = generateResponsiveTextSizes();
220
+
221
+ /**
222
+ * Type exports
223
+ */
224
+ export type SpacingScale = keyof typeof SPACING_SCALE;
@@ -4,8 +4,9 @@
4
4
  */
5
5
 
6
6
  import type { ReactNode } from 'react';
7
+ import type { SizeVariant } from '../../infrastructure/constants/size-variant.constants';
7
8
 
8
- export type SizeVariant = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
9
+ export { type SizeVariant } from '../../infrastructure/constants/size-variant.constants';
9
10
  export type ColorVariant = 'primary' | 'secondary' | 'success' | 'warning' | 'destructive';
10
11
  export type ColorScheme = 'light' | 'dark';
11
12
 
@@ -21,3 +21,33 @@ export {
21
21
  isBreakpointGreaterThan,
22
22
  isBreakpointLessThan,
23
23
  } from './breakpoint.constants';
24
+
25
+ export {
26
+ SPACING_SCALE,
27
+ COMMON_SPACING,
28
+ SIZE_SPACING,
29
+ type SpacingScaleKey,
30
+ type SpacingScale,
31
+ isValidSpacing,
32
+ } from './spacing.constants';
33
+
34
+ export {
35
+ SIZE_VARIANTS,
36
+ SIZE_VARIANT_ORDER,
37
+ getNextSizeVariant,
38
+ getPrevSizeVariant,
39
+ type SizeVariantKey,
40
+ type SizeVariant,
41
+ isValidSizeVariant,
42
+ } from './size-variant.constants';
43
+
44
+ export {
45
+ TEXT_SIZES,
46
+ FONT_WEIGHTS,
47
+ COMMON_TEXT_SIZES,
48
+ TEXT_SIZE_BY_VARIANT,
49
+ type TextSizeKey,
50
+ type TextSize,
51
+ type FontWeightKey,
52
+ type FontWeight,
53
+ } from './typography.constants';
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Size Variant Constants
3
+ * @description Size variants used throughout the design system
4
+ *
5
+ * All size variant values are defined here to provide consistency
6
+ * and prevent hardcoded strings in components.
7
+ */
8
+
9
+ /**
10
+ * Size variants available in the design system
11
+ * Ordered from smallest to largest
12
+ */
13
+ export const SIZE_VARIANTS = {
14
+ xs: 'xs',
15
+ sm: 'sm',
16
+ md: 'md',
17
+ lg: 'lg',
18
+ xl: 'xl',
19
+ } as const;
20
+
21
+ /**
22
+ * Type for size variant keys
23
+ */
24
+ export type SizeVariantKey = keyof typeof SIZE_VARIANTS;
25
+
26
+ /**
27
+ * Type for size variant values
28
+ */
29
+ export type SizeVariant = typeof SIZE_VARIANTS[SizeVariantKey];
30
+
31
+ /**
32
+ * Size variant order (for sorting/comparison)
33
+ */
34
+ export const SIZE_VARIANT_ORDER: SizeVariant[] = ['xs', 'sm', 'md', 'lg', 'xl'];
35
+
36
+ /**
37
+ * Get the next larger size variant
38
+ */
39
+ export function getNextSizeVariant(current: SizeVariant): SizeVariant | null {
40
+ const index = SIZE_VARIANT_ORDER.indexOf(current);
41
+ if (index === -1 || index === SIZE_VARIANT_ORDER.length - 1) {
42
+ return null;
43
+ }
44
+ return SIZE_VARIANT_ORDER[index + 1];
45
+ }
46
+
47
+ /**
48
+ * Get the next smaller size variant
49
+ */
50
+ export function getPrevSizeVariant(current: SizeVariant): SizeVariant | null {
51
+ const index = SIZE_VARIANT_ORDER.indexOf(current);
52
+ if (index <= 0) {
53
+ return null;
54
+ }
55
+ return SIZE_VARIANT_ORDER[index - 1];
56
+ }
57
+
58
+ /**
59
+ * Validate if a value is a valid size variant
60
+ */
61
+ export function isValidSizeVariant(value: string): value is SizeVariant {
62
+ return Object.values(SIZE_VARIANTS).includes(value as SizeVariant);
63
+ }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Spacing Constants
3
+ * @description Tailwind CSS spacing scale values
4
+ * @see https://tailwindcss.com/docs/customizing-spacing
5
+ *
6
+ * All spacing values used in the design system are defined here.
7
+ * This provides a single source of truth for spacing scale.
8
+ */
9
+
10
+ /**
11
+ * Tailwind CSS spacing scale
12
+ * Each value represents a spacing unit that maps to a specific pixel value
13
+ * Format: Key is the spacing class name, value is the unit number (as string for Tailwind class construction)
14
+ */
15
+ export const SPACING_SCALE = {
16
+ '0': '0', // 0px
17
+ '0.5': '0.5', // 2px
18
+ '1': '1', // 4px
19
+ '1.5': '1.5', // 6px
20
+ '2': '2', // 8px
21
+ '2.5': '2.5', // 10px
22
+ '3': '3', // 12px
23
+ '3.5': '3.5', // 14px
24
+ '4': '4', // 16px
25
+ '5': '5', // 20px
26
+ '6': '6', // 24px
27
+ '7': '7', // 28px
28
+ '8': '8', // 32px
29
+ '9': '9', // 36px
30
+ '10': '10', // 40px
31
+ '11': '11', // 44px
32
+ '12': '12', // 48px
33
+ '14': '14', // 56px
34
+ '16': '16', // 64px
35
+ '20': '20', // 80px
36
+ '24': '24', // 96px
37
+ '28': '28', // 112px
38
+ '32': '32', // 128px
39
+ '36': '36', // 144px
40
+ '40': '40', // 160px
41
+ '44': '44', // 176px
42
+ '48': '48', // 192px
43
+ '52': '52', // 208px
44
+ '56': '56', // 224px
45
+ '60': '60', // 240px
46
+ '64': '64', // 256px
47
+ '72': '72', // 288px
48
+ '80': '80', // 320px
49
+ '96': '96', // 384px
50
+ } as const;
51
+
52
+ /**
53
+ * Type for spacing scale keys
54
+ */
55
+ export type SpacingScaleKey = keyof typeof SPACING_SCALE;
56
+
57
+ /**
58
+ * Type for spacing scale values (string format for Tailwind classes)
59
+ */
60
+ export type SpacingScale = `${SpacingScaleKey}`;
61
+
62
+ /**
63
+ * Common spacing values used throughout the design system
64
+ * These are frequently used spacing values
65
+ */
66
+ export const COMMON_SPACING = {
67
+ xs: SPACING_SCALE['1'],
68
+ sm: SPACING_SCALE['2'],
69
+ md: SPACING_SCALE['4'],
70
+ lg: SPACING_SCALE['6'],
71
+ xl: SPACING_SCALE['8'],
72
+ '2xl': SPACING_SCALE['12'],
73
+ } as const;
74
+
75
+ /**
76
+ * Spacing scale for component sizing
77
+ */
78
+ export const SIZE_SPACING = {
79
+ xs: SPACING_SCALE['3'],
80
+ sm: SPACING_SCALE['4'],
81
+ md: SPACING_SCALE['5'],
82
+ lg: SPACING_SCALE['6'],
83
+ xl: SPACING_SCALE['8'],
84
+ '2xl': SPACING_SCALE['10'],
85
+ } as const;
86
+
87
+ /**
88
+ * Validate if a value is a valid spacing scale
89
+ */
90
+ export function isValidSpacing(value: string): value is SpacingScale {
91
+ return Object.keys(SPACING_SCALE).includes(value);
92
+ }
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Typography Constants
3
+ * @description Typography scale values for the design system
4
+ *
5
+ * All font size and text utility values are defined here.
6
+ * This provides consistency with Tailwind's default typography scale.
7
+ */
8
+
9
+ /**
10
+ * Text size utilities (Tailwind text classes)
11
+ */
12
+ export const TEXT_SIZES = {
13
+ xs: 'text-xs', // 0.75rem (12px)
14
+ sm: 'text-sm', // 0.875rem (14px)
15
+ base: 'text-base', // 1rem (16px)
16
+ lg: 'text-lg', // 1.125rem (18px)
17
+ xl: 'text-xl', // 1.25rem (20px)
18
+ '2xl': 'text-2xl', // 1.5rem (24px)
19
+ '3xl': 'text-3xl', // 1.875rem (30px)
20
+ '4xl': 'text-4xl', // 2.25rem (36px)
21
+ '5xl': 'text-5xl', // 3rem (48px)
22
+ '6xl': 'text-6xl', // 3.75rem (60px)
23
+ '7xl': 'text-7xl', // 4.5rem (72px)
24
+ '8xl': 'text-8xl', // 6rem (96px)
25
+ '9xl': 'text-9xl', // 8rem (128px)
26
+ } as const;
27
+
28
+ /**
29
+ * Type for text size keys
30
+ */
31
+ export type TextSizeKey = keyof typeof TEXT_SIZES;
32
+
33
+ /**
34
+ * Type for text size values
35
+ */
36
+ export type TextSize = typeof TEXT_SIZES[TextSizeKey];
37
+
38
+ /**
39
+ * Font weight utilities
40
+ */
41
+ export const FONT_WEIGHTS = {
42
+ thin: 'font-thin', // 100
43
+ extralight: 'font-extralight', // 200
44
+ light: 'font-light', // 300
45
+ normal: 'font-normal', // 400
46
+ medium: 'font-medium', // 500
47
+ semibold: 'font-semibold', // 600
48
+ bold: 'font-bold', // 700
49
+ extrabold: 'font-extrabold', // 800
50
+ black: 'font-black', // 900
51
+ } as const;
52
+
53
+ /**
54
+ * Type for font weight keys
55
+ */
56
+ export type FontWeightKey = keyof typeof FONT_WEIGHTS;
57
+
58
+ /**
59
+ * Type for font weight values
60
+ */
61
+ export type FontWeight = typeof FONT_WEIGHTS[FontWeightKey];
62
+
63
+ /**
64
+ * Common text sizes for different element types
65
+ */
66
+ export const COMMON_TEXT_SIZES = {
67
+ caption: TEXT_SIZES.xs,
68
+ small: TEXT_SIZES.sm,
69
+ body: TEXT_SIZES.base,
70
+ subtitle: TEXT_SIZES.lg,
71
+ title: TEXT_SIZES.xl,
72
+ heading: TEXT_SIZES['2xl'],
73
+ display: TEXT_SIZES['4xl'],
74
+ } as const;
75
+
76
+ /**
77
+ * Text sizes by size variant
78
+ * Maps size variants to appropriate text sizes
79
+ */
80
+ export const TEXT_SIZE_BY_VARIANT = {
81
+ xs: {
82
+ mobile: TEXT_SIZES.xs,
83
+ tablet: TEXT_SIZES.xs,
84
+ },
85
+ sm: {
86
+ mobile: TEXT_SIZES.xs,
87
+ tablet: TEXT_SIZES.sm,
88
+ },
89
+ md: {
90
+ mobile: TEXT_SIZES.sm,
91
+ tablet: TEXT_SIZES.base,
92
+ },
93
+ lg: {
94
+ mobile: TEXT_SIZES.base,
95
+ tablet: TEXT_SIZES.lg,
96
+ },
97
+ xl: {
98
+ mobile: TEXT_SIZES.lg,
99
+ tablet: TEXT_SIZES.xl,
100
+ },
101
+ } as const;