@oneplatformdev/ui 0.1.99-beta.248 → 0.1.99-beta.249
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## 0.1.99-beta.249 (2026-03-11)
|
|
2
|
+
|
|
3
|
+
### 🧱 Updated Dependencies
|
|
4
|
+
|
|
5
|
+
- Updated @oneplatformdev/utils to 0.1.99-beta.249
|
|
6
|
+
- Updated @oneplatformdev/hooks to 0.1.99-beta.249
|
|
7
|
+
- Updated @oneplatformdev/tokens to 0.1.99-beta.249
|
|
8
|
+
|
|
1
9
|
## 0.1.99-beta.248 (2026-03-10)
|
|
2
10
|
|
|
3
11
|
### 🧱 Updated Dependencies
|
|
@@ -2,14 +2,10 @@ import * as React from 'react';
|
|
|
2
2
|
type UseDialogClosePositionOptions = {
|
|
3
3
|
enabled?: boolean;
|
|
4
4
|
titleSelector?: string;
|
|
5
|
-
fallback?: {
|
|
6
|
-
top: number;
|
|
7
|
-
right: number;
|
|
8
|
-
};
|
|
9
5
|
};
|
|
10
6
|
type DialogClosePosition = {
|
|
11
|
-
top
|
|
12
|
-
right
|
|
7
|
+
top?: number;
|
|
8
|
+
right?: number;
|
|
13
9
|
};
|
|
14
10
|
export declare function useDialogClosePosition(contentRef: React.RefObject<HTMLElement | null>, options?: UseDialogClosePositionOptions): DialogClosePosition;
|
|
15
11
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDialogClosePosition.d.ts","sourceRoot":"","sources":["../../src/Dialog/useDialogClosePosition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,KAAK,6BAA6B,GAAG;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"useDialogClosePosition.d.ts","sourceRoot":"","sources":["../../src/Dialog/useDialogClosePosition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,KAAK,6BAA6B,GAAG;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAC/C,OAAO,CAAC,EAAE,6BAA6B,uBAuFxC"}
|
|
@@ -1,57 +1,53 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
function
|
|
1
|
+
import * as c from "react";
|
|
2
|
+
function h(s, l) {
|
|
3
3
|
const {
|
|
4
4
|
enabled: a = !0,
|
|
5
|
-
titleSelector:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const e =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
titleSelector: u = '[data-slot="dialog-title"]'
|
|
6
|
+
} = l ?? {}, [d, g] = c.useState({}), r = c.useCallback((t) => {
|
|
7
|
+
g((e) => e.top === t.top && e.right === t.right ? e : t);
|
|
8
|
+
}, []), o = c.useCallback(() => {
|
|
9
|
+
const t = s.current;
|
|
10
|
+
if (!a || !t) {
|
|
11
|
+
r({});
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const e = t.querySelector(u);
|
|
15
|
+
if (!e) {
|
|
16
|
+
r({});
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const n = t.getBoundingClientRect(), i = e.getBoundingClientRect();
|
|
20
|
+
if (n.width <= 0 || n.height <= 0 || i.width <= 0 || i.height <= 0) {
|
|
21
|
+
r({});
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
r({
|
|
25
|
+
top: Math.round(i.top - n.top),
|
|
26
|
+
right: Math.round(n.right - i.right)
|
|
27
|
+
});
|
|
28
|
+
}, [s, a, r, u]);
|
|
29
|
+
return c.useEffect(() => {
|
|
23
30
|
if (!a) {
|
|
24
|
-
|
|
31
|
+
r({});
|
|
25
32
|
return;
|
|
26
33
|
}
|
|
27
|
-
let
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}), e.observe(t);
|
|
34
|
-
const d = t.querySelector(s);
|
|
35
|
-
d && e.observe(d), i = new MutationObserver(() => {
|
|
36
|
-
n();
|
|
37
|
-
const f = t.querySelector(s);
|
|
38
|
-
f && e && (e.disconnect(), e.observe(t), e.observe(f));
|
|
39
|
-
}), i.observe(t, {
|
|
40
|
-
childList: !0,
|
|
41
|
-
subtree: !0,
|
|
42
|
-
characterData: !0
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
return o = requestAnimationFrame(() => {
|
|
46
|
-
c = requestAnimationFrame(() => {
|
|
47
|
-
m();
|
|
34
|
+
let t = 0, e = 0;
|
|
35
|
+
const n = s.current;
|
|
36
|
+
if (!n) return;
|
|
37
|
+
t = requestAnimationFrame(() => {
|
|
38
|
+
e = requestAnimationFrame(() => {
|
|
39
|
+
o();
|
|
48
40
|
});
|
|
49
|
-
})
|
|
50
|
-
|
|
41
|
+
});
|
|
42
|
+
const i = new ResizeObserver(() => {
|
|
43
|
+
o();
|
|
44
|
+
});
|
|
45
|
+
return i.observe(n), window.addEventListener("resize", o), () => {
|
|
46
|
+
cancelAnimationFrame(t), cancelAnimationFrame(e), i.disconnect(), window.removeEventListener("resize", o);
|
|
51
47
|
};
|
|
52
|
-
}, [
|
|
48
|
+
}, [s, a, o, r]), d;
|
|
53
49
|
}
|
|
54
50
|
export {
|
|
55
|
-
|
|
51
|
+
h as useDialogClosePosition
|
|
56
52
|
};
|
|
57
53
|
//# sourceMappingURL=useDialogClosePosition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDialogClosePosition.js","sources":["../../src/Dialog/useDialogClosePosition.ts"],"sourcesContent":["import * as React from 'react';\n\ntype UseDialogClosePositionOptions = {\n enabled?: boolean;\n titleSelector?: string;\n
|
|
1
|
+
{"version":3,"file":"useDialogClosePosition.js","sources":["../../src/Dialog/useDialogClosePosition.ts"],"sourcesContent":["import * as React from 'react';\n\ntype UseDialogClosePositionOptions = {\n enabled?: boolean;\n titleSelector?: string;\n};\n\ntype DialogClosePosition = {\n top?: number;\n right?: number;\n};\n\nexport function useDialogClosePosition(\n contentRef: React.RefObject<HTMLElement | null>,\n options?: UseDialogClosePositionOptions,\n) {\n const {\n enabled = true,\n titleSelector = '[data-slot=\"dialog-title\"]',\n } = options ?? {};\n\n const [position, setPosition] = React.useState<DialogClosePosition>({});\n\n const setIfChanged = React.useCallback((next: DialogClosePosition) => {\n setPosition((prev) => {\n if (prev.top === next.top && prev.right === next.right) {\n return prev;\n }\n\n return next;\n });\n }, []);\n\n const measure = React.useCallback(() => {\n const contentEl = contentRef.current;\n\n if (!enabled || !contentEl) {\n setIfChanged({});\n return;\n }\n\n const titleEl = contentEl.querySelector<HTMLElement>(titleSelector);\n\n if (!titleEl) {\n setIfChanged({});\n return;\n }\n\n const contentRect = contentEl.getBoundingClientRect();\n const titleRect = titleEl.getBoundingClientRect();\n\n if (\n contentRect.width <= 0 ||\n contentRect.height <= 0 ||\n titleRect.width <= 0 ||\n titleRect.height <= 0\n ) {\n setIfChanged({});\n return;\n }\n\n setIfChanged({\n top: Math.round(titleRect.top - contentRect.top),\n right: Math.round(contentRect.right - titleRect.right),\n });\n }, [contentRef, enabled, setIfChanged, titleSelector]);\n\n React.useEffect(() => {\n if (!enabled) {\n setIfChanged({});\n return;\n }\n\n let raf1 = 0;\n let raf2 = 0;\n\n const contentEl = contentRef.current;\n if (!contentEl) return;\n\n raf1 = requestAnimationFrame(() => {\n raf2 = requestAnimationFrame(() => {\n measure();\n });\n });\n\n const resizeObserver = new ResizeObserver(() => {\n measure();\n });\n\n resizeObserver.observe(contentEl);\n window.addEventListener('resize', measure);\n\n return () => {\n cancelAnimationFrame(raf1);\n cancelAnimationFrame(raf2);\n resizeObserver.disconnect();\n window.removeEventListener('resize', measure);\n };\n }, [contentRef, enabled, measure, setIfChanged]);\n\n return position;\n}\n"],"names":["useDialogClosePosition","contentRef","options","enabled","titleSelector","position","setPosition","React","setIfChanged","next","prev","measure","contentEl","titleEl","contentRect","titleRect","raf1","raf2","resizeObserver"],"mappings":";AAYO,SAASA,EACdC,GACAC,GACA;AACA,QAAM;AAAA,IACJ,SAAAC,IAAU;AAAA,IACV,eAAAC,IAAgB;AAAA,EAAA,IACdF,KAAW,CAAA,GAET,CAACG,GAAUC,CAAW,IAAIC,EAAM,SAA8B,CAAA,CAAE,GAEhEC,IAAeD,EAAM,YAAY,CAACE,MAA8B;AACpE,IAAAH,EAAY,CAACI,MACPA,EAAK,QAAQD,EAAK,OAAOC,EAAK,UAAUD,EAAK,QACxCC,IAGFD,CACR;AAAA,EACH,GAAG,CAAA,CAAE,GAECE,IAAUJ,EAAM,YAAY,MAAM;AACtC,UAAMK,IAAYX,EAAW;AAE7B,QAAI,CAACE,KAAW,CAACS,GAAW;AAC1B,MAAAJ,EAAa,CAAA,CAAE;AACf;AAAA,IACF;AAEA,UAAMK,IAAUD,EAAU,cAA2BR,CAAa;AAElE,QAAI,CAACS,GAAS;AACZ,MAAAL,EAAa,CAAA,CAAE;AACf;AAAA,IACF;AAEA,UAAMM,IAAcF,EAAU,sBAAA,GACxBG,IAAYF,EAAQ,sBAAA;AAE1B,QACEC,EAAY,SAAS,KACrBA,EAAY,UAAU,KACtBC,EAAU,SAAS,KACnBA,EAAU,UAAU,GACpB;AACA,MAAAP,EAAa,CAAA,CAAE;AACf;AAAA,IACF;AAEA,IAAAA,EAAa;AAAA,MACX,KAAK,KAAK,MAAMO,EAAU,MAAMD,EAAY,GAAG;AAAA,MAC/C,OAAO,KAAK,MAAMA,EAAY,QAAQC,EAAU,KAAK;AAAA,IAAA,CACtD;AAAA,EACH,GAAG,CAACd,GAAYE,GAASK,GAAcJ,CAAa,CAAC;AAErD,SAAAG,EAAM,UAAU,MAAM;AACpB,QAAI,CAACJ,GAAS;AACZ,MAAAK,EAAa,CAAA,CAAE;AACf;AAAA,IACF;AAEA,QAAIQ,IAAO,GACPC,IAAO;AAEX,UAAML,IAAYX,EAAW;AAC7B,QAAI,CAACW,EAAW;AAEhB,IAAAI,IAAO,sBAAsB,MAAM;AACjC,MAAAC,IAAO,sBAAsB,MAAM;AACjC,QAAAN,EAAA;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAED,UAAMO,IAAiB,IAAI,eAAe,MAAM;AAC9C,MAAAP,EAAA;AAAA,IACF,CAAC;AAED,WAAAO,EAAe,QAAQN,CAAS,GAChC,OAAO,iBAAiB,UAAUD,CAAO,GAElC,MAAM;AACX,2BAAqBK,CAAI,GACzB,qBAAqBC,CAAI,GACzBC,EAAe,WAAA,GACf,OAAO,oBAAoB,UAAUP,CAAO;AAAA,IAC9C;AAAA,EACF,GAAG,CAACV,GAAYE,GAASQ,GAASH,CAAY,CAAC,GAExCH;AACT;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneplatformdev/ui",
|
|
3
|
-
"version": "0.1.99-beta.
|
|
3
|
+
"version": "0.1.99-beta.249",
|
|
4
4
|
"description": "UI component library for OnePlatform",
|
|
5
5
|
"author": "One Platform Development Team",
|
|
6
6
|
"keywords": [
|
|
@@ -106,9 +106,9 @@
|
|
|
106
106
|
"recharts": "^3.2.0",
|
|
107
107
|
"sonner": "^2.0.7",
|
|
108
108
|
"vaul": "^1.1.2",
|
|
109
|
-
"@oneplatformdev/tokens": "^0.1.99-beta.
|
|
110
|
-
"@oneplatformdev/
|
|
111
|
-
"@oneplatformdev/
|
|
109
|
+
"@oneplatformdev/tokens": "^0.1.99-beta.249",
|
|
110
|
+
"@oneplatformdev/hooks": "^0.1.99-beta.249",
|
|
111
|
+
"@oneplatformdev/utils": "^0.1.99-beta.249"
|
|
112
112
|
},
|
|
113
113
|
"scripts": {
|
|
114
114
|
"chromatic": "chromatic"
|