@moontra/moonui 6.10.0 → 6.12.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.js CHANGED
@@ -1135,42 +1135,54 @@ var cardVariants = classVarianceAuthority.cva(
1135
1135
  }
1136
1136
  }
1137
1137
  );
1138
+ var CARD_SECTION_PADDING = {
1139
+ sm: "p-4",
1140
+ md: "p-6",
1141
+ lg: "p-8",
1142
+ xl: "p-10"
1143
+ };
1144
+ var CardSizeContext = React12__namespace.createContext("md");
1145
+ var resolveCardSize = (size) => size && size !== "default" ? size : "md";
1138
1146
  var Card = React12__namespace.forwardRef(
1139
- ({ className, variant, size, radius, interactive, microInteraction = "lift", ...props }, ref) => {
1147
+ ({ className, variant, size, radius, interactive, asChild = false, microInteraction = "lift", ...props }, ref) => {
1148
+ const resolvedSize = resolveCardSize(size);
1149
+ const rootClassName = cn(
1150
+ "moonui-theme",
1151
+ cardVariants({ variant, size, radius, interactive, className })
1152
+ );
1153
+ if (asChild) {
1154
+ return /* @__PURE__ */ jsxRuntime.jsx(CardSizeContext.Provider, { value: resolvedSize, children: /* @__PURE__ */ jsxRuntime.jsx(reactSlot.Slot, { ref, className: rootClassName, ...props }) });
1155
+ }
1140
1156
  if (interactive && microInteraction !== "none") {
1141
1157
  const interactionProps = {
1142
1158
  whileHover: microInteraction === "scale" ? hoverAnimations.scale : microInteraction === "glow" ? hoverAnimations.glow : hoverAnimations.lift,
1143
1159
  whileTap: tapAnimations.scale
1144
1160
  };
1145
- return /* @__PURE__ */ jsxRuntime.jsx(
1161
+ return /* @__PURE__ */ jsxRuntime.jsx(CardSizeContext.Provider, { value: resolvedSize, children: /* @__PURE__ */ jsxRuntime.jsx(
1146
1162
  framerMotion.motion.div,
1147
1163
  {
1148
1164
  ref,
1149
- className: cn("moonui-theme", cardVariants({ variant, size, radius, interactive, className })),
1165
+ className: rootClassName,
1150
1166
  ...interactionProps,
1151
1167
  ...props
1152
1168
  }
1153
- );
1169
+ ) });
1154
1170
  }
1155
- return /* @__PURE__ */ jsxRuntime.jsx(
1156
- "div",
1157
- {
1158
- ref,
1159
- className: cn("moonui-theme", cardVariants({ variant, size, radius, interactive, className })),
1160
- ...props
1161
- }
1162
- );
1171
+ return /* @__PURE__ */ jsxRuntime.jsx(CardSizeContext.Provider, { value: resolvedSize, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: rootClassName, ...props }) });
1163
1172
  }
1164
1173
  );
1165
1174
  Card.displayName = "Card";
1166
- var CardHeader = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1167
- "div",
1168
- {
1169
- ref,
1170
- className: cn("moonui-theme", "flex flex-col space-y-1.5 p-6", className),
1171
- ...props
1172
- }
1173
- ));
1175
+ var CardHeader = React12__namespace.forwardRef(({ className, ...props }, ref) => {
1176
+ const padding = CARD_SECTION_PADDING[React12__namespace.useContext(CardSizeContext)];
1177
+ return /* @__PURE__ */ jsxRuntime.jsx(
1178
+ "div",
1179
+ {
1180
+ ref,
1181
+ className: cn("moonui-theme", "flex flex-col space-y-1.5", padding, className),
1182
+ ...props
1183
+ }
1184
+ );
1185
+ });
1174
1186
  CardHeader.displayName = "CardHeader";
1175
1187
  var CardTitle = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1176
1188
  "h3",
@@ -1190,16 +1202,29 @@ var CardDescription = React12__namespace.forwardRef(({ className, ...props }, re
1190
1202
  }
1191
1203
  ));
1192
1204
  CardDescription.displayName = "CardDescription";
