@asnewyla/tooltip 0.2.0
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/LICENSE +21 -0
- package/README.md +47 -0
- package/dist/index.css +69 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +34 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +63 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 XD
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @asnewyla/tooltip
|
|
2
|
+
|
|
3
|
+
Styled tooltip built on `@asnewyla/unstyled-tooltip` — a theme-aware bubble,
|
|
4
|
+
CSS positioning per side, no new props over the primitive.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @asnewyla/tooltip
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { Tooltip, TooltipTrigger, TooltipContent } from '@asnewyla/tooltip';
|
|
16
|
+
import '@asnewyla/tooltip/styles.css';
|
|
17
|
+
|
|
18
|
+
<Tooltip>
|
|
19
|
+
<TooltipTrigger>
|
|
20
|
+
<button type="button">Save</button>
|
|
21
|
+
</TooltipTrigger>
|
|
22
|
+
<TooltipContent side="bottom">Saves your work automatically</TooltipContent>
|
|
23
|
+
</Tooltip>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Same API as [`@asnewyla/unstyled-tooltip`](https://www.npmjs.com/package/@asnewyla/unstyled-tooltip)
|
|
27
|
+
— `Tooltip` (`open`/`defaultOpen`/`onOpenChange`/`delay`), `TooltipTrigger`
|
|
28
|
+
(clones its single child), `TooltipContent` (`side`). This package only adds
|
|
29
|
+
the `xd-tooltip-root` / `xd-tooltip` classes and their CSS.
|
|
30
|
+
|
|
31
|
+
### Styling
|
|
32
|
+
|
|
33
|
+
The bubble is positioned absolutely against the trigger wrapper with an 8px
|
|
34
|
+
gap and a small arrow, placed by `data-side`. There is no collision detection:
|
|
35
|
+
a `side` that runs off-screen stays off-screen — pick the side with room.
|
|
36
|
+
|
|
37
|
+
Colors invert against the page (`--xd-color-text` background, `--xd-color-surface`
|
|
38
|
+
text) and read from `@asnewyla/tokens` when present, with built-in fallbacks.
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import '@asnewyla/tokens/tokens.css'; // optional
|
|
42
|
+
import '@asnewyla/tooltip/styles.css'; // required
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## License
|
|
46
|
+
|
|
47
|
+
MIT
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/* src/components/Tooltip.css */
|
|
2
|
+
.xd-tooltip {
|
|
3
|
+
position: absolute;
|
|
4
|
+
z-index: 40;
|
|
5
|
+
max-width: 16rem;
|
|
6
|
+
width: max-content;
|
|
7
|
+
padding: var(--xd-space-xs, 0.25rem) var(--xd-space-sm, 0.375rem);
|
|
8
|
+
border-radius: var(--xd-radius-sm, 0.25rem);
|
|
9
|
+
background-color: var(--xd-color-text, #0f172a);
|
|
10
|
+
color: var(--xd-color-surface, #ffffff);
|
|
11
|
+
font-family: var(--xd-font-family, system-ui, sans-serif);
|
|
12
|
+
font-size: var(--xd-font-size-sm, 0.75rem);
|
|
13
|
+
line-height: var(--xd-line-height-normal, 1.25);
|
|
14
|
+
box-shadow: var(--xd-shadow-sm, 0 1px 2px rgb(0 0 0 / 0.12));
|
|
15
|
+
pointer-events: none;
|
|
16
|
+
}
|
|
17
|
+
.xd-tooltip[data-side=top] {
|
|
18
|
+
bottom: 100%;
|
|
19
|
+
left: 50%;
|
|
20
|
+
transform: translateX(-50%);
|
|
21
|
+
margin-bottom: 0.5rem;
|
|
22
|
+
}
|
|
23
|
+
.xd-tooltip[data-side=bottom] {
|
|
24
|
+
top: 100%;
|
|
25
|
+
left: 50%;
|
|
26
|
+
transform: translateX(-50%);
|
|
27
|
+
margin-top: 0.5rem;
|
|
28
|
+
}
|
|
29
|
+
.xd-tooltip[data-side=left] {
|
|
30
|
+
right: 100%;
|
|
31
|
+
top: 50%;
|
|
32
|
+
transform: translateY(-50%);
|
|
33
|
+
margin-right: 0.5rem;
|
|
34
|
+
}
|
|
35
|
+
.xd-tooltip[data-side=right] {
|
|
36
|
+
left: 100%;
|
|
37
|
+
top: 50%;
|
|
38
|
+
transform: translateY(-50%);
|
|
39
|
+
margin-left: 0.5rem;
|
|
40
|
+
}
|
|
41
|
+
.xd-tooltip::after {
|
|
42
|
+
content: "";
|
|
43
|
+
position: absolute;
|
|
44
|
+
width: 0.375rem;
|
|
45
|
+
height: 0.375rem;
|
|
46
|
+
background-color: inherit;
|
|
47
|
+
transform: rotate(45deg);
|
|
48
|
+
}
|
|
49
|
+
.xd-tooltip[data-side=top]::after {
|
|
50
|
+
bottom: -0.1875rem;
|
|
51
|
+
left: 50%;
|
|
52
|
+
margin-left: -0.1875rem;
|
|
53
|
+
}
|
|
54
|
+
.xd-tooltip[data-side=bottom]::after {
|
|
55
|
+
top: -0.1875rem;
|
|
56
|
+
left: 50%;
|
|
57
|
+
margin-left: -0.1875rem;
|
|
58
|
+
}
|
|
59
|
+
.xd-tooltip[data-side=left]::after {
|
|
60
|
+
right: -0.1875rem;
|
|
61
|
+
top: 50%;
|
|
62
|
+
margin-top: -0.1875rem;
|
|
63
|
+
}
|
|
64
|
+
.xd-tooltip[data-side=right]::after {
|
|
65
|
+
left: -0.1875rem;
|
|
66
|
+
top: 50%;
|
|
67
|
+
margin-top: -0.1875rem;
|
|
68
|
+
}
|
|
69
|
+
/*# sourceMappingURL=index.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Tooltip.css"],"sourcesContent":["/* The wrapper (.xd-tooltip-root) is a shrink-wrapped positioning context — the\n primitive's own inline styles already set position/display, so no rule is\n needed here; the class exists only as a consumer styling hook. */\n\n/* --- The bubble ---\n Positioned absolutely against .xd-tooltip-root. No collision detection for\n v0.x: an explicit `side` that runs off-screen stays off-screen. Token\n fallbacks kept in sync with @asnewyla/tokens (soft dependency). */\n\n.xd-tooltip {\n position: absolute;\n z-index: 40;\n max-width: 16rem;\n width: max-content;\n padding: var(--xd-space-xs, 0.25rem) var(--xd-space-sm, 0.375rem);\n border-radius: var(--xd-radius-sm, 0.25rem);\n background-color: var(--xd-color-text, #0f172a);\n color: var(--xd-color-surface, #ffffff);\n font-family: var(--xd-font-family, system-ui, sans-serif);\n font-size: var(--xd-font-size-sm, 0.75rem);\n line-height: var(--xd-line-height-normal, 1.25);\n box-shadow: var(--xd-shadow-sm, 0 1px 2px rgb(0 0 0 / 0.12));\n /* The pointer never interacts with the bubble — it isn't hoverable in v0.x. */\n pointer-events: none;\n}\n\n/* --- Placement per side ---\n 8px gap between the trigger and the bubble, plus a centered arrow. */\n\n.xd-tooltip[data-side=\"top\"] {\n bottom: 100%;\n left: 50%;\n transform: translateX(-50%);\n margin-bottom: 0.5rem;\n}\n\n.xd-tooltip[data-side=\"bottom\"] {\n top: 100%;\n left: 50%;\n transform: translateX(-50%);\n margin-top: 0.5rem;\n}\n\n.xd-tooltip[data-side=\"left\"] {\n right: 100%;\n top: 50%;\n transform: translateY(-50%);\n margin-right: 0.5rem;\n}\n\n.xd-tooltip[data-side=\"right\"] {\n left: 100%;\n top: 50%;\n transform: translateY(-50%);\n margin-left: 0.5rem;\n}\n\n/* --- Arrow --- a 6px square rotated 45deg, half-tucked under the bubble edge */\n\n.xd-tooltip::after {\n content: \"\";\n position: absolute;\n width: 0.375rem;\n height: 0.375rem;\n background-color: inherit;\n transform: rotate(45deg);\n}\n\n.xd-tooltip[data-side=\"top\"]::after {\n bottom: -0.1875rem;\n left: 50%;\n margin-left: -0.1875rem;\n}\n\n.xd-tooltip[data-side=\"bottom\"]::after {\n top: -0.1875rem;\n left: 50%;\n margin-left: -0.1875rem;\n}\n\n.xd-tooltip[data-side=\"left\"]::after {\n right: -0.1875rem;\n top: 50%;\n margin-top: -0.1875rem;\n}\n\n.xd-tooltip[data-side=\"right\"]::after {\n left: -0.1875rem;\n top: 50%;\n margin-top: -0.1875rem;\n}\n"],"mappings":";AASA,CAAC;AACC,YAAU;AACV,WAAS;AACT,aAAW;AACX,SAAO;AACP,WAAS,IAAI,aAAa,EAAE,SAAS,IAAI,aAAa,EAAE;AACxD,iBAAe,IAAI,cAAc,EAAE;AACnC,oBAAkB,IAAI,eAAe,EAAE;AACvC,SAAO,IAAI,kBAAkB,EAAE;AAC/B,eAAa,IAAI,gBAAgB,EAAE,SAAS,EAAE;AAC9C,aAAW,IAAI,iBAAiB,EAAE;AAClC,eAAa,IAAI,uBAAuB,EAAE;AAC1C,cAAY,IAAI,cAAc,EAAE,EAAE,IAAI,IAAI,IAAI,EAAE,EAAE,EAAE,EAAE;AAEtD,kBAAgB;AAClB;AAKA,CApBC,UAoBU,CAAC;AACV,UAAQ;AACR,QAAM;AACN,aAAW,WAAW;AACtB,iBAAe;AACjB;AAEA,CA3BC,UA2BU,CAAC;AACV,OAAK;AACL,QAAM;AACN,aAAW,WAAW;AACtB,cAAY;AACd;AAEA,CAlCC,UAkCU,CAAC;AACV,SAAO;AACP,OAAK;AACL,aAAW,WAAW;AACtB,gBAAc;AAChB;AAEA,CAzCC,UAyCU,CAAC;AACV,QAAM;AACN,OAAK;AACL,aAAW,WAAW;AACtB,eAAa;AACf;AAIA,CAlDC,UAkDU;AACT,WAAS;AACT,YAAU;AACV,SAAO;AACP,UAAQ;AACR,oBAAkB;AAClB,aAAW,OAAO;AACpB;AAEA,CA3DC,UA2DU,CAAC,cAAgB;AAC1B,UAAQ;AACR,QAAM;AACN,eAAa;AACf;AAEA,CAjEC,UAiEU,CAAC,iBAAmB;AAC7B,OAAK;AACL,QAAM;AACN,eAAa;AACf;AAEA,CAvEC,UAuEU,CAAC,eAAiB;AAC3B,SAAO;AACP,OAAK;AACL,cAAY;AACd;AAEA,CA7EC,UA6EU,CAAC,gBAAkB;AAC5B,QAAM;AACN,OAAK;AACL,cAAY;AACd;","names":[]}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as _asnewyla_unstyled_tooltip from '@asnewyla/unstyled-tooltip';
|
|
2
|
+
import { TooltipProps as TooltipProps$1, TooltipContentProps as TooltipContentProps$1 } from '@asnewyla/unstyled-tooltip';
|
|
3
|
+
export { TooltipSide, TooltipTrigger, TooltipTriggerProps } from '@asnewyla/unstyled-tooltip';
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
|
|
6
|
+
type TooltipProps = TooltipProps$1;
|
|
7
|
+
declare const Tooltip: react.ForwardRefExoticComponent<{
|
|
8
|
+
open?: boolean;
|
|
9
|
+
defaultOpen?: boolean;
|
|
10
|
+
onOpenChange?: (open: boolean) => void;
|
|
11
|
+
delay?: number;
|
|
12
|
+
children: react.ReactNode;
|
|
13
|
+
} & Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "children" | "onChange"> & react.RefAttributes<HTMLSpanElement>>;
|
|
14
|
+
|
|
15
|
+
type TooltipContentProps = TooltipContentProps$1;
|
|
16
|
+
declare const TooltipContent: react.ForwardRefExoticComponent<{
|
|
17
|
+
side?: _asnewyla_unstyled_tooltip.TooltipSide;
|
|
18
|
+
} & Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "id" | "role"> & react.RefAttributes<HTMLSpanElement>>;
|
|
19
|
+
|
|
20
|
+
export { Tooltip, TooltipContent, type TooltipContentProps, type TooltipProps };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as _asnewyla_unstyled_tooltip from '@asnewyla/unstyled-tooltip';
|
|
2
|
+
import { TooltipProps as TooltipProps$1, TooltipContentProps as TooltipContentProps$1 } from '@asnewyla/unstyled-tooltip';
|
|
3
|
+
export { TooltipSide, TooltipTrigger, TooltipTriggerProps } from '@asnewyla/unstyled-tooltip';
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
|
|
6
|
+
type TooltipProps = TooltipProps$1;
|
|
7
|
+
declare const Tooltip: react.ForwardRefExoticComponent<{
|
|
8
|
+
open?: boolean;
|
|
9
|
+
defaultOpen?: boolean;
|
|
10
|
+
onOpenChange?: (open: boolean) => void;
|
|
11
|
+
delay?: number;
|
|
12
|
+
children: react.ReactNode;
|
|
13
|
+
} & Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "children" | "onChange"> & react.RefAttributes<HTMLSpanElement>>;
|
|
14
|
+
|
|
15
|
+
type TooltipContentProps = TooltipContentProps$1;
|
|
16
|
+
declare const TooltipContent: react.ForwardRefExoticComponent<{
|
|
17
|
+
side?: _asnewyla_unstyled_tooltip.TooltipSide;
|
|
18
|
+
} & Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "id" | "role"> & react.RefAttributes<HTMLSpanElement>>;
|
|
19
|
+
|
|
20
|
+
export { Tooltip, TooltipContent, type TooltipContentProps, type TooltipProps };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var unstyledTooltip = require('@asnewyla/unstyled-tooltip');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
// src/components/index.ts
|
|
8
|
+
function TooltipInner({ className, ...rest }, ref) {
|
|
9
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10
|
+
unstyledTooltip.Tooltip,
|
|
11
|
+
{
|
|
12
|
+
...rest,
|
|
13
|
+
className: className ? `xd-tooltip-root ${className}` : "xd-tooltip-root",
|
|
14
|
+
ref
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
var Tooltip = react.forwardRef(TooltipInner);
|
|
19
|
+
function TooltipContentInner({ className, ...rest }, ref) {
|
|
20
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21
|
+
unstyledTooltip.TooltipContent,
|
|
22
|
+
{
|
|
23
|
+
...rest,
|
|
24
|
+
className: className ? `xd-tooltip ${className}` : "xd-tooltip",
|
|
25
|
+
ref
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
var TooltipContent = react.forwardRef(
|
|
30
|
+
TooltipContentInner
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
Object.defineProperty(exports, "TooltipTrigger", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return unstyledTooltip.TooltipTrigger; }
|
|
36
|
+
});
|
|
37
|
+
exports.Tooltip = Tooltip;
|
|
38
|
+
exports.TooltipContent = TooltipContent;
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Tooltip.tsx","../src/components/TooltipContent.tsx"],"names":["jsx","UnstyledTooltip","forwardRef","UnstyledTooltipContent"],"mappings":";;;;;;;AASA,SAAS,aACP,EAAE,SAAA,EAAW,GAAG,IAAA,IAChB,GAAA,EACA;AACA,EAAA,uBACEA,cAAA;AAAA,IAACC,uBAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,SAAA,EAAW,SAAA,GAAY,CAAA,gBAAA,EAAmB,SAAS,CAAA,CAAA,GAAK,iBAAA;AAAA,MACxD;AAAA;AAAA,GACF;AAEJ;AAEO,IAAM,OAAA,GAAUC,iBAA0C,YAAY;ACd7E,SAAS,oBACP,EAAE,SAAA,EAAW,GAAG,IAAA,IAChB,GAAA,EACA;AACA,EAAA,uBACEF,cAAAA;AAAA,IAACG,8BAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,SAAA,EAAW,SAAA,GAAY,CAAA,WAAA,EAAc,SAAS,CAAA,CAAA,GAAK,YAAA;AAAA,MACnD;AAAA;AAAA,GACF;AAEJ;AAEO,IAAM,cAAA,GAAiBD,gBAAAA;AAAA,EAC5B;AACF","file":"index.js","sourcesContent":["import {\n Tooltip as UnstyledTooltip,\n type TooltipProps as UnstyledTooltipProps,\n} from '@asnewyla/unstyled-tooltip';\nimport { type ForwardedRef, forwardRef } from 'react';\nimport './Tooltip.css';\n\nexport type TooltipProps = UnstyledTooltipProps;\n\nfunction TooltipInner(\n { className, ...rest }: TooltipProps,\n ref: ForwardedRef<HTMLSpanElement>,\n) {\n return (\n <UnstyledTooltip\n {...rest}\n className={className ? `xd-tooltip-root ${className}` : 'xd-tooltip-root'}\n ref={ref}\n />\n );\n}\n\nexport const Tooltip = forwardRef<HTMLSpanElement, TooltipProps>(TooltipInner);\n","import {\n TooltipContent as UnstyledTooltipContent,\n type TooltipContentProps as UnstyledTooltipContentProps,\n} from '@asnewyla/unstyled-tooltip';\nimport { type ForwardedRef, forwardRef } from 'react';\n\nexport type TooltipContentProps = UnstyledTooltipContentProps;\n\nfunction TooltipContentInner(\n { className, ...rest }: TooltipContentProps,\n ref: ForwardedRef<HTMLSpanElement>,\n) {\n return (\n <UnstyledTooltipContent\n {...rest}\n className={className ? `xd-tooltip ${className}` : 'xd-tooltip'}\n ref={ref}\n />\n );\n}\n\nexport const TooltipContent = forwardRef<HTMLSpanElement, TooltipContentProps>(\n TooltipContentInner,\n);\n"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Tooltip as Tooltip$1, TooltipContent as TooltipContent$1 } from '@asnewyla/unstyled-tooltip';
|
|
2
|
+
export { TooltipTrigger } from '@asnewyla/unstyled-tooltip';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
// src/components/index.ts
|
|
7
|
+
function TooltipInner({ className, ...rest }, ref) {
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
Tooltip$1,
|
|
10
|
+
{
|
|
11
|
+
...rest,
|
|
12
|
+
className: className ? `xd-tooltip-root ${className}` : "xd-tooltip-root",
|
|
13
|
+
ref
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
var Tooltip = forwardRef(TooltipInner);
|
|
18
|
+
function TooltipContentInner({ className, ...rest }, ref) {
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
TooltipContent$1,
|
|
21
|
+
{
|
|
22
|
+
...rest,
|
|
23
|
+
className: className ? `xd-tooltip ${className}` : "xd-tooltip",
|
|
24
|
+
ref
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
var TooltipContent = forwardRef(
|
|
29
|
+
TooltipContentInner
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export { Tooltip, TooltipContent };
|
|
33
|
+
//# sourceMappingURL=index.mjs.map
|
|
34
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Tooltip.tsx","../src/components/TooltipContent.tsx"],"names":["UnstyledTooltip","jsx","UnstyledTooltipContent","forwardRef"],"mappings":";;;;;;AASA,SAAS,aACP,EAAE,SAAA,EAAW,GAAG,IAAA,IAChB,GAAA,EACA;AACA,EAAA,uBACE,GAAA;AAAA,IAACA,SAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,SAAA,EAAW,SAAA,GAAY,CAAA,gBAAA,EAAmB,SAAS,CAAA,CAAA,GAAK,iBAAA;AAAA,MACxD;AAAA;AAAA,GACF;AAEJ;AAEO,IAAM,OAAA,GAAU,WAA0C,YAAY;ACd7E,SAAS,oBACP,EAAE,SAAA,EAAW,GAAG,IAAA,IAChB,GAAA,EACA;AACA,EAAA,uBACEC,GAAAA;AAAA,IAACC,gBAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,SAAA,EAAW,SAAA,GAAY,CAAA,WAAA,EAAc,SAAS,CAAA,CAAA,GAAK,YAAA;AAAA,MACnD;AAAA;AAAA,GACF;AAEJ;AAEO,IAAM,cAAA,GAAiBC,UAAAA;AAAA,EAC5B;AACF","file":"index.mjs","sourcesContent":["import {\n Tooltip as UnstyledTooltip,\n type TooltipProps as UnstyledTooltipProps,\n} from '@asnewyla/unstyled-tooltip';\nimport { type ForwardedRef, forwardRef } from 'react';\nimport './Tooltip.css';\n\nexport type TooltipProps = UnstyledTooltipProps;\n\nfunction TooltipInner(\n { className, ...rest }: TooltipProps,\n ref: ForwardedRef<HTMLSpanElement>,\n) {\n return (\n <UnstyledTooltip\n {...rest}\n className={className ? `xd-tooltip-root ${className}` : 'xd-tooltip-root'}\n ref={ref}\n />\n );\n}\n\nexport const Tooltip = forwardRef<HTMLSpanElement, TooltipProps>(TooltipInner);\n","import {\n TooltipContent as UnstyledTooltipContent,\n type TooltipContentProps as UnstyledTooltipContentProps,\n} from '@asnewyla/unstyled-tooltip';\nimport { type ForwardedRef, forwardRef } from 'react';\n\nexport type TooltipContentProps = UnstyledTooltipContentProps;\n\nfunction TooltipContentInner(\n { className, ...rest }: TooltipContentProps,\n ref: ForwardedRef<HTMLSpanElement>,\n) {\n return (\n <UnstyledTooltipContent\n {...rest}\n className={className ? `xd-tooltip ${className}` : 'xd-tooltip'}\n ref={ref}\n />\n );\n}\n\nexport const TooltipContent = forwardRef<HTMLSpanElement, TooltipContentProps>(\n TooltipContentInner,\n);\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@asnewyla/tooltip",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Styled tooltip built on @asnewyla/unstyled-tooltip — CSS positioning per side, theme-aware bubble",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/xavierDelaFuente/xd-components.git",
|
|
9
|
+
"directory": "packages/tooltip"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"module": "dist/index.mjs",
|
|
16
|
+
"types": "dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.mjs",
|
|
21
|
+
"require": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./styles.css": "./dist/index.css"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"sideEffects": [
|
|
29
|
+
"*.css"
|
|
30
|
+
],
|
|
31
|
+
"keywords": [
|
|
32
|
+
"react",
|
|
33
|
+
"tooltip",
|
|
34
|
+
"styled",
|
|
35
|
+
"accessible"
|
|
36
|
+
],
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
39
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@asnewyla/unstyled-tooltip": "0.2.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@testing-library/jest-dom": "^6.4.0",
|
|
46
|
+
"@testing-library/react": "^16.0.0",
|
|
47
|
+
"@testing-library/user-event": "^14.5.0",
|
|
48
|
+
"@vitest/coverage-v8": "^2.0.0",
|
|
49
|
+
"jsdom": "^24.0.0",
|
|
50
|
+
"react": "^18.3.0",
|
|
51
|
+
"react-dom": "^18.3.0",
|
|
52
|
+
"tsup": "^8.1.0",
|
|
53
|
+
"typescript": "^5.5.0",
|
|
54
|
+
"vitest": "^2.0.0"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsup",
|
|
58
|
+
"test": "vitest run",
|
|
59
|
+
"test:watch": "vitest",
|
|
60
|
+
"test:coverage": "vitest run --coverage",
|
|
61
|
+
"type-check": "tsc --noEmit"
|
|
62
|
+
}
|
|
63
|
+
}
|