@open-mercato/ui 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 +1 -1
- package/AGENTS.md +2 -4
- package/agentic/standalone-guide.md +1 -1
- package/build.mjs +54 -2
- package/dist/ai/AiChat.js +2 -21
- package/dist/ai/AiChat.js.map +2 -2
- package/dist/backend/AppShell.js +4 -43
- package/dist/backend/AppShell.js.map +2 -2
- package/dist/backend/AuthSessionGuard.js +0 -14
- package/dist/backend/AuthSessionGuard.js.map +2 -2
- package/dist/backend/BackendChromeProvider.js +1 -6
- package/dist/backend/BackendChromeProvider.js.map +2 -2
- package/dist/backend/CrudForm.js +4 -6
- package/dist/backend/CrudForm.js.map +2 -2
- package/dist/backend/DataTable.js +18 -20
- package/dist/backend/DataTable.js.map +2 -2
- package/dist/backend/JsonBuilder.js +3 -3
- package/dist/backend/JsonBuilder.js.map +2 -2
- package/dist/backend/NextStepCallout.js +4 -4
- package/dist/backend/NextStepCallout.js.map +1 -1
- package/dist/backend/ProfileDropdown.js +1 -2
- package/dist/backend/ProfileDropdown.js.map +2 -2
- package/dist/backend/RowActions.js +2 -2
- package/dist/backend/RowActions.js.map +2 -2
- package/dist/backend/confirm-dialog/ConfirmDialog.js +1 -13
- package/dist/backend/confirm-dialog/ConfirmDialog.js.map +2 -2
- package/dist/backend/crud/useGroupOrder.js +21 -14
- package/dist/backend/crud/useGroupOrder.js.map +2 -2
- package/dist/backend/detail/AddressTiles.js +5 -4
- package/dist/backend/detail/AddressTiles.js.map +2 -2
- package/dist/backend/detail/AttachmentDeleteDialog.js +1 -1
- package/dist/backend/detail/AttachmentDeleteDialog.js.map +2 -2
- package/dist/backend/detail/AttachmentMetadataDialog.js.map +1 -1
- package/dist/backend/detail/AttachmentsSection.js +1 -1
- package/dist/backend/detail/AttachmentsSection.js.map +2 -2
- package/dist/backend/detail/NotesSection.js +1 -1
- package/dist/backend/detail/NotesSection.js.map +2 -2
- package/dist/backend/detail/TagsSection.js +1 -1
- package/dist/backend/detail/TagsSection.js.map +2 -2
- package/dist/backend/forms/FormHeader.js +2 -1
- package/dist/backend/forms/FormHeader.js.map +2 -2
- package/dist/backend/icons/lucideRegistry.generated.js +25 -1
- package/dist/backend/icons/lucideRegistry.generated.js.map +2 -2
- package/dist/backend/icons/lucideRegistry.js +3 -3
- package/dist/backend/icons/lucideRegistry.js.map +2 -2
- package/dist/backend/injection/spotIds.js +18 -23
- package/dist/backend/injection/spotIds.js.map +2 -2
- package/dist/backend/schedule/ScheduleAgenda.js +3 -3
- package/dist/backend/schedule/ScheduleAgenda.js.map +1 -1
- package/dist/backend/schedule/ScheduleGrid.js +3 -3
- package/dist/backend/schedule/ScheduleGrid.js.map +1 -1
- package/dist/backend/schedule/ScheduleToolbar.js +70 -87
- package/dist/backend/schedule/ScheduleToolbar.js.map +2 -2
- package/dist/backend/sidebar/SidebarCustomizationEditor.js +2 -30
- package/dist/backend/sidebar/SidebarCustomizationEditor.js.map +2 -2
- package/dist/backend/sidebar/customization-helpers.js +0 -30
- package/dist/backend/sidebar/customization-helpers.js.map +2 -2
- package/dist/backend/utils/api.js +13 -3
- package/dist/backend/utils/api.js.map +2 -2
- package/dist/backend/utils/apiCall.js +1 -21
- package/dist/backend/utils/apiCall.js.map +2 -2
- package/dist/backend/utils/customFieldDefs.js.map +2 -2
- package/dist/backend/utils/customFieldForms.js +9 -10
- package/dist/backend/utils/customFieldForms.js.map +2 -2
- package/dist/backend/utils/nav.js +2 -5
- package/dist/backend/utils/nav.js.map +2 -2
- package/dist/frontend/LanguageSwitcher.js +1 -2
- package/dist/frontend/LanguageSwitcher.js.map +2 -2
- package/dist/portal/PortalContext.js +1 -1
- package/dist/portal/PortalContext.js.map +2 -2
- package/dist/portal/hooks/usePortalEventBridge.js +0 -6
- package/dist/portal/hooks/usePortalEventBridge.js.map +2 -2
- package/dist/portal/hooks/usePortalNotifications.js +4 -42
- package/dist/portal/hooks/usePortalNotifications.js.map +2 -2
- package/dist/portal/utils/nav.js +3 -2
- package/dist/portal/utils/nav.js.map +2 -2
- package/dist/primitives/button.js +4 -9
- package/dist/primitives/button.js.map +2 -2
- package/jest.config.cjs +1 -2
- package/package.json +18 -21
- package/src/ai/AiChat.tsx +1 -30
- package/src/ai/__tests__/AiChat.test.tsx +0 -31
- package/src/backend/AppShell.tsx +4 -55
- package/src/backend/AuthSessionGuard.tsx +0 -29
- package/src/backend/BackendChromeProvider.tsx +1 -19
- package/src/backend/CrudForm.tsx +4 -18
- package/src/backend/DataTable.tsx +19 -36
- package/src/backend/JsonBuilder.tsx +3 -3
- package/src/backend/NextStepCallout.tsx +4 -4
- package/src/backend/ProfileDropdown.tsx +0 -1
- package/src/backend/RowActions.tsx +2 -2
- package/src/backend/__tests__/AppShell.test.tsx +7 -65
- package/src/backend/__tests__/AuthSessionGuard.test.tsx +0 -52
- package/src/backend/__tests__/BackendChromeProvider.test.tsx +2 -98
- package/src/backend/__tests__/DataTable.perspectiveStorage.test.ts +1 -62
- package/src/backend/__tests__/nav-utils.test.ts +0 -139
- package/src/backend/confirm-dialog/ConfirmDialog.tsx +1 -16
- package/src/backend/confirm-dialog/__tests__/ConfirmDialog.test.tsx +1 -68
- package/src/backend/crud/__tests__/useGroupOrder.test.ts +1 -39
- package/src/backend/crud/useGroupOrder.ts +25 -30
- package/src/backend/detail/AddressTiles.tsx +6 -3
- package/src/backend/detail/AttachmentDeleteDialog.tsx +1 -1
- package/src/backend/detail/AttachmentMetadataDialog.tsx +1 -1
- package/src/backend/detail/AttachmentsSection.tsx +1 -1
- package/src/backend/detail/NotesSection.tsx +1 -1
- package/src/backend/detail/TagsSection.tsx +1 -1
- package/src/backend/detail/__tests__/AttachmentAssignmentsEditor.test.tsx +0 -21
- package/src/backend/forms/FormHeader.tsx +2 -1
- package/src/backend/icons/lucideRegistry.generated.tsx +37 -3
- package/src/backend/icons/lucideRegistry.ts +2 -2
- package/src/backend/injection/spotIds.ts +18 -23
- package/src/backend/schedule/ScheduleAgenda.tsx +3 -3
- package/src/backend/schedule/ScheduleGrid.tsx +3 -3
- package/src/backend/schedule/ScheduleToolbar.tsx +68 -89
- package/src/backend/sidebar/SidebarCustomizationEditor.tsx +3 -42
- package/src/backend/sidebar/customization-helpers.ts +0 -47
- package/src/backend/utils/__tests__/api.test.ts +27 -0
- package/src/backend/utils/__tests__/apiCall.test.ts +0 -61
- package/src/backend/utils/api.ts +20 -3
- package/src/backend/utils/apiCall.ts +1 -29
- package/src/backend/utils/customFieldDefs.ts +0 -1
- package/src/backend/utils/customFieldForms.ts +11 -15
- package/src/backend/utils/nav.ts +2 -22
- package/src/frontend/LanguageSwitcher.tsx +0 -1
- package/src/portal/PortalContext.tsx +1 -1
- package/src/portal/hooks/usePortalEventBridge.ts +0 -6
- package/src/portal/hooks/usePortalNotifications.ts +12 -55
- package/src/portal/utils/__tests__/nav.test.ts +2 -2
- package/src/portal/utils/nav.ts +4 -3
- package/src/primitives/button.tsx +4 -10
- package/dist/backend/icons/lucideRegistryRuntime.js +0 -28
- package/dist/backend/icons/lucideRegistryRuntime.js.map +0 -7
- package/dist/backend/perspectiveState.js +0 -34
- package/dist/backend/perspectiveState.js.map +0 -7
- package/dist/backend/utils/fetchAllPages.js +0 -57
- package/dist/backend/utils/fetchAllPages.js.map +0 -7
- package/dist/portal/hooks/portalBridgeStatus.js +0 -25
- package/dist/portal/hooks/portalBridgeStatus.js.map +0 -7
- package/figma/alert.figma.tsx +0 -35
- package/figma/badge.figma.tsx +0 -33
- package/figma/button.figma.tsx +0 -33
- package/figma/checkbox.figma.tsx +0 -28
- package/figma/drawer.figma.tsx +0 -40
- package/figma/input-variants.figma.tsx +0 -58
- package/figma/radio.figma.tsx +0 -16
- package/figma/select.figma.tsx +0 -24
- package/figma/status-badge.figma.tsx +0 -24
- package/figma/switch.figma.tsx +0 -28
- package/figma/tabs.figma.tsx +0 -22
- package/figma/tag.figma.tsx +0 -27
- package/figma.config.json +0 -6
- package/scripts/lucideRegistrySource.cjs +0 -133
- package/src/backend/__tests__/CrudForm.fieldsetBinding.test.tsx +0 -158
- package/src/backend/__tests__/CrudForm.groupInjectionColumn.test.tsx +0 -98
- package/src/backend/__tests__/DataTable.metaHiddenLateColumns.test.tsx +0 -105
- package/src/backend/icons/__tests__/lucideRegistryGenerator.test.ts +0 -177
- package/src/backend/icons/lucideRegistryRuntime.tsx +0 -36
- package/src/backend/injection/__tests__/spotIds.extension-points.test.ts +0 -38
- package/src/backend/perspectiveState.ts +0 -44
- package/src/backend/sidebar/__tests__/group-visibility.test.ts +0 -131
- package/src/backend/utils/__tests__/customFieldForms.optionsPaging.test.ts +0 -95
- package/src/backend/utils/__tests__/fetchAllPages.test.ts +0 -103
- package/src/backend/utils/fetchAllPages.ts +0 -93
- package/src/portal/hooks/__tests__/usePortalEventBridge.test.tsx +0 -66
- package/src/portal/hooks/__tests__/usePortalNotifications.test.tsx +0 -155
- package/src/portal/hooks/portalBridgeStatus.ts +0 -29
- package/src/primitives/__tests__/button.test.tsx +0 -70
package/.turbo/turbo-build.log
CHANGED
package/AGENTS.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# UI Package - Agent Guidelines
|
|
2
2
|
|
|
3
|
-
UI defaults
|
|
3
|
+
UI usage patterns based on customers, sales, and staff modules. Use these defaults when building new UI in `packages/ui` or consuming from other modules.
|
|
4
4
|
|
|
5
|
-
>
|
|
5
|
+
> **DS reference:** [`.ai/ds-rules.md`](../../.ai/ds-rules.md) — color tokens, typography, spacing, decision trees. **Component reference (variants/sizes/props/examples/MUST rules):** [`.ai/ui-components.md`](../../.ai/ui-components.md). **Backend component families (charts, filters, detail sections, schedule, messages, page scaffolding):** [`.ai/ui-backend-components.md`](../../.ai/ui-backend-components.md) — check it before building any of these from scratch.
|
|
6
6
|
|
|
7
7
|
## Always
|
|
8
8
|
|
|
@@ -14,7 +14,6 @@ UI defaults for `packages/ui` and its consumers.
|
|
|
14
14
|
- Use i18n keys and `useT()` for user-facing copy.
|
|
15
15
|
- Keep UMES spot IDs, replacement handles, field/group IDs, and portal page metadata stable.
|
|
16
16
|
- Follow `.ai/ds-rules.md` and `.ai/ui-components.md` for tokens, primitives, and component contracts.
|
|
17
|
-
- Keep documented primitive additions/renames and their `figma/*.figma.tsx` mappings in the same PR; run `yarn ds:code-connect:check`.
|
|
18
17
|
|
|
19
18
|
## Ask First
|
|
20
19
|
|
|
@@ -37,7 +36,6 @@ UI defaults for `packages/ui` and its consumers.
|
|
|
37
36
|
```bash
|
|
38
37
|
yarn workspace @open-mercato/ui test
|
|
39
38
|
yarn workspace @open-mercato/ui build
|
|
40
|
-
yarn ds:code-connect:check
|
|
41
39
|
yarn i18n:check
|
|
42
40
|
```
|
|
43
41
|
|
|
@@ -189,7 +189,7 @@ import {
|
|
|
189
189
|
| `usePortalAppEvent(pattern, handler, deps?)` | Listen for portal SSE events by glob pattern (e.g., `'sales.order.*'`) |
|
|
190
190
|
| `usePortalEventBridge()` | Establish singleton SSE connection — mount once in shell/layout |
|
|
191
191
|
| `usePortalInjectedMenuItems(surfaceId)` | Load feature-gated menu items for portal nav surfaces: `{ items, isLoading }` |
|
|
192
|
-
| `usePortalNotifications()` |
|
|
192
|
+
| `usePortalNotifications()` | Poll portal notifications: `{ notifications, unreadCount, hasNew, isLoading, refresh, markAsRead, dismiss, markAllRead }` |
|
|
193
193
|
| `usePortalDashboardWidgets(spotId)` | Load UI injection widgets (with `Widget` component) for a portal spot: `{ widgets, isLoading, error }` |
|
|
194
194
|
|
|
195
195
|
### Portal Components
|
package/build.mjs
CHANGED
|
@@ -3,7 +3,6 @@ import { readFileSync, writeFileSync } from 'node:fs'
|
|
|
3
3
|
import { dirname, join } from 'node:path'
|
|
4
4
|
import { fileURLToPath } from 'node:url'
|
|
5
5
|
import { buildPackage } from '../../scripts/build-package.mjs'
|
|
6
|
-
import { buildLucideRegistrySource } from './scripts/lucideRegistrySource.cjs'
|
|
7
6
|
|
|
8
7
|
const packageDir = dirname(fileURLToPath(import.meta.url))
|
|
9
8
|
|
|
@@ -89,8 +88,61 @@ async function generateLucideRegistry() {
|
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
90
|
|
|
91
|
+
resolved.sort((a, b) => a.kebab.localeCompare(b.kebab))
|
|
92
|
+
const uniqueExports = [...new Set(resolved.map((r) => r.exportName))].sort((a, b) => a.localeCompare(b))
|
|
93
|
+
|
|
94
|
+
const importSection = uniqueExports.length
|
|
95
|
+
? `import {\n${uniqueExports.map((n) => ` ${n},`).join('\n')}\n} from 'lucide-react'\n`
|
|
96
|
+
: ``
|
|
97
|
+
|
|
98
|
+
const registryEntries = resolved.map((r) => ` '${r.kebab}': ${r.exportName},`).join('\n')
|
|
99
|
+
|
|
92
100
|
const outPath = join(packageDir, 'src/backend/icons/lucideRegistry.generated.tsx')
|
|
93
|
-
|
|
101
|
+
const file = `/* eslint-disable */
|
|
102
|
+
// AUTO-GENERATED by @open-mercato/ui build. Do not edit by hand.
|
|
103
|
+
// Generated from discovered icon string usages across the repo.
|
|
104
|
+
|
|
105
|
+
import type * as React from 'react'
|
|
106
|
+
import type { LucideIcon } from 'lucide-react'
|
|
107
|
+
${importSection}
|
|
108
|
+
export const LUCIDE_ICON_REGISTRY: Record<string, LucideIcon> = {
|
|
109
|
+
${registryEntries ? `${registryEntries}\n` : ''}}
|
|
110
|
+
|
|
111
|
+
function normalizeKebabIconName(input: string): string {
|
|
112
|
+
const trimmed = input.trim()
|
|
113
|
+
if (!trimmed) return ''
|
|
114
|
+
const withoutPrefix = trimmed.startsWith('lucide:') ? trimmed.slice('lucide:'.length) : trimmed
|
|
115
|
+
if (!withoutPrefix) return ''
|
|
116
|
+
if (!withoutPrefix.includes('-') && !withoutPrefix.includes('_') && !withoutPrefix.includes(' ') && /[A-Z]/.test(withoutPrefix)) {
|
|
117
|
+
return withoutPrefix
|
|
118
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
119
|
+
.replace(/([A-Z])([A-Z][a-z])/g, '$1-$2')
|
|
120
|
+
.toLowerCase()
|
|
121
|
+
}
|
|
122
|
+
return withoutPrefix
|
|
123
|
+
.replace(/[_\\s]+/g, '-')
|
|
124
|
+
.replace(/-+/g, '-')
|
|
125
|
+
.toLowerCase()
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function resolveRegisteredLucideIcon(name: string | undefined): LucideIcon | null {
|
|
129
|
+
if (!name) return null
|
|
130
|
+
const normalized = normalizeKebabIconName(name)
|
|
131
|
+
if (!normalized) return null
|
|
132
|
+
return (LUCIDE_ICON_REGISTRY as Record<string, LucideIcon | undefined>)[normalized] ?? null
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function resolveRegisteredLucideIconNode(
|
|
136
|
+
name: string | undefined,
|
|
137
|
+
className: string
|
|
138
|
+
): React.ReactNode | null {
|
|
139
|
+
const Icon = resolveRegisteredLucideIcon(name)
|
|
140
|
+
if (!Icon) return null
|
|
141
|
+
return <Icon className={className} />
|
|
142
|
+
}
|
|
143
|
+
`
|
|
144
|
+
|
|
145
|
+
writeFileSync(outPath, file)
|
|
94
146
|
console.log(`Generated lucide registry with ${resolved.length} icons -> ${outPath}`)
|
|
95
147
|
}
|
|
96
148
|
|
package/dist/ai/AiChat.js
CHANGED
|
@@ -127,29 +127,10 @@ function mapErrorCodeToVariant(code) {
|
|
|
127
127
|
const warningCodes = /* @__PURE__ */ new Set([
|
|
128
128
|
"tool_not_whitelisted",
|
|
129
129
|
"tool_features_denied",
|
|
130
|
-
"attachment_type_not_accepted"
|
|
131
|
-
// Content-safety rejections are soft: the user can rephrase and retry.
|
|
132
|
-
"moderation_blocked",
|
|
133
|
-
"moderation_unavailable"
|
|
130
|
+
"attachment_type_not_accepted"
|
|
134
131
|
]);
|
|
135
132
|
return warningCodes.has(code) ? "warning" : "destructive";
|
|
136
133
|
}
|
|
137
|
-
function resolveChatErrorMessage(code, fallback, translate) {
|
|
138
|
-
switch (code) {
|
|
139
|
-
case "moderation_blocked":
|
|
140
|
-
return translate(
|
|
141
|
-
"ai_assistant.errors.moderationBlocked",
|
|
142
|
-
"Your message was blocked by the content safety filter. Please rephrase and try again."
|
|
143
|
-
);
|
|
144
|
-
case "moderation_unavailable":
|
|
145
|
-
return translate(
|
|
146
|
-
"ai_assistant.errors.moderationUnavailable",
|
|
147
|
-
"The content safety check is temporarily unavailable. Please try again in a moment."
|
|
148
|
-
);
|
|
149
|
-
default:
|
|
150
|
-
return fallback;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
134
|
const MARKDOWN_TYPOGRAPHY_CLASS = cn(
|
|
154
135
|
"[&_p]:my-1 [&_p:first-child]:mt-0 [&_p:last-child]:mb-0",
|
|
155
136
|
"[&_ul]:my-2 [&_ol]:my-2 [&_ul]:ml-4 [&_ol]:ml-4 [&_ul]:list-disc [&_ol]:list-decimal",
|
|
@@ -1195,7 +1176,7 @@ function AiChat({
|
|
|
1195
1176
|
/* @__PURE__ */ jsx(AlertTitle, { children: t("ai_assistant.chat.errorTitle", "Agent dispatch failed") }),
|
|
1196
1177
|
/* @__PURE__ */ jsxs(AlertDescription, { children: [
|
|
1197
1178
|
chat.error.code ? /* @__PURE__ */ jsx("span", { className: "mr-2 font-mono text-xs", children: chat.error.code }) : null,
|
|
1198
|
-
|
|
1179
|
+
chat.error.message
|
|
1199
1180
|
] })
|
|
1200
1181
|
] }) : null,
|
|
1201
1182
|
chat.isOwner === false ? /* @__PURE__ */ jsx(
|