@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/hooks/index.global.js +1 -25
- package/dist/hooks/index.global.js.map +1 -1
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.global.js +365 -52
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +62 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -37
- package/dist/index.mjs.map +1 -1
- package/dist/lib/theme.global.js +14 -1
- package/dist/lib/theme.global.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ui/__tests__/card-size-aschild.test.tsx +119 -0
- package/src/components/ui/__tests__/preset-color-shadowing.test.ts +71 -0
- package/src/components/ui/__tests__/semantic-token-usage.test.ts +120 -0
- package/src/components/ui/__tests__/toast.test.tsx +6 -3
- package/src/components/ui/__tests__/tooltip.test.tsx +8 -4
- package/src/components/ui/card.tsx +96 -41
- package/src/components/ui/toast.tsx +4 -4
- package/src/components/ui/tooltip.tsx +3 -3
- package/src/styles/tokens.css +43 -2
- package/tailwind-preset.js +17 -7
- package/src/use-toast.ts +0 -32
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:
|
|
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) =>
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
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) =>
|
|
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) =>
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
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-
|
|
6949
|
-
warning: "bg-
|
|
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-
|
|
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-
|
|
8334
|
-
warning: "border-
|
|
8335
|
-
info: "border-
|
|
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-
|
|
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;
|