@telegraph/tooltip 0.0.62 → 0.1.1
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/CHANGELOG.md +18 -0
- package/README.md +45 -45
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +2289 -2082
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/Tooltip/Tooltip.d.ts +3 -3
- package/dist/types/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/Tooltip/index.d.ts +1 -0
- package/dist/types/Tooltip/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @telegraph/tooltip
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#693](https://github.com/knocklabs/telegraph/pull/693) [`4ab1d02`](https://github.com/knocklabs/telegraph/commit/4ab1d02cf51db16024e7098d4c9f9b963b8fac37) Thanks [@dependabot](https://github.com/apps/dependabot)! - chore(deps): bump motion from 12.23.12 to 12.34.3
|
|
8
|
+
|
|
9
|
+
## 0.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#688](https://github.com/knocklabs/telegraph/pull/688) [`8d55540`](https://github.com/knocklabs/telegraph/commit/8d5554005bea4695560efbee9ea4333ccddfc1bf) Thanks [@kylemcd](https://github.com/kylemcd)! - fix: invalid props on components would not throw type errors
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`8d55540`](https://github.com/knocklabs/telegraph/commit/8d5554005bea4695560efbee9ea4333ccddfc1bf)]:
|
|
18
|
+
- @telegraph/typography@0.2.0
|
|
19
|
+
- @telegraph/layout@0.4.0
|
|
20
|
+
|
|
3
21
|
## 0.0.62
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -42,13 +42,13 @@ import { Info } from "lucide-react";
|
|
|
42
42
|
export const TooltipExample = () => (
|
|
43
43
|
<div>
|
|
44
44
|
{/* Basic tooltip */}
|
|
45
|
-
<Tooltip
|
|
45
|
+
<Tooltip label="This button saves your changes">
|
|
46
46
|
<Button>Save</Button>
|
|
47
47
|
</Tooltip>
|
|
48
48
|
|
|
49
49
|
{/* Rich content tooltip */}
|
|
50
50
|
<Tooltip
|
|
51
|
-
|
|
51
|
+
label={
|
|
52
52
|
<div>
|
|
53
53
|
<strong>Pro Tip:</strong>
|
|
54
54
|
<br />
|
|
@@ -70,13 +70,13 @@ The main tooltip component that wraps content and provides contextual informatio
|
|
|
70
70
|
|
|
71
71
|
| Prop | Type | Default | Description |
|
|
72
72
|
| ------------------------- | ---------------------------------------- | ----------- | ------------------------------------------------------------ |
|
|
73
|
-
| `
|
|
74
|
-
| `side` | `"top" \| "right" \| "bottom" \| "left"` | `"
|
|
73
|
+
| `label` | `string \| ReactNode` | - | **Required.** Content to display in the tooltip |
|
|
74
|
+
| `side` | `"top" \| "right" \| "bottom" \| "left"` | `"bottom"` | Preferred placement side |
|
|
75
75
|
| `align` | `"start" \| "center" \| "end"` | `"center"` | Alignment relative to the trigger |
|
|
76
76
|
| `sideOffset` | `number` | `4` | Distance from the trigger element |
|
|
77
77
|
| `alignOffset` | `number` | `0` | Offset along the alignment axis |
|
|
78
|
-
| `delayDuration` | `number` | `
|
|
79
|
-
| `skipDelayDuration` | `number` |
|
|
78
|
+
| `delayDuration` | `number` | `400` | Delay before showing tooltip (ms) |
|
|
79
|
+
| `skipDelayDuration` | `number` | - | Skip delay if another tooltip was recently shown |
|
|
80
80
|
| `disableHoverableContent` | `boolean` | `false` | Prevent tooltip from staying open when hovering over content |
|
|
81
81
|
| `avoidCollisions` | `boolean` | `true` | Automatically flip tooltip to avoid viewport edges |
|
|
82
82
|
| `sticky` | `"partial" \| "always"` | `"partial"` | How tooltip follows the cursor |
|
|
@@ -91,7 +91,7 @@ import { Button } from "@telegraph/button";
|
|
|
91
91
|
import { Tooltip } from "@telegraph/tooltip";
|
|
92
92
|
|
|
93
93
|
export const BasicTooltip = () => (
|
|
94
|
-
<Tooltip
|
|
94
|
+
<Tooltip label="Click to save your work">
|
|
95
95
|
<Button>Save</Button>
|
|
96
96
|
</Tooltip>
|
|
97
97
|
);
|
|
@@ -105,19 +105,19 @@ import { Tooltip } from "@telegraph/tooltip";
|
|
|
105
105
|
|
|
106
106
|
export const PositionedTooltips = () => (
|
|
107
107
|
<div>
|
|
108
|
-
<Tooltip
|
|
108
|
+
<Tooltip label="Tooltip on top" side="top">
|
|
109
109
|
<Button>Top</Button>
|
|
110
110
|
</Tooltip>
|
|
111
111
|
|
|
112
|
-
<Tooltip
|
|
112
|
+
<Tooltip label="Tooltip on right" side="right">
|
|
113
113
|
<Button>Right</Button>
|
|
114
114
|
</Tooltip>
|
|
115
115
|
|
|
116
|
-
<Tooltip
|
|
116
|
+
<Tooltip label="Tooltip on bottom" side="bottom">
|
|
117
117
|
<Button>Bottom</Button>
|
|
118
118
|
</Tooltip>
|
|
119
119
|
|
|
120
|
-
<Tooltip
|
|
120
|
+
<Tooltip label="Tooltip on left" side="left">
|
|
121
121
|
<Button>Left</Button>
|
|
122
122
|
</Tooltip>
|
|
123
123
|
</div>
|
|
@@ -133,7 +133,7 @@ import { Mail, Phone, User } from "lucide-react";
|
|
|
133
133
|
|
|
134
134
|
export const RichContentTooltip = () => (
|
|
135
135
|
<Tooltip
|
|
136
|
-
|
|
136
|
+
label={
|
|
137
137
|
<div className="user-tooltip">
|
|
138
138
|
<div className="user-header">
|
|
139
139
|
<User size={20} />
|
|
@@ -164,12 +164,12 @@ import { Tooltip } from "@telegraph/tooltip";
|
|
|
164
164
|
export const CustomDelayTooltips = () => (
|
|
165
165
|
<div>
|
|
166
166
|
{/* Instant tooltip */}
|
|
167
|
-
<Tooltip
|
|
167
|
+
<Tooltip label="Shows immediately" delayDuration={0}>
|
|
168
168
|
<Button>Instant</Button>
|
|
169
169
|
</Tooltip>
|
|
170
170
|
|
|
171
171
|
{/* Slow tooltip */}
|
|
172
|
-
<Tooltip
|
|
172
|
+
<Tooltip label="Takes time to show" delayDuration={1500}>
|
|
173
173
|
<Button>Slow</Button>
|
|
174
174
|
</Tooltip>
|
|
175
175
|
</div>
|
|
@@ -183,7 +183,7 @@ import { Button } from "@telegraph/button";
|
|
|
183
183
|
import { Tooltip } from "@telegraph/tooltip";
|
|
184
184
|
|
|
185
185
|
export const DisabledTooltip = () => (
|
|
186
|
-
<Tooltip
|
|
186
|
+
<Tooltip label="This action is not available right now">
|
|
187
187
|
<span>
|
|
188
188
|
{" "}
|
|
189
189
|
{/* Wrapper needed for disabled elements */}
|
|
@@ -202,7 +202,7 @@ import { Button } from "@telegraph/button";
|
|
|
202
202
|
import { Tooltip } from "@telegraph/tooltip";
|
|
203
203
|
|
|
204
204
|
export const ConditionalTooltip = ({ showTooltip, user }) => (
|
|
205
|
-
<Tooltip
|
|
205
|
+
<Tooltip label={showTooltip ? `Hello, ${user.name}!` : "Sign in to continue"}>
|
|
206
206
|
<Button>{user.isLoggedIn ? "Dashboard" : "Sign In"}</Button>
|
|
207
207
|
</Tooltip>
|
|
208
208
|
);
|
|
@@ -213,11 +213,11 @@ export const ConditionalTooltip = ({ showTooltip, user }) => (
|
|
|
213
213
|
```tsx
|
|
214
214
|
import { Button } from "@telegraph/button";
|
|
215
215
|
import { Tooltip } from "@telegraph/tooltip";
|
|
216
|
-
import
|
|
216
|
+
import Link from "next/link";
|
|
217
217
|
|
|
218
218
|
export const InteractiveTooltip = () => (
|
|
219
219
|
<Tooltip
|
|
220
|
-
|
|
220
|
+
label={
|
|
221
221
|
<div className="interactive-tooltip">
|
|
222
222
|
<p>Need help with this feature?</p>
|
|
223
223
|
<div className="tooltip-actions">
|
|
@@ -255,7 +255,7 @@ export const FormWithTooltips = () => (
|
|
|
255
255
|
<label htmlFor="username">
|
|
256
256
|
Username
|
|
257
257
|
<Tooltip
|
|
258
|
-
|
|
258
|
+
label="Username must be 3-20 characters long and contain only letters, numbers, and underscores"
|
|
259
259
|
side="right"
|
|
260
260
|
>
|
|
261
261
|
<HelpCircle size={16} className="help-icon" />
|
|
@@ -268,7 +268,7 @@ export const FormWithTooltips = () => (
|
|
|
268
268
|
<label htmlFor="email">
|
|
269
269
|
Email Address
|
|
270
270
|
<Tooltip
|
|
271
|
-
|
|
271
|
+
label="We'll use this email for account notifications and password recovery"
|
|
272
272
|
side="right"
|
|
273
273
|
>
|
|
274
274
|
<HelpCircle size={16} className="help-icon" />
|
|
@@ -288,15 +288,15 @@ import { Tooltip } from "@telegraph/tooltip";
|
|
|
288
288
|
|
|
289
289
|
export const ArrowTooltips = () => (
|
|
290
290
|
<div className="tooltip-demo-grid">
|
|
291
|
-
<Tooltip
|
|
291
|
+
<Tooltip label="Aligned to start" align="start">
|
|
292
292
|
<Button>Start</Button>
|
|
293
293
|
</Tooltip>
|
|
294
294
|
|
|
295
|
-
<Tooltip
|
|
295
|
+
<Tooltip label="Centered alignment" align="center">
|
|
296
296
|
<Button>Center</Button>
|
|
297
297
|
</Tooltip>
|
|
298
298
|
|
|
299
|
-
<Tooltip
|
|
299
|
+
<Tooltip label="Aligned to end" align="end">
|
|
300
300
|
<Button>End</Button>
|
|
301
301
|
</Tooltip>
|
|
302
302
|
</div>
|
|
@@ -310,7 +310,7 @@ import { Tooltip } from "@telegraph/tooltip";
|
|
|
310
310
|
|
|
311
311
|
export const ChartTooltip = ({ dataPoint }) => (
|
|
312
312
|
<Tooltip
|
|
313
|
-
|
|
313
|
+
label={
|
|
314
314
|
<div className="chart-tooltip">
|
|
315
315
|
<div className="tooltip-title">{dataPoint.label}</div>
|
|
316
316
|
<div className="tooltip-value">
|
|
@@ -345,7 +345,7 @@ import { Tooltip } from "@telegraph/tooltip";
|
|
|
345
345
|
export const KeyboardTooltips = () => (
|
|
346
346
|
<div className="keyboard-shortcuts">
|
|
347
347
|
<Tooltip
|
|
348
|
-
|
|
348
|
+
label={
|
|
349
349
|
<div>
|
|
350
350
|
Quick save: <Kbd>Ctrl</Kbd> + <Kbd>S</Kbd>
|
|
351
351
|
</div>
|
|
@@ -355,7 +355,7 @@ export const KeyboardTooltips = () => (
|
|
|
355
355
|
</Tooltip>
|
|
356
356
|
|
|
357
357
|
<Tooltip
|
|
358
|
-
|
|
358
|
+
label={
|
|
359
359
|
<div>
|
|
360
360
|
Copy: <Kbd>Ctrl</Kbd> + <Kbd>C</Kbd>
|
|
361
361
|
<br />
|
|
@@ -402,7 +402,7 @@ export const StatusTooltips = ({ status }) => {
|
|
|
402
402
|
const config = statusConfig[status];
|
|
403
403
|
|
|
404
404
|
return (
|
|
405
|
-
<Tooltip
|
|
405
|
+
<Tooltip label={config.message}>
|
|
406
406
|
<config.icon size={20} className={`status-icon status-${config.color}`} />
|
|
407
407
|
</Tooltip>
|
|
408
408
|
);
|
|
@@ -418,21 +418,21 @@ import { Settings, User } from "lucide-react";
|
|
|
418
418
|
|
|
419
419
|
export const NestedTooltips = () => (
|
|
420
420
|
<div className="nested-tooltip-example">
|
|
421
|
-
<Tooltip
|
|
421
|
+
<Tooltip label="User account settings">
|
|
422
422
|
<Button icon={{ icon: User, alt: "User" }}>Profile</Button>
|
|
423
423
|
</Tooltip>
|
|
424
424
|
|
|
425
425
|
<Tooltip
|
|
426
|
-
|
|
426
|
+
label={
|
|
427
427
|
<div>
|
|
428
428
|
<div>Advanced Settings</div>
|
|
429
429
|
<div className="nested-actions">
|
|
430
|
-
<Tooltip
|
|
430
|
+
<Tooltip label="Manage account preferences" side="right">
|
|
431
431
|
<Button size="0" variant="ghost">
|
|
432
432
|
Preferences
|
|
433
433
|
</Button>
|
|
434
434
|
</Tooltip>
|
|
435
|
-
<Tooltip
|
|
435
|
+
<Tooltip label="Security and privacy settings" side="right">
|
|
436
436
|
<Button size="0" variant="ghost">
|
|
437
437
|
Security
|
|
438
438
|
</Button>
|
|
@@ -488,7 +488,7 @@ import { Button } from "@telegraph/button";
|
|
|
488
488
|
import { Tooltip } from "@telegraph/tooltip";
|
|
489
489
|
|
|
490
490
|
export const BasicExample = () => (
|
|
491
|
-
<Tooltip
|
|
491
|
+
<Tooltip label="This will save your current work">
|
|
492
492
|
<Button>Save Changes</Button>
|
|
493
493
|
</Tooltip>
|
|
494
494
|
);
|
|
@@ -497,14 +497,14 @@ export const BasicExample = () => (
|
|
|
497
497
|
### Advanced Example
|
|
498
498
|
|
|
499
499
|
```tsx
|
|
500
|
-
import {
|
|
500
|
+
import { Tag } from "@telegraph/tag";
|
|
501
501
|
import { Button } from "@telegraph/button";
|
|
502
502
|
import { Tooltip } from "@telegraph/tooltip";
|
|
503
503
|
import { Calendar, Mail, MapPin, User } from "lucide-react";
|
|
504
504
|
|
|
505
505
|
export const UserProfileTooltip = ({ user }) => (
|
|
506
506
|
<Tooltip
|
|
507
|
-
|
|
507
|
+
label={
|
|
508
508
|
<div className="user-profile-tooltip">
|
|
509
509
|
<div className="user-header">
|
|
510
510
|
<div className="user-avatar">
|
|
@@ -512,9 +512,9 @@ export const UserProfileTooltip = ({ user }) => (
|
|
|
512
512
|
</div>
|
|
513
513
|
<div className="user-info">
|
|
514
514
|
<h4>{user.name}</h4>
|
|
515
|
-
<
|
|
515
|
+
<Tag variant="soft" color="green">
|
|
516
516
|
Online
|
|
517
|
-
</
|
|
517
|
+
</Tag>
|
|
518
518
|
</div>
|
|
519
519
|
</div>
|
|
520
520
|
|
|
@@ -555,7 +555,7 @@ export const UserProfileTooltip = ({ user }) => (
|
|
|
555
555
|
### Real-world Example
|
|
556
556
|
|
|
557
557
|
```tsx
|
|
558
|
-
import {
|
|
558
|
+
import { Tag } from "@telegraph/tag";
|
|
559
559
|
import { Button } from "@telegraph/button";
|
|
560
560
|
import { Tooltip } from "@telegraph/tooltip";
|
|
561
561
|
import {
|
|
@@ -576,18 +576,18 @@ export const ApplicationHeader = ({ user, notifications }) => (
|
|
|
576
576
|
</div>
|
|
577
577
|
|
|
578
578
|
<nav className="header-nav">
|
|
579
|
-
<Tooltip
|
|
579
|
+
<Tooltip label="View all notifications">
|
|
580
580
|
<Button variant="ghost" icon={{ icon: Bell, alt: "Notifications" }}>
|
|
581
581
|
{notifications.length > 0 && (
|
|
582
|
-
<
|
|
582
|
+
<Tag variant="solid" color="red" size="0">
|
|
583
583
|
{notifications.length}
|
|
584
|
-
</
|
|
584
|
+
</Tag>
|
|
585
585
|
)}
|
|
586
586
|
</Button>
|
|
587
587
|
</Tooltip>
|
|
588
588
|
|
|
589
589
|
<Tooltip
|
|
590
|
-
|
|
590
|
+
label={
|
|
591
591
|
<div className="feature-tooltip">
|
|
592
592
|
<div className="tooltip-header">
|
|
593
593
|
<Zap size={16} />
|
|
@@ -613,7 +613,7 @@ export const ApplicationHeader = ({ user, notifications }) => (
|
|
|
613
613
|
</Tooltip>
|
|
614
614
|
|
|
615
615
|
<Tooltip
|
|
616
|
-
|
|
616
|
+
label={
|
|
617
617
|
<div className="help-tooltip">
|
|
618
618
|
<div className="help-section">
|
|
619
619
|
<h4>Need Help?</h4>
|
|
@@ -641,7 +641,7 @@ export const ApplicationHeader = ({ user, notifications }) => (
|
|
|
641
641
|
</Tooltip>
|
|
642
642
|
|
|
643
643
|
<Tooltip
|
|
644
|
-
|
|
644
|
+
label={
|
|
645
645
|
<div className="user-menu-tooltip">
|
|
646
646
|
<div className="user-info">
|
|
647
647
|
<div className="user-avatar">
|
|
@@ -650,13 +650,13 @@ export const ApplicationHeader = ({ user, notifications }) => (
|
|
|
650
650
|
<div>
|
|
651
651
|
<div className="user-name">{user.name}</div>
|
|
652
652
|
<div className="user-email">{user.email}</div>
|
|
653
|
-
<
|
|
653
|
+
<Tag
|
|
654
654
|
variant="soft"
|
|
655
655
|
color={user.plan === "premium" ? "purple" : "gray"}
|
|
656
656
|
size="0"
|
|
657
657
|
>
|
|
658
658
|
{user.plan}
|
|
659
|
-
</
|
|
659
|
+
</Tag>
|
|
660
660
|
</div>
|
|
661
661
|
</div>
|
|
662
662
|
|