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