@targetprocess/popover 12.19.2-alpha.5 → 12.19.3-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
@@ -1,4 +1,4 @@
1
- import React, {createRef} from 'react'
1
+ import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import {PopoverPosition} from './PopoverPosition'
4
4
  import {PopoverBody} from './PopoverBody'
@@ -83,7 +83,6 @@ export type PopoverProps = {
83
83
  showTip?: boolean
84
84
  className?: string
85
85
  trackScroll?: boolean
86
- role?: 'tooltip' | 'dialog'
87
86
  }
88
87
 
89
88
  export type PopoverState = {
@@ -121,8 +120,7 @@ export class Popover extends React.Component<PopoverProps, PopoverState> {
121
120
  noPadding: PropTypes.bool,
122
121
  zIndex: PropTypes.number,
123
122
  trackScroll: PropTypes.bool,
124
- children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
125
- role: PropTypes.oneOf(['tooltip', 'dialog'])
123
+ children: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
126
124
  }
127
125
 
128
126
  static defaultProps = {
@@ -148,30 +146,16 @@ export class Popover extends React.Component<PopoverProps, PopoverState> {
148
146
  }
149
147
  }
150
148
 
151
- childrenRef = createRef<HTMLElement>()
152
-
153
149
  render() {
154
150
  const isOpen = typeof this.props.isOpen === 'undefined' ? this.state.isOpen : this.props.isOpen
155
151
  const children =
156
152
  typeof this.props.children === 'function'
157
- ? this.props.children({isOpen, setOpened: this.setOpened, ref: this.childrenRef})
153
+ ? this.props.children({isOpen, setOpened: this.setOpened})
158
154
  : this.props.children
159
- const childrenWithRef = React.Children.map(children, child =>
160
- React.cloneElement(child, {ref: this.childrenRef})
161
- )
162
155
 
163
156
  return (
164
- <StatelessPopover
165
- {...this.props}
166
- onOuterAction={this.onOuterAction}
167
- onEscapeAction={() => {
168
- this.setOpened(false)
169
- this.childrenRef.current?.focus()
170
- }}
171
- isOpen={isOpen}
172
- role={this.props.role}
173
- >
174
- {childrenWithRef}
157
+ <StatelessPopover {...this.props} onOuterAction={this.onOuterAction} isOpen={isOpen}>
158
+ {children}
175
159
  </StatelessPopover>
176
160
  )
177
161
  }
@@ -18,8 +18,6 @@ type PopoverContainerProps = {
18
18
  getPopoverPosition: GetPopoverPositionType
19
19
  showTip?: boolean
20
20
  zIndex: number
21
- role?: 'tooltip' | 'dialog'
22
- onEscapeAction: () => void
23
21
  }
24
22
 
25
23
  type PopoverContainerState = {
@@ -88,9 +86,7 @@ export class PopoverContainer extends React.Component<
88
86
  positioningTarget: PropTypes.object,
89
87
  containerElement: PropTypes.object,
90
88
  className: PropTypes.string,
91
- trackScroll: PropTypes.bool,
92
- role: PropTypes.oneOf(['tooltip', 'dialog']),
93
- onEscapeAction: PropTypes.func
89
+ trackScroll: PropTypes.bool
94
90
  }
95
91
 
96
92
  static defaultProps = {
@@ -153,10 +149,6 @@ export class PopoverContainer extends React.Component<
153
149
  this.mounted = true
154
150
  this.adjustPosition()
155
151
 
156
- if (this.popoverContentRef) {
157
- this.popoverContentRef.current.focus()
158
- }
159
-
160
152
  if (this.props.trackScroll) {
161
153
  document.addEventListener('scroll', this.onScroll)
162
154
  window.addEventListener('resize', this.onResize)
@@ -202,11 +194,6 @@ export class PopoverContainer extends React.Component<
202
194
 
203
195
  return null
204
196
  }
205
- handleKeyDown = event => {
206
- if (event.key === 'Escape') {
207
- this.props.onEscapeAction()
208
- }
209
- }
210
197
 
211
198
  render() {
212
199
  const getPopoverPosition =
@@ -261,16 +248,12 @@ export class PopoverContainer extends React.Component<
261
248
  )}
262
249
  <div
263
250
  ref={this.popoverContentRef}
264
- aria-modal="true"
265
251
  style={{
266
252
  position: 'absolute',
267
253
  pointerEvents: 'all',
268
254
  ...position
269
255
  }}
270
256
  className={this.props.className}
271
- role={this.props.role}
272
- tabIndex={0}
273
- onKeyDown={this.handleKeyDown}
274
257
  >
275
258
  {this.props.children}
276
259
  </div>
@@ -17,8 +17,6 @@ export type StatelessPopoverProps = {
17
17
  outerActionEvents?: string[]
18
18
  onOuterAction?: (evt: Event) => void
19
19
  trackScroll?: boolean
20
- role?: 'tooltip' | 'dialog'
21
- onEscapeAction: () => void
22
20
  }
23
21
 
24
22
  export class StatelessPopover extends React.Component<StatelessPopoverProps> {
@@ -42,8 +40,6 @@ export class StatelessPopover extends React.Component<StatelessPopoverProps> {
42
40
  showTip={props.showTip}
43
41
  zIndex={props.zIndex}
44
42
  trackScroll={props.trackScroll}
45
- role={this.props.role}
46
- onEscapeAction={this.props.onEscapeAction}
47
43
  >
48
44
  {props.body}
49
45
  </PopoverContainer>
package/dist/Popover.d.ts CHANGED
@@ -79,7 +79,6 @@ export declare type PopoverProps = {
79
79
  showTip?: boolean;
80
80
  className?: string;
81
81
  trackScroll?: boolean;
82
- role?: 'tooltip' | 'dialog';
83
82
  };
84
83
  export declare type PopoverState = {
85
84
  isOpen: boolean;
@@ -112,7 +111,6 @@ export declare class Popover extends React.Component<PopoverProps, PopoverState>
112
111
  zIndex: PropTypes.Requireable<number>;
113
112
  trackScroll: PropTypes.Requireable<boolean>;
114
113
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
115
- role: PropTypes.Requireable<string>;
116
114
  };
117
115
  static defaultProps: {
118
116
  zIndex: number;
@@ -124,6 +122,5 @@ export declare class Popover extends React.Component<PopoverProps, PopoverState>
124
122
  };
125
123
  setOpened: (isOpen: boolean) => void;
126
124
  onOuterAction: (event: Event) => void;
127
- childrenRef: React.RefObject<HTMLElement>;
128
125
  render(): JSX.Element;
129
126
  }
@@ -11,8 +11,6 @@ declare type PopoverContainerProps = {
11
11
  getPopoverPosition: GetPopoverPositionType;
12
12
  showTip?: boolean;
13
13
  zIndex: number;
14
- role?: 'tooltip' | 'dialog';
15
- onEscapeAction: () => void;
16
14
  };
17
15
  declare type PopoverContainerState = {
18
16
  adjusted: boolean;
@@ -28,8 +26,6 @@ export declare class PopoverContainer extends React.Component<PopoverContainerPr
28
26
  containerElement: PropTypes.Requireable<object>;
29
27
  className: PropTypes.Requireable<string>;
30
28
  trackScroll: PropTypes.Requireable<boolean>;
31
- role: PropTypes.Requireable<string>;
32
- onEscapeAction: PropTypes.Requireable<(...args: any[]) => any>;
33
29
  };
34
30
  static defaultProps: {
35
31
  trackScroll: boolean;
@@ -44,7 +40,6 @@ export declare class PopoverContainer extends React.Component<PopoverContainerPr
44
40
  componentDidUpdate(previousProps: any): void;
45
41
  componentWillUnmount(): void;
46
42
  getPopoverTipPosition: (popoverPosition: any, containerPosition: any) => "top" | "bottom" | "right" | "left";
47
- handleKeyDown: (event: any) => void;
48
43
  render(): JSX.Element;
49
44
  }
50
45
  export {};
@@ -12,8 +12,6 @@ export declare type StatelessPopoverProps = {
12
12
  outerActionEvents?: string[];
13
13
  onOuterAction?: (evt: Event) => void;
14
14
  trackScroll?: boolean;
15
- role?: 'tooltip' | 'dialog';
16
- onEscapeAction: () => void;
17
15
  };
18
16
  export declare class StatelessPopover extends React.Component<StatelessPopoverProps> {
19
17
  renderPortalContent({ props, container, positioningTarget }: {
@@ -1,4 +1,4 @@
1
- import React, { createRef } from 'react';
1
+ import React from 'react';
2
2
  import { SpaceXS } from '@targetprocess/global-constants';
3
3
  import classNames from 'classnames';
4
4
  import ReactDOM from 'react-dom';
@@ -205,8 +205,8 @@ function styleInject(css, ref) {
205
205
  }
206
206
  }
207
207
 
208
- var css = ".popover-body-container__popover__12-19-2-alpha-5 {\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-2-alpha-5 {\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-2-alpha-5 {\r\n padding: 0;\r\n }\r\n\r\n.popover-tip__popover__12-19-2-alpha-5 {\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-2-alpha-5: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-2-alpha-5,\r\n .popover-tip--top__popover__12-19-2-alpha-5 {\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-2-alpha-5,\r\n .popover-tip--right__popover__12-19-2-alpha-5 {\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-2-alpha-5: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-2-alpha-5: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-2-alpha-5: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-2-alpha-5: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-2-alpha-5","popover-body":"popover-body__popover__12-19-2-alpha-5","popover-body--no-padding":"popover-body--no-padding__popover__12-19-2-alpha-5","popover-tip":"popover-tip__popover__12-19-2-alpha-5","popover-tip--bottom":"popover-tip--bottom__popover__12-19-2-alpha-5","popover-tip--top":"popover-tip--top__popover__12-19-2-alpha-5","popover-tip--left":"popover-tip--left__popover__12-19-2-alpha-5","popover-tip--right":"popover-tip--right__popover__12-19-2-alpha-5"};
208
+ var css = ".popover-body-container__popover__12-19-3-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-3-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-3-alpha-0 {\r\n padding: 0;\r\n }\r\n\r\n.popover-tip__popover__12-19-3-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-3-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-3-alpha-0,\r\n .popover-tip--top__popover__12-19-3-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-3-alpha-0,\r\n .popover-tip--right__popover__12-19-3-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-3-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-3-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-3-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-3-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-3-alpha-0","popover-body":"popover-body__popover__12-19-3-alpha-0","popover-body--no-padding":"popover-body--no-padding__popover__12-19-3-alpha-0","popover-tip":"popover-tip__popover__12-19-3-alpha-0","popover-tip--bottom":"popover-tip--bottom__popover__12-19-3-alpha-0","popover-tip--top":"popover-tip--top__popover__12-19-3-alpha-0","popover-tip--left":"popover-tip--left__popover__12-19-3-alpha-0","popover-tip--right":"popover-tip--right__popover__12-19-3-alpha-0"};
210
210
  styleInject(css);
211
211
 
212
212
  var PopoverBody = function PopoverBody(_ref) {
@@ -323,11 +323,6 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
323
323
  }
324
324
  return null;
325
325
  };
326
- _this.handleKeyDown = function (event) {
327
- if (event.key === 'Escape') {
328
- _this.props.onEscapeAction();
329
- }
330
- };
331
326
  return _this;
332
327
  }
