@targetprocess/popover 12.7.3 → 12.7.4
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/PopoverContainer.tsx +6 -1
- package/dist/popover.es.js +3 -3
- package/dist/popover.js +3 -3
- package/dist/types.d.ts +1 -1
- package/package.json +2 -2
- package/types.ts +2 -1
package/PopoverContainer.tsx
CHANGED
|
@@ -201,7 +201,12 @@ export class PopoverContainer extends React.Component<
|
|
|
201
201
|
? this.props.getPopoverPosition
|
|
202
202
|
: PopoverPosition[this.props.getPopoverPosition] || PopoverPosition.bottomLeft
|
|
203
203
|
const position = this.state.hostRect
|
|
204
|
-
? getPopoverPosition(
|
|
204
|
+
? getPopoverPosition(
|
|
205
|
+
this.state.hostRect,
|
|
206
|
+
this.state.popoverRect,
|
|
207
|
+
this.state.scroll,
|
|
208
|
+
this.props.containerElement
|
|
209
|
+
)
|
|
205
210
|
: {}
|
|
206
211
|
|
|
207
212
|
const containerPosition = {
|
package/dist/popover.es.js
CHANGED
|
@@ -198,8 +198,8 @@ function styleInject(css, ref) {
|
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
var css = ".popover-body-container__popover__12-7-
|
|
202
|
-
var styles = {"popover-body-container":"popover-body-container__popover__12-7-
|
|
201
|
+
var css = ".popover-body-container__popover__12-7-4 {\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-7-4 {\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-7-4 {\r\n padding: 0;\r\n }\r\n\r\n.popover-tip__popover__12-7-4 {\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-7-4: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-7-4,\r\n .popover-tip--top__popover__12-7-4 {\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-7-4,\r\n .popover-tip--right__popover__12-7-4 {\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-7-4: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-7-4: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-7-4: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-7-4: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";
|
|
202
|
+
var styles = {"popover-body-container":"popover-body-container__popover__12-7-4","popover-body":"popover-body__popover__12-7-4","popover-body--no-padding":"popover-body--no-padding__popover__12-7-4","popover-tip":"popover-tip__popover__12-7-4","popover-tip--bottom":"popover-tip--bottom__popover__12-7-4","popover-tip--top":"popover-tip--top__popover__12-7-4","popover-tip--left":"popover-tip--left__popover__12-7-4","popover-tip--right":"popover-tip--right__popover__12-7-4"};
|
|
203
203
|
styleInject(css);
|
|
204
204
|
|
|
205
205
|
var PopoverBody = function PopoverBody(_ref) {
|
|
@@ -415,7 +415,7 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
415
415
|
key: "render",
|
|
416
416
|
value: function render() {
|
|
417
417
|
var getPopoverPosition = typeof this.props.getPopoverPosition === 'function' ? this.props.getPopoverPosition : PopoverPosition[this.props.getPopoverPosition] || PopoverPosition.bottomLeft;
|
|
418
|
-
var position = this.state.hostRect ? getPopoverPosition(this.state.hostRect, this.state.popoverRect, this.state.scroll) : {};
|
|
418
|
+
var position = this.state.hostRect ? getPopoverPosition(this.state.hostRect, this.state.popoverRect, this.state.scroll, this.props.containerElement) : {};
|
|
419
419
|
var containerPosition = {
|
|
420
420
|
left: this.state.hostRect ? this.state.hostRect.left : 0,
|
|
421
421
|
top: this.state.hostRect ? this.state.hostRect.top : 0,
|
package/dist/popover.js
CHANGED
|
@@ -204,8 +204,8 @@ function styleInject(css, ref) {
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
var css = ".popover-body-container__popover__12-7-
|
|
208
|
-
var styles = {"popover-body-container":"popover-body-container__popover__12-7-
|
|
207
|
+
var css = ".popover-body-container__popover__12-7-4 {\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-7-4 {\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-7-4 {\r\n padding: 0;\r\n }\r\n\r\n.popover-tip__popover__12-7-4 {\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-7-4: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-7-4,\r\n .popover-tip--top__popover__12-7-4 {\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-7-4,\r\n .popover-tip--right__popover__12-7-4 {\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-7-4: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-7-4: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-7-4: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-7-4: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";
|
|
208
|
+
var styles = {"popover-body-container":"popover-body-container__popover__12-7-4","popover-body":"popover-body__popover__12-7-4","popover-body--no-padding":"popover-body--no-padding__popover__12-7-4","popover-tip":"popover-tip__popover__12-7-4","popover-tip--bottom":"popover-tip--bottom__popover__12-7-4","popover-tip--top":"popover-tip--top__popover__12-7-4","popover-tip--left":"popover-tip--left__popover__12-7-4","popover-tip--right":"popover-tip--right__popover__12-7-4"};
|
|
209
209
|
styleInject(css);
|
|
210
210
|
|
|
211
211
|
var PopoverBody = function PopoverBody(_ref) {
|
|
@@ -421,7 +421,7 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
421
421
|
key: "render",
|
|
422
422
|
value: function render() {
|
|
423
423
|
var getPopoverPosition = typeof this.props.getPopoverPosition === 'function' ? this.props.getPopoverPosition : PopoverPosition[this.props.getPopoverPosition] || PopoverPosition.bottomLeft;
|
|
424
|
-
var position = this.state.hostRect ? getPopoverPosition(this.state.hostRect, this.state.popoverRect, this.state.scroll) : {};
|
|
424
|
+
var position = this.state.hostRect ? getPopoverPosition(this.state.hostRect, this.state.popoverRect, this.state.scroll, this.props.containerElement) : {};
|
|
425
425
|
var containerPosition = {
|
|
426
426
|
left: this.state.hostRect ? this.state.hostRect.left : 0,
|
|
427
427
|
top: this.state.hostRect ? this.state.hostRect.top : 0,
|
package/dist/types.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare type DimensionParams = {
|
|
|
9
9
|
height: number;
|
|
10
10
|
width: number;
|
|
11
11
|
};
|
|
12
|
-
export declare type GetPopoverPositionCallback = (hostRect: DimensionParams, popoverRect: DimensionParams, containerScroll: PositionParams) => CSSProperties;
|
|
12
|
+
export declare type GetPopoverPositionCallback = (hostRect: DimensionParams, popoverRect: DimensionParams, containerScroll: PositionParams, containerElement?: HTMLElement) => CSSProperties;
|
|
13
13
|
export declare type DefaultPopoverPositions = {
|
|
14
14
|
bottomLeft: GetPopoverPositionCallback;
|
|
15
15
|
bottom: GetPopoverPositionCallback;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@targetprocess/popover",
|
|
3
|
-
"version": "12.7.
|
|
3
|
+
"version": "12.7.4",
|
|
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": "
|
|
24
|
+
"gitHead": "5b5fe47a0487c63dd7cafca4f7735106b09e8926"
|
|
25
25
|
}
|
package/types.ts
CHANGED
|
@@ -15,7 +15,8 @@ export type DimensionParams = {
|
|
|
15
15
|
export type GetPopoverPositionCallback = (
|
|
16
16
|
hostRect: DimensionParams,
|
|
17
17
|
popoverRect: DimensionParams,
|
|
18
|
-
containerScroll: PositionParams
|
|
18
|
+
containerScroll: PositionParams,
|
|
19
|
+
containerElement?: HTMLElement
|
|
19
20
|
) => CSSProperties
|
|
20
21
|
|
|
21
22
|
export type DefaultPopoverPositions = {
|