@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
@@ -22,6 +22,7 @@ import './Popover.css';
22
22
  * @property {boolean} closable - Exibe o botão de fechar no topo.
23
23
  * @property {string} closeLabel - Nome acessível do botão de fechar. Padrão: "Fechar".
24
24
  * @property {number} width - Largura do painel, em px. Padrão: 240.
25
+ * @property {number | string} maxHeight - Altura máxima do corpo, que rola quando o conteúdo passa dela. Número vira px; texto vai como CSS (`"60vh"`). `"none"` deixa o corpo crescer com o conteúdo (painel "Colunas do card"). Sem a prop, o teto histórico de 300px continua.
25
26
  * @property {string} ariaLabel - Nome acessível quando não há `title`.
26
27
  * @property {string} className - Classes CSS adicionais.
27
28
  * @property {function} onOpenChange - Avisa quando abre e quando fecha.
@@ -45,6 +46,12 @@ export interface PopoverProps {
45
46
  closable?: boolean;
46
47
  closeLabel?: string;
47
48
  width?: number;
49
+ /**
50
+ * Altura máxima do corpo. Número vira px; texto vai como CSS (`"60vh"`).
51
+ * `"none"` deixa o corpo crescer com o conteúdo. Sem a prop, vale o teto de
52
+ * 300px de sempre (o cabeçalho e o × não rolam junto).
53
+ */
54
+ maxHeight?: number | string;
48
55
  ariaLabel?: string;
49
56
  className?: string;
50
57
  children?: any;
@@ -305,6 +305,16 @@ function Popover(props) {
305
305
  visibility: positioned ? "visible" : "hidden",
306
306
  };
307
307
  }
308
+ function corpoStyle() {
309
+ if (props.maxHeight === undefined || props.maxHeight === null) {
310
+ return undefined;
311
+ }
312
+ return {
313
+ maxHeight: typeof props.maxHeight === "number"
314
+ ? props.maxHeight + "px"
315
+ : props.maxHeight,
316
+ };
317
+ }
308
318
  function panelStyle() {
309
319
  return {
310
320
  opacity: positioned ? 1 : 0,
@@ -339,6 +349,6 @@ function Popover(props) {
339
349
  }, []);
340
350
  return (_jsxs("span", { ref: anchorRef, className: anchorClasses(), style: {
341
351
  display: "inline-flex",
342
- }, children: [_jsx("span", { className: "umds-popover__trigger", ref: triggerButtonRef, id: triggerIdText(), role: triggerIsInteractive ? undefined : "button", tabIndex: triggerIsInteractive ? undefined : 0, "aria-haspopup": triggerIsInteractive ? undefined : "dialog", "aria-expanded": triggerIsInteractive ? undefined : ariaExpandedText(), onClick: (event) => toggle(), onKeyDown: (event) => handleTriggerKeydown(event), children: _jsx(_Fragment, { children: props.children }) }), _jsx(Portal, { children: mounted ? (_jsx("span", { className: "umds-popover__floating", ref: floatingRef, style: floatingStyle(), children: _jsxs("div", { className: "umds-popover__panel", role: "dialog", "aria-modal": "false", ref: panelRef, "aria-labelledby": labelledByText(), "aria-label": props.title ? undefined : props.ariaLabel, tabIndex: -1, style: panelStyle(), onKeyDown: (event) => handlePanelKeydown(event), children: [props.title || props.closable ? (_jsxs("div", { className: "umds-popover__header", children: [props.title ? (_jsx(Text, { as: "span", variant: "body2", weight: "semibold", id: titleIdText(), children: props.title })) : null, props.closable ? (_jsx("button", { type: "button", className: "umds-popover__close", "aria-label": props.closeLabel || "Fechar", onClick: (event) => close(), children: _jsx(Icon, { size: "sm", variant: "inherit", icon: faXmark }) })) : null] })) : null, _jsx("div", { className: "umds-popover__body", children: _jsx(_Fragment, { children: props.content }) })] }) })) : null })] }));
352
+ }, children: [_jsx("span", { className: "umds-popover__trigger", ref: triggerButtonRef, id: triggerIdText(), role: triggerIsInteractive ? undefined : "button", tabIndex: triggerIsInteractive ? undefined : 0, "aria-haspopup": triggerIsInteractive ? undefined : "dialog", "aria-expanded": triggerIsInteractive ? undefined : ariaExpandedText(), onClick: (event) => toggle(), onKeyDown: (event) => handleTriggerKeydown(event), children: _jsx(_Fragment, { children: props.children }) }), _jsx(Portal, { children: mounted ? (_jsx("span", { className: "umds-popover__floating", ref: floatingRef, style: floatingStyle(), children: _jsxs("div", { className: "umds-popover__panel", role: "dialog", "aria-modal": "false", ref: panelRef, "aria-labelledby": labelledByText(), "aria-label": props.title ? undefined : props.ariaLabel, tabIndex: -1, style: panelStyle(), onKeyDown: (event) => handlePanelKeydown(event), children: [props.title || props.closable ? (_jsxs("div", { className: "umds-popover__header", children: [props.title ? (_jsx(Text, { as: "span", variant: "body2", weight: "semibold", id: titleIdText(), children: props.title })) : null, props.closable ? (_jsx("button", { type: "button", className: "umds-popover__close", "aria-label": props.closeLabel || "Fechar", onClick: (event) => close(), children: _jsx(Icon, { size: "sm", variant: "inherit", icon: faXmark }) })) : null] })) : null, _jsx("div", { className: "umds-popover__body", style: corpoStyle(), children: _jsx(_Fragment, { children: props.content }) })] }) })) : null })] }));
343
353
  }
