@umituz/web-design-system 2.9.0 → 3.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/web-design-system",
3
- "version": "2.9.0",
3
+ "version": "3.1.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,245 +1,228 @@
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';
13
15
  import { SPACING_SCALE } from '../../infrastructure/constants/spacing.constants';
14
- import { TEXT_SIZES } from '../../infrastructure/constants/typography.constants';
16
+ import { TEXT_SIZES, type TextSizeKey } from '../../infrastructure/constants/typography.constants';
17
+ import { BREAKPOINT_ORDER } from '../../infrastructure/constants/breakpoint.constants';
15
18
 
16
19
  /**
17
- * Spacing scale values for padding, margin, and gap
18
- * Format: Tailwind spacing unit numbers (as strings for easier concatenation)
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)
19
23
  */
20
- export type SpacingScale = keyof typeof SPACING_SCALE;
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
+ '2xl': 6, // SPACING_SCALE['6'] = 24px
46
+ };
47
+
48
+ /**
49
+ * Base icon size values for each size variant
50
+ */
51
+ const ICON_BASES: Record<SizeVariant, number> = {
52
+ xs: 4,
53
+ sm: 5,
54
+ md: 6,
55
+ lg: 8,
56
+ xl: 10,
57
+ '2xl': 12,
58
+ };
59
+
60
+ /**
61
+ * Base container size values (for icon wrappers)
62
+ */
63
+ const CONTAINER_BASES: Record<SizeVariant, number> = {
64
+ xs: 6,
65
+ sm: 8,
66
+ md: 10,
67
+ lg: 12,
68
+ xl: 14,
69
+ '2xl': 16,
70
+ };
71
+
72
+ /**
73
+ * Base gap/spacing values for layout
74
+ */
75
+ const GAP_BASES: Record<SizeVariant, number> = {
76
+ xs: 1,
77
+ sm: 2,
78
+ md: 3,
79
+ lg: 4,
80
+ xl: 5,
81
+ '2xl': 6,
82
+ };
83
+
84
+ // ============================================================================
85
+ // FORMULAS - Define responsive behavior for each token type
86
+ // ============================================================================
87
+
88
+ /**
89
+ * Spacing formula for padding, margin, gap
90
+ * Progression: xs/sm→base, md/lg→base+1, xl→base+2, 2xl→base+3
91
+ */
92
+ const spacingFormula: ScaleFormula = (base, bp) => {
93
+ const bpIndex = BREAKPOINT_ORDER.indexOf(bp);
94
+ if (bpIndex <= 1) return base; // xs, sm
95
+ if (bpIndex <= 3) return base + 1; // md, lg
96
+ if (bpIndex === 4) return base + 2; // xl
97
+ return base + 3; // 2xl
98
+ };
99
+
100
+ /**
101
+ * Icon size formula
102
+ * Progression: More gradual increase across breakpoints
103
+ */
104
+ const iconFormula: ScaleFormula = (base, bp) => {
105
+ if (bp === 'xs') return base - 1;
106
+ if (bp === 'sm') return base;
107
+ if (bp === 'md') return base + 1;
108
+ if (bp === 'lg') return base + 2;
109
+ if (bp === 'xl') return base + 3;
110
+ return base + 3; // 2xl
111
+ };
112
+
113
+ /**
114
+ * Container size formula (for icon wrappers)
115
+ * Consistent size increase
116
+ */
117
+ const containerFormula: ScaleFormula = (base, bp) => {
118
+ const bpIndex = BREAKPOINT_ORDER.indexOf(bp);
119
+ if (bpIndex <= 3) return base + 2; // xs, sm, md, lg
120
+ if (bpIndex === 4) return base + 2; // xl
121
+ return base + 2; // 2xl
122
+ };
123
+
124
+ /**
125
+ * Gap formula for layout spacing
126
+ */
127
+ const gapFormula: ScaleFormula = (base, bp) => {
128
+ const bpIndex = BREAKPOINT_ORDER.indexOf(bp);
129
+ if (bpIndex <= 1) return base; // xs, sm
130
+ if (bpIndex <= 3) return base + 1; // md, lg
131
+ if (bpIndex === 4) return base + 1; // xl
132
+ return base + 2; // 2xl
133
+ };
134
+
135
+ // ============================================================================
136
+ // GENERATORS - Create responsive scales dynamically
137
+ // ============================================================================
21
138
 