333
328
  _createClass(PopoverContainer, [{
@@ -370,9 +365,6 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
370
365
  value: function componentDidMount() {
371
366
  this.mounted = true;
372
367
  this.adjustPosition();
373
- if (this.popoverContentRef) {
374
- this.popoverContentRef.current.focus();
375
- }
376
368
  if (this.props.trackScroll) {
377
369
  document.addEventListener('scroll', this.onScroll);
378
370
  window.addEventListener('resize', this.onResize);
@@ -433,15 +425,11 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
433
425
  }
434
426
  }), React.createElement("div", {
435
427
  ref: this.popoverContentRef,
436
- "aria-modal": "true",
437
428
  style: _extends({
438
429
  position: 'absolute',
439
430
  pointerEvents: 'all'
440
431
  }, position),
441
- className: this.props.className,
442
- role: this.props.role,
443
- tabIndex: 0,
444
- onKeyDown: this.handleKeyDown
432
+ className: this.props.className
445
433
  }, this.props.children));
446
434
  }
447
435
  }]);
@@ -575,9 +563,7 @@ var StatelessPopover = /*#__PURE__*/function (_React$Component) {
575
563
  positioningTarget: positioningTarget,
576
564
  showTip: props.showTip,
577
565
  zIndex: props.zIndex,
578
- trackScroll: props.trackScroll,
579
- role: this.props.role,
580
- onEscapeAction: this.props.onEscapeAction
566
+ trackScroll: props.trackScroll
581
567
  }, props.body);
