@targetprocess/popover 12.21.1-alpha.0 → 12.22.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
@@ -84,11 +84,11 @@ export type PopoverProps = {
84
84
  body?: React.ReactNode
85
85
  zIndex: number
86
86
  showTip?: boolean
87
+ classNameTip?: string
87
88
  className?: string
88
89
  trackScroll?: boolean
89
90
  role?: 'tooltip' | 'dialog'
90
91
  trapFocus?: boolean
91
- darkMode?: boolean
92
92
  }
93
93
 
94
94
  export type PopoverState = {
@@ -128,8 +128,7 @@ export class Popover extends React.Component<PopoverProps, PopoverState> {
128
128
  trackScroll: PropTypes.bool,
129
129
  children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
130
130
  role: PropTypes.oneOf(['tooltip', 'dialog']),
131
- trapFocus: PropTypes.bool,
132
- darkMode: PropTypes.bool
131
+ trapFocus: PropTypes.bool
133
132
  }
134
133
 
135
134
  static defaultProps = {
@@ -137,8 +136,7 @@ export class Popover extends React.Component<PopoverProps, PopoverState> {
137
136
  outerActionEvents: ['mousedown', 'touchstart'],
138
137
  getPopoverPosition: 'bottomLeft',
139
138
  role: 'dialog',
140
- trapFocus: 'true',
141
- darkMode: false
139
+ trapFocus: 'true'
142
140
  }
143
141
 
144
142
  state = {
@@ -186,7 +184,6 @@ export class Popover extends React.Component<PopoverProps, PopoverState> {
186
184
  isOpen={isOpen}
187
185
  role={this.props.role}
188
186
  trapFocus={this.props.trapFocus}
189
- darkMode={this.props.darkMode}
190
187
  >
191
188
  {childrenWithRef}
192
189
  </StatelessPopover>
package/PopoverBody.tsx CHANGED
@@ -11,29 +11,20 @@ export type PopoverBodyProps = {
11
11
  className?: string
12
12
  classNameBody?: string
13
13
  noPadding?: boolean
14
- darkMode?: boolean
15
14
  }
16
15
 
17
16
  export const PopoverBody: React.FunctionComponent<PopoverBodyProps> = ({
18
17
  children,
19
18
  className,
20
19
  classNameBody,
21
- noPadding,
22
- darkMode
20
+ noPadding
23
21
  }) => (
24
- <div
25
- className={classNames(
26
- className,
27
- styles['popover-body-container'],
28
- darkMode && styles['popover-body-container--dark-mode']
29
- )}
30
- >
22
+ <div className={classNames(className, styles['popover-body-container'])}>
31
23
  <div
32
24
  className={classNames(
33
25
  classNameBody,
34
26
  styles['popover-body'],
35
- noPadding && styles['popover-body--no-padding'],
36
- darkMode && styles['popover-body--dark-mode']
27
+ noPadding && styles['popover-body--no-padding']
37
28
  )}
38
29
  >
39
30
  {children}
@@ -24,11 +24,11 @@ type PopoverContainerProps = {
24
24
  scrollThrottleIntervalMs?: number
25
25
  getPopoverPosition: GetPopoverPositionType
26
26
  showTip?: boolean
27
+ classNameTip?: string
27
28
  zIndex: number
28
29
  role?: 'tooltip' | 'dialog'
29
30
  trapFocus?: boolean
30
31
  onEscapeAction: (event: Event) => void
31
- darkMode?: boolean
32
32
  }
33
33
 
34
34
  type PopoverContainerState = {
@@ -100,8 +100,7 @@ export class PopoverContainer extends React.Component<
100
100
  trackScroll: PropTypes.bool,
101
101
  role: PropTypes.oneOf(['tooltip', 'dialog']),
102
102
  trapFocus: PropTypes.bool,
103
- onEscapeAction: PropTypes.func,
104
- darkMode: PropTypes.bool
103
+ onEscapeAction: PropTypes.func
105
104
  }
106
105
 
107
106
  static defaultProps = {
@@ -268,10 +267,7 @@ export class PopoverContainer extends React.Component<
268
267
  styles['popover-tip'],
269
268
  styles[`popover-tip--${tipPosition}`],
270
269
  'popover-tip',
271
- {
272
- [styles[`popover-tip--${tipPosition}--dark-mode`]]: this.props.darkMode,
273
- [styles['popover-tip--dark-mode']]: this.props.darkMode
274
- }
270
+ this.props.classNameTip
275
271
  )}
276
272
  style={{
277
273
  top: tipPosition === 'bottom' && (position.top as number) - 8,
@@ -16,6 +16,7 @@ export type StatelessPopoverProps = {
16
16
  body?: React.ReactNode
17
17
  zIndex: number
18
18
  showTip?: boolean
19
+ classNameTip?: string
19
20
  className?: string
20
21
  outerActionEvents?: string[]
21
22
  onOuterAction?: (evt: Event) => void
@@ -23,7 +24,6 @@ export type StatelessPopoverProps = {
23
24
  trackScroll?: boolean
24
25
  role?: 'tooltip' | 'dialog'
25
26
  trapFocus?: boolean
26
- darkMode?: boolean
27
27
  }
28
28
 
29
29
  export class StatelessPopover extends React.Component<StatelessPopoverProps> {
@@ -45,12 +45,12 @@ export class StatelessPopover extends React.Component<StatelessPopoverProps> {
45
45
  className={props.className}
46
46
  positioningTarget={positioningTarget}
47
47
  showTip={props.showTip}
48
+ classNameTip={props.classNameTip}
48
49
  zIndex={props.zIndex}
49
50
  trackScroll={props.trackScroll}
50
51
  role={this.props.role}
51
52
  trapFocus={this.props.trapFocus}
52
53
  onEscapeAction={this.props.onEscapeAction}
53
- darkMode={this.props.darkMode}
54
54
  >
55
55
  {props.body}
56
56
  </PopoverContainer>
package/dist/Popover.d.ts CHANGED
@@ -80,11 +80,11 @@ export declare type PopoverProps = {
80
80
  body?: React.ReactNode;
81
81
  zIndex: number;
82
82
  showTip?: boolean;
83
+ classNameTip?: string;
83
84
  className?: string;
84
85
  trackScroll?: boolean;
85
86
  role?: 'tooltip' | 'dialog';
86
87
  trapFocus?: boolean;
87
- darkMode?: boolean;
88
88
  };
89
89
  export declare type PopoverState = {
90
90
  isOpen: boolean;
@@ -119,7 +119,6 @@ export declare class Popover extends React.Component<PopoverProps, PopoverState>
119
119
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
120
120
  role: PropTypes.Requireable<string>;
121
121
  trapFocus: PropTypes.Requireable<boolean>;
122
- darkMode: PropTypes.Requireable<boolean>;
123
122
  };
124
123
  static defaultProps: {
125
124
  zIndex: number;
@@ -127,7 +126,6 @@ export declare class Popover extends React.Component<PopoverProps, PopoverState>
127
126
  getPopoverPosition: string;
128
127
  role: string;
129
128
  trapFocus: string;
130
- darkMode: boolean;
131
129
  };
132
130
  state: {
133
131
  isOpen: boolean;
@@ -7,6 +7,5 @@ export declare type PopoverBodyProps = {
7
7
  className?: string;
8
8
  classNameBody?: string;
9
9
  noPadding?: boolean;
10
- darkMode?: boolean;
11
10
  };
12
11
  export declare const PopoverBody: React.FunctionComponent<PopoverBodyProps>;
@@ -13,11 +13,11 @@ declare type PopoverContainerProps = {
13
13
  scrollThrottleIntervalMs?: number;
14
14
  getPopoverPosition: GetPopoverPositionType;
15
15
  showTip?: boolean;
16
+ classNameTip?: string;
16
17
  zIndex: number;
17
18
  role?: 'tooltip' | 'dialog';
18
19
  trapFocus?: boolean;
19
20
  onEscapeAction: (event: Event) => void;
20
- darkMode?: boolean;
21
21
  };
22
22
  declare type PopoverContainerState = {
23
23
  adjusted: boolean;
@@ -36,7 +36,6 @@ export declare class PopoverContainer extends React.Component<PopoverContainerPr
36
36
  role: PropTypes.Requireable<string>;
37
37
  trapFocus: PropTypes.Requireable<boolean>;
38
38
  onEscapeAction: PropTypes.Requireable<(...args: any[]) => any>;
39
- darkMode: PropTypes.Requireable<boolean>;
40
39
  };
41
40
  static defaultProps: {
42
41
  trackScroll: boolean;
@@ -11,6 +11,7 @@ export declare type StatelessPopoverProps = {
11
11
  body?: React.ReactNode;
12
12
  zIndex: number;
13
13
  showTip?: boolean;
14
+ classNameTip?: string;
14
15
  className?: string;
15
16
  outerActionEvents?: string[];
16
17
  onOuterAction?: (evt: Event) => void;
@@ -18,7 +19,6 @@ export declare type StatelessPopoverProps = {
18
19
  trackScroll?: boolean;
19
20
  role?: 'tooltip' | 'dialog';
20
21
  trapFocus?: boolean;
21
- darkMode?: boolean;
22
22
  };
23
23
  export declare class StatelessPopover extends React.Component<StatelessPopoverProps> {
24
24
  renderPortalContent({ props, container, positioningTarget }: {
@@ -26,20 +26,6 @@ function _createClass(Constructor, protoProps, staticProps) {
26
26
  });
27
27
  return Constructor;
28
28
  }
29
- function _defineProperty(obj, key, value) {
30
- key = _toPropertyKey(key);
31
- if (key in obj) {
32
- Object.defineProperty(obj, key, {
33
- value: value,
34
- enumerable: true,
35
- configurable: true,
36
- writable: true
37
- });
38
- } else {
39
- obj[key] = value;
40
- }
41
- return obj;
42
- }
43
29
  function _extends() {
44
30
  _extends = Object.assign ? Object.assign.bind() : function (target) {
45
31
  for (var i = 1; i < arguments.length; i++) {
@@ -223,8 +209,8 @@ function styleInject(css, ref) {
223
209
  }
224
210
  }
225
211
 
226
- var css = "/*********************************************************************\n* © Copyright IBM Corp. 2024\n*********************************************************************/\n.popover-body-container__popover__12-21-1-alpha-0 {\n -webkit-box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\n box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\n border-radius: var(--BorderRadiusL, 4px);\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\n background: var(--BackgroundDefault, #FFFFFF);\n z-index: var(--ZIndexModal, 10001);\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n.popover-body-container--dark-mode__popover__12-21-1-alpha-0 {\n background: var(--Second700, #2D2E33);\n border-color: var(--Second700, #2D2E33);\n }\n.popover-body__popover__12-21-1-alpha-0 {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n padding: var(--SpaceSM, 12px);\n font-size: var(--FontSizeDefault, 13px);\n color: var(--FontColorDefault, #000000);\n}\n.popover-body--no-padding__popover__12-21-1-alpha-0 {\n padding: 0;\n }\n.popover-body--dark-mode__popover__12-21-1-alpha-0 {\n color: var(--FontColorWhite, #FFFFFF);\n }\n.popover-tip__popover__12-21-1-alpha-0 {\n position: absolute;\n pointer-events: none;\n z-index: calc(var(--ZIndexModal, 10001) + 1);\n overflow: hidden;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.popover-tip__popover__12-21-1-alpha-0:before {\n content: '';\n position: absolute;\n display: block;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n background-color: var(--BackgroundDefault, #FFFFFF);\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\n /*\n geometry FTW\n\n 2*$popoverTipSize\n _______ _______\n | /|\\ |\n | / | \\ | $popoverTipSize\n | / | \\ |\n |/______|______\\|\n since tip is rotated 45 degrees, its width and height is a\n diagonal of a square with side=$popoverTipSize, thus diagonal\n is sqrt(2) * $popoverTipSize.\n sqrt(2) ~= 1.414, 1.4 used here to prevent too much rounding\n */\n width: 11.2px;\n height: 11.2px;\n -webkit-transform: rotate(45deg);\n transform: rotate(45deg);\n }\n.popover-tip--dark-mode__popover__12-21-1-alpha-0:before {\n background-color: var(--Second700, #2D2E33);\n border-color: var(--Second700, #2D2E33);\n }\n.popover-tip--bottom__popover__12-21-1-alpha-0,\n .popover-tip--top__popover__12-21-1-alpha-0 {\n width: 100%;\n border-top: 1px var(--BackgroundDefault, #FFFFFF);\n border-bottom: 1px var(--BackgroundDefault, #FFFFFF);\n height: 9px;\n }\n.popover-tip--bottom--dark-mode__popover__12-21-1-alpha-0, .popover-tip--top--dark-mode__popover__12-21-1-alpha-0 {\n border-color: var(--Second700, #2D2E33);\n }\n.popover-tip--left__popover__12-21-1-alpha-0,\n .popover-tip--right__popover__12-21-1-alpha-0 {\n border-left: 1px var(--BackgroundDefault, #FFFFFF);\n border-right: 1px var(--BackgroundDefault, #FFFFFF);\n height: 100%;\n width: 9px;\n }\n.popover-tip--left--dark-mode__popover__12-21-1-alpha-0, .popover-tip--right--dark-mode__popover__12-21-1-alpha-0 {\n border-color: var(--Second700, #2D2E33);\n }\n/*\n To determine tip position, we need to rotate it\n along the \"tip\" point, after that, the \"tip\" point\n can be placed with exactly 50% offset from the origin\n so that it is centered.\n */\n.popover-tip--bottom__popover__12-21-1-alpha-0:before {\n -webkit-transform-origin: left top;\n transform-origin: left top;\n left: 50%;\n top: 0;\n }\n.popover-tip--top__popover__12-21-1-alpha-0:before {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n right: 50%;\n bottom: 0;\n }\n.popover-tip--left__popover__12-21-1-alpha-0:before {\n -webkit-transform-origin: right top;\n transform-origin: right top;\n right: 0;\n top: 50%;\n }\n.popover-tip--right__popover__12-21-1-alpha-0:before {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n left: 0;\n bottom: 50%;\n }\n";
227
- var styles = {"popover-body-container":"popover-body-container__popover__12-21-1-alpha-0","popover-body-container--dark-mode":"popover-body-container--dark-mode__popover__12-21-1-alpha-0","popover-body":"popover-body__popover__12-21-1-alpha-0","popover-body--no-padding":"popover-body--no-padding__popover__12-21-1-alpha-0","popover-body--dark-mode":"popover-body--dark-mode__popover__12-21-1-alpha-0","popover-tip":"popover-tip__popover__12-21-1-alpha-0","popover-tip--dark-mode":"popover-tip--dark-mode__popover__12-21-1-alpha-0","popover-tip--bottom":"popover-tip--bottom__popover__12-21-1-alpha-0","popover-tip--top":"popover-tip--top__popover__12-21-1-alpha-0","popover-tip--bottom--dark-mode":"popover-tip--bottom--dark-mode__popover__12-21-1-alpha-0","popover-tip--top--dark-mode":"popover-tip--top--dark-mode__popover__12-21-1-alpha-0","popover-tip--left":"popover-tip--left__popover__12-21-1-alpha-0","popover-tip--right":"popover-tip--right__popover__12-21-1-alpha-0","popover-tip--left--dark-mode":"popover-tip--left--dark-mode__popover__12-21-1-alpha-0","popover-tip--right--dark-mode":"popover-tip--right--dark-mode__popover__12-21-1-alpha-0"};
212
+ var css = "/*********************************************************************\n* © Copyright IBM Corp. 2024\n*********************************************************************/\n.popover-body-container__popover__12-22-0 {\n -webkit-box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\n box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\n border-radius: var(--BorderRadiusL, 4px);\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\n background: var(--BackgroundDefault, #FFFFFF);\n z-index: var(--ZIndexModal, 10001);\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n.popover-body__popover__12-22-0 {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n padding: var(--SpaceSM, 12px);\n font-size: var(--FontSizeDefault, 13px);\n color: var(--FontColorDefault, #000000);\n}\n.popover-body--no-padding__popover__12-22-0 {\n padding: 0;\n }\n.popover-tip__popover__12-22-0 {\n position: absolute;\n pointer-events: none;\n z-index: calc(var(--ZIndexModal, 10001) + 1);\n overflow: hidden;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.popover-tip__popover__12-22-0:before {\n content: '';\n position: absolute;\n display: block;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n background-color: var(--BackgroundDefault, #FFFFFF);\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\n /*\n geometry FTW\n\n 2*$popoverTipSize\n _______ _______\n | /|\\ |\n | / | \\ | $popoverTipSize\n | / | \\ |\n |/______|______\\|\n since tip is rotated 45 degrees, its width and height is a\n diagonal of a square with side=$popoverTipSize, thus diagonal\n is sqrt(2) * $popoverTipSize.\n sqrt(2) ~= 1.414, 1.4 used here to prevent too much rounding\n */\n width: 11.2px;\n height: 11.2px;\n -webkit-transform: rotate(45deg);\n transform: rotate(45deg);\n }\n.popover-tip--bottom__popover__12-22-0,\n .popover-tip--top__popover__12-22-0 {\n width: 100%;\n border-top: 1px var(--BackgroundDefault, #FFFFFF);\n border-bottom: 1px var(--BackgroundDefault, #FFFFFF);\n height: 9px;\n }\n.popover-tip--left__popover__12-22-0,\n .popover-tip--right__popover__12-22-0 {\n border-left: 1px var(--BackgroundDefault, #FFFFFF);\n border-right: 1px var(--BackgroundDefault, #FFFFFF);\n height: 100%;\n width: 9px;\n }\n/*\n To determine tip position, we need to rotate it\n along the \"tip\" point, after that, the \"tip\" point\n can be placed with exactly 50% offset from the origin\n so that it is centered.\n */\n.popover-tip--bottom__popover__12-22-0:before {\n -webkit-transform-origin: left top;\n transform-origin: left top;\n left: 50%;\n top: 0;\n }\n.popover-tip--top__popover__12-22-0:before {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n right: 50%;\n bottom: 0;\n }\n.popover-tip--left__popover__12-22-0:before {\n -webkit-transform-origin: right top;\n transform-origin: right top;\n right: 0;\n top: 50%;\n }\n.popover-tip--right__popover__12-22-0:before {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n left: 0;\n bottom: 50%;\n }\n";
213
+ var styles = {"popover-body-container":"popover-body-container__popover__12-22-0","popover-body":"popover-body__popover__12-22-0","popover-body--no-padding":"popover-body--no-padding__popover__12-22-0","popover-tip":"popover-tip__popover__12-22-0","popover-tip--bottom":"popover-tip--bottom__popover__12-22-0","popover-tip--top":"popover-tip--top__popover__12-22-0","popover-tip--left":"popover-tip--left__popover__12-22-0","popover-tip--right":"popover-tip--right__popover__12-22-0"};
228
214
  styleInject(css);
229
215
 
230
216
  /*********************************************************************
@@ -234,12 +220,11 @@ var PopoverBody = function PopoverBody(_ref) {
234
220
  var children = _ref.children,
235
221
  className = _ref.className,
236
222
  classNameBody = _ref.classNameBody,
237
- noPadding = _ref.noPadding,
238
- darkMode = _ref.darkMode;
223
+ noPadding = _ref.noPadding;
239
224
  return React.createElement("div", {
240
- className: classNames(className, styles['popover-body-container'], darkMode && styles['popover-body-container--dark-mode'])
225
+ className: classNames(className, styles['popover-body-container'])
241
226
  }, React.createElement("div", {
242
- className: classNames(classNameBody, styles['popover-body'], noPadding && styles['popover-body--no-padding'], darkMode && styles['popover-body--dark-mode'])
227
+ className: classNames(classNameBody, styles['popover-body'], noPadding && styles['popover-body--no-padding'])
243
228
  }, children));
244
229
  };
245
230
 
@@ -481,7 +466,6 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
481
466
  }, {
482
467
  key: "render",
483
468
  value: function render() {
484
- var _classNames;
485
469
  var getPopoverPosition = typeof this.props.getPopoverPosition === 'function' ? this.props.getPopoverPosition : PopoverPosition[this.props.getPopoverPosition] || PopoverPosition.bottomLeft;
486
470
  var position = this.state.hostRect ? getPopoverPosition(this.state.hostRect, this.state.popoverRect, this.state.scroll, this.props.containerElement) : {};
487
471
  var containerPosition = {
@@ -503,7 +487,7 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
503
487
  opacity: this.state.adjusted ? 1 : 0
504
488
  })
505
489
  }, this.props.showTip && tipPosition && React.createElement("div", {
506
- className: classNames(styles['popover-tip'], styles["popover-tip--".concat(tipPosition)], 'popover-tip', (_classNames = {}, _defineProperty(_classNames, styles["popover-tip--".concat(tipPosition, "--dark-mode")], this.props.darkMode), _defineProperty(_classNames, styles['popover-tip--dark-mode'], this.props.darkMode), _classNames)),
490
+ className: classNames(styles['popover-tip'], styles["popover-tip--".concat(tipPosition)], 'popover-tip', this.props.classNameTip),
507
491
  style: {
508
492
  top: tipPosition === 'bottom' && position.top - 8,
509
493
  bottom: tipPosition === 'top' && position.bottom - 8,
@@ -671,12 +655,12 @@ var StatelessPopover = /*#__PURE__*/function (_React$Component) {
671
655
  className: props.className,
672
656
  positioningTarget: positioningTarget,
673
657
  showTip: props.showTip,
658
+ classNameTip: props.classNameTip,
674
659
  zIndex: props.zIndex,
675
660
  trackScroll: props.trackScroll,
676
661
  role: this.props.role,
677
662
  trapFocus: this.props.trapFocus,
678
- onEscapeAction: this.props.onEscapeAction,
679
- darkMode: this.props.darkMode
663
+ onEscapeAction: this.props.onEscapeAction
680
664
  }, props.body);
681
665
  return ReactDOM.createPortal(popoverContent, container);
682
666
  }
@@ -766,8 +750,7 @@ var Popover = /*#__PURE__*/function (_React$Component) {
766
750
  onEscapeAction: this.onEscapeAction,
767
751
  isOpen: isOpen,
768
752
  role: this.props.role,
769
- trapFocus: this.props.trapFocus,
770
- darkMode: this.props.darkMode
753
+ trapFocus: this.props.trapFocus
771
754
  }), childrenWithRef);
772
755
  }
773
756
  }]);
@@ -780,8 +763,7 @@ Popover.defaultProps = {
780
763
  outerActionEvents: ['mousedown', 'touchstart'],
781
764
  getPopoverPosition: 'bottomLeft',
782
765
  role: 'dialog',
783
- trapFocus: 'true',
784
- darkMode: false
766
+ trapFocus: 'true'
785
767
  };
786
768
 
787
769
  /*********************************************************************
package/dist/popover.js CHANGED
@@ -33,20 +33,6 @@ function _createClass(Constructor, protoProps, staticProps) {
33
33
  });
34
34
  return Constructor;
35
35
  }
36
- function _defineProperty(obj, key, value) {
37
- key = _toPropertyKey(key);
38
- if (key in obj) {
39
- Object.defineProperty(obj, key, {
40
- value: value,
41
- enumerable: true,
42
- configurable: true,
43
- writable: true
44
- });
45
- } else {
46
- obj[key] = value;
47
- }
48
- return obj;
49
- }
50
36
  function _extends() {
51
37
  _extends = Object.assign ? Object.assign.bind() : function (target) {
52
38
  for (var i = 1; i < arguments.length; i++) {
@@ -230,8 +216,8 @@ function styleInject(css, ref) {
230
216
  }
231
217
  }
232
218
 
233
- var css = "/*********************************************************************\n* © Copyright IBM Corp. 2024\n*********************************************************************/\n.popover-body-container__popover__12-21-1-alpha-0 {\n -webkit-box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\n box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\n border-radius: var(--BorderRadiusL, 4px);\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\n background: var(--BackgroundDefault, #FFFFFF);\n z-index: var(--ZIndexModal, 10001);\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n.popover-body-container--dark-mode__popover__12-21-1-alpha-0 {\n background: var(--Second700, #2D2E33);\n border-color: var(--Second700, #2D2E33);\n }\n.popover-body__popover__12-21-1-alpha-0 {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n padding: var(--SpaceSM, 12px);\n font-size: var(--FontSizeDefault, 13px);\n color: var(--FontColorDefault, #000000);\n}\n.popover-body--no-padding__popover__12-21-1-alpha-0 {\n padding: 0;\n }\n.popover-body--dark-mode__popover__12-21-1-alpha-0 {\n color: var(--FontColorWhite, #FFFFFF);\n }\n.popover-tip__popover__12-21-1-alpha-0 {\n position: absolute;\n pointer-events: none;\n z-index: calc(var(--ZIndexModal, 10001) + 1);\n overflow: hidden;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.popover-tip__popover__12-21-1-alpha-0:before {\n content: '';\n position: absolute;\n display: block;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n background-color: var(--BackgroundDefault, #FFFFFF);\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\n /*\n geometry FTW\n\n 2*$popoverTipSize\n _______ _______\n | /|\\ |\n | / | \\ | $popoverTipSize\n | / | \\ |\n |/______|______\\|\n since tip is rotated 45 degrees, its width and height is a\n diagonal of a square with side=$popoverTipSize, thus diagonal\n is sqrt(2) * $popoverTipSize.\n sqrt(2) ~= 1.414, 1.4 used here to prevent too much rounding\n */\n width: 11.2px;\n height: 11.2px;\n -webkit-transform: rotate(45deg);\n transform: rotate(45deg);\n }\n.popover-tip--dark-mode__popover__12-21-1-alpha-0:before {\n background-color: var(--Second700, #2D2E33);\n border-color: var(--Second700, #2D2E33);\n }\n.popover-tip--bottom__popover__12-21-1-alpha-0,\n .popover-tip--top__popover__12-21-1-alpha-0 {\n width: 100%;\n border-top: 1px var(--BackgroundDefault, #FFFFFF);\n border-bottom: 1px var(--BackgroundDefault, #FFFFFF);\n height: 9px;\n }\n.popover-tip--bottom--dark-mode__popover__12-21-1-alpha-0, .popover-tip--top--dark-mode__popover__12-21-1-alpha-0 {\n border-color: var(--Second700, #2D2E33);\n }\n.popover-tip--left__popover__12-21-1-alpha-0,\n .popover-tip--right__popover__12-21-1-alpha-0 {\n border-left: 1px var(--BackgroundDefault, #FFFFFF);\n border-right: 1px var(--BackgroundDefault, #FFFFFF);\n height: 100%;\n width: 9px;\n }\n.popover-tip--left--dark-mode__popover__12-21-1-alpha-0, .popover-tip--right--dark-mode__popover__12-21-1-alpha-0 {\n border-color: var(--Second700, #2D2E33);\n }\n/*\n To determine tip position, we need to rotate it\n along the \"tip\" point, after that, the \"tip\" point\n can be placed with exactly 50% offset from the origin\n so that it is centered.\n */\n.popover-tip--bottom__popover__12-21-1-alpha-0:before {\n -webkit-transform-origin: left top;\n transform-origin: left top;\n left: 50%;\n top: 0;\n }\n.popover-tip--top__popover__12-21-1-alpha-0:before {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n right: 50%;\n bottom: 0;\n }\n.popover-tip--left__popover__12-21-1-alpha-0:before {\n -webkit-transform-origin: right top;\n transform-origin: right top;\n right: 0;\n top: 50%;\n }\n.popover-tip--right__popover__12-21-1-alpha-0:before {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n left: 0;\n bottom: 50%;\n }\n";
234
- var styles = {"popover-body-container":"popover-body-container__popover__12-21-1-alpha-0","popover-body-container--dark-mode":"popover-body-container--dark-mode__popover__12-21-1-alpha-0","popover-body":"popover-body__popover__12-21-1-alpha-0","popover-body--no-padding":"popover-body--no-padding__popover__12-21-1-alpha-0","popover-body--dark-mode":"popover-body--dark-mode__popover__12-21-1-alpha-0","popover-tip":"popover-tip__popover__12-21-1-alpha-0","popover-tip--dark-mode":"popover-tip--dark-mode__popover__12-21-1-alpha-0","popover-tip--bottom":"popover-tip--bottom__popover__12-21-1-alpha-0","popover-tip--top":"popover-tip--top__popover__12-21-1-alpha-0","popover-tip--bottom--dark-mode":"popover-tip--bottom--dark-mode__popover__12-21-1-alpha-0","popover-tip--top--dark-mode":"popover-tip--top--dark-mode__popover__12-21-1-alpha-0","popover-tip--left":"popover-tip--left__popover__12-21-1-alpha-0","popover-tip--right":"popover-tip--right__popover__12-21-1-alpha-0","popover-tip--left--dark-mode":"popover-tip--left--dark-mode__popover__12-21-1-alpha-0","popover-tip--right--dark-mode":"popover-tip--right--dark-mode__popover__12-21-1-alpha-0"};
219
+ var css = "/*********************************************************************\n* © Copyright IBM Corp. 2024\n*********************************************************************/\n.popover-body-container__popover__12-22-0 {\n -webkit-box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\n box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\n border-radius: var(--BorderRadiusL, 4px);\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\n background: var(--BackgroundDefault, #FFFFFF);\n z-index: var(--ZIndexModal, 10001);\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n.popover-body__popover__12-22-0 {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n padding: var(--SpaceSM, 12px);\n font-size: var(--FontSizeDefault, 13px);\n color: var(--FontColorDefault, #000000);\n}\n.popover-body--no-padding__popover__12-22-0 {\n padding: 0;\n }\n.popover-tip__popover__12-22-0 {\n position: absolute;\n pointer-events: none;\n z-index: calc(var(--ZIndexModal, 10001) + 1);\n overflow: hidden;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.popover-tip__popover__12-22-0:before {\n content: '';\n position: absolute;\n display: block;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n background-color: var(--BackgroundDefault, #FFFFFF);\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\n /*\n geometry FTW\n\n 2*$popoverTipSize\n _______ _______\n | /|\\ |\n | / | \\ | $popoverTipSize\n | / | \\ |\n |/______|______\\|\n since tip is rotated 45 degrees, its width and height is a\n diagonal of a square with side=$popoverTipSize, thus diagonal\n is sqrt(2) * $popoverTipSize.\n sqrt(2) ~= 1.414, 1.4 used here to prevent too much rounding\n */\n width: 11.2px;\n height: 11.2px;\n -webkit-transform: rotate(45deg);\n transform: rotate(45deg);\n }\n.popover-tip--bottom__popover__12-22-0,\n .popover-tip--top__popover__12-22-0 {\n width: 100%;\n border-top: 1px var(--BackgroundDefault, #FFFFFF);\n border-bottom: 1px var(--BackgroundDefault, #FFFFFF);\n height: 9px;\n }\n.popover-tip--left__popover__12-22-0,\n .popover-tip--right__popover__12-22-0 {\n border-left: 1px var(--BackgroundDefault, #FFFFFF);\n border-right: 1px var(--BackgroundDefault, #FFFFFF);\n height: 100%;\n width: 9px;\n }\n/*\n To determine tip position, we need to rotate it\n along the \"tip\" point, after that, the \"tip\" point\n can be placed with exactly 50% offset from the origin\n so that it is centered.\n */\n.popover-tip--bottom__popover__12-22-0:before {\n -webkit-transform-origin: left top;\n transform-origin: left top;\n left: 50%;\n top: 0;\n }\n.popover-tip--top__popover__12-22-0:before {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n right: 50%;\n bottom: 0;\n }\n.popover-tip--left__popover__12-22-0:before {\n -webkit-transform-origin: right top;\n transform-origin: right top;\n right: 0;\n top: 50%;\n }\n.popover-tip--right__popover__12-22-0:before {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n left: 0;\n bottom: 50%;\n }\n";
220
+ var styles = {"popover-body-container":"popover-body-container__popover__12-22-0","popover-body":"popover-body__popover__12-22-0","popover-body--no-padding":"popover-body--no-padding__popover__12-22-0","popover-tip":"popover-tip__popover__12-22-0","popover-tip--bottom":"popover-tip--bottom__popover__12-22-0","popover-tip--top":"popover-tip--top__popover__12-22-0","popover-tip--left":"popover-tip--left__popover__12-22-0","popover-tip--right":"popover-tip--right__popover__12-22-0"};
235
221
  styleInject(css);
236
222
 
237
223
  /*********************************************************************
@@ -241,12 +227,11 @@ var PopoverBody = function PopoverBody(_ref) {
241
227
  var children = _ref.children,
242
228
  className = _ref.className,
243
229
  classNameBody = _ref.classNameBody,
244
- noPadding = _ref.noPadding,
245
- darkMode = _ref.darkMode;
230
+ noPadding = _ref.noPadding;
246
231
  return React__default.createElement("div", {
247
- className: classNames(className, styles['popover-body-container'], darkMode && styles['popover-body-container--dark-mode'])
232
+ className: classNames(className, styles['popover-body-container'])
248
233
  }, React__default.createElement("div", {
249
- className: classNames(classNameBody, styles['popover-body'], noPadding && styles['popover-body--no-padding'], darkMode && styles['popover-body--dark-mode'])
234
+ className: classNames(classNameBody, styles['popover-body'], noPadding && styles['popover-body--no-padding'])
250
235
  }, children));
251
236
  };
252
237
 
@@ -488,7 +473,6 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
488
473
  }, {
489
474
  key: "render",
490
475
  value: function render() {
491
- var _classNames;
492
476
  var getPopoverPosition = typeof this.props.getPopoverPosition === 'function' ? this.props.getPopoverPosition : PopoverPosition[this.props.getPopoverPosition] || PopoverPosition.bottomLeft;
493
477
  var position = this.state.hostRect ? getPopoverPosition(this.state.hostRect, this.state.popoverRect, this.state.scroll, this.props.containerElement) : {};
494
478
  var containerPosition = {
@@ -510,7 +494,7 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
510
494
  opacity: this.state.adjusted ? 1 : 0
511
495
  })
512
496
  }, this.props.showTip && tipPosition && React__default.createElement("div", {
513
- className: classNames(styles['popover-tip'], styles["popover-tip--".concat(tipPosition)], 'popover-tip', (_classNames = {}, _defineProperty(_classNames, styles["popover-tip--".concat(tipPosition, "--dark-mode")], this.props.darkMode), _defineProperty(_classNames, styles['popover-tip--dark-mode'], this.props.darkMode), _classNames)),
497
+ className: classNames(styles['popover-tip'], styles["popover-tip--".concat(tipPosition)], 'popover-tip', this.props.classNameTip),
514
498
  style: {
515
499
  top: tipPosition === 'bottom' && position.top - 8,
516
500
  bottom: tipPosition === 'top' && position.bottom - 8,
@@ -678,12 +662,12 @@ var StatelessPopover = /*#__PURE__*/function (_React$Component) {
678
662
  className: props.className,
679
663
  positioningTarget: positioningTarget,
680
664
  showTip: props.showTip,
665
+ classNameTip: props.classNameTip,
681
666
  zIndex: props.zIndex,
682
667
  trackScroll: props.trackScroll,
683
668
  role: this.props.role,
684
669
  trapFocus: this.props.trapFocus,
685
- onEscapeAction: this.props.onEscapeAction,
686
- darkMode: this.props.darkMode
670
+ onEscapeAction: this.props.onEscapeAction
687
671
  }, props.body);
688
672
  return ReactDOM.createPortal(popoverContent, container);
689
673
  }
@@ -773,8 +757,7 @@ var Popover = /*#__PURE__*/function (_React$Component) {
773
757
  onEscapeAction: this.onEscapeAction,
774
758
  isOpen: isOpen,
775
759
  role: this.props.role,
776
- trapFocus: this.props.trapFocus,
777
- darkMode: this.props.darkMode
760
+ trapFocus: this.props.trapFocus
778
761
  }), childrenWithRef);
779
762
  }
780
763
  }]);
@@ -787,8 +770,7 @@ Popover.defaultProps = {
787
770
  outerActionEvents: ['mousedown', 'touchstart'],
788
771
  getPopoverPosition: 'bottomLeft',
789
772
  role: 'dialog',
790
- trapFocus: 'true',
791
- darkMode: false
773
+ trapFocus: 'true'
792
774
  };
793
775
 
794
776
  /*********************************************************************
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@targetprocess/popover",
3
- "version": "12.21.1-alpha.0",
3
+ "version": "12.22.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.21.1-alpha.0",
15
+ "@targetprocess/global-constants": "^12.22.0",
16
16
  "classnames": "^2.2.5",
17
17
  "focus-trap-react": "^7.0.0",
18
18
  "prop-types": "^15.6.0",
@@ -22,5 +22,5 @@
22
22
  "publishConfig": {
23
23
  "access": "public"
24
24
  },
25
- "gitHead": "051c638e999ccf0c8813c2ffa5d30567c48042cb"
25
+ "gitHead": "0b28861002689e429cb2b1c6e99a0b85e3e7de11"
26
26
  }
package/style/index.css CHANGED
@@ -10,11 +10,6 @@ $popoverTipSize: 16px;
10
10
  background: $gBackgroundDefault;
11
11
  z-index: $gZIndexModal;
12
12
  box-sizing: border-box;
13
-
14
- &--dark-mode {
15
- background: $gSecond700;
16
- border-color: $gSecond700;
17
- }
18
13
  }
19
14
 
20
15
  .popover-body {
@@ -26,10 +21,6 @@ $popoverTipSize: 16px;
26
21
  &--no-padding {
27
22
  padding: 0;
28
23
  }
29
-
30
- &--dark-mode {
31
- color: $gFontColorWhite;
32
- }
33
24
  }
34
25
 
35
26
  .popover-tip {
@@ -67,23 +58,12 @@ $popoverTipSize: 16px;
67
58
  transform: rotate(45deg);
68
59
  }
69
60
 
70
- &--dark-mode {
71
- &:before {
72
- background-color: $gSecond700;
73
- border-color: $gSecond700;
74
- }
75
- }
76
-
77
61
  &--bottom,
78
62
  &--top {
79
63
  width: 100%;
80
64
  border-top: 1px $gBackgroundDefault;
81
65
  border-bottom: 1px $gBackgroundDefault;
82
66
  height: calc($popoverTipSize / 2 + 1px);
83
-
84
- &--dark-mode {
85
- border-color: $gSecond700;
86
- }
87
67
  }
88
68
 
89
69
  &--left,
@@ -92,10 +72,6 @@ $popoverTipSize: 16px;
92
72
  border-right: 1px $gBackgroundDefault;
93
73
  height: 100%;
94
74
  width: calc($popoverTipSize / 2 + 1px);
95
-
96
- &--dark-mode {
97
- border-color: $gSecond700;
98
- }
99
75
  }
100
76
 
101
77
  /*