1193
- var CardContent = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("moonui-theme", "p-6 pt-0", className), ...props }));
1205
+ var CardContent = React12__namespace.forwardRef(({ className, ...props }, ref) => {
1206
+ const padding = CARD_SECTION_PADDING[React12__namespace.useContext(CardSizeContext)];
1207
+ return /* @__PURE__ */ jsxRuntime.jsx(
1208
+ "div",
1209
+ {
1210
+ ref,
1211
+ className: cn("moonui-theme", padding, "pt-0", className),
1212
+ ...props
1213
+ }
1214
+ );
1215
+ });
1194
1216
  CardContent.displayName = "CardContent";
1195
- var CardFooter = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1196
- "div",
1197
- {
1198
- ref,
1199
- className: cn("moonui-theme", "flex items-center p-6 pt-0", className),
1200
- ...props
1201
- }
1202
- ));
1217
+ var CardFooter = React12__namespace.forwardRef(({ className, ...props }, ref) => {
1218
+ const padding = CARD_SECTION_PADDING[React12__namespace.useContext(CardSizeContext)];
1219
+ return /* @__PURE__ */ jsxRuntime.jsx(
1220
+ "div",
1221
+ {
1222
+ ref,
1223
+ className: cn("moonui-theme", "flex items-center", padding, "pt-0", className),
1224
+ ...props
1225
+ }
1226
+ );
1227
+ });
1203
1228
  CardFooter.displayName = "CardFooter";
1204
1229
  function Calendar({
1205
1230
  mode = "single",
@@ -6945,10 +6970,10 @@ var tooltipVariants = classVarianceAuthority.cva(
6945
6970
  variant: {
6946
6971
  default: "bg-primary text-primary-foreground",
6947
6972
  secondary: "bg-secondary text-secondary-foreground",
6948
- success: "bg-green-500 text-white border-green-600",
6949
- warning: "bg-yellow-500 text-white border-yellow-600",
6973
+ success: "bg-success text-success-foreground border-success",
6974
+ warning: "bg-warning text-warning-foreground border-warning",
6950
6975
  destructive: "bg-destructive text-destructive-foreground",
6951
- info: "bg-blue-500 text-white border-blue-600"
6976
+ info: "bg-info text-info-foreground border-info"
6952
6977
  },
6953
6978
  size: {
6954
6979
  sm: "px-2 py-1 text-xs",
@@ -8330,9 +8355,9 @@ var toastVariants = classVarianceAuthority.cva(
8330
8355
  variant: {
8331
8356
  default: "border bg-background text-foreground",
8332
8357
  destructive: "destructive group border-destructive bg-destructive text-destructive-foreground",
8333
- success: "border-green-200 bg-green-50 text-green-900 dark:border-green-800 dark:bg-green-900/20 dark:text-green-100",
8334
- warning: "border-orange-200 bg-orange-50 text-orange-900 dark:border-orange-800 dark:bg-orange-900/20 dark:text-orange-100",
8335
- info: "border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-900/20 dark:text-blue-100"
8358
+ success: "border-success-subtle-foreground/20 bg-success-subtle text-success-subtle-foreground",
8359
+ warning: "border-warning-subtle-foreground/20 bg-warning-subtle text-warning-subtle-foreground",
8360
+ info: "border-info-subtle-foreground/20 bg-info-subtle text-info-subtle-foreground"
8336
8361
  }
8337
8362
  },
8338
8363
  defaultVariants: {
@@ -8368,7 +8393,7 @@ var ToastClose = React12__namespace.forwardRef(({ className, ...props }, ref) =>
8368
8393
  {
8369
8394
  ref,
8370
8395
  className: cn(
8371
- "absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
8396
+ "absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-destructive-foreground/70 group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive-foreground/40 group-[.destructive]:focus:ring-offset-destructive",
8372
8397
  className
8373
8398
  ),
8374
8399
  "toast-close": "",
@@ -9326,6 +9351,7 @@ exports.badgeVariants = badgeVariants;
9326
9351
  exports.breadcrumbVariants = breadcrumbVariants;
9327
9352
  exports.buttonGroupVariants = buttonGroupVariants;
9328
9353
  exports.buttonVariants = buttonVariants;
9354
+ exports.cardVariants = cardVariants;
9329
9355
  exports.carouselContentVariants = carouselContentVariants;
9330
9356
  exports.carouselItemVariants = carouselItemVariants;
9331
9357
  exports.cn = cn;