@unicom-cloud/ui 0.8.96 → 0.8.98

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 (302) hide show
  1. package/Affix.js +1 -1
  2. package/Carousel.js +1 -1
  3. package/LiquidFill.js +4 -0
  4. package/OverflowEllipsis.js +1 -1
  5. package/PageHeader.js +1 -1
  6. package/QrCode.js +57 -0
  7. package/Tour.js +63 -0
  8. package/Trigger.js +1 -1
  9. package/_virtual/_commonjsHelpers.js +6 -0
  10. package/_virtual/index.js +7 -0
  11. package/_virtual/index2.js +4 -0
  12. package/affix/index.js +70 -72
  13. package/alert/index.js +56 -56
  14. package/anchor/Anchor.js +55 -55
  15. package/anchor/Link.js +34 -34
  16. package/anchor/util.js +5 -5
  17. package/auto-complete/index.js +116 -122
  18. package/avatar/Avatar.js +33 -33
  19. package/avatar/Group.js +26 -26
  20. package/back-top/index.js +58 -61
  21. package/badge/index.js +46 -46
  22. package/breadcrumb/Item.js +42 -43
  23. package/breadcrumb/index.js +47 -47
  24. package/button/Group.js +6 -6
  25. package/button/index.js +91 -91
  26. package/calendar/Month.js +75 -75
  27. package/calendar/Year.js +35 -35
  28. package/calendar/header/index.js +25 -25
  29. package/calendar/index.js +103 -103
  30. package/card/Grid.js +8 -8
  31. package/card/Meta.js +16 -16
  32. package/card/index.js +49 -49
  33. package/carousel/Arrow.js +19 -19
  34. package/carousel/Indicator.js +26 -26
  35. package/carousel/index.js +108 -108
  36. package/cascader/Cascader.js +178 -191
  37. package/cascader/base/node.js +133 -136
  38. package/cascader/base/store.js +82 -85
  39. package/cascader/panel/List.js +125 -129
  40. package/cascader/panel/Search.js +79 -81
  41. package/cascader/util.js +13 -13
  42. package/checkbox/Checkbox.js +94 -96
  43. package/checkbox/Group.js +54 -56
  44. package/checkbox/GroupBlock.js +28 -29
  45. package/collapse/Collapse.js +45 -45
  46. package/collapse/Item.js +53 -55
  47. package/color-picker/ControlBar.js +43 -43
  48. package/color-picker/InputAlpha.js +12 -12
  49. package/color-picker/InputHex.js +30 -31
  50. package/color-picker/InputRgb.js +24 -24
  51. package/color-picker/Palette.js +18 -18
  52. package/color-picker/Panel.js +122 -125
  53. package/color-picker/hooks/useColorPicker.js +85 -88
  54. package/color-picker/hooks/useControlBlock.js +38 -40
  55. package/color-picker/index.js +47 -47
  56. package/comment/index.js +29 -29
  57. package/components/common/higher-order/with-speech-synthesis/index.js +37 -40
  58. package/components/common/hooks/useId.js +8 -8
  59. package/components/common/hooks/useInView.js +16 -16
  60. package/components/common/hooks/useIntersectionObserver.js +1 -1
  61. package/components/common/hooks/useKeyboardEvent.js +9 -10
  62. package/components/common/hooks/useOverflowHidden.js +1 -4
  63. package/components/common/hooks/usePersistCallback.js +7 -7
  64. package/components/common/hooks/useStateCallback.js +9 -10
  65. package/components/common/hooks/useWindowSize.js +8 -8
  66. package/components/common/space/index.js +9 -7
  67. package/components/common/utils/convertToDurationBasedOnTimeUnits.js +6 -0
  68. package/components/common/utils/dom.js +27 -29
  69. package/components/common/utils/findScrollParent.js +17 -0
  70. package/components/common/utils/intersectionObserver.js +21 -0
  71. package/components/common/utils/is.js +99 -109
  72. package/components/common/utils/mutationObserver.js +19 -0
  73. package/components/common/utils/reactDOM.js +34 -34
  74. package/components/common/utils/resizeObserver.js +21 -0
  75. package/copy/index.js +38 -40
  76. package/date-picker/Picker.js +290 -295
  77. package/date-picker/RangePicker.js +367 -372
  78. package/date-picker/index.js +33 -35
  79. package/date-picker/panel/Body.js +46 -47
  80. package/date-picker/panel/Header.js +33 -33
  81. package/date-picker/panel/Shortcut.js +31 -31
  82. package/date-picker/panel/date/index.js +85 -85
  83. package/date-picker/panel/month/index.js +59 -59
  84. package/date-picker/panel/quarter/index.js +67 -70
  85. package/date-picker/panel/range/index.js +101 -101
  86. package/date-picker/panel/year/index.js +39 -39
  87. package/date-picker/util.js +17 -18
  88. package/descriptions/index.js +62 -62
  89. package/details/index.js +53 -55
  90. package/development/index.js +9 -9
  91. package/dist/tinycolor/chunk/BOzCVdr0.js +1 -1
  92. package/dist/validate/src/index.js +5 -5
  93. package/dist/validate/src/util.js +1 -1
  94. package/divider/index.js +21 -21
  95. package/draggable/Item.js +35 -35
  96. package/draggable/index.js +22 -22
  97. package/drawer/Drawer.js +142 -147
  98. package/dropdown/Button.js +48 -48
  99. package/dropdown/index.js +88 -92
  100. package/empty/index.js +16 -16
  101. package/form/Control.js +211 -225
  102. package/form/Form.js +109 -113
  103. package/form/FormItem.js +118 -120
  104. package/form/FormList.js +60 -66
  105. package/form/FormProvider.js +31 -34
  106. package/form/hook/useContext.js +17 -19
  107. package/form/hook/useState.js +22 -23
  108. package/form/hook/useWatch.js +26 -27
  109. package/form/promisify.js +14 -18
  110. package/form/store.js +304 -316
  111. package/form/util.js +14 -15
  112. package/grid/Col.js +64 -64
  113. package/grid/Grid.js +51 -51
  114. package/grid/GridItem.js +48 -48
  115. package/grid/Row.js +39 -39
  116. package/hooks/useVerificationCode.js +41 -43
  117. package/hooks/useWatermark.js +89 -92
  118. package/icon/index.js +23 -24
  119. package/icon-hover/index.js +16 -16
  120. package/icons/file.js +11 -11
  121. package/image/Image.js +140 -141
  122. package/image/ImagePreview.js +252 -255
  123. package/image/ImagePreviewArrow.js +25 -25
  124. package/image/ImagePreviewGroup.js +62 -62
  125. package/image/util/getScale.js +25 -28
  126. package/index.js +684 -675
  127. package/input/Button.js +48 -50
  128. package/input/Group.js +9 -9
  129. package/input/Input.js +145 -154
  130. package/input/InputElement.js +108 -115
  131. package/input/Password.js +38 -38
  132. package/input/Search.js +51 -55
  133. package/input/Textarea.js +80 -81
  134. package/input/useComposition.js +23 -23
  135. package/input-number/decimal.js +59 -62
  136. package/input-number/index.js +139 -141
  137. package/input-tag/InputTag.js +222 -230
  138. package/layout/Content.js +6 -6
  139. package/layout/Footer.js +8 -8
  140. package/layout/Header.js +7 -7
  141. package/layout/Sider.js +88 -90
  142. package/layout/index.js +30 -30
  143. package/link/index.js +45 -46
  144. package/liquid-fill/LiquidFill.js +226 -0
  145. package/liquid-fill/LiquidFill2.js +3 -0
  146. package/liquid-fill/index.js +4 -0
  147. package/list/Item.js +28 -28
  148. package/list/Meta.js +12 -12
  149. package/list/index.js +146 -148
  150. package/mentions/index.js +75 -76
  151. package/menu/Item.js +58 -58
  152. package/menu/Menu.js +125 -127
  153. package/menu/OverflowWrap.js +39 -40
  154. package/menu/sub-menu/Inline.js +45 -45
  155. package/menu/util.js +26 -28
  156. package/message/index.js +96 -99
  157. package/message/useMessage.js +26 -27
  158. package/modal/Confirm.js +47 -49
  159. package/modal/Modal.js +250 -257
  160. package/modal/use-modal/Hook.js +26 -28
  161. package/modal/use-modal/index.js +46 -49
  162. package/notice/index.js +89 -90
  163. package/notification/index.js +60 -65
  164. package/notification/withNotification.js +35 -35
  165. package/overflow-ellipsis/OverflowItem.js +19 -20
  166. package/overflow-ellipsis/index.js +45 -46
  167. package/package.json +1 -1
  168. package/page-header/index.js +45 -45
  169. package/pagination/PageItem.js +87 -91
  170. package/pagination/PageJumper.js +40 -41
  171. package/pagination/PageOption.js +31 -35
  172. package/pagination/Pagination.js +162 -163
  173. package/picker/Input.js +90 -96
  174. package/picker/InputRange.js +115 -122
  175. package/popconfirm/index.js +98 -100
  176. package/popover/index.js +28 -28
  177. package/portal/Portal.js +10 -11
  178. package/progress/index.js +36 -36
  179. package/qr-code/index.js +99 -0
  180. package/qr-code/interface.js +1 -0
  181. package/radio/Group.js +48 -48
  182. package/radio/GroupBlock.js +32 -33
  183. package/radio/Radio.js +62 -64
  184. package/rate/index.js +88 -88
  185. package/resize-box/ResizeTrigger.js +39 -39
  186. package/resize-box/Split.js +92 -96
  187. package/resize-box/SplitGroup.js +116 -122
  188. package/resize-box/index.js +112 -115
  189. package/result/index.js +44 -44
  190. package/select/Option.js +53 -56
  191. package/select/Select.js +365 -381
  192. package/select/util.js +95 -99
  193. package/select-view/Core.js +159 -160
  194. package/skeleton/index.js +23 -23
  195. package/slider/Button.js +84 -92
  196. package/slider/Input.js +47 -49
  197. package/slider/Tick.js +28 -31
  198. package/slider/index.js +107 -107
  199. package/space/index.js +26 -26
  200. package/space-/index.js +51 -51
  201. package/spin/DotLoading.js +8 -8
  202. package/spin/index.js +47 -47
  203. package/statistic/Countdown.js +37 -37
  204. package/statistic/index.js +58 -58
  205. package/steps/Step.js +42 -42
  206. package/steps/index.js +54 -54
  207. package/style.css +1 -1
  208. package/switch/index.js +77 -78
  209. package/table/ColGroup.js +36 -37
  210. package/table/Table.js +447 -450
  211. package/table/hook/useExpand.js +24 -24
  212. package/table/hook/useRowSelection.js +62 -62
  213. package/table/summary/Row.js +16 -17
  214. package/table/tbody/Td.js +119 -118
  215. package/table/tbody/Tr.js +119 -121
  216. package/table/tbody/index.js +62 -63
  217. package/table/th-resizable/index.js +30 -30
  218. package/table/thead/Column.js +148 -148
  219. package/table/thead/index.js +87 -88
  220. package/tabs/Tab.js +55 -55
  221. package/tabs/TabContent.js +8 -8
  222. package/tabs/TabPane.js +15 -15
  223. package/tabs/hook/useHeaderScroll.js +36 -36
  224. package/tabs/tab-header/TabInk.js +31 -33
  225. package/tabs/tab-header/TabNavIcon.js +34 -35
  226. package/tabs/tab-header/index.js +192 -195
  227. package/tag/index.js +94 -97
  228. package/time-picker/Picker.js +167 -172
  229. package/time-picker/RangePicker.js +28 -28
  230. package/time-picker/TimePicker.js +146 -146
  231. package/timeline/Item.js +46 -46
  232. package/timeline/Timeline.js +52 -52
  233. package/tooltip/index.js +89 -95
  234. package/tour/index.js +289 -0
  235. package/transfer/Item.js +54 -54
  236. package/transfer/List.js +134 -136
  237. package/transfer/index.js +91 -91
  238. package/tree/Animation.js +49 -52
  239. package/tree/Node.js +114 -122
  240. package/tree/NodeList.js +51 -51
  241. package/tree/Tree.js +386 -393
  242. package/tree-select/List.js +71 -72
  243. package/tree-select/Select.js +135 -143
  244. package/tree-select/hook/useKeyCache.js +39 -39
  245. package/tree-select/hook/useStateValue.js +12 -12
  246. package/trigger/getPopupStyle.js +60 -61
  247. package/trigger/index.js +337 -346
  248. package/types/common/space/interface.d.ts +1 -1
  249. package/types/common/utils/convertToDurationBasedOnTimeUnits.d.ts +3 -0
  250. package/types/common/utils/findScrollParent.d.ts +2 -0
  251. package/types/common/utils/index.d.ts +5 -0
  252. package/types/common/utils/intersectionObserver.d.ts +2 -0
  253. package/types/common/utils/mutationObserver.d.ts +2 -0
  254. package/types/common/utils/resizeObserver.d.ts +2 -0
  255. package/types/pc/config-provider/interface.d.ts +6 -0
  256. package/types/pc/index.d.ts +3 -0
  257. package/types/pc/liquid-fill/LiquidFill.d.ts +115 -0
  258. package/types/pc/liquid-fill/LiquidFill2.d.ts +1 -0
  259. package/types/pc/liquid-fill/index.d.ts +2 -0
  260. package/types/pc/qr-code/index.d.ts +34 -0
  261. package/types/pc/qr-code/interface.d.ts +39 -0
  262. package/types/pc/table/interface.d.ts +2 -2
  263. package/types/pc/tour/index.d.ts +42 -0
  264. package/types/pc/utils/convertToDurationBasedOnTimeUnits.d.ts +3 -0
  265. package/types/pc/utils/findScrollParent.d.ts +2 -0
  266. package/types/pc/utils/index.d.ts +5 -0
  267. package/types/pc/utils/intersectionObserver.d.ts +2 -0
  268. package/types/pc/utils/mutationObserver.d.ts +2 -0
  269. package/types/pc/utils/names.d.ts +18 -0
  270. package/types/pc/utils/resizeObserver.d.ts +2 -0
  271. package/typography/Base.js +79 -81
  272. package/typography/EditContent.js +30 -33
  273. package/typography/Ellipsis.js +77 -73
  274. package/typography/Operations.js +50 -52
  275. package/typography/Paragraph.js +7 -7
  276. package/typography/Typography.js +7 -7
  277. package/typography/useEllipsis.js +105 -106
  278. package/upload/TriggerNode.js +69 -76
  279. package/upload/Upload.js +84 -87
  280. package/upload/Uploader.js +115 -118
  281. package/upload/list/PictureItem.js +61 -71
  282. package/upload/list/TextItem.js +61 -67
  283. package/upload/list/UploadProgress.js +42 -49
  284. package/upload/list/index.js +48 -49
  285. package/upload/request_.js +37 -38
  286. package/upload/util.js +39 -39
  287. package/utils/convertToDurationBasedOnTimeUnits.js +6 -0
  288. package/utils/findScrollParent.js +4 -0
  289. package/utils/index.js +281 -278
  290. package/utils/intersectionObserver.js +4 -0
  291. package/utils/mutationObserver.js +4 -0
  292. package/utils/names.js +12 -0
  293. package/utils/resizeObserver.js +4 -0
  294. package/verification-code/VerificationCode.js +50 -51
  295. package/version/index.js +1 -1
  296. package/virtual-list/VirtualList.js +243 -244
  297. package/virtual-list/util/item.js +3 -4
  298. package/watermark/Watermark.js +27 -31
  299. package/components/common/utils/resizeObserverEffect.js +0 -23
  300. package/types/common/utils/resizeObserverEffect.d.ts +0 -2
  301. package/types/pc/utils/resizeObserverEffect.d.ts +0 -2
  302. package/utils/resizeObserverEffect.js +0 -4
