@gridui/tooltip 1.0.5 → 1.0.7
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 +2 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/styles.css +8 -8
- package/docs/catalog.json +8 -2
- package/docs/reference/README.md +7 -0
- package/docs/reference/tooltip-content.md +140 -0
- package/docs/reference/tooltip-provider.md +47 -0
- package/docs/reference/tooltip-trigger.md +63 -0
- package/docs/reference/tooltip.md +58 -0
- package/package.json +4 -4
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -25,8 +25,8 @@ import { cn } from "@gridui/style-utils";
|
|
|
25
25
|
import { cva } from "class-variance-authority";
|
|
26
26
|
var tooltipContentStyles = cva(cn(
|
|
27
27
|
overlaySurfaceStyles({ kind: "tooltip" }),
|
|
28
|
-
"gridui-tooltip-content gridui-u-z-(--gridui-z-tooltip) gridui-u-box-border gridui-u-w-max gridui-u-max-w-[min(20rem,var(--radix-tooltip-content-available-width))]",
|
|
29
|
-
"gridui-u-p-gridui-8 gridui-u-type-supporting gridui-u-wrap-anywhere"
|
|
28
|
+
"gridui-tooltip-content gridui-u-tooltip--z-(--gridui-z-tooltip) gridui-u-tooltip--box-border gridui-u-tooltip--w-max gridui-u-tooltip--max-w-[min(20rem,var(--radix-tooltip-content-available-width))]",
|
|
29
|
+
"gridui-u-tooltip--p-gridui-8 gridui-u-tooltip--type-supporting gridui-u-tooltip--wrap-anywhere"
|
|
30
30
|
));
|
|
31
31
|
|
|
32
32
|
// src/tooltip-content/tooltip-content.tsx
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 { OverlayOpen, useOverlayState } from \"@gridui/overlay\";\nimport * as Primitive from \"@radix-ui/react-tooltip\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type TooltipProps = ComponentPropsWithRef<typeof Primitive.Root>;\n\nexport const Tooltip: FC<TooltipProps> = (props: TooltipProps) => {\n const state = useOverlayState(props);\n return (<OverlayOpen.Provider\n value={state.open}\n >\n <Primitive.Root\n {...props}\n {...state}\n />\n </OverlayOpen.Provider>);\n};\n", "/**\n * @author WMXPY\n * @package Tooltip\n * @namespace TooltipContent\n * @description Style\n */\n\nimport { overlaySurfaceStyles } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const tooltipContentStyles = cva(cn(\n overlaySurfaceStyles({ kind: \"tooltip\" }),\n \"gridui-tooltip-content gridui-u-z-(--gridui-z-tooltip) gridui-u-box-border gridui-u-w-max gridui-u-max-w-[min(20rem,var(--radix-tooltip-content-available-width))]\",\n \"gridui-u-p-gridui-8 gridui-u-type-supporting gridui-u-wrap-anywhere\",\n));\n", "/**\n * @author WMXPY\n * @package Tooltip\n * @namespace TooltipContent\n * @description Tooltip Content\n */\n\nimport { tooltipContentStyles } from \"./style\";\nimport { RetainedLayer } from \"@gridui/overlay\";\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 const content = (<Primitive.Content\n {...mountProps}\n {...restProps}\n sideOffset={sideOffset}\n collisionPadding={collisionPadding}\n className={cn(tooltipContentStyles(), className)}\n />);\n return (<Primitive.Portal\n {...mountProps}\n container={container}\n >\n {forceMount ? (<RetainedLayer>\n {content}\n </RetainedLayer>) : content}\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"],
|
|
4
|
+
"sourcesContent": ["/**\n * @author WMXPY\n * @package Tooltip\n * @namespace Tooltip\n * @description Tooltip\n */\n\nimport { OverlayOpen, useOverlayState } from \"@gridui/overlay\";\nimport * as Primitive from \"@radix-ui/react-tooltip\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type TooltipProps = ComponentPropsWithRef<typeof Primitive.Root>;\n\nexport const Tooltip: FC<TooltipProps> = (props: TooltipProps) => {\n const state = useOverlayState(props);\n return (<OverlayOpen.Provider\n value={state.open}\n >\n <Primitive.Root\n {...props}\n {...state}\n />\n </OverlayOpen.Provider>);\n};\n", "/**\n * @author WMXPY\n * @package Tooltip\n * @namespace TooltipContent\n * @description Style\n */\n\nimport { overlaySurfaceStyles } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const tooltipContentStyles = cva(cn(\n overlaySurfaceStyles({ kind: \"tooltip\" }),\n \"gridui-tooltip-content gridui-u-tooltip--z-(--gridui-z-tooltip) gridui-u-tooltip--box-border gridui-u-tooltip--w-max gridui-u-tooltip--max-w-[min(20rem,var(--radix-tooltip-content-available-width))]\",\n \"gridui-u-tooltip--p-gridui-8 gridui-u-tooltip--type-supporting gridui-u-tooltip--wrap-anywhere\",\n));\n", "/**\n * @author WMXPY\n * @package Tooltip\n * @namespace TooltipContent\n * @description Tooltip Content\n */\n\nimport { tooltipContentStyles } from \"./style\";\nimport { RetainedLayer } from \"@gridui/overlay\";\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 const content = (<Primitive.Content\n {...mountProps}\n {...restProps}\n sideOffset={sideOffset}\n collisionPadding={collisionPadding}\n className={cn(tooltipContentStyles(), className)}\n />);\n return (<Primitive.Portal\n {...mountProps}\n container={container}\n >\n {forceMount ? (<RetainedLayer>\n {content}\n </RetainedLayer>) : content}\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
5
|
"mappings": ";AAOA,SAAS,aAAa,uBAAuB;AAC7C,YAAY,eAAe;AAUnB;AALD,IAAM,UAA4B,CAAC,UAAwB;AAC9D,QAAM,QAAQ,gBAAgB,KAAK;AACnC,SAAQ;AAAA,IAAC,YAAY;AAAA,IAAZ;AAAA,MACL,OAAO,MAAM;AAAA,MAEb;AAAA,QAAW;AAAA,QAAV;AAAA,UACI,GAAG;AAAA,UACH,GAAG;AAAA;AAAA,MACR;AAAA;AAAA,EACJ;AACJ;;;AChBA,SAAS,4BAA4B;AACrC,SAAS,UAAU;AACnB,SAAS,WAAW;AAEb,IAAM,uBAAuB,IAAI;AAAA,EACpC,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAAA,EACxC;AAAA,EACA;AACJ,CAAC;;;ACPD,SAAS,qBAAqB;AAC9B,SAAS,MAAAA,WAAU;AACnB,YAAYC,gBAAe;AAiBN,gBAAAC,YAAA;AAVd,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,QAAM,UAAW,gBAAAA;AAAA,IAAW;AAAA,IAAV;AAAA,MACb,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA,WAAWF,IAAG,qBAAqB,GAAG,SAAS;AAAA;AAAA,EACnD;AACA,SAAQ,gBAAAE;AAAA,IAAW;AAAA,IAAV;AAAA,MACJ,GAAG;AAAA,MACJ;AAAA,MAEC,uBAAc,gBAAAA,KAAC,iBACX,mBACL,IAAoB;AAAA;AAAA,EACxB;AACJ;;;ACnCA,YAAYC,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
6
|
"names": ["cn", "Primitive", "jsx", "Primitive", "jsx", "Primitive", "jsx"]
|
|
7
7
|
}
|
package/dist/styles.css
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
/*! tailwindcss v4.3.
|
|
1
|
+
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer theme, base, components, utilities;
|
|
3
3
|
@layer utilities {
|
|
4
|
-
.gridui-u-z-\(--gridui-z-tooltip\) {
|
|
4
|
+
.gridui-u-tooltip--z-\(--gridui-z-tooltip\) {
|
|
5
5
|
z-index: var(--gridui-z-tooltip);
|
|
6
6
|
}
|
|
7
|
-
.gridui-u-box-border {
|
|
7
|
+
.gridui-u-tooltip--box-border {
|
|
8
8
|
box-sizing: border-box;
|
|
9
9
|
}
|
|
10
|
-
.gridui-u-w-max {
|
|
10
|
+
.gridui-u-tooltip--w-max {
|
|
11
11
|
width: max-content;
|
|
12
12
|
}
|
|
13
|
-
.gridui-u-max-w-\[min\(20rem\,var\(--radix-tooltip-content-available-width\)\)\] {
|
|
13
|
+
.gridui-u-tooltip--max-w-\[min\(20rem\,var\(--radix-tooltip-content-available-width\)\)\] {
|
|
14
14
|
max-width: min(20rem, var(--radix-tooltip-content-available-width));
|
|
15
15
|
}
|
|
16
|
-
.gridui-u-p-gridui-8 {
|
|
16
|
+
.gridui-u-tooltip--p-gridui-8 {
|
|
17
17
|
padding: var(--gridui-space-8);
|
|
18
18
|
}
|
|
19
|
-
.gridui-u-type-supporting {
|
|
19
|
+
.gridui-u-tooltip--type-supporting {
|
|
20
20
|
font: var(--gridui-type-supporting);
|
|
21
21
|
letter-spacing: normal;
|
|
22
22
|
}
|
|
23
|
-
.gridui-u-wrap-anywhere {
|
|
23
|
+
.gridui-u-tooltip--wrap-anywhere {
|
|
24
24
|
overflow-wrap: anywhere;
|
|
25
25
|
}
|
|
26
26
|
}
|
package/docs/catalog.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "@gridui/tooltip",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.7",
|
|
5
5
|
"category": "core",
|
|
6
6
|
"description": "GridUI React tooltip",
|
|
7
7
|
"usage": "The Tooltip family owns composable primitives for supplemental button and link hints. This family owns timing, controlled state, native trigger composition, portal styling, positioning, accessibility, and content limits. Applications own clipboard state and localized labels.",
|
|
8
8
|
"documentation": [
|
|
9
|
-
"README.md"
|
|
9
|
+
"README.md",
|
|
10
|
+
"docs/reference/README.md",
|
|
11
|
+
"docs/reference/tooltip-content.md",
|
|
12
|
+
"docs/reference/tooltip-provider.md",
|
|
13
|
+
"docs/reference/tooltip-trigger.md",
|
|
14
|
+
"docs/reference/tooltip.md"
|
|
10
15
|
],
|
|
11
16
|
"exports": [
|
|
12
17
|
{
|
|
@@ -56,6 +61,7 @@
|
|
|
56
61
|
"@gridui/tooltip/styles.css"
|
|
57
62
|
],
|
|
58
63
|
"examples": [
|
|
64
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/tooltip/stories/hints.mdx",
|
|
59
65
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/tooltip/stories/tooltip.stories.tsx"
|
|
60
66
|
]
|
|
61
67
|
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# TooltipContent
|
|
3
|
+
|
|
4
|
+
Compose TooltipContent with Tooltip inside the same @gridui/tooltip component family.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/tooltip`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { TooltipContent } from "@gridui/tooltip";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/tooltip/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/tooltip/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/tooltip/stories/tooltip.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
|
+
|
|
22
|
+
### forceMount
|
|
23
|
+
|
|
24
|
+
``true | undefined`` · Optional
|
|
25
|
+
|
|
26
|
+
Used to force mounting when more control is needed. Useful when
|
|
27
|
+
controlling animation with React animation libraries.
|
|
28
|
+
|
|
29
|
+
### aria-label
|
|
30
|
+
|
|
31
|
+
``string | undefined`` · Optional
|
|
32
|
+
|
|
33
|
+
A more descriptive label for accessibility purpose
|
|
34
|
+
|
|
35
|
+
### onEscapeKeyDown
|
|
36
|
+
|
|
37
|
+
``(event: KeyboardEvent): void`` · Optional
|
|
38
|
+
|
|
39
|
+
Event handler called when the escape key is down.
|
|
40
|
+
Can be prevented.
|
|
41
|
+
|
|
42
|
+
### onPointerDownOutside
|
|
43
|
+
|
|
44
|
+
``(event: CustomEvent<{ originalEvent: PointerEvent; }>): void`` · Optional
|
|
45
|
+
|
|
46
|
+
Event handler called when the a `pointerdown` event happens outside of the `Tooltip`.
|
|
47
|
+
Can be prevented.
|
|
48
|
+
|
|
49
|
+
### children
|
|
50
|
+
|
|
51
|
+
``ReactNode`` · Optional
|
|
52
|
+
|
|
53
|
+
Content rendered inside the component.
|
|
54
|
+
|
|
55
|
+
### onFocus
|
|
56
|
+
|
|
57
|
+
``(event: FocusEvent<HTMLDivElement, Element>): void`` · Optional
|
|
58
|
+
|
|
59
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
60
|
+
|
|
61
|
+
### onBlur
|
|
62
|
+
|
|
63
|
+
``(event: FocusEvent<HTMLDivElement, Element>): void`` · Optional
|
|
64
|
+
|
|
65
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
66
|
+
|
|
67
|
+
### onChange
|
|
68
|
+
|
|
69
|
+
``(event: ChangeEvent<HTMLDivElement, Element>): void`` · Optional
|
|
70
|
+
|
|
71
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
72
|
+
|
|
73
|
+
### onSubmit
|
|
74
|
+
|
|
75
|
+
``(event: SubmitEvent<HTMLDivElement>): void`` · Optional
|
|
76
|
+
|
|
77
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
78
|
+
|
|
79
|
+
### onClick
|
|
80
|
+
|
|
81
|
+
``(event: MouseEvent<HTMLDivElement, MouseEvent>): void`` · Optional
|
|
82
|
+
|
|
83
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
84
|
+
|
|
85
|
+
### asChild
|
|
86
|
+
|
|
87
|
+
``boolean | undefined`` · Optional
|
|
88
|
+
|
|
89
|
+
### side
|
|
90
|
+
|
|
91
|
+
``"left" | "right" | "top" | "bottom" | undefined`` · Optional
|
|
92
|
+
|
|
93
|
+
### sideOffset
|
|
94
|
+
|
|
95
|
+
``number | undefined`` · Optional
|
|
96
|
+
|
|
97
|
+
Default: ``8``
|
|
98
|
+
|
|
99
|
+
### align
|
|
100
|
+
|
|
101
|
+
``"center" | "start" | "end" | undefined`` · Optional
|
|
102
|
+
|
|
103
|
+
### alignOffset
|
|
104
|
+
|
|
105
|
+
``number | undefined`` · Optional
|
|
106
|
+
|
|
107
|
+
### arrowPadding
|
|
108
|
+
|
|
109
|
+
``number | undefined`` · Optional
|
|
110
|
+
|
|
111
|
+
### avoidCollisions
|
|
112
|
+
|
|
113
|
+
``boolean | undefined`` · Optional
|
|
114
|
+
|
|
115
|
+
### collisionBoundary
|
|
116
|
+
|
|
117
|
+
``(Element | null) | (Element | null)[] | undefined`` · Optional
|
|
118
|
+
|
|
119
|
+
### collisionPadding
|
|
120
|
+
|
|
121
|
+
``number | Partial<Record<"left" | "right" | "top" | "bottom", number>> | undefined`` · Optional
|
|
122
|
+
|
|
123
|
+
Default: ``16``
|
|
124
|
+
|
|
125
|
+
### sticky
|
|
126
|
+
|
|
127
|
+
``("partial" | "always") | undefined`` · Optional
|
|
128
|
+
|
|
129
|
+
### hideWhenDetached
|
|
130
|
+
|
|
131
|
+
``boolean | undefined`` · Optional
|
|
132
|
+
|
|
133
|
+
### updatePositionStrategy
|
|
134
|
+
|
|
135
|
+
``("always" | "optimized") | undefined`` · Optional
|
|
136
|
+
|
|
137
|
+
### container
|
|
138
|
+
|
|
139
|
+
``Element | DocumentFragment | null | undefined`` · Optional
|
|
140
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# TooltipProvider
|
|
3
|
+
|
|
4
|
+
Compose TooltipProvider with Tooltip inside the same @gridui/tooltip component family.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/tooltip`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { TooltipProvider } from "@gridui/tooltip";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/tooltip/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/tooltip/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/tooltip/stories/tooltip.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
|
+
|
|
22
|
+
### children
|
|
23
|
+
|
|
24
|
+
``ReactNode`` · Required
|
|
25
|
+
|
|
26
|
+
Content rendered inside the component.
|
|
27
|
+
|
|
28
|
+
### delayDuration
|
|
29
|
+
|
|
30
|
+
``number | undefined`` · Optional
|
|
31
|
+
|
|
32
|
+
Default: ``300``
|
|
33
|
+
|
|
34
|
+
The duration from when the pointer enters the trigger until the tooltip gets opened.
|
|
35
|
+
|
|
36
|
+
### skipDelayDuration
|
|
37
|
+
|
|
38
|
+
``number | undefined`` · Optional
|
|
39
|
+
|
|
40
|
+
How much time a user has to enter another trigger without incurring a delay again.
|
|
41
|
+
|
|
42
|
+
### disableHoverableContent
|
|
43
|
+
|
|
44
|
+
``boolean | undefined`` · Optional
|
|
45
|
+
|
|
46
|
+
When `true`, trying to hover the content will result in the tooltip closing as the pointer leaves the trigger.
|
|
47
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# TooltipTrigger
|
|
3
|
+
|
|
4
|
+
Compose TooltipTrigger with Tooltip inside the same @gridui/tooltip component family.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/tooltip`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { TooltipTrigger } from "@gridui/tooltip";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/tooltip/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/tooltip/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/tooltip/stories/tooltip.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
|
+
|
|
22
|
+
### children
|
|
23
|
+
|
|
24
|
+
``ReactNode`` · Optional
|
|
25
|
+
|
|
26
|
+
Content rendered inside the component.
|
|
27
|
+
|
|
28
|
+
### onFocus
|
|
29
|
+
|
|
30
|
+
``(event: FocusEvent<HTMLButtonElement, Element>): void`` · Optional
|
|
31
|
+
|
|
32
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
33
|
+
|
|
34
|
+
### onBlur
|
|
35
|
+
|
|
36
|
+
``(event: FocusEvent<HTMLButtonElement, Element>): void`` · Optional
|
|
37
|
+
|
|
38
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
39
|
+
|
|
40
|
+
### onChange
|
|
41
|
+
|
|
42
|
+
``(event: ChangeEvent<HTMLButtonElement, Element>): void`` · Optional
|
|
43
|
+
|
|
44
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
45
|
+
|
|
46
|
+
### onSubmit
|
|
47
|
+
|
|
48
|
+
``(event: SubmitEvent<HTMLButtonElement>): void`` · Optional
|
|
49
|
+
|
|
50
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
51
|
+
|
|
52
|
+
### onClick
|
|
53
|
+
|
|
54
|
+
``(event: MouseEvent<HTMLButtonElement, MouseEvent>): void`` · Optional
|
|
55
|
+
|
|
56
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
57
|
+
|
|
58
|
+
### asChild
|
|
59
|
+
|
|
60
|
+
``boolean | undefined`` · Optional
|
|
61
|
+
|
|
62
|
+
Default: ``true``
|
|
63
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# Tooltip
|
|
3
|
+
|
|
4
|
+
Provides a short supplemental hint on hover or keyboard focus. Use a Popover when the content contains interactive controls.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/tooltip`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { Tooltip } from "@gridui/tooltip";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/tooltip/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/tooltip/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/tooltip/stories/tooltip.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
|
+
|
|
22
|
+
### children
|
|
23
|
+
|
|
24
|
+
``ReactNode`` · Optional
|
|
25
|
+
|
|
26
|
+
Content rendered inside the component.
|
|
27
|
+
|
|
28
|
+
### open
|
|
29
|
+
|
|
30
|
+
``boolean | undefined`` · Optional
|
|
31
|
+
|
|
32
|
+
Controlled visibility. Pair with onOpenChange.
|
|
33
|
+
|
|
34
|
+
### defaultOpen
|
|
35
|
+
|
|
36
|
+
``boolean | undefined`` · Optional
|
|
37
|
+
|
|
38
|
+
Initial uncontrolled visibility. Reset the story after changing it.
|
|
39
|
+
|
|
40
|
+
### onOpenChange
|
|
41
|
+
|
|
42
|
+
``(open: boolean): void`` · Optional
|
|
43
|
+
|
|
44
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
45
|
+
|
|
46
|
+
### delayDuration
|
|
47
|
+
|
|
48
|
+
``number | undefined`` · Optional
|
|
49
|
+
|
|
50
|
+
The duration from when the pointer enters the trigger until the tooltip gets opened. This will
|
|
51
|
+
override the prop with the same name passed to Provider.
|
|
52
|
+
|
|
53
|
+
### disableHoverableContent
|
|
54
|
+
|
|
55
|
+
``boolean | undefined`` · Optional
|
|
56
|
+
|
|
57
|
+
When `true`, trying to hover the content will result in the tooltip closing as the pointer leaves the trigger.
|
|
58
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/tooltip",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "GridUI React tooltip",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
"react-dom": "^19.2.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@gridui/overlay": "^
|
|
31
|
-
"@gridui/style-utils": "^
|
|
30
|
+
"@gridui/overlay": "^2.0.0",
|
|
31
|
+
"@gridui/style-utils": "^4.0.0",
|
|
32
32
|
"@gridui/theme": "^2.5.3",
|
|
33
33
|
"@radix-ui/react-tooltip": "1.4.1",
|
|
34
34
|
"class-variance-authority": "0.7.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@gridui-internal/configuration": "0.0.0-internal",
|
|
38
|
-
"@gridui/button": "
|
|
38
|
+
"@gridui/button": "4.1.0",
|
|
39
39
|
"@jest/globals": "30.5.2",
|
|
40
40
|
"@storybook/react-vite": "10.6.6",
|
|
41
41
|
"@types/jest": "30.0.0",
|