@rojaostudio/ds 1.0.2 → 2.0.0-next.1

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 (356) hide show
  1. package/README.md +75 -13
  2. package/dist/compat/generate.d.ts +0 -1
  3. package/dist/components/accordion.d.ts +30 -20
  4. package/dist/components/accordion.js +31 -93
  5. package/dist/components/action-bar.d.ts +24 -0
  6. package/dist/components/action-bar.js +55 -0
  7. package/dist/components/alert-dialog.d.ts +31 -0
  8. package/dist/components/alert-dialog.js +43 -0
  9. package/dist/components/alert.d.ts +31 -19
  10. package/dist/components/alert.js +67 -65
  11. package/dist/components/attachment.d.ts +37 -0
  12. package/dist/components/attachment.js +76 -0
  13. package/dist/components/avatar.d.ts +43 -36
  14. package/dist/components/avatar.js +59 -90
  15. package/dist/components/badge.d.ts +30 -41
  16. package/dist/components/badge.js +13 -110
  17. package/dist/components/banner.d.ts +27 -0
  18. package/dist/components/banner.js +66 -0
  19. package/dist/components/benefits.d.ts +30 -0
  20. package/dist/components/benefits.js +32 -0
  21. package/dist/components/breadcrumb.d.ts +25 -18
  22. package/dist/components/breadcrumb.js +38 -56
  23. package/dist/components/browser.d.ts +18 -0
  24. package/dist/components/browser.js +32 -0
  25. package/dist/components/bubble.d.ts +29 -0
  26. package/dist/components/bubble.js +33 -0
  27. package/dist/components/button-group.d.ts +19 -0
  28. package/dist/components/button-group.js +20 -0
  29. package/dist/components/button.d.ts +47 -20
  30. package/dist/components/button.js +45 -108
  31. package/dist/components/calendar.d.ts +29 -0
  32. package/dist/components/calendar.js +149 -0
  33. package/dist/components/card.d.ts +47 -19
  34. package/dist/components/card.js +31 -46
  35. package/dist/components/carousel.d.ts +28 -0
  36. package/dist/components/carousel.js +130 -0
  37. package/dist/components/chart.d.ts +49 -0
  38. package/dist/components/chart.js +258 -0
  39. package/dist/components/checkbox-group.d.ts +16 -0
  40. package/dist/components/checkbox-group.js +13 -0
  41. package/dist/components/checkbox.d.ts +25 -10
  42. package/dist/components/checkbox.js +87 -81
  43. package/dist/components/chip-input.d.ts +46 -20
  44. package/dist/components/chip-input.js +172 -176
  45. package/dist/components/chip.d.ts +28 -0
  46. package/dist/components/chip.js +73 -0
  47. package/dist/components/choice-card.d.ts +10 -13
  48. package/dist/components/choice-card.js +11 -62
  49. package/dist/components/choice-carousel.d.ts +9 -0
  50. package/dist/components/choice-carousel.js +28 -44
  51. package/dist/components/choice-preview-card.d.ts +10 -20
  52. package/dist/components/choice-preview-card.js +12 -40
  53. package/dist/components/color-input.d.ts +36 -11
  54. package/dist/components/color-input.js +131 -59
  55. package/dist/components/combobox.d.ts +60 -57
  56. package/dist/components/combobox.js +210 -213
  57. package/dist/components/command.d.ts +58 -0
  58. package/dist/components/command.js +177 -0
  59. package/dist/components/contact.d.ts +23 -0
  60. package/dist/components/contact.js +32 -0
  61. package/dist/components/context-menu.d.ts +34 -26
  62. package/dist/components/context-menu.js +41 -68
  63. package/dist/components/copy-field.d.ts +10 -5
  64. package/dist/components/copy-field.js +24 -29
  65. package/dist/components/currency-input.d.ts +25 -11
  66. package/dist/components/currency-input.js +29 -65
  67. package/dist/components/danger-zone.d.ts +10 -1
  68. package/dist/components/danger-zone.js +14 -18
  69. package/dist/components/data-table-header.d.ts +13 -2
  70. package/dist/components/data-table-header.js +114 -190
  71. package/dist/components/date-picker.d.ts +31 -32
  72. package/dist/components/date-picker.js +119 -254
  73. package/dist/components/delta.d.ts +26 -0
  74. package/dist/components/delta.js +24 -0
  75. package/dist/components/dialog.d.ts +21 -0
  76. package/dist/components/dialog.js +16 -0
  77. package/dist/components/drawer.d.ts +15 -23
  78. package/dist/components/drawer.js +57 -89
  79. package/dist/components/dropdown-menu.d.ts +63 -0
  80. package/dist/components/dropdown-menu.js +62 -0
  81. package/dist/components/dropzone.d.ts +10 -4
  82. package/dist/components/dropzone.js +30 -58
  83. package/dist/components/empty.d.ts +29 -0
  84. package/dist/components/empty.js +42 -0
  85. package/dist/components/fab.d.ts +29 -6
  86. package/dist/components/fab.js +51 -51
  87. package/dist/components/faq.d.ts +21 -0
  88. package/dist/components/faq.js +24 -0
  89. package/dist/components/file-input.d.ts +56 -0
  90. package/dist/components/file-input.js +244 -0
  91. package/dist/components/filter-chip.d.ts +34 -47
  92. package/dist/components/filter-chip.js +61 -61
  93. package/dist/components/floating-stepper.d.ts +7 -18
  94. package/dist/components/floating-stepper.js +27 -55
  95. package/dist/components/footer.d.ts +36 -0
  96. package/dist/components/footer.js +38 -0
  97. package/dist/components/form-actions.d.ts +28 -0
  98. package/dist/components/form-actions.js +24 -0
  99. package/dist/components/google-account-chooser.d.ts +25 -0
  100. package/dist/components/google-account-chooser.js +44 -0
  101. package/dist/components/google-button.d.ts +26 -0
  102. package/dist/components/google-button.js +38 -0
  103. package/dist/components/google-consent.d.ts +23 -0
  104. package/dist/components/google-consent.js +28 -0
  105. package/dist/components/google-sign-in.d.ts +26 -0
  106. package/dist/components/google-sign-in.js +36 -0
  107. package/dist/components/hover-card.d.ts +30 -0
  108. package/dist/components/hover-card.js +55 -0
  109. package/dist/components/icon-button.d.ts +41 -11
  110. package/dist/components/icon-button.js +44 -64
  111. package/dist/components/image-crop-modal.d.ts +3 -3
  112. package/dist/components/image-crop-modal.js +32 -39
  113. package/dist/components/image-upload.d.ts +21 -29
  114. package/dist/components/image-upload.js +55 -259
  115. package/dist/components/index.d.ts +105 -52
  116. package/dist/components/index.js +190 -74
  117. package/dist/components/input-otp.d.ts +35 -0
  118. package/dist/components/input-otp.js +119 -0
  119. package/dist/components/input.d.ts +23 -17
  120. package/dist/components/input.js +104 -137
  121. package/dist/components/insight-card.d.ts +25 -9
  122. package/dist/components/insight-card.js +42 -27
  123. package/dist/components/internal/announce.d.ts +3 -0
  124. package/dist/components/internal/announce.js +20 -0
  125. package/dist/components/internal/block.d.ts +15 -0
  126. package/dist/components/internal/block.js +14 -0
  127. package/dist/components/internal/button.d.ts +23 -0
  128. package/dist/components/internal/button.js +30 -0
  129. package/dist/components/internal/choice-card.d.ts +52 -0
  130. package/dist/components/internal/choice-card.js +117 -0
  131. package/dist/components/internal/choice.d.ts +25 -0
  132. package/dist/components/internal/choice.js +44 -0
  133. package/dist/components/internal/dates.d.ts +17 -0
  134. package/dist/components/internal/dates.js +59 -0
  135. package/dist/components/internal/field.d.ts +66 -0
  136. package/dist/components/internal/field.js +105 -0
  137. package/dist/components/internal/fieldset.d.ts +25 -0
  138. package/dist/components/internal/fieldset.js +56 -0
  139. package/dist/components/internal/focus-after.d.ts +3 -0
  140. package/dist/components/internal/focus-after.js +13 -0
  141. package/dist/components/internal/google.d.ts +47 -0
  142. package/dist/components/internal/google.js +73 -0
  143. package/dist/components/internal/icons.d.ts +108 -0
  144. package/dist/components/internal/icons.js +316 -0
  145. package/dist/components/internal/menu.d.ts +16 -0
  146. package/dist/components/internal/menu.js +14 -0
  147. package/dist/components/internal/modal.d.ts +50 -0
  148. package/dist/components/internal/modal.js +85 -0
  149. package/dist/components/internal/option-content.d.ts +10 -0
  150. package/dist/components/internal/option-content.js +13 -0
  151. package/dist/components/internal/radio-context.d.ts +16 -0
  152. package/dist/components/internal/radio-context.js +6 -0
  153. package/dist/components/internal/toggle.d.ts +7 -0
  154. package/dist/components/internal/toggle.js +13 -0
  155. package/dist/components/internal/use-listbox.d.ts +56 -0
  156. package/dist/components/internal/use-listbox.js +69 -0
  157. package/dist/components/internal/whatsapp.d.ts +8 -0
  158. package/dist/components/internal/whatsapp.js +12 -0
  159. package/dist/components/item.d.ts +32 -0
  160. package/dist/components/item.js +35 -0
  161. package/dist/components/kbd.d.ts +17 -0
  162. package/dist/components/kbd.js +18 -0
  163. package/dist/components/listbox.d.ts +34 -0
  164. package/dist/components/listbox.js +114 -0
  165. package/dist/components/marker.d.ts +24 -0
  166. package/dist/components/marker.js +28 -0
  167. package/dist/components/media-tile.d.ts +17 -14
  168. package/dist/components/media-tile.js +19 -27
  169. package/dist/components/message-scroller.d.ts +20 -0
  170. package/dist/components/message-scroller.js +108 -0
  171. package/dist/components/message.d.ts +33 -0
  172. package/dist/components/message.js +23 -0
  173. package/dist/components/navigation-menu.d.ts +42 -0
  174. package/dist/components/navigation-menu.js +30 -0
  175. package/dist/components/newsletter.d.ts +27 -0
  176. package/dist/components/newsletter.js +75 -0
  177. package/dist/components/number-input.d.ts +60 -0
  178. package/dist/components/number-input.js +234 -0
  179. package/dist/components/option-tile.d.ts +20 -19
  180. package/dist/components/option-tile.js +52 -137
  181. package/dist/components/page-header.d.ts +31 -0
  182. package/dist/components/page-header.js +25 -0
  183. package/dist/components/page-shell.d.ts +11 -1
  184. package/dist/components/page-shell.js +8 -34
  185. package/dist/components/page-skeleton.d.ts +15 -21
  186. package/dist/components/page-skeleton.js +28 -25
  187. package/dist/components/pagination.d.ts +32 -22
  188. package/dist/components/pagination.js +78 -76
  189. package/dist/components/password-input.d.ts +26 -0
  190. package/dist/components/password-input.js +112 -0
  191. package/dist/components/phone-input.d.ts +12 -8
  192. package/dist/components/phone-input.js +75 -64
  193. package/dist/components/phone.d.ts +27 -0
  194. package/dist/components/phone.js +35 -0
  195. package/dist/components/popover.d.ts +25 -36
  196. package/dist/components/popover.js +30 -131
  197. package/dist/components/pricing-card.d.ts +9 -25
  198. package/dist/components/pricing-card.js +9 -40
  199. package/dist/components/pricing.d.ts +48 -0
  200. package/dist/components/pricing.js +64 -0
  201. package/dist/components/progress.d.ts +30 -0
  202. package/dist/components/progress.js +57 -0
  203. package/dist/components/qr-display.d.ts +11 -6
  204. package/dist/components/qr-display.js +6 -22
  205. package/dist/components/questionnaire.d.ts +42 -0
  206. package/dist/components/questionnaire.js +107 -0
  207. package/dist/components/radio-group.d.ts +21 -0
  208. package/dist/components/radio-group.js +40 -0
  209. package/dist/components/radio.d.ts +15 -29
  210. package/dist/components/radio.js +45 -103
  211. package/dist/components/row-actions.d.ts +5 -0
  212. package/dist/components/row-actions.js +27 -34
  213. package/dist/components/saving-bar-context.d.ts +0 -5
  214. package/dist/components/saving-bar-context.js +16 -40
  215. package/dist/components/saving-bar.d.ts +26 -11
  216. package/dist/components/saving-bar.js +50 -65
  217. package/dist/components/section-card.d.ts +18 -4
  218. package/dist/components/section-card.js +29 -50
  219. package/dist/components/section-header.d.ts +8 -12
  220. package/dist/components/section-header.js +5 -10
  221. package/dist/components/select.d.ts +44 -16
  222. package/dist/components/select.js +83 -154
  223. package/dist/components/selectable-card.d.ts +11 -19
  224. package/dist/components/selectable-card.js +4 -28
  225. package/dist/components/separator.d.ts +20 -0
  226. package/dist/components/separator.js +19 -0
  227. package/dist/components/setting-row.d.ts +11 -15
  228. package/dist/components/setting-row.js +10 -23
  229. package/dist/components/settings-list.d.ts +10 -12
  230. package/dist/components/settings-list.js +7 -19
  231. package/dist/components/sheet.d.ts +21 -0
  232. package/dist/components/sheet.js +16 -0
  233. package/dist/components/sidebar.d.ts +79 -0
  234. package/dist/components/sidebar.js +111 -0
  235. package/dist/components/skeleton.d.ts +14 -20
  236. package/dist/components/skeleton.js +8 -37
  237. package/dist/components/slider.d.ts +21 -23
  238. package/dist/components/slider.js +59 -64
  239. package/dist/components/sparkline.d.ts +19 -0
  240. package/dist/components/sparkline.js +32 -0
  241. package/dist/components/spinner.d.ts +16 -8
  242. package/dist/components/spinner.js +34 -37
  243. package/dist/components/star-rating.d.ts +22 -0
  244. package/dist/components/star-rating.js +25 -0
  245. package/dist/components/stat.d.ts +33 -0
  246. package/dist/components/stat.js +29 -0
  247. package/dist/components/status.d.ts +27 -0
  248. package/dist/components/status.js +34 -0
  249. package/dist/components/step-progress.d.ts +13 -6
  250. package/dist/components/step-progress.js +18 -16
  251. package/dist/components/summary-bar.d.ts +20 -20
  252. package/dist/components/summary-bar.js +13 -55
  253. package/dist/components/switch.d.ts +20 -0
  254. package/dist/components/switch.js +46 -0
  255. package/dist/components/table.d.ts +56 -17
  256. package/dist/components/table.js +59 -58
  257. package/dist/components/tabs.d.ts +67 -0
  258. package/dist/components/tabs.js +56 -0
  259. package/dist/components/testimonial.d.ts +30 -0
  260. package/dist/components/testimonial.js +36 -0
  261. package/dist/components/textarea.d.ts +11 -16
  262. package/dist/components/textarea.js +55 -91
  263. package/dist/components/tile.d.ts +24 -0
  264. package/dist/components/tile.js +21 -0
  265. package/dist/components/time-picker.d.ts +40 -25
  266. package/dist/components/time-picker.js +185 -203
  267. package/dist/components/toast.d.ts +63 -0
  268. package/dist/components/toast.js +132 -0
  269. package/dist/components/toggle-card-compact.d.ts +15 -5
  270. package/dist/components/toggle-card-compact.js +19 -86
  271. package/dist/components/toggle-card.d.ts +11 -2
  272. package/dist/components/toggle-card.js +8 -77
  273. package/dist/components/toggle-group.d.ts +21 -59
  274. package/dist/components/toggle-group.js +31 -80
  275. package/dist/components/toggle.d.ts +19 -9
  276. package/dist/components/toggle.js +16 -61
  277. package/dist/components/tooltip.d.ts +25 -12
  278. package/dist/components/tooltip.js +15 -88
  279. package/dist/components/top-navigation.d.ts +33 -0
  280. package/dist/components/top-navigation.js +85 -0
  281. package/dist/components/typing-indicator.d.ts +6 -0
  282. package/dist/components/typing-indicator.js +3 -24
  283. package/dist/components/whatsapp-chat.d.ts +28 -0
  284. package/dist/components/whatsapp-chat.js +95 -0
  285. package/dist/components/whatsapp-message.d.ts +22 -0
  286. package/dist/components/whatsapp-message.js +34 -0
  287. package/dist/components/whatsapp-notification.d.ts +27 -0
  288. package/dist/components/whatsapp-notification.js +73 -0
  289. package/dist/components/whatsapp-template.d.ts +42 -0
  290. package/dist/components/whatsapp-template.js +69 -0
  291. package/dist/icons/index.d.ts +2 -0
  292. package/dist/icons/index.js +2 -0
  293. package/dist/icons/pix.d.ts +16 -0
  294. package/dist/targets/native/components/index.d.ts +0 -2
  295. package/dist/targets/native/components/index.js +0 -4
  296. package/dist/targets/native/preset.cjs +0 -1
  297. package/dist/targets/native/theme.css +58 -60
  298. package/dist/targets/native/theme.d.ts +58 -60
  299. package/dist/targets/native/theme.js +58 -60
  300. package/package.json +34 -12
  301. package/styles/_primitives.generated.css +40 -0
  302. package/styles/base.css +12 -18
  303. package/styles/rds/components-styles.css +11365 -0
  304. package/styles/rds/components.css +993 -0
  305. package/styles/rds/foundation.css +74 -0
  306. package/styles/rds/theme.css +261 -0
  307. package/styles/rds.css +6 -0
  308. package/styles/themes/rojao.css +46 -53
  309. package/dist/components/blocker-card.d.ts +0 -42
  310. package/dist/components/blocker-card.js +0 -54
  311. package/dist/components/bottom-sheet.d.ts +0 -31
  312. package/dist/components/bottom-sheet.js +0 -127
  313. package/dist/components/chat-bubble.d.ts +0 -16
  314. package/dist/components/chat-bubble.js +0 -56
  315. package/dist/components/chips.d.ts +0 -22
  316. package/dist/components/chips.js +0 -101
  317. package/dist/components/copilot-hint.d.ts +0 -18
  318. package/dist/components/copilot-hint.js +0 -72
  319. package/dist/components/divider.d.ts +0 -20
  320. package/dist/components/divider.js +0 -50
  321. package/dist/components/empty-state.d.ts +0 -48
  322. package/dist/components/empty-state.js +0 -94
  323. package/dist/components/form-card-header.d.ts +0 -13
  324. package/dist/components/form-card-header.js +0 -16
  325. package/dist/components/label.d.ts +0 -16
  326. package/dist/components/label.js +0 -48
  327. package/dist/components/menu.d.ts +0 -50
  328. package/dist/components/menu.js +0 -83
  329. package/dist/components/modal.d.ts +0 -25
  330. package/dist/components/modal.js +0 -86
  331. package/dist/components/notice.d.ts +0 -50
  332. package/dist/components/notice.js +0 -121
  333. package/dist/components/page-tabs.d.ts +0 -35
  334. package/dist/components/page-tabs.js +0 -68
  335. package/dist/components/paywall-banner.d.ts +0 -37
  336. package/dist/components/paywall-banner.js +0 -58
  337. package/dist/components/paywall.d.ts +0 -44
  338. package/dist/components/paywall.js +0 -65
  339. package/dist/components/phone-frame.d.ts +0 -9
  340. package/dist/components/phone-frame.js +0 -19
  341. package/dist/components/pix-icon.d.ts +0 -8
  342. package/dist/components/search.d.ts +0 -30
  343. package/dist/components/search.js +0 -86
  344. package/dist/components/themed.d.ts +0 -36
  345. package/dist/components/themed.js +0 -23
  346. package/dist/components/toaster.d.ts +0 -84
  347. package/dist/components/toaster.js +0 -290
  348. package/dist/components/use-dismiss.d.ts +0 -9
  349. package/dist/components/use-dismiss.js +0 -28
  350. package/dist/components/use-focus-trap.d.ts +0 -5
  351. package/dist/components/use-focus-trap.js +0 -54
  352. package/dist/targets/native/components/paywall-banner.d.ts +0 -11
  353. package/dist/targets/native/components/paywall-banner.js +0 -55
  354. package/dist/targets/native/components/paywall.d.ts +0 -18
  355. package/dist/targets/native/components/paywall.js +0 -71
  356. /package/dist/{components/pix-icon.js → icons/pix.js} +0 -0
