@particle-academy/react-fancy 4.4.1 → 4.4.3
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/README.md +2 -0
- package/dist/index.cjs +26 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -9
- package/dist/index.d.ts +13 -9
- package/dist/index.js +26 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
-
|
|
630
|
-
|
|
631
|
-
|
|
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
|
-
|
|
630
|
-
|
|
631
|
-
|
|
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
|
@@ -2954,18 +2954,18 @@ function Field({
|
|
|
2954
2954
|
] });
|
|
2955
2955
|
}
|
|
2956
2956
|
var insidePaddingLeft = {
|
|
2957
|
-
xs: "pl-7",
|
|
2958
|
-
sm: "pl-8",
|
|
2959
|
-
md: "pl-9",
|
|
2960
|
-
lg: "pl-10",
|
|
2961
|
-
xl: "pl-11"
|
|
2957
|
+
xs: "[&_input]:pl-7 [&_select]:pl-7 [&_textarea]:pl-7",
|
|
2958
|
+
sm: "[&_input]:pl-8 [&_select]:pl-8 [&_textarea]:pl-8",
|
|
2959
|
+
md: "[&_input]:pl-9 [&_select]:pl-9 [&_textarea]:pl-9",
|
|
2960
|
+
lg: "[&_input]:pl-10 [&_select]:pl-10 [&_textarea]:pl-10",
|
|
2961
|
+
xl: "[&_input]:pl-11 [&_select]:pl-11 [&_textarea]:pl-11"
|
|
2962
2962
|
};
|
|
2963
2963
|
var insidePaddingRight = {
|
|
2964
|
-
xs: "pr-7",
|
|
2965
|
-
sm: "pr-8",
|
|
2966
|
-
md: "pr-9",
|
|
2967
|
-
lg: "pr-10",
|
|
2968
|
-
xl: "pr-11"
|
|
2964
|
+
xs: "[&_input]:pr-7 [&_select]:pr-7 [&_textarea]:pr-7",
|
|
2965
|
+
sm: "[&_input]:pr-8 [&_select]:pr-8 [&_textarea]:pr-8",
|
|
2966
|
+
md: "[&_input]:pr-9 [&_select]:pr-9 [&_textarea]:pr-9",
|
|
2967
|
+
lg: "[&_input]:pr-10 [&_select]:pr-10 [&_textarea]:pr-10",
|
|
2968
|
+
xl: "[&_input]:pr-11 [&_select]:pr-11 [&_textarea]:pr-11"
|
|
2969
2969
|
};
|
|
2970
2970
|
var affixOutsideClasses = "inline-flex items-center border border-zinc-300 bg-zinc-50 px-3 text-sm text-zinc-500 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-400";
|
|
2971
2971
|
function InputWrapper({
|
|
@@ -3004,7 +3004,7 @@ function InputWrapper({
|
|
|
3004
3004
|
hasOutsidePrefix && !hasOutsideSuffix && "[&_input]:rounded-l-none [&_select]:rounded-l-none [&_textarea]:rounded-l-none",
|
|
3005
3005
|
!hasOutsidePrefix && hasOutsideSuffix && "[&_input]:rounded-r-none [&_select]:rounded-r-none [&_textarea]:rounded-r-none",
|
|
3006
3006
|
hasOutsidePrefix && hasOutsideSuffix && "[&_input]:rounded-none [&_select]:rounded-none [&_textarea]:rounded-none",
|
|
3007
|
-
hasInsidePrefix &&
|
|
3007
|
+
hasInsidePrefix && insidePaddingLeft[size]
|
|
3008
3008
|
),
|
|
3009
3009
|
children
|
|
3010
3010
|
}
|
|
@@ -3023,8 +3023,8 @@ function InputWrapper({
|
|
|
3023
3023
|
{
|
|
3024
3024
|
className: cn(
|
|
3025
3025
|
"w-full",
|
|
3026
|
-
hasInsidePrefix &&
|
|
3027
|
-
hasInsideSuffix &&
|
|
3026
|
+
hasInsidePrefix && insidePaddingLeft[size],
|
|
3027
|
+
hasInsideSuffix && insidePaddingRight[size]
|
|
3028
3028
|
),
|
|
3029
3029
|
children
|
|
3030
3030
|
}
|
|
@@ -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: () =>
|
|
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",
|