22
139
  /**
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;
140
+ * Generate responsive scale for any token type
141
+ * @param bases - Base values for each size variant
142
+ * @param formula - Formula to calculate value at each breakpoint
143
+ * @returns Complete responsive scale object
144
+ */
145
+ function generateResponsiveScale(
146
+ bases: Record<SizeVariant, number>,
147
+ formula: ScaleFormula
148
+ ): ResponsiveScale {
149
+ const result: Partial<ResponsiveScale> = {};
150
+
151
+ for (const size of Object.keys(bases) as SizeVariant[]) {
152
+ const base = bases[size];
153
+ result[size] = {};
154
+
155
+ for (const bp of BREAKPOINT_ORDER) {
156
+ const scaleIndex = formula(base, bp);
157
+ const scaleKey = scaleIndex.toString() as keyof typeof SPACING_SCALE;
158
+
159
+ // Validate and get spacing scale value
160
+ if (scaleKey in SPACING_SCALE) {
161
+ result[size]![bp] = SPACING_SCALE[scaleKey];
162
+ }
163
+ }
164
+ }
165
+
166
+ return result as ResponsiveScale;
167
+ }
168
+
169
+ /**
170
+ * Generate responsive text sizes
171
+ * Text sizes use string literals, not spacing scale
172
+ */
173
+ function generateResponsiveTextSizes() {
174
+ const textSizeKeys: Record<SizeVariant, { mobile: TextSizeKey; tablet: TextSizeKey }> = {
175
+ xs: { mobile: 'xs', tablet: 'xs' },
176
+ sm: { mobile: 'xs', tablet: 'sm' },
177
+ md: { mobile: 'sm', tablet: 'base' },
178
+ lg: { mobile: 'base', tablet: 'lg' },
179
+ xl: { mobile: 'lg', tablet: 'xl' },
180
+ '2xl': { mobile: 'xl', tablet: '2xl' },
181
+ };
182
+
183
+ const result: Partial<Record<SizeVariant, Partial<Record<'mobile' | 'tablet', string>>>> = {};
184
+
185
+ for (const size of Object.keys(textSizeKeys) as SizeVariant[]) {
186
+ const keys = textSizeKeys[size];
187
+ result[size] = {
188
+ mobile: TEXT_SIZES[keys.mobile],
189
+ tablet: `sm:${TEXT_SIZES[keys.tablet]}`,
190
+ };
191
+ }
192
+
193
+ return result as Record<SizeVariant, Partial<Record<'mobile' | 'tablet', string>>>;
194
+ }
195
+
196
+ // ============================================================================
197
+ // EXPORTS - All responsive tokens (one line each!)
198
+ // ============================================================================
199
+
200
+ /**
201
+ * Responsive spacing scale for padding, margin, space-*, gap-*
202
+ */
203
+ export const RESPONSIVE_SPACING = generateResponsiveScale(SPACING_BASES, spacingFormula);
204
+
205
+ /**
206
+ * Responsive icon sizes (height/width)
207
+ */
208
+ export const RESPONSIVE_ICON_SIZE = generateResponsiveScale(ICON_BASES, iconFormula);
209
+
210
+ /**
211
+ * Responsive container sizes for icon wrappers
212
+ */
213
+ export const RESPONSIVE_CONTAINER_SIZE = generateResponsiveScale(CONTAINER_BASES, containerFormula);
214
+
215
+ /**
216
+ * Responsive gap/spacing for layouts
217
+ */
218
+ export const RESPONSIVE_GAP = generateResponsiveScale(GAP_BASES, gapFormula);
219
+
220
+ /**
221
+ * Responsive text sizes (mobile + tablet)
222
+ */
223
+ export const RESPONSIVE_TEXT_SIZE = generateResponsiveTextSizes();
224
+
225
+ /**
226
+ * Type exports
227
+ */
228
+ export type SpacingScale = keyof typeof SPACING_SCALE;
@@ -4,9 +4,8 @@
4
4
  */
