@agimon-ai/po-native-components 0.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +71 -0
  3. package/dist/components/Badge.d.mts +17 -0
  4. package/dist/components/Badge.d.mts.map +1 -0
  5. package/dist/components/Badge.mjs +106 -0
  6. package/dist/components/Badge.mjs.map +1 -0
  7. package/dist/components/Button.d.mts +20 -0
  8. package/dist/components/Button.d.mts.map +1 -0
  9. package/dist/components/Button.mjs +278 -0
  10. package/dist/components/Button.mjs.map +1 -0
  11. package/dist/components/CodeBlock.d.mts +10 -0
  12. package/dist/components/CodeBlock.d.mts.map +1 -0
  13. package/dist/components/CodeBlock.mjs +88 -0
  14. package/dist/components/CodeBlock.mjs.map +1 -0
  15. package/dist/components/Dialog.d.mts +52 -0
  16. package/dist/components/Dialog.d.mts.map +1 -0
  17. package/dist/components/Dialog.mjs +257 -0
  18. package/dist/components/Dialog.mjs.map +1 -0
  19. package/dist/components/Dot.d.mts +17 -0
  20. package/dist/components/Dot.d.mts.map +1 -0
  21. package/dist/components/Dot.mjs +94 -0
  22. package/dist/components/Dot.mjs.map +1 -0
  23. package/dist/components/DropdownMenu.d.mts +63 -0
  24. package/dist/components/DropdownMenu.d.mts.map +1 -0
  25. package/dist/components/DropdownMenu.mjs +256 -0
  26. package/dist/components/DropdownMenu.mjs.map +1 -0
  27. package/dist/components/EmptyState.d.mts +14 -0
  28. package/dist/components/EmptyState.d.mts.map +1 -0
  29. package/dist/components/EmptyState.mjs +64 -0
  30. package/dist/components/EmptyState.mjs.map +1 -0
  31. package/dist/components/Input.d.mts +19 -0
  32. package/dist/components/Input.d.mts.map +1 -0
  33. package/dist/components/Input.mjs +123 -0
  34. package/dist/components/Input.mjs.map +1 -0
  35. package/dist/components/Label.d.mts +13 -0
  36. package/dist/components/Label.d.mts.map +1 -0
  37. package/dist/components/Label.mjs +36 -0
  38. package/dist/components/Label.mjs.map +1 -0
  39. package/dist/components/List.d.mts +48 -0
  40. package/dist/components/List.d.mts.map +1 -0
  41. package/dist/components/List.mjs +156 -0
  42. package/dist/components/List.mjs.map +1 -0
  43. package/dist/components/Markdown.d.mts +15 -0
  44. package/dist/components/Markdown.d.mts.map +1 -0
  45. package/dist/components/Markdown.mjs +219 -0
  46. package/dist/components/Markdown.mjs.map +1 -0
  47. package/dist/components/MessageItem.d.mts +87 -0
  48. package/dist/components/MessageItem.d.mts.map +1 -0
  49. package/dist/components/MessageItem.mjs +361 -0
  50. package/dist/components/MessageItem.mjs.map +1 -0
  51. package/dist/components/Panel.d.mts +15 -0
  52. package/dist/components/Panel.d.mts.map +1 -0
  53. package/dist/components/Panel.mjs +77 -0
  54. package/dist/components/Panel.mjs.map +1 -0
  55. package/dist/components/PoNativeProvider.d.mts +15 -0
  56. package/dist/components/PoNativeProvider.d.mts.map +1 -0
  57. package/dist/components/PoNativeProvider.mjs +22 -0
  58. package/dist/components/PoNativeProvider.mjs.map +1 -0
  59. package/dist/components/SectionLabel.d.mts +6 -0
  60. package/dist/components/SectionLabel.d.mts.map +1 -0
  61. package/dist/components/SectionLabel.mjs +40 -0
  62. package/dist/components/SectionLabel.mjs.map +1 -0
  63. package/dist/components/SegmentedControl.d.mts +26 -0
  64. package/dist/components/SegmentedControl.d.mts.map +1 -0
  65. package/dist/components/SegmentedControl.mjs +56 -0
  66. package/dist/components/SegmentedControl.mjs.map +1 -0
  67. package/dist/components/Sheet.d.mts +39 -0
  68. package/dist/components/Sheet.d.mts.map +1 -0
  69. package/dist/components/Sheet.mjs +166 -0
  70. package/dist/components/Sheet.mjs.map +1 -0
  71. package/dist/components/SheetFrame.mjs +84 -0
  72. package/dist/components/SheetFrame.mjs.map +1 -0
  73. package/dist/components/Spinner.d.mts +19 -0
  74. package/dist/components/Spinner.d.mts.map +1 -0
  75. package/dist/components/Spinner.mjs +34 -0
  76. package/dist/components/Spinner.mjs.map +1 -0
  77. package/dist/components/StatusBadge.d.mts +23 -0
  78. package/dist/components/StatusBadge.d.mts.map +1 -0
  79. package/dist/components/StatusBadge.mjs +116 -0
  80. package/dist/components/StatusBadge.mjs.map +1 -0
  81. package/dist/components/Tabs.d.mts +44 -0
  82. package/dist/components/Tabs.d.mts.map +1 -0
  83. package/dist/components/Tabs.mjs +197 -0
  84. package/dist/components/Tabs.mjs.map +1 -0
  85. package/dist/components/Textarea.d.mts +10 -0
  86. package/dist/components/Textarea.d.mts.map +1 -0
  87. package/dist/components/Textarea.mjs +29 -0
  88. package/dist/components/Textarea.mjs.map +1 -0
  89. package/dist/icons/IconColorContext.d.mts +10 -0
  90. package/dist/icons/IconColorContext.d.mts.map +1 -0
  91. package/dist/icons/IconColorContext.mjs +13 -0
  92. package/dist/icons/IconColorContext.mjs.map +1 -0
  93. package/dist/icons/iconGlyphs.d.mts +120 -0
  94. package/dist/icons/iconGlyphs.d.mts.map +1 -0
  95. package/dist/icons/iconGlyphs.mjs +121 -0
  96. package/dist/icons/iconGlyphs.mjs.map +1 -0
  97. package/dist/icons/icons.d.mts +122 -0
  98. package/dist/icons/icons.d.mts.map +1 -0
  99. package/dist/icons/icons.mjs +79 -0
  100. package/dist/icons/icons.mjs.map +1 -0
  101. package/dist/index.d.mts +27 -0
  102. package/dist/index.mjs +27 -0
  103. package/dist/lib/fonts.d.mts +13 -0
  104. package/dist/lib/fonts.d.mts.map +1 -0
  105. package/dist/lib/fonts.mjs +22 -0
  106. package/dist/lib/fonts.mjs.map +1 -0
  107. package/dist/lib/haptics.d.mts +7 -0
  108. package/dist/lib/haptics.d.mts.map +1 -0
  109. package/dist/lib/haptics.mjs +25 -0
  110. package/dist/lib/haptics.mjs.map +1 -0
  111. package/dist/lib/insideSheet.mjs +16 -0
  112. package/dist/lib/insideSheet.mjs.map +1 -0
  113. package/dist/lib/markdown.mjs +271 -0
  114. package/dist/lib/markdown.mjs.map +1 -0
  115. package/dist/lib/tone.mjs +50 -0
  116. package/dist/lib/tone.mjs.map +1 -0
  117. package/dist/lib/useControllable.mjs +22 -0
  118. package/dist/lib/useControllable.mjs.map +1 -0
  119. package/dist/lib/wrapText.mjs +20 -0
  120. package/dist/lib/wrapText.mjs.map +1 -0
  121. package/llms.txt +8 -0
  122. package/package.json +104 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SegmentedControl.d.mts","names":[],"sources":["../../src/components/SegmentedControl.tsx"],"mappings":";;iBA0BiB;EACf;EACA;;iBAGe;;EAEf,kBAAkB;;EAElB;EACA,gBAAgB;EAChB;;EAEA;EACA,QAAQ,UAAU;;;;;;;;wBASJ,mBACd,SACA,OACA,eACA,UACA,oBACA,SACC,wCAAqB,IAAA"}
