@instructure/ui-tooltip 11.6.0 → 11.6.1-snapshot-129

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +35 -283
  2. package/es/Tooltip/{index.js → v1/index.js} +2 -2
  3. package/es/Tooltip/v2/index.js +163 -0
  4. package/es/Tooltip/v2/props.js +28 -0
  5. package/es/Tooltip/v2/styles.js +46 -0
  6. package/es/{index.js → exports/a.js} +1 -1
  7. package/{src/index.ts → es/exports/b.js} +1 -2
  8. package/lib/Tooltip/{index.js → v1/index.js} +3 -3
  9. package/lib/Tooltip/v2/index.js +173 -0
  10. package/lib/Tooltip/v2/props.js +33 -0
  11. package/lib/Tooltip/v2/styles.js +52 -0
  12. package/lib/{index.js → exports/a.js} +2 -2
  13. package/lib/exports/b.js +12 -0
  14. package/package.json +40 -18
  15. package/src/Tooltip/{index.tsx → v1/index.tsx} +3 -3
  16. package/src/Tooltip/{props.ts → v1/props.ts} +1 -1
  17. package/src/Tooltip/v2/README.md +142 -0
  18. package/src/Tooltip/v2/index.tsx +191 -0
  19. package/src/Tooltip/v2/props.ts +223 -0
  20. package/src/Tooltip/v2/styles.ts +52 -0
  21. package/src/exports/a.ts +28 -0
  22. package/src/exports/b.ts +28 -0
  23. package/tsconfig.build.tsbuildinfo +1 -1
  24. package/types/Tooltip/{index.d.ts → v1/index.d.ts} +1 -1
  25. package/types/Tooltip/v1/index.d.ts.map +1 -0
  26. package/types/Tooltip/{props.d.ts → v1/props.d.ts} +1 -1
  27. package/types/Tooltip/v1/props.d.ts.map +1 -0
  28. package/types/Tooltip/v1/styles.d.ts.map +1 -0
  29. package/types/Tooltip/v1/theme.d.ts.map +1 -0
  30. package/types/Tooltip/v2/index.d.ts +54 -0
  31. package/types/Tooltip/v2/index.d.ts.map +1 -0
  32. package/types/Tooltip/v2/props.d.ts +110 -0
  33. package/types/Tooltip/v2/props.d.ts.map +1 -0
  34. package/types/Tooltip/v2/styles.d.ts +13 -0
  35. package/types/Tooltip/v2/styles.d.ts.map +1 -0
  36. package/types/exports/a.d.ts +3 -0
  37. package/types/exports/a.d.ts.map +1 -0
  38. package/types/exports/b.d.ts +3 -0
  39. package/types/exports/b.d.ts.map +1 -0
  40. package/types/Tooltip/index.d.ts.map +0 -1
  41. package/types/Tooltip/props.d.ts.map +0 -1
  42. package/types/Tooltip/styles.d.ts.map +0 -1
  43. package/types/Tooltip/theme.d.ts.map +0 -1
  44. package/types/index.d.ts +0 -3
  45. package/types/index.d.ts.map +0 -1
  46. /package/es/Tooltip/{props.js → v1/props.js} +0 -0
  47. /package/es/Tooltip/{styles.js → v1/styles.js} +0 -0
  48. /package/es/Tooltip/{theme.js → v1/theme.js} +0 -0
  49. /package/lib/Tooltip/{props.js → v1/props.js} +0 -0
  50. /package/lib/Tooltip/{styles.js → v1/styles.js} +0 -0
  51. /package/lib/Tooltip/{theme.js → v1/theme.js} +0 -0
  52. /package/src/Tooltip/{README.md → v1/README.md} +0 -0
  53. /package/src/Tooltip/{styles.ts → v1/styles.ts} +0 -0
  54. /package/src/Tooltip/{theme.ts → v1/theme.ts} +0 -0
  55. /package/types/Tooltip/{styles.d.ts → v1/styles.d.ts} +0 -0
  56. /package/types/Tooltip/{theme.d.ts → v1/theme.d.ts} +0 -0
