@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.
Files changed (160) hide show
  1. package/lib/module/components/ui/ActionMenuContent/ActionMenuContent.js +97 -0
  2. package/lib/module/components/ui/ActionMenuContent/ActionMenuContent.js.map +1 -0
  3. package/lib/module/components/ui/ActionMenuContent/index.js +4 -0
  4. package/lib/module/components/ui/ActionMenuContent/index.js.map +1 -0
  5. package/lib/module/components/ui/ActionMenuContent/styles.js +54 -0
  6. package/lib/module/components/ui/ActionMenuContent/styles.js.map +1 -0
  7. package/lib/module/components/ui/ActionMenuContent/types.js.map +1 -0
  8. package/lib/module/components/ui/Button/ButtonBase.js +10 -2
  9. package/lib/module/components/ui/Button/ButtonBase.js.map +1 -1
  10. package/lib/module/components/ui/IconButton/IconButton.js +5 -1
  11. package/lib/module/components/ui/IconButton/IconButton.js.map +1 -1
  12. package/lib/module/components/ui/ImagePreview/ImagePreview.js +200 -0
  13. package/lib/module/components/ui/ImagePreview/ImagePreview.js.map +1 -0
  14. package/lib/module/components/ui/ImagePreview/constants.js +5 -0
  15. package/lib/module/components/ui/ImagePreview/constants.js.map +1 -0
  16. package/lib/module/components/ui/ImagePreview/index.js +4 -0
  17. package/lib/module/components/ui/ImagePreview/index.js.map +1 -0
  18. package/lib/module/components/ui/ImagePreview/styles.js +55 -0
  19. package/lib/module/components/ui/ImagePreview/styles.js.map +1 -0
  20. package/lib/module/components/ui/ImagePreview/types.js +4 -0
  21. package/lib/module/components/ui/ImagePreview/types.js.map +1 -0
  22. package/lib/module/components/ui/Sheet/Sheet.js +40 -0
  23. package/lib/module/components/ui/Sheet/Sheet.js.map +1 -0
  24. package/lib/module/components/ui/Sheet/index.js +4 -0
  25. package/lib/module/components/ui/Sheet/index.js.map +1 -0
  26. package/lib/module/components/ui/Sheet/styles.js +41 -0
  27. package/lib/module/components/ui/Sheet/styles.js.map +1 -0
  28. package/lib/module/components/ui/Sheet/types.js +4 -0
  29. package/lib/module/components/ui/Sheet/types.js.map +1 -0
  30. package/lib/module/components/ui/SmsField/SmsField.js +40 -0
  31. package/lib/module/components/ui/SmsField/SmsField.js.map +1 -0
  32. package/lib/module/components/ui/SmsField/index.js +4 -0
  33. package/lib/module/components/ui/SmsField/index.js.map +1 -0
  34. package/lib/module/components/ui/SmsField/types.js +4 -0
  35. package/lib/module/components/ui/SmsField/types.js.map +1 -0
  36. package/lib/module/components/ui/TextEntryContent/TextEntryContent.js +60 -0
  37. package/lib/module/components/ui/TextEntryContent/TextEntryContent.js.map +1 -0
  38. package/lib/module/components/ui/TextEntryContent/index.js +4 -0
  39. package/lib/module/components/ui/TextEntryContent/index.js.map +1 -0
  40. package/lib/module/components/ui/TextEntryContent/styles.js +29 -0
  41. package/lib/module/components/ui/TextEntryContent/styles.js.map +1 -0
  42. package/lib/module/components/ui/TextEntryContent/types.js +4 -0
  43. package/lib/module/components/ui/TextEntryContent/types.js.map +1 -0
  44. package/lib/module/components/ui/index.js +5 -1
  45. package/lib/module/components/ui/index.js.map +1 -1
  46. package/lib/module/icons/data.js +87 -1
  47. package/lib/module/icons/data.js.map +1 -1
  48. package/lib/typescript/src/components/ui/ActionMenuContent/ActionMenuContent.d.ts +4 -0
  49. package/lib/typescript/src/components/ui/ActionMenuContent/ActionMenuContent.d.ts.map +1 -0
  50. package/lib/typescript/src/components/ui/ActionMenuContent/index.d.ts +3 -0
  51. package/lib/typescript/src/components/ui/ActionMenuContent/index.d.ts.map +1 -0
  52. package/lib/typescript/src/components/ui/ActionMenuContent/styles.d.ts +51 -0
  53. package/lib/typescript/src/components/ui/ActionMenuContent/styles.d.ts.map +1 -0
  54. package/lib/typescript/src/components/ui/ActionMenuContent/types.d.ts +25 -0
  55. package/lib/typescript/src/components/ui/ActionMenuContent/types.d.ts.map +1 -0
  56. package/lib/typescript/src/components/ui/Button/ButtonBase.d.ts +3 -1
  57. package/lib/typescript/src/components/ui/Button/ButtonBase.d.ts.map +1 -1
  58. package/lib/typescript/src/components/ui/IconButton/IconButton.d.ts +1 -1
  59. package/lib/typescript/src/components/ui/IconButton/IconButton.d.ts.map +1 -1
  60. package/lib/typescript/src/components/ui/IconButton/types.d.ts +4 -0
  61. package/lib/typescript/src/components/ui/IconButton/types.d.ts.map +1 -1
  62. package/lib/typescript/src/components/ui/ImagePreview/ImagePreview.d.ts +3 -0
  63. package/lib/typescript/src/components/ui/ImagePreview/ImagePreview.d.ts.map +1 -0
  64. package/lib/typescript/src/components/ui/ImagePreview/constants.d.ts +3 -0
  65. package/lib/typescript/src/components/ui/ImagePreview/constants.d.ts.map +1 -0
  66. package/lib/typescript/src/components/ui/ImagePreview/index.d.ts +3 -0
  67. package/lib/typescript/src/components/ui/ImagePreview/index.d.ts.map +1 -0
  68. package/lib/typescript/src/components/ui/ImagePreview/styles.d.ts +56 -0
  69. package/lib/typescript/src/components/ui/ImagePreview/styles.d.ts.map +1 -0
  70. package/lib/typescript/src/components/ui/ImagePreview/types.d.ts +33 -0
  71. package/lib/typescript/src/components/ui/ImagePreview/types.d.ts.map +1 -0
  72. package/lib/typescript/src/components/ui/Sheet/Sheet.d.ts +4 -0
  73. package/lib/typescript/src/components/ui/Sheet/Sheet.d.ts.map +1 -0
  74. package/lib/typescript/src/components/ui/Sheet/index.d.ts +3 -0
  75. package/lib/typescript/src/components/ui/Sheet/index.d.ts.map +1 -0
  76. package/lib/typescript/src/components/ui/Sheet/styles.d.ts +38 -0
  77. package/lib/typescript/src/components/ui/Sheet/styles.d.ts.map +1 -0
  78. package/lib/typescript/src/components/ui/Sheet/types.d.ts +13 -0
  79. package/lib/typescript/src/components/ui/Sheet/types.d.ts.map +1 -0
  80. package/lib/typescript/src/components/ui/SmsField/SmsField.d.ts +4 -0
  81. package/lib/typescript/src/components/ui/SmsField/SmsField.d.ts.map +1 -0
  82. package/lib/typescript/src/components/ui/SmsField/index.d.ts +3 -0
  83. package/lib/typescript/src/components/ui/SmsField/index.d.ts.map +1 -0
  84. package/lib/typescript/src/components/ui/SmsField/types.d.ts +12 -0
  85. package/lib/typescript/src/components/ui/SmsField/types.d.ts.map +1 -0
  86. package/lib/typescript/src/components/ui/TextEntryContent/TextEntryContent.d.ts +4 -0
  87. package/lib/typescript/src/components/ui/TextEntryContent/TextEntryContent.d.ts.map +1 -0
  88. package/lib/typescript/src/components/ui/TextEntryContent/index.d.ts +3 -0
  89. package/lib/typescript/src/components/ui/TextEntryContent/index.d.ts.map +1 -0
  90. package/lib/typescript/src/components/ui/TextEntryContent/styles.d.ts +26 -0
  91. package/lib/typescript/src/components/ui/TextEntryContent/styles.d.ts.map +1 -0
  92. package/lib/typescript/src/components/ui/TextEntryContent/types.d.ts +18 -0
  93. package/lib/typescript/src/components/ui/TextEntryContent/types.d.ts.map +1 -0
  94. package/lib/typescript/src/components/ui/index.d.ts +10 -2
  95. package/lib/typescript/src/components/ui/index.d.ts.map +1 -1
  96. package/lib/typescript/src/icons/data.d.ts +1 -1
  97. package/lib/typescript/src/icons/data.d.ts.map +1 -1
  98. package/lib/typescript/type-tests/content-api.d.ts +2 -0
  99. package/lib/typescript/type-tests/content-api.d.ts.map +1 -0
  100. package/package.json +1 -1
  101. package/src/components/ui/ActionMenuContent/ActionMenuContent.tsx +118 -0
  102. package/src/components/ui/ActionMenuContent/index.ts +6 -0
  103. package/src/components/ui/ActionMenuContent/styles.ts +47 -0
  104. package/src/components/ui/ActionMenuContent/types.ts +27 -0
  105. package/src/components/ui/Button/ButtonBase.tsx +11 -2
  106. package/src/components/ui/IconButton/IconButton.tsx +9 -1
  107. package/src/components/ui/IconButton/types.ts +4 -0
  108. package/src/components/ui/ImagePreview/ImagePreview.tsx +243 -0
  109. package/src/components/ui/ImagePreview/constants.ts +2 -0
  110. package/src/components/ui/ImagePreview/index.ts +6 -0
  111. package/src/components/ui/ImagePreview/styles.ts +48 -0
  112. package/src/components/ui/ImagePreview/types.ts +37 -0
  113. package/src/components/ui/Sheet/Sheet.tsx +43 -0
  114. package/src/components/ui/Sheet/index.ts +2 -0
  115. package/src/components/ui/Sheet/styles.ts +40 -0
  116. package/src/components/ui/Sheet/types.ts +14 -0
  117. package/src/components/ui/SmsField/SmsField.tsx +40 -0
  118. package/src/components/ui/SmsField/index.ts +2 -0
  119. package/src/components/ui/SmsField/types.ts +15 -0
  120. package/src/components/ui/TextEntryContent/TextEntryContent.tsx +56 -0
  121. package/src/components/ui/TextEntryContent/index.ts +2 -0
  122. package/src/components/ui/TextEntryContent/styles.ts +17 -0
  123. package/src/components/ui/TextEntryContent/types.ts +18 -0
  124. package/src/components/ui/index.ts +18 -2
  125. package/src/icons/data.ts +134 -0
  126. package/lib/module/components/ui/BorderBeam/BorderBeam.js +0 -102
  127. package/lib/module/components/ui/BorderBeam/BorderBeam.js.map +0 -1
  128. package/lib/module/components/ui/BorderBeam/BorderBeam.web.js +0 -108
  129. package/lib/module/components/ui/BorderBeam/BorderBeam.web.js.map +0 -1
  130. package/lib/module/components/ui/BorderBeam/index.js +0 -4
  131. package/lib/module/components/ui/BorderBeam/index.js.map +0 -1
  132. package/lib/module/components/ui/BorderBeam/normalizeBorderBeam.js +0 -23
  133. package/lib/module/components/ui/BorderBeam/normalizeBorderBeam.js.map +0 -1
  134. package/lib/module/components/ui/BorderBeam/shared.js +0 -54
  135. package/lib/module/components/ui/BorderBeam/shared.js.map +0 -1
  136. package/lib/module/components/ui/BorderBeam/styles.js +0 -18
  137. package/lib/module/components/ui/BorderBeam/styles.js.map +0 -1
  138. package/lib/module/components/ui/BorderBeam/types.js.map +0 -1
  139. package/lib/typescript/src/components/ui/BorderBeam/BorderBeam.d.ts +0 -10
  140. package/lib/typescript/src/components/ui/BorderBeam/BorderBeam.d.ts.map +0 -1
  141. package/lib/typescript/src/components/ui/BorderBeam/BorderBeam.web.d.ts +0 -5
  142. package/lib/typescript/src/components/ui/BorderBeam/BorderBeam.web.d.ts.map +0 -1
  143. package/lib/typescript/src/components/ui/BorderBeam/index.d.ts +0 -3
  144. package/lib/typescript/src/components/ui/BorderBeam/index.d.ts.map +0 -1
  145. package/lib/typescript/src/components/ui/BorderBeam/normalizeBorderBeam.d.ts +0 -16
  146. package/lib/typescript/src/components/ui/BorderBeam/normalizeBorderBeam.d.ts.map +0 -1
  147. package/lib/typescript/src/components/ui/BorderBeam/shared.d.ts +0 -28
  148. package/lib/typescript/src/components/ui/BorderBeam/shared.d.ts.map +0 -1
  149. package/lib/typescript/src/components/ui/BorderBeam/styles.d.ts +0 -15
  150. package/lib/typescript/src/components/ui/BorderBeam/styles.d.ts.map +0 -1
  151. package/lib/typescript/src/components/ui/BorderBeam/types.d.ts +0 -23
  152. package/lib/typescript/src/components/ui/BorderBeam/types.d.ts.map +0 -1
  153. package/src/components/ui/BorderBeam/BorderBeam.tsx +0 -130
  154. package/src/components/ui/BorderBeam/BorderBeam.web.tsx +0 -127
  155. package/src/components/ui/BorderBeam/index.ts +0 -2
  156. package/src/components/ui/BorderBeam/normalizeBorderBeam.ts +0 -58
  157. package/src/components/ui/BorderBeam/shared.ts +0 -47
  158. package/src/components/ui/BorderBeam/styles.ts +0 -16
  159. package/src/components/ui/BorderBeam/types.ts +0 -23
  160. /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
- };