@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.
Files changed (287) hide show
  1. package/CHANGELOG.md +1540 -0
  2. package/dist/components/AILabel/AILabel.js +1 -1
  3. package/dist/components/Accordion/Accordion.css +13 -0
  4. package/dist/components/Accordion/Accordion.d.ts +9 -2
  5. package/dist/components/Accordion/Accordion.js +1 -0
  6. package/dist/components/AppSubheader/AppSubheader.css +10 -1
  7. package/dist/components/AttachmentCard/AttachmentCard.css +26 -8
  8. package/dist/components/AttachmentCard/AttachmentCard.d.ts +22 -2
  9. package/dist/components/AttachmentCard/AttachmentCard.js +47 -3
  10. package/dist/components/Avatar/Avatar.css +7 -2
  11. package/dist/components/Avatar/AvatarGroup.d.ts +17 -0
  12. package/dist/components/Avatar/AvatarGroup.js +22 -8
  13. package/dist/components/Badge/Badge.css +67 -2
  14. package/dist/components/Badge/Badge.d.ts +23 -4
  15. package/dist/components/Badge/Badge.js +4 -0
  16. package/dist/components/Box/Box.css +83 -0
  17. package/dist/components/Box/Box.d.ts +82 -2
  18. package/dist/components/Box/Box.js +42 -2
  19. package/dist/components/Button/Button.css +29 -0
  20. package/dist/components/Button/Button.d.ts +4 -4
  21. package/dist/components/Button/Button.js +4 -1
  22. package/dist/components/Calendar/Calendar.css +245 -0
  23. package/dist/components/Calendar/Calendar.d.ts +126 -0
  24. package/dist/components/Calendar/Calendar.js +320 -0
  25. package/dist/components/Chips/Chips.css +38 -0
  26. package/dist/components/Chips/Chips.d.ts +5 -2
  27. package/dist/components/Chips/Chips.js +2 -1
  28. package/dist/components/Coachmark/Coachmark.css +128 -0
  29. package/dist/components/Coachmark/Coachmark.d.ts +87 -0
  30. package/dist/components/Coachmark/Coachmark.js +362 -0
  31. package/dist/components/CodeBlock/CodeBlock.css +96 -0
  32. package/dist/components/CodeBlock/CodeBlock.d.ts +47 -0
  33. package/dist/components/CodeBlock/CodeBlock.js +103 -0
  34. package/dist/components/ColorPicker/ColorPicker.css +140 -0
  35. package/dist/components/ColorPicker/ColorPicker.d.ts +73 -0
  36. package/dist/components/ColorPicker/ColorPicker.js +219 -0
  37. package/dist/components/Combobox/Combobox.css +8 -0
  38. package/dist/components/DataTable/DataTable.css +254 -0
  39. package/dist/components/DataTable/DataTable.d.ts +81 -5
  40. package/dist/components/DataTable/DataTable.js +335 -19
  41. package/dist/components/DatePicker/DatePicker.css +8 -0
  42. package/dist/components/DatePicker/DatePicker.js +10 -1
  43. package/dist/components/DescriptionList/DescriptionList.css +127 -0
  44. package/dist/components/DescriptionList/DescriptionList.d.ts +62 -0
  45. package/dist/components/DescriptionList/DescriptionList.js +52 -0
  46. package/dist/components/EmptyState/EmptyState.d.ts +4 -2
  47. package/dist/components/EmptyState/EmptyState.js +2 -2
  48. package/dist/components/FileInput/FileInput.css +16 -0
  49. package/dist/components/FileInput/FileInput.d.ts +4 -2
  50. package/dist/components/FileInput/FileInput.js +8 -2
  51. package/dist/components/Grid/Grid.js +5 -5
  52. package/dist/components/IconPicker/IconPicker.css +107 -0
  53. package/dist/components/IconPicker/IconPicker.d.ts +74 -0
  54. package/dist/components/IconPicker/IconPicker.js +194 -0
  55. package/dist/components/Input/Input.css +59 -0
  56. package/dist/components/Input/Input.d.ts +17 -1
  57. package/dist/components/Input/Input.js +67 -5
  58. package/dist/components/Kanban/Kanban.css +4 -0
  59. package/dist/components/Kbd/Kbd.css +66 -0
  60. package/dist/components/Kbd/Kbd.d.ts +32 -0
  61. package/dist/components/Kbd/Kbd.js +40 -0
  62. package/dist/components/List/List.css +136 -0
  63. package/dist/components/List/List.d.ts +82 -0
  64. package/dist/components/List/List.js +53 -0
  65. package/dist/components/List/ListItem.d.ts +97 -0
  66. package/dist/components/List/ListItem.js +82 -0
  67. package/dist/components/Modal/Modal.css +80 -0
  68. package/dist/components/Modal/Modal.d.ts +33 -6
  69. package/dist/components/Modal/Modal.js +101 -6
  70. package/dist/components/MultiSelect/MultiSelect.css +8 -0
  71. package/dist/components/MultiSelect/MultiSelect.js +10 -1
  72. package/dist/components/OrgChart/OrgChart.css +149 -0
  73. package/dist/components/OrgChart/OrgChart.d.ts +83 -0
  74. package/dist/components/OrgChart/OrgChart.js +297 -0
  75. package/dist/components/OtpInput/OtpInput.css +93 -0
  76. package/dist/components/OtpInput/OtpInput.d.ts +60 -0
  77. package/dist/components/OtpInput/OtpInput.js +215 -0
  78. package/dist/components/PhoneInput/PhoneInput.css +8 -0
  79. package/dist/components/Popover/Popover.d.ts +7 -0
  80. package/dist/components/Popover/Popover.js +11 -1
  81. package/dist/components/RichTextEditor/RichTextEditor.css +250 -0
  82. package/dist/components/RichTextEditor/RichTextEditor.d.ts +97 -0
  83. package/dist/components/RichTextEditor/RichTextEditor.js +951 -0
  84. package/dist/components/SegmentedControl/SegmentedControl.css +24 -0
  85. package/dist/components/SegmentedControl/SegmentedControl.d.ts +2 -0
  86. package/dist/components/SegmentedControl/SegmentedControl.js +10 -2
  87. package/dist/components/Select/Select.css +164 -0
  88. package/dist/components/Select/Select.d.ts +34 -0
  89. package/dist/components/Select/Select.js +258 -28
  90. package/dist/components/Stack/Stack.css +49 -0
  91. package/dist/components/Stack/Stack.d.ts +65 -7
  92. package/dist/components/Stack/Stack.js +30 -2
  93. package/dist/components/StatCard/StatCard.css +138 -0
  94. package/dist/components/StatCard/StatCard.d.ts +26 -0
  95. package/dist/components/StatCard/StatCard.js +13 -1
  96. package/dist/components/Tabs/Tab.d.ts +15 -0
  97. package/dist/components/Tabs/Tab.js +30 -1
  98. package/dist/components/Tabs/Tabs.css +132 -0
  99. package/dist/components/Tabs/Tabs.d.ts +7 -0
  100. package/dist/components/Tabs/Tabs.js +13 -2
  101. package/dist/components/Tag/Tag.css +85 -2
  102. package/dist/components/Tag/Tag.d.ts +13 -6
  103. package/dist/components/Tag/Tag.js +1 -0
  104. package/dist/components/Text/Text.js +2 -2
  105. package/dist/components/Textarea/Textarea.css +8 -0
  106. package/dist/components/TimePicker/TimePicker.css +8 -0
  107. package/dist/components/Toast/Toast.css +32 -0
  108. package/dist/components/Toast/Toast.d.ts +18 -0
  109. package/dist/components/Toast/Toast.js +14 -1
  110. package/dist/components/Toast/ToastStack.js +8 -1
  111. package/dist/components/Tooltip/Tooltip.css +25 -0
  112. package/dist/components/Tooltip/Tooltip.d.ts +11 -0
  113. package/dist/components/Tooltip/Tooltip.js +18 -3
  114. package/dist/index.d.ts +25 -0
  115. package/dist/index.js +14 -0
  116. package/dist/teste/AILabel.test.d.ts +1 -0
  117. package/dist/teste/AILabel.test.js +33 -0
  118. package/dist/teste/AccordionConteudoLivre.test.d.ts +1 -0
  119. package/dist/teste/AccordionConteudoLivre.test.js +29 -0
  120. package/dist/teste/AccordionTituloNeutro.test.d.ts +1 -0
  121. package/dist/teste/AccordionTituloNeutro.test.js +23 -0
  122. package/dist/teste/AppSubheaderRegiao.test.d.ts +1 -0
  123. package/dist/teste/AppSubheaderRegiao.test.js +13 -0
  124. package/dist/teste/AtributosRepassados.test.d.ts +1 -0
  125. package/dist/teste/AtributosRepassados.test.js +52 -0
  126. package/dist/teste/AttachmentCardIA.test.d.ts +1 -0
  127. package/dist/teste/AttachmentCardIA.test.js +89 -0
  128. package/dist/teste/AttachmentCardLista.test.d.ts +1 -0
  129. package/dist/teste/AttachmentCardLista.test.js +49 -0
  130. package/dist/teste/AttachmentCardSm.test.d.ts +1 -0
  131. package/dist/teste/AttachmentCardSm.test.js +26 -0
  132. package/dist/teste/AvatarGroupOverlap.test.d.ts +1 -0
  133. package/dist/teste/AvatarGroupOverlap.test.js +56 -0
  134. package/dist/teste/BadgeNeutroColado.test.d.ts +1 -0
  135. package/dist/teste/BadgeNeutroColado.test.js +11 -0
  136. package/dist/teste/BadgeTag.test.d.ts +1 -0
  137. package/dist/teste/BadgeTag.test.js +55 -0
  138. package/dist/teste/BoxItemFlex.test.d.ts +1 -0
  139. package/dist/teste/BoxItemFlex.test.js +54 -0
  140. package/dist/teste/BoxLayout.test.d.ts +1 -0
  141. package/dist/teste/BoxLayout.test.js +35 -0
  142. package/dist/teste/Button.test.d.ts +1 -0
  143. package/dist/teste/Button.test.js +27 -0
  144. package/dist/teste/Calendar.test.d.ts +1 -0
  145. package/dist/teste/Calendar.test.js +221 -0
  146. package/dist/teste/CalendarCabecalho.test.d.ts +1 -0
  147. package/dist/teste/CalendarCabecalho.test.js +11 -0
  148. package/dist/teste/ChipsXs.test.d.ts +1 -0
  149. package/dist/teste/ChipsXs.test.js +31 -0
  150. package/dist/teste/Coachmark.test.d.ts +1 -0
  151. package/dist/teste/Coachmark.test.js +149 -0
  152. package/dist/teste/CoachmarkSemVeu.test.d.ts +1 -0
  153. package/dist/teste/CoachmarkSemVeu.test.js +85 -0
  154. package/dist/teste/ColorPicker.test.d.ts +1 -0
  155. package/dist/teste/ColorPicker.test.js +132 -0
  156. package/dist/teste/ColorPickerXs.test.d.ts +1 -0
  157. package/dist/teste/ColorPickerXs.test.js +21 -0
  158. package/dist/teste/DataTableArvoreEVariantes.test.d.ts +1 -0
  159. package/dist/teste/DataTableArvoreEVariantes.test.js +190 -0
  160. package/dist/teste/DataTableCelulaLivre.test.d.ts +1 -0
  161. package/dist/teste/DataTableCelulaLivre.test.js +76 -0
  162. package/dist/teste/DataTableDocumento.test.d.ts +1 -0
  163. package/dist/teste/DataTableDocumento.test.js +92 -0
  164. package/dist/teste/DatePicker.test.js +23 -0
  165. package/dist/teste/DescriptionListCompacta.test.d.ts +1 -0
  166. package/dist/teste/DescriptionListCompacta.test.js +22 -0
  167. package/dist/teste/EmptyStateTituloRico.test.d.ts +1 -0
  168. package/dist/teste/EmptyStateTituloRico.test.js +23 -0
  169. package/dist/teste/FileInputTrigger.test.d.ts +1 -0
  170. package/dist/teste/FileInputTrigger.test.js +53 -0
  171. package/dist/teste/IconPicker.test.d.ts +1 -0
  172. package/dist/teste/IconPicker.test.js +130 -0
  173. package/dist/teste/InputAgrupado.test.d.ts +1 -0
  174. package/dist/teste/InputAgrupado.test.js +24 -0
  175. package/dist/teste/InputMascaraEAfins.test.d.ts +1 -0
  176. package/dist/teste/InputMascaraEAfins.test.js +99 -0
  177. package/dist/teste/KbdCodeBlock.test.d.ts +1 -0
  178. package/dist/teste/KbdCodeBlock.test.js +95 -0
  179. package/dist/teste/List.test.d.ts +1 -0
  180. package/dist/teste/List.test.js +153 -0
  181. package/dist/teste/ListItemTooltipStandalone.test.d.ts +1 -0
  182. package/dist/teste/ListItemTooltipStandalone.test.js +39 -0
  183. package/dist/teste/ModalVariantes.test.d.ts +1 -0
  184. package/dist/teste/ModalVariantes.test.js +151 -0
  185. package/dist/teste/NomeAcessivelSsr.test.d.ts +1 -0
  186. package/dist/teste/NomeAcessivelSsr.test.js +88 -0
  187. package/dist/teste/OrgChart.test.d.ts +1 -0
  188. package/dist/teste/OrgChart.test.js +162 -0
  189. package/dist/teste/OtpInput.test.d.ts +1 -0
  190. package/dist/teste/OtpInput.test.js +143 -0
  191. package/dist/teste/PopoverMaxHeight.test.d.ts +1 -0
  192. package/dist/teste/PopoverMaxHeight.test.js +38 -0
  193. package/dist/teste/RichTextEditor.test.d.ts +1 -0
  194. package/dist/teste/RichTextEditor.test.js +287 -0
  195. package/dist/teste/RichTextEditorAlinhaImagemTabela.test.d.ts +1 -0
  196. package/dist/teste/RichTextEditorAlinhaImagemTabela.test.js +212 -0
  197. package/dist/teste/RichTextEditorEstiloDeTexto.test.d.ts +1 -0
  198. package/dist/teste/RichTextEditorEstiloDeTexto.test.js +120 -0
  199. package/dist/teste/SegmentedControlContador.test.d.ts +1 -0
  200. package/dist/teste/SegmentedControlContador.test.js +39 -0
  201. package/dist/teste/SelectAbertoControladoEFlutuante.test.d.ts +1 -0
  202. package/dist/teste/SelectAbertoControladoEFlutuante.test.js +145 -0
  203. package/dist/teste/SelectFiltroCorETamanho.test.d.ts +1 -0
  204. package/dist/teste/SelectFiltroCorETamanho.test.js +77 -0
  205. package/dist/teste/SelectPlacementFiltro.test.d.ts +1 -0
  206. package/dist/teste/SelectPlacementFiltro.test.js +88 -0
  207. package/dist/teste/Stack.test.d.ts +1 -0
  208. package/dist/teste/Stack.test.js +57 -0
  209. package/dist/teste/StatCardRotuloTopo.test.d.ts +1 -0
  210. package/dist/teste/StatCardRotuloTopo.test.js +34 -0
  211. package/dist/teste/StatCardSecundariaETom.test.d.ts +1 -0
  212. package/dist/teste/StatCardSecundariaETom.test.js +45 -0
  213. package/dist/teste/TabsContadorFechavel.test.d.ts +1 -0
  214. package/dist/teste/TabsContadorFechavel.test.js +79 -0
  215. package/dist/teste/ToastAcaoEDetalhes.test.d.ts +1 -0
  216. package/dist/teste/ToastAcaoEDetalhes.test.js +94 -0
  217. package/dist/teste/TooltipDark.test.d.ts +1 -0
  218. package/dist/teste/TooltipDark.test.js +31 -0
  219. package/dist/utils/calendario.d.ts +28 -0
  220. package/dist/utils/calendario.js +73 -0
  221. package/dist/utils/html-seguro.d.ts +45 -0
  222. package/dist/utils/html-seguro.js +208 -0
  223. package/dist/utils/paleta-de-cores.d.ts +26 -0
  224. package/dist/utils/paleta-de-cores.js +10 -0
  225. package/dist/utils/texto.d.ts +5 -0
  226. package/dist/utils/texto.js +5 -0
  227. package/dist/utils/toast.d.ts +10 -1
  228. package/dist/utils/toast.js +2 -1
  229. package/package.json +3 -3
  230. package/src/index.ts +26 -0
  231. package/src/teste/AILabel.test.tsx +41 -0
  232. package/src/teste/AccordionConteudoLivre.test.tsx +39 -0
  233. package/src/teste/AccordionTituloNeutro.test.tsx +25 -0
  234. package/src/teste/AppSubheaderRegiao.test.tsx +17 -0
  235. package/src/teste/AtributosRepassados.test.tsx +73 -0
  236. package/src/teste/AttachmentCardIA.test.tsx +126 -0
  237. package/src/teste/AttachmentCardLista.test.tsx +53 -0
  238. package/src/teste/AttachmentCardSm.test.tsx +29 -0
  239. package/src/teste/AvatarGroupOverlap.test.tsx +74 -0
  240. package/src/teste/BadgeNeutroColado.test.tsx +15 -0
  241. package/src/teste/BadgeTag.test.tsx +85 -0
  242. package/src/teste/BoxItemFlex.test.tsx +81 -0
  243. package/src/teste/BoxLayout.test.tsx +50 -0
  244. package/src/teste/Button.test.tsx +39 -0
  245. package/src/teste/Calendar.test.tsx +282 -0
  246. package/src/teste/CalendarCabecalho.test.tsx +11 -0
  247. package/src/teste/ChipsXs.test.tsx +41 -0
  248. package/src/teste/Coachmark.test.tsx +198 -0
  249. package/src/teste/CoachmarkSemVeu.test.tsx +101 -0
  250. package/src/teste/ColorPicker.test.tsx +153 -0
  251. package/src/teste/ColorPickerXs.test.tsx +22 -0
  252. package/src/teste/DataTableArvoreEVariantes.test.tsx +240 -0
  253. package/src/teste/DataTableCelulaLivre.test.tsx +103 -0
  254. package/src/teste/DataTableDocumento.test.tsx +102 -0
  255. package/src/teste/DatePicker.test.tsx +38 -0
  256. package/src/teste/DescriptionListCompacta.test.tsx +24 -0
  257. package/src/teste/EmptyStateTituloRico.test.tsx +34 -0
  258. package/src/teste/FileInputTrigger.test.tsx +89 -0
  259. package/src/teste/IconPicker.test.tsx +145 -0
  260. package/src/teste/InputAgrupado.test.tsx +26 -0
  261. package/src/teste/InputMascaraEAfins.test.tsx +124 -0
  262. package/src/teste/KbdCodeBlock.test.tsx +106 -0
  263. package/src/teste/List.test.tsx +269 -0
  264. package/src/teste/ListItemTooltipStandalone.test.tsx +64 -0
  265. package/src/teste/ModalVariantes.test.tsx +173 -0
  266. package/src/teste/NomeAcessivelSsr.test.tsx +110 -0
  267. package/src/teste/OrgChart.test.tsx +183 -0
  268. package/src/teste/OtpInput.test.tsx +163 -0
  269. package/src/teste/PopoverMaxHeight.test.tsx +47 -0
  270. package/src/teste/RichTextEditor.test.tsx +329 -0
  271. package/src/teste/RichTextEditorAlinhaImagemTabela.test.tsx +238 -0
  272. package/src/teste/RichTextEditorEstiloDeTexto.test.tsx +137 -0
  273. package/src/teste/SegmentedControlContador.test.tsx +43 -0
  274. package/src/teste/SelectAbertoControladoEFlutuante.test.tsx +180 -0
  275. package/src/teste/SelectFiltroCorETamanho.test.tsx +90 -0
  276. package/src/teste/SelectPlacementFiltro.test.tsx +110 -0
  277. package/src/teste/Stack.test.tsx +80 -0
  278. package/src/teste/StatCardRotuloTopo.test.tsx +44 -0
  279. package/src/teste/StatCardSecundariaETom.test.tsx +51 -0
  280. package/src/teste/TabsContadorFechavel.test.tsx +144 -0
  281. package/src/teste/ToastAcaoEDetalhes.test.tsx +109 -0
  282. package/src/teste/TooltipDark.test.tsx +51 -0
  283. package/src/utils/calendario.ts +78 -0
  284. package/src/utils/html-seguro.ts +197 -0
  285. package/src/utils/paleta-de-cores.ts +34 -0
  286. package/src/utils/texto.ts +5 -0
  287. package/src/utils/toast.ts +12 -2
