@vector-business-services/cristal-ds-web 0.20.0 → 0.21.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
@@ -16,9 +16,11 @@ var checkbox = require('primereact/checkbox');
16
16
  var chip = require('primereact/chip');
17
17
  var contextmenu = require('primereact/contextmenu');
18
18
  var menu = require('primereact/menu');
19
+ var overlaypanel = require('primereact/overlaypanel');
20
+ var inputtext = require('primereact/inputtext');
21
+ var radiobutton = require('primereact/radiobutton');
19
22
  var divider = require('primereact/divider');
20
23
  var sidebar = require('primereact/sidebar');
21
- var inputtext = require('primereact/inputtext');
22
24
  var menubar = require('primereact/menubar');
23
25
  var tag = require('primereact/tag');
24
26
  var message = require('primereact/message');
@@ -28,7 +30,6 @@ var tabmenu = require('primereact/tabmenu');
28
30
  var paginator = require('primereact/paginator');
29
31
  var dropdown = require('primereact/dropdown');
30
32
  var panel = require('primereact/panel');
31
- var radiobutton = require('primereact/radiobutton');
32
33
  var scrollpanel = require('primereact/scrollpanel');
33
34
  var selectbutton = require('primereact/selectbutton');
34
35
  var skeleton = require('primereact/skeleton');
@@ -313,16 +314,16 @@ api.addLocale(LOCALE, {
313
314
  nextDecade: "Pr\xF3xima d\xE9cada"
314
315
  });
