alinea 2.0.0-preview.13 → 2.0.0-preview.14

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 (323) hide show
  1. package/dist/.init/content/pages/welcome.json +1 -1
  2. package/dist/.mcp/later/dev.json +1 -1
  3. package/dist/.mcp/online/dev.json +1 -1
  4. package/dist/adapter/next/cms.js +6 -2
  5. package/dist/adapter/next/context.js +1 -4
  6. package/dist/adapter/next/handler.js +12 -1
  7. package/dist/backend/CommitEntries.d.ts +17 -0
  8. package/dist/backend/CommitEntries.js +39 -0
  9. package/dist/backend/Handler.d.ts +9 -0
  10. package/dist/backend/Handler.js +80 -20
  11. package/dist/backend/api/BasicAuth.js +5 -1
  12. package/dist/backend/api/CreateBackend.js +2 -2
  13. package/dist/backend/api/DatabaseApi.js +18 -5
  14. package/dist/backend/api/GithubApi.d.ts +13 -0
  15. package/dist/backend/api/GithubApi.js +170 -30
  16. package/dist/backend/api/database.js +2 -2
  17. package/dist/backend/util/Syncable.d.ts +6 -0
  18. package/dist/backend/util/Syncable.js +3 -1
  19. package/dist/bundled.d.ts +911 -151
  20. package/dist/chunks/{chunk-5H4D5JQL.js → chunk-2PP7WJUJ.js} +1 -11
  21. package/dist/chunks/{chunk-QHHMKJUO.js → chunk-7DDPSWRY.js} +465 -2
  22. package/dist/chunks/{chunk-HOETF6HN.js → chunk-PMGIIYDD.js} +1 -0
  23. package/dist/chunks/{chunk-3QFSGTGF.js → chunk-SCV3TEXM.js} +1 -1
  24. package/dist/chunks/{chunk-UPY2RUZF.js → chunk-TWBREZWC.js} +30 -0
  25. package/dist/cli/Generate.js +20 -7
  26. package/dist/cli/Mcp.js +1 -1
  27. package/dist/cli/Serve.js +1 -1
  28. package/dist/cli/bin.js +1 -1
  29. package/dist/cli/build/BuildEmitter.d.ts +5 -1
  30. package/dist/cli/build/BuildEmitter.js +8 -3
  31. package/dist/cli/generate/CompileConfig.js +10 -6
  32. package/dist/cli/generate/DevDB.d.ts +4 -1
  33. package/dist/cli/generate/DevDB.js +15 -7
  34. package/dist/cli/generate/GenerateDashboard.js +1 -0
  35. package/dist/cli/generate/MediaLocations.d.ts +18 -0
  36. package/dist/cli/generate/MediaLocations.js +69 -0
  37. package/dist/cli/serve/CreateLocalServer.js +1 -0
  38. package/dist/cli/serve/mcp/DevMcp.js +1 -1
  39. package/dist/cloud/CloudRemote.js +21 -7
  40. package/dist/cms.d.ts +4 -2
  41. package/dist/components/Alert.js +2 -2
  42. package/dist/components/AppShell.js +2 -2
  43. package/dist/components/AsyncList.d.ts +52 -0
  44. package/dist/components/AsyncList.js +69 -0
  45. package/dist/components/Breadcrumbs.js +6 -6
  46. package/dist/components/Button.js +4 -4
  47. package/dist/components/Calendar.js +18 -18
  48. package/dist/components/Checkbox.js +10 -10
  49. package/dist/components/CheckboxGroup.js +2 -2
  50. package/dist/components/Collapsible.js +5 -5
  51. package/dist/components/ColorSwatch.js +2 -2
  52. package/dist/components/ColorSwatchPicker.js +4 -4
  53. package/dist/components/ComboBox.d.ts +27 -9
  54. package/dist/components/ComboBox.js +40 -9
  55. package/dist/components/Command.js +13 -13
  56. package/dist/components/ContentCard.js +28 -28
  57. package/dist/components/ContentGrid.js +11 -11
  58. package/dist/components/DataList.js +1 -1
  59. package/dist/components/DateField.d.ts +4 -0
  60. package/dist/components/DateField.js +2 -2
  61. package/dist/components/DatePicker.js +2 -2
  62. package/dist/components/DateRangePicker.js +2 -2
  63. package/dist/components/Dialog.d.ts +14 -3
  64. package/dist/components/Dialog.js +38 -11
  65. package/dist/components/DropZone.js +6 -6
  66. package/dist/components/DropdownMenu.js +8 -8
  67. package/dist/components/Empty.js +4 -4
  68. package/dist/components/Field.d.ts +1 -1
  69. package/dist/components/Field.js +18 -12
  70. package/dist/components/Form.d.ts +23 -0
  71. package/dist/components/Form.js +64 -0
  72. package/dist/components/Link.d.ts +8 -1
  73. package/dist/components/List.js +27 -27
  74. package/dist/components/MediaPreview.js +5 -5
  75. package/dist/components/MultipleSelect.d.ts +13 -8
  76. package/dist/components/MultipleSelect.js +25 -25
  77. package/dist/components/NavRail.js +7 -7
  78. package/dist/components/NumberField.d.ts +5 -1
  79. package/dist/components/NumberField.js +6 -4
  80. package/dist/components/Page.js +6 -6
  81. package/dist/components/Popover.js +2 -2
  82. package/dist/components/PreviewFrame.js +8 -8
  83. package/dist/components/RadioGroup.js +10 -10
  84. package/dist/components/Resizable.js +1 -1
  85. package/dist/components/SearchField.js +8 -8
  86. package/dist/components/Select.d.ts +13 -10
  87. package/dist/components/Select.js +18 -32
  88. package/dist/components/Sheet.js +6 -6
  89. package/dist/components/Sidebar.js +5 -5
  90. package/dist/components/SortableList.js +12 -12
  91. package/dist/components/Spinner.js +4 -4
  92. package/dist/components/Stack.d.ts +20 -0
  93. package/dist/components/Stack.js +45 -0
  94. package/dist/components/Surface.js +1 -1
  95. package/dist/components/Switch.js +5 -5
  96. package/dist/components/Table.d.ts +11 -1
  97. package/dist/components/Table.js +81 -53
  98. package/dist/components/Tabs.js +6 -6
  99. package/dist/components/TagGroup.js +10 -10
  100. package/dist/components/TextField.d.ts +7 -1
  101. package/dist/components/TextField.js +20 -11
  102. package/dist/components/TimeField.d.ts +6 -1
  103. package/dist/components/TimeField.js +51 -26
  104. package/dist/components/Timestamp.js +1 -1
  105. package/dist/components/ToggleGroup.js +2 -2
  106. package/dist/components/Toolbar.js +3 -3
  107. package/dist/components/Tooltip.js +5 -4
  108. package/dist/components/Tree.js +27 -27
  109. package/dist/components/internal/DateControl.js +11 -11
  110. package/dist/components/internal/FormScope.d.ts +2 -0
  111. package/dist/components/internal/FormScope.js +8 -0
  112. package/dist/components/internal/ListBoxGroup.d.ts +12 -0
  113. package/dist/components/internal/ListBoxGroup.js +46 -0
  114. package/dist/components/internal/ListBoxOption.d.ts +2 -2
  115. package/dist/components/internal/ListBoxOption.js +5 -5
  116. package/dist/components/internal/Locale.js +2 -2
  117. package/dist/components/internal/PopoverSurface.js +5 -4
  118. package/dist/components/internal/SelectionCheckbox.js +5 -5
  119. package/dist/components/internal/Slot.js +1 -1
  120. package/dist/components/internal/ToggleButton.js +4 -4
  121. package/dist/components/internal/Trigger.js +2 -2
  122. package/dist/components/internal/useDragDrop.js +2 -2
  123. package/dist/components/types.d.ts +4 -0
  124. package/dist/components.d.ts +3 -0
  125. package/dist/components.js +3 -0
  126. package/dist/core/Client.js +12 -1
  127. package/dist/core/Config.d.ts +6 -0
  128. package/dist/core/Config.js +12 -0
  129. package/dist/core/DashboardEntry.d.ts +19 -0
  130. package/dist/core/DashboardEntry.js +0 -0
  131. package/dist/core/Document.d.ts +2 -2
  132. package/dist/core/Document.js +10 -3
  133. package/dist/core/EntryFields.d.ts +8 -2
  134. package/dist/core/Field.d.ts +5 -0
  135. package/dist/core/Filter.d.ts +19 -2
  136. package/dist/core/Filter.js +5 -0
  137. package/dist/core/Graph.d.ts +10 -2
  138. package/dist/core/Overview.d.ts +74 -5
  139. package/dist/core/Overview.js +1 -0
  140. package/dist/core/Root.js +1 -1
  141. package/dist/core/Scope.d.ts +5 -0
  142. package/dist/core/Scope.js +22 -5
  143. package/dist/core/Type.d.ts +25 -6
  144. package/dist/core/Type.js +25 -7
  145. package/dist/core/db/LocalStore.d.ts +7 -0
  146. package/dist/core/field/CreateField.d.ts +1 -2
  147. package/dist/core/source/Source.d.ts +2 -0
  148. package/dist/core/source/Source.js +11 -0
  149. package/dist/core/util/Async.d.ts +2 -0
  150. package/dist/core/util/Async.js +12 -1
  151. package/dist/core/util/Checks.js +1 -1
  152. package/dist/core/util/Slugs.js +4 -3
  153. package/dist/dashboard/App.css +13 -11
  154. package/dist/dashboard/App.d.ts +1 -0
  155. package/dist/dashboard/App.js +22 -6
  156. package/dist/dashboard/Href.d.ts +37 -0
  157. package/dist/dashboard/Href.js +46 -0
  158. package/dist/dashboard/app/ActivityStatus.js +34 -12
  159. package/dist/dashboard/app/AuthView.js +2 -2
  160. package/dist/dashboard/app/BlockSettings.d.ts +9 -0
  161. package/dist/dashboard/app/BlockSettings.js +16 -0
  162. package/dist/dashboard/app/BlockSheet.js +3 -3
  163. package/dist/dashboard/app/BlockSheetStoryFrame.js +2 -2
  164. package/dist/dashboard/app/CompactField.js +15 -15
  165. package/dist/dashboard/app/CroppedImage.js +2 -2
  166. package/dist/dashboard/app/DashboardLayout.d.ts +1 -1
  167. package/dist/dashboard/app/DashboardLayout.js +12 -0
  168. package/dist/dashboard/app/EntryActions.d.ts +11 -0
  169. package/dist/dashboard/app/EntryActions.js +30 -0
  170. package/dist/dashboard/app/EntryFields.d.ts +15 -2
  171. package/dist/dashboard/app/EntryFields.js +26 -5
  172. package/dist/dashboard/app/EntryHeader.js +17 -7
  173. package/dist/dashboard/app/EntryReferences.js +2 -2
  174. package/dist/dashboard/app/EntrySidebar.js +25 -23
  175. package/dist/dashboard/app/EntrySidebarPreview.js +2 -2
  176. package/dist/dashboard/app/EntryValidationModal.js +3 -3
  177. package/dist/dashboard/app/Explorer.js +84 -45
  178. package/dist/dashboard/app/ExplorerBatchActions.js +4 -4
  179. package/dist/dashboard/app/ExplorerControls.js +5 -5
  180. package/dist/dashboard/app/ExplorerList.js +2 -2
  181. package/dist/dashboard/app/ExplorerModal.js +3 -3
  182. package/dist/dashboard/app/ExplorerOverviewHeader.d.ts +6 -0
  183. package/dist/dashboard/app/ExplorerOverviewHeader.js +28 -0
  184. package/dist/dashboard/app/ExplorerTable.js +7 -7
  185. package/dist/dashboard/app/ExplorerTabs.d.ts +12 -0
  186. package/dist/dashboard/app/ExplorerTabs.js +42 -0
  187. package/dist/dashboard/app/ImageEditor.js +31 -31
  188. package/dist/dashboard/app/LinkPicker.js +3 -3
  189. package/dist/dashboard/app/LocaleMenu.js +9 -9
  190. package/dist/dashboard/app/MediaPreviewCell.js +5 -5
  191. package/dist/dashboard/app/OverviewCell.js +12 -10
  192. package/dist/dashboard/app/RemoveDialog.js +5 -0
  193. package/dist/dashboard/app/SearchBar.js +4 -4
  194. package/dist/dashboard/app/SettingsTab.d.ts +6 -0
  195. package/dist/dashboard/app/SettingsTab.js +27 -0
  196. package/dist/dashboard/app/SidebarTree.js +19 -19
  197. package/dist/dashboard/app/WorkspaceMenu.js +6 -6
  198. package/dist/dashboard/app/WorkspaceRoots.js +102 -98
  199. package/dist/dashboard/app/editor/FileEditor.js +18 -18
  200. package/dist/dashboard/app/pages/EntryPage.js +42 -39
  201. package/dist/dashboard/app/pages/RootPage.js +3 -3
  202. package/dist/dashboard/app/pages/SplashPage.js +94 -79
  203. package/dist/dashboard/app/pages/UsersPage.js +9 -9
  204. package/dist/dashboard/app/ui/DashboardModal.js +14 -14
  205. package/dist/dashboard/atoms/activity.d.ts +1 -0
  206. package/dist/dashboard/atoms/activity.js +8 -5
  207. package/dist/dashboard/atoms/config.d.ts +2 -0
  208. package/dist/dashboard/atoms/dashboard.d.ts +11 -0
  209. package/dist/dashboard/atoms/dashboard.js +8 -0
  210. package/dist/dashboard/atoms/editor.d.ts +7 -1
  211. package/dist/dashboard/atoms/editor.js +14 -2
  212. package/dist/dashboard/atoms/explorer.d.ts +15 -0
  213. package/dist/dashboard/atoms/explorer.js +43 -14
  214. package/dist/dashboard/atoms/graph.d.ts +5 -0
  215. package/dist/dashboard/atoms/graph.js +26 -1
  216. package/dist/dashboard/atoms/nav.d.ts +16 -10
  217. package/dist/dashboard/atoms/nav.js +96 -36
  218. package/dist/dashboard/atoms/overview.d.ts +26 -4
  219. package/dist/dashboard/atoms/overview.js +41 -12
  220. package/dist/dashboard/atoms/root.js +7 -1
  221. package/dist/dashboard/boot/ActivityEvent.d.ts +1 -1
  222. package/dist/dashboard/boot/Boot.js +6 -0
  223. package/dist/dashboard/boot/DashboardWorker.d.ts +6 -0
  224. package/dist/dashboard/boot/DashboardWorker.js +89 -8
  225. package/dist/dashboard/boot/LoadWorker.js +3 -0
  226. package/dist/dashboard/boot/SyncEvent.d.ts +7 -0
  227. package/dist/dashboard/boot/SyncEvent.js +14 -0
  228. package/dist/dashboard/boot/WorkerDB.d.ts +1 -0
  229. package/dist/dashboard/boot/WorkerDB.js +3 -0
  230. package/dist/dashboard/cms/EntryTable.d.ts +4 -3
  231. package/dist/dashboard/cms/EntryTable.js +2 -2
  232. package/dist/dashboard/cms/ViewProps.d.ts +3 -2
  233. package/dist/dashboard/cms/hooks.d.ts +34 -18
  234. package/dist/dashboard/cms/hooks.js +43 -18
  235. package/dist/dashboard/contexts.d.ts +3 -2
  236. package/dist/dashboard/contexts.js +3 -2
  237. package/dist/dashboard/hook/UseEntryEditor.d.ts +1 -1
  238. package/dist/dashboard/hook/UseEntryEditor.js +7 -3
  239. package/dist/dashboard/icons.d.ts +1 -0
  240. package/dist/dashboard/icons.js +15 -0
  241. package/dist/database/BrowserEntryStore.js +35 -13
  242. package/dist/database/DatabaseTables.js +1 -1
  243. package/dist/database/EntryDatabase.d.ts +10 -1
  244. package/dist/database/EntryDatabase.js +31 -10
  245. package/dist/database/EntryStore.js +1 -11
  246. package/dist/database/entry/EntryTable.d.ts +5 -3
  247. package/dist/database/entry/EntryTable.js +25 -8
  248. package/dist/database/query/Condition.d.ts +4 -1
  249. package/dist/database/query/Condition.js +16 -5
  250. package/dist/database/query/EntryQuery.js +59 -7
  251. package/dist/database/query/Relation.d.ts +13 -1
  252. package/dist/database/query/Relation.js +19 -1
  253. package/dist/database/query/Search.d.ts +7 -1
  254. package/dist/database/query/Search.js +54 -9
  255. package/dist/database/sync/EntrySyncer.d.ts +2 -0
  256. package/dist/database/sync/EntrySyncer.js +4 -2
  257. package/dist/database/sync/Ingest.d.ts +2 -1
  258. package/dist/database/sync/Ingest.js +20 -6
  259. package/dist/field/code/CodeField.view.js +12 -12
  260. package/dist/field/link/EntryLink.d.ts +4 -5
  261. package/dist/field/link/FileLink.d.ts +2 -2
  262. package/dist/field/link/ImageLink.d.ts +2 -5
  263. package/dist/field/link/ImageLink.js +0 -1
  264. package/dist/field/link/LinkField.view.js +18 -15
  265. package/dist/field/list/ListField.view.js +50 -35
  266. package/dist/field/metadata/MetadataField.view.js +14 -14
  267. package/dist/field/richtext/RichTextBlock.js +39 -35
  268. package/dist/field/richtext/RichTextExtensions.js +23 -23
  269. package/dist/field/richtext/RichTextField.view.js +6 -6
  270. package/dist/field/richtext/RichTextInsertMenu.js +5 -5
  271. package/dist/field/richtext/RichTextToolbar.js +26 -1
  272. package/dist/field/richtext/Toolbar.d.ts +9 -1
  273. package/dist/field/richtext/Toolbar.js +12 -2
  274. package/dist/field/select/SelectField.view.js +1 -0
  275. package/dist/index.css +174 -23
  276. package/dist/index.d.ts +1 -0
  277. package/dist/index.js +3 -1
  278. package/dist/next.d.ts +2 -0
  279. package/dist/next.edge.d.ts +2 -0
  280. package/dist/picker/entry/EntryPicker.d.ts +3 -1
  281. package/dist/picker/entry/EntryPicker.js +15 -1
  282. package/dist/preview/react.js +3 -0
  283. package/dist/query.d.ts +26 -14
  284. package/dist/query.js +4 -0
  285. package/dist/types.d.ts +8 -5
  286. package/dist/ui/Stack.d.ts +4 -2
  287. package/docs/ai-setup.md +3 -3
  288. package/docs/cli.md +4 -2
  289. package/docs/components/combo-box.md +105 -16
  290. package/docs/components/date-field.md +1 -1
  291. package/docs/components/dialog.md +51 -0
  292. package/docs/components/form.md +67 -0
  293. package/docs/components/link.md +10 -0
  294. package/docs/components/multiple-select.md +9 -17
  295. package/docs/components/number-field.md +5 -1
  296. package/docs/components/select.md +9 -20
  297. package/docs/components/stack.md +42 -0
  298. package/docs/components/table.md +83 -0
  299. package/docs/components/text-field.md +9 -1
  300. package/docs/components/time-field.md +5 -1
  301. package/docs/components.md +39 -1
  302. package/docs/configuration.md +3 -1
  303. package/docs/custom-fields.md +135 -7
  304. package/docs/deploy/self-host.md +2 -0
  305. package/docs/deploy.md +7 -4
  306. package/docs/fields/image.md +0 -1
  307. package/docs/fields/list.md +19 -0
  308. package/docs/fields/object.md +5 -3
  309. package/docs/fields/rich-text.md +31 -0
  310. package/docs/index.md +8 -6
  311. package/docs/instant-publishing.md +23 -2
  312. package/docs/overviews.md +128 -4
  313. package/docs/query/filtering.md +2 -0
  314. package/docs/query/related.md +58 -9
  315. package/docs/query.md +52 -1
  316. package/docs/quickstart.md +5 -5
  317. package/docs/schema/document.md +2 -0
  318. package/docs/schema/type.md +3 -1
  319. package/docs/upgrading.md +100 -19
  320. package/llms-full.txt +1022 -125
  321. package/package.json +1 -1
  322. package/readme.md +2 -2
  323. package/dist/chunks/{chunk-4ZA6KZHS.js → chunk-6FQ5IMNA.js} +3 -3
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  $ed8ccb2e23e76301$export$4aa08d5625cb8ead
3
- } from "../chunks/chunk-QHHMKJUO.js";
3
+ } from "../chunks/chunk-7DDPSWRY.js";
4
4
  import "../chunks/chunk-NUFRM6SI.js";
