@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,28 @@
1
+ import * as react from 'react';
2
+ import { HTMLAttributes, ReactNode } from 'react';
3
+
4
+ interface ChipProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
5
+ /** The chosen value (Figma: `label`): an applied filter, a recipient, a typed tag. */
6
+ children: ReactNode;
7
+ /** Icon before the label (Figma: `showIcon` + `iconName`). Decorative, rendered with aria-hidden. */
8
+ icon?: ReactNode;
9
+ /**
10
+ * Shows the × (Figma: `showRemove`) and is called when it is pressed. Only the × removes: the chip
11
+ * itself is not a button. After the removal, focus goes to the next chip's × in the same list (or the
12
+ * previous one).
13
+ */
14
+ onRemove?: () => void;
15
+ /** The ×'s accessible name. By default "Remover <label>", which needs a text label. */
16
+ removeLabel?: string;
17
+ /** Said to screen readers after the removal. By default "<label> removido". */
18
+ removedMessage?: string;
19
+ /** Rendered as aria-disabled="true": the × stays in the tab order, but pressing it does nothing. */
20
+ disabled?: boolean;
21
+ }
22
+ /**
23
+ * Chip — Figma [RDS] Actions/Chip. A chosen value that can be taken away. Not for choosing options
24
+ * (Toggle, ToggleGroup) and not for labelling without an action (Badge). Styles: chip.css.
25
+ */
26
+ declare function Chip({ children, icon, onRemove, removeLabel, removedMessage, disabled, className, ...rest }: ChipProps): react.JSX.Element;
27
+
28
+ export { Chip, type ChipProps };
@@ -0,0 +1,73 @@
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 { announce } from "./internal/announce.js";
9
+ import { CloseIcon } from "./internal/icons.js";
10
+ function Chip(_a) {
11
+ var _b = _a, {
12
+ children,
13
+ icon,
14
+ onRemove,
15
+ removeLabel,
16
+ removedMessage,
17
+ disabled,
18
+ className
19
+ } = _b, rest = __objRest(_b, [
20
+ "children",
21
+ "icon",
22
+ "onRemove",
23
+ "removeLabel",
24
+ "removedMessage",
25
+ "disabled",
26
+ "className"
27
+ ]);
28
+ const text = typeof children === "string" || typeof children === "number" ? String(children) : void 0;
29
+ function remove(event) {
30
+ if (disabled || !onRemove) return;
31
+ const next = neighbourRemove(event.currentTarget);
32
+ onRemove();
33
+ const message = removedMessage != null ? removedMessage : text ? `${text} removido` : void 0;
34
+ if (message) announce(message);
35
+ requestAnimationFrame(() => next == null ? void 0 : next.focus());
36
+ }
37
+ return /* @__PURE__ */ jsxs(
38
+ "span",
39
+ __spreadProps(__spreadValues({}, rest), {
40
+ role: disabled ? "group" : rest.role,
41
+ "aria-disabled": disabled || void 0,
42
+ className: ["rds-chip", onRemove && "rds-chip--removable", disabled && "rds-chip--disabled", className].filter(Boolean).join(" "),
43
+ children: [
44
+ icon && /* @__PURE__ */ jsx("span", { className: "rds-chip__icon", "aria-hidden": "true", children: icon }),
45
+ /* @__PURE__ */ jsx("span", { className: "rds-chip__label", children }),
46
+ onRemove && /* @__PURE__ */ jsx(
47
+ "button",
48
+ {
49
+ type: "button",
50
+ className: "rds-chip__remove",
51
+ "aria-label": removeLabel != null ? removeLabel : `Remover ${text != null ? text : ""}`.trim(),
52
+ "aria-disabled": disabled || void 0,
53
+ onClick: remove,
54
+ children: /* @__PURE__ */ jsx("span", { className: "rds-chip__remove-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx(CloseIcon, {}) })
55
+ }
56
+ )
57
+ ]
58
+ })
59
+ );
60
+ }
61
+ function neighbourRemove(own) {
62
+ var _a, _b, _c, _d;
63
+ const chip = own.closest(".rds-chip");
64
+ const list = (_a = chip == null ? void 0 : chip.closest('ul, ol, [role="list"]')) != null ? _a : chip == null ? void 0 : chip.parentElement;
65
+ if (!list) return null;
66
+ const all = Array.from(list.querySelectorAll('.rds-chip__remove:not([aria-disabled="true"])'));
67
+ const index = all.indexOf(own);
68
+ if (index === -1) return (_b = all[0]) != null ? _b : null;
69
+ return (_d = (_c = all[index + 1]) != null ? _c : all[index - 1]) != null ? _d : null;
70
+ }
71
+ export {
72
+ Chip
73
+ };
@@ -1,16 +1,13 @@
1
1
  import * as react from 'react';
2
- import { ReactNode } from 'react';
2
+ import { ChoiceCardProps } from './internal/choice-card.js';
3
+ export { ChoiceCardGroup, ChoiceCardGroupProps, ChoiceCardLayout } from './internal/choice-card.js';
3
4
 
4
- interface ChoiceCardProps {
5
- selected: boolean;
6
- onClick: () => void;
7
- label: string;
8
- description?: string;
9
- icon?: ReactNode;
10
- disabled?: boolean;
11
- /** Override pontual (ex.: rounded-b-none quando há painel anexado embaixo). */
12
- className?: string;
13
- }
14
- declare function ChoiceCard({ selected, onClick, label, description, icon, disabled, className }: ChoiceCardProps): react.JSX.Element;
5
+ /**
6
+ * ChoiceCard — Figma [RDS] Content/ChoiceCard. A large single-choice option with icon, label and description, for
7
+ * when each option needs an explanation. Three layouts: row (the line with the radio), tile (a grid cell) and
8
+ * preview (an image on top). It is a native radio: Tab reaches the group, the arrows move and choose, Space
9
+ * chooses. Use it inside a ChoiceCardGroup (one chosen at a time). Styles: choice-card.css.
10
+ */
11
+ declare function ChoiceCard(props: ChoiceCardProps): react.JSX.Element;
15
12
 
16
- export { ChoiceCard, type ChoiceCardProps };
13
+ export { ChoiceCard, ChoiceCardProps };
@@ -1,66 +1,15 @@
1
1
  "use client";
2
- import "../chunk-ORMEWXMH.js";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
- function ChoiceCard({ selected, onClick, label, description, icon, disabled = false, className = "" }) {
5
- return /* @__PURE__ */ jsxs(
6
- "button",
7
- {
8
- type: "button",
9
- onClick,
10
- disabled,
11
- className: [
12
- "w-full flex items-center gap-4 px-4 py-4 rounded-(--radius-card) border text-left transition-all",
13
- selected ? "[border-color:var(--choice-card-border-active)] [background:var(--choice-card-bg-active)]" : "[border-color:var(--choice-card-border)] [background:var(--choice-card-bg)] hover:[border-color:var(--choice-card-border-hover)]",
14
- disabled ? "opacity-50 cursor-not-allowed" : "",
15
- className
16
- ].filter(Boolean).join(" "),
17
- children: [
18
- icon && /* @__PURE__ */ jsx(
19
- "div",
20
- {
21
- className: [
22
- "shrink-0 w-9 h-9 rounded-(--radius-card) flex items-center justify-center transition-colors",
23
- selected ? "[background:var(--choice-card-icon-bg-active)] [color:var(--choice-card-icon-active)]" : "[background:var(--choice-card-icon-bg)] [color:var(--choice-card-icon)]"
24
- ].join(" "),
25
- children: icon
26
- }
27
- ),
28
- /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
29
- /* @__PURE__ */ jsx(
30
- "p",
31
- {
32
- className: [
33
- "text-label font-semibold",
34
- selected ? "[color:var(--choice-card-label-active)]" : "[color:var(--choice-card-label)]"
35
- ].join(" "),
36
- children: label
37
- }
38
- ),
39
- description && /* @__PURE__ */ jsx(
40
- "p",
41
- {
42
- className: [
43
- "text-caption mt-0.5",
44
- selected ? "[color:var(--choice-card-description-active)]" : "[color:var(--choice-card-description)]"
45
- ].join(" "),
46
- children: description
47
- }
48
- )
49
- ] }),
50
- /* @__PURE__ */ jsx(
51
- "div",
52
- {
53
- className: [
54
- "shrink-0 w-4 h-4 rounded-full border-2 flex items-center justify-center transition-colors",
55
- selected ? "[border-color:var(--choice-card-radio-border-active)]" : "[border-color:var(--choice-card-radio-border)]"
56
- ].join(" "),
57
- children: selected && /* @__PURE__ */ jsx("div", { className: "w-2 h-2 rounded-full [background:var(--choice-card-radio-dot)]" })
58
- }
59
- )
60
- ]
61
- }
62
- );
2
+ import {
3
+ __spreadProps,
4
+ __spreadValues
5
+ } from "../chunk-ORMEWXMH.js";
6
+ import { jsx } from "react/jsx-runtime";
7
+ import { ChoiceCardControl } from "./internal/choice-card.js";
8
+ import { ChoiceCardGroup } from "./internal/choice-card.js";
9
+ function ChoiceCard(props) {
10
+ return /* @__PURE__ */ jsx(ChoiceCardControl, __spreadProps(__spreadValues({}, props), { control: "radio" }));
63
11
  }
