@moontra/moonui-pro 2.18.4 → 2.18.5

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/dist/index.mjs CHANGED
@@ -61684,7 +61684,8 @@ function useGitHubData({
61684
61684
  onMilestoneReached,
61685
61685
  milestones = [10, 50, 100, 500, 1e3, 5e3, 1e4],
61686
61686
  docsMode = false,
61687
- mockDataFallback = true
61687
+ mockDataFallback = true,
61688
+ forceMockData = false
61688
61689
  }) {
61689
61690
  const isDocsMode2 = docsMode || typeof window !== "undefined" && (window.location.pathname.includes("/docs/") || window.location.pathname.includes("/components/"));
61690
61691
  const effectiveAutoRefresh = isDocsMode2 ? false : autoRefresh;
@@ -61728,6 +61729,16 @@ function useGitHubData({
61728
61729
  });
61729
61730
  }, []);
61730
61731
  const fetchData = useCallback(async () => {
61732
+ if (forceMockData) {
61733
+ console.log("[Mock Mode] Using mock data");
61734
+ const mockData = getMockGitHubData(username, repository, repositories);
61735
+ setRepos(mockData);
61736
+ const calculatedStats = calculateStats(mockData);
61737
+ setStats(calculatedStats);
61738
+ setError(null);
61739
+ setLoading(false);
61740
+ return;
61741
+ }
61731
61742
  if (isDocsMode2 && hasInitialFetchedRef.current && docsDataCacheRef.current) {
61732
61743
  console.log("[Docs Mode] Returning cached data, skipping API request");
61733
61744
  setRepos(docsDataCacheRef.current);
@@ -61877,7 +61888,8 @@ function useGitHubData({
61877
61888
  onDataUpdate,
61878
61889
  onError,
61879
61890
  isDocsMode2,
61880
- mockDataFallback
61891
+ mockDataFallback,
61892
+ forceMockData
61881
61893
  ]);
61882
61894
  useEffect(() => {
61883
61895
  const hasValidInput = username && repository || username && repositories && repositories.length > 0 || repositories && repositories.length > 0 && repositories.every((r2) => r2.includes("/")) || username;
@@ -62498,6 +62510,7 @@ var GitHubStarsInternal = ({
62498
62510
  repository,
62499
62511
  repositories,
62500
62512
  token,
62513
+ useMockData = false,
62501
62514
  variant = "card",
62502
62515
  layout = "grid",
62503
62516
  showDescription = true,
@@ -62534,6 +62547,10 @@ var GitHubStarsInternal = ({
62534
62547
  size: size4 = "md",
62535
62548
  customColors
62536
62549
  }) => {
62550
+ const hasValidProps = useMockData || username || repositories && repositories.length > 0;
62551
+ if (!useMockData && !hasValidProps) {
62552
+ return null;
62553
+ }
62537
62554
  const isDocsMode2 = typeof window !== "undefined" && (window.location.pathname.includes("/docs/") || window.location.pathname.includes("/components/"));
62538
62555
  const effectiveAutoRefresh = isDocsMode2 ? false : autoRefresh;
62539
62556
  const effectiveNotifications = isDocsMode2 ? false : enableNotifications;
@@ -62576,8 +62593,10 @@ var GitHubStarsInternal = ({
62576
62593
  milestones,
62577
62594
  docsMode: isDocsMode2,
62578
62595
  // Docs mode flag'ini gönder
62579
- mockDataFallback: true
62596
+ mockDataFallback: true,
62580
62597
  // Docs modunda mock data kullan
62598
+ forceMockData: useMockData
62599
+ // Force mock data if true
62581
62600
  });
62582
62601
  const handleExport = t__default.useCallback((format7) => {
62583
62602
  if (!enableExport)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.18.4",
3
+ "version": "2.18.5",
4
4
  "description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
@@ -32,6 +32,7 @@ interface UseGitHubDataOptions {
32
32
  // Docs mode optimizasyonları için
33
33
  docsMode?: boolean
34
34
  mockDataFallback?: boolean
35
+ forceMockData?: boolean // Force mock data instead of API
35
36
  }
36
37
 
37
38
  export function useGitHubData({
@@ -49,6 +50,7 @@ export function useGitHubData({
49
50
  milestones = [10, 50, 100, 500, 1000, 5000, 10000],
50
51
  docsMode = false,
51
52
  mockDataFallback = true,
53
+ forceMockData = false,
52
54
  }: UseGitHubDataOptions) {
53
55
  // Docs mode tespiti
54
56
  const isDocsMode = docsMode || (typeof window !== "undefined" &&
@@ -107,6 +109,18 @@ export function useGitHubData({
107
109
  }, []) // Boş dependency array - fonksiyon asla yeniden oluşturulmaz
108
110
 
109
111
  const fetchData = useCallback(async () => {
112
+ // If forceMockData is true, always return mock data
113
+ if (forceMockData) {
114
+ console.log("[Mock Mode] Using mock data")
115
+ const mockData = getMockGitHubData(username, repository, repositories)
116
+ setRepos(mockData)
117
+ const calculatedStats = calculateStats(mockData)
118
+ setStats(calculatedStats)
119
+ setError(null)
120
+ setLoading(false)
121
+ return
122
+ }
123
+
110
124
  // Docs modunda ve daha önce fetch yapıldıysa, cache'den döndür
111
125
  if (isDocsMode && hasInitialFetchedRef.current && docsDataCacheRef.current) {
112
126
  console.log("[Docs Mode] Returning cached data, skipping API request")
@@ -299,6 +313,7 @@ export function useGitHubData({
299
313
  onError,
300
314
  isDocsMode,
301
315
  mockDataFallback,
316
+ forceMockData,
302
317
  ])
303
318
 
304
319
  // Initial fetch
@@ -24,6 +24,7 @@ const GitHubStarsInternal: React.FC<GitHubStarsProps> = ({
24
24
  repository,
25
25
  repositories,
26
26
  token,
27
+ useMockData = false,
27
28
  variant = "card",
28
29
  layout = "grid",
29
30
  showDescription = true,
@@ -61,6 +62,14 @@ const GitHubStarsInternal: React.FC<GitHubStarsProps> = ({
61
62
  customColors,
62
63
  }) => {
63
64
  // Docs mode tespiti
65
+ // Check if component has valid props to render
66
+ const hasValidProps = useMockData || username || (repositories && repositories.length > 0)
67
+
68
+ // If useMockData is false and no valid data props, don't render
69
+ if (!useMockData && !hasValidProps) {
70
+ return null
71
+ }
72
+
64
73
  const isDocsMode = typeof window !== "undefined" &&
65
74
  (window.location.pathname.includes("/docs/") ||
66
75
  window.location.pathname.includes("/components/"))
@@ -115,6 +124,7 @@ const GitHubStarsInternal: React.FC<GitHubStarsProps> = ({
115
124
  milestones,
116
125
  docsMode: isDocsMode, // Docs mode flag'ini gönder
117
126
  mockDataFallback: true, // Docs modunda mock data kullan
127
+ forceMockData: useMockData, // Force mock data if true
118
128
  })
119
129
 
120
130
  const handleExport = React.useCallback((format: "json" | "csv") => {
@@ -83,6 +83,7 @@ export interface GitHubStarsProps {
83
83
  repository?: string // For single repo mode
84
84
  repositories?: string[] // For multiple repos
85
85
  token?: string // GitHub token for higher rate limits
86
+ useMockData?: boolean // Force mock data instead of API requests
86
87
 
87
88
  // Display options
88
89
  variant?: DisplayVariant