@object-ui/fields 17.3.0 → 17.6.0

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 (265) hide show
  1. package/CHANGELOG.md +1655 -0
  2. package/README.md +1 -12
  3. package/dist/FieldEditWidget.d.ts +23 -3
  4. package/dist/currency.d.ts +46 -0
  5. package/dist/field-type-alias.d.ts +35 -1
  6. package/dist/index.cjs +4 -4
  7. package/dist/index.css +651 -0
  8. package/dist/index.d.ts +474 -85
  9. package/dist/index.js +5418 -5023
  10. package/dist/widgets/AddressField.d.ts +4 -12
  11. package/dist/widgets/AutoNumberField.d.ts +1 -1
  12. package/dist/widgets/AvatarField.d.ts +1 -1
  13. package/dist/widgets/BooleanField.d.ts +1 -1
  14. package/dist/widgets/CapabilityMultiSelectField.d.ts +1 -1
  15. package/dist/widgets/CheckboxesField.d.ts +1 -1
  16. package/dist/widgets/CodeField.d.ts +1 -1
  17. package/dist/widgets/ColorField.d.ts +1 -1
  18. package/dist/widgets/CurrencyField.d.ts +1 -1
  19. package/dist/widgets/DateField.d.ts +1 -1
  20. package/dist/widgets/DateTimeField.d.ts +1 -1
  21. package/dist/widgets/EmailField.d.ts +1 -1
  22. package/dist/widgets/FileField.d.ts +18 -2
  23. package/dist/widgets/FilterConditionField.d.ts +28 -1
  24. package/dist/widgets/FormulaField.d.ts +1 -1
  25. package/dist/widgets/FullscreenFieldEditor.d.ts +49 -152
  26. package/dist/widgets/GeolocationField.d.ts +1 -1
  27. package/dist/widgets/GridField.d.ts +68 -6
  28. package/dist/widgets/ImageField.d.ts +1 -1
  29. package/dist/widgets/LocationField.d.ts +1 -1
  30. package/dist/widgets/LookupField.d.ts +1 -1
  31. package/dist/widgets/MasterDetailField.d.ts +1 -1
  32. package/dist/widgets/MultiSelectField.d.ts +1 -1
  33. package/dist/widgets/NumberField.d.ts +1 -1
  34. package/dist/widgets/ObjectField.d.ts +1 -1
  35. package/dist/widgets/ObjectRefField.d.ts +1 -1
  36. package/dist/widgets/OptionsEmptyState.d.ts +21 -1
  37. package/dist/widgets/PasswordField.d.ts +1 -1
  38. package/dist/widgets/PercentField.d.ts +1 -1
  39. package/dist/widgets/PhoneField.d.ts +1 -1
  40. package/dist/widgets/QRCodeField.d.ts +1 -1
  41. package/dist/widgets/RadioField.d.ts +1 -1
  42. package/dist/widgets/RatingField.d.ts +1 -1
  43. package/dist/widgets/RecipientPickerField.d.ts +1 -1
  44. package/dist/widgets/RecordPickerDialog.d.ts +34 -10
  45. package/dist/widgets/RichTextField.d.ts +37 -1
  46. package/dist/widgets/SelectField.d.ts +26 -6
  47. package/dist/widgets/SignatureField.d.ts +32 -2
  48. package/dist/widgets/SliderField.d.ts +37 -2
  49. package/dist/widgets/SummaryField.d.ts +1 -1
  50. package/dist/widgets/TagsField.d.ts +1 -1
  51. package/dist/widgets/TextAreaField.d.ts +6 -2
  52. package/dist/widgets/TextField.d.ts +1 -1
  53. package/dist/widgets/TimeField.d.ts +1 -1
  54. package/dist/widgets/UrlField.d.ts +1 -1
  55. package/dist/widgets/UserField.d.ts +1 -1
  56. package/dist/widgets/VectorField.d.ts +1 -1
  57. package/dist/widgets/_cell-renderer-bridge.d.ts +1 -1
  58. package/dist/widgets/address-format.d.ts +88 -0
  59. package/dist/widgets/file-size-guard.d.ts +41 -0
  60. package/dist/widgets/lookupColumnDisplay.d.ts +93 -0
  61. package/dist/widgets/nativeDateValue.d.ts +37 -0
  62. package/dist/widgets/richTextDisplay.d.ts +80 -0
  63. package/dist/widgets/toDomProps.d.ts +30 -10
  64. package/dist/widgets/toHostGroupProps.d.ts +189 -0
  65. package/dist/widgets/types.d.ts +8 -3
  66. package/dist/widgets/useRecordQuery.d.ts +7 -1
  67. package/package.json +17 -14
  68. package/dist/FieldEditWidget.test.d.ts +0 -8
  69. package/dist/__tests__/DateCellRenderer.test.d.ts +0 -0
  70. package/dist/__tests__/NumberCellRenderer.test.d.ts +0 -0
  71. package/dist/__tests__/cell-truncation.test.d.ts +0 -0
  72. package/dist/__tests__/field-carrier-sdui.test.d.ts +0 -0
  73. package/dist/__tests__/lookupCellDisplayField.test.d.ts +0 -0
  74. package/dist/__tests__/lookupCellDisplayName.test.d.ts +0 -0
  75. package/dist/__tests__/lookupCellReferenceKey.test.d.ts +0 -0
  76. package/dist/__tests__/registry-collision.test.d.ts +0 -0
  77. package/dist/__tests__/resolveFieldCurrency.test.d.ts +0 -1
  78. package/dist/__tests__/spec-symbol-batch7.test.d.ts +0 -8
  79. package/dist/__tests__/validation-feedback.test.d.ts +0 -0
  80. package/dist/__tests__/widget-aria-invalid-e2e.test.d.ts +0 -0
  81. package/dist/__tests__/widget-aria-invalid-registry-e2e.test.d.ts +0 -0
  82. package/dist/__tests__/widget-dom-leak-e2e.test.d.ts +0 -0
  83. package/dist/__tests__/widget-props-contract.test.d.ts +0 -8
  84. package/dist/coerce-safe-value.test.d.ts +0 -1
  85. package/dist/complex-widgets.test.d.ts +0 -1
  86. package/dist/datetime-widgets.test.d.ts +0 -1
  87. package/dist/field-type-coverage.test.d.ts +0 -1
  88. package/dist/standard-widgets.test.d.ts +0 -0
  89. package/dist/widgets/AddressField.uniqueIds.test.d.ts +0 -0
  90. package/dist/widgets/CapabilityMultiSelectField.test.d.ts +0 -0
  91. package/dist/widgets/CharacterCount.d.ts +0 -56
  92. package/dist/widgets/CheckboxesField.cascade.test.d.ts +0 -0
  93. package/dist/widgets/GeolocationField.uniqueIds.test.d.ts +0 -0
  94. package/dist/widgets/GridField.test.d.ts +0 -1
  95. package/dist/widgets/ImageLightbox.test.d.ts +0 -1
  96. package/dist/widgets/LookupField.dependsOn.test.d.ts +0 -8
  97. package/dist/widgets/LookupField.gateHintLabel.test.d.ts +0 -8
  98. package/dist/widgets/LookupField.hydration.test.d.ts +0 -1
  99. package/dist/widgets/LookupField.idField.test.d.ts +0 -1
  100. package/dist/widgets/MultiSelectField.cascade.test.d.ts +0 -0
  101. package/dist/widgets/OptionsEmptyState.no-provider.test.d.ts +0 -0
  102. package/dist/widgets/OptionsEmptyState.test.d.ts +0 -0
  103. package/dist/widgets/PeoplePicker.test.d.ts +0 -8
  104. package/dist/widgets/PeoplePickerComponents.test.d.ts +0 -8
  105. package/dist/widgets/RadioField.cascade.test.d.ts +0 -0
  106. package/dist/widgets/RecipientPickerField.test.d.ts +0 -0
  107. package/dist/widgets/RecordPickerDialog.filterOptions.test.d.ts +0 -8
  108. package/dist/widgets/RecordPickerDialog.selectLabel.test.d.ts +0 -8
  109. package/dist/widgets/SelectField.cascade.test.d.ts +0 -0
  110. package/dist/widgets/TagsField.placeholder.no-provider.test.d.ts +0 -0
  111. package/dist/widgets/TagsField.placeholder.test.d.ts +0 -0
  112. package/dist/widgets/UserFieldPicker.test.d.ts +0 -8
  113. package/dist/widgets/__tests__/FilterConditionField.matchAll.test.d.ts +0 -8
  114. package/dist/widgets/__tests__/FilterConditionField.operators.test.d.ts +0 -8
  115. package/dist/widgets/__tests__/FullscreenFieldEditor.i18n.test.d.ts +0 -0
  116. package/dist/widgets/__tests__/FullscreenFieldEditor.no-provider.test.d.ts +0 -0
  117. package/dist/widgets/__tests__/RichTextField.fullscreenDisabled.test.d.ts +0 -0
  118. package/dist/widgets/__tests__/RichTextField.mobileFullscreen.test.d.ts +0 -0
  119. package/dist/widgets/__tests__/TextAreaField.characterCount.announcements.test.d.ts +0 -0
  120. package/dist/widgets/__tests__/TextAreaField.characterCount.i18n.test.d.ts +0 -0
  121. package/dist/widgets/__tests__/TextAreaField.characterCount.no-provider.test.d.ts +0 -0
  122. package/dist/widgets/__tests__/TextAreaField.fullscreenCharacterCount.i18n.test.d.ts +0 -0
  123. package/dist/widgets/__tests__/TextAreaField.fullscreenCharacterCount.test.d.ts +0 -0
  124. package/dist/widgets/__tests__/TextAreaField.fullscreenDisabled.test.d.ts +0 -0
  125. package/dist/widgets/__tests__/TextAreaField.mobileFullscreen.test.d.ts +0 -0
  126. package/dist/widgets/deriveLookupColumns.test.d.ts +0 -1
  127. package/dist/widgets/file-value.test.d.ts +0 -1
  128. package/dist/widgets/personDisplay.test.d.ts +0 -8
  129. package/dist/widgets/recentLookups.test.d.ts +0 -1
  130. package/dist/widgets/useRecordQuery.test.d.ts +0 -8
  131. package/dist/widgets/useUploadingSignal.test.d.ts +0 -1
  132. package/src/FieldEditWidget.test.ts +0 -133
  133. package/src/FieldEditWidget.tsx +0 -191
  134. package/src/__tests__/DateCellRenderer.test.tsx +0 -73
  135. package/src/__tests__/NumberCellRenderer.test.tsx +0 -60
  136. package/src/__tests__/cell-truncation.test.tsx +0 -96
  137. package/src/__tests__/field-carrier-sdui.test.tsx +0 -169
  138. package/src/__tests__/lookupCellDisplayField.test.tsx +0 -107
  139. package/src/__tests__/lookupCellDisplayName.test.tsx +0 -119
  140. package/src/__tests__/lookupCellReferenceKey.test.tsx +0 -57
  141. package/src/__tests__/registry-collision.test.ts +0 -91
  142. package/src/__tests__/resolveFieldCurrency.test.ts +0 -20
  143. package/src/__tests__/spec-symbol-batch7.test.ts +0 -126
  144. package/src/__tests__/validation-feedback.test.tsx +0 -361
  145. package/src/__tests__/widget-aria-invalid-e2e.test.tsx +0 -265
  146. package/src/__tests__/widget-aria-invalid-registry-e2e.test.tsx +0 -338
  147. package/src/__tests__/widget-dom-leak-e2e.test.tsx +0 -598
  148. package/src/__tests__/widget-props-contract.test.tsx +0 -142
  149. package/src/coerce-safe-value.test.ts +0 -34
  150. package/src/complex-widgets.test.tsx +0 -908
  151. package/src/currency.ts +0 -14
  152. package/src/datetime-widgets.test.tsx +0 -93
  153. package/src/field-type-alias.ts +0 -100
  154. package/src/field-type-coverage.test.ts +0 -67
  155. package/src/index.tsx +0 -2503
  156. package/src/standard-widgets.test.tsx +0 -357
  157. package/src/widgets/AddressField.tsx +0 -132
  158. package/src/widgets/AddressField.uniqueIds.test.tsx +0 -92
  159. package/src/widgets/AutoNumberField.tsx +0 -18
  160. package/src/widgets/AvatarField.tsx +0 -117
  161. package/src/widgets/BooleanField.tsx +0 -52
  162. package/src/widgets/CapabilityMultiSelectField.test.tsx +0 -168
  163. package/src/widgets/CapabilityMultiSelectField.tsx +0 -229
  164. package/src/widgets/CharacterCount.tsx +0 -263
  165. package/src/widgets/CheckboxesField.cascade.test.tsx +0 -143
  166. package/src/widgets/CheckboxesField.tsx +0 -136
  167. package/src/widgets/CodeField.tsx +0 -41
  168. package/src/widgets/ColorField.tsx +0 -53
  169. package/src/widgets/CurrencyField.tsx +0 -95
  170. package/src/widgets/DateField.tsx +0 -31
  171. package/src/widgets/DateTimeField.tsx +0 -37
  172. package/src/widgets/EmailField.tsx +0 -37
  173. package/src/widgets/FileField.tsx +0 -494
  174. package/src/widgets/FilterConditionField.tsx +0 -454
  175. package/src/widgets/FormulaField.tsx +0 -33
  176. package/src/widgets/FullscreenFieldEditor.tsx +0 -271
  177. package/src/widgets/GeolocationField.tsx +0 -167
  178. package/src/widgets/GeolocationField.uniqueIds.test.tsx +0 -88
  179. package/src/widgets/GridField.test.tsx +0 -406
  180. package/src/widgets/GridField.tsx +0 -966
  181. package/src/widgets/ImageCropperDialog.tsx +0 -245
  182. package/src/widgets/ImageField.tsx +0 -255
  183. package/src/widgets/ImageLightbox.test.tsx +0 -52
  184. package/src/widgets/ImageLightbox.tsx +0 -108
  185. package/src/widgets/LocationField.tsx +0 -57
  186. package/src/widgets/LookupField.dependsOn.test.tsx +0 -233
  187. package/src/widgets/LookupField.gateHintLabel.test.tsx +0 -135
  188. package/src/widgets/LookupField.hydration.test.tsx +0 -136
  189. package/src/widgets/LookupField.idField.test.tsx +0 -61
  190. package/src/widgets/LookupField.tsx +0 -1291
  191. package/src/widgets/MarkdownContent.tsx +0 -19
  192. package/src/widgets/MasterDetailField.tsx +0 -131
  193. package/src/widgets/MultiSelectField.cascade.test.tsx +0 -143
  194. package/src/widgets/MultiSelectField.tsx +0 -142
  195. package/src/widgets/NumberField.tsx +0 -49
  196. package/src/widgets/ObjectField.tsx +0 -94
  197. package/src/widgets/ObjectRefField.tsx +0 -121
  198. package/src/widgets/OptionsEmptyState.no-provider.test.tsx +0 -88
  199. package/src/widgets/OptionsEmptyState.test.tsx +0 -169
  200. package/src/widgets/OptionsEmptyState.tsx +0 -83
  201. package/src/widgets/PasswordField.tsx +0 -49
  202. package/src/widgets/PeoplePicker.test.tsx +0 -360
  203. package/src/widgets/PeoplePicker.tsx +0 -579
  204. package/src/widgets/PeoplePickerComponents.test.tsx +0 -104
  205. package/src/widgets/PercentField.tsx +0 -95
  206. package/src/widgets/PersonRow.tsx +0 -117
  207. package/src/widgets/PhoneField.tsx +0 -37
  208. package/src/widgets/QRCodeField.tsx +0 -103
  209. package/src/widgets/RadioField.cascade.test.tsx +0 -141
  210. package/src/widgets/RadioField.tsx +0 -111
  211. package/src/widgets/RatingField.tsx +0 -81
  212. package/src/widgets/RecipientPickerField.test.tsx +0 -157
  213. package/src/widgets/RecipientPickerField.tsx +0 -188
  214. package/src/widgets/RecordPickerDialog.filterOptions.test.tsx +0 -611
  215. package/src/widgets/RecordPickerDialog.selectLabel.test.tsx +0 -112
  216. package/src/widgets/RecordPickerDialog.tsx +0 -1316
  217. package/src/widgets/RichTextField.tsx +0 -176
  218. package/src/widgets/SelectField.cascade.test.tsx +0 -138
  219. package/src/widgets/SelectField.tsx +0 -162
  220. package/src/widgets/SelectionTray.tsx +0 -110
  221. package/src/widgets/SignatureField.tsx +0 -140
  222. package/src/widgets/SliderField.tsx +0 -39
  223. package/src/widgets/SummaryField.tsx +0 -31
  224. package/src/widgets/TagsField.placeholder.no-provider.test.tsx +0 -68
  225. package/src/widgets/TagsField.placeholder.test.tsx +0 -95
  226. package/src/widgets/TagsField.tsx +0 -88
  227. package/src/widgets/TextAreaField.tsx +0 -213
  228. package/src/widgets/TextField.tsx +0 -45
  229. package/src/widgets/TimeField.tsx +0 -31
  230. package/src/widgets/UrlField.tsx +0 -46
  231. package/src/widgets/UserField.tsx +0 -58
  232. package/src/widgets/UserFieldPicker.test.tsx +0 -78
  233. package/src/widgets/VectorField.tsx +0 -29
  234. package/src/widgets/__tests__/FilterConditionField.matchAll.test.ts +0 -66
  235. package/src/widgets/__tests__/FilterConditionField.operators.test.ts +0 -142
  236. package/src/widgets/__tests__/FullscreenFieldEditor.i18n.test.tsx +0 -248
  237. package/src/widgets/__tests__/FullscreenFieldEditor.no-provider.test.tsx +0 -116
  238. package/src/widgets/__tests__/RichTextField.fullscreenDisabled.test.tsx +0 -244
  239. package/src/widgets/__tests__/RichTextField.mobileFullscreen.test.tsx +0 -195
  240. package/src/widgets/__tests__/TextAreaField.characterCount.announcements.test.tsx +0 -417
  241. package/src/widgets/__tests__/TextAreaField.characterCount.i18n.test.tsx +0 -287
  242. package/src/widgets/__tests__/TextAreaField.characterCount.no-provider.test.tsx +0 -160
  243. package/src/widgets/__tests__/TextAreaField.fullscreenCharacterCount.i18n.test.tsx +0 -161
  244. package/src/widgets/__tests__/TextAreaField.fullscreenCharacterCount.test.tsx +0 -346
  245. package/src/widgets/__tests__/TextAreaField.fullscreenDisabled.test.tsx +0 -246
  246. package/src/widgets/__tests__/TextAreaField.mobileFullscreen.test.tsx +0 -175
  247. package/src/widgets/_cell-renderer-bridge.ts +0 -19
  248. package/src/widgets/deriveLookupColumns.test.ts +0 -112
  249. package/src/widgets/deriveLookupColumns.ts +0 -108
  250. package/src/widgets/file-value.test.ts +0 -230
  251. package/src/widgets/file-value.ts +0 -246
  252. package/src/widgets/openNativePicker.ts +0 -18
  253. package/src/widgets/personDisplay.test.ts +0 -113
  254. package/src/widgets/personDisplay.ts +0 -92
  255. package/src/widgets/recentLookups.test.ts +0 -45
  256. package/src/widgets/recentLookups.ts +0 -47
  257. package/src/widgets/toDomProps.ts +0 -175
  258. package/src/widgets/types.ts +0 -242
  259. package/src/widgets/useCascadingOptions.ts +0 -46
  260. package/src/widgets/useFieldTranslation.ts +0 -150
  261. package/src/widgets/useRecordQuery.test.ts +0 -174
  262. package/src/widgets/useRecordQuery.ts +0 -264
  263. package/src/widgets/useUploadingSignal.test.tsx +0 -62
  264. package/src/widgets/useUploadingSignal.ts +0 -20
  265. package/src/withFieldCarrier.tsx +0 -75
