@umituz/web-design-system 1.9.4 → 2.0.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 +7 -7
- package/src/index.ts +63 -3
- package/src/infrastructure/error/SuspenseWrapper.tsx +2 -3
- package/src/presentation/atoms/Text.tsx +2 -0
- package/src/presentation/atoms/Tooltip.tsx +1 -1
- package/src/presentation/atoms/index.ts +0 -2
- package/src/presentation/molecules/ListItem.tsx +8 -4
- package/src/presentation/molecules/index.ts +0 -1
- package/src/presentation/organisms/Calendar.tsx +6 -2
- package/src/presentation/organisms/DataTable.tsx +2 -1
- package/src/presentation/organisms/Table.tsx +1 -1
- package/src/presentation/organisms/index.ts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/web-design-system",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
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",
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"class-variance-authority": ">=0.7.0",
|
|
74
74
|
"clsx": ">=2.0.0",
|
|
75
75
|
"lucide-react": ">=0.400.0",
|
|
76
|
-
"react": ">=
|
|
76
|
+
"react": ">=19.0.0",
|
|
77
77
|
"react-day-picker": ">=9.0.0",
|
|
78
|
-
"react-dom": ">=
|
|
78
|
+
"react-dom": ">=19.0.0",
|
|
79
79
|
"react-i18next": ">=13.0.0",
|
|
80
80
|
"tailwind-merge": ">=2.0.0"
|
|
81
81
|
},
|
|
@@ -97,14 +97,14 @@
|
|
|
97
97
|
"@radix-ui/react-toggle": "^1.1.9",
|
|
98
98
|
"@radix-ui/react-toggle-group": "^1.1.10",
|
|
99
99
|
"@radix-ui/react-tooltip": "^1.2.7",
|
|
100
|
-
"@types/react": "^
|
|
101
|
-
"@types/react-dom": "^
|
|
100
|
+
"@types/react": "^19.0.0",
|
|
101
|
+
"@types/react-dom": "^19.0.0",
|
|
102
102
|
"class-variance-authority": "^0.7.1",
|
|
103
103
|
"clsx": "^2.1.1",
|
|
104
104
|
"lucide-react": "^0.577.0",
|
|
105
|
-
"react": "^
|
|
105
|
+
"react": "^19.0.0",
|
|
106
106
|
"react-day-picker": "^9.14.0",
|
|
107
|
-
"react-dom": "^
|
|
107
|
+
"react-dom": "^19.0.0",
|
|
108
108
|
"react-i18next": "^13.0.0",
|
|
109
109
|
"tailwind-merge": "^3.5.0",
|
|
110
110
|
"typescript": "~5.9.2"
|
package/src/index.ts
CHANGED
|
@@ -24,8 +24,68 @@ export * from './infrastructure/constants';
|
|
|
24
24
|
export * from './infrastructure/security';
|
|
25
25
|
export * from './infrastructure/performance';
|
|
26
26
|
export * from './infrastructure/error';
|
|
27
|
-
export * from './presentation/atoms';
|
|
28
|
-
export * from './presentation/molecules';
|
|
29
|
-
export * from './presentation/organisms';
|
|
30
27
|
export * from './presentation/templates';
|
|
31
28
|
export * from './presentation/hooks';
|
|
29
|
+
|
|
30
|
+
// Atoms
|
|
31
|
+
export type { ButtonProps } from './presentation/atoms/Button';
|
|
32
|
+
export { Button } from './presentation/atoms/Button';
|
|
33
|
+
export type { BadgeProps } from './presentation/atoms/Badge';
|
|
34
|
+
export { Badge } from './presentation/atoms/Badge';
|
|
35
|
+
export type { InputProps } from './presentation/atoms/Input';
|
|
36
|
+
export { Input } from './presentation/atoms/Input';
|
|
37
|
+
export type { TextProps, TextElement, TextVariant, TextSize } from './presentation/atoms/Text';
|
|
38
|
+
export { Text } from './presentation/atoms/Text';
|
|
39
|
+
export type { IconProps } from './presentation/atoms/Icon';
|
|
40
|
+
export { Icon } from './presentation/atoms/Icon';
|
|
41
|
+
export type { SpinnerProps } from './presentation/atoms/Spinner';
|
|
42
|
+
export { Spinner } from './presentation/atoms/Spinner';
|
|
43
|
+
export type { CheckboxProps } from './presentation/atoms/Checkbox';
|
|
44
|
+
export { Checkbox } from './presentation/atoms/Checkbox';
|
|
45
|
+
export type { RadioProps } from './presentation/atoms/Radio';
|
|
46
|
+
export { Radio } from './presentation/atoms/Radio';
|
|
47
|
+
export type { SliderProps } from './presentation/atoms/Slider';
|
|
48
|
+
export { Slider } from './presentation/atoms/Slider';
|
|
49
|
+
export type { DividerProps } from './presentation/atoms/Divider';
|
|
50
|
+
export { Divider } from './presentation/atoms/Divider';
|
|
51
|
+
export type { SkeletonProps } from './presentation/atoms/Skeleton';
|
|
52
|
+
export { Skeleton } from './presentation/atoms/Skeleton';
|
|
53
|
+
export type { LinkProps } from './presentation/atoms/Link';
|
|
54
|
+
export { Link } from './presentation/atoms/Link';
|
|
55
|
+
export type { TooltipProps } from './presentation/atoms/Tooltip';
|
|
56
|
+
export { Tooltip } from './presentation/atoms/Tooltip';
|
|
57
|
+
export type { ProgressProps } from './presentation/atoms/Progress';
|
|
58
|
+
export { Progress } from './presentation/atoms/Progress';
|
|
59
|
+
export { Label } from './presentation/atoms/Label';
|
|
60
|
+
export type { AspectRatioProps } from './presentation/atoms/AspectRatio';
|
|
61
|
+
export { AspectRatio } from './presentation/atoms/AspectRatio';
|
|
62
|
+
export type { SwitchProps } from './presentation/atoms/Switch';
|
|
63
|
+
export { Switch } from './presentation/atoms/Switch';
|
|
64
|
+
export { Separator } from './presentation/atoms/Separator';
|
|
65
|
+
export { Toggle as ToggleAtom, toggleVariants } from './presentation/atoms/Toggle';
|
|
66
|
+
|
|
67
|
+
// Molecules
|
|
68
|
+
export type { FormFieldProps } from './presentation/molecules/FormField';
|
|
69
|
+
export { FormField } from './presentation/molecules/FormField';
|
|
70
|
+
export type { SearchBoxProps } from './presentation/molecules/SearchBox';
|
|
71
|
+
export { SearchBox } from './presentation/molecules/SearchBox';
|
|
72
|
+
export type { AvatarProps, AvatarImageProps, AvatarFallbackProps } from './presentation/molecules/Avatar';
|
|
73
|
+
export { Avatar, AvatarImage, AvatarFallback } from './presentation/molecules/Avatar';
|
|
74
|
+
export type { ChipProps } from './presentation/molecules/Chip';
|
|
75
|
+
export { Chip } from './presentation/molecules/Chip';
|
|
76
|
+
export type { ToggleProps } from './presentation/molecules/Toggle';
|
|
77
|
+
export { Toggle } from './presentation/molecules/Toggle';
|
|
78
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton } from './presentation/molecules/Select';
|
|
79
|
+
export type { TextareaProps } from './presentation/molecules/Textarea';
|
|
80
|
+
export { Textarea } from './presentation/molecules/Textarea';
|
|
81
|
+
export type { RadioGroupProps, RadioOption } from './presentation/molecules/RadioGroup';
|
|
82
|
+
export { RadioGroup } from './presentation/molecules/RadioGroup';
|
|
83
|
+
export type { CheckboxGroupProps, CheckboxOption } from './presentation/molecules/CheckboxGroup';
|
|
84
|
+
export { CheckboxGroup } from './presentation/molecules/CheckboxGroup';
|
|
85
|
+
export type { InputGroupProps } from './presentation/molecules/InputGroup';
|
|
86
|
+
export { InputGroup, GroupedInput } from './presentation/molecules/InputGroup';
|
|
87
|
+
export { ScrollArea, ScrollBar } from './presentation/molecules/ScrollArea';
|
|
88
|
+
export type { ListItemProps } from './presentation/molecules/ListItem';
|
|
89
|
+
export { ListItem } from './presentation/molecules/ListItem';
|
|
90
|
+
|
|
91
|
+
export * from './presentation/organisms';
|
|
@@ -14,14 +14,13 @@ export interface SuspenseWrapperProps {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const DefaultLoadingSpinner: React.FC<{ text?: string; className?: string }> = ({ text, className }) => (
|
|
17
|
-
<div style={{
|
|
17
|
+
<div className={className} style={{
|
|
18
18
|
display: 'flex',
|
|
19
19
|
flexDirection: 'column',
|
|
20
20
|
alignItems: 'center',
|
|
21
21
|
justifyContent: 'center',
|
|
22
22
|
gap: '16px',
|
|
23
|
-
padding: '32px'
|
|
24
|
-
...({ className } as any)
|
|
23
|
+
padding: '32px'
|
|
25
24
|
}}>
|
|
26
25
|
<div style={{
|
|
27
26
|
width: '40px',
|
|
@@ -43,6 +43,8 @@ const weightStyles: Record<'normal' | 'medium' | 'semibold' | 'bold', string> =
|
|
|
43
43
|
bold: 'font-bold',
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
// NOTE: "as any" is used here for the polymorphic ref, which is a necessary workaround
|
|
47
|
+
// for TypeScript's limitations in typing polymorphic components properly.
|
|
46
48
|
export const Text = forwardRef<HTMLElement, TextProps>(
|
|
47
49
|
({ className, as = 'p', variant = 'body', size = 'md', weight = 'normal', ...props }, ref) => {
|
|
48
50
|
const Tag = as as any;
|
|
@@ -23,7 +23,7 @@ const placementStyles: Record<'top' | 'bottom' | 'left' | 'right', string> = {
|
|
|
23
23
|
export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
24
24
|
({ className, children, content, placement = 'top', delay = 200, ...props }, ref) => {
|
|
25
25
|
const [isOpen, setIsOpen] = useState(false);
|
|
26
|
-
const timeoutRef = useRef<
|
|
26
|
+
const timeoutRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
|
|
27
27
|
|
|
28
28
|
const handleMouseEnter = () => {
|
|
29
29
|
timeoutRef.current = setTimeout(() => {
|
|
@@ -55,7 +55,5 @@ export { Switch } from './Switch';
|
|
|
55
55
|
export type { SwitchProps } from './Switch';
|
|
56
56
|
|
|
57
57
|
export { Separator } from './Separator';
|
|
58
|
-
export type { SeparatorProps } from './Separator';
|
|
59
58
|
|
|
60
59
|
export { Toggle, toggleVariants } from './Toggle';
|
|
61
|
-
export type { ToggleProps } from './Toggle';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Reduces boilerplate in list components throughout the app
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { forwardRef, type ReactNode, type
|
|
7
|
+
import { forwardRef, type ReactNode, type HTMLAttributes, type AnchorHTMLAttributes } from 'react';
|
|
8
8
|
import { cn } from '../../infrastructure/utils';
|
|
9
9
|
import { Button } from '../atoms';
|
|
10
10
|
import type { BaseProps } from '../../domain/types';
|
|
@@ -22,6 +22,8 @@ export interface ListItemProps extends BaseProps {
|
|
|
22
22
|
selected?: boolean;
|
|
23
23
|
size?: 'sm' | 'md' | 'lg';
|
|
24
24
|
variant?: 'default' | 'bordered' | 'ghost';
|
|
25
|
+
className?: string;
|
|
26
|
+
id?: string;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
const sizeStyles = {
|
|
@@ -64,7 +66,7 @@ export const ListItem = forwardRef<HTMLDivElement, ListItemProps>(
|
|
|
64
66
|
selected = false,
|
|
65
67
|
size = 'md',
|
|
66
68
|
variant = 'default',
|
|
67
|
-
|
|
69
|
+
id,
|
|
68
70
|
},
|
|
69
71
|
ref
|
|
70
72
|
) => {
|
|
@@ -104,9 +106,11 @@ export const ListItem = forwardRef<HTMLDivElement, ListItemProps>(
|
|
|
104
106
|
</>
|
|
105
107
|
);
|
|
106
108
|
|
|
109
|
+
// NOTE: Polymorphic component - renders as anchor when href is provided
|
|
110
|
+
// "ref as any" is necessary due to TypeScript limitations with polymorphic refs
|
|
107
111
|
if (href && !disabled) {
|
|
108
112
|
return (
|
|
109
|
-
<a href={href}
|
|
113
|
+
<a href={href} className={baseClasses} id={id} ref={ref as any}>
|
|
110
114
|
{content}
|
|
111
115
|
</a>
|
|
112
116
|
);
|
|
@@ -117,7 +121,7 @@ export const ListItem = forwardRef<HTMLDivElement, ListItemProps>(
|
|
|
117
121
|
ref={ref}
|
|
118
122
|
className={baseClasses}
|
|
119
123
|
onClick={disabled ? undefined : onClick}
|
|
120
|
-
{
|
|
124
|
+
id={id}
|
|
121
125
|
>
|
|
122
126
|
{content}
|
|
123
127
|
</div>
|
|
@@ -20,7 +20,6 @@ export { Toggle } from './Toggle';
|
|
|
20
20
|
export type { ToggleProps } from './Toggle';
|
|
21
21
|
|
|
22
22
|
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton } from './Select';
|
|
23
|
-
export type { SelectProps } from './Select';
|
|
24
23
|
|
|
25
24
|
export { Textarea } from './Textarea';
|
|
26
25
|
export type { TextareaProps } from './Textarea';
|
|
@@ -63,8 +63,12 @@ function Calendar({
|
|
|
63
63
|
...classNames,
|
|
64
64
|
}}
|
|
65
65
|
components={{
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
Chevron: ({ orientation, ...props }) =>
|
|
67
|
+
orientation === 'left' ? (
|
|
68
|
+
<ChevronLeft className="h-4 w-4" {...props} />
|
|
69
|
+
) : (
|
|
70
|
+
<ChevronRight className="h-4 w-4" {...props} />
|
|
71
|
+
),
|
|
68
72
|
}}
|
|
69
73
|
{...props}
|
|
70
74
|
/>
|
|
@@ -84,8 +84,9 @@ export function DataTable<T extends Record<string, unknown>>({
|
|
|
84
84
|
const bValue = typeof column.accessor === 'function' ? column.accessor(b) : b[column.accessor];
|
|
85
85
|
|
|
86
86
|
if (aValue === bValue) return 0;
|
|
87
|
+
if (aValue == null || bValue == null) return 0;
|
|
87
88
|
|
|
88
|
-
const comparison = aValue < bValue ? -1 : 1;
|
|
89
|
+
const comparison = (aValue as string | number) < (bValue as string | number) ? -1 : 1;
|
|
89
90
|
return sortDirection === 'asc' ? comparison : -comparison;
|
|
90
91
|
});
|
|
91
92
|
}, [data, sortColumn, sortDirection, columns, sortable]);
|
|
@@ -92,7 +92,7 @@ export const TableHead = forwardRef<HTMLTableCellElement, HTMLAttributes<HTMLTab
|
|
|
92
92
|
|
|
93
93
|
TableHead.displayName = 'TableHead';
|
|
94
94
|
|
|
95
|
-
export const TableCell = forwardRef<HTMLTableCellElement, HTMLAttributes<HTMLTableCellElement
|
|
95
|
+
export const TableCell = forwardRef<HTMLTableCellElement, HTMLAttributes<HTMLTableCellElement> & { colSpan?: number }>(
|
|
96
96
|
({ className, ...props }, ref) => (
|
|
97
97
|
<td
|
|
98
98
|
ref={ref}
|
|
@@ -129,7 +129,5 @@ export {
|
|
|
129
129
|
DropdownMenuSubTrigger,
|
|
130
130
|
DropdownMenuRadioGroup,
|
|
131
131
|
} from './DropdownMenu';
|
|
132
|
-
export type { DropdownMenuProps, DropdownMenuContentProps } from './DropdownMenu';
|
|
133
132
|
|
|
134
133
|
export { ToggleGroup, ToggleGroupItem } from './ToggleGroup';
|
|
135
|
-
export type { ToggleGroupProps, ToggleGroupItemProps } from './ToggleGroup';
|