@1doc/1ds-react 2.8.0 → 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.
Files changed (213) hide show
  1. package/CHANGELOG.md +1106 -0
  2. package/dist/components/AILabel/AILabel.js +1 -1
  3. package/dist/components/Accordion/Accordion.d.ts +6 -2
  4. package/dist/components/AttachmentCard/AttachmentCard.css +16 -0
  5. package/dist/components/AttachmentCard/AttachmentCard.d.ts +19 -2
  6. package/dist/components/AttachmentCard/AttachmentCard.js +40 -3
  7. package/dist/components/Avatar/Avatar.css +7 -2
  8. package/dist/components/Avatar/AvatarGroup.d.ts +17 -0
  9. package/dist/components/Avatar/AvatarGroup.js +22 -8
  10. package/dist/components/Badge/Badge.css +54 -2
  11. package/dist/components/Badge/Badge.d.ts +14 -4
  12. package/dist/components/Badge/Badge.js +1 -0
  13. package/dist/components/Box/Box.css +83 -0
  14. package/dist/components/Box/Box.d.ts +82 -2
  15. package/dist/components/Box/Box.js +42 -2
  16. package/dist/components/Button/Button.css +29 -0
  17. package/dist/components/Button/Button.d.ts +4 -4
  18. package/dist/components/Button/Button.js +4 -1
  19. package/dist/components/Calendar/Calendar.css +245 -0
  20. package/dist/components/Calendar/Calendar.d.ts +125 -0
  21. package/dist/components/Calendar/Calendar.js +320 -0
  22. package/dist/components/Chips/Chips.css +38 -0
  23. package/dist/components/Chips/Chips.d.ts +5 -2
  24. package/dist/components/Chips/Chips.js +2 -1
  25. package/dist/components/Coachmark/Coachmark.css +118 -0
  26. package/dist/components/Coachmark/Coachmark.d.ts +75 -0
  27. package/dist/components/Coachmark/Coachmark.js +321 -0
  28. package/dist/components/CodeBlock/CodeBlock.css +96 -0
  29. package/dist/components/CodeBlock/CodeBlock.d.ts +47 -0
  30. package/dist/components/CodeBlock/CodeBlock.js +103 -0
  31. package/dist/components/ColorPicker/ColorPicker.css +133 -0
  32. package/dist/components/ColorPicker/ColorPicker.d.ts +73 -0
  33. package/dist/components/ColorPicker/ColorPicker.js +219 -0
  34. package/dist/components/Combobox/Combobox.css +8 -0
  35. package/dist/components/DataTable/DataTable.css +80 -0
  36. package/dist/components/DataTable/DataTable.d.ts +19 -4
  37. package/dist/components/DataTable/DataTable.js +59 -15
  38. package/dist/components/DatePicker/DatePicker.css +8 -0
  39. package/dist/components/DatePicker/DatePicker.js +10 -1
  40. package/dist/components/DescriptionList/DescriptionList.css +113 -0
  41. package/dist/components/DescriptionList/DescriptionList.d.ts +59 -0
  42. package/dist/components/DescriptionList/DescriptionList.js +51 -0
  43. package/dist/components/FileInput/FileInput.css +16 -0
  44. package/dist/components/FileInput/FileInput.d.ts +4 -2
  45. package/dist/components/FileInput/FileInput.js +8 -2
  46. package/dist/components/Grid/Grid.js +5 -5
  47. package/dist/components/IconPicker/IconPicker.css +107 -0
  48. package/dist/components/IconPicker/IconPicker.d.ts +74 -0
  49. package/dist/components/IconPicker/IconPicker.js +194 -0
  50. package/dist/components/Input/Input.css +38 -0
  51. package/dist/components/Input/Input.d.ts +10 -1
  52. package/dist/components/Input/Input.js +66 -5
  53. package/dist/components/Kanban/Kanban.css +4 -0
  54. package/dist/components/Kbd/Kbd.css +66 -0
  55. package/dist/components/Kbd/Kbd.d.ts +32 -0
  56. package/dist/components/Kbd/Kbd.js +40 -0
  57. package/dist/components/List/List.css +136 -0
  58. package/dist/components/List/List.d.ts +82 -0
  59. package/dist/components/List/List.js +53 -0
  60. package/dist/components/List/ListItem.d.ts +85 -0
  61. package/dist/components/List/ListItem.js +81 -0
  62. package/dist/components/Modal/Modal.css +80 -0
  63. package/dist/components/Modal/Modal.d.ts +33 -6
  64. package/dist/components/Modal/Modal.js +101 -6
  65. package/dist/components/MultiSelect/MultiSelect.css +8 -0
  66. package/dist/components/MultiSelect/MultiSelect.js +10 -1
  67. package/dist/components/OrgChart/OrgChart.css +149 -0
  68. package/dist/components/OrgChart/OrgChart.d.ts +83 -0
  69. package/dist/components/OrgChart/OrgChart.js +297 -0
  70. package/dist/components/OtpInput/OtpInput.css +93 -0
  71. package/dist/components/OtpInput/OtpInput.d.ts +60 -0
  72. package/dist/components/OtpInput/OtpInput.js +215 -0
  73. package/dist/components/PhoneInput/PhoneInput.css +8 -0
  74. package/dist/components/Popover/Popover.d.ts +7 -0
  75. package/dist/components/Popover/Popover.js +11 -1
  76. package/dist/components/RichTextEditor/RichTextEditor.css +203 -0
  77. package/dist/components/RichTextEditor/RichTextEditor.d.ts +83 -0
  78. package/dist/components/RichTextEditor/RichTextEditor.js +494 -0
  79. package/dist/components/SegmentedControl/SegmentedControl.js +7 -2
  80. package/dist/components/Select/Select.css +70 -0
  81. package/dist/components/Select/Select.d.ts +12 -0
  82. package/dist/components/Select/Select.js +59 -4
  83. package/dist/components/Stack/Stack.css +49 -0
  84. package/dist/components/Stack/Stack.d.ts +65 -7
  85. package/dist/components/Stack/Stack.js +30 -2
  86. package/dist/components/StatCard/StatCard.css +73 -0
  87. package/dist/components/StatCard/StatCard.d.ts +17 -0
  88. package/dist/components/StatCard/StatCard.js +4 -1
  89. package/dist/components/Tabs/Tab.d.ts +15 -0
  90. package/dist/components/Tabs/Tab.js +30 -1
  91. package/dist/components/Tabs/Tabs.css +132 -0
  92. package/dist/components/Tabs/Tabs.d.ts +7 -0
  93. package/dist/components/Tabs/Tabs.js +13 -2
  94. package/dist/components/Tag/Tag.css +85 -2
  95. package/dist/components/Tag/Tag.d.ts +13 -6
  96. package/dist/components/Tag/Tag.js +1 -0
  97. package/dist/components/Text/Text.js +2 -2
  98. package/dist/components/Textarea/Textarea.css +8 -0
  99. package/dist/components/TimePicker/TimePicker.css +8 -0
  100. package/dist/components/Tooltip/Tooltip.css +25 -0
  101. package/dist/components/Tooltip/Tooltip.d.ts +11 -0
  102. package/dist/components/Tooltip/Tooltip.js +18 -3
  103. package/dist/index.d.ts +25 -0
  104. package/dist/index.js +14 -0
  105. package/dist/teste/AILabel.test.d.ts +1 -0
  106. package/dist/teste/AILabel.test.js +33 -0
  107. package/dist/teste/AccordionConteudoLivre.test.d.ts +1 -0
  108. package/dist/teste/AccordionConteudoLivre.test.js +29 -0
  109. package/dist/teste/AtributosRepassados.test.d.ts +1 -0
  110. package/dist/teste/AtributosRepassados.test.js +52 -0
  111. package/dist/teste/AttachmentCardIA.test.d.ts +1 -0
  112. package/dist/teste/AttachmentCardIA.test.js +89 -0
  113. package/dist/teste/AvatarGroupOverlap.test.d.ts +1 -0
  114. package/dist/teste/AvatarGroupOverlap.test.js +56 -0
  115. package/dist/teste/BadgeTag.test.d.ts +1 -0
  116. package/dist/teste/BadgeTag.test.js +42 -0
  117. package/dist/teste/BoxItemFlex.test.d.ts +1 -0
  118. package/dist/teste/BoxItemFlex.test.js +54 -0
  119. package/dist/teste/BoxLayout.test.d.ts +1 -0
  120. package/dist/teste/BoxLayout.test.js +35 -0
  121. package/dist/teste/Button.test.d.ts +1 -0
  122. package/dist/teste/Button.test.js +27 -0
  123. package/dist/teste/Calendar.test.d.ts +1 -0
  124. package/dist/teste/Calendar.test.js +221 -0
  125. package/dist/teste/ChipsXs.test.d.ts +1 -0
  126. package/dist/teste/ChipsXs.test.js +31 -0
  127. package/dist/teste/Coachmark.test.d.ts +1 -0
  128. package/dist/teste/Coachmark.test.js +149 -0
  129. package/dist/teste/ColorPicker.test.d.ts +1 -0
  130. package/dist/teste/ColorPicker.test.js +132 -0
  131. package/dist/teste/DataTableCelulaLivre.test.d.ts +1 -0
  132. package/dist/teste/DataTableCelulaLivre.test.js +76 -0
  133. package/dist/teste/DataTableDocumento.test.d.ts +1 -0
  134. package/dist/teste/DataTableDocumento.test.js +92 -0
  135. package/dist/teste/DatePicker.test.js +23 -0
  136. package/dist/teste/FileInputTrigger.test.d.ts +1 -0
  137. package/dist/teste/FileInputTrigger.test.js +53 -0
  138. package/dist/teste/IconPicker.test.d.ts +1 -0
  139. package/dist/teste/IconPicker.test.js +130 -0
  140. package/dist/teste/InputMascaraEAfins.test.d.ts +1 -0
  141. package/dist/teste/InputMascaraEAfins.test.js +99 -0
  142. package/dist/teste/KbdCodeBlock.test.d.ts +1 -0
  143. package/dist/teste/KbdCodeBlock.test.js +95 -0
  144. package/dist/teste/List.test.d.ts +1 -0
  145. package/dist/teste/List.test.js +153 -0
  146. package/dist/teste/ModalVariantes.test.d.ts +1 -0
  147. package/dist/teste/ModalVariantes.test.js +151 -0
  148. package/dist/teste/NomeAcessivelSsr.test.d.ts +1 -0
  149. package/dist/teste/NomeAcessivelSsr.test.js +88 -0
  150. package/dist/teste/OrgChart.test.d.ts +1 -0
  151. package/dist/teste/OrgChart.test.js +162 -0
  152. package/dist/teste/OtpInput.test.d.ts +1 -0
  153. package/dist/teste/OtpInput.test.js +143 -0
  154. package/dist/teste/PopoverMaxHeight.test.d.ts +1 -0
  155. package/dist/teste/PopoverMaxHeight.test.js +38 -0
  156. package/dist/teste/RichTextEditor.test.d.ts +1 -0
  157. package/dist/teste/RichTextEditor.test.js +287 -0
  158. package/dist/teste/SelectPlacementFiltro.test.d.ts +1 -0
  159. package/dist/teste/SelectPlacementFiltro.test.js +88 -0
  160. package/dist/teste/Stack.test.d.ts +1 -0
  161. package/dist/teste/Stack.test.js +57 -0
  162. package/dist/teste/StatCardRotuloTopo.test.d.ts +1 -0
  163. package/dist/teste/StatCardRotuloTopo.test.js +34 -0
  164. package/dist/teste/TabsContadorFechavel.test.d.ts +1 -0
  165. package/dist/teste/TabsContadorFechavel.test.js +79 -0
  166. package/dist/teste/TooltipDark.test.d.ts +1 -0
  167. package/dist/teste/TooltipDark.test.js +31 -0
  168. package/dist/utils/calendario.d.ts +28 -0
  169. package/dist/utils/calendario.js +73 -0
  170. package/dist/utils/html-seguro.d.ts +27 -0
  171. package/dist/utils/html-seguro.js +97 -0
  172. package/dist/utils/paleta-de-cores.d.ts +26 -0
  173. package/dist/utils/paleta-de-cores.js +10 -0
  174. package/dist/utils/texto.d.ts +5 -0
  175. package/dist/utils/texto.js +5 -0
  176. package/package.json +3 -3
  177. package/src/index.ts +26 -0
  178. package/src/teste/AILabel.test.tsx +41 -0
  179. package/src/teste/AccordionConteudoLivre.test.tsx +39 -0
  180. package/src/teste/AtributosRepassados.test.tsx +73 -0
  181. package/src/teste/AttachmentCardIA.test.tsx +126 -0
  182. package/src/teste/AvatarGroupOverlap.test.tsx +74 -0
  183. package/src/teste/BadgeTag.test.tsx +64 -0
  184. package/src/teste/BoxItemFlex.test.tsx +81 -0
  185. package/src/teste/BoxLayout.test.tsx +50 -0
  186. package/src/teste/Button.test.tsx +39 -0
  187. package/src/teste/Calendar.test.tsx +282 -0
  188. package/src/teste/ChipsXs.test.tsx +41 -0
  189. package/src/teste/Coachmark.test.tsx +198 -0
  190. package/src/teste/ColorPicker.test.tsx +153 -0
  191. package/src/teste/DataTableCelulaLivre.test.tsx +103 -0
  192. package/src/teste/DataTableDocumento.test.tsx +102 -0
  193. package/src/teste/DatePicker.test.tsx +38 -0
  194. package/src/teste/FileInputTrigger.test.tsx +89 -0
  195. package/src/teste/IconPicker.test.tsx +145 -0
  196. package/src/teste/InputMascaraEAfins.test.tsx +124 -0
  197. package/src/teste/KbdCodeBlock.test.tsx +106 -0
  198. package/src/teste/List.test.tsx +269 -0
  199. package/src/teste/ModalVariantes.test.tsx +173 -0
  200. package/src/teste/NomeAcessivelSsr.test.tsx +110 -0
  201. package/src/teste/OrgChart.test.tsx +183 -0
  202. package/src/teste/OtpInput.test.tsx +163 -0
  203. package/src/teste/PopoverMaxHeight.test.tsx +47 -0
  204. package/src/teste/RichTextEditor.test.tsx +329 -0
  205. package/src/teste/SelectPlacementFiltro.test.tsx +110 -0
  206. package/src/teste/Stack.test.tsx +80 -0
  207. package/src/teste/StatCardRotuloTopo.test.tsx +44 -0
  208. package/src/teste/TabsContadorFechavel.test.tsx +144 -0
  209. package/src/teste/TooltipDark.test.tsx +51 -0
  210. package/src/utils/calendario.ts +78 -0
  211. package/src/utils/html-seguro.ts +94 -0
  212. package/src/utils/paleta-de-cores.ts +34 -0
  213. package/src/utils/texto.ts +5 -0
