@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 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-3](https://github.com/instructure/instructure-ui/compare/v10.2.2...v10.2.3-snapshot-3) (2024-09-20)
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",
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-3",
28
- "@instructure/shared-types": "10.2.3-snapshot-3",
29
- "@instructure/ui-popover": "10.2.3-snapshot-3",
30
- "@instructure/ui-position": "10.2.3-snapshot-3",
31
- "@instructure/ui-prop-types": "10.2.3-snapshot-3",
32
- "@instructure/ui-react-utils": "10.2.3-snapshot-3",
33
- "@instructure/ui-testable": "10.2.3-snapshot-3",
34
- "@instructure/ui-utils": "10.2.3-snapshot-3",
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-3",
39
- "@instructure/ui-babel-preset": "10.2.3-snapshot-3",
40
- "@instructure/ui-color-utils": "10.2.3-snapshot-3",
41
- "@instructure/ui-scripts": "10.2.3-snapshot-3",
42
- "@instructure/ui-test-locator": "10.2.3-snapshot-3",
43
- "@instructure/ui-test-queries": "10.2.3-snapshot-3",
44
- "@instructure/ui-test-utils": "10.2.3-snapshot-3",
45
- "@instructure/ui-themes": "10.2.3-snapshot-3",
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",
@@ -59,74 +59,121 @@ type: example
59
59
 
60
60
  #### Controlled Tooltips
61
61
 
62
- ```js
63
- ---
64
- type: example
65
- ---
66
- class Example extends React.Component {
67
- constructor (props) {
68
- super(props)
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
- this.state = {
71
- isShowingContent: false
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
- <Tooltip
80
- renderTip="Hello. I'm a tool tip"
81
- isShowingContent={this.state.isShowingContent}
82
- onShowContent={(e) => {
83
- console.log("expecting to show tooltip")
84
- }}
85
- onHideContent={(e) => {
86
- console.log("expecting to hide tooltip")
87
- }}
88
- >
89
- <Link href="#">This link has a tooltip</Link>
90
- </Tooltip>
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
- this.setState({isShowingContent: event.target.checked})
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
- type: example
115
- ---
116
- class MyComponent extends React.Component {
117
- constructor(props) {
118
- super(props)
119
- this.ref = React.createRef()
120
- }
121
- render() {
122
- // Spread the props to the underlying DOM element
123
- return <div {...this.props} ref={this.ref} style={{width:"10rem"}}>My custom component</div>
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
- <Tooltip renderTip="Tooltip text to display" >
127
- <MyComponent />
128
- </Tooltip>
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