5
5
 
6
6
  import type { ReactNode } from 'react';
7
- import type { SizeVariant } from '../../infrastructure/constants/size-variant.constants';
7
+ export type { SizeVariant } from '../../infrastructure/constants/size-variant.constants';
8
8
 
9
- export { type SizeVariant } from '../../infrastructure/constants/size-variant.constants';
10
9
  export type ColorVariant = 'primary' | 'secondary' | 'success' | 'warning' | 'destructive';
11
10
  export type ColorScheme = 'light' | 'dark';
12
11
 
@@ -38,6 +38,11 @@ export {
38
38
  getPrevSizeVariant,
39
39
  type SizeVariantKey,
40
40
  type SizeVariant,
41
+ type SmallSizes,
42
+ type MediumSizes,
43
+ type RegularSizes,
44
+ type ExtendedSizes,
45
+ type AllSizes,
41
46
  isValidSizeVariant,
42
47
  } from './size-variant.constants';
43
48
 
@@ -16,6 +16,7 @@ export const SIZE_VARIANTS = {
16
16
  md: 'md',
17
17
  lg: 'lg',
18
18
  xl: 'xl',
19
+ '2xl': '2xl',
19
20
  } as const;
20
21
 
21
22
  /**
@@ -28,10 +29,20 @@ export type SizeVariantKey = keyof typeof SIZE_VARIANTS;
28
29
  */
29
30
  export type SizeVariant = typeof SIZE_VARIANTS[SizeVariantKey];
30
31
 
32
+ /**
33
+ * Common size combinations used by components
34
+ * These prevent repeating Extract<SizeVariant, '...'> in every component
35
+ */
36
+ export type SmallSizes = Extract<SizeVariant, 'xs' | 'sm'>;
37
+ export type MediumSizes = Extract<SizeVariant, 'sm' | 'md' | 'lg'>;
38
+ export type RegularSizes = Extract<SizeVariant, 'sm' | 'md' | 'lg' | 'xl'>;
39
+ export type ExtendedSizes = Extract<SizeVariant, 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'>;
40
+ export type AllSizes = SizeVariant;
41
+
31
42
  /**
32
43
  * Size variant order (for sorting/comparison)
33
44
  */
34
- export const SIZE_VARIANT_ORDER: SizeVariant[] = ['xs', 'sm', 'md', 'lg', 'xl'];
45
+ export const SIZE_VARIANT_ORDER: SizeVariant[] = ['xs', 'sm', 'md', 'lg', 'xl', '2xl'];
35
46
 
