@middag-io/react 0.44.1 → 0.45.2
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 +7 -0
- package/dist-lib/{FormField-Bj43PjHH.js → FormField-Csx8hGAW.js} +1956 -1936
- package/dist-lib/{FormPanelBlock-C6eDfGoI.js → FormPanelBlock-Bmd0DpiX.js} +337 -337
- package/dist-lib/base/blocks/DenseTableBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/LinkListBlock.d.ts +2 -1
- package/dist-lib/base/blocks/LinkListBlock.d.ts.map +1 -1
- package/dist-lib/base/form/FormField.d.ts.map +1 -1
- package/dist-lib/base/layout/DashboardLayout.d.ts.map +1 -1
- package/dist-lib/base/partials/ConfirmationDialog/index.d.ts.map +1 -1
- package/dist-lib/base/partials/DataTable/cell-renderers.d.ts +1 -1
- package/dist-lib/base/partials/DataTable/cell-renderers.d.ts.map +1 -1
- package/dist-lib/base/partials/DataTable/index.d.ts +1 -1
- package/dist-lib/base/partials/DataTable/index.d.ts.map +1 -1
- package/dist-lib/base/partials/DataTable/sanitize-html.d.ts +17 -0
- package/dist-lib/base/partials/DataTable/sanitize-html.d.ts.map +1 -0
- package/dist-lib/base/partials/DataTable/types.d.ts +15 -0
- package/dist-lib/base/partials/DataTable/types.d.ts.map +1 -1
- package/dist-lib/base/partials/FilterBar/index.d.ts.map +1 -1
- package/dist-lib/base/shell/BasicShell.js +1 -1
- package/dist-lib/base/shell/partials/InlineEditablePanel.js +38 -24
- package/dist-lib/base/shell/partials/PageActionButton.d.ts.map +1 -1
- package/dist-lib/base/shell/partials/PageActionButton.js +1 -1
- package/dist-lib/chunks/subpath-Bh1MAmBT.js +165 -0
- package/dist-lib/chunks/{subpath-AeMdleNB.js → subpath-fEhy6n_U.js} +10 -6
- package/dist-lib/contracts/block-data/data-display.d.ts +51 -2
- package/dist-lib/contracts/block-data/data-display.d.ts.map +1 -1
- package/dist-lib/contracts/generated/contract-schema.d.ts +1 -1
- package/dist-lib/contracts/generated/contract-types.d.ts +4 -2
- package/dist-lib/contracts/generated/contract-types.d.ts.map +1 -1
- package/dist-lib/contracts/generated/index.d.ts +1 -1
- package/dist-lib/i18n/I18nProvider.js +1 -1
- package/dist-lib/i18n/instance.js +1 -1
- package/dist-lib/i18n/locales/en/ui.json +5 -3
- package/dist-lib/i18n/locales/pt-BR/ui.json +5 -3
- package/dist-lib/i18n/register-strings.js +1 -1
- package/dist-lib/index.d.ts +1 -1
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/middag-react.css +1 -1
- package/dist-lib/middag-react.js +18641 -13317
- package/dist-lib/primitives/reui/chart.d.ts.map +1 -1
- package/dist-lib/primitives/reui/chart.js +35 -31
- 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
- package/dist-lib/chunks/subpath-q4Q2zg_p.js +0 -153
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers all built-in icons in the icon registry.
|
|
3
|
+
*
|
|
4
|
+
* Called by registerDefaults(). Merges icons from the former static maps
|
|
5
|
+
* in icons.ts (block/page icons) and SidebarNav.tsx (navigation icons).
|
|
6
|
+
*
|
|
7
|
+
* Consumers can register additional icons via registerIcon() / registerEntityIcon()
|
|
8
|
+
* without modifying this file.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
Activity01Icon,
|
|
13
|
+
AlertCircleIcon,
|
|
14
|
+
ArrowDown01Icon,
|
|
15
|
+
ArrowRight01Icon,
|
|
16
|
+
ArrowUp01Icon,
|
|
17
|
+
Calendar03Icon,
|
|
18
|
+
Cancel01Icon,
|
|
19
|
+
ChartLineData01Icon,
|
|
20
|
+
CheckmarkCircle01Icon,
|
|
21
|
+
CheckmarkSquare01Icon,
|
|
22
|
+
Clock01Icon,
|
|
23
|
+
CloudIcon,
|
|
24
|
+
CodeIcon,
|
|
25
|
+
Copy01Icon,
|
|
26
|
+
DashboardBrowsingIcon,
|
|
27
|
+
Database01Icon,
|
|
28
|
+
Delete02Icon,
|
|
29
|
+
Download01Icon,
|
|
30
|
+
Edit02Icon,
|
|
31
|
+
File01Icon,
|
|
32
|
+
FileExportIcon,
|
|
33
|
+
FilterIcon,
|
|
34
|
+
FolderOpenIcon,
|
|
35
|
+
GitBranchIcon,
|
|
36
|
+
Globe02Icon,
|
|
37
|
+
GraduationScrollIcon,
|
|
38
|
+
HelpCircleIcon,
|
|
39
|
+
Home01Icon,
|
|
40
|
+
InboxIcon,
|
|
41
|
+
LayersLogoIcon,
|
|
42
|
+
Link01Icon,
|
|
43
|
+
LockIcon,
|
|
44
|
+
MailAtSign01Icon,
|
|
45
|
+
Menu01Icon,
|
|
46
|
+
MonitorDotIcon,
|
|
47
|
+
MoreHorizontalIcon,
|
|
48
|
+
Notification03Icon,
|
|
49
|
+
PieChart01Icon,
|
|
50
|
+
Plug01Icon,
|
|
51
|
+
PuzzleIcon,
|
|
52
|
+
RefreshIcon,
|
|
53
|
+
RssIcon,
|
|
54
|
+
Search01Icon,
|
|
55
|
+
Settings01Icon,
|
|
56
|
+
Settings02Icon,
|
|
57
|
+
ShieldKeyIcon,
|
|
58
|
+
ShoppingCart01Icon,
|
|
59
|
+
SquareIcon,
|
|
60
|
+
StarIcon,
|
|
61
|
+
Tag01Icon,
|
|
62
|
+
Target01Icon,
|
|
63
|
+
TerminalIcon,
|
|
64
|
+
Upload01Icon,
|
|
65
|
+
UserGroupIcon,
|
|
66
|
+
UserIcon,
|
|
67
|
+
ViewIcon,
|
|
68
|
+
WorkflowSquare06Icon,
|
|
69
|
+
Wrench01Icon,
|
|
70
|
+
ZapIcon,
|
|
71
|
+
} from "@hugeicons/core-free-icons";
|
|
72
|
+
|
|
73
|
+
import { registerEntityIcon, registerIcon } from "./icon-registry";
|
|
74
|
+
|
|
75
|
+
let registered = false;
|
|
76
|
+
|
|
77
|
+
export function registerDefaultIcons(): void {
|
|
78
|
+
if (registered) return;
|
|
79
|
+
registered = true;
|
|
80
|
+
|
|
81
|
+
// ── General icons (blocks, page header, actions) ──────────────────────────
|
|
82
|
+
registerIcon("inbox", InboxIcon);
|
|
83
|
+
registerIcon("square", SquareIcon);
|
|
84
|
+
registerIcon("arrow-up", ArrowUp01Icon);
|
|
85
|
+
registerIcon("arrow-down", ArrowDown01Icon);
|
|
86
|
+
registerIcon("arrow-right", ArrowRight01Icon);
|
|
87
|
+
registerIcon("check-circle", CheckmarkCircle01Icon);
|
|
88
|
+
registerIcon("check", CheckmarkSquare01Icon);
|
|
89
|
+
registerIcon("circle-x", Cancel01Icon);
|
|
90
|
+
registerIcon("alert-circle", AlertCircleIcon);
|
|
91
|
+
registerIcon("search", Search01Icon);
|
|
92
|
+
registerIcon("menu", Menu01Icon);
|
|
93
|
+
registerIcon("settings", Settings01Icon);
|
|
94
|
+
registerIcon("settings-2", Settings02Icon);
|
|
95
|
+
registerIcon("plug", Plug01Icon);
|
|
96
|
+
registerIcon("filter", FilterIcon);
|
|
97
|
+
registerIcon("layout-dashboard", DashboardBrowsingIcon);
|
|
98
|
+
registerIcon("dashboard", DashboardBrowsingIcon);
|
|
99
|
+
registerIcon("puzzle", PuzzleIcon);
|
|
100
|
+
registerIcon("git-branch", GitBranchIcon);
|
|
101
|
+
registerIcon("shield", ShieldKeyIcon);
|
|
102
|
+
registerIcon("lock", LockIcon);
|
|
103
|
+
registerIcon("users", UserGroupIcon);
|
|
104
|
+
registerIcon("user", UserIcon);
|
|
105
|
+
registerIcon("chart", ChartLineData01Icon);
|
|
106
|
+
registerIcon("calendar", Calendar03Icon);
|
|
107
|
+
registerIcon("mail", MailAtSign01Icon);
|
|
108
|
+
registerIcon("bell", Notification03Icon);
|
|
109
|
+
registerIcon("cloud", CloudIcon);
|
|
110
|
+
registerIcon("link", Link01Icon);
|
|
111
|
+
registerIcon("workflow", WorkflowSquare06Icon);
|
|
112
|
+
registerIcon("database", Database01Icon);
|
|
113
|
+
registerIcon("code", CodeIcon);
|
|
114
|
+
registerIcon("file-export", FileExportIcon);
|
|
115
|
+
registerIcon("tag", Tag01Icon);
|
|
116
|
+
registerIcon("layers", LayersLogoIcon);
|
|
117
|
+
registerIcon("segment", FilterIcon);
|
|
118
|
+
registerIcon("edit", Edit02Icon);
|
|
119
|
+
registerIcon("delete", Delete02Icon);
|
|
120
|
+
registerIcon("trash", Delete02Icon);
|
|
121
|
+
registerIcon("copy", Copy01Icon);
|
|
122
|
+
registerIcon("view", ViewIcon);
|
|
123
|
+
registerIcon("eye", ViewIcon);
|
|
124
|
+
registerIcon("download", Download01Icon);
|
|
125
|
+
registerIcon("upload", Upload01Icon);
|
|
126
|
+
registerIcon("refresh", RefreshIcon);
|
|
127
|
+
registerIcon("clock", Clock01Icon);
|
|
128
|
+
registerIcon("star", StarIcon);
|
|
129
|
+
registerIcon("folder", FolderOpenIcon);
|
|
130
|
+
registerIcon("file", File01Icon);
|
|
131
|
+
registerIcon("globe", Globe02Icon);
|
|
132
|
+
registerIcon("more-horizontal", MoreHorizontalIcon);
|
|
133
|
+
registerIcon("external-link", Globe02Icon);
|
|
134
|
+
registerIcon("sliders-horizontal", FilterIcon);
|
|
135
|
+
|
|
136
|
+
// ── Navigation-specific icons (from SidebarNav) ───────────────────────────
|
|
137
|
+
registerIcon("home", Home01Icon);
|
|
138
|
+
registerIcon("shopping-cart", ShoppingCart01Icon);
|
|
139
|
+
registerIcon("zap", ZapIcon);
|
|
140
|
+
registerIcon("graduation-cap", GraduationScrollIcon);
|
|
141
|
+
registerIcon("wrench", Wrench01Icon);
|
|
142
|
+
registerIcon("terminal", TerminalIcon);
|
|
143
|
+
registerIcon("target", Target01Icon);
|
|
144
|
+
registerIcon("pie-chart", PieChart01Icon);
|
|
145
|
+
registerIcon("activity", Activity01Icon);
|
|
146
|
+
registerIcon("monitor", MonitorDotIcon);
|
|
147
|
+
registerIcon("file-text", File01Icon);
|
|
148
|
+
registerIcon("rss", RssIcon);
|
|
149
|
+
registerIcon("help-circle", HelpCircleIcon);
|
|
150
|
+
|
|
151
|
+
// ── Entity type icons (navigation entity resolution) ──────────────────────
|
|
152
|
+
registerEntityIcon("connector", Plug01Icon);
|
|
153
|
+
registerEntityIcon("workflow", WorkflowSquare06Icon);
|
|
154
|
+
registerEntityIcon("segment", FilterIcon);
|
|
155
|
+
registerEntityIcon("instancegroup", LayersLogoIcon);
|
|
156
|
+
registerEntityIcon("condition", GitBranchIcon);
|
|
157
|
+
registerEntityIcon("compliance", ShieldKeyIcon);
|
|
158
|
+
registerEntityIcon("offering", Tag01Icon);
|
|
159
|
+
registerEntityIcon("order", ShoppingCart01Icon);
|
|
160
|
+
registerEntityIcon("course", GraduationScrollIcon);
|
|
161
|
+
registerEntityIcon("form", File01Icon);
|
|
162
|
+
registerEntityIcon("certificate", FileExportIcon);
|
|
163
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scoped localStorage utilities.
|
|
3
|
+
*
|
|
4
|
+
* All MIDDAG localStorage keys are prefixed with a configurable application key.
|
|
5
|
+
* Default prefix is "middag". Hosts call `setStoragePrefix()` during bootstrap
|
|
6
|
+
* to isolate storage when multiple MIDDAG instances share a domain.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // Moodle bootstrap:
|
|
10
|
+
* setStoragePrefix("middag-moodle");
|
|
11
|
+
*
|
|
12
|
+
* // WordPress bootstrap:
|
|
13
|
+
* setStoragePrefix("middag-wp");
|
|
14
|
+
*
|
|
15
|
+
* // Result: "middag-moodle-appearance", "middag-wp-appearance"
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
let prefix = "middag";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Set the application-scoped localStorage key prefix.
|
|
22
|
+
* Call once during app bootstrap before any storage reads.
|
|
23
|
+
*
|
|
24
|
+
* When not called, defaults to "middag" for backward compatibility.
|
|
25
|
+
*/
|
|
26
|
+
export function setStoragePrefix(newPrefix: string): void {
|
|
27
|
+
prefix = newPrefix;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Get the current storage prefix. */
|
|
31
|
+
export function getStoragePrefix(): string {
|
|
32
|
+
return prefix;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Build a scoped storage key: `{prefix}-{name}`. */
|
|
36
|
+
export function storageKey(name: string): string {
|
|
37
|
+
return `${prefix}-${name}`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Read a value from scoped localStorage. Returns null if unavailable. */
|
|
41
|
+
export function getStorageItem(name: string): string | null {
|
|
42
|
+
try {
|
|
43
|
+
return localStorage.getItem(storageKey(name));
|
|
44
|
+
} catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Write a value to scoped localStorage. Silently fails in SSR/incognito. */
|
|
50
|
+
export function setStorageItem(name: string, value: string): void {
|
|
51
|
+
try {
|
|
52
|
+
localStorage.setItem(storageKey(name), value);
|
|
53
|
+
} catch {
|
|
54
|
+
/* SSR or storage quota exceeded */
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Remove a value from scoped localStorage. */
|
|
59
|
+
export function removeStorageItem(name: string): void {
|
|
60
|
+
try {
|
|
61
|
+
localStorage.removeItem(storageKey(name));
|
|
62
|
+
} catch {
|
|
63
|
+
/* SSR */
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time formatting utilities — locale-aware relative and absolute timestamps.
|
|
3
|
+
*
|
|
4
|
+
* Locale-aware via Intl.RelativeTimeFormat / Intl.DateTimeFormat. Callers pass
|
|
5
|
+
* the active locale (from I18nProvider's `useTranslation().locale`); it defaults
|
|
6
|
+
* to "en" so non-React utilities and tests stay deterministic.
|
|
7
|
+
*
|
|
8
|
+
* formatRelativeTime() keeps the hybrid scale used by timeline/timestamp
|
|
9
|
+
* displays:
|
|
10
|
+
* - < 1 min: "now" / "agora"
|
|
11
|
+
* - < 1h: "N minutes ago" / "há N minutos"
|
|
12
|
+
* - < 24h: time of day (locale short time)
|
|
13
|
+
* - yesterday: "yesterday, <time>"
|
|
14
|
+
* - < 30 days: "<day month>, <time>"
|
|
15
|
+
* - >= 30 days: "<day month year>"
|
|
16
|
+
*
|
|
17
|
+
* @see NV-05-ux-blocks.md §6 (timeline timestamps)
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import type { TimestampFormat } from "@/contracts/block-data";
|
|
21
|
+
|
|
22
|
+
const MINUTE = 60;
|
|
23
|
+
const HOUR = 3600;
|
|
24
|
+
const DAY = 86400;
|
|
25
|
+
|
|
26
|
+
const DEFAULT_LOCALE = "en";
|
|
27
|
+
|
|
28
|
+
function timeOfDay(date: Date, locale: string): string {
|
|
29
|
+
return new Intl.DateTimeFormat(locale, { timeStyle: "short" }).format(date);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function dayMonth(date: Date, locale: string): string {
|
|
33
|
+
return new Intl.DateTimeFormat(locale, { day: "numeric", month: "short" }).format(date);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function dayMonthYear(date: Date, locale: string): string {
|
|
37
|
+
return new Intl.DateTimeFormat(locale, {
|
|
38
|
+
day: "numeric",
|
|
39
|
+
month: "short",
|
|
40
|
+
year: "numeric",
|
|
41
|
+
}).format(date);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Localized relative word: format(0, "second") → "now"/"agora", (-1, "day") → "yesterday"/"ontem". */
|
|
45
|
+
function relativeWord(amount: number, unit: Intl.RelativeTimeFormatUnit, locale: string): string {
|
|
46
|
+
return new Intl.RelativeTimeFormat(locale, { numeric: "auto" }).format(amount, unit);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function isYesterday(date: Date, now: Date): boolean {
|
|
50
|
+
const yesterday = new Date(now);
|
|
51
|
+
yesterday.setDate(yesterday.getDate() - 1);
|
|
52
|
+
return (
|
|
53
|
+
date.getDate() === yesterday.getDate() &&
|
|
54
|
+
date.getMonth() === yesterday.getMonth() &&
|
|
55
|
+
date.getFullYear() === yesterday.getFullYear()
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Format a Unix timestamp (seconds) as relative/absolute text on the hybrid scale.
|
|
61
|
+
*/
|
|
62
|
+
export function formatRelativeTime(timestamp: number, locale: string = DEFAULT_LOCALE): string {
|
|
63
|
+
if (!Number.isFinite(timestamp)) return "";
|
|
64
|
+
const now = Date.now() / 1000;
|
|
65
|
+
const diff = Math.floor(now - timestamp);
|
|
66
|
+
const date = new Date(timestamp * 1000);
|
|
67
|
+
const nowDate = new Date();
|
|
68
|
+
|
|
69
|
+
if (diff < MINUTE) return relativeWord(0, "second", locale);
|
|
70
|
+
if (diff < HOUR) {
|
|
71
|
+
const mins = Math.floor(diff / MINUTE);
|
|
72
|
+
return new Intl.RelativeTimeFormat(locale, { numeric: "always" }).format(-mins, "minute");
|
|
73
|
+
}
|
|
74
|
+
if (diff < DAY) return timeOfDay(date, locale);
|
|
75
|
+
if (isYesterday(date, nowDate)) {
|
|
76
|
+
return `${relativeWord(-1, "day", locale)}, ${timeOfDay(date, locale)}`;
|
|
77
|
+
}
|
|
78
|
+
if (diff < DAY * 30) return `${dayMonth(date, locale)}, ${timeOfDay(date, locale)}`;
|
|
79
|
+
return dayMonthYear(date, locale);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Return ISO 8601 string from a Unix timestamp (seconds).
|
|
84
|
+
* Used as tooltip/title for <time datetime>. Locale-independent.
|
|
85
|
+
*/
|
|
86
|
+
export function formatISO(timestamp: number): string {
|
|
87
|
+
if (!Number.isFinite(timestamp)) return "";
|
|
88
|
+
return new Date(timestamp * 1000).toISOString();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Format a Unix timestamp (seconds) using one of the supported display formats.
|
|
93
|
+
* "relative" delegates to formatRelativeTime; the others are absolute and
|
|
94
|
+
* locale-aware (or ISO for "iso").
|
|
95
|
+
*/
|
|
96
|
+
export function formatTimestamp(
|
|
97
|
+
timestamp: number,
|
|
98
|
+
format: TimestampFormat = "relative",
|
|
99
|
+
locale: string = DEFAULT_LOCALE,
|
|
100
|
+
): string {
|
|
101
|
+
if (!Number.isFinite(timestamp)) return "";
|
|
102
|
+
const date = new Date(timestamp * 1000);
|
|
103
|
+
switch (format) {
|
|
104
|
+
case "iso":
|
|
105
|
+
return date.toISOString();
|
|
106
|
+
case "date":
|
|
107
|
+
return new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(date);
|
|
108
|
+
case "time":
|
|
109
|
+
return new Intl.DateTimeFormat(locale, { timeStyle: "short" }).format(date);
|
|
110
|
+
case "datetime":
|
|
111
|
+
return new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeStyle: "short" }).format(
|
|
112
|
+
date,
|
|
113
|
+
);
|
|
114
|
+
case "relative":
|
|
115
|
+
default:
|
|
116
|
+
return formatRelativeTime(timestamp, locale);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Return a date group label for timeline grouping.
|
|
122
|
+
* "today" / "yesterday" (localized) or "<day month year>".
|
|
123
|
+
*/
|
|
124
|
+
export function formatDateGroupLabel(timestamp: number, locale: string = DEFAULT_LOCALE): string {
|
|
125
|
+
if (!Number.isFinite(timestamp)) return "";
|
|
126
|
+
const date = new Date(timestamp * 1000);
|
|
127
|
+
const now = new Date();
|
|
128
|
+
|
|
129
|
+
if (
|
|
130
|
+
date.getDate() === now.getDate() &&
|
|
131
|
+
date.getMonth() === now.getMonth() &&
|
|
132
|
+
date.getFullYear() === now.getFullYear()
|
|
133
|
+
) {
|
|
134
|
+
return relativeWord(0, "day", locale);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (isYesterday(date, now)) return relativeWord(-1, "day", locale);
|
|
138
|
+
return dayMonthYear(date, locale);
|
|
139
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action hierarchy — canonical OSS shape (middag-php-ui) + Pro overlay.
|
|
3
|
+
*
|
|
4
|
+
* The canonical `Action` VO (id, label, target, intent, confirmation, capability)
|
|
5
|
+
* is generated from php-ui into `@/contracts/generated`. React adds a Pro
|
|
6
|
+
* `display` channel and the row-level conditional fields used by DenseTable.
|
|
7
|
+
*
|
|
8
|
+
* DA-05: `ActionBase` / `ExecutableAction` / `ConditionalAction` are kept as the
|
|
9
|
+
* public names (barrel stability), now expressed in terms of the canonical Action.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { Confirmation, HttpMethod, Action as WireAction } from "@/contracts/generated";
|
|
13
|
+
|
|
14
|
+
import type { FormCondition } from "./shared";
|
|
15
|
+
|
|
16
|
+
// ── Canonical enums (re-exported under the firewall names) ───────────────────
|
|
17
|
+
|
|
18
|
+
/** Semantic intent for action buttons (8 canonical values, php-ui parity). */
|
|
19
|
+
export type { ActionIntent } from "@/contracts/generated";
|
|
20
|
+
|
|
21
|
+
/** HTTP method for action execution (alias of the canonical HttpMethod enum). */
|
|
22
|
+
export type ActionMethod = HttpMethod;
|
|
23
|
+
|
|
24
|
+
// ── Confirmation (canonical + Pro overlay) ───────────────────────────────
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Confirmation dialog shown before executing an action. Canonical `Confirmation`
|
|
28
|
+
* (title/message/variant/labels) plus Pro polling-aware fields.
|
|
29
|
+
*/
|
|
30
|
+
export interface ActionConfirmation extends Confirmation {
|
|
31
|
+
/** Pro semantic accent for the dialog. */
|
|
32
|
+
intent?: "danger" | "warning" | "default";
|
|
33
|
+
/** Keep the dialog open until a polling cycle resolves. */
|
|
34
|
+
waitForPolling?: boolean;
|
|
35
|
+
/** Message shown while waiting for polling. */
|
|
36
|
+
waitingMessage?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// ── Canonical Action ─────────────────────────────────────────────────────
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Canonical action: a discriminated `target` (link | route | request), a
|
|
43
|
+
* semantic `intent`, an i18n-aware `label`, optional confirmation and
|
|
44
|
+
* capability gate. The premium `display` channel is not part of the free
|
|
45
|
+
* Action; it lives on `ProAction` in `@middag-io/react-pro`.
|
|
46
|
+
*/
|
|
47
|
+
export interface Action extends Omit<WireAction, "confirmation"> {
|
|
48
|
+
/** Confirmation dialog (Pro-extended). */
|
|
49
|
+
confirmation?: ActionConfirmation;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Shared base for all action types (DA-05: now the canonical Action). */
|
|
53
|
+
export type ActionBase = Action;
|
|
54
|
+
|
|
55
|
+
/** Executable action (DA-05: the canonical Action carries its own target). */
|
|
56
|
+
export type ExecutableAction = Action;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Conditional action — row-level action with per-row visibility, disabled, and
|
|
60
|
+
* loading state. Used by DenseTable where conditions evaluate against each row.
|
|
61
|
+
*/
|
|
62
|
+
export interface ConditionalAction extends Action {
|
|
63
|
+
/** Row action display variant. */
|
|
64
|
+
variant?: "icon" | "button";
|
|
65
|
+
/** Show this action only when condition is met (evaluated per row). */
|
|
66
|
+
visible_when?: FormCondition;
|
|
67
|
+
/** Disable this action when condition is met (evaluated per row). */
|
|
68
|
+
disabled_when?: FormCondition;
|
|
69
|
+
/** Show loading spinner when condition is met (evaluated per row). */
|
|
70
|
+
loading_when?: FormCondition;
|
|
71
|
+
/** Field name in row data containing a tooltip reason when disabled. */
|
|
72
|
+
disabled_reason_field?: string;
|
|
73
|
+
}
|