@vector-business-services/cristal-ds-web 0.9.0 → 0.11.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 +368 -107
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +470 -128
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +108 -3
- package/dist/index.d.ts +108 -3
- package/dist/index.js +366 -110
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var react = require('react');
|
|
4
|
-
var
|
|
4
|
+
var accordion = require('primereact/accordion');
|
|
5
5
|
var react$1 = require('@phosphor-icons/react');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var autocomplete = require('primereact/autocomplete');
|
|
7
8
|
var badge = require('primereact/badge');
|
|
8
9
|
var button = require('primereact/button');
|
|
9
10
|
var card = require('primereact/card');
|
|
@@ -18,18 +19,74 @@ var menubar = require('primereact/menubar');
|
|
|
18
19
|
var avatar = require('primereact/avatar');
|
|
19
20
|
var tooltip = require('primereact/tooltip');
|
|
20
21
|
var tag = require('primereact/tag');
|
|
22
|
+
var message = require('primereact/message');
|
|
21
23
|
var dialog = require('primereact/dialog');
|
|
22
24
|
var multiselect = require('primereact/multiselect');
|
|
23
25
|
var tabmenu = require('primereact/tabmenu');
|
|
26
|
+
var paginator = require('primereact/paginator');
|
|
27
|
+
var dropdown = require('primereact/dropdown');
|
|
24
28
|
var panel = require('primereact/panel');
|
|
25
29
|
var radiobutton = require('primereact/radiobutton');
|
|
26
30
|
var scrollpanel = require('primereact/scrollpanel');
|
|
27
31
|
var selectbutton = require('primereact/selectbutton');
|
|
28
|
-
var dropdown = require('primereact/dropdown');
|
|
29
32
|
var inputswitch = require('primereact/inputswitch');
|
|
30
33
|
var tabview = require('primereact/tabview');
|
|
34
|
+
var toast = require('primereact/toast');
|
|
31
35
|
|
|
32
|
-
// src/components/
|
|
36
|
+
// src/components/Accordion/Accordion.tsx
|
|
37
|
+
function AccordionTab(_props) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
var seta = (icon) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-accordion__toggle", "aria-hidden": "true", children: icon });
|
|
41
|
+
var Accordion = react.forwardRef(function Accordion2({ multiple = false, activeIndex, onTabChange, children, id, className }, ref) {
|
|
42
|
+
const primeRef = react.useRef(null);
|
|
43
|
+
react.useImperativeHandle(ref, () => primeRef.current?.getElement());
|
|
44
|
+
const [interno, setInterno] = react.useState(multiple ? [0] : 0);
|
|
45
|
+
const abertos = activeIndex === void 0 ? interno : activeIndex;
|
|
46
|
+
const tabs = react.Children.toArray(children).filter(
|
|
47
|
+
(child) => react.isValidElement(child)
|
|
48
|
+
);
|
|
49
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
50
|
+
accordion.Accordion,
|
|
51
|
+
{
|
|
52
|
+
...{ unstyled: true },
|
|
53
|
+
ref: primeRef,
|
|
54
|
+
id,
|
|
55
|
+
multiple,
|
|
56
|
+
activeIndex: abertos,
|
|
57
|
+
onTabChange: (event) => {
|
|
58
|
+
const index = event.index;
|
|
59
|
+
setInterno(index);
|
|
60
|
+
onTabChange?.(index);
|
|
61
|
+
},
|
|
62
|
+
expandIcon: seta(/* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDown, {})),
|
|
63
|
+
collapseIcon: seta(/* @__PURE__ */ jsxRuntime.jsx(react$1.CaretUp, {})),
|
|
64
|
+
pt: { root: { className: ["cr-accordion", className].filter(Boolean).join(" ") } },
|
|
65
|
+
children: tabs.map((tab, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
66
|
+
accordion.AccordionTab,
|
|
67
|
+
{
|
|
68
|
+
header: tab.props.header,
|
|
69
|
+
disabled: tab.props.disabled,
|
|
70
|
+
headerTemplate: tab.props.headerContent ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-accordion__custom", children: tab.props.headerContent }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "cr-accordion__texts", children: [
|
|
71
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-accordion__title", children: tab.props.header }),
|
|
72
|
+
tab.props.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-accordion__description", children: tab.props.description })
|
|
73
|
+
] }),
|
|
74
|
+
pt: {
|
|
75
|
+
root: { className: "cr-accordion__item" },
|
|
76
|
+
header: { className: "cr-accordion__header" },
|
|
77
|
+
headerAction: { className: "cr-accordion__action" },
|
|
78
|
+
toggleableContent: { className: "cr-accordion__region" },
|
|
79
|
+
content: { className: "cr-accordion__content" },
|
|
80
|
+
// Sem animação: o Prime manteria o conteúdo na tela pelos 450ms da saída dele.
|
|
81
|
+
transition: { timeout: 0 }
|
|
82
|
+
},
|
|
83
|
+
children: tab.props.children
|
|
84
|
+
},
|
|
85
|
+
tab.key ?? index
|
|
86
|
+
))
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
});
|
|
33
90
|
var AutoComplete = react.forwardRef(function AutoComplete2({
|
|
34
91
|
variant = "outline",
|
|
35
92
|
size = "large",
|
|
@@ -881,9 +938,20 @@ var MenuPrincipal = react.forwardRef(
|
|
|
881
938
|
}, ref) {
|
|
882
939
|
const primeRef = react.useRef(null);
|
|
883
940
|
const context = react.useContext(api.PrimeReactContext);
|
|
941
|
+
const [baseDoAlvo, setBaseDoAlvo] = react.useState();
|
|
942
|
+
const medirAlvo = (event) => {
|
|
943
|
+
const alvo = event.currentTarget;
|
|
944
|
+
if (alvo instanceof Element) setBaseDoAlvo(alvo.getBoundingClientRect().bottom);
|
|
945
|
+
};
|
|
884
946
|
react.useImperativeHandle(ref, () => ({
|
|
885
|
-
toggle: (event) =>
|
|
886
|
-
|
|
947
|
+
toggle: (event) => {
|
|
948
|
+
medirAlvo(event);
|
|
949
|
+
primeRef.current?.toggle(event);
|
|
950
|
+
},
|
|
951
|
+
show: (event) => {
|
|
952
|
+
medirAlvo(event);
|
|
953
|
+
primeRef.current?.show(event);
|
|
954
|
+
},
|
|
887
955
|
hide: (event) => primeRef.current?.hide(event),
|
|
888
956
|
getElement: () => primeRef.current?.getElement() ?? null
|
|
889
957
|
}));
|
|
@@ -941,6 +1009,7 @@ var MenuPrincipal = react.forwardRef(
|
|
|
941
1009
|
ref: primeRef,
|
|
942
1010
|
id,
|
|
943
1011
|
className: classes,
|
|
1012
|
+
style: popup && baseDoAlvo !== void 0 ? { "--cr-menu-principal-topo": `${baseDoAlvo}px` } : void 0,
|
|
944
1013
|
model: items,
|
|
945
1014
|
popup,
|
|
946
1015
|
onShow,
|
|
@@ -951,6 +1020,43 @@ var MenuPrincipal = react.forwardRef(
|
|
|
951
1020
|
return context ? menu$1 : /* @__PURE__ */ jsxRuntime.jsx(api.PrimeReactProvider, { children: menu$1 });
|
|
952
1021
|
}
|
|
953
1022
|
);
|
|
1023
|
+
var SEVERITY = {
|
|
1024
|
+
info: "info",
|
|
1025
|
+
warning: "warn",
|
|
1026
|
+
success: "success",
|
|
1027
|
+
danger: "error",
|
|
1028
|
+
highlight: "contrast",
|
|
1029
|
+
neutral: "secondary"
|
|
1030
|
+
};
|
|
1031
|
+
var ICON = {
|
|
1032
|
+
info: /* @__PURE__ */ jsxRuntime.jsx(react$1.Info, {}),
|
|
1033
|
+
warning: /* @__PURE__ */ jsxRuntime.jsx(react$1.Warning, {}),
|
|
1034
|
+
success: /* @__PURE__ */ jsxRuntime.jsx(react$1.CheckCircle, {}),
|
|
1035
|
+
danger: /* @__PURE__ */ jsxRuntime.jsx(react$1.XCircle, {}),
|
|
1036
|
+
highlight: /* @__PURE__ */ jsxRuntime.jsx(react$1.SealWarning, {}),
|
|
1037
|
+
neutral: /* @__PURE__ */ jsxRuntime.jsx(react$1.WarningCircle, {})
|
|
1038
|
+
};
|
|
1039
|
+
var Message = react.forwardRef(function Message2({ type = "info", children, showIcon = true, id, className }, ref) {
|
|
1040
|
+
const primeRef = react.useRef(null);
|
|
1041
|
+
react.useImperativeHandle(ref, () => primeRef.current?.getElement());
|
|
1042
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1043
|
+
message.Message,
|
|
1044
|
+
{
|
|
1045
|
+
unstyled: true,
|
|
1046
|
+
ref: primeRef,
|
|
1047
|
+
id,
|
|
1048
|
+
severity: SEVERITY[type],
|
|
1049
|
+
text: children,
|
|
1050
|
+
icon: showIcon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-message__icon", "aria-hidden": "true", children: ICON[type] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}),
|
|
1051
|
+
pt: {
|
|
1052
|
+
root: {
|
|
1053
|
+
className: ["cr-message", `cr-message--${type}`, className].filter(Boolean).join(" ")
|
|
1054
|
+
},
|
|
1055
|
+
text: { className: "cr-message__text" }
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
);
|
|
1059
|
+
});
|
|
954
1060
|
function Modal({
|
|
955
1061
|
visible,
|
|
956
1062
|
onHide,
|
|
@@ -1319,6 +1425,193 @@ var PageHeader = react.forwardRef(function PageHeader2({
|
|
|
1319
1425
|
)
|
|
1320
1426
|
] });
|
|
1321
1427
|
});
|
|
1428
|
+
var Select = react.forwardRef(function Select2({
|
|
1429
|
+
variant = "outline",
|
|
1430
|
+
size = "large",
|
|
1431
|
+
label,
|
|
1432
|
+
"aria-label": ariaLabel,
|
|
1433
|
+
options,
|
|
1434
|
+
optionLabel = "label",
|
|
1435
|
+
optionValue,
|
|
1436
|
+
value,
|
|
1437
|
+
onChange,
|
|
1438
|
+
placeholder = "Selecione uma op\xE7\xE3o",
|
|
1439
|
+
hint,
|
|
1440
|
+
error,
|
|
1441
|
+
required,
|
|
1442
|
+
disabled,
|
|
1443
|
+
id,
|
|
1444
|
+
name,
|
|
1445
|
+
className
|
|
1446
|
+
}, ref) {
|
|
1447
|
+
const autoId = react.useId();
|
|
1448
|
+
const inputId = id ?? autoId;
|
|
1449
|
+
const hintId = `${inputId}-hint`;
|
|
1450
|
+
const listId = `${inputId}-list`;
|
|
1451
|
+
const supportText = error ?? hint;
|
|
1452
|
+
const [open, setOpen] = react.useState(false);
|
|
1453
|
+
const setInputRef = react.useCallback(
|
|
1454
|
+
(input) => {
|
|
1455
|
+
input?.setAttribute("role", "combobox");
|
|
1456
|
+
if (typeof ref === "function") ref(input);
|
|
1457
|
+
else if (ref) ref.current = input;
|
|
1458
|
+
},
|
|
1459
|
+
[ref]
|
|
1460
|
+
);
|
|
1461
|
+
const classes = [
|
|
1462
|
+
"cr-field",
|
|
1463
|
+
`cr-field--${variant}`,
|
|
1464
|
+
`cr-field--${size}`,
|
|
1465
|
+
"cr-select",
|
|
1466
|
+
error && "cr-field--error",
|
|
1467
|
+
disabled && "cr-field--disabled",
|
|
1468
|
+
className
|
|
1469
|
+
].filter(Boolean).join(" ");
|
|
1470
|
+
const pt = {
|
|
1471
|
+
root: {
|
|
1472
|
+
className: `cr-field__control cr-select__control${open ? " cr-select__control--open" : ""}`,
|
|
1473
|
+
// O Prime aponta para um item mesmo sem destaque (dropdownItem_-1); o foco vai no item.
|
|
1474
|
+
"aria-activedescendant": void 0
|
|
1475
|
+
},
|
|
1476
|
+
// O <select> escondido do Prime só existe para formulários: fora da árvore de acessibilidade.
|
|
1477
|
+
select: { "aria-hidden": true },
|
|
1478
|
+
hiddenSelectedMessage: { className: "cr-select__hidden" },
|
|
1479
|
+
// O Prime usa a mesma chave no texto do campo e no combobox escondido.
|
|
1480
|
+
input: { className: "cr-select__value" },
|
|
1481
|
+
trigger: { className: "cr-field__icon cr-select__trigger", "aria-hidden": true },
|
|
1482
|
+
panel: { className: "cr-select__panel" },
|
|
1483
|
+
wrapper: { className: "cr-select__wrapper" },
|
|
1484
|
+
list: { className: "cr-select__list", id: listId },
|
|
1485
|
+
item: { className: "cr-select__item" },
|
|
1486
|
+
emptyMessage: { className: "cr-select__item cr-select__empty" }
|
|
1487
|
+
};
|
|
1488
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, children: [
|
|
1489
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "cr-field__label", htmlFor: inputId, children: [
|
|
1490
|
+
label,
|
|
1491
|
+
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__required", "aria-hidden": "true", children: "*" })
|
|
1492
|
+
] }),
|
|
1493
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1494
|
+
dropdown.Dropdown,
|
|
1495
|
+
{
|
|
1496
|
+
unstyled: true,
|
|
1497
|
+
inputId,
|
|
1498
|
+
focusInputRef: setInputRef,
|
|
1499
|
+
value,
|
|
1500
|
+
options,
|
|
1501
|
+
optionLabel,
|
|
1502
|
+
optionValue,
|
|
1503
|
+
onChange: (event) => onChange?.(event.value),
|
|
1504
|
+
onShow: () => setOpen(true),
|
|
1505
|
+
onHide: () => setOpen(false),
|
|
1506
|
+
disabled,
|
|
1507
|
+
required,
|
|
1508
|
+
name,
|
|
1509
|
+
invalid: Boolean(error),
|
|
1510
|
+
placeholder,
|
|
1511
|
+
valueTemplate: (option) => option == null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-select__placeholder", children: placeholder }) : String(option[optionLabel] ?? option),
|
|
1512
|
+
scrollHeight: "185px",
|
|
1513
|
+
dropdownIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDown, {}),
|
|
1514
|
+
collapseIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretUp, {}),
|
|
1515
|
+
"aria-label": label ? void 0 : ariaLabel,
|
|
1516
|
+
"aria-expanded": open,
|
|
1517
|
+
"aria-controls": open ? listId : void 0,
|
|
1518
|
+
"aria-describedby": supportText ? hintId : void 0,
|
|
1519
|
+
"aria-invalid": error ? true : void 0,
|
|
1520
|
+
"aria-required": required || void 0,
|
|
1521
|
+
pt
|
|
1522
|
+
}
|
|
1523
|
+
),
|
|
1524
|
+
supportText && /* @__PURE__ */ jsxRuntime.jsxs("p", { id: hintId, className: `cr-field__hint${error ? " cr-field__hint--error" : ""}`, children: [
|
|
1525
|
+
/* @__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, {}) }),
|
|
1526
|
+
supportText
|
|
1527
|
+
] })
|
|
1528
|
+
] });
|
|
1529
|
+
});
|
|
1530
|
+
var seta2 = (label, icon) => (options) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1531
|
+
"button",
|
|
1532
|
+
{
|
|
1533
|
+
type: "button",
|
|
1534
|
+
className: "cr-paginator__arrow",
|
|
1535
|
+
"aria-label": label,
|
|
1536
|
+
disabled: options.disabled,
|
|
1537
|
+
onClick: options.onClick,
|
|
1538
|
+
children: icon
|
|
1539
|
+
}
|
|
1540
|
+
);
|
|
1541
|
+
var Paginator = react.forwardRef(function Paginator2({
|
|
1542
|
+
totalRecords,
|
|
1543
|
+
first,
|
|
1544
|
+
rows,
|
|
1545
|
+
rowsPerPageOptions,
|
|
1546
|
+
pageLinkSize = 5,
|
|
1547
|
+
onPageChange,
|
|
1548
|
+
rowsPerPageLabel = "Itens por p\xE1gina",
|
|
1549
|
+
id,
|
|
1550
|
+
className
|
|
1551
|
+
}, ref) {
|
|
1552
|
+
const primeRef = react.useRef(null);
|
|
1553
|
+
react.useImperativeHandle(ref, () => primeRef.current?.getElement());
|
|
1554
|
+
const [interno, setInterno] = react.useState({
|
|
1555
|
+
first: 0,
|
|
1556
|
+
rows: rowsPerPageOptions?.[0] ?? 10
|
|
1557
|
+
});
|
|
1558
|
+
const atual = { first: first ?? interno.first, rows: rows ?? interno.rows };
|
|
1559
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1560
|
+
paginator.Paginator,
|
|
1561
|
+
{
|
|
1562
|
+
unstyled: true,
|
|
1563
|
+
ref: primeRef,
|
|
1564
|
+
id,
|
|
1565
|
+
totalRecords,
|
|
1566
|
+
first: atual.first,
|
|
1567
|
+
rows: atual.rows,
|
|
1568
|
+
rowsPerPageOptions,
|
|
1569
|
+
pageLinkSize,
|
|
1570
|
+
onPageChange: (event) => {
|
|
1571
|
+
setInterno({ first: event.first, rows: event.rows });
|
|
1572
|
+
onPageChange?.(event);
|
|
1573
|
+
},
|
|
1574
|
+
template: {
|
|
1575
|
+
layout: "FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown",
|
|
1576
|
+
FirstPageLink: seta2("Primeira p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDoubleLeft, { "aria-hidden": "true" })),
|
|
1577
|
+
PrevPageLink: seta2("P\xE1gina anterior", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretLeft, { "aria-hidden": "true" })),
|
|
1578
|
+
NextPageLink: seta2("Pr\xF3xima p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretRight, { "aria-hidden": "true" })),
|
|
1579
|
+
LastPageLink: seta2("\xDAltima p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDoubleRight, { "aria-hidden": "true" })),
|
|
1580
|
+
PageLinks: (options) => {
|
|
1581
|
+
const ativa = options.page === options.currentPage;
|
|
1582
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1583
|
+
"button",
|
|
1584
|
+
{
|
|
1585
|
+
type: "button",
|
|
1586
|
+
className: "cr-paginator__page",
|
|
1587
|
+
"aria-label": `P\xE1gina ${options.page + 1}`,
|
|
1588
|
+
"aria-current": ativa ? "page" : void 0,
|
|
1589
|
+
onClick: options.onClick,
|
|
1590
|
+
children: options.page + 1
|
|
1591
|
+
}
|
|
1592
|
+
);
|
|
1593
|
+
},
|
|
1594
|
+
// O Prime chama o template mesmo sem rowsPerPageOptions.
|
|
1595
|
+
RowsPerPageDropdown: (options) => options.options.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1596
|
+
Select,
|
|
1597
|
+
{
|
|
1598
|
+
className: "cr-paginator__rows",
|
|
1599
|
+
size: "medium",
|
|
1600
|
+
"aria-label": rowsPerPageLabel,
|
|
1601
|
+
options: options.options,
|
|
1602
|
+
optionValue: "value",
|
|
1603
|
+
value: options.value,
|
|
1604
|
+
onChange: (value) => options.onChange({ value })
|
|
1605
|
+
}
|
|
1606
|
+
)
|
|
1607
|
+
},
|
|
1608
|
+
pt: {
|
|
1609
|
+
root: { className: ["cr-paginator", className].filter(Boolean).join(" ") },
|
|
1610
|
+
pages: { className: "cr-paginator__pages" }
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
);
|
|
1614
|
+
});
|
|
1322
1615
|
var Panel = react.forwardRef(function Panel2({ className, style, children, ...props }, ref) {
|
|
1323
1616
|
const primeRef = react.useRef(null);
|
|
1324
1617
|
react.useImperativeHandle(ref, () => primeRef.current?.getElement());
|
|
@@ -1483,108 +1776,6 @@ var SegmentControl = react.forwardRef(
|
|
|
1483
1776
|
);
|
|
1484
1777
|
}
|
|
1485
1778
|
);
|
|
1486
|
-
var Select = react.forwardRef(function Select2({
|
|
1487
|
-
variant = "outline",
|
|
1488
|
-
size = "large",
|
|
1489
|
-
label,
|
|
1490
|
-
"aria-label": ariaLabel,
|
|
1491
|
-
options,
|
|
1492
|
-
optionLabel = "label",
|
|
1493
|
-
optionValue,
|
|
1494
|
-
value,
|
|
1495
|
-
onChange,
|
|
1496
|
-
placeholder = "Selecione uma op\xE7\xE3o",
|
|
1497
|
-
hint,
|
|
1498
|
-
error,
|
|
1499
|
-
required,
|
|
1500
|
-
disabled,
|
|
1501
|
-
id,
|
|
1502
|
-
name,
|
|
1503
|
-
className
|
|
1504
|
-
}, ref) {
|
|
1505
|
-
const autoId = react.useId();
|
|
1506
|
-
const inputId = id ?? autoId;
|
|
1507
|
-
const hintId = `${inputId}-hint`;
|
|
1508
|
-
const listId = `${inputId}-list`;
|
|
1509
|
-
const supportText = error ?? hint;
|
|
1510
|
-
const [open, setOpen] = react.useState(false);
|
|
1511
|
-
const setInputRef = react.useCallback(
|
|
1512
|
-
(input) => {
|
|
1513
|
-
input?.setAttribute("role", "combobox");
|
|
1514
|
-
if (typeof ref === "function") ref(input);
|
|
1515
|
-
else if (ref) ref.current = input;
|
|
1516
|
-
},
|
|
1517
|
-
[ref]
|
|
1518
|
-
);
|
|
1519
|
-
const classes = [
|
|
1520
|
-
"cr-field",
|
|
1521
|
-
`cr-field--${variant}`,
|
|
1522
|
-
`cr-field--${size}`,
|
|
1523
|
-
"cr-select",
|
|
1524
|
-
error && "cr-field--error",
|
|
1525
|
-
disabled && "cr-field--disabled",
|
|
1526
|
-
className
|
|
1527
|
-
].filter(Boolean).join(" ");
|
|
1528
|
-
const pt = {
|
|
1529
|
-
root: {
|
|
1530
|
-
className: `cr-field__control cr-select__control${open ? " cr-select__control--open" : ""}`,
|
|
1531
|
-
// O Prime aponta para um item mesmo sem destaque (dropdownItem_-1); o foco vai no item.
|
|
1532
|
-
"aria-activedescendant": void 0
|
|
1533
|
-
},
|
|
1534
|
-
// O <select> escondido do Prime só existe para formulários: fora da árvore de acessibilidade.
|
|
1535
|
-
select: { "aria-hidden": true },
|
|
1536
|
-
hiddenSelectedMessage: { className: "cr-select__hidden" },
|
|
1537
|
-
// O Prime usa a mesma chave no texto do campo e no combobox escondido.
|
|
1538
|
-
input: { className: "cr-select__value" },
|
|
1539
|
-
trigger: { className: "cr-field__icon cr-select__trigger", "aria-hidden": true },
|
|
1540
|
-
panel: { className: "cr-select__panel" },
|
|
1541
|
-
wrapper: { className: "cr-select__wrapper" },
|
|
1542
|
-
list: { className: "cr-select__list", id: listId },
|
|
1543
|
-
item: { className: "cr-select__item" },
|
|
1544
|
-
emptyMessage: { className: "cr-select__item cr-select__empty" }
|
|
1545
|
-
};
|
|
1546
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, children: [
|
|
1547
|
-
label && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "cr-field__label", htmlFor: inputId, children: [
|
|
1548
|
-
label,
|
|
1549
|
-
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__required", "aria-hidden": "true", children: "*" })
|
|
1550
|
-
] }),
|
|
1551
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1552
|
-
dropdown.Dropdown,
|
|
1553
|
-
{
|
|
1554
|
-
unstyled: true,
|
|
1555
|
-
inputId,
|
|
1556
|
-
focusInputRef: setInputRef,
|
|
1557
|
-
value,
|
|
1558
|
-
options,
|
|
1559
|
-
optionLabel,
|
|
1560
|
-
optionValue,
|
|
1561
|
-
onChange: (event) => onChange?.(event.value),
|
|
1562
|
-
onShow: () => setOpen(true),
|
|
1563
|
-
onHide: () => setOpen(false),
|
|
1564
|
-
disabled,
|
|
1565
|
-
required,
|
|
1566
|
-
name,
|
|
1567
|
-
invalid: Boolean(error),
|
|
1568
|
-
placeholder,
|
|
1569
|
-
valueTemplate: (option) => option == null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-select__placeholder", children: placeholder }) : String(option[optionLabel] ?? option),
|
|
1570
|
-
scrollHeight: "185px",
|
|
1571
|
-
dropdownIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDown, {}),
|
|
1572
|
-
collapseIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretUp, {}),
|
|
1573
|
-
"aria-label": label ? void 0 : ariaLabel,
|
|
1574
|
-
"aria-expanded": open,
|
|
1575
|
-
"aria-controls": open ? listId : void 0,
|
|
1576
|
-
"aria-describedby": supportText ? hintId : void 0,
|
|
1577
|
-
"aria-invalid": error ? true : void 0,
|
|
1578
|
-
"aria-required": required || void 0,
|
|
1579
|
-
pt
|
|
1580
|
-
}
|
|
1581
|
-
),
|
|
1582
|
-
supportText && /* @__PURE__ */ jsxRuntime.jsxs("p", { id: hintId, className: `cr-field__hint${error ? " cr-field__hint--error" : ""}`, children: [
|
|
1583
|
-
/* @__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, {}) }),
|
|
1584
|
-
supportText
|
|
1585
|
-
] })
|
|
1586
|
-
] });
|
|
1587
|
-
});
|
|
1588
1779
|
var Switch = react.forwardRef(function Switch2({
|
|
1589
1780
|
label,
|
|
1590
1781
|
showLabel = true,
|
|
@@ -1715,7 +1906,74 @@ var Tabs = react.forwardRef(function Tabs2({ activeIndex, onTabChange, children,
|
|
|
1715
1906
|
}
|
|
1716
1907
|
);
|
|
1717
1908
|
});
|
|
1909
|
+
var SEVERITY2 = {
|
|
1910
|
+
warning: "warn",
|
|
1911
|
+
danger: "error",
|
|
1912
|
+
success: "success",
|
|
1913
|
+
info: "info"
|
|
1914
|
+
};
|
|
1915
|
+
var ICON2 = {
|
|
1916
|
+
warning: /* @__PURE__ */ jsxRuntime.jsx(react$1.Warning, {}),
|
|
1917
|
+
danger: /* @__PURE__ */ jsxRuntime.jsx(react$1.XCircle, {}),
|
|
1918
|
+
success: /* @__PURE__ */ jsxRuntime.jsx(react$1.Check, {}),
|
|
1919
|
+
info: /* @__PURE__ */ jsxRuntime.jsx(react$1.Info, {})
|
|
1920
|
+
};
|
|
1921
|
+
var Toast = react.forwardRef(function Toast2({ position = "top-right", closeLabel = "Fechar", id, className }, ref) {
|
|
1922
|
+
const primeRef = react.useRef(null);
|
|
1923
|
+
const converter = ({
|
|
1924
|
+
type,
|
|
1925
|
+
title,
|
|
1926
|
+
message,
|
|
1927
|
+
showIcon = true,
|
|
1928
|
+
life,
|
|
1929
|
+
sticky
|
|
1930
|
+
}) => ({
|
|
1931
|
+
severity: SEVERITY2[type],
|
|
1932
|
+
summary: title,
|
|
1933
|
+
detail: message,
|
|
1934
|
+
// Sem ícone, um fragmento vazio: com undefined o Prime põe o ícone dele.
|
|
1935
|
+
icon: showIcon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-toast__icon", "aria-hidden": "true", children: ICON2[type] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}),
|
|
1936
|
+
closeIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.X, { "aria-hidden": "true" }),
|
|
1937
|
+
life,
|
|
1938
|
+
sticky,
|
|
1939
|
+
className: `cr-toast__message--${type}`
|
|
1940
|
+
});
|
|
1941
|
+
react.useImperativeHandle(ref, () => ({
|
|
1942
|
+
show: (message) => primeRef.current?.show(Array.isArray(message) ? message.map(converter) : converter(message)),
|
|
1943
|
+
clear: () => primeRef.current?.clear()
|
|
1944
|
+
}));
|
|
1945
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1946
|
+
toast.Toast,
|
|
1947
|
+
{
|
|
1948
|
+
...{ unstyled: true },
|
|
1949
|
+
ref: primeRef,
|
|
1950
|
+
id,
|
|
1951
|
+
position,
|
|
1952
|
+
pt: {
|
|
1953
|
+
root: {
|
|
1954
|
+
className: ["cr-toast", className].filter(Boolean).join(" ")
|
|
1955
|
+
},
|
|
1956
|
+
message: { className: "cr-toast__message" },
|
|
1957
|
+
content: { className: "cr-toast__content" },
|
|
1958
|
+
text: { className: "cr-toast__text" },
|
|
1959
|
+
summary: { className: "cr-toast__title" },
|
|
1960
|
+
detail: { className: "cr-toast__detail" },
|
|
1961
|
+
closeButton: { className: "cr-toast__close", "aria-label": closeLabel },
|
|
1962
|
+
// No unstyled o Prime não põe classes na transição: o Cristal dá as dele (Toast.css).
|
|
1963
|
+
transition: {
|
|
1964
|
+
classNames: {
|
|
1965
|
+
enter: "cr-toast__message--enter",
|
|
1966
|
+
enterActive: "cr-toast__message--enter-active",
|
|
1967
|
+
exitActive: "cr-toast__message--exit-active"
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
);
|
|
1973
|
+
});
|
|
1718
1974
|
|
|
1975
|
+
exports.Accordion = Accordion;
|
|
1976
|
+
exports.AccordionTab = AccordionTab;
|
|
1719
1977
|
exports.AutoComplete = AutoComplete;
|
|
1720
1978
|
exports.Badge = Badge;
|
|
1721
1979
|
exports.Button = Button;
|
|
@@ -1729,9 +1987,11 @@ exports.Input = Input;
|
|
|
1729
1987
|
exports.Menu = Menu;
|
|
1730
1988
|
exports.MenuPrincipal = MenuPrincipal;
|
|
1731
1989
|
exports.Menubar = Menubar;
|
|
1990
|
+
exports.Message = Message;
|
|
1732
1991
|
exports.Modal = Modal;
|
|
1733
1992
|
exports.MultiSelect = MultiSelect;
|
|
1734
1993
|
exports.PageHeader = PageHeader;
|
|
1994
|
+
exports.Paginator = Paginator;
|
|
1735
1995
|
exports.Panel = Panel;
|
|
1736
1996
|
exports.Radio = Radio;
|
|
1737
1997
|
exports.ScrollPanel = ScrollPanel;
|
|
@@ -1741,6 +2001,7 @@ exports.Switch = Switch;
|
|
|
1741
2001
|
exports.TabPanel = TabPanel;
|
|
1742
2002
|
exports.Tabs = Tabs;
|
|
1743
2003
|
exports.Tag = Tag;
|
|
2004
|
+
exports.Toast = Toast;
|
|
1744
2005
|
exports.Tooltip = Tooltip;
|
|
1745
2006
|
//# sourceMappingURL=index.cjs.map
|
|
1746
2007
|
//# sourceMappingURL=index.cjs.map
|