@snksergio/design-system 0.43.3 → 0.45.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.
Files changed (56) hide show
  1. package/dist-lib/chunks/app-shell-mocks-kWIVSzLs.mjs.map +1 -1
  2. package/dist-lib/chunks/app-shell-mocks-oO_IV3Gw.cjs.map +1 -1
  3. package/dist-lib/chunks/avatar-DFWEwBKu.mjs.map +1 -1
  4. package/dist-lib/chunks/avatar-eM5txRFZ.cjs.map +1 -1
  5. package/dist-lib/chunks/chat-v2-mocks-BV9Wha_Z.cjs.map +1 -1
  6. package/dist-lib/chunks/chat-v2-mocks-DvZRkhmz.mjs.map +1 -1
  7. package/dist-lib/chunks/page-header--cPS_Z-a.mjs.map +1 -1
  8. package/dist-lib/chunks/page-header-DvAJoEfb.cjs.map +1 -1
  9. package/dist-lib/chunks/{panel-CvfP8eP1.cjs → panel-4aMDou7z.cjs} +17 -6
  10. package/dist-lib/chunks/panel-4aMDou7z.cjs.map +1 -0
  11. package/dist-lib/chunks/{panel-CCPe1H70.mjs → panel-DtQi10ps.mjs} +17 -6
  12. package/dist-lib/chunks/panel-DtQi10ps.mjs.map +1 -0
  13. package/dist-lib/chunks/sheet-D1vQth7X.mjs.map +1 -1
  14. package/dist-lib/chunks/sheet-j-d_UX7R.cjs.map +1 -1
  15. package/dist-lib/chunks/{toggle-group-BEPs3e0Y.cjs → toggle-group-BC4eS3Gt.cjs} +85 -26
  16. package/dist-lib/chunks/toggle-group-BC4eS3Gt.cjs.map +1 -0
  17. package/dist-lib/chunks/{toggle-group-XMO6ReVo.mjs → toggle-group-CFiAGdm7.mjs} +85 -26
  18. package/dist-lib/chunks/toggle-group-CFiAGdm7.mjs.map +1 -0
  19. package/dist-lib/chunks/useTheme-C9Y6vxTf.cjs.map +1 -1
  20. package/dist-lib/chunks/useTheme-DCmzLBUR.mjs.map +1 -1
  21. package/dist-lib/index.cjs +162 -94
  22. package/dist-lib/index.cjs.map +1 -1
  23. package/dist-lib/index.mjs +165 -97
  24. package/dist-lib/index.mjs.map +1 -1
  25. package/dist-lib/preview/chat.cjs.map +1 -1
  26. package/dist-lib/preview/chat.mjs.map +1 -1
  27. package/dist-lib/preview/clientes.cjs +1 -1
  28. package/dist-lib/preview/clientes.mjs +1 -1
  29. package/dist-lib/shadcn.cjs +1 -1
  30. package/dist-lib/shadcn.mjs +1 -1
  31. package/dist-lib/src/components/shadcn/card.d.ts +55 -2
  32. package/dist-lib/src/components/shadcn/card.d.ts.map +1 -1
  33. package/dist-lib/src/components/ui/ChoroplethMap/choropleth-map.d.ts.map +1 -1
  34. package/dist-lib/src/components/ui/ChoroplethMap/choropleth-map.styles.d.ts +24 -6
  35. package/dist-lib/src/components/ui/ChoroplethMap/choropleth-map.styles.d.ts.map +1 -1
  36. package/dist-lib/src/components/ui/ChoroplethMap/choropleth-map.types.d.ts +11 -2
  37. package/dist-lib/src/components/ui/ChoroplethMap/choropleth-map.types.d.ts.map +1 -1
  38. package/dist-lib/src/components/ui/FormField/form-field-select.d.ts.map +1 -1
  39. package/dist-lib/src/components/ui/MessageBubble/message-bubble.d.ts.map +1 -1
  40. package/dist-lib/src/components/ui/MessageBubble/message-bubble.styles.d.ts.map +1 -1
  41. package/dist-lib/src/components/ui/MessageComposer/message-composer.styles.d.ts +9 -3
  42. package/dist-lib/src/components/ui/MessageComposer/message-composer.styles.d.ts.map +1 -1
  43. package/dist-lib/theme/brand-blue.css +110 -110
  44. package/dist-lib/theme/brand-green.css +110 -110
  45. package/dist-lib/theme/brand-pay.css +189 -189
  46. package/dist-lib/theme/brand-vibrant.css +148 -148
  47. package/dist-lib/theme.css +3 -1
  48. package/dist-lib/tokens/brands/default/components/spacing.d.ts +41 -2
  49. package/dist-lib/tokens/brands/default/components/spacing.d.ts.map +1 -1
  50. package/dist-lib/tokens.cjs.map +1 -1
  51. package/dist-lib/tokens.mjs.map +1 -1
  52. package/package.json +4 -2
  53. package/dist-lib/chunks/panel-CCPe1H70.mjs.map +0 -1
  54. package/dist-lib/chunks/panel-CvfP8eP1.cjs.map +0 -1
  55. package/dist-lib/chunks/toggle-group-BEPs3e0Y.cjs.map +0 -1
  56. package/dist-lib/chunks/toggle-group-XMO6ReVo.mjs.map +0 -1
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const panel = require("./chunks/panel-CvfP8eP1.cjs");
3
+ const panel = require("./chunks/panel-4aMDou7z.cjs");
4
4
  const useTheme = require("./chunks/useTheme-C9Y6vxTf.cjs");
