@targetprocess/popover 12.21.0 → 12.21.1-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
@@ -88,6 +88,7 @@ export type PopoverProps = {
88
88
  trackScroll?: boolean
89
89
  role?: 'tooltip' | 'dialog'
90
90
  trapFocus?: boolean
91
+ darkMode?: boolean
91
92
  }
92
93
 
93
94
  export type PopoverState = {
@@ -127,7 +128,8 @@ export class Popover extends React.Component<PopoverProps, PopoverState> {
127
128
  trackScroll: PropTypes.bool,
128
129
  children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
129
130
  role: PropTypes.oneOf(['tooltip', 'dialog']),
130
- trapFocus: PropTypes.bool
131
+ trapFocus: PropTypes.bool,
132
+ darkMode: PropTypes.bool
131
133
  }
132
134
 
133
135
  static defaultProps = {
@@ -135,7 +137,8 @@ export class Popover extends React.Component<PopoverProps, PopoverState> {
135
137
  outerActionEvents: ['mousedown', 'touchstart'],
136
138
  getPopoverPosition: 'bottomLeft',
137
139
  role: 'dialog',
138
- trapFocus: 'true'
140
+ trapFocus: 'true',
141
+ darkMode: false
139
142
  }
140
143
 
141
144
  state = {
@@ -183,6 +186,7 @@ export class Popover extends React.Component<PopoverProps, PopoverState> {
183
186
  isOpen={isOpen}
184
187
  role={this.props.role}
185
188
  trapFocus={this.props.trapFocus}
189
+ darkMode={this.props.darkMode}
186
190
  >
187
191
  {childrenWithRef}
188
192
  </StatelessPopover>
package/PopoverBody.tsx CHANGED
@@ -11,20 +11,29 @@ export type PopoverBodyProps = {
11
11
  className?: string
12
12
  classNameBody?: string
13
13
  noPadding?: boolean
14
+ darkMode?: boolean
14
15
  }
15
16
 
16
17
  export const PopoverBody: React.FunctionComponent<PopoverBodyProps> = ({
17
18
  children,
18
19
  className,
19
20
  classNameBody,
20
- noPadding
21
+ noPadding,
22
+ darkMode
21
23
  }) => (
22
- <div className={classNames(className, styles['popover-body-container'])}>
24
+ <div
25
+ className={classNames(
26
+ className,
27
+ styles['popover-body-container'],
28
+ darkMode && styles['popover-body-container--dark-mode']
29
+ )}
30
+ >
23
31
  <div
24
32
  className={classNames(
25
33
  classNameBody,
26
34
  styles['popover-body'],
27
- noPadding && styles['popover-body--no-padding']
35
+ noPadding && styles['popover-body--no-padding'],
36
+ darkMode && styles['popover-body--dark-mode']
28
37
  )}
29
38
  >
30
39
  {children}
@@ -28,6 +28,7 @@ type PopoverContainerProps = {
28
28
  role?: 'tooltip' | 'dialog'
29
29
  trapFocus?: boolean
30
30
  onEscapeAction: (event: Event) => void
31
+ darkMode?: boolean
31
32
  }
32
33
 
33
34
  type PopoverContainerState = {
@@ -99,7 +100,8 @@ export class PopoverContainer extends React.Component<
99
100
  trackScroll: PropTypes.bool,
100
101
  role: PropTypes.oneOf(['tooltip', 'dialog']),
101
102
  trapFocus: PropTypes.bool,
102
- onEscapeAction: PropTypes.func
103
+ onEscapeAction: PropTypes.func,
104
+ darkMode: PropTypes.bool
103
105
  }
104
106
 
105
107
  static defaultProps = {
@@ -265,7 +267,11 @@ export class PopoverContainer extends React.Component<
265
267
  className={classNames(
266
268
  styles['popover-tip'],
267
269
  styles[`popover-tip--${tipPosition}`],
268
- 'popover-tip'
270
+ 'popover-tip',
271
+ {
272
+ [styles[`popover-tip--${tipPosition}--dark-mode`]]: this.props.darkMode,
273
+ [styles['popover-tip--dark-mode']]: this.props.darkMode
274
+ }
269
275
  )}
270
276
  style={{
271
277
  top: tipPosition === 'bottom' && (position.top as number) - 8,
@@ -23,6 +23,7 @@ export type StatelessPopoverProps = {
23
23
  trackScroll?: boolean
24
24
  role?: 'tooltip' | 'dialog'
25
25
  trapFocus?: boolean
26
+ darkMode?: boolean
26
27
  }
27
28
 
28
29
  export class StatelessPopover extends React.Component<StatelessPopoverProps> {
@@ -49,6 +50,7 @@ export class StatelessPopover extends React.Component<StatelessPopoverProps> {
49
50
  role={this.props.role}
50
51
  trapFocus={this.props.trapFocus}
51
52
  onEscapeAction={this.props.onEscapeAction}
53
+ darkMode={this.props.darkMode}
52
54
  >
53
55
  {props.body}
54
56
  </PopoverContainer>
package/dist/Popover.d.ts CHANGED
@@ -84,6 +84,7 @@ export declare type PopoverProps = {
84
84
  trackScroll?: boolean;
85
85
  role?: 'tooltip' | 'dialog';
86
86
  trapFocus?: boolean;
87
+ darkMode?: boolean;
87
88
  };
88
89
  export declare type PopoverState = {
89
90
  isOpen: boolean;
@@ -118,6 +119,7 @@ export declare class Popover extends React.Component<PopoverProps, PopoverState>
118
119
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
119
120
  role: PropTypes.Requireable<string>;
120
121
  trapFocus: PropTypes.Requireable<boolean>;
122
+ darkMode: PropTypes.Requireable<boolean>;
121
123
  };
122
124
  static defaultProps: {
123
125
  zIndex: number;
@@ -125,6 +127,7 @@ export declare class Popover extends React.Component<PopoverProps, PopoverState>
125
127
  getPopoverPosition: string;
126
128
  role: string;
127
129
  trapFocus: string;
130
+ darkMode: boolean;
128
131
  };
129
132
  state: {
130
133
  isOpen: boolean;
@@ -7,5 +7,6 @@ export declare type PopoverBodyProps = {
7
7
  className?: string;
8
8
  classNameBody?: string;
9
9
  noPadding?: boolean;
10
+ darkMode?: boolean;
10
11
  };
11
12
  export declare const PopoverBody: React.FunctionComponent<PopoverBodyProps>;
@@ -17,6 +17,7 @@ declare type PopoverContainerProps = {
17
17
  role?: 'tooltip' | 'dialog';
18
18
  trapFocus?: boolean;
19
19
  onEscapeAction: (event: Event) => void;
20
+ darkMode?: boolean;
20
21
  };
21
22
  declare type PopoverContainerState = {
22
23
  adjusted: boolean;
@@ -35,6 +36,7 @@ export declare class PopoverContainer extends React.Component<PopoverContainerPr
35
36
  role: PropTypes.Requireable<string>;
36
37
  trapFocus: PropTypes.Requireable<boolean>;
37
38
  onEscapeAction: PropTypes.Requireable<(...args: any[]) => any>;
39
+ darkMode: PropTypes.Requireable<boolean>;
38
40
  };
39
41
  static defaultProps: {
40
42
  trackScroll: boolean;
@@ -18,6 +18,7 @@ export declare type StatelessPopoverProps = {
18
18
  trackScroll?: boolean;
19
19
  role?: 'tooltip' | 'dialog';
20
20
  trapFocus?: boolean;
21
+ darkMode?: boolean;
21
22
  };
22
23
  export declare class StatelessPopover extends React.Component<StatelessPopoverProps> {
23
24
  renderPortalContent({ props, container, positioningTarget }: {
@@ -26,6 +26,20 @@ 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
+ }
29
43
  function _extends() {
30
44
  _extends = Object.assign ? Object.assign.bind() : function (target) {
31
45
  for (var i = 1; i < arguments.length; i++) {
@@ -209,8 +223,8 @@ function styleInject(css, ref) {
209
223
  }
210
224
  }
211
225
 
212
- var css = "/*********************************************************************\n* © Copyright IBM Corp. 2024\n*********************************************************************/\n.popover-body-container__popover__12-21-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-21-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-0 {\n padding: 0;\n }\n.popover-tip__popover__12-21-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-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-21-0,\n .popover-tip--top__popover__12-21-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-21-0,\n .popover-tip--right__popover__12-21-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-21-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-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-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-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-21-0","popover-body":"popover-body__popover__12-21-0","popover-body--no-padding":"popover-body--no-padding__popover__12-21-0","popover-tip":"popover-tip__popover__12-21-0","popover-tip--bottom":"popover-tip--bottom__popover__12-21-0","popover-tip--top":"popover-tip--top__popover__12-21-0","popover-tip--left":"popover-tip--left__popover__12-21-0","popover-tip--right":"popover-tip--right__popover__12-21-0"};
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"};
214
228
  styleInject(css);
215
229
 
216
230
  /*********************************************************************
@@ -220,11 +234,12 @@ var PopoverBody = function PopoverBody(_ref) {
220
234
  var children = _ref.children,
221
235
  className = _ref.className,
222
236
  classNameBody = _ref.classNameBody,
223
- noPadding = _ref.noPadding;
237
+ noPadding = _ref.noPadding,
238
+ darkMode = _ref.darkMode;
224
239
  return React.createElement("div", {
225
- className: classNames(className, styles['popover-body-container'])
240
+ className: classNames(className, styles['popover-body-container'], darkMode && styles['popover-body-container--dark-mode'])
226
241
  }, React.createElement("div", {
227
- className: classNames(classNameBody, styles['popover-body'], noPadding && styles['popover-body--no-padding'])
242
+ className: classNames(classNameBody, styles['popover-body'], noPadding && styles['popover-body--no-padding'], darkMode && styles['popover-body--dark-mode'])
228
243
  }, children));
229
244
  };
230
245
 
@@ -466,6 +481,7 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
466
481
  }, {
467
482
  key: "render",
468
483
  value: function render() {
484
+ var _classNames;
469
485
  var getPopoverPosition = typeof this.props.getPopoverPosition === 'function' ? this.props.getPopoverPosition : PopoverPosition[this.props.getPopoverPosition] || PopoverPosition.bottomLeft;
470
486
  var position = this.state.hostRect ? getPopoverPosition(this.state.hostRect, this.state.popoverRect, this.state.scroll, this.props.containerElement) : {};
471
487
  var containerPosition = {
@@ -487,7 +503,7 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
487
503
  opacity: this.state.adjusted ? 1 : 0
488
504
  })
489
505
  }, this.props.showTip && tipPosition && React.createElement("div", {
490
- className: classNames(styles['popover-tip'], styles["popover-tip--".concat(tipPosition)], 'popover-tip'),
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)),
491
507
  style: {
492
508
  top: tipPosition === 'bottom' && position.top - 8,
493
509
  bottom: tipPosition === 'top' && position.bottom - 8,
@@ -659,7 +675,8 @@ var StatelessPopover = /*#__PURE__*/function (_React$Component) {
659
675
  trackScroll: props.trackScroll,
660
676
  role: this.props.role,
661
677
  trapFocus: this.props.trapFocus,
662
- onEscapeAction: this.props.onEscapeAction
678
+ onEscapeAction: this.props.onEscapeAction,
679
+ darkMode: this.props.darkMode
663
680
  }, props.body);
664
681
  return ReactDOM.createPortal(popoverContent, container);
665
682
  }
@@ -749,7 +766,8 @@ var Popover = /*#__PURE__*/function (_React$Component) {
749
766
  onEscapeAction: this.onEscapeAction,
750
767
  isOpen: isOpen,
751
768
  role: this.props.role,
752
- trapFocus: this.props.trapFocus
769
+ trapFocus: this.props.trapFocus,
770
+ darkMode: this.props.darkMode
753
771
  }), childrenWithRef);
754
772
  }
755
773
  }]);
@@ -762,7 +780,8 @@ Popover.defaultProps = {
762
780
  outerActionEvents: ['mousedown', 'touchstart'],
763
781
  getPopoverPosition: 'bottomLeft',
764
782
  role: 'dialog',
765
- trapFocus: 'true'
783
+ trapFocus: 'true',
784
+ darkMode: false
766
785
  };
767
786
 
768
787
  /*********************************************************************
package/dist/popover.js CHANGED
@@ -33,6 +33,20 @@ 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
+ }
36
50
  function _extends() {
37
51
  _extends = Object.assign ? Object.assign.bind() : function (target) {
38
52
  for (var i = 1; i < arguments.length; i++) {
@@ -216,8 +230,8 @@ function styleInject(css, ref) {
216
230
  }
217
231
  }
218
232
 
219
- var css = "/*********************************************************************\n* © Copyright IBM Corp. 2024\n*********************************************************************/\n.popover-body-container__popover__12-21-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-21-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-0 {\n padding: 0;\n }\n.popover-tip__popover__12-21-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-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-21-0,\n .popover-tip--top__popover__12-21-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-21-0,\n .popover-tip--right__popover__12-21-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-21-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-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-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-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-21-0","popover-body":"popover-body__popover__12-21-0","popover-body--no-padding":"popover-body--no-padding__popover__12-21-0","popover-tip":"popover-tip__popover__12-21-0","popover-tip--bottom":"popover-tip--bottom__popover__12-21-0","popover-tip--top":"popover-tip--top__popover__12-21-0","popover-tip--left":"popover-tip--left__popover__12-21-0","popover-tip--right":"popover-tip--right__popover__12-21-0"};
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"};
221
235
  styleInject(css);
222
236
 
223
237
  /*********************************************************************
@@ -227,11 +241,12 @@ var PopoverBody = function PopoverBody(_ref) {
227
241
  var children = _ref.children,
228
242
  className = _ref.className,
229
243
  classNameBody = _ref.classNameBody,
230
- noPadding = _ref.noPadding;
244
+ noPadding = _ref.noPadding,
245
+ darkMode = _ref.darkMode;
231
246
  return React__default.createElement("div", {
232
- className: classNames(className, styles['popover-body-container'])
247
+ className: classNames(className, styles['popover-body-container'], darkMode && styles['popover-body-container--dark-mode'])
233
248
  }, React__default.createElement("div", {
234
- className: classNames(classNameBody, styles['popover-body'], noPadding && styles['popover-body--no-padding'])
249
+ className: classNames(classNameBody, styles['popover-body'], noPadding && styles['popover-body--no-padding'], darkMode && styles['popover-body--dark-mode'])
235
250
  }, children));
236
251
  };
237
252
 
@@ -473,6 +488,7 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
473
488
  }, {
474
489
  key: "render",
475
490
  value: function render() {
491
+ var _classNames;
476
492
  var getPopoverPosition = typeof this.props.getPopoverPosition === 'function' ? this.props.getPopoverPosition : PopoverPosition[this.props.getPopoverPosition] || PopoverPosition.bottomLeft;
477
493
  var position = this.state.hostRect ? getPopoverPosition(this.state.hostRect, this.state.popoverRect, this.state.scroll, this.props.containerElement) : {};
478
494
  var containerPosition = {
@@ -494,7 +510,7 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
494
510
  opacity: this.state.adjusted ? 1 : 0
495
511
  })
496
512
  }, this.props.showTip && tipPosition && React__default.createElement("div", {
497
- className: classNames(styles['popover-tip'], styles["popover-tip--".concat(tipPosition)], 'popover-tip'),
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)),
498
514
  style: {
499
515
  top: tipPosition === 'bottom' && position.top - 8,
500
516
  bottom: tipPosition === 'top' && position.bottom - 8,
@@ -666,7 +682,8 @@ var StatelessPopover = /*#__PURE__*/function (_React$Component) {
666
682
  trackScroll: props.trackScroll,
667
683
  role: this.props.role,
668
684
  trapFocus: this.props.trapFocus,
669
- onEscapeAction: this.props.onEscapeAction
685
+ onEscapeAction: this.props.onEscapeAction,
686
+ darkMode: this.props.darkMode
670
687
  }, props.body);
671
688
  return ReactDOM.createPortal(popoverContent, container);
672
689
  }
@@ -756,7 +773,8 @@ var Popover = /*#__PURE__*/function (_React$Component) {
756
773
  onEscapeAction: this.onEscapeAction,
757
774
  isOpen: isOpen,
758
775
  role: this.props.role,
759
- trapFocus: this.props.trapFocus
776
+ trapFocus: this.props.trapFocus,
777
+ darkMode: this.props.darkMode
760
778
  }), childrenWithRef);
761
779
  }
762
780
  }]);
