@vector-business-services/cristal-ds-web 0.14.0 → 0.16.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.js CHANGED
@@ -1,6 +1,6 @@
1
- import { forwardRef, useRef, useImperativeHandle, useState, Children, isValidElement, useId, useCallback, useEffect, useContext, cloneElement, useLayoutEffect, useMemo } from 'react';
1
+ import { forwardRef, useRef, useImperativeHandle, useState, Children, isValidElement, useId, useLayoutEffect, useMemo, useCallback, useEffect, useContext, cloneElement } from 'react';
2
2
  import { Accordion as Accordion$1, AccordionTab as AccordionTab$1 } from 'primereact/accordion';
3
- import { WarningCircle, Info, Check, CircleNotch, CaretDown, MagnifyingGlass, ArrowLeft, ArrowsInSimple, ArrowsOutSimple, CaretUp, X, List, DribbbleLogo, SealWarning, XCircle, CheckCircle, Warning, CaretDoubleRight, CaretRight, CaretLeft, CaretDoubleLeft, Question } from '@phosphor-icons/react';
3
+ import { WarningCircle, Info, Question, Check, ArrowLeft, X, CircleNotch, CaretDown, MagnifyingGlass, ArrowsInSimple, ArrowsOutSimple, CaretUp, List, DribbbleLogo, SealWarning, XCircle, CheckCircle, Warning, CaretDoubleRight, CaretRight, CaretLeft, CaretDoubleLeft } from '@phosphor-icons/react';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import { AutoComplete as AutoComplete$1 } from 'primereact/autocomplete';
6
6
  import { Badge as Badge$1 } from 'primereact/badge';
@@ -16,7 +16,6 @@ import { InputText } from 'primereact/inputtext';
16
16
  import { PrimeReactContext, PrimeReactProvider } from 'primereact/api';
17
17
  import { Menu as Menu$1 } from 'primereact/menu';
18
18
  import { Menubar as Menubar$1 } from 'primereact/menubar';
19
- import { Avatar } from 'primereact/avatar';
20
19
  import { Tag as Tag$1 } from 'primereact/tag';
21
20
  import { Message as Message$1 } from 'primereact/message';
22
21
  import { Dialog } from 'primereact/dialog';
@@ -37,22 +36,23 @@ function AccordionTab(_props) {
37
36
  return null;
38
37
  }
39
38
  var seta = (icon) => /* @__PURE__ */ jsx("span", { className: "cr-accordion__toggle", "aria-hidden": "true", children: icon });
