@agimon-ai/po-native-components 0.0.0-alpha.21 → 0.0.0-alpha.211

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 (195) hide show
  1. package/LICENSE +21 -149
  2. package/README.md +9 -51
  3. package/dist/components/AgentAvatar.d.mts +19 -0
  4. package/dist/components/AgentAvatar.d.mts.map +1 -0
  5. package/dist/components/AgentAvatar.mjs +88 -0
  6. package/dist/components/AgentAvatar.mjs.map +1 -0
  7. package/dist/components/AnnotationSurface.d.mts +69 -0
  8. package/dist/components/AnnotationSurface.d.mts.map +1 -0
  9. package/dist/components/AnnotationSurface.mjs +431 -0
  10. package/dist/components/AnnotationSurface.mjs.map +1 -0
  11. package/dist/components/Badge.d.mts +1 -1
  12. package/dist/components/Badge.mjs +1 -1
  13. package/dist/components/Button.mjs +3 -3
  14. package/dist/components/Button.mjs.map +1 -1
  15. package/dist/components/CodeBlock.d.mts +3 -1
  16. package/dist/components/CodeBlock.d.mts.map +1 -1
  17. package/dist/components/CodeBlock.mjs +42 -47
  18. package/dist/components/CodeBlock.mjs.map +1 -1
  19. package/dist/components/ComputerRow.d.mts +15 -0
  20. package/dist/components/ComputerRow.d.mts.map +1 -0
  21. package/dist/components/ComputerRow.mjs +107 -0
  22. package/dist/components/ComputerRow.mjs.map +1 -0
  23. package/dist/components/CopyButton.d.mts +13 -0
  24. package/dist/components/CopyButton.d.mts.map +1 -0
  25. package/dist/components/CopyButton.mjs +49 -0
  26. package/dist/components/CopyButton.mjs.map +1 -0
  27. package/dist/components/CountBadge.d.mts +15 -0
  28. package/dist/components/CountBadge.d.mts.map +1 -0
  29. package/dist/components/CountBadge.mjs +49 -0
  30. package/dist/components/CountBadge.mjs.map +1 -0
  31. package/dist/components/CtaCard.d.mts +19 -0
  32. package/dist/components/CtaCard.d.mts.map +1 -0
  33. package/dist/components/CtaCard.mjs +92 -0
  34. package/dist/components/CtaCard.mjs.map +1 -0
  35. package/dist/components/Dialog.d.mts +2 -2
  36. package/dist/components/Dialog.d.mts.map +1 -1
  37. package/dist/components/Dialog.mjs +16 -10
  38. package/dist/components/Dialog.mjs.map +1 -1
  39. package/dist/components/Dot.d.mts +1 -1
  40. package/dist/components/Dot.mjs +2 -2
  41. package/dist/components/DropdownMenu.d.mts +3 -1
  42. package/dist/components/DropdownMenu.d.mts.map +1 -1
  43. package/dist/components/DropdownMenu.mjs +21 -14
  44. package/dist/components/DropdownMenu.mjs.map +1 -1
  45. package/dist/components/EmptyState.d.mts +31 -3
  46. package/dist/components/EmptyState.d.mts.map +1 -1
  47. package/dist/components/EmptyState.mjs +303 -29
  48. package/dist/components/EmptyState.mjs.map +1 -1
  49. package/dist/components/FileList.d.mts +48 -0
  50. package/dist/components/FileList.d.mts.map +1 -0
  51. package/dist/components/FileList.mjs +737 -0
  52. package/dist/components/FileList.mjs.map +1 -0
  53. package/dist/components/FilePreview.d.mts +33 -0
  54. package/dist/components/FilePreview.d.mts.map +1 -0
  55. package/dist/components/FilePreview.mjs +102 -0
  56. package/dist/components/FilePreview.mjs.map +1 -0
  57. package/dist/components/FileViewer.d.mts +57 -0
  58. package/dist/components/FileViewer.d.mts.map +1 -0
  59. package/dist/components/FileViewer.mjs +345 -0
  60. package/dist/components/FileViewer.mjs.map +1 -0
  61. package/dist/components/HashlineLines.d.mts +13 -0
  62. package/dist/components/HashlineLines.d.mts.map +1 -0
  63. package/dist/components/HashlineLines.mjs +153 -0
  64. package/dist/components/HashlineLines.mjs.map +1 -0
  65. package/dist/components/HostFilter.d.mts +17 -0
  66. package/dist/components/HostFilter.d.mts.map +1 -0
  67. package/dist/components/HostFilter.mjs +68 -0
  68. package/dist/components/HostFilter.mjs.map +1 -0
  69. package/dist/components/HostTag.d.mts +7 -0
  70. package/dist/components/HostTag.d.mts.map +1 -0
  71. package/dist/components/HostTag.mjs +48 -0
  72. package/dist/components/HostTag.mjs.map +1 -0
  73. package/dist/components/InfoStrip.d.mts +9 -0
  74. package/dist/components/InfoStrip.d.mts.map +1 -0
  75. package/dist/components/InfoStrip.mjs +53 -0
  76. package/dist/components/InfoStrip.mjs.map +1 -0
  77. package/dist/components/Input.d.mts +3 -1
  78. package/dist/components/Input.d.mts.map +1 -1
  79. package/dist/components/Input.mjs +4 -3
  80. package/dist/components/Input.mjs.map +1 -1
  81. package/dist/components/Label.mjs +1 -1
  82. package/dist/components/LinkText.d.mts +13 -0
  83. package/dist/components/LinkText.d.mts.map +1 -0
  84. package/dist/components/LinkText.mjs +32 -0
  85. package/dist/components/LinkText.mjs.map +1 -0
  86. package/dist/components/List.d.mts.map +1 -1
  87. package/dist/components/List.mjs +50 -11
  88. package/dist/components/List.mjs.map +1 -1
  89. package/dist/components/LiveDuration.d.mts +30 -0
  90. package/dist/components/LiveDuration.d.mts.map +1 -0
  91. package/dist/components/LiveDuration.mjs +67 -0
  92. package/dist/components/LiveDuration.mjs.map +1 -0
  93. package/dist/components/LoadingState.d.mts +17 -0
  94. package/dist/components/LoadingState.d.mts.map +1 -0
  95. package/dist/components/LoadingState.mjs +90 -0
  96. package/dist/components/LoadingState.mjs.map +1 -0
  97. package/dist/components/Markdown.d.mts +24 -2
  98. package/dist/components/Markdown.d.mts.map +1 -1
  99. package/dist/components/Markdown.mjs +356 -27
  100. package/dist/components/Markdown.mjs.map +1 -1
  101. package/dist/components/MessageItem.d.mts +10 -15
  102. package/dist/components/MessageItem.d.mts.map +1 -1
  103. package/dist/components/MessageItem.mjs +94 -68
  104. package/dist/components/MessageItem.mjs.map +1 -1
  105. package/dist/components/NativeShellState.d.mts +30 -0
  106. package/dist/components/NativeShellState.d.mts.map +1 -0
  107. package/dist/components/NativeShellState.mjs +61 -0
  108. package/dist/components/NativeShellState.mjs.map +1 -0
  109. package/dist/components/RailItem.d.mts +13 -0
  110. package/dist/components/RailItem.d.mts.map +1 -0
  111. package/dist/components/RailItem.mjs +61 -0
  112. package/dist/components/RailItem.mjs.map +1 -0
  113. package/dist/components/ReferenceChip.d.mts +18 -0
  114. package/dist/components/ReferenceChip.d.mts.map +1 -0
  115. package/dist/components/ReferenceChip.mjs +38 -0
  116. package/dist/components/ReferenceChip.mjs.map +1 -0
  117. package/dist/components/SectionLabel.mjs +1 -1
  118. package/dist/components/SeekBar.d.mts +17 -0
  119. package/dist/components/SeekBar.d.mts.map +1 -0
  120. package/dist/components/SeekBar.mjs +97 -0
  121. package/dist/components/SeekBar.mjs.map +1 -0
  122. package/dist/components/Select.d.mts +39 -0
  123. package/dist/components/Select.d.mts.map +1 -0
  124. package/dist/components/Select.mjs +288 -0
  125. package/dist/components/Select.mjs.map +1 -0
  126. package/dist/components/Sheet.d.mts +17 -2
  127. package/dist/components/Sheet.d.mts.map +1 -1
  128. package/dist/components/Sheet.mjs +34 -11
  129. package/dist/components/Sheet.mjs.map +1 -1
  130. package/dist/components/SheetFrame.mjs +149 -28
  131. package/dist/components/SheetFrame.mjs.map +1 -1
  132. package/dist/components/SheetList.d.mts +14 -0
  133. package/dist/components/SheetList.d.mts.map +1 -0
  134. package/dist/components/SheetList.mjs +34 -0
  135. package/dist/components/SheetList.mjs.map +1 -0
  136. package/dist/components/ShowMore.d.mts +10 -0
  137. package/dist/components/ShowMore.d.mts.map +1 -0
  138. package/dist/components/ShowMore.mjs +44 -0
  139. package/dist/components/ShowMore.mjs.map +1 -0
  140. package/dist/components/Spinner.d.mts +1 -1
  141. package/dist/components/StatusBadge.d.mts +1 -1
  142. package/dist/components/Switch.d.mts +14 -0
  143. package/dist/components/Switch.d.mts.map +1 -0
  144. package/dist/components/Switch.mjs +37 -0
  145. package/dist/components/Switch.mjs.map +1 -0
  146. package/dist/components/SyntaxLine.d.mts +19 -0
  147. package/dist/components/SyntaxLine.d.mts.map +1 -0
  148. package/dist/components/SyntaxLine.mjs +134 -0
  149. package/dist/components/SyntaxLine.mjs.map +1 -0
  150. package/dist/components/Tabs.d.mts.map +1 -1
  151. package/dist/components/Tabs.mjs +8 -7
  152. package/dist/components/Tabs.mjs.map +1 -1
  153. package/dist/components/ToolPathLink.d.mts +10 -0
  154. package/dist/components/ToolPathLink.d.mts.map +1 -0
  155. package/dist/components/ToolPathLink.mjs +42 -0
  156. package/dist/components/ToolPathLink.mjs.map +1 -0
  157. package/dist/components/ToolResultImage.d.mts +21 -0
  158. package/dist/components/ToolResultImage.d.mts.map +1 -0
  159. package/dist/components/ToolResultImage.mjs +60 -0
  160. package/dist/components/ToolResultImage.mjs.map +1 -0
  161. package/dist/icons/IconColorContext.d.mts +2 -1
  162. package/dist/icons/IconColorContext.d.mts.map +1 -1
  163. package/dist/icons/IconColorContext.mjs.map +1 -1
  164. package/dist/icons/iconGlyphs.d.mts +132 -0
  165. package/dist/icons/iconGlyphs.d.mts.map +1 -1
  166. package/dist/icons/iconGlyphs.mjs +132 -0
  167. package/dist/icons/iconGlyphs.mjs.map +1 -1
  168. package/dist/icons/icons.d.mts +133 -1
  169. package/dist/icons/icons.d.mts.map +1 -1
  170. package/dist/icons/icons.mjs +35 -2
  171. package/dist/icons/icons.mjs.map +1 -1
  172. package/dist/index.d.mts +31 -7
  173. package/dist/index.mjs +36 -12
  174. package/dist/lib/fileKindLabel.mjs +17 -0
  175. package/dist/lib/fileKindLabel.mjs.map +1 -0
  176. package/dist/lib/fonts.d.mts +3 -1
  177. package/dist/lib/fonts.d.mts.map +1 -1
  178. package/dist/lib/fonts.mjs +4 -2
  179. package/dist/lib/fonts.mjs.map +1 -1
  180. package/dist/lib/insideSheet.d.mts +10 -0
  181. package/dist/lib/insideSheet.d.mts.map +1 -0
  182. package/dist/lib/markdown.mjs +310 -23
  183. package/dist/lib/markdown.mjs.map +1 -1
  184. package/dist/lib/reading.mjs +60 -0
  185. package/dist/lib/reading.mjs.map +1 -0
  186. package/dist/lib/useControllable.mjs +14 -6
  187. package/dist/lib/useControllable.mjs.map +1 -1
  188. package/dist/lib/useReadingPage.mjs +33 -0
  189. package/dist/lib/useReadingPage.mjs.map +1 -0
  190. package/dist/po-runtime-identity.json +1 -0
  191. package/dist/shell.d.mts +6 -0
  192. package/dist/shell.mjs +7 -0
  193. package/locales/vi.json +112 -0
  194. package/locales/zh-CN.json +112 -0
  195. package/package.json +43 -30