package/dist/index.js CHANGED
@@ -4,12 +4,17 @@ export * from "./utils/theme";
4
4
  export * from "./utils/toast";
5
5
  // Densidade global (modo touch ≥44px via data-density)
6
6
  export * from "./utils/density";
7
+ // Paleta de cor categórica (primitivos) do ColorPicker
8
+ export * from "./utils/paleta-de-cores";
7
9
  // FontAwesome
8
10
  export { library } from "@fortawesome/fontawesome-svg-core";
9
11
  // Components
10
12
  export { default as Accordion } from "./components/Accordion/Accordion";
11
13
  export { default as AILabel } from "./components/AILabel/AILabel";
12
14
  export { default as AIContent } from "./components/AIContent/AIContent";
15
+ export { default as Calendar } from "./components/Calendar/Calendar";
16
+ export { default as Coachmark } from "./components/Coachmark/Coachmark";
17
+ export { default as CodeBlock } from "./components/CodeBlock/CodeBlock";
13
18
  export { default as ConfirmAIAction } from "./components/ConfirmAIAction/ConfirmAIAction";
14
19
  export { default as Alert } from "./components/Alert/Alert";
15
20
  export { default as AppHeader } from "./components/AppHeader/AppHeader";
@@ -31,11 +36,13 @@ export { default as Button } from "./components/Button/Button";
31
36
  export { default as Card } from "./components/Card/Card";
