@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
|
@@ -75,7 +75,7 @@ function DialogContent({
|
|
|
75
75
|
>
|
|
76
76
|
<UtilityClose
|
|
77
77
|
className={cn(
|
|
78
|
-
"dialog-close-icon text-gray-400 hover:text-gray-
|
|
78
|
+
"dialog-close-icon text-gray-400 hover:text-gray-600 transition-colors duration-200 ",
|
|
79
79
|
closeClassName,
|
|
80
80
|
)}
|
|
81
81
|
/>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useLayoutEffect, useRef, ReactNode } from "react";
|
|
4
|
+
import { animate } from "motion/react";
|
|
5
|
+
import { cn } from "@/lib/utils";
|
|
6
|
+
|
|
7
|
+
export function HeightContainer({
|
|
8
|
+
children,
|
|
9
|
+
stateKey,
|
|
10
|
+
className,
|
|
11
|
+
}: {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
stateKey: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
}) {
|
|
16
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
17
|
+
const innerRef = useRef<HTMLDivElement>(null);
|
|
18
|
+
const currentHeight = useRef(0);
|
|
19
|
+
|
|
20
|
+
useLayoutEffect(() => {
|
|
21
|
+
const container = containerRef.current;
|
|
22
|
+
const inner = innerRef.current;
|
|
23
|
+
if (!container || !inner) return;
|
|
24
|
+
|
|
25
|
+
// Set initial height without animation
|
|
26
|
+
const initialHeight = inner.offsetHeight;
|
|
27
|
+
if (currentHeight.current === 0 && initialHeight > 0) {
|
|
28
|
+
currentHeight.current = initialHeight;
|
|
29
|
+
container.style.height = `${initialHeight}px`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Keep observing so we catch post-animation height changes
|
|
33
|
+
const ro = new ResizeObserver(() => {
|
|
34
|
+
const targetHeight = inner.offsetHeight;
|
|
35
|
+
if (targetHeight > 0 && targetHeight !== currentHeight.current) {
|
|
36
|
+
const shouldAnimate = currentHeight.current > 0;
|
|
37
|
+
currentHeight.current = targetHeight;
|
|
38
|
+
if (shouldAnimate) {
|
|
39
|
+
animate(container, { height: targetHeight }, { duration: 0.25, ease: "easeInOut" });
|
|
40
|
+
} else {
|
|
41
|
+
container.style.height = `${targetHeight}px`;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
ro.observe(inner);
|
|
46
|
+
return () => ro.disconnect();
|
|
47
|
+
}, [stateKey]);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div ref={containerRef} className={cn("overflow-clip", className)}>
|
|
51
|
+
<div ref={innerRef}>{children}</div>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
useMotionValue,
|
|
9
9
|
} from "motion/react";
|
|
10
10
|
import { cn } from "@/lib/utils";
|
|
11
|
+
import { HeightContainer } from "./height-container";
|
|
11
12
|
import {
|
|
12
13
|
Children,
|
|
13
14
|
cloneElement,
|
|
@@ -65,49 +66,6 @@ const contentVariants = {
|
|
|
65
66
|
exit: (dir: number) => ({ opacity: 0, x: dir * -20 }),
|
|
66
67
|
};
|
|
67
68
|
|
|
68
|
-
function AnimatedHeight({
|
|
69
|
-
children,
|
|
70
|
-
selectedValue,
|
|
71
|
-
}: {
|
|
72
|
-
children: ReactNode;
|
|
73
|
-
selectedValue: string;
|
|
74
|
-
}) {
|
|
75
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
76
|
-
const innerRef = useRef<HTMLDivElement>(null);
|
|
77
|
-
const currentHeight = useRef(0);
|
|
78
|
-
|
|
79
|
-
useLayoutEffect(() => {
|
|
80
|
-
const container = containerRef.current;
|
|
81
|
-
const inner = innerRef.current;
|
|
82
|
-
if (!container || !inner) return;
|
|
83
|
-
|
|
84
|
-
const initialHeight = inner.offsetHeight;
|
|
85
|
-
if (currentHeight.current === 0) {
|
|
86
|
-
currentHeight.current = initialHeight;
|
|
87
|
-
container.style.height = `${initialHeight}px`;
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Keep observing until the height differs from current (new content has mounted)
|
|
92
|
-
const ro = new ResizeObserver(() => {
|
|
93
|
-
const targetHeight = inner.offsetHeight;
|
|
94
|
-
if (targetHeight > 0 && targetHeight !== currentHeight.current) {
|
|
95
|
-
currentHeight.current = targetHeight;
|
|
96
|
-
ro.disconnect();
|
|
97
|
-
animate(container, { height: targetHeight }, { duration: 0.25, ease: "easeInOut" });
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
ro.observe(inner);
|
|
101
|
-
return () => ro.disconnect();
|
|
102
|
-
}, [selectedValue]);
|
|
103
|
-
|
|
104
|
-
return (
|
|
105
|
-
<div ref={containerRef} className="overflow-clip">
|
|
106
|
-
<div ref={innerRef}>{children}</div>
|
|
107
|
-
</div>
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
69
|
function Tabs({
|
|
112
70
|
children,
|
|
113
71
|
defaultValue,
|
|
@@ -156,12 +114,12 @@ function Tabs({
|
|
|
156
114
|
>
|
|
157
115
|
<div className={cn("tabs-container", className)}>
|
|
158
116
|
{nonContentChildren}
|
|
159
|
-
<
|
|
117
|
+
<HeightContainer stateKey={selectedValue}>
|
|
160
118
|
<AnimatePresence mode="wait" custom={direction}>
|
|
161
119
|
{activeContent &&
|
|
162
120
|
cloneElement(activeContent, { key: activeContent.props.value })}
|
|
163
121
|
</AnimatePresence>
|
|
164
|
-
</
|
|
122
|
+
</HeightContainer>
|
|
165
123
|
</div>
|
|
166
124
|
</TabsContext.Provider>
|
|
167
125
|
);
|
package/client/global.css
CHANGED
|
@@ -2054,7 +2054,7 @@ body {
|
|
|
2054
2054
|
.tooltip-content {
|
|
2055
2055
|
position: relative;
|
|
2056
2056
|
z-index: 50;
|
|
2057
|
-
border-radius:
|
|
2057
|
+
border-radius: 12px;
|
|
2058
2058
|
padding: 1.5rem;
|
|
2059
2059
|
padding-top: 2rem;
|
|
2060
2060
|
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
@@ -2177,6 +2177,12 @@ body {
|
|
|
2177
2177
|
top: 1rem;
|
|
2178
2178
|
right: 1rem;
|
|
2179
2179
|
cursor: pointer;
|
|
2180
|
+
color: var(--color-gray-500, #6b7280);
|
|
2181
|
+
transition: color 0.15s ease-in-out;
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
[data-slot="tooltip-close"]:hover {
|
|
2185
|
+
color: var(--color-gray-300, #fff);
|
|
2180
2186
|
}
|
|
2181
2187
|
|
|
2182
2188
|
@media (max-width: 639px) {
|
|
@@ -7305,11 +7311,9 @@ body {
|
|
|
7305
7311
|
margin-bottom: 0;
|
|
7306
7312
|
}
|
|
7307
7313
|
|
|
7308
|
-
.page-header-description {
|
|
7309
|
-
/* Uses body-large utility */
|
|
7310
|
-
/* max-width: 680px; */
|
|
7314
|
+
/* .page-header-description {
|
|
7311
7315
|
padding-right: 10rem;
|
|
7312
|
-
}
|
|
7316
|
+
} */
|
|
7313
7317
|
|
|
7314
7318
|
@media (max-width: 640px) {
|
|
7315
7319
|
.page-header-description {
|