40
- var Accordion = forwardRef(function Accordion2({ multiple = false, activeIndex, onTabChange, children, id, className }, ref) {
39
+ var Accordion = forwardRef(function Accordion2({ multiple = false, activeIndex, onTabChange, children, id, className, ...props }, ref) {
41
40
  const primeRef = useRef(null);
42
41
  useImperativeHandle(ref, () => primeRef.current?.getElement());
43
42
  const [interno, setInterno] = useState(multiple ? [0] : 0);
44
- const abertos = activeIndex === void 0 ? interno : activeIndex;
43
+ const abertos2 = activeIndex === void 0 ? interno : activeIndex;
45
44
  const tabs = Children.toArray(children).filter(
46
45
  (child) => isValidElement(child)
47
46
  );
48
47
  return /* @__PURE__ */ jsx(
49
48
  Accordion$1,
50
49
  {
50
+ ...props,
51
51
  ...{ unstyled: true },
52
52
  ref: primeRef,
53
53
  id,
54
54
  multiple,
55
- activeIndex: abertos,
55
+ activeIndex: abertos2,
56
56
  onTabChange: (event) => {
57
57
  const index = event.index;
58
58
  setInterno(index);
@@ -76,8 +76,16 @@ var Accordion = forwardRef(function Accordion2({ multiple = false, activeIndex,
76
76
  headerAction: { className: "cr-accordion__action" },
77
77
  toggleableContent: { className: "cr-accordion__region" },
78
78
  content: { className: "cr-accordion__content" },
79
- // Sem animação: o Prime manteria o conteúdo na tela pelos 450ms da saída dele.
80
- transition: { timeout: 0 }
79
+ // Abre e fecha pela altura, como o tema do Prime (p-toggleable-content, Accordion.css):
80
+ // no unstyled o Prime só dá o tempo, sem classes.
81
+ transition: {
82
+ classNames: {
83
+ enter: "cr-accordion__region--entrar",
84
+ enterActive: "cr-accordion__region--entrando",
85
+ exit: "cr-accordion__region--sair",
86
+ exitActive: "cr-accordion__region--saindo"
87
+ }
88
+ }
81
89
  },
82
90
  children: tab.props.children
83
91
  },
@@ -87,6 +95,9 @@ var Accordion = forwardRef(function Accordion2({ multiple = false, activeIndex,
87
95
  );
88
96
  });
89
97
 
98
+ // src/components/aria.ts
99
+ var juntarIds = (...ids) => ids.filter(Boolean).join(" ") || void 0;
100
+
90
101
  // src/components/popup.ts
91
102
  function seguirLado(painel, alvo) {
92
103
  if (!(painel instanceof HTMLElement) || !alvo) return;
@@ -102,7 +113,17 @@ var painelDoCampo = (campo, seletorDoPainel) => {
102
113
  const lista = campo?.getAttribute("aria-controls");
103
114
  return lista ? document.getElementById(lista)?.closest(seletorDoPainel) : null;
104
115
  };
105
- var aoPosicionar = (onEnter) => ({ onEnter });
116
+ var CLASSES_DO_POPUP = {
117
+ enter: "cr-popup--entrar",
118
+ enterActive: "cr-popup--entrando",
119
+ enterDone: "cr-popup--entrou",
120
+ exitActive: "cr-popup--saindo"
121
+ };
122
+ var transicaoDoPopup = (onEnter) => (
123
+ // Sem onEnter, a chave nem aparece: o Prime soma as funções do pt às dele, mas um undefined
124
+ // substituiria o onEnter dele (que posiciona a lista).
125
+ { classNames: CLASSES_DO_POPUP, ...onEnter && { onEnter } }
126
+ );
106
127
  var AutoComplete = forwardRef(function AutoComplete2({
107
128
  variant = "outline",
108
129
  size = "large",
@@ -148,15 +169,16 @@ var AutoComplete = forwardRef(function AutoComplete2({
148
169
  input: {
149
170
  root: {
150
171
  className: "cr-field__control cr-autocomplete__input",
151
- "aria-describedby": supportText ? hintId : void 0,
172
+ "aria-describedby": juntarIds(supportText && hintId, props["aria-describedby"]),
152
173
  "aria-invalid": error ? true : void 0
153
174
  }
154
175
  },
155
176
  // O Prime mostra um spinner próprio enquanto busca; o Figma não define esse estado.
156
177
  loadingIcon: { className: "cr-autocomplete__loader" },
157
178
  panel: { className: "cr-lista cr-autocomplete__panel" },
158
- // Lado da lista (acima ou abaixo do campo), medido logo depois de o Prime posicionar.
159
- transition: aoPosicionar(() => {
179
+ // Animação de entrada e saída (a do Prime) e o lado da lista, medido logo depois de o Prime
180
+ // posicionar.
181
+ transition: transicaoDoPopup(() => {
160
182
  const campo = document.getElementById(id);
161
183
  seguirLado(painelDoCampo(campo, ".cr-autocomplete__panel"), campo);
162
184
  }),
@@ -236,8 +258,16 @@ var Card = forwardRef(function Card2({ padding = "xsmall", outline = false, clas
236
258
  );
237
259
  });
238
260
  var usandoTeclado = false;
261
+ var abertos = /* @__PURE__ */ new Set();
239
262
  if (typeof document !== "undefined") {
240
- document.addEventListener("keydown", () => usandoTeclado = true, true);
263
+ document.addEventListener(
264
+ "keydown",
265
+ (event) => {
266
+ usandoTeclado = true;
267
+ if (event.key === "Escape") abertos.forEach((fechar) => fechar());
268
+ },
269
+ true
270
+ );
241
271
  document.addEventListener("pointerdown", () => usandoTeclado = false, true);
242
272
  }
243
273
  var resolveTargets = (target) => {
@@ -260,6 +290,9 @@ function Tooltip({
260
290
  }) {
261
291
  const autoId = useId();
262
292
  const tooltipId = id ?? autoId;
293
+ const primeRef = useRef(null);
294
+ const [fechar] = useState(() => () => void primeRef.current?.hide());
295
+ useEffect(() => () => void abertos.delete(fechar), [fechar]);
263
296
  useEffect(() => {
264
297
  if (!describe) return;
265
298
  const elements = resolveTargets(target);
@@ -294,9 +327,17 @@ function Tooltip({
294
327
  event,
295
328
  showDelay,
296
329
  hideDelay,
330
+ ref: primeRef,
297
331
  disabled,
298
- closeOnEscape: true,
299
- onBeforeShow: (e) => e.originalEvent?.type !== "focus" || usandoTeclado,
332
+ onBeforeShow: (e) => {
333
+ const abre = e.originalEvent?.type !== "focus" || usandoTeclado;
334
+ if (abre) abertos.add(fechar);
335
+ return abre;
336
+ },
337
+ onBeforeHide: () => {
338
+ abertos.delete(fechar);
339
+ return true;
340
+ },
300
341
  pt,
301
342
  children: content
302
343
  }
@@ -325,9 +366,17 @@ var lerTema = (el) => {
325
366
  }
326
367
  };
327
368
  };
328
- var comAlfa = (hex, alfa) => {
329
- const n = parseInt(hex.replace("#", ""), 16);
330
- return `rgba(${n >> 16 & 255}, ${n >> 8 & 255}, ${n & 255}, ${alfa})`;
369
+ var comAlfa = (cor, alfa) => {
370
+ const ctx = document.createElement("canvas").getContext("2d");
371
+ if (!ctx) return cor;
372
+ ctx.fillStyle = cor;
373
+ const normal = String(ctx.fillStyle);
374
+ if (normal.startsWith("#")) {
375
+ const n = parseInt(normal.slice(1, 7), 16);
376
+ return `rgba(${n >> 16 & 255}, ${n >> 8 & 255}, ${n & 255}, ${alfa})`;
377
+ }
378
+ const [r = 0, g = 0, b = 0] = normal.match(/[\d.]+/g)?.map(Number) ?? [];
379
+ return `rgba(${r}, ${g}, ${b}, ${alfa})`;
331
380
  };
332
381
  var cruz = (cor) => ({
333
382
  id: "crCruz",
@@ -345,27 +394,61 @@ var cruz = (cor) => ({
345
394
  ctx.restore();
346
395
  }
347
396
  });
397
+ var tracar = (ctx, pontos) => {
398
+ pontos.forEach((ponto, i) => {
399
+ const antes = pontos[i - 1];
400
+ if (!antes) return ctx.moveTo(ponto.x, ponto.y);
401
+ const meio = (antes.x + ponto.x) / 2;
402
+ ctx.bezierCurveTo(meio, antes.y, meio, ponto.y, ponto.x, ponto.y);
403
+ });
404
+ };
405
+ var trechos = (pontos) => pontos.reduce(
406
+ (lista, ponto) => {
407
+ if (ponto.skip) lista.push([]);
408
+ else lista[lista.length - 1].push(ponto);
409
+ return lista;
410
+ },
411
+ [[]]
412
+ ).filter((trecho) => trecho.length > 0);
348
413
  var curvaDoFigma = {
349
414
  id: "crCurva",
350
415
  beforeDatasetsDraw(chart) {
351
- chart.data.datasets.forEach((_, indice) => {
352
- const meta = chart.getDatasetMeta(indice);
353
- const pontos = meta.data;
354
- pontos.forEach((ponto, i) => {
355
- const antes = pontos[i - 1];
356
- const depois = pontos[i + 1];
357
- ponto.cp1x = antes ? (antes.x + ponto.x) / 2 : ponto.x;
358
- ponto.cp2x = depois ? (ponto.x + depois.x) / 2 : ponto.x;
359
- ponto.cp1y = ponto.y;
360
- ponto.cp2y = ponto.y;
416
+ const { ctx, chartArea } = chart;
417
+ const series = chart.data.datasets.map((dataset, indice) => ({ dataset, meta: chart.getDatasetMeta(indice), indice })).filter(({ indice }) => chart.isDatasetVisible(indice)).reverse();
418
+ ctx.save();
419
+ ctx.beginPath();
420
+ ctx.rect(chartArea.left, chartArea.top, chartArea.width, chartArea.height);
421
+ ctx.clip();
422
+ series.forEach(({ dataset, meta }) => {
423
+ const cor = String(dataset.borderColor);
424
+ const base = Math.min(meta.yScale?.getPixelForValue(0) ?? chartArea.bottom, chartArea.bottom);
425
+ const degrade = ctx.createLinearGradient(0, chartArea.top, 0, chartArea.bottom);
426
+ degrade.addColorStop(0, comAlfa(cor, 0.1));
427
+ degrade.addColorStop(1, comAlfa(cor, 0.02));
428
+ trechos(meta.data).forEach((trecho) => {
429
+ ctx.beginPath();
430
+ tracar(ctx, trecho);
431
+ ctx.lineTo(trecho[trecho.length - 1].x, base);
432
+ ctx.lineTo(trecho[0].x, base);
433
+ ctx.closePath();
434
+ ctx.fillStyle = degrade;
435
+ ctx.fill();
436
+ });
437
+ });
438
+ series.forEach(({ dataset, meta }) => {
439
+ ctx.strokeStyle = String(dataset.borderColor);
440
+ ctx.lineWidth = 2;
441
+ trechos(meta.data).forEach((trecho) => {
442
+ ctx.beginPath();
443
+ tracar(ctx, trecho);
444
+ ctx.stroke();
361
445
  });
362
- if (meta.dataset)
363
- meta.dataset._pointsUpdated = true;
364
446
  });
447
+ ctx.restore();
365
448
  }
366
449
  };
367
450
  var formatar = (eixo, valor) => eixo?.format ? eixo.format(valor) : String(valor);
368
- function Chart({
451
+ var Chart = forwardRef(function Chart2({
369
452
  type = "line",
370
453
  stacked = false,
371
454
  labels,
@@ -378,9 +461,11 @@ function Chart({
378
461
  actions,
379
462
  height = 266,
380
463
  id,
381
- className
382
- }) {
464
+ className,
465
+ ...props
466
+ }, ref) {
383
467
  const raiz = useRef(null);
468
+ useImperativeHandle(ref, () => raiz.current);
384
469
  const ajuda = useRef(null);
385
470
  const [tema, setTema] = useState();
386
471
  useLayoutEffect(() => {
@@ -413,22 +498,13 @@ function Chart({
413
498
  data: s.data,
414
499
  yAxisID: s.axis === "right" ? "y2" : "y",
415
500
  borderColor: cor,
416
- borderWidth: 2,
417
- tension: 0.4,
501
+ // A linha e a área são desenhadas pelo plugin curvaDoFigma.
502
+ showLine: false,
418
503
  pointRadius: 0,
419
504
  pointHoverRadius: 4,
420
505
  pointHoverBorderWidth: 2,
421
506
  pointHoverBorderColor: tema.superficie,
422
- pointHoverBackgroundColor: cor,
423
- fill: "origin",
424
- backgroundColor: (ctx) => {
425
- const area = ctx.chart.chartArea;
426
- if (!area) return comAlfa(cor, 0.1);
427
- const degrade = ctx.chart.ctx.createLinearGradient(0, area.top, 0, area.bottom);
428
- degrade.addColorStop(0, comAlfa(cor, 0.1));
429
- degrade.addColorStop(1, comAlfa(cor, 0.02));
430
- return degrade;
431
- }
507
+ pointHoverBackgroundColor: cor
432
508
  };
433
509
  })
434
510
  };
@@ -496,7 +572,7 @@ function Chart({
496
572
  }, [tema, yAxis, y2Axis, temDireita, series, type, stacked]);
497
573
  const card = Boolean(title || actions);
498
574
  const classes = ["cr-chart", card && "cr-chart--card", className].filter(Boolean).join(" ");
499
- return /* @__PURE__ */ jsxs("div", { ref: raiz, id, className: classes, children: [
575
+ return /* @__PURE__ */ jsxs("div", { ...props, ref: raiz, id, className: classes, children: [
500
576
  card && /* @__PURE__ */ jsxs("div", { className: "cr-chart__header", children: [
501
577
  /* @__PURE__ */ jsxs("div", { className: "cr-chart__title-row", children: [
502
578
  title && /* @__PURE__ */ jsx("span", { className: "cr-chart__title", children: title }),
@@ -539,25 +615,25 @@ function Chart({
539
615
  }
540
616
  ),
541
617
  s.label
542
- ] }, s.label)) })
618
+ ] }, `${i}-${s.label}`)) })
543
619
  ] }),
544
620
  /* @__PURE__ */ jsxs("table", { className: "cr-so-leitor cr-chart__table", children: [
545
621
  title && /* @__PURE__ */ jsx("caption", { children: title }),
546
622
  /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
547
623
  /* @__PURE__ */ jsx("td", {}),
548
- series.map((s) => /* @__PURE__ */ jsx("th", { scope: "col", children: s.label }, s.label))
624
+ series.map((s, i) => /* @__PURE__ */ jsx("th", { scope: "col", children: s.label }, `${i}-${s.label}`))
549
625
  ] }) }),
550
626
  /* @__PURE__ */ jsx("tbody", { children: labels.map((rotulo, linha) => /* @__PURE__ */ jsxs("tr", { children: [
551
627
  /* @__PURE__ */ jsx("th", { scope: "row", children: rotulo }),
552
- series.map((s) => {
628
+ series.map((s, i) => {
553
629
  const valor = s.data[linha];
554
630
  const eixo = s.axis === "right" ? y2Axis : yAxis;
555
- return /* @__PURE__ */ jsx("td", { children: valor == null ? "" : formatar(eixo, valor) }, s.label);
631
+ return /* @__PURE__ */ jsx("td", { children: valor == null ? "" : formatar(eixo, valor) }, `${i}-${s.label}`);
556
632
  })
557
- ] }, rotulo)) })
633
+ ] }, `${linha}-${rotulo}`)) })
558
634
  ] })
559
635
  ] });
560
- }
636
+ });
561
637
  var Checkbox = forwardRef(function Checkbox2({
562
638
  label,
563
639
  showLabel = true,
@@ -572,7 +648,8 @@ var Checkbox = forwardRef(function Checkbox2({
572
648
  value,
573
649
  id,
574
650
  className,
575
- style
651
+ style,
652
+ ...props
576
653
  }, ref) {
577
654
  const autoId = useId();
578
655
  const inputId = id ?? autoId;
@@ -615,7 +692,7 @@ var Checkbox = forwardRef(function Checkbox2({
615
692
  root: {
616
693
  className: `cr-checkbox__control${checked ? " cr-checkbox__control--checked" : ""}`
617
694
  },
618
- input: { className: "cr-checkbox__input" },
695
+ input: { ...props, className: "cr-checkbox__input" },
619
696
  box: { className: "cr-checkbox__box" },
620
697
  icon: { className: "cr-checkbox__icon", "aria-hidden": true }
621
698
  }
@@ -753,7 +830,7 @@ var IconButton = forwardRef(function IconButton2({
753
830
  ] });
754
831
  });
755
832
  var FOCAVEIS = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
756
- function Drawer({
833
+ var Drawer = forwardRef(function Drawer2({
757
834
  visible,
758
835
  onHide,
759
836
  title,
@@ -768,8 +845,13 @@ function Drawer({
768
845
  footer,
769
846
  children,
770
847
  id,
771
- className
772
- }) {
848
+ className,
849
+ ...props
850
+ }, ref) {
851
+ const primeRef = useRef(null);
852
+ useImperativeHandle(ref, () => ({
853
+ getElement: () => primeRef.current?.getElement() ?? null
854
+ }));
773
855
  const autoId = useId();
774
856
  const titleId = `${autoId}-title`;
775
857
  const subtitleId = `${autoId}-subtitle`;
@@ -818,6 +900,8 @@ function Drawer({
818
900
  return /* @__PURE__ */ jsx(
819
901
  Sidebar,
820
902
  {
903
+ ...props,
904
+ ref: primeRef,
821
905
  unstyled: true,
822
906
  id,
823
907
  visible,
@@ -901,7 +985,7 @@ function Drawer({
901
985
  )
902
986
  }
903
987
  );
904
- }
988
+ });
905
989
  var Input = forwardRef(function Input2({
906
990
  variant = "outline",
907
991
  size = "large",
@@ -946,8 +1030,8 @@ var Input = forwardRef(function Input2({
946
1030
  disabled,
947
1031
  invalid: Boolean(error),
948
1032
  "aria-invalid": error ? true : void 0,
949
- "aria-describedby": supportText ? hintId : void 0,
950
- ...props
1033
+ ...props,
1034
+ "aria-describedby": juntarIds(supportText && hintId, props["aria-describedby"])
951
1035
  }
952
1036
  ),
953
1037
  trailingIcon && /* @__PURE__ */ jsx("span", { className: "cr-field__icon", children: trailingIcon })
@@ -970,7 +1054,8 @@ var Menu = forwardRef(function Menu2({
970
1054
  onShow,
971
1055
  onHide,
972
1056
  id,
973
- className
1057
+ className,
1058
+ ...props
974
1059
  }, ref) {
975
1060
  const primeRef = useRef(null);
976
1061
  const alvo = useRef(null);
@@ -1021,10 +1106,11 @@ var Menu = forwardRef(function Menu2({
1021
1106
  };
1022
1107
  },
1023
1108
  content: { className: "cr-menu__content" },
1024
- // Lado do popup (acima ou abaixo de quem o abriu), medido logo depois de o Prime posicionar.
1109
+ // Animação de entrada e saída (a do Prime) e o lado do popup, medido logo depois de o Prime
1110
+ // posicionar.
1025
1111
  // Numa microtarefa: no onEnter o Prime ainda está religando a ref (getElement vem vazio); ela
1026
1112
  // roda logo depois, antes de a tela ser pintada.
1027
- transition: aoPosicionar(
1113
+ transition: transicaoDoPopup(
1028
1114
  () => queueMicrotask(() => seguirLado(primeRef.current?.getElement(), alvo.current))
1029
1115
  ),
1030
1116
  action: { className: "cr-lista__item cr-menu__action" },
@@ -1033,6 +1119,7 @@ var Menu = forwardRef(function Menu2({
1033
1119
  const menu = /* @__PURE__ */ jsx(
1034
1120
  Menu$1,
1035
1121
  {
1122
+ ...props,
1036
1123
  unstyled: true,
1037
1124
  ref: primeRef,
1038
1125
  id,
@@ -1121,16 +1208,11 @@ function Profile({ user, menu }) {
1121
1208
  user.role && /* @__PURE__ */ jsx("span", { className: "cr-menubar__profile-role", children: user.role })
1122
1209
  ] }),
1123
1210
  /* @__PURE__ */ jsx(
1124
- Avatar,
1211
+ "span",
1125
1212
  {
1126
- unstyled: true,
1127
1213
  "aria-hidden": "true",
1128
1214
  className: `cr-menubar__avatar${user.avatar ? "" : " cr-menubar__avatar--initial"}`,
1129
- image: user.avatar,
1130
- imageAlt: "",
1131
- label: user.avatar ? void 0 : user.name.trim().charAt(0).toUpperCase(),
1132
- shape: "circle",
1133
- pt: { image: { className: "cr-menubar__avatar-image" } }
1215
+ children: user.avatar ? /* @__PURE__ */ jsx("img", { className: "cr-menubar__avatar-image", src: user.avatar, alt: "" }) : user.name.trim().charAt(0).toUpperCase()
1134
1216
  }
1135
1217
  )
1136
1218
  ] });
@@ -1179,7 +1261,8 @@ var Menubar = forwardRef(function Menubar2({
1179
1261
  user,
1180
1262
  userMenu,
1181
1263
  id,
1182
- className
1264
+ className,
1265
+ ...props
1183
1266
  }, ref) {
1184
1267
  const [innerSearch, setInnerSearch] = useState("");
1185
1268
  const search = searchValue ?? innerSearch;
@@ -1245,6 +1328,7 @@ var Menubar = forwardRef(function Menubar2({
1245
1328
  return /* @__PURE__ */ jsx("div", { ref, id, className: classes, children: /* @__PURE__ */ jsx(
1246
1329
  Menubar$1,
1247
1330
  {
1331
+ ...props,
1248
1332
  unstyled: true,
1249
1333
  className: "cr-menubar__bar",
1250
1334
  model: [],
@@ -1276,10 +1360,12 @@ var MenuPrincipal = forwardRef(
1276
1360
  model,
1277
1361
  popup = false,
1278
1362
  "aria-label": ariaLabel = "Menu principal",
1363
+ "aria-labelledby": ariaLabelledBy,
1279
1364
  onShow,
1280
1365
  onHide,
1281
1366
  id,
1282
- className
1367
+ className,
1368
+ ...props
1283
1369
  }, ref) {
1284
1370
  const primeRef = useRef(null);
1285
1371
  const context = useContext(PrimeReactContext);
@@ -1353,7 +1439,12 @@ var MenuPrincipal = forwardRef(
1353
1439
  });
1354
1440
  const classes = ["cr-menu-principal", popup && "cr-menu-principal--popup", className].filter(Boolean).join(" ");
1355
1441
  const pt = {
1356
- menu: { className: "cr-menu-principal__list", "aria-label": ariaLabel },
1442
+ // O nome acessível vai na lista (role=menu), como no Menu.
1443
+ menu: {
1444
+ className: "cr-menu-principal__list",
1445
+ "aria-label": ariaLabelledBy ? void 0 : ariaLabel,
1446
+ "aria-labelledby": ariaLabelledBy
1447
+ },
1357
1448
  submenuHeader: { className: "cr-menu-principal__group" },
1358
1449
  // O divisor tracejado é o Divider do Cristal (dashed).
1359
1450
  separator: {
@@ -1362,13 +1453,14 @@ var MenuPrincipal = forwardRef(
1362
1453
  menuitem: { className: "cr-menu-principal__item" },
1363
1454
  // Lado do popup, medido logo depois de o Prime posicionar.
1364
1455
  // Numa microtarefa: no onEnter o Prime ainda está religando a ref (como no Menu).
1365
- transition: aoPosicionar(
1456
+ transition: transicaoDoPopup(
1366
1457
  () => queueMicrotask(() => seguirLado(primeRef.current?.getElement(), alvo.current))
1367
1458
  )
1368
1459
  };
1369
1460
  const menu = /* @__PURE__ */ jsx(
1370
1461
  Menu$1,
1371
1462
  {
1463
+ ...props,
1372
1464
  unstyled: true,
1373
1465
  ref: primeRef,
1374
1466
  id,
@@ -1400,12 +1492,13 @@ var ICON = {
1400
1492
  highlight: /* @__PURE__ */ jsx(SealWarning, {}),
1401
1493
  neutral: /* @__PURE__ */ jsx(WarningCircle, {})
1402
1494
  };
1403
- var Message = forwardRef(function Message2({ type = "info", children, showIcon = true, id, className }, ref) {
1495
+ var Message = forwardRef(function Message2({ type = "info", children, showIcon = true, id, className, ...props }, ref) {
1404
1496
  const primeRef = useRef(null);
1405
1497
  useImperativeHandle(ref, () => primeRef.current?.getElement());
1406
1498
  return /* @__PURE__ */ jsx(
1407
1499
  Message$1,
1408
1500
  {
1501
+ ...props,
1409
1502
  unstyled: true,
1410
1503
  ref: primeRef,
1411
1504
  id,
@@ -1421,9 +1514,10 @@ var Message = forwardRef(function Message2({ type = "info", children, showIcon =
1421
1514
  }
1422
1515
  );
1423
1516
  });
1424
- function Modal({
1517
+ var Modal = forwardRef(function Modal2({
1425
1518
  visible,
1426
1519
  onHide,
1520
+ dismissableMask = true,
1427
1521
  title,
1428
1522
  size = "large",
1429
1523
  onHelp,
@@ -1433,8 +1527,13 @@ function Modal({
1433
1527
  footerStart,
1434
1528
  children,
1435
1529
  id,
1436
- className
1437
- }) {
1530
+ className,
1531
+ ...props
1532
+ }, ref) {
1533
+ const primeRef = useRef(null);
1534
+ useImperativeHandle(ref, () => ({
1535
+ getElement: () => primeRef.current?.getElement() ?? null
1536
+ }));
1438
1537
  const autoId = useId();
1439
1538
  const titleId = `${autoId}-title`;
1440
1539
  const [body, setBody] = useState(null);
@@ -1452,10 +1551,13 @@ function Modal({
1452
1551
  return /* @__PURE__ */ jsx(
1453
1552
  Dialog,
1454
1553
  {
1554
+ ...props,
1555
+ ref: primeRef,
1455
1556
  unstyled: true,
1456
1557
  id,
1457
1558
  visible,
1458
1559
  onHide,
1560
+ dismissableMask,
1459
1561
  draggable: false,
1460
1562
  resizable: false,
1461
1563
  blockScroll: true,
@@ -1465,6 +1567,16 @@ function Modal({
1465
1567
  className: classes,
1466
1568
  "aria-labelledby": titleId,
1467
1569
  "aria-describedby": void 0
1570
+ },
1571
+ // Entrada e saída do tema do Prime (p-dialog, Modal.css). No unstyled o Prime não põe
1572
+ // classes na transição; o tipo exige o addEndListener do react-transition-group.
1573
+ transition: {
1574
+ classNames: {
1575
+ enter: "cr-modal--entrar",
1576
+ enterActive: "cr-modal--entrando",
1577
+ enterDone: "cr-modal--entrou",
1578
+ exitActive: "cr-modal--saindo"
1579
+ }
1468
1580
  }
1469
1581
  },
1470
1582
  content: ({ hide, closeRef }) => /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -1510,7 +1622,7 @@ function Modal({
1510
1622
  ] })
1511
1623
  }
1512
1624
  );
1513
- }
1625
+ });
1514
1626
  var MultiSelect = forwardRef(function MultiSelect2({
1515
1627
  variant = "outline",
1516
1628
  size = "large",
@@ -1610,7 +1722,7 @@ var MultiSelect = forwardRef(function MultiSelect2({
1610
1722
  },
1611
1723
  hiddenInputWrapper: { className: "cr-so-leitor cr-multiselect__hidden" },
1612
1724
  input: {
1613
- "aria-describedby": supportText ? hintId : void 0,
1725
+ "aria-describedby": juntarIds(supportText && hintId, props["aria-describedby"]),
1614
1726
  "aria-invalid": error ? true : void 0,
1615
1727
  "aria-required": required || void 0
1616
1728
  },
@@ -1650,7 +1762,9 @@ var MultiSelect = forwardRef(function MultiSelect2({
1650
1762
  ...checkbox,
1651
1763
  root: { ...checkbox.root, role: void 0, "aria-checked": void 0, inert: true }
1652
1764
  },
1653
- emptyMessage: { className: "cr-multiselect__empty" }
1765
+ emptyMessage: { className: "cr-multiselect__empty" },
1766
+ // Animação de entrada e saída da lista, a do Prime (comum.css).
1767
+ transition: transicaoDoPopup()
1654
1768
  };
1655
1769
  return /* @__PURE__ */ jsxs("div", { className: classes, children: [
1656
1770
  label && /* @__PURE__ */ jsxs("label", { className: "cr-field__label", htmlFor: inputId, children: [
@@ -1813,7 +1927,8 @@ var Select = forwardRef(function Select2({
1813
1927
  disabled,
1814
1928
  id,
1815
1929
  name,
1816
- className
1930
+ className,
1931
+ ...props
1817
1932
  }, ref) {
1818
1933
  const autoId = useId();
1819
1934
  const inputId = id ?? autoId;
@@ -1851,8 +1966,9 @@ var Select = forwardRef(function Select2({
1851
1966
  input: { className: "cr-select__value" },
1852
1967
  trigger: { className: "cr-field__icon cr-select__trigger", "aria-hidden": true },
1853
1968
  panel: { className: "cr-lista cr-select__panel" },
1854
- // Lado da lista (acima ou abaixo do campo), medido logo depois de o Prime posicionar.
1855
- transition: aoPosicionar(
1969
+ // Animação de entrada e saída (a do Prime) e o lado da lista, medido logo depois de o Prime
1970
+ // posicionar.
1971
+ transition: transicaoDoPopup(
1856
1972
  () => seguirLado(
1857
1973
  document.getElementById(listId)?.closest(".cr-select__panel"),
1858
1974
  document.getElementById(inputId)?.closest(".cr-select__control")
@@ -1878,6 +1994,7 @@ var Select = forwardRef(function Select2({
1878
1994
  /* @__PURE__ */ jsx(
1879
1995
  Dropdown,
1880
1996
  {
1997
+ ...props,
1881
1998
  unstyled: true,
1882
1999
  inputId,
1883
2000
  focusInputRef: setInputRef,
@@ -1900,7 +2017,7 @@ var Select = forwardRef(function Select2({
1900
2017
  "aria-label": label ? void 0 : ariaLabel,
1901
2018
  "aria-expanded": open,
1902
2019
  "aria-controls": open ? listId : void 0,
1903
- "aria-describedby": supportText ? hintId : void 0,
2020
+ "aria-describedby": juntarIds(supportText && hintId, props["aria-describedby"]),
1904
2021
  "aria-invalid": error ? true : void 0,
1905
2022
  "aria-required": required || void 0,
1906
2023
  pt
@@ -1932,7 +2049,8 @@ var Paginator = forwardRef(function Paginator2({
1932
2049
  onPageChange,
1933
2050
  rowsPerPageLabel = "Itens por p\xE1gina",
1934
2051
  id,
1935
- className
2052
+ className,
2053
+ ...props
1936
2054
  }, ref) {
1937
2055
  const primeRef = useRef(null);
1938
2056
  useImperativeHandle(ref, () => primeRef.current?.getElement());
@@ -1944,6 +2062,7 @@ var Paginator = forwardRef(function Paginator2({
1944
2062
  return /* @__PURE__ */ jsx(
1945
2063
  Paginator$1,
1946
2064
  {
2065
+ ...props,
1947
2066
  unstyled: true,
1948
2067
  ref: primeRef,
1949
2068
  id,
@@ -2031,7 +2150,8 @@ var Radio = forwardRef(function Radio2({
2031
2150
  required,
2032
2151
  id,
2033
2152
  className,
2034
- style
2153
+ style,
2154
+ ...props
2035
2155
  }, ref) {
2036
2156
  const autoId = useId();
2037
2157
  const inputId = id ?? autoId;
@@ -2057,7 +2177,7 @@ var Radio = forwardRef(function Radio2({
2057
2177
  pt: {
2058
2178
  // Marcado pela prop do Cristal, não pelo atributo interno do Prime (data-p-checked).
2059
2179
  root: { className: `cr-radio__control${checked ? " cr-radio__control--checked" : ""}` },
2060
- input: { className: "cr-radio__input" },
2180
+ input: { ...props, className: "cr-radio__input" },
2061
2181
  box: { className: "cr-radio__box" },
2062
2182
  icon: { className: "cr-radio__icon" }
2063
2183
  }
@@ -2074,7 +2194,15 @@ var Radio = forwardRef(function Radio2({
2074
2194
  ] });
2075
2195
  });
2076
2196
  var porcentagem = (posicao, total, visivel) => total > visivel ? Math.round(posicao / (total - visivel) * 100) : 0;
2077
- var ScrollPanel = forwardRef(function ScrollPanel2({ children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, style, id, className }, ref) {
2197
+ var ScrollPanel = forwardRef(function ScrollPanel2({
2198
+ children,
2199
+ "aria-label": ariaLabel,
2200
+ "aria-labelledby": ariaLabelledBy,
2201
+ style,
2202
+ id,
2203
+ className,
2204
+ ...props
2205
+ }, ref) {
2078
2206
  const primeRef = useRef(null);
2079
2207
  useImperativeHandle(ref, () => primeRef.current?.getElement());
2080
2208
  const contentId = `${useId()}-content`;
@@ -2109,7 +2237,7 @@ var ScrollPanel = forwardRef(function ScrollPanel2({ children, "aria-label": ari
2109
2237
  barx: barra("horizontal", posicao.x),
2110
2238
  bary: barra("vertical", posicao.y)
2111
2239
  };
2112
- return /* @__PURE__ */ jsx(ScrollPanel$1, { unstyled: true, ref: primeRef, id, pt, children });
2240
+ return /* @__PURE__ */ jsx(ScrollPanel$1, { ...props, unstyled: true, ref: primeRef, id, pt, children });
2113
2241
  });
2114
2242
  var SegmentControl = forwardRef(
2115
2243
  function SegmentControl2({
@@ -2121,7 +2249,8 @@ var SegmentControl = forwardRef(
2121
2249
  "aria-labelledby": ariaLabelledBy,
2122
2250
  disabled,
2123
2251
  id,
2124
- className
2252
+ className,
2253
+ ...props
2125
2254
  }, ref) {
2126
2255
  const primeRef = useRef(null);
2127
2256
  useImperativeHandle(ref, () => primeRef.current?.getElement());
@@ -2129,6 +2258,7 @@ var SegmentControl = forwardRef(
2129
2258
  return /* @__PURE__ */ jsx(
2130
2259
  SelectButton,
2131
2260
  {
2261
+ ...props,
2132
2262
  unstyled: true,
2133
2263
  ref: primeRef,
2134
2264
  id,
@@ -2173,7 +2303,8 @@ var Switch = forwardRef(function Switch2({
2173
2303
  name,
2174
2304
  id,
2175
2305
  className,
2176
- style
2306
+ style,
2307
+ ...props
2177
2308
  }, ref) {
2178
2309
  const autoId = useId();
2179
2310
  const inputId = id ?? autoId;
@@ -2202,7 +2333,7 @@ var Switch = forwardRef(function Switch2({
2202
2333
  role: void 0,
2203
2334
  "aria-checked": void 0
2204
2335
  },
2205
- input: { className: "cr-switch__input" },
2336
+ input: { ...props, className: "cr-switch__input" },
2206
2337
  slider: { className: "cr-switch__track" }
2207
2338
  }
2208
2339
  }
@@ -2220,7 +2351,7 @@ var Switch = forwardRef(function Switch2({
2220
2351
  function TabPanel(_props) {
2221
2352
  return null;
2222
2353
  }
2223
- var Tabs = forwardRef(function Tabs2({ activeIndex, onTabChange, children, id, className }, ref) {
2354
+ var Tabs = forwardRef(function Tabs2({ activeIndex, onTabChange, children, id, className, ...props }, ref) {
2224
2355
  const primeRef = useRef(null);
2225
2356
  useImperativeHandle(ref, () => primeRef.current?.getElement());
2226
2357
  const [interno, setInterno] = useState(0);
@@ -2263,6 +2394,7 @@ var Tabs = forwardRef(function Tabs2({ activeIndex, onTabChange, children, id, c
2263
2394
  return /* @__PURE__ */ jsx(
2264
2395
  TabView,
2265
2396
  {
2397
+ ...props,
2266
2398
  unstyled: true,
2267
2399
  ref: primeRef,
2268
2400
  id,
@@ -2355,6 +2487,7 @@ var Toast = forwardRef(function Toast2({ position = "top-right", closeLabel = "F
2355
2487
  classNames: {
2356
2488
  enter: "cr-toast__message--enter",
2357
2489
  enterActive: "cr-toast__message--enter-active",
2490
+ exit: "cr-toast__message--exit",
2358
2491
  exitActive: "cr-toast__message--exit-active"
2359
2492
  }
2360
2493
  }