@genesislcap/ai-assistant 15.69.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 +5524 -2684
  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 +20 -10
  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 +25 -18
  136. package/dist/react.mjs +23 -17
  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,778 @@
1
+ /**
2
+ * Context injected into the UI Builder system prompt.
3
+ * Covers the global filters pattern: a shared filter bar (header or per-page) whose
4
+ * criteria string flows into every data tile across all routes via a Redux slice.
5
+ *
6
+ * SOURCE NOTES:
7
+ * - `Filters` component lives in `@genesislcap/foundation-forms/react` (NOT foundation-filters).
8
+ * `foundation-filters` is a feature-flag / URL-targeting utility package (clientFilter,
9
+ * timeWindow, percentage, urlTargeting — no /react subpath), not a UI component.
10
+ * Verified: foundation-filters src at foundation-ui repo v14.481.1 + package exports {'.', './package.json'}.
11
+ * - Filters WC props + `change`/`submit` events verified against the INSTALLED client
12
+ * (14.480.0): foundation-forms/dist/dts/filters/filters.d.ts (public props: resourceName,
13
+ * uischema, jsonSchema, data, value, prefix, renderers, showFilterPersistenceControls; @fires
14
+ * change/submit) + dist/esm filters.js (valueChanged→dispatch 'change' no-detail;
15
+ * searchFilters→$emit 'submit' {payload}) + filters.template.js (Clear[neutral]/Search[accent]
16
+ * buttons, slots actions-start/actions-end, parts container/container-forms/actions).
17
+ * - GENERATED-APP RUNTIME NOTE: generated apps run foundation-forms **14.481.1** (see
18
+ * the generated client package.json under server/preview-service/temp/projects), which is AHEAD
19
+ * of the create-tool client's 14.480.0. The ORIENTATION (`layout-direction` attr auto-derived from a HorizontalLayout
20
+ * uischema), the `:host` flex-column/height:100%/min-height:0/overflow:hidden sizing, the
21
+ * `.filters-dropdown-overflow` opt-in host class, and the `--filter-horizontal-field-min-width`
22
+ * token exist ONLY at 14.481.0+ — verify them against foundation-ui repo v14.481.1
23
+ * filters.styles.ts + filters.ts (getter layoutMode: uischema.type==='HorizontalLayout'?
24
+ * 'horizontal':'vertical'), NOT the 14.480.0 client (which styles the light-DOM `foundation-filters`
25
+ * element with no :host / no layout-direction). All correct for the 14.481.1 runtime the ui-builder
26
+ * targets.
27
+ * - CriteriaBuilder / ExpressionBuilder / Serialisers / Join verified against:
28
+ * foundation-criteria/dist/dts/{criteria-builder,expression-builder,serialisers,types}.d.ts (14.480.0).
29
+ */
30
+ export const FUI_GLOBAL_FILTERS_TAGS = [
31
+ // natural-language phrases (scored by search_context)
32
+ 'filter bar',
33
+ 'shared filter',
34
+ 'global filter',
35
+ 'header filter',
36
+ 'filter all tiles',
37
+ 'filter multiple grids',
38
+ 'filter across tiles',
39
+ 'filter tile',
40
+ 'dedicated filter panel',
41
+ 'criteria string',
42
+ 'date range filter',
43
+ 'cross-tile filter',
44
+ 'filter drives grid',
45
+ 'filter the whole page',
46
+ 'search bar across tiles',
47
+ 'broadcast filter',
48
+ // technical identifiers
49
+ 'Filters',
50
+ 'GlobalFilters',
51
+ 'CriteriaBuilder',
52
+ 'ExpressionBuilder',
53
+ 'Serialisers',
54
+ 'sharedCriteria',
55
+ 'getCriteria',
56
+ 'foundation-forms/react',
57
+ 'resourceName',
58
+ 'showFilterPersistenceControls',
59
+ 'enableFilters',
60
+ ];
61
+ // fui-styling carries the LAYERING rules (z-index / stacking contexts): a filter bar is the
62
+ // element whose popups get hidden behind neighbouring strips, so co-load it every time.
63
+ export const FUI_GLOBAL_FILTERS_DEPS = ['fui-eventing', 'fui-styling'];
64
+ export const FUI_GLOBAL_FILTERS_CONTEXT = `
65
+ ## SHARED FILTERING — CHOOSE YOUR APPROACH
66
+
67
+ **DEFAULT RULE: Any filter inside a layout tile (not the app header) MUST use Option A.**
68
+ Only use Option B when the filter must live in the app header across ALL routes, or when the
69
+ user explicitly requires custom field transformations not expressible via a server view.
70
+
71
+ > **IMPORTANT:** The \`foundation-filters\` npm package is a feature-flag / URL-targeting utility
72
+ > (clientFilter, timeWindow, percentage, etc.). It is NOT the filter UI component.
73
+ > The \`Filters\` UI component imports from \`@genesislcap/foundation-forms/react\`.
74
+
75
+ | Signal in the user request | Use |
76
+ |---|---|
77
+ | "filter inside this tile / grid / modal", single datasource | **Option A** — \`Filters\` component |
78
+ | "filter in a dedicated layout tile that drives ALL other tiles on this page" | **Option A** — \`Filters\` component + criteria distribution (Redux slice) |
79
+ | "global filter bar in the header / top of every page, across all routes" | **Option B** — Global-filters Redux pattern (custom UI) |
80
+ | User explicitly requires custom field transformations with no matching server view | **Option B** — Global-filters Redux pattern (custom UI) |
81
+
82
+ **BEFORE writing any filter code:** If the user has not specified a server view name, you MUST
83
+ call \`query_project_schema('queries')\` first to get the real available query/view names from the
84
+ project. Then call \`plan_ask_user\` with ONLY the names returned by that call as options — never
85
+ use example names like "ALL_TRADES" or "POSITION_VIEW", which may not exist in this project.
86
+ Do NOT silently fall back to Option B because the view name is unknown — Option A requires it.
87
+
88
+ **DO NOT build a custom filter UI (Option B) for a filter-in-tile request.** Not knowing the
89
+ exact field names is NOT a reason to use Option B. The Filters component discovers ALL fields
90
+ automatically from the server view — you never need to enumerate them.
91
+
92
+ ---
93
+
94
+ ### OPTION A — \`Filters\` component (built-in, server-driven)
95
+
96
+ The component auto-generates the entire filter UI from the server view's schema.
97
+ You provide a \`resourceName\` — the component handles field discovery, rendering, validation,
98
+ and criteria string building. **No custom fields, no CriteriaBuilder, no Redux actions per field.**
99
+
100
+ **Import (component):** \`import { Filters } from '@genesislcap/foundation-forms/react';\`
101
+ **Import (ref type):** \`import { FiltersRef } from '@genesislcap/foundation-forms/react';\`
102
+ **VFS react.d.ts key:** \`@genesislcap/foundation-forms/react.d.ts\` — always read before using Filters.
103
+
104
+ **Verified public props** (source: \`foundation-forms/dist/dts/filters/filters.d.ts\`):
105
+
106
+ | Prop | Type | Notes |
107
+ |---|---|---|
108
+ | \`resourceName\` | \`string\` | Server resource name — an entity, view, or DATA_SERVER/REQUEST_SERVER query; component fetches metadata automatically. Verify the exact name with \`query_project_schema\` before writing it — don't assume it must be a view. |
109
+ | \`uischema\` | \`UiSchema\` | Controls which fields are shown, their order, and labels. Optional — auto-generated from view schema if omitted |
110
+ | \`jsonSchema\` | \`JSONSchema7\` | Hard-code client-side schema instead of fetching from server. Optional |
111
+ | \`data\` | \`any\` | Initial data for the filters. Optional |
112
+ | \`value\` | \`string\` | **Read-only** observable. Contains the built criteria string after \`onChange\` fires |
113
+ | \`showFilterPersistenceControls\` | \`boolean\` | Shows built-in save/load/delete buttons |
114
+ | \`prefix\` | \`string\` | Design-system prefix used in renderers (e.g. \`"rapid"\`) |
115
+ | \`renderers\` | \`RendererEntry[]\` | Override the default renderer set |
116
+
117
+ **Verified events** (source: \`foundation-forms/dist/dts/filters/filters.d.ts\` JSDoc):
118
+
119
+ | Event | Handler prop | When it fires |
120
+ |---|---|---|
121
+ | \`change\` | \`onChange\` | Fired whenever the built criteria (\`value\`) updates — i.e. when the user clicks Search (or Clear, with \`value === ''\`). No \`detail\` payload — read \`e.target.value\` |
122
+ | \`submit\` | n/a (use \`onChange\`; native listener if needed) | Fired on Search click; \`detail = { payload }\` is the RAW filter form data, not the criteria. \`value\` is already up to date at this point |
123
+
124
+ **Reading criteria:** Use \`(e.target as FiltersRef).value\` — the built criteria string
125
+ (e.g. \`"SIDE == 'BUY' AND QUANTITY > 100"\`). **Do NOT read from \`(e as CustomEvent).detail\`**
126
+ — the detail is empty; always use \`e.target\`. Alternatively cast as \`(e.target as any).value\`.
127
+
128
+ **No CriteriaBuilder needed for Option A.** The component builds the full criteria string
129
+ internally — just read \`value\` and pass it to datasource \`criteria\` props.
130
+
131
+ ### Orientation — horizontal strip vs vertical panel
132
+
133
+ The auto-generated uischema is a **VerticalLayout** (fields stacked top-to-bottom). That is
134
+ right for a SIDE filter panel, but a filter STRIP above a grid must pass a
135
+ \`HorizontalLayout\` uischema explicitly or it renders as a tall stacked list:
136
+
137
+ \`\`\`tsx
138
+ import type { UiSchema } from '@genesislcap/foundation-forms'; // type from BASE package
139
+
140
+ // One Control per field to show, in display order — fields render left-to-right in a row
141
+ const filterBarUiSchema: UiSchema = {
142
+ type: 'HorizontalLayout',
143
+ elements: [
144
+ { type: 'Control', scope: '#/properties/SIDE' },
145
+ { type: 'Control', scope: '#/properties/STATUS' },
146
+ { type: 'Control', scope: '#/properties/TRADE_DATE' },
147
+ ],
148
+ };
149
+ <Filters resourceName="MY_VIEW" uischema={filterBarUiSchema} onChange={handleChange} />
150
+ \`\`\`
151
+
152
+ Pick per placement: strip above/below a grid → \`HorizontalLayout\`; dedicated side tile →
153
+ \`VerticalLayout\` (or omit uischema). Range fields (date/number) render as min–max input
154
+ pairs in both orientations.
155
+
156
+ The component adapts its own chrome to the root layout (source: \`filters.styles.ts\` +
157
+ the internal \`layout-direction\` attr in \`filters.ts\`):
158
+ - **horizontal**: fields render in ONE nowrap row that scrolls sideways when tight (each
159
+ field min-width \`--filter-horizontal-field-min-width\`, ≈120px); the built-in **Search**
160
+ and **Clear** buttons sit on the SAME row, right after the fields.
161
+ - **vertical**: fields scroll vertically; Search/Clear are pinned below the fields.
162
+ - Extra buttons can be slotted beside Search/Clear via \`slot="actions-start"\` /
163
+ \`slot="actions-end"\` children.
164
+ - Criteria (\`value\`) is built when the user clicks **Search** — NOT live per keystroke.
165
+ Clear fires \`onChange\` with \`value === ''\`.
166
+ ### Popups break in TWO different ways — clipping and stacking
167
+
168
+ Every filter popup (\`Select\`, \`Multiselect\`, \`Combobox\`, \`DatePicker\`, and \`Filters\`' own fields)
169
+ renders inside shadow DOM as an absolutely-positioned div. It cannot escape the page box it sits
170
+ in, and two unrelated things break it. Diagnose first — **\`overflow\` never fixes stacking and
171
+ z-index never fixes clipping**:
172
+
173
+ | Symptom | Cause | Fix |
174
+ |---|---|---|
175
+ | Popup **cut off** at a container edge, hidden part simply absent | \`overflow: hidden\` / \`contain: paint|content\` on an ancestor | \`overflow: visible; contain: none\` — next subsection |
176
+ | Popup fully laid out but a **neighbour paints over it**, and that area is unclickable | The container is a stacking context that out-ranks nothing, or a later sibling ties/wins on z-index | \`position: relative; z-index: 200\` on the filter container — see \`fui-styling\` → LAYERING |
177
+
178
+ The stacking case is what bites when a filter bar sits in a **page shell** above a KPI strip or a
179
+ \`<Layout>\`: give the filter container \`position: relative; z-index: 200\` and give the KPI strip and
180
+ the layout container **no** z-index. Never \`position: sticky\` on those strips — nothing scrolls in a
181
+ generated page shell, and sticky creates a stacking context that traps the popups inside the strip.
182
+
183
+ The clipping case is what bites **inside a FlexLayout tile**: \`.flexlayout__tab\` is
184
+ \`overflow: hidden\`, so a popup taller than the space below its field is cut off at the tile edge and
185
+ no z-index helps. Put the filter field at the TOP of the tile, or lift the filter bar into the page
186
+ shell.
187
+
188
+ ### Dropdown overflow — don't let select/multiselect popups get clipped
189
+
190
+ A \`Filters\` with a select or multiselect field, placed in a card/tile (the usual filter tile),
191
+ CROPS its dropdown popup: the popup is absolutely-positioned and paints below the field, but the
192
+ card clips it. Two layers clip it and BOTH must be opened (source: \`filters.styles.ts\` +
193
+ foundation-ui PR #2349's showcase \`Filters.css\`):
194
+
195
+ 1. **The Filters component's own containers** default to \`overflow: hidden\` (for field scrolling).
196
+ Add \`className="filters-dropdown-overflow"\` on the \`<Filters>\` element — its opt-in
197
+ \`:host(.filters-dropdown-overflow)\` rules set container / container-body / container-forms to
198
+ \`overflow: visible\` (and size the vertical fields to content so the pinned Search/Clear flow
199
+ below). This trades away that instance's internal field scrolling.
200
+ 2. **The wrapping card/tile** clips it too — and \`overflow: visible\` ALONE is NOT enough:
201
+ \`rapid-card\` (and other rapid surfaces) default to \`contain: content\`, whose PAINT containment
202
+ clips overflowing children even when overflow is visible. The wrapper needs BOTH:
203
+ \`\`\`css
204
+ /* on the tile/card that wraps <Filters> */
205
+ .my-filter-tile { overflow: visible; contain: none; }
206
+ \`\`\`
207
+
208
+ \`\`\`tsx
209
+ <div className="my-filter-tile">{/* overflow:visible; contain:none (see CSS above) */}
210
+ <Filters className="filters-dropdown-overflow" resourceName="MY_VIEW" uischema={uischema} onChange={handleChange} />
211
+ </div>
212
+ \`\`\`
213
+
214
+ Only needed when a field renders a popup (select / multiselect / connected lookup). A text/number/
215
+ date filter with no dropdown does not need either — leave the tile's normal overflow alone so the
216
+ grid below still clips/scrolls correctly.
217
+
218
+ ### Sizing — Filters stacked above a grid/EntityManagement in ONE tile
219
+
220
+ A tile that stacks Filters over a grid MUST be a flex column, the FILTERS host must be
221
+ constrained to its NATURAL height, and the grid area MUST take the remainder — otherwise
222
+ EntityManagement/grid-pro collapses to 0 height (nothing renders below the filter bar):
223
+
224
+ \`\`\`tsx
225
+ <div style={{ height: '100%', display: 'flex', flexDirection: 'column' }}>
226
+ {/* CRITICAL: Filters' own :host is height:100% (filters.styles.ts) — as a flex child it
227
+ would STRETCH and squash the grid to 0. Pin it to its natural height so the grid gets
228
+ the rest. flex:'0 0 auto' + height:'auto' (inline style wins over the :host rule). */}
229
+ <Filters
230
+ resourceName="MY_VIEW"
231
+ uischema={filterBarUiSchema}
232
+ onChange={handleChange}
233
+ style={{ flex: '0 0 auto', height: 'auto' }}
234
+ />
235
+ <div style={{ flex: 1, minHeight: 0 }}>
236
+ {/* EntityManagement / grid fills the remainder — height 100%, never auto */}
237
+ <EntityManagement style={{ height: '100%' }} ... />
238
+ </div>
239
+ </div>
240
+ \`\`\`
241
+
242
+ Two non-negotiables here:
243
+ - **Override the Filters host height.** \`filters.styles.ts\` \`:host\` is
244
+ \`display:flex; flex-direction:column; height:100%; min-height:0; overflow:hidden\` — that
245
+ \`height:100%\` makes Filters fill the tile and starve the grid. Give the \`<Filters>\` element
246
+ \`style={{ flex: '0 0 auto', height: 'auto' }}\` (inline style overrides the \`:host\` rule) so it
247
+ takes only the height its fields need. If the React wrapper does not forward \`style\` to the
248
+ host, wrap Filters in a \`<div style={{ flex: '0 0 auto' }}>\` AND target the element in the
249
+ tile's CSS: \`foundation-filters { height: auto !important; }\`.
250
+ - **\`minHeight: 0\` on the grid's flex child** is REQUIRED (flexbox default min-height blocks the
251
+ grid from shrinking to fit); the inner grid/EntityManagement always gets \`height: '100%'\`.
252
+
253
+ **Pattern: Filters component in a dedicated layout tile driving all other tiles**
254
+
255
+ 1. Place \`<Filters resourceName="MY_VIEW" />\` in a dedicated FlexLayout tile component
256
+ 2. On \`onChange\`, read criteria from \`(e.target as FiltersRef).value\` and store in a Redux slice
257
+ 3. Subscribe all other tile components to that slice's criteria selector
258
+ 4. Pass criteria to each tile's datasource
259
+
260
+ \`\`\`tsx
261
+ // FilterTileComponent.tsx — in the layout tile
262
+ import React from 'react';
263
+ import { Filters, FiltersRef } from '@genesislcap/foundation-forms/react';
264
+ import { actions } from '../../../store/store';
265
+
266
+ const FilterTileComponent: React.FC = () => {
267
+ const handleChange = (e: Event) => {
268
+ // criteria is already a fully built string — no CriteriaBuilder needed
269
+ const criteria = (e.target as FiltersRef).value ?? '';
270
+ actions.sharedFilters.setCriteria(criteria);
271
+ };
272
+
273
+ return (
274
+ <div style={{ height: '100%', overflow: 'auto', padding: '8px' }}>
275
+ <Filters resourceName="MY_VIEW" onChange={handleChange} />
276
+ </div>
277
+ );
278
+ };
279
+ export default FilterTileComponent;
280
+ \`\`\`
281
+
282
+ \`\`\`ts
283
+ // store/slices/sharedFilters.slice.ts
284
+ import { createSlice, PayloadAction } from '@genesislcap/foundation-redux';
285
+
286
+ const sharedFiltersSlice = createSlice({
287
+ name: 'sharedFilters',
288
+ initialState: { criteria: '' },
289
+ reducers: {
290
+ setCriteria: (state, action: PayloadAction<string>) => { state.criteria = action.payload; },
291
+ clearCriteria: (state) => { state.criteria = ''; },
292
+ },
293
+ selectors: {
294
+ getCriteria: (state) => state.criteria,
295
+ },
296
+ });
297
+ export default sharedFiltersSlice;
298
+ \`\`\`
299
+
300
+ Then in each target tile component:
301
+ \`\`\`tsx
302
+ import { useSelector } from 'react-redux';
303
+ import { selectors } from '../../../store/store';
304
+
305
+ const sharedCriteria = useSelector(selectors.sharedFilters.getCriteria);
306
+ // pass to datasource:
307
+ <EntityManagement datasourceConfig={{ criteria: sharedCriteria || undefined, requestAutoSetup: false }} ... />
308
+ \`\`\`
309
+
310
+ **AI WORKFLOW for Option A:**
311
+ 1. \`vfs_snapshot\` with description
312
+ 2. \`read_projectSnapshot()\` to identify routes and tile names
313
+ 3. \`read_context('fui-eventing')\` — for Redux slice wiring rules
314
+ 4. \`vfs_read('@genesislcap/foundation-forms/react.d.ts')\` — exact Filters prop API
315
+ 5. \`vfs_write\` the slice (\`store/slices/sharedFilters.slice.ts\`)
316
+ 6. \`vfs_read store/store.ts\` → \`vfs_edit\` to register the slice
317
+ 7. \`vfs_write\` the filter tile component (e.g. \`Home/FilterTile/FilterTileComponent.tsx\`)
318
+ 8. \`vfs_read\` each target tile → \`vfs_edit\` to add criteria subscription
319
+ 9. After writing each file, call \`file_done({ path })\`. When the last file is recorded, the automatic review type-checks the whole batch and the machine applies the changes — you do not call vfs_auto_fix or vfs_flush_changes yourself.
320
+
321
+ ---
322
+
323
+ ### OPTION B — Global-filters Redux pattern (custom hand-written UI)
324
+
325
+ **Only use Option B when:** the filter must live in the app header and be visible across ALL routes
326
+ simultaneously, OR the user explicitly requires field transformations (e.g. date arithmetic,
327
+ multi-step encoding) that the server view cannot express.
328
+
329
+ **Do NOT use Option B** just because: the user hasn't named specific fields; the filter drives
330
+ multiple tiles; you want more control. All of those are Option A use cases.
331
+
332
+ **Before implementing, ask the user:**
333
+ 1. Which fields should be filterable? (date range, entity, status, side, etc.)
334
+ 2. What are the exact datasource field names? (e.g. \`TRADE_DATE\`, \`ENTITY\`, \`SIDE\`)
335
+ 3. Which routes/tiles should receive the filter? (default: all)
336
+ 4. Placement: header (compact, always visible) or below the header per-page? (default: header)
337
+
338
+ ---
339
+
340
+ ### OPTION B — VFS PATHS FOR SHARED COMPONENTS AND LAYOUTS
341
+
342
+ - **Reusable cross-page component**: \`components/{Name}/{Name}.tsx\` + \`components/{Name}/{Name}.css\`
343
+ → writes to \`client/src/components/{Name}/{Name}.tsx\`
344
+ - **DefaultLayout override**: \`layouts/default/DefaultLayout.tsx\`
345
+ → writes to \`client/src/layouts/default/DefaultLayout.tsx\`
346
+
347
+ These paths are handled by the preview service as direct writes — do NOT use a \`pages/\` prefix.
348
+
349
+ ---
350
+
351
+ ### OPTION B STEP 1 — Redux slice: \`store/slices/globalFilters.slice.ts\`
352
+
353
+ **Serialisers** (verified from \`foundation-criteria/src/serialisers.ts\`):
354
+ \`EQ\`, \`NE\`, \`GT\`, \`GE\`, \`LT\`, \`LE\`, \`AND\`, \`OR\`, \`NOT\`,
355
+ \`equals\`, \`equalsIgnoreCase\`, \`contains\`, \`fieldContains\`, \`containsIgnoreCase\`,
356
+ \`startsWith\`, \`endsWith\`, \`dateIsToday\`, \`dateIsEqual\`, \`dateIsGreaterEqual\`,
357
+ \`dateIsLessEqual\`, \`dateTimeIsGreaterEqual\`, \`dateTimeIsLessEqual\`
358
+ (full output-pattern table: \`fui-criteria\` context)
359
+
360
+ \`\`\`ts
361
+ import { createSlice, PayloadAction } from '@genesislcap/foundation-redux';
362
+ import { CriteriaBuilder, ExpressionBuilder, Serialisers, Join } from '@genesislcap/foundation-criteria';
363
+
364
+ // Shape is application-specific — fill in based on user's filter fields
365
+ export interface GlobalFiltersState {
366
+ dateFrom: string;
367
+ dateTo: string;
368
+ // entity: string;
369
+ // side: string;
370
+ }
371
+
372
+ const initialState: GlobalFiltersState = {
373
+ dateFrom: '',
374
+ dateTo: '',
375
+ };
376
+
377
+ const globalFiltersSlice = createSlice({
378
+ name: 'globalFilters',
379
+ initialState,
380
+ reducers: {
381
+ setDateFrom: (state, action: PayloadAction<string>) => { state.dateFrom = action.payload; },
382
+ setDateTo: (state, action: PayloadAction<string>) => { state.dateTo = action.payload; },
383
+ // setEntity: (state, action: PayloadAction<string>) => { state.entity = action.payload; },
384
+ resetFilters: () => initialState,
385
+ },
386
+ selectors: {
387
+ // getCriteria builds the complete criteria string to pass to datasourceConfig
388
+ getCriteria: (state: GlobalFiltersState): string => {
389
+ const builder = new CriteriaBuilder();
390
+
391
+ // Date range — strip hyphens: "2026-01-15" → "20260115"
392
+ const from = state.dateFrom ? state.dateFrom.split('-').join('') : undefined;
393
+ const to = state.dateTo ? state.dateTo.split('-').join('') : undefined;
394
+ if (from) {
395
+ builder.withExpression(
396
+ new ExpressionBuilder().withField('TRADE_DATE').withValue(from)
397
+ .withSerialiser(Serialisers.dateIsGreaterEqual).build()
398
+ );
399
+ }
400
+ if (to) {
401
+ builder.withExpression(
402
+ new ExpressionBuilder().withField('TRADE_DATE').withValue(to)
403
+ .withSerialiser(Serialisers.dateIsLessEqual).build()
404
+ );
405
+ }
406
+
407
+ // String equality — single value
408
+ // if (state.entity) {
409
+ // builder.withExpression(
410
+ // new ExpressionBuilder().withField('ENTITY').withValue(state.entity)
411
+ // .withSerialiser(Serialisers.EQ).build()
412
+ // );
413
+ // }
414
+
415
+ // Multi-value OR — array of values
416
+ // if (state.sides.length === 1) {
417
+ // builder.withExpression(
418
+ // new ExpressionBuilder().withField('SIDE').withValue(state.sides[0])
419
+ // .withSerialiser(Serialisers.EQ).build()
420
+ // );
421
+ // } else if (state.sides.length > 1) {
422
+ // builder.withExpression(
423
+ // state.sides.map(v =>
424
+ // new ExpressionBuilder().withField('SIDE').withValue(v).withSerialiser(Serialisers.EQ).build()
425
+ // ),
426
+ // { join: Join.Or() }
427
+ // );
428
+ // }
429
+
430
+ const result = builder.build();
431
+ return result === '()' ? '' : result; // empty string = no filter applied
432
+ },
433
+ getDateFrom: (state) => state.dateFrom,
434
+ getDateTo: (state) => state.dateTo,
435
+ },
436
+ });
437
+
438
+ export default globalFiltersSlice;
439
+ \`\`\`
440
+
441
+ **Slice rules:**
442
+ - \`name\` must match the key used in \`createStore\` preloaded state (\`'globalFilters'\`)
443
+ - Always define \`selectors\` inside \`createSlice\` — foundation-redux auto-exposes them as \`selectors.globalFilters.*\`
444
+ - \`getCriteria\` returns \`''\` (not \`'()'\`) when no filters are set — empty string means no server filter
445
+ - Date range: strip hyphens from ISO date (\`YYYY-MM-DD\` → \`YYYYMMDD\`), use \`Serialisers.dateIsGreaterEqual\` / \`dateIsLessEqual\`
446
+ - String equality: \`Serialisers.EQ\`
447
+ - Multi-value OR: pass expression array with \`{ join: Join.Or() }\`
448
+ - **Actions are pre-bound** — call \`actions.globalFilters.setDateFrom(value)\` directly, never \`dispatch()\`
449
+
450
+ ---
451
+
452
+ ### OPTION B STEP 2 — Register in \`store/store.ts\`
453
+
454
+ \`vfs_read store/store.ts\`, then \`vfs_edit\` using safe anchors (see WHITESPACE TRAP in eventing context):
455
+
456
+ \`\`\`ts
457
+ // Add import after eventing import:
458
+ import globalFiltersSlice from './slices/globalFilters.slice';
459
+
460
+ // Extend createStore:
461
+ export const { reduxStore, store, actions, selectors } = createStore(
462
+ [eventingSlice, globalFiltersSlice],
463
+ {
464
+ eventing: { /* existing */ },
465
+ globalFilters: globalFiltersSlice.getInitialState(),
466
+ },
467
+ );
468
+ \`\`\`
469
+
470
+ \`getInitialState()\` is a method call, not \`.initialState\`.
471
+
472
+ ---
473
+
474
+ ### OPTION B STEP 3 — GlobalFilters React component
475
+
476
+ **MANDATORY**: Read \`vfs_read react.d.ts\` for every Genesis input component you use (date picker,
477
+ select, text field) before writing any code — same PRE-WRITE GATE rule as all other components.
478
+
479
+ VFS key: \`components/GlobalFilters/GlobalFilters.tsx\`
480
+
481
+ \`\`\`tsx
482
+ import React from 'react';
483
+ import { useSelector } from 'react-redux';
484
+ import { Select, Button, ListboxOption } from '@genesislcap/rapid-design-system/react';
485
+ import { actions, selectors } from '../../store/store';
486
+ import './GlobalFilters.css';
487
+
488
+ // Values must come from query_project_schema('entities', entityName) — NEVER hardcode assumed enum values
489
+ const SIDE_OPTIONS = [
490
+ { value: '', label: 'All Sides' }, // first option = unselected state (no placeholder prop)
491
+ { value: 'BUY', label: 'BUY' },
492
+ { value: 'SELL', label: 'SELL' },
493
+ ];
494
+
495
+ const GlobalFilters: React.FC = () => {
496
+ const selectedSide = useSelector(selectors.globalFilters.getSide);
497
+
498
+ const handleSideChange = (e: Event) => {
499
+ actions.globalFilters.setSide((e.target as HTMLSelectElement).value || null);
500
+ };
501
+
502
+ return (
503
+ <div className="global-filters">
504
+ <Select value={selectedSide ?? ''} onChange={handleSideChange}>
505
+ {SIDE_OPTIONS.map(option => (
506
+ <ListboxOption key={option.value} value={option.value}>
507
+ {option.label}
508
+ </ListboxOption>
509
+ ))}
510
+ </Select>
511
+ <Button onClick={() => actions.globalFilters.resetFilters()}>Clear</Button>
512
+ </div>
513
+ );
514
+ };
515
+
516
+ export default GlobalFilters;
517
+ \`\`\`
518
+
519
+ VFS key: \`components/GlobalFilters/GlobalFilters.css\`
520
+
521
+ \`\`\`css
522
+ .global-filters {
523
+ /* The Select/DatePicker popups render inside shadow DOM and cannot escape this container, so
524
+ it must out-rank every LATER sibling it opens over (KPI strips, FlexLayout tiles). 200 clears
525
+ those and stays under foundation-header (999) and the flyout layer (2000+).
526
+ NEVER use position:sticky here — nothing scrolls in a generated page shell and sticky
527
+ creates a stacking context that traps the popups. See fui-styling → LAYERING. */
528
+ position: relative;
529
+ z-index: 200;
530
+ display: flex;
531
+ align-items: center;
532
+ gap: 8px;
533
+ padding: 0 12px;
534
+ }
535
+ .global-filters__label {
536
+ font-size: 12px;
537
+ color: var(--neutral-foreground-rest);
538
+ }
539
+ \`\`\`
540
+
541
+ When \`GlobalFilters\` is placed in the **header** (\`slot="routes-end"\`) it is inside
542
+ \`foundation-header\`'s own stacking context and needs no z-index of its own — the rule above matters
543
+ for the **content-start / per-page** placements, where it sits above the route's KPI strip and
544
+ \`<Layout>\`.
545
+
546
+ **Select + ListboxOption rules — MANDATORY:**
547
+ - Import both \`Select\` AND \`ListboxOption\` from \`@genesislcap/rapid-design-system/react\`
548
+ - Children of \`Select\` MUST be \`ListboxOption\` — NOT HTML \`<option>\` elements
549
+ - \`Select\` does NOT accept a \`placeholder\` prop — use a first \`<ListboxOption value="">All X</ListboxOption>\` for the unselected state
550
+ - \`onChange\` handler type: \`(e: Event) => void\`; read value via \`(e.target as HTMLSelectElement).value\`
551
+ - Controlled \`Select\` needs \`value\` prop: \`value={selectedValue ?? ''}\`
552
+ - Always import and use React wrappers from \`@genesislcap/rapid-design-system/react\` — do NOT use raw web component JSX strings like \`<rapid-date-picker>\`
553
+
554
+ ---
555
+
556
+ ### OPTION B STEP 4 — Inject into DefaultLayout (header placement)
557
+
558
+ VFS key: \`layouts/default/DefaultLayout.tsx\`
559
+
560
+ \`vfs_read layouts/default/DefaultLayout.tsx\` first, then \`vfs_edit\` to add:
561
+
562
+ \`\`\`tsx
563
+ import GlobalFilters from '../../components/GlobalFilters/GlobalFilters';
564
+
565
+ // Inside <foundation-header ...> before <PBCElementsRenderer target={TARGET_HEADER_NAV} />:
566
+ <span slot="routes-end">
567
+ <GlobalFilters />
568
+ </span>
569
+ \`\`\`
570
+
571
+ **Alternative — content-start placement** (when filters are too wide for the header):
572
+ \`\`\`tsx
573
+ // Inside <section className={styles['content']}> before <Outlet />:
574
+ {connected && <GlobalFilters />}
575
+ {connected && <PBCElementsRenderer target={TARGET_CONTENT_START} />}
576
+ \`\`\`
577
+
578
+ ---
579
+
580
+ ### OPTION B STEP 5 — Apply criteria in page components
581
+
582
+ \`vfs_read\` each affected page file, then \`vfs_edit\` to add criteria from the selector.
583
+
584
+ \`\`\`tsx
585
+ import { useSelector } from 'react-redux';
586
+ import { selectors } from '../../../store/store'; // adjust depth as needed
587
+
588
+ // In the component body:
589
+ const globalCriteria = useSelector(selectors.globalFilters.getCriteria);
590
+
591
+ // EntityManagement:
592
+ <EntityManagement datasourceConfig={{ criteria: globalCriteria || undefined, requestAutoSetup: false }} ... />
593
+
594
+ // RapidGridPro with GridProGenesisDatasource:
595
+ <GridProGenesisDatasource criteria={globalCriteria || undefined} requestAutoSetup={false} ... />
596
+
597
+ // MERGING with tile-level eventing criteria (when the tile also has a row-selection listener):
598
+ const eventingCriteria = useSelector(selectors.eventing.getCriteriaFor{TileName});
599
+ const criteria = [globalCriteria, eventingCriteria].filter(Boolean).join(' AND ') || undefined;
600
+ <EntityManagement datasourceConfig={{ criteria, requestAutoSetup: false }} ... />
601
+ \`\`\`
602
+
603
+ Pass \`undefined\` (not \`''\`) when no criteria — an empty string is a valid (but no-op) criteria
604
+ string; \`undefined\` tells the datasource to fetch without a filter.
605
+
606
+ ---
607
+
608
+ ### OPTION B AI WORKFLOW
609
+
610
+ 1. Ask the user which fields, field names, tiles, and placement before generating
611
+ 2. \`vfs_snapshot\` with description (e.g. "Add global date filter bar")
612
+ 3. \`read_projectSnapshot()\` to identify all routes and tile names
613
+ 4. For each filter field with enum/status values (side, status, type, direction, etc.): call \`query_project_schema('entities', entityName)\` to get the real server-side enum values — NEVER hardcode assumed values from memory
614
+ 5. \`vfs_read react.d.ts\` for all Genesis input components you plan to use
615
+ 6. \`vfs_write store/slices/globalFilters.slice.ts\`
616
+ 7. \`vfs_read store/store.ts\` → \`vfs_edit\` to add slice
617
+ 8. \`vfs_write components/GlobalFilters/GlobalFilters.tsx\` + \`vfs_write components/GlobalFilters/GlobalFilters.css\`
618
+ 9. \`vfs_read layouts/default/DefaultLayout.tsx\` → \`vfs_edit\` to inject component
619
+ 10. For each applicable route: \`vfs_read\` page file → \`vfs_edit\` to add \`criteria\` to datasources
620
+ 11. After writing each file, call \`file_done({ path })\`. The automatic review type-checks the whole batch and the machine applies the changes and shows the preview — you do not call vfs_auto_fix, vfs_flush_changes, or show_preview_status yourself.
621
+
622
+ ---
623
+
624
+ ### Foundation Forms — Categorization/Stepper tabs are \`Control\` elements
625
+
626
+ There are NO \`'Category'\` or \`'Step'\` element types. \`UiSchemaElementType\` is exactly:
627
+ \`Control | VerticalLayout | LayoutVertical2Columns | FormGridLayout | Categorization | Group | Stepper | HorizontalLayout\`
628
+ (foundation-forms \`types.ts\`). Each tab/step is a \`Control\` item in the root \`elements\`,
629
+ scoped to an object property, with the section content in that Control's own
630
+ \`options.childElements\`. The Stepper renderer reads each step element's \`scope\` for
631
+ validation — omitting it breaks the stepper. Full examples: \`fui-form-component\` context.
632
+
633
+ \`\`\`ts
634
+ {
635
+ type: 'Categorization',
636
+ elements: [
637
+ {
638
+ type: 'Control', // ← 'Control' — 'Category' does NOT exist (TS error)
639
+ scope: '#/properties/basic',
640
+ label: 'Personal',
641
+ options: {
642
+ childElements: [
643
+ {
644
+ type: 'VerticalLayout',
645
+ elements: [
646
+ { type: 'Control', scope: '#/properties/basic/properties/FIRST_NAME' },
647
+ ],
648
+ },
649
+ ],
650
+ },
651
+ },
652
+ ],
653
+ }
654
+ \`\`\`
655
+
656
+ ---
657
+
658
+ ### DANGEROUS PATTERNS
659
+
660
+ #### DP-1: Importing Filters from the wrong package
661
+
662
+ \`\`\`ts
663
+ // WRONG — foundation-filters is a feature-flag utility, NOT the filter UI component:
664
+ import { Filters } from '@genesislcap/foundation-filters/react'; // package doesn't exist
665
+ import { Filters } from 'foundation-filters'; // wrong package entirely
666
+
667
+ // CORRECT:
668
+ import { Filters, FiltersRef } from '@genesislcap/foundation-forms/react';
669
+ \`\`\`
670
+
671
+ #### DP-2: Reading criteria from event detail instead of event.target.value
672
+
673
+ \`\`\`ts
674
+ // WRONG — event detail is empty on the Filters component:
675
+ const criteria = (e as CustomEvent).detail?.criteria; // undefined
676
+ const criteria = (e as CustomEvent).detail?.value; // undefined
677
+
678
+ // CORRECT — read from the component's value observable via event.target:
679
+ const criteria = (e.target as FiltersRef).value; // built criteria string
680
+ // or:
681
+ const criteria = (e.target as any).value ?? '';
682
+ \`\`\`
683
+
684
+ #### DP-3: Using onCriteriaChange — that prop does not exist
685
+
686
+ \`\`\`tsx
687
+ // WRONG — onCriteriaChange is not a prop on Filters:
688
+ <Filters resourceName="MY_VIEW" onCriteriaChange={handleChange} />
689
+
690
+ // CORRECT — use onChange (maps to the 'change' DOM event):
691
+ <Filters resourceName="MY_VIEW" onChange={handleChange} />
692
+ \`\`\`
693
+
694
+ #### DP-4: \`childElements\` at root UiSchema level
695
+
696
+ \`\`\`ts
697
+ // WRONG — childElements never goes at root:
698
+ const schema: UiSchema = {
699
+ type: 'Categorization',
700
+ childElements: [...], // wrong level
701
+ };
702
+
703
+ // CORRECT — childElements is always inside options on a section element:
704
+ { type: 'Control', scope: '#/properties/tab1', label: 'Tab', options: { childElements: [...] } }
705
+ \`\`\`
706
+
707
+ #### DP-5: Inventing \`'Category'\` / \`'Step'\` element types (vanilla-JSONForms habit)
708
+
709
+ \`\`\`ts
710
+ // WRONG — not in UiSchemaElementType; fails the typecheck:
711
+ { type: 'Category', label: 'Tab', options: { childElements: [...] } }
712
+ { type: 'Step', label: 'Step 1', options: { childElements: [...] } }
713
+
714
+ // CORRECT — tabs/steps are Control elements scoped to an object property:
715
+ { type: 'Control', scope: '#/properties/tab1', label: 'Tab', options: { childElements: [...] } }
716
+ \`\`\`
717
+
718
+ #### DP-6: Building criteria strings manually when Option A is available
719
+
720
+ \`\`\`ts
721
+ // WRONG for Option A — manual criteria building:
722
+ const criteria = \`SIDE == '\${selectedSide}'\`; // fragile, injection-prone
723
+
724
+ // CORRECT for Option A — let Filters component build the criteria:
725
+ const handleChange = (e: Event) => {
726
+ const criteria = (e.target as FiltersRef).value; // already fully built by the component
727
+ actions.sharedFilters.setCriteria(criteria);
728
+ };
729
+ \`\`\`
730
+
731
+ #### DP-7: Passing \`''\` (empty string) as criteria when no filter is set
732
+
733
+ \`\`\`ts
734
+ // WRONG — empty string is passed as criteria, server applies a no-op filter:
735
+ datasourceConfig={{ criteria: sharedCriteria, requestAutoSetup: false }}
736
+
737
+ // CORRECT — pass undefined when no filter to allow datasource to fetch all:
738
+ datasourceConfig={{ criteria: sharedCriteria || undefined, requestAutoSetup: false }}
739
+ \`\`\`
740
+
741
+ #### DP-8: Using \`dispatch()\` to call actions (foundation-redux actions are pre-bound)
742
+
743
+ \`\`\`ts
744
+ // WRONG — useDispatch is not needed; actions dispatch themselves:
745
+ import { useDispatch } from 'react-redux';
746
+ const dispatch = useDispatch();
747
+ dispatch(actions.globalFilters.setDateFrom(value)); // TS error: returns void
748
+
749
+ // CORRECT — call actions directly:
750
+ actions.globalFilters.setDateFrom(value);
751
+ \`\`\`
752
+
753
+ #### DP-9: Using \`mySlice.initialState\` instead of \`mySlice.getInitialState()\`
754
+
755
+ \`\`\`ts
756
+ // WRONG:
757
+ globalFilters: globalFiltersSlice.initialState, // undefined
758
+
759
+ // CORRECT:
760
+ globalFilters: globalFiltersSlice.getInitialState(),
761
+ \`\`\`
762
+
763
+ #### DP-10: \`position: sticky\` on the filter bar — hides its own dropdowns
764
+
765
+ \`\`\`css
766
+ /* WRONG — sticky creates a stacking context even though nothing on the page scrolls, trapping
767
+ the Select listbox and DatePicker calendar inside the filter bar's layer. Any later sibling
768
+ with an equal-or-higher z-index (a KPI strip at the same value, the FlexLayout tiles) then
769
+ paints over the popup, and that region stops responding to clicks. */
770
+ .global-filters { position: sticky; top: 0; z-index: 10; }
771
+
772
+ /* CORRECT — positioned, and ranked above every later sibling in the shell: */
773
+ .global-filters { position: relative; z-index: 200; }
774
+ \`\`\`
775
+
776
+ Verify by opening each filter's popup and confirming the FIRST option is clickable, not just
777
+ visible — a covered popup still renders its lower half, so a screenshot alone will not show it.
778
+ `.trim();