@1doc/1ds-react 2.7.2 → 2.9.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 +1280 -0
- package/dist/components/AIContent/AIContent.d.ts +10 -0
- package/dist/components/AIContent/AIContent.js +1 -1
- package/dist/components/AILabel/AILabel.d.ts +4 -0
- package/dist/components/AILabel/AILabel.js +2 -2
- package/dist/components/Accordion/Accordion.d.ts +6 -2
- package/dist/components/Alert/Alert.css +2 -0
- package/dist/components/Alert/Alert.d.ts +3 -1
- package/dist/components/Alert/Alert.js +7 -1
- package/dist/components/AppHeader/AppHeader.css +82 -8
- package/dist/components/AppHeader/AppHeader.d.ts +12 -1
- package/dist/components/AppHeader/AppHeader.js +186 -1
- package/dist/components/AppNavItem/AppNavItem.css +11 -3
- package/dist/components/AppShell/AppShell.css +9 -0
- package/dist/components/AppShell/AppShell.d.ts +8 -0
- package/dist/components/AppShell/AppShell.js +4 -1
- package/dist/components/AppSidebar/AppSidebar.css +1 -1
- package/dist/components/AppSidebar/AppSidebar.d.ts +4 -0
- package/dist/components/AppSidebar/AppSidebar.js +3 -1
- package/dist/components/AttachmentCard/AttachmentCard.css +17 -1
- package/dist/components/AttachmentCard/AttachmentCard.d.ts +29 -2
- package/dist/components/AttachmentCard/AttachmentCard.js +88 -20
- package/dist/components/Avatar/Avatar.css +7 -2
- package/dist/components/Avatar/AvatarGroup.d.ts +27 -0
- package/dist/components/Avatar/AvatarGroup.js +28 -4
- package/dist/components/Badge/Badge.css +61 -3
- package/dist/components/Badge/Badge.d.ts +14 -4
- package/dist/components/Badge/Badge.js +1 -0
- package/dist/components/BottomSheet/BottomSheet.css +1 -0
- package/dist/components/BottomSheet/BottomSheet.d.ts +8 -0
- package/dist/components/BottomSheet/BottomSheet.js +14 -2
- package/dist/components/Box/Box.css +83 -0
- package/dist/components/Box/Box.d.ts +82 -2
- package/dist/components/Box/Box.js +42 -2
- package/dist/components/Button/Button.css +29 -0
- package/dist/components/Button/Button.d.ts +4 -4
- package/dist/components/Button/Button.js +4 -1
- package/dist/components/Calendar/Calendar.css +245 -0
- package/dist/components/Calendar/Calendar.d.ts +125 -0
- package/dist/components/Calendar/Calendar.js +320 -0
- package/dist/components/Chart/BarChart.d.ts +6 -0
- package/dist/components/Chart/BarChart.js +3 -1
- package/dist/components/Chart/LineChart.d.ts +6 -0
- package/dist/components/Chart/LineChart.js +3 -1
- package/dist/components/Checkbox/Checkbox.css +4 -1
- package/dist/components/Chips/Chips.css +39 -0
- package/dist/components/Chips/Chips.d.ts +7 -2
- package/dist/components/Chips/Chips.js +6 -2
- package/dist/components/Coachmark/Coachmark.css +118 -0
- package/dist/components/Coachmark/Coachmark.d.ts +75 -0
- package/dist/components/Coachmark/Coachmark.js +321 -0
- package/dist/components/CodeBlock/CodeBlock.css +96 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +47 -0
- package/dist/components/CodeBlock/CodeBlock.js +103 -0
- package/dist/components/ColorPicker/ColorPicker.css +133 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +73 -0
- package/dist/components/ColorPicker/ColorPicker.js +219 -0
- package/dist/components/Combobox/Combobox.css +11 -3
- package/dist/components/ConfirmAIAction/ConfirmAIAction.d.ts +11 -1
- package/dist/components/ConfirmAIAction/ConfirmAIAction.js +6 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.css +3 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts +14 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.js +2 -2
- package/dist/components/DataTable/DataTable.css +80 -0
- package/dist/components/DataTable/DataTable.d.ts +23 -4
- package/dist/components/DataTable/DataTable.js +61 -15
- package/dist/components/DatePicker/DatePicker.css +8 -0
- package/dist/components/DatePicker/DatePicker.d.ts +4 -0
- package/dist/components/DatePicker/DatePicker.js +14 -1
- package/dist/components/DescriptionList/DescriptionList.css +113 -0
- package/dist/components/DescriptionList/DescriptionList.d.ts +59 -0
- package/dist/components/DescriptionList/DescriptionList.js +51 -0
- package/dist/components/Drawer/Drawer.css +1 -0
- package/dist/components/Dropdown/Dropdown.js +47 -29
- package/dist/components/FileInput/FileInput.css +24 -4
- package/dist/components/FileInput/FileInput.d.ts +22 -2
- package/dist/components/FileInput/FileInput.js +23 -2
- package/dist/components/Grid/Grid.js +5 -5
- package/dist/components/IconPicker/IconPicker.css +107 -0
- package/dist/components/IconPicker/IconPicker.d.ts +74 -0
- package/dist/components/IconPicker/IconPicker.js +194 -0
- package/dist/components/Input/Input.css +41 -3
- package/dist/components/Input/Input.d.ts +14 -1
- package/dist/components/Input/Input.js +72 -6
- package/dist/components/Kanban/Kanban.css +5 -0
- package/dist/components/Kanban/Kanban.d.ts +41 -0
- package/dist/components/Kanban/Kanban.js +59 -27
- package/dist/components/Kanban/KanbanCard.d.ts +2 -0
- package/dist/components/Kanban/KanbanCard.js +1 -1
- package/dist/components/Kanban/KanbanColumn.d.ts +2 -0
- package/dist/components/Kanban/KanbanColumn.js +3 -0
- package/dist/components/Kbd/Kbd.css +66 -0
- package/dist/components/Kbd/Kbd.d.ts +32 -0
- package/dist/components/Kbd/Kbd.js +40 -0
- package/dist/components/Link/Link.css +1 -1
- package/dist/components/List/List.css +136 -0
- package/dist/components/List/List.d.ts +82 -0
- package/dist/components/List/List.js +53 -0
- package/dist/components/List/ListItem.d.ts +85 -0
- package/dist/components/List/ListItem.js +81 -0
- package/dist/components/Modal/Modal.css +93 -8
- package/dist/components/Modal/Modal.d.ts +45 -7
- package/dist/components/Modal/Modal.js +106 -6
- package/dist/components/MultiSelect/MultiSelect.css +9 -1
- package/dist/components/MultiSelect/MultiSelect.js +45 -8
- package/dist/components/OrgChart/OrgChart.css +149 -0
- package/dist/components/OrgChart/OrgChart.d.ts +83 -0
- package/dist/components/OrgChart/OrgChart.js +297 -0
- package/dist/components/OtpInput/OtpInput.css +93 -0
- package/dist/components/OtpInput/OtpInput.d.ts +60 -0
- package/dist/components/OtpInput/OtpInput.js +215 -0
- package/dist/components/Pagination/Pagination.d.ts +6 -0
- package/dist/components/Pagination/Pagination.js +9 -1
- package/dist/components/PhoneInput/PhoneInput.css +9 -1
- package/dist/components/PhoneInput/PhoneInput.d.ts +10 -0
- package/dist/components/PhoneInput/PhoneInput.js +20 -3
- package/dist/components/Popover/Popover.d.ts +7 -0
- package/dist/components/Popover/Popover.js +11 -1
- package/dist/components/RichTextEditor/RichTextEditor.css +203 -0
- package/dist/components/RichTextEditor/RichTextEditor.d.ts +83 -0
- package/dist/components/RichTextEditor/RichTextEditor.js +494 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +2 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +21 -8
- package/dist/components/Select/Select.css +71 -1
- package/dist/components/Select/Select.d.ts +12 -0
- package/dist/components/Select/Select.js +93 -10
- package/dist/components/SidePanel/SidePanel.css +4 -4
- package/dist/components/SidePanelItem/SidePanelItem.css +7 -5
- package/dist/components/SidePanelSearch/SidePanelSearch.css +2 -2
- package/dist/components/SidePanelSection/SidePanelSection.css +7 -5
- package/dist/components/Stack/Stack.css +49 -0
- package/dist/components/Stack/Stack.d.ts +65 -7
- package/dist/components/Stack/Stack.js +30 -2
- package/dist/components/StatCard/StatCard.css +73 -0
- package/dist/components/StatCard/StatCard.d.ts +17 -0
- package/dist/components/StatCard/StatCard.js +4 -1
- package/dist/components/Stepper/Stepper.css +4 -1
- package/dist/components/Stepper/Stepper.d.ts +8 -0
- package/dist/components/Stepper/Stepper.js +4 -4
- package/dist/components/Switch/Switch.css +1 -0
- package/dist/components/Tabs/Tab.d.ts +15 -0
- package/dist/components/Tabs/Tab.js +30 -1
- package/dist/components/Tabs/Tabs.css +132 -0
- package/dist/components/Tabs/Tabs.d.ts +7 -0
- package/dist/components/Tabs/Tabs.js +13 -2
- package/dist/components/Tag/Tag.css +85 -2
- package/dist/components/Tag/Tag.d.ts +13 -6
- package/dist/components/Tag/Tag.js +1 -0
- package/dist/components/Text/Text.d.ts +9 -1
- package/dist/components/Text/Text.js +2 -2
- package/dist/components/Textarea/Textarea.css +11 -3
- package/dist/components/TimePicker/TimePicker.css +8 -0
- package/dist/components/TimePicker/TimePicker.d.ts +6 -0
- package/dist/components/TimePicker/TimePicker.js +1 -1
- package/dist/components/Tooltip/Tooltip.css +40 -0
- package/dist/components/Tooltip/Tooltip.d.ts +11 -0
- package/dist/components/Tooltip/Tooltip.js +114 -11
- package/dist/index.d.ts +25 -0
- package/dist/index.js +14 -0
- package/dist/teste/AILabel.test.d.ts +1 -0
- package/dist/teste/AILabel.test.js +33 -0
- package/dist/teste/AccordionConteudoLivre.test.d.ts +1 -0
- package/dist/teste/AccordionConteudoLivre.test.js +29 -0
- package/dist/teste/Alert.test.d.ts +1 -0
- package/dist/teste/Alert.test.js +27 -0
- package/dist/teste/AtributosRepassados.test.d.ts +1 -0
- package/dist/teste/AtributosRepassados.test.js +52 -0
- package/dist/teste/AttachmentCardIA.test.d.ts +1 -0
- package/dist/teste/AttachmentCardIA.test.js +89 -0
- package/dist/teste/AvatarGroupOverlap.test.d.ts +1 -0
- package/dist/teste/AvatarGroupOverlap.test.js +56 -0
- package/dist/teste/BadgeTag.test.d.ts +1 -0
- package/dist/teste/BadgeTag.test.js +42 -0
- package/dist/teste/BottomSheet.test.d.ts +1 -0
- package/dist/teste/BottomSheet.test.js +23 -0
- package/dist/teste/BoxItemFlex.test.d.ts +1 -0
- package/dist/teste/BoxItemFlex.test.js +54 -0
- package/dist/teste/BoxLayout.test.d.ts +1 -0
- package/dist/teste/BoxLayout.test.js +35 -0
- package/dist/teste/Button.test.d.ts +1 -0
- package/dist/teste/Button.test.js +27 -0
- package/dist/teste/Calendar.test.d.ts +1 -0
- package/dist/teste/Calendar.test.js +221 -0
- package/dist/teste/ChipsXs.test.d.ts +1 -0
- package/dist/teste/ChipsXs.test.js +31 -0
- package/dist/teste/Coachmark.test.d.ts +1 -0
- package/dist/teste/Coachmark.test.js +149 -0
- package/dist/teste/ColorPicker.test.d.ts +1 -0
- package/dist/teste/ColorPicker.test.js +132 -0
- package/dist/teste/ConfirmAIAction.test.d.ts +1 -0
- package/dist/teste/ConfirmAIAction.test.js +33 -0
- package/dist/teste/DataTableCelulaLivre.test.d.ts +1 -0
- package/dist/teste/DataTableCelulaLivre.test.js +76 -0
- package/dist/teste/DataTableDocumento.test.d.ts +1 -0
- package/dist/teste/DataTableDocumento.test.js +92 -0
- package/dist/teste/DatePicker.test.js +23 -0
- package/dist/teste/Dropdown.test.js +111 -0
- package/dist/teste/FileInputTrigger.test.d.ts +1 -0
- package/dist/teste/FileInputTrigger.test.js +53 -0
- package/dist/teste/IconPicker.test.d.ts +1 -0
- package/dist/teste/IconPicker.test.js +130 -0
- package/dist/teste/InputMascaraEAfins.test.d.ts +1 -0
- package/dist/teste/InputMascaraEAfins.test.js +99 -0
- package/dist/teste/KbdCodeBlock.test.d.ts +1 -0
- package/dist/teste/KbdCodeBlock.test.js +95 -0
- package/dist/teste/List.test.d.ts +1 -0
- package/dist/teste/List.test.js +153 -0
- package/dist/teste/Modal.test.d.ts +1 -0
- package/dist/teste/Modal.test.js +26 -0
- package/dist/teste/ModalVariantes.test.d.ts +1 -0
- package/dist/teste/ModalVariantes.test.js +151 -0
- package/dist/teste/MultiSelectErro.test.d.ts +1 -0
- package/dist/teste/MultiSelectErro.test.js +62 -0
- package/dist/teste/NomeAcessivelSsr.test.d.ts +1 -0
- package/dist/teste/NomeAcessivelSsr.test.js +88 -0
- package/dist/teste/OrgChart.test.d.ts +1 -0
- package/dist/teste/OrgChart.test.js +162 -0
- package/dist/teste/OtpInput.test.d.ts +1 -0
- package/dist/teste/OtpInput.test.js +143 -0
- package/dist/teste/PopoverMaxHeight.test.d.ts +1 -0
- package/dist/teste/PopoverMaxHeight.test.js +38 -0
- package/dist/teste/RichTextEditor.test.d.ts +1 -0
- package/dist/teste/RichTextEditor.test.js +287 -0
- package/dist/teste/RotulosTraduziveis.test.d.ts +1 -0
- package/dist/teste/RotulosTraduziveis.test.js +405 -0
- package/dist/teste/SegmentedControl.test.js +33 -0
- package/dist/teste/Select.test.d.ts +1 -0
- package/dist/teste/Select.test.js +62 -0
- package/dist/teste/SelectPlacementFiltro.test.d.ts +1 -0
- package/dist/teste/SelectPlacementFiltro.test.js +88 -0
- package/dist/teste/Stack.test.d.ts +1 -0
- package/dist/teste/Stack.test.js +57 -0
- package/dist/teste/StatCardRotuloTopo.test.d.ts +1 -0
- package/dist/teste/StatCardRotuloTopo.test.js +34 -0
- package/dist/teste/TabsContadorFechavel.test.d.ts +1 -0
- package/dist/teste/TabsContadorFechavel.test.js +79 -0
- package/dist/teste/Tooltip.test.d.ts +1 -0
- package/dist/teste/Tooltip.test.js +109 -0
- package/dist/teste/TooltipDark.test.d.ts +1 -0
- package/dist/teste/TooltipDark.test.js +31 -0
- package/dist/utils/calendario.d.ts +28 -0
- package/dist/utils/calendario.js +73 -0
- package/dist/utils/chart.d.ts +4 -0
- package/dist/utils/chart.js +3 -2
- package/dist/utils/html-seguro.d.ts +27 -0
- package/dist/utils/html-seguro.js +97 -0
- package/dist/utils/id.d.ts +2 -0
- package/dist/utils/id.js +23 -0
- package/dist/utils/paleta-de-cores.d.ts +26 -0
- package/dist/utils/paleta-de-cores.js +10 -0
- package/dist/utils/texto.d.ts +5 -0
- package/dist/utils/texto.js +5 -0
- package/package.json +3 -3
- package/src/index.ts +26 -0
- package/src/teste/AILabel.test.tsx +41 -0
- package/src/teste/AccordionConteudoLivre.test.tsx +39 -0
- package/src/teste/Alert.test.tsx +32 -0
- package/src/teste/AtributosRepassados.test.tsx +73 -0
- package/src/teste/AttachmentCardIA.test.tsx +126 -0
- package/src/teste/AvatarGroupOverlap.test.tsx +74 -0
- package/src/teste/BadgeTag.test.tsx +64 -0
- package/src/teste/BottomSheet.test.tsx +25 -0
- package/src/teste/BoxItemFlex.test.tsx +81 -0
- package/src/teste/BoxLayout.test.tsx +50 -0
- package/src/teste/Button.test.tsx +39 -0
- package/src/teste/Calendar.test.tsx +282 -0
- package/src/teste/ChipsXs.test.tsx +41 -0
- package/src/teste/Coachmark.test.tsx +198 -0
- package/src/teste/ColorPicker.test.tsx +153 -0
- package/src/teste/ConfirmAIAction.test.tsx +41 -0
- package/src/teste/DataTableCelulaLivre.test.tsx +103 -0
- package/src/teste/DataTableDocumento.test.tsx +102 -0
- package/src/teste/DatePicker.test.tsx +38 -0
- package/src/teste/Dropdown.test.tsx +146 -0
- package/src/teste/FileInputTrigger.test.tsx +89 -0
- package/src/teste/IconPicker.test.tsx +145 -0
- package/src/teste/InputMascaraEAfins.test.tsx +124 -0
- package/src/teste/KbdCodeBlock.test.tsx +106 -0
- package/src/teste/List.test.tsx +269 -0
- package/src/teste/Modal.test.tsx +28 -0
- package/src/teste/ModalVariantes.test.tsx +173 -0
- package/src/teste/MultiSelectErro.test.tsx +97 -0
- package/src/teste/NomeAcessivelSsr.test.tsx +110 -0
- package/src/teste/OrgChart.test.tsx +183 -0
- package/src/teste/OtpInput.test.tsx +163 -0
- package/src/teste/PopoverMaxHeight.test.tsx +47 -0
- package/src/teste/RichTextEditor.test.tsx +329 -0
- package/src/teste/RotulosTraduziveis.test.tsx +545 -0
- package/src/teste/SegmentedControl.test.tsx +57 -0
- package/src/teste/Select.test.tsx +97 -0
- package/src/teste/SelectPlacementFiltro.test.tsx +110 -0
- package/src/teste/Stack.test.tsx +80 -0
- package/src/teste/StatCardRotuloTopo.test.tsx +44 -0
- package/src/teste/TabsContadorFechavel.test.tsx +144 -0
- package/src/teste/Tooltip.test.tsx +219 -0
- package/src/teste/TooltipDark.test.tsx +51 -0
- package/src/utils/calendario.ts +78 -0
- package/src/utils/chart.ts +7 -2
- package/src/utils/html-seguro.ts +94 -0
- package/src/utils/id.ts +24 -0
- package/src/utils/paleta-de-cores.ts +34 -0
- package/src/utils/texto.ts +5 -0
|
@@ -90,6 +90,9 @@ function Kanban(props) {
|
|
|
90
90
|
return undefined;
|
|
91
91
|
return props.addCardLabel || "Adicionar cartão";
|
|
92
92
|
}
|
|
93
|
+
function papelDoCartao() {
|
|
94
|
+
return props.cardRoleDescription || "cartão arrastável";
|
|
95
|
+
}
|
|
93
96
|
function nomeDoQuadro() {
|
|
94
97
|
return props.ariaLabel || "Quadro";
|
|
95
98
|
}
|
|
@@ -164,15 +167,23 @@ function Kanban(props) {
|
|
|
164
167
|
const coluna = colunaDaBase(colunaId);
|
|
165
168
|
return coluna ? coluna.title : "";
|
|
166
169
|
}
|
|
170
|
+
function anuncios() {
|
|
171
|
+
return props.announcements || {};
|
|
172
|
+
}
|
|
167
173
|
function avisoDeLimite(colunaId, total) {
|
|
168
174
|
const coluna = colunaDaBase(colunaId);
|
|
169
175
|
if (!coluna || typeof coluna.wipLimit !== "number")
|
|
170
176
|
return "";
|
|
171
177
|
if (coluna.wipLimit <= 0 || total < coluna.wipLimit)
|
|
172
178
|
return "";
|
|
179
|
+
const a = anuncios();
|
|
173
180
|
if (total === coluna.wipLimit) {
|
|
181
|
+
if (a.limitReached)
|
|
182
|
+
return " " + a.limitReached(coluna.wipLimit);
|
|
174
183
|
return " Limite de " + coluna.wipLimit + " cartões atingido.";
|
|
175
184
|
}
|
|
185
|
+
if (a.limitExceeded)
|
|
186
|
+
return " " + a.limitExceeded(coluna.wipLimit);
|
|
176
187
|
return " Limite de " + coluna.wipLimit + " cartões excedido.";
|
|
177
188
|
}
|
|
178
189
|
function tabIndexDe(cartaoId) {
|
|
@@ -207,11 +218,13 @@ function Kanban(props) {
|
|
|
207
218
|
partes.push(cartao.description);
|
|
208
219
|
if (cartao.meta)
|
|
209
220
|
partes.push(cartao.meta);
|
|
210
|
-
if (cartao.assignee)
|
|
211
|
-
partes.push("Responsável: " + cartao.assignee);
|
|
221
|
+
if (cartao.assignee) {
|
|
222
|
+
partes.push((props.assigneeLabel || "Responsável") + ": " + cartao.assignee);
|
|
223
|
+
}
|
|
212
224
|
const etiquetas = cartao.tags || [];
|
|
213
225
|
if (etiquetas.length > 0) {
|
|
214
|
-
partes.push("Etiquetas
|
|
226
|
+
partes.push((props.tagsLabel || "Etiquetas") +
|
|
227
|
+
": " +
|
|
215
228
|
etiquetas.map((etiqueta) => etiqueta.label).join(", "));
|
|
216
229
|
}
|
|
217
230
|
return partes.join(". ");
|
|
@@ -273,6 +286,10 @@ function Kanban(props) {
|
|
|
273
286
|
setAnuncio(par ? texto + "\u00A0" : texto);
|
|
274
287
|
}
|
|
275
288
|
function posicaoFalada(colunaId, indice, total) {
|
|
289
|
+
const a = anuncios();
|
|
290
|
+
if (a.position) {
|
|
291
|
+
return a.position(tituloDaColuna(colunaId), indice + 1, total);
|
|
292
|
+
}
|
|
276
293
|
return ("Coluna " +
|
|
277
294
|
tituloDaColuna(colunaId) +
|
|
278
295
|
", posição " +
|
|
@@ -292,11 +309,16 @@ function Kanban(props) {
|
|
|
292
309
|
setOrigemIndice(pos.indice);
|
|
293
310
|
setPreviewColunaId(pos.colunaId);
|
|
294
311
|
setPreviewIndice(pos.indice);
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
312
|
+
const a = anuncios();
|
|
313
|
+
const titulo = tituloDoCartao(cartaoId);
|
|
314
|
+
const posicao = posicaoFalada(pos.colunaId, pos.indice, total);
|
|
315
|
+
anunciar(a.grabbed
|
|
316
|
+
? a.grabbed(titulo, posicao)
|
|
317
|
+
: "Cartão " +
|
|
318
|
+
titulo +
|
|
319
|
+
" pego. " +
|
|
320
|
+
posicao +
|
|
321
|
+
" Use as setas para mover, Espaço ou Enter para soltar, Esc para cancelar.");
|
|
300
322
|
}
|
|
301
323
|
function moverPego(tecla) {
|
|
302
324
|
const base = props.columns || [];
|
|
@@ -331,13 +353,15 @@ function Kanban(props) {
|
|
|
331
353
|
const total = tamanhoSemPego(destinoId) + 1;
|
|
332
354
|
if (destinoColuna === colunaIndice && destinoIndice === previewIndice) {
|
|
333
355
|
// Bateu na borda: diz qual, para quem ouve saber que parou.
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
356
|
+
const a = anuncios();
|
|
357
|
+
let borda = a.columnEnd || "Fim da coluna.";
|
|
358
|
+
if (tecla === "ArrowUp" || tecla === "Home") {
|
|
359
|
+
borda = a.columnStart || "Início da coluna.";
|
|
360
|
+
}
|
|
337
361
|
if (tecla === "ArrowLeft")
|
|
338
|
-
borda = "Não há coluna à esquerda.";
|
|
362
|
+
borda = a.noColumnLeft || "Não há coluna à esquerda.";
|
|
339
363
|
if (tecla === "ArrowRight")
|
|
340
|
-
borda = "Não há coluna à direita.";
|
|
364
|
+
borda = a.noColumnRight || "Não há coluna à direita.";
|
|
341
365
|
anunciar(borda + " " + posicaoFalada(destinoId, destinoIndice, total));
|
|
342
366
|
return;
|
|
343
367
|
}
|
|
@@ -362,13 +386,17 @@ function Kanban(props) {
|
|
|
362
386
|
setFocoId(cartaoId);
|
|
363
387
|
if (movimento.fromColumnId === movimento.toColumnId &&
|
|
364
388
|
movimento.fromIndex === movimento.toIndex) {
|
|
365
|
-
|
|
389
|
+
const a = anuncios();
|
|
390
|
+
anunciar(a.droppedInPlace
|
|
391
|
+
? a.droppedInPlace(titulo)
|
|
392
|
+
: "Cartão " + titulo + " solto na posição original.");
|
|
366
393
|
}
|
|
367
394
|
else {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
395
|
+
const a = anuncios();
|
|
396
|
+
const posicao = posicaoFalada(movimento.toColumnId, movimento.toIndex, total);
|
|
397
|
+
anunciar(a.dropped
|
|
398
|
+
? a.dropped(titulo, posicao)
|
|
399
|
+
: "Cartão " + titulo + " solto. " + posicao);
|
|
372
400
|
if (props.onCardMove)
|
|
373
401
|
props.onCardMove(movimento);
|
|
374
402
|
}
|
|
@@ -381,10 +409,12 @@ function Kanban(props) {
|
|
|
381
409
|
const coluna = colunaDaBase(origemColunaId);
|
|
382
410
|
const total = coluna ? (coluna.cards || []).length : 0;
|
|
383
411
|
setPegoId("");
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
412
|
+
const a = anuncios();
|
|
413
|
+
const titulo = tituloDoCartao(cartaoId);
|
|
414
|
+
const posicao = posicaoFalada(origemColunaId, origemIndice, total);
|
|
415
|
+
anunciar(a.cancelled
|
|
416
|
+
? a.cancelled(titulo, posicao)
|
|
417
|
+
: "Movimento cancelado. Cartão " + titulo + " voltou. " + posicao);
|
|
388
418
|
if (devolverFoco)
|
|
389
419
|
focarCartao(cartaoId);
|
|
390
420
|
}
|
|
@@ -608,10 +638,12 @@ function Kanban(props) {
|
|
|
608
638
|
const tamanho = coluna ? (coluna.cards || []).length : 0;
|
|
609
639
|
const total = colunaId === origemId ? tamanho : tamanho + 1;
|
|
610
640
|
setFocoId(cartaoId);
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
641
|
+
const a = anuncios();
|
|
642
|
+
const titulo = tituloDoCartao(cartaoId);
|
|
643
|
+
const posicao = posicaoFalada(colunaId, destinoIndice, total);
|
|
644
|
+
anunciar(a.moved
|
|
645
|
+
? a.moved(titulo, posicao)
|
|
646
|
+
: "Cartão " + titulo + " movido. " + posicao);
|
|
615
647
|
if (props.onCardMove) {
|
|
616
648
|
props.onCardMove({
|
|
617
649
|
cardId: cartaoId,
|
|
@@ -640,6 +672,6 @@ function Kanban(props) {
|
|
|
640
672
|
}
|
|
641
673
|
aplicarFocoPendente();
|
|
642
674
|
});
|
|
643
|
-
return (_jsxs("div", { role: "region", ref: rootRef, id: props.id, style: estiloDoQuadro(), "aria-label": nomeDoQuadro(), className: classesDoQuadro(), children: [_jsx("p", { className: "umds-kanban__sr", id: idDasInstrucoes(), children: textoDasInstrucoes() }), colunasDoQuadro()?.map((coluna, colunaIndice) => (_jsx(KanbanColumn, { title: coluna.title, count: coluna.cards.length, wipLimit: coluna.wipLimit, emptyText: textoVazioDa(coluna), highlighted: colunaEhAlvo(coluna.id), addLabel: rotuloDeAdicionar(), headingLevel: props.columnHeadingLevel, onAdd: (event) => handleAdicionar(coluna.id), children: _jsxs("ul", { className: "umds-kanban__list", onDragOver: (event) => handleDragOver(event, coluna.id), onDragLeave: (event) => handleDragLeave(event, coluna.id), onDrop: (event) => handleDrop(event, coluna.id), children: [coluna.cards?.map((cartao, indice) => (_jsxs(React.Fragment, { children: [mostraIndicador(coluna.id, indice) ? (_jsx("li", { "aria-hidden": "true", className: "umds-kanban__indicator" })) : null, _jsxs("li", { className: classesDoItem(cartao.id), children: [_jsx("div", { role: "button",
|
|
675
|
+
return (_jsxs("div", { role: "region", ref: rootRef, id: props.id, style: estiloDoQuadro(), "aria-label": nomeDoQuadro(), className: classesDoQuadro(), children: [_jsx("p", { className: "umds-kanban__sr", id: idDasInstrucoes(), children: textoDasInstrucoes() }), colunasDoQuadro()?.map((coluna, colunaIndice) => (_jsx(KanbanColumn, { title: coluna.title, count: coluna.cards.length, wipLimit: coluna.wipLimit, emptyText: textoVazioDa(coluna), highlighted: colunaEhAlvo(coluna.id), addLabel: rotuloDeAdicionar(), headingLevel: props.columnHeadingLevel, countLabel: props.columnCountLabel, onAdd: (event) => handleAdicionar(coluna.id), children: _jsxs("ul", { className: "umds-kanban__list", onDragOver: (event) => handleDragOver(event, coluna.id), onDragLeave: (event) => handleDragLeave(event, coluna.id), onDrop: (event) => handleDrop(event, coluna.id), children: [coluna.cards?.map((cartao, indice) => (_jsxs(React.Fragment, { children: [mostraIndicador(coluna.id, indice) ? (_jsx("li", { "aria-hidden": "true", className: "umds-kanban__indicator" })) : null, _jsxs("li", { className: classesDoItem(cartao.id), children: [_jsx("div", { role: "button", draggable: "true", className: "umds-kanban__handle", "aria-roledescription": papelDoCartao(), "aria-label": cartao.title, "aria-describedby": descritoPor(cartao.id, colunaIndice, indice), "aria-pressed": pressionadoDe(cartao.id), tabIndex: tabIndexDe(cartao.id), "data-card-id": cartao.id, onKeyDown: (event) => handleTecla(event, cartao.id, coluna.id), onFocus: (event) => handleFoco(cartao.id), onBlur: (event) => handleSaida(event), onClick: (event) => handleClique(event, cartao.id, coluna.id), onDragStart: (event) => handleDragStart(event, cartao.id, coluna.id, indice), onDragEnd: (event) => handleDragEnd(), children: _jsx(KanbanCard, { title: cartao.title, description: cartao.description, tags: cartao.tags, meta: cartao.meta, assignee: cartao.assignee, assigneeSrc: cartao.assigneeSrc, assigneeLabel: props.assigneeLabel }) }), _jsx("span", { className: "umds-kanban__sr", id: idDaDescricao(colunaIndice, indice), children: descricaoDoCartao(cartao) })] })] }, cartao.id))), mostraIndicador(coluna.id, coluna.cards.length) ? (_jsx("li", { "aria-hidden": "true", className: "umds-kanban__indicator" })) : null] }) }, coluna.id))), _jsx("div", { "aria-live": "assertive", "aria-atomic": "true", className: "umds-kanban__sr", children: anuncio })] }));
|
|
644
676
|
}
|
|
645
677
|
export default Kanban;
|
|
@@ -44,6 +44,8 @@ export interface KanbanCardProps {
|
|
|
44
44
|
onClick?: (event?: any) => void;
|
|
45
45
|
className?: string;
|
|
46
46
|
id?: string;
|
|
47
|
+
/** Prefixo do nome acessível do avatar do responsável (o nome vem depois de ": "). Troque para traduzir. @default 'Responsável' */
|
|
48
|
+
assigneeLabel?: string;
|
|
47
49
|
}
|
|
48
50
|
declare function KanbanCard(props: KanbanCardProps): import("react/jsx-runtime").JSX.Element;
|
|
49
51
|
export default KanbanCard;
|
|
@@ -35,7 +35,7 @@ function KanbanCard(props) {
|
|
|
35
35
|
return (primeira + ultima).toUpperCase();
|
|
36
36
|
}
|
|
37
37
|
function rotuloDoResponsavel() {
|
|
38
|
-
return "Responsável: " + (props.assignee || "");
|
|
38
|
+
return ((props.assigneeLabel || "Responsável") + ": " + (props.assignee || ""));
|
|
39
39
|
}
|
|
40
40
|
function handleClique(event) {
|
|
41
41
|
if (props.onClick)
|
|
@@ -42,6 +42,8 @@ export interface KanbanColumnProps {
|
|
|
42
42
|
className?: string;
|
|
43
43
|
id?: string;
|
|
44
44
|
children?: any;
|
|
45
|
+
/** Contagem por extenso lida pelo leitor de tela no lugar do selo. Recebe a quantidade e o limite de WIP (quando há). Troque para traduzir. @default (count, limit) => '4 de 3 cartões, limite excedido' | '3 de 3 cartões, limite atingido' | '1 cartão' | 'N cartões' */
|
|
46
|
+
countLabel?: (count: number, limit?: number) => string;
|
|
45
47
|
}
|
|
46
48
|
declare function KanbanColumn(props: KanbanColumnProps): import("react/jsx-runtime").JSX.Element;
|
|
47
49
|
export default KanbanColumn;
|
|
@@ -44,6 +44,9 @@ function KanbanColumn(props) {
|
|
|
44
44
|
function contagemPorExtenso() {
|
|
45
45
|
const n = typeof props.count === "number" ? props.count : 0;
|
|
46
46
|
const limite = props.wipLimit;
|
|
47
|
+
if (props.countLabel) {
|
|
48
|
+
return props.countLabel(n, typeof limite === "number" && limite > 0 ? limite : undefined);
|
|
49
|
+
}
|
|
47
50
|
if (typeof limite === "number" && limite > 0) {
|
|
48
51
|
let frase = n + " de " + limite + " cartões";
|
|
49
52
|
if (n > limite)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* ─────────────────────────────────────────────
|
|
2
|
+
KBD
|
|
3
|
+
Uma tecla, ou uma combinação, em fonte monoespaçada.
|
|
4
|
+
|
|
5
|
+
A caixa é cinza com borda e uma sombra de base de 1px (a "espessura" da
|
|
6
|
+
tecla). Texto escuro sobre cinza claro: contraste de texto, não só de cor.
|
|
7
|
+
|
|
8
|
+
Cores: semânticos · Medidas: primitivos
|
|
9
|
+
───────────────────────────────────────────── */
|
|
10
|
+
|
|
11
|
+
.umds-kbd {
|
|
12
|
+
display: inline-block;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
min-width: var(--umds-primitive-spacing-xxs); /* 24px */
|
|
15
|
+
padding: var(--umds-primitive-spacing-micro) var(--umds-primitive-spacing-nano); /* 2px 8px */
|
|
16
|
+
font-family: var(--umds-semantic-font-family-mono);
|
|
17
|
+
font-weight: var(--umds-primitive-font-weight-semibold);
|
|
18
|
+
line-height: var(--umds-primitive-font-line-height-lg);
|
|
19
|
+
text-align: center;
|
|
20
|
+
white-space: nowrap;
|
|
21
|
+
color: var(--umds-semantic-color-neutral-dark-pure);
|
|
22
|
+
background: var(--umds-semantic-color-background-light);
|
|
23
|
+
border: var(--umds-primitive-border-width-hairline) solid var(--umds-semantic-color-neutral-light-down);
|
|
24
|
+
border-bottom-width: var(--umds-primitive-border-width-thin);
|
|
25
|
+
border-radius: var(--umds-primitive-border-radius-xs);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.umds-kbd.umds-kbd--md {
|
|
29
|
+
font-size: var(--umds-primitive-font-size-xxs); /* 14px */
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.umds-kbd.umds-kbd--sm {
|
|
33
|
+
min-width: 0;
|
|
34
|
+
padding: 0 var(--umds-primitive-spacing-quarck); /* 0 4px */
|
|
35
|
+
font-size: var(--umds-primitive-font-size-xxxs); /* 12px */
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* ── Combinação ── */
|
|
39
|
+
.umds-kbd-combo {
|
|
40
|
+
display: inline-flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: var(--umds-primitive-spacing-quarck); /* 4px */
|
|
43
|
+
font-family: var(--umds-semantic-font-family-mono);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.umds-kbd-combo__item {
|
|
47
|
+
display: inline-flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
gap: var(--umds-primitive-spacing-quarck); /* 4px */
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.umds-kbd-combo__separator {
|
|
53
|
+
font-size: var(--umds-primitive-font-size-xxxs); /* 12px */
|
|
54
|
+
color: var(--umds-semantic-color-neutral-dark-down);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* O tamanho do conjunto vale para cada tecla dentro dele. */
|
|
58
|
+
.umds-kbd-combo.umds-kbd--md .umds-kbd--inner {
|
|
59
|
+
font-size: var(--umds-primitive-font-size-xxs); /* 14px */
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.umds-kbd-combo.umds-kbd--sm .umds-kbd--inner {
|
|
63
|
+
min-width: 0;
|
|
64
|
+
padding: 0 var(--umds-primitive-spacing-quarck); /* 0 4px */
|
|
65
|
+
font-size: var(--umds-primitive-font-size-xxxs); /* 12px */
|
|
66
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import './Kbd.css';
|
|
2
|
+
/**
|
|
3
|
+
* Kbd — uma tecla, ou uma combinação de teclas, num `<kbd>`.
|
|
4
|
+
*
|
|
5
|
+
* Uma tecla: `<Kbd>Esc</Kbd>`. Uma combinação: `keys` (`["Ctrl", "Shift", "P"]`),
|
|
6
|
+
* que desenha uma caixa por tecla com o `separator` entre elas (`+` por padrão).
|
|
7
|
+
* A fonte é a monoespaçada do DS (`--umds-semantic-font-family-mono`), a caixa é
|
|
8
|
+
* cinza com borda e uma sombra de base, como uma tecla de verdade.
|
|
9
|
+
*
|
|
10
|
+
* Semântica: `<kbd>` é o elemento HTML de "entrada de teclado", e um `<kbd>`
|
|
11
|
+
* dentro de outro é a forma de dizer "combinação de teclas". O leitor de tela lê
|
|
12
|
+
* "Ctrl + Shift + P" (o separador é texto, não desenho).
|
|
13
|
+
* @property {string[]} keys - Teclas de uma combinação, em ordem. Sem `keys`, vale o conteúdo (uma tecla)
|
|
14
|
+
* @property {string} separator - Texto entre as teclas de uma combinação (padrão "+")
|
|
15
|
+
* @property {string} size - 'sm' | 'md' (padrão)
|
|
16
|
+
* @property {string} className - Classes CSS adicionais
|
|
17
|
+
* @quandoUsar Mostrar um atalho de teclado ou a tecla que a pessoa deve apertar: painel de atalhos, dica de campo, instrução.
|
|
18
|
+
* @quandoNaoUsar Para botão, use `Button`. Para trecho de código, use `CodeBlock`.
|
|
19
|
+
*/
|
|
20
|
+
export interface KbdProps {
|
|
21
|
+
keys?: string[];
|
|
22
|
+
separator?: string;
|
|
23
|
+
size?: "sm" | "md";
|
|
24
|
+
className?: string;
|
|
25
|
+
id?: string;
|
|
26
|
+
style?: any;
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
/** Uma tecla (quando não há `keys`). */
|
|
29
|
+
children?: any;
|
|
30
|
+
}
|
|
31
|
+
declare function Kbd(props: KbdProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export default Kbd;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import './Kbd.css';
|
|
3
|
+
function Kbd(props) {
|
|
4
|
+
function isSingle() {
|
|
5
|
+
return !(props.keys && props.keys.length > 0);
|
|
6
|
+
}
|
|
7
|
+
function keyList() {
|
|
8
|
+
return props.keys || [];
|
|
9
|
+
}
|
|
10
|
+
function classes() {
|
|
11
|
+
const combinacao = !!props.keys && props.keys.length > 0;
|
|
12
|
+
return [
|
|
13
|
+
combinacao ? "umds-kbd-combo" : "umds-kbd",
|
|
14
|
+
`umds-kbd--${props.size || "md"}`,
|
|
15
|
+
props.className,
|
|
16
|
+
]
|
|
17
|
+
.filter(Boolean)
|
|
18
|
+
.join(" ");
|
|
19
|
+
}
|
|
20
|
+
function separatorText() {
|
|
21
|
+
return props.separator || "+";
|
|
22
|
+
}
|
|
23
|
+
function isLast(index) {
|
|
24
|
+
return index === keyList().length - 1;
|
|
25
|
+
}
|
|
26
|
+
function htmlAttrs() {
|
|
27
|
+
const out = {};
|
|
28
|
+
for (const chave in props) {
|
|
29
|
+
if (chave.indexOf("data-") === 0 ||
|
|
30
|
+
chave.indexOf("aria-") === 0 ||
|
|
31
|
+
chave === "style" ||
|
|
32
|
+
chave === "title") {
|
|
33
|
+
out[chave] = props[chave];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
return (_jsxs("kbd", { id: props.id, ...htmlAttrs(), className: classes(), children: [isSingle() ? _jsx(_Fragment, { children: props.children }) : null, keyList()?.map((tecla, posicao) => (_jsxs("span", { className: "umds-kbd-combo__item", children: [_jsx("kbd", { className: "umds-kbd umds-kbd--inner", children: tecla }), !isLast(posicao) ? (_jsx("span", { className: "umds-kbd-combo__separator", children: separatorText() })) : null] }, posicao)))] }));
|
|
39
|
+
}
|
|
40
|
+
export default Kbd;
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
.umds-link:focus-visible {
|
|
33
33
|
outline: 2px solid var(--umds-semantic-color-primary-pure);
|
|
34
34
|
outline-offset: 2px;
|
|
35
|
-
border-radius:
|
|
35
|
+
border-radius: var(--umds-primitive-border-radius-xxs); /* 2px */
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/* ── Tamanhos ── */
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/* ─────────────────────────────────────────────
|
|
2
|
+
LIST / LIST ITEM
|
|
3
|
+
Lista semântica (ul/ol > li) de linhas clicáveis com conteúdo livre.
|
|
4
|
+
Só tokens do DS. Sem equivalente (mantido como literal):
|
|
5
|
+
padding vertical de 10px do CrisDoc → usa spacing-nano (8px).
|
|
6
|
+
───────────────────────────────────────────── */
|
|
7
|
+
|
|
8
|
+
/* ── List ── */
|
|
9
|
+
.umds-list {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
min-width: 0;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
font-family: var(--umds-semantic-font-family-base);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
ul.umds-list,
|
|
18
|
+
ol.umds-list {
|
|
19
|
+
list-style: none;
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.umds-list--gap-none { gap: 0; }
|
|
25
|
+
.umds-list--gap-micro { gap: var(--umds-primitive-spacing-micro); }
|
|
26
|
+
.umds-list--gap-quarck { gap: var(--umds-primitive-spacing-quarck); }
|
|
27
|
+
.umds-list--gap-nano { gap: var(--umds-primitive-spacing-nano); }
|
|
28
|
+
.umds-list--gap-mini { gap: var(--umds-primitive-spacing-mini); }
|
|
29
|
+
.umds-list--gap-xxxs { gap: var(--umds-primitive-spacing-xxxs); }
|
|
30
|
+
|
|
31
|
+
/* Estado vazio: o miolo da lista troca de conteúdo; quem rodeia não muda. */
|
|
32
|
+
.umds-list--empty {
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* ── <li> que envolve a linha ── */
|
|
38
|
+
.umds-list__item {
|
|
39
|
+
display: block;
|
|
40
|
+
list-style: none;
|
|
41
|
+
margin: 0;
|
|
42
|
+
padding: 0;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* ── Linha ── */
|
|
47
|
+
.umds-list-item {
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: flex-start;
|
|
50
|
+
gap: var(--umds-primitive-spacing-nano); /* 8px */
|
|
51
|
+
width: 100%;
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
min-width: 0;
|
|
54
|
+
margin: 0;
|
|
55
|
+
padding: var(--umds-primitive-spacing-nano) var(--umds-primitive-spacing-mini); /* 8px 12px */
|
|
56
|
+
border: 0;
|
|
57
|
+
border-radius: var(--umds-primitive-border-radius-sm); /* 8px */
|
|
58
|
+
background: transparent;
|
|
59
|
+
color: var(--umds-semantic-color-neutral-dark-pure);
|
|
60
|
+
font: inherit;
|
|
61
|
+
text-align: left;
|
|
62
|
+
text-decoration: none;
|
|
63
|
+
transition: background-color var(--umds-semantic-motion-duration-fast) var(--umds-semantic-motion-easing-standard);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.umds-list-item--interactive {
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.umds-list-item--interactive:hover {
|
|
71
|
+
background: var(--umds-semantic-color-background-light);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.umds-list-item--interactive:focus-visible {
|
|
75
|
+
outline: 2px solid var(--umds-semantic-color-primary-pure);
|
|
76
|
+
outline-offset: -2px; /* dentro da linha: o anel não é cortado por overflow do pai */
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* ── Selecionado ── */
|
|
80
|
+
.umds-list-item--selected {
|
|
81
|
+
background: var(--umds-semantic-color-primary-light);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.umds-list-item--selected.umds-list-item--interactive:hover {
|
|
85
|
+
background: color-mix(
|
|
86
|
+
in srgb,
|
|
87
|
+
var(--umds-semantic-color-primary-light) 85%,
|
|
88
|
+
var(--umds-semantic-color-background-white)
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* ── Desabilitado ── */
|
|
93
|
+
.umds-list-item--disabled,
|
|
94
|
+
.umds-list-item--disabled .umds-list-item__subtitle,
|
|
95
|
+
.umds-list-item--disabled .umds-list-item__meta {
|
|
96
|
+
color: var(--umds-semantic-color-neutral-dark-up);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.umds-list-item--disabled,
|
|
100
|
+
.umds-list-item--disabled.umds-list-item--interactive:hover {
|
|
101
|
+
cursor: not-allowed;
|
|
102
|
+
background: transparent;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* ── Anatomia ── */
|
|
106
|
+
.umds-list-item__start,
|
|
107
|
+
.umds-list-item__end {
|
|
108
|
+
display: inline-flex;
|
|
109
|
+
flex-shrink: 0;
|
|
110
|
+
align-items: center;
|
|
111
|
+
align-self: center;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.umds-list-item__end {
|
|
115
|
+
margin-left: auto;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.umds-list-item__body {
|
|
119
|
+
display: flex;
|
|
120
|
+
flex: 1 1 auto;
|
|
121
|
+
flex-direction: column;
|
|
122
|
+
gap: var(--umds-primitive-spacing-micro); /* 2px */
|
|
123
|
+
min-width: 0;
|
|
124
|
+
overflow-wrap: anywhere;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.umds-list-item__title {
|
|
128
|
+
display: block;
|
|
129
|
+
color: inherit;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.umds-list-item__subtitle,
|
|
133
|
+
.umds-list-item__meta {
|
|
134
|
+
display: block;
|
|
135
|
+
color: var(--umds-semantic-color-neutral-dark-down);
|
|
136
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import './List.css';
|
|
2
|
+
/** Espaço entre as linhas, na escala oficial do DS. `none` cola as linhas. */
|
|
3
|
+
export type ListGap = "none" | "micro" | "quarck" | "nano" | "mini" | "xxxs";
|
|
4
|
+
/** Elemento da lista: `ul` (padrão) ou `ol` quando a ordem importa. */
|
|
5
|
+
/** Espaço entre as linhas, na escala oficial do DS. `none` cola as linhas. */
|
|
6
|
+
/** Elemento da lista: `ul` (padrão) ou `ol` quando a ordem importa. */
|
|
7
|
+
export type ListTag = "ul" | "ol";
|
|
8
|
+
/**
|
|
9
|
+
* List — agrupa `ListItem` numa lista semântica (`ul`/`ol` com `li`) e traz o
|
|
10
|
+
* estado vazio dentro dela.
|
|
11
|
+
*
|
|
12
|
+
* Quando não há itens, passe `isEmpty`: a lista troca os itens por um
|
|
13
|
+
* `EmptyState` (`emptyTitle`, `emptyDescription`, `emptyIcon`, `emptyActionLabel`
|
|
14
|
+
* com `onEmptyAction`) ou, para um conteúdo próprio, pelo slot `empty`. Só o
|
|
15
|
+
* miolo troca: o título do cartão, a busca, os filtros e a paginação ao redor
|
|
16
|
+
* continuam montados, e o estado vazio é anunciado ao leitor de tela
|
|
17
|
+
* (`role="status"`). `isEmpty` é uma decisão sua, porque a lista não conta
|
|
18
|
+
* filhos: `:is-empty="!itens.length"`.
|
|
19
|
+
*
|
|
20
|
+
* A lista precisa de nome: passe `ariaLabel` (ou `ariaLabelledby`, apontando
|
|
21
|
+
* para o título visível). Sem isso o leitor de tela anuncia "lista, 5 itens"
|
|
22
|
+
* sem dizer de quê.
|
|
23
|
+
*
|
|
24
|
+
* `ul` e `ol` saem sem marcador, margem e recuo, com `role="list"` (o Safari
|
|
25
|
+
* tira a semântica de lista de `list-style: none`).
|
|
26
|
+
* @property {string} as - Elemento: 'ul' (padrão) | 'ol'
|
|
27
|
+
* @property {string} gap - Espaço entre as linhas, na escala do DS ('none' cola)
|
|
28
|
+
* @property {string} ariaLabel - Nome acessível da lista
|
|
29
|
+
* @property {string} ariaLabelledby - Id do título visível que nomeia a lista
|
|
30
|
+
* @property {boolean} isEmpty - Sem itens: mostra o estado vazio no lugar das linhas
|
|
31
|
+
* @property {string} emptyTitle - Título do estado vazio (padrão: "Nenhum item encontrado")
|
|
32
|
+
* @property {string} emptyDescription - Texto de apoio do estado vazio
|
|
33
|
+
* @property {IconProp} emptyIcon - Ícone do estado vazio (objeto do Font Awesome)
|
|
34
|
+
* @property {string} emptySize - Tamanho do estado vazio: 'sm' (padrão, compacto) | 'md' | 'lg'
|
|
35
|
+
* @property {string} emptyActionLabel - Rótulo do botão do estado vazio (junto de onEmptyAction)
|
|
36
|
+
* @property {function} onEmptyAction - Callback do botão do estado vazio
|
|
37
|
+
* @property {any} empty - Slot `empty`: conteúdo próprio no lugar do EmptyState
|
|
38
|
+
* @property {string} className - Classes CSS adicionais
|
|
39
|
+
* @slot empty - Conteúdo do estado vazio (substitui o EmptyState padrão).
|
|
40
|
+
* @quandoUsar Qualquer lista de linhas clicáveis (`ListItem`) ou de itens simples que pode ficar sem resultado: documentos não lidos, notificações, resultados de busca. Resolve a semântica de lista e o "nada por aqui" num lugar só.
|
|
41
|
+
* @quandoNaoUsar Para dados tabulares comparados coluna a coluna, use `DataTable` (que já tem o próprio estado vazio). Para só empilhar blocos com espaçamento, sem semântica de lista, use `Stack`. Para um estado vazio que ocupa a tela inteira (sem lista), use `EmptyState` direto.
|
|
42
|
+
*/
|
|
43
|
+
/** Espaço entre as linhas, na escala oficial do DS. `none` cola as linhas. */
|
|
44
|
+
/** Elemento da lista: `ul` (padrão) ou `ol` quando a ordem importa. */
|
|
45
|
+
export interface ListProps {
|
|
46
|
+
/** Elemento da lista. @default 'ul' */
|
|
47
|
+
as?: ListTag;
|
|
48
|
+
/** Espaço entre as linhas, na escala oficial (`none` cola). @default 'quarck' */
|
|
49
|
+
gap?: ListGap;
|
|
50
|
+
/** Nome acessível da lista. */
|
|
51
|
+
ariaLabel?: string;
|
|
52
|
+
/** Id do título visível que nomeia a lista. */
|
|
53
|
+
ariaLabelledby?: string;
|
|
54
|
+
/** Sem itens: mostra o estado vazio no lugar das linhas. @default false */
|
|
55
|
+
isEmpty?: boolean;
|
|
56
|
+
/** Título do estado vazio. @default 'Nenhum item encontrado' */
|
|
57
|
+
emptyTitle?: string;
|
|
58
|
+
/** Texto de apoio do estado vazio. */
|
|
59
|
+
emptyDescription?: string;
|
|
60
|
+
/** Ícone do estado vazio: o objeto importado do Font Awesome. */
|
|
61
|
+
emptyIcon?: IconProp;
|
|
62
|
+
/** Tamanho do estado vazio. @default 'sm' */
|
|
63
|
+
emptySize?: "sm" | "md" | "lg";
|
|
64
|
+
/** Rótulo do botão do estado vazio (exibido junto de `onEmptyAction`). */
|
|
65
|
+
emptyActionLabel?: string;
|
|
66
|
+
/** Chamado no botão do estado vazio. */
|
|
67
|
+
onEmptyAction?: () => void;
|
|
68
|
+
/** Conteúdo próprio do estado vazio. No Vue, slot `empty`. */
|
|
69
|
+
empty?: any;
|
|
70
|
+
/** Classes CSS adicionais. */
|
|
71
|
+
className?: string;
|
|
72
|
+
/** ID HTML do elemento raiz. */
|
|
73
|
+
id?: string;
|
|
74
|
+
/** Atributos HTML repassados ao elemento raiz (style, data-*…). */
|
|
75
|
+
style?: any;
|
|
76
|
+
[key: string]: any;
|
|
77
|
+
/** As linhas: `ListItem` (ou `li`). */
|
|
78
|
+
children?: any;
|
|
79
|
+
}
|
|
80
|
+
import type { IconProp } from "../Icon/Icon";
|
|
81
|
+
declare function List(props: ListProps): import("react/jsx-runtime").JSX.Element;
|
|
82
|
+
export default List;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import './List.css';
|
|
3
|
+
import EmptyState from "../EmptyState/EmptyState";
|
|
4
|
+
function List(props) {
|
|
5
|
+
function elementTag() {
|
|
6
|
+
return props.as || "ul";
|
|
7
|
+
}
|
|
8
|
+
function showEmpty() {
|
|
9
|
+
return !!props.isEmpty;
|
|
10
|
+
}
|
|
11
|
+
function showItems() {
|
|
12
|
+
return !props.isEmpty;
|
|
13
|
+
}
|
|
14
|
+
function classes() {
|
|
15
|
+
return [
|
|
16
|
+
"umds-list",
|
|
17
|
+
`umds-list--gap-${props.gap || "quarck"}`,
|
|
18
|
+
props.className,
|
|
19
|
+
]
|
|
20
|
+
.filter(Boolean)
|
|
21
|
+
.join(" ");
|
|
22
|
+
}
|
|
23
|
+
function emptyClasses() {
|
|
24
|
+
return ["umds-list umds-list--empty", props.className]
|
|
25
|
+
.filter(Boolean)
|
|
26
|
+
.join(" ");
|
|
27
|
+
}
|
|
28
|
+
function emptyTitleText() {
|
|
29
|
+
return props.emptyTitle || "Nenhum item encontrado";
|
|
30
|
+
}
|
|
31
|
+
function emptyActionProps() {
|
|
32
|
+
if (!props.onEmptyAction)
|
|
33
|
+
return {};
|
|
34
|
+
return {
|
|
35
|
+
actionLabel: props.emptyActionLabel,
|
|
36
|
+
onAction: props.onEmptyAction,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function emptySizeValue() {
|
|
40
|
+
return props.emptySize || "sm";
|
|
41
|
+
}
|
|
42
|
+
function htmlAttrs() {
|
|
43
|
+
const out = {};
|
|
44
|
+
for (const chave in props) {
|
|
45
|
+
if (chave.indexOf("data-") === 0 || chave === "style") {
|
|
46
|
+
out[chave] = props[chave];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
51
|
+
return (_jsxs(_Fragment, { children: [showEmpty() ? (_jsx("div", { role: "status", id: props.id, ...htmlAttrs(), className: emptyClasses(), children: _jsx(_Fragment, { children: props.empty || (_jsx(EmptyState, { icon: props.emptyIcon, title: emptyTitleText(), description: props.emptyDescription, size: emptySizeValue(), ...emptyActionProps() })) }) })) : null, showItems() && elementTag() === "ul" ? (_jsx("ul", { role: "list", id: props.id, "aria-label": props.ariaLabel, "aria-labelledby": props.ariaLabelledby, ...htmlAttrs(), className: classes(), children: _jsx(_Fragment, { children: props.children }) })) : null, showItems() && elementTag() === "ol" ? (_jsx("ol", { role: "list", id: props.id, "aria-label": props.ariaLabel, "aria-labelledby": props.ariaLabelledby, ...htmlAttrs(), className: classes(), children: _jsx(_Fragment, { children: props.children }) })) : null] }));
|
|
52
|
+
}
|
|
53
|
+
export default List;
|