@wildo-ai/saas-frontend-lib 1.1.12 → 1.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/dist/esm/components/data-display/DisplayValueDispatcher.d.ts.map +1 -1
  2. package/dist/esm/components/data-display/DisplayValueDispatcher.js +17 -1
  3. package/dist/esm/components/data-display/DisplayValueDispatcher.js.map +1 -1
  4. package/dist/esm/components/data-display/approval-seal.d.ts +97 -0
  5. package/dist/esm/components/data-display/approval-seal.d.ts.map +1 -0
  6. package/dist/esm/components/data-display/approval-seal.js +208 -0
  7. package/dist/esm/components/data-display/approval-seal.js.map +1 -0
  8. package/dist/esm/components/data-display/external-data-provenance/external-data-provenance.frontend.d.ts.map +1 -1
  9. package/dist/esm/components/data-display/external-data-provenance/external-data-provenance.frontend.js +5 -2
  10. package/dist/esm/components/data-display/external-data-provenance/external-data-provenance.frontend.js.map +1 -1
  11. package/dist/esm/components/data-display/formatters/display-field-file.d.ts.map +1 -1
  12. package/dist/esm/components/data-display/formatters/display-field-file.js +16 -2
  13. package/dist/esm/components/data-display/formatters/display-field-file.js.map +1 -1
  14. package/dist/esm/components/flows-actors/approval.d.ts.map +1 -1
  15. package/dist/esm/components/flows-actors/approval.js +48 -18
  16. package/dist/esm/components/flows-actors/approval.js.map +1 -1
  17. package/dist/esm/components/form/automated/ResourceAutomatedForm.d.ts.map +1 -1
  18. package/dist/esm/components/form/automated/ResourceAutomatedForm.js +20 -1
  19. package/dist/esm/components/form/automated/ResourceAutomatedForm.js.map +1 -1
  20. package/dist/esm/components/form/chromes/FormFieldChrome.js +1 -1
  21. package/dist/esm/components/form/chromes/FormFieldChrome.js.map +1 -1
  22. package/dist/esm/components/form/chromes/field-control-aria.d.ts +8 -1
  23. package/dist/esm/components/form/chromes/field-control-aria.d.ts.map +1 -1
  24. package/dist/esm/components/form/chromes/field-control-aria.js +19 -2
  25. package/dist/esm/components/form/chromes/field-control-aria.js.map +1 -1
  26. package/dist/esm/components/form/validation-errors/validate-field-url.frontend.d.ts +5 -0
  27. package/dist/esm/components/form/validation-errors/validate-field-url.frontend.d.ts.map +1 -1
  28. package/dist/esm/components/form/validation-errors/validate-field-url.frontend.js +6 -2
  29. package/dist/esm/components/form/validation-errors/validate-field-url.frontend.js.map +1 -1
  30. package/dist/esm/components/resources/ResourceCollectionBody_Table.d.ts.map +1 -1
  31. package/dist/esm/components/resources/ResourceCollectionBody_Table.js +8 -1
  32. package/dist/esm/components/resources/ResourceCollectionBody_Table.js.map +1 -1
  33. package/dist/esm/components/resources/ResourceLayout_DangerZone.d.ts.map +1 -1
  34. package/dist/esm/components/resources/ResourceLayout_DangerZone.js +2 -2
  35. package/dist/esm/components/resources/ResourceLayout_DangerZone.js.map +1 -1
  36. package/dist/esm/components/resources/ResourceLayout_RecordSharing.js +2 -2
  37. package/dist/esm/components/resources/ResourceLayout_RecordSharing.js.map +1 -1
  38. package/dist/esm/components/resources/ResourceListItemRenderer.d.ts.map +1 -1
  39. package/dist/esm/components/resources/ResourceListItemRenderer.js +6 -1
  40. package/dist/esm/components/resources/ResourceListItemRenderer.js.map +1 -1
  41. package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.d.ts.map +1 -1
  42. package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.js +5 -1
  43. package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.js.map +1 -1
  44. package/dist/esm/components/resources/skeleton/DisplayLayout.js +2 -2
  45. package/dist/esm/components/resources/skeleton/DisplayLayout.js.map +1 -1
  46. package/dist/esm/components/resources-fields/_presets/resource-reference/ResourceFieldDisplayPreset_ResourceReference_Default.d.ts.map +1 -1
  47. package/dist/esm/components/resources-fields/_presets/resource-reference/ResourceFieldDisplayPreset_ResourceReference_Default.js +71 -16
  48. package/dist/esm/components/resources-fields/_presets/resource-reference/ResourceFieldDisplayPreset_ResourceReference_Default.js.map +1 -1
  49. package/dist/esm/components/sections/surface.d.ts +12 -0
  50. package/dist/esm/components/sections/surface.d.ts.map +1 -1
  51. package/dist/esm/components/sections/surface.js +14 -0
  52. package/dist/esm/components/sections/surface.js.map +1 -1
  53. package/dist/esm/components/views/chart-dashboard/ChartDashboard.d.ts +27 -24
  54. package/dist/esm/components/views/chart-dashboard/ChartDashboard.d.ts.map +1 -1
  55. package/dist/esm/components/views/chart-dashboard/ChartDashboard.js +27 -33
  56. package/dist/esm/components/views/chart-dashboard/ChartDashboard.js.map +1 -1
  57. package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.d.ts +37 -0
  58. package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.d.ts.map +1 -0
  59. package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.js +100 -0
  60. package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.js.map +1 -0
  61. package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.labels.d.ts +3 -0
  62. package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.labels.d.ts.map +1 -0
  63. package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.labels.js +34 -0
  64. package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.labels.js.map +1 -0
  65. package/dist/esm/components/views/chart-dashboard/chart-dashboard-layout.utils.d.ts +47 -0
  66. package/dist/esm/components/views/chart-dashboard/chart-dashboard-layout.utils.d.ts.map +1 -0
  67. package/dist/esm/components/views/chart-dashboard/chart-dashboard-layout.utils.js +94 -0
  68. package/dist/esm/components/views/chart-dashboard/chart-dashboard-layout.utils.js.map +1 -0
  69. package/dist/esm/components/views/chart-dashboard/useChartDashboardLayout.d.ts +39 -0
  70. package/dist/esm/components/views/chart-dashboard/useChartDashboardLayout.d.ts.map +1 -0
  71. package/dist/esm/components/views/chart-dashboard/useChartDashboardLayout.js +155 -0
  72. package/dist/esm/components/views/chart-dashboard/useChartDashboardLayout.js.map +1 -0
  73. package/dist/esm/core/app-shell/shell-motion/shell-motion-origins.d.ts.map +1 -1
  74. package/dist/esm/core/app-shell/shell-motion/shell-motion-origins.js +3 -2
  75. package/dist/esm/core/app-shell/shell-motion/shell-motion-origins.js.map +1 -1
  76. package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.d.ts +15 -0
  77. package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.d.ts.map +1 -1
  78. package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.js +29 -0
  79. package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.js.map +1 -1
  80. package/dist/esm/core/app-shell/shell-motion/use-shell-motion.d.ts.map +1 -1
  81. package/dist/esm/core/app-shell/shell-motion/use-shell-motion.js +2 -2
  82. package/dist/esm/core/app-shell/shell-motion/use-shell-motion.js.map +1 -1
  83. package/dist/esm/core/branding/useBrandPresentation.d.ts.map +1 -1
  84. package/dist/esm/core/branding/useBrandPresentation.js +17 -6
  85. package/dist/esm/core/branding/useBrandPresentation.js.map +1 -1
  86. package/dist/esm/core/components-registry/assert-registry-completeness.frontend.helper.d.ts.map +1 -1
  87. package/dist/esm/core/components-registry/assert-registry-completeness.frontend.helper.js +2 -0
  88. package/dist/esm/core/components-registry/assert-registry-completeness.frontend.helper.js.map +1 -1
  89. package/dist/esm/core/execution/useExecutionResourceOperationContextBuilder.d.ts.map +1 -1
  90. package/dist/esm/core/execution/useExecutionResourceOperationContextBuilder.js +11 -1
  91. package/dist/esm/core/execution/useExecutionResourceOperationContextBuilder.js.map +1 -1
  92. package/dist/esm/core/i18n/I18nContext.d.ts.map +1 -1
  93. package/dist/esm/core/i18n/I18nContext.js +8 -2
  94. package/dist/esm/core/i18n/I18nContext.js.map +1 -1
  95. package/dist/esm/core/i18n/component-label-resolution.utils.d.ts.map +1 -1
  96. package/dist/esm/core/i18n/component-label-resolution.utils.js +6 -1
  97. package/dist/esm/core/i18n/component-label-resolution.utils.js.map +1 -1
  98. package/dist/esm/core/monitoring/analytics/AnalyticsContext.d.ts +0 -15
  99. package/dist/esm/core/monitoring/analytics/AnalyticsContext.d.ts.map +1 -1
  100. package/dist/esm/core/monitoring/analytics/AnalyticsContext.js +71 -6
  101. package/dist/esm/core/monitoring/analytics/AnalyticsContext.js.map +1 -1
  102. package/dist/esm/core/monitoring/analytics/AnalyticsEventBridge.d.ts.map +1 -1
  103. package/dist/esm/core/monitoring/analytics/AnalyticsEventBridge.js +12 -3
  104. package/dist/esm/core/monitoring/analytics/AnalyticsEventBridge.js.map +1 -1
  105. package/dist/esm/core/navigation/NavigationContext.d.ts.map +1 -1
  106. package/dist/esm/core/navigation/NavigationContext.js +60 -17
  107. package/dist/esm/core/navigation/NavigationContext.js.map +1 -1
  108. package/dist/esm/core/navigation/launcher-resolution.d.ts +29 -0
  109. package/dist/esm/core/navigation/launcher-resolution.d.ts.map +1 -1
  110. package/dist/esm/core/navigation/launcher-resolution.js +31 -0
  111. package/dist/esm/core/navigation/launcher-resolution.js.map +1 -1
  112. package/dist/esm/core/navigation/navigation-controller-internals.d.ts +48 -0
  113. package/dist/esm/core/navigation/navigation-controller-internals.d.ts.map +1 -1
  114. package/dist/esm/core/navigation/navigation-controller-internals.js +56 -3
  115. package/dist/esm/core/navigation/navigation-controller-internals.js.map +1 -1
  116. package/dist/esm/core/navigation/useNavigationRouterSync.d.ts.map +1 -1
  117. package/dist/esm/core/navigation/useNavigationRouterSync.js +30 -2
  118. package/dist/esm/core/navigation/useNavigationRouterSync.js.map +1 -1
  119. package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.d.ts +34 -1
  120. package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.d.ts.map +1 -1
  121. package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.js +41 -0
  122. package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.js.map +1 -1
  123. package/dist/esm/core/resources/route-parent-relocation.frontend.utils.d.ts +44 -0
  124. package/dist/esm/core/resources/route-parent-relocation.frontend.utils.d.ts.map +1 -0
  125. package/dist/esm/core/resources/route-parent-relocation.frontend.utils.js +63 -0
  126. package/dist/esm/core/resources/route-parent-relocation.frontend.utils.js.map +1 -0
  127. package/dist/esm/core/resources/useOperationDirectExecution.d.ts.map +1 -1
  128. package/dist/esm/core/resources/useOperationDirectExecution.js +45 -6
  129. package/dist/esm/core/resources/useOperationDirectExecution.js.map +1 -1
  130. package/dist/esm/core/runtime/AppRouter.d.ts.map +1 -1
  131. package/dist/esm/core/runtime/AppRouter.js +18 -1
  132. package/dist/esm/core/runtime/AppRouter.js.map +1 -1
  133. package/dist/esm/core/security/UserOrgsContext.d.ts.map +1 -1
  134. package/dist/esm/core/security/UserOrgsContext.js +61 -8
  135. package/dist/esm/core/security/UserOrgsContext.js.map +1 -1
  136. package/dist/esm/core/ui/inner-control-activation.utils.d.ts +16 -0
  137. package/dist/esm/core/ui/inner-control-activation.utils.d.ts.map +1 -0
  138. package/dist/esm/core/ui/inner-control-activation.utils.js +44 -0
  139. package/dist/esm/core/ui/inner-control-activation.utils.js.map +1 -0
  140. package/dist/esm/index.d.ts +4 -0
  141. package/dist/esm/index.d.ts.map +1 -1
  142. package/dist/esm/index.js +4 -0
  143. package/dist/esm/index.js.map +1 -1
  144. package/dist/tsconfig.build.tsbuildinfo +1 -1
  145. package/package.json +8 -8