582
568
  if (!props.inline) {
583
569
  return ReactDOM.createPortal(popoverContent, container);
@@ -641,34 +627,20 @@ var Popover = /*#__PURE__*/function (_React$Component) {
641
627
  _this.props.onOuterAction(event);
642
628
  }
643
629
  };
644
- _this.childrenRef = createRef();
645
630
  return _this;
646
631
  }
647
632
  _createClass(Popover, [{
648
633
  key: "render",
649
634
  value: function render() {
650
- var _this2 = this;
651
635
  var isOpen = typeof this.props.isOpen === 'undefined' ? this.state.isOpen : this.props.isOpen;
652
636
  var children = typeof this.props.children === 'function' ? this.props.children({
653
637
  isOpen: isOpen,
654
- setOpened: this.setOpened,
655
- ref: this.childrenRef
638
+ setOpened: this.setOpened
656
639
  }) : this.props.children;
657
- var childrenWithRef = React.Children.map(children, function (child) {
658
- return React.cloneElement(child, {
659
- ref: _this2.childrenRef
660
- });
661
- });
662
640
  return React.createElement(StatelessPopover, Object.assign({}, this.props, {
663
641
  onOuterAction: this.onOuterAction,
664
- onEscapeAction: function onEscapeAction() {
665
- var _a;
666
- _this2.setOpened(false);
667
- (_a = _this2.childrenRef.current) === null || _a === void 0 ? void 0 : _a.focus();
668
- },
669
- isOpen: isOpen,
670
- role: this.props.role
671
- }), childrenWithRef);
642
+ isOpen: isOpen
643
+ }), children);
672
644
  }
