@bifrostui/react 1.4.8-beta.0 → 2.0.0-beta.1

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 (313) hide show
  1. package/dist/ActionSheet/ActionSheet.css +2 -2
  2. package/dist/ActionSheet/ActionSheetItem.js +3 -8
  3. package/dist/Avatar/Avatar.js +3 -8
  4. package/dist/Avatar/AvatarGroup.js +2 -6
  5. package/dist/Badge/Badge.js +3 -8
  6. package/dist/Button/Button.css +77 -78
  7. package/dist/Button/Button.d.ts +1 -1
  8. package/dist/Button/Button.js +4 -10
  9. package/dist/Button/Button.types.d.ts +8 -7
  10. package/dist/Calendar/Calendar.js +7 -19
  11. package/dist/Calendar/Calendar.types.d.ts +0 -5
  12. package/dist/Card/Card.css +1 -1
  13. package/dist/Card/CardContent.css +1 -2
  14. package/dist/Card/CardFooter.css +2 -4
  15. package/dist/Card/CardHeader.css +4 -5
  16. package/dist/Checkbox/Checkbox.js +2 -6
  17. package/dist/Checkbox/CheckboxGroup.js +4 -7
  18. package/dist/Collapse/Collapse.css +1 -0
  19. package/dist/Collapse/Collapse.d.ts +1 -1
  20. package/dist/Collapse/Collapse.js +8 -11
  21. package/dist/CollapsePanel/CollapsePanel.css +2 -4
  22. package/dist/CollapsePanel/CollapsePanelItem.js +45 -46
  23. package/dist/Countdown/Countdown.js +5 -12
  24. package/dist/Dialog/FunctionalDialog.js +1 -1
  25. package/dist/Divider/Divider.js +8 -5
  26. package/dist/Drawer/Drawer.js +4 -10
  27. package/dist/Fade/Fade.js +52 -56
  28. package/dist/IconButton/IconButton.js +5 -12
  29. package/dist/Image/Image.js +112 -119
  30. package/dist/Input/Input.js +4 -10
  31. package/dist/List/List.js +3 -8
  32. package/dist/List/ListItem.js +42 -44
  33. package/dist/List/ListItemContent.js +1 -4
  34. package/dist/List/ListItemExtra.js +9 -4
  35. package/dist/List/ListItemFooter.js +9 -4
  36. package/dist/List/ListItemHeader.js +9 -4
  37. package/dist/Loading/Loading.js +13 -4
  38. package/dist/Modal/Modal.js +0 -6
  39. package/dist/Modal/Modal.miniapp.js +4 -10
  40. package/dist/NavBar/NavBar.js +0 -1
  41. package/dist/Picker/Picker.css +0 -5
  42. package/dist/Picker/Picker.js +5 -27
  43. package/dist/Picker/Picker.types.d.ts +2 -15
  44. package/dist/Picker/PickerPanel.css +0 -4
  45. package/dist/Picker/PickerPanel.js +6 -7
  46. package/dist/Popover/Popover.css +5 -5
  47. package/dist/Popover/Popover.js +27 -70
  48. package/dist/Portal/Portal.miniapp.js +4 -7
  49. package/dist/Radio/Radio.css +0 -1
  50. package/dist/Radio/Radio.js +2 -6
  51. package/dist/Radio/RadioGroup.js +0 -3
  52. package/dist/Rating/Rating.js +8 -18
  53. package/dist/ScrollView/ScrollView.js +11 -24
  54. package/dist/ScrollView/ScrollView.types.d.ts +1 -0
  55. package/dist/Select/Select.css +4 -1
  56. package/dist/Select/Select.js +41 -68
  57. package/dist/Skeleton/Skeleton.js +5 -9
  58. package/dist/Slide/Slide.js +69 -74
  59. package/dist/Slider/Slider.js +11 -27
  60. package/dist/Steps/Step.js +81 -82
  61. package/dist/Steps/Steps.d.ts +1 -1
  62. package/dist/Steps/Steps.js +57 -60
  63. package/dist/Switch/Switch.js +75 -78
  64. package/dist/TabBar/TabBar.js +3 -8
  65. package/dist/Tabs/Tab.css +10 -16
  66. package/dist/Tabs/Tab.js +2 -3
  67. package/dist/Tabs/Tabs.css +13 -22
  68. package/dist/Tabs/Tabs.js +39 -70
  69. package/dist/Tabs/Tabs.types.d.ts +0 -10
  70. package/dist/Tabs/utils/bound.d.ts +1 -0
  71. package/dist/{DesktopPicker/utils/calcAfterMounted.js → Tabs/utils/bound.js} +14 -7
  72. package/dist/Tag/Tag.css +1 -1
  73. package/dist/Tag/Tag.js +2 -6
  74. package/dist/TextArea/TextArea.js +5 -12
  75. package/dist/Toast/FunctionalToast.js +1 -1
  76. package/dist/Toast/Toast.css +1 -0
  77. package/dist/Tooltip/Tooltip.css +5 -5
  78. package/dist/Tooltip/Tooltip.js +27 -70
  79. package/dist/Transition/TransitionCore.js +3 -8
  80. package/dist/index.d.ts +0 -6
  81. package/dist/index.js +1 -13
  82. package/dist/locales/base.d.ts +0 -11
  83. package/dist/locales/en-US.js +0 -24
  84. package/dist/locales/zh-CN.js +0 -24
  85. package/dist/locales/zh-TW.js +0 -24
  86. package/es/ActionSheet/ActionSheet.css +2 -2
  87. package/es/ActionSheet/ActionSheetItem.js +3 -8
  88. package/es/Avatar/Avatar.js +3 -8
  89. package/es/Avatar/AvatarGroup.js +2 -6
  90. package/es/Badge/Badge.js +3 -8
  91. package/es/Button/Button.css +77 -78
  92. package/es/Button/Button.d.ts +1 -1
  93. package/es/Button/Button.js +3 -9
  94. package/es/Button/Button.types.d.ts +8 -7
  95. package/es/Calendar/Calendar.js +7 -19
  96. package/es/Calendar/Calendar.types.d.ts +0 -5
  97. package/es/Card/Card.css +1 -1
  98. package/es/Card/CardContent.css +1 -2
  99. package/es/Card/CardFooter.css +2 -4
  100. package/es/Card/CardHeader.css +4 -5
  101. package/es/Checkbox/Checkbox.js +2 -6
  102. package/es/Checkbox/CheckboxGroup.js +4 -7
  103. package/es/Collapse/Collapse.css +1 -0
  104. package/es/Collapse/Collapse.d.ts +1 -1
  105. package/es/Collapse/Collapse.js +8 -11
  106. package/es/CollapsePanel/CollapsePanel.css +2 -4
  107. package/es/CollapsePanel/CollapsePanelItem.js +45 -46
  108. package/es/Countdown/Countdown.js +5 -12
  109. package/es/Dialog/FunctionalDialog.js +2 -2
  110. package/es/Divider/Divider.js +8 -5
  111. package/es/Drawer/Drawer.js +4 -10
  112. package/es/Fade/Fade.js +52 -56
  113. package/es/IconButton/IconButton.js +5 -12
  114. package/es/Image/Image.js +112 -119
  115. package/es/Input/Input.js +4 -10
  116. package/es/List/List.js +3 -8
  117. package/es/List/ListItem.js +42 -44
  118. package/es/List/ListItemContent.js +1 -4
  119. package/es/List/ListItemExtra.js +9 -4
  120. package/es/List/ListItemFooter.js +9 -4
  121. package/es/List/ListItemHeader.js +9 -4
  122. package/es/Loading/Loading.js +13 -4
  123. package/es/Modal/Modal.js +0 -6
  124. package/es/Modal/Modal.miniapp.d.ts +1 -1
  125. package/es/Modal/Modal.miniapp.js +4 -10
  126. package/es/NavBar/NavBar.js +0 -1
  127. package/es/Picker/Picker.css +0 -5
  128. package/es/Picker/Picker.js +5 -27
  129. package/es/Picker/Picker.types.d.ts +2 -15
  130. package/es/Picker/PickerPanel.css +0 -4
  131. package/es/Picker/PickerPanel.js +6 -7
  132. package/es/Popover/Popover.css +5 -5
  133. package/es/Popover/Popover.js +29 -73
  134. package/es/Portal/Portal.miniapp.js +5 -8
  135. package/es/Radio/Radio.css +0 -1
  136. package/es/Radio/Radio.js +2 -6
  137. package/es/Radio/RadioGroup.js +0 -3
  138. package/es/Rating/Rating.js +8 -18
  139. package/es/ScrollView/ScrollView.js +11 -24
  140. package/es/ScrollView/ScrollView.types.d.ts +1 -0
  141. package/es/Select/Select.css +4 -1
  142. package/es/Select/Select.js +42 -68
  143. package/es/Skeleton/Skeleton.js +5 -9
  144. package/es/Slide/Slide.js +69 -74
  145. package/es/Slider/Slider.js +12 -30
  146. package/es/Steps/Step.js +81 -82
  147. package/es/Steps/Steps.d.ts +1 -1
  148. package/es/Steps/Steps.js +57 -60
  149. package/es/Switch/Switch.js +75 -78
  150. package/es/TabBar/TabBar.js +3 -8
  151. package/es/Tabs/Tab.css +10 -16
  152. package/es/Tabs/Tab.js +2 -3
  153. package/es/Tabs/Tabs.css +13 -22
  154. package/es/Tabs/Tabs.js +41 -83
  155. package/es/Tabs/Tabs.types.d.ts +0 -10
  156. package/es/Tabs/utils/bound.d.ts +1 -0
  157. package/es/Tabs/utils/bound.js +13 -0
  158. package/es/Tag/Tag.css +1 -1
  159. package/es/Tag/Tag.js +2 -6
  160. package/es/TextArea/TextArea.js +5 -12
  161. package/es/Toast/FunctionalToast.js +2 -2
  162. package/es/Toast/Toast.css +1 -0
  163. package/es/Tooltip/Tooltip.css +5 -5
  164. package/es/Tooltip/Tooltip.js +29 -73
  165. package/es/Transition/TransitionCore.js +3 -8
  166. package/es/index.d.ts +0 -6
  167. package/es/index.js +0 -6
  168. package/es/locales/base.d.ts +0 -11
  169. package/es/locales/en-US.js +0 -24
  170. package/es/locales/zh-CN.js +0 -24
  171. package/es/locales/zh-TW.js +0 -24
  172. package/package.json +6 -6
  173. package/dist/Collapse/Collapse.miniapp.d.ts +0 -5
  174. package/dist/Collapse/Collapse.miniapp.js +0 -177
  175. package/dist/DatePicker/DatePicker.d.ts +0 -4
  176. package/dist/DatePicker/DatePicker.js +0 -335
  177. package/dist/DatePicker/DatePicker.types.d.ts +0 -36
  178. package/dist/DatePicker/DatePicker.types.js +0 -15
  179. package/dist/DatePicker/constants.d.ts +0 -9
  180. package/dist/DatePicker/constants.js +0 -37
  181. package/dist/DatePicker/index.d.ts +0 -3
  182. package/dist/DatePicker/index.js +0 -44
  183. package/dist/DesktopDatePicker/DesktopDatePicker.d.ts +0 -5
  184. package/dist/DesktopDatePicker/DesktopDatePicker.js +0 -280
  185. package/dist/DesktopDatePicker/DesktopDatePicker.types.d.ts +0 -163
  186. package/dist/DesktopDatePicker/DesktopDatePicker.types.js +0 -15
  187. package/dist/DesktopDatePicker/deskTopPickerContainer.css +0 -100
  188. package/dist/DesktopDatePicker/index.css +0 -61
  189. package/dist/DesktopDatePicker/index.d.ts +0 -2
  190. package/dist/DesktopDatePicker/index.js +0 -41
  191. package/dist/DesktopDatePicker/useGetDatePickerContent.d.ts +0 -6
  192. package/dist/DesktopDatePicker/useGetDatePickerContent.js +0 -343
  193. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +0 -5
  194. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -322
  195. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +0 -163
  196. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.js +0 -15
  197. package/dist/DesktopDateTimePicker/index.css +0 -66
  198. package/dist/DesktopDateTimePicker/index.d.ts +0 -2
  199. package/dist/DesktopDateTimePicker/index.js +0 -41
  200. package/dist/DesktopPicker/DesktopPicker.d.ts +0 -5
  201. package/dist/DesktopPicker/DesktopPicker.js +0 -238
  202. package/dist/DesktopPicker/DesktopPicker.types.d.ts +0 -57
  203. package/dist/DesktopPicker/DesktopPicker.types.js +0 -15
  204. package/dist/DesktopPicker/index.css +0 -37
  205. package/dist/DesktopPicker/index.d.ts +0 -2
  206. package/dist/DesktopPicker/index.js +0 -41
  207. package/dist/DesktopPicker/utils/calcAfterMounted.d.ts +0 -2
  208. package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +0 -2
  209. package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.js +0 -38
  210. package/dist/DesktopTimePicker/DesktopTimePicker.d.ts +0 -5
  211. package/dist/DesktopTimePicker/DesktopTimePicker.js +0 -288
  212. package/dist/DesktopTimePicker/DesktopTimePicker.types.d.ts +0 -182
  213. package/dist/DesktopTimePicker/DesktopTimePicker.types.js +0 -15
  214. package/dist/DesktopTimePicker/DesktopTimePickerList.d.ts +0 -4
  215. package/dist/DesktopTimePicker/DesktopTimePickerList.js +0 -111
  216. package/dist/DesktopTimePicker/index.css +0 -170
  217. package/dist/DesktopTimePicker/index.d.ts +0 -2
  218. package/dist/DesktopTimePicker/index.js +0 -41
  219. package/dist/DesktopTimePicker/useGetTimePickerContent.d.ts +0 -6
  220. package/dist/DesktopTimePicker/useGetTimePickerContent.js +0 -249
  221. package/dist/DesktopTimePicker/utils/scrollUtil.d.ts +0 -2
  222. package/dist/DesktopTimePicker/utils/scrollUtil.js +0 -27
  223. package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +0 -2
  224. package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.js +0 -51
  225. package/dist/DesktopTimePicker/utils/utils.d.ts +0 -28
  226. package/dist/DesktopTimePicker/utils/utils.js +0 -408
  227. package/dist/SwipeAction/SwipeAction.css +0 -79
  228. package/dist/SwipeAction/SwipeAction.d.ts +0 -5
  229. package/dist/SwipeAction/SwipeAction.js +0 -349
  230. package/dist/SwipeAction/SwipeAction.types.d.ts +0 -75
  231. package/dist/SwipeAction/SwipeAction.types.js +0 -15
  232. package/dist/SwipeAction/SwipeActionContext.d.ts +0 -4
  233. package/dist/SwipeAction/SwipeActionContext.js +0 -30
  234. package/dist/SwipeAction/SwipeActionItem.css +0 -31
  235. package/dist/SwipeAction/SwipeActionItem.d.ts +0 -5
  236. package/dist/SwipeAction/SwipeActionItem.js +0 -105
  237. package/dist/SwipeAction/constants.d.ts +0 -9
  238. package/dist/SwipeAction/constants.js +0 -39
  239. package/dist/SwipeAction/index.d.ts +0 -5
  240. package/dist/SwipeAction/index.js +0 -50
  241. package/dist/Tabs/utils/scroll.d.ts +0 -2
  242. package/dist/Tabs/utils/scroll.js +0 -55
  243. package/es/Collapse/Collapse.miniapp.d.ts +0 -5
  244. package/es/Collapse/Collapse.miniapp.js +0 -157
  245. package/es/DatePicker/DatePicker.d.ts +0 -4
  246. package/es/DatePicker/DatePicker.js +0 -308
  247. package/es/DatePicker/DatePicker.types.d.ts +0 -36
  248. package/es/DatePicker/DatePicker.types.js +0 -1
  249. package/es/DatePicker/constants.d.ts +0 -9
  250. package/es/DatePicker/constants.js +0 -14
  251. package/es/DatePicker/index.d.ts +0 -3
  252. package/es/DatePicker/index.js +0 -8
  253. package/es/DesktopDatePicker/DesktopDatePicker.d.ts +0 -5
  254. package/es/DesktopDatePicker/DesktopDatePicker.js +0 -253
  255. package/es/DesktopDatePicker/DesktopDatePicker.types.d.ts +0 -163
  256. package/es/DesktopDatePicker/DesktopDatePicker.types.js +0 -1
  257. package/es/DesktopDatePicker/deskTopPickerContainer.css +0 -100
  258. package/es/DesktopDatePicker/index.css +0 -61
  259. package/es/DesktopDatePicker/index.d.ts +0 -2
  260. package/es/DesktopDatePicker/index.js +0 -6
  261. package/es/DesktopDatePicker/useGetDatePickerContent.d.ts +0 -6
  262. package/es/DesktopDatePicker/useGetDatePickerContent.js +0 -316
  263. package/es/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +0 -5
  264. package/es/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -295
  265. package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +0 -163
  266. package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.js +0 -1
  267. package/es/DesktopDateTimePicker/index.css +0 -66
  268. package/es/DesktopDateTimePicker/index.d.ts +0 -2
  269. package/es/DesktopDateTimePicker/index.js +0 -9
  270. package/es/DesktopPicker/DesktopPicker.d.ts +0 -5
  271. package/es/DesktopPicker/DesktopPicker.js +0 -221
  272. package/es/DesktopPicker/DesktopPicker.types.d.ts +0 -57
  273. package/es/DesktopPicker/DesktopPicker.types.js +0 -1
  274. package/es/DesktopPicker/index.css +0 -37
  275. package/es/DesktopPicker/index.d.ts +0 -2
  276. package/es/DesktopPicker/index.js +0 -6
  277. package/es/DesktopPicker/utils/calcAfterMounted.d.ts +0 -2
  278. package/es/DesktopPicker/utils/calcAfterMounted.js +0 -6
  279. package/es/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +0 -2
  280. package/es/DesktopPicker/utils/calcAfterMounted.miniapp.js +0 -9
  281. package/es/DesktopTimePicker/DesktopTimePicker.d.ts +0 -5
  282. package/es/DesktopTimePicker/DesktopTimePicker.js +0 -261
  283. package/es/DesktopTimePicker/DesktopTimePicker.types.d.ts +0 -182
  284. package/es/DesktopTimePicker/DesktopTimePicker.types.js +0 -1
  285. package/es/DesktopTimePicker/DesktopTimePickerList.d.ts +0 -4
  286. package/es/DesktopTimePicker/DesktopTimePickerList.js +0 -84
  287. package/es/DesktopTimePicker/index.css +0 -170
  288. package/es/DesktopTimePicker/index.d.ts +0 -2
  289. package/es/DesktopTimePicker/index.js +0 -6
  290. package/es/DesktopTimePicker/useGetTimePickerContent.d.ts +0 -6
  291. package/es/DesktopTimePicker/useGetTimePickerContent.js +0 -226
  292. package/es/DesktopTimePicker/utils/scrollUtil.d.ts +0 -2
  293. package/es/DesktopTimePicker/utils/scrollUtil.js +0 -8
  294. package/es/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +0 -2
  295. package/es/DesktopTimePicker/utils/scrollUtil.miniapp.js +0 -22
  296. package/es/DesktopTimePicker/utils/utils.d.ts +0 -28
  297. package/es/DesktopTimePicker/utils/utils.js +0 -365
  298. package/es/SwipeAction/SwipeAction.css +0 -79
  299. package/es/SwipeAction/SwipeAction.d.ts +0 -5
  300. package/es/SwipeAction/SwipeAction.js +0 -334
  301. package/es/SwipeAction/SwipeAction.types.d.ts +0 -75
  302. package/es/SwipeAction/SwipeAction.types.js +0 -1
  303. package/es/SwipeAction/SwipeActionContext.d.ts +0 -4
  304. package/es/SwipeAction/SwipeActionContext.js +0 -11
  305. package/es/SwipeAction/SwipeActionItem.css +0 -31
  306. package/es/SwipeAction/SwipeActionItem.d.ts +0 -5
  307. package/es/SwipeAction/SwipeActionItem.js +0 -78
  308. package/es/SwipeAction/constants.d.ts +0 -9
  309. package/es/SwipeAction/constants.js +0 -15
  310. package/es/SwipeAction/index.d.ts +0 -5
  311. package/es/SwipeAction/index.js +0 -12
  312. package/es/Tabs/utils/scroll.d.ts +0 -2
  313. package/es/Tabs/utils/scroll.js +0 -36
