@middag-io/react 0.45.0 → 0.45.3
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.
- package/README.md +4 -3
- package/docs/public/schemas/ai-contract-manifest.json +1820 -0
- package/docs/public/schemas/blocks.json +445 -0
- package/docs/public/schemas/components.json +166 -0
- package/docs/public/schemas/connectors.json +97 -0
- package/docs/public/schemas/fragment.json +2329 -0
- package/docs/public/schemas/manifest.json +119 -0
- package/docs/public/schemas/navigation.json +72 -0
- package/docs/public/schemas/page-contract.json +2329 -0
- package/docs/public/schemas/shared-props.json +118 -0
- package/docs/public/schemas/theme-defaults.json +253 -0
- package/docs/public/schemas/theme.json +401 -0
- package/package.json +109 -3
- package/src/assets/lottie/calendar/schedule-1.json +1 -0
- package/src/assets/lottie/calendar/schedule-2.json +1 -0
- package/src/assets/lottie/celebration/confetti-1.json +1 -0
- package/src/assets/lottie/celebration/confetti-2.json +1 -0
- package/src/assets/lottie/celebration/confetti-3.json +1 -0
- package/src/assets/lottie/cloud/cloud-1.json +1 -0
- package/src/assets/lottie/cloud/cloud-2.json +1 -0
- package/src/assets/lottie/connection/network-1.json +1 -0
- package/src/assets/lottie/connection/network-2.json +1 -0
- package/src/assets/lottie/connection/network-3.json +1 -0
- package/src/assets/lottie/dashboard/analytics-1.json +1 -0
- package/src/assets/lottie/dashboard/analytics-2.json +1 -0
- package/src/assets/lottie/dashboard/analytics-3.json +1 -0
- package/src/assets/lottie/email/mail-1.json +1 -0
- package/src/assets/lottie/email/mail-2.json +1 -0
- package/src/assets/lottie/email/mail-3.json +1 -0
- package/src/assets/lottie/empty-state/empty-1.json +1 -0
- package/src/assets/lottie/empty-state/empty-2.json +1 -0
- package/src/assets/lottie/empty-state/empty-3.json +1 -0
- package/src/assets/lottie/error/warning-1.json +1 -0
- package/src/assets/lottie/error/warning-2.json +1 -0
- package/src/assets/lottie/error/warning-3.json +1 -0
- package/src/assets/lottie/index.ts +49 -0
- package/src/assets/lottie/loading/spinner-1.json +1 -0
- package/src/assets/lottie/loading/spinner-2.json +1 -0
- package/src/assets/lottie/loading/spinner-3.json +1 -0
- package/src/assets/lottie/maintenance/construction-1.json +1 -0
- package/src/assets/lottie/maintenance/construction-2.json +1 -0
- package/src/assets/lottie/maintenance/construction-3.json +1 -0
- package/src/assets/lottie/not-found/404-1.json +1 -0
- package/src/assets/lottie/not-found/404-2.json +1 -0
- package/src/assets/lottie/not-found/404-3.json +1 -0
- package/src/assets/lottie/notification/bell-1.json +1 -0
- package/src/assets/lottie/notification/bell-2.json +1 -0
- package/src/assets/lottie/notification/bell-3.json +1 -0
- package/src/assets/lottie/onboarding/welcome-1.json +1 -0
- package/src/assets/lottie/onboarding/welcome-2.json +1 -0
- package/src/assets/lottie/onboarding/welcome-3.json +1 -0
- package/src/assets/lottie/payment/wallet-1.json +1 -0
- package/src/assets/lottie/payment/wallet-2.json +1 -0
- package/src/assets/lottie/payment/wallet-3.json +1 -0
- package/src/assets/lottie/search/search-1.json +1 -0
- package/src/assets/lottie/search/search-2.json +1 -0
- package/src/assets/lottie/search/search-3.json +1 -0
- package/src/assets/lottie/security/lock-1.json +1 -0
- package/src/assets/lottie/security/lock-2.json +1 -0
- package/src/assets/lottie/security/lock-3.json +1 -0
- package/src/assets/lottie/settings/gear-1.json +1 -0
- package/src/assets/lottie/settings/gear-2.json +1 -0
- package/src/assets/lottie/settings/gear-3.json +1 -0
- package/src/assets/lottie/success/check-1.json +1 -0
- package/src/assets/lottie/success/check-2.json +1 -0
- package/src/assets/lottie/success/check-3.json +1 -0
- package/src/assets/lottie/upload/upload-1.json +1 -0
- package/src/assets/lottie/upload/upload-2.json +1 -0
- package/src/assets/lottie/upload/upload-3.json +1 -0
- package/src/assets/lottie/user/profile-1.json +1 -0
- package/src/assets/lottie/user/profile-2.json +1 -0
- package/src/assets/lottie/user/profile-3.json +1 -0
- package/src/base/blocks/ActionGridBlock.tsx +151 -0
- package/src/base/blocks/ActivityTimelineBlock.tsx +180 -0
- package/src/base/blocks/CardGridBlock.tsx +384 -0
- package/src/base/blocks/ChartBlock.tsx +81 -0
- package/src/base/blocks/DenseTableBlock.tsx +403 -0
- package/src/base/blocks/DetailPanelBlock.tsx +189 -0
- package/src/base/blocks/EmptyStateBlock.tsx +46 -0
- package/src/base/blocks/FormPanelBlock.lazy.tsx +38 -0
- package/src/base/blocks/FormPanelBlock.tsx +480 -0
- package/src/base/blocks/LinkListBlock.tsx +94 -0
- package/src/base/blocks/MarkdownPanelBlock.tsx +60 -0
- package/src/base/blocks/MetricCardBlock.tsx +128 -0
- package/src/base/blocks/StatusStripBlock.tsx +43 -0
- package/src/base/blocks/TabsBlock.tsx +94 -0
- package/src/base/form/FormField.tsx +607 -0
- package/src/base/form/fields/CheckboxField.tsx +56 -0
- package/src/base/form/fields/ColorField.tsx +76 -0
- package/src/base/form/fields/CurrencyField.tsx +126 -0
- package/src/base/form/fields/DateField.tsx +168 -0
- package/src/base/form/fields/DateRangeField.tsx +66 -0
- package/src/base/form/fields/DocumentField.tsx +222 -0
- package/src/base/form/fields/EntityPickerField.tsx +244 -0
- package/src/base/form/fields/FileUploadField.tsx +253 -0
- package/src/base/form/fields/MultiSelectField.tsx +286 -0
- package/src/base/form/fields/NativeSelectField.tsx +67 -0
- package/src/base/form/fields/NumberField.tsx +67 -0
- package/src/base/form/fields/OtpField.tsx +88 -0
- package/src/base/form/fields/PasswordField.tsx +69 -0
- package/src/base/form/fields/PhoneField.tsx +64 -0
- package/src/base/form/fields/RadioField.tsx +66 -0
- package/src/base/form/fields/RatingField.tsx +52 -0
- package/src/base/form/fields/SelectField.tsx +76 -0
- package/src/base/form/fields/SliderField.tsx +77 -0
- package/src/base/form/fields/SlugField.tsx +114 -0
- package/src/base/form/fields/StaticField.tsx +25 -0
- package/src/base/form/fields/SwitchField.tsx +56 -0
- package/src/base/form/fields/TagsField.tsx +128 -0
- package/src/base/form/fields/TextField.tsx +55 -0
- package/src/base/form/fields/TextareaField.tsx +55 -0
- package/src/base/form/fields/document-validation.ts +126 -0
- package/src/base/form/fields/field-registry.ts +53 -0
- package/src/base/form/fields/register-default-fields.ts +86 -0
- package/src/base/form/form-schema-builder.ts +192 -0
- package/src/base/form/form-utils.ts +71 -0
- package/src/base/hooks/useIsDark.ts +50 -0
- package/src/base/hooks/useLazyTabs.ts +98 -0
- package/src/base/hooks/usePolling.ts +43 -0
- package/src/base/hooks/useRemember.ts +58 -0
- package/src/base/hooks/useToast.ts +27 -0
- package/src/base/layout/BlockRegion.tsx +39 -0
- package/src/base/layout/DashboardLayout.tsx +110 -0
- package/src/base/layout/SidebarLayout.tsx +38 -0
- package/src/base/layout/StackLayout.tsx +32 -0
- package/src/base/layout/WizardLayout.tsx +49 -0
- package/src/base/partials/ActionBar/index.tsx +115 -0
- package/src/base/partials/ConfirmationDialog/index.tsx +128 -0
- package/src/base/partials/DataTable/cell-registry.ts +50 -0
- package/src/base/partials/DataTable/cell-renderers.tsx +372 -0
- package/src/base/partials/DataTable/index.tsx +1282 -0
- package/src/base/partials/DataTable/register-default-cells.ts +37 -0
- package/src/base/partials/DataTable/sanitize-html.ts +45 -0
- package/src/base/partials/DataTable/types.ts +229 -0
- package/src/base/partials/DetailSection/index.tsx +316 -0
- package/src/base/partials/EmptyPlaceholder/index.tsx +162 -0
- package/src/base/partials/EntityItem/index.tsx +154 -0
- package/src/base/partials/FilterBar/index.tsx +256 -0
- package/src/base/partials/FormSection/index.tsx +87 -0
- package/src/base/partials/LogViewer/JsonBlock.tsx +39 -0
- package/src/base/partials/LogViewer/LogEntry.tsx +68 -0
- package/src/base/partials/LogViewer/LogViewerToolbar.tsx +71 -0
- package/src/base/partials/LogViewer/index.tsx +110 -0
- package/src/base/partials/LogViewer/types.ts +28 -0
- package/src/base/partials/MarkdownContent/index.tsx +307 -0
- package/src/base/partials/MenuBar/index.tsx +80 -0
- package/src/base/partials/QuickRecordSheet/index.tsx +59 -0
- package/src/base/partials/ResizableSidebar/index.tsx +70 -0
- package/src/base/partials/StatRow/index.tsx +28 -0
- package/src/base/partials/StatusBar/index.tsx +126 -0
- package/src/base/partials/StatusIndicator/index.tsx +61 -0
- package/src/base/partials/StepIndicator/index.tsx +63 -0
- package/src/base/partials/TableOfContents/index.tsx +78 -0
- package/src/base/partials/TimelineList/index.tsx +273 -0
- package/src/base/partials/ToggleGroupControl/index.tsx +100 -0
- package/src/base/partials/TreeView/index.tsx +75 -0
- package/src/base/partials/index.ts +23 -0
- package/src/base/shell/AuthShell.tsx +54 -0
- package/src/base/shell/BasicShell.tsx +286 -0
- package/src/base/shell/ImmersiveShell.tsx +85 -0
- package/src/base/shell/partials/EditablePanelContext.tsx +82 -0
- package/src/base/shell/partials/EditablePanelProvider.tsx +122 -0
- package/src/base/shell/partials/InlineEditablePanel.tsx +239 -0
- package/src/base/shell/partials/InspectorContext.tsx +173 -0
- package/src/base/shell/partials/InspectorPanel.tsx +65 -0
- package/src/base/shell/partials/NavErrorBoundary.tsx +82 -0
- package/src/base/shell/partials/OverlayScreen.tsx +67 -0
- package/src/base/shell/partials/PageActionButton.tsx +203 -0
- package/src/base/theme/appearance.ts +133 -0
- package/src/base/theme/host-layout-detector.ts +119 -0
- package/src/base/theme/host-theme-detector.ts +146 -0
- package/src/base/theme/sidebar-safelist.txt +20 -0
- package/src/base/theme/tailwind-theme.css +136 -0
- package/src/base/theme/theme-bridge.css +164 -0
- package/src/base/theme/theme-context.tsx +142 -0
- package/src/base/theme/themes/classic.css +174 -0
- package/src/base/theme/tokens.css +290 -0
- package/src/base/theme/useHostTheme.ts +95 -0
- package/src/base/utils/clipboard.ts +39 -0
- package/src/base/utils/conditions.ts +27 -0
- package/src/base/utils/icon-registry.ts +78 -0
- package/src/base/utils/icons.ts +31 -0
- package/src/base/utils/interpolate.ts +9 -0
- package/src/base/utils/register-default-icons.ts +163 -0
- package/src/base/utils/storage.ts +65 -0
- package/src/base/utils/time.ts +139 -0
- package/src/contracts/block-data/actions.ts +73 -0
- package/src/contracts/block-data/data-display.ts +343 -0
- package/src/contracts/block-data/form.ts +164 -0
- package/src/contracts/block-data/index.ts +15 -0
- package/src/contracts/block-data/interactive.ts +34 -0
- package/src/contracts/block-data/shared.ts +44 -0
- package/src/contracts/connectors.ts +60 -0
- package/src/contracts/generated/contract-schema.ts +1237 -0
- package/src/contracts/generated/contract-types.ts +675 -0
- package/src/contracts/generated/index.ts +15 -0
- package/src/contracts/navigation.ts +59 -0
- package/src/contracts/page-contract-schema.ts +40 -0
- package/src/contracts/page-contract.ts +79 -0
- package/src/contracts/shared-props.ts +92 -0
- package/src/engine/ContractPage.tsx +178 -0
- package/src/engine/EntityRoutes.tsx +72 -0
- package/src/engine/HostSlot.tsx +126 -0
- package/src/engine/LazyBlock.tsx +92 -0
- package/src/engine/bootstrap.tsx +20 -0
- package/src/engine/providers/auth.tsx +87 -0
- package/src/engine/providers/error-reporter.tsx +89 -0
- package/src/engine/providers/flash.tsx +44 -0
- package/src/engine/providers/index.ts +18 -0
- package/src/engine/providers/inertia-error-reporter.tsx +61 -0
- package/src/engine/providers/progress.tsx +56 -0
- package/src/engine/providers/scope.tsx +51 -0
- package/src/engine/register-defaults.ts +88 -0
- package/src/engine/registries.ts +96 -0
- package/src/i18n/I18nProvider.tsx +53 -0
- package/src/i18n/MANIFEST.md +101 -0
- package/src/i18n/host-resolver.ts +18 -0
- package/src/i18n/instance.ts +69 -0
- package/src/i18n/locales/en/ui.json +277 -0
- package/src/i18n/locales/en/validators.json +13 -0
- package/src/i18n/locales/pt-BR/ui.json +277 -0
- package/src/i18n/locales/pt-BR/validators.json +13 -0
- package/src/i18n/register-strings.ts +10 -0
- package/src/i18n/render-label.ts +33 -0
- package/src/i18n/resolve-field-error.ts +29 -0
- package/src/i18n/useHostString.ts +50 -0
- package/src/i18n/useTranslation.ts +83 -0
- package/src/lib/actions/resolve-action-target.ts +151 -0
- package/src/lib/hooks/use-copy-to-clipboard.ts +37 -0
- package/src/lib/hooks/use-file-upload.ts +406 -0
- package/src/lib/hooks/use-mobile.ts +21 -0
- package/src/lib/host-pending.ts +76 -0
- package/src/lib/portal-container.ts +16 -0
- package/src/lib/test-ids.ts +40 -0
- package/src/lib/utils.ts +6 -0
- package/src/primitives/reui/MANIFEST.md +97 -0
- package/src/primitives/reui/accordion.tsx +64 -0
- package/src/primitives/reui/alert-dialog.tsx +196 -0
- package/src/primitives/reui/alert.tsx +92 -0
- package/src/primitives/reui/aspect-ratio.tsx +9 -0
- package/src/primitives/reui/autocomplete.tsx +343 -0
- package/src/primitives/reui/avatar.tsx +109 -0
- package/src/primitives/reui/badge.tsx +94 -0
- package/src/primitives/reui/breadcrumb.tsx +109 -0
- package/src/primitives/reui/button-group.tsx +83 -0
- package/src/primitives/reui/button.tsx +64 -0
- package/src/primitives/reui/calendar.tsx +220 -0
- package/src/primitives/reui/card.tsx +92 -0
- package/src/primitives/reui/carousel.tsx +239 -0
- package/src/primitives/reui/chart.tsx +388 -0
- package/src/primitives/reui/checkbox.tsx +30 -0
- package/src/primitives/reui/collapsible.tsx +31 -0
- package/src/primitives/reui/combobox.tsx +308 -0
- package/src/primitives/reui/command.tsx +182 -0
- package/src/primitives/reui/context-menu.tsx +250 -0
- package/src/primitives/reui/data-grid/data-grid-column-filter.tsx +172 -0
- package/src/primitives/reui/data-grid/data-grid-column-header.tsx +420 -0
- package/src/primitives/reui/data-grid/data-grid-column-visibility.tsx +51 -0
- package/src/primitives/reui/data-grid/data-grid-pagination.tsx +235 -0
- package/src/primitives/reui/data-grid/data-grid-scroll-area.tsx +427 -0
- package/src/primitives/reui/data-grid/data-grid-table-dnd-rows.tsx +308 -0
- package/src/primitives/reui/data-grid/data-grid-table-dnd.tsx +318 -0
- package/src/primitives/reui/data-grid/data-grid-table-virtual.tsx +491 -0
- package/src/primitives/reui/data-grid/data-grid-table.tsx +1430 -0
- package/src/primitives/reui/data-grid/data-grid.tsx +269 -0
- package/src/primitives/reui/data-grid-pagination.tsx +235 -0
- package/src/primitives/reui/date-selector.tsx +1353 -0
- package/src/primitives/reui/dialog.tsx +158 -0
- package/src/primitives/reui/drawer.tsx +133 -0
- package/src/primitives/reui/dropdown-menu.tsx +257 -0
- package/src/primitives/reui/empty.tsx +104 -0
- package/src/primitives/reui/field.tsx +246 -0
- package/src/primitives/reui/filters.tsx +1891 -0
- package/src/primitives/reui/frame.tsx +170 -0
- package/src/primitives/reui/hover-card.tsx +42 -0
- package/src/primitives/reui/icon-placeholder.tsx +39 -0
- package/src/primitives/reui/index.ts +98 -0
- package/src/primitives/reui/input-group.tsx +170 -0
- package/src/primitives/reui/input-otp.tsx +75 -0
- package/src/primitives/reui/input.tsx +21 -0
- package/src/primitives/reui/item.tsx +193 -0
- package/src/primitives/reui/kanban.tsx +743 -0
- package/src/primitives/reui/kbd.tsx +28 -0
- package/src/primitives/reui/label.tsx +22 -0
- package/src/primitives/reui/menubar.tsx +274 -0
- package/src/primitives/reui/native-select.tsx +62 -0
- package/src/primitives/reui/navigation-menu.tsx +168 -0
- package/src/primitives/reui/number-field.tsx +250 -0
- package/src/primitives/reui/pagination.tsx +127 -0
- package/src/primitives/reui/phone-input.tsx +231 -0
- package/src/primitives/reui/popover.tsx +87 -0
- package/src/primitives/reui/progress.tsx +31 -0
- package/src/primitives/reui/radio-group.tsx +43 -0
- package/src/primitives/reui/rating.tsx +177 -0
- package/src/primitives/reui/resizable.tsx +51 -0
- package/src/primitives/reui/scroll-area.tsx +58 -0
- package/src/primitives/reui/scrollspy.tsx +240 -0
- package/src/primitives/reui/select.tsx +188 -0
- package/src/primitives/reui/separator.tsx +28 -0
- package/src/primitives/reui/sheet.tsx +141 -0
- package/src/primitives/reui/sidebar.tsx +732 -0
- package/src/primitives/reui/skeleton.tsx +13 -0
- package/src/primitives/reui/slider.tsx +61 -0
- package/src/primitives/reui/sonner.tsx +47 -0
- package/src/primitives/reui/sortable.tsx +414 -0
- package/src/primitives/reui/spinner.tsx +16 -0
- package/src/primitives/reui/stepper.tsx +484 -0
- package/src/primitives/reui/svgs/claudeAiIcon.tsx +12 -0
- package/src/primitives/reui/svgs/gemini.tsx +171 -0
- package/src/primitives/reui/svgs/openai.tsx +9 -0
- package/src/primitives/reui/svgs/openaiDark.tsx +12 -0
- package/src/primitives/reui/switch.tsx +33 -0
- package/src/primitives/reui/table.tsx +114 -0
- package/src/primitives/reui/tabs.tsx +91 -0
- package/src/primitives/reui/textarea.tsx +18 -0
- package/src/primitives/reui/timeline.tsx +219 -0
- package/src/primitives/reui/toggle-group.tsx +83 -0
- package/src/primitives/reui/toggle.tsx +45 -0
- package/src/primitives/reui/tooltip.tsx +55 -0
- package/src/primitives/reui/tree.tsx +247 -0
- package/src/theme.css +71 -0
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data display block types — read-only blocks that present information.
|
|
3
|
+
*
|
|
4
|
+
* Includes DenseTable, MetricCard, EmptyState, StatusStrip, DetailPanel,
|
|
5
|
+
* ActivityTimeline, MarkdownPanel, CardGrid, and LinkList.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { ConditionalAction, ExecutableAction } from "./actions";
|
|
9
|
+
import type { EmptyStateDef, EntityRef } from "./shared";
|
|
10
|
+
|
|
11
|
+
// ── DenseTableBlock ──────────────────────────────────────────────────────────
|
|
12
|
+
|
|
13
|
+
/** Display format for `timestamp` column values. Defaults to "relative". */
|
|
14
|
+
export type TimestampFormat = "relative" | "datetime" | "date" | "time" | "iso";
|
|
15
|
+
|
|
16
|
+
export interface DenseTableColumnDef {
|
|
17
|
+
key: string;
|
|
18
|
+
label: string;
|
|
19
|
+
sortable?: boolean;
|
|
20
|
+
searchable?: boolean;
|
|
21
|
+
variant?:
|
|
22
|
+
| "text"
|
|
23
|
+
| "status"
|
|
24
|
+
| "badge"
|
|
25
|
+
| "boolean"
|
|
26
|
+
| "timestamp"
|
|
27
|
+
| "link"
|
|
28
|
+
| "rich_status"
|
|
29
|
+
| "html"
|
|
30
|
+
| "link_group"
|
|
31
|
+
| "annotated"
|
|
32
|
+
| "progress";
|
|
33
|
+
/** Display format for `variant: "timestamp"` columns. Defaults to "relative". */
|
|
34
|
+
timestampFormat?: TimestampFormat;
|
|
35
|
+
/** URL pattern for link columns. Interpolated per row (e.g. "/organizations/{organizationId}"). */
|
|
36
|
+
href?: string;
|
|
37
|
+
/** Entity reference for link resolution via PageContract.entities map. */
|
|
38
|
+
entity?: EntityRef;
|
|
39
|
+
minWidth?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Cap in pixels. Longer content is clipped to one line with an ellipsis, and
|
|
42
|
+
* the full value stays in the DOM as the cell's `title`.
|
|
43
|
+
*
|
|
44
|
+
* Without a cap a column grows until the widest value fits, so a single long
|
|
45
|
+
* row can push the table past the width of the page. Capping in the column
|
|
46
|
+
* keeps the value intact — selectable, searchable by the browser, readable on
|
|
47
|
+
* hover — where trimming it in the data would not.
|
|
48
|
+
*/
|
|
49
|
+
maxWidth?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Status value → semantic intent, for `variant: "status"` and `"badge"`.
|
|
52
|
+
*
|
|
53
|
+
* Those variants resolve their colour by looking the displayed text up in a
|
|
54
|
+
* built-in English map, so a translated label matches nothing and every row
|
|
55
|
+
* renders neutral. Supplying the mapping for the labels this column actually
|
|
56
|
+
* shows is what lets a localized status column keep its colours. Keys are
|
|
57
|
+
* matched case-insensitively.
|
|
58
|
+
*/
|
|
59
|
+
statusMap?: Record<string, StatusIntent>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Semantic intents a status cell can resolve to. */
|
|
63
|
+
export type StatusIntent = "success" | "warning" | "destructive" | "secondary" | "info" | "default";
|
|
64
|
+
|
|
65
|
+
export interface DenseTablePagination {
|
|
66
|
+
page: number;
|
|
67
|
+
perPage: number;
|
|
68
|
+
total: number;
|
|
69
|
+
lastPage: number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface DenseTableSort {
|
|
73
|
+
column: string | null;
|
|
74
|
+
direction: "asc" | "desc" | null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface DenseTableFilterDef {
|
|
78
|
+
key: string;
|
|
79
|
+
label: string;
|
|
80
|
+
type: "select" | "multiselect" | "date_range";
|
|
81
|
+
options?: Array<{ value: string; label: string }>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ── Rich column value types ─────────────────────────────────────────────────
|
|
85
|
+
|
|
86
|
+
export interface RichStatusValue {
|
|
87
|
+
label: string;
|
|
88
|
+
appearance: "success" | "warning" | "danger" | "info" | "neutral";
|
|
89
|
+
icon?: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Structured value for the `annotated` column variant. */
|
|
93
|
+
export interface AnnotatedValue {
|
|
94
|
+
/** Primary text. */
|
|
95
|
+
text: string;
|
|
96
|
+
/** Optional prefix badge (colored square with 1-2 characters). */
|
|
97
|
+
badge?: { label: string; color: string };
|
|
98
|
+
/** Optional secondary text (rendered in muted mono below the primary text). */
|
|
99
|
+
sublabel?: string;
|
|
100
|
+
/** Semantic color applied to the primary text. */
|
|
101
|
+
appearance?: "success" | "warning" | "danger" | "info" | "neutral";
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Structured value for the `progress` column variant. */
|
|
105
|
+
export interface ProgressValue {
|
|
106
|
+
/** Current value. */
|
|
107
|
+
value: number;
|
|
108
|
+
/** Maximum value the bar represents. Defaults to 100. */
|
|
109
|
+
max?: number;
|
|
110
|
+
/** Label shown beside the bar. Defaults to the computed percentage (e.g. "75%"). */
|
|
111
|
+
label?: string;
|
|
112
|
+
/** Semantic color applied to the bar fill. Defaults to the primary color. */
|
|
113
|
+
appearance?: "success" | "warning" | "danger" | "info" | "neutral";
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface LinkGroupItem {
|
|
117
|
+
icon: string;
|
|
118
|
+
href: string | null;
|
|
119
|
+
label: string;
|
|
120
|
+
external?: boolean;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface DenseTableBlockData {
|
|
124
|
+
columns: DenseTableColumnDef[];
|
|
125
|
+
rows: Record<string, unknown>[];
|
|
126
|
+
pagination: DenseTablePagination;
|
|
127
|
+
sort: DenseTableSort;
|
|
128
|
+
filters: {
|
|
129
|
+
available: DenseTableFilterDef[];
|
|
130
|
+
applied: Record<string, string | string[]>;
|
|
131
|
+
};
|
|
132
|
+
/** URL pattern for row click navigation. Interpolated per row (e.g. "/organizations/{id}"). */
|
|
133
|
+
rowHref?: string;
|
|
134
|
+
rowActions?: ConditionalAction[];
|
|
135
|
+
bulkActions?: ExecutableAction[];
|
|
136
|
+
searchPlaceholder?: string;
|
|
137
|
+
emptyState?: EmptyStateDef;
|
|
138
|
+
/**
|
|
139
|
+
* The toolbar's "save as view" control.
|
|
140
|
+
*
|
|
141
|
+
* Absent, the control does not render — it has no meaning on a table whose
|
|
142
|
+
* page has nowhere to keep a view. Present, it fires this action, and the
|
|
143
|
+
* page decides what saving means: the table knows the current query, but not
|
|
144
|
+
* that views exist.
|
|
145
|
+
*
|
|
146
|
+
* `saveViewActive` fills the star, for pages where the control toggles rather
|
|
147
|
+
* than only creates.
|
|
148
|
+
*/
|
|
149
|
+
saveViewAction?: ExecutableAction;
|
|
150
|
+
saveViewActive?: boolean;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// ── MetricCardBlock ──────────────────────────────────────────────────────────
|
|
154
|
+
|
|
155
|
+
export interface MetricCardBlockData {
|
|
156
|
+
value: string | number;
|
|
157
|
+
delta?: string;
|
|
158
|
+
deltaDirection?: "positive" | "negative" | "neutral";
|
|
159
|
+
label: string;
|
|
160
|
+
icon?: string;
|
|
161
|
+
href?: string;
|
|
162
|
+
locale?: string;
|
|
163
|
+
compact?: boolean;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// ── EmptyStateBlock ──────────────────────────────────────────────────────────
|
|
167
|
+
|
|
168
|
+
export type EmptyStateVariant = "first-use" | "no-results" | "error" | "permission";
|
|
169
|
+
|
|
170
|
+
export interface EmptyStateBlockData {
|
|
171
|
+
variant?: EmptyStateVariant;
|
|
172
|
+
icon?: string;
|
|
173
|
+
/** URL to a Lottie JSON animation. When provided, replaces the icon with an animated illustration. */
|
|
174
|
+
lottieUrl?: string;
|
|
175
|
+
description: string;
|
|
176
|
+
cta?: {
|
|
177
|
+
label: string;
|
|
178
|
+
href?: string;
|
|
179
|
+
method?: "get" | "post";
|
|
180
|
+
};
|
|
181
|
+
ctaSecondary?: {
|
|
182
|
+
label: string;
|
|
183
|
+
href: string;
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// ── StatusStripBlock ─────────────────────────────────────────────────────────
|
|
188
|
+
|
|
189
|
+
export type StatusStripTone = "success" | "warning" | "danger" | "neutral";
|
|
190
|
+
export type StatusItemAppearance = "success" | "warning" | "danger" | "info" | "neutral";
|
|
191
|
+
|
|
192
|
+
export interface StatusStripItem {
|
|
193
|
+
key: string;
|
|
194
|
+
label: string;
|
|
195
|
+
value: string;
|
|
196
|
+
appearance: StatusItemAppearance;
|
|
197
|
+
tooltip?: string;
|
|
198
|
+
href?: string;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface StatusStripBlockData {
|
|
202
|
+
score?: number;
|
|
203
|
+
tone?: StatusStripTone;
|
|
204
|
+
items: StatusStripItem[];
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// ── DetailPanelBlock ─────────────────────────────────────────────────────────
|
|
208
|
+
|
|
209
|
+
export interface DetailPanelFieldDef {
|
|
210
|
+
key: string;
|
|
211
|
+
label: string;
|
|
212
|
+
value: string | number | boolean | null;
|
|
213
|
+
kind?: "text" | "status" | "timestamp" | "boolean" | "link" | "code" | "email";
|
|
214
|
+
copyable?: boolean;
|
|
215
|
+
href?: string;
|
|
216
|
+
/**
|
|
217
|
+
* Entity link for this field value.
|
|
218
|
+
* Unlike DenseTable (where entity.id is a field name in the row), here
|
|
219
|
+
* entity.id is the actual entity ID value (e.g. 1, "abc") because
|
|
220
|
+
* DetailPanel fields carry inline values, not tabular rows.
|
|
221
|
+
*/
|
|
222
|
+
entity?: { type: string; id: string | number };
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface DetailPanelSectionDef {
|
|
226
|
+
id: string;
|
|
227
|
+
title: string;
|
|
228
|
+
fields: DetailPanelFieldDef[];
|
|
229
|
+
defaultCollapsed?: boolean;
|
|
230
|
+
actions?: ExecutableAction[];
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface DetailPanelBlockData {
|
|
234
|
+
sections: DetailPanelSectionDef[];
|
|
235
|
+
columns?: 1 | 2;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// ── ActivityTimelineBlock ────────────────────────────────────────────────────
|
|
239
|
+
|
|
240
|
+
export interface ActivityTimelineEntry {
|
|
241
|
+
id: string;
|
|
242
|
+
actor: string;
|
|
243
|
+
actorHref?: string;
|
|
244
|
+
action: string;
|
|
245
|
+
detail?: string;
|
|
246
|
+
icon: string;
|
|
247
|
+
color: "success" | "info" | "warning" | "destructive" | "neutral";
|
|
248
|
+
timestamp: number;
|
|
249
|
+
/**
|
|
250
|
+
* Optional read/acknowledge affordance. When `markReadHref` is present
|
|
251
|
+
* the block renders a "mark as read" action that POSTs to it; `read` reflects
|
|
252
|
+
* the current acknowledged state (a read entry hides the action / dims). Both
|
|
253
|
+
* are additive and optional — entries without them render unchanged.
|
|
254
|
+
*/
|
|
255
|
+
read?: boolean;
|
|
256
|
+
markReadHref?: string;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export interface ActivityTimelineBlockData {
|
|
260
|
+
groups: Array<{
|
|
261
|
+
label: string;
|
|
262
|
+
entries: ActivityTimelineEntry[];
|
|
263
|
+
}>;
|
|
264
|
+
hasMore?: boolean;
|
|
265
|
+
loadMoreHref?: string;
|
|
266
|
+
limit?: number;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// ── MarkdownPanelBlock ───────────────────────────────────────────────────────
|
|
270
|
+
|
|
271
|
+
export interface MarkdownPanelBlockData {
|
|
272
|
+
content: string;
|
|
273
|
+
maxHeight?: number;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// ── CardGridBlock ───────────────────────────────────────────────────────────
|
|
277
|
+
|
|
278
|
+
export interface CardGridColumnDef {
|
|
279
|
+
key: string;
|
|
280
|
+
label: string;
|
|
281
|
+
kind?: "text" | "status" | "badge" | "boolean" | "timestamp" | "number";
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export interface CardGridBlockData {
|
|
285
|
+
columns: CardGridColumnDef[];
|
|
286
|
+
rows: Record<string, unknown>[];
|
|
287
|
+
variant?: "default" | "store" | "connector";
|
|
288
|
+
emptyState?: EmptyStateDef;
|
|
289
|
+
/** URL pattern for an edit shortcut icon on each card. Interpolated per row (e.g. "/stores/{id}/edit"). */
|
|
290
|
+
editHref?: string;
|
|
291
|
+
/** Per-card action buttons (e.g. delete), rendered alongside the edit shortcut. */
|
|
292
|
+
rowActions?: ConditionalAction[];
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// ── LinkListBlock ───────────────────────────────────────────────────────────
|
|
296
|
+
|
|
297
|
+
export interface LinkListItem {
|
|
298
|
+
label: string;
|
|
299
|
+
href: string | null;
|
|
300
|
+
icon?: string;
|
|
301
|
+
description?: string;
|
|
302
|
+
external?: boolean;
|
|
303
|
+
/**
|
|
304
|
+
* Short text pinned to the right of the row — a count, a total, a shortcut.
|
|
305
|
+
*
|
|
306
|
+
* A facet list reads as two columns: what it is on the left, how many on the
|
|
307
|
+
* right. Folded into the label it becomes part of the name and the eye has to
|
|
308
|
+
* parse each row to find the number.
|
|
309
|
+
*/
|
|
310
|
+
trailing?: string;
|
|
311
|
+
/**
|
|
312
|
+
* Marks the row as the current selection, drawn as a filled background.
|
|
313
|
+
*
|
|
314
|
+
* A list that filters something needs to say which entry is doing it. Without
|
|
315
|
+
* this the only way to state it is inside the label text, which reads as part
|
|
316
|
+
* of the name rather than as state.
|
|
317
|
+
*/
|
|
318
|
+
active?: boolean;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface LinkListBlockData {
|
|
322
|
+
items: LinkListItem[];
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// ── ChartBlock (free) ────────────────────────────────────────────────────────
|
|
326
|
+
|
|
327
|
+
export interface ChartSeries {
|
|
328
|
+
/** Field key on each data row this series plots. */
|
|
329
|
+
key: string;
|
|
330
|
+
/** Human-facing series label. */
|
|
331
|
+
label: string;
|
|
332
|
+
/** Optional CSS color token, e.g. "var(--chart-1)". */
|
|
333
|
+
color?: string;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export interface ChartBlockData {
|
|
337
|
+
chartType: "line" | "bar" | "area";
|
|
338
|
+
/** Field key on each data row used for the x-axis category. */
|
|
339
|
+
categoryKey: string;
|
|
340
|
+
series: ChartSeries[];
|
|
341
|
+
data: Record<string, unknown>[];
|
|
342
|
+
options?: { showLegend?: boolean; showGrid?: boolean };
|
|
343
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form panel types — schema-driven form field definitions.
|
|
3
|
+
*
|
|
4
|
+
* The form field union, the field-props hierarchy and the schema-node wrappers
|
|
5
|
+
* (field, section, group, header) are GENERATED from middag-php-ui — the
|
|
6
|
+
* canonical wire contract (PHP value objects → JSON Schema → these types). This
|
|
7
|
+
* module re-exports them under the stable public names and derives the
|
|
8
|
+
* per-component variant aliases via `Extract`.
|
|
9
|
+
*
|
|
10
|
+
* Only the FormPanelBlockData envelope and the client error shapes stay
|
|
11
|
+
* hand-authored: the rich client `FieldError` ({message, key, domain, params})
|
|
12
|
+
* is intentionally NOT on the wire yet, so it is not generated.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { FormComponent, FormFieldNode, FormSchemaNode } from "@/contracts/generated";
|
|
16
|
+
|
|
17
|
+
// ── Generated contract types (re-exported under the stable public names) ──────
|
|
18
|
+
|
|
19
|
+
export type {
|
|
20
|
+
FieldPropsBase,
|
|
21
|
+
FormFieldNode,
|
|
22
|
+
FormGroupNode,
|
|
23
|
+
FormHeaderNode,
|
|
24
|
+
FormSchemaNode,
|
|
25
|
+
FormSectionNode,
|
|
26
|
+
OptionFieldProps,
|
|
27
|
+
} from "@/contracts/generated";
|
|
28
|
+
|
|
29
|
+
/** The full catalog of renderable form field components. */
|
|
30
|
+
export type FormFieldType = FormComponent;
|
|
31
|
+
|
|
32
|
+
// ── Field node variants (narrowed from the generated `component` union) ───────
|
|
33
|
+
//
|
|
34
|
+
// The per-variant interfaces stay part of the public API as `Extract`
|
|
35
|
+
// aliases over the generated union, so consumers importing them keep compiling.
|
|
36
|
+
// Each constraint matches exactly one generated branch's `component` literals.
|
|
37
|
+
|
|
38
|
+
/** Simple text-based fields: text, email, url, password, color. */
|
|
39
|
+
export type SimpleFormField = Extract<
|
|
40
|
+
FormFieldNode,
|
|
41
|
+
{ component: "text" | "email" | "url" | "password" | "color" }
|
|
42
|
+
>;
|
|
43
|
+
|
|
44
|
+
/** Textarea field with configurable row count. */
|
|
45
|
+
export type TextareaFormField = Extract<FormFieldNode, { component: "textarea" }>;
|
|
46
|
+
|
|
47
|
+
/** One-time-password / verification code input (segmented slots). */
|
|
48
|
+
export type OtpFormField = Extract<FormFieldNode, { component: "otp" }>;
|
|
49
|
+
|
|
50
|
+
/** Numeric input fields: int, float. */
|
|
51
|
+
export type NumericFormField = Extract<FormFieldNode, { component: "int" | "float" }>;
|
|
52
|
+
|
|
53
|
+
/** Numeric range slider (single value or multi-thumb range). */
|
|
54
|
+
export type SliderFormField = Extract<FormFieldNode, { component: "slider" }>;
|
|
55
|
+
|
|
56
|
+
/** Fields that select from a list of options: select, radio. */
|
|
57
|
+
export type SelectFormField = Extract<FormFieldNode, { component: "select" | "radio" }>;
|
|
58
|
+
|
|
59
|
+
/** Multi-select field. */
|
|
60
|
+
export type MultiSelectFormField = Extract<FormFieldNode, { component: "multiselect" }>;
|
|
61
|
+
|
|
62
|
+
/** Native HTML <select> — fallback for iframe/portal-hostile contexts (e.g. Moodle). */
|
|
63
|
+
export type NativeSelectFormField = Extract<FormFieldNode, { component: "native_select" }>;
|
|
64
|
+
|
|
65
|
+
/** Boolean toggle fields: checkbox, switch. */
|
|
66
|
+
export type BooleanFormField = Extract<FormFieldNode, { component: "checkbox" | "switch" }>;
|
|
67
|
+
|
|
68
|
+
/** Date and datetime pickers. */
|
|
69
|
+
export type DateFormField = Extract<FormFieldNode, { component: "date" | "datetime" }>;
|
|
70
|
+
|
|
71
|
+
/** Duration input. */
|
|
72
|
+
export type DurationFormField = Extract<FormFieldNode, { component: "duration" }>;
|
|
73
|
+
|
|
74
|
+
/** File upload field with drag-drop support. */
|
|
75
|
+
export type FileFormField = Extract<FormFieldNode, { component: "file" }>;
|
|
76
|
+
|
|
77
|
+
/** Async entity picker with search autocomplete. */
|
|
78
|
+
export type EntityPickerFormField = Extract<FormFieldNode, { component: "entity_picker" }>;
|
|
79
|
+
|
|
80
|
+
/** International phone number input. */
|
|
81
|
+
export type PhoneFormField = Extract<FormFieldNode, { component: "phone" }>;
|
|
82
|
+
|
|
83
|
+
/** National document field (CPF, CNPJ, SSN, etc.) with locale-aware validation. */
|
|
84
|
+
export type DocumentFormField = Extract<FormFieldNode, { component: "document" }>;
|
|
85
|
+
|
|
86
|
+
/** Currency input with locale formatting. */
|
|
87
|
+
export type CurrencyFormField = Extract<FormFieldNode, { component: "currency" }>;
|
|
88
|
+
|
|
89
|
+
/** Auto-generated slug from another field. */
|
|
90
|
+
export type SlugFormField = Extract<FormFieldNode, { component: "slug" }>;
|
|
91
|
+
|
|
92
|
+
/** Tag input with optional max limit. */
|
|
93
|
+
export type TagsFormField = Extract<FormFieldNode, { component: "tags" }>;
|
|
94
|
+
|
|
95
|
+
/** Star rating input. */
|
|
96
|
+
export type RatingFormField = Extract<FormFieldNode, { component: "rating" }>;
|
|
97
|
+
|
|
98
|
+
/** Date range selector with filter operators and presets. */
|
|
99
|
+
export type DateRangeFormField = Extract<FormFieldNode, { component: "date_range" }>;
|
|
100
|
+
|
|
101
|
+
/** Hidden field — not rendered, carries data. */
|
|
102
|
+
export type HiddenFormField = Extract<FormFieldNode, { component: "hidden" }>;
|
|
103
|
+
|
|
104
|
+
/** Static display-only field. */
|
|
105
|
+
export type StaticFormField = Extract<FormFieldNode, { component: "static" }>;
|
|
106
|
+
|
|
107
|
+
/** Visual header separator (non-interactive). */
|
|
108
|
+
export type HeaderFormField = Extract<FormFieldNode, { component: "header" }>;
|
|
109
|
+
|
|
110
|
+
// ── Form panel block data ─────────────────────────────────────────────────────
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* A single server validation error. v0.11.0 wire shape: `message` is the
|
|
114
|
+
* server-resolved (default-locale) string; key/domain/params are the machine
|
|
115
|
+
* channel for client-side re-translation.
|
|
116
|
+
*
|
|
117
|
+
* Hand-authored on purpose: the wire `FieldError` ($def in middag-php-ui) is the
|
|
118
|
+
* leaner `string | string[]`; unifying the two is a deferred breaking change.
|
|
119
|
+
*/
|
|
120
|
+
export interface FieldError {
|
|
121
|
+
message: string;
|
|
122
|
+
key: string;
|
|
123
|
+
domain: string;
|
|
124
|
+
params?: Record<string, unknown>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export type FormErrorValue = FieldError | FieldError[] | string;
|
|
128
|
+
|
|
129
|
+
/** Server validation errors keyed by field key. */
|
|
130
|
+
export type FormErrors = Record<string, FormErrorValue>;
|
|
131
|
+
|
|
132
|
+
/** HTTP method the form submits with. */
|
|
133
|
+
export type FormMethod = "post" | "put" | "patch";
|
|
134
|
+
|
|
135
|
+
/** Client/server validation strategy for the form panel. */
|
|
136
|
+
export type FormValidationMode = "client" | "server" | "both";
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* FormPanelBlockData — schema-driven form block payload.
|
|
140
|
+
*
|
|
141
|
+
* The backend sends a form schema (FormSchemaNode tree), initial values, server
|
|
142
|
+
* errors and submission metadata. FormPanelBlock renders the schema via FormField,
|
|
143
|
+
* validates client-side (Zod, additive to server validation) and submits via Inertia.
|
|
144
|
+
*/
|
|
145
|
+
export interface FormPanelBlockData {
|
|
146
|
+
/** Submission endpoint URL. */
|
|
147
|
+
action: string;
|
|
148
|
+
/** HTTP method (post | put | patch). */
|
|
149
|
+
method: FormMethod;
|
|
150
|
+
/** Form schema tree — fields, sections, groups, headers. */
|
|
151
|
+
schema: FormSchemaNode[];
|
|
152
|
+
/** Initial field values, keyed by field key. */
|
|
153
|
+
values: Record<string, unknown>;
|
|
154
|
+
/** Server validation errors, keyed by field key. */
|
|
155
|
+
errors: FormErrors;
|
|
156
|
+
/** Submission UX metadata. */
|
|
157
|
+
meta: {
|
|
158
|
+
submitLabel?: string;
|
|
159
|
+
cancelLabel?: string;
|
|
160
|
+
cancelHref?: string;
|
|
161
|
+
multiStep?: boolean;
|
|
162
|
+
validation?: FormValidationMode;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block data contracts — typed data shapes for the ADR-807 block types.
|
|
3
|
+
*
|
|
4
|
+
* Imported by block components for BlockProps<TData> type parameter.
|
|
5
|
+
* These mirror the JSON shapes sent from PHP controllers via Inertia.
|
|
6
|
+
*
|
|
7
|
+
* @see ADR-807 ref/page-contract-v1 §5
|
|
8
|
+
* @see NV-05-ux-blocks.md
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export * from "./actions";
|
|
12
|
+
export * from "./shared";
|
|
13
|
+
export * from "./form";
|
|
14
|
+
export * from "./data-display";
|
|
15
|
+
export * from "./interactive";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive block types — blocks with user interaction beyond read-only display.
|
|
3
|
+
*
|
|
4
|
+
* Community tier: ActionGrid + Tabs. The Pro interactive blocks
|
|
5
|
+
* (SentenceBuilder, ConditionTree, FlowEditor, FormBuilder, KanbanBoard) ship as
|
|
6
|
+
* generated types in @middag-io/react-pro (sourced from Middag\Core\Ui).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { ActionBase } from "./actions";
|
|
10
|
+
|
|
11
|
+
// ── ActionGridBlock ─────────────────────────────────────────────────────────
|
|
12
|
+
|
|
13
|
+
/** A card in the action grid: the canonical Action plus card presentation. */
|
|
14
|
+
export interface ActionGridItem extends ActionBase {
|
|
15
|
+
title: string;
|
|
16
|
+
description: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ActionGridBlockData {
|
|
20
|
+
items: ActionGridItem[];
|
|
21
|
+
flash?: { success: boolean; message: string } | null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// ── TabsBlock ────────────────────────────────────────────────────────────────
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Composite block: organizes inner blocks into tabs. Tab items are the wire
|
|
28
|
+
* `Tab` VO produced by middag-php-ui (`{ id, label, blocks }`); `defaultTab`
|
|
29
|
+
* selects the initially-open tab by `id`.
|
|
30
|
+
*/
|
|
31
|
+
export interface TabsBlockData {
|
|
32
|
+
tabs: import("@/contracts/generated").Tab[];
|
|
33
|
+
defaultTab?: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types used across multiple block data contracts.
|
|
3
|
+
*
|
|
4
|
+
* Contains entity references, form conditions, validation rules,
|
|
5
|
+
* and other primitives that are imported by actions, form, data-display,
|
|
6
|
+
* and interactive modules.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// ── EntityRef (shared by columns and fields that link to navigable entities) ─
|
|
10
|
+
|
|
11
|
+
/** Reference to a navigable entity. Resolved via PageContract.entities map. */
|
|
12
|
+
export interface EntityRef {
|
|
13
|
+
/** Entity type key (matches a key in PageContract.entities). */
|
|
14
|
+
type: string;
|
|
15
|
+
/** Field name in the row/record that contains the entity's ID value. */
|
|
16
|
+
id: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// ── Form conditions & validation ────────────────────────────────────────────
|
|
20
|
+
|
|
21
|
+
// Generated from middag-php-ui (the canonical wire contract). Re-exported here
|
|
22
|
+
// so the public names stay stable; the codegen is the single source of truth.
|
|
23
|
+
export type {
|
|
24
|
+
FormCondition,
|
|
25
|
+
FormFieldDocumentMask,
|
|
26
|
+
FormFieldValidation,
|
|
27
|
+
} from "@/contracts/generated";
|
|
28
|
+
|
|
29
|
+
export interface FormFieldEntityOption {
|
|
30
|
+
value: string;
|
|
31
|
+
label: string;
|
|
32
|
+
subtitle?: string;
|
|
33
|
+
avatarUrl?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ── Empty state (shared by blocks with empty states) ────────────────────────
|
|
37
|
+
|
|
38
|
+
/** Shared empty state configuration used by blocks with empty states. */
|
|
39
|
+
export interface EmptyStateDef {
|
|
40
|
+
icon?: string;
|
|
41
|
+
title?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
cta?: { label: string; href: string };
|
|
44
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connectors VOs — TypeScript mirror of PHP VOs in
|
|
3
|
+
* `classes/extensions/core/connectors/connector/*`.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export type ConnectorStatus =
|
|
7
|
+
| "unconfigured"
|
|
8
|
+
| "configured"
|
|
9
|
+
| "connected"
|
|
10
|
+
| "degraded"
|
|
11
|
+
| "disconnected";
|
|
12
|
+
|
|
13
|
+
export interface CredentialField {
|
|
14
|
+
key: string;
|
|
15
|
+
label: string;
|
|
16
|
+
type: "text" | "password" | "url" | "select";
|
|
17
|
+
required?: boolean;
|
|
18
|
+
placeholder?: string | null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface HealthCheckResult {
|
|
22
|
+
success: boolean;
|
|
23
|
+
latency_ms: number | null;
|
|
24
|
+
error_message: string | null;
|
|
25
|
+
resulting_status: string;
|
|
26
|
+
checked_at: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ConnectorListItem {
|
|
30
|
+
id: number;
|
|
31
|
+
fullname: string;
|
|
32
|
+
connector_type: string;
|
|
33
|
+
extension: string;
|
|
34
|
+
status: ConnectorStatus;
|
|
35
|
+
enabled: boolean;
|
|
36
|
+
last_check_at: number | null;
|
|
37
|
+
latency_ms: number | null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ConnectorDetail {
|
|
41
|
+
id: number;
|
|
42
|
+
fullname: string;
|
|
43
|
+
description: string | null;
|
|
44
|
+
connector_type: string;
|
|
45
|
+
endpoint: string | null;
|
|
46
|
+
extension: string;
|
|
47
|
+
status: ConnectorStatus;
|
|
48
|
+
enabled: boolean;
|
|
49
|
+
created_at: number;
|
|
50
|
+
modified_at: number;
|
|
51
|
+
credential_fields: CredentialField[];
|
|
52
|
+
health_history: HealthCheckResult[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ConnectorTypeInfo {
|
|
56
|
+
type: string;
|
|
57
|
+
name: string;
|
|
58
|
+
extension: string;
|
|
59
|
+
credential_fields: CredentialField[];
|
|
60
|
+
}
|