@syscore/ui-library 1.23.0 → 1.24.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/client/components/ui/dialog.tsx +1 -1
- package/client/components/ui/height-container.tsx +54 -0
- package/client/components/ui/tabs.tsx +3 -45
- package/client/components/ui/tooltip.tsx +1 -1
- package/client/global.css +9 -5
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +40 -35
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -145,6 +145,7 @@ import { FormField } from '../client/components/ui/form';
|
|
|
145
145
|
import { FormItem } from '../client/components/ui/form';
|
|
146
146
|
import { FormLabel } from '../client/components/ui/form';
|
|
147
147
|
import { FormMessage } from '../client/components/ui/form';
|
|
148
|
+
import { HeightContainer } from '../client/components/ui/height-container';
|
|
148
149
|
import { HoverCard } from '../client/components/ui/hover-card';
|
|
149
150
|
import { HoverCardContent } from '../client/components/ui/hover-card';
|
|
150
151
|
import { HoverCardTrigger } from '../client/components/ui/hover-card';
|
|
@@ -662,6 +663,8 @@ export { FormLabel }
|
|
|
662
663
|
|
|
663
664
|
export { FormMessage }
|
|
664
665
|
|
|
666
|
+
export { HeightContainer }
|
|
667
|
+
|
|
665
668
|
export { HoverCard }
|
|
666
669
|
|
|
667
670
|
export { HoverCardContent }
|
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { useState, useEffect, useCallback, useRef, createContext, Children, isValidElement, cloneElement,
|
|
4
|
-
import { motion, AnimatePresence,
|
|
3
|
+
import { useState, useEffect, useCallback, useRef, useLayoutEffect, createContext, Children, isValidElement, cloneElement, useContext, useMemo } from "react";
|
|
4
|
+
import { motion, AnimatePresence, animate, useMotionValue } from "motion/react";
|
|
5
5
|
import { clsx } from "clsx";
|
|
6
6
|
import { twMerge } from "tailwind-merge";
|
|
7
7
|
import { cva } from "class-variance-authority";
|
|
@@ -1097,7 +1097,7 @@ function ToggleClose({ className }) {
|
|
|
1097
1097
|
"data-slot": "tooltip-close",
|
|
1098
1098
|
onClick: close,
|
|
1099
1099
|
className,
|
|
1100
|
-
children: /* @__PURE__ */ jsx(UtilityClose, {})
|
|
1100
|
+
children: /* @__PURE__ */ jsx(UtilityClose, { className: "text-inherit" })
|
|
1101
1101
|
}
|
|
1102
1102
|
);
|
|
1103
1103
|
}
|
|
@@ -2464,7 +2464,7 @@ function DialogContent({
|
|
|
2464
2464
|
UtilityClose,
|
|
2465
2465
|
{
|
|
2466
2466
|
className: cn(
|
|
2467
|
-
"dialog-close-icon text-gray-400 hover:text-gray-
|
|
2467
|
+
"dialog-close-icon text-gray-400 hover:text-gray-600 transition-colors duration-200 ",
|
|
2468
2468
|
closeClassName
|
|
2469
2469
|
)
|
|
2470
2470
|
}
|
|
@@ -2767,6 +2767,40 @@ const Tag = React.forwardRef(
|
|
|
2767
2767
|
}
|
|
2768
2768
|
);
|
|
2769
2769
|
Tag.displayName = "Tag";
|
|
2770
|
+
function HeightContainer({
|
|
2771
|
+
children,
|
|
2772
|
+
stateKey,
|
|
2773
|
+
className
|
|
2774
|
+
}) {
|
|
2775
|
+
const containerRef = useRef(null);
|
|
2776
|
+
const innerRef = useRef(null);
|
|
2777
|
+
const currentHeight = useRef(0);
|
|
2778
|
+
useLayoutEffect(() => {
|
|
2779
|
+
const container = containerRef.current;
|
|
2780
|
+
const inner = innerRef.current;
|
|
2781
|
+
if (!container || !inner) return;
|
|
2782
|
+
const initialHeight = inner.offsetHeight;
|
|
2783
|
+
if (currentHeight.current === 0 && initialHeight > 0) {
|
|
2784
|
+
currentHeight.current = initialHeight;
|
|
2785
|
+
container.style.height = `${initialHeight}px`;
|
|
2786
|
+
}
|
|
2787
|
+
const ro = new ResizeObserver(() => {
|
|
2788
|
+
const targetHeight = inner.offsetHeight;
|
|
2789
|
+
if (targetHeight > 0 && targetHeight !== currentHeight.current) {
|
|
2790
|
+
const shouldAnimate = currentHeight.current > 0;
|
|
2791
|
+
currentHeight.current = targetHeight;
|
|
2792
|
+
if (shouldAnimate) {
|
|
2793
|
+
animate(container, { height: targetHeight }, { duration: 0.25, ease: "easeInOut" });
|
|
2794
|
+
} else {
|
|
2795
|
+
container.style.height = `${targetHeight}px`;
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
});
|
|
2799
|
+
ro.observe(inner);
|
|
2800
|
+
return () => ro.disconnect();
|
|
2801
|
+
}, [stateKey]);
|
|
2802
|
+
return /* @__PURE__ */ jsx("div", { ref: containerRef, className: cn("overflow-clip", className), children: /* @__PURE__ */ jsx("div", { ref: innerRef, children }) });
|
|
2803
|
+
}
|
|
2770
2804
|
const TabsContext = createContext(null);
|
|
2771
2805
|
function useTabsContext() {
|
|
2772
2806
|
const ctx = useContext(TabsContext);
|
|
@@ -2790,36 +2824,6 @@ const contentVariants = {
|
|
|
2790
2824
|
center: { opacity: 1, x: 0 },
|
|
2791
2825
|
exit: (dir) => ({ opacity: 0, x: dir * -20 })
|
|
2792
2826
|
};
|
|
2793
|
-
function AnimatedHeight({
|
|
2794
|
-
children,
|
|
2795
|
-
selectedValue
|
|
2796
|
-
}) {
|
|
2797
|
-
const containerRef = useRef(null);
|
|
2798
|
-
const innerRef = useRef(null);
|
|
2799
|
-
const currentHeight = useRef(0);
|
|
2800
|
-
useLayoutEffect(() => {
|
|
2801
|
-
const container = containerRef.current;
|
|
2802
|
-
const inner = innerRef.current;
|
|
2803
|
-
if (!container || !inner) return;
|
|
2804
|
-
const initialHeight = inner.offsetHeight;
|
|
2805
|
-
if (currentHeight.current === 0) {
|
|
2806
|
-
currentHeight.current = initialHeight;
|
|
2807
|
-
container.style.height = `${initialHeight}px`;
|
|
2808
|
-
return;
|
|
2809
|
-
}
|
|
2810
|
-
const ro = new ResizeObserver(() => {
|
|
2811
|
-
const targetHeight = inner.offsetHeight;
|
|
2812
|
-
if (targetHeight > 0 && targetHeight !== currentHeight.current) {
|
|
2813
|
-
currentHeight.current = targetHeight;
|
|
2814
|
-
ro.disconnect();
|
|
2815
|
-
animate(container, { height: targetHeight }, { duration: 0.25, ease: "easeInOut" });
|
|
2816
|
-
}
|
|
2817
|
-
});
|
|
2818
|
-
ro.observe(inner);
|
|
2819
|
-
return () => ro.disconnect();
|
|
2820
|
-
}, [selectedValue]);
|
|
2821
|
-
return /* @__PURE__ */ jsx("div", { ref: containerRef, className: "overflow-clip", children: /* @__PURE__ */ jsx("div", { ref: innerRef, children }) });
|
|
2822
|
-
}
|
|
2823
2827
|
function Tabs({
|
|
2824
2828
|
children,
|
|
2825
2829
|
defaultValue,
|
|
@@ -2857,7 +2861,7 @@ function Tabs({
|
|
|
2857
2861
|
value: { selectedValue, setSelectedValue: handleSetSelectedValue, direction, registerValue },
|
|
2858
2862
|
children: /* @__PURE__ */ jsxs("div", { className: cn("tabs-container", className), children: [
|
|
2859
2863
|
nonContentChildren,
|
|
2860
|
-
/* @__PURE__ */ jsx(
|
|
2864
|
+
/* @__PURE__ */ jsx(HeightContainer, { stateKey: selectedValue, children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", custom: direction, children: activeContent && cloneElement(activeContent, { key: activeContent.props.value }) }) })
|
|
2861
2865
|
] })
|
|
2862
2866
|
}
|
|
2863
2867
|
);
|
|
@@ -13625,6 +13629,7 @@ export {
|
|
|
13625
13629
|
FormItem,
|
|
13626
13630
|
FormLabel,
|
|
13627
13631
|
FormMessage,
|
|
13632
|
+
HeightContainer,
|
|
13628
13633
|
HoverCard,
|
|
13629
13634
|
HoverCardContent,
|
|
13630
13635
|
HoverCardTrigger,
|