@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.
- 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 -93
- 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 +67 -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 -90
- package/dist/components/badge.d.ts +30 -41
- package/dist/components/badge.js +13 -110
- 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 +38 -56
- 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 +45 -108
- 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 +31 -46
- 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 +87 -81
- package/dist/components/chip-input.d.ts +46 -20
- package/dist/components/chip-input.js +172 -176
- 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 -62
- package/dist/components/choice-carousel.d.ts +9 -0
- package/dist/components/choice-carousel.js +28 -44
- package/dist/components/choice-preview-card.d.ts +10 -20
- package/dist/components/choice-preview-card.js +12 -40
- package/dist/components/color-input.d.ts +36 -11
- package/dist/components/color-input.js +131 -59
- package/dist/components/combobox.d.ts +60 -57
- package/dist/components/combobox.js +210 -213
- 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 +41 -68
- package/dist/components/copy-field.d.ts +10 -5
- package/dist/components/copy-field.js +24 -29
- package/dist/components/currency-input.d.ts +25 -11
- package/dist/components/currency-input.js +29 -65
- package/dist/components/danger-zone.d.ts +10 -1
- package/dist/components/danger-zone.js +14 -18
- package/dist/components/data-table-header.d.ts +13 -2
- package/dist/components/data-table-header.js +114 -190
- package/dist/components/date-picker.d.ts +31 -32
- package/dist/components/date-picker.js +119 -254
- 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 +57 -89
- 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 -58
- 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 -51
- 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 -61
- package/dist/components/floating-stepper.d.ts +7 -18
- package/dist/components/floating-stepper.js +27 -55
- 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 +44 -64
- package/dist/components/image-crop-modal.d.ts +3 -3
- package/dist/components/image-crop-modal.js +32 -39
- package/dist/components/image-upload.d.ts +21 -29
- package/dist/components/image-upload.js +55 -259
- package/dist/components/index.d.ts +105 -52
- package/dist/components/index.js +190 -74
- 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 +104 -137
- package/dist/components/insight-card.d.ts +25 -9
- package/dist/components/insight-card.js +42 -27
- 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 -27
- 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 -137
- 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 -34
- package/dist/components/page-skeleton.d.ts +15 -21
- package/dist/components/page-skeleton.js +28 -25
- package/dist/components/pagination.d.ts +32 -22
- package/dist/components/pagination.js +78 -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 +75 -64
- 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 +30 -131
- package/dist/components/pricing-card.d.ts +9 -25
- package/dist/components/pricing-card.js +9 -40
- 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 +6 -22
- 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 +45 -103
- package/dist/components/row-actions.d.ts +5 -0
- package/dist/components/row-actions.js +27 -34
- package/dist/components/saving-bar-context.d.ts +0 -5
- package/dist/components/saving-bar-context.js +16 -40
- package/dist/components/saving-bar.d.ts +26 -11
- package/dist/components/saving-bar.js +50 -65
- package/dist/components/section-card.d.ts +18 -4
- package/dist/components/section-card.js +29 -50
- package/dist/components/section-header.d.ts +8 -12
- package/dist/components/section-header.js +5 -10
- package/dist/components/select.d.ts +44 -16
- package/dist/components/select.js +83 -154
- package/dist/components/selectable-card.d.ts +11 -19
- package/dist/components/selectable-card.js +4 -28
- 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 +10 -23
- package/dist/components/settings-list.d.ts +10 -12
- package/dist/components/settings-list.js +7 -19
- 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 -37
- package/dist/components/slider.d.ts +21 -23
- package/dist/components/slider.js +59 -64
- 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 +34 -37
- 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 +18 -16
- package/dist/components/summary-bar.d.ts +20 -20
- package/dist/components/summary-bar.js +13 -55
- 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 +59 -58
- 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 -91
- 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 +185 -203
- 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 +19 -86
- package/dist/components/toggle-card.d.ts +11 -2
- package/dist/components/toggle-card.js +8 -77
- package/dist/components/toggle-group.d.ts +21 -59
- package/dist/components/toggle-group.js +31 -80
- package/dist/components/toggle.d.ts +19 -9
- package/dist/components/toggle.js +16 -61
- package/dist/components/tooltip.d.ts +25 -12
- package/dist/components/tooltip.js +15 -88
- 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 -24
- 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/targets/native/components/index.d.ts +0 -2
- package/dist/targets/native/components/index.js +0 -4
- 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 +34 -12
- package/styles/_primitives.generated.css +40 -0
- package/styles/base.css +12 -18
- 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/dist/components/blocker-card.d.ts +0 -42
- package/dist/components/blocker-card.js +0 -54
- package/dist/components/bottom-sheet.d.ts +0 -31
- package/dist/components/bottom-sheet.js +0 -127
- package/dist/components/chat-bubble.d.ts +0 -16
- package/dist/components/chat-bubble.js +0 -56
- package/dist/components/chips.d.ts +0 -22
- package/dist/components/chips.js +0 -101
- package/dist/components/copilot-hint.d.ts +0 -18
- package/dist/components/copilot-hint.js +0 -72
- package/dist/components/divider.d.ts +0 -20
- package/dist/components/divider.js +0 -50
- package/dist/components/empty-state.d.ts +0 -48
- package/dist/components/empty-state.js +0 -94
- package/dist/components/form-card-header.d.ts +0 -13
- package/dist/components/form-card-header.js +0 -16
- package/dist/components/label.d.ts +0 -16
- package/dist/components/label.js +0 -48
- package/dist/components/menu.d.ts +0 -50
- package/dist/components/menu.js +0 -83
- package/dist/components/modal.d.ts +0 -25
- package/dist/components/modal.js +0 -86
- package/dist/components/notice.d.ts +0 -50
- package/dist/components/notice.js +0 -121
- package/dist/components/page-tabs.d.ts +0 -35
- package/dist/components/page-tabs.js +0 -68
- package/dist/components/paywall-banner.d.ts +0 -37
- package/dist/components/paywall-banner.js +0 -58
- package/dist/components/paywall.d.ts +0 -44
- package/dist/components/paywall.js +0 -65
- package/dist/components/phone-frame.d.ts +0 -9
- package/dist/components/phone-frame.js +0 -19
- package/dist/components/pix-icon.d.ts +0 -8
- package/dist/components/search.d.ts +0 -30
- package/dist/components/search.js +0 -86
- package/dist/components/themed.d.ts +0 -36
- package/dist/components/themed.js +0 -23
- package/dist/components/toaster.d.ts +0 -84
- package/dist/components/toaster.js +0 -290
- 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 -55
- package/dist/targets/native/components/paywall.d.ts +0 -18
- package/dist/targets/native/components/paywall.js +0 -71
- /package/dist/{components/pix-icon.js → icons/pix.js} +0 -0
|
@@ -1,144 +1,43 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-ORMEWXMH.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
function calcPosition(triggerRect, popRect, placement, offset) {
|
|
7
|
-
const { innerWidth: vw, innerHeight: vh } = window;
|
|
8
|
-
let [side, cross = "center"] = placement.split("-");
|
|
9
|
-
let top = 0, left = 0;
|
|
10
|
-
const place = (s, c) => {
|
|
11
|
-
if (s === "bottom") top = triggerRect.bottom + offset;
|
|
12
|
-
else if (s === "top") top = triggerRect.top - popRect.height - offset;
|
|
13
|
-
else if (s === "left") {
|
|
14
|
-
left = triggerRect.left - popRect.width - offset;
|
|
15
|
-
} else if (s === "right") {
|
|
16
|
-
left = triggerRect.right + offset;
|
|
17
|
-
}
|
|
18
|
-
if (s === "top" || s === "bottom") {
|
|
19
|
-
if (c === "start") left = triggerRect.left;
|
|
20
|
-
else if (c === "end") left = triggerRect.right - popRect.width;
|
|
21
|
-
else left = triggerRect.left + (triggerRect.width - popRect.width) / 2;
|
|
22
|
-
} else {
|
|
23
|
-
if (c === "start") top = triggerRect.top;
|
|
24
|
-
else if (c === "end") top = triggerRect.bottom - popRect.height;
|
|
25
|
-
else top = triggerRect.top + (triggerRect.height - popRect.height) / 2;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
place(side, cross);
|
|
29
|
-
if (side === "bottom" && top + popRect.height > vh) {
|
|
30
|
-
side = "top";
|
|
31
|
-
place(side, cross);
|
|
32
|
-
} else if (side === "top" && top < 0) {
|
|
33
|
-
side = "bottom";
|
|
34
|
-
place(side, cross);
|
|
35
|
-
}
|
|
36
|
-
if (side === "right" && left + popRect.width > vw) {
|
|
37
|
-
side = "left";
|
|
38
|
-
place(side, cross);
|
|
39
|
-
} else if (side === "left" && left < 0) {
|
|
40
|
-
side = "right";
|
|
41
|
-
place(side, cross);
|
|
42
|
-
}
|
|
43
|
-
left = Math.max(8, Math.min(left, vw - popRect.width - 8));
|
|
44
|
-
top = Math.max(8, Math.min(top, vh - popRect.height - 8));
|
|
45
|
-
return { top, left, placement: `${side}${cross !== "center" ? `-${cross}` : ""}` };
|
|
46
|
-
}
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useId } from "react";
|
|
5
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
47
6
|
function Popover({
|
|
48
7
|
trigger,
|
|
8
|
+
title,
|
|
49
9
|
children,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
open
|
|
10
|
+
side = "bottom",
|
|
11
|
+
align = "start",
|
|
12
|
+
open,
|
|
13
|
+
defaultOpen,
|
|
53
14
|
onOpenChange,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
className = "",
|
|
57
|
-
triggerClassName
|
|
15
|
+
className,
|
|
16
|
+
"aria-label": ariaLabel
|
|
58
17
|
}) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const popRef = useRef(null);
|
|
65
|
-
const id = useId();
|
|
66
|
-
const isControlled = openProp !== void 0;
|
|
67
|
-
const open = isControlled ? openProp : internalOpen;
|
|
68
|
-
const setOpen = (next) => {
|
|
69
|
-
if (!isControlled) setInternalOpen(next);
|
|
70
|
-
onOpenChange == null ? void 0 : onOpenChange(next);
|
|
71
|
-
};
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
setMounted(true);
|
|
74
|
-
}, []);
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
if (!open || !triggerRef.current || !popRef.current) return;
|
|
77
|
-
const update = () => {
|
|
78
|
-
if (!triggerRef.current || !popRef.current) return;
|
|
79
|
-
const trig = triggerRef.current.getBoundingClientRect();
|
|
80
|
-
const pop = popRef.current.getBoundingClientRect();
|
|
81
|
-
setPosition(calcPosition(trig, pop, placement, offset));
|
|
82
|
-
};
|
|
83
|
-
update();
|
|
84
|
-
window.addEventListener("scroll", update, true);
|
|
85
|
-
window.addEventListener("resize", update);
|
|
86
|
-
return () => {
|
|
87
|
-
window.removeEventListener("scroll", update, true);
|
|
88
|
-
window.removeEventListener("resize", update);
|
|
89
|
-
};
|
|
90
|
-
}, [open, placement, offset]);
|
|
91
|
-
useEffect(() => {
|
|
92
|
-
if (!open) return;
|
|
93
|
-
const handleClick = (e) => {
|
|
94
|
-
var _a2, _b2;
|
|
95
|
-
if (!closeOnOutsideClick) return;
|
|
96
|
-
const t = e.target;
|
|
97
|
-
if (((_a2 = popRef.current) == null ? void 0 : _a2.contains(t)) || ((_b2 = triggerRef.current) == null ? void 0 : _b2.contains(t))) return;
|
|
98
|
-
setOpen(false);
|
|
99
|
-
};
|
|
100
|
-
const handleKey = (e) => {
|
|
101
|
-
if (closeOnEsc && e.key === "Escape") setOpen(false);
|
|
102
|
-
};
|
|
103
|
-
document.addEventListener("mousedown", handleClick);
|
|
104
|
-
document.addEventListener("keydown", handleKey);
|
|
105
|
-
return () => {
|
|
106
|
-
document.removeEventListener("mousedown", handleClick);
|
|
107
|
-
document.removeEventListener("keydown", handleKey);
|
|
108
|
-
};
|
|
109
|
-
}, [open, closeOnOutsideClick, closeOnEsc]);
|
|
110
|
-
const close = () => setOpen(false);
|
|
111
|
-
const toggle = () => setOpen(!open);
|
|
112
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
113
|
-
/* @__PURE__ */ jsx(
|
|
114
|
-
"div",
|
|
18
|
+
const titleId = useId();
|
|
19
|
+
return /* @__PURE__ */ jsxs(PopoverPrimitive.Root, { open, defaultOpen, onOpenChange, children: [
|
|
20
|
+
/* @__PURE__ */ jsx(PopoverPrimitive.Trigger, { asChild: true, children: trigger }),
|
|
21
|
+
/* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
22
|
+
PopoverPrimitive.Content,
|
|
115
23
|
{
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
24
|
+
side,
|
|
25
|
+
align,
|
|
26
|
+
sideOffset: 8,
|
|
27
|
+
collisionPadding: 16,
|
|
28
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
29
|
+
"aria-label": title ? void 0 : ariaLabel,
|
|
30
|
+
className: ["rds-popover", className].filter(Boolean).join(" "),
|
|
31
|
+
children: [
|
|
32
|
+
title && /* @__PURE__ */ jsx("p", { id: titleId, className: "rds-popover__title", children: title }),
|
|
33
|
+
/* @__PURE__ */ jsx("div", { className: "rds-popover__body", children })
|
|
34
|
+
]
|
|
121
35
|
}
|
|
122
|
-
)
|
|
123
|
-
mounted && open && createPortal(
|
|
124
|
-
/* @__PURE__ */ jsx(
|
|
125
|
-
"div",
|
|
126
|
-
{
|
|
127
|
-
ref: popRef,
|
|
128
|
-
id,
|
|
129
|
-
className: ["fixed z-[1000]", className].join(" "),
|
|
130
|
-
style: {
|
|
131
|
-
top: (_a = position == null ? void 0 : position.top) != null ? _a : -9999,
|
|
132
|
-
left: (_b = position == null ? void 0 : position.left) != null ? _b : -9999,
|
|
133
|
-
visibility: position ? "visible" : "hidden"
|
|
134
|
-
},
|
|
135
|
-
children: typeof children === "function" ? children({ close }) : children
|
|
136
|
-
}
|
|
137
|
-
),
|
|
138
|
-
document.body
|
|
139
|
-
)
|
|
36
|
+
) })
|
|
140
37
|
] });
|
|
141
38
|
}
|
|
39
|
+
const PopoverClose = PopoverPrimitive.Close;
|
|
142
40
|
export {
|
|
143
|
-
Popover
|
|
41
|
+
Popover,
|
|
42
|
+
PopoverClose
|
|
144
43
|
};
|
|
@@ -1,42 +1,26 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* PricingCard — cartão de plano para páginas de preço (marketing + billing).
|
|
6
|
-
*
|
|
7
|
-
* Props-based para casar com o shape de um catálogo (`/api/public/plans`):
|
|
8
|
-
* nome, preço já formatado, lista de features e um slot de CTA (o consumidor
|
|
9
|
-
* injeta o próprio link/botão — o DS não conhece roteamento nem analytics).
|
|
10
|
-
*
|
|
11
|
-
* `recommended` inverte a superfície (destaque) e mostra o selo de recomendação.
|
|
12
|
-
* `badge` é um acento independente (ex.: "14 dias grátis") em outline.
|
|
13
|
-
*
|
|
14
|
-
* <PricingCard
|
|
15
|
-
* name="Essencial" price="R$49,90" period="/mês"
|
|
16
|
-
* description="Para quem vende todo dia."
|
|
17
|
-
* features={['Produtos ilimitados', 'Controle de estoque']}
|
|
18
|
-
* recommended
|
|
19
|
-
* cta={<a href="/register">Começar</a>}
|
|
20
|
-
* />
|
|
21
|
-
*/
|
|
4
|
+
/** @deprecated Use PricingPlanProps. */
|
|
22
5
|
interface PricingCardProps {
|
|
23
6
|
name: string;
|
|
24
|
-
/**
|
|
7
|
+
/** Price already formatted by the caller ("R$49,90", "Grátis"). */
|
|
25
8
|
price: string;
|
|
26
|
-
/** Sufixo do preço (ex.: "/mês"). Omitido em planos sem recorrência. */
|
|
27
9
|
period?: string;
|
|
28
10
|
description?: string;
|
|
29
11
|
features: string[];
|
|
30
|
-
/** Plano em destaque: superfície invertida + selo de recomendação. */
|
|
31
12
|
recommended?: boolean;
|
|
32
|
-
/**
|
|
13
|
+
/** Default "Recomendado". */
|
|
33
14
|
recommendedLabel?: string;
|
|
34
|
-
/**
|
|
15
|
+
/** Ignored: the Figma [RDS] plan has one badge only, the recommended one. */
|
|
35
16
|
badge?: string;
|
|
36
|
-
/** Slot do CTA — o consumidor injeta <a>/<Link>/<button> já estilizado ou nu. */
|
|
37
17
|
cta: ReactNode;
|
|
38
18
|
className?: string;
|
|
39
19
|
}
|
|
40
|
-
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use PricingPlan (Figma [RDS] Blocks/.pricing/plan), inside a Pricing. A thin wrapper over it: every
|
|
22
|
+
* prop passes through except `badge`, which the Figma does not have.
|
|
23
|
+
*/
|
|
24
|
+
declare function PricingCard({ badge: _badge, ...props }: PricingCardProps): react.JSX.Element;
|
|
41
25
|
|
|
42
26
|
export { PricingCard, type PricingCardProps };
|
|
@@ -1,43 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
price,
|
|
11
|
-
period,
|
|
12
|
-
description,
|
|
13
|
-
features,
|
|
14
|
-
recommended = false,
|
|
15
|
-
recommendedLabel = "Recomendado",
|
|
16
|
-
badge,
|
|
17
|
-
cta,
|
|
18
|
-
className = ""
|
|
19
|
-
}) {
|
|
20
|
-
const surface = recommended ? "bg-surface-invert text-fg-inverse border border-transparent" : "bg-surface-default text-fg-primary border border-stroke-default";
|
|
21
|
-
const nameTone = recommended ? "text-fg-inverse/70" : "text-fg-muted";
|
|
22
|
-
const descTone = recommended ? "text-fg-inverse/70" : "text-fg-muted";
|
|
23
|
-
const periodTone = recommended ? "text-fg-inverse/60" : "text-fg-muted";
|
|
24
|
-
const featTone = recommended ? "text-fg-inverse/85" : "text-fg-secondary";
|
|
25
|
-
const check = recommended ? CHECK_TONE.recommended : CHECK_TONE.default;
|
|
26
|
-
return /* @__PURE__ */ jsxs("div", { className: `relative flex flex-col rounded-(--radius-card) p-6 ${surface} ${className}`, children: [
|
|
27
|
-
recommended && /* @__PURE__ */ jsx("span", { className: "absolute -top-3 left-1/2 -translate-x-1/2 whitespace-nowrap rounded-(--radius-badge) bg-brand-accent px-3 py-1 text-[10px] font-bold uppercase tracking-widest text-brand-on-accent", children: recommendedLabel }),
|
|
28
|
-
badge && /* @__PURE__ */ jsx("span", { className: "absolute -top-3 right-4 whitespace-nowrap rounded-(--radius-badge) border border-brand-accent bg-surface-default px-3 py-1 text-[10px] font-bold uppercase tracking-widest text-brand-accent", children: badge }),
|
|
29
|
-
/* @__PURE__ */ jsx("p", { className: `text-caption font-semibold uppercase tracking-widest ${nameTone}`, children: name }),
|
|
30
|
-
/* @__PURE__ */ jsxs("div", { className: "mt-3 mb-1 flex items-baseline gap-1", children: [
|
|
31
|
-
/* @__PURE__ */ jsx("span", { className: "text-4xl font-bold leading-none tracking-tight tabular-nums", children: price }),
|
|
32
|
-
period && /* @__PURE__ */ jsx("span", { className: `text-caption ${periodTone}`, children: period })
|
|
33
|
-
] }),
|
|
34
|
-
description && /* @__PURE__ */ jsx("p", { className: `mb-5 min-h-10 text-caption ${descTone}`, children: description }),
|
|
35
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1", children: cta }),
|
|
36
|
-
/* @__PURE__ */ jsx("ul", { className: "mt-5 space-y-2", children: features.map((f) => /* @__PURE__ */ jsxs("li", { className: `flex items-start gap-2 text-caption ${featTone}`, children: [
|
|
37
|
-
/* @__PURE__ */ jsx(Check, { size: 14, className: `mt-0.5 shrink-0 ${check}`, "aria-hidden": "true" }),
|
|
38
|
-
/* @__PURE__ */ jsx("span", { children: f })
|
|
39
|
-
] }, f)) })
|
|
40
|
-
] });
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../chunk-ORMEWXMH.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { PricingPlan } from "./pricing.js";
|
|
7
|
+
function PricingCard(_a) {
|
|
8
|
+
var _b = _a, { badge: _badge } = _b, props = __objRest(_b, ["badge"]);
|
|
9
|
+
return /* @__PURE__ */ jsx(PricingPlan, __spreadValues({}, props));
|
|
41
10
|
}
|
|
42
11
|
export {
|
|
43
12
|
PricingCard
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface PricingProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
5
|
+
/** A short label above the title (Figma: `eyebrow`). */
|
|
6
|
+
eyebrow?: ReactNode;
|
|
7
|
+
/** The block's title, an h2 that names the section (Figma: `title`). */
|
|
8
|
+
title: ReactNode;
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
/** The PricingPlans (Figma: slot `plans`): side by side, stacked below 640 of container width. */
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Pricing — Figma [RDS] Blocks/Pricing. The pricing block of a public page: label, title, a sentence and the plans,
|
|
15
|
+
* one of them recommended. Adapts to the width of its container (Figma: `screen`). Styles: pricing.css.
|
|
16
|
+
*/
|
|
17
|
+
declare function Pricing({ eyebrow, title, description, children, className, ...rest }: PricingProps): react.JSX.Element;
|
|
18
|
+
interface PricingPlanProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
19
|
+
/** The plan's name, an h3 shown in capitals (Figma: `name`). */
|
|
20
|
+
name: ReactNode;
|
|
21
|
+
/** The price, already formatted by the caller (Figma: `price`): "R$ 49,90", "Grátis". */
|
|
22
|
+
price: ReactNode;
|
|
23
|
+
/** After the price (Figma: `showPeriod` + `period`): "/mês". */
|
|
24
|
+
period?: ReactNode;
|
|
25
|
+
/** Who it is for (Figma: `showDescription` + `description`). */
|
|
26
|
+
description?: ReactNode;
|
|
27
|
+
/** What it includes, with a check each (Figma: `feature1`…`feature5`). Up to five reads best. */
|
|
28
|
+
features?: ReactNode[];
|
|
29
|
+
/**
|
|
30
|
+
* The highlighted plan (Figma: `recommended`): the surface inverts and the badge shows, half out of the top. One per
|
|
31
|
+
* Pricing.
|
|
32
|
+
*/
|
|
33
|
+
recommended?: boolean;
|
|
34
|
+
/** The badge's text when recommended. */
|
|
35
|
+
recommendedLabel?: ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* The call to action (Figma: the exposed Button): a Button, a link through asChild. The Figma uses tone="action"
|
|
38
|
+
* variant="outline" on a plain plan and tone="inverse" on the recommended one.
|
|
39
|
+
*/
|
|
40
|
+
cta?: ReactNode;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* PricingPlan — Figma [RDS] Blocks/.pricing/plan. The card of one plan: name, price and period, the sentence, the
|
|
44
|
+
* call to action and the list of features. Inside a Pricing, or alone. Styles: pricing.css.
|
|
45
|
+
*/
|
|
46
|
+
declare function PricingPlan({ name, price, period, description, features, recommended, recommendedLabel, cta, className, ...rest }: PricingPlanProps): react.JSX.Element;
|
|
47
|
+
|
|
48
|
+
export { Pricing, PricingPlan, type PricingPlanProps, type PricingProps };
|
|
@@ -0,0 +1,64 @@
|
|
|
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 { Children, useId } from "react";
|
|
9
|
+
import { Badge } from "./badge.js";
|
|
10
|
+
import { BlockHeading } from "./internal/block.js";
|
|
11
|
+
import { CheckIcon } from "./internal/icons.js";
|
|
12
|
+
function Pricing(_a) {
|
|
13
|
+
var _b = _a, { eyebrow, title, description, children, className } = _b, rest = __objRest(_b, ["eyebrow", "title", "description", "children", "className"]);
|
|
14
|
+
const titleId = useId();
|
|
15
|
+
return /* @__PURE__ */ jsx("section", __spreadProps(__spreadValues({ "aria-labelledby": titleId }, rest), { className: ["rds-block", "rds-pricing", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsxs("div", { className: "rds-block__inner", children: [
|
|
16
|
+
/* @__PURE__ */ jsx(BlockHeading, { eyebrow, title, description, titleId }),
|
|
17
|
+
/* @__PURE__ */ jsx("ul", { className: "rds-pricing__plans", children: Children.toArray(children).map((plan, i) => /* @__PURE__ */ jsx("li", { className: "rds-pricing__slot", children: plan }, i)) })
|
|
18
|
+
] }) }));
|
|
19
|
+
}
|
|
20
|
+
function PricingPlan(_c) {
|
|
21
|
+
var _d = _c, {
|
|
22
|
+
name,
|
|
23
|
+
price,
|
|
24
|
+
period,
|
|
25
|
+
description,
|
|
26
|
+
features = [],
|
|
27
|
+
recommended = false,
|
|
28
|
+
recommendedLabel = "Recomendado",
|
|
29
|
+
cta,
|
|
30
|
+
className
|
|
31
|
+
} = _d, rest = __objRest(_d, [
|
|
32
|
+
"name",
|
|
33
|
+
"price",
|
|
34
|
+
"period",
|
|
35
|
+
"description",
|
|
36
|
+
"features",
|
|
37
|
+
"recommended",
|
|
38
|
+
"recommendedLabel",
|
|
39
|
+
"cta",
|
|
40
|
+
"className"
|
|
41
|
+
]);
|
|
42
|
+
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({}, rest), { className: ["rds-pricing-plan", recommended && "rds-pricing-plan--recommended", className].filter(Boolean).join(" "), children: [
|
|
43
|
+
recommended && /* @__PURE__ */ jsx(Badge, { tone: "accent", className: "rds-pricing-plan__badge", children: recommendedLabel }),
|
|
44
|
+
/* @__PURE__ */ jsxs("div", { className: "rds-pricing-plan__header", children: [
|
|
45
|
+
/* @__PURE__ */ jsx("h3", { className: "rds-pricing-plan__name", children: name }),
|
|
46
|
+
/* @__PURE__ */ jsxs("div", { className: "rds-pricing-plan__price-block", children: [
|
|
47
|
+
/* @__PURE__ */ jsxs("p", { className: "rds-pricing-plan__price-row", children: [
|
|
48
|
+
/* @__PURE__ */ jsx("span", { className: "rds-pricing-plan__price", children: price }),
|
|
49
|
+
period && /* @__PURE__ */ jsx("span", { className: "rds-pricing-plan__period", children: period })
|
|
50
|
+
] }),
|
|
51
|
+
description && /* @__PURE__ */ jsx("p", { className: "rds-pricing-plan__description", children: description })
|
|
52
|
+
] })
|
|
53
|
+
] }),
|
|
54
|
+
cta && /* @__PURE__ */ jsx("div", { className: "rds-pricing-plan__cta", children: cta }),
|
|
55
|
+
features.length > 0 && /* @__PURE__ */ jsx("ul", { className: "rds-pricing-plan__features", children: features.map((feature, i) => /* @__PURE__ */ jsxs("li", { className: "rds-pricing-plan__feature", children: [
|
|
56
|
+
/* @__PURE__ */ jsx("span", { className: "rds-pricing-plan__check", "aria-hidden": "true", children: /* @__PURE__ */ jsx(CheckIcon, {}) }),
|
|
57
|
+
/* @__PURE__ */ jsx("span", { children: feature })
|
|
58
|
+
] }, i)) })
|
|
59
|
+
] }));
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
Pricing,
|
|
63
|
+
PricingPlan
|
|
64
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/** task: something moving to the end (upload, import). measure: a value inside a known range (quota used). */
|
|
5
|
+
type ProgressKind = 'task' | 'measure';
|
|
6
|
+
type ProgressSize = 'default' | 'sm';
|
|
7
|
+
interface ProgressProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
8
|
+
/** 0 to `max` (Figma: `value`, 0 to 100 in steps of 5; the code takes any value). */
|
|
9
|
+
value: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
/** What the bar measures (Figma: `label`). Always required: hidden with `showLabel={false}`, it still names the bar. */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Show the label above the bar (Figma: `showLabel`). */
|
|
14
|
+
showLabel?: boolean;
|
|
15
|
+
/** Show the value on the right (Figma: `showValue`). */
|
|
16
|
+
showValue?: boolean;
|
|
17
|
+
/** The value as text, shown and read ("75%", "750 de 1.000"). Defaults to the percentage. */
|
|
18
|
+
valueText?: ReactNode;
|
|
19
|
+
/** task → role="progressbar"; measure → role="meter". */
|
|
20
|
+
kind?: ProgressKind;
|
|
21
|
+
/** default: 8px bar; sm: 4px, for dense lists (Figma: `size`). */
|
|
22
|
+
size?: ProgressSize;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Progress — Figma [RDS] Indicators/Progress. A bar with a value: the track is the brand tint, the fill the first
|
|
26
|
+
* data colour. A wait without a known end is the Spinner. Styles: progress.css.
|
|
27
|
+
*/
|
|
28
|
+
declare function Progress({ value, max, label, showLabel, showValue, valueText, kind, size, className, ...rest }: ProgressProps): react.JSX.Element;
|
|
29
|
+
|
|
30
|
+
export { Progress, type ProgressKind, type ProgressProps, type ProgressSize };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__objRest,
|
|
4
|
+
__spreadProps,
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "../chunk-ORMEWXMH.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useId } from "react";
|
|
9
|
+
function Progress(_a) {
|
|
10
|
+
var _b = _a, {
|
|
11
|
+
value,
|
|
12
|
+
max = 100,
|
|
13
|
+
label,
|
|
14
|
+
showLabel = true,
|
|
15
|
+
showValue = true,
|
|
16
|
+
valueText,
|
|
17
|
+
kind = "task",
|
|
18
|
+
size = "default",
|
|
19
|
+
className
|
|
20
|
+
} = _b, rest = __objRest(_b, [
|
|
21
|
+
"value",
|
|
22
|
+
"max",
|
|
23
|
+
"label",
|
|
24
|
+
"showLabel",
|
|
25
|
+
"showValue",
|
|
26
|
+
"valueText",
|
|
27
|
+
"kind",
|
|
28
|
+
"size",
|
|
29
|
+
"className"
|
|
30
|
+
]);
|
|
31
|
+
const labelId = useId();
|
|
32
|
+
const clamped = Math.min(Math.max(value, 0), max);
|
|
33
|
+
const percent = max > 0 ? clamped / max * 100 : 0;
|
|
34
|
+
const text = valueText != null ? valueText : `${Math.round(percent)}%`;
|
|
35
|
+
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({}, rest), { className: ["rds-progress", `rds-progress--${size}`, className].filter(Boolean).join(" "), children: [
|
|
36
|
+
(showLabel || showValue) && /* @__PURE__ */ jsxs("div", { className: "rds-progress__row", children: [
|
|
37
|
+
showLabel && /* @__PURE__ */ jsx("span", { id: labelId, className: "rds-progress__label", children: label }),
|
|
38
|
+
showValue && /* @__PURE__ */ jsx("span", { className: "rds-progress__value", "aria-hidden": "true", children: text })
|
|
39
|
+
] }),
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
"div",
|
|
42
|
+
__spreadProps(__spreadValues({
|
|
43
|
+
className: "rds-progress__track",
|
|
44
|
+
role: kind === "task" ? "progressbar" : "meter",
|
|
45
|
+
"aria-valuenow": clamped,
|
|
46
|
+
"aria-valuemin": 0,
|
|
47
|
+
"aria-valuemax": max,
|
|
48
|
+
"aria-valuetext": typeof text === "string" ? text : void 0
|
|
49
|
+
}, showLabel ? { "aria-labelledby": labelId } : { "aria-label": label }), {
|
|
50
|
+
children: /* @__PURE__ */ jsx("div", { className: "rds-progress__fill", style: { width: `${percent}%` } })
|
|
51
|
+
})
|
|
52
|
+
)
|
|
53
|
+
] }));
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
Progress
|
|
57
|
+
};
|
|
@@ -2,18 +2,23 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
interface QRDisplayProps {
|
|
5
|
-
/**
|
|
5
|
+
/** The QR image, a data URL (PNG) or a URL. The caller generates it: the design system does not draw QR codes. */
|
|
6
6
|
src: string;
|
|
7
|
-
/**
|
|
7
|
+
/** What the code is, for screen readers ("QR Code do Pix de R$ 50,00"). */
|
|
8
8
|
alt?: string;
|
|
9
|
-
/**
|
|
9
|
+
/** The side in px. Render it 1:1 with the generated size, so it does not blur. */
|
|
10
10
|
size?: number;
|
|
11
|
-
/**
|
|
11
|
+
/** A short line under the code (an instruction). */
|
|
12
12
|
caption?: ReactNode;
|
|
13
|
-
/**
|
|
13
|
+
/** Between the code and the caption, such as a CopyField. */
|
|
14
14
|
children?: ReactNode;
|
|
15
15
|
className?: string;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* QRDisplay — a composition of the Card (Figma [RDS] Content/Card): the QR code centred, what goes with it and a
|
|
19
|
+
* caption. It knows nothing of what the code means. The quiet zone comes with the image: generate it with its
|
|
20
|
+
* white margin (4 modules), because in dark mode the card around it is dark. Styles: qr-display.css.
|
|
21
|
+
*/
|
|
22
|
+
declare function QRDisplay({ src, alt, size, caption, children, className }: QRDisplayProps): react.JSX.Element;
|
|
18
23
|
|
|
19
24
|
export { QRDisplay, type QRDisplayProps };
|
|
@@ -1,28 +1,12 @@
|
|
|
1
1
|
import "../chunk-ORMEWXMH.js";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
caption,
|
|
8
|
-
children,
|
|
9
|
-
className = ""
|
|
10
|
-
}) {
|
|
11
|
-
return /* @__PURE__ */ jsxs("div", { className: ["flex flex-col items-center gap-4", className].join(" "), children: [
|
|
12
|
-
/* @__PURE__ */ jsx("div", { className: "rounded-(--radius-card) bg-white p-4 shadow-sm", children: /* @__PURE__ */ jsx(
|
|
13
|
-
"img",
|
|
14
|
-
{
|
|
15
|
-
src,
|
|
16
|
-
alt,
|
|
17
|
-
width: size,
|
|
18
|
-
height: size,
|
|
19
|
-
style: { width: size, height: size },
|
|
20
|
-
className: "block"
|
|
21
|
-
}
|
|
22
|
-
) }),
|
|
3
|
+
import { Card, CardContent } from "./card.js";
|
|
4
|
+
function QRDisplay({ src, alt = "QR Code", size = 240, caption, children, className }) {
|
|
5
|
+
return /* @__PURE__ */ jsx(Card, { as: "div", className: ["rds-qr-display", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsxs(CardContent, { className: "rds-qr-display__content", children: [
|
|
6
|
+
/* @__PURE__ */ jsx("img", { className: "rds-qr-display__code", src, alt, width: size, height: size }),
|
|
23
7
|
children,
|
|
24
|
-
caption && /* @__PURE__ */ jsx("
|
|
25
|
-
] });
|
|
8
|
+
caption && /* @__PURE__ */ jsx("p", { className: "rds-qr-display__caption", children: caption })
|
|
9
|
+
] }) });
|
|
26
10
|
}
|
|
27
11
|
export {
|
|
28
12
|
QRDisplay
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { FormHTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* How the person answers. single: Radio children (the RadioGroup is made here, named by the question); card:
|
|
6
|
+
* ChoiceCard children (the ChoiceCardGroup); multiple: Checkbox children (the CheckboxGroup); text: an Input or a
|
|
7
|
+
* Textarea child, with its own label.
|
|
8
|
+
*/
|
|
9
|
+
type QuestionnaireAnswer = 'single' | 'card' | 'multiple' | 'text';
|
|
10
|
+
interface QuestionnaireProps extends Omit<FormHTMLAttributes<HTMLFormElement>, 'title' | 'onSubmit'> {
|
|
11
|
+
/** This question's number, from 1. */
|
|
12
|
+
step: number;
|
|
13
|
+
/** How many questions. On the last one the next button becomes "Enviar". */
|
|
14
|
+
steps: number;
|
|
15
|
+
/** The question (Figma: `title`). It names the form and the group of options. */
|
|
16
|
+
title: string;
|
|
17
|
+
/** How to answer (Figma: `showDescription` + `description`). */
|
|
18
|
+
description?: ReactNode;
|
|
19
|
+
answer?: QuestionnaireAnswer;
|
|
20
|
+
/** The options, or the field (Figma: slot `choices`). */
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
/** With `single` and `card`: the chosen value, controlled or at first, and the change. */
|
|
23
|
+
value?: string;
|
|
24
|
+
defaultValue?: string;
|
|
25
|
+
onValueChange?: (value: string) => void;
|
|
26
|
+
/** What is missing (Figma: `showError` + `error`). Tied to the options and announced. */
|
|
27
|
+
error?: ReactNode;
|
|
28
|
+
/** The back button, "Voltar" (Figma: `showBack`). */
|
|
29
|
+
onBack?: () => void;
|
|
30
|
+
/** The skip button, "Pular", only on an optional question (Figma: `showSkip`). */
|
|
31
|
+
onSkip?: () => void;
|
|
32
|
+
/** The next button ("Próxima", or "Enviar" on the last question). Enter in a field also runs it. */
|
|
33
|
+
onNext: () => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Questionnaire — Figma [RDS] Chat/Questionnaire. One question at a time, inside the conversation: the assistant
|
|
37
|
+
* asks and the person chooses. Progress on top ("Pergunta 2 de 4"), the question, the options, the error and the
|
|
38
|
+
* actions. Styles: questionnaire.css.
|
|
39
|
+
*/
|
|
40
|
+
declare function Questionnaire({ step, steps, title, description, answer, children, value, defaultValue, onValueChange, error, onBack, onSkip, onNext, className, ...rest }: QuestionnaireProps): react.JSX.Element;
|
|
41
|
+
|
|
42
|
+
export { Questionnaire, type QuestionnaireAnswer, type QuestionnaireProps };
|