@1doc/1ds-react 2.9.0 → 2.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/CHANGELOG.md +434 -0
- package/dist/components/Accordion/Accordion.css +13 -0
- package/dist/components/Accordion/Accordion.d.ts +3 -0
- package/dist/components/Accordion/Accordion.js +1 -0
- package/dist/components/AppSubheader/AppSubheader.css +10 -1
- package/dist/components/AttachmentCard/AttachmentCard.css +10 -8
- package/dist/components/AttachmentCard/AttachmentCard.d.ts +3 -0
- package/dist/components/AttachmentCard/AttachmentCard.js +8 -1
- package/dist/components/Badge/Badge.css +14 -1
- package/dist/components/Badge/Badge.d.ts +11 -2
- package/dist/components/Badge/Badge.js +3 -0
- package/dist/components/Calendar/Calendar.d.ts +7 -6
- package/dist/components/Coachmark/Coachmark.css +10 -0
- package/dist/components/Coachmark/Coachmark.d.ts +12 -0
- package/dist/components/Coachmark/Coachmark.js +46 -5
- package/dist/components/ColorPicker/ColorPicker.css +8 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts +2 -2
- package/dist/components/DataTable/DataTable.css +174 -0
- package/dist/components/DataTable/DataTable.d.ts +63 -2
- package/dist/components/DataTable/DataTable.js +278 -6
- package/dist/components/DescriptionList/DescriptionList.css +14 -0
- package/dist/components/DescriptionList/DescriptionList.d.ts +3 -0
- package/dist/components/DescriptionList/DescriptionList.js +1 -0
- package/dist/components/EmptyState/EmptyState.d.ts +4 -2
- package/dist/components/EmptyState/EmptyState.js +2 -2
- package/dist/components/Input/Input.css +21 -0
- package/dist/components/Input/Input.d.ts +7 -0
- package/dist/components/Input/Input.js +2 -1
- package/dist/components/List/ListItem.d.ts +14 -2
- package/dist/components/List/ListItem.js +3 -2
- package/dist/components/RichTextEditor/RichTextEditor.css +47 -0
- package/dist/components/RichTextEditor/RichTextEditor.d.ts +22 -8
- package/dist/components/RichTextEditor/RichTextEditor.js +460 -3
- package/dist/components/SegmentedControl/SegmentedControl.css +24 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +2 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +4 -1
- package/dist/components/Select/Select.css +94 -0
- package/dist/components/Select/Select.d.ts +26 -4
- package/dist/components/Select/Select.js +210 -35
- package/dist/components/StatCard/StatCard.css +65 -0
- package/dist/components/StatCard/StatCard.d.ts +9 -0
- package/dist/components/StatCard/StatCard.js +10 -1
- package/dist/components/Toast/Toast.css +32 -0
- package/dist/components/Toast/Toast.d.ts +18 -0
- package/dist/components/Toast/Toast.js +14 -1
- package/dist/components/Toast/ToastStack.js +8 -1
- package/dist/teste/AccordionTituloNeutro.test.d.ts +1 -0
- package/dist/teste/AccordionTituloNeutro.test.js +23 -0
- package/dist/teste/AppSubheaderRegiao.test.d.ts +1 -0
- package/dist/teste/AppSubheaderRegiao.test.js +13 -0
- package/dist/teste/AttachmentCardLista.test.d.ts +1 -0
- package/dist/teste/AttachmentCardLista.test.js +49 -0
- package/dist/teste/AttachmentCardSm.test.d.ts +1 -0
- package/dist/teste/AttachmentCardSm.test.js +26 -0
- package/dist/teste/BadgeNeutroColado.test.d.ts +1 -0
- package/dist/teste/BadgeNeutroColado.test.js +11 -0
- package/dist/teste/BadgeTag.test.js +13 -0
- package/dist/teste/CalendarCabecalho.test.d.ts +1 -0
- package/dist/teste/CalendarCabecalho.test.js +11 -0
- package/dist/teste/CoachmarkSemVeu.test.d.ts +1 -0
- package/dist/teste/CoachmarkSemVeu.test.js +85 -0
- package/dist/teste/ColorPickerXs.test.d.ts +1 -0
- package/dist/teste/ColorPickerXs.test.js +21 -0
- package/dist/teste/DataTableArvoreEVariantes.test.d.ts +1 -0
- package/dist/teste/DataTableArvoreEVariantes.test.js +190 -0
- package/dist/teste/DescriptionListCompacta.test.d.ts +1 -0
- package/dist/teste/DescriptionListCompacta.test.js +22 -0
- package/dist/teste/EmptyStateTituloRico.test.d.ts +1 -0
- package/dist/teste/EmptyStateTituloRico.test.js +23 -0
- package/dist/teste/InputAgrupado.test.d.ts +1 -0
- package/dist/teste/InputAgrupado.test.js +24 -0
- package/dist/teste/ListItemTooltipStandalone.test.d.ts +1 -0
- package/dist/teste/ListItemTooltipStandalone.test.js +39 -0
- package/dist/teste/RichTextEditorAlinhaImagemTabela.test.d.ts +1 -0
- package/dist/teste/RichTextEditorAlinhaImagemTabela.test.js +212 -0
- package/dist/teste/RichTextEditorEstiloDeTexto.test.d.ts +1 -0
- package/dist/teste/RichTextEditorEstiloDeTexto.test.js +120 -0
- package/dist/teste/SegmentedControlContador.test.d.ts +1 -0
- package/dist/teste/SegmentedControlContador.test.js +39 -0
- package/dist/teste/SelectAbertoControladoEFlutuante.test.d.ts +1 -0
- package/dist/teste/SelectAbertoControladoEFlutuante.test.js +145 -0
- package/dist/teste/SelectFiltroCorETamanho.test.d.ts +1 -0
- package/dist/teste/SelectFiltroCorETamanho.test.js +77 -0
- package/dist/teste/StatCardSecundariaETom.test.d.ts +1 -0
- package/dist/teste/StatCardSecundariaETom.test.js +45 -0
- package/dist/teste/ToastAcaoEDetalhes.test.d.ts +1 -0
- package/dist/teste/ToastAcaoEDetalhes.test.js +94 -0
- package/dist/utils/html-seguro.d.ts +19 -1
- package/dist/utils/html-seguro.js +113 -2
- package/dist/utils/toast.d.ts +10 -1
- package/dist/utils/toast.js +2 -1
- package/package.json +2 -2
- package/src/teste/AccordionTituloNeutro.test.tsx +25 -0
- package/src/teste/AppSubheaderRegiao.test.tsx +17 -0
- package/src/teste/AttachmentCardLista.test.tsx +53 -0
- package/src/teste/AttachmentCardSm.test.tsx +29 -0
- package/src/teste/BadgeNeutroColado.test.tsx +15 -0
- package/src/teste/BadgeTag.test.tsx +21 -0
- package/src/teste/CalendarCabecalho.test.tsx +11 -0
- package/src/teste/CoachmarkSemVeu.test.tsx +101 -0
- package/src/teste/ColorPickerXs.test.tsx +22 -0
- package/src/teste/DataTableArvoreEVariantes.test.tsx +240 -0
- package/src/teste/DescriptionListCompacta.test.tsx +24 -0
- package/src/teste/EmptyStateTituloRico.test.tsx +34 -0
- package/src/teste/InputAgrupado.test.tsx +26 -0
- package/src/teste/ListItemTooltipStandalone.test.tsx +64 -0
- package/src/teste/RichTextEditorAlinhaImagemTabela.test.tsx +238 -0
- package/src/teste/RichTextEditorEstiloDeTexto.test.tsx +137 -0
- package/src/teste/SegmentedControlContador.test.tsx +43 -0
- package/src/teste/SelectAbertoControladoEFlutuante.test.tsx +180 -0
- package/src/teste/SelectFiltroCorETamanho.test.tsx +90 -0
- package/src/teste/StatCardSecundariaETom.test.tsx +51 -0
- package/src/teste/ToastAcaoEDetalhes.test.tsx +109 -0
- package/src/utils/html-seguro.ts +105 -2
- package/src/utils/toast.ts +12 -2
|
@@ -2,16 +2,253 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import './DataTable.css';
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { faSort, faSortUp, faSortDown, faInbox, faChevronRight, faChevronDown, } from "@fortawesome/free-solid-svg-icons";
|
|
6
7
|
import Icon from "../Icon/Icon";
|
|
7
8
|
import Checkbox from "../Checkbox/Checkbox";
|
|
8
9
|
function DataTable(props) {
|
|
10
|
+
const [expandedState, setExpandedState] = useState(() => Array());
|
|
11
|
+
const [expandTouched, setExpandTouched] = useState(() => false);
|
|
12
|
+
const [activeRow, setActiveRow] = useState(() => 0);
|
|
9
13
|
function columnsList() {
|
|
10
14
|
return props.columns || [];
|
|
11
15
|
}
|
|
12
16
|
function rows() {
|
|
17
|
+
if (props.treeData)
|
|
18
|
+
return treeNodes().map((node) => node.row);
|
|
13
19
|
return props.data || [];
|
|
14
20
|
}
|
|
21
|
+
function childField() {
|
|
22
|
+
return props.childrenKey || "children";
|
|
23
|
+
}
|
|
24
|
+
function isOpenKey(key, todas) {
|
|
25
|
+
if (todas)
|
|
26
|
+
return true;
|
|
27
|
+
if (props.expandedKeys)
|
|
28
|
+
return props.expandedKeys.includes(key);
|
|
29
|
+
if (expandTouched)
|
|
30
|
+
return expandedState.includes(key);
|
|
31
|
+
if (props.defaultExpandAll)
|
|
32
|
+
return true;
|
|
33
|
+
return (props.defaultExpandedKeys || []).includes(key);
|
|
34
|
+
}
|
|
35
|
+
function flatten(todas) {
|
|
36
|
+
const raizes = props.data || [];
|
|
37
|
+
const saida = [];
|
|
38
|
+
const pilha = [];
|
|
39
|
+
for (let r = raizes.length - 1; r >= 0; r--) {
|
|
40
|
+
pilha.push({
|
|
41
|
+
row: raizes[r],
|
|
42
|
+
level: 0,
|
|
43
|
+
pos: r,
|
|
44
|
+
size: raizes.length,
|
|
45
|
+
path: String(r),
|
|
46
|
+
guides: [],
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
while (pilha.length > 0) {
|
|
50
|
+
const item = pilha.pop();
|
|
51
|
+
const filhas = item.row[childField()];
|
|
52
|
+
const hasKids = Array.isArray(filhas) && filhas.length > 0;
|
|
53
|
+
const chave = typeof props.rowKey === "function"
|
|
54
|
+
? props.rowKey(item.row)
|
|
55
|
+
: props.rowKey
|
|
56
|
+
? item.row[props.rowKey]
|
|
57
|
+
: item.path;
|
|
58
|
+
const open = hasKids && isOpenKey(chave, todas);
|
|
59
|
+
saida.push({
|
|
60
|
+
row: item.row,
|
|
61
|
+
level: item.level,
|
|
62
|
+
key: chave,
|
|
63
|
+
hasKids,
|
|
64
|
+
open,
|
|
65
|
+
pos: item.pos + 1,
|
|
66
|
+
size: item.size,
|
|
67
|
+
guides: item.guides,
|
|
68
|
+
});
|
|
69
|
+
if (open) {
|
|
70
|
+
// Para as filhas, o guia do PRÓPRIO nó vira a linha que continua (tem irmã depois) ou some.
|
|
71
|
+
const base = item.guides.map((g, gi) => gi === item.guides.length - 1 ? (g === "tee" ? "line" : "none") : g);
|
|
72
|
+
for (let c = filhas.length - 1; c >= 0; c--) {
|
|
73
|
+
pilha.push({
|
|
74
|
+
row: filhas[c],
|
|
75
|
+
level: item.level + 1,
|
|
76
|
+
pos: c,
|
|
77
|
+
size: filhas.length,
|
|
78
|
+
path: item.path + "." + c,
|
|
79
|
+
guides: [...base, c === filhas.length - 1 ? "elbow" : "tee"],
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return saida;
|
|
85
|
+
}
|
|
86
|
+
function treeNodes() {
|
|
87
|
+
if (!props.treeData)
|
|
88
|
+
return [];
|
|
89
|
+
return flatten(false);
|
|
90
|
+
}
|
|
91
|
+
function nodeAt(index) {
|
|
92
|
+
return treeNodes()[index];
|
|
93
|
+
}
|
|
94
|
+
function allParentKeys() {
|
|
95
|
+
return flatten(true)
|
|
96
|
+
.filter((node) => node.hasKids)
|
|
97
|
+
.map((node) => node.key);
|
|
98
|
+
}
|
|
99
|
+
function currentExpanded() {
|
|
100
|
+
if (props.expandedKeys)
|
|
101
|
+
return props.expandedKeys;
|
|
102
|
+
if (expandTouched)
|
|
103
|
+
return expandedState;
|
|
104
|
+
if (props.defaultExpandAll)
|
|
105
|
+
return allParentKeys();
|
|
106
|
+
return props.defaultExpandedKeys || [];
|
|
107
|
+
}
|
|
108
|
+
function toggleNode(index, abrir) {
|
|
109
|
+
const node = nodeAt(index);
|
|
110
|
+
if (!node || !node.hasKids)
|
|
111
|
+
return;
|
|
112
|
+
const vaiAbrir = typeof abrir === "boolean" ? abrir : !node.open;
|
|
113
|
+
if (vaiAbrir === node.open)
|
|
114
|
+
return;
|
|
115
|
+
const atuais = currentExpanded();
|
|
116
|
+
const proximas = vaiAbrir
|
|
117
|
+
? [...atuais, node.key]
|
|
118
|
+
: atuais.filter((k) => k !== node.key);
|
|
119
|
+
setExpandedState(proximas);
|
|
120
|
+
setExpandTouched(true);
|
|
121
|
+
if (props.onExpand)
|
|
122
|
+
props.onExpand(proximas, node.row, vaiAbrir);
|
|
123
|
+
}
|
|
124
|
+
function handleToggleClick(index, event) {
|
|
125
|
+
if (event)
|
|
126
|
+
event.stopPropagation();
|
|
127
|
+
toggleNode(index);
|
|
128
|
+
}
|
|
129
|
+
function treeLevel(index) {
|
|
130
|
+
if (!props.treeData)
|
|
131
|
+
return undefined;
|
|
132
|
+
const node = nodeAt(index);
|
|
133
|
+
return node ? node.level + 1 : undefined;
|
|
134
|
+
}
|
|
135
|
+
function treePosInSet(index) {
|
|
136
|
+
if (!props.treeData)
|
|
137
|
+
return undefined;
|
|
138
|
+
const node = nodeAt(index);
|
|
139
|
+
return node ? node.pos : undefined;
|
|
140
|
+
}
|
|
141
|
+
function treeSetSize(index) {
|
|
142
|
+
if (!props.treeData)
|
|
143
|
+
return undefined;
|
|
144
|
+
const node = nodeAt(index);
|
|
145
|
+
return node ? node.size : undefined;
|
|
146
|
+
}
|
|
147
|
+
function treeExpanded(index) {
|
|
148
|
+
if (!props.treeData)
|
|
149
|
+
return undefined;
|
|
150
|
+
const node = nodeAt(index);
|
|
151
|
+
if (!node || !node.hasKids)
|
|
152
|
+
return undefined;
|
|
153
|
+
return node.open ? "true" : "false";
|
|
154
|
+
}
|
|
155
|
+
function treeHasKids(index) {
|
|
156
|
+
const node = nodeAt(index);
|
|
157
|
+
return !!node && node.hasKids;
|
|
158
|
+
}
|
|
159
|
+
function treeOpen(index) {
|
|
160
|
+
const node = nodeAt(index);
|
|
161
|
+
return !!node && node.open;
|
|
162
|
+
}
|
|
163
|
+
function isTreeCell(colIndex) {
|
|
164
|
+
return !!props.treeData && colIndex === 0;
|
|
165
|
+
}
|
|
166
|
+
function guidesOf(index) {
|
|
167
|
+
const node = nodeAt(index);
|
|
168
|
+
// Tipado na variável: o Mitosis tira a anotação de retorno, e sem ela o `map` do JSX fica com parâmetros `any` implícitos.
|
|
169
|
+
const guias = node ? node.guides : [];
|
|
170
|
+
return guias;
|
|
171
|
+
}
|
|
172
|
+
function guideClass(guia) {
|
|
173
|
+
return "umds-datatable__guide umds-datatable__guide--" + guia;
|
|
174
|
+
}
|
|
175
|
+
function indentOf(index) {
|
|
176
|
+
const node = nodeAt(index);
|
|
177
|
+
return ("calc(" +
|
|
178
|
+
(node ? node.level : 0) +
|
|
179
|
+
" * var(--umds-primitive-spacing-xxs))");
|
|
180
|
+
}
|
|
181
|
+
function toggleLabel(index) {
|
|
182
|
+
return treeOpen(index)
|
|
183
|
+
? props.collapseLabel || "Recolher"
|
|
184
|
+
: props.expandLabel || "Expandir";
|
|
185
|
+
}
|
|
186
|
+
function treeToggleIcon(index) {
|
|
187
|
+
return treeOpen(index) ? faChevronDown : faChevronRight;
|
|
188
|
+
}
|
|
189
|
+
function parentIndexOf(index) {
|
|
190
|
+
const nos = treeNodes();
|
|
191
|
+
const nivel = nos[index] ? nos[index].level : 0;
|
|
192
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
193
|
+
if (nos[i].level < nivel)
|
|
194
|
+
return i;
|
|
195
|
+
}
|
|
196
|
+
return -1;
|
|
197
|
+
}
|
|
198
|
+
function focusRowAt(atual, index) {
|
|
199
|
+
const linhas = atual.parentElement
|
|
200
|
+
? atual.parentElement.querySelectorAll("tr[aria-level]")
|
|
201
|
+
: [];
|
|
202
|
+
const alvo = linhas[index];
|
|
203
|
+
if (alvo)
|
|
204
|
+
alvo.focus();
|
|
205
|
+
}
|
|
206
|
+
function handleTreeKey(index, event) {
|
|
207
|
+
const total = treeNodes().length;
|
|
208
|
+
const k = event.key;
|
|
209
|
+
const atual = event.currentTarget;
|
|
210
|
+
let alvo = -2;
|
|
211
|
+
if (k === "ArrowDown")
|
|
212
|
+
alvo = Math.min(index + 1, total - 1);
|
|
213
|
+
else if (k === "ArrowUp")
|
|
214
|
+
alvo = Math.max(index - 1, 0);
|
|
215
|
+
else if (k === "Home")
|
|
216
|
+
alvo = 0;
|
|
217
|
+
else if (k === "End")
|
|
218
|
+
alvo = total - 1;
|
|
219
|
+
else if (k === "ArrowRight") {
|
|
220
|
+
if (!treeHasKids(index))
|
|
221
|
+
return false;
|
|
222
|
+
if (!treeOpen(index)) {
|
|
223
|
+
toggleNode(index, true);
|
|
224
|
+
event.preventDefault();
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
alvo = index + 1;
|
|
228
|
+
}
|
|
229
|
+
else if (k === "ArrowLeft") {
|
|
230
|
+
if (treeHasKids(index) && treeOpen(index)) {
|
|
231
|
+
toggleNode(index, false);
|
|
232
|
+
event.preventDefault();
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
alvo = parentIndexOf(index);
|
|
236
|
+
if (alvo < 0)
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
event.preventDefault();
|
|
243
|
+
if (alvo >= 0)
|
|
244
|
+
focusRowAt(atual, alvo);
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
function handleRowFocus(index, event) {
|
|
248
|
+
if (!props.treeData || !event || event.target !== event.currentTarget)
|
|
249
|
+
return;
|
|
250
|
+
setActiveRow(index);
|
|
251
|
+
}
|
|
15
252
|
function selectedIndexes() {
|
|
16
253
|
return props.selectedRows || [];
|
|
17
254
|
}
|
|
@@ -32,6 +269,11 @@ function DataTable(props) {
|
|
|
32
269
|
"umds-datatable",
|
|
33
270
|
props.variant === "document" ? "umds-datatable--document" : "",
|
|
34
271
|
props.density === "compact" ? "umds-datatable--compact" : "",
|
|
272
|
+
props.headerVariant === "dark" ? "umds-datatable--header-dark" : "",
|
|
273
|
+
props.headerUppercase ? "umds-datatable--header-uppercase" : "",
|
|
274
|
+
props.hideHeader ? "umds-datatable--header-hidden" : "",
|
|
275
|
+
props.striped ? "umds-datatable--striped" : "",
|
|
276
|
+
props.treeData ? "umds-datatable--tree" : "",
|
|
35
277
|
props.className,
|
|
36
278
|
]
|
|
37
279
|
.filter(Boolean)
|
|
@@ -167,6 +409,17 @@ function DataTable(props) {
|
|
|
167
409
|
return col.render(row, rowIndex);
|
|
168
410
|
return row[col.key];
|
|
169
411
|
}
|
|
412
|
+
function isHighlighted(row, index) {
|
|
413
|
+
if (props.isRowSelected && props.isRowSelected(row, index))
|
|
414
|
+
return true;
|
|
415
|
+
if (props.selectedRowKeys && props.rowKey) {
|
|
416
|
+
return props.selectedRowKeys.includes(rowKeyOf(row, index));
|
|
417
|
+
}
|
|
418
|
+
return false;
|
|
419
|
+
}
|
|
420
|
+
function ariaSelectedRow(row, index) {
|
|
421
|
+
return isHighlighted(row, index) ? "true" : undefined;
|
|
422
|
+
}
|
|
170
423
|
function handleRowClick(rowIndex, row) {
|
|
171
424
|
if (props.variant === "document")
|
|
172
425
|
return;
|
|
@@ -174,6 +427,12 @@ function DataTable(props) {
|
|
|
174
427
|
props.onRowClick(rowIndex, row);
|
|
175
428
|
}
|
|
176
429
|
function aoTeclarNaLinha(rowIndex, row, event) {
|
|
430
|
+
if (props.treeData &&
|
|
431
|
+
event &&
|
|
432
|
+
event.target === event.currentTarget &&
|
|
433
|
+
handleTreeKey(rowIndex, event)) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
177
436
|
if (!props.onRowClick || props.variant === "document" || !event)
|
|
178
437
|
return;
|
|
179
438
|
// Só a própria linha aciona. Sem esta guarda, o Espaço dentro do
|
|
@@ -189,7 +448,10 @@ function DataTable(props) {
|
|
|
189
448
|
event.preventDefault();
|
|
190
449
|
handleRowClick(rowIndex, row);
|
|
191
450
|
}
|
|
192
|
-
function
|
|
451
|
+
function rowTabIndexAt(index) {
|
|
452
|
+
if (props.treeData) {
|
|
453
|
+
return index === Math.min(activeRow, treeNodes().length - 1) ? 0 : -1;
|
|
454
|
+
}
|
|
193
455
|
return props.onRowClick && props.variant !== "document" ? 0 : undefined;
|
|
194
456
|
}
|
|
195
457
|
function rowRole() {
|
|
@@ -200,6 +462,9 @@ function DataTable(props) {
|
|
|
200
462
|
return props.selectRowLabel(index + 1);
|
|
201
463
|
return "Selecionar linha " + (index + 1);
|
|
202
464
|
}
|
|
465
|
+
function tableRole() {
|
|
466
|
+
return props.treeData ? "treegrid" : undefined;
|
|
467
|
+
}
|
|
203
468
|
function thClasses(col) {
|
|
204
469
|
return [
|
|
205
470
|
"umds-datatable__th",
|
|
@@ -237,10 +502,11 @@ function DataTable(props) {
|
|
|
237
502
|
function sortableCol(col) {
|
|
238
503
|
return !!col.sortable && props.variant !== "document";
|
|
239
504
|
}
|
|
240
|
-
function tdClasses(col) {
|
|
505
|
+
function tdClasses(col, colIndex) {
|
|
241
506
|
return [
|
|
242
507
|
"umds-datatable__td",
|
|
243
508
|
col.align ? `umds-datatable__td--${col.align}` : "",
|
|
509
|
+
isTreeCell(colIndex) ? "umds-datatable__td--tree" : "",
|
|
244
510
|
]
|
|
245
511
|
.filter(Boolean)
|
|
246
512
|
.join(" ");
|
|
@@ -248,7 +514,11 @@ function DataTable(props) {
|
|
|
248
514
|
function rowClasses(row, rowIdx) {
|
|
249
515
|
return [
|
|
250
516
|
"umds-datatable__row",
|
|
251
|
-
isSelected(row, rowIdx)
|
|
517
|
+
isSelected(row, rowIdx) || isHighlighted(row, rowIdx)
|
|
518
|
+
? "umds-datatable__row--selected"
|
|
519
|
+
: "",
|
|
520
|
+
isHighlighted(row, rowIdx) ? "umds-datatable__row--highlighted" : "",
|
|
521
|
+
props.striped && rowIdx % 2 === 1 ? "umds-datatable__row--striped" : "",
|
|
252
522
|
props.onRowClick && props.variant !== "document"
|
|
253
523
|
? "umds-datatable__row--clickable"
|
|
254
524
|
: "",
|
|
@@ -256,10 +526,12 @@ function DataTable(props) {
|
|
|
256
526
|
.filter(Boolean)
|
|
257
527
|
.join(" ");
|
|
258
528
|
}
|
|
259
|
-
return (_jsx("div", { className: tableClasses(), children: _jsxs("table", { className: "umds-datatable__table", "aria-busy": props.loading, children: [_jsx("thead", { className: "umds-datatable__thead", children: _jsxs("tr", { children: [canSelect() ? (_jsx("th", { scope: "col", className: "umds-datatable__th umds-datatable__th--checkbox", children: _jsx(Checkbox, { checked: allSelected(), indeterminate: someSelected(), ariaLabel: props.selectAllLabel || "Selecionar todas as linhas", onChange: (event) => toggleAll() }) })) : null, columnsList()?.map((col) => (_jsxs("th", { scope: "col", style: col.width
|
|
529
|
+
return (_jsx("div", { className: tableClasses(), children: _jsxs("table", { className: "umds-datatable__table", "aria-busy": props.loading, role: tableRole(), children: [_jsx("thead", { className: "umds-datatable__thead", children: _jsxs("tr", { children: [canSelect() ? (_jsx("th", { scope: "col", className: "umds-datatable__th umds-datatable__th--checkbox", children: _jsx(Checkbox, { checked: allSelected(), indeterminate: someSelected(), ariaLabel: props.selectAllLabel || "Selecionar todas as linhas", onChange: (event) => toggleAll() }) })) : null, columnsList()?.map((col) => (_jsxs("th", { scope: "col", style: col.width
|
|
260
530
|
? {
|
|
261
531
|
width: col.width,
|
|
262
532
|
}
|
|
263
|
-
: {}, "aria-sort": ariaSort(col), className: thClasses(col), children: [sortableCol(col) ? (_jsxs("button", { type: "button", className: "umds-datatable__sort-button umds-datatable__th-content", onClick: (event) => handleSort(col), children: [col.label, _jsx("span", { "aria-hidden": "true", className: sortIconClasses(col), children: _jsx(Icon, { variant: "inherit", customSize: "12px", icon: sortIconName(col) }) })] })) : null, !sortableCol(col) ? (_jsx("span", { className: "umds-datatable__th-content", children: col.label })) : null] }, col.key)))] }) }), _jsxs("tbody", { className: "umds-datatable__tbody", children: [props.loading ? (_jsx(_Fragment, { children: skeletonRowsList()?.map((_, rowIdx) => (_jsxs("tr", { className: "umds-datatable__row umds-datatable__row--skeleton", children: [canSelect() ? (_jsx("td", { className: "umds-datatable__td umds-datatable__td--checkbox", children: _jsx("div", { className: "umds-datatable__skeleton umds-datatable__skeleton--checkbox" }) })) : null, columnsList()?.map((col) => (_jsx("td", { className: "umds-datatable__td", children: _jsx("div", { className: "umds-datatable__skeleton" }) }, col.key)))] }, `sk-${rowIdx}`))) })) : null, isEmpty() ? (_jsx("tr", { className: "umds-datatable__row--empty", children: _jsx("td", { className: "umds-datatable__td umds-datatable__td--empty", colSpan: colSpan(), children: _jsxs("div", { className: "umds-datatable__empty", children: [_jsx("span", { "aria-hidden": "true", className: "umds-datatable__empty-icon", children: _jsx(Icon, { variant: "inherit", customSize: "48px", icon: faInbox }) }), _jsx("span", { children: props.emptyMessage || "Nenhum registro encontrado" })] }) }) })) : null, hasRows() ? (_jsx(_Fragment, { children: rows()?.map((row, rowIdx) => (_jsxs(React.Fragment, { children: [newGroupLabel(rowIdx) ? (_jsx("tr", { className: "umds-datatable__row umds-datatable__row--group", children: _jsx("th", { scope: "rowgroup", className: "umds-datatable__group", colSpan: colSpan(), children: groupContent(newGroupLabel(rowIdx), row, rowIdx) }) })) : null, _jsxs("tr", { onClick: (event) => handleRowClick(rowIdx, row), onKeyDown: (event) => aoTeclarNaLinha(rowIdx, row, event), tabIndex:
|
|
533
|
+
: {}, "aria-sort": ariaSort(col), className: thClasses(col), children: [sortableCol(col) ? (_jsxs("button", { type: "button", className: "umds-datatable__sort-button umds-datatable__th-content", onClick: (event) => handleSort(col), children: [col.label, _jsx("span", { "aria-hidden": "true", className: sortIconClasses(col), children: _jsx(Icon, { variant: "inherit", customSize: "12px", icon: sortIconName(col) }) })] })) : null, !sortableCol(col) ? (_jsx("span", { className: "umds-datatable__th-content", children: col.label })) : null] }, col.key)))] }) }), _jsxs("tbody", { className: "umds-datatable__tbody", children: [props.loading ? (_jsx(_Fragment, { children: skeletonRowsList()?.map((_, rowIdx) => (_jsxs("tr", { className: "umds-datatable__row umds-datatable__row--skeleton", children: [canSelect() ? (_jsx("td", { className: "umds-datatable__td umds-datatable__td--checkbox", children: _jsx("div", { className: "umds-datatable__skeleton umds-datatable__skeleton--checkbox" }) })) : null, columnsList()?.map((col) => (_jsx("td", { className: "umds-datatable__td", children: _jsx("div", { className: "umds-datatable__skeleton" }) }, col.key)))] }, `sk-${rowIdx}`))) })) : null, isEmpty() ? (_jsx("tr", { className: "umds-datatable__row--empty", children: _jsx("td", { className: "umds-datatable__td umds-datatable__td--empty", colSpan: colSpan(), children: _jsxs("div", { className: "umds-datatable__empty", children: [_jsx("span", { "aria-hidden": "true", className: "umds-datatable__empty-icon", children: _jsx(Icon, { variant: "inherit", customSize: "48px", icon: props.emptyIcon || faInbox }) }), _jsx("span", { children: props.emptyMessage || "Nenhum registro encontrado" }), !!props.emptyDescription ? (_jsx("span", { className: "umds-datatable__empty-desc", children: props.emptyDescription })) : null] }) }) })) : null, hasRows() ? (_jsx(_Fragment, { children: rows()?.map((row, rowIdx) => (_jsxs(React.Fragment, { children: [newGroupLabel(rowIdx) ? (_jsx("tr", { className: "umds-datatable__row umds-datatable__row--group", children: _jsx("th", { scope: "rowgroup", className: "umds-datatable__group", colSpan: colSpan(), children: groupContent(newGroupLabel(rowIdx), row, rowIdx) }) })) : null, _jsxs("tr", { onClick: (event) => handleRowClick(rowIdx, row), onKeyDown: (event) => aoTeclarNaLinha(rowIdx, row, event), onFocus: (event) => handleRowFocus(rowIdx, event), tabIndex: rowTabIndexAt(rowIdx), role: rowRole(), "aria-selected": ariaSelectedRow(row, rowIdx), "aria-level": treeLevel(rowIdx), "aria-posinset": treePosInSet(rowIdx), "aria-setsize": treeSetSize(rowIdx), "aria-expanded": treeExpanded(rowIdx), className: rowClasses(row, rowIdx), children: [canSelect() ? (_jsx("td", { className: "umds-datatable__td umds-datatable__td--checkbox", onClick: (event) => event.stopPropagation(), children: _jsx(Checkbox, { checked: isSelected(row, rowIdx), ariaLabel: rowSelectLabel(rowIdx), onChange: (event) => toggleRow(row, rowIdx) }) })) : null, columnsList()?.map((col, colIdx) => (_jsxs("td", { className: tdClasses(col, colIdx), children: [isTreeCell(colIdx) ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", className: "umds-datatable__tree-guides", children: guidesOf(rowIdx)?.map((guia, guiaIdx) => (_jsx("span", { className: guideClass(guia) }, guiaIdx))) }), _jsxs("div", { className: "umds-datatable__tree-content", style: {
|
|
534
|
+
paddingLeft: indentOf(rowIdx),
|
|
535
|
+
}, children: [treeHasKids(rowIdx) ? (_jsx("button", { type: "button", className: "umds-datatable__tree-toggle", tabIndex: -1, "aria-label": toggleLabel(rowIdx), onClick: (event) => handleToggleClick(rowIdx, event), children: _jsx(Icon, { variant: "inherit", customSize: "12px", icon: treeToggleIcon(rowIdx) }) })) : null, !treeHasKids(rowIdx) ? (_jsx("span", { "aria-hidden": "true", className: "umds-datatable__tree-spacer" })) : null, _jsx("div", { className: "umds-datatable__tree-text", children: cellContent(col, row, rowIdx) })] })] })) : null, !isTreeCell(colIdx) ? (_jsx(_Fragment, { children: cellContent(col, row, rowIdx) })) : null] }, col.key)))] })] }, rowIdx))) })) : null] })] }) }));
|
|
264
536
|
}
|
|
265
537
|
export default DataTable;
|
|
@@ -90,6 +90,20 @@
|
|
|
90
90
|
background: var(--umds-semantic-field-readonly-background);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
/* ── Compacta (density="compact"): a fonte de 12px do CrisDoc ──
|
|
94
|
+
O rótulo do `stacked` já é 12px; o valor desce de 14 para 12. */
|
|
95
|
+
.umds-description-list--compact {
|
|
96
|
+
font-size: var(--umds-primitive-font-size-xxxs); /* 12px */
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.umds-description-list--compact.umds-description-list--stacked {
|
|
100
|
+
gap: var(--umds-primitive-spacing-mini); /* 12px */
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.umds-description-list--compact.umds-description-list--bordered .umds-description-list__description {
|
|
104
|
+
padding: var(--umds-primitive-spacing-quarck) var(--umds-primitive-spacing-nano); /* 4px 8px */
|
|
105
|
+
}
|
|
106
|
+
|
|
93
107
|
/* Telas estreitas: o stacked vira uma coluna só. */
|
|
94
108
|
@media (max-width: 640px) {
|
|
95
109
|
.umds-description-list--cols-2,
|
|
@@ -32,6 +32,7 @@ export interface DescriptionListItem {
|
|
|
32
32
|
* @property {DescriptionListItem[]} items - Os pares, na ordem em que aparecem
|
|
33
33
|
* @property {string} layout - 'inline' (padrão) | 'stacked'
|
|
34
34
|
* @property {number} columns - Só no `stacked`: colunas de pares, de 1 a 4 (padrão 2)
|
|
35
|
+
* @property {string} density - 'default' | 'compact'. O compacto leva a fonte a 12px (o tamanho do CrisDoc) e aperta o espaço entre os pares do `stacked`.
|
|
35
36
|
* @property {boolean} bordered - Só no `stacked`: o valor numa caixa de campo somente leitura
|
|
36
37
|
* @property {boolean} fit - Só no `inline`: encolhe até o conteúdo em vez de ocupar a largura toda
|
|
37
38
|
* @property {string} emptyValue - Texto quando o valor vem vazio (padrão: "—")
|
|
@@ -46,6 +47,8 @@ export interface DescriptionListProps {
|
|
|
46
47
|
layout?: "inline" | "stacked";
|
|
47
48
|
columns?: 1 | 2 | 3 | 4;
|
|
48
49
|
bordered?: boolean;
|
|
50
|
+
/** Densidade. `compact`: fonte de 12px e espaço menor entre os pares. @default 'default' */
|
|
51
|
+
density?: "default" | "compact";
|
|
49
52
|
fit?: boolean;
|
|
50
53
|
emptyValue?: string;
|
|
51
54
|
ariaLabel?: string;
|
|
@@ -4,7 +4,8 @@ import './EmptyState.css';
|
|
|
4
4
|
* @property {IconProp} icon - Ícone FontAwesome: objeto importado (recomendado —
|
|
5
5
|
* ex.: faInbox de free-solid-svg-icons), nome ('inbox') ou par ['far','inbox'].
|
|
6
6
|
* Nomes/pares exigem registro prévio na library. Decorativo (aria-hidden).
|
|
7
|
-
* @property {string} title - Título principal do estado vazio (
|
|
7
|
+
* @property {string} title - Título principal do estado vazio: texto, ou conteúdo rico (um nó no React; no Vue, o slot `title`, com a prop como texto de reserva). O título é um `div`, então aceita negrito, ícone, link.
|
|
8
|
+
* @slot title - Só no Vue. Título com conteúdo rico (no lugar do texto da prop `title`).
|
|
8
9
|
* @property {string} description - Texto de apoio exibido abaixo do título
|
|
9
10
|
* @property {string} actionLabel - Rótulo do botão de ação (exibido junto com onAction)
|
|
10
11
|
* @property {function} onAction - Callback acionado ao clicar no botão de ação
|
|
@@ -15,7 +16,8 @@ import './EmptyState.css';
|
|
|
15
16
|
*/
|
|
16
17
|
export interface EmptyStateProps {
|
|
17
18
|
icon?: IconProp;
|
|
18
|
-
|
|
19
|
+
/** Título: texto ou conteúdo rico. No Vue, texto, ou o slot `title`. */
|
|
20
|
+
title?: any;
|
|
19
21
|
description?: string;
|
|
20
22
|
actionLabel?: string;
|
|
21
23
|
onAction?: () => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import './EmptyState.css';
|
|
4
4
|
import Icon from "../Icon/Icon";
|
|
5
5
|
function EmptyState(props) {
|
|
@@ -23,6 +23,6 @@ function EmptyState(props) {
|
|
|
23
23
|
return "40px";
|
|
24
24
|
return "32px";
|
|
25
25
|
}
|
|
26
|
-
return (_jsxs("div", { className: classes(), children: [!!props.icon ? (_jsx("div", { "aria-hidden": "true", className: "umds-empty-state__icon-wrap", children: _jsx(Icon, { variant: "inherit", icon: props.icon, customSize: iconSize() }) })) : null, _jsx("
|
|
26
|
+
return (_jsxs("div", { className: classes(), children: [!!props.icon ? (_jsx("div", { "aria-hidden": "true", className: "umds-empty-state__icon-wrap", children: _jsx(Icon, { variant: "inherit", icon: props.icon, customSize: iconSize() }) })) : null, _jsx("div", { className: "umds-empty-state__title", children: _jsx(_Fragment, { children: props.title }) }), !!props.description ? (_jsx("p", { className: "umds-empty-state__desc", children: props.description })) : null, hasAction() ? (_jsx("button", { type: "button", className: "umds-empty-state__action", onClick: (event) => props.onAction && props.onAction(), children: props.actionLabel })) : null] }));
|
|
27
27
|
}
|
|
28
28
|
export default EmptyState;
|
|
@@ -273,6 +273,27 @@
|
|
|
273
273
|
outline-offset: -2px;
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
+
/* ── grouped: o campo dentro de um contêiner que já tem moldura e foco ──
|
|
277
|
+
O campo de chips: as tags e o input moram na mesma caixa, e quem desenha a moldura
|
|
278
|
+
e o foco (`:focus-within`) é o contêiner. Aqui o campo não impõe altura de campo
|
|
279
|
+
(a linha cresce com as tags), nem padding, nem anel próprio. */
|
|
280
|
+
.umds-input--grouped:not(.umds-input--full-width) {
|
|
281
|
+
width: auto;
|
|
282
|
+
flex: 1 1 var(--umds-primitive-spacing-xxl); /* 80px: o input nunca encolhe a ponto de sumir */
|
|
283
|
+
min-width: 0;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.umds-input--grouped .umds-input__container {
|
|
287
|
+
height: auto;
|
|
288
|
+
min-height: 0;
|
|
289
|
+
padding: 0;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.umds-input--grouped .umds-input__container:focus-within:not(.umds-input__container--disabled):not(.umds-input__container--readonly) {
|
|
293
|
+
outline: none;
|
|
294
|
+
box-shadow: none;
|
|
295
|
+
}
|
|
296
|
+
|
|
276
297
|
/* ── Mobile: fonte ≥16px no controle (decisão 25/07) ──
|
|
277
298
|
Fonte <16px num campo focado dispara zoom automático no Safari iOS.
|
|
278
299
|
Só abaixo do breakpoint-sm (640px) — desktop permanece idêntico. */
|
|
@@ -35,6 +35,7 @@ export interface InputAction {
|
|
|
35
35
|
* @property {IconProp} iconLeft - Ícone Font Awesome à esquerda
|
|
36
36
|
* @property {InputAction[]} iconsRight - Botões de ação com ícone à direita
|
|
37
37
|
* @property {IconProp} iconRight - Ícone decorativo à direita (não é botão, some para o leitor de tela). Para ação clicável, use `iconsRight`.
|
|
38
|
+
* @property {boolean} grouped - O campo vive dentro de um contêiner que já desenha a moldura E o foco (o campo de chips: as tags e o input na mesma caixa). Implica `borderless`, e tira a altura de campo, o padding e o anel de foco próprio: o contêiner mostra o foco com `:focus-within`. Sem esse foco no contêiner, quem usa teclado perde o indicador (WCAG 2.4.7).
|
|
38
39
|
* @property {boolean} borderless - Sem borda, fundo e raio: o campo dentro de um grupo que já tem a moldura (um Select e um Input lado a lado numa mesma caixa). O foco continua visível, em contorno, e o erro mantém a borda vermelha.
|
|
39
40
|
* @property {string} mask - Máscara simples: 'cpf' | 'cnpj' | 'cep' | 'phone'. O valor exibido e o que chega em `onChange` já vêm formatados (para só os dígitos, `valor.replace(/\D/g, "")`). Aceita só dígitos, limita o tamanho e abre o teclado numérico no celular.
|
|
40
41
|
* @property {function} onChange - Callback acionado A CADA TECLA (recebe o novo valor string), nos dois frameworks. O blur sai em `onBlur`.
|
|
@@ -94,6 +95,12 @@ export interface InputProps {
|
|
|
94
95
|
iconRight?: IconProp;
|
|
95
96
|
/** Sem borda, fundo e raio, para o campo dentro de um grupo que já tem a moldura. O foco e o erro continuam visíveis. @default false */
|
|
96
97
|
borderless?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* O campo dentro de um contêiner que já tem a moldura e o foco (o campo de chips).
|
|
100
|
+
* Implica `borderless` e tira a altura de campo, o padding e o anel de foco
|
|
101
|
+
* próprio: o foco vem do contêiner (`:focus-within`). @default false
|
|
102
|
+
*/
|
|
103
|
+
grouped?: boolean;
|
|
97
104
|
/** Máscara simples. O valor exibido e o de `onChange` já saem formatados. */
|
|
98
105
|
mask?: "cpf" | "cnpj" | "cep" | "phone";
|
|
99
106
|
onChange?: (value: string) => void;
|
|
@@ -50,7 +50,8 @@ function Input(props) {
|
|
|
50
50
|
props.disabled ? "umds-input--disabled" : "",
|
|
51
51
|
props.readOnly ? "umds-input--readonly" : "",
|
|
52
52
|
props.numberSpinner ? "umds-input--number-spinner" : "",
|
|
53
|
-
props.borderless ? "umds-input--borderless" : "",
|
|
53
|
+
props.borderless || props.grouped ? "umds-input--borderless" : "",
|
|
54
|
+
props.grouped ? "umds-input--grouped" : "",
|
|
54
55
|
`umds-input--${props.size || "md"}`,
|
|
55
56
|
props.className,
|
|
56
57
|
]
|
|
@@ -22,14 +22,22 @@ export type ListItemTag = "button" | "a" | "div";
|
|
|
22
22
|
* tira a linha da ordem de tabulação e bloqueia o clique.
|
|
23
23
|
*
|
|
24
24
|
* Atributos HTML (`id`, `style`, `role`, `tabIndex`, `data-*`, `aria-*`) vão
|
|
25
|
-
* para o elemento interativo
|
|
26
|
-
* tem texto visível. `title` NÃO é o atributo
|
|
25
|
+
* SÓ para o elemento interativo (nunca para o `li`), que é quem recebe
|
|
26
|
+
* `aria-label` quando a linha não tem texto visível. `title` NÃO é o atributo
|
|
27
|
+
* HTML: é o título da linha. O atributo `title` (a dica nativa do navegador) é a
|
|
28
|
+
* prop `tooltip`.
|
|
29
|
+
*
|
|
30
|
+
* `standalone` tira o `li`: o ListItem vira só o elemento interativo, para uso
|
|
31
|
+
* fora de um `List` (botão de número de página, item de carrossel, linha dentro
|
|
32
|
+
* de um `div`). Fora de `ul`/`ol`, o `li` é HTML inválido.
|
|
27
33
|
* @property {string} as - Elemento da linha: 'button' | 'a' | 'div'. Padrão: 'a' com href, senão 'button'
|
|
28
34
|
* @property {string} href - Destino do link (vira as="a")
|
|
29
35
|
* @property {string} target - Destino do link: '_blank' ganha rel="noopener noreferrer"
|
|
30
36
|
* @property {string} rel - Relação do link (sobrescreve o padrão do target)
|
|
31
37
|
* @property {boolean} selected - Item atual: fundo de seleção e aria-current
|
|
32
38
|
* @property {boolean} disabled - Bloqueia clique e foco
|
|
39
|
+
* @property {string} tooltip - Dica nativa do navegador: vira o atributo HTML `title` do elemento interativo
|
|
40
|
+
* @property {boolean} standalone - Renderiza sem o `li`, só o elemento interativo (uso fora de `List`)
|
|
33
41
|
* @property {any} title - Título da linha: texto, ou slot `title` (nó)
|
|
34
42
|
* @property {any} subtitle - Segunda linha: texto, ou slot `subtitle` (nó)
|
|
35
43
|
* @property {any} meta - Terceira linha, menor (data, contexto): texto, ou slot `meta` (nó)
|
|
@@ -59,6 +67,10 @@ export interface ListItemProps {
|
|
|
59
67
|
selected?: boolean;
|
|
60
68
|
/** Bloqueia clique e foco. @default false */
|
|
61
69
|
disabled?: boolean;
|
|
70
|
+
/** Dica nativa do navegador: vira o atributo HTML `title` do elemento interativo. */
|
|
71
|
+
tooltip?: string;
|
|
72
|
+
/** Sem o `li`: só o elemento interativo, para usar fora de um `List`. @default false */
|
|
73
|
+
standalone?: boolean;
|
|
62
74
|
/** Título da linha. Texto, ou slot `title` para um nó. */
|
|
63
75
|
title?: any;
|
|
64
76
|
/** Segunda linha. Texto, ou slot `subtitle` para um nó. */
|
|
@@ -70,12 +70,13 @@ function ListItem(props) {
|
|
|
70
70
|
chave.indexOf("aria-") === 0 ||
|
|
71
71
|
chave === "style" ||
|
|
72
72
|
chave === "role" ||
|
|
73
|
-
chave === "tabIndex"
|
|
73
|
+
chave === "tabIndex" ||
|
|
74
|
+
(chave === "class" && props.standalone)) {
|
|
74
75
|
out[chave] = props[chave];
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
return out;
|
|
78
79
|
}
|
|
79
|
-
return (_jsxs("li", { className: "umds-list__item", children: [elementTag() === "button" ? (_jsxs("button", { type: "button", id: props.id, disabled: props.disabled, "aria-current": ariaCurrent(), onClick: (event) => handleClick(event), ...htmlAttrs(), className: classes(), children: [props.start ? (_jsx("span", { className: "umds-list-item__start", children: _jsx(_Fragment, { children: props.start }) })) : null, _jsxs("span", { className: "umds-list-item__body", children: [props.title ? (_jsx("span", { className: "umds-list-item__title", children: _jsx(Text, { variant: "body2", as: "span", weight: "semibold", color: "inherit", children: _jsx(_Fragment, { children: props.title }) }) })) : null, props.subtitle ? (_jsx("span", { className: "umds-list-item__subtitle", children: _jsx(Text, { variant: "body2", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.subtitle }) }) })) : null, props.meta ? (_jsx("span", { className: "umds-list-item__meta", children: _jsx(Text, { variant: "caption", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.meta }) }) })) : null, _jsx(_Fragment, { children: props.children })] }), props.end ? (_jsx("span", { className: "umds-list-item__end", children: _jsx(_Fragment, { children: props.end }) })) : null] })) : null, elementTag() === "a" ? (_jsxs("a", { id: props.id, href: hrefValue(), target: props.target, rel: relValue(), "aria-current": ariaCurrent(), "aria-disabled": ariaDisabled(), onClick: (event) => handleClick(event), ...htmlAttrs(), className: classes(), children: [props.start ? (_jsx("span", { className: "umds-list-item__start", children: _jsx(_Fragment, { children: props.start }) })) : null, _jsxs("span", { className: "umds-list-item__body", children: [props.title ? (_jsx("span", { className: "umds-list-item__title", children: _jsx(Text, { variant: "body2", as: "span", weight: "semibold", color: "inherit", children: _jsx(_Fragment, { children: props.title }) }) })) : null, props.subtitle ? (_jsx("span", { className: "umds-list-item__subtitle", children: _jsx(Text, { variant: "body2", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.subtitle }) }) })) : null, props.meta ? (_jsx("span", { className: "umds-list-item__meta", children: _jsx(Text, { variant: "caption", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.meta }) }) })) : null, _jsx(_Fragment, { children: props.children })] }), props.end ? (_jsx("span", { className: "umds-list-item__end", children: _jsx(_Fragment, { children: props.end }) })) : null] })) : null, elementTag() === "div" ? (_jsxs("div", { id: props.id, role: divRole(), tabIndex: divTabIndex(), "aria-current": ariaCurrent(), "aria-disabled": ariaDisabled(), onClick: (event) => handleClick(event), onKeyDown: (event) => handleKeyDown(event), ...htmlAttrs(), className: classes(), children: [props.start ? (_jsx("span", { className: "umds-list-item__start", children: _jsx(_Fragment, { children: props.start }) })) : null, _jsxs("span", { className: "umds-list-item__body", children: [props.title ? (_jsx("span", { className: "umds-list-item__title", children: _jsx(Text, { variant: "body2", as: "span", weight: "semibold", color: "inherit", children: _jsx(_Fragment, { children: props.title }) }) })) : null, props.subtitle ? (_jsx("span", { className: "umds-list-item__subtitle", children: _jsx(Text, { variant: "body2", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.subtitle }) }) })) : null, props.meta ? (_jsx("span", { className: "umds-list-item__meta", children: _jsx(Text, { variant: "caption", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.meta }) }) })) : null, _jsx(_Fragment, { children: props.children })] }), props.end ? (_jsx("span", { className: "umds-list-item__end", children: _jsx(_Fragment, { children: props.end }) })) : null] })) : null] }));
|
|
80
|
+
return (_jsxs(_Fragment, { children: [!props.standalone ? (_jsxs("li", { className: "umds-list__item", children: [elementTag() === "button" ? (_jsxs("button", { type: "button", id: props.id, title: props.tooltip, disabled: props.disabled, "aria-current": ariaCurrent(), onClick: (event) => handleClick(event), ...htmlAttrs(), className: classes(), children: [props.start ? (_jsx("span", { className: "umds-list-item__start", children: _jsx(_Fragment, { children: props.start }) })) : null, _jsxs("span", { className: "umds-list-item__body", children: [props.title ? (_jsx("span", { className: "umds-list-item__title", children: _jsx(Text, { variant: "body2", as: "span", weight: "semibold", color: "inherit", children: _jsx(_Fragment, { children: props.title }) }) })) : null, props.subtitle ? (_jsx("span", { className: "umds-list-item__subtitle", children: _jsx(Text, { variant: "body2", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.subtitle }) }) })) : null, props.meta ? (_jsx("span", { className: "umds-list-item__meta", children: _jsx(Text, { variant: "caption", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.meta }) }) })) : null, _jsx(_Fragment, { children: props.children })] }), props.end ? (_jsx("span", { className: "umds-list-item__end", children: _jsx(_Fragment, { children: props.end }) })) : null] })) : null, elementTag() === "a" ? (_jsxs("a", { id: props.id, title: props.tooltip, href: hrefValue(), target: props.target, rel: relValue(), "aria-current": ariaCurrent(), "aria-disabled": ariaDisabled(), onClick: (event) => handleClick(event), ...htmlAttrs(), className: classes(), children: [props.start ? (_jsx("span", { className: "umds-list-item__start", children: _jsx(_Fragment, { children: props.start }) })) : null, _jsxs("span", { className: "umds-list-item__body", children: [props.title ? (_jsx("span", { className: "umds-list-item__title", children: _jsx(Text, { variant: "body2", as: "span", weight: "semibold", color: "inherit", children: _jsx(_Fragment, { children: props.title }) }) })) : null, props.subtitle ? (_jsx("span", { className: "umds-list-item__subtitle", children: _jsx(Text, { variant: "body2", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.subtitle }) }) })) : null, props.meta ? (_jsx("span", { className: "umds-list-item__meta", children: _jsx(Text, { variant: "caption", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.meta }) }) })) : null, _jsx(_Fragment, { children: props.children })] }), props.end ? (_jsx("span", { className: "umds-list-item__end", children: _jsx(_Fragment, { children: props.end }) })) : null] })) : null, elementTag() === "div" ? (_jsxs("div", { id: props.id, title: props.tooltip, role: divRole(), tabIndex: divTabIndex(), "aria-current": ariaCurrent(), "aria-disabled": ariaDisabled(), onClick: (event) => handleClick(event), onKeyDown: (event) => handleKeyDown(event), ...htmlAttrs(), className: classes(), children: [props.start ? (_jsx("span", { className: "umds-list-item__start", children: _jsx(_Fragment, { children: props.start }) })) : null, _jsxs("span", { className: "umds-list-item__body", children: [props.title ? (_jsx("span", { className: "umds-list-item__title", children: _jsx(Text, { variant: "body2", as: "span", weight: "semibold", color: "inherit", children: _jsx(_Fragment, { children: props.title }) }) })) : null, props.subtitle ? (_jsx("span", { className: "umds-list-item__subtitle", children: _jsx(Text, { variant: "body2", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.subtitle }) }) })) : null, props.meta ? (_jsx("span", { className: "umds-list-item__meta", children: _jsx(Text, { variant: "caption", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.meta }) }) })) : null, _jsx(_Fragment, { children: props.children })] }), props.end ? (_jsx("span", { className: "umds-list-item__end", children: _jsx(_Fragment, { children: props.end }) })) : null] })) : null] })) : null, !!props.standalone ? (_jsxs(_Fragment, { children: [elementTag() === "button" ? (_jsxs("button", { type: "button", id: props.id, title: props.tooltip, disabled: props.disabled, "aria-current": ariaCurrent(), onClick: (event) => handleClick(event), ...htmlAttrs(), className: classes(), children: [props.start ? (_jsx("span", { className: "umds-list-item__start", children: _jsx(_Fragment, { children: props.start }) })) : null, _jsxs("span", { className: "umds-list-item__body", children: [props.title ? (_jsx("span", { className: "umds-list-item__title", children: _jsx(Text, { variant: "body2", as: "span", weight: "semibold", color: "inherit", children: _jsx(_Fragment, { children: props.title }) }) })) : null, props.subtitle ? (_jsx("span", { className: "umds-list-item__subtitle", children: _jsx(Text, { variant: "body2", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.subtitle }) }) })) : null, props.meta ? (_jsx("span", { className: "umds-list-item__meta", children: _jsx(Text, { variant: "caption", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.meta }) }) })) : null, _jsx(_Fragment, { children: props.children })] }), props.end ? (_jsx("span", { className: "umds-list-item__end", children: _jsx(_Fragment, { children: props.end }) })) : null] })) : null, elementTag() === "a" ? (_jsxs("a", { id: props.id, title: props.tooltip, href: hrefValue(), target: props.target, rel: relValue(), "aria-current": ariaCurrent(), "aria-disabled": ariaDisabled(), onClick: (event) => handleClick(event), ...htmlAttrs(), className: classes(), children: [props.start ? (_jsx("span", { className: "umds-list-item__start", children: _jsx(_Fragment, { children: props.start }) })) : null, _jsxs("span", { className: "umds-list-item__body", children: [props.title ? (_jsx("span", { className: "umds-list-item__title", children: _jsx(Text, { variant: "body2", as: "span", weight: "semibold", color: "inherit", children: _jsx(_Fragment, { children: props.title }) }) })) : null, props.subtitle ? (_jsx("span", { className: "umds-list-item__subtitle", children: _jsx(Text, { variant: "body2", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.subtitle }) }) })) : null, props.meta ? (_jsx("span", { className: "umds-list-item__meta", children: _jsx(Text, { variant: "caption", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.meta }) }) })) : null, _jsx(_Fragment, { children: props.children })] }), props.end ? (_jsx("span", { className: "umds-list-item__end", children: _jsx(_Fragment, { children: props.end }) })) : null] })) : null, elementTag() === "div" ? (_jsxs("div", { id: props.id, title: props.tooltip, role: divRole(), tabIndex: divTabIndex(), "aria-current": ariaCurrent(), "aria-disabled": ariaDisabled(), onClick: (event) => handleClick(event), onKeyDown: (event) => handleKeyDown(event), ...htmlAttrs(), className: classes(), children: [props.start ? (_jsx("span", { className: "umds-list-item__start", children: _jsx(_Fragment, { children: props.start }) })) : null, _jsxs("span", { className: "umds-list-item__body", children: [props.title ? (_jsx("span", { className: "umds-list-item__title", children: _jsx(Text, { variant: "body2", as: "span", weight: "semibold", color: "inherit", children: _jsx(_Fragment, { children: props.title }) }) })) : null, props.subtitle ? (_jsx("span", { className: "umds-list-item__subtitle", children: _jsx(Text, { variant: "body2", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.subtitle }) }) })) : null, props.meta ? (_jsx("span", { className: "umds-list-item__meta", children: _jsx(Text, { variant: "caption", as: "span", color: "inherit", children: _jsx(_Fragment, { children: props.meta }) }) })) : null, _jsx(_Fragment, { children: props.children })] }), props.end ? (_jsx("span", { className: "umds-list-item__end", children: _jsx(_Fragment, { children: props.end }) })) : null] })) : null] })) : null] }));
|
|
80
81
|
}
|
|
81
82
|
export default ListItem;
|