@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.
- package/LICENSE +21 -149
- package/README.md +9 -51
- package/dist/components/AgentAvatar.d.mts +19 -0
- package/dist/components/AgentAvatar.d.mts.map +1 -0
- package/dist/components/AgentAvatar.mjs +88 -0
- package/dist/components/AgentAvatar.mjs.map +1 -0
- package/dist/components/AnnotationSurface.d.mts +69 -0
- package/dist/components/AnnotationSurface.d.mts.map +1 -0
- package/dist/components/AnnotationSurface.mjs +431 -0
- package/dist/components/AnnotationSurface.mjs.map +1 -0
- package/dist/components/Badge.d.mts +1 -1
- package/dist/components/Badge.mjs +1 -1
- package/dist/components/Button.mjs +3 -3
- package/dist/components/Button.mjs.map +1 -1
- package/dist/components/CodeBlock.d.mts +3 -1
- package/dist/components/CodeBlock.d.mts.map +1 -1
- package/dist/components/CodeBlock.mjs +42 -47
- package/dist/components/CodeBlock.mjs.map +1 -1
- package/dist/components/ComputerRow.d.mts +15 -0
- package/dist/components/ComputerRow.d.mts.map +1 -0
- package/dist/components/ComputerRow.mjs +107 -0
- package/dist/components/ComputerRow.mjs.map +1 -0
- package/dist/components/CopyButton.d.mts +13 -0
- package/dist/components/CopyButton.d.mts.map +1 -0
- package/dist/components/CopyButton.mjs +49 -0
- package/dist/components/CopyButton.mjs.map +1 -0
- package/dist/components/CountBadge.d.mts +15 -0
- package/dist/components/CountBadge.d.mts.map +1 -0
- package/dist/components/CountBadge.mjs +49 -0
- package/dist/components/CountBadge.mjs.map +1 -0
- package/dist/components/CtaCard.d.mts +19 -0
- package/dist/components/CtaCard.d.mts.map +1 -0
- package/dist/components/CtaCard.mjs +92 -0
- package/dist/components/CtaCard.mjs.map +1 -0
- package/dist/components/Dialog.d.mts +2 -2
- package/dist/components/Dialog.d.mts.map +1 -1
- package/dist/components/Dialog.mjs +16 -10
- package/dist/components/Dialog.mjs.map +1 -1
- package/dist/components/Dot.d.mts +1 -1
- package/dist/components/Dot.mjs +2 -2
- package/dist/components/DropdownMenu.d.mts +3 -1
- package/dist/components/DropdownMenu.d.mts.map +1 -1
- package/dist/components/DropdownMenu.mjs +21 -14
- package/dist/components/DropdownMenu.mjs.map +1 -1
- package/dist/components/EmptyState.d.mts +31 -3
- package/dist/components/EmptyState.d.mts.map +1 -1
- package/dist/components/EmptyState.mjs +303 -29
- package/dist/components/EmptyState.mjs.map +1 -1
- package/dist/components/FileList.d.mts +48 -0
- package/dist/components/FileList.d.mts.map +1 -0
- package/dist/components/FileList.mjs +737 -0
- package/dist/components/FileList.mjs.map +1 -0
- package/dist/components/FilePreview.d.mts +33 -0
- package/dist/components/FilePreview.d.mts.map +1 -0
- package/dist/components/FilePreview.mjs +102 -0
- package/dist/components/FilePreview.mjs.map +1 -0
- package/dist/components/FileViewer.d.mts +57 -0
- package/dist/components/FileViewer.d.mts.map +1 -0
- package/dist/components/FileViewer.mjs +345 -0
- package/dist/components/FileViewer.mjs.map +1 -0
- package/dist/components/HashlineLines.d.mts +13 -0
- package/dist/components/HashlineLines.d.mts.map +1 -0
- package/dist/components/HashlineLines.mjs +153 -0
- package/dist/components/HashlineLines.mjs.map +1 -0
- package/dist/components/HostFilter.d.mts +17 -0
- package/dist/components/HostFilter.d.mts.map +1 -0
- package/dist/components/HostFilter.mjs +68 -0
- package/dist/components/HostFilter.mjs.map +1 -0
- package/dist/components/HostTag.d.mts +7 -0
- package/dist/components/HostTag.d.mts.map +1 -0
- package/dist/components/HostTag.mjs +48 -0
- package/dist/components/HostTag.mjs.map +1 -0
- package/dist/components/InfoStrip.d.mts +9 -0
- package/dist/components/InfoStrip.d.mts.map +1 -0
- package/dist/components/InfoStrip.mjs +53 -0
- package/dist/components/InfoStrip.mjs.map +1 -0
- package/dist/components/Input.d.mts +3 -1
- package/dist/components/Input.d.mts.map +1 -1
- package/dist/components/Input.mjs +4 -3
- package/dist/components/Input.mjs.map +1 -1
- package/dist/components/Label.mjs +1 -1
- package/dist/components/LinkText.d.mts +13 -0
- package/dist/components/LinkText.d.mts.map +1 -0
- package/dist/components/LinkText.mjs +32 -0
- package/dist/components/LinkText.mjs.map +1 -0
- package/dist/components/List.d.mts.map +1 -1
- package/dist/components/List.mjs +50 -11
- package/dist/components/List.mjs.map +1 -1
- package/dist/components/LiveDuration.d.mts +30 -0
- package/dist/components/LiveDuration.d.mts.map +1 -0
- package/dist/components/LiveDuration.mjs +67 -0
- package/dist/components/LiveDuration.mjs.map +1 -0
- package/dist/components/LoadingState.d.mts +17 -0
- package/dist/components/LoadingState.d.mts.map +1 -0
- package/dist/components/LoadingState.mjs +90 -0
- package/dist/components/LoadingState.mjs.map +1 -0
- package/dist/components/Markdown.d.mts +24 -2
- package/dist/components/Markdown.d.mts.map +1 -1
- package/dist/components/Markdown.mjs +356 -27
- package/dist/components/Markdown.mjs.map +1 -1
- package/dist/components/MessageItem.d.mts +10 -15
- package/dist/components/MessageItem.d.mts.map +1 -1
- package/dist/components/MessageItem.mjs +94 -68
- package/dist/components/MessageItem.mjs.map +1 -1
- package/dist/components/NativeShellState.d.mts +30 -0
- package/dist/components/NativeShellState.d.mts.map +1 -0
- package/dist/components/NativeShellState.mjs +61 -0
- package/dist/components/NativeShellState.mjs.map +1 -0
- package/dist/components/RailItem.d.mts +13 -0
- package/dist/components/RailItem.d.mts.map +1 -0
- package/dist/components/RailItem.mjs +61 -0
- package/dist/components/RailItem.mjs.map +1 -0
- package/dist/components/ReferenceChip.d.mts +18 -0
- package/dist/components/ReferenceChip.d.mts.map +1 -0
- package/dist/components/ReferenceChip.mjs +38 -0
- package/dist/components/ReferenceChip.mjs.map +1 -0
- package/dist/components/SectionLabel.mjs +1 -1
- package/dist/components/SeekBar.d.mts +17 -0
- package/dist/components/SeekBar.d.mts.map +1 -0
- package/dist/components/SeekBar.mjs +97 -0
- package/dist/components/SeekBar.mjs.map +1 -0
- package/dist/components/Select.d.mts +39 -0
- package/dist/components/Select.d.mts.map +1 -0
- package/dist/components/Select.mjs +288 -0
- package/dist/components/Select.mjs.map +1 -0
- package/dist/components/Sheet.d.mts +17 -2
- package/dist/components/Sheet.d.mts.map +1 -1
- package/dist/components/Sheet.mjs +34 -11
- package/dist/components/Sheet.mjs.map +1 -1
- package/dist/components/SheetFrame.mjs +149 -28
- package/dist/components/SheetFrame.mjs.map +1 -1
- package/dist/components/SheetList.d.mts +14 -0
- package/dist/components/SheetList.d.mts.map +1 -0
- package/dist/components/SheetList.mjs +34 -0
- package/dist/components/SheetList.mjs.map +1 -0
- package/dist/components/ShowMore.d.mts +10 -0
- package/dist/components/ShowMore.d.mts.map +1 -0
- package/dist/components/ShowMore.mjs +44 -0
- package/dist/components/ShowMore.mjs.map +1 -0
- package/dist/components/Spinner.d.mts +1 -1
- package/dist/components/StatusBadge.d.mts +1 -1
- package/dist/components/Switch.d.mts +14 -0
- package/dist/components/Switch.d.mts.map +1 -0
- package/dist/components/Switch.mjs +37 -0
- package/dist/components/Switch.mjs.map +1 -0
- package/dist/components/SyntaxLine.d.mts +19 -0
- package/dist/components/SyntaxLine.d.mts.map +1 -0
- package/dist/components/SyntaxLine.mjs +134 -0
- package/dist/components/SyntaxLine.mjs.map +1 -0
- package/dist/components/Tabs.d.mts.map +1 -1
- package/dist/components/Tabs.mjs +8 -7
- package/dist/components/Tabs.mjs.map +1 -1
- package/dist/components/ToolPathLink.d.mts +10 -0
- package/dist/components/ToolPathLink.d.mts.map +1 -0
- package/dist/components/ToolPathLink.mjs +42 -0
- package/dist/components/ToolPathLink.mjs.map +1 -0
- package/dist/components/ToolResultImage.d.mts +21 -0
- package/dist/components/ToolResultImage.d.mts.map +1 -0
- package/dist/components/ToolResultImage.mjs +60 -0
- package/dist/components/ToolResultImage.mjs.map +1 -0
- package/dist/icons/IconColorContext.d.mts +2 -1
- package/dist/icons/IconColorContext.d.mts.map +1 -1
- package/dist/icons/IconColorContext.mjs.map +1 -1
- package/dist/icons/iconGlyphs.d.mts +132 -0
- package/dist/icons/iconGlyphs.d.mts.map +1 -1
- package/dist/icons/iconGlyphs.mjs +132 -0
- package/dist/icons/iconGlyphs.mjs.map +1 -1
- package/dist/icons/icons.d.mts +133 -1
- package/dist/icons/icons.d.mts.map +1 -1
- package/dist/icons/icons.mjs +35 -2
- package/dist/icons/icons.mjs.map +1 -1
- package/dist/index.d.mts +31 -7
- package/dist/index.mjs +36 -12
- package/dist/lib/fileKindLabel.mjs +17 -0
- package/dist/lib/fileKindLabel.mjs.map +1 -0
- package/dist/lib/fonts.d.mts +3 -1
- package/dist/lib/fonts.d.mts.map +1 -1
- package/dist/lib/fonts.mjs +4 -2
- package/dist/lib/fonts.mjs.map +1 -1
- package/dist/lib/insideSheet.d.mts +10 -0
- package/dist/lib/insideSheet.d.mts.map +1 -0
- package/dist/lib/markdown.mjs +310 -23
- package/dist/lib/markdown.mjs.map +1 -1
- package/dist/lib/reading.mjs +60 -0
- package/dist/lib/reading.mjs.map +1 -0
- package/dist/lib/useControllable.mjs +14 -6
- package/dist/lib/useControllable.mjs.map +1 -1
- package/dist/lib/useReadingPage.mjs +33 -0
- package/dist/lib/useReadingPage.mjs.map +1 -0
- package/dist/po-runtime-identity.json +1 -0
- package/dist/shell.d.mts +6 -0
- package/dist/shell.mjs +7 -0
- package/locales/vi.json +112 -0
- package/locales/zh-CN.json +112 -0
- package/package.json +43 -30
|
@@ -1,61 +1,56 @@
|
|
|
1
1
|
import { fontOf } from "../lib/fonts.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { codePrefix } from "../lib/reading.mjs";
|
|
3
|
+
import { useReadingPage } from "../lib/useReadingPage.mjs";
|
|
4
|
+
import { CopyButton } from "./CopyButton.mjs";
|
|
5
|
+
import { ShowMore } from "./ShowMore.mjs";
|
|
4
6
|
import { View } from "react-native-unistyles/components/native/View";
|
|
5
|
-
import { StyleSheet } from "react-native-unistyles";
|
|
6
7
|
import { Text } from "react-native-unistyles/components/native/Text";
|
|
7
|
-
import {
|
|
8
|
+
import { StyleSheet } from "react-native-unistyles";
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { useT } from "@agimon-ai/po-core/native";
|
|
9
11
|
import { ScrollView } from "react-native-unistyles/components/native/ScrollView";
|
|
10
|
-
import { setStringAsync } from "expo-clipboard";
|
|
11
12
|
|
|
12
13
|
//#region src/components/CodeBlock.tsx
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
copied: "copied",
|
|
18
|
-
failed: "copying failed"
|
|
19
|
-
};
|
|
20
|
-
function CodeBlock({ text, language }) {
|
|
21
|
-
const [state, setState] = useState("idle");
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (state === "idle") return void 0;
|
|
24
|
-
const timer = setTimeout(() => setState("idle"), FEEDBACK_MS);
|
|
25
|
-
return () => clearTimeout(timer);
|
|
26
|
-
}, [state]);
|
|
27
|
-
const label = LABELS[state];
|
|
14
|
+
function CodeBlock({ text, language, initialPage = 1 }) {
|
|
15
|
+
const t = useT();
|
|
16
|
+
const { page, reveal } = useReadingPage(text, initialPage);
|
|
17
|
+
const visible = codePrefix(text, Math.max(initialPage, page));
|
|
28
18
|
return /* @__PURE__ */ jsxs(View, {
|
|
29
|
-
style: styles.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
})]
|
|
19
|
+
style: styles.root,
|
|
20
|
+
children: [/* @__PURE__ */ jsxs(View, {
|
|
21
|
+
style: styles.block,
|
|
22
|
+
accessibilityLabel: language === void 0 ? void 0 : t("nativeComponents.codeBlock.label", "{language} code", { language }),
|
|
23
|
+
children: [/* @__PURE__ */ jsx(ScrollView, {
|
|
24
|
+
horizontal: true,
|
|
25
|
+
showsHorizontalScrollIndicator: false,
|
|
26
|
+
contentContainerStyle: styles.scroll,
|
|
27
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
28
|
+
selectable: true,
|
|
29
|
+
style: styles.code,
|
|
30
|
+
children: visible
|
|
31
|
+
})
|
|
32
|
+
}), /* @__PURE__ */ jsx(CopyButton, {
|
|
33
|
+
text,
|
|
34
|
+
style: styles.copy
|
|
35
|
+
})]
|
|
36
|
+
}), visible.length < text.length ? /* @__PURE__ */ jsx(ShowMore, {
|
|
37
|
+
label: t("nativeComponents.codeBlock.showMore", "Show more code"),
|
|
38
|
+
summary: t("nativeComponents.codeBlock.summary", "{shownChars} of {totalChars} characters · {shownLines} of {totalLines} lines", {
|
|
39
|
+
shownChars: visible.length,
|
|
40
|
+
totalChars: text.length,
|
|
41
|
+
shownLines: visible.split("\n").length,
|
|
42
|
+
totalLines: text.split("\n").length
|
|
43
|
+
}),
|
|
44
|
+
onPress: reveal
|
|
45
|
+
}) : null]
|
|
56
46
|
});
|
|
57
47
|
}
|
|
58
48
|
const styles = StyleSheet.create((theme) => ({
|
|
49
|
+
root: {
|
|
50
|
+
gap: theme.spacing(2),
|
|
51
|
+
minWidth: 0,
|
|
52
|
+
uni__dependencies: [0]
|
|
53
|
+
},
|
|
59
54
|
block: {
|
|
60
55
|
borderRadius: theme.borderRadius.DEFAULT,
|
|
61
56
|
borderWidth: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlock.mjs","names":["
|
|
1
|
+
{"version":3,"file":"CodeBlock.mjs","names":["useT","StyleSheet","fontOf","codePrefix","useReadingPage","CopyButton","ShowMore","CodeBlockProps","text","language","initialPage","CodeBlock","t","page","reveal","visible","Math","max","styles","root","block","undefined","scroll","code","copy","length","shownChars","totalChars","shownLines","split","totalLines","create","theme","gap","spacing","minWidth","uni__dependencies","borderRadius","DEFAULT","borderWidth","borderColor","colors","border","backgroundColor","deep","padding","paddingRight","color","fontFamily","mono","fontSize","sm","lineHeight","lineHeightRelaxed","position","top","right"],"sources":["../../src/components/CodeBlock.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport { ScrollView, Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { codePrefix } from '../lib/reading';\nimport { useReadingPage } from '../lib/useReadingPage';\nimport { CopyButton } from './CopyButton';\nimport { ShowMore } from './ShowMore';\n\n/*\n * A fenced code block: the source in selectable mono type that scrolls\n * sideways rather than wrapping, and a copy button that says when it worked.\n *\n * ponytail: no syntax colouring and no mermaid diagrams yet; a mermaid fence\n * shows its source, which is still the whole content.\n */\n\nexport interface CodeBlockProps {\n /** The block's source, without the fence lines. */\n text: string;\n /** The fence's language word, such as `ts`; the web reads it from a `language-*` class. */\n language?: string;\n /** Initial reveal pages, useful for a reader restored to a known position. */\n initialPage?: number;\n}\n\nexport function CodeBlock({ text, language, initialPage = 1 }: CodeBlockProps) {\n const t = useT();\n const { page, reveal } = useReadingPage(text, initialPage);\n const visible = codePrefix(text, Math.max(initialPage, page));\n return (\n <View style={styles.root}>\n <View\n style={styles.block}\n accessibilityLabel={\n language === undefined ? undefined : t('nativeComponents.codeBlock.label', '{language} code', { language })\n }\n >\n <ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={styles.scroll}>\n <Text selectable style={styles.code}>\n {visible}\n </Text>\n </ScrollView>\n\n <CopyButton text={text} style={styles.copy} />\n </View>\n {visible.length < text.length ? (\n <ShowMore\n label={t('nativeComponents.codeBlock.showMore', 'Show more code')}\n summary={t(\n 'nativeComponents.codeBlock.summary',\n '{shownChars} of {totalChars} characters · {shownLines} of {totalLines} lines',\n {\n shownChars: visible.length,\n totalChars: text.length,\n shownLines: visible.split('\\n').length,\n totalLines: text.split('\\n').length,\n },\n )}\n onPress={reveal}\n />\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n root: { gap: theme.spacing(2), minWidth: 0 },\n block: {\n borderRadius: theme.borderRadius.DEFAULT,\n borderWidth: 1,\n borderColor: theme.colors.border,\n backgroundColor: theme.colors.deep,\n },\n // The right padding keeps the first line clear of the copy button.\n scroll: { padding: theme.spacing(2.5), paddingRight: theme.spacing(9) },\n code: {\n color: theme.colors.text,\n fontFamily: fontOf(theme.fontFamily.mono),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeightRelaxed.sm,\n },\n copy: { position: 'absolute', top: theme.spacing(1.5), right: theme.spacing(1.5) },\n}));\n"],"mappings":";;;;;;;;;;;;;AA2BA,SAAgBW,UAAU,EAAEH,MAAMC,UAAUC,cAAc,KAAqB;CAC7E,MAAME,IAAIZ,KAAK;CACf,MAAM,EAAEa,MAAMC,WAAWV,eAAeI,MAAME,WAAW;CACzD,MAAMK,UAAUZ,WAAWK,MAAMQ,KAAKC,IAAIP,aAAaG,IAAI,CAAC;CAC5D,OACE,qBAAC,MAAD;EAAM,OAAOK,OAAOC;YAApB,CACE,qBAAC,MAAD;GACE,OAAOD,OAAOE;GACd,oBACEX,aAAaY,SAAYA,SAAYT,EAAE,oCAAoC,mBAAmB,EAAEH,SAAS,CAAC;aAH9G,CAME,oBAAC,YAAD;IAAY;IAAW,gCAAgC;IAAO,uBAAuBS,OAAOI;cAC1F,oBAAC,MAAD;KAAM;KAAW,OAAOJ,OAAOK;eAC5BR;IACG;GACI,IAEZ,oBAAC,YAAD;IAAkBP;IAAM,OAAOU,OAAOM;GAAK,EACvC;MACLT,QAAQU,SAASjB,KAAKiB,SACrB,oBAAC,UAAD;GACE,OAAOb,EAAE,uCAAuC,gBAAgB;GAChE,SAASA,EACP,sCACA,gFACA;IACEc,YAAYX,QAAQU;IACpBE,YAAYnB,KAAKiB;IACjBG,YAAYb,QAAQc,MAAM,IAAI,CAAC,CAACJ;IAChCK,YAAYtB,KAAKqB,MAAM,IAAI,CAAC,CAACJ;GAC/B,CACF;GACA,SAASX;EAAO,KAEhB,IACA;;AAEV;AAEA,MAAMI,SAASjB,WAAW8B,QAAQC,WAAW;CAC3Cb,MAAM;EAAEc,KAAKD,MAAME,QAAQ,CAAC;EAAGC,UAAU;EAACC,mBAAA,CAAA,CAAA;CAAC;CAC3ChB,OAAO;EACLiB,cAAcL,MAAMK,aAAaC;EACjCC,aAAa;EACbC,aAAaR,MAAMS,OAAOC;EAC1BC,iBAAiBX,MAAMS,OAAOG;EAAIR,mBAAA,CAAA,CAAA;CACpC;CAEAd,QAAQ;EAAEuB,SAASb,MAAME,QAAQ,GAAG;EAAGY,cAAcd,MAAME,QAAQ,CAAC;EAACE,mBAAA,CAAA,CAAA;CAAC;CACtEb,MAAM;EACJwB,OAAOf,MAAMS,OAAOjC;EACpBwC,YAAY9C,OAAO8B,MAAMgB,WAAWC,IAAI;EACxCC,UAAUlB,MAAMkB,SAASC;EACzBC,YAAYpB,MAAMqB,kBAAkBF;EAAEf,mBAAA,CAAA,CAAA;CACxC;CACAZ,MAAM;EAAE8B,UAAU;EAAYC,KAAKvB,MAAME,QAAQ,GAAG;EAAGsB,OAAOxB,MAAME,QAAQ,GAAG;EAACE,mBAAA,CAAA,CAAA;CAAC;AACnF,EAAE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/components/ComputerRow.d.ts
|
|
2
|
+
export type ComputerStatus = 'connected' | 'connecting' | 'disconnected' | 'update_required';
|
|
3
|
+
export interface ComputerRowProps {
|
|
4
|
+
name: string;
|
|
5
|
+
/** A folder on that computer, in mono with the home folder shown as `~`. */
|
|
6
|
+
path?: string;
|
|
7
|
+
status: ComputerStatus;
|
|
8
|
+
/** Whether the row can be picked. Defaults to off unless the computer is connected. */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
onPress: () => void;
|
|
11
|
+
}
|
|
12
|
+
/** One computer to pick in a sheet: its name, an optional folder, and whether it is reachable. */
|
|
13
|
+
export declare function ComputerRow({ name, path, status, disabled, onPress }: ComputerRowProps): import("react").JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
//# sourceMappingURL=ComputerRow.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComputerRow.d.mts","names":[],"sources":["../../src/components/ComputerRow.tsx"],"mappings":";YASY;iBAgBK;EACf;;EAEA;EACA,QAAQ;;EAER;EACA;;;wBAIc,cAAc,MAAM,MAAM,QAAQ,UAAU,WAAW,mCAAgB,IAAA"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { fontOf } from "../lib/fonts.mjs";
|
|
2
|
+
import { Dot } from "./Dot.mjs";
|
|
3
|
+
import { MonitorIcon } from "../icons/icons.mjs";
|
|
4
|
+
import { ListRow } from "./List.mjs";
|
|
5
|
+
import { View } from "react-native-unistyles/components/native/View";
|
|
6
|
+
import { Text } from "react-native-unistyles/components/native/Text";
|
|
7
|
+
import { StyleSheet } from "react-native-unistyles";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { useT } from "@agimon-ai/po-core/native";
|
|
10
|
+
|
|
11
|
+
//#region src/components/ComputerRow.tsx
|
|
12
|
+
function statusLabel(status, t) {
|
|
13
|
+
switch (status) {
|
|
14
|
+
case "connected": return t("nativeComponents.computerRow.status.connected", "Connected");
|
|
15
|
+
case "connecting": return t("nativeComponents.computerRow.status.connecting", "Connecting");
|
|
16
|
+
case "disconnected": return t("nativeComponents.computerRow.status.disconnected", "Offline");
|
|
17
|
+
case "update_required": return t("nativeComponents.computerRow.status.updateRequired", "Needs update");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const HOME_FOLDER = /^(\/Users|\/home)\/[^/]+(?=\/|$)/;
|
|
21
|
+
/** One computer to pick in a sheet: its name, an optional folder, and whether it is reachable. */
|
|
22
|
+
function ComputerRow({ name, path, status, disabled, onPress }) {
|
|
23
|
+
const connected = status === "connected";
|
|
24
|
+
const shortPath = path?.replace(HOME_FOLDER, "~");
|
|
25
|
+
const label = statusLabel(status, useT());
|
|
26
|
+
return /* @__PURE__ */ jsx(ListRow, {
|
|
27
|
+
title: name,
|
|
28
|
+
description: shortPath ? /* @__PURE__ */ jsx(Text, {
|
|
29
|
+
numberOfLines: 1,
|
|
30
|
+
ellipsizeMode: "middle",
|
|
31
|
+
style: styles.path,
|
|
32
|
+
children: shortPath
|
|
33
|
+
}) : void 0,
|
|
34
|
+
leading: /* @__PURE__ */ jsx(View, {
|
|
35
|
+
style: [styles.icon, connected && styles.iconConnected],
|
|
36
|
+
children: /* @__PURE__ */ jsx(MonitorIcon, {
|
|
37
|
+
size: 18,
|
|
38
|
+
color: connected ? "green" : "faint"
|
|
39
|
+
})
|
|
40
|
+
}),
|
|
41
|
+
trailing: /* @__PURE__ */ jsxs(View, {
|
|
42
|
+
style: styles.status,
|
|
43
|
+
children: [/* @__PURE__ */ jsx(Dot, {
|
|
44
|
+
tone: connected ? "green" : "muted",
|
|
45
|
+
pulse: status === "connecting"
|
|
46
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
47
|
+
style: [styles.statusLabel, connected && styles.statusConnected],
|
|
48
|
+
children: label
|
|
49
|
+
})]
|
|
50
|
+
}),
|
|
51
|
+
disabled: disabled ?? !connected,
|
|
52
|
+
onPress,
|
|
53
|
+
accessibilityLabel: `${name}${shortPath ? `, ${shortPath}` : ""}, ${label}`,
|
|
54
|
+
style: styles.card
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const styles = StyleSheet.create((theme) => ({
|
|
58
|
+
card: {
|
|
59
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
60
|
+
borderColor: theme.colors.border,
|
|
61
|
+
borderRadius: theme.borderRadius.lg,
|
|
62
|
+
marginBottom: theme.spacing(2),
|
|
63
|
+
minHeight: 64,
|
|
64
|
+
uni__dependencies: [0]
|
|
65
|
+
},
|
|
66
|
+
icon: {
|
|
67
|
+
width: 36,
|
|
68
|
+
height: 36,
|
|
69
|
+
borderRadius: theme.borderRadius.full,
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
justifyContent: "center",
|
|
72
|
+
backgroundColor: theme.colors.panel,
|
|
73
|
+
uni__dependencies: [0]
|
|
74
|
+
},
|
|
75
|
+
iconConnected: {
|
|
76
|
+
backgroundColor: theme.colors["tint-green"],
|
|
77
|
+
uni__dependencies: [0]
|
|
78
|
+
},
|
|
79
|
+
path: {
|
|
80
|
+
color: theme.colors.faint,
|
|
81
|
+
fontFamily: fontOf(theme.fontFamily.mono),
|
|
82
|
+
fontSize: theme.fontSize.sm,
|
|
83
|
+
lineHeight: theme.lineHeight.sm,
|
|
84
|
+
uni__dependencies: [0]
|
|
85
|
+
},
|
|
86
|
+
status: {
|
|
87
|
+
flexDirection: "row",
|
|
88
|
+
alignItems: "center",
|
|
89
|
+
gap: theme.spacing(1.5),
|
|
90
|
+
uni__dependencies: [0]
|
|
91
|
+
},
|
|
92
|
+
statusLabel: {
|
|
93
|
+
color: theme.colors.faint,
|
|
94
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
95
|
+
fontSize: theme.fontSize.sm,
|
|
96
|
+
lineHeight: theme.lineHeight.sm,
|
|
97
|
+
uni__dependencies: [0]
|
|
98
|
+
},
|
|
99
|
+
statusConnected: {
|
|
100
|
+
color: theme.colors.green,
|
|
101
|
+
uni__dependencies: [0]
|
|
102
|
+
}
|
|
103
|
+
}));
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
export { ComputerRow };
|
|
107
|
+
//# sourceMappingURL=ComputerRow.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComputerRow.mjs","names":["useT","StyleSheet","MonitorIcon","fontOf","Dot","ListRow","ComputerStatus","statusLabel","status","t","ReturnType","HOME_FOLDER","ComputerRowProps","name","path","disabled","onPress","ComputerRow","connected","shortPath","replace","label","styles","undefined","icon","iconConnected","statusConnected","card","create","theme","borderWidth","hairlineWidth","borderColor","colors","border","borderRadius","lg","marginBottom","spacing","minHeight","uni__dependencies","width","height","full","alignItems","justifyContent","backgroundColor","panel","color","faint","fontFamily","mono","fontSize","sm","lineHeight","flexDirection","gap","sans","green"],"sources":["../../src/components/ComputerRow.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport { Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { MonitorIcon } from '../icons/icons';\nimport { fontOf } from '../lib/fonts';\nimport { Dot } from './Dot';\nimport { ListRow } from './List';\n\nexport type ComputerStatus = 'connected' | 'connecting' | 'disconnected' | 'update_required';\n\nfunction statusLabel(status: ComputerStatus, t: ReturnType<typeof useT>): string {\n switch (status) {\n case 'connected':\n return t('nativeComponents.computerRow.status.connected', 'Connected');\n case 'connecting':\n return t('nativeComponents.computerRow.status.connecting', 'Connecting');\n case 'disconnected':\n return t('nativeComponents.computerRow.status.disconnected', 'Offline');\n case 'update_required':\n return t('nativeComponents.computerRow.status.updateRequired', 'Needs update');\n }\n}\nconst HOME_FOLDER = /^(\\/Users|\\/home)\\/[^/]+(?=\\/|$)/;\n\nexport interface ComputerRowProps {\n name: string;\n /** A folder on that computer, in mono with the home folder shown as `~`. */\n path?: string;\n status: ComputerStatus;\n /** Whether the row can be picked. Defaults to off unless the computer is connected. */\n disabled?: boolean;\n onPress: () => void;\n}\n\n/** One computer to pick in a sheet: its name, an optional folder, and whether it is reachable. */\nexport function ComputerRow({ name, path, status, disabled, onPress }: ComputerRowProps) {\n const connected = status === 'connected';\n const shortPath = path?.replace(HOME_FOLDER, '~');\n const t = useT();\n const label = statusLabel(status, t);\n return (\n <ListRow\n title={name}\n description={\n shortPath ? (\n <Text numberOfLines={1} ellipsizeMode=\"middle\" style={styles.path}>\n {shortPath}\n </Text>\n ) : undefined\n }\n leading={\n <View style={[styles.icon, connected && styles.iconConnected]}>\n <MonitorIcon size={18} color={connected ? 'green' : 'faint'} />\n </View>\n }\n trailing={\n <View style={styles.status}>\n <Dot tone={connected ? 'green' : 'muted'} pulse={status === 'connecting'} />\n <Text style={[styles.statusLabel, connected && styles.statusConnected]}>{label}</Text>\n </View>\n }\n disabled={disabled ?? !connected}\n onPress={onPress}\n accessibilityLabel={`${name}${shortPath ? `, ${shortPath}` : ''}, ${label}`}\n style={styles.card}\n />\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n card: {\n borderWidth: StyleSheet.hairlineWidth,\n borderColor: theme.colors.border,\n borderRadius: theme.borderRadius.lg,\n marginBottom: theme.spacing(2),\n minHeight: 64,\n },\n icon: {\n width: 36,\n height: 36,\n borderRadius: theme.borderRadius.full,\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: theme.colors.panel,\n },\n iconConnected: { backgroundColor: theme.colors['tint-green'] },\n path: {\n color: theme.colors.faint,\n fontFamily: fontOf(theme.fontFamily.mono),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n status: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(1.5) },\n statusLabel: {\n color: theme.colors.faint,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n statusConnected: { color: theme.colors.green },\n}));\n"],"mappings":";;;;;;;;;;;AAWA,SAASO,YAAYC,QAAwBC,GAAoC;CAC/E,QAAQD,QAAR;EACE,KAAK,aACH,OAAOC,EAAE,iDAAiD,WAAW;EACvE,KAAK,cACH,OAAOA,EAAE,kDAAkD,YAAY;EACzE,KAAK,gBACH,OAAOA,EAAE,oDAAoD,SAAS;EACxE,KAAK,mBACH,OAAOA,EAAE,sDAAsD,cAAc;CACjF;AACF;AACA,MAAME,cAAc;;AAapB,SAAgBM,YAAY,EAAEJ,MAAMC,MAAMN,QAAQO,UAAUC,WAA6B;CACvF,MAAME,YAAYV,WAAW;CAC7B,MAAMW,YAAYL,MAAMM,QAAQT,aAAa,GAAG;CAEhD,MAAMU,QAAQd,YAAYC,QADhBR,KACwBS,CAAC;CACnC,OACE,oBAAC,SAAD;EACE,OAAOI;EACP,aACEM,YACE,oBAAC,MAAD;GAAM,eAAe;GAAG,eAAc;GAAS,OAAOG,OAAOR;aAC1DK;EACG,KACJI;EAEN,SACE,oBAAC,MAAD;GAAM,OAAO,CAACD,OAAOE,MAAMN,aAAaI,OAAOG,aAAa;aAC1D,oBAAC,aAAD;IAAa,MAAM;IAAI,OAAOP,YAAY,UAAU;GAAQ;EACxD;EAER,UACE,qBAAC,MAAD;GAAM,OAAOI,OAAOd;aAApB,CACE,oBAAC,KAAD;IAAK,MAAMU,YAAY,UAAU;IAAS,OAAOV,WAAW;GAAa,IACzE,oBAAC,MAAD;IAAM,OAAO,CAACc,OAAOf,aAAaW,aAAaI,OAAOI,eAAe;cAAIL;GAAY,EACjF;;EAER,UAAUN,YAAY,CAACG;EACdF;EACT,oBAAoB,GAAGH,OAAOM,YAAY,KAAKA,cAAc,GAAE,IAAKE;EACpE,OAAOC,OAAOK;CAAK;AAGzB;AAEA,MAAML,SAASrB,WAAW2B,QAAQC,WAAW;CAC3CF,MAAM;EACJG,aAAa7B,WAAW8B;EACxBC,aAAaH,MAAMI,OAAOC;EAC1BC,cAAcN,MAAMM,aAAaC;EACjCC,cAAcR,MAAMS,QAAQ,CAAC;EAC7BC,WAAW;EAAEC,mBAAA,CAAA,CAAA;CACf;CACAhB,MAAM;EACJiB,OAAO;EACPC,QAAQ;EACRP,cAAcN,MAAMM,aAAaQ;EACjCC,YAAY;EACZC,gBAAgB;EAChBC,iBAAiBjB,MAAMI,OAAOc;EAAKP,mBAAA,CAAA,CAAA;CACrC;CACAf,eAAe;EAAEqB,iBAAiBjB,MAAMI,OAAO;EAAaO,mBAAA,CAAA,CAAA;CAAC;CAC7D1B,MAAM;EACJkC,OAAOnB,MAAMI,OAAOgB;EACpBC,YAAY/C,OAAO0B,MAAMqB,WAAWC,IAAI;EACxCC,UAAUvB,MAAMuB,SAASC;EACzBC,YAAYzB,MAAMyB,WAAWD;EAAEb,mBAAA,CAAA,CAAA;CACjC;CACAhC,QAAQ;EAAE+C,eAAe;EAAOX,YAAY;EAAUY,KAAK3B,MAAMS,QAAQ,GAAG;EAACE,mBAAA,CAAA,CAAA;CAAC;CAC9EjC,aAAa;EACXyC,OAAOnB,MAAMI,OAAOgB;EACpBC,YAAY/C,OAAO0B,MAAMqB,WAAWO,IAAI;EACxCL,UAAUvB,MAAMuB,SAASC;EACzBC,YAAYzB,MAAMyB,WAAWD;EAAEb,mBAAA,CAAA,CAAA;CACjC;CACAd,iBAAiB;EAAEsB,OAAOnB,MAAMI,OAAOyB;EAAKlB,mBAAA,CAAA,CAAA;CAAC;AAC/C,EAAE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
2
|
+
//#region src/components/CopyButton.d.ts
|
|
3
|
+
export interface CopyButtonProps {
|
|
4
|
+
/** The text the press puts on the clipboard. */
|
|
5
|
+
text: string;
|
|
6
|
+
/** What is copied, announced before the state, such as `path`. */
|
|
7
|
+
label?: string;
|
|
8
|
+
style?: StyleProp<ViewStyle>;
|
|
9
|
+
}
|
|
10
|
+
/** A quiet icon button that copies text and says, briefly, whether it worked. */
|
|
11
|
+
export declare function CopyButton({ text, label, style }: CopyButtonProps): import("react").JSX.Element;
|
|
12
|
+
//#endregion
|
|
13
|
+
//# sourceMappingURL=CopyButton.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyButton.d.mts","names":[],"sources":["../../src/components/CopyButton.tsx"],"mappings":";;iBAmBiB;;EAEf;;EAEA;EACA,QAAQ,UAAU;;;wBAIJ,aAAa,MAAM,OAAO,SAAS,kCAAe,IAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Button } from "./Button.mjs";
|
|
2
|
+
import { CheckIcon, CopyIcon } from "../icons/icons.mjs";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { useT } from "@agimon-ai/po-core/native";
|
|
6
|
+
import { setStringAsync } from "expo-clipboard";
|
|
7
|
+
|
|
8
|
+
//#region src/components/CopyButton.tsx
|
|
9
|
+
/** How long the control stays acknowledged before returning to its icon. */
|
|
10
|
+
const FEEDBACK_MS = 1500;
|
|
11
|
+
function stateLabel(state, t) {
|
|
12
|
+
if (state === "copied") return t("nativeComponents.copyButton.copied", "copied");
|
|
13
|
+
if (state === "failed") return t("nativeComponents.copyButton.failed", "copying failed");
|
|
14
|
+
return t("nativeComponents.copyButton.copy", "copy");
|
|
15
|
+
}
|
|
16
|
+
/** A quiet icon button that copies text and says, briefly, whether it worked. */
|
|
17
|
+
function CopyButton({ text, label, style }) {
|
|
18
|
+
const [state, setState] = useState("idle");
|
|
19
|
+
const t = useT();
|
|
20
|
+
const action = stateLabel(state, t);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (state === "idle") return void 0;
|
|
23
|
+
const timer = setTimeout(() => setState("idle"), FEEDBACK_MS);
|
|
24
|
+
return () => clearTimeout(timer);
|
|
25
|
+
}, [state]);
|
|
26
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
27
|
+
variant: "ghost",
|
|
28
|
+
size: "icon",
|
|
29
|
+
accessibilityLabel: label === void 0 ? action : t("nativeComponents.copyButton.withLabel", "{action} {label}", {
|
|
30
|
+
action,
|
|
31
|
+
label
|
|
32
|
+
}),
|
|
33
|
+
onPress: () => {
|
|
34
|
+
setStringAsync(text).then((saved) => setState(saved ? "copied" : "failed"), () => setState("failed"));
|
|
35
|
+
},
|
|
36
|
+
style,
|
|
37
|
+
children: state === "copied" ? /* @__PURE__ */ jsx(CheckIcon, {
|
|
38
|
+
size: 12,
|
|
39
|
+
color: "green"
|
|
40
|
+
}) : /* @__PURE__ */ jsx(CopyIcon, {
|
|
41
|
+
size: 12,
|
|
42
|
+
color: "faint"
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { CopyButton };
|
|
49
|
+
//# sourceMappingURL=CopyButton.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyButton.mjs","names":["useT","setStringAsync","useEffect","useState","StyleProp","ViewStyle","CheckIcon","CopyIcon","Button","FEEDBACK_MS","CopyState","stateLabel","state","t","ReturnType","CopyButtonProps","text","label","style","CopyButton","setState","action","undefined","timer","setTimeout","clearTimeout","then","saved"],"sources":["../../src/components/CopyButton.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport { setStringAsync } from 'expo-clipboard';\nimport { useEffect, useState } from 'react';\nimport type { StyleProp, ViewStyle } from 'react-native';\n\nimport { CheckIcon, CopyIcon } from '../icons/icons';\nimport { Button } from './Button';\n\n/** How long the control stays acknowledged before returning to its icon. */\nconst FEEDBACK_MS = 1500;\n\ntype CopyState = 'idle' | 'copied' | 'failed';\n\nfunction stateLabel(state: CopyState, t: ReturnType<typeof useT>): string {\n if (state === 'copied') return t('nativeComponents.copyButton.copied', 'copied');\n if (state === 'failed') return t('nativeComponents.copyButton.failed', 'copying failed');\n return t('nativeComponents.copyButton.copy', 'copy');\n}\n\nexport interface CopyButtonProps {\n /** The text the press puts on the clipboard. */\n text: string;\n /** What is copied, announced before the state, such as `path`. */\n label?: string;\n style?: StyleProp<ViewStyle>;\n}\n\n/** A quiet icon button that copies text and says, briefly, whether it worked. */\nexport function CopyButton({ text, label, style }: CopyButtonProps) {\n const [state, setState] = useState<CopyState>('idle');\n const t = useT();\n const action = stateLabel(state, t);\n\n useEffect(() => {\n if (state === 'idle') return undefined;\n const timer = setTimeout(() => setState('idle'), FEEDBACK_MS);\n return () => clearTimeout(timer);\n }, [state]);\n\n return (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n accessibilityLabel={\n label === undefined ? action : t('nativeComponents.copyButton.withLabel', '{action} {label}', { action, label })\n }\n onPress={() => {\n setStringAsync(text).then(\n (saved) => setState(saved ? 'copied' : 'failed'),\n () => setState('failed'),\n );\n }}\n style={style}\n >\n {state === 'copied' ? <CheckIcon size={12} color=\"green\" /> : <CopyIcon size={12} color=\"faint\" />}\n </Button>\n );\n}\n"],"mappings":";;;;;;;;;AASA,MAAMS,cAAc;AAIpB,SAASE,WAAWC,OAAkBC,GAAoC;CACxE,IAAID,UAAU,UAAU,OAAOC,EAAE,sCAAsC,QAAQ;CAC/E,IAAID,UAAU,UAAU,OAAOC,EAAE,sCAAsC,gBAAgB;CACvF,OAAOA,EAAE,oCAAoC,MAAM;AACrD;;AAWA,SAAgBM,WAAW,EAAEH,MAAMC,OAAOC,SAA0B;CAClE,MAAM,CAACN,OAAOQ,YAAYjB,SAAoB,MAAM;CACpD,MAAMU,IAAIb,KAAK;CACf,MAAMqB,SAASV,WAAWC,OAAOC,CAAC;CAElCX,gBAAgB;EACd,IAAIU,UAAU,QAAQ,OAAOU;EAC7B,MAAMC,QAAQC,iBAAiBJ,SAAS,MAAM,GAAGX,WAAW;EAC5D,aAAagB,aAAaF,KAAK;CACjC,GAAG,CAACX,KAAK,CAAC;CAEV,OACE,oBAAC,QAAD;EACE,SAAQ;EACR,MAAK;EACL,oBACEK,UAAUK,SAAYD,SAASR,EAAE,yCAAyC,oBAAoB;GAAEQ;GAAQJ;EAAM,CAAC;EAEjH,eAAe;GACbhB,eAAee,IAAI,CAAC,CAACU,MAClBC,UAAUP,SAASO,QAAQ,WAAW,QAAQ,SACzCP,SAAS,QAAQ,CACzB;EACF;EACOF;YAENN,UAAU,WAAW,oBAAC,WAAD;GAAW,MAAM;GAAI,OAAM;EAAO,KAAM,oBAAC,UAAD;GAAU,MAAM;GAAI,OAAM;EAAO;CACzF;AAEZ"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
2
|
+
//#region src/components/CountBadge.d.ts
|
|
3
|
+
export interface CountBadgeProps {
|
|
4
|
+
/** Things waiting for the person; zero or less renders nothing. */
|
|
5
|
+
count: number;
|
|
6
|
+
/** Placement, usually absolute on an icon's top-right; `borderColor` matches the surface behind it. */
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The rose count of things waiting for the person, worn on an icon or avatar corner.
|
|
11
|
+
* A gentle ask, so it is rose, never red. Hidden from screen readers: the owner names the count.
|
|
12
|
+
*/
|
|
13
|
+
export declare function CountBadge({ count, style }: CountBadgeProps): import("react").JSX.Element | null;
|
|
14
|
+
//#endregion
|
|
15
|
+
//# sourceMappingURL=CountBadge.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CountBadge.d.mts","names":[],"sources":["../../src/components/CountBadge.tsx"],"mappings":";;iBAKiB;;EAEf;;EAEA,QAAQ,UAAU;;;;;;wBAOJ,aAAa,OAAO,SAAS,kCAAe,IAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { fontOf } from "../lib/fonts.mjs";
|
|
2
|
+
import { View } from "react-native-unistyles/components/native/View";
|
|
3
|
+
import { Text } from "react-native-unistyles/components/native/Text";
|
|
4
|
+
import { StyleSheet } from "react-native-unistyles";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/CountBadge.tsx
|
|
8
|
+
/**
|
|
9
|
+
* The rose count of things waiting for the person, worn on an icon or avatar corner.
|
|
10
|
+
* A gentle ask, so it is rose, never red. Hidden from screen readers: the owner names the count.
|
|
11
|
+
*/
|
|
12
|
+
function CountBadge({ count, style }) {
|
|
13
|
+
if (count <= 0) return null;
|
|
14
|
+
return /* @__PURE__ */ jsx(View, {
|
|
15
|
+
accessible: false,
|
|
16
|
+
importantForAccessibility: "no-hide-descendants",
|
|
17
|
+
style: [styles.badge, style],
|
|
18
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
19
|
+
style: styles.text,
|
|
20
|
+
children: count > 9 ? "9+" : String(count)
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const styles = StyleSheet.create((theme) => ({
|
|
25
|
+
badge: {
|
|
26
|
+
minWidth: 16,
|
|
27
|
+
height: 16,
|
|
28
|
+
paddingHorizontal: 4,
|
|
29
|
+
borderRadius: 8,
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
justifyContent: "center",
|
|
32
|
+
backgroundColor: theme.colors.magenta,
|
|
33
|
+
borderWidth: 1.5,
|
|
34
|
+
borderColor: theme.colors.panel,
|
|
35
|
+
uni__dependencies: [0]
|
|
36
|
+
},
|
|
37
|
+
text: {
|
|
38
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
39
|
+
fontSize: theme.fontSize["2xs"],
|
|
40
|
+
lineHeight: 12,
|
|
41
|
+
fontWeight: theme.fontWeight.semibold,
|
|
42
|
+
color: theme.colors.bg,
|
|
43
|
+
uni__dependencies: [0]
|
|
44
|
+
}
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { CountBadge };
|
|
49
|
+
//# sourceMappingURL=CountBadge.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CountBadge.mjs","names":["StyleProp","ViewStyle","StyleSheet","fontOf","CountBadgeProps","count","style","CountBadge","styles","badge","text","String","create","theme","minWidth","height","paddingHorizontal","borderRadius","alignItems","justifyContent","backgroundColor","colors","magenta","borderWidth","borderColor","panel","uni__dependencies","fontFamily","sans","fontSize","lineHeight","fontWeight","semibold","color","bg"],"sources":["../../src/components/CountBadge.tsx"],"sourcesContent":["import { type StyleProp, Text, View, type ViewStyle } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\n\nexport interface CountBadgeProps {\n /** Things waiting for the person; zero or less renders nothing. */\n count: number;\n /** Placement, usually absolute on an icon's top-right; `borderColor` matches the surface behind it. */\n style?: StyleProp<ViewStyle>;\n}\n\n/**\n * The rose count of things waiting for the person, worn on an icon or avatar corner.\n * A gentle ask, so it is rose, never red. Hidden from screen readers: the owner names the count.\n */\nexport function CountBadge({ count, style }: CountBadgeProps) {\n if (count <= 0) return null;\n return (\n <View accessible={false} importantForAccessibility=\"no-hide-descendants\" style={[styles.badge, style]}>\n <Text style={styles.text}>{count > 9 ? '9+' : String(count)}</Text>\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n badge: {\n minWidth: 16,\n height: 16,\n paddingHorizontal: 4,\n borderRadius: 8,\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: theme.colors.magenta,\n borderWidth: 1.5,\n borderColor: theme.colors.panel,\n },\n text: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize['2xs'],\n lineHeight: 12,\n fontWeight: theme.fontWeight.semibold,\n color: theme.colors.bg,\n },\n}));\n"],"mappings":";;;;;;;;;;;AAgBA,SAAgBO,WAAW,EAAEF,OAAOC,SAA0B;CAC5D,IAAID,SAAS,GAAG,OAAO;CACvB,OACE,oBAAC,MAAD;EAAM,YAAY;EAAO,2BAA0B;EAAsB,OAAO,CAACG,OAAOC,OAAOH,KAAK;YAClG,oBAAC,MAAD;GAAM,OAAOE,OAAOE;aAAOL,QAAQ,IAAI,OAAOM,OAAON,KAAK;EAAQ;CAC9D;AAEV;AAEA,MAAMG,SAASN,WAAWU,QAAQC,WAAW;CAC3CJ,OAAO;EACLK,UAAU;EACVC,QAAQ;EACRC,mBAAmB;EACnBC,cAAc;EACdC,YAAY;EACZC,gBAAgB;EAChBC,iBAAiBP,MAAMQ,OAAOC;EAC9BC,aAAa;EACbC,aAAaX,MAAMQ,OAAOI;EAAKC,mBAAA,CAAA,CAAA;CACjC;CACAhB,MAAM;EACJiB,YAAYxB,OAAOU,MAAMc,WAAWC,IAAI;EACxCC,UAAUhB,MAAMgB,SAAS;EACzBC,YAAY;EACZC,YAAYlB,MAAMkB,WAAWC;EAC7BC,OAAOpB,MAAMQ,OAAOa;EAAER,mBAAA,CAAA,CAAA;CACxB;AACF,EAAE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ImageSourcePropType, StyleProp, ViewStyle } from "react-native";
|
|
2
|
+
//#region src/components/CtaCard.d.ts
|
|
3
|
+
export interface CtaCardProps {
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
/** The one action's label. */
|
|
7
|
+
action: string;
|
|
8
|
+
onAction: () => void;
|
|
9
|
+
/** Decorative art beside the heading, such as Po doing the card's job. */
|
|
10
|
+
artwork?: ImageSourcePropType;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
/** The outcome of the last action, announced politely. */
|
|
13
|
+
notice?: string;
|
|
14
|
+
style?: StyleProp<ViewStyle>;
|
|
15
|
+
}
|
|
16
|
+
/** A card asking the person to do one thing: heading, a line of why, one primary action, optional art. */
|
|
17
|
+
export declare function CtaCard({ title, description, action, onAction, artwork, loading, notice, style }: CtaCardProps): import("react").JSX.Element;
|
|
18
|
+
//#endregion
|
|
19
|
+
//# sourceMappingURL=CtaCard.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CtaCard.d.mts","names":[],"sources":["../../src/components/CtaCard.tsx"],"mappings":";;iBAOiB;EACf;EACA;;EAEA;EACA;;EAEA,UAAU;EACV;;EAEA;EACA,QAAQ,UAAU;;;wBAIJ,UACd,OACA,aACA,QACA,UACA,SACA,SACA,QACA,SACC,+BAAY,IAAA"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { fontOf } from "../lib/fonts.mjs";
|
|
2
|
+
import { Button } from "./Button.mjs";
|
|
3
|
+
import { Panel } from "./Panel.mjs";
|
|
4
|
+
import { View } from "react-native-unistyles/components/native/View";
|
|
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
|
+
import { Image } from "react-native-unistyles/components/native/Image";
|
|
9
|
+
|
|
10
|
+
//#region src/components/CtaCard.tsx
|
|
11
|
+
/** A card asking the person to do one thing: heading, a line of why, one primary action, optional art. */
|
|
12
|
+
function CtaCard({ title, description, action, onAction, artwork, loading = false, notice, style }) {
|
|
13
|
+
return /* @__PURE__ */ jsxs(Panel, {
|
|
14
|
+
style: [styles.card, style],
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsxs(View, {
|
|
17
|
+
style: styles.top,
|
|
18
|
+
children: [/* @__PURE__ */ jsxs(View, {
|
|
19
|
+
style: styles.copy,
|
|
20
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
21
|
+
accessibilityRole: "header",
|
|
22
|
+
style: styles.title,
|
|
23
|
+
children: title
|
|
24
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
25
|
+
style: styles.description,
|
|
26
|
+
children: description
|
|
27
|
+
})]
|
|
28
|
+
}), artwork ? /* @__PURE__ */ jsx(Image, {
|
|
29
|
+
source: artwork,
|
|
30
|
+
resizeMode: "contain",
|
|
31
|
+
accessible: false,
|
|
32
|
+
style: styles.artwork
|
|
33
|
+
}) : null]
|
|
34
|
+
}),
|
|
35
|
+
notice ? /* @__PURE__ */ jsx(Text, {
|
|
36
|
+
accessibilityLiveRegion: "polite",
|
|
37
|
+
style: styles.description,
|
|
38
|
+
children: notice
|
|
39
|
+
}) : null,
|
|
40
|
+
/* @__PURE__ */ jsx(Button, {
|
|
41
|
+
variant: "primary",
|
|
42
|
+
size: "lg",
|
|
43
|
+
loading,
|
|
44
|
+
onPress: onAction,
|
|
45
|
+
children: action
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const styles = StyleSheet.create((theme) => ({
|
|
51
|
+
card: {
|
|
52
|
+
padding: theme.spacing(5),
|
|
53
|
+
gap: theme.spacing(4),
|
|
54
|
+
uni__dependencies: [0]
|
|
55
|
+
},
|
|
56
|
+
top: {
|
|
57
|
+
flexDirection: "row",
|
|
58
|
+
alignItems: "center",
|
|
59
|
+
gap: theme.spacing(3),
|
|
60
|
+
uni__dependencies: [0]
|
|
61
|
+
},
|
|
62
|
+
copy: {
|
|
63
|
+
flex: 1,
|
|
64
|
+
minWidth: 0,
|
|
65
|
+
gap: theme.spacing(1),
|
|
66
|
+
uni__dependencies: [0]
|
|
67
|
+
},
|
|
68
|
+
title: {
|
|
69
|
+
color: theme.colors.hi,
|
|
70
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
71
|
+
fontSize: theme.fontSize.lg,
|
|
72
|
+
lineHeight: theme.lineHeight.lg,
|
|
73
|
+
fontWeight: theme.fontWeight.semibold,
|
|
74
|
+
uni__dependencies: [0]
|
|
75
|
+
},
|
|
76
|
+
description: {
|
|
77
|
+
color: theme.colors.dim,
|
|
78
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
79
|
+
fontSize: theme.fontSize.base,
|
|
80
|
+
lineHeight: theme.lineHeight.base,
|
|
81
|
+
uni__dependencies: [0]
|
|
82
|
+
},
|
|
83
|
+
artwork: {
|
|
84
|
+
width: theme.spacing(18),
|
|
85
|
+
height: theme.spacing(18),
|
|
86
|
+
uni__dependencies: [0]
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
89
|
+
|
|
90
|
+
//#endregion
|
|
91
|
+
export { CtaCard };
|
|
92
|
+
//# sourceMappingURL=CtaCard.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CtaCard.mjs","names":["ImageSourcePropType","StyleProp","ViewStyle","StyleSheet","fontOf","Button","Panel","CtaCardProps","title","description","action","onAction","artwork","loading","notice","style","CtaCard","styles","card","top","copy","create","theme","padding","spacing","gap","uni__dependencies","flexDirection","alignItems","flex","minWidth","color","colors","hi","fontFamily","sans","fontSize","lg","lineHeight","fontWeight","semibold","dim","base","width","height"],"sources":["../../src/components/CtaCard.tsx"],"sourcesContent":["import { Image, type ImageSourcePropType, type StyleProp, Text, View, type ViewStyle } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { Button } from './Button';\nimport { Panel } from './Panel';\n\nexport interface CtaCardProps {\n title: string;\n description: string;\n /** The one action's label. */\n action: string;\n onAction: () => void;\n /** Decorative art beside the heading, such as Po doing the card's job. */\n artwork?: ImageSourcePropType;\n loading?: boolean;\n /** The outcome of the last action, announced politely. */\n notice?: string;\n style?: StyleProp<ViewStyle>;\n}\n\n/** A card asking the person to do one thing: heading, a line of why, one primary action, optional art. */\nexport function CtaCard({\n title,\n description,\n action,\n onAction,\n artwork,\n loading = false,\n notice,\n style,\n}: CtaCardProps) {\n return (\n <Panel style={[styles.card, style]}>\n <View style={styles.top}>\n <View style={styles.copy}>\n <Text accessibilityRole=\"header\" style={styles.title}>\n {title}\n </Text>\n <Text style={styles.description}>{description}</Text>\n </View>\n {artwork ? <Image source={artwork} resizeMode=\"contain\" accessible={false} style={styles.artwork} /> : null}\n </View>\n {notice ? (\n <Text accessibilityLiveRegion=\"polite\" style={styles.description}>\n {notice}\n </Text>\n ) : null}\n <Button variant=\"primary\" size=\"lg\" loading={loading} onPress={onAction}>\n {action}\n </Button>\n </Panel>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n card: { padding: theme.spacing(5), gap: theme.spacing(4) },\n top: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(3) },\n copy: { flex: 1, minWidth: 0, gap: theme.spacing(1) },\n title: {\n color: theme.colors.hi,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.lg,\n lineHeight: theme.lineHeight.lg,\n fontWeight: theme.fontWeight.semibold,\n },\n description: {\n color: theme.colors.dim,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n },\n artwork: { width: theme.spacing(18), height: theme.spacing(18) },\n}));\n"],"mappings":";;;;;;;;;;;AAsBA,SAAgBgB,QAAQ,EACtBR,OACAC,aACAC,QACAC,UACAC,SACAC,UAAU,OACVC,QACAC,SACe;CACf,OACE,qBAAC,OAAD;EAAO,OAAO,CAACE,OAAOC,MAAMH,KAAK;YAAjC;GACE,qBAAC,MAAD;IAAM,OAAOE,OAAOE;cAApB,CACE,qBAAC,MAAD;KAAM,OAAOF,OAAOG;eAApB,CACE,oBAAC,MAAD;MAAM,mBAAkB;MAAS,OAAOH,OAAOT;gBAC5CA;KACG,IACN,oBAAC,MAAD;MAAM,OAAOS,OAAOR;gBAAcA;KAAkB,EAChD;QACLG,UAAU,oBAAC,OAAD;KAAO,QAAQA;KAAS,YAAW;KAAU,YAAY;KAAO,OAAOK,OAAOL;IAAQ,KAAM,IACnG;;GACLE,SACC,oBAAC,MAAD;IAAM,yBAAwB;IAAS,OAAOG,OAAOR;cAClDK;GACG,KACJ;GACJ,oBAAC,QAAD;IAAQ,SAAQ;IAAU,MAAK;IAAcD;IAAS,SAASF;cAC5DD;GACK;EACH;;AAEX;AAEA,MAAMO,SAASd,WAAWkB,QAAQC,WAAW;CAC3CJ,MAAM;EAAEK,SAASD,MAAME,QAAQ,CAAC;EAAGC,KAAKH,MAAME,QAAQ,CAAC;EAACE,mBAAA,CAAA,CAAA;CAAC;CACzDP,KAAK;EAAEQ,eAAe;EAAOC,YAAY;EAAUH,KAAKH,MAAME,QAAQ,CAAC;EAACE,mBAAA,CAAA,CAAA;CAAC;CACzEN,MAAM;EAAES,MAAM;EAAGC,UAAU;EAAGL,KAAKH,MAAME,QAAQ,CAAC;EAACE,mBAAA,CAAA,CAAA;CAAC;CACpDlB,OAAO;EACLuB,OAAOT,MAAMU,OAAOC;EACpBC,YAAY9B,OAAOkB,MAAMY,WAAWC,IAAI;EACxCC,UAAUd,MAAMc,SAASC;EACzBC,YAAYhB,MAAMgB,WAAWD;EAC7BE,YAAYjB,MAAMiB,WAAWC;EAAQd,mBAAA,CAAA,CAAA;CACvC;CACAjB,aAAa;EACXsB,OAAOT,MAAMU,OAAOS;EACpBP,YAAY9B,OAAOkB,MAAMY,WAAWC,IAAI;EACxCC,UAAUd,MAAMc,SAASM;EACzBJ,YAAYhB,MAAMgB,WAAWI;EAAIhB,mBAAA,CAAA,CAAA;CACnC;CACAd,SAAS;EAAE+B,OAAOrB,MAAME,QAAQ,EAAE;EAAGoB,QAAQtB,MAAME,QAAQ,EAAE;EAACE,mBAAA,CAAA,CAAA;CAAC;AACjE,EAAE"}
|
|
@@ -24,7 +24,7 @@ export interface DialogContentProps {
|
|
|
24
24
|
closeLabel?: string;
|
|
25
25
|
children?: ReactNode;
|
|
26
26
|
}
|
|
27
|
-
export declare function DialogContent({ width, style, closeLabel, children }: DialogContentProps): import("react").JSX.Element;
|
|
27
|
+
export declare function DialogContent({ width, style, closeLabel: closeLabelProp, children }: DialogContentProps): import("react").JSX.Element;
|
|
28
28
|
export interface DialogPartProps extends Omit<ViewProps, 'children' | 'style'> {
|
|
29
29
|
children?: ReactNode;
|
|
30
30
|
style?: StyleProp<ViewStyle>;
|
|
@@ -38,7 +38,7 @@ export interface DialogHeaderProps extends DialogPartProps {
|
|
|
38
38
|
/** What the close control announces. */
|
|
39
39
|
closeLabel?: string;
|
|
40
40
|
}
|
|
41
|
-
export declare function DialogHeader({ dismissible, closeLabel, style, children, ...props }: DialogHeaderProps): import("react").JSX.Element;
|
|
41
|
+
export declare function DialogHeader({ dismissible, closeLabel: closeLabelProp, style, children, ...props }: DialogHeaderProps): import("react").JSX.Element;
|
|
42
42
|
export declare function DialogTitle({ style, ...props }: TextProps): import("react").JSX.Element;
|
|
43
43
|
export declare function DialogDescription({ style, ...props }: TextProps): import("react").JSX.Element;
|
|
44
44
|
export declare function DialogBody({ style, children, ...props }: DialogPartProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.mts","names":[],"sources":["../../src/components/Dialog.tsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"Dialog.d.mts","names":[],"sources":["../../src/components/Dialog.tsx"],"mappings":";;;;YAqCY;iBASK;;EAEf;EACA;EACA,gBAAgB;EAChB,WAAW;;wBAGG,SAAS,MAAM,aAAqB,cAAc,YAAY,8BAAW,IAAA;;wBAOzE,gBAAgB,YAAY,SAAS,8BAAW,IAAA;;wBAchD,cAAc,YAAY,SAAS,8BAAW,IAAA;iBAa7C;;EAEf,QAAQ;;EAER,QAAQ,UAAU;;EAElB;EACA,WAAW;;wBAGG,gBAAgB,OAAc,OAAO,YAAY,gBAAgB,YAAY,qCAAkB,IAAA;iBA+C9F,wBAAwB,KAAK;EAC5C,WAAW;EACX,QAAQ,UAAU;;iBAGH,0BAA0B;;;;;EAKzC;;EAEA;;wBAGc,eACd,aACA,YAAY,gBACZ,OACA,aACG,SACF,oCAAiB,IAAA;wBAgBJ,cAAc,UAAU,SAAS,4BAAS,IAAA;wBAI1C,oBAAoB,UAAU,SAAS,4BAAS,IAAA;wBAIhD,aAAa,OAAO,aAAa,SAAS,kCAAe,IAAA;YAQ7D;iBAEK,0BAA0B;;EAEzC,UAAU;;wBAGI,eAAe,SAAmB,OAAO,aAAa,SAAS,oCAAiB,IAAA"}
|