32
37
  export { default as Checkbox } from "./components/Checkbox/Checkbox";
33
38
  export { default as Chips } from "./components/Chips/Chips";
39
+ export { default as ColorPicker } from "./components/ColorPicker/ColorPicker";
34
40
  export { default as Combobox } from "./components/Combobox/Combobox";
35
41
  export { default as ConfirmDialog } from "./components/ConfirmDialog/ConfirmDialog";
36
42
  export { default as Container } from "./components/Container/Container";
37
43
  export { default as DataTable } from "./components/DataTable/DataTable";
38
44
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
45
+ export { default as DescriptionList } from "./components/DescriptionList/DescriptionList";
39
46
  export { default as Divider } from "./components/Divider/Divider";
40
47
  export { default as DonutChart } from "./components/Chart/DonutChart";
41
48
  export { default as Drawer } from "./components/Drawer/Drawer";
@@ -44,15 +51,21 @@ export { default as EmptyState } from "./components/EmptyState/EmptyState";
44
51
  export { default as FileInput } from "./components/FileInput/FileInput";
45
52
  export { default as Grid } from "./components/Grid/Grid";
46
53
  export { default as Icon } from "./components/Icon/Icon";
54
+ export { default as IconPicker } from "./components/IconPicker/IconPicker";
47
55
  export { default as Input } from "./components/Input/Input";