@@ -34,85 +34,82 @@ import clsx from "clsx";
34
34
  import React, { forwardRef } from "react";
35
35
  import "./Switch.css";
36
36
  const prefixCls = "bui-switch";
37
- const Switch = forwardRef((props, ref) => {
38
- const _a = props, {
39
- className,
40
- checked,
41
- defaultChecked,
42
- inputProps,
43
- inputRef,
44
- name,
45
- checkedChildren,
46
- unCheckedChildren,
47
- disabled,
48
- size,
49
- color,
50
- onChange
51
- } = _a, others = __objRest(_a, [
52
- "className",
53
- "checked",
54
- "defaultChecked",
55
- "inputProps",
56
- "inputRef",
57
- "name",
58
- "checkedChildren",
59
- "unCheckedChildren",
60
- "disabled",
61
- "size",
62
- "color",
63
- "onChange"
64
- ]);
65
- const [switchChecked, triggerChange] = useValue({
66
- value: checked,
67
- defaultValue: !!defaultChecked
68
- });
69
- const changeAction = (e, isChecked) => {
70
- triggerChange(e, isChecked);
71
- onChange == null ? void 0 : onChange(e, { checked: isChecked });
72
- };
73
- const handleChange = (e) => {
74
- var _a2;
75
- const isChecked = !switchChecked;
76
- changeAction(e, isChecked);
77
- (_a2 = inputProps == null ? void 0 : inputProps.onChange) == null ? void 0 : _a2.call(inputProps, e);
78
- };
79
- return /* @__PURE__ */ React.createElement(
80
- "div",
81
- __spreadValues({
82
- ref,
83
- className: clsx(
84
- `${prefixCls}`,
85
- `${prefixCls}-${size}`,
86
- `${prefixCls}-${color}`,
87
- {
88
- [`${prefixCls}-checked`]: switchChecked,
89
- [`${prefixCls}-disabled`]: disabled
90
- },
91
- className
92
- )
93
- }, others),
94
- /* @__PURE__ */ React.createElement(
95
- "input",
96
- __spreadProps(__spreadValues({
97
- ref: inputRef,
98
- type: "checkbox",
99
- name,
100
- checked: switchChecked,
101
- disabled
102
- }, inputProps), {
103
- onChange: handleChange,
104
- className: clsx(`${prefixCls}-input`, inputProps == null ? void 0 : inputProps.className)
105
- })
106
- ),
107
- (checkedChildren || unCheckedChildren) && /* @__PURE__ */ React.createElement("span", { className: `${prefixCls}-inner` }, switchChecked ? checkedChildren : unCheckedChildren)
108
- );
109
- });
37
+ const Switch = forwardRef(
38
+ (_a, ref) => {
39
+ var _b = _a, {
40
+ className,
41
+ checked,
42
+ defaultChecked,
43
+ inputProps,
44
+ inputRef,
45
+ name,
46
+ checkedChildren,
47
+ unCheckedChildren,
48
+ disabled = false,
49
+ size = "medium",
50
+ color = "primary",
51
+ onChange
52
+ } = _b, others = __objRest(_b, [
53
+ "className",
54
+ "checked",
55
+ "defaultChecked",
56
+ "inputProps",
57
+ "inputRef",
58
+ "name",
59
+ "checkedChildren",
60
+ "unCheckedChildren",
61
+ "disabled",
62
+ "size",
63
+ "color",
64
+ "onChange"
65
+ ]);
66
+ const [switchChecked, triggerChange] = useValue({
67
+ value: checked,
68
+ defaultValue: !!defaultChecked
69
+ });
70
+ const changeAction = (e, isChecked) => {
71
+ triggerChange(e, isChecked);
72
+ onChange == null ? void 0 : onChange(e, { checked: isChecked });
73
+ };
74
+ const handleChange = (e) => {
75
+ var _a2;
76
+ const isChecked = !switchChecked;
77
+ changeAction(e, isChecked);
78
+ (_a2 = inputProps == null ? void 0 : inputProps.onChange) == null ? void 0 : _a2.call(inputProps, e);
79
+ };
80
+ return /* @__PURE__ */ React.createElement(
81
+ "div",
82
+ __spreadValues({
83
+ ref,
84
+ className: clsx(
85
+ `${prefixCls}`,
86
+ `${prefixCls}-${size}`,
87
+ `${prefixCls}-${color}`,
88
+ {
89
+ [`${prefixCls}-checked`]: switchChecked,
90
+ [`${prefixCls}-disabled`]: disabled
91
+ },
92
+ className
93
+ )
94
+ }, others),
95
+ /* @__PURE__ */ React.createElement(
96
+ "input",
97
+ __spreadProps(__spreadValues({
98
+ ref: inputRef,
99
+ type: "checkbox",
100
+ name,
101
+ checked: switchChecked,
102
+ disabled
103
+ }, inputProps), {
104
+ onChange: handleChange,
105
+ className: clsx(`${prefixCls}-input`, inputProps == null ? void 0 : inputProps.className)
106
+ })
107
+ ),
108
+ (checkedChildren || unCheckedChildren) && /* @__PURE__ */ React.createElement("span", { className: `${prefixCls}-inner` }, switchChecked ? checkedChildren : unCheckedChildren)
109
+ );
110
+ }
111
+ );
110
112
  Switch.displayName = "BuiSwitch";
