deepsea-components 5.18.4 → 5.18.6

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 (134) hide show
  1. package/README.md +23 -23
  2. package/dist/components/AutoFit.cjs +4 -4
  3. package/dist/components/AutoFit.d.ts +1 -1
  4. package/dist/components/AutoFit.js +1 -1
  5. package/dist/components/AutoScroll.cjs +4 -4
  6. package/dist/components/AutoScroll.d.ts +2 -2
  7. package/dist/components/AutoScroll.js +1 -1
  8. package/dist/components/AutoSizeTextarea.cjs +4 -4
  9. package/dist/components/AutoSizeTextarea.d.ts +1 -1
  10. package/dist/components/AutoSizeTextarea.js +1 -1
  11. package/dist/components/CircleText.cjs +4 -4
  12. package/dist/components/CircleText.d.ts +1 -1
  13. package/dist/components/CircleText.js +1 -1
  14. package/dist/components/CopyButton.cjs +6 -9
  15. package/dist/components/CopyButton.d.ts +3 -3
  16. package/dist/components/CopyButton.js +3 -3
  17. package/dist/components/DraggableGrid.cjs +3 -3
  18. package/dist/components/DraggableGrid.d.ts +2 -2
  19. package/dist/components/DraggableGrid.module.cjs +3 -3
  20. package/dist/components/DraggableGrid.module.js +1 -1
  21. package/dist/components/Echart.cjs +20 -20
  22. package/dist/components/Echart.d.ts +3 -3
  23. package/dist/components/Echart.js +1 -1
  24. package/dist/components/Flow.cjs +7 -7
  25. package/dist/components/Flow.d.ts +1 -1
  26. package/dist/components/Flow.js +1 -1
  27. package/dist/components/FormLabel.cjs +6 -6
  28. package/dist/components/FormLabel.d.ts +1 -1
  29. package/dist/components/FormLabel.js +1 -1
  30. package/dist/components/HlsPlayer.cjs +4 -4
  31. package/dist/components/HlsPlayer.d.ts +1 -1
  32. package/dist/components/HlsPlayer.js +1 -1
  33. package/dist/components/IconFileType.cjs +6 -6
  34. package/dist/components/IconFileType.d.ts +1 -1
  35. package/dist/components/InfiniteScroll.cjs +4 -4
  36. package/dist/components/InfiniteScroll.d.ts +1 -1
  37. package/dist/components/InfiniteScroll.js +1 -1
  38. package/dist/components/InputFile.cjs +4 -4
  39. package/dist/components/InputFile.d.ts +1 -1
  40. package/dist/components/InputFile.js +1 -1
  41. package/dist/components/InputFileButton.cjs +4 -4
  42. package/dist/components/InputFileButton.d.ts +2 -2
  43. package/dist/components/InputFileButton.js +1 -1
  44. package/dist/components/LoopSwiper.cjs +4 -4
  45. package/dist/components/LoopSwiper.d.ts +1 -1
  46. package/dist/components/LoopSwiper.js +1 -1
  47. package/dist/components/ReadExcel.cjs +4 -4
  48. package/dist/components/ReadExcel.d.ts +1 -1
  49. package/dist/components/ReadExcel.js +1 -1
  50. package/dist/components/ReadSheet.cjs +4 -4
  51. package/dist/components/ReadSheet.d.ts +2 -2
  52. package/dist/components/ReadSheet.js +1 -1
  53. package/dist/components/Ring.cjs +4 -4
  54. package/dist/components/Ring.d.ts +1 -1
  55. package/dist/components/Ring.js +1 -1
  56. package/dist/components/RtspPlayer.cjs +5 -5
  57. package/dist/components/RtspPlayer.d.ts +1 -1
  58. package/dist/components/RtspPlayer.js +2 -2
  59. package/dist/components/Scroll.cjs +38 -40
  60. package/dist/components/Scroll.d.ts +1 -1
  61. package/dist/components/Scroll.js +1 -1
  62. package/dist/components/ScrollMask.cjs +3 -3
  63. package/dist/components/ScrollMask.d.ts +1 -1
  64. package/dist/components/ScrollMask.module.cjs +3 -3
  65. package/dist/components/ScrollMask.module.js +1 -1
  66. package/dist/components/ScrollMask_module.css +3 -1
  67. package/dist/components/SectionRing.cjs +4 -4
  68. package/dist/components/SectionRing.d.ts +1 -1
  69. package/dist/components/SectionRing.js +1 -1
  70. package/dist/components/Skeleton.cjs +4 -4
  71. package/dist/components/Skeleton.d.ts +1 -1
  72. package/dist/components/Skeleton.js +1 -1
  73. package/dist/components/Title.cjs +4 -4
  74. package/dist/components/Title.d.ts +1 -1
  75. package/dist/components/Title.js +1 -1
  76. package/dist/components/TransitionBox.cjs +4 -4
  77. package/dist/components/TransitionBox.d.ts +1 -1
  78. package/dist/components/TransitionBox.js +1 -1
  79. package/dist/components/TransitionNum.cjs +4 -4
  80. package/dist/components/TransitionNum.d.ts +1 -1
  81. package/dist/components/TransitionNum.js +1 -1
  82. package/dist/components/Trapezium.cjs +4 -4
  83. package/dist/components/Trapezium.d.ts +1 -1
  84. package/dist/components/Trapezium.js +1 -1
  85. package/dist/components/Unify.cjs +4 -4
  86. package/dist/components/Unify.d.ts +1 -1
  87. package/dist/components/Unify.js +1 -1
  88. package/dist/components/WriteExcel.cjs +4 -4
  89. package/dist/components/WriteExcel.d.ts +1 -1
  90. package/dist/components/WriteExcel.js +1 -1
  91. package/dist/components/WriteSheet.cjs +4 -4
  92. package/dist/components/WriteSheet.d.ts +2 -2
  93. package/dist/components/WriteSheet.js +1 -1
  94. package/dist/components/rtspPlayer/reader.cjs +3 -3
  95. package/dist/index.cjs +162 -226
  96. package/dist/utils/getReactVersion.cjs +3 -3
  97. package/dist/utils/index.cjs +3 -3
  98. package/dist/utils/index.d.ts +1 -1
  99. package/package.json +7 -7
  100. package/src/components/AutoFit.tsx +3 -1
  101. package/src/components/AutoScroll.tsx +4 -3
  102. package/src/components/AutoSizeTextarea.tsx +1 -1
  103. package/src/components/CircleText.tsx +81 -81
  104. package/src/components/CopyButton.tsx +8 -3
  105. package/src/components/DraggableGrid.tsx +9 -2
  106. package/src/components/Echart.tsx +65 -62
  107. package/src/components/Flow.tsx +11 -1
  108. package/src/components/FormLabel.tsx +1 -1
  109. package/src/components/HlsPlayer.tsx +1 -1
  110. package/src/components/IconFileType.tsx +1 -1
  111. package/src/components/InfiniteScroll.tsx +15 -1
  112. package/src/components/InputFile.tsx +6 -1
  113. package/src/components/InputFileButton.tsx +18 -13
  114. package/src/components/LoopSwiper.tsx +2 -1
  115. package/src/components/ReadExcel.tsx +13 -13
  116. package/src/components/ReadSheet.tsx +2 -2
  117. package/src/components/Ring.tsx +1 -1
  118. package/src/components/RtspPlayer.tsx +3 -4
  119. package/src/components/Scroll.tsx +13 -1
  120. package/src/components/ScrollMask.module.css +87 -87
  121. package/src/components/ScrollMask.tsx +1 -1
  122. package/src/components/SectionRing.tsx +2 -2
  123. package/src/components/Skeleton.tsx +1 -1
  124. package/src/components/Title.tsx +4 -1
  125. package/src/components/TransitionBox.tsx +1 -1
  126. package/src/components/TransitionNum.tsx +1 -1
  127. package/src/components/Trapezium.tsx +1 -1
  128. package/src/components/Unify.tsx +13 -1
  129. package/src/components/WriteExcel.tsx +13 -13
  130. package/src/components/WriteSheet.tsx +4 -2
  131. package/src/components/rtspPlayer/reader.ts +8 -9
  132. package/src/utils/getReactVersion.ts +7 -7
  133. package/src/utils/index.ts +33 -33
  134. package/tsconfig.json +6 -8
