@agimon-ai/po-native-components 0.0.0-alpha.225 → 0.0.0-alpha.227

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.
@@ -17,14 +17,19 @@ export interface ListProps<T> {
17
17
  empty?: ReactNode;
18
18
  header?: ReactNode;
19
19
  footer?: ReactNode;
20
+ onStartReached?: () => void;
20
21
  onEndReached?: () => void;
22
+ /** Keeps the jump-to-latest button visible when newer pages exist past the loaded window. */
23
+ hasNewer?: boolean;
24
+ /** Called before scrolling to the end when the reader taps jump-to-latest. */
25
+ onJumpToLatest?: () => void;
21
26
  accessibilityLabel?: string;
22
27
  /** The list's frame; give it a height or a flex parent, since a virtualised list needs bounds. */
23
28
  style?: StyleProp<ViewStyle>;
24
29
  /** Padding around the rows. */
25
30
  contentPadding?: number;
26
31
  }
27
- export declare function List<T>({ data, renderItem, keyExtractor, startAtBottom, separators, empty, header, footer, onEndReached, accessibilityLabel, style, contentPadding }: ListProps<T>): import("react").JSX.Element;
32
+ export declare function List<T>({ data, renderItem, keyExtractor, startAtBottom, separators, empty, header, footer, onStartReached, onEndReached, hasNewer, onJumpToLatest, accessibilityLabel, style, contentPadding }: ListProps<T>): import("react").JSX.Element;
28
33
  export interface ListRowProps {
29
34
  title: ReactNode;
30
35
  /** A second, quieter line under the title. */
@@ -1 +1 @@
1
- {"version":3,"file":"List.d.mts","names":[],"sources":["../../src/components/List.tsx"],"mappings":";;;iBAkCiB,UAAU;EACzB,eAAe;EACf,aAAa,MAAM,GAAG,kBAAkB;;EAExC,eAAe,MAAM,GAAG;;;;;EAKxB;;EAEA;;EAEA,QAAQ;EACR,SAAS;EACT,SAAS;EACT;EACA;;EAEA,QAAQ,UAAU;;EAElB;;wBAOc,KAAK,KACnB,MACA,YACA,cACA,eACA,YACA,OACA,QACA,QACA,cACA,oBACA,OACA,kBACC,UAAU,qBAAE,IAAA;iBAuDE;EACf,OAAO;;EAEP,cAAc;;EAEd,UAAU;;EAEV,WAAW;;EAEX;EACA;EACA;;EAEA;EACA;EACA,QAAQ,UAAU;;;wBAIJ,UACd,OACA,aACA,SACA,UACA,UACA,UACA,SACA,YACA,oBACA,SACC,+BAAY,IAAA"}
1
+ {"version":3,"file":"List.d.mts","names":[],"sources":["../../src/components/List.tsx"],"mappings":";;;iBAoCiB,UAAU;EACzB,eAAe;EACf,aAAa,MAAM,GAAG,kBAAkB;;EAExC,eAAe,MAAM,GAAG;;;;;EAKxB;;EAEA;;EAEA,QAAQ;EACR,SAAS;EACT,SAAS;EACT;EACA;;EAEA;;EAEA;EACA;;EAEA,QAAQ,UAAU;;EAElB;;wBAOc,KAAK,KACnB,MACA,YACA,cACA,eACA,YACA,OACA,QACA,QACA,gBACA,cACA,UACA,gBACA,oBACA,OACA,kBACC,UAAU,qBAAE,IAAA;iBAmEE;EACf,OAAO;;EAEP,cAAc;;EAEd,UAAU;;EAEV,WAAW;;EAEX;EACA;EACA;;EAEA;EACA;EACA,QAAQ,UAAU;;;wBAIJ,UACd,OACA,aACA,SACA,UACA,UACA,UACA,SACA,YACA,oBACA,SACC,+BAAY,IAAA"}
@@ -20,10 +20,12 @@ const DISABLED_OPACITY = .4;
20
20
  const PIN_THRESHOLD = .1;
21
21
  /** How far above the bottom, in visible heights, a chat reader must scroll before the jump-to-latest button shows. */
22
22
  const JUMP_THRESHOLD = 1;
23
+ /** How close to the top (in pt) fires `onStartReached`. */
24
+ const START_THRESHOLD = 200;
23
25
  function Separator() {
24
26
  return /* @__PURE__ */ jsx(View, { style: styles.separator });
25
27
  }
26
- function List({ data, renderItem, keyExtractor, startAtBottom = false, separators = true, empty, header, footer, onEndReached, accessibilityLabel, style, contentPadding }) {
28
+ function List({ data, renderItem, keyExtractor, startAtBottom = false, separators = true, empty, header, footer, onStartReached, onEndReached, hasNewer = false, onJumpToLatest, accessibilityLabel, style, contentPadding }) {
27
29
  const t = useT();
28
30
  const renderRow = useCallback(({ item, index }) => renderItem(item, index), [renderItem]);
29
31
  const listRef = useRef(null);
@@ -32,17 +34,21 @@ function List({ data, renderItem, keyExtractor, startAtBottom = false, separator
32
34
  const insideSheet = useInsideSheet();
33
35
  const onScroll = useCallback(({ nativeEvent }) => {
34
36
  const { contentOffset, contentSize, layoutMeasurement } = nativeEvent;
35
- const distance = contentSize.height - layoutMeasurement.height - contentOffset.y;
36
- setAwayFromBottom(distance > layoutMeasurement.height * JUMP_THRESHOLD);
37
- }, []);
37
+ if (startAtBottom) {
38
+ const distance = contentSize.height - layoutMeasurement.height - contentOffset.y;
39
+ setAwayFromBottom(distance > layoutMeasurement.height * JUMP_THRESHOLD);
40
+ }
41
+ if (onStartReached && contentOffset.y <= START_THRESHOLD) onStartReached();
42
+ }, [startAtBottom, onStartReached]);
43
+ const trackScroll = startAtBottom || onStartReached !== void 0;
38
44
  return /* @__PURE__ */ jsxs(View, {
39
45
  style: [styles.frame, style],
40
46
  accessibilityLabel,
41
47
  children: [/* @__PURE__ */ jsx(FlashList, {
42
48
  ref: listRef,
43
49
  renderScrollComponent: insideSheet ? sheetScroll : void 0,
44
- onScroll: startAtBottom ? onScroll : void 0,
45
- scrollEventThrottle: startAtBottom ? 100 : void 0,
50
+ onScroll: trackScroll ? onScroll : void 0,
51
+ scrollEventThrottle: trackScroll ? 100 : void 0,
46
52
  data,
47
53
  renderItem: renderRow,
48
54
  keyExtractor,
@@ -59,11 +65,14 @@ function List({ data, renderItem, keyExtractor, startAtBottom = false, separator
59
65
  startRenderingFromBottom: true,
60
66
  autoscrollToBottomThreshold: PIN_THRESHOLD
61
67
  } : void 0
62
- }), startAtBottom && awayFromBottom ? /* @__PURE__ */ jsx(Button, {
68
+ }), startAtBottom && (awayFromBottom || hasNewer) ? /* @__PURE__ */ jsx(Button, {
63
69
  variant: "subtle",
64
70
  size: "icon-md",
65
71
  accessibilityLabel: t("nativeComponents.list.jumpToLatest", "Jump to latest"),
66
- onPress: () => listRef.current?.scrollToEnd({ animated: true }),
72
+ onPress: () => {
73
+ onJumpToLatest?.();
74
+ listRef.current?.scrollToEnd({ animated: true });
75
+ },
67
76
  style: styles.jump,
68
77
  children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: 18 })
69
78
  }) : null]
@@ -1 +1 @@
1
- {"version":3,"file":"List.mjs","names":["useT","useInsideSheet","useBottomSheetScrollableCreator","FlashList","FlashListRef","ReactElement","ReactNode","useCallback","useRef","useState","NativeScrollEvent","NativeSyntheticEvent","Platform","StyleProp","ViewStyle","StyleSheet","ChevronDownIcon","ChevronRightIcon","fontOf","Button","MIN_ROW_HEIGHT","DISABLED_OPACITY","PIN_THRESHOLD","JUMP_THRESHOLD","ListProps","data","T","renderItem","item","index","keyExtractor","startAtBottom","separators","empty","header","footer","onEndReached","accessibilityLabel","style","contentPadding","Separator","styles","separator","List","t","renderRow","listRef","awayFromBottom","setAwayFromBottom","sheetScroll","insideSheet","onScroll","nativeEvent","contentOffset","contentSize","layoutMeasurement","distance","height","y","frame","undefined","OS","padding","startRenderingFromBottom","autoscrollToBottomThreshold","current","scrollToEnd","animated","jump","ListRowProps","title","description","leading","trailing","selected","disabled","onPress","disclosure","ListRow","chevron","content","text","titleSelected","row","pressed","create","theme","flex","minHeight","position","bottom","spacing","alignSelf","borderRadius","full","borderColor","colors","border","uni__dependencies","hairlineWidth","marginLeft","backgroundColor","flexDirection","alignItems","gap","paddingHorizontal","paddingVertical","panel","opacity","minWidth","color","hi","fontFamily","sans","fontSize","base","lineHeight","fontWeight","medium","green","semibold","faint","sm"],"sources":["../../src/components/List.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport { useInsideSheet } from '@agimon-ai/po-native-components/shell';\nimport { useBottomSheetScrollableCreator } from '@gorhom/bottom-sheet';\nimport { FlashList, type FlashListRef } from '@shopify/flash-list';\nimport { type ReactElement, type ReactNode, useCallback, useRef, useState } from 'react';\nimport {\n type NativeScrollEvent,\n type NativeSyntheticEvent,\n Platform,\n Pressable,\n type StyleProp,\n Text,\n View,\n type ViewStyle,\n} from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { ChevronDownIcon, ChevronRightIcon } from '../icons/icons';\nimport { fontOf } from '../lib/fonts';\nimport { Button } from './Button';\n/*\n * A virtualised list on FlashList: sessions, devices, a transcript. Rows\n * recycle, separators are hairlines, and a chat list can start at the bottom\n * and stay pinned there as rows arrive. The public props are this package's\n * own, so FlashList's types never reach a caller.\n */\n\nconst MIN_ROW_HEIGHT = 44;\nconst DISABLED_OPACITY = 0.4;\n/** How close to the bottom a reader must be for a new row to keep the list pinned, as a fraction of the visible height. */\nconst PIN_THRESHOLD = 0.1;\n/** How far above the bottom, in visible heights, a chat reader must scroll before the jump-to-latest button shows. */\nconst JUMP_THRESHOLD = 1;\n\nexport interface ListProps<T> {\n data: readonly T[];\n renderItem: (item: T, index: number) => ReactElement | null;\n /** A stable key per row; FlashList recycles views by it. */\n keyExtractor: (item: T, index: number) => string;\n /**\n * A chat list: render from the bottom and keep the newest row in view as\n * rows arrive, while the reader is near the bottom.\n */\n startAtBottom?: boolean;\n /** Hairline separators between rows. On by default. */\n separators?: boolean;\n /** Shown when `data` is empty. */\n empty?: ReactNode;\n header?: ReactNode;\n footer?: ReactNode;\n onEndReached?: () => void;\n accessibilityLabel?: string;\n /** The list's frame; give it a height or a flex parent, since a virtualised list needs bounds. */\n style?: StyleProp<ViewStyle>;\n /** Padding around the rows. */\n contentPadding?: number;\n}\n\nfunction Separator() {\n return <View style={styles.separator} />;\n}\n\nexport function List<T>({\n data,\n renderItem,\n keyExtractor,\n startAtBottom = false,\n separators = true,\n empty,\n header,\n footer,\n onEndReached,\n accessibilityLabel,\n style,\n contentPadding,\n}: ListProps<T>) {\n const t = useT();\n const renderRow = useCallback(({ item, index }: { item: T; index: number }) => renderItem(item, index), [renderItem]);\n const listRef = useRef<FlashListRef<T>>(null);\n const [awayFromBottom, setAwayFromBottom] = useState(false);\n // Inside a sheet the rows scroll through Gorhom, so a drag on them scrolls instead of moving the sheet.\n const sheetScroll = useBottomSheetScrollableCreator();\n const insideSheet = useInsideSheet();\n const onScroll = useCallback(({ nativeEvent }: NativeSyntheticEvent<NativeScrollEvent>) => {\n const { contentOffset, contentSize, layoutMeasurement } = nativeEvent;\n const distance = contentSize.height - layoutMeasurement.height - contentOffset.y;\n setAwayFromBottom(distance > layoutMeasurement.height * JUMP_THRESHOLD);\n }, []);\n return (\n <View style={[styles.frame, style]} accessibilityLabel={accessibilityLabel}>\n <FlashList\n ref={listRef}\n renderScrollComponent={insideSheet ? sheetScroll : undefined}\n onScroll={startAtBottom ? onScroll : undefined}\n scrollEventThrottle={startAtBottom ? 100 : undefined}\n data={data}\n renderItem={renderRow}\n keyExtractor={keyExtractor}\n ItemSeparatorComponent={separators ? Separator : null}\n ListEmptyComponent={empty === undefined ? null : <>{empty}</>}\n ListHeaderComponent={header === undefined ? null : <>{header}</>}\n ListFooterComponent={footer === undefined ? null : <>{footer}</>}\n onEndReached={onEndReached}\n // Dragging the rows pulls the keyboard down with the finger, as in Messages.\n keyboardDismissMode={Platform.OS === 'ios' ? 'interactive' : 'on-drag'}\n // A chat's rows are mostly pressable (long-press bubbles, tool groups), so any tap there hides the keyboard\n // first, as in Messages; other lists let a tap on a row land.\n keyboardShouldPersistTaps={startAtBottom ? 'never' : 'handled'}\n // Lets UIKit inset the rows under a translucent or large-title header instead of drawing beneath it.\n contentInsetAdjustmentBehavior=\"automatic\"\n contentContainerStyle={contentPadding === undefined ? undefined : { padding: contentPadding }}\n maintainVisibleContentPosition={\n startAtBottom ? { startRenderingFromBottom: true, autoscrollToBottomThreshold: PIN_THRESHOLD } : undefined\n }\n />\n {startAtBottom && awayFromBottom ? (\n <Button\n variant=\"subtle\"\n size=\"icon-md\"\n accessibilityLabel={t('nativeComponents.list.jumpToLatest', 'Jump to latest')}\n onPress={() => listRef.current?.scrollToEnd({ animated: true })}\n style={styles.jump}\n >\n <ChevronDownIcon size={18} />\n </Button>\n ) : null}\n </View>\n );\n}\n\nexport interface ListRowProps {\n title: ReactNode;\n /** A second, quieter line under the title. */\n description?: ReactNode;\n /** Before the text: a Dot, an icon. */\n leading?: ReactNode;\n /** After the text: a Badge, a ghost button, a count. */\n trailing?: ReactNode;\n /** Selected rows sit on a green tint. */\n selected?: boolean;\n disabled?: boolean;\n onPress?: () => void;\n /** The iOS disclosure chevron. Defaults to on for a pressable row on iOS, where rows that navigate wear one. */\n disclosure?: boolean;\n accessibilityLabel?: string;\n style?: StyleProp<ViewStyle>;\n}\n\n/** One list row: 44pt tall, optional leading and trailing slots, pressable when it navigates. */\nexport function ListRow({\n title,\n description,\n leading,\n trailing,\n selected = false,\n disabled = false,\n onPress,\n disclosure,\n accessibilityLabel,\n style,\n}: ListRowProps) {\n const chevron = disclosure ?? (onPress !== undefined && Platform.OS === 'ios');\n const content = (\n <>\n {leading}\n <View style={styles.text}>\n {typeof title === 'string' ? (\n <Text numberOfLines={1} style={[styles.title, selected && styles.titleSelected]}>\n {title}\n </Text>\n ) : (\n title\n )}\n {typeof description === 'string' ? (\n <Text numberOfLines={2} style={styles.description}>\n {description}\n </Text>\n ) : (\n description\n )}\n </View>\n {trailing}\n {chevron ? <ChevronRightIcon size={14} color=\"faint\" /> : null}\n </>\n );\n if (onPress === undefined) {\n return (\n <View\n accessibilityLabel={accessibilityLabel}\n accessibilityState={{ selected, disabled }}\n style={[styles.row, selected && styles.selected, disabled && styles.disabled, style]}\n >\n {content}\n </View>\n );\n }\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n accessibilityState={{ selected, disabled }}\n disabled={disabled}\n onPress={onPress}\n style={({ pressed }) => [\n styles.row,\n selected && styles.selected,\n pressed && styles.pressed,\n disabled && styles.disabled,\n style,\n ]}\n >\n {content}\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n frame: { flex: 1, minHeight: 0 },\n jump: {\n position: 'absolute',\n bottom: theme.spacing(3),\n alignSelf: 'center',\n borderRadius: theme.borderRadius.full,\n borderColor: theme.colors.border,\n },\n separator: {\n height: StyleSheet.hairlineWidth,\n marginLeft: theme.spacing(4),\n backgroundColor: theme.colors['border-soft'],\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(3),\n minHeight: MIN_ROW_HEIGHT,\n paddingHorizontal: theme.spacing(4),\n paddingVertical: theme.spacing(2),\n },\n selected: { backgroundColor: theme.colors['tint-green'] },\n pressed: { backgroundColor: theme.colors.panel },\n disabled: { opacity: DISABLED_OPACITY },\n text: { flex: 1, minWidth: 0, gap: theme.spacing(0.5) },\n title: {\n color: theme.colors.hi,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n fontWeight: theme.fontWeight.medium,\n },\n titleSelected: { color: theme.colors.green, fontWeight: theme.fontWeight.semibold },\n description: {\n color: theme.colors.faint,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n}));\n"],"mappings":";;;;;;;;;;;;;;;;AA2BA,MAAMoB,iBAAiB;AACvB,MAAMC,mBAAmB;;AAEzB,MAAMC,gBAAgB;;AAEtB,MAAMC,iBAAiB;AA0BvB,SAASiB,YAAY;CACnB,OAAO,oBAAC,MAAD,EAAM,OAAOC,OAAOC,UAAU;AACvC;AAEA,SAAgBC,KAAQ,EACtBlB,MACAE,YACAG,cACAC,gBAAgB,OAChBC,aAAa,MACbC,OACAC,QACAC,QACAC,cACAC,oBACAC,OACAC,kBACe;CACf,MAAMK,IAAI5C,KAAK;CACf,MAAM6C,YAAYtC,aAAa,EAAEqB,MAAMC,YAAwCF,WAAWC,MAAMC,KAAK,GAAG,CAACF,UAAU,CAAC;CACpH,MAAMmB,UAAUtC,OAAwB,IAAI;CAC5C,MAAM,CAACuC,gBAAgBC,qBAAqBvC,SAAS,KAAK;CAE1D,MAAMwC,cAAc/C,gCAAgC;CACpD,MAAMgD,cAAcjD,eAAe;CACnC,MAAMkD,WAAW5C,aAAa,EAAE6C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C;CACAf,KAAK;EACHmB,eAAe;EACfC,YAAY;EACZC,KAAKlB,MAAMK,QAAQ,CAAC;EACpBH,WAAWpE;EACXqF,mBAAmBnB,MAAMK,QAAQ,CAAC;EAClCe,iBAAiBpB,MAAMK,QAAQ,CAAC;EAACO,mBAAA,CAAA,CAAA;CACnC;CACAxB,UAAU;EAAE2B,iBAAiBf,MAAMU,OAAO;EAAaE,mBAAA,CAAA,CAAA;CAAC;CACxDd,SAAS;EAAEiB,iBAAiBf,MAAMU,OAAOW;EAAKT,mBAAA,CAAA,CAAA;CAAC;CAC/CvB,UAAU,EAAEiC,SAASvF,iBAAiB;CACtC4D,MAAM;EAAEM,MAAM;EAAGsB,UAAU;EAAGL,KAAKlB,MAAMK,QAAQ,EAAG;EAACO,mBAAA,CAAA,CAAA;CAAC;CACtD5B,OAAO;EACLwC,OAAOxB,MAAMU,OAAOe;EACpBC,YAAY9F,OAAOoE,MAAM0B,WAAWC,IAAI;EACxCC,UAAU5B,MAAM4B,SAASC;EACzBC,YAAY9B,MAAM8B,WAAWD;EAC7BE,YAAY/B,MAAM+B,WAAWC;EAAMpB,mBAAA,CAAA,CAAA;CACrC;CACAhB,eAAe;EAAE4B,OAAOxB,MAAMU,OAAOuB;EAAOF,YAAY/B,MAAM+B,WAAWG;EAAQtB,mBAAA,CAAA,CAAA;CAAC;CAClF3B,aAAa;EACXuC,OAAOxB,MAAMU,OAAOyB;EACpBT,YAAY9F,OAAOoE,MAAM0B,WAAWC,IAAI;EACxCC,UAAU5B,MAAM4B,SAASQ;EACzBN,YAAY9B,MAAM8B,WAAWM;EAAExB,mBAAA,CAAA,CAAA;CACjC;AACF,EAAE"}
1
+ {"version":3,"file":"List.mjs","names":["useT","useInsideSheet","useBottomSheetScrollableCreator","FlashList","FlashListRef","ReactElement","ReactNode","useCallback","useRef","useState","NativeScrollEvent","NativeSyntheticEvent","Platform","StyleProp","ViewStyle","StyleSheet","ChevronDownIcon","ChevronRightIcon","fontOf","Button","MIN_ROW_HEIGHT","DISABLED_OPACITY","PIN_THRESHOLD","JUMP_THRESHOLD","START_THRESHOLD","ListProps","data","T","renderItem","item","index","keyExtractor","startAtBottom","separators","empty","header","footer","onStartReached","onEndReached","hasNewer","onJumpToLatest","accessibilityLabel","style","contentPadding","Separator","styles","separator","List","t","renderRow","listRef","awayFromBottom","setAwayFromBottom","sheetScroll","insideSheet","onScroll","nativeEvent","contentOffset","contentSize","layoutMeasurement","distance","height","y","trackScroll","undefined","frame","OS","padding","startRenderingFromBottom","autoscrollToBottomThreshold","current","scrollToEnd","animated","jump","ListRowProps","title","description","leading","trailing","selected","disabled","onPress","disclosure","ListRow","chevron","content","text","titleSelected","row","pressed","create","theme","flex","minHeight","position","bottom","spacing","alignSelf","borderRadius","full","borderColor","colors","border","uni__dependencies","hairlineWidth","marginLeft","backgroundColor","flexDirection","alignItems","gap","paddingHorizontal","paddingVertical","panel","opacity","minWidth","color","hi","fontFamily","sans","fontSize","base","lineHeight","fontWeight","medium","green","semibold","faint","sm"],"sources":["../../src/components/List.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport { useInsideSheet } from '@agimon-ai/po-native-components/shell';\nimport { useBottomSheetScrollableCreator } from '@gorhom/bottom-sheet';\nimport { FlashList, type FlashListRef } from '@shopify/flash-list';\nimport { type ReactElement, type ReactNode, useCallback, useRef, useState } from 'react';\nimport {\n type NativeScrollEvent,\n type NativeSyntheticEvent,\n Platform,\n Pressable,\n type StyleProp,\n Text,\n View,\n type ViewStyle,\n} from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { ChevronDownIcon, ChevronRightIcon } from '../icons/icons';\nimport { fontOf } from '../lib/fonts';\nimport { Button } from './Button';\n/*\n * A virtualised list on FlashList: sessions, devices, a transcript. Rows\n * recycle, separators are hairlines, and a chat list can start at the bottom\n * and stay pinned there as rows arrive. The public props are this package's\n * own, so FlashList's types never reach a caller.\n */\n\nconst MIN_ROW_HEIGHT = 44;\nconst DISABLED_OPACITY = 0.4;\n/** How close to the bottom a reader must be for a new row to keep the list pinned, as a fraction of the visible height. */\nconst PIN_THRESHOLD = 0.1;\n/** How far above the bottom, in visible heights, a chat reader must scroll before the jump-to-latest button shows. */\nconst JUMP_THRESHOLD = 1;\n/** How close to the top (in pt) fires `onStartReached`. */\nconst START_THRESHOLD = 200;\n\nexport interface ListProps<T> {\n data: readonly T[];\n renderItem: (item: T, index: number) => ReactElement | null;\n /** A stable key per row; FlashList recycles views by it. */\n keyExtractor: (item: T, index: number) => string;\n /**\n * A chat list: render from the bottom and keep the newest row in view as\n * rows arrive, while the reader is near the bottom.\n */\n startAtBottom?: boolean;\n /** Hairline separators between rows. On by default. */\n separators?: boolean;\n /** Shown when `data` is empty. */\n empty?: ReactNode;\n header?: ReactNode;\n footer?: ReactNode;\n onStartReached?: () => void;\n onEndReached?: () => void;\n /** Keeps the jump-to-latest button visible when newer pages exist past the loaded window. */\n hasNewer?: boolean;\n /** Called before scrolling to the end when the reader taps jump-to-latest. */\n onJumpToLatest?: () => void;\n accessibilityLabel?: string;\n /** The list's frame; give it a height or a flex parent, since a virtualised list needs bounds. */\n style?: StyleProp<ViewStyle>;\n /** Padding around the rows. */\n contentPadding?: number;\n}\n\nfunction Separator() {\n return <View style={styles.separator} />;\n}\n\nexport function List<T>({\n data,\n renderItem,\n keyExtractor,\n startAtBottom = false,\n separators = true,\n empty,\n header,\n footer,\n onStartReached,\n onEndReached,\n hasNewer = false,\n onJumpToLatest,\n accessibilityLabel,\n style,\n contentPadding,\n}: ListProps<T>) {\n const t = useT();\n const renderRow = useCallback(({ item, index }: { item: T; index: number }) => renderItem(item, index), [renderItem]);\n const listRef = useRef<FlashListRef<T>>(null);\n const [awayFromBottom, setAwayFromBottom] = useState(false);\n // Inside a sheet the rows scroll through Gorhom, so a drag on them scrolls instead of moving the sheet.\n const sheetScroll = useBottomSheetScrollableCreator();\n const insideSheet = useInsideSheet();\n const onScroll = useCallback(\n ({ nativeEvent }: NativeSyntheticEvent<NativeScrollEvent>) => {\n const { contentOffset, contentSize, layoutMeasurement } = nativeEvent;\n if (startAtBottom) {\n const distance = contentSize.height - layoutMeasurement.height - contentOffset.y;\n setAwayFromBottom(distance > layoutMeasurement.height * JUMP_THRESHOLD);\n }\n if (onStartReached && contentOffset.y <= START_THRESHOLD) {\n onStartReached();\n }\n },\n [startAtBottom, onStartReached],\n );\n const trackScroll = startAtBottom || onStartReached !== undefined;\n return (\n <View style={[styles.frame, style]} accessibilityLabel={accessibilityLabel}>\n <FlashList\n ref={listRef}\n renderScrollComponent={insideSheet ? sheetScroll : undefined}\n onScroll={trackScroll ? onScroll : undefined}\n scrollEventThrottle={trackScroll ? 100 : undefined}\n data={data}\n renderItem={renderRow}\n keyExtractor={keyExtractor}\n ItemSeparatorComponent={separators ? Separator : null}\n ListEmptyComponent={empty === undefined ? null : <>{empty}</>}\n ListHeaderComponent={header === undefined ? null : <>{header}</>}\n ListFooterComponent={footer === undefined ? null : <>{footer}</>}\n onEndReached={onEndReached}\n // Dragging the rows pulls the keyboard down with the finger, as in Messages.\n keyboardDismissMode={Platform.OS === 'ios' ? 'interactive' : 'on-drag'}\n // A chat's rows are mostly pressable (long-press bubbles, tool groups), so any tap there hides the keyboard\n // first, as in Messages; other lists let a tap on a row land.\n keyboardShouldPersistTaps={startAtBottom ? 'never' : 'handled'}\n // Lets UIKit inset the rows under a translucent or large-title header instead of drawing beneath it.\n contentInsetAdjustmentBehavior=\"automatic\"\n contentContainerStyle={contentPadding === undefined ? undefined : { padding: contentPadding }}\n maintainVisibleContentPosition={\n startAtBottom ? { startRenderingFromBottom: true, autoscrollToBottomThreshold: PIN_THRESHOLD } : undefined\n }\n />\n {startAtBottom && (awayFromBottom || hasNewer) ? (\n <Button\n variant=\"subtle\"\n size=\"icon-md\"\n accessibilityLabel={t('nativeComponents.list.jumpToLatest', 'Jump to latest')}\n onPress={() => {\n onJumpToLatest?.();\n listRef.current?.scrollToEnd({ animated: true });\n }}\n style={styles.jump}\n >\n <ChevronDownIcon size={18} />\n </Button>\n ) : null}\n </View>\n );\n}\n\nexport interface ListRowProps {\n title: ReactNode;\n /** A second, quieter line under the title. */\n description?: ReactNode;\n /** Before the text: a Dot, an icon. */\n leading?: ReactNode;\n /** After the text: a Badge, a ghost button, a count. */\n trailing?: ReactNode;\n /** Selected rows sit on a green tint. */\n selected?: boolean;\n disabled?: boolean;\n onPress?: () => void;\n /** The iOS disclosure chevron. Defaults to on for a pressable row on iOS, where rows that navigate wear one. */\n disclosure?: boolean;\n accessibilityLabel?: string;\n style?: StyleProp<ViewStyle>;\n}\n\n/** One list row: 44pt tall, optional leading and trailing slots, pressable when it navigates. */\nexport function ListRow({\n title,\n description,\n leading,\n trailing,\n selected = false,\n disabled = false,\n onPress,\n disclosure,\n accessibilityLabel,\n style,\n}: ListRowProps) {\n const chevron = disclosure ?? (onPress !== undefined && Platform.OS === 'ios');\n const content = (\n <>\n {leading}\n <View style={styles.text}>\n {typeof title === 'string' ? (\n <Text numberOfLines={1} style={[styles.title, selected && styles.titleSelected]}>\n {title}\n </Text>\n ) : (\n title\n )}\n {typeof description === 'string' ? (\n <Text numberOfLines={2} style={styles.description}>\n {description}\n </Text>\n ) : (\n description\n )}\n </View>\n {trailing}\n {chevron ? <ChevronRightIcon size={14} color=\"faint\" /> : null}\n </>\n );\n if (onPress === undefined) {\n return (\n <View\n accessibilityLabel={accessibilityLabel}\n accessibilityState={{ selected, disabled }}\n style={[styles.row, selected && styles.selected, disabled && styles.disabled, style]}\n >\n {content}\n </View>\n );\n }\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n accessibilityState={{ selected, disabled }}\n disabled={disabled}\n onPress={onPress}\n style={({ pressed }) => [\n styles.row,\n selected && styles.selected,\n pressed && styles.pressed,\n disabled && styles.disabled,\n style,\n ]}\n >\n {content}\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n frame: { flex: 1, minHeight: 0 },\n jump: {\n position: 'absolute',\n bottom: theme.spacing(3),\n alignSelf: 'center',\n borderRadius: theme.borderRadius.full,\n borderColor: theme.colors.border,\n },\n separator: {\n height: StyleSheet.hairlineWidth,\n marginLeft: theme.spacing(4),\n backgroundColor: theme.colors['border-soft'],\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(3),\n minHeight: MIN_ROW_HEIGHT,\n paddingHorizontal: theme.spacing(4),\n paddingVertical: theme.spacing(2),\n },\n selected: { backgroundColor: theme.colors['tint-green'] },\n pressed: { backgroundColor: theme.colors.panel },\n disabled: { opacity: DISABLED_OPACITY },\n text: { flex: 1, minWidth: 0, gap: theme.spacing(0.5) },\n title: {\n color: theme.colors.hi,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n fontWeight: theme.fontWeight.medium,\n },\n titleSelected: { color: theme.colors.green, fontWeight: theme.fontWeight.semibold },\n description: {\n color: theme.colors.faint,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n}));\n"],"mappings":";;;;;;;;;;;;;;;;AA2BA,MAAMoB,iBAAiB;AACvB,MAAMC,mBAAmB;;AAEzB,MAAMC,gBAAgB;;AAEtB,MAAMC,iBAAiB;;AAEvB,MAAMC,kBAAkB;AA+BxB,SAASoB,YAAY;CACnB,OAAO,oBAAC,MAAD,EAAM,OAAOC,OAAOC,UAAU;AACvC;AAEA,SAAgBC,KAAQ,EACtBrB,MACAE,YACAG,cACAC,gBAAgB,OAChBC,aAAa,MACbC,OACAC,QACAC,QACAC,gBACAC,cACAC,WAAW,OACXC,gBACAC,oBACAC,OACAC,kBACe;CACf,MAAMK,IAAIhD,KAAK;CACf,MAAMiD,YAAY1C,aAAa,EAAEsB,MAAMC,YAAwCF,WAAWC,MAAMC,KAAK,GAAG,CAACF,UAAU,CAAC;CACpH,MAAMsB,UAAU1C,OAAwB,IAAI;CAC5C,MAAM,CAAC2C,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AM4B,SAASQ;EACzBN,YAAY9B,MAAM8B,WAAWM;EAAExB,mBAAA,CAAA,CAAA;CACjC;AACF,EAAE"}
@@ -23,6 +23,10 @@ export interface SheetContentProps {
23
23
  scrollable?: boolean;
24
24
  /** The sheet holds unsaved work: a prompt arriving in the conversation leaves it open with a note. */
25
25
  keep?: boolean;
26
+ /** False prevents swipe-down and backdrop close, routing backdrop tap and Android Back to onCloseAttempt. */
27
+ dismissible?: boolean;
28
+ /** Runs when the person attempts to dismiss via backdrop tap or Android Back while dismissible is false. */
29
+ onCloseAttempt?: () => void;
26
30
  /** Runs after the native modal is dismissed, including a caller-initiated close. */
27
31
  onDismiss?: () => void;
28
32
  /** Fixed heights such as `['58%']`; given, the sheet stops sizing itself to its content. */
@@ -33,7 +37,7 @@ export interface SheetContentProps {
33
37
  background?: NativeColorToken;
34
38
  }
35
39
  /** The sheet surface. Fields inside it switch to the sheet's own input so the keyboard lifts the sheet. */
36
- export declare function SheetContent({ children, scrollable, footer, keep, onDismiss, snapPoints, backdrop, background }: SheetContentProps): import("react").JSX.Element;
40
+ export declare function SheetContent({ children, scrollable, footer, keep, dismissible, onCloseAttempt, onDismiss, snapPoints, backdrop, background }: SheetContentProps): import("react").JSX.Element;
37
41
  export interface SheetPartProps extends Omit<ViewProps, 'children' | 'style'> {
38
42
  children?: ReactNode;
39
43
  style?: StyleProp<ViewStyle>;
@@ -1 +1 @@
1
- {"version":3,"file":"Sheet.d.mts","names":[],"sources":["../../src/components/Sheet.tsx"],"mappings":";;;;;iBA0BiB;;EAEf;EACA;EACA,gBAAgB;EAChB,WAAW;;wBAGG,QAAQ,MAAM,aAAqB,cAAc,YAAY,6BAAU,IAAA;;wBAOvE,eAAe,YAAY,SAAS,8BAAW,IAAA;;wBAc/C,aAAa,YAAY,SAAS,8BAAW,IAAA;iBAa5C;EACf,WAAW;;EAEX,SAAS;;EAET;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,aAAa;;;wBAIC,eACd,UACA,YACA,QACA,MACA,WACA,YACA,UACA,cACC,oCAAiB,IAAA;iBAyBH,uBAAuB,KAAK;EAC3C,WAAW;EACX,QAAQ,UAAU;;iBAGH,yBAAyB;;EAExC;;EAEA;;wBAGc,cACd,aACA,YAAY,gBACZ,OACA,aACG,SACF,mCAAgB,IAAA;wBAsBH,aAAa,UAAU,SAAS,4BAAS,IAAA;wBAKzC,mBAAmB,UAAU,SAAS,4BAAS,IAAA;;wBAK/C,YAAY,OAAO,aAAa,SAAS,iCAAc,IAAA;wBAQvD,cAAc,OAAO,aAAa,SAAS,iCAAc,IAAA"}
1
+ {"version":3,"file":"Sheet.d.mts","names":[],"sources":["../../src/components/Sheet.tsx"],"mappings":";;;;;iBA0BiB;;EAEf;EACA;EACA,gBAAgB;EAChB,WAAW;;wBAGG,QAAQ,MAAM,aAAqB,cAAc,YAAY,6BAAU,IAAA;;wBAOvE,eAAe,YAAY,SAAS,8BAAW,IAAA;;wBAc/C,aAAa,YAAY,SAAS,8BAAW,IAAA;iBAa5C;EACf,WAAW;;EAEX,SAAS;;EAET;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,aAAa;;;wBAIC,eACd,UACA,YACA,QACA,MACA,aACA,gBACA,WACA,YACA,UACA,cACC,oCAAiB,IAAA;iBA2BH,uBAAuB,KAAK;EAC3C,WAAW;EACX,QAAQ,UAAU;;iBAGH,yBAAyB;;EAExC;;EAEA;;wBAGc,cACd,aACA,YAAY,gBACZ,OACA,aACG,SACF,mCAAgB,IAAA;wBAsBH,aAAa,UAAU,SAAS,4BAAS,IAAA;wBAKzC,mBAAmB,UAAU,SAAS,4BAAS,IAAA;;wBAK/C,YAAY,OAAO,aAAa,SAAS,iCAAc,IAAA;wBAQvD,cAAc,OAAO,aAAa,SAAS,iCAAc,IAAA"}
@@ -50,7 +50,7 @@ function SheetClose({ onPress, ...props }) {
50
50
  });
51
51
  }
52
52
  /** The sheet surface. Fields inside it switch to the sheet's own input so the keyboard lifts the sheet. */
53
- function SheetContent({ children, scrollable = true, footer, keep, onDismiss, snapPoints, backdrop, background }) {
53
+ function SheetContent({ children, scrollable = true, footer, keep, dismissible, onCloseAttempt, onDismiss, snapPoints, backdrop, background }) {
54
54
  const { open, setOpen } = useContext(SheetContext);
55
55
  const value = useMemo(() => ({
56
56
  open,
@@ -66,6 +66,8 @@ function SheetContent({ children, scrollable = true, footer, keep, onDismiss, sn
66
66
  onClose: close,
67
67
  scrollable,
68
68
  keep,
69
+ dismissible,
70
+ onCloseAttempt,
69
71
  onDismiss,
70
72
  snapPoints,
71
73
  backdrop,
@@ -1 +1 @@
1
- {"version":3,"file":"Sheet.mjs","names":["useT","NativeColorToken","createContext","ReactNode","useCallback","useContext","useMemo","StyleProp","TextProps","ViewProps","ViewStyle","StyleSheet","CloseIcon","fontOf","useControllable","wrapText","Button","ButtonProps","SheetFrame","SheetState","open","setOpen","SheetContext","undefined","SheetProps","defaultOpen","onOpenChange","children","Sheet","current","value","SheetTrigger","onPress","props","event","SheetClose","SheetContentProps","footer","scrollable","keep","onDismiss","snapPoints","backdrop","background","SheetContent","close","pinned","SheetPartProps","Omit","style","SheetHeaderProps","dismissible","closeLabel","SheetHeader","closeLabelProp","t","styles","header","SheetTitle","title","SheetDescription","description","SheetBody","body","SheetFooter","hint","create","theme","flexDirection","alignItems","gap","spacing","minWidth","minHeight","paddingVertical","borderBottomWidth","borderBottomColor","colors","border","paddingHorizontal","uni__dependencies","marginLeft","flexShrink","color","hi","fontFamily","sans","fontSize","lg","lineHeight","fontWeight","semibold","dim","sm","lineHeightRelaxed","flexWrap","justifyContent","borderTopWidth","borderTopColor","backgroundColor","deep","faint"],"sources":["../../src/components/Sheet.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport type { NativeColorToken } from '@agimon-ai/po-web-components/nativeTheme';\nimport { createContext, type ReactNode, useCallback, useContext, useMemo } 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\nexport const 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 const value = useMemo(() => ({ open: current, setOpen }), [current, setOpen]);\n return <SheetContext.Provider value={value}>{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 /** Pinned actions outside the scrolling body. The footer carries the bottom safe area. */\n footer?: ReactNode;\n /** False when an embedded SheetList owns vertical scrolling. */\n scrollable?: boolean;\n /** The sheet holds unsaved work: a prompt arriving in the conversation leaves it open with a note. */\n keep?: boolean;\n /** Runs after the native modal is dismissed, including a caller-initiated close. */\n onDismiss?: () => void;\n /** Fixed heights such as `['58%']`; given, the sheet stops sizing itself to its content. */\n snapPoints?: (string | number)[];\n /** The dimmed overlay that closes the sheet on tap. Off leaves what is behind visible and usable. */\n backdrop?: boolean;\n /** The sheet and footer surface colour. */\n background?: NativeColorToken;\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({\n children,\n scrollable = true,\n footer,\n keep,\n onDismiss,\n snapPoints,\n backdrop,\n background,\n}: SheetContentProps) {\n const { open, setOpen } = useContext(SheetContext);\n const value = useMemo(() => ({ open, setOpen }), [open, setOpen]);\n const close = useCallback(() => setOpen(false), [setOpen]);\n const pinned = useMemo(\n () => (footer === undefined ? undefined : <SheetContext.Provider value={value}>{footer}</SheetContext.Provider>),\n [footer, value],\n );\n return (\n <SheetFrame\n open={open}\n onClose={close}\n scrollable={scrollable}\n keep={keep}\n onDismiss={onDismiss}\n snapPoints={snapPoints}\n backdrop={backdrop}\n background={background}\n {...(pinned === undefined ? {} : { footer: pinned })}\n >\n <SheetContext.Provider value={value}>{children}</SheetContext.Provider>\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({\n dismissible = true,\n closeLabel: closeLabelProp,\n style,\n children,\n ...props\n}: SheetHeaderProps) {\n const t = useT();\n const closeLabel = closeLabelProp ?? t('nativeComponents.dialog.close', 'close');\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 // No line cap: a title at a large Dynamic Type size wraps instead of truncating.\n return <Text accessibilityRole=\"header\" 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 // minHeight, not height: a title and description at a large Dynamic Type size push the strip taller.\n minHeight: theme.spacing(11),\n paddingVertical: theme.spacing(1.5),\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":";;;;;;;;;;;;;;AAwBA,MAAasB,eAAepB,cAA0B;CAAEkB,MAAM;CAAOC,eAAeE;AAAU,CAAC;AAU/F,SAAgBK,MAAM,EAAER,MAAMK,cAAc,OAAOC,cAAcC,YAAwB;CACvF,MAAM,CAACE,SAASR,WAAWP,gBAAgBM,MAAMK,aAAaC,YAAY;CAC1E,MAAMI,QAAQxB,eAAe;EAAEc,MAAMS;EAASR;CAAQ,IAAI,CAACQ,SAASR,OAAO,CAAC;CAC5E,OAAO,oBAAC,aAAa,UAAd;EAA8BS;EAAQH;CAAgC;AAC/E;;AAGA,SAAgBI,aAAa,EAAEC,SAAS,GAAGC,SAAsB;CAC/D,MAAM,EAAEZ,YAAYhB,WAAWiB,YAAY;CAC3C,OACE,oBAAC,QAAD;EACE,UAAUY,UAAU;GAClBF,UAAUE,KAAK;GACfb,QAAQ,IAAI;EACd;EACA,GAAIY;CAAM;AAGhB;;AAGA,SAAgBE,WAAW,EAAEH,SAAS,GAAGC,SAAsB;CAC7D,MAAM,EAAEZ,YAAYhB,WAAWiB,YAAY;CAC3C,OACE,oBAAC,QAAD;EACE,UAAUY,UAAU;GAClBF,UAAUE,KAAK;GACfb,QAAQ,KAAK;EACf;EACA,GAAIY;CAAM;AAGhB;;AAqBA,SAAgBW,aAAa,EAC3BjB,UACAW,aAAa,MACbD,QACAE,MACAC,WACAC,YACAC,UACAC,cACoB;CACpB,MAAM,EAAEvB,MAAMC,YAAYhB,WAAWiB,YAAY;CACjD,MAAMQ,QAAQxB,eAAe;EAAEc;EAAMC;CAAQ,IAAI,CAACD,MAAMC,OAAO,CAAC;CAChE,MAAMwB,QAAQzC,kBAAkBiB,QAAQ,KAAK,GAAG,CAACA,OAAO,CAAC;CACzD,MAAMyB,SAASxC,cACN+B,WAAWd,SAAYA,SA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C;EACpBE,WAAW;EACXwB,gBAAgB;EAChBC,gBAAgB/B,MAAMU,OAAO;EAC7BsB,iBAAiBhC,MAAMU,OAAOuB;EAC9BrB,mBAAmBZ,MAAMI,QAAQ,CAAC;EAClCG,iBAAiBP,MAAMI,QAAQ,GAAG;EAACS,mBAAA,CAAA,CAAA;CACrC;CACAf,MAAM;EACJkB,OAAOhB,MAAMU,OAAOwB;EACpBhB,YAAYxE,OAAOsD,MAAMkB,WAAWC,IAAI;EACxCC,UAAUpB,MAAMoB,SAAS;EACzBE,YAAYtB,MAAMsB,WAAW;EAAMT,mBAAA,CAAA,CAAA;CACrC;AACF,EAAE"}
1
+ {"version":3,"file":"Sheet.mjs","names":["useT","NativeColorToken","createContext","ReactNode","useCallback","useContext","useMemo","StyleProp","TextProps","ViewProps","ViewStyle","StyleSheet","CloseIcon","fontOf","useControllable","wrapText","Button","ButtonProps","SheetFrame","SheetState","open","setOpen","SheetContext","undefined","SheetProps","defaultOpen","onOpenChange","children","Sheet","current","value","SheetTrigger","onPress","props","event","SheetClose","SheetContentProps","footer","scrollable","keep","dismissible","onCloseAttempt","onDismiss","snapPoints","backdrop","background","SheetContent","close","pinned","SheetPartProps","Omit","style","SheetHeaderProps","closeLabel","SheetHeader","closeLabelProp","t","styles","header","SheetTitle","title","SheetDescription","description","SheetBody","body","SheetFooter","hint","create","theme","flexDirection","alignItems","gap","spacing","minWidth","minHeight","paddingVertical","borderBottomWidth","borderBottomColor","colors","border","paddingHorizontal","uni__dependencies","marginLeft","flexShrink","color","hi","fontFamily","sans","fontSize","lg","lineHeight","fontWeight","semibold","dim","sm","lineHeightRelaxed","flexWrap","justifyContent","borderTopWidth","borderTopColor","backgroundColor","deep","faint"],"sources":["../../src/components/Sheet.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport type { NativeColorToken } from '@agimon-ai/po-web-components/nativeTheme';\nimport { createContext, type ReactNode, useCallback, useContext, useMemo } 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\nexport const 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 const value = useMemo(() => ({ open: current, setOpen }), [current, setOpen]);\n return <SheetContext.Provider value={value}>{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 /** Pinned actions outside the scrolling body. The footer carries the bottom safe area. */\n footer?: ReactNode;\n /** False when an embedded SheetList owns vertical scrolling. */\n scrollable?: boolean;\n /** The sheet holds unsaved work: a prompt arriving in the conversation leaves it open with a note. */\n keep?: boolean;\n /** False prevents swipe-down and backdrop close, routing backdrop tap and Android Back to onCloseAttempt. */\n dismissible?: boolean;\n /** Runs when the person attempts to dismiss via backdrop tap or Android Back while dismissible is false. */\n onCloseAttempt?: () => void;\n /** Runs after the native modal is dismissed, including a caller-initiated close. */\n onDismiss?: () => void;\n /** Fixed heights such as `['58%']`; given, the sheet stops sizing itself to its content. */\n snapPoints?: (string | number)[];\n /** The dimmed overlay that closes the sheet on tap. Off leaves what is behind visible and usable. */\n backdrop?: boolean;\n /** The sheet and footer surface colour. */\n background?: NativeColorToken;\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({\n children,\n scrollable = true,\n footer,\n keep,\n dismissible,\n onCloseAttempt,\n onDismiss,\n snapPoints,\n backdrop,\n background,\n}: SheetContentProps) {\n const { open, setOpen } = useContext(SheetContext);\n const value = useMemo(() => ({ open, setOpen }), [open, setOpen]);\n const close = useCallback(() => setOpen(false), [setOpen]);\n const pinned = useMemo(\n () => (footer === undefined ? undefined : <SheetContext.Provider value={value}>{footer}</SheetContext.Provider>),\n [footer, value],\n );\n return (\n <SheetFrame\n open={open}\n onClose={close}\n scrollable={scrollable}\n keep={keep}\n dismissible={dismissible}\n onCloseAttempt={onCloseAttempt}\n onDismiss={onDismiss}\n snapPoints={snapPoints}\n backdrop={backdrop}\n background={background}\n {...(pinned === undefined ? {} : { footer: pinned })}\n >\n <SheetContext.Provider value={value}>{children}</SheetContext.Provider>\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({\n dismissible = true,\n closeLabel: closeLabelProp,\n style,\n children,\n ...props\n}: SheetHeaderProps) {\n const t = useT();\n const closeLabel = closeLabelProp ?? t('nativeComponents.dialog.close', 'close');\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 // No line cap: a title at a large Dynamic Type size wraps instead of truncating.\n return <Text accessibilityRole=\"header\" 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 // minHeight, not height: a title and description at a large Dynamic Type size push the strip taller.\n minHeight: theme.spacing(11),\n paddingVertical: theme.spacing(1.5),\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":";;;;;;;;;;;;;;AAwBA,MAAasB,eAAepB,cAA0B;CAAEkB,MAAM;CAAOC,eAAeE;AAAU,CAAC;AAU/F,SAAgBK,MAAM,EAAER,MAAMK,cAAc,OAAOC,cAAcC,YAAwB;CACvF,MAAM,CAACE,SAASR,WAAWP,gBAAgBM,MAAMK,aAAaC,YAAY;CAC1E,MAAMI,QAAQxB,eAAe;EAAEc,MAAMS;EAASR;CAAQ,IAAI,CAACQ,SAASR,OAAO,CAAC;CAC5E,OAAO,oBAAC,aAAa,UAAd;EAA8BS;EAAQH;CAAgC;AAC/E;;AAGA,SAAgBI,aAAa,EAAEC,SAAS,GAAGC,SAAsB;CAC/D,MAAM,EAAEZ,YAAYhB,WAAWiB,YAAY;CAC3C,OACE,oBAAC,QAAD;EACE,UAAUY,UAAU;GAClBF,UAAUE,KAAK;GACfb,QAAQ,IAAI;EACd;EACA,GAAIY;CAAM;AAGhB;;AAGA,SAAgBE,WAAW,EAAEH,SAAS,GAAGC,SAAsB;CAC7D,MAAM,EAAEZ,YAAYhB,WAAWiB,YAAY;CAC3C,OACE,oBAAC,QAAD;EACE,UAAUY,UAAU;GAClBF,UAAUE,KAAK;GACfb,QAAQ,KAAK;EACf;EACA,GAAIY;CAAM;AAGhB;;AAyBA,SAAgBa,aAAa,EAC3BnB,UACAW,aAAa,MACbD,QACAE,MACAC,aACAC,gBACAC,WACAC,YACAC,UACAC,cACoB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CACxC;CACAjB,MAAM;EACJO,KAAKH,MAAMI,QAAQ,CAAC;EACpBQ,mBAAmBZ,MAAMI,QAAQ,CAAC;EAClCG,iBAAiBP,MAAMI,QAAQ,CAAC;EAACS,mBAAA,CAAA,CAAA;CACnC;CACA5C,QAAQ;EACNgC,eAAe;EACf2B,UAAU;EACV1B,YAAY;EACZ2B,gBAAgB;EAChB1B,KAAKH,MAAMI,QAAQ,CAAC;EACpBE,WAAW;EACXwB,gBAAgB;EAChBC,gBAAgB/B,MAAMU,OAAO;EAC7BsB,iBAAiBhC,MAAMU,OAAOuB;EAC9BrB,mBAAmBZ,MAAMI,QAAQ,CAAC;EAClCG,iBAAiBP,MAAMI,QAAQ,GAAG;EAACS,mBAAA,CAAA,CAAA;CACrC;CACAf,MAAM;EACJkB,OAAOhB,MAAMU,OAAOwB;EACpBhB,YAAYzE,OAAOuD,MAAMkB,WAAWC,IAAI;EACxCC,UAAUpB,MAAMoB,SAAS;EACzBE,YAAYtB,MAAMsB,WAAW;EAAMT,mBAAA,CAAA,CAAA;CACrC;AACF,EAAE"}
@@ -42,7 +42,7 @@ function FooterBody({ holder }) {
42
42
  * back, clear of the safe area and lifted by the keyboard. Private: the public
43
43
  * parts keep bottom-sheet types out of the package API.
44
44
  */
45
- function SheetFrame({ open, onClose, onDismiss, children, scrollable = true, footer, keep = false, snapPoints, backdrop = true, background = "rail" }) {
45
+ function SheetFrame({ open, onClose, onDismiss, children, scrollable = true, footer, keep = false, dismissible = true, onCloseAttempt, snapPoints, backdrop = true, background = "rail" }) {
46
46
  const { theme } = useUnistyles();
47
47
  const insets = useContext(SafeAreaInsetsContext);
48
48
  const sheet = useRef(null);
@@ -53,12 +53,16 @@ function SheetFrame({ open, onClose, onDismiss, children, scrollable = true, foo
53
53
  const [note, setNote] = useState();
54
54
  const latest = useRef({
55
55
  keep,
56
+ dismissible,
56
57
  onClose,
58
+ onCloseAttempt,
57
59
  onDismiss
58
60
  });
59
61
  latest.current = {
60
62
  keep,
63
+ dismissible,
61
64
  onClose,
65
+ onCloseAttempt,
62
66
  onDismiss
63
67
  };
64
68
  const entry = useRef({
@@ -94,7 +98,8 @@ function SheetFrame({ open, onClose, onDismiss, children, scrollable = true, foo
94
98
  useEffect(() => {
95
99
  if (!open) return void 0;
96
100
  const subscription = BackHandler.addEventListener("hardwareBackPress", () => {
97
- latest.current.onClose();
101
+ if (latest.current.dismissible) latest.current.onClose();
102
+ else latest.current.onCloseAttempt?.();
98
103
  return true;
99
104
  });
100
105
  return () => subscription.remove();
@@ -105,9 +110,10 @@ function SheetFrame({ open, onClose, onDismiss, children, scrollable = true, foo
105
110
  appearsOnIndex: 0,
106
111
  disappearsOnIndex: -1,
107
112
  opacity: 1,
108
- pressBehavior: "close",
113
+ pressBehavior: dismissible ? "close" : "none",
114
+ ...dismissible ? {} : { onPress: () => latest.current.onCloseAttempt?.() },
109
115
  style: [props.style, { backgroundColor: backdropColor }]
110
- }), [backdropColor]);
116
+ }), [backdropColor, dismissible]);
111
117
  const footerInset = insets?.bottom ?? 0;
112
118
  const surface = theme.colors[background];
113
119
  const renderFooter = useCallback((props) => /* @__PURE__ */ jsx(BottomSheetFooter, {
@@ -151,7 +157,7 @@ function SheetFrame({ open, onClose, onDismiss, children, scrollable = true, foo
151
157
  ref: sheet,
152
158
  accessible: false,
153
159
  stackBehavior: "push",
154
- enablePanDownToClose: true,
160
+ enablePanDownToClose: dismissible,
155
161
  topInset: insets?.top ?? 0,
156
162
  keyboardBehavior: "interactive",
157
163
  keyboardBlurBehavior: "restore",
@@ -1 +1 @@
1
- {"version":3,"file":"SheetFrame.mjs","names":["dismissSheet","InsideSheetContext","OpenSheet","registerSheet","unregisterSheet","NativeColorToken","withAlpha","BottomSheetBackdrop","BottomSheetBackdropProps","BottomSheetModal","BottomSheetFooter","BottomSheetFooterProps","BottomSheetScrollView","ReactNode","useCallback","useContext","useEffect","useLayoutEffect","useMemo","useRef","useState","useSyncExternalStore","BackHandler","Keyboard","SafeAreaInsetsContext","StyleSheet","useUnistyles","fontOf","BACKDROP_ALPHA_PERCENT","SheetFrameProps","open","onClose","onDismiss","children","footer","scrollable","keep","snapPoints","backdrop","background","sheetsYielded","yieldSheets","FooterHolder","get","set","subscribe","listener","footerHolder","initial","listeners","Set","next","add","delete","FooterBody","holder","SheetFrame","theme","insets","sheet","openRef","presented","dismissing","footerHeight","setFooterHeight","note","setNote","latest","current","entry","close","footers","undefined","dismiss","present","subscription","addEventListener","remove","backdropColor","colors","deep","renderBackdrop","props","style","backgroundColor","footerInset","bottom","surface","renderFooter","event","nativeEvent","layout","height","paddingBottom","backgroundStyle","borderRadius","lg","handleIndicatorStyle","border","onChange","index","onSheetDismiss","reopen","top","backdropComponent","enableDynamicSizing","footerComponent","styles","content","SheetNote","create","flexGrow","marginHorizontal","spacing","marginBottom","color","magenta","fontFamily","sans","fontSize","sm","lineHeight","uni__dependencies"],"sources":["../../src/components/SheetFrame.tsx"],"sourcesContent":["import {\n dismissSheet,\n InsideSheetContext,\n type OpenSheet,\n registerSheet,\n unregisterSheet,\n} from '@agimon-ai/po-native-components/shell';\nimport { type NativeColorToken, withAlpha } from '@agimon-ai/po-web-components/nativeTheme';\nimport {\n BottomSheetBackdrop,\n type BottomSheetBackdropProps,\n BottomSheetModal,\n BottomSheetFooter,\n type BottomSheetFooterProps,\n BottomSheetScrollView,\n} from '@gorhom/bottom-sheet';\nimport {\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n} from 'react';\nimport { BackHandler, Keyboard, Text, View } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\nimport { StyleSheet, useUnistyles } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\n\n/** `bg-po-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 onDismiss?: () => void;\n children?: ReactNode;\n footer?: ReactNode;\n /** False when the content supplies its own Gorhom virtualized scroll owner. */\n scrollable?: boolean;\n /** The sheet holds work not yet saved, so a prompt arriving leaves it open with a note instead of closing it. */\n keep?: boolean;\n /** Fixed heights such as `['58%']`; given, the sheet stops sizing itself to its content. */\n snapPoints?: (string | number)[];\n /** The dimmed overlay that closes the sheet on tap. Off leaves what is behind visible and usable. */\n backdrop?: boolean;\n /** The sheet and footer surface colour. */\n background?: NativeColorToken;\n}\n\nexport { sheetsYielded, yieldSheets } from '@agimon-ai/po-native-components/shell';\n\n/** The latest footer, read by a footer component whose identity never changes while the sheet lives. */\ninterface FooterHolder {\n get: () => ReactNode;\n set: (footer: ReactNode) => void;\n subscribe: (listener: () => void) => () => void;\n}\n\nfunction footerHolder(initial: ReactNode): FooterHolder {\n let footer = initial;\n const listeners = new Set<() => void>();\n return {\n get: () => footer,\n set: (next) => {\n if (next === footer) return;\n footer = next;\n for (const listener of listeners) listener();\n },\n subscribe: (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n };\n}\n\nfunction FooterBody({ holder }: { holder: FooterHolder }) {\n const footer = useSyncExternalStore(holder.subscribe, holder.get);\n return <InsideSheetContext.Provider value>{footer}</InsideSheetContext.Provider>;\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({\n open,\n onClose,\n onDismiss,\n children,\n scrollable = true,\n footer,\n keep = false,\n snapPoints,\n backdrop = true,\n background = 'rail',\n}: 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 const dismissing = useRef(false);\n const [footerHeight, setFooterHeight] = useState(0);\n const [note, setNote] = useState<string>();\n const latest = useRef({ keep, onClose, onDismiss });\n latest.current = { keep, onClose, onDismiss };\n const entry = useRef<OpenSheet>({\n keep: () => latest.current.keep,\n close: () => latest.current.onClose(),\n setNote,\n });\n // Gorhom takes the footer as a component; a new one each render would remount its fields mid-typing.\n const footers = useRef<FooterHolder>(undefined);\n footers.current ??= footerHolder(footer);\n const holder = footers.current;\n useLayoutEffect(() => holder.set(footer), [holder, footer]);\n\n useEffect(() => {\n openRef.current = open;\n if (open && !dismissing.current) {\n presented.current = true;\n registerSheet(entry.current);\n // The keyboard of the field behind would cover the sheet; a field inside it focuses after this.\n Keyboard.dismiss();\n sheet.current?.present();\n } else if (!open) {\n unregisterSheet(entry.current);\n setNote(undefined);\n if (presented.current && !dismissing.current) {\n // A new open waits for native dismissal, otherwise its callback closes the new request.\n dismissing.current = true;\n sheet.current?.dismiss();\n }\n }\n }, [open]);\n\n useEffect(\n () => () => {\n openRef.current = false;\n unregisterSheet(entry.current);\n dismissSheet?.(entry.current);\n },\n [],\n );\n\n useEffect(() => {\n if (!open) return undefined;\n const subscription = BackHandler.addEventListener('hardwareBackPress', () => {\n latest.current.onClose();\n return true;\n });\n return () => subscription.remove();\n }, [open]);\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 const footerInset = insets?.bottom ?? 0;\n const surface = theme.colors[background];\n const renderFooter = useCallback(\n (props: BottomSheetFooterProps) => (\n <BottomSheetFooter {...props}>\n <View\n onLayout={(event) => setFooterHeight(event.nativeEvent.layout.height)}\n style={{ paddingBottom: footerInset, backgroundColor: surface }}\n >\n <FooterBody holder={holder} />\n </View>\n </BottomSheetFooter>\n ),\n [holder, footerInset, surface],\n );\n const backgroundStyle = useMemo(\n () => ({ backgroundColor: surface, borderRadius: theme.borderRadius.lg }),\n [surface, theme.borderRadius.lg],\n );\n const handleIndicatorStyle = useMemo(() => ({ backgroundColor: theme.colors.border }), [theme.colors.border]);\n const onChange = useCallback((index: number) => {\n // present() mounts on the next frame, so an earlier dismiss() may have had nothing to close.\n if (index >= 0 && dismissing.current) sheet.current?.dismiss();\n }, []);\n // A sheet the caller closed is already shut; only a close the sheet started is reported.\n const onSheetDismiss = useCallback(() => {\n const reopen = dismissing.current && openRef.current;\n dismissing.current = false;\n presented.current = false;\n dismissSheet?.(entry.current);\n if (reopen) {\n presented.current = true;\n registerSheet(entry.current);\n sheet.current?.present();\n return;\n }\n if (openRef.current) latest.current.onClose();\n latest.current.onDismiss?.();\n }, []);\n\n return (\n <BottomSheetModal\n ref={sheet}\n // The library marks the whole sheet as one accessible element, which hides its fields and buttons on iOS.\n accessible={false}\n stackBehavior=\"push\"\n enablePanDownToClose\n topInset={insets?.top ?? 0}\n keyboardBehavior=\"interactive\"\n keyboardBlurBehavior=\"restore\"\n android_keyboardInputMode=\"adjustResize\"\n {...(backdrop ? { backdropComponent: renderBackdrop } : {})}\n {...(snapPoints === undefined ? {} : { snapPoints, enableDynamicSizing: false })}\n {...(footer === undefined ? {} : { footerComponent: renderFooter })}\n backgroundStyle={backgroundStyle}\n handleIndicatorStyle={handleIndicatorStyle}\n onChange={onChange}\n onDismiss={onSheetDismiss}\n >\n {scrollable ? (\n <BottomSheetScrollView\n keyboardShouldPersistTaps=\"handled\"\n contentContainerStyle={[\n styles.content,\n { paddingBottom: footer === undefined ? (insets?.bottom ?? 0) : footerHeight },\n ]}\n >\n {note ? <SheetNote note={note} /> : null}\n <InsideSheetContext.Provider value>{children}</InsideSheetContext.Provider>\n </BottomSheetScrollView>\n ) : (\n <>\n {note ? <SheetNote note={note} /> : null}\n <InsideSheetContext.Provider value>{children}</InsideSheetContext.Provider>\n </>\n )}\n </BottomSheetModal>\n );\n}\n\n/** A gentle rose line: the person is asked something below, never told to hurry. */\nfunction SheetNote({ note }: { note: string }) {\n return (\n <Text style={styles.note} accessibilityRole=\"alert\">\n {note}\n </Text>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n content: { flexGrow: 1 },\n note: {\n marginHorizontal: theme.spacing(4),\n marginBottom: theme.spacing(2),\n color: theme.colors.magenta,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n}));\n"],"mappings":";;;;;;;;;;;;;;AAkCA,MAAM4B,yBAAyB;AA8B/B,SAASmB,aAAaC,SAAkC;CACtD,IAAId,SAASc;CACb,MAAMC,4BAAY,IAAIC,IAAgB;CACtC,OAAO;EACLP,WAAWT;EACXU,MAAMO,SAAS;GACb,IAAIA,SAASjB,QAAQ;GACrBA,SAASiB;GACT,KAAK,MAAML,YAAYG,WAAWH,SAAS;EAC7C;EACAD,YAAYC,aAAa;GACvBG,UAAUG,IAAIN,QAAQ;GACtB,aAAaG,UAAUI,OAAOP,QAAQ;EACxC;CACF;AACF;AAEA,SAASQ,WAAW,EAAEC,UAAoC;CACxD,MAAMrB,SAASb,qBAAqBkC,OAAOV,WAAWU,OAAOZ,GAAG;CAChE,OAAO,oBAAC,mBAAmB,UAApB;EAA6B;YAAOT;CAAoC;AACjF;;;;;;;AAQA,SAAgBsB,WAAW,EACzB1B,MACAC,SACAC,WACAC,UACAE,aAAa,MACbD,QACAE,OAAO,OACPC,YACAC,WAAW,MACXC,aAAa,UACK;CAClB,MAAM,EAAEkB,UAAU/B,aAAa;CAC/B,MAAMgC,SAAS3C,WAAWS,qBAAqB;CAC/C,MAAMmC,QAAQxC,OAAyB,IAAI;CAC3C,MAAMyC,UAAUzC,OAAOW,IAAI;CAC3B,MAAM+B,YAAY1C,OAAO,KAAK;CAC9B,MAAM2C,aAAa3C,OAAO,KAAK;CAC/B,MAAM,CAAC4C,cAAcC,mBAAmB5C,SAAS,CAAC;CAClD,MAAM,CAA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AAMgE,WAAWD;EAAEE,mBAAA,CAAA,CAAA;CACjC;AACF,EAAE"}
1
+ {"version":3,"file":"SheetFrame.mjs","names":["dismissSheet","InsideSheetContext","OpenSheet","registerSheet","unregisterSheet","NativeColorToken","withAlpha","BottomSheetBackdrop","BottomSheetBackdropProps","BottomSheetModal","BottomSheetFooter","BottomSheetFooterProps","BottomSheetScrollView","ReactNode","useCallback","useContext","useEffect","useLayoutEffect","useMemo","useRef","useState","useSyncExternalStore","BackHandler","Keyboard","SafeAreaInsetsContext","StyleSheet","useUnistyles","fontOf","BACKDROP_ALPHA_PERCENT","SheetFrameProps","open","onClose","onDismiss","children","footer","scrollable","keep","dismissible","onCloseAttempt","snapPoints","backdrop","background","sheetsYielded","yieldSheets","FooterHolder","get","set","subscribe","listener","footerHolder","initial","listeners","Set","next","add","delete","FooterBody","holder","SheetFrame","theme","insets","sheet","openRef","presented","dismissing","footerHeight","setFooterHeight","note","setNote","latest","current","entry","close","footers","undefined","dismiss","present","subscription","addEventListener","remove","backdropColor","colors","deep","renderBackdrop","props","onPress","style","backgroundColor","footerInset","bottom","surface","renderFooter","event","nativeEvent","layout","height","paddingBottom","backgroundStyle","borderRadius","lg","handleIndicatorStyle","border","onChange","index","onSheetDismiss","reopen","top","backdropComponent","enableDynamicSizing","footerComponent","styles","content","SheetNote","create","flexGrow","marginHorizontal","spacing","marginBottom","color","magenta","fontFamily","sans","fontSize","sm","lineHeight","uni__dependencies"],"sources":["../../src/components/SheetFrame.tsx"],"sourcesContent":["import {\n dismissSheet,\n InsideSheetContext,\n type OpenSheet,\n registerSheet,\n unregisterSheet,\n} from '@agimon-ai/po-native-components/shell';\nimport { type NativeColorToken, withAlpha } from '@agimon-ai/po-web-components/nativeTheme';\nimport {\n BottomSheetBackdrop,\n type BottomSheetBackdropProps,\n BottomSheetModal,\n BottomSheetFooter,\n type BottomSheetFooterProps,\n BottomSheetScrollView,\n} from '@gorhom/bottom-sheet';\nimport {\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n} from 'react';\nimport { BackHandler, Keyboard, Text, View } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\nimport { StyleSheet, useUnistyles } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\n\n/** `bg-po-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 onDismiss?: () => void;\n children?: ReactNode;\n footer?: ReactNode;\n /** False when the content supplies its own Gorhom virtualized scroll owner. */\n scrollable?: boolean;\n /** The sheet holds work not yet saved, so a prompt arriving leaves it open with a note instead of closing it. */\n keep?: boolean;\n /** False prevents swipe-down and backdrop close, routing backdrop tap and Android Back to onCloseAttempt. */\n dismissible?: boolean;\n /** Runs when the person attempts to dismiss via backdrop tap or Android Back while dismissible is false. */\n onCloseAttempt?: () => void;\n /** Fixed heights such as `['58%']`; given, the sheet stops sizing itself to its content. */\n snapPoints?: (string | number)[];\n /** The dimmed overlay that closes the sheet on tap. Off leaves what is behind visible and usable. */\n backdrop?: boolean;\n /** The sheet and footer surface colour. */\n background?: NativeColorToken;\n}\n\nexport { sheetsYielded, yieldSheets } from '@agimon-ai/po-native-components/shell';\n\n/** The latest footer, read by a footer component whose identity never changes while the sheet lives. */\ninterface FooterHolder {\n get: () => ReactNode;\n set: (footer: ReactNode) => void;\n subscribe: (listener: () => void) => () => void;\n}\n\nfunction footerHolder(initial: ReactNode): FooterHolder {\n let footer = initial;\n const listeners = new Set<() => void>();\n return {\n get: () => footer,\n set: (next) => {\n if (next === footer) return;\n footer = next;\n for (const listener of listeners) listener();\n },\n subscribe: (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n };\n}\n\nfunction FooterBody({ holder }: { holder: FooterHolder }) {\n const footer = useSyncExternalStore(holder.subscribe, holder.get);\n return <InsideSheetContext.Provider value>{footer}</InsideSheetContext.Provider>;\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({\n open,\n onClose,\n onDismiss,\n children,\n scrollable = true,\n footer,\n keep = false,\n dismissible = true,\n onCloseAttempt,\n snapPoints,\n backdrop = true,\n background = 'rail',\n}: 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 const dismissing = useRef(false);\n const [footerHeight, setFooterHeight] = useState(0);\n const [note, setNote] = useState<string>();\n const latest = useRef({ keep, dismissible, onClose, onCloseAttempt, onDismiss });\n latest.current = { keep, dismissible, onClose, onCloseAttempt, onDismiss };\n const entry = useRef<OpenSheet>({\n keep: () => latest.current.keep,\n close: () => latest.current.onClose(),\n setNote,\n });\n // Gorhom takes the footer as a component; a new one each render would remount its fields mid-typing.\n const footers = useRef<FooterHolder>(undefined);\n footers.current ??= footerHolder(footer);\n const holder = footers.current;\n useLayoutEffect(() => holder.set(footer), [holder, footer]);\n\n useEffect(() => {\n openRef.current = open;\n if (open && !dismissing.current) {\n presented.current = true;\n registerSheet(entry.current);\n // The keyboard of the field behind would cover the sheet; a field inside it focuses after this.\n Keyboard.dismiss();\n sheet.current?.present();\n } else if (!open) {\n unregisterSheet(entry.current);\n setNote(undefined);\n if (presented.current && !dismissing.current) {\n // A new open waits for native dismissal, otherwise its callback closes the new request.\n dismissing.current = true;\n sheet.current?.dismiss();\n }\n }\n }, [open]);\n\n useEffect(\n () => () => {\n openRef.current = false;\n unregisterSheet(entry.current);\n dismissSheet?.(entry.current);\n },\n [],\n );\n\n useEffect(() => {\n if (!open) return undefined;\n const subscription = BackHandler.addEventListener('hardwareBackPress', () => {\n if (latest.current.dismissible) latest.current.onClose();\n else latest.current.onCloseAttempt?.();\n return true;\n });\n return () => subscription.remove();\n }, [open]);\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={dismissible ? 'close' : 'none'}\n {...(dismissible ? {} : { onPress: () => latest.current.onCloseAttempt?.() })}\n style={[props.style, { backgroundColor: backdropColor }]}\n />\n ),\n [backdropColor, dismissible],\n );\n\n const footerInset = insets?.bottom ?? 0;\n const surface = theme.colors[background];\n const renderFooter = useCallback(\n (props: BottomSheetFooterProps) => (\n <BottomSheetFooter {...props}>\n <View\n onLayout={(event) => setFooterHeight(event.nativeEvent.layout.height)}\n style={{ paddingBottom: footerInset, backgroundColor: surface }}\n >\n <FooterBody holder={holder} />\n </View>\n </BottomSheetFooter>\n ),\n [holder, footerInset, surface],\n );\n const backgroundStyle = useMemo(\n () => ({ backgroundColor: surface, borderRadius: theme.borderRadius.lg }),\n [surface, theme.borderRadius.lg],\n );\n const handleIndicatorStyle = useMemo(() => ({ backgroundColor: theme.colors.border }), [theme.colors.border]);\n const onChange = useCallback((index: number) => {\n // present() mounts on the next frame, so an earlier dismiss() may have had nothing to close.\n if (index >= 0 && dismissing.current) sheet.current?.dismiss();\n }, []);\n // A sheet the caller closed is already shut; only a close the sheet started is reported.\n const onSheetDismiss = useCallback(() => {\n const reopen = dismissing.current && openRef.current;\n dismissing.current = false;\n presented.current = false;\n dismissSheet?.(entry.current);\n if (reopen) {\n presented.current = true;\n registerSheet(entry.current);\n sheet.current?.present();\n return;\n }\n if (openRef.current) latest.current.onClose();\n latest.current.onDismiss?.();\n }, []);\n\n return (\n <BottomSheetModal\n ref={sheet}\n // The library marks the whole sheet as one accessible element, which hides its fields and buttons on iOS.\n accessible={false}\n stackBehavior=\"push\"\n enablePanDownToClose={dismissible}\n topInset={insets?.top ?? 0}\n keyboardBehavior=\"interactive\"\n keyboardBlurBehavior=\"restore\"\n android_keyboardInputMode=\"adjustResize\"\n {...(backdrop ? { backdropComponent: renderBackdrop } : {})}\n {...(snapPoints === undefined ? {} : { snapPoints, enableDynamicSizing: false })}\n {...(footer === undefined ? {} : { footerComponent: renderFooter })}\n backgroundStyle={backgroundStyle}\n handleIndicatorStyle={handleIndicatorStyle}\n onChange={onChange}\n onDismiss={onSheetDismiss}\n >\n {scrollable ? (\n <BottomSheetScrollView\n keyboardShouldPersistTaps=\"handled\"\n contentContainerStyle={[\n styles.content,\n { paddingBottom: footer === undefined ? (insets?.bottom ?? 0) : footerHeight },\n ]}\n >\n {note ? <SheetNote note={note} /> : null}\n <InsideSheetContext.Provider value>{children}</InsideSheetContext.Provider>\n </BottomSheetScrollView>\n ) : (\n <>\n {note ? <SheetNote note={note} /> : null}\n <InsideSheetContext.Provider value>{children}</InsideSheetContext.Provider>\n </>\n )}\n </BottomSheetModal>\n );\n}\n\n/** A gentle rose line: the person is asked something below, never told to hurry. */\nfunction SheetNote({ note }: { note: string }) {\n return (\n <Text style={styles.note} accessibilityRole=\"alert\">\n {note}\n </Text>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n content: { flexGrow: 1 },\n note: {\n marginHorizontal: theme.spacing(4),\n marginBottom: theme.spacing(2),\n color: theme.colors.magenta,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n}));\n"],"mappings":";;;;;;;;;;;;;;AAkCA,MAAM4B,yBAAyB;AAkC/B,SAASqB,aAAaC,SAAkC;CACtD,IAAIhB,SAASgB;CACb,MAAMC,4BAAY,IAAIC,IAAgB;CACtC,OAAO;EACLP,WAAWX;EACXY,MAAMO,SAAS;GACb,IAAIA,SAASnB,QAAQ;GACrBA,SAASmB;GACT,KAAK,MAAML,YAAYG,WAAWH,SAAS;EAC7C;EACAD,Y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AM;EAC9E,GAAK1E,WAAWwC,SAAY,CAAC,IAAI,EAAEmC,iBAAiBlB,aAAa;EAChDM;EACKG;EACZE;EACV,WAAWE;YAEVrE,aACC,qBAAC,uBAAD;GACE,2BAA0B;GAC1B,uBAAuB,CACrB2E,OAAOC,SACP,EAAEf,eAAe9D,WAAWwC,SAAad,QAAQ6B,UAAU,IAAKxB,aAAa,CAAC;aAJlF,CAOGE,OAAO,oBAAC,WAAD,EAAiBA,KAAK,KAAM,MACpC,oBAAC,mBAAmB,UAApB;IAA6B;IAAOlC;GAAsC,EACrD;OAEvB,8CACGkC,OAAO,oBAAC,WAAD,EAAiBA,KAAK,KAAM,MACpC,oBAAC,mBAAmB,UAApB;GAA6B;GAAOlC;EAAsC,EAC5E;CAEc;AAEtB;;AAGA,SAAS+E,UAAU,EAAE7C,QAA0B;CAC7C,OACE,oBAAC,MAAD;EAAM,OAAO2C,OAAO3C;EAAM,mBAAkB;YACzCA;CACG;AAEV;AAEA,MAAM2C,SAASrF,WAAWwF,QAAQtD,WAAW;CAC3CoD,SAAS,EAAEG,UAAU,EAAE;CACvB/C,MAAM;EACJgD,kBAAkBxD,MAAMyD,QAAQ,CAAC;EACjCC,cAAc1D,MAAMyD,QAAQ,CAAC;EAC7BE,OAAO3D,MAAMsB,OAAOsC;EACpBC,YAAY7F,OAAOgC,MAAM6D,WAAWC,IAAI;EACxCC,UAAU/D,MAAM+D,SAASC;EACzBC,YAAYjE,MAAMiE,WAAWD;EAAEE,mBAAA,CAAA,CAAA;CACjC;AACF,EAAE"}
@@ -35,10 +35,12 @@ export declare function TabsContent({ value, children, style, ...props }: TabsCo
35
35
  export interface TabBadgeProps {
36
36
  /** Defaults to the enclosing tab's state: it inverts on the active tab so it stays readable on the tint. */
37
37
  active?: boolean;
38
+ /** Draws in rose (`magenta` fill, `bg` ink) when items are waiting on the person. */
39
+ ask?: boolean;
38
40
  children?: ReactNode;
39
41
  style?: StyleProp<ViewStyle>;
40
42
  }
41
43
  /** The count beside a tab's label. */
42
- export declare function TabBadge({ active, children, style }: TabBadgeProps): import("react").JSX.Element;
44
+ export declare function TabBadge({ active, ask, children, style }: TabBadgeProps): import("react").JSX.Element;
43
45
  //#endregion
44
46
  //# sourceMappingURL=Tabs.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.d.mts","names":[],"sources":["../../src/components/Tabs.tsx"],"mappings":";;;iBA8BiB,kBAAkB,KAAK;;EAEtC;EACA;EACA,iBAAiB;EACjB,WAAW;EACX,QAAQ,UAAU;;wBAGJ,OAAO,OAAO,cAAc,eAAe,UAAU,UAAU,SAAS,4BAAS,IAAA;iBAgBhF;EACf,WAAW;EACX,QAAQ,UAAU;;;wBAIJ,WAAW,UAAU,SAAS,gCAAa,IAAA;iBAc1C;EACf;EACA;;EAEA,WAAW;EACX;EACA,QAAQ,UAAU;;wBAGJ,cAAc,OAAO,UAAkB,UAAU,oBAAoB,SAAS,mCAAgB,IAAA;iBA2B7F,yBAAyB,KAAK;EAC7C;EACA,WAAW;EACX,QAAQ,UAAU;;;wBAIJ,cAAc,OAAO,UAAU,UAAU,SAAS,mCAAgB,IAAA;iBAUjE;;EAEf;EACA,WAAW;EACX,QAAQ,UAAU;;;wBAIJ,WAAW,QAAQ,UAAU,SAAS,gCAAa,IAAA"}
1
+ {"version":3,"file":"Tabs.d.mts","names":[],"sources":["../../src/components/Tabs.tsx"],"mappings":";;;iBA8BiB,kBAAkB,KAAK;;EAEtC;EACA;EACA,iBAAiB;EACjB,WAAW;EACX,QAAQ,UAAU;;wBAGJ,OAAO,OAAO,cAAc,eAAe,UAAU,UAAU,SAAS,4BAAS,IAAA;iBAgBhF;EACf,WAAW;EACX,QAAQ,UAAU;;;wBAIJ,WAAW,UAAU,SAAS,gCAAa,IAAA;iBAc1C;EACf;EACA;;EAEA,WAAW;EACX;EACA,QAAQ,UAAU;;wBAGJ,cAAc,OAAO,UAAkB,UAAU,oBAAoB,SAAS,mCAAgB,IAAA;iBA2B7F,yBAAyB,KAAK;EAC7C;EACA,WAAW;EACX,QAAQ,UAAU;;;wBAIJ,cAAc,OAAO,UAAU,UAAU,SAAS,mCAAgB,IAAA;iBAUjE;;EAEf;;EAEA;EACA,WAAW;EACX,QAAQ,UAAU;;;wBAIJ,WAAW,QAAQ,KAAa,UAAU,SAAS,gCAAa,IAAA"}
@@ -90,11 +90,11 @@ function TabsContent({ value, children, style, ...props }) {
90
90
  });
91
91
  }
92
92
  /** The count beside a tab's label. */
93
- function TabBadge({ active, children, style }) {
93
+ function TabBadge({ active, ask = false, children, style }) {
94
94
  const inherited = useContext(TabActiveContext);
95
95
  const _styles2 = styles;
96
96
  {
97
- const styles = _styles2.useVariants({ badge: active ?? inherited ? "active" : "idle" });
97
+ const styles = _styles2.useVariants({ badge: ask ? "ask" : active ?? inherited ? "active" : "idle" });
98
98
  return /* @__PURE__ */ jsx(View, {
99
99
  style: [styles.badge, style],
100
100
  children: /* @__PURE__ */ jsx(Text, {
@@ -176,6 +176,7 @@ const styles = StyleSheet.create((theme) => ({
176
176
  paddingHorizontal: theme.spacing(1),
177
177
  variants: { badge: {
178
178
  active: { backgroundColor: theme.colors.green },
179
+ ask: { backgroundColor: theme.colors.magenta },
179
180
  idle: { backgroundColor: theme.colors.panel }
180
181
  } },
181
182
  uni__dependencies: [0, 4]
@@ -187,6 +188,7 @@ const styles = StyleSheet.create((theme) => ({
187
188
  fontWeight: theme.fontWeight.semibold,
188
189
  variants: { badge: {
189
190
  active: { color: theme.colors.rail },
191
+ ask: { color: theme.colors.bg },
190
192
  idle: { color: theme.colors.dim }
191
193
  } },
192
194
  uni__dependencies: [0, 4]
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.mjs","names":["createContext","ReactNode","useContext","useMemo","StyleProp","ViewProps","ViewStyle","StyleSheet","fontOf","selectionTick","useControllable","wrapText","TAB_HEIGHT","MIN_TAP_TARGET","DISABLED_OPACITY","BADGE_SIZE","TabsState","value","setValue","TabsContext","undefined","TabActiveContext","TabsProps","Omit","defaultValue","onValueChange","children","style","Tabs","props","current","next","context","styles","tabs","TabsListProps","TabsList","listScroll","list","TabsTriggerProps","disabled","accessibilityLabel","TabsTrigger","active","_styles","useVariants","selected","pressed","tab","label","labelPressed","TabsContentProps","TabsContent","content","contentText","TabBadgeProps","TabBadge","inherited","_styles2","badge","badgeText","create","theme","gap","spacing","uni__dependencies","flexGrow","flexDirection","alignItems","minHeight","minWidth","borderRadius","DEFAULT","paddingHorizontal","paddingVertical","variants","true","backgroundColor","colors","false","panel","opacity","fontFamily","sans","fontSize","base","lineHeight","color","green","fontWeight","semibold","dim","medium","hi","sm","justifyContent","full","idle","rail"],"sources":["../../src/components/Tabs.tsx"],"sourcesContent":["import { createContext, type ReactNode, useContext, useMemo } from 'react';\nimport { Pressable, ScrollView, type StyleProp, Text, View, type ViewProps, type ViewStyle } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { selectionTick } from '../lib/haptics';\nimport { useControllable } from '../lib/useControllable';\nimport { wrapText } from '../lib/wrapText';\n\n/*\n * The web Tabs on a horizontal ScrollView: a strip that scrolls when the tabs\n * outgrow the screen, the active tab in a green tint, and a selection tick on\n * each change. The panels swap in place.\n */\n\n/** `min-h-6`, padded to Apple's 44pt tap target by hitSlop. */\nconst TAB_HEIGHT = 24;\nconst MIN_TAP_TARGET = 44;\nconst DISABLED_OPACITY = 0.4;\nconst BADGE_SIZE = 15;\n\ninterface TabsState {\n value: string | undefined;\n setValue: (value: string) => void;\n}\n\nconst TabsContext = createContext<TabsState>({ value: undefined, setValue: () => undefined });\n/** Whether the enclosing trigger is active, so a TabBadge inverts without being told. */\nconst TabActiveContext = createContext(false);\n\nexport interface TabsProps extends Omit<ViewProps, 'children' | 'style'> {\n /** Controlled mode; pair with onValueChange. Omit it and the tabs keep their own state. */\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\nexport function Tabs({ value, defaultValue, onValueChange, children, style, ...props }: TabsProps) {\n const [current, setValue] = useControllable<string | undefined>(\n value,\n defaultValue,\n onValueChange as ((next: string | undefined) => void) | undefined,\n );\n const context = useMemo(() => ({ value: current, setValue }), [current, setValue]);\n return (\n <TabsContext.Provider value={context}>\n <View style={[styles.tabs, style]} {...props}>\n {children}\n </View>\n </TabsContext.Provider>\n );\n}\n\nexport interface TabsListProps {\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\n/** The tab strip; it scrolls sideways when the tabs outgrow it. */\nexport function TabsList({ children, style }: TabsListProps) {\n return (\n <ScrollView\n horizontal\n showsHorizontalScrollIndicator={false}\n accessibilityRole=\"tablist\"\n style={styles.listScroll}\n contentContainerStyle={[styles.list, style]}\n >\n {children}\n </ScrollView>\n );\n}\n\nexport interface TabsTriggerProps {\n value: string;\n disabled?: boolean;\n /** The label; a bare string is drawn in the tab's type, and a TabBadge may follow it. */\n children?: ReactNode;\n accessibilityLabel?: string;\n style?: StyleProp<ViewStyle>;\n}\n\nexport function TabsTrigger({ value, disabled = false, children, accessibilityLabel, style }: TabsTriggerProps) {\n const tabs = useContext(TabsContext);\n const active = tabs.value === value;\n styles.useVariants({ active });\n return (\n <Pressable\n accessibilityRole=\"tab\"\n accessibilityLabel={accessibilityLabel}\n accessibilityState={{ selected: active, disabled }}\n disabled={disabled}\n hitSlop={(MIN_TAP_TARGET - TAB_HEIGHT) / 2}\n onPress={() => {\n if (active) return;\n selectionTick();\n tabs.setValue(value);\n }}\n style={({ pressed }) => [styles.tab, pressed && !active && styles.pressed, disabled && styles.disabled, style]}\n >\n {({ pressed }) => (\n <TabActiveContext.Provider value={active}>\n {wrapText(children, [styles.label, pressed && !active && styles.labelPressed])}\n </TabActiveContext.Provider>\n )}\n </Pressable>\n );\n}\n\nexport interface TabsContentProps extends Omit<ViewProps, 'children' | 'style'> {\n value: string;\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\n/** The panel for one tab; only the active one renders. */\nexport function TabsContent({ value, children, style, ...props }: TabsContentProps) {\n const tabs = useContext(TabsContext);\n if (tabs.value !== value) return null;\n return (\n <View style={[styles.content, style]} {...props}>\n {wrapText(children, styles.contentText)}\n </View>\n );\n}\n\nexport interface TabBadgeProps {\n /** Defaults to the enclosing tab's state: it inverts on the active tab so it stays readable on the tint. */\n active?: boolean;\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\n/** The count beside a tab's label. */\nexport function TabBadge({ active, children, style }: TabBadgeProps) {\n const inherited = useContext(TabActiveContext);\n styles.useVariants({ badge: (active ?? inherited) ? 'active' : 'idle' });\n return (\n <View style={[styles.badge, style]}>\n <Text style={styles.badgeText}>{children}</Text>\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n tabs: { gap: theme.spacing(2) },\n listScroll: { flexGrow: 0 },\n list: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(1) },\n tab: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(1.5),\n minHeight: TAB_HEIGHT,\n minWidth: TAB_HEIGHT,\n borderRadius: theme.borderRadius.DEFAULT,\n paddingHorizontal: theme.spacing(2),\n paddingVertical: theme.spacing(1),\n variants: {\n active: {\n true: { backgroundColor: theme.colors['tint-green'] },\n false: {},\n },\n },\n },\n pressed: { backgroundColor: theme.colors.panel },\n disabled: { opacity: DISABLED_OPACITY },\n label: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n variants: {\n active: {\n true: { color: theme.colors.green, fontWeight: theme.fontWeight.semibold },\n false: { color: theme.colors.dim, fontWeight: theme.fontWeight.medium },\n },\n },\n },\n labelPressed: { color: theme.colors.hi },\n content: { flexGrow: 1, minHeight: 0 },\n contentText: {\n color: theme.colors.dim,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n badge: {\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: BADGE_SIZE,\n minWidth: BADGE_SIZE,\n borderRadius: theme.borderRadius.full,\n paddingHorizontal: theme.spacing(1),\n variants: {\n badge: {\n active: { backgroundColor: theme.colors.green },\n idle: { backgroundColor: theme.colors.panel },\n },\n },\n },\n badgeText: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize['2xs'],\n lineHeight: theme.lineHeight['2xs'],\n fontWeight: theme.fontWeight.semibold,\n variants: {\n badge: {\n active: { color: theme.colors.rail },\n idle: { color: theme.colors.dim },\n },\n },\n },\n}));\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAMY,aAAa;AAEnB,MAAME,mBAAmB;AACzB,MAAMC,aAAa;AAOnB,MAAMI,cAAcnB,cAAyB;CAAEiB,OAAOG;CAAWF,gBAAgBE;AAAU,CAAC;;AAE5F,MAAMC,mBAAmBrB,cAAc,KAAK;AAW5C,SAAgB4B,KAAK,EAAEX,OAAOO,cAAcC,eAAeC,UAAUC,OAAO,GAAGE,SAAoB;CACjG,MAAM,CAACC,SAASZ,YAAYR,gBAC1BO,OACAO,cACAC,aACF;CACA,MAAMO,UAAU7B,eAAe;EAAEc,OAAOa;EAASZ;CAAS,IAAI,CAACY,SAASZ,QAAQ,CAAC;CACjF,OACE,oBAAC,YAAY,UAAb;EAAsB,OAAOc;YAC3B,oBAAC,MAAD;GAAM,OAAO,CAACC,OAAOC,MAAMP,KAAK;GAAG,GAAIE;GACpCH;EACG;CACc;AAE1B;;AAQA,SAAgBU,SAAS,EAAEV,UAAUC,SAAwB;CAC3D,OACE,oBAAC,YAAD;EACE;EACA,gCAAgC;EAChC,mBAAkB;EAClB,OAAOM,OAAOI;EACd,uBAAuB,CAACJ,OAAOK,MAAMX,KAAK;EAEzCD;CACS;AAEhB;AAWA,SAAgBgB,YAAY,EAAEzB,OAAOuB,WAAW,OAAOd,UAAUe,oBAAoBd,SAA2B;CAC9G,MAAMO,OAAOhC,WAAWiB,WAAW;CACnC,MAAMwB,SAAST,KA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;EACxCC,UAAUtB,MAAMsB,SAASU;EACzBR,YAAYxB,MAAMwB,WAAWQ;EAAE7B,mBAAA,CAAA,CAAA;CACjC;CACAN,OAAO;EACLS,YAAY;EACZ2B,gBAAgB;EAChB1B,WAAWtD;EACXuD,UAAUvD;EACVwD,cAAcT,MAAMS,aAAayB;EACjCvB,mBAAmBX,MAAME,QAAQ,CAAC;EAClCW,UAAU,EACRhB,OAAO;GACLhB,QAAQ,EAAEkC,iBAAiBf,MAAMgB,OAAOU,MAAM;GAC9CS,MAAM,EAAEpB,iBAAiBf,MAAMgB,OAAOE,MAAM;EAC9C,EACF;EAACf,mBAAA,CAAA,GAAA,CAAA;CACH;CACAL,WAAW;EACTsB,YAAY1E,OAAOsD,MAAMoB,WAAWC,IAAI;EACxCC,UAAUtB,MAAMsB,SAAS;EACzBE,YAAYxB,MAAMwB,WAAW;EAC7BG,YAAY3B,MAAM2B,WAAWC;EAC7Bf,UAAU,EACRhB,OAAO;GACLhB,QAAQ,EAAE4C,OAAOzB,MAAMgB,OAAOoB,KAAK;GACnCD,MAAM,EAAEV,OAAOzB,MAAMgB,OAAOa,IAAI;EAClC,EACF;EAAC1B,mBAAA,CAAA,GAAA,CAAA;CACH;AACF,EAAE"}
1
+ {"version":3,"file":"Tabs.mjs","names":["createContext","ReactNode","useContext","useMemo","StyleProp","ViewProps","ViewStyle","StyleSheet","fontOf","selectionTick","useControllable","wrapText","TAB_HEIGHT","MIN_TAP_TARGET","DISABLED_OPACITY","BADGE_SIZE","TabsState","value","setValue","TabsContext","undefined","TabActiveContext","TabsProps","Omit","defaultValue","onValueChange","children","style","Tabs","props","current","next","context","styles","tabs","TabsListProps","TabsList","listScroll","list","TabsTriggerProps","disabled","accessibilityLabel","TabsTrigger","active","_styles","useVariants","selected","pressed","tab","label","labelPressed","TabsContentProps","TabsContent","content","contentText","TabBadgeProps","ask","TabBadge","inherited","_styles2","badge","badgeText","create","theme","gap","spacing","uni__dependencies","flexGrow","flexDirection","alignItems","minHeight","minWidth","borderRadius","DEFAULT","paddingHorizontal","paddingVertical","variants","true","backgroundColor","colors","false","panel","opacity","fontFamily","sans","fontSize","base","lineHeight","color","green","fontWeight","semibold","dim","medium","hi","sm","justifyContent","full","magenta","idle","rail","bg"],"sources":["../../src/components/Tabs.tsx"],"sourcesContent":["import { createContext, type ReactNode, useContext, useMemo } from 'react';\nimport { Pressable, ScrollView, type StyleProp, Text, View, type ViewProps, type ViewStyle } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { selectionTick } from '../lib/haptics';\nimport { useControllable } from '../lib/useControllable';\nimport { wrapText } from '../lib/wrapText';\n\n/*\n * The web Tabs on a horizontal ScrollView: a strip that scrolls when the tabs\n * outgrow the screen, the active tab in a green tint, and a selection tick on\n * each change. The panels swap in place.\n */\n\n/** `min-h-6`, padded to Apple's 44pt tap target by hitSlop. */\nconst TAB_HEIGHT = 24;\nconst MIN_TAP_TARGET = 44;\nconst DISABLED_OPACITY = 0.4;\nconst BADGE_SIZE = 15;\n\ninterface TabsState {\n value: string | undefined;\n setValue: (value: string) => void;\n}\n\nconst TabsContext = createContext<TabsState>({ value: undefined, setValue: () => undefined });\n/** Whether the enclosing trigger is active, so a TabBadge inverts without being told. */\nconst TabActiveContext = createContext(false);\n\nexport interface TabsProps extends Omit<ViewProps, 'children' | 'style'> {\n /** Controlled mode; pair with onValueChange. Omit it and the tabs keep their own state. */\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\nexport function Tabs({ value, defaultValue, onValueChange, children, style, ...props }: TabsProps) {\n const [current, setValue] = useControllable<string | undefined>(\n value,\n defaultValue,\n onValueChange as ((next: string | undefined) => void) | undefined,\n );\n const context = useMemo(() => ({ value: current, setValue }), [current, setValue]);\n return (\n <TabsContext.Provider value={context}>\n <View style={[styles.tabs, style]} {...props}>\n {children}\n </View>\n </TabsContext.Provider>\n );\n}\n\nexport interface TabsListProps {\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\n/** The tab strip; it scrolls sideways when the tabs outgrow it. */\nexport function TabsList({ children, style }: TabsListProps) {\n return (\n <ScrollView\n horizontal\n showsHorizontalScrollIndicator={false}\n accessibilityRole=\"tablist\"\n style={styles.listScroll}\n contentContainerStyle={[styles.list, style]}\n >\n {children}\n </ScrollView>\n );\n}\n\nexport interface TabsTriggerProps {\n value: string;\n disabled?: boolean;\n /** The label; a bare string is drawn in the tab's type, and a TabBadge may follow it. */\n children?: ReactNode;\n accessibilityLabel?: string;\n style?: StyleProp<ViewStyle>;\n}\n\nexport function TabsTrigger({ value, disabled = false, children, accessibilityLabel, style }: TabsTriggerProps) {\n const tabs = useContext(TabsContext);\n const active = tabs.value === value;\n styles.useVariants({ active });\n return (\n <Pressable\n accessibilityRole=\"tab\"\n accessibilityLabel={accessibilityLabel}\n accessibilityState={{ selected: active, disabled }}\n disabled={disabled}\n hitSlop={(MIN_TAP_TARGET - TAB_HEIGHT) / 2}\n onPress={() => {\n if (active) return;\n selectionTick();\n tabs.setValue(value);\n }}\n style={({ pressed }) => [styles.tab, pressed && !active && styles.pressed, disabled && styles.disabled, style]}\n >\n {({ pressed }) => (\n <TabActiveContext.Provider value={active}>\n {wrapText(children, [styles.label, pressed && !active && styles.labelPressed])}\n </TabActiveContext.Provider>\n )}\n </Pressable>\n );\n}\n\nexport interface TabsContentProps extends Omit<ViewProps, 'children' | 'style'> {\n value: string;\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\n/** The panel for one tab; only the active one renders. */\nexport function TabsContent({ value, children, style, ...props }: TabsContentProps) {\n const tabs = useContext(TabsContext);\n if (tabs.value !== value) return null;\n return (\n <View style={[styles.content, style]} {...props}>\n {wrapText(children, styles.contentText)}\n </View>\n );\n}\n\nexport interface TabBadgeProps {\n /** Defaults to the enclosing tab's state: it inverts on the active tab so it stays readable on the tint. */\n active?: boolean;\n /** Draws in rose (`magenta` fill, `bg` ink) when items are waiting on the person. */\n ask?: boolean;\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\n/** The count beside a tab's label. */\nexport function TabBadge({ active, ask = false, children, style }: TabBadgeProps) {\n const inherited = useContext(TabActiveContext);\n styles.useVariants({ badge: ask ? 'ask' : (active ?? inherited) ? 'active' : 'idle' });\n return (\n <View style={[styles.badge, style]}>\n <Text style={styles.badgeText}>{children}</Text>\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n tabs: { gap: theme.spacing(2) },\n listScroll: { flexGrow: 0 },\n list: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(1) },\n tab: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(1.5),\n minHeight: TAB_HEIGHT,\n minWidth: TAB_HEIGHT,\n borderRadius: theme.borderRadius.DEFAULT,\n paddingHorizontal: theme.spacing(2),\n paddingVertical: theme.spacing(1),\n variants: {\n active: {\n true: { backgroundColor: theme.colors['tint-green'] },\n false: {},\n },\n },\n },\n pressed: { backgroundColor: theme.colors.panel },\n disabled: { opacity: DISABLED_OPACITY },\n label: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n variants: {\n active: {\n true: { color: theme.colors.green, fontWeight: theme.fontWeight.semibold },\n false: { color: theme.colors.dim, fontWeight: theme.fontWeight.medium },\n },\n },\n },\n labelPressed: { color: theme.colors.hi },\n content: { flexGrow: 1, minHeight: 0 },\n contentText: {\n color: theme.colors.dim,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n badge: {\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: BADGE_SIZE,\n minWidth: BADGE_SIZE,\n borderRadius: theme.borderRadius.full,\n paddingHorizontal: theme.spacing(1),\n variants: {\n badge: {\n active: { backgroundColor: theme.colors.green },\n ask: { backgroundColor: theme.colors.magenta },\n idle: { backgroundColor: theme.colors.panel },\n },\n },\n },\n badgeText: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize['2xs'],\n lineHeight: theme.lineHeight['2xs'],\n fontWeight: theme.fontWeight.semibold,\n variants: {\n badge: {\n active: { color: theme.colors.rail },\n ask: { color: theme.colors.bg },\n idle: { color: theme.colors.dim },\n },\n },\n },\n}));\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAMY,aAAa;AAEnB,MAAME,mBAAmB;AACzB,MAAMC,aAAa;AAOnB,MAAMI,cAAcnB,cAAyB;CAAEiB,OAAOG;CAAWF,gBAAgBE;AAAU,CAAC;;AAE5F,MAAMC,mBAAmBrB,cAAc,KAAK;AAW5C,SAAgB4B,KAAK,EAAEX,OAAOO,cAAcC,eAAeC,UAAUC,OAAO,GAAGE,SAAoB;CACjG,MAAM,CAACC,SAASZ,YAAYR,gBAC1BO,OACAO,cACAC,aACF;CACA,MAAMO,UAAU7B,eAAe;EAAEc,OAAOa;EAASZ;CAAS,IAAI,CAACY,SAASZ,QAAQ,CAAC;CACjF,OACE,oBAAC,YAAY,UAAb;EAAsB,OAAOc;YAC3B,oBAAC,MAAD;GAAM,OAAO,CAACC,OAAOC,MAAMP,KAAK;GAAG,GAAIE;GACpCH;EACG;CACc;AAE1B;;AAQA,SAAgBU,SAAS,EAAEV,UAAUC,SAAwB;CAC3D,OACE,oBAAC,YAAD;EACE;EACA,gCAAgC;EAChC,mBAAkB;EAClB,OAAOM,OAAOI;EACd,uBAAuB,CAACJ,OAAOK,MAAMX,KAAK;EAEzCD;CACS;AAEhB;AAWA,SAAgBgB,YAAY,EAAEzB,OAAOuB,WAAW,OAAOd,UAAUe,oBAAoBd,SAA2B;CAC9G,MAAMO,OAAOhC,WAAWiB,WAAW;CACnC,MAAMwB,SAAST,KAAKjB,UAAUA;CAAM,MAAA2B,UAAAX;CAAA;EAAA,MAAAA,SAAAW,QAAAC,YACjB,EAAEF,OAAO,CAAC;EAC7B,OACE,oBAAC,WA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;CACjC;CACAN,OAAO;EACLS,YAAY;EACZ2B,gBAAgB;EAChB1B,WAAWvD;EACXwD,UAAUxD;EACVyD,cAAcT,MAAMS,aAAayB;EACjCvB,mBAAmBX,MAAME,QAAQ,CAAC;EAClCW,UAAU,EACRhB,OAAO;GACLjB,QAAQ,EAAEmC,iBAAiBf,MAAMgB,OAAOU,MAAM;GAC9CjC,KAAK,EAAEsB,iBAAiBf,MAAMgB,OAAOmB,QAAQ;GAC7CC,MAAM,EAAErB,iBAAiBf,MAAMgB,OAAOE,MAAM;EAC9C,EACF;EAACf,mBAAA,CAAA,GAAA,CAAA;CACH;CACAL,WAAW;EACTsB,YAAY3E,OAAOuD,MAAMoB,WAAWC,IAAI;EACxCC,UAAUtB,MAAMsB,SAAS;EACzBE,YAAYxB,MAAMwB,WAAW;EAC7BG,YAAY3B,MAAM2B,WAAWC;EAC7Bf,UAAU,EACRhB,OAAO;GACLjB,QAAQ,EAAE6C,OAAOzB,MAAMgB,OAAOqB,KAAK;GACnC5C,KAAK,EAAEgC,OAAOzB,MAAMgB,OAAOsB,GAAG;GAC9BF,MAAM,EAAEX,OAAOzB,MAAMgB,OAAOa,IAAI;EAClC,EACF;EAAC1B,mBAAA,CAAA,GAAA,CAAA;CACH;AACF,EAAE"}
@@ -1 +1 @@
1
- {"version":1,"platformRequirements":{},"sourceFiles":["LICENSE","README.md","llms.txt","locales/vi.json","locales/zh-CN.json","package.json","src/components/AgentAvatar.stories.tsx","src/components/AgentAvatar.tsx","src/components/AnnotationSurface.tsx","src/components/Badge.stories.tsx","src/components/Badge.tsx","src/components/Button.stories.tsx","src/components/Button.tsx","src/components/CodeBlock.stories.tsx","src/components/CodeBlock.tsx","src/components/ComputerRow.stories.tsx","src/components/ComputerRow.tsx","src/components/CopyButton.tsx","src/components/CountBadge.stories.tsx","src/components/CountBadge.tsx","src/components/CtaCard.stories.tsx","src/components/CtaCard.tsx","src/components/Dialog.stories.tsx","src/components/Dialog.tsx","src/components/Dot.stories.tsx","src/components/Dot.tsx","src/components/DropdownMenu.stories.tsx","src/components/DropdownMenu.tsx","src/components/EmptyState.stories.tsx","src/components/EmptyState.tsx","src/components/FileList.stories.tsx","src/components/FileList.tsx","src/components/FilePreview.stories.tsx","src/components/FilePreview.tsx","src/components/FileViewer.stories.tsx","src/components/FileViewer.tsx","src/components/HashlineLines.tsx","src/components/HostFilter.stories.tsx","src/components/HostFilter.tsx","src/components/HostTag.stories.tsx","src/components/HostTag.tsx","src/components/InfoStrip.stories.tsx","src/components/InfoStrip.tsx","src/components/InlineReadingDesign.stories.tsx","src/components/Input.stories.tsx","src/components/Input.tsx","src/components/Label.stories.tsx","src/components/Label.tsx","src/components/LinkText.tsx","src/components/List.stories.tsx","src/components/List.tsx","src/components/LiveDuration.tsx","src/components/LoadingState.stories.tsx","src/components/LoadingState.tsx","src/components/Markdown.stories.tsx","src/components/Markdown.tsx","src/components/MessageItem.stories.tsx","src/components/MessageItem.tsx","src/components/NativeShellState.tsx","src/components/Panel.stories.tsx","src/components/Panel.tsx","src/components/PoNativeProvider.stories.tsx","src/components/PoNativeProvider.tsx","src/components/RailItem.stories.tsx","src/components/RailItem.tsx","src/components/ReferenceChip.stories.tsx","src/components/ReferenceChip.tsx","src/components/SectionLabel.stories.tsx","src/components/SectionLabel.tsx","src/components/SeekBar.stories.tsx","src/components/SeekBar.tsx","src/components/SegmentedControl.stories.tsx","src/components/SegmentedControl.tsx","src/components/Select.stories.tsx","src/components/Select.tsx","src/components/Sheet.stories.tsx","src/components/Sheet.tsx","src/components/SheetFrame.tsx","src/components/SheetList.tsx","src/components/ShowMore.tsx","src/components/Spinner.stories.tsx","src/components/Spinner.tsx","src/components/StatusBadge.stories.tsx","src/components/StatusBadge.tsx","src/components/Switch.stories.tsx","src/components/Switch.tsx","src/components/SyntaxLine.tsx","src/components/Tabs.stories.tsx","src/components/Tabs.tsx","src/components/Textarea.stories.tsx","src/components/Textarea.tsx","src/components/ToolPathLink.tsx","src/components/ToolResultImage.tsx","src/exports/index.ts","src/exports/shell.ts","src/icons/IconColorContext.ts","src/icons/iconGlyphs.ts","src/icons/icons.stories.tsx","src/icons/icons.tsx","src/lib/fileKindLabel.ts","src/lib/fonts.ts","src/lib/haptics.ts","src/lib/insideSheet.ts","src/lib/markdown.ts","src/lib/reading.ts","src/lib/tone.ts","src/lib/useControllable.ts","src/lib/useReadingPage.ts","src/lib/wrapText.tsx","src/unistyles.ts","tsdown.config.ts"],"sourceRevision":"34d19c1e3f8e800153c6af45787fa99f","manifestRevision":"dd975ca22592104ffd0f4509399a4b4a","outputFiles":["LICENSE","README.md","dist/components/AgentAvatar.mjs","dist/components/AnnotationSurface.mjs","dist/components/Badge.mjs","dist/components/Button.mjs","dist/components/CodeBlock.mjs","dist/components/ComputerRow.mjs","dist/components/CopyButton.mjs","dist/components/CountBadge.mjs","dist/components/CtaCard.mjs","dist/components/Dialog.mjs","dist/components/Dot.mjs","dist/components/DropdownMenu.mjs","dist/components/EmptyState.mjs","dist/components/FileList.mjs","dist/components/FilePreview.mjs","dist/components/FileViewer.mjs","dist/components/HashlineLines.mjs","dist/components/HostFilter.mjs","dist/components/HostTag.mjs","dist/components/InfoStrip.mjs","dist/components/Input.mjs","dist/components/Label.mjs","dist/components/LinkText.mjs","dist/components/List.mjs","dist/components/LiveDuration.mjs","dist/components/LoadingState.mjs","dist/components/Markdown.mjs","dist/components/MessageItem.mjs","dist/components/NativeShellState.mjs","dist/components/Panel.mjs","dist/components/PoNativeProvider.mjs","dist/components/RailItem.mjs","dist/components/ReferenceChip.mjs","dist/components/SectionLabel.mjs","dist/components/SeekBar.mjs","dist/components/SegmentedControl.mjs","dist/components/Select.mjs","dist/components/Sheet.mjs","dist/components/SheetFrame.mjs","dist/components/SheetList.mjs","dist/components/ShowMore.mjs","dist/components/Spinner.mjs","dist/components/StatusBadge.mjs","dist/components/Switch.mjs","dist/components/SyntaxLine.mjs","dist/components/Tabs.mjs","dist/components/Textarea.mjs","dist/components/ToolPathLink.mjs","dist/components/ToolResultImage.mjs","dist/icons/IconColorContext.mjs","dist/icons/iconGlyphs.mjs","dist/icons/icons.mjs","dist/index.mjs","dist/lib/fileKindLabel.mjs","dist/lib/fonts.mjs","dist/lib/haptics.mjs","dist/lib/insideSheet.mjs","dist/lib/markdown.mjs","dist/lib/reading.mjs","dist/lib/tone.mjs","dist/lib/useControllable.mjs","dist/lib/useReadingPage.mjs","dist/lib/wrapText.mjs","dist/shell.mjs","llms.txt","locales/vi.json","locales/zh-CN.json"],"outputRevision":"c14e3cfa2ec7224ec7ff00eca3ca2698"}
1
+ {"version":1,"platformRequirements":{},"sourceFiles":["LICENSE","README.md","llms.txt","locales/vi.json","locales/zh-CN.json","package.json","src/components/AgentAvatar.stories.tsx","src/components/AgentAvatar.tsx","src/components/AnnotationSurface.tsx","src/components/Badge.stories.tsx","src/components/Badge.tsx","src/components/Button.stories.tsx","src/components/Button.tsx","src/components/CodeBlock.stories.tsx","src/components/CodeBlock.tsx","src/components/ComputerRow.stories.tsx","src/components/ComputerRow.tsx","src/components/CopyButton.tsx","src/components/CountBadge.stories.tsx","src/components/CountBadge.tsx","src/components/CtaCard.stories.tsx","src/components/CtaCard.tsx","src/components/Dialog.stories.tsx","src/components/Dialog.tsx","src/components/Dot.stories.tsx","src/components/Dot.tsx","src/components/DropdownMenu.stories.tsx","src/components/DropdownMenu.tsx","src/components/EmptyState.stories.tsx","src/components/EmptyState.tsx","src/components/FileList.stories.tsx","src/components/FileList.tsx","src/components/FilePreview.stories.tsx","src/components/FilePreview.tsx","src/components/FileViewer.stories.tsx","src/components/FileViewer.tsx","src/components/HashlineLines.tsx","src/components/HostFilter.stories.tsx","src/components/HostFilter.tsx","src/components/HostTag.stories.tsx","src/components/HostTag.tsx","src/components/InfoStrip.stories.tsx","src/components/InfoStrip.tsx","src/components/InlineReadingDesign.stories.tsx","src/components/Input.stories.tsx","src/components/Input.tsx","src/components/Label.stories.tsx","src/components/Label.tsx","src/components/LinkText.tsx","src/components/List.stories.tsx","src/components/List.tsx","src/components/LiveDuration.tsx","src/components/LoadingState.stories.tsx","src/components/LoadingState.tsx","src/components/Markdown.stories.tsx","src/components/Markdown.tsx","src/components/MessageItem.stories.tsx","src/components/MessageItem.tsx","src/components/NativeShellState.tsx","src/components/Panel.stories.tsx","src/components/Panel.tsx","src/components/PoNativeProvider.stories.tsx","src/components/PoNativeProvider.tsx","src/components/RailItem.stories.tsx","src/components/RailItem.tsx","src/components/ReferenceChip.stories.tsx","src/components/ReferenceChip.tsx","src/components/SectionLabel.stories.tsx","src/components/SectionLabel.tsx","src/components/SeekBar.stories.tsx","src/components/SeekBar.tsx","src/components/SegmentedControl.stories.tsx","src/components/SegmentedControl.tsx","src/components/Select.stories.tsx","src/components/Select.tsx","src/components/Sheet.stories.tsx","src/components/Sheet.tsx","src/components/SheetFrame.tsx","src/components/SheetList.tsx","src/components/ShowMore.tsx","src/components/Spinner.stories.tsx","src/components/Spinner.tsx","src/components/StatusBadge.stories.tsx","src/components/StatusBadge.tsx","src/components/Switch.stories.tsx","src/components/Switch.tsx","src/components/SyntaxLine.tsx","src/components/Tabs.stories.tsx","src/components/Tabs.tsx","src/components/Textarea.stories.tsx","src/components/Textarea.tsx","src/components/ToolPathLink.tsx","src/components/ToolResultImage.tsx","src/exports/index.ts","src/exports/shell.ts","src/icons/IconColorContext.ts","src/icons/iconGlyphs.ts","src/icons/icons.stories.tsx","src/icons/icons.tsx","src/lib/fileKindLabel.ts","src/lib/fonts.ts","src/lib/haptics.ts","src/lib/insideSheet.ts","src/lib/markdown.ts","src/lib/reading.ts","src/lib/tone.ts","src/lib/useControllable.ts","src/lib/useReadingPage.ts","src/lib/wrapText.tsx","src/unistyles.ts","tsdown.config.ts"],"sourceRevision":"3b31a55f1ea934cdc86aa67368ee6f8e","manifestRevision":"252720b1fc4cb6dfcd9d24032e8a2946","outputFiles":["LICENSE","README.md","dist/components/AgentAvatar.mjs","dist/components/AnnotationSurface.mjs","dist/components/Badge.mjs","dist/components/Button.mjs","dist/components/CodeBlock.mjs","dist/components/ComputerRow.mjs","dist/components/CopyButton.mjs","dist/components/CountBadge.mjs","dist/components/CtaCard.mjs","dist/components/Dialog.mjs","dist/components/Dot.mjs","dist/components/DropdownMenu.mjs","dist/components/EmptyState.mjs","dist/components/FileList.mjs","dist/components/FilePreview.mjs","dist/components/FileViewer.mjs","dist/components/HashlineLines.mjs","dist/components/HostFilter.mjs","dist/components/HostTag.mjs","dist/components/InfoStrip.mjs","dist/components/Input.mjs","dist/components/Label.mjs","dist/components/LinkText.mjs","dist/components/List.mjs","dist/components/LiveDuration.mjs","dist/components/LoadingState.mjs","dist/components/Markdown.mjs","dist/components/MessageItem.mjs","dist/components/NativeShellState.mjs","dist/components/Panel.mjs","dist/components/PoNativeProvider.mjs","dist/components/RailItem.mjs","dist/components/ReferenceChip.mjs","dist/components/SectionLabel.mjs","dist/components/SeekBar.mjs","dist/components/SegmentedControl.mjs","dist/components/Select.mjs","dist/components/Sheet.mjs","dist/components/SheetFrame.mjs","dist/components/SheetList.mjs","dist/components/ShowMore.mjs","dist/components/Spinner.mjs","dist/components/StatusBadge.mjs","dist/components/Switch.mjs","dist/components/SyntaxLine.mjs","dist/components/Tabs.mjs","dist/components/Textarea.mjs","dist/components/ToolPathLink.mjs","dist/components/ToolResultImage.mjs","dist/icons/IconColorContext.mjs","dist/icons/iconGlyphs.mjs","dist/icons/icons.mjs","dist/index.mjs","dist/lib/fileKindLabel.mjs","dist/lib/fonts.mjs","dist/lib/haptics.mjs","dist/lib/insideSheet.mjs","dist/lib/markdown.mjs","dist/lib/reading.mjs","dist/lib/tone.mjs","dist/lib/useControllable.mjs","dist/lib/useReadingPage.mjs","dist/lib/wrapText.mjs","dist/shell.mjs","llms.txt","locales/vi.json","locales/zh-CN.json"],"outputRevision":"7a0103b26241623e6d4f4c4a9fdebd54"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/po-native-components",
3
- "version": "0.0.0-alpha.225",
3
+ "version": "0.0.0-alpha.227",
4
4
  "description": "Shared React Native components for Po and its native plugins: the web component library's look and API on native parts, tuned to the Po palette.",
5
5
  "keywords": [
6
6
  "ai",
@@ -52,12 +52,12 @@
52
52
  "access": "public"
53
53
  },
54
54
  "dependencies": {
55
- "@agimon-ai/po-web-components": "0.0.0-alpha.225"
55
+ "@agimon-ai/po-web-components": "0.0.0-alpha.227"
56
56
  },
57
57
  "devDependencies": {
58
- "@agimon-ai/po-build": "0.0.0-alpha.225",
59
- "@agimon-ai/po-core": "0.0.0-alpha.225",
60
- "@agimon-ai/vibe-lint-plugin-po-web": "0.0.0-alpha.225",
58
+ "@agimon-ai/po-build": "0.0.0-alpha.227",
59
+ "@agimon-ai/po-core": "0.0.0-alpha.227",
60
+ "@agimon-ai/vibe-lint-plugin-po-web": "0.0.0-alpha.227",
61
61
  "@babel/core": "7.29.7",
62
62
  "@expo/vector-icons": "15.1.1",
63
63
  "@fontsource-variable/ibm-plex-sans": "5.3.0",
@@ -88,7 +88,7 @@
88
88
  "vitest": "5.0.4"
89
89
  },
90
90
  "peerDependencies": {
91
- "@agimon-ai/po-core": "0.0.0-alpha.225",
91
+ "@agimon-ai/po-core": "0.0.0-alpha.227",
92
92
  "@expo/vector-icons": "^15.0.0",
93
93
  "@gorhom/bottom-sheet": "^5.2.0",
94
94
  "@react-native-segmented-control/segmented-control": "^2.5.0",