48
56
  export { default as Kanban } from "./components/Kanban/Kanban";
49
57
  export { default as KanbanCard } from "./components/Kanban/KanbanCard";
50
58
  export { default as KanbanColumn } from "./components/Kanban/KanbanColumn";
59
+ export { default as Kbd } from "./components/Kbd/Kbd";
51
60
  export { default as Link } from "./components/Link/Link";
52
61
  export { default as LineChart } from "./components/Chart/LineChart";
62
+ export { default as List } from "./components/List/List";
63
+ export { default as ListItem } from "./components/List/ListItem";
53
64
  export { default as Logo } from "./components/Logo/Logo";
54
65
  export { default as Modal } from "./components/Modal/Modal";
55
66
  export { default as MultiSelect } from "./components/MultiSelect/MultiSelect";
67
+ export { default as OrgChart } from "./components/OrgChart/OrgChart";
68
+ export { default as OtpInput } from "./components/OtpInput/OtpInput";
56
69
  export { default as PageHeader } from "./components/PageHeader/PageHeader";
57
70
  export { default as Pagination } from "./components/Pagination/Pagination";
58
71
  export { default as PhoneInput } from "./components/PhoneInput/PhoneInput";
@@ -60,6 +73,7 @@ export { default as Podium } from "./components/Podium/Podium";
60
73
  export { default as ProgressBar } from "./components/ProgressBar/ProgressBar";
61
74
  export { default as Radio } from "./components/Radio/Radio";
62
75
  export { default as RadioGroup } from "./components/Radio/RadioGroup";
76
+ export { default as RichTextEditor } from "./components/RichTextEditor/RichTextEditor";
63
77
  export { default as SegmentedControl } from "./components/SegmentedControl/SegmentedControl";
64
78
  export { default as Select } from "./components/Select/Select";
65
79
  export { default as SidePanel } from "./components/SidePanel/SidePanel";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { describe, expect, it, vi } from "vitest";
