@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.
Files changed (76) hide show
  1. package/package.json +5 -2
  2. package/skills/ndl-react/SKILL.md +152 -0
  3. package/skills/ndl-react/components/accordion.md +386 -0
  4. package/skills/ndl-react/components/ai/code-preview.md +128 -0
  5. package/skills/ndl-react/components/ai/file-tag.md +90 -0
  6. package/skills/ndl-react/components/ai/image-tag.md +91 -0
  7. package/skills/ndl-react/components/ai/more-files.md +73 -0
  8. package/skills/ndl-react/components/ai/presence.md +54 -0
  9. package/skills/ndl-react/components/ai/preview.md +498 -0
  10. package/skills/ndl-react/components/ai/prompt.md +362 -0
  11. package/skills/ndl-react/components/ai/reasoning.md +95 -0
  12. package/skills/ndl-react/components/ai/response.md +1109 -0
  13. package/skills/ndl-react/components/ai/suggestion.md +84 -0
  14. package/skills/ndl-react/components/ai/thinking.md +43 -0
  15. package/skills/ndl-react/components/ai/tool-call.md +43 -0
  16. package/skills/ndl-react/components/ai/user-bubble.md +187 -0
  17. package/skills/ndl-react/components/avatar.md +169 -0
  18. package/skills/ndl-react/components/banner.md +225 -0
  19. package/skills/ndl-react/components/box.md +39 -0
  20. package/skills/ndl-react/components/breadcrumbs.md +245 -0
  21. package/skills/ndl-react/components/checkbox.md +269 -0
  22. package/skills/ndl-react/components/clean-icon-button.md +294 -0
  23. package/skills/ndl-react/components/clipboard-button.md +154 -0
  24. package/skills/ndl-react/components/code-block.md +276 -0
  25. package/skills/ndl-react/components/code.md +68 -0
  26. package/skills/ndl-react/components/color-picker.md +131 -0
  27. package/skills/ndl-react/components/conditional-wrap.md +46 -0
  28. package/skills/ndl-react/components/data-grid.md +3121 -0
  29. package/skills/ndl-react/components/date-picker.md +652 -0
  30. package/skills/ndl-react/components/dialog.md +485 -0
  31. package/skills/ndl-react/components/dismissible-tag.md +136 -0
  32. package/skills/ndl-react/components/divider.md +96 -0
  33. package/skills/ndl-react/components/drawer.md +543 -0
  34. package/skills/ndl-react/components/dropdown-button.md +161 -0
  35. package/skills/ndl-react/components/dropzone.md +371 -0
  36. package/skills/ndl-react/components/filled-button.md +26 -0
  37. package/skills/ndl-react/components/flex.md +82 -0
  38. package/skills/ndl-react/components/graph-label.md +167 -0
  39. package/skills/ndl-react/components/icon-button-array.md +187 -0
  40. package/skills/ndl-react/components/icon-button.md +193 -0
  41. package/skills/ndl-react/components/inline-edit.md +209 -0
  42. package/skills/ndl-react/components/kbd.md +63 -0
  43. package/skills/ndl-react/components/loading-bar.md +43 -0
  44. package/skills/ndl-react/components/loading-spinner.md +57 -0
  45. package/skills/ndl-react/components/logo.md +57 -0
  46. package/skills/ndl-react/components/menu.md +993 -0
  47. package/skills/ndl-react/components/modal.md +27 -0
  48. package/skills/ndl-react/components/next/tree-view.md +966 -0
  49. package/skills/ndl-react/components/outlined-button.md +26 -0
  50. package/skills/ndl-react/components/popover.md +283 -0
  51. package/skills/ndl-react/components/progress-bar.md +70 -0
  52. package/skills/ndl-react/components/radio.md +150 -0
  53. package/skills/ndl-react/components/read-only-tag.md +96 -0
  54. package/skills/ndl-react/components/segmented-control.md +200 -0
  55. package/skills/ndl-react/components/select-icon-button.md +183 -0
  56. package/skills/ndl-react/components/select.md +530 -0
  57. package/skills/ndl-react/components/selectable-tag.md +203 -0
  58. package/skills/ndl-react/components/side-navigation.md +652 -0
  59. package/skills/ndl-react/components/skeleton.md +274 -0
  60. package/skills/ndl-react/components/slider.md +308 -0
  61. package/skills/ndl-react/components/spotlight.md +796 -0
  62. package/skills/ndl-react/components/status-indicator.md +57 -0
  63. package/skills/ndl-react/components/status-label.md +132 -0
  64. package/skills/ndl-react/components/switch.md +167 -0
  65. package/skills/ndl-react/components/tabs.md +433 -0
  66. package/skills/ndl-react/components/tag.md +91 -0
  67. package/skills/ndl-react/components/text-area.md +178 -0
  68. package/skills/ndl-react/components/text-button.md +25 -0
  69. package/skills/ndl-react/components/text-input.md +475 -0
  70. package/skills/ndl-react/components/text-link.md +119 -0
  71. package/skills/ndl-react/components/time-picker.md +137 -0
  72. package/skills/ndl-react/components/timezone-picker.md +496 -0
  73. package/skills/ndl-react/components/tooltip.md +478 -0
  74. package/skills/ndl-react/components/tree-view.md +545 -0
  75. package/skills/ndl-react/components/typography.md +72 -0
  76. package/skills/ndl-react/components/wizard.md +152 -0
