@adminide-stack/yantra-mobile 12.0.140 → 12.0.141

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/lib/features/agent-chat/NativeAgentChat.js +21 -4
  2. package/lib/features/agent-chat/NativeAgentChat.js.map +1 -1
  3. package/lib/features/chat/ApprovalCard.js +353 -0
  4. package/lib/features/chat/ApprovalCard.js.map +1 -0
  5. package/lib/features/chat/AskUserCard.js +9 -2
  6. package/lib/features/chat/AskUserCard.js.map +1 -1
  7. package/lib/features/chat/askUser.js +25 -3
  8. package/lib/features/chat/askUser.js.map +1 -1
  9. package/lib/features/chat/queuedFollowUpRows.js +13 -0
  10. package/lib/features/chat/queuedFollowUpRows.js.map +1 -0
  11. package/lib/features/discover/DiscoverArticle.js +105 -92
  12. package/lib/features/discover/DiscoverArticle.js.map +1 -1
  13. package/lib/features/discover/DiscoverFeed.js +97 -48
  14. package/lib/features/discover/DiscoverFeed.js.map +1 -1
  15. package/lib/features/discover/DiscoverFollowUp.js +135 -0
  16. package/lib/features/discover/DiscoverFollowUp.js.map +1 -0
  17. package/lib/features/discover/DiscoverSidebar.js +555 -0
  18. package/lib/features/discover/DiscoverSidebar.js.map +1 -0
  19. package/lib/features/discover/DiscoverSkeletons.js +123 -0
  20. package/lib/features/discover/DiscoverSkeletons.js.map +1 -0
  21. package/lib/features/discover/DiscoverStoryCards.js +193 -87
  22. package/lib/features/discover/DiscoverStoryCards.js.map +1 -1
  23. package/lib/features/discover/followUpQuery.js +42 -0
  24. package/lib/features/discover/followUpQuery.js.map +1 -0
  25. package/lib/features/discover/markets.js +37 -0
  26. package/lib/features/discover/markets.js.map +1 -0
  27. package/lib/features/discover/useDiscoverSidebar.js +148 -0
  28. package/lib/features/discover/useDiscoverSidebar.js.map +1 -0
  29. package/lib/features/discover/weather.js +42 -0
  30. package/lib/features/discover/weather.js.map +1 -0
  31. package/lib/features/expenses/ExpensesAgentChatPane.js +1 -1
  32. package/lib/features/expenses/ExpensesAgentChatPane.js.map +1 -1
  33. package/lib/features/inbox/InboxAgentChatPane.js +1 -1
  34. package/lib/features/inbox/InboxAgentChatPane.js.map +1 -1
  35. package/lib/features/job-search/JobSearchAgentChatPane.js +1 -0
  36. package/lib/features/job-search/JobSearchAgentChatPane.js.map +1 -1
  37. package/lib/features/local-services/LocalServicesAgentChatPane.js +1 -1
  38. package/lib/features/local-services/LocalServicesAgentChatPane.js.map +1 -1
  39. package/lib/features/movies/MoviesAgentChatPane.js +1 -1
  40. package/lib/features/movies/MoviesAgentChatPane.js.map +1 -1
  41. package/lib/features/notion/NotionBlockSheets.js +206 -0
  42. package/lib/features/notion/NotionBlockSheets.js.map +1 -0
  43. package/lib/features/notion/NotionBlockView.js +36 -0
  44. package/lib/features/notion/NotionBlockView.js.map +1 -0
  45. package/lib/features/notion/NotionCommentsSheet.js +461 -0
  46. package/lib/features/notion/NotionCommentsSheet.js.map +1 -0
  47. package/lib/features/notion/NotionConnectionsSheet.js +244 -0
  48. package/lib/features/notion/NotionConnectionsSheet.js.map +1 -0
  49. package/lib/features/notion/NotionHistorySheet.js +439 -0
  50. package/lib/features/notion/NotionHistorySheet.js.map +1 -0
  51. package/lib/features/notion/NotionMediaBlocks.js +803 -0
  52. package/lib/features/notion/NotionMediaBlocks.js.map +1 -0
  53. package/lib/features/notion/NotionMentionSheet.js +279 -0
  54. package/lib/features/notion/NotionMentionSheet.js.map +1 -0
  55. package/lib/features/notion/NotionPageMenu.js +585 -0
  56. package/lib/features/notion/NotionPageMenu.js.map +1 -0
  57. package/lib/features/notion/NotionPageTree.js +220 -0
  58. package/lib/features/notion/NotionPageTree.js.map +1 -0
  59. package/lib/features/notion/NotionPageView.js +1253 -152
  60. package/lib/features/notion/NotionPageView.js.map +1 -1
  61. package/lib/features/notion/NotionShareSheet.js +606 -0
  62. package/lib/features/notion/NotionShareSheet.js.map +1 -0
  63. package/lib/features/notion/NotionSheets.js +87 -15
  64. package/lib/features/notion/NotionSheets.js.map +1 -1
  65. package/lib/features/notion/NotionSidebarSections.js +492 -0
  66. package/lib/features/notion/NotionSidebarSections.js.map +1 -0
  67. package/lib/features/notion/NotionWorkspaceAdmin.js +659 -0
  68. package/lib/features/notion/NotionWorkspaceAdmin.js.map +1 -0
  69. package/lib/features/notion/NotionWorkspaceView.js +257 -45
  70. package/lib/features/notion/NotionWorkspaceView.js.map +1 -1
  71. package/lib/features/notion/database/DatabaseCells.js +554 -0
  72. package/lib/features/notion/database/DatabaseCells.js.map +1 -0
  73. package/lib/features/notion/database/DatabaseDateLayouts.js +792 -0
  74. package/lib/features/notion/database/DatabaseDateLayouts.js.map +1 -0
  75. package/lib/features/notion/database/DatabaseLayouts.js +461 -0
  76. package/lib/features/notion/database/DatabaseLayouts.js.map +1 -0
  77. package/lib/features/notion/database/DatabaseSheets.js +791 -0
  78. package/lib/features/notion/database/DatabaseSheets.js.map +1 -0
  79. package/lib/features/notion/database/NotionDatabaseView.js +817 -0
  80. package/lib/features/notion/database/NotionDatabaseView.js.map +1 -0
  81. package/lib/features/notion/database/RowPropertiesPanel.js +162 -0
  82. package/lib/features/notion/database/RowPropertiesPanel.js.map +1 -0
  83. package/lib/features/notion/database/chartData.js +89 -0
  84. package/lib/features/notion/database/chartData.js.map +1 -0
  85. package/lib/features/notion/database/chartView.js +112 -0
  86. package/lib/features/notion/database/chartView.js.map +1 -0
  87. package/lib/features/notion/database/connectorButton.js +33 -0
  88. package/lib/features/notion/database/connectorButton.js.map +1 -0
  89. package/lib/features/notion/database/databaseCalc.js +208 -0
  90. package/lib/features/notion/database/databaseCalc.js.map +1 -0
  91. package/lib/features/notion/database/databaseCalendar.js +157 -0
  92. package/lib/features/notion/database/databaseCalendar.js.map +1 -0
  93. package/lib/features/notion/database/databaseCsv.js +98 -0
  94. package/lib/features/notion/database/databaseCsv.js.map +1 -0
  95. package/lib/features/notion/database/databaseCsvActions.js +58 -0
  96. package/lib/features/notion/database/databaseCsvActions.js.map +1 -0
  97. package/lib/features/notion/database/databaseFilter.js +473 -0
  98. package/lib/features/notion/database/databaseFilter.js.map +1 -0
  99. package/lib/features/notion/database/databaseFormula.js +1072 -0
  100. package/lib/features/notion/database/databaseFormula.js.map +1 -0
  101. package/lib/features/notion/database/databaseGroup.js +151 -0
  102. package/lib/features/notion/database/databaseGroup.js.map +1 -0
  103. package/lib/features/notion/database/databaseRollup.js +58 -0
  104. package/lib/features/notion/database/databaseRollup.js.map +1 -0
  105. package/lib/features/notion/database/databaseTimeline.js +156 -0
  106. package/lib/features/notion/database/databaseTimeline.js.map +1 -0
  107. package/lib/features/notion/database/databaseView.js +1188 -0
  108. package/lib/features/notion/database/databaseView.js.map +1 -0
  109. package/lib/features/notion/database/databaseViews.js +310 -0
  110. package/lib/features/notion/database/databaseViews.js.map +1 -0
  111. package/lib/features/notion/database/relationSource.js +92 -0
  112. package/lib/features/notion/database/relationSource.js.map +1 -0
  113. package/lib/features/notion/database/uniqueId.js +17 -0
  114. package/lib/features/notion/database/uniqueId.js.map +1 -0
  115. package/lib/features/notion/database/useNotionDatabase.js +617 -0
  116. package/lib/features/notion/database/useNotionDatabase.js.map +1 -0
  117. package/lib/features/notion/notionAgentRunStatus.js +39 -0
  118. package/lib/features/notion/notionAgentRunStatus.js.map +1 -0
  119. package/lib/features/notion/notionCodeLanguages.js +112 -0
  120. package/lib/features/notion/notionCodeLanguages.js.map +1 -0
  121. package/lib/features/notion/notionComments.js +86 -0
  122. package/lib/features/notion/notionComments.js.map +1 -0
  123. package/lib/features/notion/notionConnections.js +74 -0
  124. package/lib/features/notion/notionConnections.js.map +1 -0
  125. package/lib/features/notion/notionDocuments.js +453 -1
  126. package/lib/features/notion/notionDocuments.js.map +1 -1
  127. package/lib/features/notion/notionEditorModel.js +142 -7
  128. package/lib/features/notion/notionEditorModel.js.map +1 -1
  129. package/lib/features/notion/notionMarkdownShortcuts.js +51 -0
  130. package/lib/features/notion/notionMarkdownShortcuts.js.map +1 -0
  131. package/lib/features/notion/notionMedia.js +119 -0
  132. package/lib/features/notion/notionMedia.js.map +1 -0
  133. package/lib/features/notion/notionMentionDate.js +32 -0
  134. package/lib/features/notion/notionMentionDate.js.map +1 -0
  135. package/lib/features/notion/notionMentionOptions.js +162 -0
  136. package/lib/features/notion/notionMentionOptions.js.map +1 -0
  137. package/lib/features/notion/notionNotesAgent.js +445 -0
  138. package/lib/features/notion/notionNotesAgent.js.map +1 -0
  139. package/lib/features/notion/notionPageAccess.js +168 -0
  140. package/lib/features/notion/notionPageAccess.js.map +1 -0
  141. package/lib/features/notion/notionPageActions.js +138 -0
  142. package/lib/features/notion/notionPageActions.js.map +1 -0
  143. package/lib/features/notion/notionPageHistory.js +154 -0
  144. package/lib/features/notion/notionPageHistory.js.map +1 -0
  145. package/lib/features/notion/notionPageKinds.js +200 -0
  146. package/lib/features/notion/notionPageKinds.js.map +1 -0
  147. package/lib/features/notion/notionRecents.js +48 -0
  148. package/lib/features/notion/notionRecents.js.map +1 -0
  149. package/lib/features/notion/notionRichText.js +177 -0
  150. package/lib/features/notion/notionRichText.js.map +1 -0
  151. package/lib/features/notion/notionRichTitle.js +336 -0
  152. package/lib/features/notion/notionRichTitle.js.map +1 -0
  153. package/lib/features/notion/useNotionWorkspace.js +272 -13
  154. package/lib/features/notion/useNotionWorkspace.js.map +1 -1
  155. package/lib/features/notion/usePageActions.js +155 -0
  156. package/lib/features/notion/usePageActions.js.map +1 -0
  157. package/lib/features/resume/ResumeAgentChatPane.js +1 -1
  158. package/lib/features/resume/ResumeAgentChatPane.js.map +1 -1
  159. package/lib/features/shopping/ShoppingAgentChatPane.js +1 -1
  160. package/lib/features/shopping/ShoppingAgentChatPane.js.map +1 -1
  161. package/lib/features/study/StudyAgentChatPane.js +1 -1
  162. package/lib/features/study/StudyAgentChatPane.js.map +1 -1
  163. package/lib/features/travel/TravelAgentChatPane.js +1 -1
  164. package/lib/features/travel/TravelAgentChatPane.js.map +1 -1
  165. package/lib/features/webbuilder/WebBuilderExperience.js +40 -8
  166. package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
  167. package/lib/features/webbuilder/buildFragments.js +1 -1
  168. package/lib/features/webbuilder/buildFragments.js.map +1 -1
  169. package/lib/features/webbuilder/codeFiles.js +302 -0
  170. package/lib/features/webbuilder/codeFiles.js.map +1 -0
  171. package/lib/features/webbuilder/codeHighlight.js +209 -0
  172. package/lib/features/webbuilder/codeHighlight.js.map +1 -0
  173. package/lib/features/webbuilder/components/CodeView.js +682 -52
  174. package/lib/features/webbuilder/components/CodeView.js.map +1 -1
  175. package/lib/features/webbuilder/components/PreviewScreen.js +59 -38
  176. package/lib/features/webbuilder/components/PreviewScreen.js.map +1 -1
  177. package/lib/features/webbuilder/components/ProjectChat.js +3 -3
  178. package/lib/features/webbuilder/components/ProjectChat.js.map +1 -1
  179. package/lib/features/webbuilder/stepLabels.js +68 -0
  180. package/lib/features/webbuilder/stepLabels.js.map +1 -0
  181. package/lib/hooks/useHostChatSteering.js +45 -0
  182. package/lib/hooks/useHostChatSteering.js.map +1 -0
  183. package/lib/screens/Chat/index.js +2 -12
  184. package/lib/screens/Chat/index.js.map +1 -1
  185. package/lib/screens/ExpensesNative/useExpensesHostChat.js +25 -5
  186. package/lib/screens/ExpensesNative/useExpensesHostChat.js.map +1 -1
  187. package/lib/screens/InboxNative/useInboxHostChat.js +25 -5
  188. package/lib/screens/InboxNative/useInboxHostChat.js.map +1 -1
  189. package/lib/screens/JobSearchNative/useJobSearchHostChat.js +25 -5
  190. package/lib/screens/JobSearchNative/useJobSearchHostChat.js.map +1 -1
  191. package/lib/screens/LocalServicesNative/useLocalServicesHostChat.js +25 -5
  192. package/lib/screens/LocalServicesNative/useLocalServicesHostChat.js.map +1 -1
  193. package/lib/screens/MoviesNative/useMoviesHostChat.js +25 -5
  194. package/lib/screens/MoviesNative/useMoviesHostChat.js.map +1 -1
  195. package/lib/screens/NotionPage/index.js +2 -2
  196. package/lib/screens/NotionPage/index.js.map +1 -1
  197. package/lib/screens/ResumeNative/useResumeHostChat.js +25 -5
  198. package/lib/screens/ResumeNative/useResumeHostChat.js.map +1 -1
  199. package/lib/screens/ShoppingNative/useShoppingHostChat.js +25 -5
  200. package/lib/screens/ShoppingNative/useShoppingHostChat.js.map +1 -1
  201. package/lib/screens/StudyNative/useStudyHostChat.js +25 -5
  202. package/lib/screens/StudyNative/useStudyHostChat.js.map +1 -1
  203. package/lib/screens/TravelNative/useTravelHostChat.js +25 -5
  204. package/lib/screens/TravelNative/useTravelHostChat.js.map +1 -1
  205. package/lib/screens/WebBuilderNative/codeWorkspaceApi.js +222 -0
  206. package/lib/screens/WebBuilderNative/codeWorkspaceApi.js.map +1 -0
  207. package/lib/screens/WebBuilderNative/index.js +1 -1
  208. package/lib/screens/WebBuilderNative/index.js.map +1 -1
  209. package/lib/screens/WebBuilderNative/sandboxProxyApi.js +126 -4
  210. package/lib/screens/WebBuilderNative/sandboxProxyApi.js.map +1 -1
  211. package/lib/screens/WebBuilderNative/useWebBuilderHost.js +120 -11
  212. package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
  213. package/package.json +3 -3
