@financinha/ui 0.11.0 → 0.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.cjs CHANGED
@@ -3495,7 +3495,7 @@ function MetricCard({
3495
3495
  }
3496
3496
 
3497
3497
  // src/components/patterns/insight-card.tsx
3498
- var React37 = require("react");
3498
+ var React37 = __toESM(require("react"), 1);
3499
3499
  var import_cn37 = require("cn");
3500
3500
  var import_lucide_react13 = require("lucide-react");
3501
3501
  var import_jsx_runtime36 = require("react/jsx-runtime");
@@ -3509,13 +3509,33 @@ var TITLE_TONE = {
3509
3509
  warning: "text-warning-500 dark:text-warning-300",
3510
3510
  tip: "text-primary-500 dark:text-primary-300"
3511
3511
  };
3512
- function InsightCard({ title, meta, action, divider = false, className, children, ...props }) {
3512
+ var InsightCardContext = React37.createContext({ size: "default", divided: true });
3513
+ function InsightCard({
3514
+ title,
3515
+ meta,
3516
+ metaPosition = "inline",
3517
+ action,
3518
+ divider = false,
3519
+ divided = true,
3520
+ size = "default",
3521
+ className,
3522
+ children,
3523
+ ...props
3524
+ }) {
3525
+ const sm = size === "sm";
3526
+ const metaNoFim = meta != null && metaPosition === "end";
3527
+ const contexto = React37.useMemo(() => ({ size, divided }), [size, divided]);
3513
3528
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
3514
3529
  Card,
3515
3530
  {
3516
3531
  "data-slot": "insight-card",
3532
+ "data-size": size,
3517
3533
  padding: "compact",
3518
- className: (0, import_cn37.cn)("gap-3 border-primary-200 bg-primary-50 dark:border-primary-700 dark:bg-primary-800/40", className),
3534
+ className: (0, import_cn37.cn)(
3535
+ "border-primary-200 bg-primary-50 dark:border-primary-700 dark:bg-primary-800/40",
3536
+ sm ? "gap-4" : "gap-3",
3537
+ className
3538
+ ),
3519
3539
  ...props,
3520
3540
  children: [
3521
3541
  /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
@@ -3523,19 +3543,24 @@ function InsightCard({ title, meta, action, divider = false, className, children
3523
3543
  {
3524
3544
  "data-slot": "insight-card-header",
3525
3545
  className: (0, import_cn37.cn)(
3526
- "flex items-center gap-2 px-(--card-spacing)",
3546
+ "flex gap-2 px-(--card-spacing)",
3547
+ // sm: 24 px de altura (a do botão icon-xs), alinhado ao topo, como o cabeçalho do Card compacto.
3548
+ sm ? "min-h-6 items-start" : "items-center",
3527
3549
  divider && "border-b border-inherit pb-(--card-spacing)"
3528
3550
  ),
3529
3551
  children: [
3530
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react13.SparklesIcon, { "aria-hidden": true, className: "size-5 shrink-0 text-primary-500 dark:text-primary-300" }),
3531
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("p", { className: "text-base font-semibold text-foreground", children: [
3552
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { "aria-hidden": true, className: (0, import_cn37.cn)("flex shrink-0 items-center", sm && "h-6"), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react13.SparklesIcon, { className: "size-5 text-primary-500 dark:text-primary-300" }) }),
3553
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("p", { className: (0, import_cn37.cn)("min-w-0 font-semibold text-foreground", sm ? "text-sm leading-6" : "text-base"), children: [
3532
3554
  title,
3533
- meta ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "font-normal text-muted-foreground", children: [
3555
+ meta != null && !metaNoFim ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "font-normal text-muted-foreground", children: [
3534
3556
  " \xB7 ",
3535
3557
  meta
3536
3558
  ] }) : null
3537
3559
  ] }),
3538
- action ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "ml-auto", children: action }) : null
3560
+ metaNoFim || action ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: [
3561
+ metaNoFim ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { "data-slot": "insight-card-meta", className: "text-sm leading-6 text-muted-foreground", children: meta }) : null,
3562
+ action
3563
+ ] }) : null
3539
3564
  ]
3540
3565
  }
3541
3566
  ),
@@ -3544,7 +3569,7 @@ function InsightCard({ title, meta, action, divider = false, className, children
3544
3569
  {
3545
3570
  "data-slot": "insight-card-content",
3546
3571
  className: "flex flex-col gap-3 px-(--card-spacing) text-sm leading-relaxed text-neutral-600 dark:text-neutral-300",
3547
- children
3572
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(InsightCardContext.Provider, { value: contexto, children })
3548
3573
  }
3549
3574
  )
3550
3575
  ]
@@ -3552,12 +3577,16 @@ function InsightCard({ title, meta, action, divider = false, className, children
3552
3577
  );
3553
3578
  }
3554
3579
  function InsightItem({ tone = "tip", icon, title, className, children, ...props }) {
3580
+ const { size, divided } = React37.useContext(InsightCardContext);
3581
+ const sm = size === "sm";
3555
3582
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
3556
3583
  "div",
3557
3584
  {
3558
3585
  "data-slot": "insight-item",
3559
3586
  className: (0, import_cn37.cn)(
3560
- "flex gap-3 border-b border-primary-200 pb-3 last:border-0 last:pb-0 dark:border-primary-700",
3587
+ "flex",
3588
+ sm ? "gap-2" : "gap-3",
3589
+ divided && "border-b border-primary-200 pb-3 last:border-0 last:pb-0 dark:border-primary-700",
3561
3590
  className
3562
3591
  ),
3563
3592
  ...props,
@@ -3566,12 +3595,16 @@ function InsightItem({ tone = "tip", icon, title, className, children, ...props
3566
3595
  "span",
3567
3596
  {
3568
3597
  "aria-hidden": true,
3569
- className: (0, import_cn37.cn)("flex size-10 shrink-0 items-center justify-center rounded-lg [&>svg]:size-5", ICON_TONE2[tone]),
3598
+ className: (0, import_cn37.cn)(
3599
+ "flex shrink-0 items-center justify-center",
3600
+ sm ? "size-8 rounded-md [&>svg]:size-4" : "size-10 rounded-lg [&>svg]:size-5",
3601
+ ICON_TONE2[tone]
3602
+ ),
3570
3603
  children: icon
3571
3604
  }
3572
3605
  ) : null,
3573
3606
  /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-1", children: [
3574
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: (0, import_cn37.cn)("text-base font-semibold", TITLE_TONE[tone]), children: title }),
3607
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: (0, import_cn37.cn)("font-semibold", sm ? "text-sm" : "text-base", TITLE_TONE[tone]), children: title }),
3575
3608
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children })
3576
3609
  ] })
3577
3610
  ]