@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
@@ -0,0 +1,87 @@
1
+ import './Coachmark.css';
2
+ /**
3
+ * Passo do tour.
4
+ * @property {string} id - Identidade do passo (opcional)
5
+ * @property {any} target - O que o passo aponta: seletor CSS (`"#aba-fluxos"`), elemento, ref do React (`{ current }`), ref do Vue (`{ value }`) ou função que devolve um deles. Sem alvo (ou alvo que não existe na tela), o cartão fica no centro e a página inteira escurece.
6
+ * @property {string} title - Título do passo
7
+ * @property {string} content - Texto do passo
8
+ * @property {string} placement - Lado do cartão em relação ao alvo: 'top' | 'bottom' | 'left' | 'right' (padrão 'bottom'; inverte sozinho se não couber)
9
+ */
10
+ export interface CoachmarkStep {
11
+ id?: string;
12
+ target?: any;
13
+ title: string;
14
+ content?: string;
15
+ placement?: "top" | "bottom" | "left" | "right";
16
+ [key: string]: any;
17
+ }
18
+ /**
19
+ * Coachmark — tour guiado: uma sequência de passos, cada um apontando um
20
+ * elemento da tela com um cartão, enquanto o resto da página escurece e o
21
+ * elemento fica destacado num recorte.
22
+ *
23
+ * O cartão é um diálogo modal (`role="dialog"`, `aria-modal`): o foco entra nele
24
+ * ao abrir, o Tab fica preso nele, Esc sai do tour, as setas esquerda e direita
25
+ * voltam e avançam, e o foco volta ao elemento de antes ao fechar. A cada passo o
26
+ * leitor de tela ouve "2 de 8: título" (região `aria-live`).
27
+ *
28
+ * O componente é CONTROLADO por `open`: o tour só existe com `open` verdadeiro, e
29
+ * `onClose(motivo)` avisa quando ele quer fechar (`"finish"` no último
30
+ * "Concluir", `"skip"` em "Sair do tour", `"escape"` no Esc). O passo atual é
31
+ * interno (`defaultStep` para começar adiante), ou controlado por `step` com
32
+ * `onStepChange`. Reabrir recomeça do primeiro passo.
33
+ *
34
+ * O alvo é achado por seletor, elemento ou ref e acompanhado: rolagem,
35
+ * redimensionamento e mudança de tamanho do alvo reposicionam o recorte e o
36
+ * cartão. Todos os textos do cartão são props (`nextLabel`, `previousLabel`,
37
+ * `finishLabel`, `skipLabel`, `counterLabel`): em tela em inglês, passe todos.
38
+ *
39
+ * Limite: a página atrás fica inerte (o véu captura o clique), então o alvo
40
+ * não é clicável durante o tour.
41
+ *
42
+ * `modal={false}` tira o véu, o recorte e o foco preso: o cartão vira um popover
43
+ * ancorado no alvo, para uma dica pontual (um passo, "Novo: agora dá para * arrastar"). A página segue clicável, o foco entra no cartão ao abrir mas o Tab
44
+ * pode sair dele, o Esc fecha de qualquer lugar da página e o cartão vira um
45
+ * `role="dialog"` com `aria-modal="false"`.
46
+ * @property {boolean} open - Mostra o tour
47
+ * @property {boolean} modal - `true` (padrão): véu, recorte e foco preso. `false`: sem véu nem foco preso, como um popover ancorado, para dica pontual
48
+ * @property {CoachmarkStep[]} steps - Os passos, em ordem
49
+ * @property {number} step - Passo atual, a partir de 0 (controlado)
50
+ * @property {number} defaultStep - Passo inicial (não controlado)
51
+ * @property {number} padding - Folga do recorte em torno do alvo, em px (padrão 8)
52
+ * @property {string} nextLabel - Texto de "Próximo" (padrão: "Próximo")
53
+ * @property {string} previousLabel - Texto de "Anterior" (padrão: "Anterior")
54
+ * @property {string} finishLabel - Texto do botão do último passo (padrão: "Concluir")
55
+ * @property {string} skipLabel - Texto de sair do tour (padrão: "Sair do tour")
56
+ * @property {string} counterLabel - Contador; `{current}` e `{total}` são trocados (padrão: "{current} de {total}")
57
+ * @property {boolean} hideSkip - Esconde o "Sair do tour" (o Esc continua saindo)
58
+ * @property {string} className - Classes CSS adicionais no cartão
59
+ * @property {function} onClose - Chamado com o motivo: 'finish' | 'skip' | 'escape'
60
+ * @property {function} onStepChange - Chamado com o novo passo (a partir de 0)
61
+ * @quandoUsar Apresentar uma tela nova ou uma funcionalidade em poucos passos curtos (até uns 8), na primeira visita ou a pedido ("Fazer o tour guiado").
62
+ * @quandoNaoUsar Para uma dica sobre UM elemento, use `Tooltip` ou `Popover`. Para uma informação que não pode ser perdida, use texto na própria tela: tour se fecha e se esquece. Para um fluxo em etapas que a pessoa preenche, use `Stepper`.
63
+ */
64
+ export interface CoachmarkProps {
65
+ open?: boolean;
66
+ /**
67
+ * `true` (padrão): véu, recorte e foco preso. `false`: o cartão é um popover
68
+ * ancorado, sem véu nem foco preso. `any` de propósito: no Vue uma prop `boolean`
69
+ * sem valor chega como `false`, e o tour modal viraria sem véu por engano.
70
+ */
71
+ modal?: any;
72
+ steps?: CoachmarkStep[];
73
+ step?: number;
74
+ defaultStep?: number;
75
+ padding?: number;
76
+ nextLabel?: string;
77
+ previousLabel?: string;
78
+ finishLabel?: string;
79
+ skipLabel?: string;
80
+ counterLabel?: string;
81
+ hideSkip?: boolean;
82
+ className?: string;
83
+ onClose?: (reason: "finish" | "skip" | "escape") => void;
84
+ onStepChange?: (step: number) => void;
85
+ }
86
+ declare function Coachmark(props: CoachmarkProps): import("react/jsx-runtime").JSX.Element;
87
+ export default Coachmark;
@@ -0,0 +1,362 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import './Coachmark.css';
4
+ import { useState, useRef, useEffect } from "react";
5
+ import { computePosition, autoUpdate, offset, flip, shift, } from "@floating-ui/dom";
6
+ import Button from "../Button/Button";
7
+ import Portal from "../Portal/Portal";
8
+ import Text from "../Text/Text";
9
+ import { gerarId } from "../../utils/id";
10
+ function Coachmark(props) {
11
+ const cardRef = useRef(null);
12
+ const cleanupRef = useRef(null);
13
+ const previousFocusRef = useRef(null);
14
+ const attachedRef = useRef(null);
15
+ const escDocRef = useRef(null);
16
+ const [internalStep, setInternalStep] = useState(() => props.defaultStep || 0);
17
+ const [uid, setUid] = useState(() => "");
18
+ const [active, setActive] = useState(() => false);
19
+ const [hasTarget, setHasTarget] = useState(() => false);
20
+ const [positioned, setPositioned] = useState(() => false);
21
+ const [rectTop, setRectTop] = useState(() => 0);
22
+ const [rectLeft, setRectLeft] = useState(() => 0);
23
+ const [rectWidth, setRectWidth] = useState(() => 0);
24
+ const [rectHeight, setRectHeight] = useState(() => 0);
25
+ const [posX, setPosX] = useState(() => 0);
26
+ const [posY, setPosY] = useState(() => 0);
27
+ const [tentativas, setTentativas] = useState(() => 0);
28
+ function stepList() {
29
+ return props.steps || [];
30
+ }
31
+ function stepCount() {
32
+ return stepList().length;
33
+ }
34
+ function index() {
35
+ const bruto = props.step !== undefined ? props.step : internalStep;
36
+ const max = stepCount() > 0 ? stepCount() - 1 : 0;
37
+ return Math.max(0, Math.min(bruto, max));
38
+ }
39
+ function currentStep() {
40
+ return (stepList()[index()] || {
41
+ title: "",
42
+ });
43
+ }
44
+ function isFirst() {
45
+ return index() === 0;
46
+ }
47
+ function isLast() {
48
+ return index() === stepCount() - 1;
49
+ }
50
+ function baseId() {
51
+ return uid || "umds-coachmark";
52
+ }
53
+ function titleId() {
54
+ return baseId() + "-title";
55
+ }
56
+ function contentId() {
57
+ return baseId() + "-content";
58
+ }
59
+ function counterText() {
60
+ const modelo = props.counterLabel || "{current} de {total}";
61
+ return modelo
62
+ .replace("{current}", String(index() + 1))
63
+ .replace("{total}", String(stepCount()));
64
+ }
65
+ function announceText() {
66
+ return counterText() + ": " + currentStep().title;
67
+ }
68
+ function nextText() {
69
+ if (isLast())
70
+ return props.finishLabel || "Concluir";
71
+ return props.nextLabel || "Próximo";
72
+ }
73
+ function previousText() {
74
+ return props.previousLabel || "Anterior";
75
+ }
76
+ function skipText() {
77
+ return props.skipLabel || "Sair do tour";
78
+ }
79
+ function isModal() {
80
+ if (props.modal === undefined || props.modal === null)
81
+ return true;
82
+ return props.modal !== false && props.modal !== "false";
83
+ }
84
+ function ariaModalText() {
85
+ return isModal() ? "true" : "false";
86
+ }
87
+ function showSkip() {
88
+ return !props.hideSkip;
89
+ }
90
+ function show() {
91
+ return !!props.open && stepCount() > 0;
92
+ }
93
+ function rootClasses() {
94
+ return [
95
+ "umds-coachmark",
96
+ hasTarget ? "" : "umds-coachmark--no-target",
97
+ isModal() ? "" : "umds-coachmark--modeless",
98
+ positioned ? "umds-coachmark--ready" : "",
99
+ ]
100
+ .filter(Boolean)
101
+ .join(" ");
102
+ }
103
+ function cardClasses() {
104
+ return [
105
+ "umds-coachmark__card",
106
+ hasTarget ? "" : "umds-coachmark__card--centered",
107
+ props.className,
108
+ ]
109
+ .filter(Boolean)
110
+ .join(" ");
111
+ }
112
+ function cutoutStyle() {
113
+ const folga = props.padding !== undefined ? props.padding : 8;
114
+ return {
115
+ top: rectTop - folga + "px",
116
+ left: rectLeft - folga + "px",
117
+ width: rectWidth + folga * 2 + "px",
118
+ height: rectHeight + folga * 2 + "px",
119
+ };
120
+ }
121
+ function cardStyle() {
122
+ if (!hasTarget)
123
+ return undefined;
124
+ // Opacidade, e não `visibility`: o cartão precisa poder receber o foco antes de ser posicionado.
125
+ return {
126
+ transform: "translate(" + posX + "px, " + posY + "px)",
127
+ opacity: positioned ? 1 : 0,
128
+ };
129
+ }
130
+ function resolverAlvo(alvo) {
131
+ if (!alvo || typeof document === "undefined")
132
+ return null;
133
+ if (typeof alvo === "string") {
134
+ try {
135
+ return document.querySelector(alvo);
136
+ }
137
+ catch (erro) {
138
+ return null;
139
+ }
140
+ }
141
+ if (typeof alvo === "function")
142
+ return resolverAlvo(alvo());
143
+ if (alvo.nodeType === 1)
144
+ return alvo;
145
+ if (alvo.current !== undefined)
146
+ return resolverAlvo(alvo.current);
147
+ if (alvo.value !== undefined)
148
+ return resolverAlvo(alvo.value);
149
+ if (alvo.$el)
150
+ return alvo.$el.nodeType === 1 ? alvo.$el : null;
151
+ return null;
152
+ }
153
+ function atualizar(alvo) {
154
+ if (!alvo || !cardRef.current)
155
+ return;
156
+ const caixa = alvo.getBoundingClientRect();
157
+ setRectTop(caixa.top);
158
+ setRectLeft(caixa.left);
159
+ setRectWidth(caixa.width);
160
+ setRectHeight(caixa.height);
161
+ const lado = (currentStep().placement || "bottom");
162
+ computePosition(alvo, cardRef.current, {
163
+ placement: lado,
164
+ strategy: "fixed",
165
+ middleware: [
166
+ offset(16),
167
+ flip(),
168
+ shift({
169
+ padding: 16,
170
+ }),
171
+ ],
172
+ }).then((posicao) => {
173
+ const dpr = typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1;
174
+ setPosX(Math.round(posicao.x * dpr) / dpr);
175
+ setPosY(Math.round(posicao.y * dpr) / dpr);
176
+ setPositioned(true);
177
+ });
178
+ }
179
+ function ligar() {
180
+ desligar();
181
+ const alvo = resolverAlvo(currentStep().target);
182
+ attachedRef.current = index();
183
+ if (!alvo) {
184
+ setHasTarget(false);
185
+ setPositioned(true);
186
+ return;
187
+ }
188
+ setHasTarget(true);
189
+ if (alvo.scrollIntoView) {
190
+ const caixa = alvo.getBoundingClientRect();
191
+ const altura = typeof window !== "undefined" ? window.innerHeight : 0;
192
+ if (caixa.top < 0 || caixa.bottom > altura) {
193
+ alvo.scrollIntoView({
194
+ block: "center",
195
+ inline: "nearest",
196
+ });
197
+ }
198
+ }
199
+ if (cardRef.current) {
200
+ cleanupRef.current = autoUpdate(alvo, cardRef.current, () => atualizar(alvo));
201
+ }
202
+ }
203
+ function desligar() {
204
+ if (cleanupRef.current) {
205
+ cleanupRef.current();
206
+ cleanupRef.current = null;
207
+ }
208
+ }
209
+ function ligarEsc() {
210
+ if (typeof document === "undefined" || escDocRef.current)
211
+ return;
212
+ const ouvir = (event) => {
213
+ // O Esc dentro do cartão já fechou (e deu preventDefault): não fecha duas vezes.
214
+ if (event.key === "Escape" && !event.defaultPrevented)
215
+ fechar("escape");
216
+ };
217
+ escDocRef.current = ouvir;
218
+ document.addEventListener("keydown", ouvir);
219
+ }
220
+ function desligarEsc() {
221
+ if (typeof document === "undefined" || !escDocRef.current)
222
+ return;
223
+ document.removeEventListener("keydown", escDocRef.current);
224
+ escDocRef.current = null;
225
+ }
226
+ function sincronizar() {
227
+ if (typeof document === "undefined")
228
+ return;
229
+ if (show() && !active && !cardRef.current) {
230
+ if (tentativas < 30) {
231
+ requestAnimationFrame(() => {
232
+ setTentativas(tentativas + 1);
233
+ });
234
+ }
235
+ return;
236
+ }
237
+ if (show() && !active) {
238
+ setActive(true);
239
+ setTentativas(0);
240
+ // Guarda só na primeira vez: no React o `active` leva um render para
241
+ // valer, e um segundo `sincronizar` antes disso guardaria o próprio
242
+ // cartão (já focado) como "o elemento de antes".
243
+ if (!previousFocusRef.current)
244
+ previousFocusRef.current = document.activeElement;
245
+ ligar();
246
+ if (cardRef.current)
247
+ cardRef.current.focus({
248
+ preventScroll: true,
249
+ });
250
+ if (!isModal())
251
+ ligarEsc();
252
+ }
253
+ else if (show() && active && attachedRef.current !== index()) {
254
+ ligar();
255
+ }
256
+ else if (!show() && active) {
257
+ setActive(false);
258
+ desligar();
259
+ desligarEsc();
260
+ attachedRef.current = null;
261
+ setHasTarget(false);
262
+ setPositioned(false);
263
+ if (props.step === undefined)
264
+ setInternalStep(props.defaultStep || 0);
265
+ // Sem véu a pessoa pode ter ido para outro lugar da página: o foco só volta se ela não foi.
266
+ const focoLivre = isModal() ||
267
+ document.activeElement === document.body ||
268
+ !document.activeElement;
269
+ if (previousFocusRef.current &&
270
+ previousFocusRef.current.focus &&
271
+ focoLivre) {
272
+ previousFocusRef.current.focus();
273
+ }
274
+ previousFocusRef.current = null;
275
+ }
276
+ }
277
+ function irPara(proximo) {
278
+ if (proximo < 0 || proximo > stepCount() - 1)
279
+ return;
280
+ setInternalStep(proximo);
281
+ if (props.onStepChange)
282
+ props.onStepChange(proximo);
283
+ }
284
+ function fechar(motivo) {
285
+ if (props.onClose)
286
+ props.onClose(motivo);
287
+ }
288
+ function handleNext() {
289
+ if (isLast())
290
+ fechar("finish");
291
+ else
292
+ irPara(index() + 1);
293
+ }
294
+ function handlePrevious() {
295
+ irPara(index() - 1);
296
+ }
297
+ function handleKeyDown(event) {
298
+ if (!event)
299
+ return;
300
+ if (event.key === "Escape") {
301
+ event.preventDefault();
302
+ fechar("escape");
303
+ return;
304
+ }
305
+ if (event.altKey || event.ctrlKey || event.metaKey)
306
+ return;
307
+ if (event.key === "ArrowRight") {
308
+ event.preventDefault();
309
+ handleNext();
310
+ return;
311
+ }
312
+ if (event.key === "ArrowLeft") {
313
+ event.preventDefault();
314
+ handlePrevious();
315
+ return;
316
+ }
317
+ if (event.key !== "Tab" || !cardRef.current || !isModal())
318
+ return;
319
+ // Foco preso: Tab e Shift+Tab giram dentro do cartão.
320
+ const focaveis = cardRef.current.querySelectorAll("button:not([disabled])");
321
+ if (focaveis.length === 0) {
322
+ event.preventDefault();
323
+ return;
324
+ }
325
+ const primeiro = focaveis[0];
326
+ const ultimo = focaveis[focaveis.length - 1];
327
+ const ativo = document.activeElement;
328
+ if (event.shiftKey) {
329
+ if (ativo === primeiro || ativo === cardRef.current) {
330
+ event.preventDefault();
331
+ ultimo.focus();
332
+ }
333
+ }
334
+ else if (ativo === ultimo) {
335
+ event.preventDefault();
336
+ primeiro.focus();
337
+ }
338
+ }
339
+ function handleVeilMouseDown(event) {
340
+ if (event && event.preventDefault)
341
+ event.preventDefault();
342
+ if (cardRef.current)
343
+ cardRef.current.focus({
344
+ preventScroll: true,
345
+ });
346
+ }
347
+ useEffect(() => {
348
+ setUid(gerarId("umds-coachmark"));
349
+ sincronizar();
350
+ }, []);
351
+ useEffect(() => {
352
+ sincronizar();
353
+ });
354
+ useEffect(() => {
355
+ return () => {
356
+ desligar();
357
+ desligarEsc();
358
+ };
359
+ }, []);
360
+ return (_jsx(_Fragment, { children: show() ? (_jsx(_Fragment, { children: _jsx(Portal, { children: _jsxs("div", { className: rootClasses(), children: [isModal() ? (_jsx("div", { "aria-hidden": "true", className: "umds-coachmark__veil", onMouseDown: (event) => handleVeilMouseDown(event) })) : null, hasTarget && isModal() ? (_jsx("div", { "aria-hidden": "true", className: "umds-coachmark__cutout", style: cutoutStyle() })) : null, _jsxs("div", { role: "dialog", ref: cardRef, style: cardStyle(), "aria-modal": ariaModalText(), "aria-labelledby": titleId(), "aria-describedby": contentId(), tabIndex: -1, onKeyDown: (event) => handleKeyDown(event), className: cardClasses(), children: [_jsx("span", { "aria-live": "polite", className: "umds-coachmark__sr", children: announceText() }), _jsx(Text, { as: "span", variant: "body2", weight: "bold", color: "primary", "aria-hidden": "true", children: counterText() }), _jsx(Text, { as: "h2", variant: "subtitle1", weight: "bold", id: titleId(), children: currentStep().title }), currentStep().content ? (_jsx(Text, { as: "p", variant: "body2", color: "secondary", id: contentId(), children: currentStep().content })) : null, _jsxs("div", { className: "umds-coachmark__footer", children: [showSkip() ? (_jsx(Button, { variant: "text", size: "sm", onClick: (event) => fechar("skip"), children: skipText() })) : null, _jsxs("span", { className: "umds-coachmark__actions", children: [!isFirst() ? (_jsx(Button, { variant: "secondary", size: "md", onClick: (event) => handlePrevious(), children: previousText() })) : null, _jsx(Button, { variant: "primary", size: "md", onClick: (event) => handleNext(), children: nextText() })] })] })] })] }) }) })) : null }));
361
+ }
362
+ export default Coachmark;
@@ -0,0 +1,96 @@
1
+ /* ─────────────────────────────────────────────
2
+ CODE BLOCK
3
+ Texto em fonte monoespaçada, com borda, rolagem e botão de copiar.
4
+
5
+ Fundo claro e texto escuro (contraste de texto, nos temas claro e escuro: os
6
+ dois vêm dos semânticos). Sem cor de sintaxe.
7
+
8
+ Cores: semânticos · Medidas: primitivos
9
+ ───────────────────────────────────────────── */
10
+
11
+ .umds-code-block {
12
+ display: flex;
13
+ flex-direction: column;
14
+ min-width: 0;
15
+ background: var(--umds-semantic-color-background-light);
16
+ border: var(--umds-primitive-border-width-hairline) solid var(--umds-semantic-color-neutral-light-down);
17
+ border-radius: var(--umds-primitive-border-radius-sm);
18
+ overflow: hidden;
19
+ }
20
+
21
+ .umds-code-block__header {
22
+ display: flex;
23
+ align-items: center;
24
+ justify-content: space-between;
25
+ gap: var(--umds-primitive-spacing-nano); /* 8px */
26
+ padding: var(--umds-primitive-spacing-quarck) var(--umds-primitive-spacing-nano); /* 4px 8px */
27
+ border-bottom: var(--umds-primitive-border-width-hairline) solid var(--umds-semantic-color-neutral-light-down);
28
+ }
29
+
30
+ .umds-code-block__language {
31
+ font-family: var(--umds-semantic-font-family-mono);
32
+ font-size: var(--umds-primitive-font-size-xxxs); /* 12px */
33
+ font-weight: var(--umds-primitive-font-weight-semibold);
34
+ color: var(--umds-semantic-color-neutral-dark-down);
35
+ }
36
+
37
+ .umds-code-block__copy {
38
+ display: inline-flex;
39
+ align-items: center;
40
+ gap: var(--umds-primitive-spacing-quarck); /* 4px */
41
+ margin: 0 0 0 auto;
42
+ padding: var(--umds-primitive-spacing-quarck) var(--umds-primitive-spacing-nano); /* 4px 8px */
43
+ border: none;
44
+ border-radius: var(--umds-primitive-border-radius-sm);
45
+ background: transparent;
46
+ font: inherit;
47
+ font-size: var(--umds-primitive-font-size-xxxs); /* 12px */
48
+ font-weight: var(--umds-primitive-font-weight-semibold);
49
+ color: var(--umds-semantic-color-neutral-dark-down);
50
+ cursor: pointer;
51
+ }
52
+
53
+ .umds-code-block__copy:hover {
54
+ background: var(--umds-semantic-color-neutral-light-medium);
55
+ color: var(--umds-semantic-color-neutral-dark-pure);
56
+ }
57
+
58
+ .umds-code-block__copy:focus-visible,
59
+ .umds-code-block__scroll:focus-visible {
60
+ outline: var(--umds-primitive-border-width-thin) solid var(--umds-semantic-color-primary-pure);
61
+ outline-offset: calc(var(--umds-primitive-border-width-thin) * -1);
62
+ }
63
+
64
+ .umds-code-block__scroll {
65
+ margin: 0;
66
+ padding: var(--umds-primitive-spacing-mini) var(--umds-primitive-spacing-xxxs); /* 12px 16px */
67
+ overflow: auto;
68
+ font-family: var(--umds-semantic-font-family-mono);
69
+ font-size: var(--umds-primitive-font-size-xxs); /* 14px */
70
+ line-height: var(--umds-primitive-font-line-height-lg);
71
+ color: var(--umds-semantic-color-neutral-dark-pure);
72
+ white-space: pre;
73
+ tab-size: 2;
74
+ }
75
+
76
+ .umds-code-block--wrap .umds-code-block__scroll {
77
+ white-space: pre-wrap;
78
+ overflow-wrap: anywhere;
79
+ }
80
+
81
+ .umds-code-block__code {
82
+ font-family: inherit;
83
+ }
84
+
85
+ .umds-code-block__sr {
86
+ position: absolute;
87
+ width: 1px;
88
+ height: 1px;
89
+ padding: 0;
90
+ margin: -1px;
91
+ overflow: hidden;
92
+ clip: rect(0, 0, 0, 0);
93
+ clip-path: inset(50%);
94
+ white-space: nowrap;
95
+ border: 0;
96
+ }
@@ -0,0 +1,47 @@
1
+ import './CodeBlock.css';
2
+ /**
3
+ * CodeBlock — trecho de código (ou JSON, ou um log) em fonte monoespaçada, com
4
+ * borda, rolagem e botão de copiar.
5
+ *
6
+ * O texto vem por `code` ou como conteúdo (`<CodeBlock>{...}</CodeBlock>`); o
7
+ * espaço e as quebras de linha são mantidos. Linha longa rola na horizontal
8
+ * (ou quebra, com `wrap`), e `maxHeight` limita a altura e rola na vertical. A
9
+ * área de rolagem é focável (Tab) e tem nome (`ariaLabel`), para quem usa o
10
+ * teclado poder rolar.
11
+ *
12
+ * `copyable` põe o botão de copiar no canto: copia o texto inteiro (não o que
13
+ * está à vista), troca o ícone por "Copiado" por dois segundos e anuncia isso ao
14
+ * leitor de tela. `onCopy` recebe o texto. Os textos são props.
15
+ *
16
+ * É só texto: não colore sintaxe (isso pede uma biblioteca, e o bloco do 1Doc
17
+ * mostra JSON e logs, que ficam bem em uma cor só).
18
+ * @property {string} code - O texto (ou passe como conteúdo)
19
+ * @property {string} language - Nome da linguagem, mostrado no topo (ex.: "JSON"). É só rótulo
20
+ * @property {boolean} wrap - Quebra a linha longa em vez de rolar
21
+ * @property {number} maxHeight - Altura máxima, em px (rola dentro dela)
22
+ * @property {boolean} copyable - Mostra o botão de copiar
23
+ * @property {string} copyLabel - Nome do botão de copiar (padrão "Copiar")
24
+ * @property {string} copiedLabel - Nome do botão e anúncio depois de copiar (padrão "Copiado")
25
+ * @property {string} ariaLabel - Nome da área de rolagem (padrão: a linguagem, ou "Código")
26
+ * @property {string} className - Classes CSS adicionais
27
+ * @property {function} onCopy - Chamado com o texto depois de copiar
28
+ * @quandoUsar Mostrar JSON de uma resposta, um comando, um log, um exemplo de uso: texto que se lê em fonte monoespaçada e se copia.
29
+ * @quandoNaoUsar Para uma tecla ou atalho, use `Kbd`. Para código dentro de uma frase, use `<code>` direto. Para editar código, use um editor especializado: este bloco só mostra.
30
+ */
31
+ export interface CodeBlockProps {
32
+ code?: string;
33
+ language?: string;
34
+ wrap?: boolean;
35
+ maxHeight?: number;
36
+ copyable?: boolean;
37
+ copyLabel?: string;
38
+ copiedLabel?: string;
39
+ ariaLabel?: string;
40
+ className?: string;
41
+ id?: string;
42
+ onCopy?: (code: string) => void;
43
+ /** O texto, quando não vem por `code`. */
44
+ children?: any;
45
+ }
46
+ declare function CodeBlock(props: CodeBlockProps): import("react/jsx-runtime").JSX.Element;
47
+ export default CodeBlock;