@windrun-huaiin/base-ui 4.1.0 → 5.0.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": "@windrun-huaiin/base-ui",
3
- "version": "4.1.0",
3
+ "version": "5.0.0",
4
4
  "description": "Base UI components for windrun-huaiin projects",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -26,11 +26,6 @@
26
26
  "import": "./dist/components/client/index.mjs",
27
27
  "require": "./dist/components/client/index.js"
28
28
  },
29
- "./lib/*": {
30
- "types": "./dist/lib/*.d.ts",
31
- "import": "./dist/lib/*.mjs",
32
- "require": "./dist/lib/*.js"
33
- },
34
29
  "./src/*": "./src/*",
35
30
  "./styles/base-ui.css": "./dist/base-ui.css"
36
31
  },
@@ -48,11 +43,11 @@
48
43
  "@radix-ui/react-slot": "^1.2.2",
49
44
  "class-variance-authority": "^0.7.1",
50
45
  "lucide-react": "^0.511.0",
51
- "@windrun-huaiin/lib": "^4.0.0"
46
+ "@windrun-huaiin/lib": "^5.0.0"
52
47
  },
53
48
  "peerDependencies": {
54
- "react": "19.2.0-canary-3fbfb9ba-20250409",
55
- "react-dom": "19.2.0-canary-3fbfb9ba-20250409",
49
+ "react": "19.1.0",
50
+ "react-dom": "19.1.0",
56
51
  "next": "15.3.2",
57
52
  "next-intl": "^3.26.5",
58
53
  "next-themes": "^0.4.6",
@@ -1,10 +1,13 @@
1
1
  'use client';
2
2
 
3
3
  import { NotFoundIcon } from "@base-ui/components/global-icon";
4
- import { SiteIcon } from "@base-ui/lib/site-icon";
5
- import { useEffect, useState } from "react";
4
+ import { useEffect, useState, type ReactNode } from "react";
6
5
 
7
- export function NotFoundPage() {
6
+ interface NotFoundPageProps {
7
+ siteIcon: ReactNode;
8
+ }
9
+
10
+ export function NotFoundPage({ siteIcon }: NotFoundPageProps) {
8
11
  const [glitchText, setGlitchText] = useState("404");
9
12
 
10
13
  // glitch effect
@@ -62,7 +65,7 @@ export function NotFoundPage() {
62
65
  {/* decorative elements */}
63
66
  <div className="flex justify-center items-center gap-8 pt-8 opacity-60">
64
67
  <div className="flex items-center gap-2 text-sm text-muted-foreground">
65
- <SiteIcon />
68
+ {siteIcon}
66
69
  <span>Woops!</span>
67
70
  </div>
68
71
  <div className="w-1 h-1 bg-purple-500 rounded-full animate-ping" />
@@ -12,4 +12,5 @@ export * from '../language-switcher';
12
12
 
13
13
  // Script Components (All Client-side)
14
14
  export * from '../script/google-analytics-script';
15
- export * from '../script/microsoft-clarity-script';
15
+ export * from '../script/microsoft-clarity-script';
16
+
@@ -12,6 +12,8 @@
12
12
 
13
13
  // Main server/universal components
14
14
  export * from './global-icon';
15
+ // Icon Configuration
16
+ export { createSiteIcon } from './site-icon';
15
17
 
16
18
  // For client components, please use:
17
19
  // import { ... } from '@base-ui/components/client'
@@ -0,0 +1,38 @@
1
+ import { type LucideProps } from 'lucide-react';
2
+ import { cn } from '@lib/utils';
3
+ import { globalLucideIcons } from '@base-ui/components/global-icon';
4
+ import { themeIconColor } from '@base-ui/lib/theme-util';
5
+
6
+ /**
7
+ * Create a SiteIcon component with specific configuration
8
+ * This function helps avoid React multi-instance issues by creating the icon component
9
+ * at the application level with explicit configuration
10
+ */
11
+ export function createSiteIcon(iconConfig: string | React.ComponentType<LucideProps>) {
12
+ return function CreatedSiteIcon({
13
+ size = 24,
14
+ className,
15
+ ...props
16
+ }: Omit<LucideProps, 'children'>) {
17
+ // render the icon, pass in the config value and attributes
18
+ if (typeof iconConfig === 'string') {
19
+ // string type: the key name of globalLucideIcons
20
+ if (iconConfig === '') {
21
+ // empty string use default icon
22
+ const DefaultIcon = globalLucideIcons['Download' as keyof typeof globalLucideIcons];
23
+ return <DefaultIcon size={size} className={cn(themeIconColor, className)} {...props} />;
24
+ }
25
+ const IconComponent = globalLucideIcons[iconConfig as keyof typeof globalLucideIcons];
26
+ if (!IconComponent) {
27
+ throw new Error(`[CreatedSiteIcon] Icon key "${iconConfig}" not found in globalLucideIcons.`);
28
+ }
29
+ return <IconComponent size={size} className={cn(themeIconColor, className)} {...props} />;
30
+ } else {
31
+ // React component type: custom icon component
32
+ const CustomIcon = iconConfig as React.ComponentType<LucideProps>;
33
+ const hasColorClass = className && /text-\w+/.test(className);
34
+ const finalClassName = hasColorClass ? className : cn(themeIconColor, className);
35
+ return <CustomIcon size={size} className={finalClassName} {...props} />;
36
+ }
37
+ };
38
+ }
package/src/index.ts CHANGED
@@ -2,6 +2,4 @@
2
2
  // ⚠️ IMPORTANT: Client components are NOT exported here to avoid server component contamination
3
3
  // For client components, use: import { ... } from '@base-ui/components/client'
4
4
 
5
- export * from './ui';
6
- export * from './components'; // Only server/universal components
7
- export * from './lib';
5
+ export * from './components'; // Only server/universal components
@@ -1,24 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ComponentType, ReactNode } from 'react';
3
- import { LucideProps } from 'lucide-react';
4
-
5
- interface IconConfig {
6
- siteIcon?: ComponentType | string;
7
- }
8
- interface IconConfigProviderProps {
9
- config: IconConfig;
10
- children: ReactNode;
11
- }
12
- /**
13
- * IconConfigProvider - icon config provider based on React Context
14
- * directly store the config value, without depending on module state
15
- */
16
- declare function IconConfigProvider({ config, children }: IconConfigProviderProps): react_jsx_runtime.JSX.Element;
17
-
18
- /**
19
- * site icon component - client component
20
- * based on React Context to get the config, solve the problem of cross-package module instance isolation
21
- */
22
- declare function SiteIcon({ size, className, ...props }: Omit<LucideProps, 'children'>): react_jsx_runtime.JSX.Element;
23
-
24
- export { type IconConfig, IconConfigProvider, SiteIcon };
@@ -1,24 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ComponentType, ReactNode } from 'react';
3
- import { LucideProps } from 'lucide-react';
4
-
5
- interface IconConfig {
6
- siteIcon?: ComponentType | string;
7
- }
8
- interface IconConfigProviderProps {
9
- config: IconConfig;
10
- children: ReactNode;
11
- }
12
- /**
13
- * IconConfigProvider - icon config provider based on React Context
14
- * directly store the config value, without depending on module state
15
- */
16
- declare function IconConfigProvider({ config, children }: IconConfigProviderProps): react_jsx_runtime.JSX.Element;
17
-
18
- /**
19
- * site icon component - client component
20
- * based on React Context to get the config, solve the problem of cross-package module instance isolation
21
- */
22
- declare function SiteIcon({ size, className, ...props }: Omit<LucideProps, 'children'>): react_jsx_runtime.JSX.Element;
23
-
24
- export { type IconConfig, IconConfigProvider, SiteIcon };