@rxdrag/website-lib-core 0.0.106 → 0.0.108
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/package.json +5 -5
- package/src/react/components/ContactForm/FileUpload2.tsx +3 -10
- package/src/react/components/ContactForm/Input2.tsx +3 -10
- package/src/react/components/ContactForm/Textarea2.tsx +26 -3
- package/src/react/components/ContactForm/hooks/useInlineLabelPadding.ts +25 -2
- package/src/react/components/ReactVideoPlayer.tsx +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxdrag/website-lib-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.108",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.ts"
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"@types/react-dom": "^19.1.0",
|
|
25
25
|
"eslint": "^7.32.0",
|
|
26
26
|
"typescript": "^5",
|
|
27
|
+
"@rxdrag/eslint-config-custom": "0.2.12",
|
|
27
28
|
"@rxdrag/slate-preview": "1.2.63",
|
|
28
|
-
"@rxdrag/tsconfig": "0.2.0"
|
|
29
|
-
"@rxdrag/eslint-config-custom": "0.2.12"
|
|
29
|
+
"@rxdrag/tsconfig": "0.2.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@iconify/utils": "^3.0.2",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"gsap": "^3.12.7",
|
|
35
35
|
"hls.js": "^1.6.13",
|
|
36
36
|
"lodash-es": "^4.17.21",
|
|
37
|
-
"@rxdrag/
|
|
38
|
-
"@rxdrag/
|
|
37
|
+
"@rxdrag/entify-lib": "0.0.23",
|
|
38
|
+
"@rxdrag/rxcms-models": "0.3.96"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"astro": "^4.0.0 || ^5.0.0",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import clsx from "clsx";
|
|
2
|
-
import { forwardRef, useRef, useState
|
|
2
|
+
import { forwardRef, useRef, useState } from "react";
|
|
3
|
+
import { useInlineLabelPadding } from "./hooks/useInlineLabelPadding";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Simple encryption function for generating anti-bot encrypted fields
|
|
@@ -68,17 +69,9 @@ export const FileUpload2 = forwardRef<HTMLInputElement, FileUploadProps>(
|
|
|
68
69
|
const [isUploading, setIsUploading] = useState(false);
|
|
69
70
|
const [uploadError, setUploadError] = useState<string>("");
|
|
70
71
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
71
|
-
const labelRef =
|
|
72
|
-
const [paddingLeft, setPaddingLeft] = useState("3.5rem");
|
|
72
|
+
const { labelRef, paddingLeft } = useInlineLabelPadding(16);
|
|
73
73
|
const abortControllerRef = useRef<AbortController | null>(null);
|
|
74
74
|
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
if (labelRef.current) {
|
|
77
|
-
const width = labelRef.current.getBoundingClientRect().width;
|
|
78
|
-
setPaddingLeft(`${width + 16}px`);
|
|
79
|
-
}
|
|
80
|
-
}, [label]);
|
|
81
|
-
|
|
82
75
|
// Upload single file
|
|
83
76
|
const uploadFile = async (
|
|
84
77
|
file: File,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import clsx from "clsx";
|
|
2
|
-
import { forwardRef
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
3
|
import { InputProps } from "./Input";
|
|
4
|
+
import { useInlineLabelPadding } from "./hooks/useInlineLabelPadding";
|
|
4
5
|
|
|
5
6
|
export const Input2 = forwardRef<HTMLInputElement, InputProps>((props, ref) => {
|
|
6
7
|
const {
|
|
@@ -20,15 +21,7 @@ export const Input2 = forwardRef<HTMLInputElement, InputProps>((props, ref) => {
|
|
|
20
21
|
...rest
|
|
21
22
|
} = props;
|
|
22
23
|
|
|
23
|
-
const labelRef =
|
|
24
|
-
const [paddingLeft, setPaddingLeft] = useState("3.5rem"); // default fallback
|
|
25
|
-
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
if (labelRef.current) {
|
|
28
|
-
const width = labelRef.current.getBoundingClientRect().width;
|
|
29
|
-
setPaddingLeft(`${width + 16}px`); // extra 16px spacing
|
|
30
|
-
}
|
|
31
|
-
}, [label]);
|
|
24
|
+
const { labelRef, paddingLeft } = useInlineLabelPadding(16);
|
|
32
25
|
|
|
33
26
|
return (
|
|
34
27
|
<div className={clsx("relative w-full", className)} {...rest}>
|
|
@@ -22,10 +22,33 @@ export const Textarea2 = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
22
22
|
const labelRef = useRef<HTMLLabelElement>(null);
|
|
23
23
|
|
|
24
24
|
useEffect(() => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const labelEl = labelRef.current;
|
|
26
|
+
if (!labelEl) return;
|
|
27
|
+
|
|
28
|
+
let rafId = 0;
|
|
29
|
+
const measure = () => {
|
|
30
|
+
const height = labelEl.getBoundingClientRect().height;
|
|
31
|
+
setPaddingTop(`${height + 12}px`);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
measure();
|
|
35
|
+
rafId = requestAnimationFrame(measure);
|
|
36
|
+
|
|
37
|
+
if (typeof ResizeObserver === "undefined") {
|
|
38
|
+
return () => {
|
|
39
|
+
cancelAnimationFrame(rafId);
|
|
40
|
+
};
|
|
28
41
|
}
|
|
42
|
+
|
|
43
|
+
const ro = new ResizeObserver(() => {
|
|
44
|
+
measure();
|
|
45
|
+
});
|
|
46
|
+
ro.observe(labelEl);
|
|
47
|
+
|
|
48
|
+
return () => {
|
|
49
|
+
cancelAnimationFrame(rafId);
|
|
50
|
+
ro.disconnect();
|
|
51
|
+
};
|
|
29
52
|
}, [label]);
|
|
30
53
|
|
|
31
54
|
return (
|
|
@@ -10,10 +10,33 @@ export function useInlineLabelPadding(extraSpace: number = 16) {
|
|
|
10
10
|
const [paddingLeft, setPaddingLeft] = useState<string>("3.5rem");
|
|
11
11
|
|
|
12
12
|
useEffect(() => {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const labelEl = labelRef.current;
|
|
14
|
+
if (!labelEl) return;
|
|
15
|
+
|
|
16
|
+
let rafId = 0;
|
|
17
|
+
const measure = () => {
|
|
18
|
+
const width = labelEl.getBoundingClientRect().width;
|
|
15
19
|
setPaddingLeft(`${width + extraSpace}px`);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
measure();
|
|
23
|
+
rafId = requestAnimationFrame(measure);
|
|
24
|
+
|
|
25
|
+
if (typeof ResizeObserver === "undefined") {
|
|
26
|
+
return () => {
|
|
27
|
+
cancelAnimationFrame(rafId);
|
|
28
|
+
};
|
|
16
29
|
}
|
|
30
|
+
|
|
31
|
+
const ro = new ResizeObserver(() => {
|
|
32
|
+
measure();
|
|
33
|
+
});
|
|
34
|
+
ro.observe(labelEl);
|
|
35
|
+
|
|
36
|
+
return () => {
|
|
37
|
+
cancelAnimationFrame(rafId);
|
|
38
|
+
ro.disconnect();
|
|
39
|
+
};
|
|
17
40
|
}, [extraSpace]);
|
|
18
41
|
|
|
19
42
|
return { labelRef, paddingLeft } as const;
|
|
@@ -186,13 +186,13 @@ export const ReactVideoPlayer = forwardRef<
|
|
|
186
186
|
>
|
|
187
187
|
<div
|
|
188
188
|
className={clsx(
|
|
189
|
-
"flex items-center justify-center w-
|
|
189
|
+
"flex items-center justify-center w-14 h-14 lg:w-[130px] lg:h-[130px] bg-white/15 rounded-full backdrop-blur-sm hover:shadow-md transition-all duration-300 hover:scale-110 group",
|
|
190
190
|
classNames?.playButtonOuter
|
|
191
191
|
)}
|
|
192
192
|
>
|
|
193
193
|
<div
|
|
194
194
|
className={clsx(
|
|
195
|
-
"w-
|
|
195
|
+
"w-10 h-10 lg:w-[90px] lg:h-[90px] bg-white relative overflow-hidden rounded-full",
|
|
196
196
|
classNames?.playButtonInner
|
|
197
197
|
)}
|
|
198
198
|
>
|
|
@@ -200,7 +200,7 @@ export const ReactVideoPlayer = forwardRef<
|
|
|
200
200
|
<div className="w-full h-full flex items-center justify-center">
|
|
201
201
|
<svg
|
|
202
202
|
className={clsx(
|
|
203
|
-
"size-
|
|
203
|
+
"size-4 lg:size-8 text-gray-700",
|
|
204
204
|
classNames?.playIcon
|
|
205
205
|
)}
|
|
206
206
|
viewBox="0 0 30 32"
|