@umituz/web-design-system 2.7.2 → 2.9.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 +1 -1
- package/src/domain/tokens/responsive-map.tokens.ts +245 -0
- package/src/domain/types/component.types.ts +2 -1
- package/src/infrastructure/constants/index.ts +30 -0
- package/src/infrastructure/constants/size-variant.constants.ts +63 -0
- package/src/infrastructure/constants/spacing.constants.ts +92 -0
- package/src/infrastructure/constants/typography.constants.ts +101 -0
- package/src/infrastructure/utils/index.ts +10 -0
- package/src/infrastructure/utils/responsive.utils.ts +166 -0
- package/src/presentation/molecules/FormField.tsx +7 -6
- package/src/presentation/molecules/Select.tsx +1 -1
- package/src/presentation/organisms/EmptyState.tsx +8 -34
- package/src/presentation/organisms/Grid.tsx +129 -0
- package/src/presentation/organisms/LoadingState.tsx +18 -31
- package/src/presentation/organisms/MetricCard.tsx +28 -36
- package/src/presentation/organisms/QuickActionCard.tsx +15 -32
- package/src/presentation/organisms/StatCard.tsx +36 -54
- package/src/presentation/organisms/index.ts +3 -0
package/package.json
CHANGED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Responsive Design Tokens
|
|
3
|
+
* @description Centralized mapping of size variants to Tailwind spacing scale values
|
|
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
|
|
7
|
+
*
|
|
8
|
+
* All responsive calculations are centralized here - components should NOT
|
|
9
|
+
* define their own size styles or do any spacing calculations.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { SizeVariant, Breakpoint } from '../types';
|
|
13
|
+
import { SPACING_SCALE } from '../../infrastructure/constants/spacing.constants';
|
|
14
|
+
import { TEXT_SIZES } from '../../infrastructure/constants/typography.constants';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Spacing scale values for padding, margin, and gap
|
|
18
|
+
* Format: Tailwind spacing unit numbers (as strings for easier concatenation)
|
|
19
|
+
*/
|
|
20
|
+
export type SpacingScale = keyof typeof SPACING_SCALE;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Responsive spacing mapping by size variant and breakpoint
|
|
24
|
+
*/
|
|
25
|
+
export const RESPONSIVE_SPACING: Record<
|
|
26
|
+
SizeVariant,
|
|
27
|
+
Partial<Record<Breakpoint, SpacingScale>>
|
|
28
|
+
> = {
|
|
29
|
+
xs: {
|
|
30
|
+
xs: SPACING_SCALE['2'],
|
|
31
|
+
sm: SPACING_SCALE['3'],
|
|
32
|
+
md: SPACING_SCALE['3'],
|
|
33
|
+
lg: SPACING_SCALE['4'],
|
|
34
|
+
xl: SPACING_SCALE['4'],
|
|
35
|
+
'2xl': SPACING_SCALE['5'],
|
|
36
|
+
},
|
|
37
|
+
sm: {
|
|
38
|
+
xs: SPACING_SCALE['3'],
|
|
39
|
+
sm: SPACING_SCALE['4'],
|
|
40
|
+
md: SPACING_SCALE['4'],
|
|
41
|
+
lg: SPACING_SCALE['5'],
|
|
42
|
+
xl: SPACING_SCALE['6'],
|
|
43
|
+
'2xl': SPACING_SCALE['8'],
|
|
44
|
+
},
|
|
45
|
+
md: {
|
|
46
|
+
xs: SPACING_SCALE['4'],
|
|
47
|
+
sm: SPACING_SCALE['5'],
|
|
48
|
+
md: SPACING_SCALE['5'],
|
|
49
|
+
lg: SPACING_SCALE['6'],
|
|
50
|
+
xl: SPACING_SCALE['8'],
|
|
51
|
+
'2xl': SPACING_SCALE['10'],
|
|
52
|
+
},
|
|
53
|
+
lg: {
|
|
54
|
+
xs: SPACING_SCALE['5'],
|
|
55
|
+
sm: SPACING_SCALE['6'],
|
|
56
|
+
md: SPACING_SCALE['6'],
|
|
57
|
+
lg: SPACING_SCALE['8'],
|
|
58
|
+
xl: SPACING_SCALE['10'],
|
|
59
|
+
'2xl': SPACING_SCALE['12'],
|
|
60
|
+
},
|
|
61
|
+
xl: {
|
|
62
|
+
xs: SPACING_SCALE['6'],
|
|
63
|
+
sm: SPACING_SCALE['8'],
|
|
64
|
+
md: SPACING_SCALE['8'],
|
|
65
|
+
lg: SPACING_SCALE['10'],
|
|
66
|
+
xl: SPACING_SCALE['12'],
|
|
67
|
+
'2xl': SPACING_SCALE['16'],
|
|
68
|
+
},
|
|
69
|
+
} as const;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Icon size scale values (height/width)
|
|
73
|
+
*/
|
|
74
|
+
export const RESPONSIVE_ICON_SIZE: Record<
|
|
75
|
+
SizeVariant,
|
|
76
|
+
Partial<Record<Breakpoint, SpacingScale>>
|
|
77
|
+
> = {
|
|
78
|
+
xs: {
|
|
79
|
+
xs: SPACING_SCALE['3'],
|
|
80
|
+
sm: SPACING_SCALE['4'],
|
|
81
|
+
md: SPACING_SCALE['5'],
|
|
82
|
+
lg: SPACING_SCALE['5'],
|
|
83
|
+
xl: SPACING_SCALE['6'],
|
|
84
|
+
'2xl': SPACING_SCALE['7'],
|
|
85
|
+
},
|
|
86
|
+
sm: {
|
|
87
|
+
xs: SPACING_SCALE['4'],
|
|
88
|
+
sm: SPACING_SCALE['5'],
|
|
89
|
+
md: SPACING_SCALE['6'],
|
|
90
|
+
lg: SPACING_SCALE['6'],
|
|
91
|
+
xl: SPACING_SCALE['8'],
|
|
92
|
+
'2xl': SPACING_SCALE['8'],
|
|
93
|
+
},
|
|
94
|
+
md: {
|
|
95
|
+
xs: SPACING_SCALE['5'],
|
|
96
|
+
sm: SPACING_SCALE['6'],
|
|
97
|
+
md: SPACING_SCALE['7'],
|
|
98
|
+
lg: SPACING_SCALE['8'],
|
|
99
|
+
xl: SPACING_SCALE['9'],
|
|
100
|
+
'2xl': SPACING_SCALE['10'],
|
|
101
|
+
},
|
|
102
|
+
lg: {
|
|
103
|
+
xs: SPACING_SCALE['6'],
|
|
104
|
+
sm: SPACING_SCALE['7'],
|
|
105
|
+
md: SPACING_SCALE['8'],
|
|
106
|
+
lg: SPACING_SCALE['9'],
|
|
107
|
+
xl: SPACING_SCALE['10'],
|
|
108
|
+
'2xl': SPACING_SCALE['12'],
|
|
109
|
+
},
|
|
110
|
+
xl: {
|
|
111
|
+
xs: SPACING_SCALE['8'],
|
|
112
|
+
sm: SPACING_SCALE['9'],
|
|
113
|
+
md: SPACING_SCALE['10'],
|
|
114
|
+
lg: SPACING_SCALE['12'],
|
|
115
|
+
xl: SPACING_SCALE['14'],
|
|
116
|
+
'2xl': SPACING_SCALE['16'],
|
|
117
|
+
},
|
|
118
|
+
} as const;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Container/icon wrapper size (for rounded containers that hold icons)
|
|
122
|
+
*/
|
|
123
|
+
export const RESPONSIVE_CONTAINER_SIZE: Record<
|
|
124
|
+
SizeVariant,
|
|
125
|
+
Partial<Record<Breakpoint, SpacingScale>>
|
|
126
|
+
> = {
|
|
127
|
+
xs: {
|
|
128
|
+
xs: SPACING_SCALE['6'],
|
|
129
|
+
sm: SPACING_SCALE['8'],
|
|
130
|
+
md: SPACING_SCALE['8'],
|
|
131
|
+
lg: SPACING_SCALE['10'],
|
|
132
|
+
xl: SPACING_SCALE['10'],
|
|
133
|
+
'2xl': SPACING_SCALE['12'],
|
|
134
|
+
},
|
|
135
|
+
sm: {
|
|
136
|
+
xs: SPACING_SCALE['8'],
|
|
137
|
+
sm: SPACING_SCALE['10'],
|
|
138
|
+
md: SPACING_SCALE['10'],
|
|
139
|
+
lg: SPACING_SCALE['12'],
|
|
140
|
+
xl: SPACING_SCALE['12'],
|
|
141
|
+
'2xl': SPACING_SCALE['14'],
|
|
142
|
+
},
|
|
143
|
+
md: {
|
|
144
|
+
xs: SPACING_SCALE['10'],
|
|
145
|
+
sm: SPACING_SCALE['12'],
|
|
146
|
+
md: SPACING_SCALE['12'],
|
|
147
|
+
lg: SPACING_SCALE['14'],
|
|
148
|
+
xl: SPACING_SCALE['14'],
|
|
149
|
+
'2xl': SPACING_SCALE['16'],
|
|
150
|
+
},
|
|
151
|
+
lg: {
|
|
152
|
+
xs: SPACING_SCALE['12'],
|
|
153
|
+
sm: SPACING_SCALE['14'],
|
|
154
|
+
md: SPACING_SCALE['14'],
|
|
155
|
+
lg: SPACING_SCALE['16'],
|
|
156
|
+
xl: SPACING_SCALE['16'],
|
|
157
|
+
'2xl': SPACING_SCALE['20'],
|
|
158
|
+
},
|
|
159
|
+
xl: {
|
|
160
|
+
xs: SPACING_SCALE['14'],
|
|
161
|
+
sm: SPACING_SCALE['16'],
|
|
162
|
+
md: SPACING_SCALE['16'],
|
|
163
|
+
lg: SPACING_SCALE['20'],
|
|
164
|
+
xl: SPACING_SCALE['20'],
|
|
165
|
+
'2xl': SPACING_SCALE['24'],
|
|
166
|
+
},
|
|
167
|
+
} as const;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Text size scale (Tailwind text utilities)
|
|
171
|
+
*/
|
|
172
|
+
export const RESPONSIVE_TEXT_SIZE: Record<
|
|
173
|
+
SizeVariant,
|
|
174
|
+
Partial<Record<'mobile' | 'tablet', string>>
|
|
175
|
+
> = {
|
|
176
|
+
xs: {
|
|
177
|
+
mobile: TEXT_SIZES.xs,
|
|
178
|
+
tablet: `sm:${TEXT_SIZES.xs}`,
|
|
179
|
+
},
|
|
180
|
+
sm: {
|
|
181
|
+
mobile: TEXT_SIZES.xs,
|
|
182
|
+
tablet: `sm:${TEXT_SIZES.sm}`,
|
|
183
|
+
},
|
|
184
|
+
md: {
|
|
185
|
+
mobile: TEXT_SIZES.sm,
|
|
186
|
+
tablet: `sm:${TEXT_SIZES.base}`,
|
|
187
|
+
},
|
|
188
|
+
lg: {
|
|
189
|
+
mobile: TEXT_SIZES.base,
|
|
190
|
+
tablet: `sm:${TEXT_SIZES.lg}`,
|
|
191
|
+
},
|
|
192
|
+
xl: {
|
|
193
|
+
mobile: TEXT_SIZES.lg,
|
|
194
|
+
tablet: `sm:${TEXT_SIZES.xl}`,
|
|
195
|
+
},
|
|
196
|
+
} as const;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Gap/Spacing between elements (space-y-*, space-x-*, gap-*)
|
|
200
|
+
*/
|
|
201
|
+
export const RESPONSIVE_GAP: Record<
|
|
202
|
+
SizeVariant,
|
|
203
|
+
Partial<Record<Breakpoint, SpacingScale>>
|
|
204
|
+
> = {
|
|
205
|
+
xs: {
|
|
206
|
+
xs: SPACING_SCALE['1'],
|
|
207
|
+
sm: SPACING_SCALE['2'],
|
|
208
|
+
md: SPACING_SCALE['2'],
|
|
209
|
+
lg: SPACING_SCALE['3'],
|
|
210
|
+
xl: SPACING_SCALE['3'],
|
|
211
|
+
'2xl': SPACING_SCALE['4'],
|
|
212
|
+
},
|
|
213
|
+
sm: {
|
|
214
|
+
xs: SPACING_SCALE['2'],
|
|
215
|
+
sm: SPACING_SCALE['3'],
|
|
216
|
+
md: SPACING_SCALE['3'],
|
|
217
|
+
lg: SPACING_SCALE['4'],
|
|
218
|
+
xl: SPACING_SCALE['4'],
|
|
219
|
+
'2xl': SPACING_SCALE['5'],
|
|
220
|
+
},
|
|
221
|
+
md: {
|
|
222
|
+
xs: SPACING_SCALE['3'],
|
|
223
|
+
sm: SPACING_SCALE['4'],
|
|
224
|
+
md: SPACING_SCALE['4'],
|
|
225
|
+
lg: SPACING_SCALE['5'],
|
|
226
|
+
xl: SPACING_SCALE['5'],
|
|
227
|
+
'2xl': SPACING_SCALE['6'],
|
|
228
|
+
},
|
|
229
|
+
lg: {
|
|
230
|
+
xs: SPACING_SCALE['4'],
|
|
231
|
+
sm: SPACING_SCALE['5'],
|
|
232
|
+
md: SPACING_SCALE['5'],
|
|
233
|
+
lg: SPACING_SCALE['6'],
|
|
234
|
+
xl: SPACING_SCALE['6'],
|
|
235
|
+
'2xl': SPACING_SCALE['8'],
|
|
236
|
+
},
|
|
237
|
+
xl: {
|
|
238
|
+
xs: SPACING_SCALE['5'],
|
|
239
|
+
sm: SPACING_SCALE['6'],
|
|
240
|
+
md: SPACING_SCALE['6'],
|
|
241
|
+
lg: SPACING_SCALE['8'],
|
|
242
|
+
xl: SPACING_SCALE['8'],
|
|
243
|
+
'2xl': SPACING_SCALE['10'],
|
|
244
|
+
},
|
|
245
|
+
} as const;
|
|
@@ -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
|
|
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;
|