@umituz/web-design-system 4.23.0 → 4.24.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": "4.23.0",
3
+ "version": "4.24.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Web Design System - Tailwind v4 authored, precompiled CSS shipped. Atomic Design components (Atoms, Molecules, Organisms, Templates) for React applications.",
@@ -1,10 +1,5 @@
1
- /**
2
- * EmptyState Component (Organism)
3
- * @description Component for displaying empty states with optional actions (Responsive)
4
- */
5
-
6
1
  import { forwardRef, isValidElement } from 'react';
7
- import type { ReactNode } from 'react';
2
+ import type { ComponentType, ReactNode } from 'react';
8
3
  import { cn, getSpacing, getGap } from '../../infrastructure/utils';
9
4
  import type { BaseProps, SizeVariant } from '../../domain/types';
10
5
 
@@ -23,8 +18,18 @@ function isActionConfig(action: EmptyStateAction | ReactNode): action is EmptySt
23
18
  );
24
19
  }
25
20
 
21
+ const FORWARD_REF = Symbol.for('react.forward_ref');
22
+ const MEMO = Symbol.for('react.memo');
23
+
24
+ function isComponentType(value: unknown): value is ComponentType<{ className?: string }> {
25
+ if (typeof value === 'function') return true;
26
+ if (typeof value !== 'object' || value === null) return false;
27
+ const tag = (value as { $$typeof?: symbol }).$$typeof;
28
+ return tag === FORWARD_REF || tag === MEMO;
29
+ }
30
+
26
31
  export interface EmptyStateProps extends BaseProps {
27
- icon?: React.ComponentType<{ className?: string }> | ReactNode;
32
+ icon?: ComponentType<{ className?: string }> | ReactNode;
28
33
  title: string;
29
34
  description?: string;
30
35
  action?: EmptyStateAction | ReactNode;
@@ -45,6 +50,7 @@ export const EmptyState = forwardRef<HTMLDivElement, EmptyStateProps>(
45
50
  },
46
51
  ref
47
52
  ) => {
53
+ const iconBox = size === 'sm' ? 'h-8 w-8 sm:h-10 sm:w-10' : size === 'md' ? 'h-12 w-12 sm:h-14 sm:w-14' : size === 'lg' ? 'h-16 w-16 sm:h-20 sm:w-20' : 'h-20 w-20 sm:h-24 sm:w-24';
48
54
  return (
49
55
  <div
50
56
  ref={ref}
@@ -56,18 +62,18 @@ export const EmptyState = forwardRef<HTMLDivElement, EmptyStateProps>(
56
62
  )}
57
63
  {...props}
58
64
  >
59
- {typeof icon === 'function' &&
65
+ {isComponentType(icon) &&
60
66
  (() => {
61
67
  const Icon = icon;
62
68
  return (
63
- <Icon className={cn(size === 'sm' ? 'h-8 w-8 sm:h-10 sm:w-10' : size === 'md' ? 'h-12 w-12 sm:h-14 sm:w-14' : size === 'lg' ? 'h-16 w-16 sm:h-20 sm:w-20' : 'h-20 w-20 sm:h-24 sm:w-24', 'text-muted-foreground/50 mx-auto mb-2')} />
69
+ <Icon className={cn(iconBox, 'text-muted-foreground/50 mx-auto mb-2')} />
64
70
  );
65
71
  })()}
66
- {typeof icon !== 'function' && icon && (
72
+ {!isComponentType(icon) && icon && (
67
73
  <span
68
74
  className={cn(
69
75
  'inline-flex items-center justify-center text-muted-foreground/50 mx-auto mb-2',
70
- size === 'sm' ? 'h-8 w-8 sm:h-10 sm:w-10' : size === 'md' ? 'h-12 w-12 sm:h-14 sm:w-14' : size === 'lg' ? 'h-16 w-16 sm:h-20 sm:w-20' : 'h-20 w-20 sm:h-24 sm:w-24'
76
+ iconBox
71
77
  )}
72
78
  >
73
79
  {icon}