@umituz/web-design-system 2.8.0 → 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 +133 -131
- 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/package.json
CHANGED
|
@@ -10,12 +10,14 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
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';
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* Spacing scale values for padding, margin, and gap
|
|
16
18
|
* Format: Tailwind spacing unit numbers (as strings for easier concatenation)
|
|
17
19
|
*/
|
|
18
|
-
export type SpacingScale =
|
|
20
|
+
export type SpacingScale = keyof typeof SPACING_SCALE;
|
|
19
21
|
|
|
20
22
|
/**
|
|
21
23
|
* Responsive spacing mapping by size variant and breakpoint
|
|
@@ -25,44 +27,44 @@ export const RESPONSIVE_SPACING: Record<
|
|
|
25
27
|
Partial<Record<Breakpoint, SpacingScale>>
|
|
26
28
|
> = {
|
|
27
29
|
xs: {
|
|
28
|
-
xs: '2',
|
|
29
|
-
sm: '3',
|
|
30
|
-
md: '3',
|
|
31
|
-
lg: '4',
|
|
32
|
-
xl: '4',
|
|
33
|
-
'2xl': '5',
|
|
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'],
|
|
34
36
|
},
|
|
35
37
|
sm: {
|
|
36
|
-
xs: '3',
|
|
37
|
-
sm: '4',
|
|
38
|
-
md: '4',
|
|
39
|
-
lg: '5',
|
|
40
|
-
xl: '6',
|
|
41
|
-
'2xl': '8',
|
|
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'],
|
|
42
44
|
},
|
|
43
45
|
md: {
|
|
44
|
-
xs: '4',
|
|
45
|
-
sm: '5',
|
|
46
|
-
md: '5',
|
|
47
|
-
lg: '6',
|
|
48
|
-
xl: '8',
|
|
49
|
-
'2xl': '10',
|
|
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'],
|
|
50
52
|
},
|
|
51
53
|
lg: {
|
|
52
|
-
xs: '5',
|
|
53
|
-
sm: '6',
|
|
54
|
-
md: '6',
|
|
55
|
-
lg: '8',
|
|
56
|
-
xl: '10',
|
|
57
|
-
'2xl': '12',
|
|
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'],
|
|
58
60
|
},
|
|
59
61
|
xl: {
|
|
60
|
-
xs: '6',
|
|
61
|
-
sm: '8',
|
|
62
|
-
md: '8',
|
|
63
|
-
lg: '10',
|
|
64
|
-
xl: '12',
|
|
65
|
-
'2xl': '16',
|
|
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'],
|
|
66
68
|
},
|
|
67
69
|
} as const;
|
|
68
70
|
|
|
@@ -74,44 +76,44 @@ export const RESPONSIVE_ICON_SIZE: Record<
|
|
|
74
76
|
Partial<Record<Breakpoint, SpacingScale>>
|
|
75
77
|
> = {
|
|
76
78
|
xs: {
|
|
77
|
-
xs: '3',
|
|
78
|
-
sm: '4',
|
|
79
|
-
md: '5',
|
|
80
|
-
lg: '5',
|
|
81
|
-
xl: '6',
|
|
82
|
-
'2xl': '7',
|
|
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'],
|
|
83
85
|
},
|
|
84
86
|
sm: {
|
|
85
|
-
xs: '4',
|
|
86
|
-
sm: '5',
|
|
87
|
-
md: '6',
|
|
88
|
-
lg: '6',
|
|
89
|
-
xl: '8',
|
|
90
|
-
'2xl': '8',
|
|
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'],
|
|
91
93
|
},
|
|
92
94
|
md: {
|
|
93
|
-
xs: '5',
|
|
94
|
-
sm: '6',
|
|
95
|
-
md: '7',
|
|
96
|
-
lg: '8',
|
|
97
|
-
xl: '9',
|
|
98
|
-
'2xl': '10',
|
|
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'],
|
|
99
101
|
},
|
|
100
102
|
lg: {
|
|
101
|
-
xs: '6',
|
|
102
|
-
sm: '7',
|
|
103
|
-
md: '8',
|
|
104
|
-
lg: '9',
|
|
105
|
-
xl: '10',
|
|
106
|
-
'2xl': '12',
|
|
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'],
|
|
107
109
|
},
|
|
108
110
|
xl: {
|
|
109
|
-
xs: '8',
|
|
110
|
-
sm: '9',
|
|
111
|
-
md: '10',
|
|
112
|
-
lg: '12',
|
|
113
|
-
xl: '14',
|
|
114
|
-
'2xl': '16',
|
|
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'],
|
|
115
117
|
},
|
|
116
118
|
} as const;
|
|
117
119
|
|
|
@@ -123,44 +125,44 @@ export const RESPONSIVE_CONTAINER_SIZE: Record<
|
|
|
123
125
|
Partial<Record<Breakpoint, SpacingScale>>
|
|
124
126
|
> = {
|
|
125
127
|
xs: {
|
|
126
|
-
xs: '6',
|
|
127
|
-
sm: '8',
|
|
128
|
-
md: '8',
|
|
129
|
-
lg: '10',
|
|
130
|
-
xl: '10',
|
|
131
|
-
'2xl': '12',
|
|
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'],
|
|
132
134
|
},
|
|
133
135
|
sm: {
|
|
134
|
-
xs: '8',
|
|
135
|
-
sm: '10',
|
|
136
|
-
md: '10',
|
|
137
|
-
lg: '12',
|
|
138
|
-
xl: '12',
|
|
139
|
-
'2xl': '14',
|
|
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'],
|
|
140
142
|
},
|
|
141
143
|
md: {
|
|
142
|
-
xs: '10',
|
|
143
|
-
sm: '12',
|
|
144
|
-
md: '12',
|
|
145
|
-
lg: '14',
|
|
146
|
-
xl: '14',
|
|
147
|
-
'2xl': '16',
|
|
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'],
|
|
148
150
|
},
|
|
149
151
|
lg: {
|
|
150
|
-
xs: '12',
|
|
151
|
-
sm: '14',
|
|
152
|
-
md: '14',
|
|
153
|
-
lg: '16',
|
|
154
|
-
xl: '16',
|
|
155
|
-
'2xl': '20',
|
|
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'],
|
|
156
158
|
},
|
|
157
159
|
xl: {
|
|
158
|
-
xs: '14',
|
|
159
|
-
sm: '16',
|
|
160
|
-
md: '16',
|
|
161
|
-
lg: '20',
|
|
162
|
-
xl: '20',
|
|
163
|
-
'2xl': '24',
|
|
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'],
|
|
164
166
|
},
|
|
165
167
|
} as const;
|
|
166
168
|
|
|
@@ -172,24 +174,24 @@ export const RESPONSIVE_TEXT_SIZE: Record<
|
|
|
172
174
|
Partial<Record<'mobile' | 'tablet', string>>
|
|
173
175
|
> = {
|
|
174
176
|
xs: {
|
|
175
|
-
mobile:
|
|
176
|
-
tablet:
|
|
177
|
+
mobile: TEXT_SIZES.xs,
|
|
178
|
+
tablet: `sm:${TEXT_SIZES.xs}`,
|
|
177
179
|
},
|
|
178
180
|
sm: {
|
|
179
|
-
mobile:
|
|
180
|
-
tablet:
|
|
181
|
+
mobile: TEXT_SIZES.xs,
|
|
182
|
+
tablet: `sm:${TEXT_SIZES.sm}`,
|
|
181
183
|
},
|
|
182
184
|
md: {
|
|
183
|
-
mobile:
|
|
184
|
-
tablet:
|
|
185
|
+
mobile: TEXT_SIZES.sm,
|
|
186
|
+
tablet: `sm:${TEXT_SIZES.base}`,
|
|
185
187
|
},
|
|
186
188
|
lg: {
|
|
187
|
-
mobile:
|
|
188
|
-
tablet:
|
|
189
|
+
mobile: TEXT_SIZES.base,
|
|
190
|
+
tablet: `sm:${TEXT_SIZES.lg}`,
|
|
189
191
|
},
|
|
190
192
|
xl: {
|
|
191
|
-
mobile:
|
|
192
|
-
tablet:
|
|
193
|
+
mobile: TEXT_SIZES.lg,
|
|
194
|
+
tablet: `sm:${TEXT_SIZES.xl}`,
|
|
193
195
|
},
|
|
194
196
|
} as const;
|
|
195
197
|
|
|
@@ -201,43 +203,43 @@ export const RESPONSIVE_GAP: Record<
|
|
|
201
203
|
Partial<Record<Breakpoint, SpacingScale>>
|
|
202
204
|
> = {
|
|
203
205
|
xs: {
|
|
204
|
-
xs: '1',
|
|
205
|
-
sm: '2',
|
|
206
|
-
md: '2',
|
|
207
|
-
lg: '3',
|
|
208
|
-
xl: '3',
|
|
209
|
-
'2xl': '4',
|
|
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'],
|
|
210
212
|
},
|
|
211
213
|
sm: {
|
|
212
|
-
xs: '2',
|
|
213
|
-
sm: '3',
|
|
214
|
-
md: '3',
|
|
215
|
-
lg: '4',
|
|
216
|
-
xl: '4',
|
|
217
|
-
'2xl': '5',
|
|
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'],
|
|
218
220
|
},
|
|
219
221
|
md: {
|
|
220
|
-
xs: '3',
|
|
221
|
-
sm: '4',
|
|
222
|
-
md: '4',
|
|
223
|
-
lg: '5',
|
|
224
|
-
xl: '5',
|
|
225
|
-
'2xl': '6',
|
|
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'],
|
|
226
228
|
},
|
|
227
229
|
lg: {
|
|
228
|
-
xs: '4',
|
|
229
|
-
sm: '5',
|
|
230
|
-
md: '5',
|
|
231
|
-
lg: '6',
|
|
232
|
-
xl: '6',
|
|
233
|
-
'2xl': '8',
|
|
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'],
|
|
234
236
|
},
|
|
235
237
|
xl: {
|
|
236
|
-
xs: '5',
|
|
237
|
-
sm: '6',
|
|
238
|
-
md: '6',
|
|
239
|
-
lg: '8',
|
|
240
|
-
xl: '8',
|
|
241
|
-
'2xl': '10',
|
|
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'],
|
|
242
244
|
},
|
|
243
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;
|