@hyddenlabs/hydn-ui 0.3.0-alpha.187 → 0.3.0-alpha.188
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +79 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +80 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2009,6 +2009,10 @@ var Button = React__default.default.forwardRef(
|
|
|
2009
2009
|
({
|
|
2010
2010
|
children,
|
|
2011
2011
|
onClick,
|
|
2012
|
+
onMouseEnter,
|
|
2013
|
+
onMouseLeave,
|
|
2014
|
+
onMouseDown,
|
|
2015
|
+
onBlur,
|
|
2012
2016
|
ariaLabel,
|
|
2013
2017
|
disabled = false,
|
|
2014
2018
|
type = "button",
|
|
@@ -2085,6 +2089,10 @@ var Button = React__default.default.forwardRef(
|
|
|
2085
2089
|
ref,
|
|
2086
2090
|
type,
|
|
2087
2091
|
onClick,
|
|
2092
|
+
onMouseEnter,
|
|
2093
|
+
onMouseLeave,
|
|
2094
|
+
onMouseDown,
|
|
2095
|
+
onBlur,
|
|
2088
2096
|
"aria-label": ariaLabel,
|
|
2089
2097
|
disabled: disabled || loading,
|
|
2090
2098
|
className: `${baseDisplayClass} items-center justify-center ${alignmentClass} ${roundedClasses[rounded]} font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50 ${styleClasses} ${sizeClasses} ${isIconOnly ? "p-0" : ""} ${widthClasses} ${activeClasses} ${className}`,
|
|
@@ -2248,9 +2256,73 @@ function useScrollReset(deps, container) {
|
|
|
2248
2256
|
}
|
|
2249
2257
|
var useScrollReset_default = useScrollReset;
|
|
2250
2258
|
var IconButton = React__default.default.forwardRef(
|
|
2251
|
-
({
|
|
2252
|
-
|
|
2253
|
-
|
|
2259
|
+
({
|
|
2260
|
+
icon,
|
|
2261
|
+
iconSize = "md",
|
|
2262
|
+
iconColor = "currentColor",
|
|
2263
|
+
buttonStyle,
|
|
2264
|
+
ariaLabel,
|
|
2265
|
+
hoverIcon,
|
|
2266
|
+
onMouseEnter,
|
|
2267
|
+
onMouseLeave,
|
|
2268
|
+
onClick,
|
|
2269
|
+
...rest
|
|
2270
|
+
}, ref) => {
|
|
2271
|
+
const [isHovered, setIsHovered] = React.useState(false);
|
|
2272
|
+
const buttonRef = React.useRef(null);
|
|
2273
|
+
const mergedRef = React.useCallback(
|
|
2274
|
+
(node) => {
|
|
2275
|
+
buttonRef.current = node;
|
|
2276
|
+
if (typeof ref === "function") {
|
|
2277
|
+
ref(node);
|
|
2278
|
+
} else if (ref) {
|
|
2279
|
+
ref.current = node;
|
|
2280
|
+
}
|
|
2281
|
+
},
|
|
2282
|
+
[ref]
|
|
2283
|
+
);
|
|
2284
|
+
const handleMouseEnter = (e) => {
|
|
2285
|
+
setIsHovered(true);
|
|
2286
|
+
onMouseEnter?.(e);
|
|
2287
|
+
};
|
|
2288
|
+
const handleMouseLeave = (e) => {
|
|
2289
|
+
setIsHovered(false);
|
|
2290
|
+
onMouseLeave?.(e);
|
|
2291
|
+
};
|
|
2292
|
+
const handleClick = (e) => {
|
|
2293
|
+
setIsHovered(false);
|
|
2294
|
+
onClick?.(e);
|
|
2295
|
+
};
|
|
2296
|
+
React.useEffect(() => {
|
|
2297
|
+
if (!hoverIcon || !isHovered) return;
|
|
2298
|
+
const handleGlobalMouseMove = (e) => {
|
|
2299
|
+
if (!buttonRef.current) return;
|
|
2300
|
+
const rect = buttonRef.current.getBoundingClientRect();
|
|
2301
|
+
const isOutside = e.clientX < rect.left || e.clientX > rect.right || e.clientY < rect.top || e.clientY > rect.bottom;
|
|
2302
|
+
if (isOutside) {
|
|
2303
|
+
setIsHovered(false);
|
|
2304
|
+
}
|
|
2305
|
+
};
|
|
2306
|
+
document.addEventListener("mousemove", handleGlobalMouseMove);
|
|
2307
|
+
return () => {
|
|
2308
|
+
document.removeEventListener("mousemove", handleGlobalMouseMove);
|
|
2309
|
+
};
|
|
2310
|
+
}, [hoverIcon, isHovered]);
|
|
2311
|
+
const displayIcon = isHovered && hoverIcon ? hoverIcon : icon;
|
|
2312
|
+
const iconNode = displayIcon ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: displayIcon, size: iconSize, color: iconColor }) : null;
|
|
2313
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2314
|
+
button_default,
|
|
2315
|
+
{
|
|
2316
|
+
ref: mergedRef,
|
|
2317
|
+
icon: iconNode,
|
|
2318
|
+
style: buttonStyle,
|
|
2319
|
+
ariaLabel,
|
|
2320
|
+
onMouseEnter: handleMouseEnter,
|
|
2321
|
+
onMouseLeave: handleMouseLeave,
|
|
2322
|
+
onClick: handleClick,
|
|
2323
|
+
...rest
|
|
2324
|
+
}
|
|
2325
|
+
);
|
|
2254
2326
|
}
|
|
2255
2327
|
);
|
|
2256
2328
|
IconButton.displayName = "IconButton";
|
|
@@ -2344,7 +2416,8 @@ function LeftNavLayout({
|
|
|
2344
2416
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2345
2417
|
icon_button_default,
|
|
2346
2418
|
{
|
|
2347
|
-
icon: collapsed ? "
|
|
2419
|
+
icon: collapsed ? "layout-sidebar-left-expand" : "layout-sidebar-left-collapse",
|
|
2420
|
+
hoverIcon: collapsed ? "layout-sidebar-left-expand-filled" : "layout-sidebar-left-collapse-filled",
|
|
2348
2421
|
ariaLabel: collapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
2349
2422
|
buttonStyle: "ghost",
|
|
2350
2423
|
variant: "neutral",
|
|
@@ -4329,7 +4402,7 @@ function DataTable({
|
|
|
4329
4402
|
return /* @__PURE__ */ jsxRuntime.jsx(stack_default, { direction: "horizontal", spacing: "sm", justify: "center", children: rowActions.map((action, actionIndex) => {
|
|
4330
4403
|
if (action && typeof action === "object" && "onClick" in action) {
|
|
4331
4404
|
const actionConfig = action;
|
|
4332
|
-
|
|
4405
|
+
const button = /* @__PURE__ */ jsxRuntime.jsx(
|
|
4333
4406
|
icon_button_default,
|
|
4334
4407
|
{
|
|
4335
4408
|
icon: actionConfig.icon,
|
|
@@ -4342,6 +4415,7 @@ function DataTable({
|
|
|
4342
4415
|
},
|
|
4343
4416
|
actionIndex
|
|
4344
4417
|
);
|
|
4418
|
+
return actionConfig.tooltip ? /* @__PURE__ */ jsxRuntime.jsx(tooltip_default, { content: actionConfig.tooltip, children: button }, actionIndex) : button;
|
|
4345
4419
|
} else {
|
|
4346
4420
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { children: action }, actionIndex);
|
|
4347
4421
|
}
|