@laser-ui/components 1.6.1 → 2.0.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 (298) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/accordion/Accordion.d.ts +1 -1
  3. package/accordion/Accordion.js +13 -25
  4. package/accordion/types.d.ts +1 -0
  5. package/affix/Affix.d.ts +2 -2
  6. package/affix/Affix.js +27 -32
  7. package/affix/types.d.ts +7 -2
  8. package/alert/Alert.d.ts +1 -1
  9. package/alert/Alert.js +12 -21
  10. package/anchor/Anchor.d.ts +2 -4
  11. package/anchor/Anchor.js +34 -26
  12. package/anchor/types.d.ts +1 -0
  13. package/avatar/Avatar.d.ts +1 -1
  14. package/avatar/Avatar.js +9 -3
  15. package/badge/Badge.d.ts +1 -1
  16. package/badge/Badge.js +22 -41
  17. package/badge/BadgeText.js +12 -26
  18. package/badge/internal/BadgeNumber.d.ts +2 -2
  19. package/badge/internal/BadgeNumber.js +34 -24
  20. package/base-input/BaseInput.d.ts +1 -2
  21. package/base-input/BaseInput.js +4 -4
  22. package/base-input/types.d.ts +1 -0
  23. package/breadcrumb/Breadcrumb.d.ts +1 -1
  24. package/button/Button.d.ts +1 -2
  25. package/button/Button.js +18 -22
  26. package/button/types.d.ts +1 -0
  27. package/card/Card.d.ts +1 -1
  28. package/card/CardAction.d.ts +1 -1
  29. package/card/CardAction.js +3 -4
  30. package/card/CardActions.d.ts +1 -1
  31. package/card/CardActions.js +7 -3
  32. package/card/CardContent.d.ts +1 -1
  33. package/card/CardHeader.d.ts +1 -1
  34. package/card/types.d.ts +5 -1
  35. package/cascader/Cascader.d.ts +2 -4
  36. package/cascader/Cascader.js +217 -214
  37. package/cascader/internal/CascaderPanel.d.ts +2 -2
  38. package/cascader/internal/CascaderPanel.js +21 -7
  39. package/cascader/internal/CascaderSearchPanel.d.ts +2 -2
  40. package/cascader/internal/CascaderSearchPanel.js +15 -6
  41. package/cascader/types.d.ts +3 -3
  42. package/checkbox/Checkbox.d.ts +1 -1
  43. package/checkbox/Checkbox.js +4 -5
  44. package/checkbox/CheckboxGroup.d.ts +1 -1
  45. package/checkbox/CheckboxGroup.js +8 -7
  46. package/checkbox/types.d.ts +14 -4
  47. package/{internal/circular-progress → circular-progress}/CircularProgress.d.ts +1 -1
  48. package/{internal/circular-progress → circular-progress}/CircularProgress.js +2 -2
  49. package/compose/Compose.d.ts +1 -1
  50. package/compose/ComposeItem.d.ts +1 -1
  51. package/config-provider/ConfigProvider.d.ts +1 -1
  52. package/config-provider/ConfigProvider.js +3 -3
  53. package/date-picker/DatePicker.d.ts +2 -2
  54. package/date-picker/DatePicker.js +116 -98
  55. package/date-picker/internal/DatePickerPanel.d.ts +2 -1
  56. package/date-picker/internal/DatePickerPanel.js +4 -4
  57. package/date-picker/types.d.ts +3 -3
  58. package/dialog-service.d.ts +9 -6
  59. package/dialog-service.js +50 -26
  60. package/drawer/Drawer.d.ts +1 -1
  61. package/drawer/Drawer.js +83 -92
  62. package/drawer/DrawerFooter.d.ts +1 -1
  63. package/drawer/DrawerFooter.js +12 -9
  64. package/drawer/DrawerHeader.d.ts +1 -1
  65. package/drawer/DrawerHeader.js +10 -7
  66. package/drawer/types.d.ts +9 -2
  67. package/drawer/vars.d.ts +5 -1
  68. package/drawer/vars.js +1 -1
  69. package/dropdown/Dropdown.d.ts +2 -4
  70. package/dropdown/Dropdown.js +83 -104
  71. package/dropdown/internal/DropdownGroup.d.ts +1 -1
  72. package/dropdown/internal/DropdownItem.d.ts +1 -1
  73. package/dropdown/internal/DropdownSub.d.ts +2 -1
  74. package/dropdown/internal/DropdownSub.js +26 -49
  75. package/dropdown/types.d.ts +15 -2
  76. package/empty/Empty.d.ts +1 -1
  77. package/fab/Fab.d.ts +1 -1
  78. package/fab/Fab.js +19 -14
  79. package/fab/FabBacktop.d.ts +1 -1
  80. package/fab/FabBacktop.js +24 -31
  81. package/fab/FabButton.d.ts +1 -1
  82. package/fab/FabButton.js +37 -10
  83. package/fab/types.d.ts +6 -2
  84. package/fab/vars.d.ts +14 -0
  85. package/fab/vars.js +4 -0
  86. package/form/Form.d.ts +1 -1
  87. package/form/Form.js +7 -2
  88. package/form/FormItem.d.ts +1 -1
  89. package/form/FormItem.js +35 -24
  90. package/form/internal/FormError.d.ts +3 -2
  91. package/form/internal/FormError.js +10 -19
  92. package/hooks/index.d.ts +0 -2
  93. package/hooks/index.js +0 -2
  94. package/hooks/useComponentProps.js +2 -2
  95. package/hooks/useFocusVisible.d.ts +9 -2
  96. package/hooks/useFocusVisible.js +5 -11
  97. package/hooks/useLayout.d.ts +2 -2
  98. package/hooks/useLayout.js +2 -2
  99. package/hooks/useNamespace.js +2 -2
  100. package/hooks/useNestedPopup.d.ts +1 -1
  101. package/hooks/useScopedProps.js +2 -2
  102. package/hooks/useStyled.js +2 -2
  103. package/hooks/useTranslation.js +2 -2
  104. package/icon/Icon.d.ts +1 -1
  105. package/icon/Icon.js +7 -4
  106. package/image/Image.d.ts +1 -1
  107. package/image/Image.js +6 -2
  108. package/image/ImageAction.d.ts +1 -1
  109. package/image/ImageAction.js +3 -4
  110. package/image/ImageLoader.d.ts +1 -1
  111. package/image/ImagePreview.d.ts +1 -1
  112. package/image/ImagePreview.js +94 -109
  113. package/image/types.d.ts +6 -2
  114. package/input/Input.d.ts +1 -1
  115. package/input/Input.js +12 -8
  116. package/input/InputNumber.js +49 -40
  117. package/input/types.d.ts +3 -5
  118. package/internal/lazy-loading/LazyLoading.d.ts +3 -0
  119. package/internal/lazy-loading/LazyLoading.js +9 -0
  120. package/internal/lazy-loading/index.d.ts +2 -0
  121. package/internal/lazy-loading/index.js +1 -0
  122. package/internal/lazy-loading/types.d.ts +7 -0
  123. package/internal/popup/Popup.d.ts +1 -1
  124. package/internal/popup/Popup.js +40 -68
  125. package/internal/popup/types.d.ts +13 -6
  126. package/internal/portal/Portal.d.ts +1 -1
  127. package/internal/portal/Portal.js +12 -6
  128. package/internal/portal/types.d.ts +3 -2
  129. package/mask/Mask.d.ts +3 -0
  130. package/mask/Mask.js +31 -0
  131. package/menu/Menu.d.ts +2 -4
  132. package/menu/Menu.js +37 -42
  133. package/menu/internal/MenuGroup.d.ts +1 -1
  134. package/menu/internal/MenuItem.d.ts +1 -1
  135. package/menu/internal/MenuItem.js +14 -10
  136. package/menu/internal/MenuSub.d.ts +2 -1
  137. package/menu/internal/MenuSub.js +43 -70
  138. package/menu/types.d.ts +1 -0
  139. package/modal/Modal.d.ts +1 -1
  140. package/modal/Modal.js +77 -80
  141. package/modal/ModalAlert.d.ts +1 -1
  142. package/modal/ModalFooter.d.ts +1 -1
  143. package/modal/ModalFooter.js +12 -9
  144. package/modal/ModalHeader.d.ts +1 -1
  145. package/modal/ModalHeader.js +10 -7
  146. package/modal/types.d.ts +9 -2
  147. package/modal/vars.d.ts +5 -0
  148. package/modal/vars.js +2 -0
  149. package/notification/Notification.d.ts +1 -1
  150. package/notification/Notification.js +44 -71
  151. package/notification/types.d.ts +1 -0
  152. package/package.json +2 -2
  153. package/pagination/Pagination.d.ts +1 -1
  154. package/pagination/Pagination.js +9 -6
  155. package/popover/Popover.d.ts +2 -2
  156. package/popover/Popover.js +82 -118
  157. package/popover/PopoverFooter.d.ts +1 -1
  158. package/popover/PopoverFooter.js +12 -9
  159. package/popover/PopoverHeader.d.ts +1 -1
  160. package/popover/PopoverHeader.js +10 -7
  161. package/popover/types.d.ts +18 -4
  162. package/popover/vars.d.ts +5 -0
  163. package/popover/vars.js +2 -0
  164. package/progress/Progress.d.ts +1 -1
  165. package/radio/Radio.d.ts +1 -1
  166. package/radio/Radio.js +18 -13
  167. package/radio/RadioGroup.d.ts +1 -1
  168. package/radio/RadioGroup.js +12 -7
  169. package/radio/types.d.ts +16 -4
  170. package/radio/vars.d.ts +6 -0
  171. package/radio/vars.js +2 -0
  172. package/rating/Rating.d.ts +1 -1
  173. package/rating/internal/RatingStar.d.ts +1 -1
  174. package/rating/internal/RatingStar.js +23 -21
  175. package/root/Root.d.ts +1 -1
  176. package/root/Root.js +1 -1
  177. package/select/Select.d.ts +2 -4
  178. package/select/Select.js +245 -243
  179. package/select/types.d.ts +3 -3
  180. package/separator/Separator.d.ts +1 -1
  181. package/skeleton/Skeleton.d.ts +1 -1
  182. package/slider/Slider.d.ts +1 -1
  183. package/slider/Slider.js +54 -34
  184. package/slider/types.d.ts +2 -3
  185. package/slides/Slides.d.ts +1 -1
  186. package/slides/Slides.js +8 -3
  187. package/spinner/Spinner.d.ts +1 -1
  188. package/spinner/Spinner.js +27 -29
  189. package/stepper/Stepper.d.ts +1 -1
  190. package/stepper/Stepper.js +9 -16
  191. package/switch/Switch.js +33 -24
  192. package/switch/types.d.ts +2 -3
  193. package/table/Table.d.ts +1 -1
  194. package/table/Table.js +14 -10
  195. package/table/TableEmpty.d.ts +1 -1
  196. package/table/TableEmpty.js +9 -3
  197. package/table/TableExpand.d.ts +1 -1
  198. package/table/TableFilter.d.ts +1 -1
  199. package/table/TableFilter.js +1 -1
  200. package/table/TableTd.d.ts +1 -1
  201. package/table/TableTh.d.ts +1 -1
  202. package/table/TableThAction.d.ts +1 -1
  203. package/table/TableThAction.js +3 -4
  204. package/table/internal/TableCell.d.ts +1 -1
  205. package/table/internal/TableCell.js +13 -5
  206. package/table/types.d.ts +9 -2
  207. package/tabs/Tabs.d.ts +2 -4
  208. package/tabs/Tabs.js +41 -25
  209. package/tabs/types.d.ts +1 -0
  210. package/tag/Tag.d.ts +1 -1
  211. package/textarea/Textarea.d.ts +1 -1
  212. package/textarea/Textarea.js +15 -8
  213. package/textarea/types.d.ts +1 -0
  214. package/time-picker/TimePicker.d.ts +2 -2
  215. package/time-picker/TimePicker.js +89 -75
  216. package/time-picker/internal/TimePickerPanel.d.ts +2 -1
  217. package/time-picker/internal/TimePickerPanel.js +22 -7
  218. package/time-picker/types.d.ts +3 -3
  219. package/timeline/Timeline.d.ts +1 -1
  220. package/toast/Toast.d.ts +1 -1
  221. package/toast/Toast.js +44 -72
  222. package/toast/types.d.ts +1 -0
  223. package/tooltip/Tooltip.d.ts +2 -2
  224. package/tooltip/Tooltip.js +50 -74
  225. package/tooltip/types.d.ts +10 -2
  226. package/transfer/Transfer.d.ts +1 -1
  227. package/transfer/internal/TransferPanel.d.ts +1 -1
  228. package/transfer/internal/TransferPanel.js +7 -2
  229. package/{internal/transition → transition}/CollapseTransition.d.ts +1 -1
  230. package/transition/CollapseTransition.js +65 -0
  231. package/transition/Transition.d.ts +3 -0
  232. package/transition/Transition.js +148 -0
  233. package/transition/types.d.ts +29 -0
  234. package/tree/Tree.d.ts +1 -1
  235. package/tree/Tree.js +19 -7
  236. package/tree/internal/TreePanel.d.ts +2 -2
  237. package/tree/internal/TreePanel.js +32 -26
  238. package/tree-select/TreeSelect.d.ts +2 -4
  239. package/tree-select/TreeSelect.js +216 -213
  240. package/tree-select/internal/TreeSelectSearchPanel.d.ts +2 -2
  241. package/tree-select/internal/TreeSelectSearchPanel.js +15 -6
  242. package/tree-select/types.d.ts +3 -3
  243. package/types.d.ts +1 -1
  244. package/upload/Upload.d.ts +1 -3
  245. package/upload/Upload.js +41 -50
  246. package/upload/UploadAction.d.ts +1 -1
  247. package/upload/UploadAction.js +19 -16
  248. package/upload/UploadButton.d.ts +1 -1
  249. package/upload/UploadButton.js +16 -12
  250. package/upload/UploadList.d.ts +1 -1
  251. package/upload/UploadList.js +52 -47
  252. package/upload/UploadPicture.d.ts +1 -1
  253. package/upload/UploadPicture.js +47 -53
  254. package/upload/UploadPictureList.d.ts +1 -1
  255. package/upload/UploadPictureList.js +52 -47
  256. package/upload/UploadPreviewAction.d.ts +1 -1
  257. package/upload/UploadPreviewAction.js +15 -14
  258. package/upload/hooks.d.ts +2 -0
  259. package/upload/types.d.ts +27 -6
  260. package/upload/vars.d.ts +11 -0
  261. package/upload/vars.js +3 -0
  262. package/virtual-scroll/VirtualScroll.d.ts +2 -4
  263. package/virtual-scroll/VirtualScroll.js +13 -21
  264. package/virtual-scroll/types.d.ts +2 -1
  265. package/wave/Wave.d.ts +3 -0
  266. package/{internal/wave → wave}/Wave.js +6 -6
  267. package/{internal/wave → wave}/types.d.ts +1 -0
  268. package/wave/types.js +1 -0
  269. package/LICENSE +0 -21
  270. package/hooks/useJSS.d.ts +0 -1
  271. package/hooks/useJSS.js +0 -15
  272. package/hooks/useNextTick.d.ts +0 -2
  273. package/internal/mask/Mask.d.ts +0 -3
  274. package/internal/mask/Mask.js +0 -36
  275. package/internal/transition/CollapseTransition.js +0 -101
  276. package/internal/transition/Transition.d.ts +0 -3
  277. package/internal/transition/Transition.js +0 -87
  278. package/internal/transition/types.d.ts +0 -33
  279. package/internal/wave/Wave.d.ts +0 -3
  280. /package/{internal/circular-progress → circular-progress}/index.d.ts +0 -0
  281. /package/{internal/circular-progress → circular-progress}/index.js +0 -0
  282. /package/{internal/circular-progress → circular-progress}/vars.d.ts +0 -0
  283. /package/{internal/circular-progress → circular-progress}/vars.js +0 -0
  284. /package/internal/{mask → lazy-loading}/types.js +0 -0
  285. /package/{internal/mask → mask}/index.d.ts +0 -0
  286. /package/{internal/mask → mask}/index.js +0 -0
  287. /package/{internal/mask → mask}/types.d.ts +0 -0
  288. /package/{internal/transition → mask}/types.js +0 -0
  289. /package/{internal/mask → mask}/vars.d.ts +0 -0
  290. /package/{internal/mask → mask}/vars.js +0 -0
  291. /package/{internal/transition → transition}/index.d.ts +0 -0
  292. /package/{internal/transition → transition}/index.js +0 -0
  293. /package/{internal/wave → transition}/types.js +0 -0
  294. /package/{hooks/useNextTick.js → upload/hooks.js} +0 -0
  295. /package/{internal/wave → wave}/index.d.ts +0 -0
  296. /package/{internal/wave → wave}/index.js +0 -0
  297. /package/{internal/wave → wave}/vars.d.ts +0 -0
  298. /package/{internal/wave → wave}/vars.js +0 -0