64
12
  export {
65
- ChoiceCard
13
+ ChoiceCard,
14
+ ChoiceCardGroup
66
15
  };
@@ -3,14 +3,23 @@ import { ReactNode } from 'react';
3
3
 
4
4
  interface ChoiceCarouselProps<T> {
5
5
  options: T[];
6
+ /** A stable key per option. */
6
7
  getKey: (option: T) => string;
8
+ /** Draws an option. Static content: the carousel item is the radio (or checkbox), so no button inside. */
7
9
  renderCard: (option: T, isSelected: boolean) => ReactNode;
8
10
  value: T | T[] | null;
9
11
  onChange: (value: T | T[]) => void;
12
+ /** Several at once (checkboxes) instead of one (radios). */
10
13
  multiple?: boolean;
14
+ /** The group's name for screen readers. */
11
15
  ariaLabel: string;
12
16
  isDisabled?: (option: T) => boolean;
13
17
  }
18
+ /**
19
+ * ChoiceCarousel — a horizontal, scroll-snapped row of options to pick one (radiogroup) or several (group of
20
+ * checkboxes); the options are drawn by `renderCard`. On a wide screen two outline IconButtons (with their Tooltips)
21
+ * scroll it by one option; the arrow keys do the same on the row. Styles: choice-carousel.css.
22
+ */
14
23
  declare function ChoiceCarousel<T>({ options, getKey, renderCard, value, onChange, multiple, ariaLabel, isDisabled, }: ChoiceCarouselProps<T>): react.JSX.Element;