@@ -95,7 +95,7 @@ function FormFieldChrome({ mode, label, description, error, required, labelPlace
95
95
  // Wrap children with autosave indicator. On a bulk update form the control carries the explicit "clear on every selected
96
96
  // record" choice (#2620), here so every chrome mode gets it from one place. The renderers that draw no chrome carry it
97
97
  // themselves: a list on its section path (AutomatedArrayField), an object, a record and a map (FormField).
98
- const wrappedChildren = wrapWithAutosaveIndicator(_jsx(FieldControlAriaProvider, { invalid: !!error, describedBy: [showDescription ? descriptionId : undefined, showError ? errorId : undefined], children: _jsx(BulkFieldClearSlot, { fieldName: fieldName, label: label, disabled: disabled, onSaveFieldNow: onSaveFieldNow, children: children }) }), { saveState, saveErrorMessage, onRetrySave, variant: autosaveVariant });
98
+ const wrappedChildren = wrapWithAutosaveIndicator(_jsx(FieldControlAriaProvider, { invalid: !!error, describedBy: [showDescription ? descriptionId : undefined, showError ? errorId : undefined], labelId: showLabel || hiddenLabel ? labelId : undefined, children: _jsx(BulkFieldClearSlot, { fieldName: fieldName, label: label, disabled: disabled, onSaveFieldNow: onSaveFieldNow, children: children }) }), { saveState, saveErrorMessage, onRetrySave, variant: autosaveVariant });
99
99
  // ── HIDDEN mode: pass through ──
100
100
  if (effectiveMode === EditChromeMode.HIDDEN) {
101
101
  return _jsxs(_Fragment, { children: [hiddenLabel, wrappedChildren] });
@@ -1 +1 @@
1
- {"version":3,"file":"FormFieldChrome.js","sourceRoot":"","sources":["../../../../../src/components/form/chromes/FormFieldChrome.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAA;AACnD,OAAO,EACL,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,UAAU,EACV,yBAAyB,GAC1B,MAAM,mDAAmD,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,0DAA0D,CAAA;AAElH,OAAO,EAAE,yBAAyB,EAAE,MAAM,wEAAwE,CAAA;AAElH,OAAO,EACL,cAAc,EAEd,kBAAkB,GACnB,MAAM,0BAA0B,CAAA;AA2CjC,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AAChF,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,+DAA+D,CAAA;AAC/G,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAA2B,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S,CAAC,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,yBACpC,SAAS,kBAChB,CAAC,CAAC,KAAK,IAAI,SAAS,mBACnB,QAAQ,IAAI,SAAS,EACpC,SAAS,EAAE,SAAS,aAEnB,WAAW,EACX,SAAS,IAAI,CACZ,MAAC,UAAU,IAAC,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,aACtC,KAAK,EACL,QAAQ,IAAI,eAAM,SAAS,EAAC,yBAAyB,iBAAa,MAAM,kBAAS,EACjF,OAAO,IAAI,KAAC,WAAW,IAAC,IAAI,EAAE,OAAO,GAAI,IAC/B,CACd,EACA,eAAe,EACf,eAAe,IAAI,KAAC,gBAAgB,IAAC,EAAE,EAAE,aAAa,YAAG,WAAW,GAAoB,EACxF,SAAS,IAAI,KAAC,UAAU,IAAC,EAAE,EAAE,OAAO,YAAG,KAAK,GAAc,IACrD,CACT,CAAC;AACJ,CAAC;AAED,CAAC;AAAC,eAAoE,CAAC,WAAW,GAAG,iBAAiB,CAAA;AAEtG,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,CAAA","sourcesContent":["\"use client\"\n\n/**\n * FormFieldChrome — centralized chrome (label, description, error, required indicator)\n * wrapper for form fields.\n *\n * Mirrors the display system pattern: FormField dispatches to a preset,\n * the preset returns bare interactive content, and FormFieldChrome wraps it\n * with the appropriate chrome layout.\n *\n * Chrome mode is resolved via a two-phase cascade:\n * Phase 1 (FormField): field decorator → section default → form default → surface policy → STACKED\n * Phase 2 (here): responsive viewport resolution via useUI()\n *\n * ## data-field safety net\n *\n * Every visible chrome mode renders `data-field={fieldName}` on its outer\n * wrapper element. This guarantees that `scrollToFirstError` (which queries\n * `[data-field=\"...\"]`) can always locate the DOM node for a field,\n * regardless of whether the inner control also emits the attribute.\n * Individual controls may still set `data-field` on their own root — that's\n * fine; the chrome's attribute serves as an outer fallback.\n */\n\nimport { FieldControlAriaProvider } from './field-control-aria';\nimport * as React from \"react\"\nimport { useMemo } from \"react\"\n\nimport { cn } from \"~wildo-frontend-lib/core/ui/cn\"\nimport {\n Field,\n FieldLabel,\n FieldDescription,\n FieldError,\n FieldContent,\n FieldTitle,\n FieldVariants_Orientation,\n} from \"~wildo-frontend-lib/components/form/chromes/field\"\nimport { Tooltip, TooltipTrigger, TooltipContent } from \"~wildo-frontend-lib/components/overlays/floating/tooltip\"\nimport { type WrapWithAutosaveIndicatorOptions } from \"~wildo-frontend-lib/components/form/automated/autosave-indicator\"\nimport { wrapWithAutosaveIndicator } from \"~wildo-frontend-lib/components/form/automated/autosave-indicator.utils\"\nimport { AutosaveFieldState } from '~wildo-frontend-lib/components/form/form-field-types'\nimport {\n EditChromeMode,\n type ResponsiveChromeMode,\n ViewportBreakpoint,\n} from \"@wildo-ai/zod-decorators\"\nimport type { ReactNode } from 'react'\n\nexport interface FormFieldChromeProps {\n mode?: ResponsiveChromeMode\n label?: string\n description?: string\n error?: string\n required?: boolean\n /** `'hidden'` keeps the label as an `sr-only` `<label>`, so the control is still named for assistive technology. */\n labelPlacement?: AutoLabelPlacement\n /** Drops the label everywhere, so the control has no accessible name of its own. See `FormField`'s `hideLabel` (#3079). */\n hideLabel?: boolean\n hideDescription?: boolean\n hideError?: boolean\n saveState?: AutosaveFieldState\n saveErrorMessage?: string\n onRetrySave?: () => void\n /**\n * Saves this field at once, given for a field that AUTOSAVES (only its caller knows the field's own autosave trigger).\n * A bulk update form's explicit clear (#2620) uses it so the clear is written as the field's other changes are; absent,\n * the clear waits for the form's save.\n */\n onSaveFieldNow?: (value: unknown) => void\n fieldName?: string\n disabled?: boolean\n tooltip?: string\n /**\n * The control is intrinsically wide/tall (file drop zone, image preview, …)\n * and cannot fit the SETTINGS_ROW fixed inline-end column (`w-72`). When the\n * EFFECTIVE mode resolves to SETTINGS_ROW, the row keeps its settings-list\n * shell (the `px-card` inset, `py-card-sm` rhythm, hairline divider, hover\n * affordance and `data-chrome-mode=\"settings_row\"` list identity) but stacks\n * the control FULL-WIDTH beneath the label instead of pinning it inline-end —\n * so the field stays a member of the flush, divided settings list rather than\n * dropping out as a misaligned bare STACKED block (the old behavior, which\n * lost the row inset and broke the list's flush stacking). Inert for every\n * other mode (a STACKED/mobile-collapsed field is already full-width).\n */\n wideControl?: boolean\n className?: string\n children: ReactNode\n}\nimport { useIconRegistry } from \"~wildo-frontend-lib/core/icons/useIconRegistry\"\nimport { StandardIconReference, IconSize } from \"~wildo-frontend-lib/core/icons/icon-registry.frontend.schemas\"\nimport { useI18n } from \"~wildo-frontend-lib/core/i18n/useI18n\"\nimport { FrontendComponentType, ButtonSize, type AutoLabelPlacement } from \"@wildo-ai/presets-components-models\"\nimport { useUI } from \"~wildo-frontend-lib/core/ui/useUI\"\nimport { Button, ButtonVariants_Variant } from \"~wildo-frontend-lib/components/actions/button\"\nimport { BulkFieldClearSlot } from \"~wildo-frontend-lib/components/form/automated/bulk-field-clear-context\"\n\n\n// =============================================================================\n// VIEWPORT-AWARE MODE RESOLUTION\n// =============================================================================\n\nfunction resolveEffectiveChromeMode(\n chromeMode: ResponsiveChromeMode | undefined,\n currentBreakpoint: ViewportBreakpoint,\n isMobile: boolean,\n): EditChromeMode {\n if (chromeMode === undefined || chromeMode === null) {\n return EditChromeMode.STACKED;\n }\n\n // Simple string value — typeof narrows to a single EditChromeMode literal.\n //\n // SETTINGS_ROW is NOT collapsed to STACKED on mobile any more: the row lays its control out\n // beneath the label instead (see the SETTINGS_ROW branch). Switching MODE on a breakpoint swapped\n // the chrome's root element (`<div>` ↔ `<Field>`), which remounted the control and discarded its\n // local state — a pending avatar crop vanished when the window crossed 768px (#1191). `isMobile`\n // stays a parameter because the responsive mapping below is still keyed by breakpoint.\n if (typeof chromeMode === \"string\") {\n void isMobile;\n return chromeMode;\n }\n\n // Responsive mapping: { [breakpoint]: mode }\n return (\n chromeMode[currentBreakpoint] ??\n chromeMode[ViewportBreakpoint.DESKTOP] ??\n EditChromeMode.STACKED\n );\n}\n\n// =============================================================================\n// TOOLTIP ICON HELPER\n// =============================================================================\n\nfunction TooltipIcon({ text }: { text: string }): React.JSX.Element | null {\n const { renderIcon } = useIconRegistry();\n const { tComponent, isReady } = useI18n({\n component: FrontendComponentType.LOW_LEVEL_FORM_FIELD,\n });\n if (!isReady) return null;\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n type=\"button\"\n variant={ButtonVariants_Variant.GHOST}\n size={ButtonSize.ICON_SM}\n className=\"ms-1 rounded-full\"\n aria-label={tComponent(FrontendComponentType.LOW_LEVEL_FORM_FIELD, 'moreInformation')}\n tabIndex={-1}\n >\n {renderIcon(StandardIconReference.INFO, { size: IconSize.XS })}\n </Button>\n </TooltipTrigger>\n <TooltipContent>{text}</TooltipContent>\n </Tooltip>\n );\n}\n\n// =============================================================================\n// COMPONENT\n// =============================================================================\n\nfunction FormFieldChrome({\n mode,\n label,\n description,\n error,\n required,\n labelPlacement,\n hideLabel,\n hideDescription,\n hideError,\n saveState,\n saveErrorMessage,\n onRetrySave,\n onSaveFieldNow,\n fieldName,\n disabled,\n tooltip,\n wideControl,\n className,\n children,\n}: FormFieldChromeProps): React.JSX.Element {\n const { currentBreakpoint, isMobile } = useUI();\n\n const effectiveMode = useMemo(\n () => resolveEffectiveChromeMode(mode, currentBreakpoint, isMobile),\n [mode, currentBreakpoint, isMobile],\n );\n\n // Deterministic IDs for aria-describedby linkage and label-input association\n const fieldId = fieldName ? `field-${fieldName}` : undefined;\n const descriptionId = fieldName ? `field-${fieldName}-description` : undefined;\n const errorId = fieldName ? `field-${fieldName}-error` : undefined;\n // Lets a control that renders a GROUP of inputs (an address) name the group by this label.\n const labelId = fieldName ? `field-${fieldName}-label` : undefined;\n\n // Determine what to show based on mode + overrides\n const effectiveLabelPlacement = labelPlacement ?? (effectiveMode === EditChromeMode.INLINE ? 'inline' : 'top');\n const showLabel = !hideLabel && !!label && effectiveLabelPlacement !== 'hidden' && effectiveMode !== EditChromeMode.COMPACT && effectiveMode !== EditChromeMode.HIDDEN;\n const showDescription = !hideDescription && !!description && effectiveMode !== EditChromeMode.COMPACT && effectiveMode !== EditChromeMode.HIDDEN;\n const showError = !hideError && !!error && effectiveMode !== EditChromeMode.HIDDEN;\n const hiddenLabel = !hideLabel && !!label && effectiveLabelPlacement === 'hidden'\n ? <FieldLabel id={labelId} htmlFor={fieldId} className=\"sr-only\">{label}</FieldLabel>\n : null;\n\n // Determine autosave indicator variant based on chrome mode\n const autosaveVariant: WrapWithAutosaveIndicatorOptions[\"variant\"] =\n effectiveLabelPlacement === 'start' || effectiveLabelPlacement === 'inline' ? \"inline\" : \"block\";\n\n // Wrap children with autosave indicator. On a bulk update form the control carries the explicit \"clear on every selected\n // record\" choice (#2620), here so every chrome mode gets it from one place. The renderers that draw no chrome carry it\n // themselves: a list on its section path (AutomatedArrayField), an object, a record and a map (FormField).\n const wrappedChildren = wrapWithAutosaveIndicator(\n <FieldControlAriaProvider invalid={!!error} describedBy={[showDescription ? descriptionId : undefined, showError ? errorId : undefined]}>\n <BulkFieldClearSlot fieldName={fieldName} label={label} disabled={disabled} onSaveFieldNow={onSaveFieldNow}>{children}</BulkFieldClearSlot>\n </FieldControlAriaProvider>,\n { saveState, saveErrorMessage, onRetrySave, variant: autosaveVariant },\n );\n\n // ── HIDDEN mode: pass through ──\n if (effectiveMode === EditChromeMode.HIDDEN) {\n return <>{hiddenLabel}{wrappedChildren}</>;\n }\n\n // ── COMPACT mode: control + error only ──\n if (effectiveMode === EditChromeMode.COMPACT) {\n return (\n <div data-slot=\"field-chrome\" data-chrome-mode=\"compact\" data-label-placement={effectiveLabelPlacement} data-field={fieldName} data-testid={fieldName ? `field-${fieldName}` : undefined} data-guidance-field={fieldName} data-disabled={disabled || undefined} className={className}>\n {hiddenLabel}\n {wrappedChildren}\n {showError && <FieldError id={errorId}>{error}</FieldError>}\n </div>\n );\n }\n\n // ── Horizontal label modes ──\n if (effectiveLabelPlacement === 'start' || effectiveLabelPlacement === 'inline') {\n const labelContent = (\n <FieldContent>\n {showLabel && (\n <FieldTitle>\n <FieldLabel id={labelId} htmlFor={fieldId}>\n {label}\n {required && <span className=\"text-destructive ms-0.5\" aria-hidden=\"true\">*</span>}\n {tooltip && <TooltipIcon text={tooltip} />}\n </FieldLabel>\n </FieldTitle>\n )}\n {showDescription && <FieldDescription id={descriptionId}>{description}</FieldDescription>}\n {showError && <FieldError id={errorId}>{error}</FieldError>}\n </FieldContent>\n );\n\n return (\n <Field\n orientation={FieldVariants_Orientation.HORIZONTAL}\n data-slot=\"field-chrome\"\n data-chrome-mode=\"inline\"\n data-label-placement={effectiveLabelPlacement}\n data-field={fieldName}\n data-testid={fieldName ? `field-${fieldName}` : undefined}\n data-guidance-field={fieldName}\n data-invalid={!!error || undefined}\n data-disabled={disabled || undefined}\n className={className}\n >\n {effectiveLabelPlacement === 'start' && labelContent}\n {wrappedChildren}\n {effectiveLabelPlacement === 'inline' && labelContent}\n </Field>\n );\n }\n\n // ── RELAXED mode: generous spacing, heading-size label ──\n if (effectiveMode === EditChromeMode.RELAXED) {\n return (\n <div\n data-slot=\"field-chrome\"\n data-chrome-mode=\"relaxed\"\n data-label-placement={effectiveLabelPlacement}\n data-field={fieldName}\n data-testid={fieldName ? `field-${fieldName}` : undefined}\n data-guidance-field={fieldName}\n data-invalid={!!error || undefined}\n data-disabled={disabled || undefined}\n className={cn(\"flex flex-col gap-field\", className)}\n >\n {hiddenLabel}\n {showLabel && (\n <label\n id={labelId}\n htmlFor={fieldId}\n className={cn(\n \"text-lg font-semibold leading-snug\",\n disabled && \"opacity-[var(--opacity-disabled)]\",\n )}\n >\n {label}\n {required && <span className=\"text-destructive ms-1\" aria-hidden=\"true\">*</span>}\n {tooltip && <TooltipIcon text={tooltip} />}\n </label>\n )}\n {showDescription && (\n <p id={descriptionId} className=\"text-base text-muted-foreground leading-normal -mt-1\">\n {description}\n </p>\n )}\n <div className=\"py-1\">\n {wrappedChildren}\n </div>\n {showError && (\n <div id={errorId} role=\"alert\" className=\"text-base text-destructive font-normal\">\n {error}\n </div>\n )}\n </div>\n );\n }\n\n // ── SETTINGS_ROW mode: a self-contained settings list-item ──\n // Label/description inline-start, control/error inline-end. The row owns ALL\n // of its own structure so a stack of settings rows forms a clean, uniform,\n // divided list in ANY host — the generated flat template (`FormLayout` /\n // `DisplayLayout` render fields in a bare `<div>` with NO inter-field gap), an\n // authored `CARD` section, etc. — for both edit and display:\n // - `py-card-sm` gives every row the same compact vertical rhythm regardless\n // of its content height (fixes the \"rows collide\" symptom on generated\n // templates, which previously relied on a non-existent container gap).\n // - `border-b … last:border-b-0` is the hairline row divider — the signature\n // of the settings-list pattern (Cursor / Claude). `last:` suppresses the\n // trailing divider when the row is the final child (display lists); under a\n // form the trailing divider sits above the host-owned submit row, which is\n // the desired \"list ↔ actions\" separation.\n // - the control is a FIXED-width, inline-end-pinned column (replaces the old\n // ragged inline `min/max-width` box that made every control a different\n // width). `items-end` right-pins intrinsic controls (switch / checkbox /\n // button); `w-full` controls (input / select / textarea) fill the column,\n // so every control shares one inline-end edge.\n // `items-start` top-aligns the control with the label's first line (the title),\n // letting the description flow beneath on the inline-start side.\n if (effectiveMode === EditChromeMode.SETTINGS_ROW) {\n // STACKED layout: same settings-list row shell + identity, but the control\n // spans the row's full width beneath the label instead of the fixed\n // inline-end column. Two causes: an intrinsically wide control (`wideControl`,\n // e.g. a file drop zone) and a MOBILE viewport, where the row has no\n // horizontal room. `data-chrome-mode=\"settings_row\"` stays, so every\n // list-level rule (flush stacking at the layout roots, CARD-body\n // `gap-0`/full-bleed/re-inset) still treats it as a settings row;\n // `data-settings-row-layout` names the layout for diagnostics/tests.\n //\n // ONE element structure for both layouts, on purpose: root > [label column,\n // control column]. Only classes change between them, so a breakpoint crossing\n // re-lays the row out without remounting the control. Returning a different\n // tree per layout (or collapsing to the STACKED mode's `<Field>`) is what\n // discarded a pending avatar crop on resize (#1191).\n const stacksControl = !!wideControl || isMobile;\n return (\n <div\n data-slot=\"field-chrome\"\n data-chrome-mode=\"settings_row\"\n data-settings-row-layout={wideControl ? \"wide\" : isMobile ? \"stacked\" : undefined}\n data-label-placement={effectiveLabelPlacement}\n data-field={fieldName}\n data-testid={fieldName ? `field-${fieldName}` : undefined}\n data-guidance-field={fieldName}\n data-invalid={!!error || undefined}\n data-disabled={disabled || undefined}\n className={cn(\n // Row rhythm (T4): compact min-height + a subtle hover affordance,\n // matching the read-mode DisplayFieldChrome SETTINGS_ROW twin so a\n // view→edit drill keeps identical geometry. Vertical alignment is\n // CONTENT-AWARE: single-line rows CENTER (no dead space below the label);\n // rows with a description top-align so the control lines up with the\n // label's first line and the description flows beneath. A row hosting a\n // MULTI-LINE control (`textarea` — e.g. a bio field) also top-aligns:\n // centering a one-line label against a tall input strands the label\n // mid-row; the label must sit level with the control's first text line.\n // Extend the `has-[…]:items-start` list when another intrinsically tall\n // control family joins settings rows. The row OWNS its\n // inline padding (`px-card`) so its `border-b` runs full-bleed to the\n // padding-less CARD body edge (and gives consistent inset in a flat\n // host); block padding stays tight (`py-card-sm`).\n \"flex min-h-10 px-card py-card-sm border-b border-border last:border-b-0 hover:bg-muted/50 transition-colors\",\n stacksControl\n ? \"flex-col gap-element-xs\"\n : cn(\"flex-row gap-section\", showDescription ? \"items-start\" : \"items-center has-[textarea]:items-start\"),\n className,\n )}\n >\n {/* Inline-start side (above the control when stacked): label + description */}\n <div className={cn(\"flex min-w-0 flex-col gap-element-xs\", !stacksControl && \"flex-1\")}>\n {hiddenLabel}\n {showLabel && (\n <label\n id={labelId}\n htmlFor={fieldId}\n className={cn(\n \"text-sm font-medium leading-snug\",\n disabled && \"opacity-[var(--opacity-disabled)]\",\n )}\n >\n {label}\n {required && <span className=\"text-destructive ms-0.5\" aria-hidden=\"true\">*</span>}\n {tooltip && <TooltipIcon text={tooltip} />}\n </label>\n )}\n {showDescription && (\n <FieldDescription id={descriptionId}>{description}</FieldDescription>\n )}\n </div>\n\n {/* Inline-end side: right-pinned control + error column. `w-72` is the\n SHARED TARGET width (one inline-end edge across rows), but the column\n must stay shrinkable (`shrink` + `min-w-0`, NOT `shrink-0`): inside a\n padded CARD fieldset the row's available inline size can drop below\n label + gap + 18rem, and a non-shrinkable column overflows the\n fieldset and CLIPS against its border (the \"label cut at the card\n edge\" defect). With shrink enabled the row can never outgrow its\n container — the label and control columns compress instead. When\n stacked, the column spans the row instead. */}\n <div\n className={cn(\n \"flex min-w-0 flex-col gap-element-xs\",\n stacksControl ? \"w-full\" : \"w-72 max-w-[55%] shrink items-end\",\n )}\n >\n {wrappedChildren}\n {showError && <FieldError id={errorId}>{error}</FieldError>}\n </div>\n </div>\n );\n }\n\n // ── STACKED mode (default): label above, control, description + error below ──\n return (\n <Field\n orientation={FieldVariants_Orientation.VERTICAL}\n data-slot=\"field-chrome\"\n data-chrome-mode=\"stacked\"\n data-label-placement={effectiveLabelPlacement}\n data-field={fieldName}\n data-testid={fieldName ? `field-${fieldName}` : undefined}\n data-guidance-field={fieldName}\n data-invalid={!!error || undefined}\n data-disabled={disabled || undefined}\n className={className}\n >\n {hiddenLabel}\n {showLabel && (\n <FieldLabel id={labelId} htmlFor={fieldId}>\n {label}\n {required && <span className=\"text-destructive ms-0.5\" aria-hidden=\"true\">*</span>}\n {tooltip && <TooltipIcon text={tooltip} />}\n </FieldLabel>\n )}\n {wrappedChildren}\n {showDescription && <FieldDescription id={descriptionId}>{description}</FieldDescription>}\n {showError && <FieldError id={errorId}>{error}</FieldError>}\n </Field>\n );\n}\n\n;(FormFieldChrome as typeof FormFieldChrome & { displayName: string }).displayName = \"FormFieldChrome\"\n\nexport { FormFieldChrome, resolveEffectiveChromeMode }\n"]}
1
+ {"version":3,"file":"FormFieldChrome.js","sourceRoot":"","sources":["../../../../../src/components/form/chromes/FormFieldChrome.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE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,IACrD,CACT,CAAC;AACJ,CAAC;AAED,CAAC;AAAC,eAAoE,CAAC,WAAW,GAAG,iBAAiB,CAAA;AAEtG,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,CAAA","sourcesContent":["\"use client\"\n\n/**\n * FormFieldChrome — centralized chrome (label, description, error, required indicator)\n * wrapper for form fields.\n *\n * Mirrors the display system pattern: FormField dispatches to a preset,\n * the preset returns bare interactive content, and FormFieldChrome wraps it\n * with the appropriate chrome layout.\n *\n * Chrome mode is resolved via a two-phase cascade:\n * Phase 1 (FormField): field decorator → section default → form default → surface policy → STACKED\n * Phase 2 (here): responsive viewport resolution via useUI()\n *\n * ## data-field safety net\n *\n * Every visible chrome mode renders `data-field={fieldName}` on its outer\n * wrapper element. This guarantees that `scrollToFirstError` (which queries\n * `[data-field=\"...\"]`) can always locate the DOM node for a field,\n * regardless of whether the inner control also emits the attribute.\n * Individual controls may still set `data-field` on their own root — that's\n * fine; the chrome's attribute serves as an outer fallback.\n */\n\nimport { FieldControlAriaProvider } from './field-control-aria';\nimport * as React from \"react\"\nimport { useMemo } from \"react\"\n\nimport { cn } from \"~wildo-frontend-lib/core/ui/cn\"\nimport {\n Field,\n FieldLabel,\n FieldDescription,\n FieldError,\n FieldContent,\n FieldTitle,\n FieldVariants_Orientation,\n} from \"~wildo-frontend-lib/components/form/chromes/field\"\nimport { Tooltip, TooltipTrigger, TooltipContent } from \"~wildo-frontend-lib/components/overlays/floating/tooltip\"\nimport { type WrapWithAutosaveIndicatorOptions } from \"~wildo-frontend-lib/components/form/automated/autosave-indicator\"\nimport { wrapWithAutosaveIndicator } from \"~wildo-frontend-lib/components/form/automated/autosave-indicator.utils\"\nimport { AutosaveFieldState } from '~wildo-frontend-lib/components/form/form-field-types'\nimport {\n EditChromeMode,\n type ResponsiveChromeMode,\n ViewportBreakpoint,\n} from \"@wildo-ai/zod-decorators\"\nimport type { ReactNode } from 'react'\n\nexport interface FormFieldChromeProps {\n mode?: ResponsiveChromeMode\n label?: string\n description?: string\n error?: string\n required?: boolean\n /** `'hidden'` keeps the label as an `sr-only` `<label>`, so the control is still named for assistive technology. */\n labelPlacement?: AutoLabelPlacement\n /** Drops the label everywhere, so the control has no accessible name of its own. See `FormField`'s `hideLabel` (#3079). */\n hideLabel?: boolean\n hideDescription?: boolean\n hideError?: boolean\n saveState?: AutosaveFieldState\n saveErrorMessage?: string\n onRetrySave?: () => void\n /**\n * Saves this field at once, given for a field that AUTOSAVES (only its caller knows the field's own autosave trigger).\n * A bulk update form's explicit clear (#2620) uses it so the clear is written as the field's other changes are; absent,\n * the clear waits for the form's save.\n */\n onSaveFieldNow?: (value: unknown) => void\n fieldName?: string\n disabled?: boolean\n tooltip?: string\n /**\n * The control is intrinsically wide/tall (file drop zone, image preview, …)\n * and cannot fit the SETTINGS_ROW fixed inline-end column (`w-72`). When the\n * EFFECTIVE mode resolves to SETTINGS_ROW, the row keeps its settings-list\n * shell (the `px-card` inset, `py-card-sm` rhythm, hairline divider, hover\n * affordance and `data-chrome-mode=\"settings_row\"` list identity) but stacks\n * the control FULL-WIDTH beneath the label instead of pinning it inline-end —\n * so the field stays a member of the flush, divided settings list rather than\n * dropping out as a misaligned bare STACKED block (the old behavior, which\n * lost the row inset and broke the list's flush stacking). Inert for every\n * other mode (a STACKED/mobile-collapsed field is already full-width).\n */\n wideControl?: boolean\n className?: string\n children: ReactNode\n}\nimport { useIconRegistry } from \"~wildo-frontend-lib/core/icons/useIconRegistry\"\nimport { StandardIconReference, IconSize } from \"~wildo-frontend-lib/core/icons/icon-registry.frontend.schemas\"\nimport { useI18n } from \"~wildo-frontend-lib/core/i18n/useI18n\"\nimport { FrontendComponentType, ButtonSize, type AutoLabelPlacement } from \"@wildo-ai/presets-components-models\"\nimport { useUI } from \"~wildo-frontend-lib/core/ui/useUI\"\nimport { Button, ButtonVariants_Variant } from \"~wildo-frontend-lib/components/actions/button\"\nimport { BulkFieldClearSlot } from \"~wildo-frontend-lib/components/form/automated/bulk-field-clear-context\"\n\n\n// =============================================================================\n// VIEWPORT-AWARE MODE RESOLUTION\n// =============================================================================\n\nfunction resolveEffectiveChromeMode(\n chromeMode: ResponsiveChromeMode | undefined,\n currentBreakpoint: ViewportBreakpoint,\n isMobile: boolean,\n): EditChromeMode {\n if (chromeMode === undefined || chromeMode === null) {\n return EditChromeMode.STACKED;\n }\n\n // Simple string value — typeof narrows to a single EditChromeMode literal.\n //\n // SETTINGS_ROW is NOT collapsed to STACKED on mobile any more: the row lays its control out\n // beneath the label instead (see the SETTINGS_ROW branch). Switching MODE on a breakpoint swapped\n // the chrome's root element (`<div>` ↔ `<Field>`), which remounted the control and discarded its\n // local state — a pending avatar crop vanished when the window crossed 768px (#1191). `isMobile`\n // stays a parameter because the responsive mapping below is still keyed by breakpoint.\n if (typeof chromeMode === \"string\") {\n void isMobile;\n return chromeMode;\n }\n\n // Responsive mapping: { [breakpoint]: mode }\n return (\n chromeMode[currentBreakpoint] ??\n chromeMode[ViewportBreakpoint.DESKTOP] ??\n EditChromeMode.STACKED\n );\n}\n\n// =============================================================================\n// TOOLTIP ICON HELPER\n// =============================================================================\n\nfunction TooltipIcon({ text }: { text: string }): React.JSX.Element | null {\n const { renderIcon } = useIconRegistry();\n const { tComponent, isReady } = useI18n({\n component: FrontendComponentType.LOW_LEVEL_FORM_FIELD,\n });\n if (!isReady) return null;\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n type=\"button\"\n variant={ButtonVariants_Variant.GHOST}\n size={ButtonSize.ICON_SM}\n className=\"ms-1 rounded-full\"\n aria-label={tComponent(FrontendComponentType.LOW_LEVEL_FORM_FIELD, 'moreInformation')}\n tabIndex={-1}\n >\n {renderIcon(StandardIconReference.INFO, { size: IconSize.XS })}\n </Button>\n </TooltipTrigger>\n <TooltipContent>{text}</TooltipContent>\n </Tooltip>\n );\n}\n\n// =============================================================================\n// COMPONENT\n// =============================================================================\n\nfunction FormFieldChrome({\n mode,\n label,\n description,\n error,\n required,\n labelPlacement,\n hideLabel,\n hideDescription,\n hideError,\n saveState,\n saveErrorMessage,\n onRetrySave,\n onSaveFieldNow,\n fieldName,\n disabled,\n tooltip,\n wideControl,\n className,\n children,\n}: FormFieldChromeProps): React.JSX.Element {\n const { currentBreakpoint, isMobile } = useUI();\n\n const effectiveMode = useMemo(\n () => resolveEffectiveChromeMode(mode, currentBreakpoint, isMobile),\n [mode, currentBreakpoint, isMobile],\n );\n\n // Deterministic IDs for aria-describedby linkage and label-input association\n const fieldId = fieldName ? `field-${fieldName}` : undefined;\n const descriptionId = fieldName ? `field-${fieldName}-description` : undefined;\n const errorId = fieldName ? `field-${fieldName}-error` : undefined;\n // Lets a control that renders a GROUP of inputs (an address) name the group by this label.\n const labelId = fieldName ? `field-${fieldName}-label` : undefined;\n\n // Determine what to show based on mode + overrides\n const effectiveLabelPlacement = labelPlacement ?? (effectiveMode === EditChromeMode.INLINE ? 'inline' : 'top');\n const showLabel = !hideLabel && !!label && effectiveLabelPlacement !== 'hidden' && effectiveMode !== EditChromeMode.COMPACT && effectiveMode !== EditChromeMode.HIDDEN;\n const showDescription = !hideDescription && !!description && effectiveMode !== EditChromeMode.COMPACT && effectiveMode !== EditChromeMode.HIDDEN;\n const showError = !hideError && !!error && effectiveMode !== EditChromeMode.HIDDEN;\n const hiddenLabel = !hideLabel && !!label && effectiveLabelPlacement === 'hidden'\n ? <FieldLabel id={labelId} htmlFor={fieldId} className=\"sr-only\">{label}</FieldLabel>\n : null;\n\n // Determine autosave indicator variant based on chrome mode\n const autosaveVariant: WrapWithAutosaveIndicatorOptions[\"variant\"] =\n effectiveLabelPlacement === 'start' || effectiveLabelPlacement === 'inline' ? \"inline\" : \"block\";\n\n // Wrap children with autosave indicator. On a bulk update form the control carries the explicit \"clear on every selected\n // record\" choice (#2620), here so every chrome mode gets it from one place. The renderers that draw no chrome carry it\n // themselves: a list on its section path (AutomatedArrayField), an object, a record and a map (FormField).\n const wrappedChildren = wrapWithAutosaveIndicator(\n <FieldControlAriaProvider invalid={!!error} describedBy={[showDescription ? descriptionId : undefined, showError ? errorId : undefined]} labelId={showLabel || hiddenLabel ? labelId : undefined}>\n <BulkFieldClearSlot fieldName={fieldName} label={label} disabled={disabled} onSaveFieldNow={onSaveFieldNow}>{children}</BulkFieldClearSlot>\n </FieldControlAriaProvider>,\n { saveState, saveErrorMessage, onRetrySave, variant: autosaveVariant },\n );\n\n // ── HIDDEN mode: pass through ──\n if (effectiveMode === EditChromeMode.HIDDEN) {\n return <>{hiddenLabel}{wrappedChildren}</>;\n }\n\n // ── COMPACT mode: control + error only ──\n if (effectiveMode === EditChromeMode.COMPACT) {\n return (\n <div data-slot=\"field-chrome\" data-chrome-mode=\"compact\" data-label-placement={effectiveLabelPlacement} data-field={fieldName} data-testid={fieldName ? `field-${fieldName}` : undefined} data-guidance-field={fieldName} data-disabled={disabled || undefined} className={className}>\n {hiddenLabel}\n {wrappedChildren}\n {showError && <FieldError id={errorId}>{error}</FieldError>}\n </div>\n );\n }\n\n // ── Horizontal label modes ──\n if (effectiveLabelPlacement === 'start' || effectiveLabelPlacement === 'inline') {\n const labelContent = (\n <FieldContent>\n {showLabel && (\n <FieldTitle>\n <FieldLabel id={labelId} htmlFor={fieldId}>\n {label}\n {required && <span className=\"text-destructive ms-0.5\" aria-hidden=\"true\">*</span>}\n {tooltip && <TooltipIcon text={tooltip} />}\n </FieldLabel>\n </FieldTitle>\n )}\n {showDescription && <FieldDescription id={descriptionId}>{description}</FieldDescription>}\n {showError && <FieldError id={errorId}>{error}</FieldError>}\n </FieldContent>\n );\n\n return (\n <Field\n orientation={FieldVariants_Orientation.HORIZONTAL}\n data-slot=\"field-chrome\"\n data-chrome-mode=\"inline\"\n data-label-placement={effectiveLabelPlacement}\n data-field={fieldName}\n data-testid={fieldName ? `field-${fieldName}` : undefined}\n data-guidance-field={fieldName}\n data-invalid={!!error || undefined}\n data-disabled={disabled || undefined}\n className={className}\n >\n {effectiveLabelPlacement === 'start' && labelContent}\n {wrappedChildren}\n {effectiveLabelPlacement === 'inline' && labelContent}\n </Field>\n );\n }\n\n // ── RELAXED mode: generous spacing, heading-size label ──\n if (effectiveMode === EditChromeMode.RELAXED) {\n return (\n <div\n data-slot=\"field-chrome\"\n data-chrome-mode=\"relaxed\"\n data-label-placement={effectiveLabelPlacement}\n data-field={fieldName}\n data-testid={fieldName ? `field-${fieldName}` : undefined}\n data-guidance-field={fieldName}\n data-invalid={!!error || undefined}\n data-disabled={disabled || undefined}\n className={cn(\"flex flex-col gap-field\", className)}\n >\n {hiddenLabel}\n {showLabel && (\n <label\n id={labelId}\n htmlFor={fieldId}\n className={cn(\n \"text-lg font-semibold leading-snug\",\n disabled && \"opacity-[var(--opacity-disabled)]\",\n )}\n >\n {label}\n {required && <span className=\"text-destructive ms-1\" aria-hidden=\"true\">*</span>}\n {tooltip && <TooltipIcon text={tooltip} />}\n </label>\n )}\n {showDescription && (\n <p id={descriptionId} className=\"text-base text-muted-foreground leading-normal -mt-1\">\n {description}\n </p>\n )}\n <div className=\"py-1\">\n {wrappedChildren}\n </div>\n {showError && (\n <div id={errorId} role=\"alert\" className=\"text-base text-destructive font-normal\">\n {error}\n </div>\n )}\n </div>\n );\n }\n\n // ── SETTINGS_ROW mode: a self-contained settings list-item ──\n // Label/description inline-start, control/error inline-end. The row owns ALL\n // of its own structure so a stack of settings rows forms a clean, uniform,\n // divided list in ANY host — the generated flat template (`FormLayout` /\n // `DisplayLayout` render fields in a bare `<div>` with NO inter-field gap), an\n // authored `CARD` section, etc. — for both edit and display:\n // - `py-card-sm` gives every row the same compact vertical rhythm regardless\n // of its content height (fixes the \"rows collide\" symptom on generated\n // templates, which previously relied on a non-existent container gap).\n // - `border-b … last:border-b-0` is the hairline row divider — the signature\n // of the settings-list pattern (Cursor / Claude). `last:` suppresses the\n // trailing divider when the row is the final child (display lists); under a\n // form the trailing divider sits above the host-owned submit row, which is\n // the desired \"list ↔ actions\" separation.\n // - the control is a FIXED-width, inline-end-pinned column (replaces the old\n // ragged inline `min/max-width` box that made every control a different\n // width). `items-end` right-pins intrinsic controls (switch / checkbox /\n // button); `w-full` controls (input / select / textarea) fill the column,\n // so every control shares one inline-end edge.\n // `items-start` top-aligns the control with the label's first line (the title),\n // letting the description flow beneath on the inline-start side.\n if (effectiveMode === EditChromeMode.SETTINGS_ROW) {\n // STACKED layout: same settings-list row shell + identity, but the control\n // spans the row's full width beneath the label instead of the fixed\n // inline-end column. Two causes: an intrinsically wide control (`wideControl`,\n // e.g. a file drop zone) and a MOBILE viewport, where the row has no\n // horizontal room. `data-chrome-mode=\"settings_row\"` stays, so every\n // list-level rule (flush stacking at the layout roots, CARD-body\n // `gap-0`/full-bleed/re-inset) still treats it as a settings row;\n // `data-settings-row-layout` names the layout for diagnostics/tests.\n //\n // ONE element structure for both layouts, on purpose: root > [label column,\n // control column]. Only classes change between them, so a breakpoint crossing\n // re-lays the row out without remounting the control. Returning a different\n // tree per layout (or collapsing to the STACKED mode's `<Field>`) is what\n // discarded a pending avatar crop on resize (#1191).\n const stacksControl = !!wideControl || isMobile;\n return (\n <div\n data-slot=\"field-chrome\"\n data-chrome-mode=\"settings_row\"\n data-settings-row-layout={wideControl ? \"wide\" : isMobile ? \"stacked\" : undefined}\n data-label-placement={effectiveLabelPlacement}\n data-field={fieldName}\n data-testid={fieldName ? `field-${fieldName}` : undefined}\n data-guidance-field={fieldName}\n data-invalid={!!error || undefined}\n data-disabled={disabled || undefined}\n className={cn(\n // Row rhythm (T4): compact min-height + a subtle hover affordance,\n // matching the read-mode DisplayFieldChrome SETTINGS_ROW twin so a\n // view→edit drill keeps identical geometry. Vertical alignment is\n // CONTENT-AWARE: single-line rows CENTER (no dead space below the label);\n // rows with a description top-align so the control lines up with the\n // label's first line and the description flows beneath. A row hosting a\n // MULTI-LINE control (`textarea` — e.g. a bio field) also top-aligns:\n // centering a one-line label against a tall input strands the label\n // mid-row; the label must sit level with the control's first text line.\n // Extend the `has-[…]:items-start` list when another intrinsically tall\n // control family joins settings rows. The row OWNS its\n // inline padding (`px-card`) so its `border-b` runs full-bleed to the\n // padding-less CARD body edge (and gives consistent inset in a flat\n // host); block padding stays tight (`py-card-sm`).\n \"flex min-h-10 px-card py-card-sm border-b border-border last:border-b-0 hover:bg-muted/50 transition-colors\",\n stacksControl\n ? \"flex-col gap-element-xs\"\n : cn(\"flex-row gap-section\", showDescription ? \"items-start\" : \"items-center has-[textarea]:items-start\"),\n className,\n )}\n >\n {/* Inline-start side (above the control when stacked): label + description */}\n <div className={cn(\"flex min-w-0 flex-col gap-element-xs\", !stacksControl && \"flex-1\")}>\n {hiddenLabel}\n {showLabel && (\n <label\n id={labelId}\n htmlFor={fieldId}\n className={cn(\n \"text-sm font-medium leading-snug\",\n disabled && \"opacity-[var(--opacity-disabled)]\",\n )}\n >\n {label}\n {required && <span className=\"text-destructive ms-0.5\" aria-hidden=\"true\">*</span>}\n {tooltip && <TooltipIcon text={tooltip} />}\n </label>\n )}\n {showDescription && (\n <FieldDescription id={descriptionId}>{description}</FieldDescription>\n )}\n </div>\n\n {/* Inline-end side: right-pinned control + error column. `w-72` is the\n SHARED TARGET width (one inline-end edge across rows), but the column\n must stay shrinkable (`shrink` + `min-w-0`, NOT `shrink-0`): inside a\n padded CARD fieldset the row's available inline size can drop below\n label + gap + 18rem, and a non-shrinkable column overflows the\n fieldset and CLIPS against its border (the \"label cut at the card\n edge\" defect). With shrink enabled the row can never outgrow its\n container — the label and control columns compress instead. When\n stacked, the column spans the row instead. */}\n <div\n className={cn(\n \"flex min-w-0 flex-col gap-element-xs\",\n stacksControl ? \"w-full\" : \"w-72 max-w-[55%] shrink items-end\",\n )}\n >\n {wrappedChildren}\n {showError && <FieldError id={errorId}>{error}</FieldError>}\n </div>\n </div>\n );\n }\n\n // ── STACKED mode (default): label above, control, description + error below ──\n return (\n <Field\n orientation={FieldVariants_Orientation.VERTICAL}\n data-slot=\"field-chrome\"\n data-chrome-mode=\"stacked\"\n data-label-placement={effectiveLabelPlacement}\n data-field={fieldName}\n data-testid={fieldName ? `field-${fieldName}` : undefined}\n data-guidance-field={fieldName}\n data-invalid={!!error || undefined}\n data-disabled={disabled || undefined}\n className={className}\n >\n {hiddenLabel}\n {showLabel && (\n <FieldLabel id={labelId} htmlFor={fieldId}>\n {label}\n {required && <span className=\"text-destructive ms-0.5\" aria-hidden=\"true\">*</span>}\n {tooltip && <TooltipIcon text={tooltip} />}\n </FieldLabel>\n )}\n {wrappedChildren}\n {showDescription && <FieldDescription id={descriptionId}>{description}</FieldDescription>}\n {showError && <FieldError id={errorId}>{error}</FieldError>}\n </Field>\n );\n}\n\n;(FormFieldChrome as typeof FormFieldChrome & { displayName: string }).displayName = \"FormFieldChrome\"\n\nexport { FormFieldChrome, resolveEffectiveChromeMode }\n"]}
@@ -13,10 +13,12 @@ export interface FieldControlAriaProps {
13
13
  * them, never applied. A context reaches every control without each `form-field-*` passing two more props, and a field
14
14
  * rendered through any chrome mode gets it from the one place.
15
15
  */
16
- export declare function FieldControlAriaProvider({ invalid, describedBy, children, }: {
16
+ export declare function FieldControlAriaProvider({ invalid, describedBy, labelId, children, }: {
17
17
  invalid: boolean;
18
18
  /** The ids of the texts shown for the field; one that is not shown must be left out, or it names nothing. */
19
19
  describedBy: ReadonlyArray<string | undefined>;
20
+ /** The id of the field's label, given only when the label is rendered (visibly or for screen readers only). */
21
+ labelId?: string;
20
22
  children: React.ReactNode;
21
23
  }): React.JSX.Element;
22
24
  /**
@@ -24,4 +26,9 @@ export declare function FieldControlAriaProvider({ invalid, describedBy, childre
24
26
  * unchanged. Spread it BEFORE the control's own props: a value a caller states explicitly wins.
25
27
  */
26
28
  export declare function useFieldControlAria(): FieldControlAriaProps;
29
+ /**
30
+ * The id of the rendered label of the field a control sits in, for a control whose focusable element `htmlFor` cannot
31
+ * name: it sets `aria-labelledby` to it. Undefined outside a form field, or when the field shows no label.
32
+ */
33
+ export declare function useFieldControlLabelId(): string | undefined;
27
34
  //# sourceMappingURL=field-control-aria.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"field-control-aria.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/chromes/field-control-aria.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,+FAA+F;AAC/F,MAAM,WAAW,qBAAqB;IACpC,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAMD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,OAAO,EACP,WAAW,EACX,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,6GAA6G;IAC7G,WAAW,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC/C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAOpB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,qBAAqB,CAE3D"}
1
+ {"version":3,"file":"field-control-aria.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/chromes/field-control-aria.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,+FAA+F;AAC/F,MAAM,WAAW,qBAAqB;IACpC,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAiBD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,OAAO,EACP,WAAW,EACX,OAAO,EACP,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,6GAA6G;IAC7G,WAAW,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC/C,+GAA+G;IAC/G,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAWpB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,qBAAqB,CAE3D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,GAAG,SAAS,CAE3D"}
@@ -2,6 +2,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createContext, useContext, useMemo } from 'react';
3
3
  const NO_FIELD = {};
4
4
  const FieldControlAriaContext = createContext(NO_FIELD);
5
+ /**
6
+ * The id of the field's rendered label, kept apart from {@link FieldControlAriaProps} on purpose (#3867).
7
+ *
8
+ * A native input is named by the label's `htmlFor`, so it needs nothing more. A control whose focusable element is not a
9
+ * labelable element (a slider thumb, which is a `span role=slider`; a CodeMirror editor, whose focus lands on a
10
+ * contenteditable `div`) gets no name from `htmlFor`, and the first accessibility audit found both unnamed on the create
11
+ * form. Such a control points `aria-labelledby` at this id. It is not part of the props every control spreads, because
12
+ * on a checkbox, a switch or a combobox trigger `aria-labelledby` would REPLACE the name they already compute.
13
+ */
14
+ const FieldControlLabelIdContext = createContext(undefined);
5
15
  /**
6
16
  * Carries a field's validation state from its chrome to the control inside it (#3318).
7
17
  *
@@ -11,13 +21,13 @@ const FieldControlAriaContext = createContext(NO_FIELD);
11
21
  * them, never applied. A context reaches every control without each `form-field-*` passing two more props, and a field
12
22
  * rendered through any chrome mode gets it from the one place.
13
23
  */
14
- export function FieldControlAriaProvider({ invalid, describedBy, children, }) {
24
+ export function FieldControlAriaProvider({ invalid, describedBy, labelId, children, }) {
15
25
  const describedByValue = describedBy.filter(Boolean).join(' ');
16
26
  const value = useMemo(() => ({
17
27
  ...(invalid ? { 'aria-invalid': true } : {}),
18
28
  ...(describedByValue ? { 'aria-describedby': describedByValue } : {}),
19
29
  }), [invalid, describedByValue]);
20
- return _jsx(FieldControlAriaContext.Provider, { value: value, children: children });
30
+ return (_jsx(FieldControlAriaContext.Provider, { value: value, children: _jsx(FieldControlLabelIdContext.Provider, { value: labelId, children: children }) }));
21
31
  }
22
32
  /**
23
33
  * The ARIA a control spreads onto its focusable element. Empty outside a form field, so a control used on its own is
@@ -26,4 +36,11 @@ export function FieldControlAriaProvider({ invalid, describedBy, children, }) {
26
36
  export function useFieldControlAria() {
27
37
  return useContext(FieldControlAriaContext);
28
38
  }
39
+ /**
40
+ * The id of the rendered label of the field a control sits in, for a control whose focusable element `htmlFor` cannot
41
+ * name: it sets `aria-labelledby` to it. Undefined outside a form field, or when the field shows no label.
42
+ */
43
+ export function useFieldControlLabelId() {
44
+ return useContext(FieldControlLabelIdContext);
45
+ }
29
46
  //# sourceMappingURL=field-control-aria.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"field-control-aria.js","sourceRoot":"","sources":["../../../../../src/components/form/chromes/field-control-aria.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAQlE,MAAM,QAAQ,GAA0B,EAAE,CAAC;AAE3C,MAAM,uBAAuB,GAAG,aAAa,CAAwB,QAAQ,CAAC,CAAC;AAE/E;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CAAC,EACvC,OAAO,EACP,WAAW,EACX,QAAQ,GAMT;IACC,MAAM,gBAAgB,GAAG,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,OAAO,CAAwB,GAAG,EAAE,CAAC,CAAC;QAClD,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtE,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC;IACjC,OAAO,KAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAoC,CAAC;AACvG,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,UAAU,CAAC,uBAAuB,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import React, { createContext, useContext, useMemo } from 'react';\n\n/** What a form control states about its field: invalid or not, and which texts describe it. */\nexport interface FieldControlAriaProps {\n 'aria-invalid'?: true;\n 'aria-describedby'?: string;\n}\n\nconst NO_FIELD: FieldControlAriaProps = {};\n\nconst FieldControlAriaContext = createContext<FieldControlAriaProps>(NO_FIELD);\n\n/**\n * Carries a field's validation state from its chrome to the control inside it (#3318).\n *\n * The chrome holds the error and renders the message, and it receives the control only as `children`, so nothing told\n * the control. The wrapper was marked invalid and the input was not: a screen reader never heard the field was invalid\n * or which message belonged to it, and every style keyed on the control's `aria-invalid`, the themes' invalid edge among\n * them, never applied. A context reaches every control without each `form-field-*` passing two more props, and a field\n * rendered through any chrome mode gets it from the one place.\n */\nexport function FieldControlAriaProvider({\n invalid,\n describedBy,\n children,\n}: {\n invalid: boolean;\n /** The ids of the texts shown for the field; one that is not shown must be left out, or it names nothing. */\n describedBy: ReadonlyArray<string | undefined>;\n children: React.ReactNode;\n}): React.JSX.Element {\n const describedByValue = describedBy.filter(Boolean).join(' ');\n const value = useMemo<FieldControlAriaProps>(() => ({\n ...(invalid ? { 'aria-invalid': true as const } : {}),\n ...(describedByValue ? { 'aria-describedby': describedByValue } : {}),\n }), [invalid, describedByValue]);\n return <FieldControlAriaContext.Provider value={value}>{children}</FieldControlAriaContext.Provider>;\n}\n\n/**\n * The ARIA a control spreads onto its focusable element. Empty outside a form field, so a control used on its own is\n * unchanged. Spread it BEFORE the control's own props: a value a caller states explicitly wins.\n */\nexport function useFieldControlAria(): FieldControlAriaProps {\n return useContext(FieldControlAriaContext);\n}\n"]}
1
+ {"version":3,"file":"field-control-aria.js","sourceRoot":"","sources":["../../../../../src/components/form/chromes/field-control-aria.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAQlE,MAAM,QAAQ,GAA0B,EAAE,CAAC;AAE3C,MAAM,uBAAuB,GAAG,aAAa,CAAwB,QAAQ,CAAC,CAAC;AAE/E;;;;;;;;GAQG;AACH,MAAM,0BAA0B,GAAG,aAAa,CAAqB,SAAS,CAAC,CAAC;AAEhF;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CAAC,EACvC,OAAO,EACP,WAAW,EACX,OAAO,EACP,QAAQ,GAQT;IACC,MAAM,gBAAgB,GAAG,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,OAAO,CAAwB,GAAG,EAAE,CAAC,CAAC;QAClD,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtE,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC;IACjC,OAAO,CACL,KAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAC5C,KAAC,0BAA0B,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,YAAG,QAAQ,GAAuC,GACpE,CACpC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,UAAU,CAAC,uBAAuB,CAAC,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB;IACpC,OAAO,UAAU,CAAC,0BAA0B,CAAC,CAAC;AAChD,CAAC","sourcesContent":["import React, { createContext, useContext, useMemo } from 'react';\n\n/** What a form control states about its field: invalid or not, and which texts describe it. */\nexport interface FieldControlAriaProps {\n 'aria-invalid'?: true;\n 'aria-describedby'?: string;\n}\n\nconst NO_FIELD: FieldControlAriaProps = {};\n\nconst FieldControlAriaContext = createContext<FieldControlAriaProps>(NO_FIELD);\n\n/**\n * The id of the field's rendered label, kept apart from {@link FieldControlAriaProps} on purpose (#3867).\n *\n * A native input is named by the label's `htmlFor`, so it needs nothing more. A control whose focusable element is not a\n * labelable element (a slider thumb, which is a `span role=slider`; a CodeMirror editor, whose focus lands on a\n * contenteditable `div`) gets no name from `htmlFor`, and the first accessibility audit found both unnamed on the create\n * form. Such a control points `aria-labelledby` at this id. It is not part of the props every control spreads, because\n * on a checkbox, a switch or a combobox trigger `aria-labelledby` would REPLACE the name they already compute.\n */\nconst FieldControlLabelIdContext = createContext<string | undefined>(undefined);\n\n/**\n * Carries a field's validation state from its chrome to the control inside it (#3318).\n *\n * The chrome holds the error and renders the message, and it receives the control only as `children`, so nothing told\n * the control. The wrapper was marked invalid and the input was not: a screen reader never heard the field was invalid\n * or which message belonged to it, and every style keyed on the control's `aria-invalid`, the themes' invalid edge among\n * them, never applied. A context reaches every control without each `form-field-*` passing two more props, and a field\n * rendered through any chrome mode gets it from the one place.\n */\nexport function FieldControlAriaProvider({\n invalid,\n describedBy,\n labelId,\n children,\n}: {\n invalid: boolean;\n /** The ids of the texts shown for the field; one that is not shown must be left out, or it names nothing. */\n describedBy: ReadonlyArray<string | undefined>;\n /** The id of the field's label, given only when the label is rendered (visibly or for screen readers only). */\n labelId?: string;\n children: React.ReactNode;\n}): React.JSX.Element {\n const describedByValue = describedBy.filter(Boolean).join(' ');\n const value = useMemo<FieldControlAriaProps>(() => ({\n ...(invalid ? { 'aria-invalid': true as const } : {}),\n ...(describedByValue ? { 'aria-describedby': describedByValue } : {}),\n }), [invalid, describedByValue]);\n return (\n <FieldControlAriaContext.Provider value={value}>\n <FieldControlLabelIdContext.Provider value={labelId}>{children}</FieldControlLabelIdContext.Provider>\n </FieldControlAriaContext.Provider>\n );\n}\n\n/**\n * The ARIA a control spreads onto its focusable element. Empty outside a form field, so a control used on its own is\n * unchanged. Spread it BEFORE the control's own props: a value a caller states explicitly wins.\n */\nexport function useFieldControlAria(): FieldControlAriaProps {\n return useContext(FieldControlAriaContext);\n}\n\n/**\n * The id of the rendered label of the field a control sits in, for a control whose focusable element `htmlFor` cannot\n * name: it sets `aria-labelledby` to it. Undefined outside a form field, or when the field shows no label.\n */\nexport function useFieldControlLabelId(): string | undefined {\n return useContext(FieldControlLabelIdContext);\n}\n"]}
@@ -19,6 +19,11 @@ import type { ResourceConfiguration_Operation_UrlInitiatorInfo } from '@wildo-ai
19
19
  * collection URL — in `validate-field-handler.backend.service.ts`. Composing from the same field is
20
20
  * what keeps the two sides describing ONE path rather than two paths that happen to agree.
21
21
  *
22
+ * That field is an API ROUTE: `buildUrlForParentCombination` builds it with `isFrontend: false`, so it
23
+ * already begins with `MAIN_API_BASE_PATH` (`/api/v1/organizations/{organizationId}/…`) and the
24
+ * backend mounts it verbatim. Prefixing it again sent every check to `/api/v1/api/v1/…/validate-field`
25
+ * and a 404 (#3858). `apiBaseUrl` is the backend ORIGIN (`VITE_API_BASE_URL`), never a path.
26
+ *
22
27
  * @returns the absolute endpoint, or `undefined` when the initiator's parameters cannot be resolved
23
28
  * from the current context — in which case the caller disables the check rather than
24
29
  * issuing a request that cannot succeed.
@@ -1 +1 @@
1
- {"version":3,"file":"validate-field-url.frontend.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/validation-errors/validate-field-url.frontend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gDAAgD,EAAE,MAAM,uBAAuB,CAAC;AAI9F;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,gDAAgD,CAAC;IAChE,iGAAiG;IACjG,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CACvD,GAAG,MAAM,GAAG,SAAS,CAUrB"}
1
+ {"version":3,"file":"validate-field-url.frontend.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/validation-errors/validate-field-url.frontend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gDAAgD,EAAE,MAAM,uBAAuB,CAAC;AAG9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,gDAAgD,CAAC;IAChE,iGAAiG;IACjG,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CACvD,GAAG,MAAM,GAAG,SAAS,CAOrB"}
@@ -1,4 +1,3 @@
1
- import { MAIN_API_BASE_PATH } from '@wildo-ai/saas-models';
2
1
  import { NavigationUtils } from '../../../core/navigation/navigation.utils.js';
3
2
  /**
4
3
  * Compose the `validate-field` endpoint for a resource's blur-time server validation (#1238).
@@ -20,13 +19,18 @@ import { NavigationUtils } from '../../../core/navigation/navigation.utils.js';
20
19
  * collection URL — in `validate-field-handler.backend.service.ts`. Composing from the same field is
21
20
  * what keeps the two sides describing ONE path rather than two paths that happen to agree.
22
21
  *
22
+ * That field is an API ROUTE: `buildUrlForParentCombination` builds it with `isFrontend: false`, so it
23
+ * already begins with `MAIN_API_BASE_PATH` (`/api/v1/organizations/{organizationId}/…`) and the
24
+ * backend mounts it verbatim. Prefixing it again sent every check to `/api/v1/api/v1/…/validate-field`
25
+ * and a 404 (#3858). `apiBaseUrl` is the backend ORIGIN (`VITE_API_BASE_URL`), never a path.
26
+ *
23
27
  * @returns the absolute endpoint, or `undefined` when the initiator's parameters cannot be resolved
24
28
  * from the current context — in which case the caller disables the check rather than
25
29
  * issuing a request that cannot succeed.
26
30
  */
27
31
  export function buildValidateFieldUrl(params) {
28
32
  const { apiBaseUrl, initiatorInfo, contextualParameters } = params;
29
- const resolved = NavigationUtils.resolveUrlPath(`${MAIN_API_BASE_PATH}${initiatorInfo.url}`, contextualParameters);
33
+ const resolved = NavigationUtils.resolveUrlPath(initiatorInfo.url, contextualParameters);
30
34
  if (!resolved || NavigationUtils.hasUnresolvedPlaceholders(resolved)) {
31
35
  return undefined;
32
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"validate-field-url.frontend.js","sourceRoot":"","sources":["../../../../../src/components/form/validation-errors/validate-field-url.frontend.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sDAAsD,CAAC;AAEvF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAKrC;IACC,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC;IACnE,MAAM,QAAQ,GAAG,eAAe,CAAC,cAAc,CAC7C,GAAG,kBAAkB,GAAG,aAAa,CAAC,GAAG,EAAE,EAC3C,oBAAoB,CACrB,CAAC;IACF,IAAI,CAAC,QAAQ,IAAI,eAAe,CAAC,yBAAyB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrE,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,GAAG,UAAU,GAAG,QAAQ,iBAAiB,CAAC;AACnD,CAAC","sourcesContent":["import type { ResourceConfiguration_Operation_UrlInitiatorInfo } from '@wildo-ai/saas-models';\nimport { MAIN_API_BASE_PATH } from '@wildo-ai/saas-models';\nimport { NavigationUtils } from '~wildo-frontend-lib/core/navigation/navigation.utils';\n\n/**\n * Compose the `validate-field` endpoint for a resource's blur-time server validation (#1238).\n *\n * ## Why this is a function rather than three lines inside the form's memo\n *\n * The failure mode is SILENT BY CONSTRUCTION. `useFieldUniquenessValidation` treats a failed check\n * as \"no conflict found\", so a URL the backend does not serve produces a 404 that nobody sees and a\n * field that quietly never warns — indistinguishable, to the person typing, from a value that is\n * genuinely free. It was composed from the create surface's FRONTEND ROUTE, which carries a\n * `/create` segment, and the whole affordance had therefore never run on any create form.\n *\n * Nothing could fail loudly enough to catch that, so the invariant is pinned instead, which needs a\n * seam to pin it at.\n *\n * ## The authority\n *\n * The backend mounts this route on the CREATE operation's `initiatorInfos[].url` — the API\n * collection URL — in `validate-field-handler.backend.service.ts`. Composing from the same field is\n * what keeps the two sides describing ONE path rather than two paths that happen to agree.\n *\n * @returns the absolute endpoint, or `undefined` when the initiator's parameters cannot be resolved\n * from the current context — in which case the caller disables the check rather than\n * issuing a request that cannot succeed.\n */\nexport function buildValidateFieldUrl(params: {\n apiBaseUrl: string;\n initiatorInfo: ResourceConfiguration_Operation_UrlInitiatorInfo;\n /** Narrower than the selector above it takes, because `resolveUrlPath` resolves scalars only. */\n contextualParameters: Record<string, string | number>;\n}): string | undefined {\n const { apiBaseUrl, initiatorInfo, contextualParameters } = params;\n const resolved = NavigationUtils.resolveUrlPath(\n `${MAIN_API_BASE_PATH}${initiatorInfo.url}`,\n contextualParameters,\n );\n if (!resolved || NavigationUtils.hasUnresolvedPlaceholders(resolved)) {\n return undefined;\n }\n return `${apiBaseUrl}${resolved}/validate-field`;\n}\n"]}
1
+ {"version":3,"file":"validate-field-url.frontend.js","sourceRoot":"","sources":["../../../../../src/components/form/validation-errors/validate-field-url.frontend.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,sDAAsD,CAAC;AAEvF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAKrC;IACC,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC;IACnE,MAAM,QAAQ,GAAG,eAAe,CAAC,cAAc,CAAC,aAAa,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;IACzF,IAAI,CAAC,QAAQ,IAAI,eAAe,CAAC,yBAAyB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrE,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,GAAG,UAAU,GAAG,QAAQ,iBAAiB,CAAC;AACnD,CAAC","sourcesContent":["import type { ResourceConfiguration_Operation_UrlInitiatorInfo } from '@wildo-ai/saas-models';\nimport { NavigationUtils } from '~wildo-frontend-lib/core/navigation/navigation.utils';\n\n/**\n * Compose the `validate-field` endpoint for a resource's blur-time server validation (#1238).\n *\n * ## Why this is a function rather than three lines inside the form's memo\n *\n * The failure mode is SILENT BY CONSTRUCTION. `useFieldUniquenessValidation` treats a failed check\n * as \"no conflict found\", so a URL the backend does not serve produces a 404 that nobody sees and a\n * field that quietly never warns — indistinguishable, to the person typing, from a value that is\n * genuinely free. It was composed from the create surface's FRONTEND ROUTE, which carries a\n * `/create` segment, and the whole affordance had therefore never run on any create form.\n *\n * Nothing could fail loudly enough to catch that, so the invariant is pinned instead, which needs a\n * seam to pin it at.\n *\n * ## The authority\n *\n * The backend mounts this route on the CREATE operation's `initiatorInfos[].url` — the API\n * collection URL — in `validate-field-handler.backend.service.ts`. Composing from the same field is\n * what keeps the two sides describing ONE path rather than two paths that happen to agree.\n *\n * That field is an API ROUTE: `buildUrlForParentCombination` builds it with `isFrontend: false`, so it\n * already begins with `MAIN_API_BASE_PATH` (`/api/v1/organizations/{organizationId}/…`) and the\n * backend mounts it verbatim. Prefixing it again sent every check to `/api/v1/api/v1/…/validate-field`\n * and a 404 (#3858). `apiBaseUrl` is the backend ORIGIN (`VITE_API_BASE_URL`), never a path.\n *\n * @returns the absolute endpoint, or `undefined` when the initiator's parameters cannot be resolved\n * from the current context — in which case the caller disables the check rather than\n * issuing a request that cannot succeed.\n */\nexport function buildValidateFieldUrl(params: {\n apiBaseUrl: string;\n initiatorInfo: ResourceConfiguration_Operation_UrlInitiatorInfo;\n /** Narrower than the selector above it takes, because `resolveUrlPath` resolves scalars only. */\n contextualParameters: Record<string, string | number>;\n}): string | undefined {\n const { apiBaseUrl, initiatorInfo, contextualParameters } = params;\n const resolved = NavigationUtils.resolveUrlPath(initiatorInfo.url, contextualParameters);\n if (!resolved || NavigationUtils.hasUnresolvedPlaceholders(resolved)) {\n return undefined;\n }\n return `${apiBaseUrl}${resolved}/validate-field`;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceCollectionBody_Table.d.ts","sourceRoot":"","sources":["../../../../src/components/resources/ResourceCollectionBody_Table.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAA+B,MAAM,OAAO,CAAC;AAoBpD,OAAO,KAAK,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,MAAM,+DAA+D,CAAC;AACxJ,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qEAAqE,CAAC;AAIrG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wDAAwD,CAAC;AAE7F,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAyBrC,MAAM,WAAW,iCAAiC;IAChD,2CAA2C;IAC3C,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,mFAAmF;IACnF,cAAc,EAAE,gCAAgC,CAAC;IACjD;;;OAGG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,gDAAgD;IAChD,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB;;;OAGG;IACH,0BAA0B,EAAE,gCAAgC,CAAC,4BAA4B,CAAC,GAAG,SAAS,CAAC;IACvG,uDAAuD;IACvD,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,sDAAsD;IACtD,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,gFAAgF;IAChF,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IACjC,uEAAuE;IACvE,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;IAC3C;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wDAAwD;IACxD,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC;IAC7C,4CAA4C;IAC5C,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACxC,2EAA2E;IAC3E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,KAAK,CAAC,SAAS,CAAC;IACxD,6DAA6D;IAC7D,UAAU,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACtC;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC;CAC3C;AAED,eAAO,MAAM,4BAA4B,GAAI,uQAmB1C,iCAAiC,KAAG,KAAK,CAAC,GAAG,CAAC,OAsPhD,CAAC"}
1
+ {"version":3,"file":"ResourceCollectionBody_Table.d.ts","sourceRoot":"","sources":["../../../../src/components/resources/ResourceCollectionBody_Table.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAA+B,MAAM,OAAO,CAAC;AAoBpD,OAAO,KAAK,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,MAAM,+DAA+D,CAAC;AACxJ,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qEAAqE,CAAC;AAIrG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wDAAwD,CAAC;AAG7F,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAyBrC,MAAM,WAAW,iCAAiC;IAChD,2CAA2C;IAC3C,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,mFAAmF;IACnF,cAAc,EAAE,gCAAgC,CAAC;IACjD;;;OAGG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,gDAAgD;IAChD,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB;;;OAGG;IACH,0BAA0B,EAAE,gCAAgC,CAAC,4BAA4B,CAAC,GAAG,SAAS,CAAC;IACvG,uDAAuD;IACvD,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,sDAAsD;IACtD,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,gFAAgF;IAChF,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IACjC,uEAAuE;IACvE,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;IAC3C;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wDAAwD;IACxD,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC;IAC7C,4CAA4C;IAC5C,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACxC,2EAA2E;IAC3E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,KAAK,CAAC,SAAS,CAAC;IACxD,6DAA6D;IAC7D,UAAU,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACtC;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC;CAC3C;AAED,eAAO,MAAM,4BAA4B,GAAI,uQAmB1C,iCAAiC,KAAG,KAAK,CAAC,GAAG,CAAC,OAyPhD,CAAC"}
@@ -28,6 +28,7 @@ import { FieldValueRenderer } from '../../components/resources/ResourceListItemR
28
28
  import { ResourceInPlaceOperationRow } from '../../components/resources/ResourceInPlaceOperationRow.js';
29
29
  import { useInPlaceOperation } from '../../core/resources/in-place/InPlaceOperationContext.js';
30
30
  import { FrontendResourceUtils } from '../../core/resources/frontend-resource.utils.js';
31
+ import { activationStartedOnInnerControl } from '../../core/ui/inner-control-activation.utils.js';
31
32
  /**
32
33
  * Render a column's header or cell template by CALLING it, never by mounting it.
33
34
  *
@@ -152,7 +153,13 @@ export const ResourceCollectionBody_Table = ({ items, resourceType, resourceConf
152
153
  // nothing must not advertise that it does.
153
154
  rowIsOpenable && (interactiveRecipe.states.hover || 'hover:bg-muted/30'), 'transition-colors motion-reduce:transition-none', rowIsOpenable && 'cursor-pointer',
154
155
  // The table container clips (`rounded-lg overflow-hidden`): the contract's INSET outline.
155
- rowIsOpenable && focusIndicatorClasses(FocusIndicatorShape.INSET), isRowSelected?.(row.original) && 'bg-primary/5'), onClick: rowIsOpenable ? () => onRowClick(row.original) : undefined, role: "row", "aria-selected": selectable ? (isRowSelected?.(row.original) ?? false) : undefined, tabIndex: rowIsOpenable ? 0 : undefined, onKeyDown: rowIsOpenable ? (e) => {
156
+ rowIsOpenable && focusIndicatorClasses(FocusIndicatorShape.INSET), isRowSelected?.(row.original) && 'bg-primary/5'),
157
+ // A control inside a cell (a reference to another record, a link) owns its own click and key: the row
158
+ // opens its record only when the activation did not start on one (`activationStartedOnInnerControl`).
159
+ onClick: rowIsOpenable ? (e) => { if (!activationStartedOnInnerControl(e))
160
+ onRowClick(row.original); } : undefined, role: "row", "aria-selected": selectable ? (isRowSelected?.(row.original) ?? false) : undefined, tabIndex: rowIsOpenable ? 0 : undefined, onKeyDown: rowIsOpenable ? (e) => {
161
+ if (activationStartedOnInnerControl(e))
162
+ return;
156
163
  if (e.key === 'Enter' || e.key === ' ') {
157
164
  e.preventDefault();
158
165
  onRowClick(row.original);
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceCollectionBody_Table.js","sourceRoot":"","sources":["../../../../src/components/resources/ResourceCollectionBody_Table.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;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E,IAAI,CAAC,UAAU,EAAE,CAAC,IAN/D,IAAI,CAAC,EAAE,CAOF,CACb,CAAC;oCACJ,CAAC,CAAC,IA3CG,GAAG,CAAC,EAAE,CA4CR,CACJ,CAAC;4BACJ,CAAC,CAAC,GACI,IACF,GACJ,GACF,GACL,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * ResourceCollectionBody_Table — the TABLE rendering of a resource collection.\n *\n * Presentational: it receives the already-fetched `items` plus the collection's\n * sort/selection state + handlers from the host, derives columns from the\n * resource's summary fields (schema-aware cells via {@link FieldValueRenderer}),\n * and renders a TanStack table with sortable headers (server-side), a selection\n * checkbox column, and a floating selected-count summary.\n *\n * Extracted from the former standalone `List_Table` preset so a single host can\n * swap between this body and the cards body at runtime (the cards↔table toggle)\n * without duplicating the data/fetch layer.\n */\n\nimport React, { useCallback, useMemo } from 'react';\nimport {\n useReactTable,\n getCoreRowModel,\n type ColumnDef,\n type ColumnDefTemplate,\n} from '@tanstack/react-table';\nimport { z } from 'zod';\nimport { useI18n } from '~wildo-frontend-lib/core/i18n/useI18n';\nimport { cn } from '~wildo-frontend-lib/core/ui/cn';\nimport { focusIndicatorClasses, FocusIndicatorShape } from '~wildo-frontend-lib/core/ui/themes/focus-indicator';\nimport { useIconRegistry } from '~wildo-frontend-lib/core/icons/useIconRegistry';\nimport { StandardIconReference, IconSize } from '~wildo-frontend-lib/core/icons/icon-registry.frontend.schemas';\nimport { useUI } from '~wildo-frontend-lib/core/ui/useUI';\nimport { ButtonSize, FrontendComponentType, InteractiveVariant, TypographyVariant, UIBehavior } from '@wildo-ai/presets-components-models';\nimport { Button, ButtonVariants_Variant } from '~wildo-frontend-lib/components/actions/button';\nimport { CheckboxRoot } from '~wildo-frontend-lib/components/form/controls/boolean/checkbox';\nimport { TableCell } from '~wildo-frontend-lib/components/sections/table';\nimport { FieldValueRenderer } from '~wildo-frontend-lib/components/resources/ResourceListItemRenderer';\nimport { AutomatedLayoutFrontendUtils } from '~wildo-frontend-lib/core/automated-layout/automated-layout.frontend.utils';\nimport type { AnyFrontendResourceConfiguration, FrontendResourceOperationContext } from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport type { SortState } from '~wildo-frontend-lib/components/resources/ResourceLayout_SortControl';\nimport { ResourceInPlaceOperationRow } from '~wildo-frontend-lib/components/resources/ResourceInPlaceOperationRow';\nimport { useInPlaceOperation } from '~wildo-frontend-lib/core/resources/in-place/InPlaceOperationContext';\nimport { FrontendResourceUtils } from '~wildo-frontend-lib/core/resources/frontend-resource.utils';\nimport type { NavigationZone } from '~wildo-frontend-lib/core/navigation/navigation.schemas';\n\ntype TableItem = Record<string, any>;\n\n/**\n * Render a column's header or cell template by CALLING it, never by mounting it.\n *\n * TanStack's `flexRender` mounts any function it is given as a component (`React.createElement(fn, props)`),\n * so the function's identity becomes the element's TYPE. This table builds its column definitions in a\n * `useMemo` over the host's inputs (sort, selection, the row-actions renderer…), and every rebuild hands\n * each cell a NEW function — a new component type — so React unmounted every cell's subtree and mounted a\n * fresh one. For a value cell that was only wasted work; for the row ACTIONS it was the whole state of the\n * row's action bar: the anchored panel a click had just opened, the confirmation it had just raised. The\n * action \"did nothing\" because what it did was discarded in the next render (#2057).\n *\n * Calling the template returns the element it describes — `<FieldValueRenderer>`, `<CheckboxRoot>`, the\n * host's row actions — whose types are stable, so React reconciles each cell in place across rebuilds. It is\n * safe because none of these templates calls a hook: each is a plain render function over its context.\n */\nfunction renderColumnTemplate<TContext extends object>(\n template: ColumnDefTemplate<TContext> | undefined,\n context: TContext,\n): React.ReactNode {\n if (template === undefined) return null;\n return typeof template === 'function' ? template(context) : template;\n}\n\nexport interface ResourceCollectionBody_TableProps {\n /** The fetched items to render as rows. */\n items: TableItem[];\n /** Resource type for i18n + cell formatting. */\n resourceType: string;\n /** Resource configuration — provides the main schema for column type detection. */\n resourceConfig: AnyFrontendResourceConfiguration;\n /**\n * The zone this table is rendered in — forwarded to the in-place operation body so a transformed\n * row hosts its operation in the same zone as every other host on this surface.\n */\n navigationZone: NavigationZone;\n /** Ordered summary fields → one column each. */\n summaryFields: string[];\n /**\n * The collection's resource identifiers (its route scope and parents). Each cell reads in its ROW's scope, built\n * from these and the row (`FieldValueRenderer`), so a reference in a cell is fetched where the row lives (#2347).\n */\n contextResourceIdentifiers: FrontendResourceOperationContext['contextResourceIdentifiers'] | undefined;\n /** Pre-resolved i18n field labels (column headers). */\n fieldLabelsMap: Record<string, string>;\n /** Sortable field names (sortable column headers). */\n sortFields: readonly string[];\n /** Active sort rules, highest priority first (drives the header indicators). */\n sortStates: readonly SortState[];\n /** Sort change handler (owned by the host; also resets pagination). */\n onSortChange: (sorts: SortState[]) => void;\n /**\n * Item-based selection, driven by the host's shared selection model (the SAME\n * model the CARDS checkboxes use, so a selection survives the cards↔table\n * toggle and feeds the bulk bar). When `selectable` is false the select column\n * is omitted entirely.\n */\n selectable?: boolean;\n /** Whether a given row's item is currently selected. */\n isRowSelected?: (item: TableItem) => boolean;\n /** Toggle a single row's item selection. */\n onToggleRow?: (item: TableItem) => void;\n /** Whether EVERY current-page item is selected (header checkbox state). */\n allSelected?: boolean;\n /** Toggle selection of every current-page item (header checkbox). */\n onToggleAll?: () => void;\n /**\n * Per-row actions rendered in a trailing column at the END of each row (parity\n * with the cards' per-item operations). Omit to render no actions column.\n */\n renderRowActions?: (item: TableItem) => React.ReactNode;\n /** Row click handler — navigates to the item's READ view. */\n onRowClick: (item: TableItem) => void;\n /**\n * Can THIS row be opened? Omitted means every row can.\n *\n * The row's whole interactive presentation — pointer, focusability, Enter/Space — is read off this\n * rather than off the presence of `onRowClick`, because `onRowClick` is one prop for the table\n * while openability is a property of the row. Without it the table promised a click on rows whose\n * READ resolves to no view, and answered nothing: the card's defect, one surface over.\n */\n canOpenRow?: (item: TableItem) => boolean;\n}\n\nexport const ResourceCollectionBody_Table = ({\n items,\n resourceType,\n resourceConfig,\n navigationZone,\n summaryFields,\n contextResourceIdentifiers,\n fieldLabelsMap,\n sortFields,\n sortStates,\n onSortChange,\n selectable = false,\n isRowSelected,\n onToggleRow,\n allSelected = false,\n onToggleAll,\n renderRowActions,\n onRowClick,\n canOpenRow,\n}: ResourceCollectionBody_TableProps): React.JSX.Element => {\n const { tComponent, tResourceFieldEnumValue } = useI18n({\n component: FrontendComponentType.RESOURCES_LAYOUTS_LIST,\n resource: resourceType,\n });\n const { renderIcon } = useIconRegistry();\n const inPlaceHost = useInPlaceOperation();\n const { getRecipe } = useUI();\n const interactiveRecipe = getRecipe(UIBehavior.INTERACTIVE, InteractiveVariant.GHOST);\n // Column headings name what is below them: the EYEBROW voice, as a record's fact tiles name their values.\n const eyebrowRecipe = getRecipe(UIBehavior.TYPOGRAPHY, TypographyVariant.EYEBROW);\n\n const schemaShape = useMemo(() => {\n // Columns span every row, so every field some row can hold (#2455): a variant column is typed too. A family's\n // `mainSchema` is its base object since #2414, not a discriminated union.\n return FrontendResourceUtils.resolveFieldShapeOfAnyVariant(resourceConfig) ?? null;\n }, [resourceConfig]);\n\n const sortableFieldsSet = useMemo(() => new Set(sortFields), [sortFields]);\n\n const columns = useMemo<ColumnDef<TableItem>[]>(() => {\n const cols: ColumnDef<TableItem>[] = [];\n\n // Select column — only when the view is selectable. Item-based (the host's\n // shared selection), not TanStack's internal row-selection model.\n if (selectable) {\n cols.push({\n id: '__select',\n header: () => (\n <CheckboxRoot\n checked={allSelected}\n onCheckedChange={() => onToggleAll?.()}\n aria-label={tComponent(FrontendComponentType.RESOURCES_LAYOUTS_LIST, 'selectAll')}\n />\n ),\n cell: ({ row }) => (\n <CheckboxRoot\n checked={isRowSelected?.(row.original) ?? false}\n onCheckedChange={() => onToggleRow?.(row.original)}\n aria-label={tComponent(FrontendComponentType.RESOURCES_LAYOUTS_LIST, 'selectRow', { row: row.index + 1 })}\n />\n ),\n size: 40,\n enableSorting: false,\n });\n }\n\n for (const fieldName of summaryFields) {\n const fieldSchema = schemaShape?.[fieldName] as z.ZodTypeAny | undefined;\n const isSortable = sortableFieldsSet.has(fieldName);\n const label = fieldLabelsMap[fieldName] || fieldName;\n\n cols.push({\n id: fieldName,\n accessorFn: (row) => row[fieldName],\n header: () => {\n if (!isSortable) return <span>{label}</span>;\n\n const ruleIndex = sortStates.findIndex((s) => s.field === fieldName);\n const isActiveSort = ruleIndex >= 0;\n const direction = isActiveSort ? sortStates[ruleIndex].direction : null;\n\n return (\n <Button\n type=\"button\"\n variant={ButtonVariants_Variant.GHOST}\n size={ButtonSize.SM}\n className=\"inline-flex items-center gap-1 text-start -ms-2 h-auto py-0.5 px-2 font-medium\"\n onClick={() => {\n // Cycle THIS column within the multi-sort, keeping the other rules\n // (priority = order added). Owned by the host (also resets page):\n // unsorted → append asc → desc → removed.\n if (ruleIndex < 0) {\n onSortChange([...sortStates, { field: fieldName, direction: 'asc' }]);\n } else if (sortStates[ruleIndex].direction === 'asc') {\n onSortChange(sortStates.map((s, i) => (i === ruleIndex ? { ...s, direction: 'desc' } : s)));\n } else {\n onSortChange(sortStates.filter((_, i) => i !== ruleIndex));\n }\n }}\n >\n {label}\n {isActiveSort && (\n <span className=\"inline-flex items-center gap-0.5 text-muted-foreground\" aria-hidden=\"true\">\n {renderIcon(\n direction === 'asc' ? StandardIconReference.CHEVRON_UP : StandardIconReference.CHEVRON_DOWN,\n { size: IconSize.XS },\n )}\n {sortStates.length > 1 && (\n <span className=\"text-[10px] font-semibold tabular-nums\">{ruleIndex + 1}</span>\n )}\n </span>\n )}\n </Button>\n );\n },\n cell: ({ row }) => (\n <FieldValueRenderer\n value={row.original[fieldName]}\n fieldSchema={fieldSchema}\n fieldLabel={undefined}\n resourceType={resourceType}\n record={row.original as Record<string, unknown>}\n collectionContextResourceIdentifiers={contextResourceIdentifiers}\n fieldName={fieldName}\n tResourceFieldEnumValue={tResourceFieldEnumValue}\n />\n ),\n });\n }\n\n // Trailing per-row actions column (at the END of the row). Right-aligned,\n // non-sortable, header label sr-only. The host supplies the same operations\n // bar the cards use via `renderRowActions`.\n if (renderRowActions) {\n cols.push({\n id: '__actions',\n header: () => (\n <span className=\"sr-only\">{tComponent(FrontendComponentType.RESOURCES_LAYOUTS_LIST, 'actionsColumn')}</span>\n ),\n cell: ({ row }) => (\n <div className=\"flex justify-end\">{renderRowActions(row.original)}</div>\n ),\n enableSorting: false,\n });\n }\n\n return cols;\n }, [selectable, allSelected, onToggleAll, isRowSelected, onToggleRow, renderRowActions, summaryFields, contextResourceIdentifiers, schemaShape, sortableFieldsSet, fieldLabelsMap, sortStates, onSortChange, resourceType, tResourceFieldEnumValue, tComponent, renderIcon]);\n\n const table = useReactTable({\n data: items,\n columns,\n getCoreRowModel: getCoreRowModel(),\n // Stable row id: resource id when present, else the row index (NOT a random\n // value — a fresh id per render would break keys + force re-renders).\n getRowId: (row, index) => String(row.id ?? row._id ?? index),\n // Sorting is server-side (the host re-fetches on sort change).\n manualSorting: true,\n });\n\n return (\n <>\n <div className=\"rounded-lg border border-border overflow-hidden\">\n <div className=\"overflow-x-auto\">\n {/* `data-slot=\"table\"`: this IS a data table, which is what a surface's embedded-table padding keys on. */}\n {/* `tabular-nums`: values here stand in COLUMNS, so every cell's figures take one width and a column of\n amounts or dates aligns (the DATA voice no longer sets it on a lone value, #3066). */}\n <table data-slot=\"table\" className=\"w-full text-sm tabular-nums\" aria-label={tComponent(FrontendComponentType.RESOURCES_LAYOUTS_LIST, 'listLabel')}>\n <thead className=\"bg-muted/50 border-b border-border\">\n {table.getHeaderGroups().map(headerGroup => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map(header => (\n <th\n key={header.id}\n className={cn(\"px-card-sm py-element-sm text-start\", eyebrowRecipe.base)}\n style={{ width: header.getSize() !== 150 ? header.getSize() : undefined }}\n >\n {header.isPlaceholder\n ? null\n : renderColumnTemplate(header.column.columnDef.header, header.getContext())}\n </th>\n ))}\n </tr>\n ))}\n </thead>\n <tbody className=\"divide-y divide-border\">\n {table.getRowModel().rows.map(row => {\n // A row being TRANSFORMED by an INLINE action replaces its cells with the operation\n // body, spanning the full width, and every other row stays exactly where it is.\n //\n // This is the SIBLING of the cards-mode swap in `ResourceLayout_List`, and it exists\n // because the two bodies are two call sites of one invariant: a view that offers a\n // cards↔table toggle would otherwise transform the row in one mode and open an\n // overlay in the other, from the same button.\n const rowId = FrontendResourceUtils.getResourceObjectId(\n row.original,\n resourceConfig.resourceFieldIdentifier as string,\n );\n if (inPlaceHost.isElementActive(rowId)) {\n return (\n <tr key={row.id} role=\"row\">\n <td colSpan={row.getVisibleCells().length} className=\"p-0\">\n <ResourceInPlaceOperationRow navigationZone={navigationZone} />\n </td>\n </tr>\n );\n }\n\n const rowIsOpenable = canOpenRow ? canOpenRow(row.original) : true;\n\n return (\n <tr\n key={row.id}\n // One record in a collection, whichever way it is drawn: the card carries the same marker, and\n // automation (`wildo frontend look --record`, the browser lanes) finds \"a row\" by it. Without it\n // a collection shown as a TABLE read as having no rows to open.\n data-slot=\"resource-list-item\"\n className={cn(\n // Hover tint and pointer travel together with the behaviour: a row that opens\n // nothing must not advertise that it does.\n rowIsOpenable && (interactiveRecipe.states.hover || 'hover:bg-muted/30'),\n 'transition-colors motion-reduce:transition-none',\n rowIsOpenable && 'cursor-pointer',\n // The table container clips (`rounded-lg overflow-hidden`): the contract's INSET outline.\n rowIsOpenable && focusIndicatorClasses(FocusIndicatorShape.INSET),\n isRowSelected?.(row.original) && 'bg-primary/5',\n )}\n onClick={rowIsOpenable ? () => onRowClick(row.original) : undefined}\n role=\"row\"\n aria-selected={selectable ? (isRowSelected?.(row.original) ?? false) : undefined}\n tabIndex={rowIsOpenable ? 0 : undefined}\n onKeyDown={rowIsOpenable ? (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onRowClick(row.original);\n }\n } : undefined}\n >\n {row.getVisibleCells().map(cell => {\n // Control columns (select checkbox, per-row actions) never\n // truncate and stop BOTH click and keydown propagation so\n // their controls (mouse OR keyboard) don't also trigger the\n // row's navigation (the <tr> has an Enter/Space onKeyDown).\n const isControlColumn = cell.column.id === '__select' || cell.column.id === '__actions';\n return (\n <TableCell\n key={cell.id}\n className=\"px-card-sm py-element-sm text-foreground\"\n truncate={!isControlColumn}\n onClick={isControlColumn ? (e) => e.stopPropagation() : undefined}\n onKeyDown={isControlColumn ? (e) => e.stopPropagation() : undefined}\n >\n {renderColumnTemplate(cell.column.columnDef.cell, cell.getContext())}\n </TableCell>\n );\n })}\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n </div>\n </>\n );\n};\n"]}
1
+ {"version":3,"file":"ResourceCollectionBody_Table.js","sourceRoot":"","sources":["../../../../src/components/resources/ResourceCollectionBody_Table.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;AAEH,OAAc,EAAe,OAAO,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EACL,aAAa,EACb,eAAe,GAGhB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAChH,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,+DAA+D,CAAC;AAChH,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAC3I,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mEAAmE,CAAC;AAIvG,OAAO,EAAE,2BAA2B,EAAE,MAAM,sEAA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,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;wCAChC,2DAA2D;wCAC3D,0DAA0D;wCAC1D,4DAA4D;wCAC5D,4DAA4D;wCAC5D,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,UAAU,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,WAAW,CAAC;wCACxF,OAAO,CACL,KAAC,SAAS,IAER,SAAS,EAAC,0CAA0C,EACpD,QAAQ,EAAE,CAAC,eAAe,EAC1B,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,SAAS,EACjE,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,SAAS,YAElE,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,IAN/D,IAAI,CAAC,EAAE,CAOF,CACb,CAAC;oCACJ,CAAC,CAAC,IA9CG,GAAG,CAAC,EAAE,CA+CR,CACJ,CAAC;4BACJ,CAAC,CAAC,GACI,IACF,GACJ,GACF,GACL,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * ResourceCollectionBody_Table — the TABLE rendering of a resource collection.\n *\n * Presentational: it receives the already-fetched `items` plus the collection's\n * sort/selection state + handlers from the host, derives columns from the\n * resource's summary fields (schema-aware cells via {@link FieldValueRenderer}),\n * and renders a TanStack table with sortable headers (server-side), a selection\n * checkbox column, and a floating selected-count summary.\n *\n * Extracted from the former standalone `List_Table` preset so a single host can\n * swap between this body and the cards body at runtime (the cards↔table toggle)\n * without duplicating the data/fetch layer.\n */\n\nimport React, { useCallback, useMemo } from 'react';\nimport {\n useReactTable,\n getCoreRowModel,\n type ColumnDef,\n type ColumnDefTemplate,\n} from '@tanstack/react-table';\nimport { z } from 'zod';\nimport { useI18n } from '~wildo-frontend-lib/core/i18n/useI18n';\nimport { cn } from '~wildo-frontend-lib/core/ui/cn';\nimport { focusIndicatorClasses, FocusIndicatorShape } from '~wildo-frontend-lib/core/ui/themes/focus-indicator';\nimport { useIconRegistry } from '~wildo-frontend-lib/core/icons/useIconRegistry';\nimport { StandardIconReference, IconSize } from '~wildo-frontend-lib/core/icons/icon-registry.frontend.schemas';\nimport { useUI } from '~wildo-frontend-lib/core/ui/useUI';\nimport { ButtonSize, FrontendComponentType, InteractiveVariant, TypographyVariant, UIBehavior } from '@wildo-ai/presets-components-models';\nimport { Button, ButtonVariants_Variant } from '~wildo-frontend-lib/components/actions/button';\nimport { CheckboxRoot } from '~wildo-frontend-lib/components/form/controls/boolean/checkbox';\nimport { TableCell } from '~wildo-frontend-lib/components/sections/table';\nimport { FieldValueRenderer } from '~wildo-frontend-lib/components/resources/ResourceListItemRenderer';\nimport { AutomatedLayoutFrontendUtils } from '~wildo-frontend-lib/core/automated-layout/automated-layout.frontend.utils';\nimport type { AnyFrontendResourceConfiguration, FrontendResourceOperationContext } from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport type { SortState } from '~wildo-frontend-lib/components/resources/ResourceLayout_SortControl';\nimport { ResourceInPlaceOperationRow } from '~wildo-frontend-lib/components/resources/ResourceInPlaceOperationRow';\nimport { useInPlaceOperation } from '~wildo-frontend-lib/core/resources/in-place/InPlaceOperationContext';\nimport { FrontendResourceUtils } from '~wildo-frontend-lib/core/resources/frontend-resource.utils';\nimport type { NavigationZone } from '~wildo-frontend-lib/core/navigation/navigation.schemas';\nimport { activationStartedOnInnerControl } from '~wildo-frontend-lib/core/ui/inner-control-activation.utils';\n\ntype TableItem = Record<string, any>;\n\n/**\n * Render a column's header or cell template by CALLING it, never by mounting it.\n *\n * TanStack's `flexRender` mounts any function it is given as a component (`React.createElement(fn, props)`),\n * so the function's identity becomes the element's TYPE. This table builds its column definitions in a\n * `useMemo` over the host's inputs (sort, selection, the row-actions renderer…), and every rebuild hands\n * each cell a NEW function — a new component type — so React unmounted every cell's subtree and mounted a\n * fresh one. For a value cell that was only wasted work; for the row ACTIONS it was the whole state of the\n * row's action bar: the anchored panel a click had just opened, the confirmation it had just raised. The\n * action \"did nothing\" because what it did was discarded in the next render (#2057).\n *\n * Calling the template returns the element it describes — `<FieldValueRenderer>`, `<CheckboxRoot>`, the\n * host's row actions — whose types are stable, so React reconciles each cell in place across rebuilds. It is\n * safe because none of these templates calls a hook: each is a plain render function over its context.\n */\nfunction renderColumnTemplate<TContext extends object>(\n template: ColumnDefTemplate<TContext> | undefined,\n context: TContext,\n): React.ReactNode {\n if (template === undefined) return null;\n return typeof template === 'function' ? template(context) : template;\n}\n\nexport interface ResourceCollectionBody_TableProps {\n /** The fetched items to render as rows. */\n items: TableItem[];\n /** Resource type for i18n + cell formatting. */\n resourceType: string;\n /** Resource configuration — provides the main schema for column type detection. */\n resourceConfig: AnyFrontendResourceConfiguration;\n /**\n * The zone this table is rendered in — forwarded to the in-place operation body so a transformed\n * row hosts its operation in the same zone as every other host on this surface.\n */\n navigationZone: NavigationZone;\n /** Ordered summary fields → one column each. */\n summaryFields: string[];\n /**\n * The collection's resource identifiers (its route scope and parents). Each cell reads in its ROW's scope, built\n * from these and the row (`FieldValueRenderer`), so a reference in a cell is fetched where the row lives (#2347).\n */\n contextResourceIdentifiers: FrontendResourceOperationContext['contextResourceIdentifiers'] | undefined;\n /** Pre-resolved i18n field labels (column headers). */\n fieldLabelsMap: Record<string, string>;\n /** Sortable field names (sortable column headers). */\n sortFields: readonly string[];\n /** Active sort rules, highest priority first (drives the header indicators). */\n sortStates: readonly SortState[];\n /** Sort change handler (owned by the host; also resets pagination). */\n onSortChange: (sorts: SortState[]) => void;\n /**\n * Item-based selection, driven by the host's shared selection model (the SAME\n * model the CARDS checkboxes use, so a selection survives the cards↔table\n * toggle and feeds the bulk bar). When `selectable` is false the select column\n * is omitted entirely.\n */\n selectable?: boolean;\n /** Whether a given row's item is currently selected. */\n isRowSelected?: (item: TableItem) => boolean;\n /** Toggle a single row's item selection. */\n onToggleRow?: (item: TableItem) => void;\n /** Whether EVERY current-page item is selected (header checkbox state). */\n allSelected?: boolean;\n /** Toggle selection of every current-page item (header checkbox). */\n onToggleAll?: () => void;\n /**\n * Per-row actions rendered in a trailing column at the END of each row (parity\n * with the cards' per-item operations). Omit to render no actions column.\n */\n renderRowActions?: (item: TableItem) => React.ReactNode;\n /** Row click handler — navigates to the item's READ view. */\n onRowClick: (item: TableItem) => void;\n /**\n * Can THIS row be opened? Omitted means every row can.\n *\n * The row's whole interactive presentation — pointer, focusability, Enter/Space — is read off this\n * rather than off the presence of `onRowClick`, because `onRowClick` is one prop for the table\n * while openability is a property of the row. Without it the table promised a click on rows whose\n * READ resolves to no view, and answered nothing: the card's defect, one surface over.\n */\n canOpenRow?: (item: TableItem) => boolean;\n}\n\nexport const ResourceCollectionBody_Table = ({\n items,\n resourceType,\n resourceConfig,\n navigationZone,\n summaryFields,\n contextResourceIdentifiers,\n fieldLabelsMap,\n sortFields,\n sortStates,\n onSortChange,\n selectable = false,\n isRowSelected,\n onToggleRow,\n allSelected = false,\n onToggleAll,\n renderRowActions,\n onRowClick,\n canOpenRow,\n}: ResourceCollectionBody_TableProps): React.JSX.Element => {\n const { tComponent, tResourceFieldEnumValue } = useI18n({\n component: FrontendComponentType.RESOURCES_LAYOUTS_LIST,\n resource: resourceType,\n });\n const { renderIcon } = useIconRegistry();\n const inPlaceHost = useInPlaceOperation();\n const { getRecipe } = useUI();\n const interactiveRecipe = getRecipe(UIBehavior.INTERACTIVE, InteractiveVariant.GHOST);\n // Column headings name what is below them: the EYEBROW voice, as a record's fact tiles name their values.\n const eyebrowRecipe = getRecipe(UIBehavior.TYPOGRAPHY, TypographyVariant.EYEBROW);\n\n const schemaShape = useMemo(() => {\n // Columns span every row, so every field some row can hold (#2455): a variant column is typed too. A family's\n // `mainSchema` is its base object since #2414, not a discriminated union.\n return FrontendResourceUtils.resolveFieldShapeOfAnyVariant(resourceConfig) ?? null;\n }, [resourceConfig]);\n\n const sortableFieldsSet = useMemo(() => new Set(sortFields), [sortFields]);\n\n const columns = useMemo<ColumnDef<TableItem>[]>(() => {\n const cols: ColumnDef<TableItem>[] = [];\n\n // Select column — only when the view is selectable. Item-based (the host's\n // shared selection), not TanStack's internal row-selection model.\n if (selectable) {\n cols.push({\n id: '__select',\n header: () => (\n <CheckboxRoot\n checked={allSelected}\n onCheckedChange={() => onToggleAll?.()}\n aria-label={tComponent(FrontendComponentType.RESOURCES_LAYOUTS_LIST, 'selectAll')}\n />\n ),\n cell: ({ row }) => (\n <CheckboxRoot\n checked={isRowSelected?.(row.original) ?? false}\n onCheckedChange={() => onToggleRow?.(row.original)}\n aria-label={tComponent(FrontendComponentType.RESOURCES_LAYOUTS_LIST, 'selectRow', { row: row.index + 1 })}\n />\n ),\n size: 40,\n enableSorting: false,\n });\n }\n\n for (const fieldName of summaryFields) {\n const fieldSchema = schemaShape?.[fieldName] as z.ZodTypeAny | undefined;\n const isSortable = sortableFieldsSet.has(fieldName);\n const label = fieldLabelsMap[fieldName] || fieldName;\n\n cols.push({\n id: fieldName,\n accessorFn: (row) => row[fieldName],\n header: () => {\n if (!isSortable) return <span>{label}</span>;\n\n const ruleIndex = sortStates.findIndex((s) => s.field === fieldName);\n const isActiveSort = ruleIndex >= 0;\n const direction = isActiveSort ? sortStates[ruleIndex].direction : null;\n\n return (\n <Button\n type=\"button\"\n variant={ButtonVariants_Variant.GHOST}\n size={ButtonSize.SM}\n className=\"inline-flex items-center gap-1 text-start -ms-2 h-auto py-0.5 px-2 font-medium\"\n onClick={() => {\n // Cycle THIS column within the multi-sort, keeping the other rules\n // (priority = order added). Owned by the host (also resets page):\n // unsorted → append asc → desc → removed.\n if (ruleIndex < 0) {\n onSortChange([...sortStates, { field: fieldName, direction: 'asc' }]);\n } else if (sortStates[ruleIndex].direction === 'asc') {\n onSortChange(sortStates.map((s, i) => (i === ruleIndex ? { ...s, direction: 'desc' } : s)));\n } else {\n onSortChange(sortStates.filter((_, i) => i !== ruleIndex));\n }\n }}\n >\n {label}\n {isActiveSort && (\n <span className=\"inline-flex items-center gap-0.5 text-muted-foreground\" aria-hidden=\"true\">\n {renderIcon(\n direction === 'asc' ? StandardIconReference.CHEVRON_UP : StandardIconReference.CHEVRON_DOWN,\n { size: IconSize.XS },\n )}\n {sortStates.length > 1 && (\n <span className=\"text-[10px] font-semibold tabular-nums\">{ruleIndex + 1}</span>\n )}\n </span>\n )}\n </Button>\n );\n },\n cell: ({ row }) => (\n <FieldValueRenderer\n value={row.original[fieldName]}\n fieldSchema={fieldSchema}\n fieldLabel={undefined}\n resourceType={resourceType}\n record={row.original as Record<string, unknown>}\n collectionContextResourceIdentifiers={contextResourceIdentifiers}\n fieldName={fieldName}\n tResourceFieldEnumValue={tResourceFieldEnumValue}\n />\n ),\n });\n }\n\n // Trailing per-row actions column (at the END of the row). Right-aligned,\n // non-sortable, header label sr-only. The host supplies the same operations\n // bar the cards use via `renderRowActions`.\n if (renderRowActions) {\n cols.push({\n id: '__actions',\n header: () => (\n <span className=\"sr-only\">{tComponent(FrontendComponentType.RESOURCES_LAYOUTS_LIST, 'actionsColumn')}</span>\n ),\n cell: ({ row }) => (\n <div className=\"flex justify-end\">{renderRowActions(row.original)}</div>\n ),\n enableSorting: false,\n });\n }\n\n return cols;\n }, [selectable, allSelected, onToggleAll, isRowSelected, onToggleRow, renderRowActions, summaryFields, contextResourceIdentifiers, schemaShape, sortableFieldsSet, fieldLabelsMap, sortStates, onSortChange, resourceType, tResourceFieldEnumValue, tComponent, renderIcon]);\n\n const table = useReactTable({\n data: items,\n columns,\n getCoreRowModel: getCoreRowModel(),\n // Stable row id: resource id when present, else the row index (NOT a random\n // value — a fresh id per render would break keys + force re-renders).\n getRowId: (row, index) => String(row.id ?? row._id ?? index),\n // Sorting is server-side (the host re-fetches on sort change).\n manualSorting: true,\n });\n\n return (\n <>\n <div className=\"rounded-lg border border-border overflow-hidden\">\n <div className=\"overflow-x-auto\">\n {/* `data-slot=\"table\"`: this IS a data table, which is what a surface's embedded-table padding keys on. */}\n {/* `tabular-nums`: values here stand in COLUMNS, so every cell's figures take one width and a column of\n amounts or dates aligns (the DATA voice no longer sets it on a lone value, #3066). */}\n <table data-slot=\"table\" className=\"w-full text-sm tabular-nums\" aria-label={tComponent(FrontendComponentType.RESOURCES_LAYOUTS_LIST, 'listLabel')}>\n <thead className=\"bg-muted/50 border-b border-border\">\n {table.getHeaderGroups().map(headerGroup => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map(header => (\n <th\n key={header.id}\n className={cn(\"px-card-sm py-element-sm text-start\", eyebrowRecipe.base)}\n style={{ width: header.getSize() !== 150 ? header.getSize() : undefined }}\n >\n {header.isPlaceholder\n ? null\n : renderColumnTemplate(header.column.columnDef.header, header.getContext())}\n </th>\n ))}\n </tr>\n ))}\n </thead>\n <tbody className=\"divide-y divide-border\">\n {table.getRowModel().rows.map(row => {\n // A row being TRANSFORMED by an INLINE action replaces its cells with the operation\n // body, spanning the full width, and every other row stays exactly where it is.\n //\n // This is the SIBLING of the cards-mode swap in `ResourceLayout_List`, and it exists\n // because the two bodies are two call sites of one invariant: a view that offers a\n // cards↔table toggle would otherwise transform the row in one mode and open an\n // overlay in the other, from the same button.\n const rowId = FrontendResourceUtils.getResourceObjectId(\n row.original,\n resourceConfig.resourceFieldIdentifier as string,\n );\n if (inPlaceHost.isElementActive(rowId)) {\n return (\n <tr key={row.id} role=\"row\">\n <td colSpan={row.getVisibleCells().length} className=\"p-0\">\n <ResourceInPlaceOperationRow navigationZone={navigationZone} />\n </td>\n </tr>\n );\n }\n\n const rowIsOpenable = canOpenRow ? canOpenRow(row.original) : true;\n\n return (\n <tr\n key={row.id}\n // One record in a collection, whichever way it is drawn: the card carries the same marker, and\n // automation (`wildo frontend look --record`, the browser lanes) finds \"a row\" by it. Without it\n // a collection shown as a TABLE read as having no rows to open.\n data-slot=\"resource-list-item\"\n className={cn(\n // Hover tint and pointer travel together with the behaviour: a row that opens\n // nothing must not advertise that it does.\n rowIsOpenable && (interactiveRecipe.states.hover || 'hover:bg-muted/30'),\n 'transition-colors motion-reduce:transition-none',\n rowIsOpenable && 'cursor-pointer',\n // The table container clips (`rounded-lg overflow-hidden`): the contract's INSET outline.\n rowIsOpenable && focusIndicatorClasses(FocusIndicatorShape.INSET),\n isRowSelected?.(row.original) && 'bg-primary/5',\n )}\n // A control inside a cell (a reference to another record, a link) owns its own click and key: the row\n // opens its record only when the activation did not start on one (`activationStartedOnInnerControl`).\n onClick={rowIsOpenable ? (e) => { if (!activationStartedOnInnerControl(e)) onRowClick(row.original); } : undefined}\n role=\"row\"\n aria-selected={selectable ? (isRowSelected?.(row.original) ?? false) : undefined}\n tabIndex={rowIsOpenable ? 0 : undefined}\n onKeyDown={rowIsOpenable ? (e) => {\n if (activationStartedOnInnerControl(e)) return;\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onRowClick(row.original);\n }\n } : undefined}\n >\n {row.getVisibleCells().map(cell => {\n // Control columns (select checkbox, per-row actions) never\n // truncate and stop BOTH click and keydown propagation so\n // their controls (mouse OR keyboard) don't also trigger the\n // row's navigation (the <tr> has an Enter/Space onKeyDown).\n const isControlColumn = cell.column.id === '__select' || cell.column.id === '__actions';\n return (\n <TableCell\n key={cell.id}\n className=\"px-card-sm py-element-sm text-foreground\"\n truncate={!isControlColumn}\n onClick={isControlColumn ? (e) => e.stopPropagation() : undefined}\n onKeyDown={isControlColumn ? (e) => e.stopPropagation() : undefined}\n >\n {renderColumnTemplate(cell.column.columnDef.cell, cell.getContext())}\n </TableCell>\n );\n })}\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n </div>\n </>\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceLayout_DangerZone.d.ts","sourceRoot":"","sources":["../../../../src/components/resources/ResourceLayout_DangerZone.tsx"],"names":[],"mappings":"AAAA,OAAO,KA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,wBAAwB;IAC5F,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,gFAAgF;IAChF,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,uCAAuC,KAAK,IAAI,CAAC;IACnF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;OAQG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uCAAuC,GAAI,yGAOrD,4CAA4C,KAAG,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,IA0IrE,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,EAAE,MAAgC,EAAE,GAAG,KAAK,EAAE,EAAE,4CAA4C,GAAG,oBAAoB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAGhL"}
@@ -6,7 +6,7 @@ import { DangerZone } from '../../components/feedback/danger-zone.js';
6
6
  import { Text, Strong, TextVariant, TextSize } from '../../components/typography/text.js';
7
7
  import { OperationsConfirmCritical } from '../../components/feedback/operations-confirm-critical.js';
8
8
  import { useI18n } from '../../core/i18n/useI18n.js';
9
- import { responsiveMaxWidthToCssValue } from '../../components/sections/surface.js';
9
+ import { optionalMaxInlineSizeStyle } from '../../components/sections/surface.js';
10
10
  import { cn } from '../../core/ui/cn.js';
11
11
  import { useResourceOperationActions } from '../../core/resources/useResourceOperationActions.js';
12
12
  import { ActionPlacement } from '../../core/resources/resources.frontend.schemas.js';
@@ -95,7 +95,7 @@ export const ResourceLayoutPreset_DangerZone_Default = ({ resourceContext, navig
95
95
  // - `p-0` card + `px-card` rows — identical inset to the settings rows so the
96
96
  // "Reset to defaults" copy lines up with the fields above; per-row dividers
97
97
  // run full-bleed.
98
- _jsxs("section", { "data-slot": "danger-zone-section", "data-inline-size-tier": responsiveMaxWidth, className: cn('mr-auto w-full flex flex-col gap-field-sm', className), style: { maxInlineSize: responsiveMaxWidthToCssValue(responsiveMaxWidth) }, children: [_jsx(Heading, { level: 3, children: heading }), _jsx(DangerZone, { className: "rounded-xl p-0 overflow-hidden divide-y divide-destructive/20", children: rows.map((row, index) => (_jsxs("div", { className: "flex flex-col gap-field px-card py-card sm:flex-row sm:items-center sm:justify-between", children: [_jsxs("div", { className: "flex flex-col gap-element-xs", children: [_jsx(Strong, { children: row.label }), _jsx(Text, { variant: TextVariant.MUTED, size: TextSize.SM, children: describe(row) })] }), _jsx(Button, { variant: resolveDrawnActionVariant(row.variant, actionBarItemCannotRun(row)), disabled: row.disabled, onClick: row.onClick, className: "shrink-0 self-start sm:self-auto", children: row.label })] }, index))) }), isConfirmDialogOpen && (_jsx(OperationsConfirmCritical, { open: isConfirmDialogOpen, onOpenChange: (open) => { if (!open)
98
+ _jsxs("section", { "data-slot": "danger-zone-section", "data-inline-size-tier": responsiveMaxWidth, className: cn('mr-auto w-full flex flex-col gap-field-sm', className), style: optionalMaxInlineSizeStyle(responsiveMaxWidth), children: [_jsx(Heading, { level: 3, children: heading }), _jsx(DangerZone, { className: "rounded-xl p-0 overflow-hidden divide-y divide-destructive/20", children: rows.map((row, index) => (_jsxs("div", { className: "flex flex-col gap-field px-card py-card sm:flex-row sm:items-center sm:justify-between", children: [_jsxs("div", { className: "flex flex-col gap-element-xs", children: [_jsx(Strong, { children: row.label }), _jsx(Text, { variant: TextVariant.MUTED, size: TextSize.SM, children: describe(row) })] }), _jsx(Button, { variant: resolveDrawnActionVariant(row.variant, actionBarItemCannotRun(row)), disabled: row.disabled, onClick: row.onClick, className: "shrink-0 self-start sm:self-auto", "data-operation-id": row.operationIdentifier, children: row.label })] }, index))) }), isConfirmDialogOpen && (_jsx(OperationsConfirmCritical, { open: isConfirmDialogOpen, onOpenChange: (open) => { if (!open)
99
99
  onCancel(); }, cancelCallback: onCancel, validationCallback: onConfirm, label: confirmDialogLabel, description: confirmDialogDescription, confirmLabel: confirmDialogConfirmLabel, requireTypedConfirmation: confirmRequiresTypedConfirmation, confirmationPhrase: confirmConfirmationPhrase }))] }));
100
100
  };
101
101
  export function ResourceLayout_DangerZone({ preset = CorePresetNames.DEFAULT, ...props }) {