@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.
@@ -1,168 +1,123 @@
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/latest';
29
6
  import { withStyleNew } from '@instructure/emotion';
30
7
  import generateStyle from './styles.js';
31
8
  import { allowedProps } from './props.js';
32
-
33
- /**
34
- ---
35
- category: components
36
- ---
37
- **/
38
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
39
- let Tooltip = (_dec = withDeterministicId(), _dec2 = withStyleNew(generateStyle), _dec(_class = _dec2(_class = class Tooltip extends Component {
40
- static displayName = 'Tooltip';
41
- static componentId = 'Tooltip';
42
- static allowedProps = allowedProps;
43
- static defaultProps = {
44
- defaultIsShowingContent: false,
45
- color: 'primary',
46
- placement: 'top',
47
- constrain: 'window',
48
- offsetX: 0,
49
- offsetY: 0,
50
- preventTooltip: false
51
- };
52
- _id;
53
- ref = null;
54
- handleRef = el => {
55
- this.ref = el;
56
- if (typeof this.props.elementRef === 'function') {
57
- this.props.elementRef(el);
9
+ class Tooltip extends Component {
10
+ static{
11
+ this.displayName = 'Tooltip';
12
+ }
13
+ static{
14
+ this.componentId = 'Tooltip';
15
+ }
16
+ static{
17
+ this.allowedProps = allowedProps;
18
+ }
19
+ static{
20
+ this.defaultProps = {
21
+ defaultIsShowingContent: false,
22
+ color: 'primary',
23
+ placement: 'top',
24
+ constrain: 'window',
25
+ offsetX: 0,
26
+ offsetY: 0,
27
+ preventTooltip: false
28
+ };
29
+ }
30
+ constructor(props){
31
+ super(props), this.ref = null, this.handleRef = (el)=>{
32
+ this.ref = el;
33
+ if (typeof this.props.elementRef === 'function') {
34
+ this.props.elementRef(el);
35
+ }
36
+ }, this.handleFocus = ()=>{
37
+ this.setState({
38
+ hasFocus: true
39
+ });
40
+ }, this.handleBlur = ()=>{
41
+ this.setState({
42
+ hasFocus: false
43
+ });
44
+ };
45
+ this._id = props.deterministicId();
46
+ this.state = {
47
+ hasFocus: false
48
+ };
49
+ }
50
+ componentDidMount() {
51
+ this.props.makeStyles?.();
52
+ }
53
+ componentDidUpdate() {
54
+ this.props.makeStyles?.();
55
+ }
56
+ renderTrigger() {
57
+ const { children, as } = this.props;
58
+ const { hasFocus } = this.state;
59
+ const triggerProps = {
60
+ 'aria-describedby': this._id
61
+ };
62
+ if (as) {
63
+ const Trigger = getElementType(Tooltip, this.props);
64
+ const props = omitProps(this.props, Tooltip.allowedProps);
65
+ return /*#__PURE__*/ _jsx(Trigger, {
66
+ ...props,
67
+ ...triggerProps,
68
+ children: children
69
+ });
70
+ } else if (typeof children === 'function') {
71
+ return children({
72
+ focused: hasFocus,
73
+ getTriggerProps: (props)=>({
74
+ ...triggerProps,
75
+ ...props
76
+ })
77
+ });
78
+ } else {
79
+ return ensureSingleChild(children, triggerProps);
80
+ }
58
81
  }
59
- };
60
- constructor(props) {
61
- super(props);
62
- this._id = props.deterministicId();
63
- this.state = {
64
- hasFocus: false
65
- };
66
- }
67
- componentDidMount() {
68
- this.props.makeStyles?.();
69
- }
70
- componentDidUpdate() {
71
- this.props.makeStyles?.();
72
- }
73
- handleFocus = () => {
74
- this.setState({
75
- hasFocus: true
76
- });
77
- };
78
- handleBlur = () => {
79
- this.setState({
80
- hasFocus: false
81
- });
82
- };
83
- renderTrigger() {
84
- const {
85
- children,
86
- as
87
- } = this.props;
88
- const {
89
- hasFocus
90
- } = this.state;
91
- const triggerProps = {
92
- 'aria-describedby': this._id
93
- };
94
- if (as) {
95
- const Trigger = getElementType(Tooltip, this.props);
96
- const props = omitProps(this.props, Tooltip.allowedProps);
97
- return _jsx(Trigger, {
98
- ...props,
99
- ...triggerProps,
100
- children: children /*TODO check if it can be TooltipRenderChildren, this might cause a crash*/
101
- });
102
- } else if (typeof children === 'function') {
103
- return children({
104
- focused: hasFocus,
105
- getTriggerProps: props => ({
106
- ...triggerProps,
107
- ...props
108
- })
109
- });
110
- } else {
111
- return ensureSingleChild(children, triggerProps);
82
+ render() {
83
+ const { renderTip, isShowingContent, defaultIsShowingContent, on, color, placement, mountNode, constrain, offsetX, offsetY, positionTarget, onShowContent, onHideContent, preventTooltip, styles, ...rest } = this.props;
84
+ return /*#__PURE__*/ _jsx(Popover, {
85
+ ...passthroughProps(rest),
86
+ isShowingContent: !preventTooltip && isShowingContent,
87
+ defaultIsShowingContent: !preventTooltip && defaultIsShowingContent,
88
+ on: on,
89
+ shouldRenderOffscreen: true,
90
+ shouldReturnFocus: false,
91
+ placement: placement,
92
+ color: color === 'primary' ? 'primary-inverse' : 'primary',
93
+ mountNode: mountNode,
94
+ constrain: constrain,
95
+ shadow: "resting",
96
+ offsetX: offsetX,
97
+ offsetY: offsetY,
98
+ positionTarget: positionTarget,
99
+ renderTrigger: ()=>this.renderTrigger(),
100
+ onShowContent: onShowContent,
101
+ onHideContent: onHideContent,
102
+ onFocus: this.handleFocus,
103
+ onBlur: this.handleBlur,
104
+ elementRef: this.handleRef,
105
+ shouldCloseOnDocumentClick: false,
106
+ shouldCloseOnEscape: true,
107
+ shouldSetAriaExpanded: false,
108
+ "data-cid": "Tooltip",
109
+ children: !preventTooltip ? /*#__PURE__*/ _jsx("span", {
110
+ id: this._id,
111
+ css: styles?.tooltip,
112
+ role: "tooltip",
113
+ children: callRenderProp(renderTip)
114
+ }) : null
115
+ });
112
116
  }
113
- }
114
- render() {
115
- const {
116
- renderTip,
117
- isShowingContent,
118
- defaultIsShowingContent,
119
- on,
120
- color,
121
- placement,
122
- mountNode,
123
- constrain,
124
- offsetX,
125
- offsetY,
126
- positionTarget,
127
- onShowContent,
128
- onHideContent,
129
- preventTooltip,
130
- styles,
131
- ...rest
132
- } = this.props;
133
- return _jsx(Popover, {
134
- ...passthroughProps(rest),
135
- isShowingContent: !preventTooltip && isShowingContent,
136
- defaultIsShowingContent: !preventTooltip && defaultIsShowingContent,
137
- on: on,
138
- shouldRenderOffscreen: true,
139
- shouldReturnFocus: false,
140
- placement: placement,
141
- color: color === 'primary' ? 'primary-inverse' : 'primary',
142
- mountNode: mountNode,
143
- constrain: constrain,
144
- shadow: "resting",
145
- offsetX: offsetX,
146
- offsetY: offsetY,
147
- positionTarget: positionTarget,
148
- renderTrigger: () => this.renderTrigger(),
149
- onShowContent: onShowContent,
150
- onHideContent: onHideContent,
151
- onFocus: this.handleFocus,
152
- onBlur: this.handleBlur,
153
- elementRef: this.handleRef,
154
- shouldCloseOnDocumentClick: false,
155
- shouldCloseOnEscape: true,
156
- shouldSetAriaExpanded: false,
157
- "data-cid": "Tooltip",
158
- children: !preventTooltip ? _jsx("span", {
159
- id: this._id,
160
- css: styles?.tooltip,
161
- role: "tooltip",
162
- children: callRenderProp(renderTip)
163
- }) : null
164
- });
165
- }
166
- }) || _class) || _class);
117
+ }
118
+ Tooltip = _ts_decorate([
119
+ withDeterministicId(),
120
+ withStyleNew(generateStyle)
121
+ ], Tooltip);
167
122
  export default Tooltip;
168
- export { Tooltip };
123
+ 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,46 +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
- * @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
- };
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
+ };
45
13
  };
