@v-miniapp/ui-react 1.0.47 → 1.0.60

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 (254) hide show
  1. package/dist/components/app/app.d.ts +17 -0
  2. package/dist/components/app/bottom-tab-bar-layout/hook.d.ts +21 -0
  3. package/dist/components/app/bottom-tab-bar-layout/store.d.ts +13 -0
  4. package/dist/components/app/bottom-tab-bar-layout/type.d.ts +13 -0
  5. package/dist/components/app/data-theme.d.ts +8 -0
  6. package/dist/components/app/index.d.ts +9 -18
  7. package/dist/components/app/navigation-bar-layout/hook.d.ts +17 -0
  8. package/dist/components/app/navigation-bar-layout/store.d.ts +13 -0
  9. package/dist/components/app/navigation-bar-layout/type.d.ts +7 -0
  10. package/dist/components/app/page-layout/hook.d.ts +21 -0
  11. package/dist/components/app/page-layout/store.d.ts +13 -0
  12. package/dist/components/app/page-layout/type.d.ts +8 -0
  13. package/dist/components/app/type.d.ts +27 -0
  14. package/dist/components/calendar/default-render.d.ts +1 -1
  15. package/dist/components/calendar/utils.d.ts +1 -1
  16. package/dist/components/input-wrapper/input-wrapper.d.ts +2 -2
  17. package/dist/components/layout/page.d.ts +8 -1
  18. package/dist/external/index.js +11456 -8093
  19. package/dist/external/styles.css +1 -1
  20. package/dist/index.d.ts +4 -1
  21. package/dist/index.js +3787 -3991
  22. package/dist/styles.css +1 -1
  23. package/dist/utils/event-emitter.d.ts +4 -0
  24. package/dist-storybook/assets/App-CJxOxRXd.js +93 -0
  25. package/dist-storybook/assets/{Color-AVL7NMMY-OD8SQvXt.js → Color-AVL7NMMY-DwohVA43.js} +1 -1
  26. package/dist-storybook/assets/DEEPLINK-B5vUshJ4.js +33 -0
  27. package/dist-storybook/assets/{DocsRenderer-PQXLIZUC-D8kbgtPd.js → DocsRenderer-PQXLIZUC-vNsl3A7z.js} +2 -2
  28. package/dist-storybook/assets/EVENTS-DIl-sE2t.js +65 -0
  29. package/dist-storybook/assets/GETTING_STARTED-CR4dG_o7.js +62 -0
  30. package/dist-storybook/assets/GETTING_STARTED-CS2BpDsP.js +80 -0
  31. package/dist-storybook/assets/GETTING_STARTED-CtonLhRi.js +64 -0
  32. package/dist-storybook/assets/{INFINITE_SCROLL-O36i5W8i.js → INFINITE_SCROLL-BerukJIr.js} +1 -1
  33. package/dist-storybook/assets/LocalesProvider-CehS9yzW.js +53 -0
  34. package/dist-storybook/assets/MIGRATE_DARKMODE_TO_THEME-CRf-7Wcz.js +107 -0
  35. package/dist-storybook/assets/{MIGRATION_GUIDE-Dn2gFk5v.js → MIGRATION_GUIDE-CRIHuXpT.js} +3 -3
  36. package/dist-storybook/assets/OVERVIEW-DayETux4.js +51 -0
  37. package/dist-storybook/assets/Router-CGsO5Wd_.js +71 -0
  38. package/dist-storybook/assets/{TAILWIND_INTEGRATION-CVrohRXO.js → TAILWIND_INTEGRATION-RPvFP-GI.js} +1 -1
  39. package/dist-storybook/assets/THEME-C-pA_uq_.js +103 -0
  40. package/dist-storybook/assets/_baseClone-4nOrhHpR.js +1 -0
  41. package/dist-storybook/assets/alert-D3VdqAYm.js +1 -0
  42. package/dist-storybook/assets/{alert.stories-XyvS4WTm.js → alert.stories-CFBhdabd.js} +3 -3
  43. package/dist-storybook/assets/app-B__CxZQv.js +1 -0
  44. package/dist-storybook/assets/avatar-BVV1WSnD.js +1 -0
  45. package/dist-storybook/assets/{avatar.stories-glTjw5Kd.js → avatar.stories-D0RA2Mhh.js} +6 -6
  46. package/dist-storybook/assets/{axe-B8nlqekz.js → axe-Cj9fkEY9.js} +1 -1
  47. package/dist-storybook/assets/badge-DLt8CmDs.js +1 -0
  48. package/dist-storybook/assets/{badge.stories-CeNmmdtv.js → badge.stories-DhVKBE64.js} +3 -3
  49. package/dist-storybook/assets/{blocks-CpOj9FQ_.js → blocks-D4qvS4eZ.js} +3 -3
  50. package/dist-storybook/assets/{bottom-tab-bar-BsPd0FD7.js → bottom-tab-bar-UaYvPAic.js} +1 -1
  51. package/dist-storybook/assets/{bottom-tab-bar.stories-BG1ee2eN.js → bottom-tab-bar.stories--7Qh-68J.js} +3 -3
  52. package/dist-storybook/assets/button-CbLEqALK.js +1 -0
  53. package/dist-storybook/assets/{button.stories-3d_T0h_Z.js → button.stories-DgRH6oVV.js} +3 -3
  54. package/dist-storybook/assets/calendar-C7tiySn0.js +1 -0
  55. package/dist-storybook/assets/{calendar.stories-DEleEKoa.js → calendar.stories-B0K_T9ak.js} +3 -3
  56. package/dist-storybook/assets/carousel-C1nQGnJZ.js +37 -0
  57. package/dist-storybook/assets/{carousel.stories-DY9nDa3M.js → carousel.stories-C5d6yLzd.js} +3 -3
  58. package/dist-storybook/assets/checkbox-Bs8ghsWP.js +1 -0
  59. package/dist-storybook/assets/{checkbox.stories-BY8W9TRC.js → checkbox.stories-CG74gIlt.js} +3 -3
  60. package/dist-storybook/assets/chip-D4_ukvFv.js +1 -0
  61. package/dist-storybook/assets/{chip.stories-CXh30Tdq.js → chip.stories-D0908ZyT.js} +3 -3
  62. package/dist-storybook/assets/{date-Ci5dIit0.js → date-C1W0DfQy.js} +1 -1
  63. package/dist-storybook/assets/date-field-range-DSAQp9qR.js +1 -0
  64. package/dist-storybook/assets/date-field.stories-Dx6-qeWT.js +129 -0
  65. package/dist-storybook/assets/date-picker--PiU9sOL.js +1 -0
  66. package/dist-storybook/assets/{date-picker.stories-DUaL7sft.js → date-picker.stories-Bahq3f1W.js} +3 -3
  67. package/dist-storybook/assets/dialog-8K5u-kre.js +1 -0
  68. package/dist-storybook/assets/{dialog.stories-BtQMDA-1.js → dialog.stories-BxYc78Eo.js} +3 -3
  69. package/dist-storybook/assets/{chip-zY6gJxDk.js → dropdown-BeoO7m-R.js} +2 -2
  70. package/dist-storybook/assets/{dropdown.stories-DF69os0J.js → dropdown.stories-Bfhg63tZ.js} +3 -3
  71. package/dist-storybook/assets/{embla-carousel-react.esm-CCQjHA-d.js → embla-carousel-react.esm-Pp2OIUrN.js} +1 -1
  72. package/dist-storybook/assets/icon-CgGksgRS.js +1 -0
  73. package/dist-storybook/assets/{icon.stories-Ch36FMIn.js → icon.stories-qg8UAHBM.js} +3 -3
  74. package/dist-storybook/assets/iframe-BKfReaAn.css +1 -0
  75. package/dist-storybook/assets/{iframe-CLEfhyJc.js → iframe-C0PGuV5s.js} +42 -42
  76. package/dist-storybook/assets/image-BdsCB1je.js +9 -0
  77. package/dist-storybook/assets/{image.stories-CJPB43ys.js → image.stories-sQtCaoL2.js} +3 -3
  78. package/dist-storybook/assets/{index-CaMbLGUB.js → index-1AHvPexM.js} +1 -1
  79. package/dist-storybook/assets/index-BLzgbpm2.js +1 -0
  80. package/dist-storybook/assets/{index-DRIh_SUo.js → index-DWjPAWoJ.js} +1 -1
  81. package/dist-storybook/assets/{index-7xlKHfV2.js → index-SzFZQQjs.js} +1 -1
  82. package/dist-storybook/assets/input-wrapper-DkEl0Eih.js +1 -0
  83. package/dist-storybook/assets/{label-fI1oWVKU.js → label-CHVpMhb5.js} +1 -1
  84. package/dist-storybook/assets/{label.stories-C3xDUHd-.js → label.stories-CCtGPDrS.js} +3 -3
  85. package/dist-storybook/assets/{navigation-bar-CiGSH7u8.js → navigation-bar-TpF0DSXB.js} +2 -2
  86. package/dist-storybook/assets/{navigation-bar.stories-BvGp7uJf.js → navigation-bar.stories-CNXAxMYL.js} +3 -3
  87. package/dist-storybook/assets/number-field-CvCF5adO.js +1 -0
  88. package/dist-storybook/assets/{number-field.stories-B_Bj8RqE.js → number-field.stories-Dsb_eChm.js} +3 -3
  89. package/dist-storybook/assets/omit-D04qL5V_.js +1 -0
  90. package/dist-storybook/assets/option-item-Bmby544G.js +1 -0
  91. package/dist-storybook/assets/{option-item.stories-BjtolfPz.js → option-item.stories-ClUj8qVT.js} +3 -3
  92. package/dist-storybook/assets/pagination-MBP1YLhT.js +1 -0
  93. package/dist-storybook/assets/{pagination.stories-CrGsYeRw.js → pagination.stories-C9j6mE5z.js} +4 -4
  94. package/dist-storybook/assets/proxy-edvPwIiD.js +1 -0
  95. package/dist-storybook/assets/radio-DRPO7cjx.js +1 -0
  96. package/dist-storybook/assets/{radio.stories-BEG-zTwI.js → radio.stories-D8_YUTw1.js} +3 -3
  97. package/dist-storybook/assets/rating-CTv8C1tH.js +1 -0
  98. package/dist-storybook/assets/{rating.stories-Dwk8Ov3Q.js → rating.stories-BIftLeu2.js} +3 -3
  99. package/dist-storybook/assets/{react-18-4mLDkQmf.js → react-18-CacBUmwb.js} +1 -1
  100. package/dist-storybook/assets/{react-mAVd1wAc.js → react-zqqxT5R_.js} +1 -1
  101. package/dist-storybook/assets/search-field-CophTGGH.js +1 -0
  102. package/dist-storybook/assets/{search-field.stories-BnsT36yY.js → search-field.stories-D1okdN8e.js} +3 -3
  103. package/dist-storybook/assets/section-content-dVOJuOaN.js +1 -0
  104. package/dist-storybook/assets/{section.stories-B5IhLkbG.js → section.stories-Cq5CY978.js} +3 -3
  105. package/dist-storybook/assets/sheet-footer-BL2JAvmb.js +1 -0
  106. package/dist-storybook/assets/{sheet.stories-COzxyiqj.js → sheet.stories-DPcC0I5i.js} +3 -3
  107. package/dist-storybook/assets/skeleton-CmGRbWqE.js +1 -0
  108. package/dist-storybook/assets/{skeleton.stories-B71MlMyi.js → skeleton.stories-CD3J1XrJ.js} +3 -3
  109. package/dist-storybook/assets/{store-D2RudmNr.js → store-BmYgrUro.js} +5 -5
  110. package/dist-storybook/assets/switch-Cc-NvT4X.js +1 -0
  111. package/dist-storybook/assets/{switch.stories-DMBBwZef.js → switch.stories-C5SDbdGL.js} +3 -3
  112. package/dist-storybook/assets/{tab-bar-DZ3oOU50.js → tab-bar-DTyg7tFP.js} +1 -1
  113. package/dist-storybook/assets/{tab-bar.stories-Bp9w6nc3.js → tab-bar.stories-zKrihgXo.js} +3 -3
  114. package/dist-storybook/assets/text-area-WRb8Dkvn.js +1 -0
  115. package/dist-storybook/assets/{text-area.stories-BZ3HXtij.js → text-area.stories-3Z574UAD.js} +3 -3
  116. package/dist-storybook/assets/text-field-DrODy0yz.js +1 -0
  117. package/dist-storybook/assets/{text-field.stories-vSXYvs0U.js → text-field.stories-DzjpcKin.js} +3 -3
  118. package/dist-storybook/assets/toast-provider-ChNGFQlt.js +9 -0
  119. package/dist-storybook/assets/{toast.stories-DQKbk7dO.js → toast.stories-Zj4qfKO_.js} +1 -1
  120. package/dist-storybook/assets/tooltip-CrxOWTXS.js +1 -0
  121. package/dist-storybook/assets/{tooltip.stories-wuthZ3Sv.js → tooltip.stories-DEnYdL1d.js} +3 -3
  122. package/dist-storybook/assets/typography-BcLxefPi.js +1 -0
  123. package/dist-storybook/assets/{typography.stories-DD9HLY16.js → typography.stories-DWxFgTz3.js} +3 -3
  124. package/dist-storybook/assets/{uploader.stories-sModULvT.js → uploader.stories-DQN8yjt-.js} +3 -3
  125. package/dist-storybook/assets/use-app-pause-CyjeIEPG.js +21 -0
  126. package/dist-storybook/assets/use-app-resume-DntO6Rkm.js +21 -0
  127. package/dist-storybook/assets/use-bottom-tab-bar-Da7gjw6y.js +49 -0
  128. package/dist-storybook/assets/use-custom-icon-event-BEYPYrKY.js +26 -0
  129. package/dist-storybook/assets/use-did-hide-Do-KOSzV.js +30 -0
  130. package/dist-storybook/assets/use-did-show-Bv9k7DdG.js +30 -0
  131. package/dist-storybook/assets/use-histories-Ci1HfRe-.js +30 -0
  132. package/dist-storybook/assets/use-history-CkVE1jRy.js +33 -0
  133. package/dist-storybook/assets/use-language-Bg-LzpzQ.js +46 -0
  134. package/dist-storybook/assets/use-load-more-eaC8W6Cc.js +42 -0
  135. package/dist-storybook/assets/use-location-BMrQnhPi.js +39 -0
  136. package/dist-storybook/assets/use-navigate-BwwmhToy.js +36 -0
  137. package/dist-storybook/assets/use-navigation-bar-DzgWeTpM.js +42 -0
  138. package/dist-storybook/assets/use-navigation-type-DNvXTqYH.js +27 -0
  139. package/dist-storybook/assets/use-page-layout-BA2HvjAQ.js +37 -0
  140. package/dist-storybook/assets/use-page-scroll-D_gjlV-S.js +42 -0
  141. package/dist-storybook/assets/use-pull-to-refresh-SZfswIA6.js +38 -0
  142. package/dist-storybook/assets/use-settings-changed-D2gdx5rD.js +30 -0
  143. package/dist-storybook/assets/use-translate-BTC2AQ0k.js +59 -0
  144. package/dist-storybook/assets/{visibility-sensor-huP-8j4n.js → visibility-sensor-FN9n9CLs.js} +1 -1
  145. package/dist-storybook/iframe.html +2 -2
  146. package/dist-storybook/index.json +1 -1
  147. package/dist-storybook/project.json +1 -1
  148. package/dist-storybook/sb-addons/a11y-2/manager-bundle.js +2 -2
  149. package/dist-storybook/sb-addons/docs-1/manager-bundle.js +2 -2
  150. package/dist-storybook/sb-addons/storybook-build-3/manager-bundle.js +1 -1
  151. package/dist-storybook/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +4 -4
  152. package/dist-storybook/stories-data.json +152 -122
  153. package/package.json +3 -1
  154. package/dist/components/app/components/app.d.ts +0 -13
  155. package/dist/components/app/components/link.d.ts +0 -8
  156. package/dist/components/app/components/navigation-analytic.d.ts +0 -2
  157. package/dist/components/app/components/pages-render.d.ts +0 -2
  158. package/dist/components/app/context/location-key.d.ts +0 -4
  159. package/dist/components/app/hooks/use-app-pause.d.ts +0 -1
  160. package/dist/components/app/hooks/use-app-resume.d.ts +0 -1
  161. package/dist/components/app/hooks/use-app-state.d.ts +0 -7
  162. package/dist/components/app/hooks/use-bottom-tab-bar.d.ts +0 -13
  163. package/dist/components/app/hooks/use-did-hide.d.ts +0 -1
  164. package/dist/components/app/hooks/use-did-show.d.ts +0 -1
  165. package/dist/components/app/hooks/use-history.d.ts +0 -2
  166. package/dist/components/app/hooks/use-location.d.ts +0 -1
  167. package/dist/components/app/hooks/use-navigate.d.ts +0 -1
  168. package/dist/components/app/hooks/use-navigation-bar.d.ts +0 -12
  169. package/dist/components/app/hooks/use-navigation-type.d.ts +0 -1
  170. package/dist/components/app/hooks/use-page-config.d.ts +0 -1
  171. package/dist/components/app/hooks/use-page-layout.d.ts +0 -14
  172. package/dist/components/app/hooks/use-page-scroll.d.ts +0 -5
  173. package/dist/components/app/hooks/use-page-state.d.ts +0 -6
  174. package/dist/components/app/stores/app.d.ts +0 -24
  175. package/dist/components/app/stores/app.selector.d.ts +0 -11
  176. package/dist/components/app/types/app.d.ts +0 -65
  177. package/dist/components/app/types/navigation.d.ts +0 -30
  178. package/dist/components/app/utils/animation.d.ts +0 -2
  179. package/dist/components/app/utils/data-theme.d.ts +0 -4
  180. package/dist/components/app/utils/history.d.ts +0 -7
  181. package/dist/hooks/use-analytic.d.ts +0 -1
  182. package/dist/hooks/use-is-using-app.d.ts +0 -1
  183. package/dist/hooks/use-is-using-locales.d.ts +0 -1
  184. package/dist/locales/defaultResources/en.d.ts +0 -27
  185. package/dist/locales/defaultResources/vi.d.ts +0 -27
  186. package/dist/locales/fns.d.ts +0 -6
  187. package/dist/locales/hooks.d.ts +0 -9
  188. package/dist/locales/index.d.ts +0 -4
  189. package/dist/locales/provider.d.ts +0 -6
  190. package/dist/locales/store.d.ts +0 -13
  191. package/dist/locales/types.d.ts +0 -37
  192. package/dist/locales/utils.d.ts +0 -2
  193. package/dist-storybook/assets/ANIMATION-DLCDVwPI.js +0 -99
  194. package/dist-storybook/assets/APP_FRAMEWORK-B9Mrudgl.js +0 -197
  195. package/dist-storybook/assets/BOTTOM_TAB_BAR-Bgfy-nnv.js +0 -175
  196. package/dist-storybook/assets/CUSTOM_ERROR_BOUNDARY-G_i_6aho.js +0 -250
  197. package/dist-storybook/assets/GETTING_STARTED-Bf6ENjZo.js +0 -77
  198. package/dist-storybook/assets/KEEP_ALIVE-CicDtVw6.js +0 -126
  199. package/dist-storybook/assets/LOCALE-D_43J3RD.js +0 -465
  200. package/dist-storybook/assets/MOBILE_BEHAVIOURS-D5jOxNiz.js +0 -177
  201. package/dist-storybook/assets/PAGE_LAYOUT-C0sW9iZo.js +0 -192
  202. package/dist-storybook/assets/ROUTING_NAVIGATION-Bpj_mu5r.js +0 -335
  203. package/dist-storybook/assets/THEME_MODE-Sc8cgznR.js +0 -111
  204. package/dist-storybook/assets/_setToString-CjYxL0rS.js +0 -1
  205. package/dist-storybook/assets/alert-abKmNYys.js +0 -1
  206. package/dist-storybook/assets/avatar-B-jvPnzm.js +0 -1
  207. package/dist-storybook/assets/badge-Cc9u7jBX.js +0 -1
  208. package/dist-storybook/assets/button-GtWXUngt.js +0 -1
  209. package/dist-storybook/assets/calendar-CJ5_NxYx.js +0 -1
  210. package/dist-storybook/assets/carousel-sbzGq2WF.js +0 -37
  211. package/dist-storybook/assets/checkbox-CMpJJxvm.js +0 -1
  212. package/dist-storybook/assets/classname-DoNrELT0.js +0 -1
  213. package/dist-storybook/assets/date-field.stories-CerGwXZy.js +0 -129
  214. package/dist-storybook/assets/date-picker-BCIW_1-h.js +0 -1
  215. package/dist-storybook/assets/icon-TJ3FHxUI.js +0 -1
  216. package/dist-storybook/assets/iframe-yMKl6hJA.css +0 -1
  217. package/dist-storybook/assets/image-D6Yo4ht9.js +0 -9
  218. package/dist-storybook/assets/input-wrapper-D_9hAdHZ.js +0 -1
  219. package/dist-storybook/assets/number-field-DNj4myBV.js +0 -1
  220. package/dist-storybook/assets/omit-CStFhbPt.js +0 -1
  221. package/dist-storybook/assets/option-item-BloohEvW.js +0 -1
  222. package/dist-storybook/assets/pagination-Dcazh6R_.js +0 -1
  223. package/dist-storybook/assets/pick-DbIUGM9R.js +0 -1
  224. package/dist-storybook/assets/radio-t2E8E0Oc.js +0 -1
  225. package/dist-storybook/assets/rating-DsULci27.js +0 -1
  226. package/dist-storybook/assets/search-field-CuiHMy7j.js +0 -1
  227. package/dist-storybook/assets/section-content-pkGNuEs6.js +0 -1
  228. package/dist-storybook/assets/skeleton-Dn8rwbgX.js +0 -1
  229. package/dist-storybook/assets/store-DxAqU1JB.js +0 -1
  230. package/dist-storybook/assets/switch-BziC1t_8.js +0 -1
  231. package/dist-storybook/assets/text-area-CAmJ2yms.js +0 -1
  232. package/dist-storybook/assets/text-field-CjrgfYOZ.js +0 -1
  233. package/dist-storybook/assets/toast-provider-B9k1NBG6.js +0 -9
  234. package/dist-storybook/assets/tooltip-VnA8Hy0S.js +0 -1
  235. package/dist-storybook/assets/typography-DoV67nnS.js +0 -1
  236. package/dist-storybook/assets/use-app-pause-BQYQ2_kc.js +0 -29
  237. package/dist-storybook/assets/use-app-resume-BHDCAORn.js +0 -29
  238. package/dist-storybook/assets/use-custom-icon-event-BCGSFwaE.js +0 -29
  239. package/dist-storybook/assets/use-did-hide-Cosc0Bts.js +0 -48
  240. package/dist-storybook/assets/use-did-show-CTWe5NYk.js +0 -49
  241. package/dist-storybook/assets/use-histories-CAcE6nVz.js +0 -50
  242. package/dist-storybook/assets/use-history-FuEbPpap.js +0 -67
  243. package/dist-storybook/assets/use-location-CdUC1tic.js +0 -56
  244. package/dist-storybook/assets/use-navigate-DP9paY1K.js +0 -84
  245. package/dist-storybook/assets/use-navigation-type-BWVxMUtZ.js +0 -44
  246. package/dist-storybook/assets/use-page-config-5u8OF-8L.js +0 -48
  247. package/dist-storybook/assets/use-page-scroll-nPQcBn5B.js +0 -69
  248. package/dist-storybook/assets/use-page-state-CULl52gw.js +0 -79
  249. package/dist-storybook/assets/use-settings-changed-2GP5ZsJS.js +0 -29
  250. /package/dist/components/app/{components/bottom-tab-bar.d.ts → bottom-tab-bar-layout/index.d.ts} +0 -0
  251. /package/dist/components/app/{components/navigation-bar.d.ts → navigation-bar-layout/index.d.ts} +0 -0
  252. /package/dist/components/app/{components/page-layout.d.ts → page-layout/index.d.ts} +0 -0
  253. /package/dist/{components/app/hooks → hooks}/use-custom-icon-event.d.ts +0 -0
  254. /package/dist/{components/app/hooks → hooks}/use-settings-changed.d.ts +0 -0
