@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.
- package/dist/ai-assistant.api.json +97 -0
- package/dist/ai-assistant.d.ts +65 -0
- package/dist/chat-driver.cjs +18031 -0
- package/dist/chat-driver.cjs.map +4 -4
- package/dist/chat-driver.mjs +18024 -0
- package/dist/chat-driver.mjs.map +4 -4
- package/dist/custom-elements.json +5524 -2684
- package/dist/dts/chat-driver-node.d.ts +2 -0
- package/dist/dts/chat-driver-node.d.ts.map +1 -1
- package/dist/dts/code-review/code-review.types.d.ts +76 -0
- package/dist/dts/code-review/code-review.types.d.ts.map +1 -0
- package/dist/dts/code-review/code-reviewer.agent.d.ts +77 -0
- package/dist/dts/code-review/code-reviewer.agent.d.ts.map +1 -0
- package/dist/dts/code-review/code-reviewer.prompt.d.ts +23 -0
- package/dist/dts/code-review/code-reviewer.prompt.d.ts.map +1 -0
- package/dist/dts/code-review/gate.d.ts +44 -0
- package/dist/dts/code-review/gate.d.ts.map +1 -0
- package/dist/dts/code-review/index.d.ts +27 -0
- package/dist/dts/code-review/index.d.ts.map +1 -0
- package/dist/dts/code-review/review-changes.d.ts +70 -0
- package/dist/dts/code-review/review-changes.d.ts.map +1 -0
- package/dist/dts/code-review/rules/context-trigger-map.d.ts +6 -0
- package/dist/dts/code-review/rules/context-trigger-map.d.ts.map +1 -0
- package/dist/dts/code-review/rules/context.registry.d.ts +123 -0
- package/dist/dts/code-review/rules/context.registry.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-ai-extensions.d.ts +13 -0
- package/dist/dts/code-review/rules/fui-ai-extensions.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-blotter.d.ts +16 -0
- package/dist/dts/code-review/rules/fui-blotter.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-chart.d.ts +20 -0
- package/dist/dts/code-review/rules/fui-chart.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-column-defs.d.ts +21 -0
- package/dist/dts/code-review/rules/fui-column-defs.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-components.d.ts +9 -0
- package/dist/dts/code-review/rules/fui-components.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-criteria.d.ts +32 -0
- package/dist/dts/code-review/rules/fui-criteria.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-custom-renderer.d.ts +15 -0
- package/dist/dts/code-review/rules/fui-custom-renderer.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-dashboard.d.ts +19 -0
- package/dist/dts/code-review/rules/fui-dashboard.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-dialogs.d.ts +19 -0
- package/dist/dts/code-review/rules/fui-dialogs.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-entity-management.d.ts +19 -0
- package/dist/dts/code-review/rules/fui-entity-management.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-error-boundary.d.ts +9 -0
- package/dist/dts/code-review/rules/fui-error-boundary.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-eventing.d.ts +8 -0
- package/dist/dts/code-review/rules/fui-eventing.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-flexlayout.d.ts +17 -0
- package/dist/dts/code-review/rules/fui-flexlayout.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-flyout-panel.d.ts +10 -0
- package/dist/dts/code-review/rules/fui-flyout-panel.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-form-component.d.ts +9 -0
- package/dist/dts/code-review/rules/fui-form-component.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-formatters.d.ts +12 -0
- package/dist/dts/code-review/rules/fui-formatters.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-foundation-comms.d.ts +10 -0
- package/dist/dts/code-review/rules/fui-foundation-comms.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-global-filters.d.ts +33 -0
- package/dist/dts/code-review/rules/fui-global-filters.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-import-surface.d.ts +37 -0
- package/dist/dts/code-review/rules/fui-import-surface.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-inline-editing.d.ts +10 -0
- package/dist/dts/code-review/rules/fui-inline-editing.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-layout.d.ts +7 -0
- package/dist/dts/code-review/rules/fui-layout.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-notifications.d.ts +12 -0
- package/dist/dts/code-review/rules/fui-notifications.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-primitives.d.ts +26 -0
- package/dist/dts/code-review/rules/fui-primitives.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-rapid-grid-pro.d.ts +18 -0
- package/dist/dts/code-review/rules/fui-rapid-grid-pro.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-redux-store.d.ts +8 -0
- package/dist/dts/code-review/rules/fui-redux-store.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-reporting.d.ts +19 -0
- package/dist/dts/code-review/rules/fui-reporting.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-styling.d.ts +15 -0
- package/dist/dts/code-review/rules/fui-styling.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-trade-form.d.ts +13 -0
- package/dist/dts/code-review/rules/fui-trade-form.d.ts.map +1 -0
- package/dist/dts/code-review/submit-code-review.tool.d.ts +12 -0
- package/dist/dts/code-review/submit-code-review.tool.d.ts.map +1 -0
- package/dist/dts/code-review/unified-diff.d.ts +7 -0
- package/dist/dts/code-review/unified-diff.d.ts.map +1 -0
- package/dist/dts/code-review/verdict.d.ts +23 -0
- package/dist/dts/code-review/verdict.d.ts.map +1 -0
- package/dist/dts/components/code-review-result/code-review-result.d.ts +26 -0
- package/dist/dts/components/code-review-result/code-review-result.d.ts.map +1 -0
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/react.d.ts +20 -10
- package/dist/esm/chat-driver-node.js +6 -0
- package/dist/esm/code-review/code-review.types.js +6 -0
- package/dist/esm/code-review/code-reviewer.agent.js +167 -0
- package/dist/esm/code-review/code-reviewer.prompt.js +103 -0
- package/dist/esm/code-review/gate.js +93 -0
- package/dist/esm/code-review/index.js +28 -0
- package/dist/esm/code-review/review-changes.js +123 -0
- package/dist/esm/code-review/rules/context-trigger-map.js +20 -0
- package/dist/esm/code-review/rules/context.registry.js +772 -0
- package/dist/esm/code-review/rules/fui-ai-extensions.js +306 -0
- package/dist/esm/code-review/rules/fui-blotter.js +596 -0
- package/dist/esm/code-review/rules/fui-chart.js +669 -0
- package/dist/esm/code-review/rules/fui-column-defs.js +862 -0
- package/dist/esm/code-review/rules/fui-components.js +245 -0
- package/dist/esm/code-review/rules/fui-criteria.js +538 -0
- package/dist/esm/code-review/rules/fui-custom-renderer.js +612 -0
- package/dist/esm/code-review/rules/fui-dashboard.js +604 -0
- package/dist/esm/code-review/rules/fui-dialogs.js +588 -0
- package/dist/esm/code-review/rules/fui-entity-management.js +1014 -0
- package/dist/esm/code-review/rules/fui-error-boundary.js +244 -0
- package/dist/esm/code-review/rules/fui-eventing.js +628 -0
- package/dist/esm/code-review/rules/fui-flexlayout.js +860 -0
- package/dist/esm/code-review/rules/fui-flyout-panel.js +432 -0
- package/dist/esm/code-review/rules/fui-form-component.js +898 -0
- package/dist/esm/code-review/rules/fui-formatters.js +415 -0
- package/dist/esm/code-review/rules/fui-foundation-comms.js +518 -0
- package/dist/esm/code-review/rules/fui-global-filters.js +778 -0
- package/dist/esm/code-review/rules/fui-import-surface.js +452 -0
- package/dist/esm/code-review/rules/fui-inline-editing.js +445 -0
- package/dist/esm/code-review/rules/fui-layout.js +431 -0
- package/dist/esm/code-review/rules/fui-notifications.js +439 -0
- package/dist/esm/code-review/rules/fui-primitives.js +1216 -0
- package/dist/esm/code-review/rules/fui-rapid-grid-pro.js +650 -0
- package/dist/esm/code-review/rules/fui-redux-store.js +522 -0
- package/dist/esm/code-review/rules/fui-reporting.js +506 -0
- package/dist/esm/code-review/rules/fui-styling.js +1229 -0
- package/dist/esm/code-review/rules/fui-trade-form.js +618 -0
- package/dist/esm/code-review/submit-code-review.tool.js +43 -0
- package/dist/esm/code-review/unified-diff.js +96 -0
- package/dist/esm/code-review/verdict.js +24 -0
- package/dist/esm/components/code-review-result/code-review-result.js +89 -0
- package/dist/esm/index.js +3 -0
- package/dist/react.cjs +25 -18
- package/dist/react.mjs +23 -17
- package/docs/code-review.md +137 -0
- package/package.json +24 -17
- package/scripts/smoke-chat-driver-node.mjs +15 -0
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context: Dialog, Modal, Flyout components — imperative ref API (Dialog/Modal),
|
|
3
|
+
* controlled prop API (Flyout), confirm flows via showNotificationDialog.
|
|
4
|
+
*
|
|
5
|
+
* Sources verified against:
|
|
6
|
+
* - foundation-ui/packages/foundation/foundation-ds/rapid-design-system/dist/dts/react.d.ts
|
|
7
|
+
* - foundation-ui/packages/foundation/foundation-ui/src/dialog/dialog.ts
|
|
8
|
+
* - foundation-ui/packages/foundation/foundation-ui/src/dialog/dialog.types.ts
|
|
9
|
+
* - foundation-ui/packages/foundation/foundation-ui/src/modal/modal.ts
|
|
10
|
+
* - foundation-ui/packages/foundation/foundation-ui/src/flyout/flyout.ts
|
|
11
|
+
* - foundation-ui/packages/foundation/foundation-notifications/src/dialog/dialog-builder.ts
|
|
12
|
+
* - foundation-ui/packages/foundation/foundation-notifications/src/types.ts
|
|
13
|
+
* - sales-trader-hub: IrVolDeskPanel.tsx, RFQPanel.tsx
|
|
14
|
+
* - showcase: client-app/react-client/src/utils/customEvents.ts
|
|
15
|
+
*/
|
|
16
|
+
export const FUI_DIALOGS_DEPS = ['fui-primitives'];
|
|
17
|
+
export const FUI_DIALOGS_TAGS = [
|
|
18
|
+
'dialog',
|
|
19
|
+
'modal',
|
|
20
|
+
'flyout',
|
|
21
|
+
'popup',
|
|
22
|
+
'overlay',
|
|
23
|
+
'confirm',
|
|
24
|
+
'confirmation',
|
|
25
|
+
'show dialog',
|
|
26
|
+
'show modal',
|
|
27
|
+
'show flyout',
|
|
28
|
+
'open dialog',
|
|
29
|
+
'open modal',
|
|
30
|
+
'open flyout',
|
|
31
|
+
'close dialog',
|
|
32
|
+
'close modal',
|
|
33
|
+
'close flyout',
|
|
34
|
+
'slide-in panel',
|
|
35
|
+
'side panel',
|
|
36
|
+
'confirm before delete',
|
|
37
|
+
'confirm action',
|
|
38
|
+
'confirm dialog',
|
|
39
|
+
'notification dialog',
|
|
40
|
+
'are you sure',
|
|
41
|
+
'delete confirmation',
|
|
42
|
+
'action confirmation',
|
|
43
|
+
'DialogRef',
|
|
44
|
+
'ModalRef',
|
|
45
|
+
'FlyoutRef',
|
|
46
|
+
'showNotificationDialog',
|
|
47
|
+
'draggable dialog',
|
|
48
|
+
'resizable dialog',
|
|
49
|
+
'blocking overlay',
|
|
50
|
+
// A "ticket" is a modal, but the word routes to fui-trade-form (UISchema fields), which never
|
|
51
|
+
// warns against hand-rolling the shell — which is how a fixed-position div with a backdrop and a
|
|
52
|
+
// guessed z-index got built instead of using Modal. Same for the words that describe that shape.
|
|
53
|
+
'ticket',
|
|
54
|
+
'order ticket',
|
|
55
|
+
'trade ticket',
|
|
56
|
+
'execute ticket',
|
|
57
|
+
'backdrop',
|
|
58
|
+
'scrim',
|
|
59
|
+
'position fixed',
|
|
60
|
+
'z-index',
|
|
61
|
+
];
|
|
62
|
+
export const FUI_DIALOGS_CONTEXT = `
|
|
63
|
+
## Dialog / Modal / Flyout — \`@genesislcap/rapid-design-system/react\`
|
|
64
|
+
|
|
65
|
+
**Read react.d.ts BEFORE use:** VFS key \`@genesislcap/rapid-design-system/react.d.ts\`
|
|
66
|
+
|
|
67
|
+
> **What goes INSIDE the modal.** This module covers the SHELL (open/close, ref API, stacking).
|
|
68
|
+
> If the modal contains fields the user fills in and submits, its body is a foundation-forms
|
|
69
|
+
> \`<Form>\` — call \`read_context('fui-form-component')\` and follow its WHEN-TO-USE table. Do not
|
|
70
|
+
> hand-assemble the body from \`TextField\`/\`Select\` + \`useState\` + a submit handler. A modal that
|
|
71
|
+
> only CONFIRMS a fieldless action (cancel, approve, delete) needs no Form — confirm, then commit.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## DANGEROUS PATTERNS
|
|
76
|
+
|
|
77
|
+
### 1. Dialog/Modal: never pass \`open\` as a prop — it is a read-only \`@volatile\` getter
|
|
78
|
+
|
|
79
|
+
**WRONG:**
|
|
80
|
+
\`\`\`tsx
|
|
81
|
+
// Silent no-op — open is a getter, not a settable prop. Dialog never appears.
|
|
82
|
+
<Dialog open={isOpen} />
|
|
83
|
+
<Modal open={isOpen} />
|
|
84
|
+
\`\`\`
|
|
85
|
+
|
|
86
|
+
**CORRECT — use ref + show()/close():**
|
|
87
|
+
\`\`\`tsx
|
|
88
|
+
const dialogRef = useRef<DialogRef>(null);
|
|
89
|
+
|
|
90
|
+
// To show:
|
|
91
|
+
dialogRef.current?.show();
|
|
92
|
+
// To close:
|
|
93
|
+
dialogRef.current?.close();
|
|
94
|
+
|
|
95
|
+
<Dialog ref={dialogRef} />
|
|
96
|
+
\`\`\`
|
|
97
|
+
|
|
98
|
+
Source: \`foundation-ui/src/dialog/dialog.ts\` — \`@volatile get open(): boolean\` (getter only).
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### 2. Flyout: no show()/hide() ref methods — use \`closed\` controlled prop
|
|
103
|
+
|
|
104
|
+
**WRONG:**
|
|
105
|
+
\`\`\`tsx
|
|
106
|
+
// FlyoutRef has no .show() or .hide() — these calls do nothing.
|
|
107
|
+
const flyoutRef = useRef<FlyoutRef>(null);
|
|
108
|
+
flyoutRef.current?.show(); // method does not exist on Flyout
|
|
109
|
+
flyoutRef.current?.hide(); // method does not exist on Flyout
|
|
110
|
+
\`\`\`
|
|
111
|
+
|
|
112
|
+
**CORRECT — drive visibility via the \`closed\` boolean prop:**
|
|
113
|
+
\`\`\`tsx
|
|
114
|
+
// Flyout is controlled: closed=false means open, closed=true means closed.
|
|
115
|
+
<Flyout
|
|
116
|
+
position="right"
|
|
117
|
+
closed={!isOpen}
|
|
118
|
+
onClosed={() => setIsOpen(false)}
|
|
119
|
+
>
|
|
120
|
+
{/* content */}
|
|
121
|
+
</Flyout>
|
|
122
|
+
\`\`\`
|
|
123
|
+
|
|
124
|
+
Source: \`foundation-ui/src/flyout/flyout.ts\` — \`@attr({ mode: 'boolean' }) closed: boolean = true\`.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
### 3. Dialog position values — only 'center' | 'left' | 'right'
|
|
129
|
+
|
|
130
|
+
**WRONG:**
|
|
131
|
+
\`\`\`tsx
|
|
132
|
+
<Dialog position="top" /> // 'top' is not a valid DialogPosition
|
|
133
|
+
<Dialog position="bottom" /> // 'bottom' is not a valid DialogPosition
|
|
134
|
+
\`\`\`
|
|
135
|
+
|
|
136
|
+
**CORRECT:**
|
|
137
|
+
\`\`\`tsx
|
|
138
|
+
<Dialog position="center" /> // default
|
|
139
|
+
<Dialog position="left" />
|
|
140
|
+
<Dialog position="right" />
|
|
141
|
+
\`\`\`
|
|
142
|
+
|
|
143
|
+
Source: \`foundation-ui/src/dialog/dialog.types.ts\` — \`type DialogPosition = 'center' | 'left' | 'right'\`.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### 4. Flyout width: use camelCase \`flyoutWidth\` prop, NOT kebab-case attribute
|
|
148
|
+
|
|
149
|
+
**WRONG:**
|
|
150
|
+
\`\`\`tsx
|
|
151
|
+
// kebab-case HTML attribute — bypasses React prop typing, may not update reactively
|
|
152
|
+
<Flyout flyout-width="520px" />
|
|
153
|
+
\`\`\`
|
|
154
|
+
|
|
155
|
+
**CORRECT — use camelCase React prop:**
|
|
156
|
+
\`\`\`tsx
|
|
157
|
+
// camelCase prop — typed, reactive, correct React convention
|
|
158
|
+
<Flyout flyoutWidth="520px" />
|
|
159
|
+
// Also accepts CSS calc/min expressions:
|
|
160
|
+
<Flyout flyoutWidth="min(960px, calc(100vw - 24px))" />
|
|
161
|
+
\`\`\`
|
|
162
|
+
|
|
163
|
+
Source: \`foundation-ui/src/flyout/flyout.ts\` — \`@attr({ attribute: 'flyout-width' }) flyoutWidth: string\`.
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
### 5. Modal \`onClose\` is NOT in react.d.ts — use addEventListener via ref
|
|
168
|
+
|
|
169
|
+
**WRONG:**
|
|
170
|
+
\`\`\`tsx
|
|
171
|
+
// onClose is NOT declared on Modal in react.d.ts — no-op in TypeScript strict mode
|
|
172
|
+
<Modal ref={modalRef} onClose={() => setOpen(false)} />
|
|
173
|
+
\`\`\`
|
|
174
|
+
|
|
175
|
+
**CORRECT — attach native listener via ref:**
|
|
176
|
+
\`\`\`tsx
|
|
177
|
+
useEffect(() => {
|
|
178
|
+
const el = modalRef.current;
|
|
179
|
+
if (!el) return;
|
|
180
|
+
const handler = () => setOpen(false);
|
|
181
|
+
el.addEventListener('close', handler);
|
|
182
|
+
return () => el.removeEventListener('close', handler);
|
|
183
|
+
}, []);
|
|
184
|
+
|
|
185
|
+
<Modal ref={modalRef} />
|
|
186
|
+
\`\`\`
|
|
187
|
+
|
|
188
|
+
Source: \`react.d.ts\` Modal entry has no \`on*\` event props (only empty \`{}\` block); Dialog has \`onClose\`.
|
|
189
|
+
|
|
190
|
+
**Do NOT let this push you to \`Dialog\` for a modal overlay** — see DANGEROUS PATTERN 6. The
|
|
191
|
+
listener above is the whole cost of picking the correct component.
|
|
192
|
+
|
|
193
|
+
### 6. \`Dialog\` where you meant \`Modal\` — non-modal semantics, and it still obeys z-index
|
|
194
|
+
|
|
195
|
+
\`Dialog\` calls the native \`dialog.show()\` (**non-modal**): no backdrop, no focus trap, no
|
|
196
|
+
Esc-to-close, and the page behind stays fully interactive. If you want a blocking overlay, that is
|
|
197
|
+
already the wrong component regardless of where it paints.
|
|
198
|
+
|
|
199
|
+
It also remains an ordinary participant in the z-index ladder. The element is \`position: fixed\`, so
|
|
200
|
+
it is never CLIPPED, and since FUI 15.7.2 it defaults to \`z-index: 1001\` (\`--dialog-z-index\`) —
|
|
201
|
+
clearing \`foundation-header\` (999) and FlexLayout's drag chrome (1000), so a dialog in a tile is no
|
|
202
|
+
longer buried by the tiles after it. But 1001 is still just a number: \`Flyout\` (2000/2001) paints
|
|
203
|
+
over it, and an ancestor that creates a stacking context (\`transform\`, \`filter\`, \`position: sticky\`
|
|
204
|
+
— see \`fui-styling\`) can still trap it below something else.
|
|
205
|
+
|
|
206
|
+
\`Modal\` calls \`dialog.showModal()\`, which puts it in the browser's **top layer**: above every
|
|
207
|
+
stacking context and outside every \`overflow: hidden\`, with a backdrop, focus trap and Esc-to-close.
|
|
208
|
+
No z-index is involved at any point, so nothing can out-stack it.
|
|
209
|
+
|
|
210
|
+
\`\`\`tsx
|
|
211
|
+
// WRONG for a blocking overlay — non-modal: no backdrop, no focus trap, no Esc,
|
|
212
|
+
// and still out-stacked by anything above 1001 (e.g. an open Flyout)
|
|
213
|
+
<Dialog ref={dialogRef} position="center" onClose={() => handleClose()}>
|
|
214
|
+
<ImportWizard />
|
|
215
|
+
</Dialog>
|
|
216
|
+
|
|
217
|
+
// CORRECT — top layer, immune to every stacking context; onClose via listener (DANGEROUS PATTERN 5)
|
|
218
|
+
<Modal ref={modalRef}>
|
|
219
|
+
<ImportWizard />
|
|
220
|
+
</Modal>
|
|
221
|
+
\`\`\`
|
|
222
|
+
|
|
223
|
+
\`Dialog\` is right when you WANT the background interactive (a non-blocking side panel or inspector).
|
|
224
|
+
Raising \`--dialog-z-index\` changes only where it sits in the ladder — it stays non-modal. If you
|
|
225
|
+
need the page blocked, swap the component; do not tune the z-index.
|
|
226
|
+
|
|
227
|
+
Source: \`foundation-ui/src/dialog/dialog.ts\` \`show()\` → \`mainElement.show()\` vs
|
|
228
|
+
\`foundation-ui/src/modal/modal.ts\` \`show()\` → \`mainElement.showModal()\`;
|
|
229
|
+
\`foundation-ui/src/dialog/dialog.styles.ts\` \`z-index: var(--dialog-z-index, 1001)\`.
|
|
230
|
+
\`foundation-entity-management\` renders its own edit/create form as \`\${prefix}-modal\` for exactly
|
|
231
|
+
this reason, and it sits inside a tile without clipping.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Imports
|
|
236
|
+
|
|
237
|
+
\`\`\`tsx
|
|
238
|
+
import {
|
|
239
|
+
Dialog,
|
|
240
|
+
type DialogRef,
|
|
241
|
+
Modal,
|
|
242
|
+
type ModalRef,
|
|
243
|
+
Flyout,
|
|
244
|
+
// FlyoutRef is the WC type; only needed for typed refs
|
|
245
|
+
} from '@genesislcap/rapid-design-system/react';
|
|
246
|
+
|
|
247
|
+
// Types for Dialog props:
|
|
248
|
+
import type { DialogPosition, DialogType } from '@genesislcap/foundation-ui';
|
|
249
|
+
|
|
250
|
+
// Imperative confirm/cancel dialog (no JSX):
|
|
251
|
+
import { showNotificationDialog } from '@genesislcap/foundation-notifications';
|
|
252
|
+
import type { DialogStructure } from '@genesislcap/foundation-notifications';
|
|
253
|
+
\`\`\`
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Dialog — non-blocking overlay
|
|
258
|
+
|
|
259
|
+
Dialog uses the native \`<dialog>\` element's non-modal \`show()\` — the background remains interactive.
|
|
260
|
+
|
|
261
|
+
\`\`\`tsx
|
|
262
|
+
import { useRef } from 'react';
|
|
263
|
+
import { Button, Dialog, type DialogRef } from '@genesislcap/rapid-design-system/react';
|
|
264
|
+
|
|
265
|
+
function MyDialog() {
|
|
266
|
+
const dialogRef = useRef<DialogRef>(null);
|
|
267
|
+
|
|
268
|
+
return (
|
|
269
|
+
<>
|
|
270
|
+
<Button appearance="primary" onClick={() => dialogRef.current?.show()}>Open Dialog</Button>
|
|
271
|
+
|
|
272
|
+
<Dialog
|
|
273
|
+
ref={dialogRef}
|
|
274
|
+
position="center" // 'center' | 'left' | 'right' (default: 'center')
|
|
275
|
+
type="default" // 'default' | 'alert' | 'success' | 'error'
|
|
276
|
+
showCloseIcon={true} // default: true
|
|
277
|
+
resizable={false} // default: false
|
|
278
|
+
draggable={false} // default: false
|
|
279
|
+
minWidth={300} // px, default: 300
|
|
280
|
+
minHeight={200} // px, default: 200
|
|
281
|
+
initialWidth={600} // optional: initial width (capped at viewport width)
|
|
282
|
+
initialHeight={400} // optional: initial height (capped at viewport height)
|
|
283
|
+
onClose={() => console.log('dialog closed')}
|
|
284
|
+
>
|
|
285
|
+
<div slot="top">Execute Axe</div>
|
|
286
|
+
<div>Dialog content here</div>
|
|
287
|
+
<Button slot="bottom" appearance="primary" onClick={onExecute}>Execute</Button>
|
|
288
|
+
</Dialog>
|
|
289
|
+
</>
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
\`\`\`
|
|
293
|
+
|
|
294
|
+
**Events (react.d.ts verified):**
|
|
295
|
+
| Event | Signature | Notes |
|
|
296
|
+
|-------|-----------|-------|
|
|
297
|
+
| \`onClose\` | \`(event: CustomEvent<unknown>) => void\` | Fired when the dialog closes |
|
|
298
|
+
|
|
299
|
+
**Note:** The \`resize\` event fires when the dialog is resized in resizable mode but is **not** declared in react.d.ts — use a native \`addEventListener\` via the ref if needed.
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## Modal — blocking overlay (locks background)
|
|
304
|
+
|
|
305
|
+
Modal extends Dialog. It calls the native \`<dialog>\` element's \`showModal()\` — the background is inert/inaccessible while the modal is open.
|
|
306
|
+
|
|
307
|
+
\`\`\`tsx
|
|
308
|
+
import { useRef, useEffect } from 'react';
|
|
309
|
+
import { Button, Modal, type ModalRef } from '@genesislcap/rapid-design-system/react';
|
|
310
|
+
|
|
311
|
+
function MyModal() {
|
|
312
|
+
const modalRef = useRef<ModalRef>(null);
|
|
313
|
+
|
|
314
|
+
// Modal has NO onClose in react.d.ts — listen natively:
|
|
315
|
+
useEffect(() => {
|
|
316
|
+
const el = modalRef.current;
|
|
317
|
+
if (!el) return;
|
|
318
|
+
const handler = () => console.log('modal closed');
|
|
319
|
+
el.addEventListener('close', handler);
|
|
320
|
+
return () => el.removeEventListener('close', handler);
|
|
321
|
+
}, []);
|
|
322
|
+
|
|
323
|
+
return (
|
|
324
|
+
<>
|
|
325
|
+
<Button appearance="primary" onClick={() => modalRef.current?.show()}>Open Modal</Button>
|
|
326
|
+
|
|
327
|
+
<Modal
|
|
328
|
+
ref={modalRef}
|
|
329
|
+
position="center"
|
|
330
|
+
showCloseIcon={true}
|
|
331
|
+
draggable={false}
|
|
332
|
+
resizable={false}
|
|
333
|
+
>
|
|
334
|
+
<div>Modal content here</div>
|
|
335
|
+
</Modal>
|
|
336
|
+
</>
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
\`\`\`
|
|
340
|
+
|
|
341
|
+
**Events:** Modal has **no** \`on*\` event props in react.d.ts. Attach native listeners via the ref.
|
|
342
|
+
|
|
343
|
+
### The close affordance is already there — do not add a second one
|
|
344
|
+
|
|
345
|
+
\`showCloseIcon\` defaults to **\`true\`** on \`Dialog\`, and \`Modal\` extends \`Dialog\`, so every dialog
|
|
346
|
+
and modal you render already paints a themed close control in its header. Adding your own
|
|
347
|
+
"Cancel" next to it gives the user two ways to do the same thing and makes the dialog look
|
|
348
|
+
hand-built.
|
|
349
|
+
|
|
350
|
+
- **Dismiss-only dialog** (a detail view, a chart, a read-only panel): render the content and
|
|
351
|
+
nothing else. The close icon IS the dismiss control.
|
|
352
|
+
- **Form / submit dialog** (a ticket, a create or edit form — the common case): the footer holds the
|
|
353
|
+
SUBMIT action alone, e.g. \`Execute\` or \`Save\`. The close icon is the cancel. This is the
|
|
354
|
+
platform's own shape: EntityManagement's built-in create modal renders a single right-aligned
|
|
355
|
+
**Submit** with an X and no Cancel. A \`Cancel\` beside a submit AND a close icon is three ways to
|
|
356
|
+
leave one dialog, and it was reported from a live app as looking hand-built.
|
|
357
|
+
- **Decision dialog** (a genuine either/or the user must answer deliberately — discard unsaved work,
|
|
358
|
+
delete a record, confirm something irreversible): the footer holds BOTH sides of the choice, e.g.
|
|
359
|
+
\`Cancel\` + \`Delete\`, because here "cancel" is a real answer rather than a way out. Do not add a
|
|
360
|
+
lone \`Cancel\` that duplicates the close icon.
|
|
361
|
+
- If you deliberately want \`Cancel\` as the only action, set \`showCloseIcon={false}\` so there is
|
|
362
|
+
exactly one way out.
|
|
363
|
+
|
|
364
|
+
**Every button in a dialog must be the \`Button\` component — never a raw \`<button>\`.** A raw
|
|
365
|
+
\`<button>\` is the single most visible "this was generated" tell: it renders with the browser's
|
|
366
|
+
native chrome, so it ignores the theme's accent, corner radius, focus ring, typography and
|
|
367
|
+
disabled styling, and sits next to themed controls looking like a different application.
|
|
368
|
+
|
|
369
|
+
**A stylesheet styles the INSIDE of a platform dialog — it is never a reason to build your own.**
|
|
370
|
+
\`<Dialog>\`/\`<Modal>\` render in the browser's TOP LAYER: they bring the backdrop, the focus trap,
|
|
371
|
+
Esc-to-close, the themed close icon and a stacking context that cannot be lost. A hand-built
|
|
372
|
+
\`position: fixed\` overlay with a chosen \`z-index\` has none of that, and the z-index is a guess you
|
|
373
|
+
eventually lose to a grid popup or a flyout. MEASURED: one run wrote a stylesheet per modal and
|
|
374
|
+
hand-rolled the overlay in ALL FIVE, having used the platform component in every modal the run
|
|
375
|
+
before. If you are writing \`position: fixed\` + \`z-index\` for a modal, you have rebuilt \`<Modal>\`
|
|
376
|
+
badly — use the component and let the stylesheet handle only the layout of its CONTENT.
|
|
377
|
+
|
|
378
|
+
**Dialog spacing comes from tokens, not raw pixels.** A dialog is usually pure \`.tsx\` with no
|
|
379
|
+
stylesheet, and \`fui-styling\` is only force-loaded when a plan writes a \`.css\` — so this is the
|
|
380
|
+
one place a modal reliably sees the rule. Use \`calc(var(--design-unit) * Npx)\` for padding,
|
|
381
|
+
margin and gap and the \`--type-ramp-*\` sizes for text, exactly as a grid tile does. Hardcoded
|
|
382
|
+
\`'16px'\` does not scale with theme density, so a modal built that way drifts out of step with
|
|
383
|
+
every other surface in the app. MEASURED: the modal steps of one buildout emitted 36 raw pixel
|
|
384
|
+
values against 18 token uses, while the blotter steps ran 2 against 14.
|
|
385
|
+
|
|
386
|
+
**Dialog/Modal have three slots — use them.** \`top\` is the header (it shares the row with the
|
|
387
|
+
close icon), the default slot is the content, \`bottom\` is the footer. A dialog opened with
|
|
388
|
+
\`.show()\` and NO \`slot="top"\` renders a BLANK header band with a lone floating X, because the
|
|
389
|
+
platform's fallback for that slot is a notification title that a \`.show()\` dialog does not have —
|
|
390
|
+
so the title you then hand-write inside the content area sits UNDER an empty strip. Put the title
|
|
391
|
+
in \`slot="top"\` and the actions in \`slot="bottom"\`; do not hand-roll a flex footer div in the
|
|
392
|
+
content area.
|
|
393
|
+
|
|
394
|
+
\`\`\`tsx
|
|
395
|
+
// WRONG — a redundant Cancel, and a raw button that inherits none of the theme:
|
|
396
|
+
<Modal ref={modalRef} showCloseIcon>
|
|
397
|
+
<TradeDetails id={id} />
|
|
398
|
+
{/* <button className="cancel-link">Cancel</button> — native chrome, no theme, no focus ring */}
|
|
399
|
+
</Modal>
|
|
400
|
+
|
|
401
|
+
// CORRECT — dismiss-only: the close icon is the dismiss control, so there is no footer at all:
|
|
402
|
+
<Modal ref={modalRef} showCloseIcon>
|
|
403
|
+
<TradeDetails id={id} />
|
|
404
|
+
</Modal>
|
|
405
|
+
|
|
406
|
+
// CORRECT — a FORM: the submit action stands alone, the close icon is the cancel:
|
|
407
|
+
<Modal ref={modalRef} showCloseIcon>
|
|
408
|
+
<div slot="top">New RFQ</div>
|
|
409
|
+
<TradeForm ... />
|
|
410
|
+
<Button slot="bottom" appearance="primary" onClick={onSave}>Save</Button>
|
|
411
|
+
</Modal>
|
|
412
|
+
|
|
413
|
+
// CORRECT — a real DECISION: no fields, so both outcomes are real choices and Cancel earns its
|
|
414
|
+
// place. If your dialog body has form fields, it is the case ABOVE, not this one:
|
|
415
|
+
<Modal ref={modalRef} showCloseIcon>
|
|
416
|
+
<div slot="top">Discard changes?</div>
|
|
417
|
+
<p>Your unsaved changes to this order will be lost.</p>
|
|
418
|
+
<Button slot="bottom" appearance="neutral" onClick={() => modalRef.current?.close()}>Keep editing</Button>
|
|
419
|
+
<Button slot="bottom" appearance="primary" onClick={onDiscard}>Discard</Button>
|
|
420
|
+
</Modal>
|
|
421
|
+
\`\`\`
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
## Flyout — slide-in side panel (controlled prop pattern)
|
|
426
|
+
|
|
427
|
+
Flyout is controlled via the \`closed\` boolean prop — no ref needed for open/close. Keep it always mounted; do NOT unmount it conditionally or form state will be lost.
|
|
428
|
+
|
|
429
|
+
\`\`\`tsx
|
|
430
|
+
import { useState } from 'react';
|
|
431
|
+
import { Button, Flyout } from '@genesislcap/rapid-design-system/react';
|
|
432
|
+
|
|
433
|
+
function MyFlyout() {
|
|
434
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
435
|
+
|
|
436
|
+
return (
|
|
437
|
+
<>
|
|
438
|
+
<Button appearance="primary" onClick={() => setIsOpen(true)}>Open Panel</Button>
|
|
439
|
+
|
|
440
|
+
{/* Keep Flyout always mounted — use closed to toggle visibility */}
|
|
441
|
+
<Flyout
|
|
442
|
+
position="right" // 'right' | 'left' (default: 'right')
|
|
443
|
+
closed={!isOpen} // true = hidden, false = visible
|
|
444
|
+
flyoutWidth="400px" // width string (default: '20%'); accepts CSS calc/min
|
|
445
|
+
displayHeader={true} // show/hide the built-in header bar (default: true)
|
|
446
|
+
onClosed={() => setIsOpen(false)} // fired after close animation completes
|
|
447
|
+
>
|
|
448
|
+
<div slot="title">Panel Title</div>
|
|
449
|
+
<div>Panel content</div>
|
|
450
|
+
</Flyout>
|
|
451
|
+
</>
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
\`\`\`
|
|
455
|
+
|
|
456
|
+
**Events (react.d.ts verified):**
|
|
457
|
+
| Event | Signature | Notes |
|
|
458
|
+
|-------|-----------|-------|
|
|
459
|
+
| \`onClosed\` | \`(event: CustomEvent<unknown>) => void\` | Fired when flyout finishes closing |
|
|
460
|
+
|
|
461
|
+
**Dynamic width** (sales-trader-hub pattern — different widths for different form states):
|
|
462
|
+
\`\`\`tsx
|
|
463
|
+
<Flyout
|
|
464
|
+
closed={!isOpen}
|
|
465
|
+
flyoutWidth={activeForm === 'fte' ? 'min(960px, calc(100vw - 24px))' : '300px'}
|
|
466
|
+
onClosed={handleClose}
|
|
467
|
+
>
|
|
468
|
+
{/* form content */}
|
|
469
|
+
</Flyout>
|
|
470
|
+
\`\`\`
|
|
471
|
+
|
|
472
|
+
---
|
|
473
|
+
|
|
474
|
+
## Confirm flow — \`showNotificationDialog\` (imperative, no JSX)
|
|
475
|
+
|
|
476
|
+
For "are you sure?" prompts before destructive actions, use the imperative \`showNotificationDialog\` utility from \`@genesislcap/foundation-notifications\`. It programmatically renders a modal-style dialog with confirm/cancel buttons — no JSX needed.
|
|
477
|
+
|
|
478
|
+
\`\`\`tsx
|
|
479
|
+
import { showNotificationDialog } from '@genesislcap/foundation-notifications';
|
|
480
|
+
|
|
481
|
+
// Confirm before delete:
|
|
482
|
+
function handleDeleteClick(rowId: string) {
|
|
483
|
+
showNotificationDialog(
|
|
484
|
+
{
|
|
485
|
+
title: 'Delete Record',
|
|
486
|
+
body: 'Are you sure you want to delete this record? This action cannot be undone.',
|
|
487
|
+
dialog: {
|
|
488
|
+
confirmingActions: [
|
|
489
|
+
{
|
|
490
|
+
label: 'Delete',
|
|
491
|
+
action: () => performDelete(rowId),
|
|
492
|
+
},
|
|
493
|
+
],
|
|
494
|
+
dismissingAction: {
|
|
495
|
+
label: 'Cancel',
|
|
496
|
+
action: () => {},
|
|
497
|
+
},
|
|
498
|
+
},
|
|
499
|
+
},
|
|
500
|
+
'rapid', // design-system prefix — always 'rapid' for rapid-design-system
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
\`\`\`
|
|
504
|
+
|
|
505
|
+
**Signature (verified against foundation-notifications/src/dialog/dialog-builder.ts):**
|
|
506
|
+
\`\`\`ts
|
|
507
|
+
showNotificationDialog(
|
|
508
|
+
configuration: DialogStructure,
|
|
509
|
+
tagName: string, // 'rapid' for rapid-design-system
|
|
510
|
+
notificationBoundary?: HTMLElement // optional: scope dialog to a specific DOM subtree
|
|
511
|
+
): void
|
|
512
|
+
\`\`\`
|
|
513
|
+
|
|
514
|
+
**\`DialogStructure\` type (from \`@genesislcap/foundation-notifications\`):**
|
|
515
|
+
\`\`\`ts
|
|
516
|
+
interface DialogStructure {
|
|
517
|
+
readonly title: string; // REQUIRED — throws if missing
|
|
518
|
+
readonly body: string; // REQUIRED — throws if missing
|
|
519
|
+
readonly logLevel?: LogLevel;
|
|
520
|
+
readonly dialog?: {
|
|
521
|
+
readonly confirmingActions?: Array<{ label: string; action: Function }>;
|
|
522
|
+
readonly dismissingAction?: { label: string; action?: Function };
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
\`\`\`
|
|
526
|
+
|
|
527
|
+
**Promise-based wrapper** (when you need to await the user's choice):
|
|
528
|
+
\`\`\`tsx
|
|
529
|
+
function confirmAction(title: string, message: string): Promise<boolean> {
|
|
530
|
+
return new Promise((resolve) => {
|
|
531
|
+
showNotificationDialog(
|
|
532
|
+
{
|
|
533
|
+
title,
|
|
534
|
+
body: message,
|
|
535
|
+
dialog: {
|
|
536
|
+
confirmingActions: [{ label: 'Confirm', action: () => resolve(true) }],
|
|
537
|
+
dismissingAction: { label: 'Cancel', action: () => resolve(false) },
|
|
538
|
+
},
|
|
539
|
+
},
|
|
540
|
+
'rapid',
|
|
541
|
+
);
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// Usage (e.g. rebalance approval / trade cancel):
|
|
546
|
+
import { getConnect, commitGenesisEvent } from '@genesislcap/foundation-comms';
|
|
547
|
+
import { EventRebalanceApprove } from '../generated/genesis-event-types'; // typed DETAILS — when listed (depth like store imports — e.g. ../../ from a route page)
|
|
548
|
+
|
|
549
|
+
const confirmed = await confirmAction('Approve Rebalance', 'Submit rebalance orders for all accounts?');
|
|
550
|
+
if (confirmed) {
|
|
551
|
+
// typed-first (never create or edit the generated file; see fui-foundation-comms):
|
|
552
|
+
await commitGenesisEvent(getConnect(), new EventRebalanceApprove({ REBALANCE_ID: id }));
|
|
553
|
+
// Plain fallback when the generated map is absent or lacks this event:
|
|
554
|
+
// getConnect().commitEvent('EVENT_REBALANCE_APPROVE', { DETAILS: { REBALANCE_ID: id } });
|
|
555
|
+
}
|
|
556
|
+
\`\`\`
|
|
557
|
+
|
|
558
|
+
---
|
|
559
|
+
|
|
560
|
+
## Ref type summary
|
|
561
|
+
|
|
562
|
+
| Component | Ref type | Open method | Close method | Controlled prop |
|
|
563
|
+
|-----------|-----------|-------------------|-------------|-----------------|
|
|
564
|
+
| \`Dialog\` | \`DialogRef\` | \`.show()\` (non-blocking) | \`.close()\` | — |
|
|
565
|
+
| \`Modal\` | \`ModalRef\` | \`.show()\` (blocking / \`showModal()\`) | \`.close()\` | — |
|
|
566
|
+
| \`Flyout\` | n/a (ref not needed) | \`closed={false}\` | \`closed={true}\` | \`closed\` |
|
|
567
|
+
|
|
568
|
+
All ref types imported from \`@genesislcap/rapid-design-system/react\`.
|
|
569
|
+
|
|
570
|
+
---
|
|
571
|
+
|
|
572
|
+
## KEY RULES
|
|
573
|
+
|
|
574
|
+
- **Dialog/Modal**: control via ref. Never pass \`open\` as a prop — it is a getter.
|
|
575
|
+
- **\`showCloseIcon\` defaults to \`true\`** (Modal extends Dialog) — the dismiss control already
|
|
576
|
+
exists. Do NOT add a redundant \`Cancel\` alongside it; add a footer only for a real decision.
|
|
577
|
+
- **Never a raw \`<button>\` inside a dialog** — always the \`Button\` component, or it renders with
|
|
578
|
+
native browser chrome and ignores the theme entirely.
|
|
579
|
+
- **Flyout**: control via \`closed={!isOpen}\` prop. No \`.show()\`/\`.hide()\` methods exist.
|
|
580
|
+
- **Flyout \`flyoutWidth\`**: camelCase React prop (WC HTML attribute is \`flyout-width\`). Use \`flyoutWidth\` in JSX.
|
|
581
|
+
- **Flyout position**: \`'right'\` or \`'left'\` only (source: flyout.ts \`@attr position: string = 'right'\`).
|
|
582
|
+
- **Dialog position**: \`'center'\` | \`'left'\` | \`'right'\` — NOT \`'top'\` or \`'bottom'\`.
|
|
583
|
+
- **Keep Flyout always mounted** — never conditionally render it; toggling \`closed\` preserves form state.
|
|
584
|
+
- **Confirm flows**: use \`showNotificationDialog\` from \`@genesislcap/foundation-notifications\` for imperative yes/no dialogs.
|
|
585
|
+
- **Modal \`onClose\`**: NOT in react.d.ts — use \`addEventListener('close', ...)\` via ref if needed.
|
|
586
|
+
- **Dialog \`onClose\`**: IS declared in react.d.ts — use as a normal prop.
|
|
587
|
+
- For multi-step flyout form navigation (QTE→FTE), see \`fui-flyout-panel\` context.
|
|
588
|
+
`.trim();
|