@neo4j-ndl/react 4.16.8 → 4.16.9
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/package.json +5 -2
- package/skills/ndl-react/SKILL.md +152 -0
- package/skills/ndl-react/components/accordion.md +386 -0
- package/skills/ndl-react/components/ai/code-preview.md +128 -0
- package/skills/ndl-react/components/ai/file-tag.md +90 -0
- package/skills/ndl-react/components/ai/image-tag.md +91 -0
- package/skills/ndl-react/components/ai/more-files.md +73 -0
- package/skills/ndl-react/components/ai/presence.md +54 -0
- package/skills/ndl-react/components/ai/preview.md +498 -0
- package/skills/ndl-react/components/ai/prompt.md +362 -0
- package/skills/ndl-react/components/ai/reasoning.md +95 -0
- package/skills/ndl-react/components/ai/response.md +1109 -0
- package/skills/ndl-react/components/ai/suggestion.md +84 -0
- package/skills/ndl-react/components/ai/thinking.md +43 -0
- package/skills/ndl-react/components/ai/tool-call.md +43 -0
- package/skills/ndl-react/components/ai/user-bubble.md +187 -0
- package/skills/ndl-react/components/avatar.md +169 -0
- package/skills/ndl-react/components/banner.md +225 -0
- package/skills/ndl-react/components/box.md +39 -0
- package/skills/ndl-react/components/breadcrumbs.md +245 -0
- package/skills/ndl-react/components/checkbox.md +269 -0
- package/skills/ndl-react/components/clean-icon-button.md +294 -0
- package/skills/ndl-react/components/clipboard-button.md +154 -0
- package/skills/ndl-react/components/code-block.md +276 -0
- package/skills/ndl-react/components/code.md +68 -0
- package/skills/ndl-react/components/color-picker.md +131 -0
- package/skills/ndl-react/components/conditional-wrap.md +46 -0
- package/skills/ndl-react/components/data-grid.md +3121 -0
- package/skills/ndl-react/components/date-picker.md +652 -0
- package/skills/ndl-react/components/dialog.md +485 -0
- package/skills/ndl-react/components/dismissible-tag.md +136 -0
- package/skills/ndl-react/components/divider.md +96 -0
- package/skills/ndl-react/components/drawer.md +543 -0
- package/skills/ndl-react/components/dropdown-button.md +161 -0
- package/skills/ndl-react/components/dropzone.md +371 -0
- package/skills/ndl-react/components/filled-button.md +26 -0
- package/skills/ndl-react/components/flex.md +82 -0
- package/skills/ndl-react/components/graph-label.md +167 -0
- package/skills/ndl-react/components/icon-button-array.md +187 -0
- package/skills/ndl-react/components/icon-button.md +193 -0
- package/skills/ndl-react/components/inline-edit.md +209 -0
- package/skills/ndl-react/components/kbd.md +63 -0
- package/skills/ndl-react/components/loading-bar.md +43 -0
- package/skills/ndl-react/components/loading-spinner.md +57 -0
- package/skills/ndl-react/components/logo.md +57 -0
- package/skills/ndl-react/components/menu.md +993 -0
- package/skills/ndl-react/components/modal.md +27 -0
- package/skills/ndl-react/components/next/tree-view.md +966 -0
- package/skills/ndl-react/components/outlined-button.md +26 -0
- package/skills/ndl-react/components/popover.md +283 -0
- package/skills/ndl-react/components/progress-bar.md +70 -0
- package/skills/ndl-react/components/radio.md +150 -0
- package/skills/ndl-react/components/read-only-tag.md +96 -0
- package/skills/ndl-react/components/segmented-control.md +200 -0
- package/skills/ndl-react/components/select-icon-button.md +183 -0
- package/skills/ndl-react/components/select.md +530 -0
- package/skills/ndl-react/components/selectable-tag.md +203 -0
- package/skills/ndl-react/components/side-navigation.md +652 -0
- package/skills/ndl-react/components/skeleton.md +274 -0
- package/skills/ndl-react/components/slider.md +308 -0
- package/skills/ndl-react/components/spotlight.md +796 -0
- package/skills/ndl-react/components/status-indicator.md +57 -0
- package/skills/ndl-react/components/status-label.md +132 -0
- package/skills/ndl-react/components/switch.md +167 -0
- package/skills/ndl-react/components/tabs.md +433 -0
- package/skills/ndl-react/components/tag.md +91 -0
- package/skills/ndl-react/components/text-area.md +178 -0
- package/skills/ndl-react/components/text-button.md +25 -0
- package/skills/ndl-react/components/text-input.md +475 -0
- package/skills/ndl-react/components/text-link.md +119 -0
- package/skills/ndl-react/components/time-picker.md +137 -0
- package/skills/ndl-react/components/timezone-picker.md +496 -0
- package/skills/ndl-react/components/tooltip.md +478 -0
- package/skills/ndl-react/components/tree-view.md +545 -0
- package/skills/ndl-react/components/typography.md +72 -0
- package/skills/ndl-react/components/wizard.md +152 -0
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
# Preview
|
|
2
|
+
|
|
3
|
+
Import: `import { Preview } from '@neo4j-ndl/react/ai'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### Preview
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Required | Default | Description |
|
|
10
|
+
|------|------|----------|---------|-------------|
|
|
11
|
+
| `children` | `ReactNode` | ✅ | | |
|
|
12
|
+
| `ref` | `Ref<HTMLDivElement>` | | | A ref to apply to the root element. |
|
|
13
|
+
|
|
14
|
+
### Preview.Code
|
|
15
|
+
|
|
16
|
+
| Prop | Type | Required | Default | Description |
|
|
17
|
+
|------|------|----------|---------|-------------|
|
|
18
|
+
| `code` | `string` | ✅ | | The code content to display |
|
|
19
|
+
| `headerActions` | `ReactNode` | | | The actions to display in the header. Should be small buttons or icon buttons only. |
|
|
20
|
+
| `isLoading` | `boolean` | | `false` | Whether the code block is loading |
|
|
21
|
+
| `label` | `'read' \| 'write'` | | | The current state of the code block |
|
|
22
|
+
| `language` | `any` | ✅ | | The language of the code (e.g., 'cypher', 'python', 'javascript') |
|
|
23
|
+
| `ref` | `Ref<HTMLDivElement>` | | | A ref to apply to the root element. |
|
|
24
|
+
| `theme` | `'ndl-code-dark' \| 'ndl-code-light'` | | | The theme of the code block |
|
|
25
|
+
|
|
26
|
+
### Preview.Confirmation
|
|
27
|
+
|
|
28
|
+
| Prop | Type | Required | Default | Description |
|
|
29
|
+
|------|------|----------|---------|-------------|
|
|
30
|
+
| `actions` | `ReactNode` | ✅ | | The actions to display in the confirmation, usually two buttons; one for confirming and one for rejecting. |
|
|
31
|
+
| `children` | `ReactNode` | | | The content to display in the confirmation |
|
|
32
|
+
| `confirmedActionText` | `string` | | `Action confirmed` | The text to display for the confirmed status |
|
|
33
|
+
| `isFooter` | `boolean` | | `false` | Whether the confirmation is used as a footer |
|
|
34
|
+
| `ref` | `Ref<HTMLDivElement>` | | | A ref to apply to the root element. |
|
|
35
|
+
| `rejectedActionText` | `string` | | `Action rejected` | The text to display for the rejected status |
|
|
36
|
+
| `status` | `'confirmed' \| 'pending' \| 'rejected'` | | `pending` | The status of the confirmation |
|
|
37
|
+
|
|
38
|
+
### Preview.Content
|
|
39
|
+
|
|
40
|
+
| Prop | Type | Required | Default | Description |
|
|
41
|
+
|------|------|----------|---------|-------------|
|
|
42
|
+
| `children` | `ReactNode` | | | |
|
|
43
|
+
| `ref` | `Ref<HTMLDivElement>` | | | A ref to apply to the root element. |
|
|
44
|
+
|
|
45
|
+
### Preview.Header
|
|
46
|
+
|
|
47
|
+
| Prop | Type | Required | Default | Description |
|
|
48
|
+
|------|------|----------|---------|-------------|
|
|
49
|
+
| `actions` | `ReactNode` | | | |
|
|
50
|
+
| `children` | `ReactNode` | | | |
|
|
51
|
+
| `ref` | `Ref<HTMLDivElement>` | | | A ref to apply to the root element. |
|
|
52
|
+
|
|
53
|
+
## Examples
|
|
54
|
+
|
|
55
|
+
### Code Confirmation
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
59
|
+
|
|
60
|
+
import { FilledButton, OutlinedButton } from '@neo4j-ndl/react';
|
|
61
|
+
import { Preview } from '@neo4j-ndl/react/ai';
|
|
62
|
+
import { useState } from 'react';
|
|
63
|
+
|
|
64
|
+
const cypherCode = `SHOW [ALL|BUILT IN|USER DEFINED] FUNCTION[S] EXECUTABLE BY
|
|
65
|
+
username
|
|
66
|
+
[YIELD { * | field[, ...] } [ORDER BY field ...`;
|
|
67
|
+
|
|
68
|
+
const Component = () => {
|
|
69
|
+
const [status, setStatus] =
|
|
70
|
+
useState<React.ComponentProps<typeof Preview.Confirmation>['status']>(
|
|
71
|
+
'pending',
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<Preview>
|
|
76
|
+
<Preview.Code
|
|
77
|
+
code={cypherCode}
|
|
78
|
+
language="cypher"
|
|
79
|
+
label="write"
|
|
80
|
+
isLoading={false}
|
|
81
|
+
headerActions={null}
|
|
82
|
+
/>
|
|
83
|
+
<Preview.Confirmation
|
|
84
|
+
status={status}
|
|
85
|
+
isFooter={true}
|
|
86
|
+
confirmedActionText="Action confirmed"
|
|
87
|
+
rejectedActionText="Action rejected"
|
|
88
|
+
actions={
|
|
89
|
+
<>
|
|
90
|
+
<OutlinedButton
|
|
91
|
+
variant="neutral"
|
|
92
|
+
size="small"
|
|
93
|
+
onClick={() => setStatus('rejected')}
|
|
94
|
+
>
|
|
95
|
+
Skip
|
|
96
|
+
</OutlinedButton>
|
|
97
|
+
<FilledButton
|
|
98
|
+
variant="primary"
|
|
99
|
+
size="small"
|
|
100
|
+
onClick={() => setStatus('confirmed')}
|
|
101
|
+
>
|
|
102
|
+
Run query
|
|
103
|
+
</FilledButton>
|
|
104
|
+
</>
|
|
105
|
+
}
|
|
106
|
+
>
|
|
107
|
+
Assistant wants to run this query
|
|
108
|
+
</Preview.Confirmation>
|
|
109
|
+
</Preview>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export default Component;
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Code Languages
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
120
|
+
|
|
121
|
+
import { Preview } from '@neo4j-ndl/react/ai';
|
|
122
|
+
|
|
123
|
+
const pythonCode = `def show_functions(username, function_type='ALL'):
|
|
124
|
+
"""
|
|
125
|
+
Show functions executable by user
|
|
126
|
+
"""
|
|
127
|
+
query = f"SHOW {function_type} FUNCTIONS EXECUTABLE BY {username}"
|
|
128
|
+
return query`;
|
|
129
|
+
|
|
130
|
+
const Component = () => {
|
|
131
|
+
return (
|
|
132
|
+
<Preview>
|
|
133
|
+
<Preview.Code code={pythonCode} language="python" />
|
|
134
|
+
</Preview>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export default Component;
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Code Loading
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
145
|
+
|
|
146
|
+
import { Preview } from '@neo4j-ndl/react/ai';
|
|
147
|
+
|
|
148
|
+
const Component = () => {
|
|
149
|
+
return (
|
|
150
|
+
<Preview>
|
|
151
|
+
<Preview.Code code="" language="cypher" isLoading={true} />
|
|
152
|
+
</Preview>
|
|
153
|
+
);
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export default Component;
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Code Read
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
163
|
+
|
|
164
|
+
import { OutlinedButton } from '@neo4j-ndl/react';
|
|
165
|
+
import { Preview } from '@neo4j-ndl/react/ai';
|
|
166
|
+
import { PencilSquareIconOutline } from '@neo4j-ndl/react/icons';
|
|
167
|
+
|
|
168
|
+
const cypherCode = `SHOW [ALL|BUILT IN|USER DEFINED] FUNCTION[S] EXECUTABLE BY
|
|
169
|
+
username
|
|
170
|
+
[YIELD { * | field[, ...] } [ORDER BY field ...`;
|
|
171
|
+
|
|
172
|
+
const Component = () => {
|
|
173
|
+
return (
|
|
174
|
+
<Preview>
|
|
175
|
+
<Preview.Code
|
|
176
|
+
code={cypherCode}
|
|
177
|
+
language="cypher"
|
|
178
|
+
label="read"
|
|
179
|
+
headerActions={
|
|
180
|
+
<OutlinedButton
|
|
181
|
+
leadingVisual={<PencilSquareIconOutline />}
|
|
182
|
+
variant="neutral"
|
|
183
|
+
size="small"
|
|
184
|
+
>
|
|
185
|
+
Send to Query
|
|
186
|
+
</OutlinedButton>
|
|
187
|
+
}
|
|
188
|
+
/>
|
|
189
|
+
</Preview>
|
|
190
|
+
);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export default Component;
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Code Write
|
|
197
|
+
|
|
198
|
+
```tsx
|
|
199
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
200
|
+
|
|
201
|
+
import { CleanIconButton } from '@neo4j-ndl/react';
|
|
202
|
+
import { Preview } from '@neo4j-ndl/react/ai';
|
|
203
|
+
import {
|
|
204
|
+
PencilSquareIconOutline,
|
|
205
|
+
PlayCircleIconOutline,
|
|
206
|
+
} from '@neo4j-ndl/react/icons';
|
|
207
|
+
|
|
208
|
+
const cypherCode = `SHOW [ALL|BUILT IN|USER DEFINED] FUNCTION[S] EXECUTABLE BY
|
|
209
|
+
username
|
|
210
|
+
[YIELD { * | field[, ...] } [ORDER BY field ...`;
|
|
211
|
+
|
|
212
|
+
const Component = () => {
|
|
213
|
+
return (
|
|
214
|
+
<Preview>
|
|
215
|
+
<Preview.Code
|
|
216
|
+
code={cypherCode}
|
|
217
|
+
language="cypher"
|
|
218
|
+
label="write"
|
|
219
|
+
headerActions={
|
|
220
|
+
<>
|
|
221
|
+
<CleanIconButton
|
|
222
|
+
variant="neutral"
|
|
223
|
+
description="Send to Query"
|
|
224
|
+
size="small"
|
|
225
|
+
>
|
|
226
|
+
<PencilSquareIconOutline />
|
|
227
|
+
</CleanIconButton>
|
|
228
|
+
<CleanIconButton
|
|
229
|
+
variant="neutral"
|
|
230
|
+
description="Run in Query"
|
|
231
|
+
size="small"
|
|
232
|
+
>
|
|
233
|
+
<PlayCircleIconOutline />
|
|
234
|
+
</CleanIconButton>
|
|
235
|
+
</>
|
|
236
|
+
}
|
|
237
|
+
/>
|
|
238
|
+
</Preview>
|
|
239
|
+
);
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
export default Component;
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Confirmation Standalone
|
|
246
|
+
|
|
247
|
+
```tsx
|
|
248
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
249
|
+
|
|
250
|
+
import { FilledButton, OutlinedButton } from '@neo4j-ndl/react';
|
|
251
|
+
import { Preview } from '@neo4j-ndl/react/ai';
|
|
252
|
+
import { useState } from 'react';
|
|
253
|
+
|
|
254
|
+
const Component = () => {
|
|
255
|
+
const [status, setStatus] =
|
|
256
|
+
useState<React.ComponentProps<typeof Preview.Confirmation>['status']>(
|
|
257
|
+
'pending',
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
return (
|
|
261
|
+
<Preview>
|
|
262
|
+
<Preview.Confirmation
|
|
263
|
+
status={status}
|
|
264
|
+
isFooter={false}
|
|
265
|
+
confirmedActionText="Action confirmed"
|
|
266
|
+
rejectedActionText="Action rejected"
|
|
267
|
+
actions={
|
|
268
|
+
<>
|
|
269
|
+
<OutlinedButton
|
|
270
|
+
variant="neutral"
|
|
271
|
+
size="small"
|
|
272
|
+
onClick={() => setStatus('rejected')}
|
|
273
|
+
>
|
|
274
|
+
Reject
|
|
275
|
+
</OutlinedButton>
|
|
276
|
+
<FilledButton
|
|
277
|
+
variant="primary"
|
|
278
|
+
size="small"
|
|
279
|
+
onClick={() => setStatus('confirmed')}
|
|
280
|
+
>
|
|
281
|
+
Confirm
|
|
282
|
+
</FilledButton>
|
|
283
|
+
</>
|
|
284
|
+
}
|
|
285
|
+
>
|
|
286
|
+
This confirmation is used when the assistant does not have a preview,
|
|
287
|
+
but asks about doing something in plain text on top of the canvas in the
|
|
288
|
+
chat. Do you approve this action?
|
|
289
|
+
</Preview.Confirmation>
|
|
290
|
+
</Preview>
|
|
291
|
+
);
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
export default Component;
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Data Grid
|
|
298
|
+
|
|
299
|
+
```tsx
|
|
300
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
301
|
+
|
|
302
|
+
import { DataGrid, FilledButton, OutlinedButton } from '@neo4j-ndl/react';
|
|
303
|
+
import { Preview } from '@neo4j-ndl/react/ai';
|
|
304
|
+
import {
|
|
305
|
+
getCoreRowModel,
|
|
306
|
+
getSortedRowModel,
|
|
307
|
+
useReactTable,
|
|
308
|
+
} from '@tanstack/react-table';
|
|
309
|
+
import { useState } from 'react';
|
|
310
|
+
|
|
311
|
+
const DATA = [
|
|
312
|
+
{
|
|
313
|
+
project_role: 'Viewer',
|
|
314
|
+
user: 'John Doe',
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
project_role: 'Viewer',
|
|
318
|
+
user: 'Alice Appleton',
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
project_role: 'Editor',
|
|
322
|
+
user: 'Bob Blueburr',
|
|
323
|
+
},
|
|
324
|
+
];
|
|
325
|
+
|
|
326
|
+
const Component = () => {
|
|
327
|
+
const [status, setStatus] =
|
|
328
|
+
useState<React.ComponentProps<typeof Preview.Confirmation>['status']>(
|
|
329
|
+
'pending',
|
|
330
|
+
);
|
|
331
|
+
|
|
332
|
+
const table = useReactTable({
|
|
333
|
+
columns: [
|
|
334
|
+
{
|
|
335
|
+
accessorKey: 'user',
|
|
336
|
+
header: 'User',
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
accessorKey: 'project_role',
|
|
340
|
+
header: 'Project Role',
|
|
341
|
+
},
|
|
342
|
+
],
|
|
343
|
+
data: DATA,
|
|
344
|
+
defaultColumn: {
|
|
345
|
+
minSize: 100,
|
|
346
|
+
},
|
|
347
|
+
enableSorting: true,
|
|
348
|
+
getCoreRowModel: getCoreRowModel(),
|
|
349
|
+
getSortedRowModel: getSortedRowModel(),
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
return (
|
|
353
|
+
<Preview>
|
|
354
|
+
<DataGrid
|
|
355
|
+
isResizable={false}
|
|
356
|
+
tableInstance={table}
|
|
357
|
+
isKeyboardNavigable={false}
|
|
358
|
+
styling={{
|
|
359
|
+
borderStyle: 'all-sides',
|
|
360
|
+
}}
|
|
361
|
+
components={{
|
|
362
|
+
Navigation: null,
|
|
363
|
+
}}
|
|
364
|
+
/>
|
|
365
|
+
<Preview.Confirmation
|
|
366
|
+
isFooter={true}
|
|
367
|
+
status={status}
|
|
368
|
+
actions={
|
|
369
|
+
<>
|
|
370
|
+
<OutlinedButton
|
|
371
|
+
variant="neutral"
|
|
372
|
+
size="small"
|
|
373
|
+
onClick={() => setStatus('rejected')}
|
|
374
|
+
>
|
|
375
|
+
Skip
|
|
376
|
+
</OutlinedButton>
|
|
377
|
+
<FilledButton
|
|
378
|
+
variant="primary"
|
|
379
|
+
size="small"
|
|
380
|
+
onClick={() => setStatus('confirmed')}
|
|
381
|
+
>
|
|
382
|
+
Invite users
|
|
383
|
+
</FilledButton>
|
|
384
|
+
</>
|
|
385
|
+
}
|
|
386
|
+
>
|
|
387
|
+
Assistant wants to perform an action
|
|
388
|
+
</Preview.Confirmation>
|
|
389
|
+
</Preview>
|
|
390
|
+
);
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
export default Component;
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Simple
|
|
397
|
+
|
|
398
|
+
```tsx
|
|
399
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
400
|
+
|
|
401
|
+
import { FilledButton, OutlinedButton } from '@neo4j-ndl/react';
|
|
402
|
+
import { Preview } from '@neo4j-ndl/react/ai';
|
|
403
|
+
import { useState } from 'react';
|
|
404
|
+
|
|
405
|
+
const Component = () => {
|
|
406
|
+
const [status, setStatus] =
|
|
407
|
+
useState<React.ComponentProps<typeof Preview.Confirmation>['status']>(
|
|
408
|
+
'pending',
|
|
409
|
+
);
|
|
410
|
+
|
|
411
|
+
return (
|
|
412
|
+
<Preview>
|
|
413
|
+
<Preview.Header>CONNECT TO INSTANCE</Preview.Header>
|
|
414
|
+
<Preview.Confirmation
|
|
415
|
+
status={status}
|
|
416
|
+
isFooter={true}
|
|
417
|
+
confirmedActionText="Instance selected"
|
|
418
|
+
rejectedActionText="Skipped"
|
|
419
|
+
actions={
|
|
420
|
+
<>
|
|
421
|
+
<OutlinedButton
|
|
422
|
+
variant="neutral"
|
|
423
|
+
size="small"
|
|
424
|
+
onClick={() => setStatus('rejected')}
|
|
425
|
+
>
|
|
426
|
+
Skip
|
|
427
|
+
</OutlinedButton>
|
|
428
|
+
<FilledButton
|
|
429
|
+
variant="primary"
|
|
430
|
+
size="small"
|
|
431
|
+
onClick={() => setStatus('confirmed')}
|
|
432
|
+
>
|
|
433
|
+
Select instance
|
|
434
|
+
</FilledButton>
|
|
435
|
+
</>
|
|
436
|
+
}
|
|
437
|
+
></Preview.Confirmation>
|
|
438
|
+
</Preview>
|
|
439
|
+
);
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
export default Component;
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
### Simple With Content
|
|
446
|
+
|
|
447
|
+
```tsx
|
|
448
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
449
|
+
|
|
450
|
+
import { FilledButton, OutlinedButton, ReadOnlyTag } from '@neo4j-ndl/react';
|
|
451
|
+
import { Preview } from '@neo4j-ndl/react/ai';
|
|
452
|
+
import { DeploymentsIcon } from '@neo4j-ndl/react/icons';
|
|
453
|
+
import { useState } from 'react';
|
|
454
|
+
|
|
455
|
+
const Component = () => {
|
|
456
|
+
const [status, setStatus] =
|
|
457
|
+
useState<React.ComponentProps<typeof Preview.Confirmation>['status']>(
|
|
458
|
+
'pending',
|
|
459
|
+
);
|
|
460
|
+
|
|
461
|
+
return (
|
|
462
|
+
<Preview>
|
|
463
|
+
<Preview.Header>CONNECT TO INSTANCE</Preview.Header>
|
|
464
|
+
<Preview.Content>
|
|
465
|
+
<ReadOnlyTag size="small" leadingVisual={<DeploymentsIcon />}>
|
|
466
|
+
Instance 1
|
|
467
|
+
</ReadOnlyTag>
|
|
468
|
+
</Preview.Content>
|
|
469
|
+
<Preview.Confirmation
|
|
470
|
+
status={status}
|
|
471
|
+
isFooter={true}
|
|
472
|
+
confirmedActionText="Allowed action"
|
|
473
|
+
rejectedActionText="Skipped action"
|
|
474
|
+
actions={
|
|
475
|
+
<>
|
|
476
|
+
<OutlinedButton
|
|
477
|
+
variant="neutral"
|
|
478
|
+
size="small"
|
|
479
|
+
onClick={() => setStatus('rejected')}
|
|
480
|
+
>
|
|
481
|
+
Skip
|
|
482
|
+
</OutlinedButton>
|
|
483
|
+
<FilledButton
|
|
484
|
+
variant="primary"
|
|
485
|
+
size="small"
|
|
486
|
+
onClick={() => setStatus('confirmed')}
|
|
487
|
+
>
|
|
488
|
+
Allow
|
|
489
|
+
</FilledButton>
|
|
490
|
+
</>
|
|
491
|
+
}
|
|
492
|
+
></Preview.Confirmation>
|
|
493
|
+
</Preview>
|
|
494
|
+
);
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
export default Component;
|
|
498
|
+
```
|