deepsea-components 5.15.22 → 5.15.24
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.
- package/README.md +23 -23
- package/dist/components/AutoFit.cjs +7 -7
- package/dist/components/AutoFit.js +30 -30
- package/dist/components/AutoScroll.cjs +7 -7
- package/dist/components/AutoScroll.js +30 -30
- package/dist/components/AutoSizeTextarea.cjs +4 -4
- package/dist/components/AutoSizeTextarea.js +17 -17
- package/dist/components/CircleText.js +4 -4
- package/dist/components/CopyButton.cjs +2 -2
- package/dist/components/CopyButton.js +13 -14
- package/dist/components/Echart.cjs +2 -2
- package/dist/components/Echart.js +12 -12
- package/dist/components/Flow.cjs +19 -19
- package/dist/components/Flow.js +44 -44
- package/dist/components/FormLabel.cjs +3 -3
- package/dist/components/FormLabel.js +9 -9
- package/dist/components/HlsPlayer.js +10 -10
- package/dist/components/IconFileType.cjs +4 -4
- package/dist/components/IconFileType.js +9 -9
- package/dist/components/InfiniteScroll.cjs +13 -13
- package/dist/components/InfiniteScroll.js +32 -32
- package/dist/components/InputFile.js +4 -4
- package/dist/components/InputFileButton.js +11 -11
- package/dist/components/LoopSwiper.cjs +33 -33
- package/dist/components/LoopSwiper.js +47 -47
- package/dist/components/ReadExcel.js +2 -2
- package/dist/components/ReadSheet.js +5 -5
- package/dist/components/Ring.js +4 -4
- package/dist/components/Scroll.cjs +15 -15
- package/dist/components/Scroll.js +32 -33
- package/dist/components/ScrollMask.js +13 -13
- package/dist/components/ScrollMask.module.cjs +2 -2
- package/dist/components/ScrollMask.module.js +2 -2
- package/dist/components/SectionRing.js +6 -6
- package/dist/components/Skeleton.cjs +17 -17
- package/dist/components/Skeleton.js +23 -23
- package/dist/components/Title.js +12 -12
- package/dist/components/TransitionBox.js +10 -10
- package/dist/components/TransitionNum.cjs +1 -1
- package/dist/components/TransitionNum.js +12 -12
- package/dist/components/Trapezium.cjs +4 -4
- package/dist/components/Trapezium.js +14 -14
- package/dist/components/Unify.js +10 -10
- package/dist/components/WriteExcel.js +2 -2
- package/dist/components/WriteSheet.js +4 -4
- package/dist/utils/getReactVersion.js +2 -2
- package/package.json +6 -5
- package/src/components/AutoFit.tsx +104 -104
- package/src/components/AutoScroll.tsx +150 -150
- package/src/components/AutoSizeTextarea.tsx +50 -50
- package/src/components/CircleText.tsx +81 -81
- package/src/components/CopyButton.tsx +31 -31
- package/src/components/Echart.tsx +69 -69
- package/src/components/Flow.tsx +271 -271
- package/src/components/FormLabel.tsx +41 -41
- package/src/components/HlsPlayer.tsx +34 -34
- package/src/components/IconFileType.tsx +162 -162
- package/src/components/InfiniteScroll.tsx +163 -163
- package/src/components/InputFile.tsx +93 -93
- package/src/components/InputFileButton.tsx +122 -122
- package/src/components/LoopSwiper.tsx +125 -125
- package/src/components/ReadExcel.tsx +13 -13
- package/src/components/ReadSheet.tsx +17 -17
- package/src/components/Ring.tsx +30 -30
- package/src/components/Scroll.tsx +97 -97
- package/src/components/ScrollMask.module.css +87 -87
- package/src/components/ScrollMask.tsx +68 -68
- package/src/components/SectionRing.tsx +40 -40
- package/src/components/Skeleton.tsx +45 -45
- package/src/components/Title.tsx +27 -27
- package/src/components/TransitionBox.tsx +44 -44
- package/src/components/TransitionNum.tsx +54 -54
- package/src/components/Trapezium.tsx +60 -60
- package/src/components/Unify.tsx +38 -38
- package/src/components/WriteExcel.tsx +13 -13
- package/src/components/WriteSheet.tsx +25 -25
- package/src/utils/getReactVersion.ts +7 -7
- package/src/utils/index.ts +33 -33
- package/tsconfig.json +16 -16
package/dist/components/Flow.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { css } from "@emotion/css";
|
|
4
|
+
import { clsx } from "deepsea-tools";
|
|
5
|
+
import { useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
6
|
+
import { useSize } from "soda-hooks";
|
|
7
|
+
import { px, transformCSSVariable } from "../utils/index.js";
|
|
8
8
|
function getGapRange(gap) {
|
|
9
9
|
if ("number" == typeof gap) return [
|
|
10
10
|
gap,
|
|
@@ -44,8 +44,8 @@ function ManualFlow(props) {
|
|
|
44
44
|
rowGap ??= gap;
|
|
45
45
|
columnGap ??= gap;
|
|
46
46
|
const [minColumnGap, maxColumnGap] = getGapRange(columnGap);
|
|
47
|
-
const [{ count: columnCount, gap: columnGapSize }, setGapAndCount] =
|
|
48
|
-
const ele =
|
|
47
|
+
const [{ count: columnCount, gap: columnGapSize }, setGapAndCount] = useState(()=>getGapCountAndSize(width, itemWidth, minColumnGap, maxColumnGap));
|
|
48
|
+
const ele = useRef(null);
|
|
49
49
|
const contentRows = Math.ceil(data.length / columnCount);
|
|
50
50
|
const contentShownRows = "number" == typeof maxRows ? Math.min(contentRows, maxRows) : contentRows;
|
|
51
51
|
const height = contentShownRows > 0 ? contentShownRows * (itemHeight + rowGap) - rowGap : 0;
|
|
@@ -61,10 +61,10 @@ function ManualFlow(props) {
|
|
|
61
61
|
if ("number" != typeof maxRows) return false;
|
|
62
62
|
return index >= maxRows * columnCount;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
useImperativeHandle(element, ()=>ele.current, [
|
|
65
65
|
ele.current
|
|
66
66
|
]);
|
|
67
|
-
|
|
67
|
+
useEffect(()=>{
|
|
68
68
|
function task() {
|
|
69
69
|
setGapAndCount(getGapCountAndSize(width, itemWidth, minColumnGap, maxColumnGap));
|
|
70
70
|
}
|
|
@@ -78,7 +78,7 @@ function ManualFlow(props) {
|
|
|
78
78
|
minColumnGap,
|
|
79
79
|
maxColumnGap
|
|
80
80
|
]);
|
|
81
|
-
|
|
81
|
+
useEffect(()=>{
|
|
82
82
|
onSizeChange?.({
|
|
83
83
|
width,
|
|
84
84
|
height,
|
|
@@ -104,41 +104,41 @@ function ManualFlow(props) {
|
|
|
104
104
|
itemHeight,
|
|
105
105
|
maxRows
|
|
106
106
|
]);
|
|
107
|
-
return /*#__PURE__*/
|
|
107
|
+
return /*#__PURE__*/ jsx("div", {
|
|
108
108
|
ref: ele,
|
|
109
|
-
className:
|
|
110
|
-
position: relative;
|
|
111
|
-
height: var(--height);
|
|
112
|
-
overflow: hidden;
|
|
109
|
+
className: clsx(css`
|
|
110
|
+
position: relative;
|
|
111
|
+
height: var(--height);
|
|
112
|
+
overflow: hidden;
|
|
113
113
|
`, className),
|
|
114
|
-
style:
|
|
115
|
-
height:
|
|
114
|
+
style: transformCSSVariable({
|
|
115
|
+
height: px(height)
|
|
116
116
|
}, style),
|
|
117
117
|
...rest,
|
|
118
|
-
children: data.map((item, index, arr)=>/*#__PURE__*/
|
|
119
|
-
className:
|
|
120
|
-
position: absolute;
|
|
121
|
-
width: var(--width);
|
|
122
|
-
height: var(--height);
|
|
123
|
-
transition: var(--transition);
|
|
124
|
-
left: 0;
|
|
125
|
-
top: 0;
|
|
126
|
-
transform: translate(var(--left), var(--top));
|
|
118
|
+
children: data.map((item, index, arr)=>/*#__PURE__*/ jsx("div", {
|
|
119
|
+
className: clsx(css`
|
|
120
|
+
position: absolute;
|
|
121
|
+
width: var(--width);
|
|
122
|
+
height: var(--height);
|
|
123
|
+
transition: var(--transition);
|
|
124
|
+
left: 0;
|
|
125
|
+
top: 0;
|
|
126
|
+
transform: translate(var(--left), var(--top));
|
|
127
127
|
`, wrapperClassName),
|
|
128
|
-
style:
|
|
129
|
-
width:
|
|
130
|
-
height:
|
|
128
|
+
style: transformCSSVariable({
|
|
129
|
+
width: px(itemWidth),
|
|
130
|
+
height: px(itemHeight),
|
|
131
131
|
transition: 0 === transitionDuration ? "none" : `all ${transitionDuration || 400}ms`,
|
|
132
|
-
left:
|
|
133
|
-
top:
|
|
132
|
+
left: px(getPosition(index).left),
|
|
133
|
+
top: px(getPosition(index).top)
|
|
134
134
|
}, wrapperStyle),
|
|
135
|
-
children: /*#__PURE__*/
|
|
136
|
-
className:
|
|
137
|
-
width: 100%;
|
|
138
|
-
height: 100%;
|
|
139
|
-
display: var(--display);
|
|
135
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
136
|
+
className: clsx(css`
|
|
137
|
+
width: 100%;
|
|
138
|
+
height: 100%;
|
|
139
|
+
display: var(--display);
|
|
140
140
|
`, containerClassName),
|
|
141
|
-
style:
|
|
141
|
+
style: transformCSSVariable({
|
|
142
142
|
display: getHidden(index) ? "none" : "block"
|
|
143
143
|
}, containerStyle),
|
|
144
144
|
children: render(item, index, arr)
|
|
@@ -148,18 +148,18 @@ function ManualFlow(props) {
|
|
|
148
148
|
}
|
|
149
149
|
function Flow(props) {
|
|
150
150
|
const { itemWidth, itemHeight, columnGap, rowGap, gap, maxRows, data, render, keyExactor, wrapperClassName, wrapperStyle, containerClassName, containerStyle, throttle, transitionDuration, onSizeChange, element, ...rest } = props;
|
|
151
|
-
const ele =
|
|
152
|
-
const size =
|
|
153
|
-
const width =
|
|
151
|
+
const ele = useRef(null);
|
|
152
|
+
const size = useSize(ele);
|
|
153
|
+
const width = useRef(size?.width || 0);
|
|
154
154
|
if (size && 0 !== size.width) width.current = size.width;
|
|
155
|
-
|
|
155
|
+
useImperativeHandle(element, ()=>ele.current, [
|
|
156
156
|
ele.current
|
|
157
157
|
]);
|
|
158
|
-
if (0 === width.current) return /*#__PURE__*/
|
|
158
|
+
if (0 === width.current) return /*#__PURE__*/ jsx("div", {
|
|
159
159
|
ref: ele,
|
|
160
160
|
...rest
|
|
161
161
|
});
|
|
162
|
-
return /*#__PURE__*/
|
|
162
|
+
return /*#__PURE__*/ jsx(ManualFlow, {
|
|
163
163
|
element: ele,
|
|
164
164
|
...props,
|
|
165
165
|
width: width.current
|
|
@@ -25,9 +25,9 @@ var __webpack_require__ = {};
|
|
|
25
25
|
var __webpack_exports__ = {};
|
|
26
26
|
__webpack_require__.r(__webpack_exports__);
|
|
27
27
|
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
-
FormLabelConfigContext: ()=>FormLabelConfigContext,
|
|
29
28
|
FormLabel: ()=>FormLabel,
|
|
30
|
-
FormLabelConfigProvider: ()=>FormLabelConfigProvider
|
|
29
|
+
FormLabelConfigProvider: ()=>FormLabelConfigProvider,
|
|
30
|
+
FormLabelConfigContext: ()=>FormLabelConfigContext
|
|
31
31
|
});
|
|
32
32
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
33
33
|
const external_react_namespaceObject = require("react");
|
|
@@ -50,7 +50,7 @@ const FormLabel = (props)=>{
|
|
|
50
50
|
color: "transparent",
|
|
51
51
|
userSelect: "none"
|
|
52
52
|
},
|
|
53
|
-
children: "
|
|
53
|
+
children: "\u2002"
|
|
54
54
|
}),
|
|
55
55
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
56
56
|
style: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const FormLabelConfigContext = /*#__PURE__*/
|
|
5
|
-
const FormLabelConfigProvider = ({ width, before, children })=>/*#__PURE__*/
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment, createContext, useContext } from "react";
|
|
4
|
+
const FormLabelConfigContext = /*#__PURE__*/ createContext({});
|
|
5
|
+
const FormLabelConfigProvider = ({ width, before, children })=>/*#__PURE__*/ jsx(FormLabelConfigContext.Provider, {
|
|
6
6
|
value: {
|
|
7
7
|
width,
|
|
8
8
|
before
|
|
@@ -10,19 +10,19 @@ const FormLabelConfigProvider = ({ width, before, children })=>/*#__PURE__*/ (0,
|
|
|
10
10
|
children: children
|
|
11
11
|
});
|
|
12
12
|
const FormLabel = (props)=>{
|
|
13
|
-
const { width: _width, before: _before } =
|
|
13
|
+
const { width: _width, before: _before } = useContext(FormLabelConfigContext);
|
|
14
14
|
const { style, width = _width, before = _before, ...rest } = props;
|
|
15
|
-
return /*#__PURE__*/
|
|
15
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
16
16
|
children: [
|
|
17
|
-
!!before && /*#__PURE__*/
|
|
17
|
+
!!before && /*#__PURE__*/ jsx("div", {
|
|
18
18
|
style: {
|
|
19
19
|
width: 11,
|
|
20
20
|
color: "transparent",
|
|
21
21
|
userSelect: "none"
|
|
22
22
|
},
|
|
23
|
-
children: "
|
|
23
|
+
children: "\u2002"
|
|
24
24
|
}),
|
|
25
|
-
/*#__PURE__*/
|
|
25
|
+
/*#__PURE__*/ jsx("div", {
|
|
26
26
|
style: {
|
|
27
27
|
width,
|
|
28
28
|
textAlign: "justify",
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const HlsPlayer = /*#__PURE__*/
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import hls_0 from "hls.js";
|
|
4
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
|
|
5
|
+
const HlsPlayer = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
6
6
|
const { src, ...rest } = props;
|
|
7
|
-
const video =
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const video = useRef(null);
|
|
8
|
+
useImperativeHandle(ref, ()=>video.current, []);
|
|
9
|
+
useEffect(()=>{
|
|
10
10
|
const { current: player } = video;
|
|
11
11
|
if (!player || !src) return;
|
|
12
12
|
if (player.canPlayType("application/vnd.apple.mpegurl")) {
|
|
13
13
|
player.src = src;
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
if (
|
|
17
|
-
const hls = new
|
|
16
|
+
if (hls_0.isSupported()) {
|
|
17
|
+
const hls = new hls_0();
|
|
18
18
|
hls.loadSource(src);
|
|
19
19
|
hls.attachMedia(player);
|
|
20
20
|
return ()=>{
|
|
@@ -24,7 +24,7 @@ const HlsPlayer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef
|
|
|
24
24
|
}, [
|
|
25
25
|
src
|
|
26
26
|
]);
|
|
27
|
-
return /*#__PURE__*/
|
|
27
|
+
return /*#__PURE__*/ jsx("video", {
|
|
28
28
|
ref: video,
|
|
29
29
|
...rest
|
|
30
30
|
});
|
|
@@ -24,11 +24,11 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
IconFileTypeText: ()=>IconFileTypeText,
|
|
28
|
-
IconFileTypeBase: ()=>IconFileTypeBase,
|
|
29
|
-
IconFileTypePage: ()=>IconFileTypePage,
|
|
30
27
|
IconFileType: ()=>IconFileType,
|
|
31
|
-
IconFileTypeDogEar: ()=>IconFileTypeDogEar
|
|
28
|
+
IconFileTypeDogEar: ()=>IconFileTypeDogEar,
|
|
29
|
+
IconFileTypeBase: ()=>IconFileTypeBase,
|
|
30
|
+
IconFileTypeText: ()=>IconFileTypeText,
|
|
31
|
+
IconFileTypePage: ()=>IconFileTypePage
|
|
32
32
|
});
|
|
33
33
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
34
34
|
const GOLD = (Math.sqrt(5) - 1) / 2;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
const GOLD = (Math.sqrt(5) - 1) / 2;
|
|
3
3
|
const GOLD_T = Math.sqrt(1 - GOLD * GOLD);
|
|
4
4
|
const HANDLE_LENGTH = (1 - GOLD) * GOLD_T;
|
|
5
5
|
const FileTypeSize = 512;
|
|
6
|
-
const IconFileTypeBase = (props)=>/*#__PURE__*/
|
|
6
|
+
const IconFileTypeBase = (props)=>/*#__PURE__*/ jsx("svg", {
|
|
7
7
|
viewBox: `${-(FileTypeSize / 2)} ${-(FileTypeSize / 2)} ${FileTypeSize} ${FileTypeSize}`,
|
|
8
8
|
...props
|
|
9
9
|
});
|
|
10
10
|
const IconFileTypePage = ({ pageColor = "#f31260", pageWidth = 0.75 * FileTypeSize, pageBessel = 0.75 * FileTypeSize * GOLD, ...rest })=>{
|
|
11
11
|
const radius = pageBessel * (1 - GOLD);
|
|
12
12
|
const offset = pageBessel * HANDLE_LENGTH;
|
|
13
|
-
return /*#__PURE__*/
|
|
13
|
+
return /*#__PURE__*/ jsx("path", {
|
|
14
14
|
d: `M ${-(pageWidth / 2 - radius)} ${-(FileTypeSize / 2)}
|
|
15
15
|
L ${pageWidth * GOLD - pageWidth / 2} ${-(FileTypeSize / 2)}
|
|
16
16
|
L ${pageWidth / 2} ${-(FileTypeSize / 2 - pageWidth * (1 - GOLD))}
|
|
@@ -26,14 +26,14 @@ Z
|
|
|
26
26
|
...rest
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
|
-
const IconFileTypeDogEar = ({ pageWidth, dogEarColor = "rgba(0, 0, 0, 0.25)", dogEarSize = pageWidth * (1 - GOLD), ...rest })=>/*#__PURE__*/
|
|
29
|
+
const IconFileTypeDogEar = ({ pageWidth, dogEarColor = "rgba(0, 0, 0, 0.25)", dogEarSize = pageWidth * (1 - GOLD), ...rest })=>/*#__PURE__*/ jsx("path", {
|
|
30
30
|
d: `M ${pageWidth / 2 - dogEarSize} ${-(FileTypeSize / 2)}
|
|
31
31
|
L ${pageWidth / 2} ${-(FileTypeSize / 2 - dogEarSize)}
|
|
32
32
|
L ${pageWidth / 2 - dogEarSize} ${-(FileTypeSize / 2 - dogEarSize)}`,
|
|
33
33
|
fill: dogEarColor,
|
|
34
34
|
...rest
|
|
35
35
|
});
|
|
36
|
-
const IconFileTypeText = ({ textColor = "#ffffff", textFontSize = 0.25 * FileTypeSize, textFontWeight = "bold", textFontFamily, textX = 0, textY = 0.25 * FileTypeSize, ...rest })=>/*#__PURE__*/
|
|
36
|
+
const IconFileTypeText = ({ textColor = "#ffffff", textFontSize = 0.25 * FileTypeSize, textFontWeight = "bold", textFontFamily, textX = 0, textY = 0.25 * FileTypeSize, ...rest })=>/*#__PURE__*/ jsx("text", {
|
|
37
37
|
textAnchor: "middle",
|
|
38
38
|
fill: textColor,
|
|
39
39
|
x: textX,
|
|
@@ -43,20 +43,20 @@ const IconFileTypeText = ({ textColor = "#ffffff", textFontSize = 0.25 * FileTyp
|
|
|
43
43
|
fontFamily: textFontFamily,
|
|
44
44
|
...rest
|
|
45
45
|
});
|
|
46
|
-
const IconFileType = ({ pageColor, pageWidth = 0.75 * FileTypeSize, pageBessel, dogEarColor, dogEarSize, textColor, textFontSize, textFontWeight, textFontFamily, textX, textY, children, ...rest })=>/*#__PURE__*/
|
|
46
|
+
const IconFileType = ({ pageColor, pageWidth = 0.75 * FileTypeSize, pageBessel, dogEarColor, dogEarSize, textColor, textFontSize, textFontWeight, textFontFamily, textX, textY, children, ...rest })=>/*#__PURE__*/ jsxs(IconFileTypeBase, {
|
|
47
47
|
...rest,
|
|
48
48
|
children: [
|
|
49
|
-
/*#__PURE__*/
|
|
49
|
+
/*#__PURE__*/ jsx(IconFileTypePage, {
|
|
50
50
|
pageColor: pageColor,
|
|
51
51
|
pageWidth: pageWidth,
|
|
52
52
|
pageBessel: pageBessel
|
|
53
53
|
}),
|
|
54
|
-
/*#__PURE__*/
|
|
54
|
+
/*#__PURE__*/ jsx(IconFileTypeDogEar, {
|
|
55
55
|
pageWidth: pageWidth,
|
|
56
56
|
dogEarColor: dogEarColor,
|
|
57
57
|
dogEarSize: dogEarSize
|
|
58
58
|
}),
|
|
59
|
-
/*#__PURE__*/
|
|
59
|
+
/*#__PURE__*/ jsx(IconFileTypeText, {
|
|
60
60
|
textColor: textColor,
|
|
61
61
|
textFontSize: textFontSize,
|
|
62
62
|
textFontWeight: textFontWeight,
|
|
@@ -85,9 +85,9 @@ const InfiniteScroll = /*#__PURE__*/ (0, external_react_namespaceObject.forwardR
|
|
|
85
85
|
]);
|
|
86
86
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
87
87
|
ref: wrapper,
|
|
88
|
-
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
89
|
-
position: relative;
|
|
90
|
-
${"vertical" === direction ? "overflow-y: hidden;" : "overflow-x: hidden;"}
|
|
88
|
+
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
89
|
+
position: relative;
|
|
90
|
+
${"vertical" === direction ? "overflow-y: hidden;" : "overflow-x: hidden;"}
|
|
91
91
|
`, className),
|
|
92
92
|
onMouseEnter: enter,
|
|
93
93
|
onMouseLeave: leave,
|
|
@@ -102,22 +102,22 @@ const InfiniteScroll = /*#__PURE__*/ (0, external_react_namespaceObject.forwardR
|
|
|
102
102
|
children: [
|
|
103
103
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
104
104
|
ref: container,
|
|
105
|
-
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
106
|
-
position: absolute;
|
|
107
|
-
left: 0;
|
|
108
|
-
top: 0;
|
|
109
|
-
${"vertical" === direction ? "width: 100%;" : "height: 100%;"}
|
|
105
|
+
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
106
|
+
position: absolute;
|
|
107
|
+
left: 0;
|
|
108
|
+
top: 0;
|
|
109
|
+
${"vertical" === direction ? "width: 100%;" : "height: 100%;"}
|
|
110
110
|
`, containerClassName),
|
|
111
111
|
style: containerStyle,
|
|
112
112
|
children: children
|
|
113
113
|
}),
|
|
114
114
|
overflow && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
115
115
|
ref: container,
|
|
116
|
-
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
117
|
-
position: absolute;
|
|
118
|
-
right: 0;
|
|
119
|
-
bottom: 0;
|
|
120
|
-
${"vertical" === direction ? "width: 100%;" : "height: 100%;"}
|
|
116
|
+
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
117
|
+
position: absolute;
|
|
118
|
+
right: 0;
|
|
119
|
+
bottom: 0;
|
|
120
|
+
${"vertical" === direction ? "width: 100%;" : "height: 100%;"}
|
|
121
121
|
`, containerClassName),
|
|
122
122
|
style: containerStyle,
|
|
123
123
|
children: children
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const InfiniteScroll = /*#__PURE__*/
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { css } from "@emotion/css";
|
|
4
|
+
import { clsx } from "deepsea-tools";
|
|
5
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
|
|
6
|
+
import { useSize } from "soda-hooks";
|
|
7
|
+
const InfiniteScroll = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
8
8
|
const { className, direction = "vertical", children, containerClassName, containerStyle, gap = 0, duration, withGap, withEqual, pauseOnHover, onMouseEnter, onMouseLeave, ...rest } = props;
|
|
9
|
-
const wrapper =
|
|
10
|
-
const wrapperSize =
|
|
11
|
-
const ele =
|
|
12
|
-
|
|
9
|
+
const wrapper = useRef(null);
|
|
10
|
+
const wrapperSize = useSize(wrapper);
|
|
11
|
+
const ele = useRef(null);
|
|
12
|
+
useImperativeHandle(ref, ()=>wrapper.current, [
|
|
13
13
|
wrapper.current
|
|
14
14
|
]);
|
|
15
|
-
const container =
|
|
16
|
-
const containerSize =
|
|
15
|
+
const container = useRef(null);
|
|
16
|
+
const containerSize = useSize(container);
|
|
17
17
|
function bigger(containerSize, wrapperSize) {
|
|
18
18
|
return withEqual ? containerSize + (withGap ? gap : 0) >= wrapperSize : containerSize + (withGap ? gap : 0) > wrapperSize;
|
|
19
19
|
}
|
|
20
20
|
const overflow = wrapperSize && containerSize ? "vertical" === direction ? bigger(containerSize.height, wrapperSize.height) : bigger(containerSize.width, wrapperSize.width) : false;
|
|
21
|
-
const animation =
|
|
22
|
-
|
|
21
|
+
const animation = useRef(void 0);
|
|
22
|
+
useEffect(()=>{
|
|
23
23
|
if (!wrapperSize || !containerSize || !overflow) return;
|
|
24
24
|
animation.current = ele.current?.animate({
|
|
25
25
|
transform: "vertical" === direction ? [
|
|
@@ -49,22 +49,22 @@ const InfiniteScroll = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwa
|
|
|
49
49
|
if (pauseOnHover) animation.current?.play();
|
|
50
50
|
onMouseLeave?.(e);
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
useEffect(()=>{
|
|
53
53
|
if (!pauseOnHover && animation.current?.playState === "paused") animation.current?.play();
|
|
54
54
|
}, [
|
|
55
55
|
animation.current,
|
|
56
56
|
pauseOnHover
|
|
57
57
|
]);
|
|
58
|
-
return /*#__PURE__*/
|
|
58
|
+
return /*#__PURE__*/ jsx("div", {
|
|
59
59
|
ref: wrapper,
|
|
60
|
-
className:
|
|
61
|
-
position: relative;
|
|
62
|
-
${"vertical" === direction ? "overflow-y: hidden;" : "overflow-x: hidden;"}
|
|
60
|
+
className: clsx(css`
|
|
61
|
+
position: relative;
|
|
62
|
+
${"vertical" === direction ? "overflow-y: hidden;" : "overflow-x: hidden;"}
|
|
63
63
|
`, className),
|
|
64
64
|
onMouseEnter: enter,
|
|
65
65
|
onMouseLeave: leave,
|
|
66
66
|
...rest,
|
|
67
|
-
children: /*#__PURE__*/
|
|
67
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
68
68
|
ref: ele,
|
|
69
69
|
style: {
|
|
70
70
|
position: "absolute",
|
|
@@ -72,24 +72,24 @@ const InfiniteScroll = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwa
|
|
|
72
72
|
height: "horizontal" === direction ? "100%" : containerSize && (overflow ? 2 * containerSize.height + gap : containerSize.width)
|
|
73
73
|
},
|
|
74
74
|
children: [
|
|
75
|
-
/*#__PURE__*/
|
|
75
|
+
/*#__PURE__*/ jsx("div", {
|
|
76
76
|
ref: container,
|
|
77
|
-
className:
|
|
78
|
-
position: absolute;
|
|
79
|
-
left: 0;
|
|
80
|
-
top: 0;
|
|
81
|
-
${"vertical" === direction ? "width: 100%;" : "height: 100%;"}
|
|
77
|
+
className: clsx(css`
|
|
78
|
+
position: absolute;
|
|
79
|
+
left: 0;
|
|
80
|
+
top: 0;
|
|
81
|
+
${"vertical" === direction ? "width: 100%;" : "height: 100%;"}
|
|
82
82
|
`, containerClassName),
|
|
83
83
|
style: containerStyle,
|
|
84
84
|
children: children
|
|
85
85
|
}),
|
|
86
|
-
overflow && /*#__PURE__*/
|
|
86
|
+
overflow && /*#__PURE__*/ jsx("div", {
|
|
87
87
|
ref: container,
|
|
88
|
-
className:
|
|
89
|
-
position: absolute;
|
|
90
|
-
right: 0;
|
|
91
|
-
bottom: 0;
|
|
92
|
-
${"vertical" === direction ? "width: 100%;" : "height: 100%;"}
|
|
88
|
+
className: clsx(css`
|
|
89
|
+
position: absolute;
|
|
90
|
+
right: 0;
|
|
91
|
+
bottom: 0;
|
|
92
|
+
${"vertical" === direction ? "width: 100%;" : "height: 100%;"}
|
|
93
93
|
`, containerClassName),
|
|
94
94
|
style: containerStyle,
|
|
95
95
|
children: children
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
4
|
async function getFileData(file, type) {
|
|
5
5
|
const fileReader = new FileReader();
|
|
6
6
|
switch(type){
|
|
@@ -27,7 +27,7 @@ async function getFileData(file, type) {
|
|
|
27
27
|
}
|
|
28
28
|
function InputFile(props) {
|
|
29
29
|
const { multiple = false, type = "file", onChange: _onChange, disabled: _disabled, clearAfterChange, onValueChange, onFileChange, ...rest } = props;
|
|
30
|
-
const [disabled, setDisabled] =
|
|
30
|
+
const [disabled, setDisabled] = useState(false);
|
|
31
31
|
async function onChange(e) {
|
|
32
32
|
_onChange?.(e);
|
|
33
33
|
const input = e.target;
|
|
@@ -54,7 +54,7 @@ function InputFile(props) {
|
|
|
54
54
|
setDisabled(false);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
return /*#__PURE__*/
|
|
57
|
+
return /*#__PURE__*/ jsx("input", {
|
|
58
58
|
disabled: disabled || _disabled,
|
|
59
59
|
type: "file",
|
|
60
60
|
multiple: multiple,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment, createElement, useImperativeHandle, useRef, useState } from "react";
|
|
4
|
+
import { InputFile, getFileData } from "./InputFile.js";
|
|
5
5
|
function InputFileButton(props) {
|
|
6
6
|
const { as = "button", onClick: _onClick, inputProps = {}, accept, onDrop: _onDrop, onDragOver: _onDragOver, dragFile, disabled: _disabled, type = "file", multiple, onValueChange, onFileChange, clearAfterChange, ...rest } = props;
|
|
7
7
|
const { ref, style, disabled: __disabled, ...restInputProps } = inputProps;
|
|
8
|
-
const [disabled, setDisabled] =
|
|
9
|
-
const input =
|
|
10
|
-
|
|
8
|
+
const [disabled, setDisabled] = useState(false);
|
|
9
|
+
const input = useRef(null);
|
|
10
|
+
useImperativeHandle(ref, ()=>input.current, [
|
|
11
11
|
input.current
|
|
12
12
|
]);
|
|
13
13
|
function onClick(e) {
|
|
@@ -26,7 +26,7 @@ function InputFileButton(props) {
|
|
|
26
26
|
const files2 = Array.from(files);
|
|
27
27
|
const values = [];
|
|
28
28
|
for (const file of files2){
|
|
29
|
-
const value = await
|
|
29
|
+
const value = await getFileData(file, type);
|
|
30
30
|
values.push(value);
|
|
31
31
|
}
|
|
32
32
|
onFileChange?.(files2);
|
|
@@ -34,7 +34,7 @@ function InputFileButton(props) {
|
|
|
34
34
|
} else {
|
|
35
35
|
const file = files[0];
|
|
36
36
|
onFileChange?.(file);
|
|
37
|
-
onValueChange?.(await
|
|
37
|
+
onValueChange?.(await getFileData(file, type));
|
|
38
38
|
}
|
|
39
39
|
} finally{
|
|
40
40
|
setDisabled(false);
|
|
@@ -45,9 +45,9 @@ function InputFileButton(props) {
|
|
|
45
45
|
if (disabled || !dragFile) return;
|
|
46
46
|
e.preventDefault();
|
|
47
47
|
}
|
|
48
|
-
return /*#__PURE__*/
|
|
48
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
49
49
|
children: [
|
|
50
|
-
/*#__PURE__*/
|
|
50
|
+
/*#__PURE__*/ jsx(InputFile, {
|
|
51
51
|
ref: input,
|
|
52
52
|
disabled: disabled || _disabled || __disabled,
|
|
53
53
|
style: {
|
|
@@ -62,7 +62,7 @@ function InputFileButton(props) {
|
|
|
62
62
|
clearAfterChange: clearAfterChange,
|
|
63
63
|
...restInputProps
|
|
64
64
|
}),
|
|
65
|
-
/*#__PURE__*/
|
|
65
|
+
/*#__PURE__*/ createElement(as, {
|
|
66
66
|
disabled: disabled || _disabled,
|
|
67
67
|
onClick,
|
|
68
68
|
onDrop,
|
|
@@ -68,39 +68,39 @@ const LoopSwiper = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)(
|
|
|
68
68
|
}, []);
|
|
69
69
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
70
70
|
ref: wrapper,
|
|
71
|
-
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
72
|
-
@keyframes deepsea-horizontal-loop-swipe {
|
|
73
|
-
from {
|
|
74
|
-
transform: translateX(0);
|
|
75
|
-
}
|
|
76
|
-
to {
|
|
77
|
-
transform: translateX(-100%);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
@keyframes deepsea-reverse-horizontal-loop-swipe {
|
|
81
|
-
from {
|
|
82
|
-
transform: translateX(0);
|
|
83
|
-
}
|
|
84
|
-
to {
|
|
85
|
-
transform: translateX(100%);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
@keyframes deepsea-vertical-loop-swipe {
|
|
89
|
-
from {
|
|
90
|
-
transform: translateY(0);
|
|
91
|
-
}
|
|
92
|
-
to {
|
|
93
|
-
transform: translateY(-100%);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
@keyframes deepsea-reverse-vertical-loop-swipe {
|
|
97
|
-
from {
|
|
98
|
-
transform: translateY(0);
|
|
99
|
-
}
|
|
100
|
-
to {
|
|
101
|
-
transform: translateY(100%);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
71
|
+
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
72
|
+
@keyframes deepsea-horizontal-loop-swipe {
|
|
73
|
+
from {
|
|
74
|
+
transform: translateX(0);
|
|
75
|
+
}
|
|
76
|
+
to {
|
|
77
|
+
transform: translateX(-100%);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
@keyframes deepsea-reverse-horizontal-loop-swipe {
|
|
81
|
+
from {
|
|
82
|
+
transform: translateX(0);
|
|
83
|
+
}
|
|
84
|
+
to {
|
|
85
|
+
transform: translateX(100%);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
@keyframes deepsea-vertical-loop-swipe {
|
|
89
|
+
from {
|
|
90
|
+
transform: translateY(0);
|
|
91
|
+
}
|
|
92
|
+
to {
|
|
93
|
+
transform: translateY(-100%);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
@keyframes deepsea-reverse-vertical-loop-swipe {
|
|
97
|
+
from {
|
|
98
|
+
transform: translateY(0);
|
|
99
|
+
}
|
|
100
|
+
to {
|
|
101
|
+
transform: translateY(100%);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
104
|
`, className),
|
|
105
105
|
style: {
|
|
106
106
|
display: "flex",
|