@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
@@ -1,290 +0,0 @@
1
- "use client";
2
- import {
3
- __spreadProps,
4
- __spreadValues
5
- } from "../chunk-ORMEWXMH.js";
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- import { useEffect, useRef, useState, useCallback } from "react";
8
- import { createPortal } from "react-dom";
9
- import { Loader2, X, Check, AlertTriangle, Info } from "lucide-react";
10
- const listeners = /* @__PURE__ */ new Set();
11
- function emit(a) {
12
- for (const l of listeners) l(a);
13
- }
14
- let counter = 0;
15
- function genId() {
16
- counter += 1;
17
- return `t${Date.now()}_${counter}`;
18
- }
19
- function defaultDuration(variant, hasAction) {
20
- if (variant === "loading") return 0;
21
- if (hasAction || variant === "error") return 2750;
22
- return 1500;
23
- }
24
- function show(message, options = {}) {
25
- var _a, _b, _c;
26
- const id = (_a = options.id) != null ? _a : genId();
27
- const variant = (_b = options.variant) != null ? _b : "default";
28
- const hasAction = !!options.action;
29
- emit({
30
- type: "show",
31
- toast: {
32
- id,
33
- message,
34
- description: options.description,
35
- variant,
36
- duration: (_c = options.duration) != null ? _c : defaultDuration(variant, hasAction),
37
- action: options.action
38
- }
39
- });
40
- return id;
41
- }
42
- const base = (msg, opts) => show(msg, opts);
43
- const toast = Object.assign(base, {
44
- success: (m, o) => show(m, __spreadProps(__spreadValues({}, o), { variant: "success" })),
45
- error: (m, o) => show(m, __spreadProps(__spreadValues({}, o), { variant: "error" })),
46
- warning: (m, o) => show(m, __spreadProps(__spreadValues({}, o), { variant: "warning" })),
47
- info: (m, o) => show(m, __spreadProps(__spreadValues({}, o), { variant: "info" })),
48
- loading: (m, o) => show(m, __spreadProps(__spreadValues({}, o), { variant: "loading" })),
49
- dismiss: (id) => {
50
- if (id) emit({ type: "dismiss", id });
51
- else listeners.forEach((l) => l({ type: "dismiss", id: "*" }));
52
- },
53
- promise: async (promise, msgs) => {
54
- const id = show(msgs.loading, { variant: "loading" });
55
- try {
56
- const data = await promise;
57
- const m = typeof msgs.success === "function" ? msgs.success(data) : msgs.success;
58
- emit({ type: "update", id, patch: { variant: "success", message: m, duration: defaultDuration("success", false) } });
59
- return data;
60
- } catch (err) {
61
- const m = typeof msgs.error === "function" ? msgs.error(err) : msgs.error;
62
- emit({ type: "update", id, patch: { variant: "error", message: m, duration: defaultDuration("error", false) } });
63
- throw err;
64
- }
65
- }
66
- });
67
- const VARIANT_COLOR = {
68
- success: "var(--success)",
69
- error: "var(--danger)",
70
- warning: "var(--warning)",
71
- info: "var(--info)"
72
- };
73
- function containerStyle(variant) {
74
- const c = VARIANT_COLOR[variant];
75
- return {
76
- background: c ? `linear-gradient(105deg, color-mix(in srgb, ${c} 16%, var(--toast-bg)) 0%, var(--toast-bg) 60%)` : "var(--toast-bg)",
77
- color: "var(--toast-text)"
78
- };
79
- }
80
- const VARIANT_ICON = {
81
- default: null,
82
- success: Check,
83
- error: X,
84
- warning: AlertTriangle,
85
- info: Info,
86
- loading: Loader2
87
- };
88
- function ToastVisual({
89
- message,
90
- description,
91
- variant = "default",
92
- action,
93
- animate = false,
94
- origin = "bottom",
95
- dismissible,
96
- onDismiss
97
- }) {
98
- const isError = variant === "error";
99
- const isLoading = variant === "loading";
100
- const hasAction = !!action;
101
- const showClose = dismissible != null ? dismissible : !hasAction && !isLoading;
102
- const animClass = animate ? origin === "top" ? "rojao-toast--enter-top" : "rojao-toast--enter-bottom" : "";
103
- return /* @__PURE__ */ jsxs(
104
- "div",
105
- {
106
- role: isError ? "alert" : "status",
107
- className: [
108
- "rojao-toast",
109
- "flex items-center gap-3 px-4 py-3 shadow-lg",
110
- "min-w-[344px] max-w-[min(560px,calc(100vw-2rem))]",
111
- animClass
112
- ].join(" "),
113
- style: __spreadProps(__spreadValues({}, containerStyle(variant)), {
114
- border: "1px solid var(--toast-border)",
115
- borderRadius: "var(--radius-toast)",
116
- minHeight: "56px",
117
- fontFamily: "var(--font-family)"
118
- }),
119
- children: [
120
- (() => {
121
- const Icon = VARIANT_ICON[variant];
122
- if (!Icon) return null;
123
- if (isLoading) {
124
- return /* @__PURE__ */ jsx(
125
- Icon,
126
- {
127
- size: 18,
128
- className: "shrink-0 animate-spin",
129
- style: { color: "var(--toast-text-muted)" }
130
- }
131
- );
132
- }
133
- const c = VARIANT_COLOR[variant];
134
- return /* @__PURE__ */ jsx(
135
- "span",
136
- {
137
- "aria-hidden": "true",
138
- className: "grid place-items-center rounded-full shrink-0 size-9",
139
- style: {
140
- background: c,
141
- color: `color-mix(in srgb, ${c} 30%, black)`,
142
- boxShadow: `0 0 0 5px color-mix(in srgb, ${c} 18%, transparent)`
143
- },
144
- children: /* @__PURE__ */ jsx(Icon, { size: 18, strokeWidth: 2.75 })
145
- }
146
- );
147
- })(),
148
- /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
149
- /* @__PURE__ */ jsx("p", { className: description ? "text-[0.9375rem] font-semibold leading-snug" : "text-label leading-snug", children: message }),
150
- description && /* @__PURE__ */ jsx("p", { className: "text-label leading-snug mt-0.5", style: { color: "var(--toast-text-muted)" }, children: description })
151
- ] }),
152
- hasAction ? /* @__PURE__ */ jsx(
153
- "button",
154
- {
155
- type: "button",
156
- onClick: action.onClick,
157
- className: "shrink-0 text-label font-medium px-2 -mr-1 transition-opacity hover:opacity-80",
158
- style: { color: "currentColor" },
159
- children: action.label
160
- }
161
- ) : showClose && /* @__PURE__ */ jsx(
162
- "button",
163
- {
164
- type: "button",
165
- onClick: onDismiss,
166
- "aria-label": "Fechar",
167
- className: "shrink-0 opacity-60 hover:opacity-100 transition-opacity",
168
- style: { color: "currentColor" },
169
- children: /* @__PURE__ */ jsx(X, { size: 16 })
170
- }
171
- )
172
- ]
173
- }
174
- );
175
- }
176
- const POSITION_CLASS = {
177
- "top-left": "top-4 left-4",
178
- "top-center": "top-4 left-1/2 -translate-x-1/2",
179
- "top-right": "top-4 right-4",
180
- "bottom-left": "bottom-4 left-4",
181
- "bottom-center": "bottom-4 left-1/2 -translate-x-1/2",
182
- "bottom-right": "bottom-4 right-4"
183
- };
184
- function Toaster({ position = "bottom-center" } = {}) {
185
- const [current, setCurrent] = useState(null);
186
- const [mounted, setMounted] = useState(false);
187
- const timerRef = useRef(null);
188
- useEffect(() => {
189
- setMounted(true);
190
- }, []);
191
- const clearTimer = useCallback(() => {
192
- if (timerRef.current) {
193
- clearTimeout(timerRef.current);
194
- timerRef.current = null;
195
- }
196
- }, []);
197
- const startExit = useCallback((id) => {
198
- clearTimer();
199
- setCurrent((prev) => prev && prev.id === id ? __spreadProps(__spreadValues({}, prev), { exiting: true }) : prev);
200
- setTimeout(() => {
201
- setCurrent((prev) => prev && prev.id === id ? null : prev);
202
- }, 75);
203
- }, [clearTimer]);
204
- const scheduleDismiss = useCallback((t2) => {
205
- if (t2.duration <= 0) return;
206
- timerRef.current = setTimeout(() => startExit(t2.id), t2.duration);
207
- }, [startExit]);
208
- const currentRef = useRef(null);
209
- currentRef.current = current;
210
- useEffect(() => {
211
- const listener = (action) => {
212
- var _a, _b, _c;
213
- if (action.type === "show") {
214
- clearTimer();
215
- setCurrent(action.toast);
216
- scheduleDismiss(action.toast);
217
- } else if (action.type === "update") {
218
- setCurrent((prev) => {
219
- if (!prev || prev.id !== action.id) return prev;
220
- const next = __spreadProps(__spreadValues(__spreadValues({}, prev), action.patch), { exiting: false });
221
- clearTimer();
222
- if (next.duration > 0) {
223
- timerRef.current = setTimeout(() => startExit(next.id), next.duration);
224
- }
225
- return next;
226
- });
227
- } else if (action.type === "dismiss") {
228
- if (action.id === "*") startExit((_b = (_a = currentRef.current) == null ? void 0 : _a.id) != null ? _b : "");
229
- else if (((_c = currentRef.current) == null ? void 0 : _c.id) === action.id) startExit(action.id);
230
- }
231
- };
232
- listeners.add(listener);
233
- return () => {
234
- listeners.delete(listener);
235
- clearTimer();
236
- };
237
- }, [clearTimer, scheduleDismiss, startExit]);
238
- const handleMouseEnter = () => clearTimer();
239
- const handleMouseLeave = () => {
240
- if (current && !current.exiting) scheduleDismiss(current);
241
- };
242
- if (!mounted || !current) return null;
243
- const t = current;
244
- const isError = t.variant === "error";
245
- const ariaLive = isError ? "assertive" : "polite";
246
- const isTop = position.startsWith("top-");
247
- const exitClass = t.exiting ? isTop ? "rojao-toast--exit-top" : "rojao-toast--exit-bottom" : "";
248
- return createPortal(
249
- /* @__PURE__ */ jsx(
250
- "div",
251
- {
252
- "aria-live": ariaLive,
253
- "aria-atomic": "true",
254
- className: ["fixed z-[9999] pointer-events-none", POSITION_CLASS[position]].join(" "),
255
- children: /* @__PURE__ */ jsx(
256
- "div",
257
- {
258
- onMouseEnter: handleMouseEnter,
259
- onMouseLeave: handleMouseLeave,
260
- className: ["pointer-events-auto", exitClass].join(" "),
261
- children: /* @__PURE__ */ jsx(
262
- ToastVisual,
263
- {
264
- message: t.message,
265
- description: t.description,
266
- variant: t.variant,
267
- action: t.action ? {
268
- label: t.action.label,
269
- onClick: () => {
270
- t.action.onClick();
271
- startExit(t.id);
272
- }
273
- } : void 0,
274
- animate: !t.exiting,
275
- origin: isTop ? "top" : "bottom",
276
- onDismiss: () => startExit(t.id)
277
- }
278
- )
279
- }
280
- )
281
- }
282
- ),
283
- document.body
284
- );
285
- }
286
- export {
287
- ToastVisual,
288
- Toaster,
289
- toast
290
- };
@@ -1,9 +0,0 @@
1
- import { RefObject } from 'react';
2
-
3
- /**
4
- * useDismiss — outside-click + ESC para overlays (dropdown, combobox, etc).
5
- * Stale-closure safe: handler updates on every render via ref.
6
- */
7
- declare function useDismiss(popupRef: RefObject<Element | null>, triggerRef: RefObject<Element | null>, onDismiss: () => void, active: boolean): void;
8
-
9
- export { useDismiss };
@@ -1,28 +0,0 @@
1
- "use client";
2
- import "../chunk-ORMEWXMH.js";
3
- import { useEffect, useRef } from "react";
4
- function useDismiss(popupRef, triggerRef, onDismiss, active) {
5
- const cb = useRef(onDismiss);
6
- cb.current = onDismiss;
7
- useEffect(() => {
8
- if (!active) return;
9
- const onMouse = (e) => {
10
- var _a, _b;
11
- const t = e.target;
12
- if (((_a = popupRef.current) == null ? void 0 : _a.contains(t)) || ((_b = triggerRef.current) == null ? void 0 : _b.contains(t))) return;
13
- cb.current();
14
- };
15
- const onKey = (e) => {
16
- if (e.key === "Escape") cb.current();
17
- };
18
- document.addEventListener("mousedown", onMouse);
19
- document.addEventListener("keydown", onKey);
20
- return () => {
21
- document.removeEventListener("mousedown", onMouse);
22
- document.removeEventListener("keydown", onKey);
23
- };
24
- }, [active]);
25
- }
26
- export {
27
- useDismiss
28
- };
@@ -1,5 +0,0 @@
1
- import * as react from 'react';
2
-
3
- declare function useFocusTrap<T extends HTMLElement>(open: boolean): react.RefObject<T | null>;
4
-
5
- export { useFocusTrap };
@@ -1,54 +0,0 @@
1
- "use client";
2
- import "../chunk-ORMEWXMH.js";
3
- import { useEffect, useRef } from "react";
4
- const FOCUSABLE = [
5
- "a[href]",
6
- "button:not([disabled])",
7
- "textarea:not([disabled])",
8
- "input:not([disabled])",
9
- "select:not([disabled])",
10
- '[tabindex]:not([tabindex="-1"])'
11
- ].join(", ");
12
- function useFocusTrap(open) {
13
- const ref = useRef(null);
14
- useEffect(() => {
15
- var _a;
16
- if (!open) return;
17
- const container = ref.current;
18
- if (!container) return;
19
- const previousFocus = document.activeElement;
20
- const focusables = Array.from(container.querySelectorAll(FOCUSABLE));
21
- ((_a = focusables[0]) != null ? _a : container).focus();
22
- const trap = (e) => {
23
- if (e.key !== "Tab") return;
24
- const nodes = Array.from(container.querySelectorAll(FOCUSABLE));
25
- if (nodes.length === 0) {
26
- e.preventDefault();
27
- return;
28
- }
29
- const first = nodes[0];
30
- const last = nodes[nodes.length - 1];
31
- if (!first || !last) return;
32
- if (e.shiftKey) {
33
- if (document.activeElement === first) {
34
- e.preventDefault();
35
- last.focus();
36
- }
37
- } else {
38
- if (document.activeElement === last) {
39
- e.preventDefault();
40
- first.focus();
41
- }
42
- }
43
- };
44
- document.addEventListener("keydown", trap);
45
- return () => {
46
- document.removeEventListener("keydown", trap);
47
- previousFocus == null ? void 0 : previousFocus.focus();
48
- };
49
- }, [open]);
50
- return ref;
51
- }
52
- export {
53
- useFocusTrap
54
- };
@@ -1,11 +0,0 @@
1
- import * as react from 'react';
2
-
3
- type PaywallBannerProps = {
4
- title: string;
5
- description?: string;
6
- ctaLabel?: string;
7
- onPress: () => void;
8
- };
9
- declare function PaywallBanner({ title, description, ctaLabel, onPress }: PaywallBannerProps): react.JSX.Element;
10
-
11
- export { PaywallBanner, type PaywallBannerProps };
@@ -1,55 +0,0 @@
1
- import "../../../chunk-ORMEWXMH.js";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { Lock } from "lucide-react-native";
4
- import { StyleSheet, View } from "react-native";
5
- import { Button } from "./button.js";
6
- import { Text } from "./text.js";
7
- import { useTheme } from "./theme.js";
8
- function PaywallBanner({ title, description, ctaLabel = "Ver planos", onPress }) {
9
- const t = useTheme();
10
- return /* @__PURE__ */ jsxs(
11
- View,
12
- {
13
- accessibilityRole: "summary",
14
- style: [
15
- styles.container,
16
- { backgroundColor: t["--surface-raised"], borderColor: t["--border-default"] }
17
- ],
18
- children: [
19
- /* @__PURE__ */ jsxs(View, { style: styles.row, children: [
20
- /* @__PURE__ */ jsx(View, { style: [styles.iconWrap, { backgroundColor: t["--brand-primary"] }], children: /* @__PURE__ */ jsx(Lock, { size: 20, color: t["--brand-on-primary"] }) }),
21
- /* @__PURE__ */ jsxs(View, { style: styles.copy, children: [
22
- /* @__PURE__ */ jsx(Text, { variant: "label", numberOfLines: 2, children: title }),
23
- description ? /* @__PURE__ */ jsx(Text, { variant: "caption", color: "secondary", style: styles.desc, children: description }) : null
24
- ] })
25
- ] }),
26
- /* @__PURE__ */ jsx(Button, { label: ctaLabel, variant: "primary", fullWidth: true, onPress })
27
- ]
28
- }
29
- );
30
- }
31
- const styles = StyleSheet.create({
32
- container: {
33
- borderWidth: 1,
34
- borderRadius: 12,
35
- padding: 16,
36
- gap: 14
37
- },
38
- row: {
39
- flexDirection: "row",
40
- alignItems: "flex-start",
41
- gap: 12
42
- },
43
- iconWrap: {
44
- width: 40,
45
- height: 40,
46
- borderRadius: 10,
47
- alignItems: "center",
48
- justifyContent: "center"
49
- },
50
- copy: { flex: 1 },
51
- desc: { marginTop: 2 }
52
- });
53
- export {
54
- PaywallBanner
55
- };
@@ -1,18 +0,0 @@
1
- import * as react from 'react';
2
-
3
- type PaywallReason = 'feature' | 'limit';
4
- type PaywallIcon = 'lock' | 'catalog' | 'channels' | 'commercial' | 'operation' | 'intelligence' | 'billing';
5
- type PaywallContentProps = {
6
- icon?: PaywallIcon;
7
- title: string;
8
- description?: string;
9
- reason?: PaywallReason;
10
- planLabel?: string;
11
- ctaLabel?: string;
12
- onCta: () => void;
13
- };
14
- /** Visual puro do paywall — o app envolve num Sheet/overlay (gate de ação) ou
15
- * num container de tela cheia (gate de seção). */
16
- declare function PaywallContent({ icon, title, description, reason, planLabel, ctaLabel, onCta, }: PaywallContentProps): react.JSX.Element;
17
-
18
- export { PaywallContent, type PaywallContentProps, type PaywallIcon, type PaywallReason };
@@ -1,71 +0,0 @@
1
- import "../../../chunk-ORMEWXMH.js";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import {
4
- Lock,
5
- Package,
6
- Send,
7
- HandCoins,
8
- Store,
9
- BarChart3,
10
- CreditCard
11
- } from "lucide-react-native";
12
- import { StyleSheet, View } from "react-native";
13
- import { Button } from "./button.js";
14
- import { Text } from "./text.js";
15
- import { useTheme } from "./theme.js";
16
- const ICONS = {
17
- lock: Lock,
18
- catalog: Package,
19
- channels: Send,
20
- commercial: HandCoins,
21
- operation: Store,
22
- intelligence: BarChart3,
23
- billing: CreditCard
24
- };
25
- function planLineText(reason, planLabel) {
26
- if (reason === "limit") return "Limite atingido";
27
- return planLabel ? `Dispon\xEDvel no ${planLabel}` : "Fa\xE7a upgrade";
28
- }
29
- function PaywallContent({
30
- icon = "lock",
31
- title,
32
- description,
33
- reason = "feature",
34
- planLabel,
35
- ctaLabel = "Ver planos",
36
- onCta
37
- }) {
38
- var _a;
39
- const t = useTheme();
40
- const Icon = (_a = ICONS[icon]) != null ? _a : Lock;
41
- return /* @__PURE__ */ jsxs(View, { style: styles.container, children: [
42
- /* @__PURE__ */ jsxs(View, { style: styles.iconWrap, children: [
43
- /* @__PURE__ */ jsx(Icon, { size: 52, strokeWidth: 1.25, color: t["--text-secondary"] }),
44
- /* @__PURE__ */ jsx(View, { style: [styles.lockBadge, { backgroundColor: t["--brand-primary"] }], children: /* @__PURE__ */ jsx(Lock, { size: 12, strokeWidth: 2.5, color: t["--brand-on-primary"] }) })
45
- ] }),
46
- /* @__PURE__ */ jsx(View, { style: [styles.pill, { backgroundColor: t["--surface-raised"] }], children: /* @__PURE__ */ jsx(Text, { variant: "caption", color: "secondary", children: planLineText(reason, planLabel) }) }),
47
- /* @__PURE__ */ jsx(Text, { variant: "title", style: styles.title, children: title }),
48
- description ? /* @__PURE__ */ jsx(Text, { variant: "body-sm", color: "muted", style: styles.desc, children: description }) : null,
49
- /* @__PURE__ */ jsx(Button, { label: ctaLabel, variant: "primary", fullWidth: true, onPress: onCta })
50
- ] });
51
- }
52
- const styles = StyleSheet.create({
53
- container: { alignItems: "center", paddingHorizontal: 8, gap: 12, width: "100%" },
54
- iconWrap: { position: "relative", marginBottom: 4 },
55
- lockBadge: {
56
- position: "absolute",
57
- bottom: -4,
58
- right: -4,
59
- width: 24,
60
- height: 24,
61
- borderRadius: 12,
62
- alignItems: "center",
63
- justifyContent: "center"
64
- },
65
- pill: { borderRadius: 999, paddingHorizontal: 10, paddingVertical: 4 },
66
- title: { textAlign: "center" },
67
- desc: { textAlign: "center", maxWidth: 320 }
68
- });
69
- export {
70
- PaywallContent
71
- };
File without changes