@bifrostui/react 1.2.9-beta.0 → 1.3.1-beta.0

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 (307) hide show
  1. package/dist/ActionSheet/ActionSheet.css +6 -3
  2. package/dist/ActionSheet/ActionSheetItem.css +10 -6
  3. package/dist/Alert/index.css +14 -8
  4. package/dist/Avatar/Avatar.css +13 -9
  5. package/dist/Avatar/AvatarGroup.css +15 -8
  6. package/dist/Backdrop/Backdrop.css +2 -1
  7. package/dist/Badge/Badge.css +27 -17
  8. package/dist/Breadcrumb/Breadcrumb.css +34 -0
  9. package/dist/Breadcrumb/Breadcrumb.d.ts +5 -0
  10. package/dist/Breadcrumb/Breadcrumb.js +128 -0
  11. package/dist/Breadcrumb/Breadcrumb.types.d.ts +49 -0
  12. package/dist/Breadcrumb/Breadcrumb.types.js +15 -0
  13. package/dist/Breadcrumb/BreadcrumbItem.d.ts +4 -0
  14. package/dist/Breadcrumb/BreadcrumbItem.js +78 -0
  15. package/dist/Breadcrumb/index.d.ts +4 -0
  16. package/dist/Breadcrumb/index.js +45 -0
  17. package/dist/Button/Button.css +26 -17
  18. package/dist/Calendar/Calendar.css +33 -18
  19. package/dist/Calendar/Calendar.d.ts +1 -1
  20. package/dist/Calendar/Calendar.js +85 -18
  21. package/dist/Calendar/Calendar.types.d.ts +33 -0
  22. package/dist/Card/CardFooter.css +2 -1
  23. package/dist/Card/CardHeader.css +3 -1
  24. package/dist/Checkbox/Checkbox.css +7 -5
  25. package/dist/CitySelector/CitySelector.css +29 -15
  26. package/dist/CitySelector/CitySelectorCore.js +25 -16
  27. package/dist/CitySelector/Selector/index.css +4 -4
  28. package/dist/Collapse/Collapse.css +6 -0
  29. package/dist/Collapse/Collapse.d.ts +5 -0
  30. package/dist/Collapse/Collapse.js +165 -0
  31. package/dist/Collapse/Collapse.types.d.ts +16 -0
  32. package/dist/Collapse/Collapse.types.js +15 -0
  33. package/dist/Collapse/index.d.ts +2 -0
  34. package/dist/Collapse/index.js +41 -0
  35. package/dist/CollapsePanel/CollapsePanel.css +32 -0
  36. package/dist/CollapsePanel/CollapsePanel.d.ts +5 -0
  37. package/dist/CollapsePanel/CollapsePanel.js +159 -0
  38. package/dist/CollapsePanel/CollapsePanel.types.d.ts +64 -0
  39. package/dist/CollapsePanel/CollapsePanel.types.js +15 -0
  40. package/dist/CollapsePanel/CollapsePanelItem.d.ts +4 -0
  41. package/dist/CollapsePanel/CollapsePanelItem.js +112 -0
  42. package/dist/CollapsePanel/index.d.ts +4 -0
  43. package/dist/CollapsePanel/index.js +45 -0
  44. package/dist/Countdown/Countdown.css +2 -1
  45. package/dist/Countdown/Countdown.js +3 -0
  46. package/dist/Dialog/Dialog.d.ts +5 -0
  47. package/dist/Dialog/Dialog.js +152 -0
  48. package/dist/Dialog/Dialog.types.d.ts +109 -0
  49. package/dist/Dialog/Dialog.types.js +15 -0
  50. package/dist/Dialog/FunctionalDialog.d.ts +3 -0
  51. package/dist/Dialog/FunctionalDialog.js +204 -0
  52. package/dist/Dialog/index.css +75 -0
  53. package/dist/Dialog/index.d.ts +2 -0
  54. package/dist/Dialog/index.js +41 -0
  55. package/dist/Divider/Divider.css +6 -4
  56. package/dist/IconButton/IconButton.css +9 -7
  57. package/dist/Image/index.css +2 -1
  58. package/dist/Input/Input.css +10 -5
  59. package/dist/List/List.css +3 -0
  60. package/dist/List/ListItem.css +3 -3
  61. package/dist/List/ListItemContent.css +1 -1
  62. package/dist/Loading/Loading.css +4 -2
  63. package/dist/Modal/Modal.miniapp.d.ts +1 -1
  64. package/dist/NavBar/NavBar.css +9 -5
  65. package/dist/Picker/Picker.css +25 -29
  66. package/dist/Picker/Picker.js +31 -11
  67. package/dist/Picker/Picker.types.d.ts +4 -0
  68. package/dist/Picker/PickerPanel.css +8 -8
  69. package/dist/Picker/PickerPanel.js +14 -8
  70. package/dist/Picker/utils.d.ts +16 -0
  71. package/dist/Picker/utils.js +32 -2
  72. package/dist/Popover/Popover.css +97 -0
  73. package/dist/Popover/Popover.d.ts +5 -0
  74. package/dist/Popover/Popover.js +186 -0
  75. package/dist/Popover/Popover.types.d.ts +60 -0
  76. package/dist/Popover/Popover.types.js +15 -0
  77. package/dist/Popover/index.d.ts +2 -0
  78. package/dist/Popover/index.js +41 -0
  79. package/dist/Portal/Portal.types.d.ts +4 -0
  80. package/dist/Portal/PortalCore.js +8 -1
  81. package/dist/Progress/Progress.css +8 -6
  82. package/dist/Radio/Radio.css +2 -1
  83. package/dist/Radio/Radio.js +1 -1
  84. package/dist/Radio/RadioButtonIcon.d.ts +1 -6
  85. package/dist/Radio/RadioButtonIcon.js +0 -3
  86. package/dist/Rating/Rating.css +8 -4
  87. package/dist/Select/Select.css +21 -10
  88. package/dist/Select/Select.js +1 -1
  89. package/dist/Select/SelectOption.js +3 -0
  90. package/dist/Skeleton/Skeleton.css +3 -2
  91. package/dist/Slider/Slider.css +24 -13
  92. package/dist/Steps/Step.css +11 -11
  93. package/dist/Steps/Steps.css +14 -5
  94. package/dist/Swiper/Swiper.css +2 -1
  95. package/dist/Switch/Switch.css +31 -16
  96. package/dist/TabBar/TabBar.css +7 -3
  97. package/dist/TabBar/TabBarItem.css +0 -1
  98. package/dist/Tabs/Tab.css +2 -6
  99. package/dist/Tabs/Tabs.css +7 -4
  100. package/dist/Tag/Tag.css +7 -10
  101. package/dist/Tag/TagGroup.css +9 -1
  102. package/dist/TextArea/TextArea.css +14 -8
  103. package/dist/ThemeProvider/ThemeProvider.d.ts +4 -0
  104. package/dist/ThemeProvider/ThemeProvider.js +90 -0
  105. package/dist/ThemeProvider/ThemeProvider.types.d.ts +127 -0
  106. package/dist/ThemeProvider/ThemeProvider.types.js +27 -0
  107. package/dist/ThemeProvider/hooks/ThemeContext.d.ts +4 -0
  108. package/dist/ThemeProvider/hooks/ThemeContext.js +35 -0
  109. package/dist/ThemeProvider/hooks/createTheme.d.ts +2 -0
  110. package/dist/ThemeProvider/hooks/createTheme.js +55 -0
  111. package/dist/ThemeProvider/hooks/index.d.ts +4 -0
  112. package/dist/ThemeProvider/hooks/index.js +43 -0
  113. package/dist/ThemeProvider/hooks/useTheme.d.ts +1 -0
  114. package/dist/ThemeProvider/hooks/useTheme.js +39 -0
  115. package/dist/ThemeProvider/index.d.ts +4 -0
  116. package/dist/ThemeProvider/index.js +45 -0
  117. package/dist/ThemeProvider/utils/constants.d.ts +38 -0
  118. package/dist/ThemeProvider/utils/constants.js +65 -0
  119. package/dist/ThemeProvider/utils/index.d.ts +2 -0
  120. package/dist/ThemeProvider/utils/index.js +23 -0
  121. package/dist/ThemeProvider/utils/mountTokens.d.ts +26 -0
  122. package/dist/ThemeProvider/utils/mountTokens.js +123 -0
  123. package/dist/Toast/FunctionalToast.d.ts +3 -0
  124. package/dist/Toast/FunctionalToast.js +177 -0
  125. package/dist/Toast/Toast.css +56 -0
  126. package/dist/Toast/Toast.d.ts +5 -0
  127. package/dist/Toast/Toast.js +121 -0
  128. package/dist/Toast/Toast.types.d.ts +101 -0
  129. package/dist/Toast/Toast.types.js +15 -0
  130. package/dist/Toast/index.d.ts +2 -0
  131. package/dist/Toast/index.js +41 -0
  132. package/dist/Tooltip/Tooltip.css +91 -0
  133. package/dist/Tooltip/Tooltip.d.ts +5 -0
  134. package/dist/Tooltip/Tooltip.js +177 -0
  135. package/dist/Tooltip/Tooltip.types.d.ts +51 -0
  136. package/dist/Tooltip/Tooltip.types.js +15 -0
  137. package/dist/Tooltip/index.d.ts +2 -0
  138. package/dist/Tooltip/index.js +41 -0
  139. package/dist/Transition/Transition.miniapp.js +7 -1
  140. package/dist/index.d.ts +9 -0
  141. package/dist/index.js +19 -1
  142. package/dist/locales/base.d.ts +40 -0
  143. package/dist/locales/base.js +15 -0
  144. package/dist/locales/en-US.d.ts +3 -0
  145. package/dist/locales/en-US.js +69 -0
  146. package/dist/locales/hooks/useLocaleText.d.ts +3 -0
  147. package/dist/locales/hooks/useLocaleText.js +43 -0
  148. package/dist/locales/index.d.ts +5 -0
  149. package/dist/locales/index.js +49 -0
  150. package/dist/locales/zh-CN.d.ts +3 -0
  151. package/dist/locales/zh-CN.js +51 -0
  152. package/dist/locales/zh-TW.d.ts +3 -0
  153. package/dist/locales/zh-TW.js +51 -0
  154. package/es/ActionSheet/ActionSheet.css +6 -3
  155. package/es/ActionSheet/ActionSheetItem.css +10 -6
  156. package/es/Alert/index.css +14 -8
  157. package/es/Avatar/Avatar.css +13 -9
  158. package/es/Avatar/AvatarGroup.css +15 -8
  159. package/es/Backdrop/Backdrop.css +2 -1
  160. package/es/Badge/Badge.css +27 -17
  161. package/es/Breadcrumb/Breadcrumb.css +34 -0
  162. package/es/Breadcrumb/Breadcrumb.d.ts +5 -0
  163. package/es/Breadcrumb/Breadcrumb.js +101 -0
  164. package/es/Breadcrumb/Breadcrumb.types.d.ts +49 -0
  165. package/es/Breadcrumb/Breadcrumb.types.js +1 -0
  166. package/es/Breadcrumb/BreadcrumbItem.d.ts +4 -0
  167. package/es/Breadcrumb/BreadcrumbItem.js +51 -0
  168. package/es/Breadcrumb/index.d.ts +4 -0
  169. package/es/Breadcrumb/index.js +9 -0
  170. package/es/Button/Button.css +26 -17
  171. package/es/Calendar/Calendar.css +33 -18
  172. package/es/Calendar/Calendar.d.ts +1 -1
  173. package/es/Calendar/Calendar.js +91 -19
  174. package/es/Calendar/Calendar.types.d.ts +33 -0
  175. package/es/Card/CardFooter.css +2 -1
  176. package/es/Card/CardHeader.css +3 -1
  177. package/es/Checkbox/Checkbox.css +7 -5
  178. package/es/CitySelector/CitySelector.css +29 -15
  179. package/es/CitySelector/CitySelectorCore.js +25 -16
  180. package/es/CitySelector/Selector/index.css +4 -4
  181. package/es/Collapse/Collapse.css +6 -0
  182. package/es/Collapse/Collapse.d.ts +5 -0
  183. package/es/Collapse/Collapse.js +144 -0
  184. package/es/Collapse/Collapse.types.d.ts +16 -0
  185. package/es/Collapse/Collapse.types.js +1 -0
  186. package/es/Collapse/index.d.ts +2 -0
  187. package/es/Collapse/index.js +6 -0
  188. package/es/CollapsePanel/CollapsePanel.css +32 -0
  189. package/es/CollapsePanel/CollapsePanel.d.ts +5 -0
  190. package/es/CollapsePanel/CollapsePanel.js +132 -0
  191. package/es/CollapsePanel/CollapsePanel.types.d.ts +64 -0
  192. package/es/CollapsePanel/CollapsePanel.types.js +1 -0
  193. package/es/CollapsePanel/CollapsePanelItem.d.ts +4 -0
  194. package/es/CollapsePanel/CollapsePanelItem.js +85 -0
  195. package/es/CollapsePanel/index.d.ts +4 -0
  196. package/es/CollapsePanel/index.js +9 -0
  197. package/es/Countdown/Countdown.css +2 -1
  198. package/es/Countdown/Countdown.js +3 -0
  199. package/es/Dialog/Dialog.d.ts +5 -0
  200. package/es/Dialog/Dialog.js +125 -0
  201. package/es/Dialog/Dialog.types.d.ts +109 -0
  202. package/es/Dialog/Dialog.types.js +1 -0
  203. package/es/Dialog/FunctionalDialog.d.ts +3 -0
  204. package/es/Dialog/FunctionalDialog.js +177 -0
  205. package/es/Dialog/index.css +75 -0
  206. package/es/Dialog/index.d.ts +2 -0
  207. package/es/Dialog/index.js +6 -0
  208. package/es/Divider/Divider.css +6 -4
  209. package/es/IconButton/IconButton.css +9 -7
  210. package/es/Image/index.css +2 -1
  211. package/es/Input/Input.css +10 -5
  212. package/es/List/List.css +3 -0
  213. package/es/List/ListItem.css +3 -3
  214. package/es/List/ListItemContent.css +1 -1
  215. package/es/Loading/Loading.css +4 -2
  216. package/es/Modal/Modal.miniapp.d.ts +1 -1
  217. package/es/NavBar/NavBar.css +9 -5
  218. package/es/Picker/Picker.css +25 -29
  219. package/es/Picker/Picker.js +32 -12
  220. package/es/Picker/Picker.types.d.ts +4 -0
  221. package/es/Picker/PickerPanel.css +8 -8
  222. package/es/Picker/PickerPanel.js +14 -8
  223. package/es/Picker/utils.d.ts +16 -0
  224. package/es/Picker/utils.js +29 -1
  225. package/es/Popover/Popover.css +97 -0
  226. package/es/Popover/Popover.d.ts +5 -0
  227. package/es/Popover/Popover.js +159 -0
  228. package/es/Popover/Popover.types.d.ts +60 -0
  229. package/es/Popover/Popover.types.js +1 -0
  230. package/es/Popover/index.d.ts +2 -0
  231. package/es/Popover/index.js +6 -0
  232. package/es/Portal/Portal.types.d.ts +4 -0
  233. package/es/Portal/PortalCore.js +8 -1
  234. package/es/Progress/Progress.css +8 -6
  235. package/es/Radio/Radio.css +2 -1
  236. package/es/Radio/Radio.js +1 -1
  237. package/es/Radio/RadioButtonIcon.d.ts +1 -6
  238. package/es/Radio/RadioButtonIcon.js +0 -3
  239. package/es/Rating/Rating.css +8 -4
  240. package/es/Select/Select.css +21 -10
  241. package/es/Select/Select.js +1 -1
  242. package/es/Select/SelectOption.js +3 -0
  243. package/es/Skeleton/Skeleton.css +3 -2
  244. package/es/Slider/Slider.css +24 -13
  245. package/es/Steps/Step.css +11 -11
  246. package/es/Steps/Steps.css +14 -5
  247. package/es/Swiper/Swiper.css +2 -1
  248. package/es/Switch/Switch.css +31 -16
  249. package/es/TabBar/TabBar.css +7 -3
  250. package/es/TabBar/TabBarItem.css +0 -1
  251. package/es/Tabs/Tab.css +2 -6
  252. package/es/Tabs/Tabs.css +7 -4
  253. package/es/Tag/Tag.css +7 -10
  254. package/es/Tag/TagGroup.css +9 -1
  255. package/es/TextArea/TextArea.css +14 -8
  256. package/es/ThemeProvider/ThemeProvider.d.ts +4 -0
  257. package/es/ThemeProvider/ThemeProvider.js +61 -0
  258. package/es/ThemeProvider/ThemeProvider.types.d.ts +127 -0
  259. package/es/ThemeProvider/ThemeProvider.types.js +1 -0
  260. package/es/ThemeProvider/hooks/ThemeContext.d.ts +4 -0
  261. package/es/ThemeProvider/hooks/ThemeContext.js +6 -0
  262. package/es/ThemeProvider/hooks/createTheme.d.ts +2 -0
  263. package/es/ThemeProvider/hooks/createTheme.js +38 -0
  264. package/es/ThemeProvider/hooks/index.d.ts +4 -0
  265. package/es/ThemeProvider/hooks/index.js +8 -0
  266. package/es/ThemeProvider/hooks/useTheme.d.ts +1 -0
  267. package/es/ThemeProvider/hooks/useTheme.js +10 -0
  268. package/es/ThemeProvider/index.d.ts +4 -0
  269. package/es/ThemeProvider/index.js +8 -0
  270. package/es/ThemeProvider/utils/constants.d.ts +38 -0
  271. package/es/ThemeProvider/utils/constants.js +40 -0
  272. package/es/ThemeProvider/utils/index.d.ts +2 -0
  273. package/es/ThemeProvider/utils/index.js +2 -0
  274. package/es/ThemeProvider/utils/mountTokens.d.ts +26 -0
  275. package/es/ThemeProvider/utils/mountTokens.js +88 -0
  276. package/es/Toast/FunctionalToast.d.ts +3 -0
  277. package/es/Toast/FunctionalToast.js +150 -0
  278. package/es/Toast/Toast.css +56 -0
  279. package/es/Toast/Toast.d.ts +5 -0
  280. package/es/Toast/Toast.js +99 -0
  281. package/es/Toast/Toast.types.d.ts +101 -0
  282. package/es/Toast/Toast.types.js +1 -0
  283. package/es/Toast/index.d.ts +2 -0
  284. package/es/Toast/index.js +6 -0
  285. package/es/Tooltip/Tooltip.css +91 -0
  286. package/es/Tooltip/Tooltip.d.ts +5 -0
  287. package/es/Tooltip/Tooltip.js +150 -0
  288. package/es/Tooltip/Tooltip.types.d.ts +51 -0
  289. package/es/Tooltip/Tooltip.types.js +1 -0
  290. package/es/Tooltip/index.d.ts +2 -0
  291. package/es/Tooltip/index.js +6 -0
  292. package/es/Transition/Transition.miniapp.js +7 -1
  293. package/es/index.d.ts +9 -0
  294. package/es/index.js +9 -0
  295. package/es/locales/base.d.ts +40 -0
  296. package/es/locales/base.js +0 -0
  297. package/es/locales/en-US.d.ts +3 -0
  298. package/es/locales/en-US.js +50 -0
  299. package/es/locales/hooks/useLocaleText.d.ts +3 -0
  300. package/es/locales/hooks/useLocaleText.js +26 -0
  301. package/es/locales/index.d.ts +5 -0
  302. package/es/locales/index.js +11 -0
  303. package/es/locales/zh-CN.d.ts +3 -0
  304. package/es/locales/zh-CN.js +32 -0
  305. package/es/locales/zh-TW.d.ts +3 -0
  306. package/es/locales/zh-TW.js +32 -0
  307. package/package.json +5 -5
