deepsea-components 5.15.23 → 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/dist/components/AutoFit.js +24 -24
- package/dist/components/AutoScroll.js +24 -24
- package/dist/components/AutoSizeTextarea.js +14 -14
- 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 +3 -3
- package/dist/components/Flow.js +31 -31
- package/dist/components/FormLabel.cjs +2 -2
- package/dist/components/FormLabel.js +8 -8
- 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.js +22 -22
- package/dist/components/InputFile.js +4 -4
- package/dist/components/InputFileButton.js +11 -11
- package/dist/components/LoopSwiper.js +15 -15
- 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 +2 -2
- package/dist/components/Scroll.js +20 -21
- package/dist/components/ScrollMask.js +13 -13
- package/dist/components/SectionRing.js +6 -6
- package/dist/components/Skeleton.js +8 -8
- package/dist/components/Title.js +12 -12
- package/dist/components/TransitionBox.js +10 -10
- package/dist/components/TransitionNum.js +11 -11
- package/dist/components/Trapezium.js +11 -11
- 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 +5 -5
|
@@ -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,
|
|
@@ -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:
|
|
60
|
+
className: clsx(css`
|
|
61
61
|
position: relative;
|
|
62
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,9 +72,9 @@ 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:
|
|
77
|
+
className: clsx(css`
|
|
78
78
|
position: absolute;
|
|
79
79
|
left: 0;
|
|
80
80
|
top: 0;
|
|
@@ -83,9 +83,9 @@ const InfiniteScroll = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwa
|
|
|
83
83
|
style: containerStyle,
|
|
84
84
|
children: children
|
|
85
85
|
}),
|
|
86
|
-
overflow && /*#__PURE__*/
|
|
86
|
+
overflow && /*#__PURE__*/ jsx("div", {
|
|
87
87
|
ref: container,
|
|
88
|
-
className:
|
|
88
|
+
className: clsx(css`
|
|
89
89
|
position: absolute;
|
|
90
90
|
right: 0;
|
|
91
91
|
bottom: 0;
|
|
@@ -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,
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const LoopSwiper = /*#__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, useState } from "react";
|
|
6
|
+
const LoopSwiper = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
7
7
|
const { className, style, children, direction, period, reverse, gap, ...rest } = props;
|
|
8
|
-
const wrapper =
|
|
9
|
-
const container =
|
|
10
|
-
const [swiper, setSwiper] =
|
|
11
|
-
const directionRef =
|
|
8
|
+
const wrapper = useRef(null);
|
|
9
|
+
const container = useRef(null);
|
|
10
|
+
const [swiper, setSwiper] = useState(false);
|
|
11
|
+
const directionRef = useRef(direction);
|
|
12
12
|
directionRef.current = direction;
|
|
13
13
|
const flexDirection = "vertical" === direction ? reverse ? "column-reverse" : "column" : reverse ? "row-reverse" : "row";
|
|
14
14
|
const animationName = swiper ? "vertical" === direction ? reverse ? "deepsea-reverse-vertical-loop-swipe" : "deepsea-vertical-loop-swipe" : reverse ? "deepsea-reverse-horizontal-loop-swipe" : "deepsea-horizontal-loop-swipe" : "none";
|
|
15
15
|
const animationDuration = `${period}ms`;
|
|
16
16
|
const animationTimingFunction = "linear";
|
|
17
17
|
const animationIterationCount = "infinite";
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
useImperativeHandle(ref, ()=>wrapper.current, []);
|
|
19
|
+
useEffect(()=>{
|
|
20
20
|
const wrapperEle = wrapper.current;
|
|
21
21
|
const containerEle = container.current;
|
|
22
22
|
let wrapperWidth = 0;
|
|
@@ -38,9 +38,9 @@ const LoopSwiper = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRe
|
|
|
38
38
|
observer.observe(wrapperEle);
|
|
39
39
|
observer.observe(containerEle);
|
|
40
40
|
}, []);
|
|
41
|
-
return /*#__PURE__*/
|
|
41
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
42
42
|
ref: wrapper,
|
|
43
|
-
className:
|
|
43
|
+
className: clsx(css`
|
|
44
44
|
@keyframes deepsea-horizontal-loop-swipe {
|
|
45
45
|
from {
|
|
46
46
|
transform: translateX(0);
|
|
@@ -82,7 +82,7 @@ const LoopSwiper = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRe
|
|
|
82
82
|
},
|
|
83
83
|
...rest,
|
|
84
84
|
children: [
|
|
85
|
-
/*#__PURE__*/
|
|
85
|
+
/*#__PURE__*/ jsx("div", {
|
|
86
86
|
ref: container,
|
|
87
87
|
style: {
|
|
88
88
|
display: "flex",
|
|
@@ -95,7 +95,7 @@ const LoopSwiper = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRe
|
|
|
95
95
|
},
|
|
96
96
|
children: children
|
|
97
97
|
}),
|
|
98
|
-
/*#__PURE__*/
|
|
98
|
+
/*#__PURE__*/ jsx("div", {
|
|
99
99
|
style: {
|
|
100
100
|
display: swiper ? "flex" : "none",
|
|
101
101
|
flexDirection,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
const ReadExcel =
|
|
2
|
+
import { ReadSheet } from "./ReadSheet.js";
|
|
3
|
+
const ReadExcel = ReadSheet;
|
|
4
4
|
export { ReadExcel };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { readSheet } from "deepsea-tools";
|
|
4
|
+
import { InputFile } from "./InputFile.js";
|
|
5
5
|
const ReadSheet = (props)=>{
|
|
6
6
|
const { onValueChange, ...rest } = props;
|
|
7
|
-
return /*#__PURE__*/
|
|
7
|
+
return /*#__PURE__*/ jsx(InputFile, {
|
|
8
8
|
accept: ".xlsx",
|
|
9
9
|
type: "arrayBuffer",
|
|
10
|
-
onValueChange: (data)=>onValueChange?.(
|
|
10
|
+
onValueChange: (data)=>onValueChange?.(readSheet(data)),
|
|
11
11
|
...rest
|
|
12
12
|
});
|
|
13
13
|
};
|
package/dist/components/Ring.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const Ring = /*#__PURE__*/
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
const Ring = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
5
5
|
const { outerWidth, innerWidth, style, ...rest } = props;
|
|
6
6
|
const outerRadius = outerWidth / 2;
|
|
7
7
|
const innerRadius = innerWidth / 2;
|
|
8
|
-
return /*#__PURE__*/
|
|
8
|
+
return /*#__PURE__*/ jsx("div", {
|
|
9
9
|
ref: ref,
|
|
10
10
|
style: {
|
|
11
11
|
...style,
|
|
@@ -80,9 +80,9 @@ var __webpack_exports__ = {};
|
|
|
80
80
|
var smooth_scrollbar_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("smooth-scrollbar/interfaces");
|
|
81
81
|
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
82
82
|
for(var __WEBPACK_IMPORT_KEY__ in smooth_scrollbar_interfaces__WEBPACK_IMPORTED_MODULE_6__)if ([
|
|
83
|
-
"Scroll",
|
|
84
83
|
"default",
|
|
85
|
-
"Scrollbar"
|
|
84
|
+
"Scrollbar",
|
|
85
|
+
"Scroll"
|
|
86
86
|
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
87
87
|
return smooth_scrollbar_interfaces__WEBPACK_IMPORTED_MODULE_6__[key];
|
|
88
88
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
@@ -1,32 +1,32 @@
|
|
|
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 { forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useRef } from "react";
|
|
6
|
+
import smooth_scrollbar from "smooth-scrollbar";
|
|
7
|
+
import { px, transformCSSVariable } from "../utils/index.js";
|
|
8
8
|
export * from "smooth-scrollbar/interfaces";
|
|
9
|
-
const Scroll = /*#__PURE__*/
|
|
9
|
+
const Scroll = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
10
10
|
const { children, options, className, style, scrollbar, onScrollbar, ...rest } = props;
|
|
11
11
|
const { thumbWidth, thumbRadius, thumbColor, trackColor, ...scrollbarOptions } = options || {};
|
|
12
|
-
const ele =
|
|
13
|
-
const bar =
|
|
14
|
-
|
|
15
|
-
bar.current =
|
|
12
|
+
const ele = useRef(null);
|
|
13
|
+
const bar = useRef(null);
|
|
14
|
+
useLayoutEffect(()=>{
|
|
15
|
+
bar.current = smooth_scrollbar.init(ele.current, scrollbarOptions);
|
|
16
16
|
return ()=>bar.current?.destroy();
|
|
17
17
|
}, []);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
useImperativeHandle(ref, ()=>ele.current, []);
|
|
19
|
+
useImperativeHandle(scrollbar, ()=>bar.current, []);
|
|
20
|
+
useEffect(()=>{
|
|
21
21
|
if (!onScrollbar) return;
|
|
22
22
|
bar.current?.addListener(onScrollbar);
|
|
23
23
|
return ()=>bar.current?.removeListener(onScrollbar);
|
|
24
24
|
}, [
|
|
25
25
|
onScrollbar
|
|
26
26
|
]);
|
|
27
|
-
return /*#__PURE__*/
|
|
27
|
+
return /*#__PURE__*/ jsx("div", {
|
|
28
28
|
ref: ele,
|
|
29
|
-
className:
|
|
29
|
+
className: clsx(css`
|
|
30
30
|
.scrollbar-track.scrollbar-track-x {
|
|
31
31
|
${void 0 !== thumbWidth ? "height: var(--thumb-width);" : ""} ${void 0 !== trackColor ? "background-color: var(--track-color);" : ""}
|
|
32
32
|
}
|
|
@@ -40,9 +40,9 @@ const Scroll = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef)((
|
|
|
40
40
|
${void 0 !== thumbWidth ? "width: var(--thumb-width);" : ""} ${void 0 !== thumbRadius ? "border-radius: var(--thumb-radius);" : ""} ${void 0 !== thumbColor ? "background-color: var(--thumb-color);" : ""}
|
|
41
41
|
}
|
|
42
42
|
`, className),
|
|
43
|
-
style:
|
|
44
|
-
thumbWidth:
|
|
45
|
-
thumbRadius:
|
|
43
|
+
style: transformCSSVariable({
|
|
44
|
+
thumbWidth: px(thumbWidth),
|
|
45
|
+
thumbRadius: px(thumbRadius),
|
|
46
46
|
thumbColor,
|
|
47
47
|
trackColor
|
|
48
48
|
}, style),
|
|
@@ -50,5 +50,4 @@ const Scroll = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef)((
|
|
|
50
50
|
children: children
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
|
-
|
|
54
|
-
export { Scroll, __webpack_exports__Scrollbar as Scrollbar };
|
|
53
|
+
export { Scroll, smooth_scrollbar as Scrollbar };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clsx, isNonNullable } from "deepsea-tools";
|
|
3
|
+
import { useRef } from "react";
|
|
4
|
+
import { useSize } from "soda-hooks";
|
|
5
|
+
import ScrollMask_module from "./ScrollMask.module.js";
|
|
6
6
|
const ScrollMask = ({ className, style, position = "top", size = 8, from = "rgba(0, 0, 0, 0.1)", to = "rgba(0, 0, 0, 0)", contentClassName, contentStyle, showRadian = false, ...rest })=>{
|
|
7
|
-
const ref =
|
|
8
|
-
const contentSize =
|
|
9
|
-
const radius =
|
|
10
|
-
const clipPath = showRadian &&
|
|
11
|
-
return /*#__PURE__*/
|
|
12
|
-
className:
|
|
7
|
+
const ref = useRef(null);
|
|
8
|
+
const contentSize = useSize(ref);
|
|
9
|
+
const radius = isNonNullable(contentSize) ? "top" === position || "bottom" === position ? (contentSize.width ** 2 / 4 + contentSize.height ** 2) / (2 * contentSize.height) : (contentSize.height ** 2 / 4 + contentSize.width ** 2) / (2 * contentSize.width) : void 0;
|
|
10
|
+
const clipPath = showRadian && isNonNullable(radius) ? "top" === position ? `circle(${radius}px at 50% -${radius - contentSize.height}px)` : "bottom" === position ? `circle(${radius}px at 50% ${radius}px)` : "left" === position ? `circle(${radius}px at -${radius - contentSize.width}px 50%)` : "right" === position ? `circle(${radius}px at ${radius}px 50%)` : "none" : "none";
|
|
11
|
+
return /*#__PURE__*/ jsx("div", {
|
|
12
|
+
className: clsx(ScrollMask_module["scroll-mask"], ScrollMask_module[`${position}-scroll-mask`], className),
|
|
13
13
|
style: {
|
|
14
14
|
"--scroll-mask-size": `${size}px`,
|
|
15
15
|
"--scroll-mask-color-from": from,
|
|
@@ -18,9 +18,9 @@ const ScrollMask = ({ className, style, position = "top", size = 8, from = "rgba
|
|
|
18
18
|
...style
|
|
19
19
|
},
|
|
20
20
|
...rest,
|
|
21
|
-
children: /*#__PURE__*/
|
|
21
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
22
22
|
ref: ref,
|
|
23
|
-
className:
|
|
23
|
+
className: clsx(ScrollMask_module["scroll-mask-content"], ScrollMask_module[`${position}-scroll-mask-content`], contentClassName),
|
|
24
24
|
style: contentStyle
|
|
25
25
|
})
|
|
26
26
|
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const SectionRing = /*#__PURE__*/
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { drawArc } from "deepsea-tools";
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
const SectionRing = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
6
6
|
const { outerRadius: o, innerRadius: i, count: c, angel: a, style, ...rest } = props;
|
|
7
7
|
const s = 2 * Math.PI / c - a;
|
|
8
8
|
function arc(radius, startAngle, endAngle, options = {}) {
|
|
9
|
-
return
|
|
9
|
+
return drawArc(o, o, radius, startAngle, endAngle, options);
|
|
10
10
|
}
|
|
11
|
-
return /*#__PURE__*/
|
|
11
|
+
return /*#__PURE__*/ jsx("div", {
|
|
12
12
|
ref: ref,
|
|
13
13
|
style: {
|
|
14
14
|
width: 2 * o,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const Skeleton = /*#__PURE__*/
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { css } from "@emotion/css";
|
|
4
|
+
import { clsx } from "deepsea-tools";
|
|
5
|
+
import { forwardRef } from "react";
|
|
6
|
+
const Skeleton = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
7
7
|
const { className, children, loading = null == children, ...rest } = props;
|
|
8
|
-
return /*#__PURE__*/
|
|
8
|
+
return /*#__PURE__*/ jsx("div", {
|
|
9
9
|
ref: ref,
|
|
10
|
-
className:
|
|
10
|
+
className: clsx(css`
|
|
11
11
|
@keyframes shimmer {
|
|
12
12
|
0% {
|
|
13
13
|
background-position: -400px 0px;
|
|
@@ -16,7 +16,7 @@ const Skeleton = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef)
|
|
|
16
16
|
background-position: 400px 0px;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
`, loading &&
|
|
19
|
+
`, loading && css`
|
|
20
20
|
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.067) 8%, rgba(0, 0, 0, 0.133) 18%, rgba(0, 0, 0, 0.067) 33%);
|
|
21
21
|
animation-duration: 1s;
|
|
22
22
|
animation-fill-mode: forwards;
|
package/dist/components/Title.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const [major] =
|
|
8
|
-
const Title = /*#__PURE__*/
|
|
9
|
-
if (major >= 19) return /*#__PURE__*/
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { isBrowser } from "deepsea-tools";
|
|
4
|
+
import { forwardRef, useImperativeHandle, useLayoutEffect, useRef } from "react";
|
|
5
|
+
import { createPortal } from "react-dom";
|
|
6
|
+
import { getReactVersion } from "../utils/getReactVersion.js";
|
|
7
|
+
const [major] = getReactVersion();
|
|
8
|
+
const Title = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
9
|
+
if (major >= 19) return /*#__PURE__*/ jsx("title", {
|
|
10
10
|
ref: ref,
|
|
11
11
|
...props
|
|
12
12
|
});
|
|
13
|
-
const ele =
|
|
14
|
-
|
|
13
|
+
const ele = useRef(null);
|
|
14
|
+
useImperativeHandle(ref, ()=>ele.current, [
|
|
15
15
|
ele.current
|
|
16
16
|
]);
|
|
17
|
-
|
|
17
|
+
useLayoutEffect(()=>{
|
|
18
18
|
const title = document.head.querySelector("title");
|
|
19
19
|
if (title === ele.current) return;
|
|
20
20
|
document.head.insertBefore(ele.current, title);
|
|
21
21
|
}, []);
|
|
22
|
-
return
|
|
22
|
+
return isBrowser && /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx("title", {
|
|
23
23
|
ref: ele,
|
|
24
24
|
...props
|
|
25
25
|
}), document.head);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const TransitionBox = /*#__PURE__*/
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useEffect, useRef, useState } from "react";
|
|
4
|
+
import { useSize } from "soda-hooks";
|
|
5
|
+
const TransitionBox = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
6
6
|
const { style, containerClassName, containerStyle, children, vertical = true, horizontal = true, time = 3000, ...rest } = props;
|
|
7
|
-
const container =
|
|
8
|
-
const size =
|
|
7
|
+
const container = useRef(null);
|
|
8
|
+
const size = useSize(container);
|
|
9
9
|
const width = size?.width ?? 0;
|
|
10
10
|
const height = size?.height ?? 0;
|
|
11
|
-
const [count, setCount] =
|
|
12
|
-
|
|
11
|
+
const [count, setCount] = useState(0);
|
|
12
|
+
useEffect(()=>{
|
|
13
13
|
setCount((count)=>Math.min(count + 1, 3));
|
|
14
14
|
}, [
|
|
15
15
|
width,
|
|
@@ -27,11 +27,11 @@ const TransitionBox = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwar
|
|
|
27
27
|
position: "relative",
|
|
28
28
|
...style
|
|
29
29
|
};
|
|
30
|
-
return /*#__PURE__*/
|
|
30
|
+
return /*#__PURE__*/ jsx("div", {
|
|
31
31
|
ref: ref,
|
|
32
32
|
style: outerStyle,
|
|
33
33
|
...rest,
|
|
34
|
-
children: /*#__PURE__*/
|
|
34
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
35
35
|
className: containerClassName,
|
|
36
36
|
style: {
|
|
37
37
|
position: "absolute",
|