5
5
  const avatar = require("./chunks/avatar-eM5txRFZ.cjs");
6
6
  const jsxRuntime = require("react/jsx-runtime");
7
7
  const React = require("react");
8
8
  const sheet = require("./chunks/sheet-j-d_UX7R.cjs");
9
9
  const lucideReact = require("lucide-react");
10
- const toggleGroup = require("./chunks/toggle-group-BEPs3e0Y.cjs");
10
+ const toggleGroup = require("./chunks/toggle-group-BC4eS3Gt.cjs");
11
11
  const input = require("./chunks/input-az2SuVXQ.cjs");
12
12
  const kpiDelta = require("./chunks/kpi-delta-CXGg2nBx.cjs");
13
13
  const pageHeader = require("./chunks/page-header-DvAJoEfb.cjs");
@@ -3975,9 +3975,14 @@ const messageBubbleStyles = avatar.tv({
3975
3975
  mediaVideo: "max-w-full rounded-radius-sm focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring-brand",
3976
3976
  mediaAudio: "w-full",
3977
3977
  mediaDoc: [
3978
- "flex items-center gap-gp-md",
3978
+ "flex w-full items-center gap-gp-md text-left",
3979
3979
  "rounded-radius-sm bg-bg-muted",
3980
- "px-pad-lg py-pad-md"
3980
+ "px-pad-lg py-pad-md",
3981
+ // O card INTEIRO e o alvo do clique (ver o docblock do branch
3982
+ // `document`), entao ele precisa do estado de foco e do afeto de hover
3983
+ // que qualquer alvo clicavel tem.
3984
+ "transition-colors hover:bg-bg-subtle",
3985
+ "focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring-brand"
3981
3986
  ],
3982
3987
  mediaDocIcon: "shrink-0 text-fg-brand",
3983
3988
  mediaDocInfo: "flex min-w-0 flex-col",
@@ -4115,33 +4120,43 @@ function MessageMediaRenderer({
4115
4120
  }
4116
4121
  )
4117
4122
  ) : null });
