@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.
Files changed (146) hide show
  1. package/README.md +375 -56
  2. package/dist/bridge.d.ts +11 -0
  3. package/dist/bridge.js +20 -0
  4. package/dist/components/app.d.ts +6 -0
  5. package/dist/components/app.js +34 -0
  6. package/dist/components/avatar/Avatar.d.ts +21 -0
  7. package/dist/components/avatar/Avatar.js +33 -0
  8. package/dist/components/avatar/index.d.ts +2 -0
  9. package/dist/components/avatar/index.js +1 -0
  10. package/dist/components/bottom-sheet/BottomSheet.d.ts +19 -0
  11. package/dist/components/bottom-sheet/BottomSheet.js +70 -0
  12. package/dist/components/bottom-sheet/index.d.ts +2 -0
  13. package/dist/components/bottom-sheet/index.js +1 -0
  14. package/dist/components/button/Button.d.ts +32 -0
  15. package/dist/components/button/Button.js +165 -0
  16. package/dist/components/button/index.d.ts +2 -0
  17. package/dist/components/button/index.js +1 -0
  18. package/dist/components/button-group/ButtonGroup.d.ts +28 -0
  19. package/dist/components/button-group/ButtonGroup.js +21 -0
  20. package/dist/components/button-group/index.d.ts +2 -0
  21. package/dist/components/button-group/index.js +1 -0
  22. package/dist/components/card/Card.d.ts +18 -0
  23. package/dist/components/card/Card.js +35 -0
  24. package/dist/components/card/index.d.ts +2 -0
  25. package/dist/components/card/index.js +1 -0
  26. package/dist/components/checkbox/Checkbox.d.ts +41 -0
  27. package/dist/components/checkbox/Checkbox.js +94 -0
  28. package/dist/components/checkbox/index.d.ts +2 -0
  29. package/dist/components/checkbox/index.js +1 -0
  30. package/dist/components/chip/Chip.d.ts +24 -0
  31. package/dist/components/chip/Chip.js +83 -0
  32. package/dist/components/chip/index.d.ts +2 -0
  33. package/dist/components/chip/index.js +1 -0
  34. package/dist/components/dialog/Dialog.d.ts +19 -0
  35. package/dist/components/dialog/Dialog.js +51 -0
  36. package/dist/components/dialog/index.d.ts +2 -0
  37. package/dist/components/dialog/index.js +1 -0
  38. package/dist/components/divider/Divider.d.ts +16 -0
  39. package/dist/components/divider/Divider.js +18 -0
  40. package/dist/components/divider/index.d.ts +2 -0
  41. package/dist/components/divider/index.js +1 -0
  42. package/dist/components/input/Input.d.ts +40 -0
  43. package/dist/components/input/Input.js +51 -0
  44. package/dist/components/input/index.d.ts +2 -0
  45. package/dist/components/input/index.js +1 -0
  46. package/dist/components/list/List.d.ts +31 -0
  47. package/dist/components/list/List.js +72 -0
  48. package/dist/components/list/index.d.ts +2 -0
  49. package/dist/components/list/index.js +1 -0
  50. package/dist/components/loading/Loading.d.ts +28 -0
  51. package/dist/components/loading/Loading.js +33 -0
  52. package/dist/components/loading/index.d.ts +2 -0
  53. package/dist/components/loading/index.js +1 -0
  54. package/dist/components/modal/Modal.d.ts +38 -0
  55. package/dist/components/modal/Modal.js +50 -0
  56. package/dist/components/modal/index.d.ts +2 -0
  57. package/dist/components/modal/index.js +1 -0
  58. package/dist/components/navigation-bar/NavigationBar.d.ts +44 -0
  59. package/dist/components/navigation-bar/NavigationBar.js +70 -0
  60. package/dist/components/navigation-bar/index.d.ts +2 -0
  61. package/dist/components/navigation-bar/index.js +1 -0
  62. package/dist/components/radio/Radio.d.ts +40 -0
  63. package/dist/components/radio/Radio.js +88 -0
  64. package/dist/components/radio/index.d.ts +2 -0
  65. package/dist/components/radio/index.js +1 -0
  66. package/dist/components/select/Select.d.ts +29 -0
  67. package/dist/components/select/Select.js +30 -0
  68. package/dist/components/select/index.d.ts +2 -0
  69. package/dist/components/select/index.js +1 -0
  70. package/dist/components/switch/Switch.d.ts +23 -0
  71. package/dist/components/switch/Switch.js +81 -0
  72. package/dist/components/switch/index.d.ts +2 -0
  73. package/dist/components/switch/index.js +1 -0
  74. package/dist/components/tab-bar/TabBar.d.ts +28 -0
  75. package/dist/components/tab-bar/TabBar.js +60 -0
  76. package/dist/components/tab-bar/index.d.ts +2 -0
  77. package/dist/components/tab-bar/index.js +1 -0
  78. package/dist/components/textarea/Textarea.d.ts +31 -0
  79. package/dist/components/textarea/Textarea.js +33 -0
  80. package/dist/components/textarea/index.d.ts +2 -0
  81. package/dist/components/textarea/index.js +1 -0
  82. package/dist/components/toast/Toast.d.ts +41 -0
  83. package/dist/components/toast/Toast.js +61 -0
  84. package/dist/components/toast/index.d.ts +2 -0
  85. package/dist/components/toast/index.js +1 -0
  86. package/dist/components/typography/Typography.d.ts +45 -0
  87. package/dist/components/typography/Typography.js +143 -0
  88. package/dist/components/typography/index.d.ts +2 -0
  89. package/dist/components/typography/index.js +1 -0
  90. package/dist/hooks/use-app-pause.d.ts +6 -0
  91. package/dist/hooks/use-app-pause.js +29 -0
  92. package/dist/hooks/use-app-resume.d.ts +6 -0
  93. package/dist/hooks/use-app-resume.js +28 -0
  94. package/{src/ui-react/hooks/use-app-state.ts → dist/hooks/use-app-state.d.ts} +0 -1
  95. package/dist/hooks/use-app-state.js +1 -0
  96. package/dist/hooks/use-did-hide.d.ts +6 -0
  97. package/dist/hooks/use-did-hide.js +21 -0
  98. package/dist/hooks/use-did-show.d.ts +6 -0
  99. package/dist/hooks/use-did-show.js +21 -0
  100. package/dist/hooks/use-listener-scan-qr.d.ts +21 -0
  101. package/dist/hooks/use-listener-scan-qr.js +29 -0
  102. package/dist/hooks/use-navigate.d.ts +8 -0
  103. package/dist/hooks/use-navigate.js +23 -0
  104. package/dist/hooks/use-tap-app-bar.d.ts +6 -0
  105. package/dist/hooks/use-tap-app-bar.js +21 -0
  106. package/dist/index.d.ts +56 -0
  107. package/dist/index.js +41 -0
  108. package/dist/styles/VETCProvider.d.ts +114 -0
  109. package/dist/styles/VETCProvider.js +124 -0
  110. package/dist/styles/tokens.css +448 -0
  111. package/dist/tokens/colors.d.ts +127 -0
  112. package/dist/tokens/colors.js +75 -0
  113. package/dist/tokens/index.d.ts +3 -0
  114. package/dist/tokens/index.js +3 -0
  115. package/dist/tokens/spacing.d.ts +56 -0
  116. package/dist/tokens/spacing.js +56 -0
  117. package/dist/tokens/typography.d.ts +121 -0
  118. package/dist/tokens/typography.js +57 -0
  119. package/dist/types/app.d.ts +21 -0
  120. package/dist/types/app.js +1 -0
  121. package/package.json +26 -8
  122. package/src/dist/ui-react/index.js +0 -2
  123. package/src/dist/ui-react/index.js.LICENSE.txt +0 -11
  124. package/src/ui-react/bridge.js +0 -36
  125. package/src/ui-react/bridge.ts +0 -48
  126. package/src/ui-react/components/app.d.ts +0 -7
  127. package/src/ui-react/components/app.jsx +0 -80
  128. package/src/ui-react/components/app.tsx +0 -42
  129. package/src/ui-react/components/app1.js +0 -101
  130. package/src/ui-react/hooks/use-app-pause.js +0 -35
  131. package/src/ui-react/hooks/use-app-pause.ts +0 -33
  132. package/src/ui-react/hooks/use-app-resume.js +0 -37
  133. package/src/ui-react/hooks/use-app-resume.ts +0 -32
  134. package/src/ui-react/hooks/use-app-state.js +0 -35
  135. package/src/ui-react/hooks/use-did-hide.js +0 -25
  136. package/src/ui-react/hooks/use-did-hide.ts +0 -34
  137. package/src/ui-react/hooks/use-did-show.js +0 -26
  138. package/src/ui-react/hooks/use-did-show.ts +0 -34
  139. package/src/ui-react/hooks/use-listener-scan-qr.js +0 -33
  140. package/src/ui-react/hooks/use-listener-scan-qr.ts +0 -52
  141. package/src/ui-react/hooks/use-navigate.js +0 -15
  142. package/src/ui-react/hooks/use-navigate.ts +0 -41
  143. package/src/ui-react/index.js +0 -8
  144. package/src/ui-react/index.ts +0 -9
  145. package/src/ui-react/types/app.js +0 -30
  146. 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
- }
@@ -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';
@@ -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
- };