@hyddenlabs/hydn-ui 0.3.0-alpha.186 → 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 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
- ({ icon, iconSize = "md", iconColor = "currentColor", buttonStyle, ariaLabel, ...rest }, ref) => {
2252
- const iconNode = icon ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: icon, size: iconSize, color: iconColor }) : null;
2253
- return /* @__PURE__ */ jsxRuntime.jsx(button_default, { ref, icon: iconNode, style: buttonStyle, ariaLabel, ...rest });
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 ? "chevron-right" : "chevron-left",
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",
@@ -2838,15 +2911,21 @@ var PageTransition = ({
2838
2911
  };
2839
2912
  PageTransition.displayName = "PageTransition";
2840
2913
  var page_transition_default = PageTransition;
2841
- function Breadcrumbs({ items, separator = "/", className = "" }) {
2914
+ function Breadcrumbs({ items, separator = "/", className = "", linkComponent }) {
2915
+ const LinkComponent = linkComponent || "a";
2842
2916
  return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": "Breadcrumb", className, children: /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "flex items-center space-x-2 text-sm", children: items.map((item, index) => {
2843
2917
  const isLast = index === items.length - 1;
2844
2918
  const key = item.href || item.label;
2919
+ const { label: _label, onClick, href, ...linkProps } = item;
2920
+ const hasLinkProps = href || onClick || Object.keys(linkProps).length > 0;
2921
+ const shouldRenderLink = hasLinkProps && !isLast;
2845
2922
  return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "flex items-center", children: [
2846
- item.href && !isLast ? /* @__PURE__ */ jsxRuntime.jsx(
2847
- "a",
2923
+ shouldRenderLink ? /* @__PURE__ */ jsxRuntime.jsx(
2924
+ LinkComponent,
2848
2925
  {
2849
- href: item.href,
2926
+ ...href ? { href } : {},
2927
+ ...linkProps,
2928
+ onClick,
2850
2929
  className: "text-primary hover:text-primary/80 hover:underline cursor-pointer transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-ring rounded px-1 -mx-1",
2851
2930
  children: item.label
2852
2931
  }
@@ -4206,6 +4285,10 @@ function DataTable({
4206
4285
  }
4207
4286
  };
4208
4287
  const renderCellContent = (value, column, row, rowIndex) => {
4288
+ const isEmpty = value == null || value === "";
4289
+ if (isEmpty && column.fallback !== void 0) {
4290
+ return column.fallback;
4291
+ }
4209
4292
  if (column.render) {
4210
4293
  return column.render(value, row, rowIndex);
4211
4294
  }
@@ -4319,7 +4402,7 @@ function DataTable({
4319
4402
  return /* @__PURE__ */ jsxRuntime.jsx(stack_default, { direction: "horizontal", spacing: "sm", justify: "center", children: rowActions.map((action, actionIndex) => {
4320
4403
  if (action && typeof action === "object" && "onClick" in action) {
4321
4404
  const actionConfig = action;
4322
- return /* @__PURE__ */ jsxRuntime.jsx(
4405
+ const button = /* @__PURE__ */ jsxRuntime.jsx(
4323
4406
  icon_button_default,
4324
4407
  {
4325
4408
  icon: actionConfig.icon,
@@ -4332,6 +4415,7 @@ function DataTable({
4332
4415
  },
4333
4416
  actionIndex
4334
4417
  );
4418
+ return actionConfig.tooltip ? /* @__PURE__ */ jsxRuntime.jsx(tooltip_default, { content: actionConfig.tooltip, children: button }, actionIndex) : button;
4335
4419
  } else {
4336
4420
  return /* @__PURE__ */ jsxRuntime.jsx("div", { children: action }, actionIndex);
4337
4421
  }