@particle-academy/react-fancy 5.2.0 → 5.3.0
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 +66 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +66 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1015,6 +1015,34 @@ declare const Profile: react.ForwardRefExoticComponent<ProfileProps & react.RefA
|
|
|
1015
1015
|
interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
1016
1016
|
variant?: "outlined" | "elevated" | "flat";
|
|
1017
1017
|
padding?: "none" | "sm" | "md" | "lg";
|
|
1018
|
+
/**
|
|
1019
|
+
* Card is a link or a grid tile: adds the hover lift + border/shadow
|
|
1020
|
+
* response, and clips children to the rounded corners so a `Card.Media`
|
|
1021
|
+
* sits flush.
|
|
1022
|
+
*/
|
|
1023
|
+
interactive?: boolean;
|
|
1024
|
+
}
|
|
1025
|
+
interface CardMediaProps extends HTMLAttributes<HTMLDivElement> {
|
|
1026
|
+
/** Image URL. Omit for a pure colour/gradient tile. */
|
|
1027
|
+
src?: string;
|
|
1028
|
+
alt?: string;
|
|
1029
|
+
/** CSS `aspect-ratio`. Default `"16/9"`. Ignored when `height` is set. */
|
|
1030
|
+
ratio?: string;
|
|
1031
|
+
/** Fixed height instead of an aspect ratio. */
|
|
1032
|
+
height?: number | string;
|
|
1033
|
+
/**
|
|
1034
|
+
* Shown UNDER the image — while it loads, and permanently if it never
|
|
1035
|
+
* arrives. Any CSS background value, so a gradient works.
|
|
1036
|
+
*/
|
|
1037
|
+
background?: string;
|
|
1038
|
+
/** `object-position` for the image. Default `"center"`. */
|
|
1039
|
+
objectPosition?: string;
|
|
1040
|
+
loading?: "lazy" | "eager";
|
|
1041
|
+
/** Slots pinned to the media's corners — a number chip, a status pill. */
|
|
1042
|
+
topLeft?: ReactNode;
|
|
1043
|
+
topRight?: ReactNode;
|
|
1044
|
+
bottomLeft?: ReactNode;
|
|
1045
|
+
bottomRight?: ReactNode;
|
|
1018
1046
|
}
|
|
1019
1047
|
interface CardHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
1020
1048
|
}
|
|
@@ -1024,6 +1052,7 @@ interface CardFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
1024
1052
|
}
|
|
1025
1053
|
|
|
1026
1054
|
declare const Card: react.ForwardRefExoticComponent<CardProps & react.RefAttributes<HTMLDivElement>> & {
|
|
1055
|
+
Media: react.ForwardRefExoticComponent<CardMediaProps & react.RefAttributes<HTMLDivElement>>;
|
|
1027
1056
|
Header: react.ForwardRefExoticComponent<CardHeaderProps & react.RefAttributes<HTMLDivElement>>;
|
|
1028
1057
|
Body: react.ForwardRefExoticComponent<CardBodyProps & react.RefAttributes<HTMLDivElement>>;
|
|
1029
1058
|
Footer: react.ForwardRefExoticComponent<CardFooterProps & react.RefAttributes<HTMLDivElement>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1015,6 +1015,34 @@ declare const Profile: react.ForwardRefExoticComponent<ProfileProps & react.RefA
|
|
|
1015
1015
|
interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
1016
1016
|
variant?: "outlined" | "elevated" | "flat";
|
|
1017
1017
|
padding?: "none" | "sm" | "md" | "lg";
|
|
1018
|
+
/**
|
|
1019
|
+
* Card is a link or a grid tile: adds the hover lift + border/shadow
|
|
1020
|
+
* response, and clips children to the rounded corners so a `Card.Media`
|
|
1021
|
+
* sits flush.
|
|
1022
|
+
*/
|
|
1023
|
+
interactive?: boolean;
|
|
1024
|
+
}
|
|
1025
|
+
interface CardMediaProps extends HTMLAttributes<HTMLDivElement> {
|
|
1026
|
+
/** Image URL. Omit for a pure colour/gradient tile. */
|
|
1027
|
+
src?: string;
|
|
1028
|
+
alt?: string;
|
|
1029
|
+
/** CSS `aspect-ratio`. Default `"16/9"`. Ignored when `height` is set. */
|
|
1030
|
+
ratio?: string;
|
|
1031
|
+
/** Fixed height instead of an aspect ratio. */
|
|
1032
|
+
height?: number | string;
|
|
1033
|
+
/**
|
|
1034
|
+
* Shown UNDER the image — while it loads, and permanently if it never
|
|
1035
|
+
* arrives. Any CSS background value, so a gradient works.
|
|
1036
|
+
*/
|
|
1037
|
+
background?: string;
|
|
1038
|
+
/** `object-position` for the image. Default `"center"`. */
|
|
1039
|
+
objectPosition?: string;
|
|
1040
|
+
loading?: "lazy" | "eager";
|
|
1041
|
+
/** Slots pinned to the media's corners — a number chip, a status pill. */
|
|
1042
|
+
topLeft?: ReactNode;
|
|
1043
|
+
topRight?: ReactNode;
|
|
1044
|
+
bottomLeft?: ReactNode;
|
|
1045
|
+
bottomRight?: ReactNode;
|
|
1018
1046
|
}
|
|
1019
1047
|
interface CardHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
1020
1048
|
}
|
|
@@ -1024,6 +1052,7 @@ interface CardFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
1024
1052
|
}
|
|
1025
1053
|
|
|
1026
1054
|
declare const Card: react.ForwardRefExoticComponent<CardProps & react.RefAttributes<HTMLDivElement>> & {
|
|
1055
|
+
Media: react.ForwardRefExoticComponent<CardMediaProps & react.RefAttributes<HTMLDivElement>>;
|
|
1027
1056
|
Header: react.ForwardRefExoticComponent<CardHeaderProps & react.RefAttributes<HTMLDivElement>>;
|
|
1028
1057
|
Body: react.ForwardRefExoticComponent<CardBodyProps & react.RefAttributes<HTMLDivElement>>;
|
|
1029
1058
|
Footer: react.ForwardRefExoticComponent<CardFooterProps & react.RefAttributes<HTMLDivElement>>;
|
package/dist/index.js
CHANGED
|
@@ -7040,6 +7040,66 @@ var CardFooter = forwardRef(
|
|
|
7040
7040
|
}
|
|
7041
7041
|
);
|
|
7042
7042
|
CardFooter.displayName = "CardFooter";
|
|
7043
|
+
var CardMedia = forwardRef(
|
|
7044
|
+
({
|
|
7045
|
+
src,
|
|
7046
|
+
alt = "",
|
|
7047
|
+
ratio = "16/9",
|
|
7048
|
+
height,
|
|
7049
|
+
background,
|
|
7050
|
+
objectPosition = "center",
|
|
7051
|
+
loading = "lazy",
|
|
7052
|
+
topLeft,
|
|
7053
|
+
topRight,
|
|
7054
|
+
bottomLeft,
|
|
7055
|
+
bottomRight,
|
|
7056
|
+
className,
|
|
7057
|
+
style,
|
|
7058
|
+
children,
|
|
7059
|
+
...props
|
|
7060
|
+
}, ref) => {
|
|
7061
|
+
return /* @__PURE__ */ jsxs(
|
|
7062
|
+
"div",
|
|
7063
|
+
{
|
|
7064
|
+
ref,
|
|
7065
|
+
"data-react-fancy-card-media": "",
|
|
7066
|
+
className: cn(
|
|
7067
|
+
"relative overflow-hidden rounded-t-lg",
|
|
7068
|
+
// Card's `padding` prop pads EVERY direct div child
|
|
7069
|
+
// (`[&>div]:px-4 …`), which would inset the media and break the
|
|
7070
|
+
// flush-to-the-edge look every caller wants. `!` wins regardless of
|
|
7071
|
+
// stylesheet order, which plain `p-0` would not.
|
|
7072
|
+
"!px-0 !py-0",
|
|
7073
|
+
className
|
|
7074
|
+
),
|
|
7075
|
+
style: {
|
|
7076
|
+
...height === void 0 ? { aspectRatio: ratio } : { height },
|
|
7077
|
+
...background ? { background } : null,
|
|
7078
|
+
...style
|
|
7079
|
+
},
|
|
7080
|
+
...props,
|
|
7081
|
+
children: [
|
|
7082
|
+
src ? /* @__PURE__ */ jsx(
|
|
7083
|
+
"img",
|
|
7084
|
+
{
|
|
7085
|
+
src,
|
|
7086
|
+
alt,
|
|
7087
|
+
loading,
|
|
7088
|
+
className: "absolute inset-0 h-full w-full object-cover",
|
|
7089
|
+
style: { objectPosition }
|
|
7090
|
+
}
|
|
7091
|
+
) : null,
|
|
7092
|
+
children,
|
|
7093
|
+
topLeft ? /* @__PURE__ */ jsx("span", { className: "absolute left-2 top-2 z-10", children: topLeft }) : null,
|
|
7094
|
+
topRight ? /* @__PURE__ */ jsx("span", { className: "absolute right-2 top-2 z-10", children: topRight }) : null,
|
|
7095
|
+
bottomLeft ? /* @__PURE__ */ jsx("span", { className: "absolute bottom-2 left-2 z-10", children: bottomLeft }) : null,
|
|
7096
|
+
bottomRight ? /* @__PURE__ */ jsx("span", { className: "absolute bottom-2 right-2 z-10", children: bottomRight }) : null
|
|
7097
|
+
]
|
|
7098
|
+
}
|
|
7099
|
+
);
|
|
7100
|
+
}
|
|
7101
|
+
);
|
|
7102
|
+
CardMedia.displayName = "CardMedia";
|
|
7043
7103
|
var variantClasses = {
|
|
7044
7104
|
outlined: "border border-zinc-200 dark:border-zinc-700",
|
|
7045
7105
|
elevated: "shadow-md border border-zinc-100 dark:border-zinc-800",
|
|
@@ -7055,6 +7115,7 @@ var CardRoot = forwardRef(
|
|
|
7055
7115
|
({
|
|
7056
7116
|
variant = "outlined",
|
|
7057
7117
|
padding = "md",
|
|
7118
|
+
interactive = false,
|
|
7058
7119
|
className,
|
|
7059
7120
|
children,
|
|
7060
7121
|
...props
|
|
@@ -7067,6 +7128,10 @@ var CardRoot = forwardRef(
|
|
|
7067
7128
|
className: cn(
|
|
7068
7129
|
"rounded-lg bg-white dark:bg-zinc-900",
|
|
7069
7130
|
variantClasses[variant],
|
|
7131
|
+
// `overflow-hidden` is part of `interactive` rather than always-on:
|
|
7132
|
+
// clipping unconditionally would cut off popovers and dropdowns that
|
|
7133
|
+
// legitimately overflow a static card.
|
|
7134
|
+
interactive && "overflow-hidden transition hover:-translate-y-0.5 hover:shadow-lg hover:border-zinc-300 dark:hover:border-zinc-600",
|
|
7070
7135
|
paddingClasses[padding],
|
|
7071
7136
|
className
|
|
7072
7137
|
),
|
|
@@ -7078,6 +7143,7 @@ var CardRoot = forwardRef(
|
|
|
7078
7143
|
);
|
|
7079
7144
|
CardRoot.displayName = "Card";
|
|
7080
7145
|
var Card = Object.assign(CardRoot, {
|
|
7146
|
+
Media: CardMedia,
|
|
7081
7147
|
Header: CardHeader,
|
|
7082
7148
|
Body: CardBody,
|
|
7083
7149
|
Footer: CardFooter
|