@rebasepro/admin 0.13.0 → 0.13.1-canary.g249daa1

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 (154) hide show
  1. package/dist/{CollectionEditorDialog-CjXkWZ64.js → CollectionEditorDialog-DgfCYDmF.js} +3 -3
  2. package/dist/{CollectionEditorDialog-CjXkWZ64.js.map → CollectionEditorDialog-DgfCYDmF.js.map} +1 -1
  3. package/dist/{PropertyEditView-W8I3YV89.js → PropertyEditView-CCrruunW.js} +2 -2
  4. package/dist/{PropertyEditView-W8I3YV89.js.map → PropertyEditView-CCrruunW.js.map} +1 -1
  5. package/dist/{RouterCollectionsStudioView-BsLTNoqX.js → RouterCollectionsStudioView-C_EwDSi1.js} +9 -13
  6. package/dist/RouterCollectionsStudioView-C_EwDSi1.js.map +1 -0
  7. package/dist/collection_editor/serializable_types.d.ts +1 -0
  8. package/dist/collection_editor_ui.js +4 -4
  9. package/dist/components/AdditionalFieldValue.d.ts +25 -0
  10. package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +16 -0
  11. package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +3 -1
  12. package/dist/components/CollectionViewBinding/SearchExplanation.d.ts +48 -0
  13. package/dist/components/CollectionViewBinding/SearchHighlight.d.ts +92 -0
  14. package/dist/components/CollectionViewBinding/SlotValue.d.ts +63 -0
  15. package/dist/components/CollectionViewBinding/SplitListCloseButton.d.ts +17 -4
  16. package/dist/components/CollectionViewBinding/SplitListShowButton.d.ts +12 -0
  17. package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +55 -5
  18. package/dist/components/DetailViewBinding.d.ts +15 -0
  19. package/dist/components/DrawerNavigationGroup.d.ts +9 -6
  20. package/dist/components/DrawerNavigationItem.d.ts +16 -6
  21. package/dist/components/EditViewBinding.d.ts +30 -1
  22. package/dist/components/EntityDisplayHeader.d.ts +53 -0
  23. package/dist/components/EntityIdentityBar.d.ts +43 -1
  24. package/dist/components/EntityViewBinding.d.ts +60 -6
  25. package/dist/components/RebaseLayout.d.ts +1 -1
  26. package/dist/components/RebaseShell.d.ts +1 -1
  27. package/dist/components/RelationSelector.d.ts +8 -1
  28. package/dist/components/UserSelector.d.ts +8 -1
  29. package/dist/components/app/Scaffold.d.ts +9 -3
  30. package/dist/components/index.d.ts +2 -0
  31. package/dist/{export-J79rMoNj.js → export-CV-qQfxK.js} +2 -2
  32. package/dist/{export-J79rMoNj.js.map → export-CV-qQfxK.js.map} +1 -1
  33. package/dist/form/components/FieldBlock.d.ts +58 -4
  34. package/dist/form/components/FormRail.d.ts +13 -0
  35. package/dist/form/components/FormSections.d.ts +15 -1
  36. package/dist/form/components/useRailVisible.d.ts +5 -4
  37. package/dist/form/form_utils.d.ts +38 -1
  38. package/dist/{history-D7L_JlLO.js → history-By7QT3V0.js} +4 -4
  39. package/dist/{history-D7L_JlLO.js.map → history-By7QT3V0.js.map} +1 -1
  40. package/dist/hooks/useEntityDisplay.d.ts +102 -0
  41. package/dist/hooks/useEntityDisplayTitle.d.ts +18 -9
  42. package/dist/{import-BvYl--U4.js → import-CYbvYa_x.js} +3 -3
  43. package/dist/{import-BvYl--U4.js.map → import-CYbvYa_x.js.map} +1 -1
  44. package/dist/index.d.ts +2 -2
  45. package/dist/index.js +152 -57
  46. package/dist/index.js.map +1 -1
  47. package/dist/preview/compact_text.d.ts +23 -0
  48. package/dist/preview/components/BooleanPreview.d.ts +3 -1
  49. package/dist/preview/property_previews/ArrayOfStringsPreview.d.ts +1 -1
  50. package/dist/preview/property_previews/ArrayOneOfPreview.d.ts +1 -1
  51. package/dist/preview/property_previews/ArrayPropertyPreview.d.ts +1 -1
  52. package/dist/preview/property_previews/MapPropertyPreview.d.ts +1 -1
  53. package/dist/preview/property_previews/StringPropertyPreview.d.ts +1 -1
  54. package/dist/routes/RebaseRoute.d.ts +1 -1
  55. package/dist/types/components/PropertyPreviewProps.d.ts +19 -0
  56. package/dist/util/number_format.d.ts +14 -0
  57. package/dist/util/previews.d.ts +9 -2
  58. package/dist/util/view_constants.d.ts +24 -0
  59. package/dist/util/view_mode.d.ts +18 -0
  60. package/dist/{util-GiwPgxnL.js → util-B8hurkxt.js} +3569 -1692
  61. package/dist/util-B8hurkxt.js.map +1 -0
  62. package/package.json +9 -9
  63. package/src/collection_editor/serializable_types.ts +1 -0
  64. package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +9 -11
  65. package/src/components/AdditionalFieldValue.tsx +68 -0
  66. package/src/components/CollectionTableBinding/CollectionTableBinding.tsx +7 -8
  67. package/src/components/CollectionTableBinding/PropertyTableCell.tsx +2 -2
  68. package/src/components/CollectionTableBinding/column_utils.tsx +15 -6
  69. package/src/components/CollectionTableBinding/internal/popup_field/PopupFormField.tsx +2 -2
  70. package/src/components/CollectionViewBinding/BoardCardBinding.tsx +26 -27
  71. package/src/components/CollectionViewBinding/CollectionCardViewBinding.tsx +2 -1
  72. package/src/components/CollectionViewBinding/CollectionListViewBinding.tsx +822 -354
  73. package/src/components/CollectionViewBinding/CollectionViewActions.tsx +1 -1
  74. package/src/components/CollectionViewBinding/CollectionViewBinding.tsx +51 -12
  75. package/src/components/CollectionViewBinding/EntityCardBinding.tsx +51 -39
  76. package/src/components/CollectionViewBinding/SearchExplanation.tsx +106 -0
  77. package/src/components/CollectionViewBinding/SearchHighlight.tsx +285 -0
  78. package/src/components/CollectionViewBinding/SlotValue.tsx +156 -0
  79. package/src/components/CollectionViewBinding/SplitListCloseButton.tsx +23 -7
  80. package/src/components/CollectionViewBinding/SplitListShowButton.tsx +28 -0
  81. package/src/components/CollectionViewBinding/SplitListView.tsx +47 -7
  82. package/src/components/CollectionViewBinding/useBoardDataController.tsx +12 -3
  83. package/src/components/CollectionViewBinding/usePreviewSlots.ts +183 -64
  84. package/src/components/CollectionViewBinding/utils.ts +7 -4
  85. package/src/components/DefaultDrawer.tsx +19 -23
  86. package/src/components/DetailViewBinding.tsx +109 -62
  87. package/src/components/DrawerNavigationGroup.tsx +16 -39
  88. package/src/components/DrawerNavigationItem.tsx +44 -16
  89. package/src/components/EditViewBinding.tsx +233 -50
  90. package/src/components/EntityDisplayHeader.tsx +170 -0
  91. package/src/components/EntityIdentityBar.tsx +163 -23
  92. package/src/components/EntityInspector.tsx +24 -6
  93. package/src/components/EntityPreviewBinding.tsx +58 -18
  94. package/src/components/EntityViewBinding.tsx +344 -41
  95. package/src/components/InlineEntityPreview.tsx +10 -10
  96. package/src/components/RebaseLayout.tsx +2 -2
  97. package/src/components/RebaseShell.tsx +2 -2
  98. package/src/components/ReferenceTable/SelectionTableBinding.tsx +4 -2
  99. package/src/components/RelationSelector.tsx +23 -9
  100. package/src/components/SideDialogs.tsx +15 -3
  101. package/src/components/SidePanelBinding.tsx +122 -66
  102. package/src/components/UserSelector.tsx +20 -8
  103. package/src/components/app/Scaffold.tsx +112 -10
  104. package/src/components/history/LastEditedByIndicator.tsx +7 -12
  105. package/src/components/index.ts +3 -0
  106. package/src/data_import/utils/data.ts +9 -1
  107. package/src/form/EntityForm.tsx +74 -53
  108. package/src/form/EntityFormBinding.tsx +24 -11
  109. package/src/form/PropertyFieldBinding.tsx +2 -2
  110. package/src/form/components/FieldBlock.tsx +80 -10
  111. package/src/form/components/FormRail.tsx +19 -2
  112. package/src/form/components/FormSections.tsx +32 -5
  113. package/src/form/components/StorageUploadProgress.tsx +9 -3
  114. package/src/form/components/useRailVisible.tsx +5 -4
  115. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +2 -2
  116. package/src/form/field_bindings/BinaryFieldBinding.tsx +10 -5
  117. package/src/form/field_bindings/BlockFieldBinding.tsx +3 -3
  118. package/src/form/field_bindings/GeopointFieldBinding.tsx +23 -16
  119. package/src/form/field_bindings/MapFieldBinding.tsx +2 -2
  120. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +13 -7
  121. package/src/form/field_bindings/MultiSelectFieldBinding.tsx +7 -1
  122. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +21 -2
  123. package/src/form/field_bindings/ReferenceFieldBinding.tsx +1 -1
  124. package/src/form/field_bindings/RelationFieldBinding.tsx +5 -2
  125. package/src/form/field_bindings/RepeatFieldBinding.tsx +3 -3
  126. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +2 -2
  127. package/src/form/field_bindings/UserSelectFieldBinding.tsx +4 -1
  128. package/src/form/field_bindings/VectorFieldBinding.tsx +6 -4
  129. package/src/form/form_utils.ts +78 -0
  130. package/src/hooks/navigation/useBuildCollectionRegistryController.tsx +29 -5
  131. package/src/hooks/useEntityDisplay.tsx +262 -0
  132. package/src/hooks/useEntityDisplayTitle.tsx +27 -38
  133. package/src/index.ts +9 -1
  134. package/src/preview/PropertyPreview.tsx +25 -5
  135. package/src/preview/compact_text.ts +68 -0
  136. package/src/preview/components/BooleanPreview.tsx +5 -2
  137. package/src/preview/components/StorageThumbnail.tsx +5 -2
  138. package/src/preview/property_previews/ArrayOfRelationsPreview.tsx +6 -3
  139. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +26 -1
  140. package/src/preview/property_previews/ArrayOneOfPreview.tsx +10 -1
  141. package/src/preview/property_previews/ArrayPropertyPreview.tsx +10 -1
  142. package/src/preview/property_previews/MapPropertyPreview.tsx +52 -1
  143. package/src/preview/property_previews/NumberPropertyPreview.tsx +9 -1
  144. package/src/preview/property_previews/StringPropertyPreview.tsx +8 -5
  145. package/src/routes/RebaseRoute.tsx +62 -4
  146. package/src/types/components/PropertyPreviewProps.tsx +21 -0
  147. package/src/util/navigation_utils.ts +4 -2
  148. package/src/util/number_format.ts +46 -0
  149. package/src/util/previews.ts +8 -55
  150. package/src/util/property_utils.tsx +6 -1
  151. package/src/util/view_constants.ts +27 -0
  152. package/src/util/view_mode.ts +36 -0
  153. package/dist/RouterCollectionsStudioView-BsLTNoqX.js.map +0 -1
  154. package/dist/util-GiwPgxnL.js.map +0 -1
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Turning block content into the one line a compact preview has room for.
3
+ *
4
+ * A preview slot inside a card is a single line that cannot grow. Rendering
5
+ * Markdown there does not produce a small version of the document — it
6
+ * produces the whole document, headings and lists included, inside a 44px box.
7
+ * These helpers take the opening line instead, which is what a person reads
8
+ * off a card anyway.
9
+ */
10
+ /**
11
+ * The readable text of a Markdown document, as one line.
12
+ *
13
+ * Deliberately a lexical strip rather than a parse: this runs once per preview
14
+ * cell in a table that can hold hundreds, and the result is truncated to a line
15
+ * regardless, so the cost of being exactly right is not worth paying. Anything
16
+ * it fails to strip degrades to a stray `*`, never to a broken layout.
17
+ */
18
+ export declare function markdownToPlainText(source: string, maxLength?: number): string;
19
+ /**
20
+ * Whitespace — including the newlines that would otherwise let a `truncate`
21
+ * container grow — collapsed to single spaces, capped to `maxLength`.
22
+ */
23
+ export declare function collapseToSingleLine(source: string, maxLength?: number): string;
@@ -4,8 +4,10 @@ import { PreviewSize } from "../../types/components/PropertyPreviewProps";
4
4
  /**
5
5
  * @group Preview components
6
6
  */
