@financinha/ui 0.11.0 → 0.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.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,31 @@ 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
+ action,
3517
+ divider = false,
3518
+ divided = true,
3519
+ size = "default",
3520
+ className,
3521
+ children,
3522
+ ...props
3523
+ }) {
3524
+ const sm = size === "sm";
3525
+ const contexto = React37.useMemo(() => ({ size, divided }), [size, divided]);
3513
3526
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
3514
3527
  Card,
3515
3528
  {
3516
3529
  "data-slot": "insight-card",
3530
+ "data-size": size,
3517
3531
  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),
3532
+ className: (0, import_cn37.cn)(
3533
+ "border-primary-200 bg-primary-50 dark:border-primary-700 dark:bg-primary-800/40",
3534
+ sm ? "gap-4" : "gap-3",
3535
+ className
3536
+ ),
3519
3537
  ...props,
3520
3538
  children: [
3521
3539
  /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
@@ -3523,12 +3541,14 @@ function InsightCard({ title, meta, action, divider = false, className, children
3523
3541
  {
3524
3542
  "data-slot": "insight-card-header",
3525
3543
  className: (0, import_cn37.cn)(
3526
- "flex items-center gap-2 px-(--card-spacing)",
3544
+ "flex gap-2 px-(--card-spacing)",
3545
+ // sm: 24 px de altura (a do botão icon-xs), alinhado ao topo, como o cabeçalho do Card compacto.
3546
+ sm ? "min-h-6 items-start" : "items-center",
3527
3547
  divider && "border-b border-inherit pb-(--card-spacing)"
3528
3548
  ),
3529
3549
  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: [
3550
+ /* @__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" }) }),
3551
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("p", { className: (0, import_cn37.cn)("font-semibold text-foreground", sm ? "text-sm leading-6" : "text-base"), children: [
3532
3552
  title,
3533
3553
  meta ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "font-normal text-muted-foreground", children: [
3534
3554
  " \xB7 ",
@@ -3544,7 +3564,7 @@ function InsightCard({ title, meta, action, divider = false, className, children
3544
3564
  {
3545
3565
  "data-slot": "insight-card-content",
3546
3566
  className: "flex flex-col gap-3 px-(--card-spacing) text-sm leading-relaxed text-neutral-600 dark:text-neutral-300",
3547
- children
3567
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(InsightCardContext.Provider, { value: contexto, children })
3548
3568
  }
3549
3569
  )
3550
3570
  ]
@@ -3552,12 +3572,16 @@ function InsightCard({ title, meta, action, divider = false, className, children
3552
3572
  );
3553
3573
  }
3554
3574
  function InsightItem({ tone = "tip", icon, title, className, children, ...props }) {
3575
+ const { size, divided } = React37.useContext(InsightCardContext);
3576
+ const sm = size === "sm";
3555
3577
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
3556
3578
  "div",
3557
3579
  {
3558
3580
  "data-slot": "insight-item",
3559
3581
  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",
3582
+ "flex",
3583
+ sm ? "gap-2" : "gap-3",
3584
+ divided && "border-b border-primary-200 pb-3 last:border-0 last:pb-0 dark:border-primary-700",
3561
3585
  className
3562
3586
  ),
3563
3587
  ...props,
@@ -3566,12 +3590,16 @@ function InsightItem({ tone = "tip", icon, title, className, children, ...props
3566
3590
  "span",
3567
3591
  {
3568
3592
  "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]),
3593
+ className: (0, import_cn37.cn)(
3594
+ "flex shrink-0 items-center justify-center",
3595
+ sm ? "size-8 rounded-md [&>svg]:size-4" : "size-10 rounded-lg [&>svg]:size-5",
3596
+ ICON_TONE2[tone]
3597
+ ),
3570
3598
  children: icon
3571
3599
  }
3572
3600
  ) : null,
3573
3601
  /* @__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 }),
3602
+ /* @__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
3603
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children })
3576
3604
  ] })
3577
3605
  ]