46
- export default generateStyle;
14
+ export default generateStyle;
package/es/exports/a.js CHANGED
@@ -1,24 +1 @@
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
- export { Tooltip } from '../Tooltip/v1/index.js';
1
+ export { Tooltip } from '../Tooltip/v1/index.js';
package/es/exports/b.js CHANGED
@@ -1,24 +1 @@
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
- export { Tooltip } from '../Tooltip/v2/index.js';
1
+ export { Tooltip } from '../Tooltip/v2/index.js';
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@instructure/ui-tooltip",
3
- "version": "11.7.8",
3
+ "version": "11.7.9-pr-snapshot-1792147648392",
4
+ "type": "module",
4
5
  "description": "A component for showing small text-only overlays on hover/focus.",
5
6
  "author": "Instructure, Inc. Engineering and Product Design",
6
7
  "module": "./es/index.js",
7
- "main": "./lib/index.js",
8
8
  "types": "./types/index.d.ts",
9
9
  "repository": {
10
10
  "type": "git",
@@ -14,20 +14,19 @@
14
14
  "bugs": "https://github.com/instructure/instructure-ui/issues",
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
- "@babel/runtime": "^7.29.7",
18
- "@instructure/emotion": "11.7.8",
19
- "@instructure/ui-react-utils": "11.7.8",
20
- "@instructure/shared-types": "11.7.8",
21
- "@instructure/ui-popover": "11.7.8",
22
- "@instructure/ui-position": "11.7.8",
23
- "@instructure/ui-themes": "11.7.8",
24
- "@instructure/ui-utils": "11.7.8"
17
+ "@swc/helpers": "^0.5.23",
18
+ "@instructure/emotion": "11.7.9-pr-snapshot-1792147648392",
19
+ "@instructure/shared-types": "11.7.9-pr-snapshot-1792147648392",
20
+ "@instructure/ui-position": "11.7.9-pr-snapshot-1792147648392",
21
+ "@instructure/ui-popover": "11.7.9-pr-snapshot-1792147648392",
22
+ "@instructure/ui-react-utils": "11.7.9-pr-snapshot-1792147648392",
23
+ "@instructure/ui-themes": "11.7.9-pr-snapshot-1792147648392",
24
+ "@instructure/ui-utils": "11.7.9-pr-snapshot-1792147648392"
25
25
  },