36
47
  /**
37
48
  * Get the next larger size variant
@@ -11,7 +11,6 @@ import {
11
11
  RESPONSIVE_ICON_SIZE,
12
12
  RESPONSIVE_CONTAINER_SIZE,
13
13
  RESPONSIVE_TEXT_SIZE,
14
- RESPONSIVE_GAP,
15
14
  } from '../../domain/tokens/responsive-map.tokens';
16
15
 
17
16
  /**
@@ -5,11 +5,12 @@
5
5
 
6
6
  import { forwardRef, type HTMLAttributes } from 'react';
7
7
  import { cn } from '../../infrastructure/utils';
8
- import type { BaseProps, ColorVariant, SizeVariant } from '../../domain/types';
8
+ import type { BaseProps, ColorVariant } from '../../domain/types';
9
+ import type { MediumSizes } from '../../infrastructure/constants';
9
10
 
10
11
  export interface BadgeProps extends HTMLAttributes<HTMLDivElement>, BaseProps {
11
12
  variant?: ColorVariant;
12
- size?: Extract<SizeVariant, 'sm' | 'md' | 'lg'>;
13
+ size?: MediumSizes;
13
14
  }
14
15
 
15
16
  const variantStyles: Record<ColorVariant, string> = {
@@ -20,7 +21,7 @@ const variantStyles: Record<ColorVariant, string> = {
20
21
  destructive: 'bg-destructive text-destructive-foreground border-destructive',
21
22
  };
22
23
 
23
- const sizeStyles: Record<'sm' | 'md' | 'lg', string> = {
24
+ const sizeStyles: Record<MediumSizes, string> = {
24
25
  sm: 'px-2 py-0.5 text-xs',
25
26
  md: 'px-2.5 py-1 text-sm',
26
27
  lg: 'px-3 py-1.5 text-base',
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { useBreakpoint } from '../hooks/useMediaQuery';
7
- import type { Breakpoint, HideProps } from '../../domain/types/breakpoint.types';
7
+ import type { HideProps } from '../../domain/types/breakpoint.types';
8
8
  import type { BaseProps } from '../../domain/types';
9
9
 
10
10
  export interface HideComponentProps extends BaseProps, HideProps {
@@ -5,18 +5,20 @@
5
5
 
6
6
  import { forwardRef, type SVGAttributes } from 'react';
7
7
  import { cn } from '../../infrastructure/utils';
8
- import type { BaseProps, SizeVariant } from '../../domain/types';
8
+ import type { BaseProps } from '../../domain/types';
9
+ import type { ExtendedSizes } from '../../infrastructure/constants';
9
10
 
10
11
  export interface IconProps extends SVGAttributes<SVGSVGElement>, BaseProps {
11
- size?: Extract<SizeVariant, 'xs' | 'sm' | 'md' | 'lg' | 'xl'>;
12
+ size?: ExtendedSizes;
12
13
  }
13
14
 
14
- const sizeStyles: Record<'xs' | 'sm' | 'md' | 'lg' | 'xl', string> = {
15
+ const sizeStyles: Record<ExtendedSizes, string> = {
15
16
  xs: 'h-3 w-3',
16
17
  sm: 'h-4 w-4',
17
18
  md: 'h-5 w-5',
18
19
  lg: 'h-6 w-6',
19
20
  xl: 'h-8 w-8',
21
+ '2xl': 'h-10 w-10',
20
22
  };
21
23
 
22
24
  export const Icon = forwardRef<SVGSVGElement, IconProps>(
@@ -5,14 +5,15 @@
5
5
 
6
6
  import { forwardRef, type InputHTMLAttributes } from 'react';
7
7
  import { cn } from '../../infrastructure/utils';
8
- import type { BaseProps, SizeVariant } from '../../domain/types';
8
+ import type { BaseProps } from '../../domain/types';
9
+ import type { MediumSizes } from '../../infrastructure/constants';
9
10
 
10
11
  export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'>, BaseProps {
11
12
  error?: boolean;
12
- size?: Extract<SizeVariant, 'sm' | 'md' | 'lg'>;
13
+ size?: MediumSizes;
13
14
  }
14
15
 
15
- const sizeStyles: Record<'sm' | 'md' | 'lg', string> = {
16
+ const sizeStyles: Record<MediumSizes, string> = {
16
17
  sm: 'h-8 px-3 text-sm',
17
18
  md: 'h-9 px-3 text-sm',
18
19
  lg: 'h-10 px-4 text-base',
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { useBreakpoint } from '../hooks/useMediaQuery';
7
- import type { Breakpoint, ShowProps } from '../../domain/types/breakpoint.types';
7
+ import type { ShowProps } from '../../domain/types/breakpoint.types';
8
8
  import type { BaseProps } from '../../domain/types';
9
9
 
10
10
  export interface ShowComponentProps extends BaseProps, ShowProps {
@@ -5,13 +5,14 @@
5
5
 
6
6
  import { forwardRef, type HTMLAttributes } from 'react';
7
7
  import { cn } from '../../infrastructure/utils';
8
- import type { BaseProps, SizeVariant } from '../../domain/types';
8
+ import type { BaseProps } from '../../domain/types';
9
+ import type { RegularSizes } from '../../infrastructure/constants';
9
10
 
10
11
  export interface SpinnerProps extends HTMLAttributes<HTMLDivElement>, BaseProps {
11
- size?: Extract<SizeVariant, 'sm' | 'md' | 'lg' | 'xl'>;
12
+ size?: RegularSizes;
12
13
  }
13
14
 
14
- const sizeStyles: Record<'sm' | 'md' | 'lg' | 'xl', string> = {
15
+ const sizeStyles: Record<RegularSizes, string> = {
15
16
  sm: 'h-4 w-4 border-2',
16
17
  md: 'h-6 w-6 border-2',
17
18
  lg: 'h-8 w-8 border-3',
@@ -5,13 +5,14 @@
5
5
 
6
6
  import { forwardRef, type HTMLAttributes, type ComponentPropsWithoutRef } from 'react';
7
7
  import { cn } from '../../infrastructure/utils';
8
- import type { BaseProps, SizeVariant } from '../../domain/types';
8
+ import type { BaseProps } from '../../domain/types';
9
+ import type { ExtendedSizes } from '../../infrastructure/constants';
9
10
 
10
11
  export interface AvatarProps extends HTMLAttributes<HTMLDivElement>, BaseProps {
11
- size?: Extract<SizeVariant, 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'>;
12
+ size?: ExtendedSizes;
12
13
  }
13
14
 
14
- const sizeStyles: Record<'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl', string> = {
15
+ const sizeStyles: Record<ExtendedSizes, string> = {
15
16
  xs: 'h-6 w-6 text-xs',
16
17
  sm: 'h-8 w-8 text-sm',
17
18
  md: 'h-10 w-10 text-base',
@@ -18,6 +18,7 @@ import {
18
18
  import { Button } from '../atoms/Button';
19
19
  import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from 'lucide-react';
20
20
  import type { BaseProps, SizeVariant, ColorVariant } from '../../domain/types';
21
+ import type { MediumSizes } from '../../infrastructure/constants';
21
22
 
22
23
  export interface Column<T> {
23
24
  id: string;
@@ -32,7 +33,7 @@ export interface DataTableProps<T> extends BaseProps {
32
33
  data: T[];
33
34
  columns: Column<T>[];
34
35
  caption?: string;
35
- size?: Extract<SizeVariant, 'sm' | 'md' | 'lg'>;
36
+ size?: MediumSizes;
36
37
  variant?: ColorVariant;
37
38
  sortable?: boolean;
38
39
  paginated?: boolean;
@@ -110,13 +111,13 @@ export function DataTable<T extends Record<string, unknown>>({
110
111
  return value as React.ReactNode;
111
112
  };
112
113
 
113
- const sizeStyles = {
114
+ const sizeStyles: Record<MediumSizes, string> = {
114
115
  sm: 'text-xs',
115
116
  md: 'text-sm',
116
117
  lg: 'text-base',
117
118
  };
118
119
 
119
- const paddingStyles = {
120
+ const paddingStyles: Record<MediumSizes, string> = {
120
121
  sm: 'px-2 py-2',
121
122
  md: 'px-4 py-3',
122
123
  lg: 'px-6 py-4',
@@ -5,7 +5,6 @@
5
5
 
6
6
  import { cn } from '../../infrastructure/utils';
7
7
  import type { BaseProps } from '../../domain/types';
8
- import type { Breakpoint } from '../../domain/types/breakpoint.types';
9
8
 
10
9
  export interface GridProps extends BaseProps {
11
10
  children: React.ReactNode;