@bifrostui/react 1.4.6 → 1.4.7-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 (232) hide show
  1. package/dist/Calendar/Calendar.js +5 -1
  2. package/dist/Calendar/Calendar.types.d.ts +5 -0
  3. package/dist/CitySelector/CitySelectorCore.js +3 -3
  4. package/dist/Collapse/Collapse.css +0 -1
  5. package/dist/Collapse/Collapse.d.ts +1 -1
  6. package/dist/Collapse/Collapse.js +11 -8
  7. package/dist/Collapse/Collapse.miniapp.d.ts +5 -0
  8. package/dist/Collapse/Collapse.miniapp.js +177 -0
  9. package/dist/CollapsePanel/CollapsePanel.css +4 -2
  10. package/dist/DatePicker/DatePicker.d.ts +4 -0
  11. package/dist/DatePicker/DatePicker.js +335 -0
  12. package/dist/DatePicker/DatePicker.types.d.ts +43 -0
  13. package/dist/DatePicker/DatePicker.types.js +35 -0
  14. package/dist/DatePicker/index.d.ts +2 -0
  15. package/dist/DatePicker/index.js +41 -0
  16. package/dist/DesktopDatePicker/DesktopDatePicker.d.ts +5 -0
  17. package/dist/DesktopDatePicker/DesktopDatePicker.js +280 -0
  18. package/dist/DesktopDatePicker/DesktopDatePicker.types.d.ts +163 -0
  19. package/dist/DesktopDatePicker/DesktopDatePicker.types.js +15 -0
  20. package/dist/DesktopDatePicker/deskTopPickerContainer.css +100 -0
  21. package/dist/DesktopDatePicker/index.css +61 -0
  22. package/dist/DesktopDatePicker/index.d.ts +2 -0
  23. package/dist/DesktopDatePicker/index.js +41 -0
  24. package/dist/DesktopDatePicker/useGetDatePickerContent.d.ts +6 -0
  25. package/dist/DesktopDatePicker/useGetDatePickerContent.js +343 -0
  26. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +5 -0
  27. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.js +322 -0
  28. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +163 -0
  29. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.js +15 -0
  30. package/dist/DesktopDateTimePicker/index.css +66 -0
  31. package/dist/DesktopDateTimePicker/index.d.ts +2 -0
  32. package/dist/DesktopDateTimePicker/index.js +41 -0
  33. package/dist/DesktopPicker/DesktopPicker.d.ts +5 -0
  34. package/dist/DesktopPicker/DesktopPicker.js +238 -0
  35. package/dist/DesktopPicker/DesktopPicker.types.d.ts +57 -0
  36. package/dist/DesktopPicker/DesktopPicker.types.js +15 -0
  37. package/dist/DesktopPicker/index.css +37 -0
  38. package/dist/DesktopPicker/index.d.ts +2 -0
  39. package/dist/DesktopPicker/index.js +41 -0
  40. package/dist/DesktopPicker/utils/calcAfterMounted.d.ts +2 -0
  41. package/dist/{Tabs/utils/bound.js → DesktopPicker/utils/calcAfterMounted.js} +7 -14
  42. package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +2 -0
  43. package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.js +38 -0
  44. package/dist/DesktopTimePicker/DesktopTimePicker.d.ts +5 -0
  45. package/dist/DesktopTimePicker/DesktopTimePicker.js +288 -0
  46. package/dist/DesktopTimePicker/DesktopTimePicker.types.d.ts +182 -0
  47. package/dist/DesktopTimePicker/DesktopTimePicker.types.js +15 -0
  48. package/dist/DesktopTimePicker/DesktopTimePickerList.d.ts +4 -0
  49. package/dist/DesktopTimePicker/DesktopTimePickerList.js +111 -0
  50. package/dist/DesktopTimePicker/index.css +170 -0
  51. package/dist/DesktopTimePicker/index.d.ts +2 -0
  52. package/dist/DesktopTimePicker/index.js +41 -0
  53. package/dist/DesktopTimePicker/useGetTimePickerContent.d.ts +6 -0
  54. package/dist/DesktopTimePicker/useGetTimePickerContent.js +246 -0
  55. package/dist/DesktopTimePicker/utils/scrollUtil.d.ts +2 -0
  56. package/dist/DesktopTimePicker/utils/scrollUtil.js +27 -0
  57. package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +2 -0
  58. package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.js +51 -0
  59. package/dist/DesktopTimePicker/utils/utils.d.ts +28 -0
  60. package/dist/DesktopTimePicker/utils/utils.js +408 -0
  61. package/dist/Dialog/FunctionalDialog.js +1 -1
  62. package/dist/ItemSelector/ItemSelector.css +120 -0
  63. package/dist/ItemSelector/ItemSelector.d.ts +4 -0
  64. package/dist/ItemSelector/ItemSelector.js +84 -0
  65. package/dist/ItemSelector/ItemSelector.miniapp.d.ts +5 -0
  66. package/dist/ItemSelector/ItemSelector.miniapp.js +125 -0
  67. package/dist/ItemSelector/ItemSelector.types.d.ts +40 -0
  68. package/dist/ItemSelector/ItemSelector.types.js +15 -0
  69. package/dist/ItemSelector/ItemSelectorCore.d.ts +5 -0
  70. package/dist/ItemSelector/ItemSelectorCore.js +217 -0
  71. package/dist/ItemSelector/Selector/index.css +11 -0
  72. package/dist/ItemSelector/Selector/index.d.ts +9 -0
  73. package/dist/ItemSelector/Selector/index.js +48 -0
  74. package/dist/ItemSelector/index.d.ts +2 -0
  75. package/dist/ItemSelector/index.js +41 -0
  76. package/dist/ItemSelector/miniapp.css +4 -0
  77. package/dist/Modal/Modal.miniapp.d.ts +1 -1
  78. package/dist/Picker/Picker.css +5 -0
  79. package/dist/Picker/Picker.js +27 -5
  80. package/dist/Picker/Picker.types.d.ts +15 -2
  81. package/dist/Picker/PickerPanel.css +4 -0
  82. package/dist/Picker/PickerPanel.js +7 -6
  83. package/dist/Popover/Popover.js +70 -27
  84. package/dist/Portal/Portal.miniapp.js +7 -4
  85. package/dist/ScrollView/ScrollView.js +24 -11
  86. package/dist/ScrollView/ScrollView.types.d.ts +0 -1
  87. package/dist/Select/Select.css +1 -4
  88. package/dist/Select/Select.js +63 -40
  89. package/dist/Slider/Slider.js +13 -5
  90. package/dist/SwipeAction/SwipeAction.css +79 -0
  91. package/dist/SwipeAction/SwipeAction.d.ts +5 -0
  92. package/dist/SwipeAction/SwipeAction.js +349 -0
  93. package/dist/SwipeAction/SwipeAction.types.d.ts +83 -0
  94. package/dist/SwipeAction/SwipeAction.types.js +39 -0
  95. package/dist/SwipeAction/SwipeActionContext.d.ts +4 -0
  96. package/dist/SwipeAction/SwipeActionContext.js +30 -0
  97. package/dist/SwipeAction/SwipeActionItem.css +31 -0
  98. package/dist/SwipeAction/SwipeActionItem.d.ts +5 -0
  99. package/dist/SwipeAction/SwipeActionItem.js +105 -0
  100. package/dist/SwipeAction/index.d.ts +4 -0
  101. package/dist/SwipeAction/index.js +45 -0
  102. package/dist/Tabs/Tab.js +13 -4
  103. package/dist/Tabs/Tabs.js +30 -15
  104. package/dist/Tabs/utils/scroll.d.ts +2 -0
  105. package/dist/Tabs/utils/scroll.js +55 -0
  106. package/dist/Toast/FunctionalToast.js +1 -1
  107. package/dist/Toast/Toast.css +0 -1
  108. package/dist/Tooltip/Tooltip.js +70 -27
  109. package/dist/index.d.ts +7 -0
  110. package/dist/index.js +15 -1
  111. package/dist/locales/base.d.ts +11 -0
  112. package/dist/locales/en-US.js +24 -0
  113. package/dist/locales/zh-CN.js +24 -0
  114. package/dist/locales/zh-TW.js +24 -0
  115. package/es/Calendar/Calendar.js +5 -1
  116. package/es/Calendar/Calendar.types.d.ts +5 -0
  117. package/es/CitySelector/CitySelectorCore.js +3 -3
  118. package/es/Collapse/Collapse.css +0 -1
  119. package/es/Collapse/Collapse.d.ts +1 -1
  120. package/es/Collapse/Collapse.js +11 -8
  121. package/es/Collapse/Collapse.miniapp.d.ts +5 -0
  122. package/es/Collapse/Collapse.miniapp.js +157 -0
  123. package/es/CollapsePanel/CollapsePanel.css +4 -2
  124. package/es/DatePicker/DatePicker.d.ts +4 -0
  125. package/es/DatePicker/DatePicker.js +310 -0
  126. package/es/DatePicker/DatePicker.types.d.ts +43 -0
  127. package/es/DatePicker/DatePicker.types.js +1 -0
  128. package/es/DatePicker/index.d.ts +2 -0
  129. package/es/DatePicker/index.js +6 -0
  130. package/es/DesktopDatePicker/DesktopDatePicker.d.ts +5 -0
  131. package/es/DesktopDatePicker/DesktopDatePicker.js +253 -0
  132. package/es/DesktopDatePicker/DesktopDatePicker.types.d.ts +163 -0
  133. package/es/DesktopDatePicker/DesktopDatePicker.types.js +1 -0
  134. package/es/DesktopDatePicker/deskTopPickerContainer.css +100 -0
  135. package/es/DesktopDatePicker/index.css +61 -0
  136. package/es/DesktopDatePicker/index.d.ts +2 -0
  137. package/es/DesktopDatePicker/index.js +6 -0
  138. package/es/DesktopDatePicker/useGetDatePickerContent.d.ts +6 -0
  139. package/es/DesktopDatePicker/useGetDatePickerContent.js +316 -0
  140. package/es/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +5 -0
  141. package/es/DesktopDateTimePicker/DesktopDateTimePicker.js +295 -0
  142. package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +163 -0
  143. package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.js +1 -0
  144. package/es/DesktopDateTimePicker/index.css +66 -0
  145. package/es/DesktopDateTimePicker/index.d.ts +2 -0
  146. package/es/DesktopDateTimePicker/index.js +9 -0
  147. package/es/DesktopPicker/DesktopPicker.d.ts +5 -0
  148. package/es/DesktopPicker/DesktopPicker.js +221 -0
  149. package/es/DesktopPicker/DesktopPicker.types.d.ts +57 -0
  150. package/es/DesktopPicker/DesktopPicker.types.js +1 -0
  151. package/es/DesktopPicker/index.css +37 -0
  152. package/es/DesktopPicker/index.d.ts +2 -0
  153. package/es/DesktopPicker/index.js +6 -0
  154. package/es/DesktopPicker/utils/calcAfterMounted.d.ts +2 -0
  155. package/es/DesktopPicker/utils/calcAfterMounted.js +6 -0
  156. package/es/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +2 -0
  157. package/es/DesktopPicker/utils/calcAfterMounted.miniapp.js +9 -0
  158. package/es/DesktopTimePicker/DesktopTimePicker.d.ts +5 -0
  159. package/es/DesktopTimePicker/DesktopTimePicker.js +261 -0
  160. package/es/DesktopTimePicker/DesktopTimePicker.types.d.ts +182 -0
  161. package/es/DesktopTimePicker/DesktopTimePicker.types.js +1 -0
  162. package/es/DesktopTimePicker/DesktopTimePickerList.d.ts +4 -0
  163. package/es/DesktopTimePicker/DesktopTimePickerList.js +84 -0
  164. package/es/DesktopTimePicker/index.css +170 -0
  165. package/es/DesktopTimePicker/index.d.ts +2 -0
  166. package/es/DesktopTimePicker/index.js +6 -0
  167. package/es/DesktopTimePicker/useGetTimePickerContent.d.ts +6 -0
  168. package/es/DesktopTimePicker/useGetTimePickerContent.js +223 -0
  169. package/es/DesktopTimePicker/utils/scrollUtil.d.ts +2 -0
  170. package/es/DesktopTimePicker/utils/scrollUtil.js +8 -0
  171. package/es/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +2 -0
  172. package/es/DesktopTimePicker/utils/scrollUtil.miniapp.js +22 -0
  173. package/es/DesktopTimePicker/utils/utils.d.ts +28 -0
  174. package/es/DesktopTimePicker/utils/utils.js +365 -0
  175. package/es/Dialog/FunctionalDialog.js +2 -2
  176. package/es/ItemSelector/ItemSelector.css +120 -0
  177. package/es/ItemSelector/ItemSelector.d.ts +4 -0
  178. package/es/ItemSelector/ItemSelector.js +57 -0
  179. package/es/ItemSelector/ItemSelector.miniapp.d.ts +5 -0
  180. package/es/ItemSelector/ItemSelector.miniapp.js +98 -0
  181. package/es/ItemSelector/ItemSelector.types.d.ts +40 -0
  182. package/es/ItemSelector/ItemSelector.types.js +1 -0
  183. package/es/ItemSelector/ItemSelectorCore.d.ts +5 -0
  184. package/es/ItemSelector/ItemSelectorCore.js +190 -0
  185. package/es/ItemSelector/Selector/index.css +11 -0
  186. package/es/ItemSelector/Selector/index.d.ts +9 -0
  187. package/es/ItemSelector/Selector/index.js +19 -0
  188. package/es/ItemSelector/index.d.ts +2 -0
  189. package/es/ItemSelector/index.js +6 -0
  190. package/es/ItemSelector/miniapp.css +4 -0
  191. package/es/Modal/Modal.miniapp.d.ts +1 -1
  192. package/es/Picker/Picker.css +5 -0
  193. package/es/Picker/Picker.js +27 -5
  194. package/es/Picker/Picker.types.d.ts +15 -2
  195. package/es/Picker/PickerPanel.css +4 -0
  196. package/es/Picker/PickerPanel.js +7 -6
  197. package/es/Popover/Popover.js +73 -29
  198. package/es/Portal/Portal.miniapp.js +8 -5
  199. package/es/ScrollView/ScrollView.js +24 -11
  200. package/es/ScrollView/ScrollView.types.d.ts +0 -1
  201. package/es/Select/Select.css +1 -4
  202. package/es/Select/Select.js +63 -41
  203. package/es/Slider/Slider.js +16 -6
  204. package/es/SwipeAction/SwipeAction.css +79 -0
  205. package/es/SwipeAction/SwipeAction.d.ts +5 -0
  206. package/es/SwipeAction/SwipeAction.js +337 -0
  207. package/es/SwipeAction/SwipeAction.types.d.ts +83 -0
  208. package/es/SwipeAction/SwipeAction.types.js +1 -0
  209. package/es/SwipeAction/SwipeActionContext.d.ts +4 -0
  210. package/es/SwipeAction/SwipeActionContext.js +11 -0
  211. package/es/SwipeAction/SwipeActionItem.css +31 -0
  212. package/es/SwipeAction/SwipeActionItem.d.ts +5 -0
  213. package/es/SwipeAction/SwipeActionItem.js +78 -0
  214. package/es/SwipeAction/index.d.ts +4 -0
  215. package/es/SwipeAction/index.js +9 -0
  216. package/es/Tabs/Tab.js +13 -4
  217. package/es/Tabs/Tabs.js +30 -15
  218. package/es/Tabs/utils/scroll.d.ts +2 -0
  219. package/es/Tabs/utils/scroll.js +36 -0
  220. package/es/Toast/FunctionalToast.js +2 -2
  221. package/es/Toast/Toast.css +0 -1
  222. package/es/Tooltip/Tooltip.js +73 -29
  223. package/es/index.d.ts +7 -0
  224. package/es/index.js +7 -0
  225. package/es/locales/base.d.ts +11 -0
  226. package/es/locales/en-US.js +24 -0
  227. package/es/locales/zh-CN.js +24 -0
  228. package/es/locales/zh-TW.js +24 -0
  229. package/package.json +5 -5
  230. package/dist/Tabs/utils/bound.d.ts +0 -1
  231. package/es/Tabs/utils/bound.d.ts +0 -1
  232. package/es/Tabs/utils/bound.js +0 -13
