@instructure/ui-popover 11.7.8 → 11.7.9-snapshot-1
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/CHANGELOG.md +8 -0
- package/lib/Popover/v1/index.js +37 -47
- package/lib/Popover/v2/index.js +37 -47
- package/package.json +17 -17
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [11.7.9-snapshot-1](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-snapshot-1) (2026-10-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-popover
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-popover
|
package/lib/Popover/v1/index.js
CHANGED
|
@@ -7,25 +7,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.Popover = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _keycode = _interopRequireDefault(require("keycode"));
|
|
10
|
-
var
|
|
11
|
-
var _parsePlacement = require("@instructure/ui-position/lib/parsePlacement.js");
|
|
12
|
-
var _mirrorHorizontalPlacement = require("@instructure/ui-position/lib/mirrorHorizontalPlacement.js");
|
|
10
|
+
var _uiPosition = require("@instructure/ui-position");
|
|
13
11
|
var _v11_ = require("@instructure/ui-view/v11_6");
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var _handleMouseOverOut = require("@instructure/ui-dom-utils/lib/handleMouseOverOut.js");
|
|
20
|
-
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
21
|
-
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
22
|
-
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
23
|
-
var _createChainedFunction = require("@instructure/ui-utils/lib/createChainedFunction.js");
|
|
24
|
-
var _shallowEqual = require("@instructure/ui-utils/lib/shallowEqual.js");
|
|
25
|
-
var _px = require("@instructure/ui-utils/lib/px.js");
|
|
26
|
-
var _combineDataCid = require("@instructure/ui-utils/lib/combineDataCid.js");
|
|
12
|
+
var _uiDialog = require("@instructure/ui-dialog");
|
|
13
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
14
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
15
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
16
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
27
17
|
var _console = require("@instructure/console");
|
|
28
|
-
var
|
|
18
|
+
var _uiA11yUtils = require("@instructure/ui-a11y-utils");
|
|
29
19
|
var _emotion = require("@instructure/emotion");
|
|
30
20
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
31
21
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
@@ -61,7 +51,7 @@ category: components
|
|
|
61
51
|
tags: overlay, portal, dialog
|
|
62
52
|
---
|
|
63
53
|
**/
|
|
64
|
-
let Popover = exports.Popover = (_dec = (0,
|
|
54
|
+
let Popover = exports.Popover = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _uiI18n.textDirectionContextConsumer)(), _dec3 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = _dec3(_class = class Popover extends _react.Component {
|
|
65
55
|
static displayName = 'Popover';
|
|
66
56
|
static componentId = 'Popover';
|
|
67
57
|
static allowedProps = _props.allowedProps;
|
|
@@ -90,7 +80,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
90
80
|
constructor(props) {
|
|
91
81
|
super(props);
|
|
92
82
|
this._renderTriggerProp = this.props.renderTrigger;
|
|
93
|
-
this._renderTrigger = (0,
|
|
83
|
+
this._renderTrigger = (0, _uiReactUtils.callRenderProp)(this.props.renderTrigger);
|
|
94
84
|
this.state = {
|
|
95
85
|
placement: props.placement,
|
|
96
86
|
offsetX: props.offsetX,
|
|
@@ -99,11 +89,11 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
99
89
|
};
|
|
100
90
|
this._id = this.props.id || props.deterministicId();
|
|
101
91
|
this._raf = [];
|
|
102
|
-
this._handleMouseOver =
|
|
92
|
+
this._handleMouseOver = _uiDomUtils.handleMouseOverOut.bind(null, event => {
|
|
103
93
|
this.show(event);
|
|
104
94
|
clearTimeout(this.mouseOutTimeout);
|
|
105
95
|
});
|
|
106
|
-
this._handleMouseOut =
|
|
96
|
+
this._handleMouseOut = _uiDomUtils.handleMouseOverOut.bind(null, event => {
|
|
107
97
|
// this is needed bc the trigger mouseOut fires before tooltip mouseOver
|
|
108
98
|
this.mouseOutTimeout = setTimeout(() => {
|
|
109
99
|
this.hide(event);
|
|
@@ -144,7 +134,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
144
134
|
// if popover is being used as a tooltip with no focusable content
|
|
145
135
|
// manage its FocusRegion internally rather than registering it with
|
|
146
136
|
// the FocusRegionManager via Dialog
|
|
147
|
-
this._focusRegion = new
|
|
137
|
+
this._focusRegion = new _uiA11yUtils.FocusRegion(this._contentElement, {
|
|
148
138
|
shouldCloseOnEscape: this.props.shouldCloseOnEscape,
|
|
149
139
|
shouldCloseOnDocumentClick: false,
|
|
150
140
|
onDismiss: this.hide,
|
|
@@ -164,7 +154,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
164
154
|
}
|
|
165
155
|
}
|
|
166
156
|
shouldComponentUpdate(nextProps, nextState) {
|
|
167
|
-
return !(0,
|
|
157
|
+
return !(0, _uiUtils.shallowEqual)(this.props, nextProps) || !(0, _uiUtils.shallowEqual)(this.state, nextState);
|
|
168
158
|
}
|
|
169
159
|
componentDidUpdate(prevProps, prevState) {
|
|
170
160
|
if (this._focusRegion && this.isTooltip) {
|
|
@@ -200,7 +190,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
200
190
|
offsetY
|
|
201
191
|
} = this.props;
|
|
202
192
|
if (this.props.shouldAlignArrow && this._view) {
|
|
203
|
-
const secondaryPlacement = (0,
|
|
193
|
+
const secondaryPlacement = (0, _uiPosition.parsePlacement)(placement)[1];
|
|
204
194
|
|
|
205
195
|
// arrowSize and arrowBorderWidth are component theme variables
|
|
206
196
|
// declared in ContextView's styles.js
|
|
@@ -208,7 +198,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
208
198
|
arrowSize = 0,
|
|
209
199
|
arrowBorderWidth = 0
|
|
210
200
|
} = this._view.props.styles;
|
|
211
|
-
const offsetAmount = ((0,
|
|
201
|
+
const offsetAmount = ((0, _uiUtils.px)(arrowSize) + (0, _uiUtils.px)(arrowBorderWidth)) * 2;
|
|
212
202
|
if (secondaryPlacement === 'start') {
|
|
213
203
|
offsetX = offsetAmount;
|
|
214
204
|
} else if (secondaryPlacement === 'end') {
|
|
@@ -231,9 +221,9 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
231
221
|
const {
|
|
232
222
|
dir
|
|
233
223
|
} = this.props;
|
|
234
|
-
const isRtl = dir ===
|
|
224
|
+
const isRtl = dir === _uiI18n.textDirectionContextConsumer.DIRECTION.rtl;
|
|
235
225
|
if (isRtl) {
|
|
236
|
-
placement = (0,
|
|
226
|
+
placement = (0, _uiPosition.mirrorHorizontalPlacement)(placement, ' ');
|
|
237
227
|
}
|
|
238
228
|
return !this.shown && this.props.shouldRenderOffscreen ? 'offscreen' : placement;
|
|
239
229
|
}
|
|
@@ -302,7 +292,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
302
292
|
};
|
|
303
293
|
handleDialogDismiss = (event, documentClick) => {
|
|
304
294
|
if (!this.props.shouldReturnFocus && this.props.shouldFocusContentOnTriggerBlur) {
|
|
305
|
-
const trigger = (0,
|
|
295
|
+
const trigger = (0, _uiDomUtils.findDOMNode)(this._trigger);
|
|
306
296
|
if (trigger && typeof trigger.focus === 'function') {
|
|
307
297
|
;
|
|
308
298
|
trigger.focus();
|
|
@@ -322,7 +312,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
322
312
|
}
|
|
323
313
|
if (event.keyCode === _keycode.default.codes.tab && !event.shiftKey) {
|
|
324
314
|
event.preventDefault();
|
|
325
|
-
this._raf.push((0,
|
|
315
|
+
this._raf.push((0, _uiDomUtils.requestAnimationFrame)(() => {
|
|
326
316
|
this._dialog && this._dialog.focus();
|
|
327
317
|
}));
|
|
328
318
|
}
|
|
@@ -340,8 +330,8 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
340
330
|
on
|
|
341
331
|
} = this.props;
|
|
342
332
|
if (on && on.indexOf('focus') > -1) {
|
|
343
|
-
this._raf.push((0,
|
|
344
|
-
if (!(0,
|
|
333
|
+
this._raf.push((0, _uiDomUtils.requestAnimationFrame)(() => {
|
|
334
|
+
if (!(0, _uiDomUtils.containsActiveElement)(this._view)) {
|
|
345
335
|
this.hide(event);
|
|
346
336
|
}
|
|
347
337
|
}));
|
|
@@ -366,7 +356,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
366
356
|
renderTrigger() {
|
|
367
357
|
if (this._renderTriggerProp != this.props.renderTrigger) {
|
|
368
358
|
this._renderTriggerProp = this.props.renderTrigger;
|
|
369
|
-
this._renderTrigger = (0,
|
|
359
|
+
this._renderTrigger = (0, _uiReactUtils.callRenderProp)(this.props.renderTrigger);
|
|
370
360
|
}
|
|
371
361
|
let trigger = this._renderTrigger;
|
|
372
362
|
if (trigger) {
|
|
@@ -404,29 +394,29 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
404
394
|
} else {
|
|
405
395
|
expanded = undefined;
|
|
406
396
|
}
|
|
407
|
-
trigger = (0,
|
|
397
|
+
trigger = (0, _uiReactUtils.safeCloneElement)(trigger, {
|
|
408
398
|
ref: el => {
|
|
409
399
|
this._trigger = el;
|
|
410
400
|
},
|
|
411
401
|
'aria-expanded': expanded,
|
|
412
402
|
'data-popover-trigger': true,
|
|
413
|
-
onKeyDown: (0,
|
|
414
|
-
onKeyUp: (0,
|
|
415
|
-
onClick: (0,
|
|
416
|
-
onBlur: (0,
|
|
417
|
-
onFocus: (0,
|
|
418
|
-
onMouseOut: (0,
|
|
419
|
-
onMouseOver: (0,
|
|
403
|
+
onKeyDown: (0, _uiUtils.createChainedFunction)(this.handleTriggerKeyDown, this.props.onKeyDown),
|
|
404
|
+
onKeyUp: (0, _uiUtils.createChainedFunction)(this.handleTriggerKeyUp, this.props.onKeyUp),
|
|
405
|
+
onClick: (0, _uiUtils.createChainedFunction)(onClick, this.props.onClick),
|
|
406
|
+
onBlur: (0, _uiUtils.createChainedFunction)(this.handleTriggerBlur, this.props.onBlur),
|
|
407
|
+
onFocus: (0, _uiUtils.createChainedFunction)(onFocus, this.props.onFocus),
|
|
408
|
+
onMouseOut: (0, _uiUtils.createChainedFunction)(onMouseOut, this.props.onMouseOut),
|
|
409
|
+
onMouseOver: (0, _uiUtils.createChainedFunction)(onMouseOver, this.props.onMouseOver)
|
|
420
410
|
});
|
|
421
411
|
}
|
|
422
412
|
return trigger;
|
|
423
413
|
}
|
|
424
414
|
renderContent() {
|
|
425
|
-
let content = (0,
|
|
415
|
+
let content = (0, _uiReactUtils.callRenderProp)(this.props.children);
|
|
426
416
|
if (this.shown && !this.isTooltip) {
|
|
427
417
|
// if popover is NOT being used as a tooltip, create a Dialog
|
|
428
418
|
// to manage the content FocusRegion, when showing
|
|
429
|
-
content = (0, _jsxRuntime.jsx)(
|
|
419
|
+
content = (0, _jsxRuntime.jsx)(_uiDialog.Dialog, {
|
|
430
420
|
open: this.shown,
|
|
431
421
|
label: this.props.screenReaderLabel,
|
|
432
422
|
ref: el => {
|
|
@@ -478,7 +468,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
478
468
|
...viewProps,
|
|
479
469
|
// TODO: remove background override after contextview is updated
|
|
480
470
|
background: color === 'primary' ? 'default' : 'inverse',
|
|
481
|
-
placement: this.props.dir ===
|
|
471
|
+
placement: this.props.dir === _uiI18n.textDirectionContextConsumer.DIRECTION.rtl ? (0, _uiPosition.mirrorHorizontalPlacement)(placement, ' ') : placement
|
|
482
472
|
};
|
|
483
473
|
return (0, _jsxRuntime.jsx)(_v11_.ContextView, {
|
|
484
474
|
...viewProps,
|
|
@@ -509,15 +499,15 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
509
499
|
if (this.props.positionTarget) {
|
|
510
500
|
return (0, _jsxRuntime.jsxs)("span", {
|
|
511
501
|
ref: this.handleRef,
|
|
512
|
-
children: [this.renderTrigger(), (0, _jsxRuntime.jsx)(
|
|
502
|
+
children: [this.renderTrigger(), (0, _jsxRuntime.jsx)(_uiPosition.Position, {
|
|
513
503
|
...positionProps,
|
|
514
|
-
"data-cid": (0,
|
|
504
|
+
"data-cid": (0, _uiUtils.combineDataCid)('Popover', this.props),
|
|
515
505
|
children: this.renderContent()
|
|
516
506
|
})]
|
|
517
507
|
});
|
|
518
508
|
} else {
|
|
519
|
-
return (0, _jsxRuntime.jsx)(
|
|
520
|
-
"data-cid": (0,
|
|
509
|
+
return (0, _jsxRuntime.jsx)(_uiPosition.Position, {
|
|
510
|
+
"data-cid": (0, _uiUtils.combineDataCid)('Popover', this.props),
|
|
521
511
|
...positionProps,
|
|
522
512
|
renderTarget: this.renderTrigger(),
|
|
523
513
|
elementRef: this.handleRef,
|
package/lib/Popover/v2/index.js
CHANGED
|
@@ -7,25 +7,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.Popover = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _keycode = _interopRequireDefault(require("keycode"));
|
|
10
|
-
var
|
|
11
|
-
var _parsePlacement = require("@instructure/ui-position/lib/parsePlacement.js");
|
|
12
|
-
var _mirrorHorizontalPlacement = require("@instructure/ui-position/lib/mirrorHorizontalPlacement.js");
|
|
10
|
+
var _uiPosition = require("@instructure/ui-position");
|
|
13
11
|
var _latest = require("@instructure/ui-view/latest");
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var _handleMouseOverOut = require("@instructure/ui-dom-utils/lib/handleMouseOverOut.js");
|
|
20
|
-
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
21
|
-
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
22
|
-
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
23
|
-
var _createChainedFunction = require("@instructure/ui-utils/lib/createChainedFunction.js");
|
|
24
|
-
var _shallowEqual = require("@instructure/ui-utils/lib/shallowEqual.js");
|
|
25
|
-
var _px = require("@instructure/ui-utils/lib/px.js");
|
|
26
|
-
var _combineDataCid = require("@instructure/ui-utils/lib/combineDataCid.js");
|
|
12
|
+
var _uiDialog = require("@instructure/ui-dialog");
|
|
13
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
14
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
15
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
16
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
27
17
|
var _console = require("@instructure/console");
|
|
28
|
-
var
|
|
18
|
+
var _uiA11yUtils = require("@instructure/ui-a11y-utils");
|
|
29
19
|
var _emotion = require("@instructure/emotion");
|
|
30
20
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
31
21
|
var _props = require("./props.js");
|
|
@@ -60,7 +50,7 @@ category: components
|
|
|
60
50
|
tags: overlay, portal, dialog
|
|
61
51
|
---
|
|
62
52
|
**/
|
|
63
|
-
let Popover = exports.Popover = (_dec = (0,
|
|
53
|
+
let Popover = exports.Popover = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _uiI18n.textDirectionContextConsumer)(), _dec3 = (0, _emotion.withStyleNew)(_styles.default), _dec(_class = _dec2(_class = _dec3(_class = class Popover extends _react.Component {
|
|
64
54
|
static displayName = 'Popover';
|
|
65
55
|
static componentId = 'Popover';
|
|
66
56
|
static allowedProps = _props.allowedProps;
|
|
@@ -89,7 +79,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
89
79
|
constructor(props) {
|
|
90
80
|
super(props);
|
|
91
81
|
this._renderTriggerProp = this.props.renderTrigger;
|
|
92
|
-
this._renderTrigger = (0,
|
|
82
|
+
this._renderTrigger = (0, _uiReactUtils.callRenderProp)(this.props.renderTrigger);
|
|
93
83
|
this.state = {
|
|
94
84
|
placement: props.placement,
|
|
95
85
|
offsetX: props.offsetX,
|
|
@@ -98,11 +88,11 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
98
88
|
};
|
|
99
89
|
this._id = this.props.id || props.deterministicId();
|
|
100
90
|
this._raf = [];
|
|
101
|
-
this._handleMouseOver =
|
|
91
|
+
this._handleMouseOver = _uiDomUtils.handleMouseOverOut.bind(null, event => {
|
|
102
92
|
this.show(event);
|
|
103
93
|
clearTimeout(this.mouseOutTimeout);
|
|
104
94
|
});
|
|
105
|
-
this._handleMouseOut =
|
|
95
|
+
this._handleMouseOut = _uiDomUtils.handleMouseOverOut.bind(null, event => {
|
|
106
96
|
// this is needed bc the trigger mouseOut fires before tooltip mouseOver
|
|
107
97
|
this.mouseOutTimeout = setTimeout(() => {
|
|
108
98
|
this.hide(event);
|
|
@@ -144,7 +134,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
144
134
|
// if popover is being used as a tooltip with no focusable content
|
|
145
135
|
// manage its FocusRegion internally rather than registering it with
|
|
146
136
|
// the FocusRegionManager via Dialog
|
|
147
|
-
this._focusRegion = new
|
|
137
|
+
this._focusRegion = new _uiA11yUtils.FocusRegion(this._contentElement, {
|
|
148
138
|
shouldCloseOnEscape: this.props.shouldCloseOnEscape,
|
|
149
139
|
shouldCloseOnDocumentClick: false,
|
|
150
140
|
onDismiss: this.hide,
|
|
@@ -164,7 +154,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
164
154
|
}
|
|
165
155
|
}
|
|
166
156
|
shouldComponentUpdate(nextProps, nextState) {
|
|
167
|
-
return !(0,
|
|
157
|
+
return !(0, _uiUtils.shallowEqual)(this.props, nextProps) || !(0, _uiUtils.shallowEqual)(this.state, nextState);
|
|
168
158
|
}
|
|
169
159
|
componentDidUpdate(prevProps, prevState) {
|
|
170
160
|
this.props.makeStyles?.();
|
|
@@ -201,7 +191,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
201
191
|
offsetY
|
|
202
192
|
} = this.props;
|
|
203
193
|
if (this.props.shouldAlignArrow && this._view) {
|
|
204
|
-
const secondaryPlacement = (0,
|
|
194
|
+
const secondaryPlacement = (0, _uiPosition.parsePlacement)(placement)[1];
|
|
205
195
|
|
|
206
196
|
// arrowSize and arrowBorderWidth are component theme variables
|
|
207
197
|
// declared in ContextView's styles.js
|
|
@@ -209,7 +199,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
209
199
|
arrowSize = 0,
|
|
210
200
|
arrowBorderWidth = 0
|
|
211
201
|
} = this._view.props.styles;
|
|
212
|
-
const offsetAmount = ((0,
|
|
202
|
+
const offsetAmount = ((0, _uiUtils.px)(arrowSize) + (0, _uiUtils.px)(arrowBorderWidth)) * 2;
|
|
213
203
|
if (secondaryPlacement === 'start') {
|
|
214
204
|
offsetX = offsetAmount;
|
|
215
205
|
} else if (secondaryPlacement === 'end') {
|
|
@@ -232,9 +222,9 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
232
222
|
const {
|
|
233
223
|
dir
|
|
234
224
|
} = this.props;
|
|
235
|
-
const isRtl = dir ===
|
|
225
|
+
const isRtl = dir === _uiI18n.textDirectionContextConsumer.DIRECTION.rtl;
|
|
236
226
|
if (isRtl) {
|
|
237
|
-
placement = (0,
|
|
227
|
+
placement = (0, _uiPosition.mirrorHorizontalPlacement)(placement, ' ');
|
|
238
228
|
}
|
|
239
229
|
return !this.shown && this.props.shouldRenderOffscreen ? 'offscreen' : placement;
|
|
240
230
|
}
|
|
@@ -303,7 +293,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
303
293
|
};
|
|
304
294
|
handleDialogDismiss = (event, documentClick) => {
|
|
305
295
|
if (!this.props.shouldReturnFocus && this.props.shouldFocusContentOnTriggerBlur) {
|
|
306
|
-
const trigger = (0,
|
|
296
|
+
const trigger = (0, _uiDomUtils.findDOMNode)(this._trigger);
|
|
307
297
|
if (trigger && typeof trigger.focus === 'function') {
|
|
308
298
|
;
|
|
309
299
|
trigger.focus();
|
|
@@ -323,7 +313,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
323
313
|
}
|
|
324
314
|
if (event.keyCode === _keycode.default.codes.tab && !event.shiftKey) {
|
|
325
315
|
event.preventDefault();
|
|
326
|
-
this._raf.push((0,
|
|
316
|
+
this._raf.push((0, _uiDomUtils.requestAnimationFrame)(() => {
|
|
327
317
|
this._dialog && this._dialog.focus();
|
|
328
318
|
}));
|
|
329
319
|
}
|
|
@@ -341,8 +331,8 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
341
331
|
on
|
|
342
332
|
} = this.props;
|
|
343
333
|
if (on && on.indexOf('focus') > -1) {
|
|
344
|
-
this._raf.push((0,
|
|
345
|
-
if (!(0,
|
|
334
|
+
this._raf.push((0, _uiDomUtils.requestAnimationFrame)(() => {
|
|
335
|
+
if (!(0, _uiDomUtils.containsActiveElement)(this._view)) {
|
|
346
336
|
this.hide(event);
|
|
347
337
|
}
|
|
348
338
|
}));
|
|
@@ -367,7 +357,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
367
357
|
renderTrigger() {
|
|
368
358
|
if (this._renderTriggerProp != this.props.renderTrigger) {
|
|
369
359
|
this._renderTriggerProp = this.props.renderTrigger;
|
|
370
|
-
this._renderTrigger = (0,
|
|
360
|
+
this._renderTrigger = (0, _uiReactUtils.callRenderProp)(this.props.renderTrigger);
|
|
371
361
|
}
|
|
372
362
|
let trigger = this._renderTrigger;
|
|
373
363
|
if (trigger) {
|
|
@@ -405,25 +395,25 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
405
395
|
} else {
|
|
406
396
|
expanded = undefined;
|
|
407
397
|
}
|
|
408
|
-
trigger = (0,
|
|
398
|
+
trigger = (0, _uiReactUtils.safeCloneElement)(trigger, {
|
|
409
399
|
ref: el => {
|
|
410
400
|
this._trigger = el;
|
|
411
401
|
},
|
|
412
402
|
'aria-expanded': expanded,
|
|
413
403
|
'data-popover-trigger': true,
|
|
414
|
-
onKeyDown: (0,
|
|
415
|
-
onKeyUp: (0,
|
|
416
|
-
onClick: (0,
|
|
417
|
-
onBlur: (0,
|
|
418
|
-
onFocus: (0,
|
|
419
|
-
onMouseOut: (0,
|
|
420
|
-
onMouseOver: (0,
|
|
404
|
+
onKeyDown: (0, _uiUtils.createChainedFunction)(this.handleTriggerKeyDown, this.props.onKeyDown),
|
|
405
|
+
onKeyUp: (0, _uiUtils.createChainedFunction)(this.handleTriggerKeyUp, this.props.onKeyUp),
|
|
406
|
+
onClick: (0, _uiUtils.createChainedFunction)(onClick, this.props.onClick),
|
|
407
|
+
onBlur: (0, _uiUtils.createChainedFunction)(this.handleTriggerBlur, this.props.onBlur),
|
|
408
|
+
onFocus: (0, _uiUtils.createChainedFunction)(onFocus, this.props.onFocus),
|
|
409
|
+
onMouseOut: (0, _uiUtils.createChainedFunction)(onMouseOut, this.props.onMouseOut),
|
|
410
|
+
onMouseOver: (0, _uiUtils.createChainedFunction)(onMouseOver, this.props.onMouseOver)
|
|
421
411
|
});
|
|
422
412
|
}
|
|
423
413
|
return trigger;
|
|
424
414
|
}
|
|
425
415
|
renderContent() {
|
|
426
|
-
let content = (0,
|
|
416
|
+
let content = (0, _uiReactUtils.callRenderProp)(this.props.children);
|
|
427
417
|
if (this.props.shouldScrollContent) {
|
|
428
418
|
content = (0, _jsxRuntime.jsx)("div", {
|
|
429
419
|
css: this.props.styles?.scrollContainer,
|
|
@@ -433,7 +423,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
433
423
|
if (this.shown && !this.isTooltip) {
|
|
434
424
|
// if popover is NOT being used as a tooltip, create a Dialog
|
|
435
425
|
// to manage the content FocusRegion, when showing
|
|
436
|
-
content = (0, _jsxRuntime.jsx)(
|
|
426
|
+
content = (0, _jsxRuntime.jsx)(_uiDialog.Dialog, {
|
|
437
427
|
open: this.shown,
|
|
438
428
|
label: this.props.screenReaderLabel,
|
|
439
429
|
ref: el => {
|
|
@@ -485,7 +475,7 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
485
475
|
...viewProps,
|
|
486
476
|
// TODO: remove background override after contextview is updated
|
|
487
477
|
background: color === 'primary' ? 'default' : 'inverse',
|
|
488
|
-
placement: this.props.dir ===
|
|
478
|
+
placement: this.props.dir === _uiI18n.textDirectionContextConsumer.DIRECTION.rtl ? (0, _uiPosition.mirrorHorizontalPlacement)(placement, ' ') : placement
|
|
489
479
|
};
|
|
490
480
|
return (0, _jsxRuntime.jsx)(_latest.ContextView, {
|
|
491
481
|
...viewProps,
|
|
@@ -517,15 +507,15 @@ let Popover = exports.Popover = (_dec = (0, _withDeterministicId.withDeterminist
|
|
|
517
507
|
if (this.props.positionTarget) {
|
|
518
508
|
return (0, _jsxRuntime.jsxs)("span", {
|
|
519
509
|
ref: this.handleRef,
|
|
520
|
-
children: [this.renderTrigger(), (0, _jsxRuntime.jsx)(
|
|
510
|
+
children: [this.renderTrigger(), (0, _jsxRuntime.jsx)(_uiPosition.Position, {
|
|
521
511
|
...positionProps,
|
|
522
|
-
"data-cid": (0,
|
|
512
|
+
"data-cid": (0, _uiUtils.combineDataCid)('Popover', this.props),
|
|
523
513
|
children: this.renderContent()
|
|
524
514
|
})]
|
|
525
515
|
});
|
|
526
516
|
} else {
|
|
527
|
-
return (0, _jsxRuntime.jsx)(
|
|
528
|
-
"data-cid": (0,
|
|
517
|
+
return (0, _jsxRuntime.jsx)(_uiPosition.Position, {
|
|
518
|
+
"data-cid": (0, _uiUtils.combineDataCid)('Popover', this.props),
|
|
529
519
|
...positionProps,
|
|
530
520
|
renderTarget: this.renderTrigger(),
|
|
531
521
|
elementRef: this.handleRef,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-popover",
|
|
3
|
-
"version": "11.7.
|
|
3
|
+
"version": "11.7.9-snapshot-1",
|
|
4
4
|
"description": "A component for hiding or showing content based on user interaction.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -16,25 +16,25 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.7",
|
|
18
18
|
"keycode": "^2.2.1",
|
|
19
|
-
"@instructure/console": "11.7.
|
|
20
|
-
"@instructure/emotion": "11.7.
|
|
21
|
-
"@instructure/ui-a11y-utils": "11.7.
|
|
22
|
-
"@instructure/ui-dialog": "11.7.
|
|
23
|
-
"@instructure/shared-types": "11.7.
|
|
24
|
-
"@instructure/ui-
|
|
25
|
-
"@instructure/ui-
|
|
26
|
-
"@instructure/ui-
|
|
27
|
-
"@instructure/ui-themes": "11.7.
|
|
28
|
-
"@instructure/ui-
|
|
29
|
-
"@instructure/ui-
|
|
30
|
-
"@instructure/
|
|
31
|
-
"@instructure/
|
|
19
|
+
"@instructure/console": "11.7.9-snapshot-1",
|
|
20
|
+
"@instructure/emotion": "11.7.9-snapshot-1",
|
|
21
|
+
"@instructure/ui-a11y-utils": "11.7.9-snapshot-1",
|
|
22
|
+
"@instructure/ui-dialog": "11.7.9-snapshot-1",
|
|
23
|
+
"@instructure/shared-types": "11.7.9-snapshot-1",
|
|
24
|
+
"@instructure/ui-dom-utils": "11.7.9-snapshot-1",
|
|
25
|
+
"@instructure/ui-i18n": "11.7.9-snapshot-1",
|
|
26
|
+
"@instructure/ui-react-utils": "11.7.9-snapshot-1",
|
|
27
|
+
"@instructure/ui-themes": "11.7.9-snapshot-1",
|
|
28
|
+
"@instructure/ui-position": "11.7.9-snapshot-1",
|
|
29
|
+
"@instructure/ui-utils": "11.7.9-snapshot-1",
|
|
30
|
+
"@instructure/ui-view": "11.7.9-snapshot-1",
|
|
31
|
+
"@instructure/uid": "11.7.9-snapshot-1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"vitest": "^5.0.0",
|
|
35
|
-
"@instructure/ui-axe-check": "11.7.
|
|
36
|
-
"@instructure/ui-babel-preset": "11.7.
|
|
37
|
-
"@instructure/ui-color-utils": "11.7.
|
|
35
|
+
"@instructure/ui-axe-check": "11.7.9-snapshot-1",
|
|
36
|
+
"@instructure/ui-babel-preset": "11.7.9-snapshot-1",
|
|
37
|
+
"@instructure/ui-color-utils": "11.7.9-snapshot-1"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": ">=18 <=19"
|