@@ -1,175 +0,0 @@
1
- import{j as n}from"./iframe-CLEfhyJc.js";import{useMDXComponents as o}from"./index-7xlKHfV2.js";import{b as a,M as r}from"./blocks-CpOj9FQ_.js";import"./preload-helper-PPVm8Dsz.js";import"./index-CaMbLGUB.js";function i(e){const t={code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...o(),...e.components};return n.jsxs(n.Fragment,{children:[`
2
- `,`
3
- `,n.jsx(a,{title:"App Framework/Bottom Tab Bar"}),`
4
- `,n.jsx(t.h1,{id:"bottom-tab-bar",children:"Bottom Tab Bar"}),`
5
- `,n.jsx(t.p,{children:"Bottom Tab Bar config cho phép bạn cấu hình thanh điều hướng ở cuối màn hình với các tab items."}),`
6
- `,n.jsx(t.h2,{id:"cấu-trúc",children:"Cấu trúc"}),`
7
- `,n.jsx(t.pre,{children:n.jsx(t.code,{className:"language-typescript",children:`type IAppBottomTabBarState = Partial<
8
- Omit<IBottomTabBarProps, 'activeId' | 'items'>
9
- > & {
10
- items: Array<
11
- IBottomTabBarItem & { path: string; params?: Record<string, string> }
12
- >
13
- hidden?: boolean
14
- }
15
-
16
- type IBottomTabBarItem = {
17
- id: string
18
- name: string
19
- icon?: IIconProps | ReactNode
20
- activeIcon?: IIconProps | ReactNode
21
- }
22
- `})}),`
23
- `,n.jsx(t.h2,{id:"thuộc-tính",children:"Thuộc tính"}),`
24
- `,n.jsx(r,{children:"\n| Thuộc tính | Kiểu dữ liệu | Mặc định | Mô tả |\n| :--- | :--- | :--- | :--- |\n| `items` | <code>Array&lt;IBottomTabBarItem &amp; {<br/>&nbsp;&nbsp;path: string;<br/>&nbsp;&nbsp;params?: Record&lt;string, string&gt;<br/>}&gt;</code> | - | Mảng tab items (mỗi item có `id`, `name`, `path`) |\n| `hidden` | `boolean` | `false` | Không render bottom tab bar (không có trong DOM) |\n| `indicator` | `boolean` | `true` | Hiển thị indicator bar cho tab active |\n| `setCssVariable` | `boolean` | - | Set CSS variable `--vsf-bottom-tab-bar-height` |\n| `bgColor` | `IColor` | - | Màu nền của tab bar |\n| `color` | `IColor` | - | Màu text và icon cho các tab không active |\n| `activeColor` | `IColor` | - | Màu text và icon cho tab active |\n| `safeAreaBottomOffset` | `boolean` | `true` | Thêm safe area bottom inset padding |\n| `onItemClick` | `(item, index) => void` | - | Callback khi click vào tab item |\n| `className` | `string` | - | CSS class name tùy chỉnh |\n| `...props` | `ComponentProps<'div'>` | - | Tất cả props HTML div chuẩn |\n"}),`
25
- `,n.jsx(t.h2,{id:"cách-hoạt-động",children:"Cách hoạt động"}),`
26
- `,n.jsxs(t.ol,{children:[`
27
- `,n.jsxs(t.li,{children:[n.jsx(t.strong,{children:"Items với path"}),": Mỗi item trong ",n.jsx(t.code,{children:"items"})," phải có ",n.jsx(t.code,{children:"path"})," để navigate khi click"]}),`
28
- `,n.jsxs(t.li,{children:[n.jsx(t.strong,{children:"Page linking"}),": Page phải có ",n.jsx(t.code,{children:"bottomTabBarId"})," khớp với ",n.jsx(t.code,{children:"id"})," của item để bottom tab bar hiển thị"]}),`
29
- `,n.jsxs(t.li,{children:[n.jsx(t.strong,{children:"Active state"}),": Tab bar tự động highlight tab có ",n.jsx(t.code,{children:"id"})," khớp với ",n.jsx(t.code,{children:"bottomTabBarId"})," của page hiện tại"]}),`
30
- `,n.jsxs(t.li,{children:[n.jsx(t.strong,{children:"Navigation"}),": Khi click vào tab, sẽ navigate đến ",n.jsx(t.code,{children:"path"})," của item đó"]}),`
31
- `]}),`
32
- `,n.jsx(t.h2,{id:"cấu-hình",children:"Cấu hình"}),`
33
- `,n.jsx(t.h3,{id:"app-level-config",children:"App-level Config"}),`
34
- `,n.jsx(t.p,{children:"Cấu hình bottom tab bar mặc định:"}),`
35
- `,n.jsx(t.pre,{children:n.jsx(t.code,{className:"language-tsx",children:`import { HomeIcon, SettingsIcon } from '@ant-design/icons'
36
-
37
- const appConfig: IAppConfig = {
38
- bottomTabBar: {
39
- items: [
40
- {
41
- id: 'home',
42
- name: 'Trang chủ',
43
- icon: <HomeIcon />,
44
- path: '/home',
45
- },
46
- {
47
- id: 'settings',
48
- name: 'Cài đặt',
49
- icon: <SettingsIcon />,
50
- path: '/settings',
51
- },
52
- ],
53
- indicator: true,
54
- safeAreaBottomOffset: true,
55
- },
56
- pages: [
57
- {
58
- pathname: '/home',
59
- Component: HomePage,
60
- bottomTabBarId: 'home', // Link với bottom tab bar item
61
- },
62
- {
63
- pathname: '/settings',
64
- Component: SettingsPage,
65
- bottomTabBarId: 'settings',
66
- },
67
- ],
68
- }
69
- `})}),`
70
- `,n.jsx(t.h3,{id:"page-level-config",children:"Page-level Config"}),`
71
- `,n.jsx(t.p,{children:"Override bottom tab bar cho từng page:"}),`
72
- `,n.jsx(t.pre,{children:n.jsx(t.code,{className:"language-tsx",children:`const appConfig: IAppConfig = {
73
- bottomTabBar: {
74
- items: [
75
- { id: 'home', name: 'Home', path: '/home' },
76
- { id: 'settings', name: 'Settings', path: '/settings' },
77
- ],
78
- },
79
- pages: [
80
- {
81
- pathname: '/home',
82
- Component: HomePage,
83
- bottomTabBarId: 'home',
84
- // Override bottom tab bar cho page này
85
- bottomTabBar: {
86
- hidden: false,
87
- indicator: false, // Tắt indicator cho page này
88
- },
89
- },
90
- {
91
- pathname: '/settings',
92
- Component: SettingsPage,
93
- bottomTabBarId: 'settings',
94
- // Ẩn bottom tab bar cho page này
95
- bottomTabBar: {
96
- hidden: true,
97
- },
98
- },
99
- ],
100
- }
101
- `})}),`
102
- `,n.jsx(t.h2,{id:"ví-dụ-với-icons",children:"Ví dụ với Icons"}),`
103
- `,n.jsx(t.pre,{children:n.jsx(t.code,{className:"language-tsx",children:`import {
104
- HomeOutlined,
105
- HomeFilled,
106
- SettingOutlined,
107
- SettingFilled,
108
- } from '@ant-design/icons'
109
-
110
- const appConfig: IAppConfig = {
111
- bottomTabBar: {
112
- items: [
113
- {
114
- id: 'home',
115
- name: 'Trang chủ',
116
- icon: <HomeOutlined />, // Icon khi không active
117
- activeIcon: <HomeFilled />, // Icon khi active
118
- path: '/home',
119
- },
120
- {
121
- id: 'settings',
122
- name: 'Cài đặt',
123
- icon: <SettingOutlined />,
124
- activeIcon: <SettingFilled />,
125
- path: '/settings',
126
- },
127
- ],
128
- },
129
- pages: [
130
- {
131
- pathname: '/home',
132
- Component: HomePage,
133
- bottomTabBarId: 'home',
134
- },
135
- {
136
- pathname: '/settings',
137
- Component: SettingsPage,
138
- bottomTabBarId: 'settings',
139
- },
140
- ],
141
- }
142
- `})}),`
143
- `,n.jsx(t.h2,{id:"ví-dụ-với-styling",children:"Ví dụ với Styling"}),`
144
- `,n.jsx(t.pre,{children:n.jsx(t.code,{className:"language-tsx",children:`const appConfig: IAppConfig = {
145
- bottomTabBar: {
146
- items: [
147
- { id: 'home', name: 'Home', path: '/home' },
148
- { id: 'settings', name: 'Settings', path: '/settings' },
149
- ],
150
- bgColor: '#ffffff',
151
- color: '#666666',
152
- activeColor: '#1890ff',
153
- indicator: true,
154
- },
155
- pages: [
156
- // ...
157
- ],
158
- }
159
- `})}),`
160
- `,n.jsx(t.h2,{id:"lưu-ý",children:"Lưu ý"}),`
161
- `,n.jsxs(t.ul,{children:[`
162
- `,n.jsxs(t.li,{children:[n.jsxs(t.strong,{children:["Bottom tab bar chỉ hiển thị khi page có ",n.jsx(t.code,{children:"bottomTabBarId"})]}),": Nếu page không có ",n.jsx(t.code,{children:"bottomTabBarId"})," hoặc ",n.jsx(t.code,{children:"bottomTabBarId"})," không khớp với bất kỳ item nào, bottom tab bar sẽ không hiển thị"]}),`
163
- `,n.jsxs(t.li,{children:[n.jsx(t.strong,{children:"Path matching"}),": ",n.jsx(t.code,{children:"path"})," trong item phải khớp với ",n.jsx(t.code,{children:"pathname"})," của page để navigation hoạt động đúng"]}),`
164
- `,n.jsxs(t.li,{children:[n.jsx(t.strong,{children:"Params"}),": Bạn có thể thêm ",n.jsx(t.code,{children:"params"})," vào item để truyền query parameters khi navigate:",`
165
- `,n.jsx(t.pre,{children:n.jsx(t.code,{className:"language-tsx",children:`{
166
- id: 'detail',
167
- name: 'Detail',
168
- path: '/detail',
169
- params: { id: '123' }, // Navigate đến /detail?id=123
170
- }
171
- `})}),`
172
- `]}),`
173
- `,n.jsxs(t.li,{children:[n.jsx(t.strong,{children:"Hidden"}),": Khi ",n.jsx(t.code,{children:"hidden: true"}),", bottom tab bar sẽ không được render (không có trong DOM)"]}),`
174
- `,n.jsxs(t.li,{children:[n.jsx(t.strong,{children:"Safe Area"}),": ",n.jsx(t.code,{children:"safeAreaBottomOffset"})," tự động thêm padding cho safe area bottom (quan trọng trên iOS)"]}),`
175
- `]})]})}function l(e={}){const{wrapper:t}={...o(),...e.components};return t?n.jsx(t,{...e,children:n.jsx(i,{...e})}):i(e)}export{l as default};
@@ -1,250 +0,0 @@
1
- import{j as r}from"./iframe-CLEfhyJc.js";import{useMDXComponents as t}from"./index-7xlKHfV2.js";import{b as a}from"./blocks-CpOj9FQ_.js";import"./preload-helper-PPVm8Dsz.js";import"./index-CaMbLGUB.js";function e(o){const n={code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...t(),...o.components};return r.jsxs(r.Fragment,{children:[`
2
- `,`
3
- `,r.jsx(a,{title:"Use Cases/Custom Error Boundary"}),`
4
- `,r.jsx(n.h1,{id:"custom-error-boundary",children:"Custom Error Boundary"}),`
5
- `,r.jsx(n.p,{children:"App framework đã có sẵn ErrorBoundary global để catch tất cả lỗi, nhưng bạn có thể thêm ErrorBoundary riêng cho từng page thông qua Layouts để bắt lỗi trước và xử lý chi tiết hơn."}),`
6
- `,r.jsx(n.h2,{id:"tổng-quan",children:"Tổng quan"}),`
7
- `,r.jsxs(n.p,{children:["App component đã được bọc với ErrorBoundary global ở ngoài cùng để catch tất cả lỗi không được handle. Tuy nhiên, bạn có thể thêm ErrorBoundary riêng cho từng page thông qua ",r.jsx(n.code,{children:"Layouts"})," trong ",r.jsx(n.code,{children:"IPageConfig"})," để:"]}),`
8
- `,r.jsxs(n.ul,{children:[`
9
- `,r.jsxs(n.li,{children:[r.jsx(n.strong,{children:"Bắt lỗi trước"}),": ErrorBoundary ở page-level sẽ bắt lỗi trước ErrorBoundary global"]}),`
10
- `,r.jsxs(n.li,{children:[r.jsx(n.strong,{children:"Xử lý chi tiết"}),": Mỗi page có thể có error UI và logic xử lý lỗi riêng phù hợp với context"]}),`
11
- `,r.jsxs(n.li,{children:[r.jsx(n.strong,{children:"Isolate errors"}),": Lỗi ở một page không ảnh hưởng đến các pages khác"]}),`
12
- `,r.jsxs(n.li,{children:[r.jsx(n.strong,{children:"Better UX"}),": User có thể tiếp tục sử dụng các pages khác khi một page bị lỗi"]}),`
13
- `]}),`
14
- `,r.jsx(n.h2,{id:"errorboundary-global",children:"ErrorBoundary Global"}),`
15
- `,r.jsx(n.p,{children:"App component đã có ErrorBoundary global sẵn:"}),`
16
- `,r.jsx(n.pre,{children:r.jsx(n.code,{className:"language-tsx",children:`<ErrorBoundary isGlobal>{/* App content */}</ErrorBoundary>
17
- `})}),`
18
- `,r.jsx(n.p,{children:"ErrorBoundary global sẽ catch tất cả lỗi không được handle bởi các ErrorBoundary khác."}),`
19
- `,r.jsx(n.h2,{id:"thêm-errorboundary-cho-từng-page",children:"Thêm ErrorBoundary cho từng Page"}),`
20
- `,r.jsxs(n.p,{children:["Bạn có thể thêm ErrorBoundary riêng cho từng page thông qua ",r.jsx(n.code,{children:"Layouts"}),":"]}),`
21
- `,r.jsx(n.h3,{id:"bước-1-tạo-custom-error-boundary-layout",children:"Bước 1: Tạo Custom Error Boundary Layout"}),`
22
- `,r.jsx(n.p,{children:"Bạn có thể tự viết ErrorBoundary của riêng bạn:"}),`
23
- `,r.jsx(n.pre,{children:r.jsx(n.code,{className:"language-tsx",children:`import { Component } from 'react'
24
- import { FC, PropsWithChildren } from 'react'
25
-
26
- // Custom ErrorBoundary của riêng bạn
27
- class CustomErrorBoundary extends Component<
28
- PropsWithChildren,
29
- { hasError: boolean; error: Error | null }
30
- > {
31
- constructor(props: PropsWithChildren) {
32
- super(props)
33
- this.state = { hasError: false, error: null }
34
- }
35
-
36
- static getDerivedStateFromError(error: Error) {
37
- return { hasError: true, error }
38
- }
39
-
40
- componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
41
- // Log error to service
42
- console.error('Error caught:', error, errorInfo)
43
- }
44
-
45
- render() {
46
- if (this.state.hasError) {
47
- return (
48
- <div>
49
- <h1>Something went wrong</h1>
50
- <p>{this.state.error?.message}</p>
51
- </div>
52
- )
53
- }
54
-
55
- return this.props.children
56
- }
57
- }
58
-
59
- const PageErrorBoundary: FC<PropsWithChildren> = ({ children }) => {
60
- return <CustomErrorBoundary>{children}</CustomErrorBoundary>
61
- }
62
- `})}),`
63
- `,r.jsx(n.h3,{id:"bước-2-sử-dụng-trong-page-config",children:"Bước 2: Sử dụng trong Page Config"}),`
64
- `,r.jsx(n.pre,{children:r.jsx(n.code,{className:"language-tsx",children:`import { App, type IAppConfig } from '@v-miniapp/ui-react'
65
- import { PageErrorBoundary } from './layouts/PageErrorBoundary'
66
-
67
- const appConfig: IAppConfig = {
68
- pages: [
69
- {
70
- pathname: '/home',
71
- Component: HomePage,
72
- // Wrap page với ErrorBoundary riêng
73
- Layouts: [PageErrorBoundary],
74
- },
75
- {
76
- pathname: '/settings',
77
- Component: SettingsPage,
78
- // Page này không có ErrorBoundary riêng, sẽ dùng global
79
- },
80
- {
81
- pathname: '/detail',
82
- Component: DetailPage,
83
- // Có thể kết hợp với các layouts khác
84
- Layouts: [PageErrorBoundary, HeaderLayout],
85
- },
86
- ],
87
- }
88
-
89
- export function MiniApp() {
90
- return <App config={appConfig} />
91
- }
92
- `})}),`
93
- `,r.jsx(n.h2,{id:"thứ-tự-xử-lý-lỗi",children:"Thứ tự xử lý lỗi"}),`
94
- `,r.jsx(n.p,{children:"Khi có lỗi xảy ra, ErrorBoundary sẽ được gọi theo thứ tự từ trong ra ngoài:"}),`
95
- `,r.jsxs(n.ol,{children:[`
96
- `,r.jsxs(n.li,{children:[r.jsx(n.strong,{children:"Page-level ErrorBoundary"})," (nếu có trong Layouts) - Bắt lỗi trước"]}),`
97
- `,r.jsxs(n.li,{children:[r.jsx(n.strong,{children:"Global ErrorBoundary"})," (trong App component) - Bắt các lỗi còn lại"]}),`
98
- `]}),`
99
- `,r.jsx(n.p,{children:"Nếu page có ErrorBoundary riêng và nó catch được lỗi, Global ErrorBoundary sẽ không nhận được lỗi đó."}),`
100
- `,r.jsx(n.h2,{id:"ví-dụ-nâng-cao",children:"Ví dụ nâng cao"}),`
101
- `,r.jsx(n.h3,{id:"custom-error-ui-cho-từng-page",children:"Custom Error UI cho từng page"}),`
102
- `,r.jsx(n.p,{children:"Bạn có thể tạo các ErrorBoundary khác nhau với error UI và logic xử lý riêng. Có thể sử dụng ErrorBoundary có sẵn hoặc tự viết:"}),`
103
- `,r.jsx(n.pre,{children:r.jsx(n.code,{className:"language-tsx",children:`import { Component, type ReactNode } from 'react'
104
- import { FC, PropsWithChildren } from 'react'
105
-
106
- // ErrorBoundary với custom error UI cho home page
107
- class HomeErrorBoundary extends Component<
108
- PropsWithChildren,
109
- { hasError: boolean }
110
- > {
111
- constructor(props: PropsWithChildren) {
112
- super(props)
113
- this.state = { hasError: false }
114
- }
115
-
116
- static getDerivedStateFromError() {
117
- return { hasError: true }
118
- }
119
-
120
- render() {
121
- if (this.state.hasError) {
122
- return <div>Home page error occurred</div>
123
- }
124
- return this.props.children
125
- }
126
- }
127
-
128
- // ErrorBoundary với custom error UI cho settings page
129
- class SettingsErrorBoundary extends Component<
130
- PropsWithChildren,
131
- { hasError: boolean }
132
- > {
133
- constructor(props: PropsWithChildren) {
134
- super(props)
135
- this.state = { hasError: false }
136
- }
137
-
138
- static getDerivedStateFromError() {
139
- return { hasError: true }
140
- }
141
-
142
- render() {
143
- if (this.state.hasError) {
144
- return <div>Settings page error occurred</div>
145
- }
146
- return this.props.children
147
- }
148
- }
149
-
150
- const HomeErrorBoundaryWrapper: FC<PropsWithChildren> = ({ children }) => {
151
- return <HomeErrorBoundary>{children}</HomeErrorBoundary>
152
- }
153
-
154
- const SettingsErrorBoundaryWrapper: FC<PropsWithChildren> = ({ children }) => {
155
- return <SettingsErrorBoundary>{children}</SettingsErrorBoundary>
156
- }
157
-
158
- const appConfig: IAppConfig = {
159
- pages: [
160
- {
161
- pathname: '/home',
162
- Component: HomePage,
163
- Layouts: [HomeErrorBoundaryWrapper],
164
- },
165
- {
166
- pathname: '/settings',
167
- Component: SettingsPage,
168
- Layouts: [SettingsErrorBoundaryWrapper],
169
- },
170
- ],
171
- }
172
- `})}),`
173
- `,r.jsx(n.h3,{id:"kết-hợp-với-các-layouts-khác",children:"Kết hợp với các Layouts khác"}),`
174
- `,r.jsx(n.p,{children:"Bạn có thể kết hợp ErrorBoundary với các layouts khác. Thứ tự trong array sẽ quyết định thứ tự wrap:"}),`
175
- `,r.jsx(n.pre,{children:r.jsx(n.code,{className:"language-tsx",children:`import { Component } from 'react'
176
- import { FC, PropsWithChildren } from 'react'
177
-
178
- // Tự viết ErrorBoundary hoặc sử dụng từ @v-miniapp/ui-react
179
- class PageErrorBoundary extends Component<
180
- PropsWithChildren,
181
- { hasError: boolean }
182
- > {
183
- constructor(props: PropsWithChildren) {
184
- super(props)
185
- this.state = { hasError: false }
186
- }
187
-
188
- static getDerivedStateFromError() {
189
- return { hasError: true }
190
- }
191
-
192
- render() {
193
- if (this.state.hasError) {
194
- return <div>Page error occurred</div>
195
- }
196
- return this.props.children
197
- }
198
- }
199
-
200
- const PageErrorBoundaryWrapper: FC<PropsWithChildren> = ({ children }) => {
201
- return <PageErrorBoundary>{children}</PageErrorBoundary>
202
- }
203
-
204
- const HeaderLayout: FC<PropsWithChildren> = ({ children }) => {
205
- return (
206
- <div className="header-layout">
207
- <header>Header</header>
208
- {children}
209
- </div>
210
- )
211
- }
212
-
213
- const AuthLayout: FC<PropsWithChildren> = ({ children }) => {
214
- return <div className="auth-layout">{children}</div>
215
- }
216
-
217
- const appConfig: IAppConfig = {
218
- pages: [
219
- {
220
- pathname: '/home',
221
- Component: HomePage,
222
- // Thứ tự wrap: AuthLayout → HeaderLayout → PageErrorBoundaryWrapper → HomePage
223
- Layouts: [AuthLayout, HeaderLayout, PageErrorBoundaryWrapper],
224
- },
225
- ],
226
- }
227
- `})}),`
228
- `,r.jsxs(n.p,{children:[r.jsx(n.strong,{children:"Lưu ý:"})," Phần tử ",r.jsx(n.strong,{children:"cuối cùng"})," trong array sẽ wrap ở ",r.jsx(n.strong,{children:"trong cùng"})," (gần Component nhất). Với ",r.jsx(n.code,{children:"Layouts: [AuthLayout, HeaderLayout, PageErrorBoundaryWrapper]"}),", kết quả render sẽ là:"]}),`
229
- `,r.jsx(n.pre,{children:r.jsx(n.code,{className:"language-tsx",children:`<AuthLayout>
230
- <HeaderLayout>
231
- <PageErrorBoundaryWrapper>
232
- <HomePage />
233
- </PageErrorBoundaryWrapper>
234
- </HeaderLayout>
235
- </AuthLayout>
236
- `})}),`
237
- `,r.jsx(n.h2,{id:"lưu-ý-quan-trọng",children:"Lưu ý quan trọng"}),`
238
- `,r.jsxs(n.ul,{children:[`
239
- `,r.jsxs(n.li,{children:[r.jsx(n.strong,{children:"Wrap từng màn hình"}),": Layouts phải wrap từng page riêng biệt, không hỗ trợ nested routes hoặc group layout cho nhiều pages. Mỗi page cần wrap ErrorBoundary riêng nếu muốn xử lý lỗi độc lập."]}),`
240
- `,r.jsxs(n.li,{children:[r.jsx(n.strong,{children:"Không group Layout"}),": Không thể định nghĩa Layouts ở app-level để áp dụng cho nhiều pages. Layouts chỉ có thể được khai báo trong ",r.jsx(n.code,{children:"IPageConfig"})," của từng page."]}),`
241
- `,r.jsxs(n.li,{children:[r.jsx(n.strong,{children:"ErrorBoundary scope"}),": ErrorBoundary trong Layouts chỉ catch lỗi của page component và các component con của nó, không catch lỗi của các pages khác."]}),`
242
- `,r.jsxs(n.li,{children:[r.jsx(n.strong,{children:"Bắt lỗi trước"}),": Page-level ErrorBoundary sẽ bắt lỗi trước Global ErrorBoundary, cho phép bạn xử lý lỗi chi tiết hơn cho từng page."]}),`
243
- `]}),`
244
- `,r.jsx(n.h2,{id:"best-practices",children:"Best Practices"}),`
245
- `,r.jsxs(n.ol,{children:[`
246
- `,r.jsxs(n.li,{children:[r.jsx(n.strong,{children:"Chỉ bọc page cần thiết"}),": Không cần bọc ErrorBoundary cho tất cả pages, chỉ bọc những page có logic phức tạp hoặc cần xử lý lỗi riêng"]}),`
247
- `,r.jsxs(n.li,{children:[r.jsx(n.strong,{children:"Đặt ErrorBoundary ở trong cùng"}),": Nếu kết hợp với các layouts khác, thường nên đặt ErrorBoundary ở trong cùng (cuối array) để chỉ catch lỗi của page component"]}),`
248
- `,r.jsxs(n.li,{children:[r.jsx(n.strong,{children:"Custom error UI"}),": Tùy chỉnh error UI phù hợp với context của từng page để có UX tốt hơn"]}),`
249
- `,r.jsxs(n.li,{children:[r.jsx(n.strong,{children:"Error logging"}),": Có thể thêm error logging trong ErrorBoundary để track lỗi"]}),`
250
- `]})]})}function l(o={}){const{wrapper:n}={...t(),...o.components};return n?r.jsx(n,{...o,children:r.jsx(e,{...o})}):e(o)}export{l as default};
@@ -1,77 +0,0 @@
1
- import{j as n}from"./iframe-CLEfhyJc.js";import{useMDXComponents as c}from"./index-7xlKHfV2.js";import{b as a}from"./blocks-CpOj9FQ_.js";import"./preload-helper-PPVm8Dsz.js";import"./index-CaMbLGUB.js";function t(e){const i={code:"code",h1:"h1",h2:"h2",h3:"h3",p:"p",pre:"pre",strong:"strong",...c(),...e.components};return n.jsxs(n.Fragment,{children:[`
2
- `,`
3
- `,n.jsx(a,{title:"Getting Started",parameters:{options:{nav:{icon:""}}}}),`
4
- `,n.jsx(i.h1,{id:"getting-started-với-v-miniappui-react",children:"Getting Started với @v-miniapp/ui-react"}),`
5
- `,n.jsxs(i.p,{children:[n.jsx(i.strong,{children:"@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."]}),`
6
- `,n.jsx(i.h2,{id:"cài-đặt",children:"Cài đặt"}),`
7
- `,n.jsx(i.pre,{children:n.jsx(i.code,{className:"language-bash",children:`npm install @v-miniapp/ui-react
8
- # hoặc
9
- pnpm add @v-miniapp/ui-react
10
- # hoặc
11
- yarn add @v-miniapp/ui-react
12
- `})}),`
13
- `,n.jsx(i.h2,{id:"import-styles",children:"Import Styles"}),`
14
- `,n.jsx(i.h3,{id:"option-1-sử-dụng-css-chuẩn",children:"Option 1: Sử dụng CSS chuẩn"}),`
15
- `,n.jsx(i.p,{children:"Đảm bảo bạn import CSS từ phía component để UI hoạt động tốt nhất:"}),`
16
- `,n.jsx(i.pre,{children:n.jsx(i.code,{className:"language-tsx",children:`import '@v-miniapp/ui-react/styles.css'
17
- `})}),`
18
- `,n.jsx(i.h3,{id:"option-2-tích-hợp-với-tailwind-css",children:"Option 2: Tích hợp với Tailwind CSS"}),`
19
- `,n.jsx(i.p,{children:"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:"}),`
20
- `,n.jsx(i.pre,{children:n.jsx(i.code,{className:"language-css",children:`/* tailwind.css hoặc file CSS chính của bạn */
21
- @import '@v-miniapp/ui-react/tailwind';
22
- `})}),`
23
- `,n.jsxs(i.p,{children:[n.jsx(i.strong,{children:"Lưu ý:"})," Khi tích hợp với Tailwind, bạn không cần import ",n.jsx(i.code,{children:"@v-miniapp/ui-react/styles.css"})," nữa."]}),`
24
- `,n.jsx(i.h2,{id:"ví-dụ-bắt-đầu-sử-dụng",children:"Ví dụ bắt đầu sử dụng"}),`
25
- `,n.jsx(i.pre,{children:n.jsx(i.code,{className:"language-tsx",children:`import { App, type IAppConfig } from '@v-miniapp/ui-react'
26
-
27
- // Tạo các page components
28
- const HomePage = () => {
29
- return <div>Trang chủ</div>
30
- }
31
-
32
- const SettingsPage = () => {
33
- return <div>Cài đặt</div>
34
- }
35
-
36
- const appConfig: IAppConfig = {
37
- // Animation giữa các pages: 'none', 'slide_up', 'slide_left', 'fade_in'
38
- animation: {
39
- type: 'slide_left',
40
- },
41
- // Keep-alive: giữ state của pages khi navigate
42
- keepAlive: {
43
- enable: true,
44
- },
45
-
46
- pages: [
47
- {
48
- pathname: '/home',
49
- Component: HomePage,
50
- navigationBar: {
51
- title: 'Trang chủ',
52
- },
53
- },
54
- {
55
- pathname: '/settings',
56
- Component: SettingsPage,
57
- navigationBar: {
58
- title: 'Cài đặt',
59
- },
60
- },
61
- ],
62
- }
63
-
64
- export const MiniApp: FC = () => {
65
- return <App config={appConfig} />
66
- }
67
- `})}),`
68
- `,n.jsx(i.h2,{id:"️-lưu-ý-quan-trọng",children:"⚠️ Lưu ý quan trọng"}),`
69
- `,n.jsxs(i.p,{children:["Khi sử dụng component ",n.jsx(i.code,{children:"App"})," từ ",n.jsx(i.code,{children:"@v-miniapp/ui-react"}),", bạn đã có sẵn ",n.jsx(i.code,{children:"NavigationBar"})," component được quản lý bởi SDK. Nếu bạn cấu hình ",n.jsx(i.code,{children:"window"})," trong ",n.jsx(i.code,{children:"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 ",n.jsx(i.code,{children:"ui-react"}),"."]}),`
70
- `,n.jsxs(i.p,{children:[n.jsx(i.strong,{children:"Giải pháp:"})," Nếu bạn sử dụng ",n.jsx(i.code,{children:"NavigationBar"})," từ ",n.jsx(i.code,{children:"@v-miniapp/ui-react"}),", bạn nên cấu hình trong ",n.jsx(i.code,{children:"app-config.json"})," để ẩn native title bar:"]}),`
71
- `,n.jsx(i.pre,{children:n.jsx(i.code,{className:"language-json",children:`{
72
- "window": {
73
- "defaultTitle": "",
74
- "transparentTitle": "always"
75
- }
76
- }
77
- `})})]})}function h(e={}){const{wrapper:i}={...c(),...e.components};return i?n.jsx(i,{...e,children:n.jsx(t,{...e})}):t(e)}export{h as default};
@@ -1,126 +0,0 @@
1
- import{j as e}from"./iframe-CLEfhyJc.js";import{useMDXComponents as a}from"./index-7xlKHfV2.js";import{b as l,M as t}from"./blocks-CpOj9FQ_.js";import"./preload-helper-PPVm8Dsz.js";import"./index-CaMbLGUB.js";function r(i){const n={code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...a(),...i.components};return e.jsxs(e.Fragment,{children:[`
2
- `,`
3
- `,e.jsx(l,{title:"App Framework/Keep Alive"}),`
4
- `,e.jsx(n.h1,{id:"keep-alive",children:"Keep Alive"}),`
5
- `,e.jsx(n.p,{children:"Keep Alive cho phép giữ các pages trong DOM (ẩn) thay vì unmount khi navigate, giúp giữ state và scroll position."}),`
6
- `,e.jsx(n.h2,{id:"cấu-trúc",children:"Cấu trúc"}),`
7
- `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-typescript",children:`type IAppKeepAliveState = {
8
- enable?: boolean
9
- maxStack?: number
10
- freeze?: boolean
11
- freezeDelay?: number
12
- }
13
-
14
- // Page-level có thể override bằng boolean hoặc config object
15
- type IPageState = {
16
- keepAlive?: boolean | IAppKeepAliveState
17
- freeze?: boolean
18
- freezeDelay?: number
19
- }
20
- `})}),`
21
- `,e.jsx(n.h2,{id:"thuộc-tính",children:"Thuộc tính"}),`
22
- `,e.jsx(t,{children:"\n| Thuộc tính | Kiểu dữ liệu | Mặc định | Mô tả |\n| :--- | :--- | :--- | :--- |\n| `enable` | `boolean` | `true` | Bật/tắt keep-alive |\n| `maxStack` | `number` | `5` | Số lượng pages tối đa được giữ trong DOM |\n| `freeze` | `boolean` | `true` | Bật/tắt freeze (ngăn re-render cho pages không hiển thị) |\n| `freezeDelay` | `number` | `3000` | Delay (ms) trước khi freeze page sau khi navigate đi |\n"}),`
23
- `,e.jsx(n.h2,{id:"cách-hoạt-động",children:"Cách hoạt động"}),`
24
- `,e.jsxs(n.ol,{children:[`
25
- `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Khi navigate đi"}),": Page được ẩn (",e.jsx(n.code,{children:"display: none"}),") nhưng vẫn trong DOM"]}),`
26
- `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Khi navigate đến"}),": Page được hiển thị (",e.jsx(n.code,{children:"display: block"}),")"]}),`
27
- `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Freeze"}),": Các pages không hiển thị được freeze bằng ",e.jsx(n.code,{children:"Freeze"})," component để tránh re-render. Freeze được áp dụng sau ",e.jsx(n.code,{children:"freezeDelay"})," (mặc định: 3000ms) để cho phép animation hoàn thành."]}),`
28
- `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Giới hạn"}),": Chỉ giữ tối đa ",e.jsx(n.code,{children:"maxStack"})," pages trong DOM"]}),`
29
- `]}),`
30
- `,e.jsx(n.h2,{id:"cấu-hình",children:"Cấu hình"}),`
31
- `,e.jsx(n.h3,{id:"app-level-config",children:"App-level Config"}),`
32
- `,e.jsx(n.p,{children:"Cấu hình keep-alive mặc định cho tất cả pages:"}),`
33
- `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`const appConfig: IAppConfig = {
34
- keepAlive: {
35
- enable: true, // Bật keep-alive
36
- maxStack: 5, // Giữ tối đa 5 pages
37
- freeze: true, // Bật freeze để tránh re-render
38
- freezeDelay: 3000, // Freeze sau 3 giây
39
- },
40
- pages: [
41
- // Tất cả pages sẽ được keep-alive
42
- ],
43
- }
44
- `})}),`
45
- `,e.jsx(n.h3,{id:"page-level-config",children:"Page-level Config"}),`
46
- `,e.jsx(n.p,{children:"Override keep-alive cho từng page cụ thể:"}),`
47
- `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`const appConfig: IAppConfig = {
48
- keepAlive: {
49
- enable: true,
50
- maxStack: 5,
51
- },
52
- pages: [
53
- {
54
- pathname: '/home',
55
- Component: HomePage,
56
- // Page này dùng app-level config (keep-alive enabled)
57
- },
58
- {
59
- pathname: '/login',
60
- Component: LoginPage,
61
- // Tắt keep-alive cho page này
62
- keepAlive: false,
63
- },
64
- {
65
- pathname: '/detail',
66
- Component: DetailPage,
67
- // Override config cho page này
68
- keepAlive: {
69
- enable: true,
70
- maxStack: 3, // Giữ ít hơn pages khác
71
- },
72
- // Tắt freeze cho page này (vẫn keep-alive nhưng không freeze)
73
- freeze: false,
74
- },
75
- {
76
- pathname: '/video',
77
- Component: VideoPage,
78
- keepAlive: true,
79
- // Freeze ngay lập tức (không delay)
80
- freeze: true,
81
- freezeDelay: 0,
82
- },
83
- ],
84
- }
85
- `})}),`
86
- `,e.jsx(n.h2,{id:"lợi-ích",children:"Lợi ích"}),`
87
- `,e.jsxs(n.ul,{children:[`
88
- `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Giữ state"}),": Component state không bị mất khi navigate"]}),`
89
- `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Giữ scroll position"}),": Scroll position được giữ nguyên (kết hợp với ",e.jsx(n.code,{children:"scrollRestoration"}),")"]}),`
90
- `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Form data"}),": Form data không bị mất khi navigate back"]}),`
91
- `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Performance"}),": Không cần re-render khi navigate back/forward"]}),`
92
- `]}),`
93
- `,e.jsx(n.h2,{id:"lưu-ý",children:"Lưu ý"}),`
94
- `,e.jsxs(n.ul,{children:[`
95
- `,e.jsx(n.li,{children:"Pages được giữ trong DOM nên vẫn tốn memory"}),`
96
- `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"maxStack"})," giới hạn số pages để tránh tốn quá nhiều memory"]}),`
97
- `,e.jsx(n.li,{children:"Chỉ pages trong stack (theo thứ tự) mới được keep-alive"}),`
98
- `,e.jsxs(n.li,{children:["Pages ngoài ",e.jsx(n.code,{children:"maxStack"})," sẽ bị unmount"]}),`
99
- `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Freeze"}),": Khi ",e.jsx(n.code,{children:"freeze: true"}),", pages không hiển thị sẽ bị freeze để tránh re-render, giúp tiết kiệm performance"]}),`
100
- `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Freeze Delay"}),": ",e.jsx(n.code,{children:"freezeDelay"})," cho phép animation hoàn thành trước khi freeze. Nếu set ",e.jsx(n.code,{children:"0"}),", page sẽ freeze ngay lập tức"]}),`
101
- `]}),`
102
- `,e.jsx(n.h2,{id:"ví-dụ",children:"Ví dụ"}),`
103
- `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`const appConfig: IAppConfig = {
104
- keepAlive: {
105
- enable: true,
106
- maxStack: 5,
107
- },
108
- pages: [
109
- {
110
- pathname: '/home',
111
- Component: HomePage,
112
- // Keep-alive enabled
113
- },
114
- {
115
- pathname: '/list',
116
- Component: ListPage,
117
- // Keep-alive enabled, giữ scroll position khi back
118
- },
119
- {
120
- pathname: '/login',
121
- Component: LoginPage,
122
- keepAlive: false, // Tắt keep-alive, reset mỗi lần vào
123
- },
124
- ],
125
- }
126
- `})})]})}function g(i={}){const{wrapper:n}={...a(),...i.components};return n?e.jsx(n,{...i,children:e.jsx(r,{...i})}):r(i)}export{g as default};