@@ -0,0 +1,2 @@
1
+ declare const scrollLeftTo: (scroller: HTMLElement, to: number, duration: number) => void;
2
+ export default scrollLeftTo;
@@ -0,0 +1,36 @@
1
+ const root = window || global;
2
+ let rafId;
3
+ let prev = Date.now();
4
+ const rafPolyfill = (fn) => {
5
+ const curr = Date.now();
6
+ const ms = Math.max(0, 16 - (curr - prev));
7
+ const id = setTimeout(fn, ms);
8
+ prev = curr + ms;
9
+ return id;
10
+ };
11
+ const cancelRaf = (id) => {
12
+ const cancelAnimationFrame = (root == null ? void 0 : root.cancelAnimationFrame) || (root == null ? void 0 : root.clearTimeout) || clearTimeout;
13
+ cancelAnimationFrame.call(root, id);
14
+ };
15
+ const raf = (fn) => {
16
+ const requestAnimationFrame = (root == null ? void 0 : root.requestAnimationFrame) || rafPolyfill;
17
+ return requestAnimationFrame.call(root, fn);
18
+ };
19
+ const scrollLeftTo = (scroller, to, duration) => {
20
+ cancelRaf(rafId);
21
+ let count = 0;
22
+ const from = scroller.scrollLeft;
23
+ const frames = duration === 0 ? 1 : Math.round(duration / 16);
24
+ function animate() {
25
+ scroller.scrollLeft += (to - from) / frames;
26
+ count += 1;
27
+ if (count < frames) {
28
+ rafId = raf(animate);
29
+ }
30
+ }
31
+ animate();
32
+ };
33
+ var scroll_default = scrollLeftTo;
34
+ export {
35
+ scroll_default as default
36
+ };
@@ -29,7 +29,7 @@ var __objRest = (source, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
- import { render, unmount, getRootElement } from "@bifrostui/utils";
32
+ import { render, unmount, getRootContainer } 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 = getRootElement();
73
+ const rootElement = getRootContainer();
74
74
  rootElement.appendChild(rootWrapper);
75
75
  const ToastComponent = () => {
76
76
  const _a = options, { duration, allowMultiple, onClose } = _a, others = __objRest(_a, ["duration", "allowMultiple", "onClose"]);
@@ -13,7 +13,6 @@
13
13
  position: fixed;
14
14
  left: 50%;
15
15
  z-index: var(--bui-z-index-toast);
16
- width: fit-content;
17
16
  min-width: var(--min-width);
18
17
  max-width: var(--max-width);
19
18
  padding: var(--padding);
@@ -26,14 +26,35 @@ var __objRest = (source, exclude) => {
26
26
  }
27
27
  return target;
28
28
  };
29
+ var __async = (__this, __arguments, generator) => {
30
+ return new Promise((resolve, reject) => {
31
+ var fulfilled = (value) => {
32
+ try {
33
+ step(generator.next(value));
34
+ } catch (e) {
35
+ reject(e);
36
+ }
37
+ };
38
+ var rejected = (value) => {
39
+ try {
40
+ step(generator.throw(value));
41
+ } catch (e) {
42
+ reject(e);
43
+ }
44
+ };
45
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
46
+ step((generator = generator.apply(__this, __arguments)).next());
47
+ });
48
+ };
29
49
  import clsx from "clsx";
30
50
  import React, { useState, useRef, useEffect } from "react";
31
51
  import {
32
52
  getStylesAndLocation,
33
53
  triggerEventTransform,
34
54
  parsePlacement,
35
- useUniqueId,
36
- throttle
55
+ throttle,
56
+ useForkRef,
57
+ isMini
37
58
  } from "@bifrostui/utils";
38
59
  import Portal from "../Portal";
39
60
  import "./Tooltip.css";
@@ -48,8 +69,8 @@ const Tooltip = /* @__PURE__ */ React.forwardRef((props, ref) => {
48
69
  offsetSpacing = 0,
49
70
  placement = "top",
50
71
  trigger = "click",
51
- onOpenChange,
52
- open
72
+ open,
73
+ onOpenChange
53
74
  } = _a, others = __objRest(_a, [
54
75
  "className",
55
76
  "style",
@@ -59,8 +80,8 @@ const Tooltip = /* @__PURE__ */ React.forwardRef((props, ref) => {
59
80
  "offsetSpacing",
60
81
  "placement",
61
82
  "trigger",
62
- "onOpenChange",
63
- "open"
83
+ "open",
84
+ "onOpenChange"
64
85
  ]);
65
86
  const controlByUser = typeof open !== "undefined";
66
87
  const { direction, location = "center" } = parsePlacement(placement);
@@ -68,11 +89,18 @@ const Tooltip = /* @__PURE__ */ React.forwardRef((props, ref) => {
68
89
  const [openStatus, setOpenStatus] = useState(defaultOpen);
69
90
  const [arrowDirection, setArrowDirection] = useState(direction);
70
91
  const [arrowLocation, setArrowLocation] = useState(location);
71
- const [tooltyles, setTooltyles] = useState({});
72
- const ttId = useUniqueId();
92
+ const [toolStyles, setToolStyles] = useState({});
93
+ const tipRef = useRef(null);
94
+ const nodeRef = useForkRef(ref, tipRef);
95
+ const clearRef = (status) => {
96
+ if (status === false) {
97
+ tipRef.current = null;
98
+ }
99
+ };
73
100
  const changeOpenStatus = (event, status) => {
74
101
  if (controlByUser)
75
102
  return;
103
+ clearRef(status);
76
104
  setOpenStatus(status);
77
105
  onOpenChange == null ? void 0 : onOpenChange(event, { open: status });
78
106
  };
@@ -91,23 +119,33 @@ const Tooltip = /* @__PURE__ */ React.forwardRef((props, ref) => {
91
119
  if (!controlByUser)
92
120
  return;
93
121
  setOpenStatus(open);
122
+ clearRef(open);
94
123
  }, [open]);
124
+ useEffect(() => {
125
+ if (!openStatus) {
126
+ setToolStyles({
127
+ visibility: "hidden"
128
+ });
129
+ }
130
+ }, [openStatus]);
95
131
  const clickEventHandler = (event) => {
96
132
  if (trigger === "hover" || (trigger == null ? void 0 : trigger.length) === 1 && (trigger == null ? void 0 : trigger[0]) === "hover")
97
133
  return;
98
134
  hideTooltip(event);
99
135
  };
100
- const onRootElementMouted = throttle(() => {
136
+ const onRootElementMouted = throttle(() => __async(void 0, null, function* () {
137
+ if (!tipRef.current)
138
+ return;
101
139
  const {
102
140
  direction: newParsedDirection,
103
141
  location: newParsedLocation = "center"
104
142
  } = parsePlacement(placement);
105
- const result = getStylesAndLocation({
143
+ const result = yield getStylesAndLocation({
106
144
  childrenRef,
107
145
  arrowDirection: newParsedDirection,
108
146
  arrowLocation: newParsedLocation,
109
147
  offsetSpacing,
110
- selector: `[data-id="tt_${ttId}"]`
148
+ tipRef
111
149
  });
112
150
  if (!result)
113
151
  return;
@@ -118,26 +156,32 @@ const Tooltip = /* @__PURE__ */ React.forwardRef((props, ref) => {
118
156
  if (newArrowLocation !== arrowLocation) {
119
157
  setArrowLocation(newArrowLocation);
120
158
  }
121
- setTooltyles(styles);
122
- }, 100);
123
- const bindEvent = () => {
124
- if (!controlByUser) {
125
- document.addEventListener("click", clickEventHandler);
126
- }
127
- window.addEventListener("resize", onRootElementMouted);
128
- };
129
- const unbindEvent = () => {
130
- if (!controlByUser) {
131
- document.removeEventListener("click", clickEventHandler);
132
- }
133
- window.removeEventListener("resize", onRootElementMouted);
134
- };
159
+ setToolStyles(styles);
160
+ }), 100);
135
161
  useEffect(() => {
162
+ const bindEvent = () => {
163
+ if (!openStatus)
164
+ return;
165
+ if (!controlByUser) {
166
+ document.addEventListener("click", clickEventHandler);
167
+ }
168
+ if (!isMini) {
169
+ window.addEventListener("resize", onRootElementMouted);
170
+ }
171
+ };
172
+ const unbindEvent = () => {
173
+ if (!controlByUser) {
174
+ document.removeEventListener("click", clickEventHandler);
175
+ }
176
+ if (!isMini) {
177
+ window.removeEventListener("resize", onRootElementMouted);
178
+ }
179
+ };
136
180
  bindEvent();
137
181
  return () => {
138
182
  unbindEvent();
139
183
  };
140
- }, []);
184
+ }, [openStatus]);
141
185
  let triggerEventOption;
142
186
  if (!controlByUser) {
143
187
  triggerEventOption = triggerEventTransform({
@@ -150,12 +194,12 @@ const Tooltip = /* @__PURE__ */ React.forwardRef((props, ref) => {
150
194
  const childrenOptions = __spreadValues({
151
195
  ref: childrenRef
152
196
  }, triggerEventOption);
153
- return /* @__PURE__ */ React.createElement(React.Fragment, null, (open || openStatus) && title ? /* @__PURE__ */ React.createElement(Portal, { onRootElementMouted, ref }, /* @__PURE__ */ React.createElement(
197
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, (open || openStatus) && title ? /* @__PURE__ */ React.createElement(Portal, { onRootElementMouted }, /* @__PURE__ */ React.createElement(
154
198
  "div",
155
199
  __spreadValues({
156
200
  className: clsx(prefixCls, className, `tooltip-${arrowDirection}`),
157
- style: __spreadValues(__spreadValues({}, style), tooltyles),
158
- "data-id": `tt_${ttId}`
201
+ style: __spreadValues(__spreadValues({}, style), toolStyles),
202
+ ref: nodeRef
159
203
  }, others),
160
204
  /* @__PURE__ */ React.createElement(
161
205
  "div",
package/es/index.d.ts CHANGED
@@ -8,6 +8,11 @@ export * from './Calendar';
8
8
  export * from './Card';
9
9
  export * from './Checkbox';
10
10
  export * from './Collapse';
11
+ export * from './DatePicker';
12
+ export * from './DesktopDatePicker';
13
+ export * from './DesktopTimePicker';
14
+ export * from './DesktopDateTimePicker';
15
+ export * from './DesktopPicker';
11
16
  export * from './Divider';
12
17
  export * from './Drawer';
13
18
  export * from './Fade';
@@ -40,6 +45,7 @@ export * from './Loading';
40
45
  export * from './TabBar';
41
46
  export * from './Countdown';
42
47
  export * from './CitySelector';
48
+ export * from './ItemSelector';
43
49
  export * from './Picker';
44
50
  export * from './CollapsePanel';
45
51
  export * from './Breadcrumb';
@@ -47,3 +53,4 @@ export * from './Toast';
47
53
  export * from './Dialog';
48
54
  export * from './ThemeProvider';
49
55
  export * from './locales';
56
+ export * from './SwipeAction';
package/es/index.js CHANGED
@@ -8,6 +8,11 @@ export * from "./Calendar";
8
8
  export * from "./Card";
9
9
  export * from "./Checkbox";
10
10
  export * from "./Collapse";
11
+ export * from "./DatePicker";
12
+ export * from "./DesktopDatePicker";
13
+ export * from "./DesktopTimePicker";
14
+ export * from "./DesktopDateTimePicker";
15
+ export * from "./DesktopPicker";
11
16
  export * from "./Divider";
12
17
  export * from "./Drawer";
13
18
  export * from "./Fade";
@@ -40,6 +45,7 @@ export * from "./Loading";
40
45
  export * from "./TabBar";
41
46
  export * from "./Countdown";
42
47
  export * from "./CitySelector";
48
+ export * from "./ItemSelector";
43
49
  export * from "./Picker";
44
50
  export * from "./CollapsePanel";
45
51
  export * from "./Breadcrumb";
@@ -47,3 +53,4 @@ export * from "./Toast";
47
53
  export * from "./Dialog";
48
54
  export * from "./ThemeProvider";
49
55
  export * from "./locales";
56
+ export * from "./SwipeAction";
@@ -37,4 +37,15 @@ export interface BaseLang {
37
37
  currentType?: Record<string, string>;
38
38
  hotCityType?: Record<string, string>;
39
39
  };
40
+ desktopDatePicker?: {
41
+ month?: Record<number, string>;
42
+ };
43
+ datePicker?: {
44
+ year: string;
45
+ month: string;
46
+ day: string;
47
+ hour: string;
48
+ minute: string;
49
+ second: string;
50
+ };
40
51
  }
@@ -42,6 +42,30 @@ const enUS = {
42
42
  title: "Hot",
43
43
  code: "HOT"
44
44
  }
45
+ },
46
+ desktopDatePicker: {
47
+ month: {
48
+ 1: "Jan",
49
+ 2: "Feb",
50
+ 3: "Mar",
51
+ 4: "Apr",
52
+ 5: "May",
53
+ 6: "Jun",
54
+ 7: "Jul",
55
+ 8: "Aug",
56
+ 9: "Sep",
57
+ 10: "Oct",
58
+ 11: "Nov",
59
+ 12: "Dec"
60
+ }
61
+ },
62
+ datePicker: {
63
+ year: "Year",
64
+ month: "Month",
65
+ day: "Day",
66
+ hour: "Hour",
67
+ minute: "Minute",
68
+ second: "Second"
45
69
  }
46
70
  };
47
71
  var en_US_default = enUS;
@@ -24,6 +24,30 @@ const zhCN = {
24
24
  located: "\u5B9A\u4F4D",
25
25
  current: "\u5F53\u524D",
26
26
  hot: "\u70ED\u95E8"
27
+ },
28
+ desktopDatePicker: {
29
+ month: {
30
+ 1: "1\u6708",
31
+ 2: "2\u6708",
32
+ 3: "3\u6708",
33
+ 4: "4\u6708",
34
+ 5: "5\u6708",
35
+ 6: "6\u6708",
36
+ 7: "7\u6708",
37
+ 8: "8\u6708",
38
+ 9: "9\u6708",
39
+ 10: "10\u6708",
40
+ 11: "11\u6708",
41
+ 12: "12\u6708"
42
+ }
43
+ },
44
+ datePicker: {
45
+ year: "\u5E74",
46
+ month: "\u6708",
47
+ day: "\u65E5",
48
+ hour: "\u65F6",
49
+ minute: "\u5206",
50
+ second: "\u79D2"
27
51
  }
28
52
  };
29
53
  var zh_CN_default = zhCN;
@@ -24,6 +24,30 @@ const zhTW = {
24
24
  located: "\u5B9A\u4F4D",
25
25
  current: "\u76EE\u524D",
26
26
  hot: "\u71B1\u9580"
27
+ },
28
+ desktopDatePicker: {
29
+ month: {
30
+ 1: "1\u6708",
31
+ 2: "2\u6708",
32
+ 3: "3\u6708",
33
+ 4: "4\u6708",
34
+ 5: "5\u6708",
35
+ 6: "6\u6708",
36
+ 7: "7\u6708",
37
+ 8: "8\u6708",
38
+ 9: "9\u6708",
39
+ 10: "10\u6708",
40
+ 11: "11\u6708",
41
+ 12: "12\u6708"
42
+ }
43
+ },
44
+ datePicker: {
45
+ year: "\u5E74",
46
+ month: "\u6708",
47
+ day: "\u65E5",
48
+ hour: "\u6642",
49
+ minute: "\u5206",
50
+ second: "\u79D2"
27
51
  }
28
52
  };
29
53
  var zh_TW_default = zhTW;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bifrostui/react",
3
- "version": "1.4.6",
3
+ "version": "1.4.7-beta.0",
4
4
  "description": "React components for building mobile application",
5
5
  "homepage": "http://bui.taopiaopiao.com",
6
6
  "license": "MIT",
@@ -33,10 +33,10 @@
33
33
  "clsx": "^1.2.1",
34
34
  "dayjs": "^1.11.7",
35
35
  "swiper": "^8.1.5",
36
- "@bifrostui/icons": "1.4.6",
37
- "@bifrostui/styles": "1.4.6",
38
- "@bifrostui/utils": "1.4.6",
39
- "@bifrostui/types": "1.4.6"
36
+ "@bifrostui/icons": "1.4.7-beta.0",
37
+ "@bifrostui/types": "1.4.7-beta.0",
38
+ "@bifrostui/styles": "1.4.7-beta.0",
39
+ "@bifrostui/utils": "1.4.7-beta.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@tarojs/components": "^3.0.0",
@@ -1 +0,0 @@
1
- export default function bound(position: number, min: number | undefined, max: number | undefined): number;
@@ -1 +0,0 @@
1
- export default function bound(position: number, min: number | undefined, max: number | undefined): number;
@@ -1,13 +0,0 @@
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
- };