@@ -0,0 +1,545 @@
1
+ # TreeView
2
+
3
+ Import: `import { TreeView } from '@neo4j-ndl/react'`
4
+
5
+ ## Props
6
+
7
+ ### TreeView
8
+
9
+ | Prop | Type | Required | Default | Description |
10
+ |------|------|----------|---------|-------------|
11
+ | `items` | `TreeItem<T>[]` | ✅ | | The items to be displayed in the tree view |
12
+ | `onItemsChanged` | `(newItems: TreeItem<T>[], itemChangedReason: ItemChangedReason<T>) => void` | ✅ | | A function that is called when the items in the tree view change |
13
+ | `TreeItemComponent` | `TreeItemComponent<T, E>` | | | The component to use for the tree items, if not provided the default component will be used |
14
+
15
+ ### TreeView.SortableTreeViewItem
16
+
17
+ | Prop | Type | Required | Default | Description |
18
+ |------|------|----------|---------|-------------|
19
+ | `ariaLevel` | `number` | | | |
20
+ | `ariaPosInSet` | `number` | | | |
21
+ | `ariaSetSize` | `number` | | | |
22
+ | `childCount` | `number` | | | Number of child items |
23
+ | `clone` | `boolean` | | | Whether this is a clone item |
24
+ | `collapsed` | `boolean` | | | Whether the item is collapsed |
25
+ | `depth` | `number` | ✅ | | Depth of the item in the tree |
26
+ | `id` | `UniqueIdentifier` | ✅ | | |
27
+ | `indentationWidth` | `number` | ✅ | | Width of the indentation |
28
+ | `indicator` | `boolean` | | | Whether this is an indicator item |
29
+ | `isLast` | `boolean` | ✅ | | Whether this is the last item in its parent |
30
+ | `item` | `FlattenedTreeItem<T>` | ✅ | | The tree item data |
31
+ | `items` | `FlattenedTreeItem<T>[]` | ✅ | | All items in the tree |
32
+ | `keepGhostInPlace` | `boolean` | | | Whether to keep the ghost item in place while dragging |
33
+ | `onCollapse` | `(id: UniqueIdentifier) => void` | | | Function to call when item is collapsed |
34
+ | `onFocus` | `() => void` | | | Function to call when the item receives focus |
35
+ | `onItemsChanged` | `(newItems: FlattenedTreeItem<T>[], itemChangedReason: ItemChangedReason<T>) => void` | ✅ | | Function to call when the item has changed |
36
+ | `onRemove` | `(id: UniqueIdentifier) => void` | | | Function to call when item is removed |
37
+ | `parent` | `FlattenedTreeItem<T>` | ✅ | | Parent item of this item |
38
+ | `shouldDisableInteraction` | `boolean` | | | Whether interaction should be disabled |
39
+ | `shouldDisableSorting` | `boolean` | | | Whether sorting should be disabled for this item |
40
+ | `sortableProps` | `Omit<Arguments, "id">` | | | Props for the sortable functionality |
41
+ | `tabIndex` | `number` | | | |
42
+ | `trails` | `("none" \| "straight" \| "straight-curved" \| "curved")[]` | ✅ | | A list of trails to render before the item |
43
+ | `TreeItemComponent` | `TreeItemComponent<T, E>` | ✅ | | The component to use for rendering the tree item |
44
+ | `wrapperRef` | `(node: HTMLLIElement) => void` | | | Function to set the wrapper ref |
45
+
46
+ ### TreeView.TreeItemWrapper
47
+
48
+ | Prop | Type | Required | Default | Description |
49
+ |------|------|----------|---------|-------------|
50
+ | `ariaLevel` | `number` | | | |
51
+ | `ariaPosInSet` | `number` | | | |
52
+ | `ariaSetSize` | `number` | | | |
53
+ | `depth` | `number` | ✅ | | Depth of the item in the tree |
54
+ | `dragHandleProps` | `Record<string, unknown>` | | | Props for the drag handle |
55
+ | `indentationWidth` | `number` | ✅ | | Width of the indentation |
56
+ | `isCollapsed` | `boolean` | | | If the item is collapsed |
57
+ | `isGhost` | `boolean` | | | If the item is should be rendered as a placeholder (for example, while dragging) |
58
+ | `isIndicator` | `boolean` | | | True if the item should be rendered as a indicator (for example, while dragging) |
59
+ | `isLastInParent` | `boolean` | ✅ | | True if this item is the last in the parent list |
60
+ | `isOver` | `boolean` | ✅ | | True if dragged item is over this Node. |
61
+ | `isOverParent` | `boolean` | ✅ | | True if dragged item is over the parent of this Node. |
62
+ | `item` | `FlattenedTreeItem<T>` | ✅ | | The tree item data |
63
+ | `items` | `FlattenedTreeItem<T>[]` | ✅ | | All items in the tree |
64
+ | `onCollapse` | `() => void` | | | Function to call when the item is collapsed/expanded |
65
+ | `onFocus` | `() => void` | | | Function to call when the item receives focus |
66
+ | `onItemsChanged` | `(newItems: FlattenedTreeItem<T>[], reason: ItemChangedReason<T>) => void` | ✅ | | Function to call when the item has changed |
67
+ | `parent` | `FlattenedTreeItem<T>` | ✅ | | Parent item of this item |
68
+ | `ref` | `Ref<HTMLDivElement>` | | | A ref to apply to the root element. |
69
+ | `setActivatorNodeRef` | `(node: HTMLElement) => void` | ✅ | | Function to set the ref of the element that should activate sorting |
70
+ | `setNodeRef` | `(node: HTMLLIElement) => void` | ✅ | | Function to set the ref of the element that should be sorted (the wrapper element of the item) |
71
+ | `shouldDisableInteraction` | `boolean` | | | While dragging it makes sense to disable some interaction for all other items. |
72
+ | `shouldDisableSorting` | `boolean` | | | True if sorting is disabled for this item. |
73
+ | `tabIndex` | `number` | | | |
74
+ | `trails` | `("none" \| "straight" \| "straight-curved" \| "curved")[]` | ✅ | | A list of trails to render before the item |
75
+
76
+ ### TreeView.TreeViewTextItem
77
+
78
+ | Prop | Type | Required | Default | Description |
79
+ |------|------|----------|---------|-------------|
80
+ | `ariaLevel` | `number` | | | |
81
+ | `ariaPosInSet` | `number` | | | |
82
+ | `ariaSetSize` | `number` | | | |
83
+ | `depth` | `number` | ✅ | | Depth of the item in the tree |
84
+ | `dragHandleProps` | `Record<string, unknown>` | | | Props for the drag handle |
85
+ | `indentationWidth` | `number` | ✅ | | Width of the indentation |
86
+ | `isCollapsed` | `boolean` | | | If the item is collapsed |
87
+ | `isGhost` | `boolean` | | | If the item is should be rendered as a placeholder (for example, while dragging) |
88
+ | `isIndicator` | `boolean` | | | True if the item should be rendered as a indicator (for example, while dragging) |
89
+ | `isLastInParent` | `boolean` | ✅ | | True if this item is the last in the parent list |
90
+ | `isOver` | `boolean` | ✅ | | True if dragged item is over this Node. |
91
+ | `isOverParent` | `boolean` | ✅ | | True if dragged item is over the parent of this Node. |
92
+ | `item` | `FlattenedTreeItem<T>` | ✅ | | The tree item data |
93
+ | `items` | `FlattenedTreeItem<T>[]` | ✅ | | All items in the tree |
94
+ | `onCollapse` | `() => void` | | | Function to call when the item is collapsed/expanded |
95
+ | `onFocus` | `() => void` | | | Function to call when the item receives focus |
96
+ | `onItemsChanged` | `(newItems: FlattenedTreeItem<T>[], reason: ItemChangedReason<T>) => void` | ✅ | | Function to call when the item has changed |
97
+ | `parent` | `FlattenedTreeItem<T>` | ✅ | | Parent item of this item |
98
+ | `ref` | `Ref<HTMLDivElement> & Ref<HTMLElement>` | | | A ref to apply to the root element. |
99
+ | `setActivatorNodeRef` | `(node: HTMLElement) => void` | ✅ | | Function to set the ref of the element that should activate sorting |
100
+ | `setNodeRef` | `(node: HTMLLIElement) => void` | ✅ | | Function to set the ref of the element that should be sorted (the wrapper element of the item) |
101
+ | `shouldDisableInteraction` | `boolean` | | | While dragging it makes sense to disable some interaction for all other items. |
102
+ | `shouldDisableSorting` | `boolean` | | | True if sorting is disabled for this item. |
103
+ | `tabIndex` | `number` | | | |
104
+ | `trails` | `("none" \| "straight" \| "straight-curved" \| "curved")[]` | ✅ | | A list of trails to render before the item |
105
+
106
+ ## Examples
107
+
108
+ ### Treeview Custom
109
+
110
+ ```tsx
111
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
112
+
113
+ import { TreeView } from '@neo4j-ndl/react';
114
+ import {
115
+ ChevronDownIconSolid,
116
+ ChevronUpIconSolid,
117
+ FolderIconOutline,
118
+ } from '@neo4j-ndl/react/icons';
119
+ import type React from 'react';
120
+ import { useState } from 'react';
121
+
122
+ const TREE_ITEMS: React.ComponentProps<typeof TreeView>['items'] = [
123
+ {
124
+ canHaveSubItems: true,
125
+ data: {
126
+ custom: 'Custom Root',
127
+ },
128
+ id: 'Root',
129
+ isCollapsed: false,
130
+ isSelected: false,
131
+ subItems: [
132
+ {
133
+ canHaveSubItems: false,
134
+ data: {
135
+ custom: 'Custom child 1',
136
+ },
137
+ id: 'Child 1',
138
+ isSelected: false,
139
+ },
140
+ {
141
+ canHaveSubItems: false,
142
+ data: {
143
+ custom: 'Custom child 2',
144
+ },
145
+ id: 'Child 2',
146
+ isSelected: false,
147
+ },
148
+ {
149
+ canHaveSubItems: false,
150
+ data: {
151
+ custom: 'Custom child 3',
152
+ },
153
+ id: 'Child 3',
154
+ isSelected: false,
155
+ },
156
+ ],
157
+ },
158
+ ];
159
+
160
+ const Component = () => {
161
+ const [items, setItems] = useState(TREE_ITEMS);
162
+
163
+ return (
164
+ <TreeView
165
+ items={items}
166
+ onItemsChanged={(newItems) => {
167
+ setItems(newItems);
168
+ }}
169
+ TreeItemComponent={function CustomTreeItem({
170
+ ref,
171
+ onItemsChanged,
172
+ ...restProps
173
+ }: React.ComponentProps<typeof TreeView.TreeItemWrapper>) {
174
+ return (
175
+ <TreeView.TreeItemWrapper
176
+ {...restProps}
177
+ onItemsChanged={onItemsChanged}
178
+ ref={ref}
179
+ >
180
+ <div
181
+ className="n-items-center n-flex n-flex-row"
182
+ style={{
183
+ background: !restProps.item.canHaveSubItems
184
+ ? 'linear-gradient(in hsl longer hue 45deg, red 0 0)'
185
+ : '',
186
+ }}
187
+ >
188
+ {restProps.item.canHaveSubItems && (
189
+ <>
190
+ <FolderIconOutline className="n-h-5 w-h-5" />
191
+ <button
192
+ type="button"
193
+ onClick={() =>
194
+ restProps.onCollapse && restProps.onCollapse()
195
+ }
196
+ >
197
+ {restProps.item.isCollapsed ? (
198
+ <ChevronUpIconSolid className="n-h-5 w-h-5" />
199
+ ) : (
200
+ <ChevronDownIconSolid className="n-h-5 w-h-5" />
201
+ )}
202
+ </button>
203
+ </>
204
+ )}
205
+ {'custom' in restProps.item.data &&
206
+ typeof restProps.item.data.custom === 'string' &&
207
+ restProps.item.data.custom}
208
+ </div>
209
+ </TreeView.TreeItemWrapper>
210
+ );
211
+ }}
212
+ />
213
+ );
214
+ };
215
+
216
+ export default Component;
217
+ ```
218
+
219
+ ### Treeview Default
220
+
221
+ ```tsx
222
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
223
+
224
+ import { TreeView } from '@neo4j-ndl/react';
225
+ import { PencilIconOutline } from '@neo4j-ndl/react/icons';
226
+ import type React from 'react';
227
+ import { useState } from 'react';
228
+
229
+ const TREE_ITEMS: React.ComponentProps<typeof TreeView>['items'] = [
230
+ {
231
+ canHaveSubItems: true,
232
+ data: {
233
+ actions: [
234
+ {
235
+ buttonProps: {
236
+ description: 'Edit',
237
+ onClick: () => {
238
+ alert('Pencil was clicked');
239
+ },
240
+ },
241
+ icon: <PencilIconOutline />,
242
+ },
243
+ ],
244
+ onTextClick: () => {
245
+ alert('Text was clicked');
246
+ },
247
+ text: 'Folder 1',
248
+ },
249
+ id: 'Folder 1',
250
+ isCollapsed: false,
251
+ isSelected: false,
252
+ isSortable: false,
253
+ subItems: [
254
+ {
255
+ canHaveSubItems: false,
256
+ data: {
257
+ actions: [
258
+ {
259
+ buttonProps: {
260
+ description: 'Edit',
261
+ onClick: () => {
262
+ alert('Pencil was clicked');
263
+ },
264
+ },
265
+ icon: <PencilIconOutline />,
266
+ },
267
+ ],
268
+ onTextClick: () => {
269
+ alert('Text was clicked');
270
+ },
271
+ text: 'Child 1',
272
+ },
273
+ id: 'Child 1',
274
+ isSelected: false,
275
+ isSortable: true,
276
+ },
277
+ {
278
+ canHaveSubItems: false,
279
+ data: {
280
+ actions: [
281
+ {
282
+ buttonProps: {
283
+ description: 'Edit',
284
+ onClick: () => {
285
+ alert('Pencil was clicked');
286
+ },
287
+ },
288
+ icon: <PencilIconOutline />,
289
+ },
290
+ ],
291
+ onTextClick: () => {
292
+ alert('Text was clicked');
293
+ },
294
+ text: 'Child 2',
295
+ },
296
+ id: 'Child 2',
297
+ isSelected: false,
298
+ isSortable: true,
299
+ },
300
+ {
301
+ canHaveSubItems: false,
302
+ data: {
303
+ actions: [
304
+ {
305
+ buttonProps: {
306
+ description: 'Edit',
307
+ onClick: () => {
308
+ alert('Pencil was clicked');
309
+ },
310
+ },
311
+ icon: <PencilIconOutline />,
312
+ },
313
+ ],
314
+ onTextClick: () => {
315
+ alert('Text was clicked');
316
+ },
317
+ text: 'Child 3',
318
+ },
319
+ id: 'Child 3',
320
+ isSelected: false,
321
+ isSortable: true,
322
+ },
323
+ {
324
+ canHaveSubItems: true,
325
+ data: {
326
+ actions: [
327
+ {
328
+ buttonProps: {
329
+ description: 'Edit',
330
+ onClick: () => {
331
+ alert('Pencil was clicked');
332
+ },
333
+ },
334
+ icon: <PencilIconOutline />,
335
+ },
336
+ ],
337
+ onTextClick: () => {
338
+ alert('Text was clicked');
339
+ },
340
+ text: 'Folder 2',
341
+ },
342
+ id: 'Folder 2',
343
+ isCollapsed: true,
344
+ isSelected: false,
345
+ isSortable: true,
346
+ subItems: [
347
+ {
348
+ canHaveSubItems: false,
349
+ data: {
350
+ actions: [
351
+ {
352
+ buttonProps: {
353
+ description: 'Edit',
354
+ onClick: () => {
355
+ alert('Pencil was clicked');
356
+ },
357
+ },
358
+ icon: <PencilIconOutline />,
359
+ },
360
+ ],
361
+ onTextClick: () => {
362
+ alert('Text was clicked');
363
+ },
364
+ text: 'Child 4',
365
+ },
366
+
367
+ id: 'Child 4',
368
+ isSelected: false,
369
+ },
370
+ {
371
+ canHaveSubItems: false,
372
+ data: {
373
+ actions: [
374
+ {
375
+ buttonProps: {
376
+ description: 'Edit',
377
+ onClick: () => {
378
+ alert('Pencil was clicked');
379
+ },
380
+ },
381
+ icon: <PencilIconOutline />,
382
+ },
383
+ ],
384
+ onTextClick: () => {
385
+ alert('Text was clicked');
386
+ },
387
+ text: 'Child 5',
388
+ },
389
+ id: 'Child 5',
390
+ isSelected: false,
391
+ },
392
+ {
393
+ canHaveSubItems: false,
394
+ data: {
395
+ actions: [
396
+ {
397
+ buttonProps: {
398
+ description: 'Edit',
399
+ onClick: () => {
400
+ alert('Pencil was clicked');
401
+ },
402
+ },
403
+ icon: <PencilIconOutline />,
404
+ },
405
+ ],
406
+ onTextClick: () => {
407
+ alert('Text was clicked');
408
+ },
409
+ text: 'Child 6',
410
+ },
411
+ id: 'Child 6',
412
+ isSelected: false,
413
+ },
414
+ ],
415
+ },
416
+ ],
417
+ },
418
+ {
419
+ canHaveSubItems: false,
420
+ data: {
421
+ actions: [
422
+ {
423
+ buttonProps: {
424
+ description: 'Edit',
425
+ onClick: () => {
426
+ alert('Pencil was clicked');
427
+ },
428
+ },
429
+ icon: <PencilIconOutline />,
430
+ },
431
+ ],
432
+ onTextClick: () => {
433
+ alert('Text was clicked');
434
+ },
435
+ text: 'Child 7',
436
+ },
437
+ id: 'Child 7',
438
+ isSelected: false,
439
+ isSortable: true,
440
+ },
441
+ ];
442
+
443
+ const Component = () => {
444
+ const [items, setItems] =
445
+ useState<React.ComponentProps<typeof TreeView>['items']>(TREE_ITEMS);
446
+
447
+ return (
448
+ <TreeView
449
+ items={items}
450
+ onItemsChanged={(newItems, itemChangedReason) => {
451
+ // eslint-disable-next-line no-restricted-syntax
452
+ console.log('change with itemChangedReason:', itemChangedReason);
453
+ setItems(newItems);
454
+ }}
455
+ TreeItemComponent={undefined}
456
+ />
457
+ );
458
+ };
459
+
460
+ export default Component;
461
+ ```
462
+
463
+ ### Treeview Skeleton Loading
464
+
465
+ ```tsx
466
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
467
+
468
+ import { TreeView } from '@neo4j-ndl/react';
469
+ import type React from 'react';
470
+ import { useState } from 'react';
471
+
472
+ const TREE_ITEMS: React.ComponentProps<typeof TreeView>['items'] = [
473
+ {
474
+ canHaveSubItems: true,
475
+ data: {
476
+ actions: [],
477
+ text: 'Folder 1',
478
+ },
479
+ id: 'Folder 1',
480
+ isCollapsed: false,
481
+ isSelected: false,
482
+ subItems: [
483
+ {
484
+ canHaveSubItems: false,
485
+ data: {
486
+ actions: [],
487
+ text: 'Item 1',
488
+ },
489
+ id: 'Item 1',
490
+ isSelected: false,
491
+ },
492
+ {
493
+ canHaveSubItems: true,
494
+ data: {
495
+ actions: [],
496
+ text: 'Folder 2',
497
+ },
498
+ id: 'Folder 2',
499
+ isCollapsed: false,
500
+ isSelected: false,
501
+ isSkeletonLoading: true,
502
+ subItems: [
503
+ {
504
+ canHaveSubItems: false,
505
+ data: {
506
+ actions: [],
507
+ text: 'Item 2',
508
+ },
509
+ id: 'Item 2',
510
+ isSelected: false,
511
+ },
512
+ {
513
+ canHaveSubItems: false,
514
+ data: {
515
+ actions: [],
516
+ text: 'Item 3',
517
+ },
518
+ id: 'Item 3',
519
+ isSelected: false,
520
+ isSkeletonLoading: true,
521
+ },
522
+ ],
523
+ },
524
+ ],
525
+ },
526
+ ];
527
+
528
+ const Component = () => {
529
+ const [items, setItems] =
530
+ useState<React.ComponentProps<typeof TreeView>['items']>(TREE_ITEMS);
531
+
532
+ return (
533
+ <TreeView
534
+ items={items}
535
+ onItemsChanged={(newItems, itemChangedReason) => {
536
+ console.info('change with itemChangedReason:', itemChangedReason);
537
+ setItems(newItems);
538
+ }}
539
+ TreeItemComponent={undefined}
540
+ />
541
+ );
542
+ };
543
+
544
+ export default Component;
545
+ ```
@@ -0,0 +1,72 @@
1
+ # Typography
2
+
3
+ Import: `import { Typography } from '@neo4j-ndl/react'`
4
+
5
+ ## Props
6
+
7
+ ### Typography
8
+
9
+ | Prop | Type | Required | Default | Description |
10
+ |------|------|----------|---------|-------------|
11
+ | `as` | `ElementType<any, keyof IntrinsicElements>` | | | An override of the default HTML tag of the root of the component. Can also be another React component. |
12
+ | `children` | `ReactNode` | | | Content displayed inside the component |
13
+ | `ref` | `any` | | | A ref to apply to the root element. |
14
+ | `variant` | `'body-large' \| 'body-medium' \| 'body-small' \| 'code' \| 'display' \| 'label' \| 'subheading-large' \| 'subheading-medium' \| 'subheading-small' \| 'title-1' \| 'title-2' \| 'title-3' \| 'title-4'` | ✅ | | The typography variant to use for the text. |
15
+
16
+ ## Examples
17
+
18
+ ### Default
19
+
20
+ ```tsx
21
+ import { Typography } from '../Typography';
22
+
23
+ const Component = () => (
24
+ <Typography variant="body-medium">
25
+ The quick brown fox jumps over the lazy dog.
26
+ </Typography>
27
+ );
28
+
29
+ export default Component;
30
+ ```
31
+
32
+ ### Anchor
33
+
34
+ ```tsx
35
+ import { Typography } from '../Typography';
36
+
37
+ const Component = () => {
38
+ const variant = 'title-1';
39
+
40
+ return (
41
+ <Typography as="a" htmlAttributes={{ href: '/index' }} variant={variant}>
42
+ {variant}: The quick brown fox jumps over the lazy dog
43
+ </Typography>
44
+ );
45
+ };
46
+
47
+ export default Component;
48
+ ```
49
+
50
+ ### Variants
51
+
52
+ ```tsx
53
+ import { tokens } from '@neo4j-ndl/base';
54
+
55
+ import { Typography } from '../Typography';
56
+
57
+ const VARIANTS = Object.keys(tokens.typography) as Array<
58
+ keyof typeof tokens.typography
59
+ >;
60
+
61
+ const Component = () => (
62
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
63
+ {VARIANTS.map((variant) => (
64
+ <Typography key={variant} variant={variant}>
65
+ {variant}: The quick brown fox jumps over the lazy dog.
66
+ </Typography>
67
+ ))}
68
+ </div>
69
+ );
70
+
71
+ export default Component;
72
+ ```