@unif/react-native-design 0.30.1 → 0.31.1

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 (41) hide show
  1. package/lib/module/components/ui/BorderBeam/BorderBeam.js +100 -0
  2. package/lib/module/components/ui/BorderBeam/BorderBeam.js.map +1 -0
  3. package/lib/module/components/ui/BorderBeam/BorderBeam.web.js +100 -0
  4. package/lib/module/components/ui/BorderBeam/BorderBeam.web.js.map +1 -0
  5. package/lib/module/components/ui/BorderBeam/index.js +4 -0
  6. package/lib/module/components/ui/BorderBeam/index.js.map +1 -0
  7. package/lib/module/components/ui/BorderBeam/normalizeBorderBeam.js +23 -0
  8. package/lib/module/components/ui/BorderBeam/normalizeBorderBeam.js.map +1 -0
  9. package/lib/module/components/ui/BorderBeam/shared.js +24 -0
  10. package/lib/module/components/ui/BorderBeam/shared.js.map +1 -0
  11. package/lib/module/components/ui/BorderBeam/styles.js +18 -0
  12. package/lib/module/components/ui/BorderBeam/styles.js.map +1 -0
  13. package/lib/module/components/ui/BorderBeam/types.js +4 -0
  14. package/lib/module/components/ui/BorderBeam/types.js.map +1 -0
  15. package/lib/module/components/ui/index.js +1 -0
  16. package/lib/module/components/ui/index.js.map +1 -1
  17. package/lib/typescript/src/components/ui/BorderBeam/BorderBeam.d.ts +10 -0
  18. package/lib/typescript/src/components/ui/BorderBeam/BorderBeam.d.ts.map +1 -0
  19. package/lib/typescript/src/components/ui/BorderBeam/BorderBeam.web.d.ts +5 -0
  20. package/lib/typescript/src/components/ui/BorderBeam/BorderBeam.web.d.ts.map +1 -0
  21. package/lib/typescript/src/components/ui/BorderBeam/index.d.ts +3 -0
  22. package/lib/typescript/src/components/ui/BorderBeam/index.d.ts.map +1 -0
  23. package/lib/typescript/src/components/ui/BorderBeam/normalizeBorderBeam.d.ts +16 -0
  24. package/lib/typescript/src/components/ui/BorderBeam/normalizeBorderBeam.d.ts.map +1 -0
  25. package/lib/typescript/src/components/ui/BorderBeam/shared.d.ts +18 -0
  26. package/lib/typescript/src/components/ui/BorderBeam/shared.d.ts.map +1 -0
  27. package/lib/typescript/src/components/ui/BorderBeam/styles.d.ts +15 -0
  28. package/lib/typescript/src/components/ui/BorderBeam/styles.d.ts.map +1 -0
  29. package/lib/typescript/src/components/ui/BorderBeam/types.d.ts +23 -0
  30. package/lib/typescript/src/components/ui/BorderBeam/types.d.ts.map +1 -0
  31. package/lib/typescript/src/components/ui/index.d.ts +2 -0
  32. package/lib/typescript/src/components/ui/index.d.ts.map +1 -1
  33. package/package.json +1 -1
  34. package/src/components/ui/BorderBeam/BorderBeam.tsx +121 -0
  35. package/src/components/ui/BorderBeam/BorderBeam.web.tsx +112 -0
  36. package/src/components/ui/BorderBeam/index.ts +2 -0
  37. package/src/components/ui/BorderBeam/normalizeBorderBeam.ts +58 -0
  38. package/src/components/ui/BorderBeam/shared.ts +26 -0
  39. package/src/components/ui/BorderBeam/styles.ts +16 -0
  40. package/src/components/ui/BorderBeam/types.ts +23 -0
  41. package/src/components/ui/index.ts +2 -0
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+
3
+ import React, { useEffect, useState } from 'react';
4
+ import { View } from 'react-native';
5
+ import Animated, { cancelAnimation, Easing, ReduceMotion, useAnimatedProps, useSharedValue, withRepeat, withTiming } from 'react-native-reanimated';
6
+ import Svg, { Rect } from 'react-native-svg';
7
+ import { radius, useColors, usePrefersReducedMotion } from "../../../theme/index.js";
8
+ import { A11Y_HIDDEN_PROPS } from "../shared/a11y.js";
9
+ import { normalizeBorderBeam } from "./normalizeBorderBeam.js";
10
+ import { borderBeamGeometry, EMPTY_BORDER_BEAM_LAYOUT } from "./shared.js";
11
+ import { styles } from "./styles.js";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ const AnimatedRect = Animated.createAnimatedComponent(Rect);
14
+
15
+ /**
16
+ * 沿内容边缘循环移动的装饰性流光描边。
17
+ *
18
+ * 组件不承载加载、错误或焦点语义;业务状态仍由调用方自己的可访问元素表达。
19
+ * 系统开启「减弱动态效果」时隐藏流光,只保留原内容。
20
+ */
21
+ export function BorderBeam({
22
+ children,
23
+ active = true,
24
+ color,
25
+ duration,
26
+ lineWidth,
27
+ size,
28
+ borderRadius = radius.md,
29
+ style,
30
+ testID
31
+ }) {
32
+ const colors = useColors();
33
+ const reducedMotion = usePrefersReducedMotion();
34
+ const [layout, setLayout] = useState(EMPTY_BORDER_BEAM_LAYOUT);
35
+ const normalized = normalizeBorderBeam({
36
+ duration,
37
+ lineWidth,
38
+ size,
39
+ borderRadius
40
+ });
41
+ const geometry = borderBeamGeometry({
42
+ layout,
43
+ ...normalized
44
+ });
45
+ const dashOffset = useSharedValue(0);
46
+ const showVisual = active && !reducedMotion && geometry.perimeter > 0;
47
+ useEffect(() => {
48
+ cancelAnimation(dashOffset);
49
+ dashOffset.value = 0;
50
+ if (!showVisual) return;
51
+ dashOffset.value = withRepeat(withTiming(-geometry.perimeter, {
52
+ duration: normalized.duration,
53
+ easing: Easing.linear,
54
+ reduceMotion: ReduceMotion.System
55
+ }), -1, false, undefined, ReduceMotion.System);
56
+ return () => cancelAnimation(dashOffset);
57
+ }, [dashOffset, geometry.perimeter, normalized.duration, showVisual]);
58
+ const animatedProps = useAnimatedProps(() => ({
59
+ strokeDashoffset: dashOffset.value
60
+ }));
61
+ const handleLayout = event => {
62
+ const width = Math.max(0, event.nativeEvent.layout.width);
63
+ const height = Math.max(0, event.nativeEvent.layout.height);
64
+ setLayout(current => current.width === width && current.height === height ? current : {
65
+ width,
66
+ height
67
+ });
68
+ };
69
+ return /*#__PURE__*/_jsxs(View, {
70
+ onLayout: handleLayout,
71
+ style: [styles.container, {
72
+ borderRadius: normalized.borderRadius
73
+ }, style],
74
+ testID: testID,
75
+ children: [children, showVisual ? /*#__PURE__*/_jsx(View, {
76
+ pointerEvents: "none",
77
+ style: styles.visual,
78
+ ...A11Y_HIDDEN_PROPS,
79
+ children: /*#__PURE__*/_jsx(Svg, {
80
+ width: layout.width,
81
+ height: layout.height,
82
+ children: /*#__PURE__*/_jsx(AnimatedRect, {
83
+ animatedProps: animatedProps,
84
+ x: normalized.lineWidth / 2,
85
+ y: normalized.lineWidth / 2,
86
+ width: geometry.rectWidth,
87
+ height: geometry.rectHeight,
88
+ rx: geometry.radius,
89
+ ry: geometry.radius,
90
+ fill: "none",
91
+ stroke: color ?? colors.primary,
92
+ strokeWidth: normalized.lineWidth,
93
+ strokeLinecap: "round",
94
+ strokeDasharray: [geometry.beamLength, Math.max(0, geometry.perimeter - geometry.beamLength)]
95
+ })
96
+ })
97
+ }) : null]
98
+ });
99
+ }
100
+ //# sourceMappingURL=BorderBeam.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useEffect","useState","View","Animated","cancelAnimation","Easing","ReduceMotion","useAnimatedProps","useSharedValue","withRepeat","withTiming","Svg","Rect","radius","useColors","usePrefersReducedMotion","A11Y_HIDDEN_PROPS","normalizeBorderBeam","borderBeamGeometry","EMPTY_BORDER_BEAM_LAYOUT","styles","jsx","_jsx","jsxs","_jsxs","AnimatedRect","createAnimatedComponent","BorderBeam","children","active","color","duration","lineWidth","size","borderRadius","md","style","testID","colors","reducedMotion","layout","setLayout","normalized","geometry","dashOffset","showVisual","perimeter","value","easing","linear","reduceMotion","System","undefined","animatedProps","strokeDashoffset","handleLayout","event","width","Math","max","nativeEvent","height","current","onLayout","container","pointerEvents","visual","x","y","rectWidth","rectHeight","rx","ry","fill","stroke","primary","strokeWidth","strokeLinecap","strokeDasharray","beamLength"],"sourceRoot":"../../../../../src","sources":["components/ui/BorderBeam/BorderBeam.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAElD,SAASC,IAAI,QAAQ,cAAc;AACnC,OAAOC,QAAQ,IACbC,eAAe,EACfC,MAAM,EACNC,YAAY,EACZC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAChC,OA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AEA,MAAO;IAAAT,QAAA,GAEdA,QAAQ,EACRiB,UAAU,gBACTvB,IAAA,CAACpB,IAAI;MAAC+D,aAAa,EAAC,MAAM;MAAC7B,KAAK,EAAEhB,MAAM,CAAC8C,MAAO;MAAA,GAAKlD,iBAAiB;MAAAY,QAAA,eACpEN,IAAA,CAACX,GAAG;QAAC8C,KAAK,EAAEjB,MAAM,CAACiB,KAAM;QAACI,MAAM,EAAErB,MAAM,CAACqB,MAAO;QAAAjC,QAAA,eAC9CN,IAAA,CAACG,YAAY;UACX4B,aAAa,EAAEA,aAAc;UAC7Bc,CAAC,EAAEzB,UAAU,CAACV,SAAS,GAAG,CAAE;UAC5BoC,CAAC,EAAE1B,UAAU,CAACV,SAAS,GAAG,CAAE;UAC5ByB,KAAK,EAAEd,QAAQ,CAAC0B,SAAU;UAC1BR,MAAM,EAAElB,QAAQ,CAAC2B,UAAW;UAC5BC,EAAE,EAAE5B,QAAQ,CAAC9B,MAAO;UACpB2D,EAAE,EAAE7B,QAAQ,CAAC9B,MAAO;UACpB4D,IAAI,EAAC,MAAM;UACXC,MAAM,EAAE5C,KAAK,IAAIQ,MAAM,CAACqC,OAAQ;UAChCC,WAAW,EAAElC,UAAU,CAACV,SAAU;UAClC6C,aAAa,EAAC,OAAO;UACrBC,eAAe,EAAE,CACfnC,QAAQ,CAACoC,UAAU,EACnBrB,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEhB,QAAQ,CAACG,SAAS,GAAGH,QAAQ,CAACoC,UAAU,CAAC;QACrD,CACH;MAAC,CACC;IAAC,CACF,CAAC,GACL,IAAI;EAAA,CACJ,CAAC;AAEX","ignoreList":[]}
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+
3
+ import React, { useEffect, useRef, useState } from 'react';
4
+ import { View } from 'react-native';
5
+ import Svg, { Rect } from 'react-native-svg';
6
+ import { radius, useColors, usePrefersReducedMotion } from "../../../theme/index.js";
7
+ import { A11Y_HIDDEN_PROPS } from "../shared/a11y.js";
8
+ import { normalizeBorderBeam } from "./normalizeBorderBeam.js";
9
+ import { borderBeamGeometry, EMPTY_BORDER_BEAM_LAYOUT } from "./shared.js";
10
+ import { styles } from "./styles.js";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ const KEYFRAMES_ID = 'unif-border-beam-keyframes';
13
+ const win = globalThis;
14
+ function ensureKeyframes() {
15
+ if (typeof win.document === 'undefined') return;
16
+ if (win.document.getElementById(KEYFRAMES_ID)) return;
17
+ const sheet = win.document.createElement('style');
18
+ sheet.id = KEYFRAMES_ID;
19
+ sheet.textContent = '@keyframes unif-border-beam-flow { from { stroke-dashoffset: 0; } to { stroke-dashoffset: calc(-1 * var(--unif-border-beam-path)); } }';
20
+ win.document.head.appendChild(sheet);
21
+ }
22
+
23
+ /** Web 版用 CSS keyframes 插值,JS 只在布局或 props 变化时更新一次。 */
24
+ export function BorderBeam({
25
+ children,
26
+ active = true,
27
+ color,
28
+ duration,
29
+ lineWidth,
30
+ size,
31
+ borderRadius = radius.md,
32
+ style,
33
+ testID
34
+ }) {
35
+ const colors = useColors();
36
+ const reducedMotion = usePrefersReducedMotion();
37
+ const [layout, setLayout] = useState(EMPTY_BORDER_BEAM_LAYOUT);
38
+ const rectRef = useRef(null);
39
+ const normalized = normalizeBorderBeam({
40
+ duration,
41
+ lineWidth,
42
+ size,
43
+ borderRadius
44
+ });
45
+ const geometry = borderBeamGeometry({
46
+ layout,
47
+ ...normalized
48
+ });
49
+ const showVisual = active && !reducedMotion && geometry.perimeter > 0;
50
+ useEffect(() => {
51
+ if (!showVisual) return;
52
+ ensureKeyframes();
53
+ const node = rectRef.current;
54
+ if (!node?.style) return;
55
+ node.style.setProperty('--unif-border-beam-path', `${geometry.perimeter}px`);
56
+ node.style.animation = `unif-border-beam-flow ${normalized.duration}ms linear infinite`;
57
+ return () => {
58
+ node.style.animation = '';
59
+ };
60
+ }, [geometry.perimeter, normalized.duration, showVisual]);
61
+ const handleLayout = event => {
62
+ const width = Math.max(0, event.nativeEvent.layout.width);
63
+ const height = Math.max(0, event.nativeEvent.layout.height);
64
+ setLayout(current => current.width === width && current.height === height ? current : {
65
+ width,
66
+ height
67
+ });
68
+ };
69
+ return /*#__PURE__*/_jsxs(View, {
70
+ onLayout: handleLayout,
71
+ style: [styles.container, {
72
+ borderRadius: normalized.borderRadius
73
+ }, style],
74
+ testID: testID,
75
+ children: [children, showVisual ? /*#__PURE__*/_jsx(View, {
76
+ pointerEvents: "none",
77
+ style: styles.visual,
78
+ ...A11Y_HIDDEN_PROPS,
79
+ children: /*#__PURE__*/_jsx(Svg, {
80
+ width: layout.width,
81
+ height: layout.height,
82
+ children: /*#__PURE__*/_jsx(Rect, {
83
+ ref: rectRef,
84
+ x: normalized.lineWidth / 2,
85
+ y: normalized.lineWidth / 2,
86
+ width: geometry.rectWidth,
87
+ height: geometry.rectHeight,
88
+ rx: geometry.radius,
89
+ ry: geometry.radius,
90
+ fill: "none",
91
+ stroke: color ?? colors.primary,
92
+ strokeWidth: normalized.lineWidth,
93
+ strokeLinecap: "round",
94
+ strokeDasharray: [geometry.beamLength, Math.max(0, geometry.perimeter - geometry.beamLength)]
95
+ })
96
+ })
97
+ }) : null]
98
+ });
99
+ }
100
+ //# sourceMappingURL=BorderBeam.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useEffect","useRef","useState","View","Svg","Rect","radius","useColors","usePrefersReducedMotion","A11Y_HIDDEN_PROPS","normalizeBorderBeam","borderBeamGeometry","EMPTY_BORDER_BEAM_LAYOUT","styles","jsx","_jsx","jsxs","_jsxs","KEYFRAMES_ID","win","globalThis","ensureKeyframes","document","getElementById","sheet","createElement","id","textContent","head","appendChild","BorderBeam","children","active","color","duration","lineWidth","size","borderRadius","md","style","testID","colors","reducedMotion","layout","setLayout","rectRef","normalized","geometry","showVisual","perimeter","node","current","setProperty","animation","handleLayout","event","width","Math","max","nativeEvent","height","onLayout","container","pointerEvents","visual","ref","x","y","rectWidth","rectHeight","rx","ry","fill","stroke","primary","strokeWidth","strokeLinecap","strokeDasharray","beamLength"],"sourceRoot":"../../../../../src","sources":["components/ui/BorderBeam/BorderBeam.web.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAE1D,SAASC,IAAI,QAAQ,cAAc;AACnC,OAAOC,GAAG,IAAIC,IAAI,QAAQ,kBAAkB;AAE5C,SAASC,MAAM,EAAEC,SAAS,EAAEC,uBAAuB,QAAQ,yBAAgB;AAC3E,SAASC,iBAAiB,QAAQ,mBAAgB;AAClD,SAASC,mBAAmB,QAAQ,0BAAuB;AAC3D,SAASC,kBAAkB,EAAEC,wBAAwB,QAAQ,aAAU;AACvE,SAASC,MAAM,QAAQ,aAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGlC,MAAMC,YAAY,GAAG,4BAA4B;AACjD,MAAMC,GAAQ,GAAGC,UAAiB;AAElC,SAASC,eAAeA,CAAA,EAAS;EAC/B,IAAI,OAAOF,GAAG,CAACG,QAAQ,KAAK,WAAW,EAAE;EACzC,IAAIH,GAAG,CAACG,QAAQ,CAACC,cAAc,CAACL,YAAY,CAAC,EAAE;EAC/C,MAAMM,KAAK,GAAGL,GAAG,CAACG,QAAQ,CAACG,aAAa,CAAC,OAAO,CAAC;EACjDD,KAAK,CAACE,EAAE,GAAGR,YAAY;EACvBM,KAAK,CAACG,WAAW,GACf,wIAAwI;EAC1IR,GAAG,CAACG,QAAQ,CAACM,IAAI,CAACC,WAAW,CAACL,KAAK,CAAC;AACtC;;AAEA;AACA,OAAO,SAASM,UAAUA,CAAC;EACzBC,QAAQ;EACRC,MAAM,GAAG,IAAI;EACbC,KAAK;EACLC,QAAQ;EACRC,SAAS;EACTC,IAAI;EACJC,YAAY,GAAG/B,MAAM,CAACgC,EAAE;EACxBC,KAAK;EACLC;AACe,CAAC,EAAqB;EACrC,MAAMC,MAAM,GAAGlC,SA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UAAU,EACnBrB,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEX,QAAQ,CAACE,SAAS,GAAGF,QAAQ,CAAC+B,UAAU,CAAC;QACrD,CACH;MAAC,CACC;IAAC,CACF,CAAC,GACL,IAAI;EAAA,CACJ,CAAC;AAEX","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { BorderBeam } from './BorderBeam';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BorderBeam"],"sourceRoot":"../../../../../src","sources":["components/ui/BorderBeam/index.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ export const BORDER_BEAM_DEFAULTS = {
4
+ duration: 6000,
5
+ lineWidth: 1,
6
+ size: 40,
7
+ borderRadius: 12
8
+ };
9
+ const normalizeNumber = (value, fallback, min, max, allowZero = false) => {
10
+ if (typeof value !== 'number' || !Number.isFinite(value) || value < 0 || !allowZero && value === 0) {
11
+ return fallback;
12
+ }
13
+ return Math.min(max, Math.max(min, value));
14
+ };
15
+ export function normalizeBorderBeam(input) {
16
+ return {
17
+ duration: normalizeNumber(input.duration, BORDER_BEAM_DEFAULTS.duration, 300, 60_000),
18
+ lineWidth: normalizeNumber(input.lineWidth, BORDER_BEAM_DEFAULTS.lineWidth, 0.5, 8),
19
+ size: normalizeNumber(input.size, BORDER_BEAM_DEFAULTS.size, 8, 1_000),
20
+ borderRadius: normalizeNumber(input.borderRadius, BORDER_BEAM_DEFAULTS.borderRadius, 0, 1_000, true)
21
+ };
22
+ }
23
+ //# sourceMappingURL=normalizeBorderBeam.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BORDER_BEAM_DEFAULTS","duration","lineWidth","size","borderRadius","normalizeNumber","value","fallback","min","max","allowZero","Number","isFinite","Math","normalizeBorderBeam","input"],"sourceRoot":"../../../../../src","sources":["components/ui/BorderBeam/normalizeBorderBeam.ts"],"mappings":";;AAOA,OAAO,MAAMA,oBAA0C,GAAG;EACxDC,QAAQ,EAAE,IAAI;EACdC,SAAS,EAAE,CAAC;EACZC,IAAI,EAAE,EAAE;EACRC,YAAY,EAAE;AAChB,CAAC;AAID,MAAMC,eAAe,GAAGA,CACtBC,KAAyB,EACzBC,QAAgB,EAChBC,GAAW,EACXC,GAAW,EACXC,SAAS,GAAG,KAAK,KACN;EACX,IACE,OAAOJ,KAAK,KAAK,QAAQ,IACzB,CAACK,MAAM,CAACC,QAAQ,CAACN,KAAK,CAAC,IACvBA,KAAK,GAAG,CAAC,IACR,CAACI,SAAS,IAAIJ,KAAK,KAAK,CAAE,EAC3B;IACA,OAAOC,QAAQ;EACjB;EACA,OAAOM,IAAI,CAACL,GAAG,CAACC,GAAG,EAAEI,IAAI,CAACJ,GAAG,CAACD,GAAG,EAAEF,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED,OAAO,SAASQ,mBAAmBA,CAACC,KAAwB,EAAE;EAC5D,OAAO;IACLd,QAAQ,EAAEI,eAAe,CACvBU,KAAK,CAACd,QAAQ,EACdD,oBAAoB,CAACC,QAAQ,EAC7B,GAAG,EACH,MACF,CAAC;IACDC,SAAS,EAAEG,eAAe,CACxBU,KAAK,CAACb,SAAS,EACfF,oBAAoB,CAACE,SAAS,EAC9B,GAAG,EACH,CACF,CAAC;IACDC,IAAI,EAAEE,eAAe,CAACU,KAAK,CAACZ,IAAI,EAAEH,oBAAoB,CAACG,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC;IACtEC,YAAY,EAAEC,eAAe,CAC3BU,KAAK,CAACX,YAAY,EAClBJ,oBAAoB,CAACI,YAAY,EACjC,CAAC,EACD,KAAK,EACL,IACF;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ export const EMPTY_BORDER_BEAM_LAYOUT = {
4
+ width: 0,
5
+ height: 0
6
+ };
7
+ export function borderBeamGeometry(input) {
8
+ const {
9
+ layout,
10
+ lineWidth
11
+ } = input;
12
+ const rectWidth = Math.max(0, layout.width - lineWidth);
13
+ const rectHeight = Math.max(0, layout.height - lineWidth);
14
+ const perimeter = Math.max(0, 2 * (rectWidth + rectHeight));
15
+ const beamLength = Math.min(input.size, perimeter / 2);
16
+ return {
17
+ beamLength,
18
+ perimeter,
19
+ rectHeight,
20
+ rectWidth,
21
+ radius: Math.min(input.borderRadius, rectWidth / 2, rectHeight / 2)
22
+ };
23
+ }
24
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EMPTY_BORDER_BEAM_LAYOUT","width","height","borderBeamGeometry","input","layout","lineWidth","rectWidth","Math","max","rectHeight","perimeter","beamLength","min","size","radius","borderRadius"],"sourceRoot":"../../../../../src","sources":["components/ui/BorderBeam/shared.ts"],"mappings":";;AAEA,OAAO,MAAMA,wBAA0C,GAAG;EACxDC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE;AACV,CAAC;AAED,OAAO,SAASC,kBAAkBA,CAACC,KAKlC,EAAE;EACD,MAAM;IAAEC,MAAM;IAAEC;EAAU,CAAC,GAAGF,KAAK;EACnC,MAAMG,SAAS,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEJ,MAAM,CAACJ,KAAK,GAAGK,SAAS,CAAC;EACvD,MAAMI,UAAU,GAAGF,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEJ,MAAM,CAACH,MAAM,GAAGI,SAAS,CAAC;EACzD,MAAMK,SAAS,GAAGH,IAAI,CAACC,GAAG,CAAC,CAAC,EAAE,CAAC,IAAIF,SAAS,GAAGG,UAAU,CAAC,CAAC;EAC3D,MAAME,UAAU,GAAGJ,IAAI,CAACK,GAAG,CAACT,KAAK,CAACU,IAAI,EAAEH,SAAS,GAAG,CAAC,CAAC;EACtD,OAAO;IACLC,UAAU;IACVD,SAAS;IACTD,UAAU;IACVH,SAAS;IACTQ,MAAM,EAAEP,IAAI,CAACK,GAAG,CAACT,KAAK,CAACY,YAAY,EAAET,SAAS,GAAG,CAAC,EAAEG,UAAU,GAAG,CAAC;EACpE,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ import { StyleSheet } from 'react-native';
4
+ export const styles = StyleSheet.create({
5
+ container: {
6
+ position: 'relative'
7
+ },
8
+ visual: {
9
+ position: 'absolute',
10
+ top: 0,
11
+ right: 0,
12
+ bottom: 0,
13
+ left: 0,
14
+ zIndex: 1,
15
+ elevation: 1
16
+ }
17
+ });
18
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StyleSheet","styles","create","container","position","visual","top","right","bottom","left","zIndex","elevation"],"sourceRoot":"../../../../../src","sources":["components/ui/BorderBeam/styles.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AAEzC,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAM,CAAC;EACtCC,SAAS,EAAE;IACTC,QAAQ,EAAE;EACZ,CAAC;EACDC,MAAM,EAAE;IACND,QAAQ,EAAE,UAAU;IACpBE,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAE,CAAC;IACPC,MAAM,EAAE,CAAC;IACTC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["components/ui/BorderBeam/types.ts"],"mappings":"","ignoreList":[]}
@@ -3,6 +3,7 @@
3
3
  export { Avatar } from "./Avatar/index.js";