@@ -1,64 +1,64 @@
1
- import { jsx as b, jsxs as _t, Fragment as wt } from "react/jsx-runtime";
1
+ import { jsx as E, jsxs as _t, Fragment as wt } from "react/jsx-runtime";
2
2
  import Ft from "lodash/isFunction";
3
3
  import dt from "lodash/isNumber";
4
- import tt, { useRef as y, useState as Ct, useMemo as Nt, useEffect as P, useImperativeHandle as Ut } from "react";
4
+ import J, { useRef as H, useState as Ct, useMemo as Nt, useEffect as b, useImperativeHandle as Ut } from "react";
5
5
  import kt from "../components/common/hooks/useForceUpdate.js";
6
6
  import Vt from "../components/common/hooks/useIsFirstRender.js";
7
7
  import jt from "../components/common/hooks/useIsomorphicLayoutEffect.js";
8
8
  import Dt from "../components/common/hooks/usePrevious.js";
9
9
  import Kt from "../components/common/hooks/useStateWithPromise.js";
10
- import { resizeObserverEffect as Bt } from "../components/common/utils/resizeObserverEffect.js";
11
- import pt from "./Filler.js";
10
+ import { resizeObserver as Bt } from "../components/common/utils/resizeObserver.js";
11
+ import ft from "./Filler.js";
12
12
  import { findListDiffIndex as qt, getIndexByStartLoc as Gt } from "./util/algorithm.js";
