@khanacademy/wonder-blocks-tooltip 1.3.5 → 1.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/es/index.js +44 -45
- package/package.json +3 -4
- package/src/__tests__/__snapshots__/generated-snapshot.test.js.snap +2 -2
- package/src/components/__tests__/tooltip-anchor.test.js +1 -0
- package/src/components/__tests__/tooltip-bubble.test.js +1 -0
- package/src/components/__tests__/tooltip-popper.test.js +1 -0
- package/src/components/__tests__/tooltip.test.js +1 -0
- package/src/components/tooltip.stories.js +39 -4
- package/src/util/__tests__/ref-tracker.test.js +1 -0
- package/LICENSE +0 -21
package/CHANGELOG.md
ADDED
package/dist/es/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as ReactDOM from 'react-dom';
|
|
3
3
|
import { Text as Text$1, View, UniqueIDProvider } from '@khanacademy/wonder-blocks-core';
|
|
4
4
|
import { maybeGetPortalMountedModalHostElement } from '@khanacademy/wonder-blocks-modal';
|
|
5
|
-
import {
|
|
5
|
+
import { StyleSheet, css } from 'aphrodite';
|
|
6
6
|
import Colors from '@khanacademy/wonder-blocks-color';
|
|
7
7
|
import Spacing from '@khanacademy/wonder-blocks-spacing';
|
|
8
8
|
import _extends from '@babel/runtime/helpers/extends';
|
|
@@ -118,7 +118,7 @@ const TooltipDisappearanceDelay = 75;
|
|
|
118
118
|
* positioning and displaying tooltips.
|
|
119
119
|
*/
|
|
120
120
|
const TRACKER = new ActiveTracker();
|
|
121
|
-
class TooltipAnchor extends Component {
|
|
121
|
+
class TooltipAnchor extends React.Component {
|
|
122
122
|
constructor(props) {
|
|
123
123
|
super(props);
|
|
124
124
|
|
|
@@ -182,7 +182,7 @@ class TooltipAnchor extends Component {
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
componentDidMount() {
|
|
185
|
-
const anchorNode = findDOMNode(this); // This should never happen, but we have this check here to make flow
|
|
185
|
+
const anchorNode = ReactDOM.findDOMNode(this); // This should never happen, but we have this check here to make flow
|
|
186
186
|
// happy and ensure that if this does happen, we'll know about it.
|
|
187
187
|
|
|
188
188
|
if (anchorNode instanceof Text) {
|
|
@@ -327,13 +327,13 @@ class TooltipAnchor extends Component {
|
|
|
327
327
|
const {
|
|
328
328
|
children
|
|
329
329
|
} = this.props;
|
|
330
|
-
return typeof children === "string" ? /*#__PURE__*/createElement(Text$1, null, children) : children;
|
|
330
|
+
return typeof children === "string" ? /*#__PURE__*/React.createElement(Text$1, null, children) : children;
|
|
331
331
|
}
|
|
332
332
|
|
|
333
333
|
_renderAccessibleChildren(ids) {
|
|
334
334
|
const anchorableChildren = this._renderAnchorableChildren();
|
|
335
335
|
|
|
336
|
-
return /*#__PURE__*/cloneElement(anchorableChildren, {
|
|
336
|
+
return /*#__PURE__*/React.cloneElement(anchorableChildren, {
|
|
337
337
|
"aria-describedby": ids.get(TooltipAnchor.ariaContentId)
|
|
338
338
|
});
|
|
339
339
|
}
|
|
@@ -359,7 +359,7 @@ TooltipAnchor.ariaContentId = "aria-content";
|
|
|
359
359
|
// TODO(somewhatabstract): Replace this really basic unique ID work with
|
|
360
360
|
// something SSR-friendly and more robust.
|
|
361
361
|
let tempIdCounter = 0;
|
|
362
|
-
class TooltipTail extends Component {
|
|
362
|
+
class TooltipTail extends React.Component {
|
|
363
363
|
_calculateDimensionsFromPlacement() {
|
|
364
364
|
const {
|
|
365
365
|
placement
|
|
@@ -476,7 +476,7 @@ class TooltipTail extends Component {
|
|
|
476
476
|
offsetShadowX
|
|
477
477
|
} = position;
|
|
478
478
|
const dropShadowFilterId = `tooltip-dropshadow-${placement}-${tempIdCounter++}`;
|
|
479
|
-
return [/*#__PURE__*/createElement("filter", {
|
|
479
|
+
return [/*#__PURE__*/React.createElement("filter", {
|
|
480
480
|
key: "filter",
|
|
481
481
|
id: dropShadowFilterId // Height and width tell the filter how big of a canvas to
|
|
482
482
|
// draw based on its parent size. i.e. 2 times bigger.
|
|
@@ -491,10 +491,10 @@ class TooltipTail extends Component {
|
|
|
491
491
|
,
|
|
492
492
|
x: x,
|
|
493
493
|
y: y
|
|
494
|
-
}, /*#__PURE__*/createElement("feGaussianBlur", {
|
|
494
|
+
}, /*#__PURE__*/React.createElement("feGaussianBlur", {
|
|
495
495
|
in: "SourceAlpha",
|
|
496
496
|
stdDeviation: Spacing.xxSmall_6 / 2
|
|
497
|
-
}), /*#__PURE__*/createElement("feComponentTransfer", null, /*#__PURE__*/createElement("feFuncA", {
|
|
497
|
+
}), /*#__PURE__*/React.createElement("feComponentTransfer", null, /*#__PURE__*/React.createElement("feFuncA", {
|
|
498
498
|
type: "linear",
|
|
499
499
|
slope: "0.3"
|
|
500
500
|
}))),
|
|
@@ -512,10 +512,10 @@ class TooltipTail extends Component {
|
|
|
512
512
|
*
|
|
513
513
|
* See styles below for why we offset the arrow.
|
|
514
514
|
*/
|
|
515
|
-
createElement("g", {
|
|
515
|
+
React.createElement("g", {
|
|
516
516
|
key: "dropshadow",
|
|
517
517
|
transform: `translate(${offsetShadowX},5.5)`
|
|
518
|
-
}, /*#__PURE__*/createElement("polyline", {
|
|
518
|
+
}, /*#__PURE__*/React.createElement("polyline", {
|
|
519
519
|
fill: Colors.offBlack16,
|
|
520
520
|
points: points.join(" "),
|
|
521
521
|
stroke: Colors.offBlack32,
|
|
@@ -656,23 +656,23 @@ class TooltipTail extends Component {
|
|
|
656
656
|
const {
|
|
657
657
|
color
|
|
658
658
|
} = this.props;
|
|
659
|
-
return /*#__PURE__*/createElement("svg", {
|
|
660
|
-
className: css(styles.arrow),
|
|
659
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
660
|
+
className: css(styles$2.arrow),
|
|
661
661
|
style: this._getArrowStyle(),
|
|
662
662
|
width: width,
|
|
663
663
|
height: height
|
|
664
|
-
}, this._maybeRenderDropshadow(points), /*#__PURE__*/createElement("polyline", {
|
|
664
|
+
}, this._maybeRenderDropshadow(points), /*#__PURE__*/React.createElement("polyline", {
|
|
665
665
|
fill: Colors[color],
|
|
666
666
|
stroke: Colors[color],
|
|
667
667
|
points: points.join(" ")
|
|
668
|
-
}), /*#__PURE__*/createElement("polyline", {
|
|
668
|
+
}), /*#__PURE__*/React.createElement("polyline", {
|
|
669
669
|
// Redraw the stroke on top of the background color,
|
|
670
670
|
// so that the ends aren't extra dark where they meet
|
|
671
671
|
// the border of the tooltip.
|
|
672
672
|
fill: Colors[color],
|
|
673
673
|
points: points.join(" "),
|
|
674
674
|
stroke: Colors.offBlack16
|
|
675
|
-
}), /*#__PURE__*/createElement("polyline", {
|
|
675
|
+
}), /*#__PURE__*/React.createElement("polyline", {
|
|
676
676
|
stroke: Colors[color],
|
|
677
677
|
points: trimlinePoints.join(" ")
|
|
678
678
|
}));
|
|
@@ -684,8 +684,8 @@ class TooltipTail extends Component {
|
|
|
684
684
|
placement,
|
|
685
685
|
updateRef
|
|
686
686
|
} = this.props;
|
|
687
|
-
return /*#__PURE__*/createElement(View, {
|
|
688
|
-
style: [styles.tailContainer, _extends({}, offset), this._getContainerStyle()],
|
|
687
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
688
|
+
style: [styles$2.tailContainer, _extends({}, offset), this._getContainerStyle()],
|
|
689
689
|
"data-placement": placement,
|
|
690
690
|
ref: updateRef
|
|
691
691
|
}, this._renderArrow());
|
|
@@ -706,7 +706,7 @@ const DISTANCE_FROM_ANCHOR = Spacing.xSmall_8;
|
|
|
706
706
|
const MIN_DISTANCE_FROM_CORNERS = Spacing.xSmall_8;
|
|
707
707
|
const ARROW_WIDTH = Spacing.large_24;
|
|
708
708
|
const ARROW_HEIGHT = Spacing.small_12;
|
|
709
|
-
const styles = StyleSheet.create({
|
|
709
|
+
const styles$2 = StyleSheet.create({
|
|
710
710
|
/**
|
|
711
711
|
* Container
|
|
712
712
|
*/
|
|
@@ -724,7 +724,7 @@ const styles = StyleSheet.create({
|
|
|
724
724
|
}
|
|
725
725
|
});
|
|
726
726
|
|
|
727
|
-
class TooltipBubble extends Component {
|
|
727
|
+
class TooltipBubble extends React.Component {
|
|
728
728
|
constructor(...args) {
|
|
729
729
|
super(...args);
|
|
730
730
|
this.state = {
|
|
@@ -758,7 +758,7 @@ class TooltipBubble extends Component {
|
|
|
758
758
|
updateTailRef,
|
|
759
759
|
tailOffset
|
|
760
760
|
} = this.props;
|
|
761
|
-
return /*#__PURE__*/createElement(View, {
|
|
761
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
762
762
|
id: id,
|
|
763
763
|
role: "tooltip",
|
|
764
764
|
"data-placement": placement,
|
|
@@ -766,9 +766,9 @@ class TooltipBubble extends Component {
|
|
|
766
766
|
onMouseLeave: this.handleMouseLeave,
|
|
767
767
|
ref: updateBubbleRef,
|
|
768
768
|
style: [isReferenceHidden && styles$1.hide, styles$1.bubble, styles$1[`content-${placement}`], style]
|
|
769
|
-
}, /*#__PURE__*/createElement(View, {
|
|
769
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
770
770
|
style: styles$1.content
|
|
771
|
-
}, children), /*#__PURE__*/createElement(TooltipTail, {
|
|
771
|
+
}, children), /*#__PURE__*/React.createElement(TooltipTail, {
|
|
772
772
|
updateRef: updateTailRef,
|
|
773
773
|
placement: placement,
|
|
774
774
|
offset: tailOffset
|
|
@@ -823,7 +823,7 @@ const styles$1 = StyleSheet.create({
|
|
|
823
823
|
* This component is used to provide the content that is to be rendered in the
|
|
824
824
|
* tooltip bubble.
|
|
825
825
|
*/
|
|
826
|
-
class TooltipContent extends Component {
|
|
826
|
+
class TooltipContent extends React.Component {
|
|
827
827
|
_renderTitle() {
|
|
828
828
|
const {
|
|
829
829
|
title
|
|
@@ -831,7 +831,7 @@ class TooltipContent extends Component {
|
|
|
831
831
|
|
|
832
832
|
if (title) {
|
|
833
833
|
if (typeof title === "string") {
|
|
834
|
-
return /*#__PURE__*/createElement(HeadingSmall, null, title);
|
|
834
|
+
return /*#__PURE__*/React.createElement(HeadingSmall, null, title);
|
|
835
835
|
} else {
|
|
836
836
|
return title;
|
|
837
837
|
}
|
|
@@ -846,7 +846,7 @@ class TooltipContent extends Component {
|
|
|
846
846
|
} = this.props;
|
|
847
847
|
|
|
848
848
|
if (typeof children === "string") {
|
|
849
|
-
return /*#__PURE__*/createElement(LabelMedium, null, children);
|
|
849
|
+
return /*#__PURE__*/React.createElement(LabelMedium, null, children);
|
|
850
850
|
} else {
|
|
851
851
|
return children;
|
|
852
852
|
}
|
|
@@ -857,16 +857,16 @@ class TooltipContent extends Component {
|
|
|
857
857
|
|
|
858
858
|
const children = this._renderChildren();
|
|
859
859
|
|
|
860
|
-
const containerStyle = title ? styles
|
|
861
|
-
return /*#__PURE__*/createElement(View, {
|
|
860
|
+
const containerStyle = title ? styles.withTitle : styles.withoutTitle;
|
|
861
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
862
862
|
style: containerStyle
|
|
863
|
-
}, title, title && children && /*#__PURE__*/createElement(Strut, {
|
|
863
|
+
}, title, title && children && /*#__PURE__*/React.createElement(Strut, {
|
|
864
864
|
size: Spacing.xxxSmall_4
|
|
865
865
|
}), children);
|
|
866
866
|
}
|
|
867
867
|
|
|
868
868
|
}
|
|
869
|
-
const styles
|
|
869
|
+
const styles = StyleSheet.create({
|
|
870
870
|
withoutTitle: {
|
|
871
871
|
padding: `10px ${Spacing.medium_16}px`
|
|
872
872
|
},
|
|
@@ -888,7 +888,7 @@ class RefTracker {
|
|
|
888
888
|
// We only want to update the reference if it is
|
|
889
889
|
// actually changed. Otherwise, we can trigger another render that
|
|
890
890
|
// would then update the reference again and just keep looping.
|
|
891
|
-
const domNode = findDOMNode(ref);
|
|
891
|
+
const domNode = ReactDOM.findDOMNode(ref);
|
|
892
892
|
|
|
893
893
|
if (domNode instanceof HTMLElement && domNode !== this._lastRef) {
|
|
894
894
|
this._lastRef = domNode;
|
|
@@ -918,7 +918,7 @@ class RefTracker {
|
|
|
918
918
|
* This component is a light wrapper for react-popper, allowing us to position
|
|
919
919
|
* and control the tooltip bubble location and visibility as we need.
|
|
920
920
|
*/
|
|
921
|
-
class TooltipPopper extends Component {
|
|
921
|
+
class TooltipPopper extends React.Component {
|
|
922
922
|
constructor(...args) {
|
|
923
923
|
super(...args);
|
|
924
924
|
this._bubbleRefTracker = new RefTracker();
|
|
@@ -975,7 +975,7 @@ class TooltipPopper extends Component {
|
|
|
975
975
|
anchorElement,
|
|
976
976
|
placement
|
|
977
977
|
} = this.props;
|
|
978
|
-
return /*#__PURE__*/createElement(Popper, {
|
|
978
|
+
return /*#__PURE__*/React.createElement(Popper, {
|
|
979
979
|
referenceElement: anchorElement,
|
|
980
980
|
strategy: "fixed",
|
|
981
981
|
placement: placement,
|
|
@@ -1009,7 +1009,7 @@ class TooltipPopper extends Component {
|
|
|
1009
1009
|
* - TooltipTail (renders the callout tail and shadow that points from the
|
|
1010
1010
|
* callout to the anchor content)
|
|
1011
1011
|
*/
|
|
1012
|
-
class Tooltip extends Component {
|
|
1012
|
+
class Tooltip extends React.Component {
|
|
1013
1013
|
constructor(...args) {
|
|
1014
1014
|
super(...args);
|
|
1015
1015
|
this.state = {
|
|
@@ -1034,11 +1034,11 @@ class Tooltip extends Component {
|
|
|
1034
1034
|
} = this.props;
|
|
1035
1035
|
|
|
1036
1036
|
if (typeof content === "string") {
|
|
1037
|
-
return /*#__PURE__*/createElement(TooltipContent, {
|
|
1037
|
+
return /*#__PURE__*/React.createElement(TooltipContent, {
|
|
1038
1038
|
title: title
|
|
1039
1039
|
}, content);
|
|
1040
1040
|
} else if (title) {
|
|
1041
|
-
return /*#__PURE__*/cloneElement(content, {
|
|
1041
|
+
return /*#__PURE__*/React.cloneElement(content, {
|
|
1042
1042
|
title
|
|
1043
1043
|
});
|
|
1044
1044
|
} else {
|
|
@@ -1059,10 +1059,10 @@ class Tooltip extends Component {
|
|
|
1059
1059
|
const {
|
|
1060
1060
|
placement
|
|
1061
1061
|
} = this.props;
|
|
1062
|
-
return /*#__PURE__*/createElement(TooltipPopper, {
|
|
1062
|
+
return /*#__PURE__*/React.createElement(TooltipPopper, {
|
|
1063
1063
|
anchorElement: this.state.anchorElement,
|
|
1064
1064
|
placement: placement
|
|
1065
|
-
}, props => /*#__PURE__*/createElement(TooltipBubble, {
|
|
1065
|
+
}, props => /*#__PURE__*/React.createElement(TooltipBubble, {
|
|
1066
1066
|
id: bubbleId,
|
|
1067
1067
|
style: props.style,
|
|
1068
1068
|
tailOffset: props.tailOffset,
|
|
@@ -1096,14 +1096,14 @@ class Tooltip extends Component {
|
|
|
1096
1096
|
const popperHost = this._getHost(); // TODO(kevinb): update to use ReactPopper's React 16-friendly syntax
|
|
1097
1097
|
|
|
1098
1098
|
|
|
1099
|
-
return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(TooltipAnchor, {
|
|
1099
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TooltipAnchor, {
|
|
1100
1100
|
forceAnchorFocusivity: forceAnchorFocusivity,
|
|
1101
1101
|
anchorRef: r => this._updateAnchorElement(r),
|
|
1102
1102
|
onActiveChanged: active => this.setState({
|
|
1103
1103
|
active
|
|
1104
1104
|
}),
|
|
1105
1105
|
ids: ids
|
|
1106
|
-
}, children), popperHost && (active || activeBubble) && /*#__PURE__*/createPortal(this._renderPopper(ids), popperHost));
|
|
1106
|
+
}, children), popperHost && (active || activeBubble) && /*#__PURE__*/ReactDOM.createPortal(this._renderPopper(ids), popperHost));
|
|
1107
1107
|
}
|
|
1108
1108
|
|
|
1109
1109
|
render() {
|
|
@@ -1116,7 +1116,7 @@ class Tooltip extends Component {
|
|
|
1116
1116
|
// need it.
|
|
1117
1117
|
return this._renderTooltipAnchor();
|
|
1118
1118
|
} else {
|
|
1119
|
-
return /*#__PURE__*/createElement(UniqueIDProvider, {
|
|
1119
|
+
return /*#__PURE__*/React.createElement(UniqueIDProvider, {
|
|
1120
1120
|
scope: "tooltip",
|
|
1121
1121
|
mockOnFirstRender: true
|
|
1122
1122
|
}, ids => this._renderTooltipAnchor(ids));
|
|
@@ -1130,5 +1130,4 @@ Tooltip.defaultProps = {
|
|
|
1130
1130
|
};
|
|
1131
1131
|
Tooltip.ariaContentId = "aria-content";
|
|
1132
1132
|
|
|
1133
|
-
export default
|
|
1134
|
-
export { TooltipContent, TooltipPopper, TooltipTail };
|
|
1133
|
+
export { TooltipContent, TooltipPopper, TooltipTail, Tooltip as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-tooltip",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@khanacademy/wonder-blocks-color": "^1.1.20",
|
|
20
20
|
"@khanacademy/wonder-blocks-core": "^4.0.0",
|
|
21
21
|
"@khanacademy/wonder-blocks-layout": "^1.4.6",
|
|
22
|
-
"@khanacademy/wonder-blocks-modal": "^2.
|
|
22
|
+
"@khanacademy/wonder-blocks-modal": "^2.2.0",
|
|
23
23
|
"@khanacademy/wonder-blocks-spacing": "^3.0.5",
|
|
24
24
|
"@khanacademy/wonder-blocks-typography": "^1.1.28"
|
|
25
25
|
},
|
|
@@ -32,6 +32,5 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"wb-dev-build-settings": "^0.2.0"
|
|
35
|
-
}
|
|
36
|
-
"gitHead": "9ebea88533e702011165072f090a377e02fa3f0f"
|
|
35
|
+
}
|
|
37
36
|
}
|
|
@@ -142,8 +142,8 @@ exports[`wonder-blocks-tooltip example 3 1`] = `
|
|
|
142
142
|
|
|
143
143
|
exports[`wonder-blocks-tooltip example 4 1`] = `
|
|
144
144
|
<button
|
|
145
|
+
aria-disabled={false}
|
|
145
146
|
className=""
|
|
146
|
-
disabled={false}
|
|
147
147
|
onBlur={[Function]}
|
|
148
148
|
onClick={[Function]}
|
|
149
149
|
onDragStart={[Function]}
|
|
@@ -400,8 +400,8 @@ exports[`wonder-blocks-tooltip example 6 1`] = `
|
|
|
400
400
|
>
|
|
401
401
|
<button
|
|
402
402
|
aria-describedby="uid-tooltip-6-aria-content"
|
|
403
|
+
aria-disabled={false}
|
|
403
404
|
className=""
|
|
404
|
-
disabled={false}
|
|
405
405
|
onBlur={[Function]}
|
|
406
406
|
onClick={[Function]}
|
|
407
407
|
onDragStart={[Function]}
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import {StyleSheet} from "aphrodite";
|
|
4
4
|
import {View} from "@khanacademy/wonder-blocks-core";
|
|
5
|
+
import Button from "@khanacademy/wonder-blocks-button";
|
|
5
6
|
import {TextField} from "@khanacademy/wonder-blocks-form";
|
|
7
|
+
import {Strut} from "@khanacademy/wonder-blocks-layout";
|
|
8
|
+
import Spacing from "@khanacademy/wonder-blocks-spacing";
|
|
6
9
|
import Tooltip from "@khanacademy/wonder-blocks-tooltip";
|
|
7
10
|
|
|
8
11
|
import type {Placement} from "@khanacademy/wonder-blocks-tooltip";
|
|
@@ -10,6 +13,13 @@ import type {StoryComponentType} from "@storybook/react";
|
|
|
10
13
|
|
|
11
14
|
export default {
|
|
12
15
|
title: "Floating/Tooltip",
|
|
16
|
+
parameters: {
|
|
17
|
+
// TODO(WB-1170): Reassess this after investigating more about Chromatic
|
|
18
|
+
// flakyness.
|
|
19
|
+
chromatic: {
|
|
20
|
+
delay: 400,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
13
23
|
};
|
|
14
24
|
|
|
15
25
|
const BaseTooltipExample = ({placement}: {|placement: Placement|}) => {
|
|
@@ -41,19 +51,44 @@ const BaseTooltipExample = ({placement}: {|placement: Placement|}) => {
|
|
|
41
51
|
);
|
|
42
52
|
};
|
|
43
53
|
|
|
44
|
-
export const
|
|
54
|
+
export const TooltipOnButtons: StoryComponentType = () => {
|
|
55
|
+
return (
|
|
56
|
+
<View style={styles.centered}>
|
|
57
|
+
<View>
|
|
58
|
+
<Tooltip content={"This is a tooltip on a button."}>
|
|
59
|
+
<Button disabled={false}>Example 1</Button>
|
|
60
|
+
</Tooltip>
|
|
61
|
+
<Strut size={Spacing.medium_16} />
|
|
62
|
+
<Tooltip
|
|
63
|
+
content="This is a tooltip on a disabled button."
|
|
64
|
+
placement="bottom"
|
|
65
|
+
>
|
|
66
|
+
<Button disabled={true}>Example 2</Button>
|
|
67
|
+
</Tooltip>
|
|
68
|
+
</View>
|
|
69
|
+
</View>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
TooltipOnButtons.parameters = {
|
|
74
|
+
chromatic: {
|
|
75
|
+
disableSnapshot: true,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const TooltipRight: StoryComponentType = () => (
|
|
45
80
|
<BaseTooltipExample placement="right" />
|
|
46
81
|
);
|
|
47
82
|
|
|
48
|
-
export const
|
|
83
|
+
export const TooltipLeft: StoryComponentType = () => (
|
|
49
84
|
<BaseTooltipExample placement="left" />
|
|
50
85
|
);
|
|
51
86
|
|
|
52
|
-
export const
|
|
87
|
+
export const TooltipTop: StoryComponentType = () => (
|
|
53
88
|
<BaseTooltipExample placement="top" />
|
|
54
89
|
);
|
|
55
90
|
|
|
56
|
-
export const
|
|
91
|
+
export const TooltipBottom: StoryComponentType = () => (
|
|
57
92
|
<BaseTooltipExample placement="bottom" />
|
|
58
93
|
);
|
|
59
94
|
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018 Khan Academy
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|