15
24
 
16
25
  export { ChoiceCarousel, type ChoiceCarouselProps };
@@ -1,7 +1,10 @@
1
1
  "use client";
2
2
  import "../chunk-ORMEWXMH.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
- import { useRef, useState, useEffect, useCallback } from "react";
4
+ import { useRef, useState, useEffect, useCallback, useMemo } from "react";
5
+ import { IconButton } from "./icon-button.js";
6
+ import { ChevronLeftIcon, ChevronRightIcon } from "./internal/icons.js";
7
+ import { Tooltip } from "./tooltip.js";
5
8
  function ChoiceCarousel({
6
9
  options,
7
10
  getKey,
@@ -15,7 +18,7 @@ function ChoiceCarousel({
15
18
  const trackRef = useRef(null);
16
19
  const [canScrollLeft, setCanScrollLeft] = useState(false);
17
20
  const [canScrollRight, setCanScrollRight] = useState(false);
18
- const valueArray = multiple ? value != null ? value : [] : [];
21
+ const valueArray = useMemo(() => multiple ? value != null ? value : [] : [], [multiple, value]);
19
22
  const valueSingle = multiple ? null : value;
20
23
  const isSelected = useCallback(
21
24
  (option) => {
@@ -59,7 +62,7 @@ function ChoiceCarousel({
59
62
  const el = trackRef.current;
60
63
  if (!el) return;
61
64
  const cardWidth = (_b = (_a = el.firstElementChild) == null ? void 0 : _a.getBoundingClientRect().width) != null ? _b : 160;
62
- const gap = 12;
65
+ const gap = parseFloat(getComputedStyle(el).columnGap) || 0;
63
66
  el.scrollBy({ left: dir * (cardWidth + gap), behavior: "smooth" });
64
67
  };
65
68
  const handleKeyDown = (e) => {
@@ -71,24 +74,20 @@ function ChoiceCarousel({
71
74
  scrollByAmount(-1);
72
75
  }
73
76
  };
74
- return /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
75
- /* @__PURE__ */ jsx(
76
- "button",
77
+ return /* @__PURE__ */ jsxs("div", { className: "rds-choice-carousel", children: [
78
+ /* @__PURE__ */ jsx(Tooltip, { text: "Anterior", children: /* @__PURE__ */ jsx(
79
+ IconButton,
77
80
  {
78
- type: "button",
79
- "aria-label": "Anterior",
81
+ className: "rds-choice-carousel__arrow rds-choice-carousel__arrow--prev",
82
+ icon: /* @__PURE__ */ jsx(ChevronLeftIcon, {}),
83
+ label: "Anterior",
84
+ variant: "outline",
85
+ tone: "neutral",
80
86
  onClick: () => scrollByAmount(-1),
81
87
  disabled: !canScrollLeft,
82
- className: "hidden md:flex absolute left-0 top-1/2 -translate-y-1/2 -translate-x-1/2 z-10 w-9 h-9 rounded-full items-center justify-center transition-opacity disabled:opacity-0 disabled:pointer-events-none",
83
- style: {
84
- background: "var(--choice-carousel-chevron-bg)",
85
- border: `1px solid var(--choice-carousel-chevron-border)`,
86
- color: "var(--choice-carousel-chevron-text)",
87
- boxShadow: "var(--shadow-md)"
88
- },
89
- children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.8", children: /* @__PURE__ */ jsx("path", { d: "M10 4l-4 4 4 4", strokeLinecap: "round", strokeLinejoin: "round" }) })
88
+ tabIndex: -1
90
89
  }
91
- ),
90
+ ) }),
92
91
  /* @__PURE__ */ jsx(
93
92
  "div",
94
93
  {
@@ -97,13 +96,7 @@ function ChoiceCarousel({
97
96
  "aria-label": ariaLabel,
98
97
  tabIndex: 0,
99
98
  onKeyDown: handleKeyDown,
100
- className: "flex overflow-x-auto scroll-smooth focus:outline-none",
101
- style: {
102
- gap: "var(--choice-carousel-gap)",
103
- scrollSnapType: "x mandatory",
104
- scrollbarWidth: "none",
105
- paddingBlock: 4
106
- },
99
+ className: "rds-choice-carousel__track",
107
100
  children: options.map((option) => {
108
101
  var _a;
109
102
  const selected = isSelected(option);
@@ -113,7 +106,7 @@ function ChoiceCarousel({
113
106
  {
114
107
  role: multiple ? "checkbox" : "radio",
115
108
  "aria-checked": selected,
116
- "aria-disabled": disabled,
109
+ "aria-disabled": disabled || void 0,
117
110
  tabIndex: disabled ? -1 : 0,
118
111
  onClick: () => handleSelect(option),
119
112
  onKeyDown: (e) => {
@@ -122,12 +115,7 @@ function ChoiceCarousel({
122
115
  handleSelect(option);
123
116
  }
124
117
  },
125
- className: "shrink-0",
126
- style: {
127
- width: "var(--choice-carousel-card-width-mobile)",
128
- scrollSnapAlign: "start",
129
- cursor: disabled ? "not-allowed" : "pointer"
130
- },
118
+ className: "rds-choice-carousel__option",
131
119
  children: renderCard(option, selected)
132
120
  },
133
121
  getKey(option)
@@ -135,23 +123,19 @@ function ChoiceCarousel({
135
123
  })
136
124
  }
137
125
  ),
138
- /* @__PURE__ */ jsx(
139
- "button",
126
+ /* @__PURE__ */ jsx(Tooltip, { text: "Pr\xF3ximo", children: /* @__PURE__ */ jsx(
127
+ IconButton,
140
128
  {
141
- type: "button",
142
- "aria-label": "Pr\xF3ximo",
129
+ className: "rds-choice-carousel__arrow rds-choice-carousel__arrow--next",
130
+ icon: /* @__PURE__ */ jsx(ChevronRightIcon, {}),
131
+ label: "Pr\xF3ximo",
132
+ variant: "outline",
133
+ tone: "neutral",
143
134
  onClick: () => scrollByAmount(1),
144
135
  disabled: !canScrollRight,
145
- className: "hidden md:flex absolute right-0 top-1/2 -translate-y-1/2 translate-x-1/2 z-10 w-9 h-9 rounded-full items-center justify-center transition-opacity disabled:opacity-0 disabled:pointer-events-none",
146
- style: {
147
- background: "var(--choice-carousel-chevron-bg)",
148
- border: `1px solid var(--choice-carousel-chevron-border)`,
149
- color: "var(--choice-carousel-chevron-text)",
150
- boxShadow: "var(--shadow-md)"
151
- },
152
- children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.8", children: /* @__PURE__ */ jsx("path", { d: "M6 4l4 4-4 4", strokeLinecap: "round", strokeLinejoin: "round" }) })
136
+ tabIndex: -1
153
137
  }
154
- )
138
+ ) })
155
139
  ] });
156
140
  }
157
141
  export {
@@ -1,37 +1,27 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
 
4
- /**
5
- * ChoicePreviewCard — cartão de seleção VERTICAL: mini-preview (mockup/swatch/imagem) em
6
- * cima, label + descrição embaixo, check no selecionado. Para escolhas onde o rótulo não
7
- * basta e o usuário precisa VER a opção (layout da home, tema, densidade, modo).
8
- *
9
- * Quando usar cada "card clicável" do DS:
10
- * - ChoicePreviewCard — tile VERTICAL de preview selecionável (este).
11
- * - ChoiceCard — row HORIZONTAL com radio (escolha exclusiva textual).
12
- * - SelectableCard — clicável genérico (ação/navegação), button/a.
13
- * - ToggleCard — toggle dentro de card.
14
- * - MediaTile — thumbnail de navegação (sem estado selecionado).
15
- *
16
- * Estado selected é NEUTRO (stroke-focus), seguro no admin. A seleção única é gerenciada
17
- * pelo consumidor (map + selected/onSelect) — sem grupo no DS de propósito.
18
- */
4
+ /** @deprecated Use ChoiceCardProps. */
19
5
  interface ChoicePreviewCardProps {
20
6
  selected: boolean;
21
7
  onSelect: () => void;
22
- /** Mini-mockup/swatch/imagem no topo. */
8
+ /** The picture on top. */
23
9
  preview: ReactNode;
24
10
  label: string;
25
11
  description?: string;
26
- /** Bloqueado por gate de plano — mostra cadeado; o clique segue (consumidor abre paywall). */
12
+ /** Ignored: the ChoiceCard has no locked state. */
27
13
  locked?: boolean;
28
- /** Desabilitado (não-clicável). */
29
14
  disabled?: boolean;
30
- /** Selo no canto do preview (ex.: "PRO"). */
15
+ /** Ignored: the ChoiceCard has no badge on the picture. */
31
16
  badge?: ReactNode;
17
+ /** Ignored: the picture is always 16:9. */
32
18
  previewAspect?: 'square' | 'video' | 'wide';
33
19
  className?: string;
34
20
  }
35
- declare function ChoicePreviewCard({ selected, onSelect, preview, label, description, locked, disabled, badge, previewAspect, className, }: ChoicePreviewCardProps): react.JSX.Element;
21
+ /**
22
+ * @deprecated Use ChoiceCard with layout="preview" (Figma [RDS] Content/ChoiceCard). A thin wrapper over it: `label`
23
+ * is the children. It is a native radio now, not a toggle button; `locked`, `badge` and `previewAspect` are ignored.
24
+ */
25
+ declare function ChoicePreviewCard({ selected, onSelect, preview, label, description, disabled, className }: ChoicePreviewCardProps): react.JSX.Element;
36
26
 
37
27
  export { ChoicePreviewCard, type ChoicePreviewCardProps };
@@ -1,47 +1,19 @@
1
1
  "use client";
2
2
  import "../chunk-ORMEWXMH.js";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
- import { Check, Lock } from "lucide-react";
5
- function ChoicePreviewCard({
6
- selected,
7
- onSelect,
8
- preview,
9
- label,
10
- description,
11
- locked = false,
12
- disabled = false,
13
- badge,
14
- previewAspect = "video",
15
- className = ""
16
- }) {
17
- const aspect = previewAspect === "square" ? "aspect-square" : previewAspect === "wide" ? "aspect-[2/1]" : "aspect-video";
18
- return /* @__PURE__ */ jsxs(
19
- "button",
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { ChoiceCard } from "./choice-card.js";
5
+ function ChoicePreviewCard({ selected, onSelect, preview, label, description, disabled, className }) {
6
+ return /* @__PURE__ */ jsx(
7
+ ChoiceCard,
20
8
  {
21
- type: "button",
22
- onClick: onSelect,
9
+ layout: "preview",
10
+ selected,
11
+ onSelect,
12
+ preview,
13
+ description,
23
14
  disabled,
24
- "aria-pressed": selected,
25
- className: [
26
- "relative w-full text-left rounded-(--radius-card) border p-2 transition-all",
27
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stroke-focus",
28
- selected ? "border-2 border-stroke-focus bg-surface-raised" : "border border-stroke-default bg-surface-default hover:border-stroke-strong",
29
- disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
30
- className
31
- ].filter(Boolean).join(" "),
32
- children: [
33
- /* @__PURE__ */ jsxs("div", { className: ["relative w-full overflow-hidden rounded-(--radius-card) ring-1 ring-inset ring-stroke-subtle", aspect].join(" "), children: [
34
- preview,
35
- badge && /* @__PURE__ */ jsx("span", { className: "absolute top-1.5 left-1.5", children: badge }),
36
- selected && /* @__PURE__ */ jsx("span", { className: "absolute bottom-1.5 right-1.5 size-5 rounded-full bg-stroke-focus text-surface-default flex items-center justify-center", children: /* @__PURE__ */ jsx(Check, { size: 12, strokeWidth: 3 }) }),
37
- locked && // TODO(DS): trocar por token de overlay (--choice-preview-overlay) — Patrick.
38
- /* @__PURE__ */ jsx("span", { className: "absolute inset-0 flex items-center justify-center bg-[rgba(0,0,0,0.55)]", children: /* @__PURE__ */ jsx(Lock, { size: 18, className: "text-white" }) })
39
- ] }),
40
- /* @__PURE__ */ jsxs("div", { className: "px-1 pt-2", children: [
41
- /* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-fg-primary", children: label }),
42
- description && /* @__PURE__ */ jsx("div", { className: "text-xs text-fg-muted mt-0.5 leading-snug", children: description })
43
- ] })
44
- ]
15
+ className,
16
+ children: label
45
17
  }
46
18
  );
47
19
  }
@@ -1,20 +1,45 @@
1
1
  import * as react from 'react';
2
+ import { CSSProperties } from 'react';
3
+ import { FieldTextProps } from './internal/field.js';
2
4
 
3
- interface ColorInputProps {
4
- /** Hex #RRGGBB. */
5
- value: string;
6
- /** Dispara apenas com hex válido, normalizado em UPPERCASE. */
7
- onChange: (hex: string) => void;
8
- size?: 'sm' | 'md';
5
+ interface ColorInputProps extends Omit<FieldTextProps, 'labelPosition'> {
6
+ /** Controlled: the colour, #RRGGBB (Figma: `value`). */
7
+ value?: string;
8
+ /** Uncontrolled: the colour at first. */
9
+ defaultValue?: string;
10
+ /** Called only with a valid #RRGGBB, in capitals: typed and confirmed, or chosen in the palette. */
11
+ onChange?: (hex: string) => void;
12
+ /**
13
+ * The colours the swatch's popover offers (#RRGGBB): the caller decides, usually the brand's. Without a palette the
14
+ * swatch opens the system's colour picker instead.
15
+ */
16
+ palette?: string[];
17
+ /** The palette's title. */
18
+ paletteTitle?: string;
19
+ /** The line under the palette. */
20
+ paletteCaption?: string;
21
+ /** The swatch's accessible name: it opens the palette (or the system's picker). */
22
+ pickLabel?: string;
23
+ /** The form field name: carries the hex. */
24
+ name?: string;
9
25
  disabled?: boolean;
26
+ id?: string;
10
27
  className?: string;
28
+ style?: CSSProperties;
29
+ /** The name when there is no visible label. */
11
30
  'aria-label'?: string;
31
+ 'aria-labelledby'?: string;
12
32
  }
33
+ /** "2563eb", "#2563eb" → "#2563EB"; anything else → null. */
34
+ declare function normalizeHex(text: string): string | null;
13
35
  /**
14
- * ColorInput — campo de cor único: swatch (abre o picker nativo) + hex
15
- * editável, no mesmo controle. Molécula sobre os tokens do Input: mesma
16
- * altura, borda, radius e anel de foco.
36
+ * ColorInput — Figma [RDS] Forms/ColorInput. One colour, chosen or typed: the swatch shows it and the hex beside it
37
+ * is editable (#RRGGBB, with or without #). The swatch opens a popover with the palette the caller passes (Figma:
38
+ * menu=open); without one, the system's colour picker. Enter or leaving the field confirms the hex; an invalid hex
39
+ * goes back to the last valid one. The swatch's colour is the person's data, not a token: it is the one inline
40
+ * style the DS allows (style.backgroundColor of the swatch and of each palette colour). Choosing among a few fixed
41
+ * colours without a hex is the ToggleGroup or the ChoiceCard. Styles: color-input.css and internal/field.css.
17
42
  */
18
- declare function ColorInput({ value, onChange, size, disabled, className, 'aria-label': ariaLabel, }: ColorInputProps): react.JSX.Element;
43
+ declare function ColorInput({ label, hint, error, errorMessage, required, value, defaultValue, onChange, palette, paletteTitle, paletteCaption, pickLabel, name, disabled, id, className, style, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, }: ColorInputProps): react.JSX.Element;
19
44
 
20
- export { ColorInput, type ColorInputProps };
45
+ export { ColorInput, type ColorInputProps, normalizeHex };