344
354
  export default Popover;
@@ -0,0 +1,203 @@
1
+ /* ─────────────────────────────────────────────
2
+ RICH TEXT EDITOR
3
+ Editor de texto rico leve sobre contenteditable.
4
+
5
+ A moldura (borda, raio, foco, erro) segue a família de campos. A barra é uma
6
+ faixa de fundo claro com botões de 32px: o botão LIGADO (negrito, lista...)
7
+ ganha o fundo e a cor do primário, e a mesma informação sai em `aria-pressed`.
8
+
9
+ Cores: semânticos · Medidas: primitivos
10
+ ───────────────────────────────────────────── */
11
+
12
+ .umds-rte {
13
+ display: flex;
14
+ flex-direction: column;
15
+ gap: var(--umds-primitive-spacing-quarck); /* 4px */
16
+ font-family: var(--umds-semantic-font-family-base);
17
+ }
18
+
19
+ .umds-rte__label {
20
+ font-size: var(--umds-semantic-field-label-size);
21
+ font-weight: var(--umds-semantic-field-label-weight);
22
+ color: var(--umds-semantic-field-label-color);
23
+ }
24
+
25
+ .umds-rte__frame {
26
+ display: flex;
27
+ flex-direction: column;
28
+ border: var(--umds-primitive-border-width-hairline) solid var(--umds-semantic-field-border-default);
29
+ border-radius: var(--umds-primitive-border-radius-sm);
30
+ background: var(--umds-semantic-color-background-white);
31
+ overflow: hidden;
32
+ transition:
33
+ border-color var(--umds-semantic-motion-duration-fast) var(--umds-semantic-motion-easing-standard),
34
+ box-shadow var(--umds-semantic-motion-duration-fast) var(--umds-semantic-motion-easing-standard);
35
+ }
36
+
37
+ .umds-rte__frame:hover {
38
+ border-color: var(--umds-semantic-field-border-hover);
39
+ }
40
+
41
+ .umds-rte__frame:focus-within {
42
+ border-color: var(--umds-semantic-field-border-focus);
43
+ box-shadow: var(--umds-semantic-field-ring-focus);
44
+ }
45
+
46
+ .umds-rte--invalid .umds-rte__frame,
47
+ .umds-rte--invalid .umds-rte__frame:hover {
48
+ border-color: var(--umds-semantic-field-border-error);
49
+ }
50
+
51
+ .umds-rte--invalid .umds-rte__frame:focus-within {
52
+ box-shadow: var(--umds-semantic-field-ring-error);
53
+ }
54
+
55
+ .umds-rte--disabled .umds-rte__frame {
56
+ background: var(--umds-semantic-field-disabled-background);
57
+ opacity: var(--umds-semantic-field-disabled-opacity);
58
+ cursor: not-allowed;
59
+ }
60
+
61
+ .umds-rte--readonly .umds-rte__frame {
62
+ background: var(--umds-semantic-field-readonly-background);
63
+ }
64
+
65
+ /* ── Barra ── */
66
+ .umds-rte__toolbar {
67
+ display: flex;
68
+ flex-wrap: wrap;
69
+ align-items: center;
70
+ gap: var(--umds-primitive-spacing-quarck); /* 4px */
71
+ padding: var(--umds-primitive-spacing-quarck) var(--umds-primitive-spacing-nano); /* 4px 8px */
72
+ background: var(--umds-semantic-color-background-light);
73
+ border-bottom: var(--umds-primitive-border-width-hairline) solid var(--umds-semantic-color-neutral-light-medium);
74
+ }
75
+
76
+ .umds-rte__tool {
77
+ display: inline-flex;
78
+ align-items: center;
79
+ justify-content: center;
80
+ box-sizing: border-box;
81
+ width: var(--umds-primitive-spacing-xs); /* 32px */
82
+ height: var(--umds-primitive-spacing-xs);
83
+ margin: 0;
84
+ padding: 0;
85
+ border: none;
86
+ border-radius: var(--umds-primitive-border-radius-sm);
87
+ background: transparent;
88
+ color: var(--umds-semantic-color-neutral-dark-down);
89
+ cursor: pointer;
90
+ transition:
91
+ background-color var(--umds-semantic-motion-duration-fast) var(--umds-semantic-motion-easing-standard),
92
+ color var(--umds-semantic-motion-duration-fast) var(--umds-semantic-motion-easing-standard);
93
+ }
94
+
95
+ .umds-rte__tool:hover:not(:disabled) {
96
+ background: var(--umds-semantic-color-neutral-light-medium);
97
+ color: var(--umds-semantic-color-neutral-dark-pure);
98
+ }
99
+
100
+ .umds-rte__tool--active,
101
+ .umds-rte__tool--active:hover:not(:disabled) {
102
+ background: var(--umds-semantic-color-primary-light);
103
+ color: var(--umds-semantic-color-primary-dark);
104
+ }
105
+
106
+ .umds-rte__tool:focus-visible {
107
+ outline: var(--umds-primitive-border-width-thin) solid var(--umds-semantic-color-primary-pure);
108
+ outline-offset: calc(var(--umds-primitive-border-width-thin) * -1);
109
+ }
110
+
111
+ .umds-rte__tool:disabled {
112
+ cursor: not-allowed;
113
+ opacity: var(--umds-semantic-field-disabled-opacity);
114
+ }
115
+
116
+ .umds-rte__separator {
117
+ align-self: stretch;
118
+ width: var(--umds-primitive-border-width-hairline);
119
+ margin: var(--umds-primitive-spacing-quarck) var(--umds-primitive-spacing-micro);
120
+ background: var(--umds-semantic-color-neutral-light-down);
121
+ }
122
+
123
+ /* ── Campo de link, logo abaixo da barra ── */
124
+ .umds-rte__link {
125
+ display: flex;
126
+ flex-wrap: wrap;
127
+ align-items: flex-end;
128
+ gap: var(--umds-primitive-spacing-nano); /* 8px */
129
+ padding: var(--umds-primitive-spacing-nano) var(--umds-primitive-spacing-mini); /* 8px 12px */
130
+ background: var(--umds-semantic-color-background-light);
131
+ border-bottom: var(--umds-primitive-border-width-hairline) solid var(--umds-semantic-color-neutral-light-medium);
132
+ }
133
+
134
+ .umds-rte__link-field {
135
+ flex: 1 1 var(--umds-primitive-spacing-giant);
136
+ min-width: 0;
137
+ }
138
+
139
+ .umds-rte__link-actions {
140
+ display: flex;
141
+ align-items: center;
142
+ gap: var(--umds-primitive-spacing-nano); /* 8px */
143
+ }
144
+
145
+ /* ── Área de escrita ── */
146
+ .umds-rte__editor {
147
+ box-sizing: border-box;
148
+ min-height: var(--umds-primitive-spacing-xxxl); /* 120px */
149
+ padding: var(--umds-primitive-spacing-mini) var(--umds-primitive-spacing-xxxs); /* 12px 16px */
150
+ font-size: var(--umds-semantic-field-text-size); /* 14px */
151
+ line-height: var(--umds-primitive-font-line-height-lg);
152
+ color: var(--umds-semantic-field-text-color);
153
+ outline: none;
154
+ overflow-wrap: anywhere;
155
+ overflow-y: auto;
156
+ }
157
+
158
+ .umds-rte--resizable .umds-rte__editor {
159
+ resize: vertical;
160
+ }
161
+
162
+ /* Placeholder: o :empty some assim que há conteúdo (o JS limpa o <br> que sobra). */
163
+ .umds-rte__editor:empty::before {
164
+ content: attr(data-placeholder);
165
+ color: var(--umds-semantic-field-placeholder-color);
166
+ pointer-events: none;
167
+ }
168
+
169
+ .umds-rte__editor ul,
170
+ .umds-rte__editor ol {
171
+ margin: var(--umds-primitive-spacing-quarck) 0;
172
+ padding-left: var(--umds-primitive-spacing-xxs); /* 24px */
173
+ }
174
+
175
+ .umds-rte__editor p,
176
+ .umds-rte__editor blockquote {
177
+ margin: 0 0 var(--umds-primitive-spacing-nano);
178
+ }
179
+
180
+ .umds-rte__editor blockquote {
181
+ padding-left: var(--umds-primitive-spacing-mini);
182
+ border-left: var(--umds-primitive-border-width-thin) solid var(--umds-semantic-color-neutral-light-down);
183
+ color: var(--umds-semantic-color-neutral-dark-down);
184
+ }
185
+
186
+ .umds-rte__editor a {
187
+ color: var(--umds-semantic-color-primary-pure);
188
+ text-decoration: underline;
189
+ }
190
+
191
+ .umds-rte__footer {
192
+ padding: var(--umds-primitive-spacing-nano) var(--umds-primitive-spacing-xxxs); /* 8px 16px */
193
+ border-top: var(--umds-primitive-border-width-hairline) solid var(--umds-semantic-color-neutral-light-medium);
194
+ background: var(--umds-semantic-color-background-light);
195
+ font-size: var(--umds-primitive-font-size-xxs); /* 14px */
196
+ color: var(--umds-semantic-color-neutral-dark-down);
197
+ }
198
+
199
+ @media (forced-colors: active) {
200
+ .umds-rte__tool--active {
201
+ outline: var(--umds-primitive-border-width-thin) solid Highlight;
202
+ }
203
+ }
@@ -0,0 +1,83 @@
1
+ import './RichTextEditor.css';
2
+ /** Ferramentas da barra, na ordem em que aparecem em `toolbar`. `"|"` é um separador. */
3
+ export type RichTextTool = "bold" | "italic" | "underline" | "strike" | "ul" | "ol" | "link" | "undo" | "redo" | "clear" | "|";
4
+ /**
5
+ * RichTextEditor — editor de texto rico leve, sobre `contenteditable`, sem
6
+ * biblioteca: negrito, itálico, sublinhado, tachado, listas, link, desfazer e
7
+ * refazer, e limpar formatação.
8
+ *
9
+ * O valor é HTML (`value`/`defaultValue`/`onChange`) e SEMPRE passa por uma
10
+ * higienização: só ficam negrito, itálico, sublinhado, tachado, listas,
11
+ * parágrafos, quebras, títulos, citação e link; o resto (`script`, `style`,
12
+ * `onerror`, `class`, `javascript:`) sai, tanto do `value` que entra quanto do
13
+ * que se cola (colar entra como texto puro). Link só aceita `http(s)`, `mailto`,
14
+ * `tel`, caminho e âncora.
15
+ *
16
+ * A barra é um `role="toolbar"` com Tab numa parada só e setas entre as
17
+ * ferramentas; negrito, itálico, sublinhado, tachado e as listas são botões de
18
+ * liga/desliga (`aria-pressed`) que seguem a posição do cursor. Os atalhos do
19
+ * navegador (Ctrl+B, Ctrl+I, Ctrl+U, Ctrl+Z) valem, e Ctrl+K abre o link. O
20
+ * botão de link abre um campo logo abaixo da barra (endereço, aplicar, remover,
21
+ * cancelar), sem modal.
22
+ *
23
+ * A barra se escolhe por `toolbar`: a completa é o padrão; `["bold", "italic",
24
+ * "underline", "ul", "ol", "link"]` é a compacta; `["bold", "italic"]`, a mínima.
25
+ * O rodapé aceita o slot `footer` (a assinatura do autor, por exemplo) e a área
26
+ * pode ser redimensionável (`resizable`).
27
+ *
28
+ * Todos os textos são props (`labels`, `toolbarLabel`, `placeholder`).
29
+ *
30
+ * Limites do primeiro corte: sem tabela, imagem, cor, fonte, tamanho nem
31
+ * alinhamento; usa `document.execCommand`, que o navegador mantém mas está
32
+ * marcado como obsoleto (o comportamento do desfazer varia um pouco entre
33
+ * navegadores). Nada disso é preciso para o que as telas de despacho, resposta e
34
+ * descrição pedem.
35
+ * @property {string} value - HTML (controlado)
36
+ * @property {string} defaultValue - HTML inicial (não controlado)
37
+ * @property {string} label - Rótulo visível do campo
38
+ * @property {string} ariaLabel - Nome acessível quando não há `label` visível
39
+ * @property {string} placeholder - Texto de apoio com o editor vazio
40
+ * @property {string[]} toolbar - Ferramentas da barra, em ordem: 'bold' | 'italic' | 'underline' | 'strike' | 'ul' | 'ol' | 'link' | 'undo' | 'redo' | 'clear' | '|' (separador)
41
+ * @property {string} toolbarLabel - Nome da barra (padrão "Formatação")
42
+ * @property {object} labels - Nomes das ferramentas e do campo de link, parcial: `{ bold, italic, underline, strike, ul, ol, link, undo, redo, clear, linkAddress, linkApply, linkRemove, linkCancel, linkInvalid }`
43
+ * @property {number} minHeight - Altura mínima da área de escrita, em px (padrão 120)
44
+ * @property {boolean} resizable - Deixa redimensionar a altura pelo canto
45
+ * @property {boolean} disabled - Desabilita barra e área
46
+ * @property {boolean} readOnly - Só leitura: a área não edita e a barra some
47
+ * @property {boolean} invalid - Estado de erro
48
+ * @property {string} errorMessage - Mensagem de erro (liga o estado de erro)
49
+ * @property {string} helperText - Texto de ajuda abaixo do campo
50
+ * @property {string} id - Base dos ids internos; passe em SSR para os ids já saírem no HTML do servidor
51
+ * @property {string} className - Classes CSS adicionais
52
+ * @property {function} onChange - Chamado com o HTML a cada edição
53
+ * @property {function} onBlur - Chamado quando o foco sai da área de escrita
54
+ * @slot footer - Rodapé dentro da moldura, abaixo da área de escrita (assinatura).
55
+ * @quandoUsar Texto formatado que vira conteúdo de documento: despacho, resposta, descrição de serviço, modelo de texto.
56
+ * @quandoNaoUsar Para texto simples de várias linhas, use `Textarea`. Para texto de uma linha, `Input`. Quando for preciso tabela, imagem, cor ou fonte, este corte não serve: peça ao DS ou use um editor especializado.
57
+ */
58
+ /** Ferramentas da barra, na ordem em que aparecem em `toolbar`. `"|"` é um separador. */
59
+ export interface RichTextEditorProps {
60
+ value?: string;
61
+ defaultValue?: string;
62
+ label?: string;
63
+ ariaLabel?: string;
64
+ placeholder?: string;
65
+ toolbar?: RichTextTool[];
66
+ toolbarLabel?: string;
67
+ labels?: Record<string, string>;
68
+ minHeight?: number;
69
+ resizable?: boolean;
70
+ disabled?: boolean;
71
+ readOnly?: boolean;
72
+ invalid?: boolean;
73
+ errorMessage?: string;
74
+ helperText?: string;
75
+ id?: string;
76
+ className?: string;
77
+ /** Slot `footer`: abaixo da área de escrita. */
78
+ footer?: any;
79
+ onChange?: (html: string) => void;
80
+ onBlur?: (event?: any) => void;
81
+ }
82
+ declare function RichTextEditor(props: RichTextEditorProps): import("react/jsx-runtime").JSX.Element;
83
+ export default RichTextEditor;