@rojaostudio/ds 1.0.2 → 2.0.0-next.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 (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 -49
  116. package/dist/components/index.js +190 -68
  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,177 @@
1
+ "use client";
2
+ import "../chunk-ORMEWXMH.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import {
5
+ createContext,
6
+ useContext,
7
+ useEffect,
8
+ useId,
9
+ useLayoutEffect,
10
+ useRef,
11
+ useState
12
+ } from "react";
13
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
14
+ import { SearchIcon } from "./internal/icons.js";
15
+ import { MenuItemContent, menuItemClassName } from "./internal/menu.js";
16
+ const CommandContext = createContext(null);
17
+ function useCommand(part) {
18
+ const ctx = useContext(CommandContext);
19
+ if (!ctx) throw new Error(`${part} must be inside a Command`);
20
+ return ctx;
21
+ }
22
+ const normalize = (text) => text.normalize("NFD").replace(new RegExp("\\p{Diacritic}", "gu"), "").toLowerCase();
23
+ const OPTION = '[role="option"]:not([aria-disabled="true"])';
24
+ function Command({
25
+ trigger,
26
+ open,
27
+ defaultOpen,
28
+ onOpenChange,
29
+ query: queryProp,
30
+ defaultQuery = "",
31
+ onQueryChange,
32
+ placeholder = "Buscar ou ir para\u2026",
33
+ children,
34
+ emptyMessage = "Nenhum resultado",
35
+ hotkey = true,
36
+ label = "Comandos",
37
+ container
38
+ }) {
39
+ const [ownOpen, setOwnOpen] = useState(defaultOpen != null ? defaultOpen : false);
40
+ const isOpen = open != null ? open : ownOpen;
41
+ const [ownQuery, setOwnQuery] = useState(defaultQuery);
42
+ const query = queryProp != null ? queryProp : ownQuery;
43
+ const [activeId, setActiveId] = useState(null);
44
+ const [count, setCount] = useState(0);
45
+ const listRef = useRef(null);
46
+ const listId = useId();
47
+ const setQuery = (next) => {
48
+ setOwnQuery(next);
49
+ onQueryChange == null ? void 0 : onQueryChange(next);
50
+ };
51
+ const setOpen = (next) => {
52
+ setOwnOpen(next);
53
+ onOpenChange == null ? void 0 : onOpenChange(next);
54
+ if (!next) setQuery("");
55
+ };
56
+ const toggle = useRef(() => {
57
+ });
58
+ toggle.current = () => setOpen(!isOpen);
59
+ useEffect(() => {
60
+ if (!hotkey) return;
61
+ const onKey = (event) => {
62
+ if (event.key.toLowerCase() === "k" && (event.ctrlKey || event.metaKey)) {
63
+ event.preventDefault();
64
+ toggle.current();
65
+ }
66
+ };
67
+ window.addEventListener("keydown", onKey);
68
+ return () => window.removeEventListener("keydown", onKey);
69
+ }, [hotkey]);
70
+ const run = (onSelect) => {
71
+ setOpen(false);
72
+ onSelect == null ? void 0 : onSelect();
73
+ };
74
+ const onKeyDown = (event) => {
75
+ var _a, _b, _c, _d, _e;
76
+ const options = [...(_b = (_a = listRef.current) == null ? void 0 : _a.querySelectorAll(OPTION)) != null ? _b : []];
77
+ if (!options.length) return;
78
+ const current = options.findIndex((o) => o.id === activeId);
79
+ let next = -1;
80
+ if (event.key === "ArrowDown") next = (current + 1) % options.length;
81
+ else if (event.key === "ArrowUp") next = (current - 1 + options.length) % options.length;
82
+ else if (event.key === "Home") next = 0;
83
+ else if (event.key === "End") next = options.length - 1;
84
+ else if (event.key === "Enter") {
85
+ event.preventDefault();
86
+ (_c = options[Math.max(current, 0)]) == null ? void 0 : _c.click();
87
+ return;
88
+ }
89
+ if (next < 0) return;
90
+ event.preventDefault();
91
+ setActiveId(options[next].id);
92
+ (_e = (_d = options[next]).scrollIntoView) == null ? void 0 : _e.call(_d, { block: "nearest" });
93
+ };
94
+ const mac = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.userAgent);
95
+ return /* @__PURE__ */ jsxs(DialogPrimitive.Root, { open: isOpen, onOpenChange: setOpen, children: [
96
+ trigger && /* @__PURE__ */ jsx(DialogPrimitive.Trigger, { asChild: true, children: trigger }),
97
+ /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { container, children: [
98
+ /* @__PURE__ */ jsx(DialogPrimitive.Overlay, { className: "rds-command__scrim" }),
99
+ /* @__PURE__ */ jsxs(DialogPrimitive.Content, { className: "rds-command", "aria-describedby": void 0, children: [
100
+ /* @__PURE__ */ jsx(DialogPrimitive.Title, { className: "rds-visually-hidden", children: label }),
101
+ /* @__PURE__ */ jsxs("div", { className: "rds-command__search", children: [
102
+ /* @__PURE__ */ jsx("span", { className: "rds-command__icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx(SearchIcon, {}) }),
103
+ /* @__PURE__ */ jsx(
104
+ "input",
105
+ {
106
+ className: "rds-command__input",
107
+ type: "text",
108
+ role: "combobox",
109
+ "aria-label": placeholder,
110
+ "aria-expanded": "true",
111
+ "aria-autocomplete": "list",
112
+ "aria-controls": listId,
113
+ "aria-activedescendant": count && activeId ? activeId : void 0,
114
+ autoComplete: "off",
115
+ spellCheck: false,
116
+ placeholder,
117
+ value: query,
118
+ onChange: (event) => setQuery(event.target.value),
119
+ onKeyDown
120
+ }
121
+ ),
122
+ hotkey && /* @__PURE__ */ jsx("kbd", { className: "rds-command__hint", "aria-hidden": "true", children: mac ? "\u2318 K" : "Ctrl K" })
123
+ ] }),
124
+ /* @__PURE__ */ jsx("div", { ref: listRef, id: listId, role: "listbox", "aria-label": "Resultados", className: "rds-command__results", children: /* @__PURE__ */ jsx(CommandContext.Provider, { value: { query: normalize(query.trim()), activeId, setActiveId, run }, children }) }),
125
+ /* @__PURE__ */ jsx(
126
+ Sync,
127
+ {
128
+ sync: () => {
129
+ var _a, _b, _c, _d;
130
+ const options = [...(_b = (_a = listRef.current) == null ? void 0 : _a.querySelectorAll(OPTION)) != null ? _b : []];
131
+ if (options.length !== count) setCount(options.length);
132
+ if (!options.some((o) => o.id === activeId)) setActiveId((_d = (_c = options[0]) == null ? void 0 : _c.id) != null ? _d : null);
133
+ }
134
+ }
135
+ ),
136
+ count === 0 && /* @__PURE__ */ jsx("p", { className: "rds-command__empty", children: emptyMessage }),
137
+ /* @__PURE__ */ jsx("span", { className: "rds-visually-hidden", "aria-live": "polite", children: query ? count ? `${count} ${count === 1 ? "resultado" : "resultados"}` : emptyMessage : "" })
138
+ ] })
139
+ ] })
140
+ ] });
141
+ }
142
+ function Sync({ sync }) {
143
+ useLayoutEffect(sync);
144
+ return null;
145
+ }
146
+ function CommandGroup({ label, children }) {
147
+ return /* @__PURE__ */ jsxs("div", { role: "group", "aria-label": label, className: "rds-command__group", children: [
148
+ /* @__PURE__ */ jsx("p", { className: "rds-command__group-label", "aria-hidden": "true", children: label }),
149
+ children
150
+ ] });
151
+ }
152
+ function CommandItem({ children, icon, shortcut, onSelect, value, keywords = [], disabled }) {
153
+ const { query, activeId, setActiveId, run } = useCommand("CommandItem");
154
+ const id = useId();
155
+ const text = value != null ? value : typeof children === "string" || typeof children === "number" ? String(children) : "";
156
+ if (query && !normalize([text, ...keywords].join(" ")).includes(query)) return null;
157
+ const active = id === activeId;
158
+ return /* @__PURE__ */ jsx(
159
+ "div",
160
+ {
161
+ id,
162
+ role: "option",
163
+ "aria-selected": active,
164
+ "aria-disabled": disabled || void 0,
165
+ "data-active": active ? "" : void 0,
166
+ className: menuItemClassName(),
167
+ onPointerMove: disabled ? void 0 : () => setActiveId(id),
168
+ onClick: disabled ? void 0 : () => run(onSelect),
169
+ children: /* @__PURE__ */ jsx(MenuItemContent, { icon, shortcut, children })
170
+ }
171
+ );
172
+ }
173
+ export {
174
+ Command,
175
+ CommandGroup,
176
+ CommandItem
177
+ };
@@ -0,0 +1,23 @@
1
+ import * as react from 'react';
2
+ import { HTMLAttributes, ReactNode, FormEvent } from 'react';
3
+
4
+ interface ContactProps extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'onSubmit'> {
5
+ eyebrow?: ReactNode;
6
+ /** The block's title, an h2 that names the section and the form. */
7
+ title: ReactNode;
8
+ description?: ReactNode;
9
+ /**
10
+ * The fields and the button (the Figma exposes them): Input name and e-mail, Textarea, the consent Checkbox and a
11
+ * submit Button, which takes the full width.
12
+ */
13
+ children: ReactNode;
14
+ /** Runs on send, with the form's data. The browser's own validation is off: show the fields' errors. */
15
+ onSubmit: (data: FormData, event: FormEvent<HTMLFormElement>) => void;
16
+ }
17
+ /**
18
+ * Contact — Figma [RDS] Blocks/Contact. The contact form of a public page. Adapts to the width of its container
19
+ * (Figma: `screen`). Styles: contact.css.
20
+ */
21
+ declare function Contact({ eyebrow, title, description, children, onSubmit, className, ...rest }: ContactProps): react.JSX.Element;
22
+
23
+ export { Contact, type ContactProps };
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import {
3
+ __objRest,
4
+ __spreadProps,
5
+ __spreadValues
6
+ } from "../chunk-ORMEWXMH.js";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { useId } from "react";
9
+ import { BlockHeading } from "./internal/block.js";
10
+ function Contact(_a) {
11
+ var _b = _a, { eyebrow, title, description, children, onSubmit, className } = _b, rest = __objRest(_b, ["eyebrow", "title", "description", "children", "onSubmit", "className"]);
12
+ const titleId = useId();
13
+ return /* @__PURE__ */ jsx("section", __spreadProps(__spreadValues({ "aria-labelledby": titleId }, rest), { className: ["rds-block", "rds-contact", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsxs("div", { className: "rds-block__inner", children: [
14
+ /* @__PURE__ */ jsx(BlockHeading, { eyebrow, title, description, titleId }),
15
+ /* @__PURE__ */ jsx(
16
+ "form",
17
+ {
18
+ className: "rds-contact__form",
19
+ "aria-labelledby": titleId,
20
+ noValidate: true,
21
+ onSubmit: (event) => {
22
+ event.preventDefault();
23
+ onSubmit(new FormData(event.currentTarget), event);
24
+ },
25
+ children
26
+ }
27
+ )
28
+ ] }) }));
29
+ }
30
+ export {
31
+ Contact
32
+ };
@@ -1,33 +1,41 @@
1
1
  import * as react from 'react';
2
- import { ReactNode } from 'react';
2
+ import { ReactElement, ReactNode } from 'react';
3
+ import { MenuItemContentProps, MenuItemTone } from './internal/menu.js';
3
4
 
4
- /**
5
- * ContextMenu — menu acionado por clique direito (contextmenu event).
6
- *
7
- * Uso:
8
- * <ContextMenu menu={({ close }) => (
9
- * <>
10
- * <MenuItem onClick={() => { copy(); close(); }}>Copiar</MenuItem>
11
- * <MenuItem onClick={() => { paste(); close(); }}>Colar</MenuItem>
12
- * </>
13
- * )}>
14
- * <div className="border p-4">Clique direito aqui</div>
15
- * </ContextMenu>
16
- *
17
- * Posiciona no ponto exato do clique. Fecha em ESC, clique fora, scroll.
18
- */
5
+ type ContextMenuItemTone = MenuItemTone;
19
6
  interface ContextMenuProps {
20
- children: ReactNode;
21
- /** Conteúdo do menu (mesmo formato do Menu — MenuItem, MenuSeparator, etc). */
22
- menu: ReactNode | ((api: {
23
- close: () => void;
24
- }) => ReactNode);
25
- /** Largura mínima em px. default = 180. */
26
- minWidth?: number;
27
- /** Desabilita o context menu. default = false. */
7
+ /**
8
+ * The area it opens on (one element). Make it focusable (tabIndex={0}, or a control) so the keyboard can open
9
+ * the menu too, with the menu key or Shift+F10.
10
+ */
11
+ children: ReactElement;
12
+ /** The ContextMenuItems, with a ContextMenuSeparator between groups. */
13
+ items: ReactNode;
14
+ /** Turns it off: the right click shows the browser's menu again. */
28
15
  disabled?: boolean;
16
+ onOpenChange?: (open: boolean) => void;
17
+ /** The menu's name for screen readers. */
18
+ 'aria-label'?: string;
29
19
  className?: string;
30
20
  }
31
- declare const ContextMenu: react.ForwardRefExoticComponent<ContextMenuProps & react.RefAttributes<HTMLDivElement>>;
21
+ /**
22
+ * ContextMenu — Figma [RDS] Overlays/ContextMenu (spec only: the DropdownMenu's look, opened by the right click,
23
+ * a long touch, the menu key or Shift+F10). Radix ContextMenu: role="menu" at the pointer; the arrows move,
24
+ * Enter chooses, Escape closes. It is never the only way to an action: every item also lives on the screen or in a
25
+ * DropdownMenu. Styles: internal/menu.css.
26
+ */
27
+ declare function ContextMenu({ children, items, disabled, onOpenChange, className, 'aria-label': ariaLabel }: ContextMenuProps): react.JSX.Element;
28
+ interface ContextMenuItemProps extends MenuItemContentProps {
29
+ /** Runs when the item is chosen; the menu then closes. */
30
+ onSelect?: () => void;
31
+ /** danger for what destroys: last, after a separator. */
32
+ tone?: ContextMenuItemTone;
33
+ disabled?: boolean;
34
+ textValue?: string;
35
+ }
36
+ /** One action (Figma .menu/item): role="menuitem". */
37
+ declare function ContextMenuItem({ children, icon, shortcut, onSelect, tone, disabled, textValue }: ContextMenuItemProps): react.JSX.Element;
38
+ /** The line between groups of actions. */
39
+ declare function ContextMenuSeparator(): react.JSX.Element;
32
40
 
33
- export { ContextMenu, type ContextMenuProps };
41
+ export { ContextMenu, ContextMenuItem, type ContextMenuItemProps, type ContextMenuItemTone, type ContextMenuProps, ContextMenuSeparator };
@@ -1,74 +1,47 @@
1
1
  "use client";
2
2
  import "../chunk-ORMEWXMH.js";
3
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
- import { forwardRef, useState, useEffect, useRef, useImperativeHandle } from "react";
5
- import { createPortal } from "react-dom";
6
- const ContextMenu = forwardRef(function ContextMenu2({
7
- children,
8
- menu,
9
- minWidth = 180,
10
- disabled = false,
11
- className = ""
12
- }, ref) {
13
- const [pos, setPos] = useState(null);
14
- const [mounted, setMounted] = useState(false);
15
- const containerRef = useRef(null);
16
- const menuRef = useRef(null);
17
- useImperativeHandle(ref, () => containerRef.current);
18
- useEffect(() => {
19
- setMounted(true);
20
- }, []);
21
- useEffect(() => {
22
- if (!pos) return;
23
- const close = () => setPos(null);
24
- const handleClick = (e) => {
25
- var _a;
26
- if ((_a = menuRef.current) == null ? void 0 : _a.contains(e.target)) return;
27
- close();
28
- };
29
- const handleKey = (e) => {
30
- if (e.key === "Escape") close();
31
- };
32
- document.addEventListener("mousedown", handleClick);
33
- document.addEventListener("keydown", handleKey);
34
- document.addEventListener("scroll", close, true);
35
- return () => {
36
- document.removeEventListener("mousedown", handleClick);
37
- document.removeEventListener("keydown", handleKey);
38
- document.removeEventListener("scroll", close, true);
39
- };
40
- }, [pos]);
41
- useEffect(() => {
42
- if (!pos || !menuRef.current) return;
43
- const rect = menuRef.current.getBoundingClientRect();
44
- const { innerWidth: vw, innerHeight: vh } = window;
45
- let { x, y } = pos;
46
- if (x + rect.width > vw - 8) x = vw - rect.width - 8;
47
- if (y + rect.height > vh - 8) y = vh - rect.height - 8;
48
- if (x !== pos.x || y !== pos.y) setPos({ x, y });
49
- }, [pos]);
50
- function handleContext(e) {
51
- if (disabled) return;
52
- e.preventDefault();
53
- setPos({ x: e.clientX, y: e.clientY });
54
- }
55
- return /* @__PURE__ */ jsxs(Fragment, { children: [
56
- /* @__PURE__ */ jsx("div", { ref: containerRef, onContextMenu: handleContext, className, children }),
57
- mounted && pos && createPortal(
58
- /* @__PURE__ */ jsx(
59
- "div",
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import * as Menu from "@radix-ui/react-context-menu";
5
+ import { MenuItemContent, menuItemClassName } from "./internal/menu.js";
6
+ function openFromKeyboard(event) {
7
+ const isMenuKey = event.key === "ContextMenu" || event.shiftKey && event.key === "F10";
8
+ if (!isMenuKey) return;
9
+ event.preventDefault();
10
+ const rect = event.currentTarget.getBoundingClientRect();
11
+ event.currentTarget.dispatchEvent(
12
+ new MouseEvent("contextmenu", {
13
+ bubbles: true,
14
+ cancelable: true,
15
+ clientX: rect.left + Math.min(rect.width, 16),
16
+ clientY: rect.top + Math.min(rect.height, 16)
17
+ })
18
+ );
19
+ }
20
+ function ContextMenu({ children, items, disabled, onOpenChange, className, "aria-label": ariaLabel }) {
21
+ return (
22
+ // Not modal, as the DropdownMenu: the page is not hidden from screen readers while the menu is open.
23
+ /* @__PURE__ */ jsxs(Menu.Root, { onOpenChange, modal: false, children: [
24
+ /* @__PURE__ */ jsx(Menu.Trigger, { asChild: true, disabled, onKeyDown: disabled ? void 0 : openFromKeyboard, children }),
25
+ /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(
26
+ Menu.Content,
60
27
  {
61
- ref: menuRef,
62
- role: "menu",
63
- className: "fixed z-[1000] rounded-(--radius-card) border border-stroke-default bg-surface-default shadow-lg py-1",
64
- style: { top: pos.y, left: pos.x, minWidth },
65
- children: typeof menu === "function" ? menu({ close: () => setPos(null) }) : menu
28
+ collisionPadding: 8,
29
+ "aria-label": ariaLabel,
30
+ className: ["rds-menu", "rds-context-menu", className].filter(Boolean).join(" "),
31
+ children: items
66
32
  }
67
- ),
68
- document.body
69
- )
70
- ] });
71
- });
33
+ ) })
34
+ ] })
35
+ );
36
+ }
37
+ function ContextMenuItem({ children, icon, shortcut, onSelect, tone, disabled, textValue }) {
38
+ return /* @__PURE__ */ jsx(Menu.Item, { onSelect, disabled, textValue, className: menuItemClassName(tone), children: /* @__PURE__ */ jsx(MenuItemContent, { icon, shortcut, children }) });
39
+ }
40
+ function ContextMenuSeparator() {
41
+ return /* @__PURE__ */ jsx(Menu.Separator, { className: "rds-menu__separator" });
42
+ }
72
43
  export {
73
- ContextMenu
44
+ ContextMenu,
45
+ ContextMenuItem,
46
+ ContextMenuSeparator
74
47
  };