@@ -1,175 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- import type { FieldWidgetComponentProps, FieldWidgetDomProps } from './types';
10
-
11
- /**
12
- * The RUNTIME EXECUTOR of the "DOM pass-through" section of
13
- * {@link FieldWidgetComponentProps} (objectui#3291).
14
- *
15
- * ## The defect
16
- *
17
- * Field widgets forwarded their leftover props to a control with a bare
18
- * spread — `const { inputType, ...domProps } = props as any; <Input
19
- * {...domProps} />`. Whatever a host handed the widget therefore became a DOM
20
- * attribute. Measured on `origin/main`, a real form + a real widget:
21
- *
22
- * ```
23
- * <input placeholder="PH-f" zzcanary="CANARY-STR" zzcanaryobj="[object Object]"
24
- * zzcanarynum="42" id="…" type="text" value="" name="f">
25
- * ```
26
- *
27
- * The `[object Object]` this issue is named for is an authored field-config
28
- * key being `String()`-ed onto an attribute. React 19 does not warn: an
29
- * all-lowercase unknown attribute is passed through in complete silence, which
30
- * is why this survived so long.
31
- *
32
- * ## Why a whitelist, and not a list of keys to drop
33
- *
34
- * The biggest leak source is not any NAMED renderer prop — it is the open tail
35
- * of author-supplied keys. The form renderer destructures a fixed set of known
36
- * keys and forwards `...fieldProps` verbatim
37
- * (`components/src/renderers/form/form.tsx`), and `SchemaRenderer` is wider
38
- * still: it spreads the whole authored node as props and has no strip layer at
39
- * all, so on the SDUI path a widget's own spread is the ONLY line of defence.
40
- *
41
- * A blacklist enumerating today's renderer-only keys (`error`, `emptyHint`,
42
- * `dataSource`, `dependentValues`, `dependsOn`, `options`, `inputType`, …)
43
- * would pass every one of the canaries above and would not stop the next
44
- * authored key either. Only "keep the known-safe set, drop the rest" closes
45
- * it, which is what this function does.
46
- *
47
- * ## Declared = enforced
48
- *
49
- * {@link FieldWidgetComponentProps} already DECLARES the closed set of keys a
50
- * widget may receive, and {@link FieldWidgetDomProps} names the subset that may
51
- * legitimately reach a DOM element (objectui#3221). Until now that was a
52
- * type-level claim a widget could violate at runtime simply by spreading. This
53
- * function is that declaration's executable form, and TWO compile-time
54
- * assertions below bind them in both directions — forwarding an undeclared key
55
- * and declaring an unforwarded DOM key are each a compile error. Neither
56
- * direction can drift silently.
57
- *
58
- * ## Deliberately NOT forwarded
59
- *
60
- * `role` and other HTML global attributes are absent because the contract does
61
- * not declare them. They reached the DOM before this change only through the
62
- * open spread. If a field node should be able to author one, DECLARE it on
63
- * `FieldWidgetComponentProps` first and add it here — do not reopen the spread
64
- * (AGENTS.md #0.1: fix the contract, never widen the consumer).
65
- */
66
- const DOM_PASS_THROUGH_KEYS = [
67
- /* ── The contract's own "DOM pass-through" block, verbatim ─────────────── */
68
- 'id',
69
- 'name',
70
- 'autoFocus',
71
- 'tabIndex',
72
- 'onBlur',
73
- 'onFocus',
74
- 'onClick',
75
-
76
- /* ── Two more declared keys that ARE valid DOM attributes ──────────────── */
77
- //
78
- // Both are declared on `FieldWidgetComponentProps` under the
79
- // controlled-input contract rather than the DOM block, because widgets also
80
- // INTERPRET them (`className` gets composed with the widget's own classes;
81
- // `disabled` is OR-ed with `readonly`). They are still `class` and
82
- // `disabled` on the element, and every widget here already forwards them.
83
- //
84
- // Withholding them would make this helper a silent styling- and
85
- // interactivity-dropper: `<Input {...toDomProps(props)} />` — the shape this
86
- // change teaches every future widget author to write — would quietly lose
87
- // the host's className and disabled state. That is a NEW silent failure of
88
- // exactly the kind the whitelist exists to prevent, so they are forwarded.
89
- 'className',
90
- 'disabled',
91
- ] as const;
92
-
93
- type DomPassThroughKey = (typeof DOM_PASS_THROUGH_KEYS)[number];
94
-
95
- /**
96
- * Compile-time link to the declaration, direction 1 of 2: every key forwarded
97
- * at runtime must exist on {@link FieldWidgetComponentProps}. Deleting a key
98
- * from the contract without deleting it here is a compile error.
99
- *
100
- * Catches: helper forwards something the contract no longer declares.
101
- */
102
- type EveryForwardedKeyIsDeclared =
103
- DomPassThroughKey extends keyof FieldWidgetComponentProps ? true : never;
104
- const _everyForwardedKeyIsDeclared: EveryForwardedKeyIsDeclared = true;
105
- void _everyForwardedKeyIsDeclared;
106
-
107
- /**
108
- * Direction 2 of 2: every key of {@link FieldWidgetDomProps} — the contract's
109
- * DOM pass-through block — must be one this helper actually forwards. Adding a
110
- * DOM key to the contract without adding it to `DOM_PASS_THROUGH_KEYS` is a
111
- * compile error.
112
- *
113
- * Catches: DECLARED BUT NOT DELIVERED — a key that type-checks, reads as
114
- * supported, and silently never reaches the element. That is the failure this
115
- * repo treats as first-class (objectui#3290's `aria-required` that never
116
- * reached a control; objectui#3222's validation slot nobody produced), and it
117
- * is the one direction the leak test structurally CANNOT see: that test looks
118
- * for attributes that arrive, not for ones that go missing.
119
- *
120
- * `className` / `disabled` are not part of `FieldWidgetDomProps` (they are
121
- * controlled-input keys this helper also forwards — see above), so they are
122
- * bound by direction 1 only. That is deliberate, not an oversight.
123
- */
124
- type EveryDeclaredDomKeyIsForwarded =
125
- keyof FieldWidgetDomProps extends DomPassThroughKey ? true : never;
126
- const _everyDeclaredDomKeyIsForwarded: EveryDeclaredDomKeyIsForwarded = true;
127
- void _everyDeclaredDomKeyIsForwarded;
128
-
129
- const DOM_PASS_THROUGH: ReadonlySet<string> = new Set<string>(DOM_PASS_THROUGH_KEYS);
130
-
131
- /**
132
- * `aria-*` is declared on the contract as React's `AriaAttributes`; `data-*`
133
- * is declared as an open template-literal family (open in HTML too, and the
134
- * only open family the contract has). Both are matched by prefix so the helper
135
- * needs no per-attribute list.
136
- */
137
- function isOpenDomFamily(key: string): boolean {
138
- return key.startsWith('data-') || key.startsWith('aria-');
139
- }
140
-
141
- /** The subset of `P` this helper forwards, with each key's declared type. */
142
- export type DomProps<P> = Pick<P, Extract<keyof P, DomPassThroughKey>> & {
143
- [K in Extract<keyof P, `data-${string}` | `aria-${string}`>]: P[K];
144
- };
145
-
146
- /**
147
- * Keep only what may legitimately become a DOM attribute, and drop everything
148
- * else — renderer plumbing, and any extra key an author put on the field
149
- * config or SDUI node.
150
- *
151
- * Replaces the bare `{...props}` spread in every field widget that renders a
152
- * host element:
153
- *
154
- * ```tsx
155
- * // before — forwards whatever it was handed
156
- * const { inputType, ...domProps } = props as any;
157
- * return <Input {...domProps} … />;
158
- *
159
- * // after
160
- * return <Input {...toDomProps(props)} … />;
161
- * ```
162
- *
163
- * Semantic props a widget INTERPRETS (`value`, `onChange`, `field`,
164
- * `readonly`, `error`, …) are read from `props` as before; this function only
165
- * governs what gets spread.
166
- */
167
- export function toDomProps<P extends object>(props: P): DomProps<P> {
168
- const domProps: Record<string, unknown> = {};
169
- for (const key of Object.keys(props)) {
170
- if (DOM_PASS_THROUGH.has(key) || isOpenDomFamily(key)) {
171
- domProps[key] = (props as Record<string, unknown>)[key];
172
- }
173
- }
174
- return domProps as DomProps<P>;
175
- }
@@ -1,242 +0,0 @@
1
- import type { AriaAttributes, FocusEventHandler, MouseEventHandler } from 'react';
2
- import type { DependsOnInput, FieldMetadata } from '@object-ui/types';
3
-
4
- /**
5
- * DOM pass-through: what a widget's `...props` spread may legitimately put on
6
- * the element it renders.
7
- *
8
- * A NAMED type rather than an inline block of {@link FieldWidgetComponentProps}
9
- * so the compiler can bind it to its runtime executor in BOTH directions
10
- * (objectui#3291). `toDomProps` asserts:
11
- *
12
- * - every key it forwards is declared on the widget contract — deleting one
13
- * here without deleting it there is a compile error;
14
- * - every key of THIS type is one it forwards — adding one here without
15
- * adding it to `DOM_PASS_THROUGH_KEYS` is a compile error too.
16
- *
17
- * The second direction is the one that matters for the failure mode this repo
18
- * treats as first-class: DECLARED BUT NOT DELIVERED (objectui#3290's
19
- * `aria-required` that never reached a control, objectui#3222's validation slot
20
- * nobody produced). Without it, a key added here would type-check, read as
21
- * supported, and silently never reach the DOM — and the leak test cannot see
22
- * that class of bug, because it looks for attributes that ARRIVE, not for ones
23
- * that go missing.
24
- *
25
- * `className` and `disabled` are deliberately NOT here. They are DOM-legal and
26
- * `toDomProps` does forward them, but they are declared on the controlled-input
27
- * block of {@link FieldWidgetComponentProps} because widgets also INTERPRET
28
- * them (className is composed with the widget's own classes; disabled is OR-ed
29
- * with readonly). They are therefore bound in the forward direction only.
30
- *
31
- * `AriaAttributes` and the `data-${string}` family are matched by prefix at
32
- * runtime rather than key-by-key, so they are intersected in separately.
33
- *
34
- * Adding a key here is a contract change: say who produces it and who reads it.
35
- */
36
- export type FieldWidgetDomProps = {
37
- id?: string;
38
- /** react-hook-form's field name, spread in by the form renderer. */
39
- name?: string;
40
- autoFocus?: boolean;
41
- tabIndex?: number;
42
- onBlur?: FocusEventHandler<HTMLElement>;
43
- onFocus?: FocusEventHandler<HTMLElement>;
44
- onClick?: MouseEventHandler<HTMLElement>;
45
- };
46
-
47
- /**
48
- * Props every field widget in this package receives at RUNTIME.
49
- *
50
- * Named `FieldWidgetComponentProps`, not `FieldWidgetProps` (objectui#3161,
51
- * objectstack#4115 ledger batch 7), adopting the name `@object-ui/app-shell`
52
- * settled on for the same split in objectui#3169: `@objectstack/spec/ui` owns
53
- * `FieldWidgetProps` for the DECLARED widget-plugin contract — a zod object
54
- * (`FieldWidgetPropsSchema`) a plugin manifest is validated against, with
55
- * `field` narrowed to `{ name?, label?, type: <the FieldType enum> }` and
56
- * `readonly` / `required` carrying `.default()`s. This is the React interface
57
- * the widgets in this directory actually implement, against
58
- * `@object-ui/types`'s much richer `FieldMetadata`.
59
- *
60
- * The two are NOT interchangeable, but they no longer disagree on the
61
- * validation slot: this type used to call it `errorMessage` while the spec
62
- * calls it `error`, so a widget written to the published contract read
63
- * `undefined` forever. objectui#3222 resolved that in the direction the
64
- * contract points — the slot below IS the spec's `error`, and the form
65
- * renderer now produces it (see `error`'s own doc comment). Reading
66
- * `props.required` off this type is still a compile error rather than a
67
- * silent `any`; that key is deliberately NOT lowered here (see below).
68
- *
69
- * ## Why `required` is still absent, though the spec declares it
70
- *
71
- * The required MARKER is drawn exactly once, by the form renderer's
72
- * `<FormLabel>` (the `*` with `aria-label="required"`, which the label
73
- * association folds into the control's accessible name). Handing `required`
74
- * to widgets would give that marker a second possible author, and the very
75
- * next AI-written widget draws its own asterisk — the same double-display
76
- * failure that keeps the validation TEXT out of the widget below. The a11y
77
- * state a widget genuinely could carry is `aria-required` on the input, and
78
- * that needs no new key at all: `AriaAttributes` is already part of this type
79
- * and every widget already forwards it to its control. Tracked separately;
80
- * do not add `required` here to "align" without that decision.
81
- *
82
- * ## Why there is no `[key: string]: any` (objectui#3221)
83
- *
84
- * This type used to end in an index signature, "load-bearing" for the widgets'
85
- * `...props` spreads. It was also why every drift above was invisible: **a type
86
- * that claims to have every key can never be reported as missing one** (the
87
- * objectstack#4075 mechanism). `props.required` and `props.error` were legal
88
- * reads typed `any` and always `undefined` at runtime; a misspelled prop
89
- * (`readOnly` for `readonly`, `onchange` for `onChange`) compiled; and any
90
- * structural/parity comparison against the type was useless *in principle*,
91
- * which is why the batch-7 symbol guard was the only detector that could see
92
- * the collision at all.
93
- *
94
- * It is replaced by the CLOSED set below: the controlled-input contract, the
95
- * host plumbing the form renderer genuinely forwards, and a DOM pass-through
96
- * allowance. `data-*` is an open family by design (it is open in HTML too) and
97
- * is expressed as a template-literal index signature, which — unlike
98
- * `[key: string]` — leaves `keyof` finite, so an undeclared prop still fails.
99
- *
100
- * ## Why there is no `schema` (objectui#3233)
101
- *
102
- * `schema` used to be declared here as a SECOND carrier for what `field`
103
- * already means — `SchemaRenderer` handed the SDUI node down as `schema`, the
104
- * form renderer forwarded `schema={props.field || props.schema || props}`
105
- * *alongside* `field`, and ~30 widgets resolved their config as
106
- * `field || schema`. One concept, two keys, two producers: exactly the
107
- * consumer-side tolerance AGENTS.md #0.1 forbids, and exactly the shape that
108
- * lets an AI-written widget pick the wrong spelling and still "work" under one
109
- * host while reading `undefined` under another.
110
- *
111
- * v17 converged it at the PRODUCERS. `field` is the only carrier a widget ever
112
- * sees; the SDUI node → `field` translation happens once, in this package's
113
- * registry adapter (`withFieldCarrier`), not ~30 times in the widgets. Reading
114
- * `props.schema` is now a compile error rather than a silent second contract.
115
- *
116
- * Adding a key here is a contract change: say who produces it and who reads it.
117
- */
118
- export type FieldWidgetComponentProps<T = any> = {
119
- /* ── The controlled-input contract every widget implements ─────────────── */
120
-
121
- value: T;
122
- onChange: (val: T) => void;
123
- /**
124
- * The field's metadata, and the SINGLE carrier for it (objectui#3233).
125
- *
126
- * Deliberately the looser `@object-ui/types` shape rather than the spec's,
127
- * to avoid a circular dependency for now.
128
- *
129
- * Every host produces it: the form renderer's `renderFieldComponent`, the
130
- * inline-edit hosts (`FieldEditWidget`), `ActionParamDialog` /
131
- * `BulkActionDialog`, and — since #3233 — the registry adapter that adapts
132
- * `SchemaRenderer`'s SDUI node onto this contract (`withFieldCarrier` in
133
- * `packages/fields/src/withFieldCarrier.tsx`). A widget reads `props.field`
134
- * and nothing else; there is no second key to check.
135
- */
136
- field: FieldMetadata;
137
- readonly?: boolean;
138
- disabled?: boolean;
139
- className?: string;
140
- /**
141
- * The active validation message for this field, named as
142
- * `@objectstack/spec/ui`'s `FieldWidgetPropsSchema` names it (objectui#3222).
143
- *
144
- * **Producer**: the form renderer, from react-hook-form's
145
- * `fieldState.error?.message` (`packages/components/src/renderers/form/
146
- * form.tsx`). Before #3222 nothing in the repo produced it under EITHER
147
- * spelling, so the seven widgets computing `aria-invalid={!!errorMessage}`
148
- * were computing it from a permanent `undefined` — `aria-invalid` was never
149
- * once set and a screen reader was never told the field had failed.
150
- *
151
- * **Consumer**: a widget reads this ONLY to drive `aria-invalid` on the
152
- * control it renders. The message TEXT stays with the form renderer's
153
- * `<FormMessage/>`; a widget that also renders it double-displays it.
154
- */
155
- error?: string;
156
- /**
157
- * Upload widgets (`file`/`image`) fire this when their in-progress state
158
- * flips, so a host can block submit until a presigned upload settles. Other
159
- * widgets ignore it.
160
- */
161
- onUploadingChange?: (uploading: boolean) => void;
162
-
163
- /* ── Host plumbing: what a rendering host actually forwards ─────────────── */
164
-
165
- /**
166
- * DataSource for widgets that query records (lookup / user / object-ref /
167
- * recipient-picker / grid). Injected by the form renderer for the field
168
- * types that need it, and passed directly by inline-edit hosts. Option
169
- * widgets destructure it purely to keep it off their DOM spread.
170
- *
171
- * Left structural (`unknown`): `@object-ui/fields` must not depend on a
172
- * concrete adapter — every consumer narrows it itself.
173
- */
174
- dataSource?: unknown;
175
- /**
176
- * Live sibling-field values driving cascading / role-gated options and
177
- * dependent lookups (ADR-0058, #2215/#2284). The form renderer passes the
178
- * in-progress record; widgets fall back to `SchemaRendererContext`.
179
- */
180
- dependentValues?: Record<string, unknown>;
181
- /**
182
- * Controlling field(s) that gate this field's option list. Normally declared
183
- * on the field metadata; accepted as a prop so a host can drive the gate for
184
- * a field it synthesised. Field metadata wins when both are present.
185
- */
186
- dependsOn?: DependsOnInput;
187
- /**
188
- * Controlling-field name → its human LABEL, for widgets that have to NAME a
189
- * sibling field in user-visible copy (the dependent-lookup gate hint).
190
- *
191
- * Only the form renderer knows a field's label — the widget sees its own
192
- * metadata and a `depends_on` list of API names. Without this map the gate
193
- * sentence interpolated the raw API name into every locale, `en` included
194
- * ("Select crm_account first"), which is an internal identifier leaking into
195
- * the UI, not merely an untranslated word (objectstack#5407). This is the
196
- * lookup-side counterpart of `emptyHint`, which the form already resolves to
197
- * labels for the fixed-option widgets. A name with no entry falls back to
198
- * itself, so a host that passes nothing renders exactly what it did before.
199
- */
200
- dependsOnLabels?: Record<string, string>;
201
- /**
202
- * Hint shown when an option list cannot be filled — typically a
203
- * dependency-gated list still waiting on its controlling field (#2284).
204
- * Forwarded by the form renderer, which resolves the controlling fields to
205
- * their human LABELS. **When supplied it wins**; the option widgets fall back
206
- * to their own translated copy only when a host computed none (objectui#3231
207
- * — they used to discard this prop and always render their own hardcoded
208
- * English). See `OptionsEmptyState`, the single consumer.
209
- */
210
- emptyHint?: string;
211
- /**
212
- * Render as a single-line, borderless control for a grid cell (the inline
213
- * editor and the line-item grid set it) instead of the full form layout.
214
- */
215
- compact?: boolean;
216
- /**
217
- * Receive the FULL selected record rather than just its id, so a host can
218
- * auto-fill sibling fields from it (a line-item grid copying a product's
219
- * price). When provided, the host owns the resulting value change.
220
- */
221
- onSelectRecord?: (record: Record<string, any>) => void;
222
- /**
223
- * Offer a "create new" affordance in a record picker, carrying whatever the
224
- * user had typed. Also declarable on the field metadata.
225
- */
226
- onCreateNew?: (searchQuery: string) => void;
227
-
228
- /* ── DOM pass-through ───────────────────────────────────────────────────── */
229
- //
230
- // Lives in the named {@link FieldWidgetDomProps} above, because that is what
231
- // lets the compiler bind the declaration to `toDomProps` — its runtime
232
- // executor — in BOTH directions (objectui#3291). Add a DOM key THERE, not
233
- // here, and the compiler will make you add it to the whitelist too.
234
- } & FieldWidgetDomProps & AriaAttributes & {
235
- /**
236
- * Arbitrary `data-*` attributes (test ids, analytics hooks). Open by design,
237
- * but a template-literal key — `keyof` stays finite, so this does NOT
238
- * reintroduce the index signature objectui#3221 removed: `props.required`
239
- * is still an error, `props['data-testid']` is still fine.
240
- */
241
- [dataAttribute: `data-${string}`]: string | number | boolean | undefined;
242
- };
@@ -1,46 +0,0 @@
1
- import { useContext, useMemo } from 'react';
2
- import {
3
- resolveCascadingOptions,
4
- type CascadingOptions,
5
- type OptionLike,
6
- type DependsOnInput,
7
- } from '@object-ui/core';
8
- import { SchemaRendererContext, usePredicateScope } from '@object-ui/react';
9
-
10
- /**
11
- * Shared per-option cascading / role-gating resolution for the option widgets
12
- * (`SelectField` single, `MultiSelectField`, `RadioField`) — the client half of
13
- * ADR-0058 (#2284). Each option may carry a `visibleWhen` CEL predicate; the
14
- * offered set narrows against the live form record (`record.country == 'cn'`) +
15
- * the global predicate scope (`'admin' in current_user.positions`). A field
16
- * declares which sibling fields drive its list via `dependsOn`; while any is
17
- * empty the list is *gated* — callers surface a "select the parent first" hint
18
- * rather than an unfiltered set, mirroring the dependent-lookup UX.
19
- *
20
- * This is the React wrapper that sources `record` (the live form values) and the
21
- * predicate scope from context; the actual resolution is the pure
22
- * {@link resolveCascadingOptions} in `@object-ui/core`, shared with the form
23
- * renderer so gating/filtering can never drift between them (#2715).
24
- */
25
- export type CascadingOptionsResult<T extends OptionLike> = CascadingOptions<T>;
26
-
27
- export function useCascadingOptions<T extends OptionLike>(
28
- rawOptions: readonly T[],
29
- dependsOn: DependsOnInput,
30
- dependentValues: Record<string, unknown> | undefined,
31
- ): CascadingOptionsResult<T> {
32
- // Live form values for cascading options — injected by the form renderer as
33
- // `dependentValues` (same channel dependent lookups use), falling back to the
34
- // record on SchemaRendererContext. `current_user` etc. come from the global
35
- // predicate scope so role/context predicates resolve too.
36
- const ctx = useContext(SchemaRendererContext) as any;
37
- const record = useMemo<Record<string, unknown>>(() => {
38
- return (dependentValues ?? ctx?.formValues ?? ctx?.data ?? {}) as Record<string, unknown>;
39
- }, [dependentValues, ctx?.formValues, ctx?.data]);
40
- const predicateScope = usePredicateScope();
41
-
42
- return useMemo(
43
- () => resolveCascadingOptions(rawOptions, record, dependsOn, predicateScope),
44
- [rawOptions, record, dependsOn, predicateScope],
45
- );
46
- }
@@ -1,150 +0,0 @@
1
- /**
2
- * Safe translation hook for field widgets.
3
- * Falls back to English defaults when no I18nProvider is available.
4
- */
5
- import { createSafeTranslation } from '@object-ui/i18n';
6
-
7
- const FIELD_DEFAULTS: Record<string, string> = {
8
- 'common.selectOption': 'Select an option',
9
- 'common.select': 'Select...',
10
- 'common.search': 'Search',
11
- 'common.loading': 'Loading...',
12
- 'common.noResults': 'No results found',
13
- 'common.cancel': 'Cancel',
14
- 'common.confirm': 'Confirm',
15
- 'table.selected': '{{count}} selected',
16
- 'table.search': 'Search...',
17
- 'lookup.loading': 'Loading…',
18
- 'lookup.noOptions': 'No options found',
19
- 'lookup.noRecords': 'No records found',
20
- 'lookup.recentlyUsed': 'Recently used',
21
- 'lookup.allResults': 'All results',
22
- 'lookup.createNew': 'Create new',
23
- 'lookup.createNamed': 'Create new "{{name}}"',
24
- 'lookup.showingResults': 'Showing {{shown}} of {{total}} results',
25
- 'lookup.showAllResults': 'Show all results ({{count}})',
26
- 'lookup.selectedBadge': 'Selected',
27
- 'lookup.browseAll': 'Browse all records',
28
- 'lookup.remove': 'Remove {{label}}',
29
- 'lookup.selectFirst': 'Select {{fields}} first',
30
- 'lookup.selectRecord': 'Select record',
31
- 'lookup.recordCount': '{{count}} records',
32
- 'lookup.recordCountOne': '1 record',
33
- 'lookup.pageOf': 'Page {{current}} of {{total}}',
34
- 'lookup.filters': 'Filters',
35
- 'lookup.clear': 'Clear',
36
- 'lookup.yes': 'Yes',
37
- 'lookup.filterPlaceholder': 'Filter {{label}}',
38
- 'lookup.prevPage': 'Previous page',
39
- 'lookup.nextPage': 'Next page',
40
- 'lookup.jumpToPage': 'Jump to page',
41
- 'lookup.retry': 'Retry',
42
- // objectui#3231 — the empty / dependency-gated state of the fixed-option
43
- // widgets (select, multiselect, radio, checkboxes). Only used when the host
44
- // supplies no `emptyHint`; the gate sentence shares its key with the form
45
- // renderer so both cannot drift apart in a locale.
46
- 'fields.options.empty': 'No options available',
47
- 'fields.options.selectFirst': 'Select {{fields}} first',
48
- // objectstack#3821 — sharing-rule authoring widgets (object-ref /
49
- // recipient-picker / filter-condition). The recipient placeholder is keyed
50
- // PER TYPE rather than interpolating the enum value into an English
51
- // sentence, which no locale could translate.
52
- 'fields.objectRef.loading': 'Loading objects…',
53
- 'fields.objectRef.placeholder': 'Select an object',
54
- 'fields.objectRef.search': 'Search objects…',
55
- 'fields.objectRef.empty': 'No objects found',
56
- 'fields.recipient.selectTypeFirst': 'Select a recipient type first.',
57
- 'fields.recipient.loading': 'Loading…',
58
- 'fields.recipient.search': 'Search…',
59
- 'fields.recipient.empty': 'No matches',
60
- 'fields.recipient.select': 'Select a recipient',
61
- 'fields.recipient.selectUser': 'Select a user',
62
- 'fields.recipient.selectTeam': 'Select a team',
63
- 'fields.recipient.selectBusinessUnit': 'Select a business unit',
64
- 'fields.recipient.selectPosition': 'Select a position',
65
- 'fields.recipient.selectUnitAndSubordinates': 'Select a business unit',
66
- 'fields.filterCondition.selectObjectFirst': 'Select an object first.',
67
- // objectstack#3896 — this used to be 'All records'. An empty criteria never
68
- // meant "share everything"; it meant the predicate was missing, and the
69
- // sharing evaluator failed open on it. Such a rule is now refused on save
70
- // and shares nothing, so say that rather than advertise the old bug.
71
- 'fields.filterCondition.noCriteria': 'No criteria — this rule shares nothing',
72
- 'fields.filterCondition.criteriaRequired':
73
- 'Add at least one condition. A rule with no criteria would share every record, so it cannot be saved.',
74
- 'fields.filterCondition.invalidJson': 'Invalid JSON — the rule will match no records until fixed.',
75
- 'fields.filterCondition.jsonOnly': 'This criteria can only be edited as JSON',
76
- 'fields.filterCondition.editAsJson': 'Edit as JSON',
77
- 'fields.filterCondition.useVisualBuilder': 'Use visual builder',
78
- // objectui#3342 — the tags widget's input hint. Used only when the field
79
- // author declared no `placeholder` of their own (author declaration wins).
80
- 'fields.tags.placeholder': 'Type and press Enter to add…',
81
- // objectui#3406 — the accessible name of `TextAreaField`'s character
82
- // counter, rendered only when the field declares `maxLength`. The visible
83
- // `{n}/{max}` is digits; this sentence is what a screen reader speaks, and
84
- // the element is `aria-live`, so before the key existed a non-English
85
- // session heard English on every keystroke. Byte-identical to the literal
86
- // it replaces, so a no-provider render is unchanged.
87
- 'fields.textarea.characterCount': 'Character count: {{count}} of {{max}}',
88
- // objectui#3408 — the NEAR-LIMIT warning, spoken by the counter's status
89
- // region after the typist pauses and only once they are inside the last 10%
90
- // (or last 20 characters) of the cap. The sentence above became the field's
91
- // `aria-describedby` description in the same change; this one is the only
92
- // thing that is ever announced mid-typing, which is why it says what is
93
- // LEFT rather than repeating the whole count.
94
- //
95
- // Colon form, not "You have {{count}} characters remaining": `count` makes
96
- // i18next attempt plural lookup (`_one` / `_few` / …) before the base key,
97
- // and these packs declare the base key only — the same base-key fallback
98
- // `characterCount` already relies on. A sentence whose grammar does not
99
- // depend on the number stays correct at 1 without ten plural entries per
100
- // pack, and matches the sibling key's shape.
101
- 'fields.textarea.charactersRemaining': 'Characters remaining: {{count}}',
102
- // objectui#3404 — the shared fullscreen long-text dialog
103
- // (`FullscreenFieldEditor`, reached from `TextAreaField` and
104
- // `RichTextField` when `mobile_fullscreen` is set).
105
- //
106
- // Deliberately the SAME `form.fullscreen.*` / `common.cancel` keys the
107
- // built-in branch consumes (`FullscreenTextarea` in
108
- // `components/src/renderers/form/form.tsx`, objectui#3272) rather than
109
- // `fields.fullscreen.*` twins. One form-level setting
110
- // (`ObjectFormSchema.mobile.fullscreenLongText`) projects onto BOTH render
111
- // paths inside a single form, so a second copy of this copy is guaranteed
112
- // drift — the shape #3231/#3263 had to undo — and would mean editing ten
113
- // locale packs to say what they already say. `common.cancel` is already
114
- // declared above and is reused here for exactly that reason.
115
- //
116
- // The values are byte-identical to the English literals they replaced, so
117
- // a widget rendered with no I18nProvider (standalone/embedded hosts, and
118
- // every bare-render test in this package) shows what it always did instead
119
- // of a raw key. Measured before the change: with no provider mounted, bare
120
- // `useObjectTranslation().t` returns the key itself
121
- // (`common.cancel` → "common.cancel"), which is why this goes through
122
- // `createSafeTranslation` like the built-in branch does.
123
- 'form.fullscreen.title': 'Edit text',
124
- 'form.fullscreen.description': 'Edit the full text value, then save or cancel your changes.',
125
- 'form.fullscreen.done': 'Done',
126
- // Kept as ONE interpolated sentence with a translated generic noun standing
127
- // in for a missing label — the literal's own shape
128
- // (`Edit ${label ?? 'text'} fullscreen`). A second, label-less sentence key
129
- // would need ten new pack entries to say the same thing.
130
- 'form.fullscreen.toggle': 'Edit {{label}} fullscreen',
131
- 'form.fullscreen.textFallback': 'text',
132
- // objectui#2600 B5 — capability picker scope group headers.
133
- 'capability.group.platform': 'Platform',
134
- 'capability.group.org': 'Organization',
135
- 'capability.group.other': 'Other',
136
- // objectui#2600 B5 — curated platform capability labels (registry serves
137
- // English; dots in the api-name become underscores in the key).
138
- 'capability.label.manage_users': 'Manage Users',
139
- 'capability.label.manage_org_users': 'Manage Organization Users',
140
- 'capability.label.manage_metadata': 'Manage Metadata',
141
- 'capability.label.manage_platform_settings': 'Manage Platform Settings',
142
- 'capability.label.setup_access': 'Setup Access',
143
- 'capability.label.setup_write': 'Write Settings',
144
- 'capability.label.studio_access': 'Studio Access',
145
- };
146
-
147
- export const useFieldTranslation = createSafeTranslation(
148
- FIELD_DEFAULTS,
149
- 'common.selectOption',
150
- );