@@ -1,16 +1,16 @@
1
1
  "use client"
2
2
 
3
- import { CSSProperties, FC, MouseEvent as ReactMouseEvent, useEffect, useEffectEvent, useImperativeHandle, useRef } from "react"
3
+ import { type CSSProperties, type FC, type MouseEvent as ReactMouseEvent, useEffect, useEffectEvent, useImperativeHandle, useRef } from "react"
4
4
 
5
5
  import { css } from "@emotion/css"
6
6
  import { clsx, getArray } from "deepsea-tools"
7
7
  import Scrollbar from "smooth-scrollbar"
8
- import { ScrollStatus } from "smooth-scrollbar/interfaces/scrollbar"
8
+ import type { ScrollStatus } from "smooth-scrollbar/interfaces/scrollbar"
9
9
  import { useSize } from "soda-hooks"
10
10
 
11
11
  import { px, transformCSSVariable } from "@/utils"
12
12
 
13
- import { Scroll, ScrollProps } from "./Scroll"
13
+ import { type ScrollProps, Scroll } from "./Scroll"
14
14
 
15
15
  export interface AutoScrollProps extends ScrollProps {
16
16
  /** 轮播元素的个数 */
@@ -127,6 +127,7 @@ export const AutoScroll: FC<AutoScrollProps> = ({
127
127
  return () => {
128
128
  clearTimeout(timeout.current)
129
129
  bar.current?.removeListener(listener)
130
+ // eslint-disable-next-line react-hooks/exhaustive-deps
130
131
  bar.current?.scrollTo(0, 0)
131
132
  }
132
133
  }, [size, count, itemSize, gap, duration, animation, isVertical])
@@ -1,6 +1,6 @@
1
1
  "use client"
2
2
 
3
- import { forwardRef, TextareaHTMLAttributes, useImperativeHandle, useLayoutEffect, useRef, useState } from "react"
3
+ import { type TextareaHTMLAttributes, forwardRef, useImperativeHandle, useLayoutEffect, useRef, useState } from "react"
4
4
 
5
5
  import { css } from "@emotion/css"
6
6
  import { clsx } from "deepsea-tools"
@@ -1,81 +1,81 @@
1
- "use client"
2
-
3
- import { FC, Fragment, HTMLAttributes } from "react"
4
-
5
- export interface CircleTextProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children"> {
6
- /** 每一个方块的宽度 */
7
- width: number
8
- /** 每一个方块的高度 */
9
- height: number
10
- /** 圆弧的半径,不包含方块的高度 */
11
- radius: number
12
- /** 开始旋转的弧度,逆时针增加,0 为 x 轴方向 */
13
- startAngel?: number
14
- /** 每一个方块之间间隔的弧度 */
15
- gapAngel?: number
16
- /** 文字对齐的方式,默认居中 */
17
- align?: "left" | "center" | "right"
18
- /** 文字朝向圆心还是外侧,默认外侧 */
19
- direction?: "inner" | "outer"
20
- /** 是否反转文字顺序 */
21
- reverse?: boolean
22
- /** 分割文字的方法 */
23
- separator?: string | RegExp | ((text: string) => string[])
24
- /** 显示的文字 */
25
- children: string
26
- }
27
-
28
- /** 环形文字 */
29
- export const CircleText: FC<CircleTextProps> = props => {
30
- const {
31
- width,
32
- height,
33
- radius,
34
- startAngel = 0,
35
- gapAngel = 0,
36
- align = "center",
37
- style,
38
- direction = "outer",
39
- reverse = false,
40
- separator,
41
- children,
42
- ...rest
43
- } = props
44
- const unitAngle = Math.atan(width / 2 / radius) * 2
45
- const totalAngle = (unitAngle + gapAngel) * children.length - gapAngel
46
- const offsetAngle = align === "left" ? 0 : align === "right" ? totalAngle : totalAngle / 2
47
-
48
- function getTransform(idx: number) {
49
- const angle = startAngel - idx * (unitAngle + gapAngel) + offsetAngle - unitAngle / 2
50
- const x = (radius + height / 2) * Math.cos(angle) - width / 2
51
- const y = (radius + height / 2) * Math.sin(angle) * -1 - height / 2
52
- const z = Math.PI / 2 - angle + (direction === "inner" ? Math.PI : 0)
53
- return `translateX(${x}px) translateY(${y}px) rotateZ(${(z / Math.PI) * 180}deg)`
54
- }
55
-
56
- const words = typeof separator === "function" ? separator(children) : children.split(separator ?? "")
57
-
58
- if (reverse) words.reverse()
59
-
60
- return (
61
- <Fragment>
62
- {words.map((w, idx) => (
63
- <span
64
- key={idx}
65
- style={{
66
- position: "absolute",
67
- ...style,
68
- transform: getTransform(idx),
69
- textAlign: "center",
70
- width,
71
- lineHeight: `${height}px`,
72
- height: height,
73
- }}
74
- {...rest}
75
- >
76
- {w}
77
- </span>
78
- ))}
79
- </Fragment>
80
- )
81
- }
1
+ "use client"
2
+
3
+ import { type FC, type HTMLAttributes, Fragment } from "react"
4
+
5
+ export interface CircleTextProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children"> {
6
+ /** 每一个方块的宽度 */
7
+ width: number
8
+ /** 每一个方块的高度 */
9
+ height: number
10
+ /** 圆弧的半径,不包含方块的高度 */
11
+ radius: number
12
+ /** 开始旋转的弧度,逆时针增加,0 为 x 轴方向 */
13
+ startAngel?: number
14
+ /** 每一个方块之间间隔的弧度 */
15
+ gapAngel?: number
16
+ /** 文字对齐的方式,默认居中 */
17
+ align?: "left" | "center" | "right"
18
+ /** 文字朝向圆心还是外侧,默认外侧 */
19
+ direction?: "inner" | "outer"
20
+ /** 是否反转文字顺序 */
21
+ reverse?: boolean
22
+ /** 分割文字的方法 */
23
+ separator?: string | RegExp | ((text: string) => string[])
24
+ /** 显示的文字 */
25
+ children: string
26
+ }
27
+
28
+ /** 环形文字 */
29
+ export const CircleText: FC<CircleTextProps> = props => {
30
+ const {
31
+ width,
32
+ height,
33
+ radius,
34
+ startAngel = 0,
35
+ gapAngel = 0,
36
+ align = "center",
37
+ style,
38
+ direction = "outer",
39
+ reverse = false,
40
+ separator,
41
+ children,
42
+ ...rest
43
+ } = props
44
+ const unitAngle = Math.atan(width / 2 / radius) * 2
45
+ const totalAngle = (unitAngle + gapAngel) * children.length - gapAngel
46
+ const offsetAngle = align === "left" ? 0 : align === "right" ? totalAngle : totalAngle / 2
47
+
48
+ function getTransform(idx: number) {
49
+ const angle = startAngel - idx * (unitAngle + gapAngel) + offsetAngle - unitAngle / 2
50
+ const x = (radius + height / 2) * Math.cos(angle) - width / 2
51
+ const y = (radius + height / 2) * Math.sin(angle) * -1 - height / 2
52
+ const z = Math.PI / 2 - angle + (direction === "inner" ? Math.PI : 0)
53
+ return `translateX(${x}px) translateY(${y}px) rotateZ(${(z / Math.PI) * 180}deg)`
54
+ }
55
+
56
+ const words = typeof separator === "function" ? separator(children) : children.split(separator ?? "")
57
+
58
+ if (reverse) words.reverse()
59
+
60
+ return (
61
+ <Fragment>
62
+ {words.map((w, idx) => (
63
+ <span
64
+ key={idx}
65
+ style={{
66
+ position: "absolute",
67
+ ...style,
68
+ transform: getTransform(idx),
69
+ textAlign: "center",
70
+ width,
71
+ lineHeight: `${height}px`,
72
+ height: height,
73
+ }}
74
+ {...rest}
75
+ >
76
+ {w}
77
+ </span>
78
+ ))}
79
+ </Fragment>
80
+ )
81
+ }
@@ -1,11 +1,13 @@
1
1
  "use client"