@@ -769,7 +787,8 @@ Popover.defaultProps = {
769
787
  outerActionEvents: ['mousedown', 'touchstart'],
770
788
  getPopoverPosition: 'bottomLeft',
771
789
  role: 'dialog',
772
- trapFocus: 'true'
790
+ trapFocus: 'true',
791
+ darkMode: false
773
792
  };
774
793
 
775
794
  /*********************************************************************
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@targetprocess/popover",
3
- "version": "12.21.0",
3
+ "version": "12.21.1-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.21.0",
15
+ "@targetprocess/global-constants": "^12.21.1-alpha.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": "973be848e3196688a1b9ee91d308a15d9cec95a1"
25
+ "gitHead": "051c638e999ccf0c8813c2ffa5d30567c48042cb"
26
26
  }
package/style/index.css CHANGED
@@ -10,6 +10,11 @@ $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
+ }
13
18
  }
14
19
 
15
20
  .popover-body {
@@ -21,6 +26,10 @@ $popoverTipSize: 16px;
21
26
  &--no-padding {
22
27
  padding: 0;
23
28
  }
29
+
30
+ &--dark-mode {
31
+ color: $gFontColorWhite;
32
+ }
24
33
  }
25
34
 
26
35
  .popover-tip {
@@ -58,12 +67,23 @@ $popoverTipSize: 16px;
58
67
  transform: rotate(45deg);
59
68
  }
60
69
 
70
+ &--dark-mode {
71
+ &:before {
72
+ background-color: $gSecond700;
73
+ border-color: $gSecond700;
74
+ }
75
+ }
76
+
61
77
  &--bottom,
62
78
  &--top {
63
79
  width: 100%;
64
80
  border-top: 1px $gBackgroundDefault;
65
81
  border-bottom: 1px $gBackgroundDefault;
66
82
  height: calc($popoverTipSize / 2 + 1px);
83
+
84
+ &--dark-mode {
85
+ border-color: $gSecond700;
86
+ }
67
87
  }
68
88
 
69
89
  &--left,
@@ -72,6 +92,10 @@ $popoverTipSize: 16px;
72
92
  border-right: 1px $gBackgroundDefault;
73
93
  height: 100%;
74
94
  width: calc($popoverTipSize / 2 + 1px);
95
+
96
+ &--dark-mode {
97
+ border-color: $gSecond700;
98
+ }
75
99
  }
76
100
 
77
101
  /*