@adminide-stack/yantra-mobile 12.0.141-alpha.1 → 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 (220) 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/devices/bodyComposition.js +116 -0
  12. package/lib/features/devices/bodyComposition.js.map +1 -0
  13. package/lib/features/devices/readings.js.map +1 -1
  14. package/lib/features/devices/session.js +22 -2
  15. package/lib/features/devices/session.js.map +1 -1
  16. package/lib/features/discover/DiscoverArticle.js +105 -92
  17. package/lib/features/discover/DiscoverArticle.js.map +1 -1
  18. package/lib/features/discover/DiscoverFeed.js +97 -48
  19. package/lib/features/discover/DiscoverFeed.js.map +1 -1
  20. package/lib/features/discover/DiscoverFollowUp.js +135 -0
  21. package/lib/features/discover/DiscoverFollowUp.js.map +1 -0
  22. package/lib/features/discover/DiscoverSidebar.js +555 -0
  23. package/lib/features/discover/DiscoverSidebar.js.map +1 -0
  24. package/lib/features/discover/DiscoverSkeletons.js +123 -0
  25. package/lib/features/discover/DiscoverSkeletons.js.map +1 -0
  26. package/lib/features/discover/DiscoverStoryCards.js +193 -87
  27. package/lib/features/discover/DiscoverStoryCards.js.map +1 -1
  28. package/lib/features/discover/followUpQuery.js +42 -0
  29. package/lib/features/discover/followUpQuery.js.map +1 -0
  30. package/lib/features/discover/markets.js +37 -0
  31. package/lib/features/discover/markets.js.map +1 -0
  32. package/lib/features/discover/useDiscoverSidebar.js +148 -0
  33. package/lib/features/discover/useDiscoverSidebar.js.map +1 -0
  34. package/lib/features/discover/weather.js +42 -0
  35. package/lib/features/discover/weather.js.map +1 -0
  36. package/lib/features/expenses/ExpensesAgentChatPane.js +1 -1
  37. package/lib/features/expenses/ExpensesAgentChatPane.js.map +1 -1
  38. package/lib/features/inbox/InboxAgentChatPane.js +1 -1
  39. package/lib/features/inbox/InboxAgentChatPane.js.map +1 -1
  40. package/lib/features/job-search/JobSearchAgentChatPane.js +1 -0
  41. package/lib/features/job-search/JobSearchAgentChatPane.js.map +1 -1
  42. package/lib/features/local-services/LocalServicesAgentChatPane.js +1 -1
  43. package/lib/features/local-services/LocalServicesAgentChatPane.js.map +1 -1
  44. package/lib/features/movies/MoviesAgentChatPane.js +1 -1
  45. package/lib/features/movies/MoviesAgentChatPane.js.map +1 -1
  46. package/lib/features/notion/NotionBlockSheets.js +206 -0
  47. package/lib/features/notion/NotionBlockSheets.js.map +1 -0
  48. package/lib/features/notion/NotionBlockView.js +36 -0
  49. package/lib/features/notion/NotionBlockView.js.map +1 -0
  50. package/lib/features/notion/NotionCommentsSheet.js +461 -0
  51. package/lib/features/notion/NotionCommentsSheet.js.map +1 -0
  52. package/lib/features/notion/NotionConnectionsSheet.js +244 -0
  53. package/lib/features/notion/NotionConnectionsSheet.js.map +1 -0
  54. package/lib/features/notion/NotionHistorySheet.js +439 -0
  55. package/lib/features/notion/NotionHistorySheet.js.map +1 -0
  56. package/lib/features/notion/NotionMediaBlocks.js +803 -0
  57. package/lib/features/notion/NotionMediaBlocks.js.map +1 -0
  58. package/lib/features/notion/NotionMentionSheet.js +279 -0
  59. package/lib/features/notion/NotionMentionSheet.js.map +1 -0
  60. package/lib/features/notion/NotionPageMenu.js +585 -0
  61. package/lib/features/notion/NotionPageMenu.js.map +1 -0
  62. package/lib/features/notion/NotionPageTree.js +220 -0
  63. package/lib/features/notion/NotionPageTree.js.map +1 -0
  64. package/lib/features/notion/NotionPageView.js +1253 -152
  65. package/lib/features/notion/NotionPageView.js.map +1 -1
  66. package/lib/features/notion/NotionShareSheet.js +606 -0
  67. package/lib/features/notion/NotionShareSheet.js.map +1 -0
  68. package/lib/features/notion/NotionSheets.js +87 -15
  69. package/lib/features/notion/NotionSheets.js.map +1 -1
  70. package/lib/features/notion/NotionSidebarSections.js +492 -0
  71. package/lib/features/notion/NotionSidebarSections.js.map +1 -0
  72. package/lib/features/notion/NotionWorkspaceAdmin.js +659 -0
  73. package/lib/features/notion/NotionWorkspaceAdmin.js.map +1 -0
  74. package/lib/features/notion/NotionWorkspaceView.js +257 -45
  75. package/lib/features/notion/NotionWorkspaceView.js.map +1 -1
  76. package/lib/features/notion/database/DatabaseCells.js +554 -0
  77. package/lib/features/notion/database/DatabaseCells.js.map +1 -0
  78. package/lib/features/notion/database/DatabaseDateLayouts.js +792 -0
  79. package/lib/features/notion/database/DatabaseDateLayouts.js.map +1 -0
  80. package/lib/features/notion/database/DatabaseLayouts.js +461 -0
  81. package/lib/features/notion/database/DatabaseLayouts.js.map +1 -0
  82. package/lib/features/notion/database/DatabaseSheets.js +791 -0
  83. package/lib/features/notion/database/DatabaseSheets.js.map +1 -0
  84. package/lib/features/notion/database/NotionDatabaseView.js +817 -0
  85. package/lib/features/notion/database/NotionDatabaseView.js.map +1 -0
  86. package/lib/features/notion/database/RowPropertiesPanel.js +162 -0
  87. package/lib/features/notion/database/RowPropertiesPanel.js.map +1 -0
  88. package/lib/features/notion/database/chartData.js +89 -0
  89. package/lib/features/notion/database/chartData.js.map +1 -0
  90. package/lib/features/notion/database/chartView.js +112 -0
  91. package/lib/features/notion/database/chartView.js.map +1 -0
  92. package/lib/features/notion/database/connectorButton.js +33 -0
  93. package/lib/features/notion/database/connectorButton.js.map +1 -0
  94. package/lib/features/notion/database/databaseCalc.js +208 -0
  95. package/lib/features/notion/database/databaseCalc.js.map +1 -0
  96. package/lib/features/notion/database/databaseCalendar.js +157 -0
  97. package/lib/features/notion/database/databaseCalendar.js.map +1 -0
  98. package/lib/features/notion/database/databaseCsv.js +98 -0
  99. package/lib/features/notion/database/databaseCsv.js.map +1 -0
  100. package/lib/features/notion/database/databaseCsvActions.js +58 -0
  101. package/lib/features/notion/database/databaseCsvActions.js.map +1 -0
  102. package/lib/features/notion/database/databaseFilter.js +473 -0
  103. package/lib/features/notion/database/databaseFilter.js.map +1 -0
  104. package/lib/features/notion/database/databaseFormula.js +1072 -0
  105. package/lib/features/notion/database/databaseFormula.js.map +1 -0
  106. package/lib/features/notion/database/databaseGroup.js +151 -0
  107. package/lib/features/notion/database/databaseGroup.js.map +1 -0
  108. package/lib/features/notion/database/databaseRollup.js +58 -0
  109. package/lib/features/notion/database/databaseRollup.js.map +1 -0
  110. package/lib/features/notion/database/databaseTimeline.js +156 -0
  111. package/lib/features/notion/database/databaseTimeline.js.map +1 -0
  112. package/lib/features/notion/database/databaseView.js +1188 -0
  113. package/lib/features/notion/database/databaseView.js.map +1 -0
  114. package/lib/features/notion/database/databaseViews.js +310 -0
  115. package/lib/features/notion/database/databaseViews.js.map +1 -0
  116. package/lib/features/notion/database/relationSource.js +92 -0
  117. package/lib/features/notion/database/relationSource.js.map +1 -0
  118. package/lib/features/notion/database/uniqueId.js +17 -0
  119. package/lib/features/notion/database/uniqueId.js.map +1 -0
  120. package/lib/features/notion/database/useNotionDatabase.js +617 -0
  121. package/lib/features/notion/database/useNotionDatabase.js.map +1 -0
  122. package/lib/features/notion/notionAgentRunStatus.js +39 -0
  123. package/lib/features/notion/notionAgentRunStatus.js.map +1 -0
  124. package/lib/features/notion/notionCodeLanguages.js +112 -0
  125. package/lib/features/notion/notionCodeLanguages.js.map +1 -0
  126. package/lib/features/notion/notionComments.js +86 -0
  127. package/lib/features/notion/notionComments.js.map +1 -0
  128. package/lib/features/notion/notionConnections.js +74 -0
  129. package/lib/features/notion/notionConnections.js.map +1 -0
  130. package/lib/features/notion/notionDocuments.js +453 -1
  131. package/lib/features/notion/notionDocuments.js.map +1 -1
  132. package/lib/features/notion/notionEditorModel.js +142 -7
  133. package/lib/features/notion/notionEditorModel.js.map +1 -1
  134. package/lib/features/notion/notionMarkdownShortcuts.js +51 -0
  135. package/lib/features/notion/notionMarkdownShortcuts.js.map +1 -0
  136. package/lib/features/notion/notionMedia.js +119 -0
  137. package/lib/features/notion/notionMedia.js.map +1 -0
  138. package/lib/features/notion/notionMentionDate.js +32 -0
  139. package/lib/features/notion/notionMentionDate.js.map +1 -0
  140. package/lib/features/notion/notionMentionOptions.js +162 -0
  141. package/lib/features/notion/notionMentionOptions.js.map +1 -0
  142. package/lib/features/notion/notionNotesAgent.js +445 -0
  143. package/lib/features/notion/notionNotesAgent.js.map +1 -0
  144. package/lib/features/notion/notionPageAccess.js +168 -0
  145. package/lib/features/notion/notionPageAccess.js.map +1 -0
  146. package/lib/features/notion/notionPageActions.js +138 -0
  147. package/lib/features/notion/notionPageActions.js.map +1 -0
  148. package/lib/features/notion/notionPageHistory.js +154 -0
  149. package/lib/features/notion/notionPageHistory.js.map +1 -0
  150. package/lib/features/notion/notionPageKinds.js +200 -0
  151. package/lib/features/notion/notionPageKinds.js.map +1 -0
  152. package/lib/features/notion/notionRecents.js +48 -0
  153. package/lib/features/notion/notionRecents.js.map +1 -0
  154. package/lib/features/notion/notionRichText.js +177 -0
  155. package/lib/features/notion/notionRichText.js.map +1 -0
  156. package/lib/features/notion/notionRichTitle.js +336 -0
  157. package/lib/features/notion/notionRichTitle.js.map +1 -0
  158. package/lib/features/notion/useNotionWorkspace.js +272 -13
  159. package/lib/features/notion/useNotionWorkspace.js.map +1 -1
  160. package/lib/features/notion/usePageActions.js +155 -0
  161. package/lib/features/notion/usePageActions.js.map +1 -0
  162. package/lib/features/resume/ResumeAgentChatPane.js +1 -1
  163. package/lib/features/resume/ResumeAgentChatPane.js.map +1 -1
  164. package/lib/features/shopping/ShoppingAgentChatPane.js +1 -1
  165. package/lib/features/shopping/ShoppingAgentChatPane.js.map +1 -1
  166. package/lib/features/study/StudyAgentChatPane.js +1 -1
  167. package/lib/features/study/StudyAgentChatPane.js.map +1 -1
  168. package/lib/features/travel/TravelAgentChatPane.js +1 -1
  169. package/lib/features/travel/TravelAgentChatPane.js.map +1 -1
  170. package/lib/features/webbuilder/WebBuilderExperience.js +40 -8
  171. package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
  172. package/lib/features/webbuilder/buildFragments.js +1 -1
  173. package/lib/features/webbuilder/buildFragments.js.map +1 -1
  174. package/lib/features/webbuilder/codeFiles.js +302 -0
  175. package/lib/features/webbuilder/codeFiles.js.map +1 -0
  176. package/lib/features/webbuilder/codeHighlight.js +209 -0
  177. package/lib/features/webbuilder/codeHighlight.js.map +1 -0
  178. package/lib/features/webbuilder/components/CodeView.js +682 -52
  179. package/lib/features/webbuilder/components/CodeView.js.map +1 -1
  180. package/lib/features/webbuilder/components/PreviewScreen.js +59 -38
  181. package/lib/features/webbuilder/components/PreviewScreen.js.map +1 -1
  182. package/lib/features/webbuilder/components/ProjectChat.js +3 -3
  183. package/lib/features/webbuilder/components/ProjectChat.js.map +1 -1
  184. package/lib/features/webbuilder/stepLabels.js +68 -0
  185. package/lib/features/webbuilder/stepLabels.js.map +1 -0
  186. package/lib/hooks/useHostChatSteering.js +45 -0
  187. package/lib/hooks/useHostChatSteering.js.map +1 -0
  188. package/lib/screens/Chat/index.js +2 -12
  189. package/lib/screens/Chat/index.js.map +1 -1
  190. package/lib/screens/Devices/index.js +205 -3
  191. package/lib/screens/Devices/index.js.map +1 -1
  192. package/lib/screens/ExpensesNative/useExpensesHostChat.js +25 -5
  193. package/lib/screens/ExpensesNative/useExpensesHostChat.js.map +1 -1
  194. package/lib/screens/InboxNative/useInboxHostChat.js +25 -5
  195. package/lib/screens/InboxNative/useInboxHostChat.js.map +1 -1
  196. package/lib/screens/JobSearchNative/useJobSearchHostChat.js +25 -5
  197. package/lib/screens/JobSearchNative/useJobSearchHostChat.js.map +1 -1
  198. package/lib/screens/LocalServicesNative/useLocalServicesHostChat.js +25 -5
  199. package/lib/screens/LocalServicesNative/useLocalServicesHostChat.js.map +1 -1
  200. package/lib/screens/MoviesNative/useMoviesHostChat.js +25 -5
  201. package/lib/screens/MoviesNative/useMoviesHostChat.js.map +1 -1
  202. package/lib/screens/NotionPage/index.js +2 -2
  203. package/lib/screens/NotionPage/index.js.map +1 -1
  204. package/lib/screens/ResumeNative/useResumeHostChat.js +25 -5
  205. package/lib/screens/ResumeNative/useResumeHostChat.js.map +1 -1
  206. package/lib/screens/ShoppingNative/useShoppingHostChat.js +25 -5
  207. package/lib/screens/ShoppingNative/useShoppingHostChat.js.map +1 -1
  208. package/lib/screens/StudyNative/useStudyHostChat.js +25 -5
  209. package/lib/screens/StudyNative/useStudyHostChat.js.map +1 -1
  210. package/lib/screens/TravelNative/useTravelHostChat.js +25 -5
  211. package/lib/screens/TravelNative/useTravelHostChat.js.map +1 -1
  212. package/lib/screens/WebBuilderNative/codeWorkspaceApi.js +222 -0
  213. package/lib/screens/WebBuilderNative/codeWorkspaceApi.js.map +1 -0
  214. package/lib/screens/WebBuilderNative/index.js +1 -1
  215. package/lib/screens/WebBuilderNative/index.js.map +1 -1
  216. package/lib/screens/WebBuilderNative/sandboxProxyApi.js +126 -4
  217. package/lib/screens/WebBuilderNative/sandboxProxyApi.js.map +1 -1
  218. package/lib/screens/WebBuilderNative/useWebBuilderHost.js +120 -11
  219. package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
  220. package/package.json +4 -4
