@bifrostui/react 2.0.0-alpha.0 → 2.0.0-alpha.10

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 (565) hide show
  1. package/dist/Alert/Alert.js +2 -1
  2. package/dist/Alert/__tests__/fixtures/A11yDemos.d.ts +17 -0
  3. package/dist/Alert/__tests__/fixtures/A11yDemos.js +143 -0
  4. package/dist/Alert/index.css +4 -4
  5. package/dist/Avatar/AvatarGroup.css +8 -8
  6. package/dist/Avatar/index.css +8 -8
  7. package/dist/Backdrop/Backdrop.js +3 -2
  8. package/dist/Backdrop/Backdrop.types.d.ts +4 -0
  9. package/dist/Backdrop/__tests__/fixtures/A11yDemos.d.ts +8 -0
  10. package/dist/Backdrop/__tests__/fixtures/A11yDemos.js +51 -0
  11. package/dist/Backdrop/index.css +2 -2
  12. package/dist/Badge/Badge.js +38 -11
  13. package/dist/Badge/Badge.types.d.ts +30 -1
  14. package/dist/Badge/__tests__/fixtures/A11yDemos.d.ts +25 -0
  15. package/dist/Badge/__tests__/fixtures/A11yDemos.js +110 -0
  16. package/dist/Badge/hooks/useBadgeA11y.d.ts +23 -0
  17. package/dist/Badge/hooks/useBadgeA11y.js +76 -0
  18. package/dist/Badge/hooks/useBadgeDisplay.d.ts +16 -0
  19. package/dist/Badge/hooks/useBadgeDisplay.js +56 -0
  20. package/dist/Button/Button.js +2 -1
  21. package/dist/Button/__tests__/fixtures/A11yDemos.d.ts +23 -0
  22. package/dist/Button/__tests__/fixtures/A11yDemos.js +81 -0
  23. package/dist/Button/index.css +4 -5
  24. package/dist/CSSTransition/CSSTransition.d.ts +4 -0
  25. package/dist/CSSTransition/CSSTransition.js +177 -0
  26. package/dist/CSSTransition/CSSTransition.types.d.ts +13 -0
  27. package/dist/CSSTransition/CSSTransition.types.js +15 -0
  28. package/dist/CSSTransition/demo/CSSTransitionDemo.d.ts +4 -0
  29. package/dist/CSSTransition/demo/CSSTransitionDemo.js +76 -0
  30. package/dist/CSSTransition/demo/index.css +25 -0
  31. package/dist/CSSTransition/index.d.ts +2 -0
  32. package/dist/CSSTransition/index.js +41 -0
  33. package/dist/Calendar/Calendar.js +131 -34
  34. package/dist/Calendar/Calendar.types.d.ts +16 -1
  35. package/dist/Calendar/__tests__/fixtures/A11yDemos.d.ts +2 -0
  36. package/dist/Calendar/__tests__/fixtures/A11yDemos.js +41 -0
  37. package/dist/Calendar/index.css +52 -9
  38. package/dist/Calendar/utils.d.ts +7 -3
  39. package/dist/Calendar/utils.js +33 -23
  40. package/dist/Checkbox/Checkbox.js +5 -4
  41. package/dist/Checkbox/__tests__/fixtures/A11yDemos.d.ts +15 -0
  42. package/dist/Checkbox/__tests__/fixtures/A11yDemos.js +57 -0
  43. package/dist/CitySelector/CitySelector.types.d.ts +0 -1
  44. package/dist/Collapse/Collapse.d.ts +1 -1
  45. package/dist/Collapse/Collapse.js +26 -12
  46. package/dist/Collapse/Collapse.miniapp.d.ts +10 -0
  47. package/dist/Collapse/Collapse.miniapp.js +255 -0
  48. package/dist/Collapse/index.css +40 -1
  49. package/dist/CollapsePanel/index.css +1 -1
  50. package/dist/Countdown/Countdown.js +61 -21
  51. package/dist/Countdown/Countdown.types.d.ts +19 -15
  52. package/dist/Countdown/__tests__/fixtures/A11yDemos.d.ts +23 -0
  53. package/dist/Countdown/__tests__/fixtures/A11yDemos.js +107 -0
  54. package/dist/Countdown/index.css +11 -0
  55. package/dist/DatePicker/DatePicker.d.ts +4 -0
  56. package/dist/DatePicker/DatePicker.js +335 -0
  57. package/dist/DatePicker/DatePicker.types.d.ts +36 -0
  58. package/dist/DatePicker/DatePicker.types.js +15 -0
  59. package/dist/DatePicker/constants.d.ts +9 -0
  60. package/dist/DatePicker/constants.js +37 -0
  61. package/dist/DatePicker/index.d.ts +3 -0
  62. package/dist/DatePicker/index.js +44 -0
  63. package/dist/DesktopDatePicker/DesktopDatePicker.css +61 -0
  64. package/dist/DesktopDatePicker/DesktopDatePicker.d.ts +5 -0
  65. package/dist/DesktopDatePicker/DesktopDatePicker.js +280 -0
  66. package/dist/DesktopDatePicker/DesktopDatePicker.types.d.ts +163 -0
  67. package/dist/DesktopDatePicker/DesktopDatePicker.types.js +15 -0
  68. package/dist/DesktopDatePicker/deskTopPickerContainer.css +100 -0
  69. package/dist/DesktopDatePicker/index.css +161 -0
  70. package/dist/DesktopDatePicker/index.d.ts +2 -0
  71. package/dist/DesktopDatePicker/index.js +41 -0
  72. package/dist/DesktopDatePicker/useGetDatePickerContent.d.ts +6 -0
  73. package/dist/DesktopDatePicker/useGetDatePickerContent.js +343 -0
  74. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +5 -0
  75. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.js +322 -0
  76. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +163 -0
  77. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.js +15 -0
  78. package/dist/DesktopDateTimePicker/index.css +66 -0
  79. package/dist/DesktopDateTimePicker/index.d.ts +2 -0
  80. package/dist/DesktopDateTimePicker/index.js +41 -0
  81. package/dist/DesktopPicker/DesktopPicker.d.ts +5 -0
  82. package/dist/DesktopPicker/DesktopPicker.js +243 -0
  83. package/dist/DesktopPicker/DesktopPicker.types.d.ts +61 -0
  84. package/dist/DesktopPicker/DesktopPicker.types.js +15 -0
  85. package/dist/DesktopPicker/index.css +39 -0
  86. package/dist/DesktopPicker/index.d.ts +2 -0
  87. package/dist/DesktopPicker/index.js +41 -0
  88. package/dist/DesktopPicker/utils/calcAfterMounted.d.ts +2 -0
  89. package/dist/{Tabs/utils/bound.js → DesktopPicker/utils/calcAfterMounted.js} +7 -14
  90. package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +2 -0
  91. package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.js +38 -0
  92. package/dist/DesktopTimePicker/DesktopTimePicker.d.ts +5 -0
  93. package/dist/DesktopTimePicker/DesktopTimePicker.js +288 -0
  94. package/dist/DesktopTimePicker/DesktopTimePicker.types.d.ts +182 -0
  95. package/dist/DesktopTimePicker/DesktopTimePicker.types.js +15 -0
  96. package/dist/DesktopTimePicker/DesktopTimePickerList.d.ts +4 -0
  97. package/dist/DesktopTimePicker/DesktopTimePickerList.js +111 -0
  98. package/dist/DesktopTimePicker/index.css +170 -0
  99. package/dist/DesktopTimePicker/index.d.ts +2 -0
  100. package/dist/DesktopTimePicker/index.js +41 -0
  101. package/dist/DesktopTimePicker/useGetTimePickerContent.d.ts +6 -0
  102. package/dist/DesktopTimePicker/useGetTimePickerContent.js +249 -0
  103. package/dist/DesktopTimePicker/utils/scrollUtil.d.ts +2 -0
  104. package/dist/DesktopTimePicker/utils/scrollUtil.js +27 -0
  105. package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +2 -0
  106. package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.js +51 -0
  107. package/dist/DesktopTimePicker/utils/utils.d.ts +28 -0
  108. package/dist/DesktopTimePicker/utils/utils.js +408 -0
  109. package/dist/Dialog/Dialog.d.ts +5 -2
  110. package/dist/Dialog/Dialog.js +56 -34
  111. package/dist/Dialog/Dialog.types.d.ts +50 -22
  112. package/dist/Dialog/FunctionalDialog.d.ts +10 -3
  113. package/dist/Dialog/FunctionalDialog.js +102 -80
  114. package/dist/Dialog/__tests__/fixtures/A11yDemos.d.ts +9 -0
  115. package/dist/Dialog/__tests__/fixtures/A11yDemos.js +78 -0
  116. package/dist/Dialog/index.css +19 -19
  117. package/dist/Dialog/index.d.ts +4 -1
  118. package/dist/Dialog/index.js +9 -2
  119. package/dist/Drawer/Drawer.js +7 -7
  120. package/dist/Drawer/__tests__/fixtures/A11yDemos.d.ts +21 -0
  121. package/dist/Drawer/__tests__/fixtures/A11yDemos.js +148 -0
  122. package/dist/Fade/Fade.js +2 -2
  123. package/dist/Fade/Fade.miniapp.d.ts +10 -0
  124. package/dist/Fade/Fade.miniapp.js +200 -0
  125. package/dist/Fade/index.css +18 -0
  126. package/dist/IconButton/IconButton.js +23 -8
  127. package/dist/IconButton/IconButton.types.d.ts +35 -1
  128. package/dist/IconButton/index.css +3 -0
  129. package/dist/Image/Image.js +17 -10
  130. package/dist/Image/__tests__/fixtures/A11yDemos.d.ts +21 -0
  131. package/dist/Image/__tests__/fixtures/A11yDemos.js +130 -0
  132. package/dist/Image/index.css +3 -8
  133. package/dist/Input/Input.js +5 -3
  134. package/dist/Input/__tests__/fixtures/A11yDemos.d.ts +21 -0
  135. package/dist/Input/__tests__/fixtures/A11yDemos.js +81 -0
  136. package/dist/Input/index.css +8 -8
  137. package/dist/ItemSelector/ItemSelector.types.d.ts +0 -1
  138. package/dist/Modal/Modal.js +47 -47
  139. package/dist/Modal/Modal.miniapp.d.ts +2 -2
  140. package/dist/Modal/Modal.miniapp.js +48 -32
  141. package/dist/Modal/Modal.types.d.ts +26 -2
  142. package/dist/Modal/ModalManager.d.ts +21 -0
  143. package/dist/Modal/ModalManager.js +238 -0
  144. package/dist/Modal/__tests__/fixtures/A11yDemos.d.ts +8 -0
  145. package/dist/Modal/__tests__/fixtures/A11yDemos.js +52 -0
  146. package/dist/Modal/index.css +1 -1
  147. package/dist/Modal/index.d.ts +3 -0
  148. package/dist/Modal/index.js +9 -1
  149. package/dist/Modal/useModal.d.ts +24 -0
  150. package/dist/Modal/useModal.js +190 -0
  151. package/dist/NavBar/index.css +2 -2
  152. package/dist/Picker/Picker.css +4 -0
  153. package/dist/Picker/Picker.js +72 -18
  154. package/dist/Picker/Picker.types.d.ts +15 -2
  155. package/dist/Picker/PickerPanel.css +4 -0
  156. package/dist/Picker/PickerPanel.js +52 -41
  157. package/dist/Picker/__tests__/fixtures/A11yDemos.d.ts +2 -0
  158. package/dist/Picker/__tests__/fixtures/A11yDemos.js +79 -0
  159. package/dist/Picker/index.css +8 -0
  160. package/dist/Picker/utils.d.ts +8 -5
  161. package/dist/Picker/utils.js +9 -12
  162. package/dist/Popover/Popover.js +123 -91
  163. package/dist/Popover/Popover.types.d.ts +44 -7
  164. package/dist/Popover/__tests__/fixtures/A11yDemos.d.ts +25 -0
  165. package/dist/Popover/__tests__/fixtures/A11yDemos.js +175 -0
  166. package/dist/Popover/hooks/index.d.ts +8 -0
  167. package/dist/Popover/hooks/index.js +36 -0
  168. package/dist/Popover/hooks/usePopoverA11y.d.ts +14 -0
  169. package/dist/Popover/hooks/usePopoverA11y.js +66 -0
  170. package/dist/Popover/hooks/usePopoverEvents.d.ts +21 -0
  171. package/dist/Popover/hooks/usePopoverEvents.js +150 -0
  172. package/dist/Popover/hooks/usePopoverPosition.d.ts +17 -0
  173. package/dist/Popover/hooks/usePopoverPosition.js +124 -0
  174. package/dist/Popover/hooks/usePopoverState.d.ts +16 -0
  175. package/dist/Popover/hooks/usePopoverState.js +54 -0
  176. package/dist/Portal/Portal.miniapp.js +20 -11
  177. package/dist/Portal/Portal.types.d.ts +1 -1
  178. package/dist/Portal/PortalCore.js +2 -2
  179. package/dist/Progress/Progress.js +61 -6
  180. package/dist/Progress/Progress.types.d.ts +44 -0
  181. package/dist/Progress/__tests__/fixtures/A11yDemos.d.ts +21 -0
  182. package/dist/Progress/__tests__/fixtures/A11yDemos.js +100 -0
  183. package/dist/Radio/Radio.js +5 -4
  184. package/dist/Radio/RadioGroup.js +1 -1
  185. package/dist/Radio/__tests__/fixtures/A11yDemos.d.ts +15 -0
  186. package/dist/Radio/__tests__/fixtures/A11yDemos.js +57 -0
  187. package/dist/Rating/index.css +8 -12
  188. package/dist/ScrollView/ScrollView.js +48 -196
  189. package/dist/ScrollView/ScrollView.types.d.ts +120 -86
  190. package/dist/ScrollView/__tests__/fixtures/A11yDemos.d.ts +7 -0
  191. package/dist/ScrollView/__tests__/fixtures/A11yDemos.js +319 -0
  192. package/dist/ScrollView/useScrollView.d.ts +10 -0
  193. package/dist/ScrollView/useScrollView.js +300 -0
  194. package/dist/Select/Select.js +73 -39
  195. package/dist/Select/Select.types.d.ts +2 -2
  196. package/dist/Select/SelectOption.js +5 -1
  197. package/dist/Select/__tests__/fixtures/A11yDemos.d.ts +21 -0
  198. package/dist/Select/__tests__/fixtures/A11yDemos.js +154 -0
  199. package/dist/Select/index.css +12 -8
  200. package/dist/Select/selectContext.d.ts +0 -1
  201. package/dist/Slide/Slide.js +2 -2
  202. package/dist/Slide/Slide.miniapp.d.ts +14 -0
  203. package/dist/Slide/Slide.miniapp.js +213 -0
  204. package/dist/Slide/index.css +72 -0
  205. package/dist/Slider/Slider.js +13 -5
  206. package/dist/Stack/demo/index.css +2 -0
  207. package/dist/SwipeAction/SwipeAction.css +79 -0
  208. package/dist/SwipeAction/SwipeAction.d.ts +5 -0
  209. package/dist/SwipeAction/SwipeAction.js +349 -0
  210. package/dist/SwipeAction/SwipeAction.types.d.ts +75 -0
  211. package/dist/SwipeAction/SwipeAction.types.js +15 -0
  212. package/dist/SwipeAction/SwipeActionContext.d.ts +3 -0
  213. package/dist/SwipeAction/SwipeActionContext.js +30 -0
  214. package/dist/SwipeAction/SwipeActionItem.css +31 -0
  215. package/dist/SwipeAction/SwipeActionItem.d.ts +5 -0
  216. package/dist/SwipeAction/SwipeActionItem.js +105 -0
  217. package/dist/SwipeAction/constants.d.ts +9 -0
  218. package/dist/SwipeAction/constants.js +39 -0
  219. package/dist/SwipeAction/index.css +110 -0
  220. package/dist/SwipeAction/index.d.ts +5 -0
  221. package/dist/SwipeAction/index.js +50 -0
  222. package/dist/Swiper/Swiper.js +18 -4
  223. package/dist/Switch/Switch.js +5 -4
  224. package/dist/Switch/__tests__/fixtures/A11yDemos.d.ts +15 -0
  225. package/dist/Switch/__tests__/fixtures/A11yDemos.js +57 -0
  226. package/dist/Tabs/Tab.js +36 -21
  227. package/dist/Tabs/Tab.types.d.ts +1 -1
  228. package/dist/Tabs/TabPanel.d.ts +1 -1
  229. package/dist/Tabs/TabPanel.js +9 -5
  230. package/dist/Tabs/Tabs.css +2 -2
  231. package/dist/Tabs/Tabs.js +87 -64
  232. package/dist/Tabs/Tabs.types.d.ts +1 -1
  233. package/dist/Tabs/TabsContext.d.ts +4 -5
  234. package/dist/Tabs/TabsContext.js +3 -1
  235. package/dist/Tabs/index.css +2 -2
  236. package/dist/Tabs/utils/scroll.d.ts +2 -0
  237. package/dist/Tabs/utils/scroll.js +55 -0
  238. package/dist/Tag/__tests__/fixtures/A11yDemos.d.ts +21 -0
  239. package/dist/Tag/__tests__/fixtures/A11yDemos.js +196 -0
  240. package/dist/TextArea/TextArea.js +50 -7
  241. package/dist/TextArea/TextArea.types.d.ts +28 -0
  242. package/dist/TextArea/__tests__/fixtures/A11yDemos.d.ts +19 -0
  243. package/dist/TextArea/__tests__/fixtures/A11yDemos.js +91 -0
  244. package/dist/TextArea/index.css +4 -4
  245. package/dist/ThemeProvider/ThemeProvider.types.d.ts +2 -2
  246. package/dist/ThemeProvider/ThemeProvider.types.js +0 -12
  247. package/dist/Toast/FunctionalToast.d.ts +2 -2
  248. package/dist/Toast/FunctionalToast.js +180 -85
  249. package/dist/Toast/Toast.d.ts +2 -2
  250. package/dist/Toast/Toast.js +69 -28
  251. package/dist/Toast/Toast.types.d.ts +13 -10
  252. package/dist/Toast/__tests__/fixtures/A11yDemos.d.ts +2 -0
  253. package/dist/Toast/__tests__/fixtures/A11yDemos.js +54 -0
  254. package/dist/Toast/index.css +0 -1
  255. package/dist/Tooltip/Tooltip.js +63 -107
  256. package/dist/Tooltip/Tooltip.types.d.ts +94 -43
  257. package/dist/Tooltip/__tests__/fixtures/A11yDemos.d.ts +25 -0
  258. package/dist/Tooltip/__tests__/fixtures/A11yDemos.js +100 -0
  259. package/dist/Tooltip/useTooltip.d.ts +29 -0
  260. package/dist/Tooltip/useTooltip.js +313 -0
  261. package/dist/Transition/TransitionCore.js +30 -25
  262. package/dist/TransitionGroup/TransitionGroup.d.ts +7 -0
  263. package/dist/TransitionGroup/TransitionGroup.js +132 -0
  264. package/dist/TransitionGroup/TransitionGroup.types.d.ts +47 -0
  265. package/dist/TransitionGroup/TransitionGroup.types.js +15 -0
  266. package/dist/TransitionGroup/demo/TransitionGroupDemo.d.ts +4 -0
  267. package/dist/TransitionGroup/demo/TransitionGroupDemo.js +68 -0
  268. package/dist/TransitionGroup/demo/index.css +33 -0
  269. package/dist/TransitionGroup/index.d.ts +2 -0
  270. package/dist/TransitionGroup/index.js +41 -0
  271. package/dist/TransitionGroup/utils/childMapping.d.ts +27 -0
  272. package/dist/TransitionGroup/utils/childMapping.js +119 -0
  273. package/dist/_.._/benchmarks/components/Button.js +41 -0
  274. package/dist/_.._/benchmarks/components/Input.js +45 -0
  275. package/dist/_.._/benchmarks/components/Tabs.js +50 -0
  276. package/dist/index.d.ts +8 -0
  277. package/dist/index.js +17 -1
  278. package/dist/locales/base.d.ts +40 -1
  279. package/dist/locales/en-US.js +54 -2
  280. package/dist/locales/zh-CN.js +56 -1
  281. package/dist/locales/zh-TW.js +56 -1
  282. package/es/Alert/Alert.js +2 -1
  283. package/es/Alert/__tests__/fixtures/A11yDemos.d.ts +17 -0
  284. package/es/Alert/__tests__/fixtures/A11yDemos.js +107 -0
  285. package/es/Alert/index.css +4 -4
  286. package/es/Avatar/AvatarGroup.css +8 -8
  287. package/es/Avatar/index.css +8 -8
  288. package/es/Backdrop/Backdrop.js +3 -2
  289. package/es/Backdrop/Backdrop.types.d.ts +4 -0
  290. package/es/Backdrop/__tests__/fixtures/A11yDemos.d.ts +8 -0
  291. package/es/Backdrop/__tests__/fixtures/A11yDemos.js +17 -0
  292. package/es/Backdrop/index.css +2 -2
  293. package/es/Badge/Badge.js +38 -11
  294. package/es/Badge/Badge.types.d.ts +30 -1
  295. package/es/Badge/__tests__/fixtures/A11yDemos.d.ts +25 -0
  296. package/es/Badge/__tests__/fixtures/A11yDemos.js +70 -0
  297. package/es/Badge/hooks/useBadgeA11y.d.ts +23 -0
  298. package/es/Badge/hooks/useBadgeA11y.js +53 -0
  299. package/es/Badge/hooks/useBadgeDisplay.d.ts +16 -0
  300. package/es/Badge/hooks/useBadgeDisplay.js +33 -0
  301. package/es/Button/Button.js +2 -1
  302. package/es/Button/__tests__/fixtures/A11yDemos.d.ts +23 -0
  303. package/es/Button/__tests__/fixtures/A11yDemos.js +42 -0
  304. package/es/Button/index.css +4 -5
  305. package/es/CSSTransition/CSSTransition.d.ts +4 -0
  306. package/es/CSSTransition/CSSTransition.js +153 -0
  307. package/es/CSSTransition/CSSTransition.types.d.ts +13 -0
  308. package/es/CSSTransition/CSSTransition.types.js +1 -0
  309. package/es/CSSTransition/demo/CSSTransitionDemo.d.ts +4 -0
  310. package/es/CSSTransition/demo/CSSTransitionDemo.js +47 -0
  311. package/es/CSSTransition/demo/index.css +25 -0
  312. package/es/CSSTransition/index.d.ts +2 -0
  313. package/es/CSSTransition/index.js +6 -0
  314. package/es/Calendar/Calendar.js +131 -34
  315. package/es/Calendar/Calendar.types.d.ts +16 -1
  316. package/es/Calendar/__tests__/fixtures/A11yDemos.d.ts +2 -0
  317. package/es/Calendar/__tests__/fixtures/A11yDemos.js +8 -0
  318. package/es/Calendar/index.css +52 -9
  319. package/es/Calendar/utils.d.ts +7 -3
  320. package/es/Calendar/utils.js +29 -20
  321. package/es/Checkbox/Checkbox.js +5 -4
  322. package/es/Checkbox/__tests__/fixtures/A11yDemos.d.ts +15 -0
  323. package/es/Checkbox/__tests__/fixtures/A11yDemos.js +22 -0
  324. package/es/CitySelector/CitySelector.types.d.ts +0 -1
  325. package/es/Collapse/Collapse.d.ts +1 -1
  326. package/es/Collapse/Collapse.js +26 -12
  327. package/es/Collapse/Collapse.miniapp.d.ts +10 -0
  328. package/es/Collapse/Collapse.miniapp.js +236 -0
  329. package/es/Collapse/index.css +40 -1
  330. package/es/CollapsePanel/index.css +1 -1
  331. package/es/Countdown/Countdown.js +61 -21
  332. package/es/Countdown/Countdown.types.d.ts +19 -15
  333. package/es/Countdown/__tests__/fixtures/A11yDemos.d.ts +23 -0
  334. package/es/Countdown/__tests__/fixtures/A11yDemos.js +68 -0
  335. package/es/Countdown/index.css +11 -0
  336. package/es/DatePicker/DatePicker.d.ts +4 -0
  337. package/es/DatePicker/DatePicker.js +308 -0
  338. package/es/DatePicker/DatePicker.types.d.ts +36 -0
  339. package/es/DatePicker/DatePicker.types.js +1 -0
  340. package/es/DatePicker/constants.d.ts +9 -0
  341. package/es/DatePicker/constants.js +14 -0
  342. package/es/DatePicker/index.d.ts +3 -0
  343. package/es/DatePicker/index.js +8 -0
  344. package/es/DesktopDatePicker/DesktopDatePicker.css +61 -0
  345. package/es/DesktopDatePicker/DesktopDatePicker.d.ts +5 -0
  346. package/es/DesktopDatePicker/DesktopDatePicker.js +253 -0
  347. package/es/DesktopDatePicker/DesktopDatePicker.types.d.ts +163 -0
  348. package/es/DesktopDatePicker/DesktopDatePicker.types.js +1 -0
  349. package/es/DesktopDatePicker/deskTopPickerContainer.css +100 -0
  350. package/es/DesktopDatePicker/index.css +161 -0
  351. package/es/DesktopDatePicker/index.d.ts +2 -0
  352. package/es/DesktopDatePicker/index.js +6 -0
  353. package/es/DesktopDatePicker/useGetDatePickerContent.d.ts +6 -0
  354. package/es/DesktopDatePicker/useGetDatePickerContent.js +316 -0
  355. package/es/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +5 -0
  356. package/es/DesktopDateTimePicker/DesktopDateTimePicker.js +295 -0
  357. package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +163 -0
  358. package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.js +1 -0
  359. package/es/DesktopDateTimePicker/index.css +66 -0
  360. package/es/DesktopDateTimePicker/index.d.ts +2 -0
  361. package/es/DesktopDateTimePicker/index.js +9 -0
  362. package/es/DesktopPicker/DesktopPicker.d.ts +5 -0
  363. package/es/DesktopPicker/DesktopPicker.js +226 -0
  364. package/es/DesktopPicker/DesktopPicker.types.d.ts +61 -0
  365. package/es/DesktopPicker/DesktopPicker.types.js +1 -0
  366. package/es/DesktopPicker/index.css +39 -0
  367. package/es/DesktopPicker/index.d.ts +2 -0
  368. package/es/DesktopPicker/index.js +6 -0
  369. package/es/DesktopPicker/utils/calcAfterMounted.d.ts +2 -0
  370. package/es/DesktopPicker/utils/calcAfterMounted.js +6 -0
  371. package/es/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +2 -0
  372. package/es/DesktopPicker/utils/calcAfterMounted.miniapp.js +9 -0
  373. package/es/DesktopTimePicker/DesktopTimePicker.d.ts +5 -0
  374. package/es/DesktopTimePicker/DesktopTimePicker.js +261 -0
  375. package/es/DesktopTimePicker/DesktopTimePicker.types.d.ts +182 -0
  376. package/es/DesktopTimePicker/DesktopTimePicker.types.js +1 -0
  377. package/es/DesktopTimePicker/DesktopTimePickerList.d.ts +4 -0
  378. package/es/DesktopTimePicker/DesktopTimePickerList.js +84 -0
  379. package/es/DesktopTimePicker/index.css +170 -0
  380. package/es/DesktopTimePicker/index.d.ts +2 -0
  381. package/es/DesktopTimePicker/index.js +6 -0
  382. package/es/DesktopTimePicker/useGetTimePickerContent.d.ts +6 -0
  383. package/es/DesktopTimePicker/useGetTimePickerContent.js +226 -0
  384. package/es/DesktopTimePicker/utils/scrollUtil.d.ts +2 -0
  385. package/es/DesktopTimePicker/utils/scrollUtil.js +8 -0
  386. package/es/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +2 -0
  387. package/es/DesktopTimePicker/utils/scrollUtil.miniapp.js +22 -0
  388. package/es/DesktopTimePicker/utils/utils.d.ts +28 -0
  389. package/es/DesktopTimePicker/utils/utils.js +365 -0
  390. package/es/Dialog/Dialog.d.ts +5 -2
  391. package/es/Dialog/Dialog.js +57 -35
  392. package/es/Dialog/Dialog.types.d.ts +50 -22
  393. package/es/Dialog/FunctionalDialog.d.ts +10 -3
  394. package/es/Dialog/FunctionalDialog.js +106 -84
  395. package/es/Dialog/__tests__/fixtures/A11yDemos.d.ts +9 -0
  396. package/es/Dialog/__tests__/fixtures/A11yDemos.js +43 -0
  397. package/es/Dialog/index.css +19 -19
  398. package/es/Dialog/index.d.ts +4 -1
  399. package/es/Dialog/index.js +10 -3
  400. package/es/Drawer/Drawer.js +8 -8
  401. package/es/Drawer/__tests__/fixtures/A11yDemos.d.ts +21 -0
  402. package/es/Drawer/__tests__/fixtures/A11yDemos.js +112 -0
  403. package/es/Fade/Fade.js +2 -2
  404. package/es/Fade/Fade.miniapp.d.ts +10 -0
  405. package/es/Fade/Fade.miniapp.js +179 -0
  406. package/es/Fade/index.css +18 -0
  407. package/es/IconButton/IconButton.js +23 -8
  408. package/es/IconButton/IconButton.types.d.ts +35 -1
  409. package/es/IconButton/index.css +3 -0
  410. package/es/Image/Image.js +17 -10
  411. package/es/Image/__tests__/fixtures/A11yDemos.d.ts +21 -0
  412. package/es/Image/__tests__/fixtures/A11yDemos.js +92 -0
  413. package/es/Image/index.css +3 -8
  414. package/es/Input/Input.js +5 -3
  415. package/es/Input/__tests__/fixtures/A11yDemos.d.ts +21 -0
  416. package/es/Input/__tests__/fixtures/A11yDemos.js +43 -0
  417. package/es/Input/index.css +8 -8
  418. package/es/ItemSelector/ItemSelector.types.d.ts +0 -1
  419. package/es/Modal/Modal.js +48 -48
  420. package/es/Modal/Modal.miniapp.d.ts +2 -2
  421. package/es/Modal/Modal.miniapp.js +49 -33
  422. package/es/Modal/Modal.types.d.ts +26 -2
  423. package/es/Modal/ModalManager.d.ts +21 -0
  424. package/es/Modal/ModalManager.js +214 -0
  425. package/es/Modal/__tests__/fixtures/A11yDemos.d.ts +8 -0
  426. package/es/Modal/__tests__/fixtures/A11yDemos.js +18 -0
  427. package/es/Modal/index.css +1 -1
  428. package/es/Modal/index.d.ts +3 -0
  429. package/es/Modal/index.js +6 -1
  430. package/es/Modal/useModal.d.ts +24 -0
  431. package/es/Modal/useModal.js +169 -0
  432. package/es/NavBar/index.css +2 -2
  433. package/es/Picker/Picker.css +4 -0
  434. package/es/Picker/Picker.js +72 -18
  435. package/es/Picker/Picker.types.d.ts +15 -2
  436. package/es/Picker/PickerPanel.css +4 -0
  437. package/es/Picker/PickerPanel.js +52 -41
  438. package/es/Picker/__tests__/fixtures/A11yDemos.d.ts +2 -0
  439. package/es/Picker/__tests__/fixtures/A11yDemos.js +46 -0
  440. package/es/Picker/index.css +8 -0
  441. package/es/Picker/utils.d.ts +8 -5
  442. package/es/Picker/utils.js +9 -12
  443. package/es/Popover/Popover.js +130 -99
  444. package/es/Popover/Popover.types.d.ts +44 -7
  445. package/es/Popover/__tests__/fixtures/A11yDemos.d.ts +25 -0
  446. package/es/Popover/__tests__/fixtures/A11yDemos.js +135 -0
  447. package/es/Popover/hooks/index.d.ts +8 -0
  448. package/es/Popover/hooks/index.js +10 -0
  449. package/es/Popover/hooks/usePopoverA11y.d.ts +14 -0
  450. package/es/Popover/hooks/usePopoverA11y.js +43 -0
  451. package/es/Popover/hooks/usePopoverEvents.d.ts +21 -0
  452. package/es/Popover/hooks/usePopoverEvents.js +127 -0
  453. package/es/Popover/hooks/usePopoverPosition.d.ts +17 -0
  454. package/es/Popover/hooks/usePopoverPosition.js +105 -0
  455. package/es/Popover/hooks/usePopoverState.d.ts +16 -0
  456. package/es/Popover/hooks/usePopoverState.js +31 -0
  457. package/es/Portal/Portal.miniapp.js +21 -12
  458. package/es/Portal/Portal.types.d.ts +1 -1
  459. package/es/Portal/PortalCore.js +2 -2
  460. package/es/Progress/Progress.js +61 -6
  461. package/es/Progress/Progress.types.d.ts +44 -0
  462. package/es/Progress/__tests__/fixtures/A11yDemos.d.ts +21 -0
  463. package/es/Progress/__tests__/fixtures/A11yDemos.js +62 -0
  464. package/es/Radio/Radio.js +5 -4
  465. package/es/Radio/RadioGroup.js +1 -1
  466. package/es/Radio/__tests__/fixtures/A11yDemos.d.ts +15 -0
  467. package/es/Radio/__tests__/fixtures/A11yDemos.js +22 -0
  468. package/es/Rating/index.css +8 -12
  469. package/es/ScrollView/ScrollView.js +51 -197
  470. package/es/ScrollView/ScrollView.types.d.ts +120 -86
  471. package/es/ScrollView/__tests__/fixtures/A11yDemos.d.ts +7 -0
  472. package/es/ScrollView/__tests__/fixtures/A11yDemos.js +283 -0
  473. package/es/ScrollView/useScrollView.d.ts +10 -0
  474. package/es/ScrollView/useScrollView.js +279 -0
  475. package/es/Select/Select.js +73 -40
  476. package/es/Select/Select.types.d.ts +2 -2
  477. package/es/Select/SelectOption.js +5 -1
  478. package/es/Select/__tests__/fixtures/A11yDemos.d.ts +21 -0
  479. package/es/Select/__tests__/fixtures/A11yDemos.js +118 -0
  480. package/es/Select/index.css +12 -8
  481. package/es/Select/selectContext.d.ts +0 -1
  482. package/es/Slide/Slide.js +2 -2
  483. package/es/Slide/Slide.miniapp.d.ts +14 -0
  484. package/es/Slide/Slide.miniapp.js +192 -0
  485. package/es/Slide/index.css +72 -0
  486. package/es/Slider/Slider.js +16 -6
  487. package/es/Stack/demo/index.css +2 -0
  488. package/es/SwipeAction/SwipeAction.css +79 -0
  489. package/es/SwipeAction/SwipeAction.d.ts +5 -0
  490. package/es/SwipeAction/SwipeAction.js +334 -0
  491. package/es/SwipeAction/SwipeAction.types.d.ts +75 -0
  492. package/es/SwipeAction/SwipeAction.types.js +1 -0
  493. package/es/SwipeAction/SwipeActionContext.d.ts +3 -0
  494. package/es/SwipeAction/SwipeActionContext.js +11 -0
  495. package/es/SwipeAction/SwipeActionItem.css +31 -0
  496. package/es/SwipeAction/SwipeActionItem.d.ts +5 -0
  497. package/es/SwipeAction/SwipeActionItem.js +78 -0
  498. package/es/SwipeAction/constants.d.ts +9 -0
  499. package/es/SwipeAction/constants.js +15 -0
  500. package/es/SwipeAction/index.css +110 -0
  501. package/es/SwipeAction/index.d.ts +5 -0
  502. package/es/SwipeAction/index.js +12 -0
  503. package/es/Swiper/Swiper.js +18 -4
  504. package/es/Switch/Switch.js +5 -4
  505. package/es/Switch/__tests__/fixtures/A11yDemos.d.ts +15 -0
  506. package/es/Switch/__tests__/fixtures/A11yDemos.js +22 -0
  507. package/es/Tabs/Tab.js +36 -21
  508. package/es/Tabs/Tab.types.d.ts +1 -1
  509. package/es/Tabs/TabPanel.d.ts +1 -1
  510. package/es/Tabs/TabPanel.js +8 -4
  511. package/es/Tabs/Tabs.css +2 -2
  512. package/es/Tabs/Tabs.js +87 -64
  513. package/es/Tabs/Tabs.types.d.ts +1 -1
  514. package/es/Tabs/TabsContext.d.ts +4 -5
  515. package/es/Tabs/TabsContext.js +3 -1
  516. package/es/Tabs/index.css +2 -2
  517. package/es/Tabs/utils/scroll.d.ts +2 -0
  518. package/es/Tabs/utils/scroll.js +36 -0
  519. package/es/Tag/__tests__/fixtures/A11yDemos.d.ts +21 -0
  520. package/es/Tag/__tests__/fixtures/A11yDemos.js +160 -0
  521. package/es/TextArea/TextArea.js +51 -8
  522. package/es/TextArea/TextArea.types.d.ts +28 -0
  523. package/es/TextArea/__tests__/fixtures/A11yDemos.d.ts +19 -0
  524. package/es/TextArea/__tests__/fixtures/A11yDemos.js +54 -0
  525. package/es/TextArea/index.css +4 -4
  526. package/es/ThemeProvider/ThemeProvider.types.d.ts +2 -2
  527. package/es/Toast/FunctionalToast.d.ts +2 -2
  528. package/es/Toast/FunctionalToast.js +186 -86
  529. package/es/Toast/Toast.d.ts +2 -2
  530. package/es/Toast/Toast.js +69 -28
  531. package/es/Toast/Toast.types.d.ts +13 -10
  532. package/es/Toast/__tests__/fixtures/A11yDemos.d.ts +2 -0
  533. package/es/Toast/__tests__/fixtures/A11yDemos.js +21 -0
  534. package/es/Toast/index.css +0 -1
  535. package/es/Tooltip/Tooltip.js +64 -114
  536. package/es/Tooltip/Tooltip.types.d.ts +94 -43
  537. package/es/Tooltip/__tests__/fixtures/A11yDemos.d.ts +25 -0
  538. package/es/Tooltip/__tests__/fixtures/A11yDemos.js +60 -0
  539. package/es/Tooltip/useTooltip.d.ts +29 -0
  540. package/es/Tooltip/useTooltip.js +290 -0
  541. package/es/Transition/TransitionCore.js +31 -26
  542. package/es/TransitionGroup/TransitionGroup.d.ts +7 -0
  543. package/es/TransitionGroup/TransitionGroup.js +109 -0
  544. package/es/TransitionGroup/TransitionGroup.types.d.ts +47 -0
  545. package/es/TransitionGroup/TransitionGroup.types.js +1 -0
  546. package/es/TransitionGroup/demo/TransitionGroupDemo.d.ts +4 -0
  547. package/es/TransitionGroup/demo/TransitionGroupDemo.js +39 -0
  548. package/es/TransitionGroup/demo/index.css +33 -0
  549. package/es/TransitionGroup/index.d.ts +2 -0
  550. package/es/TransitionGroup/index.js +6 -0
  551. package/es/TransitionGroup/utils/childMapping.d.ts +27 -0
  552. package/es/TransitionGroup/utils/childMapping.js +93 -0
  553. package/es/_.._/benchmarks/components/Button.js +8 -0
  554. package/es/_.._/benchmarks/components/Input.js +12 -0
  555. package/es/_.._/benchmarks/components/Tabs.js +17 -0
  556. package/es/index.d.ts +8 -0
  557. package/es/index.js +8 -0
  558. package/es/locales/base.d.ts +40 -1
  559. package/es/locales/en-US.js +54 -2
  560. package/es/locales/zh-CN.js +56 -1
  561. package/es/locales/zh-TW.js +56 -1
  562. package/package.json +9 -6
  563. package/dist/Tabs/utils/bound.d.ts +0 -1
  564. package/es/Tabs/utils/bound.d.ts +0 -1
  565. package/es/Tabs/utils/bound.js +0 -13
