@elliemae/ds-popper 2.3.1 → 3.0.0-alpha.3
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/dist/cjs/DSPopper.js +117 -0
- package/dist/cjs/DSPopper.js.map +7 -0
- package/dist/cjs/PopperContent.js +158 -0
- package/dist/cjs/PopperContent.js.map +7 -0
- package/dist/cjs/PopperImpl.js +281 -0
- package/dist/cjs/PopperImpl.js.map +7 -0
- package/dist/cjs/getArrowStylesBySize.js +73 -0
- package/dist/cjs/getArrowStylesBySize.js.map +7 -0
- package/dist/cjs/index.js +37 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/interaction.js +40 -0
- package/dist/cjs/interaction.js.map +7 -0
- package/dist/cjs/positions.js +69 -0
- package/dist/cjs/positions.js.map +7 -0
- package/dist/cjs/props.js +89 -0
- package/dist/cjs/props.js.map +7 -0
- package/dist/esm/DSPopper.js +88 -0
- package/dist/esm/DSPopper.js.map +7 -0
- package/dist/esm/PopperContent.js +131 -0
- package/dist/esm/PopperContent.js.map +7 -0
- package/{esm → dist/esm}/PopperImpl.js +75 -143
- package/dist/esm/PopperImpl.js.map +7 -0
- package/dist/esm/getArrowStylesBySize.js +46 -0
- package/dist/esm/getArrowStylesBySize.js.map +7 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/interaction.js +11 -0
- package/dist/esm/interaction.js.map +7 -0
- package/dist/esm/positions.js +40 -0
- package/dist/esm/positions.js.map +7 -0
- package/dist/esm/props.js +60 -0
- package/dist/esm/props.js.map +7 -0
- package/package.json +41 -32
- package/cjs/DSPopper.js +0 -97
- package/cjs/PopperContent.js +0 -156
- package/cjs/PopperImpl.js +0 -335
- package/cjs/getArrowStylesBySize.js +0 -46
- package/cjs/index.js +0 -19
- package/cjs/interaction.js +0 -12
- package/cjs/positions.js +0 -25
- package/cjs/props.js +0 -88
- package/esm/DSPopper.js +0 -83
- package/esm/PopperContent.js +0 -147
- package/esm/getArrowStylesBySize.js +0 -37
- package/esm/index.js +0 -4
- package/esm/interaction.js +0 -7
- package/esm/positions.js +0 -20
- package/esm/props.js +0 -83
- package/types/DSPopper.d.ts +0 -156
- package/types/PopperContent.d.ts +0 -21
- package/types/PopperImpl.d.ts +0 -52
- package/types/getArrowStylesBySize.d.ts +0 -2
- package/types/index.d.ts +0 -3
- package/types/interaction.d.ts +0 -5
- package/types/positions.d.ts +0 -18
- package/types/props.d.ts +0 -119
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
-
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
-
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
-
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
-
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
-
|
|
12
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
-
|
|
14
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
15
|
-
|
|
16
|
-
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; }
|
|
17
|
-
|
|
18
|
-
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__default["default"](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; }
|
|
19
|
-
|
|
20
|
-
const getArrowStylesBySize = function (position) {
|
|
21
|
-
let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 30;
|
|
22
|
-
const basePosition = position && position.split('-')[0];
|
|
23
|
-
return _objectSpread({
|
|
24
|
-
borderWidth: size
|
|
25
|
-
}, {
|
|
26
|
-
top: {
|
|
27
|
-
top: '100% !important',
|
|
28
|
-
transform: "rotateZ(".concat(180, "deg)")
|
|
29
|
-
},
|
|
30
|
-
right: {
|
|
31
|
-
right: '100%',
|
|
32
|
-
transform: "rotateZ(".concat(-90, "deg)")
|
|
33
|
-
},
|
|
34
|
-
bottom: {
|
|
35
|
-
bottom: '100%',
|
|
36
|
-
transform: "rotateZ(".concat(0, "deg)")
|
|
37
|
-
},
|
|
38
|
-
left: {
|
|
39
|
-
left: '100%',
|
|
40
|
-
transform: "rotateZ(".concat(90, "deg)")
|
|
41
|
-
}
|
|
42
|
-
}[basePosition]);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
exports["default"] = getArrowStylesBySize;
|
|
46
|
-
exports.getArrowStylesBySize = getArrowStylesBySize;
|
package/cjs/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var DSPopper = require('./DSPopper.js');
|
|
6
|
-
var getArrowStylesBySize = require('./getArrowStylesBySize.js');
|
|
7
|
-
var interaction = require('./interaction.js');
|
|
8
|
-
var positions = require('./positions.js');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.DSPopper = DSPopper.DSPopper;
|
|
13
|
-
exports.DSPopperWithSchema = DSPopper.DSPopperWithSchema;
|
|
14
|
-
exports["default"] = DSPopper.DSPopper;
|
|
15
|
-
exports.getArrowStylesBySize = getArrowStylesBySize.getArrowStylesBySize;
|
|
16
|
-
exports.PopperInteractions = interaction.Interaction;
|
|
17
|
-
exports.interactions = interaction.interactions;
|
|
18
|
-
exports.PopperPositions = positions.Position;
|
|
19
|
-
exports.positions = positions.positions;
|
package/cjs/interaction.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const Interaction = {
|
|
6
|
-
CLICK: 'click',
|
|
7
|
-
HOVER: 'hover'
|
|
8
|
-
};
|
|
9
|
-
const interactions = [Interaction.CLICK, Interaction.HOVER];
|
|
10
|
-
|
|
11
|
-
exports.Interaction = Interaction;
|
|
12
|
-
exports.interactions = interactions;
|
package/cjs/positions.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const Position = {
|
|
6
|
-
AUTO: 'auto',
|
|
7
|
-
AUTO_START: 'auto-start',
|
|
8
|
-
AUTO_END: 'auto-end',
|
|
9
|
-
BOTTOM: 'bottom',
|
|
10
|
-
BOTTOM_START: 'bottom-start',
|
|
11
|
-
BOTTOM_END: 'bottom-end',
|
|
12
|
-
LEFT: 'left',
|
|
13
|
-
LEFT_END: 'left-end',
|
|
14
|
-
LEFT_START: 'left-start',
|
|
15
|
-
RIGHT: 'right',
|
|
16
|
-
RIGHT_END: 'right-end',
|
|
17
|
-
RIGHT_START: 'right-start',
|
|
18
|
-
TOP: 'top',
|
|
19
|
-
TOP_START: 'top-start',
|
|
20
|
-
TOP_END: 'top-end'
|
|
21
|
-
};
|
|
22
|
-
const positions = [Position.AUTO_START, Position.AUTO_END, Position.AUTO, Position.TOP_START, Position.TOP, Position.TOP_END, Position.RIGHT_START, Position.RIGHT, Position.RIGHT_END, Position.BOTTOM_START, Position.BOTTOM, Position.BOTTOM_END, Position.LEFT_START, Position.LEFT, Position.LEFT_END];
|
|
23
|
-
|
|
24
|
-
exports.Position = Position;
|
|
25
|
-
exports.positions = positions;
|
package/cjs/props.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var reactDesc = require('react-desc');
|
|
6
|
-
var positions = require('./positions.js');
|
|
7
|
-
var interaction = require('./interaction.js');
|
|
8
|
-
|
|
9
|
-
const popperProps = {
|
|
10
|
-
/** Hide menu component if trigger component is not visible/scrolled away */
|
|
11
|
-
hideIfNotVisible: reactDesc.PropTypes.bool.description('Hide menu component if trigger component is not visible/scrolled away'),
|
|
12
|
-
|
|
13
|
-
/** props to inject to popper wrapper */
|
|
14
|
-
containerProps: reactDesc.PropTypes.object.description('props to inject to popper wrapper'),
|
|
15
|
-
|
|
16
|
-
/** Space between the arrow and the popup */
|
|
17
|
-
arrowGap: reactDesc.PropTypes.number.description('Space between the arrow and the popup'),
|
|
18
|
-
|
|
19
|
-
/** callback for when menu changes from close to open */
|
|
20
|
-
onOpen: reactDesc.PropTypes.func.description('callback for when menu changes from close to open'),
|
|
21
|
-
|
|
22
|
-
/** callback for when menu changes from open to close */
|
|
23
|
-
onClose: reactDesc.PropTypes.func.description('callback for when menu changes from open to close'),
|
|
24
|
-
|
|
25
|
-
/** Time in ms to delay close of menu */
|
|
26
|
-
delayClose: reactDesc.PropTypes.number.description('Time in ms to delay close of menu'),
|
|
27
|
-
|
|
28
|
-
/** Time in ms to delay open of menu */
|
|
29
|
-
delayOpen: reactDesc.PropTypes.number.description('Time in ms to delay open of menu'),
|
|
30
|
-
|
|
31
|
-
/** callback for when menu changes placement */
|
|
32
|
-
onPlacementChange: reactDesc.PropTypes.func.description('callback for when menu changes placement'),
|
|
33
|
-
|
|
34
|
-
/** Arrow size */
|
|
35
|
-
arrowSize: reactDesc.PropTypes.number.description('Arrow size'),
|
|
36
|
-
|
|
37
|
-
/** Bem blockname for the popper */
|
|
38
|
-
blockName: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.object]).description('Bem blockname for the popper'),
|
|
39
|
-
triggerComponent: reactDesc.PropTypes.element.description("The component that will open/close the tooltip. \n Cannot be used with disabled elements. \n https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled").isRequired
|
|
40
|
-
};
|
|
41
|
-
const defaultProps = {
|
|
42
|
-
containerProps: {},
|
|
43
|
-
arrowGap: 8,
|
|
44
|
-
arrowSize: 6,
|
|
45
|
-
blockName: '',
|
|
46
|
-
contentOffset: null,
|
|
47
|
-
contentStyle: null,
|
|
48
|
-
contentComponent: () => null,
|
|
49
|
-
delayClose: 300,
|
|
50
|
-
delayOpen: 200,
|
|
51
|
-
interactionType: interaction.Interaction.CLICK,
|
|
52
|
-
onOpen: () => null,
|
|
53
|
-
onClose: () => null,
|
|
54
|
-
onPlacementChange: () => null,
|
|
55
|
-
placement: positions.Position.BOTTOM,
|
|
56
|
-
preventOverflow: 'window',
|
|
57
|
-
showArrow: true,
|
|
58
|
-
closeAnimationConfig: {
|
|
59
|
-
to: {
|
|
60
|
-
transform: 'scale(0.8)',
|
|
61
|
-
opacity: '0'
|
|
62
|
-
},
|
|
63
|
-
config: {
|
|
64
|
-
delay: 80,
|
|
65
|
-
duration: 80
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
openAnimationConfig: {
|
|
69
|
-
to: {
|
|
70
|
-
transform: 'scale(1)',
|
|
71
|
-
opacity: '1'
|
|
72
|
-
},
|
|
73
|
-
config: {
|
|
74
|
-
delay: 80,
|
|
75
|
-
duration: 80
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
usePortal: true,
|
|
79
|
-
triggerComponent: () => null,
|
|
80
|
-
getTargetFromChildren: () => null,
|
|
81
|
-
getContentFromChildren: () => null,
|
|
82
|
-
modifiers: {},
|
|
83
|
-
triggerRef: () => null,
|
|
84
|
-
hideIfNotVisible: false
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
exports.defaultProps = defaultProps;
|
|
88
|
-
exports.popperProps = popperProps;
|
package/esm/DSPopper.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import 'react';
|
|
3
|
-
import { describe } from 'react-desc';
|
|
4
|
-
import PopperImpl from './PopperImpl.js';
|
|
5
|
-
export { Position as PopperPositions, positions } from './positions.js';
|
|
6
|
-
export { Interaction as PopperInteractions, interactions } from './interaction.js';
|
|
7
|
-
import { popperProps, defaultProps } from './props.js';
|
|
8
|
-
|
|
9
|
-
const DSPopper = _ref => {
|
|
10
|
-
let {
|
|
11
|
-
containerProps,
|
|
12
|
-
arrowGap,
|
|
13
|
-
arrowSize,
|
|
14
|
-
blockName,
|
|
15
|
-
contentOffset,
|
|
16
|
-
contentStyle,
|
|
17
|
-
contentComponent,
|
|
18
|
-
delayClose,
|
|
19
|
-
delayOpen,
|
|
20
|
-
interactionType,
|
|
21
|
-
isOpen,
|
|
22
|
-
// if this is set DSPopper would be a controlled component if not, an uncontrolled one
|
|
23
|
-
onOpen,
|
|
24
|
-
onClose,
|
|
25
|
-
onPlacementChange,
|
|
26
|
-
placement,
|
|
27
|
-
preventOverflow,
|
|
28
|
-
showArrow,
|
|
29
|
-
closeAnimationConfig,
|
|
30
|
-
openAnimationConfig,
|
|
31
|
-
usePortal,
|
|
32
|
-
triggerComponent,
|
|
33
|
-
wrapExtraComponent,
|
|
34
|
-
getTargetFromChildren,
|
|
35
|
-
getContentFromChildren,
|
|
36
|
-
modifiers,
|
|
37
|
-
triggerRef,
|
|
38
|
-
children: customPopper,
|
|
39
|
-
renderReference,
|
|
40
|
-
referenceNode,
|
|
41
|
-
zIndex,
|
|
42
|
-
hideIfNotVisible
|
|
43
|
-
} = _ref;
|
|
44
|
-
return /*#__PURE__*/_jsx(PopperImpl, {
|
|
45
|
-
arrowGap: arrowGap,
|
|
46
|
-
arrowSize: arrowSize,
|
|
47
|
-
blockName: blockName,
|
|
48
|
-
closeAnimationConfig: closeAnimationConfig,
|
|
49
|
-
containerProps: containerProps,
|
|
50
|
-
contentComponent: contentComponent,
|
|
51
|
-
contentOffset: contentOffset,
|
|
52
|
-
contentStyle: contentStyle,
|
|
53
|
-
delayClose: delayClose,
|
|
54
|
-
delayOpen: delayOpen,
|
|
55
|
-
getContentFromChildren: getContentFromChildren,
|
|
56
|
-
getTargetFromChildren: getTargetFromChildren,
|
|
57
|
-
interactionType: interactionType,
|
|
58
|
-
isOpen: isOpen,
|
|
59
|
-
modifiers: modifiers,
|
|
60
|
-
onOpen: onOpen,
|
|
61
|
-
onClose: onClose,
|
|
62
|
-
onPlacementChange: onPlacementChange,
|
|
63
|
-
openAnimationConfig: openAnimationConfig,
|
|
64
|
-
placement: placement,
|
|
65
|
-
preventOverflow: preventOverflow,
|
|
66
|
-
referenceNode: referenceNode,
|
|
67
|
-
renderReference: renderReference,
|
|
68
|
-
showArrow: showArrow,
|
|
69
|
-
triggerComponent: triggerComponent,
|
|
70
|
-
triggerRef: triggerRef,
|
|
71
|
-
usePortal: usePortal,
|
|
72
|
-
wrapExtraComponent: wrapExtraComponent,
|
|
73
|
-
zIndex: zIndex,
|
|
74
|
-
hideIfNotVisible: hideIfNotVisible
|
|
75
|
-
}, void 0, customPopper);
|
|
76
|
-
}; // @deprecated: There's the NEW (not finished) popover that uses its own popper implementation.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
DSPopper.defaultProps = defaultProps;
|
|
80
|
-
const DSPopperWithSchema = describe(DSPopper);
|
|
81
|
-
DSPopperWithSchema.propTypes = popperProps;
|
|
82
|
-
|
|
83
|
-
export { DSPopper, DSPopperWithSchema, DSPopper as default };
|
package/esm/PopperContent.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
-
import { PureComponent } from 'react';
|
|
9
|
-
import { Popper } from '@elliemae/react-popper';
|
|
10
|
-
import { Keyframes, animated } from 'react-spring/renderprops';
|
|
11
|
-
import getComponentFromProps from '@elliemae/ds-utilities/getComponentFromProps';
|
|
12
|
-
import DSOverlay from '@elliemae/ds-overlay';
|
|
13
|
-
import { getArrowStylesBySize } from './getArrowStylesBySize.js';
|
|
14
|
-
import { jsx } from 'react/jsx-runtime';
|
|
15
|
-
|
|
16
|
-
var _svg;
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
const Content = Keyframes.Spring({});
|
|
22
|
-
class PopperContent extends PureComponent {
|
|
23
|
-
// eslint-disable-next-line react/static-property-placement
|
|
24
|
-
constructor(props) {
|
|
25
|
-
super(props);
|
|
26
|
-
this.renderContent = this.renderContent.bind(this);
|
|
27
|
-
this.renderArrow = this.renderArrow.bind(this);
|
|
28
|
-
this.handleRestAnimation = this.handleRestAnimation.bind(this);
|
|
29
|
-
this.handleRestAnimation = this.handleRestAnimation.bind(this);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
handleRestAnimation() {
|
|
33
|
-
const {
|
|
34
|
-
isOpen,
|
|
35
|
-
onContentDestroyed
|
|
36
|
-
} = this.props;
|
|
37
|
-
|
|
38
|
-
if (!isOpen) {
|
|
39
|
-
onContentDestroyed();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
renderArrow(_ref, placement) {
|
|
44
|
-
let {
|
|
45
|
-
ref,
|
|
46
|
-
style
|
|
47
|
-
} = _ref;
|
|
48
|
-
const {
|
|
49
|
-
blockName,
|
|
50
|
-
showArrow
|
|
51
|
-
} = this.props;
|
|
52
|
-
if (!showArrow) return null;
|
|
53
|
-
return /*#__PURE__*/jsx("div", {
|
|
54
|
-
ref: ref,
|
|
55
|
-
className: "".concat(blockName || 'popper', "__arrow"),
|
|
56
|
-
"data-placement": placement,
|
|
57
|
-
style: _objectSpread(_objectSpread({}, style), getArrowStylesBySize(placement, 25)),
|
|
58
|
-
children: _svg || (_svg = /*#__PURE__*/_jsx("svg", {
|
|
59
|
-
viewBox: "0 0 30 30"
|
|
60
|
-
}, void 0, /*#__PURE__*/_jsx("path", {
|
|
61
|
-
className: "stroke",
|
|
62
|
-
d: "M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z"
|
|
63
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
64
|
-
className: "fill",
|
|
65
|
-
d: "M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z"
|
|
66
|
-
})))
|
|
67
|
-
}, "popper-arrow");
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
renderContent(_ref2) {
|
|
71
|
-
let {
|
|
72
|
-
ref,
|
|
73
|
-
style,
|
|
74
|
-
placement,
|
|
75
|
-
arrowProps,
|
|
76
|
-
scheduleUpdate,
|
|
77
|
-
outOfBoundaries
|
|
78
|
-
} = _ref2;
|
|
79
|
-
const {
|
|
80
|
-
contentComponent,
|
|
81
|
-
contentStyle,
|
|
82
|
-
isOpen,
|
|
83
|
-
closeAnimationConfig,
|
|
84
|
-
openAnimationConfig,
|
|
85
|
-
onMouseEnter,
|
|
86
|
-
onMouseLeave,
|
|
87
|
-
containerProps,
|
|
88
|
-
zIndex,
|
|
89
|
-
hideIfNotVisible
|
|
90
|
-
} = this.props;
|
|
91
|
-
|
|
92
|
-
const computedStyle = _objectSpread(_objectSpread(_objectSpread({}, style), contentStyle), {}, {
|
|
93
|
-
zIndex
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
97
|
-
"data-placement": placement,
|
|
98
|
-
onMouseEnter: onMouseEnter,
|
|
99
|
-
onMouseLeave: onMouseLeave,
|
|
100
|
-
style: computedStyle,
|
|
101
|
-
"data-testid": "popper-container",
|
|
102
|
-
children: /*#__PURE__*/_jsx(Content, {
|
|
103
|
-
native: true,
|
|
104
|
-
onRest: this.handleRestAnimation,
|
|
105
|
-
state: isOpen && (!outOfBoundaries || !hideIfNotVisible) ? 'open' : 'close',
|
|
106
|
-
states: {
|
|
107
|
-
open: _objectSpread(_objectSpread({}, openAnimationConfig), {}, {
|
|
108
|
-
from: closeAnimationConfig.to
|
|
109
|
-
}),
|
|
110
|
-
close: closeAnimationConfig
|
|
111
|
-
}
|
|
112
|
-
}, void 0, animationStyle => /*#__PURE__*/jsx(animated.div, {
|
|
113
|
-
ref: ref,
|
|
114
|
-
style: animationStyle,
|
|
115
|
-
children: getComponentFromProps(contentComponent, {
|
|
116
|
-
scheduleUpdate
|
|
117
|
-
}, [this.renderArrow(arrowProps, placement)])
|
|
118
|
-
}))
|
|
119
|
-
}));
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
render() {
|
|
123
|
-
const {
|
|
124
|
-
destroyed = false,
|
|
125
|
-
onClickOutside = () => null,
|
|
126
|
-
placement = 'bottom-start',
|
|
127
|
-
modifiers = {},
|
|
128
|
-
referenceNode,
|
|
129
|
-
usePortal = true
|
|
130
|
-
} = this.props;
|
|
131
|
-
return /*#__PURE__*/_jsx(DSOverlay, {
|
|
132
|
-
isOpen: !destroyed,
|
|
133
|
-
onClickOutside: onClickOutside,
|
|
134
|
-
usePortal: usePortal
|
|
135
|
-
}, void 0, /*#__PURE__*/_jsx(Popper, {
|
|
136
|
-
modifiers: modifiers,
|
|
137
|
-
placement: placement,
|
|
138
|
-
referenceElement: referenceNode
|
|
139
|
-
}, void 0, this.renderContent));
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
PopperContent.defaultProps = {
|
|
144
|
-
onContentDestroyed: () => null
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
export { PopperContent as default };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
-
|
|
8
|
-
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; }
|
|
9
|
-
|
|
10
|
-
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; }
|
|
11
|
-
|
|
12
|
-
const getArrowStylesBySize = function (position) {
|
|
13
|
-
let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 30;
|
|
14
|
-
const basePosition = position && position.split('-')[0];
|
|
15
|
-
return _objectSpread({
|
|
16
|
-
borderWidth: size
|
|
17
|
-
}, {
|
|
18
|
-
top: {
|
|
19
|
-
top: '100% !important',
|
|
20
|
-
transform: "rotateZ(".concat(180, "deg)")
|
|
21
|
-
},
|
|
22
|
-
right: {
|
|
23
|
-
right: '100%',
|
|
24
|
-
transform: "rotateZ(".concat(-90, "deg)")
|
|
25
|
-
},
|
|
26
|
-
bottom: {
|
|
27
|
-
bottom: '100%',
|
|
28
|
-
transform: "rotateZ(".concat(0, "deg)")
|
|
29
|
-
},
|
|
30
|
-
left: {
|
|
31
|
-
left: '100%',
|
|
32
|
-
transform: "rotateZ(".concat(90, "deg)")
|
|
33
|
-
}
|
|
34
|
-
}[basePosition]);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export { getArrowStylesBySize as default, getArrowStylesBySize };
|
package/esm/index.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { DSPopper, DSPopperWithSchema, DSPopper as default } from './DSPopper.js';
|
|
2
|
-
export { getArrowStylesBySize } from './getArrowStylesBySize.js';
|
|
3
|
-
export { Interaction as PopperInteractions, interactions } from './interaction.js';
|
|
4
|
-
export { Position as PopperPositions, positions } from './positions.js';
|
package/esm/interaction.js
DELETED
package/esm/positions.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const Position = {
|
|
2
|
-
AUTO: 'auto',
|
|
3
|
-
AUTO_START: 'auto-start',
|
|
4
|
-
AUTO_END: 'auto-end',
|
|
5
|
-
BOTTOM: 'bottom',
|
|
6
|
-
BOTTOM_START: 'bottom-start',
|
|
7
|
-
BOTTOM_END: 'bottom-end',
|
|
8
|
-
LEFT: 'left',
|
|
9
|
-
LEFT_END: 'left-end',
|
|
10
|
-
LEFT_START: 'left-start',
|
|
11
|
-
RIGHT: 'right',
|
|
12
|
-
RIGHT_END: 'right-end',
|
|
13
|
-
RIGHT_START: 'right-start',
|
|
14
|
-
TOP: 'top',
|
|
15
|
-
TOP_START: 'top-start',
|
|
16
|
-
TOP_END: 'top-end'
|
|
17
|
-
};
|
|
18
|
-
const positions = [Position.AUTO_START, Position.AUTO_END, Position.AUTO, Position.TOP_START, Position.TOP, Position.TOP_END, Position.RIGHT_START, Position.RIGHT, Position.RIGHT_END, Position.BOTTOM_START, Position.BOTTOM, Position.BOTTOM_END, Position.LEFT_START, Position.LEFT, Position.LEFT_END];
|
|
19
|
-
|
|
20
|
-
export { Position, positions };
|
package/esm/props.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { PropTypes } from 'react-desc';
|
|
2
|
-
import { Position } from './positions.js';
|
|
3
|
-
import { Interaction } from './interaction.js';
|
|
4
|
-
|
|
5
|
-
const popperProps = {
|
|
6
|
-
/** Hide menu component if trigger component is not visible/scrolled away */
|
|
7
|
-
hideIfNotVisible: PropTypes.bool.description('Hide menu component if trigger component is not visible/scrolled away'),
|
|
8
|
-
|
|
9
|
-
/** props to inject to popper wrapper */
|
|
10
|
-
containerProps: PropTypes.object.description('props to inject to popper wrapper'),
|
|
11
|
-
|
|
12
|
-
/** Space between the arrow and the popup */
|
|
13
|
-
arrowGap: PropTypes.number.description('Space between the arrow and the popup'),
|
|
14
|
-
|
|
15
|
-
/** callback for when menu changes from close to open */
|
|
16
|
-
onOpen: PropTypes.func.description('callback for when menu changes from close to open'),
|
|
17
|
-
|
|
18
|
-
/** callback for when menu changes from open to close */
|
|
19
|
-
onClose: PropTypes.func.description('callback for when menu changes from open to close'),
|
|
20
|
-
|
|
21
|
-
/** Time in ms to delay close of menu */
|
|
22
|
-
delayClose: PropTypes.number.description('Time in ms to delay close of menu'),
|
|
23
|
-
|
|
24
|
-
/** Time in ms to delay open of menu */
|
|
25
|
-
delayOpen: PropTypes.number.description('Time in ms to delay open of menu'),
|
|
26
|
-
|
|
27
|
-
/** callback for when menu changes placement */
|
|
28
|
-
onPlacementChange: PropTypes.func.description('callback for when menu changes placement'),
|
|
29
|
-
|
|
30
|
-
/** Arrow size */
|
|
31
|
-
arrowSize: PropTypes.number.description('Arrow size'),
|
|
32
|
-
|
|
33
|
-
/** Bem blockname for the popper */
|
|
34
|
-
blockName: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).description('Bem blockname for the popper'),
|
|
35
|
-
triggerComponent: PropTypes.element.description("The component that will open/close the tooltip. \n Cannot be used with disabled elements. \n https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled").isRequired
|
|
36
|
-
};
|
|
37
|
-
const defaultProps = {
|
|
38
|
-
containerProps: {},
|
|
39
|
-
arrowGap: 8,
|
|
40
|
-
arrowSize: 6,
|
|
41
|
-
blockName: '',
|
|
42
|
-
contentOffset: null,
|
|
43
|
-
contentStyle: null,
|
|
44
|
-
contentComponent: () => null,
|
|
45
|
-
delayClose: 300,
|
|
46
|
-
delayOpen: 200,
|
|
47
|
-
interactionType: Interaction.CLICK,
|
|
48
|
-
onOpen: () => null,
|
|
49
|
-
onClose: () => null,
|
|
50
|
-
onPlacementChange: () => null,
|
|
51
|
-
placement: Position.BOTTOM,
|
|
52
|
-
preventOverflow: 'window',
|
|
53
|
-
showArrow: true,
|
|
54
|
-
closeAnimationConfig: {
|
|
55
|
-
to: {
|
|
56
|
-
transform: 'scale(0.8)',
|
|
57
|
-
opacity: '0'
|
|
58
|
-
},
|
|
59
|
-
config: {
|
|
60
|
-
delay: 80,
|
|
61
|
-
duration: 80
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
openAnimationConfig: {
|
|
65
|
-
to: {
|
|
66
|
-
transform: 'scale(1)',
|
|
67
|
-
opacity: '1'
|
|
68
|
-
},
|
|
69
|
-
config: {
|
|
70
|
-
delay: 80,
|
|
71
|
-
duration: 80
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
usePortal: true,
|
|
75
|
-
triggerComponent: () => null,
|
|
76
|
-
getTargetFromChildren: () => null,
|
|
77
|
-
getContentFromChildren: () => null,
|
|
78
|
-
modifiers: {},
|
|
79
|
-
triggerRef: () => null,
|
|
80
|
-
hideIfNotVisible: false
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export { defaultProps, popperProps };
|