@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.cjs +225 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +130 -43
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +49 -23
- package/dist/index.d.ts +49 -23
- package/dist/index.js +227 -94
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -18,7 +18,6 @@ var inputtext = require('primereact/inputtext');
|
|
|
18
18
|
var api = require('primereact/api');
|
|
19
19
|
var menu = require('primereact/menu');
|
|
20
20
|
var menubar = require('primereact/menubar');
|
|
21
|
-
var avatar = require('primereact/avatar');
|
|
22
21
|
var tag = require('primereact/tag');
|
|
23
22
|
var message = require('primereact/message');
|
|
24
23
|
var dialog = require('primereact/dialog');
|
|
@@ -39,22 +38,23 @@ function AccordionTab(_props) {
|
|
|
39
38
|
return null;
|
|
40
39
|
}
|
|
41
40
|
var seta = (icon) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-accordion__toggle", "aria-hidden": "true", children: icon });
|
|
42
|
-
var Accordion = react.forwardRef(function Accordion2({ multiple = false, activeIndex, onTabChange, children, id, className }, ref) {
|
|
41
|
+
var Accordion = react.forwardRef(function Accordion2({ multiple = false, activeIndex, onTabChange, children, id, className, ...props }, ref) {
|
|
43
42
|
const primeRef = react.useRef(null);
|
|
44
43
|
react.useImperativeHandle(ref, () => primeRef.current?.getElement());
|
|
45
44
|
const [interno, setInterno] = react.useState(multiple ? [0] : 0);
|
|
46
|
-
const
|
|
45
|
+
const abertos2 = activeIndex === void 0 ? interno : activeIndex;
|
|
47
46
|
const tabs = react.Children.toArray(children).filter(
|
|
48
47
|
(child) => react.isValidElement(child)
|
|
49
48
|
);
|
|
50
49
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
51
50
|
accordion.Accordion,
|
|
52
51
|
{
|
|
52
|
+
...props,
|
|
53
53
|
...{ unstyled: true },
|
|
54
54
|
ref: primeRef,
|
|
55
55
|
id,
|
|
56
56
|
multiple,
|
|
57
|
-
activeIndex:
|
|
57
|
+
activeIndex: abertos2,
|
|
58
58
|
onTabChange: (event) => {
|
|
59
59
|
const index = event.index;
|
|
60
60
|
setInterno(index);
|
|
@@ -78,8 +78,16 @@ var Accordion = react.forwardRef(function Accordion2({ multiple = false, activeI
|
|
|
78
78
|
headerAction: { className: "cr-accordion__action" },
|
|
79
79
|
toggleableContent: { className: "cr-accordion__region" },
|
|
80
80
|
content: { className: "cr-accordion__content" },
|
|
81
|
-
//
|
|
82
|
-
|
|
81
|
+
// Abre e fecha pela altura, como o tema do Prime (p-toggleable-content, Accordion.css):
|
|
82
|
+
// no unstyled o Prime só dá o tempo, sem classes.
|
|
83
|
+
transition: {
|
|
84
|
+
classNames: {
|
|
85
|
+
enter: "cr-accordion__region--entrar",
|
|
86
|
+
enterActive: "cr-accordion__region--entrando",
|
|
87
|
+
exit: "cr-accordion__region--sair",
|
|
88
|
+
exitActive: "cr-accordion__region--saindo"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
83
91
|
},
|
|
84
92
|
children: tab.props.children
|
|
85
93
|
},
|
|
@@ -89,6 +97,9 @@ var Accordion = react.forwardRef(function Accordion2({ multiple = false, activeI
|
|
|
89
97
|
);
|
|
90
98
|
});
|
|
91
99
|
|
|
100
|
+
// src/components/aria.ts
|
|
101
|
+
var juntarIds = (...ids) => ids.filter(Boolean).join(" ") || void 0;
|
|
102
|
+
|
|
92
103
|
// src/components/popup.ts
|
|
93
104
|
function seguirLado(painel, alvo) {
|
|
94
105
|
if (!(painel instanceof HTMLElement) || !alvo) return;
|
|
@@ -104,7 +115,17 @@ var painelDoCampo = (campo, seletorDoPainel) => {
|
|
|
104
115
|
const lista = campo?.getAttribute("aria-controls");
|
|
105
116
|
return lista ? document.getElementById(lista)?.closest(seletorDoPainel) : null;
|
|
106
117
|
};
|
|
107
|
-
var
|
|
118
|
+
var CLASSES_DO_POPUP = {
|
|
119
|
+
enter: "cr-popup--entrar",
|
|
120
|
+
enterActive: "cr-popup--entrando",
|
|
121
|
+
enterDone: "cr-popup--entrou",
|
|
122
|
+
exitActive: "cr-popup--saindo"
|
|
123
|
+
};
|
|
124
|
+
var transicaoDoPopup = (onEnter) => (
|
|
125
|
+
// Sem onEnter, a chave nem aparece: o Prime soma as funções do pt às dele, mas um undefined
|
|
126
|
+
// substituiria o onEnter dele (que posiciona a lista).
|
|
127
|
+
{ classNames: CLASSES_DO_POPUP, ...onEnter && { onEnter } }
|
|
128
|
+
);
|
|
108
129
|
var AutoComplete = react.forwardRef(function AutoComplete2({
|
|
109
130
|
variant = "outline",
|
|
110
131
|
size = "large",
|
|
@@ -150,15 +171,16 @@ var AutoComplete = react.forwardRef(function AutoComplete2({
|
|
|
150
171
|
input: {
|
|
151
172
|
root: {
|
|
152
173
|
className: "cr-field__control cr-autocomplete__input",
|
|
153
|
-
"aria-describedby": supportText
|
|
174
|
+
"aria-describedby": juntarIds(supportText && hintId, props["aria-describedby"]),
|
|
154
175
|
"aria-invalid": error ? true : void 0
|
|
155
176
|
}
|
|
156
177
|
},
|
|
157
178
|
// O Prime mostra um spinner próprio enquanto busca; o Figma não define esse estado.
|
|
158
179
|
loadingIcon: { className: "cr-autocomplete__loader" },
|
|
159
180
|
panel: { className: "cr-lista cr-autocomplete__panel" },
|
|
160
|
-
//
|
|
161
|
-
|
|
181
|
+
// Animação de entrada e saída (a do Prime) e o lado da lista, medido logo depois de o Prime
|
|
182
|
+
// posicionar.
|
|
183
|
+
transition: transicaoDoPopup(() => {
|
|
162
184
|
const campo = document.getElementById(id);
|
|
163
185
|
seguirLado(painelDoCampo(campo, ".cr-autocomplete__panel"), campo);
|
|
164
186
|
}),
|
|
@@ -238,8 +260,16 @@ var Card = react.forwardRef(function Card2({ padding = "xsmall", outline = false
|
|
|
238
260
|
);
|
|
239
261
|
});
|
|
240
262
|
var usandoTeclado = false;
|
|
263
|
+
var abertos = /* @__PURE__ */ new Set();
|
|
241
264
|
if (typeof document !== "undefined") {
|
|
242
|
-
document.addEventListener(
|
|
265
|
+
document.addEventListener(
|
|
266
|
+
"keydown",
|
|
267
|
+
(event) => {
|
|
268
|
+
usandoTeclado = true;
|
|
269
|
+
if (event.key === "Escape") abertos.forEach((fechar) => fechar());
|
|
270
|
+
},
|
|
271
|
+
true
|
|
272
|
+
);
|
|
243
273
|
document.addEventListener("pointerdown", () => usandoTeclado = false, true);
|
|
244
274
|
}
|
|
245
275
|
var resolveTargets = (target) => {
|
|
@@ -262,6 +292,9 @@ function Tooltip({
|
|
|
262
292
|
}) {
|
|
263
293
|
const autoId = react.useId();
|
|
264
294
|
const tooltipId = id ?? autoId;
|
|
295
|
+
const primeRef = react.useRef(null);
|
|
296
|
+
const [fechar] = react.useState(() => () => void primeRef.current?.hide());
|
|
297
|
+
react.useEffect(() => () => void abertos.delete(fechar), [fechar]);
|
|
265
298
|
react.useEffect(() => {
|
|
266
299
|
if (!describe) return;
|
|
267
300
|
const elements = resolveTargets(target);
|
|
@@ -296,9 +329,17 @@ function Tooltip({
|
|
|
296
329
|
event,
|
|
297
330
|
showDelay,
|
|
298
331
|
hideDelay,
|
|
332
|
+
ref: primeRef,
|
|
299
333
|
disabled,
|
|
300
|
-
|
|
301
|
-
|
|
334
|
+
onBeforeShow: (e) => {
|
|
335
|
+
const abre = e.originalEvent?.type !== "focus" || usandoTeclado;
|
|
336
|
+
if (abre) abertos.add(fechar);
|
|
337
|
+
return abre;
|
|
338
|
+
},
|
|
339
|
+
onBeforeHide: () => {
|
|
340
|
+
abertos.delete(fechar);
|
|
341
|
+
return true;
|
|
342
|
+
},
|
|
302
343
|
pt,
|
|
303
344
|
children: content
|
|
304
345
|
}
|
|
@@ -327,9 +368,17 @@ var lerTema = (el) => {
|
|
|
327
368
|
}
|
|
328
369
|
};
|
|
329
370
|
};
|
|
330
|
-
var comAlfa = (
|
|
331
|
-
const
|
|
332
|
-
|
|
371
|
+
var comAlfa = (cor, alfa) => {
|
|
372
|
+
const ctx = document.createElement("canvas").getContext("2d");
|
|
373
|
+
if (!ctx) return cor;
|
|
374
|
+
ctx.fillStyle = cor;
|
|
375
|
+
const normal = String(ctx.fillStyle);
|
|
376
|
+
if (normal.startsWith("#")) {
|
|
377
|
+
const n = parseInt(normal.slice(1, 7), 16);
|
|
378
|
+
return `rgba(${n >> 16 & 255}, ${n >> 8 & 255}, ${n & 255}, ${alfa})`;
|
|
379
|
+
}
|
|
380
|
+
const [r = 0, g = 0, b = 0] = normal.match(/[\d.]+/g)?.map(Number) ?? [];
|
|
381
|
+
return `rgba(${r}, ${g}, ${b}, ${alfa})`;
|
|
333
382
|
};
|
|
334
383
|
var cruz = (cor) => ({
|
|
335
384
|
id: "crCruz",
|
|
@@ -347,27 +396,61 @@ var cruz = (cor) => ({
|
|
|
347
396
|
ctx.restore();
|
|
348
397
|
}
|
|
349
398
|
});
|
|
399
|
+
var tracar = (ctx, pontos) => {
|
|
400
|
+
pontos.forEach((ponto, i) => {
|
|
401
|
+
const antes = pontos[i - 1];
|
|
402
|
+
if (!antes) return ctx.moveTo(ponto.x, ponto.y);
|
|
403
|
+
const meio = (antes.x + ponto.x) / 2;
|
|
404
|
+
ctx.bezierCurveTo(meio, antes.y, meio, ponto.y, ponto.x, ponto.y);
|
|
405
|
+
});
|
|
406
|
+
};
|
|
407
|
+
var trechos = (pontos) => pontos.reduce(
|
|
408
|
+
(lista, ponto) => {
|
|
409
|
+
if (ponto.skip) lista.push([]);
|
|
410
|
+
else lista[lista.length - 1].push(ponto);
|
|
411
|
+
return lista;
|
|
412
|
+
},
|
|
413
|
+
[[]]
|
|
414
|
+
).filter((trecho) => trecho.length > 0);
|
|
350
415
|
var curvaDoFigma = {
|
|
351
416
|
id: "crCurva",
|
|
352
417
|
beforeDatasetsDraw(chart) {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
418
|
+
const { ctx, chartArea } = chart;
|
|
419
|
+
const series = chart.data.datasets.map((dataset, indice) => ({ dataset, meta: chart.getDatasetMeta(indice), indice })).filter(({ indice }) => chart.isDatasetVisible(indice)).reverse();
|
|
420
|
+
ctx.save();
|
|
421
|
+
ctx.beginPath();
|
|
422
|
+
ctx.rect(chartArea.left, chartArea.top, chartArea.width, chartArea.height);
|
|
423
|
+
ctx.clip();
|
|
424
|
+
series.forEach(({ dataset, meta }) => {
|
|
425
|
+
const cor = String(dataset.borderColor);
|
|
426
|
+
const base = Math.min(meta.yScale?.getPixelForValue(0) ?? chartArea.bottom, chartArea.bottom);
|
|
427
|
+
const degrade = ctx.createLinearGradient(0, chartArea.top, 0, chartArea.bottom);
|
|
428
|
+
degrade.addColorStop(0, comAlfa(cor, 0.1));
|
|
429
|
+
degrade.addColorStop(1, comAlfa(cor, 0.02));
|
|
430
|
+
trechos(meta.data).forEach((trecho) => {
|
|
431
|
+
ctx.beginPath();
|
|
432
|
+
tracar(ctx, trecho);
|
|
433
|
+
ctx.lineTo(trecho[trecho.length - 1].x, base);
|
|
434
|
+
ctx.lineTo(trecho[0].x, base);
|
|
435
|
+
ctx.closePath();
|
|
436
|
+
ctx.fillStyle = degrade;
|
|
437
|
+
ctx.fill();
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
series.forEach(({ dataset, meta }) => {
|
|
441
|
+
ctx.strokeStyle = String(dataset.borderColor);
|
|
442
|
+
ctx.lineWidth = 2;
|
|
443
|
+
trechos(meta.data).forEach((trecho) => {
|
|
444
|
+
ctx.beginPath();
|
|
445
|
+
tracar(ctx, trecho);
|
|
446
|
+
ctx.stroke();
|
|
363
447
|
});
|
|
364
|
-
if (meta.dataset)
|
|
365
|
-
meta.dataset._pointsUpdated = true;
|
|
366
448
|
});
|
|
449
|
+
ctx.restore();
|
|
367
450
|
}
|
|
368
451
|
};
|
|
369
452
|
var formatar = (eixo, valor) => eixo?.format ? eixo.format(valor) : String(valor);
|
|
370
|
-
|
|
453
|
+
var Chart = react.forwardRef(function Chart2({
|
|
371
454
|
type = "line",
|
|
372
455
|
stacked = false,
|
|
373
456
|
labels,
|
|
@@ -380,9 +463,11 @@ function Chart({
|
|
|
380
463
|
actions,
|
|
381
464
|
height = 266,
|
|
382
465
|
id,
|
|
383
|
-
className
|
|
384
|
-
|
|
466
|
+
className,
|
|
467
|
+
...props
|
|
468
|
+
}, ref) {
|
|
385
469
|
const raiz = react.useRef(null);
|
|
470
|
+
react.useImperativeHandle(ref, () => raiz.current);
|
|
386
471
|
const ajuda = react.useRef(null);
|
|
387
472
|
const [tema, setTema] = react.useState();
|
|
388
473
|
react.useLayoutEffect(() => {
|
|
@@ -415,22 +500,13 @@ function Chart({
|
|
|
415
500
|
data: s.data,
|
|
416
501
|
yAxisID: s.axis === "right" ? "y2" : "y",
|
|
417
502
|
borderColor: cor,
|
|
418
|
-
|
|
419
|
-
|
|
503
|
+
// A linha e a área são desenhadas pelo plugin curvaDoFigma.
|
|
504
|
+
showLine: false,
|
|
420
505
|
pointRadius: 0,
|
|
421
506
|
pointHoverRadius: 4,
|
|
422
507
|
pointHoverBorderWidth: 2,
|
|
423
508
|
pointHoverBorderColor: tema.superficie,
|
|
424
|
-
pointHoverBackgroundColor: cor
|
|
425
|
-
fill: "origin",
|
|
426
|
-
backgroundColor: (ctx) => {
|
|
427
|
-
const area = ctx.chart.chartArea;
|
|
428
|
-
if (!area) return comAlfa(cor, 0.1);
|
|
429
|
-
const degrade = ctx.chart.ctx.createLinearGradient(0, area.top, 0, area.bottom);
|
|
430
|
-
degrade.addColorStop(0, comAlfa(cor, 0.1));
|
|
431
|
-
degrade.addColorStop(1, comAlfa(cor, 0.02));
|
|
432
|
-
return degrade;
|
|
433
|
-
}
|
|
509
|
+
pointHoverBackgroundColor: cor
|
|
434
510
|
};
|
|
435
511
|
})
|
|
436
512
|
};
|
|
@@ -498,7 +574,7 @@ function Chart({
|
|
|
498
574
|
}, [tema, yAxis, y2Axis, temDireita, series, type, stacked]);
|
|
499
575
|
const card = Boolean(title || actions);
|
|
500
576
|
const classes = ["cr-chart", card && "cr-chart--card", className].filter(Boolean).join(" ");
|
|
501
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: raiz, id, className: classes, children: [
|
|
577
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...props, ref: raiz, id, className: classes, children: [
|
|
502
578
|
card && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-chart__header", children: [
|
|
503
579
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-chart__title-row", children: [
|
|
504
580
|
title && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-chart__title", children: title }),
|
|
@@ -541,25 +617,25 @@ function Chart({
|
|
|
541
617
|
}
|
|
542
618
|
),
|
|
543
619
|
s.label
|
|
544
|
-
] }, s.label)) })
|
|
620
|
+
] }, `${i}-${s.label}`)) })
|
|
545
621
|
] }),
|
|
546
622
|
/* @__PURE__ */ jsxRuntime.jsxs("table", { className: "cr-so-leitor cr-chart__table", children: [
|
|
547
623
|
title && /* @__PURE__ */ jsxRuntime.jsx("caption", { children: title }),
|
|
548
624
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
549
625
|
/* @__PURE__ */ jsxRuntime.jsx("td", {}),
|
|
550
|
-
series.map((s) => /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", children: s.label }, s.label))
|
|
626
|
+
series.map((s, i) => /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", children: s.label }, `${i}-${s.label}`))
|
|
551
627
|
] }) }),
|
|
552
628
|
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: labels.map((rotulo, linha) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
553
629
|
/* @__PURE__ */ jsxRuntime.jsx("th", { scope: "row", children: rotulo }),
|
|
554
|
-
series.map((s) => {
|
|
630
|
+
series.map((s, i) => {
|
|
555
631
|
const valor = s.data[linha];
|
|
556
632
|
const eixo = s.axis === "right" ? y2Axis : yAxis;
|
|
557
|
-
return /* @__PURE__ */ jsxRuntime.jsx("td", { children: valor == null ? "" : formatar(eixo, valor) }, s.label);
|
|
633
|
+
return /* @__PURE__ */ jsxRuntime.jsx("td", { children: valor == null ? "" : formatar(eixo, valor) }, `${i}-${s.label}`);
|
|
558
634
|
})
|
|
559
|
-
] }, rotulo)) })
|
|
635
|
+
] }, `${linha}-${rotulo}`)) })
|
|
560
636
|
] })
|
|
561
637
|
] });
|
|
562
|
-
}
|
|
638
|
+
});
|
|
563
639
|
var Checkbox = react.forwardRef(function Checkbox2({
|
|
564
640
|
label,
|
|
565
641
|
showLabel = true,
|
|
@@ -574,7 +650,8 @@ var Checkbox = react.forwardRef(function Checkbox2({
|
|
|
574
650
|
value,
|
|
575
651
|
id,
|
|
576
652
|
className,
|
|
577
|
-
style
|
|
653
|
+
style,
|
|
654
|
+
...props
|
|
578
655
|
}, ref) {
|
|
579
656
|
const autoId = react.useId();
|
|
580
657
|
const inputId = id ?? autoId;
|
|
@@ -617,7 +694,7 @@ var Checkbox = react.forwardRef(function Checkbox2({
|
|
|
617
694
|
root: {
|
|
618
695
|
className: `cr-checkbox__control${checked ? " cr-checkbox__control--checked" : ""}`
|
|
619
696
|
},
|
|
620
|
-
input: { className: "cr-checkbox__input" },
|
|
697
|
+
input: { ...props, className: "cr-checkbox__input" },
|
|
621
698
|
box: { className: "cr-checkbox__box" },
|
|
622
699
|
icon: { className: "cr-checkbox__icon", "aria-hidden": true }
|
|
623
700
|
}
|
|
@@ -755,7 +832,7 @@ var IconButton = react.forwardRef(function IconButton2({
|
|
|
755
832
|
] });
|
|
756
833
|
});
|
|
757
834
|
var FOCAVEIS = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
758
|
-
|
|
835
|
+
var Drawer = react.forwardRef(function Drawer2({
|
|
759
836
|
visible,
|
|
760
837
|
onHide,
|
|
761
838
|
title,
|
|
@@ -770,8 +847,13 @@ function Drawer({
|
|
|
770
847
|
footer,
|
|
771
848
|
children,
|
|
772
849
|
id,
|
|
773
|
-
className
|
|
774
|
-
|
|
850
|
+
className,
|
|
851
|
+
...props
|
|
852
|
+
}, ref) {
|
|
853
|
+
const primeRef = react.useRef(null);
|
|
854
|
+
react.useImperativeHandle(ref, () => ({
|
|
855
|
+
getElement: () => primeRef.current?.getElement() ?? null
|
|
856
|
+
}));
|
|
775
857
|
const autoId = react.useId();
|
|
776
858
|
const titleId = `${autoId}-title`;
|
|
777
859
|
const subtitleId = `${autoId}-subtitle`;
|
|
@@ -820,6 +902,8 @@ function Drawer({
|
|
|
820
902
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
821
903
|
sidebar.Sidebar,
|
|
822
904
|
{
|
|
905
|
+
...props,
|
|
906
|
+
ref: primeRef,
|
|
823
907
|
unstyled: true,
|
|
824
908
|
id,
|
|
825
909
|
visible,
|
|
@@ -903,7 +987,7 @@ function Drawer({
|
|
|
903
987
|
)
|
|
904
988
|
}
|
|
905
989
|
);
|
|
906
|
-
}
|
|
990
|
+
});
|
|
907
991
|
var Input = react.forwardRef(function Input2({
|
|
908
992
|
variant = "outline",
|
|
909
993
|
size = "large",
|
|
@@ -948,8 +1032,8 @@ var Input = react.forwardRef(function Input2({
|
|
|
948
1032
|
disabled,
|
|
949
1033
|
invalid: Boolean(error),
|
|
950
1034
|
"aria-invalid": error ? true : void 0,
|
|
951
|
-
|
|
952
|
-
|
|
1035
|
+
...props,
|
|
1036
|
+
"aria-describedby": juntarIds(supportText && hintId, props["aria-describedby"])
|
|
953
1037
|
}
|
|
954
1038
|
),
|
|
955
1039
|
trailingIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__icon", children: trailingIcon })
|
|
@@ -972,7 +1056,8 @@ var Menu = react.forwardRef(function Menu2({
|
|
|
972
1056
|
onShow,
|
|
973
1057
|
onHide,
|
|
974
1058
|
id,
|
|
975
|
-
className
|
|
1059
|
+
className,
|
|
1060
|
+
...props
|
|
976
1061
|
}, ref) {
|
|
977
1062
|
const primeRef = react.useRef(null);
|
|
978
1063
|
const alvo = react.useRef(null);
|
|
@@ -1023,10 +1108,11 @@ var Menu = react.forwardRef(function Menu2({
|
|
|
1023
1108
|
};
|
|
1024
1109
|
},
|
|
1025
1110
|
content: { className: "cr-menu__content" },
|
|
1026
|
-
//
|
|
1111
|
+
// Animação de entrada e saída (a do Prime) e o lado do popup, medido logo depois de o Prime
|
|
1112
|
+
// posicionar.
|
|
1027
1113
|
// Numa microtarefa: no onEnter o Prime ainda está religando a ref (getElement vem vazio); ela
|
|
1028
1114
|
// roda logo depois, antes de a tela ser pintada.
|
|
1029
|
-
transition:
|
|
1115
|
+
transition: transicaoDoPopup(
|
|
1030
1116
|
() => queueMicrotask(() => seguirLado(primeRef.current?.getElement(), alvo.current))
|
|
1031
1117
|
),
|
|
1032
1118
|
action: { className: "cr-lista__item cr-menu__action" },
|
|
@@ -1035,6 +1121,7 @@ var Menu = react.forwardRef(function Menu2({
|
|
|
1035
1121
|
const menu$1 = /* @__PURE__ */ jsxRuntime.jsx(
|
|
1036
1122
|
menu.Menu,
|
|
1037
1123
|
{
|
|
1124
|
+
...props,
|
|
1038
1125
|
unstyled: true,
|
|
1039
1126
|
ref: primeRef,
|
|
1040
1127
|
id,
|
|
@@ -1123,16 +1210,11 @@ function Profile({ user, menu }) {
|
|
|
1123
1210
|
user.role && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-menubar__profile-role", children: user.role })
|
|
1124
1211
|
] }),
|
|
1125
1212
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1126
|
-
|
|
1213
|
+
"span",
|
|
1127
1214
|
{
|
|
1128
|
-
unstyled: true,
|
|
1129
1215
|
"aria-hidden": "true",
|
|
1130
1216
|
className: `cr-menubar__avatar${user.avatar ? "" : " cr-menubar__avatar--initial"}`,
|
|
1131
|
-
image: user.avatar,
|
|
1132
|
-
imageAlt: "",
|
|
1133
|
-
label: user.avatar ? void 0 : user.name.trim().charAt(0).toUpperCase(),
|
|
1134
|
-
shape: "circle",
|
|
1135
|
-
pt: { image: { className: "cr-menubar__avatar-image" } }
|
|
1217
|
+
children: user.avatar ? /* @__PURE__ */ jsxRuntime.jsx("img", { className: "cr-menubar__avatar-image", src: user.avatar, alt: "" }) : user.name.trim().charAt(0).toUpperCase()
|
|
1136
1218
|
}
|
|
1137
1219
|
)
|
|
1138
1220
|
] });
|
|
@@ -1181,7 +1263,8 @@ var Menubar = react.forwardRef(function Menubar2({
|
|
|
1181
1263
|
user,
|
|
1182
1264
|
userMenu,
|
|
1183
1265
|
id,
|
|
1184
|
-
className
|
|
1266
|
+
className,
|
|
1267
|
+
...props
|
|
1185
1268
|
}, ref) {
|
|
1186
1269
|
const [innerSearch, setInnerSearch] = react.useState("");
|
|
1187
1270
|
const search = searchValue ?? innerSearch;
|
|
@@ -1247,6 +1330,7 @@ var Menubar = react.forwardRef(function Menubar2({
|
|
|
1247
1330
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, id, className: classes, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1248
1331
|
menubar.Menubar,
|
|
1249
1332
|
{
|
|
1333
|
+
...props,
|
|
1250
1334
|
unstyled: true,
|
|
1251
1335
|
className: "cr-menubar__bar",
|
|
1252
1336
|
model: [],
|
|
@@ -1278,10 +1362,12 @@ var MenuPrincipal = react.forwardRef(
|
|
|
1278
1362
|
model,
|
|
1279
1363
|
popup = false,
|
|
1280
1364
|
"aria-label": ariaLabel = "Menu principal",
|
|
1365
|
+
"aria-labelledby": ariaLabelledBy,
|
|
1281
1366
|
onShow,
|
|
1282
1367
|
onHide,
|
|
1283
1368
|
id,
|
|
1284
|
-
className
|
|
1369
|
+
className,
|
|
1370
|
+
...props
|
|
1285
1371
|
}, ref) {
|
|
1286
1372
|
const primeRef = react.useRef(null);
|
|
1287
1373
|
const context = react.useContext(api.PrimeReactContext);
|
|
@@ -1355,7 +1441,12 @@ var MenuPrincipal = react.forwardRef(
|
|
|
1355
1441
|
});
|
|
1356
1442
|
const classes = ["cr-menu-principal", popup && "cr-menu-principal--popup", className].filter(Boolean).join(" ");
|
|
1357
1443
|
const pt = {
|
|
1358
|
-
|
|
1444
|
+
// O nome acessível vai na lista (role=menu), como no Menu.
|
|
1445
|
+
menu: {
|
|
1446
|
+
className: "cr-menu-principal__list",
|
|
1447
|
+
"aria-label": ariaLabelledBy ? void 0 : ariaLabel,
|
|
1448
|
+
"aria-labelledby": ariaLabelledBy
|
|
1449
|
+
},
|
|
1359
1450
|
submenuHeader: { className: "cr-menu-principal__group" },
|
|
1360
1451
|
// O divisor tracejado é o Divider do Cristal (dashed).
|
|
1361
1452
|
separator: {
|
|
@@ -1364,13 +1455,14 @@ var MenuPrincipal = react.forwardRef(
|
|
|
1364
1455
|
menuitem: { className: "cr-menu-principal__item" },
|
|
1365
1456
|
// Lado do popup, medido logo depois de o Prime posicionar.
|
|
1366
1457
|
// Numa microtarefa: no onEnter o Prime ainda está religando a ref (como no Menu).
|
|
1367
|
-
transition:
|
|
1458
|
+
transition: transicaoDoPopup(
|
|
1368
1459
|
() => queueMicrotask(() => seguirLado(primeRef.current?.getElement(), alvo.current))
|
|
1369
1460
|
)
|
|
1370
1461
|
};
|
|
1371
1462
|
const menu$1 = /* @__PURE__ */ jsxRuntime.jsx(
|
|
1372
1463
|
menu.Menu,
|
|
1373
1464
|
{
|
|
1465
|
+
...props,
|
|
1374
1466
|
unstyled: true,
|
|
1375
1467
|
ref: primeRef,
|
|
1376
1468
|
id,
|
|
@@ -1402,12 +1494,13 @@ var ICON = {
|
|
|
1402
1494
|
highlight: /* @__PURE__ */ jsxRuntime.jsx(react$1.SealWarning, {}),
|
|
1403
1495
|
neutral: /* @__PURE__ */ jsxRuntime.jsx(react$1.WarningCircle, {})
|
|
1404
1496
|
};
|
|
1405
|
-
var Message = react.forwardRef(function Message2({ type = "info", children, showIcon = true, id, className }, ref) {
|
|
1497
|
+
var Message = react.forwardRef(function Message2({ type = "info", children, showIcon = true, id, className, ...props }, ref) {
|
|
1406
1498
|
const primeRef = react.useRef(null);
|
|
1407
1499
|
react.useImperativeHandle(ref, () => primeRef.current?.getElement());
|
|
1408
1500
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1409
1501
|
message.Message,
|
|
1410
1502
|
{
|
|
1503
|
+
...props,
|
|
1411
1504
|
unstyled: true,
|
|
1412
1505
|
ref: primeRef,
|
|
1413
1506
|
id,
|
|
@@ -1423,9 +1516,10 @@ var Message = react.forwardRef(function Message2({ type = "info", children, show
|
|
|
1423
1516
|
}
|
|
1424
1517
|
);
|
|
1425
1518
|
});
|
|
1426
|
-
|
|
1519
|
+
var Modal = react.forwardRef(function Modal2({
|
|
1427
1520
|
visible,
|
|
1428
1521
|
onHide,
|
|
1522
|
+
dismissableMask = true,
|
|
1429
1523
|
title,
|
|
1430
1524
|
size = "large",
|
|
1431
1525
|
onHelp,
|
|
@@ -1435,8 +1529,13 @@ function Modal({
|
|
|
1435
1529
|
footerStart,
|
|
1436
1530
|
children,
|
|
1437
1531
|
id,
|
|
1438
|
-
className
|
|
1439
|
-
|
|
1532
|
+
className,
|
|
1533
|
+
...props
|
|
1534
|
+
}, ref) {
|
|
1535
|
+
const primeRef = react.useRef(null);
|
|
1536
|
+
react.useImperativeHandle(ref, () => ({
|
|
1537
|
+
getElement: () => primeRef.current?.getElement() ?? null
|
|
1538
|
+
}));
|
|
1440
1539
|
const autoId = react.useId();
|
|
1441
1540
|
const titleId = `${autoId}-title`;
|
|
1442
1541
|
const [body, setBody] = react.useState(null);
|
|
@@ -1454,10 +1553,13 @@ function Modal({
|
|
|
1454
1553
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1455
1554
|
dialog.Dialog,
|
|
1456
1555
|
{
|
|
1556
|
+
...props,
|
|
1557
|
+
ref: primeRef,
|
|
1457
1558
|
unstyled: true,
|
|
1458
1559
|
id,
|
|
1459
1560
|
visible,
|
|
1460
1561
|
onHide,
|
|
1562
|
+
dismissableMask,
|
|
1461
1563
|
draggable: false,
|
|
1462
1564
|
resizable: false,
|
|
1463
1565
|
blockScroll: true,
|
|
@@ -1467,6 +1569,16 @@ function Modal({
|
|
|
1467
1569
|
className: classes,
|
|
1468
1570
|
"aria-labelledby": titleId,
|
|
1469
1571
|
"aria-describedby": void 0
|
|
1572
|
+
},
|
|
1573
|
+
// Entrada e saída do tema do Prime (p-dialog, Modal.css). No unstyled o Prime não põe
|
|
1574
|
+
// classes na transição; o tipo exige o addEndListener do react-transition-group.
|
|
1575
|
+
transition: {
|
|
1576
|
+
classNames: {
|
|
1577
|
+
enter: "cr-modal--entrar",
|
|
1578
|
+
enterActive: "cr-modal--entrando",
|
|
1579
|
+
enterDone: "cr-modal--entrou",
|
|
1580
|
+
exitActive: "cr-modal--saindo"
|
|
1581
|
+
}
|
|
1470
1582
|
}
|
|
1471
1583
|
},
|
|
1472
1584
|
content: ({ hide, closeRef }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -1512,7 +1624,7 @@ function Modal({
|
|
|
1512
1624
|
] })
|
|
1513
1625
|
}
|
|
1514
1626
|
);
|
|
1515
|
-
}
|
|
1627
|
+
});
|
|
1516
1628
|
var MultiSelect = react.forwardRef(function MultiSelect2({
|
|
1517
1629
|
variant = "outline",
|
|
1518
1630
|
size = "large",
|
|
@@ -1612,7 +1724,7 @@ var MultiSelect = react.forwardRef(function MultiSelect2({
|
|
|
1612
1724
|
},
|
|
1613
1725
|
hiddenInputWrapper: { className: "cr-so-leitor cr-multiselect__hidden" },
|
|
1614
1726
|
input: {
|
|
1615
|
-
"aria-describedby": supportText
|
|
1727
|
+
"aria-describedby": juntarIds(supportText && hintId, props["aria-describedby"]),
|
|
1616
1728
|
"aria-invalid": error ? true : void 0,
|
|
1617
1729
|
"aria-required": required || void 0
|
|
1618
1730
|
},
|
|
@@ -1652,7 +1764,9 @@ var MultiSelect = react.forwardRef(function MultiSelect2({
|
|
|
1652
1764
|
...checkbox,
|
|
1653
1765
|
root: { ...checkbox.root, role: void 0, "aria-checked": void 0, inert: true }
|
|
1654
1766
|
},
|
|
1655
|
-
emptyMessage: { className: "cr-multiselect__empty" }
|
|
1767
|
+
emptyMessage: { className: "cr-multiselect__empty" },
|
|
1768
|
+
// Animação de entrada e saída da lista, a do Prime (comum.css).
|
|
1769
|
+
transition: transicaoDoPopup()
|
|
1656
1770
|
};
|
|
1657
1771
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, children: [
|
|
1658
1772
|
label && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "cr-field__label", htmlFor: inputId, children: [
|
|
@@ -1815,7 +1929,8 @@ var Select = react.forwardRef(function Select2({
|
|
|
1815
1929
|
disabled,
|
|
1816
1930
|
id,
|
|
1817
1931
|
name,
|
|
1818
|
-
className
|
|
1932
|
+
className,
|
|
1933
|
+
...props
|
|
1819
1934
|
}, ref) {
|
|
1820
1935
|
const autoId = react.useId();
|
|
1821
1936
|
const inputId = id ?? autoId;
|
|
@@ -1853,8 +1968,9 @@ var Select = react.forwardRef(function Select2({
|
|
|
1853
1968
|
input: { className: "cr-select__value" },
|
|
1854
1969
|
trigger: { className: "cr-field__icon cr-select__trigger", "aria-hidden": true },
|
|
1855
1970
|
panel: { className: "cr-lista cr-select__panel" },
|
|
1856
|
-
//
|
|
1857
|
-
|
|
1971
|
+
// Animação de entrada e saída (a do Prime) e o lado da lista, medido logo depois de o Prime
|
|
1972
|
+
// posicionar.
|
|
1973
|
+
transition: transicaoDoPopup(
|
|
1858
1974
|
() => seguirLado(
|
|
1859
1975
|
document.getElementById(listId)?.closest(".cr-select__panel"),
|
|
1860
1976
|
document.getElementById(inputId)?.closest(".cr-select__control")
|
|
@@ -1880,6 +1996,7 @@ var Select = react.forwardRef(function Select2({
|
|
|
1880
1996
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1881
1997
|
dropdown.Dropdown,
|
|
1882
1998
|
{
|
|
1999
|
+
...props,
|
|
1883
2000
|
unstyled: true,
|
|
1884
2001
|
inputId,
|
|
1885
2002
|
focusInputRef: setInputRef,
|
|
@@ -1902,7 +2019,7 @@ var Select = react.forwardRef(function Select2({
|
|
|
1902
2019
|
"aria-label": label ? void 0 : ariaLabel,
|
|
1903
2020
|
"aria-expanded": open,
|
|
1904
2021
|
"aria-controls": open ? listId : void 0,
|
|
1905
|
-
"aria-describedby": supportText
|
|
2022
|
+
"aria-describedby": juntarIds(supportText && hintId, props["aria-describedby"]),
|
|
1906
2023
|
"aria-invalid": error ? true : void 0,
|
|
1907
2024
|
"aria-required": required || void 0,
|
|
1908
2025
|
pt
|
|
@@ -1934,7 +2051,8 @@ var Paginator = react.forwardRef(function Paginator2({
|
|
|
1934
2051
|
onPageChange,
|
|
1935
2052
|
rowsPerPageLabel = "Itens por p\xE1gina",
|
|
1936
2053
|
id,
|
|
1937
|
-
className
|
|
2054
|
+
className,
|
|
2055
|
+
...props
|
|
1938
2056
|
}, ref) {
|
|
1939
2057
|
const primeRef = react.useRef(null);
|
|
1940
2058
|
react.useImperativeHandle(ref, () => primeRef.current?.getElement());
|
|
@@ -1946,6 +2064,7 @@ var Paginator = react.forwardRef(function Paginator2({
|
|
|
1946
2064
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1947
2065
|
paginator.Paginator,
|
|
1948
2066
|
{
|
|
2067
|
+
...props,
|
|
1949
2068
|
unstyled: true,
|
|
1950
2069
|
ref: primeRef,
|
|
1951
2070
|
id,
|
|
@@ -2033,7 +2152,8 @@ var Radio = react.forwardRef(function Radio2({
|
|
|
2033
2152
|
required,
|
|
2034
2153
|
id,
|
|
2035
2154
|
className,
|
|
2036
|
-
style
|
|
2155
|
+
style,
|
|
2156
|
+
...props
|
|
2037
2157
|
}, ref) {
|
|
2038
2158
|
const autoId = react.useId();
|
|
2039
2159
|
const inputId = id ?? autoId;
|
|
@@ -2059,7 +2179,7 @@ var Radio = react.forwardRef(function Radio2({
|
|
|
2059
2179
|
pt: {
|
|
2060
2180
|
// Marcado pela prop do Cristal, não pelo atributo interno do Prime (data-p-checked).
|
|
2061
2181
|
root: { className: `cr-radio__control${checked ? " cr-radio__control--checked" : ""}` },
|
|
2062
|
-
input: { className: "cr-radio__input" },
|
|
2182
|
+
input: { ...props, className: "cr-radio__input" },
|
|
2063
2183
|
box: { className: "cr-radio__box" },
|
|
2064
2184
|
icon: { className: "cr-radio__icon" }
|
|
2065
2185
|
}
|
|
@@ -2076,7 +2196,15 @@ var Radio = react.forwardRef(function Radio2({
|
|
|
2076
2196
|
] });
|
|
2077
2197
|
});
|
|
2078
2198
|
var porcentagem = (posicao, total, visivel) => total > visivel ? Math.round(posicao / (total - visivel) * 100) : 0;
|
|
2079
|
-
var ScrollPanel = react.forwardRef(function ScrollPanel2({
|
|
2199
|
+
var ScrollPanel = react.forwardRef(function ScrollPanel2({
|
|
2200
|
+
children,
|
|
2201
|
+
"aria-label": ariaLabel,
|
|
2202
|
+
"aria-labelledby": ariaLabelledBy,
|
|
2203
|
+
style,
|
|
2204
|
+
id,
|
|
2205
|
+
className,
|
|
2206
|
+
...props
|
|
2207
|
+
}, ref) {
|
|
2080
2208
|
const primeRef = react.useRef(null);
|
|
2081
2209
|
react.useImperativeHandle(ref, () => primeRef.current?.getElement());
|
|
2082
2210
|
const contentId = `${react.useId()}-content`;
|
|
@@ -2111,7 +2239,7 @@ var ScrollPanel = react.forwardRef(function ScrollPanel2({ children, "aria-label
|
|
|
2111
2239
|
barx: barra("horizontal", posicao.x),
|
|
2112
2240
|
bary: barra("vertical", posicao.y)
|
|
2113
2241
|
};
|
|
2114
|
-
return /* @__PURE__ */ jsxRuntime.jsx(scrollpanel.ScrollPanel, { unstyled: true, ref: primeRef, id, pt, children });
|
|
2242
|
+
return /* @__PURE__ */ jsxRuntime.jsx(scrollpanel.ScrollPanel, { ...props, unstyled: true, ref: primeRef, id, pt, children });
|
|
2115
2243
|
});
|
|
2116
2244
|
var SegmentControl = react.forwardRef(
|
|
2117
2245
|
function SegmentControl2({
|
|
@@ -2123,7 +2251,8 @@ var SegmentControl = react.forwardRef(
|
|
|
2123
2251
|
"aria-labelledby": ariaLabelledBy,
|
|
2124
2252
|
disabled,
|
|
2125
2253
|
id,
|
|
2126
|
-
className
|
|
2254
|
+
className,
|
|
2255
|
+
...props
|
|
2127
2256
|
}, ref) {
|
|
2128
2257
|
const primeRef = react.useRef(null);
|
|
2129
2258
|
react.useImperativeHandle(ref, () => primeRef.current?.getElement());
|
|
@@ -2131,6 +2260,7 @@ var SegmentControl = react.forwardRef(
|
|
|
2131
2260
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2132
2261
|
selectbutton.SelectButton,
|
|
2133
2262
|
{
|
|
2263
|
+
...props,
|
|
2134
2264
|
unstyled: true,
|
|
2135
2265
|
ref: primeRef,
|
|
2136
2266
|
id,
|
|
@@ -2175,7 +2305,8 @@ var Switch = react.forwardRef(function Switch2({
|
|
|
2175
2305
|
name,
|
|
2176
2306
|
id,
|
|
2177
2307
|
className,
|
|
2178
|
-
style
|
|
2308
|
+
style,
|
|
2309
|
+
...props
|
|
2179
2310
|
}, ref) {
|
|
2180
2311
|
const autoId = react.useId();
|
|
2181
2312
|
const inputId = id ?? autoId;
|
|
@@ -2204,7 +2335,7 @@ var Switch = react.forwardRef(function Switch2({
|
|
|
2204
2335
|
role: void 0,
|
|
2205
2336
|
"aria-checked": void 0
|
|
2206
2337
|
},
|
|
2207
|
-
input: { className: "cr-switch__input" },
|
|
2338
|
+
input: { ...props, className: "cr-switch__input" },
|
|
2208
2339
|
slider: { className: "cr-switch__track" }
|
|
2209
2340
|
}
|
|
2210
2341
|
}
|
|
@@ -2222,7 +2353,7 @@ var Switch = react.forwardRef(function Switch2({
|
|
|
2222
2353
|
function TabPanel(_props) {
|
|
2223
2354
|
return null;
|
|
2224
2355
|
}
|
|
2225
|
-
var Tabs = react.forwardRef(function Tabs2({ activeIndex, onTabChange, children, id, className }, ref) {
|
|
2356
|
+
var Tabs = react.forwardRef(function Tabs2({ activeIndex, onTabChange, children, id, className, ...props }, ref) {
|
|
2226
2357
|
const primeRef = react.useRef(null);
|
|
2227
2358
|
react.useImperativeHandle(ref, () => primeRef.current?.getElement());
|
|
2228
2359
|
const [interno, setInterno] = react.useState(0);
|
|
@@ -2265,6 +2396,7 @@ var Tabs = react.forwardRef(function Tabs2({ activeIndex, onTabChange, children,
|
|
|
2265
2396
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2266
2397
|
tabview.TabView,
|
|
2267
2398
|
{
|
|
2399
|
+
...props,
|
|
2268
2400
|
unstyled: true,
|
|
2269
2401
|
ref: primeRef,
|
|
2270
2402
|
id,
|
|
@@ -2357,6 +2489,7 @@ var Toast = react.forwardRef(function Toast2({ position = "top-right", closeLabe
|
|
|
2357
2489
|
classNames: {
|
|
2358
2490
|
enter: "cr-toast__message--enter",
|
|
2359
2491
|
enterActive: "cr-toast__message--enter-active",
|
|
2492
|
+
exit: "cr-toast__message--exit",
|
|
2360
2493
|
exitActive: "cr-toast__message--exit-active"
|
|
2361
2494
|
}
|
|
2362
2495
|
}
|