@declarion/react 0.65.1 → 0.66.1

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 (467) hide show
  1. package/dist-lib/api/access-expiry.js +32 -0
  2. package/dist-lib/api/agents.js +105 -0
  3. package/dist-lib/api/auth-redirect.js +30 -0
  4. package/dist-lib/api/auth.js +67 -0
  5. package/dist-lib/api/batch.js +34 -0
  6. package/dist-lib/api/client.js +241 -0
  7. package/dist-lib/api/data.js +122 -0
  8. package/dist-lib/api/entities.js +160 -0
  9. package/dist-lib/api/events.js +120 -0
  10. package/dist-lib/api/fileReferences.js +8 -0
  11. package/dist-lib/api/params.js +20 -0
  12. package/dist-lib/api/properties.js +25 -0
  13. package/dist-lib/api/request-bounds.js +28 -0
  14. package/dist-lib/api/schema.js +71 -0
  15. package/dist-lib/api/session-renewal.js +36 -0
  16. package/dist-lib/api/status.js +17 -0
  17. package/dist-lib/app.js +262 -0
  18. package/dist-lib/components/actions/ActionButton.js +116 -0
  19. package/dist-lib/{ActionDialog-C6EG-AmC.js → components/actions/ActionDialog.js} +63 -53
  20. package/dist-lib/{ActionResultDialog.impl-BATutW8J.js → components/actions/ActionResultDialog.impl.js} +53 -48
  21. package/dist-lib/components/actions/ActionResultDialog.js +12 -0
  22. package/dist-lib/components/actions/ActionRunner.js +274 -0
  23. package/dist-lib/components/actions/ObjectActionBar.js +127 -0
  24. package/dist-lib/components/actions/PropertyGridEditor.js +202 -0
  25. package/dist-lib/components/actions/ResponsiveActionBar.js +773 -0
  26. package/dist-lib/components/actions/RowActionsKebab.js +90 -0
  27. package/dist-lib/{AgentChatPanel.impl-D5y_qEex.js → components/agents/AgentChatPanel.impl.js} +314 -362
  28. package/dist-lib/components/agents/AgentChatPanel.js +12 -0
  29. package/dist-lib/components/agents/AgentConversationDrawer.js +59 -0
  30. package/dist-lib/components/agents/AgentElicitForm.js +152 -0
  31. package/dist-lib/components/agents/AgentOpenFollower.impl.js +7 -0
  32. package/dist-lib/components/agents/AgentOpenFollower.js +12 -0
  33. package/dist-lib/components/agents/AgentPicker.js +58 -0
  34. package/dist-lib/components/agents/transcript-runs.js +52 -0
  35. package/dist-lib/components/chrome/AssociationTabs.js +176 -0
  36. package/dist-lib/components/chrome/AuditMetaStrip.js +64 -0
  37. package/dist-lib/components/chrome/Breadcrumbs.js +67 -0
  38. package/dist-lib/components/chrome/HighlightsStrip.js +39 -0
  39. package/dist-lib/{PageHeader-DiwLe7CO.js → components/chrome/PageHeader.js} +19 -15
  40. package/dist-lib/{PageShell-BJz1MiTH.js → components/chrome/PageShell.js} +3 -3
  41. package/dist-lib/components/chrome/RecordHeader.js +119 -0
  42. package/dist-lib/{headerActionZone-bef-tZZ7.js → components/chrome/headerActionZone.js} +1 -1
  43. package/dist-lib/components/detail-layout/AssociatedBlock.js +1244 -0
  44. package/dist-lib/components/detail-layout/AssociatedToolbar.js +87 -0
  45. package/dist-lib/components/detail-layout/ChildrenBlock.js +80 -0
  46. package/dist-lib/components/detail-layout/ChildrenCards.js +156 -0
  47. package/dist-lib/components/detail-layout/ChildrenList.js +135 -0
  48. package/dist-lib/components/detail-layout/ChildrenTable.js +189 -0
  49. package/dist-lib/components/detail-layout/ChildrenTimeline.js +609 -0
  50. package/dist-lib/components/detail-layout/DetailAuditStrip.js +40 -0
  51. package/dist-lib/components/detail-layout/DetailHighlights.js +54 -0
  52. package/dist-lib/{DraggableChildrenTable-Dd5SeuF6.js → components/detail-layout/DraggableChildrenTable.js} +56 -53
  53. package/dist-lib/components/detail-layout/EditableChildrenTable.js +341 -0
  54. package/dist-lib/components/detail-layout/ErrorSummary.js +89 -0
  55. package/dist-lib/components/detail-layout/EvidenceBlock.js +66 -0
  56. package/dist-lib/{FieldRow-DedGIY9R.js → components/detail-layout/FieldRow.js} +8 -7
  57. package/dist-lib/components/detail-layout/FieldsBlock.js +74 -0
  58. package/dist-lib/components/detail-layout/LayoutColumn.js +16 -0
  59. package/dist-lib/components/detail-layout/LayoutRenderer.js +54 -0
  60. package/dist-lib/components/detail-layout/LayoutRow.js +83 -0
  61. package/dist-lib/components/detail-layout/LayoutTabs.js +195 -0
  62. package/dist-lib/components/detail-layout/PropertiesBlock.js +74 -0
  63. package/dist-lib/components/detail-layout/QuickAddForm.js +81 -0
  64. package/dist-lib/components/detail-layout/SectionBlock.js +48 -0
  65. package/dist-lib/components/detail-layout/StatusesBlock.js +18 -0
  66. package/dist-lib/components/detail-layout/TimelineComposer.js +205 -0
  67. package/dist-lib/components/detail-layout/blockMeta.js +27 -0
  68. package/dist-lib/components/detail-layout/useManualColumnResize.js +94 -0
  69. package/dist-lib/components/detail-layout/useQuickAdd.js +85 -0
  70. package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +295 -0
  71. package/dist-lib/components/detail-layout/widgets/JsonDiffWidget.js +107 -0
  72. package/dist-lib/components/detail-layout/widgets/MonacoJson.js +47 -0
  73. package/dist-lib/components/detail-layout/widgets/WidgetHost.js +36 -0
  74. package/dist-lib/components/detail-layout/widgets/builtins.js +10 -0
  75. package/dist-lib/components/detail-layout/widgets/canonicalizeJson.js +32 -0
  76. package/dist-lib/components/detail-layout/widgets/monacoBootstrap.js +16 -0
  77. package/dist-lib/components/detail-layout/widgets/registry.js +13 -0
  78. package/dist-lib/components/fields/BoolField.js +13 -0
  79. package/dist-lib/components/fields/EmailField.js +16 -0
  80. package/dist-lib/components/fields/EnumField.js +38 -0
  81. package/dist-lib/components/fields/FileReferenceField.js +60 -0
  82. package/dist-lib/components/fields/IntArrayField.js +83 -0
  83. package/dist-lib/components/fields/JsonField.js +51 -0
  84. package/dist-lib/components/fields/MultilangArrayField.js +56 -0
  85. package/dist-lib/components/fields/MultilangField.js +65 -0
  86. package/dist-lib/components/fields/MultilangTextField.js +65 -0
  87. package/dist-lib/components/fields/NumberField.js +64 -0
  88. package/dist-lib/components/fields/PasswordField.js +34 -0
  89. package/dist-lib/components/fields/PhoneField.js +84 -0
  90. package/dist-lib/components/fields/RefCombobox.js +112 -0
  91. package/dist-lib/components/fields/RefField.js +45 -0
  92. package/dist-lib/components/fields/RichTextField.js +225 -0
  93. package/dist-lib/components/fields/SecretField.js +34 -0
  94. package/dist-lib/components/fields/StringArrayField.js +165 -0
  95. package/dist-lib/components/fields/StringField.js +39 -0
  96. package/dist-lib/components/fields/StructureField.js +221 -0
  97. package/dist-lib/components/fields/TextField.js +76 -0
  98. package/dist-lib/components/fields/TimestampField.js +110 -0
  99. package/dist-lib/components/fields/UrlField.js +18 -0
  100. package/dist-lib/components/fields/cells/factories/badge.js +42 -0
  101. package/dist-lib/components/fields/cells/factories/boolPill.js +17 -0
  102. package/dist-lib/components/fields/cells/factories/code.js +11 -0
  103. package/dist-lib/components/fields/cells/factories/date.js +30 -0
  104. package/dist-lib/components/fields/cells/factories/email.js +26 -0
  105. package/dist-lib/components/fields/cells/factories/emptyCell.js +10 -0
  106. package/dist-lib/components/fields/cells/factories/fileReference.js +17 -0
  107. package/dist-lib/components/fields/cells/factories/host-icons.js +146 -0
  108. package/dist-lib/components/fields/cells/factories/json.js +61 -0
  109. package/dist-lib/components/fields/cells/factories/link.js +32 -0
  110. package/dist-lib/components/fields/cells/factories/markdown.js +31 -0
  111. package/dist-lib/components/fields/cells/factories/markdownPreview.js +81 -0
  112. package/dist-lib/components/fields/cells/factories/money.js +37 -0
  113. package/dist-lib/components/fields/cells/factories/multilangInline.js +35 -0
  114. package/dist-lib/components/fields/cells/factories/nextRun.js +46 -0
  115. package/dist-lib/components/fields/cells/factories/number.js +42 -0
  116. package/dist-lib/components/fields/cells/factories/passwordMask.js +23 -0
  117. package/dist-lib/components/fields/cells/factories/phone.js +35 -0
  118. package/dist-lib/components/fields/cells/factories/refLink.js +57 -0
  119. package/dist-lib/components/fields/cells/factories/richTextPreview.js +34 -0
  120. package/dist-lib/components/fields/cells/factories/statusPill.js +35 -0
  121. package/dist-lib/components/fields/cells/factories/tagList.js +44 -0
  122. package/dist-lib/components/fields/cells/factories/text.js +5 -0
  123. package/dist-lib/components/fields/cells/factories/timestamp.js +18 -0
  124. package/dist-lib/components/fields/cells/factories/url-helpers.js +49 -0
  125. package/dist-lib/components/fields/cells/factories/url.js +45 -0
  126. package/dist-lib/components/fields/cells/registry.js +58 -0
  127. package/dist-lib/components/fields/index.js +80 -0
  128. package/dist-lib/components/fields/langMap.js +6 -0
  129. package/dist-lib/components/fields/secretValue.js +7 -0
  130. package/dist-lib/components/file-widgets/CircleImage.js +11 -0
  131. package/dist-lib/components/file-widgets/DocumentCard.js +277 -0
  132. package/dist-lib/components/file-widgets/FileList.js +213 -0
  133. package/dist-lib/{Grid-XUHm5SDe.js → components/file-widgets/Grid.js} +45 -40
  134. package/dist-lib/components/file-widgets/GridLazy.js +15 -0
  135. package/dist-lib/components/file-widgets/ImageWidget.js +354 -0
  136. package/dist-lib/components/file-widgets/LabeledSlots.js +69 -0
  137. package/dist-lib/components/file-widgets/SquareImage.js +11 -0
  138. package/dist-lib/components/file-widgets/UnknownFileWidget.js +22 -0
  139. package/dist-lib/components/file-widgets/UploadFailureText.js +10 -0
  140. package/dist-lib/components/file-widgets/WideBanner.js +11 -0
  141. package/dist-lib/components/file-widgets/builtins.js +15 -0
  142. package/dist-lib/components/file-widgets/cropper.js +13 -0
  143. package/dist-lib/components/file-widgets/draft-scope.js +59 -0
  144. package/dist-lib/components/file-widgets/helpers.js +75 -0
  145. package/dist-lib/components/file-widgets/host.js +75 -0
  146. package/dist-lib/{payload-DioMoxMX.js → components/file-widgets/payload.js} +14 -14
  147. package/dist-lib/components/file-widgets/registry.js +13 -0
  148. package/dist-lib/components/file-widgets/upload.js +180 -0
  149. package/dist-lib/components/file-widgets/useEmbedFileSrc.js +45 -0
  150. package/dist-lib/components/file-widgets/value.js +12 -0
  151. package/dist-lib/components/filters/FilterChips.js +123 -0
  152. package/dist-lib/components/filters/FilterConditionValue.js +40 -0
  153. package/dist-lib/components/filters/FilterDrawer.js +670 -0
  154. package/dist-lib/components/filters/FilterOmittedNotice.js +14 -0
  155. package/dist-lib/components/filters/filter-op-label.js +8 -0
  156. package/dist-lib/{CommandPalette.impl-DRI5kxVY.js → components/layout/CommandPalette.impl.js} +62 -61
  157. package/dist-lib/components/layout/CommandPalette.js +12 -0
  158. package/dist-lib/{DirtyTabsCloseDialog.impl-FhAiOmEb.js → components/layout/DirtyTabsCloseDialog.impl.js} +16 -14
  159. package/dist-lib/components/layout/DirtyTabsCloseDialog.js +12 -0
  160. package/dist-lib/{ImpersonationBanner.impl--g0iYwcV.js → components/layout/ImpersonationBanner.impl.js} +4 -3
  161. package/dist-lib/components/layout/ImpersonationBanner.js +12 -0
  162. package/dist-lib/components/layout/ImpersonationFrame.js +29 -0
  163. package/dist-lib/{ImpersonationStartModal.impl-BFBN0YJe.js → components/layout/ImpersonationStartModal.impl.js} +9 -9
  164. package/dist-lib/components/layout/ImpersonationStartModal.js +12 -0
  165. package/dist-lib/components/layout/Layout.js +755 -0
  166. package/dist-lib/components/layout/Rail.js +149 -0
  167. package/dist-lib/components/layout/Sidebar.js +362 -0
  168. package/dist-lib/components/layout/TabStrip.js +321 -0
  169. package/dist-lib/components/layout/TenantChip.js +355 -0
  170. package/dist-lib/components/layout/TopBar.js +305 -0
  171. package/dist-lib/components/layout/tab-close.js +24 -0
  172. package/dist-lib/components/list/ColumnPicker.js +112 -0
  173. package/dist-lib/components/list/InlineEditCell.js +107 -0
  174. package/dist-lib/components/list/PeekFieldCell.js +143 -0
  175. package/dist-lib/components/list/QuickPeek.js +263 -0
  176. package/dist-lib/components/list/ViewSwitcher.js +156 -0
  177. package/dist-lib/components/list/peekDraftStore.js +14 -0
  178. package/dist-lib/{AdminCatalogPage.impl-B-7MLqa1.js → components/pages/AdminCatalogPage.impl.js} +53 -49
  179. package/dist-lib/components/pages/AdminCatalogPage.js +12 -0
  180. package/dist-lib/components/pages/DocumentsMenu.js +150 -0
  181. package/dist-lib/components/pages/ExportMenu.js +123 -0
  182. package/dist-lib/{NotFoundPage.impl-BoX11u-P.js → components/pages/NotFoundPage.impl.js} +6 -4
  183. package/dist-lib/components/pages/NotFoundPage.js +12 -0
  184. package/dist-lib/components/pages/RecordDocumentsPanel.js +230 -0
  185. package/dist-lib/components/pages/RecordNotesPanel.js +200 -0
  186. package/dist-lib/components/pages/RecordPanels.js +18 -0
  187. package/dist-lib/components/pages/SSOCallbackPage.impl.js +28 -0
  188. package/dist-lib/components/pages/SSOCallbackPage.js +12 -0
  189. package/dist-lib/components/pages/SmartDetailPage.impl.js +986 -0
  190. package/dist-lib/components/pages/SmartDetailPage.js +12 -0
  191. package/dist-lib/components/pages/SmartListPage.impl.js +708 -0
  192. package/dist-lib/components/pages/SmartListPage.js +12 -0
  193. package/dist-lib/components/pages/SmartRecordListPage.impl.js +818 -0
  194. package/dist-lib/components/pages/SmartRecordListPage.js +12 -0
  195. package/dist-lib/components/pages/auth/AuthShell.js +350 -0
  196. package/dist-lib/{Forgot.impl-6tL6SBlS.js → components/pages/auth/Forgot.impl.js} +13 -12
  197. package/dist-lib/components/pages/auth/Forgot.js +12 -0
  198. package/dist-lib/{Reset.impl-D0pjhS6d.js → components/pages/auth/Reset.impl.js} +17 -15
  199. package/dist-lib/components/pages/auth/Reset.js +12 -0
  200. package/dist-lib/components/pages/auth/SignIn.js +252 -0
  201. package/dist-lib/{SignUp.impl-CfEXrUeg.js → components/pages/auth/SignUp.impl.js} +31 -27
  202. package/dist-lib/components/pages/auth/SignUp.js +12 -0
  203. package/dist-lib/{TwoFA.impl-B2HtPduH.js → components/pages/auth/TwoFA.impl.js} +9 -8
  204. package/dist-lib/components/pages/auth/TwoFA.js +12 -0
  205. package/dist-lib/components/pages/auth/icons.js +56 -0
  206. package/dist-lib/components/pages/exportRequest.js +17 -0
  207. package/dist-lib/components/pages/list/DataCell.js +27 -0
  208. package/dist-lib/components/pages/list/DeleteViewDialog.js +22 -0
  209. package/dist-lib/{ListCardsBody-BEoYjSZ2.js → components/pages/list/ListCardRow.js} +47 -72
  210. package/dist-lib/components/pages/list/ListCardsBody.js +31 -0
  211. package/dist-lib/components/pages/list/ListFloatbar.js +130 -0
  212. package/dist-lib/components/pages/list/ListFooter.js +138 -0
  213. package/dist-lib/components/pages/list/ListHeader.js +120 -0
  214. package/dist-lib/components/pages/list/ListNoRows.js +72 -0
  215. package/dist-lib/components/pages/list/ListTable.js +191 -0
  216. package/dist-lib/components/pages/list/ListTableRow.js +37 -0
  217. package/dist-lib/components/pages/list/ListToolbar.js +261 -0
  218. package/dist-lib/components/pages/list/ListUrlBanner.js +45 -0
  219. package/dist-lib/components/pages/list/RowActionsCell.js +49 -0
  220. package/dist-lib/components/pages/list/RowContextMenu.js +55 -0
  221. package/dist-lib/components/pages/list/SaveViewDialog.js +111 -0
  222. package/dist-lib/{SortHeaderMenu-Co5PvhTA.js → components/pages/list/SortHeaderMenu.js} +18 -17
  223. package/dist-lib/{cardProjection-Cxlogzh8.js → components/pages/list/cardProjection.js} +3 -3
  224. package/dist-lib/components/pages/list/column-sizing.js +17 -0
  225. package/dist-lib/components/pages/list/columns.js +168 -0
  226. package/dist-lib/components/pages/list/filter-meta.js +84 -0
  227. package/dist-lib/components/pages/list/page-size.js +11 -0
  228. package/dist-lib/components/pages/list/sortable-header.js +18 -0
  229. package/dist-lib/components/pages/list/table-features.js +11 -0
  230. package/dist-lib/components/pages/list/use-filter-value-labels.js +115 -0
  231. package/dist-lib/components/pages/list/useActiveView.js +98 -0
  232. package/dist-lib/components/pages/list/useHeaderReorder.js +93 -0
  233. package/dist-lib/components/pages/list/useListColumnLayout.js +56 -0
  234. package/dist-lib/components/pages/list/useListFilterPresentation.js +34 -0
  235. package/dist-lib/components/pages/list/useListQuery.js +101 -0
  236. package/dist-lib/components/pages/list/useListRowInteraction.js +120 -0
  237. package/dist-lib/components/pages/list/useListSelection.js +53 -0
  238. package/dist-lib/components/pages/list/useListSort.js +44 -0
  239. package/dist-lib/components/pages/list/useListViews.js +148 -0
  240. package/dist-lib/components/pages/list/useRowMenu.js +106 -0
  241. package/dist-lib/components/pages/list/visible-filters.js +19 -0
  242. package/dist-lib/{Preferences.impl-Ct5xwZtT.js → components/pages/profile/Preferences.impl.js} +34 -31
  243. package/dist-lib/components/pages/profile/Preferences.js +12 -0
  244. package/dist-lib/components/pages/profile/Profile.impl.js +437 -0
  245. package/dist-lib/components/pages/profile/Profile.js +12 -0
  246. package/dist-lib/{TenantParamsPage.impl-BGpdmEZg.js → components/pages/tenant-params/TenantParamsPage.impl.js} +45 -40
  247. package/dist-lib/components/pages/tenant-params/TenantParamsPage.js +12 -0
  248. package/dist-lib/components/params/ParamsBlock.js +119 -0
  249. package/dist-lib/{param-editors-TYYU7HKK.js → components/params/param-editors.js} +32 -28
  250. package/dist-lib/components/primitives/Avatar.js +33 -0
  251. package/dist-lib/components/primitives/BoolToggle.js +35 -0
  252. package/dist-lib/components/primitives/BrandGlyph.js +38 -0
  253. package/dist-lib/components/primitives/BrandLogo.js +20 -0
  254. package/dist-lib/components/primitives/Btn.js +67 -0
  255. package/dist-lib/{Check-DAfMbQIw.js → components/primitives/Check.js} +2 -2
  256. package/dist-lib/components/primitives/Chip.js +44 -0
  257. package/dist-lib/components/primitives/ClassifiedFieldLocked.js +15 -0
  258. package/dist-lib/components/primitives/Dropdown.js +85 -0
  259. package/dist-lib/components/primitives/Fields.js +751 -0
  260. package/dist-lib/components/primitives/HoverCard.js +115 -0
  261. package/dist-lib/components/primitives/IconBtn.js +37 -0
  262. package/dist-lib/{Icons-lt-7lhYR.js → components/primitives/Icons.js} +1 -1
  263. package/dist-lib/{Kbd-CNttVu0z.js → components/primitives/Kbd.js} +2 -2
  264. package/dist-lib/components/primitives/MenuItem.js +57 -0
  265. package/dist-lib/{Pill-D-wsfRhx.js → components/primitives/Pill.js} +1 -1
  266. package/dist-lib/{RecordIdBadge-wbigZaFc.js → components/primitives/RecordIdBadge.js} +5 -5
  267. package/dist-lib/components/primitives/RowField.js +47 -0
  268. package/dist-lib/{SectionCard-BYHoHWJc.js → components/primitives/SectionCard.js} +10 -10
  269. package/dist-lib/components/primitives/Spinner.js +31 -0
  270. package/dist-lib/components/primitives/StatTile.js +108 -0
  271. package/dist-lib/components/primitives/Tooltip.js +115 -0
  272. package/dist-lib/{dataTableStyles-vwD1mVOP.js → components/primitives/dataTableStyles.js} +1 -1
  273. package/dist-lib/components/shared/BlankScreen.js +13 -0
  274. package/dist-lib/{ChangePasswordDialog.impl-5hDc0wpE.js → components/shared/ChangePasswordDialog.impl.js} +27 -22
  275. package/dist-lib/{ChangePasswordDialog-C_T_3pjl.js → components/shared/ChangePasswordDialog.js} +2 -2
  276. package/dist-lib/components/shared/ConfirmDialog.js +129 -0
  277. package/dist-lib/components/shared/ConnectionNotice.js +12 -0
  278. package/dist-lib/components/shared/CopyButton.js +25 -0
  279. package/dist-lib/components/shared/DynamicIcon.js +73 -0
  280. package/dist-lib/components/shared/EmptyState.js +56 -0
  281. package/dist-lib/components/shared/ErrorBoundary.js +96 -0
  282. package/dist-lib/components/shared/LoadingSkeleton.js +117 -0
  283. package/dist-lib/components/shared/LucideIcon.js +43 -0
  284. package/dist-lib/components/shared/Markdown.js +15 -0
  285. package/dist-lib/{MarkdownRenderer-sK2TRZS-.js → components/shared/MarkdownRenderer.js} +10 -9
  286. package/dist-lib/components/shared/RefreshControl.js +42 -0
  287. package/dist-lib/components/shared/StatusGroupsDisplay.js +123 -0
  288. package/dist-lib/components/shared/StatusStepper.js +70 -0
  289. package/dist-lib/components/shared/toast/DeclarionToast.js +308 -0
  290. package/dist-lib/components/shared/useOwnRefresh.js +19 -0
  291. package/dist-lib/declarion-react.css +1 -1
  292. package/dist-lib/embed/EmbedAuthBootstrap.js +71 -0
  293. package/dist-lib/embed/EmbedContext.js +38 -0
  294. package/dist-lib/embed/EmbedDirtyReporter.js +17 -0
  295. package/dist-lib/embed/EmbedHistoryTracker.js +17 -0
  296. package/dist-lib/embed/EmbedLocationReporter.js +26 -0
  297. package/dist-lib/embed/EmbedResizeReporter.js +25 -0
  298. package/dist-lib/embed/EmbedUnsavedGuard.js +23 -0
  299. package/dist-lib/embed/embed-dirty.js +21 -0
  300. package/dist-lib/embed/embed-history.js +17 -0
  301. package/dist-lib/embed/embed-nav-guard.js +13 -0
  302. package/dist-lib/embed/file-src.js +60 -0
  303. package/dist-lib/embed/handshake.js +37 -0
  304. package/dist-lib/embed/params.js +45 -0
  305. package/dist-lib/embed/protocol.js +26 -0
  306. package/dist-lib/embed/screen-location.js +44 -0
  307. package/dist-lib/embed/theme.js +11 -0
  308. package/dist-lib/embed/token.js +54 -0
  309. package/dist-lib/embed/useEmbedNavigate.js +65 -0
  310. package/dist-lib/embed/useGlobalLinkInterceptor.js +63 -0
  311. package/dist-lib/hooks/useActionData.js +58 -0
  312. package/dist-lib/hooks/useAgentConversation.js +311 -0
  313. package/dist-lib/hooks/useAggregate.js +18 -0
  314. package/dist-lib/hooks/useAllEntityData.js +53 -0
  315. package/dist-lib/hooks/useAssociatedData.js +37 -0
  316. package/dist-lib/hooks/useAuth.js +56 -0
  317. package/dist-lib/hooks/useBranding.js +18 -0
  318. package/dist-lib/hooks/useBrandingChrome.js +58 -0
  319. package/dist-lib/hooks/useChildrenData.js +33 -0
  320. package/dist-lib/hooks/useColumns.js +44 -0
  321. package/dist-lib/hooks/useConnectionNotice.js +35 -0
  322. package/dist-lib/{useCurrentLocation-Bq1T72AW.js → hooks/useCurrentLocation.js} +2 -2
  323. package/dist-lib/hooks/useCurrentScreen.js +20 -0
  324. package/dist-lib/hooks/useCursorEntityData.js +77 -0
  325. package/dist-lib/hooks/useDebounce.js +11 -0
  326. package/dist-lib/hooks/useEntity.js +8 -0
  327. package/dist-lib/hooks/useEntityData.js +64 -0
  328. package/dist-lib/hooks/useFileReferenceJSON.js +29 -0
  329. package/dist-lib/hooks/useFilters.js +28 -0
  330. package/dist-lib/hooks/useFollowAgentOpen.js +84 -0
  331. package/dist-lib/hooks/useImpersonation.js +40 -0
  332. package/dist-lib/hooks/useIntentPrefetch.js +43 -0
  333. package/dist-lib/hooks/useJsonSnapshot.js +8 -0
  334. package/dist-lib/hooks/useLanguage.js +21 -0
  335. package/dist-lib/hooks/useLiveObject.js +17 -0
  336. package/dist-lib/hooks/useLongPress.js +49 -0
  337. package/dist-lib/hooks/useMutations.js +70 -0
  338. package/dist-lib/{useObject-B45F96rC.js → hooks/useObject.js} +2 -2
  339. package/dist-lib/hooks/useObjectStatus.js +20 -0
  340. package/dist-lib/hooks/usePageState.js +18 -0
  341. package/dist-lib/hooks/usePageStateRuntime.js +46 -0
  342. package/dist-lib/hooks/usePageStateTtl.js +10 -0
  343. package/dist-lib/hooks/useParams.js +123 -0
  344. package/dist-lib/hooks/useProperties.js +32 -0
  345. package/dist-lib/hooks/useRealtimeThresholds.js +31 -0
  346. package/dist-lib/hooks/useRegisterScreenTab.js +28 -0
  347. package/dist-lib/hooks/useResponsiveMode.js +84 -0
  348. package/dist-lib/hooks/useSSE.js +307 -0
  349. package/dist-lib/hooks/useSchema.js +73 -0
  350. package/dist-lib/hooks/useScreen.js +8 -0
  351. package/dist-lib/hooks/useScreenBack.js +60 -0
  352. package/dist-lib/hooks/useScreenTab.js +11 -0
  353. package/dist-lib/hooks/useTabNavigate.js +82 -0
  354. package/dist-lib/hooks/useTabSearchMirror.js +19 -0
  355. package/dist-lib/{useTabTitle-KrzEo118.js → hooks/useTabTitle.js} +9 -7
  356. package/dist-lib/hooks/useText.js +15 -0
  357. package/dist-lib/hooks/useTimelineData.js +44 -0
  358. package/dist-lib/hooks/useUnsavedInput.js +18 -0
  359. package/dist-lib/hooks/useVersionWatcher.js +62 -0
  360. package/dist-lib/hooks/useViews.js +88 -0
  361. package/dist-lib/hooks/useWindowConversation.js +11 -0
  362. package/dist-lib/icons.js +5 -3
  363. package/dist-lib/index.d.ts +42 -20
  364. package/dist-lib/index.js +131 -3926
  365. package/dist-lib/lib/action-dispatch.js +7 -0
  366. package/dist-lib/lib/actions.js +279 -0
  367. package/dist-lib/lib/anchor.js +41 -0
  368. package/dist-lib/lib/brand-tokens.js +95 -0
  369. package/dist-lib/lib/branding.js +25 -0
  370. package/dist-lib/lib/canonical-url.js +17 -0
  371. package/dist-lib/lib/capabilityPrefetch.js +57 -0
  372. package/dist-lib/lib/child-config.js +111 -0
  373. package/dist-lib/lib/children-validation.js +52 -0
  374. package/dist-lib/lib/decimal-text.js +15 -0
  375. package/dist-lib/lib/display-value.js +19 -0
  376. package/dist-lib/lib/document-templates.js +6 -0
  377. package/dist-lib/lib/download.js +41 -0
  378. package/dist-lib/lib/evidence-verdict.js +23 -0
  379. package/dist-lib/lib/failure.js +9 -0
  380. package/dist-lib/lib/field-classification.js +58 -0
  381. package/dist-lib/lib/field-regions.js +13 -0
  382. package/dist-lib/lib/filter-evaluator.js +98 -0
  383. package/dist-lib/lib/filters.js +118 -0
  384. package/dist-lib/lib/format-count.js +24 -0
  385. package/dist-lib/lib/html-state.js +9 -0
  386. package/dist-lib/lib/language.js +52 -0
  387. package/dist-lib/lib/longPressGesture.js +34 -0
  388. package/dist-lib/lib/mass-edit.js +65 -0
  389. package/dist-lib/{page-inset-D_kkVwwN.js → lib/page-inset.js} +1 -1
  390. package/dist-lib/lib/phone.js +28 -0
  391. package/dist-lib/lib/query-retry.js +7 -0
  392. package/dist-lib/lib/quick-add.js +23 -0
  393. package/dist-lib/lib/realtime-query-keys.js +23 -0
  394. package/dist-lib/lib/realtime-reconcile.js +148 -0
  395. package/dist-lib/lib/realtime-resync.js +192 -0
  396. package/dist-lib/lib/record-documents-key.js +4 -0
  397. package/dist-lib/lib/ref-choices.js +6 -0
  398. package/dist-lib/lib/refetch-when-idle.js +25 -0
  399. package/dist-lib/lib/rich-text.js +46 -0
  400. package/dist-lib/lib/rowClickGesture.js +10 -0
  401. package/dist-lib/lib/safe-url.js +34 -0
  402. package/dist-lib/lib/schema-routing.js +51 -0
  403. package/dist-lib/{screen-back-BtbEp5sO.js → lib/screen-back.js} +2 -2
  404. package/dist-lib/lib/scroll-restoration.js +156 -0
  405. package/dist-lib/lib/size-value.js +22 -0
  406. package/dist-lib/lib/sort.js +59 -0
  407. package/dist-lib/lib/timestamp.js +97 -0
  408. package/dist-lib/lib/toast.js +78 -0
  409. package/dist-lib/lib/ui-actions.js +81 -0
  410. package/dist-lib/{utils-D_QDpB8_.js → lib/utils.js} +1 -1
  411. package/dist-lib/lib/variants.js +63 -0
  412. package/dist-lib/lib/versionTracker.js +102 -0
  413. package/dist-lib/lib/viewport-category.js +12 -0
  414. package/dist-lib/{window-election-CHIvIZwx.js → lib/window-election.js} +1 -1
  415. package/dist-lib/stores/auth.js +84 -0
  416. package/dist-lib/stores/icon-registry.js +24 -0
  417. package/dist-lib/stores/list-layout.js +178 -0
  418. package/dist-lib/{page-state-eA6J_KIR.js → stores/page-state.js} +1 -1
  419. package/dist-lib/stores/preferences.js +126 -0
  420. package/dist-lib/stores/realtime.js +115 -0
  421. package/dist-lib/stores/screen-registry.js +10 -0
  422. package/dist-lib/stores/tabs.js +220 -0
  423. package/dist-lib/test/seed-schema.js +8 -0
  424. package/dist-lib/testing.d.ts +1 -1
  425. package/dist-lib/testing.js +80 -76
  426. package/dist-lib/types/api.js +48 -0
  427. package/dist-lib/types/fieldType.js +4 -0
  428. package/dist-lib/types/ordmap.js +50 -0
  429. package/dist-lib/types/schema.js +173 -0
  430. package/dist-lib/{useResponsiveMode-DIR1bZfo.d.ts → useResponsiveMode-DmrpMbZX.d.ts} +44 -16
  431. package/package.json +13 -12
  432. package/dist-lib/ActionRunner-DdBFhqGe.js +0 -1440
  433. package/dist-lib/AgentOpenFollower.impl-BAs_wGEZ.js +0 -81
  434. package/dist-lib/AssociatedBlock-BOoPLOjw.js +0 -1515
  435. package/dist-lib/AuthShell-C8aVwHS7.js +0 -361
  436. package/dist-lib/BlankScreen-DVc7fh8C.js +0 -61
  437. package/dist-lib/CopyButton-DRIT_f0k.js +0 -119
  438. package/dist-lib/DynamicIcon-DuBSz6TZ.js +0 -133
  439. package/dist-lib/FilterChips-Cv1tlXyo.js +0 -1031
  440. package/dist-lib/LayoutRenderer-d-tXYPze.js +0 -3239
  441. package/dist-lib/MenuItem-CfkVXPvC.js +0 -140
  442. package/dist-lib/MonacoJson-BG3S3GHX.js +0 -60
  443. package/dist-lib/Profile.impl-Cypk27ah.js +0 -527
  444. package/dist-lib/PropertyGridEditor-XrP6TZ5s.js +0 -4378
  445. package/dist-lib/RecordHeader-BfQ0_4wq.js +0 -217
  446. package/dist-lib/RefreshControl-CRdWPoF5.js +0 -195
  447. package/dist-lib/SSOCallbackPage.impl-Cfi2pQ59.js +0 -31
  448. package/dist-lib/SmartDetailPage.impl-BiIX0n7K.js +0 -1609
  449. package/dist-lib/SmartListPage.impl-Cu83Gv_G.js +0 -2818
  450. package/dist-lib/SmartRecordListPage.impl-DR6lq7HA.js +0 -795
  451. package/dist-lib/format-count-lyB4CPen.js +0 -943
  452. package/dist-lib/peekDraftStore-CaimrOhW.js +0 -200
  453. package/dist-lib/registry-CGe5kCXN.js +0 -119
  454. package/dist-lib/use-filter-value-labels-D3YDgUzg.js +0 -413
  455. package/dist-lib/useAgentConversation-rru-7hnF.js +0 -612
  456. package/dist-lib/useBranding-zcxEic2k.js +0 -41
  457. package/dist-lib/useBrandingChrome-bxaR3G1R.js +0 -170
  458. package/dist-lib/useCurrentScreen-BZOHBGQZ.js +0 -2522
  459. package/dist-lib/useImpersonation-DBIRRR70.js +0 -35
  460. package/dist-lib/useOwnRefresh-DJjaje52.js +0 -435
  461. package/dist-lib/useParams-BFLJi4n3.js +0 -133
  462. package/dist-lib/useProperties-B7opZ-iy.js +0 -81
  463. package/dist-lib/useScreenBack-DENlz844.js +0 -71
  464. package/dist-lib/useTabNavigate-CUqOmcMj.js +0 -78
  465. package/dist-lib/value-BuQVYx52.js +0 -194
  466. package/dist-lib/variants-vUtfBbE6.js +0 -1961
  467. /package/dist-lib/{JsonEditor-Dz1PQHC8.js → components/fields/JsonEditor.js} +0 -0
