@bifrostui/react 1.4.7-beta.0 → 2.0.0-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 (304) 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.js +4 -10
  125. package/es/NavBar/NavBar.js +0 -1
  126. package/es/Picker/Picker.css +0 -5
  127. package/es/Picker/Picker.js +5 -27
  128. package/es/Picker/Picker.types.d.ts +2 -15
  129. package/es/Picker/PickerPanel.css +0 -4
  130. package/es/Picker/PickerPanel.js +6 -7
  131. package/es/Popover/Popover.css +5 -5
  132. package/es/Popover/Popover.js +29 -73
  133. package/es/Portal/Portal.miniapp.js +5 -8
  134. package/es/Radio/Radio.css +0 -1
  135. package/es/Radio/Radio.js +2 -6
  136. package/es/Radio/RadioGroup.js +0 -3
  137. package/es/Rating/Rating.js +8 -18
  138. package/es/ScrollView/ScrollView.js +11 -24
  139. package/es/ScrollView/ScrollView.types.d.ts +1 -0
  140. package/es/Select/Select.css +4 -1
  141. package/es/Select/Select.js +42 -68
  142. package/es/Skeleton/Skeleton.js +5 -9
  143. package/es/Slide/Slide.js +69 -74
  144. package/es/Slider/Slider.js +12 -30
  145. package/es/Steps/Step.js +81 -82
  146. package/es/Steps/Steps.d.ts +1 -1
  147. package/es/Steps/Steps.js +57 -60
  148. package/es/Switch/Switch.js +75 -78
  149. package/es/TabBar/TabBar.js +3 -8
  150. package/es/Tabs/Tab.css +10 -16
  151. package/es/Tabs/Tab.js +2 -3
  152. package/es/Tabs/Tabs.css +13 -22
  153. package/es/Tabs/Tabs.js +41 -83
  154. package/es/Tabs/Tabs.types.d.ts +0 -10
  155. package/es/Tabs/utils/bound.d.ts +1 -0
  156. package/es/Tabs/utils/bound.js +13 -0
  157. package/es/Tag/Tag.css +1 -1
  158. package/es/Tag/Tag.js +2 -6
  159. package/es/TextArea/TextArea.js +5 -12
  160. package/es/Toast/FunctionalToast.js +2 -2
  161. package/es/Toast/Toast.css +1 -0
  162. package/es/Tooltip/Tooltip.css +5 -5
  163. package/es/Tooltip/Tooltip.js +29 -73
  164. package/es/Transition/TransitionCore.js +3 -8
  165. package/es/index.d.ts +0 -6
  166. package/es/index.js +0 -6
  167. package/es/locales/base.d.ts +0 -11
  168. package/es/locales/en-US.js +0 -24
  169. package/es/locales/zh-CN.js +0 -24
  170. package/es/locales/zh-TW.js +0 -24
  171. package/package.json +6 -6
  172. package/dist/Collapse/Collapse.miniapp.d.ts +0 -5
  173. package/dist/Collapse/Collapse.miniapp.js +0 -177
  174. package/dist/DatePicker/DatePicker.d.ts +0 -4
  175. package/dist/DatePicker/DatePicker.js +0 -335
  176. package/dist/DatePicker/DatePicker.types.d.ts +0 -43
  177. package/dist/DatePicker/DatePicker.types.js +0 -35
  178. package/dist/DatePicker/index.d.ts +0 -2
  179. package/dist/DatePicker/index.js +0 -41
  180. package/dist/DesktopDatePicker/DesktopDatePicker.d.ts +0 -5
  181. package/dist/DesktopDatePicker/DesktopDatePicker.js +0 -280
  182. package/dist/DesktopDatePicker/DesktopDatePicker.types.d.ts +0 -163
  183. package/dist/DesktopDatePicker/DesktopDatePicker.types.js +0 -15
  184. package/dist/DesktopDatePicker/deskTopPickerContainer.css +0 -100
  185. package/dist/DesktopDatePicker/index.css +0 -61
  186. package/dist/DesktopDatePicker/index.d.ts +0 -2
  187. package/dist/DesktopDatePicker/index.js +0 -41
  188. package/dist/DesktopDatePicker/useGetDatePickerContent.d.ts +0 -6
  189. package/dist/DesktopDatePicker/useGetDatePickerContent.js +0 -343
  190. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +0 -5
  191. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -322
  192. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +0 -163
  193. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.js +0 -15
  194. package/dist/DesktopDateTimePicker/index.css +0 -66
  195. package/dist/DesktopDateTimePicker/index.d.ts +0 -2
  196. package/dist/DesktopDateTimePicker/index.js +0 -41
  197. package/dist/DesktopPicker/DesktopPicker.d.ts +0 -5
  198. package/dist/DesktopPicker/DesktopPicker.js +0 -238
  199. package/dist/DesktopPicker/DesktopPicker.types.d.ts +0 -57
  200. package/dist/DesktopPicker/DesktopPicker.types.js +0 -15
  201. package/dist/DesktopPicker/index.css +0 -37
  202. package/dist/DesktopPicker/index.d.ts +0 -2
  203. package/dist/DesktopPicker/index.js +0 -41
  204. package/dist/DesktopPicker/utils/calcAfterMounted.d.ts +0 -2
  205. package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +0 -2
  206. package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.js +0 -38
  207. package/dist/DesktopTimePicker/DesktopTimePicker.d.ts +0 -5
  208. package/dist/DesktopTimePicker/DesktopTimePicker.js +0 -288
  209. package/dist/DesktopTimePicker/DesktopTimePicker.types.d.ts +0 -182
  210. package/dist/DesktopTimePicker/DesktopTimePicker.types.js +0 -15
  211. package/dist/DesktopTimePicker/DesktopTimePickerList.d.ts +0 -4
  212. package/dist/DesktopTimePicker/DesktopTimePickerList.js +0 -111
  213. package/dist/DesktopTimePicker/index.css +0 -170
  214. package/dist/DesktopTimePicker/index.d.ts +0 -2
  215. package/dist/DesktopTimePicker/index.js +0 -41
  216. package/dist/DesktopTimePicker/useGetTimePickerContent.d.ts +0 -6
  217. package/dist/DesktopTimePicker/useGetTimePickerContent.js +0 -246
  218. package/dist/DesktopTimePicker/utils/scrollUtil.d.ts +0 -2
  219. package/dist/DesktopTimePicker/utils/scrollUtil.js +0 -27
  220. package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +0 -2
  221. package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.js +0 -51
  222. package/dist/DesktopTimePicker/utils/utils.d.ts +0 -28
  223. package/dist/DesktopTimePicker/utils/utils.js +0 -408
  224. package/dist/SwipeAction/SwipeAction.css +0 -79
  225. package/dist/SwipeAction/SwipeAction.d.ts +0 -5
  226. package/dist/SwipeAction/SwipeAction.js +0 -349
  227. package/dist/SwipeAction/SwipeAction.types.d.ts +0 -83
  228. package/dist/SwipeAction/SwipeAction.types.js +0 -39
  229. package/dist/SwipeAction/SwipeActionContext.d.ts +0 -4
  230. package/dist/SwipeAction/SwipeActionContext.js +0 -30
  231. package/dist/SwipeAction/SwipeActionItem.css +0 -31
  232. package/dist/SwipeAction/SwipeActionItem.d.ts +0 -5
  233. package/dist/SwipeAction/SwipeActionItem.js +0 -105
  234. package/dist/SwipeAction/index.d.ts +0 -4
  235. package/dist/SwipeAction/index.js +0 -45
  236. package/dist/Tabs/utils/scroll.d.ts +0 -2
  237. package/dist/Tabs/utils/scroll.js +0 -55
  238. package/es/Collapse/Collapse.miniapp.d.ts +0 -5
  239. package/es/Collapse/Collapse.miniapp.js +0 -157
  240. package/es/DatePicker/DatePicker.d.ts +0 -4
  241. package/es/DatePicker/DatePicker.js +0 -310
  242. package/es/DatePicker/DatePicker.types.d.ts +0 -43
  243. package/es/DatePicker/DatePicker.types.js +0 -1
  244. package/es/DatePicker/index.d.ts +0 -2
  245. package/es/DatePicker/index.js +0 -6
  246. package/es/DesktopDatePicker/DesktopDatePicker.d.ts +0 -5
  247. package/es/DesktopDatePicker/DesktopDatePicker.js +0 -253
  248. package/es/DesktopDatePicker/DesktopDatePicker.types.d.ts +0 -163
  249. package/es/DesktopDatePicker/DesktopDatePicker.types.js +0 -1
  250. package/es/DesktopDatePicker/deskTopPickerContainer.css +0 -100
  251. package/es/DesktopDatePicker/index.css +0 -61
  252. package/es/DesktopDatePicker/index.d.ts +0 -2
  253. package/es/DesktopDatePicker/index.js +0 -6
  254. package/es/DesktopDatePicker/useGetDatePickerContent.d.ts +0 -6
  255. package/es/DesktopDatePicker/useGetDatePickerContent.js +0 -316
  256. package/es/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +0 -5
  257. package/es/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -295
  258. package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +0 -163
  259. package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.js +0 -1
  260. package/es/DesktopDateTimePicker/index.css +0 -66
  261. package/es/DesktopDateTimePicker/index.d.ts +0 -2
  262. package/es/DesktopDateTimePicker/index.js +0 -9
  263. package/es/DesktopPicker/DesktopPicker.d.ts +0 -5
  264. package/es/DesktopPicker/DesktopPicker.js +0 -221
  265. package/es/DesktopPicker/DesktopPicker.types.d.ts +0 -57
  266. package/es/DesktopPicker/DesktopPicker.types.js +0 -1
  267. package/es/DesktopPicker/index.css +0 -37
  268. package/es/DesktopPicker/index.d.ts +0 -2
  269. package/es/DesktopPicker/index.js +0 -6
  270. package/es/DesktopPicker/utils/calcAfterMounted.d.ts +0 -2
  271. package/es/DesktopPicker/utils/calcAfterMounted.js +0 -6
  272. package/es/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +0 -2
  273. package/es/DesktopPicker/utils/calcAfterMounted.miniapp.js +0 -9
  274. package/es/DesktopTimePicker/DesktopTimePicker.d.ts +0 -5
  275. package/es/DesktopTimePicker/DesktopTimePicker.js +0 -261
  276. package/es/DesktopTimePicker/DesktopTimePicker.types.d.ts +0 -182
  277. package/es/DesktopTimePicker/DesktopTimePicker.types.js +0 -1
  278. package/es/DesktopTimePicker/DesktopTimePickerList.d.ts +0 -4
  279. package/es/DesktopTimePicker/DesktopTimePickerList.js +0 -84
  280. package/es/DesktopTimePicker/index.css +0 -170
  281. package/es/DesktopTimePicker/index.d.ts +0 -2
  282. package/es/DesktopTimePicker/index.js +0 -6
  283. package/es/DesktopTimePicker/useGetTimePickerContent.d.ts +0 -6
  284. package/es/DesktopTimePicker/useGetTimePickerContent.js +0 -223
  285. package/es/DesktopTimePicker/utils/scrollUtil.d.ts +0 -2
  286. package/es/DesktopTimePicker/utils/scrollUtil.js +0 -8
  287. package/es/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +0 -2
  288. package/es/DesktopTimePicker/utils/scrollUtil.miniapp.js +0 -22
  289. package/es/DesktopTimePicker/utils/utils.d.ts +0 -28
  290. package/es/DesktopTimePicker/utils/utils.js +0 -365
  291. package/es/SwipeAction/SwipeAction.css +0 -79
  292. package/es/SwipeAction/SwipeAction.d.ts +0 -5
  293. package/es/SwipeAction/SwipeAction.js +0 -337
  294. package/es/SwipeAction/SwipeAction.types.d.ts +0 -83
  295. package/es/SwipeAction/SwipeAction.types.js +0 -1
  296. package/es/SwipeAction/SwipeActionContext.d.ts +0 -4
  297. package/es/SwipeAction/SwipeActionContext.js +0 -11
  298. package/es/SwipeAction/SwipeActionItem.css +0 -31
  299. package/es/SwipeAction/SwipeActionItem.d.ts +0 -5
  300. package/es/SwipeAction/SwipeActionItem.js +0 -78
  301. package/es/SwipeAction/index.d.ts +0 -4
  302. package/es/SwipeAction/index.js +0 -9
  303. package/es/Tabs/utils/scroll.d.ts +0 -2
  304. package/es/Tabs/utils/scroll.js +0 -36