4118
- case "document":
4119
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.mediaDoc(), children: [
4120
- /* @__PURE__ */ jsxRuntime.jsx(
4121
- Icon,
4122
- {
4123
- name: "line-file",
4124
- size: "lg",
4125
- className: styles.mediaDocIcon()
4126
- }
4127
- ),
4128
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.mediaDocInfo(), children: [
4129
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.mediaDocName(), children: body2 || "Documento" }),
4130
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.mediaDocHint(), children: "Toque para baixar" })
4131
- ] }),
4132
- mediaUrl ? /* @__PURE__ */ jsxRuntime.jsx(
4133
- avatar.Button,
4134
- {
4123
+ case "document": {
4124
+ const abrivel = Boolean(onMediaClick);
4125
+ const Moldura = abrivel ? "button" : "div";
4126
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4127
+ Moldura,
4128
+ {
4129
+ ...abrivel ? {
4135
4130
  type: "button",
4136
- size: "xs",
4137
- variant: "ghost",
4138
- color: "primary",
4139
- "aria-label": "Baixar documento",
4140
4131
  onClick: onMediaClick,
4141
- children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "line-download-01", size: "sm" })
4142
- }
4143
- ) : null
4144
- ] });
4132
+ "aria-label": `Abrir documento${body2 ? `: ${body2}` : ""}`
4133
+ } : {},
4134
+ className: styles.mediaDoc(),
4135
+ children: [
4136
+ /* @__PURE__ */ jsxRuntime.jsx(
4137
+ Icon,
4138
+ {
4139
+ name: "line-file",
4140
+ size: "lg",
4141
+ className: styles.mediaDocIcon()
4142
+ }
4143
+ ),
4144
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.mediaDocInfo(), children: [
4145
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.mediaDocName(), children: body2 || "Documento" }),
4146
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.mediaDocHint(), children: abrivel ? "Toque para abrir" : "Documento recebido" })
4147
+ ] }),
4148
+ abrivel ? /* @__PURE__ */ jsxRuntime.jsx(
4149
+ Icon,
4150
+ {
4151
+ name: "line-download-01",
4152
+ size: "sm",
4153
+ className: styles.mediaDocIcon()
4154
+ }
4155
+ ) : null
4156
+ ]
4157
+ }
4158
+ );
4159
+ }
4145
4160
  case "location":
