@moontra/moonui 6.11.0 → 6.13.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.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.global.js +16 -16
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +58 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -30
- 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__/progress-accessible-name.test.tsx +65 -0
- package/src/components/ui/card.tsx +96 -41
- package/src/components/ui/progress.tsx +14 -0
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",
|
|
@@ -4899,6 +4924,7 @@ var Progress = React12__namespace.forwardRef(({
|
|
|
4899
4924
|
const normalizedValue = Math.max(0, Math.min(value, max));
|
|
4900
4925
|
const percentage = max > 0 ? normalizedValue / max * 100 : 0;
|
|
4901
4926
|
const label = valueLabel || `${Math.round(percentage)}%`;
|
|
4927
|
+
const hasExplicitName = props["aria-label"] != null || props["aria-labelledby"] != null;
|
|
4902
4928
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4903
4929
|
showValueLabel && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-between items-center mb-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4904
4930
|
"span",
|
|
@@ -4919,6 +4945,8 @@ var Progress = React12__namespace.forwardRef(({
|
|
|
4919
4945
|
"aria-valuemin": 0,
|
|
4920
4946
|
"aria-valuemax": max,
|
|
4921
4947
|
"aria-valuenow": indeterminate ? void 0 : normalizedValue,
|
|
4948
|
+
"aria-label": hasExplicitName ? void 0 : "Progress",
|
|
4949
|
+
"aria-valuetext": valueLabel,
|
|
4922
4950
|
...props,
|
|
4923
4951
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4924
4952
|
"div",
|
|
@@ -9326,6 +9354,7 @@ exports.badgeVariants = badgeVariants;
|
|
|
9326
9354
|
exports.breadcrumbVariants = breadcrumbVariants;
|
|
9327
9355
|
exports.buttonGroupVariants = buttonGroupVariants;
|
|
9328
9356
|
exports.buttonVariants = buttonVariants;
|
|
9357
|
+
exports.cardVariants = cardVariants;
|
|
9329
9358
|
exports.carouselContentVariants = carouselContentVariants;
|
|
9330
9359
|
exports.carouselItemVariants = carouselItemVariants;
|
|
9331
9360
|
exports.cn = cn;
|