@unif/react-native-ui 0.1.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 (227) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +103 -0
  3. package/lib/module/README.md +99 -0
  4. package/lib/module/action-sheet/index.js +63 -0
  5. package/lib/module/action-sheet/index.js.map +1 -0
  6. package/lib/module/action-sheet/index.md +69 -0
  7. package/lib/module/action-sheet/style/index.js +38 -0
  8. package/lib/module/action-sheet/style/index.js.map +1 -0
  9. package/lib/module/avatar/index.js +42 -0
  10. package/lib/module/avatar/index.js.map +1 -0
  11. package/lib/module/avatar/index.md +51 -0
  12. package/lib/module/avatar/style/index.js +17 -0
  13. package/lib/module/avatar/style/index.js.map +1 -0
  14. package/lib/module/button/index.js +52 -0
  15. package/lib/module/button/index.js.map +1 -0
  16. package/lib/module/button/index.md +90 -0
  17. package/lib/module/button/style/index.js +94 -0
  18. package/lib/module/button/style/index.js.map +1 -0
  19. package/lib/module/center/index.js +21 -0
  20. package/lib/module/center/index.js.map +1 -0
  21. package/lib/module/center/index.md +28 -0
  22. package/lib/module/center/style/index.js +10 -0
  23. package/lib/module/center/style/index.js.map +1 -0
  24. package/lib/module/chip/index.js +59 -0
  25. package/lib/module/chip/index.js.map +1 -0
  26. package/lib/module/chip/index.md +60 -0
  27. package/lib/module/chip/style/index.js +40 -0
  28. package/lib/module/chip/style/index.js.map +1 -0
  29. package/lib/module/column/index.js +30 -0
  30. package/lib/module/column/index.js.map +1 -0
  31. package/lib/module/column/index.md +34 -0
  32. package/lib/module/column/style/index.js +9 -0
  33. package/lib/module/column/style/index.js.map +1 -0
  34. package/lib/module/divider/index.js +21 -0
  35. package/lib/module/divider/index.js.map +1 -0
  36. package/lib/module/divider/index.md +44 -0
  37. package/lib/module/divider/style/index.js +17 -0
  38. package/lib/module/divider/style/index.js.map +1 -0
  39. package/lib/module/hooks/index.js +4 -0
  40. package/lib/module/hooks/index.js.map +1 -0
  41. package/lib/module/hooks/index.md +71 -0
  42. package/lib/module/hooks/useMergeStyles.js +27 -0
  43. package/lib/module/hooks/useMergeStyles.js.map +1 -0
  44. package/lib/module/index.js +29 -0
  45. package/lib/module/index.js.map +1 -0
  46. package/lib/module/input/index.js +69 -0
  47. package/lib/module/input/index.js.map +1 -0
  48. package/lib/module/input/index.md +73 -0
  49. package/lib/module/input/style/index.js +27 -0
  50. package/lib/module/input/style/index.js.map +1 -0
  51. package/lib/module/list-item/index.js +69 -0
  52. package/lib/module/list-item/index.js.map +1 -0
  53. package/lib/module/list-item/index.md +101 -0
  54. package/lib/module/list-item/style/index.js +39 -0
  55. package/lib/module/list-item/style/index.js.map +1 -0
  56. package/lib/module/package.json +1 -0
  57. package/lib/module/popover/index.js +60 -0
  58. package/lib/module/popover/index.js.map +1 -0
  59. package/lib/module/popover/index.md +57 -0
  60. package/lib/module/popover/style/index.js +22 -0
  61. package/lib/module/popover/style/index.js.map +1 -0
  62. package/lib/module/row/index.js +31 -0
  63. package/lib/module/row/index.js.map +1 -0
  64. package/lib/module/row/index.md +46 -0
  65. package/lib/module/row/style/index.js +15 -0
  66. package/lib/module/row/style/index.js.map +1 -0
  67. package/lib/module/space/index.js +20 -0
  68. package/lib/module/space/index.js.map +1 -0
  69. package/lib/module/space/index.md +31 -0
  70. package/lib/module/space/style/index.js +9 -0
  71. package/lib/module/space/style/index.js.map +1 -0
  72. package/lib/module/text/index.js +30 -0
  73. package/lib/module/text/index.js.map +1 -0
  74. package/lib/module/text/index.md +63 -0
  75. package/lib/module/text/style/index.js +51 -0
  76. package/lib/module/text/style/index.js.map +1 -0
  77. package/lib/module/theme/config.js +27 -0
  78. package/lib/module/theme/config.js.map +1 -0
  79. package/lib/module/theme/tokens.js +67 -0
  80. package/lib/module/theme/tokens.js.map +1 -0
  81. package/lib/module/touchable/index.js +35 -0
  82. package/lib/module/touchable/index.js.map +1 -0
  83. package/lib/module/touchable/index.md +42 -0
  84. package/lib/module/touchable/style/index.js +9 -0
  85. package/lib/module/touchable/style/index.js.map +1 -0
  86. package/lib/module/wave-animation/index.js +67 -0
  87. package/lib/module/wave-animation/index.js.map +1 -0
  88. package/lib/module/wave-animation/index.md +50 -0
  89. package/lib/typescript/jest.setup.d.ts +1 -0
  90. package/lib/typescript/jest.setup.d.ts.map +1 -0
  91. package/lib/typescript/package.json +1 -0
  92. package/lib/typescript/src/action-sheet/index.d.ts +22 -0
  93. package/lib/typescript/src/action-sheet/index.d.ts.map +1 -0
  94. package/lib/typescript/src/action-sheet/style/index.d.ts +16 -0
  95. package/lib/typescript/src/action-sheet/style/index.d.ts.map +1 -0
  96. package/lib/typescript/src/avatar/index.d.ts +19 -0
  97. package/lib/typescript/src/avatar/index.d.ts.map +1 -0
  98. package/lib/typescript/src/avatar/style/index.d.ts +7 -0
  99. package/lib/typescript/src/avatar/style/index.d.ts.map +1 -0
  100. package/lib/typescript/src/button/index.d.ts +24 -0
  101. package/lib/typescript/src/button/index.d.ts.map +1 -0
  102. package/lib/typescript/src/button/style/index.d.ts +16 -0
  103. package/lib/typescript/src/button/style/index.d.ts.map +1 -0
  104. package/lib/typescript/src/center/index.d.ts +11 -0
  105. package/lib/typescript/src/center/index.d.ts.map +1 -0
  106. package/lib/typescript/src/center/style/index.d.ts +5 -0
  107. package/lib/typescript/src/center/style/index.d.ts.map +1 -0
  108. package/lib/typescript/src/chip/index.d.ts +22 -0
  109. package/lib/typescript/src/chip/index.d.ts.map +1 -0
  110. package/lib/typescript/src/chip/style/index.d.ts +10 -0
  111. package/lib/typescript/src/chip/style/index.d.ts.map +1 -0
  112. package/lib/typescript/src/column/index.d.ts +20 -0
  113. package/lib/typescript/src/column/index.d.ts.map +1 -0
  114. package/lib/typescript/src/column/style/index.d.ts +4 -0
  115. package/lib/typescript/src/column/style/index.d.ts.map +1 -0
  116. package/lib/typescript/src/divider/index.d.ts +13 -0
  117. package/lib/typescript/src/divider/index.d.ts.map +1 -0
  118. package/lib/typescript/src/divider/style/index.d.ts +9 -0
  119. package/lib/typescript/src/divider/style/index.d.ts.map +1 -0
  120. package/lib/typescript/src/hooks/index.d.ts +2 -0
  121. package/lib/typescript/src/hooks/index.d.ts.map +1 -0
  122. package/lib/typescript/src/hooks/useMergeStyles.d.ts +13 -0
  123. package/lib/typescript/src/hooks/useMergeStyles.d.ts.map +1 -0
  124. package/lib/typescript/src/index.d.ts +39 -0
  125. package/lib/typescript/src/index.d.ts.map +1 -0
  126. package/lib/typescript/src/input/index.d.ts +29 -0
  127. package/lib/typescript/src/input/index.d.ts.map +1 -0
  128. package/lib/typescript/src/input/style/index.d.ts +8 -0
  129. package/lib/typescript/src/input/style/index.d.ts.map +1 -0
  130. package/lib/typescript/src/list-item/index.d.ts +25 -0
  131. package/lib/typescript/src/list-item/index.d.ts.map +1 -0
  132. package/lib/typescript/src/list-item/style/index.d.ts +17 -0
  133. package/lib/typescript/src/list-item/style/index.d.ts.map +1 -0
  134. package/lib/typescript/src/popover/index.d.ts +27 -0
  135. package/lib/typescript/src/popover/index.d.ts.map +1 -0
  136. package/lib/typescript/src/popover/style/index.d.ts +7 -0
  137. package/lib/typescript/src/popover/style/index.d.ts.map +1 -0
  138. package/lib/typescript/src/row/index.d.ts +22 -0
  139. package/lib/typescript/src/row/index.d.ts.map +1 -0
  140. package/lib/typescript/src/row/style/index.d.ts +8 -0
  141. package/lib/typescript/src/row/style/index.d.ts.map +1 -0
  142. package/lib/typescript/src/space/index.d.ts +15 -0
  143. package/lib/typescript/src/space/index.d.ts.map +1 -0
  144. package/lib/typescript/src/space/style/index.d.ts +7 -0
  145. package/lib/typescript/src/space/style/index.d.ts.map +1 -0
  146. package/lib/typescript/src/text/index.d.ts +18 -0
  147. package/lib/typescript/src/text/index.d.ts.map +1 -0
  148. package/lib/typescript/src/text/style/index.d.ts +35 -0
  149. package/lib/typescript/src/text/style/index.d.ts.map +1 -0
  150. package/lib/typescript/src/theme/config.d.ts +18 -0
  151. package/lib/typescript/src/theme/config.d.ts.map +1 -0
  152. package/lib/typescript/src/theme/tokens.d.ts +61 -0
  153. package/lib/typescript/src/theme/tokens.d.ts.map +1 -0
  154. package/lib/typescript/src/touchable/index.d.ts +19 -0
  155. package/lib/typescript/src/touchable/index.d.ts.map +1 -0
  156. package/lib/typescript/src/touchable/style/index.d.ts +4 -0
  157. package/lib/typescript/src/touchable/style/index.d.ts.map +1 -0
  158. package/lib/typescript/src/wave-animation/index.d.ts +20 -0
  159. package/lib/typescript/src/wave-animation/index.d.ts.map +1 -0
  160. package/lib/typescript/tests/component/component.coverage.test.d.ts +2 -0
  161. package/lib/typescript/tests/component/component.coverage.test.d.ts.map +1 -0
  162. package/lib/typescript/tests/component/component.interaction.test.d.ts +2 -0
  163. package/lib/typescript/tests/component/component.interaction.test.d.ts.map +1 -0
  164. package/lib/typescript/tests/component/component.snapshot.test.d.ts +2 -0
  165. package/lib/typescript/tests/component/component.snapshot.test.d.ts.map +1 -0
  166. package/lib/typescript/tests/e2e/app.e2e.test.d.ts +2 -0
  167. package/lib/typescript/tests/e2e/app.e2e.test.d.ts.map +1 -0
  168. package/lib/typescript/tests/integration/ui.integration.test.d.ts +2 -0
  169. package/lib/typescript/tests/integration/ui.integration.test.d.ts.map +1 -0
  170. package/lib/typescript/tests/unit/mergeStyles.unit.test.d.ts +2 -0
  171. package/lib/typescript/tests/unit/mergeStyles.unit.test.d.ts.map +1 -0
  172. package/lib/typescript/tests/unit/public-api.unit.test.d.ts +2 -0
  173. package/lib/typescript/tests/unit/public-api.unit.test.d.ts.map +1 -0
  174. package/lib/typescript/tests/unit/theme-config.unit.test.d.ts +2 -0
  175. package/lib/typescript/tests/unit/theme-config.unit.test.d.ts.map +1 -0
  176. package/package.json +134 -0
  177. package/src/README.md +99 -0
  178. package/src/action-sheet/index.md +69 -0
  179. package/src/action-sheet/index.tsx +85 -0
  180. package/src/action-sheet/style/index.tsx +52 -0
  181. package/src/avatar/index.md +51 -0
  182. package/src/avatar/index.tsx +56 -0
  183. package/src/avatar/style/index.tsx +21 -0
  184. package/src/button/index.md +90 -0
  185. package/src/button/index.tsx +86 -0
  186. package/src/button/style/index.tsx +67 -0
  187. package/src/center/index.md +28 -0
  188. package/src/center/index.tsx +18 -0
  189. package/src/center/style/index.tsx +8 -0
  190. package/src/chip/index.md +60 -0
  191. package/src/chip/index.tsx +80 -0
  192. package/src/chip/style/index.tsx +47 -0
  193. package/src/column/index.md +34 -0
  194. package/src/column/index.tsx +43 -0
  195. package/src/column/style/index.tsx +7 -0
  196. package/src/divider/index.md +44 -0
  197. package/src/divider/index.tsx +30 -0
  198. package/src/divider/style/index.tsx +13 -0
  199. package/src/hooks/index.md +71 -0
  200. package/src/hooks/index.ts +1 -0
  201. package/src/hooks/useMergeStyles.ts +27 -0
  202. package/src/index.tsx +49 -0
  203. package/src/input/index.md +73 -0
  204. package/src/input/index.tsx +95 -0
  205. package/src/input/style/index.tsx +32 -0
  206. package/src/list-item/index.md +101 -0
  207. package/src/list-item/index.tsx +91 -0
  208. package/src/list-item/style/index.tsx +41 -0
  209. package/src/popover/index.md +57 -0
  210. package/src/popover/index.tsx +80 -0
  211. package/src/popover/style/index.tsx +23 -0
  212. package/src/row/index.md +46 -0
  213. package/src/row/index.tsx +47 -0
  214. package/src/row/style/index.tsx +14 -0
  215. package/src/space/index.md +31 -0
  216. package/src/space/index.tsx +28 -0
  217. package/src/space/style/index.tsx +3 -0
  218. package/src/text/index.md +63 -0
  219. package/src/text/index.tsx +45 -0
  220. package/src/text/style/index.tsx +32 -0
  221. package/src/theme/config.ts +26 -0
  222. package/src/theme/tokens.ts +66 -0
  223. package/src/touchable/index.md +42 -0
  224. package/src/touchable/index.tsx +45 -0
  225. package/src/touchable/style/index.tsx +5 -0
  226. package/src/wave-animation/index.md +50 -0
  227. package/src/wave-animation/index.tsx +93 -0
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Input 基础组件
5
+ *
6
+ * TextInput 容器,支持多行、工具栏插槽、自动聚焦。
7
+ */
8
+
9
+ import React, { useRef, useEffect, useMemo, forwardRef } from 'react';
10
+ import { View, TextInput } from 'react-native';
11
+ import { mergeStyles } from "../hooks/index.js";
12
+ import { tokens } from "../theme/tokens.js";
13
+ import { DEFAULT_STYLES } from "./style/index.js";
14
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
+ const Input = /*#__PURE__*/forwardRef(({
16
+ value,
17
+ onChangeText,
18
+ placeholder,
19
+ multiline = false,
20
+ maxLength,
21
+ maxHeight,
22
+ autoFocus,
23
+ returnKeyType,
24
+ onSubmitEditing,
25
+ onBlur,
26
+ onFocus,
27
+ disabled,
28
+ toolbar,
29
+ style,
30
+ styles: semanticStyles,
31
+ testID
32
+ }, ref) => {
33
+ const inputRef = useRef(null);
34
+ React.useImperativeHandle(ref, () => inputRef.current);
35
+ const s = useMemo(() => mergeStyles(DEFAULT_STYLES, semanticStyles), [semanticStyles]);
36
+ useEffect(() => {
37
+ if (autoFocus) {
38
+ inputRef.current?.focus();
39
+ }
40
+ }, [autoFocus]);
41
+ return /*#__PURE__*/_jsxs(View, {
42
+ style: [s.root, style],
43
+ children: [/*#__PURE__*/_jsx(TextInput, {
44
+ ref: inputRef,
45
+ testID: testID,
46
+ style: [s.input, maxHeight ? {
47
+ maxHeight
48
+ } : undefined],
49
+ value: value,
50
+ onChangeText: onChangeText,
51
+ placeholder: placeholder,
52
+ placeholderTextColor: tokens.colorTextPlaceholder,
53
+ multiline: multiline,
54
+ maxLength: maxLength,
55
+ returnKeyType: returnKeyType,
56
+ onSubmitEditing: onSubmitEditing,
57
+ onBlur: onBlur,
58
+ onFocus: onFocus,
59
+ editable: !disabled,
60
+ blurOnSubmit: false
61
+ }), toolbar && /*#__PURE__*/_jsx(View, {
62
+ style: s.toolbar,
63
+ children: toolbar
64
+ })]
65
+ });
66
+ });
67
+ Input.displayName = 'Input';
68
+ export default Input;
69
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useRef","useEffect","useMemo","forwardRef","View","TextInput","mergeStyles","tokens","DEFAULT_STYLES","jsx","_jsx","jsxs","_jsxs","Input","value","onChangeText","placeholder","multiline","maxLength","maxHeight","autoFocus","returnKeyType","onSubmitEditing","onBlur","onFocus","disabled","toolbar","style","styles","semanticStyles","testID","ref","inputRef","useImperativeHandle","current","s","focus","root","children","input","undefined","placeholderTextColor","colorTextPlaceholder","editable","blurOnSubmit","displayName"],"sourceRoot":"../../../src","sources":["input/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,MAAM,EAAEC,SAAS,EAAEC,OAAO,EAAEC,UAAU,QAAQ,OAAO;AACrE,SAASC,IAAI,EAAEC,SAAS,QAAQ,cAAc;AAE9C,SAASC,WAAW,QAAQ,mBAAU;AACtC,SAASC,MAAM,QAAQ,oBAAiB;AAExC,SAASC,cAAc,QAAQ,kBAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAuBzC,MAAMC,KAAK,gBAAGV,UAAU,CAAuB,CAAC;EAC9CW,KAAK;EACLC,YAAY;EACZC,WAAW;EACXC,SAAS,GAAG,KAAK;EACjBC,SAAS;EACTC,SAAS;EACTC,SAAS;EACTC,aAAa;EACbC,eAAe;EACfC,MAAM;EACNC,OAAO;EACPC,QAAQ;EACRC,OAAO;EACPC,KAAK;EACLC,MAAM,EAAEC,cAAc;EACtBC;AACF,CAAC,EAAEC,GAAG,KAAK;EACT,MAAMC,QAAQ,GAAGhC,MAAM,CAAW,IAAI,CAAC;EAEvCD,KAAK,CAACkC,mBAAmB,CAACF,GAAG,EAAE,MAAMC,QAAQ,CAACE,OAAmB,CAAC;EAElE,MAAMC,CAAC,GAAGjC,OAAO,CACf,MAAMI,WAAW,CAAsBE,cAAc,EAAEqB,cAAc,CAAC,EACtE,CAACA,cAAc,CACjB,CAAC;EAED5B,SAAS,CAAC,MAAM;IACd,IAAImB,SAAS,EAAE;MACbY,QAAQ,CAACE,OAAO,EAAEE,KAAK,CAAC,CAAC;IAC3B;EACF,CAAC,EAAE,CAAChB,SAAS,CAAC,CAAC;EAEf,oBACER,KAAA,CAACR,IAAI;IAACuB,KAAK,EAAE,CAACQ,CAAC,CAACE,IAAI,EAAEV,KAAK,CAAE;IAAAW,QAAA,gBAC3B5B,IAAA,CAACL,SAAS;MACR0B,GAAG,EAAEC,QAAS;MACdF,MAAM,EAAEA,MAAO;MACfH,KAAK,EAAE,CAACQ,CAAC,CAACI,KAAK,EAAEpB,SAAS,GAAG;QAAEA;MAAU,CAAC,GAAGqB,SAAS,CAAE;MACxD1B,KAAK,EAAEA,KAAM;MACbC,YAAY,EAAEA,YAAa;MAC3BC,WAAW,EAAEA,WAAY;MACzByB,oBAAoB,EAAElC,MAAM,CAACmC,oBAAqB;MAClDzB,SAAS,EAAEA,SAAU;MACrBC,SAAS,EAAEA,SAAU;MACrBG,aAAa,EAAEA,aAAc;MAC7BC,eAAe,EAAEA,eAAgB;MACjCC,MAAM,EAAEA,MAAO;MACfC,OAAO,EAAEA,OAAQ;MACjBmB,QAAQ,EAAE,CAAClB,QAAS;MACpBmB,YAAY,EAAE;IAAM,CACrB,CAAC,EACDlB,OAAO,iBAAIhB,IAAA,CAACN,IAAI;MAACuB,KAAK,EAAEQ,CAAC,CAACT,OAAQ;MAAAY,QAAA,EAAEZ;IAAO,CAAO,CAAC;EAAA,CAChD,CAAC;AAEX,CAAC,CAAC;AAEFb,KAAK,CAACgC,WAAW,GAAG,OAAO;AAE3B,eAAehC,KAAK","ignoreList":[]}
@@ -0,0 +1,73 @@
1
+ ---
2
+ title: Input
3
+ nav:
4
+ title: 组件
5
+ order: 1
6
+ group:
7
+ title: 基础
8
+ order: 2
9
+ ---
10
+
11
+ # Input 输入框
12
+
13
+ TextInput 容器,支持多行输入、底部工具栏和自动聚焦。
14
+
15
+ ## 何时使用
16
+
17
+ - 需要文本输入时
18
+ - 需要带工具栏的输入框时
19
+ - 聊天输入场景
20
+
21
+ ## 代码演示
22
+
23
+ ```tsx
24
+ import { Input, Icon } from '@unif/react-native-ui';
25
+
26
+ // 基本用法
27
+ <Input
28
+ value={text}
29
+ onChangeText={setText}
30
+ placeholder="请输入..."
31
+ />
32
+
33
+ // 多行 + 工具栏
34
+ <Input
35
+ multiline
36
+ maxHeight={100}
37
+ autoFocus
38
+ toolbar={
39
+ <View style={{ flexDirection: 'row' }}>
40
+ <Icon name="mic-outline" size={24} />
41
+ </View>
42
+ }
43
+ />
44
+ ```
45
+
46
+ ## API
47
+
48
+ | 属性 | 说明 | 类型 | 默认值 |
49
+ | --------------- | ---------------- | ---------------------- | ------- |
50
+ | value | 输入值 | `string` | - |
51
+ | onChangeText | 文本变化回调 | `(text: string) => void` | - |
52
+ | placeholder | 占位文本 | `string` | - |
53
+ | multiline | 多行模式 | `boolean` | `false` |
54
+ | maxLength | 最大字符数 | `number` | - |
55
+ | maxHeight | 最大高度 | `number` | - |
56
+ | autoFocus | 自动聚焦 | `boolean` | - |
57
+ | returnKeyType | 回车键类型 | `ReturnKeyTypeOptions` | - |
58
+ | onSubmitEditing | 提交回调 | `() => void` | - |
59
+ | onBlur | 失焦回调 | `() => void` | - |
60
+ | onFocus | 聚焦回调 | `() => void` | - |
61
+ | disabled | 禁用状态 | `boolean` | - |
62
+ | toolbar | 底部工具栏 | `ReactNode` | - |
63
+ | style | 容器样式 | `ViewStyle` | - |
64
+ | styles | 语义样式 | `InputSemanticStyles` | - |
65
+ | testID | 测试标识 | `string` | - |
66
+
67
+ ## Semantic Styles
68
+
69
+ | Slot | 说明 |
70
+ | ------- | -------------- |
71
+ | root | 外层容器 |
72
+ | input | TextInput 本身 |
73
+ | toolbar | 工具栏容器 |
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ import { Platform } from 'react-native';
4
+ import { tokens } from "../../theme/tokens.js";
5
+ export const DEFAULT_STYLES = {
6
+ root: {
7
+ backgroundColor: tokens.colorBgElevated,
8
+ borderRadius: tokens.radiusXl,
9
+ paddingHorizontal: 12,
10
+ paddingTop: 8,
11
+ paddingBottom: 6,
12
+ ...tokens.shadow
13
+ },
14
+ input: {
15
+ fontSize: tokens.fontSize,
16
+ color: tokens.colorText,
17
+ lineHeight: tokens.lineHeight,
18
+ paddingVertical: Platform.OS === 'ios' ? 4 : 2,
19
+ paddingHorizontal: 4
20
+ },
21
+ toolbar: {
22
+ flexDirection: 'row',
23
+ alignItems: 'center',
24
+ paddingTop: 4
25
+ }
26
+ };
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","tokens","DEFAULT_STYLES","root","backgroundColor","colorBgElevated","borderRadius","radiusXl","paddingHorizontal","paddingTop","paddingBottom","shadow","input","fontSize","color","colorText","lineHeight","paddingVertical","OS","toolbar","flexDirection","alignItems"],"sourceRoot":"../../../../src","sources":["input/style/index.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,SAASC,MAAM,QAAQ,uBAAoB;AAQ3C,OAAO,MAAMC,cAAmC,GAAG;EACjDC,IAAI,EAAE;IACJC,eAAe,EAAEH,MAAM,CAACI,eAAe;IACvCC,YAAY,EAAEL,MAAM,CAACM,QAAQ;IAC7BC,iBAAiB,EAAE,EAAE;IACrBC,UAAU,EAAE,CAAC;IACbC,aAAa,EAAE,CAAC;IAChB,GAAGT,MAAM,CAACU;EACZ,CAAC;EACDC,KAAK,EAAE;IACLC,QAAQ,EAAEZ,MAAM,CAACY,QAAQ;IACzBC,KAAK,EAAEb,MAAM,CAACc,SAAS;IACvBC,UAAU,EAAEf,MAAM,CAACe,UAAU;IAC7BC,eAAe,EAAEjB,QAAQ,CAACkB,EAAE,KAAK,KAAK,GAAG,CAAC,GAAG,CAAC;IAC9CV,iBAAiB,EAAE;EACrB,CAAC;EACDW,OAAO,EAAE;IACPC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBZ,UAAU,EAAE;EACd;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * 列表行组件
5
+ *
6
+ * 语义 slot:root / content / description / extra。
7
+ */
8
+
9
+ import React, { useMemo } from 'react';
10
+ import { View, Text, Pressable } from 'react-native';
11
+ import { mergeStyles } from "../hooks/index.js";
12
+ import { tokens } from "../theme/tokens.js";
13
+ import { DEFAULT_SEMANTIC, lineStyle, contentWrapStyle } from "./style/index.js";
14
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
+ const defaultArrowStyle = {
16
+ fontSize: 18,
17
+ color: tokens.colorTextSecondary
18
+ };
19
+ const ListItem = ({
20
+ thumb,
21
+ title,
22
+ description,
23
+ extra,
24
+ arrow,
25
+ arrowIcon,
26
+ style,
27
+ styles: semanticStyles,
28
+ ...props
29
+ }) => {
30
+ const s = useMemo(() => mergeStyles(DEFAULT_SEMANTIC, semanticStyles), [semanticStyles]);
31
+ const content = /*#__PURE__*/_jsxs(View, {
32
+ style: [s.root, style],
33
+ children: [thumb, /*#__PURE__*/_jsxs(View, {
34
+ style: lineStyle,
35
+ children: [/*#__PURE__*/_jsxs(View, {
36
+ style: contentWrapStyle,
37
+ children: [typeof title === 'string' ? /*#__PURE__*/_jsx(Text, {
38
+ style: s.content,
39
+ children: title
40
+ }) : title, description != null && /*#__PURE__*/_jsx(Text, {
41
+ style: s.description,
42
+ numberOfLines: 1,
43
+ children: description
44
+ })]
45
+ }), extra != null && (typeof extra === 'string' ? /*#__PURE__*/_jsx(Text, {
46
+ style: s.extra,
47
+ children: extra
48
+ }) : /*#__PURE__*/_jsx(View, {
49
+ style: s.extra,
50
+ children: extra
51
+ })), arrow && (arrowIcon ?? /*#__PURE__*/_jsx(Text, {
52
+ style: defaultArrowStyle,
53
+ children: "\u203A"
54
+ }))]
55
+ })]
56
+ });
57
+ if (props.onPress) {
58
+ return /*#__PURE__*/_jsx(Pressable, {
59
+ onPress: props.onPress,
60
+ onLongPress: props.onLongPress,
61
+ disabled: props.disabled,
62
+ testID: props.testID,
63
+ children: content
64
+ });
65
+ }
66
+ return content;
67
+ };
68
+ export default ListItem;
69
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useMemo","View","Text","Pressable","mergeStyles","tokens","DEFAULT_SEMANTIC","lineStyle","contentWrapStyle","jsx","_jsx","jsxs","_jsxs","defaultArrowStyle","fontSize","color","colorTextSecondary","ListItem","thumb","title","description","extra","arrow","arrowIcon","style","styles","semanticStyles","props","s","content","root","children","numberOfLines","onPress","onLongPress","disabled","testID"],"sourceRoot":"../../../src","sources":["list-item/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,IAAI,EAAEC,IAAI,EAAEC,SAAS,QAAQ,cAAc;AAEpD,SAASC,WAAW,QAAQ,mBAAU;AACtC,SAASC,MAAM,QAAQ,oBAAiB;AAExC,SAASC,gBAAgB,EAAEC,SAAS,EAAEC,gBAAgB,QAAQ,kBAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAiBxE,MAAMC,iBAAiB,GAAG;EAAEC,QAAQ,EAAE,EAAE;EAAEC,KAAK,EAAEV,MAAM,CAACW;AAAmB,CAAC;AAE5E,MAAMC,QAAiC,GAAGA,CAAC;EACzCC,KAAK;EACLC,KAAK;EACLC,WAAW;EACXC,KAAK;EACLC,KAAK;EACLC,SAAS;EACTC,KAAK;EACLC,MAAM,EAAEC,cAAc;EACtB,GAAGC;AACU,CAAC,KAAK;EACnB,MAAMC,CAAC,GAAG5B,OAAO,CACf,MAAMI,WAAW,CAACE,gBAAgB,EAAEoB,cAAc,CAAC,EACnD,CAACA,cAAc,CACjB,CAAC;EAED,MAAMG,OAAO,gBACXjB,KAAA,CAACX,IAAI;IAACuB,KAAK,EAAE,CAACI,CAAC,CAACE,IAAI,EAAEN,KAAK,CAAE;IAAAO,QAAA,GAC1Bb,KAAK,eACNN,KAAA,CAACX,IAAI;MAACuB,KAAK,EAAEjB,SAAU;MAAAwB,QAAA,gBACrBnB,KAAA,CAACX,IAAI;QAACuB,KAAK,EAAEhB,gBAAiB;QAAAuB,QAAA,GAC3B,OAAOZ,KAAK,KAAK,QAAQ,gBACxBT,IAAA,CAACR,IAAI;UAACsB,KAAK,EAAEI,CAAC,CAACC,OAAQ;UAAAE,QAAA,EAAEZ;QAAK,CAAO,CAAC,GAEtCA,KACD,EACAC,WAAW,IAAI,IAAI,iBAClBV,IAAA,CAACR,IAAI;UAACsB,KAAK,EAAEI,CAAC,CAACR,WAAY;UAACY,aAAa,EAAE,CAAE;UAAAD,QAAA,EAC1CX;QAAW,CACR,CACP;MAAA,CACG,CAAC,EACNC,KAAK,IAAI,IAAI,KACX,OAAOA,KAAK,KAAK,QAAQ,gBACxBX,IAAA,CAACR,IAAI;QAACsB,KAAK,EAAEI,CAAC,CAACP,KAAmB;QAAAU,QAAA,EAAEV;MAAK,CAAO,CAAC,gBAEjDX,IAAA,CAACT,IAAI;QAACuB,KAAK,EAAEI,CAAC,CAACP,KAAmB;QAAAU,QAAA,EAAEV;MAAK,CAAO,CACjD,CAAC,EACHC,KAAK,KACHC,SAAS,iBAAIb,IAAA,CAACR,IAAI;QAACsB,KAAK,EAAEX,iBAAkB;QAAAkB,QAAA,EAAC;MAAC,CAAM,CAAC,CAAC;IAAA,CACrD,CAAC;EAAA,CACH,CACP;EAED,IAAIJ,KAAK,CAACM,OAAO,EAAE;IACjB,oBACEvB,IAAA,CAACP,SAAS;MACR8B,OAAO,EAAEN,KAAK,CAACM,OAAQ;MACvBC,WAAW,EAAEP,KAAK,CAACO,WAAY;MAC/BC,QAAQ,EAAER,KAAK,CAACQ,QAAS;MACzBC,MAAM,EAAET,KAAK,CAACS,MAAO;MAAAL,QAAA,EAEpBF;IAAO,CACC,CAAC;EAEhB;EACA,OAAOA,OAAO;AAChB,CAAC;AAED,eAAeZ,QAAQ","ignoreList":[]}
@@ -0,0 +1,101 @@
1
+ # ListItem 列表行
2
+
3
+ 4 个语义 slot(root / content / description / extra),支持 `styles` 精确覆盖。
4
+
5
+ ## 何时使用
6
+
7
+ - 替代 `<TouchableOpacity>` + icon + text + arrow 的手写列表行
8
+ - 统一列表行样式:设置菜单、选择列表、会话列表等
9
+
10
+ ## 代码演示
11
+
12
+ ```tsx
13
+ // 基础 — 带箭头
14
+ <ListItem title="关于" arrow onPress={handleAbout} />
15
+
16
+ // 带右侧额外信息
17
+ <ListItem title="关于" extra="v1.0.0" onPress={handleAbout} />
18
+
19
+ // 带左侧图标
20
+ <ListItem
21
+ thumb={<Icon name="information-circle-outline" size={22} color={tokens.colorTextSecondary} />}
22
+ title="关于"
23
+ extra="v1.0.0"
24
+ onPress={handleAbout}
25
+ />
26
+
27
+ // 带描述文字(双行)
28
+ <ListItem
29
+ thumb={<Icon name="chatbubble-outline" size={16} />}
30
+ title="今天的会话"
31
+ description="最后一条消息预览..."
32
+ onPress={handleSelect}
33
+ onLongPress={handleDelete}
34
+ />
35
+
36
+ // 语义插槽覆盖 — 选中态
37
+ <ListItem
38
+ title={model.name}
39
+ description={model.desc}
40
+ extra={isSelected ? <Icon name="checkmark-circle" size={22} color={tokens.colorPrimary} /> : undefined}
41
+ onPress={() => handleSelect(model.id)}
42
+ styles={isSelected ? {
43
+ root: {backgroundColor: '#FFF7F0'},
44
+ content: {color: tokens.colorPrimary},
45
+ } : undefined}
46
+ />
47
+
48
+ // 语义插槽覆盖 — 危险操作
49
+ <ListItem
50
+ thumb={<Icon name="log-out-outline" size={22} color={tokens.colorError} />}
51
+ title="退出登录"
52
+ onPress={handleLogout}
53
+ styles={{content: {color: tokens.colorError}}}
54
+ />
55
+ ```
56
+
57
+ ## API
58
+
59
+ | 属性 | 说明 | 类型 | 默认值 |
60
+ |------|------|------|--------|
61
+ | thumb | 左侧缩略(图标、头像等) | `ReactNode` | - |
62
+ | title | 主标题 | `string` \| `ReactNode` | **必填** |
63
+ | description | 描述文字(单行截断) | `string` | - |
64
+ | extra | 右侧额外内容 | `ReactNode` \| `string` | - |
65
+ | arrow | 显示右箭头 | `boolean` | `false` |
66
+ | onPress | 点击回调(有值时渲染为 Pressable) | `() => void` | - |
67
+ | onLongPress | 长按回调 | `() => void` | - |
68
+ | disabled | 禁用状态 | `boolean` | `false` |
69
+ | style | 外层容器样式 | `ViewStyle` | - |
70
+ | styles | 语义插槽样式 | `Partial<ListItemSemanticStyles>` | - |
71
+ | testID | 测试标识 | `string` | - |
72
+
73
+ ## Semantic Styles
74
+
75
+ 通过 `styles` prop 精确覆盖组件内部各 slot 的样式。
76
+
77
+ | 插槽 | 类型 | 说明 |
78
+ |------|------|------|
79
+ | root | `ViewStyle` | 整行容器(padding、背景等) |
80
+ | content | `TextStyle` | 主标题文字(字号、颜色、flex 等) |
81
+ | description | `TextStyle` | 描述文字(字号、颜色等) |
82
+ | extra | `ViewStyle & TextStyle` | 右侧额外内容区域 |
83
+
84
+ ## 内部布局
85
+
86
+ ```
87
+ ┌─ root ──────────────────────────────────┐
88
+ │ [thumb] ┌─ line ─────────────────────┐ │
89
+ │ │ ┌─ contentWrap ──────────┐ │ │
90
+ │ │ │ [content] │ │ │
91
+ │ │ │ [description] │ │ │
92
+ │ │ └────────────────────────┘ │ │
93
+ │ │ [extra] [arrow] │ │
94
+ │ └────────────────────────────┘ │
95
+ └─────────────────────────────────────────┘
96
+ ```
97
+
98
+ ## 交互行为
99
+
100
+ - 有 `onPress` 时自动包裹 `Pressable`,无 `onPress` 时渲染为纯 `View`
101
+ - `onLongPress` 仅在有 `onPress` 时生效
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ import { StyleSheet } from 'react-native';
4
+ import { tokens } from "../../theme/tokens.js";
5
+ export const DEFAULT_SEMANTIC = {
6
+ root: {
7
+ flexDirection: 'row',
8
+ alignItems: 'center',
9
+ paddingHorizontal: 16,
10
+ paddingVertical: 14
11
+ },
12
+ content: {
13
+ fontSize: 15,
14
+ color: tokens.colorText,
15
+ flex: 1
16
+ },
17
+ description: {
18
+ fontSize: 12,
19
+ color: tokens.colorTextSecondary,
20
+ marginTop: 2
21
+ },
22
+ extra: {
23
+ color: tokens.colorTextSecondary,
24
+ fontSize: 14
25
+ }
26
+ };
27
+ export const lineStyle = StyleSheet.create({
28
+ s: {
29
+ flex: 1,
30
+ flexDirection: 'row',
31
+ alignItems: 'center'
32
+ }
33
+ }).s;
34
+ export const contentWrapStyle = StyleSheet.create({
35
+ s: {
36
+ flex: 1
37
+ }
38
+ }).s;
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StyleSheet","tokens","DEFAULT_SEMANTIC","root","flexDirection","alignItems","paddingHorizontal","paddingVertical","content","fontSize","color","colorText","flex","description","colorTextSecondary","marginTop","extra","lineStyle","create","s","contentWrapStyle"],"sourceRoot":"../../../../src","sources":["list-item/style/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AAEzC,SAASC,MAAM,QAAQ,uBAAoB;AAS3C,OAAO,MAAMC,gBAAwC,GAAG;EACtDC,IAAI,EAAE;IACJC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE;EACnB,CAAC;EACDC,OAAO,EAAE;IACPC,QAAQ,EAAE,EAAE;IACZC,KAAK,EAAET,MAAM,CAACU,SAAS;IACvBC,IAAI,EAAE;EACR,CAAC;EACDC,WAAW,EAAE;IACXJ,QAAQ,EAAE,EAAE;IACZC,KAAK,EAAET,MAAM,CAACa,kBAAkB;IAChCC,SAAS,EAAE;EACb,CAAC;EACDC,KAAK,EAAE;IACLN,KAAK,EAAET,MAAM,CAACa,kBAAkB;IAChCL,QAAQ,EAAE;EACZ;AACF,CAAC;AAED,OAAO,MAAMQ,SAAS,GAAGjB,UAAU,CAACkB,MAAM,CAAC;EACzCC,CAAC,EAAE;IAAEP,IAAI,EAAE,CAAC;IAAER,aAAa,EAAE,KAAK;IAAEC,UAAU,EAAE;EAAS;AAC3D,CAAC,CAAC,CAACc,CAAC;AAEJ,OAAO,MAAMC,gBAAgB,GAAGpB,UAAU,CAACkB,MAAM,CAAC;EAChDC,CAAC,EAAE;IAAEP,IAAI,EAAE;EAAE;AACf,CAAC,CAAC,CAACO,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Popover 基础组件
5
+ *
6
+ * 锚定定位下拉容器,仅做定位,内容由 children 传入。
7
+ */
8
+
9
+ import React, { useMemo } from 'react';
10
+ import { View, TouchableWithoutFeedback, Modal } from 'react-native';
11
+ import { mergeStyles } from "../hooks/index.js";
12
+ import { DEFAULT_STYLES } from "./style/index.js";
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ const GAP = 4;
15
+ const Popover = ({
16
+ visible,
17
+ onClose,
18
+ anchorLayout,
19
+ width = 180,
20
+ placement = 'bottom',
21
+ children,
22
+ style,
23
+ styles: semanticStyles,
24
+ testID
25
+ }) => {
26
+ const s = useMemo(() => mergeStyles(DEFAULT_STYLES, semanticStyles), [semanticStyles]);
27
+ if (!visible) {
28
+ return null;
29
+ }
30
+ const positionStyle = placement === 'bottom' ? {
31
+ top: anchorLayout.y + anchorLayout.height + GAP,
32
+ left: anchorLayout.x
33
+ } : {
34
+ bottom: anchorLayout.y - GAP,
35
+ left: anchorLayout.x
36
+ };
37
+ return /*#__PURE__*/_jsx(Modal, {
38
+ visible: visible,
39
+ transparent: true,
40
+ animationType: "fade",
41
+ onRequestClose: onClose,
42
+ children: /*#__PURE__*/_jsx(TouchableWithoutFeedback, {
43
+ onPress: onClose,
44
+ children: /*#__PURE__*/_jsx(View, {
45
+ style: s.overlay,
46
+ children: /*#__PURE__*/_jsx(TouchableWithoutFeedback, {
47
+ children: /*#__PURE__*/_jsx(View, {
48
+ style: [s.content, positionStyle, {
49
+ width
50
+ }, style],
51
+ testID: testID,
52
+ children: children
53
+ })
54
+ })
55
+ })
56
+ })
57
+ });
58
+ };
59
+ export default Popover;
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useMemo","View","TouchableWithoutFeedback","Modal","mergeStyles","DEFAULT_STYLES","jsx","_jsx","GAP","Popover","visible","onClose","anchorLayout","width","placement","children","style","styles","semanticStyles","testID","s","positionStyle","top","y","height","left","x","bottom","transparent","animationType","onRequestClose","onPress","overlay","content"],"sourceRoot":"../../../src","sources":["popover/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SACEC,IAAI,EACJC,wBAAwB,EACxBC,KAAK,QACA,cAAc;AAErB,SAASC,WAAW,QAAQ,mBAAU;AAEtC,SAASC,cAAc,QAAQ,kBAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAczC,MAAMC,GAAG,GAAG,CAAC;AAEb,MAAMC,OAA+B,GAAGA,CAAC;EACvCC,OAAO;EACPC,OAAO;EACPC,YAAY;EACZC,KAAK,GAAG,GAAG;EACXC,SAAS,GAAG,QAAQ;EACpBC,QAAQ;EACRC,KAAK;EACLC,MAAM,EAAEC,cAAc;EACtBC;AACF,CAAC,KAAK;EACJ,MAAMC,CAAC,GAAGpB,OAAO,CACf,MAAMI,WAAW,CAAwBC,cAAc,EAAEa,cAAc,CAAC,EACxE,CAACA,cAAc,CACjB,CAAC;EAED,IAAI,CAACR,OAAO,EAAE;IACZ,OAAO,IAAI;EACb;EAEA,MAAMW,aAAwB,GAC5BP,SAAS,KAAK,QAAQ,GAClB;IAAEQ,GAAG,EAAEV,YAAY,CAACW,CAAC,GAAGX,YAAY,CAACY,MAAM,GAAGhB,GAAG;IAAEiB,IAAI,EAAEb,YAAY,CAACc;EAAE,CAAC,GACzE;IAAEC,MAAM,EAAEf,YAAY,CAACW,CAAC,GAAGf,GAAG;IAAEiB,IAAI,EAAEb,YAAY,CAACc;EAAE,CAAC;EAE5D,oBACEnB,IAAA,CAACJ,KAAK;IACJO,OAAO,EAAEA,OAAQ;IACjBkB,WAAW;IACXC,aAAa,EAAC,MAAM;IACpBC,cAAc,EAAEnB,OAAQ;IAAAI,QAAA,eAExBR,IAAA,CAACL,wBAAwB;MAAC6B,OAAO,EAAEpB,OAAQ;MAAAI,QAAA,eACzCR,IAAA,CAACN,IAAI;QAACe,KAAK,EAAEI,CAAC,CAACY,OAAQ;QAAAjB,QAAA,eACrBR,IAAA,CAACL,wBAAwB;UAAAa,QAAA,eACvBR,IAAA,CAACN,IAAI;YACHe,KAAK,EAAE,CAACI,CAAC,CAACa,OAAO,EAAEZ,aAAa,EAAE;cAAER;YAAM,CAAC,EAAEG,KAAK,CAAE;YACpDG,MAAM,EAAEA,MAAO;YAAAJ,QAAA,EAEdA;UAAQ,CACL;QAAC,CACiB;MAAC,CACvB;IAAC,CACiB;EAAC,CACtB,CAAC;AAEZ,CAAC;AAED,eAAeN,OAAO","ignoreList":[]}
@@ -0,0 +1,57 @@
1
+ ---
2
+ title: Popover
3
+ nav:
4
+ title: 组件
5
+ order: 1
6
+ group:
7
+ title: 基础
8
+ order: 2
9
+ ---
10
+
11
+ # Popover 弹出定位容器
12
+
13
+ 锚定在指定元素下方的弹出容器,用于下拉菜单等场景。
14
+
15
+ ## 何时使用
16
+
17
+ - 下拉选择菜单
18
+ - 模型选择器
19
+ - 任何需要锚定定位的浮层
20
+
21
+ ## 代码演示
22
+
23
+ ```tsx
24
+ import { Popover } from '@unif/react-native-ui';
25
+
26
+ <Popover
27
+ visible={visible}
28
+ onClose={() => setVisible(false)}
29
+ anchorLayout={{ x: 100, y: 50, width: 120, height: 40 }}
30
+ width={180}
31
+ >
32
+ <View>
33
+ <Text>下拉内容</Text>
34
+ </View>
35
+ </Popover>
36
+ ```
37
+
38
+ ## API
39
+
40
+ | 属性 | 说明 | 类型 | 默认值 |
41
+ | ------------ | -------------- | --------------------------------------------- | ---------- |
42
+ | visible | 是否可见 | `boolean` | - |
43
+ | onClose | 关闭回调 | `() => void` | - |
44
+ | anchorLayout | 锚点布局 | `{ x, y, width, height }` | - |
45
+ | width | 内容宽度 | `number` | `180` |
46
+ | placement | 弹出方向 | `'bottom'` \| `'top'` | `'bottom'` |
47
+ | children | 弹出内容 | `ReactNode` | - |
48
+ | style | 内容容器样式 | `ViewStyle` | - |
49
+ | styles | 语义样式 | `PopoverSemanticStyles` | - |
50
+ | testID | 测试标识 | `string` | - |
51
+
52
+ ## Semantic Styles
53
+
54
+ | Slot | 说明 |
55
+ | ------- | ------------ |
56
+ | overlay | 遮罩层 |
57
+ | content | 内容容器 |
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ import { tokens } from "../../theme/tokens.js";
4
+ export const DEFAULT_STYLES = {
5
+ overlay: {
6
+ flex: 1
7
+ },
8
+ content: {
9
+ position: 'absolute',
10
+ backgroundColor: tokens.colorBgElevated,
11
+ borderRadius: 12,
12
+ shadowColor: '#000',
13
+ shadowOffset: {
14
+ width: 0,
15
+ height: 4
16
+ },
17
+ shadowOpacity: 0.12,
18
+ shadowRadius: 12,
19
+ elevation: 8
20
+ }
21
+ };
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["tokens","DEFAULT_STYLES","overlay","flex","content","position","backgroundColor","colorBgElevated","borderRadius","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation"],"sourceRoot":"../../../../src","sources":["popover/style/index.tsx"],"mappings":";;AACA,SAASA,MAAM,QAAQ,uBAAoB;AAO3C,OAAO,MAAMC,cAAqC,GAAG;EACnDC,OAAO,EAAE;IACPC,IAAI,EAAE;EACR,CAAC;EACDC,OAAO,EAAE;IACPC,QAAQ,EAAE,UAAU;IACpBC,eAAe,EAAEN,MAAM,CAACO,eAAe;IACvCC,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MAAEC,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC;IACrCC,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,EAAE;IAChBC,SAAS,EAAE;EACb;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * 水平布局容器
5
+ *
6
+ * 默认 flexDirection: 'row' + alignItems: 'center'。
7
+ */
8
+
9
+ import React from 'react';
10
+ import { View } from 'react-native';
11
+ import { baseStyle, wrapStyle } from "./style/index.js";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ const Row = ({
14
+ align,
15
+ justify,
16
+ gap,
17
+ wrap,
18
+ style,
19
+ ...rest
20
+ }) => /*#__PURE__*/_jsx(View, {
21
+ style: [baseStyle, align != null && {
22
+ alignItems: align
23
+ }, justify != null && {
24
+ justifyContent: justify
25
+ }, gap != null && {
26
+ gap
27
+ }, wrap && wrapStyle, style],
28
+ ...rest
29
+ });
30
+ export default Row;
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","View","baseStyle","wrapStyle","jsx","_jsx","Row","align","justify","gap","wrap","style","rest","alignItems","justifyContent"],"sourceRoot":"../../../src","sources":["row/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,cAAc;AAEnC,SAASC,SAAS,EAAEC,SAAS,QAAQ,kBAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAgB/C,MAAMC,GAAuB,GAAGA,CAAC;EAC/BC,KAAK;EACLC,OAAO;EACPC,GAAG;EACHC,IAAI;EACJC,KAAK;EACL,GAAGC;AACK,CAAC,kBACTP,IAAA,CAACJ,IAAI;EACHU,KAAK,EAAE,CACLT,SAAS,EACTK,KAAK,IAAI,IAAI,IAAI;IAAEM,UAAU,EAAEN;EAAM,CAAC,EACtCC,OAAO,IAAI,IAAI,IAAI;IAAEM,cAAc,EAAEN;EAAQ,CAAC,EAC9CC,GAAG,IAAI,IAAI,IAAI;IAAEA;EAAI,CAAC,EACtBC,IAAI,IAAIP,SAAS,EACjBQ,KAAK,CACL;EAAA,GACEC;AAAI,CACT,CACF;AAED,eAAeN,GAAG","ignoreList":[]}
@@ -0,0 +1,46 @@
1
+ # Row 水平布局
2
+
3
+ 水平排列子元素,默认垂直居中。替代 `flexDirection: 'row' + alignItems: 'center'` 的手写样式。
4
+
5
+ ## 何时使用
6
+
7
+ - 需要水平排列元素时
8
+ - 替代 `<View style={{flexDirection: 'row', alignItems: 'center'}}>` 的场景
9
+
10
+ ## 代码演示
11
+
12
+ ```tsx
13
+ // 基础用法 — 默认 alignItems: 'center'
14
+ <Row>
15
+ <Icon name="star" />
16
+ <Text>标题</Text>
17
+ </Row>
18
+
19
+ // 两端对齐
20
+ <Row justify="space-between">
21
+ <Text>左侧</Text>
22
+ <Text>右侧</Text>
23
+ </Row>
24
+
25
+ // 间距
26
+ <Row gap={10}>
27
+ <Button block onPress={...}>修改</Button>
28
+ <Button block onPress={...}>确认</Button>
29
+ </Row>
30
+
31
+ // 换行
32
+ <Row wrap gap={8}>
33
+ {tags.map(tag => <Tag key={tag}>{tag}</Tag>)}
34
+ </Row>
35
+ ```
36
+
37
+ ## API
38
+
39
+ | 属性 | 说明 | 类型 | 默认值 |
40
+ |------|------|------|--------|
41
+ | align | alignItems | `ViewStyle['alignItems']` | `'center'` |
42
+ | justify | justifyContent | `ViewStyle['justifyContent']` | - |
43
+ | gap | 子元素间距 | `number` | - |
44
+ | wrap | 是否换行 | `boolean` | `false` |
45
+
46
+ > 继承所有 RN `ViewProps`(`style`、`testID` 等)
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ import { StyleSheet } from 'react-native';
4
+ export const baseStyle = StyleSheet.create({
5
+ row: {
6
+ flexDirection: 'row',
7
+ alignItems: 'center'
8
+ }
9
+ }).row;
10
+ export const wrapStyle = StyleSheet.create({
11
+ wrap: {
12
+ flexWrap: 'wrap'
13
+ }
14
+ }).wrap;
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StyleSheet","baseStyle","create","row","flexDirection","alignItems","wrapStyle","wrap","flexWrap"],"sourceRoot":"../../../../src","sources":["row/style/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AAEzC,OAAO,MAAMC,SAAS,GAAGD,UAAU,CAACE,MAAM,CAAC;EACzCC,GAAG,EAAE;IACHC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC,CAACF,GAAG;AAEN,OAAO,MAAMG,SAAS,GAAGN,UAAU,CAACE,MAAM,CAAC;EACzCK,IAAI,EAAE;IACJC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC,CAACD,IAAI","ignoreList":[]}