@targetprocess/popover 12.19.5-alpha.3 → 12.19.6-alpha.0

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/Popover.tsx CHANGED
@@ -128,8 +128,7 @@ export class Popover extends React.Component<PopoverProps, PopoverState> {
128
128
  static defaultProps = {
129
129
  zIndex: 19999,
130
130
  outerActionEvents: ['mousedown', 'touchstart'],
131
- getPopoverPosition: 'bottomLeft',
132
- role: 'dialog'
131
+ getPopoverPosition: 'bottomLeft'
133
132
  }
134
133
 
135
134
  state = {
@@ -7,7 +7,7 @@ import {PopoverPosition} from './PopoverPosition'
7
7
  import styles from './style/index.css'
8
8
  import {DimensionParams, GetPopoverPositionType, PositionParams} from './types'
9
9
  import {throttle} from '../../base/utils/throttle'
10
- import {focusFirstDescendant, trapFocus} from '../../base/utils/ariaUtils'
10
+ import {focusFirstDescendant} from '../../base/utils/ariaUtils'
11
11
 
12
12
  type PopoverContainerProps = {
13
13
  containerElement?: HTMLElement
@@ -154,16 +154,11 @@ export class PopoverContainer extends React.Component<
154
154
  this.mounted = true
155
155
  this.adjustPosition()
156
156
 
157
- if (this.popoverContentRef.current && this.props.role === 'dialog') {
157
+ if (this.popoverContentRef.current) {
158
158
  if (!focusFirstDescendant(this.popoverContentRef.current)) {
159
159
  this.popoverContentRef.current.tabIndex = 0
160
160
  this.popoverContentRef.current.focus()
161
161
  }
162
- trapFocus(this.popoverContentRef.current)
163
- }
164
- if (this.props.role === 'tooltip') {
165
- this.popoverContentRef.current.tabIndex = 0
166
- this.popoverContentRef.current.focus()
167
162
  }
168
163
 
169
164
  if (this.props.trackScroll) {
@@ -214,7 +209,6 @@ export class PopoverContainer extends React.Component<
214
209
 
215
210
  handleKeyDown = event => {
216
211
  if (event.key === 'Escape') {
217
- event.stopPropagation()
218
212
  this.props.onEscapeAction(event)
219
213
  }
220
214
  }
@@ -272,6 +266,7 @@ export class PopoverContainer extends React.Component<
272
266
  )}
273
267
  <div
274
268
  ref={this.popoverContentRef}
269
+ aria-modal="true"
275
270
  style={{
276
271
  position: 'absolute',
277
272
  pointerEvents: 'all',
@@ -279,7 +274,6 @@ export class PopoverContainer extends React.Component<
279
274
  }}
280
275
  className={this.props.className}
281
276
  role={this.props.role}
282
- aria-modal={this.props.role === 'dialog' ? 'true' : 'false'}
283
277
  onKeyDown={this.handleKeyDown}
284
278
  >
285
279
  {this.props.children}
package/dist/Popover.d.ts CHANGED
@@ -118,7 +118,6 @@ export declare class Popover extends React.Component<PopoverProps, PopoverState>
118
118
  zIndex: number;
119
119
  outerActionEvents: string[];
120
120
  getPopoverPosition: string;
121
- role: string;
122
121
  };
123
122
  state: {
124
123
  isOpen: boolean;
@@ -3,33 +3,6 @@ import { SpaceXS } from '@targetprocess/global-constants';
3
3
  import classNames from 'classnames';
4
4
  import ReactDOM from 'react-dom';
5
5
 
6
- function _iterableToArrayLimit(r, l) {
7
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
8
- if (null != t) {
9
- var e,
10
- n,
11
- i,
12
- u,
13
- a = [],
14
- f = !0,
15
- o = !1;
16
- try {
17
- if (i = (t = t.call(r)).next, 0 === l) {
18
- if (Object(t) !== t) return;
19
- f = !1;
20
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
21
- } catch (r) {
22
- o = !0, n = r;
23
- } finally {
24
- try {
25
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
26
- } finally {
27
- if (o) throw n;
28
- }
29
- }
30
- return a;
31
- }
32
- }
33
6
  function _classCallCheck(instance, Constructor) {
34
7
  if (!(instance instanceof Constructor)) {
35
8
  throw new TypeError("Cannot call a class as a function");
@@ -109,28 +82,6 @@ function _possibleConstructorReturn(self, call) {
109
82
  }
110
83
  return _assertThisInitialized(self);
111
84
  }
112
- function _slicedToArray(arr, i) {
113
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
114
- }
115
- function _arrayWithHoles(arr) {
116
- if (Array.isArray(arr)) return arr;
117
- }
118
- function _unsupportedIterableToArray(o, minLen) {
119
- if (!o) return;
120
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
121
- var n = Object.prototype.toString.call(o).slice(8, -1);
122
- if (n === "Object" && o.constructor) n = o.constructor.name;
123
- if (n === "Map" || n === "Set") return Array.from(o);
124
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
125
- }
126
- function _arrayLikeToArray(arr, len) {
127
- if (len == null || len > arr.length) len = arr.length;
128
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
129
- return arr2;
130
- }
131
- function _nonIterableRest() {
132
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
133
- }
134
85
  function _toPrimitive(input, hint) {
135
86
  if (typeof input !== "object" || input === null) return input;
136
87
  var prim = input[Symbol.toPrimitive];
@@ -254,8 +205,8 @@ function styleInject(css, ref) {
254
205
  }
255
206
  }
256
207
 
257
- var css = ".popover-body-container__popover__12-19-5-alpha-3 {\r\n -webkit-box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n border-radius: var(--BorderRadiusL, 4px);\r\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\r\n background: var(--BackgroundDefault, #FFFFFF);\r\n z-index: var(--ZIndexModal, 10001);\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n}\r\n\r\n.popover-body__popover__12-19-5-alpha-3 {\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n padding: var(--SpaceSM, 12px);\r\n font-size: var(--FontSizeDefault, 13px);\r\n color: var(--FontColorDefault, #000000);\r\n}\r\n\r\n.popover-body--no-padding__popover__12-19-5-alpha-3 {\r\n padding: 0;\r\n }\r\n\r\n.popover-tip__popover__12-19-5-alpha-3 {\r\n position: absolute;\r\n pointer-events: none;\r\n z-index: calc(var(--ZIndexModal, 10001) + 1);\r\n overflow: hidden;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-pack: center;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n}\r\n\r\n.popover-tip__popover__12-19-5-alpha-3:before {\r\n content: '';\r\n position: absolute;\r\n display: block;\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n background-color: var(--BackgroundDefault, #FFFFFF);\r\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\r\n /*\r\n geometry FTW\r\n\r\n 2*$popoverTipSize\r\n _______ _______\r\n | /|\\ |\r\n | / | \\ | $popoverTipSize\r\n | / | \\ |\r\n |/______|______\\|\r\n since tip is rotated 45 degrees, its width and height is a\r\n diagonal of a square with side=$popoverTipSize, thus diagonal\r\n is sqrt(2) * $popoverTipSize.\r\n sqrt(2) ~= 1.414, 1.4 used here to prevent too much rounding\r\n */\r\n width: 11.2px;\r\n height: 11.2px;\r\n -webkit-transform: rotate(45deg);\r\n transform: rotate(45deg);\r\n }\r\n\r\n.popover-tip--bottom__popover__12-19-5-alpha-3,\r\n .popover-tip--top__popover__12-19-5-alpha-3 {\r\n width: 100%;\r\n border-top: 1px var(--BackgroundDefault, #FFFFFF);\r\n border-bottom: 1px var(--BackgroundDefault, #FFFFFF);\r\n height: 9px;\r\n }\r\n\r\n.popover-tip--left__popover__12-19-5-alpha-3,\r\n .popover-tip--right__popover__12-19-5-alpha-3 {\r\n border-left: 1px var(--BackgroundDefault, #FFFFFF);\r\n border-right: 1px var(--BackgroundDefault, #FFFFFF);\r\n height: 100%;\r\n width: 9px;\r\n }\r\n\r\n/*\r\n To determine tip position, we need to rotate it\r\n along the \"tip\" point, after that, the \"tip\" point\r\n can be placed with exactly 50% offset from the origin\r\n so that it is centered.\r\n */\r\n\r\n.popover-tip--bottom__popover__12-19-5-alpha-3:before {\r\n -webkit-transform-origin: left top;\r\n transform-origin: left top;\r\n left: 50%;\r\n top: 0;\r\n }\r\n\r\n.popover-tip--top__popover__12-19-5-alpha-3:before {\r\n -webkit-transform-origin: right bottom;\r\n transform-origin: right bottom;\r\n right: 50%;\r\n bottom: 0;\r\n }\r\n\r\n.popover-tip--left__popover__12-19-5-alpha-3:before {\r\n -webkit-transform-origin: right top;\r\n transform-origin: right top;\r\n right: 0;\r\n top: 50%;\r\n }\r\n\r\n.popover-tip--right__popover__12-19-5-alpha-3:before {\r\n -webkit-transform-origin: left bottom;\r\n transform-origin: left bottom;\r\n left: 0;\r\n bottom: 50%;\r\n }\r\n";
258
- var styles = {"popover-body-container":"popover-body-container__popover__12-19-5-alpha-3","popover-body":"popover-body__popover__12-19-5-alpha-3","popover-body--no-padding":"popover-body--no-padding__popover__12-19-5-alpha-3","popover-tip":"popover-tip__popover__12-19-5-alpha-3","popover-tip--bottom":"popover-tip--bottom__popover__12-19-5-alpha-3","popover-tip--top":"popover-tip--top__popover__12-19-5-alpha-3","popover-tip--left":"popover-tip--left__popover__12-19-5-alpha-3","popover-tip--right":"popover-tip--right__popover__12-19-5-alpha-3"};
208
+ var css = ".popover-body-container__popover__12-19-6-alpha-0 {\r\n -webkit-box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n border-radius: var(--BorderRadiusL, 4px);\r\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\r\n background: var(--BackgroundDefault, #FFFFFF);\r\n z-index: var(--ZIndexModal, 10001);\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n}\r\n\r\n.popover-body__popover__12-19-6-alpha-0 {\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n padding: var(--SpaceSM, 12px);\r\n font-size: var(--FontSizeDefault, 13px);\r\n color: var(--FontColorDefault, #000000);\r\n}\r\n\r\n.popover-body--no-padding__popover__12-19-6-alpha-0 {\r\n padding: 0;\r\n }\r\n\r\n.popover-tip__popover__12-19-6-alpha-0 {\r\n position: absolute;\r\n pointer-events: none;\r\n z-index: calc(var(--ZIndexModal, 10001) + 1);\r\n overflow: hidden;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-pack: center;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n}\r\n\r\n.popover-tip__popover__12-19-6-alpha-0:before {\r\n content: '';\r\n position: absolute;\r\n display: block;\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n background-color: var(--BackgroundDefault, #FFFFFF);\r\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\r\n /*\r\n geometry FTW\r\n\r\n 2*$popoverTipSize\r\n _______ _______\r\n | /|\\ |\r\n | / | \\ | $popoverTipSize\r\n | / | \\ |\r\n |/______|______\\|\r\n since tip is rotated 45 degrees, its width and height is a\r\n diagonal of a square with side=$popoverTipSize, thus diagonal\r\n is sqrt(2) * $popoverTipSize.\r\n sqrt(2) ~= 1.414, 1.4 used here to prevent too much rounding\r\n */\r\n width: 11.2px;\r\n height: 11.2px;\r\n -webkit-transform: rotate(45deg);\r\n transform: rotate(45deg);\r\n }\r\n\r\n.popover-tip--bottom__popover__12-19-6-alpha-0,\r\n .popover-tip--top__popover__12-19-6-alpha-0 {\r\n width: 100%;\r\n border-top: 1px var(--BackgroundDefault, #FFFFFF);\r\n border-bottom: 1px var(--BackgroundDefault, #FFFFFF);\r\n height: 9px;\r\n }\r\n\r\n.popover-tip--left__popover__12-19-6-alpha-0,\r\n .popover-tip--right__popover__12-19-6-alpha-0 {\r\n border-left: 1px var(--BackgroundDefault, #FFFFFF);\r\n border-right: 1px var(--BackgroundDefault, #FFFFFF);\r\n height: 100%;\r\n width: 9px;\r\n }\r\n\r\n/*\r\n To determine tip position, we need to rotate it\r\n along the \"tip\" point, after that, the \"tip\" point\r\n can be placed with exactly 50% offset from the origin\r\n so that it is centered.\r\n */\r\n\r\n.popover-tip--bottom__popover__12-19-6-alpha-0:before {\r\n -webkit-transform-origin: left top;\r\n transform-origin: left top;\r\n left: 50%;\r\n top: 0;\r\n }\r\n\r\n.popover-tip--top__popover__12-19-6-alpha-0:before {\r\n -webkit-transform-origin: right bottom;\r\n transform-origin: right bottom;\r\n right: 50%;\r\n bottom: 0;\r\n }\r\n\r\n.popover-tip--left__popover__12-19-6-alpha-0:before {\r\n -webkit-transform-origin: right top;\r\n transform-origin: right top;\r\n right: 0;\r\n top: 50%;\r\n }\r\n\r\n.popover-tip--right__popover__12-19-6-alpha-0:before {\r\n -webkit-transform-origin: left bottom;\r\n transform-origin: left bottom;\r\n left: 0;\r\n bottom: 50%;\r\n }\r\n";
209
+ var styles = {"popover-body-container":"popover-body-container__popover__12-19-6-alpha-0","popover-body":"popover-body__popover__12-19-6-alpha-0","popover-body--no-padding":"popover-body--no-padding__popover__12-19-6-alpha-0","popover-tip":"popover-tip__popover__12-19-6-alpha-0","popover-tip--bottom":"popover-tip--bottom__popover__12-19-6-alpha-0","popover-tip--top":"popover-tip--top__popover__12-19-6-alpha-0","popover-tip--left":"popover-tip--left__popover__12-19-6-alpha-0","popover-tip--right":"popover-tip--right__popover__12-19-6-alpha-0"};
259
210
  styleInject(css);
260
211
 
261
212
  var PopoverBody = function PopoverBody(_ref) {
@@ -329,40 +280,6 @@ var focusFirstDescendant = function focusFirstDescendant(element) {
329
280
  }
330
281
  return false;
331
282
  };
332
- var findAllFocusableElementsInside = function findAllFocusableElementsInside(containerElement) {
333
- var focusableElements = [];
334
- var traverseDOM = function traverseDOM(element) {
335
- if (isFocusable(element)) {
336
- focusableElements.push(element);
337
- }
338
- var _arr2 = Array.from(element.childNodes);
339
- for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
340
- var child = _arr2[_i2];
341
- traverseDOM(child);
342
- }
343
- };
344
- traverseDOM(containerElement);
345
- return focusableElements;
346
- };
347
- var trapFocus = function trapFocus(element) {
348
- var focusableEls = findAllFocusableElementsInside(element);
349
- var _focusableEls = _slicedToArray(focusableEls, 1),
350
- firstFocusableEl = _focusableEls[0];
351
- var lastFocusableEl = focusableEls.pop();
352
- element.addEventListener('keydown', function (event) {
353
- var isTabPressed = event.key === 'Tab';
354
- if (!isTabPressed) {
355
- return;
356
- }
357
- if (event.shiftKey && document.activeElement === firstFocusableEl) {
358
- lastFocusableEl.focus();
359
- event.preventDefault();
360
- } else if (document.activeElement === lastFocusableEl) {
361
- firstFocusableEl.focus();
362
- event.preventDefault();
363
- }
364
- });
365
- };
366
283
 
367
284
  var isScrollParent = function isScrollParent(element) {
368
285
  // Firefox wants us to check `-x` and `-y` variations as well
@@ -446,7 +363,6 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
446
363
  };
447
364
  _this.handleKeyDown = function (event) {
448
365
  if (event.key === 'Escape') {
449
- event.stopPropagation();
450
366
  _this.props.onEscapeAction(event);
451
367
  }
452
368
  };
@@ -492,16 +408,11 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
492
408
  value: function componentDidMount() {
493
409
  this.mounted = true;
494
410
  this.adjustPosition();
495
- if (this.popoverContentRef.current && this.props.role === 'dialog') {
411
+ if (this.popoverContentRef.current) {
496
412
  if (!focusFirstDescendant(this.popoverContentRef.current)) {
497
413
  this.popoverContentRef.current.tabIndex = 0;
498
414
  this.popoverContentRef.current.focus();
499
415
  }
500
- trapFocus(this.popoverContentRef.current);
501
- }
502
- if (this.props.role === 'tooltip') {
503
- this.popoverContentRef.current.tabIndex = 0;
504
- this.popoverContentRef.current.focus();
505
416
  }
506
417
  if (this.props.trackScroll) {
507
418
  document.addEventListener('scroll', this.onScroll);
@@ -563,13 +474,13 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
563
474
  }
564
475
  }), React.createElement("div", {
565
476
  ref: this.popoverContentRef,
477
+ "aria-modal": "true",
566
478
  style: _extends({
567
479
  position: 'absolute',
568
480
  pointerEvents: 'all'
569
481
  }, position),
570
482
  className: this.props.className,
571
483
  role: this.props.role,
572
- "aria-modal": this.props.role === 'dialog' ? 'true' : 'false',
573
484
  onKeyDown: this.handleKeyDown
574
485
  }, this.props.children));
575
486
  }
@@ -811,8 +722,7 @@ Popover.Position = PopoverPosition;
811
722
  Popover.defaultProps = {
812
723
  zIndex: 19999,
813
724
  outerActionEvents: ['mousedown', 'touchstart'],
814
- getPopoverPosition: 'bottomLeft',
815
- role: 'dialog'
725
+ getPopoverPosition: 'bottomLeft'
816
726
  };
817
727
 
818
728
  export default Popover;
package/dist/popover.js CHANGED
@@ -10,33 +10,6 @@ var globalConstants = require('@targetprocess/global-constants');
10
10
  var classNames = _interopDefault(require('classnames'));
11
11
  var ReactDOM = _interopDefault(require('react-dom'));
12
12
 
13
- function _iterableToArrayLimit(r, l) {
14
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
15
- if (null != t) {
16
- var e,
17
- n,
18
- i,
19
- u,
20
- a = [],
21
- f = !0,
22
- o = !1;
23
- try {
24
- if (i = (t = t.call(r)).next, 0 === l) {
25
- if (Object(t) !== t) return;
26
- f = !1;
27
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
28
- } catch (r) {
29
- o = !0, n = r;
30
- } finally {
31
- try {
32
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
33
- } finally {
34
- if (o) throw n;
35
- }
36
- }
37
- return a;
38
- }
39
- }
40
13
  function _classCallCheck(instance, Constructor) {
41
14
  if (!(instance instanceof Constructor)) {
42
15
  throw new TypeError("Cannot call a class as a function");
@@ -116,28 +89,6 @@ function _possibleConstructorReturn(self, call) {
116
89
  }
117
90
  return _assertThisInitialized(self);
118
91
  }
119
- function _slicedToArray(arr, i) {
120
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
121
- }
122
- function _arrayWithHoles(arr) {
123
- if (Array.isArray(arr)) return arr;
124
- }
125
- function _unsupportedIterableToArray(o, minLen) {
126
- if (!o) return;
127
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
128
- var n = Object.prototype.toString.call(o).slice(8, -1);
129
- if (n === "Object" && o.constructor) n = o.constructor.name;
130
- if (n === "Map" || n === "Set") return Array.from(o);
131
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
132
- }
133
- function _arrayLikeToArray(arr, len) {
134
- if (len == null || len > arr.length) len = arr.length;
135
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
136
- return arr2;
137
- }
138
- function _nonIterableRest() {
139
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
140
- }
141
92
  function _toPrimitive(input, hint) {
142
93
  if (typeof input !== "object" || input === null) return input;
143
94
  var prim = input[Symbol.toPrimitive];
@@ -261,8 +212,8 @@ function styleInject(css, ref) {
261
212
  }
262
213
  }
263
214
 
264
- var css = ".popover-body-container__popover__12-19-5-alpha-3 {\r\n -webkit-box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n border-radius: var(--BorderRadiusL, 4px);\r\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\r\n background: var(--BackgroundDefault, #FFFFFF);\r\n z-index: var(--ZIndexModal, 10001);\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n}\r\n\r\n.popover-body__popover__12-19-5-alpha-3 {\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n padding: var(--SpaceSM, 12px);\r\n font-size: var(--FontSizeDefault, 13px);\r\n color: var(--FontColorDefault, #000000);\r\n}\r\n\r\n.popover-body--no-padding__popover__12-19-5-alpha-3 {\r\n padding: 0;\r\n }\r\n\r\n.popover-tip__popover__12-19-5-alpha-3 {\r\n position: absolute;\r\n pointer-events: none;\r\n z-index: calc(var(--ZIndexModal, 10001) + 1);\r\n overflow: hidden;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-pack: center;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n}\r\n\r\n.popover-tip__popover__12-19-5-alpha-3:before {\r\n content: '';\r\n position: absolute;\r\n display: block;\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n background-color: var(--BackgroundDefault, #FFFFFF);\r\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\r\n /*\r\n geometry FTW\r\n\r\n 2*$popoverTipSize\r\n _______ _______\r\n | /|\\ |\r\n | / | \\ | $popoverTipSize\r\n | / | \\ |\r\n |/______|______\\|\r\n since tip is rotated 45 degrees, its width and height is a\r\n diagonal of a square with side=$popoverTipSize, thus diagonal\r\n is sqrt(2) * $popoverTipSize.\r\n sqrt(2) ~= 1.414, 1.4 used here to prevent too much rounding\r\n */\r\n width: 11.2px;\r\n height: 11.2px;\r\n -webkit-transform: rotate(45deg);\r\n transform: rotate(45deg);\r\n }\r\n\r\n.popover-tip--bottom__popover__12-19-5-alpha-3,\r\n .popover-tip--top__popover__12-19-5-alpha-3 {\r\n width: 100%;\r\n border-top: 1px var(--BackgroundDefault, #FFFFFF);\r\n border-bottom: 1px var(--BackgroundDefault, #FFFFFF);\r\n height: 9px;\r\n }\r\n\r\n.popover-tip--left__popover__12-19-5-alpha-3,\r\n .popover-tip--right__popover__12-19-5-alpha-3 {\r\n border-left: 1px var(--BackgroundDefault, #FFFFFF);\r\n border-right: 1px var(--BackgroundDefault, #FFFFFF);\r\n height: 100%;\r\n width: 9px;\r\n }\r\n\r\n/*\r\n To determine tip position, we need to rotate it\r\n along the \"tip\" point, after that, the \"tip\" point\r\n can be placed with exactly 50% offset from the origin\r\n so that it is centered.\r\n */\r\n\r\n.popover-tip--bottom__popover__12-19-5-alpha-3:before {\r\n -webkit-transform-origin: left top;\r\n transform-origin: left top;\r\n left: 50%;\r\n top: 0;\r\n }\r\n\r\n.popover-tip--top__popover__12-19-5-alpha-3:before {\r\n -webkit-transform-origin: right bottom;\r\n transform-origin: right bottom;\r\n right: 50%;\r\n bottom: 0;\r\n }\r\n\r\n.popover-tip--left__popover__12-19-5-alpha-3:before {\r\n -webkit-transform-origin: right top;\r\n transform-origin: right top;\r\n right: 0;\r\n top: 50%;\r\n }\r\n\r\n.popover-tip--right__popover__12-19-5-alpha-3:before {\r\n -webkit-transform-origin: left bottom;\r\n transform-origin: left bottom;\r\n left: 0;\r\n bottom: 50%;\r\n }\r\n";
265
- var styles = {"popover-body-container":"popover-body-container__popover__12-19-5-alpha-3","popover-body":"popover-body__popover__12-19-5-alpha-3","popover-body--no-padding":"popover-body--no-padding__popover__12-19-5-alpha-3","popover-tip":"popover-tip__popover__12-19-5-alpha-3","popover-tip--bottom":"popover-tip--bottom__popover__12-19-5-alpha-3","popover-tip--top":"popover-tip--top__popover__12-19-5-alpha-3","popover-tip--left":"popover-tip--left__popover__12-19-5-alpha-3","popover-tip--right":"popover-tip--right__popover__12-19-5-alpha-3"};
215
+ var css = ".popover-body-container__popover__12-19-6-alpha-0 {\r\n -webkit-box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n border-radius: var(--BorderRadiusL, 4px);\r\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\r\n background: var(--BackgroundDefault, #FFFFFF);\r\n z-index: var(--ZIndexModal, 10001);\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n}\r\n\r\n.popover-body__popover__12-19-6-alpha-0 {\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n padding: var(--SpaceSM, 12px);\r\n font-size: var(--FontSizeDefault, 13px);\r\n color: var(--FontColorDefault, #000000);\r\n}\r\n\r\n.popover-body--no-padding__popover__12-19-6-alpha-0 {\r\n padding: 0;\r\n }\r\n\r\n.popover-tip__popover__12-19-6-alpha-0 {\r\n position: absolute;\r\n pointer-events: none;\r\n z-index: calc(var(--ZIndexModal, 10001) + 1);\r\n overflow: hidden;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-pack: center;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n}\r\n\r\n.popover-tip__popover__12-19-6-alpha-0:before {\r\n content: '';\r\n position: absolute;\r\n display: block;\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n background-color: var(--BackgroundDefault, #FFFFFF);\r\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\r\n /*\r\n geometry FTW\r\n\r\n 2*$popoverTipSize\r\n _______ _______\r\n | /|\\ |\r\n | / | \\ | $popoverTipSize\r\n | / | \\ |\r\n |/______|______\\|\r\n since tip is rotated 45 degrees, its width and height is a\r\n diagonal of a square with side=$popoverTipSize, thus diagonal\r\n is sqrt(2) * $popoverTipSize.\r\n sqrt(2) ~= 1.414, 1.4 used here to prevent too much rounding\r\n */\r\n width: 11.2px;\r\n height: 11.2px;\r\n -webkit-transform: rotate(45deg);\r\n transform: rotate(45deg);\r\n }\r\n\r\n.popover-tip--bottom__popover__12-19-6-alpha-0,\r\n .popover-tip--top__popover__12-19-6-alpha-0 {\r\n width: 100%;\r\n border-top: 1px var(--BackgroundDefault, #FFFFFF);\r\n border-bottom: 1px var(--BackgroundDefault, #FFFFFF);\r\n height: 9px;\r\n }\r\n\r\n.popover-tip--left__popover__12-19-6-alpha-0,\r\n .popover-tip--right__popover__12-19-6-alpha-0 {\r\n border-left: 1px var(--BackgroundDefault, #FFFFFF);\r\n border-right: 1px var(--BackgroundDefault, #FFFFFF);\r\n height: 100%;\r\n width: 9px;\r\n }\r\n\r\n/*\r\n To determine tip position, we need to rotate it\r\n along the \"tip\" point, after that, the \"tip\" point\r\n can be placed with exactly 50% offset from the origin\r\n so that it is centered.\r\n */\r\n\r\n.popover-tip--bottom__popover__12-19-6-alpha-0:before {\r\n -webkit-transform-origin: left top;\r\n transform-origin: left top;\r\n left: 50%;\r\n top: 0;\r\n }\r\n\r\n.popover-tip--top__popover__12-19-6-alpha-0:before {\r\n -webkit-transform-origin: right bottom;\r\n transform-origin: right bottom;\r\n right: 50%;\r\n bottom: 0;\r\n }\r\n\r\n.popover-tip--left__popover__12-19-6-alpha-0:before {\r\n -webkit-transform-origin: right top;\r\n transform-origin: right top;\r\n right: 0;\r\n top: 50%;\r\n }\r\n\r\n.popover-tip--right__popover__12-19-6-alpha-0:before {\r\n -webkit-transform-origin: left bottom;\r\n transform-origin: left bottom;\r\n left: 0;\r\n bottom: 50%;\r\n }\r\n";
216
+ var styles = {"popover-body-container":"popover-body-container__popover__12-19-6-alpha-0","popover-body":"popover-body__popover__12-19-6-alpha-0","popover-body--no-padding":"popover-body--no-padding__popover__12-19-6-alpha-0","popover-tip":"popover-tip__popover__12-19-6-alpha-0","popover-tip--bottom":"popover-tip--bottom__popover__12-19-6-alpha-0","popover-tip--top":"popover-tip--top__popover__12-19-6-alpha-0","popover-tip--left":"popover-tip--left__popover__12-19-6-alpha-0","popover-tip--right":"popover-tip--right__popover__12-19-6-alpha-0"};
266
217
  styleInject(css);
267
218
 
268
219
  var PopoverBody = function PopoverBody(_ref) {
@@ -336,40 +287,6 @@ var focusFirstDescendant = function focusFirstDescendant(element) {
336
287
  }
337
288
  return false;
338
289
  };
339
- var findAllFocusableElementsInside = function findAllFocusableElementsInside(containerElement) {
340
- var focusableElements = [];
341
- var traverseDOM = function traverseDOM(element) {
342
- if (isFocusable(element)) {
343
- focusableElements.push(element);
344
- }
345
- var _arr2 = Array.from(element.childNodes);
346
- for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
347
- var child = _arr2[_i2];
348
- traverseDOM(child);
349
- }
350
- };
351
- traverseDOM(containerElement);
352
- return focusableElements;
353
- };
354
- var trapFocus = function trapFocus(element) {
355
- var focusableEls = findAllFocusableElementsInside(element);
356
- var _focusableEls = _slicedToArray(focusableEls, 1),
357
- firstFocusableEl = _focusableEls[0];
358
- var lastFocusableEl = focusableEls.pop();
359
- element.addEventListener('keydown', function (event) {
360
- var isTabPressed = event.key === 'Tab';
361
- if (!isTabPressed) {
362
- return;
363
- }
364
- if (event.shiftKey && document.activeElement === firstFocusableEl) {
365
- lastFocusableEl.focus();
366
- event.preventDefault();
367
- } else if (document.activeElement === lastFocusableEl) {
368
- firstFocusableEl.focus();
369
- event.preventDefault();
370
- }
371
- });
372
- };
373
290
 
374
291
  var isScrollParent = function isScrollParent(element) {
375
292
  // Firefox wants us to check `-x` and `-y` variations as well
@@ -453,7 +370,6 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
453
370
  };
454
371
  _this.handleKeyDown = function (event) {
455
372
  if (event.key === 'Escape') {
456
- event.stopPropagation();
457
373
  _this.props.onEscapeAction(event);
458
374
  }
459
375
  };
@@ -499,16 +415,11 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
499
415
  value: function componentDidMount() {
500
416
  this.mounted = true;
501
417
  this.adjustPosition();
502
- if (this.popoverContentRef.current && this.props.role === 'dialog') {
418
+ if (this.popoverContentRef.current) {
503
419
  if (!focusFirstDescendant(this.popoverContentRef.current)) {
504
420
  this.popoverContentRef.current.tabIndex = 0;
505
421
  this.popoverContentRef.current.focus();
506
422
  }
507
- trapFocus(this.popoverContentRef.current);
508
- }
509
- if (this.props.role === 'tooltip') {
510
- this.popoverContentRef.current.tabIndex = 0;
511
- this.popoverContentRef.current.focus();
512
423
  }
513
424
  if (this.props.trackScroll) {
514
425
  document.addEventListener('scroll', this.onScroll);
@@ -570,13 +481,13 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
570
481
  }
571
482
  }), React__default.createElement("div", {
572
483
  ref: this.popoverContentRef,
484
+ "aria-modal": "true",
573
485
  style: _extends({
574
486
  position: 'absolute',
575
487
  pointerEvents: 'all'
576
488
  }, position),
577
489
  className: this.props.className,
578
490
  role: this.props.role,
579
- "aria-modal": this.props.role === 'dialog' ? 'true' : 'false',
580
491
  onKeyDown: this.handleKeyDown
581
492
  }, this.props.children));
582
493
  }
@@ -818,8 +729,7 @@ Popover.Position = PopoverPosition;
818
729
  Popover.defaultProps = {
819
730
  zIndex: 19999,
820
731
  outerActionEvents: ['mousedown', 'touchstart'],
821
- getPopoverPosition: 'bottomLeft',
822
- role: 'dialog'
732
+ getPopoverPosition: 'bottomLeft'
823
733
  };
824
734
 
825
735
  exports.Popover = Popover;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@targetprocess/popover",
3
- "version": "12.19.5-alpha.3",
3
+ "version": "12.19.6-alpha.0",
4
4
  "description": "",
5
5
  "main": "dist/popover.js",
6
6
  "module": "dist/popover.es.js",
@@ -12,7 +12,7 @@
12
12
  "prepack": "node -r ../../.ts-node.js ../../config/rollup.config.js ."
13
13
  },
14
14
  "dependencies": {
15
- "@targetprocess/global-constants": "^12.7.3",
15
+ "@targetprocess/global-constants": "^12.19.6-alpha.0",
16
16
  "classnames": "^2.2.5",
17
17
  "prop-types": "^15.6.0",
18
18
  "react": "^16.7.0",
@@ -21,5 +21,5 @@
21
21
  "publishConfig": {
22
22
  "access": "public"
23
23
  },
24
- "gitHead": "6acc350de401d2739358a5a64f0a5e923e9a7c08"
24
+ "gitHead": "09c2de637be6694aef61a9dbe734ecb9cc9e8e59"
25
25
  }