@@ -1,14 +1,29 @@
1
1
  .bui-city-selector {
2
+ --select-item-width: var(--bui-city-selector-item-width, 111px);
3
+ --select-item-height: var(--bui-city-selector-item-height, 36px);
4
+ --select-item-border-radius: var(--bui-city-selector-item-border-radius, 20px);
5
+ --select-item-margin: var(--bui-city-selector-item-margin, 4.5px 0 4.5px 9px);
6
+ --title-height: var(--bui-city-selector-title-height, 45px);
7
+ --title-line-height: var(--bui-city-selector-title-line-height, 45px);
8
+ --btn-close-size: var(--bui-city-selector-btn-close-size, 45px);
9
+ --btn-close-font-size: var(--bui-city-selector-btn-close-font-size, 20px);
10
+ --container-with-title-height: var(--bui-city-selector-container-with-title-height, calc(100% - var(--title-height)));
11
+ --city-container-min-height: var(--bui-city-selector-city-container-min-height, 500px);
12
+ --select-city-buttons-padding: var(--bui-city-selector-select-city-buttons-padding, 7.5px 0 0 3px);
13
+ --select-city-title-line-height: var(--bui-city-selector-select-city-title-line-height, 15px);
14
+ --list-item-height: var(--bui-city-selector-list-item-height, 45px);
15
+ --city-index-has-title-top: var(--bui-city-selector-city-index-has-title-top, calc(50% + var(--title-height) / 2));
16
+ --index-item-height: var(--bui-city-selector-index-item-height, 20px);
2
17
  font-family: var(--bui-font-family);
3
18
  height: 100%;
4
19
  position: relative;
5
20
  }