@@ -1,1961 +0,0 @@
1
- import { Dt as e, Et as t, Nt as n, V as r, k as i, on as a, sn as o, wt as s, z as c } from "./useCurrentScreen-BZOHBGQZ.js";
2
- import { t as l } from "./Icons-lt-7lhYR.js";
3
- import { n as u, r as d } from "./CopyButton-DRIT_f0k.js";
4
- import { n as f, t as p } from "./MenuItem-CfkVXPvC.js";
5
- import { C as m, O as h, Q as g, S as _, T as v, b as y, f as b, g as x, l as S, s as C, v as w, w as T, x as E, y as D } from "./PropertyGridEditor-XrP6TZ5s.js";
6
- import { t as O } from "./DynamicIcon-DuBSz6TZ.js";
7
- import { a as k, c as A, d as j, f as M, i as N, l as ee, m as P, n as F, o as I, p as L, r as te, s as R, t as z, u as ne } from "./value-BuQVYx52.js";
8
- import { Fragment as B, Suspense as V, lazy as H, useCallback as U, useEffect as W, useLayoutEffect as re, useMemo as ie, useRef as G, useState as K } from "react";
9
- import { Fragment as q, jsx as J, jsxs as Y } from "react/jsx-runtime";
10
- //#region src/components/file-widgets/registry.ts
11
- var X = /* @__PURE__ */ new Map();
12
- function Z(e, t) {
13
- X.set(e, t);
14
- }
15
- function ae(e) {
16
- return X.get(e);
17
- }
18
- function oe(e) {
19
- return X.has(e);
20
- }
21
- //#endregion
22
- //#region src/components/file-widgets/cropper.ts
23
- var se = ({ file: e }) => Promise.resolve({
24
- blob: e,
25
- filename: e.name
26
- }), ce = se;
27
- function le(e) {
28
- ce = e ?? se;
29
- }
30
- function Q() {
31
- return ce;
32
- }
33
- //#endregion
34
- //#region src/components/file-widgets/ImageWidget.tsx
35
- function ue(e, t) {
36
- return A(e, t);
37
- }
38
- function de(e) {
39
- let t = e.trim().split(/\s+/).filter(Boolean);
40
- return t.length === 1 ? t[0].slice(0, 2).toUpperCase() : (t[0][0] + t[1][0]).toUpperCase();
41
- }
42
- function fe(n) {
43
- let { field: r, fieldName: i, value: a, onChange: o, mode: c, alt: l, recordTitle: u, disabled: d, visual: f, uploadFieldCode: p, uploadSlotCode: h } = n, g = F(a), [v, y] = K("idle"), [b, S] = K(null), [C, O] = K(null), [k, A] = K(null), [I, te] = K(!1), z = G(null), ne = G(!1), B = G(null), { register: V, unregister: H, isDraft: re } = x(), q = s(), X = s("errors");
44
- W(() => () => {
45
- z.current && z.current.abort();
46
- }, []);
47
- let Z = e(), ae = t(), oe = ie(() => M(g, l, i, Z, ae), [
48
- l,
49
- i,
50
- g,
51
- Z,
52
- ae
53
- ]), se = r.display?.initials ? u?.trim() : void 0, ce = (r.accepts ?? ["image/*"]).join(","), le = U(async (e) => {
54
- let t = T(e, r.accepts, r.max_size_bytes);
55
- if (t) {
56
- O(E(q, X, t)), y("error");
57
- return;
58
- }
59
- let a = e;
60
- if (r.display?.crop_on_upload) try {
61
- let { blob: t, filename: n } = await Q()({
62
- file: e,
63
- aspectRatio: ge(r.display.aspect_ratio)
64
- });
65
- a = new File([t], n, { type: t.type || e.type });
66
- } catch {
67
- O({
68
- code: "file.crop_failed",
69
- message: X("file.crop_failed", "The image could not be cropped.")
70
- }), y("error");
71
- return;
72
- }
73
- O(null), ne.current = !1, y("uploading"), S({
74
- loaded: 0,
75
- total: a.size,
76
- pct: 0
77
- });
78
- let s = new AbortController();
79
- z.current = s;
80
- try {
81
- let e = await m({
82
- file: a,
83
- entityCode: n.entityCode,
84
- fieldCode: p ?? i,
85
- slotCode: h,
86
- signal: s.signal,
87
- onProgress: S
88
- });
89
- if (ne.current) {
90
- D(e.id).catch(() => {}), H(e.id);
91
- return;
92
- }
93
- g && re(g.id) && (D(g.id).catch(() => {}), H(g.id)), V(e.id, () => D(e.id)), A(e.id), y("idle"), S(null);
94
- let t = {
95
- id: e.id,
96
- filename: e.filename,
97
- content_type: e.content_type,
98
- size_bytes: e.size_bytes,
99
- sha256: e.sha256,
100
- width: e.width,
101
- height: e.height,
102
- url: e.url,
103
- metadata: e.metadata
104
- };
105
- o?.(r.mode === "array" ? [t] : t);
106
- } catch (e) {
107
- if (e instanceof w && e.code === "ABORTED") return;
108
- O(_(q, X, e)), y("error"), S(null);
109
- }
110
- }, [
111
- X,
112
- q,
113
- r.accepts,
114
- r.max_size_bytes,
115
- r.display?.crop_on_upload,
116
- r.display?.aspect_ratio,
117
- r.mode,
118
- i,
119
- o,
120
- n.entityCode,
121
- V,
122
- re,
123
- g,
124
- H,
125
- p,
126
- h
127
- ]), de = U(() => {
128
- v === "uploading" && z.current && (ne.current = !0, z.current.abort(), z.current = null, y("idle"), S(null)), k && (D(k).catch(() => {}), H(k), A(null));
129
- }, [
130
- v,
131
- k,
132
- H
133
- ]), fe = U(() => {
134
- g && re(g.id) && (D(g.id).catch(() => {}), H(g.id), A(null)), o?.(r.mode === "array" ? [] : null);
135
- }, [
136
- g,
137
- r.mode,
138
- re,
139
- o,
140
- H
141
- ]), ye = U(() => {
142
- O(null), y("idle"), B.current?.click();
143
- }, []), be = U(() => {
144
- d || B.current?.click();
145
- }, [d]), xe = U((e) => {
146
- d || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), be());
147
- }, [d, be]), Se = U((e) => {
148
- d || (e.preventDefault(), e.dataTransfer.dropEffect = "copy");
149
- }, [d]), Ce = U((e) => {
150
- if (d) return;
151
- e.preventDefault();
152
- let t = e.dataTransfer.files?.[0];
153
- t && le(t);
154
- }, [d, le]), we = U((e) => {
155
- let t = e.target.files?.[0];
156
- e.target.value = "", t && le(t);
157
- }, [le]), Te = f.aspectRatio ?? he(f.shape, r.display?.aspect_ratio), Ee = j(g), De = {
158
- aspectRatio: Te,
159
- width: f.width ?? (f.shape === "wide" ? "100%" : "120px")
160
- }, Oe = !!g, ke = ue(g, r.display?.listable_thumbnail), Ae = ee(g, r.display?.listable_thumbnail), je = N(g?.id, Ae, ke), Me = c === "display", Ne = U((e) => {
161
- e.stopPropagation(), te((e) => !e);
162
- }, []), Pe = U((e) => {
163
- if (!g || !I) return;
164
- let t = e.currentTarget.getBoundingClientRect(), n = t.width > 0 ? (e.clientX - t.left) / t.width : .5, i = t.height > 0 ? (e.clientY - t.top) / t.height : .5, a = L(g, {
165
- x: Math.max(0, Math.min(1, n)),
166
- y: Math.max(0, Math.min(1, i))
167
- });
168
- o?.(r.mode === "array" ? [a] : a), te(!1);
169
- }, [
170
- r.mode,
171
- g,
172
- I,
173
- o
174
- ]);
175
- return Me ? /* @__PURE__ */ J("div", {
176
- className: pe(f.shape, !1),
177
- style: De,
178
- "aria-label": oe,
179
- children: Oe && je ? /* @__PURE__ */ J("img", {
180
- src: je,
181
- alt: oe,
182
- className: me(f.shape),
183
- style: { objectPosition: R(Ee) },
184
- loading: "lazy"
185
- }) : /* @__PURE__ */ J(_e, {
186
- shape: f.shape,
187
- initialsTitle: se
188
- })
189
- }) : /* @__PURE__ */ Y("div", {
190
- className: pe(f.shape, !d),
191
- style: De,
192
- tabIndex: d ? -1 : 0,
193
- role: "button",
194
- "aria-label": oe,
195
- "aria-disabled": d || void 0,
196
- "aria-busy": v === "uploading" || void 0,
197
- "aria-invalid": v === "error" || void 0,
198
- onClick: v === "idle" && !Oe ? be : void 0,
199
- onMouseDown: I ? Pe : void 0,
200
- onKeyDown: xe,
201
- onDragOver: Se,
202
- onDrop: Ce,
203
- "data-testid": I ? "focal-point-target" : `file-widget-${i}`,
204
- children: [
205
- /* @__PURE__ */ J("input", {
206
- ref: B,
207
- type: "file",
208
- accept: ce,
209
- onChange: we,
210
- style: { display: "none" },
211
- "data-testid": `file-input-${i}`
212
- }),
213
- Oe && je ? /* @__PURE__ */ J("img", {
214
- src: je,
215
- alt: oe,
216
- className: me(f.shape),
217
- style: { objectPosition: R(Ee) },
218
- loading: "lazy"
219
- }) : v === "uploading" ? null : /* @__PURE__ */ J(_e, {
220
- shape: f.shape,
221
- initialsTitle: se
222
- }),
223
- v === "uploading" && /* @__PURE__ */ J(ve, {
224
- pct: b?.pct ?? 0,
225
- label: q("file.upload.progress", "Uploading {pct}%", { pct: Math.round(b?.pct ?? 0) })
226
- }),
227
- k && /* @__PURE__ */ J("span", {
228
- className: "absolute right-1 top-1 h-2 w-2 rounded-full bg-warning",
229
- "aria-hidden": "true",
230
- "data-testid": "draft-indicator"
231
- }),
232
- Oe && v === "idle" && !d && /* @__PURE__ */ Y("div", {
233
- className: "absolute inset-0 flex items-center justify-center gap-2 bg-black/40 opacity-0 transition-opacity hover:opacity-100 focus-within:opacity-100",
234
- children: [
235
- r.display?.focal_point && /* @__PURE__ */ J("button", {
236
- type: "button",
237
- className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
238
- onClick: Ne,
239
- "data-testid": "focal-point-toggle",
240
- children: I ? q("file.image.focus_cancel", "Cancel focus") : q("file.image.focus_set", "Set focus")
241
- }),
242
- /* @__PURE__ */ J("button", {
243
- type: "button",
244
- className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
245
- onClick: (e) => {
246
- e.stopPropagation(), be();
247
- },
248
- children: q("file.image.change", "Change")
249
- }),
250
- /* @__PURE__ */ J("button", {
251
- type: "button",
252
- className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-destructive hover:bg-surface-2",
253
- onClick: (e) => {
254
- e.stopPropagation(), fe();
255
- },
256
- children: q("file.remove", "Remove")
257
- })
258
- ]
259
- }),
260
- Ee && Oe && /* @__PURE__ */ J("span", {
261
- className: "absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full border border-white bg-black/70",
262
- style: {
263
- left: `${Ee.x * 100}%`,
264
- top: `${Ee.y * 100}%`
265
- },
266
- "data-testid": "focal-point-marker"
267
- }),
268
- v === "uploading" && /* @__PURE__ */ J("button", {
269
- type: "button",
270
- className: "absolute bottom-1 right-1 rounded-sm border border-border bg-card px-2 py-0.5 text-xs",
271
- onClick: (e) => {
272
- e.stopPropagation(), de();
273
- },
274
- "data-testid": "cancel-upload",
275
- children: q("file.upload.cancel", "Cancel")
276
- }),
277
- v === "error" && C && /* @__PURE__ */ Y("div", {
278
- className: "absolute inset-x-0 bottom-0 flex items-center justify-between gap-2 bg-destructive-soft px-2 py-1 text-xs text-destructive",
279
- role: "alert",
280
- children: [/* @__PURE__ */ J("span", {
281
- className: "truncate",
282
- title: C.message,
283
- children: /* @__PURE__ */ J(P, { failure: C })
284
- }), /* @__PURE__ */ J("button", {
285
- type: "button",
286
- className: "underline",
287
- onClick: (e) => {
288
- e.stopPropagation(), ye();
289
- },
290
- "data-testid": "retry-upload",
291
- children: q("file.upload.retry", "Retry")
292
- })]
293
- })
294
- ]
295
- });
296
- }
297
- function pe(e, t) {
298
- return [
299
- "relative overflow-hidden border border-border bg-surface-2",
300
- e === "circle" ? "rounded-full" : "rounded-md",
301
- t ? "cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent" : ""
302
- ].filter(Boolean).join(" ");
303
- }
304
- function me(e) {
305
- return "h-full w-full object-cover";
306
- }
307
- function he(e, t) {
308
- return t ? t.replace(":", " / ") : e === "wide" ? "16 / 9" : "1 / 1";
309
- }
310
- function ge(e) {
311
- if (!e) return;
312
- let t = e.replace(/\s/g, "").match(/^(\d+(?:\.\d+)?)[:/](\d+(?:\.\d+)?)$/);
313
- if (!t) return;
314
- let n = Number(t[1]), r = Number(t[2]);
315
- if (n && r) return n / r;
316
- }
317
- function _e({ shape: e, initialsTitle: t }) {
318
- let n = s();
319
- return t ? /* @__PURE__ */ J("div", {
320
- className: "flex h-full w-full items-center justify-center bg-surface-3 text-text-3",
321
- children: /* @__PURE__ */ J("span", {
322
- className: e === "circle" ? "text-lg font-medium" : "text-base font-medium",
323
- children: de(t)
324
- })
325
- }) : /* @__PURE__ */ J("div", {
326
- className: "flex h-full w-full items-center justify-center bg-surface-3 text-text-4",
327
- children: /* @__PURE__ */ J("span", {
328
- className: "text-xs",
329
- children: e === "wide" ? n("file.image.drop", "Drop image here") : "+"
330
- })
331
- });
332
- }
333
- function ve({ pct: e, label: t }) {
334
- let n = 2 * Math.PI * 18, r = n - Math.max(0, Math.min(100, e)) / 100 * n;
335
- return /* @__PURE__ */ Y("div", {
336
- className: "absolute inset-0 flex items-center justify-center bg-black/30",
337
- "data-testid": "upload-progress",
338
- "aria-label": t,
339
- role: "progressbar",
340
- "aria-valuenow": Math.round(e),
341
- "aria-valuemin": 0,
342
- "aria-valuemax": 100,
343
- children: [/* @__PURE__ */ Y("svg", {
344
- width: "48",
345
- height: "48",
346
- viewBox: "0 0 48 48",
347
- children: [/* @__PURE__ */ J("circle", {
348
- cx: "24",
349
- cy: "24",
350
- r: 18,
351
- stroke: "currentColor",
352
- strokeOpacity: "0.25",
353
- strokeWidth: "4",
354
- fill: "none",
355
- className: "text-foreground"
356
- }), /* @__PURE__ */ J("circle", {
357
- cx: "24",
358
- cy: "24",
359
- r: 18,
360
- stroke: "currentColor",
361
- strokeWidth: "4",
362
- fill: "none",
363
- strokeDasharray: n,
364
- strokeDashoffset: r,
365
- strokeLinecap: "round",
366
- className: "text-accent",
367
- transform: "rotate(-90 24 24)"
368
- })]
369
- }), /* @__PURE__ */ Y("span", {
370
- className: "absolute text-xs text-foreground",
371
- children: [Math.round(e), "%"]
372
- })]
373
- });
374
- }
375
- //#endregion
376
- //#region src/components/file-widgets/SquareImage.tsx
377
- function ye(e) {
378
- return /* @__PURE__ */ J(fe, {
379
- ...e,
380
- visual: { shape: "square" }
381
- });
382
- }
383
- //#endregion
384
- //#region src/components/file-widgets/CircleImage.tsx
385
- function be(e) {
386
- return /* @__PURE__ */ J(fe, {
387
- ...e,
388
- visual: { shape: "circle" }
389
- });
390
- }
391
- //#endregion
392
- //#region src/components/file-widgets/WideBanner.tsx
393
- function xe(e) {
394
- return /* @__PURE__ */ J(fe, {
395
- ...e,
396
- visual: { shape: "wide" }
397
- });
398
- }
399
- //#endregion
400
- //#region src/components/file-widgets/GridLazy.tsx
401
- var Se = H(() => import("./Grid-XUHm5SDe.js").then((e) => ({ default: e.Grid })));
402
- function Ce() {
403
- return /* @__PURE__ */ J("div", { className: "h-24 w-full rounded-md bg-muted animate-pulse" });
404
- }
405
- function we(e) {
406
- return /* @__PURE__ */ J(V, {
407
- fallback: /* @__PURE__ */ J(Ce, {}),
408
- children: /* @__PURE__ */ J(Se, { ...e })
409
- });
410
- }
411
- //#endregion
412
- //#region src/components/file-widgets/DocumentCard.tsx
413
- function Te({ contentType: e }) {
414
- let t = s(), n = e ? e.includes("pdf") ? "PDF" : e.includes("word") ? "DOC" : e.includes("sheet") || e.includes("excel") ? "XLS" : e.startsWith("image/") ? "IMG" : e.split("/")[1]?.slice(0, 4).toUpperCase() ?? t("file.document.type_other", "FILE") : t("file.document.type_other", "FILE");
415
- return /* @__PURE__ */ J("div", {
416
- className: "flex h-16 w-16 flex-none items-center justify-center rounded-md border border-border bg-surface-3 text-xs font-medium text-muted-foreground",
417
- children: n
418
- });
419
- }
420
- function Ee(e) {
421
- let { field: t, fieldName: r, value: i, onChange: a, mode: o, disabled: c, uploadFieldCode: l, uploadSlotCode: u } = e, d = F(i), [f, p] = K("idle"), [h, g] = K(null), [v, b] = K(null), [S, C] = K(!1), [O, A] = K(d?.filename ?? ""), j = G(null), M = G(!1), N = G(null), { register: ee, unregister: L, isDraft: R } = x(), z = s(), B = s("errors"), { open: V } = te();
422
- W(() => () => {
423
- j.current && j.current.abort();
424
- }, []), W(() => {
425
- A(d?.filename ?? "");
426
- }, [d?.filename]);
427
- let H = (t.accepts ?? []).join(","), re = U(async (n) => {
428
- let i = T(n, t.accepts, t.max_size_bytes);
429
- if (i) {
430
- b(E(z, B, i)), p("error");
431
- return;
432
- }
433
- b(null), M.current = !1, p("uploading"), g({
434
- loaded: 0,
435
- total: n.size,
436
- pct: 0
437
- });
438
- let o = new AbortController();
439
- j.current = o;
440
- try {
441
- let i = await m({
442
- file: n,
443
- entityCode: e.entityCode,
444
- fieldCode: l ?? r,
445
- slotCode: u,
446
- signal: o.signal,
447
- onProgress: g
448
- });
449
- if (M.current) {
450
- D(i.id).catch(() => {}), L(i.id);
451
- return;
452
- }
453
- d && R(d.id) && (D(d.id).catch(() => {}), L(d.id)), ee(i.id, () => D(i.id)), p("idle"), g(null);
454
- let s = {
455
- id: i.id,
456
- filename: i.filename,
457
- content_type: i.content_type,
458
- size_bytes: i.size_bytes,
459
- sha256: i.sha256,
460
- width: i.width,
461
- height: i.height,
462
- url: i.url,
463
- metadata: i.metadata
464
- };
465
- a?.(t.mode === "array" ? [s] : s);
466
- } catch (e) {
467
- if (e instanceof w && e.code === "ABORTED") return;
468
- b(_(z, B, e)), p("error"), g(null);
469
- }
470
- }, [
471
- B,
472
- z,
473
- t.accepts,
474
- t.max_size_bytes,
475
- t.mode,
476
- r,
477
- d,
478
- R,
479
- a,
480
- e.entityCode,
481
- ee,
482
- L,
483
- l,
484
- u
485
- ]), ie = U(() => {
486
- c || N.current?.click();
487
- }, [c]), X = U((e) => {
488
- let t = e.target.files?.[0];
489
- e.target.value = "", t && re(t);
490
- }, [re]), Z = U(() => {
491
- d && R(d.id) && (D(d.id).catch(() => {}), L(d.id)), a?.(t.mode === "array" ? [] : null);
492
- }, [
493
- d,
494
- t.mode,
495
- R,
496
- a,
497
- L
498
- ]), ae = U(() => {
499
- f === "uploading" && j.current && (M.current = !0, j.current.abort(), j.current = null, p("idle"), g(null));
500
- }, [f]), oe = U(() => {
501
- d && V(d.id, "download", I(d));
502
- }, [d, V]), se = d ? k(d) : !1, ce = U(() => {
503
- d && k(d) && V(d.id, "preview", ne(d));
504
- }, [d, V]), le = U(() => {
505
- if (!d) {
506
- C(!1);
507
- return;
508
- }
509
- let e = O.trim();
510
- if (C(!1), !e || e === d.filename) {
511
- A(d.filename);
512
- return;
513
- }
514
- let n = {
515
- ...d,
516
- filename: e
517
- };
518
- a?.(t.mode === "array" ? [n] : n);
519
- }, [
520
- O,
521
- d,
522
- a,
523
- t.mode
524
- ]), Q = o === "display";
525
- return !d && f !== "uploading" ? /* @__PURE__ */ Y("div", {
526
- "data-testid": `file-widget-${r}`,
527
- className: "flex items-center gap-3 rounded-md border border-dashed border-border bg-surface p-3",
528
- children: [
529
- /* @__PURE__ */ J(Te, {}),
530
- /* @__PURE__ */ Y("div", {
531
- className: "flex flex-col gap-1",
532
- children: [/* @__PURE__ */ J("span", {
533
- className: "text-sm text-foreground",
534
- children: z(t.display?.placeholder) || z("file.document.empty", "No document attached")
535
- }), !Q && /* @__PURE__ */ J("button", {
536
- type: "button",
537
- className: "self-start rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
538
- onClick: ie,
539
- disabled: c,
540
- "data-testid": "upload",
541
- children: z("file.document.upload", "Upload")
542
- })]
543
- }),
544
- !Q && /* @__PURE__ */ J("input", {
545
- ref: N,
546
- type: "file",
547
- accept: H || void 0,
548
- onChange: X,
549
- style: { display: "none" },
550
- "data-testid": `file-input-${r}`
551
- }),
552
- f === "error" && v && /* @__PURE__ */ J("div", {
553
- className: "ml-auto text-xs text-destructive",
554
- role: "alert",
555
- children: /* @__PURE__ */ J(P, { failure: v })
556
- })
557
- ]
558
- }) : /* @__PURE__ */ Y("div", {
559
- "data-testid": `file-widget-${r}`,
560
- className: "flex items-center gap-3 rounded-md border border-border bg-surface p-3",
561
- "aria-busy": f === "uploading" || void 0,
562
- "aria-invalid": f === "error" || void 0,
563
- children: [
564
- /* @__PURE__ */ J(Te, { contentType: d?.content_type }),
565
- /* @__PURE__ */ Y("div", {
566
- className: "flex min-w-0 flex-1 flex-col gap-1",
567
- children: [
568
- S && d ? /* @__PURE__ */ J("input", {
569
- type: "text",
570
- className: "rounded-sm border border-border bg-card px-1 py-0.5 text-sm text-foreground",
571
- value: O,
572
- autoFocus: !0,
573
- onChange: (e) => A(e.target.value),
574
- onBlur: le,
575
- onKeyDown: (e) => {
576
- e.key === "Enter" ? le() : e.key === "Escape" && (C(!1), A(d.filename));
577
- },
578
- "data-testid": "filename-input"
579
- }) : /* @__PURE__ */ J("button", {
580
- type: "button",
581
- className: "truncate text-left text-sm font-medium text-foreground hover:underline",
582
- onClick: () => !Q && d && C(!0),
583
- disabled: Q || c || !d,
584
- title: d?.filename,
585
- "data-testid": "filename",
586
- children: d?.filename ?? z("file.document.uploading", "Uploading…")
587
- }),
588
- /* @__PURE__ */ Y("div", {
589
- className: "flex flex-wrap gap-2 text-xs text-muted-foreground",
590
- children: [
591
- d && /* @__PURE__ */ J("span", { children: y(d.size_bytes) }),
592
- d?.page_count != null && /* @__PURE__ */ J("span", { children: n(z, "file.document.pages", d.page_count, {
593
- one: "{count} page",
594
- other: "{count} pages"
595
- }) }),
596
- d?.uploaded_at && /* @__PURE__ */ J("span", { children: De(d.uploaded_at) }),
597
- d?.uploaded_by && /* @__PURE__ */ J("span", { children: z("file.document.uploaded_by", "by {user}", { user: d.uploaded_by }) }),
598
- d?.version?.number != null && /* @__PURE__ */ J("span", {
599
- "data-testid": "version-badge",
600
- children: z("file.document.version", "v{number}", { number: d.version.number })
601
- })
602
- ]
603
- }),
604
- f === "uploading" && /* @__PURE__ */ J("div", {
605
- className: "text-xs text-muted-foreground",
606
- role: "progressbar",
607
- "aria-valuenow": h?.pct ?? 0,
608
- "aria-valuemin": 0,
609
- "aria-valuemax": 100,
610
- "data-testid": "upload-progress",
611
- children: z("file.upload.progress", "Uploading {pct}%", { pct: h?.pct ?? 0 })
612
- }),
613
- f === "error" && v && /* @__PURE__ */ J("div", {
614
- className: "text-xs text-destructive",
615
- role: "alert",
616
- children: /* @__PURE__ */ J(P, { failure: v })
617
- })
618
- ]
619
- }),
620
- /* @__PURE__ */ Y("div", {
621
- className: "flex flex-none items-center gap-1",
622
- children: [d && f !== "uploading" && /* @__PURE__ */ Y(q, { children: [
623
- /* @__PURE__ */ J("button", {
624
- type: "button",
625
- className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
626
- onClick: oe,
627
- "data-testid": "download",
628
- children: z("file.download", "Download")
629
- }),
630
- /* @__PURE__ */ J("button", {
631
- type: "button",
632
- className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-50",
633
- onClick: ce,
634
- disabled: !se,
635
- title: se ? void 0 : z("file.document.preview_images_only", "Preview is available only for images and PDFs"),
636
- "data-testid": "preview",
637
- children: z("file.document.preview", "Preview")
638
- }),
639
- !Q && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J("button", {
640
- type: "button",
641
- className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
642
- onClick: ie,
643
- disabled: c,
644
- "data-testid": "replace",
645
- children: z("file.document.replace", "Replace")
646
- }), /* @__PURE__ */ J("button", {
647
- type: "button",
648
- className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-destructive hover:bg-surface-2",
649
- onClick: Z,
650
- disabled: c,
651
- "data-testid": "remove",
652
- children: z("file.remove", "Remove")
653
- })] })
654
- ] }), f === "uploading" && /* @__PURE__ */ J("button", {
655
- type: "button",
656
- className: "rounded-sm border border-border bg-card px-2 py-1 text-xs",
657
- onClick: ae,
658
- "data-testid": "cancel-upload",
659
- children: z("file.upload.cancel", "Cancel")
660
- })]
661
- }),
662
- !Q && /* @__PURE__ */ J("input", {
663
- ref: N,
664
- type: "file",
665
- accept: H || void 0,
666
- onChange: X,
667
- style: { display: "none" },
668
- "data-testid": `file-input-${r}`
669
- })
670
- ]
671
- });
672
- }
673
- function De(e) {
674
- let t = new Date(e);
675
- return isNaN(t.getTime()) ? e : t.toISOString().slice(0, 10);
676
- }
677
- //#endregion
678
- //#region src/components/file-widgets/FileList.tsx
679
- function Oe(e) {
680
- return e ? (e.split("/")[1] ?? e).toUpperCase().slice(0, 6) : "";
681
- }
682
- function ke(e) {
683
- let { field: t, fieldName: n, value: r, onChange: i, mode: a, disabled: o } = e, c = z(r), [l, u] = K([]), { register: d, unregister: f, isDraft: p } = x(), h = s(), g = s("errors"), v = G(c);
684
- v.current = c;
685
- let b = G(null), S = G(/* @__PURE__ */ new Set()), C = G([]);
686
- C.current = l;
687
- let { open: O } = te();
688
- W(() => () => {
689
- C.current.forEach((e) => e.abort());
690
- }, []);
691
- let k = (t.accepts ?? []).join(","), A = a === "display", j = U(async (r) => {
692
- let a = T(r, t.accepts, t.max_size_bytes), o = `row-${Math.random().toString(36).slice(2)}-${Date.now()}`, s = new AbortController();
693
- if (a) u((e) => [...e, {
694
- localId: o,
695
- filename: r.name,
696
- progress: null,
697
- error: E(h, g, a),
698
- abort: () => {}
699
- }]);
700
- else {
701
- u((e) => [...e, {
702
- localId: o,
703
- filename: r.name,
704
- progress: {
705
- loaded: 0,
706
- total: r.size,
707
- pct: 0
708
- },
709
- error: null,
710
- abort: () => s.abort()
711
- }]);
712
- try {
713
- let t = await m({
714
- file: r,
715
- entityCode: e.entityCode,
716
- fieldCode: n,
717
- signal: s.signal,
718
- onProgress: (e) => u((t) => t.map((t) => t.localId === o ? {
719
- ...t,
720
- progress: e
721
- } : t))
722
- });
723
- if (S.current.delete(o)) {
724
- D(t.id).catch(() => {}), f(t.id);
725
- return;
726
- }
727
- d(t.id, () => D(t.id));
728
- let a = {
729
- id: t.id,
730
- filename: t.filename,
731
- content_type: t.content_type,
732
- size_bytes: t.size_bytes,
733
- sha256: t.sha256,
734
- width: t.width,
735
- height: t.height,
736
- url: t.url,
737
- metadata: t.metadata
738
- }, c = [...v.current, a];
739
- v.current = c, i?.(c), u((e) => e.filter((e) => e.localId !== o));
740
- } catch (e) {
741
- if (e instanceof w && e.code === "ABORTED") {
742
- u((e) => e.filter((e) => e.localId !== o));
743
- return;
744
- }
745
- let t = _(h, g, e);
746
- u((e) => e.map((e) => e.localId === o ? {
747
- ...e,
748
- error: t,
749
- progress: null,
750
- abort: () => {}
751
- } : e));
752
- }
753
- }
754
- }, [
755
- g,
756
- h,
757
- t.accepts,
758
- t.max_size_bytes,
759
- n,
760
- i,
761
- e.entityCode,
762
- d,
763
- f
764
- ]), M = U((e) => {
765
- Array.from(e).forEach((e) => void j(e));
766
- }, [j]), N = U(() => {
767
- o || b.current?.click();
768
- }, [o]), ee = U((e) => {
769
- let t = e.target.files;
770
- e.target.value = "", t && t.length > 0 && M(t);
771
- }, [M]), F = U((e) => {
772
- p(e) && (D(e).catch(() => {}), f(e)), i?.(c.filter((t) => t.id !== e));
773
- }, [
774
- p,
775
- c,
776
- i,
777
- f
778
- ]), L = U((e) => {
779
- O(e.id, "download", I(e));
780
- }, [O]);
781
- return /* @__PURE__ */ Y("div", {
782
- "data-testid": `file-widget-${n}`,
783
- className: "flex flex-col gap-2",
784
- children: [/* @__PURE__ */ Y("ul", {
785
- className: "flex flex-col divide-y divide-divider rounded-md border border-border bg-surface",
786
- children: [
787
- c.length === 0 && l.length === 0 && /* @__PURE__ */ J("li", {
788
- className: "px-3 py-4 text-center text-sm text-muted-foreground",
789
- children: h(t.display?.placeholder) || h("file.list.empty", "No files")
790
- }),
791
- c.map((e) => /* @__PURE__ */ Y("li", {
792
- className: "flex items-center gap-3 px-3 py-2",
793
- "data-testid": `row-${e.id}`,
794
- children: [
795
- /* @__PURE__ */ J("span", {
796
- className: "flex-none rounded-sm border border-border bg-surface-3 px-1.5 py-0.5 text-[10px] text-muted-foreground",
797
- children: Oe(e.content_type)
798
- }),
799
- /* @__PURE__ */ J("button", {
800
- type: "button",
801
- onClick: () => L(e),
802
- className: "min-w-0 flex-1 truncate text-left text-sm text-foreground hover:underline",
803
- title: e.filename,
804
- children: e.filename
805
- }),
806
- /* @__PURE__ */ J("span", {
807
- className: "flex-none text-xs text-muted-foreground",
808
- children: y(e.size_bytes)
809
- }),
810
- /* @__PURE__ */ J("button", {
811
- type: "button",
812
- className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs text-foreground hover:bg-surface-2",
813
- onClick: () => L(e),
814
- "data-testid": `download-${e.id}`,
815
- children: h("file.download", "Download")
816
- }),
817
- !A && /* @__PURE__ */ J("button", {
818
- type: "button",
819
- className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs text-destructive hover:bg-surface-2",
820
- onClick: () => F(e.id),
821
- disabled: o,
822
- "data-testid": `remove-${e.id}`,
823
- children: h("file.remove", "Remove")
824
- })
825
- ]
826
- }, e.id)),
827
- l.map((e) => /* @__PURE__ */ Y("li", {
828
- className: "flex items-center gap-3 px-3 py-2",
829
- "data-testid": `pending-row-${e.localId}`,
830
- "aria-busy": !e.error,
831
- "aria-invalid": !!e.error || void 0,
832
- children: [
833
- /* @__PURE__ */ J("span", {
834
- className: "flex-none truncate text-sm text-foreground",
835
- title: e.filename,
836
- children: e.filename
837
- }),
838
- /* @__PURE__ */ J("span", { className: "flex-1" }),
839
- e.error ? /* @__PURE__ */ J("span", {
840
- role: "alert",
841
- className: "text-xs text-destructive",
842
- children: /* @__PURE__ */ J(P, { failure: e.error })
843
- }) : /* @__PURE__ */ Y("span", {
844
- className: "text-xs text-muted-foreground",
845
- role: "progressbar",
846
- "aria-valuenow": e.progress?.pct ?? 0,
847
- "aria-valuemin": 0,
848
- "aria-valuemax": 100,
849
- children: [e.progress?.pct ?? 0, "%"]
850
- }),
851
- /* @__PURE__ */ J("button", {
852
- type: "button",
853
- className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs",
854
- onClick: () => {
855
- e.abort(), S.current.add(e.localId), u((t) => t.filter((t) => t.localId !== e.localId));
856
- },
857
- children: e.error ? h("file.upload.dismiss", "Dismiss") : h("file.upload.cancel", "Cancel")
858
- })
859
- ]
860
- }, e.localId))
861
- ]
862
- }), !A && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J("button", {
863
- type: "button",
864
- className: "self-start rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
865
- onClick: N,
866
- disabled: o,
867
- "data-testid": "add-files",
868
- children: h("file.list.add", "Add files")
869
- }), /* @__PURE__ */ J("input", {
870
- ref: b,
871
- type: "file",
872
- accept: k || void 0,
873
- multiple: !0,
874
- onChange: ee,
875
- style: { display: "none" },
876
- "data-testid": `file-input-${n}`
877
- })] })]
878
- });
879
- }
880
- //#endregion
881
- //#region src/components/file-widgets/UnknownFileWidget.tsx
882
- function Ae({ widgetCode: e }) {
883
- let t = s(), n = s("errors");
884
- return e ? /* @__PURE__ */ Y("span", {
885
- className: "text-sm text-muted-foreground",
886
- children: [
887
- n("file.unknown_widget", "This file field names a widget this deployment does not have."),
888
- " ",
889
- /* @__PURE__ */ J("span", {
890
- className: "opacity-80",
891
- children: t("file.widget_code", "Widget: {widget}", { widget: e })
892
- })
893
- ]
894
- }) : /* @__PURE__ */ J("span", {
895
- className: "text-sm text-muted-foreground",
896
- children: n("file.missing_widget", "This file field does not name a widget to show it.")
897
- });
898
- }
899
- //#endregion
900
- //#region src/components/file-widgets/LabeledSlots.tsx
901
- function je(e) {
902
- return !e || Array.isArray(e) || typeof e != "object" ? {} : e;
903
- }
904
- function Me(e, t) {
905
- return t?.content_type?.startsWith("image/") ? !0 : (e.accepts ?? []).some((e) => e === "image/*" || e.startsWith("image/"));
906
- }
907
- function Ne(e, t, n, r) {
908
- return {
909
- ...e,
910
- name: `${e.name}.${t}`,
911
- mode: "single",
912
- accepts: n.accepts ?? e.accepts,
913
- max_size_bytes: n.max_size_bytes ?? e.max_size_bytes,
914
- slots: void 0,
915
- display: {
916
- ...e.display ?? { widget: "document_card" },
917
- widget: Me(n, r) ? "square_image" : "document_card",
918
- aspect_ratio: n.aspect_ratio ?? e.display?.aspect_ratio
919
- }
920
- };
921
- }
922
- function Pe(e) {
923
- let { field: t, fieldName: n, entityCode: r, value: i, recordTitle: a, onChange: o, mode: c, disabled: l } = e, u = Object.entries(t.slots ?? {}), d = je(i), f = s();
924
- return u.length === 0 ? /* @__PURE__ */ J("span", {
925
- className: "text-sm text-muted-foreground",
926
- children: f("file.slots.empty", "No slots configured")
927
- }) : /* @__PURE__ */ J("div", {
928
- className: "grid gap-3",
929
- children: u.map(([e, i]) => {
930
- let s = d[e] ?? null, u = Ne(t, e, i, s), p = u.display?.widget ?? "document_card", m = ae(p);
931
- return m ? /* @__PURE__ */ Y("div", {
932
- className: "grid gap-1.5",
933
- children: [/* @__PURE__ */ J("div", {
934
- className: "text-xs font-semibold text-text-2",
935
- children: f(i.name)
936
- }), /* @__PURE__ */ J(m, {
937
- field: u,
938
- fieldName: e,
939
- entityCode: r,
940
- value: s,
941
- recordTitle: a,
942
- mode: c,
943
- disabled: l,
944
- uploadFieldCode: n,
945
- uploadSlotCode: e,
946
- onChange: (t) => {
947
- o && o({
948
- ...d,
949
- [e]: t ?? null
950
- });
951
- }
952
- })]
953
- }, e) : /* @__PURE__ */ Y("div", {
954
- className: "grid gap-1.5",
955
- children: [/* @__PURE__ */ J("div", {
956
- className: "text-xs font-semibold text-text-2",
957
- children: f(i.name)
958
- }), /* @__PURE__ */ J(Ae, { widgetCode: p })]
959
- }, e);
960
- })
961
- });
962
- }
963
- //#endregion
964
- //#region src/components/file-widgets/builtins.ts
965
- var Fe = !1;
966
- function Ie() {
967
- Fe ||= (Z("square_image", ye), Z("circle_image", be), Z("wide_banner", xe), Z("grid", we), Z("document_card", Ee), Z("file_list", ke), Z("labeled_slots", Pe), !0);
968
- }
969
- //#endregion
970
- //#region src/components/file-widgets/host.tsx
971
- Ie();
972
- function Le(e, t) {
973
- return e.files?.get(t);
974
- }
975
- function Re(e, t) {
976
- return Object.prototype.hasOwnProperty.call(e, t) ? e[t] ?? null : e.$files?.[t] ?? null;
977
- }
978
- function ze(e, t, n) {
979
- if (Le(e, n)) return Re(t, n);
980
- let r = e.fields.get(n);
981
- return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? v(t[n], Re(t, n)) : t[n];
982
- }
983
- function Be(e, t, n) {
984
- let r = ze(e, t, n);
985
- return r == null || r === "" ? !1 : Array.isArray(r) ? r.length > 0 : typeof r != "object" || Object.keys(r).length > 0;
986
- }
987
- function Ve(e, t, n) {
988
- let r = e.fields.get(t);
989
- return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? h(n) : n;
990
- }
991
- function He(e, t, n, r) {
992
- let i = Le(t, n);
993
- if (i) return i.name || n;
994
- let o = t.fields.get(n);
995
- return o ? a(e, o, n, r) : n;
996
- }
997
- function Ue(e) {
998
- let { entity: t, entityCode: n, fieldName: r, record: i, mode: a, onChange: s, refs: c, disabled: l, surface: u, entities: d, screens: f, t: p, fieldId: m, labelId: h, structure: g, detailScreen: _ } = e, v = Le(t, r);
999
- if (v) {
1000
- let e = v.display?.widget ?? "", c = ae(e);
1001
- return c ? /* @__PURE__ */ J(c, {
1002
- field: v,
1003
- fieldName: r,
1004
- entityCode: n,
1005
- value: Re(i, r),
1006
- recordTitle: o(p, i, t),
1007
- mode: a,
1008
- onChange: s,
1009
- disabled: l,
1010
- fieldId: m
1011
- }) : /* @__PURE__ */ J(Ae, { widgetCode: e });
1012
- }
1013
- let y = t.fields.get(r), x = g && a === "display" && y ? {
1014
- ...y,
1015
- structure: g
1016
- } : y;
1017
- return x ? b({
1018
- field: x,
1019
- entityCode: n,
1020
- fieldName: r,
1021
- value: ze(t, i, r),
1022
- mode: a,
1023
- onChange: s,
1024
- record: i,
1025
- refs: c,
1026
- surface: u,
1027
- entity: n && d ? d[n] : void 0,
1028
- entities: d,
1029
- screens: f,
1030
- t: p,
1031
- fieldId: m,
1032
- labelId: h,
1033
- detailScreen: _
1034
- }) : null;
1035
- }
1036
- //#endregion
1037
- //#region src/lib/action-dispatch.ts
1038
- function We(e, t, n, r, i) {
1039
- return S(n) ? (C(e, n.ui_steps, r), null) : n.entity ? `${n.entity}.${t}` : i ? `${i}.${t}` : t;
1040
- }
1041
- //#endregion
1042
- //#region src/components/actions/ResponsiveActionBar.tsx
1043
- function Ge(e, t) {
1044
- return e.replace(/\$\{([^}]+)\}/g, (e, n) => Object.prototype.hasOwnProperty.call(t, n) ? t[n] : e);
1045
- }
1046
- function Ke(e) {
1047
- return e.widget ? "widget" : e.href ? "href" : e.handler ? "handler" : e.association ? "association" : e.ui_steps && e.ui_steps.length > 0 ? "ui_steps" : "unknown";
1048
- }
1049
- function qe(e, t, n, i, a) {
1050
- let o = Ke(t), s = r(n, i?.entity), c = i?.entityCode ?? "";
1051
- if (e === "__peek") return a?.({
1052
- code: e,
1053
- entity: c,
1054
- mode: "peek",
1055
- rowId: s
1056
- }), i?.openPeek?.(n), !0;
1057
- if (a?.({
1058
- code: e,
1059
- entity: c,
1060
- mode: o,
1061
- rowId: s
1062
- }), o === "widget") return console.warn(`[ResponsiveActionBar] widget "${t.widget}" requested for action "${e}" but the SDK has no widget registry yet; falling back to onRun.`), !1;
1063
- if (o === "href" && i) {
1064
- let n = e === "__open" || e === "__edit" ? i.recordHref?.(s) : null, r = n ? e === "__edit" ? `${n}?edit=true` : n : Ge(t.href ?? "", {
1065
- entity: c,
1066
- id: encodeURIComponent(s)
1067
- }), a = r.indexOf("?");
1068
- return a === -1 ? i.tabNavigate(r) : i.tabNavigate(r.slice(0, a), { search: r.slice(a + 1) }), !0;
1069
- }
1070
- return o === "handler" || o === "association" || o === "ui_steps" || o === "unknown" && console.warn(`[ResponsiveActionBar] no dispatch mode set on action "${e}" (none of handler/association/widget/href/ui_steps).`), !1;
1071
- }
1072
- function Je(e) {
1073
- let t = 0;
1074
- for (let n of e) n.kind === "action" ? t++ : t += Je(n.items);
1075
- return t;
1076
- }
1077
- function Ye(e, t, n) {
1078
- let r = [], i = [];
1079
- for (let a of e) a.kind === "action" && Ze(a.code, t, n)?.destructive ? i.push(a) : r.push(a);
1080
- return {
1081
- normal: r,
1082
- destructive: i
1083
- };
1084
- }
1085
- function Xe(e, t, n) {
1086
- let r = [], i = [], a = [];
1087
- for (let o of e) {
1088
- if (o.kind !== "action") {
1089
- i.push(o);
1090
- continue;
1091
- }
1092
- let e = Ze(o.code, t, n), s = e?.destructive === !0, c = e?.display?.primary === !0;
1093
- s && c ? (console.warn(`[ResponsiveActionBar] action "${o.code}" declares both primary and destructive; treating as destructive.`), a.push(o)) : s ? a.push(o) : c ? r.push(o) : i.push(o);
1094
- }
1095
- return {
1096
- primary: r,
1097
- regular: i,
1098
- destructive: a
1099
- };
1100
- }
1101
- function Ze(e, t, n) {
1102
- if (t && e in t) return t[e];
1103
- if (n && e in n) return n[e];
1104
- }
1105
- function Qe(e, t, n, r) {
1106
- return e(Ze(t, n, r)?.display?.name) || t;
1107
- }
1108
- function $e(e, t, n) {
1109
- return Ze(e, t, n)?.display?.icon || void 0;
1110
- }
1111
- function et(e) {
1112
- return `action-tooltip-${e}`;
1113
- }
1114
- function tt({ leaf: e, entityActions: t, globalActions: n, onRun: r, loading: a, onLoadingChange: o, measureRef: c, style: l, row: u, widgetContext: f, onActionClick: p, iconOnly: m = !1 }) {
1115
- let h = s(), _ = Ze(e.code, t, n), v = Qe(h, e.code, t, n), y = $e(e.code, t, n), b = _?.destructive ?? !1, x = !b && _?.display?.primary === !0, S = !e.enabled, C = S ? et(e.code) : void 0, w = U(async () => {
1116
- if (!(!_ || S || a)) {
1117
- o(!0);
1118
- try {
1119
- qe(e.code, _, u, f, p) || await Promise.resolve(r(e.code, _));
1120
- } finally {
1121
- o(!1);
1122
- }
1123
- }
1124
- }, [
1125
- _,
1126
- S,
1127
- a,
1128
- r,
1129
- e.code,
1130
- o,
1131
- u,
1132
- f,
1133
- p
1134
- ]), T = a ? /* @__PURE__ */ J(g, { size: 12 }) : y ? /* @__PURE__ */ J(O, {
1135
- name: y,
1136
- size: 12
1137
- }) : null;
1138
- return /* @__PURE__ */ Y(q, { children: [C && e.reason && /* @__PURE__ */ J("span", {
1139
- id: C,
1140
- role: "tooltip",
1141
- style: {
1142
- position: "absolute",
1143
- width: 1,
1144
- height: 1,
1145
- overflow: "hidden",
1146
- clip: "rect(0,0,0,0)"
1147
- },
1148
- children: e.reason
1149
- }), /* @__PURE__ */ J(d, {
1150
- ref: c,
1151
- kind: x ? "primary" : "default",
1152
- danger: b,
1153
- icon: T,
1154
- disabled: S || a,
1155
- "aria-disabled": S ? "true" : void 0,
1156
- "aria-describedby": C,
1157
- "aria-label": m ? v : void 0,
1158
- title: i(h, _, v, S, e.reason, m),
1159
- onClick: w,
1160
- style: l,
1161
- children: m ? null : v
1162
- })] });
1163
- }
1164
- function nt({ group: e, entityActions: t, globalActions: n, onRun: r, loading: i, onLoadingChange: a, measureRef: o, style: c, row: u, widgetContext: p, onActionClick: m }) {
1165
- let h = s(), _ = G(null), [v, y] = K(!1), b = e.name ? h(e.name) : h("action.menu.title", "Actions"), x = U((e) => {
1166
- _.current = e, o?.(e);
1167
- }, [o]), S = U((e, t) => (y(!1), r(e, t)), [r]);
1168
- return /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(d, {
1169
- ref: x,
1170
- kind: "default",
1171
- icon: i == null ? e.icon ? /* @__PURE__ */ J(O, {
1172
- name: e.icon,
1173
- size: 12
1174
- }) : void 0 : /* @__PURE__ */ J(g, { size: 12 }),
1175
- iconRight: /* @__PURE__ */ J(l.down, { size: 10 }),
1176
- "aria-haspopup": "menu",
1177
- "aria-expanded": v ? "true" : "false",
1178
- title: b,
1179
- onClick: () => y((e) => !e),
1180
- style: c,
1181
- children: b
1182
- }), /* @__PURE__ */ J(f, {
1183
- open: v,
1184
- anchor: _.current,
1185
- onClose: () => y(!1),
1186
- align: "start",
1187
- width: 200,
1188
- children: /* @__PURE__ */ J("div", {
1189
- role: "menu",
1190
- "aria-label": b,
1191
- children: e.items.map((e) => e.kind === "action" ? /* @__PURE__ */ J(rt, {
1192
- leaf: e,
1193
- entityActions: t,
1194
- globalActions: n,
1195
- onRun: S,
1196
- loading: i === e.code,
1197
- onLoadingChange: (t) => a(t ? e.code : null),
1198
- row: u,
1199
- widgetContext: p,
1200
- onActionClick: m
1201
- }, e.code) : /* @__PURE__ */ J(it, {
1202
- group: e,
1203
- entityActions: t,
1204
- globalActions: n,
1205
- onRun: S,
1206
- loading: i,
1207
- onLoadingChange: a,
1208
- row: u,
1209
- widgetContext: p,
1210
- onActionClick: m
1211
- }, e.items[0]?.kind === "action" ? e.items[0].code : e.icon ?? "group"))
1212
- })
1213
- })] });
1214
- }
1215
- function rt({ leaf: e, entityActions: t, globalActions: n, onRun: r, loading: a, onLoadingChange: o, row: c, widgetContext: l, onActionClick: u }) {
1216
- let d = s(), f = Ze(e.code, t, n), p = Qe(d, e.code, t, n), m = $e(e.code, t, n), h = f?.destructive ?? !1, _ = !e.enabled, v = _ ? et(e.code) : void 0, y = a ? /* @__PURE__ */ J(g, { size: 12 }) : m ? /* @__PURE__ */ J(O, {
1217
- name: m,
1218
- size: 12
1219
- }) : null;
1220
- return /* @__PURE__ */ Y(q, { children: [v && e.reason && /* @__PURE__ */ J("span", {
1221
- id: v,
1222
- role: "tooltip",
1223
- style: {
1224
- position: "absolute",
1225
- width: 1,
1226
- height: 1,
1227
- overflow: "hidden",
1228
- clip: "rect(0,0,0,0)"
1229
- },
1230
- children: e.reason
1231
- }), /* @__PURE__ */ Y("div", {
1232
- role: "menuitem",
1233
- "aria-disabled": _ ? "true" : void 0,
1234
- "aria-describedby": v,
1235
- title: i(d, f, p, _, e.reason),
1236
- onClick: async () => {
1237
- if (!(!f || _ || a)) {
1238
- o(!0);
1239
- try {
1240
- qe(e.code, f, c, l, u) || await Promise.resolve(r(e.code, f));
1241
- } finally {
1242
- o(!1);
1243
- }
1244
- }
1245
- },
1246
- style: {
1247
- display: "flex",
1248
- alignItems: "center",
1249
- gap: 8,
1250
- padding: "6px 10px",
1251
- borderRadius: 5,
1252
- fontSize: 12.5,
1253
- color: h ? "var(--danger)" : _ ? "var(--text-3)" : "var(--text-2)",
1254
- cursor: _ ? "not-allowed" : "pointer",
1255
- opacity: _ ? .6 : 1
1256
- },
1257
- onMouseEnter: (e) => {
1258
- _ || (e.currentTarget.style.background = "var(--surface-3)");
1259
- },
1260
- onMouseLeave: (e) => {
1261
- e.currentTarget.style.background = "transparent";
1262
- },
1263
- children: [y && /* @__PURE__ */ J("span", {
1264
- style: {
1265
- color: h ? "var(--danger)" : "var(--text-3)",
1266
- display: "flex"
1267
- },
1268
- children: y
1269
- }), /* @__PURE__ */ J("span", {
1270
- style: { flex: 1 },
1271
- children: p
1272
- })]
1273
- })] });
1274
- }
1275
- function it({ group: e, entityActions: t, globalActions: n, onRun: r, loading: i, onLoadingChange: a, row: o, widgetContext: c, onActionClick: l }) {
1276
- let u = s(), d = e.name ? u(e.name) : void 0;
1277
- return /* @__PURE__ */ Y(q, { children: [d && /* @__PURE__ */ J("div", {
1278
- style: {
1279
- padding: "4px 10px 2px",
1280
- fontSize: 10.5,
1281
- fontWeight: 600,
1282
- color: "var(--text-3)",
1283
- textTransform: "uppercase",
1284
- letterSpacing: "0.05em"
1285
- },
1286
- children: d
1287
- }), e.items.map((e) => e.kind === "action" ? /* @__PURE__ */ J(rt, {
1288
- leaf: e,
1289
- entityActions: t,
1290
- globalActions: n,
1291
- onRun: r,
1292
- loading: i === e.code,
1293
- onLoadingChange: (t) => a(t ? e.code : null),
1294
- row: o,
1295
- widgetContext: c,
1296
- onActionClick: l
1297
- }, e.code) : /* @__PURE__ */ J(it, {
1298
- group: e,
1299
- entityActions: t,
1300
- globalActions: n,
1301
- onRun: r,
1302
- loading: i,
1303
- onLoadingChange: a,
1304
- row: o,
1305
- widgetContext: c,
1306
- onActionClick: l
1307
- }, e.icon ?? "nested"))] });
1308
- }
1309
- function at({ layout: e, entityActions: t, globalActions: n, onRun: r, row: i, widgetContext: a, onActionClick: o }) {
1310
- let c = s(), d = G(null), [p, m] = K(!1), [h, _] = K(null), v = U((e, t) => (m(!1), r(e, t)), [r]);
1311
- return Je(e) === 0 ? null : /* @__PURE__ */ Y("div", {
1312
- "data-open": p ? "true" : void 0,
1313
- style: {
1314
- display: "inline-flex",
1315
- alignItems: "center"
1316
- },
1317
- children: [/* @__PURE__ */ J(u, {
1318
- ref: d,
1319
- icon: J(h == null ? l.more : g, { size: 14 }),
1320
- title: c("action.menu.title", "Actions"),
1321
- size: 28,
1322
- onClick: () => m((e) => !e)
1323
- }), /* @__PURE__ */ J(f, {
1324
- open: p,
1325
- anchor: d.current,
1326
- onClose: () => m(!1),
1327
- align: "end",
1328
- width: 220,
1329
- children: /* @__PURE__ */ J(st, {
1330
- layout: e,
1331
- entityActions: t,
1332
- globalActions: n,
1333
- onRun: v,
1334
- loading: h,
1335
- onLoadingChange: _,
1336
- row: i,
1337
- widgetContext: a,
1338
- onActionClick: o
1339
- })
1340
- })]
1341
- });
1342
- }
1343
- function ot(e) {
1344
- let t = 0;
1345
- for (let n of e) if (n.kind === "action" && c(n.code)) t++;
1346
- else break;
1347
- return t;
1348
- }
1349
- function st({ layout: e, entityActions: t, globalActions: n, onRun: r, loading: i, onLoadingChange: a, row: o, widgetContext: c, onActionClick: l, ariaLabel: u }) {
1350
- let d = s(), { normal: f, destructive: m } = Ye(e, t, n), h = ot(f), g = f.slice(0, h), _ = f.slice(h), v = m.length > 0, y = _.length > 0, b = (e) => /* @__PURE__ */ J(rt, {
1351
- leaf: e,
1352
- entityActions: t,
1353
- globalActions: n,
1354
- onRun: r,
1355
- loading: i === e.code,
1356
- onLoadingChange: (t) => a(t ? e.code : null),
1357
- row: o,
1358
- widgetContext: c,
1359
- onActionClick: l
1360
- }, e.code);
1361
- return /* @__PURE__ */ Y("div", {
1362
- role: "menu",
1363
- "aria-label": u ?? d("action.menu.row_actions", "Row actions"),
1364
- children: [
1365
- g.map((e) => e.kind === "action" ? b(e) : null),
1366
- g.length > 0 && y && /* @__PURE__ */ J(p, { divider: !0 }),
1367
- _.map((e) => e.kind === "action" ? b(e) : /* @__PURE__ */ J(it, {
1368
- group: e,
1369
- entityActions: t,
1370
- globalActions: n,
1371
- onRun: r,
1372
- loading: i,
1373
- onLoadingChange: a,
1374
- row: o,
1375
- widgetContext: c,
1376
- onActionClick: l
1377
- }, e.icon ?? "group")),
1378
- v && /* @__PURE__ */ J(p, { divider: !0 }),
1379
- m.map((e) => b(e))
1380
- ]
1381
- });
1382
- }
1383
- var ct = "__overflow_trigger__", lt = 90, ut = 4, dt = 8;
1384
- function ft(e) {
1385
- return `icon:${$(e)}`;
1386
- }
1387
- function pt() {
1388
- return dt;
1389
- }
1390
- function mt(e, t, n) {
1391
- return [
1392
- ...e,
1393
- ...t,
1394
- ...n
1395
- ];
1396
- }
1397
- var ht = () => {}, gt = () => Promise.resolve();
1398
- function _t(e) {
1399
- return (t) => {
1400
- t && (t.setAttribute("data-node-key", e), t.setAttribute("tabindex", "-1"));
1401
- };
1402
- }
1403
- function vt(e, t) {
1404
- if (e.size !== t.size) return !1;
1405
- for (let [n, r] of t) if (e.get(n) !== r) return !1;
1406
- return !0;
1407
- }
1408
- function yt(e, t) {
1409
- return t.get($(e)) ?? 0;
1410
- }
1411
- function bt(e, t) {
1412
- return t.get(ft(e));
1413
- }
1414
- function xt(e, t, n, r, i, a, o, s, c) {
1415
- let { primary: l, regular: u, destructive: d } = Xe(e, i, a), f = ut, p = r.get(ct) ?? lt, m = t - n, h = mt(l, u, d), g = /* @__PURE__ */ new Set(), _ = /* @__PURE__ */ new Set();
1416
- if (o) for (let e of h) o(e) && g.add($(e));
1417
- else {
1418
- let e = (e, t) => t ? bt(e, r) ?? yt(e, r) : yt(e, r), t = (e) => s ? e.filter((e) => !s.has($(e))).length * pt() : 0, n = (e, t) => c ? e.slice(0, t).filter((e) => c.has($(e))).length * pt() : 0, i = (r, i) => {
1419
- let a = r.length < h.length ? p + f : 0, o = r.length > 1 ? (r.length - 1) * f : 0;
1420
- return r.reduce((t, n, r) => t + e(n, r >= i), 0) + o + a + t(r) + n(r, i) <= m;
1421
- }, a = 0, o = !1;
1422
- for (let e = h.length; e >= 1 && a === 0; e--) i(h.slice(0, e), 1) ? a = e : i(h.slice(0, e), 0) && (a = e, o = !0);
1423
- let l = o ? 0 : Math.min(1, a), u = h.slice(0, a);
1424
- for (; l < a && i(u, l + 1);) l++;
1425
- u.forEach((e, t) => {
1426
- let n = $(e);
1427
- g.add(n), t >= l && _.add(n);
1428
- });
1429
- }
1430
- let v = (e) => g.has($(e)), y = [
1431
- ...l,
1432
- ...u,
1433
- ...d
1434
- ].filter((e) => !v(e));
1435
- return {
1436
- primaryInline: l.filter(v),
1437
- inline: u.filter(v),
1438
- overflow: y,
1439
- destructiveInline: d.filter(v),
1440
- iconOnly: _
1441
- };
1442
- }
1443
- function $(e) {
1444
- return e.kind === "action" ? `action:${e.code}` : `group:${JSON.stringify(e.name ?? {})}`;
1445
- }
1446
- function St(e) {
1447
- let t = e.parentElement;
1448
- for (; t && getComputedStyle(t).display === "contents";) t = t.parentElement;
1449
- if (!t) return !1;
1450
- let n = getComputedStyle(t);
1451
- return !(parseFloat(n.flexGrow) > 0 || n.display === "block" || n.display === "flow-root" || n.width !== "auto" || n.maxWidth !== "none");
1452
- }
1453
- function Ct({ layout: e, entityActions: t, globalActions: n, onRun: r, reservedRightWidth: i = 0, measurementOverride: a, ariaLabel: o, align: c = "trailing", constrain: u = !0, row: m, widgetContext: h, onActionClick: g }) {
1454
- let _ = s(), v = G(null), y = G(null), [b, x] = K(0), [S, C] = K(/* @__PURE__ */ new Map()), [w, T] = K(!1), [E, D] = K(null), [O, k] = K(() => typeof document < "u" && document.documentElement.dir === "rtl");
1455
- W(() => {
1456
- if (typeof MutationObserver > "u") return;
1457
- let e = new MutationObserver((e) => {
1458
- for (let t of e) t.attributeName === "dir" && k(document.documentElement.dir === "rtl"), t.attributeName === "lang" && T(!1);
1459
- });
1460
- return e.observe(document.documentElement, {
1461
- attributes: !0,
1462
- attributeFilter: ["dir", "lang"]
1463
- }), () => e.disconnect();
1464
- }, []);
1465
- let A = G(null), [j, M] = K(!1), N = U((e, t) => (M(!1), r(e, t)), [r]), ee = Je(e), P = !!a, F = U(() => {
1466
- if (P || !y.current) return;
1467
- let e = Array.from(y.current.children), t = /* @__PURE__ */ new Map();
1468
- e.forEach((e) => {
1469
- let n = e.dataset.nodeKey;
1470
- n && t.set(n, e.getBoundingClientRect().width || e.offsetWidth);
1471
- }), C((e) => vt(e, t) ? e : t), T(!0);
1472
- }, [P]), I = ie(() => JSON.stringify(e.map((e) => $(e))), [e]);
1473
- W(() => {
1474
- if (P) return;
1475
- let e = y.current;
1476
- if (!e || typeof ResizeObserver > "u") return;
1477
- let t = new ResizeObserver(() => F());
1478
- t.observe(e);
1479
- for (let n of Array.from(e.children)) t.observe(n);
1480
- return () => t.disconnect();
1481
- }, [
1482
- F,
1483
- P,
1484
- I
1485
- ]), re(() => {
1486
- if (P) {
1487
- T(!0);
1488
- return;
1489
- }
1490
- T(!1);
1491
- let e = requestAnimationFrame(() => {
1492
- F();
1493
- });
1494
- return () => cancelAnimationFrame(e);
1495
- }, [
1496
- I,
1497
- F,
1498
- P
1499
- ]), W(() => {
1500
- if (P || w) return;
1501
- let e = setTimeout(() => {
1502
- F(), T(!0);
1503
- }, 16);
1504
- return () => clearTimeout(e);
1505
- }, [
1506
- w,
1507
- F,
1508
- P
1509
- ]), W(() => {
1510
- if (P || !u || !w || b === 0) return;
1511
- let e = v.current;
1512
- if (!e || !St(e)) return;
1513
- let t = [...e.children].filter((e) => e.getAttribute("aria-hidden") !== "true"), n = t.length > 1 ? (t.length - 1) * 4 : 0, r = t.reduce((e, t) => e + t.getBoundingClientRect().width, 0) + n;
1514
- r > 0 && Math.abs(b - r) < 1 && console.error(`[declarion] ResponsiveActionBar is measuring itself: its container is ${Math.round(b)}px, exactly the width of what it just rendered. The slot holding this bar is sized by its own content, so it cannot tell the bar how much room there is. Give that slot \`flex: 1 1 auto; min-width: 0\` (and justify its content to the edge the buttons sit on), or pass \`constrain={false}\` if it genuinely has no row to take space from.`);
1515
- }, [
1516
- P,
1517
- u,
1518
- w,
1519
- b,
1520
- S
1521
- ]), W(() => {
1522
- if (P) return;
1523
- let e = v.current;
1524
- if (!e) return;
1525
- if (typeof ResizeObserver > "u") {
1526
- x(e.getBoundingClientRect().width);
1527
- return;
1528
- }
1529
- let t = new ResizeObserver((e) => {
1530
- let t = e[0];
1531
- t && x(t.contentRect.width);
1532
- });
1533
- return t.observe(e), x(e.getBoundingClientRect().width), () => t.disconnect();
1534
- }, [P]);
1535
- let L = G(void 0), te = G(void 0);
1536
- W(() => {
1537
- L.current = void 0, te.current = void 0;
1538
- }, [I]);
1539
- let R = ie(() => P || !u ? xt(e, 2 ** 53 - 1, i, S, t, n, a) : w ? b === 0 ? xt(e, 2 ** 53 - 1, i, S, t, n, a) : xt(e, b, i, S, t, n, a, L.current, te.current) : {
1540
- primaryInline: [],
1541
- inline: [],
1542
- overflow: [],
1543
- destructiveInline: [],
1544
- iconOnly: /* @__PURE__ */ new Set()
1545
- }, [
1546
- P,
1547
- u,
1548
- w,
1549
- b,
1550
- e,
1551
- i,
1552
- S,
1553
- t,
1554
- n,
1555
- a
1556
- ]);
1557
- if (W(() => {
1558
- (w || P) && (L.current = new Set([
1559
- ...R.primaryInline,
1560
- ...R.inline,
1561
- ...R.destructiveInline
1562
- ].map($)), te.current = new Set(R.iconOnly));
1563
- }, [
1564
- R,
1565
- w,
1566
- P
1567
- ]), ee === 0) return null;
1568
- let z = R.overflow.length > 0, { normal: ne, destructive: V } = Ye(R.overflow, t, n);
1569
- return /* @__PURE__ */ Y("div", {
1570
- ref: v,
1571
- role: "toolbar",
1572
- "aria-label": o ?? _("action.menu.title", "Actions"),
1573
- style: {
1574
- display: "flex",
1575
- flexDirection: O ? "row-reverse" : "row",
1576
- alignItems: "center",
1577
- gap: ut,
1578
- flexWrap: "wrap",
1579
- visibility: w || P ? "visible" : "hidden",
1580
- position: "relative",
1581
- flex: u ? "1 1 auto" : "0 1 auto",
1582
- justifyContent: c === "trailing" ? "flex-end" : "flex-start",
1583
- minWidth: 0,
1584
- boxSizing: "border-box"
1585
- },
1586
- children: [
1587
- /* @__PURE__ */ Y("div", {
1588
- ref: y,
1589
- "aria-hidden": "true",
1590
- inert: !0,
1591
- style: {
1592
- position: "absolute",
1593
- visibility: "hidden",
1594
- pointerEvents: "none",
1595
- display: "flex",
1596
- gap: 4,
1597
- top: 0,
1598
- left: 0,
1599
- width: "max-content",
1600
- flexWrap: "nowrap"
1601
- },
1602
- children: [/* @__PURE__ */ J(d, {
1603
- "data-node-key": ct,
1604
- iconRight: /* @__PURE__ */ J(l.down, { size: 10 }),
1605
- tabIndex: -1,
1606
- children: _("action.menu.title", "Actions")
1607
- }, ct), e.map((e) => {
1608
- let r = $(e);
1609
- return e.kind === "action" ? /* @__PURE__ */ Y(B, { children: [/* @__PURE__ */ J(tt, {
1610
- leaf: e,
1611
- entityActions: t,
1612
- globalActions: n,
1613
- onRun: gt,
1614
- loading: !1,
1615
- onLoadingChange: ht,
1616
- row: m,
1617
- widgetContext: h,
1618
- measureRef: _t(r)
1619
- }), $e(e.code, t, n) && /* @__PURE__ */ J(tt, {
1620
- leaf: e,
1621
- entityActions: t,
1622
- globalActions: n,
1623
- onRun: gt,
1624
- loading: !1,
1625
- onLoadingChange: ht,
1626
- row: m,
1627
- widgetContext: h,
1628
- iconOnly: !0,
1629
- measureRef: _t(ft(e))
1630
- })] }, r) : /* @__PURE__ */ J(nt, {
1631
- group: e,
1632
- entityActions: t,
1633
- globalActions: n,
1634
- onRun: gt,
1635
- loading: null,
1636
- onLoadingChange: ht,
1637
- row: m,
1638
- widgetContext: h,
1639
- onActionClick: g,
1640
- measureRef: _t(r)
1641
- }, r);
1642
- })]
1643
- }),
1644
- R.primaryInline.map((e) => /* @__PURE__ */ J(tt, {
1645
- leaf: e,
1646
- entityActions: t,
1647
- globalActions: n,
1648
- onRun: r,
1649
- loading: E === e.code,
1650
- onLoadingChange: (t) => D(t ? e.code : null),
1651
- row: m,
1652
- widgetContext: h,
1653
- onActionClick: g,
1654
- iconOnly: R.iconOnly.has($(e))
1655
- }, $(e))),
1656
- R.inline.map((e) => {
1657
- let i = $(e);
1658
- return e.kind === "action" ? /* @__PURE__ */ J(tt, {
1659
- leaf: e,
1660
- entityActions: t,
1661
- globalActions: n,
1662
- onRun: r,
1663
- loading: E === e.code,
1664
- onLoadingChange: (t) => D(t ? e.code : null),
1665
- row: m,
1666
- widgetContext: h,
1667
- onActionClick: g,
1668
- iconOnly: R.iconOnly.has(i)
1669
- }, i) : /* @__PURE__ */ J(nt, {
1670
- group: e,
1671
- entityActions: t,
1672
- globalActions: n,
1673
- onRun: r,
1674
- loading: E,
1675
- onLoadingChange: D,
1676
- row: m,
1677
- widgetContext: h,
1678
- onActionClick: g
1679
- }, i);
1680
- }),
1681
- z && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(d, {
1682
- ref: A,
1683
- kind: "default",
1684
- iconRight: /* @__PURE__ */ J(l.down, { size: 10 }),
1685
- "aria-haspopup": "menu",
1686
- "aria-expanded": j ? "true" : "false",
1687
- onClick: () => M((e) => !e),
1688
- children: _("action.menu.title", "Actions")
1689
- }), /* @__PURE__ */ J(f, {
1690
- open: j,
1691
- anchor: A.current,
1692
- onClose: () => M(!1),
1693
- align: O ? "start" : "end",
1694
- width: 220,
1695
- children: /* @__PURE__ */ J("div", {
1696
- role: "menu",
1697
- "aria-label": _("action.menu.more", "More actions"),
1698
- children: [
1699
- ...ne,
1700
- ...V.length > 0 ? [null] : [],
1701
- ...V
1702
- ].map((e, r) => e === null ? /* @__PURE__ */ J(p, { divider: !0 }, "destructive-divider") : e.kind === "action" ? /* @__PURE__ */ J(rt, {
1703
- leaf: e,
1704
- entityActions: t,
1705
- globalActions: n,
1706
- onRun: N,
1707
- loading: E === e.code,
1708
- onLoadingChange: (t) => D(t ? e.code : null),
1709
- row: m,
1710
- widgetContext: h,
1711
- onActionClick: g
1712
- }, e.code) : /* @__PURE__ */ J(it, {
1713
- group: e,
1714
- entityActions: t,
1715
- globalActions: n,
1716
- onRun: N,
1717
- loading: E,
1718
- onLoadingChange: D,
1719
- row: m,
1720
- widgetContext: h,
1721
- onActionClick: g
1722
- }, `${$(e)}-${r}`))
1723
- })
1724
- })] }),
1725
- R.destructiveInline.map((e) => /* @__PURE__ */ J(tt, {
1726
- leaf: e,
1727
- entityActions: t,
1728
- globalActions: n,
1729
- onRun: r,
1730
- loading: E === e.code,
1731
- onLoadingChange: (t) => D(t ? e.code : null),
1732
- row: m,
1733
- widgetContext: h,
1734
- onActionClick: g,
1735
- iconOnly: R.iconOnly.has($(e))
1736
- }, $(e)))
1737
- ]
1738
- });
1739
- }
1740
- function wt({ layout: e, rowSelection: t = [], ...n }) {
1741
- let r = t.length > 0;
1742
- return /* @__PURE__ */ Y("div", {
1743
- style: {
1744
- position: "relative",
1745
- display: "flex",
1746
- flex: "1 1 auto",
1747
- minWidth: 0
1748
- },
1749
- children: [/* @__PURE__ */ J("div", {
1750
- "aria-hidden": r ? "true" : void 0,
1751
- style: {
1752
- display: r ? "none" : "flex",
1753
- flex: "1 1 auto",
1754
- minWidth: 0
1755
- },
1756
- children: /* @__PURE__ */ J(Ct, {
1757
- layout: e,
1758
- rowSelection: [],
1759
- ...n
1760
- })
1761
- }), /* @__PURE__ */ J("div", {
1762
- "aria-hidden": r ? void 0 : "true",
1763
- style: {
1764
- display: r ? "flex" : "none",
1765
- flex: "1 1 auto",
1766
- minWidth: 0
1767
- },
1768
- children: /* @__PURE__ */ J(Ct, {
1769
- layout: e,
1770
- rowSelection: t,
1771
- ...n
1772
- })
1773
- })]
1774
- });
1775
- }
1776
- function Tt({ layout: e, row: t, rowSelection: n, onRun: r, reservedRightWidth: i = 0, kind: a = "toolbar", align: o = "trailing", constrain: s = !0, measurementOverride: c, entityActions: l, globalActions: u, ariaLabel: d, widgetContext: f, onActionClick: p }) {
1777
- let m = Je(e);
1778
- return a === "row" ? /* @__PURE__ */ J(at, {
1779
- layout: e,
1780
- entityActions: l,
1781
- globalActions: u,
1782
- onRun: r,
1783
- row: t,
1784
- widgetContext: f,
1785
- onActionClick: p
1786
- }) : m === 0 ? null : J(a === "toolbar" ? wt : Ct, {
1787
- layout: e,
1788
- row: t,
1789
- rowSelection: n,
1790
- onRun: r,
1791
- reservedRightWidth: i,
1792
- measurementOverride: c,
1793
- entityActions: l,
1794
- globalActions: u,
1795
- ariaLabel: d,
1796
- align: o,
1797
- constrain: s,
1798
- widgetContext: f,
1799
- onActionClick: p
1800
- });
1801
- }
1802
- //#endregion
1803
- //#region src/lib/filter-evaluator.ts
1804
- var Et = /* @__PURE__ */ new Set([
1805
- "string",
1806
- "text",
1807
- "rich_text",
1808
- "email",
1809
- "url",
1810
- "phone"
1811
- ]), Dt = /* @__PURE__ */ new Set([
1812
- "int",
1813
- "float",
1814
- "decimal"
1815
- ]), Ot = /* @__PURE__ */ new Set([
1816
- "date",
1817
- "timestamp",
1818
- "time"
1819
- ]), kt = /^(?:eq|not_eq|contains|starts_with|is_empty|is_not_empty)$/, At = /^(?:eq|not_eq|in|not_in|is_empty|is_not_empty)$/, jt = /^(?:eq|not_eq|gt|gte|lt|lte|between|is_empty|is_not_empty)$/, Mt = {
1820
- string: kt,
1821
- text: kt,
1822
- rich_text: kt,
1823
- email: kt,
1824
- url: kt,
1825
- phone: kt,
1826
- enum: At,
1827
- int: jt,
1828
- float: jt,
1829
- decimal: jt,
1830
- date: jt,
1831
- timestamp: jt,
1832
- time: jt,
1833
- bool: /^(?:eq|is_empty)$/,
1834
- ref: /^(?:eq|not_eq|is_empty|is_not_empty)$/,
1835
- uuid: /^(?:eq|not_eq|is_empty|is_not_empty)$/
1836
- };
1837
- function Nt(e, t, n) {
1838
- return e.every((e) => Pt(e, t, n));
1839
- }
1840
- function Pt(e, t, n) {
1841
- if (e.and) return e.and.every((e) => Pt(e, t, n));
1842
- if (e.or) return e.or.some((e) => Pt(e, t, n));
1843
- if (!e.field || !e.op) return !1;
1844
- let r = t[e.field];
1845
- return !r || !Mt[r.type]?.test(e.op) ? !1 : Ft(e, r.type, n[e.field]);
1846
- }
1847
- function Ft(e, t, n) {
1848
- let r = It(n);
1849
- if (e.op === "is_empty") return r;
1850
- if (e.op === "is_not_empty") return !r;
1851
- if (r) return !1;
1852
- let i = e.value;
1853
- switch (e.op) {
1854
- case "eq": return Lt(t, n, i);
1855
- case "not_eq": return !Lt(t, n, i) && Rt(t, n, i);
1856
- case "in": return Array.isArray(i) && i.some((e) => Lt(t, n, e));
1857
- case "not_in": return Array.isArray(i) && i.every((e) => Rt(t, n, e) && !Lt(t, n, e));
1858
- case "contains": return typeof n == "string" && typeof i == "string" && n.toLowerCase().includes(i.toLowerCase());
1859
- case "starts_with": return typeof n == "string" && typeof i == "string" && n.toLowerCase().startsWith(i.toLowerCase());
1860
- case "gt": return zt(t, n, i, (e, t) => e > t);
1861
- case "gte": return zt(t, n, i, (e, t) => e >= t);
1862
- case "lt": return zt(t, n, i, (e, t) => e < t);
1863
- case "lte": return zt(t, n, i, (e, t) => e <= t);
1864
- case "between": {
1865
- if (!Array.isArray(i) || i.length !== 2) return !1;
1866
- let e = Bt(t, n, i[0]), r = Bt(t, n, i[1]);
1867
- return e === void 0 || r === void 0 ? !1 : e >= 0 && r <= 0;
1868
- }
1869
- default: return !1;
1870
- }
1871
- }
1872
- function It(e) {
1873
- return e == null || e === "" || Array.isArray(e) && e.length === 0;
1874
- }
1875
- function Lt(e, t, n) {
1876
- return Rt(e, t, n) ? Ot.has(e) ? Bt(e, t, n) === 0 : t === n : !1;
1877
- }
1878
- function Rt(e, t, n) {
1879
- return Bt(e, t, n) !== void 0;
1880
- }
1881
- function zt(e, t, n, r) {
1882
- let i = Bt(e, t, n);
1883
- return i !== void 0 && r(i, 0);
1884
- }
1885
- function Bt(e, t, n) {
1886
- if (Dt.has(e)) return typeof t != "number" || typeof n != "number" || !Number.isFinite(t) || !Number.isFinite(n) ? void 0 : t === n ? 0 : t < n ? -1 : 1;
1887
- if (Ot.has(e)) return typeof t != "string" || typeof n != "string" || !Vt(e, t) || !Vt(e, n) ? void 0 : t === n ? 0 : t < n ? -1 : 1;
1888
- if (Et.has(e) || e === "enum" || e === "ref" || e === "uuid") return typeof t != "string" || typeof n != "string" ? void 0 : t === n ? 0 : t < n ? -1 : 1;
1889
- if (e === "bool") return typeof t != "boolean" || typeof n != "boolean" ? void 0 : t === n ? 0 : t ? 1 : -1;
1890
- }
1891
- function Vt(e, t) {
1892
- switch (e) {
1893
- case "date": return /^\d{4}-\d{2}-\d{2}$/.test(t);
1894
- case "time": return /^\d{2}:\d{2}:\d{2}(?:\.\d+)?$/.test(t);
1895
- case "timestamp": return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/.test(t);
1896
- default: return !1;
1897
- }
1898
- }
1899
- //#endregion
1900
- //#region src/lib/variants.ts
1901
- function Ht(e, t) {
1902
- let n = e.variants;
1903
- if (!n || n.length === 0) return;
1904
- let r = {};
1905
- for (let [t, n] of e.fields) r[t] = n;
1906
- for (let [e, i] of n) if (e !== "default" && i.when && Nt(i.when, r, t)) return e;
1907
- return n.has("default") ? "default" : void 0;
1908
- }
1909
- function Ut(e, t) {
1910
- let n = e?.variants;
1911
- if (!n || !n.items().some((e) => e.actions !== void 0)) return;
1912
- let r = Ht(e, t), i = n.get("default"), a = (r ? n.get(r)?.actions : void 0) ?? i?.actions ?? [];
1913
- return new Set(a);
1914
- }
1915
- function Wt(e, t) {
1916
- if (t.length === 0) return;
1917
- let n = t.map((t) => Ut(e, t));
1918
- if (n.every((e) => e === void 0)) return;
1919
- let r = n[0] ?? /* @__PURE__ */ new Set(), i = new Set(r);
1920
- for (let e of n.slice(1)) {
1921
- if (!e) {
1922
- i.clear();
1923
- break;
1924
- }
1925
- for (let t of i) e.has(t) || i.delete(t);
1926
- }
1927
- return i;
1928
- }
1929
- function Gt(e, t, n) {
1930
- if (!t.variants || t.variants.length === 0) return;
1931
- if (e.variants) {
1932
- let r = Ht(e, n) ?? "default";
1933
- return t.variants.has(r) ? r : "default";
1934
- }
1935
- let r = {};
1936
- for (let [t, n] of e.fields) r[t] = n;
1937
- for (let [e, i] of t.variants) if (e !== "default" && i.when && Nt(i.when, r, n)) return e;
1938
- return "default";
1939
- }
1940
- var Kt = [
1941
- "items",
1942
- "sidebar",
1943
- "sidebar_width",
1944
- "highlights",
1945
- "audit",
1946
- "actions",
1947
- "row_actions",
1948
- "action_layout",
1949
- "card",
1950
- "quick_peek"
1951
- ];
1952
- function qt(e, t, n) {
1953
- if (!e || !t?.variants) return t;
1954
- let r = Gt(e, t, n), i = r ? t.variants.get(r) : void 0;
1955
- if (!i) return t;
1956
- let a = { ...t };
1957
- for (let e of Kt) i[e] !== void 0 && (a[e] = i[e]);
1958
- return a;
1959
- }
1960
- //#endregion
1961
- export { oe as C, ae as S, xe as _, Ut as a, Q as b, st as c, Re as d, ze as f, Ve as g, Be as h, Gt as i, We as l, He as m, qt as n, Nt as o, Ue as p, Ht as r, Tt as s, Wt as t, Le as u, be as v, Z as w, le as x, ye as y };