@genesislcap/ai-assistant 15.70.0 → 15.71.0-FUI-2650.1

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 (139) hide show
  1. package/dist/ai-assistant.api.json +97 -0
  2. package/dist/ai-assistant.d.ts +65 -0
  3. package/dist/chat-driver.cjs +18031 -0
  4. package/dist/chat-driver.cjs.map +4 -4
  5. package/dist/chat-driver.mjs +18024 -0
  6. package/dist/chat-driver.mjs.map +4 -4
  7. package/dist/custom-elements.json +9287 -6447
  8. package/dist/dts/chat-driver-node.d.ts +2 -0
  9. package/dist/dts/chat-driver-node.d.ts.map +1 -1
  10. package/dist/dts/code-review/code-review.types.d.ts +76 -0
  11. package/dist/dts/code-review/code-review.types.d.ts.map +1 -0
  12. package/dist/dts/code-review/code-reviewer.agent.d.ts +77 -0
  13. package/dist/dts/code-review/code-reviewer.agent.d.ts.map +1 -0
  14. package/dist/dts/code-review/code-reviewer.prompt.d.ts +23 -0
  15. package/dist/dts/code-review/code-reviewer.prompt.d.ts.map +1 -0
  16. package/dist/dts/code-review/gate.d.ts +44 -0
  17. package/dist/dts/code-review/gate.d.ts.map +1 -0
  18. package/dist/dts/code-review/index.d.ts +27 -0
  19. package/dist/dts/code-review/index.d.ts.map +1 -0
  20. package/dist/dts/code-review/review-changes.d.ts +70 -0
  21. package/dist/dts/code-review/review-changes.d.ts.map +1 -0
  22. package/dist/dts/code-review/rules/context-trigger-map.d.ts +6 -0
  23. package/dist/dts/code-review/rules/context-trigger-map.d.ts.map +1 -0
  24. package/dist/dts/code-review/rules/context.registry.d.ts +123 -0
  25. package/dist/dts/code-review/rules/context.registry.d.ts.map +1 -0
  26. package/dist/dts/code-review/rules/fui-ai-extensions.d.ts +13 -0
  27. package/dist/dts/code-review/rules/fui-ai-extensions.d.ts.map +1 -0
  28. package/dist/dts/code-review/rules/fui-blotter.d.ts +16 -0
  29. package/dist/dts/code-review/rules/fui-blotter.d.ts.map +1 -0
  30. package/dist/dts/code-review/rules/fui-chart.d.ts +20 -0
  31. package/dist/dts/code-review/rules/fui-chart.d.ts.map +1 -0
  32. package/dist/dts/code-review/rules/fui-column-defs.d.ts +21 -0
  33. package/dist/dts/code-review/rules/fui-column-defs.d.ts.map +1 -0
  34. package/dist/dts/code-review/rules/fui-components.d.ts +9 -0
  35. package/dist/dts/code-review/rules/fui-components.d.ts.map +1 -0
  36. package/dist/dts/code-review/rules/fui-criteria.d.ts +32 -0
  37. package/dist/dts/code-review/rules/fui-criteria.d.ts.map +1 -0
  38. package/dist/dts/code-review/rules/fui-custom-renderer.d.ts +15 -0
  39. package/dist/dts/code-review/rules/fui-custom-renderer.d.ts.map +1 -0
  40. package/dist/dts/code-review/rules/fui-dashboard.d.ts +19 -0
  41. package/dist/dts/code-review/rules/fui-dashboard.d.ts.map +1 -0
  42. package/dist/dts/code-review/rules/fui-dialogs.d.ts +19 -0
  43. package/dist/dts/code-review/rules/fui-dialogs.d.ts.map +1 -0
  44. package/dist/dts/code-review/rules/fui-entity-management.d.ts +19 -0
  45. package/dist/dts/code-review/rules/fui-entity-management.d.ts.map +1 -0
  46. package/dist/dts/code-review/rules/fui-error-boundary.d.ts +9 -0
  47. package/dist/dts/code-review/rules/fui-error-boundary.d.ts.map +1 -0
  48. package/dist/dts/code-review/rules/fui-eventing.d.ts +8 -0
  49. package/dist/dts/code-review/rules/fui-eventing.d.ts.map +1 -0
  50. package/dist/dts/code-review/rules/fui-flexlayout.d.ts +17 -0
  51. package/dist/dts/code-review/rules/fui-flexlayout.d.ts.map +1 -0
  52. package/dist/dts/code-review/rules/fui-flyout-panel.d.ts +10 -0
  53. package/dist/dts/code-review/rules/fui-flyout-panel.d.ts.map +1 -0
  54. package/dist/dts/code-review/rules/fui-form-component.d.ts +9 -0
  55. package/dist/dts/code-review/rules/fui-form-component.d.ts.map +1 -0
  56. package/dist/dts/code-review/rules/fui-formatters.d.ts +12 -0
  57. package/dist/dts/code-review/rules/fui-formatters.d.ts.map +1 -0
  58. package/dist/dts/code-review/rules/fui-foundation-comms.d.ts +10 -0
  59. package/dist/dts/code-review/rules/fui-foundation-comms.d.ts.map +1 -0
  60. package/dist/dts/code-review/rules/fui-global-filters.d.ts +33 -0
  61. package/dist/dts/code-review/rules/fui-global-filters.d.ts.map +1 -0
  62. package/dist/dts/code-review/rules/fui-import-surface.d.ts +37 -0
  63. package/dist/dts/code-review/rules/fui-import-surface.d.ts.map +1 -0
  64. package/dist/dts/code-review/rules/fui-inline-editing.d.ts +10 -0
  65. package/dist/dts/code-review/rules/fui-inline-editing.d.ts.map +1 -0
  66. package/dist/dts/code-review/rules/fui-layout.d.ts +7 -0
  67. package/dist/dts/code-review/rules/fui-layout.d.ts.map +1 -0
  68. package/dist/dts/code-review/rules/fui-notifications.d.ts +12 -0
  69. package/dist/dts/code-review/rules/fui-notifications.d.ts.map +1 -0
  70. package/dist/dts/code-review/rules/fui-primitives.d.ts +26 -0
  71. package/dist/dts/code-review/rules/fui-primitives.d.ts.map +1 -0
  72. package/dist/dts/code-review/rules/fui-rapid-grid-pro.d.ts +18 -0
  73. package/dist/dts/code-review/rules/fui-rapid-grid-pro.d.ts.map +1 -0
  74. package/dist/dts/code-review/rules/fui-redux-store.d.ts +8 -0
  75. package/dist/dts/code-review/rules/fui-redux-store.d.ts.map +1 -0
  76. package/dist/dts/code-review/rules/fui-reporting.d.ts +19 -0
  77. package/dist/dts/code-review/rules/fui-reporting.d.ts.map +1 -0
  78. package/dist/dts/code-review/rules/fui-styling.d.ts +15 -0
  79. package/dist/dts/code-review/rules/fui-styling.d.ts.map +1 -0
  80. package/dist/dts/code-review/rules/fui-trade-form.d.ts +13 -0
  81. package/dist/dts/code-review/rules/fui-trade-form.d.ts.map +1 -0
  82. package/dist/dts/code-review/submit-code-review.tool.d.ts +12 -0
  83. package/dist/dts/code-review/submit-code-review.tool.d.ts.map +1 -0
  84. package/dist/dts/code-review/unified-diff.d.ts +7 -0
  85. package/dist/dts/code-review/unified-diff.d.ts.map +1 -0
  86. package/dist/dts/code-review/verdict.d.ts +23 -0
  87. package/dist/dts/code-review/verdict.d.ts.map +1 -0
  88. package/dist/dts/components/code-review-result/code-review-result.d.ts +26 -0
  89. package/dist/dts/components/code-review-result/code-review-result.d.ts.map +1 -0
  90. package/dist/dts/index.d.ts +1 -0
  91. package/dist/dts/index.d.ts.map +1 -1
  92. package/dist/dts/react.d.ts +10 -0
  93. package/dist/esm/chat-driver-node.js +6 -0
  94. package/dist/esm/code-review/code-review.types.js +6 -0
  95. package/dist/esm/code-review/code-reviewer.agent.js +167 -0
  96. package/dist/esm/code-review/code-reviewer.prompt.js +103 -0
  97. package/dist/esm/code-review/gate.js +93 -0
  98. package/dist/esm/code-review/index.js +28 -0
  99. package/dist/esm/code-review/review-changes.js +123 -0
  100. package/dist/esm/code-review/rules/context-trigger-map.js +20 -0
  101. package/dist/esm/code-review/rules/context.registry.js +772 -0
  102. package/dist/esm/code-review/rules/fui-ai-extensions.js +306 -0
  103. package/dist/esm/code-review/rules/fui-blotter.js +596 -0
  104. package/dist/esm/code-review/rules/fui-chart.js +669 -0
  105. package/dist/esm/code-review/rules/fui-column-defs.js +862 -0
  106. package/dist/esm/code-review/rules/fui-components.js +245 -0
  107. package/dist/esm/code-review/rules/fui-criteria.js +538 -0
  108. package/dist/esm/code-review/rules/fui-custom-renderer.js +612 -0
  109. package/dist/esm/code-review/rules/fui-dashboard.js +604 -0
  110. package/dist/esm/code-review/rules/fui-dialogs.js +588 -0
  111. package/dist/esm/code-review/rules/fui-entity-management.js +1014 -0
  112. package/dist/esm/code-review/rules/fui-error-boundary.js +244 -0
  113. package/dist/esm/code-review/rules/fui-eventing.js +628 -0
  114. package/dist/esm/code-review/rules/fui-flexlayout.js +860 -0
  115. package/dist/esm/code-review/rules/fui-flyout-panel.js +432 -0
  116. package/dist/esm/code-review/rules/fui-form-component.js +898 -0
  117. package/dist/esm/code-review/rules/fui-formatters.js +415 -0
  118. package/dist/esm/code-review/rules/fui-foundation-comms.js +518 -0
  119. package/dist/esm/code-review/rules/fui-global-filters.js +778 -0
  120. package/dist/esm/code-review/rules/fui-import-surface.js +452 -0
  121. package/dist/esm/code-review/rules/fui-inline-editing.js +445 -0
  122. package/dist/esm/code-review/rules/fui-layout.js +431 -0
  123. package/dist/esm/code-review/rules/fui-notifications.js +439 -0
  124. package/dist/esm/code-review/rules/fui-primitives.js +1216 -0
  125. package/dist/esm/code-review/rules/fui-rapid-grid-pro.js +650 -0
  126. package/dist/esm/code-review/rules/fui-redux-store.js +522 -0
  127. package/dist/esm/code-review/rules/fui-reporting.js +506 -0
  128. package/dist/esm/code-review/rules/fui-styling.js +1229 -0
  129. package/dist/esm/code-review/rules/fui-trade-form.js +618 -0
  130. package/dist/esm/code-review/submit-code-review.tool.js +43 -0
  131. package/dist/esm/code-review/unified-diff.js +96 -0
  132. package/dist/esm/code-review/verdict.js +24 -0
  133. package/dist/esm/components/code-review-result/code-review-result.js +89 -0
  134. package/dist/esm/index.js +3 -0
  135. package/dist/react.cjs +7 -0
  136. package/dist/react.mjs +6 -0
  137. package/docs/code-review.md +137 -0
  138. package/package.json +24 -17
  139. package/scripts/smoke-chat-driver-node.mjs +15 -0
