@delightui/components 0.1.105 → 0.1.107
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/README.md +104 -1
- package/dist/cjs/components/molecules/Modal/DemoModal.d.ts +8 -0
- package/dist/cjs/components/molecules/Modal/ModalContext/ModalContext.d.ts +41 -0
- package/dist/cjs/components/molecules/Modal/ModalContext/ModalContext.types.d.ts +87 -0
- package/dist/cjs/components/molecules/Modal/ModalContext/index.d.ts +3 -0
- package/dist/cjs/components/molecules/Modal/ModalContext/useModal.d.ts +34 -0
- package/dist/cjs/components/molecules/Modal/index.d.ts +2 -0
- package/dist/cjs/components/molecules/index.d.ts +2 -0
- package/dist/cjs/library.css +19 -6
- package/dist/cjs/library.js +3 -3
- package/dist/cjs/library.js.map +1 -1
- package/dist/esm/components/molecules/Modal/DemoModal.d.ts +8 -0
- package/dist/esm/components/molecules/Modal/ModalContext/ModalContext.d.ts +41 -0
- package/dist/esm/components/molecules/Modal/ModalContext/ModalContext.types.d.ts +87 -0
- package/dist/esm/components/molecules/Modal/ModalContext/index.d.ts +3 -0
- package/dist/esm/components/molecules/Modal/ModalContext/useModal.d.ts +34 -0
- package/dist/esm/components/molecules/Modal/index.d.ts +2 -0
- package/dist/esm/components/molecules/index.d.ts +2 -0
- package/dist/esm/library.css +19 -6
- package/dist/esm/library.js +3 -3
- package/dist/esm/library.js.map +1 -1
- package/dist/index.d.ts +108 -2
- package/docs/README.md +264 -0
- package/docs/components/atoms/ActionImage.md +119 -0
- package/docs/components/atoms/Button.md +197 -0
- package/docs/components/atoms/Checkbox.md +299 -0
- package/docs/components/atoms/CheckboxItem.md +314 -0
- package/docs/components/atoms/Chip.md +380 -0
- package/docs/components/atoms/CustomToggle.md +270 -0
- package/docs/components/atoms/Icon.md +365 -0
- package/docs/components/atoms/IconButton.md +407 -0
- package/docs/components/atoms/Image.md +448 -0
- package/docs/components/atoms/Input.md +430 -0
- package/docs/components/atoms/ListItem.md +502 -0
- package/docs/components/atoms/Password.md +472 -0
- package/docs/components/atoms/RadioButton.md +614 -0
- package/docs/components/atoms/RadioButtonItem.md +588 -0
- package/docs/components/atoms/ResponsiveComponent.md +612 -0
- package/docs/components/atoms/SelectListItem.md +609 -0
- package/docs/components/atoms/Slider.md +605 -0
- package/docs/components/atoms/Spinner.md +605 -0
- package/docs/components/atoms/Text.md +463 -0
- package/docs/components/atoms/TextArea.md +670 -0
- package/docs/components/atoms/ToastNotification.md +668 -0
- package/docs/components/atoms/Toggle.md +737 -0
- package/docs/components/atoms/ToggleButton.md +751 -0
- package/docs/components/atoms/Tooltip.md +391 -0
- package/docs/components/molecules/Accordion.md +440 -0
- package/docs/components/molecules/AccordionGroup.md +547 -0
- package/docs/components/molecules/ActionCard.md +546 -0
- package/docs/components/molecules/Breadcrumb.md +403 -0
- package/docs/components/molecules/Breadcrumbs.md +485 -0
- package/docs/components/molecules/ButtonGroup.md +383 -0
- package/docs/components/molecules/Card.md +298 -0
- package/docs/components/molecules/ChipInput.md +646 -0
- package/docs/components/molecules/ContextMenu.md +768 -0
- package/docs/components/molecules/CustomTimeSelector.md +116 -0
- package/docs/components/molecules/DatePicker.md +516 -0
- package/docs/components/molecules/DateTimeSelector.md +166 -0
- package/docs/components/molecules/FormField.md +312 -0
- package/docs/components/molecules/Grid.md +577 -0
- package/docs/components/molecules/GridItem.md +834 -0
- package/docs/components/molecules/GridList.md +244 -0
- package/docs/components/molecules/List.md +485 -0
- package/docs/components/molecules/Modal.md +470 -0
- package/docs/components/molecules/ModalFooter.md +702 -0
- package/docs/components/molecules/ModalHeader.md +756 -0
- package/docs/components/molecules/ModalProvider.md +205 -0
- package/docs/components/molecules/Nav.md +530 -0
- package/docs/components/molecules/NavItem.md +572 -0
- package/docs/components/molecules/NavLink.md +499 -0
- package/docs/components/molecules/Option.md +521 -0
- package/docs/components/molecules/Pagination.md +592 -0
- package/docs/components/molecules/PaginationNumberField.md +722 -0
- package/docs/components/molecules/Popover.md +516 -0
- package/docs/components/molecules/ProgressBar.md +624 -0
- package/docs/components/molecules/RadioGroup.md +831 -0
- package/docs/components/molecules/RepeaterList.md +185 -0
- package/docs/components/molecules/Select.md +402 -0
- package/docs/components/molecules/SortableTrigger.md +82 -0
- package/docs/components/molecules/useModal.md +379 -0
- package/docs/components/organisms/Dropzone.md +346 -0
- package/docs/components/organisms/DropzoneClear.md +135 -0
- package/docs/components/organisms/DropzoneContent.md +216 -0
- package/docs/components/organisms/DropzoneFilename.md +191 -0
- package/docs/components/organisms/DropzoneSupportedFormats.md +184 -0
- package/docs/components/organisms/DropzoneTrigger.md +209 -0
- package/docs/components/organisms/Form.md +533 -0
- package/docs/components/organisms/SlideOutPanel.md +662 -0
- package/docs/components/organisms/TabContent.md +902 -0
- package/docs/components/organisms/TabItem.md +1091 -0
- package/docs/components/organisms/Table.md +611 -0
- package/docs/components/organisms/TableBody.md +679 -0
- package/docs/components/organisms/TableCell.md +482 -0
- package/docs/components/organisms/TableHeader.md +513 -0
- package/docs/components/organisms/TableHeaderCell.md +661 -0
- package/docs/components/organisms/TableRow.md +715 -0
- package/docs/components/organisms/Tabs.md +1330 -0
- package/docs/components/utils/ConditionalView.md +568 -0
- package/docs/components/utils/RenderStateView.md +726 -0
- package/docs/components/utils/WrapTextNodes.md +614 -0
- package/package.json +3 -2
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
# Tooltip
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
A contextual tooltip component that displays helpful information when users interact with elements. Supports multiple trigger actions (hover, click, follow), positioning options, and customizable styling with arrow indicators for enhanced user experience.
|
|
6
|
+
|
|
7
|
+
## Aliases
|
|
8
|
+
|
|
9
|
+
- Tooltip
|
|
10
|
+
- Popover
|
|
11
|
+
- Hint
|
|
12
|
+
- Help Text
|
|
13
|
+
- Info Bubble
|
|
14
|
+
|
|
15
|
+
## Props Breakdown
|
|
16
|
+
|
|
17
|
+
**Extends:** Standalone interface (no HTML element inheritance)
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Default | Required | Description |
|
|
20
|
+
|------|------|---------|----------|-------------|
|
|
21
|
+
| `children` | `ReactNode` | - | No | The content displayed inside the tooltip |
|
|
22
|
+
| `direction` | `'Top' \| 'Bottom' \| 'Right' \| 'Left'` | `'Top'` | No | Direction where the tooltip appears relative to target |
|
|
23
|
+
| `alignment` | `'Start' \| 'End' \| 'Center'` | `'Center'` | No | Alignment of the tooltip relative to the target |
|
|
24
|
+
| `action` | `'Click' \| 'Hover' \| 'Follow'` | `'Hover'` | No | Event that triggers tooltip visibility |
|
|
25
|
+
| `isVisible` | `boolean` | `false` | No | Whether the tooltip is initially visible |
|
|
26
|
+
| `target` | `ReactNode` | - | No | The target element that triggers the tooltip |
|
|
27
|
+
| `style` | `'Default' \| 'Outlined'` | `'Default'` | No | Visual style variant of the tooltip |
|
|
28
|
+
| `className` | `string` | - | No | Additional CSS class names |
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
### Basic Usage
|
|
33
|
+
```tsx
|
|
34
|
+
import { Tooltip, Button } from '@delightui/components';
|
|
35
|
+
|
|
36
|
+
function BasicExample() {
|
|
37
|
+
return (
|
|
38
|
+
<Tooltip
|
|
39
|
+
target={<Button>Hover me</Button>}
|
|
40
|
+
>
|
|
41
|
+
This is a helpful tooltip message!
|
|
42
|
+
</Tooltip>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Tooltip Directions
|
|
48
|
+
```tsx
|
|
49
|
+
function DirectionsExample() {
|
|
50
|
+
return (
|
|
51
|
+
<div className="tooltip-directions">
|
|
52
|
+
<Tooltip
|
|
53
|
+
direction="Top"
|
|
54
|
+
target={<Button>Top Tooltip</Button>}
|
|
55
|
+
>
|
|
56
|
+
Tooltip appears above
|
|
57
|
+
</Tooltip>
|
|
58
|
+
|
|
59
|
+
<Tooltip
|
|
60
|
+
direction="Bottom"
|
|
61
|
+
target={<Button>Bottom Tooltip</Button>}
|
|
62
|
+
>
|
|
63
|
+
Tooltip appears below
|
|
64
|
+
</Tooltip>
|
|
65
|
+
|
|
66
|
+
<Tooltip
|
|
67
|
+
direction="Left"
|
|
68
|
+
target={<Button>Left Tooltip</Button>}
|
|
69
|
+
>
|
|
70
|
+
Tooltip appears to the left
|
|
71
|
+
</Tooltip>
|
|
72
|
+
|
|
73
|
+
<Tooltip
|
|
74
|
+
direction="Right"
|
|
75
|
+
target={<Button>Right Tooltip</Button>}
|
|
76
|
+
>
|
|
77
|
+
Tooltip appears to the right
|
|
78
|
+
</Tooltip>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Tooltip Alignments
|
|
85
|
+
```tsx
|
|
86
|
+
function AlignmentExample() {
|
|
87
|
+
return (
|
|
88
|
+
<div className="tooltip-alignments">
|
|
89
|
+
<Tooltip
|
|
90
|
+
direction="Bottom"
|
|
91
|
+
alignment="Start"
|
|
92
|
+
target={<Button>Start Aligned</Button>}
|
|
93
|
+
>
|
|
94
|
+
Aligned to start of target
|
|
95
|
+
</Tooltip>
|
|
96
|
+
|
|
97
|
+
<Tooltip
|
|
98
|
+
direction="Bottom"
|
|
99
|
+
alignment="Center"
|
|
100
|
+
target={<Button>Center Aligned</Button>}
|
|
101
|
+
>
|
|
102
|
+
Aligned to center of target
|
|
103
|
+
</Tooltip>
|
|
104
|
+
|
|
105
|
+
<Tooltip
|
|
106
|
+
direction="Bottom"
|
|
107
|
+
alignment="End"
|
|
108
|
+
target={<Button>End Aligned</Button>}
|
|
109
|
+
>
|
|
110
|
+
Aligned to end of target
|
|
111
|
+
</Tooltip>
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Trigger Actions
|
|
118
|
+
```tsx
|
|
119
|
+
function ActionsExample() {
|
|
120
|
+
return (
|
|
121
|
+
<div className="tooltip-actions">
|
|
122
|
+
<Tooltip
|
|
123
|
+
action="Hover"
|
|
124
|
+
target={<Button>Hover Action</Button>}
|
|
125
|
+
>
|
|
126
|
+
Shows on hover (default)
|
|
127
|
+
</Tooltip>
|
|
128
|
+
|
|
129
|
+
<Tooltip
|
|
130
|
+
action="Click"
|
|
131
|
+
target={<Button>Click Action</Button>}
|
|
132
|
+
>
|
|
133
|
+
Shows on click - click again to hide
|
|
134
|
+
</Tooltip>
|
|
135
|
+
|
|
136
|
+
<Tooltip
|
|
137
|
+
action="Follow"
|
|
138
|
+
target={<Button>Follow Action</Button>}
|
|
139
|
+
>
|
|
140
|
+
Follows your cursor on hover
|
|
141
|
+
</Tooltip>
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Tooltip Styles
|
|
148
|
+
```tsx
|
|
149
|
+
function StylesExample() {
|
|
150
|
+
return (
|
|
151
|
+
<div className="tooltip-styles">
|
|
152
|
+
<Tooltip
|
|
153
|
+
style="Default"
|
|
154
|
+
target={<Button>Default Style</Button>}
|
|
155
|
+
>
|
|
156
|
+
Default tooltip appearance
|
|
157
|
+
</Tooltip>
|
|
158
|
+
|
|
159
|
+
<Tooltip
|
|
160
|
+
style="Outlined"
|
|
161
|
+
target={<Button>Outlined Style</Button>}
|
|
162
|
+
>
|
|
163
|
+
Outlined tooltip appearance
|
|
164
|
+
</Tooltip>
|
|
165
|
+
</div>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Icon Tooltips
|
|
171
|
+
```tsx
|
|
172
|
+
import { Icon, Tooltip } from '@delightui/components';
|
|
173
|
+
|
|
174
|
+
function IconTooltipsExample() {
|
|
175
|
+
return (
|
|
176
|
+
<div className="icon-tooltips">
|
|
177
|
+
<Tooltip
|
|
178
|
+
target={<Icon icon="Info" />}
|
|
179
|
+
direction="Top"
|
|
180
|
+
>
|
|
181
|
+
Additional information about this feature
|
|
182
|
+
</Tooltip>
|
|
183
|
+
|
|
184
|
+
<Tooltip
|
|
185
|
+
target={<Icon icon="Help" />}
|
|
186
|
+
direction="Right"
|
|
187
|
+
>
|
|
188
|
+
Get help with this section
|
|
189
|
+
</Tooltip>
|
|
190
|
+
|
|
191
|
+
<Tooltip
|
|
192
|
+
target={<Icon icon="Warning" />}
|
|
193
|
+
direction="Bottom"
|
|
194
|
+
style="Outlined"
|
|
195
|
+
>
|
|
196
|
+
Warning: This action cannot be undone
|
|
197
|
+
</Tooltip>
|
|
198
|
+
</div>
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Form Field Tooltips
|
|
204
|
+
```tsx
|
|
205
|
+
import { Tooltip, Input, FormField, Icon } from '@delightui/components';
|
|
206
|
+
|
|
207
|
+
function FormTooltipsExample() {
|
|
208
|
+
return (
|
|
209
|
+
<div className="form-tooltips">
|
|
210
|
+
<FormField
|
|
211
|
+
name="email"
|
|
212
|
+
label={
|
|
213
|
+
<div className="label-with-tooltip">
|
|
214
|
+
Email Address
|
|
215
|
+
<Tooltip
|
|
216
|
+
target={<Icon icon="Info" size="Small" />}
|
|
217
|
+
direction="Right"
|
|
218
|
+
>
|
|
219
|
+
We'll never share your email with anyone
|
|
220
|
+
</Tooltip>
|
|
221
|
+
</div>
|
|
222
|
+
}
|
|
223
|
+
>
|
|
224
|
+
<Input
|
|
225
|
+
inputType="Email"
|
|
226
|
+
placeholder="Enter your email"
|
|
227
|
+
/>
|
|
228
|
+
</FormField>
|
|
229
|
+
|
|
230
|
+
<FormField
|
|
231
|
+
name="password"
|
|
232
|
+
label={
|
|
233
|
+
<div className="label-with-tooltip">
|
|
234
|
+
Password
|
|
235
|
+
<Tooltip
|
|
236
|
+
target={<Icon icon="Help" size="Small" />}
|
|
237
|
+
direction="Top"
|
|
238
|
+
>
|
|
239
|
+
Password must be at least 8 characters long and contain uppercase, lowercase, and numbers
|
|
240
|
+
</Tooltip>
|
|
241
|
+
</div>
|
|
242
|
+
}
|
|
243
|
+
>
|
|
244
|
+
<Input
|
|
245
|
+
inputType="Password"
|
|
246
|
+
placeholder="Enter password"
|
|
247
|
+
/>
|
|
248
|
+
</FormField>
|
|
249
|
+
</div>
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Rich Content Tooltips
|
|
255
|
+
```tsx
|
|
256
|
+
function RichContentExample() {
|
|
257
|
+
return (
|
|
258
|
+
<div className="rich-content-tooltips">
|
|
259
|
+
<Tooltip
|
|
260
|
+
target={<Button>Product Info</Button>}
|
|
261
|
+
direction="Bottom"
|
|
262
|
+
style="Default"
|
|
263
|
+
>
|
|
264
|
+
<div className="tooltip-content">
|
|
265
|
+
<h4>Premium Plan</h4>
|
|
266
|
+
<ul>
|
|
267
|
+
<li>Unlimited projects</li>
|
|
268
|
+
<li>Advanced analytics</li>
|
|
269
|
+
<li>Priority support</li>
|
|
270
|
+
</ul>
|
|
271
|
+
<p><strong>$29/month</strong></p>
|
|
272
|
+
</div>
|
|
273
|
+
</Tooltip>
|
|
274
|
+
|
|
275
|
+
<Tooltip
|
|
276
|
+
target={<Button>Status</Button>}
|
|
277
|
+
direction="Right"
|
|
278
|
+
>
|
|
279
|
+
<div className="status-tooltip">
|
|
280
|
+
<Icon icon="Check" style="Filled" />
|
|
281
|
+
<span>All systems operational</span>
|
|
282
|
+
</div>
|
|
283
|
+
</Tooltip>
|
|
284
|
+
</div>
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Interactive Tooltips
|
|
290
|
+
```tsx
|
|
291
|
+
function InteractiveExample() {
|
|
292
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
293
|
+
|
|
294
|
+
return (
|
|
295
|
+
<div className="interactive-tooltips">
|
|
296
|
+
<Tooltip
|
|
297
|
+
isVisible={isVisible}
|
|
298
|
+
target={
|
|
299
|
+
<Button onClick={() => setIsVisible(!isVisible)}>
|
|
300
|
+
Toggle Tooltip
|
|
301
|
+
</Button>
|
|
302
|
+
}
|
|
303
|
+
>
|
|
304
|
+
This tooltip is controlled programmatically
|
|
305
|
+
</Tooltip>
|
|
306
|
+
|
|
307
|
+
<Tooltip
|
|
308
|
+
action="Click"
|
|
309
|
+
target={<Button>Settings</Button>}
|
|
310
|
+
>
|
|
311
|
+
<div className="interactive-content">
|
|
312
|
+
<p>Quick Settings</p>
|
|
313
|
+
<Button size="Small">Enable notifications</Button>
|
|
314
|
+
<Button size="Small" style="Secondary">
|
|
315
|
+
Change theme
|
|
316
|
+
</Button>
|
|
317
|
+
</div>
|
|
318
|
+
</Tooltip>
|
|
319
|
+
</div>
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Accessibility Example
|
|
325
|
+
```tsx
|
|
326
|
+
function AccessibilityExample() {
|
|
327
|
+
return (
|
|
328
|
+
<div className="accessibility-tooltips">
|
|
329
|
+
<Tooltip
|
|
330
|
+
target={
|
|
331
|
+
<Button
|
|
332
|
+
aria-describedby="tooltip-1"
|
|
333
|
+
aria-label="Save document with tooltip help"
|
|
334
|
+
>
|
|
335
|
+
Save
|
|
336
|
+
</Button>
|
|
337
|
+
}
|
|
338
|
+
>
|
|
339
|
+
<div id="tooltip-1">
|
|
340
|
+
Save your document to the cloud.
|
|
341
|
+
Keyboard shortcut: Ctrl+S
|
|
342
|
+
</div>
|
|
343
|
+
</Tooltip>
|
|
344
|
+
|
|
345
|
+
<Tooltip
|
|
346
|
+
target={
|
|
347
|
+
<Icon
|
|
348
|
+
icon="Info"
|
|
349
|
+
aria-describedby="info-tooltip"
|
|
350
|
+
tabIndex={0}
|
|
351
|
+
/>
|
|
352
|
+
}
|
|
353
|
+
action="Click"
|
|
354
|
+
>
|
|
355
|
+
<div id="info-tooltip">
|
|
356
|
+
This feature is available in the premium plan.
|
|
357
|
+
Upgrade your account to access advanced features.
|
|
358
|
+
</div>
|
|
359
|
+
</Tooltip>
|
|
360
|
+
</div>
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Custom Styling
|
|
366
|
+
```tsx
|
|
367
|
+
function CustomStylingExample() {
|
|
368
|
+
return (
|
|
369
|
+
<div className="custom-tooltip-styling">
|
|
370
|
+
<Tooltip
|
|
371
|
+
target={<Button>Custom Tooltip</Button>}
|
|
372
|
+
className="custom-tooltip-class"
|
|
373
|
+
direction="Top"
|
|
374
|
+
>
|
|
375
|
+
This tooltip has custom styling applied
|
|
376
|
+
</Tooltip>
|
|
377
|
+
|
|
378
|
+
<Tooltip
|
|
379
|
+
target={<Button>Error Tooltip</Button>}
|
|
380
|
+
className="error-tooltip"
|
|
381
|
+
style="Outlined"
|
|
382
|
+
>
|
|
383
|
+
<div className="error-content">
|
|
384
|
+
<Icon icon="Error" />
|
|
385
|
+
Something went wrong! Please try again.
|
|
386
|
+
</div>
|
|
387
|
+
</Tooltip>
|
|
388
|
+
</div>
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
```
|