@@ -0,0 +1,68 @@
1
+ import { selectionTick } from "../lib/haptics.mjs";
2
+ import { Button } from "./Button.mjs";
3
+ import { SegmentedControl } from "./SegmentedControl.mjs";
4
+ import { View } from "react-native-unistyles/components/native/View";
5
+ import { StyleSheet } from "react-native-unistyles";
6
+ import { jsx } from "react/jsx-runtime";
7
+ import { t } from "@agimon-ai/po-core/native";
8
+ import { ScrollView } from "react-native-unistyles/components/native/ScrollView";
9
+
10
+ //#region src/components/HostFilter.tsx
11
+ const ALL = "";
12
+ const MAX_SEGMENTS = 3;
13
+ const MAX_SEGMENT_LABEL = 12;
14
+ /** Short names use the native segmented control; long names remain reachable by scrolling. */
15
+ function HostFilter({ hosts, value, onChange, includeAll = true, accessibilityLabel: accessibilityLabelProp }) {
16
+ const accessibilityLabel = accessibilityLabelProp ?? t("nativeComponents.hostFilter.label", "Filter by computer");
17
+ const options = [...includeAll ? [{
18
+ value: ALL,
19
+ label: t("nativeComponents.hostFilter.all", "All")
20
+ }] : [], ...hosts.map(({ id, label }) => ({
21
+ value: id,
22
+ label
23
+ }))];
24
+ const selected = hosts.some(({ id }) => id === value) ? value : includeAll ? ALL : hosts[0]?.id ?? ALL;
25
+ if (options.length <= MAX_SEGMENTS && options.every(({ label }) => label.length <= MAX_SEGMENT_LABEL)) return /* @__PURE__ */ jsx(SegmentedControl, {
26
+ options,
27
+ value: selected,
28
+ onValueChange: (id) => onChange(id || null),
29
+ accessibilityLabel,
30
+ style: styles.control
31
+ });
32
+ return /* @__PURE__ */ jsx(ScrollView, {
33
+ horizontal: true,
34
+ showsHorizontalScrollIndicator: false,
35
+ accessibilityLabel,
36
+ children: /* @__PURE__ */ jsx(View, {
37
+ style: styles.choices,
38
+ children: options.map(({ value: id, label }) => /* @__PURE__ */ jsx(Button, {
39
+ variant: selected === id ? "subtle" : "ghost",
40
+ accessibilityState: { selected: selected === id },
41
+ style: [styles.choice, selected === id && styles.selected],
42
+ onPress: () => {
43
+ selectionTick();
44
+ onChange(id || null);
45
+ },
46
+ children: label
47
+ }, id))
48
+ })
49
+ });
50
+ }
51
+ const styles = StyleSheet.create((theme) => ({
52
+ control: { minHeight: 44 },
53
+ choices: {
54
+ flexDirection: "row",
55
+ gap: theme.spacing(2),
56
+ uni__dependencies: [0]
57
+ },
58
+ choice: { minHeight: 44 },
59
+ selected: {
60
+ backgroundColor: theme.colors["tint-green"],
61
+ borderColor: theme.colors["edge-green"],
62
+ uni__dependencies: [0]
63
+ }
64
+ }));
65
+
66
+ //#endregion
67
+ export { HostFilter };
68
+ //# sourceMappingURL=HostFilter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HostFilter.mjs","names":["t","StyleSheet","selectionTick","Button","SegmentedControl","HostFilterProps","hosts","id","label","value","onChange","includeAll","accessibilityLabel","ALL","MAX_SEGMENTS","MAX_SEGMENT_LABEL","HostFilter","accessibilityLabelProp","options","map","selected","some","length","every","styles","control","choices","choice","create","theme","minHeight","flexDirection","gap","spacing","uni__dependencies","backgroundColor","colors","borderColor"],"sources":["../../src/components/HostFilter.tsx"],"sourcesContent":["import { t } from '@agimon-ai/po-core/native';\nimport { ScrollView, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { selectionTick } from '../lib/haptics';\nimport { Button } from './Button';\nimport { SegmentedControl } from './SegmentedControl';\n\nexport interface HostFilterProps {\n hosts: readonly { id: string; label: string }[];\n /** null means All. This is presentation only, not a transport selection. */\n value: string | null;\n onChange: (id: string | null) => void;\n /** Off when the choice names where something lives, so exactly one computer is always chosen. */\n includeAll?: boolean;\n accessibilityLabel?: string;\n}\nconst ALL = '';\nconst MAX_SEGMENTS = 3;\nconst MAX_SEGMENT_LABEL = 12;\n\n/** Short names use the native segmented control; long names remain reachable by scrolling. */\nexport function HostFilter({\n hosts,\n value,\n onChange,\n includeAll = true,\n accessibilityLabel: accessibilityLabelProp,\n}: HostFilterProps) {\n const accessibilityLabel = accessibilityLabelProp ?? t('nativeComponents.hostFilter.label', 'Filter by computer');\n const options = [\n ...(includeAll ? [{ value: ALL, label: t('nativeComponents.hostFilter.all', 'All') }] : []),\n ...hosts.map(({ id, label }) => ({ value: id, label })),\n ];\n const selected = hosts.some(({ id }) => id === value) ? value! : includeAll ? ALL : (hosts[0]?.id ?? ALL);\n if (options.length <= MAX_SEGMENTS && options.every(({ label }) => label.length <= MAX_SEGMENT_LABEL)) {\n return (\n <SegmentedControl\n options={options}\n value={selected}\n onValueChange={(id) => onChange(id || null)}\n accessibilityLabel={accessibilityLabel}\n style={styles.control}\n />\n );\n }\n return (\n <ScrollView horizontal showsHorizontalScrollIndicator={false} accessibilityLabel={accessibilityLabel}>\n <View style={styles.choices}>\n {options.map(({ value: id, label }) => (\n <Button\n key={id}\n variant={selected === id ? 'subtle' : 'ghost'}\n accessibilityState={{ selected: selected === id }}\n style={[styles.choice, selected === id && styles.selected]}\n onPress={() => {\n selectionTick();\n onChange(id || null);\n }}\n >\n {label}\n </Button>\n ))}\n </View>\n </ScrollView>\n );\n}\nconst styles = StyleSheet.create((theme) => ({\n control: { minHeight: 44 },\n choices: { flexDirection: 'row', gap: theme.spacing(2) },\n choice: { minHeight: 44 },\n selected: { backgroundColor: theme.colors['tint-green'], borderColor: theme.colors['edge-green'] },\n}));\n"],"mappings":";;;;;;;;;;AAiBA,MAAMa,MAAM;AACZ,MAAMC,eAAe;AACrB,MAAMC,oBAAoB;;AAG1B,SAAgBC,WAAW,EACzBV,OACAG,OACAC,UACAC,aAAa,MACbC,oBAAoBK,0BACF;CAClB,MAAML,qBAAqBK,0BAA0BjB,EAAE,qCAAqC,oBAAoB;CAChH,MAAMkB,UAAU,CACd,GAAIP,aAAa,CAAC;EAAEF,OAAOI;EAAKL,OAAOR,EAAE,mCAAmC,KAAK;CAAE,CAAC,IAAI,CAAA,GACxF,GAAGM,MAAMa,KAAK,EAAEZ,IAAIC,aAAa;EAAEC,OAAOF;EAAIC;CAAM,EAAE,CAAC;CAEzD,MAAMY,WAAWd,MAAMe,MAAM,EAAEd,SAASA,OAAOE,KAAK,IAAIA,QAASE,aAAaE,MAAOP,MAAM,EAAE,EAAEC,MAAMM;CACrG,IAAIK,QAAQI,UAAUR,gBAAgBI,QAAQK,OAAO,EAAEf,YAAYA,MAAMc,UAAUP,iBAAiB,GAClG,OACE,oBAAC,kBAAD;EACWG;EACT,OAAOE;EACP,gBAAgBb,OAAOG,SAASH,MAAM,IAAI;EACtBK;EACpB,OAAOY,OAAOC;CAAQ;CAI5B,OACE,oBAAC,YAAD;EAAY;EAAW,gCAAgC;EAA2Bb;YAChF,oBAAC,MAAD;GAAM,OAAOY,OAAOE;aACjBR,QAAQC,KAAK,EAAEV,OAAOF,IAAIC,YACzB,oBAAC,QAAD;IAEE,SAASY,aAAab,KAAK,WAAW;IACtC,oBAAoB,EAAEa,UAAUA,aAAab,GAAG;IAChD,OAAO,CAACiB,OAAOG,QAAQP,aAAab,MAAMiB,OAAOJ,QAAQ;IACzD,eAAe;KACblB,cAAc;KACdQ,SAASH,MAAM,IAAI;IACrB;cAECC;GACK,GAVDD,EAUC,CACT;EACG;CACI;AAEhB;AACA,MAAMiB,SAASvB,WAAW2B,QAAQC,WAAW;CAC3CJ,SAAS,EAAEK,WAAW,GAAG;CACzBJ,SAAS;EAAEK,eAAe;EAAOC,KAAKH,MAAMI,QAAQ,CAAC;EAACC,mBAAA,CAAA,CAAA;CAAC;CACvDP,QAAQ,EAAEG,WAAW,GAAG;CACxBV,UAAU;EAAEe,iBAAiBN,MAAMO,OAAO;EAAeC,aAAaR,MAAMO,OAAO;EAAaF,mBAAA,CAAA,CAAA;CAAC;AACnG,EAAE"}
@@ -0,0 +1,7 @@
1
+ //#region src/components/HostTag.d.ts
2
+ /** A computer's display label, never an authority or connection indicator. */
3
+ export declare function HostTag({ label }: {
4
+ label: string;
5
+ }): import("react").JSX.Element;
6
+ //#endregion
7
+ //# sourceMappingURL=HostTag.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HostTag.d.mts","names":[],"sources":["../../src/components/HostTag.tsx"],"mappings":";;wBASgB,UAAU;EAAW;oBAAe,IAAA"}
@@ -0,0 +1,48 @@
1
+ import { fontOf } from "../lib/fonts.mjs";
2
+ import { agentInitials } from "./AgentAvatar.mjs";
3
+ import { Badge } from "./Badge.mjs";
4
+ import { Text } from "react-native-unistyles/components/native/Text";
5
+ import { StyleSheet } from "react-native-unistyles";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { t } from "@agimon-ai/po-core/native";
8
+
9
+ //#region src/components/HostTag.tsx
10
+ /** A computer's display label, never an authority or connection indicator. */
11
+ function HostTag({ label }) {
12
+ return /* @__PURE__ */ jsxs(Badge, {
13
+ accessibilityLabel: t("nativeComponents.hostTag.label", "Computer: {label}", { label }),
14
+ style: styles.tag,
15
+ children: [/* @__PURE__ */ jsx(Text, {
16
+ style: styles.initials,
17
+ children: agentInitials(label)
18
+ }), /* @__PURE__ */ jsx(Text, {
19
+ style: styles.label,
20
+ numberOfLines: 1,
21
+ children: label
22
+ })]
23
+ });
24
+ }
25
+ const styles = StyleSheet.create((theme) => ({
26
+ tag: {
27
+ maxWidth: "100%",
28
+ flexShrink: 1
29
+ },
30
+ initials: {
31
+ fontFamily: fontOf(theme.fontFamily.sans),
32
+ fontSize: theme.fontSize.xs,
33
+ color: theme.colors.dim,
34
+ uni__dependencies: [0]
35
+ },
36
+ label: {
37
+ fontFamily: fontOf(theme.fontFamily.sans),
38
+ fontSize: theme.fontSize.sm,
39
+ lineHeight: theme.lineHeight.sm,
40
+ color: theme.colors.dim,
41
+ flexShrink: 1,
42
+ uni__dependencies: [0]
43
+ }
44
+ }));
45
+
46
+ //#endregion
47
+ export { HostTag };
48
+ //# sourceMappingURL=HostTag.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HostTag.mjs","names":["t","StyleSheet","fontOf","agentInitials","Badge","HostTag","label","styles","tag","initials","create","theme","maxWidth","flexShrink","fontFamily","sans","fontSize","xs","color","colors","dim","uni__dependencies","sm","lineHeight"],"sources":["../../src/components/HostTag.tsx"],"sourcesContent":["import { t } from '@agimon-ai/po-core/native';\nimport { Text } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { agentInitials } from './AgentAvatar';\nimport { Badge } from './Badge';\n\n/** A computer's display label, never an authority or connection indicator. */\nexport function HostTag({ label }: { label: string }) {\n return (\n <Badge accessibilityLabel={t('nativeComponents.hostTag.label', 'Computer: {label}', { label })} style={styles.tag}>\n <Text style={styles.initials}>{agentInitials(label)}</Text>\n <Text style={styles.label} numberOfLines={1}>\n {label}\n </Text>\n </Badge>\n );\n}\nconst styles = StyleSheet.create((theme) => ({\n tag: { maxWidth: '100%', flexShrink: 1 },\n initials: { fontFamily: fontOf(theme.fontFamily.sans), fontSize: theme.fontSize.xs, color: theme.colors.dim },\n label: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n color: theme.colors.dim,\n flexShrink: 1,\n },\n}));\n"],"mappings":";;;;;;;;;;AASA,SAAgBK,QAAQ,EAAEC,SAA4B;CACpD,OACE,qBAAC,OAAD;EAAO,oBAAoBN,EAAE,kCAAkC,qBAAqB,EAAEM,MAAM,CAAC;EAAG,OAAOC,OAAOC;YAA9G,CACE,oBAAC,MAAD;GAAM,OAAOD,OAAOE;aAAWN,cAAcG,KAAK;EAAQ,IAC1D,oBAAC,MAAD;GAAM,OAAOC,OAAOD;GAAO,eAAe;aACvCA;EACG,EACD;;AAEX;AACA,MAAMC,SAASN,WAAWS,QAAQC,WAAW;CAC3CH,KAAK;EAAEI,UAAU;EAAQC,YAAY;CAAE;CACvCJ,UAAU;EAAEK,YAAYZ,OAAOS,MAAMG,WAAWC,IAAI;EAAGC,UAAUL,MAAMK,SAASC;EAAIC,OAAOP,MAAMQ,OAAOC;EAAGC,mBAAA,CAAA,CAAA;CAAC;CAC5Gf,OAAO;EACLQ,YAAYZ,OAAOS,MAAMG,WAAWC,IAAI;EACxCC,UAAUL,MAAMK,SAASM;EACzBC,YAAYZ,MAAMY,WAAWD;EAC7BJ,OAAOP,MAAMQ,OAAOC;EACpBP,YAAY;EAACQ,mBAAA,CAAA,CAAA;CACf;AACF,EAAE"}
@@ -0,0 +1,9 @@
1
+ //#region src/components/InfoStrip.d.ts
2
+ /** A quiet explanation with an optional text action, without live activity. */
3
+ export declare function InfoStrip({ message, actionLabel, onAction }: {
4
+ message: string;
5
+ actionLabel?: string;
6
+ onAction?: () => void;
7
+ }): import("react").JSX.Element;
8
+ //#endregion
9
+ //# sourceMappingURL=InfoStrip.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InfoStrip.d.mts","names":[],"sources":["../../src/components/InfoStrip.tsx"],"mappings":";;wBASgB,YACd,SACA,aACA;EAEA;EACA;EACA;oBACD,IAAA"}
@@ -0,0 +1,53 @@
1
+ import { fontOf } from "../lib/fonts.mjs";
2
+ import { Button } from "./Button.mjs";
3
+ import { AlertIcon } from "../icons/icons.mjs";
4
+ import { Panel } from "./Panel.mjs";
5
+ import { Text } from "react-native-unistyles/components/native/Text";
6
+ import { StyleSheet } from "react-native-unistyles";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+
9
+ //#region src/components/InfoStrip.tsx
10
+ /** A quiet explanation with an optional text action, without live activity. */
11
+ function InfoStrip({ message, actionLabel, onAction }) {
12
+ return /* @__PURE__ */ jsxs(Panel, {
13
+ style: styles.strip,
14
+ children: [
15
+ /* @__PURE__ */ jsx(AlertIcon, {
16
+ size: 16,
17
+ color: "dim"
18
+ }),
19
+ /* @__PURE__ */ jsx(Text, {
20
+ style: styles.text,
21
+ children: message
22
+ }),
23
+ onAction && actionLabel ? /* @__PURE__ */ jsx(Button, {
24
+ variant: "ghost",
25
+ style: styles.action,
26
+ onPress: onAction,
27
+ children: actionLabel
28
+ }) : null
29
+ ]
30
+ });
31
+ }
32
+ const styles = StyleSheet.create((theme) => ({
33
+ strip: {
34
+ flexDirection: "row",
35
+ alignItems: "center",
36
+ gap: theme.spacing(2),
37
+ padding: theme.spacing(3),
38
+ uni__dependencies: [0]
39
+ },
40
+ text: {
41
+ flex: 1,
42
+ fontFamily: fontOf(theme.fontFamily.sans),
43
+ fontSize: theme.fontSize.sm,
44
+ lineHeight: theme.lineHeight.sm,
45
+ color: theme.colors.dim,
46
+ uni__dependencies: [0]
47
+ },
48
+ action: { minHeight: 44 }
49
+ }));
50
+
51
+ //#endregion
52
+ export { InfoStrip };
53
+ //# sourceMappingURL=InfoStrip.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InfoStrip.mjs","names":["StyleSheet","AlertIcon","fontOf","Button","Panel","InfoStrip","message","actionLabel","onAction","styles","strip","text","action","create","theme","flexDirection","alignItems","gap","spacing","padding","uni__dependencies","flex","fontFamily","sans","fontSize","sm","lineHeight","color","colors","dim","minHeight"],"sources":["../../src/components/InfoStrip.tsx"],"sourcesContent":["import { Text } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { AlertIcon } from '../icons/icons';\nimport { fontOf } from '../lib/fonts';\nimport { Button } from './Button';\nimport { Panel } from './Panel';\n\n/** A quiet explanation with an optional text action, without live activity. */\nexport function InfoStrip({\n message,\n actionLabel,\n onAction,\n}: {\n message: string;\n actionLabel?: string;\n onAction?: () => void;\n}) {\n return (\n <Panel style={styles.strip}>\n <AlertIcon size={16} color=\"dim\" />\n <Text style={styles.text}>{message}</Text>\n {onAction && actionLabel ? (\n <Button variant=\"ghost\" style={styles.action} onPress={onAction}>\n {actionLabel}\n </Button>\n ) : null}\n </Panel>\n );\n}\nconst styles = StyleSheet.create((theme) => ({\n strip: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(2), padding: theme.spacing(3) },\n text: {\n flex: 1,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n color: theme.colors.dim,\n },\n action: { minHeight: 44 },\n}));\n"],"mappings":";;;;;;;;;;AASA,SAAgBK,UAAU,EACxBC,SACAC,aACAC,YAKC;CACD,OACE,qBAAC,OAAD;EAAO,OAAOC,OAAOC;YAArB;GACE,oBAAC,WAAD;IAAW,MAAM;IAAI,OAAM;GAAK;GAChC,oBAAC,MAAD;IAAM,OAAOD,OAAOE;cAAOL;GAAc;GACxCE,YAAYD,cACX,oBAAC,QAAD;IAAQ,SAAQ;IAAQ,OAAOE,OAAOG;IAAQ,SAASJ;cACpDD;GACK,KACN;EACC;;AAEX;AACA,MAAME,SAAST,WAAWa,QAAQC,WAAW;CAC3CJ,OAAO;EAAEK,eAAe;EAAOC,YAAY;EAAUC,KAAKH,MAAMI,QAAQ,CAAC;EAAGC,SAASL,MAAMI,QAAQ,CAAC;EAACE,mBAAA,CAAA,CAAA;CAAC;CACtGT,MAAM;EACJU,MAAM;EACNC,YAAYpB,OAAOY,MAAMQ,WAAWC,IAAI;EACxCC,UAAUV,MAAMU,SAASC;EACzBC,YAAYZ,MAAMY,WAAWD;EAC7BE,OAAOb,MAAMc,OAAOC;EAAGT,mBAAA,CAAA,CAAA;CACzB;CACAR,QAAQ,EAAEkB,WAAW,GAAG;AAC1B,EAAE"}
@@ -1,8 +1,10 @@
1
- import { TextInputProps } from "react-native";
1
+ import { TextInput, TextInputProps } from "react-native";
2
+ import { ComponentRef, Ref } from "react";
2
3
  //#region src/components/Input.d.ts
