@instructure/ui-tooltip 11.7.3 → 11.7.4-pr-snapshot-1781695314229

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.
@@ -7,6 +7,7 @@ category: components
7
7
  ---
8
8
  **/
9
9
  declare class Tooltip extends Component<TooltipProps, TooltipState> {
10
+ static displayName: string;
10
11
  static readonly componentId = "Tooltip";
11
12
  static allowedProps: readonly (keyof {
12
13
  elementRef?: (element: Element | null) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Tooltip/v1/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAW5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAMjE,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAGzD;;;;GAIG;AACH,cAEM,OAAQ,SAAQ,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IACzD,MAAM,CAAC,QAAQ,CAAC,WAAW,aAAY;IAEvC,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;SAAe;IAElC,MAAM,CAAC,YAAY;;;;;;;;MAQT;IAEV,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IAE5B,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,GAAI,IAAI,OAAO,GAAG,IAAI,UAK9B;gBAEW,KAAK,EAAE,YAAY;IAQ/B,iBAAiB;IAIjB,kBAAkB;IAIlB,WAAW,EAAE,YAAY,CAAC,SAAS,CAAC,CAEnC;IAED,UAAU,EAAE,YAAY,CAAC,QAAQ,CAAC,CAEjC;IAED,aAAa;IA+Bb,MAAM;CAwDP;AAED,eAAe,OAAO,CAAA;AACtB,OAAO,EAAE,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Tooltip/v1/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAW5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAMjE,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAGzD;;;;GAIG;AACH,cAEM,OAAQ,SAAQ,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IACzD,MAAM,CAAC,WAAW,SAAY;IAC9B,MAAM,CAAC,QAAQ,CAAC,WAAW,aAAY;IAEvC,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;SAAe;IAElC,MAAM,CAAC,YAAY;;;;;;;;MAQT;IAEV,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IAE5B,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,GAAI,IAAI,OAAO,GAAG,IAAI,UAK9B;gBAEW,KAAK,EAAE,YAAY;IAQ/B,iBAAiB;IAIjB,kBAAkB;IAIlB,WAAW,EAAE,YAAY,CAAC,SAAS,CAAC,CAEnC;IAED,UAAU,EAAE,YAAY,CAAC,QAAQ,CAAC,CAEjC;IAED,aAAa;IA+Bb,MAAM;CAwDP;AAED,eAAe,OAAO,CAAA;AACtB,OAAO,EAAE,OAAO,EAAE,CAAA"}
@@ -7,6 +7,7 @@ category: components
7
7
  ---
8
8
  **/
9
9
  declare class Tooltip extends Component<TooltipProps, TooltipState> {
10
+ static displayName: string;
10
11
  static readonly componentId = "Tooltip";
11
12
  static allowedProps: readonly (keyof {
12
13
  elementRef?: (element: Element | null) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Tooltip/v2/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAW5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAKlE,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAGzD;;;;GAIG;AACH,cAEM,OAAQ,SAAQ,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IACzD,MAAM,CAAC,QAAQ,CAAC,WAAW,aAAY;IAEvC,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;SAAe;IAElC,MAAM,CAAC,YAAY;;;;;;;;MAQT;IAEV,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IAE5B,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,GAAI,IAAI,OAAO,GAAG,IAAI,UAK9B;gBAEW,KAAK,EAAE,YAAY;IAQ/B,iBAAiB;IAIjB,kBAAkB;IAIlB,WAAW,EAAE,YAAY,CAAC,SAAS,CAAC,CAEnC;IAED,UAAU,EAAE,YAAY,CAAC,QAAQ,CAAC,CAEjC;IAED,aAAa;IA+Bb,MAAM;CAwDP;AAED,eAAe,OAAO,CAAA;AACtB,OAAO,EAAE,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Tooltip/v2/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAW5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAKlE,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAGzD;;;;GAIG;AACH,cAEM,OAAQ,SAAQ,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IACzD,MAAM,CAAC,WAAW,SAAY;IAC9B,MAAM,CAAC,QAAQ,CAAC,WAAW,aAAY;IAEvC,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;SAAe;IAElC,MAAM,CAAC,YAAY;;;;;;;;MAQT;IAEV,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IAE5B,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,GAAI,IAAI,OAAO,GAAG,IAAI,UAK9B;gBAEW,KAAK,EAAE,YAAY;IAQ/B,iBAAiB;IAIjB,kBAAkB;IAIlB,WAAW,EAAE,YAAY,CAAC,SAAS,CAAC,CAEnC;IAED,UAAU,EAAE,YAAY,CAAC,QAAQ,CAAC,CAEjC;IAED,aAAa;IA+Bb,MAAM;CAwDP;AAED,eAAe,OAAO,CAAA;AACtB,OAAO,EAAE,OAAO,EAAE,CAAA"}
@@ -1,3 +1,3 @@
1
- export { Tooltip } from '../Tooltip/v1';
1
+ export { Tooltip } from '../Tooltip/v1/index.js';
2
2
  export type { TooltipProps, TooltipRenderChildrenArgs } from '../Tooltip/v1/props';
3
3
  //# sourceMappingURL=a.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../../src/exports/a.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,YAAY,EACV,YAAY,EACZ,yBAAyB,EAC1B,MAAM,qBAAqB,CAAA"}
1
+ {"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../../src/exports/a.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAChD,YAAY,EACV,YAAY,EACZ,yBAAyB,EAC1B,MAAM,qBAAqB,CAAA"}
@@ -1,3 +1,3 @@
1
- export { Tooltip } from '../Tooltip/v2';
1
+ export { Tooltip } from '../Tooltip/v2/index.js';
2
2
  export type { TooltipProps, TooltipRenderChildrenArgs } from '../Tooltip/v2/props';
3
3
  //# sourceMappingURL=b.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"b.d.ts","sourceRoot":"","sources":["../../src/exports/b.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,YAAY,EACV,YAAY,EACZ,yBAAyB,EAC1B,MAAM,qBAAqB,CAAA"}
1
+ {"version":3,"file":"b.d.ts","sourceRoot":"","sources":["../../src/exports/b.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAChD,YAAY,EACV,YAAY,EACZ,yBAAyB,EAC1B,MAAM,qBAAqB,CAAA"}
@@ -1,178 +0,0 @@
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 _react = require("react");
9
- var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
10
- var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
11
- var _ensureSingleChild = require("@instructure/ui-react-utils/lib/ensureSingleChild.js");
12
- var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
13
- var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
14
- var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
15
- var _v11_ = require("@instructure/ui-popover/v11_6");
16
- var _emotion = require("@instructure/emotion");
17
- var _styles = _interopRequireDefault(require("./styles"));
18
- var _theme = _interopRequireDefault(require("./theme"));
19
- var _props = require("./props");
20
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
21
- var _dec, _dec2, _class;
22
- /*
23
- * The MIT License (MIT)
24
- *
25
- * Copyright (c) 2015 - present Instructure, Inc.
26
- *
27
- * Permission is hereby granted, free of charge, to any person obtaining a copy
28
- * of this software and associated documentation files (the "Software"), to deal
29
- * in the Software without restriction, including without limitation the rights
30
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
31
- * copies of the Software, and to permit persons to whom the Software is
32
- * furnished to do so, subject to the following conditions:
33
- *
34
- * The above copyright notice and this permission notice shall be included in all
35
- * copies or substantial portions of the Software.
36
- *
37
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
40
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
43
- * SOFTWARE.
44
- */
45
- /**
46
- ---
47
- category: components
48
- ---
49
- **/
50
- let Tooltip = exports.Tooltip = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = class Tooltip extends _react.Component {
51
- static displayName = "Tooltip";
52
- static componentId = 'Tooltip';
53
- static allowedProps = _props.allowedProps;
54
- static defaultProps = {
55
- defaultIsShowingContent: false,
56
- color: 'primary',
57
- placement: 'top',
58
- constrain: 'window',
59
- offsetX: 0,
60
- offsetY: 0,
61
- preventTooltip: false
62
- };
63
- _id;
64
- ref = null;
65
- handleRef = el => {
66
- this.ref = el;
67
- if (typeof this.props.elementRef === 'function') {
68
- this.props.elementRef(el);
69
- }
70
- };
71
- constructor(props) {
72
- super(props);
73
- this._id = props.deterministicId();
74
- this.state = {
75
- hasFocus: false
76
- };
77
- }
78
- componentDidMount() {
79
- this.props.makeStyles?.();
80
- }
81
- componentDidUpdate() {
82
- this.props.makeStyles?.();
83
- }
84
- handleFocus = () => {
85
- this.setState({
86
- hasFocus: true
87
- });
88
- };
89
- handleBlur = () => {
90
- this.setState({
91
- hasFocus: false
92
- });
93
- };
94
- renderTrigger() {
95
- const {
96
- children,
97
- as
98
- } = this.props;
99
- const {
100
- hasFocus
101
- } = this.state;
102
- const triggerProps = {
103
- 'aria-describedby': this._id
104
- };
105
- if (as) {
106
- const Trigger = (0, _getElementType.getElementType)(Tooltip, this.props);
107
- const props = (0, _omitProps.omitProps)(this.props, Tooltip.allowedProps);
108
- return (0, _jsxRuntime.jsx)(Trigger, {
109
- ...props,
110
- ...triggerProps,
111
- children: children /*TODO check if it can be TooltipRenderChildren, this might cause a crash*/
112
- });
113
- } else if (typeof children === 'function') {
114
- return children({
115
- focused: hasFocus,
116
- getTriggerProps: props => ({
117
- ...triggerProps,
118
- ...props
119
- })
120
- });
121
- } else {
122
- return (0, _ensureSingleChild.ensureSingleChild)(children, triggerProps);
123
- }
124
- }
125
- render() {
126
- const {
127
- renderTip,
128
- isShowingContent,
129
- defaultIsShowingContent,
130
- on,
131
- color,
132
- placement,
133
- mountNode,
134
- constrain,
135
- offsetX,
136
- offsetY,
137
- positionTarget,
138
- onShowContent,
139
- onHideContent,
140
- preventTooltip,
141
- styles,
142
- ...rest
143
- } = this.props;
144
- return (0, _jsxRuntime.jsx)(_v11_.Popover, {
145
- ...(0, _passthroughProps.passthroughProps)(rest),
146
- isShowingContent: !preventTooltip && isShowingContent,
147
- defaultIsShowingContent: !preventTooltip && defaultIsShowingContent,
148
- on: on,
149
- shouldRenderOffscreen: true,
150
- shouldReturnFocus: false,
151
- placement: placement,
152
- color: color === 'primary' ? 'primary-inverse' : 'primary',
153
- mountNode: mountNode,
154
- constrain: constrain,
155
- shadow: "none",
156
- offsetX: offsetX,
157
- offsetY: offsetY,
158
- positionTarget: positionTarget,
159
- renderTrigger: () => this.renderTrigger(),
160
- onShowContent: onShowContent,
161
- onHideContent: onHideContent,
162
- onFocus: this.handleFocus,
163
- onBlur: this.handleBlur,
164
- elementRef: this.handleRef,
165
- shouldCloseOnDocumentClick: false,
166
- shouldCloseOnEscape: true,
167
- shouldSetAriaExpanded: false,
168
- "data-cid": "Tooltip",
169
- children: !preventTooltip ? (0, _jsxRuntime.jsx)("span", {
170
- id: this._id,
171
- css: styles?.tooltip,
172
- role: "tooltip",
173
- children: (0, _callRenderProp.callRenderProp)(renderTip)
174
- }) : null
175
- });
176
- }
177
- }) || _class) || _class);
178
- var _default = exports.default = Tooltip;
@@ -1,33 +0,0 @@
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'];
@@ -1,54 +0,0 @@
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
- * @param {Object} props the props of the component, the style is applied to
38
- * @param {Object} state the state of the component, the style is applied to
39
- * @return {Object} The final style object, which will be used in the component
40
- */
41
- const generateStyle = componentTheme => {
42
- return {
43
- tooltip: {
44
- label: 'tooltip',
45
- fontFamily: componentTheme.fontFamily,
46
- fontWeight: componentTheme.fontWeight,
47
- boxSizing: 'border-box',
48
- display: 'block',
49
- fontSize: componentTheme.fontSize,
50
- padding: componentTheme.padding
51
- }
52
- };
53
- };
54
- var _default = exports.default = generateStyle;
@@ -1,51 +0,0 @@
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
- * Generates the theme object for the component from the theme and provided additional information
33
- * @param {Object} theme The actual theme object.
34
- * @return {Object} The final theme object with the overrides and component variables
35
- */
36
- const generateComponentTheme = theme => {
37
- const {
38
- typography,
39
- spacing
40
- } = theme;
41
- const componentVariables = {
42
- fontFamily: typography?.fontFamily,
43
- fontWeight: typography?.fontWeightNormal,
44
- fontSize: typography?.fontSizeSmall,
45
- padding: spacing?.small
46
- };
47
- return {
48
- ...componentVariables
49
- };
50
- };
51
- var _default = exports.default = generateComponentTheme;
@@ -1,177 +0,0 @@
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 _react = require("react");
9
- var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
10
- var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
11
- var _ensureSingleChild = require("@instructure/ui-react-utils/lib/ensureSingleChild.js");
12
- var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
13
- var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
14
- var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
15
- var _latest = require("@instructure/ui-popover/latest");
16
- var _emotion = require("@instructure/emotion");
17
- var _styles = _interopRequireDefault(require("./styles"));
18
- var _props = require("./props");
19
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
20
- var _dec, _dec2, _class;
21
- /*
22
- * The MIT License (MIT)
23
- *
24
- * Copyright (c) 2015 - present Instructure, Inc.
25
- *
26
- * Permission is hereby granted, free of charge, to any person obtaining a copy
27
- * of this software and associated documentation files (the "Software"), to deal
28
- * in the Software without restriction, including without limitation the rights
29
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
30
- * copies of the Software, and to permit persons to whom the Software is
31
- * furnished to do so, subject to the following conditions:
32
- *
33
- * The above copyright notice and this permission notice shall be included in all
34
- * copies or substantial portions of the Software.
35
- *
36
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
41
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
42
- * SOFTWARE.
43
- */
44
- /**
45
- ---
46
- category: components
47
- ---
48
- **/
49
- let Tooltip = exports.Tooltip = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyleNew)(_styles.default), _dec(_class = _dec2(_class = class Tooltip extends _react.Component {
50
- static displayName = "Tooltip";
51
- static componentId = 'Tooltip';
52
- static allowedProps = _props.allowedProps;
53
- static defaultProps = {
54
- defaultIsShowingContent: false,
55
- color: 'primary',
56
- placement: 'top',
57
- constrain: 'window',
58
- offsetX: 0,
59
- offsetY: 0,
60
- preventTooltip: false
61
- };
62
- _id;
63
- ref = null;
64
- handleRef = el => {
65
- this.ref = el;
66
- if (typeof this.props.elementRef === 'function') {
67
- this.props.elementRef(el);
68
- }
69
- };
70
- constructor(props) {
71
- super(props);
72
- this._id = props.deterministicId();
73
- this.state = {
74
- hasFocus: false
75
- };
76
- }
77
- componentDidMount() {
78
- this.props.makeStyles?.();
79
- }
80
- componentDidUpdate() {
81
- this.props.makeStyles?.();
82
- }
83
- handleFocus = () => {
84
- this.setState({
85
- hasFocus: true
86
- });
87
- };
88
- handleBlur = () => {
89
- this.setState({
90
- hasFocus: false
91
- });
92
- };
93
- renderTrigger() {
94
- const {
95
- children,
96
- as
97
- } = this.props;
98
- const {
99
- hasFocus
100
- } = this.state;
101
- const triggerProps = {
102
- 'aria-describedby': this._id
103
- };
104
- if (as) {
105
- const Trigger = (0, _getElementType.getElementType)(Tooltip, this.props);
106
- const props = (0, _omitProps.omitProps)(this.props, Tooltip.allowedProps);
107
- return (0, _jsxRuntime.jsx)(Trigger, {
108
- ...props,
109
- ...triggerProps,
110
- children: children /*TODO check if it can be TooltipRenderChildren, this might cause a crash*/
111
- });
112
- } else if (typeof children === 'function') {
113
- return children({
114
- focused: hasFocus,
115
- getTriggerProps: props => ({
116
- ...triggerProps,
117
- ...props
118
- })
119
- });
120
- } else {
121
- return (0, _ensureSingleChild.ensureSingleChild)(children, triggerProps);
122
- }
123
- }
124
- render() {
125
- const {
126
- renderTip,
127
- isShowingContent,
128
- defaultIsShowingContent,
129
- on,
130
- color,
131
- placement,
132
- mountNode,
133
- constrain,
134
- offsetX,
135
- offsetY,
136
- positionTarget,
137
- onShowContent,
138
- onHideContent,
139
- preventTooltip,
140
- styles,
141
- ...rest
142
- } = this.props;
143
- return (0, _jsxRuntime.jsx)(_latest.Popover, {
144
- ...(0, _passthroughProps.passthroughProps)(rest),
145
- isShowingContent: !preventTooltip && isShowingContent,
146
- defaultIsShowingContent: !preventTooltip && defaultIsShowingContent,
147
- on: on,
148
- shouldRenderOffscreen: true,
149
- shouldReturnFocus: false,
150
- placement: placement,
151
- color: color === 'primary' ? 'primary-inverse' : 'primary',
152
- mountNode: mountNode,
153
- constrain: constrain,
154
- shadow: "resting",
155
- offsetX: offsetX,
156
- offsetY: offsetY,
157
- positionTarget: positionTarget,
158
- renderTrigger: () => this.renderTrigger(),
159
- onShowContent: onShowContent,
160
- onHideContent: onHideContent,
161
- onFocus: this.handleFocus,
162
- onBlur: this.handleBlur,
163
- elementRef: this.handleRef,
164
- shouldCloseOnDocumentClick: false,
165
- shouldCloseOnEscape: true,
166
- shouldSetAriaExpanded: false,
167
- "data-cid": "Tooltip",
168
- children: !preventTooltip ? (0, _jsxRuntime.jsx)("span", {
169
- id: this._id,
170
- css: styles?.tooltip,
171
- role: "tooltip",
172
- children: (0, _callRenderProp.callRenderProp)(renderTip)
173
- }) : null
174
- });
175
- }
176
- }) || _class) || _class);
177
- var _default = exports.default = Tooltip;
@@ -1,52 +0,0 @@
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;
package/lib/exports/a.js DELETED
@@ -1,12 +0,0 @@
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/v1");
package/lib/exports/b.js DELETED
@@ -1,12 +0,0 @@
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/lib/package.json DELETED
@@ -1 +0,0 @@
1
- {"type":"commonjs"}