@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 CHANGED
@@ -7042,6 +7042,66 @@ var CardFooter = react.forwardRef(
7042
7042
  }
7043
7043
  );
7044
7044
  CardFooter.displayName = "CardFooter";
7045
+ var CardMedia = react.forwardRef(
7046
+ ({
7047
+ src,
7048
+ alt = "",
7049
+ ratio = "16/9",
7050
+ height,
7051
+ background,
7052
+ objectPosition = "center",
7053
+ loading = "lazy",
7054
+ topLeft,
7055
+ topRight,
7056
+ bottomLeft,
7057
+ bottomRight,
7058
+ className,
7059
+ style,
7060
+ children,
7061
+ ...props
7062
+ }, ref) => {
7063
+ return /* @__PURE__ */ jsxRuntime.jsxs(
7064
+ "div",
7065
+ {
7066
+ ref,
7067
+ "data-react-fancy-card-media": "",
7068
+ className: cn(
7069
+ "relative overflow-hidden rounded-t-lg",
7070
+ // Card's `padding` prop pads EVERY direct div child
7071
+ // (`[&>div]:px-4 …`), which would inset the media and break the
7072
+ // flush-to-the-edge look every caller wants. `!` wins regardless of
7073
+ // stylesheet order, which plain `p-0` would not.
7074
+ "!px-0 !py-0",
7075
+ className
7076
+ ),
7077
+ style: {
7078
+ ...height === void 0 ? { aspectRatio: ratio } : { height },
7079
+ ...background ? { background } : null,
7080
+ ...style
7081
+ },
7082
+ ...props,
7083
+ children: [
7084
+ src ? /* @__PURE__ */ jsxRuntime.jsx(
7085
+ "img",
7086
+ {
7087
+ src,
7088
+ alt,
7089
+ loading,
7090
+ className: "absolute inset-0 h-full w-full object-cover",
7091
+ style: { objectPosition }
7092
+ }
7093
+ ) : null,
7094
+ children,
7095
+ topLeft ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute left-2 top-2 z-10", children: topLeft }) : null,
7096
+ topRight ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute right-2 top-2 z-10", children: topRight }) : null,
7097
+ bottomLeft ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute bottom-2 left-2 z-10", children: bottomLeft }) : null,
7098
+ bottomRight ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute bottom-2 right-2 z-10", children: bottomRight }) : null
7099
+ ]
7100
+ }
7101
+ );
7102
+ }
7103
+ );
7104
+ CardMedia.displayName = "CardMedia";
7045
7105
  var variantClasses = {
7046
7106
  outlined: "border border-zinc-200 dark:border-zinc-700",
7047
7107
  elevated: "shadow-md border border-zinc-100 dark:border-zinc-800",
@@ -7057,6 +7117,7 @@ var CardRoot = react.forwardRef(
7057
7117
  ({
7058
7118
  variant = "outlined",
7059
7119
  padding = "md",
7120
+ interactive = false,
7060
7121
  className,
7061
7122
  children,
7062
7123
  ...props
@@ -7069,6 +7130,10 @@ var CardRoot = react.forwardRef(
7069
7130
  className: cn(
7070
7131
  "rounded-lg bg-white dark:bg-zinc-900",
7071
7132
  variantClasses[variant],
7133
+ // `overflow-hidden` is part of `interactive` rather than always-on:
7134
+ // clipping unconditionally would cut off popovers and dropdowns that
7135
+ // legitimately overflow a static card.
7136
+ interactive && "overflow-hidden transition hover:-translate-y-0.5 hover:shadow-lg hover:border-zinc-300 dark:hover:border-zinc-600",
7072
7137
  paddingClasses[padding],
7073
7138
  className
7074
7139
  ),
@@ -7080,6 +7145,7 @@ var CardRoot = react.forwardRef(
7080
7145
  );
7081
7146
  CardRoot.displayName = "Card";
7082
7147
  var Card = Object.assign(CardRoot, {
7148
+ Media: CardMedia,
7083
7149
  Header: CardHeader,
7084
7150
  Body: CardBody,
7085
7151
  Footer: CardFooter