3
4
  export type FieldVariant = 'default' | 'bare';
4
5
  export type FieldSize = 'xs' | 'sm' | 'md' | 'lg';
5
6
  export interface InputProps extends Omit<TextInputProps, 'editable'> {
7
+ ref?: Ref<ComponentRef<typeof TextInput>>;
6
8
  variant?: FieldVariant;
7
9
  /** The same rungs Button names, so a field and the button beside it line up. */
8
10
  size?: FieldSize;
@@ -1 +1 @@
1
- {"version":3,"file":"Input.d.mts","names":[],"sources":["../../src/components/Input.tsx"],"mappings":";;YASY;YACA;iBAOK,mBAAmB,KAAK;EACvC,UAAU;;EAEV,OAAO;;EAEP;EACA;;;;;;wBAOc,QACd,SACA,MACA,SACA,UACA,OACA,SACA,QACA,uBACG,SACF,6BAAU,IAAA"}
1
+ {"version":3,"file":"Input.d.mts","names":[],"sources":["../../src/components/Input.tsx"],"mappings":";;;YASY;YACA;iBAQK,mBAAmB,KAAK;EACvC,MAAM,IAAI,oBAAoB;EAC9B,UAAU;;EAEV,OAAO;;EAEP;EACA;;;;;;wBAOc,QACd,SACA,MACA,SACA,UACA,OACA,SACA,QACA,uBACG,SACF,6BAAU,IAAA"}
@@ -1,9 +1,9 @@
1
1
  import { fontOf } from "../lib/fonts.mjs";
2
- import { useInsideSheet } from "../lib/insideSheet.mjs";
3
- import { withAlpha } from "@agimon-ai/po-web-components/nativeTheme";
4
2
  import { StyleSheet, useUnistyles, withUnistyles } from "react-native-unistyles";
3
+ import { withAlpha } from "@agimon-ai/po-web-components/nativeTheme";
5
4
  import { useState } from "react";
6
5
  import { jsx } from "react/jsx-runtime";
6
+ import { useInsideSheet } from "@agimon-ai/po-native-components/shell";
7
7
  import { BottomSheetTextInput } from "@gorhom/bottom-sheet";
8
8
  import { TextInput } from "react-native-unistyles/components/native/TextInput";
9
9
 
@@ -17,7 +17,7 @@ const ThemedSheetTextInput = withUnistyles(BottomSheetTextInput);
17
17
  * red edge when invalid. Inside a Sheet it becomes the sheet's own input.
18
18
  */
19
19
  function Input({ variant = "default", size = "md", invalid = false, disabled = false, style, onFocus, onBlur, accessibilityState, ...props }) {
20
- const { theme } = useUnistyles();
20
+ const { theme, rt } = useUnistyles();
21
21
  const [focused, setFocused] = useState(false);
22
22
  const Field = useInsideSheet() ? ThemedSheetTextInput : TextInput;
23
23
  const _styles = styles;
@@ -28,6 +28,7 @@ function Input({ variant = "default", size = "md", invalid = false, disabled = f
28
28
  });
29
29
  return /* @__PURE__ */ jsx(Field, {
30
30
  autoCorrect: false,
31
+ keyboardAppearance: rt.themeName === "dark" ? "dark" : "light",
31
32
  spellCheck: false,
32
33
  placeholderTextColor: theme.colors.faint,
33
34
  selectionColor: theme.colors.green,
@@ -1 +1 @@
1
- {"version":3,"file":"Input.mjs","names":["withAlpha","BottomSheetTextInput","useState","TextInputProps","StyleSheet","useUnistyles","withUnistyles","fontOf","useInsideSheet","FieldVariant","FieldSize","FOCUS_EDGE_ALPHA_PERCENT","DISABLED_OPACITY","ThemedSheetTextInput","InputProps","Omit","variant","size","invalid","disabled","Input","style","onFocus","onBlur","accessibilityState","props","theme","focused","setFocused","Field","TextInput","_styles","styles","useVariants","undefined","colors","faint","green","event","field","borderColor","create","minWidth","minHeight","color","hi","fontFamily","sans","variants","default","borderRadius","DEFAULT","borderWidth","border","backgroundColor","deep","bare","padding","xs","paddingHorizontal","spacing","paddingVertical","fontSize","sm","md","base","lg","compoundVariants","uni__dependencies","red","opacity"],"sources":["../../src/components/Input.tsx"],"sourcesContent":["import { withAlpha } from '@agimon-ai/po-web-components/nativeTheme';\nimport { BottomSheetTextInput } from '@gorhom/bottom-sheet';\nimport { useState } from 'react';\nimport { TextInput, type TextInputProps } from 'react-native';\nimport { StyleSheet, useUnistyles, withUnistyles } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { useInsideSheet } from '../lib/insideSheet';\n\nexport type FieldVariant = 'default' | 'bare';\nexport type FieldSize = 'xs' | 'sm' | 'md' | 'lg';\n\n/** `focus:border-po-green/60`. */\nconst FOCUS_EDGE_ALPHA_PERCENT = 60;\nconst DISABLED_OPACITY = 0.5;\n\nconst ThemedSheetTextInput = withUnistyles(BottomSheetTextInput);\nexport interface InputProps extends Omit<TextInputProps, 'editable'> {\n variant?: FieldVariant;\n /** The same rungs Button names, so a field and the button beside it line up. */\n size?: FieldSize;\n /** The value is wrong: red edge and red text, as `aria-invalid` on the web. */\n invalid?: boolean;\n disabled?: boolean;\n}\n\n/**\n * The one text field: deep well, quiet border, jade edge and cursor on focus,\n * red edge when invalid. Inside a Sheet it becomes the sheet's own input.\n */\nexport function Input({\n variant = 'default',\n size = 'md',\n invalid = false,\n disabled = false,\n style,\n onFocus,\n onBlur,\n accessibilityState,\n ...props\n}: InputProps) {\n const { theme } = useUnistyles();\n const [focused, setFocused] = useState(false);\n // Inside a Sheet the field must be the sheet's own input, so the sheet rises with the keyboard.\n const Field = useInsideSheet() ? ThemedSheetTextInput : TextInput;\n // Unistyles reserves a variant named `default` as the fallback for an unset variant.\n styles.useVariants({ variant: variant === 'bare' ? 'bare' : undefined, size });\n return (\n <Field\n autoCorrect={false}\n spellCheck={false}\n placeholderTextColor={theme.colors.faint}\n selectionColor={theme.colors.green}\n cursorColor={theme.colors.green}\n editable={!disabled}\n accessibilityState={{ ...accessibilityState, disabled }}\n onFocus={(event) => {\n setFocused(true);\n onFocus?.(event);\n }}\n onBlur={(event) => {\n setFocused(false);\n onBlur?.(event);\n }}\n style={[\n styles.field,\n // Alpha mixes are computed in render from useUnistyles(), not in StyleSheet.create: on web Unistyles hands\n // the stylesheet CSS variables, which withAlpha cannot read.\n focused && variant === 'default' && { borderColor: withAlpha(theme.colors.green, FOCUS_EDGE_ALPHA_PERCENT) },\n invalid && styles.invalid,\n disabled && styles.disabled,\n style,\n ]}\n {...props}\n />\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n field: {\n minWidth: 0,\n minHeight: 44,\n color: theme.colors.hi,\n fontFamily: fontOf(theme.fontFamily.sans),\n variants: {\n variant: {\n default: {\n borderRadius: theme.borderRadius.DEFAULT,\n borderWidth: 1,\n borderColor: theme.colors.border,\n backgroundColor: theme.colors.deep,\n },\n /** No well: a composer or a search that draws its own surface keeps the type and drops the box. */\n bare: { borderWidth: 0, backgroundColor: 'transparent', padding: 0 },\n },\n size: {\n xs: {\n paddingHorizontal: theme.spacing(1.5),\n paddingVertical: theme.spacing(0.5),\n fontSize: theme.fontSize.sm,\n },\n sm: {\n paddingHorizontal: theme.spacing(2),\n paddingVertical: theme.spacing(1),\n fontSize: theme.fontSize.sm,\n },\n md: {\n paddingHorizontal: theme.spacing(2.5),\n paddingVertical: theme.spacing(1.5),\n fontSize: theme.fontSize.base,\n },\n lg: {\n paddingHorizontal: theme.spacing(3),\n paddingVertical: theme.spacing(1.5),\n fontSize: theme.fontSize.base,\n },\n },\n },\n compoundVariants: [{ variant: 'bare', styles: { padding: 0, paddingHorizontal: 0, paddingVertical: 0 } }],\n },\n invalid: { borderColor: theme.colors['edge-red'], color: theme.colors.red },\n disabled: { opacity: DISABLED_OPACITY },\n}));\n"],"mappings":";;;;;;;;;;;AAaA,MAAMW,2BAA2B;AACjC,MAAMC,mBAAmB;AAEzB,MAAMC,uBAAuBP,cAAcL,oBAAoB;;;;;AAc/D,SAAgBmB,MAAM,EACpBJ,UAAU,WACVC,OAAO,MACPC,UAAU,OACVC,WAAW,OACXE,OACAC,SACAC,QACAC,oBACA,GAAGC,SACU;CACb,MAAM,EAAEC,UAAUrB,aAAa;CAC/B,MAAM,CAACsB,SAASC,cAAc1B,SAAS,KAAK;CAE5C,MAAM2B,QAAQrB,eAAe,IAAIK,uBAAuBiB;CACxD,MAAAC,UAAAC;CAAA;EAAA,MAAAA,SAAAD,QAAAE,YACmB;GAAEjB,SAASA,YAAY,SAAS,SAASkB;GAAWjB;EAAK,CAAC;EAC7E,OACE,oBAAC,OAAD;GACE,aAAa;GACb,YAAY;GACZ,sBAAsBS,MAAMS,OAAOC;GACnC,gBAAgBV,MAAMS,OAAOE;GAC7B,aAAaX,MAAMS,OAAOE;GAC1B,UAAU,CAAClB;GACX,oBAAoB;IAAE,GAAGK;IAAoBL;GAAS;GACtD,UAAUmB,UAAU;IAClBV,WAAW,IAAI;IACfN,UAAUgB,KAAK;GACjB;GACA,SAASA,UAAU;IACjBV,WAAW,KAAK;IAChBL,SAASe,KAAK;GAChB;GACA,OAAO;IACLN,OAAOO;IAGPZ,WAAWX,YAAY,aAAa,EAAEwB,aAAaxC,UAAU0B,MAAMS,OAAOE,OAAO1B,wBAAwB,EAAE;IAC3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mBAAA,CAAA,CAAA;CAAC;CAC1EjD,UAAU,EAAEmD,SAAS1D,iBAAiB;AACxC,EAAE"}
1
+ {"version":3,"file":"Input.mjs","names":["useInsideSheet","withAlpha","BottomSheetTextInput","useState","ComponentRef","Ref","TextInputProps","StyleSheet","useUnistyles","withUnistyles","fontOf","FieldVariant","FieldSize","FOCUS_EDGE_ALPHA_PERCENT","DISABLED_OPACITY","ThemedSheetTextInput","TextInput","InputProps","Omit","ref","variant","size","invalid","disabled","Input","style","onFocus","onBlur","accessibilityState","props","theme","rt","focused","setFocused","Field","_styles","styles","useVariants","undefined","themeName","colors","faint","green","event","field","borderColor","create","minWidth","minHeight","color","hi","fontFamily","sans","variants","default","borderRadius","DEFAULT","borderWidth","border","backgroundColor","deep","bare","padding","xs","paddingHorizontal","spacing","paddingVertical","fontSize","sm","md","base","lg","compoundVariants","uni__dependencies","red","opacity"],"sources":["../../src/components/Input.tsx"],"sourcesContent":["import { useInsideSheet } from '@agimon-ai/po-native-components/shell';\nimport { withAlpha } from '@agimon-ai/po-web-components/nativeTheme';\nimport { BottomSheetTextInput } from '@gorhom/bottom-sheet';\nimport { useState, type ComponentRef, type Ref } from 'react';\nimport { TextInput, type TextInputProps } from 'react-native';\nimport { StyleSheet, useUnistyles, withUnistyles } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\n\nexport type FieldVariant = 'default' | 'bare';\nexport type FieldSize = 'xs' | 'sm' | 'md' | 'lg';\n\n/** `focus:border-po-green/60`. */\nconst FOCUS_EDGE_ALPHA_PERCENT = 60;\nconst DISABLED_OPACITY = 0.5;\n\n// Both fields expose the native input handle; the sheet's gesture-handler declaration names its component instead.\nconst ThemedSheetTextInput = withUnistyles(BottomSheetTextInput) as unknown as typeof TextInput;\nexport interface InputProps extends Omit<TextInputProps, 'editable'> {\n ref?: Ref<ComponentRef<typeof TextInput>>;\n variant?: FieldVariant;\n /** The same rungs Button names, so a field and the button beside it line up. */\n size?: FieldSize;\n /** The value is wrong: red edge and red text, as `aria-invalid` on the web. */\n invalid?: boolean;\n disabled?: boolean;\n}\n\n/**\n * The one text field: deep well, quiet border, jade edge and cursor on focus,\n * red edge when invalid. Inside a Sheet it becomes the sheet's own input.\n */\nexport function Input({\n variant = 'default',\n size = 'md',\n invalid = false,\n disabled = false,\n style,\n onFocus,\n onBlur,\n accessibilityState,\n ...props\n}: InputProps) {\n const { theme, rt } = useUnistyles();\n const [focused, setFocused] = useState(false);\n // Inside a Sheet the field must be the sheet's own input, so the sheet rises with the keyboard.\n const Field = useInsideSheet() ? ThemedSheetTextInput : TextInput;\n // Unistyles reserves a variant named `default` as the fallback for an unset variant.\n styles.useVariants({ variant: variant === 'bare' ? 'bare' : undefined, size });\n return (\n <Field\n autoCorrect={false}\n // iOS draws the keyboard light by default, a bright slab under a dark screen.\n keyboardAppearance={rt.themeName === 'dark' ? 'dark' : 'light'}\n spellCheck={false}\n placeholderTextColor={theme.colors.faint}\n selectionColor={theme.colors.green}\n cursorColor={theme.colors.green}\n editable={!disabled}\n accessibilityState={{ ...accessibilityState, disabled }}\n onFocus={(event) => {\n setFocused(true);\n onFocus?.(event);\n }}\n onBlur={(event) => {\n setFocused(false);\n onBlur?.(event);\n }}\n style={[\n styles.field,\n // Alpha mixes are computed in render from useUnistyles(), not in StyleSheet.create: on web Unistyles hands\n // the stylesheet CSS variables, which withAlpha cannot read.\n focused && variant === 'default' && { borderColor: withAlpha(theme.colors.green, FOCUS_EDGE_ALPHA_PERCENT) },\n invalid && styles.invalid,\n disabled && styles.disabled,\n style,\n ]}\n {...props}\n />\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n field: {\n minWidth: 0,\n minHeight: 44,\n color: theme.colors.hi,\n fontFamily: fontOf(theme.fontFamily.sans),\n variants: {\n variant: {\n default: {\n borderRadius: theme.borderRadius.DEFAULT,\n borderWidth: 1,\n borderColor: theme.colors.border,\n backgroundColor: theme.colors.deep,\n },\n /** No well: a composer or a search that draws its own surface keeps the type and drops the box. */\n bare: { borderWidth: 0, backgroundColor: 'transparent', padding: 0 },\n },\n size: {\n xs: {\n paddingHorizontal: theme.spacing(1.5),\n paddingVertical: theme.spacing(0.5),\n fontSize: theme.fontSize.sm,\n },\n sm: {\n paddingHorizontal: theme.spacing(2),\n paddingVertical: theme.spacing(1),\n fontSize: theme.fontSize.sm,\n },\n md: {\n paddingHorizontal: theme.spacing(2.5),\n paddingVertical: theme.spacing(1.5),\n fontSize: theme.fontSize.base,\n },\n lg: {\n paddingHorizontal: theme.spacing(3),\n paddingVertical: theme.spacing(1.5),\n fontSize: theme.fontSize.base,\n },\n },\n },\n compoundVariants: [{ variant: 'bare', styles: { padding: 0, paddingHorizontal: 0, paddingVertical: 0 } }],\n },\n invalid: { borderColor: theme.colors['edge-red'], color: theme.colors.red },\n disabled: { opacity: DISABLED_OPACITY },\n}));\n"],"mappings":";;;;;;;;;;;AAaA,MAAMa,2BAA2B;AACjC,MAAMC,mBAAmB;AAGzB,MAAMC,uBAAuBN,cAAcP,oBAAoB;;;;;AAe/D,SAAgBsB,MAAM,EACpBJ,UAAU,WACVC,OAAO,MACPC,UAAU,OACVC,WAAW,OACXE,OACAC,SACAC,QACAC,oBACA,GAAGC,SACU;CACb,MAAM,EAAEC,OAAOC,OAAOvB,aAAa;CACnC,MAAM,CAACwB,SAASC,cAAc9B,SAAS,KAAK;CAE5C,MAAM+B,QAAQlC,eAAe,IAAIe,uBAAuBC;CACxD,MAAAmB,UAAAC;CAAA;EAAA,MAAAA,SAAAD,QAAAE,YACmB;GAAEjB,SAASA,YAAY,SAAS,SAASkB;GAAWjB;EAAK,CAAC;EAC7E,OACE,oBAAC,OAAD;GACE,aAAa;GAEb,oBAAoBU,GAAGQ,cAAc,SAAS,SAAS;GACvD,YAAY;GACZ,sBAAsBT,MAAMU,OAAOC;GACnC,gBAAgBX,MAAMU,OAAOE;GAC7B,aAAaZ,MAAMU,OAAOE;GAC1B,UAAU,CAACnB;GACX,oBAAoB;IAAE,GAAGK;IAAoBL;GAA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SAASG;IAC3B;GACF;EACF;EACAE,kBAAkB,CAAC;GAAEpD,SAAS;GAAQgB,QAAQ;IAAE0B,SAAS;IAAGE,mBAAmB;IAAGE,iBAAiB;GAAE;EAAE,CAAC;EAACO,mBAAA,CAAA,GAAA,CAAA;CAC3G;CACAnD,SAAS;EAAEuB,aAAaf,MAAMU,OAAO;EAAaS,OAAOnB,MAAMU,OAAOkC;EAAGD,mBAAA,CAAA,CAAA;CAAC;CAC1ElD,UAAU,EAAEoD,SAAS7D,iBAAiB;AACxC,EAAE"}
@@ -1,6 +1,6 @@
1
1
  import { fontOf } from "../lib/fonts.mjs";
2
- import { StyleSheet } from "react-native-unistyles";
3
2
  import { Text } from "react-native-unistyles/components/native/Text";
3
+ import { StyleSheet } from "react-native-unistyles";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
 
6
6
  //#region src/components/Label.tsx
@@ -0,0 +1,13 @@
1
+ import { ReferenceRenderer } from "./Markdown.mjs";
2
+ import { StyleProp, TextStyle } from "react-native";
3
+ //#region src/components/LinkText.d.ts
4
+ export interface LinkTextProps {
5
+ text: string;
6
+ style?: StyleProp<TextStyle>;
7
+ /** Given to each link too, so holding a link still reaches the surrounding long press. */
8
+ onLongPress?: () => void;
9
+ renderReference?: ReferenceRenderer;
10
+ }
11
+ export declare function LinkText({ text, style, onLongPress, renderReference }: LinkTextProps): import("react").JSX.Element;
12
+ //#endregion
13
+ //# sourceMappingURL=LinkText.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkText.d.mts","names":[],"sources":["../../src/components/LinkText.tsx"],"mappings":";;;iBAciB;EACf;EACA,QAAQ,UAAU;;EAElB;EACA,kBAAkB;;wBAGJ,WAAW,MAAM,OAAO,aAAa,mBAAmB,gCAAa,IAAA"}
@@ -0,0 +1,32 @@
1
+ import { splitWebLinks } from "../lib/markdown.mjs";
2
+ import { Text } from "react-native-unistyles/components/native/Text";
3
+ import { StyleSheet } from "react-native-unistyles";
4
+ import { Linking } from "react-native";
5
+ import { Fragment, useMemo } from "react";
6
+ import { jsx } from "react/jsx-runtime";
7
+
8
+ //#region src/components/LinkText.tsx
9
+ function LinkText({ text, style, onLongPress, renderReference }) {
10
+ const parts = useMemo(() => splitWebLinks(text), [text]);
11
+ return /* @__PURE__ */ jsx(Text, {
12
+ style,
13
+ children: parts.map((part, index) => part.reference !== void 0 ? /* @__PURE__ */ jsx(Fragment, { children: renderReference?.(part.reference, { onLongPress }) ?? part.text }, index) : part.href === void 0 ? part.text : /* @__PURE__ */ jsx(Text, {
14
+ accessibilityRole: "link",
15
+ onPress: () => {
16
+ Linking.openURL(part.href).catch(() => void 0);
17
+ },
18
+ onLongPress,
19
+ style: styles.link,
20
+ children: part.text
21
+ }, index))
22
+ });
23
+ }
24
+ const styles = StyleSheet.create((theme) => ({ link: {
25
+ color: theme.colors.blue,
26
+ textDecorationLine: "underline",
27
+ uni__dependencies: [0]
28
+ } }));
29
+
30
+ //#endregion
31
+ export { LinkText };
32
+ //# sourceMappingURL=LinkText.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkText.mjs","names":["Fragment","useMemo","Linking","StyleProp","TextStyle","StyleSheet","splitWebLinks","ReferenceRenderer","LinkTextProps","text","style","onLongPress","renderReference","LinkText","parts","map","part","index","reference","undefined","href","openURL","catch","styles","link","create","theme","color","colors","blue","textDecorationLine","uni__dependencies"],"sources":["../../src/components/LinkText.tsx"],"sourcesContent":["import { Fragment, useMemo } from 'react';\nimport { Linking, type StyleProp, Text, type TextStyle } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { splitWebLinks } from '../lib/markdown';\nimport type { ReferenceRenderer } from './Markdown';\n\n/*\n * Plain text whose bare http(s) addresses open in the system browser, for text\n * that is not Markdown: what the person typed, a notice. The web's notices\n * link the same way. `@scheme:value` references draw through `renderReference`,\n * as Markdown's do, and stay text without it.\n */\n\nexport interface LinkTextProps {\n text: string;\n style?: StyleProp<TextStyle>;\n /** Given to each link too, so holding a link still reaches the surrounding long press. */\n onLongPress?: () => void;\n renderReference?: ReferenceRenderer;\n}\n\nexport function LinkText({ text, style, onLongPress, renderReference }: LinkTextProps) {\n const parts = useMemo(() => splitWebLinks(text), [text]);\n return (\n <Text style={style}>\n {parts.map((part, index) =>\n part.reference !== undefined ? (\n <Fragment key={index}>{renderReference?.(part.reference, { onLongPress }) ?? part.text}</Fragment>\n ) : part.href === undefined ? (\n part.text\n ) : (\n <Text\n key={index}\n accessibilityRole=\"link\"\n onPress={() => {\n // A link the system cannot open stays text, as Markdown's links do; there is no one to tell.\n Linking.openURL(part.href!).catch(() => undefined);\n }}\n onLongPress={onLongPress}\n style={styles.link}\n >\n {part.text}\n </Text>\n ),\n )}\n </Text>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n link: { color: theme.colors.blue, textDecorationLine: 'underline' },\n}));\n"],"mappings":";;;;;;;;AAsBA,SAAgBa,SAAS,EAAEJ,MAAMC,OAAOC,aAAaC,mBAAkC;CACrF,MAAME,QAAQb,cAAcK,cAAcG,IAAI,GAAG,CAACA,IAAI,CAAC;CACvD,OACE,oBAAC,MAAD;EAAaC;YACVI,MAAMC,KAAKC,MAAMC,UAChBD,KAAKE,cAAcC,SACjB,oBAAC,UAAD,YAAuBP,kBAAkBI,KAAKE,WAAW,EAAEP,YAAY,CAAC,KAAKK,KAAKP,KAAe,GAAlFQ,KAAkF,IAC/FD,KAAKI,SAASD,SAChBH,KAAKP,OAEL,oBAAC,MAAD;GAEE,mBAAkB;GAClB,eAAe;IAEbP,QAAQmB,QAAQL,KAAKI,IAAK,CAAC,CAACE,YAAYH,MAAS;GACnD;GACaR;GACb,OAAOY,OAAOC;aAEbR,KAAKP;EACF,GAVCQ,KAUD,CAEV;CACI;AAEV;AAEA,MAAMM,SAASlB,WAAWoB,QAAQC,WAAW,EAC3CF,MAAM;CAAEG,OAAOD,MAAME,OAAOC;CAAMC,oBAAoB;CAAWC,mBAAA,CAAA,CAAA;AAAC,EACpE,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"List.d.mts","names":[],"sources":["../../src/components/List.tsx"],"mappings":";;;iBAoBiB,UAAU;EACzB,eAAe;EACf,aAAa,MAAM,GAAG,kBAAkB;;EAExC,eAAe,MAAM,GAAG;;;;;EAKxB;;EAEA;;EAEA,QAAQ;EACR,SAAS;EACT,SAAS;EACT;EACA;;EAEA,QAAQ,UAAU;;EAElB;;wBAOc,KAAK,KACnB,MACA,YACA,cACA,eACA,YACA,OACA,QACA,QACA,cACA,oBACA,OACA,kBACC,UAAU,qBAAE,IAAA;iBAuBE;EACf,OAAO;;EAEP,cAAc;;EAEd,UAAU;;EAEV,WAAW;;EAEX;EACA;EACA;;EAEA;EACA;EACA,QAAQ,UAAU;;;wBAIJ,UACd,OACA,aACA,SACA,UACA,UACA,UACA,SACA,YACA,oBACA,SACC,+BAAY,IAAA"}
1
+ {"version":3,"file":"List.d.mts","names":[],"sources":["../../src/components/List.tsx"],"mappings":";;;iBAkCiB,UAAU;EACzB,eAAe;EACf,aAAa,MAAM,GAAG,kBAAkB;;EAExC,eAAe,MAAM,GAAG;;;;;EAKxB;;EAEA;;EAEA,QAAQ;EACR,SAAS;EACT,SAAS;EACT;EACA;;EAEA,QAAQ,UAAU;;EAElB;;wBAOc,KAAK,KACnB,MACA,YACA,cACA,eACA,YACA,OACA,QACA,QACA,cACA,oBACA,OACA,kBACC,UAAU,qBAAE,IAAA;iBAuDE;EACf,OAAO;;EAEP,cAAc;;EAEd,UAAU;;EAEV,WAAW;;EAEX;EACA;EACA;;EAEA;EACA;EACA,QAAQ,UAAU;;;wBAIJ,UACd,OACA,aACA,SACA,UACA,UACA,UACA,SACA,YACA,oBACA,SACC,+BAAY,IAAA"}
@@ -1,11 +1,16 @@
1
1
  import { fontOf } from "../lib/fonts.mjs";
2
- import { ChevronRightIcon } from "../icons/icons.mjs";
2
+ import { Button } from "./Button.mjs";
3
+ import { ChevronDownIcon, ChevronRightIcon } from "../icons/icons.mjs";
3
4
  import { View } from "react-native-unistyles/components/native/View";
5
+ import { Text } from "react-native-unistyles/components/native/Text";
4
6
  import { StyleSheet } from "react-native-unistyles";
5
7
  import { Platform } from "react-native";
6
- import { Text } from "react-native-unistyles/components/native/Text";
7
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { useCallback, useRef, useState } from "react";
9
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
10
  import { Pressable } from "react-native-unistyles/components/native/Pressable";
11
+ import { useT } from "@agimon-ai/po-core/native";
12
+ import { useInsideSheet } from "@agimon-ai/po-native-components/shell";
13
+ import { useBottomSheetScrollableCreator } from "@gorhom/bottom-sheet";
9
14
  import { FlashList } from "@shopify/flash-list";
10
15
 
11
16
  //#region src/components/List.tsx
@@ -13,35 +18,61 @@ const MIN_ROW_HEIGHT = 44;
13
18
  const DISABLED_OPACITY = .4;
14
19
  /** How close to the bottom a reader must be for a new row to keep the list pinned, as a fraction of the visible height. */
15
20
  const PIN_THRESHOLD = .1;
21
+ /** How far above the bottom, in visible heights, a chat reader must scroll before the jump-to-latest button shows. */
22
+ const JUMP_THRESHOLD = 1;
16
23
  function Separator() {
17
24
  return /* @__PURE__ */ jsx(View, { style: styles.separator });
18
25
  }
19
26
  function List({ data, renderItem, keyExtractor, startAtBottom = false, separators = true, empty, header, footer, onEndReached, accessibilityLabel, style, contentPadding }) {
20
- return /* @__PURE__ */ jsx(View, {
27
+ const t = useT();
28
+ const renderRow = useCallback(({ item, index }) => renderItem(item, index), [renderItem]);
29
+ const listRef = useRef(null);
30
+ const [awayFromBottom, setAwayFromBottom] = useState(false);
31
+ const sheetScroll = useBottomSheetScrollableCreator();
32
+ const insideSheet = useInsideSheet();
33
+ const onScroll = useCallback(({ nativeEvent }) => {
34
+ const { contentOffset, contentSize, layoutMeasurement } = nativeEvent;
35
+ const distance = contentSize.height - layoutMeasurement.height - contentOffset.y;
36
+ setAwayFromBottom(distance > layoutMeasurement.height * JUMP_THRESHOLD);
37
+ }, []);
38
+ return /* @__PURE__ */ jsxs(View, {
21
39
  style: [styles.frame, style],
22
40
  accessibilityLabel,
23
- children: /* @__PURE__ */ jsx(FlashList, {
41
+ children: [/* @__PURE__ */ jsx(FlashList, {
42
+ ref: listRef,
43
+ renderScrollComponent: insideSheet ? sheetScroll : void 0,
44
+ onScroll: startAtBottom ? onScroll : void 0,
45
+ scrollEventThrottle: startAtBottom ? 100 : void 0,
24
46
  data,
25
- renderItem: ({ item, index }) => renderItem(item, index),
47
+ renderItem: renderRow,
26
48
  keyExtractor,
27
49
  ItemSeparatorComponent: separators ? Separator : null,
28
- ListEmptyComponent: empty === void 0 ? null : /* @__PURE__ */ jsx(Fragment, { children: empty }),
29
- ListHeaderComponent: header === void 0 ? null : /* @__PURE__ */ jsx(Fragment, { children: header }),
30
- ListFooterComponent: footer === void 0 ? null : /* @__PURE__ */ jsx(Fragment, { children: footer }),
50
+ ListEmptyComponent: empty === void 0 ? null : /* @__PURE__ */ jsx(Fragment$1, { children: empty }),
51
+ ListHeaderComponent: header === void 0 ? null : /* @__PURE__ */ jsx(Fragment$1, { children: header }),
52
+ ListFooterComponent: footer === void 0 ? null : /* @__PURE__ */ jsx(Fragment$1, { children: footer }),
31
53
  onEndReached,
54
+ keyboardDismissMode: Platform.OS === "ios" ? "interactive" : "on-drag",
55
+ keyboardShouldPersistTaps: startAtBottom ? "never" : "handled",
32
56
  contentInsetAdjustmentBehavior: "automatic",
33
57
  contentContainerStyle: contentPadding === void 0 ? void 0 : { padding: contentPadding },
34
58
  maintainVisibleContentPosition: startAtBottom ? {
35
59
  startRenderingFromBottom: true,
36
60
  autoscrollToBottomThreshold: PIN_THRESHOLD
37
61
  } : void 0
38
- })
62
+ }), startAtBottom && awayFromBottom ? /* @__PURE__ */ jsx(Button, {
63
+ variant: "subtle",
64
+ size: "icon-md",
65
+ accessibilityLabel: t("nativeComponents.list.jumpToLatest", "Jump to latest"),
66
+ onPress: () => listRef.current?.scrollToEnd({ animated: true }),
67
+ style: styles.jump,
68
+ children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: 18 })
69
+ }) : null]
39
70
  });
40
71
  }
41
72
  /** One list row: 44pt tall, optional leading and trailing slots, pressable when it navigates. */
42
73
  function ListRow({ title, description, leading, trailing, selected = false, disabled = false, onPress, disclosure, accessibilityLabel, style }) {
43
74
  const chevron = disclosure ?? (onPress !== void 0 && Platform.OS === "ios");
44
- const content = /* @__PURE__ */ jsxs(Fragment, { children: [
75
+ const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
45
76
  leading,
46
77
  /* @__PURE__ */ jsxs(View, {
47
78
  style: styles.text,
@@ -99,6 +130,14 @@ const styles = StyleSheet.create((theme) => ({
99
130
  flex: 1,
100
131
  minHeight: 0
101
132
  },
133
+ jump: {
134
+ position: "absolute",
135
+ bottom: theme.spacing(3),
136
+ alignSelf: "center",
137
+ borderRadius: theme.borderRadius.full,
138
+ borderColor: theme.colors.border,
139
+ uni__dependencies: [0]
140
+ },
102
141
  separator: {
103
142
  height: StyleSheet.hairlineWidth,
104
143
  marginLeft: theme.spacing(4),
@@ -1 +1 @@
1
- {"version":3,"file":"List.mjs","names":["FlashList","ReactElement","ReactNode","Platform","StyleProp","ViewStyle","StyleSheet","ChevronRightIcon","fontOf","MIN_ROW_HEIGHT","DISABLED_OPACITY","PIN_THRESHOLD","ListProps","data","T","renderItem","item","index","keyExtractor","startAtBottom","separators","empty","header","footer","onEndReached","accessibilityLabel","style","contentPadding","Separator","styles","separator","List","frame","undefined","padding","startRenderingFromBottom","autoscrollToBottomThreshold","ListRowProps","title","description","leading","trailing","selected","disabled","onPress","disclosure","ListRow","chevron","OS","content","text","titleSelected","row","pressed","create","theme","flex","minHeight","height","hairlineWidth","marginLeft","spacing","backgroundColor","colors","uni__dependencies","flexDirection","alignItems","gap","paddingHorizontal","paddingVertical","panel","opacity","minWidth","color","hi","fontFamily","sans","fontSize","base","lineHeight","fontWeight","medium","green","semibold","faint","sm"],"sources":["../../src/components/List.tsx"],"sourcesContent":["import { FlashList } from '@shopify/flash-list';\nimport type { ReactElement, ReactNode } from 'react';\nimport { Platform, Pressable, type StyleProp, Text, View, type ViewStyle } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { ChevronRightIcon } from '../icons/icons';\nimport { fontOf } from '../lib/fonts';\n\n/*\n * A virtualised list on FlashList: sessions, devices, a transcript. Rows\n * recycle, separators are hairlines, and a chat list can start at the bottom\n * and stay pinned there as rows arrive. The public props are this package's\n * own, so FlashList's types never reach a caller.\n */\n\nconst MIN_ROW_HEIGHT = 44;\nconst DISABLED_OPACITY = 0.4;\n/** How close to the bottom a reader must be for a new row to keep the list pinned, as a fraction of the visible height. */\nconst PIN_THRESHOLD = 0.1;\n\nexport interface ListProps<T> {\n data: readonly T[];\n renderItem: (item: T, index: number) => ReactElement | null;\n /** A stable key per row; FlashList recycles views by it. */\n keyExtractor: (item: T, index: number) => string;\n /**\n * A chat list: render from the bottom and keep the newest row in view as\n * rows arrive, while the reader is near the bottom.\n */\n startAtBottom?: boolean;\n /** Hairline separators between rows. On by default. */\n separators?: boolean;\n /** Shown when `data` is empty. */\n empty?: ReactNode;\n header?: ReactNode;\n footer?: ReactNode;\n onEndReached?: () => void;\n accessibilityLabel?: string;\n /** The list's frame; give it a height or a flex parent, since a virtualised list needs bounds. */\n style?: StyleProp<ViewStyle>;\n /** Padding around the rows. */\n contentPadding?: number;\n}\n\nfunction Separator() {\n return <View style={styles.separator} />;\n}\n\nexport function List<T>({\n data,\n renderItem,\n keyExtractor,\n startAtBottom = false,\n separators = true,\n empty,\n header,\n footer,\n onEndReached,\n accessibilityLabel,\n style,\n contentPadding,\n}: ListProps<T>) {\n return (\n <View style={[styles.frame, style]} accessibilityLabel={accessibilityLabel}>\n <FlashList\n data={data}\n renderItem={({ item, index }) => renderItem(item, index)}\n keyExtractor={keyExtractor}\n ItemSeparatorComponent={separators ? Separator : null}\n ListEmptyComponent={empty === undefined ? null : <>{empty}</>}\n ListHeaderComponent={header === undefined ? null : <>{header}</>}\n ListFooterComponent={footer === undefined ? null : <>{footer}</>}\n onEndReached={onEndReached}\n // Lets UIKit inset the rows under a translucent or large-title header instead of drawing beneath it.\n contentInsetAdjustmentBehavior=\"automatic\"\n contentContainerStyle={contentPadding === undefined ? undefined : { padding: contentPadding }}\n maintainVisibleContentPosition={\n startAtBottom ? { startRenderingFromBottom: true, autoscrollToBottomThreshold: PIN_THRESHOLD } : undefined\n }\n />\n </View>\n );\n}\n\nexport interface ListRowProps {\n title: ReactNode;\n /** A second, quieter line under the title. */\n description?: ReactNode;\n /** Before the text: a Dot, an icon. */\n leading?: ReactNode;\n /** After the text: a Badge, a ghost button, a count. */\n trailing?: ReactNode;\n /** Selected rows sit on a green tint. */\n selected?: boolean;\n disabled?: boolean;\n onPress?: () => void;\n /** The iOS disclosure chevron. Defaults to on for a pressable row on iOS, where rows that navigate wear one. */\n disclosure?: boolean;\n accessibilityLabel?: string;\n style?: StyleProp<ViewStyle>;\n}\n\n/** One list row: 44pt tall, optional leading and trailing slots, pressable when it navigates. */\nexport function ListRow({\n title,\n description,\n leading,\n trailing,\n selected = false,\n disabled = false,\n onPress,\n disclosure,\n accessibilityLabel,\n style,\n}: ListRowProps) {\n const chevron = disclosure ?? (onPress !== undefined && Platform.OS === 'ios');\n const content = (\n <>\n {leading}\n <View style={styles.text}>\n {typeof title === 'string' ? (\n <Text numberOfLines={1} style={[styles.title, selected && styles.titleSelected]}>\n {title}\n </Text>\n ) : (\n title\n )}\n {typeof description === 'string' ? (\n <Text numberOfLines={2} style={styles.description}>\n {description}\n </Text>\n ) : (\n description\n )}\n </View>\n {trailing}\n {chevron ? <ChevronRightIcon size={14} color=\"faint\" /> : null}\n </>\n );\n if (onPress === undefined) {\n return (\n <View\n accessibilityLabel={accessibilityLabel}\n accessibilityState={{ selected, disabled }}\n style={[styles.row, selected && styles.selected, disabled && styles.disabled, style]}\n >\n {content}\n </View>\n );\n }\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n accessibilityState={{ selected, disabled }}\n disabled={disabled}\n onPress={onPress}\n style={({ pressed }) => [\n styles.row,\n selected && styles.selected,\n pressed && styles.pressed,\n disabled && styles.disabled,\n style,\n ]}\n >\n {content}\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n frame: { flex: 1, minHeight: 0 },\n separator: {\n height: StyleSheet.hairlineWidth,\n marginLeft: theme.spacing(4),\n backgroundColor: theme.colors['border-soft'],\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(3),\n minHeight: MIN_ROW_HEIGHT,\n paddingHorizontal: theme.spacing(4),\n paddingVertical: theme.spacing(2),\n },\n selected: { backgroundColor: theme.colors['tint-green'] },\n pressed: { backgroundColor: theme.colors.panel },\n disabled: { opacity: DISABLED_OPACITY },\n text: { flex: 1, minWidth: 0, gap: theme.spacing(0.5) },\n title: {\n color: theme.colors.hi,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n fontWeight: theme.fontWeight.medium,\n },\n titleSelected: { color: theme.colors.green, fontWeight: theme.fontWeight.semibold },\n description: {\n color: theme.colors.faint,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n}));\n"],"mappings":";;;;;;;;;;;AAeA,MAAMS,iBAAiB;AACvB,MAAMC,mBAAmB;;AAEzB,MAAMC,gBAAgB;AA0BtB,SAASiB,YAAY;CACnB,OAAO,oBAAC,MAAD,EAAM,OAAOC,OAAOC,UAAU;AACvC;AAEA,SAAgBC,KAAQ,EACtBlB,MACAE,YACAG,cACAC,gBAAgB,OAChBC,aAAa,MACbC,OACAC,QACAC,QACAC,cACAC,oBACAC,OACAC,kBACe;CACf,OACE,oBAAC,MAAD;EAAM,OAAO,CAACE,OAAOG,OAAON,KAAK;EAAuBD;YACtD,oBAAC,WAAD;GACQZ;GACN,aAAa,EAAEG,MAAMC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E,OAAO+C,MAAMoB,WAAWC,IAAI;EACxCC,UAAUtB,MAAMsB,SAASQ;EACzBN,YAAYxB,MAAMwB,WAAWM;EAAErB,mBAAA,CAAA,CAAA;CACjC;AACF,EAAE"}
1
+ {"version":3,"file":"List.mjs","names":["useT","useInsideSheet","useBottomSheetScrollableCreator","FlashList","FlashListRef","ReactElement","ReactNode","useCallback","useRef","useState","NativeScrollEvent","NativeSyntheticEvent","Platform","StyleProp","ViewStyle","StyleSheet","ChevronDownIcon","ChevronRightIcon","fontOf","Button","MIN_ROW_HEIGHT","DISABLED_OPACITY","PIN_THRESHOLD","JUMP_THRESHOLD","ListProps","data","T","renderItem","item","index","keyExtractor","startAtBottom","separators","empty","header","footer","onEndReached","accessibilityLabel","style","contentPadding","Separator","styles","separator","List","t","renderRow","listRef","awayFromBottom","setAwayFromBottom","sheetScroll","insideSheet","onScroll","nativeEvent","contentOffset","contentSize","layoutMeasurement","distance","height","y","frame","undefined","OS","padding","startRenderingFromBottom","autoscrollToBottomThreshold","current","scrollToEnd","animated","jump","ListRowProps","title","description","leading","trailing","selected","disabled","onPress","disclosure","ListRow","chevron","content","text","titleSelected","row","pressed","create","theme","flex","minHeight","position","bottom","spacing","alignSelf","borderRadius","full","borderColor","colors","border","uni__dependencies","hairlineWidth","marginLeft","backgroundColor","flexDirection","alignItems","gap","paddingHorizontal","paddingVertical","panel","opacity","minWidth","color","hi","fontFamily","sans","fontSize","base","lineHeight","fontWeight","medium","green","semibold","faint","sm"],"sources":["../../src/components/List.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport { useInsideSheet } from '@agimon-ai/po-native-components/shell';\nimport { useBottomSheetScrollableCreator } from '@gorhom/bottom-sheet';\nimport { FlashList, type FlashListRef } from '@shopify/flash-list';\nimport { type ReactElement, type ReactNode, useCallback, useRef, useState } from 'react';\nimport {\n type NativeScrollEvent,\n type NativeSyntheticEvent,\n Platform,\n Pressable,\n type StyleProp,\n Text,\n View,\n type ViewStyle,\n} from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { ChevronDownIcon, ChevronRightIcon } from '../icons/icons';\nimport { fontOf } from '../lib/fonts';\nimport { Button } from './Button';\n/*\n * A virtualised list on FlashList: sessions, devices, a transcript. Rows\n * recycle, separators are hairlines, and a chat list can start at the bottom\n * and stay pinned there as rows arrive. The public props are this package's\n * own, so FlashList's types never reach a caller.\n */\n\nconst MIN_ROW_HEIGHT = 44;\nconst DISABLED_OPACITY = 0.4;\n/** How close to the bottom a reader must be for a new row to keep the list pinned, as a fraction of the visible height. */\nconst PIN_THRESHOLD = 0.1;\n/** How far above the bottom, in visible heights, a chat reader must scroll before the jump-to-latest button shows. */\nconst JUMP_THRESHOLD = 1;\n\nexport interface ListProps<T> {\n data: readonly T[];\n renderItem: (item: T, index: number) => ReactElement | null;\n /** A stable key per row; FlashList recycles views by it. */\n keyExtractor: (item: T, index: number) => string;\n /**\n * A chat list: render from the bottom and keep the newest row in view as\n * rows arrive, while the reader is near the bottom.\n */\n startAtBottom?: boolean;\n /** Hairline separators between rows. On by default. */\n separators?: boolean;\n /** Shown when `data` is empty. */\n empty?: ReactNode;\n header?: ReactNode;\n footer?: ReactNode;\n onEndReached?: () => void;\n accessibilityLabel?: string;\n /** The list's frame; give it a height or a flex parent, since a virtualised list needs bounds. */\n style?: StyleProp<ViewStyle>;\n /** Padding around the rows. */\n contentPadding?: number;\n}\n\nfunction Separator() {\n return <View style={styles.separator} />;\n}\n\nexport function List<T>({\n data,\n renderItem,\n keyExtractor,\n startAtBottom = false,\n separators = true,\n empty,\n header,\n footer,\n onEndReached,\n accessibilityLabel,\n style,\n contentPadding,\n}: ListProps<T>) {\n const t = useT();\n const renderRow = useCallback(({ item, index }: { item: T; index: number }) => renderItem(item, index), [renderItem]);\n const listRef = useRef<FlashListRef<T>>(null);\n const [awayFromBottom, setAwayFromBottom] = useState(false);\n // Inside a sheet the rows scroll through Gorhom, so a drag on them scrolls instead of moving the sheet.\n const sheetScroll = useBottomSheetScrollableCreator();\n const insideSheet = useInsideSheet();\n const onScroll = useCallback(({ nativeEvent }: NativeSyntheticEvent<NativeScrollEvent>) => {\n const { contentOffset, contentSize, layoutMeasurement } = nativeEvent;\n const distance = contentSize.height - layoutMeasurement.height - contentOffset.y;\n setAwayFromBottom(distance > layoutMeasurement.height * JUMP_THRESHOLD);\n }, []);\n return (\n <View style={[styles.frame, style]} accessibilityLabel={accessibilityLabel}>\n <FlashList\n ref={listRef}\n renderScrollComponent={insideSheet ? sheetScroll : undefined}\n onScroll={startAtBottom ? onScroll : undefined}\n scrollEventThrottle={startAtBottom ? 100 : undefined}\n data={data}\n renderItem={renderRow}\n keyExtractor={keyExtractor}\n ItemSeparatorComponent={separators ? Separator : null}\n ListEmptyComponent={empty === undefined ? null : <>{empty}</>}\n ListHeaderComponent={header === undefined ? null : <>{header}</>}\n ListFooterComponent={footer === undefined ? null : <>{footer}</>}\n onEndReached={onEndReached}\n // Dragging the rows pulls the keyboard down with the finger, as in Messages.\n keyboardDismissMode={Platform.OS === 'ios' ? 'interactive' : 'on-drag'}\n // A chat's rows are mostly pressable (long-press bubbles, tool groups), so any tap there hides the keyboard\n // first, as in Messages; other lists let a tap on a row land.\n keyboardShouldPersistTaps={startAtBottom ? 'never' : 'handled'}\n // Lets UIKit inset the rows under a translucent or large-title header instead of drawing beneath it.\n contentInsetAdjustmentBehavior=\"automatic\"\n contentContainerStyle={contentPadding === undefined ? undefined : { padding: contentPadding }}\n maintainVisibleContentPosition={\n startAtBottom ? { startRenderingFromBottom: true, autoscrollToBottomThreshold: PIN_THRESHOLD } : undefined\n }\n />\n {startAtBottom && awayFromBottom ? (\n <Button\n variant=\"subtle\"\n size=\"icon-md\"\n accessibilityLabel={t('nativeComponents.list.jumpToLatest', 'Jump to latest')}\n onPress={() => listRef.current?.scrollToEnd({ animated: true })}\n style={styles.jump}\n >\n <ChevronDownIcon size={18} />\n </Button>\n ) : null}\n </View>\n );\n}\n\nexport interface ListRowProps {\n title: ReactNode;\n /** A second, quieter line under the title. */\n description?: ReactNode;\n /** Before the text: a Dot, an icon. */\n leading?: ReactNode;\n /** After the text: a Badge, a ghost button, a count. */\n trailing?: ReactNode;\n /** Selected rows sit on a green tint. */\n selected?: boolean;\n disabled?: boolean;\n onPress?: () => void;\n /** The iOS disclosure chevron. Defaults to on for a pressable row on iOS, where rows that navigate wear one. */\n disclosure?: boolean;\n accessibilityLabel?: string;\n style?: StyleProp<ViewStyle>;\n}\n\n/** One list row: 44pt tall, optional leading and trailing slots, pressable when it navigates. */\nexport function ListRow({\n title,\n description,\n leading,\n trailing,\n selected = false,\n disabled = false,\n onPress,\n disclosure,\n accessibilityLabel,\n style,\n}: ListRowProps) {\n const chevron = disclosure ?? (onPress !== undefined && Platform.OS === 'ios');\n const content = (\n <>\n {leading}\n <View style={styles.text}>\n {typeof title === 'string' ? (\n <Text numberOfLines={1} style={[styles.title, selected && styles.titleSelected]}>\n {title}\n </Text>\n ) : (\n title\n )}\n {typeof description === 'string' ? (\n <Text numberOfLines={2} style={styles.description}>\n {description}\n </Text>\n ) : (\n description\n )}\n </View>\n {trailing}\n {chevron ? <ChevronRightIcon size={14} color=\"faint\" /> : null}\n </>\n );\n if (onPress === undefined) {\n return (\n <View\n accessibilityLabel={accessibilityLabel}\n accessibilityState={{ selected, disabled }}\n style={[styles.row, selected && styles.selected, disabled && styles.disabled, style]}\n >\n {content}\n </View>\n );\n }\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n accessibilityState={{ selected, disabled }}\n disabled={disabled}\n onPress={onPress}\n style={({ pressed }) => [\n styles.row,\n selected && styles.selected,\n pressed && styles.pressed,\n disabled && styles.disabled,\n style,\n ]}\n >\n {content}\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n frame: { flex: 1, minHeight: 0 },\n jump: {\n position: 'absolute',\n bottom: theme.spacing(3),\n alignSelf: 'center',\n borderRadius: theme.borderRadius.full,\n borderColor: theme.colors.border,\n },\n separator: {\n height: StyleSheet.hairlineWidth,\n marginLeft: theme.spacing(4),\n backgroundColor: theme.colors['border-soft'],\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(3),\n minHeight: MIN_ROW_HEIGHT,\n paddingHorizontal: theme.spacing(4),\n paddingVertical: theme.spacing(2),\n },\n selected: { backgroundColor: theme.colors['tint-green'] },\n pressed: { backgroundColor: theme.colors.panel },\n disabled: { opacity: DISABLED_OPACITY },\n text: { flex: 1, minWidth: 0, gap: theme.spacing(0.5) },\n title: {\n color: theme.colors.hi,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n fontWeight: theme.fontWeight.medium,\n },\n titleSelected: { color: theme.colors.green, fontWeight: theme.fontWeight.semibold },\n description: {\n color: theme.colors.faint,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n}));\n"],"mappings":";;;;;;;;;;;;;;;;AA2BA,MAAMoB,iBAAiB;AACvB,MAAMC,mBAAmB;;AAEzB,MAAMC,gBAAgB;;AAEtB,MAAMC,iBAAiB;AA0BvB,SAASiB,YAAY;CACnB,OAAO,oBAAC,MAAD,EAAM,OAAOC,OAAOC,UAAU;AACvC;AAEA,SAAgBC,KAAQ,EACtBlB,MACAE,YACAG,cACAC,gBAAgB,OAChBC,aAAa,MACbC,OACAC,QACAC,QACAC,cACAC,oBACAC,OACAC,kBACe;CACf,MAAMK,IAAI5C,KAAK;CACf,MAAM6C,YAAYtC,aAAa,EAAEqB,MAAMC,YAAwCF,WAAWC,MAAMC,KAAK,GAAG,CAACF,UAAU,CAAC;CACpH,MAAMmB,UAAUtC,OAAwB,IAAI;CAC5C,MAAM,CAACuC,gBAAgBC,qBAAqBvC,SAAS,KAAK;CAE1D,MAAMwC,cAAc/C,gCAAgC;CACpD,MAAMgD,cAAcjD,eAAe;CACnC,MAAMkD,WAAW5C,aA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CAAA;CAC9C;CACAf,KAAK;EACHmB,eAAe;EACfC,YAAY;EACZC,KAAKlB,MAAMK,QAAQ,CAAC;EACpBH,WAAWpE;EACXqF,mBAAmBnB,MAAMK,QAAQ,CAAC;EAClCe,iBAAiBpB,MAAMK,QAAQ,CAAC;EAACO,mBAAA,CAAA,CAAA;CACnC;CACAxB,UAAU;EAAE2B,iBAAiBf,MAAMU,OAAO;EAAaE,mBAAA,CAAA,CAAA;CAAC;CACxDd,SAAS;EAAEiB,iBAAiBf,MAAMU,OAAOW;EAAKT,mBAAA,CAAA,CAAA;CAAC;CAC/CvB,UAAU,EAAEiC,SAASvF,iBAAiB;CACtC4D,MAAM;EAAEM,MAAM;EAAGsB,UAAU;EAAGL,KAAKlB,MAAMK,QAAQ,EAAG;EAACO,mBAAA,CAAA,CAAA;CAAC;CACtD5B,OAAO;EACLwC,OAAOxB,MAAMU,OAAOe;EACpBC,YAAY9F,OAAOoE,MAAM0B,WAAWC,IAAI;EACxCC,UAAU5B,MAAM4B,SAASC;EACzBC,YAAY9B,MAAM8B,WAAWD;EAC7BE,YAAY/B,MAAM+B,WAAWC;EAAMpB,mBAAA,CAAA,CAAA;CACrC;CACAhB,eAAe;EAAE4B,OAAOxB,MAAMU,OAAOuB;EAAOF,YAAY/B,MAAM+B,WAAWG;EAAQtB,mBAAA,CAAA,CAAA;CAAC;CAClF3B,aAAa;EACXuC,OAAOxB,MAAMU,OAAOyB;EACpBT,YAAY9F,OAAOoE,MAAM0B,WAAWC,IAAI;EACxCC,UAAU5B,MAAM4B,SAASQ;EACzBN,YAAY9B,MAAM8B,WAAWM;EAAExB,mBAAA,CAAA,CAAA;CACjC;AACF,EAAE"}
@@ -0,0 +1,30 @@
1
+ import { StyleProp, TextStyle } from "react-native";
2
+ //#region src/components/LiveDuration.d.ts
3
+ /** What a custom clock shows at `now`, and how long until it changes; no `nextMs` freezes it. */
4
+ export interface LiveDurationReading {
5
+ text: string;
6
+ nextMs?: number;
7
+ }
8
+ export type LiveDurationProps = {
9
+ style?: StyleProp<TextStyle>;
10
+ } & ({
11
+ /** The copy before the elapsed time, such as "running". */
12
+ label: string;
13
+ /** Epoch milliseconds the clock counts from. */
14
+ since: number;
15
+ clock?: undefined;
16
+ } | {
17
+ /** A custom format; keep it stable (useCallback), since a new function restarts the clock. */
18
+ clock: (now: number) => LiveDurationReading;
19
+ label?: undefined;
20
+ since?: undefined;
21
+ });
22
+ /**
23
+ * "running · 12m" that ages by itself, or any `clock` format. Each change writes a shared value the UI thread
24
+ * draws, so a list of running work re-renders nothing to keep its clocks current. It sleeps while the app is in
25
+ * the background and catches up on return. Read-only and not focusable: it sits inside a row whose own label
26
+ * speaks for it.
27
+ */
28
+ export declare function LiveDuration({ label, since, clock, style }: LiveDurationProps): import("react").JSX.Element;
29
+ //#endregion
30
+ //# sourceMappingURL=LiveDuration.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveDuration.d.mts","names":[],"sources":["../../src/components/LiveDuration.tsx"],"mappings":";;;iBASiB;EACf;EACA;;YAGU;EACV,QAAQ,UAAU;;;EAId;;EAEA;EACA;;;EAIA,QAAQ,gBAAgB;EACxB;EACA;;;;;;;;wBAUU,eAAe,OAAO,OAAO,OAAO,SAAS,oCAAiB,IAAA"}