@@ -64,83 +64,80 @@ var import_clsx = __toESM(require("clsx"));
64
64
  var import_react = __toESM(require("react"));
65
65
  var import_Switch2 = require("./Switch.css");
66
66
  const prefixCls = "bui-switch";
67
- const Switch = (0, import_react.forwardRef)((props, ref) => {
68
- const _a = props, {
69
- className,
70
- checked,
71
- defaultChecked,
72
- inputProps,
73
- inputRef,
74
- name,
75
- checkedChildren,
76
- unCheckedChildren,
77
- disabled,
78
- size,
79
- color,
80
- onChange
81
- } = _a, others = __objRest(_a, [
82
- "className",
83
- "checked",
84
- "defaultChecked",
85
- "inputProps",
86
- "inputRef",
87
- "name",
88
- "checkedChildren",
89
- "unCheckedChildren",
90
- "disabled",
91
- "size",
92
- "color",
93
- "onChange"
94
- ]);
95
- const [switchChecked, triggerChange] = (0, import_utils.useValue)({
96
- value: checked,
97
- defaultValue: !!defaultChecked
98
- });
99
- const changeAction = (e, isChecked) => {
100
- triggerChange(e, isChecked);
101
- onChange == null ? void 0 : onChange(e, { checked: isChecked });
102
- };
103
- const handleChange = (e) => {
104
- var _a2;
105
- const isChecked = !switchChecked;
106
- changeAction(e, isChecked);
107
- (_a2 = inputProps == null ? void 0 : inputProps.onChange) == null ? void 0 : _a2.call(inputProps, e);
108
- };
109
- return /* @__PURE__ */ import_react.default.createElement(
110
- "div",
111
- __spreadValues({
112
- ref,
113
- className: (0, import_clsx.default)(
114
- `${prefixCls}`,
115
- `${prefixCls}-${size}`,
116
- `${prefixCls}-${color}`,
117
- {
118
- [`${prefixCls}-checked`]: switchChecked,
119
- [`${prefixCls}-disabled`]: disabled
120
- },
121
- className
122
- )
123
- }, others),
124
- /* @__PURE__ */ import_react.default.createElement(
125
- "input",
126
- __spreadProps(__spreadValues({
127
- ref: inputRef,
128
- type: "checkbox",
129
- name,
130
- checked: switchChecked,
131
- disabled
132
- }, inputProps), {
133
- onChange: handleChange,
134
- className: (0, import_clsx.default)(`${prefixCls}-input`, inputProps == null ? void 0 : inputProps.className)
135
- })
136
- ),
137
- (checkedChildren || unCheckedChildren) && /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefixCls}-inner` }, switchChecked ? checkedChildren : unCheckedChildren)
138
- );
139
- });
67
+ const Switch = (0, import_react.forwardRef)(
68
+ (_a, ref) => {
69
+ var _b = _a, {
70
+ className,
71
+ checked,
72
+ defaultChecked,
73
+ inputProps,
74
+ inputRef,
75
+ name,
76
+ checkedChildren,
77
+ unCheckedChildren,
78
+ disabled = false,
79
+ size = "medium",
80
+ color = "primary",
81
+ onChange
82
+ } = _b, others = __objRest(_b, [
83
+ "className",
84
+ "checked",
85
+ "defaultChecked",
86
+ "inputProps",
87
+ "inputRef",
88
+ "name",
89
+ "checkedChildren",
90
+ "unCheckedChildren",
91
+ "disabled",
92
+ "size",
93
+ "color",
94
+ "onChange"
95
+ ]);
96
+ const [switchChecked, triggerChange] = (0, import_utils.useValue)({
97
+ value: checked,
98
+ defaultValue: !!defaultChecked
99
+ });
100
+ const changeAction = (e, isChecked) => {
101
+ triggerChange(e, isChecked);
102
+ onChange == null ? void 0 : onChange(e, { checked: isChecked });
103
+ };
104
+ const handleChange = (e) => {
105
+ var _a2;
106
+ const isChecked = !switchChecked;
107
+ changeAction(e, isChecked);
108
+ (_a2 = inputProps == null ? void 0 : inputProps.onChange) == null ? void 0 : _a2.call(inputProps, e);
109
+ };
110
+ return /* @__PURE__ */ import_react.default.createElement(
111
+ "div",
112
+ __spreadValues({
113
+ ref,
114
+ className: (0, import_clsx.default)(
115
+ `${prefixCls}`,
116
+ `${prefixCls}-${size}`,
117
+ `${prefixCls}-${color}`,
118
+ {
119
+ [`${prefixCls}-checked`]: switchChecked,
120
+ [`${prefixCls}-disabled`]: disabled
121
+ },
122
+ className
123
+ )
124
+ }, others),
125
+ /* @__PURE__ */ import_react.default.createElement(
126
+ "input",
127
+ __spreadProps(__spreadValues({
128
+ ref: inputRef,
129
+ type: "checkbox",
130
+ name,
131
+ checked: switchChecked,
132
+ disabled
133
+ }, inputProps), {
134
+ onChange: handleChange,
135
+ className: (0, import_clsx.default)(`${prefixCls}-input`, inputProps == null ? void 0 : inputProps.className)
136
+ })
137
+ ),
138
+ (checkedChildren || unCheckedChildren) && /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefixCls}-inner` }, switchChecked ? checkedChildren : unCheckedChildren)
139
+ );
140
+ }
141
+ );
140
142
  Switch.displayName = "BuiSwitch";
