najm-kit 2.1.51 → 2.1.52

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.ts CHANGED
@@ -1647,7 +1647,7 @@ type NStatCardProps = DefaultProps | UsageProps | CompactProps;
1647
1647
  declare function NStatCard(props: NStatCardProps): react_jsx_runtime.JSX.Element;
1648
1648
 
1649
1649
  type NDonutCardVariant = "compact" | "default";
1650
- type NDonutCardLayout = "vertical" | "horizontal";
1650
+ type NDonutCardLayout = "auto" | "vertical" | "horizontal";
1651
1651
  type NDonutCardLegendMarker = "dot" | "icon" | "none";
1652
1652
  type NDonutCardCenterOrientation = "column" | "row";
1653
1653
  interface NDonutCardItem {
@@ -1684,6 +1684,7 @@ interface NDonutCardProps {
1684
1684
  emptyLabel?: React__default.ReactNode;
1685
1685
  footer?: React__default.ReactNode;
1686
1686
  variant?: NDonutCardVariant;
1687
+ /** `"auto"` keeps the donut and legend side by side and lets the space between them grow. */
1687
1688
  layout?: NDonutCardLayout;
1688
1689
  legendMarker?: NDonutCardLegendMarker;
1689
1690
  centerOrientation?: NDonutCardCenterOrientation;
package/dist/index.mjs CHANGED
@@ -7685,7 +7685,7 @@ function NCard({
7685
7685
  CardContent,
7686
7686
  {
7687
7687
  className: cn(
7688
- "m-0 flex min-w-0 flex-col gap-2 p-0",
7688
+ "m-0 flex min-w-0 flex-1 flex-col gap-2 p-0",
7689
7689
  sideBody && "col-start-2",
7690
7690
  headerBody && "col-span-full",
7691
7691
  responsiveAvatarBody && "col-start-2 sm:col-span-full",
@@ -8233,7 +8233,7 @@ function NDonutCard({
8233
8233
  emptyLabel,
8234
8234
  footer,
8235
8235
  variant = "default",
8236
- layout = "vertical",
8236
+ layout = "auto",
8237
8237
  legendMarker = "dot",
8238
8238
  centerOrientation = "column",
8239
8239
  percentageFormatter,
@@ -8261,6 +8261,7 @@ function NDonutCard({
8261
8261
  const isTitleString = typeof title === "string";
8262
8262
  const accessibleLabel = isTitleString ? title : ariaLabel;
8263
8263
  const isCompact = variant === "compact";
8264
+ const isAuto = layout === "auto";
8264
8265
  const isHorizontal = layout === "horizontal";
8265
8266
  const isCenterRow = centerOrientation === "row";
8266
8267
  const ringStyle = {
@@ -8291,7 +8292,7 @@ function NDonutCard({
8291
8292
  role: "group",
8292
8293
  "aria-label": accessibleLabel,
8293
8294
  className: cn(
8294
- isHorizontal ? "grid grid-cols-[auto_minmax(0,1fr)] items-center gap-5 p-2 lg:p-3 2xl:p-4" : cn(
8295
+ isAuto ? "flex w-full items-center gap-4 p-2 sm:p-3 lg:p-4" : isHorizontal ? "grid grid-cols-[auto_minmax(0,1fr)] items-center gap-5 p-2 lg:p-3 2xl:p-4" : cn(
8295
8296
  "flex flex-col items-center p-2 lg:p-3 2xl:p-4",
8296
8297
  isCompact ? "gap-2" : "gap-4"
8297
8298
  ),
@@ -8301,7 +8302,10 @@ function NDonutCard({
8301
8302
  /* @__PURE__ */ jsxs(
8302
8303
  "div",
8303
8304
  {
8304
- className: cn("flex flex-col items-center gap-2", isHorizontal && "shrink-0"),
8305
+ className: cn(
8306
+ "flex flex-col items-center gap-2",
8307
+ (isHorizontal || isAuto) && "shrink-0"
8308
+ ),
8305
8309
  children: [
8306
8310
  /* @__PURE__ */ jsxs(
8307
8311
  "div",
@@ -8391,9 +8395,11 @@ function NDonutCard({
8391
8395
  {
8392
8396
  "data-slot": "donut-legend",
8393
8397
  className: cn(
8394
- "flex flex-col gap-1.5 w-full",
8395
- isCompact && "gap-1",
8396
- isHorizontal && "min-w-0 flex-1 gap-2 pt-0.5",
8398
+ isAuto ? "ms-auto shrink-0 space-y-3" : cn(
8399
+ "flex flex-col gap-1.5 w-full",
8400
+ isCompact && "gap-1",
8401
+ isHorizontal && "min-w-0 flex-1 gap-2 pt-0.5"
8402
+ ),
8397
8403
  classNames?.legend
8398
8404
  ),
8399
8405
  children: normalized.map((item) => /* @__PURE__ */ jsx(
@@ -8401,7 +8407,44 @@ function NDonutCard({
8401
8407
  {
8402
8408
  "data-slot": "donut-legend-item",
8403
8409
  className: cn(classNames?.legendItem),
8404
- children: isHorizontal ? /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
8410
+ children: isAuto ? /* @__PURE__ */ jsxs(Fragment, { children: [
8411
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
8412
+ /* @__PURE__ */ jsx(
8413
+ LegendMarker,
8414
+ {
8415
+ className: cn(classNames?.legendMarker),
8416
+ color: item.color,
8417
+ icon: item.icon,
8418
+ mode: legendMarker
8419
+ }
8420
+ ),
8421
+ /* @__PURE__ */ jsx(
8422
+ "span",
8423
+ {
8424
+ className: cn(
8425
+ "min-w-0 flex-1 truncate text-muted-foreground",
8426
+ isCompact ? "text-[11px]" : "text-xs sm:text-sm",
8427
+ classNames?.legendLabel
8428
+ ),
8429
+ children: item.label
8430
+ }
8431
+ )
8432
+ ] }),
8433
+ /* @__PURE__ */ jsxs(
8434
+ "span",
8435
+ {
8436
+ className: cn(
8437
+ "ms-4 block whitespace-nowrap tabular-nums text-foreground font-semibold",
8438
+ isCompact ? "text-[11px]" : "text-xs sm:text-sm",
8439
+ classNames?.legendValue
8440
+ ),
8441
+ children: [
8442
+ valueFormatter(item.value),
8443
+ percentageFormatter ? /* @__PURE__ */ jsx("span", { className: "ml-1 text-[11px] font-normal text-muted-foreground sm:ml-0.5", children: percentageFormatter(item.ratio) }) : null
8444
+ ]
8445
+ }
8446
+ )
8447
+ ] }) : isHorizontal ? /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
8405
8448
  /* @__PURE__ */ jsx(
8406
8449
  LegendMarker,
8407
8450
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "najm-kit",
3
- "version": "2.1.51",
3
+ "version": "2.1.52",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Reusable React UI component package for Najm framework",