@hyddenlabs/hydn-ui 0.3.0-alpha.186 → 0.3.0-alpha.187

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.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React$1 from 'react';
3
- import React__default, { ReactNode, ComponentProps, MouseEvent, HTMLAttributes, CSSProperties, FormEvent, RefObject } from 'react';
3
+ import React__default, { ReactNode, ComponentProps, MouseEvent, ComponentType, HTMLAttributes, CSSProperties, FormEvent, RefObject } from 'react';
4
4
 
5
5
  declare const colors: {
6
6
  background: string;
@@ -2020,6 +2020,10 @@ type BreadcrumbItem = {
2020
2020
  label: string;
2021
2021
  /** Optional navigation link (last item typically has no href) */
2022
2022
  href?: string;
2023
+ /** Optional click handler for client-side navigation */
2024
+ onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
2025
+ /** Additional props passed to the link component (e.g., 'to' for React Router Link) */
2026
+ [key: string]: unknown;
2023
2027
  };
2024
2028
  type BreadcrumbsProps = {
2025
2029
  /** Array of breadcrumb items to display in hierarchical order */
@@ -2028,11 +2032,40 @@ type BreadcrumbsProps = {
2028
2032
  separator?: ReactNode;
2029
2033
  /** Additional CSS classes for the breadcrumb container */
2030
2034
  className?: string;
2035
+ /** Custom link component (e.g., React Router Link) for client-side navigation */
2036
+ linkComponent?: ComponentType<{
2037
+ className?: string;
2038
+ onClick?: (e: MouseEvent<HTMLAnchorElement>) => void;
2039
+ [key: string]: unknown;
2040
+ }>;
2031
2041
  };
2032
2042
  /**
2033
2043
  * Breadcrumbs - Hierarchical path display
2044
+ *
2045
+ * @example
2046
+ * // With onClick handlers
2047
+ * <Breadcrumbs
2048
+ * items={[
2049
+ * { label: 'Home', href: '/', onClick: () => navigate('/') },
2050
+ * { label: 'Products', href: '/products', onClick: () => navigate('/products') },
2051
+ * { label: 'Item' }
2052
+ * ]}
2053
+ * />
2054
+ *
2055
+ * @example
2056
+ * // With React Router Link component
2057
+ * import { Link } from 'react-router-dom';
2058
+ *
2059
+ * <Breadcrumbs
2060
+ * linkComponent={Link}
2061
+ * items={[
2062
+ * { label: 'Home', to: '/' },
2063
+ * { label: 'Products', to: '/products' },
2064
+ * { label: 'Item' }
2065
+ * ]}
2066
+ * />
2034
2067
  */
2035
- declare function Breadcrumbs({ items, separator, className }: Readonly<BreadcrumbsProps>): react_jsx_runtime.JSX.Element;
2068
+ declare function Breadcrumbs({ items, separator, className, linkComponent }: Readonly<BreadcrumbsProps>): react_jsx_runtime.JSX.Element;
2036
2069
  declare namespace Breadcrumbs {
2037
2070
  var displayName: string;
2038
2071
  }
@@ -2589,6 +2622,8 @@ type ColumnDef<T> = {
2589
2622
  chipVariant?: StatusColorProp;
2590
2623
  /** Size for badge or chip rendering */
2591
2624
  componentSize?: 'sm' | 'md' | 'lg';
2625
+ /** Fallback value to display when cell value is null, undefined, or empty string */
2626
+ fallback?: string;
2592
2627
  };
2593
2628
  type DataTableProps<T> = {
2594
2629
  /** Array of data objects to display in the table */
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React$1 from 'react';
3
- import React__default, { ReactNode, ComponentProps, MouseEvent, HTMLAttributes, CSSProperties, FormEvent, RefObject } from 'react';
3
+ import React__default, { ReactNode, ComponentProps, MouseEvent, ComponentType, HTMLAttributes, CSSProperties, FormEvent, RefObject } from 'react';
4
4
 
5
5
  declare const colors: {
6
6
  background: string;
@@ -2020,6 +2020,10 @@ type BreadcrumbItem = {
2020
2020
  label: string;
2021
2021
  /** Optional navigation link (last item typically has no href) */
2022
2022
  href?: string;
2023
+ /** Optional click handler for client-side navigation */
2024
+ onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
2025
+ /** Additional props passed to the link component (e.g., 'to' for React Router Link) */
2026
+ [key: string]: unknown;
2023
2027
  };
2024
2028
  type BreadcrumbsProps = {
2025
2029
  /** Array of breadcrumb items to display in hierarchical order */
@@ -2028,11 +2032,40 @@ type BreadcrumbsProps = {
2028
2032
  separator?: ReactNode;
2029
2033
  /** Additional CSS classes for the breadcrumb container */
2030
2034
  className?: string;
2035
+ /** Custom link component (e.g., React Router Link) for client-side navigation */
2036
+ linkComponent?: ComponentType<{
2037
+ className?: string;
2038
+ onClick?: (e: MouseEvent<HTMLAnchorElement>) => void;
2039
+ [key: string]: unknown;
2040
+ }>;
2031
2041
  };
2032
2042
  /**
2033
2043
  * Breadcrumbs - Hierarchical path display
2044
+ *
2045
+ * @example
2046
+ * // With onClick handlers
2047
+ * <Breadcrumbs
2048
+ * items={[
2049
+ * { label: 'Home', href: '/', onClick: () => navigate('/') },
2050
+ * { label: 'Products', href: '/products', onClick: () => navigate('/products') },
2051
+ * { label: 'Item' }
2052
+ * ]}
2053
+ * />
2054
+ *
2055
+ * @example
2056
+ * // With React Router Link component
2057
+ * import { Link } from 'react-router-dom';
2058
+ *
2059
+ * <Breadcrumbs
2060
+ * linkComponent={Link}
2061
+ * items={[
2062
+ * { label: 'Home', to: '/' },
2063
+ * { label: 'Products', to: '/products' },
2064
+ * { label: 'Item' }
2065
+ * ]}
2066
+ * />
2034
2067
  */
2035
- declare function Breadcrumbs({ items, separator, className }: Readonly<BreadcrumbsProps>): react_jsx_runtime.JSX.Element;
2068
+ declare function Breadcrumbs({ items, separator, className, linkComponent }: Readonly<BreadcrumbsProps>): react_jsx_runtime.JSX.Element;
2036
2069
  declare namespace Breadcrumbs {
2037
2070
  var displayName: string;
2038
2071
  }
@@ -2589,6 +2622,8 @@ type ColumnDef<T> = {
2589
2622
  chipVariant?: StatusColorProp;
2590
2623
  /** Size for badge or chip rendering */
2591
2624
  componentSize?: 'sm' | 'md' | 'lg';
2625
+ /** Fallback value to display when cell value is null, undefined, or empty string */
2626
+ fallback?: string;
2592
2627
  };
2593
2628
  type DataTableProps<T> = {
2594
2629
  /** Array of data objects to display in the table */
package/dist/index.js CHANGED
@@ -2813,15 +2813,21 @@ var PageTransition = ({
2813
2813
  };
2814
2814
  PageTransition.displayName = "PageTransition";
2815
2815
  var page_transition_default = PageTransition;
2816
- function Breadcrumbs({ items, separator = "/", className = "" }) {
2816
+ function Breadcrumbs({ items, separator = "/", className = "", linkComponent }) {
2817
+ const LinkComponent = linkComponent || "a";
2817
2818
  return /* @__PURE__ */ jsx("nav", { "aria-label": "Breadcrumb", className, children: /* @__PURE__ */ jsx("ol", { className: "flex items-center space-x-2 text-sm", children: items.map((item, index) => {
2818
2819
  const isLast = index === items.length - 1;
2819
2820
  const key = item.href || item.label;
2821
+ const { label: _label, onClick, href, ...linkProps } = item;
2822
+ const hasLinkProps = href || onClick || Object.keys(linkProps).length > 0;
2823
+ const shouldRenderLink = hasLinkProps && !isLast;
2820
2824
  return /* @__PURE__ */ jsxs("li", { className: "flex items-center", children: [
2821
- item.href && !isLast ? /* @__PURE__ */ jsx(
2822
- "a",
2825
+ shouldRenderLink ? /* @__PURE__ */ jsx(
2826
+ LinkComponent,
2823
2827
  {
2824
- href: item.href,
2828
+ ...href ? { href } : {},
2829
+ ...linkProps,
2830
+ onClick,
2825
2831
  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",
2826
2832
  children: item.label
2827
2833
  }
@@ -4181,6 +4187,10 @@ function DataTable({
4181
4187
  }
4182
4188
  };
4183
4189
  const renderCellContent = (value, column, row, rowIndex) => {
4190
+ const isEmpty = value == null || value === "";
4191
+ if (isEmpty && column.fallback !== void 0) {
4192
+ return column.fallback;
4193
+ }
4184
4194
  if (column.render) {
4185
4195
  return column.render(value, row, rowIndex);
4186
4196
  }