5
- import "../chunks/chunk-HOETF6HN.js";
5
+ import "../chunks/chunk-PMGIIYDD.js";
6
6
  import "../chunks/chunk-RKDPDEF7.js";
7
7
  import "../chunks/chunk-PSSMQKAH.js";
8
8
  import {
@@ -14,13 +14,13 @@ import { FoldIcon } from "./FoldIcon.js";
14
14
 
15
15
  // src/components/Collapsible.module.css
16
16
  var Collapsible_default = {
17
- "CollapsibleTrigger-icon": "alinea-CollapsibleTrigger-icon",
18
- "CollapsibleTriggerIcon": "alinea-CollapsibleTrigger-icon",
17
+ "CollapsibleTrigger-title": "alinea-CollapsibleTrigger-title",
18
+ "CollapsibleTriggerTitle": "alinea-CollapsibleTrigger-title",
19
+ "CollapsibleContent": "alinea-CollapsibleContent",
19
20
  "CollapsibleTrigger": "alinea-CollapsibleTrigger",
20
21
  "Collapsible": "alinea-Collapsible",
21
- "CollapsibleContent": "alinea-CollapsibleContent",
22
- "CollapsibleTrigger-title": "alinea-CollapsibleTrigger-title",
23
- "CollapsibleTriggerTitle": "alinea-CollapsibleTrigger-title"
22
+ "CollapsibleTrigger-icon": "alinea-CollapsibleTrigger-icon",
23
+ "CollapsibleTriggerIcon": "alinea-CollapsibleTrigger-icon"
24
24
  };
25
25
 
26
26
  // src/components/Collapsible.tsx
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  $eeaff5a2d2421ecc$export$cae13e90592f246a
3
- } from "../chunks/chunk-QHHMKJUO.js";
3
+ } from "../chunks/chunk-7DDPSWRY.js";
4
4
  import "../chunks/chunk-NUFRM6SI.js";