@@ -1,17 +1,255 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import './DataTable.css';
4
- import { faSort, faSortUp, faSortDown, faInbox, } from "@fortawesome/free-solid-svg-icons";
4
+ import * as React from "react";
5
+ import { useState } from "react";
6
+ import { faSort, faSortUp, faSortDown, faInbox, faChevronRight, faChevronDown, } from "@fortawesome/free-solid-svg-icons";
5
7
  import Icon from "../Icon/Icon";
6
8
  import Checkbox from "../Checkbox/Checkbox";
7
9
  function DataTable(props) {
10
+ const [expandedState, setExpandedState] = useState(() => Array());
11
+ const [expandTouched, setExpandTouched] = useState(() => false);
12
+ const [activeRow, setActiveRow] = useState(() => 0);
8
13
  function columnsList() {
9
14
  return props.columns || [];
10
15
  }
11
16
  function rows() {
17
+ if (props.treeData)
18
+ return treeNodes().map((node) => node.row);
12
19
  return props.data || [];
13
20
  }
14
- function selected() {
21
+ function childField() {
22
+ return props.childrenKey || "children";
23
+ }
24
+ function isOpenKey(key, todas) {
25
+ if (todas)
26
+ return true;
27
+ if (props.expandedKeys)
28
+ return props.expandedKeys.includes(key);
29
+ if (expandTouched)
30
+ return expandedState.includes(key);
31
+ if (props.defaultExpandAll)
32
+ return true;
33
+ return (props.defaultExpandedKeys || []).includes(key);
34
+ }
35
+ function flatten(todas) {
36
+ const raizes = props.data || [];
37
+ const saida = [];
38
+ const pilha = [];
39
+ for (let r = raizes.length - 1; r >= 0; r--) {
40
+ pilha.push({
41
+ row: raizes[r],
42
+ level: 0,
43
+ pos: r,
44
+ size: raizes.length,
45
+ path: String(r),
46
+ guides: [],
47
+ });
48
+ }
49
+ while (pilha.length > 0) {
50
+ const item = pilha.pop();
51
+ const filhas = item.row[childField()];
52
+ const hasKids = Array.isArray(filhas) && filhas.length > 0;
53
+ const chave = typeof props.rowKey === "function"
54
+ ? props.rowKey(item.row)
55
+ : props.rowKey
56
+ ? item.row[props.rowKey]
57
+ : item.path;
58
+ const open = hasKids && isOpenKey(chave, todas);
59
+ saida.push({
60
+ row: item.row,
61
+ level: item.level,
62
+ key: chave,
63
+ hasKids,
64
+ open,
65
+ pos: item.pos + 1,
66
+ size: item.size,
67
+ guides: item.guides,
68
+ });
69
+ if (open) {
70
+ // Para as filhas, o guia do PRÓPRIO nó vira a linha que continua (tem irmã depois) ou some.
71
+ const base = item.guides.map((g, gi) => gi === item.guides.length - 1 ? (g === "tee" ? "line" : "none") : g);
72
+ for (let c = filhas.length - 1; c >= 0; c--) {
73
+ pilha.push({
74
+ row: filhas[c],
75
+ level: item.level + 1,
76
+ pos: c,
77
+ size: filhas.length,
78
+ path: item.path + "." + c,
79
+ guides: [...base, c === filhas.length - 1 ? "elbow" : "tee"],
80
+ });
81
+ }
82
+ }
83
+ }
84
+ return saida;
85
+ }
86
+ function treeNodes() {
87
+ if (!props.treeData)
88
+ return [];
89
+ return flatten(false);
90
+ }
91
+ function nodeAt(index) {
92
+ return treeNodes()[index];
93
+ }
94
+ function allParentKeys() {
95
+ return flatten(true)
96
+ .filter((node) => node.hasKids)
97
+ .map((node) => node.key);
98
+ }
99
+ function currentExpanded() {
100
+ if (props.expandedKeys)
101
+ return props.expandedKeys;
102
+ if (expandTouched)
103
+ return expandedState;
104
+ if (props.defaultExpandAll)
105
+ return allParentKeys();
106
+ return props.defaultExpandedKeys || [];
107
+ }
108
+ function toggleNode(index, abrir) {
109
+ const node = nodeAt(index);
110
+ if (!node || !node.hasKids)
111
+ return;
112
+ const vaiAbrir = typeof abrir === "boolean" ? abrir : !node.open;
113
+ if (vaiAbrir === node.open)
114
+ return;
115
+ const atuais = currentExpanded();
116
+ const proximas = vaiAbrir
117
+ ? [...atuais, node.key]
118
+ : atuais.filter((k) => k !== node.key);
119
+ setExpandedState(proximas);
120
+ setExpandTouched(true);
121
+ if (props.onExpand)
122
+ props.onExpand(proximas, node.row, vaiAbrir);
123
+ }
124
+ function handleToggleClick(index, event) {
125
+ if (event)
126
+ event.stopPropagation();
127
+ toggleNode(index);
128
+ }
129
+ function treeLevel(index) {
130
+ if (!props.treeData)
131
+ return undefined;
132
+ const node = nodeAt(index);
133
+ return node ? node.level + 1 : undefined;
134
+ }
135
+ function treePosInSet(index) {
136
+ if (!props.treeData)
137
+ return undefined;
138
+ const node = nodeAt(index);
139
+ return node ? node.pos : undefined;
140
+ }
141
+ function treeSetSize(index) {
142
+ if (!props.treeData)
143
+ return undefined;
144
+ const node = nodeAt(index);
145
+ return node ? node.size : undefined;
146
+ }
147
+ function treeExpanded(index) {
148
+ if (!props.treeData)
149
+ return undefined;
150
+ const node = nodeAt(index);
151
+ if (!node || !node.hasKids)
152
+ return undefined;
153
+ return node.open ? "true" : "false";
154
+ }
155
+ function treeHasKids(index) {
156
+ const node = nodeAt(index);
157
+ return !!node && node.hasKids;
158
+ }
159
+ function treeOpen(index) {
160
+ const node = nodeAt(index);
161
+ return !!node && node.open;
162
+ }
163
+ function isTreeCell(colIndex) {
164
+ return !!props.treeData && colIndex === 0;
165
+ }
166
+ function guidesOf(index) {
167
+ const node = nodeAt(index);
168
+ // Tipado na variável: o Mitosis tira a anotação de retorno, e sem ela o `map` do JSX fica com parâmetros `any` implícitos.
169
+ const guias = node ? node.guides : [];
170
+ return guias;
171
+ }
172
+ function guideClass(guia) {
173
+ return "umds-datatable__guide umds-datatable__guide--" + guia;
174
+ }
175
+ function indentOf(index) {
176
+ const node = nodeAt(index);
177
+ return ("calc(" +
178
+ (node ? node.level : 0) +
179
+ " * var(--umds-primitive-spacing-xxs))");
180
+ }
181
+ function toggleLabel(index) {
182
+ return treeOpen(index)
183
+ ? props.collapseLabel || "Recolher"
184
+ : props.expandLabel || "Expandir";
185
+ }
186
+ function treeToggleIcon(index) {
187
+ return treeOpen(index) ? faChevronDown : faChevronRight;
188
+ }
189
+ function parentIndexOf(index) {
190
+ const nos = treeNodes();
191
+ const nivel = nos[index] ? nos[index].level : 0;
192
+ for (let i = index - 1; i >= 0; i--) {
193
+ if (nos[i].level < nivel)
194
+ return i;
195
+ }
196
+ return -1;
197
+ }
198
+ function focusRowAt(atual, index) {
199
+ const linhas = atual.parentElement
200
+ ? atual.parentElement.querySelectorAll("tr[aria-level]")
201
+ : [];
202
+ const alvo = linhas[index];
203
+ if (alvo)
204
+ alvo.focus();
205
+ }
206
+ function handleTreeKey(index, event) {
207
+ const total = treeNodes().length;
208
+ const k = event.key;
209
+ const atual = event.currentTarget;
210
+ let alvo = -2;
211
+ if (k === "ArrowDown")
212
+ alvo = Math.min(index + 1, total - 1);
213
+ else if (k === "ArrowUp")
214
+ alvo = Math.max(index - 1, 0);
215
+ else if (k === "Home")
216
+ alvo = 0;
217
+ else if (k === "End")
218
+ alvo = total - 1;
219
+ else if (k === "ArrowRight") {
220
+ if (!treeHasKids(index))
221
+ return false;
222
+ if (!treeOpen(index)) {
223
+ toggleNode(index, true);
224
+ event.preventDefault();
225
+ return true;
226
+ }
227
+ alvo = index + 1;
228
+ }
229
+ else if (k === "ArrowLeft") {
230
+ if (treeHasKids(index) && treeOpen(index)) {
231
+ toggleNode(index, false);
232
+ event.preventDefault();
233
+ return true;
234
+ }
235
+ alvo = parentIndexOf(index);
236
+ if (alvo < 0)
237
+ return false;
238
+ }
239
+ else {
240
+ return false;
241
+ }
242
+ event.preventDefault();
243
+ if (alvo >= 0)
244
+ focusRowAt(atual, alvo);
245
+ return true;
246
+ }
247
+ function handleRowFocus(index, event) {
248
+ if (!props.treeData || !event || event.target !== event.currentTarget)
249
+ return;
250
+ setActiveRow(index);
251
+ }
252
+ function selectedIndexes() {
15
253
  return props.selectedRows || [];
16
254
  }
17
255
  function selectedKeysList() {
@@ -20,10 +258,22 @@ function DataTable(props) {
20
258
  function usesKeys() {
21
259
  return !!props.rowKey;
22
260
  }
261
+ function isDocument() {
262
+ return props.variant === "document";
263
+ }
264
+ function canSelect() {
265
+ return !!props.selectable && props.variant !== "document";
266
+ }
23
267
  function tableClasses() {
24
268
  return [
25
269
  "umds-datatable",
270
+ props.variant === "document" ? "umds-datatable--document" : "",
26
271
  props.density === "compact" ? "umds-datatable--compact" : "",
272
+ props.headerVariant === "dark" ? "umds-datatable--header-dark" : "",
273
+ props.headerUppercase ? "umds-datatable--header-uppercase" : "",
274
+ props.hideHeader ? "umds-datatable--header-hidden" : "",
275
+ props.striped ? "umds-datatable--striped" : "",
276
+ props.treeData ? "umds-datatable--tree" : "",
27
277
  props.className,
28
278
  ]
29
279
  .filter(Boolean)
@@ -43,8 +293,31 @@ function DataTable(props) {
43
293
  function hasRows() {
44
294
  return !props.loading && rows().length > 0;
45
295
  }
296
+ function groupOf(row, index) {
297
+ if (!props.rowGroup)
298
+ return "";
299
+ const bruto = typeof props.rowGroup === "function"
300
+ ? props.rowGroup(row, index)
301
+ : row[props.rowGroup];
302
+ return bruto === undefined || bruto === null ? "" : String(bruto);
303
+ }
304
+ function newGroupLabel(index) {
305
+ if (!props.rowGroup)
306
+ return "";
307
+ const atual = groupOf(rows()[index], index);
308
+ if (!atual)
309
+ return "";
310
+ if (index === 0)
311
+ return atual;
312
+ return groupOf(rows()[index - 1], index - 1) === atual ? "" : atual;
313
+ }
314
+ function groupContent(label, row, index) {
315
+ if (props.renderRowGroup)
316
+ return props.renderRowGroup(label, row, index);
317
+ return label;
318
+ }
46
319
  function colSpan() {
47
- return columnsList().length + (props.selectable ? 1 : 0);
320
+ return columnsList().length + (canSelect() ? 1 : 0);
48
321
  }
49
322
  function rowKeyOf(row, index) {
50
323
  if (typeof props.rowKey === "function")
@@ -59,17 +332,17 @@ function DataTable(props) {
59
332
  if (usesKeys()) {
60
333
  return rows().every((row, i) => selectedKeysList().includes(rowKeyOf(row, i)));
61
334
  }
62
- return selected().length === rows().length;
335
+ return selectedIndexes().length === rows().length;
63
336
  }
64
337
  function someSelected() {
65
338
  if (usesKeys()) {
66
339
  return (!allSelected() &&
67
340
  rows().some((row, i) => selectedKeysList().includes(rowKeyOf(row, i))));
68
341
  }
69
- return selected().length > 0 && !allSelected();
342
+ return selectedIndexes().length > 0 && !allSelected();
70
343
  }
71
344
  function handleSort(col) {
72
- if (!col.sortable)
345
+ if (!col.sortable || props.variant === "document")
73
346
  return;
74
347
  const dir = props.sortKey === col.key && props.sortDirection === "asc"
75
348
  ? "desc"
@@ -110,7 +383,7 @@ function DataTable(props) {
110
383
  const nextKeys = current.includes(key)
111
384
  ? current.filter((k) => k !== key)
112
385
  : [...current, key];
113
- const currentIdx = selected();
386
+ const currentIdx = selectedIndexes();
114
387
  const nextIdx = currentIdx.includes(index)
115
388
  ? currentIdx.filter((i) => i !== index)
116
389
  : [...currentIdx, index];
@@ -119,7 +392,7 @@ function DataTable(props) {
119
392
  }
120
393
  if (!props.onSelect)
121
394
  return;
122
- const current = selected();
395
+ const current = selectedIndexes();
123
396
  const next = current.includes(index)
124
397
  ? current.filter((i) => i !== index)
125
398
  : [...current, index];
@@ -129,19 +402,38 @@ function DataTable(props) {
129
402
  if (usesKeys()) {
130
403
  return selectedKeysList().includes(rowKeyOf(row, index));
131
404
  }
132
- return selected().includes(index);
405
+ return selectedIndexes().includes(index);
133
406
  }
134
407
  function cellContent(col, row, rowIndex) {
135
408
  if (col.render)
136
409
  return col.render(row, rowIndex);
137
410
  return row[col.key];
138
411
  }
412
+ function isHighlighted(row, index) {
413
+ if (props.isRowSelected && props.isRowSelected(row, index))
414
+ return true;
415
+ if (props.selectedRowKeys && props.rowKey) {
416
+ return props.selectedRowKeys.includes(rowKeyOf(row, index));
417
+ }
418
+ return false;
419
+ }
420
+ function ariaSelectedRow(row, index) {
421
+ return isHighlighted(row, index) ? "true" : undefined;
422
+ }
139
423
  function handleRowClick(rowIndex, row) {
424
+ if (props.variant === "document")
425
+ return;
140
426
  if (props.onRowClick)
141
427
  props.onRowClick(rowIndex, row);
142
428
  }
143
429
  function aoTeclarNaLinha(rowIndex, row, event) {
144
- if (!props.onRowClick || !event)
430
+ if (props.treeData &&
431
+ event &&
432
+ event.target === event.currentTarget &&
433
+ handleTreeKey(rowIndex, event)) {
434
+ return;
435
+ }
436
+ if (!props.onRowClick || props.variant === "document" || !event)
145
437
  return;
146
438
  // Só a própria linha aciona. Sem esta guarda, o Espaço dentro do
147
439
  // checkbox de seleção era engolido pelo preventDefault abaixo e a
@@ -156,8 +448,11 @@ function DataTable(props) {
156
448
  event.preventDefault();
157
449
  handleRowClick(rowIndex, row);
158
450
  }
159
- function rowTabIndex() {
160
- return props.onRowClick ? 0 : undefined;
451
+ function rowTabIndexAt(index) {
452
+ if (props.treeData) {
453
+ return index === Math.min(activeRow, treeNodes().length - 1) ? 0 : -1;
454
+ }
455
+ return props.onRowClick && props.variant !== "document" ? 0 : undefined;
161
456
  }
162
457
  function rowRole() {
163
458
  return undefined;
@@ -167,17 +462,26 @@ function DataTable(props) {
167
462
  return props.selectRowLabel(index + 1);
168
463
  return "Selecionar linha " + (index + 1);
169
464
  }
465
+ function tableRole() {
466
+ return props.treeData ? "treegrid" : undefined;
467
+ }
170
468
  function thClasses(col) {
171
469
  return [
172
470
  "umds-datatable__th",
173
- col.sortable ? "umds-datatable__th--sortable" : "",
174
- props.sortKey === col.key ? "umds-datatable__th--sorted" : "",
471
+ col.sortable && props.variant !== "document"
472
+ ? "umds-datatable__th--sortable"
473
+ : "",
474
+ props.sortKey === col.key && props.variant !== "document"
475
+ ? "umds-datatable__th--sorted"
476
+ : "",
175
477
  col.align ? `umds-datatable__th--${col.align}` : "",
176
478
  ]
177
479
  .filter(Boolean)
178
480
  .join(" ");
179
481
  }
180
482
  function ariaSort(col) {
483
+ if (props.variant === "document")
484
+ return undefined;
181
485
  if (props.sortKey !== col.key)
182
486
  return "none";
183
487
  return props.sortDirection === "asc" ? "ascending" : "descending";
@@ -195,10 +499,14 @@ function DataTable(props) {
195
499
  return faSort;
196
500
  return props.sortDirection === "desc" ? faSortDown : faSortUp;
197
501
  }
198
- function tdClasses(col) {
502
+ function sortableCol(col) {
503
+ return !!col.sortable && props.variant !== "document";
504
+ }
505
+ function tdClasses(col, colIndex) {
199
506
  return [
200
507
  "umds-datatable__td",
201
508
  col.align ? `umds-datatable__td--${col.align}` : "",
509
+ isTreeCell(colIndex) ? "umds-datatable__td--tree" : "",
202
510
  ]
203
511
  .filter(Boolean)
204
512
  .join(" ");
@@ -206,16 +514,24 @@ function DataTable(props) {
206
514
  function rowClasses(row, rowIdx) {
207
515
  return [
208
516
  "umds-datatable__row",
209
- isSelected(row, rowIdx) ? "umds-datatable__row--selected" : "",
210
- props.onRowClick ? "umds-datatable__row--clickable" : "",
517
+ isSelected(row, rowIdx) || isHighlighted(row, rowIdx)
518
+ ? "umds-datatable__row--selected"
519
+ : "",
520
+ isHighlighted(row, rowIdx) ? "umds-datatable__row--highlighted" : "",
521
+ props.striped && rowIdx % 2 === 1 ? "umds-datatable__row--striped" : "",
522
+ props.onRowClick && props.variant !== "document"
523
+ ? "umds-datatable__row--clickable"
524
+ : "",
211
525
  ]
212
526
  .filter(Boolean)
213
527
  .join(" ");
214
528
  }
215
- return (_jsx("div", { className: tableClasses(), children: _jsxs("table", { className: "umds-datatable__table", "aria-busy": props.loading, children: [_jsx("thead", { className: "umds-datatable__thead", children: _jsxs("tr", { children: [props.selectable ? (_jsx("th", { scope: "col", className: "umds-datatable__th umds-datatable__th--checkbox", children: _jsx(Checkbox, { checked: allSelected(), indeterminate: someSelected(), ariaLabel: props.selectAllLabel || "Selecionar todas as linhas", onChange: (event) => toggleAll() }) })) : null, columnsList()?.map((col) => (_jsxs("th", { scope: "col", style: col.width
529
+ return (_jsx("div", { className: tableClasses(), children: _jsxs("table", { className: "umds-datatable__table", "aria-busy": props.loading, role: tableRole(), children: [_jsx("thead", { className: "umds-datatable__thead", children: _jsxs("tr", { children: [canSelect() ? (_jsx("th", { scope: "col", className: "umds-datatable__th umds-datatable__th--checkbox", children: _jsx(Checkbox, { checked: allSelected(), indeterminate: someSelected(), ariaLabel: props.selectAllLabel || "Selecionar todas as linhas", onChange: (event) => toggleAll() }) })) : null, columnsList()?.map((col) => (_jsxs("th", { scope: "col", style: col.width
216
530
  ? {
217
531
  width: col.width,
218
532
  }
219
- : {}, "aria-sort": ariaSort(col), className: thClasses(col), children: [col.sortable ? (_jsxs("button", { type: "button", className: "umds-datatable__sort-button umds-datatable__th-content", onClick: (event) => handleSort(col), children: [col.label, _jsx("span", { "aria-hidden": "true", className: sortIconClasses(col), children: _jsx(Icon, { variant: "inherit", customSize: "12px", icon: sortIconName(col) }) })] })) : null, !col.sortable ? (_jsx("span", { className: "umds-datatable__th-content", children: col.label })) : null] }, col.key)))] }) }), _jsxs("tbody", { className: "umds-datatable__tbody", children: [props.loading ? (_jsx(_Fragment, { children: skeletonRowsList()?.map((_, rowIdx) => (_jsxs("tr", { className: "umds-datatable__row umds-datatable__row--skeleton", children: [props.selectable ? (_jsx("td", { className: "umds-datatable__td umds-datatable__td--checkbox", children: _jsx("div", { className: "umds-datatable__skeleton umds-datatable__skeleton--checkbox" }) })) : null, columnsList()?.map((col) => (_jsx("td", { className: "umds-datatable__td", children: _jsx("div", { className: "umds-datatable__skeleton" }) }, col.key)))] }, `sk-${rowIdx}`))) })) : null, isEmpty() ? (_jsx("tr", { className: "umds-datatable__row--empty", children: _jsx("td", { className: "umds-datatable__td umds-datatable__td--empty", colSpan: colSpan(), children: _jsxs("div", { className: "umds-datatable__empty", children: [_jsx("span", { "aria-hidden": "true", className: "umds-datatable__empty-icon", children: _jsx(Icon, { variant: "inherit", customSize: "48px", icon: faInbox }) }), _jsx("span", { children: props.emptyMessage || "Nenhum registro encontrado" })] }) }) })) : null, hasRows() ? (_jsx(_Fragment, { children: rows()?.map((row, rowIdx) => (_jsxs("tr", { onClick: (event) => handleRowClick(rowIdx, row), onKeyDown: (event) => aoTeclarNaLinha(rowIdx, row, event), tabIndex: rowTabIndex(), role: rowRole(), className: rowClasses(row, rowIdx), children: [props.selectable ? (_jsx("td", { className: "umds-datatable__td umds-datatable__td--checkbox", onClick: (event) => event.stopPropagation(), children: _jsx(Checkbox, { checked: isSelected(row, rowIdx), ariaLabel: rowSelectLabel(rowIdx), onChange: (event) => toggleRow(row, rowIdx) }) })) : null, columnsList()?.map((col) => (_jsx("td", { className: tdClasses(col), children: cellContent(col, row, rowIdx) }, col.key)))] }, rowIdx))) })) : null] })] }) }));
533
+ : {}, "aria-sort": ariaSort(col), className: thClasses(col), children: [sortableCol(col) ? (_jsxs("button", { type: "button", className: "umds-datatable__sort-button umds-datatable__th-content", onClick: (event) => handleSort(col), children: [col.label, _jsx("span", { "aria-hidden": "true", className: sortIconClasses(col), children: _jsx(Icon, { variant: "inherit", customSize: "12px", icon: sortIconName(col) }) })] })) : null, !sortableCol(col) ? (_jsx("span", { className: "umds-datatable__th-content", children: col.label })) : null] }, col.key)))] }) }), _jsxs("tbody", { className: "umds-datatable__tbody", children: [props.loading ? (_jsx(_Fragment, { children: skeletonRowsList()?.map((_, rowIdx) => (_jsxs("tr", { className: "umds-datatable__row umds-datatable__row--skeleton", children: [canSelect() ? (_jsx("td", { className: "umds-datatable__td umds-datatable__td--checkbox", children: _jsx("div", { className: "umds-datatable__skeleton umds-datatable__skeleton--checkbox" }) })) : null, columnsList()?.map((col) => (_jsx("td", { className: "umds-datatable__td", children: _jsx("div", { className: "umds-datatable__skeleton" }) }, col.key)))] }, `sk-${rowIdx}`))) })) : null, isEmpty() ? (_jsx("tr", { className: "umds-datatable__row--empty", children: _jsx("td", { className: "umds-datatable__td umds-datatable__td--empty", colSpan: colSpan(), children: _jsxs("div", { className: "umds-datatable__empty", children: [_jsx("span", { "aria-hidden": "true", className: "umds-datatable__empty-icon", children: _jsx(Icon, { variant: "inherit", customSize: "48px", icon: props.emptyIcon || faInbox }) }), _jsx("span", { children: props.emptyMessage || "Nenhum registro encontrado" }), !!props.emptyDescription ? (_jsx("span", { className: "umds-datatable__empty-desc", children: props.emptyDescription })) : null] }) }) })) : null, hasRows() ? (_jsx(_Fragment, { children: rows()?.map((row, rowIdx) => (_jsxs(React.Fragment, { children: [newGroupLabel(rowIdx) ? (_jsx("tr", { className: "umds-datatable__row umds-datatable__row--group", children: _jsx("th", { scope: "rowgroup", className: "umds-datatable__group", colSpan: colSpan(), children: groupContent(newGroupLabel(rowIdx), row, rowIdx) }) })) : null, _jsxs("tr", { onClick: (event) => handleRowClick(rowIdx, row), onKeyDown: (event) => aoTeclarNaLinha(rowIdx, row, event), onFocus: (event) => handleRowFocus(rowIdx, event), tabIndex: rowTabIndexAt(rowIdx), role: rowRole(), "aria-selected": ariaSelectedRow(row, rowIdx), "aria-level": treeLevel(rowIdx), "aria-posinset": treePosInSet(rowIdx), "aria-setsize": treeSetSize(rowIdx), "aria-expanded": treeExpanded(rowIdx), className: rowClasses(row, rowIdx), children: [canSelect() ? (_jsx("td", { className: "umds-datatable__td umds-datatable__td--checkbox", onClick: (event) => event.stopPropagation(), children: _jsx(Checkbox, { checked: isSelected(row, rowIdx), ariaLabel: rowSelectLabel(rowIdx), onChange: (event) => toggleRow(row, rowIdx) }) })) : null, columnsList()?.map((col, colIdx) => (_jsxs("td", { className: tdClasses(col, colIdx), children: [isTreeCell(colIdx) ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", className: "umds-datatable__tree-guides", children: guidesOf(rowIdx)?.map((guia, guiaIdx) => (_jsx("span", { className: guideClass(guia) }, guiaIdx))) }), _jsxs("div", { className: "umds-datatable__tree-content", style: {
534
+ paddingLeft: indentOf(rowIdx),
535
+ }, children: [treeHasKids(rowIdx) ? (_jsx("button", { type: "button", className: "umds-datatable__tree-toggle", tabIndex: -1, "aria-label": toggleLabel(rowIdx), onClick: (event) => handleToggleClick(rowIdx, event), children: _jsx(Icon, { variant: "inherit", customSize: "12px", icon: treeToggleIcon(rowIdx) }) })) : null, !treeHasKids(rowIdx) ? (_jsx("span", { "aria-hidden": "true", className: "umds-datatable__tree-spacer" })) : null, _jsx("div", { className: "umds-datatable__tree-text", children: cellContent(col, row, rowIdx) })] })] })) : null, !isTreeCell(colIdx) ? (_jsx(_Fragment, { children: cellContent(col, row, rowIdx) })) : null] }, col.key)))] })] }, rowIdx))) })) : null] })] }) }));
220
536
  }
221
537
  export default DataTable;
@@ -156,6 +156,14 @@
156
156
  background-color: var(--umds-semantic-field-readonly-background);
157
157
  }
158
158
 
159
+ /* Somente leitura não é desabilitado: o texto segue lido e o WCAG 1.4.3 vale
160
+ sem isenção. O placeholder padrão foi calibrado para fundo branco e cai para
161
+ ~4,2:1 sobre o fundo de somente leitura; neutral-dark-down passa 4,5:1 em
162
+ todos os temas (1doc 6,78:1 · 1doc-dark 10,83:1 · alto contraste 16,48:1). */
163
+ .umds-datepicker--readonly .umds-datepicker__placeholder {
164
+ color: var(--umds-semantic-color-neutral-dark-down);
165
+ }
166
+
159
167
  /* ── Wrapper flutuante (Portal no body; posicionado pelo floating-ui via style inline) ── */
160
168
  .umds-datepicker__floating {
161
169
  display: block;
@@ -34,14 +34,21 @@ function DatePicker(props) {
34
34
  const [viewYear, setViewYear] = useState(() => 0);
35
35
  const [viewMonth, setViewMonth] = useState(() => 0);
36
36
  const [uid, setUid] = useState(() => "umds-datepicker-" + Math.random().toString(36).slice(2, 9));
37
- const [internalFrom, setInternalFrom] = useState(() => (props.defaultRange && props.defaultRange.from) || "");
37
+ const [internalFrom, setInternalFrom] = useState(() => props.mode !== "range" && props.defaultValue
38
+ ? props.defaultValue
39
+ : (props.defaultRange && props.defaultRange.from) || "");
38
40
  const [internalTo, setInternalTo] = useState(() => (props.defaultRange && props.defaultRange.to) || "");
39
41
  const [hoverIso, setHoverIso] = useState(() => "");
40
42
  const [focusedIso, setFocusedIso] = useState(() => "");
41
43
  function currentFrom() {
44
+ if (props.mode !== "range" && props.value !== undefined) {
45
+ return props.value || "";
46
+ }
42
47
  return props.range !== undefined ? props.range.from || "" : internalFrom;
43
48
  }
44
49
  function currentTo() {
50
+ if (props.mode !== "range" && props.value !== undefined)
51
+ return "";
45
52
  return props.range !== undefined ? props.range.to || "" : internalTo;
46
53
  }
47
54
  function monthNames() {
@@ -491,6 +498,8 @@ function DatePicker(props) {
491
498
  }
492
499
  function handleKeydown(event) {
493
500
  if (event && event.key === "Escape" && open) {
501
+ // O Esc é do calendário (fecha só ele): o Modal em volta não reage.
502
+ event.preventDefault();
494
503
  closeCalendar();
495
504
  }
496
505
  }
@@ -0,0 +1,127 @@
1
+ /* ─────────────────────────────────────────────
2
+ DESCRIPTION LIST
3
+ Pares rótulo/valor de um documento, em <dl>.
4
+
5
+ inline: grade de bordas finas, rótulo pintado à esquerda, sem cabeçalho.
6
+ As linhas viram `display: contents` para as duas colunas alinharem
7
+ entre todos os pares; as bordas são as linhas de 1px que a grade
8
+ deixa entre as células (o fundo da lista é a cor da borda).
9
+ stacked: rótulo pequeno em cima, valor embaixo, em até 4 colunas.
10
+
11
+ Cores: semânticos · Medidas: primitivos
12
+ ───────────────────────────────────────────── */
13
+
14
+ .umds-description-list {
15
+ margin: 0;
16
+ padding: 0;
17
+ font-family: var(--umds-semantic-font-family-base);
18
+ font-size: var(--umds-primitive-font-size-xxs); /* 14px */
19
+ color: var(--umds-semantic-color-neutral-dark-pure);
20
+ }
21
+
22
+ .umds-description-list__term,
23
+ .umds-description-list__description {
24
+ margin: 0;
25
+ overflow-wrap: anywhere;
26
+ }
27
+
28
+ /* ── inline ── */
29
+ .umds-description-list--inline {
30
+ display: grid;
31
+ grid-template-columns: max-content minmax(0, 1fr);
32
+ gap: var(--umds-primitive-border-width-hairline);
33
+ border: var(--umds-primitive-border-width-hairline) solid var(--umds-semantic-color-neutral-light-medium);
34
+ background: var(--umds-semantic-color-neutral-light-medium);
35
+ }
36
+
37
+ .umds-description-list--inline.umds-description-list--fit {
38
+ display: inline-grid;
39
+ }
40
+
41
+ .umds-description-list--inline .umds-description-list__item {
42
+ display: contents;
43
+ }
44
+
45
+ .umds-description-list--inline .umds-description-list__term,
46
+ .umds-description-list--inline .umds-description-list__description {
47
+ padding: var(--umds-primitive-spacing-quarck) var(--umds-primitive-spacing-nano); /* 4px 8px */
48
+ }
49
+
50
+ /* O rótulo é a coluna pintada: sem negrito e sem quebra. */
51
+ .umds-description-list--inline .umds-description-list__term {
52
+ background: var(--umds-semantic-color-background-light);
53
+ color: var(--umds-semantic-color-neutral-dark-down);
54
+ font-weight: var(--umds-primitive-font-weight-regular);
55
+ white-space: nowrap;
56
+ }
57
+
58
+ .umds-description-list--inline .umds-description-list__description {
59
+ background: var(--umds-semantic-color-background-white);
60
+ }
61
+
62
+ /* ── stacked ── */
63
+ .umds-description-list--stacked {
64
+ display: grid;
65
+ gap: var(--umds-primitive-spacing-xxxs); /* 16px */
66
+ }
67
+
68
+ .umds-description-list--cols-1 { grid-template-columns: minmax(0, 1fr); }
69
+ .umds-description-list--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
70
+ .umds-description-list--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
71
+ .umds-description-list--cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
72
+
73
+ .umds-description-list--stacked .umds-description-list__item {
74
+ display: flex;
75
+ flex-direction: column;
76
+ gap: var(--umds-primitive-spacing-quarck); /* 4px */
77
+ min-width: 0;
78
+ }
79
+
80
+ .umds-description-list--stacked .umds-description-list__term {
81
+ font-size: var(--umds-primitive-font-size-xxxs); /* 12px */
82
+ font-weight: var(--umds-primitive-font-weight-semibold);
83
+ color: var(--umds-semantic-color-neutral-dark-down);
84
+ }
85
+
86
+ .umds-description-list--bordered .umds-description-list__description {
87
+ padding: var(--umds-primitive-spacing-nano) var(--umds-primitive-spacing-mini); /* 8px 12px */
88
+ border: var(--umds-primitive-border-width-hairline) solid var(--umds-semantic-color-neutral-light-medium);
89
+ border-radius: var(--umds-primitive-border-radius-sm);
90
+ background: var(--umds-semantic-field-readonly-background);
91
+ }
92
+
93
+ /* ── Compacta (density="compact"): a fonte de 12px do CrisDoc ──
94
+ O rótulo do `stacked` já é 12px; o valor desce de 14 para 12. */
95
+ .umds-description-list--compact {
96
+ font-size: var(--umds-primitive-font-size-xxxs); /* 12px */
97
+ }
98
+
99
+ .umds-description-list--compact.umds-description-list--stacked {
100
+ gap: var(--umds-primitive-spacing-mini); /* 12px */
101
+ }
102
+
103
+ .umds-description-list--compact.umds-description-list--bordered .umds-description-list__description {
104
+ padding: var(--umds-primitive-spacing-quarck) var(--umds-primitive-spacing-nano); /* 4px 8px */
105
+ }
106
+
107
+ /* Telas estreitas: o stacked vira uma coluna só. */
108
+ @media (max-width: 640px) {
109
+ .umds-description-list--cols-2,
110
+ .umds-description-list--cols-3,
111
+ .umds-description-list--cols-4 {
112
+ grid-template-columns: minmax(0, 1fr);
113
+ }
114
+ }
115
+
116
+ /* ── Impressão: o par não é cortado entre duas páginas e a cor do rótulo sai ── */
117
+ @media print {
118
+ .umds-description-list {
119
+ -webkit-print-color-adjust: exact;
120
+ print-color-adjust: exact;
121
+ }
122
+
123
+ .umds-description-list__item {
124
+ break-inside: avoid;
125
+ page-break-inside: avoid;
126
+ }
127
+ }