@gridui/tooltip 0.0.0-stage → 0.0.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/README.md CHANGED
@@ -1,3 +1,48 @@
1
- # Temporary Holding Version
1
+ # @gridui/tooltip
2
+
3
+ Core family. Public API: `Tooltip`, `TooltipContent`, `TooltipContentProps`, `TooltipProps`, `TooltipProvider`, `TooltipProviderProps`, `TooltipTrigger`, `TooltipTriggerProps`.
4
+
5
+ Import components from `@gridui/tooltip` and load `@gridui/tooltip/styles.css` after Theme.
6
+ Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
7
+
8
+ See [component ownership](../../docs/component-ownership.md) and [release history](.changeset/history/).
9
+
10
+ ## Tooltips
11
+
12
+ Controls owns composable Tooltip primitives for supplemental button and link
13
+ hints. The [Controls contract](../../docs/component-ownership.md) owns timing,
14
+ controlled state, native trigger composition, portal styling, positioning,
15
+ accessibility, and content limits. Applications own clipboard state and localized labels.
16
+
17
+
18
+ ## Implementation and lifecycle
19
+
20
+ Use `TooltipProvider` around a related action group, then compose `Tooltip`,
21
+ `TooltipTrigger`, and `TooltipContent`. The provider defaults to a 300ms hover
22
+ delay; keyboard focus opens immediately. Native Radix provider/root props expose
23
+ shared timing and controlled or uncontrolled state. `TooltipTrigger` defaults to
24
+ `asChild`, preserving a single native button or link, its ref, and event handlers.
25
+ Keep the trigger's accessible name even when a tooltip repeats it.
26
+
27
+ `TooltipContent` forwards native content props and refs, defaults to an 8px side
28
+ offset and 16px collision padding, and portals into `document.body`. The portal
29
+ avoids clipping and uses the document theme's semantic palette. Use `container`
30
+ when a different portal host is required, and `className`, `style`, `side`, or
31
+ `align` for local presentation. Entry/exit motion respects reduced motion.
32
+ Radix owns description association, hoverable content, Escape dismissal, and
33
+ viewport collisions. Content is supplemental, noninteractive text; use a popover
34
+ for interactive content. Disabled native controls do not receive focus; essential
35
+ instructions must also be available outside the tooltip. Consumers own copy,
36
+ localization, and business state.
37
+
38
+ ```tsx
39
+ <TooltipProvider>
40
+ <Tooltip>
41
+ <TooltipTrigger>
42
+ <Button aria-label="Copy prompt">Copy</Button>
43
+ </TooltipTrigger>
44
+ <TooltipContent>Copy prompt</TooltipContent>
45
+ </Tooltip>
46
+ </TooltipProvider>
47
+ ```
2
48
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Tooltip
4
+ * @namespace Root
5
+ * @description Index
6
+ */
7
+ export type { TooltipProps } from "./tooltip/tooltip";
8
+ export { Tooltip } from "./tooltip/tooltip";
9
+ export type { TooltipContentProps } from "./tooltip-content/tooltip-content";
10
+ export { TooltipContent } from "./tooltip-content/tooltip-content";
11
+ export type { TooltipProviderProps } from "./tooltip-provider/tooltip-provider";
12
+ export { TooltipProvider } from "./tooltip-provider/tooltip-provider";
13
+ export type { TooltipTriggerProps } from "./tooltip-trigger/tooltip-trigger";
14
+ export { TooltipTrigger } from "./tooltip-trigger/tooltip-trigger";
package/dist/index.js ADDED
@@ -0,0 +1,80 @@
1
+ // src/tooltip/tooltip.tsx
2
+ import * as Primitive from "@radix-ui/react-tooltip";
3
+ var Tooltip = Primitive.Root;
4
+
5
+ // src/tooltip-content/style.ts
6
+ import { cn } from "@gridui/style-utils";
7
+ import { cva } from "class-variance-authority";
8
+ var tooltipContentStyles = cva(cn(
9
+ "gridui-tooltip-content z-(--gridui-z-tooltip) box-border w-max max-w-[min(20rem,var(--radix-tooltip-content-available-width))]",
10
+ "p-gridui-8 border border-solid border-border rounded-control bg-background text-foreground type-supporting wrap-anywhere",
11
+ "data-[state='closed']:pointer-events-none"
12
+ ));
13
+
14
+ // src/tooltip-content/tooltip-content.tsx
15
+ import { cn as cn2 } from "@gridui/style-utils";
16
+ import * as Primitive2 from "@radix-ui/react-tooltip";
17
+ import { jsx } from "react/jsx-runtime";
18
+ var TooltipContent = (props) => {
19
+ const {
20
+ container,
21
+ forceMount,
22
+ className,
23
+ sideOffset = 8,
24
+ collisionPadding = 16,
25
+ ...restProps
26
+ } = props;
27
+ const mountProps = forceMount ? { forceMount } : {};
28
+ return /* @__PURE__ */ jsx(
29
+ Primitive2.Portal,
30
+ {
31
+ ...mountProps,
32
+ container,
33
+ children: /* @__PURE__ */ jsx(
34
+ Primitive2.Content,
35
+ {
36
+ ...mountProps,
37
+ ...restProps,
38
+ sideOffset,
39
+ collisionPadding,
40
+ className: cn2(tooltipContentStyles(), className)
41
+ }
42
+ )
43
+ }
44
+ );
45
+ };
46
+
47
+ // src/tooltip-provider/tooltip-provider.tsx
48
+ import * as Primitive3 from "@radix-ui/react-tooltip";
49
+ import { jsx as jsx2 } from "react/jsx-runtime";
50
+ var TooltipProvider = (props) => {
51
+ const { delayDuration = 300, ...restProps } = props;
52
+ return /* @__PURE__ */ jsx2(
53
+ Primitive3.Provider,
54
+ {
55
+ ...restProps,
56
+ delayDuration
57
+ }
58
+ );
59
+ };
60
+
61
+ // src/tooltip-trigger/tooltip-trigger.tsx
62
+ import * as Primitive4 from "@radix-ui/react-tooltip";
63
+ import { jsx as jsx3 } from "react/jsx-runtime";
64
+ var TooltipTrigger = (props) => {
65
+ const { asChild = true, ...restProps } = props;
66
+ return /* @__PURE__ */ jsx3(
67
+ Primitive4.Trigger,
68
+ {
69
+ ...restProps,
70
+ asChild
71
+ }
72
+ );
73
+ };
74
+ export {
75
+ Tooltip,
76
+ TooltipContent,
77
+ TooltipProvider,
78
+ TooltipTrigger
79
+ };
80
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/tooltip/tooltip.tsx", "../src/tooltip-content/style.ts", "../src/tooltip-content/tooltip-content.tsx", "../src/tooltip-provider/tooltip-provider.tsx", "../src/tooltip-trigger/tooltip-trigger.tsx"],
4
+ "sourcesContent": ["/**\n * @author WMXPY\n * @package Tooltip\n * @namespace Tooltip\n * @description Tooltip\n */\n\nimport * as Primitive from \"@radix-ui/react-tooltip\";\nimport type { ComponentPropsWithRef } from \"react\";\n\nexport type TooltipProps = ComponentPropsWithRef<typeof Primitive.Root>;\n\nexport const Tooltip = Primitive.Root;\n", "/**\n * @author WMXPY\n * @package Tooltip\n * @namespace TooltipContent\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const tooltipContentStyles = cva(cn(\n \"gridui-tooltip-content z-(--gridui-z-tooltip) box-border w-max max-w-[min(20rem,var(--radix-tooltip-content-available-width))]\",\n \"p-gridui-8 border border-solid border-border rounded-control bg-background text-foreground type-supporting wrap-anywhere\",\n \"data-[state='closed']:pointer-events-none\",\n));\n", "/**\n * @author WMXPY\n * @package Tooltip\n * @namespace TooltipContent\n * @description Tooltip Content\n */\n\nimport { tooltipContentStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-tooltip\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type TooltipContentProps = ComponentPropsWithRef<typeof Primitive.Content> & {\n readonly container?: ComponentPropsWithRef<typeof Primitive.Portal>[\"container\"];\n};\n\nexport const TooltipContent: FC<TooltipContentProps> = (props: TooltipContentProps) => {\n const {\n container,\n forceMount,\n className,\n sideOffset = 8,\n collisionPadding = 16,\n ...restProps\n } = props;\n const mountProps = forceMount ? { forceMount } : {};\n return (<Primitive.Portal\n {...mountProps}\n container={container}\n >\n <Primitive.Content\n {...mountProps}\n {...restProps}\n sideOffset={sideOffset}\n collisionPadding={collisionPadding}\n className={cn(tooltipContentStyles(), className)}\n />\n </Primitive.Portal>);\n};\n", "/**\n * @author WMXPY\n * @package Tooltip\n * @namespace TooltipProvider\n * @description Tooltip Provider\n */\n\nimport * as Primitive from \"@radix-ui/react-tooltip\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type TooltipProviderProps = ComponentPropsWithRef<typeof Primitive.Provider>;\n\nexport const TooltipProvider: FC<TooltipProviderProps> = (props: TooltipProviderProps) => {\n const { delayDuration = 300, ...restProps } = props;\n return (<Primitive.Provider\n {...restProps}\n delayDuration={delayDuration}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Tooltip\n * @namespace TooltipTrigger\n * @description Tooltip Trigger\n */\n\nimport * as Primitive from \"@radix-ui/react-tooltip\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type TooltipTriggerProps = ComponentPropsWithRef<typeof Primitive.Trigger>;\n\nexport const TooltipTrigger: FC<TooltipTriggerProps> = (props: TooltipTriggerProps) => {\n const { asChild = true, ...restProps } = props;\n return (<Primitive.Trigger\n {...restProps}\n asChild={asChild}\n />);\n};\n"],
5
+ "mappings": ";AAOA,YAAY,eAAe;AAKpB,IAAM,UAAoB;;;ACLjC,SAAS,UAAU;AACnB,SAAS,WAAW;AAEb,IAAM,uBAAuB,IAAI;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AACJ,CAAC;;;ACND,SAAS,MAAAA,WAAU;AACnB,YAAYC,gBAAe;AAqBnB;AAdD,IAAM,iBAA0C,CAAC,UAA+B;AACnF,QAAM;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb,mBAAmB;AAAA,IACnB,GAAG;AAAA,EACP,IAAI;AACJ,QAAM,aAAa,aAAa,EAAE,WAAW,IAAI,CAAC;AAClD,SAAQ;AAAA,IAAW;AAAA,IAAV;AAAA,MACJ,GAAG;AAAA,MACJ;AAAA,MAEA;AAAA,QAAW;AAAA,QAAV;AAAA,UACI,GAAG;AAAA,UACH,GAAG;AAAA,UACJ;AAAA,UACA;AAAA,UACA,WAAWD,IAAG,qBAAqB,GAAG,SAAS;AAAA;AAAA,MACnD;AAAA;AAAA,EACJ;AACJ;;;AC/BA,YAAYE,gBAAe;AAOf,gBAAAC,YAAA;AAFL,IAAM,kBAA4C,CAAC,UAAgC;AACtF,QAAM,EAAE,gBAAgB,KAAK,GAAG,UAAU,IAAI;AAC9C,SAAQ,gBAAAA;AAAA,IAAW;AAAA,IAAV;AAAA,MACJ,GAAG;AAAA,MACJ;AAAA;AAAA,EACJ;AACJ;;;ACXA,YAAYC,gBAAe;AAOf,gBAAAC,YAAA;AAFL,IAAM,iBAA0C,CAAC,UAA+B;AACnF,QAAM,EAAE,UAAU,MAAM,GAAG,UAAU,IAAI;AACzC,SAAQ,gBAAAA;AAAA,IAAW;AAAA,IAAV;AAAA,MACJ,GAAG;AAAA,MACJ;AAAA;AAAA,EACJ;AACJ;",
6
+ "names": ["cn", "Primitive", "Primitive", "jsx", "Primitive", "jsx"]
7
+ }
@@ -0,0 +1,96 @@
1
+ /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
+ @layer properties;
3
+ @layer theme, base, components, utilities;
4
+ @layer utilities {
5
+ .z-\(--gridui-z-tooltip\) {
6
+ z-index: var(--gridui-z-tooltip);
7
+ }
8
+ .container {
9
+ width: 100%;
10
+ @media (width >= 40rem) {
11
+ max-width: 40rem;
12
+ }
13
+ @media (width >= 48rem) {
14
+ max-width: 48rem;
15
+ }
16
+ @media (width >= 64rem) {
17
+ max-width: 64rem;
18
+ }
19
+ @media (width >= 80rem) {
20
+ max-width: 80rem;
21
+ }
22
+ @media (width >= 96rem) {
23
+ max-width: 96rem;
24
+ }
25
+ }
26
+ .box-border {
27
+ box-sizing: border-box;
28
+ }
29
+ .w-max {
30
+ width: max-content;
31
+ }
32
+ .max-w-\[min\(20rem\,var\(--radix-tooltip-content-available-width\)\)\] {
33
+ max-width: min(20rem, var(--radix-tooltip-content-available-width));
34
+ }
35
+ .rounded-control {
36
+ border-radius: var(--gridui-control-radius);
37
+ }
38
+ .border {
39
+ border-style: var(--tw-border-style);
40
+ border-width: 1px;
41
+ }
42
+ .border-solid {
43
+ --tw-border-style: solid;
44
+ border-style: solid;
45
+ }
46
+ .border-border {
47
+ border-color: var(--gridui-border);
48
+ }
49
+ .bg-background {
50
+ background-color: var(--gridui-background);
51
+ }
52
+ .p-gridui-8 {
53
+ padding: var(--gridui-space-8);
54
+ }
55
+ .type-supporting {
56
+ font: var(--gridui-type-supporting);
57
+ letter-spacing: normal;
58
+ }
59
+ .wrap-anywhere {
60
+ overflow-wrap: anywhere;
61
+ }
62
+ .text-foreground {
63
+ color: var(--gridui-foreground);
64
+ }
65
+ .data-\[state\=\'closed\'\]\:pointer-events-none[data-state='closed'] {
66
+ pointer-events: none;
67
+ }
68
+ }
69
+ @layer components {
70
+ .gridui-tooltip-content {
71
+ transform-origin: var(--radix-tooltip-content-transform-origin);
72
+ }
73
+ .gridui-tooltip-content[data-state="delayed-open"], .gridui-tooltip-content[data-state="instant-open"] {
74
+ animation: gridui-surface-enter var(--gridui-motion-duration-quick) var(--gridui-motion-ease-out) both;
75
+ }
76
+ .gridui-tooltip-content[data-state="closed"] {
77
+ animation: gridui-surface-exit var(--gridui-motion-duration-quick) var(--gridui-motion-ease-in) both;
78
+ }
79
+ @media (prefers-reduced-motion: reduce) {
80
+ .gridui-tooltip-content[data-state] {
81
+ animation: none;
82
+ }
83
+ }
84
+ }
85
+ @property --tw-border-style {
86
+ syntax: "*";
87
+ inherits: false;
88
+ initial-value: solid;
89
+ }
90
+ @layer properties {
91
+ @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
92
+ *, ::before, ::after, ::backdrop {
93
+ --tw-border-style: solid;
94
+ }
95
+ }
96
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Tooltip
4
+ * @namespace Tooltip
5
+ * @description Tooltip
6
+ */
7
+ import * as Primitive from "@radix-ui/react-tooltip";
8
+ import type { ComponentPropsWithRef } from "react";
9
+ export type TooltipProps = ComponentPropsWithRef<typeof Primitive.Root>;
10
+ export declare const Tooltip: import("react").FC<Primitive.TooltipProps>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Tooltip
4
+ * @namespace TooltipContent
5
+ * @description Style
6
+ */
7
+ export declare const tooltipContentStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Tooltip
4
+ * @namespace TooltipContent
5
+ * @description Tooltip Content
6
+ */
7
+ import * as Primitive from "@radix-ui/react-tooltip";
8
+ import type { ComponentPropsWithRef, FC } from "react";
9
+ export type TooltipContentProps = ComponentPropsWithRef<typeof Primitive.Content> & {
10
+ readonly container?: ComponentPropsWithRef<typeof Primitive.Portal>["container"];
11
+ };
12
+ export declare const TooltipContent: FC<TooltipContentProps>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Tooltip
4
+ * @namespace TooltipProvider
5
+ * @description Tooltip Provider
6
+ */
7
+ import * as Primitive from "@radix-ui/react-tooltip";
8
+ import type { ComponentPropsWithRef, FC } from "react";
9
+ export type TooltipProviderProps = ComponentPropsWithRef<typeof Primitive.Provider>;
10
+ export declare const TooltipProvider: FC<TooltipProviderProps>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Tooltip
4
+ * @namespace TooltipTrigger
5
+ * @description Tooltip Trigger
6
+ */
7
+ import * as Primitive from "@radix-ui/react-tooltip";
8
+ import type { ComponentPropsWithRef, FC } from "react";
9
+ export type TooltipTriggerProps = ComponentPropsWithRef<typeof Primitive.Trigger>;
10
+ export declare const TooltipTrigger: FC<TooltipTriggerProps>;
package/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "@gridui/tooltip",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.0.0",
4
+ "description": "GridUI React tooltip",
5
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
11
+ "sideEffects": [
12
+ "**/*.css"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ },
19
+ "./styles.css": "./dist/styles.css"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "peerDependencies": {
25
+ "react": "^19.2.0",
26
+ "react-dom": "^19.2.0"
27
+ },
28
+ "dependencies": {
29
+ "@gridui/style-utils": "^2.1.2",
30
+ "@gridui/theme": "^2.1.2",
31
+ "@radix-ui/react-tooltip": "1.4.1",
32
+ "class-variance-authority": "0.7.1"
33
+ },
34
+ "devDependencies": {
35
+ "@gridui-internal/configuration": "0.0.0",
36
+ "@jest/globals": "30.5.2",
37
+ "@types/jest": "30.0.0",
38
+ "@types/node": "26.6.5",
39
+ "@types/react": "19.3.0",
40
+ "@types/react-dom": "19.3.0",
41
+ "jest": "30.5.2",
42
+ "react": "19.3.1",
43
+ "react-dom": "19.3.1",
44
+ "typescript": "6.0.3"
45
+ },
46
+ "scripts": {
47
+ "build": "node ../../scripts/compilation/package.ts",
48
+ "compile": "tsc --project tsconfig.json",
49
+ "test": "jest --passWithNoTests",
50
+ "coverage": "jest --coverage --passWithNoTests"
51
+ }
6
52
  }