6
21
  .bui-city-selector-title {
7
22
  width: 100%;
8
- height: 45px;
23
+ height: var(--title-height);
9
24
  color: var(--bui-color-fg-default);
10
25
  font-size: var(--bui-title-size-3);
11
- line-height: 45px;
26
+ line-height: var(--title-line-height);
12
27
  text-align: center;
13
28
  position: sticky;
14
29
  top: 0;
@@ -20,20 +35,20 @@
20
35
  position: absolute;
21
36
  top: 0;
22
37
  right: 0;
23
- width: 45px;
24
- height: 45px;
38
+ width: var(--btn-close-size);
39
+ height: var(--btn-close-size);
25
40
  color: var(--bui-color-fg-muted);
26
41
  text-align: center;
27
- font-size: 20px;
42
+ font-size: var(--btn-close-font-size);
28
43
  }
29
44
  .bui-city-selector-scroll-view-container {
30
45
  height: 100%;
31
46
  }
32
47
  .bui-city-selector-scroll-view-container.container-has-title {
33
- height: calc(100% - 45px);
48
+ height: var(--container-with-title-height);
34
49
  }
35
50
  .bui-city-selector-all-city {
36
- min-height: 500px;
51
+ min-height: var(--city-container-min-height);
37
52
  font-size: var(--bui-text-size-2);
38
53
  width: 100%;
39
54
  background: var(--bui-color-bg-view);
@@ -42,22 +57,21 @@
42
57
  .bui-city-selector-all-city .select-city-buttons {
43
58
  display: flex;
44
59
  flex-flow: wrap;
45
- padding-left: 3px;
46
- padding-top: 7.5px;
60
+ padding: var(--select-city-buttons-padding);
47
61
  }
48
62
  .bui-city-selector-all-city .select-city-title {
49
63
  font-size: var(--bui-title-size-4);
50
- line-height: 15px;
51
- font-weight: 600;
64
+ line-height: var(--select-city-title-line-height);
65
+ font-weight: var(--bui-font-weight-bold);
52
66
  padding-left: var(--bui-spacing-lg);
53
- padding-top: 9px;
67
+ padding-top: var(--bui-spacing-md);
54
68
  }
55
69
  .bui-city-selector-list {
56
70
  padding-left: var(--bui-spacing-lg);
57
71
  list-style-type: none;
58
72
  }
59
73
  .bui-city-selector-list-item {
60
- height: 45px;
74
+ height: var(--list-item-height);
61
75
  font-size: var(--bui-title-size-4);
62
76
  display: flex;
63
77
  align-items: center;
@@ -81,7 +95,7 @@
81
95
  transform: translate(0, -50%);
82
96
  }
83
97
  .bui-city-selector-index-container.city-index-has-title {
84
- top: calc(50% + 22.5px);
98
+ top: var(--city-index-has-title-top);
85
99
  }
86
100
  .bui-city-selector-index-container ul {
87
101
  margin: 0;
@@ -92,7 +106,7 @@
92
106
  }
93
107
  .bui-city-selector-index-container li {
94
108
  list-style: none;
95
- height: 20px;
109
+ height: var(--index-item-height);
96
110
  text-align: center;
97
111
  font-size: var(--bui-text-size-3);
98
112
  color: var(--bui-color-info, --bui-color-info);
@@ -29,34 +29,31 @@ var __objRest = (source, exclude) => {
29
29
  import React, { useState, useEffect, useRef } from "react";
30
30
  import clsx from "clsx";
31
31
  import { throttle, useForkRef, useTouchEmulator } from "@bifrostui/utils";
32
+ import { useLocaleText } from "../locales";
32
33
  import ScrollView from "../ScrollView";
33
34
  import Selector from "./Selector";
34
35
  import "./CitySelector.css";
35
36
  const DEVIATION_HEIGHT = "6vmin";
36
- const GPS_TYPE = {
37
- title: "\u5B9A\u4F4D",
38
- code: "GPS"
39
- };
40
- const CURRENT_TYPE = {
41
- title: "\u5F53\u524D",
42
- code: "CRRT"
43
- };
44
- const HOT_CITY_TYPE = {
45
- title: "\u70ED\u95E8",
46
- code: "HOT"
47
- };
48
37
  const prefixCls = "bui-city-selector";
49
38
  const CitySelector = /* @__PURE__ */ React.forwardRef(
50
39
  (props, ref) => {
40
+ const {
41
+ selectedCityGroupName: selectedCityGroupLocaleName,
42
+ currentCityGroupName: currentCityGroupLocaleName,
43
+ hotCitiesGroupName: hotCitiesGroupLocaleName,
44
+ located,
45
+ current,
46
+ hot
47
+ } = useLocaleText("citySelector");
51
48
  const _a = props, {
52
49
  className,
53
50
  title: pageTitle,
54
51
  selectedCity,
55
- selectedCityGroupName = "\u5F53\u524D\u57CE\u5E02",
52
+ selectedCityGroupName = selectedCityGroupLocaleName,
56
53
  currentCity,
57
- currentCityGroupName = "\u5B9A\u4F4D\u57CE\u5E02",
54
+ currentCityGroupName = currentCityGroupLocaleName,
58
55
  hotCities,
59
- hotCitiesGroupName = "\u70ED\u95E8\u57CE\u5E02",
56
+ hotCitiesGroupName = hotCitiesGroupLocaleName,
60
57
  cities,
61
58
  disableIndex,
62
59
  touchHandler,
@@ -79,6 +76,18 @@ const CitySelector = /* @__PURE__ */ React.forwardRef(
79
76
  "onSelect",
80
77
  "onClose"
81
78
  ]);
79
+ const GPS_TYPE = {
80
+ title: located,
81
+ code: "GPS"
82
+ };
83
+ const CURRENT_TYPE = {
84
+ title: current,
85
+ code: "CRRT"
86
+ };
87
+ const HOT_CITY_TYPE = {
88
+ title: hot,
89
+ code: "HOT"
90
+ };
82
91
  const cityRef = useRef(null);
83
92
  const nodeRef = useForkRef(ref, cityRef);
84
93
  useTouchEmulator(cityRef.current);
@@ -137,7 +146,7 @@ const CitySelector = /* @__PURE__ */ React.forwardRef(
137
146
  };
138
147
  const renderTitile = (title, titleCode) => {
139
148
  const parseTitle = (titleCode || title).toUpperCase();
140
- return /* @__PURE__ */ React.createElement("div", { className: "select-city-title", id: disableIndex ? "" : parseTitle }, title.toUpperCase());
149
+ return /* @__PURE__ */ React.createElement("div", { className: "select-city-title", id: disableIndex ? "" : parseTitle }, title == null ? void 0 : title.toUpperCase());
141
150
  };
142
151
  const renderCity = (citys, title, titleCode) => {
143
152
  return /* @__PURE__ */ React.createElement("div", null, renderTitile(title, titleCode), /* @__PURE__ */ React.createElement("div", { className: "select-city-buttons" }, citys.map((city, index) => {
@@ -1,11 +1,11 @@
1
1
  .bui-city-selector-item {
2
- width: 111px;
3
- height: 36px;
2
+ width: var(--select-item-width);
3
+ height: var(--select-item-height);
4
4
  display: inline-flex;
5
5
  justify-content: center;
6
6
  align-items: center;
7
- border-radius: 20px;
8
- margin: 4.5px 0 4.5px 9px;
7
+ border-radius: var(--select-item-border-radius);
8
+ margin: var(--select-item-margin);
9
9
  background-color: var(--bui-color-bg-default);
10
10
  font-size: var(--bui-text-size-2);
11
11
  }
@@ -0,0 +1,6 @@
1
+ .bui-collapse {
2
+ overflow: hidden;
3
+ white-space: nowrap;
4
+ height: fit-content;
5
+ width: fit-content;
6
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { CollapseProps } from './Collapse.types';
3
+ import './Collapse.less';
4
+ declare const Collapse: React.ForwardRefExoticComponent<CollapseProps & React.RefAttributes<unknown>>;
5
+ export default Collapse;
@@ -0,0 +1,144 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ import React, { useEffect, useRef } from "react";
33
+ import {
34
+ useForkRef,
35
+ duration,
36
+ easing,
37
+ getTransitionProps,
38
+ createTransitions
39
+ } from "@bifrostui/utils";
40
+ import { Transition } from "../Transition";
41
+ import "./Collapse.css";
42
+ const defaultEasing = {
43
+ enter: easing.easeOut,
44
+ exit: easing.sharp
45
+ };
46
+ const defaultTimeout = {
47
+ enter: duration.enteringScreen,
48
+ exit: duration.leavingScreen
49
+ };
50
+ const Collapse = /* @__PURE__ */ React.forwardRef((props, ref) => {
51
+ const _a = props, {
52
+ appear = false,
53
+ in: inProp,
54
+ easing: easingProp = defaultEasing,
55
+ direction = "vertical",
56
+ timeout = defaultTimeout,
57
+ delay = 0,
58
+ collapsedSize: collapsedSizeProp = 0,
59
+ style,
60
+ className,
61
+ children
62
+ } = _a, other = __objRest(_a, [
63
+ "appear",
64
+ "in",
65
+ "easing",
66
+ "direction",
67
+ "timeout",
68
+ "delay",
69
+ "collapsedSize",
70
+ "style",
71
+ "className",
72
+ "children"
73
+ ]);
74
+ const nodeRef = useForkRef(ref);
75
+ const wrapperRef = useRef(null);
76
+ const collapseRef = useForkRef(wrapperRef, ref);
77
+ const transitions = createTransitions();
78
+ const isHorizontal = direction === "horizontal";
79
+ const collapsedSize = typeof collapsedSizeProp === "number" ? `${collapsedSizeProp}px` : collapsedSizeProp;
80
+ const size = isHorizontal ? "width" : "height";
81
+ const getCollapseWrapperSize = (reactNode) => {
82
+ return reactNode ? `${reactNode[isHorizontal ? "clientWidth" : "clientHeight"]}px` : "fit-content";
83
+ };
84
+ useEffect(() => {
85
+ var _a2, _b, _c, _d;
86
+ if (appear === false && inProp === true && ((_b = (_a2 = wrapperRef.current) == null ? void 0 : _a2.style) == null ? void 0 : _b[size]) === "fit-content") {
87
+ wrapperRef.current.style[size] = getCollapseWrapperSize(
88
+ (_d = (_c = wrapperRef.current) == null ? void 0 : _c.children) == null ? void 0 : _d[0]
89
+ );
90
+ }
91
+ }, [appear, inProp]);
92
+ if (!children)
93
+ return null;
94
+ return /* @__PURE__ */ React.createElement(
95
+ Transition,
96
+ __spreadProps(__spreadValues({}, other), {
97
+ ref: nodeRef,
98
+ in: inProp,
99
+ timeout,
100
+ delay,
101
+ appear
102
+ }),
103
+ (state, childProps) => {
104
+ var _a2;
105
+ const transition = transitions.create(
106
+ size,
107
+ getTransitionProps(
108
+ { timeout, style, easing: easingProp, delay },
109
+ { mode: state }
110
+ )
111
+ );
112
+ const wrapperSize = () => {
113
+ var _a3, _b;
114
+ const collapseWrapperSize = state === "entering" || state === "entered" ? getCollapseWrapperSize((_b = (_a3 = wrapperRef.current) == null ? void 0 : _a3.children) == null ? void 0 : _b[0]) : collapsedSize;
115
+ return isHorizontal ? {
116
+ width: collapseWrapperSize,
117
+ WebKitWidth: collapseWrapperSize
118
+ } : {
119
+ height: collapseWrapperSize,
120
+ WebKitHeight: collapseWrapperSize
121
+ };
122
+ };
123
+ return React.createElement(
124
+ "div",
125
+ {
126
+ className: `bui-collapse ${className}`,
127
+ style: __spreadValues(__spreadProps(__spreadValues({}, style), {
128
+ transition,
129
+ WebkitTransition: transition
130
+ }), wrapperSize()),
131
+ ref: collapseRef
132
+ },
133
+ React.cloneElement(children, __spreadValues({
134
+ style: __spreadValues({}, (_a2 = children.props) == null ? void 0 : _a2.style)
135
+ }, childProps))
136
+ );
137
+ }
138
+ );
139
+ });
140
+ Collapse.displayName = "BuiCollapse";
141
+ var Collapse_default = Collapse;
142
+ export {
143
+ Collapse_default as default
144
+ };
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { TransitionProps } from '../Transition';
3
+ export interface CollapseProps extends Omit<TransitionProps, 'children'> {
4
+ easing?: string | {
5
+ enter?: string;
6
+ exit?: string;
7
+ };
8
+ children?: React.ReactElement;
9
+ /**
10
+ * 折叠的方向
11
+ * horizontal - 水平方向
12
+ * vertical - 垂直方向
13
+ */
14
+ direction?: 'horizontal' | 'vertical';
15
+ collapsedSize?: string | number;
16
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default, default as Collapse } from './Collapse';
2
+ export * from './Collapse.types';
@@ -0,0 +1,6 @@
1
+ import { default as default2, default as default3 } from "./Collapse";
2
+ export * from "./Collapse.types";
3
+ export {
4
+ default3 as Collapse,
5
+ default2 as default
6
+ };
@@ -0,0 +1,32 @@
1
+ .bui-collapse-panel {
2
+ --width: var(--bui-collapse-panel-width, 100%);
3
+ --header-padding: var(--bui-collapse-panel-header-padding, var(--bui-spacing-lg) 0);
4
+ --content-padding: var(--bui-collapse-panel-content-padding, var(--bui-spacing-lg) 0);
5
+ width: var(--width);
6
+ background-color: var(--bui-color-bg-view);
7
+ color: var(--bui-color-fg-default);
8
+ }
9
+ .bui-collapse-panel-item-header {
10
+ display: flex;
11
+ align-items: center;
12
+ justify-content: space-between;
13
+ border-bottom: solid 1px #eee;
14
+ cursor: pointer;
15
+ }
16
+ .bui-collapse-panel-item-header-label {
17
+ padding: var(--header-padding);
18
+ font-size: var(--bui-title-size-2);
19
+ }
20
+ .bui-collapse-panel-item-header-icon-arrow {
21
+ transform: rotate(0deg);
22
+ transition: all 0.3s ease;
23
+ }
24
+ .bui-collapse-panel-item-header-icon-arrow-active {
25
+ transform: rotate(-180deg);
26
+ }
27
+ .bui-collapse-panel-item-content {
28
+ padding: var(--content-padding);
29
+ font-size: var(--bui-text-size-1);
30
+ transition: height 0.5s ease;
31
+ overflow: hidden;
32
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { CollapsePanelProps } from './CollapsePanel.types';
3
+ import './CollapsePanel.less';
4
+ declare const CollapsePanel: React.ForwardRefExoticComponent<Omit<CollapsePanelProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
+ export default CollapsePanel;
@@ -0,0 +1,132 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ import React from "react";
33
+ import clsx from "clsx";
34
+ import { ArrowDownwardLargeIcon } from "@bifrostui/icons";
35
+ import { useValue } from "@bifrostui/utils";
36
+ import CollapseItem from "./CollapsePanelItem";
37
+ import "./CollapsePanel.css";
38
+ const prefixCls = "bui-collapse-panel";
39
+ const CollapsePanel = /* @__PURE__ */ React.forwardRef(
40
+ (props, ref) => {
41
+ const _a = props, {
42
+ className,
43
+ style,
44
+ accordion = false,
45
+ activeKeys,
46
+ defaultActiveKeys,
47
+ items,
48
+ children,
49
+ arrowIcon,
50
+ onChange
51
+ } = _a, others = __objRest(_a, [
52
+ "className",
53
+ "style",
54
+ "accordion",
55
+ "activeKeys",
56
+ "defaultActiveKeys",
57
+ "items",
58
+ "children",
59
+ "arrowIcon",
60
+ "onChange"
61
+ ]);
62
+ const [openKeys, setOpenKeys] = useValue({
63
+ defaultValue: defaultActiveKeys || [],
64
+ value: activeKeys
65
+ });
66
+ const handleClick = (event, target) => {
67
+ var _a2;
68
+ const targetKey = target == null ? void 0 : target.key;
69
+ let newOpenKeys = [];
70
+ if (accordion) {
71
+ newOpenKeys = openKeys.includes(targetKey) ? [] : [targetKey];
72
+ } else {
73
+ newOpenKeys = openKeys.includes(targetKey) ? openKeys.filter((k) => k !== targetKey) : [targetKey, ...openKeys];
74
+ }
75
+ setOpenKeys(event, newOpenKeys);
76
+ onChange == null ? void 0 : onChange(event, { activeKeys: newOpenKeys });
77
+ (_a2 = target == null ? void 0 : target.onClick) == null ? void 0 : _a2.call(target, event);
78
+ };
79
+ const getArrowIcon = () => {
80
+ if (arrowIcon) {
81
+ return arrowIcon;
82
+ }
83
+ return /* @__PURE__ */ React.createElement(ArrowDownwardLargeIcon, null);
84
+ };
85
+ const renderList = () => {
86
+ if (Array.isArray(items)) {
87
+ return items.map((item) => {
88
+ const _a2 = item, { key } = _a2, otherProps = __objRest(_a2, ["key"]);
89
+ return /* @__PURE__ */ React.createElement(
90
+ CollapseItem,
91
+ __spreadProps(__spreadValues({
92
+ key,
93
+ icon: getArrowIcon(),
94
+ active: openKeys.includes(item.key)
95
+ }, otherProps), {
96
+ onClick: (e) => handleClick(e, item)
97
+ })
98
+ );
99
+ });
100
+ }
101
+ const enhancedChildren = React.Children.map(children, (child) => {
102
+ if (React.isValidElement(child)) {
103
+ const newProps = {
104
+ icon: getArrowIcon(),
105
+ active: openKeys.includes(child.key),
106
+ onClick: (e) => handleClick(e, child)
107
+ };
108
+ return React.cloneElement(child, newProps);
109
+ }
110
+ return child;
111
+ });
112
+ return enhancedChildren;
113
+ };
114
+ if (items == null && children == null) {
115
+ return null;
116
+ }
117
+ return /* @__PURE__ */ React.createElement(
118
+ "div",
119
+ __spreadValues({
120
+ className: clsx(prefixCls, className),
121
+ style,
122
+ ref
123
+ }, others),
124
+ /* @__PURE__ */ React.createElement("div", { className: `${prefixCls}-list` }, renderList())
125
+ );
126
+ }
127
+ );
128
+ CollapsePanel.displayName = "BuiCollapsePanel";
129
+ var CollapsePanel_default = CollapsePanel;
130
+ export {
131
+ CollapsePanel_default as default
132
+ };
@@ -0,0 +1,64 @@
1
+ import { OverrideProps } from '@bifrostui/types';
2
+ import React from 'react';
3
+ export type CollapsePanelItemProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
4
+ props: P & {
5
+ /**
6
+ * 唯一标识,对应 activeKey
7
+ */
8
+ key?: string | number;
9
+ /**
10
+ * 面板标题
11
+ */
12
+ label?: React.ReactNode;
13
+ /**
14
+ * 自定义 icon
15
+ */
16
+ icon?: React.ReactNode | ((active: boolean) => React.ReactNode);
17
+ /**
18
+ * 是否展开
19
+ * @default false
20
+ */
21
+ active?: boolean;
22
+ /**
23
+ * body 区域内容
24
+ */
25
+ children?: React.ReactNode;
26
+ };
27
+ defaultComponent: D;
28
+ }, D>;
29
+ export type CollapsePanelProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
30
+ props: P & {
31
+ /**
32
+ * 是否开启手风琴模式
33
+ * @default false
34
+ */
35
+ accordion?: boolean;
36
+ /**
37
+ * 当前激活面板的 key
38
+ */
39
+ activeKeys?: (number | string)[];
40
+ /**
41
+ * 默认展开面板的 key
42
+ */
43
+ defaultActiveKeys?: (number | string)[];
44
+ /**
45
+ * 折叠项目内容
46
+ */
47
+ items?: Array<CollapsePanelItemProps>;
48
+ /**
49
+ * body 区域内容,使用 CollapseItem 进行渲染
50
+ */
51
+ children?: React.ReactNode;
52
+ /**
53
+ * 自定义箭头图标
54
+ */
55
+ arrowIcon?: React.ReactNode | ((active: boolean) => React.ReactNode);
56
+ /**
57
+ * 切换面板时触发
58
+ */
59
+ onChange?: (e: React.SyntheticEvent, params: {
60
+ activeKeys: (number | string)[];
61
+ }) => void;
62
+ };
63
+ defaultComponent: D;
64
+ }, D>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { CollapsePanelItemProps } from './CollapsePanel.types';
3
+ declare const CollapsePanelItem: React.ForwardRefExoticComponent<Omit<CollapsePanelItemProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
+ export default CollapsePanelItem;