@@ -0,0 +1,791 @@
1
+ import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {useState,useEffect,useMemo}from'react';import {View,StyleSheet,Text,Pressable,TextInput,Switch,Modal,ScrollView}from'react-native';import {Ionicons}from'@expo/vector-icons';import {ui,SheetHeader}from'../notionUi.js';import {isOrMode,setFilterMode,newCondition,operatorInfo,RELATIVE_DATES,operatorsFor}from'./databaseFilter.js';import {kindsFor,CALC_LABELS}from'./databaseCalc.js';import {isTableGroupable}from'./databaseGroup.js';import {propertyTypeLabel,PROPERTY_TYPES,normalizeStatusOptions}from'./databaseView.js';import {layoutPropertyCandidates,readCardLayout,VIEW_TYPES,CARD_SIZES,buildNewView}from'./databaseViews.js';var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ const PROPERTY_ICONS = {
21
+ title: "text-outline",
22
+ text: "reorder-three-outline",
23
+ number: "calculator-outline",
24
+ select: "chevron-down-circle-outline",
25
+ status: "ellipse-outline",
26
+ multi_select: "list-outline",
27
+ date: "calendar-outline",
28
+ checkbox: "checkbox-outline",
29
+ url: "link-outline",
30
+ email: "at-outline",
31
+ phone: "call-outline",
32
+ person: "person-outline",
33
+ files: "attach-outline",
34
+ relation: "git-network-outline",
35
+ formula: "flask-outline",
36
+ rollup: "search-outline",
37
+ created_time: "time-outline",
38
+ last_edited_time: "time-outline",
39
+ created_by: "person-circle-outline",
40
+ last_edited_by: "person-circle-outline",
41
+ unique_id: "key-outline",
42
+ button: "radio-button-on-outline",
43
+ connector: "flash-outline"
44
+ };
45
+ function propertyIcon(type) {
46
+ var _a;
47
+ return (_a = PROPERTY_ICONS[type]) != null ? _a : "reorder-three-outline";
48
+ }
49
+ function Sheet({
50
+ visible,
51
+ title,
52
+ palette,
53
+ onClose,
54
+ left,
55
+ children
56
+ }) {
57
+ return /* @__PURE__ */ jsx(Modal, { visible, animationType: "slide", presentationStyle: "pageSheet", onRequestClose: onClose, children: /* @__PURE__ */ jsxs(View, { style: [ui.flex, {
58
+ backgroundColor: palette.bg
59
+ }], children: [
60
+ /* @__PURE__ */ jsx(SheetHeader, { title, onDone: onClose, palette, left }),
61
+ /* @__PURE__ */ jsx(ScrollView, { contentContainerStyle: styles.content, keyboardShouldPersistTaps: "handled", children })
62
+ ] }) });
63
+ }
64
+ function Row({
65
+ palette,
66
+ icon,
67
+ label,
68
+ detail,
69
+ onPress,
70
+ right,
71
+ danger,
72
+ first,
73
+ last
74
+ }) {
75
+ return /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: onPress ? "button" : void 0, onPress, disabled: !onPress, style: ({
76
+ pressed
77
+ }) => [styles.row, {
78
+ backgroundColor: pressed ? palette.pressed : palette.card
79
+ }, first && styles.first, last && styles.last], children: [
80
+ icon ? /* @__PURE__ */ jsx(Ionicons, { name: icon, size: 18, color: danger ? palette.danger : palette.textMuted }) : null,
81
+ /* @__PURE__ */ jsxs(View, { style: [styles.rowBody, !last && {
82
+ borderBottomColor: palette.hairline
83
+ }, !last && ui.hairline], children: [
84
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.rowLabel, {
85
+ color: danger ? palette.danger : palette.text
86
+ }], children: label }),
87
+ detail ? /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.rowDetail, {
88
+ color: palette.textMuted
89
+ }], children: detail }) : null,
90
+ right,
91
+ onPress && !right ? /* @__PURE__ */ jsx(Ionicons, { name: "chevron-forward", size: 16, color: palette.textFaint }) : null
92
+ ] })
93
+ ] });
94
+ }
95
+ function Label({
96
+ palette,
97
+ children
98
+ }) {
99
+ return /* @__PURE__ */ jsx(Text, { style: [styles.label, {
100
+ color: palette.textMuted
101
+ }], children });
102
+ }
103
+ function Chips({
104
+ palette,
105
+ options,
106
+ value,
107
+ onChange
108
+ }) {
109
+ return /* @__PURE__ */ jsx(View, { style: styles.chips, children: options.map((o) => {
110
+ const on = o.value === value;
111
+ return /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", accessibilityState: {
112
+ selected: on
113
+ }, onPress: () => onChange(o.value), style: [styles.chip, {
114
+ backgroundColor: on ? palette.primary : palette.fill
115
+ }], children: /* @__PURE__ */ jsx(Text, { style: [styles.chipText, {
116
+ color: on ? palette.onPrimary : palette.text
117
+ }], children: o.label }) }, o.value);
118
+ }) });
119
+ }
120
+ function ChoiceSheet({
121
+ visible,
122
+ title,
123
+ palette,
124
+ choices,
125
+ value,
126
+ onPick,
127
+ onClose
128
+ }) {
129
+ return /* @__PURE__ */ jsx(Sheet, { visible, title, palette, onClose, children: /* @__PURE__ */ jsx(View, { children: choices.map((c, i) => /* @__PURE__ */ jsx(Row, { palette, icon: c.icon, label: c.label, detail: c.detail, first: i === 0, last: i === choices.length - 1, onPress: () => onPick(c.value), right: c.value === value ? /* @__PURE__ */ jsx(Ionicons, { name: "checkmark", size: 20, color: palette.primary }) : /* @__PURE__ */ jsx(View, {}) }, c.value)) }) });
130
+ }
131
+ function ConditionEditor({
132
+ cond,
133
+ column,
134
+ columns,
135
+ palette,
136
+ onChange,
137
+ onRemove
138
+ }) {
139
+ var _a, _b, _c, _d, _e;
140
+ const [picker, setPicker] = useState(null);
141
+ const type = (_a = column == null ? void 0 : column.type) != null ? _a : "text";
142
+ const info = operatorInfo(type, cond.operator);
143
+ const options = column ? column.type === "status" ? normalizeStatusOptions(column.options) : (_b = column.options) != null ? _b : [] : [];
144
+ const values = Array.isArray(cond.value) ? cond.value : cond.value != null ? [String(cond.value)] : [];
145
+ return /* @__PURE__ */ jsxs(View, { style: [styles.condition, {
146
+ backgroundColor: palette.card
147
+ }], children: [
148
+ /* @__PURE__ */ jsxs(View, { style: styles.conditionHead, children: [
149
+ /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", onPress: () => setPicker("property"), style: [styles.select, {
150
+ backgroundColor: palette.fill
151
+ }], children: [
152
+ /* @__PURE__ */ jsx(Ionicons, { name: propertyIcon(type), size: 15, color: palette.textMuted }),
153
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.selectText, {
154
+ color: palette.text
155
+ }], children: (_c = column == null ? void 0 : column.name) != null ? _c : cond.property })
156
+ ] }),
157
+ /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", onPress: () => setPicker("operator"), style: [styles.select, {
158
+ backgroundColor: palette.fill
159
+ }], children: [
160
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.selectText, {
161
+ color: palette.text
162
+ }], children: (_d = info == null ? void 0 : info.label) != null ? _d : cond.operator }),
163
+ /* @__PURE__ */ jsx(Ionicons, { name: "chevron-down", size: 14, color: palette.textMuted })
164
+ ] }),
165
+ /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: "Remove filter", onPress: onRemove, hitSlop: 8, children: /* @__PURE__ */ jsx(Ionicons, { name: "trash-outline", size: 18, color: palette.danger }) })
166
+ ] }),
167
+ (info == null ? void 0 : info.input) === "text" || (info == null ? void 0 : info.input) === "number" || (info == null ? void 0 : info.input) === "days" || (info == null ? void 0 : info.input) === "date" ? /* @__PURE__ */ jsx(TextInput, { value: cond.value == null ? "" : String(cond.value), onChangeText: (v) => onChange(__spreadProps(__spreadValues({}, cond), {
168
+ value: info.input === "number" || info.input === "days" ? v.trim() === "" ? null : v : v
169
+ })), placeholder: info.input === "date" ? "YYYY-MM-DD" : info.input === "days" ? "Days" : "Value", placeholderTextColor: palette.textFaint, keyboardType: info.input === "text" ? "default" : "numbers-and-punctuation", autoCapitalize: "none", style: [styles.input, {
170
+ color: palette.text,
171
+ backgroundColor: palette.fill
172
+ }] }) : null,
173
+ (info == null ? void 0 : info.input) === "relative" ? /* @__PURE__ */ jsx(Chips, { palette, options: RELATIVE_DATES.map((d) => ({
174
+ value: d.value,
175
+ label: d.label
176
+ })), value: typeof cond.value === "string" ? cond.value : null, onChange: (v) => onChange(__spreadProps(__spreadValues({}, cond), {
177
+ value: v
178
+ })) }) : null,
179
+ (info == null ? void 0 : info.input) === "option" || (info == null ? void 0 : info.input) === "options" ? /* @__PURE__ */ jsx(Chips, { palette, options: options.map((o) => ({
180
+ value: o.name,
181
+ label: o.name
182
+ })), value: info.input === "option" ? (_e = values[0]) != null ? _e : null : null, onChange: (name) => {
183
+ if (info.input === "option") onChange(__spreadProps(__spreadValues({}, cond), {
184
+ value: name
185
+ }));
186
+ else {
187
+ const next = values.includes(name) ? values.filter((v) => v !== name) : [...values, name];
188
+ onChange(__spreadProps(__spreadValues({}, cond), {
189
+ value: next
190
+ }));
191
+ }
192
+ } }) : null,
193
+ (info == null ? void 0 : info.input) === "options" && values.length ? /* @__PURE__ */ jsx(Text, { style: [styles.hint, {
194
+ color: palette.textMuted
195
+ }], children: values.join(", ") }) : null,
196
+ /* @__PURE__ */ jsx(ChoiceSheet, { visible: picker === "property", title: "Property", palette, value: cond.property, choices: columns.map((c) => ({
197
+ value: c.name,
198
+ label: c.name,
199
+ icon: propertyIcon(c.type)
200
+ })), onClose: () => setPicker(null), onPick: (name) => {
201
+ setPicker(null);
202
+ const next = columns.find((c) => c.name === name);
203
+ if (next) onChange(__spreadProps(__spreadValues({}, newCondition(next)), {
204
+ id: cond.id,
205
+ conj: cond.conj
206
+ }));
207
+ } }),
208
+ /* @__PURE__ */ jsx(ChoiceSheet, { visible: picker === "operator", title: "Condition", palette, value: cond.operator, choices: operatorsFor(type).map((o) => ({
209
+ value: o.op,
210
+ label: o.label
211
+ })), onClose: () => setPicker(null), onPick: (op) => {
212
+ setPicker(null);
213
+ const nextInfo = operatorInfo(type, op);
214
+ const keep = (nextInfo == null ? void 0 : nextInfo.input) === (info == null ? void 0 : info.input);
215
+ onChange(__spreadProps(__spreadValues({}, cond), {
216
+ operator: op,
217
+ value: keep ? cond.value : null
218
+ }));
219
+ } })
220
+ ] });
221
+ }
222
+ function FilterSheet({
223
+ visible,
224
+ palette,
225
+ columns,
226
+ conditions,
227
+ onChange,
228
+ onClose
229
+ }) {
230
+ const [adding, setAdding] = useState(false);
231
+ const orMode = isOrMode(conditions);
232
+ const filterable = columns.filter((c) => c.type !== "button");
233
+ return /* @__PURE__ */ jsxs(Sheet, { visible, title: "Filter", palette, onClose, left: conditions.length ? {
234
+ label: "Clear",
235
+ onPress: () => onChange([])
236
+ } : void 0, children: [
237
+ conditions.length > 1 ? /* @__PURE__ */ jsxs(View, { style: styles.block, children: [
238
+ /* @__PURE__ */ jsx(Label, { palette, children: "Rows must match" }),
239
+ /* @__PURE__ */ jsx(Chips, { palette, options: [{
240
+ value: "and",
241
+ label: "All filters"
242
+ }, {
243
+ value: "or",
244
+ label: "Any filter"
245
+ }], value: orMode ? "or" : "and", onChange: (m) => onChange(setFilterMode(conditions, m)) })
246
+ ] }) : null,
247
+ conditions.map((cond) => /* @__PURE__ */ jsx(ConditionEditor, { cond, column: columns.find((c) => c.name === cond.property), columns: filterable, palette, onChange: (next) => onChange(conditions.map((c) => c.id === cond.id ? next : c)), onRemove: () => onChange(conditions.filter((c) => c.id !== cond.id)) }, cond.id)),
248
+ !conditions.length ? /* @__PURE__ */ jsx(Text, { style: [styles.empty, {
249
+ color: palette.textMuted
250
+ }], children: "No filters. Add one to show only the rows that match." }) : null,
251
+ /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", onPress: () => setAdding(true), style: [styles.add, {
252
+ backgroundColor: palette.primarySoft
253
+ }], children: [
254
+ /* @__PURE__ */ jsx(Ionicons, { name: "add", size: 18, color: palette.primary }),
255
+ /* @__PURE__ */ jsx(Text, { style: [styles.addText, {
256
+ color: palette.primary
257
+ }], children: "Add a filter" })
258
+ ] }),
259
+ /* @__PURE__ */ jsx(ChoiceSheet, { visible: adding, title: "Filter by", palette, choices: filterable.map((c) => ({
260
+ value: c.name,
261
+ label: c.name,
262
+ icon: propertyIcon(c.type)
263
+ })), onClose: () => setAdding(false), onPick: (name) => {
264
+ setAdding(false);
265
+ const column = filterable.find((c) => c.name === name);
266
+ if (!column) return;
267
+ const cond = newCondition(column);
268
+ onChange([...conditions, orMode ? __spreadProps(__spreadValues({}, cond), {
269
+ conj: "or"
270
+ }) : cond]);
271
+ } })
272
+ ] });
273
+ }
274
+ function SortSheet({
275
+ visible,
276
+ palette,
277
+ columns,
278
+ sorts,
279
+ onChange,
280
+ onClose
281
+ }) {
282
+ const [adding, setAdding] = useState(false);
283
+ const free = columns.filter((c) => !sorts.some((s) => s.property === c.name) && c.type !== "button");
284
+ const move = (i, d) => {
285
+ const j = i + d;
286
+ if (j < 0 || j >= sorts.length) return;
287
+ const next = [...sorts];
288
+ [next[i], next[j]] = [next[j], next[i]];
289
+ onChange(next);
290
+ };
291
+ return /* @__PURE__ */ jsxs(Sheet, { visible, title: "Sort", palette, onClose, left: sorts.length ? {
292
+ label: "Clear",
293
+ onPress: () => onChange([])
294
+ } : void 0, children: [
295
+ sorts.map((s, i) => {
296
+ var _a;
297
+ const column = columns.find((c) => c.name === s.property);
298
+ return /* @__PURE__ */ jsxs(View, { style: [styles.condition, {
299
+ backgroundColor: palette.card
300
+ }], children: [
301
+ /* @__PURE__ */ jsxs(View, { style: styles.conditionHead, children: [
302
+ /* @__PURE__ */ jsx(Ionicons, { name: propertyIcon((_a = column == null ? void 0 : column.type) != null ? _a : "text"), size: 16, color: palette.textMuted }),
303
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.rowLabel, ui.flex, {
304
+ color: palette.text
305
+ }], children: s.property }),
306
+ /* @__PURE__ */ jsx(Pressable, { accessibilityLabel: "Move up", onPress: () => move(i, -1), hitSlop: 6, children: /* @__PURE__ */ jsx(Ionicons, { name: "arrow-up", size: 18, color: i ? palette.textMuted : palette.textFaint }) }),
307
+ /* @__PURE__ */ jsx(Pressable, { accessibilityLabel: "Move down", onPress: () => move(i, 1), hitSlop: 6, children: /* @__PURE__ */ jsx(Ionicons, { name: "arrow-down", size: 18, color: i < sorts.length - 1 ? palette.textMuted : palette.textFaint }) }),
308
+ /* @__PURE__ */ jsx(Pressable, { accessibilityLabel: "Remove sort", onPress: () => onChange(sorts.filter((x) => x.property !== s.property)), hitSlop: 6, children: /* @__PURE__ */ jsx(Ionicons, { name: "trash-outline", size: 18, color: palette.danger }) })
309
+ ] }),
310
+ /* @__PURE__ */ jsx(Chips, { palette, options: [{
311
+ value: "ascending",
312
+ label: "Ascending"
313
+ }, {
314
+ value: "descending",
315
+ label: "Descending"
316
+ }], value: s.direction, onChange: (direction) => onChange(sorts.map((x) => x.property === s.property ? __spreadProps(__spreadValues({}, x), {
317
+ direction
318
+ }) : x)) })
319
+ ] }, s.property);
320
+ }),
321
+ !sorts.length ? /* @__PURE__ */ jsx(Text, { style: [styles.empty, {
322
+ color: palette.textMuted
323
+ }], children: "Rows show in the order they were added." }) : null,
324
+ free.length ? /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", onPress: () => setAdding(true), style: [styles.add, {
325
+ backgroundColor: palette.primarySoft
326
+ }], children: [
327
+ /* @__PURE__ */ jsx(Ionicons, { name: "add", size: 18, color: palette.primary }),
328
+ /* @__PURE__ */ jsx(Text, { style: [styles.addText, {
329
+ color: palette.primary
330
+ }], children: "Add a sort" })
331
+ ] }) : null,
332
+ /* @__PURE__ */ jsx(ChoiceSheet, { visible: adding, title: "Sort by", palette, choices: free.map((c) => ({
333
+ value: c.name,
334
+ label: c.name,
335
+ icon: propertyIcon(c.type)
336
+ })), onClose: () => setAdding(false), onPick: (name) => {
337
+ setAdding(false);
338
+ onChange([...sorts, {
339
+ property: name,
340
+ direction: "ascending"
341
+ }]);
342
+ } })
343
+ ] });
344
+ }
345
+ function PropertiesSheet({
346
+ visible,
347
+ palette,
348
+ columns,
349
+ visibleNames,
350
+ onChangeVisible,
351
+ onEdit,
352
+ onAdd,
353
+ onClose,
354
+ children
355
+ }) {
356
+ const title = columns.find((c) => c.type === "title");
357
+ const shown = visibleNames.map((n) => columns.find((c) => c.name === n)).filter((c) => !!c);
358
+ const hidden = columns.filter((c) => c.type !== "title" && !visibleNames.includes(c.name));
359
+ const move = (name, d) => {
360
+ const i = visibleNames.indexOf(name);
361
+ const j = i + d;
362
+ if (i < 0 || j < 0 || j >= visibleNames.length) return;
363
+ const next = [...visibleNames];
364
+ [next[i], next[j]] = [next[j], next[i]];
365
+ onChangeVisible(next);
366
+ };
367
+ return /* @__PURE__ */ jsxs(Sheet, { visible, title: "Properties", palette, onClose, children: [
368
+ title ? /* @__PURE__ */ jsx(View, { style: styles.block, children: /* @__PURE__ */ jsx(Row, { palette, icon: propertyIcon("title"), label: title.name, detail: "Title", first: true, last: true, onPress: () => onEdit(title) }) }) : null,
369
+ /* @__PURE__ */ jsx(Label, { palette, children: "Shown in this view" }),
370
+ /* @__PURE__ */ jsxs(View, { style: styles.block, children: [
371
+ shown.map((c, i) => /* @__PURE__ */ jsx(Row, { palette, icon: propertyIcon(c.type), label: c.name, first: i === 0, last: i === shown.length - 1, onPress: () => onEdit(c), right: /* @__PURE__ */ jsxs(View, { style: styles.rowActions, children: [
372
+ /* @__PURE__ */ jsx(Pressable, { accessibilityLabel: `Move ${c.name} up`, onPress: () => move(c.name, -1), hitSlop: 6, children: /* @__PURE__ */ jsx(Ionicons, { name: "arrow-up", size: 17, color: palette.textMuted }) }),
373
+ /* @__PURE__ */ jsx(Pressable, { accessibilityLabel: `Move ${c.name} down`, onPress: () => move(c.name, 1), hitSlop: 6, children: /* @__PURE__ */ jsx(Ionicons, { name: "arrow-down", size: 17, color: palette.textMuted }) }),
374
+ /* @__PURE__ */ jsx(Pressable, { accessibilityLabel: `Hide ${c.name}`, onPress: () => onChangeVisible(visibleNames.filter((n) => n !== c.name)), hitSlop: 6, children: /* @__PURE__ */ jsx(Ionicons, { name: "eye", size: 19, color: palette.primary }) })
375
+ ] }) }, c.name)),
376
+ !shown.length ? /* @__PURE__ */ jsx(Text, { style: [styles.empty, {
377
+ color: palette.textMuted
378
+ }], children: "Only the title is shown." }) : null
379
+ ] }),
380
+ hidden.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
381
+ /* @__PURE__ */ jsx(Label, { palette, children: "Hidden" }),
382
+ /* @__PURE__ */ jsx(View, { style: styles.block, children: hidden.map((c, i) => /* @__PURE__ */ jsx(Row, { palette, icon: propertyIcon(c.type), label: c.name, first: i === 0, last: i === hidden.length - 1, onPress: () => onEdit(c), right: /* @__PURE__ */ jsx(Pressable, { accessibilityLabel: `Show ${c.name}`, onPress: () => onChangeVisible([...visibleNames, c.name]), hitSlop: 6, children: /* @__PURE__ */ jsx(Ionicons, { name: "eye-off-outline", size: 19, color: palette.textFaint }) }) }, c.name)) })
383
+ ] }) : null,
384
+ /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", onPress: onAdd, style: [styles.add, {
385
+ backgroundColor: palette.primarySoft
386
+ }], children: [
387
+ /* @__PURE__ */ jsx(Ionicons, { name: "add", size: 18, color: palette.primary }),
388
+ /* @__PURE__ */ jsx(Text, { style: [styles.addText, {
389
+ color: palette.primary
390
+ }], children: "New property" })
391
+ ] }),
392
+ children
393
+ ] });
394
+ }
395
+ const EDITABLE_TYPES = PROPERTY_TYPES.filter((t) => t.type !== "connector" && t.type !== "button");
396
+ function PropertyEditorSheet({
397
+ visible,
398
+ palette,
399
+ column,
400
+ isNew,
401
+ calculation,
402
+ onClose,
403
+ onRename,
404
+ onChangeType,
405
+ onDelete,
406
+ onCalculation,
407
+ onCreate
408
+ }) {
409
+ var _a, _b;
410
+ const [name, setName] = useState("");
411
+ const [type, setType] = useState("text");
412
+ const [picker, setPicker] = useState(null);
413
+ const [error, setError] = useState(null);
414
+ const [busy, setBusy] = useState(false);
415
+ useEffect(() => {
416
+ var _a2, _b2;
417
+ if (!visible) return;
418
+ setName((_a2 = column == null ? void 0 : column.name) != null ? _a2 : "");
419
+ setType((_b2 = column == null ? void 0 : column.type) != null ? _b2 : "text");
420
+ setError(null);
421
+ }, [visible, column]);
422
+ const isTitle = (column == null ? void 0 : column.type) === "title";
423
+ const run = async (fn, close = false) => {
424
+ setBusy(true);
425
+ setError(null);
426
+ const err = await fn();
427
+ setBusy(false);
428
+ if (err) setError(err);
429
+ else if (close) onClose();
430
+ };
431
+ const kinds = column ? kindsFor(column.type) : [];
432
+ return /* @__PURE__ */ jsxs(Sheet, { visible, title: isNew ? "New property" : "Edit property", palette, onClose, left: isNew ? {
433
+ label: "Add",
434
+ disabled: busy || !name.trim(),
435
+ onPress: () => run(() => onCreate(name.trim(), type), true)
436
+ } : void 0, children: [
437
+ /* @__PURE__ */ jsx(Label, { palette, children: "Name" }),
438
+ /* @__PURE__ */ jsx(TextInput, { value: name, onChangeText: setName, autoFocus: isNew, placeholder: "Property name", placeholderTextColor: palette.textFaint, returnKeyType: "done", onEndEditing: () => {
439
+ if (!isNew && column && name.trim() && name.trim() !== column.name) {
440
+ run(() => onRename(name.trim()));
441
+ }
442
+ }, style: [styles.input, {
443
+ color: palette.text,
444
+ backgroundColor: palette.fill
445
+ }] }),
446
+ error ? /* @__PURE__ */ jsx(Text, { style: [styles.error, {
447
+ color: palette.danger
448
+ }], children: error }) : null,
449
+ /* @__PURE__ */ jsxs(View, { style: styles.block, children: [
450
+ /* @__PURE__ */ jsx(Row, { palette, icon: propertyIcon(type), label: "Type", detail: propertyTypeLabel(type), first: true, last: isNew || !kinds.length, onPress: isTitle ? void 0 : () => setPicker("type") }),
451
+ !isNew && kinds.length ? /* @__PURE__ */ jsx(Row, { palette, icon: "stats-chart-outline", label: "Calculate", detail: calculation ? (_b = (_a = CALC_LABELS[calculation]) == null ? void 0 : _a.menu) != null ? _b : "None" : "None", last: true, onPress: () => setPicker("calc") }) : null
452
+ ] }),
453
+ !isNew && !isTitle ? /* @__PURE__ */ jsx(View, { style: styles.block, children: /* @__PURE__ */ jsx(Row, { palette, icon: "trash-outline", label: "Delete property", danger: true, first: true, last: true, onPress: onDelete }) }) : null,
454
+ /* @__PURE__ */ jsx(ChoiceSheet, { visible: picker === "type", title: "Type", palette, value: type, choices: EDITABLE_TYPES.map((t) => ({
455
+ value: t.type,
456
+ label: t.label,
457
+ icon: propertyIcon(t.type)
458
+ })), onClose: () => setPicker(null), onPick: (t) => {
459
+ setPicker(null);
460
+ setType(t);
461
+ if (!isNew && column && t !== column.type) run(() => onChangeType(t));
462
+ } }),
463
+ /* @__PURE__ */ jsx(ChoiceSheet, { visible: picker === "calc", title: "Calculate", palette, value: calculation != null ? calculation : "none", choices: ["none", ...kinds.filter((k) => k !== "none")].map((k) => {
464
+ var _a2, _b2;
465
+ return {
466
+ value: k,
467
+ label: (_b2 = (_a2 = CALC_LABELS[k]) == null ? void 0 : _a2.menu) != null ? _b2 : k
468
+ };
469
+ }), onClose: () => setPicker(null), onPick: (k) => {
470
+ setPicker(null);
471
+ onCalculation(k);
472
+ } })
473
+ ] });
474
+ }
475
+ function ViewOptionsSheet({
476
+ visible,
477
+ palette,
478
+ type,
479
+ groupBy,
480
+ settings,
481
+ columns,
482
+ onChangeType,
483
+ onChangeGroupBy,
484
+ onChangeSettings,
485
+ onClose
486
+ }) {
487
+ var _a, _b;
488
+ const [picker, setPicker] = useState(null);
489
+ const groupCandidates = useMemo(() => {
490
+ if (type === "board" || type === "calendar" || type === "timeline") {
491
+ return layoutPropertyCandidates(type, columns);
492
+ }
493
+ if (type === "table" || type === "list") return columns.filter((c) => c.type !== "title" && isTableGroupable(c));
494
+ return [];
495
+ }, [columns, type]);
496
+ const card = readCardLayout(settings, {
497
+ cover: true
498
+ });
499
+ const fileColumns = columns.filter((c) => c.type === "files");
500
+ const groupLabel = type === "calendar" || type === "timeline" ? "Date property" : type === "board" ? "Group by" : "Group";
501
+ return /* @__PURE__ */ jsxs(Sheet, { visible, title: "View options", palette, onClose, children: [
502
+ /* @__PURE__ */ jsxs(View, { style: styles.block, children: [
503
+ /* @__PURE__ */ jsx(Row, { palette, icon: "grid-outline", label: "Layout", detail: (_a = VIEW_TYPES.find((v) => v.type === type)) == null ? void 0 : _a.label, first: true, last: !groupCandidates.length && type !== "board", onPress: () => setPicker("layout") }),
504
+ groupCandidates.length || type === "board" ? /* @__PURE__ */ jsx(Row, { palette, icon: "albums-outline", label: groupLabel, detail: groupBy != null ? groupBy : "None", last: true, onPress: () => setPicker("group") }) : null
505
+ ] }),
506
+ type === "board" || (type === "table" || type === "list") && groupBy ? /* @__PURE__ */ jsx(View, { style: styles.block, children: /* @__PURE__ */ jsx(Row, { palette, icon: "eye-off-outline", label: "Hide empty groups", first: true, last: true, right: /* @__PURE__ */ jsx(Switch, { value: Boolean(settings.hideEmptyGroups), onValueChange: (v) => onChangeSettings({
507
+ hideEmptyGroups: v || void 0
508
+ }) }) }) }) : null,
509
+ type === "table" ? /* @__PURE__ */ jsx(View, { style: styles.block, children: /* @__PURE__ */ jsx(Row, { palette, icon: "return-down-forward-outline", label: "Wrap all columns", first: true, last: true, right: /* @__PURE__ */ jsx(Switch, { value: Boolean(settings.wrap), onValueChange: (v) => onChangeSettings({
510
+ wrap: v || void 0
511
+ }) }) }) }) : null,
512
+ type === "gallery" ? /* @__PURE__ */ jsxs(Fragment, { children: [
513
+ /* @__PURE__ */ jsx(Label, { palette, children: "Card size" }),
514
+ /* @__PURE__ */ jsx(Chips, { palette, options: CARD_SIZES.map((c) => ({
515
+ value: c.size,
516
+ label: c.label
517
+ })), value: card.size, onChange: (size) => onChangeSettings({
518
+ cardSize: size
519
+ }) }),
520
+ /* @__PURE__ */ jsx(View, { style: [styles.block, styles.spaced], children: /* @__PURE__ */ jsx(Row, { palette, icon: "image-outline", label: "Card preview", detail: card.coverSource === "auto" ? "Page cover or first image" : card.coverSource === "cover" ? "Page cover" : card.coverSource === "none" ? "None" : card.coverSource, first: true, last: true, onPress: () => setPicker("cover") }) })
521
+ ] }) : null,
522
+ /* @__PURE__ */ jsx(ChoiceSheet, { visible: picker === "layout", title: "Layout", palette, value: type, choices: VIEW_TYPES.map((v) => ({
523
+ value: v.type,
524
+ label: v.label,
525
+ detail: v.hint
526
+ })), onClose: () => setPicker(null), onPick: (t) => {
527
+ setPicker(null);
528
+ onChangeType(t);
529
+ } }),
530
+ /* @__PURE__ */ jsx(ChoiceSheet, { visible: picker === "group", title: groupLabel, palette, value: groupBy != null ? groupBy : "__none", choices: [...type === "calendar" || type === "timeline" ? [] : [{
531
+ value: "__none",
532
+ label: "None"
533
+ }], ...groupCandidates.map((c) => ({
534
+ value: c.name,
535
+ label: c.name,
536
+ icon: propertyIcon(c.type)
537
+ }))], onClose: () => setPicker(null), onPick: (name) => {
538
+ setPicker(null);
539
+ onChangeGroupBy(name === "__none" ? null : name);
540
+ } }),
541
+ /* @__PURE__ */ jsx(ChoiceSheet, { visible: picker === "cover", title: "Card preview", palette, value: (_b = card.coverSource) != null ? _b : "auto", choices: [{
542
+ value: "auto",
543
+ label: "Page cover or first image"
544
+ }, {
545
+ value: "cover",
546
+ label: "Page cover"
547
+ }, ...fileColumns.map((c) => ({
548
+ value: c.name,
549
+ label: c.name,
550
+ icon: propertyIcon("files")
551
+ })), {
552
+ value: "none",
553
+ label: "None"
554
+ }], onClose: () => setPicker(null), onPick: (source) => {
555
+ setPicker(null);
556
+ onChangeSettings({
557
+ cardCoverSource: source,
558
+ cardCover: source !== "none"
559
+ });
560
+ } })
561
+ ] });
562
+ }
563
+ function NewViewSheet({
564
+ visible,
565
+ palette,
566
+ columns,
567
+ onCreate,
568
+ onClose
569
+ }) {
570
+ var _a, _b, _c, _d;
571
+ const [type, setType] = useState("table");
572
+ const [name, setName] = useState("");
573
+ const [layoutProperty, setLayoutProperty] = useState(null);
574
+ const [error, setError] = useState(null);
575
+ const [busy, setBusy] = useState(false);
576
+ useEffect(() => {
577
+ if (!visible) return;
578
+ setType("table");
579
+ setName("");
580
+ setLayoutProperty(null);
581
+ setError(null);
582
+ }, [visible]);
583
+ const candidates = layoutPropertyCandidates(type, columns);
584
+ const label = (_b = (_a = VIEW_TYPES.find((v) => v.type === type)) == null ? void 0 : _a.label) != null ? _b : "Table";
585
+ const submit = async () => {
586
+ const result = buildNewView({
587
+ type,
588
+ name: name.trim() || label,
589
+ layoutProperty
590
+ }, columns);
591
+ if (!result.ok) {
592
+ setError(result.error);
593
+ return;
594
+ }
595
+ setBusy(true);
596
+ const err = await onCreate(result.input);
597
+ setBusy(false);
598
+ if (err) setError(err);
599
+ else onClose();
600
+ };
601
+ return /* @__PURE__ */ jsxs(Sheet, { visible, title: "New view", palette, onClose, left: {
602
+ label: "Create",
603
+ onPress: submit,
604
+ disabled: busy
605
+ }, children: [
606
+ /* @__PURE__ */ jsx(Label, { palette, children: "Name" }),
607
+ /* @__PURE__ */ jsx(TextInput, { value: name, onChangeText: setName, placeholder: label, placeholderTextColor: palette.textFaint, style: [styles.input, {
608
+ color: palette.text,
609
+ backgroundColor: palette.fill
610
+ }] }),
611
+ /* @__PURE__ */ jsx(Label, { palette, children: "Layout" }),
612
+ /* @__PURE__ */ jsx(View, { style: styles.grid, children: VIEW_TYPES.map((v) => {
613
+ const on = v.type === type;
614
+ return /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", accessibilityState: {
615
+ selected: on
616
+ }, onPress: () => {
617
+ setType(v.type);
618
+ setLayoutProperty(null);
619
+ setError(null);
620
+ }, style: [styles.tile, {
621
+ backgroundColor: on ? palette.primarySoft : palette.card,
622
+ borderColor: on ? palette.primary : palette.hairline
623
+ }], children: [
624
+ /* @__PURE__ */ jsx(Text, { style: [styles.glyph, {
625
+ color: on ? palette.primary : palette.textMuted
626
+ }], children: v.glyph }),
627
+ /* @__PURE__ */ jsx(Text, { style: [styles.tileLabel, {
628
+ color: palette.text
629
+ }], children: v.label }),
630
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 2, style: [styles.tileHint, {
631
+ color: palette.textMuted
632
+ }], children: v.hint })
633
+ ] }, v.type);
634
+ }) }),
635
+ candidates.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
636
+ /* @__PURE__ */ jsx(Label, { palette, children: type === "board" ? "Group by" : "Date property" }),
637
+ /* @__PURE__ */ jsx(Chips, { palette, options: candidates.map((c) => ({
638
+ value: c.name,
639
+ label: c.name
640
+ })), value: (_d = layoutProperty != null ? layoutProperty : (_c = candidates[0]) == null ? void 0 : _c.name) != null ? _d : null, onChange: setLayoutProperty })
641
+ ] }) : null,
642
+ error ? /* @__PURE__ */ jsx(Text, { style: [styles.error, {
643
+ color: palette.danger
644
+ }], children: error }) : null
645
+ ] });
646
+ }
647
+ const styles = StyleSheet.create({
648
+ content: {
649
+ padding: 16,
650
+ paddingBottom: 48,
651
+ gap: 10
652
+ },
653
+ block: {
654
+ marginBottom: 8
655
+ },
656
+ spaced: {
657
+ marginTop: 8
658
+ },
659
+ label: {
660
+ fontSize: 13,
661
+ fontWeight: "600",
662
+ marginTop: 6,
663
+ textTransform: "uppercase",
664
+ letterSpacing: 0.4
665
+ },
666
+ row: {
667
+ flexDirection: "row",
668
+ alignItems: "center",
669
+ paddingLeft: 14,
670
+ gap: 12
671
+ },
672
+ first: {
673
+ borderTopLeftRadius: 14,
674
+ borderTopRightRadius: 14
675
+ },
676
+ last: {
677
+ borderBottomLeftRadius: 14,
678
+ borderBottomRightRadius: 14
679
+ },
680
+ rowBody: {
681
+ flex: 1,
682
+ flexDirection: "row",
683
+ alignItems: "center",
684
+ gap: 8,
685
+ minHeight: 50,
686
+ paddingRight: 14
687
+ },
688
+ rowLabel: {
689
+ flex: 1,
690
+ fontSize: 16
691
+ },
692
+ rowDetail: {
693
+ fontSize: 15,
694
+ maxWidth: "50%"
695
+ },
696
+ rowActions: {
697
+ flexDirection: "row",
698
+ alignItems: "center",
699
+ gap: 14
700
+ },
701
+ chips: {
702
+ flexDirection: "row",
703
+ flexWrap: "wrap",
704
+ gap: 8
705
+ },
706
+ chip: {
707
+ paddingHorizontal: 12,
708
+ paddingVertical: 7,
709
+ borderRadius: 999
710
+ },
711
+ chipText: {
712
+ fontSize: 14,
713
+ fontWeight: "600"
714
+ },
715
+ condition: {
716
+ borderRadius: 14,
717
+ padding: 12,
718
+ gap: 10
719
+ },
720
+ conditionHead: {
721
+ flexDirection: "row",
722
+ alignItems: "center",
723
+ gap: 8
724
+ },
725
+ select: {
726
+ flexShrink: 1,
727
+ flexDirection: "row",
728
+ alignItems: "center",
729
+ gap: 6,
730
+ paddingHorizontal: 10,
731
+ height: 36,
732
+ borderRadius: 10
733
+ },
734
+ selectText: {
735
+ fontSize: 15,
736
+ flexShrink: 1
737
+ },
738
+ input: {
739
+ minHeight: 44,
740
+ borderRadius: 12,
741
+ paddingHorizontal: 12,
742
+ fontSize: 16
743
+ },
744
+ hint: {
745
+ fontSize: 13
746
+ },
747
+ empty: {
748
+ fontSize: 14,
749
+ paddingVertical: 8
750
+ },
751
+ add: {
752
+ flexDirection: "row",
753
+ alignItems: "center",
754
+ justifyContent: "center",
755
+ gap: 6,
756
+ height: 46,
757
+ borderRadius: 12,
758
+ marginTop: 4
759
+ },
760
+ addText: {
761
+ fontSize: 15,
762
+ fontWeight: "700"
763
+ },
764
+ error: {
765
+ fontSize: 13
766
+ },
767
+ grid: {
768
+ flexDirection: "row",
769
+ flexWrap: "wrap",
770
+ gap: 10
771
+ },
772
+ tile: {
773
+ width: "31%",
774
+ flexGrow: 1,
775
+ padding: 12,
776
+ borderRadius: 14,
777
+ borderWidth: 1,
778
+ gap: 4
779
+ },
780
+ glyph: {
781
+ fontSize: 22
782
+ },
783
+ tileLabel: {
784
+ fontSize: 15,
785
+ fontWeight: "700"
786
+ },
787
+ tileHint: {
788
+ fontSize: 12,
789
+ lineHeight: 16
790
+ }
791
+ });export{ChoiceSheet,FilterSheet,NewViewSheet,PROPERTY_ICONS,PropertiesSheet,PropertyEditorSheet,SortSheet,ViewOptionsSheet,propertyIcon};//# sourceMappingURL=DatabaseSheets.js.map