@open-mercato/cli 0.6.7-develop.6862.1.c11a64ce0a → 0.6.7
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/.turbo/turbo-build.log +4 -4
- package/build.mjs +7 -24
- package/dist/agentic/claude-code/hooks/entity-migration-check.ts +88 -32
- package/dist/agentic/codex/enforcement-rules.md +16 -2
- package/dist/agentic/cursor/hooks/entity-migration-check.mjs +50 -19
- package/dist/agentic/cursor/rules/entity-guard.mdc +21 -9
- package/dist/agentic/cursor/rules/generated-guard.mdc +5 -3
- package/dist/agentic/cursor/rules/open-mercato.mdc +29 -3
- package/dist/agentic/guides/cache.md +45 -0
- package/dist/agentic/guides/core.md +453 -0
- package/dist/agentic/guides/events.md +117 -0
- package/dist/agentic/guides/module-facts.json +3833 -115419
- package/dist/agentic/guides/module-system.md +127 -12
- package/dist/agentic/guides/modules/ai_assistant.md +28 -227
- package/dist/agentic/guides/modules/api_docs.md +2 -58
- package/dist/agentic/guides/modules/api_keys.md +7 -92
- package/dist/agentic/guides/modules/attachments.md +14 -119
- package/dist/agentic/guides/modules/audit_logs.md +10 -131
- package/dist/agentic/guides/modules/auth.md +33 -276
- package/dist/agentic/guides/modules/business_rules.md +14 -149
- package/dist/agentic/guides/modules/catalog.md +43 -475
- package/dist/agentic/guides/modules/channel_gmail.md +3 -82
- package/dist/agentic/guides/modules/channel_imap.md +3 -82
- package/dist/agentic/guides/modules/checkout.md +27 -299
- package/dist/agentic/guides/modules/communication_channels.md +33 -315
- package/dist/agentic/guides/modules/configs.md +8 -104
- package/dist/agentic/guides/modules/content.md +2 -57
- package/dist/agentic/guides/modules/currencies.md +17 -152
- package/dist/agentic/guides/modules/customer_accounts.md +45 -387
- package/dist/agentic/guides/modules/customers.md +85 -746
- package/dist/agentic/guides/modules/dashboards.md +10 -155
- package/dist/agentic/guides/modules/data_sync.md +16 -149
- package/dist/agentic/guides/modules/dictionaries.md +12 -107
- package/dist/agentic/guides/modules/directory.md +15 -148
- package/dist/agentic/guides/modules/entities.md +13 -145
- package/dist/agentic/guides/modules/events.md +2 -59
- package/dist/agentic/guides/modules/feature_toggles.md +9 -119
- package/dist/agentic/guides/modules/gateway_stripe.md +4 -92
- package/dist/agentic/guides/modules/generators.md +2 -45
- package/dist/agentic/guides/modules/inbox_ops.md +27 -207
- package/dist/agentic/guides/modules/integrations.md +16 -146
- package/dist/agentic/guides/modules/messages.md +24 -223
- package/dist/agentic/guides/modules/notifications.md +8 -96
- package/dist/agentic/guides/modules/onboarding.md +6 -77
- package/dist/agentic/guides/modules/payment_gateways.md +21 -164
- package/dist/agentic/guides/modules/perspectives.md +7 -77
- package/dist/agentic/guides/modules/planner.md +18 -136
- package/dist/agentic/guides/modules/portal.md +2 -93
- package/dist/agentic/guides/modules/progress.md +14 -104
- package/dist/agentic/guides/modules/query_index.md +15 -154
- package/dist/agentic/guides/modules/record_locks.md +21 -206
- package/dist/agentic/guides/modules/resources.md +30 -197
- package/dist/agentic/guides/modules/sales.md +84 -678
- package/dist/agentic/guides/modules/scheduler.md +14 -133
- package/dist/agentic/guides/modules/search.md +6 -170
- package/dist/agentic/guides/modules/security.md +35 -294
- package/dist/agentic/guides/modules/shipping_carriers.md +18 -134
- package/dist/agentic/guides/modules/sso.md +26 -151
- package/dist/agentic/guides/modules/staff.md +57 -369
- package/dist/agentic/guides/modules/storage_s3.md +5 -95
- package/dist/agentic/guides/modules/sync_akeneo.md +3 -85
- package/dist/agentic/guides/modules/sync_excel.md +6 -75
- package/dist/agentic/guides/modules/system_status_overlays.md +2 -60
- package/dist/agentic/guides/modules/translations.md +10 -104
- package/dist/agentic/guides/modules/webhooks.md +24 -203
- package/dist/agentic/guides/modules/wms.md +46 -441
- package/dist/agentic/guides/modules/workflows.md +43 -302
- package/dist/agentic/guides/queue.md +53 -0
- package/dist/agentic/guides/search.md +115 -0
- package/dist/agentic/guides/shared.md +108 -0
- package/dist/agentic/guides/ui.md +347 -0
- package/dist/agentic/shared/AGENTS.md.template +311 -124
- package/dist/agentic/shared/ai/agentic.config.json +0 -2
- package/dist/agentic/shared/ai/lessons.md +3 -26
- package/dist/agentic/shared/ai/skills/om-auto-continue-pr-loop/SKILL.md +27 -0
- package/dist/agentic/shared/ai/skills/om-auto-create-pr-loop/SKILL.md +27 -0
- package/dist/agentic/shared/ai/skills/om-auto-review-pr/SKILL.md +0 -4
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/SKILL.md +241 -20
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/ui-components.md +260 -0
- package/dist/agentic/shared/ai/skills/om-data-model-design/SKILL.md +601 -16
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/mikro-orm-cheatsheet.md +146 -0
- package/dist/agentic/shared/ai/skills/om-eject-and-customize/SKILL.md +310 -14
- package/dist/agentic/shared/ai/skills/om-help/SKILL.md +97 -15
- package/dist/agentic/shared/ai/skills/om-help/references/skills-catalog.md +84 -0
- package/dist/agentic/shared/ai/skills/om-help/references/workflow-sequences.md +193 -0
- package/dist/agentic/shared/ai/skills/om-implement-spec/SKILL.md +152 -33
- package/dist/agentic/shared/ai/skills/om-integration-builder/SKILL.md +708 -24
- package/dist/agentic/shared/ai/skills/om-integration-builder/STANDALONE.md +34 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/adapter-contracts.md +762 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/SKILL.md +820 -20
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/naming-conventions.md +50 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/navigation-patterns.md +97 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/SKILL.md +843 -19
- package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-contracts.md +271 -0
- package/dist/agentic/shared/ai/skills/om-trim-unused-modules/SKILL.md +63 -15
- package/dist/agentic/shared/ai/skills/om-troubleshooter/SKILL.md +467 -16
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnostic-commands.md +101 -0
- package/dist/agentic/shared/ai/skills/tiers.json +21 -143
- package/dist/agentic/shared/ai/skills/tiers.schema.json +40 -52
- package/dist/agentic/shared/ai/specs/README.md +3 -4
- package/dist/agentic/shared/ai/specs/SPEC-000-template.md +10 -226
- package/dist/agentic/shared/ai/trackers/github.md +4 -108
- package/dist/agentic/shared/scripts/install-skills.sh +694 -4
- package/dist/bin.js +1 -13
- package/dist/bin.js.map +2 -2
- package/dist/lib/__integration__/TC-INT-008.spec.js +8 -88
- package/dist/lib/__integration__/TC-INT-008.spec.js.map +2 -2
- package/dist/lib/agentic-init.js +3 -13
- package/dist/lib/agentic-init.js.map +2 -2
- package/dist/lib/agentic-setup.js +186 -418
- package/dist/lib/agentic-setup.js.map +2 -2
- package/dist/lib/generators/extensions/injection-widgets.js +0 -20
- package/dist/lib/generators/extensions/injection-widgets.js.map +2 -2
- package/dist/lib/generators/module-facts-discovery.js +7 -41
- package/dist/lib/generators/module-facts-discovery.js.map +2 -2
- package/dist/lib/generators/module-facts.js +45 -1387
- package/dist/lib/generators/module-facts.js.map +3 -3
- package/dist/lib/generators/module-registry.js +5 -11
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/dist/lib/resolver.js +0 -2
- package/dist/lib/resolver.js.map +2 -2
- package/dist/lib/testing/integration.js +0 -5
- package/dist/lib/testing/integration.js.map +2 -2
- package/dist/mercato.js +1 -23
- package/dist/mercato.js.map +2 -2
- package/package.json +11 -13
- package/src/bin.ts +1 -33
- package/src/lib/__integration__/TC-INT-008.spec.ts +9 -107
- package/src/lib/__tests__/agentic-init.test.ts +5 -41
- package/src/lib/agentic-init.ts +3 -15
- package/src/lib/agentic-setup.ts +224 -530
- package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +2 -88
- package/src/lib/generators/__tests__/module-facts.customers.fixture.test.ts +0 -1
- package/src/lib/generators/__tests__/module-facts.discovery.test.ts +10 -54
- package/src/lib/generators/__tests__/module-subset.test.ts +0 -18
- package/src/lib/generators/extensions/injection-widgets.ts +0 -51
- package/src/lib/generators/module-facts-discovery.ts +7 -58
- package/src/lib/generators/module-facts.ts +46 -1851
- package/src/lib/generators/module-registry.ts +6 -16
- package/src/lib/resolver.ts +0 -3
- package/src/lib/testing/__tests__/integration.test.ts +0 -4
- package/src/lib/testing/integration.ts +0 -5
- package/src/mercato.ts +1 -26
- package/dist/agentic/guides/ai-workflows.md +0 -76
- package/dist/agentic/guides/architecture.md +0 -107
- package/dist/agentic/guides/backend-ui.md +0 -80
- package/dist/agentic/guides/contracts.md +0 -92
- package/dist/agentic/guides/extensions.md +0 -121
- package/dist/agentic/guides/framework-extension-points.md +0 -36
- package/dist/agentic/guides/integrations.md +0 -81
- package/dist/agentic/guides/modules/design_system.md +0 -102
- package/dist/agentic/guides/spec-delivery.md +0 -22
- package/dist/agentic/guides/testing-debugging.md +0 -80
- package/dist/agentic/guides/upstream/AGENTS.md +0 -298
- package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +0 -316
- package/dist/agentic/guides/upstream/manifest.json +0 -8
- package/dist/agentic/shared/ai/harness/README.md +0 -50
- package/dist/agentic/shared/ai/harness/RELEASE.md +0 -57
- package/dist/agentic/shared/ai/harness/cases.json +0 -13680
- package/dist/agentic/shared/ai/harness/cases.schema.json +0 -133
- package/dist/agentic/shared/ai/harness/fixtures/index.json +0 -49
- package/dist/agentic/shared/ai/harness/fixtures/seeds.json +0 -162
- package/dist/agentic/shared/ai/harness/generated-code-review-policy.md +0 -21
- package/dist/agentic/shared/ai/harness/generated-code-review-response.schema.json +0 -96
- package/dist/agentic/shared/ai/harness/generated-code-review-result.schema.json +0 -172
- package/dist/agentic/shared/ai/harness/release-matrix.json +0 -158
- package/dist/agentic/shared/ai/harness/release-result.schema.json +0 -219
- package/dist/agentic/shared/ai/harness/result.schema.json +0 -76
- package/dist/agentic/shared/ai/harness/routing-response.schema.json +0 -12
- package/dist/agentic/shared/ai/harness/target-validation-result.schema.json +0 -73
- package/dist/agentic/shared/ai/harness/validators.json +0 -78
- package/dist/agentic/shared/ai/harness/writable-ast-oracles.mjs +0 -2121
- package/dist/agentic/shared/ai/harness/writable-behavior-oracles.mjs +0 -1096
- package/dist/agentic/shared/ai/lessons/_template.md +0 -16
- package/dist/agentic/shared/ai/review-checklist.md +0 -36
- package/dist/agentic/shared/ai/skills/om-auto-implement-spec/SKILL.md +0 -21
- package/dist/agentic/shared/ai/skills/om-auto-upgrade-0.6.6-to-0.6.7/SKILL.md +0 -98
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/crud-surfaces.md +0 -16
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/frontend-and-design-system.md +0 -53
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/page-and-navigation.md +0 -13
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/quality-states.md +0 -11
- package/dist/agentic/shared/ai/skills/om-build-workflow/SKILL.md +0 -30
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/activity-contracts.md +0 -12
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/durability-and-progress.md +0 -13
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/workflow-design.md +0 -14
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/SKILL.md +0 -28
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/attachments-and-overrides.md +0 -12
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/module-agents-and-tools.md +0 -22
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/orchestrator-agents.md +0 -12
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/surface-selector.md +0 -19
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/integrity-and-concurrency.md +0 -19
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/migration-workflow.md +0 -13
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/schema-design.md +0 -14
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/sensitive-data.md +0 -10
- package/dist/agentic/shared/ai/skills/om-eject-and-customize/references/decision-and-procedure.md +0 -17
- package/dist/agentic/shared/ai/skills/om-evolve-harness/SKILL.md +0 -29
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-template.md +0 -100
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-workflow.md +0 -16
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/owner-selection.md +0 -17
- package/dist/agentic/shared/ai/skills/om-framework-context/SKILL.md +0 -25
- package/dist/agentic/shared/ai/skills/om-framework-context/references/resolver-procedure.md +0 -11
- package/dist/agentic/shared/ai/skills/om-framework-context/references/skew-and-escalation.md +0 -13
- package/dist/agentic/shared/ai/skills/om-help/references/delivery-workflows.md +0 -18
- package/dist/agentic/shared/ai/skills/om-help/references/task-families.md +0 -20
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/phases-and-gates.md +0 -33
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/planning-and-progress.md +0 -40
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/report-templates.md +0 -27
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/spec-resolution.md +0 -24
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/package-and-activation.md +0 -16
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/provider-families.md +0 -14
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/security-and-reliability.md +0 -15
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/sync-and-files.md +0 -12
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/SKILL.md +0 -34
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/agents/openai.yaml +0 -4
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/agentic-setup.md +0 -11
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/input-normalization.md +0 -31
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/judge-workflow.md +0 -39
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/report-template.md +0 -43
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/rules.md +0 -11
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/api-and-domain.md +0 -19
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/business-one-shot-blueprints.md +0 -172
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/data-and-migrations.md +0 -12
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/discovery-surface-catalog.md +0 -83
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/module-surfaces.md +0 -21
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/planning.md +0 -11
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/runtime-cache-and-queues.md +0 -22
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/verification.md +0 -13
- package/dist/agentic/shared/ai/skills/om-share-this-session/SKILL.md +0 -41
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/agentic-setup.md +0 -19
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/bundle-preparation.md +0 -44
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/consent-and-review.md +0 -39
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/publication.md +0 -20
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/report-templates.md +0 -57
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/rules.md +0 -11
- package/dist/agentic/shared/ai/skills/om-share-this-session/scripts/prepare-share-bundle.mjs +0 -486
- package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-branches.md +0 -18
- package/dist/agentic/shared/ai/skills/om-system-extension/references/mechanism-selector.md +0 -27
- package/dist/agentic/shared/ai/skills/om-system-extension/references/read-write-roundtrip.md +0 -13
- package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +0 -41
- package/dist/agentic/shared/ai/skills/om-system-extension/references/verification.md +0 -11
- package/dist/agentic/shared/ai/skills/om-trim-unused-modules/references/dependency-and-redirect.md +0 -15
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnosis-map.md +0 -16
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/regression-oracles.md +0 -14
- package/dist/agentic/shared/scripts/agent-harness-tool-server.mjs +0 -187
- package/dist/agentic/shared/scripts/check-lessons.mjs +0 -178
- package/dist/agentic/shared/scripts/evaluate-agent-harness.mjs +0 -2958
- package/dist/agentic/shared/scripts/execution-sandbox.mjs +0 -329
- package/dist/agentic/shared/scripts/framework-context.mjs +0 -888
- package/dist/agentic/shared/scripts/install-skills.mjs +0 -1029
- package/dist/agentic/shared/scripts/prepare-agent-harness-fixture.mjs +0 -222
- package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +0 -1774
- package/dist/lib/generators/module-extension-facts.js +0 -1840
- package/dist/lib/generators/module-extension-facts.js.map +0 -7
- package/dist/lib/generators/module-fact-sources.js +0 -70
- package/dist/lib/generators/module-fact-sources.js.map +0 -7
- package/dist/lib/generators/module-override-targets.js +0 -688
- package/dist/lib/generators/module-override-targets.js.map +0 -7
- package/dist/lib/load-env.js +0 -24
- package/dist/lib/load-env.js.map +0 -7
- package/dist/lib/telemetry-init.js +0 -358
- package/dist/lib/telemetry-init.js.map +0 -7
- package/src/lib/__tests__/agentic-setup.ownership.test.ts +0 -386
- package/src/lib/__tests__/injection-widget-id-validation.test.ts +0 -184
- package/src/lib/__tests__/load-env.test.ts +0 -65
- package/src/lib/__tests__/telemetry-init.test.ts +0 -298
- package/src/lib/generators/__tests__/activation-adapter-coverage.test.ts +0 -92
- package/src/lib/generators/__tests__/module-extension-activations.test.ts +0 -762
- package/src/lib/generators/__tests__/module-extension-facts.test.ts +0 -404
- package/src/lib/generators/__tests__/module-facts.extension-hosts.test.ts +0 -108
- package/src/lib/generators/__tests__/module-facts.owned-contracts.test.ts +0 -561
- package/src/lib/generators/__tests__/module-facts.source-links.test.ts +0 -119
- package/src/lib/generators/__tests__/module-override-targets.roundtrip.test.ts +0 -149
- package/src/lib/generators/__tests__/module-override-targets.test.ts +0 -304
- package/src/lib/generators/module-extension-facts.ts +0 -2365
- package/src/lib/generators/module-fact-sources.ts +0 -108
- package/src/lib/generators/module-override-targets.ts +0 -863
- package/src/lib/load-env.ts +0 -30
- package/src/lib/telemetry-init.ts +0 -461
|
@@ -1,30 +1,251 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: om-backend-ui-design
|
|
3
|
-
description:
|
|
3
|
+
description: Design and implement consistent backend/backoffice interfaces using @open-mercato/ui. Use when building admin pages, CRUD interfaces, data tables, forms, detail pages, or any backoffice UI.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Backend UI Design
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Guide for creating consistent, production-grade backend interfaces using the `@open-mercato/ui` component library. All implementations must use existing components for visual and behavioral consistency.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
For complete component API reference, see `references/ui-components.md`. Pair this skill with `.ai/guides/ui.md` when present and with the standalone `AGENTS.md` rules for DataTable hosts, design-system primitives, and backend page conventions.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## Design Principles
|
|
13
13
|
|
|
14
|
-
1.
|
|
15
|
-
2.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
App-owned persisted fields/entities also require `module-data`, contracts, and `om-data-model-design`; a new server API/command path instead requires `module-data`, contracts, and `om-module-scaffold`.
|
|
21
|
-
4. Read `references/quality-states.md` for every UI task: loading/empty/error/success, dialogs/keyboard, accessibility, responsive layout, i18n, hydration, and design tokens.
|
|
22
|
-
5. Run `yarn generate` for pages/navigation/widgets and exercise the API plus UI with self-contained fixtures.
|
|
14
|
+
1. **Consistency First**: Every page should feel like part of the same application.
|
|
15
|
+
2. **Component Reuse**: Never create custom implementations when a shared component exists.
|
|
16
|
+
3. **Data Density**: Admin users need information-rich interfaces. Optimize for scanning.
|
|
17
|
+
4. **Keyboard Navigation**: `Cmd/Ctrl+Enter` for primary actions, `Escape` to cancel.
|
|
18
|
+
5. **Clear Hierarchy**: Page → Section → Content. Use `PageHeader`, `PageBody`, consistent spacing.
|
|
19
|
+
6. **Design System Discipline**: Use semantic status tokens plus shared primitives like `StatusBadge`, `Alert`, `FormField`, `SectionHeader`, `CollapsibleSection`, and `EmptyState`. No hardcoded status colors or arbitrary text sizes.
|
|
23
20
|
|
|
24
|
-
##
|
|
21
|
+
## Required Component Library
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
ALWAYS import from `@open-mercato/ui`.
|
|
24
|
+
|
|
25
|
+
### Core Layout
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { Page, PageHeader, PageBody } from '@open-mercato/ui/backend/Page'
|
|
29
|
+
|
|
30
|
+
<Page>
|
|
31
|
+
<PageHeader>{/* Title, actions, breadcrumbs */}</PageHeader>
|
|
32
|
+
<PageBody>{/* Main content */}</PageBody>
|
|
33
|
+
</Page>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Data Display (Lists)
|
|
37
|
+
|
|
38
|
+
Use `DataTable` for ALL tabular data. Never implement custom tables.
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { DataTable } from '@open-mercato/ui/backend/DataTable'
|
|
42
|
+
import type { FilterDef } from '@open-mercato/ui/backend/FilterBar'
|
|
43
|
+
import { RowActions } from '@open-mercato/ui/backend/RowActions'
|
|
44
|
+
import { TruncatedCell } from '@open-mercato/ui/backend/TruncatedCell'
|
|
45
|
+
import { BooleanIcon, EnumBadge } from '@open-mercato/ui/backend/ValueIcons'
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Column patterns:
|
|
49
|
+
- Text: `TruncatedCell` with `meta.maxWidth`
|
|
50
|
+
- Boolean: `BooleanIcon`
|
|
51
|
+
- Status/enum: `EnumBadge` with severity presets
|
|
52
|
+
- Actions: `RowActions` for context menus
|
|
53
|
+
|
|
54
|
+
### Preferred DataTable Host Pattern
|
|
55
|
+
|
|
56
|
+
For standard CRUD lists, prefer the built-in host pattern instead of manually fetching and shaping rows:
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
<DataTable
|
|
60
|
+
entityId="tickets.ticket"
|
|
61
|
+
apiPath="tickets/tickets"
|
|
62
|
+
extensionTableId="tickets.ticket"
|
|
63
|
+
columns={columns}
|
|
64
|
+
createHref="/backend/tickets/tickets/new"
|
|
65
|
+
emptyState={{
|
|
66
|
+
title: t('tickets.list.empty.title'),
|
|
67
|
+
description: t('tickets.list.empty.description'),
|
|
68
|
+
}}
|
|
69
|
+
/>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Keep `extensionTableId` stable so DataTable injections remain backward-compatible.
|
|
73
|
+
|
|
74
|
+
### DataTable Pagination
|
|
75
|
+
|
|
76
|
+
DataTable MUST be configured with pagination props to display all data correctly. Without these, the table only shows the first page with no way to navigate:
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
<DataTable
|
|
80
|
+
columns={columns}
|
|
81
|
+
data={items}
|
|
82
|
+
page={page}
|
|
83
|
+
pageSize={pageSize}
|
|
84
|
+
totalCount={totalCount}
|
|
85
|
+
onPageChange={setPage}
|
|
86
|
+
/>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
When using a custom API (not `makeCrudRoute`), ensure the list response always returns:
|
|
90
|
+
- `items` — array of records for the current page
|
|
91
|
+
- `totalCount` — total records matching the query (not just the current page)
|
|
92
|
+
- `page` — current page number (1-based)
|
|
93
|
+
- `pageSize` — records per page
|
|
94
|
+
|
|
95
|
+
The default `pageSize` is 25. Keep at or below 100. If you see fewer records than expected, verify your API returns `totalCount` and the DataTable has pagination props wired.
|
|
96
|
+
|
|
97
|
+
### Forms
|
|
98
|
+
|
|
99
|
+
Use `CrudForm` for ALL forms. Never build from scratch.
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
import { CrudForm, type CrudField, type CrudFormGroup } from '@open-mercato/ui/backend/CrudForm'
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Field types: `text`, `textarea`, `number`, `email`, `password`, `select`, `multiselect`, `combobox`, `checkbox`, `switch`, `date`, `datetime`, `custom`.
|
|
106
|
+
|
|
107
|
+
### Form Headers & Footers
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
import { FormHeader, FormFooter, FormActionButtons, ActionsDropdown } from '@open-mercato/ui/backend/forms'
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
- **`FormHeader mode="edit"`** — compact header for CrudForm pages
|
|
114
|
+
- **`FormHeader mode="detail"`** — large header for view/detail pages with entity type label, title, status badge, and Actions dropdown
|
|
115
|
+
- **`FormFooter`** — footer wrapping `FormActionButtons`
|
|
116
|
+
- **`ActionsDropdown`** — groups additional context actions (Convert, Send, Print). Delete is never inside the dropdown.
|
|
117
|
+
|
|
118
|
+
### Dialogs
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@open-mercato/ui/primitives/dialog'
|
|
122
|
+
|
|
123
|
+
// Dialog forms MUST use embedded={true}
|
|
124
|
+
<CrudForm fields={fields} onSubmit={handleSubmit} embedded={true} submitLabel="Save" />
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Detail Pages
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
import { DetailFieldsSection, LoadingMessage, ErrorMessage, TabEmptyState } from '@open-mercato/ui/backend/detail'
|
|
131
|
+
import { NotesSection } from '@open-mercato/ui/backend/detail/NotesSection'
|
|
132
|
+
import { TagsSection } from '@open-mercato/ui/backend/detail/TagsSection'
|
|
133
|
+
import { CustomDataSection } from '@open-mercato/ui/backend/detail/CustomDataSection'
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Notifications
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
import { flash } from '@open-mercato/ui/backend/FlashMessages'
|
|
140
|
+
|
|
141
|
+
flash('Record saved successfully', 'success')
|
|
142
|
+
flash('Failed to save record', 'error')
|
|
143
|
+
flash('This action cannot be undone', 'warning')
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
NEVER use `alert()`, `console.log()`, or custom toast implementations.
|
|
147
|
+
|
|
148
|
+
### Loading & Error States
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
import { Spinner } from '@open-mercato/ui/primitives/spinner'
|
|
152
|
+
import { DataLoader } from '@open-mercato/ui/primitives/DataLoader'
|
|
153
|
+
import { Notice } from '@open-mercato/ui/primitives/Notice'
|
|
154
|
+
import { ErrorNotice } from '@open-mercato/ui/primitives/ErrorNotice'
|
|
155
|
+
import { EmptyState } from '@open-mercato/ui/backend/EmptyState'
|
|
156
|
+
import { LoadingMessage, ErrorMessage } from '@open-mercato/ui/backend/detail'
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Primitives
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
import { Button } from '@open-mercato/ui/primitives/button'
|
|
163
|
+
import { Input } from '@open-mercato/ui/primitives/input'
|
|
164
|
+
import { Label } from '@open-mercato/ui/primitives/label'
|
|
165
|
+
import { Badge } from '@open-mercato/ui/primitives/badge'
|
|
166
|
+
import { Switch } from '@open-mercato/ui/primitives/switch'
|
|
167
|
+
import { SimpleTooltip } from '@open-mercato/ui/primitives/tooltip'
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## API Integration
|
|
171
|
+
|
|
172
|
+
```tsx
|
|
173
|
+
import { apiCall, apiCallOrThrow } from '@open-mercato/ui/backend/utils/apiCall'
|
|
174
|
+
import { createCrud, updateCrud, deleteCrud } from '@open-mercato/ui/backend/utils/crud'
|
|
175
|
+
import { createCrudFormError } from '@open-mercato/ui/backend/utils/serverErrors'
|
|
176
|
+
|
|
177
|
+
const handleCreate = async (values: FormValues) => {
|
|
178
|
+
const result = await createCrud<ResponseType>('module/resource', values)
|
|
179
|
+
if (result.ok) {
|
|
180
|
+
flash('Created successfully', 'success')
|
|
181
|
+
router.push(`/backend/module/${result.result.id}`)
|
|
182
|
+
}
|
|
183
|
+
return result
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Custom Fields Integration
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
import { useCustomFieldDefinitions } from '@open-mercato/ui/backend/utils/customFieldDefs'
|
|
191
|
+
import { buildCustomFieldFormFields } from '@open-mercato/ui/backend/utils/customFieldForms'
|
|
192
|
+
import { buildCustomFieldColumns } from '@open-mercato/ui/backend/utils/customFieldColumns'
|
|
193
|
+
import { collectCustomFieldValues } from '@open-mercato/ui/backend/utils/customFieldValues'
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Implementation Checklist
|
|
197
|
+
|
|
198
|
+
- [ ] Forms use `CrudForm` (not custom)
|
|
199
|
+
- [ ] Tables use `DataTable` (not custom)
|
|
200
|
+
- [ ] Notifications use `flash()` (not alert/toast)
|
|
201
|
+
- [ ] Dialog forms have `embedded={true}`
|
|
202
|
+
- [ ] Keyboard: `Cmd/Ctrl+Enter` (submit), `Escape` (cancel)
|
|
203
|
+
- [ ] Loading states use `LoadingMessage` or `DataLoader`
|
|
204
|
+
- [ ] Error states use `ErrorMessage`, `ErrorNotice`, or `Notice variant="error"`
|
|
205
|
+
- [ ] Empty states use `EmptyState`
|
|
206
|
+
- [ ] Status displays use `StatusBadge` or `EnumBadge`, not hardcoded colors
|
|
207
|
+
- [ ] Standalone inputs use `FormField`; detail sections use `SectionHeader` / `CollapsibleSection` when applicable
|
|
208
|
+
- [ ] Column truncation uses `meta.truncate` and `meta.maxWidth`
|
|
209
|
+
- [ ] Boolean values use `BooleanIcon`
|
|
210
|
+
- [ ] Status/enum values use `EnumBadge`
|
|
211
|
+
- [ ] Row actions use `RowActions` with stable `id` values
|
|
212
|
+
- [ ] API calls use `apiCall`/`apiCallOrThrow` (not raw `fetch`)
|
|
213
|
+
|
|
214
|
+
## Anti-Patterns
|
|
215
|
+
|
|
216
|
+
1. Custom form implementations — use `CrudForm`
|
|
217
|
+
2. Manual table markup — use `DataTable`
|
|
218
|
+
3. Custom toast/notification — use `flash()`
|
|
219
|
+
4. Inline styles — use Tailwind classes
|
|
220
|
+
5. Hardcoded colors or status classes — use theme variables and semantic status tokens
|
|
221
|
+
6. Missing loading states — every async operation needs feedback
|
|
222
|
+
7. Missing error handling — every failure needs messaging
|
|
223
|
+
8. Missing keyboard shortcuts — all dialogs need `Cmd+Enter` and `Escape`
|
|
224
|
+
9. Custom truncation — use `TruncatedCell` with `meta.maxWidth`
|
|
225
|
+
10. Direct `fetch()` — use `apiCall`/`apiCallOrThrow`
|
|
226
|
+
|
|
227
|
+
## Visual Guidelines
|
|
228
|
+
|
|
229
|
+
### Spacing
|
|
230
|
+
- `p-4` for cards, `p-6` for page sections
|
|
231
|
+
- `gap-4` or `gap-6` for flex/grid layouts
|
|
232
|
+
- `space-y-4` or `space-y-6` for vertical rhythm
|
|
233
|
+
|
|
234
|
+
### Colors
|
|
235
|
+
- Use semantic colors from theme (no hardcoded hex)
|
|
236
|
+
- Destructive: `variant="destructive"` on buttons
|
|
237
|
+
- Status badges: `useSeverityPreset()`
|
|
238
|
+
|
|
239
|
+
### Layout Patterns
|
|
240
|
+
- **List pages**: FilterBar + DataTable + Pagination
|
|
241
|
+
- **Detail pages**: Header + Tabs/Sections + Related data
|
|
242
|
+
- **Create/Edit**: Full-page CrudForm or Dialog with embedded CrudForm
|
|
243
|
+
- **Settings**: Grouped sections with inline editing
|
|
244
|
+
|
|
245
|
+
## Page Navigation Metadata
|
|
246
|
+
|
|
247
|
+
Every backend page needs correct `page.meta.ts` for sidebar placement.
|
|
248
|
+
See `.ai/skills/om-module-scaffold/references/navigation-patterns.md` for:
|
|
249
|
+
- Complete field reference (`pageGroup`, `pageOrder`, `pageContext`, `navHidden`)
|
|
250
|
+
- Settings page pattern (`pageContext: 'settings' as const` + `navHidden: true`)
|
|
251
|
+
- Common anti-patterns (missing group, mismatched keys, broken icons)
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# UI Components Reference
|
|
2
|
+
|
|
3
|
+
Complete reference of all available UI components in `@open-mercato/ui`.
|
|
4
|
+
|
|
5
|
+
## Package Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
@open-mercato/ui/
|
|
9
|
+
├── primitives/ # Base UI components (shadcn-style)
|
|
10
|
+
├── backend/ # Full-featured admin components
|
|
11
|
+
├── frontend/ # Public-facing components
|
|
12
|
+
└── theme/ # Theme and provider setup
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## PRIMITIVES (`@open-mercato/ui/primitives/*`)
|
|
16
|
+
|
|
17
|
+
| Component | Import Path | Purpose |
|
|
18
|
+
|-----------|-------------|---------|
|
|
19
|
+
| **Button** | `@open-mercato/ui/primitives/button` | Core button with variants (default, outline, ghost, destructive) |
|
|
20
|
+
| **Input** | `@open-mercato/ui/primitives/input` | Text input field |
|
|
21
|
+
| **Label** | `@open-mercato/ui/primitives/label` | Form label component |
|
|
22
|
+
| **Textarea** | `@open-mercato/ui/primitives/textarea` | Multi-line text input |
|
|
23
|
+
| **Dialog** | `@open-mercato/ui/primitives/dialog` | Modal dialog (Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter) |
|
|
24
|
+
| **Tooltip** | `@open-mercato/ui/primitives/tooltip` | Hover tooltip + `SimpleTooltip` utility component |
|
|
25
|
+
| **Table** | `@open-mercato/ui/primitives/table` | Table structure (Table, TableHeader, TableBody, TableRow, TableHead, TableCell) |
|
|
26
|
+
| **Alert** | `@open-mercato/ui/primitives/alert` | Alert boxes (Alert, AlertTitle, AlertDescription) with variants |
|
|
27
|
+
| **Badge** | `@open-mercato/ui/primitives/badge` | Small badge/tag labels with variants |
|
|
28
|
+
| **Separator** | `@open-mercato/ui/primitives/separator` | Visual divider line |
|
|
29
|
+
| **Switch** | `@open-mercato/ui/primitives/switch` | Toggle switch control |
|
|
30
|
+
| **Spinner** | `@open-mercato/ui/primitives/spinner` | Loading spinner animation |
|
|
31
|
+
| **Notice** | `@open-mercato/ui/primitives/Notice` | Contextual notice/hint with variants (`error`, `info`, `warning`) and optional `compact` mode |
|
|
32
|
+
| **ErrorNotice** | `@open-mercato/ui/primitives/ErrorNotice` | Convenience wrapper around `<Notice variant="error">` with default title/message |
|
|
33
|
+
| **DataLoader** | `@open-mercato/ui/primitives/DataLoader` | Loading state wrapper with spinner and optional skeleton |
|
|
34
|
+
|
|
35
|
+
## BACKEND COMPONENTS (`@open-mercato/ui/backend/*`)
|
|
36
|
+
|
|
37
|
+
### Core Layout & Navigation
|
|
38
|
+
|
|
39
|
+
| Component | Import Path | Purpose | Key Props |
|
|
40
|
+
|-----------|-------------|---------|-----------|
|
|
41
|
+
| **AppShell** | `@open-mercato/ui/backend/AppShell` | Main application shell with sidebar, header, breadcrumbs | `navigation`, `user`, `children` |
|
|
42
|
+
| **Page, PageHeader, PageBody** | `@open-mercato/ui/backend/Page` | Page layout containers | - |
|
|
43
|
+
| **UserMenu** | `@open-mercato/ui/backend/UserMenu` | User profile dropdown with logout | `user`, `onLogout` |
|
|
44
|
+
| **FlashMessages, flash** | `@open-mercato/ui/backend/FlashMessages` | Toast notifications. Use `flash(message, type)` programmatically | Type: 'success' \| 'error' \| 'warning' \| 'info' |
|
|
45
|
+
|
|
46
|
+
### Data Display & Tables
|
|
47
|
+
|
|
48
|
+
| Component | Import Path | Purpose | Key Props |
|
|
49
|
+
|-----------|-------------|---------|-----------|
|
|
50
|
+
| **DataTable** | `@open-mercato/ui/backend/DataTable` | Feature-rich table with sorting, filtering, pagination, export, perspectives | `entityId`, `apiPath`, `extensionTableId`, `columns`, `data`, `page`, `pageSize`, `totalCount`, `onPageChange`, `onRowClick` |
|
|
51
|
+
| **TruncatedCell** | `@open-mercato/ui/backend/TruncatedCell` | Table cell with text truncation and tooltip | `value`, `maxWidth` |
|
|
52
|
+
| **EmptyState** | `@open-mercato/ui/backend/EmptyState` | Empty state placeholder | `title`, `description`, `action`, `icon` |
|
|
53
|
+
| **RowActions** | `@open-mercato/ui/backend/RowActions` | Context menu for row actions | `items: {label, href?, onSelect?, destructive?}[]` |
|
|
54
|
+
| **FilterBar** | `@open-mercato/ui/backend/FilterBar` | Search and filter UI bar | `filters`, `values`, `onApply`, `onClear` |
|
|
55
|
+
| **ValueIcons** | `@open-mercato/ui/backend/ValueIcons` | `BooleanIcon`, `EnumBadge`, `useSeverityPreset()` | - |
|
|
56
|
+
|
|
57
|
+
### Forms
|
|
58
|
+
|
|
59
|
+
| Component | Import Path | Purpose | Key Props |
|
|
60
|
+
|-----------|-------------|---------|-----------|
|
|
61
|
+
| **CrudForm** | `@open-mercato/ui/backend/CrudForm` | Complete CRUD form with field registry, groups, custom fields, validation | `fields`, `groups`, `initialValues`, `onSubmit`, `schema`, `embedded`, `extraActions` |
|
|
62
|
+
| **FormHeader** | `@open-mercato/ui/backend/forms` | Unified page header with `edit` mode (compact, for CrudForm) and `detail` mode (large title, entity type label, status badge, Actions dropdown) | `mode`, `backHref`, `title`, `actions`, `menuActions`, `onDelete`, `statusBadge` |
|
|
63
|
+
| **FormFooter** | `@open-mercato/ui/backend/forms` | Form footer wrapping FormActionButtons with embedded/dialog layout awareness | `actions`, `embedded`, `className` |
|
|
64
|
+
| **FormActionButtons** | `@open-mercato/ui/backend/forms` | Atomic button bar: [extraActions] [Delete] [Cancel] [Save]. Shared by header and footer. | `showDelete`, `onDelete`, `cancelHref`, `submit` |
|
|
65
|
+
| **ActionsDropdown** | `@open-mercato/ui/backend/forms` | Dropdown menu for additional context actions (Convert, Send, Print). Only visible when items are provided. Delete is never inside the dropdown. | `items: ActionItem[]`, `label`, `size` |
|
|
66
|
+
| **JsonBuilder** | `@open-mercato/ui/backend/JsonBuilder` | Interactive JSON editor with "Raw JSON" and "Builder" tabs | `value`, `onChange`, `disabled` |
|
|
67
|
+
| **JsonDisplay** | `@open-mercato/ui/backend/JsonDisplay` | Read-only JSON viewer with expand/collapse | `data`, `title`, `maxInitialDepth`, `showCopy` |
|
|
68
|
+
|
|
69
|
+
### Input Components (`@open-mercato/ui/backend/inputs/*`)
|
|
70
|
+
|
|
71
|
+
Specialized inputs that ship with the framework. For each, the full props table, MUST rules, and anti-patterns live in `.ai/ui-components.md` under the section linked from the component name.
|
|
72
|
+
|
|
73
|
+
| Component | Import Path | Purpose | Key Props |
|
|
74
|
+
|-----------|-------------|---------|-----------|
|
|
75
|
+
| **ComboboxInput** | `@open-mercato/ui/backend/inputs/ComboboxInput` | Single-value typeahead with sync/async suggestions; allows free-form custom values by default | `value`, `onChange`, `suggestions`, `loadSuggestions`, `resolveLabel`, `allowCustomValues` |
|
|
76
|
+
| **TagsInput** | `@open-mercato/ui/backend/inputs/TagsInput` | Multi-value (`string[]`) version of `ComboboxInput` with rich `{ value, label, description }` triples | `value`, `onChange`, `suggestions`, `loadSuggestions`, `selectedOptions`, `resolveLabel` |
|
|
77
|
+
| **LookupSelect** | `@open-mercato/ui/backend/inputs/LookupSelect` | Rich card-list search/select with title/subtitle/icon/badge per row; returns selected id | `value`, `onChange`, `fetchItems`, `options`, `minQuery`, `actionSlot` |
|
|
78
|
+
| **PhoneNumberField** | `@open-mercato/ui/backend/inputs/PhoneNumberField` | Compound country-picker + national-number input matching Figma `Text Input [1.1]` Phone variant. Validates + normalizes on blur, optional duplicate lookup | `value`, `onValueChange`, `onDigitsChange`, `countries`, `defaultCountryIso2`, `onDuplicateLookup` |
|
|
79
|
+
| **EventSelect** | `@open-mercato/ui/backend/inputs/EventSelect` | Strict select for declared platform events, grouped by module. **Mandated by `packages/ui/AGENTS.md`** for event selection | `value`, `onChange`, `categories`, `modules`, `excludeTriggerExcluded`, `size` |
|
|
80
|
+
| **EventPatternInput** | `@open-mercato/ui/backend/inputs/EventPatternInput` | `ComboboxInput` preloaded with declared events that allows wildcard patterns (e.g. `sales.orders.*`) | `value`, `onChange`, `categories`, `modules` |
|
|
81
|
+
| **TimeInput** | `@open-mercato/ui/backend/inputs/TimeInput` | Bare `HH:MM` editor (two `<input type="number">` cells, no popover). Low-level atom — most flows want `TimePicker` | `value`, `onChange`, `minuteStep`, `hourLabel`, `minuteLabel` |
|
|
82
|
+
| **DatePicker** *(@deprecated shim — import from `primitives/date-picker`)* | `@open-mercato/ui/backend/inputs/DatePicker` | Backward-compat re-export of the `DatePicker` primitive. New code MUST import from `@open-mercato/ui/primitives/date-picker`. | — |
|
|
83
|
+
| **DateTimePicker** *(@deprecated shim — use `DatePicker withTime`)* | `@open-mercato/ui/backend/inputs/DateTimePicker` | Thin wrapper that always sets `withTime` on the primitive. New code: `<DatePicker withTime />` | — |
|
|
84
|
+
| **TimePicker** *(@deprecated shim — import from `primitives/time-picker`)* | `@open-mercato/ui/backend/inputs/TimePicker` | Legacy popover-anchored time picker wrapping the new `TimePicker` primitive. New code: `@open-mercato/ui/primitives/time-picker`. | — |
|
|
85
|
+
| **SwitchableMarkdownInput** *(@deprecated — use `RichEditor`)* | `@open-mercato/ui/backend/inputs/SwitchableMarkdownInput` | Markdown ⇄ plain textarea toggle. Kept only for backward compatibility with Markdown-backed surfaces. New rich-text fields MUST use `RichEditor` from `@open-mercato/ui/primitives/rich-editor` (sanitized HTML). | `value`, `onChange`, `isMarkdownEnabled` |
|
|
86
|
+
|
|
87
|
+
### Input Variants (Figma `Text Input [1.1]` — `@open-mercato/ui/primitives/*`)
|
|
88
|
+
|
|
89
|
+
Foundation-level input variants matching Figma type-specific designs. Use these instead of raw `<Input type="email">`, `<Input type="password">`, etc. — they ship correct visual chrome (leading icons, prefix boxes, trailing buttons, brand badges) and i18n-resolved labels.
|
|
90
|
+
|
|
91
|
+
| Component | Import Path | Purpose | Key Props |
|
|
92
|
+
|-----------|-------------|---------|-----------|
|
|
93
|
+
| **EmailInput** | `@open-mercato/ui/primitives/email-input` | `Input` wrapper with leading Mail icon, `type="email"`, `autoComplete="email"` | `value`, `onChange`, `showIcon` |
|
|
94
|
+
| **SearchInput** | `@open-mercato/ui/primitives/search-input` | Leading Search icon + trailing × clear button (when value non-empty). Use for DataTable global filter, command palette, list-view live filter | `value`, `onChange`, `onClear`, `clearable` |
|
|
95
|
+
| **PasswordInput** | `@open-mercato/ui/primitives/password-input` | Leading Lock icon + trailing Eye/EyeOff reveal toggle. Controlled or uncontrolled reveal state | `value`, `onChange`, `revealable`, `revealed`, `onRevealedChange`, `showLockIcon` |
|
|
96
|
+
| **WebsiteInput** | `@open-mercato/ui/primitives/website-input` | Left "https://" prefix box + divider + URL input. `type="url"` | `value`, `onChange`, `prefix`, `showPrefix` |
|
|
97
|
+
| **AmountInput** | `@open-mercato/ui/primitives/amount-input` | Leading currency symbol + numeric input + trailing ISO currency picker (10 markets default) | `value: { amount, currency }`, `onChange`, `currencies`, `showCurrency` |
|
|
98
|
+
| **ButtonInput** | `@open-mercato/ui/primitives/button-input` | Input with optional `leftIcon` + divider + required `trailingAction` slot for interactive button (copy URL, send, regenerate) | `leftIcon`, `trailingAction` (required) |
|
|
99
|
+
| **CardInput** | `@open-mercato/ui/primitives/card-input` | Credit-card-number input with regex-based brand auto-detection (Visa/MC/Amex/Discover/Diners/JCB/UnionPay), format masking, brand badge | `value` (digits-only), `onChange`, `onBrandChange`, `brands` |
|
|
100
|
+
|
|
101
|
+
### Detail Page Components (`@open-mercato/ui/backend/detail/*`)
|
|
102
|
+
|
|
103
|
+
| Component | Import Path | Purpose | Key Props |
|
|
104
|
+
|-----------|-------------|---------|-----------|
|
|
105
|
+
| **DetailFieldsSection** | `@open-mercato/ui/backend/detail/DetailFieldsSection` | Entity field display with inline editing | `fields`, `entity`, `onUpdate` |
|
|
106
|
+
| **InlineTextEditor** | `@open-mercato/ui/backend/detail/InlineEditors` | Click-to-edit text field | `value`, `onSave`, `label` |
|
|
107
|
+
| **InlineMultilineEditor** | `@open-mercato/ui/backend/detail/InlineEditors` | Click-to-edit textarea | `value`, `onSave`, `label` |
|
|
108
|
+
| **InlineSelectEditor** | `@open-mercato/ui/backend/detail/InlineEditors` | Click-to-edit select | `value`, `onSave`, `options`, `label` |
|
|
109
|
+
| **NotesSection** | `@open-mercato/ui/backend/detail/NotesSection` | Notes/comments section with markdown | `notes`, `onAdd`, `onUpdate`, `onDelete` |
|
|
110
|
+
| **TagsSection** | `@open-mercato/ui/backend/detail/TagsSection` | Tag management section | `tags`, `onAdd`, `onRemove`, `suggestions` |
|
|
111
|
+
| **CustomDataSection** | `@open-mercato/ui/backend/detail/CustomDataSection` | Custom fields display | `data`, `fieldDefinitions` |
|
|
112
|
+
| **LoadingMessage** | `@open-mercato/ui/backend/detail` | Loading state with spinner | `message` |
|
|
113
|
+
| **ErrorMessage** | `@open-mercato/ui/backend/detail` | Error alert with action | `title`, `description`, `action` |
|
|
114
|
+
| **TabEmptyState** | `@open-mercato/ui/backend/detail` | Empty state for tabs | `message`, `action` |
|
|
115
|
+
|
|
116
|
+
## BACKEND UTILITIES (`@open-mercato/ui/backend/utils/*`)
|
|
117
|
+
|
|
118
|
+
| Utility | Import Path | Purpose | Key Exports |
|
|
119
|
+
|---------|-------------|---------|-------------|
|
|
120
|
+
| **apiCall** | `@open-mercato/ui/backend/utils/apiCall` | HTTP client with auth | `apiCall`, `apiCallOrThrow`, `readApiResultOrThrow` |
|
|
121
|
+
| **api** | `@open-mercato/ui/backend/utils/api` | Low-level API utils | `apiFetch` |
|
|
122
|
+
| **crud** | `@open-mercato/ui/backend/utils/crud` | CRUD operation helpers | `createCrud`, `updateCrud`, `deleteCrud` |
|
|
123
|
+
| **serverErrors** | `@open-mercato/ui/backend/utils/serverErrors` | Error mapping | `mapCrudServerErrorToFormErrors`, `createCrudFormError`, `raiseCrudError` |
|
|
124
|
+
| **customFieldValues** | `@open-mercato/ui/backend/utils/customFieldValues` | Custom field value helpers | `collectCustomFieldValues`, `normalizeCustomFieldSubmitValue` |
|
|
125
|
+
| **customFieldDefs** | `@open-mercato/ui/backend/utils/customFieldDefs` | Field definition fetching | `useCustomFieldDefinitions` |
|
|
126
|
+
| **customFieldForms** | `@open-mercato/ui/backend/utils/customFieldForms` | Form field generation | `buildCustomFieldFormFields` |
|
|
127
|
+
| **customFieldColumns** | `@open-mercato/ui/backend/utils/customFieldColumns` | Column builders | `buildCustomFieldColumns` |
|
|
128
|
+
| **customFieldFilters** | `@open-mercato/ui/backend/utils/customFieldFilters` | Filter definitions | `useCustomFieldFilters` |
|
|
129
|
+
|
|
130
|
+
## Common Usage Patterns
|
|
131
|
+
|
|
132
|
+
### Flash Messages
|
|
133
|
+
```tsx
|
|
134
|
+
import { flash } from '@open-mercato/ui/backend/FlashMessages'
|
|
135
|
+
|
|
136
|
+
flash('Record saved successfully', 'success')
|
|
137
|
+
flash('Failed to save record', 'error')
|
|
138
|
+
// Types: 'success' | 'error' | 'warning' | 'info'
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### DataTable with Filters
|
|
142
|
+
```tsx
|
|
143
|
+
import { DataTable } from '@open-mercato/ui/backend/DataTable'
|
|
144
|
+
import type { FilterDef, FilterValues } from '@open-mercato/ui/backend/FilterBar'
|
|
145
|
+
|
|
146
|
+
const filters: FilterDef[] = [
|
|
147
|
+
{ id: 'search', type: 'text', label: 'Search', placeholder: 'Search...' },
|
|
148
|
+
{ id: 'status', type: 'select', label: 'Status', options: [...] },
|
|
149
|
+
]
|
|
150
|
+
|
|
151
|
+
<DataTable
|
|
152
|
+
entityId="inventory.item"
|
|
153
|
+
apiPath="inventory/items"
|
|
154
|
+
extensionTableId="inventory.item"
|
|
155
|
+
columns={columns}
|
|
156
|
+
filters={filters}
|
|
157
|
+
filterValues={filterValues}
|
|
158
|
+
onFiltersApply={handleFiltersApply}
|
|
159
|
+
onFiltersClear={handleFiltersClear}
|
|
160
|
+
page={page}
|
|
161
|
+
pageSize={pageSize}
|
|
162
|
+
totalCount={totalCount}
|
|
163
|
+
onPageChange={setPage}
|
|
164
|
+
onRowClick={(row) => router.push(`/items/${row.id}`)}
|
|
165
|
+
/>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### CrudForm
|
|
169
|
+
```tsx
|
|
170
|
+
import { CrudForm, type CrudField, type CrudFormGroup } from '@open-mercato/ui/backend/CrudForm'
|
|
171
|
+
|
|
172
|
+
const fields: CrudField[] = [
|
|
173
|
+
{ id: 'name', label: 'Name', type: 'text', required: true },
|
|
174
|
+
{ id: 'description', label: 'Description', type: 'textarea' },
|
|
175
|
+
{ id: 'status', label: 'Status', type: 'select', options: [...] },
|
|
176
|
+
{ id: 'config', label: 'Config', type: 'custom', component: (props) => <JsonBuilder {...props} /> },
|
|
177
|
+
]
|
|
178
|
+
|
|
179
|
+
const groups: CrudFormGroup[] = [
|
|
180
|
+
{ id: 'basic', title: 'Basic Info', column: 1, fields: ['name', 'description'] },
|
|
181
|
+
{ id: 'settings', title: 'Settings', column: 1, fields: ['status', 'config'] },
|
|
182
|
+
]
|
|
183
|
+
|
|
184
|
+
<CrudForm
|
|
185
|
+
title="Create Item"
|
|
186
|
+
fields={fields}
|
|
187
|
+
groups={groups}
|
|
188
|
+
initialValues={{}}
|
|
189
|
+
onSubmit={handleSubmit}
|
|
190
|
+
submitLabel="Save"
|
|
191
|
+
embedded={true} // For use inside dialogs
|
|
192
|
+
extraActions={<Button onClick={handleDelete}>Delete</Button>}
|
|
193
|
+
/>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Dialog with Form
|
|
197
|
+
```tsx
|
|
198
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@open-mercato/ui/primitives/dialog'
|
|
199
|
+
import { CrudForm } from '@open-mercato/ui/backend/CrudForm'
|
|
200
|
+
|
|
201
|
+
<Dialog open={isOpen} onOpenChange={onClose}>
|
|
202
|
+
<DialogContent className="sm:max-w-2xl [&_.grid]:!grid-cols-1">
|
|
203
|
+
<DialogHeader>
|
|
204
|
+
<DialogTitle>Edit Item</DialogTitle>
|
|
205
|
+
</DialogHeader>
|
|
206
|
+
<CrudForm
|
|
207
|
+
fields={fields}
|
|
208
|
+
groups={groups}
|
|
209
|
+
initialValues={initialValues}
|
|
210
|
+
onSubmit={handleSubmit}
|
|
211
|
+
embedded={true}
|
|
212
|
+
submitLabel="Save"
|
|
213
|
+
/>
|
|
214
|
+
</DialogContent>
|
|
215
|
+
</Dialog>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Detail Page with Inline Editing
|
|
219
|
+
```tsx
|
|
220
|
+
import { DetailFieldsSection, LoadingMessage, ErrorMessage } from '@open-mercato/ui/backend/detail'
|
|
221
|
+
|
|
222
|
+
if (isLoading) return <LoadingMessage message="Loading..." />
|
|
223
|
+
if (error) return <ErrorMessage title="Error" description={error.message} />
|
|
224
|
+
|
|
225
|
+
<DetailFieldsSection
|
|
226
|
+
fields={[
|
|
227
|
+
{ id: 'name', label: 'Name', type: 'text' },
|
|
228
|
+
{ id: 'status', label: 'Status', type: 'select', options: [...] },
|
|
229
|
+
]}
|
|
230
|
+
entity={entity}
|
|
231
|
+
onUpdate={handleUpdate}
|
|
232
|
+
/>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### API Calls
|
|
236
|
+
```tsx
|
|
237
|
+
import { apiCall } from '@open-mercato/ui/backend/utils/apiCall'
|
|
238
|
+
import { createCrud, updateCrud, deleteCrud } from '@open-mercato/ui/backend/utils/crud'
|
|
239
|
+
|
|
240
|
+
// Generic API call
|
|
241
|
+
const result = await apiCall<ResponseType>('/api/endpoint', { method: 'POST', body: JSON.stringify(data) })
|
|
242
|
+
if (result.ok) {
|
|
243
|
+
// result.result contains the parsed JSON response
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// CRUD operations
|
|
247
|
+
const created = await createCrud<ItemType>('module/items', payload)
|
|
248
|
+
const updated = await updateCrud<ItemType>('module/items', id, payload)
|
|
249
|
+
const deleted = await deleteCrud('module/items', id)
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Important Notes
|
|
253
|
+
|
|
254
|
+
1. **Always use `flash()` for notifications** - Don't use `alert()` or custom toast implementations
|
|
255
|
+
2. **Use `CrudForm` for forms** - Provides consistent validation, field rendering, and keyboard shortcuts
|
|
256
|
+
3. **Use `DataTable` for lists** - Includes filtering, sorting, pagination, export, and perspectives
|
|
257
|
+
4. **Keep `extensionTableId` stable** - Injection spots must remain backward-compatible
|
|
258
|
+
5. **Use `JsonBuilder` for JSON editing** - Provides both raw JSON and visual builder modes
|
|
259
|
+
6. **Dialog forms need `embedded={true}`** - And add `[&_.grid]:!grid-cols-1` to DialogContent for single-column layout
|
|
260
|
+
7. **Support Cmd/Ctrl+Enter and Escape** - All dialogs should support these keyboard shortcuts
|