@vetc-miniapp/ui-react 0.0.23 → 0.0.25
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/README.md +375 -56
- package/dist/bridge.d.ts +11 -0
- package/dist/bridge.js +20 -0
- package/dist/components/app.d.ts +6 -0
- package/dist/components/app.js +34 -0
- package/dist/components/avatar/Avatar.d.ts +21 -0
- package/dist/components/avatar/Avatar.js +33 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/bottom-sheet/BottomSheet.d.ts +19 -0
- package/dist/components/bottom-sheet/BottomSheet.js +70 -0
- package/dist/components/bottom-sheet/index.d.ts +2 -0
- package/dist/components/bottom-sheet/index.js +1 -0
- package/dist/components/button/Button.d.ts +32 -0
- package/dist/components/button/Button.js +165 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/button-group/ButtonGroup.d.ts +28 -0
- package/dist/components/button-group/ButtonGroup.js +21 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/button-group/index.js +1 -0
- package/dist/components/card/Card.d.ts +18 -0
- package/dist/components/card/Card.js +35 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/checkbox/Checkbox.d.ts +41 -0
- package/dist/components/checkbox/Checkbox.js +94 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/chip/Chip.d.ts +24 -0
- package/dist/components/chip/Chip.js +83 -0
- package/dist/components/chip/index.d.ts +2 -0
- package/dist/components/chip/index.js +1 -0
- package/dist/components/dialog/Dialog.d.ts +19 -0
- package/dist/components/dialog/Dialog.js +51 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/index.js +1 -0
- package/dist/components/divider/Divider.d.ts +16 -0
- package/dist/components/divider/Divider.js +18 -0
- package/dist/components/divider/index.d.ts +2 -0
- package/dist/components/divider/index.js +1 -0
- package/dist/components/input/Input.d.ts +40 -0
- package/dist/components/input/Input.js +51 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +1 -0
- package/dist/components/list/List.d.ts +31 -0
- package/dist/components/list/List.js +72 -0
- package/dist/components/list/index.d.ts +2 -0
- package/dist/components/list/index.js +1 -0
- package/dist/components/loading/Loading.d.ts +28 -0
- package/dist/components/loading/Loading.js +33 -0
- package/dist/components/loading/index.d.ts +2 -0
- package/dist/components/loading/index.js +1 -0
- package/dist/components/modal/Modal.d.ts +38 -0
- package/dist/components/modal/Modal.js +50 -0
- package/dist/components/modal/index.d.ts +2 -0
- package/dist/components/modal/index.js +1 -0
- package/dist/components/navigation-bar/NavigationBar.d.ts +44 -0
- package/dist/components/navigation-bar/NavigationBar.js +70 -0
- package/dist/components/navigation-bar/index.d.ts +2 -0
- package/dist/components/navigation-bar/index.js +1 -0
- package/dist/components/radio/Radio.d.ts +40 -0
- package/dist/components/radio/Radio.js +88 -0
- package/dist/components/radio/index.d.ts +2 -0
- package/dist/components/radio/index.js +1 -0
- package/dist/components/select/Select.d.ts +29 -0
- package/dist/components/select/Select.js +30 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +1 -0
- package/dist/components/switch/Switch.d.ts +23 -0
- package/dist/components/switch/Switch.js +81 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +1 -0
- package/dist/components/tab-bar/TabBar.d.ts +28 -0
- package/dist/components/tab-bar/TabBar.js +60 -0
- package/dist/components/tab-bar/index.d.ts +2 -0
- package/dist/components/tab-bar/index.js +1 -0
- package/dist/components/textarea/Textarea.d.ts +31 -0
- package/dist/components/textarea/Textarea.js +33 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/index.js +1 -0
- package/dist/components/toast/Toast.d.ts +41 -0
- package/dist/components/toast/Toast.js +61 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/toast/index.js +1 -0
- package/dist/components/typography/Typography.d.ts +45 -0
- package/dist/components/typography/Typography.js +143 -0
- package/dist/components/typography/index.d.ts +2 -0
- package/dist/components/typography/index.js +1 -0
- package/dist/hooks/use-app-pause.d.ts +6 -0
- package/dist/hooks/use-app-pause.js +29 -0
- package/dist/hooks/use-app-resume.d.ts +6 -0
- package/dist/hooks/use-app-resume.js +28 -0
- package/{src/ui-react/hooks/use-app-state.ts → dist/hooks/use-app-state.d.ts} +0 -1
- package/dist/hooks/use-app-state.js +1 -0
- package/dist/hooks/use-did-hide.d.ts +6 -0
- package/dist/hooks/use-did-hide.js +21 -0
- package/dist/hooks/use-did-show.d.ts +6 -0
- package/dist/hooks/use-did-show.js +21 -0
- package/dist/hooks/use-listener-scan-qr.d.ts +21 -0
- package/dist/hooks/use-listener-scan-qr.js +29 -0
- package/dist/hooks/use-navigate.d.ts +8 -0
- package/dist/hooks/use-navigate.js +23 -0
- package/dist/hooks/use-tap-app-bar.d.ts +6 -0
- package/dist/hooks/use-tap-app-bar.js +21 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.js +41 -0
- package/dist/styles/VETCProvider.d.ts +114 -0
- package/dist/styles/VETCProvider.js +124 -0
- package/dist/styles/tokens.css +448 -0
- package/dist/tokens/colors.d.ts +127 -0
- package/dist/tokens/colors.js +75 -0
- package/dist/tokens/index.d.ts +3 -0
- package/dist/tokens/index.js +3 -0
- package/dist/tokens/spacing.d.ts +56 -0
- package/dist/tokens/spacing.js +56 -0
- package/dist/tokens/typography.d.ts +121 -0
- package/dist/tokens/typography.js +57 -0
- package/dist/types/app.d.ts +21 -0
- package/dist/types/app.js +1 -0
- package/package.json +26 -8
- package/src/dist/ui-react/index.js +0 -2
- package/src/dist/ui-react/index.js.LICENSE.txt +0 -11
- package/src/ui-react/bridge.js +0 -36
- package/src/ui-react/bridge.ts +0 -48
- package/src/ui-react/components/app.d.ts +0 -7
- package/src/ui-react/components/app.jsx +0 -80
- package/src/ui-react/components/app.tsx +0 -42
- package/src/ui-react/components/app1.js +0 -101
- package/src/ui-react/hooks/use-app-pause.js +0 -35
- package/src/ui-react/hooks/use-app-pause.ts +0 -33
- package/src/ui-react/hooks/use-app-resume.js +0 -37
- package/src/ui-react/hooks/use-app-resume.ts +0 -32
- package/src/ui-react/hooks/use-app-state.js +0 -35
- package/src/ui-react/hooks/use-did-hide.js +0 -25
- package/src/ui-react/hooks/use-did-hide.ts +0 -34
- package/src/ui-react/hooks/use-did-show.js +0 -26
- package/src/ui-react/hooks/use-did-show.ts +0 -34
- package/src/ui-react/hooks/use-listener-scan-qr.js +0 -33
- package/src/ui-react/hooks/use-listener-scan-qr.ts +0 -52
- package/src/ui-react/hooks/use-navigate.js +0 -15
- package/src/ui-react/hooks/use-navigate.ts +0 -41
- package/src/ui-react/index.js +0 -8
- package/src/ui-react/index.ts +0 -9
- package/src/ui-react/types/app.js +0 -30
- package/src/ui-react/types/app.ts +0 -32
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { callHost } from "../bridge";
|
|
2
|
-
|
|
3
|
-
/* ================= Types ================= */
|
|
4
|
-
|
|
5
|
-
export type NavigateMode = "push" | "replace";
|
|
6
|
-
|
|
7
|
-
export interface NavigateOptions {
|
|
8
|
-
replace?: boolean;
|
|
9
|
-
popTo?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type NavigateParams = Record<string, unknown>;
|
|
13
|
-
|
|
14
|
-
export type MiniAppRoute = string | number; // có thể đổi sang union type nếu muốn strict
|
|
15
|
-
|
|
16
|
-
/* ================= Hook ================= */
|
|
17
|
-
|
|
18
|
-
export function useNavigate() {
|
|
19
|
-
return (
|
|
20
|
-
route: MiniAppRoute,
|
|
21
|
-
params: NavigateParams = {},
|
|
22
|
-
options: NavigateOptions = {}
|
|
23
|
-
): void => {
|
|
24
|
-
// POP navigation
|
|
25
|
-
if (typeof route === "number") {
|
|
26
|
-
return callHost("navigate", {
|
|
27
|
-
type: "native",
|
|
28
|
-
action: "pop",
|
|
29
|
-
delta: Math.abs(route),
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
// Gửi sang native host
|
|
33
|
-
callHost("navigate", {
|
|
34
|
-
type: "native",
|
|
35
|
-
action: "push",
|
|
36
|
-
route,
|
|
37
|
-
params,
|
|
38
|
-
options,
|
|
39
|
-
}).catch(console.error);
|
|
40
|
-
};
|
|
41
|
-
}
|
package/src/ui-react/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from './hooks/use-app-pause.js';
|
|
2
|
-
export * from './hooks/use-app-resume.js';
|
|
3
|
-
export * from './hooks/use-did-show.js';
|
|
4
|
-
export * from './hooks/use-did-hide.js';
|
|
5
|
-
export * from './hooks/use-navigate.js';
|
|
6
|
-
export * from './hooks/use-app-state.js';
|
|
7
|
-
export * from './hooks/use-listener-scan-qr.js';
|
|
8
|
-
export * from './components/app.jsx';
|
package/src/ui-react/index.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from './hooks/use-app-resume';
|
|
2
|
-
export * from './hooks/use-app-pause';
|
|
3
|
-
export * from './hooks/use-did-show';
|
|
4
|
-
export * from './hooks/use-did-hide';
|
|
5
|
-
export * from './hooks/use-navigate';
|
|
6
|
-
export * from './hooks/use-app-state';
|
|
7
|
-
export * from './hooks/use-listener-scan-qr.ts';
|
|
8
|
-
// export * from './components/app';
|
|
9
|
-
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {"light" | "dark"} ThemeMode
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Trạng thái cấp App do Host cung cấp
|
|
7
|
-
* @typedef {Object} IAppState
|
|
8
|
-
* @property {string=} locale
|
|
9
|
-
* @property {ThemeMode=} theme
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Cấu hình 1 page trong MiniApp
|
|
14
|
-
* @typedef {Object} IPageConfig
|
|
15
|
-
* @property {string} key - Key định danh page dùng cho navigation
|
|
16
|
-
* @property {string=} title - Tên hiển thị (header native)
|
|
17
|
-
* @property {string} url - URL nội bộ của page (phục vụ render state)
|
|
18
|
-
* @property {boolean=} canGoBack - Có cho phép back không
|
|
19
|
-
* @property {boolean=} isRoot - Có phải root page không
|
|
20
|
-
* @property {Object<string, any>=} defaultParams - Params mặc định khi mở page
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Cấu hình tổng của MiniApp
|
|
25
|
-
* @typedef {IAppState & {
|
|
26
|
-
* pages: IPageConfig[]
|
|
27
|
-
* }} IAppConfig
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
export {}; // để file được coi là module
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export type IAppConfig = {
|
|
3
|
-
pages: IPageConfig[];
|
|
4
|
-
// darkMode?: IDarkModeConfig;
|
|
5
|
-
} & IAppState;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export type IAppState = {
|
|
9
|
-
locale?: string;
|
|
10
|
-
theme?: "light" | "dark";
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type IPageConfig = {
|
|
14
|
-
/** Key định danh page dùng cho navigation */
|
|
15
|
-
key: string;
|
|
16
|
-
|
|
17
|
-
/** Tên hiển thị (optional, dùng cho header native) */
|
|
18
|
-
title?: string;
|
|
19
|
-
|
|
20
|
-
page: React.ComponentType<any>
|
|
21
|
-
|
|
22
|
-
url: string;
|
|
23
|
-
|
|
24
|
-
/** Có cho phép back không */
|
|
25
|
-
canGoBack?: boolean;
|
|
26
|
-
|
|
27
|
-
/** Có phải root page không */
|
|
28
|
-
isRoot?: boolean;
|
|
29
|
-
|
|
30
|
-
/** Params mặc định khi mở page */
|
|
31
|
-
defaultParams?: Record<string, unknown>;
|
|
32
|
-
};
|