673
645
  }]);
674
646
  return Popover;
package/dist/popover.js CHANGED
@@ -4,8 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
6
 
7
- var React = require('react');
8
- var React__default = _interopDefault(React);
7
+ var React = _interopDefault(require('react'));
9
8
  var globalConstants = require('@targetprocess/global-constants');
10
9
  var classNames = _interopDefault(require('classnames'));
11
10
  var ReactDOM = _interopDefault(require('react-dom'));
@@ -212,8 +211,8 @@ function styleInject(css, ref) {
212
211
  }
213
212
  }
214
213
 
215
- var css = ".popover-body-container__popover__12-19-2-alpha-5 {\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-2-alpha-5 {\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-2-alpha-5 {\r\n padding: 0;\r\n }\r\n\r\n.popover-tip__popover__12-19-2-alpha-5 {\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-2-alpha-5: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-2-alpha-5,\r\n .popover-tip--top__popover__12-19-2-alpha-5 {\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-2-alpha-5,\r\n .popover-tip--right__popover__12-19-2-alpha-5 {\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-2-alpha-5: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-2-alpha-5: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-2-alpha-5: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-2-alpha-5: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-2-alpha-5","popover-body":"popover-body__popover__12-19-2-alpha-5","popover-body--no-padding":"popover-body--no-padding__popover__12-19-2-alpha-5","popover-tip":"popover-tip__popover__12-19-2-alpha-5","popover-tip--bottom":"popover-tip--bottom__popover__12-19-2-alpha-5","popover-tip--top":"popover-tip--top__popover__12-19-2-alpha-5","popover-tip--left":"popover-tip--left__popover__12-19-2-alpha-5","popover-tip--right":"popover-tip--right__popover__12-19-2-alpha-5"};
214
+ var css = ".popover-body-container__popover__12-19-3-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-3-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-3-alpha-0 {\r\n padding: 0;\r\n }\r\n\r\n.popover-tip__popover__12-19-3-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-3-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-3-alpha-0,\r\n .popover-tip--top__popover__12-19-3-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-3-alpha-0,\r\n .popover-tip--right__popover__12-19-3-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-3-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-3-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-3-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-3-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";
215
+ var styles = {"popover-body-container":"popover-body-container__popover__12-19-3-alpha-0","popover-body":"popover-body__popover__12-19-3-alpha-0","popover-body--no-padding":"popover-body--no-padding__popover__12-19-3-alpha-0","popover-tip":"popover-tip__popover__12-19-3-alpha-0","popover-tip--bottom":"popover-tip--bottom__popover__12-19-3-alpha-0","popover-tip--top":"popover-tip--top__popover__12-19-3-alpha-0","popover-tip--left":"popover-tip--left__popover__12-19-3-alpha-0","popover-tip--right":"popover-tip--right__popover__12-19-3-alpha-0"};
217
216
  styleInject(css);