315
316
  function seguirFocoDoDia(event) {
316
- const dia = event.target;
317
- if (!(dia instanceof HTMLElement) || !dia.classList.contains("cr-calendar__date")) return;
318
- const painel = dia.closest(".cr-calendar");
319
- const td = dia.closest("td");
320
- const mes = dia.closest(".cr-calendar__month");
317
+ const dia2 = event.target;
318
+ if (!(dia2 instanceof HTMLElement) || !dia2.classList.contains("cr-calendar__date")) return;
319
+ const painel = dia2.closest(".cr-calendar");
320
+ const td = dia2.closest("td");
321
+ const mes = dia2.closest(".cr-calendar__month");
321
322
  if (!painel || !td || !mes || event.relatedTarget) return;
322
323
  const indice = [...painel.querySelectorAll(".cr-calendar__month")].indexOf(mes);
323
324
  const { pDay, pMonth, pYear } = td.dataset;
324
325
  requestAnimationFrame(() => {
325
- if (dia.isConnected || document.activeElement !== document.body) return;
326
+ if (dia2.isConnected || document.activeElement !== document.body) return;
326
327
  const novo = painel.querySelectorAll(".cr-calendar__month")[indice]?.querySelector(
327
328
  `td[data-p-day="${pDay}"][data-p-month="${pMonth}"][data-p-year="${pYear}"] .cr-calendar__date`
328
329
  );
@@ -337,26 +338,26 @@ var setas = {
337
338
  prevIcon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-icon-button__icon", children: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretLeft, {}) }),
338
339
  nextIcon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-icon-button__icon", children: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretRight, {}) })
339
340
  };
340
- var mesmoDia = (data, dia) => data instanceof Date && data.getDate() === dia.day && data.getMonth() === dia.month && data.getFullYear() === dia.year;
341
- var chave = (dia) => dia.year * 1e4 + dia.month * 100 + dia.day;
341
+ var mesmoDia = (data, dia2) => data instanceof Date && data.getDate() === dia2.day && data.getMonth() === dia2.month && data.getFullYear() === dia2.year;
342
+ var chave = (dia2) => dia2.year * 1e4 + dia2.month * 100 + dia2.day;
342
343
  var chaveDe = (data) => chave({ day: data.getDate(), month: data.getMonth(), year: data.getFullYear() });
343
- function escolhido(props, dia) {
344
+ function escolhido(props, dia2) {
344
345
  const { value } = props;
345
- if (value instanceof Date) return mesmoDia(value, dia);
346
+ if (value instanceof Date) return mesmoDia(value, dia2);
346
347
  if (!Array.isArray(value)) return false;
347
348
  if (props.selectionMode === "range") {
348
349
  const [inicio, fim] = value;
349
350
  if (!inicio) return false;
350
- return chave(dia) >= chaveDe(inicio) && chave(dia) <= chaveDe(fim ?? inicio);
351
+ return chave(dia2) >= chaveDe(inicio) && chave(dia2) <= chaveDe(fim ?? inicio);
351
352
  }
352
- return value.some((data) => mesmoDia(data, dia));
353
+ return value.some((data) => mesmoDia(data, dia2));
353
354
  }
354
- function noPeriodo(props, dia) {
355
+ function noPeriodo(props, dia2) {
355
356
  if (props.selectionMode !== "range" || !Array.isArray(props.value)) return void 0;
356
357
  const [inicio, fim] = props.value;
357
- if (mesmoDia(inicio, dia) || mesmoDia(fim, dia)) return "cr-calendar__day--edge";
358
+ if (mesmoDia(inicio, dia2) || mesmoDia(fim, dia2)) return "cr-calendar__day--edge";
358
359
  if (inicio && fim) {
359
- const data = new Date(dia.year, dia.month, dia.day);
360
+ const data = new Date(dia2.year, dia2.month, dia2.day);
360
361
  if (data > inicio && data < fim) return "cr-calendar__day--middle";
361
362
  }
362
363
  return void 0;
@@ -379,20 +380,20 @@ function ptDoPainel(offDays = []) {
379
380
  table: { className: "cr-calendar__table" },
380
381
  tableHeaderCell: { className: "cr-calendar__weekday" },
381
382
  day: ({ props, context }) => {
382
- const dia = context.date;
383
+ const dia2 = context.date;
383
384
  const meses = api.localeOption("monthNames", props.locale ?? LOCALE);
384
385
  return {
385
386
  // O Prime põe o escolhido e o desabilitado no <span> do dia, que não tem papel: eles vão
386
387
  // para a célula da grade (gridcell). O nome da célula inclui o número que aparece nela.
387
- "aria-selected": escolhido(props, dia),
388
- "aria-disabled": dia.selectable ? void 0 : true,
389
- "aria-label": `${dia.day} de ${meses[dia.month]?.toLowerCase()} de ${dia.year}`,
388
+ "aria-selected": escolhido(props, dia2),
389
+ "aria-disabled": dia2.selectable ? void 0 : true,
390
+ "aria-label": `${dia2.day} de ${meses[dia2.month]?.toLowerCase()} de ${dia2.year}`,
390
391
  className: classes(
391
392
  "cr-calendar__day",
392
393
  context.today && "cr-calendar__day--today",
393
394
  context.otherMonth && "cr-calendar__day--other-month",
394
- offDays.some((data) => mesmoDia(data, dia)) && "cr-calendar__day--off",
395
- noPeriodo(props, dia)
395
+ offDays.some((data) => mesmoDia(data, dia2)) && "cr-calendar__day--off",
396
+ noPeriodo(props, dia2)
396
397
  )
397
398
  };
398
399
  },
@@ -1221,6 +1222,423 @@ function DatePickerBase({
1221
1222
  ] });
1222
1223
  }
1223
1224
  var DatePicker = react.forwardRef(DatePickerBase);
1225
+ var Input = react.forwardRef(function Input2({
1226
+ variant = "outline",
1227
+ size = "large",
1228
+ label,
1229
+ leadingIcon,
1230
+ trailingIcon,
1231
+ hint,
1232
+ error,
1233
+ id,
1234
+ required,
1235
+ disabled,
1236
+ className,
1237
+ ...props
1238
+ }, ref) {
1239
+ const autoId = react.useId();
1240
+ const inputId = id ?? autoId;
1241
+ const hintId = `${inputId}-hint`;
1242
+ const supportText = error ?? hint;
1243
+ const classes2 = [
1244
+ "cr-field",
1245
+ `cr-field--${variant}`,
1246
+ `cr-field--${size}`,
1247
+ error && "cr-field--error",
1248
+ disabled && "cr-field--disabled",
1249
+ className
1250
+ ].filter(Boolean).join(" ");
1251
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes2, children: [
1252
+ label && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "cr-field__label", htmlFor: inputId, children: [
1253
+ label,
1254
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__required", "aria-hidden": "true", children: "*" })
1255
+ ] }),
1256
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-field__control", children: [
1257
+ leadingIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__icon", "aria-hidden": "true", children: leadingIcon }),
1258
+ /* @__PURE__ */ jsxRuntime.jsx(
1259
+ inputtext.InputText,
1260
+ {
1261
+ unstyled: true,
1262
+ ref,
1263
+ id: inputId,
1264
+ className: "cr-field__input",
1265
+ required,
1266
+ disabled,
1267
+ invalid: Boolean(error),
1268
+ "aria-invalid": error ? true : void 0,
1269
+ ...props,
1270
+ "aria-describedby": juntarIds(supportText && hintId, props["aria-describedby"])
1271
+ }
1272
+ ),
1273
+ trailingIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__icon", children: trailingIcon })
1274
+ ] }),
1275
+ supportText && /* @__PURE__ */ jsxRuntime.jsxs("p", { id: hintId, className: `cr-field__hint${error ? " cr-field__hint--error" : ""}`, children: [
1276
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__hint-icon", "aria-hidden": "true", children: error ? /* @__PURE__ */ jsxRuntime.jsx(react$1.WarningCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(react$1.Info, {}) }),
1277
+ supportText
1278
+ ] })
1279
+ ] });
1280
+ });
1281
+ var Radio = react.forwardRef(function Radio2({
1282
+ label,
1283
+ showLabel = true,
1284
+ labelSize = "default",
1285
+ checked = false,
1286
+ value,
1287
+ name,
1288
+ onChange,
1289
+ disabled,
1290
+ required,
1291
+ id,
1292
+ className,
1293
+ style,
1294
+ ...props
1295
+ }, ref) {
1296
+ const autoId = react.useId();
1297
+ const inputId = id ?? autoId;
1298
+ const classes2 = [
1299
+ "cr-radio",
1300
+ `cr-radio--label-${labelSize}`,
1301
+ disabled && "cr-radio--disabled",
1302
+ className
1303
+ ].filter(Boolean).join(" ");
1304
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes2, style, children: [
1305
+ /* @__PURE__ */ jsxRuntime.jsx(
1306
+ radiobutton.RadioButton,
1307
+ {
1308
+ unstyled: true,
1309
+ inputRef: ref,
1310
+ inputId,
1311
+ checked,
1312
+ value,
1313
+ name,
1314
+ onChange,
1315
+ disabled,
1316
+ required,
1317
+ pt: {
1318
+ // Marcado pela prop do Cristal, não pelo atributo interno do Prime (data-p-checked).
1319
+ root: { className: `cr-radio__control${checked ? " cr-radio__control--checked" : ""}` },
1320
+ input: { ...props, className: "cr-radio__input" },
1321
+ box: { className: "cr-radio__box" },
1322
+ icon: { className: "cr-radio__icon" }
1323
+ }
1324
+ }
1325
+ ),
1326
+ /* @__PURE__ */ jsxRuntime.jsx(
1327
+ "label",
1328
+ {
1329
+ className: `cr-radio__label${showLabel ? "" : " cr-radio__label--hidden cr-so-leitor"}`,
1330
+ htmlFor: inputId,
1331
+ children: label
1332
+ }
1333
+ )
1334
+ ] });
1335
+ });
1336
+
1337
+ // src/components/DateRangeButton/periodos.ts
1338
+ var dia = (ano, mes, numero) => new Date(ano, mes, numero);
1339
+ var semHora = (data) => dia(data.getFullYear(), data.getMonth(), data.getDate());
1340
+ var menos = (data, dias) => dia(data.getFullYear(), data.getMonth(), data.getDate() - dias);
1341
+ var DATE_PERIODS = {
1342
+ today: { label: "Hoje", range: (hoje) => [semHora(hoje), semHora(hoje)] },
1343
+ yesterday: { label: "Ontem", range: (hoje) => [menos(hoje, 1), menos(hoje, 1)] },
1344
+ last7Days: { label: "\xDAltimos 7 dias", range: (hoje) => [menos(hoje, 6), semHora(hoje)] },
1345
+ last14Days: { label: "\xDAltimos 14 dias", range: (hoje) => [menos(hoje, 13), semHora(hoje)] },
1346
+ last30Days: { label: "\xDAltimos 30 dias", range: (hoje) => [menos(hoje, 29), semHora(hoje)] },
1347
+ thisMonth: {
1348
+ label: "Este m\xEAs",
1349
+ range: (hoje) => [dia(hoje.getFullYear(), hoje.getMonth(), 1), semHora(hoje)]
1350
+ },
1351
+ // A semana começa no domingo, como no calendário.
1352
+ lastWeek: {
1353
+ label: "Semana passada",
1354
+ range: (hoje) => {
1355
+ const domingo = menos(hoje, hoje.getDay() + 7);
1356
+ return [domingo, menos(domingo, -6)];
1357
+ }
1358
+ },
1359
+ lastMonth: {
1360
+ label: "M\xEAs passado",
1361
+ range: (hoje) => [
1362
+ dia(hoje.getFullYear(), hoje.getMonth() - 1, 1),
1363
+ dia(hoje.getFullYear(), hoje.getMonth(), 0)
1364
+ ]
1365
+ },
1366
+ thisYear: {
1367
+ label: "Este ano",
1368
+ range: (hoje) => [dia(hoje.getFullYear(), 0, 1), semHora(hoje)]
1369
+ }
1370
+ };
1371
+ var PERIODOS_PADRAO = [
1372
+ DATE_PERIODS.today,
1373
+ DATE_PERIODS.yesterday,
1374
+ DATE_PERIODS.last7Days,
1375
+ DATE_PERIODS.last14Days,
1376
+ DATE_PERIODS.last30Days,
1377
+ DATE_PERIODS.thisMonth
1378
+ ];
1379
+ var MESES = ["jan", "fev", "mar", "abr", "mai", "jun", "jul", "ago", "set", "out", "nov", "dez"];
1380
+ var dataPorExtenso = (data) => `${data.getDate()} de ${MESES[data.getMonth()]} de ${data.getFullYear()}`;
1381
+ var periodoPorExtenso = ([inicio, fim]) => `${dataPorExtenso(inicio)} a ${dataPorExtenso(fim)}`;
1382
+ var mesmoDia2 = (a, b) => !!a && !!b && semHora(a).getTime() === semHora(b).getTime();
1383
+ var periodoDe = (periods, range, hoje) => range ? periods.find((period) => {
1384
+ const [inicio, fim] = period.range(hoje);
1385
+ return mesmoDia2(inicio, range[0]) && mesmoDia2(fim, range[1]);
1386
+ }) : void 0;
1387
+ var dataCurta = (data) => data ? `${String(data.getDate()).padStart(2, "0")}/${String(data.getMonth() + 1).padStart(2, "0")}/${data.getFullYear()}` : "";
1388
+ function lerData(texto) {
1389
+ const partes = /^(\d{2})\/(\d{2})\/(\d{4})$/.exec(texto.replace(/\s/g, ""));
1390
+ if (!partes) return null;
1391
+ const [d, m, a] = [Number(partes[1]), Number(partes[2]), Number(partes[3])];
1392
+ const data = dia(a, m - 1, d);
1393
+ return data.getMonth() === m - 1 && data.getDate() === d ? data : null;
1394
+ }
1395
+ function mesDaTela(range, meses, hoje) {
1396
+ const base = (meses > 1 ? range[1] : range[0]) ?? range[0] ?? hoje;
1397
+ return new Date(base.getFullYear(), base.getMonth() - (meses > 1 ? 1 : 0), 1);
1398
+ }
1399
+ function PainelDePeriodo({
1400
+ value,
1401
+ periods,
1402
+ footer,
1403
+ today,
1404
+ numberOfMonths,
1405
+ minDate,
1406
+ maxDate,
1407
+ disabledDates,
1408
+ offDays,
1409
+ onSelect,
1410
+ onClose
1411
+ }) {
1412
+ const grupo = react.useId();
1413
+ const [rascunho, setRascunho] = react.useState(value ?? [null, null]);
1414
+ const [periodo, setPeriodo] = react.useState(() => periodoDe(periods, value, today) ?? null);
1415
+ const [textos, setTextos] = react.useState([
1416
+ dataCurta(value?.[0]),
1417
+ dataCurta(value?.[1])
1418
+ ]);
1419
+ const [mes, setMes] = react.useState(() => mesDaTela(rascunho, numberOfMonths, today));
1420
+ const mudar = (novo, novoPeriodo, mudarTextos = true) => {
1421
+ setRascunho(novo);
1422
+ setPeriodo(novoPeriodo);
1423
+ if (mudarTextos) setTextos([dataCurta(novo[0]), dataCurta(novo[1])]);
1424
+ if (!footer && novo[0] && novo[1]) onSelect([novo[0], novo[1]], novoPeriodo);
1425
+ };
1426
+ const escolherPeriodo = (item) => {
1427
+ const range = item.range(today);
1428
+ setMes(mesDaTela(range, numberOfMonths, today));
1429
+ mudar(range, item);
1430
+ };
1431
+ const digitar = (indice, texto) => {
1432
+ const novosTextos = [...textos];
1433
+ novosTextos[indice] = texto;
1434
+ setTextos(novosTextos);
1435
+ const data = lerData(texto);
1436
+ if (!data) return;
1437
+ const novo = [...rascunho];
1438
+ novo[indice] = data;
1439
+ if (novo[0] && novo[1] && novo[0] > novo[1]) novo[indice === 0 ? 1 : 0] = null;
1440
+ setMes(mesDaTela(novo, numberOfMonths, today));
1441
+ mudar(novo, null, false);
1442
+ };
1443
+ const [inicio, fim] = rascunho;
1444
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-date-range", children: [
1445
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-date-range__body", children: [
1446
+ periods.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cr-date-range__periods", role: "radiogroup", "aria-label": "Per\xEDodos", children: periods.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
1447
+ Radio,
1448
+ {
1449
+ className: "cr-date-range__period",
1450
+ name: grupo,
1451
+ label: item.label,
1452
+ value: item.label,
1453
+ checked: periodo === item,
1454
+ onChange: () => escolherPeriodo(item)
1455
+ },
1456
+ item.label
1457
+ )) }),
1458
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-date-range__calendars", children: [
1459
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-date-range__inputs", children: [
1460
+ /* @__PURE__ */ jsxRuntime.jsx(
1461
+ Input,
1462
+ {
1463
+ size: "medium",
1464
+ "aria-label": "Data inicial",
1465
+ placeholder: "dd / mm / aaaa",
1466
+ value: textos[0],
1467
+ onChange: (event) => digitar(0, event.target.value)
1468
+ }
1469
+ ),
1470
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-date-range__dash", "aria-hidden": "true", children: "-" }),
1471
+ /* @__PURE__ */ jsxRuntime.jsx(
1472
+ Input,
1473
+ {
1474
+ size: "medium",
1475
+ "aria-label": "Data final",
1476
+ placeholder: "dd / mm / aaaa",
1477
+ value: textos[1],
1478
+ onChange: (event) => digitar(1, event.target.value)
1479
+ }
1480
+ )
1481
+ ] }),
1482
+ /* @__PURE__ */ jsxRuntime.jsx(
1483
+ Calendar,
1484
+ {
1485
+ selectionMode: "range",
1486
+ numberOfMonths,
1487
+ value: rascunho,
1488
+ viewDate: mes,
1489
+ onViewDateChange: (event) => setMes(event.value),
1490
+ onChange: (event) => {
1491
+ const [inicio2 = null, fim2 = null] = event.value ?? [];
1492
+ mudar([inicio2, fim2], null);
1493
+ },
1494
+ minDate,
1495
+ maxDate,
1496
+ disabledDates,
1497
+ offDays
1498
+ }
1499
+ )
1500
+ ] })
1501
+ ] }),
1502
+ footer && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-date-range__footer", children: [
1503
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "tertiary", size: "medium", onClick: onClose, children: "Fechar" }),
1504
+ /* @__PURE__ */ jsxRuntime.jsx(
1505
+ Button,
1506
+ {
1507
+ size: "medium",
1508
+ disabled: !inicio || !fim,
1509
+ onClick: () => inicio && fim && onSelect([inicio, fim], periodo),
1510
+ children: "Selecionar"
1511
+ }
1512
+ )
1513
+ ] })
1514
+ ] });
1515
+ }
1516
+ var DateRangeButton = react.forwardRef(
1517
+ function DateRangeButton2({
1518
+ value = null,
1519
+ onChange,
1520
+ label,
1521
+ required,
1522
+ placeholder = "Selecione o per\xEDodo",
1523
+ periods = PERIODOS_PADRAO,
1524
+ footer = true,
1525
+ numberOfMonths = 2,
1526
+ minDate,
1527
+ maxDate,
1528
+ disabledDates,
1529
+ offDays,
1530
+ today,
1531
+ disabled,
1532
+ id,
1533
+ className,
1534
+ style
1535
+ }, ref) {
1536
+ const autoId = react.useId();
1537
+ const botaoId = id ?? autoId;
1538
+ const rotuloId = `${botaoId}-rotulo`;
1539
+ const textoId = `${botaoId}-texto`;
1540
+ const painelId = `${botaoId}-painel`;
1541
+ const painel = react.useRef(null);
1542
+ const botao = react.useRef(null);
1543
+ const [aberto, setAberto] = react.useState(false);
1544
+ const [hoje, setHoje] = react.useState(() => today ?? /* @__PURE__ */ new Date());
1545
+ const periodo = periodoDe(periods, value, today ?? hoje);
1546
+ const classes2 = ["cr-field", "cr-date-range-field", disabled && "cr-field--disabled", className].filter(Boolean).join(" ");
1547
+ const fechar = () => painel.current?.hide();
1548
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes2, style, children: [
1549
+ label && /* @__PURE__ */ jsxRuntime.jsxs("span", { id: rotuloId, className: "cr-field__label", children: [
1550
+ label,
1551
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__required", "aria-hidden": "true", children: "*" })
1552
+ ] }),
1553
+ /* @__PURE__ */ jsxRuntime.jsxs(
1554
+ button.Button,
1555
+ {
1556
+ unstyled: true,
1557
+ ref: (elemento) => {
1558
+ const el = elemento;
1559
+ botao.current = el;
1560
+ if (typeof ref === "function") ref(el);
1561
+ else if (ref) ref.current = el;
1562
+ },
1563
+ id: botaoId,
1564
+ type: "button",
1565
+ className: "cr-date-range-button",
1566
+ disabled,
1567
+ "aria-haspopup": "dialog",
1568
+ "aria-expanded": aberto,
1569
+ "aria-controls": aberto ? painelId : void 0,
1570
+ "aria-labelledby": label ? `${rotuloId} ${textoId}` : void 0,
1571
+ onClick: (event) => {
1572
+ setHoje(today ?? /* @__PURE__ */ new Date());
1573
+ painel.current?.toggle(event);
1574
+ },
1575
+ children: [
1576
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-date-range-button__icon", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(react$1.CalendarDots, {}) }),
1577
+ /* @__PURE__ */ jsxRuntime.jsx("span", { id: textoId, className: "cr-date-range-button__text", children: value ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1578
+ periodo && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "cr-date-range-button__period", children: [
1579
+ periodo.label,
1580
+ ":"
1581
+ ] }),
1582
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: periodoPorExtenso(value) })
1583
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-date-range-button__placeholder", children: placeholder }) }),
1584
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-date-range-button__caret", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDown, {}) })
1585
+ ]
1586
+ }
1587
+ ),
1588
+ /* @__PURE__ */ jsxRuntime.jsx(
1589
+ overlaypanel.OverlayPanel,
1590
+ {
1591
+ ref: painel,
1592
+ unstyled: true,
1593
+ id: painelId,
1594
+ onShow: () => {
1595
+ setAberto(true);
1596
+ const raiz = document.getElementById(painelId);
1597
+ const alvo = raiz?.querySelector('input[type="radio"]:checked') ?? raiz?.querySelector('input, button, [tabindex="0"]');
1598
+ alvo?.focus();
1599
+ },
1600
+ onHide: () => {
1601
+ setAberto(false);
1602
+ const ativo = document.activeElement;
1603
+ if (ativo === document.body || document.getElementById(painelId)?.contains(ativo)) {
1604
+ botao.current?.focus();
1605
+ }
1606
+ },
1607
+ pt: {
1608
+ root: {
1609
+ className: "cr-date-range__panel",
1610
+ role: "dialog",
1611
+ "aria-label": label ?? "Escolher per\xEDodo"
1612
+ },
1613
+ // Animação de entrada e saída (a do Prime) e o lado do painel em relação ao botão.
1614
+ transition: transicaoDoPopup(
1615
+ () => seguirLado(document.getElementById(painelId), botao.current)
1616
+ )
1617
+ },
1618
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1619
+ PainelDePeriodo,
1620
+ {
1621
+ value,
1622
+ periods,
1623
+ footer,
1624
+ today: today ?? hoje,
1625
+ numberOfMonths,
1626
+ minDate,
1627
+ maxDate,
1628
+ disabledDates,
1629
+ offDays,
1630
+ onClose: fechar,
1631
+ onSelect: (range, item) => {
1632
+ onChange?.({ value: range, period: item });
1633
+ fechar();
1634
+ }
1635
+ }
1636
+ )
1637
+ }
1638
+ )
1639
+ ] });
1640
+ }
1641
+ );
1224
1642
  var Divider = react.forwardRef(function Divider2({ orientation = "horizontal", variant = "solid", className, style, ...props }, ref) {
1225
1643
  const primeRef = react.useRef(null);
1226
1644
  react.useImperativeHandle(ref, () => primeRef.current?.getElement());
@@ -1445,62 +1863,6 @@ var Drawer = react.forwardRef(function Drawer2({
1445
1863
  }
1446
1864
  );
1447
1865
  });
1448
- var Input = react.forwardRef(function Input2({
1449
- variant = "outline",
1450
- size = "large",
1451
- label,
1452
- leadingIcon,
1453
- trailingIcon,
1454
- hint,
1455
- error,
1456
- id,
1457
- required,
1458
- disabled,
1459
- className,
1460
- ...props
1461
- }, ref) {
1462
- const autoId = react.useId();
1463
- const inputId = id ?? autoId;
1464
- const hintId = `${inputId}-hint`;
1465
- const supportText = error ?? hint;
1466
- const classes2 = [
1467
- "cr-field",
1468
- `cr-field--${variant}`,
1469
- `cr-field--${size}`,
1470
- error && "cr-field--error",
1471
- disabled && "cr-field--disabled",
1472
- className
1473
- ].filter(Boolean).join(" ");
1474
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes2, children: [
1475
- label && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "cr-field__label", htmlFor: inputId, children: [
1476
- label,
1477
- required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__required", "aria-hidden": "true", children: "*" })
1478
- ] }),
1479
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-field__control", children: [
1480
- leadingIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__icon", "aria-hidden": "true", children: leadingIcon }),
1481
- /* @__PURE__ */ jsxRuntime.jsx(
1482
- inputtext.InputText,
1483
- {
1484
- unstyled: true,
1485
- ref,
1486
- id: inputId,
1487
- className: "cr-field__input",
1488
- required,
1489
- disabled,
1490
- invalid: Boolean(error),
1491
- "aria-invalid": error ? true : void 0,
1492
- ...props,
1493
- "aria-describedby": juntarIds(supportText && hintId, props["aria-describedby"])
1494
- }
1495
- ),
1496
- trailingIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__icon", children: trailingIcon })
1497
- ] }),
1498
- supportText && /* @__PURE__ */ jsxRuntime.jsxs("p", { id: hintId, className: `cr-field__hint${error ? " cr-field__hint--error" : ""}`, children: [
1499
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__hint-icon", "aria-hidden": "true", children: error ? /* @__PURE__ */ jsxRuntime.jsx(react$1.WarningCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(react$1.Info, {}) }),
1500
- supportText
1501
- ] })
1502
- ] });
1503
- });
1504
1866
 
