@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,96 @@
|
|
|
1
|
+
# Divider
|
|
2
|
+
|
|
3
|
+
Import: `import { Divider } from '@neo4j-ndl/react'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### Divider
|
|
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
|
+
| `orientation` | `'horizontal' \| 'vertical'` | | `horizontal` | |
|
|
13
|
+
| `ref` | `any` | | | A ref to apply to the root element. |
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
### Default
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
21
|
+
|
|
22
|
+
import { Divider } from '@neo4j-ndl/react';
|
|
23
|
+
|
|
24
|
+
const Component = () => {
|
|
25
|
+
return (
|
|
26
|
+
<div
|
|
27
|
+
style={{
|
|
28
|
+
display: 'flex',
|
|
29
|
+
flexDirection: 'column',
|
|
30
|
+
gap: '4px',
|
|
31
|
+
width: '100%',
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
|
35
|
+
<Divider />
|
|
36
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default Component;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Horizontal
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
48
|
+
|
|
49
|
+
import { Divider } from '@neo4j-ndl/react';
|
|
50
|
+
|
|
51
|
+
const Component = () => {
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
style={{
|
|
55
|
+
display: 'flex',
|
|
56
|
+
flexDirection: 'column',
|
|
57
|
+
gap: '4px',
|
|
58
|
+
width: '100%',
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
|
62
|
+
<Divider orientation="horizontal" />
|
|
63
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default Component;
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Vertical
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
75
|
+
|
|
76
|
+
import { Divider } from '@neo4j-ndl/react';
|
|
77
|
+
|
|
78
|
+
const Component = () => {
|
|
79
|
+
return (
|
|
80
|
+
<div
|
|
81
|
+
style={{
|
|
82
|
+
display: 'flex',
|
|
83
|
+
flexDirection: 'row',
|
|
84
|
+
gap: '4px',
|
|
85
|
+
width: '100%',
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
88
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
|
89
|
+
<Divider orientation="vertical" />
|
|
90
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export default Component;
|
|
96
|
+
```
|
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
# Drawer
|
|
2
|
+
|
|
3
|
+
Import: `import { Drawer } from '@neo4j-ndl/react'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### Drawer
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Required | Default | Description |
|
|
10
|
+
|------|------|----------|---------|-------------|
|
|
11
|
+
| `ariaLabel` | `string` | | | The aria-label to apply to the drawer. Required for accessibility when type is "modal" or "overlay". |
|
|
12
|
+
| `as` | `ElementType<any, keyof IntrinsicElements>` | | | An override of the default HTML tag of the root of the component. Can also be another React component. |
|
|
13
|
+
| `children` | `ReactNode` | ✅ | | The content to display within the drawer. |
|
|
14
|
+
| `closeOnClickOutside` | `boolean` | | `false` | When type is "overlay", whether clicking outside the drawer closes it. Should be set to true for overlay drawers. - When type is "overlay" or "modal", this defaults to false. - When type is "push", no effect. |
|
|
15
|
+
| `closeOnEscape` | `boolean` | | `type === 'modal' ? true : false` | Whether pressing Escape closes the drawer. Should be set to true for overlay drawers. - When type is "modal", this defaults to true. - When type is "overlay", this defaults to false. - When type is "push", no effect. |
|
|
16
|
+
| `closeOnFocusOut` | `boolean` | | | @deprecated overlay are now focus trapped by default, this prop has no effect anymore. |
|
|
17
|
+
| `isCloseable` | `boolean` | | `true` | Whether a close button (X) is displayed in the drawer. |
|
|
18
|
+
| `isExpanded` | `boolean` | ✅ | | Controls whether the drawer is open (expanded) or closed (collapsed). |
|
|
19
|
+
| `isPortaled` | `boolean` | | `false` | Whether to portal the content. Only applies when type is "overlay". Type "modal" is always portaled. |
|
|
20
|
+
| `isResizeable` | `boolean` | | `false` | Enables horizontal resizing of the drawer, by default it is not resizable. |
|
|
21
|
+
| `onExpandedChange` | `((expanded: boolean) => void)` | | | Callback fired when the drawer's expanded state changes (close button, Escape, click outside, or programmatic change). |
|
|
22
|
+
| `portalProps` | `FloatingPortalProps` | | `{}` | Props to pass to the portal from @floating-ui /react FloatingPortal Only applies when type is "overlay" and isPortaled is true, or if type is "modal". @see https://floating-ui.com/docs/floatingportal |
|
|
23
|
+
| `position` | `'left' \| 'right'` | | `left` | Position where the drawer appears on screen. By default, it appears from the left. |
|
|
24
|
+
| `ref` | `any` | | | A ref to apply to the root element. |
|
|
25
|
+
| `resizeableProps` | `ResizableProps` | | | To use this prop the isResizeable prop must be set to true. For overriding the third party library props: https://github.com/bokuweb/re-resizable The property enable has default values set for bottom, bottomLeft etc based on the position prop. |
|
|
26
|
+
| `type` | `'modal' \| 'overlay' \| 'push'` | | `overlay` | How the drawer affects the layout of sibling content. By default, it overlays content. |
|
|
27
|
+
|
|
28
|
+
Where `ResizableProps` is the props for the `re-resizable` library. For more information, see the [re-resizable documentation](https://github.com/bokuweb/re-resizable).
|
|
29
|
+
|
|
30
|
+
Where `FloatingPortalProps` is the props for the `@floating-ui/react` library. For more information, see the [FloatingPortal documentation](https://floating-ui.com/docs/floatingportal).
|
|
31
|
+
|
|
32
|
+
### Drawer.Actions
|
|
33
|
+
|
|
34
|
+
| Prop | Type | Required | Default | Description |
|
|
35
|
+
|------|------|----------|---------|-------------|
|
|
36
|
+
| `children` | `ReactNode` | ✅ | | |
|
|
37
|
+
|
|
38
|
+
### Drawer.Body
|
|
39
|
+
|
|
40
|
+
| Prop | Type | Required | Default | Description |
|
|
41
|
+
|------|------|----------|---------|-------------|
|
|
42
|
+
| `children` | `ReactNode` | ✅ | | |
|
|
43
|
+
|
|
44
|
+
### Drawer.Header
|
|
45
|
+
|
|
46
|
+
| Prop | Type | Required | Default | Description |
|
|
47
|
+
|------|------|----------|---------|-------------|
|
|
48
|
+
| `children` | `ReactNode` | ✅ | | |
|
|
49
|
+
|
|
50
|
+
## Accessibility
|
|
51
|
+
|
|
52
|
+
## Implementation guidelines
|
|
53
|
+
|
|
54
|
+
A button that expands a Drawer should have `'aria-expanded'` set to whether the Drawer is expanded or not, following the [disclosure pattern]([https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/)).
|
|
55
|
+
A drawer of type "overlay" should set the props `closeOnClickOutside` and `closeOnFocusOut` to true. This ensures that it doesn't hide focus of interactive elements on the screen (WCAG 2.4.11). closeOnEscape is not strictly needed, but is recommended.
|
|
56
|
+
Drawers of type "overlay" or "modal" implement the dialog pattern, meaning they need to be labelled to be accessible. Use either an `'aria-label'` or `'aria-labelledby'`.
|
|
57
|
+
The `isResizable` prop renders a vertical resize handle that is usable with both mouse and keyboard, with the relevant aria-attributes set to be accessible using screen readers as well.
|
|
58
|
+
|
|
59
|
+
## Examples
|
|
60
|
+
|
|
61
|
+
### Full
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
65
|
+
|
|
66
|
+
import { Checkbox, Drawer, FilledButton, TextInput } from '@neo4j-ndl/react';
|
|
67
|
+
import { useState } from 'react';
|
|
68
|
+
|
|
69
|
+
const Component = () => {
|
|
70
|
+
const [isExpanded, setIsExpanded] = useState(true);
|
|
71
|
+
|
|
72
|
+
const Placeholder = () => (
|
|
73
|
+
<div className="w-full n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16">
|
|
74
|
+
<div className="n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md">
|
|
75
|
+
<FilledButton
|
|
76
|
+
onClick={() => setIsExpanded(true)}
|
|
77
|
+
htmlAttributes={{
|
|
78
|
+
'aria-expanded': isExpanded,
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
Press to show the Drawer
|
|
82
|
+
</FilledButton>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<div className="n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden">
|
|
89
|
+
<Drawer
|
|
90
|
+
type="push"
|
|
91
|
+
isExpanded={isExpanded}
|
|
92
|
+
onExpandedChange={() => setIsExpanded(false)}
|
|
93
|
+
isResizeable={true}
|
|
94
|
+
resizeableProps={{
|
|
95
|
+
maxWidth: '400px',
|
|
96
|
+
minWidth: '300px',
|
|
97
|
+
}}
|
|
98
|
+
isCloseable={true}
|
|
99
|
+
isPortaled={false}
|
|
100
|
+
>
|
|
101
|
+
<Drawer.Header>Drawer Header</Drawer.Header>
|
|
102
|
+
<Drawer.Body>
|
|
103
|
+
<TextInput
|
|
104
|
+
showRequiredOrOptionalLabel={true}
|
|
105
|
+
moreInformationText="some information"
|
|
106
|
+
label="Label"
|
|
107
|
+
isDisabled={false}
|
|
108
|
+
isReadOnly={false}
|
|
109
|
+
helpText="Friendly text"
|
|
110
|
+
isFluid={true}
|
|
111
|
+
/>
|
|
112
|
+
<br />
|
|
113
|
+
<TextInput label="Some input" value="something" />
|
|
114
|
+
<br />
|
|
115
|
+
<Checkbox label="Checkbox label" />
|
|
116
|
+
<br />
|
|
117
|
+
Some example of something.
|
|
118
|
+
<br />
|
|
119
|
+
<TextInput label="Some input" isDisabled={true} value="something" />
|
|
120
|
+
<br />
|
|
121
|
+
<TextInput
|
|
122
|
+
showRequiredOrOptionalLabel={true}
|
|
123
|
+
moreInformationText="some information"
|
|
124
|
+
label="Label"
|
|
125
|
+
isDisabled={false}
|
|
126
|
+
isReadOnly={false}
|
|
127
|
+
helpText="Friendly text"
|
|
128
|
+
isFluid={true}
|
|
129
|
+
/>
|
|
130
|
+
<br />
|
|
131
|
+
Some example of something.
|
|
132
|
+
<br />
|
|
133
|
+
<TextInput label="Some input" value="something" />
|
|
134
|
+
<br />
|
|
135
|
+
<Checkbox label="Checkbox label" />
|
|
136
|
+
<br />
|
|
137
|
+
<TextInput label="Some input" value="something" />
|
|
138
|
+
</Drawer.Body>
|
|
139
|
+
<Drawer.Actions>
|
|
140
|
+
<FilledButton onClick={() => setIsExpanded(false)} size="medium">
|
|
141
|
+
Close
|
|
142
|
+
</FilledButton>
|
|
143
|
+
</Drawer.Actions>
|
|
144
|
+
</Drawer>
|
|
145
|
+
<Placeholder />
|
|
146
|
+
</div>
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export default Component;
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Not Closeable
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
157
|
+
|
|
158
|
+
import { Drawer } from '@neo4j-ndl/react';
|
|
159
|
+
|
|
160
|
+
const Component = () => {
|
|
161
|
+
const Placeholder = () => (
|
|
162
|
+
<div className="n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16 w-full">
|
|
163
|
+
<div className="n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md"></div>
|
|
164
|
+
</div>
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
<div className="n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden">
|
|
169
|
+
<Drawer type="push" isExpanded={true} position="left" isCloseable={false}>
|
|
170
|
+
<Drawer.Header>Drawer</Drawer.Header>
|
|
171
|
+
<Drawer.Body>Lorem ipsum dolor sit amet.</Drawer.Body>
|
|
172
|
+
</Drawer>
|
|
173
|
+
<Placeholder />
|
|
174
|
+
</div>
|
|
175
|
+
);
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export default Component;
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Overlay
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
185
|
+
|
|
186
|
+
import { Drawer, FilledButton } from '@neo4j-ndl/react';
|
|
187
|
+
import { useRef, useState } from 'react';
|
|
188
|
+
|
|
189
|
+
const Component = () => {
|
|
190
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
191
|
+
const referenceElement = useRef<HTMLButtonElement>(null);
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<div className="n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden">
|
|
195
|
+
<Drawer
|
|
196
|
+
isExpanded={isExpanded}
|
|
197
|
+
onExpandedChange={() => setIsExpanded(false)}
|
|
198
|
+
type="overlay"
|
|
199
|
+
ariaLabel="Drawer"
|
|
200
|
+
position="left"
|
|
201
|
+
closeOnClickOutside={true}
|
|
202
|
+
closeOnEscape={true}
|
|
203
|
+
isCloseable={true}
|
|
204
|
+
style={{ maxWidth: '400px' }}
|
|
205
|
+
>
|
|
206
|
+
<Drawer.Header>Drawer</Drawer.Header>
|
|
207
|
+
<Drawer.Body>
|
|
208
|
+
If you use an overlay drawer, you should set{' '}
|
|
209
|
+
<code>closeOnClickOutside</code> to true. This is to align the mouse
|
|
210
|
+
behavior with the keyboard behavior, as focus is trapped inside the
|
|
211
|
+
drawer. This is to prevent the drawer from covering interactive
|
|
212
|
+
elements outside the drawer.
|
|
213
|
+
</Drawer.Body>
|
|
214
|
+
<Drawer.Actions>
|
|
215
|
+
<FilledButton onClick={() => setIsExpanded(false)} size="medium">
|
|
216
|
+
Close
|
|
217
|
+
</FilledButton>
|
|
218
|
+
</Drawer.Actions>
|
|
219
|
+
</Drawer>
|
|
220
|
+
<div className="n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16 w-full">
|
|
221
|
+
<div className="n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md">
|
|
222
|
+
<FilledButton
|
|
223
|
+
onClick={() => setIsExpanded(true)}
|
|
224
|
+
htmlAttributes={{
|
|
225
|
+
'aria-expanded': isExpanded,
|
|
226
|
+
}}
|
|
227
|
+
ref={referenceElement}
|
|
228
|
+
>
|
|
229
|
+
Press to show the Drawer
|
|
230
|
+
</FilledButton>
|
|
231
|
+
</div>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
);
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
export default Component;
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Portaled
|
|
241
|
+
|
|
242
|
+
```tsx
|
|
243
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
244
|
+
|
|
245
|
+
import { Drawer, DropdownButton, FilledButton, Menu } from '@neo4j-ndl/react';
|
|
246
|
+
import { useRef, useState } from 'react';
|
|
247
|
+
|
|
248
|
+
const Component = () => {
|
|
249
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
250
|
+
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
251
|
+
const anchorRef = useRef<HTMLButtonElement | null>(null);
|
|
252
|
+
const referenceElementRef = useRef<HTMLButtonElement | null>(null);
|
|
253
|
+
|
|
254
|
+
return (
|
|
255
|
+
<div className="n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden">
|
|
256
|
+
<Drawer
|
|
257
|
+
type="modal"
|
|
258
|
+
isExpanded={isExpanded}
|
|
259
|
+
onExpandedChange={() => setIsExpanded(false)}
|
|
260
|
+
position="left"
|
|
261
|
+
closeOnEscape={true}
|
|
262
|
+
ariaLabel="Drawer"
|
|
263
|
+
htmlAttributes={{
|
|
264
|
+
id: 'drawer',
|
|
265
|
+
}}
|
|
266
|
+
>
|
|
267
|
+
<Drawer.Header>Drawer</Drawer.Header>
|
|
268
|
+
<Drawer.Body>
|
|
269
|
+
Lorem ipsum dolor sit amet.{' '}
|
|
270
|
+
<DropdownButton ref={anchorRef} onClick={() => setIsMenuOpen(true)}>
|
|
271
|
+
Dropdown Button
|
|
272
|
+
</DropdownButton>
|
|
273
|
+
<Menu
|
|
274
|
+
strategy="fixed"
|
|
275
|
+
portalTarget={document.getElementById('drawer')}
|
|
276
|
+
anchorRef={anchorRef}
|
|
277
|
+
isOpen={isMenuOpen}
|
|
278
|
+
onClose={(_event) => {
|
|
279
|
+
setIsMenuOpen(false);
|
|
280
|
+
}}
|
|
281
|
+
>
|
|
282
|
+
<Menu.Item title="Menu Item 1" />
|
|
283
|
+
<Menu.Item title="Menu Item 2" />
|
|
284
|
+
<Menu.Item title="Menu Item 3" />
|
|
285
|
+
</Menu>
|
|
286
|
+
</Drawer.Body>
|
|
287
|
+
<Drawer.Actions>
|
|
288
|
+
<FilledButton onClick={() => setIsExpanded(false)} size="medium">
|
|
289
|
+
Close
|
|
290
|
+
</FilledButton>
|
|
291
|
+
</Drawer.Actions>
|
|
292
|
+
</Drawer>
|
|
293
|
+
<div className="n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16 w-full">
|
|
294
|
+
<div className="n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md">
|
|
295
|
+
<FilledButton
|
|
296
|
+
onClick={() => setIsExpanded(true)}
|
|
297
|
+
htmlAttributes={{
|
|
298
|
+
'aria-expanded': isExpanded,
|
|
299
|
+
}}
|
|
300
|
+
ref={referenceElementRef}
|
|
301
|
+
>
|
|
302
|
+
Press to show the Drawer
|
|
303
|
+
</FilledButton>
|
|
304
|
+
</div>
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
);
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
export default Component;
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Push
|
|
314
|
+
|
|
315
|
+
```tsx
|
|
316
|
+
import { Drawer, FilledButton } from '@neo4j-ndl/react';
|
|
317
|
+
import { useState } from 'react';
|
|
318
|
+
|
|
319
|
+
const Component = () => {
|
|
320
|
+
const [isExpanded, setIsExpanded] = useState(true);
|
|
321
|
+
|
|
322
|
+
const Placeholder = () => (
|
|
323
|
+
<div className="n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16 w-full">
|
|
324
|
+
<div className="n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md">
|
|
325
|
+
<FilledButton
|
|
326
|
+
onClick={() => setIsExpanded(true)}
|
|
327
|
+
htmlAttributes={{
|
|
328
|
+
'aria-expanded': isExpanded,
|
|
329
|
+
}}
|
|
330
|
+
>
|
|
331
|
+
Press to show the Drawer
|
|
332
|
+
</FilledButton>
|
|
333
|
+
</div>
|
|
334
|
+
</div>
|
|
335
|
+
);
|
|
336
|
+
|
|
337
|
+
return (
|
|
338
|
+
<div className="n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden">
|
|
339
|
+
<Drawer
|
|
340
|
+
type="push"
|
|
341
|
+
isExpanded={isExpanded}
|
|
342
|
+
onExpandedChange={() => setIsExpanded(false)}
|
|
343
|
+
>
|
|
344
|
+
<Drawer.Header>Drawer</Drawer.Header>
|
|
345
|
+
<Drawer.Body>Lorem ipsum dolor sit amet.</Drawer.Body>
|
|
346
|
+
<Drawer.Actions>
|
|
347
|
+
<FilledButton onClick={() => setIsExpanded(false)} size="medium">
|
|
348
|
+
Close
|
|
349
|
+
</FilledButton>
|
|
350
|
+
</Drawer.Actions>
|
|
351
|
+
</Drawer>
|
|
352
|
+
<Placeholder />
|
|
353
|
+
</div>
|
|
354
|
+
);
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
export default Component;
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Resizable
|
|
361
|
+
|
|
362
|
+
```tsx
|
|
363
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
364
|
+
|
|
365
|
+
import { Drawer, FilledButton } from '@neo4j-ndl/react';
|
|
366
|
+
import { useState } from 'react';
|
|
367
|
+
|
|
368
|
+
const Component = () => {
|
|
369
|
+
const [isExpanded, setIsExpanded] = useState(true);
|
|
370
|
+
|
|
371
|
+
const Placeholder = () => (
|
|
372
|
+
<div className="n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16 w-full">
|
|
373
|
+
<div className="n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md">
|
|
374
|
+
<FilledButton
|
|
375
|
+
onClick={() => setIsExpanded(true)}
|
|
376
|
+
htmlAttributes={{
|
|
377
|
+
'aria-expanded': isExpanded,
|
|
378
|
+
}}
|
|
379
|
+
>
|
|
380
|
+
Press to show the Drawer
|
|
381
|
+
</FilledButton>
|
|
382
|
+
</div>
|
|
383
|
+
</div>
|
|
384
|
+
);
|
|
385
|
+
|
|
386
|
+
return (
|
|
387
|
+
<div className="n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden">
|
|
388
|
+
<Drawer
|
|
389
|
+
type="push"
|
|
390
|
+
isExpanded={isExpanded}
|
|
391
|
+
onExpandedChange={() => setIsExpanded(false)}
|
|
392
|
+
position="left"
|
|
393
|
+
isResizeable={true}
|
|
394
|
+
resizeableProps={{
|
|
395
|
+
maxWidth: '400px',
|
|
396
|
+
minWidth: '300px',
|
|
397
|
+
}}
|
|
398
|
+
>
|
|
399
|
+
<Drawer.Header>Drawer</Drawer.Header>
|
|
400
|
+
<Drawer.Body>Lorem ipsum dolor sit amet.</Drawer.Body>
|
|
401
|
+
<Drawer.Actions>
|
|
402
|
+
<FilledButton onClick={() => setIsExpanded(false)} size="medium">
|
|
403
|
+
Close
|
|
404
|
+
</FilledButton>
|
|
405
|
+
</Drawer.Actions>
|
|
406
|
+
</Drawer>
|
|
407
|
+
<Placeholder />
|
|
408
|
+
</div>
|
|
409
|
+
);
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
export default Component;
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
### Right Side
|
|
416
|
+
|
|
417
|
+
```tsx
|
|
418
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
419
|
+
|
|
420
|
+
import { Drawer, FilledButton } from '@neo4j-ndl/react';
|
|
421
|
+
import { useState } from 'react';
|
|
422
|
+
|
|
423
|
+
const Component = () => {
|
|
424
|
+
const [isExpanded, setIsExpanded] = useState(true);
|
|
425
|
+
|
|
426
|
+
const Placeholder = () => (
|
|
427
|
+
<div className="n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16 w-full">
|
|
428
|
+
<div className="n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md">
|
|
429
|
+
<FilledButton
|
|
430
|
+
onClick={() => setIsExpanded(true)}
|
|
431
|
+
htmlAttributes={{
|
|
432
|
+
'aria-expanded': isExpanded,
|
|
433
|
+
}}
|
|
434
|
+
>
|
|
435
|
+
Press to show the Drawer
|
|
436
|
+
</FilledButton>
|
|
437
|
+
</div>
|
|
438
|
+
</div>
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
return (
|
|
442
|
+
<div className="n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden">
|
|
443
|
+
<Placeholder />
|
|
444
|
+
<Drawer
|
|
445
|
+
type="push"
|
|
446
|
+
isExpanded={isExpanded}
|
|
447
|
+
onExpandedChange={() => setIsExpanded(false)}
|
|
448
|
+
position="right"
|
|
449
|
+
>
|
|
450
|
+
<Drawer.Header>Drawer</Drawer.Header>
|
|
451
|
+
<Drawer.Body>Lorem ipsum dolor sit amet.</Drawer.Body>
|
|
452
|
+
<Drawer.Actions>
|
|
453
|
+
<FilledButton onClick={() => setIsExpanded(false)} size="medium">
|
|
454
|
+
Close
|
|
455
|
+
</FilledButton>
|
|
456
|
+
</Drawer.Actions>
|
|
457
|
+
</Drawer>
|
|
458
|
+
</div>
|
|
459
|
+
);
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
export default Component;
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### Scrollable
|
|
466
|
+
|
|
467
|
+
```tsx
|
|
468
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
469
|
+
|
|
470
|
+
import { Checkbox, Drawer, FilledButton, TextInput } from '@neo4j-ndl/react';
|
|
471
|
+
import { useState } from 'react';
|
|
472
|
+
|
|
473
|
+
const Component = () => {
|
|
474
|
+
const [isExpanded, setIsExpanded] = useState(true);
|
|
475
|
+
|
|
476
|
+
const Placeholder = () => (
|
|
477
|
+
<div className="w-full n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16">
|
|
478
|
+
<div className="n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md">
|
|
479
|
+
<FilledButton
|
|
480
|
+
onClick={() => setIsExpanded(true)}
|
|
481
|
+
htmlAttributes={{
|
|
482
|
+
'aria-expanded': isExpanded,
|
|
483
|
+
}}
|
|
484
|
+
>
|
|
485
|
+
Press to show the Drawer
|
|
486
|
+
</FilledButton>
|
|
487
|
+
</div>
|
|
488
|
+
</div>
|
|
489
|
+
);
|
|
490
|
+
|
|
491
|
+
return (
|
|
492
|
+
<div className="n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden">
|
|
493
|
+
<Drawer
|
|
494
|
+
type="push"
|
|
495
|
+
isExpanded={isExpanded}
|
|
496
|
+
onExpandedChange={() => setIsExpanded(false)}
|
|
497
|
+
>
|
|
498
|
+
<Drawer.Header>Drawer</Drawer.Header>
|
|
499
|
+
<Drawer.Body>
|
|
500
|
+
<TextInput
|
|
501
|
+
showRequiredOrOptionalLabel={true}
|
|
502
|
+
moreInformationText="some information"
|
|
503
|
+
label="Label"
|
|
504
|
+
isDisabled={false}
|
|
505
|
+
isReadOnly={false}
|
|
506
|
+
helpText="Friendly text"
|
|
507
|
+
isFluid={true}
|
|
508
|
+
/>
|
|
509
|
+
<br />
|
|
510
|
+
<TextInput label="Some input" value="something" />
|
|
511
|
+
<br />
|
|
512
|
+
<Checkbox label="Checkbox label" />
|
|
513
|
+
<br />
|
|
514
|
+
Some example of something.
|
|
515
|
+
<br />
|
|
516
|
+
<TextInput label="Some input" isDisabled={true} value="something" />
|
|
517
|
+
<br />
|
|
518
|
+
<TextInput
|
|
519
|
+
showRequiredOrOptionalLabel={true}
|
|
520
|
+
moreInformationText="some information"
|
|
521
|
+
label="Label"
|
|
522
|
+
isDisabled={false}
|
|
523
|
+
isReadOnly={false}
|
|
524
|
+
helpText="Friendly text"
|
|
525
|
+
isFluid={true}
|
|
526
|
+
/>
|
|
527
|
+
<br />
|
|
528
|
+
Some example of something.
|
|
529
|
+
<br />
|
|
530
|
+
<TextInput label="Some input" value="something" />
|
|
531
|
+
<br />
|
|
532
|
+
<Checkbox label="Checkbox label" />
|
|
533
|
+
<br />
|
|
534
|
+
<TextInput label="Some input" value="something" />
|
|
535
|
+
</Drawer.Body>
|
|
536
|
+
</Drawer>
|
|
537
|
+
<Placeholder />
|
|
538
|
+
</div>
|
|
539
|
+
);
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
export default Component;
|
|
543
|
+
```
|