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