1505
1867
  // src/components/Menubar/assets/vector-logo-simbolo.svg
1506
1868
  var vector_logo_simbolo_default = 'data:image/svg+xml,<svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="42.7061" height="20" viewBox="0 0 42.7061 20" fill="none" xmlns="http://www.w3.org/2000/svg">%0A<g id="Grupo 2380">%0A<path id="Caminho 1049" d="M26.8782 10.21C26.8393 10.1525 26.7869 10.1055 26.7255 10.0731C26.6642 10.0408 26.5958 10.024 26.5264 10.0244H4.21626C4.14666 10.024 4.07803 10.0408 4.0165 10.0733C3.95497 10.1059 3.90244 10.1531 3.8636 10.2109C3.82535 10.2676 3.80224 10.3333 3.79648 10.4015C3.79072 10.4697 3.80251 10.5383 3.8307 10.6007L7.35895 19.7545C7.39283 19.8281 7.44722 19.8905 7.51559 19.934C7.58397 19.9776 7.66345 20.0005 7.74451 20C7.82641 19.9998 7.90647 19.9758 7.97493 19.9308C8.0434 19.8859 8.09731 19.822 8.13007 19.7469L11.5604 13.47H25.3511C25.4325 13.4705 25.5123 13.4474 25.5809 13.4035C25.6494 13.3596 25.7038 13.2969 25.7375 13.2228L26.9086 10.5964C26.9365 10.5347 26.9484 10.4669 26.9431 10.3993C26.9378 10.3318 26.9154 10.2666 26.8782 10.21V10.21Z" fill="%23C1BFBF"/>%0A<g id="Grupo 2378">%0A<path id="Caminho 1050" d="M26.3926 6.06543L24.0666 19.1424C24.0588 19.2502 24.0736 19.3585 24.1103 19.4602C24.1469 19.5619 24.2045 19.6549 24.2792 19.7329C24.3554 19.813 24.447 19.8767 24.5485 19.9202C24.65 19.9637 24.7593 19.9861 24.8698 19.986H30.4229L29.2578 13.5446L26.3926 6.06543Z" fill="%231545DE"/>%0A<g id="Grupo 2377">%0A<path id="Caminho 1051" d="M42.2783 16.0921H42.0598C42.0303 11.9033 41.8911 10.7668 41.2541 10.086C40.167 9.29536 38.9793 8.65329 37.7225 8.17676C37.1378 7.91016 36.4755 7.60812 36.3684 7.52881C36.1102 7.27149 34.8768 5.05179 34.2145 3.85884C33.9378 3.36107 33.6956 2.92488 33.5311 2.63887C33.166 1.80107 32.5487 1.09795 31.7653 0.627372C30.9818 0.15679 30.0712 -0.0578392 29.16 0.0133599H21.1072C21.036 0.0134652 20.966 0.0313585 20.9036 0.0653944C20.8411 0.0994303 20.7881 0.148532 20.7494 0.208251C20.7106 0.268417 20.6872 0.337237 20.6813 0.408613C20.6754 0.479989 20.6872 0.551716 20.7157 0.617433L28.9955 19.7283C29.0285 19.8051 29.0832 19.8705 29.1529 19.9166C29.2226 19.9626 29.3043 19.9872 29.3878 19.9873H30.9849C31.0972 19.9869 31.2048 19.9425 31.2848 19.8637C31.3648 19.7848 31.4107 19.6778 31.4126 19.5655C31.4126 18.581 31.8037 17.6368 32.4999 16.9406C33.1961 16.2444 34.1403 15.8533 35.1248 15.8533C36.1093 15.8533 37.0535 16.2444 37.7497 16.9406C38.4459 17.6368 38.837 18.581 38.837 19.5655C38.839 19.6778 38.8848 19.7848 38.9648 19.8637C39.0447 19.9425 39.1524 19.9869 39.2647 19.9873H41.6396C41.6961 19.9871 41.752 19.9758 41.8041 19.9539C41.8561 19.9321 41.9034 19.9002 41.9431 19.8601C41.9828 19.82 42.0143 19.7724 42.0356 19.7201C42.0569 19.6678 42.0677 19.6119 42.0674 19.5554C42.0674 19.2179 42.0674 18.9015 42.0674 18.5911H42.2783C42.3923 18.5904 42.5013 18.5445 42.5815 18.4636C42.6617 18.3826 42.7065 18.2731 42.7061 18.1591V16.5241C42.7065 16.4101 42.6617 16.3006 42.5815 16.2196C42.5013 16.1386 42.3923 16.0928 42.2783 16.0921V16.0921ZM31.6058 8.33621H27.9359C27.7958 8.33732 27.6591 8.29246 27.547 8.20849C27.4348 8.12452 27.3533 8.00609 27.3149 7.87135L26.0545 3.91029C26.0293 3.8176 26.0262 3.72028 26.0455 3.62619C26.0649 3.5321 26.1061 3.44388 26.1658 3.36866C26.2264 3.29247 26.3034 3.23091 26.391 3.18856C26.4786 3.1462 26.5747 3.12414 26.672 3.124H28.9305C29.2861 3.13975 29.6349 3.22716 29.9558 3.38098C30.2768 3.53479 30.5634 3.75184 30.7984 4.01912C31.7475 5.02307 32.2662 6.35841 32.2437 7.73973C32.2339 7.90191 32.1624 8.05419 32.0437 8.16517C31.925 8.27615 31.7683 8.33736 31.6058 8.33621V8.33621Z" fill="%231545DE"/>%0A</g>%0A</g>%0A<path id="Caminho 1052" d="M18.318 0.208784C18.2779 0.150057 18.224 0.102045 18.1611 0.0689531C18.0981 0.0358617 18.028 0.0186933 17.9569 0.0189526H0.432107C0.361515 0.0187583 0.291932 0.0356991 0.229331 0.0683223C0.166729 0.100945 0.112985 0.148276 0.0727059 0.206248C0.0332923 0.263519 0.00898875 0.329827 0.00205642 0.399002C-0.00487591 0.468178 0.00578389 0.537987 0.0330492 0.601939L1.0404 3.29747C1.07434 3.3749 1.13023 3.44069 1.20115 3.48672C1.27206 3.53275 1.35491 3.55701 1.43945 3.55648H16.5134C16.5968 3.55702 16.6787 3.53341 16.749 3.4885C16.8194 3.44359 16.8753 3.37931 16.9099 3.30338L18.3526 0.607835C18.3813 0.543894 18.3933 0.473655 18.3872 0.403804C18.3812 0.333954 18.3573 0.266823 18.318 0.208784V0.208784Z" fill="%23C1BFBF"/>%0A<path id="Caminho 1053" d="M20.2107 5.18251C20.1706 5.12378 20.1167 5.07577 20.0538 5.04268C19.9908 5.00959 19.9207 4.99242 19.8496 4.99268H2.32482C2.25423 4.99248 2.18465 5.00943 2.12205 5.04205C2.05945 5.07467 2.0057 5.122 1.96542 5.17997C1.92601 5.23725 1.9017 5.30355 1.89477 5.37273C1.88784 5.4419 1.8985 5.51171 1.92577 5.57567L2.93311 8.2712C2.96706 8.34863 3.02294 8.41442 3.09386 8.46045C3.16478 8.50648 3.24763 8.53073 3.33217 8.53021H18.4061C18.4896 8.53075 18.5714 8.50714 18.6417 8.46224C18.7121 8.41733 18.768 8.35304 18.8026 8.27711L20.2453 5.58157C20.274 5.51761 20.2859 5.44738 20.2798 5.37754C20.2738 5.30771 20.25 5.24058 20.2107 5.18251V5.18251Z" fill="%23C1BFBF"/>%0A</g>%0A</svg>%0A';