5
- import "../chunks/chunk-HOETF6HN.js";
5
+ import "../chunks/chunk-PMGIIYDD.js";
6
6
  import "../chunks/chunk-RKDPDEF7.js";
7
7
  import "../chunks/chunk-PSSMQKAH.js";
8
8
  import {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  $a36727cf8b43b57f$export$abcd89c27081c2ef,
3
3
  $a36727cf8b43b57f$export$b46792416e3d8515
4
- } from "../chunks/chunk-QHHMKJUO.js";
4
+ } from "../chunks/chunk-7DDPSWRY.js";
5
5
  import "../chunks/chunk-NUFRM6SI.js";
6
- import "../chunks/chunk-HOETF6HN.js";
6
+ import "../chunks/chunk-PMGIIYDD.js";
7
7
  import "../chunks/chunk-RKDPDEF7.js";
8
8
  import "../chunks/chunk-PSSMQKAH.js";
9
9
  import {
@@ -16,8 +16,8 @@ import { ColorSwatch } from "./ColorSwatch.js";
16
16
 
17
17
  // src/components/ColorSwatchPicker.module.css
18
18
  var ColorSwatchPicker_default = {
19
- "ColorSwatchPicker": "alinea-ColorSwatchPicker",
20
- "ColorSwatchPickerItem": "alinea-ColorSwatchPickerItem"
19
+ "ColorSwatchPickerItem": "alinea-ColorSwatchPickerItem",
20
+ "ColorSwatchPicker": "alinea-ColorSwatchPicker"
21
21
  };
22
22
 
23
23
  // src/components/ColorSwatchPicker.tsx
@@ -1,10 +1,11 @@
1
- import { type ReactNode } from 'react';
2
- import type { AriaProps, DataProps, FieldSharedProps, OpenStateProps, StyleProps } from './types.js';
3
- export interface ComboBoxProps extends FieldSharedProps, OpenStateProps, StyleProps, AriaProps, DataProps {
4
- value?: string | null;
5
- defaultValue?: string | null;
1
+ import { type ReactElement, type ReactNode } from 'react';
2
+ import type { AriaProps, DataProps, FieldSharedProps, IconType, Key, OpenStateProps, StyleProps } from './types.js';
3
+ export interface ComboBoxProps<V extends Key = Key> extends FieldSharedProps, OpenStateProps, StyleProps, AriaProps, DataProps {
4
+ /** The value of the selected ComboBoxItem */
5
+ value?: V | null;
6
+ defaultValue?: V | null;
6
7
  /** Called with the selected value, or null when the selection is cleared */
7
- onValueChange?: (value: string | null) => void;
8
+ onValueChange?: (value: V | null) => void;
8
9
  inputValue?: string;
9
10
  defaultInputValue?: string;
10
11
  onInputValueChange?: (value: string) => void;
@@ -13,19 +14,36 @@ export interface ComboBoxProps extends FieldSharedProps, OpenStateProps, StylePr
13
14
  allowsCustomValue?: boolean;
14
15
  /** Shown in the list when no item matches, the list stays closed if unset */
15
16
  emptyMessage?: ReactNode;
17
+ /**
18
+ * Whether an item is shown for the typed text, defaults to a case and
19
+ * accent insensitive match anywhere in its text. Pass false to show every
20
+ * item, eg. when the server already filtered them.
21
+ */
22
+ filter?: false | ((textValue: string, inputValue: string) => boolean);
23
+ /** Shows a spinner, eg. while the items for the typed text load */
24
+ loading?: boolean;
16
25
  /** Name of the hidden form input carrying the value */
17
26
  name?: string;
18
27
  autoFocus?: boolean;
19
- /** ComboBoxItem elements */
28
+ /** ComboBoxItem and ComboBoxGroup elements */
20
29
  children: ReactNode;
21
30
  }
22
31
  /** A labelled text input that filters a list of options to pick from */
23
- export declare function ComboBox({ label, description, error, required, disabled, readOnly, icon, shared, value, defaultValue, onValueChange, inputValue, defaultInputValue, onInputValueChange, open, defaultOpen, onOpenChange, placeholder, emptyMessage, autoFocus, className, style, children, ...props }: ComboBoxProps): import("react").JSX.Element;
32
+ export declare function ComboBox<V extends Key = Key>({ label, description, error, required, disabled, readOnly, icon, shared, value, defaultValue, onValueChange, inputValue, defaultInputValue, onInputValueChange, open, defaultOpen, onOpenChange, placeholder, emptyMessage, filter, loading, autoFocus, className, style, children, ...props }: ComboBoxProps<V>): import("react").JSX.Element;
24
33
  export interface ComboBoxItemProps extends StyleProps {
25
- value: string;
34
+ value: Key;
26
35
  /** Text used for filtering and the input, defaults to string children */
27
36
  textValue?: string;
28
37
  disabled?: boolean;
38
+ /** Icon shown before the label in the list */
39
+ icon?: IconType | ReactElement;
40
+ /** Secondary text shown below the label in the list */
41
+ description?: ReactNode;
29
42
  children: ReactNode;
30
43
  }
31
44
  export declare function ComboBoxItem(props: ComboBoxItemProps): import("react").JSX.Element;
45
+ export interface ComboBoxGroupProps extends AriaProps {
46
+ label?: ReactNode;
47
+ children: ReactNode;
48
+ }
49
+ export declare function ComboBoxGroup(props: ComboBoxGroupProps): import("react").JSX.Element;
@@ -4,9 +4,9 @@ import {
4
4
  $928221da08ecbc62$export$41f133550aa26f48,
5
5
  $dbdc5e6e7ce01b4b$export$72b9695b8216309a,
6
6
  $dbdc5e6e7ce01b4b$export$c02625b26074192c
7
- } from "../chunks/chunk-QHHMKJUO.js";
7
+ } from "../chunks/chunk-7DDPSWRY.js";
8
8
  import "../chunks/chunk-NUFRM6SI.js";
9
- import "../chunks/chunk-HOETF6HN.js";
9
+ import "../chunks/chunk-PMGIIYDD.js";
10
10
  import "../chunks/chunk-RKDPDEF7.js";
11
11
  import "../chunks/chunk-PSSMQKAH.js";
12
12
  import {
@@ -24,27 +24,34 @@ import { IcRoundClose, IcRoundKeyboardArrowDown } from "alinea/dashboard/icons";
24
24
 
25
25
  // src/components/ComboBox.module.css
26
26
  var ComboBox_default = {
27
- "ComboBoxTrigger": "alinea-ComboBoxTrigger",
27
+ "ComboBoxTrigger-spinner": "alinea-ComboBoxTrigger-spinner",
28
+ "ComboBoxTriggerSpinner": "alinea-ComboBoxTrigger-spinner",
28
29
  "ComboBoxContent-list": "alinea-ComboBoxContent-list",
29
30
  "ComboBoxContentList": "alinea-ComboBoxContent-list",
31
+ "ComboBoxTrigger-input": "alinea-ComboBoxTrigger-input",
32
+ "ComboBoxTriggerInput": "alinea-ComboBoxTrigger-input",
33
+ "ComboBoxTrigger": "alinea-ComboBoxTrigger",
30
34
  "ComboBoxContent-empty": "alinea-ComboBoxContent-empty",
31
35
  "ComboBoxContentEmpty": "alinea-ComboBoxContent-empty",
32
36
  "ComboBoxTrigger-action": "alinea-ComboBoxTrigger-action",
33
37
  "ComboBoxTriggerAction": "alinea-ComboBoxTrigger-action",
34
38
  "ComboBoxTrigger-arrow": "alinea-ComboBoxTrigger-arrow",
35
39
  "ComboBoxTriggerArrow": "alinea-ComboBoxTrigger-arrow",
36
- "ComboBoxTrigger-input": "alinea-ComboBoxTrigger-input",
37
- "ComboBoxTriggerInput": "alinea-ComboBoxTrigger-input",
38
40
  "ComboBox": "alinea-ComboBox"
39
41
  };
40
42
 
41
43
  // src/components/ComboBox.tsx
42
44
  import { Field } from "./Field.js";
43
45
  import { Icon } from "./Icon.js";
46
+ import { ListBoxGroup } from "./internal/ListBoxGroup.js";
44
47
  import { ListBoxOption } from "./internal/ListBoxOption.js";
45
48
  import { PopoverSurface } from "./internal/PopoverSurface.js";
49
+ import { Spinner } from "./Spinner.js";
46
50
  import { jsx, jsxs } from "react/jsx-runtime";
47
51
  var styles = dist_default(ComboBox_default);
52
+ function showAll() {
53
+ return true;
54
+ }
48
55
  function ComboBox({
49
56
  label,
50
57
  description,
@@ -65,6 +72,8 @@ function ComboBox({
65
72
  onOpenChange,
66
73
  placeholder,
67
74
  emptyMessage,
75
+ filter,
76
+ loading,
68
77
  autoFocus,
69
78
  className,
70
79
  style,
@@ -82,7 +91,7 @@ function ComboBox({
82
91
  style,
83
92
  selectedKey: value,
84
93
  defaultSelectedKey: defaultValue,
85
- onSelectionChange: (key) => onValueChange?.(key === null ? null : String(key)),
94
+ onSelectionChange: (key) => onValueChange?.(key),
86
95
  inputValue,
87
96
  defaultInputValue,
88
97
  onInputChange: onInputValueChange,
@@ -94,6 +103,7 @@ function ComboBox({
94
103
  isRequired: required,
95
104
  isInvalid: error ? true : void 0,
96
105
  allowsEmptyCollection: emptyMessage !== void 0,
106
+ defaultFilter: filter === false ? showAll : filter,
97
107
  children: /* @__PURE__ */ jsxs(
98
108
  Field,
99
109
  {
@@ -121,7 +131,8 @@ function ComboBox({
121
131
  placeholder,
122
132
  autoFocus,
123
133
  invalid: Boolean(error),
124
- clearable: !disabled && !readOnly
134
+ clearable: !disabled && !readOnly,
135
+ loading
125
136
  }
126
137
  ),
127
138
  /* @__PURE__ */ jsx(
@@ -139,7 +150,7 @@ function ComboBox({
139
150
  {
140
151
  "data-slot": "combobox-empty",
141
152
  className: styles.ComboBoxContent.empty(),
142
- children: emptyMessage
153
+ children: loading ? /* @__PURE__ */ jsx(Spinner, { size: "sm" }) : emptyMessage
143
154
  }
144
155
  ),
145
156
  children
@@ -179,7 +190,8 @@ function ComboBoxTrigger({
179
190
  placeholder,
180
191
  autoFocus,
181
192
  invalid,
182
- clearable
193
+ clearable,
194
+ loading
183
195
  }) {
184
196
  const state = useContext($dbdc5e6e7ce01b4b$export$c02625b26074192c);
185
197
  const inputRef = useRef(null);
@@ -202,6 +214,14 @@ function ComboBoxTrigger({
202
214
  className: styles.ComboBoxTrigger.input()
203
215
  }
204
216
  ),
217
+ loading && /* @__PURE__ */ jsx(
218
+ Spinner,
219
+ {
220
+ size: "sm",
221
+ "data-slot": "combobox-spinner",
222
+ className: styles.ComboBoxTrigger.spinner()
223
+ }
224
+ ),
205
225
  hasClear && /* @__PURE__ */ jsx(
206
226
  $7705c033048f6da7$export$353f5b6fc5456de1,
207
227
  {
@@ -239,7 +259,18 @@ function ComboBoxTrigger({
239
259
  function ComboBoxItem(props) {
240
260
  return /* @__PURE__ */ jsx(ListBoxOption, { slot: "combobox-item", ...props });
241
261
  }
262
+ function ComboBoxGroup(props) {
263
+ return /* @__PURE__ */ jsx(
264
+ ListBoxGroup,
265
+ {
266
+ slot: "combobox-group",
267
+ labelSlot: "combobox-group-label",
268
+ ...props
269
+ }
270
+ );
271
+ }
242
272
  export {
243
273
  ComboBox,
274
+ ComboBoxGroup,
244
275
  ComboBoxItem
245
276
  };
@@ -6,11 +6,11 @@ import {
6
6
  $928221da08ecbc62$export$a11e76429ed99b4,
7
7
  $928221da08ecbc62$export$dca12b0bb56e4fc,
8
8
  $e28ab3efe3e87743$export$1ff3c3f08ae963c0
9
- } from "../chunks/chunk-QHHMKJUO.js";
9
+ } from "../chunks/chunk-7DDPSWRY.js";
10
10
  import "../chunks/chunk-NUFRM6SI.js";
11
11
  import {
12
12
  $ef182bb9912241d8$export$3274cf84b703fff
13
- } from "../chunks/chunk-HOETF6HN.js";
13
+ } from "../chunks/chunk-PMGIIYDD.js";
14
14
  import "../chunks/chunk-RKDPDEF7.js";
15
15
  import "../chunks/chunk-PSSMQKAH.js";
16
16
  import {
@@ -27,23 +27,23 @@ import { IcRoundSearch } from "alinea/dashboard/icons";
27
27
 
28
28
  // src/components/Command.module.css
29
29
  var Command_default = {
30
- "CommandGroup-heading": "alinea-CommandGroup-heading",
31
- "CommandGroupHeading": "alinea-CommandGroup-heading",
32
- "CommandInput": "alinea-CommandInput",
33
- "Command": "alinea-Command",
34
- "CommandEmpty": "alinea-CommandEmpty",
35
- "CommandGroup": "alinea-CommandGroup",
36
- "CommandItem": "alinea-CommandItem",
37
- "CommandSeparator": "alinea-CommandSeparator",
30
+ "is-focusVisible": "alinea-is-focusVisible",
31
+ "isFocusVisible": "alinea-is-focusVisible",
38
32
  "CommandItem-icon": "alinea-CommandItem-icon",
39
33
  "CommandItemIcon": "alinea-CommandItem-icon",
40
34
  "CommandItem-label": "alinea-CommandItem-label",
41
35
  "CommandItemLabel": "alinea-CommandItem-label",
42
- "is-focusVisible": "alinea-is-focusVisible",
43
- "isFocusVisible": "alinea-is-focusVisible",
36
+ "CommandInput": "alinea-CommandInput",
37
+ "CommandList": "alinea-CommandList",
38
+ "CommandSeparator": "alinea-CommandSeparator",
39
+ "Command": "alinea-Command",
40
+ "CommandGroup": "alinea-CommandGroup",
41
+ "CommandGroup-heading": "alinea-CommandGroup-heading",
42
+ "CommandGroupHeading": "alinea-CommandGroup-heading",
43
+ "CommandEmpty": "alinea-CommandEmpty",
44
44
  "is-highlighted": "alinea-is-highlighted",
45
45
  "isHighlighted": "alinea-is-highlighted",
46
- "CommandList": "alinea-CommandList"
46
+ "CommandItem": "alinea-CommandItem"
47
47
  };
48
48
 
49
49
  // src/components/Command.tsx
@@ -12,43 +12,43 @@ import {
12
12
 
13
13
  // src/components/ContentCard.module.css
14
14
  var ContentCard_default = {
15
- "ContentCard-icon": "alinea-ContentCard-icon",
16
- "ContentCardIcon": "alinea-ContentCard-icon",
17
- "ContentCard-suffix": "alinea-ContentCard-suffix",
18
- "ContentCardSuffix": "alinea-ContentCard-suffix",
15
+ "ContentCard-pulse": "alinea-ContentCard-pulse",
16
+ "ContentCardPulse": "alinea-ContentCard-pulse",
17
+ "ContentCard-title-text": "alinea-ContentCard-title-text",
18
+ "ContentCardTitleText": "alinea-ContentCard-title-text",
19
+ "is-icon": "alinea-is-icon",
20
+ "isIcon": "alinea-is-icon",
21
+ "ContentCard-title": "alinea-ContentCard-title",
22
+ "ContentCardTitle": "alinea-ContentCard-title",
23
+ "is-skeleton": "alinea-is-skeleton",
24
+ "isSkeleton": "alinea-is-skeleton",
19
25
  "is-breadcrumbs": "alinea-is-breadcrumbs",
20
26
  "isBreadcrumbs": "alinea-is-breadcrumbs",
21
- "ContentCard-breadcrumbs": "alinea-ContentCard-breadcrumbs",
22
- "ContentCardBreadcrumbs": "alinea-ContentCard-breadcrumbs",
23
27
  "ContentCard-breadcrumbs-separator": "alinea-ContentCard-breadcrumbs-separator",
24
28
  "ContentCardBreadcrumbsSeparator": "alinea-ContentCard-breadcrumbs-separator",
25
- "ContentCard-description-text": "alinea-ContentCard-description-text",
26
- "ContentCardDescriptionText": "alinea-ContentCard-description-text",
27
- "is-wide": "alinea-is-wide",
28
- "isWide": "alinea-is-wide",
29
+ "ContentCard-body": "alinea-ContentCard-body",
30
+ "ContentCardBody": "alinea-ContentCard-body",
31
+ "ContentCard-suffix": "alinea-ContentCard-suffix",
32
+ "ContentCardSuffix": "alinea-ContentCard-suffix",
33
+ "ContentCard-image": "alinea-ContentCard-image",
34
+ "ContentCardImage": "alinea-ContentCard-image",
35
+ "ContentCard-media": "alinea-ContentCard-media",
36
+ "ContentCardMedia": "alinea-ContentCard-media",
29
37
  "ContentCard-details": "alinea-ContentCard-details",
30
38
  "ContentCardDetails": "alinea-ContentCard-details",
39
+ "is-wide": "alinea-is-wide",
40
+ "isWide": "alinea-is-wide",
41
+ "ContentCard-description-text": "alinea-ContentCard-description-text",
42
+ "ContentCardDescriptionText": "alinea-ContentCard-description-text",
31
43
  "ContentCard": "alinea-ContentCard",
44
+ "ContentCard-description": "alinea-ContentCard-description",
45
+ "ContentCardDescription": "alinea-ContentCard-description",
32
46
  "ContentCard-skeleton": "alinea-ContentCard-skeleton",
33
47
  "ContentCardSkeleton": "alinea-ContentCard-skeleton",
34
- "ContentCard-pulse": "alinea-ContentCard-pulse",
35
- "ContentCardPulse": "alinea-ContentCard-pulse",
36
- "ContentCard-title": "alinea-ContentCard-title",
37
- "ContentCardTitle": "alinea-ContentCard-title",
38
- "ContentCard-media": "alinea-ContentCard-media",
39
- "ContentCardMedia": "alinea-ContentCard-media",
40
- "ContentCard-image": "alinea-ContentCard-image",
41
- "ContentCardImage": "alinea-ContentCard-image",
42
- "ContentCard-body": "alinea-ContentCard-body",
43
- "ContentCardBody": "alinea-ContentCard-body",
44
- "ContentCard-title-text": "alinea-ContentCard-title-text",
45
- "ContentCardTitleText": "alinea-ContentCard-title-text",
46
- "is-skeleton": "alinea-is-skeleton",
47
- "isSkeleton": "alinea-is-skeleton",
48
- "is-icon": "alinea-is-icon",
49
- "isIcon": "alinea-is-icon",
50
- "ContentCard-description": "alinea-ContentCard-description",
51
- "ContentCardDescription": "alinea-ContentCard-description"
48
+ "ContentCard-breadcrumbs": "alinea-ContentCard-breadcrumbs",
49
+ "ContentCardBreadcrumbs": "alinea-ContentCard-breadcrumbs",
50
+ "ContentCard-icon": "alinea-ContentCard-icon",
51
+ "ContentCardIcon": "alinea-ContentCard-icon"
52
52
  };
53
53
 
54
54
  // src/components/ContentCard.tsx
@@ -5,9 +5,9 @@ import {
5
5
  $7705c033048f6da7$export$353f5b6fc5456de1,
6
6
  $cc8e610d5d6e3fe4$export$cb6da89c6af1a8ec,
7
7
  $fc34f5dff94ff74a$export$7d2b12578154a735
8
- } from "../chunks/chunk-QHHMKJUO.js";
8
+ } from "../chunks/chunk-7DDPSWRY.js";
9
9
  import "../chunks/chunk-NUFRM6SI.js";
10
- import "../chunks/chunk-HOETF6HN.js";
10
+ import "../chunks/chunk-PMGIIYDD.js";
11
11
  import "../chunks/chunk-RKDPDEF7.js";
12
12
  import "../chunks/chunk-PSSMQKAH.js";
13
13
  import {
@@ -26,24 +26,24 @@ import {
26
26
  var ContentGrid_default = {
27
27
  "ContentGrid-dropIndicator": "alinea-ContentGrid-dropIndicator",
28
28
  "ContentGridDropIndicator": "alinea-ContentGrid-dropIndicator",
29
- "ContentGrid": "alinea-ContentGrid",
29
+ "ContentGridItem-card": "alinea-ContentGridItem-card",
30
+ "ContentGridItemCard": "alinea-ContentGridItem-card",
30
31
  "is-dropTarget": "alinea-is-dropTarget",
31
32
  "isDropTarget": "alinea-is-dropTarget",
33
+ "ContentGridItem-checkbox": "alinea-ContentGridItem-checkbox",
34
+ "ContentGridItemCheckbox": "alinea-ContentGridItem-checkbox",
35
+ "ContentGridItem": "alinea-ContentGridItem",
36
+ "ContentGrid": "alinea-ContentGrid",
32
37
  "is-active": "alinea-is-active",
33
38
  "isActive": "alinea-is-active",
39
+ "ContentGridItem-drag": "alinea-ContentGridItem-drag",
40
+ "ContentGridItemDrag": "alinea-ContentGridItem-drag",
34
41
  "ContentGrid-empty": "alinea-ContentGrid-empty",
35
42
  "ContentGridEmpty": "alinea-ContentGrid-empty",
36
43
  "is-dragging": "alinea-is-dragging",
37
44
  "isDragging": "alinea-is-dragging",
38
- "ContentGridItem": "alinea-ContentGridItem",
39
- "ContentGridItem-drag": "alinea-ContentGridItem-drag",
40
- "ContentGridItemDrag": "alinea-ContentGridItem-drag",
41
- "ContentGridItem-card": "alinea-ContentGridItem-card",
42
- "ContentGridItemCard": "alinea-ContentGridItem-card",
43
45
  "ContentGrid-list": "alinea-ContentGrid-list",
44
- "ContentGridList": "alinea-ContentGrid-list",
45
- "ContentGridItem-checkbox": "alinea-ContentGridItem-checkbox",
46
- "ContentGridItemCheckbox": "alinea-ContentGridItem-checkbox"
46
+ "ContentGridList": "alinea-ContentGrid-list"
47
47
  };
48
48
 
49
49
  // src/components/ContentGrid.tsx
@@ -5,9 +5,9 @@ import "../chunks/chunk-CQ52GEHY.js";
5
5
 
6
6
  // src/components/DataList.module.css
7
7
  var DataList_default = {
8
- "DataList": "alinea-DataList",
9
8
  "DataListItem": "alinea-DataListItem",
10
9
  "DataListValue": "alinea-DataListValue",
10
+ "DataList": "alinea-DataList",
11
11
  "DataListLabel": "alinea-DataListLabel"
12
12
  };
13
13
 
@@ -10,6 +10,10 @@ export interface DateFieldProps extends FieldSharedProps, StyleProps, AriaProps,
10
10
  min?: string;
11
11
  /** The latest valid date, `YYYY-MM-DD` */
12
12
  max?: string;
13
+ /**
14
+ * Name of the hidden form input, which submits the date like a native
15
+ * date input: `YYYY-MM-DD`, or an empty string when no date is set
16
+ */
13
17
  name?: string;
14
18
  autoFocus?: boolean;
15
19
  }
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  $5400c097f4765e59$export$d9781c7894a82487
3
- } from "../chunks/chunk-QHHMKJUO.js";
3
+ } from "../chunks/chunk-7DDPSWRY.js";
4
4
  import "../chunks/chunk-NUFRM6SI.js";
5
- import "../chunks/chunk-HOETF6HN.js";
5
+ import "../chunks/chunk-PMGIIYDD.js";
6
6
  import "../chunks/chunk-RKDPDEF7.js";
7
7
  import "../chunks/chunk-PSSMQKAH.js";
8
8
  import "../chunks/chunk-CQ52GEHY.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  $e539d00f123fdfd8$export$5109c6dd95d8fb00
3
- } from "../chunks/chunk-QHHMKJUO.js";
3
+ } from "../chunks/chunk-7DDPSWRY.js";
4
4
  import "../chunks/chunk-NUFRM6SI.js";
5
- import "../chunks/chunk-HOETF6HN.js";
5
+ import "../chunks/chunk-PMGIIYDD.js";
6
6
  import "../chunks/chunk-RKDPDEF7.js";
7
7
  import "../chunks/chunk-PSSMQKAH.js";
8
8
  import "../chunks/chunk-CQ52GEHY.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  $e539d00f123fdfd8$export$17334619f3ac2224
3
- } from "../chunks/chunk-QHHMKJUO.js";
3
+ } from "../chunks/chunk-7DDPSWRY.js";
4
4
  import "../chunks/chunk-NUFRM6SI.js";
5
- import "../chunks/chunk-HOETF6HN.js";
5
+ import "../chunks/chunk-PMGIIYDD.js";
6
6
  import "../chunks/chunk-RKDPDEF7.js";
7
7
  import "../chunks/chunk-PSSMQKAH.js";
8
8
  import "../chunks/chunk-CQ52GEHY.js";
@@ -1,11 +1,14 @@
1
1
  import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
2
2
  import { type ButtonProps } from './Button.js';
3
+ import { type FormProps } from './Form.js';
3
4
  import { type TriggerProps } from './internal/Trigger.js';
4
- import type { AriaProps, DataProps, OpenStateProps, StyleProps } from './types.js';
5
+ import type { AriaProps, DataProps, OpenStateProps, StyleProps, ValidationErrors } from './types.js';
5
6
  export interface DialogProps extends OpenStateProps {
7
+ /** Called when the dialog closes, after `onOpenChange(false)` */
8
+ onClose?: () => void;
6
9
  children: ReactNode;
7
10
  }
8
- export declare function Dialog({ open, defaultOpen, onOpenChange, children }: DialogProps): import("react").JSX.Element;
11
+ export declare function Dialog({ open, defaultOpen, onOpenChange, onClose, children }: DialogProps): import("react").JSX.Element;
9
12
  export interface DialogTriggerProps extends TriggerProps {
10
13
  }
11
14
  export declare function DialogTrigger(props: DialogTriggerProps): import("react").JSX.Element;
@@ -21,9 +24,17 @@ export interface DialogContentProps extends StyleProps, AriaProps, DataProps {
21
24
  dismissable?: boolean;
22
25
  /** Defaults to true */
23
26
  showCloseButton?: boolean;
27
+ /**
28
+ * Renders the content as a Form, submitted by a `type="submit"` Button.
29
+ * The dialog closes once this resolves without returning errors, which
30
+ * are shown on the fields otherwise.
31
+ */
32
+ onSubmit?: FormProps['onSubmit'];
33
+ /** Errors keyed by field name, when the content is a form */
34
+ validationErrors?: ValidationErrors;
24
35
  children: ReactNode;
25
36
  }
26
- export declare function DialogContent({ role, size, dismissable, showCloseButton, className, style, children, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, ...props }: DialogContentProps): import("react").JSX.Element;
37
+ export declare function DialogContent({ role, size, dismissable, showCloseButton, onSubmit, validationErrors, className, style, children, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, ...props }: DialogContentProps): import("react").JSX.Element;
27
38
  export interface DialogHeaderProps extends ComponentPropsWithoutRef<'div'> {
28
39
  }
29
40
  export declare function DialogHeader({ className, ...props }: DialogHeaderProps): import("react").JSX.Element;
@@ -5,9 +5,9 @@ import {
5
5
  $f2ff30fde7b014be$export$2e1e1122cf0cba88,
6
6
  $f2ff30fde7b014be$export$3ddf2d174ce01153,
7
7
  $f2ff30fde7b014be$export$d2f961adcb0afbe
8
- } from "../chunks/chunk-QHHMKJUO.js";
8
+ } from "../chunks/chunk-7DDPSWRY.js";
9
9
  import "../chunks/chunk-NUFRM6SI.js";
10
- import "../chunks/chunk-HOETF6HN.js";
10
+ import "../chunks/chunk-PMGIIYDD.js";
11
11
  import "../chunks/chunk-RKDPDEF7.js";
12
12
  import "../chunks/chunk-PSSMQKAH.js";
13
13
  import {
@@ -24,20 +24,23 @@ import { Button } from "./Button.js";
24
24
 
25
25
  // src/components/Dialog.module.css
26
26
  var Dialog_default = {
27
- "DialogFooter": "alinea-DialogFooter",
28
- "DialogTitle": "alinea-DialogTitle",
27
+ "DialogContent-form": "alinea-DialogContent-form",
28
+ "DialogContentForm": "alinea-DialogContent-form",
29
+ "DialogDescription": "alinea-DialogDescription",
30
+ "DialogHeader": "alinea-DialogHeader",
31
+ "DialogContent": "alinea-DialogContent",
29
32
  "DialogContent-dialog": "alinea-DialogContent-dialog",
30
33
  "DialogContentDialog": "alinea-DialogContent-dialog",
31
- "DialogContent": "alinea-DialogContent",
32
- "DialogDescription": "alinea-DialogDescription",
33
- "DialogContent-overlay": "alinea-DialogContent-overlay",
34
- "DialogContentOverlay": "alinea-DialogContent-overlay",
35
34
  "DialogContent-close": "alinea-DialogContent-close",
36
35
  "DialogContentClose": "alinea-DialogContent-close",
37
- "DialogHeader": "alinea-DialogHeader"
36
+ "DialogContent-overlay": "alinea-DialogContent-overlay",
37
+ "DialogContentOverlay": "alinea-DialogContent-overlay",
38
+ "DialogFooter": "alinea-DialogFooter",
39
+ "DialogTitle": "alinea-DialogTitle"
38
40
  };
39
41
 
40
42
  // src/components/Dialog.tsx
43
+ import { Form } from "./Form.js";
41
44
  import { Slot } from "./internal/Slot.js";
42
45
  import {
43
46
  OptionalTrigger,
@@ -49,6 +52,7 @@ function Dialog({
49
52
  open,
50
53
  defaultOpen,
51
54
  onOpenChange,
55
+ onClose,
52
56
  children
53
57
  }) {
54
58
  return /* @__PURE__ */ jsxs(
@@ -56,7 +60,10 @@ function Dialog({
56
60
  {
57
61
  isOpen: open,
58
62
  defaultOpen,
59
- onOpenChange,
63
+ onOpenChange: (next) => {
64
+ onOpenChange?.(next);
65
+ if (!next) onClose?.();
66
+ },
60
67
  children: [
61
68
  /* @__PURE__ */ jsx(OptionalTrigger, {}),
62
69
  children
@@ -72,6 +79,8 @@ function DialogContent({
72
79
  size = "default",
73
80
  dismissable = true,
74
81
  showCloseButton = true,
82
+ onSubmit,
83
+ validationErrors,
75
84
  className,
76
85
  style,
77
86
  children,
@@ -85,6 +94,7 @@ function DialogContent({
85
94
  $8b8d26808cb8cb53$export$8948f78d83984c69,
86
95
  {
87
96
  "data-slot": "dialog-overlay",
97
+ "data-alinea-theme": "",
88
98
  isDismissable: dismissable,
89
99
  className: styles.DialogContent.overlay(),
90
100
  children: /* @__PURE__ */ jsx(
@@ -106,7 +116,7 @@ function DialogContent({
106
116
  "aria-describedby": ariaDescribedby,
107
117
  className: styles.DialogContent.dialog(),
108
118
  children: [
109
- children,
119
+ onSubmit ? /* @__PURE__ */ jsx(DialogForm, { onSubmit, validationErrors, children }) : children,
110
120
  showCloseButton && /* @__PURE__ */ jsx(
111
121
  DialogClose,
112
122
  {
@@ -125,6 +135,23 @@ function DialogContent({
125
135
  }
126
136
  );
127
137
  }
138
+ function DialogForm({ onSubmit, validationErrors, children }) {
139
+ const state = useContext($f2ff30fde7b014be$export$d2f961adcb0afbe);
140
+ async function submit(data) {
141
+ const errors = await onSubmit(data);
142
+ if (!errors || Object.keys(errors).length === 0) state?.close();
143
+ return errors;
144
+ }
145
+ return /* @__PURE__ */ jsx(
146
+ Form,
147
+ {
148
+ validationErrors,
149
+ onSubmit: submit,
150
+ className: styles.DialogContent.form(),
151
+ children
152
+ }
153
+ );
154
+ }
128
155
  function DialogHeader({ className, ...props }) {
129
156
  return /* @__PURE__ */ jsx(
130
157
  "div",