@rojaostudio/ds 1.0.1 → 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.
- package/README.md +75 -13
- package/dist/compat/generate.d.ts +0 -1
- package/dist/components/accordion.d.ts +30 -20
- package/dist/components/accordion.js +31 -87
- package/dist/components/action-bar.d.ts +24 -0
- package/dist/components/action-bar.js +55 -0
- package/dist/components/alert-dialog.d.ts +31 -0
- package/dist/components/alert-dialog.js +43 -0
- package/dist/components/alert.d.ts +31 -19
- package/dist/components/alert.js +74 -65
- package/dist/components/attachment.d.ts +37 -0
- package/dist/components/attachment.js +76 -0
- package/dist/components/avatar.d.ts +43 -36
- package/dist/components/avatar.js +59 -83
- package/dist/components/badge.d.ts +30 -41
- package/dist/components/badge.js +16 -106
- package/dist/components/banner.d.ts +27 -0
- package/dist/components/banner.js +66 -0
- package/dist/components/benefits.d.ts +30 -0
- package/dist/components/benefits.js +32 -0
- package/dist/components/breadcrumb.d.ts +25 -18
- package/dist/components/breadcrumb.js +40 -48
- package/dist/components/browser.d.ts +18 -0
- package/dist/components/browser.js +32 -0
- package/dist/components/bubble.d.ts +29 -0
- package/dist/components/bubble.js +33 -0
- package/dist/components/button-group.d.ts +19 -0
- package/dist/components/button-group.js +20 -0
- package/dist/components/button.d.ts +47 -20
- package/dist/components/button.js +51 -107
- package/dist/components/calendar.d.ts +29 -0
- package/dist/components/calendar.js +149 -0
- package/dist/components/card.d.ts +47 -19
- package/dist/components/card.js +38 -38
- package/dist/components/carousel.d.ts +28 -0
- package/dist/components/carousel.js +130 -0
- package/dist/components/chart.d.ts +49 -0
- package/dist/components/chart.js +258 -0
- package/dist/components/checkbox-group.d.ts +16 -0
- package/dist/components/checkbox-group.js +13 -0
- package/dist/components/checkbox.d.ts +25 -10
- package/dist/components/checkbox.js +86 -67
- package/dist/components/chip-input.d.ts +46 -20
- package/dist/components/chip-input.js +171 -158
- package/dist/components/chip.d.ts +28 -0
- package/dist/components/chip.js +73 -0
- package/dist/components/choice-card.d.ts +10 -13
- package/dist/components/choice-card.js +11 -56
- package/dist/components/choice-carousel.d.ts +9 -0
- package/dist/components/choice-carousel.js +67 -78
- package/dist/components/choice-preview-card.d.ts +10 -20
- package/dist/components/choice-preview-card.js +13 -30
- package/dist/components/color-input.d.ts +36 -11
- package/dist/components/color-input.js +139 -61
- package/dist/components/combobox.d.ts +60 -57
- package/dist/components/combobox.js +215 -196
- package/dist/components/command.d.ts +58 -0
- package/dist/components/command.js +177 -0
- package/dist/components/contact.d.ts +23 -0
- package/dist/components/contact.js +32 -0
- package/dist/components/context-menu.d.ts +34 -26
- package/dist/components/context-menu.js +43 -66
- package/dist/components/copy-field.d.ts +10 -5
- package/dist/components/copy-field.js +25 -27
- package/dist/components/currency-input.d.ts +25 -11
- package/dist/components/currency-input.js +39 -67
- package/dist/components/danger-zone.d.ts +10 -1
- package/dist/components/danger-zone.js +20 -14
- package/dist/components/data-table-header.d.ts +13 -2
- package/dist/components/data-table-header.js +143 -169
- package/dist/components/date-picker.d.ts +31 -32
- package/dist/components/date-picker.js +126 -242
- package/dist/components/delta.d.ts +26 -0
- package/dist/components/delta.js +24 -0
- package/dist/components/dialog.d.ts +21 -0
- package/dist/components/dialog.js +16 -0
- package/dist/components/drawer.d.ts +15 -23
- package/dist/components/drawer.js +56 -76
- package/dist/components/dropdown-menu.d.ts +63 -0
- package/dist/components/dropdown-menu.js +62 -0
- package/dist/components/dropzone.d.ts +10 -4
- package/dist/components/dropzone.js +30 -55
- package/dist/components/empty.d.ts +29 -0
- package/dist/components/empty.js +42 -0
- package/dist/components/fab.d.ts +29 -6
- package/dist/components/fab.js +51 -39
- package/dist/components/faq.d.ts +21 -0
- package/dist/components/faq.js +24 -0
- package/dist/components/file-input.d.ts +56 -0
- package/dist/components/file-input.js +244 -0
- package/dist/components/filter-chip.d.ts +34 -47
- package/dist/components/filter-chip.js +61 -57
- package/dist/components/floating-stepper.d.ts +7 -18
- package/dist/components/floating-stepper.js +17 -35
- package/dist/components/footer.d.ts +36 -0
- package/dist/components/footer.js +38 -0
- package/dist/components/form-actions.d.ts +28 -0
- package/dist/components/form-actions.js +24 -0
- package/dist/components/google-account-chooser.d.ts +25 -0
- package/dist/components/google-account-chooser.js +44 -0
- package/dist/components/google-button.d.ts +26 -0
- package/dist/components/google-button.js +38 -0
- package/dist/components/google-consent.d.ts +23 -0
- package/dist/components/google-consent.js +28 -0
- package/dist/components/google-sign-in.d.ts +26 -0
- package/dist/components/google-sign-in.js +36 -0
- package/dist/components/hover-card.d.ts +30 -0
- package/dist/components/hover-card.js +55 -0
- package/dist/components/icon-button.d.ts +41 -11
- package/dist/components/icon-button.js +47 -61
- package/dist/components/image-crop-modal.d.ts +3 -3
- package/dist/components/image-crop-modal.js +66 -52
- package/dist/components/image-upload.d.ts +21 -29
- package/dist/components/image-upload.js +59 -219
- package/dist/components/index.d.ts +105 -49
- package/dist/components/index.js +190 -68
- package/dist/components/input-otp.d.ts +35 -0
- package/dist/components/input-otp.js +119 -0
- package/dist/components/input.d.ts +23 -17
- package/dist/components/input.js +103 -108
- package/dist/components/insight-card.d.ts +25 -9
- package/dist/components/insight-card.js +45 -19
- package/dist/components/internal/announce.d.ts +3 -0
- package/dist/components/internal/announce.js +20 -0
- package/dist/components/internal/block.d.ts +15 -0
- package/dist/components/internal/block.js +14 -0
- package/dist/components/internal/button.d.ts +23 -0
- package/dist/components/internal/button.js +30 -0
- package/dist/components/internal/choice-card.d.ts +52 -0
- package/dist/components/internal/choice-card.js +117 -0
- package/dist/components/internal/choice.d.ts +25 -0
- package/dist/components/internal/choice.js +44 -0
- package/dist/components/internal/dates.d.ts +17 -0
- package/dist/components/internal/dates.js +59 -0
- package/dist/components/internal/field.d.ts +66 -0
- package/dist/components/internal/field.js +105 -0
- package/dist/components/internal/fieldset.d.ts +25 -0
- package/dist/components/internal/fieldset.js +56 -0
- package/dist/components/internal/focus-after.d.ts +3 -0
- package/dist/components/internal/focus-after.js +13 -0
- package/dist/components/internal/google.d.ts +47 -0
- package/dist/components/internal/google.js +73 -0
- package/dist/components/internal/icons.d.ts +108 -0
- package/dist/components/internal/icons.js +316 -0
- package/dist/components/internal/menu.d.ts +16 -0
- package/dist/components/internal/menu.js +14 -0
- package/dist/components/internal/modal.d.ts +50 -0
- package/dist/components/internal/modal.js +85 -0
- package/dist/components/internal/option-content.d.ts +10 -0
- package/dist/components/internal/option-content.js +13 -0
- package/dist/components/internal/radio-context.d.ts +16 -0
- package/dist/components/internal/radio-context.js +6 -0
- package/dist/components/internal/toggle.d.ts +7 -0
- package/dist/components/internal/toggle.js +13 -0
- package/dist/components/internal/use-listbox.d.ts +56 -0
- package/dist/components/internal/use-listbox.js +69 -0
- package/dist/components/internal/whatsapp.d.ts +8 -0
- package/dist/components/internal/whatsapp.js +12 -0
- package/dist/components/item.d.ts +32 -0
- package/dist/components/item.js +35 -0
- package/dist/components/kbd.d.ts +17 -0
- package/dist/components/kbd.js +18 -0
- package/dist/components/listbox.d.ts +34 -0
- package/dist/components/listbox.js +114 -0
- package/dist/components/marker.d.ts +24 -0
- package/dist/components/marker.js +28 -0
- package/dist/components/media-tile.d.ts +17 -14
- package/dist/components/media-tile.js +19 -24
- package/dist/components/message-scroller.d.ts +20 -0
- package/dist/components/message-scroller.js +108 -0
- package/dist/components/message.d.ts +33 -0
- package/dist/components/message.js +23 -0
- package/dist/components/navigation-menu.d.ts +42 -0
- package/dist/components/navigation-menu.js +30 -0
- package/dist/components/newsletter.d.ts +27 -0
- package/dist/components/newsletter.js +75 -0
- package/dist/components/number-input.d.ts +60 -0
- package/dist/components/number-input.js +234 -0
- package/dist/components/option-tile.d.ts +20 -19
- package/dist/components/option-tile.js +52 -131
- package/dist/components/page-header.d.ts +31 -0
- package/dist/components/page-header.js +25 -0
- package/dist/components/page-shell.d.ts +11 -1
- package/dist/components/page-shell.js +8 -27
- package/dist/components/page-skeleton.d.ts +15 -21
- package/dist/components/page-skeleton.js +37 -4
- package/dist/components/pagination.d.ts +32 -22
- package/dist/components/pagination.js +83 -76
- package/dist/components/password-input.d.ts +26 -0
- package/dist/components/password-input.js +112 -0
- package/dist/components/phone-input.d.ts +12 -8
- package/dist/components/phone-input.js +77 -47
- package/dist/components/phone.d.ts +27 -0
- package/dist/components/phone.js +35 -0
- package/dist/components/popover.d.ts +25 -36
- package/dist/components/popover.js +32 -129
- package/dist/components/pricing-card.d.ts +9 -25
- package/dist/components/pricing-card.js +9 -25
- package/dist/components/pricing.d.ts +48 -0
- package/dist/components/pricing.js +64 -0
- package/dist/components/progress.d.ts +30 -0
- package/dist/components/progress.js +57 -0
- package/dist/components/qr-display.d.ts +11 -6
- package/dist/components/qr-display.js +8 -19
- package/dist/components/questionnaire.d.ts +42 -0
- package/dist/components/questionnaire.js +107 -0
- package/dist/components/radio-group.d.ts +21 -0
- package/dist/components/radio-group.js +40 -0
- package/dist/components/radio.d.ts +15 -29
- package/dist/components/radio.js +46 -87
- package/dist/components/row-actions.d.ts +5 -0
- package/dist/components/row-actions.js +57 -56
- package/dist/components/saving-bar-context.d.ts +0 -5
- package/dist/components/saving-bar-context.js +16 -34
- package/dist/components/saving-bar.d.ts +26 -11
- package/dist/components/saving-bar.js +53 -65
- package/dist/components/section-card.d.ts +18 -4
- package/dist/components/section-card.js +26 -39
- package/dist/components/section-header.d.ts +8 -12
- package/dist/components/section-header.js +7 -2
- package/dist/components/select.d.ts +44 -16
- package/dist/components/select.js +85 -135
- package/dist/components/selectable-card.d.ts +11 -19
- package/dist/components/selectable-card.js +4 -21
- package/dist/components/separator.d.ts +20 -0
- package/dist/components/separator.js +19 -0
- package/dist/components/setting-row.d.ts +11 -15
- package/dist/components/setting-row.js +11 -14
- package/dist/components/settings-list.d.ts +10 -12
- package/dist/components/settings-list.js +9 -17
- package/dist/components/sheet.d.ts +21 -0
- package/dist/components/sheet.js +16 -0
- package/dist/components/sidebar.d.ts +79 -0
- package/dist/components/sidebar.js +111 -0
- package/dist/components/skeleton.d.ts +14 -20
- package/dist/components/skeleton.js +8 -36
- package/dist/components/slider.d.ts +21 -23
- package/dist/components/slider.js +65 -56
- package/dist/components/sparkline.d.ts +19 -0
- package/dist/components/sparkline.js +32 -0
- package/dist/components/spinner.d.ts +16 -8
- package/dist/components/spinner.js +35 -32
- package/dist/components/star-rating.d.ts +22 -0
- package/dist/components/star-rating.js +25 -0
- package/dist/components/stat.d.ts +33 -0
- package/dist/components/stat.js +29 -0
- package/dist/components/status.d.ts +27 -0
- package/dist/components/status.js +34 -0
- package/dist/components/step-progress.d.ts +13 -6
- package/dist/components/step-progress.js +20 -17
- package/dist/components/summary-bar.d.ts +20 -20
- package/dist/components/summary-bar.js +13 -50
- package/dist/components/switch.d.ts +20 -0
- package/dist/components/switch.js +46 -0
- package/dist/components/table.d.ts +56 -17
- package/dist/components/table.js +65 -59
- package/dist/components/tabs.d.ts +67 -0
- package/dist/components/tabs.js +56 -0
- package/dist/components/testimonial.d.ts +30 -0
- package/dist/components/testimonial.js +36 -0
- package/dist/components/textarea.d.ts +11 -16
- package/dist/components/textarea.js +55 -75
- package/dist/components/tile.d.ts +24 -0
- package/dist/components/tile.js +21 -0
- package/dist/components/time-picker.d.ts +40 -25
- package/dist/components/time-picker.js +191 -189
- package/dist/components/toast.d.ts +63 -0
- package/dist/components/toast.js +132 -0
- package/dist/components/toggle-card-compact.d.ts +15 -5
- package/dist/components/toggle-card-compact.js +22 -81
- package/dist/components/toggle-card.d.ts +11 -2
- package/dist/components/toggle-card.js +9 -70
- package/dist/components/toggle-group.d.ts +21 -59
- package/dist/components/toggle-group.js +31 -74
- package/dist/components/toggle.d.ts +19 -9
- package/dist/components/toggle.js +20 -55
- package/dist/components/tooltip.d.ts +25 -12
- package/dist/components/tooltip.js +16 -84
- package/dist/components/top-navigation.d.ts +33 -0
- package/dist/components/top-navigation.js +85 -0
- package/dist/components/typing-indicator.d.ts +6 -0
- package/dist/components/typing-indicator.js +3 -21
- package/dist/components/whatsapp-chat.d.ts +28 -0
- package/dist/components/whatsapp-chat.js +95 -0
- package/dist/components/whatsapp-message.d.ts +22 -0
- package/dist/components/whatsapp-message.js +34 -0
- package/dist/components/whatsapp-notification.d.ts +27 -0
- package/dist/components/whatsapp-notification.js +73 -0
- package/dist/components/whatsapp-template.d.ts +42 -0
- package/dist/components/whatsapp-template.js +69 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +2 -0
- package/dist/icons/pix.d.ts +16 -0
- package/dist/icons/pix.js +29 -0
- package/dist/targets/native/components/accordion.js +31 -25
- package/dist/targets/native/components/alert.js +22 -16
- package/dist/targets/native/components/avatar.js +36 -29
- package/dist/targets/native/components/badge.js +4 -3
- package/dist/targets/native/components/button.js +11 -4
- package/dist/targets/native/components/card.js +2 -1
- package/dist/targets/native/components/checkbox.js +18 -15
- package/dist/targets/native/components/chips.js +19 -16
- package/dist/targets/native/components/choice-card.js +29 -23
- package/dist/targets/native/components/context-menu.js +13 -9
- package/dist/targets/native/components/currency-input.js +28 -25
- package/dist/targets/native/components/danger-zone.js +10 -4
- package/dist/targets/native/components/date-picker.js +86 -70
- package/dist/targets/native/components/divider.js +3 -2
- package/dist/targets/native/components/empty-state.js +6 -1
- package/dist/targets/native/components/fab.js +32 -26
- package/dist/targets/native/components/filter-chip.js +9 -8
- package/dist/targets/native/components/form-field.js +20 -10
- package/dist/targets/native/components/form-screen.js +50 -45
- package/dist/targets/native/components/google-icon.js +31 -25
- package/dist/targets/native/components/icon-button.js +6 -4
- package/dist/targets/native/components/icon.js +2 -1
- package/dist/targets/native/components/image-upload.js +59 -50
- package/dist/targets/native/components/index.d.ts +0 -2
- package/dist/targets/native/components/index.js +0 -4
- package/dist/targets/native/components/input.js +41 -34
- package/dist/targets/native/components/list-item.js +29 -23
- package/dist/targets/native/components/menu.js +12 -10
- package/dist/targets/native/components/modal.js +41 -32
- package/dist/targets/native/components/radio.js +19 -16
- package/dist/targets/native/components/search.js +41 -38
- package/dist/targets/native/components/select.js +71 -63
- package/dist/targets/native/components/sheet.js +36 -30
- package/dist/targets/native/components/skeleton.js +6 -5
- package/dist/targets/native/components/slider.js +51 -43
- package/dist/targets/native/components/spinner.js +2 -1
- package/dist/targets/native/components/stepper.js +14 -9
- package/dist/targets/native/components/switch.js +15 -14
- package/dist/targets/native/components/text.js +2 -1
- package/dist/targets/native/components/textarea.js +2 -1
- package/dist/targets/native/components/theme.js +2 -1
- package/dist/targets/native/components/toaster.js +24 -21
- package/dist/targets/native/index.d.ts +1 -1
- package/dist/targets/native/index.js +1 -3
- package/dist/targets/native/preset.cjs +0 -1
- package/dist/targets/native/theme.css +58 -60
- package/dist/targets/native/theme.d.ts +58 -60
- package/dist/targets/native/theme.js +58 -60
- package/package.json +35 -16
- package/styles/_primitives.generated.css +40 -0
- package/styles/base.css +15 -21
- package/styles/rds/components-styles.css +11365 -0
- package/styles/rds/components.css +993 -0
- package/styles/rds/foundation.css +74 -0
- package/styles/rds/theme.css +261 -0
- package/styles/rds.css +6 -0
- package/styles/themes/rojao.css +46 -53
- package/brand/rojao-black-on-white.png +0 -0
- package/brand/rojao-black.png +0 -0
- package/brand/rojao-white-on-black.png +0 -0
- package/brand/rojao-white.png +0 -0
- package/dist/components/blocker-card.d.ts +0 -42
- package/dist/components/blocker-card.js +0 -45
- package/dist/components/bottom-sheet.d.ts +0 -31
- package/dist/components/bottom-sheet.js +0 -120
- package/dist/components/chat-bubble.d.ts +0 -16
- package/dist/components/chat-bubble.js +0 -55
- package/dist/components/chips.d.ts +0 -22
- package/dist/components/chips.js +0 -94
- package/dist/components/copilot-hint.d.ts +0 -18
- package/dist/components/copilot-hint.js +0 -63
- package/dist/components/divider.d.ts +0 -20
- package/dist/components/divider.js +0 -47
- package/dist/components/empty-state.d.ts +0 -48
- package/dist/components/empty-state.js +0 -91
- package/dist/components/form-card-header.d.ts +0 -13
- package/dist/components/form-card-header.js +0 -8
- package/dist/components/label.d.ts +0 -16
- package/dist/components/label.js +0 -43
- package/dist/components/menu.d.ts +0 -50
- package/dist/components/menu.js +0 -80
- package/dist/components/modal.d.ts +0 -25
- package/dist/components/modal.js +0 -71
- package/dist/components/notice.d.ts +0 -50
- package/dist/components/notice.js +0 -103
- package/dist/components/page-tabs.d.ts +0 -35
- package/dist/components/page-tabs.js +0 -55
- package/dist/components/paywall-banner.d.ts +0 -37
- package/dist/components/paywall-banner.js +0 -42
- package/dist/components/paywall.d.ts +0 -44
- package/dist/components/paywall.js +0 -55
- package/dist/components/phone-frame.d.ts +0 -9
- package/dist/components/phone-frame.js +0 -18
- package/dist/components/pix-icon.d.ts +0 -8
- package/dist/components/pix-icon.js +0 -24
- package/dist/components/search.d.ts +0 -30
- package/dist/components/search.js +0 -81
- package/dist/components/themed.d.ts +0 -36
- package/dist/components/themed.js +0 -22
- package/dist/components/toaster.d.ts +0 -84
- package/dist/components/toaster.js +0 -284
- package/dist/components/use-dismiss.d.ts +0 -9
- package/dist/components/use-dismiss.js +0 -28
- package/dist/components/use-focus-trap.d.ts +0 -5
- package/dist/components/use-focus-trap.js +0 -54
- package/dist/targets/native/components/paywall-banner.d.ts +0 -11
- package/dist/targets/native/components/paywall-banner.js +0 -46
- package/dist/targets/native/components/paywall.d.ts +0 -18
- package/dist/targets/native/components/paywall.js +0 -61
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__objRest,
|
|
4
|
-
__spreadProps,
|
|
5
|
-
__spreadValues
|
|
6
|
-
} from "../chunk-ORMEWXMH.js";
|
|
7
|
-
import { Lock, Sparkles } from "lucide-react";
|
|
8
|
-
import { ICON_MAP } from "./empty-state.js";
|
|
9
|
-
import { Modal } from "./modal.js";
|
|
10
|
-
const CTA_CLASS = "inline-flex items-center justify-center w-full rounded-(--radius-control) px-4 py-3 text-label font-semibold bg-brand-primary text-brand-on-primary hover:bg-brand-hover transition-colors";
|
|
11
|
-
function planLineText(reason, planLabel) {
|
|
12
|
-
if (reason === "trial_value") return "Incluso no seu teste Pro";
|
|
13
|
-
if (reason === "limit") return "Limite atingido";
|
|
14
|
-
return planLabel ? `Dispon\xEDvel no ${planLabel}` : "Fa\xE7a upgrade";
|
|
15
|
-
}
|
|
16
|
-
function PaywallContent({
|
|
17
|
-
icon = "lock",
|
|
18
|
-
title,
|
|
19
|
-
description,
|
|
20
|
-
reason = "feature",
|
|
21
|
-
planLabel,
|
|
22
|
-
ctaLabel = "Ver planos",
|
|
23
|
-
ctaHref,
|
|
24
|
-
onCta,
|
|
25
|
-
linkAs: Link
|
|
26
|
-
}) {
|
|
27
|
-
var _a;
|
|
28
|
-
const Icon = (_a = ICON_MAP[icon]) != null ? _a : Lock;
|
|
29
|
-
const isTrial = reason === "trial_value";
|
|
30
|
-
const cta = ctaHref && Link ? /* @__PURE__ */ React.createElement(Link, { href: ctaHref, className: CTA_CLASS, onClick: onCta }, ctaLabel) : ctaHref ? /* @__PURE__ */ React.createElement("a", { href: ctaHref, className: CTA_CLASS, onClick: onCta }, ctaLabel) : /* @__PURE__ */ React.createElement("button", { type: "button", className: CTA_CLASS, onClick: onCta }, ctaLabel);
|
|
31
|
-
return /* @__PURE__ */ React.createElement("div", { className: "flex flex-col items-center text-center px-2" }, /* @__PURE__ */ React.createElement("div", { className: "relative mb-4 text-fg-secondary" }, /* @__PURE__ */ React.createElement(Icon, { size: 52, strokeWidth: 1.25 }), /* @__PURE__ */ React.createElement("span", { className: `absolute -bottom-1 -right-1 flex h-6 w-6 items-center justify-center rounded-full ${isTrial ? "bg-amber-500 text-white" : "bg-brand-primary text-brand-on-primary"}` }, isTrial ? /* @__PURE__ */ React.createElement(Sparkles, { size: 12, strokeWidth: 2.5 }) : /* @__PURE__ */ React.createElement(Lock, { size: 12, strokeWidth: 2.5 }))), /* @__PURE__ */ React.createElement("span", { className: `inline-flex items-center rounded-full px-2.5 py-1 text-caption font-medium ${isTrial ? "bg-amber-100 text-amber-900" : "bg-surface-raised text-fg-secondary"}` }, planLineText(reason, planLabel)), /* @__PURE__ */ React.createElement("p", { className: "text-body font-semibold text-fg-primary mt-3 mb-1.5" }, title), description && /* @__PURE__ */ React.createElement("p", { className: "text-label text-fg-muted max-w-sm leading-relaxed mb-5" }, description), /* @__PURE__ */ React.createElement("div", { className: "w-full max-w-xs" }, cta));
|
|
32
|
-
}
|
|
33
|
-
function PaywallState(_a) {
|
|
34
|
-
var _b = _a, { className = "" } = _b, content = __objRest(_b, ["className"]);
|
|
35
|
-
return /* @__PURE__ */ React.createElement(
|
|
36
|
-
"div",
|
|
37
|
-
{
|
|
38
|
-
className: ["flex flex-col items-center justify-center min-h-[320px] flex-1 py-10", className].filter(Boolean).join(" ")
|
|
39
|
-
},
|
|
40
|
-
/* @__PURE__ */ React.createElement(PaywallContent, __spreadValues({}, content))
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
function PaywallModal(_c) {
|
|
44
|
-
var _d = _c, { open, onClose } = _d, content = __objRest(_d, ["open", "onClose"]);
|
|
45
|
-
return /* @__PURE__ */ React.createElement(Modal, { open, onClose, size: "sm" }, /* @__PURE__ */ React.createElement("div", { className: "py-2" }, /* @__PURE__ */ React.createElement(PaywallContent, __spreadProps(__spreadValues({}, content), { onCta: () => {
|
|
46
|
-
var _a;
|
|
47
|
-
(_a = content.onCta) == null ? void 0 : _a.call(content);
|
|
48
|
-
onClose();
|
|
49
|
-
} }))));
|
|
50
|
-
}
|
|
51
|
-
export {
|
|
52
|
-
PaywallContent,
|
|
53
|
-
PaywallModal,
|
|
54
|
-
PaywallState
|
|
55
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import "../chunk-ORMEWXMH.js";
|
|
2
|
-
function PhoneFrame({ children, className = "" }) {
|
|
3
|
-
return /* @__PURE__ */ React.createElement(
|
|
4
|
-
"div",
|
|
5
|
-
{
|
|
6
|
-
className: [
|
|
7
|
-
// rojao-detect-disable over-rounding
|
|
8
|
-
"relative rounded-[2.5rem] border-[6px] border-(--text-primary)",
|
|
9
|
-
"bg-white overflow-hidden shadow-2xl",
|
|
10
|
-
className
|
|
11
|
-
].filter(Boolean).join(" ")
|
|
12
|
-
},
|
|
13
|
-
/* @__PURE__ */ React.createElement("div", { className: "h-full overflow-y-auto overflow-x-hidden scrollbar-none" }, children)
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
PhoneFrame
|
|
18
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__objRest,
|
|
3
|
-
__spreadValues
|
|
4
|
-
} from "../chunk-ORMEWXMH.js";
|
|
5
|
-
function PixIcon(_a) {
|
|
6
|
-
var _b = _a, { size = 16 } = _b, props = __objRest(_b, ["size"]);
|
|
7
|
-
return /* @__PURE__ */ React.createElement(
|
|
8
|
-
"svg",
|
|
9
|
-
__spreadValues({
|
|
10
|
-
width: size,
|
|
11
|
-
height: size,
|
|
12
|
-
viewBox: "0 0 512 512",
|
|
13
|
-
fill: "currentColor",
|
|
14
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
15
|
-
"aria-hidden": "true"
|
|
16
|
-
}, props),
|
|
17
|
-
/* @__PURE__ */ React.createElement("path", { d: "M242.4 292.5c5.4-5.4 14.7-5.4 20.1 0l77 77c14.2 14.2 33.1 22 53.1 22h15.1l-97.1 97.1c-30.3 30.3-79.5 30.3-109.8 0L103.3 391.2h9.3c20 0 38.9-7.8 53.1-22l76.7-76.7z" }),
|
|
18
|
-
/* @__PURE__ */ React.createElement("path", { d: "M262.5 218.9c-5.4 5.4-14.7 5.4-20.1 0l-76.7-76.7c-14.2-14.2-33.1-22-53.1-22h-9.3l97.4-97.4c30.3-30.3 79.5-30.3 109.8 0l97.1 97.1h-15.1c-20 0-38.9 7.8-53.1 22l-77 77z" }),
|
|
19
|
-
/* @__PURE__ */ React.createElement("path", { d: "M112.6 142.7c13.8 0 27.4 5.6 37.2 15.4l76.7 76.7c7.3 7.3 17 10.9 26.6 10.9s19.3-3.6 26.6-10.9l77-77c9.8-9.8 23.4-15.4 37.2-15.4h37.2l58.4 58.4c30.3 30.3 30.3 79.5 0 109.8l-58.4 58.4h-37.2c-13.8 0-27.4-5.6-37.2-15.4l-77-77c-14.2-14.2-39-14.2-53.2 0l-76.7 76.7c-9.8 9.8-23.4 15.4-37.2 15.4H75.4L17 310.7c-30.3-30.3-30.3-79.5 0-109.8l58.4-58.4h37.2z" })
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
PixIcon
|
|
24
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { InputHTMLAttributes } from 'react';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Search — input dedicado de busca. Ícone leading + botão clear quando tem valor.
|
|
6
|
-
*
|
|
7
|
-
* Uso (uncontrolled):
|
|
8
|
-
* <Search placeholder="Buscar pedidos..." onSearch={q => doSearch(q)} />
|
|
9
|
-
*
|
|
10
|
-
* Uso (controlled):
|
|
11
|
-
* <Search value={q} onChange={e => setQ(e.target.value)} onClear={() => setQ('')} />
|
|
12
|
-
*
|
|
13
|
-
* Disparos de busca:
|
|
14
|
-
* - onSearch(query): debounce automático (default 250ms) ou Enter pressed
|
|
15
|
-
* - onChange: cada keystroke (caso queira live-search direto)
|
|
16
|
-
*/
|
|
17
|
-
interface SearchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange' | 'size'> {
|
|
18
|
-
onChange?: InputHTMLAttributes<HTMLInputElement>['onChange'];
|
|
19
|
-
/** Callback debounced (250ms) ou em Enter. */
|
|
20
|
-
onSearch?: (query: string) => void;
|
|
21
|
-
/** Callback do botão clear. */
|
|
22
|
-
onClear?: () => void;
|
|
23
|
-
/** Tamanho. default = md. */
|
|
24
|
-
size?: 'sm' | 'md' | 'lg';
|
|
25
|
-
/** Largura full ou hug. default = full. */
|
|
26
|
-
width?: 'full' | 'hug';
|
|
27
|
-
}
|
|
28
|
-
declare const Search: react.ForwardRefExoticComponent<SearchProps & react.RefAttributes<HTMLInputElement>>;
|
|
29
|
-
|
|
30
|
-
export { Search, type SearchProps };
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__objRest,
|
|
4
|
-
__spreadValues
|
|
5
|
-
} from "../chunk-ORMEWXMH.js";
|
|
6
|
-
import { forwardRef, useEffect, useRef } from "react";
|
|
7
|
-
import { Search as SearchIcon, X } from "lucide-react";
|
|
8
|
-
const SIZE_CLASS = {
|
|
9
|
-
sm: "h-control-sm text-caption pl-8 pr-7",
|
|
10
|
-
md: "h-control-md text-label pl-9 pr-8",
|
|
11
|
-
lg: "h-control-lg text-body pl-10 pr-9"
|
|
12
|
-
};
|
|
13
|
-
const ICON_SIZE = { sm: 14, md: 16, lg: 18 };
|
|
14
|
-
const ICON_POS = { sm: "left-2.5", md: "left-3", lg: "left-3.5" };
|
|
15
|
-
const CLEAR_POS = { sm: "right-1.5", md: "right-2", lg: "right-2.5" };
|
|
16
|
-
const Search = forwardRef(function Search2(_a, ref) {
|
|
17
|
-
var _b = _a, { size = "md", width = "full", onSearch, onClear, onChange, value, className = "" } = _b, rest = __objRest(_b, ["size", "width", "onSearch", "onClear", "onChange", "value", "className"]);
|
|
18
|
-
const hasValue = !!(value != null ? value : "");
|
|
19
|
-
const debounceRef = useRef(null);
|
|
20
|
-
useEffect(() => () => {
|
|
21
|
-
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
22
|
-
}, []);
|
|
23
|
-
function handleChange(e) {
|
|
24
|
-
onChange == null ? void 0 : onChange(e);
|
|
25
|
-
if (onSearch) {
|
|
26
|
-
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
27
|
-
debounceRef.current = setTimeout(() => onSearch(e.target.value), 250);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function handleClear() {
|
|
31
|
-
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
32
|
-
onClear == null ? void 0 : onClear();
|
|
33
|
-
}
|
|
34
|
-
return /* @__PURE__ */ React.createElement("div", { className: ["relative inline-flex", width === "full" ? "w-full" : "w-auto"].join(" ") }, /* @__PURE__ */ React.createElement(
|
|
35
|
-
SearchIcon,
|
|
36
|
-
{
|
|
37
|
-
size: ICON_SIZE[size],
|
|
38
|
-
className: ["absolute top-1/2 -translate-y-1/2 text-fg-muted pointer-events-none", ICON_POS[size]].join(" ")
|
|
39
|
-
}
|
|
40
|
-
), /* @__PURE__ */ React.createElement(
|
|
41
|
-
"input",
|
|
42
|
-
__spreadValues({
|
|
43
|
-
ref,
|
|
44
|
-
type: "search",
|
|
45
|
-
role: "searchbox",
|
|
46
|
-
value,
|
|
47
|
-
onChange: handleChange,
|
|
48
|
-
onKeyDown: (e) => {
|
|
49
|
-
if (e.key === "Enter") {
|
|
50
|
-
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
51
|
-
onSearch == null ? void 0 : onSearch(e.target.value);
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
className: [
|
|
55
|
-
"w-full rounded-(--radius-control) bg-surface-default text-fg-primary placeholder:text-fg-placeholder",
|
|
56
|
-
"border border-stroke-control transition-colors outline-none",
|
|
57
|
-
"focus:border-stroke-focus focus:ring-2 focus:ring-stroke-focus/20",
|
|
58
|
-
"[&::-webkit-search-cancel-button]:hidden",
|
|
59
|
-
SIZE_CLASS[size],
|
|
60
|
-
className
|
|
61
|
-
].join(" ")
|
|
62
|
-
}, rest)
|
|
63
|
-
), hasValue && /* @__PURE__ */ React.createElement(
|
|
64
|
-
"button",
|
|
65
|
-
{
|
|
66
|
-
type: "button",
|
|
67
|
-
onClick: handleClear,
|
|
68
|
-
"aria-label": "Limpar busca",
|
|
69
|
-
className: [
|
|
70
|
-
"absolute top-1/2 -translate-y-1/2 inline-flex items-center justify-center",
|
|
71
|
-
"rounded-(--radius-control) text-fg-muted hover:text-fg-primary transition-colors",
|
|
72
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stroke-focus",
|
|
73
|
-
CLEAR_POS[size]
|
|
74
|
-
].join(" ")
|
|
75
|
-
},
|
|
76
|
-
/* @__PURE__ */ React.createElement(X, { size: ICON_SIZE[size] - 2 })
|
|
77
|
-
));
|
|
78
|
-
});
|
|
79
|
-
export {
|
|
80
|
-
Search
|
|
81
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* className for a brand theme: `theme-<name>` (+ ` dark`). The DS theme CSS is
|
|
6
|
-
* class-scoped, so apply this wherever you want the theme to take effect — on
|
|
7
|
-
* `<html>`/`<body>` for the whole app, or via <Themed> for a subtree.
|
|
8
|
-
*
|
|
9
|
-
* <html className={themeClass('padaria', isDark)}>
|
|
10
|
-
*/
|
|
11
|
-
declare const themeClass: (theme: string, dark?: boolean) => string;
|
|
12
|
-
interface ThemedProps extends HTMLAttributes<HTMLDivElement> {
|
|
13
|
-
/** Brand theme name → `.theme-<name>` (the served sheet's selector). */
|
|
14
|
-
theme: string;
|
|
15
|
-
/** Apply dark mode (`.dark`). */
|
|
16
|
-
dark?: boolean;
|
|
17
|
-
/** Merge the theme class onto the single child element instead of wrapping a
|
|
18
|
-
* `<div>` (no extra DOM node — apply the theme to a `<main>`, `<section>`…). */
|
|
19
|
-
asChild?: boolean;
|
|
20
|
-
children: ReactNode;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Scopes a brand theme to its subtree via the `.theme-<name>` class. Because the
|
|
24
|
-
* theme CSS is class-scoped (not :root), this can NEST — different subtrees can
|
|
25
|
-
* render different themes on the same page. For the whole app, prefer putting
|
|
26
|
-
* `themeClass()` on `<html>` instead of wrapping everything in a div.
|
|
27
|
-
*
|
|
28
|
-
* <Themed theme="padaria">…</Themed>
|
|
29
|
-
* <Themed theme="pet" dark>…</Themed>
|
|
30
|
-
* <Themed theme="cafe" asChild><main>…</main></Themed>
|
|
31
|
-
*
|
|
32
|
-
* Pair with the brand sheet (ds.rojao.ai/themes/<slug>.css) + base.css.
|
|
33
|
-
*/
|
|
34
|
-
declare function Themed({ theme, dark, asChild, className, children, ...rest }: ThemedProps): react.JSX.Element;
|
|
35
|
-
|
|
36
|
-
export { Themed, type ThemedProps, themeClass };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__objRest,
|
|
3
|
-
__spreadProps,
|
|
4
|
-
__spreadValues
|
|
5
|
-
} from "../chunk-ORMEWXMH.js";
|
|
6
|
-
import { cloneElement, isValidElement } from "react";
|
|
7
|
-
const themeClass = (theme, dark = false) => `theme-${theme}${dark ? " dark" : ""}`;
|
|
8
|
-
function Themed(_a) {
|
|
9
|
-
var _b = _a, { theme, dark = false, asChild = false, className, children } = _b, rest = __objRest(_b, ["theme", "dark", "asChild", "className", "children"]);
|
|
10
|
-
const cls = themeClass(theme, dark);
|
|
11
|
-
if (asChild && isValidElement(children)) {
|
|
12
|
-
const child = children;
|
|
13
|
-
return cloneElement(child, __spreadProps(__spreadValues({}, rest), {
|
|
14
|
-
className: [cls, child.props.className, className].filter(Boolean).join(" ")
|
|
15
|
-
}));
|
|
16
|
-
}
|
|
17
|
-
return /* @__PURE__ */ React.createElement("div", __spreadValues({ className: [cls, className].filter(Boolean).join(" ") }, rest), children);
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
Themed,
|
|
21
|
-
themeClass
|
|
22
|
-
};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Toaster — comportamento de snackbar M3, visual de notification card.
|
|
5
|
-
*
|
|
6
|
-
* Comportamento (M3):
|
|
7
|
-
* • Um por vez (novo substitui o anterior).
|
|
8
|
-
* • Action label OU close icon — não os dois.
|
|
9
|
-
* • Duração: 4s sem action, 7s com action; persistente em loading.
|
|
10
|
-
* • Posição default: bottom-center.
|
|
11
|
-
* • Motion: 150ms ease-out enter, 75ms ease-in exit, slide vertical + fade.
|
|
12
|
-
* • Não rouba foco. aria-live="polite" default, "assertive" pra erro.
|
|
13
|
-
*
|
|
14
|
-
* Visual (notification card):
|
|
15
|
-
* • Card escuro nos DOIS themes (inverse surface, tokens --toast-*).
|
|
16
|
-
* • Feedback variants: tint da cor semântica entra pela esquerda (gradiente)
|
|
17
|
-
* + badge circular sólido com halo — ícone em tom escuro da própria cor.
|
|
18
|
-
* • Título (message) + description opcional em --toast-text-muted.
|
|
19
|
-
* • default/loading: card neutro sem tint nem badge.
|
|
20
|
-
*
|
|
21
|
-
* API:
|
|
22
|
-
* import { toast } from '@rojaostudio/ds/components';
|
|
23
|
-
* toast('Salvo');
|
|
24
|
-
* toast.success('Salvo', { description: 'Pedido #1042 confirmado.' });
|
|
25
|
-
* toast.error('...'), toast.warning('...'), toast.info('...'), toast.loading('...');
|
|
26
|
-
* toast.dismiss(id?);
|
|
27
|
-
* toast.promise(p, { loading, success, error });
|
|
28
|
-
*/
|
|
29
|
-
type ToastVariant = 'default' | 'success' | 'error' | 'warning' | 'info' | 'loading';
|
|
30
|
-
type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
31
|
-
interface ToastOptions {
|
|
32
|
-
variant?: ToastVariant;
|
|
33
|
-
/** Linha secundária — message vira título (semibold) quando presente. */
|
|
34
|
-
description?: string;
|
|
35
|
-
/** ms até auto-dismiss. Omitido → fallback do Material (1500 curto · 2750 com ação/erro · 0 loading). */
|
|
36
|
-
duration?: number;
|
|
37
|
-
action?: {
|
|
38
|
-
label: string;
|
|
39
|
-
onClick: () => void;
|
|
40
|
-
};
|
|
41
|
-
id?: string;
|
|
42
|
-
}
|
|
43
|
-
interface ToastFn {
|
|
44
|
-
(message: string, options?: ToastOptions): string;
|
|
45
|
-
success: (msg: string, opts?: Omit<ToastOptions, 'variant'>) => string;
|
|
46
|
-
error: (msg: string, opts?: Omit<ToastOptions, 'variant'>) => string;
|
|
47
|
-
warning: (msg: string, opts?: Omit<ToastOptions, 'variant'>) => string;
|
|
48
|
-
info: (msg: string, opts?: Omit<ToastOptions, 'variant'>) => string;
|
|
49
|
-
loading: (msg: string, opts?: Omit<ToastOptions, 'variant' | 'duration'>) => string;
|
|
50
|
-
dismiss: (id?: string) => void;
|
|
51
|
-
promise: <T>(promise: Promise<T>, msgs: {
|
|
52
|
-
loading: string;
|
|
53
|
-
success: string | ((data: T) => string);
|
|
54
|
-
error: string | ((err: unknown) => string);
|
|
55
|
-
}) => Promise<T>;
|
|
56
|
-
}
|
|
57
|
-
declare const toast: ToastFn;
|
|
58
|
-
interface ToastVisualProps {
|
|
59
|
-
message: string;
|
|
60
|
-
/** Linha secundária — message vira título (semibold) quando presente. */
|
|
61
|
-
description?: string;
|
|
62
|
-
variant?: ToastVariant;
|
|
63
|
-
action?: {
|
|
64
|
-
label: string;
|
|
65
|
-
onClick?: () => void;
|
|
66
|
-
};
|
|
67
|
-
/** Quando true, renderiza a animação de entrada. default = false. */
|
|
68
|
-
animate?: boolean;
|
|
69
|
-
/** Top vs bottom afeta a direção da animação enter. default = 'bottom'. */
|
|
70
|
-
origin?: 'top' | 'bottom';
|
|
71
|
-
/** Mostra o botão de close (X). default = true se não houver action; M3
|
|
72
|
-
* prescreve action OU close, não ambos. */
|
|
73
|
-
dismissible?: boolean;
|
|
74
|
-
/** Handler do close (opcional). Sem handler, o X aparece mas é decorativo. */
|
|
75
|
-
onDismiss?: () => void;
|
|
76
|
-
}
|
|
77
|
-
declare function ToastVisual({ message, description, variant, action, animate, origin, dismissible, onDismiss, }: ToastVisualProps): react.JSX.Element;
|
|
78
|
-
interface ToasterProps {
|
|
79
|
-
/** Posição. default = bottom-center (M3 recomenda bottom). */
|
|
80
|
-
position?: ToastPosition;
|
|
81
|
-
}
|
|
82
|
-
declare function Toaster({ position }?: ToasterProps): react.ReactPortal | null;
|
|
83
|
-
|
|
84
|
-
export { type ToastOptions, type ToastPosition, type ToastVariant, ToastVisual, type ToastVisualProps, Toaster, type ToasterProps, toast };
|
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__spreadProps,
|
|
4
|
-
__spreadValues
|
|
5
|
-
} from "../chunk-ORMEWXMH.js";
|
|
6
|
-
import { useEffect, useRef, useState, useCallback } from "react";
|
|
7
|
-
import { createPortal } from "react-dom";
|
|
8
|
-
import { Loader2, X, Check, AlertTriangle, Info } from "lucide-react";
|
|
9
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
10
|
-
function emit(a) {
|
|
11
|
-
for (const l of listeners) l(a);
|
|
12
|
-
}
|
|
13
|
-
let counter = 0;
|
|
14
|
-
function genId() {
|
|
15
|
-
counter += 1;
|
|
16
|
-
return `t${Date.now()}_${counter}`;
|
|
17
|
-
}
|
|
18
|
-
function defaultDuration(variant, hasAction) {
|
|
19
|
-
if (variant === "loading") return 0;
|
|
20
|
-
if (hasAction || variant === "error") return 2750;
|
|
21
|
-
return 1500;
|
|
22
|
-
}
|
|
23
|
-
function show(message, options = {}) {
|
|
24
|
-
var _a, _b, _c;
|
|
25
|
-
const id = (_a = options.id) != null ? _a : genId();
|
|
26
|
-
const variant = (_b = options.variant) != null ? _b : "default";
|
|
27
|
-
const hasAction = !!options.action;
|
|
28
|
-
emit({
|
|
29
|
-
type: "show",
|
|
30
|
-
toast: {
|
|
31
|
-
id,
|
|
32
|
-
message,
|
|
33
|
-
description: options.description,
|
|
34
|
-
variant,
|
|
35
|
-
duration: (_c = options.duration) != null ? _c : defaultDuration(variant, hasAction),
|
|
36
|
-
action: options.action
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
return id;
|
|
40
|
-
}
|
|
41
|
-
const base = (msg, opts) => show(msg, opts);
|
|
42
|
-
const toast = Object.assign(base, {
|
|
43
|
-
success: (m, o) => show(m, __spreadProps(__spreadValues({}, o), { variant: "success" })),
|
|
44
|
-
error: (m, o) => show(m, __spreadProps(__spreadValues({}, o), { variant: "error" })),
|
|
45
|
-
warning: (m, o) => show(m, __spreadProps(__spreadValues({}, o), { variant: "warning" })),
|
|
46
|
-
info: (m, o) => show(m, __spreadProps(__spreadValues({}, o), { variant: "info" })),
|
|
47
|
-
loading: (m, o) => show(m, __spreadProps(__spreadValues({}, o), { variant: "loading" })),
|
|
48
|
-
dismiss: (id) => {
|
|
49
|
-
if (id) emit({ type: "dismiss", id });
|
|
50
|
-
else listeners.forEach((l) => l({ type: "dismiss", id: "*" }));
|
|
51
|
-
},
|
|
52
|
-
promise: async (promise, msgs) => {
|
|
53
|
-
const id = show(msgs.loading, { variant: "loading" });
|
|
54
|
-
try {
|
|
55
|
-
const data = await promise;
|
|
56
|
-
const m = typeof msgs.success === "function" ? msgs.success(data) : msgs.success;
|
|
57
|
-
emit({ type: "update", id, patch: { variant: "success", message: m, duration: defaultDuration("success", false) } });
|
|
58
|
-
return data;
|
|
59
|
-
} catch (err) {
|
|
60
|
-
const m = typeof msgs.error === "function" ? msgs.error(err) : msgs.error;
|
|
61
|
-
emit({ type: "update", id, patch: { variant: "error", message: m, duration: defaultDuration("error", false) } });
|
|
62
|
-
throw err;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
const VARIANT_COLOR = {
|
|
67
|
-
success: "var(--success)",
|
|
68
|
-
error: "var(--danger)",
|
|
69
|
-
warning: "var(--warning)",
|
|
70
|
-
info: "var(--info)"
|
|
71
|
-
};
|
|
72
|
-
function containerStyle(variant) {
|
|
73
|
-
const c = VARIANT_COLOR[variant];
|
|
74
|
-
return {
|
|
75
|
-
background: c ? `linear-gradient(105deg, color-mix(in srgb, ${c} 16%, var(--toast-bg)) 0%, var(--toast-bg) 60%)` : "var(--toast-bg)",
|
|
76
|
-
color: "var(--toast-text)"
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
const VARIANT_ICON = {
|
|
80
|
-
default: null,
|
|
81
|
-
success: Check,
|
|
82
|
-
error: X,
|
|
83
|
-
warning: AlertTriangle,
|
|
84
|
-
info: Info,
|
|
85
|
-
loading: Loader2
|
|
86
|
-
};
|
|
87
|
-
function ToastVisual({
|
|
88
|
-
message,
|
|
89
|
-
description,
|
|
90
|
-
variant = "default",
|
|
91
|
-
action,
|
|
92
|
-
animate = false,
|
|
93
|
-
origin = "bottom",
|
|
94
|
-
dismissible,
|
|
95
|
-
onDismiss
|
|
96
|
-
}) {
|
|
97
|
-
const isError = variant === "error";
|
|
98
|
-
const isLoading = variant === "loading";
|
|
99
|
-
const hasAction = !!action;
|
|
100
|
-
const showClose = dismissible != null ? dismissible : !hasAction && !isLoading;
|
|
101
|
-
const animClass = animate ? origin === "top" ? "rojao-toast--enter-top" : "rojao-toast--enter-bottom" : "";
|
|
102
|
-
return /* @__PURE__ */ React.createElement(
|
|
103
|
-
"div",
|
|
104
|
-
{
|
|
105
|
-
role: isError ? "alert" : "status",
|
|
106
|
-
className: [
|
|
107
|
-
"rojao-toast",
|
|
108
|
-
"flex items-center gap-3 px-4 py-3 shadow-lg",
|
|
109
|
-
"min-w-[344px] max-w-[min(560px,calc(100vw-2rem))]",
|
|
110
|
-
animClass
|
|
111
|
-
].join(" "),
|
|
112
|
-
style: __spreadProps(__spreadValues({}, containerStyle(variant)), {
|
|
113
|
-
border: "1px solid var(--toast-border)",
|
|
114
|
-
borderRadius: "var(--radius-toast)",
|
|
115
|
-
minHeight: "56px",
|
|
116
|
-
fontFamily: "var(--font-family)"
|
|
117
|
-
})
|
|
118
|
-
},
|
|
119
|
-
(() => {
|
|
120
|
-
const Icon = VARIANT_ICON[variant];
|
|
121
|
-
if (!Icon) return null;
|
|
122
|
-
if (isLoading) {
|
|
123
|
-
return /* @__PURE__ */ React.createElement(
|
|
124
|
-
Icon,
|
|
125
|
-
{
|
|
126
|
-
size: 18,
|
|
127
|
-
className: "shrink-0 animate-spin",
|
|
128
|
-
style: { color: "var(--toast-text-muted)" }
|
|
129
|
-
}
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
const c = VARIANT_COLOR[variant];
|
|
133
|
-
return /* @__PURE__ */ React.createElement(
|
|
134
|
-
"span",
|
|
135
|
-
{
|
|
136
|
-
"aria-hidden": "true",
|
|
137
|
-
className: "grid place-items-center rounded-full shrink-0 size-9",
|
|
138
|
-
style: {
|
|
139
|
-
background: c,
|
|
140
|
-
color: `color-mix(in srgb, ${c} 30%, black)`,
|
|
141
|
-
boxShadow: `0 0 0 5px color-mix(in srgb, ${c} 18%, transparent)`
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
/* @__PURE__ */ React.createElement(Icon, { size: 18, strokeWidth: 2.75 })
|
|
145
|
-
);
|
|
146
|
-
})(),
|
|
147
|
-
/* @__PURE__ */ React.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ React.createElement("p", { className: description ? "text-[0.9375rem] font-semibold leading-snug" : "text-label leading-snug" }, message), description && /* @__PURE__ */ React.createElement("p", { className: "text-label leading-snug mt-0.5", style: { color: "var(--toast-text-muted)" } }, description)),
|
|
148
|
-
hasAction ? /* @__PURE__ */ React.createElement(
|
|
149
|
-
"button",
|
|
150
|
-
{
|
|
151
|
-
type: "button",
|
|
152
|
-
onClick: action.onClick,
|
|
153
|
-
className: "shrink-0 text-label font-medium px-2 -mr-1 transition-opacity hover:opacity-80",
|
|
154
|
-
style: { color: "currentColor" }
|
|
155
|
-
},
|
|
156
|
-
action.label
|
|
157
|
-
) : showClose && /* @__PURE__ */ React.createElement(
|
|
158
|
-
"button",
|
|
159
|
-
{
|
|
160
|
-
type: "button",
|
|
161
|
-
onClick: onDismiss,
|
|
162
|
-
"aria-label": "Fechar",
|
|
163
|
-
className: "shrink-0 opacity-60 hover:opacity-100 transition-opacity",
|
|
164
|
-
style: { color: "currentColor" }
|
|
165
|
-
},
|
|
166
|
-
/* @__PURE__ */ React.createElement(X, { size: 16 })
|
|
167
|
-
)
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
const POSITION_CLASS = {
|
|
171
|
-
"top-left": "top-4 left-4",
|
|
172
|
-
"top-center": "top-4 left-1/2 -translate-x-1/2",
|
|
173
|
-
"top-right": "top-4 right-4",
|
|
174
|
-
"bottom-left": "bottom-4 left-4",
|
|
175
|
-
"bottom-center": "bottom-4 left-1/2 -translate-x-1/2",
|
|
176
|
-
"bottom-right": "bottom-4 right-4"
|
|
177
|
-
};
|
|
178
|
-
function Toaster({ position = "bottom-center" } = {}) {
|
|
179
|
-
const [current, setCurrent] = useState(null);
|
|
180
|
-
const [mounted, setMounted] = useState(false);
|
|
181
|
-
const timerRef = useRef(null);
|
|
182
|
-
useEffect(() => {
|
|
183
|
-
setMounted(true);
|
|
184
|
-
}, []);
|
|
185
|
-
const clearTimer = useCallback(() => {
|
|
186
|
-
if (timerRef.current) {
|
|
187
|
-
clearTimeout(timerRef.current);
|
|
188
|
-
timerRef.current = null;
|
|
189
|
-
}
|
|
190
|
-
}, []);
|
|
191
|
-
const startExit = useCallback((id) => {
|
|
192
|
-
clearTimer();
|
|
193
|
-
setCurrent((prev) => prev && prev.id === id ? __spreadProps(__spreadValues({}, prev), { exiting: true }) : prev);
|
|
194
|
-
setTimeout(() => {
|
|
195
|
-
setCurrent((prev) => prev && prev.id === id ? null : prev);
|
|
196
|
-
}, 75);
|
|
197
|
-
}, [clearTimer]);
|
|
198
|
-
const scheduleDismiss = useCallback((t2) => {
|
|
199
|
-
if (t2.duration <= 0) return;
|
|
200
|
-
timerRef.current = setTimeout(() => startExit(t2.id), t2.duration);
|
|
201
|
-
}, [startExit]);
|
|
202
|
-
const currentRef = useRef(null);
|
|
203
|
-
currentRef.current = current;
|
|
204
|
-
useEffect(() => {
|
|
205
|
-
const listener = (action) => {
|
|
206
|
-
var _a, _b, _c;
|
|
207
|
-
if (action.type === "show") {
|
|
208
|
-
clearTimer();
|
|
209
|
-
setCurrent(action.toast);
|
|
210
|
-
scheduleDismiss(action.toast);
|
|
211
|
-
} else if (action.type === "update") {
|
|
212
|
-
setCurrent((prev) => {
|
|
213
|
-
if (!prev || prev.id !== action.id) return prev;
|
|
214
|
-
const next = __spreadProps(__spreadValues(__spreadValues({}, prev), action.patch), { exiting: false });
|
|
215
|
-
clearTimer();
|
|
216
|
-
if (next.duration > 0) {
|
|
217
|
-
timerRef.current = setTimeout(() => startExit(next.id), next.duration);
|
|
218
|
-
}
|
|
219
|
-
return next;
|
|
220
|
-
});
|
|
221
|
-
} else if (action.type === "dismiss") {
|
|
222
|
-
if (action.id === "*") startExit((_b = (_a = currentRef.current) == null ? void 0 : _a.id) != null ? _b : "");
|
|
223
|
-
else if (((_c = currentRef.current) == null ? void 0 : _c.id) === action.id) startExit(action.id);
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
listeners.add(listener);
|
|
227
|
-
return () => {
|
|
228
|
-
listeners.delete(listener);
|
|
229
|
-
clearTimer();
|
|
230
|
-
};
|
|
231
|
-
}, [clearTimer, scheduleDismiss, startExit]);
|
|
232
|
-
const handleMouseEnter = () => clearTimer();
|
|
233
|
-
const handleMouseLeave = () => {
|
|
234
|
-
if (current && !current.exiting) scheduleDismiss(current);
|
|
235
|
-
};
|
|
236
|
-
if (!mounted || !current) return null;
|
|
237
|
-
const t = current;
|
|
238
|
-
const isError = t.variant === "error";
|
|
239
|
-
const ariaLive = isError ? "assertive" : "polite";
|
|
240
|
-
const isTop = position.startsWith("top-");
|
|
241
|
-
const exitClass = t.exiting ? isTop ? "rojao-toast--exit-top" : "rojao-toast--exit-bottom" : "";
|
|
242
|
-
return createPortal(
|
|
243
|
-
/* @__PURE__ */ React.createElement(
|
|
244
|
-
"div",
|
|
245
|
-
{
|
|
246
|
-
"aria-live": ariaLive,
|
|
247
|
-
"aria-atomic": "true",
|
|
248
|
-
className: ["fixed z-[9999] pointer-events-none", POSITION_CLASS[position]].join(" ")
|
|
249
|
-
},
|
|
250
|
-
/* @__PURE__ */ React.createElement(
|
|
251
|
-
"div",
|
|
252
|
-
{
|
|
253
|
-
onMouseEnter: handleMouseEnter,
|
|
254
|
-
onMouseLeave: handleMouseLeave,
|
|
255
|
-
className: ["pointer-events-auto", exitClass].join(" ")
|
|
256
|
-
},
|
|
257
|
-
/* @__PURE__ */ React.createElement(
|
|
258
|
-
ToastVisual,
|
|
259
|
-
{
|
|
260
|
-
message: t.message,
|
|
261
|
-
description: t.description,
|
|
262
|
-
variant: t.variant,
|
|
263
|
-
action: t.action ? {
|
|
264
|
-
label: t.action.label,
|
|
265
|
-
onClick: () => {
|
|
266
|
-
t.action.onClick();
|
|
267
|
-
startExit(t.id);
|
|
268
|
-
}
|
|
269
|
-
} : void 0,
|
|
270
|
-
animate: !t.exiting,
|
|
271
|
-
origin: isTop ? "top" : "bottom",
|
|
272
|
-
onDismiss: () => startExit(t.id)
|
|
273
|
-
}
|
|
274
|
-
)
|
|
275
|
-
)
|
|
276
|
-
),
|
|
277
|
-
document.body
|
|
278
|
-
);
|
|
279
|
-
}
|
|
280
|
-
export {
|
|
281
|
-
ToastVisual,
|
|
282
|
-
Toaster,
|
|
283
|
-
toast
|
|
284
|
-
};
|
|
@@ -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 };
|