feat: add shared infiplot workspace packages

Signed-off-by: baizhi958216 <1475289190@qq.com>
This commit is contained in:
baizhi958216
2026-06-30 00:44:36 +08:00
parent caca4369aa
commit e585bb2eed
17 changed files with 240 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
{
"name": "@infiplot/ui",
"version": "0.1.0",
"private": true,
"type": "module",
"exports": {
".": {
"react-native": "./src/index.native.tsx",
"types": "./src/index.ts",
"default": "./src/index.web.tsx"
}
},
"scripts": {
"typecheck": "tsc --noEmit"
},
"peerDependencies": {
"react": ">=19",
"react-native": ">=0.85"
},
"devDependencies": {
"@types/react": "~19.2.2",
"react-native": "0.85.3",
"typescript": "^6.0.3"
}
}
+2
View File
@@ -0,0 +1,2 @@
export type { SurfaceProps } from "./surface.types";
export { Surface } from "./surface.native";
+1
View File
@@ -0,0 +1 @@
export type { SurfaceProps } from "./surface.types";
+2
View File
@@ -0,0 +1,2 @@
export type { SurfaceProps } from "./surface.types";
export { Surface } from "./surface.web";
+16
View File
@@ -0,0 +1,16 @@
import { View } from "react-native";
import type { ViewStyle } from "react-native";
import type { SurfaceProps } from "./surface.types";
const styles: Record<NonNullable<SurfaceProps["tone"]>, ViewStyle> = {
default: {
backgroundColor: "#ffffff"
},
muted: {
backgroundColor: "#f4f6f8"
}
};
export function Surface({ children, tone = "default" }: SurfaceProps) {
return <View style={styles[tone]}>{children}</View>;
}
+6
View File
@@ -0,0 +1,6 @@
import type { ReactNode } from "react";
export interface SurfaceProps {
children: ReactNode;
tone?: "default" | "muted";
}
+17
View File
@@ -0,0 +1,17 @@
import type { CSSProperties } from "react";
import type { SurfaceProps } from "./surface.types";
const styles: Record<NonNullable<SurfaceProps["tone"]>, CSSProperties> = {
default: {
backgroundColor: "#ffffff",
color: "#111827"
},
muted: {
backgroundColor: "#f4f6f8",
color: "#111827"
}
};
export function Surface({ children, tone = "default" }: SurfaceProps) {
return <div style={styles[tone]}>{children}</div>;
}
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react-jsx",
"noEmit": true
},
"include": ["src/**/*.ts", "src/**/*.tsx"]
}