@neo4j-ndl/react 4.16.7 → 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/lib/cjs/color-picker/ColorPicker.js +3 -1
- package/lib/cjs/color-picker/ColorPicker.js.map +1 -1
- package/lib/cjs/color-picker/stories/color-picker-dialog.story.js +40 -0
- package/lib/cjs/color-picker/stories/color-picker-dialog.story.js.map +1 -0
- package/lib/cjs/color-picker/stories/color-picker-popover.story.js +32 -0
- package/lib/cjs/color-picker/stories/color-picker-popover.story.js.map +1 -0
- package/lib/cjs/color-picker/stories/index.js +9 -1
- package/lib/cjs/color-picker/stories/index.js.map +1 -1
- package/lib/cjs/popover/use-popover.js +1 -1
- package/lib/cjs/popover/use-popover.js.map +1 -1
- package/lib/cjs/select/Select.js +2 -0
- package/lib/cjs/select/Select.js.map +1 -1
- package/lib/esm/color-picker/ColorPicker.js +3 -1
- package/lib/esm/color-picker/ColorPicker.js.map +1 -1
- package/lib/esm/color-picker/stories/color-picker-dialog.story.js +38 -0
- package/lib/esm/color-picker/stories/color-picker-dialog.story.js.map +1 -0
- package/lib/esm/color-picker/stories/color-picker-popover.story.js +30 -0
- package/lib/esm/color-picker/stories/color-picker-popover.story.js.map +1 -0
- package/lib/esm/color-picker/stories/index.js +6 -0
- package/lib/esm/color-picker/stories/index.js.map +1 -1
- package/lib/esm/popover/use-popover.js +1 -1
- package/lib/esm/popover/use-popover.js.map +1 -1
- package/lib/esm/select/Select.js +2 -0
- package/lib/esm/select/Select.js.map +1 -1
- package/lib/types/color-picker/ColorPicker.d.ts +4 -0
- package/lib/types/color-picker/ColorPicker.d.ts.map +1 -1
- package/lib/types/color-picker/stories/color-picker-dialog.story.d.ts +24 -0
- package/lib/types/color-picker/stories/color-picker-dialog.story.d.ts.map +1 -0
- package/lib/types/color-picker/stories/color-picker-popover.story.d.ts +24 -0
- package/lib/types/color-picker/stories/color-picker-popover.story.d.ts.map +1 -0
- package/lib/types/color-picker/stories/index.d.ts +4 -0
- package/lib/types/color-picker/stories/index.d.ts.map +1 -1
- package/lib/types/select/Select.d.ts.map +1 -1
- 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,269 @@
|
|
|
1
|
+
# Checkbox
|
|
2
|
+
|
|
3
|
+
Import: `import { Checkbox } from '@neo4j-ndl/react'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### Checkbox
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Required | Default | Description |
|
|
10
|
+
|------|------|----------|---------|-------------|
|
|
11
|
+
| `ariaLabel` | `string` | | | The aria label of the checkbox. Required if the label is not a string. |
|
|
12
|
+
| `hasLeadingLabel` | `boolean` | | | Whether the label should be displayed before the checkbox |
|
|
13
|
+
| `isChecked` | `boolean` | | | Whether the checkbox is checked |
|
|
14
|
+
| `isDefaultChecked` | `boolean` | | | Checks the input by default in uncontrolled mode |
|
|
15
|
+
| `isDisabled` | `boolean` | | `false` | Whether the checkbox is disabled |
|
|
16
|
+
| `isFluid` | `boolean` | | `false` | Whether the checkbox & label should take the full available width of its container |
|
|
17
|
+
| `isIndeterminate` | `boolean` | | `false` | Whether the checkbox is indeterminate |
|
|
18
|
+
| `label` | `ReactNode` | | | The label of the checkbox. If not a string, supply an aria label for screen reader support. |
|
|
19
|
+
| `onChange` | `((event: ChangeEvent<HTMLInputElement, Element>) => void)` | | | The callback function triggered when the checkbox value changes |
|
|
20
|
+
| `onClick` | `((event: MouseEvent<HTMLInputElement, MouseEvent>) => void)` | | | The callback function triggered when the checkbox is clicked |
|
|
21
|
+
| `ref` | `Ref<HTMLInputElement>` | | | A ref to apply to the root element. |
|
|
22
|
+
| `value` | `string \| number \| readonly string[]` | | | The value of the checkbox |
|
|
23
|
+
|
|
24
|
+
## Accessibility
|
|
25
|
+
|
|
26
|
+
## Implementation guidelines
|
|
27
|
+
|
|
28
|
+
The Checkbox component uses implicit label wrapping to associate the visible label with the input for screen readers. If you omit the label prop or use an invalid label (no text content), the `ariaLabel` prop will be required to ensure an accessible name.
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
### Default
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
36
|
+
|
|
37
|
+
import { Checkbox } from '@neo4j-ndl/react';
|
|
38
|
+
|
|
39
|
+
const Component = () => {
|
|
40
|
+
return <Checkbox label="Uncontrolled checkbox" />;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default Component;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Controlled
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
50
|
+
|
|
51
|
+
import { Checkbox } from '@neo4j-ndl/react';
|
|
52
|
+
import { useState } from 'react';
|
|
53
|
+
|
|
54
|
+
const Component = () => {
|
|
55
|
+
const [isChecked, setIsChecked] = useState(false);
|
|
56
|
+
return (
|
|
57
|
+
<Checkbox
|
|
58
|
+
isChecked={isChecked}
|
|
59
|
+
onChange={(event) => setIsChecked(event.target.checked)}
|
|
60
|
+
label="Controlled checkbox"
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default Component;
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Disabled
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
72
|
+
|
|
73
|
+
import { Checkbox } from '@neo4j-ndl/react';
|
|
74
|
+
|
|
75
|
+
const Component = () => {
|
|
76
|
+
return <Checkbox label="Checkbox label" isDisabled />;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export default Component;
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Fluid
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
86
|
+
|
|
87
|
+
import { Checkbox } from '@neo4j-ndl/react';
|
|
88
|
+
|
|
89
|
+
const Component = () => {
|
|
90
|
+
return <Checkbox isFluid />;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export default Component;
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Full
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
100
|
+
|
|
101
|
+
import { Checkbox } from '@neo4j-ndl/react';
|
|
102
|
+
import { useState } from 'react';
|
|
103
|
+
|
|
104
|
+
const Component = () => {
|
|
105
|
+
const [childCheckboxes, setChildCheckboxes] = useState({
|
|
106
|
+
childOne: false,
|
|
107
|
+
childThree: true,
|
|
108
|
+
childTwo: false,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const handleParentCheckboxChange = (
|
|
112
|
+
event: React.ChangeEvent<HTMLInputElement>,
|
|
113
|
+
) => {
|
|
114
|
+
const isChecked = event.target.checked;
|
|
115
|
+
|
|
116
|
+
// Update child checkboxes based on parent checkbox state.
|
|
117
|
+
setChildCheckboxes({
|
|
118
|
+
childOne: isChecked,
|
|
119
|
+
childThree: isChecked,
|
|
120
|
+
childTwo: isChecked,
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const handleChildCheckboxChange = (
|
|
125
|
+
childKey: keyof typeof childCheckboxes,
|
|
126
|
+
) => {
|
|
127
|
+
// Set currently clicked child checkbox.
|
|
128
|
+
setChildCheckboxes((prevState) => ({
|
|
129
|
+
...prevState,
|
|
130
|
+
[childKey]: !prevState[childKey],
|
|
131
|
+
}));
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const isParentChecked = Object.values(childCheckboxes).every(
|
|
135
|
+
(isChildChecked) => isChildChecked,
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
const isParentIndeterminate =
|
|
139
|
+
Object.values(childCheckboxes).some((isChildChecked) => isChildChecked) &&
|
|
140
|
+
!isParentChecked;
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
<div className="n-flex n-flex-col n-items-start n-gap-1">
|
|
144
|
+
<Checkbox
|
|
145
|
+
isChecked={isParentChecked}
|
|
146
|
+
isIndeterminate={isParentIndeterminate}
|
|
147
|
+
label="Parent checkbox"
|
|
148
|
+
onChange={(event) => {
|
|
149
|
+
handleParentCheckboxChange(event);
|
|
150
|
+
}}
|
|
151
|
+
/>
|
|
152
|
+
<Checkbox
|
|
153
|
+
className="n-ml-7"
|
|
154
|
+
isChecked={childCheckboxes.childOne}
|
|
155
|
+
label="Child checkbox 1"
|
|
156
|
+
onChange={() => handleChildCheckboxChange('childOne')}
|
|
157
|
+
/>
|
|
158
|
+
<Checkbox
|
|
159
|
+
className="n-ml-7"
|
|
160
|
+
isChecked={childCheckboxes.childTwo}
|
|
161
|
+
label="Child checkbox 2"
|
|
162
|
+
onChange={() => handleChildCheckboxChange('childTwo')}
|
|
163
|
+
/>
|
|
164
|
+
<Checkbox
|
|
165
|
+
className="n-ml-7"
|
|
166
|
+
isChecked={childCheckboxes.childThree}
|
|
167
|
+
label="Child checkbox 3"
|
|
168
|
+
onChange={() => handleChildCheckboxChange('childThree')}
|
|
169
|
+
/>
|
|
170
|
+
</div>
|
|
171
|
+
);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export default Component;
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Has Label Before
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
181
|
+
|
|
182
|
+
import { Checkbox } from '@neo4j-ndl/react';
|
|
183
|
+
|
|
184
|
+
const Component = () => {
|
|
185
|
+
return <Checkbox label="Checkbox label" hasLeadingLabel />;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export default Component;
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Indeterminate
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
195
|
+
|
|
196
|
+
import { Checkbox, FilledButton } from '@neo4j-ndl/react';
|
|
197
|
+
import { useState } from 'react';
|
|
198
|
+
|
|
199
|
+
const Component = () => {
|
|
200
|
+
const [isChecked, setIsChecked] = useState(false);
|
|
201
|
+
const [isIndeterminate, setIsIndeterminate] = useState(true);
|
|
202
|
+
|
|
203
|
+
return (
|
|
204
|
+
<div
|
|
205
|
+
style={{
|
|
206
|
+
alignItems: 'center',
|
|
207
|
+
display: 'flex',
|
|
208
|
+
flexDirection: 'column',
|
|
209
|
+
gap: '10px',
|
|
210
|
+
}}
|
|
211
|
+
>
|
|
212
|
+
<Checkbox
|
|
213
|
+
isChecked={isChecked}
|
|
214
|
+
isIndeterminate={isIndeterminate}
|
|
215
|
+
onChange={(event) => {
|
|
216
|
+
setIsChecked(event.target.checked);
|
|
217
|
+
setIsIndeterminate(event.target.indeterminate);
|
|
218
|
+
}}
|
|
219
|
+
ariaLabel="Indeterminate checkbox"
|
|
220
|
+
/>
|
|
221
|
+
<div style={{ marginTop: '25px', width: '100%' }}>
|
|
222
|
+
<div>Checkbox checked state: {isChecked.toString()}</div>
|
|
223
|
+
<div>Checkbox indeterminate state: {isIndeterminate.toString()}</div>
|
|
224
|
+
</div>
|
|
225
|
+
<div>
|
|
226
|
+
<FilledButton onClick={() => setIsChecked((prev: boolean) => !prev)}>
|
|
227
|
+
Toggle checked
|
|
228
|
+
</FilledButton>
|
|
229
|
+
<FilledButton
|
|
230
|
+
onClick={() => setIsIndeterminate((prev: boolean) => !prev)}
|
|
231
|
+
style={{ marginLeft: '10px' }}
|
|
232
|
+
>
|
|
233
|
+
Toggle indeterminate
|
|
234
|
+
</FilledButton>
|
|
235
|
+
</div>
|
|
236
|
+
</div>
|
|
237
|
+
);
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export default Component;
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Label Before
|
|
244
|
+
|
|
245
|
+
```tsx
|
|
246
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
247
|
+
|
|
248
|
+
import { Checkbox } from '@neo4j-ndl/react';
|
|
249
|
+
|
|
250
|
+
const Component = () => {
|
|
251
|
+
return <Checkbox hasLeadingLabel label="Label" />;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export default Component;
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### No Label
|
|
258
|
+
|
|
259
|
+
```tsx
|
|
260
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
261
|
+
|
|
262
|
+
import { Checkbox } from '@neo4j-ndl/react';
|
|
263
|
+
|
|
264
|
+
const Component = () => {
|
|
265
|
+
return <Checkbox ariaLabel="no-label-provided" />;
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
export default Component;
|
|
269
|
+
```
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
# CleanIconButton
|
|
2
|
+
|
|
3
|
+
Import: `import { CleanIconButton } from '@neo4j-ndl/react'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### CleanIconButton
|
|
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` | | | |
|
|
13
|
+
| `description` | `string \| null` | ✅ | | A string that will be shown as a tooltip when hovering over the button it also acts as an aria-label- {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label} |
|
|
14
|
+
| `descriptionKbdProps` | `(KbdProps & { as?: ElementType<any, keyof IntrinsicElements>; } & BaseProps<ElementType<any, keyof IntrinsicElements>>)` | | | The Kbd components that will be displayed in the tooltip after the description text, this does not include the keyboard shortcut functionality this only displays the Kbd components. |
|
|
15
|
+
| `isActive` | `boolean` | | | Active - used for open context menus for example |
|
|
16
|
+
| `isDisabled` | `boolean` | | `false` | If the icon button is in disabled state |
|
|
17
|
+
| `isLoading` | `boolean` | | `false` | If the button is doing something Async, it will display a loading spinner |
|
|
18
|
+
| `loadingMessage` | `string` | | | Accessible message for screen readers when the button is in a loading state |
|
|
19
|
+
| `onClick` | `((e: MouseEvent<HTMLButtonElement, MouseEvent>) => void)` | | | Click handler |
|
|
20
|
+
| `ref` | `any` | | | A ref to apply to the root element. |
|
|
21
|
+
| `size` | `'large' \| 'medium' \| 'small'` | | `medium` | Size of button |
|
|
22
|
+
| `tooltipProps` | `TooltipObjectProps` | | | Props for the tooltip component. |
|
|
23
|
+
| `variant` | `'danger' \| 'neutral'` | | `neutral` | Variant of the button |
|
|
24
|
+
|
|
25
|
+
## Accessibility
|
|
26
|
+
|
|
27
|
+
## Implementation guidelines
|
|
28
|
+
|
|
29
|
+
A CleanIconButton must have the `tooltip` prop set for it to be accessible. The tooltip text is used as the aria-label for screen readers. CleanIconButtons are interactive elements that allow users to trigger actions with either `Space` or `Enter`. Try to avoid disabling buttons since they are removed from the accessibility tree. Instead, give the user feedback on the action.
|
|
30
|
+
|
|
31
|
+
## Examples
|
|
32
|
+
|
|
33
|
+
### Default
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
37
|
+
|
|
38
|
+
import { CleanIconButton } from '@neo4j-ndl/react';
|
|
39
|
+
import { MagnifyingGlassIconOutline } from '@neo4j-ndl/react/icons';
|
|
40
|
+
|
|
41
|
+
const Component = () => {
|
|
42
|
+
return (
|
|
43
|
+
<CleanIconButton description="Search">
|
|
44
|
+
<MagnifyingGlassIconOutline />
|
|
45
|
+
</CleanIconButton>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default Component;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Active
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
56
|
+
|
|
57
|
+
import { CleanIconButton } from '@neo4j-ndl/react';
|
|
58
|
+
import { MagnifyingGlassIconOutline } from '@neo4j-ndl/react/icons';
|
|
59
|
+
|
|
60
|
+
const Component = () => {
|
|
61
|
+
return (
|
|
62
|
+
<CleanIconButton description="Search" isActive>
|
|
63
|
+
<MagnifyingGlassIconOutline />
|
|
64
|
+
</CleanIconButton>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default Component;
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### All
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
75
|
+
|
|
76
|
+
import { IconButton, Typography } from '@neo4j-ndl/react';
|
|
77
|
+
import { ArrowDownTrayIconOutline } from '@neo4j-ndl/react/icons';
|
|
78
|
+
|
|
79
|
+
const Component = () => {
|
|
80
|
+
return (
|
|
81
|
+
<div className="n-grid n-grid-cols-[auto_auto_auto_auto] n-gap-token-32 n-place-items-center n-w-fit">
|
|
82
|
+
{/* size row */}
|
|
83
|
+
<Typography variant="subheading-small" className="n-justify-self-end">
|
|
84
|
+
Size
|
|
85
|
+
</Typography>
|
|
86
|
+
<IconButton description="Size example" size="small">
|
|
87
|
+
Small
|
|
88
|
+
</IconButton>
|
|
89
|
+
<IconButton description="Size example" size="medium">
|
|
90
|
+
Medium
|
|
91
|
+
</IconButton>
|
|
92
|
+
<IconButton description="Size example" size="large">
|
|
93
|
+
Large
|
|
94
|
+
</IconButton>
|
|
95
|
+
|
|
96
|
+
{/* tone row */}
|
|
97
|
+
<Typography variant="subheading-small" className="n-justify-self-end">
|
|
98
|
+
Tone
|
|
99
|
+
</Typography>
|
|
100
|
+
<IconButton description="Grouped example" tone="default">
|
|
101
|
+
<ArrowDownTrayIconOutline />
|
|
102
|
+
</IconButton>
|
|
103
|
+
<IconButton description="Grouped example" tone="danger">
|
|
104
|
+
<ArrowDownTrayIconOutline />
|
|
105
|
+
</IconButton>
|
|
106
|
+
<div></div>
|
|
107
|
+
<div></div>
|
|
108
|
+
|
|
109
|
+
{/* isDisabled Row */}
|
|
110
|
+
<Typography variant="subheading-small" className="n-justify-self-end">
|
|
111
|
+
Disabled
|
|
112
|
+
</Typography>
|
|
113
|
+
<IconButton description="Disabled example" isDisabled>
|
|
114
|
+
<ArrowDownTrayIconOutline />
|
|
115
|
+
</IconButton>
|
|
116
|
+
<div></div>
|
|
117
|
+
<div></div>
|
|
118
|
+
|
|
119
|
+
{/* isLoading Row */}
|
|
120
|
+
<Typography variant="subheading-small" className="n-justify-self-end">
|
|
121
|
+
Loading
|
|
122
|
+
</Typography>
|
|
123
|
+
<IconButton description="Loading example" isLoading>
|
|
124
|
+
<ArrowDownTrayIconOutline />
|
|
125
|
+
</IconButton>
|
|
126
|
+
<div></div>
|
|
127
|
+
<div></div>
|
|
128
|
+
|
|
129
|
+
{/* isFloating row */}
|
|
130
|
+
<Typography variant="subheading-small" className="n-justify-self-end">
|
|
131
|
+
Floating
|
|
132
|
+
</Typography>
|
|
133
|
+
<IconButton description="Floating example" isFloating>
|
|
134
|
+
<ArrowDownTrayIconOutline />
|
|
135
|
+
</IconButton>
|
|
136
|
+
<div></div>
|
|
137
|
+
<div></div>
|
|
138
|
+
|
|
139
|
+
{/* isGrouped row */}
|
|
140
|
+
<Typography variant="subheading-small" className="n-justify-self-end">
|
|
141
|
+
Grouped
|
|
142
|
+
</Typography>
|
|
143
|
+
<IconButton description="Grouped example" isGrouped>
|
|
144
|
+
<ArrowDownTrayIconOutline />
|
|
145
|
+
</IconButton>
|
|
146
|
+
<div></div>
|
|
147
|
+
<div></div>
|
|
148
|
+
|
|
149
|
+
{/* isActive row */}
|
|
150
|
+
<Typography variant="subheading-small" className="n-justify-self-end">
|
|
151
|
+
Active
|
|
152
|
+
</Typography>
|
|
153
|
+
<IconButton description="Active example" isActive>
|
|
154
|
+
<ArrowDownTrayIconOutline />
|
|
155
|
+
</IconButton>
|
|
156
|
+
<div></div>
|
|
157
|
+
<div></div>
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export default Component;
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Disabled
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
169
|
+
|
|
170
|
+
import { CleanIconButton } from '@neo4j-ndl/react';
|
|
171
|
+
import { MagnifyingGlassIconOutline } from '@neo4j-ndl/react/icons';
|
|
172
|
+
|
|
173
|
+
const Component = () => {
|
|
174
|
+
return (
|
|
175
|
+
<CleanIconButton description="Search" isDisabled>
|
|
176
|
+
<MagnifyingGlassIconOutline />
|
|
177
|
+
</CleanIconButton>
|
|
178
|
+
);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export default Component;
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Keyboard Display
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
188
|
+
|
|
189
|
+
import { CleanIconButton } from '@neo4j-ndl/react';
|
|
190
|
+
import { MagnifyingGlassIconOutline } from '@neo4j-ndl/react/icons';
|
|
191
|
+
|
|
192
|
+
const Component = () => {
|
|
193
|
+
return (
|
|
194
|
+
<div className="n-flex n-flex-col n-gap-token-16">
|
|
195
|
+
<div className="n-flex n-flex-row n-gap-token-16 n-items-center">
|
|
196
|
+
<CleanIconButton
|
|
197
|
+
description="Search"
|
|
198
|
+
descriptionKbdProps={{ keys: ['B'], modifierKeys: ['meta'] }}
|
|
199
|
+
variant="neutral"
|
|
200
|
+
>
|
|
201
|
+
<MagnifyingGlassIconOutline />
|
|
202
|
+
</CleanIconButton>
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export default Component;
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Loading
|
|
212
|
+
|
|
213
|
+
```tsx
|
|
214
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
215
|
+
|
|
216
|
+
import { CleanIconButton } from '@neo4j-ndl/react';
|
|
217
|
+
import { MagnifyingGlassIconOutline } from '@neo4j-ndl/react/icons';
|
|
218
|
+
|
|
219
|
+
const Component = () => {
|
|
220
|
+
return (
|
|
221
|
+
<CleanIconButton description="Search" isLoading loadingMessage="Loading">
|
|
222
|
+
<MagnifyingGlassIconOutline />
|
|
223
|
+
</CleanIconButton>
|
|
224
|
+
);
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export default Component;
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Sizes
|
|
231
|
+
|
|
232
|
+
```tsx
|
|
233
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
234
|
+
|
|
235
|
+
import { CleanIconButton, Typography } from '@neo4j-ndl/react';
|
|
236
|
+
import { MagnifyingGlassIconOutline } from '@neo4j-ndl/react/icons';
|
|
237
|
+
|
|
238
|
+
const Component = () => {
|
|
239
|
+
return (
|
|
240
|
+
<div className="n-flex n-flex-col n-gap-token-16">
|
|
241
|
+
<div className="n-flex n-flex-row n-gap-token-16 n-items-center">
|
|
242
|
+
<CleanIconButton description="Search" size="small">
|
|
243
|
+
<MagnifyingGlassIconOutline />
|
|
244
|
+
</CleanIconButton>
|
|
245
|
+
<Typography variant="label"> Small</Typography>
|
|
246
|
+
</div>
|
|
247
|
+
<div className="n-flex n-flex-row n-gap-token-16 n-items-center">
|
|
248
|
+
<CleanIconButton description="Search" size="medium">
|
|
249
|
+
<MagnifyingGlassIconOutline />
|
|
250
|
+
</CleanIconButton>
|
|
251
|
+
<Typography variant="label"> Medium</Typography>
|
|
252
|
+
</div>
|
|
253
|
+
<div className="n-flex n-flex-row n-gap-token-16 n-items-center">
|
|
254
|
+
<CleanIconButton description="Search" size="large">
|
|
255
|
+
<MagnifyingGlassIconOutline />
|
|
256
|
+
</CleanIconButton>
|
|
257
|
+
<Typography variant="label"> Large</Typography>
|
|
258
|
+
</div>
|
|
259
|
+
</div>
|
|
260
|
+
);
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export default Component;
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Tone
|
|
267
|
+
|
|
268
|
+
```tsx
|
|
269
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
270
|
+
|
|
271
|
+
import { CleanIconButton, Typography } from '@neo4j-ndl/react';
|
|
272
|
+
import { MagnifyingGlassIconOutline } from '@neo4j-ndl/react/icons';
|
|
273
|
+
|
|
274
|
+
const Component = () => {
|
|
275
|
+
return (
|
|
276
|
+
<div className="n-flex n-flex-col n-gap-token-16">
|
|
277
|
+
<div className="n-flex n-flex-row n-gap-token-16 n-items-center">
|
|
278
|
+
<CleanIconButton description="Search" variant="neutral">
|
|
279
|
+
<MagnifyingGlassIconOutline />
|
|
280
|
+
</CleanIconButton>
|
|
281
|
+
<Typography variant="label">Default</Typography>
|
|
282
|
+
</div>
|
|
283
|
+
<div className="n-flex n-flex-row n-gap-token-16 n-items-center">
|
|
284
|
+
<CleanIconButton description="Search" variant="danger">
|
|
285
|
+
<MagnifyingGlassIconOutline />
|
|
286
|
+
</CleanIconButton>
|
|
287
|
+
<Typography variant="label">Danger</Typography>
|
|
288
|
+
</div>
|
|
289
|
+
</div>
|
|
290
|
+
);
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
export default Component;
|
|
294
|
+
```
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# ClipboardButton
|
|
2
|
+
|
|
3
|
+
Import: `import { ClipboardButton } from '@neo4j-ndl/react'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### ClipboardButton
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Required | Default | Description |
|
|
10
|
+
|------|------|----------|---------|-------------|
|
|
11
|
+
| `descriptionKbdProps` | `(KbdProps & { as?: ElementType<any, keyof IntrinsicElements>; } & BaseProps<ElementType<any, keyof IntrinsicElements>>)` | | | |
|
|
12
|
+
| `isDisabled` | `boolean` | | | |
|
|
13
|
+
| `size` | `'large' \| 'medium' \| 'small'` | | | |
|
|
14
|
+
| `textToCopy` | `string` | ✅ | | The text that should be set to users clipboard |
|
|
15
|
+
| `tooltipProps` | `Omit<TooltipProps, "children">` | | | |
|
|
16
|
+
| `type` | `'clean-icon-button' \| 'icon-button' \| 'outlined-button'` | | `clean-icon-button` | |
|
|
17
|
+
|
|
18
|
+
For more information of the `TooltipProps` type, see the Tooltip component documentation.
|
|
19
|
+
|
|
20
|
+
## Examples
|
|
21
|
+
|
|
22
|
+
### Default
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
26
|
+
|
|
27
|
+
import { ClipboardButton } from '@neo4j-ndl/react';
|
|
28
|
+
|
|
29
|
+
const Component = () => {
|
|
30
|
+
return <ClipboardButton textToCopy="This is the text to copy" />;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default Component;
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Disabled
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
40
|
+
|
|
41
|
+
import { ClipboardButton } from '@neo4j-ndl/react';
|
|
42
|
+
|
|
43
|
+
const Component = () => {
|
|
44
|
+
return (
|
|
45
|
+
<ClipboardButton textToCopy="This is the text to copy" isDisabled={true} />
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default Component;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Keyboard Shortcut
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
56
|
+
|
|
57
|
+
import { ClipboardButton } from '@neo4j-ndl/react';
|
|
58
|
+
|
|
59
|
+
const Component = () => {
|
|
60
|
+
return (
|
|
61
|
+
<ClipboardButton
|
|
62
|
+
textToCopy="This is the text to copy"
|
|
63
|
+
descriptionKbdProps={{
|
|
64
|
+
keys: ['c'],
|
|
65
|
+
modifierKeys: ['ctrl', 'shift'],
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default Component;
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Not Clean
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
78
|
+
|
|
79
|
+
import { ClipboardButton } from '@neo4j-ndl/react';
|
|
80
|
+
|
|
81
|
+
const Component = () => {
|
|
82
|
+
return (
|
|
83
|
+
<ClipboardButton textToCopy="This is the text to copy" type="icon-button" />
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export default Component;
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Not Icon Button
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
94
|
+
|
|
95
|
+
import { ClipboardButton } from '@neo4j-ndl/react';
|
|
96
|
+
|
|
97
|
+
const Component = () => {
|
|
98
|
+
return (
|
|
99
|
+
<ClipboardButton
|
|
100
|
+
type="outlined-button"
|
|
101
|
+
textToCopy="This is the text to copy"
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export default Component;
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Sizes
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
113
|
+
|
|
114
|
+
import { ClipboardButton } from '@neo4j-ndl/react';
|
|
115
|
+
|
|
116
|
+
const Component = () => {
|
|
117
|
+
return (
|
|
118
|
+
<div className="n-flex n-gap-token-16">
|
|
119
|
+
<ClipboardButton textToCopy="This is the text to copy" size="small" />
|
|
120
|
+
<ClipboardButton textToCopy="This is the text to copy" size="medium" />
|
|
121
|
+
<ClipboardButton textToCopy="This is the text to copy" size="large" />
|
|
122
|
+
</div>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export default Component;
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Tooltip
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
133
|
+
|
|
134
|
+
import { ClipboardButton } from '@neo4j-ndl/react';
|
|
135
|
+
|
|
136
|
+
const Component = () => {
|
|
137
|
+
return (
|
|
138
|
+
<ClipboardButton
|
|
139
|
+
textToCopy="This is the text to copy"
|
|
140
|
+
tooltipProps={{
|
|
141
|
+
hoverDelay: {
|
|
142
|
+
close: 100,
|
|
143
|
+
open: 100,
|
|
144
|
+
},
|
|
145
|
+
isInitialOpen: true,
|
|
146
|
+
placement: 'right',
|
|
147
|
+
type: 'simple',
|
|
148
|
+
}}
|
|
149
|
+
/>
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export default Component;
|
|
154
|
+
```
|