@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
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import './IconPicker.css';
|
|
4
|
+
import { useState, useRef, useEffect } from "react";
|
|
5
|
+
import Icon from "../Icon/Icon";
|
|
6
|
+
import Input from "../Input/Input";
|
|
7
|
+
import Text from "../Text/Text";
|
|
8
|
+
import { gerarId } from "../../utils/id";
|
|
9
|
+
import { semAcento } from "../../utils/texto";
|
|
10
|
+
import { faMagnifyingGlass } from "@fortawesome/free-solid-svg-icons";
|
|
11
|
+
function IconPicker(props) {
|
|
12
|
+
const groupRef = useRef(null);
|
|
13
|
+
const focoPendenteRef = useRef(-1);
|
|
14
|
+
const [internalValue, setInternalValue] = useState(() => props.defaultValue || "");
|
|
15
|
+
const [query, setQuery] = useState(() => "");
|
|
16
|
+
const [uid, setUid] = useState(() => "");
|
|
17
|
+
function baseId() {
|
|
18
|
+
return props.id || uid;
|
|
19
|
+
}
|
|
20
|
+
function labelId() {
|
|
21
|
+
return baseId() && props.label ? baseId() + "-label" : undefined;
|
|
22
|
+
}
|
|
23
|
+
function groupAriaLabel() {
|
|
24
|
+
if (props.ariaLabel)
|
|
25
|
+
return props.ariaLabel;
|
|
26
|
+
return props.label && !labelId() ? props.label : undefined;
|
|
27
|
+
}
|
|
28
|
+
function currentValue() {
|
|
29
|
+
return props.value !== undefined ? props.value : internalValue;
|
|
30
|
+
}
|
|
31
|
+
function columnCount() {
|
|
32
|
+
return props.columns && props.columns > 0 ? props.columns : 8;
|
|
33
|
+
}
|
|
34
|
+
function classes() {
|
|
35
|
+
return [
|
|
36
|
+
"umds-icon-picker",
|
|
37
|
+
`umds-icon-picker--${props.size || "md"}`,
|
|
38
|
+
props.disabled ? "umds-icon-picker--disabled" : "",
|
|
39
|
+
props.className,
|
|
40
|
+
]
|
|
41
|
+
.filter(Boolean)
|
|
42
|
+
.join(" ");
|
|
43
|
+
}
|
|
44
|
+
function gridStyle() {
|
|
45
|
+
const estilo = {
|
|
46
|
+
gridTemplateColumns: "repeat(" + columnCount() + ", var(--umds-icon-picker-tile))",
|
|
47
|
+
};
|
|
48
|
+
if (props.maxHeight)
|
|
49
|
+
estilo.maxHeight = props.maxHeight + "px";
|
|
50
|
+
return estilo;
|
|
51
|
+
}
|
|
52
|
+
function nomeDe(icone) {
|
|
53
|
+
if (!icone)
|
|
54
|
+
return "";
|
|
55
|
+
if (typeof icone === "string")
|
|
56
|
+
return icone;
|
|
57
|
+
return icone.iconName || "";
|
|
58
|
+
}
|
|
59
|
+
function rotuloDe(nome) {
|
|
60
|
+
if (props.iconLabel)
|
|
61
|
+
return props.iconLabel(nome);
|
|
62
|
+
return nome.replace(/-/g, " ");
|
|
63
|
+
}
|
|
64
|
+
function itemList() {
|
|
65
|
+
const lista = props.icons || [];
|
|
66
|
+
const saida = [];
|
|
67
|
+
for (let i = 0; i < lista.length; i++) {
|
|
68
|
+
const bruto = lista[i];
|
|
69
|
+
const embrulhado = !!bruto && bruto.icon !== undefined && bruto.iconName === undefined;
|
|
70
|
+
const icone = embrulhado ? bruto.icon : bruto;
|
|
71
|
+
const nome = nomeDe(icone);
|
|
72
|
+
if (!nome)
|
|
73
|
+
continue;
|
|
74
|
+
const rotulo = embrulhado && bruto.label ? bruto.label : rotuloDe(nome);
|
|
75
|
+
const palavras = embrulhado && bruto.keywords ? bruto.keywords.join(" ") : "";
|
|
76
|
+
saida.push({
|
|
77
|
+
name: nome,
|
|
78
|
+
label: rotulo,
|
|
79
|
+
icon: icone,
|
|
80
|
+
raw: bruto,
|
|
81
|
+
search: semAcento(nome + " " + rotulo + " " + palavras),
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return saida;
|
|
85
|
+
}
|
|
86
|
+
function visibleItems() {
|
|
87
|
+
const busca = semAcento(query);
|
|
88
|
+
if (!busca)
|
|
89
|
+
return itemList();
|
|
90
|
+
return itemList().filter((item) => item.search.indexOf(busca) !== -1);
|
|
91
|
+
}
|
|
92
|
+
function hasResults() {
|
|
93
|
+
return visibleItems().length > 0;
|
|
94
|
+
}
|
|
95
|
+
function emptyMessage() {
|
|
96
|
+
return props.emptyText || "Nenhum ícone encontrado";
|
|
97
|
+
}
|
|
98
|
+
function resultsText() {
|
|
99
|
+
return (props.resultsLabel || "{count} ícones").replace("{count}", String(visibleItems().length));
|
|
100
|
+
}
|
|
101
|
+
function searchName() {
|
|
102
|
+
return props.searchLabel || "Buscar ícone";
|
|
103
|
+
}
|
|
104
|
+
function estaEscolhido(item) {
|
|
105
|
+
return !!currentValue() && item.name === currentValue();
|
|
106
|
+
}
|
|
107
|
+
function itemClasses(item) {
|
|
108
|
+
return [
|
|
109
|
+
"umds-icon-picker__item",
|
|
110
|
+
estaEscolhido(item) ? "umds-icon-picker__item--selected" : "",
|
|
111
|
+
]
|
|
112
|
+
.filter(Boolean)
|
|
113
|
+
.join(" ");
|
|
114
|
+
}
|
|
115
|
+
function indiceDoTab() {
|
|
116
|
+
const lista = visibleItems();
|
|
117
|
+
for (let i = 0; i < lista.length; i++) {
|
|
118
|
+
if (estaEscolhido(lista[i]))
|
|
119
|
+
return i;
|
|
120
|
+
}
|
|
121
|
+
return 0;
|
|
122
|
+
}
|
|
123
|
+
function tabIndexDe(index) {
|
|
124
|
+
return index === indiceDoTab() ? 0 : -1;
|
|
125
|
+
}
|
|
126
|
+
function escolher(item) {
|
|
127
|
+
if (props.disabled)
|
|
128
|
+
return;
|
|
129
|
+
setInternalValue(item.name);
|
|
130
|
+
if (props.onChange)
|
|
131
|
+
props.onChange(item.name, item.raw);
|
|
132
|
+
}
|
|
133
|
+
function focarEm(index) {
|
|
134
|
+
if (!groupRef.current)
|
|
135
|
+
return;
|
|
136
|
+
const botoes = groupRef.current.querySelectorAll('[role="radio"]');
|
|
137
|
+
const alvo = botoes[index];
|
|
138
|
+
if (alvo)
|
|
139
|
+
alvo.focus();
|
|
140
|
+
}
|
|
141
|
+
function handleKeyDown(event, index) {
|
|
142
|
+
if (!event || event.altKey || event.ctrlKey || event.metaKey)
|
|
143
|
+
return;
|
|
144
|
+
const lista = visibleItems();
|
|
145
|
+
const total = lista.length;
|
|
146
|
+
if (!total)
|
|
147
|
+
return;
|
|
148
|
+
const colunas = columnCount();
|
|
149
|
+
let alvo = index;
|
|
150
|
+
if (event.key === "ArrowRight")
|
|
151
|
+
alvo = (index + 1) % total;
|
|
152
|
+
else if (event.key === "ArrowLeft")
|
|
153
|
+
alvo = (index - 1 + total) % total;
|
|
154
|
+
else if (event.key === "ArrowDown")
|
|
155
|
+
alvo = index + colunas < total ? index + colunas : index;
|
|
156
|
+
else if (event.key === "ArrowUp")
|
|
157
|
+
alvo = index - colunas >= 0 ? index - colunas : index;
|
|
158
|
+
else if (event.key === "Home")
|
|
159
|
+
alvo = 0;
|
|
160
|
+
else if (event.key === "End")
|
|
161
|
+
alvo = total - 1;
|
|
162
|
+
else
|
|
163
|
+
return;
|
|
164
|
+
event.preventDefault();
|
|
165
|
+
if (alvo === index &&
|
|
166
|
+
event.key !== "ArrowRight" &&
|
|
167
|
+
event.key !== "ArrowLeft")
|
|
168
|
+
return;
|
|
169
|
+
escolher(lista[alvo]);
|
|
170
|
+
focoPendenteRef.current = alvo;
|
|
171
|
+
}
|
|
172
|
+
function handleSearch(texto) {
|
|
173
|
+
setQuery(texto);
|
|
174
|
+
}
|
|
175
|
+
function handleSearchKeyDown(event) {
|
|
176
|
+
if (!event || event.key !== "ArrowDown" || !hasResults())
|
|
177
|
+
return;
|
|
178
|
+
event.preventDefault();
|
|
179
|
+
focarEm(indiceDoTab());
|
|
180
|
+
}
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
if (!props.id)
|
|
183
|
+
setUid(gerarId("umds-icon-picker"));
|
|
184
|
+
}, []);
|
|
185
|
+
useEffect(() => {
|
|
186
|
+
if (focoPendenteRef.current >= 0) {
|
|
187
|
+
const alvo = focoPendenteRef.current;
|
|
188
|
+
focoPendenteRef.current = -1;
|
|
189
|
+
focarEm(alvo);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
return (_jsxs("div", { className: classes(), children: [props.label ? (_jsx("span", { className: "umds-icon-picker__label", id: labelId(), children: props.label })) : null, !props.hideSearch ? (_jsx("div", { className: "umds-icon-picker__search", onKeyDown: (event) => handleSearchKeyDown(event), children: _jsx(Input, { size: "sm", type: "search", ariaLabel: searchName(), placeholder: props.searchPlaceholder || "Buscar ícone...", iconLeft: faMagnifyingGlass, value: query, disabled: props.disabled, onChange: (texto) => handleSearch(texto) }) })) : null, _jsx("span", { role: "status", "aria-live": "polite", className: "umds-icon-picker__sr", children: resultsText() }), hasResults() ? (_jsx("div", { role: "radiogroup", className: "umds-icon-picker__grid", ref: groupRef, "aria-label": groupAriaLabel(), "aria-labelledby": labelId(), style: gridStyle(), children: visibleItems()?.map((item, posicao) => (_jsx("button", { type: "button", role: "radio", "aria-checked": estaEscolhido(item) ? "true" : "false", "aria-label": item.label, title: item.label, disabled: props.disabled, tabIndex: tabIndexDe(posicao), onClick: (event) => escolher(item), onKeyDown: (event) => handleKeyDown(event, posicao), className: itemClasses(item), children: _jsx(Icon, { variant: "inherit", icon: item.icon, size: props.size === "sm" ? "sm" : "md" }) }, item.name))) })) : null, !hasResults() ? (_jsx("div", { className: "umds-icon-picker__empty", children: _jsx(Text, { as: "p", variant: "body2", color: "secondary", children: emptyMessage() }) })) : null] }));
|
|
193
|
+
}
|
|
194
|
+
export default IconPicker;
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
display: flex;
|
|
35
35
|
align-items: center;
|
|
36
36
|
background-color: var(--umds-semantic-color-background-white);
|
|
37
|
-
border: 1px solid var(--umds-semantic-
|
|
37
|
+
border: 1px solid var(--umds-semantic-field-border-default);
|
|
38
38
|
border-radius: var(--umds-primitive-border-radius-sm);
|
|
39
39
|
box-sizing: border-box;
|
|
40
40
|
transition:
|
|
@@ -167,12 +167,12 @@
|
|
|
167
167
|
.umds-input--readonly .umds-input__container,
|
|
168
168
|
.umds-input__container--readonly {
|
|
169
169
|
background-color: var(--umds-semantic-field-readonly-background);
|
|
170
|
-
border-color: var(--umds-semantic-
|
|
170
|
+
border-color: var(--umds-semantic-field-border-default);
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
.umds-input--readonly .umds-input__container:hover,
|
|
174
174
|
.umds-input__container--readonly:hover {
|
|
175
|
-
border-color: var(--umds-semantic-
|
|
175
|
+
border-color: var(--umds-semantic-field-border-default);
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
.umds-input--readonly .umds-input__container:focus-within,
|
|
@@ -186,6 +186,14 @@
|
|
|
186
186
|
cursor: default;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
/* Somente leitura não é desabilitado: o texto segue lido e a WCAG 1.4.3 vale
|
|
190
|
+
sem isenção. O placeholder padrão foi calibrado para fundo branco e cai para
|
|
191
|
+
~4,2:1 sobre o fundo de somente leitura; neutral-dark-down passa 4,5:1 em
|
|
192
|
+
todos os temas (1doc 6,78:1 · 1doc-dark 10,83:1 · alto contraste 16,48:1). */
|
|
193
|
+
.umds-input--readonly .umds-input__control::placeholder {
|
|
194
|
+
color: var(--umds-semantic-color-neutral-dark-down);
|
|
195
|
+
}
|
|
196
|
+
|
|
189
197
|
/* ── Ícone esquerdo ── */
|
|
190
198
|
.umds-input__icon-left {
|
|
191
199
|
display: flex;
|
|
@@ -196,6 +204,20 @@
|
|
|
196
204
|
flex-shrink: 0;
|
|
197
205
|
}
|
|
198
206
|
|
|
207
|
+
/* ── Ícone decorativo à direita (iconRight) ── */
|
|
208
|
+
.umds-input__icon-right {
|
|
209
|
+
display: flex;
|
|
210
|
+
align-items: center;
|
|
211
|
+
justify-content: center;
|
|
212
|
+
margin-left: var(--umds-primitive-spacing-nano);
|
|
213
|
+
color: var(--umds-semantic-color-neutral-dark-medium);
|
|
214
|
+
flex-shrink: 0;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.umds-input--disabled .umds-input__icon-right {
|
|
218
|
+
color: var(--umds-semantic-color-neutral-dark-up);
|
|
219
|
+
}
|
|
220
|
+
|
|
199
221
|
/* ── Ações à direita (botões de ícone) ── */
|
|
200
222
|
.umds-input__actions-right {
|
|
201
223
|
display: flex;
|
|
@@ -235,6 +257,22 @@
|
|
|
235
257
|
outline-offset: 0; /* exceção ao offset 2px: o botão vive DENTRO do campo, e o afastamento invadiria a borda */
|
|
236
258
|
}
|
|
237
259
|
|
|
260
|
+
/* ── borderless: o campo dentro de um grupo que já tem a moldura ──
|
|
261
|
+
Sem borda, fundo e raio. O foco NÃO some: o anel do campo vira um contorno
|
|
262
|
+
para dentro (WCAG 2.4.7), e o erro mantém a borda vermelha (a cor do erro não
|
|
263
|
+
pode depender só da moldura do grupo). Sem erro, hover e foco não pintam borda. */
|
|
264
|
+
.umds-input--borderless:not(.umds-input--error) .umds-input__container {
|
|
265
|
+
border-color: transparent;
|
|
266
|
+
border-radius: 0;
|
|
267
|
+
background-color: transparent;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.umds-input--borderless .umds-input__container:focus-within:not(.umds-input__container--disabled):not(.umds-input__container--readonly) {
|
|
271
|
+
box-shadow: none;
|
|
272
|
+
outline: 2px solid var(--umds-semantic-color-primary-pure);
|
|
273
|
+
outline-offset: -2px;
|
|
274
|
+
}
|
|
275
|
+
|
|
238
276
|
/* ── Mobile: fonte ≥16px no controle (decisão 25/07) ──
|
|
239
277
|
Fonte <16px num campo focado dispara zoom automático no Safari iOS.
|
|
240
278
|
Só abaixo do breakpoint-sm (640px) — desktop permanece idêntico. */
|
|
@@ -34,7 +34,10 @@ export interface InputAction {
|
|
|
34
34
|
* @property {string} ariaLabel - Nome acessível quando não há label visível
|
|
35
35
|
* @property {IconProp} iconLeft - Ícone Font Awesome à esquerda
|
|
36
36
|
* @property {InputAction[]} iconsRight - Botões de ação com ícone à direita
|
|
37
|
-
* @property {
|
|
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} 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
|
+
* @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
|
+
* @property {function} onChange - Callback acionado A CADA TECLA (recebe o novo valor string), nos dois frameworks. O blur sai em `onBlur`.
|
|
38
41
|
* @property {function} onFocus - Callback de foco (recebe o evento nativo)
|
|
39
42
|
* @property {function} onBlur - Callback de blur (recebe o evento nativo)
|
|
40
43
|
* @quandoUsar Entrada de texto de UMA linha: nome, e-mail, número, busca. É o campo padrão quando o dado é curto e livre.
|
|
@@ -81,8 +84,18 @@ export interface InputProps {
|
|
|
81
84
|
fullWidth?: boolean;
|
|
82
85
|
className?: string;
|
|
83
86
|
ariaLabel?: string;
|
|
87
|
+
/** Nome acessível do botão de mostrar a senha (`type="password"`). Troque para traduzir. @default 'Mostrar senha' */
|
|
88
|
+
showPasswordLabel?: string;
|
|
89
|
+
/** Nome acessível do botão de ocultar a senha (`type="password"`). Troque para traduzir. @default 'Ocultar senha' */
|
|
90
|
+
hidePasswordLabel?: string;
|
|
84
91
|
iconLeft?: IconProp;
|
|
85
92
|
iconsRight?: InputAction[];
|
|
93
|
+
/** Ícone decorativo à direita (não clicável, `aria-hidden`). Para ação, use `iconsRight`. */
|
|
94
|
+
iconRight?: IconProp;
|
|
95
|
+
/** 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
|
+
borderless?: boolean;
|
|
97
|
+
/** Máscara simples. O valor exibido e o de `onChange` já saem formatados. */
|
|
98
|
+
mask?: "cpf" | "cnpj" | "cep" | "phone";
|
|
86
99
|
onChange?: (value: string) => void;
|
|
87
100
|
onFocus?: (event?: any) => void;
|
|
88
101
|
onBlur?: (event?: any) => void;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import './Input.css';
|
|
4
|
-
import { useState } from "react";
|
|
4
|
+
import { useState, useRef } from "react";
|
|
5
5
|
import { faEye, faEyeSlash } from "@fortawesome/free-solid-svg-icons";
|
|
6
6
|
import Icon from "../Icon/Icon";
|
|
7
7
|
import Text from "../Text/Text";
|
|
8
8
|
function Input(props) {
|
|
9
|
+
const ultimoEventoRef = useRef(null);
|
|
10
|
+
const ultimoValorRef = useRef(null);
|
|
9
11
|
const [isPasswordVisible, setIsPasswordVisible] = useState(() => false);
|
|
10
12
|
const [internalValue, setInternalValue] = useState(() => props.defaultValue || "");
|
|
11
13
|
const [uid, setUid] = useState(() => "umds-input-" + Math.random().toString(36).slice(2, 9));
|
|
@@ -15,6 +17,11 @@ function Input(props) {
|
|
|
15
17
|
function inputId() {
|
|
16
18
|
return props.id || uid;
|
|
17
19
|
}
|
|
20
|
+
function passwordToggleLabel() {
|
|
21
|
+
return isPasswordVisible
|
|
22
|
+
? props.hidePasswordLabel || "Ocultar senha"
|
|
23
|
+
: props.showPasswordLabel || "Mostrar senha";
|
|
24
|
+
}
|
|
18
25
|
function errorId() {
|
|
19
26
|
return (props.id || uid) + "-error";
|
|
20
27
|
}
|
|
@@ -43,6 +50,7 @@ function Input(props) {
|
|
|
43
50
|
props.disabled ? "umds-input--disabled" : "",
|
|
44
51
|
props.readOnly ? "umds-input--readonly" : "",
|
|
45
52
|
props.numberSpinner ? "umds-input--number-spinner" : "",
|
|
53
|
+
props.borderless ? "umds-input--borderless" : "",
|
|
46
54
|
`umds-input--${props.size || "md"}`,
|
|
47
55
|
props.className,
|
|
48
56
|
]
|
|
@@ -64,16 +72,74 @@ function Input(props) {
|
|
|
64
72
|
function iconSize() {
|
|
65
73
|
return props.size === "sm" || props.size === "xs" ? "sm" : "md";
|
|
66
74
|
}
|
|
75
|
+
function aplicarMascara(valor) {
|
|
76
|
+
const texto = valor === undefined || valor === null ? "" : String(valor);
|
|
77
|
+
if (!props.mask)
|
|
78
|
+
return texto;
|
|
79
|
+
let digitos = texto.replace(/\D/g, "");
|
|
80
|
+
let padrao = "";
|
|
81
|
+
if (props.mask === "cpf")
|
|
82
|
+
padrao = "###.###.###-##";
|
|
83
|
+
else if (props.mask === "cnpj")
|
|
84
|
+
padrao = "##.###.###/####-##";
|
|
85
|
+
else if (props.mask === "cep")
|
|
86
|
+
padrao = "#####-###";
|
|
87
|
+
else if (props.mask === "phone")
|
|
88
|
+
padrao = digitos.length > 10 ? "(##) #####-####" : "(##) ####-####";
|
|
89
|
+
let saida = "";
|
|
90
|
+
let posicao = 0;
|
|
91
|
+
for (let i = 0; i < padrao.length && posicao < digitos.length; i++) {
|
|
92
|
+
if (padrao.charAt(i) === "#") {
|
|
93
|
+
saida += digitos.charAt(posicao);
|
|
94
|
+
posicao++;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
saida += padrao.charAt(i);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return saida;
|
|
101
|
+
}
|
|
102
|
+
function tamanhoMaximo() {
|
|
103
|
+
if (props.mask === "cpf")
|
|
104
|
+
return 14;
|
|
105
|
+
if (props.mask === "cnpj")
|
|
106
|
+
return 18;
|
|
107
|
+
if (props.mask === "cep")
|
|
108
|
+
return 9;
|
|
109
|
+
if (props.mask === "phone")
|
|
110
|
+
return 15;
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
function modoDoTeclado() {
|
|
114
|
+
return props.mask ? "numeric" : undefined;
|
|
115
|
+
}
|
|
116
|
+
function valorExibido() {
|
|
117
|
+
const bruto = props.value !== undefined ? props.value : internalValue;
|
|
118
|
+
return aplicarMascara(bruto);
|
|
119
|
+
}
|
|
67
120
|
function handleChange(event) {
|
|
68
|
-
|
|
121
|
+
const nativo = event.nativeEvent || event;
|
|
122
|
+
if (nativo === ultimoEventoRef.current)
|
|
123
|
+
return;
|
|
124
|
+
ultimoEventoRef.current = nativo;
|
|
125
|
+
const valor = aplicarMascara(event.target.value);
|
|
126
|
+
// O `change` do blur (Vue) repete o que o `input` da última tecla
|
|
127
|
+
// entregou; só passa se o valor mudou de fato (ex.: change disparado à mão).
|
|
128
|
+
if (nativo.type === "change" && valor === ultimoValorRef.current)
|
|
129
|
+
return;
|
|
130
|
+
ultimoValorRef.current = valor;
|
|
131
|
+
if (props.mask && event.target.value !== valor) {
|
|
132
|
+
event.target.value = valor;
|
|
133
|
+
}
|
|
134
|
+
setInternalValue(valor);
|
|
69
135
|
if (props.onChange) {
|
|
70
|
-
props.onChange(
|
|
136
|
+
props.onChange(valor);
|
|
71
137
|
}
|
|
72
138
|
}
|
|
73
|
-
return (_jsxs("div", { className: wrapperClasses(), children: [props.label ? (_jsxs(Text, { as: "label", variant: "label", className: "umds-input__label", forId: inputId(), children: [_jsx(_Fragment, { children: props.label }), props.required ? (_jsx("span", { className: "umds-input__required", children: "*" })) : null] })) : null, _jsxs("div", { className: inputContainerClasses(), children: [props.iconLeft ? (_jsx("div", { className: "umds-input__icon-left", children: _jsx(Icon, { icon: props.iconLeft, size: iconSize() }) })) : null, _jsx("input", { className: "umds-input__control", id: inputId(), type: inputType(), name: props.name, min: props.min, max: props.max, step: props.step, disabled: props.disabled, readOnly: props.readOnly, placeholder: props.placeholder, value:
|
|
74
|
-
!!(props.errorMessage && props.errorMessage.length > 0), "aria-describedby": describedBy() || undefined, required: props.required }), _jsxs("div", { className: "umds-input__actions-right", children: [props.type === "password" ? (_jsx("button", { type: "button", className: "umds-input__action-btn", disabled: props.disabled, onClick: (event) => togglePassword(), "aria-label":
|
|
139
|
+
return (_jsxs("div", { className: wrapperClasses(), children: [props.label ? (_jsxs(Text, { as: "label", variant: "label", className: "umds-input__label", forId: inputId(), children: [_jsx(_Fragment, { children: props.label }), props.required ? (_jsx("span", { className: "umds-input__required", children: "*" })) : null] })) : null, _jsxs("div", { className: inputContainerClasses(), children: [props.iconLeft ? (_jsx("div", { className: "umds-input__icon-left", children: _jsx(Icon, { icon: props.iconLeft, size: iconSize() }) })) : null, _jsx("input", { className: "umds-input__control", id: inputId(), type: inputType(), name: props.name, min: props.min, max: props.max, step: props.step, disabled: props.disabled, readOnly: props.readOnly, placeholder: props.placeholder, value: valorExibido(), maxLength: tamanhoMaximo(), inputMode: modoDoTeclado(), onInput: (event) => handleChange(event), onChange: (event) => handleChange(event), onFocus: (event) => props.onFocus?.(event), onBlur: (event) => props.onBlur?.(event), "aria-label": props.ariaLabel, "aria-invalid": !!props.invalid ||
|
|
140
|
+
!!(props.errorMessage && props.errorMessage.length > 0), "aria-describedby": describedBy() || undefined, required: props.required }), _jsxs("div", { className: "umds-input__actions-right", children: [props.type === "password" ? (_jsx("button", { type: "button", className: "umds-input__action-btn", disabled: props.disabled, onClick: (event) => togglePassword(), "aria-label": passwordToggleLabel(), children: _jsx(Icon, { icon: isPasswordVisible ? faEyeSlash : faEye, size: iconSize() }) })) : null, props.iconsRight?.length ? (_jsx(_Fragment, { children: props.iconsRight?.map((action, index) => (_jsx("button", { type: "button", className: "umds-input__action-btn", disabled: props.disabled, onClick: (e) => {
|
|
75
141
|
e.stopPropagation();
|
|
76
142
|
action.onClick?.(e);
|
|
77
|
-
}, title: action.tooltip, "aria-label": action.label || action.tooltip, children: _jsx(Icon, { icon: action.icon, size: iconSize() }) }, index))) })) : null] })] }), props.errorMessage ? (_jsx(Text, { as: "span", variant: "caption", color: "negative", id: errorId(), children: _jsx(_Fragment, { children: props.errorMessage }) })) : null, props.helperText ? (_jsx(Text, { as: "span", variant: "caption", color: "secondary", id: helperId(), children: _jsx(_Fragment, { children: props.helperText }) })) : null] }));
|
|
143
|
+
}, title: action.tooltip, "aria-label": action.label || action.tooltip, children: _jsx(Icon, { icon: action.icon, size: iconSize() }) }, index))) })) : null] }), props.iconRight ? (_jsx("div", { "aria-hidden": "true", className: "umds-input__icon-right", children: _jsx(Icon, { icon: props.iconRight, size: iconSize() }) })) : null] }), props.errorMessage ? (_jsx(Text, { as: "span", variant: "caption", color: "negative", id: errorId(), children: _jsx(_Fragment, { children: props.errorMessage }) })) : null, props.helperText ? (_jsx(Text, { as: "span", variant: "caption", color: "secondary", id: helperId(), children: _jsx(_Fragment, { children: props.helperText }) })) : null] }));
|
|
78
144
|
}
|
|
79
145
|
export default Input;
|
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
cartão.
|
|
8
8
|
============================================ */
|
|
9
9
|
|
|
10
|
+
/* `position: relative` ancora os textos só para leitor de tela (absolutos) das
|
|
11
|
+
colunas dentro da área que rola; sem ele, o de uma coluna fora da tela sobe
|
|
12
|
+
até a página e cria rolagem horizontal nela. */
|
|
10
13
|
.umds-kanban {
|
|
14
|
+
position: relative;
|
|
11
15
|
display: flex;
|
|
12
16
|
align-items: stretch;
|
|
13
17
|
gap: var(--umds-primitive-spacing-xxxs);
|
|
@@ -90,6 +94,7 @@
|
|
|
90
94
|
.umds-kanban__indicator {
|
|
91
95
|
flex: 0 0 auto;
|
|
92
96
|
height: var(--umds-primitive-border-width-thin); /* espessura de linha: 2px */
|
|
97
|
+
/* stylelint-disable-next-line 1ds/espaco-da-escala -- compensação exata: 2px de linha + 8px de gap = 10px, devolvidos em -5px de cada lado */
|
|
93
98
|
margin: -5px 0; /* ver comentário acima */
|
|
94
99
|
border-radius: var(--umds-primitive-border-radius-pill);
|
|
95
100
|
background-color: var(--umds-semantic-color-primary-pure);
|
|
@@ -50,6 +50,37 @@ export interface KanbanCardMove {
|
|
|
50
50
|
toColumnId: string;
|
|
51
51
|
toIndex: number;
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Frases que o quadro anuncia na região `aria-live` durante o movimento. Todas
|
|
55
|
+
* opcionais: a que faltar fica no texto padrão em português. `position` monta
|
|
56
|
+
* a frase de posição que as outras recebem pronta no parâmetro `position`.
|
|
57
|
+
*/
|
|
58
|
+
export interface KanbanAnnouncements {
|
|
59
|
+
/** Posição do cartão. Padrão: "Coluna {coluna}, posição {n} de {total}." */
|
|
60
|
+
position?: (column: string, position: number, total: number) => string;
|
|
61
|
+
/** Cartão pego pelo teclado. Padrão: "Cartão {cartão} pego. {posição} Use as setas para mover, Espaço ou Enter para soltar, Esc para cancelar." */
|
|
62
|
+
grabbed?: (card: string, position: string) => string;
|
|
63
|
+
/** Cartão solto num lugar novo pelo teclado. Padrão: "Cartão {cartão} solto. {posição}" */
|
|
64
|
+
dropped?: (card: string, position: string) => string;
|
|
65
|
+
/** Cartão solto onde estava. Padrão: "Cartão {cartão} solto na posição original." */
|
|
66
|
+
droppedInPlace?: (card: string) => string;
|
|
67
|
+
/** Cartão arrastado com o ponteiro e solto. Padrão: "Cartão {cartão} movido. {posição}" */
|
|
68
|
+
moved?: (card: string, position: string) => string;
|
|
69
|
+
/** Movimento cancelado com Esc. Padrão: "Movimento cancelado. Cartão {cartão} voltou. {posição}" */
|
|
70
|
+
cancelled?: (card: string, position: string) => string;
|
|
71
|
+
/** Seta para cima no topo da coluna. Padrão: "Início da coluna." */
|
|
72
|
+
columnStart?: string;
|
|
73
|
+
/** Seta para baixo no fim da coluna. Padrão: "Fim da coluna." */
|
|
74
|
+
columnEnd?: string;
|
|
75
|
+
/** Seta para a esquerda na primeira coluna. Padrão: "Não há coluna à esquerda." */
|
|
76
|
+
noColumnLeft?: string;
|
|
77
|
+
/** Seta para a direita na última coluna. Padrão: "Não há coluna à direita." */
|
|
78
|
+
noColumnRight?: string;
|
|
79
|
+
/** Coluna de destino chegou ao limite de WIP. Padrão: "Limite de {n} cartões atingido." */
|
|
80
|
+
limitReached?: (limit: number) => string;
|
|
81
|
+
/** Coluna de destino passou do limite de WIP. Padrão: "Limite de {n} cartões excedido." */
|
|
82
|
+
limitExceeded?: (limit: number) => string;
|
|
83
|
+
}
|
|
53
84
|
/**
|
|
54
85
|
* Componente Kanban — quadro de colunas com cartões que se movem entre elas.
|
|
55
86
|
*
|
|
@@ -111,6 +142,16 @@ export interface KanbanProps {
|
|
|
111
142
|
columnHeadingLevel?: number;
|
|
112
143
|
className?: string;
|
|
113
144
|
id?: string;
|
|
145
|
+
/** Frases anunciadas ao leitor de tela durante o movimento (ver `KanbanAnnouncements`). Cada uma que faltar fica no padrão em português. Troque para traduzir. @default frases em português */
|
|
146
|
+
announcements?: KanbanAnnouncements;
|
|
147
|
+
/** Prefixo do responsável na descrição lida de cada cartão e no avatar (o nome vem depois de ": "). Troque para traduzir. @default 'Responsável' */
|
|
148
|
+
assigneeLabel?: string;
|
|
149
|
+
/** Prefixo das etiquetas na descrição lida de cada cartão (a lista vem depois de ": "). Troque para traduzir. @default 'Etiquetas' */
|
|
150
|
+
tagsLabel?: string;
|
|
151
|
+
/** Descrição do papel do cartão (aria-roledescription). Troque para traduzir. @default 'cartão arrastável' */
|
|
152
|
+
cardRoleDescription?: string;
|
|
153
|
+
/** Contagem por extenso de cada coluna, repassada ao `countLabel` do KanbanColumn. Recebe a quantidade e o limite de WIP (quando há). Troque para traduzir. @default (count, limit) => '4 de 3 cartões, limite excedido' | '1 cartão' | 'N cartões' */
|
|
154
|
+
columnCountLabel?: (count: number, limit?: number) => string;
|
|
114
155
|
}
|
|
115
156
|
import type { KanbanCardTag } from "./KanbanCard";
|
|
116
157
|
declare function Kanban(props: KanbanProps): import("react/jsx-runtime").JSX.Element;
|