4
4
  export { AvatarGroup } from "./AvatarGroup/index.js";
5
5
  export { BlurLayer } from "./BlurLayer/index.js";
6
+ export { BorderBeam } from "./BorderBeam/index.js";
6
7
  export { Button } from "./Button/index.js";
7
8
  export { Card } from "./Card/index.js";
8
9
  export { Carousel } from "./Carousel/index.js";
@@ -1 +1 @@
1
- {"version":3,"names":["Avatar","AvatarGroup","BlurLayer","Button","Card","Carousel","Cell","List","Checkbox","Chip","CircularProgress","confirm","ConfirmHost","DrawerHeader","Empty","EntryCard","Form","FormGroup","FormRow","Grid","Icon","IconButton","Input","Logo","NavBar","PasswordInput","Pulse","PulseDot","usePulse","Radio","Reveal","Ribbon","Search","Skeleton","Segmented","Spinner","StatusDot","Stepper","Switch","TabBar","Tabs","Tag","Textarea","Thumbnail","toast","ToastHost"],"sourceRoot":"../../../../src","sources":["components/ui/index.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,mBAAU;AAOjC,SAASC,WAAW,QAAQ,wBAAe;AAE3C,SAASC,SAAS,QAAQ,sBAAa;AAEvC,SAASC,MAAM,QAAQ,mBAAU;AAEjC,SAASC,IAAI,QAAQ,iBAAQ;AAE7B,SAASC,QAAQ,QAAQ,qBAAY;AAErC,SAASC,IAAI,EAAEC,IAAI,QAAQ,iBAAQ;AAQnC,SAASC,QAAQ,QAAQ,qBAAY;AAErC,SAASC,IAAI,QAAQ,iBAAQ;AAE7B,SAASC,gBAAgB,QAAQ,6BAAoB;AAErD,SAASC,OAAO,EAAEC,WAAW,QAAQ,oBAAW;AAEhD,SAASC,YAAY,QAAQ,yBAAgB;AAE7C,SAASC,KAAK,QAAQ,kBAAS;AAE/B,SAASC,SAAS,QAAQ,sBAAa;AAEvC,SAASC,IAAI,EAAEC,SAAS,EAAEC,OAAO,QAAQ,iBAAQ;AAEjD,SAASC,IAAI,QAAQ,iBAAQ;AAE7B,SAASC,IAAI,QAAQ,iBAAQ;AAE7B,SAASC,UAAU,QAAQ,uBAAc;AAEzC,SAASC,KAAK,QAAQ,kBAAS;AAO/B,SAASC,IAAI,QAAQ,iBAAQ;AAE7B,SAASC,MAAM,QAAQ,mBAAU;AAEjC,SAASC,aAAa,QAAQ,0BAAiB;AAE/C,SAASC,KAAK,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,kBAAS;AAEnD,SAASC,KAAK,QAAQ,kBAAS;AAE/B,SAASC,MAAM,QAAQ,mBAAU;AAEjC,SAASC,MAAM,QAAQ,mBAAU;AAEjC,SAASC,MAAM,QAAQ,mBAAU;AAEjC,SAASC,QAAQ,QAAQ,qBAAY;AAErC,SAASC,SAAS,QAAQ,sBAAa;AAEvC,SAASC,OAAO,QAAQ,oBAAW;AAEnC,SAASC,SAAS,QAAQ,sBAAa;AAMvC,SAASC,OAAO,QAAQ,oBAAW;AAEnC,SAASC,MAAM,QAAQ,mBAAU;AAEjC,SAASC,MAAM,QAAQ,mBAAU;AAEjC,SAASC,IAAI,QAAQ,iBAAQ;AAE7B,SAASC,GAAG,QAAQ,gBAAO;AAE3B,SAASC,QAAQ,QAAQ,qBAAY;AAErC,SAASC,SAAS,QAAQ,sBAAa;AAMvC,SAASC,KAAK,EAAEC,SAAS,QAAQ,kBAAS","ignoreList":[]}
1
+ {"version":3,"names":["Avatar","AvatarGroup","BlurLayer","BorderBeam","Button","Card","Carousel","Cell","List","Checkbox","Chip","CircularProgress","confirm","ConfirmHost","DrawerHeader","Empty","EntryCard","Form","FormGroup","FormRow","Grid","Icon","IconButton","Input","Logo","NavBar","PasswordInput","Pulse","PulseDot","usePulse","Radio","Reveal","Ribbon","Search","Skeleton","Segmented","Spinner","StatusDot","Stepper","Switch","TabBar","Tabs","Tag","Textarea","Thumbnail","toast","ToastHost"],"sourceRoot":"../../../../src","sources":["components/ui/index.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,mBAAU;AAOjC,SAASC,WAAW,QAAQ,wBAAe;AAE3C,SAASC,SAAS,QAAQ,sBAAa;AAEvC,SAASC,UAAU,QAAQ,uBAAc;AAEzC,SAASC,MAAM,QAAQ,mBAAU;AAEjC,SAASC,IAAI,QAAQ,iBAAQ;AAE7B,SAASC,QAAQ,QAAQ,qBAAY;AAErC,SAASC,IAAI,EAAEC,IAAI,QAAQ,iBAAQ;AAQnC,SAASC,QAAQ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4
+ * 沿内容边缘循环移动的装饰性流光描边。
5
+ *
6
+ * 组件不承载加载、错误或焦点语义;业务状态仍由调用方自己的可访问元素表达。
7
+ * 系统开启「减弱动态效果」时隐藏流光,只保留原内容。
8
+ */
9
+ export declare function BorderBeam({ children, active, color, duration, lineWidth, size, borderRadius, style, testID, }: BorderBeamProps): React.JSX.Element;
10
+ //# sourceMappingURL=BorderBeam.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BorderBeam.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/BorderBeam/BorderBeam.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAmBnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAI/C;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,MAAa,EACb,KAAK,EACL,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,YAAwB,EACxB,KAAK,EACL,MAAM,GACP,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAiFrC"}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { BorderBeamProps } from './types';
3
+ /** Web 版用 CSS keyframes 插值,JS 只在布局或 props 变化时更新一次。 */
4
+ export declare function BorderBeam({ children, active, color, duration, lineWidth, size, borderRadius, style, testID, }: BorderBeamProps): React.JSX.Element;
5
+ //# sourceMappingURL=BorderBeam.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BorderBeam.web.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/BorderBeam/BorderBeam.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAU3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAe/C,sDAAsD;AACtD,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,MAAa,EACb,KAAK,EACL,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,YAAwB,EACxB,KAAK,EACL,MAAM,GACP,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA2ErC"}
@@ -0,0 +1,3 @@
1
+ export { BorderBeam } from './BorderBeam';
2
+ export type { BorderBeamProps } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/BorderBeam/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,16 @@
1
+ export type NormalizedBorderBeam = {
2
+ duration: number;
3
+ lineWidth: number;
4
+ size: number;
5
+ borderRadius: number;
6
+ };
7
+ export declare const BORDER_BEAM_DEFAULTS: NormalizedBorderBeam;
8
+ type BorderBeamNumbers = Partial<NormalizedBorderBeam>;
9
+ export declare function normalizeBorderBeam(input: BorderBeamNumbers): {
10
+ duration: number;
11
+ lineWidth: number;
12
+ size: number;
13
+ borderRadius: number;
14
+ };
15
+ export {};
16
+ //# sourceMappingURL=normalizeBorderBeam.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizeBorderBeam.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/BorderBeam/normalizeBorderBeam.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,oBAKlC,CAAC;AAEF,KAAK,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAoBvD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,iBAAiB;;;;;EAuB3D"}
@@ -0,0 +1,18 @@
1
+ export type BorderBeamLayout = Readonly<{
2
+ width: number;
3
+ height: number;
4
+ }>;
5
+ export declare const EMPTY_BORDER_BEAM_LAYOUT: BorderBeamLayout;
6
+ export declare function borderBeamGeometry(input: {
7
+ layout: BorderBeamLayout;
8
+ lineWidth: number;
9
+ size: number;
10
+ borderRadius: number;
11
+ }): {
12
+ beamLength: number;
13
+ perimeter: number;
14
+ rectHeight: number;
15
+ rectWidth: number;
16
+ radius: number;
17
+ };
18
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/BorderBeam/shared.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE3E,eAAO,MAAM,wBAAwB,EAAE,gBAGtC,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,MAAM,EAAE,gBAAgB,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB;;;;;;EAaA"}
@@ -0,0 +1,15 @@
1
+ export declare const styles: Readonly<{
2
+ container: {
3
+ position: "relative";
4
+ };
5
+ visual: {
6
+ position: "absolute";
7
+ top: number;
8
+ right: number;
9
+ bottom: number;
10
+ left: number;
11
+ zIndex: number;
12
+ elevation: number;
13
+ };
14
+ }>;
15
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/BorderBeam/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM;;;;;;;;;;;;;EAajB,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { StyleProp, ViewStyle } from 'react-native';
3
+ export type BorderBeamProps = {
4
+ /** 被流光描边包围的内容。 */
5
+ children: ReactNode;
6
+ /** 是否显示并运行动画,默认 true。 */
7
+ active?: boolean;
8
+ /** 流光颜色,默认主题 primary。 */
9
+ color?: string;
10
+ /** 绕边一周的时长(毫秒),默认 6000。 */
11
+ duration?: number;
12
+ /** 描边宽度,默认 1。 */
13
+ lineWidth?: number;
14
+ /** 流光段长度(布局单位),默认 40。 */
15
+ size?: number;
16
+ /** 圆角半径,默认 radius.md。 */
17
+ borderRadius?: number;
18
+ /** 外层布局样式。 */
19
+ style?: StyleProp<ViewStyle>;
20
+ /** E2E / 测试定位。 */
21
+ testID?: string;
22
+ };
23
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/BorderBeam/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,eAAe,GAAG;IAC5B,kBAAkB;IAClB,QAAQ,EAAE,SAAS,CAAC;IACpB,yBAAyB;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yBAAyB;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc;IACd,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
@@ -4,6 +4,8 @@ export { AvatarGroup } from './AvatarGroup';
4
4
  export type { AvatarGroupItem, AvatarGroupProps } from './AvatarGroup';
5
5
  export { BlurLayer } from './BlurLayer';
6
6
  export type { BlurLayerProps } from './BlurLayer';
7
+ export { BorderBeam } from './BorderBeam';
8
+ export type { BorderBeamProps } from './BorderBeam';
7
9
  export { Button } from './Button';
8
10
  export type { ButtonProps, ButtonSize, ButtonVariant } from './Button';
9
11
  export { Card } from './Card';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,aAAa,GACd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACpC,YAAY,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,aAAa,EACb,SAAS,GACV,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,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AAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC3C,YAAY,EACV,UAAU,EACV,cAAc,EACd,UAAU,EACV,SAAS,EACT,aAAa,GACd,MAAM,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unif/react-native-design",
3
- "version": "0.30.1",
3
+ "version": "0.31.1",
4
4
  "description": "Unif 设计系统:theme + icons + utils + components",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -0,0 +1,121 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import type { LayoutChangeEvent } from 'react-native';
3
+ import { View } from 'react-native';
4
+ import Animated, {
5
+ cancelAnimation,
6
+ Easing,
7
+ ReduceMotion,
8
+ useAnimatedProps,
9
+ useSharedValue,
10
+ withRepeat,
11
+ withTiming,
12
+ } from 'react-native-reanimated';
13
+ import Svg, { Rect } from 'react-native-svg';
14
+
15
+ import { radius, useColors, usePrefersReducedMotion } from '../../../theme';
16
+ import { A11Y_HIDDEN_PROPS } from '../shared/a11y';
17
+ import { normalizeBorderBeam } from './normalizeBorderBeam';
18
+ import { borderBeamGeometry, EMPTY_BORDER_BEAM_LAYOUT } from './shared';
19
+ import { styles } from './styles';
20
+ import type { BorderBeamProps } from './types';
21
+
22
+ const AnimatedRect = Animated.createAnimatedComponent(Rect);
23
+
24
+ /**
25
+ * 沿内容边缘循环移动的装饰性流光描边。
26
+ *
27
+ * 组件不承载加载、错误或焦点语义;业务状态仍由调用方自己的可访问元素表达。
28
+ * 系统开启「减弱动态效果」时隐藏流光,只保留原内容。
29
+ */
30
+ export function BorderBeam({
31
+ children,
32
+ active = true,
33
+ color,
34
+ duration,
35
+ lineWidth,
36
+ size,
37
+ borderRadius = radius.md,
38
+ style,
39
+ testID,
40
+ }: BorderBeamProps): React.JSX.Element {
41
+ const colors = useColors();
42
+ const reducedMotion = usePrefersReducedMotion();
43
+ const [layout, setLayout] = useState(EMPTY_BORDER_BEAM_LAYOUT);
44
+ const normalized = normalizeBorderBeam({
45
+ duration,
46
+ lineWidth,
47
+ size,
48
+ borderRadius,
49
+ });
50
+ const geometry = borderBeamGeometry({ layout, ...normalized });
51
+ const dashOffset = useSharedValue(0);
52
+ const showVisual = active && !reducedMotion && geometry.perimeter > 0;
53
+
54
+ useEffect(() => {
55
+ cancelAnimation(dashOffset);
56
+ dashOffset.value = 0;
57
+ if (!showVisual) return;
58
+ dashOffset.value = withRepeat(
59
+ withTiming(-geometry.perimeter, {
60
+ duration: normalized.duration,
61
+ easing: Easing.linear,
62
+ reduceMotion: ReduceMotion.System,
63
+ }),
64
+ -1,
65
+ false,
66
+ undefined,
67
+ ReduceMotion.System
68
+ );
69
+ return () => cancelAnimation(dashOffset);
70
+ }, [dashOffset, geometry.perimeter, normalized.duration, showVisual]);
71
+
72
+ const animatedProps = useAnimatedProps(() => ({
73
+ strokeDashoffset: dashOffset.value,
74
+ }));
75
+ const handleLayout = (event: LayoutChangeEvent): void => {
76
+ const width = Math.max(0, event.nativeEvent.layout.width);
77
+ const height = Math.max(0, event.nativeEvent.layout.height);
78
+ setLayout((current) =>
79
+ current.width === width && current.height === height
80
+ ? current
81
+ : { width, height }
82
+ );
83
+ };
84
+
85
+ return (
86
+ <View
87
+ onLayout={handleLayout}
88
+ style={[
89
+ styles.container,
90
+ { borderRadius: normalized.borderRadius },
91
+ style,
92
+ ]}
93
+ testID={testID}
94
+ >
95
+ {children}
96
+ {showVisual ? (
97
+ <View pointerEvents="none" style={styles.visual} {...A11Y_HIDDEN_PROPS}>
98
+ <Svg width={layout.width} height={layout.height}>
99
+ <AnimatedRect
100
+ animatedProps={animatedProps}
101
+ x={normalized.lineWidth / 2}
102
+ y={normalized.lineWidth / 2}
103
+ width={geometry.rectWidth}
104
+ height={geometry.rectHeight}
105
+ rx={geometry.radius}
106
+ ry={geometry.radius}
107
+ fill="none"
108
+ stroke={color ?? colors.primary}
109
+ strokeWidth={normalized.lineWidth}
110
+ strokeLinecap="round"
111
+ strokeDasharray={[
112
+ geometry.beamLength,
113
+ Math.max(0, geometry.perimeter - geometry.beamLength),
114
+ ]}
115
+ />
116
+ </Svg>
117
+ </View>
118
+ ) : null}
119
+ </View>
120
+ );
121
+ }
@@ -0,0 +1,112 @@
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import type { LayoutChangeEvent } from 'react-native';
3
+ import { View } from 'react-native';
4
+ import Svg, { Rect } from 'react-native-svg';
5
+
6
+ import { radius, useColors, usePrefersReducedMotion } from '../../../theme';
7
+ import { A11Y_HIDDEN_PROPS } from '../shared/a11y';
8
+ import { normalizeBorderBeam } from './normalizeBorderBeam';
9
+ import { borderBeamGeometry, EMPTY_BORDER_BEAM_LAYOUT } from './shared';
10
+ import { styles } from './styles';
11
+ import type { BorderBeamProps } from './types';
12
+
13
+ const KEYFRAMES_ID = 'unif-border-beam-keyframes';
14
+ const win: any = globalThis as any;
15
+
16
+ function ensureKeyframes(): void {
17
+ if (typeof win.document === 'undefined') return;
18
+ if (win.document.getElementById(KEYFRAMES_ID)) return;
19
+ const sheet = win.document.createElement('style');
20
+ sheet.id = KEYFRAMES_ID;
21
+ sheet.textContent =
22
+ '@keyframes unif-border-beam-flow { from { stroke-dashoffset: 0; } to { stroke-dashoffset: calc(-1 * var(--unif-border-beam-path)); } }';
23
+ win.document.head.appendChild(sheet);
24
+ }
25
+
26
+ /** Web 版用 CSS keyframes 插值,JS 只在布局或 props 变化时更新一次。 */
27
+ export function BorderBeam({
28
+ children,
29
+ active = true,
30
+ color,
31
+ duration,
32
+ lineWidth,
33
+ size,
34
+ borderRadius = radius.md,
35
+ style,
36
+ testID,
37
+ }: BorderBeamProps): React.JSX.Element {
38
+ const colors = useColors();
39
+ const reducedMotion = usePrefersReducedMotion();
40
+ const [layout, setLayout] = useState(EMPTY_BORDER_BEAM_LAYOUT);
41
+ const rectRef = useRef<any>(null);
42
+ const normalized = normalizeBorderBeam({
43
+ duration,
44
+ lineWidth,
45
+ size,
46
+ borderRadius,
47
+ });
48
+ const geometry = borderBeamGeometry({ layout, ...normalized });
49
+ const showVisual = active && !reducedMotion && geometry.perimeter > 0;
50
+
51
+ useEffect(() => {
52
+ if (!showVisual) return;
53
+ ensureKeyframes();
54
+ const node = rectRef.current;
55
+ if (!node?.style) return;
56
+ node.style.setProperty(
57
+ '--unif-border-beam-path',
58
+ `${geometry.perimeter}px`
59
+ );
60
+ node.style.animation = `unif-border-beam-flow ${normalized.duration}ms linear infinite`;
61
+ return () => {
62
+ node.style.animation = '';
63
+ };
64
+ }, [geometry.perimeter, normalized.duration, showVisual]);
65
+
66
+ const handleLayout = (event: LayoutChangeEvent): void => {
67
+ const width = Math.max(0, event.nativeEvent.layout.width);
68
+ const height = Math.max(0, event.nativeEvent.layout.height);
69
+ setLayout((current) =>
70
+ current.width === width && current.height === height
71
+ ? current
72
+ : { width, height }
73
+ );
74
+ };
75
+
76
+ return (
77
+ <View
78
+ onLayout={handleLayout}
79
+ style={[
80
+ styles.container,
81
+ { borderRadius: normalized.borderRadius },
82
+ style,
83
+ ]}
84
+ testID={testID}
85
+ >
86
+ {children}
87
+ {showVisual ? (
88
+ <View pointerEvents="none" style={styles.visual} {...A11Y_HIDDEN_PROPS}>
89
+ <Svg width={layout.width} height={layout.height}>
90
+ <Rect
91
+ ref={rectRef}
92
+ x={normalized.lineWidth / 2}
93
+ y={normalized.lineWidth / 2}
94
+ width={geometry.rectWidth}
95
+ height={geometry.rectHeight}
96
+ rx={geometry.radius}
97
+ ry={geometry.radius}
98
+ fill="none"
99
+ stroke={color ?? colors.primary}
100
+ strokeWidth={normalized.lineWidth}
101
+ strokeLinecap="round"
102
+ strokeDasharray={[
103
+ geometry.beamLength,
104
+ Math.max(0, geometry.perimeter - geometry.beamLength),
105
+ ]}
106
+ />
107
+ </Svg>
108
+ </View>
109
+ ) : null}
110
+ </View>
111
+ );
112
+ }
@@ -0,0 +1,2 @@
1
+ export { BorderBeam } from './BorderBeam';
2
+ export type { BorderBeamProps } from './types';
@@ -0,0 +1,58 @@
1
+ export type NormalizedBorderBeam = {
2
+ duration: number;
3
+ lineWidth: number;
4
+ size: number;
5
+ borderRadius: number;
6
+ };
7
+
8
+ export const BORDER_BEAM_DEFAULTS: NormalizedBorderBeam = {
9
+ duration: 6000,
10
+ lineWidth: 1,
11
+ size: 40,
12
+ borderRadius: 12,
13
+ };
14
+
15
+ type BorderBeamNumbers = Partial<NormalizedBorderBeam>;
16
+
17
+ const normalizeNumber = (
18
+ value: number | undefined,
19
+ fallback: number,
20
+ min: number,
21
+ max: number,
22
+ allowZero = false
23
+ ): number => {
24
+ if (
25
+ typeof value !== 'number' ||
26
+ !Number.isFinite(value) ||
27
+ value < 0 ||
28
+ (!allowZero && value === 0)
29
+ ) {
30
+ return fallback;
31
+ }
32
+ return Math.min(max, Math.max(min, value));
33
+ };
34
+
35
+ export function normalizeBorderBeam(input: BorderBeamNumbers) {
36
+ return {
37
+ duration: normalizeNumber(
38
+ input.duration,
39
+ BORDER_BEAM_DEFAULTS.duration,
40
+ 300,
41
+ 60_000
42
+ ),
43
+ lineWidth: normalizeNumber(
44
+ input.lineWidth,
45
+ BORDER_BEAM_DEFAULTS.lineWidth,
46
+ 0.5,
47
+ 8
48
+ ),
49
+ size: normalizeNumber(input.size, BORDER_BEAM_DEFAULTS.size, 8, 1_000),
50
+ borderRadius: normalizeNumber(
51
+ input.borderRadius,
52
+ BORDER_BEAM_DEFAULTS.borderRadius,
53
+ 0,
54
+ 1_000,
55
+ true
56
+ ),
57
+ };
58
+ }
@@ -0,0 +1,26 @@
1
+ export type BorderBeamLayout = Readonly<{ width: number; height: number }>;
2
+
3
+ export const EMPTY_BORDER_BEAM_LAYOUT: BorderBeamLayout = {
4
+ width: 0,
5
+ height: 0,
6
+ };
7
+
8
+ export function borderBeamGeometry(input: {
9
+ layout: BorderBeamLayout;
10
+ lineWidth: number;
11
+ size: number;
12
+ borderRadius: number;
13
+ }) {
14
+ const { layout, lineWidth } = input;
15
+ const rectWidth = Math.max(0, layout.width - lineWidth);
16
+ const rectHeight = Math.max(0, layout.height - lineWidth);
17
+ const perimeter = Math.max(0, 2 * (rectWidth + rectHeight));
18
+ const beamLength = Math.min(input.size, perimeter / 2);
19
+ return {
20
+ beamLength,
21
+ perimeter,
22
+ rectHeight,
23
+ rectWidth,
24
+ radius: Math.min(input.borderRadius, rectWidth / 2, rectHeight / 2),
25
+ };
26
+ }
@@ -0,0 +1,16 @@
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ export const styles = StyleSheet.create({
4
+ container: {
5
+ position: 'relative',
6
+ },
7
+ visual: {
8
+ position: 'absolute',
9
+ top: 0,
10
+ right: 0,
11
+ bottom: 0,
12
+ left: 0,
13
+ zIndex: 1,
14
+ elevation: 1,
15
+ },
16
+ });
@@ -0,0 +1,23 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { StyleProp, ViewStyle } from 'react-native';
3
+
4
+ export type BorderBeamProps = {
5
+ /** 被流光描边包围的内容。 */
6
+ children: ReactNode;
7
+ /** 是否显示并运行动画,默认 true。 */
8
+ active?: boolean;
9
+ /** 流光颜色,默认主题 primary。 */
10
+ color?: string;
11
+ /** 绕边一周的时长(毫秒),默认 6000。 */
12
+ duration?: number;
13
+ /** 描边宽度,默认 1。 */
14
+ lineWidth?: number;
15
+ /** 流光段长度(布局单位),默认 40。 */
16
+ size?: number;
17
+ /** 圆角半径,默认 radius.md。 */
18
+ borderRadius?: number;
19
+ /** 外层布局样式。 */
20
+ style?: StyleProp<ViewStyle>;
21
+ /** E2E / 测试定位。 */
22
+ testID?: string;
23
+ };
@@ -9,6 +9,8 @@ export { AvatarGroup } from './AvatarGroup';
9
9
  export type { AvatarGroupItem, AvatarGroupProps } from './AvatarGroup';
10
10
  export { BlurLayer } from './BlurLayer';
11
11
  export type { BlurLayerProps } from './BlurLayer';
12
+ export { BorderBeam } from './BorderBeam';
13
+ export type { BorderBeamProps } from './BorderBeam';
12
14
  export { Button } from './Button';
13
15
  export type { ButtonProps, ButtonSize, ButtonVariant } from './Button';
14
16
  export { Card } from './Card';