@@ -0,0 +1,163 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ const _excluded = ["renderTip", "isShowingContent", "defaultIsShowingContent", "on", "color", "placement", "mountNode", "constrain", "offsetX", "offsetY", "positionTarget", "onShowContent", "onHideContent", "preventTooltip", "styles"];
3
+ var _dec, _dec2, _class, _Tooltip;
4
+ /*
5
+ * The MIT License (MIT)
6
+ *
7
+ * Copyright (c) 2015 - present Instructure, Inc.
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ * of this software and associated documentation files (the "Software"), to deal
11
+ * in the Software without restriction, including without limitation the rights
12
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ * copies of the Software, and to permit persons to whom the Software is
14
+ * furnished to do so, subject to the following conditions:
15
+ *
16
+ * The above copyright notice and this permission notice shall be included in all
17
+ * copies or substantial portions of the Software.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ * SOFTWARE.
26
+ */
27
+
28
+ import { Component } from 'react';
29
+ import { getElementType, omitProps, ensureSingleChild, passthroughProps, callRenderProp, withDeterministicId } from '@instructure/ui-react-utils';
30
+ import { Popover } from '@instructure/ui-popover/latest';
31
+ import { withStyle } from '@instructure/emotion';
32
+ import generateStyle from "./styles.js";
33
+ import { allowedProps } from "./props.js";
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), _dec(_class = _dec2(_class = (_Tooltip = class Tooltip extends Component {
41
+ constructor(props) {
42
+ super(props);
43
+ this._id = void 0;
44
+ this.ref = null;
45
+ this.handleRef = el => {
46
+ this.ref = el;
47
+ if (typeof this.props.elementRef === 'function') {
48
+ this.props.elementRef(el);
49
+ }
50
+ };
51
+ this.handleFocus = () => {
52
+ this.setState({
53
+ hasFocus: true
54
+ });
55
+ };
56
+ this.handleBlur = () => {
57
+ this.setState({
58
+ hasFocus: false
59
+ });
60
+ };
61
+ this._id = props.deterministicId();
62
+ this.state = {
63
+ hasFocus: false
64
+ };
65
+ }
66
+ componentDidMount() {
67
+ var _this$props$makeStyle, _this$props;
68
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
69
+ }
70
+ componentDidUpdate() {
71
+ var _this$props$makeStyle2, _this$props2;
72
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
73
+ }
74
+ renderTrigger() {
75
+ const _ref = this.props,
76
+ children = _ref.children,
77
+ as = _ref.as;
78
+ const hasFocus = this.state.hasFocus;
79
+ const triggerProps = {
80
+ 'aria-describedby': this._id
81
+ };
82
+ if (as) {
83
+ const Trigger = getElementType(Tooltip, this.props);
84
+ const props = omitProps(this.props, Tooltip.allowedProps);
85
+ return _jsx(Trigger, {
86
+ ...props,
87
+ ...triggerProps,
88
+ children: children /*TODO check if it can be TooltipRenderChildren, this might cause a crash*/
89
+ });
90
+ } else if (typeof children === 'function') {
91
+ return children({
92
+ focused: hasFocus,
93
+ getTriggerProps: props => ({
94
+ ...triggerProps,
95
+ ...props
96
+ })
97
+ });
98
+ } else {
99
+ return ensureSingleChild(children, triggerProps);
100
+ }
101
+ }
102
+ render() {
103
+ const _this$props3 = this.props,
104
+ renderTip = _this$props3.renderTip,
105
+ isShowingContent = _this$props3.isShowingContent,
106
+ defaultIsShowingContent = _this$props3.defaultIsShowingContent,
107
+ on = _this$props3.on,
108
+ color = _this$props3.color,
109
+ placement = _this$props3.placement,
110
+ mountNode = _this$props3.mountNode,
111
+ constrain = _this$props3.constrain,
112
+ offsetX = _this$props3.offsetX,
113
+ offsetY = _this$props3.offsetY,
114
+ positionTarget = _this$props3.positionTarget,
115
+ onShowContent = _this$props3.onShowContent,
116
+ onHideContent = _this$props3.onHideContent,
117
+ preventTooltip = _this$props3.preventTooltip,
118
+ styles = _this$props3.styles,
119
+ rest = _objectWithoutProperties(_this$props3, _excluded);
120
+ return _jsx(Popover, {
121
+ ...passthroughProps(rest),
122
+ isShowingContent: !preventTooltip && isShowingContent,
123
+ defaultIsShowingContent: !preventTooltip && defaultIsShowingContent,
124
+ on: on,
125
+ shouldRenderOffscreen: true,
126
+ shouldReturnFocus: false,
127
+ placement: placement,
128
+ color: color === 'primary' ? 'primary-inverse' : 'primary',
129
+ mountNode: mountNode,
130
+ constrain: constrain,
131
+ shadow: "resting",
132
+ offsetX: offsetX,
133
+ offsetY: offsetY,
134
+ positionTarget: positionTarget,
135
+ renderTrigger: () => this.renderTrigger(),
136
+ onShowContent: onShowContent,
137
+ onHideContent: onHideContent,
138
+ onFocus: this.handleFocus,
139
+ onBlur: this.handleBlur,
140
+ elementRef: this.handleRef,
141
+ shouldCloseOnDocumentClick: false,
142
+ shouldCloseOnEscape: true,
143
+ shouldSetAriaExpanded: false,
144
+ "data-cid": "Tooltip",
145
+ children: !preventTooltip ? _jsx("span", {
146
+ id: this._id,
147
+ css: styles === null || styles === void 0 ? void 0 : styles.tooltip,
148
+ role: "tooltip",
149
+ children: callRenderProp(renderTip)
150
+ }) : null
151
+ });
152
+ }
153
+ }, _Tooltip.displayName = "Tooltip", _Tooltip.componentId = 'Tooltip', _Tooltip.allowedProps = allowedProps, _Tooltip.defaultProps = {
154
+ defaultIsShowingContent: false,
155
+ color: 'primary',
156
+ placement: 'top',
157
+ constrain: 'window',
158
+ offsetX: 0,
159
+ offsetY: 0,
160
+ preventTooltip: false
161
+ }, _Tooltip)) || _class) || _class);
162
+ export default Tooltip;
163
+ export { Tooltip };
@@ -0,0 +1,28 @@
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 };
@@ -0,0 +1,46 @@
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
+ * @return {Object} The final style object, which will be used in the component
32
+ */
33
+ const generateStyle = componentTheme => {
34
+ return {
35
+ tooltip: {
36
+ label: 'tooltip',
37
+ fontFamily: componentTheme.fontFamily,
38
+ fontWeight: componentTheme.fontWeight,
39
+ boxSizing: 'border-box',
40
+ display: 'block',
41
+ fontSize: componentTheme.fontSize,
42
+ padding: componentTheme.padding
43
+ }
44
+ };
45
+ };
46
+ export default generateStyle;
@@ -21,4 +21,4 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
- export { Tooltip } from "./Tooltip/index.js";
24
+ export { Tooltip } from "../Tooltip/v1/index.js";
@@ -21,5 +21,4 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
- export { Tooltip } from './Tooltip'
25
- export type { TooltipProps, TooltipRenderChildrenArgs } from './Tooltip/props'
24
+ export { Tooltip } from "../Tooltip/v2/index.js";
@@ -13,7 +13,7 @@ var _ensureSingleChild = require("@instructure/ui-react-utils/lib/ensureSingleCh
13
13
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
14
14
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
15
15
  var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
16
- var _Popover = require("@instructure/ui-popover/lib/Popover");
16
+ var _v11_ = require("@instructure/ui-popover/v11_6");
17
17
  var _emotion = require("@instructure/emotion");
18
18
  var _styles = _interopRequireDefault(require("./styles"));
19
19
  var _theme = _interopRequireDefault(require("./theme"));
@@ -49,7 +49,7 @@ var _dec, _dec2, _class, _Tooltip;
49
49
  category: components
50
50
  ---
51
51
  **/
52
- let Tooltip = exports.Tooltip = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_Tooltip = class Tooltip extends _react.Component {
52
+ let Tooltip = exports.Tooltip = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_Tooltip = class Tooltip extends _react.Component {
53
53
  constructor(props) {
54
54
  super(props);
55
55
  this._id = void 0;
@@ -129,7 +129,7 @@ let Tooltip = exports.Tooltip = (_dec = (0, _withDeterministicId.withDeterminist
129
129
  preventTooltip = _this$props3.preventTooltip,
130
130
  styles = _this$props3.styles,
131
131
  rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
132
- return (0, _jsxRuntime.jsx)(_Popover.Popover, {
132
+ return (0, _jsxRuntime.jsx)(_v11_.Popover, {
133
133
  ...(0, _passthroughProps.passthroughProps)(rest),
134
134
  isShowingContent: !preventTooltip && isShowingContent,
135
135
  defaultIsShowingContent: !preventTooltip && defaultIsShowingContent,
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = exports.Tooltip = void 0;
8
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
+ var _react = require("react");
10
+ var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
11
+ var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
12
+ var _ensureSingleChild = require("@instructure/ui-react-utils/lib/ensureSingleChild.js");
13
+ var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
14
+ var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
15
+ var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
16
+ var _latest = require("@instructure/ui-popover/latest");
17
+ var _emotion = require("@instructure/emotion");
18
+ var _styles = _interopRequireDefault(require("./styles"));
19
+ var _props = require("./props");
20
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
21
+ const _excluded = ["renderTip", "isShowingContent", "defaultIsShowingContent", "on", "color", "placement", "mountNode", "constrain", "offsetX", "offsetY", "positionTarget", "onShowContent", "onHideContent", "preventTooltip", "styles"];
22
+ var _dec, _dec2, _class, _Tooltip;
23
+ /*
24
+ * The MIT License (MIT)
25
+ *
26
+ * Copyright (c) 2015 - present Instructure, Inc.
27
+ *
28
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
29
+ * of this software and associated documentation files (the "Software"), to deal
30
+ * in the Software without restriction, including without limitation the rights
31
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
32
+ * copies of the Software, and to permit persons to whom the Software is
33
+ * furnished to do so, subject to the following conditions:
34
+ *
35
+ * The above copyright notice and this permission notice shall be included in all
36
+ * copies or substantial portions of the Software.
37
+ *
38
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
41
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
42
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
43
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
44
+ * SOFTWARE.
45
+ */
46
+ /**
47
+ ---
48
+ category: components
49
+ ---
50
+ **/
51
+ let Tooltip = exports.Tooltip = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default), _dec(_class = _dec2(_class = (_Tooltip = class Tooltip extends _react.Component {
52
+ constructor(props) {
53
+ super(props);
54
+ this._id = void 0;
55
+ this.ref = null;
56
+ this.handleRef = el => {
57
+ this.ref = el;
58
+ if (typeof this.props.elementRef === 'function') {
59
+ this.props.elementRef(el);
60
+ }
61
+ };
62
+ this.handleFocus = () => {
63
+ this.setState({
64
+ hasFocus: true
65
+ });
66
+ };
67
+ this.handleBlur = () => {
68
+ this.setState({
69
+ hasFocus: false
70
+ });
71
+ };
72
+ this._id = props.deterministicId();
73
+ this.state = {
74
+ hasFocus: false
75
+ };
76
+ }
77
+ componentDidMount() {
78
+ var _this$props$makeStyle, _this$props;
79
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
80
+ }
81
+ componentDidUpdate() {
82
+ var _this$props$makeStyle2, _this$props2;
83
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
84
+ }
85
+ renderTrigger() {
86
+ const _ref = this.props,
87
+ children = _ref.children,
88
+ as = _ref.as;
89
+ const hasFocus = this.state.hasFocus;
90
+ const triggerProps = {
91
+ 'aria-describedby': this._id
92
+ };
93
+ if (as) {
94
+ const Trigger = (0, _getElementType.getElementType)(Tooltip, this.props);
95
+ const props = (0, _omitProps.omitProps)(this.props, Tooltip.allowedProps);
96
+ return (0, _jsxRuntime.jsx)(Trigger, {
97
+ ...props,
98
+ ...triggerProps,
99
+ children: children /*TODO check if it can be TooltipRenderChildren, this might cause a crash*/
100
+ });
101
+ } else if (typeof children === 'function') {
102
+ return children({
103
+ focused: hasFocus,
104
+ getTriggerProps: props => ({
105
+ ...triggerProps,
106
+ ...props
107
+ })
108
+ });
109
+ } else {
110
+ return (0, _ensureSingleChild.ensureSingleChild)(children, triggerProps);
111
+ }
112
+ }
113
+ render() {
114
+ const _this$props3 = this.props,
115
+ renderTip = _this$props3.renderTip,
116
+ isShowingContent = _this$props3.isShowingContent,
117
+ defaultIsShowingContent = _this$props3.defaultIsShowingContent,
118
+ on = _this$props3.on,
119
+ color = _this$props3.color,
120
+ placement = _this$props3.placement,
121
+ mountNode = _this$props3.mountNode,
122
+ constrain = _this$props3.constrain,
123
+ offsetX = _this$props3.offsetX,
124
+ offsetY = _this$props3.offsetY,
125
+ positionTarget = _this$props3.positionTarget,
126
+ onShowContent = _this$props3.onShowContent,
127
+ onHideContent = _this$props3.onHideContent,
128
+ preventTooltip = _this$props3.preventTooltip,
129
+ styles = _this$props3.styles,
130
+ rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
131
+ return (0, _jsxRuntime.jsx)(_latest.Popover, {
132
+ ...(0, _passthroughProps.passthroughProps)(rest),
133
+ isShowingContent: !preventTooltip && isShowingContent,
134
+ defaultIsShowingContent: !preventTooltip && defaultIsShowingContent,
135
+ on: on,
136
+ shouldRenderOffscreen: true,
137
+ shouldReturnFocus: false,
138
+ placement: placement,
139
+ color: color === 'primary' ? 'primary-inverse' : 'primary',
140
+ mountNode: mountNode,
141
+ constrain: constrain,
142
+ shadow: "resting",
143
+ offsetX: offsetX,
144
+ offsetY: offsetY,
145
+ positionTarget: positionTarget,
146
+ renderTrigger: () => this.renderTrigger(),
147
+ onShowContent: onShowContent,
148
+ onHideContent: onHideContent,
149
+ onFocus: this.handleFocus,
150
+ onBlur: this.handleBlur,
151
+ elementRef: this.handleRef,
152
+ shouldCloseOnDocumentClick: false,
153
+ shouldCloseOnEscape: true,
154
+ shouldSetAriaExpanded: false,
155
+ "data-cid": "Tooltip",
156
+ children: !preventTooltip ? (0, _jsxRuntime.jsx)("span", {
157
+ id: this._id,
158
+ css: styles === null || styles === void 0 ? void 0 : styles.tooltip,
159
+ role: "tooltip",
160
+ children: (0, _callRenderProp.callRenderProp)(renderTip)
161
+ }) : null
162
+ });
163
+ }
164
+ }, _Tooltip.displayName = "Tooltip", _Tooltip.componentId = 'Tooltip', _Tooltip.allowedProps = _props.allowedProps, _Tooltip.defaultProps = {
165
+ defaultIsShowingContent: false,
166
+ color: 'primary',
167
+ placement: 'top',
168
+ constrain: 'window',
169
+ offsetX: 0,
170
+ offsetY: 0,
171
+ preventTooltip: false
172
+ }, _Tooltip)) || _class) || _class);
173
+ var _default = exports.default = Tooltip;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.allowedProps = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ // passes through props for Popover, except the ones set manually
32
+
33
+ const allowedProps = exports.allowedProps = ['elementRef', 'children', 'renderTip', 'isShowingContent', 'defaultIsShowingContent', 'as', 'on', 'color', 'placement', 'mountNode', 'constrain', 'offsetX', 'offsetY', 'positionTarget', 'onShowContent', 'onHideContent', 'preventTooltip'];
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ /**
32
+ * ---
33
+ * private: true
34
+ * ---
35
+ * Generates the style object from the theme and provided additional information
36
+ * @param {Object} componentTheme The theme variable object.
37
+ * @return {Object} The final style object, which will be used in the component
38
+ */
39
+ const generateStyle = componentTheme => {
40
+ return {
41
+ tooltip: {
42
+ label: 'tooltip',
43
+ fontFamily: componentTheme.fontFamily,
44
+ fontWeight: componentTheme.fontWeight,
45
+ boxSizing: 'border-box',
46
+ display: 'block',
47
+ fontSize: componentTheme.fontSize,
48
+ padding: componentTheme.padding
49
+ }
50
+ };
51
+ };
52
+ var _default = exports.default = generateStyle;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "Tooltip", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _Tooltip.Tooltip;
9
+ return _v.Tooltip;
10
10
  }
11
11
  });
12
- var _Tooltip = require("./Tooltip");
12
+ var _v = require("../Tooltip/v1");
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Tooltip", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _v.Tooltip;
10
+ }
11
+ });
12
+ var _v = require("../Tooltip/v2");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-tooltip",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-snapshot-129",
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",
@@ -15,22 +15,22 @@
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.27.6",
18
- "@instructure/emotion": "11.6.0",
19
- "@instructure/shared-types": "11.6.0",
20
- "@instructure/ui-popover": "11.6.0",
21
- "@instructure/ui-position": "11.6.0",
22
- "@instructure/ui-react-utils": "11.6.0",
23
- "@instructure/ui-utils": "11.6.0"
18
+ "@instructure/emotion": "11.6.1-snapshot-129",
19
+ "@instructure/shared-types": "11.6.1-snapshot-129",
20
+ "@instructure/ui-popover": "11.6.1-snapshot-129",
21
+ "@instructure/ui-position": "11.6.1-snapshot-129",
22
+ "@instructure/ui-react-utils": "11.6.1-snapshot-129",
23
+ "@instructure/ui-utils": "11.6.1-snapshot-129"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@testing-library/jest-dom": "^6.6.3",
27
27
  "@testing-library/react": "15.0.7",
28
28
  "@testing-library/user-event": "^14.6.1",
29
29
  "vitest": "^3.2.2",
30
- "@instructure/ui-babel-preset": "11.6.0",
31
- "@instructure/ui-themes": "11.6.0",
32
- "@instructure/ui-color-utils": "11.6.0",
33
- "@instructure/ui-scripts": "11.6.0"
30
+ "@instructure/ui-babel-preset": "11.6.1-snapshot-129",
31
+ "@instructure/ui-color-utils": "11.6.1-snapshot-129",
32
+ "@instructure/ui-scripts": "11.6.1-snapshot-129",
33
+ "@instructure/ui-themes": "11.6.1-snapshot-129"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": ">=18 <=19"
@@ -40,17 +40,39 @@
40
40
  },
41
41
  "sideEffects": false,
42
42
  "exports": {
43
- ".": {
44
- "types": "./types/index.d.ts",
45
- "import": "./es/index.js",
46
- "require": "./lib/index.js",
47
- "default": "./es/index.js"
48
- },
49
43
  "./lib/*": "./lib/*",
50
44
  "./es/*": "./es/*",
51
45
  "./types/*": "./types/*",
52
46
  "./package.json": "./package.json",
53
- "./src/*": "./src/*"
47
+ "./src/*": "./src/*",
48
+ ".": {
49
+ "src": "./src/exports/a.ts",
50
+ "types": "./types/exports/a.d.ts",
51
+ "import": "./es/exports/a.js",
52
+ "require": "./lib/exports/a.js",
53
+ "default": "./es/exports/a.js"
54
+ },
55
+ "./v11_6": {
56
+ "src": "./src/exports/a.ts",
57
+ "types": "./types/exports/a.d.ts",
58
+ "import": "./es/exports/a.js",
59
+ "require": "./lib/exports/a.js",
60
+ "default": "./es/exports/a.js"
61
+ },
62
+ "./v11_7": {
63
+ "src": "./src/exports/b.ts",
64
+ "types": "./types/exports/b.d.ts",
65
+ "import": "./es/exports/b.js",
66
+ "require": "./lib/exports/b.js",
67
+ "default": "./es/exports/b.js"
68
+ },
69
+ "./latest": {
70
+ "src": "./src/exports/b.ts",
71
+ "types": "./types/exports/b.d.ts",
72
+ "import": "./es/exports/b.js",
73
+ "require": "./lib/exports/b.js",
74
+ "default": "./es/exports/b.js"
75
+ }
54
76
  },
55
77
  "scripts": {
56
78
  "lint": "ui-scripts lint",
@@ -32,9 +32,9 @@ import {
32
32
  callRenderProp,
33
33
  withDeterministicId
34
34
  } from '@instructure/ui-react-utils'
35
- import { Popover } from '@instructure/ui-popover'
36
- import type { PopoverProps } from '@instructure/ui-popover'
37
- import { withStyle } from '@instructure/emotion'
35
+ import { Popover } from '@instructure/ui-popover/v11_6'
36
+ import type { PopoverProps } from '@instructure/ui-popover/v11_6'
37
+ import { withStyleLegacy as withStyle } from '@instructure/emotion'
38
38
 
39
39
  import generateStyle from './styles'
40
40
  import generateComponentTheme from './theme'