@instructure/ui-tooltip 11.7.8 → 11.7.9-pr-snapshot-1792147648392

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,6 +3,19 @@
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
+ ## [11.7.9-pr-snapshot-1792147648392](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-pr-snapshot-1792147648392) (2026-10-16)
7
+
8
+ ### Build System
9
+
10
+ * **many:** replace babel with swc ([7e36c54](https://github.com/instructure/instructure-ui/commit/7e36c54d240b4fa483801c03ab18e7f860f561e2))
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ * **many:** `@instructure/ui-babel-preset` and
15
+ `@instructure/browserslist-config-instui` are removed and will no longer be
16
+ published. Packages depend on `@swc/helpers` instead of `@babel/runtime`.
17
+
18
+
6
19
  ## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
7
20
 
8
21
  **Note:** Version bump only for package @instructure/ui-tooltip
@@ -1,28 +1,5 @@
1
- var _dec, _dec2, _class;
2
- /*
3
- * The MIT License (MIT)
4
- *
5
- * Copyright (c) 2015 - present Instructure, Inc.
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is
12
- * furnished to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in all
15
- * copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- * SOFTWARE.
24
- */
25
-
1
+ import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
2
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
26
3
  import { Component } from 'react';
27
4
  import { getElementType, omitProps, ensureSingleChild, passthroughProps, callRenderProp, withDeterministicId } from '@instructure/ui-react-utils';
28
5
  import { Popover } from '@instructure/ui-popover/v11_6';
@@ -30,140 +7,118 @@ import { withStyle } from '@instructure/emotion';
30
7
  import generateStyle from './styles.js';
31
8
  import generateComponentTheme from './theme.js';
32
9
  import { allowedProps } from './props.js';
33
-
34
- /**
35
- ---
36
- category: components
37
- ---
38
- **/
39
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
40
- let Tooltip = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec(_class = _dec2(_class = class Tooltip extends Component {
41
- static displayName = 'Tooltip';
42
- static componentId = 'Tooltip';
43
- static allowedProps = allowedProps;
44
- static defaultProps = {
45
- defaultIsShowingContent: false,
46
- color: 'primary',
47
- placement: 'top',
48
- constrain: 'window',
49
- offsetX: 0,
50
- offsetY: 0,
51
- preventTooltip: false
52
- };
53
- _id;
54
- ref = null;
55
- handleRef = el => {
56
- this.ref = el;
57
- if (typeof this.props.elementRef === 'function') {
58
- this.props.elementRef(el);
10
+ class Tooltip extends Component {
11
+ static{
12
+ this.displayName = 'Tooltip';
13
+ }
14
+ static{
15
+ this.componentId = 'Tooltip';
16
+ }
17
+ static{
18
+ this.allowedProps = allowedProps;
19
+ }
20
+ static{
21
+ this.defaultProps = {
22
+ defaultIsShowingContent: false,
23
+ color: 'primary',
24
+ placement: 'top',
25
+ constrain: 'window',
26
+ offsetX: 0,
27
+ offsetY: 0,
28
+ preventTooltip: false
29
+ };
30
+ }
31
+ constructor(props){
32
+ super(props), this.ref = null, this.handleRef = (el)=>{
33
+ this.ref = el;
34
+ if (typeof this.props.elementRef === 'function') {
35
+ this.props.elementRef(el);
36
+ }
37
+ }, this.handleFocus = ()=>{
38
+ this.setState({
39
+ hasFocus: true
40
+ });
41
+ }, this.handleBlur = ()=>{
42
+ this.setState({
43
+ hasFocus: false
44
+ });
45
+ };
46
+ this._id = props.deterministicId();
47
+ this.state = {
48
+ hasFocus: false
49
+ };
50
+ }
51
+ componentDidMount() {
52
+ this.props.makeStyles?.();
53
+ }
54
+ componentDidUpdate() {
55
+ this.props.makeStyles?.();
56
+ }
57
+ renderTrigger() {
58
+ const { children, as } = this.props;
59
+ const { hasFocus } = this.state;
60
+ const triggerProps = {
61
+ 'aria-describedby': this._id
62
+ };
63
+ if (as) {
64
+ const Trigger = getElementType(Tooltip, this.props);
65
+ const props = omitProps(this.props, Tooltip.allowedProps);
66
+ return /*#__PURE__*/ _jsx(Trigger, {
67
+ ...props,
68
+ ...triggerProps,
69
+ children: children
70
+ });
71
+ } else if (typeof children === 'function') {
72
+ return children({
73
+ focused: hasFocus,
74
+ getTriggerProps: (props)=>({
75
+ ...triggerProps,
76
+ ...props
77
+ })
78
+ });
79
+ } else {
80
+ return ensureSingleChild(children, triggerProps);
81
+ }
59
82
  }
60
- };
61
- constructor(props) {
62
- super(props);
63
- this._id = props.deterministicId();
64
- this.state = {
65
- hasFocus: false
66
- };
67
- }
68
- componentDidMount() {
69
- this.props.makeStyles?.();
70
- }
71
- componentDidUpdate() {
72
- this.props.makeStyles?.();
73
- }
74
- handleFocus = () => {
75
- this.setState({
76
- hasFocus: true
77
- });
78
- };
79
- handleBlur = () => {
80
- this.setState({
81
- hasFocus: false
82
- });
83
- };
84
- renderTrigger() {
85
- const {
86
- children,
87
- as
88
- } = this.props;
89
- const {
90
- hasFocus
91
- } = this.state;
92
- const triggerProps = {
93
- 'aria-describedby': this._id
94
- };
95
- if (as) {
96
- const Trigger = getElementType(Tooltip, this.props);
97
- const props = omitProps(this.props, Tooltip.allowedProps);
98
- return _jsx(Trigger, {
99
- ...props,
100
- ...triggerProps,
101
- children: children /*TODO check if it can be TooltipRenderChildren, this might cause a crash*/
102
- });
103
- } else if (typeof children === 'function') {
104
- return children({
105
- focused: hasFocus,
106
- getTriggerProps: props => ({
107
- ...triggerProps,
108
- ...props
109
- })
110
- });
111
- } else {
112
- return ensureSingleChild(children, triggerProps);
83
+ render() {
84
+ const { renderTip, isShowingContent, defaultIsShowingContent, on, color, placement, mountNode, constrain, offsetX, offsetY, positionTarget, onShowContent, onHideContent, preventTooltip, styles, ...rest } = this.props;
85
+ return /*#__PURE__*/ _jsx(Popover, {
86
+ ...passthroughProps(rest),
87
+ isShowingContent: !preventTooltip && isShowingContent,
88
+ defaultIsShowingContent: !preventTooltip && defaultIsShowingContent,
89
+ on: on,
90
+ shouldRenderOffscreen: true,
91
+ shouldReturnFocus: false,
92
+ placement: placement,
93
+ color: color === 'primary' ? 'primary-inverse' : 'primary',
94
+ mountNode: mountNode,
95
+ constrain: constrain,
96
+ shadow: "none",
97
+ offsetX: offsetX,
98
+ offsetY: offsetY,
99
+ positionTarget: positionTarget,
100
+ renderTrigger: ()=>this.renderTrigger(),
101
+ onShowContent: onShowContent,
102
+ onHideContent: onHideContent,
103
+ onFocus: this.handleFocus,
104
+ onBlur: this.handleBlur,
105
+ elementRef: this.handleRef,
106
+ shouldCloseOnDocumentClick: false,
107
+ shouldCloseOnEscape: true,
108
+ shouldSetAriaExpanded: false,
109
+ "data-cid": "Tooltip",
110
+ children: !preventTooltip ? /*#__PURE__*/ _jsx("span", {
111
+ id: this._id,
112
+ css: styles?.tooltip,
113
+ role: "tooltip",
114
+ children: callRenderProp(renderTip)
115
+ }) : null
116
+ });
113
117
  }
114
- }
115
- render() {
116
- const {
117
- renderTip,
118
- isShowingContent,
119
- defaultIsShowingContent,
120
- on,
121
- color,
122
- placement,
123
- mountNode,
124
- constrain,
125
- offsetX,
126
- offsetY,
127
- positionTarget,
128
- onShowContent,
129
- onHideContent,
130
- preventTooltip,
131
- styles,
132
- ...rest
133
- } = this.props;
134
- return _jsx(Popover, {
135
- ...passthroughProps(rest),
136
- isShowingContent: !preventTooltip && isShowingContent,
137
- defaultIsShowingContent: !preventTooltip && defaultIsShowingContent,
138
- on: on,
139
- shouldRenderOffscreen: true,
140
- shouldReturnFocus: false,
141
- placement: placement,
142
- color: color === 'primary' ? 'primary-inverse' : 'primary',
143
- mountNode: mountNode,
144
- constrain: constrain,
145
- shadow: "none",
146
- offsetX: offsetX,
147
- offsetY: offsetY,
148
- positionTarget: positionTarget,
149
- renderTrigger: () => this.renderTrigger(),
150
- onShowContent: onShowContent,
151
- onHideContent: onHideContent,
152
- onFocus: this.handleFocus,
153
- onBlur: this.handleBlur,
154
- elementRef: this.handleRef,
155
- shouldCloseOnDocumentClick: false,
156
- shouldCloseOnEscape: true,
157
- shouldSetAriaExpanded: false,
158
- "data-cid": "Tooltip",
159
- children: !preventTooltip ? _jsx("span", {
160
- id: this._id,
161
- css: styles?.tooltip,
162
- role: "tooltip",
163
- children: callRenderProp(renderTip)
164
- }) : null
165
- });
166
- }
167
- }) || _class) || _class);
118
+ }
119
+ Tooltip = _ts_decorate([
120
+ withDeterministicId(),
121
+ withStyle(generateStyle, generateComponentTheme)
122
+ ], Tooltip);
168
123
  export default Tooltip;
169
- export { Tooltip };
124
+ export { Tooltip };
@@ -1,28 +1,20 @@
1
- /*
2
- * The MIT License (MIT)
3
- *
4
- * Copyright (c) 2015 - present Instructure, Inc.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- // passes through props for Popover, except the ones set manually
26
-
27
- const allowedProps = ['elementRef', 'children', 'renderTip', 'isShowingContent', 'defaultIsShowingContent', 'as', 'on', 'color', 'placement', 'mountNode', 'constrain', 'offsetX', 'offsetY', 'positionTarget', 'onShowContent', 'onHideContent', 'preventTooltip'];
28
- export { allowedProps };
1
+ const allowedProps = [
2
+ 'elementRef',
3
+ 'children',
4
+ 'renderTip',
5
+ 'isShowingContent',
6
+ 'defaultIsShowingContent',
7
+ 'as',
8
+ 'on',
9
+ 'color',
10
+ 'placement',
11
+ 'mountNode',
12
+ 'constrain',
13
+ 'offsetX',
14
+ 'offsetY',
15
+ 'positionTarget',
16
+ 'onShowContent',
17
+ 'onHideContent',
18
+ 'preventTooltip'
19
+ ];
20
+ export { allowedProps };
@@ -1,48 +1,14 @@
1
- /*
2
- * The MIT License (MIT)
3
- *
4
- * Copyright (c) 2015 - present Instructure, Inc.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- /**
26
- * ---
27
- * private: true
28
- * ---
29
- * Generates the style object from the theme and provided additional information
30
- * @param {Object} componentTheme The theme variable object.
31
- * @param {Object} props the props of the component, the style is applied to
32
- * @param {Object} state the state of the component, the style is applied to
33
- * @return {Object} The final style object, which will be used in the component
34
- */
35
- const generateStyle = componentTheme => {
36
- return {
37
- tooltip: {
38
- label: 'tooltip',
39
- fontFamily: componentTheme.fontFamily,
40
- fontWeight: componentTheme.fontWeight,
41
- boxSizing: 'border-box',
42
- display: 'block',
43
- fontSize: componentTheme.fontSize,
44
- padding: componentTheme.padding
45
- }
46
- };
1
+ const generateStyle = (componentTheme)=>{
2
+ return {
3
+ tooltip: {
4
+ label: 'tooltip',
5
+ fontFamily: componentTheme.fontFamily,
6
+ fontWeight: componentTheme.fontWeight,
7
+ boxSizing: 'border-box',
8
+ display: 'block',
9
+ fontSize: componentTheme.fontSize,
10
+ padding: componentTheme.padding
11
+ }
12
+ };
47
13
  };
48
- export default generateStyle;
14
+ export default generateStyle;
@@ -1,45 +1,13 @@
1
- /*
2
- * The MIT License (MIT)
3
- *
4
- * Copyright (c) 2015 - present Instructure, Inc.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- /**
26
- * Generates the theme object for the component from the theme and provided additional information
27
- * @param {Object} theme The actual theme object.
28
- * @return {Object} The final theme object with the overrides and component variables
29
- */
30
- const generateComponentTheme = theme => {
31
- const {
32
- typography,
33
- spacing
34
- } = theme;
35
- const componentVariables = {
36
- fontFamily: typography?.fontFamily,
37
- fontWeight: typography?.fontWeightNormal,
38
- fontSize: typography?.fontSizeSmall,
39
- padding: spacing?.small
40
- };
41
- return {
42
- ...componentVariables
43
- };
1
+ const generateComponentTheme = (theme)=>{
2
+ const { typography, spacing } = theme;
3
+ const componentVariables = {
4
+ fontFamily: typography?.fontFamily,
5
+ fontWeight: typography?.fontWeightNormal,
6
+ fontSize: typography?.fontSizeSmall,
7
+ padding: spacing?.small
8
+ };
9
+ return {
10
+ ...componentVariables
11
+ };
44
12
  };
45
- export default generateComponentTheme;
13
+ export default generateComponentTheme;