@@ -1,16 +1,21 @@
1
1
  import * as react from 'react';
2
2
 
3
3
  interface CopyFieldProps {
4
- /** Texto copiado pro clipboard. */
4
+ /** What goes to the clipboard. */
5
5
  value: string;
6
- /** Rótulo do botão em repouso. */
6
+ /** The button's text at rest. */
7
7
  label?: string;
8
- /** Rótulo após copiar (feedback). */
8
+ /** The text for 2 s after copying; it is announced too. */
9
9
  copiedLabel?: string;
10
- /** Largura total do container. */
10
+ /** Takes the container's whole width. */
11
11
  fullWidth?: boolean;
12
12
  className?: string;
13
13
  }
14
- declare function CopyField({ value, label, copiedLabel, fullWidth, className, }: CopyFieldProps): react.JSX.Element;
14
+ /**
15
+ * CopyField — a composition of the Button (Figma [RDS] Actions/Button, outline, neutral): copies `value` to the
16
+ * clipboard and says so for 2 s ("Copiado!"), on screen and to screen readers. Used next to a QR code or a link
17
+ * to share. Styles: copy-field.css.
18
+ */
19
+ declare function CopyField({ value, label, copiedLabel, fullWidth, className }: CopyFieldProps): react.JSX.Element;
15
20
 
