@fluentui/react-tooltip 9.0.0-beta.1 → 9.0.0-beta.5
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +249 -1
- package/CHANGELOG.md +68 -2
- package/dist/react-tooltip.d.ts +2 -0
- package/lib/common/isConformant.js +1 -1
- package/lib/common/isConformant.js.map +1 -1
- package/lib/components/Tooltip/Tooltip.js +2 -2
- package/lib/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/components/Tooltip/index.d.ts +1 -1
- package/lib/components/Tooltip/index.js +1 -1
- package/lib/components/Tooltip/index.js.map +1 -1
- package/lib/components/Tooltip/renderTooltip.js +6 -7
- package/lib/components/Tooltip/renderTooltip.js.map +1 -1
- package/lib/components/Tooltip/useTooltip.js +69 -79
- package/lib/components/Tooltip/useTooltip.js.map +1 -1
- package/lib/components/Tooltip/useTooltipStyles.d.ts +1 -0
- package/lib/components/Tooltip/useTooltipStyles.js +17 -8
- package/lib/components/Tooltip/useTooltipStyles.js.map +1 -1
- package/lib-commonjs/Tooltip.js +1 -1
- package/lib-commonjs/common/isConformant.js +3 -3
- package/lib-commonjs/common/isConformant.js.map +1 -1
- package/lib-commonjs/components/Tooltip/Tooltip.js +6 -6
- package/lib-commonjs/components/Tooltip/Tooltip.js.map +1 -1
- package/lib-commonjs/components/Tooltip/index.d.ts +1 -1
- package/lib-commonjs/components/Tooltip/index.js +2 -10
- package/lib-commonjs/components/Tooltip/index.js.map +1 -1
- package/lib-commonjs/components/Tooltip/renderTooltip.js +9 -11
- package/lib-commonjs/components/Tooltip/renderTooltip.js.map +1 -1
- package/lib-commonjs/components/Tooltip/useTooltip.js +73 -84
- package/lib-commonjs/components/Tooltip/useTooltip.js.map +1 -1
- package/lib-commonjs/components/Tooltip/useTooltipStyles.d.ts +1 -0
- package/lib-commonjs/components/Tooltip/useTooltipStyles.js +21 -11
- package/lib-commonjs/components/Tooltip/useTooltipStyles.js.map +1 -1
- package/lib-commonjs/index.js +1 -1
- package/package.json +10 -11
@@ -5,20 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.useTooltip = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const React = /*#__PURE__*/require("react");
|
9
9
|
|
10
|
-
|
10
|
+
const react_positioning_1 = /*#__PURE__*/require("@fluentui/react-positioning");
|
11
11
|
|
12
|
-
|
12
|
+
const react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
|
13
13
|
|
14
|
-
|
14
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities"); // Style values that are required for popper to properly position the tooltip
|
15
15
|
|
16
|
-
var react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities"); // Style values that are required for popper to properly position the tooltip
|
17
16
|
|
17
|
+
const tooltipBorderRadius = 4; // Update the root's borderRadius in useTooltipStyles.ts if this changes
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
var arrowHeight = 6; // Update the arrow's width/height in useTooltipStyles.ts if this changes
|
19
|
+
const arrowHeight = 6; // Update the arrow's width/height in useTooltipStyles.ts if this changes
|
22
20
|
|
23
21
|
/**
|
24
22
|
* Create the state required to render Tooltip.
|
@@ -31,39 +29,32 @@ var arrowHeight = 6; // Update the arrow's width/height in useTooltipStyles.ts i
|
|
31
29
|
* @param defaultProps - (optional) default prop values provided by the implementing type
|
32
30
|
*/
|
33
31
|
|
34
|
-
|
32
|
+
const useTooltip = (props, ref) => {
|
35
33
|
var _a, _b, _c, _d;
|
36
34
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
_h = props.hideDelay,
|
55
|
-
hideDelay = _h === void 0 ? 250 : _h;
|
56
|
-
|
57
|
-
var _j = react_utilities_1.useControllableState({
|
35
|
+
const context = React.useContext(react_shared_contexts_1.TooltipContext);
|
36
|
+
const isServerSideRender = react_utilities_1.useIsSSR();
|
37
|
+
const {
|
38
|
+
targetDocument
|
39
|
+
} = react_shared_contexts_1.useFluent();
|
40
|
+
const [setDelayTimeout, clearDelayTimeout] = react_utilities_1.useTimeout();
|
41
|
+
const {
|
42
|
+
content,
|
43
|
+
inverted,
|
44
|
+
withArrow,
|
45
|
+
positioning,
|
46
|
+
onVisibleChange,
|
47
|
+
triggerAriaAttribute = 'label',
|
48
|
+
showDelay = 250,
|
49
|
+
hideDelay = 250
|
50
|
+
} = props;
|
51
|
+
const [visible, setVisibleInternal] = react_utilities_1.useControllableState({
|
58
52
|
state: props.visible,
|
59
53
|
initialState: false
|
60
|
-
})
|
61
|
-
|
62
|
-
setVisibleInternal = _j[1];
|
63
|
-
|
64
|
-
var setVisible = React.useCallback(function (newVisible, ev) {
|
54
|
+
});
|
55
|
+
const setVisible = React.useCallback((newVisible, ev) => {
|
65
56
|
clearDelayTimeout();
|
66
|
-
setVisibleInternal(
|
57
|
+
setVisibleInternal(oldVisible => {
|
67
58
|
if (newVisible !== oldVisible) {
|
68
59
|
onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(ev, {
|
69
60
|
visible: newVisible
|
@@ -73,76 +64,74 @@ var useTooltip = function (props, ref) {
|
|
73
64
|
return newVisible;
|
74
65
|
});
|
75
66
|
}, [clearDelayTimeout, setVisibleInternal, onVisibleChange]);
|
76
|
-
|
77
|
-
content
|
78
|
-
inverted
|
79
|
-
withArrow
|
80
|
-
positioning
|
81
|
-
showDelay
|
82
|
-
hideDelay
|
83
|
-
triggerAriaAttribute
|
84
|
-
visible
|
67
|
+
const state = {
|
68
|
+
content,
|
69
|
+
inverted,
|
70
|
+
withArrow,
|
71
|
+
positioning,
|
72
|
+
showDelay,
|
73
|
+
hideDelay,
|
74
|
+
triggerAriaAttribute,
|
75
|
+
visible,
|
85
76
|
shouldRenderTooltip: visible,
|
86
77
|
appearance: props.appearance,
|
87
78
|
// Slots
|
88
79
|
components: {
|
89
80
|
root: 'div'
|
90
81
|
},
|
91
|
-
root: react_utilities_1.getNativeElementProps('div',
|
92
|
-
role: 'tooltip'
|
93
|
-
|
94
|
-
ref
|
82
|
+
root: react_utilities_1.getNativeElementProps('div', {
|
83
|
+
role: 'tooltip',
|
84
|
+
...props,
|
85
|
+
ref,
|
95
86
|
id: react_utilities_1.useId('tooltip-', props.id)
|
96
|
-
})
|
87
|
+
})
|
97
88
|
};
|
98
|
-
|
99
|
-
var popperOptions = tslib_1.__assign({
|
89
|
+
const popperOptions = {
|
100
90
|
enabled: state.visible,
|
101
91
|
arrowPadding: 2 * tooltipBorderRadius,
|
102
92
|
position: 'above',
|
103
93
|
align: 'center',
|
104
|
-
offset: [0, 4]
|
105
|
-
|
94
|
+
offset: [0, 4],
|
95
|
+
...react_positioning_1.resolvePositioningShorthand(state.positioning)
|
96
|
+
};
|
106
97
|
|
107
98
|
if (state.withArrow) {
|
108
99
|
popperOptions.offset = react_positioning_1.mergeArrowOffset(popperOptions.offset, arrowHeight);
|
109
100
|
}
|
110
101
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
102
|
+
const {
|
103
|
+
targetRef,
|
104
|
+
containerRef,
|
105
|
+
arrowRef
|
106
|
+
} = react_positioning_1.usePopper(popperOptions);
|
116
107
|
state.root.ref = react_utilities_1.useMergedRefs(state.root.ref, containerRef);
|
117
108
|
state.arrowRef = arrowRef; // When this tooltip is visible, hide any other tooltips, and register it
|
118
109
|
// as the visibleTooltip with the TooltipContext.
|
119
110
|
// Also add a listener on document to hide the tooltip if Escape is pressed
|
120
111
|
|
121
|
-
react_utilities_1.useIsomorphicLayoutEffect(
|
112
|
+
react_utilities_1.useIsomorphicLayoutEffect(() => {
|
122
113
|
var _a;
|
123
114
|
|
124
115
|
if (visible) {
|
125
|
-
|
126
|
-
hide:
|
127
|
-
return setVisible(false);
|
128
|
-
}
|
116
|
+
const thisTooltip = {
|
117
|
+
hide: () => setVisible(false)
|
129
118
|
};
|
130
119
|
(_a = context.visibleTooltip) === null || _a === void 0 ? void 0 : _a.hide();
|
131
|
-
context.visibleTooltip =
|
120
|
+
context.visibleTooltip = thisTooltip;
|
132
121
|
|
133
|
-
|
122
|
+
const onDocumentKeyDown = ev => {
|
134
123
|
if (ev.key === 'Escape' || ev.key === 'Esc') {
|
135
|
-
|
124
|
+
thisTooltip.hide();
|
136
125
|
}
|
137
126
|
};
|
138
127
|
|
139
|
-
targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener('keydown',
|
140
|
-
return
|
141
|
-
if (context.visibleTooltip ===
|
128
|
+
targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener('keydown', onDocumentKeyDown);
|
129
|
+
return () => {
|
130
|
+
if (context.visibleTooltip === thisTooltip) {
|
142
131
|
context.visibleTooltip = undefined;
|
143
132
|
}
|
144
133
|
|
145
|
-
targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener('keydown',
|
134
|
+
targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener('keydown', onDocumentKeyDown);
|
146
135
|
};
|
147
136
|
}
|
148
137
|
}, [context, targetDocument, visible, setVisible]); // The focused element gets a blur event when the document loses focus
|
@@ -151,24 +140,24 @@ var useTooltip = function (props, ref) {
|
|
151
140
|
// checking if the blurred element is still the document's activeElement.
|
152
141
|
// See https://github.com/microsoft/fluentui/issues/13541
|
153
142
|
|
154
|
-
|
143
|
+
const ignoreNextFocusEventRef = React.useRef(false); // Listener for onPointerEnter and onFocus on the trigger element
|
155
144
|
|
156
|
-
|
145
|
+
const onEnterTrigger = React.useCallback(ev => {
|
157
146
|
if (ev.type === 'focus' && ignoreNextFocusEventRef.current) {
|
158
147
|
ignoreNextFocusEventRef.current = false;
|
159
148
|
return;
|
160
149
|
} // Show immediately if another tooltip is already visible
|
161
150
|
|
162
151
|
|
163
|
-
|
164
|
-
setDelayTimeout(
|
152
|
+
const delay = context.visibleTooltip ? 0 : state.showDelay;
|
153
|
+
setDelayTimeout(() => {
|
165
154
|
setVisible(true, ev);
|
166
155
|
}, delay);
|
167
156
|
ev.persist(); // Persist the event since the setVisible call will happen asynchronously
|
168
157
|
}, [setDelayTimeout, setVisible, state.showDelay, context]); // Listener for onPointerLeave and onBlur on the trigger element
|
169
158
|
|
170
|
-
|
171
|
-
|
159
|
+
const onLeaveTrigger = React.useCallback(ev => {
|
160
|
+
let delay = state.hideDelay;
|
172
161
|
|
173
162
|
if (ev.type === 'blur') {
|
174
163
|
// Hide immediately when losing focus
|
@@ -176,7 +165,7 @@ var useTooltip = function (props, ref) {
|
|
176
165
|
ignoreNextFocusEventRef.current = (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement) === ev.target;
|
177
166
|
}
|
178
167
|
|
179
|
-
setDelayTimeout(
|
168
|
+
setDelayTimeout(() => {
|
180
169
|
setVisible(false, ev);
|
181
170
|
}, delay);
|
182
171
|
ev.persist(); // Persist the event since the setVisible call will happen asynchronously
|
@@ -185,17 +174,17 @@ var useTooltip = function (props, ref) {
|
|
185
174
|
|
186
175
|
state.root.onPointerEnter = useMergedCallbacks(state.root.onPointerEnter, clearDelayTimeout);
|
187
176
|
state.root.onPointerLeave = useMergedCallbacks(state.root.onPointerLeave, onLeaveTrigger);
|
188
|
-
|
177
|
+
const child = React.isValidElement(state.root.children) ? state.root.children : undefined; // The props to add to the trigger element (child)
|
189
178
|
|
190
|
-
|
179
|
+
const triggerProps = {
|
191
180
|
onPointerEnter: useMergedCallbacks((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onPointerEnter, onEnterTrigger),
|
192
181
|
onPointerLeave: useMergedCallbacks((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.onPointerLeave, onLeaveTrigger),
|
193
182
|
onFocus: useMergedCallbacks((_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.onFocus, onEnterTrigger),
|
194
183
|
onBlur: useMergedCallbacks((_d = child === null || child === void 0 ? void 0 : child.props) === null || _d === void 0 ? void 0 : _d.onBlur, onLeaveTrigger)
|
195
184
|
}; // If the target prop is not provided, attach targetRef to the trigger element's ref prop
|
196
185
|
|
197
|
-
|
198
|
-
|
186
|
+
const childWithRef = child;
|
187
|
+
const childTargetRef = react_utilities_1.useMergedRefs(childWithRef === null || childWithRef === void 0 ? void 0 : childWithRef.ref, targetRef);
|
199
188
|
|
200
189
|
if (popperOptions.target === undefined) {
|
201
190
|
triggerProps.ref = childTargetRef;
|
@@ -229,8 +218,8 @@ exports.useTooltip = useTooltip;
|
|
229
218
|
* Combine up to two event callbacks into a single function that calls them in order
|
230
219
|
*/
|
231
220
|
|
232
|
-
|
233
|
-
return React.useCallback(
|
221
|
+
const useMergedCallbacks = (callback1, callback2) => {
|
222
|
+
return React.useCallback(ev => {
|
234
223
|
callback1 === null || callback1 === void 0 ? void 0 : callback1(ev);
|
235
224
|
callback2 === null || callback2 === void 0 ? void 0 : callback2(ev);
|
236
225
|
}, [callback1, callback2]);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Tooltip/useTooltip.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/useTooltip.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA,C,CAYA;;;AACA,MAAM,mBAAmB,GAAG,CAA5B,C,CAA+B;;AAC/B,MAAM,WAAW,GAAG,CAApB,C,CAAuB;;AAEvB;;;;;;;;;AASG;;AACI,MAAM,UAAU,GAAG,CAAC,KAAD,EAAsB,GAAtB,KAAsE;;;AAC9F,QAAM,OAAO,GAAG,KAAK,CAAC,UAAN,C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SADyB,EAEzB,SAFyB,KAGvB;AACF,SAAO,KAAK,CAAC,WAAN,CACJ,EAAD,IAAc;AACZ,IAAA,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAS,KAAA,CAAT,GAAA,SAAS,CAAG,EAAH,CAAT;AACA,IAAA,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAS,KAAA,CAAT,GAAA,SAAS,CAAG,EAAH,CAAT;AACD,GAJI,EAKL,CAAC,SAAD,EAAY,SAAZ,CALK,CAAP;AAOD,CAXD","sourceRoot":""}
|
@@ -3,15 +3,18 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.useTooltipStyles = void 0;
|
6
|
+
exports.useTooltipStyles = exports.tooltipClassName = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const react_make_styles_1 = /*#__PURE__*/require("@fluentui/react-make-styles");
|
9
|
+
|
10
|
+
const react_positioning_1 = /*#__PURE__*/require("@fluentui/react-positioning");
|
11
|
+
|
12
|
+
exports.tooltipClassName = 'fui-Tooltip';
|
9
13
|
/**
|
10
14
|
* Styles for the tooltip
|
11
15
|
*/
|
12
16
|
|
13
|
-
|
14
|
-
var useStyles = /*#__PURE__*/react_make_styles_1.__styles({
|
17
|
+
const useStyles = /*#__PURE__*/react_make_styles_1.__styles({
|
15
18
|
"root": {
|
16
19
|
"mc9l5x": "fjseox",
|
17
20
|
"z8tnut": "f1sbtcvk",
|
@@ -37,19 +40,26 @@ var useStyles = /*#__PURE__*/react_make_styles_1.__styles({
|
|
37
40
|
},
|
38
41
|
"arrow": {
|
39
42
|
"qhf8xq": "f1euv43f",
|
40
|
-
"a9b677": "fpkirms",
|
41
|
-
"Bqenvij": "ftt2rgf",
|
42
43
|
"ayd6f0": "f1uo6wrk",
|
43
44
|
"Bcdw1i0": "fd7fpy0",
|
44
45
|
"Bj3rh1h": "f1bsuimh",
|
46
|
+
"Bubjx69": "f9ikmtg",
|
47
|
+
"a9b677": "fpkirms",
|
45
48
|
"rurcny": "fuzzvh5",
|
49
|
+
"zf3lio": "f1qudtws",
|
46
50
|
"xx9plb": "fxf9f1y",
|
47
51
|
"Bdn98qo": "f103af6e",
|
48
52
|
"Bbc2r3f": "f15umuo5",
|
49
53
|
"B4zgs9e": "ffo048g",
|
50
54
|
"Bex5imi": "fkk33zh",
|
51
55
|
"px8gyy": ["f5bg3dr", "f1rfdd74"],
|
52
|
-
"h6z6rw":
|
56
|
+
"h6z6rw": "fzd2j21",
|
57
|
+
"Iykf4b": ["feexxpo", "f7s5fvx"],
|
58
|
+
"F42hee": ["f1jq8eg5", "f12n7c5j"],
|
59
|
+
"Blxsnla": ["f1wv7y6t", "fi4qyh6"],
|
60
|
+
"t2scew": "fcvru7r",
|
61
|
+
"Emsed9": "f7ybgnc",
|
62
|
+
"E11wbp": "f16xtfle",
|
53
63
|
"hl6cv3": "fotnskf",
|
54
64
|
"Bh2vraf": "f1n8855c",
|
55
65
|
"yayu3t": ["f1nq055x", "f13ohf3"],
|
@@ -60,16 +70,16 @@ var useStyles = /*#__PURE__*/react_make_styles_1.__styles({
|
|
60
70
|
"Bwwlvwl": "fm1ycve"
|
61
71
|
}
|
62
72
|
}, {
|
63
|
-
"d": [".fjseox{display:none;}", ".f1sbtcvk{padding-top:5px;}", ".f11qrl6u{padding-right:12px;}", ".fjlbh76{padding-left:12px;}", ".fy7v416{padding-bottom:7px;}", ".f132xexn{max-width:240px;}", ".f158kwzp{cursor:default;}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".ft85np5{border-radius:var(--borderRadiusMedium);}", ".fcm7iae{background:var(--colorNeutralBackground1);}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".fxeb0a7{-webkit-filter:drop-shadow(0 0 2px var(--colorNeutralShadowAmbient)) drop-shadow(0 4px 8px var(--colorNeutralShadowKey));filter:drop-shadow(0 0 2px var(--colorNeutralShadowAmbient)) drop-shadow(0 4px 8px var(--colorNeutralShadowKey));}", ".ftgm304{display:block;}", ".fdr7u1v{background:var(--colorNeutralForeground2);}", ".fqpbvvt{color:var(--colorNeutralForegroundInverted);}", ".f1euv43f{position:absolute;}", ".
|
73
|
+
"d": [".fjseox{display:none;}", ".f1sbtcvk{padding-top:5px;}", ".f11qrl6u{padding-right:12px;}", ".fjlbh76{padding-left:12px;}", ".fy7v416{padding-bottom:7px;}", ".f132xexn{max-width:240px;}", ".f158kwzp{cursor:default;}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".ft85np5{border-radius:var(--borderRadiusMedium);}", ".fcm7iae{background:var(--colorNeutralBackground1);}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".fxeb0a7{-webkit-filter:drop-shadow(0 0 2px var(--colorNeutralShadowAmbient)) drop-shadow(0 4px 8px var(--colorNeutralShadowKey));filter:drop-shadow(0 0 2px var(--colorNeutralShadowAmbient)) drop-shadow(0 4px 8px var(--colorNeutralShadowKey));}", ".ftgm304{display:block;}", ".fdr7u1v{background:var(--colorNeutralForeground2);}", ".fqpbvvt{color:var(--colorNeutralForegroundInverted);}", ".f1euv43f{position:absolute;}", ".f1uo6wrk{background:inherit;}", ".fd7fpy0{visibility:hidden;}", ".f1bsuimh{z-index:-1;}", ".f9ikmtg{aspect-ratio:1;}", ".fpkirms{width:8.485px;}", ".fuzzvh5:before{content:\"\";}", ".f1qudtws:before{border-radius:4px;}", ".fxf9f1y:before{position:absolute;}", ".f103af6e:before{width:inherit;}", ".f15umuo5:before{height:inherit;}", ".ffo048g:before{background:inherit;}", ".fkk33zh:before{visibility:visible;}", ".f5bg3dr:before{border-bottom-right-radius:var(--borderRadiusSmall);}", ".f1rfdd74:before{border-bottom-left-radius:var(--borderRadiusSmall);}", ".fzd2j21:before{-webkit-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-moz-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-ms-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);}", "[data-popper-placement] .feexxpo:before{border-right-width:1px;}", "[data-popper-placement] .f7s5fvx:before{border-left-width:1px;}", "[data-popper-placement] .f1jq8eg5:before{border-right-style:solid;}", "[data-popper-placement] .f12n7c5j:before{border-left-style:solid;}", "[data-popper-placement] .f1wv7y6t:before{border-right-color:transparent;}", "[data-popper-placement] .fi4qyh6:before{border-left-color:transparent;}", "[data-popper-placement] .fcvru7r:before{border-bottom-width:1px;}", "[data-popper-placement] .f7ybgnc:before{border-bottom-style:solid;}", "[data-popper-placement] .f16xtfle:before{border-bottom-color:transparent;}", "[data-popper-placement^=\"top\"] .fotnskf{bottom:0;}", "[data-popper-placement^=\"top\"] .f1n8855c{--angle:0;}", "[data-popper-placement^=\"right\"] .f1nq055x{left:0;}", "[data-popper-placement^=\"right\"] .f13ohf3{right:0;}", "[data-popper-placement^=\"right\"] .fsw6im5{--angle:90deg;}", "[data-popper-placement^=\"bottom\"] .ftghsr9{top:0;}", "[data-popper-placement^=\"bottom\"] .f159pzir{--angle:180deg;}", "[data-popper-placement^=\"left\"] .f1l8vbt4{right:0;}", "[data-popper-placement^=\"left\"] .fsxzh25{left:0;}", "[data-popper-placement^=\"left\"] .fm1ycve{--angle:270deg;}"]
|
64
74
|
});
|
65
75
|
/**
|
66
76
|
* Apply styling to the Tooltip slots based on the state
|
67
77
|
*/
|
68
78
|
|
69
79
|
|
70
|
-
|
71
|
-
|
72
|
-
state.root.className = react_make_styles_1.mergeClasses(styles.root, state.appearance === 'inverted' && styles.inverted, state.visible && styles.visible, state.root.className);
|
80
|
+
const useTooltipStyles = state => {
|
81
|
+
const styles = useStyles();
|
82
|
+
state.root.className = react_make_styles_1.mergeClasses(exports.tooltipClassName, styles.root, state.appearance === 'inverted' && styles.inverted, state.visible && styles.visible, state.root.className);
|
73
83
|
state.arrowClassName = styles.arrow;
|
74
84
|
return state;
|
75
85
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Tooltip/useTooltipStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/useTooltipStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAGa,OAAA,CAAA,gBAAA,GAAmB,aAAnB;AAEb;;AAEG;;AACH,MAAM,SAAS,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAkCA;;AAEG;;;AACI,MAAM,gBAAgB,GAAI,KAAD,IAAsC;AACpE,QAAM,MAAM,GAAG,SAAS,EAAxB;AAEA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,mBAAA,CAAA,YAAA,CACrB,OAAA,CAAA,gBADqB,EAErB,MAAM,CAAC,IAFc,EAGrB,KAAK,CAAC,UAAN,KAAqB,UAArB,IAAmC,MAAM,CAAC,QAHrB,EAIrB,KAAK,CAAC,OAAN,IAAiB,MAAM,CAAC,OAJH,EAKrB,KAAK,CAAC,IAAN,CAAW,SALU,CAAvB;AAQA,EAAA,KAAK,CAAC,cAAN,GAAuB,MAAM,CAAC,KAA9B;AAEA,SAAO,KAAP;AACD,CAdM;;AAAM,OAAA,CAAA,gBAAA,GAAgB,gBAAhB","sourceRoot":""}
|
package/lib-commonjs/index.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-tooltip",
|
3
|
-
"version": "9.0.0-beta.
|
3
|
+
"version": "9.0.0-beta.5",
|
4
4
|
"description": "React components for building web experiences",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -25,11 +25,11 @@
|
|
25
25
|
"storybook": "start-storybook"
|
26
26
|
},
|
27
27
|
"devDependencies": {
|
28
|
-
"@fluentui/babel-make-styles": "9.0.0-beta.
|
28
|
+
"@fluentui/babel-make-styles": "9.0.0-beta.4",
|
29
29
|
"@fluentui/eslint-plugin": "*",
|
30
|
-
"@fluentui/jest-serializer-make-styles": "9.0.0-beta.
|
30
|
+
"@fluentui/jest-serializer-make-styles": "9.0.0-beta.4",
|
31
31
|
"@fluentui/react-conformance": "*",
|
32
|
-
"@fluentui/react-conformance-make-styles": "9.0.0-beta.
|
32
|
+
"@fluentui/react-conformance-make-styles": "9.0.0-beta.4",
|
33
33
|
"@fluentui/scripts": "^1.0.0",
|
34
34
|
"@types/enzyme": "3.10.3",
|
35
35
|
"@types/enzyme-adapter-react-16": "1.0.3",
|
@@ -43,12 +43,12 @@
|
|
43
43
|
"react-test-renderer": "^16.3.0"
|
44
44
|
},
|
45
45
|
"dependencies": {
|
46
|
-
"@fluentui/react-make-styles": "9.0.0-beta.
|
47
|
-
"@fluentui/react-portal": "9.0.0-beta.
|
48
|
-
"@fluentui/react-positioning": "9.0.0-beta.
|
49
|
-
"@fluentui/react-shared-contexts": "9.0.0-beta.
|
50
|
-
"@fluentui/react-theme": "9.0.0-beta.
|
51
|
-
"@fluentui/react-utilities": "9.0.0-beta.
|
46
|
+
"@fluentui/react-make-styles": "9.0.0-beta.4",
|
47
|
+
"@fluentui/react-portal": "9.0.0-beta.5",
|
48
|
+
"@fluentui/react-positioning": "9.0.0-beta.4",
|
49
|
+
"@fluentui/react-shared-contexts": "9.0.0-beta.4",
|
50
|
+
"@fluentui/react-theme": "9.0.0-beta.4",
|
51
|
+
"@fluentui/react-utilities": "9.0.0-beta.4",
|
52
52
|
"tslib": "^2.1.0"
|
53
53
|
},
|
54
54
|
"peerDependencies": {
|
@@ -58,7 +58,6 @@
|
|
58
58
|
"react-dom": ">=16.8.0 <18.0.0"
|
59
59
|
},
|
60
60
|
"beachball": {
|
61
|
-
"tag": "beta",
|
62
61
|
"disallowedChangeTypes": [
|
63
62
|
"major",
|
64
63
|
"minor",
|