@1doc/1ds-react 2.8.0 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1540 -0
- package/dist/components/AILabel/AILabel.js +1 -1
- package/dist/components/Accordion/Accordion.css +13 -0
- package/dist/components/Accordion/Accordion.d.ts +9 -2
- package/dist/components/Accordion/Accordion.js +1 -0
- package/dist/components/AppSubheader/AppSubheader.css +10 -1
- package/dist/components/AttachmentCard/AttachmentCard.css +26 -8
- package/dist/components/AttachmentCard/AttachmentCard.d.ts +22 -2
- package/dist/components/AttachmentCard/AttachmentCard.js +47 -3
- package/dist/components/Avatar/Avatar.css +7 -2
- package/dist/components/Avatar/AvatarGroup.d.ts +17 -0
- package/dist/components/Avatar/AvatarGroup.js +22 -8
- package/dist/components/Badge/Badge.css +67 -2
- package/dist/components/Badge/Badge.d.ts +23 -4
- package/dist/components/Badge/Badge.js +4 -0
- 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 +126 -0
- package/dist/components/Calendar/Calendar.js +320 -0
- package/dist/components/Chips/Chips.css +38 -0
- package/dist/components/Chips/Chips.d.ts +5 -2
- package/dist/components/Chips/Chips.js +2 -1
- package/dist/components/Coachmark/Coachmark.css +128 -0
- package/dist/components/Coachmark/Coachmark.d.ts +87 -0
- package/dist/components/Coachmark/Coachmark.js +362 -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 +140 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +73 -0
- package/dist/components/ColorPicker/ColorPicker.js +219 -0
- package/dist/components/Combobox/Combobox.css +8 -0
- package/dist/components/DataTable/DataTable.css +254 -0
- package/dist/components/DataTable/DataTable.d.ts +81 -5
- package/dist/components/DataTable/DataTable.js +335 -19
- package/dist/components/DatePicker/DatePicker.css +8 -0
- package/dist/components/DatePicker/DatePicker.js +10 -1
- package/dist/components/DescriptionList/DescriptionList.css +127 -0
- package/dist/components/DescriptionList/DescriptionList.d.ts +62 -0
- package/dist/components/DescriptionList/DescriptionList.js +52 -0
- package/dist/components/EmptyState/EmptyState.d.ts +4 -2
- package/dist/components/EmptyState/EmptyState.js +2 -2
- package/dist/components/FileInput/FileInput.css +16 -0
- package/dist/components/FileInput/FileInput.d.ts +4 -2
- package/dist/components/FileInput/FileInput.js +8 -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 +59 -0
- package/dist/components/Input/Input.d.ts +17 -1
- package/dist/components/Input/Input.js +67 -5
- package/dist/components/Kanban/Kanban.css +4 -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/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 +97 -0
- package/dist/components/List/ListItem.js +82 -0
- package/dist/components/Modal/Modal.css +80 -0
- package/dist/components/Modal/Modal.d.ts +33 -6
- package/dist/components/Modal/Modal.js +101 -6
- package/dist/components/MultiSelect/MultiSelect.css +8 -0
- package/dist/components/MultiSelect/MultiSelect.js +10 -1
- 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/PhoneInput/PhoneInput.css +8 -0
- package/dist/components/Popover/Popover.d.ts +7 -0
- package/dist/components/Popover/Popover.js +11 -1
- package/dist/components/RichTextEditor/RichTextEditor.css +250 -0
- package/dist/components/RichTextEditor/RichTextEditor.d.ts +97 -0
- package/dist/components/RichTextEditor/RichTextEditor.js +951 -0
- package/dist/components/SegmentedControl/SegmentedControl.css +24 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +2 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +10 -2
- package/dist/components/Select/Select.css +164 -0
- package/dist/components/Select/Select.d.ts +34 -0
- package/dist/components/Select/Select.js +258 -28
- 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 +138 -0
- package/dist/components/StatCard/StatCard.d.ts +26 -0
- package/dist/components/StatCard/StatCard.js +13 -1
- 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.js +2 -2
- package/dist/components/Textarea/Textarea.css +8 -0
- package/dist/components/TimePicker/TimePicker.css +8 -0
- package/dist/components/Toast/Toast.css +32 -0
- package/dist/components/Toast/Toast.d.ts +18 -0
- package/dist/components/Toast/Toast.js +14 -1
- package/dist/components/Toast/ToastStack.js +8 -1
- package/dist/components/Tooltip/Tooltip.css +25 -0
- package/dist/components/Tooltip/Tooltip.d.ts +11 -0
- package/dist/components/Tooltip/Tooltip.js +18 -3
- 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/AccordionTituloNeutro.test.d.ts +1 -0
- package/dist/teste/AccordionTituloNeutro.test.js +23 -0
- package/dist/teste/AppSubheaderRegiao.test.d.ts +1 -0
- package/dist/teste/AppSubheaderRegiao.test.js +13 -0
- package/dist/teste/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/AttachmentCardLista.test.d.ts +1 -0
- package/dist/teste/AttachmentCardLista.test.js +49 -0
- package/dist/teste/AttachmentCardSm.test.d.ts +1 -0
- package/dist/teste/AttachmentCardSm.test.js +26 -0
- package/dist/teste/AvatarGroupOverlap.test.d.ts +1 -0
- package/dist/teste/AvatarGroupOverlap.test.js +56 -0
- package/dist/teste/BadgeNeutroColado.test.d.ts +1 -0
- package/dist/teste/BadgeNeutroColado.test.js +11 -0
- package/dist/teste/BadgeTag.test.d.ts +1 -0
- package/dist/teste/BadgeTag.test.js +55 -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/CalendarCabecalho.test.d.ts +1 -0
- package/dist/teste/CalendarCabecalho.test.js +11 -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/CoachmarkSemVeu.test.d.ts +1 -0
- package/dist/teste/CoachmarkSemVeu.test.js +85 -0
- package/dist/teste/ColorPicker.test.d.ts +1 -0
- package/dist/teste/ColorPicker.test.js +132 -0
- package/dist/teste/ColorPickerXs.test.d.ts +1 -0
- package/dist/teste/ColorPickerXs.test.js +21 -0
- package/dist/teste/DataTableArvoreEVariantes.test.d.ts +1 -0
- package/dist/teste/DataTableArvoreEVariantes.test.js +190 -0
- package/dist/teste/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/DescriptionListCompacta.test.d.ts +1 -0
- package/dist/teste/DescriptionListCompacta.test.js +22 -0
- package/dist/teste/EmptyStateTituloRico.test.d.ts +1 -0
- package/dist/teste/EmptyStateTituloRico.test.js +23 -0
- package/dist/teste/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/InputAgrupado.test.d.ts +1 -0
- package/dist/teste/InputAgrupado.test.js +24 -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/ListItemTooltipStandalone.test.d.ts +1 -0
- package/dist/teste/ListItemTooltipStandalone.test.js +39 -0
- package/dist/teste/ModalVariantes.test.d.ts +1 -0
- package/dist/teste/ModalVariantes.test.js +151 -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/RichTextEditorAlinhaImagemTabela.test.d.ts +1 -0
- package/dist/teste/RichTextEditorAlinhaImagemTabela.test.js +212 -0
- package/dist/teste/RichTextEditorEstiloDeTexto.test.d.ts +1 -0
- package/dist/teste/RichTextEditorEstiloDeTexto.test.js +120 -0
- package/dist/teste/SegmentedControlContador.test.d.ts +1 -0
- package/dist/teste/SegmentedControlContador.test.js +39 -0
- package/dist/teste/SelectAbertoControladoEFlutuante.test.d.ts +1 -0
- package/dist/teste/SelectAbertoControladoEFlutuante.test.js +145 -0
- package/dist/teste/SelectFiltroCorETamanho.test.d.ts +1 -0
- package/dist/teste/SelectFiltroCorETamanho.test.js +77 -0
- package/dist/teste/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/StatCardSecundariaETom.test.d.ts +1 -0
- package/dist/teste/StatCardSecundariaETom.test.js +45 -0
- package/dist/teste/TabsContadorFechavel.test.d.ts +1 -0
- package/dist/teste/TabsContadorFechavel.test.js +79 -0
- package/dist/teste/ToastAcaoEDetalhes.test.d.ts +1 -0
- package/dist/teste/ToastAcaoEDetalhes.test.js +94 -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/html-seguro.d.ts +45 -0
- package/dist/utils/html-seguro.js +208 -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/dist/utils/toast.d.ts +10 -1
- package/dist/utils/toast.js +2 -1
- 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/AccordionTituloNeutro.test.tsx +25 -0
- package/src/teste/AppSubheaderRegiao.test.tsx +17 -0
- package/src/teste/AtributosRepassados.test.tsx +73 -0
- package/src/teste/AttachmentCardIA.test.tsx +126 -0
- package/src/teste/AttachmentCardLista.test.tsx +53 -0
- package/src/teste/AttachmentCardSm.test.tsx +29 -0
- package/src/teste/AvatarGroupOverlap.test.tsx +74 -0
- package/src/teste/BadgeNeutroColado.test.tsx +15 -0
- package/src/teste/BadgeTag.test.tsx +85 -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/CalendarCabecalho.test.tsx +11 -0
- package/src/teste/ChipsXs.test.tsx +41 -0
- package/src/teste/Coachmark.test.tsx +198 -0
- package/src/teste/CoachmarkSemVeu.test.tsx +101 -0
- package/src/teste/ColorPicker.test.tsx +153 -0
- package/src/teste/ColorPickerXs.test.tsx +22 -0
- package/src/teste/DataTableArvoreEVariantes.test.tsx +240 -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/DescriptionListCompacta.test.tsx +24 -0
- package/src/teste/EmptyStateTituloRico.test.tsx +34 -0
- package/src/teste/FileInputTrigger.test.tsx +89 -0
- package/src/teste/IconPicker.test.tsx +145 -0
- package/src/teste/InputAgrupado.test.tsx +26 -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/ListItemTooltipStandalone.test.tsx +64 -0
- package/src/teste/ModalVariantes.test.tsx +173 -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/RichTextEditorAlinhaImagemTabela.test.tsx +238 -0
- package/src/teste/RichTextEditorEstiloDeTexto.test.tsx +137 -0
- package/src/teste/SegmentedControlContador.test.tsx +43 -0
- package/src/teste/SelectAbertoControladoEFlutuante.test.tsx +180 -0
- package/src/teste/SelectFiltroCorETamanho.test.tsx +90 -0
- package/src/teste/SelectPlacementFiltro.test.tsx +110 -0
- package/src/teste/Stack.test.tsx +80 -0
- package/src/teste/StatCardRotuloTopo.test.tsx +44 -0
- package/src/teste/StatCardSecundariaETom.test.tsx +51 -0
- package/src/teste/TabsContadorFechavel.test.tsx +144 -0
- package/src/teste/ToastAcaoEDetalhes.test.tsx +109 -0
- package/src/teste/TooltipDark.test.tsx +51 -0
- package/src/utils/calendario.ts +78 -0
- package/src/utils/html-seguro.ts +197 -0
- package/src/utils/paleta-de-cores.ts +34 -0
- package/src/utils/texto.ts +5 -0
- package/src/utils/toast.ts +12 -2
package/src/index.ts
CHANGED
|
@@ -5,6 +5,8 @@ export * from "./utils/theme";
|
|
|
5
5
|
export * from "./utils/toast";
|
|
6
6
|
// Densidade global (modo touch ≥44px via data-density)
|
|
7
7
|
export * from "./utils/density";
|
|
8
|
+
// Paleta de cor categórica (primitivos) do ColorPicker
|
|
9
|
+
export * from "./utils/paleta-de-cores";
|
|
8
10
|
// FontAwesome
|
|
9
11
|
export { library } from "@fortawesome/fontawesome-svg-core";
|
|
10
12
|
|
|
@@ -12,6 +14,9 @@ export { library } from "@fortawesome/fontawesome-svg-core";
|
|
|
12
14
|
export { default as Accordion } from "./components/Accordion/Accordion";
|
|
13
15
|
export { default as AILabel } from "./components/AILabel/AILabel";
|
|
14
16
|
export { default as AIContent } from "./components/AIContent/AIContent";
|
|
17
|
+
export { default as Calendar } from "./components/Calendar/Calendar";
|
|
18
|
+
export { default as Coachmark } from "./components/Coachmark/Coachmark";
|
|
19
|
+
export { default as CodeBlock } from "./components/CodeBlock/CodeBlock";
|
|
15
20
|
export { default as ConfirmAIAction } from "./components/ConfirmAIAction/ConfirmAIAction";
|
|
16
21
|
export { default as Alert } from "./components/Alert/Alert";
|
|
17
22
|
export { default as AppHeader } from "./components/AppHeader/AppHeader";
|
|
@@ -33,11 +38,13 @@ export { default as Button } from "./components/Button/Button";
|
|
|
33
38
|
export { default as Card } from "./components/Card/Card";
|
|
34
39
|
export { default as Checkbox } from "./components/Checkbox/Checkbox";
|
|
35
40
|
export { default as Chips } from "./components/Chips/Chips";
|
|
41
|
+
export { default as ColorPicker } from "./components/ColorPicker/ColorPicker";
|
|
36
42
|
export { default as Combobox } from "./components/Combobox/Combobox";
|
|
37
43
|
export { default as ConfirmDialog } from "./components/ConfirmDialog/ConfirmDialog";
|
|
38
44
|
export { default as Container } from "./components/Container/Container";
|
|
39
45
|
export { default as DataTable } from "./components/DataTable/DataTable";
|
|
40
46
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
47
|
+
export { default as DescriptionList } from "./components/DescriptionList/DescriptionList";
|
|
41
48
|
export { default as Divider } from "./components/Divider/Divider";
|
|
42
49
|
export { default as DonutChart } from "./components/Chart/DonutChart";
|
|
43
50
|
export { default as Drawer } from "./components/Drawer/Drawer";
|
|
@@ -46,15 +53,21 @@ export { default as EmptyState } from "./components/EmptyState/EmptyState";
|
|
|
46
53
|
export { default as FileInput } from "./components/FileInput/FileInput";
|
|
47
54
|
export { default as Grid } from "./components/Grid/Grid";
|
|
48
55
|
export { default as Icon } from "./components/Icon/Icon";
|
|
56
|
+
export { default as IconPicker } from "./components/IconPicker/IconPicker";
|
|
49
57
|
export { default as Input } from "./components/Input/Input";
|
|
50
58
|
export { default as Kanban } from "./components/Kanban/Kanban";
|
|
51
59
|
export { default as KanbanCard } from "./components/Kanban/KanbanCard";
|
|
52
60
|
export { default as KanbanColumn } from "./components/Kanban/KanbanColumn";
|
|
61
|
+
export { default as Kbd } from "./components/Kbd/Kbd";
|
|
53
62
|
export { default as Link } from "./components/Link/Link";
|
|
54
63
|
export { default as LineChart } from "./components/Chart/LineChart";
|
|
64
|
+
export { default as List } from "./components/List/List";
|
|
65
|
+
export { default as ListItem } from "./components/List/ListItem";
|
|
55
66
|
export { default as Logo } from "./components/Logo/Logo";
|
|
56
67
|
export { default as Modal } from "./components/Modal/Modal";
|
|
57
68
|
export { default as MultiSelect } from "./components/MultiSelect/MultiSelect";
|
|
69
|
+
export { default as OrgChart } from "./components/OrgChart/OrgChart";
|
|
70
|
+
export { default as OtpInput } from "./components/OtpInput/OtpInput";
|
|
58
71
|
export { default as PageHeader } from "./components/PageHeader/PageHeader";
|
|
59
72
|
export { default as Pagination } from "./components/Pagination/Pagination";
|
|
60
73
|
export { default as PhoneInput } from "./components/PhoneInput/PhoneInput";
|
|
@@ -62,6 +75,7 @@ export { default as Podium } from "./components/Podium/Podium";
|
|
|
62
75
|
export { default as ProgressBar } from "./components/ProgressBar/ProgressBar";
|
|
63
76
|
export { default as Radio } from "./components/Radio/Radio";
|
|
64
77
|
export { default as RadioGroup } from "./components/Radio/RadioGroup";
|
|
78
|
+
export { default as RichTextEditor } from "./components/RichTextEditor/RichTextEditor";
|
|
65
79
|
export { default as SegmentedControl } from "./components/SegmentedControl/SegmentedControl";
|
|
66
80
|
export { default as Select } from "./components/Select/Select";
|
|
67
81
|
export { default as SidePanel } from "./components/SidePanel/SidePanel";
|
|
@@ -94,6 +108,9 @@ export { default as Tree } from "./components/Tree/Tree";
|
|
|
94
108
|
export type * from "./components/Accordion/Accordion";
|
|
95
109
|
export type * from "./components/AILabel/AILabel";
|
|
96
110
|
export type * from "./components/AIContent/AIContent";
|
|
111
|
+
export type * from "./components/Calendar/Calendar";
|
|
112
|
+
export type * from "./components/Coachmark/Coachmark";
|
|
113
|
+
export type * from "./components/CodeBlock/CodeBlock";
|
|
97
114
|
export type * from "./components/ConfirmAIAction/ConfirmAIAction";
|
|
98
115
|
export type * from "./components/Alert/Alert";
|
|
99
116
|
export type * from "./components/AppHeader/AppHeader";
|
|
@@ -115,11 +132,13 @@ export type * from "./components/Button/Button";
|
|
|
115
132
|
export type * from "./components/Card/Card";
|
|
116
133
|
export type * from "./components/Checkbox/Checkbox";
|
|
117
134
|
export type * from "./components/Chips/Chips";
|
|
135
|
+
export type * from "./components/ColorPicker/ColorPicker";
|
|
118
136
|
export type * from "./components/Combobox/Combobox";
|
|
119
137
|
export type * from "./components/ConfirmDialog/ConfirmDialog";
|
|
120
138
|
export type * from "./components/Container/Container";
|
|
121
139
|
export type * from "./components/DataTable/DataTable";
|
|
122
140
|
export type * from "./components/DatePicker/DatePicker";
|
|
141
|
+
export type * from "./components/DescriptionList/DescriptionList";
|
|
123
142
|
export type * from "./components/Divider/Divider";
|
|
124
143
|
export type * from "./components/Chart/DonutChart";
|
|
125
144
|
export type * from "./components/Drawer/Drawer";
|
|
@@ -128,15 +147,21 @@ export type * from "./components/EmptyState/EmptyState";
|
|
|
128
147
|
export type * from "./components/FileInput/FileInput";
|
|
129
148
|
export type * from "./components/Grid/Grid";
|
|
130
149
|
export type * from "./components/Icon/Icon";
|
|
150
|
+
export type * from "./components/IconPicker/IconPicker";
|
|
131
151
|
export type * from "./components/Input/Input";
|
|
132
152
|
export type * from "./components/Kanban/Kanban";
|
|
133
153
|
export type * from "./components/Kanban/KanbanCard";
|
|
134
154
|
export type * from "./components/Kanban/KanbanColumn";
|
|
155
|
+
export type * from "./components/Kbd/Kbd";
|
|
135
156
|
export type * from "./components/Link/Link";
|
|
136
157
|
export type * from "./components/Chart/LineChart";
|
|
158
|
+
export type * from "./components/List/List";
|
|
159
|
+
export type * from "./components/List/ListItem";
|
|
137
160
|
export type * from "./components/Logo/Logo";
|
|
138
161
|
export type * from "./components/Modal/Modal";
|
|
139
162
|
export type * from "./components/MultiSelect/MultiSelect";
|
|
163
|
+
export type * from "./components/OrgChart/OrgChart";
|
|
164
|
+
export type * from "./components/OtpInput/OtpInput";
|
|
140
165
|
export type * from "./components/PageHeader/PageHeader";
|
|
141
166
|
export type * from "./components/Pagination/Pagination";
|
|
142
167
|
export type * from "./components/PhoneInput/PhoneInput";
|
|
@@ -144,6 +169,7 @@ export type * from "./components/Podium/Podium";
|
|
|
144
169
|
export type * from "./components/ProgressBar/ProgressBar";
|
|
145
170
|
export type * from "./components/Radio/Radio";
|
|
146
171
|
export type * from "./components/Radio/RadioGroup";
|
|
172
|
+
export type * from "./components/RichTextEditor/RichTextEditor";
|
|
147
173
|
export type * from "./components/SegmentedControl/SegmentedControl";
|
|
148
174
|
export type * from "./components/Select/Select";
|
|
149
175
|
export type * from "./components/SidePanel/SidePanel";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import userEvent from "@testing-library/user-event";
|
|
4
|
+
import AILabel from "../components/AILabel/AILabel";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `defaultOpen` era declarado e documentado, mas nunca lido: o painel nascia
|
|
8
|
+
* fechado de qualquer jeito, e a story "Em inglês" usava `open` (controlado)
|
|
9
|
+
* para contornar — o que travava o clique.
|
|
10
|
+
*/
|
|
11
|
+
describe("AILabel · defaultOpen", () => {
|
|
12
|
+
it("abre o painel na montagem", () => {
|
|
13
|
+
render(<AILabel explanation="Resumo dos despachos." defaultOpen />);
|
|
14
|
+
expect(screen.getByRole("region")).toHaveTextContent("Resumo dos despachos.");
|
|
15
|
+
expect(screen.getByRole("button", { name: "Conteúdo gerado por IA" })).toHaveAttribute(
|
|
16
|
+
"aria-expanded",
|
|
17
|
+
"true",
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("continua não-controlado: o clique fecha e avisa", async () => {
|
|
22
|
+
const usuario = userEvent.setup();
|
|
23
|
+
const onOpenChange = vi.fn();
|
|
24
|
+
render(
|
|
25
|
+
<AILabel explanation="Resumo." defaultOpen onOpenChange={onOpenChange} />,
|
|
26
|
+
);
|
|
27
|
+
await usuario.click(screen.getByRole("button", { name: "Conteúdo gerado por IA" }));
|
|
28
|
+
expect(screen.queryByRole("region")).not.toBeInTheDocument();
|
|
29
|
+
expect(onOpenChange).toHaveBeenCalledWith(false);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("sem defaultOpen nasce fechado", () => {
|
|
33
|
+
render(<AILabel explanation="Resumo." />);
|
|
34
|
+
expect(screen.queryByRole("region")).not.toBeInTheDocument();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("`open` controlado vence o defaultOpen", () => {
|
|
38
|
+
render(<AILabel explanation="Resumo." defaultOpen open={false} />);
|
|
39
|
+
expect(screen.queryByRole("region")).not.toBeInTheDocument();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import Accordion from "../components/Accordion/Accordion";
|
|
4
|
+
|
|
5
|
+
describe("Accordion · conteúdo livre por item (React)", () => {
|
|
6
|
+
it("o content do item aceita qualquer nó (campos, botões)", () => {
|
|
7
|
+
render(
|
|
8
|
+
<Accordion
|
|
9
|
+
items={[
|
|
10
|
+
{
|
|
11
|
+
id: "s1",
|
|
12
|
+
title: "Seção 01",
|
|
13
|
+
defaultOpen: true,
|
|
14
|
+
content: (
|
|
15
|
+
<label>
|
|
16
|
+
Nome <input defaultValue="Maria" />
|
|
17
|
+
</label>
|
|
18
|
+
),
|
|
19
|
+
},
|
|
20
|
+
{ id: "s2", title: "Seção 02", content: <button type="button">Anexar arquivo</button> },
|
|
21
|
+
]}
|
|
22
|
+
/>,
|
|
23
|
+
);
|
|
24
|
+
expect(screen.getByDisplayValue("Maria")).toBeInTheDocument();
|
|
25
|
+
expect(screen.getByRole("button", { name: "Anexar arquivo", hidden: true })).toBeInTheDocument();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("o título do item é o botão do painel, sem cor própria (herda a neutra do gatilho)", () => {
|
|
29
|
+
const { container } = render(<Accordion items={[{ id: "a", title: "Seção", content: "x" }]} />);
|
|
30
|
+
const titulo = container.querySelector(".umds-accordion__title") as HTMLElement;
|
|
31
|
+
expect(titulo.closest("button")).toHaveClass("umds-accordion__trigger");
|
|
32
|
+
expect(titulo.getAttribute("style")).toBeNull();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("o texto simples continua funcionando", () => {
|
|
36
|
+
render(<Accordion items={[{ id: "a", title: "Seção", content: "Texto do painel", defaultOpen: true }]} />);
|
|
37
|
+
expect(screen.getByText("Texto do painel")).toBeInTheDocument();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { render } from "@testing-library/react";
|
|
3
|
+
import Accordion from "../components/Accordion/Accordion";
|
|
4
|
+
|
|
5
|
+
const ITENS = [
|
|
6
|
+
{ id: "a", title: "Prazos", content: "Dez dias úteis." },
|
|
7
|
+
{ id: "b", title: "Anexos", content: "Até 10 MB." },
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
describe("Accordion · titleVariant", () => {
|
|
11
|
+
it("neutral liga a classe do título neutro; o padrão e default não", () => {
|
|
12
|
+
const { container, rerender } = render(<Accordion items={ITENS} titleVariant="neutral" />);
|
|
13
|
+
const raiz = () => container.firstElementChild as HTMLElement;
|
|
14
|
+
expect(raiz()).toHaveClass("umds-accordion--title-neutral");
|
|
15
|
+
rerender(<Accordion items={ITENS} titleVariant="default" />);
|
|
16
|
+
expect(raiz()).not.toHaveClass("umds-accordion--title-neutral");
|
|
17
|
+
rerender(<Accordion items={ITENS} />);
|
|
18
|
+
expect(raiz()).not.toHaveClass("umds-accordion--title-neutral");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("combina com a variant do accordion", () => {
|
|
22
|
+
const { container } = render(<Accordion items={ITENS} variant="separated" titleVariant="neutral" />);
|
|
23
|
+
expect(container.firstElementChild).toHaveClass("umds-accordion--separated", "umds-accordion--title-neutral");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { render } from "@testing-library/react";
|
|
3
|
+
import AppSubheader from "../components/AppSubheader/AppSubheader";
|
|
4
|
+
import Breadcrumb from "../components/Breadcrumb/Breadcrumb";
|
|
5
|
+
|
|
6
|
+
/** O jsdom não tem layout: a geometria real é conferida pela story "Só a página atual" (play, no navegador); a regra de CSS, pelo teste do Vue. */
|
|
7
|
+
describe("AppSubheader · região do contexto", () => {
|
|
8
|
+
it("a trilha só com a página atual não tem nada focável dentro da região", () => {
|
|
9
|
+
const { container } = render(
|
|
10
|
+
<AppSubheader>
|
|
11
|
+
<Breadcrumb items={[{ label: "Painel" }]} />
|
|
12
|
+
</AppSubheader>,
|
|
13
|
+
);
|
|
14
|
+
const contexto = container.querySelector(".umds-app-subheader__contexto") as HTMLElement;
|
|
15
|
+
expect(contexto.querySelector("a, button, [tabindex]")).toBeNull();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { render } from "@testing-library/react";
|
|
3
|
+
import Text from "../components/Text/Text";
|
|
4
|
+
import Grid from "../components/Grid/Grid";
|
|
5
|
+
import Logo from "../components/Logo/Logo";
|
|
6
|
+
import Button from "../components/Button/Button";
|
|
7
|
+
import DataTable from "../components/DataTable/DataTable";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Paridade com o Vue: no Vue gerado, Text, Grid e Logo descartavam
|
|
11
|
+
* `title`, `style` e `aria-*`, o Button escrevia `autofocus="false"` e o
|
|
12
|
+
* DataTable a classe `--selected.value`. O React nunca teve o defeito; o teste
|
|
13
|
+
* garante que a correção do Vue não o introduza aqui (mesma fonte Mitosis).
|
|
14
|
+
*/
|
|
15
|
+
describe("atributos repassados ao elemento raiz", () => {
|
|
16
|
+
it("Text repassa title, style e aria-*", () => {
|
|
17
|
+
const { container } = render(
|
|
18
|
+
<Text title="Dica" style={{ marginTop: 4 }} aria-live="polite" data-x="1">
|
|
19
|
+
Olá
|
|
20
|
+
</Text>,
|
|
21
|
+
);
|
|
22
|
+
const el = container.firstElementChild as HTMLElement;
|
|
23
|
+
expect(el.getAttribute("title")).toBe("Dica");
|
|
24
|
+
expect(el.style.marginTop).toBe("4px");
|
|
25
|
+
expect(el.getAttribute("aria-live")).toBe("polite");
|
|
26
|
+
expect(el.getAttribute("data-x")).toBe("1");
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("Grid repassa title, style e aria-*", () => {
|
|
30
|
+
const { container } = render(
|
|
31
|
+
<Grid container spacing="xxxs" title="Dica" style={{ marginTop: 4 }} aria-label="Área">
|
|
32
|
+
x
|
|
33
|
+
</Grid>,
|
|
34
|
+
);
|
|
35
|
+
const el = container.firstElementChild as HTMLElement;
|
|
36
|
+
expect(el.getAttribute("title")).toBe("Dica");
|
|
37
|
+
expect(el.style.marginTop).toBe("4px");
|
|
38
|
+
expect(el.getAttribute("aria-label")).toBe("Área");
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("Logo repassa title, style e aria-*", () => {
|
|
42
|
+
const { container } = render(
|
|
43
|
+
<Logo title="Dica" style={{ width: 80 }} aria-hidden="true" />,
|
|
44
|
+
);
|
|
45
|
+
const el = container.firstElementChild as HTMLElement;
|
|
46
|
+
expect(el.getAttribute("title")).toBe("Dica");
|
|
47
|
+
expect(el.style.width).toBe("80px");
|
|
48
|
+
expect(el.getAttribute("aria-hidden")).toBe("true");
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe("Button · autoFocus", () => {
|
|
53
|
+
it("não escreve autofocus quando falso ou ausente", () => {
|
|
54
|
+
const { container } = render(<Button>Salvar</Button>);
|
|
55
|
+
expect(container.querySelector("[autofocus]")).toBeNull();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe("DataTable · linha selecionada", () => {
|
|
60
|
+
it("a classe --selected vai limpa, só na linha selecionada", () => {
|
|
61
|
+
const { container } = render(
|
|
62
|
+
<DataTable
|
|
63
|
+
columns={[{ key: "nome", label: "Nome" }]}
|
|
64
|
+
data={[{ nome: "Cris Lima" }, { nome: "Ana Paula" }]}
|
|
65
|
+
selectable
|
|
66
|
+
selectedRows={[0]}
|
|
67
|
+
/>,
|
|
68
|
+
);
|
|
69
|
+
const marcadas = container.querySelectorAll(".umds-datatable__row--selected");
|
|
70
|
+
expect(marcadas).toHaveLength(1);
|
|
71
|
+
expect(container.innerHTML).not.toContain(".value");
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { beforeAll, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { render, screen, waitFor } from "@testing-library/react";
|
|
3
|
+
import userEvent from "@testing-library/user-event";
|
|
4
|
+
import AttachmentCard from "../components/AttachmentCard/AttachmentCard";
|
|
5
|
+
|
|
6
|
+
beforeAll(() => {
|
|
7
|
+
if (!(globalThis as any).ResizeObserver) {
|
|
8
|
+
(globalThis as any).ResizeObserver = class {
|
|
9
|
+
observe() {}
|
|
10
|
+
unobserve() {}
|
|
11
|
+
disconnect() {}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
function cartaoDeIA(extra: Record<string, any> = {}) {
|
|
17
|
+
const aoAplicar = vi.fn();
|
|
18
|
+
const ui = (
|
|
19
|
+
<AttachmentCard
|
|
20
|
+
fileName="protocolo.pdf"
|
|
21
|
+
documentType="Protocolo"
|
|
22
|
+
status="ai"
|
|
23
|
+
statusLabel="Recursos IA"
|
|
24
|
+
onOpen={() => {}}
|
|
25
|
+
panel={
|
|
26
|
+
<div>
|
|
27
|
+
<p>A IA sugere um assunto.</p>
|
|
28
|
+
<button type="button" onClick={aoAplicar}>
|
|
29
|
+
Aplicar sugestão
|
|
30
|
+
</button>
|
|
31
|
+
</div>
|
|
32
|
+
}
|
|
33
|
+
{...extra}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
return { aoAplicar, ...render(ui) };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
describe("AttachmentCard · status ai", () => {
|
|
40
|
+
it("escreve a classe do selo de IA e usa a varinha por padrão", () => {
|
|
41
|
+
const { container } = render(<AttachmentCard fileName="x.pdf" status="ai" statusLabel="Recursos IA" />);
|
|
42
|
+
const selo = container.querySelector(".umds-attachment-card__status") as HTMLElement;
|
|
43
|
+
expect(selo).toHaveClass("umds-attachment-card__status--ai");
|
|
44
|
+
expect(selo.querySelector("svg")).not.toBeNull();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("só o selo de IA ganha ícone por padrão", () => {
|
|
48
|
+
const { container } = render(
|
|
49
|
+
<AttachmentCard fileName="x.pdf" status="positive" statusLabel="Ok" />,
|
|
50
|
+
);
|
|
51
|
+
expect(container.querySelector(".umds-attachment-card__status svg")).toBeNull();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe("AttachmentCard · slot panel", () => {
|
|
56
|
+
it("o painel livre substitui o resultado da conferência, e o selo vira botão sem statusDetails", async () => {
|
|
57
|
+
const usuario = userEvent.setup();
|
|
58
|
+
cartaoDeIA();
|
|
59
|
+
const selo = screen.getByRole("button", { name: /^Recursos IA/ });
|
|
60
|
+
expect(selo).toHaveAttribute("aria-haspopup", "dialog");
|
|
61
|
+
await usuario.click(selo);
|
|
62
|
+
const painel = await screen.findByRole("dialog");
|
|
63
|
+
expect(painel).toHaveTextContent("A IA sugere um assunto.");
|
|
64
|
+
expect(screen.getByRole("button", { name: "Aplicar sugestão" })).toBeInTheDocument();
|
|
65
|
+
// sem título interno: o painel é nomeado pelo selo
|
|
66
|
+
expect(painel).not.toHaveAttribute("aria-labelledby");
|
|
67
|
+
expect(painel).toHaveAccessibleName(/Recursos IA/);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("sem panel nem statusDetails o selo não é botão", () => {
|
|
71
|
+
render(<AttachmentCard fileName="x.pdf" status="ai" statusLabel="Recursos IA" />);
|
|
72
|
+
expect(screen.queryByRole("button")).toBeNull();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("panelWidth escreve a largura do painel; sem ela não há style", async () => {
|
|
76
|
+
const usuario = userEvent.setup();
|
|
77
|
+
cartaoDeIA({ panelWidth: 280 });
|
|
78
|
+
await usuario.click(screen.getByRole("button", { name: /^Recursos IA/ }));
|
|
79
|
+
expect((await screen.findByRole("dialog")).style.width).toBe("280px");
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("sem panelWidth o painel não leva style", async () => {
|
|
83
|
+
const usuario = userEvent.setup();
|
|
84
|
+
cartaoDeIA();
|
|
85
|
+
await usuario.click(screen.getByRole("button", { name: /^Recursos IA/ }));
|
|
86
|
+
expect((await screen.findByRole("dialog")).getAttribute("style")).toBeNull();
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
describe("AttachmentCard · closePanelOnAction", () => {
|
|
91
|
+
it("acionar um botão do painel fecha, devolve o foco ao selo e a ação chega ao app", async () => {
|
|
92
|
+
const usuario = userEvent.setup();
|
|
93
|
+
const { aoAplicar } = cartaoDeIA({ closePanelOnAction: true });
|
|
94
|
+
const selo = screen.getByRole("button", { name: /^Recursos IA/ });
|
|
95
|
+
await usuario.click(selo);
|
|
96
|
+
await usuario.click(await screen.findByRole("button", { name: "Aplicar sugestão" }));
|
|
97
|
+
expect(aoAplicar).toHaveBeenCalledTimes(1);
|
|
98
|
+
await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
|
|
99
|
+
expect(selo).toHaveFocus();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("sem a prop o painel continua aberto depois da ação", async () => {
|
|
103
|
+
const usuario = userEvent.setup();
|
|
104
|
+
const { aoAplicar } = cartaoDeIA();
|
|
105
|
+
await usuario.click(screen.getByRole("button", { name: /^Recursos IA/ }));
|
|
106
|
+
await usuario.click(await screen.findByRole("button", { name: "Aplicar sugestão" }));
|
|
107
|
+
expect(aoAplicar).toHaveBeenCalledTimes(1);
|
|
108
|
+
expect(screen.getByRole("dialog")).toBeInTheDocument();
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("o botão de copiar um campo não fecha o painel", async () => {
|
|
112
|
+
const usuario = userEvent.setup();
|
|
113
|
+
render(
|
|
114
|
+
<AttachmentCard
|
|
115
|
+
fileName="cpf.pdf"
|
|
116
|
+
status="positive"
|
|
117
|
+
statusLabel="Pré-aprovado"
|
|
118
|
+
closePanelOnAction
|
|
119
|
+
statusDetails={{ fields: [{ label: "CPF", value: "384.221.760-05", copyable: true }] }}
|
|
120
|
+
/>,
|
|
121
|
+
);
|
|
122
|
+
await usuario.click(screen.getByRole("button", { name: /^Pré-aprovado/ }));
|
|
123
|
+
await usuario.click(await screen.findByRole("button", { name: "Copiar CPF" }));
|
|
124
|
+
expect(screen.getByRole("dialog")).toBeInTheDocument();
|
|
125
|
+
});
|
|
126
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import userEvent from "@testing-library/user-event";
|
|
4
|
+
import AttachmentCard from "../components/AttachmentCard/AttachmentCard";
|
|
5
|
+
|
|
6
|
+
const DETALHES = {
|
|
7
|
+
description: "Documento legível.",
|
|
8
|
+
fields: [
|
|
9
|
+
{ label: "Nome completo", value: "Marcos Vinícius Tavares", copyable: true },
|
|
10
|
+
{ label: "CPF", value: "123.456.789-09" },
|
|
11
|
+
],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
async function abrirPainel() {
|
|
15
|
+
const usuario = userEvent.setup();
|
|
16
|
+
render(<AttachmentCard fileName="cnh.pdf" documentType="CNH" status="positive" statusLabel="Pré-aprovado" statusDetails={DETALHES} />);
|
|
17
|
+
await usuario.click(screen.getByRole("button", { name: /Pré-aprovado/ }));
|
|
18
|
+
return usuario;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
describe("AttachmentCard · o <dl> do painel é válido (axe definition-list)", () => {
|
|
22
|
+
it("o dl só tem div filhos, e cada div só tem dt e dd, nessa ordem", async () => {
|
|
23
|
+
await abrirPainel();
|
|
24
|
+
const dl = document.querySelector(".umds-attachment-card__campos") as HTMLElement;
|
|
25
|
+
expect(dl.tagName).toBe("DL");
|
|
26
|
+
const grupos = [...dl.children];
|
|
27
|
+
expect(grupos).toHaveLength(2);
|
|
28
|
+
for (const grupo of grupos) {
|
|
29
|
+
expect(grupo.tagName).toBe("DIV");
|
|
30
|
+
expect([...grupo.children].map((f) => f.tagName)).toEqual(["DT", "DD"]);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("o botão de copiar mora dentro do dd, ao lado do valor, e continua com nome", async () => {
|
|
35
|
+
await abrirPainel();
|
|
36
|
+
const dd = document.querySelector(".umds-attachment-card__campo-valor") as HTMLElement;
|
|
37
|
+
expect(dd.tagName).toBe("DD");
|
|
38
|
+
expect(dd.querySelector(".umds-attachment-card__campo-valor-texto")).toHaveTextContent("Marcos Vinícius Tavares");
|
|
39
|
+
const botao = dd.querySelector("button") as HTMLElement;
|
|
40
|
+
expect(botao).toHaveAttribute("aria-label", "Copiar Nome completo");
|
|
41
|
+
// nenhum botão solto direto num div do dl
|
|
42
|
+
for (const grupo of document.querySelectorAll(".umds-attachment-card__campo")) {
|
|
43
|
+
expect(grupo.querySelector(":scope > button")).toBeNull();
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("o campo sem copyable não tem botão e o valor segue no dd", async () => {
|
|
48
|
+
await abrirPainel();
|
|
49
|
+
const campos = document.querySelectorAll(".umds-attachment-card__campo");
|
|
50
|
+
expect(campos[1].querySelector("button")).toBeNull();
|
|
51
|
+
expect(campos[1].querySelector("dd")).toHaveTextContent("123.456.789-09");
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { render } from "@testing-library/react";
|
|
3
|
+
import AttachmentCard from "../components/AttachmentCard/AttachmentCard";
|
|
4
|
+
|
|
5
|
+
const tamanho = (el: Element | null) => (el as HTMLElement).style.width;
|
|
6
|
+
|
|
7
|
+
describe("AttachmentCard · size", () => {
|
|
8
|
+
it("md (padrão): ícone do preview de 48px e o do rodapé no sm do Icon", () => {
|
|
9
|
+
const { container } = render(<AttachmentCard fileName="Protocolo 104-2026.pdf" />);
|
|
10
|
+
expect(container.firstElementChild).not.toHaveClass("umds-attachment-card--sm");
|
|
11
|
+
expect(tamanho(container.querySelector(".umds-attachment-card__preview .umds-icon"))).toBe("48px");
|
|
12
|
+
const rodape = container.querySelector(".umds-attachment-card__rodape-icone .umds-icon") as HTMLElement;
|
|
13
|
+
expect(rodape).toHaveClass("umds-icon--sm");
|
|
14
|
+
expect(rodape.style.width).toBe("");
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("sm: ícone do preview de 40px e o do rodapé de 12px", () => {
|
|
18
|
+
const { container } = render(<AttachmentCard fileName="Protocolo 104-2026.pdf" size="sm" />);
|
|
19
|
+
expect(container.firstElementChild).toHaveClass("umds-attachment-card--sm");
|
|
20
|
+
expect(tamanho(container.querySelector(".umds-attachment-card__preview .umds-icon"))).toBe("40px");
|
|
21
|
+
expect(tamanho(container.querySelector(".umds-attachment-card__rodape-icone .umds-icon"))).toBe("12px");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("o ícone central escolhido continua valendo no sm", () => {
|
|
25
|
+
const { container } = render(<AttachmentCard fileName="a.pdf" size="sm" documentType="CNH" status="positive" statusLabel="Pré-aprovado" />);
|
|
26
|
+
expect(container.querySelector(".umds-attachment-card__tipo-texto")).toHaveTextContent("CNH");
|
|
27
|
+
expect(container.querySelector(".umds-attachment-card__status-texto")).toHaveTextContent("Pré-aprovado");
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import AvatarGroup from "../components/Avatar/AvatarGroup";
|
|
4
|
+
|
|
5
|
+
const PESSOAS = [
|
|
6
|
+
{ name: "Ana Souza" },
|
|
7
|
+
{ name: "Bruno Lima" },
|
|
8
|
+
{ name: "Carla Dias" },
|
|
9
|
+
{ name: "Diego Ferraz" },
|
|
10
|
+
{ name: "Eduarda Neves" },
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
const grupo = (c: HTMLElement) => c.firstElementChild as HTMLElement;
|
|
14
|
+
|
|
15
|
+
describe("AvatarGroup · overflowCount", () => {
|
|
16
|
+
it("sem a prop, o +N é o que passou de max (como antes)", () => {
|
|
17
|
+
render(<AvatarGroup avatars={PESSOAS} max={3} />);
|
|
18
|
+
expect(screen.getByText("+2")).toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("overflowCount vira o +N sem itens-fantasma", () => {
|
|
22
|
+
render(<AvatarGroup avatars={PESSOAS.slice(0, 3)} max={3} overflowCount={12} />);
|
|
23
|
+
expect(screen.getByText("+12")).toBeInTheDocument();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("soma com o que passou de max dentro de avatars", () => {
|
|
27
|
+
render(<AvatarGroup avatars={PESSOAS} max={3} overflowCount={10} />);
|
|
28
|
+
expect(screen.getByText("+12")).toBeInTheDocument();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("o rótulo traduzido recebe o total escondido", () => {
|
|
32
|
+
render(
|
|
33
|
+
<AvatarGroup
|
|
34
|
+
avatars={PESSOAS.slice(0, 2)}
|
|
35
|
+
max={2}
|
|
36
|
+
overflowCount={7}
|
|
37
|
+
overflowTitle={(n) => n + " others"}
|
|
38
|
+
overflowAriaLabel={(n) => n + " more avatars"}
|
|
39
|
+
/>,
|
|
40
|
+
);
|
|
41
|
+
expect(screen.getByTitle("7 others")).toBeInTheDocument();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("sem excedente nenhum, não há +N", () => {
|
|
45
|
+
render(<AvatarGroup avatars={PESSOAS.slice(0, 2)} max={4} />);
|
|
46
|
+
expect(screen.queryByText(/^\+/)).toBeNull();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("overflowCount 0 não cria +0", () => {
|
|
50
|
+
render(<AvatarGroup avatars={PESSOAS.slice(0, 2)} max={4} overflowCount={0} />);
|
|
51
|
+
expect(screen.queryByText(/^\+/)).toBeNull();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe("AvatarGroup · overlap e ring", () => {
|
|
56
|
+
it("escrevem as variáveis do grupo em px", () => {
|
|
57
|
+
const { container } = render(<AvatarGroup avatars={PESSOAS} overlap={6} ring={1} />);
|
|
58
|
+
const el = grupo(container);
|
|
59
|
+
expect(el.style.getPropertyValue("--umds-avatar-group-overlap")).toBe("6px");
|
|
60
|
+
expect(el.style.getPropertyValue("--umds-avatar-group-ring")).toBe("1px");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("só overlap não mexe no anel", () => {
|
|
64
|
+
const { container } = render(<AvatarGroup avatars={PESSOAS} overlap={4} />);
|
|
65
|
+
const el = grupo(container);
|
|
66
|
+
expect(el.style.getPropertyValue("--umds-avatar-group-overlap")).toBe("4px");
|
|
67
|
+
expect(el.style.getPropertyValue("--umds-avatar-group-ring")).toBe("");
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("sem as props, nenhum style: valem os padrões do CSS", () => {
|
|
71
|
+
const { container } = render(<AvatarGroup avatars={PESSOAS} />);
|
|
72
|
+
expect(grupo(container).getAttribute("style")).toBeNull();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { render } from "@testing-library/react";
|
|
3
|
+
import Badge from "../components/Badge/Badge";
|
|
4
|
+
|
|
5
|
+
/** A cascata de CSS de arquivo não existe no jsdom: a regra é conferida na fonte pelo teste do Vue; aqui, as classes no DOM. */
|
|
6
|
+
describe("Badge attached neutral", () => {
|
|
7
|
+
it("o neutro colado e sólido leva as três classes que a regra de CSS escolhe", () => {
|
|
8
|
+
const { container } = render(
|
|
9
|
+
<Badge attached variant="neutral" appearance="solid">
|
|
10
|
+
Tarefa manual
|
|
11
|
+
</Badge>,
|
|
12
|
+
);
|
|
13
|
+
expect(container.firstElementChild).toHaveClass("umds-badge--attached", "umds-badge--neutral", "umds-badge--solid");
|
|
14
|
+
});
|
|
15
|
+
});
|