@@ -2506,61 +2868,6 @@ var Panel = react.forwardRef(function Panel2({ className, style, children, ...pr
2506
2868
  }
2507
2869
  );
2508
2870
  });
2509
- var Radio = react.forwardRef(function Radio2({
2510
- label,
2511
- showLabel = true,
2512
- labelSize = "default",
2513
- checked = false,
2514
- value,
2515
- name,
2516
- onChange,
2517
- disabled,
2518
- required,
2519
- id,
2520
- className,
2521
- style,
2522
- ...props
2523
- }, ref) {
2524
- const autoId = react.useId();
2525
- const inputId = id ?? autoId;
2526
- const classes2 = [
2527
- "cr-radio",
2528
- `cr-radio--label-${labelSize}`,
2529
- disabled && "cr-radio--disabled",
2530
- className
2531
- ].filter(Boolean).join(" ");
2532
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes2, style, children: [
2533
- /* @__PURE__ */ jsxRuntime.jsx(
2534
- radiobutton.RadioButton,
2535
- {
2536
- unstyled: true,
2537
- inputRef: ref,
2538
- inputId,
2539
- checked,
2540
- value,
2541
- name,
2542
- onChange,
2543
- disabled,
2544
- required,
2545
- pt: {
2546
- // Marcado pela prop do Cristal, não pelo atributo interno do Prime (data-p-checked).
2547
- root: { className: `cr-radio__control${checked ? " cr-radio__control--checked" : ""}` },
2548
- input: { ...props, className: "cr-radio__input" },
2549
- box: { className: "cr-radio__box" },
2550
- icon: { className: "cr-radio__icon" }
2551
- }
2552
- }
2553
- ),
2554
- /* @__PURE__ */ jsxRuntime.jsx(
2555
- "label",
2556
- {
2557
- className: `cr-radio__label${showLabel ? "" : " cr-radio__label--hidden cr-so-leitor"}`,
2558
- htmlFor: inputId,
2559
- children: label
2560
- }
2561
- )
2562
- ] });
2563
- });
2564
2871
  var porcentagem = (posicao, total, visivel) => total > visivel ? Math.round(posicao / (total - visivel) * 100) : 0;
2565
2872
  var ScrollPanel = react.forwardRef(function ScrollPanel2({
2566
2873
  children,
@@ -3471,7 +3778,9 @@ exports.Checkbox = Checkbox;
3471
3778
  exports.Chip = Chip;
3472
3779
  exports.Column = Column;
3473
3780
  exports.ContextMenu = ContextMenu;
3781
+ exports.DATE_PERIODS = DATE_PERIODS;
3474
3782
  exports.DatePicker = DatePicker;
3783
+ exports.DateRangeButton = DateRangeButton;
3475
3784
  exports.Divider = Divider;
3476
3785
  exports.Drawer = Drawer;
3477
3786
  exports.IconButton = IconButton;