2
2
 
3
- import { ComponentPropsWithoutRef, forwardRef, useEffect, useImperativeHandle, useRef } from "react"
3
+ /* eslint-disable no-restricted-syntax */
4
4
 
5
- import ClipboardJS, { Event } from "clipboard"
5
+ import { type ComponentPropsWithoutRef, forwardRef, useEffect, useImperativeHandle, useRef } from "react"
6
+
7
+ import ClipboardJS, { type Event } from "clipboard"
6
8
  import { useLatest } from "soda-hooks"
7
9
 
8
- export { Event } from "clipboard"
10
+ export type { Event } from "clipboard"
9
11
 
10
12
  export type CopyButtonProps = ComponentPropsWithoutRef<"button"> & {
11
13
  text?: string
@@ -19,13 +21,16 @@ export const CopyButton = forwardRef<HTMLButtonElement, CopyButtonProps>((props,
19
21
  const onCopySuccess = useLatest(_onCoptSuccess)
20
22
  const onCopyError = useLatest(_onCopyError)
21
23
 
24
+ // eslint-disable-next-line react-hooks/exhaustive-deps
22
25
  useImperativeHandle(ref, () => ele.current!, [ele.current])
23
26
 
24
27
  useEffect(() => {
25
28
  const clipboard = new ClipboardJS(ele.current!)
26
29
  clipboard.on("success", event => onCopySuccess.current?.(event))
27
30
  clipboard.on("error", event => onCopyError.current?.(event))
31
+
28
32
  return () => clipboard.destroy()
33
+ // eslint-disable-next-line react-hooks/exhaustive-deps
29
34
  }, [])
30
35
 
31
36
  return <button ref={ele} {...rest} data-clipboard-text={text} />
@@ -1,7 +1,9 @@
1
- import { ComponentProps, CSSProperties, Key, ReactNode, useEffect, useMemo, useRef, useState } from "react"
1
+ /* eslint-disable no-restricted-syntax */
2
+
3
+ import { type ComponentProps, type CSSProperties, type Key, type ReactNode, useEffect, useMemo, useRef, useState } from "react"
2
4
 
3
5
  import { clsx, getArray, isNullable } from "deepsea-tools"
4
- import { DragMoveEvent, DragMoveEvents, useDragMove } from "soda-hooks"
6
+ import { type DragMoveEvent, type DragMoveEvents, useDragMove } from "soda-hooks"
5
7
 
6
8
  import styles from "./DraggableGrid.module.css"
7
9
 
@@ -347,8 +349,11 @@ export function DraggableGrid<T, K extends Key = T extends Key ? T : never>({
347
349
  setKeyToOrder(newOrderMap)
348
350
  onOrderMapChange?.(newOrderMap)
349
351
  const newRenderKeys = new Set(newOrderMap.keys())
352
+
353
+ // eslint-disable-next-line react-hooks/immutability
350
354
  setRenderKeys(prev => prev.intersection(newRenderKeys).union(newRenderKeys.difference(prev)))
351
355
  }
356
+ // eslint-disable-next-line react-hooks/refs
352
357
  }, [dragging, cache, orders, keyToItem, keyToOrder, orderPriority, onOrderMapChange])
353
358
 
354
359
  /** 渲染的元素的 key,不会随着 keyToOrder 的变化而变化 */
@@ -384,6 +389,7 @@ export function DraggableGrid<T, K extends Key = T extends Key ? T : never>({
384
389
 
385
390
  if (!!orderMap && isLegalOrderMap({ orders, keys: keyToItem.keys(), orderMap })) setKeyToOrder(orderMap)
386
391
  else onOrderMapChange?.(keyToOrder)
392
+ // eslint-disable-next-line react-hooks/exhaustive-deps
387
393
  }, [orderMap, keyToOrder, onOrderMapChange])
388
394
 
389
395
  function onDragMoveStart(key: K, event: DragMoveEvent<HTMLDivElement>) {
@@ -512,6 +518,7 @@ export function DraggableGrid<T, K extends Key = T extends Key ? T : never>({
512
518
  }
513
519
  {...rest}
514
520
  >
521
+ {/* eslint-disable-next-line react-hooks/refs */}
515
522
  {Array.from(renderKeys).map(key => {
516
523
  if (!keyToItem.has(key)) return undefined
517
524
  const item = keyToItem.get(key)!
@@ -1,71 +1,71 @@
1
1
  "use client"
2
2
 
3
- import { ComponentProps, FC, ReactNode, Ref, useEffect, useImperativeHandle, useLayoutEffect, useRef } from "react"
3
+ import { type ComponentProps, type FC, type ReactNode, type Ref, useEffect, useImperativeHandle, useLayoutEffect, useRef } from "react"
4
4
 
5
5
  import {
6
- AngleAxisComponentOption,
7
- AriaComponentOption,
8
- AxisPointerComponentOption,
9
- BarSeriesOption,
10
- BoxplotSeriesOption,
11
- BrushComponentOption,
12
- CalendarComponentOption,
13
- CandlestickSeriesOption,
14
- ChordSeriesOption,
15
- ComposeOption,
16
- ContinousVisualMapComponentOption,
17
- CustomSeriesOption,
18
- DatasetComponentOption,
19
- DataZoomComponentOption,
20
- ECharts,
21
- EChartsInitOpts,
22
- EffectScatterSeriesOption,
23
- FunnelSeriesOption,
24
- GaugeSeriesOption,
25
- GeoComponentOption,
26
- GraphicComponentOption,
27
- GraphSeriesOption,
28
- GridComponentOption,
29
- HeatmapSeriesOption,
6
+ type AngleAxisComponentOption,
7
+ type AriaComponentOption,
8
+ type AxisPointerComponentOption,
9
+ type BarSeriesOption,
10
+ type BoxplotSeriesOption,
11
+ type BrushComponentOption,
12
+ type CalendarComponentOption,
13
+ type CandlestickSeriesOption,
14
+ type ChordSeriesOption,
15
+ type ComposeOption,
16
+ type ContinousVisualMapComponentOption,
17
+ type CustomSeriesOption,
18
+ type DatasetComponentOption,
19
+ type DataZoomComponentOption,
20
+ type ECharts,
21
+ type EChartsInitOpts,
22
+ type EffectScatterSeriesOption,
23
+ type FunnelSeriesOption,
24
+ type GaugeSeriesOption,
25
+ type GeoComponentOption,
26
+ type GraphicComponentOption,
27
+ type GraphSeriesOption,
28
+ type GridComponentOption,
29
+ type HeatmapSeriesOption,
30
+ type InsideDataZoomComponentOption,
31
+ type LegendComponentOption,
32
+ type LineSeriesOption,
33
+ type LinesSeriesOption,
34
+ type MapSeriesOption,
35
+ type MarkAreaComponentOption,
36
+ type MarkLineComponentOption,
37
+ type MarkPointComponentOption,
38
+ type MatrixComponentOption,
39
+ type ParallelSeriesOption,
40
+ type PictorialBarSeriesOption,
41
+ type PiecewiseVisualMapComponentOption,
42
+ type PieSeriesOption,
43
+ type PlainLegendComponentOption,
44
+ type PolarComponentOption,
45
+ type RadarComponentOption,
46
+ type RadarSeriesOption,
47
+ type RadiusAxisComponentOption,
48
+ type SankeySeriesOption,
49
+ type ScatterSeriesOption,
50
+ type ScrollableLegendComponentOption,
51
+ type SeriesOption,
52
+ type SingleAxisComponentOption,
53
+ type SliderDataZoomComponentOption,
54
+ type SunburstSeriesOption,
55
+ type ThemeRiverSeriesOption,
56
+ type ThumbnailComponentOption,
57
+ type TimelineComponentOption,
58
+ type TitleComponentOption,
59
+ type ToolboxComponentOption,
60
+ type TooltipComponentOption,
61
+ type TreemapSeriesOption,
62
+ type TreeSeriesOption,
63
+ type VisualMapComponentOption,
64
+ type XAXisComponentOption,
65
+ type YAXisComponentOption,
30
66
  init,
31
- InsideDataZoomComponentOption,
32
- LegendComponentOption,
33
- LineSeriesOption,
34
- LinesSeriesOption,
35
- MapSeriesOption,
36
- MarkAreaComponentOption,
37
- MarkLineComponentOption,
38
- MarkPointComponentOption,
39
- MatrixComponentOption,
40
- ParallelSeriesOption,
41
- PictorialBarSeriesOption,
42
- PiecewiseVisualMapComponentOption,
43
- PieSeriesOption,
44
- PlainLegendComponentOption,
45
- PolarComponentOption,
46
- RadarComponentOption,
47
- RadarSeriesOption,
48
- RadiusAxisComponentOption,
49
- SankeySeriesOption,
50
- ScatterSeriesOption,
51
- ScrollableLegendComponentOption,
52
- SeriesOption,
53
- SingleAxisComponentOption,
54
- SliderDataZoomComponentOption,
55
- SunburstSeriesOption,
56
- ThemeRiverSeriesOption,
57
- ThumbnailComponentOption,
58
- TimelineComponentOption,
59
- TitleComponentOption,
60
- ToolboxComponentOption,
61
- TooltipComponentOption,
62
- TreemapSeriesOption,
63
- TreeSeriesOption,
64
- VisualMapComponentOption,
65
- XAXisComponentOption,
66
- YAXisComponentOption,
67
67
  } from "echarts"
68
- import { ECBasicOption } from "echarts/types/src/util/types.js"
68
+ import type { ECBasicOption } from "echarts/types/src/util/types.js"
69
69
  import hash from "stable-hash"
70
70
 
71
71
  export type ChartOption<T extends SeriesOption = never> = ComposeOption<
@@ -179,13 +179,16 @@ export function Echart<T extends ECBasicOption = ECBasicOption>({
179
179
  useLayoutEffect(() => {
180
180
  const ele = container.current!
181
181
  chartRef.current = init(ele, option, { ...initOption, width, height, locale })
182
+
182
183
  return () => chartRef.current?.dispose()
184
+ // eslint-disable-next-line react-hooks/exhaustive-deps
183
185
  }, [])
184
186
 
185
187
  useImperativeHandle(ref, () => container.current!)
186
188
 
187
189
  useImperativeHandle(chart, () => chartRef.current!)
188
190
 
191
+ // eslint-disable-next-line react-hooks/exhaustive-deps
189
192
  useEffect(() => chartRef.current?.setOption(option), [hash(option)])
190
193
 
191
194
  // @ts-expect-error width and height can be string
@@ -1,6 +1,6 @@
1
1
  "use client"
2
2
 
3
- import { CSSProperties, HTMLAttributes, Key, ReactNode, Ref, useEffect, useImperativeHandle, useRef, useState } from "react"
3
+ import { type CSSProperties, type HTMLAttributes, type Key, type ReactNode, type Ref, useEffect, useImperativeHandle, useRef, useState } from "react"
4
4
 
5
5
  import { css } from "@emotion/css"
6
6
  import { clsx } from "deepsea-tools"
@@ -154,6 +154,7 @@ export function ManualFlow<T>(props: ManualFlowProps<T>) {
154
154
  return index >= maxRows * columnCount
155
155
  }
156
156
 
157
+ // eslint-disable-next-line react-hooks/exhaustive-deps, react-hooks/refs
157
158
  useImperativeHandle(element, () => ele.current!, [ele.current])
158
159
 
159
160
  useEffect(() => {
@@ -180,6 +181,7 @@ export function ManualFlow<T>(props: ManualFlowProps<T>) {
180
181
  itemCount: data.length,
181
182
  maxRows: maxRows ?? null,
182
183
  })
184
+ // eslint-disable-next-line react-hooks/exhaustive-deps
183
185
  }, [width, height, columnGapSize, columnCount, rowGap, contentShownRows, data.length, itemWidth, itemHeight, maxRows])
184
186
 
185
187
  return (
@@ -266,8 +268,16 @@ export function Flow<T>(props: FlowProps<T>): ReactNode {
266
268
  const ele = useRef<HTMLDivElement>(null)
267
269
  const size = useSize(ele)
268
270
  const width = useRef(size?.width || 0)
271
+
272
+ // eslint-disable-next-line react-hooks/refs
269
273
  if (size && size.width !== 0) width.current = size.width
274
+
275
+ // eslint-disable-next-line react-hooks/exhaustive-deps, react-hooks/refs
270
276
  useImperativeHandle(element, () => ele.current!, [ele.current])
277
+
278
+ // eslint-disable-next-line react-hooks/refs
271
279
  if (width.current === 0) return <div ref={ele} {...rest} />
280
+
281
+ // eslint-disable-next-line react-hooks/refs
272
282
  return <ManualFlow element={ele} {...props} width={width.current} />
273
283
  }
@@ -1,6 +1,6 @@
1
1
  "use client"
2
2
 
3
- import { ComponentPropsWithoutRef, createContext, FC, Fragment, ReactNode, useContext } from "react"
3
+ import { type ComponentPropsWithoutRef, type FC, type ReactNode, createContext, Fragment, useContext } from "react"
4
4
 
5
5
  export interface FormLabelConfig {
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  "use client"
2
2
 
3
- import { ComponentProps, FC, useEffect, useImperativeHandle, useRef } from "react"
3
+ import { type ComponentProps, type FC, useEffect, useImperativeHandle, useRef } from "react"
4
4
 
5
5
  import Hls from "hls.js"
6
6
 
@@ -1,4 +1,4 @@
1
- import { ComponentProps, FC } from "react"
1
+ import type { ComponentProps, FC } from "react"
2
2
 
3
3
  const GOLD = (Math.sqrt(5) - 1) / 2
4
4
  const GOLD_T = Math.sqrt(1 - GOLD * GOLD)
@@ -1,6 +1,16 @@
1
1
  "use client"
2
2
 
3
- import { ComponentPropsWithoutRef, CSSProperties, forwardRef, MouseEvent as ReactMouseEvent, useEffect, useImperativeHandle, useRef } from "react"
3
+ /* eslint-disable no-restricted-syntax */
4
+
5
+ import {
6
+ type ComponentPropsWithoutRef,
7
+ type CSSProperties,
8
+ type MouseEvent as ReactMouseEvent,
9
+ forwardRef,
10
+ useEffect,
11
+ useImperativeHandle,
12
+ useRef,
13
+ } from "react"
4
14
 
5
15
  import { css } from "@emotion/css"
6
16
  import { clsx } from "deepsea-tools"
@@ -58,6 +68,7 @@ export const InfiniteScroll = forwardRef<HTMLDivElement, InfiniteScrollProps>((p
58
68
 
59
69
  const ele = useRef<HTMLDivElement>(null)
60
70
 
71
+ // eslint-disable-next-line react-hooks/exhaustive-deps
61
72
  useImperativeHandle(ref, () => wrapper.current as HTMLDivElement, [wrapper.current])
62
73
 
63
74
  const container = useRef<HTMLDivElement>(null)
@@ -87,7 +98,9 @@ export const InfiniteScroll = forwardRef<HTMLDivElement, InfiniteScrollProps>((p
87
98
  },
88
99
  { duration, iterations: Infinity },
89
100
  )
101
+
90
102
  return () => animation.current?.cancel()
103
+ // eslint-disable-next-line react-hooks/exhaustive-deps
91
104
  }, [wrapperSize, containerSize, overflow, direction, duration])
92
105
 
93
106
  function enter(e: ReactMouseEvent<HTMLDivElement, MouseEvent>) {
@@ -102,6 +115,7 @@ export const InfiniteScroll = forwardRef<HTMLDivElement, InfiniteScrollProps>((p
102
115
 
103
116
  useEffect(() => {
104
117
  if (!pauseOnHover && animation.current?.playState === "paused") animation.current?.play()
118
+ // eslint-disable-next-line react-hooks/exhaustive-deps
105
119
  }, [animation.current, pauseOnHover])
106
120
 
107
121
  return (
@@ -1,6 +1,8 @@
1
1
  "use client"
2
2
 
3
- import { ChangeEvent, ComponentProps, ReactNode, useState } from "react"
3
+ /* eslint-disable no-restricted-syntax */
4
+
5
+ import { type ChangeEvent, type ComponentProps, type ReactNode, useState } from "react"
4
6
 
5
7
  export interface InputFileDataTypeMap {
6
8
  base64: string
@@ -21,9 +23,11 @@ export function getFileData<T extends InputFileDataType>(file: File, type: T): P
21
23
  fileReader.addEventListener("load", () => {
22
24
  resolve(fileReader.result as any)
23
25
  })
26
+
24
27
  fileReader.addEventListener("error", () => {
25
28
  reject(fileReader.error ?? new Error("Failed to read file"))
26
29
  })
30
+
27
31
  fileReader.addEventListener("abort", () => {
28
32
  reject(fileReader.error ?? new Error("File reading was aborted"))
29
33
  })
@@ -34,6 +38,7 @@ export function getFileData<T extends InputFileDataType>(file: File, type: T): P
34
38
  fileReader.readAsArrayBuffer(file)
35
39
  break
36
40
  case "binary":
41
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
37
42
  fileReader.readAsBinaryString(file)
38
43
  break
39
44
  case "base64":
@@ -1,29 +1,31 @@
1
1
  "use client"
2
2
 
3
+ /* eslint-disable no-restricted-syntax */
4
+
3
5
  import {
4
- ComponentProps,
5
- ComponentRef,
6
+ type ComponentProps,
7
+ type ComponentRef,
8
+ type DragEvent,
9
+ type JSX,
10
+ type JSXElementConstructor,
11
+ type MouseEvent as ReactMouseEvent,
6
12
  createElement,
7
- DragEvent,
8
13
  Fragment,
9
- JSX,
10
- JSXElementConstructor,
11
- MouseEvent as ReactMouseEvent,
12
14
  useImperativeHandle,
13
15
  useRef,
14
16
  useState,
15
17
  } from "react"
16
18
 
17
19
  import {
18
- DataType,
19
- FileType,
20
+ type DataType,
21
+ type FileType,
22
+ type InputFileBaseProps,
23
+ type InputFileDataType,
24
+ type InputFileDataTypeMap,
25
+ type InputFileExtraProps,
26
+ type ValueType,
20
27
  getFileData,
21
28
  InputFile,
22
- InputFileBaseProps,
23
- InputFileDataType,
24
- InputFileDataTypeMap,
25
- InputFileExtraProps,
26
- ValueType,
27
29
  } from "./InputFile"
28
30
 
29
31
  export type InputFileButtonProps<
@@ -68,6 +70,7 @@ export function InputFileButton<
68
70
  const input = useRef<HTMLInputElement>(null)
69
71
  const isDisabled = disabled || _disabled || __disabled
70
72
 
73
+ // eslint-disable-next-line react-hooks/exhaustive-deps, react-hooks/refs
71
74
  useImperativeHandle(ref, () => input.current!, [input.current])
72
75
 
73
76
  function onClick(e: ReactMouseEvent<ComponentRef<AS>, MouseEvent>) {
@@ -116,6 +119,7 @@ export function InputFileButton<
116
119
  e.preventDefault()
117
120
  }
118
121
 
122
+ /* eslint-disable react-hooks/refs */
119
123
  return (
120
124
  <Fragment>
121
125
  <InputFile<Multiple, Type>
@@ -141,4 +145,5 @@ export function InputFileButton<
141
145
  })}
142
146
  </Fragment>
143
147
  )
148
+ /* eslint-enable react-hooks/refs */
144
149
  }
@@ -1,6 +1,6 @@
1
1
  "use client"
2
2
 
3
- import { ComponentProps, CSSProperties, FC, useEffect, useImperativeHandle, useRef, useState } from "react"
3
+ import { type ComponentProps, type CSSProperties, type FC, useEffect, useImperativeHandle, useRef, useState } from "react"
4
4
 
5
5
  import { css } from "@emotion/css"
6
6
  import { clsx } from "deepsea-tools"
@@ -39,6 +39,7 @@ export const LoopSwiper: FC<LoopSwiperProps> = ({
39
39
  const container = useRef<HTMLDivElement>(null)
40
40
  const [swiper, setSwiper] = useState(false)
41
41
  const directionRef = useRef(direction)
42
+ // eslint-disable-next-line react-hooks/refs
42
43
  directionRef.current = direction
43
44
  const flexDirection: CSSProperties["flexDirection"] = direction === "vertical" ? (reverse ? "column-reverse" : "column") : reverse ? "row-reverse" : "row"
44
45
  const animationName = swiper