7
- export declare function BooleanPreview({ value, size, property }: {
7
+ export declare function BooleanPreview({ value, size, property, hideLabel }: {
8
8
  value: boolean;
9
9
  size: PreviewSize;
10
10
  property: Property;
11
+ /** The caller already shows the name — see `PropertyPreviewProps.hideLabel`. */
12
+ hideLabel?: boolean;
11
13
  }): React.ReactElement;
@@ -4,4 +4,4 @@ import type { PropertyPreviewProps } from "../../types/components/PropertyPrevie
4
4
  /**
5
5
  * @group Preview components
6
6
  */
7
- export declare function ArrayOfStringsPreview({ propertyKey, value, property: property, size }: PropertyPreviewProps<ArrayProperty>): React.JSX.Element;
7
+ export declare function ArrayOfStringsPreview({ propertyKey, value, property: property, size, compact }: PropertyPreviewProps<ArrayProperty>): React.JSX.Element;
@@ -4,4 +4,4 @@ import type { PropertyPreviewProps } from "../../types/components/PropertyPrevie
4
4
  /**
5
5
  * @group Preview components
6
6
  */
7
- export declare function ArrayOneOfPreview({ propertyKey, value, property: property, size }: PropertyPreviewProps<ArrayProperty>): React.JSX.Element | null;
7
+ export declare function ArrayOneOfPreview({ propertyKey, value, property: property, size, compact }: PropertyPreviewProps<ArrayProperty>): React.JSX.Element | null;
@@ -4,4 +4,4 @@ import type { PropertyPreviewProps } from "../../types/components/PropertyPrevie
4
4
  /**
5
5
  * @group Preview components
6
6
  */
7
- export declare function ArrayPropertyPreview({ propertyKey, value, property: property, size }: PropertyPreviewProps<ArrayProperty>): React.JSX.Element | null;
7
+ export declare function ArrayPropertyPreview({ propertyKey, value, property: property, size, compact }: PropertyPreviewProps<ArrayProperty>): React.JSX.Element | null;
@@ -4,7 +4,7 @@ import type { PropertyPreviewProps } from "../../types/components/PropertyPrevie
4
4
  /**
5
5
  * @group Preview components
6
6
  */
7
- export declare function MapPropertyPreview({ propertyKey, value, property, size }: PropertyPreviewProps<MapProperty>): React.JSX.Element | null;
7
+ export declare function MapPropertyPreview({ propertyKey, value, property, size, compact }: PropertyPreviewProps<MapProperty>): React.JSX.Element | null;
8
8
  export declare function KeyValuePreview({ value }: {
9
9
  value: any;
10
10
  }): React.JSX.Element | null;
@@ -4,4 +4,4 @@ import type { PropertyPreviewProps } from "../../types/components/PropertyPrevie
4
4
  /**
5
5
  * @group Preview components
6
6
  */
7
- export declare function StringPropertyPreview({ propertyKey, value, property, size, textOnly }: PropertyPreviewProps<StringProperty>): React.ReactElement;
7
+ export declare function StringPropertyPreview({ propertyKey, value, property, size, textOnly, compact }: PropertyPreviewProps<StringProperty>): React.ReactElement;
@@ -1 +1 @@
1
- export declare function RebaseRoute(): import("react").JSX.Element | null;
1
+ export declare function RebaseRoute(): import("react").JSX.Element;
@@ -49,4 +49,23 @@ export interface PropertyPreviewProps<P extends Property | Property, CustomProps
49
49
  * If true, relations/references will render as plain text strings rather than full cards.
50
50
  */
51
51
  textOnly?: boolean;
52
+ /**
53
+ * The preview has one line and cannot grow — it fills a slot in a card, a
54
+ * chip, or a table cell of fixed height.
55
+ *
56
+ * Properties whose natural rendering is a block (Markdown, multi-line text,
57
+ * maps, arrays) render a one-line stand-in instead: an opening excerpt, or
58
+ * a count. Left unset, {@link PropertyPreview} infers it from the entity
59
+ * preview nesting depth, which is where the constraint actually comes from;
60
+ * pass it explicitly only to force the compact form somewhere the nesting
61
+ * does not say so.
62
+ */
63
+ compact?: boolean;
64
+ /**
65
+ * The caller has already labelled this value, so the preview must not
66
+ * repeat the property name. A boolean is the one that does: it renders its
67
+ * name beside the checkbox, which reads as a caption in a table cell and as
68
+ * a stutter under a field label — "VIP" over a checkbox saying "VIP".
69
+ */
70
+ hideLabel?: boolean;
52
71
  }
@@ -0,0 +1,14 @@
1
+ import type { NumberFormatOptions } from "@rebasepro/admin-types";
2
+ /**
3
+ * Write a number out for reading, per a property's declared `admin.format`.
4
+ *
5
+ * Nothing is inferred here. With no options the number is returned as it came
6
+ * out of the database — `String(value)`, not a locale-grouped rendering — so a
7
+ * panel that declares nothing shows exactly the stored value, and an author who
8
+ * wants thousands separators asks for them.
9
+ *
10
+ * `Intl.NumberFormat` throws on a bad currency code or an out-of-range fraction
11
+ * count, and a record must not blank because one property is misconfigured, so a
12
+ * failure falls back to the raw value.
13
+ */
14
+ export declare function formatNumber(value: number, options: NumberFormatOptions | undefined, fallbackLocale?: string): string;
@@ -1,6 +1,13 @@
1
1
  import type { PropertyConfig, AdminCollection } from "@rebasepro/admin-types";
2
- import { AuthController } from "@rebasepro/admin-types";
3
- export declare function getEntityPreviewKeys(authController: AuthController, targetCollection: AdminCollection<any>, fields: Record<string, PropertyConfig>, previewProperties?: string[], limit?: number): string[];
2
+ /**
3
+ * Which properties fill a preview surface, best first.
4
+ *
5
+ * The implementation lives in `@rebasepro/app` so that the admin package and
6
+ * the app package cannot disagree about what a record looks like in a card —
7
+ * they had drifted, and only one of the two copies had learned to keep
8
+ * relations out of the list.
9
+ */
10
+ export { getEntityPreviewKeys } from "@rebasepro/app";
4
11
  /**
5
12
  * The property that fills the title slot for a collection.
6
13
  *
@@ -4,3 +4,27 @@
4
4
  export declare const MAIN_TAB_VALUE = "__main_##Q$SC^#S6";
5
5
  export declare const JSON_TAB_VALUE = "__json";
6
6
  export declare const HISTORY_TAB_VALUE = "__rebase_history";
7
+ /**
8
+ * The tab row belongs to the header band above the record, not to the record
9
+ * itself, so it carries the same surface the identity bar over it and the form
10
+ * rail beside it carry. Against that, the active tab takes the record's own
11
+ * white and reads as connected to what it opens; on a white row it had to be
12
+ * the tinted one, which is the relationship backwards.
13
+ */
14
+ export declare const ENTITY_VIEW_TAB_BAR_CLASS = "bg-surface-50 dark:bg-surface-900";
15
+ /**
16
+ * Every tab in that row, a custom `tabComponent` included.
17
+ *
18
+ * `h-full` over the variant's `h-9`: the row is 40px and the tab 36px, so a
19
+ * centred tab floated ~2px clear of the row's bottom border and the active
20
+ * tab's underline stopped short of the record it opens. Paired with
21
+ * `items-stretch` on the Tabs root, which the variant leaves centred.
22
+ */
23
+ export declare const ENTITY_VIEW_TAB_CLASS = "h-full data-[state=active]:bg-white dark:data-[state=active]:bg-surface-800";
24
+ /**
25
+ * Added on top for the tabs this row labels itself — a custom `tabComponent`
26
+ * sizes its own contents. The main tab was the only one rendered without it,
27
+ * and so the only one left at the boxy variant's `text-xs` while its
28
+ * neighbours sat at `text-sm`.
29
+ */
30
+ export declare const ENTITY_VIEW_TAB_LABEL_CLASS = "text-sm min-w-[90px]";
@@ -27,6 +27,24 @@ export declare function getViewModeFromSearch(search?: string): ViewMode | null;
27
27
  * current browser location.
28
28
  */
29
29
  export declare function withViewMode(url: string, search?: string): string;
30
+ /**
31
+ * Carry the whole of the collection list's URL state onto a navigation target.
32
+ *
33
+ * `withViewMode` exists because losing the view mode mid-session is jarring.
34
+ * Everything else the list writes to the URL — the search string, the filters,
35
+ * the sort — is state the user built up deliberately, and losing *that* is
36
+ * worse: opening a record from a search and pressing back returned an
37
+ * unfiltered list with an empty search box, so the search had to be retyped
38
+ * for every record they wanted to look at.
39
+ *
40
+ * Copies every param the list currently has rather than an allowlist, because
41
+ * filters are encoded under the field's own name — there is no fixed set to
42
+ * list. Params already on the target win: the caller is more specific.
43
+ *
44
+ * @param url the URL to decorate. May carry a query string and/or a hash.
45
+ * @param search query string to read from. Defaults to the browser location.
46
+ */
47
+ export declare function withListState(url: string, search?: string): string;
30
48
  /**
31
49
  * Resolve the view mode for a collection, honouring the documented priority:
32
50
  * URL param > saved user config > collection default.