@elliemae/ds-popper 2.0.0-alpha.11 → 2.0.0-alpha.12
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/cjs/DSPopper.js +70 -65
- package/cjs/PopperContent.js +21 -15
- package/cjs/PopperImpl.js +21 -21
- package/cjs/getArrowStylesBySize.js +7 -1
- package/cjs/index.js +4 -0
- package/esm/DSPopper.js +70 -67
- package/esm/PopperContent.js +21 -15
- package/esm/PopperImpl.js +15 -14
- package/esm/getArrowStylesBySize.js +7 -1
- package/esm/index.js +3 -2
- package/package.json +4 -3
- package/types/DSPopper.d.ts +102 -13
- package/types/index.d.ts +1 -0
- package/types/props.d.ts +62 -11
package/cjs/DSPopper.js
CHANGED
|
@@ -14,71 +14,74 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
14
14
|
|
|
15
15
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
16
16
|
|
|
17
|
-
const DSPopper =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
17
|
+
const DSPopper = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
containerProps,
|
|
20
|
+
arrowGap,
|
|
21
|
+
arrowSize,
|
|
22
|
+
blockName,
|
|
23
|
+
contentOffset,
|
|
24
|
+
contentStyle,
|
|
25
|
+
contentComponent,
|
|
26
|
+
delayClose,
|
|
27
|
+
delayOpen,
|
|
28
|
+
interactionType,
|
|
29
|
+
isOpen,
|
|
30
|
+
// if this is set DSPopper would be a controlled component if not, an uncontrolled one
|
|
31
|
+
onOpen,
|
|
32
|
+
onClose,
|
|
33
|
+
onPlacementChange,
|
|
34
|
+
placement,
|
|
35
|
+
preventOverflow,
|
|
36
|
+
showArrow,
|
|
37
|
+
closeAnimationConfig,
|
|
38
|
+
openAnimationConfig,
|
|
39
|
+
usePortal,
|
|
40
|
+
triggerComponent,
|
|
41
|
+
wrapExtraComponent,
|
|
42
|
+
getTargetFromChildren,
|
|
43
|
+
getContentFromChildren,
|
|
44
|
+
modifiers,
|
|
45
|
+
triggerRef,
|
|
46
|
+
children: customPopper,
|
|
47
|
+
renderReference,
|
|
48
|
+
referenceNode,
|
|
49
|
+
zIndex,
|
|
50
|
+
hideIfNotVisible
|
|
51
|
+
} = _ref;
|
|
52
|
+
return /*#__PURE__*/_jsx__default["default"](PopperImpl["default"], {
|
|
53
|
+
arrowGap: arrowGap,
|
|
54
|
+
arrowSize: arrowSize,
|
|
55
|
+
blockName: blockName,
|
|
56
|
+
closeAnimationConfig: closeAnimationConfig,
|
|
57
|
+
containerProps: containerProps,
|
|
58
|
+
contentComponent: contentComponent,
|
|
59
|
+
contentOffset: contentOffset,
|
|
60
|
+
contentStyle: contentStyle,
|
|
61
|
+
delayClose: delayClose,
|
|
62
|
+
delayOpen: delayOpen,
|
|
63
|
+
getContentFromChildren: getContentFromChildren,
|
|
64
|
+
getTargetFromChildren: getTargetFromChildren,
|
|
65
|
+
interactionType: interactionType,
|
|
66
|
+
isOpen: isOpen,
|
|
67
|
+
modifiers: modifiers,
|
|
68
|
+
onOpen: onOpen,
|
|
69
|
+
onClose: onClose,
|
|
70
|
+
onPlacementChange: onPlacementChange,
|
|
71
|
+
openAnimationConfig: openAnimationConfig,
|
|
72
|
+
placement: placement,
|
|
73
|
+
preventOverflow: preventOverflow,
|
|
74
|
+
referenceNode: referenceNode,
|
|
75
|
+
renderReference: renderReference,
|
|
76
|
+
showArrow: showArrow,
|
|
77
|
+
triggerComponent: triggerComponent,
|
|
78
|
+
triggerRef: triggerRef,
|
|
79
|
+
usePortal: usePortal,
|
|
80
|
+
wrapExtraComponent: wrapExtraComponent,
|
|
81
|
+
zIndex: zIndex,
|
|
82
|
+
hideIfNotVisible: hideIfNotVisible
|
|
83
|
+
}, void 0, customPopper);
|
|
84
|
+
}; // @deprecated: There's the NEW (not finished) popover that uses its own popper implementation.
|
|
82
85
|
|
|
83
86
|
|
|
84
87
|
DSPopper.defaultProps = props.defaultProps;
|
|
@@ -86,7 +89,9 @@ const DSPopperWithSchema = reactDesc.describe(DSPopper);
|
|
|
86
89
|
DSPopperWithSchema.propTypes = props.popperProps;
|
|
87
90
|
|
|
88
91
|
exports.PopperPositions = positions.Position;
|
|
92
|
+
exports.positions = positions.positions;
|
|
89
93
|
exports.PopperInteractions = interaction.Interaction;
|
|
94
|
+
exports.interactions = interaction.interactions;
|
|
90
95
|
exports.DSPopper = DSPopper;
|
|
91
96
|
exports.DSPopperWithSchema = DSPopperWithSchema;
|
|
92
97
|
exports["default"] = DSPopper;
|
package/cjs/PopperContent.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
4
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
3
8
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
9
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
10
|
var react = require('react');
|
|
@@ -44,10 +49,11 @@ class PopperContent extends react.PureComponent {
|
|
|
44
49
|
}
|
|
45
50
|
}
|
|
46
51
|
|
|
47
|
-
renderArrow({
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
renderArrow(_ref, placement) {
|
|
53
|
+
let {
|
|
54
|
+
ref,
|
|
55
|
+
style
|
|
56
|
+
} = _ref;
|
|
51
57
|
const {
|
|
52
58
|
blockName,
|
|
53
59
|
showArrow
|
|
@@ -70,14 +76,15 @@ class PopperContent extends react.PureComponent {
|
|
|
70
76
|
}, "popper-arrow");
|
|
71
77
|
}
|
|
72
78
|
|
|
73
|
-
renderContent({
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
renderContent(_ref2) {
|
|
80
|
+
let {
|
|
81
|
+
ref,
|
|
82
|
+
style,
|
|
83
|
+
placement,
|
|
84
|
+
arrowProps,
|
|
85
|
+
scheduleUpdate,
|
|
86
|
+
outOfBoundaries
|
|
87
|
+
} = _ref2;
|
|
81
88
|
const {
|
|
82
89
|
contentComponent,
|
|
83
90
|
contentStyle,
|
|
@@ -142,9 +149,8 @@ class PopperContent extends react.PureComponent {
|
|
|
142
149
|
}
|
|
143
150
|
|
|
144
151
|
}
|
|
145
|
-
|
|
146
|
-
_defineProperty__default["default"](PopperContent, "defaultProps", {
|
|
152
|
+
PopperContent.defaultProps = {
|
|
147
153
|
onContentDestroyed: () => null
|
|
148
|
-
}
|
|
154
|
+
};
|
|
149
155
|
|
|
150
156
|
module.exports = PopperContent;
|
package/cjs/PopperImpl.js
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
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');
|
|
5
10
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
11
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
12
|
var react = require('react');
|
|
8
|
-
var
|
|
9
|
-
var reactTypesUtility = require('@elliemae/ds-utilities/reactTypesUtility');
|
|
10
|
-
var utils = require('@elliemae/ds-utilities/utils');
|
|
11
|
-
var system = require('@elliemae/ds-utilities/system');
|
|
13
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
12
14
|
var reactPopper = require('react-popper');
|
|
13
15
|
var memoizeOne = require('memoize-one');
|
|
14
16
|
var PopperContent = require('./PopperContent.js');
|
|
@@ -19,7 +21,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
19
21
|
|
|
20
22
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
21
23
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
22
|
-
var getComponentFromProps__default = /*#__PURE__*/_interopDefaultLegacy(getComponentFromProps);
|
|
23
24
|
var memoizeOne__default = /*#__PURE__*/_interopDefaultLegacy(memoizeOne);
|
|
24
25
|
|
|
25
26
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -29,16 +30,13 @@ class PopperImpl extends react.Component {
|
|
|
29
30
|
// we use safeIsMounted because isMounted is not allowed by React.
|
|
30
31
|
constructor(props) {
|
|
31
32
|
super(props);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
_defineProperty__default["default"](this, "handlePopperPlacementChange", memoizeOne__default["default"](placement => {
|
|
33
|
+
this.safeIsMounted = false;
|
|
34
|
+
this.handlePopperPlacementChange = memoizeOne__default["default"](placement => {
|
|
36
35
|
const {
|
|
37
36
|
onPlacementChange
|
|
38
37
|
} = this.props;
|
|
39
38
|
onPlacementChange(placement);
|
|
40
|
-
})
|
|
41
|
-
|
|
39
|
+
});
|
|
42
40
|
this.state = {
|
|
43
41
|
isOpen: false,
|
|
44
42
|
destroyed: true
|
|
@@ -96,7 +94,8 @@ class PopperImpl extends react.Component {
|
|
|
96
94
|
return null;
|
|
97
95
|
}
|
|
98
96
|
|
|
99
|
-
getInteractionObject(interaction$1
|
|
97
|
+
getInteractionObject(interaction$1) {
|
|
98
|
+
let referenceProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
100
99
|
const {
|
|
101
100
|
isOpen
|
|
102
101
|
} = this.props;
|
|
@@ -169,9 +168,9 @@ class PopperImpl extends react.Component {
|
|
|
169
168
|
} = this.props;
|
|
170
169
|
const {
|
|
171
170
|
onClick
|
|
172
|
-
} =
|
|
171
|
+
} = dsUtilities.get(triggerComponent, 'props') || {};
|
|
173
172
|
this.open();
|
|
174
|
-
if (
|
|
173
|
+
if (dsUtilities.isFunction(onClick)) onClick(e);
|
|
175
174
|
}
|
|
176
175
|
|
|
177
176
|
handleContentMouseEnter() {
|
|
@@ -216,9 +215,10 @@ class PopperImpl extends react.Component {
|
|
|
216
215
|
});
|
|
217
216
|
}
|
|
218
217
|
|
|
219
|
-
renderTarget({
|
|
220
|
-
|
|
221
|
-
|
|
218
|
+
renderTarget(_ref) {
|
|
219
|
+
let {
|
|
220
|
+
ref
|
|
221
|
+
} = _ref;
|
|
222
222
|
const {
|
|
223
223
|
isOpen
|
|
224
224
|
} = this.state;
|
|
@@ -227,11 +227,11 @@ class PopperImpl extends react.Component {
|
|
|
227
227
|
interactionType,
|
|
228
228
|
renderReference
|
|
229
229
|
} = this.props;
|
|
230
|
-
const componentInnerRef =
|
|
231
|
-
const compRef =
|
|
230
|
+
const componentInnerRef = dsUtilities.get(triggerComponent, ['props', 'innerRef'], () => null);
|
|
231
|
+
const compRef = dsUtilities.isDOMTypeElement(triggerComponent) ? {
|
|
232
232
|
ref
|
|
233
233
|
} : {
|
|
234
|
-
innerRef:
|
|
234
|
+
innerRef: dsUtilities.mergeRefs(ref, componentInnerRef)
|
|
235
235
|
};
|
|
236
236
|
const triggerHandler = this.getInteractionObject(interactionType, triggerComponent.props).handlers;
|
|
237
237
|
|
|
@@ -246,7 +246,7 @@ class PopperImpl extends react.Component {
|
|
|
246
246
|
}, targetProps));
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
return
|
|
249
|
+
return dsUtilities.getComponentFromProps(triggerComponent, targetProps);
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
render() {
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
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');
|
|
5
10
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
11
|
|
|
7
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -12,7 +17,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
12
17
|
|
|
13
18
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
14
19
|
|
|
15
|
-
const getArrowStylesBySize = (position
|
|
20
|
+
const getArrowStylesBySize = function (position) {
|
|
21
|
+
let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 30;
|
|
16
22
|
const basePosition = position && position.split('-')[0];
|
|
17
23
|
return _objectSpread({
|
|
18
24
|
borderWidth: size
|
package/cjs/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var DSPopper = require('./DSPopper.js');
|
|
6
|
+
var getArrowStylesBySize = require('./getArrowStylesBySize.js');
|
|
6
7
|
var interaction = require('./interaction.js');
|
|
7
8
|
var positions = require('./positions.js');
|
|
8
9
|
|
|
@@ -11,5 +12,8 @@ var positions = require('./positions.js');
|
|
|
11
12
|
exports.DSPopper = DSPopper.DSPopper;
|
|
12
13
|
exports.DSPopperWithSchema = DSPopper.DSPopperWithSchema;
|
|
13
14
|
exports["default"] = DSPopper.DSPopper;
|
|
15
|
+
exports.getArrowStylesBySize = getArrowStylesBySize.getArrowStylesBySize;
|
|
14
16
|
exports.PopperInteractions = interaction.Interaction;
|
|
17
|
+
exports.interactions = interaction.interactions;
|
|
15
18
|
exports.PopperPositions = positions.Position;
|
|
19
|
+
exports.positions = positions.positions;
|
package/esm/DSPopper.js
CHANGED
|
@@ -2,75 +2,78 @@ import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
|
2
2
|
import 'react';
|
|
3
3
|
import { describe } from 'react-desc';
|
|
4
4
|
import PopperImpl from './PopperImpl.js';
|
|
5
|
-
export { Position as PopperPositions } from './positions.js';
|
|
6
|
-
export { Interaction as PopperInteractions } from './interaction.js';
|
|
5
|
+
export { Position as PopperPositions, positions } from './positions.js';
|
|
6
|
+
export { Interaction as PopperInteractions, interactions } from './interaction.js';
|
|
7
7
|
import { popperProps, defaultProps } from './props.js';
|
|
8
8
|
|
|
9
|
-
const DSPopper =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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.
|
|
74
77
|
|
|
75
78
|
|
|
76
79
|
DSPopper.defaultProps = defaultProps;
|
package/esm/PopperContent.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
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';
|
|
1
6
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
7
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
8
|
import { PureComponent } from 'react';
|
|
@@ -35,10 +40,11 @@ class PopperContent extends PureComponent {
|
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
|
|
38
|
-
renderArrow({
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
renderArrow(_ref, placement) {
|
|
44
|
+
let {
|
|
45
|
+
ref,
|
|
46
|
+
style
|
|
47
|
+
} = _ref;
|
|
42
48
|
const {
|
|
43
49
|
blockName,
|
|
44
50
|
showArrow
|
|
@@ -61,14 +67,15 @@ class PopperContent extends PureComponent {
|
|
|
61
67
|
}, "popper-arrow");
|
|
62
68
|
}
|
|
63
69
|
|
|
64
|
-
renderContent({
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
renderContent(_ref2) {
|
|
71
|
+
let {
|
|
72
|
+
ref,
|
|
73
|
+
style,
|
|
74
|
+
placement,
|
|
75
|
+
arrowProps,
|
|
76
|
+
scheduleUpdate,
|
|
77
|
+
outOfBoundaries
|
|
78
|
+
} = _ref2;
|
|
72
79
|
const {
|
|
73
80
|
contentComponent,
|
|
74
81
|
contentStyle,
|
|
@@ -133,9 +140,8 @@ class PopperContent extends PureComponent {
|
|
|
133
140
|
}
|
|
134
141
|
|
|
135
142
|
}
|
|
136
|
-
|
|
137
|
-
_defineProperty(PopperContent, "defaultProps", {
|
|
143
|
+
PopperContent.defaultProps = {
|
|
138
144
|
onContentDestroyed: () => null
|
|
139
|
-
}
|
|
145
|
+
};
|
|
140
146
|
|
|
141
147
|
export { PopperContent as default };
|
package/esm/PopperImpl.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
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';
|
|
1
6
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
7
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
8
|
import { Component } from 'react';
|
|
4
|
-
import getComponentFromProps from '@elliemae/ds-utilities
|
|
5
|
-
import { isDOMTypeElement } from '@elliemae/ds-utilities/reactTypesUtility';
|
|
6
|
-
import { get, isFunction } from '@elliemae/ds-utilities/utils';
|
|
7
|
-
import { mergeRefs } from '@elliemae/ds-utilities/system';
|
|
9
|
+
import { get, isFunction, isDOMTypeElement, mergeRefs, getComponentFromProps } from '@elliemae/ds-utilities';
|
|
8
10
|
import { Manager, Reference } from 'react-popper';
|
|
9
11
|
export { Reference } from 'react-popper';
|
|
10
12
|
import memoizeOne from 'memoize-one';
|
|
@@ -20,16 +22,13 @@ class PopperImpl extends Component {
|
|
|
20
22
|
// we use safeIsMounted because isMounted is not allowed by React.
|
|
21
23
|
constructor(props) {
|
|
22
24
|
super(props);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
_defineProperty(this, "handlePopperPlacementChange", memoizeOne(placement => {
|
|
25
|
+
this.safeIsMounted = false;
|
|
26
|
+
this.handlePopperPlacementChange = memoizeOne(placement => {
|
|
27
27
|
const {
|
|
28
28
|
onPlacementChange
|
|
29
29
|
} = this.props;
|
|
30
30
|
onPlacementChange(placement);
|
|
31
|
-
})
|
|
32
|
-
|
|
31
|
+
});
|
|
33
32
|
this.state = {
|
|
34
33
|
isOpen: false,
|
|
35
34
|
destroyed: true
|
|
@@ -87,7 +86,8 @@ class PopperImpl extends Component {
|
|
|
87
86
|
return null;
|
|
88
87
|
}
|
|
89
88
|
|
|
90
|
-
getInteractionObject(interaction
|
|
89
|
+
getInteractionObject(interaction) {
|
|
90
|
+
let referenceProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
91
91
|
const {
|
|
92
92
|
isOpen
|
|
93
93
|
} = this.props;
|
|
@@ -207,9 +207,10 @@ class PopperImpl extends Component {
|
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
renderTarget({
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
renderTarget(_ref) {
|
|
211
|
+
let {
|
|
212
|
+
ref
|
|
213
|
+
} = _ref;
|
|
213
214
|
const {
|
|
214
215
|
isOpen
|
|
215
216
|
} = this.state;
|
|
@@ -1,10 +1,16 @@
|
|
|
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';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
|
|
3
8
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
4
9
|
|
|
5
10
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6
11
|
|
|
7
|
-
const getArrowStylesBySize = (position
|
|
12
|
+
const getArrowStylesBySize = function (position) {
|
|
13
|
+
let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 30;
|
|
8
14
|
const basePosition = position && position.split('-')[0];
|
|
9
15
|
return _objectSpread({
|
|
10
16
|
borderWidth: size
|
package/esm/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { DSPopper, DSPopperWithSchema, DSPopper as default } from './DSPopper.js';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-popper",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Popper",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -60,10 +60,11 @@
|
|
|
60
60
|
"build": "node ../../scripts/build/build.js"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@elliemae/ds-overlay": "2.0.0-alpha.
|
|
64
|
-
"@elliemae/ds-utilities": "2.0.0-alpha.
|
|
63
|
+
"@elliemae/ds-overlay": "2.0.0-alpha.12",
|
|
64
|
+
"@elliemae/ds-utilities": "2.0.0-alpha.12",
|
|
65
65
|
"memoize-one": "~5.1.1",
|
|
66
66
|
"prop-types": "~15.7.2",
|
|
67
|
+
"react-desc": "~4.1.3",
|
|
67
68
|
"react-popper": "~1.3.11",
|
|
68
69
|
"react-spring": "~8.0.27"
|
|
69
70
|
},
|
package/types/DSPopper.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
1
2
|
/// <reference types="react" />
|
|
2
3
|
import { Position } from './positions';
|
|
3
4
|
import { Interaction } from './interaction';
|
|
@@ -36,17 +37,67 @@ declare const DSPopper: {
|
|
|
36
37
|
hideIfNotVisible: any;
|
|
37
38
|
}): JSX.Element;
|
|
38
39
|
propTypes: {
|
|
39
|
-
hideIfNotVisible:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
hideIfNotVisible: {
|
|
41
|
+
defaultValue<T = unknown>(arg: T): {
|
|
42
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
43
|
+
};
|
|
44
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
45
|
+
};
|
|
46
|
+
containerProps: {
|
|
47
|
+
defaultValue<T = unknown>(arg: T): {
|
|
48
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
49
|
+
};
|
|
50
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
51
|
+
};
|
|
52
|
+
arrowGap: {
|
|
53
|
+
defaultValue<T = unknown>(arg: T): {
|
|
54
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
55
|
+
};
|
|
56
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
57
|
+
};
|
|
58
|
+
onOpen: {
|
|
59
|
+
defaultValue<T = unknown>(arg: T): {
|
|
60
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
61
|
+
};
|
|
62
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
63
|
+
};
|
|
64
|
+
onClose: {
|
|
65
|
+
defaultValue<T = unknown>(arg: T): {
|
|
66
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
67
|
+
};
|
|
68
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
69
|
+
};
|
|
70
|
+
delayClose: {
|
|
71
|
+
defaultValue<T = unknown>(arg: T): {
|
|
72
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
73
|
+
};
|
|
74
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
75
|
+
};
|
|
76
|
+
delayOpen: {
|
|
77
|
+
defaultValue<T = unknown>(arg: T): {
|
|
78
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
79
|
+
};
|
|
80
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
81
|
+
};
|
|
82
|
+
onPlacementChange: {
|
|
83
|
+
defaultValue<T = unknown>(arg: T): {
|
|
84
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
85
|
+
};
|
|
86
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
87
|
+
};
|
|
88
|
+
arrowSize: {
|
|
89
|
+
defaultValue<T = unknown>(arg: T): {
|
|
90
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
91
|
+
};
|
|
92
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
93
|
+
};
|
|
94
|
+
blockName: {
|
|
95
|
+
defaultValue<T = unknown>(arg: T): {
|
|
96
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
97
|
+
};
|
|
98
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
99
|
+
};
|
|
100
|
+
triggerComponent: import("react-desc").PropTypesDescValidator;
|
|
50
101
|
};
|
|
51
102
|
defaultProps: {
|
|
52
103
|
containerProps: {};
|
|
@@ -94,6 +145,44 @@ declare const DSPopper: {
|
|
|
94
145
|
hideIfNotVisible: boolean;
|
|
95
146
|
};
|
|
96
147
|
};
|
|
97
|
-
declare const DSPopperWithSchema:
|
|
98
|
-
|
|
148
|
+
declare const DSPopperWithSchema: {
|
|
149
|
+
(props?: {
|
|
150
|
+
containerProps: any;
|
|
151
|
+
arrowGap: any;
|
|
152
|
+
arrowSize: any;
|
|
153
|
+
blockName: any;
|
|
154
|
+
contentOffset: any;
|
|
155
|
+
contentStyle: any;
|
|
156
|
+
contentComponent: any;
|
|
157
|
+
delayClose: any;
|
|
158
|
+
delayOpen: any;
|
|
159
|
+
interactionType: any;
|
|
160
|
+
isOpen: any;
|
|
161
|
+
onOpen: any;
|
|
162
|
+
onClose: any;
|
|
163
|
+
onPlacementChange: any;
|
|
164
|
+
placement: any;
|
|
165
|
+
preventOverflow: any;
|
|
166
|
+
showArrow: any;
|
|
167
|
+
closeAnimationConfig: any;
|
|
168
|
+
openAnimationConfig: any;
|
|
169
|
+
usePortal: any;
|
|
170
|
+
triggerComponent: any;
|
|
171
|
+
wrapExtraComponent: any;
|
|
172
|
+
getTargetFromChildren: any;
|
|
173
|
+
getContentFromChildren: any;
|
|
174
|
+
modifiers: any;
|
|
175
|
+
triggerRef: any;
|
|
176
|
+
children: any;
|
|
177
|
+
renderReference: any;
|
|
178
|
+
referenceNode: any;
|
|
179
|
+
zIndex: any;
|
|
180
|
+
hideIfNotVisible: any;
|
|
181
|
+
} | undefined): JSX.Element;
|
|
182
|
+
propTypes: unknown;
|
|
183
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
184
|
+
};
|
|
185
|
+
export { Interaction as PopperInteractions, Position as PopperPositions, DSPopperWithSchema, DSPopper };
|
|
186
|
+
export { interactions } from './interaction';
|
|
187
|
+
export { positions } from './positions';
|
|
99
188
|
export default DSPopper;
|
package/types/index.d.ts
CHANGED
package/types/props.d.ts
CHANGED
|
@@ -1,25 +1,76 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
1
2
|
export declare const popperProps: {
|
|
2
3
|
/** Hide menu component if trigger component is not visible/scrolled away */
|
|
3
|
-
hideIfNotVisible:
|
|
4
|
+
hideIfNotVisible: {
|
|
5
|
+
defaultValue<T = unknown>(arg: T): {
|
|
6
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
7
|
+
};
|
|
8
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
9
|
+
};
|
|
4
10
|
/** props to inject to popper wrapper */
|
|
5
|
-
containerProps:
|
|
11
|
+
containerProps: {
|
|
12
|
+
defaultValue<T = unknown>(arg: T): {
|
|
13
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
14
|
+
};
|
|
15
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
16
|
+
};
|
|
6
17
|
/** Space between the arrow and the popup */
|
|
7
|
-
arrowGap:
|
|
18
|
+
arrowGap: {
|
|
19
|
+
defaultValue<T = unknown>(arg: T): {
|
|
20
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
21
|
+
};
|
|
22
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
23
|
+
};
|
|
8
24
|
/** callback for when menu changes from close to open */
|
|
9
|
-
onOpen:
|
|
25
|
+
onOpen: {
|
|
26
|
+
defaultValue<T = unknown>(arg: T): {
|
|
27
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
28
|
+
};
|
|
29
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
30
|
+
};
|
|
10
31
|
/** callback for when menu changes from open to close */
|
|
11
|
-
onClose:
|
|
32
|
+
onClose: {
|
|
33
|
+
defaultValue<T = unknown>(arg: T): {
|
|
34
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
35
|
+
};
|
|
36
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
37
|
+
};
|
|
12
38
|
/** Time in ms to delay close of menu */
|
|
13
|
-
delayClose:
|
|
39
|
+
delayClose: {
|
|
40
|
+
defaultValue<T = unknown>(arg: T): {
|
|
41
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
42
|
+
};
|
|
43
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
44
|
+
};
|
|
14
45
|
/** Time in ms to delay open of menu */
|
|
15
|
-
delayOpen:
|
|
46
|
+
delayOpen: {
|
|
47
|
+
defaultValue<T = unknown>(arg: T): {
|
|
48
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
49
|
+
};
|
|
50
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
51
|
+
};
|
|
16
52
|
/** callback for when menu changes placement */
|
|
17
|
-
onPlacementChange:
|
|
53
|
+
onPlacementChange: {
|
|
54
|
+
defaultValue<T = unknown>(arg: T): {
|
|
55
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
56
|
+
};
|
|
57
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
58
|
+
};
|
|
18
59
|
/** Arrow size */
|
|
19
|
-
arrowSize:
|
|
60
|
+
arrowSize: {
|
|
61
|
+
defaultValue<T = unknown>(arg: T): {
|
|
62
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
63
|
+
};
|
|
64
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
65
|
+
};
|
|
20
66
|
/** Bem blockname for the popper */
|
|
21
|
-
blockName:
|
|
22
|
-
|
|
67
|
+
blockName: {
|
|
68
|
+
defaultValue<T = unknown>(arg: T): {
|
|
69
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
70
|
+
};
|
|
71
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
72
|
+
};
|
|
73
|
+
triggerComponent: import("react-desc").PropTypesDescValidator;
|
|
23
74
|
};
|
|
24
75
|
export declare const defaultProps: {
|
|
25
76
|
containerProps: {};
|