111
- Switch.defaultProps = {
112
- disabled: false,
113
- size: "medium",
114
- color: "primary"
115
- };
116
113
  var Switch_default = Switch;
117
114
  export {
118
115
  Switch_default as default
@@ -33,9 +33,9 @@ import "./TabBar.css";
33
33
  const prefixCls = "bui-tab-bar";
34
34
  const TabBar = /* @__PURE__ */ React.forwardRef((props, ref) => {
35
35
  const _a = props || {}, {
36
- current,
37
- activeColor,
38
- color,
36
+ current = 0,
37
+ activeColor = "primary",
38
+ color = "default",
39
39
  children,
40
40
  className,
41
41
  onChange
@@ -67,11 +67,6 @@ const TabBar = /* @__PURE__ */ React.forwardRef((props, ref) => {
67
67
  );
68
68
  });
69
69
  TabBar.displayName = "BuiTabBar";
70
- TabBar.defaultProps = {
71
- activeColor: "primary",
72
- color: "default",
73
- current: 0
74
- };
75
70
  var TabBar_default = TabBar;
76
71
  export {
77
72
  TabBar_default as default
package/es/Tabs/Tab.css CHANGED
@@ -4,31 +4,25 @@
4
4
  justify-content: center;
5
5
  white-space: nowrap;
6
6
  width: min-content;
7
- height: var(--tab-height);
7
+ height: 100%;
8
8
  box-sizing: border-box;
9
9
  position: relative;
10
10
  cursor: pointer;
11
- font-size: var(--font-size);
11
+ font-size: var(--bui-tabs-font-size);
12
12
  line-height: var(--bui-line-height);
13
- color: var(--color);
14
- padding: var(--tab-padding);
15
- font-family: var(--bui-font-family);
13
+ color: var(--bui-tabs-color);
14
+ padding: var(--bui-tab-padding);
15
+ font-family: var(--bui-tabs-font-family);
16
16
  }
17
17
  .bui-tab-active {
18
- font-size: var(--font-size);
19
- line-height: var(--bui-line-height);
20
- font-weight: var(--bui-font-weight-medium);
21
- color: var(--active-color);
22
- }
23
- .bui-tab-center {
24
- flex: 1 0 0;
25
- margin: 0 auto;
18
+ --bui-tabs-font-family: var(--bui-font-family-accent, inherit);
19
+ --bui-tabs-color: var(--bui-color-fg-default);
20
+ font-weight: 600;
26
21
  }
27
22
  .bui-tab-miniapp-active {
28
- font-size: var(--font-size);
23
+ --bui-tabs-color: var(--bui-color-fg-default);
29
24
  line-height: 1.5;
30
25
  font-weight: var(--bui-font-weight-medium);
31
- color: var(--active-color);
32
26
  position: relative;
33
27
  }
34
28
  .bui-tab-miniapp-active-line {
@@ -46,7 +40,7 @@
46
40
  opacity: 0.5;
47
41
  pointer-events: none;
48
42
  }
49
- .bui-tabline-invisible {
43
+ .bui-indicator-invisible {
50
44
  visibility: hidden;
51
45
  background-color: transparent;
52
46
  }
package/es/Tabs/Tab.js CHANGED
@@ -50,14 +50,13 @@ const Tab = /* @__PURE__ */ React.forwardRef((props, ref) => {
50
50
  "onClick"
51
51
  ]);
52
52
  const tabsContext = React.useContext(TabsContext);
53
- const { value, align, triggerChange } = tabsContext;
53
+ const { value, triggerChange } = tabsContext;
54
54
  return /* @__PURE__ */ React.createElement(
55
55
  "div",
56
56
  __spreadProps(__spreadValues({
57
57
  ref,
58
58
  className: clsx(
59
59
  prefixCls,
60
- align !== "start" && `${prefixCls}-${align}`,
61
60
  {
62
61
  [`${prefixCls}-active`]: !isMini && index === value,
63
62
  [`${prefixCls}-miniapp-active`]: isMini && index === value,
@@ -79,7 +78,7 @@ const Tab = /* @__PURE__ */ React.forwardRef((props, ref) => {
79
78
  "div",
80
79
  {
81
80
  className: clsx(`${prefixCls}-miniapp-active-line`, {
82
- "bui-tabline-invisible": index !== value
81
+ "bui-indicator-invisible": index !== value
83
82
  })
84
83
  }
85
84
  )
package/es/Tabs/Tabs.css CHANGED
@@ -1,20 +1,10 @@
1
1
  .bui-tabs {
2
- --height: var(--bui-tabs-height, 39px);
3
- --color: var(--bui-tabs-color, var(--bui-color-fg-subtle));
4
- --active-color: var(--bui-tabs-active-color, var(--bui-color-fg-default));
5
- --line-color: var(--bui-tabs-line-color, var(--bui-color-primary));
6
- --line-height: var(--bui-tabs-line-height, 3PX);
7
- --line-width: var(--bui-tabs-line-width, 18px);
8
- --mask-width: var(--bui-tabs-mask-width, 12px);
9
- --mask-height: var(--bui-tabs-mask-height, 100%);
10
- --tab-height: var(--bui-tab-height, 100%);
11
- --tab-padding: var(--bui-tab-padding, var(--bui-spacing-lg) var(--bui-spacing-lg) 10px);
12
- --font-size: var(--bui-tab-font-size, var(--bui-text-size-1));
13
2
  position: relative;
14
- font-family: var(--bui-font-family);
3
+ font-family: var(--bui-tabs-font-family);
4
+ font-weight: var(--bui-tabs-font-weight);
15
5
  }
16
6
  .bui-tabs-tabs {
17
- height: var(--height);
7
+ height: var(--bui-tabs-height);
18
8
  display: flex;
19
9
  flex-wrap: nowrap;
20
10
  justify-content: flex-start;
@@ -26,14 +16,15 @@
26
16
  .bui-tabs-tabs::-webkit-scrollbar {
27
17
  display: none;
28
18
  }
29
- .bui-tabs-tabline {
19
+ .bui-tabs-indicator {
30
20
  position: absolute;
31
- width: var(--line-width);
32
- bottom: 0;
33
- height: var(--line-height);
21
+ width: var(--bui-tabs-indicator-width);
22
+ bottom: var(--bui-tabs-indicator-bottom);
23
+ height: var(--bui-tabs-indicator-height);
34
24
  color: var(--bui-color-primary);
35
- background: var(--line-color);
36
- border-radius: var(--bui-shape-radius-label);
25
+ background: var(--bui-tabs-indicator-bg);
26
+ border-radius: var(--bui-tabs-indicator-border-radius);
27
+ box-shadow: var(--bui-tabs-indicator-box-shadow);
37
28
  }
38
29
  .bui-tabs-content {
39
30
  padding: var(--bui-spacing-lg);
@@ -43,8 +34,8 @@
43
34
  top: 0;
44
35
  bottom: 0;
45
36
  z-index: 1;
46
- width: var(--mask-width);
47
- height: var(--mask-height);
37
+ width: 12px;
38
+ height: 100%;
48
39
  pointer-events: none;
49
40
  }
50
41
  .bui-tabs-mask-left {
@@ -63,7 +54,7 @@
63
54
  var(--bui-color-bg-view),
64
55
  rgba(255, 255, 255, 0));
65
56
  }
66
- .bui-tabline-invisible {
57
+ .bui-indicator-invisible {
67
58
  visibility: hidden;
68
59
  background-color: transparent;
69
60
  }
package/es/Tabs/Tabs.js CHANGED
@@ -26,45 +26,34 @@ var __objRest = (source, exclude) => {
26
26
  }
27
27
  return target;
28
28
  };
29
- import {
30
- debounce,
31
- isMini,
32
- throttle,
33
- useDidMountEffect
34
- } from "@bifrostui/utils";
29
+ import { debounce, isMini, throttle, useEventCallback } from "@bifrostui/utils";
35
30
  import clsx from "clsx";
36
- import React, {
37
- useEffect,
38
- useLayoutEffect,
39
- useMemo,
40
- useRef,
41
- useState
42
- } from "react";
31
+ import React, { useEffect, useMemo, useRef, useState } from "react";
43
32
  import Tab from "./Tab";
44
33
  import { TabsContextProvider } from "./TabsContext";
45
- import scrollLeftTo from "./utils/scroll";
34
+ import bound from "./utils/bound";
46
35
  import "./Tabs.css";
47
36
  const prefixCls = "bui-tabs";
48
- const duration = 300;
49
37
  const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
50
- const _a = props, { children, className, value, tabs, align, onChange } = _a, others = __objRest(_a, ["children", "className", "value", "tabs", "align", "onChange"]);
51
- const [active, setActive] = useState("");
38
+ const _a = props, { children, className, value, tabs = [], onChange } = _a, others = __objRest(_a, ["children", "className", "value", "tabs", "onChange"]);
52
39
  const tabsRef = useRef(null);
53
40
  const activeLineRef = useRef(null);
54
- const [lineData, setLineData] = useState({
41
+ const [indicatorData, setIndicatorData] = useState({
55
42
  x: 0,
56
- transitionInUse: false,
57
43
  hasActiveTab: false
58
44
  });
59
45
  const [maskData, setMaskData] = useState({
60
46
  leftMaskOpacity: 0,
61
47
  rightMaskOpacity: 0
62
48
  });
63
- const getActiveTabElement = () => {
49
+ const animate = useEventCallback(() => {
64
50
  const container = tabsRef.current;
65
51
  if (!container)
66
- return void 0;
67
- const activeIndex = !!tabs.length && tabs.findIndex((item) => item.index === active);
52
+ return;
53
+ const activeIndex = !!tabs.length && tabs.findIndex((item) => item.index === value);
54
+ const activeLine = activeLineRef.current;
55
+ if (!activeLine)
56
+ return;
68
57
  let activeTab;
69
58
  if (tabs.length) {
70
59
  activeTab = activeIndex > -1 ? container.childNodes[activeIndex + 1] : void 0;
@@ -78,25 +67,6 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
78
67
  return [...child.classList].includes("bui-tab-active");
79
68
  });
80
69
  }
81
- return activeTab;
82
- };
83
- const scrollIntoView = () => {
84
- const tabsContainer = tabsRef.current;
85
- const activeTab = getActiveTabElement();
86
- if (!tabsContainer || !activeTab) {
87
- return;
88
- }
89
- const to = activeTab.offsetLeft - (tabsContainer.offsetWidth - activeTab.offsetWidth) / 2;
90
- scrollLeftTo(tabsContainer, to, duration);
91
- };
92
- const animate = ({ transitionInUse }) => {
93
- const container = tabsRef.current;
94
- if (!container)
95
- return;
96
- const activeLine = activeLineRef.current;
97
- if (!activeLine)
98
- return;
99
- const activeTab = getActiveTabElement();
100
70
  let activeTabLeft = 0;
101
71
  let activeTabWidth = 0;
102
72
  let containerWidth = 0;
@@ -111,37 +81,22 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
111
81
  activeLineWidth = activeLine.offsetWidth;
112
82
  x = activeTabLeft + (activeTabWidth - activeLineWidth) / 2;
113
83
  }
114
- setLineData({
84
+ setIndicatorData({
115
85
  x,
116
- transitionInUse,
117
86
  hasActiveTab: !!activeTab
118
87
  });
119
88
  const maxScrollDistance = containerScrollWidth - containerWidth;
120
89
  if (maxScrollDistance <= 0 || !activeTab)
121
90
  return;
122
- if (!isMini) {
123
- scrollIntoView();
91
+ const nextScrollLeft = bound(
92
+ activeTabLeft - (containerWidth - activeTabWidth) / 2,
93
+ 0,
94
+ containerScrollWidth - containerWidth
95
+ );
96
+ if (tabsRef.current) {
97
+ tabsRef.current.scrollLeft = nextScrollLeft;
124
98
  }
125
- };
126
- useEffect(() => {
127
- setActive(value);
128
- }, [value]);
129
- useLayoutEffect(() => {
130
- animate({ transitionInUse: false });
131
- }, []);
132
- useEffect(() => {
133
- const handleResize = debounce(() => {
134
- animate({ transitionInUse: true });
135
- updateMask();
136
- }, 100);
137
- window.addEventListener("resize", handleResize);
138
- return () => {
139
- window.removeEventListener("resize", handleResize);
140
- };
141
- }, [active]);
142
- useDidMountEffect(() => {
143
- animate({ transitionInUse: true });
144
- }, [active, tabs, children]);
99
+ });
145
100
  const updateMask = useMemo(
146
101
  () => throttle(
147
102
  () => {
@@ -150,10 +105,7 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
150
105
  return;
151
106
  const scrollLeft = container == null ? void 0 : container.scrollLeft;
152
107
  const showLeftMask = scrollLeft > 0;
153
- const rightRange = Math.abs(
154
- container.scrollWidth - (scrollLeft + container.offsetWidth)
155
- );
156
- const showRightMask = rightRange > 1;
108
+ const showRightMask = scrollLeft + container.offsetWidth < container.scrollWidth;
157
109
  setMaskData({
158
110
  leftMaskOpacity: showLeftMask ? 1 : 0,
159
111
  rightMaskOpacity: showRightMask ? 1 : 0
@@ -167,7 +119,20 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
167
119
  ),
168
120
  []
169
121
  );
170
- useLayoutEffect(() => {
122
+ useEffect(() => {
123
+ animate();
124
+ }, [value, tabs.length, React.Children.toArray(children).length]);
125
+ useEffect(() => {
126
+ const handleResize = debounce(() => {
127
+ animate();
128
+ updateMask();
129
+ }, 100);
130
+ window.addEventListener("resize", handleResize);
131
+ return () => {
132
+ window.removeEventListener("resize", handleResize);
133
+ };
134
+ }, []);
135
+ useEffect(() => {
171
136
  updateMask();
172
137
  }, []);
173
138
  const handleClick = (e, item) => {
@@ -177,16 +142,13 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
177
142
  if (index === void 0 || index === null) {
178
143
  return;
179
144
  }
180
- if (active !== value) {
181
- setActive(index);
182
- }
183
145
  if (index !== value) {
184
146
  onChange == null ? void 0 : onChange(e, { index });
185
147
  }
186
148
  };
187
149
  const providerValue = useMemo(() => {
188
- return { value, align, triggerChange: handleClick };
189
- }, [value, align, children, handleClick]);
150
+ return { value, triggerChange: handleClick };
151
+ }, [value, children, handleClick]);
190
152
  return /* @__PURE__ */ React.createElement("div", __spreadValues({ ref, className: clsx(prefixCls, className) }, others), /* @__PURE__ */ React.createElement(
191
153
  "div",
192
154
  {
@@ -207,12 +169,12 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
207
169
  "div",
208
170
  {
209
171
  ref: activeLineRef,
210
- className: clsx(`${prefixCls}-tabline`, {
211
- "bui-tabline-invisible": isMini || !lineData.hasActiveTab
172
+ className: clsx(`${prefixCls}-indicator`, {
173
+ "bui-indicator-invisible": isMini || !indicatorData.hasActiveTab
212
174
  }),
213
175
  style: {
214
- transition: lineData.transitionInUse ? `transform ${duration / 1e3}s ease` : void 0,
215
- transform: `translate3d(${lineData.x}px, 0px, 0px)`
176
+ transition: "transform 0.3s ease-in-out",
177
+ transform: `translate3d(${indicatorData.x}px, 0px, 0px)`
216
178
  }
217
179
  }
218
180
  ), /* @__PURE__ */ React.createElement(TabsContextProvider, { value: providerValue }, !!tabs.length && tabs.map((item) => {
@@ -228,10 +190,6 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
228
190
  }), children)));
229
191
  });
230
192
  Tabs.displayName = "BuiTabs";
231
- Tabs.defaultProps = {
232
- align: "center",
233
- tabs: []
234
- };
235
193
  var Tabs_default = Tabs;
236
194
  export {
237
195
  Tabs_default as default
@@ -3,9 +3,6 @@ import React, { SyntheticEvent } from 'react';
3
3
  export interface TabHeaderItem {
4
4
  title: React.ReactNode;
5
5
  index: string;
6
- /**
7
- * 是否禁止点击
8
- */
9
6
  disabled?: boolean;
10
7
  }
11
8
  export interface ITabsChangeData {
@@ -14,11 +11,8 @@ export interface ITabsChangeData {
14
11
  }
15
12
  export type TabChangeEvent = (e?: SyntheticEvent, data?: ITabsChangeData) => void;
16
13
  export interface ITabItem {
17
- /** 面板标题 */
18
14
  title: React.ReactNode;
19
- /** 面板的索引值 */
20
15
  index: string;
21
- /** 面板是否禁用 */
22
16
  disabled?: boolean;
23
17
  }
24
18
  export type ITabAlign = 'start' | 'center';
@@ -32,10 +26,6 @@ export type TabsProps<D extends React.ElementType = 'div', P = {}> = OverridePro
32
26
  * 切换面板的数据
33
27
  */
34
28
  tabs?: ITabItem[];
35
- /**
36
- * 对齐方式,默认为center
37
- */
38
- align?: ITabAlign;
39
29
  /**
40
30
  * 切换面板的回调
41
31
  */
@@ -0,0 +1 @@
1
+ export default function bound(position: number, min: number | undefined, max: number | undefined): number;
@@ -0,0 +1,13 @@
1
+ function bound(position, min, max) {
2
+ let ret = position;
3
+ if (min !== void 0) {
4
+ ret = Math.max(position, min);
5
+ }
6
+ if (max !== void 0) {
7
+ ret = Math.min(ret, max);
8
+ }
9
+ return ret;
10
+ }
11
+ export {
12
+ bound as default
13
+ };
package/es/Tag/Tag.css CHANGED
@@ -47,7 +47,7 @@
47
47
  border: 1px solid var(--bui-color-border-danger);
48
48
  }
49
49
  .bui-tag-outlined.bui-tag-vip {
50
- color: var(--bui-color-red);
50
+ color: var(--bui-color-primary);
51
51
  border: 1px solid var(--bui-color-border-primary);
52
52
  }
53
53
  .bui-tag-contained {
package/es/Tag/Tag.js CHANGED
@@ -47,9 +47,9 @@ const Tag = /* @__PURE__ */ React.forwardRef((props, ref) => {
47
47
  const _a = props, {
48
48
  className,
49
49
  style,
50
- color,
50
+ color = "default",
51
51
  htmlColor,
52
- variant,
52
+ variant = "outlined",
53
53
  onClick,
54
54
  children
55
55
  } = _a, others = __objRest(_a, [
@@ -98,10 +98,6 @@ const Tag = /* @__PURE__ */ React.forwardRef((props, ref) => {
98
98
  );
99
99
  });
100
100
  Tag.displayName = "BuiTag";
101
- Tag.defaultProps = {
102
- variant: "outlined",
103
- color: "default"
104
- };
105
101
  var Tag_default = Tag;
106
102
  export {
107
103
  Tag_default as default
@@ -40,17 +40,17 @@ const TextArea = /* @__PURE__ */ React.forwardRef(
40
40
  const _a = props, {
41
41
  className,
42
42
  value,
43
- defaultValue,
43
+ defaultValue = "",
44
44
  textareaProps,
45
45
  textareaRef,
46
46
  name,
47
47
  placeholder,
48
48
  disabled,
49
- rows,
49
+ rows = DEFAULT_ROWS,
50
50
  maxLength,
51
- autoSize,
52
- autoFocus,
53
- showCount,
51
+ autoSize = false,
52
+ autoFocus = false,
53
+ showCount = false,
54
54
  onChange
55
55
  } = _a, others = __objRest(_a, [
56
56
  "className",
@@ -175,13 +175,6 @@ const TextArea = /* @__PURE__ */ React.forwardRef(
175
175
  }
176
176
  );
177
177
  TextArea.displayName = "BuiTextArea";
178
- TextArea.defaultProps = {
179
- defaultValue: "",
180
- rows: DEFAULT_ROWS,
181
- autoSize: false,
182
- autoFocus: false,
183
- showCount: false
184
- };
185
178
  var TextArea_default = TextArea;
186
179
  export {
187
180
  TextArea_default as default
@@ -29,7 +29,7 @@ var __objRest = (source, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
- import { render, unmount, getRootContainer } from "@bifrostui/utils";
32
+ import { render, unmount, getRootElement } from "@bifrostui/utils";
33
33
  import React, { useCallback, useEffect, useState } from "react";
34
34
  import ToastView from "./Toast";
35
35
  let toastCloses = [];
@@ -70,7 +70,7 @@ const functionalToast = (props) => {
70
70
  rootWrapper.style[property] = styles[property];
71
71
  });
72
72
  }
73
- const rootElement = getRootContainer();
73
+ const rootElement = getRootElement();
74
74
  rootElement.appendChild(rootWrapper);
75
75
  const ToastComponent = () => {
76
76
  const _a = options, { duration, allowMultiple, onClose } = _a, others = __objRest(_a, ["duration", "allowMultiple", "onClose"]);