141
- Switch.defaultProps = {
142
- disabled: false,
143
- size: "medium",
144
- color: "primary"
145
- };
146
143
  var Switch_default = Switch;
@@ -63,9 +63,9 @@ var import_TabBar = require("./TabBar.css");
63
63
  const prefixCls = "bui-tab-bar";
64
64
  const TabBar = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
65
65
  const _a = props || {}, {
66
- current,
67
- activeColor,
68
- color,
66
+ current = 0,
67
+ activeColor = "primary",
68
+ color = "default",
69
69
  children,
70
70
  className,
71
71
  onChange
@@ -97,9 +97,4 @@ const TabBar = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
97
97
  );
98
98
  });
99
99
  TabBar.displayName = "BuiTabBar";
100
- TabBar.defaultProps = {
101
- activeColor: "primary",
102
- color: "default",
103
- current: 0
104
- };
105
100
  var TabBar_default = TabBar;
package/dist/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/dist/Tabs/Tab.js CHANGED
@@ -80,14 +80,13 @@ const Tab = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
80
80
  "onClick"
81
81
  ]);
82
82
  const tabsContext = import_react.default.useContext(import_TabsContext.default);
83
- const { value, align, triggerChange } = tabsContext;
83
+ const { value, triggerChange } = tabsContext;
84
84
  return /* @__PURE__ */ import_react.default.createElement(
85
85
  "div",
86
86
  __spreadProps(__spreadValues({
87
87
  ref,
88
88
  className: (0, import_clsx.default)(
89
89
  prefixCls,
90
- align !== "start" && `${prefixCls}-${align}`,
91
90
  {
92
91
  [`${prefixCls}-active`]: !import_utils.isMini && index === value,
93
92
  [`${prefixCls}-miniapp-active`]: import_utils.isMini && index === value,
@@ -109,7 +108,7 @@ const Tab = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
109
108
  "div",
110
109
  {
111
110
  className: (0, import_clsx.default)(`${prefixCls}-miniapp-active-line`, {
112
- "bui-tabline-invisible": index !== value
111
+ "bui-indicator-invisible": index !== value
113
112
  })
114
113
  }
115
114
  )
@@ -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/dist/Tabs/Tabs.js CHANGED
@@ -61,29 +61,29 @@ var import_clsx = __toESM(require("clsx"));
61
61
  var import_react = __toESM(require("react"));
62
62
  var import_Tab = __toESM(require("./Tab"));
63
63
  var import_TabsContext = require("./TabsContext");
64
- var import_scroll = __toESM(require("./utils/scroll"));
64
+ var import_bound = __toESM(require("./utils/bound"));
65
65
  var import_Tabs2 = require("./Tabs.css");
66
66
  const prefixCls = "bui-tabs";
67
- const duration = 300;
68
67
  const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
69
- const _a = props, { children, className, value, tabs, align, onChange } = _a, others = __objRest(_a, ["children", "className", "value", "tabs", "align", "onChange"]);
70
- const [active, setActive] = (0, import_react.useState)("");
68
+ const _a = props, { children, className, value, tabs = [], onChange } = _a, others = __objRest(_a, ["children", "className", "value", "tabs", "onChange"]);
71
69
  const tabsRef = (0, import_react.useRef)(null);
72
70
  const activeLineRef = (0, import_react.useRef)(null);
73
- const [lineData, setLineData] = (0, import_react.useState)({
71
+ const [indicatorData, setIndicatorData] = (0, import_react.useState)({
74
72
  x: 0,
75
- transitionInUse: false,
76
73
  hasActiveTab: false
77
74
  });
78
75
  const [maskData, setMaskData] = (0, import_react.useState)({
79
76
  leftMaskOpacity: 0,
80
77
  rightMaskOpacity: 0
81
78
  });
82
- const getActiveTabElement = () => {
79
+ const animate = (0, import_utils.useEventCallback)(() => {
83
80
  const container = tabsRef.current;
84
81
  if (!container)
85
- return void 0;
86
- const activeIndex = !!tabs.length && tabs.findIndex((item) => item.index === active);
82
+ return;
83
+ const activeIndex = !!tabs.length && tabs.findIndex((item) => item.index === value);
84
+ const activeLine = activeLineRef.current;
85
+ if (!activeLine)
86
+ return;
87
87
  let activeTab;
88
88
  if (tabs.length) {
89
89
  activeTab = activeIndex > -1 ? container.childNodes[activeIndex + 1] : void 0;
@@ -97,25 +97,6 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
97
97
  return [...child.classList].includes("bui-tab-active");
98
98
  });
99
99
  }
100
- return activeTab;
101
- };
102
- const scrollIntoView = () => {
103
- const tabsContainer = tabsRef.current;
104
- const activeTab = getActiveTabElement();
105
- if (!tabsContainer || !activeTab) {
106
- return;
107
- }
108
- const to = activeTab.offsetLeft - (tabsContainer.offsetWidth - activeTab.offsetWidth) / 2;
109
- (0, import_scroll.default)(tabsContainer, to, duration);
110
- };
111
- const animate = ({ transitionInUse }) => {
112
- const container = tabsRef.current;
113
- if (!container)
114
- return;
115
- const activeLine = activeLineRef.current;
116
- if (!activeLine)
117
- return;
118
- const activeTab = getActiveTabElement();
119
100
  let activeTabLeft = 0;
120
101
  let activeTabWidth = 0;
121
102
  let containerWidth = 0;
@@ -130,37 +111,22 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
130
111
  activeLineWidth = activeLine.offsetWidth;
131
112
  x = activeTabLeft + (activeTabWidth - activeLineWidth) / 2;
132
113
  }
133
- setLineData({
114
+ setIndicatorData({
134
115
  x,
135
- transitionInUse,
136
116
  hasActiveTab: !!activeTab
137
117
  });
138
118
  const maxScrollDistance = containerScrollWidth - containerWidth;
139
119
  if (maxScrollDistance <= 0 || !activeTab)
140
120
  return;
141
- if (!import_utils.isMini) {
142
- scrollIntoView();
121
+ const nextScrollLeft = (0, import_bound.default)(
122
+ activeTabLeft - (containerWidth - activeTabWidth) / 2,
123
+ 0,
124
+ containerScrollWidth - containerWidth
125
+ );
126
+ if (tabsRef.current) {
127
+ tabsRef.current.scrollLeft = nextScrollLeft;
143
128
  }
144
- };
145
- (0, import_react.useEffect)(() => {
146
- setActive(value);
147
- }, [value]);
148
- (0, import_react.useLayoutEffect)(() => {
149
- animate({ transitionInUse: false });
150
- }, []);
151
- (0, import_react.useEffect)(() => {
152
- const handleResize = (0, import_utils.debounce)(() => {
153
- animate({ transitionInUse: true });
154
- updateMask();
155
- }, 100);
156
- window.addEventListener("resize", handleResize);
157
- return () => {
158
- window.removeEventListener("resize", handleResize);
159
- };
160
- }, [active]);
161
- (0, import_utils.useDidMountEffect)(() => {
162
- animate({ transitionInUse: true });
163
- }, [active, tabs, children]);
129
+ });
164
130
  const updateMask = (0, import_react.useMemo)(
165
131
  () => (0, import_utils.throttle)(
166
132
  () => {
@@ -169,10 +135,7 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
169
135
  return;
170
136
  const scrollLeft = container == null ? void 0 : container.scrollLeft;
171
137
  const showLeftMask = scrollLeft > 0;
172
- const rightRange = Math.abs(
173
- container.scrollWidth - (scrollLeft + container.offsetWidth)
174
- );
175
- const showRightMask = rightRange > 1;
138
+ const showRightMask = scrollLeft + container.offsetWidth < container.scrollWidth;
176
139
  setMaskData({
177
140
  leftMaskOpacity: showLeftMask ? 1 : 0,
178
141
  rightMaskOpacity: showRightMask ? 1 : 0
@@ -186,7 +149,20 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
186
149
  ),
187
150
  []
188
151
  );
189
- (0, import_react.useLayoutEffect)(() => {
152
+ (0, import_react.useEffect)(() => {
153
+ animate();
154
+ }, [value]);
155
+ (0, import_react.useEffect)(() => {
156
+ const handleResize = (0, import_utils.debounce)(() => {
157
+ animate();
158
+ updateMask();
159
+ }, 100);
160
+ window.addEventListener("resize", handleResize);
161
+ return () => {
162
+ window.removeEventListener("resize", handleResize);
163
+ };
164
+ }, []);
165
+ (0, import_react.useEffect)(() => {
190
166
  updateMask();
191
167
  }, []);
192
168
  const handleClick = (e, item) => {
@@ -196,16 +172,13 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
196
172
  if (index === void 0 || index === null) {
197
173
  return;
198
174
  }
199
- if (active !== value) {
200
- setActive(index);
201
- }
202
175
  if (index !== value) {
203
176
  onChange == null ? void 0 : onChange(e, { index });
204
177
  }
205
178
  };
206
179
  const providerValue = (0, import_react.useMemo)(() => {
207
- return { value, align, triggerChange: handleClick };
208
- }, [value, align, children, handleClick]);
180
+ return { value, triggerChange: handleClick };
181
+ }, [value, children, handleClick]);
209
182
  return /* @__PURE__ */ import_react.default.createElement("div", __spreadValues({ ref, className: (0, import_clsx.default)(prefixCls, className) }, others), /* @__PURE__ */ import_react.default.createElement(
210
183
  "div",
211
184
  {
@@ -226,12 +199,12 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
226
199
  "div",
227
200
  {
228
201
  ref: activeLineRef,
229
- className: (0, import_clsx.default)(`${prefixCls}-tabline`, {
230
- "bui-tabline-invisible": import_utils.isMini || !lineData.hasActiveTab
202
+ className: (0, import_clsx.default)(`${prefixCls}-indicator`, {
203
+ "bui-indicator-invisible": import_utils.isMini || !indicatorData.hasActiveTab
231
204
  }),
232
205
  style: {
233
- transition: lineData.transitionInUse ? `transform ${duration / 1e3}s ease` : void 0,
234
- transform: `translate3d(${lineData.x}px, 0px, 0px)`
206
+ transition: "transform 0.3s ease-in-out",
207
+ transform: `translate3d(${indicatorData.x}px, 0px, 0px)`
235
208
  }
236
209
  }
237
210
  ), /* @__PURE__ */ import_react.default.createElement(import_TabsContext.TabsContextProvider, { value: providerValue }, !!tabs.length && tabs.map((item) => {
@@ -247,8 +220,4 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
247
220
  }), children)));
248
221
  });
249
222
  Tabs.displayName = "BuiTabs";
250
- Tabs.defaultProps = {
251
- align: "center",
252
- tabs: []
253
- };
254
223
  var Tabs_default = Tabs;
@@ -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;
@@ -15,11 +15,18 @@ var __copyProps = (to, from, except, desc) => {
15
15
  return to;
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var calcAfterMounted_exports = {};
19
- __export(calcAfterMounted_exports, {
20
- default: () => calcAfterMounted_default
18
+ var bound_exports = {};
19
+ __export(bound_exports, {
20
+ default: () => bound
21
21
  });
22
- module.exports = __toCommonJS(calcAfterMounted_exports);
23
- var calcAfterMounted_default = (fn) => {
24
- fn();
25
- };
22
+ module.exports = __toCommonJS(bound_exports);
23
+ function bound(position, min, max) {
24
+ let ret = position;
25
+ if (min !== void 0) {
26
+ ret = Math.max(position, min);
27
+ }
28
+ if (max !== void 0) {
29
+ ret = Math.min(ret, max);
30
+ }
31
+ return ret;
32
+ }
package/dist/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/dist/Tag/Tag.js CHANGED
@@ -77,9 +77,9 @@ const Tag = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
77
77
  const _a = props, {
78
78
  className,
79
79
  style,
80
- color,
80
+ color = "default",
81
81
  htmlColor,
82
- variant,
82
+ variant = "outlined",
83
83
  onClick,
84
84
  children
85
85
  } = _a, others = __objRest(_a, [
@@ -128,8 +128,4 @@ const Tag = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
128
128
  );
129
129
  });
130
130
  Tag.displayName = "BuiTag";
131
- Tag.defaultProps = {
132
- variant: "outlined",
133
- color: "default"
134
- };
135
131
  var Tag_default = Tag;
@@ -70,17 +70,17 @@ const TextArea = /* @__PURE__ */ import_react.default.forwardRef(
70
70
  const _a = props, {
71
71
  className,
72
72
  value,
73
- defaultValue,
73
+ defaultValue = "",
74
74
  textareaProps,
75
75
  textareaRef,
76
76
  name,
77
77
  placeholder,
78
78
  disabled,
79
- rows,
79
+ rows = DEFAULT_ROWS,
80
80
  maxLength,
81
- autoSize,
82
- autoFocus,
83
- showCount,
81
+ autoSize = false,
82
+ autoFocus = false,
83
+ showCount = false,
84
84
  onChange
85
85
  } = _a, others = __objRest(_a, [
86
86
  "className",
@@ -205,11 +205,4 @@ const TextArea = /* @__PURE__ */ import_react.default.forwardRef(
205
205
  }
206
206
  );
207
207
  TextArea.displayName = "BuiTextArea";
208
- TextArea.defaultProps = {
209
- defaultValue: "",
210
- rows: DEFAULT_ROWS,
211
- autoSize: false,
212
- autoFocus: false,
213
- showCount: false
214
- };
215
208
  var TextArea_default = TextArea;
@@ -100,7 +100,7 @@ const functionalToast = (props) => {
100
100
  rootWrapper.style[property] = styles[property];
101
101
  });
102
102
  }
103
- const rootElement = (0, import_utils.getRootContainer)();
103
+ const rootElement = (0, import_utils.getRootElement)();
104
104
  rootElement.appendChild(rootWrapper);
105
105
  const ToastComponent = () => {
106
106
  const _a = options, { duration, allowMultiple, onClose } = _a, others = __objRest(_a, ["duration", "allowMultiple", "onClose"]);
@@ -13,6 +13,7 @@
13
13
  position: fixed;
14
14
  left: 50%;
15
15
  z-index: var(--bui-z-index-toast);
16
+ width: fit-content;
16
17
  min-width: var(--min-width);
17
18
  max-width: var(--max-width);
18
19
  padding: var(--padding);