218
217
 
219
218
  var PopoverBody = function PopoverBody(_ref) {
@@ -221,9 +220,9 @@ var PopoverBody = function PopoverBody(_ref) {
221
220
  className = _ref.className,
222
221
  classNameBody = _ref.classNameBody,
223
222
  noPadding = _ref.noPadding;
224
- return React__default.createElement("div", {
223
+ return React.createElement("div", {
225
224
  className: classNames(className, styles['popover-body-container'])
226
- }, React__default.createElement("div", {
225
+ }, React.createElement("div", {
227
226
  className: classNames(classNameBody, styles['popover-body'], noPadding && styles['popover-body--no-padding'])
228
227
  }, children));
229
228
  };
@@ -303,7 +302,7 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
303
302
  _classCallCheck(this, PopoverContainer);
304
303
  _this = _possibleConstructorReturn(this, _getPrototypeOf(PopoverContainer).apply(this, arguments));
305
304
  _this.mounted = false;
306
- _this.popoverContentRef = React__default.createRef();
305
+ _this.popoverContentRef = React.createRef();
307
306
  _this.state = {
308
307
  adjusted: false,
309
308
  positionX: 0,
@@ -330,11 +329,6 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
330
329
  }
331
330
  return null;
332
331
  };
333
- _this.handleKeyDown = function (event) {
334
- if (event.key === 'Escape') {
335
- _this.props.onEscapeAction();
336
- }
337
- };
338
332
  return _this;
339
333
  }
340
334
  _createClass(PopoverContainer, [{
@@ -377,9 +371,6 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
377
371
  value: function componentDidMount() {
378
372
  this.mounted = true;
379
373
  this.adjustPosition();
380
- if (this.popoverContentRef) {
381
- this.popoverContentRef.current.focus();
382
- }
383
374
  if (this.props.trackScroll) {
384
375
  document.addEventListener('scroll', this.onScroll);
385
376
  window.addEventListener('resize', this.onResize);
@@ -420,7 +411,7 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
420
411
  };
421
412
  var tipPosition = this.getPopoverTipPosition(position, containerPosition);
422
413
  // FIXME: position.top cast to number, because value may be not a number
423
- return React__default.createElement("div", {
414
+ return React.createElement("div", {
424
415
  style: _extends({
425
416
  position: 'absolute'
426
417
  }, containerPosition, {
@@ -430,7 +421,7 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
430
421
  transitionProperty: 'opacity',
431
422
  opacity: this.state.adjusted ? 1 : 0
432
423
  })
433
- }, this.props.showTip && tipPosition && React__default.createElement("div", {
424
+ }, this.props.showTip && tipPosition && React.createElement("div", {
434
425
  className: classNames(styles['popover-tip'], styles["popover-tip--".concat(tipPosition)], 'popover-tip'),
435
426
  style: {
436
427
  top: tipPosition === 'bottom' && position.top - 8,
@@ -438,22 +429,18 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
438
429
  left: tipPosition === 'right' && position.left - 8,
439
430
  right: tipPosition === 'left' && position.right - 8
440
431
  }
441
- }), React__default.createElement("div", {
432
+ }), React.createElement("div", {
442
433
  ref: this.popoverContentRef,
443
- "aria-modal": "true",
444
434
  style: _extends({
445
435
  position: 'absolute',
446
436
  pointerEvents: 'all'
447
437
  }, position),
448
- className: this.props.className,
449
- role: this.props.role,
450
- tabIndex: 0,
451
- onKeyDown: this.handleKeyDown
438
+ className: this.props.className
452
439
  }, this.props.children));
453
440
  }
454
441
  }]);
455
442
  return PopoverContainer;
456
- }(React__default.Component);
443
+ }(React.Component);
457
444
  PopoverContainer.defaultProps = {
458
445
  trackScroll: true
459
446
  };
@@ -467,7 +454,7 @@ var PositioningTarget = /*#__PURE__*/function (_React$Component) {
467
454
  _this.state = {
468
455
  target: null
469
456
  };
470
- _this.targetRef = React__default.createRef();
457
+ _this.targetRef = React.createRef();
471
458
  return _this;
472
459
  }
473
460
  _createClass(PositioningTarget, [{
@@ -480,13 +467,13 @@ var PositioningTarget = /*#__PURE__*/function (_React$Component) {
480
467
  }, {
481
468
  key: "render",
482
469
  value: function render() {
483
- return React__default.createElement("div", {
470
+ return React.createElement("div", {
484
471
  ref: this.targetRef
485
472
  }, this.props.children(this.state.target));
486
473
  }
487
474
  }]);
488
475
  return PositioningTarget;
489
- }(React__default.Component);
476
+ }(React.Component);
490
477
 
491
478
  var BodyDomNode = /*#__PURE__*/function (_React$Component) {
492
479
  _inherits(BodyDomNode, _React$Component);
@@ -551,7 +538,7 @@ var BodyDomNode = /*#__PURE__*/function (_React$Component) {
551
538
  }
552
539
  }]);
553
540
  return BodyDomNode;
554
- }(React__default.Component);
541
+ }(React.Component);
555
542
  BodyDomNode.defaultProps = {
556
543
  containerElement: document.body
557
544
  };