@@ -0,0 +1,1216 @@
1
+ /**
2
+ * Context: Rapid design-system primitives — Button, TextField, Select, Tabs, Stepper, DatePicker,
3
+ * Multiselect, FileUpload, Icon, Snackbar, Combobox, RadioGroup, Card, Tooltip, Toast,
4
+ * Divider, Banner, Disclosure, SegmentedControl, Slider, Progress, etc.
5
+ * + WC/React interop boundary + dangerous patterns.
6
+ *
7
+ * Source-verified against:
8
+ * foundation-ds/rapid-design-system/dist/dts/react.d.ts (all component shapes + Ref types)
9
+ * foundation-ui/src/icon/icon.ts (Icon @attr surface)
10
+ * foundation-ui/src/number-field/number-field.ts (NumberField @attr surface)
11
+ * foundation-ui/src/date-picker/date-picker.ts (DatePicker @attr surface)
12
+ * foundation-ui/src/tabs/tabs.ts (Tabs scrollable, currentTabIndex)
13
+ * foundation-ds/rapid-design-system/src/button/button.styles.ts (appearance values)
14
+ * showcase/react-client/src/pages/ReactTypes/ReactTypes.tsx (idiomatic event usage)
15
+ * showcase/react-client/src/pages/DatePickers/DatePickers.tsx (DatePicker usage)
16
+ * sales-trader-hub/client/src/components/IrVolDeskPanel/IrVolTradingForm.tsx (production patterns)
17
+ * foundation-ui/src/options-datasource/options-datasource.ts (OptionsDatasource @attr surface + value-change)
18
+ * foundation-ui/src/options-datasource/multiselect-datasource.ts (MultiselectDatasource @attr surface)
19
+ * foundation-ui/src/utils/base-datasource.ts (shared datasource props: criteria, orderBy, maxRows…)
20
+ * foundation-ui/dist/dts/react.d.ts + dist/react.cjs (OptionsDatasource/MultiselectDatasource React wrappers)
21
+ * installed @genesislcap/foundation-ui@14.491.0 options-datasource.d.ts (infiniteScroll/pageSize — PR #2361 / FUI-2586)
22
+ */
23
+ export const FUI_PRIMITIVES_DEPS = [];
24
+ export const FUI_PRIMITIVES_TAGS = [
25
+ // Component names
26
+ 'button',
27
+ 'textfield',
28
+ 'text field',
29
+ 'select',
30
+ 'listboxoption',
31
+ 'checkbox',
32
+ 'switch',
33
+ 'radio',
34
+ 'radiogroup',
35
+ 'tabs',
36
+ 'tab',
37
+ 'tabpanel',
38
+ 'stepper',
39
+ 'stepperpanel',
40
+ 'datepicker',
41
+ 'date picker',
42
+ 'multiselect',
43
+ 'categorized multiselect',
44
+ 'fileupload',
45
+ 'file upload',
46
+ 'icon',
47
+ 'snackbar',
48
+ 'combobox',
49
+ 'card',
50
+ 'tooltip',
51
+ 'badge',
52
+ 'numberfield',
53
+ 'number field',
54
+ 'textarea',
55
+ 'text area',
56
+ 'segmented control',
57
+ 'segmentedcontrol',
58
+ 'accordion',
59
+ 'banner',
60
+ 'slider',
61
+ 'progress',
62
+ 'status pill',
63
+ 'statuspill',
64
+ 'actions menu',
65
+ 'actionsmenu',
66
+ 'search bar',
67
+ 'searchbar',
68
+ 'ai criteria search',
69
+ 'aiCriteriaSearch',
70
+ 'tree item',
71
+ 'treeitem',
72
+ 'tree view',
73
+ 'treeview',
74
+ 'menu item',
75
+ 'menuitem',
76
+ 'url input',
77
+ 'urlInput',
78
+ 'toast',
79
+ 'divider',
80
+ 'anchor',
81
+ 'disclosure',
82
+ 'skeleton',
83
+ 'progress ring',
84
+ 'progressring',
85
+ 'stacking icons',
86
+ 'horizontal scroll',
87
+ 'breadcrumb',
88
+ 'avatar',
89
+ 'connection indicator',
90
+ 'notification listener',
91
+ // Intent phrases (non-developer)
92
+ 'add a button',
93
+ 'show a dropdown',
94
+ 'toggle switch',
95
+ 'input field',
96
+ 'form controls',
97
+ 'date input',
98
+ 'date field',
99
+ 'pick a date',
100
+ 'multi-select',
101
+ 'upload a file',
102
+ 'display an icon',
103
+ 'show a badge',
104
+ 'show a tab',
105
+ 'step wizard',
106
+ 'stepper wizard',
107
+ 'show a tooltip',
108
+ 'search box',
109
+ 'combo dropdown',
110
+ 'radio buttons',
111
+ 'loading spinner',
112
+ 'divider line',
113
+ 'section divider',
114
+ 'read only field',
115
+ 'number input',
116
+ // Technical
117
+ 'rapid-design-system',
118
+ 'onChange',
119
+ 'onValueChanged',
120
+ 'WC interop',
121
+ 'ButtonAppearance',
122
+ 'HTMLWCProps',
123
+ 'XxxRef',
124
+ 'TextFieldRef',
125
+ 'ButtonRef',
126
+ 'SelectRef',
127
+ 'DatePickerRef',
128
+ // Datasource-connected option lists (Select / Combobox / Multiselect fed from a Genesis resource)
129
+ 'options-datasource',
130
+ 'options datasource',
131
+ 'optionsdatasource',
132
+ 'OptionsDatasource',
133
+ 'multiselect-datasource',
134
+ 'multiselect datasource',
135
+ 'multiselectdatasource',
136
+ 'MultiselectDatasource',
137
+ 'connected select',
138
+ 'connected combobox',
139
+ 'connected multiselect',
140
+ 'connected dropdown',
141
+ 'value-field',
142
+ 'valueField',
143
+ 'label-field',
144
+ 'labelField',
145
+ 'allow-custom-options',
146
+ 'allowCustomOptions',
147
+ 'populate dropdown',
148
+ 'options from server',
149
+ 'options from resource',
150
+ 'dropdown from resource',
151
+ 'load options',
152
+ 'server-backed dropdown',
153
+ 'async combobox',
154
+ 'typeahead',
155
+ 'lookup dropdown',
156
+ 'infinite scroll',
157
+ 'infinite-scroll',
158
+ 'infiniteScroll',
159
+ 'page-size',
160
+ 'pageSize',
161
+ 'paged options',
162
+ 'lazy load options',
163
+ 'lazy-loaded dropdown',
164
+ 'load more options',
165
+ 'large option set',
166
+ ];
167
+ export const FUI_PRIMITIVES_CONTEXT = `
168
+ ## Rapid Design-System Primitives — \`@genesislcap/rapid-design-system/react\`
169
+
170
+ Use **PascalCase** components from this package for all buttons, fields, selects, tabs, icons, etc.
171
+
172
+ **ALWAYS read react.d.ts before writing JSX:**
173
+ VFS key: \`@genesislcap/rapid-design-system/react.d.ts\`
174
+
175
+ ### Imports
176
+
177
+ \`\`\`tsx
178
+ // Components — from /react subpath
179
+ import {
180
+ Button, TextField, TextArea, NumberField,
181
+ Select, ListboxOption, Combobox,
182
+ Checkbox, Switch, Radio, RadioGroup,
183
+ Tabs, Tab, TabPanel,
184
+ Stepper, StepperTab, StepperTabPanel,
185
+ DatePicker, Multiselect, CategorizedMultiselect,
186
+ Icon, Card, Badge, Tooltip,
187
+ Snackbar, Toast, FileUpload, SearchBar, SearchBarCombobox,
188
+ SegmentedControl, SegmentedItem,
189
+ Accordion, AccordionItem,
190
+ TreeView, TreeItem, MenuItem, Menu,
191
+ Divider, Banner, Disclosure, Skeleton, Progress, ProgressRing,
192
+ Slider, SliderLabel, StatusPill, ActionsMenu,
193
+ Anchor, AnchoredRegion, Avatar, Breadcrumb, BreadcrumbItem,
194
+ ConnectionIndicator, EnvironmentIndicator, HorizontalScroll,
195
+ NotificationListener, SectionNavigator, StackingIcons, Toolbar,
196
+ AiCriteriaSearch, UrlInput, Flipper, DropdownMenu, Listbox, Optgroup,
197
+ DesignSystemProvider, SystemHealthOverlay,
198
+ FilterBar, Filter,
199
+ } from '@genesislcap/rapid-design-system/react';
200
+
201
+ // Ref types (for useRef) — also from /react
202
+ import type {
203
+ TextFieldRef, ButtonRef, SelectRef, DatePickerRef,
204
+ NumberFieldRef, TextAreaRef, CheckboxRef, SwitchRef,
205
+ ComboboxRef, MultiselectRef, TabsRef, StepperRef,
206
+ } from '@genesislcap/rapid-design-system/react';
207
+ \`\`\`
208
+
209
+ ---
210
+
211
+ ### HTMLWCProps — base interface on ALL wrappers
212
+
213
+ All wrappers extend this interface. These are the only standard props guaranteed on every component:
214
+
215
+ \`\`\`tsx
216
+ // Layout/identity: className, style, id, slot, tabIndex, dir, lang, title
217
+ // Mouse: onClick, onDoubleClick, onContextMenu, onMouseEnter, onMouseLeave,
218
+ // onMouseDown, onMouseUp, onMouseMove
219
+ // Keyboard: onKeyDown, onKeyUp
220
+ // Focus: onFocus, onBlur
221
+ // Scroll: onScroll, onWheel
222
+ // Form: onChange(e: Event): void ← native DOM Event, NOT React SyntheticEvent
223
+ // onInput(e: Event): void ← same — bivariant, also accepts CustomEvent
224
+ \`\`\`
225
+
226
+ ---
227
+
228
+ ### Button
229
+
230
+ Verified appearance values (from \`button.styles.ts\` CSS \`:host([appearance='...'])\` selectors):
231
+
232
+ \`\`\`tsx
233
+ // Filled: 'primary' | 'secondary' | 'tertiary' | 'neutral' | 'accent'
234
+ // 'danger' | 'success' | 'warning'
235
+ // Outline: 'primary-outline' | 'secondary-outline' | 'neutral-outline'
236
+ // Other: 'link'
237
+ // No appearance = default unstyled button
238
+
239
+ <Button appearance="primary" onClick={handleSubmit}>Submit</Button>
240
+ <Button appearance="neutral" disabled={isPending}>Cancel</Button>
241
+ <Button appearance="danger" onClick={handleDelete}>Delete</Button>
242
+ <Button appearance="accent" onClick={handleAction}>Action</Button>
243
+
244
+ // Inferring type from ComponentProps (as used in sales-trader-hub):
245
+ import type { ComponentProps } from 'react';
246
+ type ButtonAppearance = ComponentProps<typeof Button>['appearance'];
247
+ \`\`\`
248
+
249
+ ---
250
+
251
+ ### TextField / TextArea / NumberField
252
+
253
+ \`\`\`tsx
254
+ // onChange fires native Event — NOT React SyntheticEvent
255
+ <TextField
256
+ value={val}
257
+ placeholder="Enter value"
258
+ disabled={false}
259
+ readOnly={false}
260
+ onChange={(e: Event) => setVal((e.target as HTMLInputElement).value)}
261
+ />
262
+
263
+ // TextArea — same onChange pattern
264
+ <TextArea
265
+ value={notes}
266
+ placeholder="Notes..."
267
+ onChange={(e: Event) => setNotes((e.target as HTMLTextAreaElement).value)}
268
+ />
269
+
270
+ // NumberField — verified @attr from foundation-ui/src/number-field/number-field.ts:
271
+ // hideStep (boolean) — hides the up/down step buttons
272
+ // withFormatting (boolean) — formats with locale separators on blur
273
+ // locale (string, default 'en-US') — Intl locale for formatting
274
+ // autoStepPrecision (boolean) — auto-detect decimal precision for step
275
+ // maximumInputPrecision (number, default 12) — max decimal digits
276
+ // autocomplete (string, default 'off')
277
+ // step, min, max from FAST base class (use as number-typed props)
278
+ <NumberField
279
+ value={String(qty)}
280
+ step={1}
281
+ min={0}
282
+ hideStep
283
+ onChange={(e: Event) => setQty(Number((e.target as HTMLInputElement).value))}
284
+ />
285
+
286
+ // NumberField with slot — as used in sales-trader-hub IrVolTradingForm:
287
+ <NumberField value={String(row.pct)} step={0.001} min={0} hideStep onChange={handleChange}>
288
+ <span slot="end" onClick={toggleMode}>%</span>
289
+ </NumberField>
290
+
291
+ // Ref pattern — use the generated XxxRef type alias:
292
+ import { useRef } from 'react';
293
+ import type { TextFieldRef } from '@genesislcap/rapid-design-system/react';
294
+
295
+ const ref = useRef<TextFieldRef>(null);
296
+ // Read value imperatively:
297
+ const val = (ref.current as any)?.value ?? '';
298
+ <TextField ref={ref} placeholder="Focus me imperatively" />
299
+ \`\`\`
300
+
301
+ ---
302
+
303
+ ### Select + ListboxOption
304
+
305
+ \`\`\`tsx
306
+ // NO built-in 'placeholder' prop on Select — use a first ListboxOption with empty value
307
+ <Select
308
+ value={selectedValue ?? ''}
309
+ onChange={(e: Event) => setValue((e.target as HTMLSelectElement).value)}
310
+ >
311
+ <ListboxOption value="">-- Select --</ListboxOption>
312
+ <ListboxOption value="BUY">Buy</ListboxOption>
313
+ <ListboxOption value="SELL">Sell</ListboxOption>
314
+ </Select>
315
+ \`\`\`
316
+
317
+ **Options from a Genesis resource (or a static array)?** Don't hand-write \`<ListboxOption>\`s from a
318
+ \`Connect.snapshot()\` — nest an \`OptionsDatasource\` child instead. See the
319
+ **"Connecting Select / Combobox / Multiselect to a Genesis datasource"** section below.
320
+
321
+ ---
322
+
323
+ ### Combobox + ListboxOption
324
+
325
+ Combobox is a filterable typeahead. Verified @attr from \`foundation-ui/src/combobox/combobox.ts\`
326
+ (+ \`combobox.types.ts\`):
327
+ \`async\` (boolean), \`caseSensitive\` (attr \`case-sensitive\`, boolean), \`filterMode\` (attr
328
+ \`filter-mode\`, \`'contains' | 'startsWith'\`, **default \`'startsWith'\`**), \`ignoreInputClick\`
329
+ (attr \`ignore-input-click\`, boolean), \`debounce\` (number ms).
330
+
331
+ \`\`\`tsx
332
+ // Currency-pair typeahead (filterMode 'contains' matches "usd" inside "EUR/USD"):
333
+ <Combobox
334
+ value={selectedPair}
335
+ filterMode="contains"
336
+ onChange={(e: Event) => setSelectedPair((e.target as HTMLInputElement).value)}
337
+ >
338
+ <ListboxOption value="EUR/USD">EUR/USD</ListboxOption>
339
+ <ListboxOption value="GBP/USD">GBP/USD</ListboxOption>
340
+ <ListboxOption value="USD/JPY">USD/JPY</ListboxOption>
341
+ </Combobox>
342
+ \`\`\`
343
+
344
+ **Server-backed typeahead?** For a large reference set, feed the Combobox from an \`OptionsDatasource\`
345
+ child (optionally with \`async\` for server-side filtering) rather than static \`<ListboxOption>\`s. See the
346
+ **"Connecting Select / Combobox / Multiselect to a Genesis datasource"** section below.
347
+
348
+ ---
349
+
350
+ ### Checkbox / Switch / Radio / RadioGroup
351
+
352
+ \`\`\`tsx
353
+ // Checkbox
354
+ <Checkbox
355
+ checked={isChecked}
356
+ onChange={(e: Event) => setChecked((e.target as HTMLInputElement).checked)}
357
+ >
358
+ Accept terms
359
+ </Checkbox>
360
+
361
+ // Switch — children become the label text
362
+ <Switch
363
+ checked={autoQuote}
364
+ onChange={(e: Event) => setAutoQuote((e.target as HTMLInputElement).checked)}
365
+ >
366
+ Auto Quote
367
+ </Switch>
368
+
369
+ // RadioGroup + Radio
370
+ <RadioGroup
371
+ value={direction}
372
+ onChange={(e: Event) => setDirection((e.target as HTMLInputElement).value)}
373
+ >
374
+ <Radio value="BUY">Buy</Radio>
375
+ <Radio value="SELL">Sell</Radio>
376
+ </RadioGroup>
377
+ \`\`\`
378
+
379
+ ---
380
+
381
+ ### Tabs / Tab / TabPanel
382
+
383
+ Verified attrs on Tabs from \`foundation-ui/src/tabs/tabs.ts\`:
384
+ - \`scrollable\` (boolean) — tab list scrolls horizontally when overflow
385
+ - \`currentTabIndex\` — getter (read-only, zero-indexed), NOT an attr to set
386
+ - \`activeid\` (string) — from the FAST base class (verified in \`@microsoft/fast-foundation\` tabs.d.ts, "HTML Attribute: activeid"), sets the active tab by its \`id\`
387
+
388
+ \`\`\`tsx
389
+ // CRITICAL: Tab and TabPanel MUST be direct children of Tabs.
390
+ // TabPanel is NOT nested inside Tab — they are siblings matched by index.
391
+ <Tabs>
392
+ <Tab>Overview</Tab>
393
+ <Tab>Details</Tab>
394
+ <TabPanel>Overview content here</TabPanel>
395
+ <TabPanel>Details content here</TabPanel>
396
+ </Tabs>
397
+
398
+ // Scrollable tab list
399
+ <Tabs scrollable>
400
+ <Tab>One</Tab><Tab>Two</Tab><Tab>Three</Tab>
401
+ <TabPanel>One content</TabPanel>
402
+ <TabPanel>Two content</TabPanel>
403
+ <TabPanel>Three content</TabPanel>
404
+ </Tabs>
405
+ \`\`\`
406
+
407
+ ---
408
+
409
+ ### Stepper / StepperTab / StepperTabPanel
410
+
411
+ Events on \`Stepper\` (verified in react.d.ts):
412
+ - \`onStepClick\`, \`onValidationFailure\`, \`onNextStep\`, \`onValidationSuccess\`
413
+
414
+ Event on \`StepperTab\` (verified in react.d.ts): \`onTabClicked\`
415
+
416
+ \`\`\`tsx
417
+ <Stepper onNextStep={(e: CustomEvent<unknown>) => handleStep(e)}>
418
+ <StepperTab>Step 1</StepperTab>
419
+ <StepperTab>Step 2</StepperTab>
420
+ <StepperTabPanel>Step 1 content</StepperTabPanel>
421
+ <StepperTabPanel>Step 2 content</StepperTabPanel>
422
+ </Stepper>
423
+ \`\`\`
424
+
425
+ ---
426
+
427
+ ### DatePicker
428
+
429
+ Custom event: \`onValueChanged?: (event: CustomEvent<unknown>) => void\` (verified in react.d.ts)
430
+
431
+ Verified @attr from \`foundation-ui/src/date-picker/date-picker.ts\`:
432
+ - \`value\` (string, format MM-DD-YYYY by default)
433
+ - \`format\` (string, e.g. 'DD/MM/YYYY') — display format
434
+ - \`lang\` (string, e.g. 'en-gb', default 'en-US')
435
+ - \`useLocaleFormat\` (boolean) — sets format from dayjs locale \`L\`; uses \`lang\` or browser locale
436
+ - \`inlineCalendar\` (boolean) — displays calendar inline, always open
437
+ - \`hideWeekends\` (boolean)
438
+ - \`allowEmpty\` (boolean) — no initial date; shows placeholder until user picks
439
+ - \`placeholder\` (string) — hint when allowEmpty and no date selected; defaults from format shape
440
+ - \`position\` ('bottom' | 'top' | 'left' | 'right', default 'bottom')
441
+ - \`label\` (string) — label displayed next to the date input
442
+ - \`disabledDaysOfWeek\` (number[]) — Sunday=1, Monday=2, ..., Saturday=7
443
+
444
+ \`\`\`tsx
445
+ // Basic controlled usage
446
+ <DatePicker
447
+ value={date}
448
+ onValueChanged={(e: CustomEvent<unknown>) => setDate(String(e.detail ?? ''))}
449
+ />
450
+
451
+ // Inline calendar with slot (verified in showcase DatePickers.tsx)
452
+ <DatePicker
453
+ ref={datePickerRef}
454
+ allowEmpty
455
+ onValueChanged={(e: CustomEvent<unknown>) => setDate(String(e.detail ?? ''))}
456
+ >
457
+ <Button slot="bottom" onClick={resetToToday}>Today</Button>
458
+ </DatePicker>
459
+
460
+ // Locale-aware, UK format
461
+ <DatePicker allowEmpty useLocaleFormat lang="en-gb" />
462
+
463
+ // Disable weekends (only Mon-Fri enabled):
464
+ // disabledDaysOfWeek accepts an array — must be passed as a JS property, not a string attribute
465
+ <DatePicker
466
+ disabledDaysOfWeek={[1, 7] as any}
467
+ onValueChanged={(e: CustomEvent<unknown>) => setDate(String(e.detail ?? ''))}
468
+ />
469
+ \`\`\`
470
+
471
+ ---
472
+
473
+ ### Multiselect / CategorizedMultiselect
474
+
475
+ Events (verified in react.d.ts):
476
+ - \`Multiselect\`: \`onSelectionChange\`, \`onClear\`
477
+ - \`CategorizedMultiselect\`: \`onSelectionChange\`
478
+
479
+ \`\`\`tsx
480
+ <Multiselect
481
+ onSelectionChange={(e: CustomEvent<unknown>) => setSelected(e.detail as string[])}
482
+ onClear={() => setSelected([])}
483
+ >
484
+ <ListboxOption value="A">Option A</ListboxOption>
485
+ <ListboxOption value="B">Option B</ListboxOption>
486
+ </Multiselect>
487
+ \`\`\`
488
+
489
+ **Options from a Genesis resource (or a static array)?** Nest a \`MultiselectDatasource\` child instead
490
+ of static \`<ListboxOption>\`s. See the **"Connecting Select / Combobox / Multiselect to a Genesis
491
+ datasource"** section below.
492
+
493
+ ---
494
+
495
+ ### Connecting Select / Combobox / Multiselect to a Genesis datasource
496
+
497
+ Populate a dropdown from a Data Server resource (a Query/view) — or a static array — **declaratively**
498
+ by nesting a datasource element as a **direct child** of the field. This replaces hand-written
499
+ \`Connect.snapshot()\` + \`useState\` + \`.map(row => <ListboxOption>)\` wiring: the datasource fetches the
500
+ rows, maps each to an option, and keeps the field's option list in sync.
501
+
502
+ - \`Select\` / \`Combobox\` → \`OptionsDatasource\`
503
+ - \`Multiselect\` → \`MultiselectDatasource\`
504
+
505
+ **CRITICAL import path** — these two datasource wrappers are the ONLY option-list pieces that come from
506
+ \`@genesislcap/foundation-ui/react\`, NOT \`@genesislcap/rapid-design-system/react\` (the host fields still
507
+ come from rapid-design-system). Mixing a rapid \`Combobox\` with a foundation-ui \`OptionsDatasource\` is
508
+ correct and expected — rapid-design-system is built on foundation-ui, and the datasource attaches to
509
+ whatever \`%%prefix%%-combobox\`/\`-select\`/\`-multiselect\` element it is nested inside:
510
+
511
+ \`\`\`tsx
512
+ import { Select, Combobox, Multiselect, ListboxOption } from '@genesislcap/rapid-design-system/react';
513
+ import { OptionsDatasource, MultiselectDatasource } from '@genesislcap/foundation-ui/react';
514
+ // Ref element types (rare): OptionsDatasourceRef, MultiselectDatasourceRef — also foundation-ui/react
515
+ \`\`\`
516
+
517
+ Props are **camelCase** — React 19 sets them as element properties. kebab-case (\`value-field\`) is
518
+ ignored, exactly like \`GridProGenesisDatasource\` / \`ChartDatasource\`.
519
+
520
+ **MANDATORY — verify \`resourceName\` before writing it.** Call \`query_project_schema('queries')\` AND
521
+ \`query_project_schema('entities')\` to see every resource the project actually has, then
522
+ \`query_project_schema('entities', NAME)\` / \`('queries', NAME)\` to confirm the one you want to bind. Do
523
+ not guess a name from the entity's business name or from an \`ALL_\`-prefix convention — a wrong or
524
+ nonexistent \`resourceName\` fails **silently** (an empty dropdown, no TypeScript error, no runtime
525
+ exception). An entity IS a valid \`resourceName\`, not just a Query: every entity and view is a
526
+ snapshot (request-reply) resource under its own bare name (the entity aspect returns
527
+ \`snapshot.resourceName\`, plus \`realtimeQueries\` for the live-updating alternative). When the preview
528
+ is up the tool answers from the generated server code (\`answeredFrom: 'generated-code'\`) and that
529
+ pair is present; under \`answeredFrom: 'config'\` the name is unverified and the entity's generated
530
+ block is absent — take the snapshot name from \`('queries')\`'s \`snapshotResources\`, which is there
531
+ either way — and one listed in \`drift.pendingRebuild\` only starts working after the server is
532
+ rebuilt.
533
+
534
+ #### OptionsDatasource props (Select + Combobox)
535
+
536
+ Verified against installed \`@genesislcap/foundation-ui@14.491.0\` (\`options-datasource.d.ts\` + inherited
537
+ \`base-datasource\`):
538
+
539
+ | Prop (camelCase) | Type | Notes |
540
+ |---|---|---|
541
+ | \`resourceName\` | string | Data Server resource — a Query/view name, e.g. \`"ALL_INSTRUMENTS"\`. Server mode. |
542
+ | \`valueField\` | string | **Required.** Row field whose value becomes each option's \`value\`. |
543
+ | \`labelField\` | string | Row field shown as the option text. Omit → the raw value is shown. |
544
+ | \`data\` | \`Record<string, any>[]\` | Static/local rows instead of \`resourceName\`. \`valueField\`/\`labelField\` index into each row. Passed as a JS array (property). |
545
+ | \`initialSelectedValue\` | string | number | Preselect this value once options load. |
546
+ | \`allowCustomOptions\` | boolean | **Combobox only.** Keep free-typed text as the value when nothing matches. Default \`false\`. |
547
+ | \`infiniteScroll\` | boolean | Page options lazily as the user scrolls (large sets). Default \`false\`. **Select/Combobox only** — see the infinite-scroll subsection below. |
548
+ | \`pageSize\` | number | Options fetched per page when \`infiniteScroll\`. Default \`20\`. |
549
+ | \`emptyDataLabel\` | string | Disabled option text shown when there are no rows. Default \`"No matching records"\`. |
550
+ | \`optionElement\` | string | Option tag name. **Leave unset** — auto-derives \`rapid-option\` from the parent field's prefix. |
551
+ | \`criteria\` | string | Server filter expression, e.g. \`"STATUS == 'ACTIVE'"\`. |
552
+ | \`orderBy\` | string | Server sort field. Set a **stable** one when \`infiniteScroll\` pages a REQUEST_SERVER resource. |
553
+ | \`maxRows\` / \`maxView\` | number | Row caps (defaults 250 / 1000). \`maxView\` still caps the running total under \`infiniteScroll\`. |
554
+ | \`labelFormatter\` / \`labelRowFormatter\` | fn | \`(labelValue) => string\` / \`(row) => string\` custom label builders (properties). |
555
+
556
+ \`isSnapshot\` defaults to \`true\` (a one-shot fetch, not a live stream). Do **not** set \`fields\` — it is
557
+ auto-derived from \`valueField\`/\`labelField\`.
558
+
559
+ **Select + server resource** — \`onChange\` on the Select gives the selected option's **value** (Select
560
+ tracks by \`value\`):
561
+
562
+ \`\`\`tsx
563
+ <Select
564
+ value={instrumentId}
565
+ onChange={(e: Event) => setInstrumentId((e.target as HTMLSelectElement).value)}
566
+ >
567
+ <OptionsDatasource resourceName="ALL_INSTRUMENTS" valueField="INSTRUMENT_ID" labelField="NAME" />
568
+ </Select>
569
+ \`\`\`
570
+
571
+ **Select + static/local data** — no server round-trip; options come from the \`data\` array:
572
+
573
+ \`\`\`tsx
574
+ <Select value={side} onChange={(e: Event) => setSide((e.target as HTMLSelectElement).value)}>
575
+ <OptionsDatasource
576
+ valueField="value"
577
+ labelField="label"
578
+ data={[{ value: 'BUY', label: 'Buy' }, { value: 'SELL', label: 'Sell' }]}
579
+ />
580
+ </Select>
581
+ \`\`\`
582
+
583
+ **Combobox + server resource (typeahead)** — a Combobox tracks by its displayed text, so \`onChange\`
584
+ gives the **label**, not the underlying value. To read \`{ value, label }\`, listen for the
585
+ \`value-change\` event **on the Combobox** via a ref — the datasource emits it on the host field, not on
586
+ itself:
587
+
588
+ \`\`\`tsx
589
+ import React, { useRef, useEffect } from 'react';
590
+ import { Combobox, ComboboxRef } from '@genesislcap/rapid-design-system/react';
591
+ import { OptionsDatasource } from '@genesislcap/foundation-ui/react';
592
+
593
+ const comboRef = useRef<ComboboxRef>(null);
594
+ useEffect(() => {
595
+ const el = comboRef.current; // ComboboxRef is the WC element — addEventListener is available
596
+ if (!el) return;
597
+ const onValueChange = (e: Event) => {
598
+ const { value, label } = (e as CustomEvent<{ value: any; label: string }>).detail ?? {};
599
+ setSelectedId(value); // underlying valueField value
600
+ };
601
+ el.addEventListener('value-change', onValueChange);
602
+ return () => el.removeEventListener('value-change', onValueChange);
603
+ }, []);
604
+
605
+ // ...
606
+ <Combobox ref={comboRef} filterMode="contains">
607
+ <OptionsDatasource resourceName="ALL_COUNTERPARTYS" valueField="COUNTERPARTY_ID" labelField="NAME" />
608
+ </Combobox>
609
+ \`\`\`
610
+
611
+ **Combobox + server-side (async) filtering** — set \`async\` on the Combobox. Each keystroke (debounced,
612
+ 500ms default) rebuilds the datasource \`criteria\` (contains-ignore-case on \`labelField ?? valueField\`)
613
+ and re-queries the server, so the list stays server-driven for large reference sets:
614
+
615
+ \`\`\`tsx
616
+ <Combobox async filterMode="contains" placeholder="Search instruments...">
617
+ <OptionsDatasource resourceName="ALL_INSTRUMENTS" valueField="INSTRUMENT_ID" labelField="NAME" />
618
+ </Combobox>
619
+ \`\`\`
620
+
621
+ Free-text entry (accept a value that isn't in the list) — Combobox + \`allowCustomOptions\`:
622
+
623
+ \`\`\`tsx
624
+ <Combobox>
625
+ <OptionsDatasource resourceName="ALL_TAGS" valueField="TAG" allowCustomOptions />
626
+ </Combobox>
627
+ \`\`\`
628
+
629
+ #### Infinite scroll (large option sets) — Select / Combobox only
630
+
631
+ For a very large reference set, set \`infiniteScroll\` so the datasource loads only \`pageSize\` options
632
+ (default 20) up front and fetches the next page when the user scrolls near the bottom of the dropdown.
633
+ This is an \`OptionsDatasource\` feature (Select / Combobox) — \`MultiselectDatasource\` does **not** have it.
634
+
635
+ \`\`\`tsx
636
+ <Combobox filterMode="contains" placeholder="Search instruments...">
637
+ <OptionsDatasource
638
+ resourceName="ALL_INSTRUMENTS"
639
+ valueField="INSTRUMENT_ID"
640
+ labelField="NAME"
641
+ orderBy="NAME"
642
+ infiniteScroll
643
+ pageSize={50}
644
+ />
645
+ </Combobox>
646
+ \`\`\`
647
+
648
+ Rules:
649
+ - **Always set a stable \`orderBy\`.** REQUEST_SERVER resources page by OFFSET; without a stable order the
650
+ server can shift rows between page fetches (duplicates/gaps). (DATASERVER resources page via a live
651
+ stream instead.)
652
+ - On a **Combobox**, \`infiniteScroll\` **auto-enables \`async\`** — only one page is loaded client-side, so
653
+ filtering is delegated to the server. Do **not** also set \`async\` yourself.
654
+ - \`pageSize\` is the per-page fetch (default 20); \`maxView\` (default 1000) still caps the running total.
655
+ - \`infiniteScroll\` pages a server \`resourceName\` — do not combine it with a static \`data\` array.
656
+
657
+ #### MultiselectDatasource props (Multiselect)
658
+
659
+ Verified against \`multiselect-datasource.ts\`: only \`valueField\` (**required**), \`labelField\`, and the
660
+ shared server props (\`resourceName\`, \`criteria\`, \`orderBy\`, \`maxRows\`, \`data\`, …). It has **no**
661
+ \`optionElement\`, \`allowCustomOptions\`, \`initialSelectedValue\`, or \`labelFormatter\`. It sets the
662
+ Multiselect's \`options\` array directly (not child \`<ListboxOption>\`s).
663
+
664
+ Read the selection with \`onSelectionChange\` **on the Multiselect** — \`e.detail\` is the array of
665
+ selected **values**:
666
+
667
+ \`\`\`tsx
668
+ <Multiselect
669
+ selectedOptions={selectedIds} // controlled preselect (array of values)
670
+ onSelectionChange={(e: CustomEvent<unknown>) => setSelectedIds(e.detail as string[])}
671
+ onClear={() => setSelectedIds([])}
672
+ >
673
+ <MultiselectDatasource resourceName="ALL_COUNTERPARTYS" valueField="COUNTERPARTY_ID" labelField="NAME" />
674
+ </Multiselect>
675
+
676
+ // Static data:
677
+ <Multiselect onSelectionChange={(e: CustomEvent<unknown>) => setSelectedIds(e.detail as string[])}>
678
+ <MultiselectDatasource
679
+ valueField="value"
680
+ labelField="label"
681
+ data={[{ value: 'FX', label: 'FX' }, { value: 'IRS', label: 'Rates' }]}
682
+ />
683
+ </Multiselect>
684
+ \`\`\`
685
+
686
+ #### Dates & typed fields — the datasource auto-formats the label
687
+
688
+ When \`labelField\` points at a **DATE** or **DATETIME** field, the datasource formats the label for you
689
+ (the base datasource's default formatter turns a raw epoch-millis timestamp into a readable date). You do
690
+ **NOT** import \`getDateFormatter\` or map the rows yourself. Keep \`valueField\` on the same field so the
691
+ option's underlying value stays the raw timestamp (usable in a criteria) while the label shows the
692
+ formatted date:
693
+
694
+ \`\`\`tsx
695
+ // A dropdown of trade dates, fetched AND formatted by the datasource (no getDateFormatter, no mapping):
696
+ <Select value={tradeDate} onChange={(e: Event) => setTradeDate((e.target as HTMLSelectElement).value)}>
697
+ <OptionsDatasource resourceName="TRADE_VIEW_QUERY" valueField="TRADE_DATE" labelField="TRADE_DATE" />
698
+ </Select>
699
+ \`\`\`
700
+
701
+ The auto-format is driven by the field's schema type (DATE/DATETIME) from the resource metadata.
702
+ Override it only when you need something custom: \`labelFormatter\` (\`(labelValue) => string\`) or
703
+ \`labelRowFormatter\` (\`(row) => string\`).
704
+
705
+ #### One option per row (no client-side dedup) — this is a scale/correctness bug, not a wiring bug
706
+
707
+ The datasource emits **one option per row** the resource returns — it does not de-duplicate, group, or
708
+ aggregate. If \`valueField\` is not unique per row in the bound resource (e.g. \`BASE_CURRENCY\` on a
709
+ \`CLIENT_ACCOUNT\` table with many accounts sharing a currency), binding \`resourceName\` directly WILL
710
+ render one option per row — a real, reproducible bug ("the dropdown shows every currency N times"), not a
711
+ sign that you did something wrong. Check whether \`valueField\` is the resource's primary key (or unique
712
+ per row) before you bind — a field is not unique just because it looks like a lookup column.
713
+
714
+ **Do NOT "fix" this by fetching the whole resource yourself and reducing it client-side**
715
+ (\`Array.from(new Set(rows.map(...)))\` or equivalent) — even if the result still ends up rendered through
716
+ \`OptionsDatasource\`/\`MultiselectDatasource\` via \`data\`. That looks like it works against a handful of
717
+ seeded rows and is wrong at any real scale:
718
+
719
+ - **It does not scale.** A table with 100k rows means fetching 100k rows across the network just to
720
+ render five dropdown options.
721
+ - **It can be silently INCOMPLETE.** A fetch is capped (a datasource's own \`maxRows\`, a manual
722
+ \`Connect\` call's page size) — a value that only appears on rows outside that cap never shows up, and
723
+ nothing signals the omission. The dropdown looks correct and is wrong.
724
+ - **It puts aggregation in the wrong place.** Computing the distinct set of a column is a server-side
725
+ concern (a \`GROUP BY\`/\`DISTINCT\` query, or a small reference entity), not client logic to reinvent
726
+ per page. See DP-15 below — this is the same anti-pattern as hand-rolling option loading, just
727
+ disguised behind a real datasource component.
728
+
729
+ **What to actually do:**
730
+
731
+ 1. **Check whether a resource that already returns the distinct set exists.** Call
732
+ \`query_project_schema('queries')\` / \`('views')\` / \`('entities')\` first. If nothing obviously matches,
733
+ use \`grep_project\` / \`read_project\` — NOT \`grep_source\`/\`read_source\`, which only search the
734
+ installed framework — to check the server's actual query/view/entity definitions (the running
735
+ backend's GPAL Kotlin, which the config \`query_project_schema\` falls back on under
736
+ \`answeredFrom: 'config'\` can drift from): a
737
+ suitable resource can exist under a name that doesn't obviously match the field (e.g. a
738
+ \`CURRENCY\`/\`ALL_CURRENCY\` reference entity, or a view that already groups by the field you need).
739
+ 2. **If one exists, bind \`resourceName\` to it.** Done — no client code needed.
740
+ 3. **If none exists, do NOT invent a client-side workaround — and do NOT quietly leave the dropdown
741
+ broken while still reporting success.** This is a data-model gap, not something fixable from the
742
+ client. Say so explicitly, naming what's missing (e.g. "there's no query that returns distinct
743
+ \`BASE_CURRENCY\` values; someone needs to add one, such as a \`CURRENCY\` reference entity or a query
744
+ on \`CLIENT_ACCOUNT\` grouped by \`BASE_CURRENCY\`") so the user or the Project Configuration agent can
745
+ add it. How you say it depends on where you are: before opening a write buffer, use \`plan_ask_user\`
746
+ if this state has it available. If you are already mid-generation and conclude there is nothing
747
+ correct to write for this dropdown, use \`report_finding\` rather than reverting to the original
748
+ (still-broken) code and claiming it works — a finding you can state plainly is always available,
749
+ even if you have to do a little more verification first to reach it honestly. Still build whatever
750
+ part of the request doesn't depend on the missing resource.
751
+
752
+ ---
753
+
754
+ ### Icon
755
+
756
+ Verified @attr from \`foundation-ui/src/icon/icon.ts\`:
757
+ - \`name\` (FontAwesome \`IconName\` — e.g. 'check-circle', 'times', 'caret-down')
758
+ - \`size\` (\`FaSize\` — '2xs' | 'xs' | 'sm' | 'lg' | 'xl' | '2xl' | '1x' | '2x' … '10x' | 'stack-1x' | 'stack-2x', **default 'sm'**)
759
+ - \`variant\` (\`IconStyle\` — 'solid' | 'regular' | 'brand', **default 'solid'**)
760
+ - \`tooltip\` (string — shows a tooltip on hover)
761
+ - \`tooltipId\` (string — explicit id for the tooltip anchor)
762
+
763
+ \`\`\`tsx
764
+ <Icon name="check-circle" size="lg" variant="solid" />
765
+ <Icon name="question-circle" variant="regular" tooltip="Help text" />
766
+ <Icon name="times" size="sm" />
767
+ \`\`\`
768
+
769
+ ---
770
+
771
+ ### Card
772
+
773
+ \`Card\` is a layout container with no special events. Use className/style for sizing.
774
+
775
+ \`\`\`tsx
776
+ <Card className="my-card">
777
+ <h3>Card Title</h3>
778
+ <p>Card content goes here.</p>
779
+ </Card>
780
+ \`\`\`
781
+
782
+ ---
783
+
784
+ ### Badge
785
+
786
+ No special events beyond HTMLWCProps. Use children for content.
787
+
788
+ \`\`\`tsx
789
+ <Badge>3</Badge>
790
+ \`\`\`
791
+
792
+ ---
793
+
794
+ ### Tooltip
795
+
796
+ \`anchor\` (string) — id of the element the tooltip is anchored to (verified: FAST base
797
+ \`@microsoft/fast-foundation\` tooltip.d.ts, "HTML Attribute: anchor"). Custom event
798
+ \`onDismiss\` (verified in react.d.ts).
799
+
800
+ \`\`\`tsx
801
+ <Tooltip anchor="submit-btn">Helpful description</Tooltip>
802
+ \`\`\`
803
+
804
+ ---
805
+
806
+ ### Divider
807
+
808
+ No special events; use as a visual separator.
809
+
810
+ \`\`\`tsx
811
+ <Divider />
812
+ \`\`\`
813
+
814
+ ---
815
+
816
+ ### Toast
817
+
818
+ No custom events registered in react.d.ts (only HTMLWCProps — verified). Use as a notification container.
819
+
820
+ \`\`\`tsx
821
+ <Toast>Operation completed successfully.</Toast>
822
+ \`\`\`
823
+
824
+ ---
825
+
826
+ ### Snackbar / TreeItem / MenuItem
827
+
828
+ Events (verified in react.d.ts):
829
+ - \`Snackbar\`: \`onAutoDismiss\`
830
+ - \`TreeItem\`: \`onExpandedChange\`, \`onSelectedChange\`
831
+ - \`MenuItem\`: \`onOnMenuClick\` (double "On" prefix — intentional in generated types), \`onExpandedChange\`
832
+
833
+ ---
834
+
835
+ ### SearchBar / SearchBarCombobox
836
+
837
+ Events (verified in react.d.ts):
838
+ - \`SearchBar\`: \`onSelectionChange\`
839
+ - \`SearchBarCombobox\`: \`onInputdeleted\`
840
+
841
+ ---
842
+
843
+ ### AiCriteriaSearch
844
+
845
+ Events (verified in react.d.ts): \`onCriteriaChanged\`, \`onValidationErrors\`
846
+
847
+ ---
848
+
849
+ ### FileUpload
850
+
851
+ Events (verified in react.d.ts): \`onFileSelected\`, \`onSuccess\`, \`onErrorOut\`, \`onClear\`
852
+
853
+ ---
854
+
855
+ ### Filter / FilterBar
856
+
857
+ Events on \`Filter\` (verified in react.d.ts): \`onFilterChanged\`, \`onFilterCleared\`
858
+
859
+ ---
860
+
861
+ ### AnchoredRegion
862
+
863
+ Events (verified in react.d.ts): \`onLoaded\`, \`onPositionchange\`
864
+
865
+ ---
866
+
867
+ ### HorizontalScroll
868
+
869
+ Events (verified in react.d.ts): \`onScrollstart\`, \`onScrollend\`
870
+
871
+ ---
872
+
873
+ ### SectionNavigator
874
+
875
+ Events (verified in react.d.ts): \`onSectionNavigatorSetState\`, \`onSectionNavigatorSetStates\`,
876
+ \`onSectionNavigatorClearState\`, \`onSectionNavigatorClearAllStates\`
877
+
878
+ ---
879
+
880
+ ### SegmentedControl / SegmentedItem
881
+
882
+ SegmentedControl extends FASTRadioGroup internally — fires the standard \`change\` event via \`onChange\`.
883
+ Use \`onChange\` to read the selected value, just like RadioGroup.
884
+
885
+ \`\`\`tsx
886
+ <SegmentedControl
887
+ value={period}
888
+ onChange={(e: Event) => setPeriod((e.target as HTMLInputElement).value)}
889
+ >
890
+ <SegmentedItem value="day">Day</SegmentedItem>
891
+ <SegmentedItem value="week">Week</SegmentedItem>
892
+ <SegmentedItem value="month">Month</SegmentedItem>
893
+ </SegmentedControl>
894
+ \`\`\`
895
+
896
+ ---
897
+
898
+ ### Ref pattern (all wrappers are React.forwardRef)
899
+
900
+ Every component ships a companion \`XxxRef\` type alias so refs can be typed concisely:
901
+
902
+ \`\`\`tsx
903
+ import { useRef } from 'react';
904
+ import type { TextFieldRef } from '@genesislcap/rapid-design-system/react';
905
+
906
+ const fieldRef = useRef<TextFieldRef>(null);
907
+ // Read value imperatively (showcased in ReactTypes.tsx):
908
+ const val = (fieldRef.current as any)?.value ?? '';
909
+ // Focus imperatively:
910
+ fieldRef.current?.focus();
911
+ \`\`\`
912
+
913
+ ---
914
+
915
+ ## React/WC Interop — prop-to-attribute boundary
916
+
917
+ | In React JSX | WC receives | Notes |
918
+ |---|---|---|
919
+ | \`onChange={(e) => ...}\` | native \`change\` event | \`e\` is DOM \`Event\`, NOT SyntheticEvent |
920
+ | \`onValueChanged={(e) => ...}\` | \`value-changed\` custom event | \`e.detail\` holds the payload |
921
+ | \`className="foo"\` | \`class="foo"\` attribute | standard interop |
922
+ | \`disabled={true}\` | boolean attribute \`disabled\` | |
923
+ | \`ref={ref}\` | ForwardRef → WC class instance | typed via \`XxxRef\` |
924
+ | object/array prop (e.g. \`disabledDaysOfWeek\`) | DOM property (JS set) | never serialize to JSON string |
925
+ | \`inlineCalendar\` (boolean attr) | \`inline-calendar=""\` | kebab-case WC attr → camelCase prop |
926
+
927
+ Custom events always type as \`CustomEvent<unknown>\`. Cast \`event.detail\` when you know the shape:
928
+
929
+ \`\`\`tsx
930
+ const handleValueChanged = (e: CustomEvent<unknown>) => {
931
+ const val = String(e.detail ?? '');
932
+ };
933
+ \`\`\`
934
+
935
+ ---
936
+
937
+ ## DANGEROUS PATTERNS
938
+
939
+ ### DP-1: Wrong Button appearance values (FAST values vs rapid-design-system styled values)
940
+
941
+ The rapid-design-system button has its OWN styled appearance values. Do NOT use FAST-only values
942
+ like 'lightweight', 'outline', 'stealth' — these have NO styles in rapid-design-system.
943
+
944
+ \`\`\`tsx
945
+ // WRONG — FAST appearance values, not styled in rapid-design-system:
946
+ <Button appearance="lightweight">Click</Button>
947
+ <Button appearance="outline">Click</Button>
948
+ <Button appearance="stealth">Click</Button>
949
+
950
+ // CORRECT — rapid-design-system styled appearance values (from button.styles.ts):
951
+ <Button appearance="primary">Click</Button> // filled primary colour
952
+ <Button appearance="secondary">Click</Button> // filled secondary colour
953
+ <Button appearance="neutral">Click</Button> // neutral/ghost
954
+ <Button appearance="accent">Click</Button> // accent colour
955
+ <Button appearance="danger">Click</Button> // red/destructive
956
+ <Button appearance="primary-outline">Click</Button> // outlined primary
957
+ // Also valid: 'tertiary', 'success', 'warning', 'secondary-outline', 'neutral-outline', 'link'
958
+ \`\`\`
959
+
960
+ ### DP-2: \`onChange\` event type on form inputs (type error + runtime fail)
961
+
962
+ Never type the \`onChange\` handler on Genesis React wrapper components as
963
+ \`React.ChangeEvent<HTMLInputElement>\`. These are web-component wrappers — they fire native DOM
964
+ \`Event\` objects, not React SyntheticEvents.
965
+
966
+ \`\`\`tsx
967
+ // WRONG — React SyntheticEvent type:
968
+ <TextField onChange={(e: React.ChangeEvent<HTMLInputElement>) => setValue(e.target.value)} />
969
+
970
+ // CORRECT — native Event type (verified in react.d.ts: onChange?(e: Event): void):
971
+ <TextField onChange={(e: Event) => setValue((e.target as HTMLInputElement).value)} />
972
+ \`\`\`
973
+
974
+ ### DP-3: Importing components from bare package root
975
+
976
+ \`\`\`tsx
977
+ // WRONG — gets WC class registrations, not React components:
978
+ import { Button } from '@genesislcap/rapid-design-system';
979
+
980
+ // CORRECT:
981
+ import { Button } from '@genesislcap/rapid-design-system/react';
982
+ \`\`\`
983
+
984
+ ### DP-4: HTML \`<option>\` inside \`Select\` or \`Combobox\`
985
+
986
+ \`\`\`tsx
987
+ // WRONG — HTML native option, not the WC ListboxOption:
988
+ <Select><option value="A">A</option></Select>
989
+
990
+ // CORRECT:
991
+ <Select><ListboxOption value="A">A</ListboxOption></Select>
992
+ \`\`\`
993
+
994
+ ### DP-5: TabPanel nested inside Tab
995
+
996
+ \`\`\`tsx
997
+ // WRONG — TabPanel must NOT be a child of Tab:
998
+ <Tabs>
999
+ <Tab>Label <TabPanel>Content</TabPanel></Tab>
1000
+ </Tabs>
1001
+
1002
+ // CORRECT — Tabs and TabPanels are siblings matched by index:
1003
+ <Tabs>
1004
+ <Tab>Label</Tab>
1005
+ <TabPanel>Content</TabPanel>
1006
+ </Tabs>
1007
+ \`\`\`
1008
+
1009
+ ### DP-6: Using 'placeholder' prop on Select
1010
+
1011
+ Select does NOT have a \`placeholder\` prop. Use a first \`ListboxOption\` with an empty value instead.
1012
+
1013
+ \`\`\`tsx
1014
+ // WRONG — no such prop on Select:
1015
+ <Select placeholder="Choose one">...</Select>
1016
+
1017
+ // CORRECT:
1018
+ <Select value={val} onChange={(e: Event) => setVal((e.target as HTMLSelectElement).value)}>
1019
+ <ListboxOption value="">-- Choose one --</ListboxOption>
1020
+ <ListboxOption value="X">Option X</ListboxOption>
1021
+ </Select>
1022
+ \`\`\`
1023
+
1024
+ ### DP-7: Using string literal for TypeScript enum props
1025
+
1026
+ String union props (\`appearance\`, etc.) accept plain strings. But true TypeScript enums — like
1027
+ \`CrudMenuPosition\` from \`@genesislcap/foundation-entity-management\` — do NOT accept string literals
1028
+ and require importing and using the enum value.
1029
+
1030
+ \`\`\`tsx
1031
+ // WRONG — TS error, string literal not assignable to enum type:
1032
+ <EntityManagement crudMenuPosition="top" />
1033
+
1034
+ // CORRECT:
1035
+ import { CrudMenuPosition } from '@genesislcap/foundation-entity-management';
1036
+ <EntityManagement crudMenuPosition={CrudMenuPosition.Top} />
1037
+ \`\`\`
1038
+
1039
+ ### DP-8: Using React.ComponentRef<typeof X> instead of the XxxRef alias
1040
+
1041
+ \`\`\`tsx
1042
+ // VERBOSE (still works):
1043
+ const ref = useRef<React.ComponentRef<typeof TextField>>(null);
1044
+
1045
+ // PREFERRED — use the generated alias exported from /react (verified in react.d.ts):
1046
+ import type { TextFieldRef } from '@genesislcap/rapid-design-system/react';
1047
+ const ref = useRef<TextFieldRef>(null);
1048
+ \`\`\`
1049
+
1050
+ ### DP-9: Passing array/object props as JSON strings
1051
+
1052
+ Web component wrappers receive array/object props as JavaScript property assignments (not serialized
1053
+ HTML attributes). Never pass them as JSON strings.
1054
+
1055
+ \`\`\`tsx
1056
+ // WRONG — string, not an array:
1057
+ <DatePicker disabledDaysOfWeek="[1,7]" />
1058
+
1059
+ // CORRECT — JS array passed as property:
1060
+ <DatePicker disabledDaysOfWeek={[1, 7] as any} />
1061
+ \`\`\`
1062
+
1063
+ ### DP-10: Setting SegmentedControl value without onChange (uncontrolled confusion)
1064
+
1065
+ SegmentedControl extends FASTRadioGroup. It fires native \`change\` via \`onChange\` — NOT a custom
1066
+ \`onSelectionChange\`. Forgetting \`onChange\` makes it appear broken when used as controlled.
1067
+
1068
+ \`\`\`tsx
1069
+ // WRONG — no onChange, value never updates in React:
1070
+ <SegmentedControl value={period}>
1071
+ <SegmentedItem value="day">Day</SegmentedItem>
1072
+ </SegmentedControl>
1073
+
1074
+ // CORRECT:
1075
+ <SegmentedControl
1076
+ value={period}
1077
+ onChange={(e: Event) => setPeriod((e.target as HTMLInputElement).value)}
1078
+ >
1079
+ <SegmentedItem value="day">Day</SegmentedItem>
1080
+ </SegmentedControl>
1081
+ \`\`\`
1082
+
1083
+ ### DP-11: Importing the option datasources from rapid-design-system (wrong package)
1084
+
1085
+ \`OptionsDatasource\` and \`MultiselectDatasource\` are NOT exported from \`rapid-design-system/react\` —
1086
+ only the host fields (Select, Combobox, Multiselect) are. The datasources live in \`foundation-ui/react\`.
1087
+
1088
+ \`\`\`tsx
1089
+ // WRONG — not exported here; import fails to resolve:
1090
+ import { OptionsDatasource } from '@genesislcap/rapid-design-system/react';
1091
+
1092
+ // CORRECT — host field from rapid-design-system, datasource from foundation-ui:
1093
+ import { Combobox } from '@genesislcap/rapid-design-system/react';
1094
+ import { OptionsDatasource } from '@genesislcap/foundation-ui/react';
1095
+ \`\`\`
1096
+
1097
+ ### DP-12: kebab-case datasource props (silently ignored)
1098
+
1099
+ Like every other WC React wrapper in React 19, the datasource props must be **camelCase** — they are
1100
+ set as element properties. kebab-case attribute names do nothing.
1101
+
1102
+ \`\`\`tsx
1103
+ // WRONG — ignored, so the datasource never receives its config (empty dropdown):
1104
+ <OptionsDatasource resource-name="ALL_INSTRUMENTS" value-field="INSTRUMENT_ID" label-field="NAME" />
1105
+
1106
+ // CORRECT — camelCase:
1107
+ <OptionsDatasource resourceName="ALL_INSTRUMENTS" valueField="INSTRUMENT_ID" labelField="NAME" />
1108
+ \`\`\`
1109
+
1110
+ ### DP-13: \`onValueChange\` on \`<OptionsDatasource>\` never fires
1111
+
1112
+ The wrapper exposes an \`onValueChange\` prop, but the \`value-change\` event is dispatched on the parent
1113
+ Select/Combobox — a handler on the datasource child never receives it (DOM events bubble up, not down).
1114
+
1115
+ \`\`\`tsx
1116
+ // WRONG — handler on the datasource child never fires:
1117
+ <Combobox>
1118
+ <OptionsDatasource resourceName="ALL_X" valueField="ID" labelField="NAME" onValueChange={handle} />
1119
+ </Combobox>
1120
+
1121
+ // CORRECT — read the selection on the HOST field:
1122
+ // • Select → onChange, e.target.value is the selected value
1123
+ // • Combobox → onChange gives the label; for { value, label } add a value-change
1124
+ // listener on the Combobox via a ref (see the datasource section above)
1125
+ <Select onChange={(e: Event) => setV((e.target as HTMLSelectElement).value)}>
1126
+ <OptionsDatasource resourceName="ALL_X" valueField="ID" labelField="NAME" />
1127
+ </Select>
1128
+ \`\`\`
1129
+
1130
+ ### DP-14: Datasource not a direct child, or mixed with manual options
1131
+
1132
+ The datasource resolves its host via \`this.parentElement\`, so it must be a **direct** child of the
1133
+ field. It also owns the option list — a hand-written \`<ListboxOption>\` placeholder is wiped on the next
1134
+ fetch (use \`emptyDataLabel\` / \`initialSelectedValue\` instead).
1135
+
1136
+ \`\`\`tsx
1137
+ // WRONG — wrapped in a div, so parentElement is the div, not the Select (no options load):
1138
+ <Select><div><OptionsDatasource resourceName="ALL_X" valueField="ID" labelField="NAME" /></div></Select>
1139
+
1140
+ // WRONG — manual placeholder is removed when the datasource refetches:
1141
+ <Select>
1142
+ <ListboxOption value="">-- all --</ListboxOption>
1143
+ <OptionsDatasource resourceName="ALL_X" valueField="ID" labelField="NAME" />
1144
+ </Select>
1145
+
1146
+ // CORRECT — datasource is the sole direct child and owns the options:
1147
+ <Select><OptionsDatasource resourceName="ALL_X" valueField="ID" labelField="NAME" /></Select>
1148
+ \`\`\`
1149
+
1150
+ ### DP-15: Faking declarative option-loading with a hand-fetch — two shapes of the same anti-pattern
1151
+
1152
+ Fetching rows yourself instead of letting a datasource own the option list. Two shapes; both are banned:
1153
+
1154
+ **Shape A — hand-mapped rows straight to \`<ListboxOption>\`.** Brittle: silently renders an **empty
1155
+ dropdown** when the stream shape, callback signature, or resource name is slightly off, and re-implements
1156
+ the date formatting the datasource already does.
1157
+
1158
+ \`\`\`tsx
1159
+ // WRONG — manual fetch + map straight to <ListboxOption>:
1160
+ const connect = getConnect();
1161
+ const obs = connect.streamState('ALL_INSTRUMENTS', () => {}, () => {});
1162
+ useEffect(() => {
1163
+ const sub = obs.subscribe({ next: (rows) => setInstruments(rows) });
1164
+ return () => sub.unsubscribe();
1165
+ }, []);
1166
+ return (
1167
+ <Select value={v} onChange={onChange}>
1168
+ {instruments.map((i) => (
1169
+ <ListboxOption key={i.INSTRUMENT_ID} value={i.INSTRUMENT_ID}>{i.NAME}</ListboxOption>
1170
+ ))}
1171
+ </Select>
1172
+ );
1173
+
1174
+ // CORRECT — bind an OptionsDatasource; it fetches, maps, and (for DATE/DATETIME) formats the label:
1175
+ import { OptionsDatasource } from '@genesislcap/foundation-ui/react';
1176
+ return (
1177
+ <Select value={v} onChange={onChange}>
1178
+ <OptionsDatasource resourceName="ALL_INSTRUMENTS" valueField="INSTRUMENT_ID" labelField="NAME" />
1179
+ </Select>
1180
+ );
1181
+ \`\`\`
1182
+
1183
+ **Shape B — the whole resource fetched and reduced through \`new Set\` to fake a distinct list.** This one
1184
+ is easy to reach for because it "looks declarative" (the render is still a real \`OptionsDatasource\`) —
1185
+ but the fetch-and-reduce still happened by hand, against the whole resource, with no awareness of the
1186
+ datasource's own row caps. See **"One option per row"** above for why this is wrong (it does not scale,
1187
+ and can silently omit values) and what to do instead: check for a resource that already returns the
1188
+ distinct set; if none exists, say so — do not build a workaround.
1189
+
1190
+ \`\`\`tsx
1191
+ // WRONG — same anti-pattern as Shape A, just rendered through the "correct" component:
1192
+ useEffect(() => {
1193
+ getConnect().snapshot('ALL_CLIENT_ACCOUNT').then((response) => {
1194
+ const distinct = Array.from(new Set(response.ROW.map((r: any) => r.BASE_CURRENCY)));
1195
+ setOptions(distinct.map((v: string) => ({ value: v, label: v })));
1196
+ });
1197
+ }, []);
1198
+ return (
1199
+ <Select value={v} onChange={onChange}>
1200
+ <OptionsDatasource data={options} valueField="value" labelField="label" />
1201
+ </Select>
1202
+ );
1203
+
1204
+ // CORRECT — no distinct resource exists yet: say so, don't fake it. (Illustrative — the actual
1205
+ // response is prose / plan_ask_user, not a code snippet.)
1206
+ // "There's no query that returns distinct BASE_CURRENCY values yet — someone needs to add one
1207
+ // (e.g. a CURRENCY reference entity, or a query on CLIENT_ACCOUNT grouped by BASE_CURRENCY)
1208
+ // before I can wire this dropdown up correctly."
1209
+ \`\`\`
1210
+
1211
+ The distinguishing question for either shape: **is the option data server-derived AND hand-reduced
1212
+ (mapped straight to \`<ListboxOption>\`, or fetched-and-\`Set\`-reduced before reaching \`data\`)?** If yes,
1213
+ DP-15 applies regardless of which component finally renders it. A \`data\` array that is genuinely
1214
+ static (a hardcoded literal, not built from a fetch) is unaffected — see the static/local-data example
1215
+ earlier in this section.
1216
+ `.trim();