@instructure/ui-popover 8.12.1-snapshot.51 → 8.12.1-snapshot.52
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/es/Popover/index.js +72 -73
- package/es/Popover/props.js +1 -176
- package/lib/Popover/index.js +72 -73
- package/lib/Popover/props.js +1 -176
- package/package.json +20 -20
- package/src/Popover/index.tsx +102 -170
- package/src/Popover/props.ts +168 -138
- package/types/Popover/index.d.ts +72 -87
- package/types/Popover/index.d.ts.map +1 -1
- package/types/Popover/props.d.ts +166 -20
- package/types/Popover/props.d.ts.map +1 -1
package/es/Popover/index.js
CHANGED
|
@@ -42,6 +42,7 @@ import { allowedProps, propTypes } from './props';
|
|
|
42
42
|
category: components
|
|
43
43
|
tags: overlay, portal, dialog
|
|
44
44
|
---
|
|
45
|
+
@tsProps
|
|
45
46
|
**/
|
|
46
47
|
|
|
47
48
|
let Popover = (_dec = textDirectionContextConsumer(), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class Popover extends Component {
|
|
@@ -52,7 +53,14 @@ let Popover = (_dec = textDirectionContextConsumer(), _dec2 = testable(), _dec(_
|
|
|
52
53
|
_this = this;
|
|
53
54
|
this._handleMouseOver = void 0;
|
|
54
55
|
this._handleMouseOut = void 0;
|
|
56
|
+
this._id = void 0;
|
|
55
57
|
this._raf = [];
|
|
58
|
+
this._trigger = void 0;
|
|
59
|
+
this._view = null;
|
|
60
|
+
this._dialog = null;
|
|
61
|
+
this._contentElement = null;
|
|
62
|
+
this._focusRegion = void 0;
|
|
63
|
+
this.mouseOutTimeout = void 0;
|
|
56
64
|
this.ref = null;
|
|
57
65
|
|
|
58
66
|
this.handleRef = el => {
|
|
@@ -65,20 +73,22 @@ let Popover = (_dec = textDirectionContextConsumer(), _dec2 = testable(), _dec(_
|
|
|
65
73
|
};
|
|
66
74
|
|
|
67
75
|
this.show = event => {
|
|
76
|
+
var _this$props$onShowCon, _this$props;
|
|
77
|
+
|
|
68
78
|
if (typeof this.props.isShowingContent === 'undefined') {
|
|
69
79
|
this.setState({
|
|
70
80
|
isShowingContent: true
|
|
71
81
|
});
|
|
72
82
|
}
|
|
73
83
|
|
|
74
|
-
this.props.onShowContent(event);
|
|
84
|
+
(_this$props$onShowCon = (_this$props = this.props).onShowContent) === null || _this$props$onShowCon === void 0 ? void 0 : _this$props$onShowCon.call(_this$props, event);
|
|
75
85
|
};
|
|
76
86
|
|
|
77
87
|
this.hide = function (event) {
|
|
78
88
|
let documentClick = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
79
|
-
const _this$
|
|
80
|
-
onHideContent = _this$
|
|
81
|
-
isShowingContent = _this$
|
|
89
|
+
const _this$props2 = _this.props,
|
|
90
|
+
onHideContent = _this$props2.onHideContent,
|
|
91
|
+
isShowingContent = _this$props2.isShowingContent;
|
|
82
92
|
|
|
83
93
|
if (typeof isShowingContent === 'undefined') {
|
|
84
94
|
// uncontrolled, set state, fire callbacks
|
|
@@ -86,7 +96,7 @@ let Popover = (_dec = textDirectionContextConsumer(), _dec2 = testable(), _dec(_
|
|
|
86
96
|
let isShowingContent = _ref.isShowingContent;
|
|
87
97
|
|
|
88
98
|
if (isShowingContent) {
|
|
89
|
-
onHideContent(event, {
|
|
99
|
+
onHideContent === null || onHideContent === void 0 ? void 0 : onHideContent(event, {
|
|
90
100
|
documentClick
|
|
91
101
|
});
|
|
92
102
|
}
|
|
@@ -97,7 +107,7 @@ let Popover = (_dec = textDirectionContextConsumer(), _dec2 = testable(), _dec(_
|
|
|
97
107
|
});
|
|
98
108
|
} else if (isShowingContent) {
|
|
99
109
|
// controlled, fire callback
|
|
100
|
-
onHideContent(event, {
|
|
110
|
+
onHideContent === null || onHideContent === void 0 ? void 0 : onHideContent(event, {
|
|
101
111
|
documentClick
|
|
102
112
|
});
|
|
103
113
|
}
|
|
@@ -111,16 +121,17 @@ let Popover = (_dec = textDirectionContextConsumer(), _dec2 = testable(), _dec(_
|
|
|
111
121
|
}
|
|
112
122
|
};
|
|
113
123
|
|
|
114
|
-
this.handleDialogDismiss =
|
|
115
|
-
if (!
|
|
116
|
-
const trigger = findDOMNode(
|
|
124
|
+
this.handleDialogDismiss = (event, documentClick) => {
|
|
125
|
+
if (!this.props.shouldReturnFocus && this.props.shouldFocusContentOnTriggerBlur) {
|
|
126
|
+
const trigger = findDOMNode(this._trigger);
|
|
117
127
|
|
|
118
128
|
if (trigger && typeof trigger.focus === 'function') {
|
|
129
|
+
;
|
|
119
130
|
trigger.focus();
|
|
120
131
|
}
|
|
121
132
|
}
|
|
122
133
|
|
|
123
|
-
|
|
134
|
+
this.hide(event, documentClick);
|
|
124
135
|
};
|
|
125
136
|
|
|
126
137
|
this.handleDialogBlur = event => {
|
|
@@ -155,7 +166,9 @@ let Popover = (_dec = textDirectionContextConsumer(), _dec2 = testable(), _dec(_
|
|
|
155
166
|
};
|
|
156
167
|
|
|
157
168
|
this.handleTriggerBlur = event => {
|
|
158
|
-
|
|
169
|
+
const on = this.props.on;
|
|
170
|
+
|
|
171
|
+
if (on && on.indexOf('focus') > -1) {
|
|
159
172
|
this._raf.push(requestAnimationFrame(() => {
|
|
160
173
|
if (!containsActiveElement(this._view)) {
|
|
161
174
|
this.hide(event);
|
|
@@ -165,33 +178,33 @@ let Popover = (_dec = textDirectionContextConsumer(), _dec2 = testable(), _dec(_
|
|
|
165
178
|
};
|
|
166
179
|
|
|
167
180
|
this.handlePositioned = position => {
|
|
181
|
+
var _this$props$onPositio, _this$props3;
|
|
182
|
+
|
|
168
183
|
const placement = position.placement;
|
|
169
184
|
this.setState({
|
|
170
185
|
placement,
|
|
171
186
|
...this.computeOffsets(placement)
|
|
172
187
|
});
|
|
173
|
-
this.props.onPositioned(position);
|
|
188
|
+
(_this$props$onPositio = (_this$props3 = this.props).onPositioned) === null || _this$props$onPositio === void 0 ? void 0 : _this$props$onPositio.call(_this$props3, position);
|
|
174
189
|
};
|
|
175
190
|
|
|
176
191
|
this.handlePositionChanged = position => {
|
|
192
|
+
var _this$props$onPositio2, _this$props4;
|
|
193
|
+
|
|
177
194
|
const placement = position.placement;
|
|
178
195
|
this.setState({
|
|
179
196
|
placement,
|
|
180
197
|
...this.computeOffsets(placement)
|
|
181
198
|
});
|
|
182
|
-
this.props.onPositionChanged(position);
|
|
199
|
+
(_this$props$onPositio2 = (_this$props4 = this.props).onPositionChanged) === null || _this$props$onPositio2 === void 0 ? void 0 : _this$props$onPositio2.call(_this$props4, position);
|
|
183
200
|
};
|
|
184
201
|
|
|
185
202
|
this.state = {
|
|
186
203
|
placement: props.placement,
|
|
187
204
|
offsetX: props.offsetX,
|
|
188
|
-
offsetY: props.offsetY
|
|
205
|
+
offsetY: props.offsetY,
|
|
206
|
+
isShowingContent: typeof props.isShowingContent === 'undefined' ? props.defaultIsShowingContent : void 0
|
|
189
207
|
};
|
|
190
|
-
|
|
191
|
-
if (typeof props.isShowingContent === 'undefined') {
|
|
192
|
-
this.state.isShowingContent = props.defaultIsShowingContent;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
208
|
this._id = this.props.id || uid('Popover');
|
|
196
209
|
this._raf = [];
|
|
197
210
|
this._handleMouseOver = handleMouseOverOut.bind(null, event => {
|
|
@@ -204,7 +217,6 @@ let Popover = (_dec = textDirectionContextConsumer(), _dec2 = testable(), _dec(_
|
|
|
204
217
|
this.hide(event);
|
|
205
218
|
}, 1);
|
|
206
219
|
});
|
|
207
|
-
this.mouseOutTimeout = void 0;
|
|
208
220
|
}
|
|
209
221
|
|
|
210
222
|
get isTooltip() {
|
|
@@ -240,11 +252,11 @@ let Popover = (_dec = textDirectionContextConsumer(), _dec2 = testable(), _dec(_
|
|
|
240
252
|
}
|
|
241
253
|
}
|
|
242
254
|
|
|
243
|
-
shouldComponentUpdate(nextProps, nextState
|
|
255
|
+
shouldComponentUpdate(nextProps, nextState) {
|
|
244
256
|
return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
|
|
245
257
|
}
|
|
246
258
|
|
|
247
|
-
componentDidUpdate(prevProps, prevState
|
|
259
|
+
componentDidUpdate(prevProps, prevState) {
|
|
248
260
|
if (this._focusRegion && this.isTooltip) {
|
|
249
261
|
// if focus region exists, popover is acting as a tooltip
|
|
250
262
|
// so we manually activate and deactivate the region when showing/hiding
|
|
@@ -271,19 +283,19 @@ let Popover = (_dec = textDirectionContextConsumer(), _dec2 = testable(), _dec(_
|
|
|
271
283
|
}
|
|
272
284
|
|
|
273
285
|
computeOffsets(placement) {
|
|
274
|
-
let _this$
|
|
275
|
-
offsetX = _this$
|
|
276
|
-
offsetY = _this$
|
|
286
|
+
let _this$props5 = this.props,
|
|
287
|
+
offsetX = _this$props5.offsetX,
|
|
288
|
+
offsetY = _this$props5.offsetY;
|
|
277
289
|
|
|
278
290
|
if (this.props.shouldAlignArrow && this._view) {
|
|
279
291
|
const secondaryPlacement = parsePlacement(placement)[1]; // arrowSize and arrowBorderWidth are component theme variables
|
|
280
292
|
// declared in ContextView's styles.js
|
|
281
293
|
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
arrowSize =
|
|
285
|
-
|
|
286
|
-
arrowBorderWidth =
|
|
294
|
+
const _ref2 = this._view.props.styles,
|
|
295
|
+
_ref2$arrowSize = _ref2.arrowSize,
|
|
296
|
+
arrowSize = _ref2$arrowSize === void 0 ? 0 : _ref2$arrowSize,
|
|
297
|
+
_ref2$arrowBorderWidt = _ref2.arrowBorderWidth,
|
|
298
|
+
arrowBorderWidth = _ref2$arrowBorderWidt === void 0 ? 0 : _ref2$arrowBorderWidt;
|
|
287
299
|
const offsetAmount = (px(arrowSize) + px(arrowBorderWidth)) * 2;
|
|
288
300
|
|
|
289
301
|
if (secondaryPlacement === 'start') {
|
|
@@ -343,28 +355,28 @@ let Popover = (_dec = textDirectionContextConsumer(), _dec2 = testable(), _dec(_
|
|
|
343
355
|
let trigger = callRenderProp(this.props.renderTrigger);
|
|
344
356
|
|
|
345
357
|
if (trigger) {
|
|
346
|
-
const _this$
|
|
347
|
-
on = _this$
|
|
348
|
-
shouldContainFocus = _this$
|
|
349
|
-
let onClick;
|
|
350
|
-
let onFocus;
|
|
351
|
-
let onMouseOut;
|
|
352
|
-
let onMouseOver;
|
|
358
|
+
const _this$props6 = this.props,
|
|
359
|
+
on = _this$props6.on,
|
|
360
|
+
shouldContainFocus = _this$props6.shouldContainFocus;
|
|
361
|
+
let onClick = void 0;
|
|
362
|
+
let onFocus = void 0;
|
|
363
|
+
let onMouseOut = void 0;
|
|
364
|
+
let onMouseOver = void 0;
|
|
353
365
|
let expanded;
|
|
354
366
|
|
|
355
|
-
if (on.indexOf('click') > -1) {
|
|
367
|
+
if (on && on.indexOf('click') > -1) {
|
|
356
368
|
onClick = event => {
|
|
357
369
|
this.toggle(event);
|
|
358
370
|
};
|
|
359
371
|
}
|
|
360
372
|
|
|
361
|
-
if (on.indexOf('hover') > -1) {
|
|
373
|
+
if (on && on.indexOf('hover') > -1) {
|
|
362
374
|
error(!(on === 'hover'), '[Popover] Specifying only the `"hover"` trigger limits the visibility' + ' of the Popover to just mouse users. Consider also including the `"focus"` trigger ' + 'so that touch and keyboard only users can see the Popover content as well.');
|
|
363
375
|
onMouseOver = this._handleMouseOver;
|
|
364
376
|
onMouseOut = this._handleMouseOut;
|
|
365
377
|
}
|
|
366
378
|
|
|
367
|
-
if (on.indexOf('focus') > -1) {
|
|
379
|
+
if (on && on.indexOf('focus') > -1) {
|
|
368
380
|
onFocus = event => {
|
|
369
381
|
this.show(event);
|
|
370
382
|
};
|
|
@@ -374,11 +386,13 @@ let Popover = (_dec = textDirectionContextConsumer(), _dec2 = testable(), _dec(_
|
|
|
374
386
|
// only set aria-expanded if popover can contain focus
|
|
375
387
|
expanded = this.shown ? 'true' : 'false';
|
|
376
388
|
} else {
|
|
377
|
-
expanded =
|
|
389
|
+
expanded = void 0;
|
|
378
390
|
}
|
|
379
391
|
|
|
380
392
|
trigger = safeCloneElement(trigger, {
|
|
381
|
-
ref: el =>
|
|
393
|
+
ref: el => {
|
|
394
|
+
this._trigger = el;
|
|
395
|
+
},
|
|
382
396
|
'aria-expanded': expanded,
|
|
383
397
|
'data-popover-trigger': true,
|
|
384
398
|
onKeyDown: createChainedFunction(this.handleTriggerKeyDown, this.props.onKeyDown),
|
|
@@ -418,30 +432,40 @@ let Popover = (_dec = textDirectionContextConsumer(), _dec2 = testable(), _dec(_
|
|
|
418
432
|
}
|
|
419
433
|
|
|
420
434
|
if (this.shown || this.props.shouldRenderOffscreen) {
|
|
421
|
-
let ViewElement;
|
|
422
435
|
const color = this.props.color;
|
|
423
436
|
let viewProps = {
|
|
437
|
+
// TODO: try to type `ref` better, LegacyRef<T> was not compatible
|
|
424
438
|
ref: c => this._view = c,
|
|
425
439
|
elementRef: el => {
|
|
440
|
+
var _this$props$contentRe, _this$props7;
|
|
441
|
+
|
|
426
442
|
this._contentElement = el;
|
|
427
|
-
this.props.contentRef(el);
|
|
443
|
+
(_this$props$contentRe = (_this$props7 = this.props).contentRef) === null || _this$props$contentRe === void 0 ? void 0 : _this$props$contentRe.call(_this$props7, el);
|
|
428
444
|
},
|
|
429
445
|
background: color,
|
|
430
446
|
stacking: this.props.stacking,
|
|
431
447
|
shadow: this.props.shadow,
|
|
432
448
|
display: 'block'
|
|
433
449
|
};
|
|
450
|
+
|
|
451
|
+
if (this.isTooltip) {
|
|
452
|
+
viewProps = { ...viewProps,
|
|
453
|
+
// Because of a11y reasons popovers should not be hidden when hovered over
|
|
454
|
+
onMouseOver: this._handleMouseOver,
|
|
455
|
+
onMouseOut: this._handleMouseOut
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
|
|
434
459
|
const placement = this.state.placement;
|
|
435
460
|
|
|
436
461
|
if (this.props.withArrow) {
|
|
437
|
-
ViewElement = ContextView;
|
|
438
462
|
viewProps = { ...viewProps,
|
|
439
463
|
// TODO: remove background override after contextview is updated
|
|
440
464
|
background: color === 'primary' ? 'default' : 'inverse',
|
|
441
465
|
placement: this.props.dir === textDirectionContextConsumer.DIRECTION.rtl ? mirrorHorizontalPlacement(placement, ' ') : placement
|
|
442
466
|
};
|
|
467
|
+
return /*#__PURE__*/React.createElement(ContextView, viewProps, content);
|
|
443
468
|
} else {
|
|
444
|
-
ViewElement = View;
|
|
445
469
|
viewProps = { ...viewProps,
|
|
446
470
|
borderWidth: 'small',
|
|
447
471
|
borderRadius: 'medium',
|
|
@@ -449,17 +473,8 @@ let Popover = (_dec = textDirectionContextConsumer(), _dec2 = testable(), _dec(_
|
|
|
449
473
|
borderColor: 'transparent'
|
|
450
474
|
})
|
|
451
475
|
};
|
|
476
|
+
return /*#__PURE__*/React.createElement(View, viewProps, content);
|
|
452
477
|
}
|
|
453
|
-
|
|
454
|
-
if (this.isTooltip) {
|
|
455
|
-
viewProps = { ...viewProps,
|
|
456
|
-
// Because of a11y reasons popovers should not be hidden when hovered over
|
|
457
|
-
onMouseOver: this._handleMouseOver,
|
|
458
|
-
onMouseOut: this._handleMouseOut
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
return /*#__PURE__*/React.createElement(ViewElement, viewProps, content);
|
|
463
478
|
} else {
|
|
464
479
|
return null;
|
|
465
480
|
}
|
|
@@ -489,7 +504,6 @@ let Popover = (_dec = textDirectionContextConsumer(), _dec2 = testable(), _dec(_
|
|
|
489
504
|
offsetY: 0,
|
|
490
505
|
color: 'primary',
|
|
491
506
|
on: ['hover', 'focus'],
|
|
492
|
-
contentRef: el => {},
|
|
493
507
|
withArrow: true,
|
|
494
508
|
constrain: 'window',
|
|
495
509
|
insertAt: 'bottom',
|
|
@@ -500,22 +514,7 @@ let Popover = (_dec = textDirectionContextConsumer(), _dec2 = testable(), _dec(_
|
|
|
500
514
|
shouldReturnFocus: true,
|
|
501
515
|
shouldCloseOnDocumentClick: true,
|
|
502
516
|
shouldFocusContentOnTriggerBlur: false,
|
|
503
|
-
shouldCloseOnEscape: true
|
|
504
|
-
onShowContent: event => {},
|
|
505
|
-
onHideContent: (event, _ref2) => {
|
|
506
|
-
let documentClick = _ref2.documentClick;
|
|
507
|
-
},
|
|
508
|
-
onClick: event => {},
|
|
509
|
-
onFocus: event => {},
|
|
510
|
-
onBlur: event => {},
|
|
511
|
-
onMouseOver: event => {},
|
|
512
|
-
onMouseOut: event => {},
|
|
513
|
-
onKeyDown: event => {},
|
|
514
|
-
onKeyUp: event => {},
|
|
515
|
-
onPositioned: position => {},
|
|
516
|
-
onPositionChanged: position => {},
|
|
517
|
-
renderTrigger: null,
|
|
518
|
-
children: null
|
|
517
|
+
shouldCloseOnEscape: true
|
|
519
518
|
}, _temp)) || _class) || _class);
|
|
520
519
|
export default Popover;
|
|
521
520
|
export { Popover };
|
package/es/Popover/props.js
CHANGED
|
@@ -25,222 +25,47 @@ import PropTypes from 'prop-types';
|
|
|
25
25
|
import { element } from '@instructure/ui-prop-types';
|
|
26
26
|
import { ThemeablePropTypes } from '@instructure/emotion';
|
|
27
27
|
import { PositionPropTypes } from '@instructure/ui-position';
|
|
28
|
-
// Copied list from "PositionPropTypes.placement" so that it appears as options in the properties table.
|
|
29
|
-
// TODO: try to use "PositionPropTypes.placement" again once Popover is fully typed and uses @tsProps
|
|
30
|
-
const placementPropValues = ['top', 'bottom', 'start', 'end', 'top start', 'top center', 'top end', 'top stretch', 'bottom start', 'bottom center', 'bottom end', 'bottom stretch', 'start top', 'start center', 'start bottom', 'start stretch', 'end top', 'end center', 'end bottom', 'end stretch', 'center start', 'center end', 'offscreen'];
|
|
31
28
|
const propTypes = {
|
|
32
|
-
/**
|
|
33
|
-
* Whether or not the `<Popover />` content is shown
|
|
34
|
-
*/
|
|
35
29
|
isShowingContent: PropTypes.bool,
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Whether or not to show the content by default, when uncontrolled
|
|
39
|
-
*/
|
|
40
30
|
defaultIsShowingContent: PropTypes.bool,
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* The action that causes the content to display (`click`, `hover`, `focus`)
|
|
44
|
-
*/
|
|
45
31
|
on: PropTypes.oneOfType([PropTypes.oneOf(['click', 'hover', 'focus']), PropTypes.arrayOf(PropTypes.oneOf(['click', 'hover', 'focus']))]),
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Whether or not an arrow pointing to the trigger should be rendered
|
|
49
|
-
*/
|
|
50
32
|
withArrow: PropTypes.bool,
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Color variant of the popover content
|
|
54
|
-
*/
|
|
55
33
|
color: PropTypes.oneOf(['primary', 'primary-inverse']),
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* The placement of the content in relation to the trigger
|
|
59
|
-
*/
|
|
60
|
-
placement: PropTypes.oneOf(placementPropValues),
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Controls the shadow depth for the `<Popover />`
|
|
64
|
-
*/
|
|
34
|
+
placement: PositionPropTypes.placement,
|
|
65
35
|
shadow: ThemeablePropTypes.shadow,
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Controls the z-index depth for the `<Popover />` content
|
|
69
|
-
*/
|
|
70
36
|
stacking: ThemeablePropTypes.stacking,
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* A function that returns a reference to the content element
|
|
74
|
-
*/
|
|
75
37
|
contentRef: PropTypes.func,
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* An element or a function returning an element to focus by default
|
|
79
|
-
*/
|
|
80
38
|
defaultFocusElement: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* An accessible label for the `<Popover />` content
|
|
84
|
-
*/
|
|
85
39
|
screenReaderLabel: PropTypes.string,
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* The horizontal offset for the positioned content
|
|
89
|
-
*/
|
|
90
40
|
offsetX: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* The vertical offset for the positioned content
|
|
94
|
-
*/
|
|
95
41
|
offsetY: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* The parent in which to constrain the popover.
|
|
99
|
-
* One of: 'window', 'scroll-parent', 'parent', 'none', an element,
|
|
100
|
-
* or a function returning an element
|
|
101
|
-
*/
|
|
102
42
|
constrain: PositionPropTypes.constrain,
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Target element for positioning the Popover (if it differs from the trigger)
|
|
106
|
-
*/
|
|
107
43
|
positionTarget: PropTypes.oneOfType([element, PropTypes.func]),
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* An element or a function returning an element to use as the mount node
|
|
111
|
-
* for the `<Popover />` (defaults to `document.body`)
|
|
112
|
-
*/
|
|
113
44
|
mountNode: PositionPropTypes.mountNode,
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Insert the element at the 'top' of the mountNode or at the 'bottom'
|
|
117
|
-
*/
|
|
118
45
|
insertAt: PropTypes.oneOf(['bottom', 'top']),
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* An element, function returning an element, or array of elements that will
|
|
122
|
-
* not be hidden from the screen reader when the `<Popover />` is open
|
|
123
|
-
*/
|
|
124
46
|
liveRegion: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.func]),
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* An id is generated if not supplied.
|
|
128
|
-
*/
|
|
129
47
|
id: PropTypes.string,
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Whether or not the content should offset to align by its arrow
|
|
133
|
-
*/
|
|
134
48
|
shouldAlignArrow: PropTypes.bool,
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Whether or not position should be tracked or just set on initial render
|
|
138
|
-
*/
|
|
139
49
|
shouldTrackPosition: PropTypes.bool,
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Should the `<Popover />` render offscreen when visually hidden
|
|
143
|
-
*/
|
|
144
50
|
shouldRenderOffscreen: PropTypes.bool,
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Whether focus should contained within the `<Popover/>` when it is open
|
|
148
|
-
*/
|
|
149
51
|
shouldContainFocus: PropTypes.bool,
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Whether focus should be returned to the trigger when the `<Popover/>` is closed
|
|
153
|
-
*/
|
|
154
52
|
shouldReturnFocus: PropTypes.bool,
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Should the `<Popover />` hide when clicks occur outside the content
|
|
158
|
-
*/
|
|
159
53
|
shouldCloseOnDocumentClick: PropTypes.bool,
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Should the `<Popover />` hide when the escape key is pressed
|
|
163
|
-
*/
|
|
164
54
|
shouldCloseOnEscape: PropTypes.bool,
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Should the content become focused when the trigger is blurred
|
|
168
|
-
*/
|
|
169
55
|
shouldFocusContentOnTriggerBlur: PropTypes.bool,
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Callback fired when content is shown. When controlled, this callback is
|
|
173
|
-
* fired when the Popover expects to be shown
|
|
174
|
-
*/
|
|
175
56
|
onShowContent: PropTypes.func,
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Callback fired when content is hidden. When controlled, this callback is
|
|
179
|
-
* fired when the Popover expects to be hidden
|
|
180
|
-
*/
|
|
181
57
|
onHideContent: PropTypes.func,
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Callback fired when content has been is initially positioned.
|
|
185
|
-
* If `shouldRenderOffscreen` is true, it will only fire once, the first
|
|
186
|
-
* time the content is shown
|
|
187
|
-
*/
|
|
188
58
|
onPositioned: PropTypes.func,
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Callback fired when the position changes
|
|
192
|
-
*/
|
|
193
59
|
onPositionChanged: PropTypes.func,
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Callback fired when component is clicked
|
|
197
|
-
*/
|
|
198
60
|
onClick: PropTypes.func,
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Callback fired when trigger is focused
|
|
202
|
-
*/
|
|
203
61
|
onFocus: PropTypes.func,
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Callback fired when component is blurred
|
|
207
|
-
*/
|
|
208
62
|
onBlur: PropTypes.func,
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Callback fired on keydown
|
|
212
|
-
*/
|
|
213
63
|
onKeyDown: PropTypes.func,
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Callback fired on keyup
|
|
217
|
-
*/
|
|
218
64
|
onKeyUp: PropTypes.func,
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
/**
|
|
222
|
-
* Callback fired when mouse is over trigger
|
|
223
|
-
*/
|
|
224
65
|
onMouseOver: PropTypes.func,
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Callback fired when mouse leaves trigger
|
|
228
|
-
*/
|
|
229
66
|
onMouseOut: PropTypes.func,
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* The element that triggers the popover
|
|
233
|
-
*/
|
|
234
67
|
renderTrigger: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* The content to be shown by the popover
|
|
238
|
-
*/
|
|
239
68
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Provides a reference to the underlying HTML root element
|
|
243
|
-
*/
|
|
244
69
|
elementRef: PropTypes.func
|
|
245
70
|
};
|
|
246
71
|
const allowedProps = ['isShowingContent', 'defaultIsShowingContent', 'on', 'withArrow', 'color', 'placement', 'shadow', 'stacking', 'contentRef', 'defaultFocusElement', 'screenReaderLabel', 'offsetX', 'offsetY', 'constrain', 'positionTarget', 'mountNode', 'insertAt', 'liveRegion', 'id', 'shouldAlignArrow', 'shouldTrackPosition', 'shouldRenderOffscreen', 'shouldContainFocus', 'shouldReturnFocus', 'shouldCloseOnDocumentClick', 'shouldCloseOnEscape', 'shouldFocusContentOnTriggerBlur', 'onShowContent', 'onHideContent', 'onPositioned', 'onPositionChanged', 'onClick', 'onFocus', 'onBlur', 'onKeyDown', 'onKeyUp', 'onMouseOver', 'onMouseOut', 'renderTrigger', 'children', 'elementRef'];
|