@@ -1,101 +0,0 @@
1
- import { __rest } from "tslib";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { isNumber, isUndefined } from 'lodash';
4
- import { useRef } from 'react';
5
- import { Transition } from './Transition';
6
- export function CollapseTransition(props) {
7
- const { children, originalSize: originalSizeProp, collapsedSize, styles } = props, restProps = __rest(props, ["children", "originalSize", "collapsedSize", "styles"]);
8
- const dataRef = useRef({
9
- width: 0,
10
- height: 0,
11
- });
12
- const elRef = useRef(null);
13
- const isHorizontal = !isUndefined(originalSizeProp.width);
14
- const getSizeStyle = (val) => (isUndefined(val) ? '' : isNumber(val) ? `${val}px` : val);
15
- return (_jsx(Transition, Object.assign({}, restProps, { afterRender: () => {
16
- var _a, _b, _c, _d, _e;
17
- (_a = restProps.afterRender) === null || _a === void 0 ? void 0 : _a.call(restProps);
18
- if (elRef.current) {
19
- if (originalSizeProp.width === 'auto') {
20
- const cssText = elRef.current.style.cssText;
21
- elRef.current.style.width = 'auto';
22
- elRef.current.style.paddingLeft = getSizeStyle((_b = originalSizeProp.padding) === null || _b === void 0 ? void 0 : _b[3]);
23
- elRef.current.style.paddingRight = getSizeStyle((_c = originalSizeProp.padding) === null || _c === void 0 ? void 0 : _c[1]);
24
- dataRef.current.width = elRef.current.offsetWidth;
25
- elRef.current.style.cssText = cssText;
26
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions
27
- elRef.current.offsetTop;
28
- }
29
- else if (originalSizeProp.height === 'auto') {
30
- const cssText = elRef.current.style.cssText;
31
- elRef.current.style.height = 'auto';
32
- elRef.current.style.paddingTop = getSizeStyle((_d = originalSizeProp.padding) === null || _d === void 0 ? void 0 : _d[0]);
33
- elRef.current.style.paddingBottom = getSizeStyle((_e = originalSizeProp.padding) === null || _e === void 0 ? void 0 : _e[2]);
34
- dataRef.current.height = elRef.current.offsetHeight;
35
- elRef.current.style.cssText = cssText;
36
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions
37
- elRef.current.offsetTop;
38
- }
39
- }
40
- }, children: (state) => {
41
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
42
- const transitionStyle = Object.assign({}, styles[state]);
43
- const originalSize = {
44
- [isHorizontal ? 'width' : 'height']: isHorizontal
45
- ? originalSizeProp.width === 'auto'
46
- ? dataRef.current.width
47
- : originalSizeProp.width
48
- : originalSizeProp.height === 'auto'
49
- ? dataRef.current.height
50
- : originalSizeProp.height,
51
- };
52
- if (!isUndefined(originalSizeProp.padding)) {
53
- originalSize.padding = originalSizeProp.padding.map((p) => getSizeStyle(p)).join(' ');
54
- }
55
- const collapsedStyle = Object.assign({
56
- [isHorizontal ? 'width' : 'height']: collapsedSize[isHorizontal ? 'width' : 'height'],
57
- overflow: 'hidden',
58
- }, isHorizontal
59
- ? {
60
- paddingLeft: (_b = (_a = collapsedSize.padding) === null || _a === void 0 ? void 0 : _a[3]) !== null && _b !== void 0 ? _b : 0,
61
- paddingRight: (_d = (_c = collapsedSize.padding) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : 0,
62
- marginLeft: (_f = (_e = collapsedSize.margin) === null || _e === void 0 ? void 0 : _e[3]) !== null && _f !== void 0 ? _f : 0,
63
- marginRight: (_h = (_g = collapsedSize.margin) === null || _g === void 0 ? void 0 : _g[1]) !== null && _h !== void 0 ? _h : 0,
64
- }
65
- : {
66
- paddingTop: (_k = (_j = collapsedSize.padding) === null || _j === void 0 ? void 0 : _j[0]) !== null && _k !== void 0 ? _k : 0,
67
- paddingBottom: (_m = (_l = collapsedSize.padding) === null || _l === void 0 ? void 0 : _l[2]) !== null && _m !== void 0 ? _m : 0,
68
- marginTop: (_p = (_o = collapsedSize.margin) === null || _o === void 0 ? void 0 : _o[0]) !== null && _p !== void 0 ? _p : 0,
69
- marginBottom: (_r = (_q = collapsedSize.margin) === null || _q === void 0 ? void 0 : _q[2]) !== null && _r !== void 0 ? _r : 0,
70
- });
71
- switch (state) {
72
- case 'enter':
73
- Object.assign(transitionStyle, collapsedStyle);
74
- break;
75
- case 'entering':
76
- Object.assign(transitionStyle, originalSize, {
77
- overflow: 'hidden',
78
- });
79
- break;
80
- case 'leave':
81
- if (elRef.current) {
82
- originalSize[isHorizontal ? 'width' : 'height'] = elRef.current[isHorizontal ? 'offsetWidth' : 'offsetHeight'];
83
- }
84
- Object.assign(transitionStyle, originalSize, {
85
- overflow: 'hidden',
86
- });
87
- break;
88
- case 'leaving':
89
- Object.assign(transitionStyle, collapsedStyle);
90
- break;
91
- case 'leaved':
92
- Object.assign(transitionStyle, collapsedStyle, {
93
- overflow: 'hidden',
94
- });
95
- break;
96
- default:
97
- break;
98
- }
99
- return children(elRef, transitionStyle, state);
100
- } })));
101
- }
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import type { TransitionProps } from './types';
3
- export declare function Transition(props: TransitionProps): JSX.Element | null;
@@ -1,87 +0,0 @@
1
- import { useAsync } from '@laser-ui/hooks';
2
- import { isArray, isBoolean, isNumber } from 'lodash';
3
- import { useEffect, useMemo, useRef, useState } from 'react';
4
- export function Transition(props) {
5
- const { children, enter: enterProp, defaultEnter, during: duringProp, mountBeforeFirstEnter = true, skipFirstTransition = true, destroyWhenLeaved = false, afterRender, afterEnter, afterLeave, } = props;
6
- // eslint-disable-next-line react-hooks/exhaustive-deps
7
- const initEnter = useMemo(() => (isBoolean(enterProp) ? enterProp : defaultEnter), []);
8
- const initState = useMemo(() => {
9
- const [skipEnter, skipLeave] = isArray(skipFirstTransition) ? skipFirstTransition : [skipFirstTransition, skipFirstTransition];
10
- if (initEnter) {
11
- return skipEnter ? 'entered' : 'enter';
12
- }
13
- else {
14
- return skipLeave ? 'leaved' : 'leave';
15
- }
16
- // eslint-disable-next-line react-hooks/exhaustive-deps
17
- }, []);
18
- const dataRef = useRef({
19
- prevEnter: initEnter,
20
- isFirstEnter: !initEnter,
21
- state: initState,
22
- });
23
- const enter = isBoolean(enterProp) ? enterProp : enterProp(dataRef.current.prevEnter);
24
- const async = useAsync();
25
- const [stateChange, setStateChange] = useState(0);
26
- if (dataRef.current.prevEnter !== enter) {
27
- dataRef.current.prevEnter = enter;
28
- dataRef.current.state = enter ? 'enter' : 'leave';
29
- dataRef.current.isFirstEnter = false;
30
- }
31
- const state = dataRef.current.state;
32
- const nextFrame = (cb) => {
33
- dataRef.current.clearTid = async.requestAnimationFrame(() => {
34
- dataRef.current.clearTid = async.setTimeout(cb);
35
- });
36
- };
37
- useEffect(() => {
38
- if (state === 'entered') {
39
- afterRender === null || afterRender === void 0 ? void 0 : afterRender();
40
- }
41
- // eslint-disable-next-line react-hooks/exhaustive-deps
42
- }, []);
43
- useEffect(() => {
44
- var _a, _b;
45
- (_b = (_a = dataRef.current).clearTid) === null || _b === void 0 ? void 0 : _b.call(_a);
46
- if (state === 'enter') {
47
- afterRender === null || afterRender === void 0 ? void 0 : afterRender();
48
- nextFrame(() => {
49
- dataRef.current.state = 'entering';
50
- setStateChange((prevStateChange) => prevStateChange + 1);
51
- });
52
- }
53
- else if (state === 'leave') {
54
- nextFrame(() => {
55
- dataRef.current.state = 'leaving';
56
- setStateChange((prevStateChange) => prevStateChange + 1);
57
- });
58
- }
59
- // eslint-disable-next-line react-hooks/exhaustive-deps
60
- }, [enter]);
61
- useEffect(() => {
62
- if (dataRef.current.state === 'entering' || dataRef.current.state === 'leaving') {
63
- const during = isNumber(duringProp) ? duringProp : enter ? duringProp.enter : duringProp.leave;
64
- dataRef.current.clearTid = async.setTimeout(() => {
65
- dataRef.current.state = enter ? 'entered' : 'leaved';
66
- setStateChange((prevStateChange) => prevStateChange + 1);
67
- }, during);
68
- }
69
- // eslint-disable-next-line react-hooks/exhaustive-deps
70
- }, [stateChange]);
71
- useEffect(() => {
72
- if (dataRef.current.state === 'entered' || dataRef.current.state === 'leaved') {
73
- enter ? afterEnter === null || afterEnter === void 0 ? void 0 : afterEnter() : afterLeave === null || afterLeave === void 0 ? void 0 : afterLeave();
74
- }
75
- // eslint-disable-next-line react-hooks/exhaustive-deps
76
- }, [stateChange]);
77
- const shouldRender = (() => {
78
- if (state === 'leaved' && destroyWhenLeaved) {
79
- return false;
80
- }
81
- if (dataRef.current.isFirstEnter && !mountBeforeFirstEnter) {
82
- return false;
83
- }
84
- return true;
85
- })();
86
- return shouldRender ? children(state) : null;
87
- }
@@ -1,33 +0,0 @@
1
- /// <reference types="react" />
2
- export {};
3
- export type TransitionState = 'enter' | 'entering' | 'entered' | 'leave' | 'leaving' | 'leaved';
4
- export interface TransitionProps {
5
- children: (state: TransitionState) => JSX.Element | null;
6
- enter: boolean | ((prev: boolean) => boolean);
7
- defaultEnter?: boolean;
8
- during: number | {
9
- enter: number;
10
- leave: number;
11
- };
12
- mountBeforeFirstEnter?: boolean;
13
- skipFirstTransition?: boolean | [boolean, boolean];
14
- destroyWhenLeaved?: boolean;
15
- afterRender?: () => void;
16
- afterEnter?: () => void;
17
- afterLeave?: () => void;
18
- }
19
- export interface CollapseTransitionProps extends Omit<TransitionProps, 'children'> {
20
- children: (ref: React.RefObject<any>, style: React.CSSProperties, state: TransitionState) => JSX.Element | null;
21
- originalSize: {
22
- width?: string | number;
23
- height?: string | number;
24
- padding?: [string | number, string | number, string | number, string | number];
25
- };
26
- collapsedSize: {
27
- width?: string | number;
28
- height?: string | number;
29
- padding?: [string | number, string | number, string | number, string | number];
30
- margin?: [string | number, string | number, string | number, string | number];
31
- };
32
- styles: Partial<Record<TransitionState, React.CSSProperties>>;
33
- }
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import type { WaveProps, WaveRef } from './types';
3
- export declare const Wave: import("react").ForwardRefExoticComponent<WaveProps & import("react").RefAttributes<WaveRef>>;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes