@vector-business-services/cristal-ds-web 0.8.0 → 0.10.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
@@ -18,15 +18,19 @@ var menubar = require('primereact/menubar');
18
18
  var avatar = require('primereact/avatar');
19
19
  var tooltip = require('primereact/tooltip');
20
20
  var tag = require('primereact/tag');
21
+ var message = require('primereact/message');
21
22
  var dialog = require('primereact/dialog');
22
23
  var multiselect = require('primereact/multiselect');
24
+ var tabmenu = require('primereact/tabmenu');
25
+ var paginator = require('primereact/paginator');
26
+ var dropdown = require('primereact/dropdown');
23
27
  var panel = require('primereact/panel');
24
28
  var radiobutton = require('primereact/radiobutton');
25
29
  var scrollpanel = require('primereact/scrollpanel');
26
30
  var selectbutton = require('primereact/selectbutton');
27
- var dropdown = require('primereact/dropdown');
28
31
  var inputswitch = require('primereact/inputswitch');
29
32
  var tabview = require('primereact/tabview');
33
+ var toast = require('primereact/toast');
30
34
 
31
35
  // src/components/AutoComplete/AutoComplete.tsx
32
36
  var AutoComplete = react.forwardRef(function AutoComplete2({
@@ -880,9 +884,20 @@ var MenuPrincipal = react.forwardRef(
880
884
  }, ref) {
881
885
  const primeRef = react.useRef(null);
882
886
  const context = react.useContext(api.PrimeReactContext);
887
+ const [baseDoAlvo, setBaseDoAlvo] = react.useState();
888
+ const medirAlvo = (event) => {
889
+ const alvo = event.currentTarget;
890
+ if (alvo instanceof Element) setBaseDoAlvo(alvo.getBoundingClientRect().bottom);
891
+ };
883
892
  react.useImperativeHandle(ref, () => ({
884
- toggle: (event) => primeRef.current?.toggle(event),
885
- show: (event) => primeRef.current?.show(event),
893
+ toggle: (event) => {
894
+ medirAlvo(event);
895
+ primeRef.current?.toggle(event);
896
+ },
897
+ show: (event) => {
898
+ medirAlvo(event);
899
+ primeRef.current?.show(event);
900
+ },
886
901
  hide: (event) => primeRef.current?.hide(event),
887
902
  getElement: () => primeRef.current?.getElement() ?? null
888
903
  }));
@@ -940,6 +955,7 @@ var MenuPrincipal = react.forwardRef(
940
955
  ref: primeRef,
941
956
  id,
942
957
  className: classes,
958
+ style: popup && baseDoAlvo !== void 0 ? { "--cr-menu-principal-topo": `${baseDoAlvo}px` } : void 0,
943
959
  model: items,
944
960
  popup,
945
961
  onShow,
@@ -950,6 +966,43 @@ var MenuPrincipal = react.forwardRef(
950
966
  return context ? menu$1 : /* @__PURE__ */ jsxRuntime.jsx(api.PrimeReactProvider, { children: menu$1 });
951
967
  }
952
968
  );
969
+ var SEVERITY = {
970
+ info: "info",
971
+ warning: "warn",
972
+ success: "success",
973
+ danger: "error",
974
+ highlight: "contrast",
975
+ neutral: "secondary"
976
+ };
977
+ var ICON = {
978
+ info: /* @__PURE__ */ jsxRuntime.jsx(react$1.Info, {}),
979
+ warning: /* @__PURE__ */ jsxRuntime.jsx(react$1.Warning, {}),
980
+ success: /* @__PURE__ */ jsxRuntime.jsx(react$1.CheckCircle, {}),
981
+ danger: /* @__PURE__ */ jsxRuntime.jsx(react$1.XCircle, {}),
982
+ highlight: /* @__PURE__ */ jsxRuntime.jsx(react$1.SealWarning, {}),
983
+ neutral: /* @__PURE__ */ jsxRuntime.jsx(react$1.WarningCircle, {})
984
+ };
985
+ var Message = react.forwardRef(function Message2({ type = "info", children, showIcon = true, id, className }, ref) {
986
+ const primeRef = react.useRef(null);
987
+ react.useImperativeHandle(ref, () => primeRef.current?.getElement());
988
+ return /* @__PURE__ */ jsxRuntime.jsx(
989
+ message.Message,
990
+ {
991
+ unstyled: true,
992
+ ref: primeRef,
993
+ id,
994
+ severity: SEVERITY[type],
995
+ text: children,
996
+ icon: showIcon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-message__icon", "aria-hidden": "true", children: ICON[type] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}),
997
+ pt: {
998
+ root: {
999
+ className: ["cr-message", `cr-message--${type}`, className].filter(Boolean).join(" ")
1000
+ },
1001
+ text: { className: "cr-message__text" }
1002
+ }
1003
+ }
1004
+ );
1005
+ });
953
1006
  function Modal({
954
1007
  visible,
955
1008
  onHide,
@@ -1219,6 +1272,292 @@ var MultiSelect = react.forwardRef(function MultiSelect2({
1219
1272
  ] })
1220
1273
  ] });
1221
1274
  });
1275
+ var PageHeader = react.forwardRef(function PageHeader2({
1276
+ title,
1277
+ variant = "primary",
1278
+ onBack,
1279
+ backLabel = "Voltar",
1280
+ tag,
1281
+ segmentControl,
1282
+ actions,
1283
+ onExpand,
1284
+ expandLabel = "Expandir",
1285
+ tabs,
1286
+ activeTab,
1287
+ onTabChange,
1288
+ tabsLabel,
1289
+ className,
1290
+ ...props
1291
+ }, ref) {
1292
+ const [interna, setInterna] = react.useState(0);
1293
+ const ativa = activeTab ?? interna;
1294
+ const tools = segmentControl || actions;
1295
+ const tabTemplate = (tab) => (
1296
+ // O TabMenu também passa o index da aba nas opções, além do que o tipo do MenuItem declara.
1297
+ function TabContent(item, options) {
1298
+ const { element, index } = options;
1299
+ const active = index === ativa;
1300
+ return react.cloneElement(
1301
+ element,
1302
+ { "aria-current": active ? "page" : void 0 },
1303
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1304
+ (variant === "primary" || tab.icon) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-page-header__tab-icon", "aria-hidden": "true", children: tab.icon }),
1305
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-page-header__tab-label", children: item.label })
1306
+ ] })
1307
+ );
1308
+ }
1309
+ );
1310
+ const classes = ["cr-page-header", `cr-page-header--${variant}`, className].filter(Boolean).join(" ");
1311
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: classes, ...props, children: [
1312
+ /* @__PURE__ */ jsxRuntime.jsxs(
1313
+ "div",
1314
+ {
1315
+ className: `cr-page-header__title-group${tools ? " cr-page-header__title-group--tools" : ""}`,
1316
+ children: [
1317
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-page-header__title-text", children: [
1318
+ onBack && /* @__PURE__ */ jsxRuntime.jsx(
1319
+ IconButton,
1320
+ {
1321
+ variant: "tertiary",
1322
+ size: "small",
1323
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.ArrowLeft, {}),
1324
+ "aria-label": backLabel,
1325
+ onClick: onBack
1326
+ }
1327
+ ),
1328
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "cr-page-header__title", children: title }),
1329
+ tag && /* @__PURE__ */ jsxRuntime.jsx(Tag, { className: "cr-page-header__tag", children: tag })
1330
+ ] }),
1331
+ tools && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-page-header__tools", children: [
1332
+ segmentControl && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cr-page-header__segment", children: segmentControl }),
1333
+ actions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cr-page-header__actions", children: actions })
1334
+ ] }),
1335
+ onExpand && /* @__PURE__ */ jsxRuntime.jsx(
1336
+ IconButton,
1337
+ {
1338
+ className: "cr-page-header__expand",
1339
+ variant: "tertiary",
1340
+ size: "medium",
1341
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.ArrowsOutSimple, {}),
1342
+ "aria-label": expandLabel,
1343
+ onClick: onExpand
1344
+ }
1345
+ )
1346
+ ]
1347
+ }
1348
+ ),
1349
+ tabs && tabs.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
1350
+ tabmenu.TabMenu,
1351
+ {
1352
+ unstyled: true,
1353
+ model: tabs.map((tab) => ({
1354
+ label: tab.label,
1355
+ disabled: tab.disabled,
1356
+ template: tabTemplate(tab)
1357
+ })),
1358
+ activeIndex: ativa,
1359
+ onTabChange: (event) => {
1360
+ setInterna(event.index);
1361
+ onTabChange?.(event.index);
1362
+ },
1363
+ pt: {
1364
+ root: { className: "cr-page-header__tabs" },
1365
+ menu: { className: "cr-page-header__tab-list", "aria-label": tabsLabel ?? title },
1366
+ menuitem: { className: "cr-page-header__tab-item" },
1367
+ action: { className: "cr-page-header__tab" },
1368
+ inkbar: { className: "cr-page-header__inkbar" }
1369
+ }
1370
+ }
1371
+ )
1372
+ ] });
1373
+ });
1374
+ var Select = react.forwardRef(function Select2({
1375
+ variant = "outline",
1376
+ size = "large",
1377
+ label,
1378
+ "aria-label": ariaLabel,
1379
+ options,
1380
+ optionLabel = "label",
1381
+ optionValue,
1382
+ value,
1383
+ onChange,
1384
+ placeholder = "Selecione uma op\xE7\xE3o",
1385
+ hint,
1386
+ error,
1387
+ required,
1388
+ disabled,
1389
+ id,
1390
+ name,
1391
+ className
1392
+ }, ref) {
1393
+ const autoId = react.useId();
1394
+ const inputId = id ?? autoId;
1395
+ const hintId = `${inputId}-hint`;
1396
+ const listId = `${inputId}-list`;
1397
+ const supportText = error ?? hint;
1398
+ const [open, setOpen] = react.useState(false);
1399
+ const setInputRef = react.useCallback(
1400
+ (input) => {
1401
+ input?.setAttribute("role", "combobox");
1402
+ if (typeof ref === "function") ref(input);
1403
+ else if (ref) ref.current = input;
1404
+ },
1405
+ [ref]
1406
+ );
1407
+ const classes = [
1408
+ "cr-field",
1409
+ `cr-field--${variant}`,
1410
+ `cr-field--${size}`,
1411
+ "cr-select",
1412
+ error && "cr-field--error",
1413
+ disabled && "cr-field--disabled",
1414
+ className
1415
+ ].filter(Boolean).join(" ");
1416
+ const pt = {
1417
+ root: {
1418
+ className: `cr-field__control cr-select__control${open ? " cr-select__control--open" : ""}`,
1419
+ // O Prime aponta para um item mesmo sem destaque (dropdownItem_-1); o foco vai no item.
1420
+ "aria-activedescendant": void 0
1421
+ },
1422
+ // O <select> escondido do Prime só existe para formulários: fora da árvore de acessibilidade.
1423
+ select: { "aria-hidden": true },
1424
+ hiddenSelectedMessage: { className: "cr-select__hidden" },
1425
+ // O Prime usa a mesma chave no texto do campo e no combobox escondido.
1426
+ input: { className: "cr-select__value" },
1427
+ trigger: { className: "cr-field__icon cr-select__trigger", "aria-hidden": true },
1428
+ panel: { className: "cr-select__panel" },
1429
+ wrapper: { className: "cr-select__wrapper" },
1430
+ list: { className: "cr-select__list", id: listId },
1431
+ item: { className: "cr-select__item" },
1432
+ emptyMessage: { className: "cr-select__item cr-select__empty" }
1433
+ };
1434
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, children: [
1435
+ label && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "cr-field__label", htmlFor: inputId, children: [
1436
+ label,
1437
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__required", "aria-hidden": "true", children: "*" })
1438
+ ] }),
1439
+ /* @__PURE__ */ jsxRuntime.jsx(
1440
+ dropdown.Dropdown,
1441
+ {
1442
+ unstyled: true,
1443
+ inputId,
1444
+ focusInputRef: setInputRef,
1445
+ value,
1446
+ options,
1447
+ optionLabel,
1448
+ optionValue,
1449
+ onChange: (event) => onChange?.(event.value),
1450
+ onShow: () => setOpen(true),
1451
+ onHide: () => setOpen(false),
1452
+ disabled,
1453
+ required,
1454
+ name,
1455
+ invalid: Boolean(error),
1456
+ placeholder,
1457
+ valueTemplate: (option) => option == null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-select__placeholder", children: placeholder }) : String(option[optionLabel] ?? option),
1458
+ scrollHeight: "185px",
1459
+ dropdownIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDown, {}),
1460
+ collapseIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretUp, {}),
1461
+ "aria-label": label ? void 0 : ariaLabel,
1462
+ "aria-expanded": open,
1463
+ "aria-controls": open ? listId : void 0,
1464
+ "aria-describedby": supportText ? hintId : void 0,
1465
+ "aria-invalid": error ? true : void 0,
1466
+ "aria-required": required || void 0,
1467
+ pt
1468
+ }
1469
+ ),
1470
+ supportText && /* @__PURE__ */ jsxRuntime.jsxs("p", { id: hintId, className: `cr-field__hint${error ? " cr-field__hint--error" : ""}`, children: [
1471
+ /* @__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, {}) }),
1472
+ supportText
1473
+ ] })
1474
+ ] });
1475
+ });
1476
+ var seta = (label, icon) => (options) => /* @__PURE__ */ jsxRuntime.jsx(
1477
+ "button",
1478
+ {
1479
+ type: "button",
1480
+ className: "cr-paginator__arrow",
1481
+ "aria-label": label,
1482
+ disabled: options.disabled,
1483
+ onClick: options.onClick,
1484
+ children: icon
1485
+ }
1486
+ );
1487
+ var Paginator = react.forwardRef(function Paginator2({
1488
+ totalRecords,
1489
+ first,
1490
+ rows,
1491
+ rowsPerPageOptions,
1492
+ pageLinkSize = 5,
1493
+ onPageChange,
1494
+ rowsPerPageLabel = "Itens por p\xE1gina",
1495
+ id,
1496
+ className
1497
+ }, ref) {
1498
+ const primeRef = react.useRef(null);
1499
+ react.useImperativeHandle(ref, () => primeRef.current?.getElement());
1500
+ const [interno, setInterno] = react.useState({
1501
+ first: 0,
1502
+ rows: rowsPerPageOptions?.[0] ?? 10
1503
+ });
1504
+ const atual = { first: first ?? interno.first, rows: rows ?? interno.rows };
1505
+ return /* @__PURE__ */ jsxRuntime.jsx(
1506
+ paginator.Paginator,
1507
+ {
1508
+ unstyled: true,
1509
+ ref: primeRef,
1510
+ id,
1511
+ totalRecords,
1512
+ first: atual.first,
1513
+ rows: atual.rows,
1514
+ rowsPerPageOptions,
1515
+ pageLinkSize,
1516
+ onPageChange: (event) => {
1517
+ setInterno({ first: event.first, rows: event.rows });
1518
+ onPageChange?.(event);
1519
+ },
1520
+ template: {
1521
+ layout: "FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown",
1522
+ FirstPageLink: seta("Primeira p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDoubleLeft, { "aria-hidden": "true" })),
1523
+ PrevPageLink: seta("P\xE1gina anterior", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretLeft, { "aria-hidden": "true" })),
1524
+ NextPageLink: seta("Pr\xF3xima p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretRight, { "aria-hidden": "true" })),
1525
+ LastPageLink: seta("\xDAltima p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDoubleRight, { "aria-hidden": "true" })),
1526
+ PageLinks: (options) => {
1527
+ const ativa = options.page === options.currentPage;
1528
+ return /* @__PURE__ */ jsxRuntime.jsx(
1529
+ "button",
1530
+ {
1531
+ type: "button",
1532
+ className: "cr-paginator__page",
1533
+ "aria-label": `P\xE1gina ${options.page + 1}`,
1534
+ "aria-current": ativa ? "page" : void 0,
1535
+ onClick: options.onClick,
1536
+ children: options.page + 1
1537
+ }
1538
+ );
1539
+ },
1540
+ // O Prime chama o template mesmo sem rowsPerPageOptions.
1541
+ RowsPerPageDropdown: (options) => options.options.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
1542
+ Select,
1543
+ {
1544
+ className: "cr-paginator__rows",
1545
+ size: "medium",
1546
+ "aria-label": rowsPerPageLabel,
1547
+ options: options.options,
1548
+ optionValue: "value",
1549
+ value: options.value,
1550
+ onChange: (value) => options.onChange({ value })
1551
+ }
1552
+ )
1553
+ },
1554
+ pt: {
1555
+ root: { className: ["cr-paginator", className].filter(Boolean).join(" ") },
1556
+ pages: { className: "cr-paginator__pages" }
1557
+ }
1558
+ }
1559
+ );
1560
+ });
1222
1561
  var Panel = react.forwardRef(function Panel2({ className, style, children, ...props }, ref) {
1223
1562
  const primeRef = react.useRef(null);
1224
1563
  react.useImperativeHandle(ref, () => primeRef.current?.getElement());
@@ -1383,108 +1722,6 @@ var SegmentControl = react.forwardRef(
1383
1722
  );
1384
1723
  }
1385
1724
  );
1386
- var Select = react.forwardRef(function Select2({
1387
- variant = "outline",
1388
- size = "large",
1389
- label,
1390
- "aria-label": ariaLabel,
1391
- options,
1392
- optionLabel = "label",
1393
- optionValue,
1394
- value,
1395
- onChange,
1396
- placeholder = "Selecione uma op\xE7\xE3o",
1397
- hint,
1398
- error,
1399
- required,
1400
- disabled,
1401
- id,
1402
- name,
1403
- className
1404
- }, ref) {
1405
- const autoId = react.useId();
1406
- const inputId = id ?? autoId;
1407
- const hintId = `${inputId}-hint`;
1408
- const listId = `${inputId}-list`;
1409
- const supportText = error ?? hint;
1410
- const [open, setOpen] = react.useState(false);
1411
- const setInputRef = react.useCallback(
1412
- (input) => {
1413
- input?.setAttribute("role", "combobox");
1414
- if (typeof ref === "function") ref(input);
1415
- else if (ref) ref.current = input;
1416
- },
1417
- [ref]
1418
- );
1419
- const classes = [
1420
- "cr-field",
1421
- `cr-field--${variant}`,
1422
- `cr-field--${size}`,
1423
- "cr-select",
1424
- error && "cr-field--error",
1425
- disabled && "cr-field--disabled",
1426
- className
1427
- ].filter(Boolean).join(" ");
1428
- const pt = {
1429
- root: {
1430
- className: `cr-field__control cr-select__control${open ? " cr-select__control--open" : ""}`,
1431
- // O Prime aponta para um item mesmo sem destaque (dropdownItem_-1); o foco vai no item.
1432
- "aria-activedescendant": void 0
1433
- },
1434
- // O <select> escondido do Prime só existe para formulários: fora da árvore de acessibilidade.
1435
- select: { "aria-hidden": true },
1436
- hiddenSelectedMessage: { className: "cr-select__hidden" },
1437
- // O Prime usa a mesma chave no texto do campo e no combobox escondido.
1438
- input: { className: "cr-select__value" },
1439
- trigger: { className: "cr-field__icon cr-select__trigger", "aria-hidden": true },
1440
- panel: { className: "cr-select__panel" },
1441
- wrapper: { className: "cr-select__wrapper" },
1442
- list: { className: "cr-select__list", id: listId },
1443
- item: { className: "cr-select__item" },
1444
- emptyMessage: { className: "cr-select__item cr-select__empty" }
1445
- };
1446
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, children: [
1447
- label && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "cr-field__label", htmlFor: inputId, children: [
1448
- label,
1449
- required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__required", "aria-hidden": "true", children: "*" })
1450
- ] }),
1451
- /* @__PURE__ */ jsxRuntime.jsx(
1452
- dropdown.Dropdown,
1453
- {
1454
- unstyled: true,
1455
- inputId,
1456
- focusInputRef: setInputRef,
1457
- value,
1458
- options,
1459
- optionLabel,
1460
- optionValue,
1461
- onChange: (event) => onChange?.(event.value),
1462
- onShow: () => setOpen(true),
1463
- onHide: () => setOpen(false),
1464
- disabled,
1465
- required,
1466
- name,
1467
- invalid: Boolean(error),
1468
- placeholder,
1469
- valueTemplate: (option) => option == null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-select__placeholder", children: placeholder }) : String(option[optionLabel] ?? option),
1470
- scrollHeight: "185px",
1471
- dropdownIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDown, {}),
1472
- collapseIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretUp, {}),
1473
- "aria-label": label ? void 0 : ariaLabel,
1474
- "aria-expanded": open,
1475
- "aria-controls": open ? listId : void 0,
1476
- "aria-describedby": supportText ? hintId : void 0,
1477
- "aria-invalid": error ? true : void 0,
1478
- "aria-required": required || void 0,
1479
- pt
1480
- }
1481
- ),
1482
- supportText && /* @__PURE__ */ jsxRuntime.jsxs("p", { id: hintId, className: `cr-field__hint${error ? " cr-field__hint--error" : ""}`, children: [
1483
- /* @__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, {}) }),
1484
- supportText
1485
- ] })
1486
- ] });
1487
- });
1488
1725
  var Switch = react.forwardRef(function Switch2({
1489
1726
  label,
1490
1727
  showLabel = true,
@@ -1615,6 +1852,71 @@ var Tabs = react.forwardRef(function Tabs2({ activeIndex, onTabChange, children,
1615
1852
  }
1616
1853
  );
1617
1854
  });
1855
+ var SEVERITY2 = {
1856
+ warning: "warn",
1857
+ danger: "error",
1858
+ success: "success",
1859
+ info: "info"
1860
+ };
1861
+ var ICON2 = {
1862
+ warning: /* @__PURE__ */ jsxRuntime.jsx(react$1.Warning, {}),
1863
+ danger: /* @__PURE__ */ jsxRuntime.jsx(react$1.XCircle, {}),
1864
+ success: /* @__PURE__ */ jsxRuntime.jsx(react$1.Check, {}),
1865
+ info: /* @__PURE__ */ jsxRuntime.jsx(react$1.Info, {})
1866
+ };
1867
+ var Toast = react.forwardRef(function Toast2({ position = "top-right", closeLabel = "Fechar", id, className }, ref) {
1868
+ const primeRef = react.useRef(null);
1869
+ const converter = ({
1870
+ type,
1871
+ title,
1872
+ message,
1873
+ showIcon = true,
1874
+ life,
1875
+ sticky
1876
+ }) => ({
1877
+ severity: SEVERITY2[type],
1878
+ summary: title,
1879
+ detail: message,
1880
+ // Sem ícone, um fragmento vazio: com undefined o Prime põe o ícone dele.
1881
+ icon: showIcon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-toast__icon", "aria-hidden": "true", children: ICON2[type] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}),
1882
+ closeIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.X, { "aria-hidden": "true" }),
1883
+ life,
1884
+ sticky,
1885
+ className: `cr-toast__message--${type}`
1886
+ });
1887
+ react.useImperativeHandle(ref, () => ({
1888
+ show: (message) => primeRef.current?.show(Array.isArray(message) ? message.map(converter) : converter(message)),
1889
+ clear: () => primeRef.current?.clear()
1890
+ }));
1891
+ return /* @__PURE__ */ jsxRuntime.jsx(
1892
+ toast.Toast,
1893
+ {
1894
+ ...{ unstyled: true },
1895
+ ref: primeRef,
1896
+ id,
1897
+ position,
1898
+ pt: {
1899
+ root: {
1900
+ className: ["cr-toast", className].filter(Boolean).join(" ")
1901
+ },
1902
+ message: { className: "cr-toast__message" },
1903
+ content: { className: "cr-toast__content" },
1904
+ text: { className: "cr-toast__text" },
1905
+ summary: { className: "cr-toast__title" },
1906
+ detail: { className: "cr-toast__detail" },
1907
+ closeButton: { className: "cr-toast__close", "aria-label": closeLabel },
1908
+ // No unstyled o Prime não põe classes na transição: o Cristal dá as dele (Toast.css).
1909
+ transition: {
1910
+ classNames: {
1911
+ enter: "cr-toast__message--enter",
1912
+ enterActive: "cr-toast__message--enter-active",
1913
+ exitActive: "cr-toast__message--exit-active"
1914
+ }
1915
+ }
1916
+ }
1917
+ }
1918
+ );
1919
+ });
1618
1920
 
1619
1921
  exports.AutoComplete = AutoComplete;
1620
1922
  exports.Badge = Badge;
@@ -1629,8 +1931,11 @@ exports.Input = Input;
1629
1931
  exports.Menu = Menu;
1630
1932
  exports.MenuPrincipal = MenuPrincipal;
1631
1933
  exports.Menubar = Menubar;
1934
+ exports.Message = Message;
1632
1935
  exports.Modal = Modal;
1633
1936
  exports.MultiSelect = MultiSelect;
1937
+ exports.PageHeader = PageHeader;
1938
+ exports.Paginator = Paginator;
1634
1939
  exports.Panel = Panel;
1635
1940
  exports.Radio = Radio;
1636
1941
  exports.ScrollPanel = ScrollPanel;
@@ -1640,6 +1945,7 @@ exports.Switch = Switch;
1640
1945
  exports.TabPanel = TabPanel;
1641
1946
  exports.Tabs = Tabs;
1642
1947
  exports.Tag = Tag;
1948
+ exports.Toast = Toast;
1643
1949
  exports.Tooltip = Tooltip;
1644
1950
  //# sourceMappingURL=index.cjs.map
1645
1951
  //# sourceMappingURL=index.cjs.map