@zohodesk/components 1.2.4 → 1.2.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/README.md +8 -0
- package/coverage/Button/Button.js.html +1 -1
- package/coverage/Button/css/Button.module.css.html +1 -1
- package/coverage/Button/css/cssJSLogic.js.html +1 -1
- package/coverage/Button/css/index.html +1 -1
- package/coverage/Button/index.html +1 -1
- package/coverage/Button/props/defaultProps.js.html +1 -1
- package/coverage/Button/props/index.html +1 -1
- package/coverage/Button/props/propTypes.js.html +1 -1
- package/coverage/Buttongroup/Buttongroup.js.html +1 -1
- package/coverage/Buttongroup/Buttongroup.module.css.html +1 -1
- package/coverage/Buttongroup/index.html +1 -1
- package/coverage/Buttongroup/props/defaultProps.js.html +1 -1
- package/coverage/Buttongroup/props/index.html +1 -1
- package/coverage/Buttongroup/props/propTypes.js.html +1 -1
- package/coverage/index.html +1 -1
- package/coverage/utils/dummyFunction.js.html +1 -1
- package/coverage/utils/index.html +1 -1
- package/es/AppContainer/AppContainer.js +3 -0
- package/es/v1/Accordion/Accordion.js +65 -0
- package/es/v1/Accordion/AccordionItem.js +57 -0
- package/es/v1/Accordion/index.js +2 -0
- package/es/v1/Animation/Animation.js +127 -0
- package/es/v1/AppContainer/AppContainer.js +137 -0
- package/es/v1/Avatar/Avatar.js +189 -0
- package/es/v1/AvatarTeam/AvatarTeam.js +70 -0
- package/es/v1/Button/Button.js +68 -0
- package/es/v1/Buttongroup/Buttongroup.js +31 -0
- package/es/v1/Card/Card.js +271 -0
- package/es/v1/CheckBox/CheckBox.js +155 -0
- package/es/v1/DateTime/CalendarView.js +218 -0
- package/es/v1/DateTime/DateTime.js +783 -0
- package/es/v1/DateTime/DateTimePopupFooter.js +47 -0
- package/es/v1/DateTime/DateTimePopupHeader.js +105 -0
- package/es/v1/DateTime/DateWidget.js +1098 -0
- package/es/v1/DateTime/DaysRow.js +31 -0
- package/es/v1/DateTime/Time.js +166 -0
- package/es/v1/DateTime/YearView.js +264 -0
- package/es/v1/DateTime/index.js +1 -0
- package/es/v1/DropBox/DropBox.js +91 -0
- package/es/v1/DropBox/DropBoxElement/DropBoxElement.js +132 -0
- package/es/v1/DropDown/DropDown.js +73 -0
- package/es/v1/DropDown/DropDownHeading.js +44 -0
- package/es/v1/DropDown/DropDownItem.js +76 -0
- package/es/v1/DropDown/DropDownSearch.js +63 -0
- package/es/v1/DropDown/DropDownSeparator.js +15 -0
- package/es/v1/Heading/Heading.js +32 -0
- package/es/v1/Label/Label.js +40 -0
- package/es/v1/Layout/Box.js +115 -0
- package/es/v1/Layout/Container.js +132 -0
- package/es/v1/Layout/index.js +2 -0
- package/es/v1/ListItem/ListContainer.js +102 -0
- package/es/v1/ListItem/ListItem.js +124 -0
- package/es/v1/ListItem/ListItemWithAvatar.js +145 -0
- package/es/v1/ListItem/ListItemWithCheckBox.js +104 -0
- package/es/v1/ListItem/ListItemWithIcon.js +127 -0
- package/es/v1/ListItem/ListItemWithRadio.js +105 -0
- package/es/v1/ListItem/index.js +6 -0
- package/es/v1/Modal/Modal.js +154 -0
- package/es/v1/MultiSelect/AdvancedGroupMultiSelect.js +1079 -0
- package/es/v1/MultiSelect/AdvancedMultiSelect.js +568 -0
- package/es/v1/MultiSelect/EmptyState.js +64 -0
- package/es/v1/MultiSelect/MobileHeader/MobileHeader.js +50 -0
- package/es/v1/MultiSelect/MultiSelect.js +1120 -0
- package/es/v1/MultiSelect/MultiSelectHeader.js +32 -0
- package/es/v1/MultiSelect/MultiSelectWithAvatar.js +216 -0
- package/es/v1/MultiSelect/SelectedOptions.js +82 -0
- package/es/v1/MultiSelect/Suggestions.js +142 -0
- package/es/v1/MultiSelect/index.js +4 -0
- package/es/v1/PopOver/PopOver.js +211 -0
- package/es/v1/Popup/Popup.js +645 -0
- package/es/v1/Radio/Radio.js +115 -0
- package/es/v1/Responsive/CustomResponsive.js +195 -0
- package/es/v1/Responsive/RefWrapper.js +39 -0
- package/es/v1/Responsive/ResizeComponent.js +197 -0
- package/es/v1/Responsive/ResizeObserver.js +140 -0
- package/es/v1/Responsive/Responsive.js +194 -0
- package/es/v1/Responsive/index.js +9 -0
- package/es/v1/ResponsiveDropBox/ResponsiveDropBox.js +58 -0
- package/es/v1/Ribbon/Ribbon.js +33 -0
- package/es/v1/RippleEffect/RippleEffect.js +24 -0
- package/es/v1/Select/GroupSelect.js +803 -0
- package/es/v1/Select/Select.js +969 -0
- package/es/v1/Select/SelectWithAvatar.js +344 -0
- package/es/v1/Select/SelectWithIcon.js +535 -0
- package/es/v1/Select/index.js +4 -0
- package/es/v1/Stencils/Stencils.js +26 -0
- package/es/v1/Switch/Switch.js +94 -0
- package/es/v1/Tab/Tab.js +108 -0
- package/es/v1/Tab/TabContent.js +30 -0
- package/es/v1/Tab/TabContentWrapper.js +29 -0
- package/es/v1/Tab/TabWrapper.js +57 -0
- package/es/v1/Tab/Tabs.js +612 -0
- package/es/v1/Tab/index.js +5 -0
- package/es/v1/Tag/Tag.js +134 -0
- package/es/v1/TextBox/TextBox.js +154 -0
- package/es/v1/TextBoxIcon/TextBoxIcon.js +158 -0
- package/es/v1/Textarea/Textarea.js +102 -0
- package/es/v1/Tooltip/Tooltip.js +518 -0
- package/es/v1/Typography/Typography.js +38 -0
- package/es/v1/Typography/css/Typography.module.css +376 -0
- package/es/v1/Typography/css/cssJSLogic.js +46 -0
- package/es/v1/Typography/css/letterSpacingMap.js +12 -0
- package/es/v1/Typography/props/defaultProps.js +8 -0
- package/es/v1/Typography/props/propTypes.js +24 -0
- package/es/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +69 -0
- package/es/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +100 -0
- package/es/v1/semantic/Button/Button.js +53 -0
- package/es/v1/semantic/index.js +1 -0
- package/lib/AppContainer/AppContainer.js +5 -0
- package/lib/v1/Accordion/Accordion.js +96 -0
- package/lib/v1/Accordion/AccordionItem.js +68 -0
- package/lib/v1/Accordion/index.js +23 -0
- package/lib/v1/Animation/Animation.js +143 -0
- package/lib/v1/AppContainer/AppContainer.js +209 -0
- package/lib/v1/Avatar/Avatar.js +246 -0
- package/lib/v1/AvatarTeam/AvatarTeam.js +81 -0
- package/lib/v1/Button/Button.js +82 -0
- package/lib/v1/Buttongroup/Buttongroup.js +44 -0
- package/lib/v1/Card/Card.js +365 -0
- package/lib/v1/CheckBox/CheckBox.js +166 -0
- package/lib/v1/DateTime/CalendarView.js +285 -0
- package/lib/v1/DateTime/DateTime.js +872 -0
- package/lib/v1/DateTime/DateTimePopupFooter.js +96 -0
- package/lib/v1/DateTime/DateTimePopupHeader.js +166 -0
- package/lib/v1/DateTime/DateWidget.js +1125 -0
- package/lib/v1/DateTime/DaysRow.js +80 -0
- package/lib/v1/DateTime/Time.js +254 -0
- package/lib/v1/DateTime/YearView.js +325 -0
- package/lib/v1/DateTime/index.js +15 -0
- package/lib/v1/DropBox/DropBox.js +119 -0
- package/lib/v1/DropBox/DropBoxElement/DropBoxElement.js +145 -0
- package/lib/v1/DropDown/DropDown.js +170 -0
- package/lib/v1/DropDown/DropDownHeading.js +93 -0
- package/lib/v1/DropDown/DropDownItem.js +127 -0
- package/lib/v1/DropDown/DropDownSearch.js +113 -0
- package/lib/v1/DropDown/DropDownSeparator.js +64 -0
- package/lib/v1/Heading/Heading.js +49 -0
- package/lib/v1/Label/Label.js +51 -0
- package/lib/v1/Layout/Box.js +128 -0
- package/lib/v1/Layout/Container.js +145 -0
- package/lib/v1/Layout/index.js +23 -0
- package/lib/v1/ListItem/ListContainer.js +120 -0
- package/lib/v1/ListItem/ListItem.js +138 -0
- package/lib/v1/ListItem/ListItemWithAvatar.js +162 -0
- package/lib/v1/ListItem/ListItemWithCheckBox.js +125 -0
- package/lib/v1/ListItem/ListItemWithIcon.js +143 -0
- package/lib/v1/ListItem/ListItemWithRadio.js +126 -0
- package/lib/v1/ListItem/index.js +55 -0
- package/lib/v1/Modal/Modal.js +212 -0
- package/lib/v1/MultiSelect/AdvancedGroupMultiSelect.js +1167 -0
- package/lib/v1/MultiSelect/AdvancedMultiSelect.js +634 -0
- package/lib/v1/MultiSelect/EmptyState.js +112 -0
- package/lib/v1/MultiSelect/MobileHeader/MobileHeader.js +62 -0
- package/lib/v1/MultiSelect/MultiSelect.js +1201 -0
- package/lib/v1/MultiSelect/MultiSelectHeader.js +78 -0
- package/lib/v1/MultiSelect/MultiSelectWithAvatar.js +270 -0
- package/lib/v1/MultiSelect/SelectedOptions.js +126 -0
- package/lib/v1/MultiSelect/Suggestions.js +195 -0
- package/lib/v1/MultiSelect/index.js +39 -0
- package/lib/v1/PopOver/PopOver.js +293 -0
- package/lib/v1/Popup/Popup.js +715 -0
- package/lib/v1/Radio/Radio.js +126 -0
- package/lib/v1/Responsive/CustomResponsive.js +242 -0
- package/lib/v1/Responsive/RefWrapper.js +57 -0
- package/lib/v1/Responsive/ResizeComponent.js +268 -0
- package/lib/v1/Responsive/ResizeObserver.js +168 -0
- package/lib/v1/Responsive/Responsive.js +274 -0
- package/lib/v1/Responsive/index.js +55 -0
- package/lib/v1/ResponsiveDropBox/ResponsiveDropBox.js +79 -0
- package/lib/v1/Ribbon/Ribbon.js +44 -0
- package/lib/v1/RippleEffect/RippleEffect.js +39 -0
- package/lib/v1/Select/GroupSelect.js +877 -0
- package/lib/v1/Select/Select.js +1013 -0
- package/lib/v1/Select/SelectWithAvatar.js +394 -0
- package/lib/v1/Select/SelectWithIcon.js +597 -0
- package/lib/v1/Select/index.js +39 -0
- package/lib/v1/Stencils/Stencils.js +43 -0
- package/lib/v1/Switch/Switch.js +108 -0
- package/lib/v1/Tab/Tab.js +132 -0
- package/lib/v1/Tab/TabContent.js +42 -0
- package/lib/v1/Tab/TabContentWrapper.js +42 -0
- package/lib/v1/Tab/TabWrapper.js +89 -0
- package/lib/v1/Tab/Tabs.js +680 -0
- package/lib/v1/Tab/index.js +47 -0
- package/lib/v1/Tag/Tag.js +154 -0
- package/lib/v1/TextBox/TextBox.js +168 -0
- package/lib/v1/TextBoxIcon/TextBoxIcon.js +196 -0
- package/lib/v1/Textarea/Textarea.js +118 -0
- package/lib/v1/Tooltip/Tooltip.js +586 -0
- package/lib/v1/Typography/Typography.js +56 -0
- package/lib/v1/Typography/css/Typography.module.css +376 -0
- package/lib/v1/Typography/css/cssJSLogic.js +41 -0
- package/lib/v1/Typography/css/letterSpacingMap.js +20 -0
- package/lib/v1/Typography/props/defaultProps.js +15 -0
- package/lib/v1/Typography/props/propTypes.js +35 -0
- package/lib/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +90 -0
- package/lib/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +126 -0
- package/lib/v1/semantic/Button/Button.js +63 -0
- package/lib/v1/semantic/index.js +15 -0
- package/package.json +1 -1
- package/result.json +1 -1
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _defaultProps = require("../../Tooltip/props/defaultProps");
|
|
13
|
+
|
|
14
|
+
var _propTypes = require("../../Tooltip/props/propTypes");
|
|
15
|
+
|
|
16
|
+
var _Config = require("../../Provider/Config");
|
|
17
|
+
|
|
18
|
+
var _TooltipModule = _interopRequireDefault(require("../../Tooltip/Tooltip.module.css"));
|
|
19
|
+
|
|
20
|
+
var _ResizeObserver = _interopRequireDefault(require("../Responsive/ResizeObserver"));
|
|
21
|
+
|
|
22
|
+
var _selectn = _interopRequireDefault(require("selectn"));
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
+
|
|
26
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
27
|
+
|
|
28
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
29
|
+
|
|
30
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
31
|
+
|
|
32
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
33
|
+
|
|
34
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
35
|
+
|
|
36
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
37
|
+
|
|
38
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
39
|
+
|
|
40
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
41
|
+
|
|
42
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
|
+
|
|
44
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
45
|
+
|
|
46
|
+
var Tooltip = /*#__PURE__*/function (_React$Component) {
|
|
47
|
+
_inherits(Tooltip, _React$Component);
|
|
48
|
+
|
|
49
|
+
var _super = _createSuper(Tooltip);
|
|
50
|
+
|
|
51
|
+
function Tooltip(props) {
|
|
52
|
+
var _this;
|
|
53
|
+
|
|
54
|
+
_classCallCheck(this, Tooltip);
|
|
55
|
+
|
|
56
|
+
_this = _super.call(this, props);
|
|
57
|
+
_this.state = {
|
|
58
|
+
title: null,
|
|
59
|
+
left: 0,
|
|
60
|
+
top: 0,
|
|
61
|
+
arrowLeft: 0,
|
|
62
|
+
isArrowRight: null,
|
|
63
|
+
isHtml: false
|
|
64
|
+
};
|
|
65
|
+
_this.handleOver = _this.handleOver.bind(_assertThisInitialized(_this));
|
|
66
|
+
_this.getToolTipDOM = _this.getToolTipDOM.bind(_assertThisInitialized(_this));
|
|
67
|
+
_this.reset = _this.reset.bind(_assertThisInitialized(_this));
|
|
68
|
+
_this.getDirection = document.getElementsByTagName('html')[0];
|
|
69
|
+
_this.leftRightScreenEdge = _this.leftRightScreenEdge.bind(_assertThisInitialized(_this));
|
|
70
|
+
_this.topBottomScreenEdge = _this.topBottomScreenEdge.bind(_assertThisInitialized(_this));
|
|
71
|
+
_this.observer = new _ResizeObserver["default"](_this.onResize);
|
|
72
|
+
_this.isResized = true;
|
|
73
|
+
_this.tooltipContainerClientRect = {};
|
|
74
|
+
_this.tooltipContainerEl = {};
|
|
75
|
+
return _this;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
_createClass(Tooltip, [{
|
|
79
|
+
key: "onResize",
|
|
80
|
+
value: function onResize(sizeOfObservedEl, observedEl) {
|
|
81
|
+
this.isResized = true;
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
key: "observeElement",
|
|
85
|
+
value: function observeElement() {
|
|
86
|
+
this.tooltipContainerEl = this.getToolTipContainerEl();
|
|
87
|
+
this.observer.observe(this.tooltipContainerEl);
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
key: "unObserveElement",
|
|
91
|
+
value: function unObserveElement() {
|
|
92
|
+
this.observer.disconnect();
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "getClientRectOfContEl",
|
|
96
|
+
value: function getClientRectOfContEl(el) {
|
|
97
|
+
if (this.isResized) {
|
|
98
|
+
return this.setClientRectOfContEl(el);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return this.tooltipContainerClientRect;
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "setClientRectOfContEl",
|
|
105
|
+
value: function setClientRectOfContEl(containerEl) {
|
|
106
|
+
this.isResized = false;
|
|
107
|
+
this.tooltipContainerClientRect = containerEl.getBoundingClientRect();
|
|
108
|
+
return this.tooltipContainerClientRect;
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
key: "getToolTipContainerEl",
|
|
112
|
+
value: function getToolTipContainerEl() {
|
|
113
|
+
var getTooltipContainer = (0, _Config.getLibraryConfig)('getTooltipContainer');
|
|
114
|
+
var tooltipContainer = typeof getTooltipContainer === 'function' ? getTooltipContainer() : null;
|
|
115
|
+
return tooltipContainer ? tooltipContainer : document.body;
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
key: "getToolTipDOM",
|
|
119
|
+
value: function getToolTipDOM(el) {
|
|
120
|
+
this.toolTip = el;
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
key: "reset",
|
|
124
|
+
value: function reset() {
|
|
125
|
+
var title = this.state.title;
|
|
126
|
+
|
|
127
|
+
if (title !== null) {
|
|
128
|
+
this.setState({
|
|
129
|
+
title: null,
|
|
130
|
+
top: 0,
|
|
131
|
+
left: 0
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/* left and right screen edge check for top and bottom tooltip position */
|
|
136
|
+
|
|
137
|
+
}, {
|
|
138
|
+
key: "leftRightScreenEdge",
|
|
139
|
+
value: function leftRightScreenEdge(tLeft, toolTipArrowLeft, thisLeft, thisWidth, tooltipoffsetWidth, bodyWidth, rightEdge, bodyLeft) {
|
|
140
|
+
if (tLeft - bodyLeft <= 1) {
|
|
141
|
+
// top & bottom position left side screen edge case
|
|
142
|
+
tLeft = bodyLeft + 2;
|
|
143
|
+
toolTipArrowLeft = parseInt(thisLeft - bodyLeft + thisWidth / 2 - 6);
|
|
144
|
+
} else if (tLeft - bodyLeft + tooltipoffsetWidth > bodyWidth) {
|
|
145
|
+
// top & bottom position right side screen edge case
|
|
146
|
+
rightEdge = tLeft + tooltipoffsetWidth - bodyWidth + 2;
|
|
147
|
+
tLeft = tLeft + bodyLeft - rightEdge;
|
|
148
|
+
toolTipArrowLeft = toolTipArrowLeft - bodyLeft + rightEdge;
|
|
149
|
+
} else if (tLeft + tooltipoffsetWidth + tooltipoffsetWidth >= bodyWidth - 2) {
|
|
150
|
+
// top & bottom center screen tooltip collide with right edge screen
|
|
151
|
+
tLeft = parseInt(thisLeft - (tooltipoffsetWidth - thisWidth) / 2);
|
|
152
|
+
toolTipArrowLeft = parseInt(tooltipoffsetWidth / 2 - 4);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return {
|
|
156
|
+
tLeft: tLeft,
|
|
157
|
+
toolTipArrowLeft: toolTipArrowLeft,
|
|
158
|
+
thisLeft: thisLeft,
|
|
159
|
+
thisWidth: thisWidth,
|
|
160
|
+
tooltipoffsetWidth: tooltipoffsetWidth,
|
|
161
|
+
bodyWidth: bodyWidth,
|
|
162
|
+
rightEdge: rightEdge
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
/* top and bottom screen edge check for left and right tooltip position */
|
|
166
|
+
|
|
167
|
+
}, {
|
|
168
|
+
key: "topBottomScreenEdge",
|
|
169
|
+
value: function topBottomScreenEdge(tTop, toolTipArrowTop, thisTop, thisHeight, tooltipoffsetHeight, bodyHeight, bottomEdge) {
|
|
170
|
+
if (tTop <= 1) {
|
|
171
|
+
tTop = 2;
|
|
172
|
+
toolTipArrowTop = parseInt(thisTop + thisHeight / 2);
|
|
173
|
+
} else if (tTop + tooltipoffsetHeight > bodyHeight) {
|
|
174
|
+
bottomEdge = tTop + tooltipoffsetHeight - bodyHeight + 2;
|
|
175
|
+
tTop -= bottomEdge;
|
|
176
|
+
toolTipArrowTop += bottomEdge;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
tTop: tTop,
|
|
181
|
+
toolTipArrowTop: toolTipArrowTop,
|
|
182
|
+
thisTop: thisTop,
|
|
183
|
+
thisHeight: thisHeight,
|
|
184
|
+
tooltipoffsetHeight: tooltipoffsetHeight,
|
|
185
|
+
bodyHeight: bodyHeight,
|
|
186
|
+
bottomEdge: bottomEdge
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
}, {
|
|
190
|
+
key: "handleOver",
|
|
191
|
+
value: function handleOver(e, targetElement) {
|
|
192
|
+
var _this2 = this;
|
|
193
|
+
|
|
194
|
+
var containerElement = this.tooltipContainerEl;
|
|
195
|
+
var element = e.target;
|
|
196
|
+
var titleDiv = element.hasAttribute('data-title') || element.hasAttribute('title') ? element : element.closest('[data-title]') || element.closest('[title]');
|
|
197
|
+
|
|
198
|
+
if (titleDiv) {
|
|
199
|
+
var title = titleDiv.getAttribute('data-title') || titleDiv.getAttribute('title');
|
|
200
|
+
/* if data-title-position is left or right change right and left in rtl case */
|
|
201
|
+
|
|
202
|
+
var isPosition = titleDiv.getAttribute('data-title-position');
|
|
203
|
+
var elem = this.getDirection;
|
|
204
|
+
|
|
205
|
+
if (elem.getAttribute('dir') == 'rtl') {
|
|
206
|
+
if (isPosition == 'left') {
|
|
207
|
+
isPosition = 'right';
|
|
208
|
+
} else if (isPosition == 'right') {
|
|
209
|
+
isPosition = 'left';
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (title !== '' && title) {
|
|
214
|
+
titleDiv.setAttribute('data-title', title);
|
|
215
|
+
titleDiv.removeAttribute('title');
|
|
216
|
+
|
|
217
|
+
if (element.nodeName !== 'I' && element.innerText && element.innerText.trim() !== '') {
|
|
218
|
+
var isContentDotted = '';
|
|
219
|
+
|
|
220
|
+
if (element.scrollWidth !== 0) {
|
|
221
|
+
isContentDotted = element.offsetWidth < element.scrollWidth;
|
|
222
|
+
|
|
223
|
+
if (!isContentDotted) {
|
|
224
|
+
isContentDotted = element.offsetHeight < element.scrollHeight;
|
|
225
|
+
} // if (!isContentDotted) {Need to check the code Sivanesh
|
|
226
|
+
// isContentDotted = element.offsetHeight < element.scrollHeight;
|
|
227
|
+
// }
|
|
228
|
+
|
|
229
|
+
} else {
|
|
230
|
+
var offWidth = (0, _selectn["default"])('parentElement.offsetWidth', element) || 0;
|
|
231
|
+
var scrollWidth = (0, _selectn["default"])('parentElement.scrollWidth', element) || 0;
|
|
232
|
+
isContentDotted = offWidth < scrollWidth;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
var originText = element.innerText.replace(/\s/g, '').toLowerCase();
|
|
236
|
+
var tooltipText = title.replace(/\s/g, '').toLowerCase();
|
|
237
|
+
var isDefaultTooltip = element.hasAttribute('data-istitle') || element.hasAttribute('istitle') ? element.getAttribute('data-istitle') || element.getAttribute('istitle') : 'false';
|
|
238
|
+
isDefaultTooltip = isDefaultTooltip === 'true';
|
|
239
|
+
var isSameText = originText.indexOf(tooltipText) !== -1 ? true : false;
|
|
240
|
+
|
|
241
|
+
if (!isContentDotted && isSameText && !isDefaultTooltip) {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (isContentDotted && titleDiv.getAttribute('data-dottedTitle')) {
|
|
246
|
+
title = titleDiv.getAttribute('data-dottedTitle');
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
var isHtml = titleDiv.getAttribute('data-ishtml');
|
|
251
|
+
var dataTooltipnoArrow = titleDiv.getAttribute('data-tooltip-noarrow') === 'true' ? true : false;
|
|
252
|
+
var dataTooltipWrap = titleDiv.getAttribute('data-title-wrap') === 'true' ? true : false;
|
|
253
|
+
var clientRect = titleDiv.getBoundingClientRect();
|
|
254
|
+
var boxLayout = this.getClientRectOfContEl(containerElement);
|
|
255
|
+
this.setState({
|
|
256
|
+
title: title,
|
|
257
|
+
isHtml: isHtml,
|
|
258
|
+
dataTooltipnoArrow: dataTooltipnoArrow,
|
|
259
|
+
dataTooltipWrap: dataTooltipWrap
|
|
260
|
+
}, function () {
|
|
261
|
+
var tooltip = _this2.toolTip;
|
|
262
|
+
|
|
263
|
+
if (tooltip) {
|
|
264
|
+
/* element top, left, height, width */
|
|
265
|
+
var thisTop = clientRect.top;
|
|
266
|
+
var thisLeft = clientRect.left;
|
|
267
|
+
var thisHeight = clientRect.height;
|
|
268
|
+
var thisWidth = clientRect.width;
|
|
269
|
+
/* box layout left spacing */
|
|
270
|
+
|
|
271
|
+
var bodyLeft = boxLayout.left; // let checkTop = thisTop + thisHeight;
|
|
272
|
+
|
|
273
|
+
/* element left plus element width */
|
|
274
|
+
|
|
275
|
+
var checkLeft = thisLeft + thisWidth;
|
|
276
|
+
var tTop;
|
|
277
|
+
var tLeft;
|
|
278
|
+
var toolTipArrowTop;
|
|
279
|
+
var toolTipArrowLeft;
|
|
280
|
+
var rightEdge;
|
|
281
|
+
var bottomEdge;
|
|
282
|
+
var tooltipLeft;
|
|
283
|
+
/* offset width, height of body */
|
|
284
|
+
|
|
285
|
+
var bodyWidth = containerElement.offsetWidth;
|
|
286
|
+
var bodyHeight = containerElement.offsetHeight;
|
|
287
|
+
var isArrowHorizontal = false;
|
|
288
|
+
var isArrowDown = false;
|
|
289
|
+
var isArrowRight = false;
|
|
290
|
+
var tWidth = '';
|
|
291
|
+
/* overall body height minus element top + element height */
|
|
292
|
+
|
|
293
|
+
var thisBottom = bodyHeight - (thisTop + thisHeight);
|
|
294
|
+
/* overall body width minus element left + element width */
|
|
295
|
+
|
|
296
|
+
var thisRight = bodyWidth - (thisLeft + thisWidth);
|
|
297
|
+
/* tooltip width and height */
|
|
298
|
+
|
|
299
|
+
var tooltipoffsetWidth = tooltip.offsetWidth;
|
|
300
|
+
var tooltipoffsetHeight = tooltip.offsetHeight;
|
|
301
|
+
|
|
302
|
+
if (isPosition) {
|
|
303
|
+
if (isPosition == 'top') {
|
|
304
|
+
/* if top does not have enough space show tooltip in bottom area */
|
|
305
|
+
if (thisTop <= tooltipoffsetHeight + 5) {
|
|
306
|
+
/* if top space is larger than bottom space show tooltip in top area */
|
|
307
|
+
if (thisTop > thisBottom) {
|
|
308
|
+
tTop = parseInt(thisTop - (tooltipoffsetHeight + 10));
|
|
309
|
+
tLeft = parseInt(thisLeft - (tooltipoffsetWidth - thisWidth) / 2 + 2);
|
|
310
|
+
toolTipArrowTop = parseInt(tooltipoffsetHeight - 4);
|
|
311
|
+
toolTipArrowLeft = parseInt(tooltipoffsetWidth / 2 - 6);
|
|
312
|
+
isArrowDown = true;
|
|
313
|
+
} else {
|
|
314
|
+
/* bottom position */
|
|
315
|
+
tTop = parseInt(thisTop + (thisHeight + 10));
|
|
316
|
+
tLeft = parseInt(thisLeft - (tooltipoffsetWidth - thisWidth) / 2 + 2);
|
|
317
|
+
toolTipArrowTop = -4;
|
|
318
|
+
toolTipArrowLeft = parseInt(tooltipoffsetWidth / 2 - 6);
|
|
319
|
+
isArrowDown = false;
|
|
320
|
+
}
|
|
321
|
+
} else {
|
|
322
|
+
/* if top have enough space show tooltip in top area */
|
|
323
|
+
tTop = parseInt(thisTop - (tooltipoffsetHeight + 10));
|
|
324
|
+
tLeft = parseInt(thisLeft - (tooltipoffsetWidth - thisWidth) / 2 + 2);
|
|
325
|
+
toolTipArrowTop = parseInt(tooltipoffsetHeight - 4);
|
|
326
|
+
toolTipArrowLeft = parseInt(tooltipoffsetWidth / 2 - 6);
|
|
327
|
+
isArrowDown = true;
|
|
328
|
+
}
|
|
329
|
+
/* top tooltip left and right corner edge case */
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
var values = _this2.leftRightScreenEdge(tLeft, toolTipArrowLeft, thisLeft, thisWidth, tooltipoffsetWidth, bodyWidth, rightEdge, bodyLeft);
|
|
333
|
+
|
|
334
|
+
tLeft = values.tLeft, toolTipArrowLeft = values.toolTipArrowLeft, thisLeft = values.thisLeft, thisWidth = values.thisWidth, tooltipoffsetWidth = values.tooltipoffsetWidth, bodyWidth = values.bodyWidth, rightEdge = values.rightEdge;
|
|
335
|
+
} else if (isPosition == 'bottom') {
|
|
336
|
+
/* if bottom does not have enough space show tooltip in top area */
|
|
337
|
+
if (thisBottom <= tooltipoffsetHeight + 5) {
|
|
338
|
+
/* if bottom space is larger than top space show tooltip in bottom area */
|
|
339
|
+
if (thisTop > thisBottom) {
|
|
340
|
+
tTop = parseInt(thisTop - (tooltipoffsetHeight + 10));
|
|
341
|
+
tLeft = parseInt(thisLeft - (tooltipoffsetWidth - thisWidth) / 2 + 2);
|
|
342
|
+
toolTipArrowTop = parseInt(tooltipoffsetHeight - 4);
|
|
343
|
+
toolTipArrowLeft = parseInt(tooltipoffsetWidth / 2 - 6);
|
|
344
|
+
isArrowDown = true;
|
|
345
|
+
} else {
|
|
346
|
+
/* top position */
|
|
347
|
+
tTop = parseInt(thisTop + (thisHeight + 10));
|
|
348
|
+
tLeft = parseInt(thisLeft - (tooltipoffsetWidth - thisWidth) / 2 + 2);
|
|
349
|
+
toolTipArrowTop = -4;
|
|
350
|
+
toolTipArrowLeft = parseInt(tooltipoffsetWidth / 2 - 6);
|
|
351
|
+
isArrowDown = false;
|
|
352
|
+
}
|
|
353
|
+
} else {
|
|
354
|
+
/* if bottom have enough space show tooltip in bottom area */
|
|
355
|
+
tTop = parseInt(thisTop + (thisHeight + 10));
|
|
356
|
+
tLeft = parseInt(thisLeft - (tooltipoffsetWidth - thisWidth) / 2 + 2);
|
|
357
|
+
toolTipArrowTop = -4;
|
|
358
|
+
toolTipArrowLeft = parseInt(tooltipoffsetWidth / 2 - 6);
|
|
359
|
+
isArrowDown = false;
|
|
360
|
+
}
|
|
361
|
+
/* bottom tooltip left and right corner edge case */
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
var _values = _this2.leftRightScreenEdge(tLeft, toolTipArrowLeft, thisLeft, thisWidth, tooltipoffsetWidth, bodyWidth, rightEdge, bodyLeft);
|
|
365
|
+
|
|
366
|
+
tLeft = _values.tLeft, toolTipArrowLeft = _values.toolTipArrowLeft, thisLeft = _values.thisLeft, thisWidth = _values.thisWidth, tooltipoffsetWidth = _values.tooltipoffsetWidth, bodyWidth = _values.bodyWidth, rightEdge = _values.rightEdge;
|
|
367
|
+
} else if (isPosition == 'left') {
|
|
368
|
+
isArrowHorizontal = true;
|
|
369
|
+
|
|
370
|
+
if (thisLeft - bodyLeft <= tooltipoffsetWidth) {
|
|
371
|
+
if (thisLeft - bodyLeft <= thisRight) {
|
|
372
|
+
/* if left does not have enough space show tooltip in right area */
|
|
373
|
+
tTop = parseInt(thisTop + (thisHeight / 2 - tooltipoffsetHeight / 2));
|
|
374
|
+
tLeft = parseInt(thisLeft + thisWidth + 10);
|
|
375
|
+
toolTipArrowTop = parseInt(tooltipoffsetHeight / 2 - 1);
|
|
376
|
+
toolTipArrowLeft = -1;
|
|
377
|
+
isArrowRight = false;
|
|
378
|
+
} else {
|
|
379
|
+
/* if left space is larger than right space show tooltip in left (default) area */
|
|
380
|
+
if (bodyLeft + tooltipoffsetWidth >= thisLeft) {
|
|
381
|
+
/* if tooltip width is greater than left space, set left space width to tooltip */
|
|
382
|
+
tWidth = thisLeft;
|
|
383
|
+
tTop = parseInt(thisTop + (thisHeight / 2 - tooltipoffsetHeight / 2));
|
|
384
|
+
tLeft = parseInt(thisLeft - tWidth - 7);
|
|
385
|
+
toolTipArrowTop = parseInt(tooltipoffsetHeight / 2 - 1);
|
|
386
|
+
toolTipArrowLeft = parseInt(tWidth - 2);
|
|
387
|
+
isArrowRight = true;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
} else {
|
|
391
|
+
/* if left have enough space show tooltip in left area */
|
|
392
|
+
tTop = parseInt(thisTop + (thisHeight / 2 - tooltipoffsetHeight / 2));
|
|
393
|
+
tLeft = parseInt(thisLeft - tooltipoffsetWidth - 7);
|
|
394
|
+
toolTipArrowTop = parseInt(tooltipoffsetHeight / 2 - 1);
|
|
395
|
+
toolTipArrowLeft = parseInt(tooltipoffsetWidth - 2);
|
|
396
|
+
isArrowRight = true;
|
|
397
|
+
}
|
|
398
|
+
/* left tooltip top and bottom corner edge case */
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
var _values2 = _this2.topBottomScreenEdge(tTop, toolTipArrowTop, thisTop, thisHeight, tooltipoffsetHeight, bodyHeight, bottomEdge);
|
|
402
|
+
|
|
403
|
+
tTop = _values2.tTop, toolTipArrowTop = _values2.toolTipArrowTop, thisTop = _values2.thisTop, thisHeight = _values2.thisHeight, tooltipoffsetHeight = _values2.tooltipoffsetHeight, bodyHeight = _values2.bodyHeight, bottomEdge = _values2.bottomEdge;
|
|
404
|
+
} else if (isPosition == 'right') {
|
|
405
|
+
isArrowHorizontal = true;
|
|
406
|
+
|
|
407
|
+
if (thisRight + bodyLeft <= tooltipoffsetWidth) {
|
|
408
|
+
if (thisLeft + bodyLeft <= thisRight) {
|
|
409
|
+
/* if right space is larger than left space show tooltip in right (default) area */
|
|
410
|
+
tTop = parseInt(thisTop + (thisHeight / 2 - tooltipoffsetHeight / 2));
|
|
411
|
+
tLeft = parseInt(thisLeft + thisWidth + 7);
|
|
412
|
+
toolTipArrowTop = parseInt(tooltipoffsetHeight / 2 - 1);
|
|
413
|
+
toolTipArrowLeft = -1;
|
|
414
|
+
isArrowRight = false;
|
|
415
|
+
} else {
|
|
416
|
+
/* if right does not have enough space show tooltip in left area */
|
|
417
|
+
if (tooltipoffsetWidth >= thisLeft) {
|
|
418
|
+
/* if tooltip width is greater than left space, set left space width to tooltip */
|
|
419
|
+
tWidth = thisLeft;
|
|
420
|
+
tTop = parseInt(thisTop + (thisHeight / 2 - tooltipoffsetHeight / 2));
|
|
421
|
+
tLeft = parseInt(thisLeft - tWidth - 7);
|
|
422
|
+
toolTipArrowTop = parseInt(tooltipoffsetHeight / 2 - 1);
|
|
423
|
+
toolTipArrowLeft = parseInt(tWidth - 2);
|
|
424
|
+
isArrowRight = true;
|
|
425
|
+
} else {
|
|
426
|
+
/* show tooltip in left area without setting left space width to tooltip */
|
|
427
|
+
tTop = parseInt(thisTop + (thisHeight / 2 - tooltipoffsetHeight / 2));
|
|
428
|
+
tLeft = parseInt(thisLeft - tooltipoffsetWidth - 7);
|
|
429
|
+
toolTipArrowTop = parseInt(tooltipoffsetHeight / 2 - 1);
|
|
430
|
+
toolTipArrowLeft = parseInt(tooltipoffsetWidth - 2);
|
|
431
|
+
isArrowRight = true;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
} else {
|
|
435
|
+
/* if right have enough space show tooltip in right area */
|
|
436
|
+
tTop = parseInt(thisTop + (thisHeight / 2 - tooltipoffsetHeight / 2));
|
|
437
|
+
tLeft = parseInt(thisLeft + thisWidth + 7);
|
|
438
|
+
toolTipArrowTop = parseInt(tooltipoffsetHeight / 2 - 1);
|
|
439
|
+
toolTipArrowLeft = -1;
|
|
440
|
+
isArrowRight = false;
|
|
441
|
+
}
|
|
442
|
+
/* right tooltip left and right corner edge case */
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
var _values3 = _this2.topBottomScreenEdge(tTop, toolTipArrowTop, thisTop, thisHeight, tooltipoffsetHeight, bodyHeight, bottomEdge);
|
|
446
|
+
|
|
447
|
+
tTop = _values3.tTop, toolTipArrowTop = _values3.toolTipArrowTop, thisTop = _values3.thisTop, thisHeight = _values3.thisHeight, tooltipoffsetHeight = _values3.tooltipoffsetHeight, bodyHeight = _values3.bodyHeight, bottomEdge = _values3.bottomEdge;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
_this2.setState({
|
|
451
|
+
top: tTop,
|
|
452
|
+
left: tLeft,
|
|
453
|
+
arrowTop: toolTipArrowTop,
|
|
454
|
+
arrowLeft: toolTipArrowLeft,
|
|
455
|
+
isArrowHorizontal: isArrowHorizontal,
|
|
456
|
+
isArrowDown: isArrowDown,
|
|
457
|
+
isArrowRight: isArrowRight,
|
|
458
|
+
width: tWidth
|
|
459
|
+
});
|
|
460
|
+
} else {
|
|
461
|
+
_this2.setState({
|
|
462
|
+
isArrowRight: null
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
tTop = parseInt(thisTop + thisHeight + 10);
|
|
466
|
+
tLeft = parseInt(thisLeft - (tooltipoffsetWidth / 2 - thisWidth / 2) + 2);
|
|
467
|
+
tooltipLeft = parseInt(tooltipoffsetWidth / 2 - 6);
|
|
468
|
+
|
|
469
|
+
if (tLeft - bodyLeft <= 1) {
|
|
470
|
+
// default left side screen edge case
|
|
471
|
+
tooltipLeft = parseInt(thisLeft - bodyLeft + thisWidth / 2 - 6);
|
|
472
|
+
tLeft = bodyLeft + 2;
|
|
473
|
+
} else if (tLeft - bodyLeft + tooltipoffsetWidth > bodyWidth) {
|
|
474
|
+
checkLeft = tLeft + tooltipoffsetWidth - bodyWidth + 2;
|
|
475
|
+
tooltipLeft = tooltipLeft - bodyLeft + checkLeft;
|
|
476
|
+
tLeft = tLeft + bodyLeft - checkLeft;
|
|
477
|
+
} else if (tLeft + tooltipoffsetWidth >= bodyWidth - 2) {
|
|
478
|
+
// default center screen tooltip collide with right edge screen
|
|
479
|
+
tLeft = parseInt(thisLeft - (tooltipoffsetWidth - thisWidth) / 2);
|
|
480
|
+
tooltipLeft = parseInt(tooltipoffsetWidth / 2 - 4);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
isArrowDown = false;
|
|
484
|
+
|
|
485
|
+
if (tTop + tooltipoffsetHeight > bodyHeight) {
|
|
486
|
+
/* if bottom does not have enough space show tooltip in top area */
|
|
487
|
+
if (thisTop > thisBottom) {
|
|
488
|
+
isArrowDown = true;
|
|
489
|
+
tTop -= tooltipoffsetHeight + thisHeight + 20;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
if (isArrowDown) {
|
|
494
|
+
var arrowTop = tooltipoffsetHeight - 4;
|
|
495
|
+
|
|
496
|
+
_this2.setState({
|
|
497
|
+
top: tTop,
|
|
498
|
+
left: tLeft,
|
|
499
|
+
arrowLeft: tooltipLeft,
|
|
500
|
+
arrowTop: arrowTop,
|
|
501
|
+
isArrowDown: true,
|
|
502
|
+
isArrowHorizontal: isArrowHorizontal
|
|
503
|
+
});
|
|
504
|
+
} else {
|
|
505
|
+
_this2.setState({
|
|
506
|
+
top: tTop,
|
|
507
|
+
left: tLeft,
|
|
508
|
+
arrowLeft: tooltipLeft,
|
|
509
|
+
arrowTop: -4,
|
|
510
|
+
isArrowDown: false,
|
|
511
|
+
isArrowHorizontal: isArrowHorizontal
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
titleDiv.addEventListener('click', this.reset);
|
|
518
|
+
titleDiv.addEventListener('mouseup', this.reset);
|
|
519
|
+
titleDiv.addEventListener('mouseleave', this.reset);
|
|
520
|
+
}
|
|
521
|
+
} else {
|
|
522
|
+
this.reset();
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}, {
|
|
526
|
+
key: "render",
|
|
527
|
+
value: function render() {
|
|
528
|
+
var _this$state = this.state,
|
|
529
|
+
title = _this$state.title,
|
|
530
|
+
left = _this$state.left,
|
|
531
|
+
top = _this$state.top,
|
|
532
|
+
arrowLeft = _this$state.arrowLeft,
|
|
533
|
+
arrowTop = _this$state.arrowTop,
|
|
534
|
+
isArrowDown = _this$state.isArrowDown,
|
|
535
|
+
isArrowRight = _this$state.isArrowRight,
|
|
536
|
+
isArrowHorizontal = _this$state.isArrowHorizontal,
|
|
537
|
+
width = _this$state.width,
|
|
538
|
+
isHtml = _this$state.isHtml,
|
|
539
|
+
dataTooltipnoArrow = _this$state.dataTooltipnoArrow,
|
|
540
|
+
dataTooltipWrap = _this$state.dataTooltipWrap;
|
|
541
|
+
var _this$props = this.props,
|
|
542
|
+
dataId = _this$props.dataId,
|
|
543
|
+
customClass = _this$props.customClass;
|
|
544
|
+
var arrowStyle = isArrowHorizontal ? isArrowRight ? _TooltipModule["default"].arrowRight : _TooltipModule["default"].arrowLeft : isArrowDown ? _TooltipModule["default"].arrowDown : _TooltipModule["default"].arrowUp;
|
|
545
|
+
title = title ? title.trim() : null;
|
|
546
|
+
var tooltipCss = "".concat(_TooltipModule["default"].tooltipcont, " ").concat(dataTooltipWrap ? _TooltipModule["default"].tooltipWrapCont : _TooltipModule["default"].tooltipNormalCont);
|
|
547
|
+
return title ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
548
|
+
className: "".concat(customClass, " ").concat(_TooltipModule["default"].tooltiptext),
|
|
549
|
+
style: {
|
|
550
|
+
left: left,
|
|
551
|
+
top: top,
|
|
552
|
+
width: width
|
|
553
|
+
},
|
|
554
|
+
ref: this.getToolTipDOM,
|
|
555
|
+
"data-id": dataId,
|
|
556
|
+
"data-test-id": dataId
|
|
557
|
+
}, !dataTooltipnoArrow ? /*#__PURE__*/_react["default"].createElement("span", {
|
|
558
|
+
className: "".concat(_TooltipModule["default"].tooltiparrow, " ").concat(arrowStyle),
|
|
559
|
+
style: {
|
|
560
|
+
left: arrowLeft,
|
|
561
|
+
top: arrowTop
|
|
562
|
+
}
|
|
563
|
+
}) : null, isHtml ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
564
|
+
className: tooltipCss,
|
|
565
|
+
dangerouslySetInnerHTML: {
|
|
566
|
+
__html: title
|
|
567
|
+
}
|
|
568
|
+
}) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
569
|
+
className: tooltipCss
|
|
570
|
+
}, title)) : null;
|
|
571
|
+
}
|
|
572
|
+
}]);
|
|
573
|
+
|
|
574
|
+
return Tooltip;
|
|
575
|
+
}(_react["default"].Component);
|
|
576
|
+
|
|
577
|
+
exports["default"] = Tooltip;
|
|
578
|
+
Tooltip.propTypes = _propTypes.propTypes;
|
|
579
|
+
Tooltip.defaultProps = _defaultProps.defaultProps; // if (__DOCS__) {
|
|
580
|
+
// Tooltip.docs = {
|
|
581
|
+
// componentGroup: 'Atom',
|
|
582
|
+
// folderName: 'Style Guide',
|
|
583
|
+
// description: ' ',
|
|
584
|
+
// external: true
|
|
585
|
+
// };
|
|
586
|
+
// }
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _defaultProps = require("./props/defaultProps");
|
|
11
|
+
|
|
12
|
+
var _propTypes = require("./props/propTypes");
|
|
13
|
+
|
|
14
|
+
var _cssJSLogic2 = _interopRequireDefault(require("./css/cssJSLogic"));
|
|
15
|
+
|
|
16
|
+
var _utils = require("@zohodesk/utils");
|
|
17
|
+
|
|
18
|
+
var _TypographyModule = _interopRequireDefault(require("./css/Typography.module.css"));
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
|
|
22
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
+
|
|
24
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
|
+
|
|
26
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
|
+
|
|
28
|
+
var Typography = function Typography(props) {
|
|
29
|
+
var children = props.children,
|
|
30
|
+
$ui_tagName = props.$ui_tagName,
|
|
31
|
+
$i18n_dataTitle = props.$i18n_dataTitle,
|
|
32
|
+
testId = props.testId,
|
|
33
|
+
customId = props.customId,
|
|
34
|
+
tagAttributes = props.tagAttributes,
|
|
35
|
+
a11yAttributes = props.a11yAttributes,
|
|
36
|
+
customStyle = props.customStyle;
|
|
37
|
+
var style = (0, _utils.mergeStyle)(_TypographyModule["default"], customStyle);
|
|
38
|
+
|
|
39
|
+
var _cssJSLogic = (0, _cssJSLogic2["default"])({
|
|
40
|
+
props: props,
|
|
41
|
+
style: style
|
|
42
|
+
}),
|
|
43
|
+
typographyClass = _cssJSLogic.typographyClass;
|
|
44
|
+
|
|
45
|
+
return /*#__PURE__*/_react["default"].createElement($ui_tagName, _objectSpread(_objectSpread({
|
|
46
|
+
className: typographyClass,
|
|
47
|
+
'data-title': $i18n_dataTitle,
|
|
48
|
+
'data-id': customId,
|
|
49
|
+
'data-test-id': testId
|
|
50
|
+
}, tagAttributes), a11yAttributes), children);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
Typography.propTypes = _propTypes.propTypes;
|
|
54
|
+
Typography.defaultProps = _defaultProps.defaultProps;
|
|
55
|
+
var _default = Typography;
|
|
56
|
+
exports["default"] = _default;
|