@@ -0,0 +1,107 @@
1
+ "use client";
2
+ import {
3
+ __objRest,
4
+ __spreadProps,
5
+ __spreadValues
6
+ } from "../chunk-ORMEWXMH.js";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { Button } from "./button.js";
9
+ import { CheckboxGroup } from "./checkbox-group.js";
10
+ import { ChoiceCardGroup } from "./choice-card.js";
11
+ import { AlertIcon } from "./internal/icons.js";
12
+ import { Progress } from "./progress.js";
13
+ import { RadioGroup } from "./radio-group.js";
14
+ function Questionnaire(_a) {
15
+ var _b = _a, {
16
+ step,
17
+ steps,
18
+ title,
19
+ description,
20
+ answer = "single",
21
+ children,
22
+ value,
23
+ defaultValue,
24
+ onValueChange,
25
+ error,
26
+ onBack,
27
+ onSkip,
28
+ onNext,
29
+ className
30
+ } = _b, rest = __objRest(_b, [
31
+ "step",
32
+ "steps",
33
+ "title",
34
+ "description",
35
+ "answer",
36
+ "children",
37
+ "value",
38
+ "defaultValue",
39
+ "onValueChange",
40
+ "error",
41
+ "onBack",
42
+ "onSkip",
43
+ "onNext",
44
+ "className"
45
+ ]);
46
+ const errorMessage = error ? /* @__PURE__ */ jsxs("span", { className: "rds-questionnaire__error", children: [
47
+ /* @__PURE__ */ jsx("span", { className: "rds-questionnaire__error-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx(AlertIcon, {}) }),
48
+ /* @__PURE__ */ jsx("span", { children: error })
49
+ ] }) : void 0;
50
+ const legend = /* @__PURE__ */ jsx("span", { className: "rds-questionnaire__title", children: title });
51
+ const hint = description ? /* @__PURE__ */ jsx("span", { className: "rds-questionnaire__description", children: description }) : void 0;
52
+ let body;
53
+ if (answer === "single") {
54
+ body = /* @__PURE__ */ jsx(
55
+ RadioGroup,
56
+ {
57
+ legend,
58
+ hint,
59
+ errorMessage,
60
+ value,
61
+ defaultValue,
62
+ onValueChange,
63
+ children
64
+ }
65
+ );
66
+ } else if (answer === "multiple") {
67
+ body = /* @__PURE__ */ jsx(CheckboxGroup, { legend, hint, errorMessage, children });
68
+ } else {
69
+ const heading = /* @__PURE__ */ jsxs("span", { className: "rds-questionnaire__heading", children: [
70
+ legend,
71
+ hint
72
+ ] });
73
+ body = /* @__PURE__ */ jsxs("div", { className: "rds-questionnaire__body", children: [
74
+ answer === "card" ? /* @__PURE__ */ jsx(ChoiceCardGroup, { legend: heading, value, defaultValue, onValueChange, children }) : /* @__PURE__ */ jsxs(Fragment, { children: [
75
+ /* @__PURE__ */ jsx("p", { className: "rds-questionnaire__text-heading", children: heading }),
76
+ children
77
+ ] }),
78
+ errorMessage && /* @__PURE__ */ jsx("p", { role: "alert", className: "rds-questionnaire__alert", children: errorMessage })
79
+ ] });
80
+ }
81
+ return /* @__PURE__ */ jsxs(
82
+ "form",
83
+ __spreadProps(__spreadValues({
84
+ noValidate: true,
85
+ "aria-label": title
86
+ }, rest), {
87
+ className: ["rds-questionnaire", className].filter(Boolean).join(" "),
88
+ onSubmit: (event) => {
89
+ event.preventDefault();
90
+ onNext();
91
+ },
92
+ children: [
93
+ /* @__PURE__ */ jsx(Progress, { size: "sm", value: step, max: steps, label: `Pergunta ${step} de ${steps}`, showValue: false }),
94
+ body,
95
+ /* @__PURE__ */ jsxs("div", { className: "rds-questionnaire__actions", children: [
96
+ onBack && /* @__PURE__ */ jsx(Button, { tone: "neutral", variant: "ghost", onClick: onBack, children: "Voltar" }),
97
+ /* @__PURE__ */ jsx("span", { className: "rds-questionnaire__spacer" }),
98
+ onSkip && /* @__PURE__ */ jsx(Button, { tone: "neutral", variant: "ghost", onClick: onSkip, children: "Pular" }),
99
+ /* @__PURE__ */ jsx(Button, { type: "submit", children: step >= steps ? "Enviar" : "Pr\xF3xima" })
100
+ ] })
101
+ ]
102
+ })
103
+ );
104
+ }
105
+ export {
106
+ Questionnaire
107
+ };
@@ -0,0 +1,21 @@
1
+ import * as react from 'react';
2
+ import { ChoiceFieldsetProps } from './internal/fieldset.js';
3
+
4
+ interface RadioGroupProps extends Omit<ChoiceFieldsetProps, 'onChange' | 'defaultValue'> {
5
+ /** The form field name shared by every option. By default a generated one. */
6
+ name?: string;
7
+ /** Controlled: the chosen option's value. */
8
+ value?: string;
9
+ /** Uncontrolled: the option chosen at first. */
10
+ defaultValue?: string;
11
+ onValueChange?: (value: string) => void;
12
+ }
13
+ /**
14
+ * RadioGroup — Figma [RDS] Forms/RadioGroup. A question and 2 to 5 single-choice options (Radio children,
15
+ * Figma slot `options`) in a <fieldset role="radiogroup">, with the group's hint and error. Tab enters on the
16
+ * chosen option; the arrows move and choose (native radios sharing one name). Styles: radio-group.css and
17
+ * internal/fieldset.css.
18
+ */
19
+ declare function RadioGroup({ name, value, defaultValue, onValueChange, required, disabled, error, ...rest }: RadioGroupProps): react.JSX.Element;
20
+
21
+ export { RadioGroup, type RadioGroupProps };
@@ -0,0 +1,40 @@
1
+ "use client";
2
+ import {
3
+ __objRest,
4
+ __spreadValues
5
+ } from "../chunk-ORMEWXMH.js";
6
+ import { jsx } from "react/jsx-runtime";
7
+ import { Children, isValidElement, useId } from "react";
8
+ import { hasContent } from "./internal/field.js";
9
+ import { ChoiceFieldset } from "./internal/fieldset.js";
10
+ import { RadioGroupContext } from "./internal/radio-context.js";
11
+ function RadioGroup(_a) {
12
+ var _b = _a, { name, value, defaultValue, onValueChange, required, disabled, error } = _b, rest = __objRest(_b, ["name", "value", "defaultValue", "onValueChange", "required", "disabled", "error"]);
13
+ const generated = useId();
14
+ const invalid = Boolean(error || hasContent(rest.errorMessage));
15
+ const first = Children.toArray(rest.children).find(
16
+ (child) => isValidElement(child) && child.props.value !== void 0
17
+ );
18
+ const firstValue = isValidElement(first) ? first.props.value : void 0;
19
+ return /* @__PURE__ */ jsx(
20
+ RadioGroupContext.Provider,
21
+ {
22
+ value: { name: name != null ? name : generated, value, defaultValue, onValueChange, required, firstValue, disabled, error: invalid },
23
+ children: /* @__PURE__ */ jsx(
24
+ ChoiceFieldset,
25
+ __spreadValues({
26
+ kind: "rds-radio-group",
27
+ role: "radiogroup",
28
+ "aria-required": required || void 0,
29
+ "aria-invalid": invalid || void 0,
30
+ required,
31
+ disabled,
32
+ error: invalid
33
+ }, rest)
34
+ )
35
+ }
36
+ );
37
+ }
38
+ export {
39
+ RadioGroup
40
+ };
@@ -1,33 +1,19 @@
1
1
  import * as react from 'react';
2
- import { InputHTMLAttributes, ReactNode } from 'react';
2
+ import { ComponentPropsWithRef, ReactNode } from 'react';
3
3
 
4
- interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> {
5
- label?: ReactNode;
6
- description?: ReactNode;
7
- error?: string;
8
- size?: 'sm' | 'md';
4
+ interface RadioProps extends Omit<ComponentPropsWithRef<'input'>, 'type' | 'children' | 'name' | 'value' | 'checked' | 'defaultChecked' | 'size'> {
5
+ /** The option's value, sent with the form and used by the RadioGroup's `value`. */
6
+ value: string;
7
+ /** The option's text (Figma: `showLabel` + `label`). Without it, pass aria-label. */
8
+ children?: ReactNode;
9
+ /** A line under the label (Figma: `showHint` + `hint`), tied by aria-describedby. */
10
+ hint?: ReactNode;
9
11
  }
10
- declare const Radio: react.ForwardRefExoticComponent<RadioProps & react.RefAttributes<HTMLInputElement>>;
11
- interface RadioOption<T extends string = string> {
12
- value: T;
13
- label: ReactNode;
14
- description?: ReactNode;
15
- disabled?: boolean;
16
- }
17
- interface RadioGroupProps<T extends string = string> {
18
- name: string;
19
- value: T | null;
20
- onChange: (value: T) => void;
21
- options: RadioOption<T>[];
22
- /** Layout. default = vertical. */
23
- orientation?: 'horizontal' | 'vertical';
24
- size?: 'sm' | 'md';
25
- error?: string;
26
- /** Label do group como `<legend>`. */
27
- legend?: ReactNode;
28
- required?: boolean;
29
- className?: string;
30
- }
31
- declare function RadioGroup<T extends string = string>({ name, value, onChange, options, orientation, size, error, legend, required, className, }: RadioGroupProps<T>): react.JSX.Element;
12
+ /**
13
+ * Radio — Figma [RDS] Forms/Radio. One single-choice option. It only exists inside a RadioGroup, which gives
14
+ * it the name, the chosen value, required, disabled and the error. Native <input type="radio">.
15
+ * Styles: radio.css and internal/choice.css.
16
+ */
17
+ declare function Radio({ value, children, hint, disabled, id, className, style, onChange, ...input }: RadioProps): react.JSX.Element;
32
18
 
33
- export { Radio, RadioGroup, type RadioGroupProps, type RadioOption, type RadioProps };
19
+ export { Radio, type RadioProps };
@@ -1,114 +1,56 @@
1
1
  "use client";
2
2
  import {
3
3
  __objRest,
4
+ __spreadProps,
4
5
  __spreadValues
5
6
  } from "../chunk-ORMEWXMH.js";
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- import { forwardRef, useId } from "react";
8
- const SIZE_CLASS = {
9
- sm: { box: "size-3.5", dot: "size-1.5", label: "text-caption" },
10
- md: { box: "size-4", dot: "size-2", label: "text-label" }
11
- };
12
- const Radio = forwardRef(function Radio2(_a, ref) {
13
- var _b = _a, { label, description, error, size = "md", className = "", id } = _b, props = __objRest(_b, ["label", "description", "error", "size", "className", "id"]);
14
- const generatedId = useId();
15
- const inputId = id != null ? id : generatedId;
16
- const errId = `${inputId}-error`;
17
- const sz = SIZE_CLASS[size];
18
- return /* @__PURE__ */ jsxs("div", { className: "inline-flex flex-col gap-0.5", children: [
19
- /* @__PURE__ */ jsxs(
20
- "label",
21
- {
22
- htmlFor: inputId,
23
- className: [
24
- "inline-flex items-start gap-2 cursor-pointer",
25
- "has-[:disabled]:opacity-50 has-[:disabled]:cursor-not-allowed",
26
- className
27
- ].filter(Boolean).join(" "),
28
- children: [
29
- /* @__PURE__ */ jsxs("span", { className: ["relative flex shrink-0 mt-0.5", sz.box].join(" "), children: [
30
- /* @__PURE__ */ jsx(
31
- "input",
32
- __spreadValues({
33
- ref,
34
- type: "radio",
35
- id: inputId,
36
- "aria-invalid": error ? true : void 0,
37
- "aria-describedby": error ? errId : void 0,
38
- className: [
39
- "peer appearance-none rounded-full shrink-0 cursor-pointer",
40
- sz.box,
41
- "bg-surface-default",
42
- error ? "border border-danger checked:border-danger" : "border border-stroke-control checked:border-brand-primary",
43
- "focus-visible:ring-2 focus-visible:ring-stroke-focus/30 focus-visible:outline-none",
44
- "disabled:cursor-not-allowed transition-colors"
45
- ].join(" ")
46
- }, props)
47
- ),
48
- /* @__PURE__ */ jsx(
49
- "span",
50
- {
51
- "aria-hidden": true,
52
- className: [
53
- "absolute inset-0 m-auto rounded-full bg-transparent transition-colors pointer-events-none",
54
- sz.dot,
55
- error ? "peer-checked:bg-danger" : "peer-checked:bg-brand-primary"
56
- ].join(" ")
57
- }
58
- )
59
- ] }),
60
- (label || description) && /* @__PURE__ */ jsxs("span", { className: "flex flex-col gap-0.5 select-none", children: [
61
- label && /* @__PURE__ */ jsx("span", { className: [sz.label, "text-fg-primary leading-snug"].join(" "), children: label }),
62
- description && /* @__PURE__ */ jsx("span", { className: "text-caption text-fg-muted leading-snug", children: description })
63
- ] })
64
- ]
65
- }
66
- ),
67
- error && /* @__PURE__ */ jsx("p", { id: errId, className: [sz.box === "size-3.5" ? "pl-5" : "pl-6", "text-caption text-danger-text"].join(" "), children: error })
68
- ] });
69
- });
70
- function RadioGroup({
71
- name,
72
- value,
73
- onChange,
74
- options,
75
- orientation = "vertical",
76
- size = "md",
77
- error,
78
- legend,
79
- required,
80
- className = ""
81
- }) {
82
- return /* @__PURE__ */ jsxs(
83
- "fieldset",
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { useContext } from "react";
9
+ import { ChoiceRow } from "./internal/choice.js";
10
+ import { warnIfUnlabelled } from "./internal/field.js";
11
+ import { RadioGroupContext } from "./internal/radio-context.js";
12
+ function Radio(_a) {
13
+ var _b = _a, { value, children, hint, disabled, id, className, style, onChange } = _b, input = __objRest(_b, ["value", "children", "hint", "disabled", "id", "className", "style", "onChange"]);
14
+ const group = useContext(RadioGroupContext);
15
+ if (!group) console.warn("[@rojaostudio/ds] Radio: use it inside a RadioGroup. A Radio alone is not a choice.");
16
+ warnIfUnlabelled("Radio", children, input["aria-label"], input["aria-labelledby"]);
17
+ const controlled = (group == null ? void 0 : group.value) !== void 0;
18
+ const off = disabled || (group == null ? void 0 : group.disabled);
19
+ return /* @__PURE__ */ jsx(
20
+ ChoiceRow,
84
21
  {
85
- className: ["flex flex-col gap-2", className].join(" "),
86
- "aria-invalid": error ? true : void 0,
87
- children: [
88
- legend && /* @__PURE__ */ jsxs("legend", { className: "text-label font-medium text-fg-primary mb-0.5", children: [
89
- legend,
90
- required && /* @__PURE__ */ jsx("span", { className: "text-danger ml-0.5", "aria-label": "obrigat\xF3rio", children: "*" })
91
- ] }),
92
- /* @__PURE__ */ jsx("div", { className: ["flex", orientation === "horizontal" ? "flex-row gap-4 flex-wrap" : "flex-col gap-2"].join(" "), children: options.map((opt) => /* @__PURE__ */ jsx(
93
- Radio,
94
- {
95
- name,
96
- value: opt.value,
97
- checked: value === opt.value,
98
- onChange: () => onChange(opt.value),
99
- label: opt.label,
100
- description: opt.description,
101
- disabled: opt.disabled,
102
- size
103
- },
104
- opt.value
105
- )) }),
106
- error && /* @__PURE__ */ jsx("p", { className: "text-caption text-danger-text", children: error })
107
- ]
22
+ kind: "rds-radio",
23
+ id,
24
+ label: children,
25
+ hint,
26
+ disabled: off,
27
+ invalid: group == null ? void 0 : group.error,
28
+ className,
29
+ style,
30
+ control: ({ id: controlId, describedBy }) => /* @__PURE__ */ jsxs(Fragment, { children: [
31
+ /* @__PURE__ */ jsx(
32
+ "input",
33
+ __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, input), {
34
+ id: controlId,
35
+ type: "radio",
36
+ name: group == null ? void 0 : group.name,
37
+ value,
38
+ required: (group == null ? void 0 : group.required) && (group.firstValue === void 0 || group.firstValue === value),
39
+ disabled: off,
40
+ "aria-describedby": [describedBy, input["aria-describedby"]].filter(Boolean).join(" ") || void 0
41
+ }), controlled ? { checked: (group == null ? void 0 : group.value) === value } : { defaultChecked: (group == null ? void 0 : group.defaultValue) === value }), {
42
+ onChange: (event) => {
43
+ var _a2;
44
+ onChange == null ? void 0 : onChange(event);
45
+ if (event.target.checked) (_a2 = group == null ? void 0 : group.onValueChange) == null ? void 0 : _a2.call(group, value);
46
+ }
47
+ })
48
+ ),
49
+ /* @__PURE__ */ jsx("span", { className: "rds-radio__circle", "aria-hidden": "true" })
50
+ ] })
108
51
  }
109
52
  );
110
53
  }
111
54
  export {
112
- Radio,
113
- RadioGroup
55
+ Radio
114
56
  };
@@ -8,6 +8,11 @@ interface RowActionItem {
8
8
  disabled?: boolean;
9
9
  onClick: () => void;
10
10
  }
11
+ /**
12
+ * RowActions — a composition of the Button (outline, neutral), the IconButton with its Tooltip and the
13
+ * DropdownMenu: the actions at the end of a table row. One action in view, the rest behind "Mais ações"; danger
14
+ * items go last, after a separator. Clicks do not reach the row. Styles: row-actions.css.
15
+ */
11
16
  interface RowActionsProps {
12
17
  /** Rótulo do botão principal (ex: "Ver detalhes"). */
13
18
  primaryLabel: string;
@@ -1,9 +1,11 @@
1
1
  "use client";
2
2
  import "../chunk-ORMEWXMH.js";
3
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
- import { MoreVertical } from "lucide-react";
5
- import { Menu, MenuItem, MenuSeparator } from "./menu.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { Button } from "./button.js";
5
+ import { DropdownMenu, DropdownMenuItem, DropdownMenuSeparator } from "./dropdown-menu.js";
6
6
  import { IconButton } from "./icon-button.js";
7
+ import { Tooltip } from "./tooltip.js";
8
+ import { MoreVerticalIcon } from "./internal/icons.js";
7
9
  function RowActions({
8
10
  primaryLabel,
9
11
  primaryHref,
@@ -15,13 +17,12 @@ function RowActions({
15
17
  const showSep = dangerSeparator != null ? dangerSeparator : hasDanger;
16
18
  const normalItems = showSep ? items.filter((i) => i.variant !== "danger") : items;
17
19
  const dangerItems = showSep ? items.filter((i) => i.variant === "danger") : [];
18
- const primaryCls = "inline-flex items-center gap-1 text-caption font-medium border border-stroke-default rounded-(--radius-control) px-2.5 py-1 text-fg-secondary hover:bg-surface-page hover:border-stroke-strong transition-colors whitespace-nowrap";
19
- return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-1", children: [
20
- primaryHref ? /* @__PURE__ */ jsx("a", { href: primaryHref, className: primaryCls, onClick: (e) => e.stopPropagation(), children: primaryLabel }) : primaryOnClick ? /* @__PURE__ */ jsx(
21
- "button",
20
+ return /* @__PURE__ */ jsxs("div", { className: "rds-row-actions", children: [
21
+ primaryHref ? /* @__PURE__ */ jsx(Button, { asChild: true, variant: "outline", tone: "neutral", children: /* @__PURE__ */ jsx("a", { href: primaryHref, onClick: (e) => e.stopPropagation(), children: primaryLabel }) }) : primaryOnClick ? /* @__PURE__ */ jsx(
22
+ Button,
22
23
  {
23
- type: "button",
24
- className: primaryCls,
24
+ variant: "outline",
25
+ tone: "neutral",
25
26
  onClick: (e) => {
26
27
  e.stopPropagation();
27
28
  primaryOnClick();
@@ -29,52 +30,44 @@ function RowActions({
29
30
  children: primaryLabel
30
31
  }
31
32
  ) : null,
32
- items.length > 0 && /* @__PURE__ */ jsx("div", { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(
33
- Menu,
33
+ items.length > 0 && /* @__PURE__ */ jsx("div", { className: "rds-row-actions__more", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxs(
34
+ DropdownMenu,
34
35
  {
35
- trigger: /* @__PURE__ */ jsx(
36
+ trigger: /* @__PURE__ */ jsx(Tooltip, { text: "Mais a\xE7\xF5es", children: /* @__PURE__ */ jsx(
36
37
  IconButton,
37
38
  {
38
- icon: /* @__PURE__ */ jsx(MoreVertical, {}),
39
- "aria-label": "Mais a\xE7\xF5es",
40
- size: "sm",
39
+ icon: /* @__PURE__ */ jsx(MoreVerticalIcon, {}),
40
+ label: "Mais a\xE7\xF5es",
41
41
  variant: "ghost",
42
- color: "secondary"
42
+ tone: "neutral"
43
43
  }
44
- ),
45
- placement: "bottom-end",
46
- minWidth: 160,
47
- children: ({ close }) => /* @__PURE__ */ jsxs(Fragment, { children: [
44
+ ) }),
45
+ align: "end",
46
+ children: [
48
47
  normalItems.map((item, i) => /* @__PURE__ */ jsx(
49
- MenuItem,
48
+ DropdownMenuItem,
50
49
  {
51
50
  icon: item.icon,
52
- variant: item.variant,
51
+ tone: item.variant,
53
52
  disabled: item.disabled,
54
- onClick: () => {
55
- item.onClick();
56
- close();
57
- },
53
+ onSelect: item.onClick,
58
54
  children: item.label
59
55
  },
60
56
  i
61
57
  )),
62
- showSep && dangerItems.length > 0 && /* @__PURE__ */ jsx(MenuSeparator, {}),
58
+ showSep && dangerItems.length > 0 && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
63
59
  dangerItems.map((item, i) => /* @__PURE__ */ jsx(
64
- MenuItem,
60
+ DropdownMenuItem,
65
61
  {
66
62
  icon: item.icon,
67
- variant: "danger",
63
+ tone: "danger",
68
64
  disabled: item.disabled,
69
- onClick: () => {
70
- item.onClick();
71
- close();
72
- },
65
+ onSelect: item.onClick,
73
66
  children: item.label
74
67
  },
75
68
  `d-${i}`
76
69
  ))
77
- ] })
70
+ ]
78
71
  }
79
72
  ) })
80
73
  ] });
@@ -11,11 +11,6 @@ type SavingBarRegistration = {
11
11
  pending?: boolean;
12
12
  saveLabel?: string;
13
13
  discardLabel?: string;
14
- /** Optional third button shown between Discard and Save. Hidden when bars are aggregated. */
15
- secondary?: {
16
- label: string;
17
- onClick: () => void;
18
- };
19
14
  };
20
15
  declare function SavingBarProvider({ children }: {
21
16
  children: ReactNode;
@@ -3,7 +3,7 @@ import {
3
3
  __spreadProps,
4
4
  __spreadValues
5
5
  } from "../chunk-ORMEWXMH.js";
6
- import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { jsx } from "react/jsx-runtime";
7
7
  import {
8
8
  createContext,
9
9
  useCallback,
@@ -14,7 +14,7 @@ import {
14
14
  useRef,
15
15
  useState
16
16
  } from "react";
17
- import { Loader2 } from "lucide-react";
17
+ import { SavingBar } from "./saving-bar.js";
18
18
  const SavingBarContext = createContext({
19
19
  bars: /* @__PURE__ */ new Map(),
20
20
  register: () => {
@@ -59,7 +59,7 @@ function useSavingBarActive() {
59
59
  return false;
60
60
  }
61
61
  function SavingBarRoot() {
62
- var _a, _b, _c;
62
+ var _a, _b;
63
63
  const { bars } = useContext(SavingBarContext);
64
64
  const [aggPending, setAggPending] = useState(false);
65
65
  const visible = useMemo(
@@ -83,45 +83,21 @@ function SavingBarRoot() {
83
83
  var _a2;
84
84
  for (const b of visible) (_a2 = b.onDiscard) == null ? void 0 : _a2.call(b);
85
85
  }
86
- const message = (_a = single == null ? void 0 : single.message) != null ? _a : null;
87
- const saveLabel = (_b = single == null ? void 0 : single.saveLabel) != null ? _b : "Salvar tudo";
88
- const discardLabel = (_c = single == null ? void 0 : single.discardLabel) != null ? _c : "Descartar tudo";
86
+ const saveLabel = (_a = single == null ? void 0 : single.saveLabel) != null ? _a : "Salvar tudo";
87
+ const discardLabel = (_b = single == null ? void 0 : single.discardLabel) != null ? _b : "Descartar tudo";
89
88
  const onSave = single ? single.onSave : saveAll;
90
89
  const onDiscard = single ? single.onDiscard : discardAll;
91
- const secondary = single == null ? void 0 : single.secondary;
92
- return /* @__PURE__ */ jsx("div", { className: "fixed bottom-3 right-6 z-50 transition-all duration-300 ease-out", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 rounded-(--radius-card) px-4 py-3 [background:var(--saving-bar-bg)] [box-shadow:var(--saving-bar-shadow)]", children: [
93
- message && /* @__PURE__ */ jsx("span", { className: "text-label pr-1 [color:var(--saving-bar-message)]", children: message }),
94
- onDiscard && /* @__PURE__ */ jsx(
95
- "button",
96
- {
97
- type: "button",
98
- onClick: onDiscard,
99
- disabled: anyPending,
100
- className: "rounded-(--radius-card) border px-3 py-1.5 text-label font-medium transition-colors disabled:opacity-40 [border-color:var(--saving-bar-discard-border)] [color:var(--saving-bar-discard-text)] hover:[border-color:var(--saving-bar-discard-border-hover)] hover:[color:var(--saving-bar-discard-text-hover)]",
101
- children: discardLabel
102
- }
103
- ),
104
- secondary && /* @__PURE__ */ jsx(
105
- "button",
106
- {
107
- type: "button",
108
- onClick: secondary.onClick,
109
- disabled: anyPending,
110
- className: "rounded-(--radius-card) border px-3 py-1.5 text-label font-medium transition-colors disabled:opacity-40 [border-color:var(--saving-bar-discard-border)] [color:var(--saving-bar-discard-text)] hover:[border-color:var(--saving-bar-discard-border-hover)] hover:[color:var(--saving-bar-discard-text-hover)]",
111
- children: secondary.label
112
- }
113
- ),
114
- onSave && /* @__PURE__ */ jsx(
115
- "button",
116
- {
117
- type: "button",
118
- onClick: () => onSave(),
119
- disabled: anyPending,
120
- className: "rounded-(--radius-card) px-4 py-1.5 text-label font-medium transition-colors disabled:opacity-50 flex items-center gap-2 min-w-[80px] justify-center [background:var(--saving-bar-save-bg)] [color:var(--saving-bar-save-text)] hover:[background:var(--saving-bar-save-bg-hover)]",
121
- children: anyPending ? /* @__PURE__ */ jsx(Loader2, { className: "w-4 h-4 animate-spin" }) : saveLabel
122
- }
123
- )
124
- ] }) });
90
+ return /* @__PURE__ */ jsx("div", { className: "rds-saving-bar-root", children: /* @__PURE__ */ jsx(
91
+ SavingBar,
92
+ {
93
+ status: anyPending ? "saving" : "unsaved",
94
+ message: single ? single.message : `${visible.length} altera\xE7\xF5es pendentes`,
95
+ saveLabel,
96
+ discardLabel,
97
+ onSave: () => void (onSave == null ? void 0 : onSave()),
98
+ onDiscard
99
+ }
100
+ ) });
125
101
  }
126
102
  export {
127
103
  SavingBarProvider,
@@ -1,18 +1,33 @@
1
1
  import * as react from 'react';
2
- import { ReactNode } from 'react';
2
+ import { HTMLAttributes, ReactNode } from 'react';
3
3
 
4
- interface SavingBarProps {
5
- visible: boolean;
6
- onSave?: () => void;
4
+ type SavingBarStatus = 'unsaved' | 'saving' | 'error';
5
+ interface SavingBarProps extends HTMLAttributes<HTMLDivElement> {
6
+ /**
7
+ * unsaved: the message and the actions; saving: a turning loader and `savingMessage`, buttons off;
8
+ * error: an alert, `errorMessage`, and Salvar becomes `retryLabel` (Figma: `status`).
9
+ */
10
+ status?: SavingBarStatus;
11
+ /** The unsaved text (Figma: `message`). */
12
+ message?: ReactNode;
13
+ /** The text while saving. */
14
+ savingMessage?: ReactNode;
15
+ /** The error text. */
16
+ errorMessage?: ReactNode;
17
+ /** Called by Salvar (and by Tentar de novo, on error). */
18
+ onSave: () => void;
19
+ /** Shows Descartar and is called when it is pressed (Figma: `showDiscard`). */
7
20
  onDiscard?: () => void;
8
- pending?: boolean;
9
21
  saveLabel?: string;
22
+ retryLabel?: string;
10
23
  discardLabel?: string;
11
- message?: string;
12
- children?: ReactNode;
13
- /** floating = fixed bottom-right; inline = inside page flow */
14
- variant?: 'floating' | 'inline';
15
24
  }
16
- declare function SavingBar({ visible, onSave, onDiscard, pending, saveLabel, discardLabel, message, children, variant, }: SavingBarProps): react.JSX.Element;
25
+ /**
26
+ * SavingBar — Figma [RDS] Actions/SavingBar. Shows at the foot of the screen while a change is not
27
+ * saved, and leaves once saved. Painted with colors/primary on purpose: a state that waits for a
28
+ * decision, not a notice. It does not place itself: put it sticky or fixed at the bottom.
29
+ * Its Buttons use the inverse tone, drawn for the colors/primary band in both modes. Styles: saving-bar.css.
30
+ */
31
+ declare function SavingBar({ status, message, savingMessage, errorMessage, onSave, onDiscard, saveLabel, retryLabel, discardLabel, className, ...rest }: SavingBarProps): react.JSX.Element;
17
32
 
18
- export { SavingBar, type SavingBarProps };
33
+ export { SavingBar, type SavingBarProps, type SavingBarStatus };