@zag-js/radio-group 1.26.1 → 1.26.2

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/index.js CHANGED
@@ -38,12 +38,19 @@ var getRadioEl = (ctx, value) => {
38
38
  if (!value) return;
39
39
  return ctx.getById(getItemId(ctx, value));
40
40
  };
41
- var getOffsetRect = (el) => ({
42
- left: el?.offsetLeft ?? 0,
43
- top: el?.offsetTop ?? 0,
44
- width: el?.offsetWidth ?? 0,
45
- height: el?.offsetHeight ?? 0
46
- });
41
+ var getOffsetRect = (el) => {
42
+ if (!el) {
43
+ return { left: 0, top: 0, width: 0, height: 0 };
44
+ }
45
+ const rect = el.getBoundingClientRect();
46
+ const parent = el.offsetParent?.getBoundingClientRect();
47
+ return {
48
+ left: parent ? rect.left - parent.left : rect.left,
49
+ top: parent ? rect.top - parent.top : rect.top,
50
+ width: rect.width,
51
+ height: rect.height
52
+ };
53
+ };
47
54
  var resolveRect = (rect) => ({
48
55
  width: `${rect.width}px`,
49
56
  height: `${rect.height}px`,
package/dist/index.mjs CHANGED
@@ -36,12 +36,19 @@ var getRadioEl = (ctx, value) => {
36
36
  if (!value) return;
37
37
  return ctx.getById(getItemId(ctx, value));
38
38
  };
39
- var getOffsetRect = (el) => ({
40
- left: el?.offsetLeft ?? 0,
41
- top: el?.offsetTop ?? 0,
42
- width: el?.offsetWidth ?? 0,
43
- height: el?.offsetHeight ?? 0
44
- });
39
+ var getOffsetRect = (el) => {
40
+ if (!el) {
41
+ return { left: 0, top: 0, width: 0, height: 0 };
42
+ }
43
+ const rect = el.getBoundingClientRect();
44
+ const parent = el.offsetParent?.getBoundingClientRect();
45
+ return {
46
+ left: parent ? rect.left - parent.left : rect.left,
47
+ top: parent ? rect.top - parent.top : rect.top,
48
+ width: rect.width,
49
+ height: rect.height
50
+ };
51
+ };
45
52
  var resolveRect = (rect) => ({
46
53
  width: `${rect.width}px`,
47
54
  height: `${rect.height}px`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/radio-group",
3
- "version": "1.26.1",
3
+ "version": "1.26.2",
4
4
  "description": "Core logic for the radio group widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -27,12 +27,12 @@
27
27
  "url": "https://github.com/chakra-ui/zag/issues"
28
28
  },
29
29
  "dependencies": {
30
- "@zag-js/anatomy": "1.26.1",
31
- "@zag-js/dom-query": "1.26.1",
32
- "@zag-js/focus-visible": "1.26.1",
33
- "@zag-js/utils": "1.26.1",
34
- "@zag-js/core": "1.26.1",
35
- "@zag-js/types": "1.26.1"
30
+ "@zag-js/anatomy": "1.26.2",
31
+ "@zag-js/dom-query": "1.26.2",
32
+ "@zag-js/focus-visible": "1.26.2",
33
+ "@zag-js/utils": "1.26.2",
34
+ "@zag-js/core": "1.26.2",
35
+ "@zag-js/types": "1.26.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "clean-package": "2.2.0"