13
- import { getItemRelativeTop as et, getScrollPercentage as L, getItemAbsoluteTop as Wt, getRangeIndex as gt, getValidScrollTop as ht, GHOST_ITEM_KEY as Yt, getCompareItemRelativeTop as zt, getLocationItem as Xt, getLongestItemIndex as $t, getNodeHeight as It } from "./util/item.js";
14
- const Jt = 32, _ = `__virtual_item_height_${Math.random().toFixed(5).slice(2)}`, Qt = (I) => {
15
- const x = kt(), { current: d } = I;
16
- P(() => {
17
- Object.keys(d).length && !d[_] && (d[_] = Object.entries(d).reduce(
18
- (w, [, H], a, S) => {
19
- const F = w + H;
20
- return a === S.length - 1 ? Math.round(F / S.length) : F;
13
+ import { getItemRelativeTop as Q, getScrollPercentage as A, getItemAbsoluteTop as Wt, getRangeIndex as pt, getValidScrollTop as gt, GHOST_ITEM_KEY as Yt, getCompareItemRelativeTop as zt, getLocationItem as Xt, getLongestItemIndex as $t, getNodeHeight as ht } from "./util/item.js";
14
+ const Jt = 32, L = `__virtual_item_height_${Math.random().toFixed(5).slice(2)}`, Qt = (h) => {
15
+ const T = kt(), { current: f } = h;
16
+ b(() => {
17
+ Object.keys(f).length && !f[L] && (f[L] = Object.entries(f).reduce(
18
+ (_, [, x], m, S) => {
19
+ const w = _ + x;
20
+ return m === S.length - 1 ? Math.round(w / S.length) : w;
21
21
  },
22
22
  0
23
- ), x());
24
- }, [Object.keys(d).length]);
25
- }, Zt = (I) => {
26
- const x = y({}), d = y(I);
27
- return P(() => {
28
- d.current = I;
29
- }, [I]), I !== d.current && (x.current = {}), (w, H, a) => (Object.prototype.hasOwnProperty.call(x.current, H) || (x.current[H] = I(w, H, a)), x.current[H]);
30
- }, te = tt.forwardRef((I, x) => {
23
+ ), T());
24
+ }, [Object.keys(f).length]);
25
+ }, Zt = (h) => {
26
+ const T = H({}), f = H(h);
27
+ return b(() => {
28
+ f.current = h;
29
+ }, [h]), h !== f.current && (T.current = {}), (_, x, m) => (Object.prototype.hasOwnProperty.call(T.current, x) || (T.current[x] = h(_, x, m)), T.current[x]);
30
+ }, te = J.forwardRef((h, T) => {
31
31
  const {
32
- style: d,
33
- className: w,
34
- children: H,
35
- data: a = [],
32
+ style: f,
33
+ className: _,
34
+ children: x,
35
+ data: m = [],
36
36
  itemKey: S,
37
- threshold: F = 100,
38
- wrapper: Tt = "div",
39
- height: xt = "100%",
40
- isStaticItemHeight: q = !0,
41
- itemHeight: Ht,
42
- measureLongestItem: yt,
43
- scrollOptions: G,
44
- onScroll: R,
45
- needFiller: St = !0,
46
- outerStyle: rt,
47
- innerStyle: nt,
48
- wrapperChild: W = tt.Fragment,
37
+ threshold: w = 100,
38
+ wrapper: It = "div",
39
+ height: Tt = "100%",
40
+ isStaticItemHeight: K = !0,
41
+ itemHeight: xt,
42
+ measureLongestItem: Ht,
43
+ scrollOptions: St,
44
+ onScroll: Z,
45
+ needFiller: yt = !0,
46
+ outerStyle: tt,
47
+ innerStyle: et,
48
+ wrapperChild: B = J.Fragment,
49
49
  ...Et
50
- } = I, V = d && d.maxHeight || xt, C = y({}), [bt, Pt] = Ct(200), ot = Zt(H);
51
- Qt(C);
52
- const M = a.length, v = Ht || C.current[_] || Jt, j = dt(V) ? V : bt, A = Math.ceil(j / v), Y = v * M, T = F !== null && M >= F && Y > j, i = y(null), E = y(null), N = y(!1), it = y(T), st = Nt(() => {
53
- if (i.current) {
54
- const t = (e) => +window.getComputedStyle(i.current)[e].replace(/\D/g, "");
50
+ } = h, k = f && f.maxHeight || Tt, F = H({}), [bt, Pt] = Ct(200), rt = Zt(x);
51
+ Qt(F);
52
+ const P = m.length, R = xt || F.current[L] || Jt, V = dt(k) ? k : bt, M = Math.ceil(V / R), q = R * P, I = w !== null && P >= w && q > V, o = H(null), y = H(null), C = H(!1), nt = H(I), ot = Nt(() => {
53
+ if (o.current) {
54
+ const t = (e) => +window.getComputedStyle(o.current)[e].replace(/\D/g, "");
55
55
  return {
56
56
  top: t("paddingTop"),
57
57
  bottom: t("paddingBottom")
58
58
  };
59
59
  }
60
60
  return { top: 0, bottom: 0 };
61
- }, [i.current]), [s, U] = Kt({
61
+ }, [o.current]), [i, N] = Kt({
62
62
  // measure status
63
63
  status: "NONE",
64
64
  // render range info
@@ -69,309 +69,308 @@ const Jt = 32, _ = `__virtual_item_height_${Math.random().toFixed(5).slice(2)}`,
69
69
  // scroll info
70
70
  startItemTop: 0,
71
71
  scrollTop: 0
72
- }), D = Dt(a) || [], Rt = Vt(), k = (t, e) => typeof S == "function" ? S(t, e) : typeof S == "string" ? t[S] : t.key || e, g = (t, e = a) => {
72
+ }), j = Dt(m) || [], Rt = Vt(), U = (t, e) => typeof S == "function" ? S(t, e) : typeof S == "string" ? t[S] : t.key || e, p = (t, e = m) => {
73
73
  if (t === e.length)
74
74
  return Yt;
75
- const c = e[t];
76
- return c !== void 0 ? k(c, t) : null;
77
- }, h = (t) => C.current[t] || v, ct = (t) => {
78
- const { itemIndex: e, relativeTop: c } = t, { scrollHeight: n, clientHeight: l } = i.current, r = s.scrollTop, m = n - l;
79
- let o = Number.MAX_VALUE, u = null, p = null, f = null, B = null, O = null, X = 0;
80
- for (let $ = 0; $ < m; $++) {
81
- const ut = Gt(0, m, r, $), at = L({
82
- scrollTop: ut,
83
- scrollHeight: n,
75
+ const s = e[t];
76
+ return s !== void 0 ? U(s, t) : null;
77
+ }, g = (t) => F.current[t] || R, it = (t) => {
78
+ const { itemIndex: e, relativeTop: s } = t, { scrollHeight: r, clientHeight: l } = o.current, c = i.scrollTop, n = r - l;
79
+ let u = Number.MAX_VALUE, a = null, d = null, v = null, O = null, lt = null, W = 0;
80
+ for (let Y = 0; Y < n; Y++) {
81
+ const ct = Gt(0, n, c, Y), ut = A({
82
+ scrollTop: ct,
83
+ scrollHeight: r,
84
84
  clientHeight: l
85
- }), { itemIndex: J, itemOffsetPtg: mt, startIndex: Q, endIndex: Z } = gt(
86
- at,
87
- M,
88
- A
85
+ }), { itemIndex: z, itemOffsetPtg: at, startIndex: X, endIndex: $ } = pt(
86
+ ut,
87
+ P,
88
+ M
89
89
  );
90
- if (Q <= e && e <= Z) {
91
- const Ot = et({
92
- itemHeight: h(g(J)),
93
- itemOffsetPtg: mt,
90
+ if (X <= e && e <= $) {
91
+ const At = Q({
92
+ itemHeight: g(p(z)),
93
+ itemOffsetPtg: at,
94
94
  clientHeight: l,
95
- scrollPtg: at
95
+ scrollPtg: ut
96
96
  }), Lt = zt({
97
- locatedItemRelativeTop: Ot,
98
- locatedItemIndex: J,
97
+ locatedItemRelativeTop: At,
98
+ locatedItemIndex: z,
99
99
  compareItemIndex: e,
100
- startIndex: Q,
101
- endIndex: Z,
102
- itemHeight: v,
103
- getItemKey: g,
104
- itemElementHeights: C.current
105
- }), ft = Math.abs(Lt - c);
106
- ft < o ? (o = ft, u = ut, p = J, f = mt, B = Q, O = Z, X = 0) : X += 1;
100
+ startIndex: X,
101
+ endIndex: $,
102
+ itemHeight: R,
103
+ getItemKey: p,
104
+ itemElementHeights: F.current
105
+ }), mt = Math.abs(Lt - s);
106
+ mt < u ? (u = mt, a = ct, d = z, v = at, O = X, lt = $, W = 0) : W += 1;
107
107
  }
108
- if (X > 10)
108
+ if (W > 10)
109
109
  break;
110
110
  }
111
- u !== null && (N.current = !0, i.current.scrollTop = u, U({
112
- ...s,
111
+ a !== null && (C.current = !0, o.current.scrollTop = a, N({
112
+ ...i,
113
113
  status: "MEASURE_START",
114
- scrollTop: u,
115
- itemIndex: p,
116
- itemOffsetPtg: f,
117
- startIndex: B,
118
- endIndex: O
119
- })), E.current = requestAnimationFrame(() => {
120
- N.current = !1;
114
+ scrollTop: a,
115
+ itemIndex: d,
116
+ itemOffsetPtg: v,
117
+ startIndex: O,
118
+ endIndex: lt
119
+ })), y.current = requestAnimationFrame(() => {
120
+ C.current = !1;
121
121
  });
122
122
  }, Mt = (t) => {
123
123
  const {
124
124
  scrollTop: e,
125
- clientHeight: c,
126
- scrollHeight: n
127
- } = i.current, l = ht(
125
+ clientHeight: s,
126
+ scrollHeight: r
127
+ } = o.current, l = gt(
128
128
  e,
129
- n - c
130
- ), r = L({
129
+ r - s
130
+ ), c = A({
131
131
  scrollTop: l,
132
- clientHeight: c,
133
- scrollHeight: n
134
- }), { index: m, offsetPtg: o } = Xt(r, M);
135
- U({
136
- ...s,
132
+ clientHeight: s,
133
+ scrollHeight: r
134
+ }), { index: n, offsetPtg: u } = Xt(c, P);
135
+ N({
136
+ ...i,
137
137
  scrollTop: l,
138
- itemIndex: m,
139
- itemOffsetPtg: o
140
- }), t && (R == null || R(t, { index: m }));
141
- }, lt = (t, e = !1) => {
142
- const c = Y, { scrollTop: n, clientHeight: l } = i.current, r = ht(
143
- n,
144
- c - l
138
+ itemIndex: n,
139
+ itemOffsetPtg: u
140
+ }), t && Z?.(t, { index: n });
141
+ }, st = (t, e = !1) => {
142
+ const s = q, { scrollTop: r, clientHeight: l } = o.current, c = gt(
143
+ r,
144
+ s - l
145
145
  );
146
- if (!e && (r === s.scrollTop || N.current))
146
+ if (!e && (c === i.scrollTop || C.current))
147
147
  return;
148
- const m = L({
149
- scrollTop: r,
148
+ const n = A({
149
+ scrollTop: c,
150
150
  clientHeight: l,
151
- scrollHeight: c
152
- }), { itemIndex: o, itemOffsetPtg: u, startIndex: p, endIndex: f } = gt(
153
- m,
154
- M,
155
- A
151
+ scrollHeight: s
152
+ }), { itemIndex: u, itemOffsetPtg: a, startIndex: d, endIndex: v } = pt(
153
+ n,
154
+ P,
155
+ M
156
156
  );
157
- U({
158
- ...s,
159
- scrollTop: r,
160
- itemIndex: o,
161
- itemOffsetPtg: u,
162
- startIndex: p,
163
- endIndex: f,
157
+ N({
158
+ ...i,
159
+ scrollTop: c,
160
+ itemIndex: u,
161
+ itemOffsetPtg: a,
162
+ startIndex: d,
163
+ endIndex: v,
164
164
  status: "MEASURE_START"
165
- }), t && (R == null || R(t, { index: o }));
165
+ }), t && Z?.(t, { index: u });
166
166
  };
167
- P(() => () => {
168
- E.current && cancelAnimationFrame(E.current);
169
- }, []), P(() => {
170
- i.current && (Rt && (i.current.scrollTop = 0), lt(null, !0));
171
- }, [A]), P(() => {
172
- if (!i.current)
167
+ b(() => () => {
168
+ y.current && cancelAnimationFrame(y.current);
169
+ }, []), b(() => {
170
+ o.current && (Rt && (o.current.scrollTop = 0), st(null, !0));
171
+ }, [M]), b(() => {
172
+ if (!o.current)
173
173
  return;
174
174
  let t = null;
175
- const e = it.current !== T ? T ? "virtual" : "raw" : "";
176
- if (it.current = T, j && D.length !== a.length) {
177
- const c = qt(D, a, k);
178
- t = c ? c.index : null;
175
+ const e = nt.current !== I ? I ? "virtual" : "raw" : "";
176
+ if (nt.current = I, V && j.length !== m.length) {
177
+ const s = qt(j, m, U);
178
+ t = s ? s.index : null;
179
179
  }
180
- if (e || T && t) {
181
- const { clientHeight: c } = i.current, n = et({
182
- itemHeight: h(
183
- g(s.itemIndex, D)
180
+ if (e || I && t) {
181
+ const { clientHeight: s } = o.current, r = Q({
182
+ itemHeight: g(
183
+ p(i.itemIndex, j)
184
184
  ),
185
- itemOffsetPtg: s.itemOffsetPtg,
186
- scrollPtg: L({
187
- scrollTop: s.scrollTop,
188
- scrollHeight: D.length * v,
189
- clientHeight: c
185
+ itemOffsetPtg: i.itemOffsetPtg,
186
+ scrollPtg: A({
187
+ scrollTop: i.scrollTop,
188
+ scrollHeight: j.length * R,
189
+ clientHeight: s
190
190
  }),
191
- clientHeight: c
191
+ clientHeight: s
192
192
  });
193
193
  if (e === "raw") {
194
- let l = n;
195
- for (let r = 0; r < s.itemIndex; r++)
196
- l -= h(g(r));
197
- i.current.scrollTop = -l, N.current = !0, E.current = requestAnimationFrame(() => {
198
- N.current = !1;
194
+ let l = r;
195
+ for (let c = 0; c < i.itemIndex; c++)
196
+ l -= g(p(c));
197
+ o.current.scrollTop = -l, C.current = !0, y.current = requestAnimationFrame(() => {
198
+ C.current = !1;
199
199
  });
200
200
  } else
201
- ct({
202
- itemIndex: s.itemIndex,
203
- relativeTop: n
201
+ it({
202
+ itemIndex: i.itemIndex,
203
+ relativeTop: r
204
204
  });
205
205
  }
206
- }, [a, T]), jt(() => {
207
- if (s.status === "MEASURE_START" && i.current) {
208
- const { scrollTop: t, scrollHeight: e, clientHeight: c } = i.current, n = L({
206
+ }, [m, I]), jt(() => {
207
+ if (i.status === "MEASURE_START" && o.current) {
208
+ const { scrollTop: t, scrollHeight: e, clientHeight: s } = o.current, r = A({
209
209
  scrollTop: t,
210
210
  scrollHeight: e,
211
- clientHeight: c
211
+ clientHeight: s
212
212
  });
213
213
  let l = Wt({
214
- scrollPtg: n,
215
- clientHeight: c,
216
- scrollTop: t - (st.top + st.bottom) * n,
217
- itemHeight: h(g(s.itemIndex)),
218
- itemOffsetPtg: s.itemOffsetPtg
214
+ scrollPtg: r,
215
+ clientHeight: s,
216
+ scrollTop: t - (ot.top + ot.bottom) * r,
217
+ itemHeight: g(p(i.itemIndex)),
218
+ itemOffsetPtg: i.itemOffsetPtg
219
219
  });
220
- for (let r = s.itemIndex - 1; r >= s.startIndex; r--)
221
- l -= h(g(r));
222
- U({
223
- ...s,
220
+ for (let c = i.itemIndex - 1; c >= i.startIndex; c--)
221
+ l -= g(p(c));
222
+ N({
223
+ ...i,
224
224
  startItemTop: l,
225
225
  status: "MEASURE_DONE"
226
226
  });
227
227
  }
228
- }, [s]), Ut(
229
- x,
228
+ }, [i]), Ut(
229
+ T,
230
230
  () => ({
231
- dom: i.current,
232
- getRootDOMNode: () => i.current,
231
+ dom: o.current,
232
+ getRootDOMNode: () => o.current,
233
233
  // Scroll to a certain height or an element
234
234
  scrollTo: (t) => {
235
- E.current && cancelAnimationFrame(E.current), E.current = requestAnimationFrame(() => {
236
- var m;
237
- if (!i.current)
235
+ y.current && cancelAnimationFrame(y.current), y.current = requestAnimationFrame(() => {
236
+ if (!o.current)
238
237
  return;
239
238
  if (typeof t == "number") {
240
- i.current.scrollTop = t;
239
+ o.current.scrollTop = t;
241
240
  return;
242
241
  }
243
- const e = "index" in t ? t.index : "key" in t ? a.findIndex(
244
- (o, u) => k(o, u) === t.key
245
- ) : 0, c = a[e];
246
- if (!c)
242
+ const e = "index" in t ? t.index : "key" in t ? m.findIndex(
243
+ (n, u) => U(n, u) === t.key
244
+ ) : 0, s = m[e];
245
+ if (!s)
247
246
  return;
248
- let n = typeof t == "object" && ((m = t.options) != null && m.block) ? t.options.block : (G == null ? void 0 : G.block) || "nearest";
249
- const { clientHeight: l, scrollTop: r } = i.current;
250
- if (T && !q) {
251
- if (n === "nearest") {
252
- const { itemIndex: o, itemOffsetPtg: u } = s;
253
- if (Math.abs(o - e) < A) {
254
- let p = et({
255
- itemHeight: h(g(o)),
247
+ let r = typeof t == "object" && t.options?.block ? t.options.block : St?.block || "nearest";
248
+ const { clientHeight: l, scrollTop: c } = o.current;
249
+ if (I && !K) {
250
+ if (r === "nearest") {
251
+ const { itemIndex: n, itemOffsetPtg: u } = i;
252
+ if (Math.abs(n - e) < M) {
253
+ let a = Q({
254
+ itemHeight: g(p(n)),
256
255
  itemOffsetPtg: u,
257
256
  clientHeight: l,
258
- scrollPtg: L(i.current)
257
+ scrollPtg: A(o.current)
259
258
  });
260
- if (e < o)
261
- for (let f = e; f < o; f++)
262
- p -= h(g(f));
259
+ if (e < n)
260
+ for (let d = e; d < n; d++)
261
+ a -= g(p(d));
263
262
  else
264
- for (let f = o; f < e; f++)
265
- p += h(g(f));
266
- if (p < 0 || p > l)
267
- n = p < 0 ? "start" : "end";
263
+ for (let d = n; d < e; d++)
264
+ a += g(p(d));
265
+ if (a < 0 || a > l)
266
+ r = a < 0 ? "start" : "end";
268
267
  else
269
268
  return;
270
269
  } else
271
- n = e < o ? "start" : "end";
270
+ r = e < n ? "start" : "end";
272
271
  }
273
- U({
274
- ...s,
275
- startIndex: Math.max(0, e - A),
276
- endIndex: Math.min(M - 1, e + A)
272
+ N({
273
+ ...i,
274
+ startIndex: Math.max(0, e - M),
275
+ endIndex: Math.min(P - 1, e + M)
277
276
  }).then(() => {
278
- const o = h(k(c, e));
279
- ct({
277
+ const n = g(U(s, e));
278
+ it({
280
279
  itemIndex: e,
281
- relativeTop: n === "start" ? 0 : (l - o) / (n === "center" ? 2 : 1)
280
+ relativeTop: r === "start" ? 0 : (l - n) / (r === "center" ? 2 : 1)
282
281
  });
283
282
  });
284
283
  } else {
285
- const o = h(
286
- g(e)
284
+ const n = g(
285
+ p(e)
287
286
  );
288
287
  let u = 0;
289
288
  for (let O = 0; O < e; O++)
290
- u += h(g(O));
291
- const p = u + o, f = u + o / 2;
292
- if (f > r && f < l + r)
289
+ u += g(p(O));
290
+ const a = u + n, d = u + n / 2;
291
+ if (d > c && d < l + c)
293
292
  return;
294
- n === "nearest" && (u < r ? n = "start" : p > r + l && (n = "end"));
295
- const B = l - o;
296
- i.current.scrollTop = u - (n === "start" ? 0 : B / (n === "center" ? 2 : 1));
293
+ r === "nearest" && (u < c ? r = "start" : a > c + l && (r = "end"));
294
+ const v = l - n;
295
+ o.current.scrollTop = u - (r === "start" ? 0 : v / (r === "center" ? 2 : 1));
297
296
  }
298
297
  });
299
298
  }
300
299
  }),
301
- [a, v, s]
300
+ [m, R, i]
302
301
  );
303
- const z = (t, e) => t.map((c, n) => {
304
- const l = e + n, r = ot(c, l, {
302
+ const G = (t, e) => t.map((s, r) => {
303
+ const l = e + r, c = rt(s, l, {
305
304
  style: {},
306
- itemIndex: n
307
- }), m = k(c, l);
308
- return tt.cloneElement(r, {
309
- key: m,
310
- ref: (o) => {
311
- const { current: u } = C;
312
- o && s.status === "MEASURE_START" && (!q || u[m] === void 0) && (q ? (u[_] || (u[_] = It(o, !0)), u[m] = u[_]) : u[m] = It(o, !0)), Ft(r == null ? void 0 : r.ref) && (r == null || r.ref(o));
305
+ itemIndex: r
306
+ }), n = U(s, l);
307
+ return J.cloneElement(c, {
308
+ key: n,
309
+ ref: (u) => {
310
+ const { current: a } = F;
311
+ u && i.status === "MEASURE_START" && (!K || a[n] === void 0) && (K ? (a[L] || (a[L] = ht(u, !0)), a[n] = a[L]) : a[n] = ht(u, !0)), Ft(c?.ref) && c?.ref(u);
313
312
  }
314
313
  });
315
- }), K = y(null);
316
- P(() => {
317
- K.current = null;
318
- }, [a]);
314
+ }), D = H(null);
315
+ b(() => {
316
+ D.current = null;
317
+ }, [m]);
319
318
  const vt = () => {
320
- if (yt) {
321
- const t = K.current === null ? $t(a) : K.current, e = a[t];
322
- return K.current = t, e ? /* @__PURE__ */ b("div", { style: { height: 1, overflow: "hidden", opacity: 0 }, children: ot(e, t, { style: {} }) }) : null;
319
+ if (Ht) {
320
+ const t = D.current === null ? $t(m) : D.current, e = m[t];
321
+ return D.current = t, e ? /* @__PURE__ */ E("div", { style: { height: 1, overflow: "hidden", opacity: 0 }, children: rt(e, t, { style: {} }) }) : null;
323
322
  }
324
323
  return null;
325
324
  };
326
- function At() {
327
- if (i.current && !dt(V)) {
328
- const { clientHeight: t } = i.current;
325
+ function Ot() {
326
+ if (o.current && !dt(k)) {
327
+ const { clientHeight: t } = o.current;
329
328
  Pt(t);
330
329
  }
331
330
  }
332
- return P(() => {
333
- const t = Bt([i.current], At);
331
+ return b(() => {
332
+ const t = Bt([o.current], Ot);
334
333
  return () => {
335
334
  t();
336
335
  };
337
- }, [i.current]), /* @__PURE__ */ b(
338
- Tt,
336
+ }, [o.current]), /* @__PURE__ */ E(
337
+ It,
339
338
  {
340
- ref: i,
339
+ ref: o,
341
340
  style: {
342
341
  overflowY: "auto",
343
342
  scrollSnapType: "y mandatory",
344
343
  overflowAnchor: "none",
345
- ...d,
346
- maxHeight: V
344
+ ...f,
345
+ maxHeight: k
347
346
  },
348
- className: w,
349
- onScroll: T ? lt : Mt,
347
+ className: _,
348
+ onScroll: I ? st : Mt,
350
349
  ...Et,
351
- children: T ? /* @__PURE__ */ _t(wt, { children: [
352
- /* @__PURE__ */ b(
353
- pt,
350
+ children: I ? /* @__PURE__ */ _t(wt, { children: [
351
+ /* @__PURE__ */ E(
352
+ ft,
354
353
  {
355
- height: Y,
356
- outerStyle: rt,
357
- innerStyle: nt,
358
- offset: s.status === "MEASURE_DONE" ? s.startItemTop : 0,
359
- children: /* @__PURE__ */ b(W, { children: z(
360
- a.slice(s.startIndex, s.endIndex + 1),
361
- s.startIndex
354
+ height: q,
355
+ outerStyle: tt,
356
+ innerStyle: et,
357
+ offset: i.status === "MEASURE_DONE" ? i.startItemTop : 0,
358
+ children: /* @__PURE__ */ E(B, { children: G(
359
+ m.slice(i.startIndex, i.endIndex + 1),
360
+ i.startIndex
362
361
  ) })
363
362
  }
364
363
  ),
365
364
  vt()
366
- ] }) : St ? /* @__PURE__ */ b(
367
- pt,
365
+ ] }) : yt ? /* @__PURE__ */ E(
366
+ ft,
368
367
  {
369
- height: j,
370
- outerStyle: rt,
371
- innerStyle: nt,
372
- children: /* @__PURE__ */ b(W, { children: z(a, 0) })
368
+ height: V,
369
+ outerStyle: tt,
370
+ innerStyle: et,
371
+ children: /* @__PURE__ */ E(B, { children: G(m, 0) })
373
372
  }
374
- ) : /* @__PURE__ */ b(W, { children: z(a, 0) })
373
+ ) : /* @__PURE__ */ E(B, { children: G(m, 0) })
375
374
  }
376
375
  );
377
376
  });
@@ -78,10 +78,9 @@ function y({
78
78
  function S(n) {
79
79
  let e = -1, o = 0;
80
80
  return n.forEach((t, f) => {
81
- var r;
82
- if (t = typeof t == "string" ? t : (r = t.props) == null ? void 0 : r.children, typeof t == "string") {
83
- const c = m(t);
84
- c > o && (o = c, e = f);
81
+ if (t = typeof t == "string" ? t : t.props?.children, typeof t == "string") {
82
+ const r = m(t);
83
+ r > o && (o = r, e = f);
85
84
  }
86
85
  }), e;
87
86
  }