4146
4161
  return mediaUrl ? /* @__PURE__ */ jsxRuntime.jsxs(
4147
4162
  "a",
@@ -4339,7 +4354,7 @@ const messageComposerStyles = avatar.tv({
4339
4354
  },
4340
4355
  state: {
4341
4356
  open: {},
4342
- disabled: { root: "opacity-60" },
4357
+ disabled: { field: "opacity-60" },
4343
4358
  "read-only": {}
4344
4359
  }
4345
4360
  },
@@ -4347,7 +4362,7 @@ const messageComposerStyles = avatar.tv({
4347
4362
  // disabled SEMPRE por último (L-006)
4348
4363
  {
4349
4364
  state: "disabled",
4350
- class: { root: "pointer-events-none" }
4365
+ class: { field: "pointer-events-none" }
4351
4366
  }
4352
4367
  ],
4353
4368
  defaultVariants: {
@@ -6541,6 +6556,10 @@ function object(topology, o) {
6541
6556
  const choroplethStyles = avatar.tv({
6542
6557
  slots: {
6543
6558
  root: "relative w-full",
6559
+ // Wrapper do svg + camada de tooltip: garante que o inset-0 da camada
6560
+ // cubra EXATAMENTE a área do mapa (sem ele, a camada cobria root inteiro
6561
+ // — incluindo a legenda — e as % de posição saíam deslocadas).
6562
+ canvas: "relative",
6544
6563
  svg: "block h-auto w-full",
6545
6564
  // Traço das divisas — `fg-muted` (mid-gray VISÍVEL nos DOIS temas: L≈0.50
6546
6565
  // no light, L≈0.70 no dark). `border-default` era L≈0.91 no light → as
@@ -6548,12 +6567,31 @@ const choroplethStyles = avatar.tv({
6548
6567
  // ("só 2 pontos"). hover reforça no próprio path (inline).
6549
6568
  path: [
6550
6569
  "stroke-fg-muted",
6551
- "transition-[fill,stroke] duration-150",
6552
- "hover:stroke-fg-brand"
6570
+ "transition-[fill,stroke] duration-150"
6553
6571
  ],
6554
- // Camada de ancoragem do tooltip (não intercepta o mouse).
6572
+ // Realce da região sob hover — uma CÓPIA do path desenhada por cima de
6573
+ // todas as outras. Necessário porque stroke de path SVG é coberto pelos
6574
+ // vizinhos desenhados depois: no próprio path, o contorno nunca fecha a
6575
+ // região inteira ("mal delimitada"). Não intercepta o mouse. Stroke E fill
6576
+ // vão inline, derivados do scaleToken (fg-{token} / bg-{token}) — o
6577
+ // contorno acompanha a família de cor do mapa (amarelo em warning, roxo
6578
+ // em info...), nunca verde fixo.
6579
+ pathHighlight: "pointer-events-none",
6580
+ // Seleção persistente (selectedId) — mesma técnica do hover (cópia por
6581
+ // cima), tinta mais forte pra diferenciar do transitório.
6582
+ pathSelected: "pointer-events-none",
6583
+ // Camada do tooltip (não intercepta o mouse — nem ela nem o filho).
6555
6584
  tooltipLayer: "pointer-events-none absolute inset-0",
6556
- tooltipAnchor: "absolute",
6585
+ // Tooltip PRÓPRIO, não Radix: renderizado dentro da camada acima, segue o
6586
+ // cursor e só troca o conteúdo. O Tooltip do DS portala o conteúdo num
6587
+ // wrapper do popper que captura o mouse — cursor movendo NA DIREÇÃO do
6588
+ // tooltip o alcançava → mouseleave do svg → fecha/reabre em loop (flicker
6589
+ // dependente de direção). Superfície = mesma receita sólida de antes.
6590
+ tooltip: [
6591
+ "pointer-events-none absolute z-10 w-max max-w-[16rem] select-none",
6592
+ "rounded-radius-md border border-border-default bg-bg-surface-elevated",
6593
+ "px-pad-lg py-pad-xs text-caption-sm shadow-sh-lg"
6594
+ ],
6557
6595
  tooltipName: "font-semibold text-fg-default",
6558
6596
  tooltipValue: "text-fg-muted",
6559
6597
  legend: "mt-gp-md flex flex-col gap-gp-xs",
@@ -6571,8 +6609,10 @@ function isFeatureCollection(g) {
6571
6609
  function normalizeFeatures(geography, topologyObject) {
6572
6610
  if (Array.isArray(geography)) return geography;
6573
6611
  if (isTopology(geography)) {
6574
- if (!topologyObject) return [];
6575
- const obj = geography.objects[topologyObject];
6612
+ const keys = Object.keys(geography.objects);
6613
+ const objectName = topologyObject ?? (keys.length === 1 ? keys[0] : void 0);
6614
+ if (!objectName) return [];
6615
+ const obj = geography.objects[objectName];
6576
6616
  if (!obj) return [];
6577
6617
  const out = topojsonFeature(geography, obj);
6578
6618
  if (out.type === "FeatureCollection") return out.features;
@@ -6600,6 +6640,7 @@ const ChoroplethMap = React.forwardRef(
6600
6640
  formatValue,
6601
6641
  renderTooltip,
6602
6642
  onFeatureClick,
6643
+ selectedId,
6603
6644
  ariaLabel = "Mapa",
6604
6645
  className
6605
6646
  }, ref) {
@@ -6619,8 +6660,7 @@ const ChoroplethMap = React.forwardRef(
6619
6660
  const pathGen = geoPath(proj);
6620
6661
  return features.map((f) => ({
6621
6662
  feature: f,
6622
- d: pathGen(f) ?? "",
6623
- centroid: pathGen.centroid(f)
6663
+ d: pathGen(f) ?? ""
6624
6664
  }));
6625
6665
  }, [features, projection2, width, height]);
6626
6666
  const getId = (f) => {
@@ -6640,6 +6680,7 @@ const ChoroplethMap = React.forwardRef(
6640
6680
  const min = domain ? domain[0] : numeric.length ? Math.min(...numeric) : 0;
6641
6681
  const max = domain ? domain[1] : numeric.length ? Math.max(...numeric) : 0;
6642
6682
  const scaleVar = `var(--color-bg-${scaleToken})`;
6683
+ const strokeVar = `var(--color-fg-${scaleToken})`;
6643
6684
  const surfaceVar = "var(--color-bg-surface)";
6644
6685
  const noDataVar = "var(--color-bg-muted)";
6645
6686
  const fillFor = (value) => {
@@ -6653,69 +6694,96 @@ const ChoroplethMap = React.forwardRef(
6653
6694
  };
6654
6695
  const fmt = formatValue ?? ((v) => new Intl.NumberFormat("pt-BR").format(v));
6655
6696
  const [hover, setHover] = React.useState(null);
6697
+ const [pos, setPos] = React.useState(null);
6656
6698
  const legendGradient = `linear-gradient(to right, ${surfaceVar}, ${scaleVar})`;
6657
6699
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: styles2.root({ className }), children: [
6658
- /* @__PURE__ */ jsxRuntime.jsx(
6659
- "svg",
6660
- {
6661
- viewBox: `0 0 ${width} ${height}`,
6662
- className: styles2.svg(),
6663
- role: "img",
6664
- "aria-label": ariaLabel,
6665
- onMouseLeave: () => setHover(null),
6666
- children: geometry.map(({ feature: feature2, d, centroid }, index) => {
6667
- const id = getId(feature2);
6668
- const value = values[id];
6669
- return /* @__PURE__ */ jsxRuntime.jsx(
6670
- "path",
6671
- {
6672
- d,
6673
- fill: fillFor(value),
6674
- strokeWidth,
6675
- className: styles2.path(),
6676
- style: onFeatureClick ? { cursor: "pointer" } : void 0,
6677
- onMouseEnter: () => setHover({
6678
- id,
6679
- name: getName(feature2),
6680
- value,
6681
- feature: feature2,
6682
- ax: centroid[0] / width * 100,
6683
- ay: centroid[1] / height * 100
6684
- }),
6685
- onClick: onFeatureClick ? () => onFeatureClick({
6686
- id,
6687
- name: getName(feature2),
6688
- value,
6689
- feature: feature2
6690
- }) : void 0
6691
- },
6692
- `${id}-${index}`
6693
- );
6694
- })
6695
- }
6696
- ),
6697
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles2.tooltipLayer(), children: /* @__PURE__ */ jsxRuntime.jsxs(avatar.Tooltip, { open: hover != null, onOpenChange: () => {
6698
- }, disableHoverableContent: true, children: [
6699
- /* @__PURE__ */ jsxRuntime.jsx(avatar.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
6700
- "span",
6700
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles2.canvas(), children: [
6701
+ /* @__PURE__ */ jsxRuntime.jsxs(
6702
+ "svg",
6701
6703
  {
6702
- "aria-hidden": "true",
6703
- className: styles2.tooltipAnchor(),
6704
- style: { left: `${hover?.ax ?? 0}%`, top: `${hover?.ay ?? 0}%` }
6704
+ viewBox: `0 0 ${width} ${height}`,
6705
+ className: styles2.svg(),
6706
+ role: "img",
6707
+ "aria-label": ariaLabel,
6708
+ onMouseLeave: () => setHover(null),
6709
+ onMouseMove: (e) => {
6710
+ const r = e.currentTarget.getBoundingClientRect();
6711
+ setPos({
6712
+ ax: (e.clientX - r.left) / r.width * 100,
6713
+ ay: (e.clientY - r.top) / r.height * 100
6714
+ });
6715
+ },
6716
+ children: [
6717
+ geometry.map(({ feature: feature2, d }, index) => {
6718
+ const id = getId(feature2);
6719
+ const value = values[id];
6720
+ return /* @__PURE__ */ jsxRuntime.jsx(
6721
+ "path",
6722
+ {
6723
+ d,
6724
+ fill: fillFor(value),
6725
+ strokeWidth,
6726
+ className: styles2.path(),
6727
+ style: onFeatureClick ? { cursor: "pointer" } : void 0,
6728
+ onMouseEnter: () => setHover({ id, name: getName(feature2), value, feature: feature2, d }),
6729
+ onClick: onFeatureClick ? () => onFeatureClick({
6730
+ id,
6731
+ name: getName(feature2),
6732
+ value,
6733
+ feature: feature2
6734
+ }) : void 0
6735
+ },
6736
+ `${id}-${index}`
6737
+ );
6738
+ }),
6739
+ selectedId != null && (() => {
6740
+ const sel = geometry.find(
6741
+ (g) => getId(g.feature) === selectedId
6742
+ );
6743
+ return sel ? /* @__PURE__ */ jsxRuntime.jsx(
6744
+ "path",
6745
+ {
6746
+ d: sel.d,
6747
+ className: styles2.pathSelected(),
6748
+ strokeWidth: Math.max(strokeWidth * 3, 1.5),
6749
+ style: {
6750
+ stroke: strokeVar,
6751
+ fill: `color-mix(in srgb, ${scaleVar} 32%, transparent)`
6752
+ }
6753
+ }
6754
+ ) : null;
6755
+ })(),
6756
+ hover && /* @__PURE__ */ jsxRuntime.jsx(
6757
+ "path",
6758
+ {
6759
+ d: hover.d,
6760
+ className: styles2.pathHighlight(),
6761
+ strokeWidth: Math.max(strokeWidth * 3, 1.5),
6762
+ style: {
6763
+ stroke: strokeVar,
6764
+ fill: `color-mix(in srgb, ${scaleVar} 18%, transparent)`
6765
+ }
6766
+ }
6767
+ )
6768
+ ]
6705
6769
  }
6706
- ) }),
6707
- /* @__PURE__ */ jsxRuntime.jsx(
6708
- avatar.TooltipContent,
6770
+ ),
6771
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles2.tooltipLayer(), children: hover && pos && /* @__PURE__ */ jsxRuntime.jsx(
6772
+ "div",
6709
6773
  {
6710
- showArrow: false,
6711
- className: "border border-border-default bg-bg-surface-elevated shadow-sh-lg",
6712
- children: hover && (renderTooltip ? renderTooltip(hover) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
6774
+ className: styles2.tooltip(),
6775
+ style: {
6776
+ left: `${pos.ax}%`,
6777
+ top: `${pos.ay}%`,
6778
+ transform: `translate(${pos.ax < 12 ? "0%" : pos.ax > 88 ? "-100%" : "-50%"}, ${pos.ay < 18 ? "16px" : "calc(-100% - 12px)"})`
6779
+ },
6780
+ children: renderTooltip ? renderTooltip(hover) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
6713
6781
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles2.tooltipName(), children: hover.name }),
6714
6782
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles2.tooltipValue(), children: hover.value != null && Number.isFinite(hover.value) ? fmt(hover.value) : "Sem dados" })
6715
- ] }))
6783
+ ] })
6716
6784
  }
6717
- )
6718
- ] }) }),
6785
+ ) })
6786
+ ] }),
6719
6787
  showLegend && numeric.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles2.legend(), children: [
6720
6788
  legendTitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles2.legendTitle(), children: legendTitle }),
6721
6789
  /* @__PURE__ */ jsxRuntime.jsx(