@v-miniapp/ui-react 1.0.37

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.
Files changed (2) hide show
  1. package/README.md +98 -0
  2. package/package.json +95 -0
package/README.md ADDED
@@ -0,0 +1,98 @@
1
+ # @v-miniapp/ui-react
2
+
3
+ **@v-miniapp/ui-react** là bộ thư viện component React mạnh mẽ được thiết kế đặc biệt cho việc phát triển V-MiniApp. SDK này cung cấp đầy đủ các component UI, routing, theme management và các tính năng native app như pull-to-refresh, swipe navigation, page stacking với keep-alive.
4
+
5
+ 📚 **Tài liệu chính thức**: [Components | V-MiniApp](https://developer.v-app.vn/components/overview)
6
+
7
+ ## Cài đặt
8
+
9
+ ```bash
10
+ npm install @v-miniapp/ui-react
11
+ # hoặc
12
+ pnpm add @v-miniapp/ui-react
13
+ # hoặc
14
+ yarn add @v-miniapp/ui-react
15
+ ```
16
+
17
+ ## Import Styles
18
+
19
+ ### Option 1: Sử dụng CSS chuẩn
20
+
21
+ Đảm bảo bạn import CSS từ phía component để UI hoạt động tốt nhất:
22
+
23
+ ```tsx
24
+ import '@v-miniapp/ui-react/styles.css'
25
+ ```
26
+
27
+ ### Option 2: Tích hợp với Tailwind CSS
28
+
29
+ Nếu mini app của bạn đang sử dụng Tailwind CSS, bạn có thể tích hợp dễ dàng bằng cách thêm một dòng import vào file Tailwind config:
30
+
31
+ ```css
32
+ /* tailwind.css hoặc file CSS chính của bạn */
33
+ @import '@v-miniapp/ui-react/tailwind';
34
+ ```
35
+
36
+ **Lưu ý:** Khi tích hợp với Tailwind, bạn không cần import `@v-miniapp/ui-react/styles.css` nữa.
37
+
38
+ ## Ví dụ bắt đầu sử dụng
39
+
40
+ ```tsx
41
+ import { App, type IAppConfig } from '@v-miniapp/ui-react'
42
+
43
+ // Tạo các page components
44
+ const HomePage = () => {
45
+ return <div>Trang chủ</div>
46
+ }
47
+
48
+ const SettingsPage = () => {
49
+ return <div>Cài đặt</div>
50
+ }
51
+
52
+ const appConfig: IAppConfig = {
53
+ // Animation giữa các pages: 'none', 'slide_up', 'slide_left', 'fade_in'
54
+ animation: {
55
+ type: 'slide_left',
56
+ },
57
+ // Keep-alive: giữ state của pages khi navigate
58
+ keepAlive: {
59
+ enable: true,
60
+ },
61
+
62
+ pages: [
63
+ {
64
+ pathname: '/home',
65
+ Component: HomePage,
66
+ navigationBar: {
67
+ title: 'Trang chủ',
68
+ },
69
+ },
70
+ {
71
+ pathname: '/settings',
72
+ Component: SettingsPage,
73
+ navigationBar: {
74
+ title: 'Cài đặt',
75
+ },
76
+ },
77
+ ],
78
+ }
79
+
80
+ export const MiniApp = () => {
81
+ return <App config={appConfig} />
82
+ }
83
+ ```
84
+
85
+ ## ⚠️ Lưu ý quan trọng
86
+
87
+ Khi sử dụng component `App` từ `@v-miniapp/ui-react`, bạn đã có sẵn `NavigationBar` component được quản lý bởi SDK. Nếu bạn cấu hình `window` trong `app-config.json` để hiển thị title bar/navigation bar từ native, sẽ có thể bị trùng lặp với component của `ui-react`.
88
+
89
+ **Giải pháp:** Nếu bạn sử dụng `NavigationBar` từ `@v-miniapp/ui-react`, bạn nên cấu hình trong `app-config.json` để ẩn native title bar:
90
+
91
+ ```json
92
+ {
93
+ "window": {
94
+ "defaultTitle": "",
95
+ "transparentTitle": "always"
96
+ }
97
+ }
98
+ ```
package/package.json ADDED
@@ -0,0 +1,95 @@
1
+ {
2
+ "name": "@v-miniapp/ui-react",
3
+ "version": "1.0.37",
4
+ "type": "module",
5
+ "files": [
6
+ "dist",
7
+ "dist-preview"
8
+ ],
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "style": "./dist/styles.css"
15
+ },
16
+ "./*": "./dist/*",
17
+ "./tailwind": "./dist/tailwind/styles.css"
18
+ },
19
+ "scripts": {
20
+ "dev:example": "vite --config vite.config.example.ts",
21
+ "dev:example:showcase": "vite --config vite.config.example.showcase.ts",
22
+ "build:lib": "pnpm run build:lib:local && pnpm run build:lib:external",
23
+ "build:lib:local": "tsc -p tsconfig.lib.json && vite build --config vite.config.lib.local.ts",
24
+ "build:lib:external": "tsc -p tsconfig.lib.json && vite build --config vite.config.lib.external.ts",
25
+ "build:example": "tsc -p tsconfig.example.json && vite build --config vite.config.example.ts",
26
+ "build:example:showcase": "tsc -p tsconfig.example.json && vite build --config vite.config.example.showcase.ts",
27
+ "lint": "eslint .",
28
+ "preview": "vite preview",
29
+ "storybook": "storybook dev -p 6006",
30
+ "build:storybook": "storybook build -o dist-storybook -c .storybook/build && node scripts/clean-storybook.js",
31
+ "generate-colors": "./scripts/generate-colors.js",
32
+ "generate-icons": "./scripts/generate-icons.js"
33
+ },
34
+ "dependencies": {
35
+ "@types/lodash": "^4.17.23",
36
+ "@use-gesture/react": "^10.3.1",
37
+ "ahooks": "^3.9.6",
38
+ "classnames": "^2.5.1",
39
+ "dayjs": "^1.11.19",
40
+ "embla-carousel": "^8.6.0",
41
+ "embla-carousel-auto-height": "^8.6.0",
42
+ "embla-carousel-autoplay": "^8.6.0",
43
+ "embla-carousel-react": "^8.6.0",
44
+ "framer-motion": "^12.23.24",
45
+ "lodash": "^4.17.23",
46
+ "motion": "^12.23.24",
47
+ "mustache": "^4.2.0",
48
+ "nanoid": "^5.1.6",
49
+ "react-freeze": "^1.0.4",
50
+ "serve-handler": "^6.1.6",
51
+ "zustand": "^5.0.9"
52
+ },
53
+ "peerDependencies": {
54
+ "react": ">=19.0.0",
55
+ "react-dom": ">=19.0.0"
56
+ },
57
+ "devDependencies": {
58
+ "@eslint/js": "^9.33.0",
59
+ "@storybook/addon-a11y": "^9.1.5",
60
+ "@storybook/addon-docs": "^9.1.5",
61
+ "@storybook/addon-vitest": "^9.1.5",
62
+ "@storybook/react-vite": "^9.1.5",
63
+ "@types/inputmask": "^5.0.7",
64
+ "@types/mustache": "^4.2.6",
65
+ "@types/node": "^24.3.3",
66
+ "@types/react": "19.2.3",
67
+ "@types/react-dom": "^19.2.3",
68
+ "@types/react-is": "^19.0.0",
69
+ "@types/use-sync-external-store": "^1.5.0",
70
+ "@vitejs/plugin-react-swc": "^4.0.0",
71
+ "@vitest/browser": "^3.2.4",
72
+ "@vitest/coverage-v8": "^3.2.4",
73
+ "eslint": "^9.33.0",
74
+ "eslint-config-prettier": "^10.1.8",
75
+ "eslint-plugin-react-hooks": "^5.2.0",
76
+ "eslint-plugin-react-refresh": "^0.4.20",
77
+ "eslint-plugin-storybook": "^9.1.5",
78
+ "globals": "^16.3.0",
79
+ "playwright": "^1.55.0",
80
+ "sass": "^1.92.1",
81
+ "storybook": "^9.1.17",
82
+ "typescript": "~5.8.3",
83
+ "typescript-eslint": "^8.39.1",
84
+ "vite": "^7.1.2",
85
+ "vite-plugin-dts": "^4.5.4",
86
+ "vite-plugin-eslint": "^1.8.1",
87
+ "vite-plugin-static-copy": "^3.1.4",
88
+ "vite-plugin-svgr": "^4.5.0",
89
+ "vitest": "^3.2.4"
90
+ },
91
+ "engines": {
92
+ "node": ">=22"
93
+ },
94
+ "packageManager": "pnpm@10.16.0"
95
+ }