@particle-academy/react-fancy 4.4.1 → 4.4.2

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,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, HTMLAttributes, ComponentType, CSSProperties, ReactElement, RefObject } from 'react';
2
+ import { ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, TdHTMLAttributes, HTMLAttributes, ComponentType, CSSProperties, ReactElement, RefObject } from 'react';
3
3
  import { ClassValue } from 'clsx';
4
4
 
5
5
  type Size = "xs" | "sm" | "md" | "lg" | "xl";
@@ -626,9 +626,13 @@ interface TableRowTrayProps {
626
626
  children: ReactNode;
627
627
  className?: string;
628
628
  }
629
- interface TableCellProps {
630
- children: ReactNode;
631
- className?: string;
629
+ /**
630
+ * Extends the native cell attributes so `colSpan`/`rowSpan` (full-span
631
+ * empty-state rows, trays) plus `onClick`, `style`, `scope`, `data-*`, etc. are
632
+ * forwarded onto the underlying `<td>`/`<th>` instead of silently dropped.
633
+ */
634
+ interface TableCellProps extends TdHTMLAttributes<HTMLTableCellElement> {
635
+ /** Render a `<th>` header cell instead of a `<td>`. */
632
636
  header?: boolean;
633
637
  }
634
638
  interface TableColumnProps {
@@ -656,7 +660,7 @@ declare function TableBody({ children, className }: TableBodyProps): react.JSX.E
656
660
 
657
661
  declare function TableRow({ children, className, onClick, tray, trayTriggerPosition, expanded: controlledExpanded, defaultExpanded, onExpandedChange, }: TableRowProps): react.JSX.Element;
658
662
 
659
- declare function TableCell({ children, className, header }: TableCellProps): react.JSX.Element;
663
+ declare function TableCell({ children, className, header, ...rest }: TableCellProps): react.JSX.Element;
660
664
 
661
665
  declare function TableColumn({ label, sortKey, className }: TableColumnProps): react.JSX.Element;
662
666
 
@@ -1292,7 +1296,7 @@ interface ModalContextValue {
1292
1296
  open: boolean;
1293
1297
  close: () => void;
1294
1298
  }
1295
- interface ModalProps {
1299
+ interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
1296
1300
  children: ReactNode;
1297
1301
  open: boolean;
1298
1302
  onClose: () => void;
@@ -1327,7 +1331,7 @@ declare namespace ModalFooter {
1327
1331
  var displayName: string;
1328
1332
  }
1329
1333
 
1330
- declare function ModalRoot({ children, open, onClose, size, className, }: ModalProps): react.JSX.Element | null;
1334
+ declare function ModalRoot({ children, open, onClose, size, className, ...rest }: ModalProps): react.JSX.Element | null;
1331
1335
  declare const Modal: typeof ModalRoot & {
1332
1336
  Header: typeof ModalHeader;
1333
1337
  Body: typeof ModalBody;
@@ -1455,7 +1459,7 @@ interface TabsListProps {
1455
1459
  children: ReactNode;
1456
1460
  className?: string;
1457
1461
  }
1458
- interface TabsTabProps {
1462
+ interface TabsTabProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "value"> {
1459
1463
  children: ReactNode;
1460
1464
  value: string;
1461
1465
  disabled?: boolean;
@@ -1476,7 +1480,7 @@ declare namespace TabsList {
1476
1480
  var displayName: string;
1477
1481
  }
1478
1482
 
1479
- declare function TabsTab({ children, value, disabled, className, }: TabsTabProps): react.JSX.Element;
1483
+ declare function TabsTab({ children, value, disabled, className, onClick, ...rest }: TabsTabProps): react.JSX.Element;
1480
1484
  declare namespace TabsTab {
1481
1485
  var displayName: string;
1482
1486
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, HTMLAttributes, ComponentType, CSSProperties, ReactElement, RefObject } from 'react';
2
+ import { ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, TdHTMLAttributes, HTMLAttributes, ComponentType, CSSProperties, ReactElement, RefObject } from 'react';
3
3
  import { ClassValue } from 'clsx';
4
4
 
5
5
  type Size = "xs" | "sm" | "md" | "lg" | "xl";
@@ -626,9 +626,13 @@ interface TableRowTrayProps {
626
626
  children: ReactNode;
627
627
  className?: string;
628
628
  }
629
- interface TableCellProps {
630
- children: ReactNode;
631
- className?: string;
629
+ /**
630
+ * Extends the native cell attributes so `colSpan`/`rowSpan` (full-span
631
+ * empty-state rows, trays) plus `onClick`, `style`, `scope`, `data-*`, etc. are
632
+ * forwarded onto the underlying `<td>`/`<th>` instead of silently dropped.
633
+ */
634
+ interface TableCellProps extends TdHTMLAttributes<HTMLTableCellElement> {
635
+ /** Render a `<th>` header cell instead of a `<td>`. */
632
636
  header?: boolean;
633
637
  }
634
638
  interface TableColumnProps {
@@ -656,7 +660,7 @@ declare function TableBody({ children, className }: TableBodyProps): react.JSX.E
656
660
 
657
661
  declare function TableRow({ children, className, onClick, tray, trayTriggerPosition, expanded: controlledExpanded, defaultExpanded, onExpandedChange, }: TableRowProps): react.JSX.Element;
658
662
 
659
- declare function TableCell({ children, className, header }: TableCellProps): react.JSX.Element;
663
+ declare function TableCell({ children, className, header, ...rest }: TableCellProps): react.JSX.Element;
660
664
 
661
665
  declare function TableColumn({ label, sortKey, className }: TableColumnProps): react.JSX.Element;
662
666
 
@@ -1292,7 +1296,7 @@ interface ModalContextValue {
1292
1296
  open: boolean;
1293
1297
  close: () => void;
1294
1298
  }
1295
- interface ModalProps {
1299
+ interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
1296
1300
  children: ReactNode;
1297
1301
  open: boolean;
1298
1302
  onClose: () => void;
@@ -1327,7 +1331,7 @@ declare namespace ModalFooter {
1327
1331
  var displayName: string;
1328
1332
  }
1329
1333
 
1330
- declare function ModalRoot({ children, open, onClose, size, className, }: ModalProps): react.JSX.Element | null;
1334
+ declare function ModalRoot({ children, open, onClose, size, className, ...rest }: ModalProps): react.JSX.Element | null;
1331
1335
  declare const Modal: typeof ModalRoot & {
1332
1336
  Header: typeof ModalHeader;
1333
1337
  Body: typeof ModalBody;
@@ -1455,7 +1459,7 @@ interface TabsListProps {
1455
1459
  children: ReactNode;
1456
1460
  className?: string;
1457
1461
  }
1458
- interface TabsTabProps {
1462
+ interface TabsTabProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "value"> {
1459
1463
  children: ReactNode;
1460
1464
  value: string;
1461
1465
  disabled?: boolean;
@@ -1476,7 +1480,7 @@ declare namespace TabsList {
1476
1480
  var displayName: string;
1477
1481
  }
1478
1482
 
1479
- declare function TabsTab({ children, value, disabled, className, }: TabsTabProps): react.JSX.Element;
1483
+ declare function TabsTab({ children, value, disabled, className, onClick, ...rest }: TabsTabProps): react.JSX.Element;
1480
1484
  declare namespace TabsTab {
1481
1485
  var displayName: string;
1482
1486
  }
package/dist/index.js CHANGED
@@ -5503,7 +5503,7 @@ function TableRow({
5503
5503
  hasTray && expanded && /* @__PURE__ */ jsx("tr", { className: "bg-zinc-50/50 dark:bg-zinc-800/30", children: /* @__PURE__ */ jsx("td", { colSpan: 999, children: tray }) })
5504
5504
  ] });
5505
5505
  }
5506
- function TableCell({ children, className, header }) {
5506
+ function TableCell({ children, className, header, ...rest }) {
5507
5507
  const Tag = header ? "th" : "td";
5508
5508
  return /* @__PURE__ */ jsx(
5509
5509
  Tag,
@@ -5514,6 +5514,7 @@ function TableCell({ children, className, header }) {
5514
5514
  header && "text-left font-medium text-zinc-500 dark:text-zinc-400",
5515
5515
  className
5516
5516
  ),
5517
+ ...rest,
5517
5518
  children
5518
5519
  }
5519
5520
  );
@@ -7909,7 +7910,8 @@ function ModalRoot({
7909
7910
  open,
7910
7911
  onClose,
7911
7912
  size = "md",
7912
- className
7913
+ className,
7914
+ ...rest
7913
7915
  }) {
7914
7916
  const panelRef = useRef(null);
7915
7917
  const close = useCallback(() => onClose(), [onClose]);
@@ -7950,6 +7952,7 @@ function ModalRoot({
7950
7952
  "data-react-fancy-modal": "",
7951
7953
  role: "dialog",
7952
7954
  "aria-modal": "true",
7955
+ ...rest,
7953
7956
  className: cn(
7954
7957
  "relative flex w-full flex-col overflow-hidden rounded-2xl border border-zinc-200 bg-white shadow-xl dark:border-zinc-700 dark:bg-zinc-900",
7955
7958
  SIZE_MAP[size],
@@ -8317,7 +8320,9 @@ function TabsTab({
8317
8320
  children,
8318
8321
  value,
8319
8322
  disabled = false,
8320
- className
8323
+ className,
8324
+ onClick,
8325
+ ...rest
8321
8326
  }) {
8322
8327
  const { activeTab, setActiveTab, variant } = useTabs();
8323
8328
  const isActive = activeTab === value;
@@ -8330,7 +8335,11 @@ function TabsTab({
8330
8335
  disabled,
8331
8336
  "aria-selected": isActive,
8332
8337
  tabIndex: isActive ? 0 : -1,
8333
- onClick: () => !disabled && setActiveTab(value),
8338
+ onClick: (e) => {
8339
+ if (!disabled) setActiveTab(value);
8340
+ onClick?.(e);
8341
+ },
8342
+ ...rest,
8334
8343
  className: cn(
8335
8344
  "text-sm font-medium transition-colors",
8336
8345
  disabled && "cursor-not-allowed opacity-50",