@@ -0,0 +1,56 @@
1
+ import { fontOf } from "../lib/fonts.mjs";
2
+ import { selectionTick } from "../lib/haptics.mjs";
3
+ import { StyleSheet, withUnistyles } from "react-native-unistyles";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import RNSegmentedControl from "@react-native-segmented-control/segmented-control";
6
+
7
+ //#region src/components/SegmentedControl.tsx
8
+ /** Theme colours reach the third-party control through withUnistyles, so it follows theme changes. */
9
+ const ThemedSegmentedControl = withUnistyles(RNSegmentedControl, (theme) => ({
10
+ backgroundColor: theme.colors.deep,
11
+ tintColor: theme.colors["tint-green"],
12
+ fontStyle: {
13
+ color: theme.colors.dim,
14
+ fontFamily: fontOf(theme.fontFamily.sans),
15
+ fontSize: theme.fontSize.base,
16
+ fontWeight: theme.fontWeight.medium
17
+ },
18
+ activeFontStyle: {
19
+ color: theme.colors.green,
20
+ fontFamily: fontOf(theme.fontFamily.sans),
21
+ fontSize: theme.fontSize.base,
22
+ fontWeight: theme.fontWeight.semibold
23
+ },
24
+ appearance: theme.scheme
25
+ }));
26
+ /**
27
+ * A short exclusive choice, such as a task's status: the platform's own
28
+ * segmented control on iOS, the library's drawn fallback elsewhere, with a
29
+ * selection tick on each change. It is the native stand-in for a web Select
30
+ * with a handful of options.
31
+ */
32
+ function SegmentedControl({ options, value, onValueChange, disabled = false, accessibilityLabel, style }) {
33
+ return /* @__PURE__ */ jsx(ThemedSegmentedControl, {
34
+ values: options.map((option) => option.label),
35
+ selectedIndex: options.findIndex((option) => option.value === value),
36
+ enabled: !disabled,
37
+ accessibilityLabel,
38
+ accessibilityState: { disabled },
39
+ onChange: (event) => {
40
+ const next = options[event.nativeEvent.selectedSegmentIndex];
41
+ if (next === void 0 || next.value === value) return;
42
+ selectionTick();
43
+ onValueChange(next.value);
44
+ },
45
+ style: [styles.control, style]
46
+ });
47
+ }
48
+ const styles = StyleSheet.create((theme) => ({ control: {
49
+ minHeight: 32,
50
+ borderRadius: theme.borderRadius.md,
51
+ uni__dependencies: [0]
52
+ } }));
53
+
54
+ //#endregion
55
+ export { SegmentedControl };
56
+ //# sourceMappingURL=SegmentedControl.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SegmentedControl.mjs","names":["RNSegmentedControl","StyleProp","ViewStyle","StyleSheet","withUnistyles","fontOf","selectionTick","ThemedSegmentedControl","theme","backgroundColor","colors","deep","tintColor","fontStyle","color","dim","fontFamily","sans","fontSize","base","fontWeight","medium","activeFontStyle","green","semibold","appearance","scheme","SegmentedControlOption","value","label","SegmentedControlProps","options","onValueChange","disabled","accessibilityLabel","style","SegmentedControl","map","option","findIndex","event","next","nativeEvent","selectedSegmentIndex","undefined","styles","control","create","minHeight","borderRadius","md","uni__dependencies"],"sources":["../../src/components/SegmentedControl.tsx"],"sourcesContent":["import RNSegmentedControl from '@react-native-segmented-control/segmented-control';\nimport type { StyleProp, ViewStyle } from 'react-native';\nimport { StyleSheet, withUnistyles } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { selectionTick } from '../lib/haptics';\n\n/** Theme colours reach the third-party control through withUnistyles, so it follows theme changes. */\nconst ThemedSegmentedControl = withUnistyles(RNSegmentedControl, (theme) => ({\n backgroundColor: theme.colors.deep,\n tintColor: theme.colors['tint-green'],\n fontStyle: {\n color: theme.colors.dim,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n fontWeight: theme.fontWeight.medium,\n },\n activeFontStyle: {\n color: theme.colors.green,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n fontWeight: theme.fontWeight.semibold,\n },\n appearance: theme.scheme,\n}));\n\nexport interface SegmentedControlOption {\n value: string;\n label: string;\n}\n\nexport interface SegmentedControlProps {\n /** The segments, in order. */\n options: readonly SegmentedControlOption[];\n /** The selected option's value. */\n value: string;\n onValueChange: (value: string) => void;\n disabled?: boolean;\n /** What the control is for, such as \"Status\". */\n accessibilityLabel?: string;\n style?: StyleProp<ViewStyle>;\n}\n\n/**\n * A short exclusive choice, such as a task's status: the platform's own\n * segmented control on iOS, the library's drawn fallback elsewhere, with a\n * selection tick on each change. It is the native stand-in for a web Select\n * with a handful of options.\n */\nexport function SegmentedControl({\n options,\n value,\n onValueChange,\n disabled = false,\n accessibilityLabel,\n style,\n}: SegmentedControlProps) {\n return (\n <ThemedSegmentedControl\n values={options.map((option) => option.label)}\n selectedIndex={options.findIndex((option) => option.value === value)}\n enabled={!disabled}\n accessibilityLabel={accessibilityLabel}\n accessibilityState={{ disabled }}\n onChange={(event) => {\n const next = options[event.nativeEvent.selectedSegmentIndex];\n if (next === undefined || next.value === value) return;\n selectionTick();\n onValueChange(next.value);\n }}\n style={[styles.control, style]}\n />\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n control: { minHeight: 32, borderRadius: theme.borderRadius.md },\n}));\n"],"mappings":";;;;;;;;AAQA,MAAMO,yBAAyBH,cAAcJ,qBAAqBQ,WAAW;CAC3EC,iBAAiBD,MAAME,OAAOC;CAC9BC,WAAWJ,MAAME,OAAO;CACxBG,WAAW;EACTC,OAAON,MAAME,OAAOK;EACpBC,YAAYX,OAAOG,MAAMQ,WAAWC,IAAI;EACxCC,UAAUV,MAAMU,SAASC;EACzBC,YAAYZ,MAAMY,WAAWC;CAC/B;CACAC,iBAAiB;EACfR,OAAON,MAAME,OAAOa;EACpBP,YAAYX,OAAOG,MAAMQ,WAAWC,IAAI;EACxCC,UAAUV,MAAMU,SAASC;EACzBC,YAAYZ,MAAMY,WAAWI;CAC/B;CACAC,YAAYjB,MAAMkB;AACpB,EAAE;;;;;;;AAyBF,SAAgBU,iBAAiB,EAC/BL,SACAH,OACAI,eACAC,WAAW,OACXC,oBACAC,SACwB;CACxB,OACE,oBAAC,wBAAD;EACE,QAAQJ,QAAQM,KAAKC,WAAWA,OAAOT,KAAK;EAC5C,eAAeE,QAAQQ,WAAWD,WAAWA,OAAOV,UAAUA,KAAK;EACnE,SAAS,CAACK;EACUC;EACpB,oBAAoB,EAAED,SAAS;EAC/B,WAAWO,UAAU;GACnB,MAAMC,OAAOV,QAAQS,MAAME,YAAYC;GACvC,IAAIF,SAASG,UAAaH,KAAKb,UAAUA,OAAO;GAChDtB,cAAc;GACd0B,cAAcS,KAAKb,KAAK;EAC1B;EACA,OAAO,CAACiB,OAAOC,SAASX,KAAK;CAAE;AAGrC;AAEA,MAAMU,SAAS1C,WAAW4C,QAAQvC,WAAW,EAC3CsC,SAAS;CAAEE,WAAW;CAAIC,cAAczC,MAAMyC,aAAaC;CAAEC,mBAAA,CAAA,CAAA;AAAC,EAChE,EAAE"}
@@ -0,0 +1,39 @@
1
+ import { ButtonProps } from "./Button.mjs";
2
+ import { StyleProp, TextProps, ViewProps, ViewStyle } from "react-native";
3
+ import { ReactNode } from "react";
4
+ //#region src/components/Sheet.d.ts
5
+ export interface SheetProps {
6
+ /** Controlled mode; pair with onOpenChange. Omit it and the sheet keeps its own state. */
7
+ open?: boolean;
8
+ defaultOpen?: boolean;
9
+ onOpenChange?: (open: boolean) => void;
10
+ children?: ReactNode;
11
+ }
12
+ export declare function Sheet({ open, defaultOpen, onOpenChange, children }: SheetProps): import("react").JSX.Element;
13
+ /** A Button that opens the enclosing sheet. */
14
+ export declare function SheetTrigger({ onPress, ...props }: ButtonProps): import("react").JSX.Element;
15
+ /** A Button that closes the enclosing sheet. */
16
+ export declare function SheetClose({ onPress, ...props }: ButtonProps): import("react").JSX.Element;
17
+ export interface SheetContentProps {
18
+ children?: ReactNode;
19
+ }
20
+ /** The sheet surface. Fields inside it switch to the sheet's own input so the keyboard lifts the sheet. */
21
+ export declare function SheetContent({ children }: SheetContentProps): import("react").JSX.Element;
22
+ export interface SheetPartProps extends Omit<ViewProps, 'children' | 'style'> {
23
+ children?: ReactNode;
24
+ style?: StyleProp<ViewStyle>;
25
+ }
26
+ export interface SheetHeaderProps extends SheetPartProps {
27
+ /** Show the close control at the right of the strip. On by default: a sheet is dismissed, not answered. */
28
+ dismissible?: boolean;
29
+ /** What the close control announces. */
30
+ closeLabel?: string;
31
+ }
32
+ export declare function SheetHeader({ dismissible, closeLabel, style, children, ...props }: SheetHeaderProps): import("react").JSX.Element;
33
+ export declare function SheetTitle({ style, ...props }: TextProps): import("react").JSX.Element;
34
+ export declare function SheetDescription({ style, ...props }: TextProps): import("react").JSX.Element;
35
+ /** The scrolling middle; the sheet itself scrolls, so this only spaces its children. */
36
+ export declare function SheetBody({ style, children, ...props }: SheetPartProps): import("react").JSX.Element;
37
+ export declare function SheetFooter({ style, children, ...props }: SheetPartProps): import("react").JSX.Element;
38
+ //#endregion
39
+ //# sourceMappingURL=Sheet.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sheet.d.mts","names":[],"sources":["../../src/components/Sheet.tsx"],"mappings":";;;;iBAwBiB;;EAEf;EACA;EACA,gBAAgB;EAChB,WAAW;;wBAGG,QAAQ,MAAM,aAAqB,cAAc,YAAY,6BAAU,IAAA;;wBAMvE,eAAe,YAAY,SAAS,8BAAW,IAAA;;wBAc/C,aAAa,YAAY,SAAS,8BAAW,IAAA;iBAa5C;EACf,WAAW;;;wBAIG,eAAe,YAAY,oCAAiB,IAAA;iBAS3C,uBAAuB,KAAK;EAC3C,WAAW;EACX,QAAQ,UAAU;;iBAGH,yBAAyB;;EAExC;;EAEA;;wBAGc,cAAc,aAAoB,YAAsB,OAAO,aAAa,SAAS,mCAAgB,IAAA;wBAoBrG,aAAa,UAAU,SAAS,4BAAS,IAAA;wBAIzC,mBAAmB,UAAU,SAAS,4BAAS,IAAA;;wBAK/C,YAAY,OAAO,aAAa,SAAS,iCAAc,IAAA;wBAQvD,cAAc,OAAO,aAAa,SAAS,iCAAc,IAAA"}
@@ -0,0 +1,166 @@
1
+ import { fontOf } from "../lib/fonts.mjs";
2
+ import { wrapText } from "../lib/wrapText.mjs";
3
+ import { Button } from "./Button.mjs";
4
+ import { CloseIcon } from "../icons/icons.mjs";
5
+ import { useControllable } from "../lib/useControllable.mjs";
6
+ import { SheetFrame } from "./SheetFrame.mjs";
7
+ import { View } from "react-native-unistyles/components/native/View";
8
+ import { StyleSheet } from "react-native-unistyles";
9
+ import { Text } from "react-native-unistyles/components/native/Text";
10
+ import { createContext, useContext } from "react";
11
+ import { jsx, jsxs } from "react/jsx-runtime";
12
+
13
+ //#region src/components/Sheet.tsx
14
+ const SheetContext = createContext({
15
+ open: false,
16
+ setOpen: () => void 0
17
+ });
18
+ function Sheet({ open, defaultOpen = false, onOpenChange, children }) {
19
+ const [current, setOpen] = useControllable(open, defaultOpen, onOpenChange);
20
+ return /* @__PURE__ */ jsx(SheetContext.Provider, {
21
+ value: {
22
+ open: current,
23
+ setOpen
24
+ },
25
+ children
26
+ });
27
+ }
28
+ /** A Button that opens the enclosing sheet. */
29
+ function SheetTrigger({ onPress, ...props }) {
30
+ const { setOpen } = useContext(SheetContext);
31
+ return /* @__PURE__ */ jsx(Button, {
32
+ onPress: (event) => {
33
+ onPress?.(event);
34
+ setOpen(true);
35
+ },
36
+ ...props
37
+ });
38
+ }
39
+ /** A Button that closes the enclosing sheet. */
40
+ function SheetClose({ onPress, ...props }) {
41
+ const { setOpen } = useContext(SheetContext);
42
+ return /* @__PURE__ */ jsx(Button, {
43
+ onPress: (event) => {
44
+ onPress?.(event);
45
+ setOpen(false);
46
+ },
47
+ ...props
48
+ });
49
+ }
50
+ /** The sheet surface. Fields inside it switch to the sheet's own input so the keyboard lifts the sheet. */
51
+ function SheetContent({ children }) {
52
+ const { open, setOpen } = useContext(SheetContext);
53
+ return /* @__PURE__ */ jsx(SheetFrame, {
54
+ open,
55
+ onClose: () => setOpen(false),
56
+ children
57
+ });
58
+ }
59
+ function SheetHeader({ dismissible = true, closeLabel = "close", style, children, ...props }) {
60
+ const { setOpen } = useContext(SheetContext);
61
+ return /* @__PURE__ */ jsxs(View, {
62
+ style: [styles.header, style],
63
+ ...props,
64
+ children: [children, dismissible ? /* @__PURE__ */ jsx(Button, {
65
+ variant: "ghost",
66
+ size: "icon",
67
+ accessibilityLabel: closeLabel,
68
+ onPress: () => setOpen(false),
69
+ style: styles.close,
70
+ children: /* @__PURE__ */ jsx(CloseIcon, {
71
+ size: 12,
72
+ color: "faint"
73
+ })
74
+ }) : null]
75
+ });
76
+ }
77
+ function SheetTitle({ style, ...props }) {
78
+ return /* @__PURE__ */ jsx(Text, {
79
+ accessibilityRole: "header",
80
+ numberOfLines: 1,
81
+ style: [styles.title, style],
82
+ ...props
83
+ });
84
+ }
85
+ function SheetDescription({ style, ...props }) {
86
+ return /* @__PURE__ */ jsx(Text, {
87
+ style: [styles.description, style],
88
+ ...props
89
+ });
90
+ }
91
+ /** The scrolling middle; the sheet itself scrolls, so this only spaces its children. */
92
+ function SheetBody({ style, children, ...props }) {
93
+ return /* @__PURE__ */ jsx(View, {
94
+ style: [styles.body, style],
95
+ ...props,
96
+ children: wrapText(children, styles.description)
97
+ });
98
+ }
99
+ function SheetFooter({ style, children, ...props }) {
100
+ return /* @__PURE__ */ jsx(View, {
101
+ style: [styles.footer, style],
102
+ ...props,
103
+ children: wrapText(children, styles.hint)
104
+ });
105
+ }
106
+ const styles = StyleSheet.create((theme) => ({
107
+ header: {
108
+ flexDirection: "row",
109
+ alignItems: "center",
110
+ gap: theme.spacing(2.5),
111
+ minWidth: 0,
112
+ height: theme.spacing(11),
113
+ borderBottomWidth: 1,
114
+ borderBottomColor: theme.colors.border,
115
+ paddingHorizontal: theme.spacing(4),
116
+ uni__dependencies: [0]
117
+ },
118
+ close: { marginLeft: "auto" },
119
+ title: {
120
+ flexShrink: 1,
121
+ color: theme.colors.hi,
122
+ fontFamily: fontOf(theme.fontFamily.sans),
123
+ fontSize: theme.fontSize.lg,
124
+ lineHeight: theme.lineHeight.lg,
125
+ fontWeight: theme.fontWeight.semibold,
126
+ uni__dependencies: [0]
127
+ },
128
+ description: {
129
+ color: theme.colors.dim,
130
+ fontFamily: fontOf(theme.fontFamily.sans),
131
+ fontSize: theme.fontSize.sm,
132
+ lineHeight: theme.lineHeightRelaxed.sm,
133
+ uni__dependencies: [0]
134
+ },
135
+ body: {
136
+ gap: theme.spacing(3),
137
+ paddingHorizontal: theme.spacing(4),
138
+ paddingVertical: theme.spacing(3),
139
+ uni__dependencies: [0]
140
+ },
141
+ footer: {
142
+ flexDirection: "row",
143
+ flexWrap: "wrap",
144
+ alignItems: "center",
145
+ justifyContent: "space-between",
146
+ gap: theme.spacing(2),
147
+ minHeight: 34,
148
+ borderTopWidth: 1,
149
+ borderTopColor: theme.colors["border-soft"],
150
+ backgroundColor: theme.colors.deep,
151
+ paddingHorizontal: theme.spacing(4),
152
+ paddingVertical: theme.spacing(1.5),
153
+ uni__dependencies: [0]
154
+ },
155
+ hint: {
156
+ color: theme.colors.faint,
157
+ fontFamily: fontOf(theme.fontFamily.sans),
158
+ fontSize: theme.fontSize["2xs"],
159
+ lineHeight: theme.lineHeight["2xs"],
160
+ uni__dependencies: [0]
161
+ }
162
+ }));
163
+
164
+ //#endregion
165
+ export { Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger };
166
+ //# sourceMappingURL=Sheet.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sheet.mjs","names":["createContext","ReactNode","useContext","StyleProp","TextProps","ViewProps","ViewStyle","StyleSheet","CloseIcon","fontOf","useControllable","wrapText","Button","ButtonProps","SheetFrame","SheetState","open","setOpen","SheetContext","undefined","SheetProps","defaultOpen","onOpenChange","children","Sheet","current","SheetTrigger","onPress","props","event","SheetClose","SheetContentProps","SheetContent","SheetPartProps","Omit","style","SheetHeaderProps","dismissible","closeLabel","SheetHeader","styles","header","close","SheetTitle","title","SheetDescription","description","SheetBody","body","SheetFooter","footer","hint","create","theme","flexDirection","alignItems","gap","spacing","minWidth","height","borderBottomWidth","borderBottomColor","colors","border","paddingHorizontal","uni__dependencies","marginLeft","flexShrink","color","hi","fontFamily","sans","fontSize","lg","lineHeight","fontWeight","semibold","dim","sm","lineHeightRelaxed","paddingVertical","flexWrap","justifyContent","minHeight","borderTopWidth","borderTopColor","backgroundColor","deep","faint"],"sources":["../../src/components/Sheet.tsx"],"sourcesContent":["import { createContext, type ReactNode, useContext } from 'react';\nimport { type StyleProp, Text, type TextProps, View, type ViewProps, type ViewStyle } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { CloseIcon } from '../icons/icons';\nimport { fontOf } from '../lib/fonts';\nimport { useControllable } from '../lib/useControllable';\nimport { wrapText } from '../lib/wrapText';\nimport { Button, type ButtonProps } from './Button';\nimport { SheetFrame } from './SheetFrame';\n\n/*\n * The web Sheet as a bottom sheet: the native shape for a detail view or a\n * short form over what the reader was looking at. `side` and `width` are\n * dropped; a phone sheet rises from the bottom edge and takes the width.\n */\n\ninterface SheetState {\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nconst SheetContext = createContext<SheetState>({ open: false, setOpen: () => undefined });\n\nexport interface SheetProps {\n /** Controlled mode; pair with onOpenChange. Omit it and the sheet keeps its own state. */\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n children?: ReactNode;\n}\n\nexport function Sheet({ open, defaultOpen = false, onOpenChange, children }: SheetProps) {\n const [current, setOpen] = useControllable(open, defaultOpen, onOpenChange);\n return <SheetContext.Provider value={{ open: current, setOpen }}>{children}</SheetContext.Provider>;\n}\n\n/** A Button that opens the enclosing sheet. */\nexport function SheetTrigger({ onPress, ...props }: ButtonProps) {\n const { setOpen } = useContext(SheetContext);\n return (\n <Button\n onPress={(event) => {\n onPress?.(event);\n setOpen(true);\n }}\n {...props}\n />\n );\n}\n\n/** A Button that closes the enclosing sheet. */\nexport function SheetClose({ onPress, ...props }: ButtonProps) {\n const { setOpen } = useContext(SheetContext);\n return (\n <Button\n onPress={(event) => {\n onPress?.(event);\n setOpen(false);\n }}\n {...props}\n />\n );\n}\n\nexport interface SheetContentProps {\n children?: ReactNode;\n}\n\n/** The sheet surface. Fields inside it switch to the sheet's own input so the keyboard lifts the sheet. */\nexport function SheetContent({ children }: SheetContentProps) {\n const { open, setOpen } = useContext(SheetContext);\n return (\n <SheetFrame open={open} onClose={() => setOpen(false)}>\n {children}\n </SheetFrame>\n );\n}\n\nexport interface SheetPartProps extends Omit<ViewProps, 'children' | 'style'> {\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\nexport interface SheetHeaderProps extends SheetPartProps {\n /** Show the close control at the right of the strip. On by default: a sheet is dismissed, not answered. */\n dismissible?: boolean;\n /** What the close control announces. */\n closeLabel?: string;\n}\n\nexport function SheetHeader({ dismissible = true, closeLabel = 'close', style, children, ...props }: SheetHeaderProps) {\n const { setOpen } = useContext(SheetContext);\n return (\n <View style={[styles.header, style]} {...props}>\n {children}\n {dismissible ? (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n accessibilityLabel={closeLabel}\n onPress={() => setOpen(false)}\n style={styles.close}\n >\n <CloseIcon size={12} color=\"faint\" />\n </Button>\n ) : null}\n </View>\n );\n}\n\nexport function SheetTitle({ style, ...props }: TextProps) {\n return <Text accessibilityRole=\"header\" numberOfLines={1} style={[styles.title, style]} {...props} />;\n}\n\nexport function SheetDescription({ style, ...props }: TextProps) {\n return <Text style={[styles.description, style]} {...props} />;\n}\n\n/** The scrolling middle; the sheet itself scrolls, so this only spaces its children. */\nexport function SheetBody({ style, children, ...props }: SheetPartProps) {\n return (\n <View style={[styles.body, style]} {...props}>\n {wrapText(children, styles.description)}\n </View>\n );\n}\n\nexport function SheetFooter({ style, children, ...props }: SheetPartProps) {\n return (\n <View style={[styles.footer, style]} {...props}>\n {wrapText(children, styles.hint)}\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n header: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(2.5),\n minWidth: 0,\n height: theme.spacing(11),\n borderBottomWidth: 1,\n borderBottomColor: theme.colors.border,\n paddingHorizontal: theme.spacing(4),\n },\n close: { marginLeft: 'auto' },\n title: {\n flexShrink: 1,\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.sm,\n lineHeight: theme.lineHeightRelaxed.sm,\n },\n body: {\n gap: theme.spacing(3),\n paddingHorizontal: theme.spacing(4),\n paddingVertical: theme.spacing(3),\n },\n footer: {\n flexDirection: 'row',\n flexWrap: 'wrap',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: theme.spacing(2),\n minHeight: 34,\n borderTopWidth: 1,\n borderTopColor: theme.colors['border-soft'],\n backgroundColor: theme.colors.deep,\n paddingHorizontal: theme.spacing(4),\n paddingVertical: theme.spacing(1.5),\n },\n hint: {\n color: theme.colors.faint,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize['2xs'],\n lineHeight: theme.lineHeight['2xs'],\n },\n}));\n"],"mappings":";;;;;;;;;;;;;AAsBA,MAAMkB,eAAelB,cAA0B;CAAEgB,MAAM;CAAOC,eAAeE;AAAU,CAAC;AAUxF,SAAgBK,MAAM,EAAER,MAAMK,cAAc,OAAOC,cAAcC,YAAwB;CACvF,MAAM,CAACE,SAASR,WAAWP,gBAAgBM,MAAMK,aAAaC,YAAY;C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C;CACAjB,MAAM;EACJQ,KAAKH,MAAMI,QAAQ,CAAC;EACpBO,mBAAmBX,MAAMI,QAAQ,CAAC;EAClCuB,iBAAiB3B,MAAMI,QAAQ,CAAC;EAACQ,mBAAA,CAAA,CAAA;CACnC;CACAf,QAAQ;EACNI,eAAe;EACf2B,UAAU;EACV1B,YAAY;EACZ2B,gBAAgB;EAChB1B,KAAKH,MAAMI,QAAQ,CAAC;EACpB0B,WAAW;EACXC,gBAAgB;EAChBC,gBAAgBhC,MAAMS,OAAO;EAC7BwB,iBAAiBjC,MAAMS,OAAOyB;EAC9BvB,mBAAmBX,MAAMI,QAAQ,CAAC;EAClCuB,iBAAiB3B,MAAMI,QAAQ,GAAG;EAACQ,mBAAA,CAAA,CAAA;CACrC;CACAd,MAAM;EACJiB,OAAOf,MAAMS,OAAO0B;EACpBlB,YAAY7D,OAAO4C,MAAMiB,WAAWC,IAAI;EACxCC,UAAUnB,MAAMmB,SAAS;EACzBE,YAAYrB,MAAMqB,WAAW;EAAMT,mBAAA,CAAA,CAAA;CACrC;AACF,EAAE"}
@@ -0,0 +1,84 @@
1
+ import { InsideSheetContext } from "../lib/insideSheet.mjs";
2
+ import { withAlpha } from "@agimon-ai/po-web-components/nativeTheme";
3
+ import { StyleSheet, useUnistyles } from "react-native-unistyles";
4
+ import { BackHandler } from "react-native";
5
+ import { useCallback, useContext, useEffect, useRef } from "react";
6
+ import { jsx } from "react/jsx-runtime";
7
+ import { BottomSheetBackdrop, BottomSheetModal, BottomSheetScrollView } from "@gorhom/bottom-sheet";
8
+ import { SafeAreaInsetsContext } from "react-native-safe-area-context";
9
+
10
+ //#region src/components/SheetFrame.tsx
11
+ /** `bg-doom-deep/70`, the overlay every web sheet and dialog draws. */
12
+ const BACKDROP_ALPHA_PERCENT = 70;
13
+ /**
14
+ * The bottom sheet both Sheet and DropdownMenu sit in: a drag handle, sized
15
+ * to its content, closed by dragging down, tapping the backdrop or Android
16
+ * back, clear of the safe area and lifted by the keyboard. Private: the public
17
+ * parts keep bottom-sheet types out of the package API.
18
+ */
19
+ function SheetFrame({ open, onClose, children }) {
20
+ const { theme } = useUnistyles();
21
+ const insets = useContext(SafeAreaInsetsContext);
22
+ const sheet = useRef(null);
23
+ const openRef = useRef(open);
24
+ const presented = useRef(false);
25
+ useEffect(() => {
26
+ openRef.current = open;
27
+ if (open) {
28
+ presented.current = true;
29
+ sheet.current?.present();
30
+ } else if (presented.current) {
31
+ presented.current = false;
32
+ sheet.current?.dismiss();
33
+ }
34
+ }, [open]);
35
+ useEffect(() => {
36
+ if (!open) return void 0;
37
+ const subscription = BackHandler.addEventListener("hardwareBackPress", () => {
38
+ onClose();
39
+ return true;
40
+ });
41
+ return () => subscription.remove();
42
+ }, [open, onClose]);
43
+ const backdropColor = withAlpha(theme.colors.deep, BACKDROP_ALPHA_PERCENT);
44
+ const renderBackdrop = useCallback((props) => /* @__PURE__ */ jsx(BottomSheetBackdrop, {
45
+ ...props,
46
+ appearsOnIndex: 0,
47
+ disappearsOnIndex: -1,
48
+ opacity: 1,
49
+ pressBehavior: "close",
50
+ style: [props.style, { backgroundColor: backdropColor }]
51
+ }), [backdropColor]);
52
+ return /* @__PURE__ */ jsx(BottomSheetModal, {
53
+ ref: sheet,
54
+ stackBehavior: "push",
55
+ enablePanDownToClose: true,
56
+ topInset: insets?.top ?? 0,
57
+ keyboardBehavior: "interactive",
58
+ keyboardBlurBehavior: "restore",
59
+ android_keyboardInputMode: "adjustResize",
60
+ backdropComponent: renderBackdrop,
61
+ backgroundStyle: {
62
+ backgroundColor: theme.colors.rail,
63
+ borderRadius: theme.borderRadius.lg
64
+ },
65
+ handleIndicatorStyle: { backgroundColor: theme.colors.border },
66
+ onDismiss: () => {
67
+ presented.current = false;
68
+ if (openRef.current) onClose();
69
+ },
70
+ children: /* @__PURE__ */ jsx(BottomSheetScrollView, {
71
+ keyboardShouldPersistTaps: "handled",
72
+ contentContainerStyle: [styles.content, { paddingBottom: insets?.bottom ?? 0 }],
73
+ children: /* @__PURE__ */ jsx(InsideSheetContext.Provider, {
74
+ value: true,
75
+ children
76
+ })
77
+ })
78
+ });
79
+ }
80
+ const styles = StyleSheet.create({ content: { flexGrow: 1 } });
81
+
82
+ //#endregion
83
+ export { SheetFrame };
84
+ //# sourceMappingURL=SheetFrame.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SheetFrame.mjs","names":["withAlpha","BottomSheetBackdrop","BottomSheetBackdropProps","BottomSheetModal","BottomSheetScrollView","ReactNode","useCallback","useContext","useEffect","useRef","BackHandler","SafeAreaInsetsContext","StyleSheet","useUnistyles","InsideSheetContext","BACKDROP_ALPHA_PERCENT","SheetFrameProps","open","onClose","children","SheetFrame","theme","insets","sheet","openRef","presented","current","present","dismiss","undefined","subscription","addEventListener","remove","backdropColor","colors","deep","renderBackdrop","props","style","backgroundColor","top","rail","borderRadius","lg","border","styles","content","paddingBottom","bottom","create","flexGrow"],"sources":["../../src/components/SheetFrame.tsx"],"sourcesContent":["import { withAlpha } from '@agimon-ai/po-web-components/nativeTheme';\nimport {\n BottomSheetBackdrop,\n type BottomSheetBackdropProps,\n BottomSheetModal,\n BottomSheetScrollView,\n} from '@gorhom/bottom-sheet';\nimport { type ReactNode, useCallback, useContext, useEffect, useRef } from 'react';\nimport { BackHandler } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\nimport { StyleSheet, useUnistyles } from 'react-native-unistyles';\n\nimport { InsideSheetContext } from '../lib/insideSheet';\n\n/** `bg-doom-deep/70`, the overlay every web sheet and dialog draws. */\nconst BACKDROP_ALPHA_PERCENT = 70;\n\nexport interface SheetFrameProps {\n open: boolean;\n /** The sheet asked to close: a drag down, a backdrop tap or Android back. */\n onClose: () => void;\n children?: ReactNode;\n}\n\n/**\n * The bottom sheet both Sheet and DropdownMenu sit in: a drag handle, sized\n * to its content, closed by dragging down, tapping the backdrop or Android\n * back, clear of the safe area and lifted by the keyboard. Private: the public\n * parts keep bottom-sheet types out of the package API.\n */\nexport function SheetFrame({ open, onClose, children }: SheetFrameProps) {\n const { theme } = useUnistyles();\n const insets = useContext(SafeAreaInsetsContext);\n const sheet = useRef<BottomSheetModal>(null);\n const openRef = useRef(open);\n const presented = useRef(false);\n\n useEffect(() => {\n openRef.current = open;\n if (open) {\n presented.current = true;\n sheet.current?.present();\n } else if (presented.current) {\n // Only a presented sheet is dismissed. Dismissing one that never opened leaves bottom-sheet's\n // modal stuck in its dismissing status, and the next present() then never draws.\n presented.current = false;\n sheet.current?.dismiss();\n }\n }, [open]);\n\n useEffect(() => {\n if (!open) return undefined;\n const subscription = BackHandler.addEventListener('hardwareBackPress', () => {\n onClose();\n return true;\n });\n return () => subscription.remove();\n }, [open, onClose]);\n\n const backdropColor = withAlpha(theme.colors.deep, BACKDROP_ALPHA_PERCENT);\n const renderBackdrop = useCallback(\n (props: BottomSheetBackdropProps) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n opacity={1}\n pressBehavior=\"close\"\n style={[props.style, { backgroundColor: backdropColor }]}\n />\n ),\n [backdropColor],\n );\n\n return (\n <BottomSheetModal\n ref={sheet}\n stackBehavior=\"push\"\n enablePanDownToClose\n topInset={insets?.top ?? 0}\n keyboardBehavior=\"interactive\"\n keyboardBlurBehavior=\"restore\"\n android_keyboardInputMode=\"adjustResize\"\n backdropComponent={renderBackdrop}\n backgroundStyle={{ backgroundColor: theme.colors.rail, borderRadius: theme.borderRadius.lg }}\n handleIndicatorStyle={{ backgroundColor: theme.colors.border }}\n // A sheet the caller closed is already shut; only a close the sheet started is reported.\n onDismiss={() => {\n // Already shut, so the close the parent answers with must not dismiss it a second time.\n presented.current = false;\n if (openRef.current) onClose();\n }}\n >\n <BottomSheetScrollView\n keyboardShouldPersistTaps=\"handled\"\n contentContainerStyle={[styles.content, { paddingBottom: insets?.bottom ?? 0 }]}\n >\n <InsideSheetContext.Provider value>{children}</InsideSheetContext.Provider>\n </BottomSheetScrollView>\n </BottomSheetModal>\n );\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C3F,sBAAsB,EAAEJ,iBAAiBlB,MAAMa,OAAOU,OAAO;EAE7D,iBAAiB;GAEfnB,UAAUC,UAAU;GACpB,IAAIF,QAAQE,SAASR,QAAQ;EAC/B;YAEA,oBAAC,uBAAD;GACE,2BAA0B;GAC1B,uBAAuB,CAAC2B,OAAOC,SAAS,EAAEC,eAAezB,QAAQ0B,UAAU,EAAE,CAAC;aAE9E,oBAAC,mBAAmB,UAApB;IAA6B;IAAO7B;GAAsC;EACrD;CACP;AAEtB;AAEA,MAAM0B,SAASjC,WAAWqC,OAAO,EAAEH,SAAS,EAAEI,UAAU,EAAE,EAAE,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { NativeColorToken } from "@agimon-ai/po-web-components/nativeTheme";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ //#region src/components/Spinner.d.ts
4
+ export interface SpinnerProps {
5
+ /**
6
+ * What the wait is for. Given one, the spinner is a progress indicator in a
7
+ * live region, so a screen reader says "Loading providers" instead of
8
+ * nothing. Without one it is hidden from screen readers.
9
+ */
10
+ label?: string;
11
+ /** A theme token, never system blue. Defaults to `dim`. */
12
+ color?: NativeColorToken;
13
+ size?: 'small' | 'large';
14
+ style?: StyleProp<ViewStyle>;
15
+ }
16
+ /** The platform's own activity indicator in a theme colour; decorative unless it is given a label. */
17
+ export declare function Spinner({ label, color, size, style }: SpinnerProps): import("react").JSX.Element;
18
+ //#endregion
19
+ //# sourceMappingURL=Spinner.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spinner.d.mts","names":[],"sources":["../../src/components/Spinner.tsx"],"mappings":";;;iBAIiB;;;;;;EAMf;;EAEA,QAAQ;EACR;EACA,QAAQ,UAAU;;;wBAIJ,UAAU,OAAO,OAAe,MAAgB,SAAS,+BAAY,IAAA"}
@@ -0,0 +1,34 @@
1
+ import { View } from "react-native-unistyles/components/native/View";
2
+ import { useUnistyles } from "react-native-unistyles";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { ActivityIndicator } from "react-native-unistyles/components/native/ActivityIndicator";
5
+
6
+ //#region src/components/Spinner.tsx
7
+ /** The platform's own activity indicator in a theme colour; decorative unless it is given a label. */
8
+ function Spinner({ label, color = "dim", size = "small", style }) {
9
+ const { theme } = useUnistyles();
10
+ const indicator = /* @__PURE__ */ jsx(ActivityIndicator, {
11
+ color: theme.colors[color],
12
+ size
13
+ });
14
+ if (label === void 0) return /* @__PURE__ */ jsx(View, {
15
+ style,
16
+ accessible: false,
17
+ importantForAccessibility: "no-hide-descendants",
18
+ accessibilityElementsHidden: true,
19
+ children: indicator
20
+ });
21
+ return /* @__PURE__ */ jsx(View, {
22
+ style,
23
+ accessible: true,
24
+ accessibilityRole: "progressbar",
25
+ accessibilityLabel: label,
26
+ accessibilityLiveRegion: "polite",
27
+ accessibilityState: { busy: true },
28
+ children: indicator
29
+ });
30
+ }
31
+
32
+ //#endregion
33
+ export { Spinner };
34
+ //# sourceMappingURL=Spinner.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spinner.mjs","names":["NativeColorToken","StyleProp","ViewStyle","useUnistyles","SpinnerProps","label","color","size","style","Spinner","theme","indicator","colors","undefined","busy"],"sources":["../../src/components/Spinner.tsx"],"sourcesContent":["import type { NativeColorToken } from '@agimon-ai/po-web-components/nativeTheme';\nimport { ActivityIndicator, type StyleProp, View, type ViewStyle } from 'react-native';\nimport { useUnistyles } from 'react-native-unistyles';\n\nexport interface SpinnerProps {\n /**\n * What the wait is for. Given one, the spinner is a progress indicator in a\n * live region, so a screen reader says \"Loading providers\" instead of\n * nothing. Without one it is hidden from screen readers.\n */\n label?: string;\n /** A theme token, never system blue. Defaults to `dim`. */\n color?: NativeColorToken;\n size?: 'small' | 'large';\n style?: StyleProp<ViewStyle>;\n}\n\n/** The platform's own activity indicator in a theme colour; decorative unless it is given a label. */\nexport function Spinner({ label, color = 'dim', size = 'small', style }: SpinnerProps) {\n const { theme } = useUnistyles();\n const indicator = <ActivityIndicator color={theme.colors[color]} size={size} />;\n if (label === undefined) {\n return (\n <View\n style={style}\n accessible={false}\n importantForAccessibility=\"no-hide-descendants\"\n accessibilityElementsHidden\n >\n {indicator}\n </View>\n );\n }\n return (\n <View\n style={style}\n accessible\n accessibilityRole=\"progressbar\"\n accessibilityLabel={label}\n accessibilityLiveRegion=\"polite\"\n accessibilityState={{ busy: true }}\n >\n {indicator}\n </View>\n );\n}\n"],"mappings":";;;;;;;AAkBA,SAAgBS,QAAQ,EAAEJ,OAAOC,QAAQ,OAAOC,OAAO,SAASC,SAAuB;CACrF,MAAM,EAAEE,UAAUP,aAAa;CAC/B,MAAMQ,YAAY,oBAAC,mBAAD;EAAmB,OAAOD,MAAME,OAAON;EAAcC;CAAK;CAC5E,IAAIF,UAAUQ,QACZ,OACE,oBAAC,MAAD;EACSL;EACP,YAAY;EACZ,2BAA0B;EAC1B;YAECG;CACG;CAGV,OACE,oBAAC,MAAD;EACSH;EACP;EACA,mBAAkB;EAClB,oBAAoBH;EACpB,yBAAwB;EACxB,oBAAoB,EAAES,MAAM,KAAK;YAEhCH;CACG;AAEV"}
@@ -0,0 +1,23 @@
1
+ import { NativeColorToken, StatusTone } from "@agimon-ai/po-web-components/nativeTheme";
2
+ import { StyleProp, ViewProps, ViewStyle } from "react-native";
3
+ import { ReactNode } from "react";
4
+ //#region src/components/StatusBadge.d.ts
5
+ type StatusTone$1 = StatusTone;
6
+ export type StatusBadgeSize = 'xs' | 'sm' | 'md' | 'lg';
7
+ /**
8
+ * The border token a card wears for a status, the same tint family as the
9
+ * badge. MessageItem builds its frame from this table, so a card and its badge
10
+ * can never disagree about a tone's edge.
11
+ */
12
+ export declare const STATUS_EDGE: Readonly<Record<StatusTone$1, NativeColorToken>>;
13
+ export interface StatusBadgeProps extends Omit<ViewProps, 'children' | 'style'> {
14
+ tone?: StatusTone$1;
15
+ size?: StatusBadgeSize;
16
+ children?: ReactNode;
17
+ style?: StyleProp<ViewStyle>;
18
+ }
19
+ /** The tinted outcome pill: running, ok, error and their kin. */
20
+ export declare function StatusBadge({ tone, size, children, style, ...props }: StatusBadgeProps): import("react").JSX.Element;
21
+ //#endregion
22
+ export { StatusTone$1 as StatusTone };
23
+ //# sourceMappingURL=StatusBadge.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatusBadge.d.mts","names":["StatusTone","Tone"],"sources":["../../src/components/StatusBadge.tsx"],"mappings":";;;;KASYA,eAAaC;YACb;;;;;;qBAOC,aAAa,SAAS,OAAOD,cAAY;iBASrC,yBAAyB,KAAK;EAC7C,OAAOA;EACP,OAAO;EACP,WAAW;EACX,QAAQ,UAAU;;;wBAIJ,cAAc,MAAkB,MAAa,UAAU,UAAU,SAAS,mCAAgB,IAAA"}
@@ -0,0 +1,116 @@
1
+ import { fontOf } from "../lib/fonts.mjs";
2
+ import { STATUS_COLORS } from "../lib/tone.mjs";
3
+ import { wrapText } from "../lib/wrapText.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
+
8
+ //#region src/components/StatusBadge.tsx
9
+ /**
10
+ * The border token a card wears for a status, the same tint family as the
11
+ * badge. MessageItem builds its frame from this table, so a card and its badge
12
+ * can never disagree about a tone's edge.
13
+ */
14
+ const STATUS_EDGE = {
15
+ neutral: "border",
16
+ running: "edge-yellow",
17
+ ok: "edge-green",
18
+ error: "edge-red",
19
+ info: "edge-blue",
20
+ accent: "edge-magenta"
21
+ };
22
+ /** The tinted outcome pill: running, ok, error and their kin. */
23
+ function StatusBadge({ tone = "neutral", size = "sm", children, style, ...props }) {
24
+ const _styles = styles;
25
+ {
26
+ const styles = _styles.useVariants({
27
+ tone,
28
+ size
29
+ });
30
+ return /* @__PURE__ */ jsx(View, {
31
+ style: [styles.badge, style],
32
+ ...props,
33
+ children: wrapText(children, styles.label)
34
+ });
35
+ }
36
+ }
37
+ const styles = StyleSheet.create((theme) => {
38
+ const fill = (tone) => ({ backgroundColor: theme.colors[STATUS_COLORS[tone].fill] });
39
+ const ink = (tone) => ({ color: theme.colors[STATUS_COLORS[tone].ink] });
40
+ return {
41
+ badge: {
42
+ flexDirection: "row",
43
+ alignItems: "center",
44
+ alignSelf: "flex-start",
45
+ flexShrink: 0,
46
+ gap: theme.spacing(1.5),
47
+ borderRadius: theme.borderRadius.sm,
48
+ variants: {
49
+ tone: {
50
+ neutral: fill("neutral"),
51
+ running: fill("running"),
52
+ ok: fill("ok"),
53
+ error: fill("error"),
54
+ info: fill("info"),
55
+ accent: fill("accent")
56
+ },
57
+ size: {
58
+ xs: {
59
+ paddingHorizontal: theme.spacing(1.5),
60
+ paddingVertical: 1
61
+ },
62
+ sm: {
63
+ paddingHorizontal: 7,
64
+ paddingVertical: 3
65
+ },
66
+ md: {
67
+ height: 21,
68
+ paddingHorizontal: theme.spacing(2)
69
+ },
70
+ lg: {
71
+ height: theme.spacing(6),
72
+ paddingHorizontal: theme.spacing(2.5)
73
+ }
74
+ }
75
+ },
76
+ uni__dependencies: [0, 4]
77
+ },
78
+ label: {
79
+ fontFamily: fontOf(theme.fontFamily.sans),
80
+ fontWeight: theme.fontWeight.semibold,
81
+ variants: {
82
+ tone: {
83
+ neutral: ink("neutral"),
84
+ running: ink("running"),
85
+ ok: ink("ok"),
86
+ error: ink("error"),
87
+ info: ink("info"),
88
+ accent: ink("accent")
89
+ },
90
+ size: {
91
+ xs: {
92
+ fontSize: theme.fontSize.sm,
93
+ lineHeight: theme.lineHeight.sm
94
+ },
95
+ sm: {
96
+ fontSize: theme.fontSize.sm,
97
+ lineHeight: theme.lineHeight.sm
98
+ },
99
+ md: {
100
+ fontSize: theme.fontSize.sm,
101
+ lineHeight: theme.lineHeight.sm
102
+ },
103
+ lg: {
104
+ fontSize: theme.fontSize.base,
105
+ lineHeight: theme.lineHeight.base
106
+ }
107
+ }
108
+ },
109
+ uni__dependencies: [0, 4]
110
+ }
111
+ };
112
+ });
113
+
114
+ //#endregion
115
+ export { STATUS_EDGE, StatusBadge };
116
+ //# sourceMappingURL=StatusBadge.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatusBadge.mjs","names":["NativeColorToken","StatusTone","Tone","ReactNode","StyleProp","ViewProps","ViewStyle","StyleSheet","fontOf","STATUS_COLORS","wrapText","StatusBadgeSize","STATUS_EDGE","Readonly","Record","neutral","running","ok","error","info","accent","StatusBadgeProps","Omit","tone","size","children","style","StatusBadge","props","_styles","styles","useVariants","badge","label","create","theme","fill","backgroundColor","colors","ink","color","flexDirection","alignItems","alignSelf","flexShrink","gap","spacing","borderRadius","sm","variants","xs","paddingHorizontal","paddingVertical","md","height","lg","uni__dependencies","fontFamily","sans","fontWeight","semibold","fontSize","lineHeight","base"],"sources":["../../src/components/StatusBadge.tsx"],"sourcesContent":["import type { NativeColorToken, StatusTone as Tone } from '@agimon-ai/po-web-components/nativeTheme';\nimport type { ReactNode } from 'react';\nimport { type StyleProp, View, type ViewProps, type ViewStyle } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { STATUS_COLORS } from '../lib/tone';\nimport { wrapText } from '../lib/wrapText';\n\nexport type StatusTone = Tone;\nexport type StatusBadgeSize = 'xs' | 'sm' | 'md' | 'lg';\n\n/**\n * The border token a card wears for a status, the same tint family as the\n * badge. MessageItem builds its frame from this table, so a card and its badge\n * can never disagree about a tone's edge.\n */\nexport const STATUS_EDGE: Readonly<Record<StatusTone, NativeColorToken>> = {\n neutral: 'border',\n running: 'edge-yellow',\n ok: 'edge-green',\n error: 'edge-red',\n info: 'edge-blue',\n accent: 'edge-magenta',\n};\n\nexport interface StatusBadgeProps extends Omit<ViewProps, 'children' | 'style'> {\n tone?: StatusTone;\n size?: StatusBadgeSize;\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\n/** The tinted outcome pill: running, ok, error and their kin. */\nexport function StatusBadge({ tone = 'neutral', size = 'sm', children, style, ...props }: StatusBadgeProps) {\n styles.useVariants({ tone, size });\n return (\n <View style={[styles.badge, style]} {...props}>\n {wrapText(children, styles.label)}\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme) => {\n const fill = (tone: StatusTone) => ({ backgroundColor: theme.colors[STATUS_COLORS[tone].fill] });\n const ink = (tone: StatusTone) => ({ color: theme.colors[STATUS_COLORS[tone].ink] });\n return {\n badge: {\n flexDirection: 'row',\n alignItems: 'center',\n alignSelf: 'flex-start',\n flexShrink: 0,\n gap: theme.spacing(1.5),\n borderRadius: theme.borderRadius.sm,\n variants: {\n tone: {\n neutral: fill('neutral'),\n running: fill('running'),\n ok: fill('ok'),\n error: fill('error'),\n info: fill('info'),\n accent: fill('accent'),\n },\n size: {\n xs: { paddingHorizontal: theme.spacing(1.5), paddingVertical: 1 },\n sm: { paddingHorizontal: 7, paddingVertical: 3 },\n md: { height: 21, paddingHorizontal: theme.spacing(2) },\n lg: { height: theme.spacing(6), paddingHorizontal: theme.spacing(2.5) },\n },\n },\n },\n label: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontWeight: theme.fontWeight.semibold,\n variants: {\n tone: {\n neutral: ink('neutral'),\n running: ink('running'),\n ok: ink('ok'),\n error: ink('error'),\n info: ink('info'),\n accent: ink('accent'),\n },\n size: {\n xs: { fontSize: theme.fontSize.sm, lineHeight: theme.lineHeight.sm },\n sm: { fontSize: theme.fontSize.sm, lineHeight: theme.lineHeight.sm },\n md: { fontSize: theme.fontSize.sm, lineHeight: theme.lineHeight.sm },\n lg: { fontSize: theme.fontSize.base, lineHeight: theme.lineHeight.base },\n },\n },\n },\n };\n});\n"],"mappings":";;;;;;;;;;;;;AAiBA,MAAaY,cAA8D;CACzEG,SAAS;CACTC,SAAS;CACTC,IAAI;CACJC,OAAO;CACPC,MAAM;CACNC,QAAQ;AACV;;AAUA,SAAgBO,YAAY,EAAEJ,OAAO,WAAWC,OAAO,MAAMC,UAAUC,OAAO,GAAGE,SAA2B;CAAA,MAAAC,UAAAC;CAAA;EAAA,MAAAA,SAAAD,QAAAE,YACvF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