@@ -5,12 +5,9 @@ import { ThemeProps } from '../ThemeProvider/ThemeProvider.types';
5
5
  /**
6
6
  * 对话框类型
7
7
  */
8
- export type DialogType = 'confirm' | 'prompt';
9
- export type Dispatch = (action: boolean, val?: string) => void;
10
- export type DialogRef = {
11
- theme?: ThemeProps;
12
- };
13
- export interface DialogProps extends ModalProps {
8
+ export type DialogType = 'confirm' | 'prompt' | 'alert';
9
+ export type Dispatch = (action: boolean, e: React.SyntheticEvent, val?: string) => void;
10
+ export interface DialogProps extends Omit<ModalProps, 'title' | 'content'> {
14
11
  /**
15
12
  * 对话框类型
16
13
  * @default confirm
@@ -19,11 +16,11 @@ export interface DialogProps extends ModalProps {
19
16
  /**
20
17
  * 自定义标题
21
18
  */
22
- header?: ReactNode;
19
+ title?: ReactNode;
23
20
  /**
24
21
  * 自定义内容
25
22
  */
26
- message?: ReactNode;
23
+ content?: ReactNode;
27
24
  /**
28
25
  * 输入框占位文本
29
26
  */
@@ -33,9 +30,9 @@ export interface DialogProps extends ModalProps {
33
30
  */
34
31
  InputProps?: Partial<InputProps>;
35
32
  /**
36
- * 确认文本内容
33
+ * 确认按钮文本内容
37
34
  */
38
- confirmText?: ReactNode;
35
+ okText?: ReactNode;
39
36
  /**
40
37
  * 取消文本内容
41
38
  */
@@ -44,27 +41,36 @@ export interface DialogProps extends ModalProps {
44
41
  * theme 主题定制
45
42
  */
46
43
  theme?: ThemeProps;
44
+ /**
45
+ * 渲染Dialog的根容器
46
+ * @default document.body
47
+ */
48
+ container?: HTMLElement | (() => HTMLElement);
47
49
  /**
48
50
  * 确认回调
49
51
  */
50
- onOk?: (val?: string) => void;
52
+ onOk?: (e: React.SyntheticEvent, data: {
53
+ value: string;
54
+ }) => void;
51
55
  /**
52
56
  * 取消回调
53
57
  */
54
- onClose?: () => void;
58
+ onCancel?: (e: React.SyntheticEvent) => void;
55
59
  }
56
60
  /**
57
61
  * 函数式调用配置参数
58
62
  */
59
- export type DialogOptions = Omit<DialogProps, 'placeholder' | 'inputProps' | 'onOk' | 'onClose'> & {
63
+ export type DialogOptions = Omit<DialogProps, 'placeholder' | 'inputProps' | 'onOk' | 'onCancel'> & {
60
64
  /**
61
65
  * 确认回调
62
66
  */
63
- onConfirm?: (val?: string) => void | Promise<void>;
67
+ onOk?: (e: React.SyntheticEvent, data: {
68
+ value: string;
69
+ }) => void;
64
70
  /**
65
71
  * 取消回调
66
72
  */
67
- onCancel?: () => void | Promise<void>;
73
+ onCancel?: (e: React.SyntheticEvent) => void;
68
74
  };
69
75
  /**
70
76
  * prompt函数式调用配置参数
@@ -83,6 +89,10 @@ export type PromptOptions = (DialogOptions & {
83
89
  * confirm函数式调用配置参数
84
90
  */
85
91
  export type ConfirmOptions = DialogOptions | string;
92
+ /**
93
+ * alert函数式调用配置参数
94
+ */
95
+ export type AlertOptions = DialogOptions | string;
86
96
  /**
87
97
  * Dialog函数式调用返回值类型
88
98
  */
@@ -91,19 +101,37 @@ export type DialogPromise = Promise<boolean | string>;
91
101
  * Dialog Instance
92
102
  */
93
103
  export interface DialogFunction {
94
- /**
95
- * 直接调用显示确认框 Dialog
96
- */
97
- (options: ConfirmOptions): DialogPromise;
98
104
  /**
99
105
  * 显示确认框 Dialog.confirm
100
106
  */
101
- confirm?: (options: ConfirmOptions) => DialogPromise;
107
+ confirm?: (options: ConfirmOptions) => Promise<boolean>;
102
108
  /**
103
109
  * 显示提示对话框 Dialog.prompt
104
110
  */
105
- prompt?: (options: PromptOptions, val?: string) => DialogPromise;
111
+ prompt?: (options: PromptOptions, val?: string) => Promise<string | null>;
112
+ /**
113
+ * 显示警告对话框 Dialog.alert
114
+ */
115
+ alert?: (options: AlertOptions) => Promise<boolean>;
106
116
  }
107
- export interface DialogInstance extends DialogFunction {
117
+ /**
118
+ * Dialog组件类型,支持组件式调用和函数式调用
119
+ */
120
+ export interface DialogComponent extends React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<HTMLDivElement>> {
121
+ /**
122
+ * 显示确认框
123
+ */
124
+ confirm: (options: ConfirmOptions) => Promise<boolean>;
125
+ /**
126
+ * 显示提示对话框
127
+ */
128
+ prompt: (options: PromptOptions) => Promise<string | null>;
129
+ /**
130
+ * 显示警告对话框
131
+ */
132
+ alert: (options: AlertOptions) => Promise<boolean>;
133
+ /**
134
+ * 使用Dialog Hook
135
+ */
108
136
  useDialog: () => [DialogFunction, React.JSX.Element];
109
137
  }
@@ -1,3 +1,10 @@
1
- import { DialogInstance } from './Dialog.types';
2
- declare const Dialog: DialogInstance;
3
- export default Dialog;
1
+ import React from 'react';
2
+ import { DialogPromise, PromptOptions, ConfirmOptions, AlertOptions, DialogOptions, DialogFunction } from './Dialog.types';
3
+ declare const FunctionalDialog: {
4
+ (props: DialogOptions | string): DialogPromise;
5
+ confirm: (options: ConfirmOptions) => Promise<boolean>;
6
+ prompt: (options: PromptOptions) => Promise<string>;
7
+ alert: (options: AlertOptions) => Promise<boolean>;
8
+ useDialog: () => [DialogFunction, React.JSX.Element];
9
+ };
10
+ export default FunctionalDialog;
@@ -82,130 +82,152 @@ module.exports = __toCommonJS(FunctionalDialog_exports);
82
82
  var import_react = __toESM(require("react"));
83
83
  var import_utils = require("@bifrostui/utils");
84
84
  var import_Dialog = __toESM(require("./Dialog"));
85
- const { isValidElement, Component } = import_react.default;
85
+ const { isValidElement } = import_react.default;
86
86
  const formatProps = (props) => {
87
87
  if (typeof props === "string" || isValidElement(props)) {
88
- return { message: props };
88
+ return { content: props };
89
89
  }
90
90
  return props;
91
91
  };
92
92
  const DialogGenerator = (options) => {
93
- const rootWrapper = document.createElement("div");
94
- const rootElement = (0, import_utils.getRootElement)();
95
- rootElement.appendChild(rootWrapper);
96
- const DialogComponent = () => {
97
- const _a = options, { onConfirm, onCancel, ref } = _a, others = __objRest(_a, ["onConfirm", "onCancel", "ref"]);
98
- const [visible, setVisible] = (0, import_react.useState)(false);
93
+ const dialogFragment = import_utils.isMini ? document.createElement("div") : document.createDocumentFragment();
94
+ const rootElement = (0, import_utils.getRootContainer)(options == null ? void 0 : options.container);
95
+ rootElement.appendChild(dialogFragment);
96
+ const DialogWrapper = () => {
97
+ const _a = options, { onOk, onCancel } = _a, rest = __objRest(_a, ["onOk", "onCancel"]);
99
98
  const close = (0, import_react.useCallback)(() => {
100
- setVisible(false);
101
99
  setTimeout(() => {
102
- const unmountRes = (0, import_utils.unmount)(rootWrapper);
103
- if (unmountRes && rootWrapper.parentNode) {
104
- rootWrapper.parentNode.removeChild(rootWrapper);
100
+ const unmountRes = (0, import_utils.unmount)(dialogFragment);
101
+ if (unmountRes && dialogFragment.parentNode) {
102
+ dialogFragment.parentNode.removeChild(dialogFragment);
105
103
  }
106
104
  }, 150);
107
- }, [rootWrapper]);
108
- (0, import_react.useEffect)(() => {
109
- setVisible(true);
110
- }, []);
111
- const dispatch = (action, val) => __async(void 0, null, function* () {
105
+ }, [dialogFragment]);
106
+ const dispatch = (action, e, val = "") => __async(void 0, null, function* () {
112
107
  if (action === true) {
113
- try {
114
- yield onConfirm == null ? void 0 : onConfirm(val);
115
- } catch (error) {
116
- }
108
+ yield onOk == null ? void 0 : onOk(e, { value: val });
117
109
  } else if (action === false) {
118
- try {
119
- yield onCancel == null ? void 0 : onCancel();
120
- } catch (error) {
121
- }
110
+ yield onCancel == null ? void 0 : onCancel(e);
122
111
  }
123
112
  close();
124
113
  });
125
114
  return /* @__PURE__ */ import_react.default.createElement(
126
115
  import_Dialog.default,
127
- __spreadProps(__spreadValues({
128
- ref
129
- }, others), {
130
- open: visible,
131
- onOk: (val) => dispatch(true, val),
132
- onClose: () => dispatch(false)
116
+ __spreadProps(__spreadValues({}, rest), {
117
+ open: true,
118
+ onOk: (e, { value }) => dispatch(true, e, value),
119
+ onCancel: (e) => dispatch(false, e)
133
120
  })
134
121
  );
135
122
  };
136
- return (0, import_utils.render)(/* @__PURE__ */ import_react.default.createElement(DialogComponent, null), rootWrapper);
123
+ return (0, import_utils.render)(/* @__PURE__ */ import_react.default.createElement(DialogWrapper, null), dialogFragment);
137
124
  };
138
- const Dialog = (props) => {
125
+ const FunctionalDialog = (props) => {
139
126
  const options = formatProps(props);
140
- const _a = options, { onConfirm, onCancel } = _a, rest = __objRest(_a, ["onConfirm", "onCancel"]);
127
+ const _a = options, { onOk, onCancel } = _a, rest = __objRest(_a, ["onOk", "onCancel"]);
141
128
  return new Promise((resolve) => {
142
129
  DialogGenerator(__spreadProps(__spreadValues({}, rest), {
143
- onConfirm: (val) => __async(void 0, null, function* () {
144
- yield onConfirm == null ? void 0 : onConfirm(val);
130
+ onOk: (_0, _1) => __async(void 0, [_0, _1], function* (e, { value: val }) {
131
+ yield onOk == null ? void 0 : onOk(e, { value: val });
145
132
  if (rest.type === "prompt")
146
133
  resolve(val);
147
134
  else
148
135
  resolve(true);
149
136
  }),
150
- onCancel: () => __async(void 0, null, function* () {
151
- yield onCancel == null ? void 0 : onCancel();
152
- resolve(false);
137
+ onCancel: (e) => __async(void 0, null, function* () {
138
+ yield onCancel == null ? void 0 : onCancel(e);
139
+ if (rest.type === "prompt")
140
+ resolve(null);
141
+ else
142
+ resolve(false);
153
143
  })
154
144
  }));
155
145
  });
156
146
  };
157
- Dialog.prototype = Component.prototype;
158
147
  const confirm = (options) => {
159
- return Dialog(__spreadValues({
148
+ return FunctionalDialog(__spreadValues({
160
149
  type: "confirm"
161
150
  }, formatProps(options)));
162
151
  };
163
152
  const prompt = (options) => {
164
- return Dialog(__spreadValues({
153
+ return FunctionalDialog(__spreadValues({
165
154
  type: "prompt"
166
155
  }, formatProps(options)));
167
156
  };
157
+ const alert = (options) => {
158
+ return FunctionalDialog(__spreadValues({
159
+ type: "alert"
160
+ }, formatProps(options)));
161
+ };
168
162
  const useDialog = () => {
169
- const holderRef = import_react.default.useRef(null);
170
- const wrapAPI = (props) => {
171
- var _a;
172
- const options = __spreadValues({ theme: (_a = holderRef.current) == null ? void 0 : _a.theme }, formatProps(props));
173
- const _b = options, { onConfirm, onCancel } = _b, rest = __objRest(_b, ["onConfirm", "onCancel"]);
163
+ const [elements, setElements] = (0, import_react.useState)([]);
164
+ const createDialog = (0, import_react.useCallback)((config) => {
174
165
  return new Promise((resolve) => {
175
- DialogGenerator(__spreadProps(__spreadValues({}, rest), {
176
- onConfirm: (val) => __async(void 0, null, function* () {
177
- yield onConfirm == null ? void 0 : onConfirm(val);
178
- if (rest.type === "prompt")
179
- resolve(val);
180
- else
181
- resolve(true);
182
- }),
183
- onCancel: () => __async(void 0, null, function* () {
184
- yield onCancel == null ? void 0 : onCancel();
166
+ const key = `dialog-${Date.now()}-${Math.random()}`;
167
+ const destroy = () => {
168
+ setElements((prev) => prev.filter((el) => el.key !== key));
169
+ };
170
+ const onInternalOk = (e, data) => __async(void 0, null, function* () {
171
+ var _a;
172
+ yield (_a = config.onOk) == null ? void 0 : _a.call(config, e, data);
173
+ if (config.type === "prompt")
174
+ resolve(data.value);
175
+ else
176
+ resolve(true);
177
+ destroy();
178
+ });
179
+ const onInternalCancel = (e) => __async(void 0, null, function* () {
180
+ var _a;
181
+ yield (_a = config.onCancel) == null ? void 0 : _a.call(config, e);
182
+ if (config.type === "prompt")
183
+ resolve(null);
184
+ else
185
185
  resolve(false);
186
+ destroy();
187
+ });
188
+ const dialogElement = /* @__PURE__ */ import_react.default.createElement(
189
+ import_Dialog.default,
190
+ __spreadProps(__spreadValues({
191
+ key
192
+ }, config), {
193
+ open: true,
194
+ onOk: onInternalOk,
195
+ onCancel: onInternalCancel
186
196
  })
187
- }));
197
+ );
198
+ setElements((prev) => [...prev, dialogElement]);
188
199
  });
189
- };
190
- wrapAPI.confirm = (options) => {
191
- var _a;
192
- return Dialog(__spreadProps(__spreadValues({
193
- type: "confirm"
194
- }, formatProps(options)), {
195
- theme: (_a = holderRef.current) == null ? void 0 : _a.theme
196
- }));
197
- };
198
- wrapAPI.prompt = (options) => {
199
- var _a;
200
- return Dialog(__spreadProps(__spreadValues({
201
- type: "prompt"
202
- }, formatProps(options)), {
203
- theme: (_a = holderRef.current) == null ? void 0 : _a.theme
204
- }));
205
- };
206
- return [wrapAPI, /* @__PURE__ */ import_react.default.createElement(import_Dialog.default, { key: "dialog-holder", ref: holderRef })];
200
+ }, []);
201
+ const wrapAPI = {};
202
+ wrapAPI.confirm = (0, import_react.useCallback)(
203
+ (options) => {
204
+ return createDialog(__spreadValues({
205
+ type: "confirm"
206
+ }, formatProps(options)));
207
+ },
208
+ [createDialog]
209
+ );
210
+ wrapAPI.prompt = (0, import_react.useCallback)(
211
+ (options) => {
212
+ return createDialog(__spreadValues({
213
+ type: "prompt"
214
+ }, formatProps(options)));
215
+ },
216
+ [createDialog]
217
+ );
218
+ wrapAPI.alert = (0, import_react.useCallback)(
219
+ (options) => {
220
+ return createDialog(__spreadValues({
221
+ type: "alert"
222
+ }, formatProps(options)));
223
+ },
224
+ [createDialog]
225
+ );
226
+ const contextHolder = /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, elements);
227
+ return [wrapAPI, contextHolder];
207
228
  };
208
- Dialog.confirm = confirm;
209
- Dialog.prompt = prompt;
210
- Dialog.useDialog = useDialog;
211
- var FunctionalDialog_default = Dialog;
229
+ FunctionalDialog.confirm = confirm;
230
+ FunctionalDialog.prompt = prompt;
231
+ FunctionalDialog.alert = alert;
232
+ FunctionalDialog.useDialog = useDialog;
233
+ var FunctionalDialog_default = FunctionalDialog;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ /**
3
+ * 自定义 Dialog 组件 Demo 集合
4
+ * 这个文件包含多个测试 demo,展示如何使用 getCustomDemoCodesFromFile 进行无障碍测试
5
+ * 文件名必须是 A11yDemos.tsx(固定约定)
6
+ */
7
+ export declare const basicDialogDemo: () => React.JSX.Element;
8
+ export declare const promptDialogDemo: () => React.JSX.Element;
9
+ export declare const alertDialogDemo: () => React.JSX.Element;
@@ -0,0 +1,78 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var A11yDemos_exports = {};
29
+ __export(A11yDemos_exports, {
30
+ alertDialogDemo: () => alertDialogDemo,
31
+ basicDialogDemo: () => basicDialogDemo,
32
+ promptDialogDemo: () => promptDialogDemo
33
+ });
34
+ module.exports = __toCommonJS(A11yDemos_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_Dialog = __toESM(require("../../Dialog"));
37
+ const basicDialogDemo = () => {
38
+ return /* @__PURE__ */ import_react.default.createElement(
39
+ import_Dialog.default,
40
+ {
41
+ open: true,
42
+ disablePortal: true,
43
+ title: "\u57FA\u7840\u5BF9\u8BDD\u6846",
44
+ content: "\u8FD9\u662F\u4E00\u4E2A\u57FA\u7840\u7684 Dialog \u7EC4\u4EF6\u793A\u4F8B"
45
+ }
46
+ );
47
+ };
48
+ const promptDialogDemo = () => {
49
+ return /* @__PURE__ */ import_react.default.createElement(
50
+ import_Dialog.default,
51
+ {
52
+ open: true,
53
+ disablePortal: true,
54
+ type: "prompt",
55
+ title: "\u8F93\u5165\u5BF9\u8BDD\u6846",
56
+ content: "\u8BF7\u8F93\u5165\u60A8\u7684\u59D3\u540D\uFF1A",
57
+ placeholder: "\u8BF7\u8F93\u5165\u59D3\u540D"
58
+ }
59
+ );
60
+ };
61
+ const alertDialogDemo = () => {
62
+ return /* @__PURE__ */ import_react.default.createElement(
63
+ import_Dialog.default,
64
+ {
65
+ open: true,
66
+ disablePortal: true,
67
+ title: "\u8B66\u544A",
68
+ content: "\u8FD9\u662F\u4E00\u4E2A\u8B66\u544A\u5BF9\u8BDD\u6846\uFF0C\u8BF7\u6CE8\u610F\uFF01",
69
+ type: "alert"
70
+ }
71
+ );
72
+ };
73
+ // Annotate the CommonJS export names for ESM import in node:
74
+ 0 && (module.exports = {
75
+ alertDialogDemo,
76
+ basicDialogDemo,
77
+ promptDialogDemo
78
+ });
@@ -4,21 +4,21 @@ xhs-page {
4
4
  --bui-dialog-max-width: 300px;
5
5
  --bui-dialog-border-radius: var(--bui-shape-radius-drawer);
6
6
  --bui-dialog-title-padding: 0 40px 9px;
7
- --bui-dialog-desc-padding: 0 24px;
8
- --bui-dialog-footer-margin-top: 15px;
7
+ --bui-dialog-content-padding: 0 24px;
8
+ --bui-dialog-actions-margin: 15px 0 0 0;
9
9
  --bui-dialog-button-height: 53px;
10
10
  --bui-dialog-button-line-height: 25px;
11
11
  --bui-dialog-button-padding: 12px 0 13px;
12
12
  --bui-dialog-button-font-size: 17px;
13
13
  --bui-dialog-button-border-left: 1px solid rgba(0, 0, 0, 0.05);
14
- --bui-dialog-button-active-background-color: rgba(54, 57, 64, 0.05);
14
+ --bui-dialog-button-active-bg-color: rgba(54, 57, 64, 0.05);
15
15
  }
16
16
  .bui-dialog {
17
17
  display: flex;
18
18
  align-items: center;
19
19
  justify-content: center;
20
20
  }
21
- .bui-dialog-body {
21
+ .bui-dialog-container {
22
22
  padding-top: 21px;
23
23
  min-width: var(--bui-dialog-max-width);
24
24
  margin: 0 auto;
@@ -27,35 +27,31 @@ xhs-page {
27
27
  background-color: var(--bui-color-bg-view);
28
28
  line-height: 21px;
29
29
  }
30
- .bui-dialog-body-title {
30
+ .bui-dialog-title {
31
31
  padding: var(--bui-dialog-title-padding);
32
32
  font-size: var(--bui-title-size-2);
33
33
  text-align: center;
34
34
  color: var(--bui-color-fg-default);
35
35
  font-weight: var(--bui-font-weight-medium);
36
36
  }
37
- .bui-dialog-body-title + .bui-dialog-body-footer {
37
+ .bui-dialog-title + .bui-dialog-actions {
38
38
  margin-top: var(--bui-spacing-sm);
39
39
  }
40
- .bui-dialog-body-desc {
41
- padding: var(--bui-dialog-desc-padding);
40
+ .bui-dialog-content {
41
+ padding: var(--bui-dialog-content-padding);
42
42
  color: var(--bui-color-fg-muted);
43
43
  font-size: var(--bui-title-size-4);
44
44
  text-align: center;
45
45
  }
46
- .bui-dialog-body-desc:first-child {
46
+ .bui-dialog-content:first-child {
47
47
  padding-top: 0;
48
48
  }
49
- .bui-dialog-body-footer {
50
- margin-top: var(--bui-dialog-footer-margin-top);
49
+ .bui-dialog-actions {
50
+ margin: var(--bui-dialog-actions-margin);
51
51
  border-top: 1px solid rgba(0, 0, 0, 0.05);
52
52
  display: flex;
53
53
  }
54
- .bui-dialog-body-input {
55
- width: calc(100% - 48px);
56
- margin: 14px 24px 0;
57
- }
58
- .bui-dialog-body-button {
54
+ .bui-dialog-actions-btn {
59
55
  flex: 1;
60
56
  display: block;
61
57
  width: 100%;
@@ -70,9 +66,13 @@ xhs-page {
70
66
  text-align: center;
71
67
  box-sizing: border-box;
72
68
  }
73
- .bui-dialog-body-button:first-child {
69
+ .bui-dialog-actions-btn:first-child {
74
70
  border: none;
75
71
  }
76
- .bui-dialog-body-button:active {
77
- background-color: var(--bui-dialog-button-active-background-color);
72
+ .bui-dialog-actions-btn:active {
73
+ background-color: var(--bui-dialog-button-active-bg-color);
74
+ }
75
+ .bui-dialog-input {
76
+ width: calc(100% - 48px);
77
+ margin: 14px 24px 0;
78
78
  }
@@ -1,2 +1,5 @@
1
- export { default, default as Dialog } from './FunctionalDialog';
1
+ import { DialogComponent as DialogComponentType } from './Dialog.types';
2
+ declare const DialogWithMethods: DialogComponentType;
3
+ export default DialogWithMethods;
4
+ export { DialogWithMethods as Dialog };
2
5
  export * from './Dialog.types';
@@ -28,12 +28,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var Dialog_exports = {};
30
30
  __export(Dialog_exports, {
31
- Dialog: () => import_FunctionalDialog.default,
32
- default: () => import_FunctionalDialog.default
31
+ Dialog: () => DialogWithMethods,
32
+ default: () => Dialog_default
33
33
  });
34
34
  module.exports = __toCommonJS(Dialog_exports);
35
+ var import_Dialog = __toESM(require("./Dialog"));
35
36
  var import_FunctionalDialog = __toESM(require("./FunctionalDialog"));
36
37
  __reExport(Dialog_exports, require("./Dialog.types"), module.exports);
38
+ const DialogWithMethods = import_Dialog.default;
39
+ DialogWithMethods.confirm = import_FunctionalDialog.default.confirm;
40
+ DialogWithMethods.prompt = import_FunctionalDialog.default.prompt;
41
+ DialogWithMethods.alert = import_FunctionalDialog.default.alert;
42
+ DialogWithMethods.useDialog = import_FunctionalDialog.default.useDialog;
43
+ var Dialog_default = DialogWithMethods;
37
44
  // Annotate the CommonJS export names for ESM import in node:
38
45
  0 && (module.exports = {
39
46
  Dialog,
@@ -98,7 +98,6 @@ const Drawer = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
98
98
  "transitionDuration"
99
99
  ]);
100
100
  const anchorInvariant = oppositeDirection[anchorProp];
101
- const [keepMounted, setKeepMounted] = (0, import_react.useState)(open);
102
101
  return /* @__PURE__ */ import_react.default.createElement(
103
102
  import_Modal.default,
104
103
  __spreadValues({
@@ -108,17 +107,14 @@ const Drawer = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
108
107
  hideBackdrop,
109
108
  ref,
110
109
  className: (0, import_clsx.default)(prefixCls, className),
111
- disablePortal,
112
- keepMounted
110
+ disablePortal
113
111
  }, others),
114
112
  /* @__PURE__ */ import_react.default.createElement(
115
113
  import_Slide.default,
116
114
  __spreadValues({
117
115
  in: open,
118
116
  direction: anchorInvariant,
119
- timeout: transitionDuration,
120
- onEnter: () => setKeepMounted(true),
121
- onExited: () => setKeepMounted(false)
117
+ timeout: transitionDuration
122
118
  }, SlideProps),
123
119
  /* @__PURE__ */ import_react.default.createElement(
124
120
  "div",
@@ -127,7 +123,11 @@ const Drawer = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
127
123
  `${prefixCls}-content`,
128
124
  `${prefixCls}-content-${anchorProp}`,
129
125
  contentProps == null ? void 0 : contentProps.className
130
- )
126
+ ),
127
+ role: "dialog",
128
+ "aria-modal": "true",
129
+ "aria-label": (contentProps == null ? void 0 : contentProps["aria-label"]) || "Drawer",
130
+ tabIndex: -1
131
131
  }),
132
132
  children
133
133
  )
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ /**
3
+ * 自定义 Drawer 组件 Demo 集合
4
+ * 这个文件包含多个测试 demo,展示如何使用 getCustomDemoCodesFromFile 进行无障碍测试
5
+ * 文件名必须是 A11yDemos.tsx(固定约定)
6
+ */
7
+ export declare const basicDrawerDemo: () => React.JSX.Element;
8
+ export declare const leftDrawerDemo: () => React.JSX.Element;
9
+ export declare const rightDrawerDemo: () => React.JSX.Element;
10
+ export declare const topDrawerDemo: () => React.JSX.Element;
11
+ export declare const noBackdropDrawerDemo: () => React.JSX.Element;
12
+ export declare const interactiveDrawerDemo: () => React.JSX.Element;
13
+ declare const _default: {
14
+ basicDrawerDemo: () => React.JSX.Element;
15
+ leftDrawerDemo: () => React.JSX.Element;
16
+ rightDrawerDemo: () => React.JSX.Element;
17
+ topDrawerDemo: () => React.JSX.Element;
18
+ noBackdropDrawerDemo: () => React.JSX.Element;
19
+ interactiveDrawerDemo: () => React.JSX.Element;
20
+ };
21
+ export default _default;