@bioturing/components 0.29.2 → 0.30.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/dist/components/hooks/antd.js +9 -11
- package/dist/components/hooks/antd.js.map +1 -1
- package/dist/components/hooks/useBreakpoint.js +50 -0
- package/dist/components/hooks/useBreakpoint.js.map +1 -0
- package/dist/components/hooks/useResizeObserver.js +52 -0
- package/dist/components/hooks/useResizeObserver.js.map +1 -0
- package/dist/components/hooks/useWindowSize.js +23 -0
- package/dist/components/hooks/useWindowSize.js.map +1 -0
- package/dist/components/modal/index.js.map +1 -1
- package/dist/components/resizable/component.js +107 -90
- package/dist/components/resizable/component.js.map +1 -1
- package/dist/index.d.ts +60 -8
- package/dist/index.js +132 -125
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import s from "antd/es/theme";
|
|
3
|
-
import t from "antd/es/grid";
|
|
4
3
|
import o from "antd/es/app/useApp";
|
|
5
|
-
import { default as
|
|
6
|
-
import { useForm as l, useWatch as
|
|
7
|
-
const
|
|
4
|
+
import { default as c } from "antd/es/app/useApp";
|
|
5
|
+
import { useForm as l, useWatch as d } from "antd/es/form/Form";
|
|
6
|
+
const u = s.useToken, m = () => {
|
|
8
7
|
const { message: e } = o();
|
|
9
8
|
return e;
|
|
10
|
-
},
|
|
9
|
+
}, n = () => {
|
|
11
10
|
const { modal: e } = o();
|
|
12
11
|
return e;
|
|
13
12
|
};
|
|
14
13
|
export {
|
|
15
|
-
|
|
16
|
-
p as useBreakpoint,
|
|
14
|
+
c as useApp,
|
|
17
15
|
l as useForm,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
m as useMessage,
|
|
17
|
+
n as useModal,
|
|
18
|
+
u as useToken,
|
|
19
|
+
d as useWatch
|
|
22
20
|
};
|
|
23
21
|
//# sourceMappingURL=antd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"antd.js","sources":["../../../src/components/hooks/antd.ts"],"sourcesContent":["\"use client\";\nimport theme from \"antd/es/theme\";\
|
|
1
|
+
{"version":3,"file":"antd.js","sources":["../../../src/components/hooks/antd.ts"],"sourcesContent":["\"use client\";\nimport theme from \"antd/es/theme\";\n// import Grid from \"antd/es/grid\";\nimport useApp from \"antd/es/app/useApp\";\n\nexport const useToken = theme.useToken;\n// export const useBreakpoint = Grid.useBreakpoint;\n\nexport { useForm, useWatch } from \"antd/es/form/Form\";\n\nexport const useMessage = () => {\n const { message } = useApp();\n return message;\n};\n\nexport const useModal = () => {\n const { modal } = useApp();\n return modal;\n};\n\nexport { useApp };\n"],"names":["useToken","theme","useMessage","message","useApp","useModal","modal"],"mappings":";;;;;AAKO,MAAMA,IAAWC,EAAM,UAKjBC,IAAa,MAAM;AACxB,QAAA,EAAE,SAAAC,EAAQ,IAAIC,EAAO;AACpB,SAAAD;AACT,GAEaE,IAAW,MAAM;AACtB,QAAA,EAAE,OAAAC,EAAM,IAAIF,EAAO;AAClB,SAAAE;AACT;"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as r, useMemo as M, useEffect as x, useCallback as w } from "react";
|
|
3
|
+
const e = {
|
|
4
|
+
sm: 640,
|
|
5
|
+
md: 768,
|
|
6
|
+
lg: 1024,
|
|
7
|
+
xl: 1280,
|
|
8
|
+
"2xl": 1536
|
|
9
|
+
}, q = (h = "lg") => {
|
|
10
|
+
const [i, l] = r(h), [d, u] = r(!1), a = M(() => {
|
|
11
|
+
const t = {};
|
|
12
|
+
return typeof window < "u" && (t.sm = window.matchMedia(`(max-width: ${e.md - 1}px)`), t.md = window.matchMedia(`(min-width: ${e.md}px) and (max-width: ${e.lg - 1}px)`), t.lg = window.matchMedia(`(min-width: ${e.lg}px) and (max-width: ${e.xl - 1}px)`), t.xl = window.matchMedia(`(min-width: ${e.xl}px) and (max-width: ${e["2xl"] - 1}px)`), t["2xl"] = window.matchMedia(`(min-width: ${e["2xl"]}px)`)), t;
|
|
13
|
+
}, []);
|
|
14
|
+
x(() => {
|
|
15
|
+
u(!0);
|
|
16
|
+
}, []), x(() => {
|
|
17
|
+
if (typeof window > "u" || !d) return;
|
|
18
|
+
const t = () => {
|
|
19
|
+
var m, o, s, c;
|
|
20
|
+
let n = "sm";
|
|
21
|
+
(m = a["2xl"]) != null && m.matches ? n = "2xl" : (o = a.xl) != null && o.matches ? n = "xl" : (s = a.lg) != null && s.matches ? n = "lg" : (c = a.md) != null && c.matches ? n = "md" : n = "sm", l(n);
|
|
22
|
+
};
|
|
23
|
+
return t(), Object.values(a).forEach((n) => {
|
|
24
|
+
n && n.addEventListener("change", t);
|
|
25
|
+
}), () => {
|
|
26
|
+
Object.values(a).forEach((n) => {
|
|
27
|
+
n && n.removeEventListener("change", t);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
}, [a, d]);
|
|
31
|
+
const f = w((t) => typeof window > "u" || !d ? e[i] >= e[t] : window.matchMedia(`(min-width: ${e[t]}px)`).matches, [d, i]), p = w((t) => typeof window > "u" || !d ? e[i] < e[t] : window.matchMedia(`(max-width: ${e[t] - 1}px)`).matches, [d, i]), $ = w((t, n) => typeof window > "u" || !d ? e[i] >= e[t] && e[i] < e[n] : window.matchMedia(`(min-width: ${e[t]}px) and (max-width: ${e[n] - 1}px)`).matches, [d, i]), y = w((t) => {
|
|
32
|
+
if (typeof window > "u" || !d)
|
|
33
|
+
return i === t;
|
|
34
|
+
const n = Object.keys(e), m = n.indexOf(t), o = n[m + 1];
|
|
35
|
+
let s;
|
|
36
|
+
return m === 0 ? s = `(max-width: ${e.md - 1}px)` : o ? s = `(min-width: ${e[t]}px) and (max-width: ${e[o] - 1}px)` : s = `(min-width: ${e[t]}px)`, window.matchMedia(s).matches;
|
|
37
|
+
}, [d, i]);
|
|
38
|
+
return {
|
|
39
|
+
breakpoint: i,
|
|
40
|
+
up: f,
|
|
41
|
+
down: p,
|
|
42
|
+
between: $,
|
|
43
|
+
only: y
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
e as BREAKPOINTS,
|
|
48
|
+
q as useBreakpoint
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=useBreakpoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBreakpoint.js","sources":["../../../src/components/hooks/useBreakpoint.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useState, useCallback, useMemo } from \"react\";\n\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\";\n\nexport const BREAKPOINTS = {\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n \"2xl\": 1536,\n};\n\n/**\n * A responsive breakpoint hook using window.matchMedia for optimal performance.\n *\n * @param ssrBreakpoint - The breakpoint to use during SSR and before hydration.\n * Defaults to \"lg\" for better SEO (search engines typically use desktop viewports).\n *\n * @example\n * ```tsx\n * // Default: uses \"lg\" for SSR\n * const bp = useBreakpoint();\n *\n * // Custom SSR breakpoint\n * const bp = useBreakpoint(\"md\");\n *\n * // Usage\n * bp.breakpoint // Current breakpoint: \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\"\n * bp.up(\"md\") // true if screen >= 768px\n * bp.down(\"lg\") // true if screen < 1024px\n * bp.between(\"md\", \"xl\") // true if 768px <= screen < 1280px\n * bp.only(\"lg\") // true if screen is exactly in \"lg\" range\n * ```\n */\nexport const useBreakpoint = (ssrBreakpoint: Breakpoint = \"lg\") => {\n const [breakpoint, setBreakpoint] = useState<Breakpoint>(ssrBreakpoint);\n const [isHydrated, setIsHydrated] = useState(false);\n\n // Generate media queries\n const mediaQueries = useMemo(() => {\n const queries: Record<Breakpoint, MediaQueryList> = {} as any;\n if (typeof window !== 'undefined') {\n queries.sm = window.matchMedia(`(max-width: ${BREAKPOINTS.md - 1}px)`);\n queries.md = window.matchMedia(`(min-width: ${BREAKPOINTS.md}px) and (max-width: ${BREAKPOINTS.lg - 1}px)`);\n queries.lg = window.matchMedia(`(min-width: ${BREAKPOINTS.lg}px) and (max-width: ${BREAKPOINTS.xl - 1}px)`);\n queries.xl = window.matchMedia(`(min-width: ${BREAKPOINTS.xl}px) and (max-width: ${BREAKPOINTS[\"2xl\"] - 1}px)`);\n queries[\"2xl\"] = window.matchMedia(`(min-width: ${BREAKPOINTS[\"2xl\"]}px)`);\n }\n return queries;\n }, []);\n\n useEffect(() => {\n setIsHydrated(true);\n }, []);\n\n useEffect(() => {\n if (typeof window === 'undefined' || !isHydrated) return;\n\n const updateBreakpoint = () => {\n let currentBp: Breakpoint = \"sm\";\n\n if (mediaQueries[\"2xl\"]?.matches) currentBp = \"2xl\";\n else if (mediaQueries.xl?.matches) currentBp = \"xl\";\n else if (mediaQueries.lg?.matches) currentBp = \"lg\";\n else if (mediaQueries.md?.matches) currentBp = \"md\";\n else currentBp = \"sm\";\n\n setBreakpoint(currentBp);\n };\n\n // Initial check\n updateBreakpoint();\n\n // Add listeners\n Object.values(mediaQueries).forEach(mq => {\n if (mq) mq.addEventListener('change', updateBreakpoint);\n });\n\n return () => {\n Object.values(mediaQueries).forEach(mq => {\n if (mq) mq.removeEventListener('change', updateBreakpoint);\n });\n };\n }, [mediaQueries, isHydrated]);\n\n // Min width check: is current width >= breakpoint\n const up = useCallback((bp: Breakpoint) => {\n if (typeof window === 'undefined' || !isHydrated) {\n // SSR fallback: check if ssrBreakpoint >= bp\n return BREAKPOINTS[breakpoint] >= BREAKPOINTS[bp];\n }\n const mq = window.matchMedia(`(min-width: ${BREAKPOINTS[bp]}px)`);\n return mq.matches;\n }, [isHydrated, breakpoint]);\n\n // Max width check: is current width < breakpoint\n const down = useCallback((bp: Breakpoint) => {\n if (typeof window === 'undefined' || !isHydrated) {\n // SSR fallback: check if ssrBreakpoint < bp\n return BREAKPOINTS[breakpoint] < BREAKPOINTS[bp];\n }\n const mq = window.matchMedia(`(max-width: ${BREAKPOINTS[bp] - 1}px)`);\n return mq.matches;\n }, [isHydrated, breakpoint]);\n\n // Range check: is current width between min and max breakpoints\n const between = useCallback((minBp: Breakpoint, maxBp: Breakpoint) => {\n if (typeof window === 'undefined' || !isHydrated) {\n // SSR fallback: check if minBp <= ssrBreakpoint < maxBp\n return BREAKPOINTS[breakpoint] >= BREAKPOINTS[minBp] && BREAKPOINTS[breakpoint] < BREAKPOINTS[maxBp];\n }\n const mq = window.matchMedia(`(min-width: ${BREAKPOINTS[minBp]}px) and (max-width: ${BREAKPOINTS[maxBp] - 1}px)`);\n return mq.matches;\n }, [isHydrated, breakpoint]);\n\n // Only check: is current width only within this breakpoint range\n const only = useCallback((bp: Breakpoint) => {\n if (typeof window === 'undefined' || !isHydrated) {\n // SSR fallback: check if ssrBreakpoint === bp\n return breakpoint === bp;\n }\n\n const breakpointKeys = Object.keys(BREAKPOINTS) as Breakpoint[];\n const currentIndex = breakpointKeys.indexOf(bp);\n const nextBp = breakpointKeys[currentIndex + 1];\n\n let query: string;\n if (currentIndex === 0) {\n // For 'sm', check if width < md\n query = `(max-width: ${BREAKPOINTS.md - 1}px)`;\n } else if (!nextBp) {\n // For highest breakpoint, check if width >= current\n query = `(min-width: ${BREAKPOINTS[bp]}px)`;\n } else {\n // For middle breakpoints, check range\n query = `(min-width: ${BREAKPOINTS[bp]}px) and (max-width: ${BREAKPOINTS[nextBp] - 1}px)`;\n }\n\n const mq = window.matchMedia(query);\n return mq.matches;\n }, [isHydrated, breakpoint]);\n\n return {\n breakpoint,\n up,\n down,\n between,\n only,\n };\n};\n"],"names":["BREAKPOINTS","useBreakpoint","ssrBreakpoint","breakpoint","setBreakpoint","useState","isHydrated","setIsHydrated","mediaQueries","useMemo","queries","useEffect","updateBreakpoint","currentBp","_a","_b","_c","_d","mq","up","useCallback","bp","down","between","minBp","maxBp","only","breakpointKeys","currentIndex","nextBp","query"],"mappings":";;AAKO,MAAMA,IAAc;AAAA,EACzB,IAAI;AAAA,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C/B6B,IAKFC,IAAA,eAAe9B,EAAYqB,CAAE,CAAC,uBAAuBrB,EAAY6B,CAAM,IAAI,CAAC,QAH5EC,IAAA,eAAe9B,EAAYqB,CAAE,CAAC,OAM7B,OAAO,WAAWS,CAAK,EACxB;AAAA,EAAA,GACT,CAACxB,GAAYH,CAAU,CAAC;AAEpB,SAAA;AAAA,IACL,YAAAA;AAAA,IACA,IAAAgB;AAAA,IACA,MAAAG;AAAA,IACA,SAAAC;AAAA,IACA,MAAAG;AAAA,EACF;AACF;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef as l, useState as R, useMemo as d, useEffect as z } from "react";
|
|
3
|
+
const S = {
|
|
4
|
+
x: 0,
|
|
5
|
+
y: 0,
|
|
6
|
+
width: 0,
|
|
7
|
+
height: 0,
|
|
8
|
+
top: 0,
|
|
9
|
+
left: 0,
|
|
10
|
+
bottom: 0,
|
|
11
|
+
right: 0
|
|
12
|
+
};
|
|
13
|
+
function x(o) {
|
|
14
|
+
const n = l(0), e = l(null), [r, u] = R(S), c = d(
|
|
15
|
+
() => typeof window < "u" ? new ResizeObserver((m) => {
|
|
16
|
+
const t = m[0];
|
|
17
|
+
t && (cancelAnimationFrame(n.current), n.current = requestAnimationFrame(() => {
|
|
18
|
+
var s, f;
|
|
19
|
+
if (e.current) {
|
|
20
|
+
const i = ((s = t.borderBoxSize) == null ? void 0 : s[0]) || ((f = t.contentBoxSize) == null ? void 0 : f[0]);
|
|
21
|
+
if (i) {
|
|
22
|
+
const a = i.inlineSize, h = i.blockSize;
|
|
23
|
+
u({
|
|
24
|
+
width: a,
|
|
25
|
+
height: h,
|
|
26
|
+
x: t.contentRect.x,
|
|
27
|
+
y: t.contentRect.y,
|
|
28
|
+
top: t.contentRect.top,
|
|
29
|
+
left: t.contentRect.left,
|
|
30
|
+
bottom: t.contentRect.bottom,
|
|
31
|
+
right: t.contentRect.right
|
|
32
|
+
});
|
|
33
|
+
} else
|
|
34
|
+
u(t.contentRect);
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
}) : null,
|
|
38
|
+
[]
|
|
39
|
+
);
|
|
40
|
+
return z(() => (e.current && (c == null || c.observe(e.current, o)), () => {
|
|
41
|
+
c == null || c.disconnect(), n.current && cancelAnimationFrame(n.current);
|
|
42
|
+
}), [e.current]), [e, r];
|
|
43
|
+
}
|
|
44
|
+
function g(o) {
|
|
45
|
+
const [n, { width: e, height: r }] = x(o);
|
|
46
|
+
return { ref: n, width: e, height: r };
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
g as useElementSize,
|
|
50
|
+
x as useResizeObserver
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=useResizeObserver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResizeObserver.js","sources":["../../../src/components/hooks/useResizeObserver.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useMemo, useRef, useState } from 'react';\n\ntype ObserverRect = Omit<DOMRectReadOnly, 'toJSON'>;\n\nconst defaultState: ObserverRect = {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n};\n\nexport function useResizeObserver<T extends HTMLElement = any>(options?: ResizeObserverOptions) {\n const frameID = useRef(0);\n const ref = useRef<T>(null);\n\n const [rect, setRect] = useState<ObserverRect>(defaultState);\n\n const observer = useMemo(\n () =>\n typeof window !== 'undefined'\n ? new ResizeObserver((entries) => {\n const entry = entries[0];\n\n if (entry) {\n cancelAnimationFrame(frameID.current);\n\n frameID.current = requestAnimationFrame(() => {\n if (ref.current) {\n const boxSize = entry.borderBoxSize?.[0] || entry.contentBoxSize?.[0];\n if (boxSize) {\n const width = boxSize.inlineSize;\n const height = boxSize.blockSize;\n\n setRect({\n width,\n height,\n x: entry.contentRect.x,\n y: entry.contentRect.y,\n top: entry.contentRect.top,\n left: entry.contentRect.left,\n bottom: entry.contentRect.bottom,\n right: entry.contentRect.right,\n });\n } else {\n setRect(entry.contentRect);\n }\n }\n });\n }\n })\n : null,\n []\n );\n\n useEffect(() => {\n if (ref.current) {\n observer?.observe(ref.current, options);\n }\n\n return () => {\n observer?.disconnect();\n\n if (frameID.current) {\n cancelAnimationFrame(frameID.current);\n }\n };\n }, [ref.current]);\n\n return [ref, rect] as const;\n}\n\nexport function useElementSize<T extends HTMLElement = any>(options?: ResizeObserverOptions) {\n const [ref, { width, height }] = useResizeObserver<T>(options);\n return { ref, width, height };\n}\n"],"names":["defaultState","useResizeObserver","options","frameID","useRef","ref","rect","setRect","useState","observer","useMemo","entries","entry","boxSize","_a","_b","width","height","useEffect","useElementSize"],"mappings":";;AAKA,MAAMA,IAA6B;AAAA,EACjC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AACT;AAEO,SAASC,EAA+CC,GAAiC;AACxF,QAAAC,IAAUC,EAAO,CAAC,GAClBC,IAAMD,EAAU,IAAI,GAEpB,CAACE,GAAMC,CAAO,IAAIC,EAAuBR,CAAY,GAErDS,IAAWC;AAAA,IACf,MACE,OAAO,SAAW,MACd,IAAI,eAAe,CAACC,MAAY;AACxB,YAAAC,IAAQD,EAAQ,CAAC;AAEvB,MAAIC,MACF,qBAAqBT,EAAQ,OAAO,GAE5BA,EAAA,UAAU,sBAAsB,MAAM;;AAC5C,YAAIE,EAAI,SAAS;AACf,gBAAMQ,MAAUC,IAAAF,EAAM,kBAAN,gBAAAE,EAAsB,SAAMC,IAAAH,EAAM,mBAAN,gBAAAG,EAAuB;AACnE,cAAIF,GAAS;AACX,kBAAMG,IAAQH,EAAQ,YAChBI,IAASJ,EAAQ;AAEf,YAAAN,EAAA;AAAA,cACN,OAAAS;AAAA,cACA,QAAAC;AAAA,cACA,GAAGL,EAAM,YAAY;AAAA,cACrB,GAAGA,EAAM,YAAY;AAAA,cACrB,KAAKA,EAAM,YAAY;AAAA,cACvB,MAAMA,EAAM,YAAY;AAAA,cACxB,QAAQA,EAAM,YAAY;AAAA,cAC1B,OAAOA,EAAM,YAAY;AAAA,YAAA,CAC1B;AAAA,UAAA;AAED,YAAAL,EAAQK,EAAM,WAAW;AAAA,QAC3B;AAAA,MACF,CACD;AAAA,IAEJ,CAAA,IACD;AAAA,IACN,CAAA;AAAA,EACF;AAEA,SAAAM,EAAU,OACJb,EAAI,YACII,KAAA,QAAAA,EAAA,QAAQJ,EAAI,SAASH,KAG1B,MAAM;AACX,IAAAO,KAAA,QAAAA,EAAU,cAENN,EAAQ,WACV,qBAAqBA,EAAQ,OAAO;AAAA,EAExC,IACC,CAACE,EAAI,OAAO,CAAC,GAET,CAACA,GAAKC,CAAI;AACnB;AAEO,SAASa,EAA4CjB,GAAiC;AACrF,QAAA,CAACG,GAAK,EAAE,OAAAW,GAAO,QAAAC,GAAQ,IAAIhB,EAAqBC,CAAO;AACtD,SAAA,EAAE,KAAAG,GAAK,OAAAW,GAAO,QAAAC,EAAO;AAC9B;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import t from "react";
|
|
3
|
+
function o() {
|
|
4
|
+
const [i, n] = t.useState({
|
|
5
|
+
width: null,
|
|
6
|
+
height: null
|
|
7
|
+
});
|
|
8
|
+
return t.useLayoutEffect(() => {
|
|
9
|
+
const e = () => {
|
|
10
|
+
n({
|
|
11
|
+
width: window.innerWidth,
|
|
12
|
+
height: window.innerHeight
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
return e(), window.addEventListener("resize", e), () => {
|
|
16
|
+
window.removeEventListener("resize", e);
|
|
17
|
+
};
|
|
18
|
+
}, []), i;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
o as useWindowSize
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=useWindowSize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWindowSize.js","sources":["../../../src/components/hooks/useWindowSize.ts"],"sourcesContent":["\"use client\";\nimport React from 'react';\n\nexport function useWindowSize() {\n const [size, setSize] = React.useState({\n width: null,\n height: null,\n });\n\n React.useLayoutEffect(() => {\n const handleResize = () => {\n setSize({\n width: window.innerWidth,\n height: window.innerHeight,\n });\n };\n\n handleResize();\n window.addEventListener(\"resize\", handleResize);\n\n return () => {\n window.removeEventListener(\"resize\", handleResize);\n };\n }, []);\n\n return size;\n}\n"],"names":["useWindowSize","size","setSize","React","handleResize"],"mappings":";;AAGO,SAASA,IAAgB;AAC9B,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAM,SAAS;AAAA,IACrC,OAAO;AAAA,IACP,QAAQ;AAAA,EAAA,CACT;AAEDA,SAAAA,EAAM,gBAAgB,MAAM;AAC1B,UAAMC,IAAe,MAAM;AACjB,MAAAF,EAAA;AAAA,QACN,OAAO,OAAO;AAAA,QACd,QAAQ,OAAO;AAAA,MAAA,CAChB;AAAA,IACH;AAEa,WAAAE,EAAA,GACN,OAAA,iBAAiB,UAAUA,CAAY,GAEvC,MAAM;AACJ,aAAA,oBAAoB,UAAUA,CAAY;AAAA,IACnD;AAAA,EACF,GAAG,EAAE,GAEEH;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/modal/index.ts"],"sourcesContent":["\"use client\";\nimport useApp from \"antd/es/app/useApp\";\nimport { Modal as MainModal } from \"./Modal\";\nimport {\n confirm,\n info,\n success,\n error,\n warning,\n open,\n destroyAll,\n type ModalFuncProps,\n} from \"./functions\";\nimport { ModalProvider, type ModalProviderProps } from \"./ModalProvider\";\n\nimport \"./style.css\";\n\nconst useModal = () => {\n return useApp().modal;\n};\n\n// Export the Modal component with static methods\nexport const Modal = Object.assign(MainModal, {\n Provider: ModalProvider,\n open,\n info,\n success,\n error,\n warning,\n confirm,\n destroyAll,\n useModal,\n});\n\nexport { ModalFuncProps, ModalProviderProps };\n"],"names":["useModal","useApp","Modal","MainModal","ModalProvider","open","info","success","error","warning","confirm","destroyAll"],"mappings":";;;;;;AAiBA,MAAMA,IAAW,MACRC,EAAS,EAAA,OAILC,IAAQ,OAAO,OAAOC,GAAW;AAAA,EAC5C,UAAUC;AAAA,EACV,MAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAX;AACF,CAAC;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/modal/index.ts"],"sourcesContent":["\"use client\";\nimport useApp from \"antd/es/app/useApp\";\nimport { Modal as MainModal, type ModalProps } from \"./Modal\";\nimport {\n confirm,\n info,\n success,\n error,\n warning,\n open,\n destroyAll,\n type ModalFuncProps,\n} from \"./functions\";\nimport { ModalProvider, type ModalProviderProps } from \"./ModalProvider\";\n\nimport \"./style.css\";\n\nconst useModal = () => {\n return useApp().modal;\n};\n\n// Export the Modal component with static methods\nexport const Modal = Object.assign(MainModal, {\n Provider: ModalProvider,\n open,\n info,\n success,\n error,\n warning,\n confirm,\n destroyAll,\n useModal,\n});\n\nexport { ModalProps, ModalFuncProps, ModalProviderProps };\n"],"names":["useModal","useApp","Modal","MainModal","ModalProvider","open","info","success","error","warning","confirm","destroyAll"],"mappings":";;;;;;AAiBA,MAAMA,IAAW,MACRC,EAAS,EAAA,OAILC,IAAQ,OAAO,OAAOC,GAAW;AAAA,EAC5C,UAAUC;AAAA,EACV,MAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAX;AACF,CAAC;"}
|
|
@@ -1,77 +1,94 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
-
import { useResizable as
|
|
5
|
-
import
|
|
6
|
-
import { mergeProps as
|
|
3
|
+
import N, { useState as R, useCallback as ee, useEffect as I, isValidElement as te } from "react";
|
|
4
|
+
import { useResizable as re } from "react-use-resizable";
|
|
5
|
+
import oe from "merge-refs";
|
|
6
|
+
import { mergeProps as ie } from "@base-ui-components/react";
|
|
7
7
|
import './style.css';/* empty css */
|
|
8
8
|
import { getReactElementProp as x } from "../utils/reactElement.js";
|
|
9
|
-
import { useCls as
|
|
10
|
-
import { clsx as h, cn as
|
|
11
|
-
import { WithRenderProp as
|
|
12
|
-
const
|
|
9
|
+
import { useCls as ne } from "../utils/antdUtils.js";
|
|
10
|
+
import { clsx as h, cn as le } from "../utils/cn.js";
|
|
11
|
+
import { WithRenderProp as fe } from "../utils/WithRenderProp.js";
|
|
12
|
+
const ye = ({
|
|
13
13
|
children: p,
|
|
14
14
|
resizable: c = !1,
|
|
15
|
-
handles:
|
|
15
|
+
handles: i = { bottom: !0, right: !0, left: !0, top: !0 },
|
|
16
16
|
absolutePositioning: V = !1,
|
|
17
17
|
classNames: t,
|
|
18
|
-
className:
|
|
19
|
-
style:
|
|
20
|
-
resetKey:
|
|
21
|
-
|
|
22
|
-
maxHeight:
|
|
23
|
-
|
|
24
|
-
minHeight:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
className: _,
|
|
19
|
+
style: $,
|
|
20
|
+
resetKey: W,
|
|
21
|
+
// Use Resizable Props
|
|
22
|
+
maxHeight: j,
|
|
23
|
+
maxWidth: q,
|
|
24
|
+
minHeight: F,
|
|
25
|
+
minWidth: G,
|
|
26
|
+
lockHorizontal: J,
|
|
27
|
+
lockVertical: L,
|
|
28
|
+
onResize: M,
|
|
29
|
+
onDragEnd: B,
|
|
30
|
+
onDragStart: D,
|
|
31
|
+
disabled: O,
|
|
32
|
+
maintainAspectRatio: o = !1,
|
|
33
|
+
interval: Q,
|
|
34
|
+
initialHeight: T,
|
|
35
|
+
initialWidth: U,
|
|
36
|
+
// other With Render Props
|
|
37
|
+
...X
|
|
28
38
|
}) => {
|
|
29
|
-
const l =
|
|
39
|
+
const l = ne(), [u, Y] = R(null), [b, H] = R(), [v, y] = R(), [w, S] = R(!1), Z = ee(
|
|
30
40
|
(e) => {
|
|
31
|
-
if (
|
|
32
|
-
const
|
|
33
|
-
|
|
41
|
+
if (Y(e), e && !b && !v) {
|
|
42
|
+
const r = e.getBoundingClientRect();
|
|
43
|
+
r.width > 0 && r.height > 0 && o && (H(r.width), y(r.height));
|
|
34
44
|
}
|
|
35
45
|
},
|
|
36
|
-
[b,
|
|
46
|
+
[b, v, o]
|
|
37
47
|
);
|
|
38
|
-
|
|
39
|
-
if (
|
|
48
|
+
I(() => {
|
|
49
|
+
if (W !== void 0 && u) {
|
|
40
50
|
u.style.width = "", u.style.height = "";
|
|
41
51
|
const e = u.getBoundingClientRect();
|
|
42
|
-
e.width > 0 && e.height > 0 && (
|
|
52
|
+
e.width > 0 && e.height > 0 && (o ? (H(e.width), y(e.height)) : (H(void 0), y(void 0)));
|
|
43
53
|
}
|
|
44
|
-
}, [
|
|
45
|
-
const
|
|
46
|
-
initialWidth:
|
|
47
|
-
initialHeight:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
}, [W, u, o]);
|
|
55
|
+
const P = re({
|
|
56
|
+
initialWidth: o ? b : U,
|
|
57
|
+
initialHeight: o ? v : T,
|
|
58
|
+
maxHeight: j,
|
|
59
|
+
maxWidth: q,
|
|
60
|
+
minHeight: F,
|
|
61
|
+
minWidth: G,
|
|
62
|
+
lockHorizontal: J,
|
|
63
|
+
lockVertical: L,
|
|
64
|
+
onResize: M,
|
|
65
|
+
disabled: O,
|
|
66
|
+
maintainAspectRatio: o,
|
|
67
|
+
interval: Q,
|
|
68
|
+
onDragStart: (e) => {
|
|
69
|
+
if (S(!0), u) {
|
|
70
|
+
const r = u.getBoundingClientRect();
|
|
71
|
+
r.width > 0 && !b && H(r.width), r.height > 0 && !v && y(r.height);
|
|
58
72
|
}
|
|
73
|
+
D && D(e);
|
|
59
74
|
},
|
|
60
|
-
onDragEnd: () =>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
75
|
+
onDragEnd: (e) => {
|
|
76
|
+
S(!1), B && B(e);
|
|
77
|
+
}
|
|
78
|
+
}), m = te(p);
|
|
79
|
+
I(() => {
|
|
80
|
+
w ? document.body.style.userSelect = "none" : document.body.style.userSelect = "";
|
|
81
|
+
}, [w]);
|
|
82
|
+
const { ref: K, ...A } = P.getRootProps(), f = P.getHandleProps, g = P.rootRef, C = (e, r) => {
|
|
66
83
|
if (!e.current || !V) return;
|
|
67
|
-
const { widthDiff: E } =
|
|
84
|
+
const { widthDiff: E } = r;
|
|
68
85
|
e.current.style.left = `${parseInt(e.current.style.left || "0") - E}px`;
|
|
69
|
-
}, k = (e,
|
|
86
|
+
}, k = (e, r) => {
|
|
70
87
|
if (!e.current || !V) return;
|
|
71
|
-
const { heightDiff: E } =
|
|
88
|
+
const { heightDiff: E } = r;
|
|
72
89
|
e.current.style.top = `${parseInt(e.current.style.top || "0") - E}px`;
|
|
73
|
-
},
|
|
74
|
-
|
|
90
|
+
}, s = c ? [
|
|
91
|
+
i.top && !o && /* @__PURE__ */ n(
|
|
75
92
|
"div",
|
|
76
93
|
{
|
|
77
94
|
className: h(
|
|
@@ -79,7 +96,7 @@ const ue = ({
|
|
|
79
96
|
t == null ? void 0 : t.resizeHandle
|
|
80
97
|
),
|
|
81
98
|
"data-placement": "top-center",
|
|
82
|
-
...
|
|
99
|
+
...f({
|
|
83
100
|
reverse: !0,
|
|
84
101
|
lockHorizontal: !0,
|
|
85
102
|
onResize: (e) => k(g, e)
|
|
@@ -87,7 +104,7 @@ const ue = ({
|
|
|
87
104
|
},
|
|
88
105
|
"top"
|
|
89
106
|
),
|
|
90
|
-
|
|
107
|
+
i.bottom && !o && /* @__PURE__ */ n(
|
|
91
108
|
"div",
|
|
92
109
|
{
|
|
93
110
|
className: h(
|
|
@@ -95,13 +112,13 @@ const ue = ({
|
|
|
95
112
|
t == null ? void 0 : t.resizeHandle
|
|
96
113
|
),
|
|
97
114
|
"data-placement": "bottom-left",
|
|
98
|
-
...
|
|
115
|
+
...f({
|
|
99
116
|
lockHorizontal: !0
|
|
100
117
|
})
|
|
101
118
|
},
|
|
102
119
|
"bottom"
|
|
103
120
|
),
|
|
104
|
-
|
|
121
|
+
i.left && !o && /* @__PURE__ */ n(
|
|
105
122
|
"div",
|
|
106
123
|
{
|
|
107
124
|
className: h(
|
|
@@ -109,7 +126,7 @@ const ue = ({
|
|
|
109
126
|
t == null ? void 0 : t.resizeHandle
|
|
110
127
|
),
|
|
111
128
|
"data-placement": "top-left",
|
|
112
|
-
...
|
|
129
|
+
...f({
|
|
113
130
|
reverse: !0,
|
|
114
131
|
lockVertical: !0,
|
|
115
132
|
onResize: (e) => C(g, e)
|
|
@@ -117,7 +134,7 @@ const ue = ({
|
|
|
117
134
|
},
|
|
118
135
|
"left"
|
|
119
136
|
),
|
|
120
|
-
|
|
137
|
+
i.right && !o && /* @__PURE__ */ n(
|
|
121
138
|
"div",
|
|
122
139
|
{
|
|
123
140
|
className: h(
|
|
@@ -125,14 +142,14 @@ const ue = ({
|
|
|
125
142
|
t == null ? void 0 : t.resizeHandle
|
|
126
143
|
),
|
|
127
144
|
"data-placement": "top-right",
|
|
128
|
-
...
|
|
145
|
+
...f({
|
|
129
146
|
lockVertical: !0
|
|
130
147
|
})
|
|
131
148
|
},
|
|
132
149
|
"right"
|
|
133
150
|
),
|
|
134
151
|
// For aspect ratio maintenance, add corner handles that can resize both dimensions
|
|
135
|
-
|
|
152
|
+
i.right && i.bottom && /* @__PURE__ */ n(
|
|
136
153
|
"div",
|
|
137
154
|
{
|
|
138
155
|
className: h(
|
|
@@ -140,13 +157,13 @@ const ue = ({
|
|
|
140
157
|
t == null ? void 0 : t.resizeHandle
|
|
141
158
|
),
|
|
142
159
|
"data-placement": "bottom-right-corner",
|
|
143
|
-
...
|
|
160
|
+
...f({
|
|
144
161
|
// No locks - allow both horizontal and vertical resizing
|
|
145
162
|
})
|
|
146
163
|
},
|
|
147
164
|
"bottom-right-corner"
|
|
148
165
|
),
|
|
149
|
-
|
|
166
|
+
o && i.left && i.bottom && /* @__PURE__ */ n(
|
|
150
167
|
"div",
|
|
151
168
|
{
|
|
152
169
|
className: h(
|
|
@@ -154,14 +171,14 @@ const ue = ({
|
|
|
154
171
|
t == null ? void 0 : t.resizeHandle
|
|
155
172
|
),
|
|
156
173
|
"data-placement": "bottom-left-corner",
|
|
157
|
-
...
|
|
174
|
+
...f({
|
|
158
175
|
reverse: !0,
|
|
159
176
|
onResize: (e) => C(g, e)
|
|
160
177
|
})
|
|
161
178
|
},
|
|
162
179
|
"bottom-left-corner"
|
|
163
180
|
),
|
|
164
|
-
|
|
181
|
+
o && i.right && i.top && /* @__PURE__ */ n(
|
|
165
182
|
"div",
|
|
166
183
|
{
|
|
167
184
|
className: h(
|
|
@@ -169,14 +186,14 @@ const ue = ({
|
|
|
169
186
|
t == null ? void 0 : t.resizeHandle
|
|
170
187
|
),
|
|
171
188
|
"data-placement": "top-right-corner",
|
|
172
|
-
...
|
|
189
|
+
...f({
|
|
173
190
|
reverse: !0,
|
|
174
191
|
onResize: (e) => k(g, e)
|
|
175
192
|
})
|
|
176
193
|
},
|
|
177
194
|
"top-right-corner"
|
|
178
195
|
),
|
|
179
|
-
|
|
196
|
+
i.left && i.top && /* @__PURE__ */ n(
|
|
180
197
|
"div",
|
|
181
198
|
{
|
|
182
199
|
className: h(
|
|
@@ -184,7 +201,7 @@ const ue = ({
|
|
|
184
201
|
t == null ? void 0 : t.resizeHandle
|
|
185
202
|
),
|
|
186
203
|
"data-placement": "top-left-corner",
|
|
187
|
-
...
|
|
204
|
+
...f({
|
|
188
205
|
reverse: !0,
|
|
189
206
|
onResize: (e) => {
|
|
190
207
|
C(g, e), k(g, e);
|
|
@@ -193,48 +210,48 @@ const ue = ({
|
|
|
193
210
|
},
|
|
194
211
|
"top-left-corner"
|
|
195
212
|
)
|
|
196
|
-
] : [],
|
|
197
|
-
className: x(
|
|
198
|
-
style: x(
|
|
199
|
-
children: x(
|
|
200
|
-
ref:
|
|
201
|
-
},
|
|
202
|
-
className:
|
|
213
|
+
] : [], d = p, z = {
|
|
214
|
+
className: x(d, "className"),
|
|
215
|
+
style: x(d, "style"),
|
|
216
|
+
children: x(d, "children"),
|
|
217
|
+
ref: d.ref
|
|
218
|
+
}, a = {
|
|
219
|
+
className: le(
|
|
203
220
|
c && l("resizable"),
|
|
204
221
|
t == null ? void 0 : t.root,
|
|
205
222
|
z.className,
|
|
206
|
-
|
|
223
|
+
_
|
|
207
224
|
),
|
|
208
|
-
ref:
|
|
209
|
-
c ?
|
|
210
|
-
|
|
225
|
+
ref: oe(
|
|
226
|
+
c ? K : void 0,
|
|
227
|
+
Z,
|
|
211
228
|
// Always need this for dimension measurement
|
|
212
|
-
|
|
229
|
+
d == null ? void 0 : d.ref
|
|
213
230
|
),
|
|
214
|
-
style: { ...z.style,
|
|
215
|
-
...
|
|
231
|
+
style: { ...z.style, ...$ },
|
|
232
|
+
...w ? { "data-resizing": !0 } : {},
|
|
216
233
|
...c ? { "data-resizable": !0 } : {},
|
|
217
|
-
children:
|
|
234
|
+
children: m ? [
|
|
218
235
|
...Array.isArray(z.children) ? z.children : [z.children],
|
|
219
|
-
...
|
|
236
|
+
...s.filter(Boolean)
|
|
220
237
|
] : p
|
|
221
238
|
};
|
|
222
239
|
return /* @__PURE__ */ n(
|
|
223
|
-
|
|
240
|
+
fe,
|
|
224
241
|
{
|
|
225
242
|
render: (e) => {
|
|
226
|
-
const
|
|
243
|
+
const r = ie(
|
|
227
244
|
e,
|
|
228
|
-
|
|
229
|
-
c ?
|
|
245
|
+
a,
|
|
246
|
+
c ? A : {}
|
|
230
247
|
);
|
|
231
|
-
return
|
|
248
|
+
return m ? N.cloneElement(d, r) : /* @__PURE__ */ n("div", { ...r, children: p });
|
|
232
249
|
},
|
|
233
|
-
...
|
|
250
|
+
...X
|
|
234
251
|
}
|
|
235
252
|
);
|
|
236
253
|
};
|
|
237
254
|
export {
|
|
238
|
-
|
|
255
|
+
ye as Resizable
|
|
239
256
|
};
|
|
240
257
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/resizable/component.tsx"],"sourcesContent":["\"use client\";\nimport React, { useCallback, useEffect, useState, isValidElement } from \"react\";\nimport { useResizable, type MoveValues } from \"react-use-resizable\";\nimport mergeRefs from \"merge-refs\";\nimport {\n useCls,\n clsx,\n WithRenderProp,\n WithRenderPropProps,\n cn,\n getReactElementProp,\n} from \"../utils\";\nimport { mergeProps } from \"@base-ui-components/react\";\n\nimport \"./style.css\";\n\nexport interface ResizableProps extends WithRenderPropProps {\n /**\n * Single React element child that will be enhanced with resize handles\n */\n children: React.ReactNode;\n /**\n * Whether the component should be resizable\n * @default false\n */\n resizable?: boolean;\n /**\n * Configure which resize handles to show\n * @default { bottom: true, right: true, left: true, top: true }\n */\n handles?: {\n bottom?: boolean;\n right?: boolean;\n left?: boolean;\n top?: boolean;\n };\n /**\n * Whether to use absolute positioning for left handle resizing\n * Set to true when used in absolutely positioned containers like PopupPanel\n * @default false\n */\n absolutePositioning?: boolean;\n /**\n * Custom class names for different parts of the resizable component\n */\n classNames?: {\n root?: string;\n resizeHandle?: string;\n };\n /**\n * Key to reset dimensions to current element size\n * When this value changes, the component will recalculate its dimensions\n * Similar to React's key prop pattern for forcing component resets\n */\n resetKey?: React.Key;\n /**\n * Maximum width the component can be resized to\n */\n maxWidth?: number;\n /**\n * Maximum height the component can be resized to\n */\n maxHeight?: number;\n /**\n * Minimum width the component can be resized to\n */\n minWidth?: number;\n /**\n * Minimum height the component can be resized to\n */\n minHeight?: number;\n /**\n * Callback fired during resize operations\n */\n onResize?: (values: MoveValues) => void;\n /**\n * Whether to maintain aspect ratio during resize\n * @default false\n */\n maintainAspectRatio?: boolean;\n}\n\nexport const Resizable = ({\n children,\n resizable = false,\n handles = { bottom: true, right: true, left: true, top: true },\n absolutePositioning = false,\n classNames,\n className: containerClassName,\n style: containerStyle,\n resetKey,\n maxWidth,\n maxHeight,\n minWidth,\n minHeight,\n onResize,\n maintainAspectRatio = false,\n ...rest\n}: ResizableProps) => {\n // Validate that children is a single React element\n // if (!isValidElement(children)) {\n // throw new Error(\n // \"Resizable component expects a single React element as children\"\n // );\n // }\n\n const cls = useCls();\n const [panelRef, setPanelRef] = useState<HTMLDivElement | null>(null);\n const [width, setWidth] = useState<number>();\n const [height, setHeight] = useState<number>();\n const [resizing, setResizing] = useState(false);\n\n const callbackRef = useCallback(\n (node: HTMLDivElement) => {\n setPanelRef(node);\n\n // Get initial dimensions only once when ref is set\n // For aspect ratio maintenance, we need initial dimensions immediately\n // Otherwise, preserve natural width/height behavior\n if (node && !width && !height) {\n const rect = node.getBoundingClientRect();\n if (rect.width > 0 && rect.height > 0) {\n if (maintainAspectRatio) {\n // Need dimensions for aspect ratio calculation\n setWidth(rect.width);\n setHeight(rect.height);\n }\n // For non-aspect-ratio cases, don't set dimensions to preserve natural behavior\n }\n }\n },\n [width, height, maintainAspectRatio]\n );\n\n // Reset dimensions when resetKey changes\n useEffect(() => {\n if (resetKey !== undefined && panelRef) {\n // Clear the hook's inline styles to reset to natural size\n panelRef.style.width = \"\";\n panelRef.style.height = \"\";\n\n // Force a reflow to get natural dimensions\n const rect = panelRef.getBoundingClientRect();\n\n if (rect.width > 0 && rect.height > 0) {\n if (maintainAspectRatio) {\n // For aspect ratio maintenance, re-measure and set dimensions\n setWidth(rect.width);\n setHeight(rect.height);\n } else {\n // Reset state to allow natural dimensions again\n setWidth(undefined);\n setHeight(undefined);\n }\n\n // Don't apply any explicit dimensions - let them remain natural\n // panelRef.style.width = `${rect.width}px`;\n // panelRef.style.height = `${rect.height}px`;\n }\n }\n }, [resetKey, panelRef, maintainAspectRatio]);\n\n // Initialize useResizable with current dimensions (or undefined if not ready)\n // For aspect ratio maintenance, we need initial dimensions\n // Otherwise, preserve natural width/height behavior until user starts resizing\n const resizableHook = useResizable({\n initialWidth: maintainAspectRatio ? width : undefined,\n initialHeight: maintainAspectRatio ? height : undefined,\n maxWidth,\n maxHeight,\n minWidth,\n minHeight,\n onResize,\n maintainAspectRatio,\n onDragStart: () => {\n setResizing(true);\n // Capture natural dimensions when user starts resizing\n if (panelRef) {\n const rect = panelRef.getBoundingClientRect();\n if (rect.width > 0 && !width) {\n setWidth(rect.width);\n }\n if (rect.height > 0 && !height) {\n setHeight(rect.height);\n }\n }\n },\n onDragEnd: () => setResizing(false),\n });\n\n const isChildrenValidElement = isValidElement(children);\n\n useEffect(() => {\n if (resizing) {\n document.body.style.userSelect = \"none\";\n } else {\n document.body.style.userSelect = \"\";\n }\n }, [resizing]);\n\n // Get resizable props - useResizable hook handles cases where dimensions aren't ready\n const { ref: rootRefProp, ...rootPropsWithoutRef } =\n resizableHook.getRootProps();\n const getHandleProps = resizableHook.getHandleProps;\n const rootRef = resizableHook.rootRef;\n\n // Handle reverse handle change for horizontal resizing (only for absolute positioning)\n const onReverseHandleChangeHorizontal = (\n parent: React.RefObject<HTMLDivElement>,\n values: MoveValues\n ) => {\n if (!parent.current || !absolutePositioning) return;\n const { widthDiff } = values;\n parent.current.style.left = `${\n parseInt(parent.current.style.left || \"0\") - widthDiff\n }px`;\n };\n\n // Handle reverse handle change for vertical resizing (only for absolute positioning)\n const onReverseHandleChangeVertical = (\n parent: React.RefObject<HTMLDivElement>,\n values: MoveValues\n ) => {\n if (!parent.current || !absolutePositioning) return;\n const { heightDiff } = values;\n parent.current.style.top = `${\n parseInt(parent.current.style.top || \"0\") - heightDiff\n }px`;\n };\n\n const resizeHandles = resizable\n ? [\n handles.top && !maintainAspectRatio && (\n <div\n key=\"top\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-center\"\n {...getHandleProps({\n reverse: true,\n lockHorizontal: true,\n onResize: (values) =>\n onReverseHandleChangeVertical(rootRef, values),\n })}\n />\n ),\n handles.bottom && !maintainAspectRatio && (\n <div\n key=\"bottom\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"bottom-left\"\n {...getHandleProps({\n lockHorizontal: true,\n })}\n />\n ),\n handles.left && !maintainAspectRatio && (\n <div\n key=\"left\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-left\"\n {...getHandleProps({\n reverse: true,\n lockVertical: true,\n onResize: (values) =>\n onReverseHandleChangeHorizontal(rootRef, values),\n })}\n />\n ),\n handles.right && !maintainAspectRatio && (\n <div\n key=\"right\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-right\"\n {...getHandleProps({\n lockVertical: true,\n })}\n />\n ),\n // For aspect ratio maintenance, add corner handles that can resize both dimensions\n handles.right && handles.bottom && (\n <div\n key=\"bottom-right-corner\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"bottom-right-corner\"\n {...getHandleProps({\n // No locks - allow both horizontal and vertical resizing\n })}\n />\n ),\n maintainAspectRatio && handles.left && handles.bottom && (\n <div\n key=\"bottom-left-corner\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"bottom-left-corner\"\n {...getHandleProps({\n reverse: true,\n onResize: (values) =>\n onReverseHandleChangeHorizontal(rootRef, values),\n })}\n />\n ),\n maintainAspectRatio && handles.right && handles.top && (\n <div\n key=\"top-right-corner\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-right-corner\"\n {...getHandleProps({\n reverse: true,\n onResize: (values) =>\n onReverseHandleChangeVertical(rootRef, values),\n })}\n />\n ),\n handles.left && handles.top && (\n <div\n key=\"top-left-corner\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-left-corner\"\n {...getHandleProps({\n reverse: true,\n onResize: (values) => {\n onReverseHandleChangeHorizontal(rootRef, values);\n onReverseHandleChangeVertical(rootRef, values);\n },\n })}\n />\n ),\n ]\n : [];\n\n const childElement = children as React.ReactElement & {\n ref?: React.Ref<HTMLDivElement>;\n };\n\n const childElementProps = {\n className: getReactElementProp<string>(childElement, \"className\"),\n style: getReactElementProp<React.CSSProperties>(childElement, \"style\"),\n children: getReactElementProp<React.ReactNode>(childElement, \"children\"),\n ref: childElement.ref,\n };\n\n const childProps = {\n className: cn(\n resizable && cls(\"resizable\"),\n classNames?.root,\n childElementProps.className,\n containerClassName\n ),\n ref: mergeRefs(\n resizable ? rootRefProp : undefined,\n callbackRef, // Always need this for dimension measurement\n childElement?.ref\n ),\n style: { ...childElementProps.style, ...containerStyle },\n ...(resizing ? { \"data-resizing\": true } : {}),\n ...(resizable ? { \"data-resizable\": true } : {}),\n children: isChildrenValidElement\n ? [\n ...(Array.isArray(childElementProps.children)\n ? childElementProps.children\n : [childElementProps.children]),\n ...resizeHandles.filter(Boolean),\n ]\n : children,\n };\n\n return (\n <WithRenderProp\n render={(props) => {\n // Merge the props from WithRenderProp with our childProps\n const mergedProps = mergeProps(\n props,\n childProps,\n resizable ? rootPropsWithoutRef : {}\n );\n if (isChildrenValidElement) {\n return React.cloneElement(childElement, mergedProps);\n } else {\n return <div {...mergedProps}>{children}</div>;\n }\n }}\n {...rest}\n />\n );\n};\n"],"names":["Resizable","children","resizable","handles","absolutePositioning","classNames","containerClassName","containerStyle","resetKey","maxWidth","maxHeight","minWidth","minHeight","onResize","maintainAspectRatio","rest","cls","useCls","panelRef","setPanelRef","useState","width","setWidth","height","setHeight","resizing","setResizing","callbackRef","useCallback","node","rect","useEffect","resizableHook","useResizable","isChildrenValidElement","isValidElement","rootRefProp","rootPropsWithoutRef","getHandleProps","rootRef","onReverseHandleChangeHorizontal","parent","values","widthDiff","onReverseHandleChangeVertical","heightDiff","resizeHandles","jsx","clsx","childElement","childElementProps","getReactElementProp","childProps","cn","mergeRefs","WithRenderProp","props","mergedProps","mergeProps","React"],"mappings":";;;;;;;;;;;AAkFO,MAAMA,KAAY,CAAC;AAAA,EACxB,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,SAAAC,IAAU,EAAE,QAAQ,IAAM,OAAO,IAAM,MAAM,IAAM,KAAK,GAAK;AAAA,EAC7D,qBAAAC,IAAsB;AAAA,EACtB,YAAAC;AAAA,EACA,WAAWC;AAAA,EACX,OAAOC;AAAA,EACP,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,qBAAAC,IAAsB;AAAA,EACtB,GAAGC;AACL,MAAsB;AAQpB,QAAMC,IAAMC,EAAO,GACb,CAACC,GAAUC,CAAW,IAAIC,EAAgC,IAAI,GAC9D,CAACC,GAAOC,CAAQ,IAAIF,EAAiB,GACrC,CAACG,GAAQC,CAAS,IAAIJ,EAAiB,GACvC,CAACK,GAAUC,CAAW,IAAIN,EAAS,EAAK,GAExCO,IAAcC;AAAA,IAClB,CAACC,MAAyB;AAMxB,UALAV,EAAYU,CAAI,GAKZA,KAAQ,CAACR,KAAS,CAACE,GAAQ;AACvB,cAAAO,IAAOD,EAAK,sBAAsB;AACxC,QAAIC,EAAK,QAAQ,KAAKA,EAAK,SAAS,KAC9BhB,MAEFQ,EAASQ,EAAK,KAAK,GACnBN,EAAUM,EAAK,MAAM;AAAA,MAGzB;AAAA,IAEJ;AAAA,IACA,CAACT,GAAOE,GAAQT,CAAmB;AAAA,EACrC;AAGA,EAAAiB,EAAU,MAAM;AACV,QAAAvB,MAAa,UAAaU,GAAU;AAEtC,MAAAA,EAAS,MAAM,QAAQ,IACvBA,EAAS,MAAM,SAAS;A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,gBAAA8C;AAAA,IAACQ;AAAA,IAAA;AAAA,MACC,QAAQ,CAACC,MAAU;AAEjB,cAAMC,IAAcC;AAAA,UAClBF;AAAA,UACAJ;AAAA,UACAlD,IAAYmC,IAAsB,CAAA;AAAA,QACpC;AACA,eAAIH,IACKyB,EAAM,aAAaV,GAAcQ,CAAW,IAE3C,gBAAAV,EAAA,OAAA,EAAK,GAAGU,GAAc,UAAAxD,EAAS,CAAA;AAAA,MAE3C;AAAA,MACC,GAAGc;AAAA,IAAA;AAAA,EACN;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/resizable/component.tsx"],"sourcesContent":["\"use client\";\nimport React, { useCallback, useEffect, useState, isValidElement } from \"react\";\nimport {\n useResizable,\n type MoveValues,\n ResizableProps as UseResizableProps,\n} from \"react-use-resizable\";\nimport mergeRefs from \"merge-refs\";\nimport {\n useCls,\n clsx,\n WithRenderProp,\n WithRenderPropProps,\n cn,\n getReactElementProp,\n} from \"../utils\";\nimport { mergeProps } from \"@base-ui-components/react\";\n\nimport \"./style.css\";\nimport { on } from \"node:stream\";\n\nexport interface ResizableProps\n extends Omit<WithRenderPropProps, keyof UseResizableProps>,\n UseResizableProps {\n /**\n * Single React element child that will be enhanced with resize handles\n */\n children: React.ReactNode;\n /**\n * Whether the component should be resizable\n * @default false\n */\n resizable?: boolean;\n /**\n * Configure which resize handles to show\n * @default { bottom: true, right: true, left: true, top: true }\n */\n handles?: {\n bottom?: boolean;\n right?: boolean;\n left?: boolean;\n top?: boolean;\n };\n /**\n * Whether to use absolute positioning for left handle resizing\n * Set to true when used in absolutely positioned containers like PopupPanel\n * @default false\n */\n absolutePositioning?: boolean;\n /**\n * Custom class names for different parts of the resizable component\n */\n classNames?: {\n root?: string;\n resizeHandle?: string;\n };\n /**\n * Key to reset dimensions to current element size\n * When this value changes, the component will recalculate its dimensions\n * Similar to React's key prop pattern for forcing component resets\n */\n resetKey?: React.Key;\n /**\n * Maximum width the component can be resized to\n */\n maxWidth?: number;\n /**\n * Maximum height the component can be resized to\n */\n maxHeight?: number;\n /**\n * Minimum width the component can be resized to\n */\n minWidth?: number;\n /**\n * Minimum height the component can be resized to\n */\n minHeight?: number;\n /**\n * Callback fired during resize operations\n */\n onResize?: (values: MoveValues) => void;\n /**\n * Whether to maintain aspect ratio during resize\n * @default false\n */\n maintainAspectRatio?: boolean;\n}\n\nexport const Resizable = ({\n children,\n resizable = false,\n handles = { bottom: true, right: true, left: true, top: true },\n absolutePositioning = false,\n classNames,\n className: containerClassName,\n style: containerStyle,\n resetKey,\n\n // Use Resizable Props\n maxHeight,\n maxWidth,\n minHeight,\n minWidth,\n lockHorizontal,\n lockVertical,\n onResize,\n onDragEnd: onDragEndProp,\n onDragStart: onDragStartProp,\n disabled,\n maintainAspectRatio = false,\n interval,\n initialHeight: initialHeightProp,\n initialWidth: initialWidthProp,\n // other With Render Props\n ...rest\n}: ResizableProps) => {\n // Validate that children is a single React element\n // if (!isValidElement(children)) {\n // throw new Error(\n // \"Resizable component expects a single React element as children\"\n // );\n // }\n\n const cls = useCls();\n const [panelRef, setPanelRef] = useState<HTMLDivElement | null>(null);\n const [width, setWidth] = useState<number>();\n const [height, setHeight] = useState<number>();\n const [resizing, setResizing] = useState(false);\n\n const callbackRef = useCallback(\n (node: HTMLDivElement) => {\n setPanelRef(node);\n\n // Get initial dimensions only once when ref is set\n // For aspect ratio maintenance, we need initial dimensions immediately\n // Otherwise, preserve natural width/height behavior\n if (node && !width && !height) {\n const rect = node.getBoundingClientRect();\n if (rect.width > 0 && rect.height > 0) {\n if (maintainAspectRatio) {\n // Need dimensions for aspect ratio calculation\n setWidth(rect.width);\n setHeight(rect.height);\n }\n // For non-aspect-ratio cases, don't set dimensions to preserve natural behavior\n }\n }\n },\n [width, height, maintainAspectRatio],\n );\n\n // Reset dimensions when resetKey changes\n useEffect(() => {\n if (resetKey !== undefined && panelRef) {\n // Clear the hook's inline styles to reset to natural size\n panelRef.style.width = \"\";\n panelRef.style.height = \"\";\n\n // Force a reflow to get natural dimensions\n const rect = panelRef.getBoundingClientRect();\n\n if (rect.width > 0 && rect.height > 0) {\n if (maintainAspectRatio) {\n // For aspect ratio maintenance, re-measure and set dimensions\n setWidth(rect.width);\n setHeight(rect.height);\n } else {\n // Reset state to allow natural dimensions again\n setWidth(undefined);\n setHeight(undefined);\n }\n\n // Don't apply any explicit dimensions - let them remain natural\n // panelRef.style.width = `${rect.width}px`;\n // panelRef.style.height = `${rect.height}px`;\n }\n }\n }, [resetKey, panelRef, maintainAspectRatio]);\n\n // Initialize useResizable with current dimensions (or undefined if not ready)\n // For aspect ratio maintenance, we need initial dimensions\n // Otherwise, preserve natural width/height behavior until user starts resizing\n const resizableHook = useResizable({\n initialWidth: maintainAspectRatio ? width : initialWidthProp,\n initialHeight: maintainAspectRatio ? height : initialHeightProp,\n maxHeight,\n maxWidth,\n minHeight,\n minWidth,\n lockHorizontal,\n lockVertical,\n onResize,\n disabled,\n maintainAspectRatio,\n interval,\n onDragStart: (values) => {\n setResizing(true);\n // Capture natural dimensions when user starts resizing\n if (panelRef) {\n const rect = panelRef.getBoundingClientRect();\n if (rect.width > 0 && !width) {\n setWidth(rect.width);\n }\n if (rect.height > 0 && !height) {\n setHeight(rect.height);\n }\n }\n if (onDragStartProp) onDragStartProp(values);\n },\n onDragEnd: (values) => {\n setResizing(false);\n if (onDragEndProp) onDragEndProp(values);\n },\n });\n\n const isChildrenValidElement = isValidElement(children);\n\n useEffect(() => {\n if (resizing) {\n document.body.style.userSelect = \"none\";\n } else {\n document.body.style.userSelect = \"\";\n }\n }, [resizing]);\n\n // Get resizable props - useResizable hook handles cases where dimensions aren't ready\n const { ref: rootRefProp, ...rootPropsWithoutRef } =\n resizableHook.getRootProps();\n const getHandleProps = resizableHook.getHandleProps;\n const rootRef = resizableHook.rootRef;\n\n // Handle reverse handle change for horizontal resizing (only for absolute positioning)\n const onReverseHandleChangeHorizontal = (\n parent: React.RefObject<HTMLDivElement>,\n values: MoveValues,\n ) => {\n if (!parent.current || !absolutePositioning) return;\n const { widthDiff } = values;\n parent.current.style.left = `${\n parseInt(parent.current.style.left || \"0\") - widthDiff\n }px`;\n };\n\n // Handle reverse handle change for vertical resizing (only for absolute positioning)\n const onReverseHandleChangeVertical = (\n parent: React.RefObject<HTMLDivElement>,\n values: MoveValues,\n ) => {\n if (!parent.current || !absolutePositioning) return;\n const { heightDiff } = values;\n parent.current.style.top = `${\n parseInt(parent.current.style.top || \"0\") - heightDiff\n }px`;\n };\n\n const resizeHandles = resizable\n ? [\n handles.top && !maintainAspectRatio && (\n <div\n key=\"top\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle,\n )}\n data-placement=\"top-center\"\n {...getHandleProps({\n reverse: true,\n lockHorizontal: true,\n onResize: (values) =>\n onReverseHandleChangeVertical(rootRef, values),\n })}\n />\n ),\n handles.bottom && !maintainAspectRatio && (\n <div\n key=\"bottom\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle,\n )}\n data-placement=\"bottom-left\"\n {...getHandleProps({\n lockHorizontal: true,\n })}\n />\n ),\n handles.left && !maintainAspectRatio && (\n <div\n key=\"left\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle,\n )}\n data-placement=\"top-left\"\n {...getHandleProps({\n reverse: true,\n lockVertical: true,\n onResize: (values) =>\n onReverseHandleChangeHorizontal(rootRef, values),\n })}\n />\n ),\n handles.right && !maintainAspectRatio && (\n <div\n key=\"right\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle,\n )}\n data-placement=\"top-right\"\n {...getHandleProps({\n lockVertical: true,\n })}\n />\n ),\n // For aspect ratio maintenance, add corner handles that can resize both dimensions\n handles.right && handles.bottom && (\n <div\n key=\"bottom-right-corner\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle,\n )}\n data-placement=\"bottom-right-corner\"\n {...getHandleProps({\n // No locks - allow both horizontal and vertical resizing\n })}\n />\n ),\n maintainAspectRatio && handles.left && handles.bottom && (\n <div\n key=\"bottom-left-corner\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle,\n )}\n data-placement=\"bottom-left-corner\"\n {...getHandleProps({\n reverse: true,\n onResize: (values) =>\n onReverseHandleChangeHorizontal(rootRef, values),\n })}\n />\n ),\n maintainAspectRatio && handles.right && handles.top && (\n <div\n key=\"top-right-corner\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle,\n )}\n data-placement=\"top-right-corner\"\n {...getHandleProps({\n reverse: true,\n onResize: (values) =>\n onReverseHandleChangeVertical(rootRef, values),\n })}\n />\n ),\n handles.left && handles.top && (\n <div\n key=\"top-left-corner\"\n className={clsx(\n cls(\"resizable-resize-handle\"),\n classNames?.resizeHandle,\n )}\n data-placement=\"top-left-corner\"\n {...getHandleProps({\n reverse: true,\n onResize: (values) => {\n onReverseHandleChangeHorizontal(rootRef, values);\n onReverseHandleChangeVertical(rootRef, values);\n },\n })}\n />\n ),\n ]\n : [];\n\n const childElement = children as React.ReactElement & {\n ref?: React.Ref<HTMLDivElement>;\n };\n\n const childElementProps = {\n className: getReactElementProp<string>(childElement, \"className\"),\n style: getReactElementProp<React.CSSProperties>(childElement, \"style\"),\n children: getReactElementProp<React.ReactNode>(childElement, \"children\"),\n ref: childElement.ref,\n };\n\n const childProps = {\n className: cn(\n resizable && cls(\"resizable\"),\n classNames?.root,\n childElementProps.className,\n containerClassName,\n ),\n ref: mergeRefs(\n resizable ? rootRefProp : undefined,\n callbackRef, // Always need this for dimension measurement\n childElement?.ref,\n ),\n style: { ...childElementProps.style, ...containerStyle },\n ...(resizing ? { \"data-resizing\": true } : {}),\n ...(resizable ? { \"data-resizable\": true } : {}),\n children: isChildrenValidElement\n ? [\n ...(Array.isArray(childElementProps.children)\n ? childElementProps.children\n : [childElementProps.children]),\n ...resizeHandles.filter(Boolean),\n ]\n : children,\n };\n\n return (\n <WithRenderProp\n render={(props) => {\n // Merge the props from WithRenderProp with our childProps\n const mergedProps = mergeProps(\n props,\n childProps,\n resizable ? rootPropsWithoutRef : {},\n );\n if (isChildrenValidElement) {\n return React.cloneElement(childElement, mergedProps);\n } else {\n return <div {...mergedProps}>{children}</div>;\n }\n }}\n {...rest}\n />\n );\n};\n"],"names":["Resizable","children","resizable","handles","absolutePositioning","classNames","containerClassName","containerStyle","resetKey","maxHeight","maxWidth","minHeight","minWidth","lockHorizontal","lockVertical","onResize","onDragEndProp","onDragStartProp","disabled","maintainAspectRatio","interval","initialHeightProp","initialWidthProp","rest","cls","useCls","panelRef","setPanelRef","useState","width","setWidth","height","setHeight","resizing","setResizing","callbackRef","useCallback","node","rect","useEffect","resizableHook","useResizable","values","isChildrenValidElement","isValidElement","rootRefProp","rootPropsWithoutRef","getHandleProps","rootRef","onReverseHandleChangeHorizontal","parent","widthDiff","onReverseHandleChangeVertical","heightDiff","resizeHandles","jsx","clsx","childElement","childElementProps","getReactElementProp","childProps","cn","mergeRefs","WithRenderProp","props","mergedProps","mergeProps","React"],"mappings":";;;;;;;;;;;AAyFO,MAAMA,KAAY,CAAC;AAAA,EACxB,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,SAAAC,IAAU,EAAE,QAAQ,IAAM,OAAO,IAAM,MAAM,IAAM,KAAK,GAAK;AAAA,EAC7D,qBAAAC,IAAsB;AAAA,EACtB,YAAAC;AAAA,EACA,WAAWC;AAAA,EACX,OAAOC;AAAA,EACP,UAAAC;AAAA;AAAA,EAGA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAWC;AAAA,EACX,aAAaC;AAAA,EACb,UAAAC;AAAA,EACA,qBAAAC,IAAsB;AAAA,EACtB,UAAAC;AAAA,EACA,eAAeC;AAAA,EACf,cAAcC;AAAA;AAAA,EAEd,GAAGC;AACL,MA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umbItemProps as BreadcrumbItemProps_2 } from 'antd/es/breadcrumb
|
|
|
21
21
|
import { BreadcrumbItemType as BreadcrumbItemType_2 } from 'antd/es/breadcrumb/Breadcrumb';
|
|
22
22
|
import { BreadcrumbProps as BreadcrumbProps_2 } from 'antd/es/breadcrumb';
|
|
23
23
|
import { BreadcrumbSeparatorType } from 'antd/es/breadcrumb/Breadcrumb';
|
|
24
|
-
import { Breakpoint } from 'antd';
|
|
25
24
|
import { ButtonProps as ButtonProps_2 } from 'antd/es/button';
|
|
26
25
|
import { Calendar } from 'antd';
|
|
27
26
|
import { CalendarMode } from 'antd';
|
|
@@ -134,8 +133,7 @@ import { message } from 'antd';
|
|
|
134
133
|
import { MessageArgsProps } from 'antd';
|
|
135
134
|
import { MessageInstance } from 'antd/es/message/interface';
|
|
136
135
|
import { ModalFuncProps } from 'antd';
|
|
137
|
-
import { ModalProps } from '
|
|
138
|
-
import { ModalProps as ModalProps_3 } from 'antd/es/modal';
|
|
136
|
+
import { ModalProps as ModalProps_2 } from 'antd/es/modal';
|
|
139
137
|
import { ModalRef } from './functions';
|
|
140
138
|
import { MoveValues } from 'react-use-resizable';
|
|
141
139
|
import { notification } from 'antd';
|
|
@@ -173,6 +171,7 @@ import { RefAttributes } from 'react';
|
|
|
173
171
|
import { RefObject } from 'react';
|
|
174
172
|
import { RefSelectProps } from 'antd';
|
|
175
173
|
import { RefSelectProps as RefSelectProps_2 } from 'antd/es/select';
|
|
174
|
+
import { ResizableProps as ResizableProps_2 } from 'react-use-resizable';
|
|
176
175
|
import { Result } from 'antd';
|
|
177
176
|
import { ResultProps } from 'antd';
|
|
178
177
|
import { RibbonProps } from 'antd/es/badge/Ribbon';
|
|
@@ -350,6 +349,16 @@ export declare interface BreadcrumbProps<T extends AnyObject = AnyObject> extend
|
|
|
350
349
|
itemRender?: (route: BreadcrumbItemType, params: T, routes: BreadcrumbItemType[], paths: string[]) => React.ReactNode;
|
|
351
350
|
}
|
|
352
351
|
|
|
352
|
+
declare type Breakpoint = "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
|
|
353
|
+
|
|
354
|
+
export declare const BREAKPOINTS: {
|
|
355
|
+
sm: number;
|
|
356
|
+
md: number;
|
|
357
|
+
lg: number;
|
|
358
|
+
xl: number;
|
|
359
|
+
"2xl": number;
|
|
360
|
+
};
|
|
361
|
+
|
|
353
362
|
/**
|
|
354
363
|
* Build Antd placement string from BaseUI side and align values
|
|
355
364
|
* @param placement - Object with side and align properties
|
|
@@ -2325,7 +2334,7 @@ export declare const Modal: (({ open: externalOpen, closeIcon, children, size: s
|
|
|
2325
2334
|
|
|
2326
2335
|
export { ModalFuncProps }
|
|
2327
2336
|
|
|
2328
|
-
declare type ModalFuncProps_2 =
|
|
2337
|
+
declare type ModalFuncProps_2 = ModalProps & {
|
|
2329
2338
|
/**
|
|
2330
2339
|
* Content to be displayed in the modal
|
|
2331
2340
|
* Similar to children prop in Modal component
|
|
@@ -2334,7 +2343,7 @@ declare type ModalFuncProps_2 = ModalProps_2 & {
|
|
|
2334
2343
|
content?: default_2.ReactNode;
|
|
2335
2344
|
};
|
|
2336
2345
|
|
|
2337
|
-
declare interface
|
|
2346
|
+
export declare interface ModalProps extends Omit<ModalProps_2, "centered"> {
|
|
2338
2347
|
/**
|
|
2339
2348
|
* Predefined sizes for the modal
|
|
2340
2349
|
* - xsmall: 400px
|
|
@@ -2479,6 +2488,8 @@ export { notification }
|
|
|
2479
2488
|
|
|
2480
2489
|
export { NotificationArgsProps }
|
|
2481
2490
|
|
|
2491
|
+
declare type ObserverRect = Omit<DOMRectReadOnly, 'toJSON'>;
|
|
2492
|
+
|
|
2482
2493
|
export { Pagination }
|
|
2483
2494
|
|
|
2484
2495
|
export { PaginationProps }
|
|
@@ -3291,9 +3302,9 @@ export { RefSelectProps }
|
|
|
3291
3302
|
|
|
3292
3303
|
declare type RefType<T extends FieldType> = T extends "input" ? InputRef : T extends "select" ? RefSelectProps_2 : never;
|
|
3293
3304
|
|
|
3294
|
-
export declare const Resizable: ({ children, resizable, handles, absolutePositioning, classNames, className: containerClassName, style: containerStyle, resetKey, maxWidth,
|
|
3305
|
+
export declare const Resizable: ({ children, resizable, handles, absolutePositioning, classNames, className: containerClassName, style: containerStyle, resetKey, maxHeight, maxWidth, minHeight, minWidth, lockHorizontal, lockVertical, onResize, onDragEnd: onDragEndProp, onDragStart: onDragStartProp, disabled, maintainAspectRatio, interval, initialHeight: initialHeightProp, initialWidth: initialWidthProp, ...rest }: ResizableProps) => JSX.Element;
|
|
3295
3306
|
|
|
3296
|
-
export declare interface ResizableProps extends WithRenderPropProps {
|
|
3307
|
+
export declare interface ResizableProps extends Omit<WithRenderPropProps, keyof ResizableProps_2>, ResizableProps_2 {
|
|
3297
3308
|
/**
|
|
3298
3309
|
* Single React element child that will be enhanced with resize handles
|
|
3299
3310
|
*/
|
|
@@ -3978,7 +3989,35 @@ export declare const useAntdCssVarClassname: () => string;
|
|
|
3978
3989
|
|
|
3979
3990
|
export { useApp }
|
|
3980
3991
|
|
|
3981
|
-
|
|
3992
|
+
/**
|
|
3993
|
+
* A responsive breakpoint hook using window.matchMedia for optimal performance.
|
|
3994
|
+
*
|
|
3995
|
+
* @param ssrBreakpoint - The breakpoint to use during SSR and before hydration.
|
|
3996
|
+
* Defaults to "lg" for better SEO (search engines typically use desktop viewports).
|
|
3997
|
+
*
|
|
3998
|
+
* @example
|
|
3999
|
+
* ```tsx
|
|
4000
|
+
* // Default: uses "lg" for SSR
|
|
4001
|
+
* const bp = useBreakpoint();
|
|
4002
|
+
*
|
|
4003
|
+
* // Custom SSR breakpoint
|
|
4004
|
+
* const bp = useBreakpoint("md");
|
|
4005
|
+
*
|
|
4006
|
+
* // Usage
|
|
4007
|
+
* bp.breakpoint // Current breakpoint: "sm" | "md" | "lg" | "xl" | "2xl"
|
|
4008
|
+
* bp.up("md") // true if screen >= 768px
|
|
4009
|
+
* bp.down("lg") // true if screen < 1024px
|
|
4010
|
+
* bp.between("md", "xl") // true if 768px <= screen < 1280px
|
|
4011
|
+
* bp.only("lg") // true if screen is exactly in "lg" range
|
|
4012
|
+
* ```
|
|
4013
|
+
*/
|
|
4014
|
+
export declare const useBreakpoint: (ssrBreakpoint?: Breakpoint) => {
|
|
4015
|
+
breakpoint: Breakpoint;
|
|
4016
|
+
up: (bp: Breakpoint) => boolean;
|
|
4017
|
+
down: (bp: Breakpoint) => boolean;
|
|
4018
|
+
between: (minBp: Breakpoint, maxBp: Breakpoint) => boolean;
|
|
4019
|
+
only: (bp: Breakpoint) => boolean;
|
|
4020
|
+
};
|
|
3982
4021
|
|
|
3983
4022
|
/**
|
|
3984
4023
|
* Get chart colors and axis configuration based on the current theme.
|
|
@@ -4051,6 +4090,12 @@ export declare const useDS: () => {
|
|
|
4051
4090
|
theme: "light" | "dark";
|
|
4052
4091
|
};
|
|
4053
4092
|
|
|
4093
|
+
export declare function useElementSize<T extends HTMLElement = any>(options?: ResizeObserverOptions): {
|
|
4094
|
+
ref: RefObject<T>;
|
|
4095
|
+
width: number;
|
|
4096
|
+
height: number;
|
|
4097
|
+
};
|
|
4098
|
+
|
|
4054
4099
|
export declare const useEnhancedEffect: typeof useLayoutEffect;
|
|
4055
4100
|
|
|
4056
4101
|
export declare function useEventCallback<Fn extends AnyFunction>(fn?: Fn): Fn;
|
|
@@ -4072,6 +4117,8 @@ export declare const useMessage: () => MessageInstance;
|
|
|
4072
4117
|
|
|
4073
4118
|
export declare const useModal: () => HookAPI;
|
|
4074
4119
|
|
|
4120
|
+
export declare function useResizeObserver<T extends HTMLElement = any>(options?: ResizeObserverOptions): readonly [RefObject<T>, ObserverRect];
|
|
4121
|
+
|
|
4075
4122
|
export declare const useToken: () => {
|
|
4076
4123
|
theme: Theme_2<SeedToken, AliasToken>;
|
|
4077
4124
|
token: GlobalToken;
|
|
@@ -4117,6 +4164,11 @@ export declare type UseUploadItemRenderProps = {
|
|
|
4117
4164
|
|
|
4118
4165
|
export { useWatch }
|
|
4119
4166
|
|
|
4167
|
+
export declare function useWindowSize(): {
|
|
4168
|
+
width: any;
|
|
4169
|
+
height: any;
|
|
4170
|
+
};
|
|
4171
|
+
|
|
4120
4172
|
export { version }
|
|
4121
4173
|
|
|
4122
4174
|
export declare const VerticalCollapsiblePanel: default_2.FC<VerticalCollapsiblePanelProps>;
|
package/dist/index.js
CHANGED
|
@@ -1,143 +1,147 @@
|
|
|
1
1
|
import { componentMetadata as r, getComponentsByCategory as t } from "./metadata.js";
|
|
2
|
-
import { Affix as
|
|
2
|
+
import { Affix as a, Alert as m, Anchor as f, App as s, AutoComplete as x, Avatar as l, BackTop as n, Calendar as i, Card as C, Carousel as c, Cascader as u, Col as T, ColorPicker as d, ConfigProvider as S, DatePicker as g, Descriptions as A, Divider as h, Drawer as E, Dropdown as P, Flex as k, FloatButton as R, Grid as b, InputNumber as D, Layout as I, List as L, Mentions as O, Menu as B, Pagination as v, Popconfirm as y, Progress as N, QRCode as M, Rate as _, Result as w, Row as U, Skeleton as W, Space as F, Statistic as V, Steps as q, Tabs as z, TimePicker as G, Timeline as K, Transfer as Q, TreeSelect as H, Typography as j, Watermark as J, message as X, notification as Y, theme as Z, unstableSetRender as $, version as oo } from "antd";
|
|
3
3
|
import { Select as ro } from "./components/select/component.js";
|
|
4
|
-
import { Modal as
|
|
4
|
+
import { Modal as po } from "./components/modal/index.js";
|
|
5
5
|
import { IconButton as mo } from "./components/icon-button/component.js";
|
|
6
6
|
import { Switch as so } from "./components/switch/component.js";
|
|
7
7
|
import { Checkbox as lo } from "./components/checkbox/component.js";
|
|
8
8
|
import { Segmented as io } from "./components/segmented/component.js";
|
|
9
9
|
import { Table as co } from "./components/table/component.js";
|
|
10
10
|
import { Tag as To } from "./components/tag/component.js";
|
|
11
|
-
import { ThemeProvider as
|
|
12
|
-
import { Split as
|
|
11
|
+
import { ThemeProvider as go } from "./components/theme-provider/component.js";
|
|
12
|
+
import { Split as ho, Splitter as Eo } from "./components/splitter/component.js";
|
|
13
13
|
import { Truncate as ko } from "./components/truncate/component.js";
|
|
14
14
|
import { DropdownMenu as bo } from "./components/dropdown-menu/component.js";
|
|
15
15
|
import { DropdownMenuItem as Io } from "./components/dropdown-menu/item.js";
|
|
16
16
|
import { Transition as Oo } from "./components/transition/component.js";
|
|
17
|
-
import { DefaultUpload as
|
|
17
|
+
import { DefaultUpload as vo, Upload as yo } from "./components/upload/component.js";
|
|
18
18
|
import { useUploadItemRender as Mo } from "./components/upload/hooks.js";
|
|
19
|
-
import { clsx as
|
|
19
|
+
import { clsx as wo, cn as Uo, cx as Wo } from "./components/utils/cn.js";
|
|
20
20
|
import { reactNodeToString as Vo } from "./components/utils/reactToString.js";
|
|
21
|
-
import { isTracebackError as
|
|
22
|
-
import { isValidHexColor as
|
|
23
|
-
import { WithRenderProp as
|
|
21
|
+
import { isTracebackError as zo } from "./components/utils/isTracebackError.js";
|
|
22
|
+
import { isValidHexColor as Ko } from "./components/utils/colors.js";
|
|
23
|
+
import { WithRenderProp as Ho } from "./components/utils/WithRenderProp.js";
|
|
24
24
|
import { getReactElementProp as Jo } from "./components/utils/reactElement.js";
|
|
25
25
|
import { useAntdCssVarClassname as Yo, useCls as Zo, useGetPrefixCls as $o } from "./components/utils/antdUtils.js";
|
|
26
26
|
import { WithAntdTokens as ee } from "./components/utils/WithAntdTokens.js";
|
|
27
27
|
import { changeThemeWithoutTransition as te } from "./components/utils/theme.js";
|
|
28
|
-
import { moveTypingCursorToEnd as
|
|
28
|
+
import { moveTypingCursorToEnd as ae } from "./components/utils/selectionRange.js";
|
|
29
29
|
import { DROPDOWN_COLLISION_AVOIDANCE as fe, POPUP_COLLISION_AVOIDANCE as se } from "./components/utils/constants.js";
|
|
30
30
|
import { buildAntdPlacement as le, parseAntdPlacement as ne } from "./components/utils/placement.js";
|
|
31
31
|
import { ScrollArea as Ce } from "./components/scroll-area/component.js";
|
|
32
32
|
import { Popover as ue } from "./components/popover/component.js";
|
|
33
33
|
import { Slider as de } from "./components/slider/component.js";
|
|
34
|
-
import { Tooltip as
|
|
35
|
-
import { Breadcrumb as
|
|
34
|
+
import { Tooltip as ge } from "./components/tooltip/component.js";
|
|
35
|
+
import { Breadcrumb as he } from "./components/breadcrumb/component.js";
|
|
36
36
|
import { useUniqueKeysTree as Pe } from "./components/tree/useUniqueKeysTree.js";
|
|
37
|
-
import { getUniqueKeysFromOriginals as
|
|
37
|
+
import { getUniqueKeysFromOriginals as Re, processTreeData as be } from "./components/tree/helpers.js";
|
|
38
38
|
import { Tree as Ie } from "./components/tree/components.js";
|
|
39
39
|
import { Spin as Oe } from "./components/spin/component.js";
|
|
40
|
-
import { Empty as
|
|
40
|
+
import { Empty as ve, EmptyIcon as ye } from "./components/empty/component.js";
|
|
41
41
|
import { Form as Me } from "./components/form/component.js";
|
|
42
|
-
import { Field as
|
|
43
|
-
import { Tour as
|
|
42
|
+
import { Field as we } from "./components/field/component.js";
|
|
43
|
+
import { Tour as We } from "./components/tour/component.js";
|
|
44
44
|
import { Toast as Ve } from "./components/toast/component.js";
|
|
45
|
-
import { toast as
|
|
46
|
-
import { VerticalCollapsiblePanel as
|
|
45
|
+
import { toast as ze, toastManager as Ge } from "./components/toast/function.js";
|
|
46
|
+
import { VerticalCollapsiblePanel as Qe } from "./components/vertical-collapsible-panel/component.js";
|
|
47
47
|
import { PopupPanel as je } from "./components/popup-panel/component.js";
|
|
48
48
|
import { CodeBlock as Xe } from "./components/code-block/component.js";
|
|
49
49
|
import { StackChild as Ze } from "./components/stack/StackChild.js";
|
|
50
50
|
import { Stack as or } from "./components/stack/index.js";
|
|
51
51
|
import { Collapse as rr } from "./components/collapse/component.js";
|
|
52
|
-
import { Input as
|
|
52
|
+
import { Input as pr } from "./components/input/component.js";
|
|
53
53
|
import { Badge as mr, InternalBadge as fr } from "./components/badge/component.js";
|
|
54
54
|
import { Radio as xr } from "./components/radio/component.js";
|
|
55
55
|
import { Button as nr } from "./components/button/component.js";
|
|
56
56
|
import { DSRoot as Cr } from "./components/ds-root/component.js";
|
|
57
57
|
import { DSRootContextProvider as ur, useDS as Tr } from "./components/ds-root/context.js";
|
|
58
|
-
import { DragDrop as
|
|
59
|
-
import { ColorSelect as
|
|
58
|
+
import { DragDrop as Sr, DragDropRoot as gr } from "./components/drag-drop/index.js";
|
|
59
|
+
import { ColorSelect as hr } from "./components/color-select/component.js";
|
|
60
60
|
import { Nav as Pr } from "./components/nav/index.js";
|
|
61
|
-
import { ChoiceList as
|
|
62
|
-
import { StatusIcon as
|
|
61
|
+
import { ChoiceList as Rr } from "./components/choice-list/component.js";
|
|
62
|
+
import { StatusIcon as Dr } from "./components/status-icon/component.js";
|
|
63
63
|
import { Resizable as Lr } from "./components/resizable/component.js";
|
|
64
|
-
import { Combobox as
|
|
65
|
-
import { SelectTrigger as
|
|
64
|
+
import { Combobox as Br } from "./components/combobox/component.js";
|
|
65
|
+
import { SelectTrigger as yr } from "./components/select-trigger/component.js";
|
|
66
66
|
import { useForm as Mr, useWatch as _r } from "antd/es/form/Form";
|
|
67
|
-
import {
|
|
68
|
-
import { default as
|
|
69
|
-
import { useAnimationsFinished as
|
|
70
|
-
import { useControlledState as
|
|
71
|
-
import { useCharts as
|
|
72
|
-
import { useCSSVariables as
|
|
73
|
-
import { useHover as
|
|
74
|
-
import { useDraggable as
|
|
75
|
-
import {
|
|
76
|
-
import {
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
80
|
-
import {
|
|
67
|
+
import { useMessage as Ur, useModal as Wr, useToken as Fr } from "./components/hooks/antd.js";
|
|
68
|
+
import { default as qr } from "antd/es/app/useApp";
|
|
69
|
+
import { useAnimationsFinished as Gr, useEnhancedEffect as Kr, useEventCallback as Qr, useLatestRef as Hr } from "./components/hooks/base-ui.js";
|
|
70
|
+
import { useControlledState as Jr } from "./components/hooks/useControlledState.js";
|
|
71
|
+
import { useCharts as Yr } from "./components/hooks/useCharts.js";
|
|
72
|
+
import { useCSSVariables as $r } from "./components/hooks/useCSSVariables.js";
|
|
73
|
+
import { useHover as et } from "./components/hooks/useHover.js";
|
|
74
|
+
import { useDraggable as tt } from "./components/hooks/useDraggable.js";
|
|
75
|
+
import { BREAKPOINTS as at, useBreakpoint as mt } from "./components/hooks/useBreakpoint.js";
|
|
76
|
+
import { useWindowSize as st } from "./components/hooks/useWindowSize.js";
|
|
77
|
+
import { useElementSize as lt, useResizeObserver as nt } from "./components/hooks/useResizeObserver.js";
|
|
78
|
+
import { antdColorTokens as Ct, darkTheme as ct, lightTheme as ut } from "./tokens/and-theme/tokens.js";
|
|
79
|
+
import { categoricalChartColorKeys as dt, categoricalChartColorTokens as St, categoricalChartsColors as gt, chartColorTokens as At, rawChartColorTokens as ht } from "./tokens/charts/palettes/cloudscape.js";
|
|
80
|
+
import { COLORBREWER as Pt } from "./tokens/charts/palettes/colorbrewer.js";
|
|
81
|
+
import { tab10 as Rt, tab20 as bt, tab20b as Dt, tab20c as It } from "./tokens/charts/palettes/tableau.js";
|
|
82
|
+
import { CATEGORICAL_PALETTES as Ot, CATEGORICAL_PALETTE_NAMES as Bt, SEQUENTIAL_PALETTES as vt, SEQUENTIAL_PALETTE_NAMES as yt, getAllCategoricalChartColors as Nt, getAllSequentialChartColors as Mt, getCategoricalChartColors as _t, getSequentialChartColors as wt } from "./tokens/charts/palettes/index.js";
|
|
83
|
+
import { getColorsByTheme as Wt, getTokensByTheme as Ft, resolveColorTokens as Vt } from "./tokens/utils.js";
|
|
81
84
|
export {
|
|
82
|
-
|
|
85
|
+
a as Affix,
|
|
83
86
|
m as Alert,
|
|
84
87
|
f as Anchor,
|
|
85
88
|
s as App,
|
|
86
89
|
x as AutoComplete,
|
|
87
90
|
l as Avatar,
|
|
91
|
+
at as BREAKPOINTS,
|
|
88
92
|
n as BackTop,
|
|
89
93
|
mr as Badge,
|
|
90
|
-
|
|
94
|
+
he as Breadcrumb,
|
|
91
95
|
nr as Button,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
Ot as CATEGORICAL_PALETTES,
|
|
97
|
+
Bt as CATEGORICAL_PALETTE_NAMES,
|
|
98
|
+
Pt as COLORBREWER,
|
|
95
99
|
i as Calendar,
|
|
96
100
|
C as Card,
|
|
97
101
|
c as Carousel,
|
|
98
102
|
u as Cascader,
|
|
99
103
|
lo as Checkbox,
|
|
100
|
-
|
|
104
|
+
Rr as ChoiceList,
|
|
101
105
|
Xe as CodeBlock,
|
|
102
106
|
T as Col,
|
|
103
107
|
rr as Collapse,
|
|
104
108
|
d as ColorPicker,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
hr as ColorSelect,
|
|
110
|
+
Br as Combobox,
|
|
111
|
+
S as ConfigProvider,
|
|
108
112
|
fe as DROPDOWN_COLLISION_AVOIDANCE,
|
|
109
113
|
Cr as DSRoot,
|
|
110
114
|
ur as DSRootContextProvider,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
g as DatePicker,
|
|
116
|
+
vo as DefaultUpload,
|
|
117
|
+
A as Descriptions,
|
|
118
|
+
h as Divider,
|
|
119
|
+
Sr as DragDrop,
|
|
120
|
+
gr as DragDropRoot,
|
|
117
121
|
E as Drawer,
|
|
118
122
|
P as Dropdown,
|
|
119
123
|
bo as DropdownMenu,
|
|
120
124
|
Io as DropdownMenuItem,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
125
|
+
ve as Empty,
|
|
126
|
+
ye as EmptyIcon,
|
|
127
|
+
we as Field,
|
|
124
128
|
k as Flex,
|
|
125
|
-
|
|
129
|
+
R as FloatButton,
|
|
126
130
|
Me as Form,
|
|
127
131
|
b as Grid,
|
|
128
132
|
mo as IconButton,
|
|
129
|
-
|
|
130
|
-
|
|
133
|
+
pr as Input,
|
|
134
|
+
D as InputNumber,
|
|
131
135
|
fr as InternalBadge,
|
|
132
136
|
I as Layout,
|
|
133
137
|
L as List,
|
|
134
138
|
O as Mentions,
|
|
135
|
-
|
|
136
|
-
|
|
139
|
+
B as Menu,
|
|
140
|
+
po as Modal,
|
|
137
141
|
Pr as Nav,
|
|
138
142
|
se as POPUP_COLLISION_AVOIDANCE,
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
v as Pagination,
|
|
144
|
+
y as Popconfirm,
|
|
141
145
|
ue as Popover,
|
|
142
146
|
je as PopupPanel,
|
|
143
147
|
N as Progress,
|
|
@@ -145,108 +149,111 @@ export {
|
|
|
145
149
|
xr as Radio,
|
|
146
150
|
_ as Rate,
|
|
147
151
|
Lr as Resizable,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
+
w as Result,
|
|
153
|
+
U as Row,
|
|
154
|
+
vt as SEQUENTIAL_PALETTES,
|
|
155
|
+
yt as SEQUENTIAL_PALETTE_NAMES,
|
|
152
156
|
Ce as ScrollArea,
|
|
153
157
|
io as Segmented,
|
|
154
158
|
ro as Select,
|
|
155
|
-
|
|
156
|
-
|
|
159
|
+
yr as SelectTrigger,
|
|
160
|
+
W as Skeleton,
|
|
157
161
|
de as Slider,
|
|
158
|
-
|
|
162
|
+
F as Space,
|
|
159
163
|
Oe as Spin,
|
|
160
|
-
|
|
164
|
+
ho as Split,
|
|
161
165
|
Eo as Splitter,
|
|
162
166
|
or as Stack,
|
|
163
167
|
Ze as StackChild,
|
|
164
168
|
V as Statistic,
|
|
165
|
-
|
|
169
|
+
Dr as StatusIcon,
|
|
166
170
|
q as Steps,
|
|
167
171
|
so as Switch,
|
|
168
172
|
co as Table,
|
|
169
|
-
|
|
173
|
+
z as Tabs,
|
|
170
174
|
To as Tag,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
175
|
+
go as ThemeProvider,
|
|
176
|
+
G as TimePicker,
|
|
177
|
+
K as Timeline,
|
|
174
178
|
Ve as Toast,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
179
|
+
ge as Tooltip,
|
|
180
|
+
We as Tour,
|
|
181
|
+
Q as Transfer,
|
|
178
182
|
Oo as Transition,
|
|
179
183
|
Ie as Tree,
|
|
180
|
-
|
|
184
|
+
H as TreeSelect,
|
|
181
185
|
ko as Truncate,
|
|
182
186
|
j as Typography,
|
|
183
|
-
|
|
184
|
-
|
|
187
|
+
yo as Upload,
|
|
188
|
+
Qe as VerticalCollapsiblePanel,
|
|
185
189
|
J as Watermark,
|
|
186
190
|
ee as WithAntdTokens,
|
|
187
|
-
|
|
188
|
-
|
|
191
|
+
Ho as WithRenderProp,
|
|
192
|
+
Ct as antdColorTokens,
|
|
189
193
|
le as buildAntdPlacement,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
194
|
+
dt as categoricalChartColorKeys,
|
|
195
|
+
St as categoricalChartColorTokens,
|
|
196
|
+
gt as categoricalChartsColors,
|
|
193
197
|
te as changeThemeWithoutTransition,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
198
|
+
At as chartColorTokens,
|
|
199
|
+
wo as clsx,
|
|
200
|
+
Uo as cn,
|
|
197
201
|
r as componentMetadata,
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
Wo as cx,
|
|
203
|
+
ct as darkTheme,
|
|
204
|
+
Nt as getAllCategoricalChartColors,
|
|
205
|
+
Mt as getAllSequentialChartColors,
|
|
206
|
+
_t as getCategoricalChartColors,
|
|
207
|
+
Wt as getColorsByTheme,
|
|
204
208
|
t as getComponentsByCategory,
|
|
205
209
|
Jo as getReactElementProp,
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
wt as getSequentialChartColors,
|
|
211
|
+
Ft as getTokensByTheme,
|
|
212
|
+
Re as getUniqueKeysFromOriginals,
|
|
213
|
+
zo as isTracebackError,
|
|
214
|
+
Ko as isValidHexColor,
|
|
215
|
+
ut as lightTheme,
|
|
212
216
|
X as message,
|
|
213
|
-
|
|
217
|
+
ae as moveTypingCursorToEnd,
|
|
214
218
|
Y as notification,
|
|
215
219
|
ne as parseAntdPlacement,
|
|
216
220
|
be as processTreeData,
|
|
217
|
-
|
|
221
|
+
ht as rawChartColorTokens,
|
|
218
222
|
Vo as reactNodeToString,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
223
|
+
Vt as resolveColorTokens,
|
|
224
|
+
Rt as tab10,
|
|
225
|
+
bt as tab20,
|
|
226
|
+
Dt as tab20b,
|
|
227
|
+
It as tab20c,
|
|
224
228
|
Z as theme,
|
|
225
|
-
|
|
226
|
-
|
|
229
|
+
ze as toast,
|
|
230
|
+
Ge as toastManager,
|
|
227
231
|
$ as unstableSetRender,
|
|
228
|
-
|
|
232
|
+
Gr as useAnimationsFinished,
|
|
229
233
|
Yo as useAntdCssVarClassname,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
+
qr as useApp,
|
|
235
|
+
mt as useBreakpoint,
|
|
236
|
+
$r as useCSSVariables,
|
|
237
|
+
Yr as useCharts,
|
|
234
238
|
Zo as useCls,
|
|
235
|
-
|
|
239
|
+
Jr as useControlledState,
|
|
236
240
|
Tr as useDS,
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
241
|
+
tt as useDraggable,
|
|
242
|
+
lt as useElementSize,
|
|
243
|
+
Kr as useEnhancedEffect,
|
|
244
|
+
Qr as useEventCallback,
|
|
240
245
|
Mr as useForm,
|
|
241
246
|
$o as useGetPrefixCls,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
247
|
+
et as useHover,
|
|
248
|
+
Hr as useLatestRef,
|
|
249
|
+
Ur as useMessage,
|
|
245
250
|
Wr as useModal,
|
|
246
|
-
|
|
251
|
+
nt as useResizeObserver,
|
|
252
|
+
Fr as useToken,
|
|
247
253
|
Pe as useUniqueKeysTree,
|
|
248
254
|
Mo as useUploadItemRender,
|
|
249
255
|
_r as useWatch,
|
|
256
|
+
st as useWindowSize,
|
|
250
257
|
oo as version
|
|
251
258
|
};
|
|
252
259
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|