@unif/react-native-design 0.33.1 → 0.34.0
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/lib/module/components/ui/ActionMenuContent/ActionMenuContent.js +97 -0
- package/lib/module/components/ui/ActionMenuContent/ActionMenuContent.js.map +1 -0
- package/lib/module/components/ui/ActionMenuContent/index.js +4 -0
- package/lib/module/components/ui/ActionMenuContent/index.js.map +1 -0
- package/lib/module/components/ui/ActionMenuContent/styles.js +54 -0
- package/lib/module/components/ui/ActionMenuContent/styles.js.map +1 -0
- package/lib/module/components/ui/ActionMenuContent/types.js.map +1 -0
- package/lib/module/components/ui/Button/ButtonBase.js +10 -2
- package/lib/module/components/ui/Button/ButtonBase.js.map +1 -1
- package/lib/module/components/ui/IconButton/IconButton.js +5 -1
- package/lib/module/components/ui/IconButton/IconButton.js.map +1 -1
- package/lib/module/components/ui/ImagePreview/ImagePreview.js +200 -0
- package/lib/module/components/ui/ImagePreview/ImagePreview.js.map +1 -0
- package/lib/module/components/ui/ImagePreview/constants.js +5 -0
- package/lib/module/components/ui/ImagePreview/constants.js.map +1 -0
- package/lib/module/components/ui/ImagePreview/index.js +4 -0
- package/lib/module/components/ui/ImagePreview/index.js.map +1 -0
- package/lib/module/components/ui/ImagePreview/styles.js +55 -0
- package/lib/module/components/ui/ImagePreview/styles.js.map +1 -0
- package/lib/module/components/ui/ImagePreview/types.js +4 -0
- package/lib/module/components/ui/ImagePreview/types.js.map +1 -0
- package/lib/module/components/ui/Sheet/Sheet.js +40 -0
- package/lib/module/components/ui/Sheet/Sheet.js.map +1 -0
- package/lib/module/components/ui/Sheet/index.js +4 -0
- package/lib/module/components/ui/Sheet/index.js.map +1 -0
- package/lib/module/components/ui/Sheet/styles.js +41 -0
- package/lib/module/components/ui/Sheet/styles.js.map +1 -0
- package/lib/module/components/ui/Sheet/types.js +4 -0
- package/lib/module/components/ui/Sheet/types.js.map +1 -0
- package/lib/module/components/ui/SmsField/SmsField.js +40 -0
- package/lib/module/components/ui/SmsField/SmsField.js.map +1 -0
- package/lib/module/components/ui/SmsField/index.js +4 -0
- package/lib/module/components/ui/SmsField/index.js.map +1 -0
- package/lib/module/components/ui/SmsField/types.js +4 -0
- package/lib/module/components/ui/SmsField/types.js.map +1 -0
- package/lib/module/components/ui/TextEntryContent/TextEntryContent.js +60 -0
- package/lib/module/components/ui/TextEntryContent/TextEntryContent.js.map +1 -0
- package/lib/module/components/ui/TextEntryContent/index.js +4 -0
- package/lib/module/components/ui/TextEntryContent/index.js.map +1 -0
- package/lib/module/components/ui/TextEntryContent/styles.js +29 -0
- package/lib/module/components/ui/TextEntryContent/styles.js.map +1 -0
- package/lib/module/components/ui/TextEntryContent/types.js +4 -0
- package/lib/module/components/ui/TextEntryContent/types.js.map +1 -0
- package/lib/module/components/ui/index.js +5 -1
- package/lib/module/components/ui/index.js.map +1 -1
- package/lib/module/icons/data.js +87 -1
- package/lib/module/icons/data.js.map +1 -1
- package/lib/typescript/src/components/ui/ActionMenuContent/ActionMenuContent.d.ts +4 -0
- package/lib/typescript/src/components/ui/ActionMenuContent/ActionMenuContent.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/ActionMenuContent/index.d.ts +3 -0
- package/lib/typescript/src/components/ui/ActionMenuContent/index.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/ActionMenuContent/styles.d.ts +51 -0
- package/lib/typescript/src/components/ui/ActionMenuContent/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/ActionMenuContent/types.d.ts +25 -0
- package/lib/typescript/src/components/ui/ActionMenuContent/types.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Button/ButtonBase.d.ts +3 -1
- package/lib/typescript/src/components/ui/Button/ButtonBase.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/IconButton/IconButton.d.ts +1 -1
- package/lib/typescript/src/components/ui/IconButton/IconButton.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/IconButton/types.d.ts +4 -0
- package/lib/typescript/src/components/ui/IconButton/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/ImagePreview/ImagePreview.d.ts +3 -0
- package/lib/typescript/src/components/ui/ImagePreview/ImagePreview.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/ImagePreview/constants.d.ts +3 -0
- package/lib/typescript/src/components/ui/ImagePreview/constants.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/ImagePreview/index.d.ts +3 -0
- package/lib/typescript/src/components/ui/ImagePreview/index.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/ImagePreview/styles.d.ts +56 -0
- package/lib/typescript/src/components/ui/ImagePreview/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/ImagePreview/types.d.ts +33 -0
- package/lib/typescript/src/components/ui/ImagePreview/types.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Sheet/Sheet.d.ts +4 -0
- package/lib/typescript/src/components/ui/Sheet/Sheet.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Sheet/index.d.ts +3 -0
- package/lib/typescript/src/components/ui/Sheet/index.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Sheet/styles.d.ts +38 -0
- package/lib/typescript/src/components/ui/Sheet/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Sheet/types.d.ts +13 -0
- package/lib/typescript/src/components/ui/Sheet/types.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/SmsField/SmsField.d.ts +4 -0
- package/lib/typescript/src/components/ui/SmsField/SmsField.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/SmsField/index.d.ts +3 -0
- package/lib/typescript/src/components/ui/SmsField/index.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/SmsField/types.d.ts +12 -0
- package/lib/typescript/src/components/ui/SmsField/types.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/TextEntryContent/TextEntryContent.d.ts +4 -0
- package/lib/typescript/src/components/ui/TextEntryContent/TextEntryContent.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/TextEntryContent/index.d.ts +3 -0
- package/lib/typescript/src/components/ui/TextEntryContent/index.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/TextEntryContent/styles.d.ts +26 -0
- package/lib/typescript/src/components/ui/TextEntryContent/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/TextEntryContent/types.d.ts +18 -0
- package/lib/typescript/src/components/ui/TextEntryContent/types.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/index.d.ts +10 -2
- package/lib/typescript/src/components/ui/index.d.ts.map +1 -1
- package/lib/typescript/src/icons/data.d.ts +1 -1
- package/lib/typescript/src/icons/data.d.ts.map +1 -1
- package/lib/typescript/type-tests/content-api.d.ts +2 -0
- package/lib/typescript/type-tests/content-api.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/ui/ActionMenuContent/ActionMenuContent.tsx +118 -0
- package/src/components/ui/ActionMenuContent/index.ts +6 -0
- package/src/components/ui/ActionMenuContent/styles.ts +47 -0
- package/src/components/ui/ActionMenuContent/types.ts +27 -0
- package/src/components/ui/Button/ButtonBase.tsx +11 -2
- package/src/components/ui/IconButton/IconButton.tsx +9 -1
- package/src/components/ui/IconButton/types.ts +4 -0
- package/src/components/ui/ImagePreview/ImagePreview.tsx +243 -0
- package/src/components/ui/ImagePreview/constants.ts +2 -0
- package/src/components/ui/ImagePreview/index.ts +6 -0
- package/src/components/ui/ImagePreview/styles.ts +48 -0
- package/src/components/ui/ImagePreview/types.ts +37 -0
- package/src/components/ui/Sheet/Sheet.tsx +43 -0
- package/src/components/ui/Sheet/index.ts +2 -0
- package/src/components/ui/Sheet/styles.ts +40 -0
- package/src/components/ui/Sheet/types.ts +14 -0
- package/src/components/ui/SmsField/SmsField.tsx +40 -0
- package/src/components/ui/SmsField/index.ts +2 -0
- package/src/components/ui/SmsField/types.ts +15 -0
- package/src/components/ui/TextEntryContent/TextEntryContent.tsx +56 -0
- package/src/components/ui/TextEntryContent/index.ts +2 -0
- package/src/components/ui/TextEntryContent/styles.ts +17 -0
- package/src/components/ui/TextEntryContent/types.ts +18 -0
- package/src/components/ui/index.ts +18 -2
- package/src/icons/data.ts +134 -0
- package/lib/module/components/ui/BorderBeam/BorderBeam.js +0 -102
- package/lib/module/components/ui/BorderBeam/BorderBeam.js.map +0 -1
- package/lib/module/components/ui/BorderBeam/BorderBeam.web.js +0 -108
- package/lib/module/components/ui/BorderBeam/BorderBeam.web.js.map +0 -1
- package/lib/module/components/ui/BorderBeam/index.js +0 -4
- package/lib/module/components/ui/BorderBeam/index.js.map +0 -1
- package/lib/module/components/ui/BorderBeam/normalizeBorderBeam.js +0 -23
- package/lib/module/components/ui/BorderBeam/normalizeBorderBeam.js.map +0 -1
- package/lib/module/components/ui/BorderBeam/shared.js +0 -54
- package/lib/module/components/ui/BorderBeam/shared.js.map +0 -1
- package/lib/module/components/ui/BorderBeam/styles.js +0 -18
- package/lib/module/components/ui/BorderBeam/styles.js.map +0 -1
- package/lib/module/components/ui/BorderBeam/types.js.map +0 -1
- package/lib/typescript/src/components/ui/BorderBeam/BorderBeam.d.ts +0 -10
- package/lib/typescript/src/components/ui/BorderBeam/BorderBeam.d.ts.map +0 -1
- package/lib/typescript/src/components/ui/BorderBeam/BorderBeam.web.d.ts +0 -5
- package/lib/typescript/src/components/ui/BorderBeam/BorderBeam.web.d.ts.map +0 -1
- package/lib/typescript/src/components/ui/BorderBeam/index.d.ts +0 -3
- package/lib/typescript/src/components/ui/BorderBeam/index.d.ts.map +0 -1
- package/lib/typescript/src/components/ui/BorderBeam/normalizeBorderBeam.d.ts +0 -16
- package/lib/typescript/src/components/ui/BorderBeam/normalizeBorderBeam.d.ts.map +0 -1
- package/lib/typescript/src/components/ui/BorderBeam/shared.d.ts +0 -28
- package/lib/typescript/src/components/ui/BorderBeam/shared.d.ts.map +0 -1
- package/lib/typescript/src/components/ui/BorderBeam/styles.d.ts +0 -15
- package/lib/typescript/src/components/ui/BorderBeam/styles.d.ts.map +0 -1
- package/lib/typescript/src/components/ui/BorderBeam/types.d.ts +0 -23
- package/lib/typescript/src/components/ui/BorderBeam/types.d.ts.map +0 -1
- package/src/components/ui/BorderBeam/BorderBeam.tsx +0 -130
- package/src/components/ui/BorderBeam/BorderBeam.web.tsx +0 -127
- package/src/components/ui/BorderBeam/index.ts +0 -2
- package/src/components/ui/BorderBeam/normalizeBorderBeam.ts +0 -58
- package/src/components/ui/BorderBeam/shared.ts +0 -47
- package/src/components/ui/BorderBeam/styles.ts +0 -16
- package/src/components/ui/BorderBeam/types.ts +0 -23
- /package/lib/module/components/ui/{BorderBeam → ActionMenuContent}/types.js +0 -0
|
@@ -1,58 +0,0 @@
|
|
|
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: 2400,
|
|
10
|
-
lineWidth: 2,
|
|
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
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
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
|
-
const BORDER_BEAM_TRAIL = [
|
|
9
|
-
{ lengthRatio: 1, opacity: 0.12 },
|
|
10
|
-
{ lengthRatio: 0.75, opacity: 0.24 },
|
|
11
|
-
{ lengthRatio: 0.5, opacity: 0.42 },
|
|
12
|
-
{ lengthRatio: 0.25, opacity: 0.88 },
|
|
13
|
-
] as const;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 把单色线段拆成由淡到亮的叠加尾迹。
|
|
17
|
-
*
|
|
18
|
-
* 所有层共享同一动画相位,较短且更亮的层叠在前端,形成接近渐变的彗星头;
|
|
19
|
-
* 同时避免 SVG gradient 在 Native/Web 上的实现差异。
|
|
20
|
-
*/
|
|
21
|
-
export function borderBeamTrail(beamLength: number) {
|
|
22
|
-
const safeLength = Math.max(0, beamLength);
|
|
23
|
-
return BORDER_BEAM_TRAIL.map(({ lengthRatio, opacity }) => ({
|
|
24
|
-
length: safeLength * lengthRatio,
|
|
25
|
-
opacity,
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function borderBeamGeometry(input: {
|
|
30
|
-
layout: BorderBeamLayout;
|
|
31
|
-
lineWidth: number;
|
|
32
|
-
size: number;
|
|
33
|
-
borderRadius: number;
|
|
34
|
-
}) {
|
|
35
|
-
const { layout, lineWidth } = input;
|
|
36
|
-
const rectWidth = Math.max(0, layout.width - lineWidth);
|
|
37
|
-
const rectHeight = Math.max(0, layout.height - lineWidth);
|
|
38
|
-
const perimeter = Math.max(0, 2 * (rectWidth + rectHeight));
|
|
39
|
-
const beamLength = Math.min(input.size, perimeter / 2);
|
|
40
|
-
return {
|
|
41
|
-
beamLength,
|
|
42
|
-
perimeter,
|
|
43
|
-
rectHeight,
|
|
44
|
-
rectWidth,
|
|
45
|
-
radius: Math.min(input.borderRadius, rectWidth / 2, rectHeight / 2),
|
|
46
|
-
};
|
|
47
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
/** 绕边一周的时长(毫秒),默认 2400。 */
|
|
12
|
-
duration?: number;
|
|
13
|
-
/** 描边宽度,默认 2。 */
|
|
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
|
-
};
|
|
File without changes
|