@@ -573,7 +560,7 @@ var StatelessPopover = /*#__PURE__*/function (_React$Component) {
573
560
  var props = _ref.props,
574
561
  container = _ref.container,
575
562
  positioningTarget = _ref.positioningTarget;
576
- var popoverContent = React__default.createElement(PopoverContainer, {
563
+ var popoverContent = React.createElement(PopoverContainer, {
577
564
  key: "popover-portal",
578
565
  getPopoverPosition: this.props.getPopoverPosition,
579
566
  relativeToParent: props.inline,
@@ -582,9 +569,7 @@ var StatelessPopover = /*#__PURE__*/function (_React$Component) {
582
569
  positioningTarget: positioningTarget,
583
570
  showTip: props.showTip,
584
571
  zIndex: props.zIndex,
585
- trackScroll: props.trackScroll,
586
- role: this.props.role,
587
- onEscapeAction: this.props.onEscapeAction
572
+ trackScroll: props.trackScroll
588
573
  }, props.body);
589
574
  if (!props.inline) {
590
575
  return ReactDOM.createPortal(popoverContent, container);
@@ -601,7 +586,7 @@ var StatelessPopover = /*#__PURE__*/function (_React$Component) {
601
586
  return this.props.inline ? this.renderPortalContent({
602
587
  props: this.props,
603
588
  positioningTarget: positioningTarget
604
- }) : React__default.createElement(BodyDomNode, {
589
+ }) : React.createElement(BodyDomNode, {
605
590
  onOuterAction: this.props.onOuterAction,
606
591
  outerActionEvents: this.props.outerActionEvents,
607
592
  positioningTarget: positioningTarget,
@@ -618,13 +603,13 @@ var StatelessPopover = /*#__PURE__*/function (_React$Component) {
618
603
  key: "render",
619
604
  value: function render() {
620
605
  var _this3 = this;
621
- return React__default.createElement(PositioningTarget, null, function (positioningTarget) {
622
- return positioningTarget ? React__default.createElement(React__default.Fragment, null, _this3.props.children, _this3.renderPortal(positioningTarget)) : null;
606
+ return React.createElement(PositioningTarget, null, function (positioningTarget) {
607
+ return positioningTarget ? React.createElement(React.Fragment, null, _this3.props.children, _this3.renderPortal(positioningTarget)) : null;
623
608
  });
624
609
  }
625
610
  }]);
626
611
  return StatelessPopover;
627
- }(React__default.Component);
612
+ }(React.Component);
628
613
 
629
614
  var Popover = /*#__PURE__*/function (_React$Component) {
630
615
  _inherits(Popover, _React$Component);
@@ -648,38 +633,24 @@ var Popover = /*#__PURE__*/function (_React$Component) {
648
633
  _this.props.onOuterAction(event);
649
634
  }
650
635
  };
651
- _this.childrenRef = React.createRef();
652
636
  return _this;
653
637
  }
654
638
  _createClass(Popover, [{
655
639
  key: "render",
656
640
  value: function render() {
657
- var _this2 = this;
658
641
  var isOpen = typeof this.props.isOpen === 'undefined' ? this.state.isOpen : this.props.isOpen;
659
642
  var children = typeof this.props.children === 'function' ? this.props.children({
660
643
  isOpen: isOpen,
661
- setOpened: this.setOpened,
662
- ref: this.childrenRef
644
+ setOpened: this.setOpened
663
645
  }) : this.props.children;
664
- var childrenWithRef = React__default.Children.map(children, function (child) {
665
- return React__default.cloneElement(child, {
666
- ref: _this2.childrenRef
667
- });
668
- });
669
- return React__default.createElement(StatelessPopover, Object.assign({}, this.props, {
646
+ return React.createElement(StatelessPopover, Object.assign({}, this.props, {
670
647
  onOuterAction: this.onOuterAction,
671
- onEscapeAction: function onEscapeAction() {
672
- var _a;
673
- _this2.setOpened(false);
674
- (_a = _this2.childrenRef.current) === null || _a === void 0 ? void 0 : _a.focus();
675
- },
676
- isOpen: isOpen,
677
- role: this.props.role
678
- }), childrenWithRef);
648
+ isOpen: isOpen
649
+ }), children);
679
650
  }
680
651
  }]);
681
652
  return Popover;
682
- }(React__default.Component);
653
+ }(React.Component);
683
654
  Popover.Body = PopoverBody;
684
655
  Popover.Position = PopoverPosition;
685
656
  Popover.defaultProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@targetprocess/popover",
3
- "version": "12.19.2-alpha.5",
3
+ "version": "12.19.3-alpha.0",
4
4
  "description": "",
5
5
  "main": "dist/popover.js",
6
6
  "module": "dist/popover.es.js",
@@ -21,5 +21,5 @@
21
21
  "publishConfig": {
22
22
  "access": "public"
23
23
  },
24
- "gitHead": "9728be04f184b73370b50f68df8b5b18d7ecddab"
24
+ "gitHead": "592b849036fd066b2fe9d9ea69079d0e81bb406b"
25
25
  }