@os-design/core 1.0.275 → 1.0.277
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/dist/Popover/index.d.ts +1 -1
- package/dist/Popover/index.d.ts.map +1 -1
- package/dist/Popover/index.js +10 -2
- package/package.json +3 -3
- package/src/Popover/index.tsx +12 -3
package/dist/Popover/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface PopoverProps extends JsxDivProps, WithSize {
|
|
|
12
12
|
* Where the popover will be rendered.
|
|
13
13
|
* @default document.body
|
|
14
14
|
*/
|
|
15
|
-
container?: Element |
|
|
15
|
+
container?: RefObject<Element> | Element | null;
|
|
16
16
|
/**
|
|
17
17
|
* On which side of the element the popover will appear.
|
|
18
18
|
* @default top
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Popover/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAW9D,OAAO,EAGL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AACf,OAA2B,EACzB,KAAK,SAAS,EACd,KAAK,IAAI,EACV,MAAM,+BAA+B,CAAC;AAEvC,KAAK,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;AAC7D,MAAM,WAAW,YAAa,SAAQ,WAAW,EAAE,QAAQ;IACzD;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IACpC;;;OAGG;IACH,SAAS,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Popover/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAW9D,OAAO,EAGL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AACf,OAA2B,EACzB,KAAK,SAAS,EACd,KAAK,IAAI,EACV,MAAM,+BAA+B,CAAC;AAEvC,KAAK,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;AAC7D,MAAM,WAAW,YAAa,SAAQ,WAAW,EAAE,QAAQ;IACzD;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IACpC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC;IAChD;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAuDD;;GAEG;AACH,QAAA,MAAM,OAAO,yGAkIZ,CAAC;AAIF,eAAe,OAAO,CAAC"}
|
package/dist/Popover/index.js
CHANGED
|
@@ -88,9 +88,17 @@ const Popover = /*#__PURE__*/forwardRef(({
|
|
|
88
88
|
current
|
|
89
89
|
} = trigger;
|
|
90
90
|
if (!current) return;
|
|
91
|
-
|
|
91
|
+
const rect = current.getBoundingClientRect();
|
|
92
|
+
if (container) {
|
|
93
|
+
const containerElement = container instanceof Element ? container : container.current;
|
|
94
|
+
if (!containerElement) return;
|
|
95
|
+
const containerRect = containerElement.getBoundingClientRect();
|
|
96
|
+
rect.x -= containerRect.x;
|
|
97
|
+
rect.y -= containerRect.y;
|
|
98
|
+
}
|
|
99
|
+
setTriggerRect(rect);
|
|
92
100
|
});
|
|
93
|
-
}, [trigger]);
|
|
101
|
+
}, [container, trigger]);
|
|
94
102
|
useBrowserLayoutEffect(() => {
|
|
95
103
|
if (!visible) return;
|
|
96
104
|
triggerResizeListener();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@os-design/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.277",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": "git@gitlab.com:os-team/libs/os-design.git",
|
|
6
6
|
"type": "module",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@os-design/input-password-utils": "^1.0.3",
|
|
36
36
|
"@os-design/media": "^1.0.32",
|
|
37
37
|
"@os-design/menu-utils": "^1.0.28",
|
|
38
|
-
"@os-design/portal": "^1.0.
|
|
38
|
+
"@os-design/portal": "^1.0.25",
|
|
39
39
|
"@os-design/styles": "^1.0.65",
|
|
40
40
|
"@os-design/theming": "^1.0.61",
|
|
41
41
|
"@os-design/time-picker-utils": "^1.0.23",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"react": "18",
|
|
59
59
|
"react-dom": "18"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "73c07308561addb0b095734a9a9bd3e3a773fa61"
|
|
62
62
|
}
|
package/src/Popover/index.tsx
CHANGED
|
@@ -37,7 +37,7 @@ export interface PopoverProps extends JsxDivProps, WithSize {
|
|
|
37
37
|
* Where the popover will be rendered.
|
|
38
38
|
* @default document.body
|
|
39
39
|
*/
|
|
40
|
-
container?: Element |
|
|
40
|
+
container?: RefObject<Element> | Element | null;
|
|
41
41
|
/**
|
|
42
42
|
* On which side of the element the popover will appear.
|
|
43
43
|
* @default top
|
|
@@ -169,9 +169,18 @@ const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
169
169
|
if (!trigger) return;
|
|
170
170
|
const { current } = trigger as RefObject<Element>;
|
|
171
171
|
if (!current) return;
|
|
172
|
-
|
|
172
|
+
const rect = current.getBoundingClientRect();
|
|
173
|
+
if (container) {
|
|
174
|
+
const containerElement =
|
|
175
|
+
container instanceof Element ? container : container.current;
|
|
176
|
+
if (!containerElement) return;
|
|
177
|
+
const containerRect = containerElement.getBoundingClientRect();
|
|
178
|
+
rect.x -= containerRect.x;
|
|
179
|
+
rect.y -= containerRect.y;
|
|
180
|
+
}
|
|
181
|
+
setTriggerRect(rect);
|
|
173
182
|
});
|
|
174
|
-
}, [trigger]);
|
|
183
|
+
}, [container, trigger]);
|
|
175
184
|
useBrowserLayoutEffect(() => {
|
|
176
185
|
if (!visible) return;
|
|
177
186
|
triggerResizeListener();
|