26
26
  "devDependencies": {
27
27
  "vitest": "^5.0.0",
28
- "@instructure/ui-scripts": "11.7.8",
29
- "@instructure/ui-color-utils": "11.7.8",
30
- "@instructure/ui-babel-preset": "11.7.8"
28
+ "@instructure/ui-color-utils": "11.7.9-pr-snapshot-1792147648392",
29
+ "@instructure/ui-scripts": "11.7.9-pr-snapshot-1792147648392"
31
30
  },
32
31
  "peerDependencies": {
33
32
  "react": ">=18 <=19"
@@ -37,7 +36,6 @@
37
36
  },
38
37
  "sideEffects": false,
39
38
  "exports": {
40
- "./lib/*": "./lib/*",
41
39
  "./es/*": "./es/*",
42
40
  "./types/*": "./types/*",
43
41
  "./package.json": "./package.json",
@@ -46,28 +44,24 @@
46
44
  "src": "./src/exports/a.ts",
47
45
  "types": "./types/exports/a.d.ts",
48
46
  "import": "./es/exports/a.js",
49
- "require": "./lib/exports/a.js",
50
47
  "default": "./es/exports/a.js"
51
48
  },
52
49
  "./v11_6": {
53
50
  "src": "./src/exports/a.ts",
54
51
  "types": "./types/exports/a.d.ts",
55
52
  "import": "./es/exports/a.js",
56
- "require": "./lib/exports/a.js",
57
53
  "default": "./es/exports/a.js"
58
54
  },
59
55
  "./v11_7": {
60
56
  "src": "./src/exports/b.ts",
61
57
  "types": "./types/exports/b.d.ts",
62
58
  "import": "./es/exports/b.js",
63
- "require": "./lib/exports/b.js",
64
59
  "default": "./es/exports/b.js"
65
60
  },
66
61
  "./latest": {
67
62
  "src": "./src/exports/b.ts",
68
63
  "types": "./types/exports/b.d.ts",
69
64
  "import": "./es/exports/b.js",
70
- "require": "./lib/exports/b.js",
71
65
  "default": "./es/exports/b.js"
72
66
  }
73
67
  },
@@ -75,7 +69,7 @@
75
69
  "lint": "ui-scripts lint",
76
70
  "lint:fix": "ui-scripts lint --fix",
77
71
  "clean": "ui-scripts clean",
78
- "build": "ui-scripts build --modules es,cjs",
72
+ "build": "ui-scripts build",
79
73
  "build:watch": "pnpm run ts:check -- --watch & ui-scripts build --watch",
80
74
  "build:types": "tsc -p tsconfig.build.json",
81
75
  "ts:check": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
@@ -12,7 +12,6 @@
12
12
  { "path": "../ui-popover/tsconfig.build.json" },
13
13
  { "path": "../ui-position/tsconfig.build.json" },
14
14
  { "path": "../ui-react-utils/tsconfig.build.json" },
15
- { "path": "../ui-babel-preset/tsconfig.build.json" },
16
15
  { "path": "../ui-color-utils/tsconfig.build.json" },
17
16
  { "path": "../ui-utils/tsconfig.build.json" },
18
17
  { "path": "../ui-themes/tsconfig.build.json" },