@umituz/web-design-system 3.0.0 → 3.1.1
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 +5 -1
- package/src/domain/types/component.types.ts +1 -2
- package/src/infrastructure/constants/index.ts +5 -0
- package/src/infrastructure/constants/size-variant.constants.ts +12 -1
- package/src/infrastructure/utils/responsive.utils.ts +0 -1
- package/src/presentation/atoms/Badge.tsx +4 -3
- package/src/presentation/atoms/Hide.tsx +1 -1
- package/src/presentation/atoms/Icon.tsx +5 -3
- package/src/presentation/atoms/Input.tsx +4 -3
- package/src/presentation/atoms/Show.tsx +1 -1
- package/src/presentation/atoms/Spinner.tsx +4 -3
- package/src/presentation/molecules/Avatar.tsx +4 -3
- package/src/presentation/organisms/DataTable.tsx +5 -4
- package/src/presentation/organisms/Grid.tsx +0 -1
package/package.json
CHANGED
|
@@ -42,6 +42,7 @@ const SPACING_BASES: Record<SizeVariant, number> = {
|
|
|
42
42
|
md: 3, // SPACING_SCALE['3'] = 12px
|
|
43
43
|
lg: 4, // SPACING_SCALE['4'] = 16px
|
|
44
44
|
xl: 5, // SPACING_SCALE['5'] = 20px
|
|
45
|
+
'2xl': 6, // SPACING_SCALE['6'] = 24px
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
/**
|
|
@@ -53,6 +54,7 @@ const ICON_BASES: Record<SizeVariant, number> = {
|
|
|
53
54
|
md: 6,
|
|
54
55
|
lg: 8,
|
|
55
56
|
xl: 10,
|
|
57
|
+
'2xl': 12,
|
|
56
58
|
};
|
|
57
59
|
|
|
58
60
|
/**
|
|
@@ -64,6 +66,7 @@ const CONTAINER_BASES: Record<SizeVariant, number> = {
|
|
|
64
66
|
md: 10,
|
|
65
67
|
lg: 12,
|
|
66
68
|
xl: 14,
|
|
69
|
+
'2xl': 16,
|
|
67
70
|
};
|
|
68
71
|
|
|
69
72
|
/**
|
|
@@ -75,6 +78,7 @@ const GAP_BASES: Record<SizeVariant, number> = {
|
|
|
75
78
|
md: 3,
|
|
76
79
|
lg: 4,
|
|
77
80
|
xl: 5,
|
|
81
|
+
'2xl': 6,
|
|
78
82
|
};
|
|
79
83
|
|
|
80
84
|
// ============================================================================
|
|
@@ -98,7 +102,6 @@ const spacingFormula: ScaleFormula = (base, bp) => {
|
|
|
98
102
|
* Progression: More gradual increase across breakpoints
|
|
99
103
|
*/
|
|
100
104
|
const iconFormula: ScaleFormula = (base, bp) => {
|
|
101
|
-
const bpIndex = BREAKPOINT_ORDER.indexOf(bp);
|
|
102
105
|
if (bp === 'xs') return base - 1;
|
|
103
106
|
if (bp === 'sm') return base;
|
|
104
107
|
if (bp === 'md') return base + 1;
|
|
@@ -174,6 +177,7 @@ function generateResponsiveTextSizes() {
|
|
|
174
177
|
md: { mobile: 'sm', tablet: 'base' },
|
|
175
178
|
lg: { mobile: 'base', tablet: 'lg' },
|
|
176
179
|
xl: { mobile: 'lg', tablet: 'xl' },
|
|
180
|
+
'2xl': { mobile: 'xl', tablet: '2xl' },
|
|
177
181
|
};
|
|
178
182
|
|
|
179
183
|
const result: Partial<Record<SizeVariant, Partial<Record<'mobile' | 'tablet', string>>>> = {};
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { ReactNode } from 'react';
|
|
7
|
-
|
|
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
|
|
|
@@ -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
|
|
@@ -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
|
|
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?:
|
|
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<
|
|
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 {
|
|
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
|
|
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?:
|
|
12
|
+
size?: ExtendedSizes;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const sizeStyles: Record<
|
|
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
|
|
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?:
|
|
13
|
+
size?: MediumSizes;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
const sizeStyles: Record<
|
|
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 {
|
|
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
|
|
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?:
|
|
12
|
+
size?: RegularSizes;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const sizeStyles: Record<
|
|
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
|
|
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?:
|
|
12
|
+
size?: ExtendedSizes;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const sizeStyles: Record<
|
|
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',
|
|
@@ -17,7 +17,8 @@ import {
|
|
|
17
17
|
} from './Table';
|
|
18
18
|
import { Button } from '../atoms/Button';
|
|
19
19
|
import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from 'lucide-react';
|
|
20
|
-
import type { BaseProps,
|
|
20
|
+
import type { BaseProps, 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?:
|
|
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',
|