@clayui/tooltip
Advanced tools
Comparing version 3.0.4 to 3.0.5
@@ -6,2 +6,8 @@ # Change Log | ||
## [3.0.5](https://github.com/liferay/clay/tree/master/packages/clay-tooltip/compare/@clayui/tooltip@3.0.4...@clayui/tooltip@3.0.5) (2019-12-05) | ||
### Bug Fixes | ||
- **drop-down:** use dom-align instead of metal-position ([335ff38](https://github.com/liferay/clay/tree/master/packages/clay-tooltip/commit/335ff38)) | ||
## [3.0.4](https://github.com/liferay/clay/tree/master/packages/clay-tooltip/compare/@clayui/tooltip@3.0.3...@clayui/tooltip@3.0.4) (2019-11-07) | ||
@@ -8,0 +14,0 @@ |
@@ -10,3 +10,3 @@ "use strict"; | ||
var _metalPosition = require("metal-position"); | ||
var _domAlign = _interopRequireDefault(require("dom-align")); | ||
@@ -19,6 +19,6 @@ var _react = _interopRequireWildcard(require("react")); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
@@ -42,11 +42,21 @@ | ||
var ALIGNMENTS_MAP = { | ||
bottom: _metalPosition.Align.Bottom, | ||
'bottom-left': _metalPosition.Align.BottomLeft, | ||
'bottom-right': _metalPosition.Align.BottomRight, | ||
left: _metalPosition.Align.Left, | ||
right: _metalPosition.Align.Right, | ||
top: _metalPosition.Align.Top, | ||
'top-left': _metalPosition.Align.TopLeft, | ||
'top-right': _metalPosition.Align.TopRight | ||
bottom: ['tc', 'bc'], | ||
'bottom-left': ['tl', 'bl'], | ||
'bottom-right': ['tr', 'br'], | ||
left: ['cr', 'cl'], | ||
right: ['cl', 'cr'], | ||
top: ['bc', 'tc'], | ||
'top-left': ['bl', 'tl'], | ||
'top-right': ['br', 'tr'] | ||
}; | ||
var ALIGNMENTS_INVERSE_MAP = { | ||
bctc: 'top', | ||
bltl: 'top-left', | ||
brtr: 'top-right', | ||
clcr: 'right', | ||
crcl: 'left', | ||
tcbc: 'bottom', | ||
tlbl: 'bottom-left', | ||
trbr: 'bottom-right' | ||
}; | ||
var initialState = { | ||
@@ -160,3 +170,3 @@ align: 'top', | ||
dispatch({ | ||
align: newAlign, | ||
align: newAlign || align, | ||
message: title, | ||
@@ -171,7 +181,15 @@ type: 'show' | ||
if (titleNodeRef.current && tooltipRef.current) { | ||
var newAlignment = ALIGNMENTS[_metalPosition.Align.align(tooltipRef.current, titleNodeRef.current, ALIGNMENTS_MAP[align || 'top'], autoAlign)]; | ||
var points = ALIGNMENTS_MAP[align || 'top']; | ||
var newAlignmentString = (0, _domAlign.default)(tooltipRef.current, titleNodeRef.current, { | ||
overflow: { | ||
adjustX: autoAlign, | ||
adjustY: autoAlign | ||
}, | ||
points: points | ||
}).points.join(''); | ||
var pointsString = points.join(''); | ||
if (newAlignment !== align) { | ||
if (pointsString !== newAlignmentString) { | ||
dispatch({ | ||
align: newAlignment, | ||
align: ALIGNMENTS_INVERSE_MAP[newAlignmentString], | ||
type: 'align' | ||
@@ -178,0 +196,0 @@ }); |
{ | ||
"name": "@clayui/tooltip", | ||
"version": "3.0.4", | ||
"version": "3.0.5", | ||
"description": "ClayTooltip component", | ||
@@ -29,5 +29,5 @@ "license": "BSD-3-Clause", | ||
"dependencies": { | ||
"@clayui/shared": "^3.0.4", | ||
"@clayui/shared": "^3.0.5", | ||
"classnames": "^2.2.6", | ||
"metal-position": "^2.1.2", | ||
"dom-align": "^1.10.2", | ||
"warning": "^4.0.3" | ||
@@ -43,3 +43,3 @@ }, | ||
], | ||
"gitHead": "e8d8027c66c6f9998b56f5bb7a0085bf00259a59" | ||
"gitHead": "df13196d448cb28438003716c4bae275b793dec1" | ||
} |
Sorry, the diff of this file is not supported yet
23917
539
+ Addeddom-align@^1.10.2
- Removedmetal-position@^2.1.2
- Removedmetal@2.16.8(transitive)
- Removedmetal-dom@2.16.8(transitive)
- Removedmetal-events@2.16.8(transitive)
- Removedmetal-position@2.1.2(transitive)
Updated@clayui/shared@^3.0.5