16
21
  export { CopyField, type CopyFieldProps };
@@ -1,41 +1,36 @@
1
1
  "use client";
2
2
  import "../chunk-ORMEWXMH.js";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
- import { useState } from "react";
5
- import { Copy, Check } from "lucide-react";
6
- function CopyField({
7
- value,
8
- label = "Copiar",
9
- copiedLabel = "Copiado!",
10
- fullWidth = false,
11
- className = ""
12
- }) {
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { useEffect, useRef, useState } from "react";
5
+ import { Button } from "./button.js";
6
+ import { announce } from "./internal/announce.js";
7
+ import { CheckIcon, CopyIcon } from "./internal/icons.js";
8
+ function CopyField({ value, label = "Copiar", copiedLabel = "Copiado!", fullWidth = false, className }) {
13
9
  const [copied, setCopied] = useState(false);
14
- async function handleCopy() {
10
+ const timer = useRef(null);
11
+ useEffect(() => () => {
12
+ if (timer.current) clearTimeout(timer.current);
13
+ }, []);
14
+ async function copy() {
15
15
  try {
16
16
  await navigator.clipboard.writeText(value);
17
- setCopied(true);
18
- setTimeout(() => setCopied(false), 2e3);
19
17
  } catch (e) {
18
+ return;
20
19
  }
20
+ setCopied(true);
21
+ announce(copiedLabel);
22
+ if (timer.current) clearTimeout(timer.current);
23
+ timer.current = setTimeout(() => setCopied(false), 2e3);
21
24
  }
22
- return /* @__PURE__ */ jsxs(
23
- "button",
25
+ return /* @__PURE__ */ jsx(
26
+ Button,
24
27
  {
25
- type: "button",
26
- onClick: handleCopy,
27
- "aria-label": label,
28
- className: [
29
- "inline-flex items-center justify-center gap-2 h-control-md px-4 rounded-(--radius-card)",
30
- "border border-stroke-default text-fg-secondary text-sm font-semibold",
31
- "hover:bg-surface-hover transition-colors focus-visible:ring-2 focus-visible:ring-stroke-focus",
32
- fullWidth ? "w-full" : "",
33
- className
34
- ].join(" "),
35
- children: [
36
- copied ? /* @__PURE__ */ jsx(Check, { className: "size-4 shrink-0 text-success-text" }) : /* @__PURE__ */ jsx(Copy, { className: "size-4 shrink-0" }),
37
- copied ? copiedLabel : label
38
- ]
28
+ variant: "outline",
29
+ tone: "neutral",
30
+ icon: copied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {}),
31
+ onClick: copy,
32
+ className: ["rds-copy-field", fullWidth && "rds-copy-field--full", className].filter(Boolean).join(" "),
33
+ children: copied ? copiedLabel : label
39
34
  }
40
35
  );
41
36
  }
@@ -2,31 +2,45 @@ import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
 
4
4
  interface CurrencyInputProps {
5
- /** Label renderada acima do controle (mesmo padrão do Input do DS). */
5
+ /** The field's label (the Input's). Without it, pass aria-label. */
6
6
  label?: ReactNode;
7
- /** Nome do hidden input pra submission (server actions, forms). */
7
+ 'aria-label'?: string;
8
+ /** The name of the hidden input that submits the value, in subunits (an integer: 9900 is R$ 99,00). */
8
9
  name: string;
9
- /** ISO 4217 — 'BRL', 'USD', 'JPY', etc. Quando passada, resolve symbol/decimals/locale automaticamente. */
10
+ /** ISO 4217 ('BRL', 'USD', 'JPY'): resolves the symbol, the decimals and the locale. */
10
11
  currency?: string;
11
- /** Símbolo da moeda exibido à esquerda (R$, $, €, ₿). Obrigatório se `currency` não for passada. */
12
+ /** The symbol before the value (R$, $, €, ₿), the Input's prefix. Needed without `currency`. */
12
13
  symbol?: string;
13
- /** Casas decimais. BRL/USD = 2, JPY = 0, BTC = 8. Obrigatório se `currency` não for passada. */
14
+ /** Decimal places: BRL and USD 2, JPY 0, BTC 8. Needed without `currency`. */
14
15
  decimals?: number;
15
- /** Locale pra formatação. Default depende de `currency` (BRL→pt-BR etc) ou 'en'. */
16
+ /** The locale the value is formatted in. Default: the currency's (BRL → pt-BR), or 'en-US'. */
16
17
  locale?: string;
17
- /** Valor inicial em SUBUNITS (integer). Ex: 9900 = R$99,00. */
18
+ /** The starting value in subunits. */
18
19
  defaultValueSubunits?: number | null;
19
20
  placeholder?: string;
20
21
  disabled?: boolean;
21
- /** Callback com valor atual em subunits a cada mudança. */
22
+ required?: boolean;
23
+ /** A line under the field (the Input's hint). */
24
+ hint?: ReactNode;
25
+ /** What is wrong with the value (the Input's error). */
26
+ errorMessage?: ReactNode;
27
+ /** Called with the value in subunits on every change. */
22
28
  onChange?: (subunits: number) => void;
23
- /** Máximo de dígitos. default = 10 → R$ 99.999.999,99. */
29
+ /** The most digits it takes. Default 10 (R$ 99.999.999,99). */
24
30
  maxDigits?: number;
25
- /** Mostrar "0,00" em vez do placeholder quando valor é zero. default = false. */
31
+ /** Shows 0,00 instead of the placeholder when the value is zero. */
26
32
  showZero?: boolean;
33
+ /** @deprecated The [RDS] Input has one height (44). Ignored. */
27
34
  size?: 'sm' | 'md' | 'lg';
35
+ id?: string;
28
36
  className?: string;
29
37
  }
30
- declare function CurrencyInput({ label, name, currency, symbol: symbolProp, decimals: decimalsProp, locale: localeProp, defaultValueSubunits, placeholder, disabled, onChange, maxDigits, showZero, size, className, }: CurrencyInputProps): react.JSX.Element;
38
+ /**
39
+ * CurrencyInput — a composition of the Input (Figma [RDS] Forms/Input) with the currency symbol as its prefix and a
40
+ * right-to-left mask: each digit typed becomes a cent, Backspace takes the last one off, pasting "R$ 50,00" gives
41
+ * 5000. The mask follows the input's value (onChange), not the keys, so the phone's keyboard opens and works. The
42
+ * value goes with the form in subunits, through a hidden input named `name`.
43
+ */
44
+ declare function CurrencyInput({ label, 'aria-label': ariaLabel, name, currency, symbol: symbolProp, decimals: decimalsProp, locale: localeProp, defaultValueSubunits, placeholder, disabled, required, hint, errorMessage, onChange, maxDigits, showZero, id, className, }: CurrencyInputProps): react.JSX.Element;
31
45
 
32
46
  export { CurrencyInput, type CurrencyInputProps };