@instructure/ui-tooltip 10.2.3-snapshot-3 → 10.2.3-snapshot-5
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 +1 -1
- package/package.json +17 -17
- package/src/Tooltip/README.md +92 -45
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [10.2.3-snapshot-
|
|
6
|
+
## [10.2.3-snapshot-5](https://github.com/instructure/instructure-ui/compare/v10.2.2...v10.2.3-snapshot-5) (2024-09-24)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-tooltip
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-tooltip",
|
|
3
|
-
"version": "10.2.3-snapshot-
|
|
3
|
+
"version": "10.2.3-snapshot-5",
|
|
4
4
|
"description": "A component for showing small text-only overlays on hover/focus.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -24,25 +24,25 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.24.5",
|
|
27
|
-
"@instructure/emotion": "10.2.3-snapshot-
|
|
28
|
-
"@instructure/shared-types": "10.2.3-snapshot-
|
|
29
|
-
"@instructure/ui-popover": "10.2.3-snapshot-
|
|
30
|
-
"@instructure/ui-position": "10.2.3-snapshot-
|
|
31
|
-
"@instructure/ui-prop-types": "10.2.3-snapshot-
|
|
32
|
-
"@instructure/ui-react-utils": "10.2.3-snapshot-
|
|
33
|
-
"@instructure/ui-testable": "10.2.3-snapshot-
|
|
34
|
-
"@instructure/ui-utils": "10.2.3-snapshot-
|
|
27
|
+
"@instructure/emotion": "10.2.3-snapshot-5",
|
|
28
|
+
"@instructure/shared-types": "10.2.3-snapshot-5",
|
|
29
|
+
"@instructure/ui-popover": "10.2.3-snapshot-5",
|
|
30
|
+
"@instructure/ui-position": "10.2.3-snapshot-5",
|
|
31
|
+
"@instructure/ui-prop-types": "10.2.3-snapshot-5",
|
|
32
|
+
"@instructure/ui-react-utils": "10.2.3-snapshot-5",
|
|
33
|
+
"@instructure/ui-testable": "10.2.3-snapshot-5",
|
|
34
|
+
"@instructure/ui-utils": "10.2.3-snapshot-5",
|
|
35
35
|
"prop-types": "^15.8.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@instructure/ui-axe-check": "10.2.3-snapshot-
|
|
39
|
-
"@instructure/ui-babel-preset": "10.2.3-snapshot-
|
|
40
|
-
"@instructure/ui-color-utils": "10.2.3-snapshot-
|
|
41
|
-
"@instructure/ui-scripts": "10.2.3-snapshot-
|
|
42
|
-
"@instructure/ui-test-locator": "10.2.3-snapshot-
|
|
43
|
-
"@instructure/ui-test-queries": "10.2.3-snapshot-
|
|
44
|
-
"@instructure/ui-test-utils": "10.2.3-snapshot-
|
|
45
|
-
"@instructure/ui-themes": "10.2.3-snapshot-
|
|
38
|
+
"@instructure/ui-axe-check": "10.2.3-snapshot-5",
|
|
39
|
+
"@instructure/ui-babel-preset": "10.2.3-snapshot-5",
|
|
40
|
+
"@instructure/ui-color-utils": "10.2.3-snapshot-5",
|
|
41
|
+
"@instructure/ui-scripts": "10.2.3-snapshot-5",
|
|
42
|
+
"@instructure/ui-test-locator": "10.2.3-snapshot-5",
|
|
43
|
+
"@instructure/ui-test-queries": "10.2.3-snapshot-5",
|
|
44
|
+
"@instructure/ui-test-utils": "10.2.3-snapshot-5",
|
|
45
|
+
"@instructure/ui-themes": "10.2.3-snapshot-5",
|
|
46
46
|
"@testing-library/jest-dom": "^6.4.6",
|
|
47
47
|
"@testing-library/react": "^15.0.7",
|
|
48
48
|
"@testing-library/user-event": "^14.5.2",
|
package/src/Tooltip/README.md
CHANGED
|
@@ -59,74 +59,121 @@ type: example
|
|
|
59
59
|
|
|
60
60
|
#### Controlled Tooltips
|
|
61
61
|
|
|
62
|
-
```js
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
- ```js
|
|
63
|
+
class Example extends React.Component {
|
|
64
|
+
constructor(props) {
|
|
65
|
+
super(props)
|
|
66
|
+
|
|
67
|
+
this.state = {
|
|
68
|
+
isShowingContent: false
|
|
69
|
+
}
|
|
70
|
+
}
|
|
69
71
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
render() {
|
|
73
|
+
return (
|
|
74
|
+
<>
|
|
75
|
+
<p>
|
|
76
|
+
<Tooltip
|
|
77
|
+
renderTip="Hello. I'm a tool tip"
|
|
78
|
+
isShowingContent={this.state.isShowingContent}
|
|
79
|
+
onShowContent={(e) => {
|
|
80
|
+
console.log('expecting to show tooltip')
|
|
81
|
+
}}
|
|
82
|
+
onHideContent={(e) => {
|
|
83
|
+
console.log('expecting to hide tooltip')
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
<Link href="#">This link has a tooltip</Link>
|
|
87
|
+
</Tooltip>
|
|
88
|
+
</p>
|
|
89
|
+
<Checkbox
|
|
90
|
+
label="show tooltip?"
|
|
91
|
+
variant="toggle"
|
|
92
|
+
value="toggled"
|
|
93
|
+
onChange={(event) => {
|
|
94
|
+
this.setState({ isShowingContent: event.target.checked })
|
|
95
|
+
}}
|
|
96
|
+
/>
|
|
97
|
+
</>
|
|
98
|
+
)
|
|
72
99
|
}
|
|
73
100
|
}
|
|
74
101
|
|
|
75
|
-
render
|
|
102
|
+
render(<Example />)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
- ```js
|
|
106
|
+
const Example = () => {
|
|
107
|
+
const [isShowingContent, setIsShowingContent] = useState(false)
|
|
108
|
+
|
|
76
109
|
return (
|
|
77
110
|
<>
|
|
78
111
|
<p>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
112
|
+
<Tooltip
|
|
113
|
+
renderTip="Hello. I'm a tool tip"
|
|
114
|
+
isShowingContent={isShowingContent}
|
|
115
|
+
onShowContent={(e) => {
|
|
116
|
+
console.log('expecting to show tooltip')
|
|
117
|
+
}}
|
|
118
|
+
onHideContent={(e) => {
|
|
119
|
+
console.log('expecting to hide tooltip')
|
|
120
|
+
}}
|
|
121
|
+
>
|
|
122
|
+
<Link href="#">This link has a tooltip</Link>
|
|
123
|
+
</Tooltip>
|
|
91
124
|
</p>
|
|
92
125
|
<Checkbox
|
|
93
126
|
label="show tooltip?"
|
|
94
127
|
variant="toggle"
|
|
95
128
|
value="toggled"
|
|
96
129
|
onChange={(event) => {
|
|
97
|
-
|
|
130
|
+
setIsShowingContent(event.target.checked)
|
|
98
131
|
}}
|
|
99
132
|
/>
|
|
100
|
-
|
|
101
|
-
|
|
133
|
+
</>
|
|
134
|
+
)
|
|
102
135
|
}
|
|
103
|
-
}
|
|
104
136
|
|
|
105
|
-
render(<Example />)
|
|
106
|
-
```
|
|
137
|
+
render(<Example />)
|
|
138
|
+
```
|
|
107
139
|
|
|
108
140
|
### Custom elements as renderTrigger
|
|
109
141
|
|
|
110
142
|
Popover and Tooltip attach mouse and focus event listeners to their render trigger components via props. These need to be propagated to the component for the listeners to work:
|
|
111
143
|
|
|
112
|
-
```js
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
144
|
+
- ```js
|
|
145
|
+
class MyComponent extends React.Component {
|
|
146
|
+
constructor(props) {
|
|
147
|
+
super(props)
|
|
148
|
+
this.ref = React.createRef()
|
|
149
|
+
}
|
|
150
|
+
render() {
|
|
151
|
+
// Spread the props to the underlying DOM element
|
|
152
|
+
return (
|
|
153
|
+
<div {...this.props} ref={this.ref} style={{ width: '10rem' }}>
|
|
154
|
+
My custom component
|
|
155
|
+
</div>
|
|
156
|
+
)
|
|
157
|
+
}
|
|
124
158
|
}
|
|
125
|
-
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
159
|
+
;<Tooltip renderTip="Tooltip text to display">
|
|
160
|
+
<MyComponent />
|
|
161
|
+
</Tooltip>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
- ```js
|
|
165
|
+
const MyComponent = forwardRef((props, ref) => {
|
|
166
|
+
return (
|
|
167
|
+
<div {...props} ref={ref} style={{ width: '10rem' }}>
|
|
168
|
+
My custom component
|
|
169
|
+
</div>
|
|
170
|
+
)
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
;<Tooltip renderTip="Tooltip text to display">
|
|
174
|
+
<MyComponent />
|
|
175
|
+
</Tooltip>
|
|
176
|
+
```
|
|
130
177
|
|
|
131
178
|
### Guidelines
|
|
132
179
|
|