3
+ import { render, screen } from "@testing-library/react";
4
+ import userEvent from "@testing-library/user-event";
5
+ import AILabel from "../components/AILabel/AILabel";
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(_jsx(AILabel, { explanation: "Resumo dos despachos.", defaultOpen: true }));
14
+ expect(screen.getByRole("region")).toHaveTextContent("Resumo dos despachos.");
15
+ expect(screen.getByRole("button", { name: "Conteúdo gerado por IA" })).toHaveAttribute("aria-expanded", "true");
16
+ });
17
+ it("continua não-controlado: o clique fecha e avisa", async () => {
18
+ const usuario = userEvent.setup();
19
+ const onOpenChange = vi.fn();
20
+ render(_jsx(AILabel, { explanation: "Resumo.", defaultOpen: true, onOpenChange: onOpenChange }));
21
+ await usuario.click(screen.getByRole("button", { name: "Conteúdo gerado por IA" }));
22
+ expect(screen.queryByRole("region")).not.toBeInTheDocument();
23
+ expect(onOpenChange).toHaveBeenCalledWith(false);
24
+ });
25
+ it("sem defaultOpen nasce fechado", () => {
26
+ render(_jsx(AILabel, { explanation: "Resumo." }));
27
+ expect(screen.queryByRole("region")).not.toBeInTheDocument();
28
+ });
29
+ it("`open` controlado vence o defaultOpen", () => {
30
+ render(_jsx(AILabel, { explanation: "Resumo.", defaultOpen: true, open: false }));
31
+ expect(screen.queryByRole("region")).not.toBeInTheDocument();
32
+ });
33
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { describe, expect, it } from "vitest";
3
+ import { render, screen } from "@testing-library/react";
4
+ import Accordion from "../components/Accordion/Accordion";
5
+ describe("Accordion · conteúdo livre por item (React)", () => {
6
+ it("o content do item aceita qualquer nó (campos, botões)", () => {
7
+ render(_jsx(Accordion, { items: [
8
+ {
9
+ id: "s1",
10
+ title: "Seção 01",
11
+ defaultOpen: true,
12
+ content: (_jsxs("label", { children: ["Nome ", _jsx("input", { defaultValue: "Maria" })] })),
13
+ },
14
+ { id: "s2", title: "Seção 02", content: _jsx("button", { type: "button", children: "Anexar arquivo" }) },
15
+ ] }));
16
+ expect(screen.getByDisplayValue("Maria")).toBeInTheDocument();
17
+ expect(screen.getByRole("button", { name: "Anexar arquivo", hidden: true })).toBeInTheDocument();
18
+ });
19
+ it("o título do item é o botão do painel, sem cor própria (herda a neutra do gatilho)", () => {
20
+ const { container } = render(_jsx(Accordion, { items: [{ id: "a", title: "Seção", content: "x" }] }));
21
+ const titulo = container.querySelector(".umds-accordion__title");
22
+ expect(titulo.closest("button")).toHaveClass("umds-accordion__trigger");
23
+ expect(titulo.getAttribute("style")).toBeNull();
24
+ });
25
+ it("o texto simples continua funcionando", () => {
26
+ render(_jsx(Accordion, { items: [{ id: "a", title: "Seção", content: "Texto do painel", defaultOpen: true }] }));
27
+ expect(screen.getByText("Texto do painel")).toBeInTheDocument();
28
+ });
29
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { describe, expect, it } from "vitest";
3
+ import { render } from "@testing-library/react";
4
+ import Text from "../components/Text/Text";
5
+ import Grid from "../components/Grid/Grid";
6
+ import Logo from "../components/Logo/Logo";
7
+ import Button from "../components/Button/Button";
8
+ import DataTable from "../components/DataTable/DataTable";
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(_jsx(Text, { title: "Dica", style: { marginTop: 4 }, "aria-live": "polite", "data-x": "1", children: "Ol\u00E1" }));
18
+ const el = container.firstElementChild;
19
+ expect(el.getAttribute("title")).toBe("Dica");
20
+ expect(el.style.marginTop).toBe("4px");
21
+ expect(el.getAttribute("aria-live")).toBe("polite");
22
+ expect(el.getAttribute("data-x")).toBe("1");
23
+ });
24
+ it("Grid repassa title, style e aria-*", () => {
25
+ const { container } = render(_jsx(Grid, { container: true, spacing: "xxxs", title: "Dica", style: { marginTop: 4 }, "aria-label": "\u00C1rea", children: "x" }));
26
+ const el = container.firstElementChild;
27
+ expect(el.getAttribute("title")).toBe("Dica");
28
+ expect(el.style.marginTop).toBe("4px");
29
+ expect(el.getAttribute("aria-label")).toBe("Área");
30
+ });
31
+ it("Logo repassa title, style e aria-*", () => {
32
+ const { container } = render(_jsx(Logo, { title: "Dica", style: { width: 80 }, "aria-hidden": "true" }));
33
+ const el = container.firstElementChild;
34
+ expect(el.getAttribute("title")).toBe("Dica");
35
+ expect(el.style.width).toBe("80px");
36
+ expect(el.getAttribute("aria-hidden")).toBe("true");
37
+ });
38
+ });
39
+ describe("Button · autoFocus", () => {
40
+ it("não escreve autofocus quando falso ou ausente", () => {
41
+ const { container } = render(_jsx(Button, { children: "Salvar" }));
42
+ expect(container.querySelector("[autofocus]")).toBeNull();
43
+ });
44
+ });
45
+ describe("DataTable · linha selecionada", () => {
46
+ it("a classe --selected vai limpa, só na linha selecionada", () => {
47
+ const { container } = render(_jsx(DataTable, { columns: [{ key: "nome", label: "Nome" }], data: [{ nome: "Cris Lima" }, { nome: "Ana Paula" }], selectable: true, selectedRows: [0] }));
48
+ const marcadas = container.querySelectorAll(".umds-datatable__row--selected");
49
+ expect(marcadas).toHaveLength(1);
50
+ expect(container.innerHTML).not.toContain(".value");
51
+ });
52
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,89 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { beforeAll, describe, expect, it, vi } from "vitest";
3
+ import { render, screen, waitFor } from "@testing-library/react";
4
+ import userEvent from "@testing-library/user-event";
5
+ import AttachmentCard from "../components/AttachmentCard/AttachmentCard";
6
+ beforeAll(() => {
7
+ if (!globalThis.ResizeObserver) {
8
+ globalThis.ResizeObserver = class {
9
+ observe() { }
10
+ unobserve() { }
11
+ disconnect() { }
12
+ };
13
+ }
14
+ });
15
+ function cartaoDeIA(extra = {}) {
16
+ const aoAplicar = vi.fn();
17
+ const ui = (_jsx(AttachmentCard, { fileName: "protocolo.pdf", documentType: "Protocolo", status: "ai", statusLabel: "Recursos IA", onOpen: () => { }, panel: _jsxs("div", { children: [_jsx("p", { children: "A IA sugere um assunto." }), _jsx("button", { type: "button", onClick: aoAplicar, children: "Aplicar sugest\u00E3o" })] }), ...extra }));
18
+ return { aoAplicar, ...render(ui) };
19
+ }
20
+ describe("AttachmentCard · status ai", () => {
21
+ it("escreve a classe do selo de IA e usa a varinha por padrão", () => {
22
+ const { container } = render(_jsx(AttachmentCard, { fileName: "x.pdf", status: "ai", statusLabel: "Recursos IA" }));
23
+ const selo = container.querySelector(".umds-attachment-card__status");
24
+ expect(selo).toHaveClass("umds-attachment-card__status--ai");
25
+ expect(selo.querySelector("svg")).not.toBeNull();
26
+ });
27
+ it("só o selo de IA ganha ícone por padrão", () => {
28
+ const { container } = render(_jsx(AttachmentCard, { fileName: "x.pdf", status: "positive", statusLabel: "Ok" }));
29
+ expect(container.querySelector(".umds-attachment-card__status svg")).toBeNull();
30
+ });
31
+ });
32
+ describe("AttachmentCard · slot panel", () => {
33
+ it("o painel livre substitui o resultado da conferência, e o selo vira botão sem statusDetails", async () => {
34
+ const usuario = userEvent.setup();
35
+ cartaoDeIA();
36
+ const selo = screen.getByRole("button", { name: /^Recursos IA/ });
37
+ expect(selo).toHaveAttribute("aria-haspopup", "dialog");
38
+ await usuario.click(selo);
39
+ const painel = await screen.findByRole("dialog");
40
+ expect(painel).toHaveTextContent("A IA sugere um assunto.");
41
+ expect(screen.getByRole("button", { name: "Aplicar sugestão" })).toBeInTheDocument();
42
+ // sem título interno: o painel é nomeado pelo selo
43
+ expect(painel).not.toHaveAttribute("aria-labelledby");
44
+ expect(painel).toHaveAccessibleName(/Recursos IA/);
45
+ });
46
+ it("sem panel nem statusDetails o selo não é botão", () => {
47
+ render(_jsx(AttachmentCard, { fileName: "x.pdf", status: "ai", statusLabel: "Recursos IA" }));
48
+ expect(screen.queryByRole("button")).toBeNull();
49
+ });
50
+ it("panelWidth escreve a largura do painel; sem ela não há style", async () => {
51
+ const usuario = userEvent.setup();
52
+ cartaoDeIA({ panelWidth: 280 });
53
+ await usuario.click(screen.getByRole("button", { name: /^Recursos IA/ }));
54
+ expect((await screen.findByRole("dialog")).style.width).toBe("280px");
55
+ });
56
+ it("sem panelWidth o painel não leva style", async () => {
57
+ const usuario = userEvent.setup();
58
+ cartaoDeIA();
59
+ await usuario.click(screen.getByRole("button", { name: /^Recursos IA/ }));
60
+ expect((await screen.findByRole("dialog")).getAttribute("style")).toBeNull();
61
+ });
62
+ });
63
+ describe("AttachmentCard · closePanelOnAction", () => {
64
+ it("acionar um botão do painel fecha, devolve o foco ao selo e a ação chega ao app", async () => {
65
+ const usuario = userEvent.setup();
66
+ const { aoAplicar } = cartaoDeIA({ closePanelOnAction: true });
67
+ const selo = screen.getByRole("button", { name: /^Recursos IA/ });
68
+ await usuario.click(selo);
69
+ await usuario.click(await screen.findByRole("button", { name: "Aplicar sugestão" }));
70
+ expect(aoAplicar).toHaveBeenCalledTimes(1);
71
+ await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
72
+ expect(selo).toHaveFocus();
73
+ });
74
+ it("sem a prop o painel continua aberto depois da ação", async () => {
75
+ const usuario = userEvent.setup();
76
+ const { aoAplicar } = cartaoDeIA();
77
+ await usuario.click(screen.getByRole("button", { name: /^Recursos IA/ }));
78
+ await usuario.click(await screen.findByRole("button", { name: "Aplicar sugestão" }));
79
+ expect(aoAplicar).toHaveBeenCalledTimes(1);
80
+ expect(screen.getByRole("dialog")).toBeInTheDocument();
81
+ });
82
+ it("o botão de copiar um campo não fecha o painel", async () => {
83
+ const usuario = userEvent.setup();
84
+ render(_jsx(AttachmentCard, { fileName: "cpf.pdf", status: "positive", statusLabel: "Pr\u00E9-aprovado", closePanelOnAction: true, statusDetails: { fields: [{ label: "CPF", value: "384.221.760-05", copyable: true }] } }));
85
+ await usuario.click(screen.getByRole("button", { name: /^Pré-aprovado/ }));
86
+ await usuario.click(await screen.findByRole("button", { name: "Copiar CPF" }));
87
+ expect(screen.getByRole("dialog")).toBeInTheDocument();
88
+ });
89
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { describe, expect, it } from "vitest";
3
+ import { render, screen } from "@testing-library/react";
4
+ import AvatarGroup from "../components/Avatar/AvatarGroup";
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
+ const grupo = (c) => c.firstElementChild;
13
+ describe("AvatarGroup · overflowCount", () => {
14
+ it("sem a prop, o +N é o que passou de max (como antes)", () => {
15
+ render(_jsx(AvatarGroup, { avatars: PESSOAS, max: 3 }));
16
+ expect(screen.getByText("+2")).toBeInTheDocument();
17
+ });
18
+ it("overflowCount vira o +N sem itens-fantasma", () => {
19
+ render(_jsx(AvatarGroup, { avatars: PESSOAS.slice(0, 3), max: 3, overflowCount: 12 }));
20
+ expect(screen.getByText("+12")).toBeInTheDocument();
21
+ });
22
+ it("soma com o que passou de max dentro de avatars", () => {
23
+ render(_jsx(AvatarGroup, { avatars: PESSOAS, max: 3, overflowCount: 10 }));
24
+ expect(screen.getByText("+12")).toBeInTheDocument();
25
+ });
26
+ it("o rótulo traduzido recebe o total escondido", () => {
27
+ render(_jsx(AvatarGroup, { avatars: PESSOAS.slice(0, 2), max: 2, overflowCount: 7, overflowTitle: (n) => n + " others", overflowAriaLabel: (n) => n + " more avatars" }));
28
+ expect(screen.getByTitle("7 others")).toBeInTheDocument();
29
+ });
30
+ it("sem excedente nenhum, não há +N", () => {
31
+ render(_jsx(AvatarGroup, { avatars: PESSOAS.slice(0, 2), max: 4 }));
32
+ expect(screen.queryByText(/^\+/)).toBeNull();
33
+ });
34
+ it("overflowCount 0 não cria +0", () => {
35
+ render(_jsx(AvatarGroup, { avatars: PESSOAS.slice(0, 2), max: 4, overflowCount: 0 }));
36
+ expect(screen.queryByText(/^\+/)).toBeNull();
37
+ });
38
+ });
39
+ describe("AvatarGroup · overlap e ring", () => {
40
+ it("escrevem as variáveis do grupo em px", () => {
41
+ const { container } = render(_jsx(AvatarGroup, { avatars: PESSOAS, overlap: 6, ring: 1 }));
42
+ const el = grupo(container);
43
+ expect(el.style.getPropertyValue("--umds-avatar-group-overlap")).toBe("6px");
44
+ expect(el.style.getPropertyValue("--umds-avatar-group-ring")).toBe("1px");
45
+ });
46
+ it("só overlap não mexe no anel", () => {
47
+ const { container } = render(_jsx(AvatarGroup, { avatars: PESSOAS, overlap: 4 }));
48
+ const el = grupo(container);
49
+ expect(el.style.getPropertyValue("--umds-avatar-group-overlap")).toBe("4px");
50
+ expect(el.style.getPropertyValue("--umds-avatar-group-ring")).toBe("");
51
+ });
52
+ it("sem as props, nenhum style: valem os padrões do CSS", () => {
53
+ const { container } = render(_jsx(AvatarGroup, { avatars: PESSOAS }));
54
+ expect(grupo(container).getAttribute("style")).toBeNull();
55
+ });
56
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { describe, expect, it } from "vitest";
3
+ import { render } from "@testing-library/react";
4
+ import Badge from "../components/Badge/Badge";
5
+ import Tag from "../components/Tag/Tag";
6
+ const raiz = (c) => c.firstElementChild;
7
+ describe("Badge compacto, novidade e colado", () => {
8
+ it("size 2xs escreve a classe; sem size continua md", () => {
9
+ const { container } = render(_jsxs(_Fragment, { children: [_jsx(Badge, { size: "2xs", children: "A" }), _jsx(Badge, { children: "B" })] }));
10
+ expect(container.children[0]).toHaveClass("umds-badge--2xs");
11
+ expect(container.children[1]).toHaveClass("umds-badge--md");
12
+ });
13
+ it("variant new escreve a classe da variante", () => {
14
+ const { container } = render(_jsx(Badge, { variant: "new", children: "Novidade" }));
15
+ expect(raiz(container)).toHaveClass("umds-badge--new");
16
+ });
17
+ it("attached escreve o modificador; sem ele não há", () => {
18
+ const { container } = render(_jsxs(_Fragment, { children: [_jsx(Badge, { attached: true, children: "A" }), _jsx(Badge, { children: "B" })] }));
19
+ expect(container.children[0]).toHaveClass("umds-badge--attached");
20
+ expect(container.children[1]).not.toHaveClass("umds-badge--attached");
21
+ });
22
+ });
23
+ describe("Tag compacta, soft, pílula e novidade", () => {
24
+ it("size xs escreve a classe e sm continua", () => {
25
+ const { container } = render(_jsxs(_Fragment, { children: [_jsx(Tag, { label: "a", size: "xs" }), _jsx(Tag, { label: "b", size: "sm" })] }));
26
+ expect(container.children[0]).toHaveClass("umds-tag--xs");
27
+ expect(container.children[1]).toHaveClass("umds-tag--sm");
28
+ });
29
+ it("appearance soft e pill escrevem as classes", () => {
30
+ const { container } = render(_jsx(Tag, { label: "SOBR", appearance: "soft", variant: "primary", pill: true }));
31
+ expect(raiz(container)).toHaveClass("umds-tag--soft", "umds-tag--primary", "umds-tag--pill");
32
+ });
33
+ it("sem pill não há a classe; padrão segue outlined", () => {
34
+ const { container } = render(_jsx(Tag, { label: "x" }));
35
+ expect(raiz(container)).toHaveClass("umds-tag--outlined");
36
+ expect(raiz(container)).not.toHaveClass("umds-tag--pill");
37
+ });
38
+ it("variant new escreve a classe", () => {
39
+ const { container } = render(_jsx(Tag, { label: "Dado simulado", variant: "new", appearance: "soft" }));
40
+ expect(raiz(container)).toHaveClass("umds-tag--new", "umds-tag--soft");
41
+ });
42
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,54 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { describe, expect, it, vi } from "vitest";
3
+ import { fireEvent, render, screen } from "@testing-library/react";
4
+ import Box from "../components/Box/Box";
5
+ describe("Box como item flex e com `as`", () => {
6
+ it("sem `as` continua um div", () => {
7
+ const { container } = render(_jsx(Box, { padding: "md", children: "x" }));
8
+ expect(container.firstElementChild?.tagName).toBe("DIV");
9
+ });
10
+ for (const tag of ["div", "span", "ul", "ol", "li", "section", "nav", "header", "footer", "form"]) {
11
+ it(`as="${tag}" renderiza <${tag}> e só ele`, () => {
12
+ const { container } = render(_jsx(Box, { as: tag, children: "x" }));
13
+ expect(container.firstElementChild?.tagName).toBe(tag.toUpperCase());
14
+ expect(container.children).toHaveLength(1);
15
+ });
16
+ }
17
+ it("ul e ol mantêm a semântica de lista (role=list)", () => {
18
+ render(_jsxs(_Fragment, { children: [_jsx(Box, { as: "ul", "aria-label": "Itens", children: _jsx(Box, { as: "li", children: "a" }) }), _jsx(Box, { as: "ol", "aria-label": "Passos", children: _jsx(Box, { as: "li", children: "b" }) })] }));
19
+ expect(screen.getByRole("list", { name: "Itens" }).tagName).toBe("UL");
20
+ expect(screen.getByRole("list", { name: "Passos" }).tagName).toBe("OL");
21
+ });
22
+ it("nav com aria-label vira região de navegação nomeada", () => {
23
+ render(_jsx(Box, { as: "nav", "aria-label": "Atalhos", children: "x" }));
24
+ expect(screen.getByRole("navigation", { name: "Atalhos" })).toBeInTheDocument();
25
+ });
26
+ it("as=form chama onSubmit", () => {
27
+ const aoEnviar = vi.fn((e) => e.preventDefault());
28
+ const { container } = render(_jsx(Box, { as: "form", onSubmit: aoEnviar, children: _jsx("button", { type: "submit", children: "Enviar" }) }));
29
+ fireEvent.submit(container.querySelector("form"));
30
+ expect(aoEnviar).toHaveBeenCalledTimes(1);
31
+ });
32
+ it("escreve as classes de item flex", () => {
33
+ const { container } = render(_jsx(Box, { grow: true, shrink: "0", basis: "50", minWidth: "auto", overflow: "hidden", overflowX: "auto", overflowY: "scroll", fullHeight: true, fullWidth: true, children: "x" }));
34
+ const el = container.firstElementChild;
35
+ for (const c of [
36
+ "umds-box--grow",
37
+ "umds-box--shrink-0",
38
+ "umds-box--basis-50",
39
+ "umds-box--min-w-auto",
40
+ "umds-box--overflow-hidden",
41
+ "umds-box--overflow-x-auto",
42
+ "umds-box--overflow-y-scroll",
43
+ "umds-box--full-height",
44
+ "umds-box--full",
45
+ ]) {
46
+ expect(el).toHaveClass(c);
47
+ }
48
+ });
49
+ it("sem as props de item não escreve nenhuma classe delas", () => {
50
+ const { container } = render(_jsx(Box, { padding: "md", children: "x" }));
51
+ const classes = container.firstElementChild.className;
52
+ expect(classes).not.toMatch(/grow|shrink|basis|min-w|overflow|full-height/);
53
+ });
54
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { describe, expect, it } from "vitest";
3
+ import { render, screen } from "@testing-library/react";
4
+ import Box from "../components/Box/Box";
5
+ describe("Box de layout", () => {
6
+ it("sem props de layout não vira flex", () => {
7
+ const { container } = render(_jsx(Box, { padding: "md", bordered: true, children: "x" }));
8
+ expect(container.firstElementChild).not.toHaveClass("umds-box--flex");
9
+ });
10
+ it("com direction, gap, align, justify e wrap vira flex", () => {
11
+ const { container } = render(_jsx(Box, { direction: "horizontal", gap: "xxxs", align: "center", justify: "between", wrap: true, padding: "md", children: "x" }));
12
+ const el = container.firstElementChild;
13
+ for (const c of [
14
+ "umds-box--flex",
15
+ "umds-box--horizontal",
16
+ "umds-box--gap-xxxs",
17
+ "umds-box--align-center",
18
+ "umds-box--justify-between",
19
+ "umds-box--wrap",
20
+ "umds-box--p-md",
21
+ ]) {
22
+ expect(el).toHaveClass(c);
23
+ }
24
+ });
25
+ it("só com gap vira flex vertical", () => {
26
+ const { container } = render(_jsx(Box, { gap: "xs", children: "x" }));
27
+ expect(container.firstElementChild).toHaveClass("umds-box--flex", "umds-box--vertical");
28
+ });
29
+ it("repassa id, role, aria-label e style", () => {
30
+ render(_jsx(Box, { id: "r", role: "region", "aria-label": "Resumo", style: { marginTop: 4 }, children: "x" }));
31
+ const el = screen.getByRole("region", { name: "Resumo" });
32
+ expect(el.id).toBe("r");
33
+ expect(el.style.marginTop).toBe("4px");
34
+ });
35
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { describe, expect, it } from "vitest";
3
+ import { render, screen } from "@testing-library/react";
4
+ import { faPlus } from "@fortawesome/free-solid-svg-icons";
5
+ import Button from "../components/Button/Button";
6
+ describe("Button: variante neutral-text e tamanho xs", () => {
7
+ it("neutral-text escreve a classe da variante", () => {
8
+ render(_jsx(Button, { variant: "neutral-text", children: "Simular" }));
9
+ expect(screen.getByRole("button", { name: "Simular" })).toHaveClass("umds-button--neutral-text");
10
+ });
11
+ it("neutral continua sendo o contornado cinza", () => {
12
+ render(_jsx(Button, { variant: "neutral", children: "Ordenar" }));
13
+ const botao = screen.getByRole("button", { name: "Ordenar" });
14
+ expect(botao).toHaveClass("umds-button--neutral");
15
+ expect(botao).not.toHaveClass("umds-button--neutral-text");
16
+ });
17
+ it("size xs escreve a classe e o botão sem size continua md", () => {
18
+ render(_jsxs(_Fragment, { children: [_jsx(Button, { size: "xs", children: "Resolver" }), _jsx(Button, { children: "Padr\u00E3o" })] }));
19
+ expect(screen.getByRole("button", { name: "Resolver" })).toHaveClass("umds-button--xs");
20
+ expect(screen.getByRole("button", { name: "Padrão" })).toHaveClass("umds-button--md");
21
+ });
22
+ it("no xs o ícone usa o tamanho sm do Icon (o CSS do botão o reduz)", () => {
23
+ const { container } = render(_jsx(Button, { size: "xs", startIcon: faPlus, children: "Novo" }));
24
+ expect(container.querySelector(".umds-icon")).toHaveClass("umds-icon--sm");
25
+ expect(container.querySelector(".umds-icon--xs")).toBeNull();
26
+ });
27
+ });
@@ -0,0 +1 @@
1
+ export {};