@@ -0,0 +1,554 @@
1
+ import {jsx,jsxs}from'react/jsx-runtime';import {useState,useEffect,useMemo}from'react';import {Modal,View,Text,StyleSheet,TextInput,Pressable,FlatList,Switch,ScrollView,ActivityIndicator,Platform}from'react-native';import {Ionicons}from'@expo/vector-icons';import {useApolloClient}from'@apollo/client/index.js';import {NATIVE_NOTION_QUERY_DATABASE}from'../notionDocuments.js';import {textColorOf,washColorOf}from'../notionRichText.js';import {ui,SheetHeader}from'../notionUi.js';import {serverErrorText}from'../notionPageActions.js';import {richTextToPlain,cellToEditorString,dateRangeValue,normalizeStatusOptions,isComputedType,cellDisplayText,propertyTypeLabel,multiSelectNames,selectName,toggleMultiSelect,selectValueToCell,serializeDateRange,relationIds,toggleRelation,filesValue,editorStringToCell,addSchemaOption}from'./databaseView.js';import {formatUniqueId}from'./uniqueId.js';import {useRelationTitles}from'./relationSource.js';import {databaseTitle}from'./useNotionDatabase.js';var _a;
2
+ function optionColors(color, isDark, palette) {
3
+ var _a2, _b;
4
+ const key = color && color !== "default" ? color : "gray";
5
+ return {
6
+ bg: (_a2 = washColorOf(key, isDark)) != null ? _a2 : palette.fill,
7
+ fg: (_b = textColorOf(key, isDark)) != null ? _b : palette.text
8
+ };
9
+ }
10
+ function OptionChip({
11
+ name,
12
+ color,
13
+ isDark,
14
+ palette
15
+ }) {
16
+ const c = optionColors(color, isDark, palette);
17
+ return /* @__PURE__ */ jsx(View, { style: [styles.chip, {
18
+ backgroundColor: c.bg
19
+ }], children: /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.chipText, {
20
+ color: c.fg
21
+ }], children: name }) });
22
+ }
23
+ function optionColorOf(column, name) {
24
+ var _a2, _b;
25
+ return (_b = (_a2 = column.options) == null ? void 0 : _a2.find((o) => o.name === name)) == null ? void 0 : _b.color;
26
+ }
27
+ const IMAGE_EXT = /\.(png|jpe?g|gif|webp|avif|heic|svg)(\?|#|$)/i;
28
+ function rowCoverUrl(properties, columns, source = "auto") {
29
+ var _a2, _b, _c, _d, _e;
30
+ if (source === "none") return null;
31
+ const pool = source !== "auto" && source !== "cover" ? columns.filter((c) => c.name === source) : columns;
32
+ const cover = source === "auto" || source === "cover" ? properties == null ? void 0 : properties.cover : null;
33
+ const fromCover = typeof cover === "string" ? cover : (_e = (_d = (_b = cover == null ? void 0 : cover.url) != null ? _b : (_a2 = cover == null ? void 0 : cover.external) == null ? void 0 : _a2.url) != null ? _d : (_c = cover == null ? void 0 : cover.file) == null ? void 0 : _c.url) != null ? _e : null;
34
+ if (typeof fromCover === "string" && /^https?:/i.test(fromCover)) return fromCover;
35
+ if (source === "cover") return null;
36
+ for (const c of pool) {
37
+ if (c.type !== "files") continue;
38
+ for (const f of filesValue(properties == null ? void 0 : properties[c.name])) {
39
+ if (IMAGE_EXT.test(f.url)) return /^https?:/i.test(f.url) ? f.url : `https://${f.url}`;
40
+ }
41
+ }
42
+ return null;
43
+ }
44
+ function rowTitle(row) {
45
+ var _a2;
46
+ return databaseTitle(row.properties) || richTextToPlain((_a2 = row.properties) == null ? void 0 : _a2.title);
47
+ }
48
+ function CellValue({
49
+ row,
50
+ column,
51
+ getValue,
52
+ isDark,
53
+ palette,
54
+ onToggleCheckbox,
55
+ wrap
56
+ }) {
57
+ const value = getValue(row, column);
58
+ const relations = useRelationTitles();
59
+ switch (column.type) {
60
+ case "relation": {
61
+ const ids = relationIds(value);
62
+ if (!ids.length) return null;
63
+ const titles = ids.map((id) => column.databaseId && (relations == null ? void 0 : relations.titleOf(column.databaseId, id)) || "Untitled");
64
+ return /* @__PURE__ */ jsx(View, { style: [styles.chips, !wrap && styles.chipsInline], children: titles.map((t, i) => /* @__PURE__ */ jsxs(View, { style: [styles.relation, {
65
+ borderBottomColor: palette.textFaint
66
+ }], children: [
67
+ /* @__PURE__ */ jsx(Ionicons, { name: "document-text-outline", size: 13, color: palette.textMuted }),
68
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.value, {
69
+ color: palette.text
70
+ }], children: t })
71
+ ] }, `${ids[i]}`)) });
72
+ }
73
+ case "unique_id": {
74
+ const text = formatUniqueId(value, column.uniquePrefix);
75
+ return text ? /* @__PURE__ */ jsx(Text, { style: [styles.value, styles.number, {
76
+ color: palette.textMuted
77
+ }], children: text }) : null;
78
+ }
79
+ case "title": {
80
+ const text = rowTitle(row);
81
+ return /* @__PURE__ */ jsx(Text, { numberOfLines: wrap ? void 0 : 1, style: [styles.title, {
82
+ color: text ? palette.text : palette.textFaint
83
+ }], children: text || "Untitled" });
84
+ }
85
+ case "checkbox": {
86
+ const on = value === true;
87
+ return /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "checkbox", accessibilityState: {
88
+ checked: on
89
+ }, accessibilityLabel: column.name, onPress: onToggleCheckbox, disabled: !onToggleCheckbox, hitSlop: 8, children: /* @__PURE__ */ jsx(Ionicons, { name: on ? "checkbox" : "square-outline", size: 20, color: on ? palette.primary : palette.textMuted }) });
90
+ }
91
+ case "select":
92
+ case "status": {
93
+ const name = selectName(value);
94
+ return name ? /* @__PURE__ */ jsx(OptionChip, { name, color: optionColorOf(column, name), isDark, palette }) : null;
95
+ }
96
+ case "multi_select": {
97
+ const names = multiSelectNames(value);
98
+ if (!names.length) return null;
99
+ return /* @__PURE__ */ jsx(View, { style: [styles.chips, !wrap && styles.chipsInline], children: names.map((n) => /* @__PURE__ */ jsx(OptionChip, { name: n, color: optionColorOf(column, n), isDark, palette }, n)) });
100
+ }
101
+ default: {
102
+ const text = cellDisplayText(value, column.type);
103
+ if (!text) return null;
104
+ const link = column.type === "url" || column.type === "email" || column.type === "phone";
105
+ return /* @__PURE__ */ jsx(Text, { numberOfLines: wrap ? void 0 : 1, style: [styles.value, {
106
+ color: link ? palette.primary : palette.text
107
+ }, column.type === "number" && styles.number], children: text });
108
+ }
109
+ }
110
+ }
111
+ let HostDatePicker = null;
112
+ try {
113
+ HostDatePicker = (_a = require("@react-native-community/datetimepicker").default) != null ? _a : null;
114
+ } catch (e) {
115
+ HostDatePicker = null;
116
+ }
117
+ const pad = (n) => String(n).padStart(2, "0");
118
+ const ymdOf = (d) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
119
+ function dateOfYmd(day) {
120
+ const m = day ? /^(\d{4})-(\d{2})-(\d{2})/.exec(day) : null;
121
+ return m ? new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3]), 12) : /* @__PURE__ */ new Date();
122
+ }
123
+ function DayField({
124
+ label,
125
+ day,
126
+ isDark,
127
+ palette,
128
+ onChange
129
+ }) {
130
+ const [open, setOpen] = useState(false);
131
+ const [typed, setTyped] = useState(day != null ? day : "");
132
+ useEffect(() => setTyped(day != null ? day : ""), [day]);
133
+ if (!HostDatePicker) {
134
+ return /* @__PURE__ */ jsxs(View, { style: styles.field, children: [
135
+ /* @__PURE__ */ jsx(Text, { style: [styles.fieldLabel, {
136
+ color: palette.textMuted
137
+ }], children: label }),
138
+ /* @__PURE__ */ jsx(TextInput, { value: typed, onChangeText: setTyped, onEndEditing: () => onChange(/^\d{4}-\d{2}-\d{2}$/.test(typed.trim()) ? typed.trim() : null), placeholder: "YYYY-MM-DD", placeholderTextColor: palette.textFaint, keyboardType: "numbers-and-punctuation", style: [styles.input, {
139
+ color: palette.text,
140
+ backgroundColor: palette.fill
141
+ }] })
142
+ ] });
143
+ }
144
+ const Picker = HostDatePicker;
145
+ if (Platform.OS === "ios") {
146
+ return /* @__PURE__ */ jsxs(View, { style: styles.field, children: [
147
+ /* @__PURE__ */ jsx(Text, { style: [styles.fieldLabel, {
148
+ color: palette.textMuted
149
+ }], children: label }),
150
+ /* @__PURE__ */ jsx(Picker, { value: dateOfYmd(day), mode: "date", display: "inline", themeVariant: isDark ? "dark" : "light", accentColor: palette.primary, onChange: (_, d) => d && onChange(ymdOf(d)) })
151
+ ] });
152
+ }
153
+ return /* @__PURE__ */ jsxs(View, { style: styles.field, children: [
154
+ /* @__PURE__ */ jsx(Text, { style: [styles.fieldLabel, {
155
+ color: palette.textMuted
156
+ }], children: label }),
157
+ /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", onPress: () => setOpen(true), style: [styles.input, styles.inputRow, {
158
+ backgroundColor: palette.fill
159
+ }], children: [
160
+ /* @__PURE__ */ jsx(Text, { style: {
161
+ color: day ? palette.text : palette.textFaint,
162
+ fontSize: 16
163
+ }, children: day ? cellDisplayText(day, "date") : "Pick a day" }),
164
+ /* @__PURE__ */ jsx(Ionicons, { name: "calendar-outline", size: 18, color: palette.textMuted })
165
+ ] }),
166
+ open ? /* @__PURE__ */ jsx(Picker, { value: dateOfYmd(day), mode: "date", onChange: (event, d) => {
167
+ setOpen(false);
168
+ if (event.type !== "dismissed" && d) onChange(ymdOf(d));
169
+ } }) : null
170
+ ] });
171
+ }
172
+ function useRelationTargets(databaseId, enabled) {
173
+ const client = useApolloClient();
174
+ const [rows, setRows] = useState([]);
175
+ const [loading, setLoading] = useState(false);
176
+ const [error, setError] = useState(null);
177
+ useEffect(() => {
178
+ if (!enabled || !databaseId) return;
179
+ let live = true;
180
+ setLoading(true);
181
+ setError(null);
182
+ client.query({
183
+ query: NATIVE_NOTION_QUERY_DATABASE,
184
+ variables: {
185
+ input: {
186
+ databaseId,
187
+ pageSize: 200
188
+ }
189
+ },
190
+ fetchPolicy: "network-only"
191
+ }).then((res) => {
192
+ var _a2, _b, _c;
193
+ if (!live) return;
194
+ const results = (_c = (_b = (_a2 = res.data) == null ? void 0 : _a2.queryDatabase) == null ? void 0 : _b.results) != null ? _c : [];
195
+ setRows(results.map((r) => ({
196
+ id: r.id,
197
+ title: databaseTitle(r.properties) || "Untitled"
198
+ })));
199
+ }).catch((err) => live && setError(serverErrorText(err))).finally(() => live && setLoading(false));
200
+ return () => {
201
+ live = false;
202
+ };
203
+ }, [client, databaseId, enabled]);
204
+ return {
205
+ rows,
206
+ loading,
207
+ error
208
+ };
209
+ }
210
+ const TEXT_INPUT_TYPES = /* @__PURE__ */ new Set(["title", "text", "number", "url", "email", "phone", "person", "files"]);
211
+ function CellEditorSheet({
212
+ visible,
213
+ row,
214
+ column,
215
+ schema,
216
+ getValue,
217
+ isDark,
218
+ palette,
219
+ onClose,
220
+ onSave,
221
+ onSaveSchema
222
+ }) {
223
+ var _a2, _b, _c;
224
+ const type = (_a2 = column == null ? void 0 : column.type) != null ? _a2 : "text";
225
+ const value = row && column ? getValue(row, column) : null;
226
+ const stored = row && column ? (_b = row.properties) == null ? void 0 : _b[column.name] : null;
227
+ const [text, setText] = useState("");
228
+ const [query, setQuery] = useState("");
229
+ const [error, setError] = useState(null);
230
+ const [busy, setBusy] = useState(false);
231
+ const [hasEnd, setHasEnd] = useState(false);
232
+ const relation = useRelationTargets(column == null ? void 0 : column.databaseId, visible && type === "relation");
233
+ useEffect(() => {
234
+ var _a3;
235
+ if (!visible || !column) return;
236
+ setText(cellToEditorString(stored, type));
237
+ setQuery("");
238
+ setError(null);
239
+ setHasEnd(Boolean((_a3 = dateRangeValue(stored)) == null ? void 0 : _a3.end));
240
+ }, [visible, column == null ? void 0 : column.name, row == null ? void 0 : row.id]);
241
+ const options = useMemo(() => {
242
+ var _a3;
243
+ const list = (_a3 = column == null ? void 0 : column.options) != null ? _a3 : [];
244
+ return type === "status" ? normalizeStatusOptions(list) : list;
245
+ }, [column == null ? void 0 : column.options, type]);
246
+ const save = async (next) => {
247
+ setBusy(true);
248
+ setError(null);
249
+ const err = await onSave(next);
250
+ setBusy(false);
251
+ if (err) setError(err);
252
+ return err;
253
+ };
254
+ const saveText = async () => {
255
+ if (!column) return;
256
+ const parsed = editorStringToCell(text, type, stored);
257
+ if (!parsed.ok) {
258
+ setError(parsed.error);
259
+ return;
260
+ }
261
+ if (!await save(parsed.value)) onClose();
262
+ };
263
+ const createOption = async (name) => {
264
+ if (!column) return;
265
+ const result = addSchemaOption(schema, column.name, name);
266
+ if (!result.ok) {
267
+ setError(result.error);
268
+ return;
269
+ }
270
+ setBusy(true);
271
+ const err = await onSaveSchema(result.schema);
272
+ setBusy(false);
273
+ if (err) {
274
+ setError(err);
275
+ return;
276
+ }
277
+ setQuery("");
278
+ if (type === "multi_select") await save(toggleMultiSelect(stored, name));
279
+ else if (!await save(selectValueToCell(name))) onClose();
280
+ };
281
+ const renderBody = () => {
282
+ var _a3, _b2;
283
+ if (!column || !row) return null;
284
+ if (isComputedType(type)) {
285
+ return /* @__PURE__ */ jsxs(View, { style: styles.body, children: [
286
+ /* @__PURE__ */ jsx(Text, { style: [styles.readOnly, {
287
+ color: palette.text
288
+ }], children: cellDisplayText(value, type) || "Empty" }),
289
+ /* @__PURE__ */ jsx(Text, { style: [styles.hint, {
290
+ color: palette.textMuted
291
+ }], children: `${propertyTypeLabel(type)} values are computed and can't be edited.` })
292
+ ] });
293
+ }
294
+ if (TEXT_INPUT_TYPES.has(type)) {
295
+ const multiline = type === "title" || type === "text";
296
+ return /* @__PURE__ */ jsxs(View, { style: styles.body, children: [
297
+ /* @__PURE__ */ jsx(TextInput, { value: text, onChangeText: setText, autoFocus: true, multiline, placeholder: type === "person" || type === "files" ? "Separate entries with commas" : "Empty", placeholderTextColor: palette.textFaint, keyboardType: type === "number" ? "decimal-pad" : type === "email" ? "email-address" : type === "phone" ? "phone-pad" : type === "url" ? "url" : "default", autoCapitalize: type === "url" || type === "email" ? "none" : "sentences", returnKeyType: multiline ? "default" : "done", onSubmitEditing: multiline ? void 0 : saveText, style: [styles.input, multiline && styles.inputMultiline, {
298
+ color: palette.text,
299
+ backgroundColor: palette.fill
300
+ }] }),
301
+ /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", onPress: saveText, disabled: busy, style: [styles.primary, {
302
+ backgroundColor: palette.primary,
303
+ opacity: busy ? 0.6 : 1
304
+ }], children: /* @__PURE__ */ jsx(Text, { style: [styles.primaryText, {
305
+ color: palette.onPrimary
306
+ }], children: "Save" }) })
307
+ ] });
308
+ }
309
+ if (type === "select" || type === "status" || type === "multi_select") {
310
+ const multi = type === "multi_select";
311
+ const chosen = multi ? multiSelectNames(stored) : [selectName(stored)].filter(Boolean);
312
+ const q = query.trim();
313
+ const shown = q ? options.filter((o) => o.name.toLowerCase().includes(q.toLowerCase())) : options;
314
+ const exact = options.some((o) => o.name.toLowerCase() === q.toLowerCase());
315
+ return /* @__PURE__ */ jsx(FlatList, { data: shown, keyExtractor: (o) => o.name, keyboardShouldPersistTaps: "handled", contentContainerStyle: styles.body, ListHeaderComponent: /* @__PURE__ */ jsxs(View, { style: styles.listHead, children: [
316
+ /* @__PURE__ */ jsx(TextInput, { value: query, onChangeText: setQuery, placeholder: type === "status" ? "Search status" : "Search or create an option", placeholderTextColor: palette.textFaint, autoCorrect: false, style: [styles.input, {
317
+ color: palette.text,
318
+ backgroundColor: palette.fill
319
+ }] }),
320
+ q && !exact && type !== "status" ? /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", onPress: () => createOption(q), style: [styles.optionRow, {
321
+ backgroundColor: palette.card
322
+ }], children: [
323
+ /* @__PURE__ */ jsx(Ionicons, { name: "add", size: 18, color: palette.primary }),
324
+ /* @__PURE__ */ jsx(Text, { style: [styles.optionLabel, {
325
+ color: palette.text
326
+ }], children: "Create" }),
327
+ /* @__PURE__ */ jsx(OptionChip, { name: q, isDark, palette })
328
+ ] }) : null,
329
+ chosen.length ? /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", onPress: async () => {
330
+ if (!await save(multi ? [] : null)) onClose();
331
+ }, style: styles.clear, children: /* @__PURE__ */ jsx(Text, { style: {
332
+ color: palette.danger,
333
+ fontSize: 15
334
+ }, children: "Clear" }) }) : null
335
+ ] }), renderItem: ({
336
+ item
337
+ }) => {
338
+ const on = chosen.includes(item.name);
339
+ return /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", accessibilityState: {
340
+ selected: on
341
+ }, onPress: async () => {
342
+ if (multi) await save(toggleMultiSelect(stored, item.name));
343
+ else if (!await save(on ? null : selectValueToCell(item.name))) onClose();
344
+ }, style: ({
345
+ pressed
346
+ }) => [styles.optionRow, {
347
+ backgroundColor: pressed ? palette.pressed : palette.card
348
+ }], children: [
349
+ /* @__PURE__ */ jsx(OptionChip, { name: item.name, color: item.color, isDark, palette }),
350
+ /* @__PURE__ */ jsx(View, { style: ui.flex }),
351
+ on ? /* @__PURE__ */ jsx(Ionicons, { name: "checkmark", size: 20, color: palette.primary }) : null
352
+ ] });
353
+ } });
354
+ }
355
+ if (type === "checkbox") {
356
+ return /* @__PURE__ */ jsxs(View, { style: [styles.body, styles.switchRow], children: [
357
+ /* @__PURE__ */ jsx(Text, { style: [styles.optionLabel, {
358
+ color: palette.text
359
+ }], children: column.name }),
360
+ /* @__PURE__ */ jsx(Switch, { value: stored === true, onValueChange: (v) => save(v) })
361
+ ] });
362
+ }
363
+ if (type === "date") {
364
+ const range = dateRangeValue(stored);
365
+ const start = (_a3 = range == null ? void 0 : range.start) != null ? _a3 : null;
366
+ const end = (_b2 = range == null ? void 0 : range.end) != null ? _b2 : null;
367
+ return /* @__PURE__ */ jsxs(ScrollView, { contentContainerStyle: styles.body, keyboardShouldPersistTaps: "handled", children: [
368
+ /* @__PURE__ */ jsx(DayField, { label: "Date", day: start, isDark, palette, onChange: (d) => save(serializeDateRange(d, hasEnd ? end : null, stored)) }),
369
+ /* @__PURE__ */ jsxs(View, { style: styles.switchRow, children: [
370
+ /* @__PURE__ */ jsx(Text, { style: [styles.optionLabel, {
371
+ color: palette.text
372
+ }], children: "End date" }),
373
+ /* @__PURE__ */ jsx(Switch, { value: hasEnd, onValueChange: (on) => {
374
+ setHasEnd(on);
375
+ if (!on && end) save(serializeDateRange(start, null, stored));
376
+ } })
377
+ ] }),
378
+ hasEnd ? /* @__PURE__ */ jsx(DayField, { label: "End", day: end, isDark, palette, onChange: (d) => start && save(serializeDateRange(start, d, stored)) }) : null,
379
+ start ? /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", onPress: async () => {
380
+ if (!await save(null)) onClose();
381
+ }, style: styles.clear, children: /* @__PURE__ */ jsx(Text, { style: {
382
+ color: palette.danger,
383
+ fontSize: 15
384
+ }, children: "Clear date" }) }) : null
385
+ ] });
386
+ }
387
+ if (type === "relation") {
388
+ const ids = relationIds(stored);
389
+ const q = query.trim().toLowerCase();
390
+ const shown = q ? relation.rows.filter((r) => r.title.toLowerCase().includes(q)) : relation.rows;
391
+ if (!column.databaseId) {
392
+ return /* @__PURE__ */ jsx(View, { style: styles.body, children: /* @__PURE__ */ jsx(Text, { style: [styles.hint, {
393
+ color: palette.textMuted
394
+ }], children: "This relation has no target database yet." }) });
395
+ }
396
+ return /* @__PURE__ */ jsx(FlatList, { data: shown, keyExtractor: (r) => r.id, keyboardShouldPersistTaps: "handled", contentContainerStyle: styles.body, ListHeaderComponent: /* @__PURE__ */ jsxs(View, { style: styles.listHead, children: [
397
+ /* @__PURE__ */ jsx(TextInput, { value: query, onChangeText: setQuery, placeholder: "Search pages", placeholderTextColor: palette.textFaint, style: [styles.input, {
398
+ color: palette.text,
399
+ backgroundColor: palette.fill
400
+ }] }),
401
+ relation.loading ? /* @__PURE__ */ jsx(ActivityIndicator, { color: palette.textMuted }) : null,
402
+ relation.error ? /* @__PURE__ */ jsx(Text, { style: {
403
+ color: palette.danger
404
+ }, children: relation.error }) : null
405
+ ] }), renderItem: ({
406
+ item
407
+ }) => {
408
+ const on = ids.includes(item.id);
409
+ return /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", accessibilityState: {
410
+ selected: on
411
+ }, onPress: () => {
412
+ const next = column.relationLimit === 1 ? on ? [] : [{
413
+ id: item.id
414
+ }] : toggleRelation(stored, item.id);
415
+ save(next);
416
+ }, style: ({
417
+ pressed
418
+ }) => [styles.optionRow, {
419
+ backgroundColor: pressed ? palette.pressed : palette.card
420
+ }], children: [
421
+ /* @__PURE__ */ jsx(Ionicons, { name: "document-text-outline", size: 18, color: palette.textMuted }),
422
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.optionLabel, ui.flex, {
423
+ color: palette.text
424
+ }], children: item.title }),
425
+ on ? /* @__PURE__ */ jsx(Ionicons, { name: "checkmark", size: 20, color: palette.primary }) : null
426
+ ] });
427
+ } });
428
+ }
429
+ return /* @__PURE__ */ jsx(View, { style: styles.body, children: /* @__PURE__ */ jsx(Text, { style: [styles.readOnly, {
430
+ color: palette.text
431
+ }], children: cellDisplayText(value, type) || "Empty" }) });
432
+ };
433
+ return /* @__PURE__ */ jsx(Modal, { visible, animationType: "slide", presentationStyle: "pageSheet", onRequestClose: onClose, children: /* @__PURE__ */ jsxs(View, { style: [ui.flex, {
434
+ backgroundColor: palette.bg
435
+ }], children: [
436
+ /* @__PURE__ */ jsx(SheetHeader, { title: (_c = column == null ? void 0 : column.name) != null ? _c : "", onDone: onClose, palette }),
437
+ error ? /* @__PURE__ */ jsx(Text, { style: [styles.error, {
438
+ color: palette.danger
439
+ }], children: error }) : null,
440
+ renderBody()
441
+ ] }) });
442
+ }
443
+ const styles = StyleSheet.create({
444
+ chip: {
445
+ paddingHorizontal: 8,
446
+ paddingVertical: 2,
447
+ borderRadius: 6,
448
+ maxWidth: 180,
449
+ alignSelf: "flex-start"
450
+ },
451
+ chipText: {
452
+ fontSize: 13,
453
+ fontWeight: "500"
454
+ },
455
+ chips: {
456
+ flexDirection: "row",
457
+ flexWrap: "wrap",
458
+ gap: 4
459
+ },
460
+ chipsInline: {
461
+ flexWrap: "nowrap",
462
+ overflow: "hidden"
463
+ },
464
+ relation: {
465
+ flexDirection: "row",
466
+ alignItems: "center",
467
+ gap: 3,
468
+ maxWidth: 180,
469
+ borderBottomWidth: StyleSheet.hairlineWidth
470
+ },
471
+ title: {
472
+ fontSize: 15,
473
+ fontWeight: "600"
474
+ },
475
+ value: {
476
+ fontSize: 14
477
+ },
478
+ number: {
479
+ fontVariant: ["tabular-nums"]
480
+ },
481
+ body: {
482
+ padding: 16,
483
+ gap: 10
484
+ },
485
+ listHead: {
486
+ gap: 10,
487
+ marginBottom: 6
488
+ },
489
+ input: {
490
+ minHeight: 44,
491
+ borderRadius: 12,
492
+ paddingHorizontal: 12,
493
+ paddingVertical: 10,
494
+ fontSize: 16
495
+ },
496
+ inputMultiline: {
497
+ minHeight: 120,
498
+ textAlignVertical: "top"
499
+ },
500
+ inputRow: {
501
+ flexDirection: "row",
502
+ alignItems: "center",
503
+ justifyContent: "space-between"
504
+ },
505
+ primary: {
506
+ height: 46,
507
+ borderRadius: 12,
508
+ alignItems: "center",
509
+ justifyContent: "center"
510
+ },
511
+ primaryText: {
512
+ fontSize: 16,
513
+ fontWeight: "700"
514
+ },
515
+ optionRow: {
516
+ flexDirection: "row",
517
+ alignItems: "center",
518
+ gap: 10,
519
+ minHeight: 48,
520
+ paddingHorizontal: 12,
521
+ borderRadius: 12,
522
+ marginBottom: 6
523
+ },
524
+ optionLabel: {
525
+ fontSize: 15
526
+ },
527
+ clear: {
528
+ alignSelf: "flex-start",
529
+ paddingVertical: 6
530
+ },
531
+ switchRow: {
532
+ flexDirection: "row",
533
+ alignItems: "center",
534
+ justifyContent: "space-between"
535
+ },
536
+ readOnly: {
537
+ fontSize: 16
538
+ },
539
+ hint: {
540
+ fontSize: 13
541
+ },
542
+ error: {
543
+ paddingHorizontal: 16,
544
+ paddingTop: 10,
545
+ fontSize: 13
546
+ },
547
+ field: {
548
+ gap: 6
549
+ },
550
+ fieldLabel: {
551
+ fontSize: 13,
552
+ fontWeight: "600"
553
+ }
554
+ });export{CellEditorSheet,CellValue,OptionChip,optionColors,rowCoverUrl,rowTitle};//# sourceMappingURL=DatabaseCells.js.map